diff -Nru mapnik-2.1.0/.travis.yml mapnik-2.2.0/.travis.yml --- mapnik-2.1.0/.travis.yml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/.travis.yml 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,21 @@ +language: cpp + +compiler: clang + +before_install: + - echo 'yes' | sudo add-apt-repository ppa:mapnik/boost + - sudo apt-get update -qq + - sudo apt-get install -qq libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-system-dev libboost-thread-dev python-nose libicu-dev libpng-dev libjpeg-dev libtiff-dev libz-dev libfreetype6-dev libxml2-dev libproj-dev + +script: + - ./configure DEMO=False BINDINGS='python' CPP_TESTS=False CAIRO=False INPUT_PLUGINS='' OPTIMIZATION=1 FAST=True && JOBS=2 make + +branches: + only: + - master + +notifications: + irc: + channels: + - "irc.freenode.org#mapnik" + use_notice: true diff -Nru mapnik-2.1.0/CHANGELOG.md mapnik-2.2.0/CHANGELOG.md --- mapnik-2.1.0/CHANGELOG.md 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/CHANGELOG.md 2013-06-04 01:35:26.000000000 +0000 @@ -6,6 +6,173 @@ For a complete change history, see the git log. +## 2.2.0 + +Released June 3rd, 2013 + +(Packaged from 9231205) + +Summary: The 2.2.0 release is primarily a performance and stability release. The code line represents development in the master branch since the release of 2.1.0 in Aug 2012 and therefore includes nearly a year of bug-fixes and optimizations. Nearly 500 new tests have been added bring the total coverage to 925. Shapefile and PostGIS datasources have benefited from numerous stability fixes, 64 bit integer support has been added to support OSM data in the grid renderer and in attribute filtering, and many fixes have landed for higher quality output when using a custom `scale_factor` during rendering. Critical code paths have been optimized include raster rendering, xml map loading, string to number conversion, vector reprojection when using `epsg:4326` and `epsg:3857`, `hextree` encoding, halo rendering, and rendering when using a custom `gamma`. Mapnik 2.2 also compiles faster than previous releases in the 2.x series and drops several unneeded and hard to install dependencies making builds on OS X and Windows easier than any previous release. + +- Removed 3 depedencies without loosing any functionality: `ltdl`, `cairomm` and `libsigc++` (#1804,#806,#1681) + +- Added 64 bit integer support in expressions, feature ids, and the grid_renderer (#1661,#1662,#1662) + +- Added the ability to disable the need for various dependencies: `proj4`, `libpng`, `libtiff`, `libjpeg` + +- Added faster reprojection support between `epsg:3857` and `epsg:4326` (#1705,#1703,#1579) + +- Fixed concurrency problem when using cursors in postgis plugin (#1823,#1588) + +- Fixed postgres connection pool leaks when using `persist_connection=false` (#1764) + +- Fixed postgres connection key to respect highest value of `max_size` and `initial_size` for any layer in map (#1599) + +- Fixed potential crash in wkb parsing when postgis returns null geometry (#1843) + +- Fixed blurry rendering of image and SVG icons (#1316) + +- Added detection of invalid srs values when loading xml (#646) + +- Added support for specifying a base_path as a third, optional argument to load_xml + +- Removed muffling of projection errors while rendering (#646) + +- Improved logging system (https://github.com/mapnik/mapnik/wiki/Logging) + +- Added support for reading images from in memory streams (#1805) + +- Optimized halo rendering. When halo radius is < 1 new method will be used automatically (#1781) + +- Added `text-halo-rasterizer` property. Set to `fast` for lower quality but faster + halo rendering (#1298) which matched new default method when radius is < 1. + +- Added support in `shape`, `sqlite`, `geojson`, and `csv` plugin for handling non-latin characters in the paths to file-based resources (#1177) + +- Fixed rendering of markers when their size is greater than the specified `spacing` value (#1487) + +- Fixed handling of alpha premultiplication in image scaling (#1489) + +- Optimized rendering when a style with no symbolizers is encountered (#1517) + +- Optimized string handling and type conversion by removing `boost::to_lower`, `boost::trim`, and `boost::lexical_cast` usage (#1687,#1687,#1633) + +- Optimized alpha preserving `hextree` method for quantization of png images (#1629) + +- Faster rendering of rasters by reducing memory allocation of temporary buffers (#1516) + +- Fixed some raster reprojection artifacts (#1501) + +- Fixed raster alignment when width != height and raster is being scaled (#1748,#1622) + +- Added support for caching rasters for re-use during rendering when styling more than once per layer (#1543) + +- Improved compile speeds of the code - in some cases by up to 2x and removed need for freetype dependency when building code against mapnik (#1688, #1756) + +- Removed internal rule cache on `mapnik::Map` c++ object (#1723) + +- Improved the scaled rendering of various map features when using `scale_factor` > 1 (#1280,#1100,#1273,#1792,#1291,#1344,#1279,#1624,#1767,#1766) + +- Added C++ api for overriding scale_denominator to enable rendering at fixed scale (#1582) + +- Added Layer `buffer-size` that can be used to override Map `buffer-size` to avoid + over-fetching of data that does not need to be buffered as much as other layers. + Map level `buffer-size` will be default if layers do not set the option. Renamed a + previously undocumented parameter by the same name that impacted clipping extent and + was not needed (clipping padding should likely be a symbolizer level option) (#1566) + +- Fixed potential file descriptor leaks in image readers when invalid images were encountered (#1783) + +- Fixed alpha handling in the `blur` and `invert` image filters (#1541) + +- Fixed error reporting in the python plugin (#1422) + +- Added the ability to run tests without installing with `make test-local` + +- Reduced library binary size by adding support for `-fvisibility-inlines-hidden` and `-fvisibility=hidden` (#1826,#1832) + +- Added `mapnik::map_request` class, a special object to allow passing mutable map objects to renderer (#1737) + +- Added the ability to use `boost::hash` on `mapnik::value` types (#1729) + +- Removed obsolete `geos` plugin (functionality replaced by `csv` plugin) and unmaintained `kismet` plugin (#1809,#1833) + +- Added new `mapnik-config` flags: `--all-flags`, `--defines`, `--git-describe`, `--includes`, `--dep-includes`, `--cxxflags`, `--cxx` (#1443) + +- Added support for unicode strings as arguments in python bindings (#163) + +- Added DebugSymbolizer which is able to render the otherwise invisible collision boxes (#1366) + +- Optimized rendering by reducing overhead of using `gamma` property (#1174) + +- Fixed rendering artifacts when using `polygon-gamma` or `line-gamma` equal to 0 (#761,#1763) + +- Fixed and optimized the display of excessive precision of some float data in labels (#430,#1697) + +- Removed the `bind` option for datasources (#1654) + +- Added ability to access style list from map by (name,obj) in python (#1725) + +- Added `is_solid` method to python mapnik.Image and mapnik.ImageView classes (#1728) + +- Changed scale_denominator C++ interface to take scale as first argument rather than map. + +- Added support for `background-image` in cairo_renderer (#1724) + +- Fixed building symbolizer rendering to be fully sensitive to alpha (8b66128c892 / bc8ea1c5a7a) + +- `[attr]` now returns false if attr is an empty string (#1665) + +- `[attr]!=null` now returns true if attr is not null (#1642) + +- Added support for DBF `Logical` type: #1614 + +- Added serialization of `line-offset` to save_map (#1562) + +- Enabled default input plugin directory and fonts path to be set inherited from environment settings in + python bindings to make it easier to run tests locally (#1594). New environment settings are: + - MAPNIK_INPUT_PLUGINS_DIRECTORY + - MAPNIK_FONT_DIRECTORY + +- Added support for controlling rendering behavior of markers on multi-geometries `marker-multi-policy` (#1555,#1573) + +- Added alternative PNG/ZLIB implementation (`miniz`) that can be enabled with `e=miniz` (#1554) + +- Added support for setting zlib `Z_FIXED` strategy with format string: `png:z=fixed` + +- Fixed handling of transparency level option in `octree` png encoding (#1556) + +- Added ability to pass a pre-created collision detector to the cairo renderer (#1444) + +- Tolerance parameter is now supported for querying datasources at a given point (#503/#1499) + +- Improved detection of newlines in CSV files - now more robust in the face of mixed newline types (#1497) + +- Allow style level compositing operations to work outside of featureset extents across tiled requests (#1477) + +- Support for encoding `literal` postgres types as strings 69fb17cd3/#1466 + +- Fixed zoom_all behavior when Map maximum-extent is provided. Previously maximum-extent was used outright but + now the combined layer extents will be again respected: they will be clipped to the maximum-extent if possible + and only when back-projecting fails for all layers will the maximum-extent be used as a fallback (#1473) + +- Compile time flag called `PLUGIN_LINKING` to allow input datasource plugins to be statically linked with the mapnik library (#249) + +- Fixed `dasharray` rendering in cairo backend (#1740) + +- Fixed handling of `opacity` in svg rendering (#1744) + +- Fixed uneven rendering of markers along lines (#1693) + +- Fixed handling of extra bytes in some shapefile fields (#1605) + +- Fixed handling (finally) of null shapes and partially corrupt shapefiles (#1630,#1621) + +- Added ability to re-use `mapnik::image_32` and `mapnik::grid` by exposing a `clear` method (#1571) + +- Added support for writing RGB (no A) png images by using the format string of `png:t=0` (#1559) + +- Added experimental support for geometry simplification at symbolizer level (#1385) ## Mapnik 2.1.0 @@ -53,12 +220,12 @@ - Added support for setting opacity dynamically on images in polygon pattern and markers symbolizers -- Added support for filtering on a features geometry type, either `point`, `linestring`, 'polygon`, +- Added support for filtering on a features geometry type, either `point`, `linestring`, `polygon`, or `collection` using the expression keyword of `[mapnik::geometry_type]` (#546) - MarkersSymbolizer width and height moved to expressions (#1102) -- PostGIS: Added 'simplify_geometries' option - will trigger ST_Simplify on geometries before returning to Mapnik (#1179) +- PostGIS: Added `simplify_geometries` option - will trigger ST_Simplify on geometries before returning to Mapnik (#1179) - Improved error feedback for invalid values passed to map.query_point @@ -67,18 +234,18 @@ - Improved logging/debugging system with release logs and file redirection (https://github.com/mapnik/mapnik/wiki/Runtime-Logging) (#937 and partially #986, #467) - GDAL: allow setting nodata value on the fly (will override value if nodata is set in data) (#1161) - + - GDAL: respect nodata for paletted/colormapped images (#1160) -- PostGIS: Added a new option called 'autodetect_key_field' (by default false) that if true will - trigger autodetection of a given tables' primary key allowing for feature.id() to represent - globally unique ids. This option has no effect if the user has not manually supplied the 'key_field' option. (#804) +- PostGIS: Added a new option called `autodetect_key_field` (by default false) that if true will + trigger autodetection of the table primary key allowing for feature.id() to represent + globally unique ids. This option has no effect if the user has not manually supplied the `key_field` option. (#804) - Cairo: Add full rendering support for markers to match AGG renderer functionality (#1071) - Fix Markers rendering so that ellipse height/width units are pixels (previously were unintentionally radii) (#1134) -- Added 'ignore-placement` attribute to markers-symbolizer (#1135) +- Added `ignore-placement` attribute to markers-symbolizer (#1135) - Removed PointDatasource - use more robust MemoryDatasource instead (#1032) @@ -94,6 +261,8 @@ - Added support for justify-alignment=auto. This is the new default. (#1125) +- Added support for grouped rendering using the `group-by` layer option: https://github.com/mapnik/mapnik/wiki/Grouped-rendering + ## Mapnik 2.0.2 @@ -121,7 +290,7 @@ - Fixed possible breakage registering plugins via python if a custom PREFIX or DESTDIR was used (e.g. macports/homebrew) (#1171) -- Fixed memory leak in the case of proj >= 4.8 and a projection initialization error (#1173) +- Fixed memory leak in the case of proj >= 4.8 and a projection initialization error (#1173) ## Mapnik 2.0.1 @@ -142,7 +311,7 @@ - Fix Markers rendering so that ellipse height/width units are pixels (previously were unintentially radii) (#1134) -- Added 'ignore-placement` attribute to markers-symbolizer (#1135) +- Added `ignore-placement` attribute to markers-symbolizer (#1135) - Removed svn_revision info from mapnik-config and python bindings as git is now used @@ -152,7 +321,7 @@ - Workaround for boost interprocess compile error with recent gcc versions (#950,#1001,#1082) -- Fix possible memory corruption when using hextree mode for png color reduction (#1087) +- Fix possible memory corruption when using `hextree` mode for png color reduction (#1087) - Fixed bug in shield line placement when dx/dy are used to shift the label relative to the placement point (Matt Amos) (#908) @@ -192,13 +361,13 @@ from a file that files directory is used. And a custom value can still be passed as an argument to load_map_from_string(). -- Added python function 'render_grid' to allow conversion of grid buffer to python object containing list of grid +- Added python function `render_grid` to allow conversion of grid buffer to python object containing list of grid pixels, list of keys, and a and dictionary of feature attributes. - Added new rendering backend, grid_renderer, that collects the attributes of rendered features and burns their ids into a grid buffer. -- Added optional 'maximum-extent' parameter to map object. If set will be used, instead of combined +- Added optional `maximum-extent` parameter to map object. If set will be used, instead of combined layer extents, for return value of map.zoom_all(). Useful in cases where the combined layer extents cannot possibly be projected into the map srs or the user wishes to control map bounds without modifying the extents of each layer. @@ -211,9 +380,9 @@ - Added support for drawing only first matching rule using filter-mode="first" in Style (#706) -- Added support to PointSymbolizer ('ignore_placement') for skipping adding placed points to collision detector (#564) +- Added support to PointSymbolizer (`ignore_placement`) for skipping adding placed points to collision detector (#564) -- Added ability to register fonts within XML using Map level 'font_directory' parameter (#168) +- Added ability to register fonts within XML using Map level `font-directory` parameter (#168) - TextSymbolizer: Change text_convert to text_transform to better match css naming (r2211) @@ -221,8 +390,8 @@ - Upgraded to the latest proj4 string literal for EPSG:4326 (WGS84) as global default projection (#333) -- Added 'mapnik_version_from_string()' function in python bindings to easily convert string representation - of version number to the integer format used in 'mapnik/version.hpp'. e.g. '0.7.1' --> 701. +- Added `mapnik_version_from_string()` function in python bindings to easily convert string representation + of version number to the integer format used in `mapnik/version.hpp`. e.g. `0.7.1` --> `701`. - Added xinclude (http://www.w3.org/TR/xinclude/) support to libxml2-based xml parser (oldtopos) (#567) @@ -230,7 +399,7 @@ - Added support for setting global alignment of polygon pattern fills (#203) -- Added support for choosing OGR layer by index number using 'layer_by_index' parameter (r1904) +- Added support for choosing OGR layer by index number using `layer_by_index` parameter (r1904) - Added support for fractional halo widths (using FT Stroker) (#93) @@ -292,7 +461,7 @@ - Various fixes to sqlite, ogr, and occi driver backported from trunk. -- Ensured that '\n' triggers linebreaks in text rendering (#584) +- Ensured that `\n` triggers linebreaks in text rendering (#584) - Support for boost filesystem v3 @@ -311,13 +480,13 @@ - XML: Save map buffer_size when serializing map. -- SCons: Added new build options 'PRIORITIZE_LINKING' and 'LINK_PRIORITY'. The first is a boolean (default True) +- SCons: Added new build options `PRIORITIZE_LINKING` and `LINK_PRIORITY`. The first is a boolean (default True) of whether to use the new sorting implementation that gives explcit preference to custom or local paths during compile and linking that will affect builds when duplicate libraries and include directories are on the system. LINK_PRIORITY defaults to prioritizing internal sources of the mapnik source folder, then local/user installed libraries over system libraries, but the option can be customized. Sorting not only ensures that compiling and linking will more likely match the desired libraries but also gives more likelyhood to avoid - the scenario where libraries are linked that don't match the includes libmapnik compiled against. + the scenario where libraries are linked that don`t match the includes libmapnik compiled against. - XML: Fixed behavior of PolygonPatternSymbolizer and LinePatternSymbolizer whereby width, height, and type of images is actually allowed to be optionally ommitted ([#508](https://github.com/mapnik/mapnik/issues/508)). This was added in r1543 but @@ -332,14 +501,14 @@ - PNG: fixed png256 for large images and some improvements to reduce color corruptions ([#522](https://github.com/mapnik/mapnik/issues/522)) -- PNG: Added new quantization method for indexed png format using hextree with full support for alpha +- PNG: Added new quantization method for indexed png format using `hextree` with full support for alpha channel. Also new method has some optimizations for color gradients common when using elevation based - rasters. By default old method using octree is used. (r1680, r1683, [#477](https://github.com/mapnik/mapnik/issues/477)) + rasters. By default old method using `octree` is used. (r1680, r1683, [#477](https://github.com/mapnik/mapnik/issues/477)) - PNG: Added initial support for passing options to png writter like number of colors, transparency support, quantization method and possibly other in future using type parameter. For example "png8:c=128:t=1:m=h" limits palette to 128 colors, uses only binary transparency (0 - none, - 1 - binary, 2 - full), and new method of quantization using hextree (h - hextree, o - octree). + 1 - binary, 2 - full), and new method of quantization using `hextree` (h - `hextree`, o - `octree`). Existing type "png256" can be also written using "png8:c=256:m=o:t=2" (r1680, r1683, [#477](https://github.com/mapnik/mapnik/issues/477)) @@ -357,26 +526,26 @@ * Use the gdaladdo utility to add overviews to existing GDAL datasets -- PostGIS: Added an optional 'geometry_table' parameter. The 'geometry_table' used by Mapnik to look up - metadata in the geometry_columns and calculate extents (when the 'geometry_field' and 'srid' parameters - are not supplied). If 'geometry_table' is not specified Mapnik will attempt to determine the name of the - table to query based on parsing the 'table' parameter, which may fail for complex queries with more than - one 'from' keyword. Using this parameter should allow for existing metadata and table indexes to be used - while opening the door to much more complicated subqueries being passed to the 'table' parameter without +- PostGIS: Added an optional `geometry_table` parameter. The `geometry_table` used by Mapnik to look up + metadata in the geometry_columns and calculate extents (when the `geometry_field` and `srid` parameters + are not supplied). If `geometry_table` is not specified Mapnik will attempt to determine the name of the + table to query based on parsing the `table` parameter, which may fail for complex queries with more than + one `from` keyword. Using this parameter should allow for existing metadata and table indexes to be used + while opening the door to much more complicated subqueries being passed to the `table` parameter without failing (#260, #426). -- PostGIS Plugin: Added optional 'geometry_field' and 'srid' parameters. If specified these will allow +- PostGIS Plugin: Added optional `geometry_field` and `srid` parameters. If specified these will allow Mapnik to skip several queries to try to determine these values dynamically, and can be helpful to avoid possible query failures during metadata lookup with complex subqueries as discussed in #260 and #436, but - also solvable by specifying the 'geometry_table' parameter. (r1300,#376) + also solvable by specifying the `geometry_table` parameter. (r1300,#376) -- PostGIS: Added an optional 'extent_from_subquery' parameter that when true (while the 'extent' parameter is - not provided and 'estimate_extent' is false) will direct Mapnik to calculate the extent upon the exact table - or sql provided in the 'table' parameter. If a sub-select is used for the table parameter then this will, +- PostGIS: Added an optional `extent_from_subquery` parameter that when true (while the `extent` parameter is + not provided and `estimate_extent` is false) will direct Mapnik to calculate the extent upon the exact table + or sql provided in the `table` parameter. If a sub-select is used for the table parameter then this will, in cases where the subquery limits results, provide a faster and more accurate layer extent. It will have - no effect if the 'table' parameter is simply an existing table. This parameter is false by default. (#456) + no effect if the `table` parameter is simply an existing table. This parameter is false by default. (#456) -- PostGIS Plugin: Added '!bbox!' token substitution ability in sql query string. This opens the door for various +- PostGIS Plugin: Added `!bbox!` token substitution ability in sql query string. This opens the door for various complex queries that may aggregate geometries to be kept fast by allowing proper placement of the bbox query to be used by indexes. (#415) @@ -392,7 +561,7 @@ (Select * from table where geom && !bbox!) as map -- PostGIS Plugin: Added 'scale_denominator' substitution ability in sql query string (#415/#465) +- PostGIS Plugin: Added `scale_denominator` substitution ability in sql query string (#415/#465) * Pass the scale_denominator token inside a subquery like: !scale_denominator! @@ -400,7 +569,7 @@ - PostGIS Plugin: Added support for quoted table names (r1454) (#393) -- PostGIS: Add a 'persist_connection' option (default true), that when false will release +- PostGIS: Add a `persist_connection` option (default true), that when false will release the idle psql connection after datasource goes out of scope (r1337) (#433,#434) - PostGIS: Added support for BigInt (int8) postgres type (384) @@ -421,19 +590,19 @@ - PNG: Added support for semi-transparency in png256 output (#477,#202) -- PolygonSymbolizer: Added 'gamma' attribute to allow for dilation of polygon edges - a solution +- PolygonSymbolizer: Added `gamma` attribute to allow for dilation of polygon edges - a solution to gap artifacts or "ghost lines" between adjacent polygons and allows for slight sharpening of the edges of non overlapping polygons. Accepts any values but 0-1 is the recommended range. -- TextSymbolizer: Large set of new attributes: 'text_transform', 'line_spacing', 'character_spacing', - 'wrap_character', 'wrap_before', 'horizontal_alignment', 'justify_alignment', and 'opacity'. +- TextSymbolizer: Large set of new attributes: `text_transform`, `line_spacing`, `character_spacing`, + `wrap_character`, `wrap_before`, `horizontal_alignment`, `justify_alignment`, and `opacity`. * More details at changesets: r1254 and r1341 -- SheildSymbolizer: Added special new attributes: 'unlock_image', 'VERTEX' placement, 'no_text' and many - attributes previously only supported in the TextSymbolizer: 'allow_overlap', 'vertical_alignment', - 'horizontal_alignment', 'justify_alignment', 'wrap_width', 'wrap_character', 'wrap_before', 'text_transform', - 'line_spacing', 'character_spacing', and 'opacity'. +- SheildSymbolizer: Added special new attributes: `unlock_image`, `VERTEX` placement, `no_text` and many + attributes previously only supported in the TextSymbolizer: `allow_overlap`, `vertical_alignment`, + `horizontal_alignment`, `justify_alignment`, `wrap_width`, `wrap_character`, `wrap_before`, `text_transform`, + `line_spacing`, `character_spacing`, and `opacity`. * More details at changeset r1341 @@ -441,42 +610,42 @@ - XML: Fixed memory leak in libxml2 implementation (#473) -- XML: Added function to serialize map to string, called 'mapnik.save_map_to_string()' (#396) +- XML: Added function to serialize map to string, called `mapnik.save_map_to_string()` (#396) -- XML: Added parameter to called 'minimum_version' to allow for enforcing the minimum Mapnik version +- XML: Added parameter to called `minimum_version` to allow for enforcing the minimum Mapnik version needed for XML features used in the mapfiles. Uses Major.Minor.Point syntax, for example would throw an error if the user is running Mapnik less than 0.6.1. -- XML: Added support for relative paths when using entities and 'mapnik.load_map_from_string()' (#440) +- XML: Added support for relative paths when using entities and `mapnik.load_map_from_string()` (#440) - XML: Made width and height optional for symbolizers using images (r1543) - XML: Ensured that default values for layers are not serialized in save_map() (r1366) -- XML: Added missing serialization of PointSymbolizer 'opacity' and 'allow_overlap' attributes (r1358) +- XML: Added missing serialization of PointSymbolizer `opacity` and `allow_overlap` attributes (r1358) - XML: Default text vertical_alignment now dependent on dy (#485, r1527) -- Python: Exposed ability to write to Cairo formats using 'mapnik.render_to_file()' and without pycairo (#381) +- Python: Exposed ability to write to Cairo formats using `mapnik.render_to_file()` and without pycairo (#381) - Python: Fixed potential crash if pycairo support is enabled but python-cairo module is missing (#392) -- Python: Added 'mapnik.has_pycairo()' function to test for pycairo support (r1278) (#284) +- Python: Added `mapnik.has_pycairo()` function to test for pycairo support (r1278) (#284) -- Python: Added 'mapnik.register_plugins()' and 'mapnik.register_fonts()' functions (r1256) +- Python: Added `mapnik.register_plugins()` and `mapnik.register_fonts()` functions (r1256) - Python: Pickling support for point_symbolizer (r1295) (#345) - Python: Ensured mapnik::config_errors now throw RuntimeError exception instead of UserWarning exception (#442) -- Filters: Added support for '!=' as an alias to '<>' for not-equals filters (avoids <>) (r1326) (#427) +- Filters: Added support for `!=` as an alias to `<>` for not-equals filters (avoids <>) (r1326) (#427) - SCons: Improved boost auto-detection (r1255,r1279) - SCons: Fixed support for JOBS=N and FAST=True to enable faster compiling (r1440) - SCons: Ensured that -h or --help will properly print help on custom Mapnik options before a user - has been able to properly run 'configure'. (r1514) + has been able to properly run `configure`. (r1514) - SCons: Added ability to link to custom icu library name using ICU_LIB_NAME (r1414) @@ -491,7 +660,7 @@ (Packaged from r1247/353ff576c7) -- Plugins: expose list of registered plugins as a 'plugin_names()' method of DatasourceCache (r1180) +- Plugins: expose list of registered plugins as a `plugin_names()` method of DatasourceCache (r1180) - XML: Fixed serialization and parsing bugs related to handling of integers and Enums (#328,#353) @@ -531,13 +700,13 @@ - Python: Pickling support for raster_symbolizer (r1154) (#345) -- Python: Added 'mapnik.has_cairo()' function to test for cairo support (r1152) (#284) +- Python: Added `mapnik.has_cairo()` function to test for cairo support (r1152) (#284) - Python: Exposed dash_array get method (r1151) (#317) - Python: Pickling support for Coord objects (#345) -- GDAL Plugin: Added an experimental option to open files in 'shared mode' (r1143) +- GDAL Plugin: Added an experimental option to open files in `shared mode` (r1143) - Python: Exposed RasterSymbolizer options in Python (r1139) @@ -549,13 +718,13 @@ - XML: Ensured relative paths in XML are interpreted relative to XML file location (r1124) (#326) -- XML: Added ability to serialize all default symbolizer values by passing third argument to save_map(m,'file.xml',True)(r1117) (#327) +- XML: Added ability to serialize all default symbolizer values by passing third argument to save_map(m,`file.xml`,True)(r1117) (#327) - Core: Added support for alpha transparency when writing to png256 (patch from Marcin Rudowski) (#202) - SCons: Ensured ABI compatibility information is embedded in libmapnik.dylib on Mac OS X (#322) -- SCons: Ensured that the full 'install_name' path would be added to libmapnik.dylib on Mac OS X (#374) +- SCons: Ensured that the full `install_name` path would be added to libmapnik.dylib on Mac OS X (#374) - Tests: Added testing framework in Python using nose (r1101-r1105) @@ -580,7 +749,7 @@ - OGCServer Fixed axis-ordering for WMS 1.3.0 request (r1051) (#241) -- Plugins: Added option to all plugins to support using a 'base' path argument (r1042) +- Plugins: Added option to all plugins to support using a `base` path argument (r1042) - Symbolizers: RasterSymbolizer now support composing modes for hillshading (r1027) @@ -601,7 +770,7 @@ - Plugins: PostGIS plugin now accepts multi-line queries (r862) - Filter parsing: Allow numbers in the filter field name. - This allows for shapefiles with columns like '1970'. + This allows for shapefiles with columns like `1970`. - Plugins: Added OGR driver for reading all OGR supported formats (kunitoki) (r836) (#170) @@ -623,7 +792,7 @@ - Core: Transformation is now skipped if srs values match exactly (r777) -- Symbolizers: 'min_distance' now honored for POINT placement using Text Symbolizer (r771) +- Symbolizers: `min_distance` now honored for POINT placement using Text Symbolizer (r771) - Plugins: PostGIS plugin now accepts a geometry_field,record_limit, cursor_size options (r769,r872) diff -Nru mapnik-2.1.0/COPYING mapnik-2.2.0/COPYING --- mapnik-2.1.0/COPYING 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/COPYING 2013-06-04 01:35:26.000000000 +0000 @@ -1,8 +1,8 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -10,7 +10,7 @@ as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -55,7 +55,7 @@ that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. - + Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a @@ -111,8 +111,8 @@ "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE + + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other @@ -146,7 +146,7 @@ on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. - + 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an @@ -158,7 +158,7 @@ You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - + 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 @@ -216,7 +216,7 @@ ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - + Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. @@ -267,7 +267,7 @@ distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - + 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work @@ -329,7 +329,7 @@ accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. - + 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined @@ -370,7 +370,7 @@ restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. - + 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or @@ -422,7 +422,7 @@ the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - + 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is @@ -432,7 +432,7 @@ of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. @@ -455,8 +455,8 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS - + END OF TERMS AND CONDITIONS + How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest @@ -485,7 +485,7 @@ You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. diff -Nru mapnik-2.1.0/GIT_DESCRIBE mapnik-2.2.0/GIT_DESCRIBE --- mapnik-2.1.0/GIT_DESCRIBE 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/GIT_DESCRIBE 2013-06-04 01:36:23.000000000 +0000 @@ -0,0 +1 @@ +v2.2.0 diff -Nru mapnik-2.1.0/GIT_REVISION mapnik-2.2.0/GIT_REVISION --- mapnik-2.1.0/GIT_REVISION 2012-08-23 22:04:43.000000000 +0000 +++ mapnik-2.2.0/GIT_REVISION 2013-06-04 01:36:23.000000000 +0000 @@ -1 +1 @@ -a25aac80f7f6f044517d48404685976eb34ba1e7 +923120557365ce217b7e7008b0eaf2adec4b33e3 diff -Nru mapnik-2.1.0/INSTALL.md mapnik-2.2.0/INSTALL.md --- mapnik-2.1.0/INSTALL.md 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/INSTALL.md 2013-06-04 01:35:26.000000000 +0000 @@ -1,19 +1,27 @@ # Mapnik Installation +Mapnik is cross platform and runs on Linux, Mac OSX, Solaris, *BSD, and Windows. -## Quick Start - -To configure and build mapnik do: +To configure and build Mapnik do: ./configure make + +NOTE: the above will not work on windows, rather see https://github.com/mapnik/mapnik/wiki/WindowsInstallation + +Then to run the tests locally (without needing to install): + + make test-local + +Install like: + sudo make install If you need to uninstall do: sudo make uninstall -For more details see the 'Building' Section below. +For more details see the `Building` Section below. Platform specific install guides at https://github.com/mapnik/mapnik/wiki/Mapnik-Installation @@ -22,60 +30,54 @@ ## Depends -Mapnik is cross platform and runs on Linux, Mac OSX, Solaris, *BSD, and Windows. - -The build system should work for all posix/unix systems but for windows see: - - https://github.com/mapnik/mapnik/wiki/BuildingOnWindows - -Build dependencies are: +Build system dependencies are: * C++ compiler (like g++ or clang++) - * Python >= 2.4 * >= 2 GB RAM + * Python 2.4-2.7 + * Scons (a copy is bundled) Mapnik Core depends on: * Boost - >= 1.47 is required. - - These libraries are required: + - These libraries are used: - filesystem - system - thread (if mapnik threadsafe support is required, default on) - regex (optionally built with icu regex support) - program_options (optionally for mapnik command line programs) - * libicuuc >= 4.0 (ideally >= 4.2) - International Components for Unicode - * libpng >= 1.2.x - PNG Graphics - * libjpeg - JPEG Graphics - * libtiff - TIFF Graphics - * libz - Zlib Compression - * libfreetype - Freetype2 for Font support (Install requires freetype-config) + * libpng >= 1.2.x - PNG graphics + * libjpeg - JPEG graphics + * libtiff - TIFF graphics + * libz - Zlib compression + * libfreetype - Freetype2 for font support (Install requires freetype-config) * libxml2 - XML parsing (Install requires xml2-config) - * libproj - PROJ.4 Projection library + * libproj - PROJ.4 projection library -Mapnik Python binding depend on: +Mapnik Python bindings depend on: - * Python >= 2.4 + * Python 2.5-2.7 or >= 3.2 * Boost python +Note: Python3k is supported, see: https://github.com/mapnik/mapnik/wiki/Python3k + Optional dependencies: - * Cairo - Graphics library for PDF, PS, and SVG formats + * Cairo >= 1.6.0 - Graphics library for output formats like PDF, PS, and SVG - pkg-config - Required for building with cairo support - - libsigc++ - C++ support for cairomm - - cairomm - C++ bindings for cairo - pycairo - Python bindings for cairo * libpq - PostgreSQL libraries (For PostGIS plugin support) * libgdal - GDAL/OGR input (For gdal and ogr plugin support) - * libsqlite3 - SQLite input (needs RTree support) (sqlite plugin support) + * libsqlite3 - SQLite input (needs RTree support builtin) (sqlite plugin support) * libocci - Oracle input plugin support * libcurl - OSM input plugin support Instructions for installing many of these dependencies on -various platforms can be found at the Mapnik Community Wiki -(https://github.com/mapnik/mapnik/wiki/Mapnik-Installation). +various platforms can be found at the Mapnik Wiki: +https://github.com/mapnik/mapnik/wiki/Mapnik-Installation ## Building @@ -86,6 +88,10 @@ ./configure && make && make install +For help on what options are accepted do: + + ./configure --help + To interact with the local copy of scons directly you can do: python scons/scons.py configure @@ -98,9 +104,9 @@ make clean -If you experience odd configure errors, try resetting the SCons caches: +If you experience odd configure errors, try cleaning the configure caches: - make reset + make distclean To install in a custom location do: @@ -118,57 +124,50 @@ ./configure ICU_INCLUDES=/usr/local/include ICU_LIBS=/usr/local/include -If you want to see configure options do: - - ./configure --help - -For more details on all the options see: +For more details on usage see: https://github.com/mapnik/mapnik/wiki/UsingScons ## Testing Installation -First, try importing the Mapnik python module in a python interpreter, -and make sure it does so without errors: +You can run the Mapnik tests locally (without installing) like: + + make test-local # see the Makefile for how this works + +Or you can install and test like: - $ python - Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17) - [GCC 4.0.1 (Apple Inc. build 5465)] on darwin - Type "help", "copyright", "credits" or "license" for more information. - >>> import mapnik - >>> - -Then, try rendering the demo map, included in the Mapnik source code:: - - cd demo/python - python rundemo.py - -If the resulting maps look good, this indicates the core components of -Mapnik are installed properly, as well as the Shapefile plugin, Unicode -text support (ICU), and re-projection support using Proj. + make install && make test -For further tests see the `tests` folder within the Mapnik source code. +Many of the tests are written in python and you can run them individually like: + + make install + python tests/python_tests/shapefile_test.py ## Learning Mapnik -### Users +### Help -Visit https://github.com/mapnik/mapnik/wiki/LearningMapnik for basic tutorials on making maps with Mapnik using the Python bindings. +Mapnik has an active community of talented users and developers making beautiful maps. -### Developers +If you need help or want to participate starting points include: -Read docs/contributing.markdown for resources for getting involved with Mapnik development. +- Sign up and post to the mailing list: http://mapnik.org/contact/ +- Join and ask questions on the #mapnik channel on irc://irc.freenode.net/mapnik +- Add your help questions to https://github.com/mapnik/mapnik-support +### Cartographers -## Mapnik Community +TileMill, which uses Mapnik internally, offers great step by step tutorials for +learning advanced map styling: http://mapbox.com/tilemill/docs/crashcourse/introduction/ +### Programmers -Mapnik has an active community of talented users and developers making -amazing maps. +Mapnik is great for building your own mapping applications. Visit +https://github.com/mapnik/mapnik/wiki/LearningMapnik for basic +tutorials on how to programmatically use Mapnik. -Please feel free to subscribe to the community list and post on both -usage and development topics: http://mapnik.org/contact/ +### Contributers -You can also get involved by joining the #mapnik channel on irc://irc.freenode.net/mapnik +Read docs/contributing.markdown for resources for getting involved with Mapnik development. diff -Nru mapnik-2.1.0/Makefile mapnik-2.2.0/Makefile --- mapnik-2.1.0/Makefile 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/Makefile 2013-06-04 01:35:26.000000000 +0000 @@ -1,38 +1,74 @@ +UNAME := $(shell uname) +LINK_FIX=LD_LIBRARY_PATH +ifeq ($(UNAME), Darwin) + LINK_FIX=DYLD_LIBRARY_PATH +else +endif + +OS:=$(shell uname -s) + +ifeq ($(JOBS),) + JOBS:=1 + ifeq ($(OS),Linux) + JOBS:=$(shell grep -c ^processor /proc/cpuinfo) + endif + ifeq ($(OS),Darwin) + JOBS:=$(shell sysctl -n hw.ncpu) + endif +endif + all: mapnik install: - @python scons/scons.py --config=cache --implicit-cache --max-drift=1 install + @python scons/scons.py -j$(JOBS) --config=cache --implicit-cache --max-drift=1 install mapnik: - @python scons/scons.py --config=cache --implicit-cache --max-drift=1 + @python scons/scons.py -j$(JOBS) --config=cache --implicit-cache --max-drift=1 clean: - @python scons/scons.py -c --config=cache --implicit-cache --max-drift=1 + @python scons/scons.py -j$(JOBS) -c --config=cache --implicit-cache --max-drift=1 @if test -e ".sconsign.dblite"; then rm ".sconsign.dblite"; fi + @if test -e "config.log"; then rm "config.log"; fi + @if test -e ".sconf_temp/"; then rm -r ".sconf_temp/"; fi + @find ./ -name "*.pyc" -exec rm {} \; + @find ./ -name "*.os" -exec rm {} \; + @find ./ -name "*.o" -exec rm {} \; + @find ./ -name "*.pyc" -exec rm {} \; + @if test -e "bindings/python/mapnik/paths.py"; then rm "bindings/python/mapnik/paths.py"; fi distclean: - if test -e ".sconf_temp/"; then rm -r ".sconf_temp/"; fi - if test -e ".sconsign.dblite"; then rm ".sconsign.dblite"; fi - if test -e "config.cache"; then rm "config.cache"; fi + @if test -e "config.cache"; then rm "config.cache"; fi + if test -e "config.py"; then mv "config.py" "config.py.backup"; fi reset: distclean +rebuild: + make uninstall && make clean && time make && make install + uninstall: - python scons/scons.py --config=cache --implicit-cache --max-drift=1 uninstall + @python scons/scons.py -j$(JOBS) --config=cache --implicit-cache --max-drift=1 uninstall test: - @echo "*** Running visual tests..." - @python tests/visual_tests/test.py -q || true - @echo "*** Running C++ tests..." - @for FILE in tests/cpp_tests/*-bin; do \ - $${FILE}; \ - done - @echo "*** Running python tests..." - @python tests/run_tests.py -q + @ ./run_tests + +test-local: + @echo "*** Boostrapping local test environment..." + @export ${LINK_FIX}=`pwd`/src:${${LINK_FIX}} && \ + export PATH=`pwd`/utils/mapnik-config/:${PATH} && \ + export PYTHONPATH=`pwd`/bindings/python/:${PYTHONPATH} && \ + export MAPNIK_FONT_DIRECTORY=`pwd`/fonts/dejavu-fonts-ttf-2.33/ttf/ && \ + export MAPNIK_INPUT_PLUGINS_DIRECTORY=`pwd`/plugins/input/ && \ + make test + +bench: + @export ${LINK_FIX}=`pwd`/src:${${LINK_FIX}} && \ + ./benchmark/run + +check: test-local demo: @echo "*** Running rundemo.cpp…" - cd demo/c++; ./rundemo `mapnik-config --prefix`/lib/mapnik + cd demo/c++; ./rundemo `mapnik-config --prefix` pep8: # https://gist.github.com/1903033 @@ -50,4 +86,4 @@ nik2img.py $${FILE} /tmp/$$(basename $${FILE}).png; \ done -.PHONY: clean reset uninstall test install demo +.PHONY: install mapnik clean distclean reset uninstall test demo pep8 grind render diff -Nru mapnik-2.1.0/README.md mapnik-2.2.0/README.md --- mapnik-2.1.0/README.md 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/README.md 2013-06-04 01:35:26.000000000 +0000 @@ -1,12 +1,14 @@ -``` - _/ _/ _/ _/ - _/_/ _/_/ _/_/_/ _/_/_/ _/_/_/ _/ _/ - _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ - _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ -_/ _/ _/_/_/ _/_/_/ _/ _/ _/ _/ _/ - _/ - _/ ``` + _/ _/ _/ _/ + _/_/ _/_/ _/_/_/ _/_/_/ _/_/_/ _/ _/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ +_/ _/ _/_/_/ _/_/_/ _/ _/ _/ _/ _/ + _/ + _/ +``` + +[![Build Status](https://secure.travis-ci.org/mapnik/mapnik.png)](http://travis-ci.org/mapnik/mapnik) # What is Mapnik? diff -Nru mapnik-2.1.0/SConstruct mapnik-2.2.0/SConstruct --- mapnik-2.1.0/SConstruct 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/SConstruct 2013-06-04 01:35:26.000000000 +0000 @@ -22,6 +22,7 @@ import re import platform from glob import glob +from copy import copy from subprocess import Popen, PIPE from SCons.SConf import SetCacheMode import pickle @@ -35,6 +36,12 @@ LIBDIR_SCHEMA_DEFAULT='lib' severities = ['debug', 'warn', 'error', 'none'] +DEFAULT_CC = "gcc" +DEFAULT_CXX = "g++" +if sys.platform == 'darwin': + DEFAULT_CC = "clang" + DEFAULT_CXX = "clang++" + py3 = None # local file to hold custom user configuration variables @@ -49,38 +56,34 @@ # auto-search directories for boost libs/headers BOOST_SEARCH_PREFIXES = ['/usr/local','/opt/local','/sw','/usr',] BOOST_MIN_VERSION = '1.47' -CAIROMM_MIN_VERSION = '1.8.0' +#CAIRO_MIN_VERSION = '1.8.0' DEFAULT_LINK_PRIORITY = ['internal','other','frameworks','user','system'] pretty_dep_names = { - 'ociei':'Oracle database library | configure with OCCI_LIBS & OCCI_INCLUDES | more info: https://github.com/mapnik/mapnik/wiki//OCCI', + 'ociei':'Oracle database library | configure with OCCI_LIBS & OCCI_INCLUDES | more info: https://github.com/mapnik/mapnik/wiki/OCCI', 'gdal':'GDAL C++ library | configured using gdal-config program | try setting GDAL_CONFIG SCons option | more info: https://github.com/mapnik/mapnik/wiki/GDAL', - 'ogr':'OGR-enabled GDAL C++ Library | configured using gdal-config program | try setting GDAL_CONFIG SCons option | more info: https://github.com/mapnik/mapnik/wiki//OGR', - 'geos_c':'GEOS Simple Geometry Specification C Library | configured with GEOS_LIB & GEOS_INCLUDE | more info: https://github.com/mapnik/mapnik/wiki//GEOS', + 'ogr':'OGR-enabled GDAL C++ Library | configured using gdal-config program | try setting GDAL_CONFIG SCons option | more info: https://github.com/mapnik/mapnik/wiki/OGR', 'cairo':'Cairo C library | configured using pkg-config | try setting PKG_CONFIG_PATH SCons option', - 'cairomm':'Cairomm C++ bindings to Cairo library | configured using pkg-config | try setting PKG_CONFIG_PATH SCons option', - 'cairomm-version':'Cairomm version is too old (so cairo renderer will not be built), you need at least %s' % CAIROMM_MIN_VERSION, 'pycairo':'Python bindings to Cairo library | configured using pkg-config | try setting PKG_CONFIG_PATH SCons option', 'proj':'Proj.4 C Projections library | configure with PROJ_LIBS & PROJ_INCLUDES | more info: http://trac.osgeo.org/proj/', - 'pg':'Postgres C Library requiered for PostGIS plugin | configure with pg_config program | more info: https://github.com/mapnik/mapnik/wiki//PostGIS', - 'sqlite3':'SQLite3 C Library | configure with SQLITE_LIBS & SQLITE_INCLUDES | more info: https://github.com/mapnik/mapnik/wiki//SQLite', + 'pg':'Postgres C Library required for PostGIS plugin | configure with pg_config program | more info: https://github.com/mapnik/mapnik/wiki/PostGIS', + 'sqlite3':'SQLite3 C Library | configure with SQLITE_LIBS & SQLITE_INCLUDES | more info: https://github.com/mapnik/mapnik/wiki/SQLite', 'jpeg':'JPEG C library | configure with JPEG_LIBS & JPEG_INCLUDES', 'tiff':'TIFF C library | configure with TIFF_LIBS & TIFF_INCLUDES', 'png':'PNG C library | configure with PNG_LIBS & PNG_INCLUDES', 'icuuc':'ICU C++ library | configure with ICU_LIBS & ICU_INCLUDES or use ICU_LIB_NAME to specify custom lib name | more info: http://site.icu-project.org/', - 'ltdl':'GNU Libtool | more info: http://www.gnu.org/software/libtool', 'z':'Z compression library | more info: http://www.zlib.net/', 'm':'Basic math library, part of C++ stlib', 'pkg-config':'pkg-config tool | more info: http://pkg-config.freedesktop.org', 'pg_config':'pg_config program | try setting PG_CONFIG SCons option', 'xml2-config':'xml2-config program | try setting XML2_CONFIG SCons option', + 'libxml2':'libxml2 library | try setting XML2_CONFIG SCons option to point to location of xml2-config program', 'gdal-config':'gdal-config program | try setting GDAL_CONFIG SCons option', - 'geos-config':'geos-config program | try setting GEOS_CONFIG SCons option', 'freetype-config':'freetype-config program | try setting FREETYPE_CONFIG SCons option', - 'osm':'more info: https://github.com/mapnik/mapnik/wiki//OsmPlugin', - 'curl':'libcurl is required for the "osm" plugin - more info: https://github.com/mapnik/mapnik/wiki//OsmPlugin', + 'osm':'more info: https://github.com/mapnik/mapnik/wiki/OsmPlugin', + 'curl':'libcurl is required for the "osm" plugin - more info: https://github.com/mapnik/mapnik/wiki/OsmPlugin', 'boost_regex_icu':'libboost_regex built with optional ICU unicode support is needed for unicode regex support in mapnik.', 'sqlite_rtree':'The SQLite plugin requires libsqlite3 built with RTREE support (-DSQLITE_ENABLE_RTREE=1)', 'pgsql2sqlite_rtree':'The pgsql2sqlite program requires libsqlite3 built with RTREE support (-DSQLITE_ENABLE_RTREE=1)' @@ -93,22 +96,20 @@ 'postgis': {'default':True,'path':None,'inc':'libpq-fe.h','lib':'pq','lang':'C'}, 'gdal': {'default':True,'path':None,'inc':'gdal_priv.h','lib':'gdal','lang':'C++'}, 'ogr': {'default':True,'path':None,'inc':'ogrsf_frmts.h','lib':'gdal','lang':'C++'}, - 'geos': {'default':False,'path':None,'inc':'geos_c.h','lib':'geos_c','lang':'C'}, # configured with custom paths, hence 'path': PREFIX/INCLUDES/LIBS 'occi': {'default':False,'path':'OCCI','inc':'occi.h','lib':'ociei','lang':'C++'}, 'sqlite': {'default':True,'path':'SQLITE','inc':'sqlite3.h','lib':'sqlite3','lang':'C'}, 'rasterlite': {'default':False,'path':'RASTERLITE','inc':['sqlite3.h','rasterlite.h'],'lib':'rasterlite','lang':'C'}, # todo: osm plugin does also depend on libxml2 (but there is a separate check for that) - 'osm': {'default':True,'path':None,'inc':'curl/curl.h','lib':'curl','lang':'C'}, + 'osm': {'default':False,'path':None,'inc':'curl/curl.h','lib':'curl','lang':'C'}, # plugins without external dependencies requiring CheckLibWithHeader... 'shape': {'default':True,'path':None,'inc':None,'lib':None,'lang':'C++'}, 'csv': {'default':True,'path':None,'inc':None,'lib':None,'lang':'C++'}, 'raster': {'default':True,'path':None,'inc':None,'lib':None,'lang':'C++'}, 'geojson': {'default':True,'path':None,'inc':None,'lib':None,'lang':'C++'}, - 'kismet': {'default':False,'path':None,'inc':None,'lib':None,'lang':'C++'}, - 'python': {'default':True,'path':None,'inc':None,'lib':None,'lang':'C++'}, + 'python': {'default':False,'path':None,'inc':None,'lib':None,'lang':'C++'}, } @@ -172,10 +173,14 @@ name = lib return name +def rm_path(item,set,_env): + for i in _env[set]: + if item in i: + _env[set].remove(i) def sort_paths(items,priority): """Sort paths such that compiling and linking will globally prefer custom or local libs - over system libraries by fixing up the order libs are passed to gcc and the linker. + over system libraries by fixing up the order libs are passed to the compiler and the linker. Ideally preference could be by-target instead of global, but our SCons implementation is not currently utilizing different SCons build env()'s as we should. @@ -245,7 +250,7 @@ if pretty: return '%s (%s)' % (dep,pretty) elif 'boost' in dep: - return '%s (%s)' % (dep,'more info see: https://github.com/mapnik/mapnik/wiki//MapnikInstallation & http://www.boost.org') + return '%s (%s)' % (dep,'more info see: https://github.com/mapnik/mapnik/wiki/Mapnik-Installation & http://www.boost.org') return dep @@ -260,14 +265,15 @@ opts.AddVariables( # Compiler options - ('CXX', 'The C++ compiler to use to compile mapnik (defaults to g++).', 'g++'), - ('CC', 'The C compiler used for configure checks of C libs (defaults to gcc).', 'gcc'), + ('CXX', 'The C++ compiler to use to compile mapnik', DEFAULT_CXX), + ('CC', 'The C compiler used for configure checks of C libs.', DEFAULT_CC), ('CUSTOM_CXXFLAGS', 'Custom C++ flags, e.g. -I if you have headers in a nonstandard directory ', ''), + ('CUSTOM_DEFINES', 'Custom Compiler DEFINES, e.g. -DENABLE_THIS', ''), ('CUSTOM_CFLAGS', 'Custom C flags, e.g. -I if you have headers in a nonstandard directory (only used for configure checks)', ''), ('CUSTOM_LDFLAGS', 'Custom linker flags, e.g. -L if you have libraries in a nonstandard directory ', ''), EnumVariable('LINKING', "Set library format for libmapnik",'shared', ['shared','static']), EnumVariable('RUNTIME_LINK', "Set preference for linking dependencies",'shared', ['shared','static']), - EnumVariable('OPTIMIZATION','Set g++ optimization level','3', ['0','1','2','3','4','s']), + EnumVariable('OPTIMIZATION','Set compiler optimization level','3', ['0','1','2','3','4','s']), # Note: setting DEBUG=True will override any custom OPTIMIZATION level BoolVariable('DEBUG', 'Compile a debug version of Mapnik', 'False'), BoolVariable('DEBUG_UNDEFINED', 'Compile a version of Mapnik using clang/llvm undefined behavior asserts', 'False'), @@ -275,6 +281,7 @@ ('WARNING_CXXFLAGS', 'Compiler flags you can set to reduce warning levels which are placed after -Wall.', ''), # SCons build behavior options + ('HOST', 'Set the target host for cross compiling"', ''), ('CONFIG', "The path to the python file in which to save user configuration options. Currently : '%s'" % SCONS_LOCAL_CONFIG,SCONS_LOCAL_CONFIG), BoolVariable('USE_CONFIG', "Use SCons user '%s' file (will also write variables after successful configuration)", 'True'), # http://www.scons.org/wiki/GoFastButton @@ -307,16 +314,18 @@ ('XML2_CONFIG', 'The path to the xml2-config executable.', 'xml2-config'), PathVariable('ICU_INCLUDES', 'Search path for ICU include files', '/usr/include', PathVariable.PathAccept), PathVariable('ICU_LIBS','Search path for ICU include files','/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept), - ('ICU_LIB_NAME', 'The library name for icu (such as icuuc, sicuuc, or icucore)', 'icuuc'), + ('ICU_LIB_NAME', 'The library name for icu (such as icuuc, sicuuc, or icucore)', 'icuuc', PathVariable.PathAccept), + + BoolVariable('PNG', 'Build Mapnik with PNG read and write support', 'True'), PathVariable('PNG_INCLUDES', 'Search path for libpng include files', '/usr/include', PathVariable.PathAccept), PathVariable('PNG_LIBS','Search path for libpng library files','/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept), - PathVariable('LTDL_INCLUDES', 'Search path for libltdl (part of libtool) include files', '/usr/include', PathVariable.PathAccept), - PathVariable('LTDL_LIBS','Search path for libltdl (ltdl.h) library files','/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept), BoolVariable('JPEG', 'Build Mapnik with JPEG read and write support', 'True'), PathVariable('JPEG_INCLUDES', 'Search path for libjpeg include files', '/usr/include', PathVariable.PathAccept), PathVariable('JPEG_LIBS', 'Search path for libjpeg library files', '/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept), + BoolVariable('TIFF', 'Build Mapnik with TIFF read and write support', 'True'), PathVariable('TIFF_INCLUDES', 'Search path for libtiff include files', '/usr/include', PathVariable.PathAccept), PathVariable('TIFF_LIBS', 'Search path for libtiff library files', '/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept), + BoolVariable('PROJ', 'Build Mapnik with proj4 support to enable transformations between many different projections', 'True'), PathVariable('PROJ_INCLUDES', 'Search path for PROJ.4 include files', '/usr/include', PathVariable.PathAccept), PathVariable('PROJ_LIBS', 'Search path for PROJ.4 library files', '/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept), ('PKG_CONFIG_PATH', 'Use this path to point pkg-config to .pc files instead of the PKG_CONFIG_PATH environment setting',''), @@ -325,15 +334,16 @@ BoolVariable('RENDERING_STATS', 'Output rendering statistics during style processing', 'False'), - #BoolVariable('SVG_RENDERER', 'build support for native svg renderer', 'False'), + BoolVariable('SVG_RENDERER', 'build support for native svg renderer', 'False'), + BoolVariable('CPP_TESTS', 'Compile the C++ tests', 'True'), + BoolVariable('BENCHMARK', 'Compile the C++ benchmark scripts', 'False'), # Variables for optional dependencies - ('GEOS_CONFIG', 'The path to the geos-config executable.', 'geos-config'), - # Note: cairo, cairomm, and pycairo all optional but configured automatically through pkg-config + # Note: cairo and and pycairo are optional but configured automatically through pkg-config # Therefore, we use a single boolean for whether to attempt to build cairo support. BoolVariable('CAIRO', 'Attempt to build with Cairo rendering support', 'True'), - PathVariable('CAIRO_INCLUDES', 'Search path for cairo/cairomm include files', '',PathVariable.PathAccept), - PathVariable('CAIRO_LIBS', 'Search path for cairo/cairomm library files','',PathVariable.PathAccept), + PathVariable('CAIRO_INCLUDES', 'Search path for cairo include files', '',PathVariable.PathAccept), + PathVariable('CAIRO_LIBS', 'Search path for cairo library files','',PathVariable.PathAccept), ('GDAL_CONFIG', 'The path to the gdal-config executable for finding gdal and ogr details.', 'gdal-config'), ('PG_CONFIG', 'The path to the pg_config executable.', 'pg_config'), PathVariable('OCCI_INCLUDES', 'Search path for OCCI include files', '/usr/lib/oracle/10.2.0.3/client/include', PathVariable.PathAccept), @@ -346,11 +356,14 @@ # Variables for logging and statistics BoolVariable('ENABLE_LOG', 'Enable logging, which is enabled by default when building in *debug*', 'False'), BoolVariable('ENABLE_STATS', 'Enable global statistics during map processing', 'False'), - ('DEFAULT_LOG_SEVERITY', 'The default severity of the logger (eg. ' + ', '.join(severities), 'error'), + ('DEFAULT_LOG_SEVERITY', 'The default severity of the logger (eg. ' + ', '.join(severities) + ')', 'error'), + + # Plugin linking + EnumVariable('PLUGIN_LINKING', "Set plugin linking with libmapnik", 'shared', ['shared','static']), # Other variables BoolVariable('SHAPE_MEMORY_MAPPED_FILE', 'Utilize memory-mapped files in Shapefile Plugin (higher memory usage, better performance)', 'True'), - ('SYSTEM_FONTS','Provide location for python bindings to register fonts (if given aborts installation of bundled DejaVu fonts)',''), + ('SYSTEM_FONTS','Provide location for python bindings to register fonts (if provided then the bundled DejaVu fonts are not installed)',''), ('LIB_DIR_NAME','Name to use for the subfolder beside libmapnik where fonts and plugins are installed','mapnik'), PathVariable('PYTHON','Full path to Python executable used to build bindings', sys.executable), BoolVariable('FRAMEWORK_PYTHON', 'Link against Framework Python on Mac OS X', 'True'), @@ -363,8 +376,11 @@ ('JOBS', 'Set the number of parallel compilations', "1", lambda key, value, env: int(value), int), BoolVariable('DEMO', 'Compile demo c++ application', 'True'), BoolVariable('PGSQL2SQLITE', 'Compile and install a utility to convert postgres tables to sqlite', 'False'), + BoolVariable('SHAPEINDEX', 'Compile and install a utility to generate shapefile indexes in the custom format (.index) Mapnik supports', 'True'), + BoolVariable('SVG2PNG', 'Compile and install a utility to generate render an svg file to a png on the command line', 'False'), BoolVariable('COLOR_PRINT', 'Print build status information in color', 'True'), BoolVariable('SAMPLE_INPUT_PLUGINS', 'Compile and install sample plugins', 'False'), + BoolVariable('BIGINT', 'Compile support for 64-bit integers in mapnik::value', 'True'), ) # variables to pickle after successful configure step @@ -382,6 +398,7 @@ 'LIBS', 'LINKFLAGS', 'CUSTOM_LDFLAGS', # user submitted + 'CUSTOM_DEFINES', # user submitted 'CUSTOM_CXXFLAGS', # user submitted 'CUSTOM_CFLAGS', # user submitted 'MAPNIK_LIB_NAME', @@ -391,6 +408,7 @@ 'PLUGINS', 'ABI_VERSION', 'MAPNIK_VERSION_STRING', + 'MAPNIK_VERSION', 'PLATFORM', 'BOOST_ABI', 'BOOST_APPEND', @@ -422,13 +440,15 @@ 'MAPNIK_LIB_BASE_DEST', 'EXTRA_FREETYPE_LIBS', 'LIBMAPNIK_CPPATHS', + 'LIBMAPNIK_DEFINES', 'LIBMAPNIK_CXXFLAGS', - 'CAIROMM_LIBPATHS', - 'CAIROMM_LINKFLAGS', - 'CAIROMM_CPPPATHS', - #'SVG_RENDERER', + 'CAIRO_LIBPATHS', + 'CAIRO_ALL_LIBS', + 'CAIRO_CPPPATHS', + 'SVG_RENDERER', 'SQLITE_LINKFLAGS', - 'BOOST_LIB_VERSION_FROM_HEADER' + 'BOOST_LIB_VERSION_FROM_HEADER', + 'BIGINT' ] # Add all other user configurable options to pickle pickle_store @@ -449,6 +469,8 @@ if ('-h' in command_line_args) or ('--help' in command_line_args): HELP_REQUESTED = True +if ('install' not in command_line_args) and ('-c' in command_line_args) or ('--clean' in command_line_args): + HELP_REQUESTED = True if 'configure' in command_line_args and not HELP_REQUESTED: force_configure = True @@ -539,7 +561,7 @@ env = context.env tool = config.lower().replace('_','-') toolname = tool - if config in ('GDAL_CONFIG','GEOS_CONFIG'): + if config in ('GDAL_CONFIG'): toolname += ' %s' % checks context.Message( 'Checking for %s... ' % toolname) cmd = '%s %s' % (env[config],checks) @@ -568,7 +590,7 @@ ret = False print ' (xml2-config not found!)' if not parsed: - if config in ('GDAL_CONFIG','GEOS_CONFIG'): + if config in ('GDAL_CONFIG'): # optional deps... env['SKIPPED_DEPS'].append(tool) conf.rollback_option(config) @@ -636,6 +658,48 @@ if item.key == variable: env[variable] = item.default +def update_linux_project_files(): + headers_content = [] + source_content = [] + + directories = [ + 'include', + 'src', + 'bindings', + 'boost', + 'plugins', + 'deps', + ] + + def iterate_dirs(headers_content, source_content, d): + if not "uninstall-" in d: + for root, subFolders, files in os.walk(d): + for f in files: + if f.endswith(".h") or f.endswith(".hpp"): + headers_content.append(" ../%s \\" % os.path.join(root, f)) + if f.endswith(".cpp") or f.endswith(".c"): + source_content.append(" ../%s \\" % os.path.join(root, f)) + for sd in subFolders: + headers_content, source_content = \ + iterate_dirs(headers_content, source_content, os.path.join(root, sd)) + return headers_content, source_content + + for d in directories: + headers_content, source_content = \ + iterate_dirs(headers_content, source_content, d) + + headers_content.sort() + headers_content = ['HEADERS += \\'] + headers_content + ['',''] + + source_content.sort() + source_content = ['SOURCES += \\'] + source_content + ['',''] + + files_name = os.path.join('.', 'workspace', 'All.files') + f = open(files_name, "w") + f.writelines([l + '\n' for l in headers_content]) + f.writelines([l + '\n' for l in source_content]) + f.close() + def FindBoost(context, prefixes, thread_flag): """Routine to auto-find boost header dir, lib dir, and library naming structure. @@ -674,25 +738,23 @@ msg = str() if BOOST_LIB_DIR: - msg += '\n *libs found: %s' % BOOST_LIB_DIR + msg += '\nFound boost libs: %s' % BOOST_LIB_DIR env['BOOST_LIBS'] = BOOST_LIB_DIR else: env['BOOST_LIBS'] = '/usr/' + env['LIBDIR_SCHEMA'] - msg += '\n *using default boost lib dir: %s' % env['BOOST_LIBS'] + msg += '\nUsing default boost lib dir: %s' % env['BOOST_LIBS'] if BOOST_INCLUDE_DIR: - msg += '\n *headers found: %s' % BOOST_INCLUDE_DIR + msg += '\nFound boost headers: %s' % BOOST_INCLUDE_DIR env['BOOST_INCLUDES'] = BOOST_INCLUDE_DIR else: env['BOOST_INCLUDES'] = '/usr/include' - msg += '\n *using default boost include dir: %s' % env['BOOST_INCLUDES'] + msg += '\nUsing default boost include dir: %s' % env['BOOST_INCLUDES'] if not env['BOOST_TOOLKIT'] and not env['BOOST_ABI'] and not env['BOOST_VERSION']: if BOOST_APPEND: - msg += '\n *lib naming extension found: %s' % BOOST_APPEND + msg += '\nFound boost lib name extension: %s' % BOOST_APPEND env['BOOST_APPEND'] = BOOST_APPEND - else: - msg += '\n *no lib naming extension found' else: # Creating BOOST_APPEND according to the Boost library naming order, # which goes ---. See: @@ -707,7 +769,7 @@ # Boost libraries. if len(append_params) > 1: env['BOOST_APPEND'] = '-'.join(append_params) - msg += '\n *using boost lib naming: %s' % env['BOOST_APPEND'] + msg += '\nFound boost lib name extension: %s' % env['BOOST_APPEND'] env.AppendUnique(CPPPATH = os.path.realpath(env['BOOST_INCLUDES'])) env.AppendUnique(LIBPATH = os.path.realpath(env['BOOST_LIBS'])) @@ -744,6 +806,32 @@ context.Result(ret) return ret +def CheckCairoHasFreetype(context, silent=False): + if not silent: + context.Message('Checking for cairo freetype font support ... ') + context.env.AppendUnique(CPPPATH=copy(env['CAIRO_CPPPATHS'])) + + ret = context.TryRun(""" + +#include + +int main() +{ + #ifdef CAIRO_HAS_FT_FONT + return 0; + #else + return 1; + #endif +} + +""", '.cpp')[0] + if silent: + context.did_show_result=1 + context.Result(ret) + for item in env['CAIRO_CPPPATHS']: + rm_path(item,'CPPPATH',context.env) + return ret + def GetBoostLibVersion(context): ret = context.TryRun(""" @@ -814,8 +902,7 @@ def boost_regex_has_icu(context): if env['RUNTIME_LINK'] == 'static': - context.env.Append(LIBS='icui18n') - context.env.Append(LIBS='icudata') + context.env.AppendUnique(LIBS='icudata') ret = context.TryRun(""" #include @@ -842,7 +929,7 @@ return True return False -def sqlite_has_rtree(context): +def sqlite_has_rtree(context, silent=False): """ check an sqlite3 install has rtree support. PRAGMA compile_options; @@ -879,7 +966,10 @@ } """, '.c') - context.Message('Checking if SQLite supports RTREE... ') + if not silent: + context.Message('Checking if SQLite supports RTREE... ') + if silent: + context.did_show_result=1 context.Result(ret[0]) if ret[0]: return True @@ -891,6 +981,7 @@ 'CheckPKGVersion' : CheckPKGVersion, 'FindBoost' : FindBoost, 'CheckBoost' : CheckBoost, + 'CheckCairoHasFreetype' : CheckCairoHasFreetype, 'GetBoostLibVersion' : GetBoostLibVersion, 'GetMapnikLibVersion' : GetMapnikLibVersion, 'parse_config' : parse_config, @@ -951,17 +1042,20 @@ env['MISSING_DEPS'] = [] env['SKIPPED_DEPS'] = [] env['HAS_CAIRO'] = False - env['CAIROMM_LIBPATHS'] = [] - env['CAIROMM_LINKFLAGS'] = [] - env['CAIROMM_CPPPATHS'] = [] + env['CAIRO_LIBPATHS'] = [] + env['CAIRO_ALL_LIBS'] = [] + env['CAIRO_CPPPATHS'] = [] env['HAS_PYCAIRO'] = False env['HAS_LIBXML2'] = False env['LIBMAPNIK_LIBS'] = [] + env['LIBMAPNIK_LINKFLAGS'] = [] env['LIBMAPNIK_CPPATHS'] = [] + env['LIBMAPNIK_DEFINES'] = [] env['LIBMAPNIK_CXXFLAGS'] = [] env['PLUGINS'] = PLUGINS env['EXTRA_FREETYPE_LIBS'] = [] env['SQLITE_LINKFLAGS'] = [] + env['PYTHON_INCLUDES'] = [] # previously a leading / was expected for LIB_DIR_NAME # now strip it to ensure expected behavior if env['LIB_DIR_NAME'].startswith(os.path.sep): @@ -1016,6 +1110,7 @@ env['LIBPATH'] = ['#src'] # set any custom cxxflags and ldflags to come first + env.Append(CPPDEFINES = env['CUSTOM_DEFINES']) env.Append(CXXFLAGS = env['CUSTOM_CXXFLAGS']) env.Append(CFLAGS = env['CUSTOM_CFLAGS']) env.Append(LINKFLAGS = env['CUSTOM_LDFLAGS']) @@ -1032,7 +1127,7 @@ SOLARIS = env['PLATFORM'] == 'SunOS' env['SUNCC'] = SOLARIS and env['CXX'].startswith('CC') - # If the Sun Studio C++ compiler (`CC`) is used instead of GCC. + # If the Sun Studio C++ compiler (`CC`) is used instead of gcc. if env['SUNCC']: env['CC'] = 'cc' # To be compatible w/Boost everything needs to be compiled @@ -1049,15 +1144,15 @@ # http://www.opensource.apple.com/tarballs/ICU/ # then copy the headers to a location that mapnik will find if 'core' in env['ICU_LIB_NAME']: - env.Append(CXXFLAGS = '-DU_HIDE_DRAFT_API') - env.Append(CXXFLAGS = '-DUDISABLE_RENAMING') + env.Append(CPPDEFINES = '-DU_HIDE_DRAFT_API') + env.Append(CPPDEFINES = '-DUDISABLE_RENAMING') if os.path.exists(env['ICU_LIB_NAME']): #-sICU_LINK=" -L/usr/lib -licucore env['ICU_LIB_NAME'] = os.path.basename(env['ICU_LIB_NAME']).replace('.dylib','').replace('lib','') # Adding the required prerequisite library directories to the include path for # compiling and the library path for linking, respectively. - for required in ('PNG', 'JPEG', 'TIFF','PROJ','ICU', 'SQLITE', 'LTDL'): + for required in ('ICU', 'SQLITE'): inc_path = env['%s_INCLUDES' % required] lib_path = env['%s_LIBS' % required] env.AppendUnique(CPPPATH = os.path.realpath(inc_path)) @@ -1079,40 +1174,76 @@ # https://github.com/mapnik/mapnik/issues/913 if conf.parse_config('XML2_CONFIG',checks='--cflags'): env['HAS_LIBXML2'] = True + else: + env['MISSING_DEPS'].append('libxml2') LIBSHEADERS = [ - ['m', 'math.h', True,'C'], - ['ltdl', 'ltdl.h', True,'C'], - ['png', 'png.h', True,'C'], - ['tiff', 'tiff.h', True,'C'], ['z', 'zlib.h', True,'C'], - ['proj', 'proj_api.h', True,'C'], [env['ICU_LIB_NAME'],'unicode/unistr.h',True,'C++'], ] if env['JPEG']: - env.Append(CXXFLAGS = '-DHAVE_JPEG') + env.Append(CPPDEFINES = '-DHAVE_JPEG') LIBSHEADERS.append(['jpeg', ['stdio.h', 'jpeglib.h'], True,'C']) + inc_path = env['%s_INCLUDES' % 'JPEG'] + lib_path = env['%s_LIBS' % 'JPEG'] + env.AppendUnique(CPPPATH = os.path.realpath(inc_path)) + env.AppendUnique(LIBPATH = os.path.realpath(lib_path)) else: env['SKIPPED_DEPS'].extend(['jpeg']) + if env['PROJ']: + env.Append(CPPDEFINES = '-DMAPNIK_USE_PROJ4') + LIBSHEADERS.append(['proj', 'proj_api.h', True,'C']) + inc_path = env['%s_INCLUDES' % 'PROJ'] + lib_path = env['%s_LIBS' % 'PROJ'] + env.AppendUnique(CPPPATH = os.path.realpath(inc_path)) + env.AppendUnique(LIBPATH = os.path.realpath(lib_path)) + else: + env['SKIPPED_DEPS'].extend(['proj']) + + if env['PNG']: + env.Append(CPPDEFINES = '-DHAVE_PNG') + LIBSHEADERS.append(['png', 'png.h', True,'C']) + inc_path = env['%s_INCLUDES' % 'PNG'] + lib_path = env['%s_LIBS' % 'PNG'] + env.AppendUnique(CPPPATH = os.path.realpath(inc_path)) + env.AppendUnique(LIBPATH = os.path.realpath(lib_path)) + else: + env['SKIPPED_DEPS'].extend(['png']) + + if env['TIFF']: + env.Append(CPPDEFINES = '-DHAVE_TIFF') + LIBSHEADERS.append(['tiff', 'tiff.h', True,'C']) + inc_path = env['%s_INCLUDES' % 'TIFF'] + lib_path = env['%s_LIBS' % 'TIFF'] + env.AppendUnique(CPPPATH = os.path.realpath(inc_path)) + env.AppendUnique(LIBPATH = os.path.realpath(lib_path)) + else: + env['SKIPPED_DEPS'].extend(['tiff']) + # if requested, sort LIBPATH and CPPPATH before running CheckLibWithHeader tests if env['PRIORITIZE_LINKING']: - conf.prioritize_paths(silent=False) + conf.prioritize_paths(silent=True) - for libname, headers, required, lang in LIBSHEADERS: - if not conf.CheckLibWithHeader(libname, headers, lang): - if required: - color_print(1, 'Could not find required header or shared library for %s' % libname) - env['MISSING_DEPS'].append(libname) - else: - color_print(4, 'Could not find optional header or shared library for %s' % libname) - env['SKIPPED_DEPS'].append(libname) + if not env['HOST']: + for libname, headers, required, lang in LIBSHEADERS: + if not conf.CheckLibWithHeader(libname, headers, lang): + if required: + color_print(1, 'Could not find required header or shared library for %s' % libname) + env['MISSING_DEPS'].append(libname) + else: + color_print(4, 'Could not find optional header or shared library for %s' % libname) + env['SKIPPED_DEPS'].append(libname) + + if not env['HOST']: + if env['ICU_LIB_NAME'] not in env['MISSING_DEPS']: + if not conf.icu_at_least_four_two(): + # expression_string.cpp and map.cpp use fromUTF* function only available in >= ICU 4.2 + env['MISSING_DEPS'].append(env['ICU_LIB_NAME']) - if env['ICU_LIB_NAME'] not in env['MISSING_DEPS']: - if not conf.icu_at_least_four_two(): - # expression_string.cpp and map.cpp use fromUTF* function only available in >= ICU 4.2 - env['MISSING_DEPS'].append(env['ICU_LIB_NAME']) + if env['BIGINT']: + env.Append(CPPDEFINES = '-DBIGINT') if env['THREADING'] == 'multi': thread_flag = thread_suffix @@ -1121,58 +1252,73 @@ conf.FindBoost(BOOST_SEARCH_PREFIXES,thread_flag) - env['BOOST_LIB_VERSION_FROM_HEADER'] = conf.GetBoostLibVersion() - - # The other required boost headers. - BOOST_LIBSHEADERS = [ - ['system', 'boost/system/system_error.hpp', True], - ['filesystem', 'boost/filesystem/operations.hpp', True], - ['regex', 'boost/regex.hpp', True], - ['program_options', 'boost/program_options.hpp', False] - ] + has_boost_devel = True + if not env['HOST']: + if not conf.CheckHeader(header='boost/version.hpp',language='C++'): + env['MISSING_DEPS'].append('boost development headers') + has_boost_devel = False + + if has_boost_devel: + env['BOOST_LIB_VERSION_FROM_HEADER'] = conf.GetBoostLibVersion() + + # The other required boost headers. + BOOST_LIBSHEADERS = [ + ['system', 'boost/system/system_error.hpp', True], + ['filesystem', 'boost/filesystem/operations.hpp', True], + ['regex', 'boost/regex.hpp', True], + ['program_options', 'boost/program_options.hpp', False] + ] - if env['THREADING'] == 'multi': - BOOST_LIBSHEADERS.append(['thread', 'boost/thread/mutex.hpp', True]) - # on solaris the configure checks for boost_thread - # require the -pthreads flag to be able to check for - # threading support, so we add as a global library instead - # of attaching to cxxflags after configure - if env['PLATFORM'] == 'SunOS': - env.Append(CXXFLAGS = '-pthreads') + if env['THREADING'] == 'multi': + BOOST_LIBSHEADERS.append(['thread', 'boost/thread/mutex.hpp', True]) + # on solaris the configure checks for boost_thread + # require the -pthreads flag to be able to check for + # threading support, so we add as a global library instead + # of attaching to cxxflags after configure + if env['PLATFORM'] == 'SunOS': + env.Append(CXXFLAGS = '-pthreads') - # if requested, sort LIBPATH and CPPPATH before running CheckLibWithHeader tests - if env['PRIORITIZE_LINKING']: - conf.prioritize_paths() + # if requested, sort LIBPATH and CPPPATH before running CheckLibWithHeader tests + if env['PRIORITIZE_LINKING']: + conf.prioritize_paths(silent=True) - # if the user is not setting custom boost configuration - # enforce boost version greater than or equal to BOOST_MIN_VERSION - if not conf.CheckBoost(BOOST_MIN_VERSION): - color_print(4,'Found boost lib version... %s' % env.get('BOOST_LIB_VERSION_FROM_HEADER') ) - color_print(1,'Boost version %s or greater is required' % BOOST_MIN_VERSION) - if not env['BOOST_VERSION']: - env['MISSING_DEPS'].append('boost version >=%s' % BOOST_MIN_VERSION) - else: - color_print(4,'Found boost lib version... %s' % env.get('BOOST_LIB_VERSION_FROM_HEADER') ) - - for count, libinfo in enumerate(BOOST_LIBSHEADERS): - if not conf.CheckLibWithHeader('boost_%s%s' % (libinfo[0],env['BOOST_APPEND']), libinfo[1], 'C++'): - if libinfo[2]: - color_print(1,'Could not find required header or shared library for boost %s' % libinfo[0]) - env['MISSING_DEPS'].append('boost ' + libinfo[0]) + if not env['HOST']: + # if the user is not setting custom boost configuration + # enforce boost version greater than or equal to BOOST_MIN_VERSION + if not conf.CheckBoost(BOOST_MIN_VERSION): + color_print(4,'Found boost lib version... %s' % env.get('BOOST_LIB_VERSION_FROM_HEADER') ) + color_print(1,'Boost version %s or greater is required' % BOOST_MIN_VERSION) + if not env['BOOST_VERSION']: + env['MISSING_DEPS'].append('boost version >= %s' % BOOST_MIN_VERSION) else: - color_print(4,'Could not find optional header or shared library for boost %s' % libinfo[0]) - env['SKIPPED_DEPS'].append('boost ' + libinfo[0]) + color_print(4,'Found boost lib version... %s' % env.get('BOOST_LIB_VERSION_FROM_HEADER') ) + + if not env['HOST']: + for count, libinfo in enumerate(BOOST_LIBSHEADERS): + if not conf.CheckLibWithHeader('boost_%s%s' % (libinfo[0],env['BOOST_APPEND']), libinfo[1], 'C++'): + if libinfo[2]: + color_print(1,'Could not find required header or shared library for boost %s' % libinfo[0]) + env['MISSING_DEPS'].append('boost ' + libinfo[0]) + else: + color_print(4,'Could not find optional header or shared library for boost %s' % libinfo[0]) + env['SKIPPED_DEPS'].append('boost ' + libinfo[0]) if env['ICU_LIB_NAME'] not in env['MISSING_DEPS']: # http://lists.boost.org/Archives/boost/2009/03/150076.php + # we need libicui18n if using static boost libraries, so it is + # important to try this check with the library linked + env.AppendUnique(LIBS='icui18n') if conf.boost_regex_has_icu(): # TODO - should avoid having this be globally defined... - env.Append(CXXFLAGS = '-DBOOST_REGEX_HAS_ICU') + env.Append(CPPDEFINES = '-DBOOST_REGEX_HAS_ICU') else: env['SKIPPED_DEPS'].append('boost_regex_icu') env['REQUESTED_PLUGINS'] = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])] + SQLITE_HAS_RTREE = None + CHECK_PKG_CONFIG = conf.CheckPKGConfig('0.15.0') + if len(env['REQUESTED_PLUGINS']): color_print(4,'Checking for requested plugins dependencies...') for plugin in env['REQUESTED_PLUGINS']: @@ -1193,11 +1339,6 @@ libname = conf.get_pkg_lib('GDAL_CONFIG','ogr') if libname: details['lib'] = libname - elif plugin == 'geos': - if conf.parse_config('GEOS_CONFIG',checks='--ldflags --cflags'): - lgeos_c = env['PLUGINS']['geos']['lib'] - env.Append(LIBS = lgeos_c) - elif details['path'] and details['lib'] and details['inc']: backup = env.Clone().Dictionary() # Note, the 'delete_existing' keyword makes sure that these paths are prepended @@ -1210,12 +1351,13 @@ env.Replace(**backup) env['SKIPPED_DEPS'].append(details['lib']) if plugin == 'sqlite': + SQLITE_HAS_RTREE = conf.sqlite_has_rtree() sqlite_backup = env.Clone().Dictionary() # if statically linking, on linux we likely # need to link sqlite to pthreads and dl if env['RUNTIME_LINK'] == 'static': - if conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('sqlite3'): + if CHECK_PKG_CONFIG and conf.CheckPKG('sqlite3'): sqlite_env = env.Clone() try: sqlite_env.ParseConfig('pkg-config --static --libs sqlite3') @@ -1226,7 +1368,9 @@ except OSError,e: pass - if not conf.sqlite_has_rtree(): + if SQLITE_HAS_RTREE is None: + SQLITE_HAS_RTREE = conf.sqlite_has_rtree() + if not SQLITE_HAS_RTREE: env.Replace(**sqlite_backup) if details['lib'] in env['LIBS']: env['LIBS'].remove(details['lib']) @@ -1249,7 +1393,7 @@ env.AppendUnique(LIBS='sqlite3') env.AppendUnique(CPPPATH = os.path.realpath(env['SQLITE_INCLUDES'])) env.AppendUnique(LIBPATH = os.path.realpath(env['SQLITE_LIBS'])) - if not conf.sqlite_has_rtree(): + if not SQLITE_HAS_RTREE: env['SKIPPED_DEPS'].append('pgsql2sqlite_rtree') env['PGSQL2SQLITE'] = False @@ -1257,55 +1401,47 @@ # prepend to make sure we link locally env.Prepend(CPPPATH = '#deps/agg/include') env.Prepend(LIBPATH = '#deps/agg') + env.Prepend(CPPPATH = '#deps/clipper/include') + # prepend deps dir for auxillary headers + env.Prepend(CPPPATH = '#deps') if env['CAIRO']: if env['CAIRO_LIBS'] or env['CAIRO_INCLUDES']: c_inc = env['CAIRO_INCLUDES'] if env['CAIRO_LIBS']: - env["CAIROMM_LIBPATHS"].append(os.path.realpath(env['CAIRO_LIBS'])) + env["CAIRO_LIBPATHS"].append(os.path.realpath(env['CAIRO_LIBS'])) if not env['CAIRO_INCLUDES']: c_inc = env['CAIRO_LIBS'].replace('lib','',1) if c_inc: c_inc = os.path.normpath(os.path.realpath(env['CAIRO_INCLUDES'])) if c_inc.endswith('include'): c_inc = os.path.dirname(c_inc) - env["CAIROMM_CPPPATHS"].extend( + env["CAIRO_CPPPATHS"].extend( [ - os.path.join(c_inc,'include/cairomm-1.0'), - os.path.join(c_inc,'lib/cairomm-1.0/include'), os.path.join(c_inc,'include/cairo'), - os.path.join(c_inc,'include/sigc++-2.0'), - os.path.join(c_inc,'lib/sigc++-2.0/include'), os.path.join(c_inc,'include/pixman-1'), #os.path.join(c_inc,'include/freetype2'), #os.path.join(c_inc,'include/libpng'), ] ) - env["CAIROMM_LINKFLAGS"] = ['cairo','cairomm-1.0'] + env["CAIRO_ALL_LIBS"] = ['cairo'] if env['RUNTIME_LINK'] == 'static': - env["CAIROMM_LINKFLAGS"].extend( - ['sigc-2.0','pixman-1','expat','fontconfig','iconv'] + env["CAIRO_ALL_LIBS"].extend( + ['pixman-1','expat','fontconfig','iconv'] ) # todo - run actual checkLib? env['HAS_CAIRO'] = True else: - if not conf.CheckPKGConfig('0.15.0'): + if not CHECK_PKG_CONFIG: env['HAS_CAIRO'] = False env['SKIPPED_DEPS'].append('pkg-config') env['SKIPPED_DEPS'].append('cairo') - env['SKIPPED_DEPS'].append('cairomm') elif not conf.CheckPKG('cairo'): env['HAS_CAIRO'] = False env['SKIPPED_DEPS'].append('cairo') - elif not conf.CheckPKG('cairomm-1.0'): - env['HAS_CAIRO'] = False - env['SKIPPED_DEPS'].append('cairomm') - elif not conf.CheckPKGVersion('cairomm-1.0',CAIROMM_MIN_VERSION): - env['HAS_CAIRO'] = False - env['SKIPPED_DEPS'].append('cairomm-version') else: - print 'Checking for cairo/cairomm lib and include paths... ', - cmd = 'pkg-config --libs --cflags cairomm-1.0' + print 'Checking for cairo lib and include paths... ', + cmd = 'pkg-config --libs --cflags cairo' if env['RUNTIME_LINK'] == 'static': cmd += ' --static' cairo_env = env.Clone() @@ -1313,25 +1449,29 @@ cairo_env.ParseConfig(cmd) for lib in cairo_env['LIBS']: if not lib in env['LIBS']: - env["CAIROMM_LINKFLAGS"].append(lib) + env["CAIRO_ALL_LIBS"].append(lib) for lpath in cairo_env['LIBPATH']: if not lpath in env['LIBPATH']: - env["CAIROMM_LIBPATHS"].append(lpath) + env["CAIRO_LIBPATHS"].append(lpath) for inc in cairo_env['CPPPATH']: if not inc in env['CPPPATH']: - env["CAIROMM_CPPPATHS"].append(inc) + env["CAIRO_CPPPATHS"].append(inc) env['HAS_CAIRO'] = True print 'yes' except OSError,e: color_print(1,'no') env['SKIPPED_DEPS'].append('cairo') - env['SKIPPED_DEPS'].append('cairomm') color_print(1,'pkg-config reported: %s' % e) else: color_print(4,'Not building with cairo support, pass CAIRO=True to enable') - if 'python' in env['BINDINGS']: + if not env['HOST'] and env['HAS_CAIRO']: + if not conf.CheckCairoHasFreetype(): + env['SKIPPED_DEPS'].append('cairo') + env['HAS_CAIRO'] = False + + if 'python' in env['BINDINGS'] or 'python' in env['REQUESTED_PLUGINS']: if not os.access(env['PYTHON'], os.X_OK): color_print(1,"Cannot run python interpreter at '%s', make sure that you have the permissions to execute it." % env['PYTHON']) Exit(1) @@ -1355,7 +1495,14 @@ py_includes = '''%s -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())"''' % env['PYTHON'] else: py_includes = '''%s -c "from distutils.sysconfig import get_python_inc; print get_python_inc()"''' % env['PYTHON'] - env['PYTHON_INCLUDES'] = call(py_includes) + env['PYTHON_INCLUDES'].append(call(py_includes)) + + # also append platform specific includes + if py3: + py_plat_includes = '''%s -c "from distutils.sysconfig import get_python_inc; print(get_python_inc(plat_specific=True))"''' % env['PYTHON'] + else: + py_plat_includes = '''%s -c "from distutils.sysconfig import get_python_inc; print get_python_inc(plat_specific=True)"''' % env['PYTHON'] + env['PYTHON_INCLUDES'].append(call(py_plat_includes)) # Note: we use the plat_specific argument here to make sure to respect the arch-specific site-packages location if py3: @@ -1366,7 +1513,7 @@ else: env['PYTHON_SYS_PREFIX'] = os.popen('''%s -c "import sys; print sys.prefix"''' % env['PYTHON']).read().strip() env['PYTHON_VERSION'] = os.popen('''%s -c "import sys; print sys.version"''' % env['PYTHON']).read()[0:3] - env['PYTHON_INCLUDES'] = env['PYTHON_SYS_PREFIX'] + '/include/python' + env['PYTHON_VERSION'] + env['PYTHON_INCLUDES'] = [env['PYTHON_SYS_PREFIX'] + '/include/python' + env['PYTHON_VERSION']] env['PYTHON_SITE_PACKAGES'] = env['DESTDIR'] + os.path.sep + env['PYTHON_SYS_PREFIX'] + os.path.sep + env['LIBDIR_SCHEMA'] + '/python' + env['PYTHON_VERSION'] + '/site-packages/' # if user-requested custom prefix fall back to manual concatenation for building subdirectories @@ -1386,22 +1533,23 @@ else: env['PYTHON_IS_64BIT'] = False - if py3 and env['BOOST_PYTHON_LIB'] == 'boost_python': - env['BOOST_PYTHON_LIB'] = 'boost_python3%s' % env['BOOST_APPEND'] - elif env['BOOST_PYTHON_LIB'] == 'boost_python': - env['BOOST_PYTHON_LIB'] = 'boost_python%s' % env['BOOST_APPEND'] - - if not conf.CheckHeader(header='boost/python/detail/config.hpp',language='C++'): - color_print(1,'Could not find required header files for boost python') - env['MISSING_DEPS'].append('boost python') - - if env['CAIRO']: - if conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('pycairo'): - env['HAS_PYCAIRO'] = True + if has_boost_devel and 'python' in env['BINDINGS']: + if py3 and env['BOOST_PYTHON_LIB'] == 'boost_python': + env['BOOST_PYTHON_LIB'] = 'boost_python3%s' % env['BOOST_APPEND'] + elif env['BOOST_PYTHON_LIB'] == 'boost_python': + env['BOOST_PYTHON_LIB'] = 'boost_python%s' % env['BOOST_APPEND'] + if not env['HOST']: + if not conf.CheckHeader(header='boost/python/detail/config.hpp',language='C++'): + color_print(1,'Could not find required header files for boost python') + env['MISSING_DEPS'].append('boost python') + + if env['CAIRO']: + if CHECK_PKG_CONFIG and conf.CheckPKG('pycairo'): + env['HAS_PYCAIRO'] = True + else: + env['SKIPPED_DEPS'].extend(['pycairo']) else: - env['SKIPPED_DEPS'].extend(['pycairo']) - else: - color_print(4,'Not building with pycairo support, pass CAIRO=True to enable') + color_print(4,'Not building with pycairo support, pass CAIRO=True to enable') #### End Config Stage for Required Dependencies #### @@ -1418,7 +1566,7 @@ color_print(4," $ sudo python scons/scons.py install") color_print(4,"\nTo view available path variables:\n $ python scons/scons.py --help or -h") color_print(4,'\nTo view overall SCons help options:\n $ python scons/scons.py --help-options or -H\n') - color_print(4,'More info: https://github.com/mapnik/mapnik/wiki//MapnikInstallation') + color_print(4,'More info: https://github.com/mapnik/mapnik/wiki/Mapnik-Installation') if not HELP_REQUESTED: Exit(1) else: @@ -1438,43 +1586,38 @@ color_print(4,"Did not use user config file, no custom path variables will be saved...") if env['SKIPPED_DEPS']: - color_print(3,'\nNote: will build without these OPTIONAL dependencies:\n - %s' % '\n - '.join([pretty_dep(dep) for dep in env['SKIPPED_DEPS']])) + color_print(4,'\nNote: will build without these OPTIONAL dependencies:\n - %s' % '\n - '.join([pretty_dep(dep) for dep in env['SKIPPED_DEPS']])) print # fetch the mapnik version header in order to set the # ABI version used to build libmapnik.so on linux in src/build.py abi = conf.GetMapnikLibVersion() - abi_fallback = "2.1.0" + abi_fallback = "2.2.0" if not abi: color_print(1,'Problem encountered parsing mapnik version, falling back to %s' % abi_fallback) abi = abi_fallback - env['ABI_VERSION'] = abi.replace('-pre','').split('.') + abi_no_pre = abi.replace('-pre','').split('.') + env['ABI_VERSION'] = abi_no_pre env['MAPNIK_VERSION_STRING'] = abi + env['MAPNIK_VERSION'] = str(int(abi_no_pre[0])*100000+int(abi_no_pre[1])*100+int(abi_no_pre[2])) - # Common C++ flags. + # Common DEFINES. + env.Append(CPPDEFINES = '-D%s' % env['PLATFORM'].upper()) if env['THREADING'] == 'multi': - common_cxx_flags = '-D%s -DBOOST_SPIRIT_THREADSAFE -DMAPNIK_THREADSAFE ' % env['PLATFORM'].upper() - else : - common_cxx_flags = '-D%s ' % env['PLATFORM'].upper() + env.Append(CPPDEFINES = '-DMAPNIK_THREADSAFE') # Mac OSX (Darwin) special settings if env['PLATFORM'] == 'Darwin': pthread = '' - # Getting the macintosh version number, sticking as a compiler macro - # for Leopard -- needed because different workarounds are needed than - # for Tiger. - # this was used for fribidi - not longer needed - # but will retain logic for future use - #if platform.mac_ver()[0].startswith('10.5'): - # common_cxx_flags += '-DOSX_LEOPARD ' else: pthread = '-pthread' # Common debugging flags. # http://lists.fedoraproject.org/pipermail/devel/2010-November/144952.html - debug_flags = '-g -fno-omit-frame-pointer -DDEBUG -DMAPNIK_DEBUG' - ndebug_flags = '-DNDEBUG' + debug_flags = ['-g', '-fno-omit-frame-pointer'] + debug_defines = ['-DDEBUG', '-DMAPNIK_DEBUG'] + ndebug_defines = ['-DNDEBUG'] # Enable logging in debug mode (always) and release mode (when specified) if env['DEFAULT_LOG_SEVERITY']: @@ -1489,50 +1632,57 @@ color_print(1,"No logger severity specified, available options are %s." % severities_list) Exit(1) - log_enabled = ' -DMAPNIK_LOG -DMAPNIK_DEFAULT_LOG_SEVERITY=%d' % log_severity + log_enabled = ['-DMAPNIK_LOG', '-DMAPNIK_DEFAULT_LOG_SEVERITY=%d' % log_severity] if env['DEBUG']: - debug_flags += log_enabled + debug_defines += log_enabled else: if env['ENABLE_LOG']: - ndebug_flags += log_enabled + ndebug_defines += log_enabled # Enable statistics reporting if env['ENABLE_STATS']: - debug_flags += ' -DMAPNIK_STATS' - ndebug_flags += ' -DMAPNIK_STATS' + debug_defines.append('-DMAPNIK_STATS') + ndebug_defines.append('-DMAPNIK_STATS') # Add rdynamic to allow using statics between application and plugins # http://stackoverflow.com/questions/8623657/multiple-instances-of-singleton-across-shared-libraries-on-linux if env['PLATFORM'] != 'Darwin' and env['CXX'] == 'g++': env.MergeFlags('-rdynamic') - # Customizing the C++ compiler flags depending on: - # (1) the C++ compiler used; and - # (2) whether debug binaries are requested. - if env['SUNCC']: - if env['DEBUG']: - env.Append(CXXFLAGS = common_cxx_flags + debug_flags) - else: - env.Append(CXXFLAGS = common_cxx_flags + '-O %s' % ndebug_flags) + if env['DEBUG']: + env.Append(CXXFLAGS = debug_flags) + env.Append(CPPDEFINES = debug_defines) else: - # Common flags for GCC. - gcc_cxx_flags = '-ansi -Wall %s %s -ftemplate-depth-300 %s' % (env['WARNING_CXXFLAGS'], pthread, common_cxx_flags) + env.Append(CPPDEFINES = ndebug_defines) + + if not env['SUNCC']: + + # Common flags for CXX compiler. + common_cxx_flags = '-ansi -Wall %s %s -ftemplate-depth-300 ' % (env['WARNING_CXXFLAGS'], pthread) + + # https://github.com/mapnik/mapnik/issues/1835 + if sys.platform == 'darwin' and env['CXX'] == 'g++': + common_cxx_flags += '-fpermissive ' + if env['DEBUG']: - env.Append(CXXFLAGS = gcc_cxx_flags + '-O0 -fno-inline %s' % debug_flags) + env.Append(CXXFLAGS = common_cxx_flags + '-O0 -fno-inline') else: - env.Append(CXXFLAGS = gcc_cxx_flags + '-O%s -fno-strict-aliasing -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts %s' % (env['OPTIMIZATION'],ndebug_flags)) + # TODO - add back -fvisibility-inlines-hidden + # https://github.com/mapnik/mapnik/issues/1863 + env.Append(CXXFLAGS = common_cxx_flags + '-O%s -fno-strict-aliasing -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts' % (env['OPTIMIZATION'])) if env['DEBUG_UNDEFINED']: - env.Append(CXXFLAGS = '-fcatch-undefined-behavior -ftrapv -fwrapv') + env.Append(CXXFLAGS = '-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error -ftrapv -fwrapv') - if 'python' in env['BINDINGS']: + if 'python' in env['BINDINGS'] or 'python' in env['REQUESTED_PLUGINS']: majver, minver = env['PYTHON_VERSION'].split('.') # we don't want the includes it in the main environment... # as they are later set in the python build.py # ugly hack needed until we have env specific conf backup = env.Clone().Dictionary() - env.AppendUnique(CPPPATH = os.path.realpath(env['PYTHON_INCLUDES'])) + for pyinc in env['PYTHON_INCLUDES']: + env.AppendUnique(CPPPATH = os.path.realpath(pyinc)) if not conf.CheckHeader(header='Python.h',language='C'): color_print(1,'Could not find required header files for the Python language (version %s)' % env['PYTHON_VERSION']) @@ -1542,14 +1692,15 @@ color_print(1,"Python version 2.2 or greater required") Exit(1) - color_print(4,'Bindings Python version... %s' % env['PYTHON_VERSION']) - color_print(4,'Python %s prefix... %s' % (env['PYTHON_VERSION'], env['PYTHON_SYS_PREFIX'])) - color_print(4,'Python bindings will install in... %s' % os.path.normpath(env['PYTHON_INSTALL_LOCATION'])) + if 'python' in env['BINDINGS']: + color_print(4,'Bindings Python version... %s' % env['PYTHON_VERSION']) + color_print(4,'Python %s prefix... %s' % (env['PYTHON_VERSION'], env['PYTHON_SYS_PREFIX'])) + color_print(4,'Python bindings will install in... %s' % os.path.normpath(env['PYTHON_INSTALL_LOCATION'])) env.Replace(**backup) # if requested, sort LIBPATH and CPPPATH one last time before saving... if env['PRIORITIZE_LINKING']: - conf.prioritize_paths() + conf.prioritize_paths(silent=True) # finish config stage and pickle results env = conf.Finish() @@ -1607,15 +1758,11 @@ p = env['PATH_REMOVE'] if p in env['ENV']['PATH']: env['ENV']['PATH'].replace(p,'') - def rm_path(set): - for i in env[set]: - if p in i: - env[set].remove(i) - rm_path('LIBPATH') - rm_path('CPPPATH') - rm_path('CXXFLAGS') - rm_path('CAIROMM_LIBPATHS') - rm_path('CAIROMM_CPPPATHS') + rm_path(p,'LIBPATH',env) + rm_path(p,'CPPPATH',env) + rm_path(p,'CXXFLAGS',env) + rm_path(p,'CAIRO_LIBPATHS',env) + rm_path(p,'CAIRO_CPPPATHS',env) if env['PATH_REPLACE']: searches,replace = env['PATH_REPLACE'].split(':') @@ -1631,28 +1778,16 @@ replace_path('LIBPATH',search,replace) replace_path('CPPPATH',search,replace) replace_path('CXXFLAGS',search,replace) - replace_path('CAIROMM_LIBPATHS',search,replace) - replace_path('CAIROMM_CPPPATHS',search,replace) + replace_path('CAIRO_LIBPATHS',search,replace) + replace_path('CAIRO_CPPPATHS',search,replace) # export env so it is available in build.py files Export('env') plugin_base = env.Clone() - # for this to work you need: - # if __GNUC__ >= 4 - # define MAPNIK_EXP __attribute__ ((visibility ("default"))) - #plugin_base.Append(CXXFLAGS='-fvisibility=hidden') - #plugin_base.Append(CXXFLAGS='-fvisibility-inlines-hidden') Export('plugin_base') - # clear the '_CPPDEFFLAGS' variable - # for unknown reasons this variable puts -DNone - # in the g++ args prompting unnecessary recompiles - env['_CPPDEFFLAGS'] = None - plugin_base['_CPPDEFFLAGS'] = None - - if env['FAST']: # caching is 'auto' by default in SCons # But let's also cache implicit deps... @@ -1670,37 +1805,56 @@ # Build the core library SConscript('src/build.py') + # Install headers + SConscript('include/build.py') + + # Install auxiliary headers + SConscript('deps/mapnik/build.py') + # Build the requested and able-to-be-compiled input plug-ins GDAL_BUILT = False OGR_BUILT = False - for plugin in env['REQUESTED_PLUGINS']: - details = env['PLUGINS'][plugin] - if details['lib'] in env['LIBS']: - SConscript('plugins/input/%s/build.py' % plugin) - if plugin == 'ogr': OGR_BUILT = True - if plugin == 'gdal': GDAL_BUILT = True - if plugin == 'ogr' or plugin == 'gdal': - if GDAL_BUILT and OGR_BUILT: + for plugin in env['PLUGINS']: + if env['PLUGIN_LINKING'] == 'static' or plugin not in env['REQUESTED_PLUGINS']: + if os.path.exists('plugins/input/%s.input' % plugin): + os.unlink('plugins/input/%s.input' % plugin) + if plugin in env['REQUESTED_PLUGINS']: + details = env['PLUGINS'][plugin] + if details['lib'] in env['LIBS']: + if env['PLUGIN_LINKING'] == 'shared': + SConscript('plugins/input/%s/build.py' % plugin) + if plugin == 'ogr': OGR_BUILT = True + if plugin == 'gdal': GDAL_BUILT = True + if plugin == 'ogr' or plugin == 'gdal': + if GDAL_BUILT and OGR_BUILT: + env['LIBS'].remove(details['lib']) + else: env['LIBS'].remove(details['lib']) + elif not details['lib']: + if env['PLUGIN_LINKING'] == 'shared': + # build internal datasource input plugins + SConscript('plugins/input/%s/build.py' % plugin) else: - env['LIBS'].remove(details['lib']) - elif not details['lib']: - # build internal shape and raster plugins - SConscript('plugins/input/%s/build.py' % plugin) - else: - color_print(1,"Notice: dependencies not met for plugin '%s', not building..." % plugin) + color_print(1,"Notice: dependencies not met for plugin '%s', not building..." % plugin) + if os.path.exists('plugins/input/%s.input' % plugin): + os.unlink('plugins/input/%s.input' % plugin) create_uninstall_target(env, env['MAPNIK_LIB_DIR_DEST'], False) create_uninstall_target(env, env['MAPNIK_INPUT_PLUGINS_DEST'] , False) - # before installing plugins, wipe out any previously - # installed plugins that we are no longer building if 'install' in COMMAND_LINE_TARGETS: + # if statically linking plugins still make sure + # to create the dynamic plugins directory + if env['PLUGIN_LINKING'] == 'static': + if not os.path.exists(env['MAPNIK_INPUT_PLUGINS_DEST']): + os.makedirs(env['MAPNIK_INPUT_PLUGINS_DEST']) + # before installing plugins, wipe out any previously + # installed plugins that we are no longer building for plugin in PLUGINS.keys(): - if plugin not in env['REQUESTED_PLUGINS']: - plugin_path = os.path.join(env['MAPNIK_INPUT_PLUGINS_DEST'],'%s.input' % plugin) - if os.path.exists(plugin_path): - color_print(1,"Notice: removing out of date plugin: '%s'" % plugin_path) + plugin_path = os.path.join(env['MAPNIK_INPUT_PLUGINS_DEST'],'%s.input' % plugin) + if os.path.exists(plugin_path): + if plugin not in env['REQUESTED_PLUGINS'] or env['PLUGIN_LINKING'] == 'static': + color_print(4,"Notice: removing out of date plugin: '%s'" % plugin_path) os.unlink(plugin_path) # Build the c++ rundemo app if requested @@ -1709,13 +1863,15 @@ # Build shapeindex and remove its dependency from the LIBS if 'boost_program_options%s' % env['BOOST_APPEND'] in env['LIBS']: - SConscript('utils/shapeindex/build.py') + if env['SHAPEINDEX']: + SConscript('utils/shapeindex/build.py') # Build the pgsql2psqlite app if requested if env['PGSQL2SQLITE']: SConscript('utils/pgsql2sqlite/build.py') - SConscript('utils/svg2png/build.py') + if env['SVG2PNG']: + SConscript('utils/svg2png/build.py') # devtools not ready for public #SConscript('utils/ogrindex/build.py') @@ -1737,13 +1893,13 @@ SConscript('fonts/build.py') # build C++ tests - # not ready for release SConscript('tests/cpp_tests/build.py') - # not currently maintained - # https://github.com/mapnik/mapnik/issues/1438 - #if env['SVG_RENDERER']: - # SConscript('tests/cpp_tests/svg_renderer_tests/build.py') + if env['CPP_TESTS'] and env['SVG_RENDERER']: + SConscript('tests/cpp_tests/svg_renderer_tests/build.py') + + if env['BENCHMARK']: + SConscript('benchmark/build.py') # install pkg-config script and mapnik-config script SConscript('utils/mapnik-config/build.py') @@ -1754,3 +1910,15 @@ # if requested, build the sample input plugins if env['SAMPLE_INPUT_PLUGINS']: SConscript('plugins/input/templates/helloworld/build.py') + else: + if 'install' in COMMAND_LINE_TARGETS: + plugin_path = os.path.join(env['MAPNIK_INPUT_PLUGINS_DEST'],'hello.input') + if os.path.exists(plugin_path): + color_print(4,"Notice: removing out of date plugin: '%s'" % plugin_path) + os.unlink(plugin_path) + if os.path.exists('plugins/input/templates/hello.input'): + os.unlink('plugins/input/templates/hello.input') + + # update linux project files + if env['PLATFORM'] == 'Linux': + update_linux_project_files() diff -Nru mapnik-2.1.0/benchmark/allocation.cpp mapnik-2.2.0/benchmark/allocation.cpp --- mapnik-2.1.0/benchmark/allocation.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/benchmark/allocation.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,49 @@ +#include +#include + + +#define BOOST_CHRONO_HEADER_ONLY +#include +#include +#include + +using namespace boost::chrono; +using namespace mapnik; + +void threaded_benchmark(void test(),std::string const& name, unsigned threads) { + using namespace boost::chrono; + typedef process_cpu_clock clock_type; + process_real_cpu_clock::time_point start = process_real_cpu_clock::now(); + boost::thread_group threads; + for (unsigned i=0;i(elapsed) + << " (" << boost::chrono::duration_cast(elapsed) << ")" + << " <-- " << name << "\n"; +} + + +void test_wkt_creation() +{ + boost::ptr_vector paths; + mapnik::wkt_parser parse_wkt; + std::string value("GEOMETRYCOLLECTION(MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)),((20 35, 45 20, 30 5, 10 10, 10 30, 20 35),(30 20, 20 25, 20 15, 30 20))),POINT(2 3),LINESTRING(2 3,3 4),MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)),((20 35, 45 20, 30 5, 10 10, 10 30, 20 35),(30 20, 20 25, 20 15, 30 20))),MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)),((20 35, 45 20, 30 5, 10 10, 10 30, 20 35),(30 20, 20 25, 20 15, 30 20))),MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)),((20 35, 45 20, 30 5, 10 10, 10 30, 20 35),(30 20, 20 25, 20 15, 30 20))))"); + if (!parse_wkt.parse(value, paths)) std::clog << "failed to parse\n"; + int iterations = 10000; + typedef process_cpu_clock clock_type; + process_real_cpu_clock::time_point start = process_real_cpu_clock::now(); + for (int i=0;i(elapsed) << "\n"; +} + +int main( int, char*[] ) +{ + return 0; +} \ No newline at end of file diff -Nru mapnik-2.1.0/benchmark/build.py mapnik-2.2.0/benchmark/build.py --- mapnik-2.1.0/benchmark/build.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/benchmark/build.py 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,26 @@ +import os +import glob +from copy import copy + +Import ('env') + +test_env = env.Clone() + +test_env['LIBS'] = copy(env['LIBMAPNIK_LIBS']) +test_env.AppendUnique(LIBS='mapnik') +#test_env.AppendUnique(LIBS='sqlite3') +test_env.AppendUnique(CXXFLAGS='-g') +linkflags = copy(env['CUSTOM_LDFLAGS']) +linkflags +if env['PLATFORM'] == 'Darwin': + linkflags += ' -F/ -framework CoreFoundation' + +for cpp_test in glob.glob('run*.cpp'): + name = cpp_test.replace('.cpp','') + source_files = [cpp_test] + test_env_local = test_env.Clone() + test_program = test_env_local.Program(name, source=source_files, LINKFLAGS=linkflags) + Depends(test_program, env.subst('../src/%s' % env['MAPNIK_LIB_NAME'])) + # build locally if installing + if 'install' in COMMAND_LINE_TARGETS: + env.Alias('install',test_program) Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/benchmark/data/multicolor-hextree-expected.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/benchmark/data/multicolor-hextree-expected.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/benchmark/data/multicolor.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/benchmark/data/multicolor.png differ diff -Nru mapnik-2.1.0/benchmark/data/polygon.wkt mapnik-2.2.0/benchmark/data/polygon.wkt --- mapnik-2.1.0/benchmark/data/polygon.wkt 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/benchmark/data/polygon.wkt 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1 @@ +MULTIPOLYGON (((30 20, 10 40, 45 40, 30 20)),((15 5, 40 10, 10 20, 5 10, 15 5))) \ No newline at end of file diff -Nru mapnik-2.1.0/benchmark/run.cpp mapnik-2.2.0/benchmark/run.cpp --- mapnik-2.1.0/benchmark/run.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/benchmark/run.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,916 @@ +#include +#include +#include +#include +#include + + +// stl +#include +#include +#include +#include +#include +#include +#include + + +// boost +#include +#include +#include +#include + +#define BOOST_CHRONO_HEADER_ONLY +#include +#include +#include + +using namespace boost::chrono; +using namespace mapnik; + +static unsigned test_num = 1; +static bool dry_run = false; +static std::set test_set; + +typedef process_cpu_clock clock_type; +typedef clock_type::duration dur; + +template +void benchmark(T & test_runner, std::string const& name) +{ + try { + bool should_run_test = true; + if (!test_set.empty()) + { + should_run_test = test_set.find(test_num) != test_set.end(); + } + if (should_run_test || dry_run) + { + if (!test_runner.validate()) + { + std::clog << "test did not validate: " << name << "\n"; + //throw std::runtime_error(std::string("test did not validate: ") + name); + } + if (dry_run) + { + std::clog << test_num << ") " << (test_runner.threads_ ? "threaded -> ": "") + << name << "\n"; + } + else + { + process_cpu_clock::time_point start; + dur elapsed; + if (test_runner.threads_ > 0) + { + boost::thread_group tg; + for (unsigned i=0;i ": "") + << name << ": " + << boost::chrono::duration_cast(elapsed) << "\n"; + } + } + } + catch (std::exception const& ex) + { + std::clog << "test runner did not complete: " << ex.what() << "\n"; + } + test_num++; +} + +bool compare_images(std::string const& src_fn,std::string const& dest_fn) +{ + std::auto_ptr reader1(mapnik::get_image_reader(dest_fn,"png")); + if (!reader1.get()) + { + throw mapnik::image_reader_exception("Failed to load: " + dest_fn); + } + boost::shared_ptr image_ptr1 = boost::make_shared(reader1->width(),reader1->height()); + reader1->read(0,0,image_ptr1->data()); + + std::auto_ptr reader2(mapnik::get_image_reader(src_fn,"png")); + if (!reader2.get()) + { + throw mapnik::image_reader_exception("Failed to load: " + src_fn); + } + boost::shared_ptr image_ptr2 = boost::make_shared(reader2->width(),reader2->height()); + reader2->read(0,0,image_ptr2->data()); + + image_data_32 const& dest = image_ptr1->data(); + image_data_32 const& src = image_ptr2->data(); + + unsigned int width = src.width(); + unsigned int height = src.height(); + if ((width != dest.width()) || height != dest.height()) return false; + for (unsigned int y = 0; y < height; ++y) + { + const unsigned int* row_from = src.getRow(y); + const unsigned int* row_to = dest.getRow(y); + for (unsigned int x = 0; x < width; ++x) + { + if (row_from[x] != row_to[x]) return false; + } + } + return true; +} + +struct test1 +{ + unsigned iter_; + unsigned threads_; + explicit test1(unsigned iterations, unsigned threads=0) : + iter_(iterations), + threads_(threads) + {} + + bool validate() + { + return true; + } + + void operator()() + { + mapnik::image_data_32 im(256,256); + std::string out; + for (unsigned i=0;i im_; + explicit test2(unsigned iterations, unsigned threads=0) : + iter_(iterations), + threads_(threads), + im_() + { + std::string filename("./benchmark/data/multicolor.png"); + std::auto_ptr reader(mapnik::get_image_reader(filename,"png")); + if (!reader.get()) + { + throw mapnik::image_reader_exception("Failed to load: " + filename); + } + im_ = boost::make_shared(reader->width(),reader->height()); + reader->read(0,0,im_->data()); + } + + bool validate() + { + std::string expected("./benchmark/data/multicolor-hextree-expected.png"); + std::string actual("./benchmark/data/multicolor-hextree-actual.png"); + mapnik::save_to_file(im_->data(),actual, "png8:m=h"); + return compare_images(actual,expected); + } + + void operator()() + { + std::string out; + for (unsigned i=0;idata(),"png8:m=h"); + } + } +}; + + +struct test3 +{ + unsigned iter_; + unsigned threads_; + double val_; + explicit test3(unsigned iterations, unsigned threads=0) : + iter_(iterations), + threads_(threads), + val_(-0.123) {} + bool validate() + { + std::ostringstream s; + s << val_; + return (s.str() == "-0.123"); + } + void operator()() + { + std::string out; + for (unsigned i=0;i(snprintf(&s[0], s.size()+1, "%g", val_)); + if (n2 <= s.size()) + { + s.resize(n2); + break; + } + s.resize(n2); + } + return true; + } + void operator()() + { + std::string out; + for (unsigned i=0;i +#include +#include + +struct test6 +{ + unsigned iter_; + unsigned threads_; + std::string src_; + std::string dest_; + mapnik::box2d from_; + mapnik::box2d to_; + bool defer_proj4_init_; + explicit test6(unsigned iterations, + unsigned threads, + std::string const& src, + std::string const& dest, + mapnik::box2d from, + mapnik::box2d to, + bool defer_proj) : + iter_(iterations), + threads_(threads), + src_(src), + dest_(dest), + from_(from), + to_(to), + defer_proj4_init_(defer_proj) {} + + bool validate() + { + mapnik::projection src(src_,defer_proj4_init_); + mapnik::projection dest(dest_,defer_proj4_init_); + mapnik::proj_transform tr(src,dest); + mapnik::box2d bbox = from_; + if (!tr.forward(bbox)) return false; + return ((std::fabs(bbox.minx() - to_.minx()) < .5) && + (std::fabs(bbox.maxx() - to_.maxx()) < .5) && + (std::fabs(bbox.miny() - to_.miny()) < .5) && + (std::fabs(bbox.maxy() - to_.maxy()) < .5) + ); + } + void operator()() + { + unsigned count=0; + for (int i=-180;i<180;++i) + { + for (int j=-85;j<85;++j) + { + mapnik::projection src(src_,defer_proj4_init_); + mapnik::projection dest(dest_,defer_proj4_init_); + mapnik::proj_transform tr(src,dest); + mapnik::box2d box(i,j,i,j); + if (!tr.forward(box)) throw std::runtime_error("could not transform coords"); + ++count; + } + } + } +}; + +#include +#include +#include + +struct test7 +{ + unsigned iter_; + unsigned threads_; + std::string expr_; + explicit test7(unsigned iterations, + unsigned threads, + std::string const& expr) : + iter_(iterations), + threads_(threads), + expr_(expr) + {} + + bool validate() + { + mapnik::expression_ptr expr = mapnik::parse_expression(expr_,"utf-8"); + return mapnik::to_expression_string(*expr) == expr_; + } + void operator()() + { + for (unsigned i=0;i + +struct test8 +{ + unsigned iter_; + unsigned threads_; + std::string expr_; + explicit test8(unsigned iterations, + unsigned threads, + std::string const& expr) : + iter_(iterations), + threads_(threads), + expr_(expr) + {} + + bool validate() + { + transcoder tr("utf-8"); + mapnik::expression_grammar expr_grammar(tr); + mapnik::expression_ptr expr = mapnik::parse_expression(expr_,expr_grammar); + return mapnik::to_expression_string(*expr) == expr_; + } + void operator()() + { + transcoder tr("utf-8"); + mapnik::expression_grammar expr_grammar(tr); + for (unsigned i=0;i + +#if BOOST_VERSION >= 105300 +#include +#include + +class rule_cache_move +{ +private: + BOOST_MOVABLE_BUT_NOT_COPYABLE(rule_cache_move) +public: + typedef std::vector rule_ptrs; + rule_cache_move() + : if_rules_(), + else_rules_(), + also_rules_() {} + + rule_cache_move(BOOST_RV_REF(rule_cache_move) rhs) // move ctor + : if_rules_(boost::move(rhs.if_rules_)), + else_rules_(boost::move(rhs.else_rules_)), + also_rules_(boost::move(rhs.also_rules_)) + {} + + rule_cache_move& operator=(BOOST_RV_REF(rule_cache_move) rhs) // move assign + { + std::swap(if_rules_, rhs.if_rules_); + std::swap(else_rules_,rhs.else_rules_); + std::swap(also_rules_, rhs.also_rules_); + return *this; + } + + void add_rule(rule const& r) + { + if (r.has_else_filter()) + { + else_rules_.push_back(&r); + } + else if (r.has_also_filter()) + { + also_rules_.push_back(&r); + } + else + { + if_rules_.push_back(&r); + } + } + + rule_ptrs const& get_if_rules() const + { + return if_rules_; + } + + rule_ptrs const& get_else_rules() const + { + return else_rules_; + } + + rule_ptrs const& get_also_rules() const + { + return also_rules_; + } + +private: + rule_ptrs if_rules_; + rule_ptrs else_rules_; + rule_ptrs also_rules_; +}; + +struct test9 +{ + unsigned iter_; + unsigned threads_; + unsigned num_rules_; + unsigned num_styles_; + std::vector rules_; + explicit test9(unsigned iterations, + unsigned threads, + unsigned num_rules, + unsigned num_styles) : + iter_(iterations), + threads_(threads), + num_rules_(num_rules), + num_styles_(num_styles), + rules_() { + mapnik::rule r("test"); + for (unsigned i=0;i rule_caches; + for (unsigned i=0;i rule_ptrs; + rule_cache_heap() + : if_rules_(), + else_rules_(), + also_rules_() {} + + void add_rule(rule const& r) + { + if (r.has_else_filter()) + { + else_rules_.push_back(&r); + } + else if (r.has_also_filter()) + { + also_rules_.push_back(&r); + } + else + { + if_rules_.push_back(&r); + } + } + + rule_ptrs const& get_if_rules() const + { + return if_rules_; + } + + rule_ptrs const& get_else_rules() const + { + return else_rules_; + } + + rule_ptrs const& get_also_rules() const + { + return also_rules_; + } + +private: + rule_ptrs if_rules_; + rule_ptrs else_rules_; + rule_ptrs also_rules_; +}; + +struct test10 +{ + unsigned iter_; + unsigned threads_; + unsigned num_rules_; + unsigned num_styles_; + std::vector rules_; + explicit test10(unsigned iterations, + unsigned threads, + unsigned num_rules, + unsigned num_styles) : + iter_(iterations), + threads_(threads), + num_rules_(num_rules), + num_styles_(num_styles), + rules_() { + mapnik::rule r("test"); + for (unsigned i=0;i rule_caches; + for (unsigned i=0;i rc(new rule_cache_heap); + for (unsigned i=0;iadd_rule(rules_[i]); + } + rule_caches.push_back(rc); + } + } + } +}; + + +#include +#include "agg_conv_clipper.h" +#include "agg_path_storage.h" +#include + +struct test11 +{ + unsigned iter_; + unsigned threads_; + std::string wkt_in_; + mapnik::box2d extent_; + typedef agg::conv_clipper poly_clipper; + test11(unsigned iterations, + unsigned threads, + std::string wkt_in, + mapnik::box2d const& extent) + : iter_(iterations), + threads_(threads), + wkt_in_(wkt_in), + extent_(extent) { + + } + + bool validate() + { + return true; + } + void operator()() + { + boost::ptr_vector paths; + if (!mapnik::from_wkt(wkt_in_, paths)) + { + throw std::runtime_error("Failed to parse WKT"); + } + agg::path_storage ps; + ps.move_to(extent_.minx(), extent_.miny()); + ps.line_to(extent_.minx(), extent_.maxy()); + ps.line_to(extent_.maxx(), extent_.maxy()); + ps.line_to(extent_.maxx(), extent_.miny()); + ps.close_polygon(); + for (unsigned i=0;i + +struct test12 +{ + unsigned iter_; + unsigned threads_; + std::string wkt_in_; + + mapnik::box2d extent_; + typedef mapnik::polygon_clipper poly_clipper; + test12(unsigned iterations, + unsigned threads, + std::string wkt_in, + mapnik::box2d const& extent) + : iter_(iterations), + threads_(threads), + wkt_in_(wkt_in), + extent_(extent) + { + } + + bool validate() + { + return true; + } + void operator()() + { + boost::ptr_vector paths; + if (!mapnik::from_wkt(wkt_in_, paths)) + { + throw std::runtime_error("Failed to parse WKT"); + } + for (unsigned i=0;i +#include +struct test13 +{ + unsigned iter_; + unsigned threads_; + + test13(unsigned iterations, + unsigned threads) + : iter_(iterations), + threads_(threads) + {} + + bool validate() + { + return true; + } + + void operator()() + { + mapnik::freetype_engine engine; + unsigned long count = 0; + for (unsigned i=0;i 0) { + for (int i=0;i from(-180,-80,180,80); + mapnik::box2d to(-20037508.3427892476,-15538711.0963092316,20037508.3427892476,15538711.0963092316); + + { + // echo -180 -60 | cs2cs -f "%.10f" +init=epsg:4326 +to +init=epsg:3857 + test6 runner(100000000,100, + "+init=epsg:4326", + "+init=epsg:3857", + from,to,true); + benchmark(runner,"lonlat -> merc coord transformation (epsg)"); + } + + { + test6 runner(100000000,100, + "+init=epsg:3857", + "+init=epsg:4326", + to,from,true); + benchmark(runner,"merc -> lonlat coord transformation (epsg)"); + } + + { + test6 runner(100000000,100, + "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs", + "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over", + from,to,true); + benchmark(runner,"lonlat -> merc coord transformation (literal)"); + } + + { + test6 runner(100000000,100, + "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over", + "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs", + to,from,true); + benchmark(runner,"merc -> lonlat coord transformation (literal)"); + } + + { + test7 runner(10000,100,"([foo]=1)"); + benchmark(runner,"expression parsing with grammer per parse"); + } + + { + test8 runner(10000,100,"([foo]=1)"); + benchmark(runner,"expression parsing by re-using grammar"); + } + + { +#if BOOST_VERSION >= 105300 + test9 runner(1000,10,200,50); + benchmark(runner,"rule caching using boost::move"); +#else + std::clog << "not running: 'rule caching using boost::move'\n"; +#endif + } + + { + test10 runner(1000,10,200,50); + benchmark(runner,"rule caching using heap allocation"); + } + + { + std::string filename_("benchmark/data/polygon.wkt"); + std::ifstream in(filename_.c_str(),std::ios_base::in | std::ios_base::binary); + if (!in.is_open()) + throw std::runtime_error("could not open: '" + filename_ + "'"); + std::string wkt_in( (std::istreambuf_iterator(in) ), + (std::istreambuf_iterator()) ); + mapnik::box2d clipping_box(0,0,40,40); + + test11 runner(100000,10,wkt_in,clipping_box); + benchmark(runner,"clipping polygon with agg_conv_clipper"); + } + + { + + std::string filename_("benchmark/data/polygon.wkt"); + std::ifstream in(filename_.c_str(),std::ios_base::in | std::ios_base::binary); + if (!in.is_open()) + throw std::runtime_error("could not open: '" + filename_ + "'"); + std::string wkt_in( (std::istreambuf_iterator(in) ), + (std::istreambuf_iterator()) ); + mapnik::box2d clipping_box(0,0,40,40); + + test12 runner(100000,10,wkt_in,clipping_box); + benchmark(runner,"clipping polygon with mapnik::polygon_clipper"); + } + + { + mapnik::freetype_engine::register_fonts("./fonts", true); + unsigned face_count = mapnik::freetype_engine::face_names().size(); + test13 runner(1000,10); + benchmark(runner, (boost::format("font_engihe: created %ld faces in ") % (face_count * 1000 * 10)).str()); + } + std::cout << "...benchmark done\n"; + return 0; + } + catch (std::exception const& ex) + { + std::clog << "test error: " << ex.what() << "\n"; + return -1; + } +} diff -Nru mapnik-2.1.0/benchmark/utils/random_image.py mapnik-2.2.0/benchmark/utils/random_image.py --- mapnik-2.1.0/benchmark/utils/random_image.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/benchmark/utils/random_image.py 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,15 @@ +import mapnik +import random + +im = mapnik.Image(256,256) + +for x in xrange(0,im.width()): + for y in xrange(0,im.height()): + r = int(random.random() * 255) + g = random.random() * 255 + b = random.random() * 255 + a = random.random() + color = mapnik.Color('rgba(%i,%i,%i,%f)' % (r,g,b,a)) + im.set_pixel(x,y,color) + +im.save('./benchmark/data/multicolor.png') \ No newline at end of file diff -Nru mapnik-2.1.0/bindings/python/build.py mapnik-2.2.0/bindings/python/build.py --- mapnik-2.1.0/bindings/python/build.py 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/build.py 2013-06-04 01:35:26.000000000 +0000 @@ -1,7 +1,7 @@ # # This file is part of Mapnik (c++ mapping toolkit) # -# Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon +# Copyright (C) 2013 Artem Pavlenko # # Mapnik is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,7 +17,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# import os, re, sys, glob from subprocess import Popen, PIPE @@ -43,19 +43,18 @@ target_path = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik') target_path_deprecated = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik2') -libraries = ['mapnik',env['BOOST_PYTHON_LIB']] +py_env = env.Clone() +py_env.Append(CPPPATH = env['PYTHON_INCLUDES']) + +py_env['LIBS'] = ['mapnik',env['BOOST_PYTHON_LIB']] + +link_all_libs = env['LINKING'] == 'static' or env['RUNTIME_LINK'] == 'static' or (env['PLATFORM'] == 'Darwin' and not env['PYTHON_DYNAMIC_LOOKUP']) + +if link_all_libs: + py_env.AppendUnique(LIBS=env['LIBMAPNIK_LIBS']) # TODO - do solaris/fedora need direct linking too? if env['PLATFORM'] == 'Darwin': - if not env['PYTHON_DYNAMIC_LOOKUP']: - libraries.append('png') - if env['JPEG']: - libraries.append('jpeg') - libraries.append(env['ICU_LIB_NAME']) - libraries.append('boost_regex%s' % env['BOOST_APPEND']) - if env['THREADING'] == 'multi': - libraries.append('boost_thread%s' % env['BOOST_APPEND']) - ##### Python linking on OS X is tricky ### # Confounding problems are: # 1) likelyhood of multiple python installs of the same major.minor version @@ -95,7 +94,6 @@ else: # should we fall back to -lpython here? python_link_flag = '-F/ -framework Python' - # if we are not linking to a framework then use the *nix standard approach else: # TODO - do we need to pass -L/? @@ -146,9 +144,6 @@ # install the shared object beside the module directory sources = glob.glob('*.cpp') -py_env = env.Clone() -py_env.Append(CPPPATH = env['PYTHON_INCLUDES']) - if 'install' in COMMAND_LINE_TARGETS: # install the core mapnik python files, including '__init__.py' init_files = glob.glob('mapnik/*.py') @@ -173,17 +168,17 @@ if 'uninstall' not in COMMAND_LINE_TARGETS: if env['HAS_CAIRO']: - py_env.Append(CPPPATH = env['CAIROMM_CPPPATHS']) - py_env.Append(CXXFLAGS = '-DHAVE_CAIRO') - if env['PLATFORM'] == 'Darwin': - py_env.Append(LIBS=env['CAIROMM_LINKFLAGS']) + py_env.Append(CPPPATH = env['CAIRO_CPPPATHS']) + py_env.Append(CPPDEFINES = '-DHAVE_CAIRO') + if link_all_libs: + py_env.Append(LIBS=env['CAIRO_ALL_LIBS']) if env['HAS_PYCAIRO']: py_env.ParseConfig('pkg-config --cflags pycairo') - py_env.Append(CXXFLAGS = '-DHAVE_PYCAIRO') + py_env.Append(CPPDEFINES = '-DHAVE_PYCAIRO') -libraries.append('boost_thread%s' % env['BOOST_APPEND']) -_mapnik = py_env.LoadableModule('mapnik/_mapnik', sources, LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so',LINKFLAGS=linkflags) +py_env.AppendUnique(LIBS = 'boost_thread%s' % env['BOOST_APPEND']) +_mapnik = py_env.LoadableModule('mapnik/_mapnik', sources, LDMODULEPREFIX='', LDMODULESUFFIX='.so',LINKFLAGS=linkflags) Depends(_mapnik, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME'])) diff -Nru mapnik-2.1.0/bindings/python/mapnik/__init__.py mapnik-2.2.0/bindings/python/mapnik/__init__.py --- mapnik-2.1.0/bindings/python/mapnik/__init__.py 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik/__init__.py 2013-06-04 01:35:26.000000000 +0000 @@ -54,7 +54,7 @@ The settings file should be a python file with an 'env' variable that declares a dictionary of key:value pairs to push into the global process environment, if not already set, like: - + env = {'ICU_DATA':'/usr/local/share/icu/'} """ if os.path.exists(os.path.join(os.path.dirname(__file__),'mapnik_settings.py')): @@ -67,7 +67,8 @@ bootstrap_env() from _mapnik import * -from paths import inputpluginspath, fontscollectionpath +from paths import inputpluginspath +from paths import fontscollectionpath import printing printing.renderer = render @@ -136,18 +137,18 @@ def forward(self, projection): """ - Projects the point from the geographic coordinate - space into the cartesian space. The x component is - considered to be longitude, the y component the + Projects the point from the geographic coordinate + space into the cartesian space. The x component is + considered to be longitude, the y component the latitude. - Returns the easting (x) and northing (y) as a + Returns the easting (x) and northing (y) as a coordinate pair. - Example: Project the geographic coordinates of the + Example: Project the geographic coordinates of the city center of Stuttgart into the local - map projection (GK Zone 3/DHDN, EPSG 31467) - >>> p = Projection('+init=epsg:31467') + map projection (GK Zone 3/DHDN, EPSG 31467) + >>> p = Projection('+init=epsg:31467') >>> Coord(9.1, 48.7).forward(p) Coord(3507360.12813,5395719.2749) """ @@ -155,19 +156,19 @@ def inverse(self, projection): """ - Projects the point from the cartesian space - into the geographic space. The x component is - considered to be the easting, the y component + Projects the point from the cartesian space + into the geographic space. The x component is + considered to be the easting, the y component to be the northing. - Returns the longitude (x) and latitude (y) as a + Returns the longitude (x) and latitude (y) as a coordinate pair. - Example: Project the cartesian coordinates of the + Example: Project the cartesian coordinates of the city center of Stuttgart in the local map projection (GK Zone 3/DHDN, EPSG 31467) into geographic coordinates: - >>> p = Projection('+init=epsg:31467') + >>> p = Projection('+init=epsg:31467') >>> Coord(3507360.12813,5395719.2749).inverse(p) Coord(9.1, 48.7) """ @@ -175,13 +176,13 @@ class _Box2d(Box2d,_injector): """ - Represents a spatial envelope (i.e. bounding box). + Represents a spatial envelope (i.e. bounding box). Following operators are defined for Box2d: Addition: - e1 + e2 is equvalent to e1.expand_to_include(e2) but yields + e1 + e2 is equvalent to e1.expand_to_include(e2) but yields a new envelope instead of modifying e1 Subtraction: @@ -191,7 +192,7 @@ Multiplication and division change the width and height of the envelope by the given factor without modifying its center.. - That is, e1 * x is equivalent to: + That is, e1 * x is equivalent to: e1.width(x * e1.width()) e1.height(x * e1.height()), except that a new envelope is created instead of modifying e1. @@ -207,8 +208,8 @@ def forward(self, projection): """ - Projects the envelope from the geographic space - into the cartesian space by projecting its corner + Projects the envelope from the geographic space + into the cartesian space by projecting its corner points. See also: @@ -218,8 +219,8 @@ def inverse(self, projection): """ - Projects the envelope from the cartesian space - into the geographic space by projecting its corner + Projects the envelope from the cartesian space + into the geographic space by projecting its corner points. See also: @@ -234,7 +235,7 @@ def forward(self,obj): """ - Projects the given object (Box2d or Coord) + Projects the given object (Box2d or Coord) from the geographic space into the cartesian space. See also: @@ -245,7 +246,7 @@ def inverse(self,obj): """ - Projects the given object (Box2d or Coord) + Projects the given object (Box2d or Coord) from the cartesian space into the geographic space. See also: @@ -331,7 +332,7 @@ encoding -- file encoding (default 'utf-8') >>> from mapnik import Shapefile, Layer - >>> shp = Shapefile(base='/home/mapnik/data',file='world_borders') + >>> shp = Shapefile(base='/home/mapnik/data',file='world_borders') >>> lyr = Layer('Shapefile Layer') >>> lyr.datasource = shp @@ -339,6 +340,53 @@ keywords['type'] = 'shape' return CreateDatasource(keywords) +def CSV(**keywords): + """Create a CSV Datasource. + + Required keyword arguments: + file -- path to csv + + Optional keyword arguments: + inline -- inline CSV string (if provided 'file' argument will be ignored and non-needed) + base -- path prefix (default None) + encoding -- file encoding (default 'utf-8') + row_limit -- integer limit of rows to return (default: 0) + strict -- throw an error if an invalid row is encountered + escape -- The escape character to use for parsing data + quote -- The quote character to use for parsing data + separator -- The separator character to use for parsing data + headers -- A comma separated list of header names that can be set to add headers to data that lacks them + filesize_max -- The maximum filesize in MB that will be accepted + + >>> from mapnik import CSV + >>> csv = CSV(file='test.csv') + + >>> from mapnik import CSV + >>> csv = CSV(inline='''wkt,Name\n"POINT (120.15 48.47)","Winthrop, WA"''') + + For more information see https://github.com/mapnik/mapnik/wiki/CSV-Plugin + + """ + keywords['type'] = 'csv' + return CreateDatasource(keywords) + +def GeoJSON(**keywords): + """Create a GeoJSON Datasource. + + Required keyword arguments: + file -- path to json + + Optional keyword arguments: + encoding -- file encoding (default 'utf-8') + base -- path prefix (default None) + + >>> from mapnik import GeoJSON + >>> geojson = GeoJSON(file='test.json') + + """ + keywords['type'] = 'geojson' + return CreateDatasource(keywords) + def PostGIS(**keywords): """Create a PostGIS Datasource. @@ -346,7 +394,7 @@ dbname -- database name to connect to table -- table name or subselect query - *Note: if using subselects for the 'table' value consider also + *Note: if using subselects for the 'table' value consider also passing the 'geometry_field' and 'srid' and 'extent_from_subquery' options and/or specifying the 'geometry_table' option. @@ -405,7 +453,7 @@ tile_stride -- if an image is in tiles, what's the increment between rows/cols (default 1) >>> from mapnik import Raster, Layer - >>> raster = Raster(base='/home/mapnik/data',file='elevation.tif',lox=-122.8,loy=48.5,hix=-122.7,hiy=48.6) + >>> raster = Raster(base='/home/mapnik/data',file='elevation.tif',lox=-122.8,loy=48.5,hix=-122.7,hiy=48.6) >>> lyr = Layer('Tiff Layer') >>> lyr.datasource = raster @@ -479,7 +527,7 @@ encoding -- file encoding (default 'utf-8') >>> from mapnik import Ogr, Layer - >>> datasource = Ogr(base='/home/mapnik/data',file='rivers.geojson',layer='OGRGeoJSON') + >>> datasource = Ogr(base='/home/mapnik/data',file='rivers.geojson',layer='OGRGeoJSON') >>> lyr = Layer('OGR Layer from GeoJSON file') >>> lyr.datasource = datasource @@ -507,7 +555,7 @@ use_spatial_index -- boolean, instruct sqlite plugin to use Rtree spatial index (default True) >>> from mapnik import SQLite, Layer - >>> sqlite = SQLite(base='/home/mapnik/data',file='osm.db',table='osm',extent='-20037508,-19929239,20037508,19929239') + >>> sqlite = SQLite(base='/home/mapnik/data',file='osm.db',table='osm',extent='-20037508,-19929239,20037508,19929239') >>> lyr = Layer('SQLite Layer') >>> lyr.datasource = sqlite @@ -527,7 +575,7 @@ extent -- manually specified data extent (comma delimited string, default None) >>> from mapnik import Rasterlite, Layer - >>> rasterlite = Rasterlite(base='/home/mapnik/data',file='osm.db',table='osm',extent='-20037508,-19929239,20037508,19929239') + >>> rasterlite = Rasterlite(base='/home/mapnik/data',file='osm.db',table='osm',extent='-20037508,-19929239,20037508,19929239') >>> lyr = Layer('Rasterlite Layer') >>> lyr.datasource = rasterlite @@ -547,7 +595,7 @@ bbox -- data bounding box for fetching data (default None) >>> from mapnik import Osm, Layer - >>> datasource = Osm(file='test.osm') + >>> datasource = Osm(file='test.osm') >>> lyr = Layer('Osm Layer') >>> lyr.datasource = datasource @@ -557,44 +605,6 @@ keywords['type'] = 'osm' return CreateDatasource(keywords) -def Kismet(**keywords): - """Create a Kismet Datasource. - - Required keyword arguments: - host -- kismet hostname - port -- kismet port - - Optional keyword arguments: - encoding -- file encoding (default 'utf-8') - extent -- manually specified data extent (comma delimited string, default None) - - >>> from mapnik import Kismet, Layer - >>> datasource = Kismet(host='localhost',port=2501,extent='-179,-85,179,85') - >>> lyr = Layer('Kismet Server Layer') - >>> lyr.datasource = datasource - - """ - keywords['type'] = 'kismet' - return CreateDatasource(keywords) - -def Geos(**keywords): - """Create a GEOS Vector Datasource. - - Required keyword arguments: - wkt -- inline WKT text of the geometry - - Optional keyword arguments: - extent -- manually specified data extent (comma delimited string, default None) - - >>> from mapnik import Geos, Layer - >>> datasource = Geos(wkt='MULTIPOINT(100 100, 50 50, 0 0)') - >>> lyr = Layer('GEOS Layer from WKT string') - >>> lyr.datasource = datasource - - """ - keywords['type'] = 'geos' - return CreateDatasource(keywords) - def Python(**keywords): """Create a Python Datasource. @@ -621,7 +631,7 @@ def features(self, query): """Return an iterable which yields instances of Feature for features within the passed query. - + Required arguments: query -- a Query instance specifying the region for which features should be returned """ @@ -699,433 +709,324 @@ class _TextSymbolizer(TextSymbolizer,_injector): @property + def name(self): + if isinstance(self.properties.format_tree, FormattingText): + return self.properties.format_tree.text + else: + # There is no single expression which could be returned as name + raise RuntimeError("TextSymbolizer uses complex formatting features, but old compatibility interface is used to access it. Use self.properties.format_tree instead.") + + @name.setter + def name(self, name): + self.properties.format_tree = FormattingText(name) + + @property def text_size(self): - warnings.warn("'text_size' is deprecated, use format.text_size", - DeprecationWarning, 2) return self.format.text_size @text_size.setter def text_size(self, text_size): - warnings.warn("'text_size' is deprecated, use format.text_size", - DeprecationWarning, 2) self.format.text_size = text_size @property def face_name(self): - warnings.warn("'face_name' is deprecated, use format.face_name", - DeprecationWarning, 2) return self.format.face_name @face_name.setter def face_name(self, face_name): - warnings.warn("'face_name' is deprecated, use format.face_name", - DeprecationWarning, 2) self.format.face_name = face_name - @property def fontset(self): - warnings.warn("'fontset' is deprecated, use format.fontset", - DeprecationWarning, 2) return self.format.fontset @fontset.setter def fontset(self, fontset): - warnings.warn("'fontset' is deprecated, use format.fontset", - DeprecationWarning, 2) self.format.fontset = fontset - @property def character_spacing(self): - warnings.warn("'character_spacing' is deprecated, use format.character_spacing", - DeprecationWarning, 2) return self.format.character_spacing @character_spacing.setter def character_spacing(self, character_spacing): - warnings.warn("'character_spacing' is deprecated, use format.character_spacing", - DeprecationWarning, 2) self.format.character_spacing = character_spacing - @property def line_spacing(self): - warnings.warn("'line_spacing' is deprecated, use format.line_spacing", - DeprecationWarning, 2) return self.format.line_spacing @line_spacing.setter def line_spacing(self, line_spacing): - warnings.warn("'line_spacing' is deprecated, use format.line_spacing", - DeprecationWarning, 2) self.format.line_spacing = line_spacing - @property def text_opacity(self): - warnings.warn("'text_opacity' is deprecated, use format.text_opacity", - DeprecationWarning, 2) return self.format.text_opacity @text_opacity.setter def text_opacity(self, text_opacity): - warnings.warn("'text_opacity' is deprecated, use format.text_opacity", - DeprecationWarning, 2) self.format.text_opacity = text_opacity - @property def wrap_char(self): - warnings.warn("'wrap_char' is deprecated, use format.wrap_char", - DeprecationWarning, 2) return self.format.wrap_char @wrap_char.setter def wrap_char(self, wrap_char): - warnings.warn("'wrap_char' is deprecated, use format.wrap_char", - DeprecationWarning, 2) self.format.wrap_char = wrap_char @property def wrap_character(self): - warnings.warn("'wrap_character' is deprecated, use format.wrap_character", - DeprecationWarning, 2) return self.format.wrap_character @wrap_char.setter def wrap_character(self, wrap_character): - warnings.warn("'wrap_char' is deprecated, use format.wrap_character", - DeprecationWarning, 2) self.format.wrap_character = wrap_character @property def wrap_before(self): - warnings.warn("'wrap_before' is deprecated, use format.wrap_before", - DeprecationWarning, 2) return self.format.wrap_before @wrap_before.setter def wrap_before(self, wrap_before): - warnings.warn("'wrap_before' is deprecated, use format.wrap_before", - DeprecationWarning, 2) self.format.wrap_before = wrap_before - @property def text_transform(self): - warnings.warn("'text_transform' is deprecated, use format.text_transform", - DeprecationWarning, 2) return self.format.text_transform @text_transform.setter def text_transform(self, text_transform): - warnings.warn("'text_transform' is deprecated, use format.text_transform", - DeprecationWarning, 2) self.format.text_transform = text_transform - @property def fill(self): - warnings.warn("'fill' is deprecated, use format.fill", - DeprecationWarning, 2) return self.format.fill @fill.setter def fill(self, fill): - warnings.warn("'fill' is deprecated, use format.fill", - DeprecationWarning, 2) self.format.fill = fill - @property def halo_fill(self): - warnings.warn("'halo_fill' is deprecated, use format.halo_fill", - DeprecationWarning, 2) return self.format.halo_fill @halo_fill.setter def halo_fill(self, halo_fill): - warnings.warn("'halo_fill' is deprecated, use format.halo_fill", - DeprecationWarning, 2) self.format.halo_fill = halo_fill @property def halo_radius(self): - warnings.warn("'halo_radius' is deprecated, use format.halo_radius", - DeprecationWarning, 2) return self.format.halo_radius @halo_radius.setter def halo_radius(self, halo_radius): - warnings.warn("'halo_radius' is deprecated, use format.halo_radius", - DeprecationWarning, 2) self.format.halo_radius = halo_radius @property def label_placement(self): - warnings.warn("'label_placement' is deprecated, use properties.label_placement", - DeprecationWarning, 2) return self.properties.label_placement @label_placement.setter def label_placement(self, label_placement): - warnings.warn("'label_placement' is deprecated, use properties.label_placement", - DeprecationWarning, 2) self.properties.label_placement = label_placement @property def horizontal_alignment(self): - warnings.warn("'horizontal_alignment' is deprecated, use properties.horizontal_alignment", - DeprecationWarning, 2) return self.properties.horizontal_alignment @horizontal_alignment.setter def horizontal_alignment(self, horizontal_alignment): - warnings.warn("'horizontal_alignment' is deprecated, use properties.horizontal_alignment", - DeprecationWarning, 2) self.properties.horizontal_alignment = horizontal_alignment @property def justify_alignment(self): - warnings.warn("'justify_alignment' is deprecated, use properties.justify_alignment", - DeprecationWarning, 2) return self.properties.justify_alignment @justify_alignment.setter def justify_alignment(self, justify_alignment): - warnings.warn("'justify_alignment' is deprecated, use properties.justify_alignment", - DeprecationWarning, 2) self.properties.justify_alignment = justify_alignment @property def vertical_alignment(self): - warnings.warn("'vertical_alignment' is deprecated, use properties.vertical_alignment", - DeprecationWarning, 2) return self.properties.vertical_alignment @vertical_alignment.setter def vertical_alignment(self, vertical_alignment): - warnings.warn("'vertical_alignment' is deprecated, use properties.vertical_alignment", - DeprecationWarning, 2) self.properties.vertical_alignment = vertical_alignment @property def orientation(self): - warnings.warn("'orientation' is deprecated, use properties.orientation", - DeprecationWarning, 2) return self.properties.orientation @orientation.setter def orientation(self, orientation): - warnings.warn("'orientation' is deprecated, use properties.orientation", - DeprecationWarning, 2) self.properties.orientation = orientation @property def displacement(self): - warnings.warn("'displacement' is deprecated, use properties.displacement", - DeprecationWarning, 2) return self.properties.displacement @displacement.setter def displacement(self, displacement): - warnings.warn("'displacement' is deprecated, use properties.displacement", - DeprecationWarning, 2) self.properties.displacement = displacement @property def label_spacing(self): - warnings.warn("'label_spacing' is deprecated, use properties.label_spacing", - DeprecationWarning, 2) return self.properties.label_spacing @label_spacing.setter def label_spacing(self, label_spacing): - warnings.warn("'label_spacing' is deprecated, use properties.label_spacing", - DeprecationWarning, 2) self.properties.label_spacing = label_spacing @property def label_position_tolerance(self): - warnings.warn("'label_position_tolerance' is deprecated, use properties.label_position_tolerance", - DeprecationWarning, 2) return self.properties.label_position_tolerance @label_position_tolerance.setter def label_position_tolerance(self, label_position_tolerance): - warnings.warn("'label_position_tolerance' is deprecated, use properties.label_position_tolerance", - DeprecationWarning, 2) self.properties.label_position_tolerance = label_position_tolerance @property def avoid_edges(self): - warnings.warn("'avoid_edges' is deprecated, use properties.avoid_edges", - DeprecationWarning, 2) return self.properties.avoid_edges @avoid_edges.setter def avoid_edges(self, avoid_edges): - warnings.warn("'avoid_edges' is deprecated, use properties.avoid_edges", - DeprecationWarning, 2) self.properties.avoid_edges = avoid_edges @property def minimum_distance(self): - warnings.warn("'minimum_distance' is deprecated, use properties.minimum_distance", - DeprecationWarning, 2) return self.properties.minimum_distance @minimum_distance.setter def minimum_distance(self, minimum_distance): - warnings.warn("'minimum_distance' is deprecated, use properties.minimum_distance", - DeprecationWarning, 2) self.properties.minimum_distance = minimum_distance @property def minimum_padding(self): - warnings.warn("'minimum_padding' is deprecated, use properties.minimum_padding", - DeprecationWarning, 2) return self.properties.minimum_padding @minimum_padding.setter def minimum_padding(self, minimum_padding): - warnings.warn("'minimum_padding' is deprecated, use properties.minimum_padding", - DeprecationWarning, 2) self.properties.minimum_padding = minimum_padding @property def minimum_path_length(self): - warnings.warn("'minimum_path_length' is deprecated, use properties.minimum_path_length", - DeprecationWarning, 2) return self.properties.minimum_path_length @minimum_path_length.setter def minimum_path_length(self, minimum_path_length): - warnings.warn("'minimum_path_length' is deprecated, use properties.minimum_path_length", - DeprecationWarning, 2) self.properties.minimum_path_length = minimum_path_length @property def maximum_angle_char_delta(self): - warnings.warn("'maximum_angle_char_delta' is deprecated, use properties.maximum_angle_char_delta", - DeprecationWarning, 2) return self.properties.maximum_angle_char_delta @maximum_angle_char_delta.setter def maximum_angle_char_delta(self, maximum_angle_char_delta): - warnings.warn("'maximum_angle_char_delta' is deprecated, use properties.maximum_angle_char_delta", - DeprecationWarning, 2) self.properties.maximum_angle_char_delta = maximum_angle_char_delta @property def force_odd_labels(self): - warnings.warn("'force_odd_labels' is deprecated, use properties.force_odd_labels", - DeprecationWarning, 2) return self.properties.force_odd_labels @force_odd_labels.setter def force_odd_labels(self, force_odd_labels): - warnings.warn("'force_odd_labels' is deprecated, use properties.force_odd_labels", - DeprecationWarning, 2) self.properties.force_odd_labels = force_odd_labels @property def allow_overlap(self): - warnings.warn("'allow_overlap' is deprecated, use properties.allow_overlap", - DeprecationWarning, 2) return self.properties.allow_overlap @allow_overlap.setter def allow_overlap(self, allow_overlap): - warnings.warn("'allow_overlap' is deprecated, use properties.allow_overlap", - DeprecationWarning, 2) self.properties.allow_overlap = allow_overlap @property def text_ratio(self): - warnings.warn("'text_ratio' is deprecated, use properties.text_ratio", - DeprecationWarning, 2) return self.properties.text_ratio @text_ratio.setter def text_ratio(self, text_ratio): - warnings.warn("'text_ratio' is deprecated, use properties.text_ratio", - DeprecationWarning, 2) self.properties.text_ratio = text_ratio @property def wrap_width(self): - warnings.warn("'wrap_width' is deprecated, use properties.wrap_width", - DeprecationWarning, 2) return self.properties.wrap_width @wrap_width.setter def wrap_width(self, wrap_width): - warnings.warn("'wrap_width' is deprecated, use properties.wrap_width", - DeprecationWarning, 2) self.properties.wrap_width = wrap_width - - - def mapnik_version_from_string(version_string): """Return the Mapnik version from a string.""" n = version_string.split('.') return (int(n[0]) * 100000) + (int(n[1]) * 100) + (int(n[2])); -def register_plugins(path=inputpluginspath): +def register_plugins(path=None): """Register plugins located by specified path""" - DatasourceCache.instance().register_datasources(path) + if not path: + if os.environ.has_key('MAPNIK_INPUT_PLUGINS_DIRECTORY'): + path = os.environ.get('MAPNIK_INPUT_PLUGINS_DIRECTORY') + else: + path = inputpluginspath + DatasourceCache.register_datasources(path) -def register_fonts(path=fontscollectionpath,valid_extensions=['.ttf','.otf','.ttc','.pfa','.pfb','.ttc','.dfont']): +def register_fonts(path=None,valid_extensions=['.ttf','.otf','.ttc','.pfa','.pfb','.ttc','.dfont']): """Recursively register fonts using path argument as base directory""" + if not path: + if os.environ.has_key('MAPNIK_FONT_DIRECTORY'): + path = os.environ.get('MAPNIK_FONT_DIRECTORY') + else: + path = fontscollectionpath for dirpath, _, filenames in os.walk(path): for filename in filenames: if os.path.splitext(filename.lower())[1] in valid_extensions: diff -Nru mapnik-2.1.0/bindings/python/mapnik_building_symbolizer.cpp mapnik-2.2.0/bindings/python/mapnik_building_symbolizer.cpp --- mapnik-2.1.0/bindings/python/mapnik_building_symbolizer.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_building_symbolizer.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -21,6 +21,8 @@ *****************************************************************************/ #include +#include +#include #include using namespace mapnik; diff -Nru mapnik-2.1.0/bindings/python/mapnik_datasource.cpp mapnik-2.2.0/bindings/python/mapnik_datasource.cpp --- mapnik-2.1.0/bindings/python/mapnik_datasource.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_datasource.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -23,6 +23,7 @@ // boost #include #include +#include // stl #include @@ -47,26 +48,29 @@ { //user-friendly wrapper that uses Python dictionary using namespace boost::python; -boost::shared_ptr create_datasource(const dict& d) +boost::shared_ptr create_datasource(dict const& d) { - bool bind=true; mapnik::parameters params; boost::python::list keys=d.keys(); - for (int i=0; i(keys[i]); object obj = d[key]; - - if (key == "bind") + if (PyUnicode_Check(obj.ptr())) { - bind = extract(obj)(); + PyObject* temp = PyUnicode_AsUTF8String(obj.ptr()); + if (temp) + { + char* c_str = PyString_AsString(temp); + params[key] = std::string(c_str); + Py_DecRef(temp); + } continue; } extract ex0(obj); - extract ex1(obj); + extract ex1(obj); extract ex2(obj); - if (ex0.check()) { params[key] = ex0(); @@ -81,7 +85,7 @@ } } - return mapnik::datasource_cache::create(params, bind); + return mapnik::datasource_cache::instance().create(params); } boost::python::dict describe(boost::shared_ptr const& ds) @@ -146,6 +150,9 @@ return fld_types; }} +mapnik::parameters const& (mapnik::datasource::*params_const)() const = &mapnik::datasource::params; + + void export_datasource() { using namespace boost::python; @@ -169,11 +176,10 @@ .def("describe",&describe) .def("envelope",&datasource::envelope) .def("features",&datasource::features) - .def("bind",&datasource::bind) .def("fields",&fields) .def("field_types",&field_types) - .def("features_at_point",&datasource::features_at_point) - .def("params",&datasource::params,return_value_policy(), + .def("features_at_point",&datasource::features_at_point, (arg("coord"),arg("tolerance")=0)) + .def("params",make_function(params_const,return_value_policy()), "The configuration parameters of the data source. " "These vary depending on the type of data source.") ; diff -Nru mapnik-2.1.0/bindings/python/mapnik_datasource_cache.cpp mapnik-2.2.0/bindings/python/mapnik_datasource_cache.cpp --- mapnik-2.1.0/bindings/python/mapnik_datasource_cache.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_datasource_cache.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -21,27 +21,72 @@ *****************************************************************************/ #include +#include + #include +namespace { + +using namespace boost::python; + +boost::shared_ptr create_datasource(const dict& d) +{ + mapnik::parameters params; + boost::python::list keys=d.keys(); + for (int i=0; i(keys[i]); + object obj = d[key]; + extract ex0(obj); + extract ex1(obj); + extract ex2(obj); + + if (ex0.check()) + { + params[key] = ex0(); + } + else if (ex1.check()) + { + params[key] = ex1(); + } + else if (ex2.check()) + { + params[key] = ex2(); + } + } + + return mapnik::datasource_cache::instance().create(params); +} + +void register_datasources(std::string const& path) +{ + mapnik::datasource_cache::instance().register_datasources(path); +} + +std::vector plugin_names() +{ + return mapnik::datasource_cache::instance().plugin_names(); +} + +std::string plugin_directories() +{ + return mapnik::datasource_cache::instance().plugin_directories(); +} + +} + void export_datasource_cache() { using mapnik::datasource_cache; - using mapnik::singleton; - using mapnik::CreateStatic; - using namespace boost::python; - class_,boost::noncopyable>("Singleton",no_init) - .def("instance",&singleton::instance, - return_value_policy()) - .staticmethod("instance") - ; - - class_ >, - boost::noncopyable>("DatasourceCache",no_init) - .def("create",&datasource_cache::create) + class_("DatasourceCache",no_init) + .def("create",&create_datasource) .staticmethod("create") - .def("register_datasources",&datasource_cache::register_datasources) + .def("register_datasources",®ister_datasources) .staticmethod("register_datasources") - .def("plugin_names",&datasource_cache::plugin_names) + .def("plugin_names",&plugin_names) .staticmethod("plugin_names") + .def("plugin_directories",&plugin_directories) + .staticmethod("plugin_directories") ; } diff -Nru mapnik-2.1.0/bindings/python/mapnik_debug_symbolizer.cpp mapnik-2.2.0/bindings/python/mapnik_debug_symbolizer.cpp --- mapnik-2.1.0/bindings/python/mapnik_debug_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_debug_symbolizer.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,42 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#include +#include "mapnik_enumeration.hpp" +#include + +void export_debug_symbolizer() +{ + using namespace boost::python; + + mapnik::enumeration_("debug_symbolizer_mode") + .value("COLLISION",mapnik::DEBUG_SYM_MODE_COLLISION) + .value("VERTEX",mapnik::DEBUG_SYM_MODE_VERTEX) + ; + + class_("DebugSymbolizer", + init<>("Default debug Symbolizer")) + .add_property("mode", + &mapnik::debug_symbolizer::get_mode, + &mapnik::debug_symbolizer::set_mode) + ; +} diff -Nru mapnik-2.1.0/bindings/python/mapnik_envelope.cpp mapnik-2.2.0/bindings/python/mapnik_envelope.cpp --- mapnik-2.1.0/bindings/python/mapnik_envelope.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_envelope.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -86,6 +86,9 @@ // clip void (box2d::*clip)(box2d const&) = &box2d::clip; +// pad +void (box2d::*pad)(double) = &box2d::pad; + // deepcopy box2d box2d_deepcopy(box2d & obj, boost::python::dict memo) { @@ -160,13 +163,20 @@ "\n " "Example:\n" ">>> e = Box2d(0, 0, 100, 100)\n" - ">>> e.center(Coord60, 60)\n" - ">>> e.center()\n" - "Coord(60.0,60.0)\n" - ">>> (e.width(), e.height())\n" - "(100.0, 100.0)\n" + ">>> c = Box2d(-50, -50, 50, 50)\n" + ">>> e.clip(c)\n" ">>> e\n" - "Box2d(10.0, 10.0, 110.0, 110.0)\n" + "Box2d(0.0,0.0,50.0,50.0\n" + ) + .def("pad", pad, + (arg("padding")), + "Pad the envelope based on a padding value.\n" + "\n " + "Example:\n" + ">>> e = Box2d(0, 0, 100, 100)\n" + ">>> e.pad(10)\n" + ">>> e\n" + "Box2d(-10.0,-10.0,110.0,110.0\n" ) .def("width", width_p1, (arg("new_width")), diff -Nru mapnik-2.1.0/bindings/python/mapnik_expression.cpp mapnik-2.2.0/bindings/python/mapnik_expression.cpp --- mapnik-2.1.0/bindings/python/mapnik_expression.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_expression.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -23,6 +23,8 @@ // boost #include #include +#include + // mapnik #include @@ -32,8 +34,6 @@ #include #include - -using mapnik::Feature; using mapnik::expression_ptr; using mapnik::parse_expression; using mapnik::to_expression_string; @@ -51,10 +51,15 @@ return mapnik::to_expression_string(expr); } -mapnik::value expression_evaluate_(mapnik::expr_node const& expr, mapnik::Feature const& f) +mapnik::value expression_evaluate_(mapnik::expr_node const& expr, mapnik::feature_impl const& f) { // will be auto-converted to proper python type by `mapnik_value_to_python` - return boost::apply_visitor(mapnik::evaluate(f),expr); + return boost::apply_visitor(mapnik::evaluate(f),expr); +} + +bool expression_evaluate_to_bool_(mapnik::expr_node const& expr, mapnik::feature_impl const& f) +{ + return boost::apply_visitor(mapnik::evaluate(f),expr).to_bool(); } // path expression @@ -68,7 +73,7 @@ return mapnik::path_processor_type::to_string(expr); } -std::string path_evaluate_(mapnik::path_expression const& expr, mapnik::Feature const& f) +std::string path_evaluate_(mapnik::path_expression const& expr, mapnik::feature_impl const& f) { return mapnik::path_processor_type::evaluate(expr, f); } @@ -80,6 +85,7 @@ "TODO" "",no_init) .def("evaluate", &expression_evaluate_) + .def("to_bool", &expression_evaluate_to_bool_) .def("__str__",&expression_to_string_); ; diff -Nru mapnik-2.1.0/bindings/python/mapnik_feature.cpp mapnik-2.2.0/bindings/python/mapnik_feature.cpp --- mapnik-2.1.0/bindings/python/mapnik_feature.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_feature.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -28,6 +28,7 @@ #include #include #include +#include // mapnik #include @@ -37,30 +38,32 @@ #include #include +// stl +#include + namespace { -using mapnik::Feature; using mapnik::geometry_utils; using mapnik::from_wkt; using mapnik::context_type; using mapnik::context_ptr; using mapnik::feature_kv_iterator; -mapnik::geometry_type const& (mapnik::Feature::*get_geometry_by_const_ref)(unsigned) const = &mapnik::Feature::get_geometry; -boost::ptr_vector const& (mapnik::Feature::*get_paths_by_const_ref)() const = &mapnik::Feature::paths; +mapnik::geometry_type const& (mapnik::feature_impl::*get_geometry_by_const_ref)(unsigned) const = &mapnik::feature_impl::get_geometry; +boost::ptr_vector const& (mapnik::feature_impl::*get_paths_by_const_ref)() const = &mapnik::feature_impl::paths; -void feature_add_geometries_from_wkb(Feature &feature, std::string wkb) +void feature_add_geometries_from_wkb(mapnik::feature_impl &feature, std::string wkb) { geometry_utils::from_wkb(feature.paths(), wkb.c_str(), wkb.size()); } -void feature_add_geometries_from_wkt(Feature &feature, std::string wkt) +void feature_add_geometries_from_wkt(mapnik::feature_impl &feature, std::string wkt) { bool result = mapnik::from_wkt(wkt, feature.paths()); if (!result) throw std::runtime_error("Failed to parse WKT"); } -std::string feature_to_geojson(Feature const& feature) +std::string feature_to_geojson(mapnik::feature_impl const& feature) { std::string json; mapnik::json::feature_generator g; @@ -71,22 +74,22 @@ return json; } -mapnik::value __getitem__(Feature const& feature, std::string const& name) +mapnik::value __getitem__(mapnik::feature_impl const& feature, std::string const& name) { return feature.get(name); } -mapnik::value __getitem2__(Feature const& feature, std::size_t index) +mapnik::value __getitem2__(mapnik::feature_impl const& feature, std::size_t index) { return feature.get(index); } -void __setitem__(Feature & feature, std::string const& name, mapnik::value const& val) +void __setitem__(mapnik::feature_impl & feature, std::string const& name, mapnik::value const& val) { feature.put_new(name,val); } -boost::python::dict attributes(Feature const& f) +boost::python::dict attributes(mapnik::feature_impl const& f) { boost::python::dict attributes; feature_kv_iterator itr = f.begin(); @@ -156,42 +159,77 @@ } }; + +struct value_null_from_python +{ + value_null_from_python() + { + boost::python::converter::registry::push_back( + &convertible, + &construct, + boost::python::type_id()); + } + + static void* convertible(PyObject* obj_ptr) + { + if (obj_ptr == Py_None) return obj_ptr; + return 0; + } + + static void construct( + PyObject* obj_ptr, + boost::python::converter::rvalue_from_python_stage1_data* data) + { + if (obj_ptr != Py_None) boost::python::throw_error_already_set(); + void* storage = ( + (boost::python::converter::rvalue_from_python_storage*) + data)->storage.bytes; + new (storage) mapnik::value_null(); + data->convertible = storage; + } +}; + void export_feature() { using namespace boost::python; - using mapnik::Feature; // Python to mapnik::value converters - implicitly_convertible(); - implicitly_convertible(); - implicitly_convertible(); - implicitly_convertible(); + // NOTE: order matters here. For example value_null must be listed before + // bool otherwise Py_None will be interpreted as bool (false) + implicitly_convertible(); + implicitly_convertible(); + implicitly_convertible(); + implicitly_convertible(); + implicitly_convertible(); + // http://misspent.wordpress.com/2009/09/27/how-to-write-boost-python-converters/ UnicodeString_from_python_str(); + value_null_from_python(); class_ ("Context",init<>("Default ctor.")) .def("push", &context_type::push) ; - class_, - boost::noncopyable>("Feature",init("Default ctor.")) - .def("id",&Feature::id) - .def("__str__",&Feature::to_string) + class_, + boost::noncopyable>("Feature",init("Default ctor.")) + .def("id",&mapnik::feature_impl::id) + .def("__str__",&mapnik::feature_impl::to_string) .def("add_geometries_from_wkb", &feature_add_geometries_from_wkb) .def("add_geometries_from_wkt", &feature_add_geometries_from_wkt) - .def("add_geometry", &Feature::add_geometry) - .def("num_geometries",&Feature::num_geometries) + .def("add_geometry", &mapnik::feature_impl::add_geometry) + .def("num_geometries",&mapnik::feature_impl::num_geometries) .def("get_geometry", make_function(get_geometry_by_const_ref,return_value_policy())) .def("geometries",make_function(get_paths_by_const_ref,return_value_policy())) - .def("envelope", &Feature::envelope) - .def("has_key", &Feature::has_key) + .def("envelope", &mapnik::feature_impl::envelope) + .def("has_key", &mapnik::feature_impl::has_key) .add_property("attributes",&attributes) .def("__setitem__",&__setitem__) + .def("__contains__",&__getitem__) .def("__getitem__",&__getitem__) .def("__getitem__",&__getitem2__) - .def("__len__", &Feature::size) - .def("context",&Feature::context) + .def("__len__", &mapnik::feature_impl::size) + .def("context",&mapnik::feature_impl::context) .def("to_geojson",&feature_to_geojson) ; } diff -Nru mapnik-2.1.0/bindings/python/mapnik_featureset.cpp mapnik-2.2.0/bindings/python/mapnik_featureset.cpp --- mapnik-2.1.0/bindings/python/mapnik_featureset.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_featureset.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -22,6 +22,7 @@ // boost #include +#include // mapnik #include @@ -64,10 +65,7 @@ void export_featureset() { using namespace boost::python; - using mapnik::Feature; - using mapnik::Featureset; - - class_, + class_, boost::noncopyable>("Featureset",no_init) .def("__iter__",pass_through) .def("next",next) diff -Nru mapnik-2.1.0/bindings/python/mapnik_font_engine.cpp mapnik-2.2.0/bindings/python/mapnik_font_engine.cpp --- mapnik-2.1.0/bindings/python/mapnik_font_engine.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_font_engine.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -21,6 +21,8 @@ *****************************************************************************/ #include +#include + #include void export_font_engine() diff -Nru mapnik-2.1.0/bindings/python/mapnik_fontset.cpp mapnik-2.2.0/bindings/python/mapnik_fontset.cpp --- mapnik-2.1.0/bindings/python/mapnik_fontset.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_fontset.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -33,8 +33,13 @@ void export_fontset () { using namespace boost::python; - class_("FontSet", init<>("default fontset constructor") + class_("FontSet", init("default fontset constructor") ) + .add_property("name", + make_function(&font_set::get_name,return_value_policy()), + &font_set::set_name, + "Get/Set the name of the FontSet.\n" + ) .def("add_face_name",&font_set::add_face_name, (arg("name")), "Add a face-name to the fontset.\n" diff -Nru mapnik-2.1.0/bindings/python/mapnik_gamma_method.cpp mapnik-2.2.0/bindings/python/mapnik_gamma_method.cpp --- mapnik-2.1.0/bindings/python/mapnik_gamma_method.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_gamma_method.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #include diff -Nru mapnik-2.1.0/bindings/python/mapnik_geometry.cpp mapnik-2.2.0/bindings/python/mapnik_geometry.cpp --- mapnik-2.1.0/bindings/python/mapnik_geometry.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_geometry.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -26,6 +26,8 @@ #include #include #include +#include + // mapnik #include @@ -41,6 +43,9 @@ #include #endif +// stl +#include + namespace { using mapnik::from_wkt; @@ -232,11 +237,11 @@ bool result = mapnik::util::to_svg(svg,geom); if (!result) { - throw std::runtime_error("Generate WKT failed"); + throw std::runtime_error("Generate SVG failed"); } return svg; #else - throw std::runtime_error("mapnik::to_wkt() requires at least boost 1.47 while your build was compiled against boost " + throw std::runtime_error("mapnik::to_svg() requires at least boost 1.47 while your build was compiled against boost " + boost_version()); #endif } diff -Nru mapnik-2.1.0/bindings/python/mapnik_grid.cpp mapnik-2.2.0/bindings/python/mapnik_grid.cpp --- mapnik-2.1.0/bindings/python/mapnik_grid.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_grid.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -39,13 +39,12 @@ return grid.painted(); } -int get_pixel(mapnik::grid const& grid, int x, int y) +mapnik::grid::value_type get_pixel(mapnik::grid const& grid, int x, int y) { if (x < static_cast(grid.width()) && y < static_cast(grid.height())) { - mapnik::grid::value_type const * row = grid.getRow(y); - mapnik::grid::value_type const pixel = row[x]; - return pixel; + mapnik::grid::data_type const & data = grid.data(); + return data(x,y); } PyErr_SetString(PyExc_IndexError, "invalid x,y for grid dimensions"); boost::python::throw_error_already_set(); @@ -66,6 +65,7 @@ .def("height",&mapnik::grid::height) .def("view",&mapnik::grid::get_view) .def("get_pixel",&get_pixel) + .def("clear",&mapnik::grid::clear) .def("encode",encode, ( boost::python::arg("encoding")="utf", boost::python::arg("features")=true,boost::python::arg("resolution")=4 ), "Encode the grid as as optimized json\n" diff -Nru mapnik-2.1.0/bindings/python/mapnik_image.cpp mapnik-2.2.0/bindings/python/mapnik_image.cpp --- mapnik-2.1.0/bindings/python/mapnik_image.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_image.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -20,11 +20,6 @@ * *****************************************************************************/ -extern "C" -{ -#include -} - // boost #include #include @@ -35,18 +30,12 @@ #include #include #include -#include #include #include -// jpeg -#if defined(HAVE_JPEG) -#include -#endif - // cairo #if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO) -#include +#include #include #endif @@ -118,6 +107,28 @@ return im.painted(); } +bool is_solid(mapnik::image_32 const& im) +{ + if (im.width() > 0 && im.height() > 0) + { + mapnik::image_data_32 const & data = im.data(); + mapnik::image_data_32::pixel_type const* first_row = data.getRow(0); + mapnik::image_data_32::pixel_type const first_pixel = first_row[0]; + for (unsigned y = 0; y < im.height(); ++y) + { + mapnik::image_data_32::pixel_type const * row = data.getRow(y); + for (unsigned x = 0; x < im.width(); ++x) + { + if (first_pixel != row[x]) + { + return false; + } + } + } + } + return true; +} + unsigned get_pixel(mapnik::image_32 const& im, int x, int y) { if (x < static_cast(im.width()) && y < static_cast(im.height())) @@ -153,22 +164,51 @@ throw mapnik::image_reader_exception("Unsupported image format:" + filename); } +boost::shared_ptr fromstring(std::string const& str) +{ + std::auto_ptr reader(get_image_reader(str.c_str(),str.size())); + if (reader.get()) + { + boost::shared_ptr image_ptr = boost::make_shared(reader->width(),reader->height()); + reader->read(0,0,image_ptr->data()); + return image_ptr; + } + throw mapnik::image_reader_exception("Failed to load image from buffer" ); +} + +boost::shared_ptr frombuffer(PyObject * obj) +{ + void const* buffer=0; + Py_ssize_t buffer_len; + if (PyObject_AsReadBuffer(obj, &buffer, &buffer_len) == 0) + { + std::auto_ptr reader(get_image_reader(reinterpret_cast(buffer),buffer_len)); + if (reader.get()) + { + boost::shared_ptr image_ptr = boost::make_shared(reader->width(),reader->height()); + reader->read(0,0,image_ptr->data()); + return image_ptr; + } + } + throw mapnik::image_reader_exception("Failed to load image from buffer" ); +} + + void blend (image_32 & im, unsigned x, unsigned y, image_32 const& im2, float opacity) { im.set_rectangle_alpha2(im2.data(),x,y,opacity); } - void composite(image_32 & dst, image_32 & src, mapnik::composite_mode_e mode, float opacity) { mapnik::composite(dst.data(),src.data(),mode,opacity,0,0,false); } #if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO) -boost::shared_ptr from_cairo(PycairoSurface* surface) +boost::shared_ptr from_cairo(PycairoSurface* py_surface) { - Cairo::RefPtr s(new Cairo::ImageSurface(surface->surface)); - boost::shared_ptr image_ptr = boost::make_shared(s); + mapnik::cairo_surface_ptr surface(py_surface->surface, mapnik::cairo_surface_closer()); + boost::shared_ptr image_ptr = boost::make_shared(surface); return image_ptr; } #endif @@ -176,6 +216,7 @@ void export_image() { using namespace boost::python; + // NOTE: must match list in include/mapnik/image_compositing.hpp enum_("CompositeOp") .value("clear", mapnik::clear) .value("src", mapnik::src) @@ -204,7 +245,12 @@ .value("exclusion", mapnik::exclusion) .value("contrast", mapnik::contrast) .value("invert", mapnik::invert) - .value("invert_rgb", mapnik::invert_rgb) + .value("grain_merge", mapnik::grain_merge) + .value("grain_extract", mapnik::grain_extract) + .value("hue", mapnik::hue) + .value("saturation", mapnik::saturation) + .value("color", mapnik::_color) + .value("value", mapnik::_value) ; class_ >("Image","This class represents a 32 bit RGBA image.",init()) @@ -212,6 +258,7 @@ .def("height",&image_32::height) .def("view",&image_32::get_view) .def("painted",&painted) + .def("is_solid",&is_solid) .add_property("background",make_function (&image_32::get_background,return_value_policy()), &image_32::set_background, "The background color of the image.") @@ -222,13 +269,14 @@ .def("composite",&composite, ( arg("self"), arg("image"), - arg("mode"), + arg("mode")=mapnik::src_over, arg("opacity")=1.0f )) .def("premultiply",&image_32::premultiply) .def("demultiply",&image_32::demultiply) .def("set_pixel",&set_pixel) .def("get_pixel",&get_pixel) + .def("clear",&image_32::clear) //TODO(haoyu) The method name 'tostring' might be confusing since they actually return bytes in Python 3 .def("tostring",&tostring1) @@ -239,6 +287,10 @@ .def("save", &save_to_file3) .def("open",open_from_file) .staticmethod("open") + .def("frombuffer",&frombuffer) + .staticmethod("frombuffer") + .def("fromstring",&fromstring) + .staticmethod("fromstring") #if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO) .def("from_cairo",&from_cairo) .staticmethod("from_cairo") diff -Nru mapnik-2.1.0/bindings/python/mapnik_image_view.cpp mapnik-2.2.0/bindings/python/mapnik_image_view.cpp --- mapnik-2.1.0/bindings/python/mapnik_image_view.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_image_view.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -20,23 +20,15 @@ * *****************************************************************************/ -extern "C" -{ -#include -} #include +#include +#include #include #include #include -#include #include -// jpeg -#if defined(HAVE_JPEG) -#include -#endif - using mapnik::image_data_32; using mapnik::image_view; using mapnik::save_to_file; @@ -84,6 +76,27 @@ (s.data(),s.size()); } +bool is_solid(image_view const& view) +{ + if (view.width() > 0 && view.height() > 0) + { + mapnik::image_view::pixel_type const* first_row = view.getRow(0); + mapnik::image_view::pixel_type const first_pixel = first_row[0]; + for (unsigned y = 0; y < view.height(); ++y) + { + mapnik::image_view::pixel_type const * row = view.getRow(y); + for (unsigned x = 0; x < view.width(); ++x) + { + if (first_pixel != row[x]) + { + return false; + } + } + } + } + return true; +} + void save_view1(image_view const& view, std::string const& filename) { @@ -112,6 +125,7 @@ class_ >("ImageView","A view into an image.",no_init) .def("width",&image_view::width) .def("height",&image_view::height) + .def("is_solid",&is_solid) .def("tostring",&view_tostring1) .def("tostring",&view_tostring2) .def("tostring",&view_tostring3) diff -Nru mapnik-2.1.0/bindings/python/mapnik_label_collision_detector.cpp mapnik-2.2.0/bindings/python/mapnik_label_collision_detector.cpp --- mapnik-2.1.0/bindings/python/mapnik_label_collision_detector.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_label_collision_detector.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -24,6 +24,8 @@ #include #include #include +#include + #include #include diff -Nru mapnik-2.1.0/bindings/python/mapnik_layer.cpp mapnik-2.2.0/bindings/python/mapnik_layer.cpp --- mapnik-2.1.0/bindings/python/mapnik_layer.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_layer.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -77,7 +77,7 @@ l.set_queryable(extract(state[3])); mapnik::parameters params = extract(state[4]); - l.set_datasource(datasource_cache::instance()->create(params)); + l.set_datasource(datasource_cache::instance().create(params)); boost::python::list s = extract(state[5]); for (int i=0;i const& buffer_size) +{ + if (buffer_size) + { + l.set_buffer_size(*buffer_size); + } + else + { + l.reset_buffer_size(); + } +} + +PyObject * get_buffer_size(mapnik::layer & l) +{ + boost::optional buffer_size = l.buffer_size(); + if (buffer_size) + { +#if PY_VERSION_HEX >= 0x03000000 + return PyLong_FromLong(*buffer_size); +#else + return PyInt_FromLong(*buffer_size); +#endif + } + else + { + Py_RETURN_NONE; + } +} + void export_layer() { using namespace boost::python; @@ -224,17 +253,18 @@ ) .add_property("buffer_size", - &layer::buffer_size, - &layer::set_buffer_size, + &get_buffer_size, + &set_buffer_size, "Get/Set the size of buffer around layer in pixels.\n" "\n" "Usage:\n" - ">>> l.buffer_size\n" - "0 # zero by default\n" + ">>> print(l.buffer_size)\n" + "None # None by default\n" ">>> l.buffer_size = 2\n" ">>> l.buffer_size\n" "2\n" ) + .add_property("maximum_extent",make_function (&layer::maximum_extent,return_value_policy()), &set_maximum_extent, @@ -316,7 +346,7 @@ "'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' # The default srs if not initialized with custom srs\n" ">>> # set to google mercator with Proj.4 literal\n" "... \n" - ">>> lyr.srs = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over'\n" + ">>> lyr.srs = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over'\n" ) .add_property("group_by", diff -Nru mapnik-2.1.0/bindings/python/mapnik_line_pattern_symbolizer.cpp mapnik-2.2.0/bindings/python/mapnik_line_pattern_symbolizer.cpp --- mapnik-2.1.0/bindings/python/mapnik_line_pattern_symbolizer.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_line_pattern_symbolizer.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -37,7 +37,7 @@ namespace { using namespace boost::python; -const std::string get_filename(line_pattern_symbolizer const& t) +std::string get_filename(line_pattern_symbolizer const& t) { return path_processor_type::to_string(*t.get_filename()); } diff -Nru mapnik-2.1.0/bindings/python/mapnik_line_symbolizer.cpp mapnik-2.2.0/bindings/python/mapnik_line_symbolizer.cpp --- mapnik-2.1.0/bindings/python/mapnik_line_symbolizer.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_line_symbolizer.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -23,12 +23,19 @@ #include #include "mapnik_enumeration.hpp" #include +#include using namespace mapnik; using mapnik::line_symbolizer; using mapnik::stroke; using mapnik::color; +std::size_t line_symbolizer_hash(line_symbolizer const& sym) +{ + return symbolizer_hash::value(sym); +} + + void export_line_symbolizer() { using namespace boost::python; @@ -48,6 +55,10 @@ (&line_symbolizer::get_stroke, return_value_policy()), &line_symbolizer::set_stroke) + .add_property("simplify_tolerance", + &line_symbolizer::simplify_tolerance, + &line_symbolizer::set_simplify_tolerance, + "simplification tolerance measure") .add_property("offset", &line_symbolizer::offset, &line_symbolizer::set_offset, @@ -64,5 +75,6 @@ &line_symbolizer::smooth, &line_symbolizer::set_smooth, "smooth value (0..1.0)") + .def("__hash__", line_symbolizer_hash) ; } diff -Nru mapnik-2.1.0/bindings/python/mapnik_logger.cpp mapnik-2.2.0/bindings/python/mapnik_logger.cpp --- mapnik-2.1.0/bindings/python/mapnik_logger.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_logger.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -21,6 +21,8 @@ *****************************************************************************/ #include +#include + #include #include #include "mapnik_enumeration.hpp" diff -Nru mapnik-2.1.0/bindings/python/mapnik_map.cpp mapnik-2.2.0/bindings/python/mapnik_map.cpp --- mapnik-2.1.0/bindings/python/mapnik_map.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_map.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -24,8 +24,11 @@ #include #include #include +#include +#include // mapnik +#include #include #include #include @@ -111,6 +114,25 @@ } } +struct extract_style +{ + typedef boost::python::tuple result_type; + result_type operator() (std::map::value_type const& val) const + { + return boost::python::make_tuple(val.first,val.second); + } +}; + +typedef boost::transform_iterator style_extract_iterator; +typedef std::pair style_range; + +style_range _styles_ (mapnik::Map const& m) +{ + return style_range( + boost::make_transform_iterator(m.begin_styles(), extract_style()), + boost::make_transform_iterator(m.end_styles(), extract_style())); +} + void export_map() { using namespace boost::python; @@ -131,6 +153,11 @@ .def(vector_indexing_suite >()) ; + class_("StyleRange") + .def("__iter__", + boost::python::range(&style_range::first, &style_range::second)) + ; + class_("Map","The map object.",init >( ( arg("width"),arg("height"),arg("srs") ), "Create a Map with a width and height as integers and, optionally,\n" @@ -214,6 +241,8 @@ "\n" ) + .add_property("styles", _styles_) + .def("pan",&Map::pan, (arg("x"),arg("y")), "Set the Map center at a given x,y location\n" @@ -469,7 +498,7 @@ "'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' # The default srs if not initialized with custom srs\n" ">>> # set to google mercator with Proj.4 literal\n" "... \n" - ">>> m.srs = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over'\n" + ">>> m.srs = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over'\n" ) .add_property("width", diff -Nru mapnik-2.1.0/bindings/python/mapnik_markers_symbolizer.cpp mapnik-2.2.0/bindings/python/mapnik_markers_symbolizer.cpp --- mapnik-2.1.0/bindings/python/mapnik_markers_symbolizer.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_markers_symbolizer.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -23,12 +23,15 @@ #include #include +#include #include #include #include #include #include "mapnik_svg.hpp" #include "mapnik_enumeration.hpp" +#include "python_optional.hpp" + #include // for known_svg_prefix_ using mapnik::markers_symbolizer; @@ -54,11 +57,11 @@ std::string filename; if (marker_type == "ellipse") { - filename = mapnik::marker_cache::known_svg_prefix_ + "ellipse"; + filename = mapnik::marker_cache::instance().known_svg_prefix_ + "ellipse"; } else if (marker_type == "arrow") { - filename = mapnik::marker_cache::known_svg_prefix_ + "arrow"; + filename = mapnik::marker_cache::instance().known_svg_prefix_ + "arrow"; } else { @@ -69,16 +72,6 @@ } - -// https://github.com/mapnik/mapnik/issues/1367 -PyObject* get_fill_opacity_impl(markers_symbolizer & sym) -{ - boost::optional fill_opacity = sym.get_fill_opacity(); - if (fill_opacity) - return ::PyFloat_FromDouble(*fill_opacity); - Py_RETURN_NONE; -} - void export_markers_symbolizer() { using namespace boost::python; @@ -89,6 +82,12 @@ .value("LINE_PLACEMENT",mapnik::MARKER_LINE_PLACEMENT) ; + mapnik::enumeration_("marker_multi_policy") + .value("EACH",mapnik::MARKER_EACH_MULTI) + .value("WHOLE",mapnik::MARKER_WHOLE_MULTI) + .value("LARGEST",mapnik::MARKER_LARGEST_MULTI) + ; + class_("MarkersSymbolizer", init<>("Default Markers Symbolizer - circle")) .def (init("")) @@ -112,7 +111,7 @@ &markers_symbolizer::set_opacity, "Set/get the overall opacity") .add_property("fill_opacity", - &get_fill_opacity_impl, + &markers_symbolizer::get_fill_opacity, &markers_symbolizer::set_fill_opacity, "Set/get the fill opacity") .add_property("ignore_placement", @@ -143,6 +142,10 @@ &markers_symbolizer::get_marker_placement, &markers_symbolizer::set_marker_placement, "Set/get the marker placement") + .add_property("multi_policy", + &markers_symbolizer::get_marker_multi_policy, + &markers_symbolizer::set_marker_multi_policy, + "Set/get the marker multi geometry rendering policy") .add_property("comp_op", &markers_symbolizer::comp_op, &markers_symbolizer::set_comp_op, diff -Nru mapnik-2.1.0/bindings/python/mapnik_palette.cpp mapnik-2.2.0/bindings/python/mapnik_palette.cpp --- mapnik-2.1.0/bindings/python/mapnik_palette.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_palette.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -23,11 +23,15 @@ // boost #include #include +#include //mapnik #include -static boost::shared_ptr make_palette( const std::string& palette, const std::string& format ) +// stl +#include + +static boost::shared_ptr make_palette( std::string const& palette, std::string const& format ) { mapnik::rgba_palette::palette_type type = mapnik::rgba_palette::PALETTE_RGBA; if (format == "rgb") @@ -51,5 +55,8 @@ // "Creates a new color palette from a file\n" // ) .def( "__init__", boost::python::make_constructor(make_palette)) + .def("to_string", &mapnik::rgba_palette::to_string, + "Returns the palette as a string.\n" + ) ; } diff -Nru mapnik-2.1.0/bindings/python/mapnik_parameters.cpp mapnik-2.2.0/bindings/python/mapnik_parameters.cpp --- mapnik-2.1.0/bindings/python/mapnik_parameters.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_parameters.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -29,6 +29,8 @@ #include #include #include +// stl +#include using mapnik::parameter; using mapnik::parameters; @@ -78,7 +80,7 @@ std::string key = extract(keys[i]); object obj = d[key]; extract ex0(obj); - extract ex1(obj); + extract ex1(obj); extract ex2(obj); extract ex3(obj); @@ -142,17 +144,10 @@ } parameters::const_iterator itr = p.begin(); - parameters::const_iterator end = p.end(); - - int idx = 0; - while (itr != end) + std::advance(itr, index); + if (itr != p.end()) { - if (idx == index) - { - return *itr; - } - ++idx; - ++itr; + return *itr; } PyErr_SetString(PyExc_IndexError, "Index is out of range"); throw boost::python::error_already_set(); @@ -180,35 +175,40 @@ } } -boost::shared_ptr create_parameter_from_string(std::string const& key, std::string const& value) +boost::shared_ptr create_parameter(UnicodeString const& key, mapnik::value_holder const& value) { - return boost::make_shared(key,mapnik::value_holder(value)); + std::string key_utf8; + mapnik::to_utf8(key, key_utf8); + return boost::make_shared(key_utf8,value); } -boost::shared_ptr create_parameter_from_int(std::string const& key, int value) -{ - return boost::make_shared(key,mapnik::value_holder(value)); -} +// needed for Python_Unicode to std::string (utf8) conversion -boost::shared_ptr create_parameter_from_float(std::string const& key, double value) +boost::shared_ptr create_parameter_from_string(UnicodeString const& key, UnicodeString const& ustr) { - return boost::make_shared(key,mapnik::value_holder(value)); + std::string key_utf8; + std::string ustr_utf8; + mapnik::to_utf8(key, key_utf8); + mapnik::to_utf8(ustr,ustr_utf8); + return boost::make_shared(key_utf8, ustr_utf8); } - void export_parameters() { using namespace boost::python; + implicitly_convertible(); + implicitly_convertible(); + implicitly_convertible(); + implicitly_convertible(); + class_ >("Parameter",no_init) - .def("__init__", make_constructor(create_parameter_from_string), - "Create a mapnik.Parameter from a pair of values, the first being a string\n" - "and the second being either a string, and integer, or a float") - .def("__init__", make_constructor(create_parameter_from_int), + .def("__init__", make_constructor(create_parameter), "Create a mapnik.Parameter from a pair of values, the first being a string\n" "and the second being either a string, and integer, or a float") - .def("__init__", make_constructor(create_parameter_from_float), + .def("__init__", make_constructor(create_parameter_from_string), "Create a mapnik.Parameter from a pair of values, the first being a string\n" "and the second being either a string, and integer, or a float") + .def_pickle(parameter_pickle_suite()) .def("__getitem__",get_param) ; diff -Nru mapnik-2.1.0/bindings/python/mapnik_point_symbolizer.cpp mapnik-2.2.0/bindings/python/mapnik_point_symbolizer.cpp --- mapnik-2.1.0/bindings/python/mapnik_point_symbolizer.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_point_symbolizer.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -38,7 +38,7 @@ namespace { using namespace boost::python; -const std::string get_filename(point_symbolizer const& t) +std::string get_filename(point_symbolizer const& t) { return path_processor_type::to_string(*t.get_filename()); } diff -Nru mapnik-2.1.0/bindings/python/mapnik_polygon_pattern_symbolizer.cpp mapnik-2.2.0/bindings/python/mapnik_polygon_pattern_symbolizer.cpp --- mapnik-2.1.0/bindings/python/mapnik_polygon_pattern_symbolizer.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_polygon_pattern_symbolizer.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -37,7 +37,7 @@ namespace { using namespace boost::python; -const std::string get_filename(polygon_pattern_symbolizer const& t) +std::string get_filename(polygon_pattern_symbolizer const& t) { return path_processor_type::to_string(*t.get_filename()); } diff -Nru mapnik-2.1.0/bindings/python/mapnik_polygon_symbolizer.cpp mapnik-2.2.0/bindings/python/mapnik_polygon_symbolizer.cpp --- mapnik-2.1.0/bindings/python/mapnik_polygon_symbolizer.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_polygon_symbolizer.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -22,11 +22,17 @@ #include #include +#include using namespace mapnik; using mapnik::polygon_symbolizer; using mapnik::color; +std::size_t polygon_symbolizer_hash(polygon_symbolizer const& sym) +{ + return symbolizer_hash::value(sym); +} + void export_polygon_symbolizer() { using namespace boost::python; @@ -60,6 +66,11 @@ &polygon_symbolizer::smooth, &polygon_symbolizer::set_smooth, "Set/get the polygon geometry's smooth value") + .add_property("simplify_tolerance", + &polygon_symbolizer::simplify_tolerance, + &polygon_symbolizer::set_simplify_tolerance, + "simplfication tolerance measure") + .def("__hash__", polygon_symbolizer_hash) ; } diff -Nru mapnik-2.1.0/bindings/python/mapnik_proj_transform.cpp mapnik-2.2.0/bindings/python/mapnik_proj_transform.cpp --- mapnik-2.1.0/bindings/python/mapnik_proj_transform.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_proj_transform.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -22,10 +22,15 @@ // mapnik #include +#include // boost #include +// stl +#include + + using mapnik::proj_transform; using mapnik::projection; diff -Nru mapnik-2.1.0/bindings/python/mapnik_projection.cpp mapnik-2.2.0/bindings/python/mapnik_projection.cpp --- mapnik-2.1.0/bindings/python/mapnik_projection.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_projection.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -25,6 +25,7 @@ // mapnik #include +#include #include using mapnik::projection; @@ -88,13 +89,10 @@ { using namespace boost::python; - class_("Projection", "Represents a map projection.",init >( + class_("Projection", "Represents a map projection.",init( (arg("proj4_string")), "Constructs a new projection from its PROJ.4 string representation.\n" "\n" - "The parameterless version of this constructor is equivalent to\n" - " Projection('+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n" - "\n" "The constructor will throw a RuntimeError in case the projection\n" "cannot be initialized.\n" ) diff -Nru mapnik-2.1.0/bindings/python/mapnik_python.cpp mapnik-2.2.0/bindings/python/mapnik_python.cpp --- mapnik-2.1.0/bindings/python/mapnik_python.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_python.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -25,6 +25,9 @@ #include #include +// stl +#include + void register_cairo(); void export_color(); void export_coord(); @@ -62,6 +65,7 @@ void export_raster_symbolizer(); void export_text_placement(); void export_shield_symbolizer(); +void export_debug_symbolizer(); void export_font_engine(); void export_projection(); void export_proj_transform(); @@ -79,9 +83,11 @@ #include #endif #include +#include +#include +#include #include #include -#include #include #include #include @@ -96,8 +102,8 @@ void clear_cache() { - mapnik::marker_cache::instance()->clear(); - mapnik::mapped_memory_cache::instance()->clear(); + mapnik::marker_cache::instance().clear(); + mapnik::mapped_memory_cache::instance().clear(); } #if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO) @@ -160,42 +166,92 @@ #if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO) void render3(const mapnik::Map& map, - PycairoSurface* surface, + PycairoSurface* py_surface, double scale_factor = 1.0, unsigned offset_x = 0, unsigned offset_y = 0) { python_unblock_auto_block b; - Cairo::RefPtr s(new Cairo::Surface(surface->surface)); - mapnik::cairo_renderer ren(map,s,scale_factor,offset_x,offset_y); + mapnik::cairo_surface_ptr surface(cairo_surface_reference(py_surface->surface), mapnik::cairo_surface_closer()); + mapnik::cairo_renderer ren(map,surface,scale_factor,offset_x,offset_y); ren.apply(); } -void render4(const mapnik::Map& map, PycairoSurface* surface) +void render4(const mapnik::Map& map, PycairoSurface* py_surface) { python_unblock_auto_block b; - Cairo::RefPtr s(new Cairo::Surface(surface->surface)); - mapnik::cairo_renderer ren(map,s); + mapnik::cairo_surface_ptr surface(cairo_surface_reference(py_surface->surface), mapnik::cairo_surface_closer()); + mapnik::cairo_renderer ren(map,surface); ren.apply(); } void render5(const mapnik::Map& map, - PycairoContext* context, + PycairoContext* py_context, double scale_factor = 1.0, unsigned offset_x = 0, unsigned offset_y = 0) { python_unblock_auto_block b; - Cairo::RefPtr c(new Cairo::Context(context->ctx)); - mapnik::cairo_renderer ren(map,c,scale_factor,offset_x, offset_y); + mapnik::cairo_ptr context(py_context->ctx, mapnik::cairo_closer()); + mapnik::cairo_renderer ren(map,context,scale_factor,offset_x, offset_y); + ren.apply(); +} + +void render6(const mapnik::Map& map, PycairoContext* py_context) +{ + python_unblock_auto_block b; + mapnik::cairo_ptr context(py_context->ctx, mapnik::cairo_closer()); + mapnik::cairo_renderer ren(map,context); + ren.apply(); +} + +void render_with_detector2( + const mapnik::Map& map, + PycairoContext* py_context, + boost::shared_ptr detector) +{ + python_unblock_auto_block b; + mapnik::cairo_ptr context(py_context->ctx, mapnik::cairo_closer()); + mapnik::cairo_renderer ren(map,context,detector); + ren.apply(); +} + +void render_with_detector3( + const mapnik::Map& map, + PycairoContext* py_context, + boost::shared_ptr detector, + double scale_factor = 1.0, + unsigned offset_x = 0u, + unsigned offset_y = 0u) +{ + python_unblock_auto_block b; + mapnik::cairo_ptr context(py_context->ctx, mapnik::cairo_closer()); + mapnik::cairo_renderer ren(map,context,detector,scale_factor,offset_x,offset_y); ren.apply(); } -void render6(const mapnik::Map& map, PycairoContext* context) +void render_with_detector4( + const mapnik::Map& map, + PycairoSurface* py_surface, + boost::shared_ptr detector) { python_unblock_auto_block b; - Cairo::RefPtr c(new Cairo::Context(context->ctx)); - mapnik::cairo_renderer ren(map,c); + mapnik::cairo_surface_ptr surface(cairo_surface_reference(py_surface->surface), mapnik::cairo_surface_closer()); + mapnik::cairo_renderer ren(map, surface, detector); + ren.apply(); +} + +void render_with_detector5( + const mapnik::Map& map, + PycairoSurface* py_surface, + boost::shared_ptr detector, + double scale_factor = 1.0, + unsigned offset_x = 0u, + unsigned offset_y = 0u) +{ + python_unblock_auto_block b; + mapnik::cairo_surface_ptr surface(cairo_surface_reference(py_surface->surface), mapnik::cairo_surface_closer()); + mapnik::cairo_renderer ren(map, surface, detector, scale_factor, offset_x, offset_y); ren.apply(); } @@ -205,8 +261,8 @@ void render_tile_to_file(const mapnik::Map& map, unsigned offset_x, unsigned offset_y, unsigned width, unsigned height, - const std::string& file, - const std::string& format) + std::string const& file, + std::string const& format) { mapnik::image_32 image(width,height); render(map,image,1.0,offset_x, offset_y); @@ -214,8 +270,8 @@ } void render_to_file1(const mapnik::Map& map, - const std::string& filename, - const std::string& format) + std::string const& filename, + std::string const& format) { if (format == "pdf" || format == "svg" || format =="ps" || format == "ARGB32" || format == "RGB24") { @@ -233,7 +289,7 @@ } } -void render_to_file2(const mapnik::Map& map,const std::string& filename) +void render_to_file2(const mapnik::Map& map,std::string const& filename) { std::string format = mapnik::guess_type(filename); if (format == "pdf" || format == "svg" || format =="ps") @@ -253,8 +309,8 @@ } void render_to_file3(const mapnik::Map& map, - const std::string& filename, - const std::string& format, + std::string const& filename, + std::string const& format, double scale_factor = 1.0 ) { @@ -276,21 +332,26 @@ double scale_denominator(mapnik::Map const &map, bool geographic) { - return mapnik::scale_denominator(map, geographic); + return mapnik::scale_denominator(map.scale(), geographic); } // http://docs.python.org/c-api/exceptions.html#standard-exceptions -void config_error_translator(mapnik::config_error const & ex) +void value_error_translator(mapnik::value_error const & ex) +{ + PyErr_SetString(PyExc_ValueError, ex.what()); +} + +void runtime_error_translator(std::runtime_error const & ex) { PyErr_SetString(PyExc_RuntimeError, ex.what()); } -void value_error_translator(mapnik::value_error const & ex) +void out_of_range_error_translator(std::out_of_range const & ex) { - PyErr_SetString(PyExc_ValueError, ex.what()); + PyErr_SetString(PyExc_IndexError, ex.what()); } -void runtime_error_translator(std::runtime_error const & ex) +void standard_error_translator(std::exception const & ex) { PyErr_SetString(PyExc_RuntimeError, ex.what()); } @@ -329,7 +390,11 @@ bool has_pycairo() { #if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO) +#if PY_MAJOR_VERSION >= 3 + Pycairo_CAPI = (Pycairo_CAPI_t*) PyCapsule_Import(const_cast("cairo.CAPI"), 0); +#else Pycairo_CAPI = (Pycairo_CAPI_t*) PyCObject_Import(const_cast("cairo"), const_cast("CAPI")); +#endif if (Pycairo_CAPI == NULL){ /* Case where pycairo support has been compiled into @@ -346,7 +411,7 @@ } -BOOST_PYTHON_FUNCTION_OVERLOADS(load_map_overloads, load_map, 2, 3) +BOOST_PYTHON_FUNCTION_OVERLOADS(load_map_overloads, load_map, 2, 4) BOOST_PYTHON_FUNCTION_OVERLOADS(load_map_string_overloads, load_map_string, 2, 4) BOOST_PYTHON_FUNCTION_OVERLOADS(save_map_overloads, save_map, 2, 3) BOOST_PYTHON_FUNCTION_OVERLOADS(save_map_to_string_overloads, save_map_to_string, 1, 2) @@ -364,7 +429,8 @@ using mapnik::save_map_to_string; using mapnik::render_grid; - register_exception_translator(&config_error_translator); + register_exception_translator(&standard_error_translator); + register_exception_translator(&out_of_range_error_translator); register_exception_translator(&value_error_translator); register_exception_translator(&runtime_error_translator); register_cairo(); @@ -401,6 +467,7 @@ export_raster_symbolizer(); export_text_placement(); export_shield_symbolizer(); + export_debug_symbolizer(); export_font_engine(); export_projection(); export_proj_transform(); @@ -572,9 +639,69 @@ ">>> render(m,context)\n" "\n" ); + + def("render_with_detector", &render_with_detector2, + "\n" + "Render Map to Cairo Context using a pre-constructed detector.\n" + "\n" + "Usage:\n" + ">>> from mapnik import Map, LabelCollisionDetector, render_with_detector, load_map\n" + ">>> from cairo import SVGSurface, Context\n" + ">>> surface = SVGSurface('image.svg', m.width, m.height)\n" + ">>> ctx = Context(surface)\n" + ">>> m = Map(256,256)\n" + ">>> load_map(m,'mapfile.xml')\n" + ">>> detector = LabelCollisionDetector(m)\n" + ">>> render_with_detector(m, ctx, detector)\n" + ); + + def("render_with_detector", &render_with_detector3, + "\n" + "Render Map to Cairo Context using a pre-constructed detector, scale and offsets.\n" + "\n" + "Usage:\n" + ">>> from mapnik import Map, LabelCollisionDetector, render_with_detector, load_map\n" + ">>> from cairo import SVGSurface, Context\n" + ">>> surface = SVGSurface('image.svg', m.width, m.height)\n" + ">>> ctx = Context(surface)\n" + ">>> m = Map(256,256)\n" + ">>> load_map(m,'mapfile.xml')\n" + ">>> detector = LabelCollisionDetector(m)\n" + ">>> render_with_detector(m, ctx, detector, 1, 1, 1)\n" + ); + + def("render_with_detector", &render_with_detector4, + "\n" + "Render Map to Cairo Surface using a pre-constructed detector.\n" + "\n" + "Usage:\n" + ">>> from mapnik import Map, LabelCollisionDetector, render_with_detector, load_map\n" + ">>> from cairo import SVGSurface, Context\n" + ">>> surface = SVGSurface('image.svg', m.width, m.height)\n" + ">>> m = Map(256,256)\n" + ">>> load_map(m,'mapfile.xml')\n" + ">>> detector = LabelCollisionDetector(m)\n" + ">>> render_with_detector(m, surface, detector)\n" + ); + + def("render_with_detector", &render_with_detector5, + "\n" + "Render Map to Cairo Surface using a pre-constructed detector, scale and offsets.\n" + "\n" + "Usage:\n" + ">>> from mapnik import Map, LabelCollisionDetector, render_with_detector, load_map\n" + ">>> from cairo import SVGSurface, Context\n" + ">>> surface = SVGSurface('image.svg', m.width, m.height)\n" + ">>> m = Map(256,256)\n" + ">>> load_map(m,'mapfile.xml')\n" + ">>> detector = LabelCollisionDetector(m)\n" + ">>> render_with_detector(m, surface, detector, 1, 1, 1)\n" + ); + #endif def("scale_denominator", &scale_denominator, + (arg("map"),arg("is_geographic")), "\n" "Return the Map Scale Denominator.\n" "Also available as Map.scale_denominator()\n" @@ -617,6 +744,7 @@ def("has_pycairo", &has_pycairo, "Get pycairo module status"); python_optional(); + python_optional(); python_optional(); python_optional >(); python_optional(); @@ -626,6 +754,7 @@ python_optional(); python_optional(); python_optional(); + python_optional(); python_optional(); register_ptr_to_python(); register_ptr_to_python(); diff -Nru mapnik-2.1.0/bindings/python/mapnik_query.cpp mapnik-2.2.0/bindings/python/mapnik_query.cpp --- mapnik-2.1.0/bindings/python/mapnik_query.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_query.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -22,11 +22,15 @@ // boost #include +#include // mapnik #include #include +#include +#include + using mapnik::query; using mapnik::box2d; @@ -46,11 +50,30 @@ } }; +struct names_to_list +{ + static PyObject* convert(std::set const& names) + { + boost::python::list l; + BOOST_FOREACH( std::string const& name, names ) + { + l.append(name); + } + return python::incref(l.ptr()); + } + + static PyTypeObject const* get_pytype() + { + return &PyList_Type; + } +}; + void export_query() { using namespace boost::python; to_python_converter (); + to_python_converter, names_to_list> (); class_("Query", "a spatial query data object", init,query::resolution_type const&,double>() ) diff -Nru mapnik-2.1.0/bindings/python/mapnik_raster_symbolizer.cpp mapnik-2.2.0/bindings/python/mapnik_raster_symbolizer.cpp --- mapnik-2.1.0/bindings/python/mapnik_raster_symbolizer.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_raster_symbolizer.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -25,8 +25,10 @@ // mapnik #include +#include #include + using mapnik::raster_symbolizer; void export_raster_symbolizer() @@ -118,5 +120,17 @@ ">>> r = RasterSymbolizer()\n" ">>> r.mesh_size = 32\n" ) + .add_property("premultiplied", + &raster_symbolizer::premultiplied, + &raster_symbolizer::set_premultiplied, + "Get/Set premultiplied status of the source image.\n" + "Can be used to override what the source data reports (when in error)\n" + "\n" + "Usage:\n" + "\n" + ">>> from mapnik import RasterSymbolizer\n" + ">>> r = RasterSymbolizer()\n" + ">>> r.premultiplied = False\n" + ) ; } diff -Nru mapnik-2.1.0/bindings/python/mapnik_rule.cpp mapnik-2.2.0/bindings/python/mapnik_rule.cpp --- mapnik-2.1.0/bindings/python/mapnik_rule.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_rule.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -34,7 +34,6 @@ using mapnik::rule; using mapnik::expr_node; using mapnik::expression_ptr; -using mapnik::Feature; using mapnik::point_symbolizer; using mapnik::line_symbolizer; using mapnik::line_pattern_symbolizer; @@ -85,6 +84,7 @@ .def("active",&rule::active) .add_property("symbols",make_function (&rule::get_symbolizers,return_value_policy())) + .add_property("copy_symbols",make_function + (&rule::get_symbolizers,return_value_policy())) ; } - diff -Nru mapnik-2.1.0/bindings/python/mapnik_scaling_method.cpp mapnik-2.2.0/bindings/python/mapnik_scaling_method.cpp --- mapnik-2.1.0/bindings/python/mapnik_scaling_method.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_scaling_method.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #include diff -Nru mapnik-2.1.0/bindings/python/mapnik_shield_symbolizer.cpp mapnik-2.2.0/bindings/python/mapnik_shield_symbolizer.cpp --- mapnik-2.1.0/bindings/python/mapnik_shield_symbolizer.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_shield_symbolizer.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -34,7 +34,8 @@ // mapnik #include #include -#include +#include +#include #include "mapnik_svg.hpp" using mapnik::color; @@ -75,7 +76,7 @@ t.set_displacement(extract(arg[0]),extract(arg[1])); } -const std::string get_filename(shield_symbolizer const& t) +std::string get_filename(shield_symbolizer const& t) { return path_processor_type::to_string(*t.get_filename()); } diff -Nru mapnik-2.1.0/bindings/python/mapnik_style.cpp mapnik-2.2.0/bindings/python/mapnik_style.cpp --- mapnik-2.1.0/bindings/python/mapnik_style.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_style.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -28,7 +28,6 @@ #include #include "mapnik_enumeration.hpp" #include -#include // image_filter_grammar #include // generate_image_filters using mapnik::feature_type_style; @@ -45,18 +44,14 @@ void set_image_filters(feature_type_style & style, std::string const& filters) { - std::string::const_iterator itr = filters.begin(); - std::string::const_iterator end = filters.end(); - mapnik::image_filter_grammar > filter_grammar; - bool result = boost::spirit::qi::phrase_parse(itr,end, - filter_grammar, - boost::spirit::qi::ascii::space, - style.image_filters()); - if (!result || itr!=end) + std::vector new_filters; + + bool result = parse_image_filters(filters, new_filters); + if (!result) { - throw mapnik::value_error("failed to parse image-filters: '" + std::string(itr,end) + "'"); + throw mapnik::value_error("failed to parse image-filters: '" + filters + "'"); } + style.image_filters().swap(new_filters); } void export_style() diff -Nru mapnik-2.1.0/bindings/python/mapnik_svg.hpp mapnik-2.2.0/bindings/python/mapnik_svg.hpp --- mapnik-2.1.0/bindings/python/mapnik_svg.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_svg.hpp 2013-06-04 01:35:26.000000000 +0000 @@ -31,7 +31,7 @@ using namespace boost::python; template -const std::string get_svg_transform(T& symbolizer) +std::string get_svg_transform(T& symbolizer) { return symbolizer.get_image_transform_string(); } diff -Nru mapnik-2.1.0/bindings/python/mapnik_symbolizer.cpp mapnik-2.2.0/bindings/python/mapnik_symbolizer.cpp --- mapnik-2.1.0/bindings/python/mapnik_symbolizer.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_symbolizer.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -22,10 +22,12 @@ // boost #include +#include // mapnik //symbolizer typdef here rather than mapnik/symbolizer.hpp #include +#include using mapnik::symbolizer; @@ -44,74 +46,81 @@ struct get_symbolizer_type : public boost::static_visitor { public: - get_symbolizer_type() {} - - std::string operator () ( const point_symbolizer & /*sym*/ ) + std::string operator () (point_symbolizer const& sym) const { - return "point"; + boost::ignore_unused_variable_warning(sym); + return std::string("point"); } - std::string operator () ( const line_symbolizer & /*sym*/ ) + std::string operator () ( line_symbolizer const& sym) const { - return "line"; + boost::ignore_unused_variable_warning(sym); + return std::string("line"); } - std::string operator () ( const line_pattern_symbolizer & /*sym*/ ) + std::string operator () (line_pattern_symbolizer const& sym) const { - return "line_pattern"; + boost::ignore_unused_variable_warning(sym); + return std::string("line_pattern"); } - std::string operator () ( const polygon_symbolizer & /*sym*/ ) + std::string operator () (polygon_symbolizer const& sym ) const { - return "polygon"; + boost::ignore_unused_variable_warning(sym); + return std::string("polygon"); } - std::string operator () ( const polygon_pattern_symbolizer & /*sym*/ ) + std::string operator () (polygon_pattern_symbolizer const& sym) const { - return "polygon_pattern"; + boost::ignore_unused_variable_warning(sym); + return std::string("polygon_pattern"); } - std::string operator () ( const raster_symbolizer & /*sym*/ ) + std::string operator () (raster_symbolizer const& sym) const { - return "raster"; + boost::ignore_unused_variable_warning(sym); + return std::string("raster"); } - std::string operator () ( const shield_symbolizer & /*sym*/ ) + std::string operator () (shield_symbolizer const& sym) const { - return "shield"; + boost::ignore_unused_variable_warning(sym); + return std::string("shield"); } - std::string operator () ( const text_symbolizer & /*sym*/ ) + std::string operator () (text_symbolizer const& sym) const { - return "text"; + boost::ignore_unused_variable_warning(sym); + return std::string("text"); } - std::string operator () ( const building_symbolizer & /*sym*/ ) + std::string operator () (building_symbolizer const& sym) const { - return "building"; + boost::ignore_unused_variable_warning(sym); + return std::string("building"); } - std::string operator () ( const markers_symbolizer & /*sym*/ ) + std::string operator () (markers_symbolizer const& sym) const { - return "markers"; + boost::ignore_unused_variable_warning(sym); + return std::string("markers"); } - + template - std::string operator() ( Symbolizer const& sym) + std::string operator() ( Symbolizer const& sym) const { boost::ignore_unused_variable_warning(sym); - return "unknown"; + return std::string("unknown"); } }; -std::string get_symbol_type(const symbolizer& symbol) +std::string get_symbol_type(symbolizer const& symbol) { - get_symbolizer_type serializer; - std::string type = boost::apply_visitor( serializer, symbol ); + std::string type = boost::apply_visitor( get_symbolizer_type(), symbol); return type; } -const point_symbolizer& point_( const symbolizer& symbol ) +const point_symbolizer& point_(symbolizer const& symbol ) { return boost::get(symbol); } @@ -161,6 +170,20 @@ return boost::get(symbol); } +struct symbolizer_hash_visitor : public boost::static_visitor +{ + template + std::size_t operator() (T const& sym) const + { + return mapnik::symbolizer_hash::value(sym); + } +}; + +std::size_t hash_impl(symbolizer const& sym) +{ + return boost::apply_visitor(symbolizer_hash_visitor(), sym); +} + void export_symbolizer() { using namespace boost::python; @@ -169,6 +192,8 @@ .def("type",get_symbol_type) + .def("__hash__",hash_impl) + .def("point",point_, return_value_policy()) @@ -200,4 +225,3 @@ return_value_policy()) ; } - diff -Nru mapnik-2.1.0/bindings/python/mapnik_text_placement.cpp mapnik-2.2.0/bindings/python/mapnik_text_placement.cpp --- mapnik-2.1.0/bindings/python/mapnik_text_placement.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_text_placement.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -21,6 +21,7 @@ *****************************************************************************/ #include #include +#include #include #include @@ -28,7 +29,7 @@ #include #include #include -#include +#include #include #include #include @@ -83,7 +84,7 @@ } - void apply(char_properties const& p, Feature const& feature, processed_text &output) const + void apply(char_properties const& p, feature_impl const& feature, processed_text &output) const { python_block_auto_unblock b; this->get_override("apply")(ptr(&p), ptr(&feature), ptr(&output)); @@ -121,7 +122,7 @@ } - virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const + virtual void apply(char_properties const& p, feature_impl const& feature, processed_text &output) const { if(override o = this->get_override("apply")) { @@ -134,7 +135,7 @@ } } - void default_apply(char_properties const& p, Feature const& feature, processed_text &output) const + void default_apply(char_properties const& p, feature_impl const& feature, processed_text &output) const { formatting::text_node::apply(p, feature, output); } @@ -142,7 +143,7 @@ struct FormatNodeWrap: formatting::format_node, wrapper { - virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const + virtual void apply(char_properties const& p, feature_impl const& feature, processed_text &output) const { if(override o = this->get_override("apply")) { @@ -155,7 +156,7 @@ } } - void default_apply(char_properties const& p, Feature const& feature, processed_text &output) const + void default_apply(char_properties const& p, feature_impl const& feature, processed_text &output) const { formatting::format_node::apply(p, feature, output); } @@ -163,7 +164,7 @@ struct ExprFormatWrap: formatting::expression_format, wrapper { - virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const + virtual void apply(char_properties const& p, feature_impl const& feature, processed_text &output) const { if(override o = this->get_override("apply")) { @@ -176,7 +177,7 @@ } } - void default_apply(char_properties const& p, Feature const& feature, processed_text &output) const + void default_apply(char_properties const& p, feature_impl const& feature, processed_text &output) const { formatting::expression_format::apply(p, feature, output); } @@ -200,7 +201,7 @@ http://wiki.python.org/moin/boost.python/HowTo#A.22Raw.22_function */ - virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const + virtual void apply(char_properties const& p, feature_impl const& feature, processed_text &output) const { if(override o = this->get_override("apply")) { @@ -213,7 +214,7 @@ } } - void default_apply(char_properties const& p, Feature const& feature, processed_text &output) const + void default_apply(char_properties const& p, feature_impl const& feature, processed_text &output) const { formatting::list_node::apply(p, feature, output); } @@ -339,6 +340,11 @@ .value("CAPITALIZE",CAPITALIZE) ; + enumeration_("halo_rasterizer") + .value("FULL",HALO_RASTERIZER_FULL) + .value("FAST",HALO_RASTERIZER_FAST) + ; + class_("TextSymbolizer", init<>()) .def(init()) @@ -362,6 +368,10 @@ &text_symbolizer::clip, &text_symbolizer::set_clip, "Set/get the text geometry's clipping status") + .add_property("halo_rasterizer", + &text_symbolizer::get_halo_rasterizer, + &text_symbolizer::set_halo_rasterizer, + "Set/get the halo rasterizer method") ; @@ -402,9 +412,9 @@ class_with_converter ("CharProperties") .def_readwrite_convert("text_transform", &char_properties::text_transform) + .def_readwrite_convert("fontset", &char_properties::fontset) .def(init()) //Copy constructor .def_readwrite("face_name", &char_properties::face_name) - .def_readwrite("fontset", &char_properties::fontset) .def_readwrite("text_size", &char_properties::text_size) .def_readwrite("character_spacing", &char_properties::character_spacing) .def_readwrite("line_spacing", &char_properties::line_spacing) diff -Nru mapnik-2.1.0/bindings/python/mapnik_value_converter.hpp mapnik-2.2.0/bindings/python/mapnik_value_converter.hpp --- mapnik-2.1.0/bindings/python/mapnik_value_converter.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/mapnik_value_converter.hpp 2013-06-04 01:35:26.000000000 +0000 @@ -22,6 +22,9 @@ #ifndef MAPNIK_PYTHON_BINDING_VALUE_CONVERTER_INCLUDED #define MAPNIK_PYTHON_BINDING_VALUE_CONVERTER_INCLUDED +// mapnik +#include + // boost #include #include @@ -30,7 +33,7 @@ struct value_converter : public boost::static_visitor { - PyObject * operator() (int val) const + PyObject * operator() (mapnik::value_integer val) const { #if PY_VERSION_HEX >= 0x03000000 return ::PyLong_FromLong(val); @@ -54,7 +57,7 @@ return ::PyUnicode_DecodeUTF8(s.c_str(),implicit_cast(s.length()),0); } - PyObject * operator() (UnicodeString const& s) const + PyObject * operator() (mapnik::value_unicode_string const& s) const { std::string buffer; mapnik::to_utf8(s,buffer); diff -Nru mapnik-2.1.0/bindings/python/python_cairo.cpp mapnik-2.2.0/bindings/python/python_cairo.cpp --- mapnik-2.1.0/bindings/python/python_cairo.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/python_cairo.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -31,6 +31,7 @@ static void *extract_surface(PyObject* op) { + if (PyObject_TypeCheck(op, const_cast(Pycairo_CAPI->Surface_Type))) { return op; @@ -55,7 +56,11 @@ void register_cairo() { +#if PY_MAJOR_VERSION >= 3 + Pycairo_CAPI = (Pycairo_CAPI_t*) PyCapsule_Import(const_cast("cairo.CAPI"), 0); +#else Pycairo_CAPI = (Pycairo_CAPI_t*) PyCObject_Import(const_cast("cairo"), const_cast("CAPI")); +#endif if (Pycairo_CAPI == NULL) return; boost::python::converter::registry::insert(&extract_surface, boost::python::type_id()); diff -Nru mapnik-2.1.0/bindings/python/python_grid_utils.cpp mapnik-2.2.0/bindings/python/python_grid_utils.cpp --- mapnik-2.1.0/bindings/python/python_grid_utils.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/python_grid_utils.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -39,13 +39,16 @@ #include "mapnik_value_converter.hpp" #include "python_grid_utils.hpp" +// stl +#include + namespace mapnik { template void grid2utf(T const& grid_type, boost::python::list& l, - std::vector& key_order) + std::vector& key_order) { typedef std::map< typename T::lookup_type, typename T::value_type> keys_type; typedef typename keys_type::const_iterator keys_iterator; @@ -121,8 +124,7 @@ // start counting at utf8 codepoint 32, aka space character boost::uint16_t codepoint = 32; - // TODO - use double? - unsigned array_size = static_cast(grid_type.width()/resolution); + unsigned array_size = std::ceil(grid_type.width()/static_cast(resolution)); for (unsigned y = 0; y < grid_type.height(); y=y+resolution) { boost::uint16_t idx = 0; diff -Nru mapnik-2.1.0/bindings/python/python_optional.hpp mapnik-2.2.0/bindings/python/python_optional.hpp --- mapnik-2.1.0/bindings/python/python_optional.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/bindings/python/python_optional.hpp 2013-06-04 01:35:26.000000000 +0000 @@ -23,6 +23,8 @@ #include #include +#include + // boost::optional to/from converter from John Wiegley template @@ -45,7 +47,7 @@ }; template -struct python_optional : public boost::noncopyable +struct python_optional : public mapnik::noncopyable { struct optional_to_python { @@ -73,7 +75,7 @@ rvalue_from_python_stage1(source, converters); return rvalue_from_python_stage2(source, data, converters); } - return NULL; + return 0; } static void construct(PyObject * source, @@ -93,17 +95,116 @@ } }; - explicit python_optional() { + explicit python_optional() + { register_python_conversion, optional_to_python, optional_from_python>(); } }; -/** This class works around a bug in boost python. +// to/from boost::optional +template <> +struct python_optional : public mapnik::noncopyable +{ + struct optional_to_python + { + static PyObject * convert(const boost::optional& value) + { + return (value ? PyFloat_FromDouble(*value) : + boost::python::detail::none()); + } + }; + + struct optional_from_python + { + static void * convertible(PyObject * source) + { + using namespace boost::python::converter; + + if (source == Py_None || PyFloat_Check(source)) + return source; + return 0; + } + + static void construct(PyObject * source, + boost::python::converter::rvalue_from_python_stage1_data * data) + { + using namespace boost::python::converter; + void * const storage = ((rvalue_from_python_storage > *) + data)->storage.bytes; + if (source == Py_None) // == None + new (storage) boost::optional(); // A Boost uninitialized value + else + new (storage) boost::optional(PyFloat_AsDouble(source)); + data->convertible = storage; + } + }; + + explicit python_optional() + { + register_python_conversion, + optional_to_python, optional_from_python>(); + } +}; + +// to/from boost::optional +template <> +struct python_optional : public mapnik::noncopyable +{ + struct optional_to_python + { + static PyObject * convert(const boost::optional& value) + { + if (value) + { + if (*value) Py_RETURN_TRUE; + else Py_RETURN_FALSE; + } + else return boost::python::detail::none(); + } + }; + struct optional_from_python + { + static void * convertible(PyObject * source) + { + using namespace boost::python::converter; + + if (source == Py_None || PyBool_Check(source)) + return source; + return 0; + } + + static void construct(PyObject * source, + boost::python::converter::rvalue_from_python_stage1_data * data) + { + using namespace boost::python::converter; + void * const storage = ((rvalue_from_python_storage > *) + data)->storage.bytes; + if (source == Py_None) // == None + new (storage) boost::optional(); // A Boost uninitialized value + else + { + new (storage) boost::optional(source == Py_True ? true : false); + } + data->convertible = storage; + } + }; + + explicit python_optional() + { + register_python_conversion, + optional_to_python, optional_from_python>(); + } +}; + + +// This class works around a feature in boost python. +// See http://osdir.com/ml/python.c++/2003-11/msg00158.html - See http://osdir.com/ml/python.c++/2003-11/msg00158.html -*/ -template +template class class_with_converter : public boost::python::class_ { public: diff -Nru mapnik-2.1.0/boost/geometry/extensions/index/rtree/rtree.hpp mapnik-2.2.0/boost/geometry/extensions/index/rtree/rtree.hpp --- mapnik-2.1.0/boost/geometry/extensions/index/rtree/rtree.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/boost/geometry/extensions/index/rtree/rtree.hpp 2013-06-04 01:35:26.000000000 +0000 @@ -670,7 +670,7 @@ } index = 0; - for (typename std::vector::const_iterator it = boxes.begin(); + for (it = boxes.begin(); it != boxes.end(); ++it, index++) { if (geometry::get(*it) >= highest_low && index != lowest_high_index) diff -Nru mapnik-2.1.0/boost/gil/extension/toolbox/hsl.hpp mapnik-2.2.0/boost/gil/extension/toolbox/hsl.hpp --- mapnik-2.1.0/boost/gil/extension/toolbox/hsl.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/boost/gil/extension/toolbox/hsl.hpp 2013-06-04 01:35:26.000000000 +0000 @@ -59,9 +59,18 @@ bits32f temp_blue = channel_convert( get_color( src, blue_t() )); bits32f hue, saturation, lightness; + bits32f min_color, max_color; - bits32f min_color = std::min( temp_red, std::min( temp_green, temp_blue )); - bits32f max_color = std::max( temp_red, std::max( temp_green, temp_blue )); + if( temp_red < temp_green ) + { + min_color = std::min( temp_blue, temp_red ); + max_color = std::max( temp_blue, temp_green ); + } + else + { + min_color = std::min( temp_blue, temp_green ); + max_color = std::max( temp_blue, temp_red ); + } if ( max_color - min_color < 0.001 ) { diff -Nru mapnik-2.1.0/boost/gil/extension/toolbox/hsv.hpp mapnik-2.2.0/boost/gil/extension/toolbox/hsv.hpp --- mapnik-2.1.0/boost/gil/extension/toolbox/hsv.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/boost/gil/extension/toolbox/hsv.hpp 2013-06-04 01:35:26.000000000 +0000 @@ -60,9 +60,18 @@ bits32f temp_blue = channel_convert( get_color( src, blue_t() )); bits32f hue, saturation, value; + bits32f min_color, max_color; - bits32f min_color = std::min(temp_red,std::min(temp_green, temp_blue)); - bits32f max_color = std::max(temp_red,std::max(temp_green, temp_blue)); + if( temp_red < temp_green ) + { + min_color = std::min( temp_blue, temp_red ); + max_color = std::max( temp_blue, temp_green ); + } + else + { + min_color = std::min( temp_blue, temp_green ); + max_color = std::max( temp_blue, temp_red ); + } value = max_color; @@ -85,7 +94,7 @@ } else { - if( std::abs( boost::numeric_cast(temp_red - max_color) ) < 0.0001f ) + if( temp_red == max_color ) { hue = ( temp_green - temp_blue ) / diff; @@ -149,18 +158,23 @@ frac = h - i; + // p = value * (1 - saturation) p = get_color( src, value_t() ) * ( 1.f - get_color( src, saturation_t() )); + // q = value * (1 - saturation * hue_frac) + // it drops with increasing distance from floor(hue) q = get_color( src, value_t() ) * ( 1.f - ( get_color( src, saturation_t() ) * frac )); + // t = value * (1 - (saturation * (1 - hue_frac)) + // it grows with increasing distance from floor(hue) t = get_color( src, value_t() ) * ( 1.f - ( get_color( src, saturation_t() ) * ( 1.f - frac ))); - switch( i ) + switch( i % 6 ) { - case 0: + case 0: // red to yellow { red = get_color( src, value_t() ); green = t; @@ -169,7 +183,7 @@ break; } - case 1: + case 1: // yellow to green { red = q; green = get_color( src, value_t() ); @@ -178,7 +192,7 @@ break; } - case 2: + case 2: // green to cyan { red = p; green = get_color( src, value_t() ); @@ -187,7 +201,7 @@ break; } - case 3: + case 3: // cyan to blue { red = p; green = q; @@ -196,7 +210,7 @@ break; } - case 4: + case 4: // blue to magenta { red = t; green = p; @@ -205,7 +219,7 @@ break; } - case 5: + case 5: // magenta to red { red = get_color( src, value_t() ); green = p; diff -Nru mapnik-2.1.0/debian/changelog mapnik-2.2.0/debian/changelog --- mapnik-2.1.0/debian/changelog 2012-08-23 23:09:35.000000000 +0000 +++ mapnik-2.2.0/debian/changelog 2013-06-04 02:19:05.000000000 +0000 @@ -1,5 +1,5 @@ -mapnik (2.1.0-ubuntu1~precise2) precise; urgency=medium +mapnik (2.2.0-ubuntu1~precise1) precise; urgency=medium - * v2.1.0 release (https://github.com/mapnik/mapnik/wiki/Release2.1.0) + * v2.2.0 release (https://github.com/mapnik/mapnik/wiki/Release2.2.0) - -- Dane Springmeyer (Mapnik Releases) Thu, 23 Aug 2012 22:57:49 +0000 + -- Dane Springmeyer (Mapnik Releases) Tue, 04 Jun 2013 00:56:06 +0000 diff -Nru mapnik-2.1.0/debian/control mapnik-2.2.0/debian/control --- mapnik-2.1.0/debian/control 2012-08-23 23:00:34.000000000 +0000 +++ mapnik-2.2.0/debian/control 2013-06-04 01:43:43.000000000 +0000 @@ -3,17 +3,18 @@ Maintainer: Mapnik Developers Uploaders: Robert Coup Build-Depends: - scons, + make, git-core, python-support (>= 0.8.4), + python-nose, debhelper (>= 7.0.50~), python-all-dev, - libboost-thread-dev (>= 1.42), - libboost-filesystem-dev (>= 1.42), - libboost-regex-dev (>= 1.42), - libboost-python-dev (>= 1.42), - libboost-system-dev (>= 1.42), - libboost-program-options-dev (>= 1.42), + libboost-thread-dev (>= 1.49), + libboost-filesystem-dev (>= 1.49), + libboost-regex-dev (>= 1.49), + libboost-python-dev (>= 1.49), + libboost-system-dev (>= 1.49), + libboost-program-options-dev (>= 1.49), libpng-dev, libjpeg-dev, libtiff-dev, @@ -26,11 +27,9 @@ libxml2-dev, libicu-dev (>= 4.2), libcairo2-dev, - libcairomm-1.0-dev, python-cairo-dev, libsqlite3-dev, - libcurl4-gnutls-dev, - libsigc++-2.0-dev + libcurl4-gnutls-dev Standards-Version: 3.8.4 Section: libs XS-Python-Version: >= 2.5 @@ -41,6 +40,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, + mapnik-utils (= ${binary:Version}), ttf-dejavu, ttf-unifont Suggests: postgis @@ -85,11 +85,9 @@ libxml2-dev, libicu-dev (>= 4.2), libcairo2-dev, - libcairomm-1.0-dev, python-cairo-dev, libsqlite3-dev, - libcurl4-gnutls-dev, - libsigc++-2.0-dev + libcurl4-gnutls-dev Recommends: mapnik-doc Description: C++/Python toolkit for developing GIS applications (devel) Mapnik is an OpenSource C++/Python toolkit for developing GIS diff -Nru mapnik-2.1.0/debian/rules mapnik-2.2.0/debian/rules --- mapnik-2.1.0/debian/rules 2012-08-23 23:00:34.000000000 +0000 +++ mapnik-2.2.0/debian/rules 2013-06-04 01:43:43.000000000 +0000 @@ -5,8 +5,13 @@ export DH_VERBOSE=1 # scons flags -SCONS_FLAGS=INPUT_PLUGINS=raster,sqlite,postgis,ogr,shape,osm,gdal,csv \ +SCONS_FLAGS=INPUT_PLUGINS=csv,gdal,geojson,ogr,osm,postgis,raster,shape,sqlite \ +CUSTOM_CXXFLAGS="-fvisibility-inlines-hidden -fvisibility=hidden" \ CAIRO=True \ +COLOR_PRINT=False \ +DEMO=True \ +SVG_RENDERER = True \ +PGSQL2SQLITE = True \ SYSTEM_FONTS=/usr/share/fonts/truetype \ DESTDIR=$(CURDIR)/debian/tmp PREFIX=/usr @@ -18,11 +23,17 @@ export CFLAGS += -O3 endif +ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) override_dh_auto_test: - +else: +override_dh_auto_test: + # the test suite does not 100% pass on all platforms/boost versions, + # but the output is useful :) + #make test-local || true; echo "Overall Test Exit Code: $?" +endif override_dh_auto_configure: - scons $(SCONS_FLAGS) CUSTOM_CXXFLAGS="$(CFLAGS)" configure + ./configure $(SCONS_FLAGS) CUSTOM_CXXFLAGS="$(CFLAGS)" dh_auto_configure # Do no build for every possible python version until this is working properly @@ -30,7 +41,7 @@ #override_dh_auto_build: # set -e; \ # for PYVER in $(shell pyversions -r); do \ -# scons \ +# ./configure \ # BOOST_PYTHON_LIB=`echo $$PYVER | sed 's/python\([0-9]\).\([0-9]\)/boost_python-py\1\2/'` \ # PYTHON=`which $$PYVER`; \ # done @@ -41,17 +52,12 @@ dh_prep -Xdebian/tmp override_dh_install: - scons install + JOBS=2 make install dh_install override_dh_auto_clean: - -scons --clean - find -name '*.pyc' -exec rm -f {} \; - find -name '.sconsign*' -exec rm -f {} \; - find -name '*.o' -exec rm -f {} \; - rm -rf .sconf_temp config.log bindings/python/mapnik/paths.py \ - utils/shapeindex/shapeindex config.py config.cache \ - docs/api_docs/python/* + -make distclean + rm -rf config.py.backup # dh_auto_clean diff -Nru mapnik-2.1.0/demo/c++/Makefile mapnik-2.2.0/demo/c++/Makefile --- mapnik-2.1.0/demo/c++/Makefile 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/c++/Makefile 2013-06-04 01:35:26.000000000 +0000 @@ -1,4 +1,4 @@ -CXXFLAGS = $(shell mapnik-config --cflags) +CXXFLAGS = $(shell mapnik-config --includes --defines --cxxflags --dep-includes) LDFLAGS = $(shell mapnik-config --libs --dep-libs --ldflags) OBJ = rundemo.o @@ -13,8 +13,15 @@ .c.o : $(CXX) -c $(CXXFLAGS) $< +gyp: + rm -rf ./build + gyp rundemo.gyp --depth=. -f make --generator-output=./build/ + make -C ./build + build/out/Release/rundemo `mapnik-config --prefix` + .PHONY : clean clean: rm -f $(OBJ) rm -f $(BIN) + rm -f ./build \ No newline at end of file diff -Nru mapnik-2.1.0/demo/c++/README.md mapnik-2.2.0/demo/c++/README.md --- mapnik-2.1.0/demo/c++/README.md 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/demo/c++/README.md 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,81 @@ +## rundemo.cpp + +This directory contains a simple c++ program demonstrating the Mapnik C++ API. It mimics the python 'rundemo.py' example with a couple exceptions. + +If building on unix you can have this program automatically build by configuring Mapnik like: + + ./configure DEMO=True + +However, this example code also should be able to be built standalone. + +The following notes describe how to do that on various operating systems. + +## Depends + + - Mapnik library development headers + - `mapnik-config` on unix and `mapnik-config.bat` on windows + +### Unix + +On OS X and Linux you also need `make`. + +### Windows + +On windows, additional dependencies to build are: + + - MSVS 2010 with C++ compiler + - Python 2.x + - gyp: https://code.google.com/p/gyp | https://github.com/springmeyer/hello-gyp + +`mapnik-config.bat` should come with your Mapnik installation. + +First confirm it is on your path: + + mapnik-config # should give usage + +To install gyp, which is pure python do: + + svn checkout http://gyp.googlecode.com/svn/trunk/ gyp + cd gyp + python setup.py install + +If you do not have svn installed you can grab gyp from: + + https://github.com/TooTallNate/node-gyp/archive/master.zip + # unzip and extract the 'gyp' subfolder then do + cd gyp + python setup.py install + +## Building the demo + +### Unix + +Simply type: + + make + +Then to run do: + + ./rundemo `mapnik-config --prefix` + +On OS X you can also create an xcode project: + + gyp rundemo.gyp --depth=. -f xcode --generator-output=./build/ + xcodebuild -project ./build/rundemo.xcodeproj + ./build/out/Release/rundemo `mapnik-config --prefix` + + +### Windows + +First you need to build the visual studio solution with gyp: + + C:\Python27\python.exe c:\Python27\Scripts\gyp rundemo.gyp --depth=. -f msvs -G msvs_version=2010 + +Then you can compile with `msbuild`: + + msbuild rundemo.sln /p:Configuration="Release" /p:Platform=Win32 + +Then run it! + + for /f %i in ('mapnik-config --prefix') do set MAPNIK_PREFIX=%i + Release\rundemo.exe %MAPNIK_PREFIX% diff -Nru mapnik-2.1.0/demo/c++/build.py mapnik-2.2.0/demo/c++/build.py --- mapnik-2.1.0/demo/c++/build.py 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/c++/build.py 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# import os from copy import copy @@ -36,8 +36,8 @@ demo_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS']) if env['HAS_CAIRO']: - demo_env.PrependUnique(CPPPATH=env['CAIROMM_CPPPATHS']) - demo_env.Append(CXXFLAGS = '-DHAVE_CAIRO') + demo_env.PrependUnique(CPPPATH=env['CAIRO_CPPPATHS']) + demo_env.Append(CPPDEFINES = '-DHAVE_CAIRO') libraries = copy(env['LIBMAPNIK_LIBS']) libraries.append('mapnik') diff -Nru mapnik-2.1.0/demo/c++/common.gypi mapnik-2.2.0/demo/c++/common.gypi --- mapnik-2.1.0/demo/c++/common.gypi 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/demo/c++/common.gypi 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,42 @@ +{ + 'variables': { + 'conditions': [ + ['OS == "mac"', { + 'target_arch%': 'x64' + }, { + 'target_arch%': 'ia32' + }] + ] + }, + 'target_defaults': { + 'default_configuration': 'Release', + 'defines': [ ], + 'conditions': [ + ['OS == "mac"', { + 'defines': [ 'DARWIN' ] + }, { + 'defines': [ 'LINUX' ] + }], + ['OS == "mac" and target_arch == "x64"', { + 'xcode_settings': { + 'ARCHS': [ 'x86_64' ] + }, + }] + ], + 'configurations': { + 'Debug': { + 'cflags': [ '-g', '-O0' ], + 'xcode_settings': { + 'OTHER_CFLAGS': [ '-g', '-O0' ] + } + }, + 'Release': { + 'cflags': [ '-O3' ], + 'defines': [ 'NDEBUG' ], + 'xcode_settings': { + 'OTHER_CFLAGS': [ '-O3' ] + } + } + } + } +} \ No newline at end of file diff -Nru mapnik-2.1.0/demo/c++/readme.txt mapnik-2.2.0/demo/c++/readme.txt --- mapnik-2.1.0/demo/c++/readme.txt 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/c++/readme.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -This directory contains a simple c++ program demonstrating the Mapnik C++ API. It mimics the python 'rundemo.py' example with a couple exceptions. - -To build it re-configure SCons with DEMO=True then rebuild:: - - $ python scons/scons.py configure DEMO=True - $ python scons/scons.py - - -The sample program will be compiled (but not installed). - - -To run:: - - $ cd demo/c++ - $ ./rundemo /usr/local/lib/mapnik - -For more detailed comments have a look in demo/python/rundemo.py - -Have fun! -Artem. diff -Nru mapnik-2.1.0/demo/c++/rundemo.cpp mapnik-2.2.0/demo/c++/rundemo.cpp --- mapnik-2.1.0/demo/c++/rundemo.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/c++/rundemo.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -23,6 +23,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -31,12 +34,10 @@ #include #include #include -#include #if defined(HAVE_CAIRO) -// cairo #include -#include +#include #endif #include @@ -46,23 +47,28 @@ { if (argc != 2) { - std::cout << "usage: ./rundemo \nUsually /usr/local/lib/mapnik\n"; + std::cout << "usage: ./rundemo \nUsually /usr/local\n"; std::cout << "Warning: ./rundemo looks for data in ../data/,\nTherefore must be run from within the demo/c++ folder.\n"; return EXIT_SUCCESS; } using namespace mapnik; + const std::string srs_lcc="+proj=lcc +ellps=GRS80 +lat_0=49 +lon_0=-95 +lat+1=49 +lat_2=77 \ + +datum=NAD83 +units=m +no_defs"; + const std::string srs_merc="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 \ + +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"; + try { std::cout << " running demo ... \n"; std::string mapnik_dir(argv[1]); - std::cout << " looking for 'shape.input' plugin in... " << mapnik_dir << "/input/" << "\n"; - datasource_cache::instance()->register_datasources(mapnik_dir + "/input/"); - std::cout << " looking for DejaVuSans font in... " << mapnik_dir << "/fonts/DejaVuSans.ttf" << "\n"; - freetype_engine::register_font(mapnik_dir + "/fonts/DejaVuSans.ttf"); + std::cout << " looking for 'shape.input' plugin in... " << mapnik_dir << "/lib/mapnik/input/" << "\n"; + datasource_cache::instance().register_datasources(mapnik_dir + "/lib/mapnik/input/"); + std::cout << " looking for DejaVuSans font in... " << mapnik_dir << "/lib/mapnik/fonts/DejaVuSans.ttf" << "\n"; + freetype_engine::register_font(mapnik_dir + "/lib/mapnik/fonts/DejaVuSans.ttf"); Map m(800,600); - m.set_background(color_factory::from_string("white")); - + m.set_background(parse_color("white")); + m.set_srs(srs_merc); // create styles // Provinces (polygon) @@ -182,8 +188,9 @@ p["encoding"]="latin1"; layer lyr("Provinces"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("provinces"); + lyr.set_srs(srs_lcc); m.addLayer(lyr); } @@ -193,7 +200,8 @@ p["type"]="shape"; p["file"]="../data/qcdrainage"; layer lyr("Quebec Hydrography"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); + lyr.set_srs(srs_lcc); lyr.add_style("drainage"); m.addLayer(lyr); } @@ -202,9 +210,9 @@ parameters p; p["type"]="shape"; p["file"]="../data/ontdrainage"; - layer lyr("Ontario Hydrography"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); + lyr.set_srs(srs_lcc); lyr.add_style("drainage"); m.addLayer(lyr); } @@ -215,7 +223,8 @@ p["type"]="shape"; p["file"]="../data/boundaries_l"; layer lyr("Provincial borders"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_srs(srs_lcc); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("provlines"); m.addLayer(lyr); } @@ -226,7 +235,8 @@ p["type"]="shape"; p["file"]="../data/roads"; layer lyr("Roads"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_srs(srs_lcc); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("smallroads"); lyr.add_style("road-border"); lyr.add_style("road-fill"); @@ -242,13 +252,13 @@ p["file"]="../data/popplaces"; p["encoding"] = "latin1"; layer lyr("Populated Places"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_srs(srs_lcc); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("popplaces"); m.addLayer(lyr); } - m.zoom_to_box(box2d(1405120.04127408,-247003.813399447, - 1706357.31328276,-25098.593149577)); + m.zoom_to_box(box2d(-8024477.28459,5445190.38849,-7381388.20071,5662941.44855)); image_32 buf(m.width(),m.height()); agg_renderer ren(m,buf); @@ -256,9 +266,9 @@ save_to_file(buf,"demo.jpg","jpeg"); save_to_file(buf,"demo.png","png"); - save_to_file(buf,"demo256.png","png256"); + save_to_file(buf,"demo256.png","png8"); save_to_file(buf,"demo.tif","tiff"); - + std::cout << "Three maps have been rendered using AGG in the current directory:\n" "- demo.jpg\n" "- demo.png\n" @@ -267,24 +277,31 @@ "Have a look!\n"; #if defined(HAVE_CAIRO) - Cairo::RefPtr image_surface; - - image_surface = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, m.width(),m.height()); - cairo_renderer png_render(m, image_surface); + // save to pdf/svg files + save_to_cairo_file(m,"cairo-demo.pdf"); + save_to_cairo_file(m,"cairo-demo.svg"); + + /* we could also do: + + save_to_cairo_file(m,"cairo-demo.png"); + + but instead let's build up a surface for more flexibility + */ + + cairo_surface_ptr image_surface( + cairo_image_surface_create(CAIRO_FORMAT_ARGB32,m.width(),m.height()), + cairo_surface_closer()); + double scale_factor = 1.0; + cairo_ptr image_context = (create_context(image_surface)); + mapnik::cairo_renderer png_render(m,image_context,scale_factor); png_render.apply(); - image_surface->write_to_png("cairo-demo.png"); - + // we can now write to png with cairo functionality + cairo_surface_write_to_png(&*image_surface, "cairo-demo.png"); + // but we can also benefit from quantization by converting + // to a mapnik image object and then saving that image_32 im(image_surface); - save_to_file(im, "cairo-demo256.png","png256"); - - Cairo::RefPtr surface; - surface = Cairo::PdfSurface::create("cairo-demo.pdf", m.width(),m.height()); - cairo_renderer pdf_render(m, surface); - pdf_render.apply(); - - surface = Cairo::SvgSurface::create("cairo-demo.svg", m.width(),m.height()); - cairo_renderer svg_render(m, surface); - svg_render.apply(); + save_to_file(im, "cairo-demo256.png","png8"); + cairo_surface_finish(&*image_surface); std::cout << "Three maps have been rendered using Cairo in the current directory:\n" "- cairo-demo.png\n" @@ -295,11 +312,6 @@ #endif } - catch ( const mapnik::config_error & ex ) - { - std::cerr << "### Configuration error: " << ex.what() << std::endl; - return EXIT_FAILURE; - } catch ( const std::exception & ex ) { std::cerr << "### std::exception: " << ex.what() << std::endl; diff -Nru mapnik-2.1.0/demo/c++/rundemo.gyp mapnik-2.2.0/demo/c++/rundemo.gyp --- mapnik-2.1.0/demo/c++/rundemo.gyp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/demo/c++/rundemo.gyp 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,48 @@ +{ + 'includes': [ 'common.gypi' ], + 'default_configuration': 'Release', + 'targets': [ + { + 'target_name': 'rundemo', + 'type': 'executable', + 'sources': [ + 'rundemo.cpp', + ], + 'conditions': [ + [ 'OS=="mac"', { + 'libraries': [ + '-lmapnik', + '-undefined dynamic_lookup' + ], + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS':[ + ' - - charplacement - charplacement - - 1 - 1.00000 - 2.00000 - 1.00000 - 5.00000 - - - NAME - NAME - String - 0 - - - CLASS - CLASS - String - 0 - - - diff -Nru mapnik-2.1.0/demo/data/test/raw/charplacement.gml mapnik-2.2.0/demo/data/test/raw/charplacement.gml --- mapnik-2.1.0/demo/data/test/raw/charplacement.gml 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/data/test/raw/charplacement.gml 1970-01-01 00:00:00.000000000 +0000 @@ -1,99 +0,0 @@ - - - - - 00 - 13-13 - - - - - - 2,-1 1,-3 2,-5 - Road Name - TRIANGLE - - - 3,-1 4,-3 3,-5 - Road Name - TRIANGLE - - - - - 1,-12 13,-12 - - Road Name - STRAIGHT - - - - 1,-13 2,-13 5,-13 10,-13 13,-13 - - Road Name - STRAIGHT - - - - 6,-1 5,-3 5,-5 - Road Name - BEND - - - 7,-1 8,-3 8,-5 - Road Name - BEND - - - 5,-6 5,-8 6,-10 - Road Name - BEND - - - 8,-6 8,-8 7,-10 - Road Name - BEND - - - - 10.055915,-1.00031738281 10.6649858,-1.077712483 11.274056,-1.26950068 11.77921,-1.55298308 12.191993,-1.92815928 12.51529,-2.369132 12.746218,-2.8329032 12.884774,-3.2968745 12.930959,-3.875339 - Road Name - CURVE - - - 10.0555,-8.875339 10.6645708,-8.7979439 11.273641,-8.6061557 11.778795,-8.3226733 12.191578,-7.9474971 12.514875,-7.5065244 12.745803,-7.0427532 12.884359,-6.5787819 12.930544,-6.0003174 - Road Name - CURVE - - - - -9.055915,-2.00031738281 9.6649858,-2.077712483 10.274056,-2.26950068 10.77921,-2.55298308 11.191993,-2.92815928 11.51529,-3.369132 11.746218,-3.8329032 11.884774,-4.2968745 11.930959,-4.875339 -11.930544,-5.0003174 11.884359,-5.5787819 11.745803,-6.0427532 11.514875,-6.5065244 11.191578,-6.9474971 10.778795,-7.3226733 10.273641,-7.6061557 9.6645708,-7.7979439 9.0555,-7.875339 - - Road Name - CURVE - - - - -9.0435048,-10.5550195 9.480786,-10.2191668 9.963148,-10.0731439 10.540222,-10.2495527 10.968444,-10.525815 11.419238,-10.8336443 12.01882,-10.9565825 12.559787,-10.7996079 12.956495,-10.4089966 - - Road Name - SQUIGGLE - - - - - 1,-9 1.4,-10 1.8,-9 2.2,-10 2.6,-9 3.0,-10 3.4,-9 3.8,-10 4.2,-9 4.6,-10 - - Long ZigZag Road Name - ZIGZAG - - - - diff -Nru mapnik-2.1.0/demo/data/test/raw/charplacement.xsd mapnik-2.2.0/demo/data/test/raw/charplacement.xsd --- mapnik-2.1.0/demo/data/test/raw/charplacement.xsd 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/data/test/raw/charplacement.xsd 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru mapnik-2.1.0/demo/data/test/raw/displacement.gfs mapnik-2.2.0/demo/data/test/raw/displacement.gfs --- mapnik-2.1.0/demo/data/test/raw/displacement.gfs 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/data/test/raw/displacement.gfs 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ - - - displacement - displacement - - 1 - 1.00000 - 2.00000 - 1.00000 - 5.00000 - - - NAME - NAME - String - 0 - - - CLASS - CLASS - String - 0 - - - diff -Nru mapnik-2.1.0/demo/data/test/raw/displacement.gml mapnik-2.2.0/demo/data/test/raw/displacement.gml --- mapnik-2.1.0/demo/data/test/raw/displacement.gml 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/data/test/raw/displacement.gml 1970-01-01 00:00:00.000000000 +0000 @@ -1,173 +0,0 @@ - - - - - 00 - 13-13 - - - - - - 1,-3 1,-2 - Road - CLOCKWISE - - - 1,-2 2,-1 - Road - CLOCKWISE - - - 2,-1 3,-1 - Road - CLOCKWISE - - - 3,-1 4,-2 - Road - CLOCKWISE - - - 4,-2 4,-3 - Road - CLOCKWISE - - - 4,-3 3,-4 - Road - CLOCKWISE - - - 3,-4 2,-4 - Road - CLOCKWISE - - - 2,-4 1,-3 - Road - CLOCKWISE - - - - 5,-3 6,-4 - Road - ANTICLOCKWISE - - - 6,-4 7,-4 - Road - ANTICLOCKWISE - - - 7,-4 8,-3 - Road - ANTICLOCKWISE - - - 8,-3 8,-2 - Road - ANTICLOCKWISE - - - 8,-2 7,-1 - Road - ANTICLOCKWISE - - - 7,-1 6,-1 - Road - ANTICLOCKWISE - - - 6,-1 5,-2 - Road - ANTICLOCKWISE - - - 5,-2 5,-3 - Road - ANTICLOCKWISE - - - - - 1,-6.5 2,-5.5 3,-5 4,-5 5,-5.5 6,-6.5 - - Long Road Name To Go Around The Whole Curve! - CURVE - - - - - 1,-7 2,-8 3,-8.5 4,-8.5 5,-8 6,-7 - - Long Road Name To Go Around The Whole Curve! - CURVE - - - - - 3,-8.5 2,-9.5 1.5,-10.5 1.5,-11.5 2,-12.5 3,-13.5 - - Long Road Name To Go Around The Whole Curve! - VERTCURVE - - - - 4,-8.5 5,-9.5 5.5,-10.5 5.5,-11.5 5,-12.5 4,-13.5 - - Long Road Name To Go Around The Whole Curve! - VERTCURVE - - - - - 9.2,-4 9,-3 10,-3 10.2,-4 - - Road Name - PARALLELOGRAM - - - - 9,-2 9.2,-1 10.2,-1 10,-2 - - Road Name - PARALLELOGRAM - - - - - 11,-1 11,-2 12,-2 - - Road Name - CORNER - - - - 11,-4 12,-4 12,-3 - - Road Name - CORNER - - - - 12.5,-1 13.5,-1 13.5,-2 - - Road Name - CORNER - - - - 12.5,-4 12.5,-3 13.5,-3 - - Road Name - CORNER - - - - diff -Nru mapnik-2.1.0/demo/data/test/raw/displacement.xsd mapnik-2.2.0/demo/data/test/raw/displacement.xsd --- mapnik-2.1.0/demo/data/test/raw/displacement.xsd 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/data/test/raw/displacement.xsd 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru mapnik-2.1.0/demo/data/test/raw/overlap.gfs mapnik-2.2.0/demo/data/test/raw/overlap.gfs --- mapnik-2.1.0/demo/data/test/raw/overlap.gfs 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/data/test/raw/overlap.gfs 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ - - - overlap - overlap - - 1 - 1.00000 - 2.00000 - 1.00000 - 5.00000 - - - NAME - NAME - String - 0 - - - CLASS - CLASS - String - 0 - - - diff -Nru mapnik-2.1.0/demo/data/test/raw/overlap.gml mapnik-2.2.0/demo/data/test/raw/overlap.gml --- mapnik-2.1.0/demo/data/test/raw/overlap.gml 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/data/test/raw/overlap.gml 1970-01-01 00:00:00.000000000 +0000 @@ -1,127 +0,0 @@ - - - - - 00 - 13-13 - - - - - - 1,-1 1,-10 - Road Name - NETWORK - - - 1,-3 7,-3 - Road Name - NETWORK - - - 7,-3 7,-7 - Road Name - NETWORK - - - 3,-2 3,-8 - Road Name - NETWORK - - - 7,-7 1,-7 - Road Name - NETWORK - - - 5,-2 5,-8 - Road Name - NETWORK - - - - 8,-3 12,-3 - Road Name - CROSS - - - 10,-1 10,-5 - Road Name - CROSS - - - - - 10,-9 13,-9 13,-11 11,-11 11,-8 - - Road Name - SELFOVERLAP - - - - 4,-9 4,-13 - Road Name - NETWORK2 - - - 8,-9 8,-13 - Road Name - NETWORK2 - - - 1,-11 9,-11 - Road Name - NETWORK2 - - - 2,-9 2,-13 - Road Name - NETWORK2 - - - 6,-9 6,-13 - Road Name - NETWORK2 - - - - - 8.8,-6 8.8,-8 - Long Road Name - BENDOVER - - - 8,-6 8,-7 10,-7 10,-8 - Long Road Name - BENDUNDER - - - - 12.2,-6 12.2,-8 - Long Road Name - BENDOVER - - - 11,-6 11,-7 13,-7 13,-8 - Long Road Name - BENDUNDER - - - - 12.2,-3.5 12.2,-5.5 - Long Road Name - BENDOVER - - - 11,-4.5 13,-4.5 - Long Road Name - BENDUNDER - - - - - diff -Nru mapnik-2.1.0/demo/data/test/raw/overlap.xsd mapnik-2.2.0/demo/data/test/raw/overlap.xsd --- mapnik-2.1.0/demo/data/test/raw/overlap.xsd 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/data/test/raw/overlap.xsd 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru mapnik-2.1.0/demo/data/test/raw/textspacing.gfs mapnik-2.2.0/demo/data/test/raw/textspacing.gfs --- mapnik-2.1.0/demo/data/test/raw/textspacing.gfs 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/data/test/raw/textspacing.gfs 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ - - - textspacing - textspacing - - 1 - 1.00000 - 2.00000 - 1.00000 - 5.00000 - - - NAME - NAME - String - 0 - - - CLASS - CLASS - String - 0 - - - diff -Nru mapnik-2.1.0/demo/data/test/raw/textspacing.gml mapnik-2.2.0/demo/data/test/raw/textspacing.gml --- mapnik-2.1.0/demo/data/test/raw/textspacing.gml 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/data/test/raw/textspacing.gml 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ - - - - - 00 - 13-13 - - - - - - 2,-1 1,-3 2,-5 - Road Name - TRIANGLE - - - 3,-1 4,-3 3,-5 - Road Name - TRIANGLE - - - - 1,-7 2,-7 - Road Name - STRAIGHT - - - 1,-8 3,-8 - Road Name - STRAIGHT - - - 1,-9 4,-9 - Road Name - STRAIGHT - - - 1,-10 5,-10 - Road Name - STRAIGHT - - - - 1,-11 7,-11 - Road Name - STRAIGHT - - - - 1,-12 13,-12 - - Road Name - STRAIGHT - - - - 1,-13 2,-13 5,-13 10,-13 13,-13 - - Road Name - STRAIGHT - - - - 6,-1 5,-3 5,-5 - Road Name - BEND - - - 7,-1 8,-3 8,-5 - Road Name - BEND - - - 5,-6 5,-8 6,-10 - Road Name - BEND - - - 8,-6 8,-8 7,-10 - Road Name - BEND - - - - 10.055915,-1.00031738281 10.6649858,-1.077712483 11.274056,-1.26950068 11.77921,-1.55298308 12.191993,-1.92815928 12.51529,-2.369132 12.746218,-2.8329032 12.884774,-3.2968745 12.930959,-3.875339 - Road Name - CURVE - - - 10.0555,-8.875339 10.6645708,-8.7979439 11.273641,-8.6061557 11.778795,-8.3226733 12.191578,-7.9474971 12.514875,-7.5065244 12.745803,-7.0427532 12.884359,-6.5787819 12.930544,-6.0003174 - Road Name - CURVE - - - - -9.055915,-2.00031738281 9.6649858,-2.077712483 10.274056,-2.26950068 10.77921,-2.55298308 11.191993,-2.92815928 11.51529,-3.369132 11.746218,-3.8329032 11.884774,-4.2968745 11.930959,-4.875339 -11.930544,-5.0003174 11.884359,-5.5787819 11.745803,-6.0427532 11.514875,-6.5065244 11.191578,-6.9474971 10.778795,-7.3226733 10.273641,-7.6061557 9.6645708,-7.7979439 9.0555,-7.875339 - - Road Name - CURVE - - - - -9.0435048,-10.5550195 9.480786,-10.2191668 9.963148,-10.0731439 10.540222,-10.2495527 10.968444,-10.525815 11.419238,-10.8336443 12.01882,-10.9565825 12.559787,-10.7996079 12.956495,-10.4089966 - - Road Name - SQUIGGLE - - - - diff -Nru mapnik-2.1.0/demo/data/test/raw/textspacing.xsd mapnik-2.2.0/demo/data/test/raw/textspacing.xsd --- mapnik-2.1.0/demo/data/test/raw/textspacing.xsd 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/data/test/raw/textspacing.xsd 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru mapnik-2.1.0/demo/data/test/readme.txt mapnik-2.2.0/demo/data/test/readme.txt --- mapnik-2.1.0/demo/data/test/readme.txt 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/data/test/readme.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -These files are for testing various rendering parts of mapnik, they have been created by hand. -The raw files are in the raw/ folder (they were created with inkscape to assist!) -Run the regenerate.sh script to regenerate the shape files from the gml files, this requires ogr2ogr to run. diff -Nru mapnik-2.1.0/demo/data/test/regenerate.sh mapnik-2.2.0/demo/data/test/regenerate.sh --- mapnik-2.1.0/demo/data/test/regenerate.sh 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/data/test/regenerate.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -#!/bin/sh -rm -f textspacing.shp textspacing.shx textspacing.dbf -ogr2ogr -f "ESRI Shapefile" textspacing raw/textspacing.gml -mv textspacing/* ./ -rmdir textspacing - -rm -f overlap.shp overlap.shx overlap.dbf -ogr2ogr -f "ESRI Shapefile" overlap raw/overlap.gml -mv overlap/* ./ -rmdir overlap - -rm -f displacement.shp displacement.shx displacement.dbf -ogr2ogr -f "ESRI Shapefile" displacement raw/displacement.gml -mv displacement/* ./ -rmdir displacement - -rm -f charplacement.shp charplacement.shx charplacement.dbf -ogr2ogr -f "ESRI Shapefile" charplacement raw/charplacement.gml -mv charplacement/* ./ -rmdir charplacement Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/demo/data/test/textspacing.dbf and /tmp/Oz2YZXflHp/mapnik-2.2.0/demo/data/test/textspacing.dbf differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/demo/data/test/textspacing.shp and /tmp/Oz2YZXflHp/mapnik-2.2.0/demo/data/test/textspacing.shp differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/demo/data/test/textspacing.shx and /tmp/Oz2YZXflHp/mapnik-2.2.0/demo/data/test/textspacing.shx differ diff -Nru mapnik-2.1.0/demo/python/README.txt mapnik-2.2.0/demo/python/README.txt --- mapnik-2.1.0/demo/python/README.txt 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/python/README.txt 2013-06-04 01:35:26.000000000 +0000 @@ -1,5 +1,3 @@ -# $Id$ - This directory contains a sample python script implementing the Mapnik API. The script is thoroughly commented and also acts as a mini tutorial. Reading diff -Nru mapnik-2.1.0/demo/python/rundemo.py mapnik-2.2.0/demo/python/rundemo.py --- mapnik-2.1.0/demo/python/rundemo.py 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/python/rundemo.py 2013-06-04 01:35:26.000000000 +0000 @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# $Id$ +# # # This file is part of Mapnik (c++ mapping toolkit) # Copyright (C) 2005 Jean-Francois Doyon @@ -186,7 +186,7 @@ roads34_lyr = mapnik.Layer('Roads') roads34_lyr.srs = "+proj=lcc +ellps=GRS80 +lat_0=49 +lon_0=-95 +lat+1=49 +lat_2=77 +datum=NAD83 +units=m +no_defs" -# create roads datasource (we're going to re-use it later) +# create roads datasource (we're going to re-use it later) roads34_lyr.datasource = mapnik.Shapefile(file='../data/roads') @@ -221,7 +221,7 @@ roads2_lyr = mapnik.Layer('Roads') roads2_lyr.srs = "+proj=lcc +ellps=GRS80 +lat_0=49 +lon_0=-95 +lat+1=49 +lat_2=77 +datum=NAD83 +units=m +no_defs" # Just get a copy from roads34_lyr -roads2_lyr.datasource = roads34_lyr.datasource +roads2_lyr.datasource = roads34_lyr.datasource roads2_style_1 = mapnik.Style() roads2_rule_1 = mapnik.Rule() @@ -306,7 +306,7 @@ # We set a "halo" around the text, which looks like an outline if thin enough, # or an outright background if large enough. popplaces_text_symbolizer.label_placement= mapnik.label_placement.POINT_PLACEMENT -popplaces_text_symbolizer.halo_fill = mapnik.Color('white') +popplaces_text_symbolizer.halo_fill = mapnik.Color(255,255,200) popplaces_text_symbolizer.halo_radius = 1 popplaces_text_symbolizer.avoid_edges = True #popplaces_text_symbolizer.minimum_padding = 30 @@ -322,7 +322,7 @@ # Draw map # Set the initial extent of the map in 'master' spherical Mercator projection -m.zoom_to_box(mapnik.Box2d(-8024477.28459,5445190.38849,-7381388.20071,5662941.44855)) +m.zoom_to_box(mapnik.Box2d(-8024477.28459,5445190.38849,-7381388.20071,5662941.44855)) # Render map im = mapnik.Image(m.width,m.height) @@ -354,7 +354,7 @@ # Render cairo examples if HAS_PYCAIRO_MODULE and mapnik.has_pycairo(): - + svg_surface = cairo.SVGSurface('demo.svg', m.width,m.height) mapnik.render(m, svg_surface) svg_surface.finish() @@ -368,7 +368,7 @@ postscript_surface = cairo.PSSurface('demo.ps', m.width,m.height) mapnik.render(m, postscript_surface) images_.append('demo.ps') - postscript_surface.finish() + postscript_surface.finish() image_surface = cairo.ImageSurface(cairo.FORMAT_RGB24, m.width, m.height) mapnik.render(m, image_surface) @@ -381,12 +381,12 @@ image_surface.write_to_png('demo_cairo_argb32.png') images_.append('demo_cairo_argb32.png') image_surface.finish() - + else: print '\n\nPycairo not available...', if mapnik.has_cairo(): print ' will render Cairo formats using alternative method' - + mapnik.render_to_file(m,'demo.pdf') images_.append('demo.pdf') mapnik.render_to_file(m,'demo.ps') @@ -399,7 +399,7 @@ images_.append('demo_cairo_argb.png') print "\n\n", len(images_), "maps have been rendered in the current directory:" - + for im_ in images_: print "-", im_ diff -Nru mapnik-2.1.0/demo/simple-renderer/render.py mapnik-2.2.0/demo/simple-renderer/render.py --- mapnik-2.1.0/demo/simple-renderer/render.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/demo/simple-renderer/render.py 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +import sys +import mapnik + +def render(input_file, output_file, width=800, height=800, bbox=None): + m = mapnik.Map(width, height) + mapnik.load_map(m, input_file, False) + if bbox is not None: + m.zoom_to_box(bbox) + else: + m.zoom_all() + mapnik.render_to_file(m, output_file) + +if len(sys.argv) == 2: + render(sys.argv[1], "output.png") +elif len(sys.argv) == 3: + render(sys.argv[1], sys.argv[2]) +elif len(sys.argv) == 5: + render(sys.argv[1], sys.argv[2], int(sys.argv[3]), int(sys.argv[4])) +else: + print "usage: %s style_file [output_file] [width height]" % sys.argv[0] + sys.exit(1) diff -Nru mapnik-2.1.0/demo/test/charplacement.py mapnik-2.2.0/demo/test/charplacement.py --- mapnik-2.1.0/demo/test/charplacement.py 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/test/charplacement.py 2013-06-04 01:35:26.000000000 +0000 @@ -42,7 +42,7 @@ road_style.rules.append(road_rule); #Road text -text_symbolizer = TextSymbolizer('NAME', 'DejaVu Sans Book', 20, Color('black')) +text_symbolizer = TextSymbolizer(Expression('[NAME]'), 'DejaVu Sans Book', 20, Color('black')) text_symbolizer.label_placement=label_placement.LINE_PLACEMENT text_symbolizer.minimum_distance = 0 #text_symbolizer.max_char_angle_delta = 40 @@ -77,6 +77,6 @@ render(m, im) # Save image to file -save_to_file('output.png', 'png',im) # true-colour RGBA +im.save('output.png') # true-colour RGBA print "Done\n" diff -Nru mapnik-2.1.0/demo/test/displacement.py mapnik-2.2.0/demo/test/displacement.py --- mapnik-2.1.0/demo/test/displacement.py 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/test/displacement.py 2013-06-04 01:35:26.000000000 +0000 @@ -43,7 +43,7 @@ road_style.rules.append(road_rule); #Road text -text_symbolizer = TextSymbolizer('NAME', 'DejaVu Sans Book', 10, Color('black')) +text_symbolizer = TextSymbolizer(Expression('[NAME]'), 'DejaVu Sans Book', 10, Color('black')) text_symbolizer.label_placement=label_placement.LINE_PLACEMENT text_symbolizer.minimum_distance = 0 #text_symbolizer.max_char_angle_delta = 40 @@ -78,6 +78,6 @@ render(m, im) # Save image to file -save_to_file('output.png', 'png',im) # true-colour RGBA +im.save('output.png') # true-colour RGBA print "Done\n" diff -Nru mapnik-2.1.0/demo/test/overlap.py mapnik-2.2.0/demo/test/overlap.py --- mapnik-2.1.0/demo/test/overlap.py 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/test/overlap.py 2013-06-04 01:35:26.000000000 +0000 @@ -44,7 +44,7 @@ road_style.rules.append(road_rule); #Road text -text_symbolizer = TextSymbolizer('NAME', 'DejaVu Sans Book', 10, Color('black')) +text_symbolizer = TextSymbolizer(Expression('[NAME]'), 'DejaVu Sans Book', 10, Color('black')) text_symbolizer.label_placement=label_placement.LINE_PLACEMENT text_symbolizer.minimum_distance = 0 #text_symbolizer.max_char_angle_delta = 40 @@ -79,6 +79,6 @@ render(m, im) # Save image to file -save_to_file('output.png', 'png',im) # true-colour RGBA +im.save('output.png') # true-colour RGBA print "Done\n" diff -Nru mapnik-2.1.0/demo/test/textspacing.py mapnik-2.2.0/demo/test/textspacing.py --- mapnik-2.1.0/demo/test/textspacing.py 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/test/textspacing.py 2013-06-04 01:35:26.000000000 +0000 @@ -43,7 +43,7 @@ road_style.rules.append(road_rule); #Road text -text_symbolizer = TextSymbolizer('NAME', 'DejaVu Sans Book', 10, Color('black')) +text_symbolizer = TextSymbolizer(Expression('[NAME]'), 'DejaVu Sans Book', 10, Color('black')) text_symbolizer.label_placement=label_placement.LINE_PLACEMENT text_symbolizer.minimum_distance = 0 #text_symbolizer.max_char_angle_delta = 40 @@ -77,6 +77,6 @@ render(m, im) # Save image to file -save_to_file('output.png', 'png',im) # true-colour RGBA +im.save('output.png') # true-colour RGBA print "Done\n" diff -Nru mapnik-2.1.0/demo/viewer/about_dialog.cpp mapnik-2.2.0/demo/viewer/about_dialog.cpp --- mapnik-2.1.0/demo/viewer/about_dialog.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/about_dialog.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #include "about_dialog.hpp" diff -Nru mapnik-2.1.0/demo/viewer/about_dialog.hpp mapnik-2.2.0/demo/viewer/about_dialog.hpp --- mapnik-2.1.0/demo/viewer/about_dialog.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/about_dialog.hpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #if !defined ABOUT_DIALOG_HPP diff -Nru mapnik-2.1.0/demo/viewer/build.py mapnik-2.2.0/demo/viewer/build.py --- mapnik-2.1.0/demo/viewer/build.py 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/build.py 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# Import ('env') import os diff -Nru mapnik-2.1.0/demo/viewer/info_dialog.cpp mapnik-2.2.0/demo/viewer/info_dialog.cpp --- mapnik-2.1.0/demo/viewer/info_dialog.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/info_dialog.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #include "info_dialog.hpp" diff -Nru mapnik-2.1.0/demo/viewer/info_dialog.hpp mapnik-2.2.0/demo/viewer/info_dialog.hpp --- mapnik-2.1.0/demo/viewer/info_dialog.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/info_dialog.hpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #ifndef INFO_DIALOG_HPP diff -Nru mapnik-2.1.0/demo/viewer/layer_info_dialog.cpp mapnik-2.2.0/demo/viewer/layer_info_dialog.cpp --- mapnik-2.1.0/demo/viewer/layer_info_dialog.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/layer_info_dialog.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,11 +17,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #include "layer_info_dialog.hpp" // mapnik +#include +#include #include diff -Nru mapnik-2.1.0/demo/viewer/layer_info_dialog.hpp mapnik-2.2.0/demo/viewer/layer_info_dialog.hpp --- mapnik-2.1.0/demo/viewer/layer_info_dialog.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/layer_info_dialog.hpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #ifndef LAYER_INFO_DIALOG_HPP diff -Nru mapnik-2.1.0/demo/viewer/layerdelegate.cpp mapnik-2.2.0/demo/viewer/layerdelegate.cpp --- mapnik-2.1.0/demo/viewer/layerdelegate.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/layerdelegate.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #include #include "layerdelegate.hpp" diff -Nru mapnik-2.1.0/demo/viewer/layerdelegate.hpp mapnik-2.2.0/demo/viewer/layerdelegate.hpp --- mapnik-2.1.0/demo/viewer/layerdelegate.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/layerdelegate.hpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #ifndef LAYER_DELEGATE_HPP #define LAYER_DELEGATE_HPP diff -Nru mapnik-2.1.0/demo/viewer/layerlistmodel.cpp mapnik-2.2.0/demo/viewer/layerlistmodel.cpp --- mapnik-2.1.0/demo/viewer/layerlistmodel.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/layerlistmodel.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #include "layerlistmodel.hpp" diff -Nru mapnik-2.1.0/demo/viewer/layerlistmodel.hpp mapnik-2.2.0/demo/viewer/layerlistmodel.hpp --- mapnik-2.1.0/demo/viewer/layerlistmodel.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/layerlistmodel.hpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #ifndef LAYER_LIST_MODEL_HPP diff -Nru mapnik-2.1.0/demo/viewer/layerwidget.cpp mapnik-2.2.0/demo/viewer/layerwidget.cpp --- mapnik-2.1.0/demo/viewer/layerwidget.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/layerwidget.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #include "layerwidget.hpp" #include diff -Nru mapnik-2.1.0/demo/viewer/layerwidget.hpp mapnik-2.2.0/demo/viewer/layerwidget.hpp --- mapnik-2.1.0/demo/viewer/layerwidget.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/layerwidget.hpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #ifndef LAYERWIDGET_HPP #define LAYERWIDGET_HPP diff -Nru mapnik-2.1.0/demo/viewer/main.cpp mapnik-2.2.0/demo/viewer/main.cpp --- mapnik-2.1.0/demo/viewer/main.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/main.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,18 +17,17 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ // qt -#include +#include #include #include #include #include #include "mainwindow.hpp" + // boost #include -#include int main( int argc, char **argv ) @@ -46,7 +45,7 @@ // register input plug-ins QString plugins_dir = settings.value("mapnik/plugins_dir", QVariant("/usr/local/lib/mapnik/input/")).toString(); - datasource_cache::instance()->register_datasources(plugins_dir.toStdString()); + datasource_cache::instance().register_datasources(plugins_dir.toStdString()); // register fonts int count = settings.beginReadArray("mapnik/fonts"); for (int index=0; index < count; ++index) diff -Nru mapnik-2.1.0/demo/viewer/mainwindow.cpp mapnik-2.2.0/demo/viewer/mainwindow.cpp --- mapnik-2.1.0/demo/viewer/mainwindow.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/mainwindow.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ // stl #include @@ -33,7 +32,10 @@ #include #include #include - +#include +#include +#include +#include // mapnik #ifndef Q_MOC_RUN // QT moc chokes on BOOST_JOIN diff -Nru mapnik-2.1.0/demo/viewer/mainwindow.hpp mapnik-2.2.0/demo/viewer/mainwindow.hpp --- mapnik-2.1.0/demo/viewer/mainwindow.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/mainwindow.hpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,13 +17,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #ifndef MAINWINDOW_HPP #define MAINWINDOW_HPP #include -#include #include #include #include @@ -79,7 +77,6 @@ LayerTab *layerTab_; StyleTab * styleTab_; MapWidget * mapWidget_; - QPrinter printer; //actions QList exportAsActs; QActionGroup *toolsGroup; diff -Nru mapnik-2.1.0/demo/viewer/mapwidget.cpp mapnik-2.2.0/demo/viewer/mapwidget.cpp --- mapnik-2.1.0/demo/viewer/mapwidget.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/mapwidget.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,15 +17,15 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #include +#define BOOST_CHRONO_HEADER_ONLY +#include #include #include #include -#include #include #include #include @@ -38,7 +38,6 @@ #ifdef HAVE_CAIRO // cairo #include -#include #endif #include "mapwidget.hpp" @@ -161,7 +160,7 @@ QVector > info; projection map_proj(map_->srs()); // map projection - double scale_denom = scale_denominator(*map_,map_proj.is_geographic()); + double scale_denom = scale_denominator(map_->scale(),map_proj.is_geographic()); CoordTransform t(map_->width(),map_->height(),map_->get_current_extent()); for (unsigned index = 0; index < map_->layer_count();++index) @@ -504,7 +503,10 @@ try { - ren.apply(); + { + boost::timer::auto_cpu_timer t; + ren.apply(); + } QImage image((uchar*)buf.raw_data(),width,height,QImage::Format_ARGB32); pix = QPixmap::fromImage(image.rgbSwapped()); } @@ -525,41 +527,7 @@ void render_grid(mapnik::Map const& map, double scaling_factor, QPixmap & pix) { - unsigned width=map.width(); - unsigned height=map.height(); - - mapnik::grid buf(width,height,"F_CODE", 1); - mapnik::grid_renderer ren(map,buf,scaling_factor); - - try - { - ren.apply(); - int * imdata = static_cast(buf.raw_data()); - - QImage image(width,height,QImage::Format_RGB32); - for (unsigned i = 0 ; i < height ; ++i) - { - for (unsigned j = 0 ; j < width ; ++j) - { - image.setPixel(j,i,qRgb((uint8_t)(imdata[i*width+j]>>8), - (uint8_t)(imdata[i*width+j+1]>>8), - (uint8_t)(imdata[i*width+j+2]>>8))); - } - } - pix = QPixmap::fromImage(image); - } - catch (mapnik::config_error & ex) - { - std::cerr << ex.what() << std::endl; - } - catch (const std::exception & ex) - { - std::cerr << "exception: " << ex.what() << std::endl; - } - catch (...) - { - std::cerr << "Unknown exception caught!\n"; - } + std::cerr << "Not supported" << std::endl; } @@ -567,12 +535,10 @@ { #ifdef HAVE_CAIRO - Cairo::RefPtr image_surface = - Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, map.width(),map.height()); - - mapnik::cairo_renderer png_render(map, image_surface, scaling_factor); - png_render.apply(); - + mapnik::cairo_surface_ptr image_surface(cairo_image_surface_create(CAIRO_FORMAT_ARGB32,map.width(),map.height()), + mapnik::cairo_surface_closer()); + mapnik::cairo_renderer renderer(map, image_surface, scaling_factor); + renderer.apply(); image_32 buf(image_surface); QImage image((uchar*)buf.raw_data(),buf.width(),buf.height(),QImage::Format_ARGB32); pix = QPixmap::fromImage(image.rgbSwapped()); diff -Nru mapnik-2.1.0/demo/viewer/mapwidget.hpp mapnik-2.2.0/demo/viewer/mapwidget.hpp --- mapnik-2.1.0/demo/viewer/mapwidget.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/mapwidget.hpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #ifndef MAP_WIDGET_HPP #define MAP_WIDGET_HPP diff -Nru mapnik-2.1.0/demo/viewer/styles_model.cpp mapnik-2.2.0/demo/viewer/styles_model.cpp --- mapnik-2.1.0/demo/viewer/styles_model.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/styles_model.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,21 +17,23 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #include "styles_model.hpp" #include +#include +#include +#include + // boost #include #include -#include // qt #include #include #include #include -class node : private boost::noncopyable +class node : private mapnik::noncopyable { struct node_base { @@ -162,6 +164,18 @@ return QString("ShieldSymbolizer"); } + QString operator() (mapnik::markers_symbolizer const& sym) const + { + boost::ignore_unused_variable_warning(sym); + return QString("MarkersSymbolizer"); + } + + QString operator() (mapnik::building_symbolizer const& sym) const + { + boost::ignore_unused_variable_warning(sym); + return QString("BuildingSymbolizer"); + } + template QString operator() (T const& ) const { @@ -223,7 +237,7 @@ { public: symbolizer_node(mapnik::symbolizer const & sym) - : sym_(sym) {} + : sym_(sym) {} ~symbolizer_node(){} QString name() const diff -Nru mapnik-2.1.0/demo/viewer/styles_model.hpp mapnik-2.2.0/demo/viewer/styles_model.hpp --- mapnik-2.1.0/demo/viewer/styles_model.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/styles_model.hpp 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//$Id$ #ifndef STYLE_MODEL_HPP #define STYLE_MODEL_HPP diff -Nru mapnik-2.1.0/demo/viewer/viewer.pro mapnik-2.2.0/demo/viewer/viewer.pro --- mapnik-2.1.0/demo/viewer/viewer.pro 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/demo/viewer/viewer.pro 2013-06-04 01:35:26.000000000 +0000 @@ -2,11 +2,13 @@ # Mapnik viewer - Copyright (C) 2007 Artem Pavlenko ###################################################################### TEMPLATE = app +QT += core gui widgets QMAKE_CXX = clang++ -QMAKE_CXXFLAGS += $$system(mapnik-config --cflags) +QMAKE_CXXFLAGS += $$system(mapnik-config --cxxflags) +QMAKE_CXXFLAGS += $$system(mapnik-config --includes --dep-includes) QMAKE_LFLAGS += $$system(mapnik-config --libs) QMAKE_LFLAGS += $$system(mapnik-config --ldflags --dep-libs) - +QMAKE_LFLAGS += -lboost_timer # Input CONFIG += qt debug_and_release @@ -19,17 +21,17 @@ layerwidget.hpp \ layerlistmodel.hpp \ layerdelegate.hpp \ - styles_model.hpp + styles_model.hpp HEADERS += about_dialog.hpp \ info_dialog.hpp \ layer_info_dialog.hpp SOURCES += main.cpp \ - mainwindow.cpp \ + mainwindow.cpp \ mapwidget.cpp \ layerwidget.cpp \ - layerlistmodel.cpp \ + layerlistmodel.cpp \ layerdelegate.cpp \ styles_model.cpp diff -Nru mapnik-2.1.0/deps/agg/build.py mapnik-2.2.0/deps/agg/build.py --- mapnik-2.1.0/deps/agg/build.py 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/build.py 2013-06-04 01:35:26.000000000 +0000 @@ -15,9 +15,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -# $Id$ +# -import glob +import os +from glob import glob Import('env') @@ -28,4 +29,4 @@ else: cxxflags = env['CUSTOM_CXXFLAGS'] + ' -O%s -fPIC -DNDEBUG' % env['OPTIMIZATION'] -agg_env.StaticLibrary('agg', glob.glob('./src/' + '*.cpp'), LIBS=[], CXXFLAGS=cxxflags, LINKFLAGS=env['CUSTOM_LDFLAGS']) \ No newline at end of file +agg_env.StaticLibrary('agg', glob('./src/' + '*.cpp'), LIBS=[], CXXFLAGS=cxxflags, LINKFLAGS=env['CUSTOM_LDFLAGS']) \ No newline at end of file diff -Nru mapnik-2.1.0/deps/agg/include/agg_alpha_mask_u8.h mapnik-2.2.0/deps/agg/include/agg_alpha_mask_u8.h --- mapnik-2.1.0/deps/agg/include/agg_alpha_mask_u8.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_alpha_mask_u8.h 2013-06-04 01:35:26.000000000 +0000 @@ -19,7 +19,7 @@ #ifndef AGG_ALPHA_MASK_U8_INCLUDED #define AGG_ALPHA_MASK_U8_INCLUDED -#include +#include #include "agg_basics.h" #include "agg_rendering_buffer.h" diff -Nru mapnik-2.1.0/deps/agg/include/agg_arc.h mapnik-2.2.0/deps/agg/include/agg_arc.h --- mapnik-2.1.0/deps/agg/include/agg_arc.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_arc.h 2013-06-04 01:35:26.000000000 +0000 @@ -20,7 +20,7 @@ #ifndef AGG_ARC_INCLUDED #define AGG_ARC_INCLUDED -#include +#include #include "agg_basics.h" namespace agg diff -Nru mapnik-2.1.0/deps/agg/include/agg_array.h mapnik-2.2.0/deps/agg/include/agg_array.h --- mapnik-2.1.0/deps/agg/include/agg_array.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_array.h 2013-06-04 01:35:26.000000000 +0000 @@ -15,8 +15,8 @@ #ifndef AGG_ARRAY_INCLUDED #define AGG_ARRAY_INCLUDED -#include -#include +#include +#include #include "agg_basics.h" namespace agg diff -Nru mapnik-2.1.0/deps/agg/include/agg_basics.h mapnik-2.2.0/deps/agg/include/agg_basics.h --- mapnik-2.1.0/deps/agg/include/agg_basics.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_basics.h 2013-06-04 01:35:26.000000000 +0000 @@ -16,7 +16,7 @@ #ifndef AGG_BASICS_INCLUDED #define AGG_BASICS_INCLUDED -#include +#include #include "agg_config.h" //---------------------------------------------------------AGG_CUSTOM_ALLOCATOR diff -Nru mapnik-2.1.0/deps/agg/include/agg_clip_liang_barsky.h mapnik-2.2.0/deps/agg/include/agg_clip_liang_barsky.h --- mapnik-2.1.0/deps/agg/include/agg_clip_liang_barsky.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_clip_liang_barsky.h 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,7 +13,7 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Liang-Barsky clipping +// Liang-Barsky clipping // //---------------------------------------------------------------------------- #ifndef AGG_CLIP_LIANG_BARSKY_INCLUDED @@ -36,7 +36,7 @@ }; //----------------------------------------------------------clipping_flags - // Determine the clipping code of the vertex according to the + // Determine the clipping code of the vertex according to the // Cyrus-Beck line clipping algorithm // // | | @@ -52,7 +52,7 @@ // | | // clip_box.x1 clip_box.x2 // - // + // template inline unsigned clipping_flags(T x, T y, const rect_base& clip_box) { @@ -87,7 +87,7 @@ const double nearzero = 1e-30; double deltax = x2 - x1; - double deltay = y2 - y1; + double deltay = y2 - y1; double xin; double xout; double yin; @@ -95,52 +95,52 @@ double tinx; double tiny; double toutx; - double touty; + double touty; double tin1; double tin2; double tout1; unsigned np = 0; - if(deltax == 0.0) - { + if(deltax == 0.0) + { // bump off of the vertical deltax = (x1 > clip_box.x1) ? -nearzero : nearzero; } - if(deltay == 0.0) - { - // bump off of the horizontal + if(deltay == 0.0) + { + // bump off of the horizontal deltay = (y1 > clip_box.y1) ? -nearzero : nearzero; } - - if(deltax > 0.0) - { + + if(deltax > 0.0) + { // points to right xin = clip_box.x1; xout = clip_box.x2; } - else + else { xin = clip_box.x2; xout = clip_box.x1; } - if(deltay > 0.0) + if(deltay > 0.0) { // points up yin = clip_box.y1; yout = clip_box.y2; } - else + else { yin = clip_box.y2; yout = clip_box.y1; } - + tinx = (xin - x1) / deltax; tiny = (yin - y1) / deltay; - - if (tinx < tiny) + + if (tinx < tiny) { // hits x first tin1 = tinx; @@ -152,10 +152,10 @@ tin1 = tiny; tin2 = tinx; } - - if(tin1 <= 1.0) + + if(tin1 <= 1.0) { - if(0.0 < tin1) + if(0.0 < tin1) { *x++ = (T)xin; *y++ = (T)yin; @@ -166,21 +166,21 @@ { toutx = (xout - x1) / deltax; touty = (yout - y1) / deltay; - + tout1 = (toutx < touty) ? toutx : touty; - - if(tin2 > 0.0 || tout1 > 0.0) + + if(tin2 > 0.0 || tout1 > 0.0) { - if(tin2 <= tout1) + if(tin2 <= tout1) { - if(tin2 > 0.0) + if(tin2 > 0.0) { - if(tinx > tiny) + if(tinx > tiny) { *x++ = (T)xin; *y++ = (T)(y1 + tinx * deltay); } - else + else { *x++ = (T)(x1 + tiny * deltax); *y++ = (T)yin; @@ -188,34 +188,34 @@ ++np; } - if(tout1 < 1.0) + if(tout1 < 1.0) { - if(toutx < touty) + if(toutx < touty) { *x++ = (T)xout; *y++ = (T)(y1 + toutx * deltay); } - else + else { *x++ = (T)(x1 + touty * deltax); *y++ = (T)yout; } } - else + else { *x++ = x2; *y++ = y2; } ++np; } - else + else { - if(tinx > tiny) + if(tinx > tiny) { *x++ = (T)xin; *y++ = (T)yout; } - else + else { *x++ = (T)xout; *y++ = (T)yin; @@ -231,8 +231,8 @@ //---------------------------------------------------------------------------- template - bool clip_move_point(T x1, T y1, T x2, T y2, - const rect_base& clip_box, + bool clip_move_point(T x1, T y1, T x2, T y2, + const rect_base& clip_box, T* x, T* y, unsigned flags) { T bound; @@ -281,14 +281,14 @@ return 0; } - if((f1 & clipping_flags_x_clipped) != 0 && + if((f1 & clipping_flags_x_clipped) != 0 && (f1 & clipping_flags_x_clipped) == (f2 & clipping_flags_x_clipped)) { // Fully clipped return 4; } - if((f1 & clipping_flags_y_clipped) != 0 && + if((f1 & clipping_flags_y_clipped) != 0 && (f1 & clipping_flags_y_clipped) == (f2 & clipping_flags_y_clipped)) { // Fully clipped @@ -299,25 +299,25 @@ T ty1 = *y1; T tx2 = *x2; T ty2 = *y2; - if(f1) - { - if(!clip_move_point(tx1, ty1, tx2, ty2, clip_box, x1, y1, f1)) + if(f1) + { + if(!clip_move_point(tx1, ty1, tx2, ty2, clip_box, x1, y1, f1)) { return 4; } - if(*x1 == *x2 && *y1 == *y2) + if(*x1 == *x2 && *y1 == *y2) { return 4; } ret |= 1; } - if(f2) + if(f2) { if(!clip_move_point(tx1, ty1, tx2, ty2, clip_box, x2, y2, f2)) { return 4; } - if(*x1 == *x2 && *y1 == *y2) + if(*x1 == *x2 && *y1 == *y2) { return 4; } diff -Nru mapnik-2.1.0/deps/agg/include/agg_color_rgba.h mapnik-2.2.0/deps/agg/include/agg_color_rgba.h --- mapnik-2.1.0/deps/agg/include/agg_color_rgba.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_color_rgba.h 2013-06-04 01:35:26.000000000 +0000 @@ -24,7 +24,7 @@ #ifndef AGG_COLOR_RGBA_INCLUDED #define AGG_COLOR_RGBA_INCLUDED -#include +#include #include "agg_basics.h" namespace agg diff -Nru mapnik-2.1.0/deps/agg/include/agg_conv_adaptor_vcgen.h mapnik-2.2.0/deps/agg/include/agg_conv_adaptor_vcgen.h --- mapnik-2.1.0/deps/agg/include/agg_conv_adaptor_vcgen.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_conv_adaptor_vcgen.h 2013-06-04 01:35:26.000000000 +0000 @@ -29,6 +29,7 @@ void rewind(unsigned) {} unsigned vertex(double*, double*) { return path_cmd_stop; } + unsigned type() const { return 0; } }; @@ -64,6 +65,7 @@ } unsigned vertex(double* x, double* y); + unsigned type() const { return m_source->type(); } private: // Prohibit copying diff -Nru mapnik-2.1.0/deps/agg/include/agg_conv_adaptor_vpgen.h mapnik-2.2.0/deps/agg/include/agg_conv_adaptor_vpgen.h --- mapnik-2.1.0/deps/agg/include/agg_conv_adaptor_vpgen.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_conv_adaptor_vpgen.h 2013-06-04 01:35:26.000000000 +0000 @@ -33,6 +33,7 @@ void rewind(unsigned path_id); unsigned vertex(double* x, double* y); + unsigned type() const { return m_source->type(); } private: conv_adaptor_vpgen(const conv_adaptor_vpgen&); diff -Nru mapnik-2.1.0/deps/agg/include/agg_conv_clip_polygon.h mapnik-2.2.0/deps/agg/include/agg_conv_clip_polygon.h --- mapnik-2.1.0/deps/agg/include/agg_conv_clip_polygon.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_conv_clip_polygon.h 2013-06-04 01:35:26.000000000 +0000 @@ -51,6 +51,7 @@ double y1() const { return base_type::vpgen().y1(); } double x2() const { return base_type::vpgen().x2(); } double y2() const { return base_type::vpgen().y2(); } + unsigned type() const { return base_type::type(); } private: conv_clip_polygon(const conv_clip_polygon&); diff -Nru mapnik-2.1.0/deps/agg/include/agg_conv_clip_polyline.h mapnik-2.2.0/deps/agg/include/agg_conv_clip_polyline.h --- mapnik-2.1.0/deps/agg/include/agg_conv_clip_polyline.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_conv_clip_polyline.h 2013-06-04 01:35:26.000000000 +0000 @@ -51,6 +51,7 @@ double y1() const { return base_type::vpgen().y1(); } double x2() const { return base_type::vpgen().x2(); } double y2() const { return base_type::vpgen().y2(); } + unsigned type() const { return base_type::type(); } private: conv_clip_polyline(const conv_clip_polyline&); diff -Nru mapnik-2.1.0/deps/agg/include/agg_conv_clipper.h mapnik-2.2.0/deps/agg/include/agg_conv_clipper.h --- mapnik-2.1.0/deps/agg/include/agg_conv_clipper.h 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_conv_clipper.h 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,295 @@ +/******************************************************************************* +* * +* Author : Angus Johnson * +* Version : 1.1 * +* Date : 4 April 2011 * +* Website : http://www.angusj.com * +* Copyright : Angus Johnson 2010-2011 * +* * +* License: * +* Use, modification & distribution is subject to Boost Software License Ver 1. * +* http://www.boost.org/LICENSE_1_0.txt * +* * +*******************************************************************************/ + +#ifndef AGG_CONV_CLIPPER_INCLUDED +#define AGG_CONV_CLIPPER_INCLUDED + +#include +#include "agg_basics.h" +#include "agg_array.h" +#include "clipper.hpp" + +namespace agg +{ + enum clipper_op_e { clipper_or, + clipper_and, clipper_xor, clipper_a_minus_b, clipper_b_minus_a }; + enum clipper_PolyFillType {clipper_even_odd, clipper_non_zero, clipper_positive, clipper_negative}; + + template class conv_clipper + { + enum status { status_move_to, status_line_to, status_stop }; + typedef VSA source_a_type; + typedef VSB source_b_type; + typedef conv_clipper self_type; + + private: + source_a_type* m_src_a; + source_b_type* m_src_b; + status m_status; + int m_vertex; + int m_contour; + int m_scaling_factor; + clipper_op_e m_operation; + pod_bvector m_vertex_accumulator; + ClipperLib::Polygons m_poly_a; + ClipperLib::Polygons m_poly_b; + ClipperLib::Polygons m_result; + ClipperLib::Clipper m_clipper; + clipper_PolyFillType m_subjFillType; + clipper_PolyFillType m_clipFillType; + + int Round(double val) + { + if ((val < 0)) return (int)(val - 0.5); else return (int)(val + 0.5); + } + + public: + conv_clipper(source_a_type &a, source_b_type &b, + clipper_op_e op = clipper_or, + clipper_PolyFillType subjFillType = clipper_even_odd, + clipper_PolyFillType clipFillType = clipper_even_odd, + int scaling_factor = 2) : + m_src_a(&a), + m_src_b(&b), + m_status(status_move_to), + m_vertex(-1), + m_contour(-1), + m_operation(op), + m_subjFillType(subjFillType), + m_clipFillType(clipFillType) + { + m_scaling_factor = std::max(std::min(scaling_factor, 6),0); + m_scaling_factor = Round(std::pow((double)10, m_scaling_factor)); + } + + ~conv_clipper() + { + } + + void attach1(VSA &source, clipper_PolyFillType subjFillType = clipper_even_odd) + { m_src_a = &source; m_subjFillType = subjFillType; } + void attach2(VSB &source, clipper_PolyFillType clipFillType = clipper_even_odd) + { m_src_b = &source; m_clipFillType = clipFillType; } + + void operation(clipper_op_e v) { m_operation = v; } + + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); + + bool next_contour(); + bool next_vertex(double* x, double* y); + void start_extracting(); + void add_vertex_(double &x, double &y); + void end_contour(ClipperLib::Polygons &p); + + template void add(VS &src, ClipperLib::Polygons &p){ + unsigned cmd; + double x; double y; double start_x; double start_y; + bool starting_first_line; + + start_x = 0.0; + start_y = 0.0; + starting_first_line = true; + p.resize(0); + + cmd = src->vertex( &x , &y ); + while(!is_stop(cmd)) + { + if(is_vertex(cmd)) + { + if(is_move_to(cmd)) + { + if(!starting_first_line ) end_contour(p); + start_x = x; + start_y = y; + } + add_vertex_( x, y ); + starting_first_line = false; + } + else if(is_end_poly(cmd)) + { + if(!starting_first_line && is_closed(cmd)) + add_vertex_( start_x, start_y ); + } + cmd = src->vertex( &x, &y ); + } + end_contour(p); + } + }; + + //------------------------------------------------------------------------ + + template + void conv_clipper::start_extracting() + { + m_status = status_move_to; + m_contour = -1; + m_vertex = -1; + } + //------------------------------------------------------------------------------ + + template + void conv_clipper::rewind(unsigned path_id) + { + m_src_a->rewind( path_id ); + m_src_b->rewind( path_id ); + + add( m_src_a , m_poly_a ); + add( m_src_b , m_poly_b ); + m_result.resize(0); + + ClipperLib::PolyFillType pftSubj, pftClip; + switch (m_subjFillType) + { + case clipper_even_odd: pftSubj = ClipperLib::pftEvenOdd; break; + case clipper_non_zero: pftSubj = ClipperLib::pftNonZero; break; + case clipper_positive: pftSubj = ClipperLib::pftPositive; break; + default: pftSubj = ClipperLib::pftNegative; + } + switch (m_clipFillType) + { + case clipper_even_odd: pftClip = ClipperLib::pftEvenOdd; break; + case clipper_non_zero: pftClip = ClipperLib::pftNonZero; break; + case clipper_positive: pftClip = ClipperLib::pftPositive; break; + default: pftClip = ClipperLib::pftNegative; + } + + m_clipper.Clear(); + switch( m_operation ) { + case clipper_or: + { + m_clipper.AddPolygons( m_poly_a , ClipperLib::ptSubject ); + m_clipper.AddPolygons( m_poly_b , ClipperLib::ptClip ); + m_clipper.Execute( ClipperLib::ctUnion , m_result , pftSubj, pftClip); + break; + } + case clipper_and: + { + m_clipper.AddPolygons( m_poly_a , ClipperLib::ptSubject ); + m_clipper.AddPolygons( m_poly_b , ClipperLib::ptClip ); + m_clipper.Execute( ClipperLib::ctIntersection , m_result, pftSubj, pftClip ); + break; + } + case clipper_xor: + { + m_clipper.AddPolygons( m_poly_a , ClipperLib::ptSubject ); + m_clipper.AddPolygons( m_poly_b , ClipperLib::ptClip ); + m_clipper.Execute( ClipperLib::ctXor , m_result, pftSubj, pftClip ); + break; + } + case clipper_a_minus_b: + { + m_clipper.AddPolygons( m_poly_a , ClipperLib::ptSubject ); + m_clipper.AddPolygons( m_poly_b , ClipperLib::ptClip ); + m_clipper.Execute( ClipperLib::ctDifference , m_result, pftSubj, pftClip ); + break; + } + case clipper_b_minus_a: + { + m_clipper.AddPolygons( m_poly_b , ClipperLib::ptSubject ); + m_clipper.AddPolygons( m_poly_a , ClipperLib::ptClip ); + m_clipper.Execute( ClipperLib::ctDifference , m_result, pftSubj, pftClip ); + break; + } + } + start_extracting(); + } + //------------------------------------------------------------------------------ + + template + void conv_clipper::end_contour( ClipperLib::Polygons &p) + { + unsigned i, len; + + if( m_vertex_accumulator.size() < 3 ) return; + len = p.size(); + p.resize(len+1); + p[len].resize(m_vertex_accumulator.size()); + for( i = 0 ; i < m_vertex_accumulator.size() ; i++ ) + p[len][i] = m_vertex_accumulator[i]; + m_vertex_accumulator.remove_all(); + } + //------------------------------------------------------------------------------ + + template + void conv_clipper::add_vertex_(double &x, double &y) + { + ClipperLib::IntPoint v; + + v.X = Round(x * m_scaling_factor); + v.Y = Round(y * m_scaling_factor); + m_vertex_accumulator.add( v ); + } + //------------------------------------------------------------------------------ + + template + bool conv_clipper::next_contour() + { + m_contour++; + if(m_contour >= (int)m_result.size()) return false; + m_vertex =-1; + return true; +} +//------------------------------------------------------------------------------ + + template + bool conv_clipper::next_vertex(double *x, double *y) + { + m_vertex++; + if(m_vertex >= (int)m_result[m_contour].size()) return false; + *x = (double)m_result[ m_contour ][ m_vertex ].X / m_scaling_factor; + *y = (double)m_result[ m_contour ][ m_vertex ].Y / m_scaling_factor; + return true; + } + //------------------------------------------------------------------------------ + + template + unsigned conv_clipper::vertex(double *x, double *y) +{ + if( m_status == status_move_to ) + { + if( next_contour() ) + { + if( next_vertex( x, y ) ) + { + m_status =status_line_to; + return path_cmd_move_to; + } + else + { + m_status = status_stop; + return path_cmd_end_poly | path_flags_close; + } + } + else + return path_cmd_stop; + } + else + { + if( next_vertex( x, y ) ) + { + return path_cmd_line_to; + } + else + { + m_status = status_move_to; + return path_cmd_end_poly | path_flags_close; + } + } +} +//------------------------------------------------------------------------------ + + +} //namespace agg +#endif //AGG_CONV_CLIPPER_INCLUDED diff -Nru mapnik-2.1.0/deps/agg/include/agg_conv_gpc.h mapnik-2.2.0/deps/agg/include/agg_conv_gpc.h --- mapnik-2.1.0/deps/agg/include/agg_conv_gpc.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_conv_gpc.h 2013-06-04 01:35:26.000000000 +0000 @@ -24,7 +24,7 @@ #ifndef AGG_CONV_GPC_INCLUDED #define AGG_CONV_GPC_INCLUDED -#include +#include #include "agg_basics.h" #include "agg_array.h" diff -Nru mapnik-2.1.0/deps/agg/include/agg_conv_smooth_poly1.h mapnik-2.2.0/deps/agg/include/agg_conv_smooth_poly1.h --- mapnik-2.1.0/deps/agg/include/agg_conv_smooth_poly1.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_conv_smooth_poly1.h 2013-06-04 01:35:26.000000000 +0000 @@ -42,6 +42,7 @@ void smooth_value(double v) { base_type::generator().smooth_value(v); } double smooth_value() const { return base_type::generator().smooth_value(); } + unsigned type() const { return base_type::type(); } private: conv_smooth_poly1(const conv_smooth_poly1&); @@ -64,6 +65,7 @@ void smooth_value(double v) { m_smooth.generator().smooth_value(v); } double smooth_value() const { return m_smooth.generator().smooth_value(); } + unsigned type() const { return m_smooth.type(); } private: conv_smooth_poly1_curve(const conv_smooth_poly1_curve&); diff -Nru mapnik-2.1.0/deps/agg/include/agg_dda_line.h mapnik-2.2.0/deps/agg/include/agg_dda_line.h --- mapnik-2.1.0/deps/agg/include/agg_dda_line.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_dda_line.h 2013-06-04 01:35:26.000000000 +0000 @@ -20,7 +20,7 @@ #ifndef AGG_DDA_LINE_INCLUDED #define AGG_DDA_LINE_INCLUDED -#include +#include #include "agg_basics.h" namespace agg diff -Nru mapnik-2.1.0/deps/agg/include/agg_ellipse.h mapnik-2.2.0/deps/agg/include/agg_ellipse.h --- mapnik-2.1.0/deps/agg/include/agg_ellipse.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_ellipse.h 2013-06-04 01:35:26.000000000 +0000 @@ -21,7 +21,7 @@ #define AGG_ELLIPSE_INCLUDED #include "agg_basics.h" -#include +#include namespace agg { diff -Nru mapnik-2.1.0/deps/agg/include/agg_font_cache_manager.h mapnik-2.2.0/deps/agg/include/agg_font_cache_manager.h --- mapnik-2.1.0/deps/agg/include/agg_font_cache_manager.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_font_cache_manager.h 2013-06-04 01:35:26.000000000 +0000 @@ -16,7 +16,7 @@ #ifndef AGG_FONT_CACHE_MANAGER_INCLUDED #define AGG_FONT_CACHE_MANAGER_INCLUDED -#include +#include #include "agg_array.h" namespace agg diff -Nru mapnik-2.1.0/deps/agg/include/agg_gamma_functions.h mapnik-2.2.0/deps/agg/include/agg_gamma_functions.h --- mapnik-2.1.0/deps/agg/include/agg_gamma_functions.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_gamma_functions.h 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -16,7 +16,7 @@ #ifndef AGG_GAMMA_FUNCTIONS_INCLUDED #define AGG_GAMMA_FUNCTIONS_INCLUDED -#include +#include #include "agg_basics.h" namespace agg @@ -40,6 +40,7 @@ double operator() (double x) const { + if (x == 0.0) return 0.0; return pow(x, m_gamma); } @@ -85,7 +86,11 @@ { if(x < m_start) return 0.0; if(x > m_end) return 1.0; - return (x - m_start) / (m_end - m_start); + double delta = m_end - m_start; + // avoid nan from potential zero division + // https://github.com/mapnik/mapnik/issues/761 + if (delta <= 0.0) return 0.0; + return (x - m_start) / delta; } private: @@ -118,6 +123,3 @@ } #endif - - - diff -Nru mapnik-2.1.0/deps/agg/include/agg_gamma_lut.h mapnik-2.2.0/deps/agg/include/agg_gamma_lut.h --- mapnik-2.1.0/deps/agg/include/agg_gamma_lut.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_gamma_lut.h 2013-06-04 01:35:26.000000000 +0000 @@ -16,7 +16,7 @@ #ifndef AGG_GAMMA_LUT_INCLUDED #define AGG_GAMMA_LUT_INCLUDED -#include +#include #include "agg_basics.h" namespace agg diff -Nru mapnik-2.1.0/deps/agg/include/agg_glyph_raster_bin.h mapnik-2.2.0/deps/agg/include/agg_glyph_raster_bin.h --- mapnik-2.1.0/deps/agg/include/agg_glyph_raster_bin.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_glyph_raster_bin.h 2013-06-04 01:35:26.000000000 +0000 @@ -16,7 +16,7 @@ #ifndef AGG_GLYPH_RASTER_BIN_INCLUDED #define AGG_GLYPH_RASTER_BIN_INCLUDED -#include +#include #include "agg_basics.h" namespace agg diff -Nru mapnik-2.1.0/deps/agg/include/agg_line_aa_basics.h mapnik-2.2.0/deps/agg/include/agg_line_aa_basics.h --- mapnik-2.1.0/deps/agg/include/agg_line_aa_basics.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_line_aa_basics.h 2013-06-04 01:35:26.000000000 +0000 @@ -15,7 +15,7 @@ #ifndef AGG_LINE_AA_BASICS_INCLUDED #define AGG_LINE_AA_BASICS_INCLUDED -#include +#include #include "agg_basics.h" namespace agg diff -Nru mapnik-2.1.0/deps/agg/include/agg_math.h mapnik-2.2.0/deps/agg/include/agg_math.h --- mapnik-2.1.0/deps/agg/include/agg_math.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_math.h 2013-06-04 01:35:26.000000000 +0000 @@ -19,7 +19,7 @@ #ifndef AGG_MATH_INCLUDED #define AGG_MATH_INCLUDED -#include +#include #include "agg_basics.h" namespace agg diff -Nru mapnik-2.1.0/deps/agg/include/agg_path_storage.h mapnik-2.2.0/deps/agg/include/agg_path_storage.h --- mapnik-2.1.0/deps/agg/include/agg_path_storage.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_path_storage.h 2013-06-04 01:35:26.000000000 +0000 @@ -16,8 +16,8 @@ #ifndef AGG_PATH_STORAGE_INCLUDED #define AGG_PATH_STORAGE_INCLUDED -#include -#include +#include +#include #include "agg_math.h" #include "agg_array.h" #include "agg_bezier_arc.h" diff -Nru mapnik-2.1.0/deps/agg/include/agg_path_storage_integer.h mapnik-2.2.0/deps/agg/include/agg_path_storage_integer.h --- mapnik-2.1.0/deps/agg/include/agg_path_storage_integer.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_path_storage_integer.h 2013-06-04 01:35:26.000000000 +0000 @@ -16,7 +16,7 @@ #ifndef AGG_PATH_STORAGE_INTEGER_INCLUDED #define AGG_PATH_STORAGE_INTEGER_INCLUDED -#include +#include #include "agg_array.h" namespace agg diff -Nru mapnik-2.1.0/deps/agg/include/agg_pixfmt_amask_adaptor.h mapnik-2.2.0/deps/agg/include/agg_pixfmt_amask_adaptor.h --- mapnik-2.1.0/deps/agg/include/agg_pixfmt_amask_adaptor.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_pixfmt_amask_adaptor.h 2013-06-04 01:35:26.000000000 +0000 @@ -17,7 +17,7 @@ #define AGG_PIXFMT_AMASK_ADAPTOR_INCLUDED -#include +#include #include "agg_array.h" #include "agg_rendering_buffer.h" diff -Nru mapnik-2.1.0/deps/agg/include/agg_pixfmt_gray.h mapnik-2.2.0/deps/agg/include/agg_pixfmt_gray.h --- mapnik-2.1.0/deps/agg/include/agg_pixfmt_gray.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_pixfmt_gray.h 2013-06-04 01:35:26.000000000 +0000 @@ -24,7 +24,7 @@ #ifndef AGG_PIXFMT_GRAY_INCLUDED #define AGG_PIXFMT_GRAY_INCLUDED -#include +#include #include "agg_basics.h" #include "agg_color_gray.h" #include "agg_rendering_buffer.h" diff -Nru mapnik-2.1.0/deps/agg/include/agg_pixfmt_rgb.h mapnik-2.2.0/deps/agg/include/agg_pixfmt_rgb.h --- mapnik-2.1.0/deps/agg/include/agg_pixfmt_rgb.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_pixfmt_rgb.h 2013-06-04 01:35:26.000000000 +0000 @@ -24,7 +24,7 @@ #ifndef AGG_PIXFMT_RGB_INCLUDED #define AGG_PIXFMT_RGB_INCLUDED -#include +#include #include "agg_basics.h" #include "agg_color_rgba.h" #include "agg_rendering_buffer.h" diff -Nru mapnik-2.1.0/deps/agg/include/agg_pixfmt_rgb_packed.h mapnik-2.2.0/deps/agg/include/agg_pixfmt_rgb_packed.h --- mapnik-2.1.0/deps/agg/include/agg_pixfmt_rgb_packed.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_pixfmt_rgb_packed.h 2013-06-04 01:35:26.000000000 +0000 @@ -24,7 +24,7 @@ #ifndef AGG_PIXFMT_RGB_PACKED_INCLUDED #define AGG_PIXFMT_RGB_PACKED_INCLUDED -#include +#include #include "agg_basics.h" #include "agg_color_rgba.h" #include "agg_rendering_buffer.h" diff -Nru mapnik-2.1.0/deps/agg/include/agg_pixfmt_rgba.h mapnik-2.2.0/deps/agg/include/agg_pixfmt_rgba.h --- mapnik-2.1.0/deps/agg/include/agg_pixfmt_rgba.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_pixfmt_rgba.h 2013-06-04 01:35:26.000000000 +0000 @@ -25,17 +25,12 @@ #ifndef AGG_PIXFMT_RGBA_INCLUDED #define AGG_PIXFMT_RGBA_INCLUDED -#include -#include +#include +#include #include "agg_basics.h" #include "agg_color_rgba.h" #include "agg_rendering_buffer.h" -#include -#include - -#include - namespace agg { @@ -334,7 +329,7 @@ p[Order::R] = (value_type)(sr + ((p[Order::R] * s1a + base_mask) >> base_shift)); p[Order::G] = (value_type)(sg + ((p[Order::G] * s1a + base_mask) >> base_shift)); p[Order::B] = (value_type)(sb + ((p[Order::B] * s1a + base_mask) >> base_shift)); - p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift)); + p[Order::A] = (value_type)(sa + ((p[Order::A] * s1a + base_mask) >> base_shift)); } }; @@ -1570,36 +1565,9 @@ base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(value_type* p, + static void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) - { - if (cover < 255) - { - sr = (sr * cover + 255) >> 8; - sg = (sg * cover + 255) >> 8; - sb = (sb * cover + 255) >> 8; - sa = (sa * cover + 255) >> 8; - } - - if (sa > 0) - { - using namespace boost; - using namespace gil; - using namespace hsv_color_space; - rgb8_pixel_t rgb_src(sr,sg,sb); - rgb8_pixel_t rgb_dst(p[Order::R],p[Order::G],p[Order::B]); - hsv32f_pixel_t hsv_src,hsv_dst; - color_convert(rgb_src, hsv_src); - color_convert(rgb_dst, hsv_dst); - get_color(hsv_dst,hue_t()) = get_color(hsv_src,hue_t()); - color_convert(hsv_dst, rgb_dst); - p[Order::R] = get_color(rgb_dst,red_t()); - p[Order::G] = get_color(rgb_dst,green_t()); - p[Order::B] = get_color(rgb_dst,blue_t()); - p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift)); - } - } + unsigned sa, unsigned cover); }; template @@ -1616,36 +1584,9 @@ base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(value_type* p, + static void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) - { - if (cover < 255) - { - sr = (sr * cover + 255) >> 8; - sg = (sg * cover + 255) >> 8; - sb = (sb * cover + 255) >> 8; - sa = (sa * cover + 255) >> 8; - } - - if (sa > 0) - { - using namespace boost; - using namespace gil; - using namespace hsv_color_space; - rgb8_pixel_t rgb_src(sr,sg,sb); - rgb8_pixel_t rgb_dst(p[Order::R],p[Order::G],p[Order::B]); - hsv32f_pixel_t hsv_src,hsv_dst; - color_convert( rgb_src, hsv_src); - color_convert( rgb_dst, hsv_dst); - get_color(hsv_dst,saturation_t()) = get_color(hsv_src,saturation_t()); - color_convert(hsv_dst, rgb_dst); - p[Order::R] = get_color(rgb_dst,red_t()); - p[Order::G] = get_color(rgb_dst,green_t()); - p[Order::B] = get_color(rgb_dst,blue_t()); - p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift)); - } - } + unsigned sa, unsigned cover); }; template @@ -1662,37 +1603,9 @@ base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(value_type* p, + static void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) - { - if (cover < 255) - { - sr = (sr * cover + 255) >> 8; - sg = (sg * cover + 255) >> 8; - sb = (sb * cover + 255) >> 8; - sa = (sa * cover + 255) >> 8; - } - - if (sa > 0) - { - using namespace boost; - using namespace gil; - using namespace hsv_color_space; - rgb8_pixel_t rgb_src(sr,sg,sb); - rgb8_pixel_t rgb_dst(p[Order::R],p[Order::G],p[Order::B]); - hsv32f_pixel_t hsv_src,hsv_dst; - color_convert( rgb_src, hsv_src); - color_convert( rgb_dst, hsv_dst); - get_color(hsv_dst,hue_t()) = get_color(hsv_src,hue_t()); - get_color(hsv_dst,saturation_t()) = get_color(hsv_src,saturation_t()); - color_convert(hsv_dst, rgb_dst); - p[Order::R] = get_color(rgb_dst,red_t()); - p[Order::G] = get_color(rgb_dst,green_t()); - p[Order::B] = get_color(rgb_dst,blue_t()); - p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift)); - } - } + unsigned sa, unsigned cover); }; @@ -1710,36 +1623,9 @@ base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(value_type* p, + static void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) - { - if (cover < 255) - { - sr = (sr * cover + 255) >> 8; - sg = (sg * cover + 255) >> 8; - sb = (sb * cover + 255) >> 8; - sa = (sa * cover + 255) >> 8; - } - - if (sa > 0) - { - using namespace boost; - using namespace gil; - using namespace hsv_color_space; - rgb8_pixel_t rgb_src(sr,sg,sb); - rgb8_pixel_t rgb_dst(p[Order::R],p[Order::G],p[Order::B]); - hsv32f_pixel_t hsv_src,hsv_dst; - color_convert( rgb_src, hsv_src); - color_convert( rgb_dst, hsv_dst); - get_color(hsv_dst,value_t()) = get_color(hsv_src,value_t()); - color_convert(hsv_dst, rgb_dst); - p[Order::R] = get_color(rgb_dst,red_t()); - p[Order::G] = get_color(rgb_dst,green_t()); - p[Order::B] = get_color(rgb_dst,blue_t()); - p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift)); - } - } + unsigned sa, unsigned cover); }; //======================================================comp_op_table_rgba diff -Nru mapnik-2.1.0/deps/agg/include/agg_rasterizer_cells_aa.h mapnik-2.2.0/deps/agg/include/agg_rasterizer_cells_aa.h --- mapnik-2.1.0/deps/agg/include/agg_rasterizer_cells_aa.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_rasterizer_cells_aa.h 2013-06-04 01:35:26.000000000 +0000 @@ -29,7 +29,7 @@ #ifndef AGG_RASTERIZER_CELLS_AA_INCLUDED #define AGG_RASTERIZER_CELLS_AA_INCLUDED -#include +#include #include #include #include "agg_math.h" diff -Nru mapnik-2.1.0/deps/agg/include/agg_rendering_buffer.h mapnik-2.2.0/deps/agg/include/agg_rendering_buffer.h --- mapnik-2.1.0/deps/agg/include/agg_rendering_buffer.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_rendering_buffer.h 2013-06-04 01:35:26.000000000 +0000 @@ -128,7 +128,7 @@ private: //-------------------------------------------------------------------- - T* m_buf; // Pointer to renrdering buffer + T* m_buf; // Pointer to rendering buffer T* m_start; // Pointer to first pixel depending on stride unsigned m_width; // Width in pixels unsigned m_height; // Height in pixels @@ -258,7 +258,7 @@ private: //-------------------------------------------------------------------- - T* m_buf; // Pointer to renrdering buffer + T* m_buf; // Pointer to rendering buffer pod_array m_rows; // Pointers to each row of the buffer unsigned m_width; // Width in pixels unsigned m_height; // Height in pixels diff -Nru mapnik-2.1.0/deps/agg/include/agg_scanline_boolean_algebra.h mapnik-2.2.0/deps/agg/include/agg_scanline_boolean_algebra.h --- mapnik-2.1.0/deps/agg/include/agg_scanline_boolean_algebra.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_scanline_boolean_algebra.h 2013-06-04 01:35:26.000000000 +0000 @@ -16,8 +16,8 @@ #ifndef AGG_SCANLINE_BOOLEAN_ALGEBRA_INCLUDED #define AGG_SCANLINE_BOOLEAN_ALGEBRA_INCLUDED -#include -#include +#include +#include #include "agg_basics.h" diff -Nru mapnik-2.1.0/deps/agg/include/agg_scanline_storage_aa.h mapnik-2.2.0/deps/agg/include/agg_scanline_storage_aa.h --- mapnik-2.1.0/deps/agg/include/agg_scanline_storage_aa.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_scanline_storage_aa.h 2013-06-04 01:35:26.000000000 +0000 @@ -24,9 +24,9 @@ #ifndef AGG_SCANLINE_STORAGE_AA_INCLUDED #define AGG_SCANLINE_STORAGE_AA_INCLUDED -#include -#include -#include +#include +#include +#include #include "agg_array.h" diff -Nru mapnik-2.1.0/deps/agg/include/agg_scanline_storage_bin.h mapnik-2.2.0/deps/agg/include/agg_scanline_storage_bin.h --- mapnik-2.1.0/deps/agg/include/agg_scanline_storage_bin.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_scanline_storage_bin.h 2013-06-04 01:35:26.000000000 +0000 @@ -25,9 +25,9 @@ #ifndef AGG_SCANLINE_STORAGE_BIN_INCLUDED #define AGG_SCANLINE_STORAGE_BIN_INCLUDED -#include -#include -#include +#include +#include +#include #include "agg_array.h" diff -Nru mapnik-2.1.0/deps/agg/include/agg_simul_eq.h mapnik-2.2.0/deps/agg/include/agg_simul_eq.h --- mapnik-2.1.0/deps/agg/include/agg_simul_eq.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_simul_eq.h 2013-06-04 01:35:26.000000000 +0000 @@ -19,7 +19,7 @@ #ifndef AGG_SIMUL_EQ_INCLUDED #define AGG_SIMUL_EQ_INCLUDED -#include +#include #include "agg_basics.h" namespace agg diff -Nru mapnik-2.1.0/deps/agg/include/agg_span_gradient.h mapnik-2.2.0/deps/agg/include/agg_span_gradient.h --- mapnik-2.1.0/deps/agg/include/agg_span_gradient.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_span_gradient.h 2013-06-04 01:35:26.000000000 +0000 @@ -16,9 +16,9 @@ #ifndef AGG_SPAN_GRADIENT_INCLUDED #define AGG_SPAN_GRADIENT_INCLUDED -#include -#include -#include +#include +#include +#include #include "agg_basics.h" #include "agg_math.h" #include "agg_array.h" diff -Nru mapnik-2.1.0/deps/agg/include/agg_trans_affine.h mapnik-2.2.0/deps/agg/include/agg_trans_affine.h --- mapnik-2.1.0/deps/agg/include/agg_trans_affine.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_trans_affine.h 2013-06-04 01:35:26.000000000 +0000 @@ -19,7 +19,7 @@ #ifndef AGG_TRANS_AFFINE_INCLUDED #define AGG_TRANS_AFFINE_INCLUDED -#include +#include #include "agg_basics.h" namespace agg diff -Nru mapnik-2.1.0/deps/agg/include/agg_trans_lens.h mapnik-2.2.0/deps/agg/include/agg_trans_lens.h --- mapnik-2.1.0/deps/agg/include/agg_trans_lens.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_trans_lens.h 2013-06-04 01:35:26.000000000 +0000 @@ -16,7 +16,7 @@ #ifndef AGG_WARP_MAGNIFIER_INCLUDED #define AGG_WARP_MAGNIFIER_INCLUDED -#include +#include #include "agg_basics.h" diff -Nru mapnik-2.1.0/deps/agg/include/agg_trans_viewport.h mapnik-2.2.0/deps/agg/include/agg_trans_viewport.h --- mapnik-2.1.0/deps/agg/include/agg_trans_viewport.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_trans_viewport.h 2013-06-04 01:35:26.000000000 +0000 @@ -21,7 +21,7 @@ #ifndef AGG_TRANS_VIEWPORT_INCLUDED #define AGG_TRANS_VIEWPORT_INCLUDED -#include +#include #include "agg_trans_affine.h" diff -Nru mapnik-2.1.0/deps/agg/include/agg_vpgen_clip_polygon.h mapnik-2.2.0/deps/agg/include/agg_vpgen_clip_polygon.h --- mapnik-2.1.0/deps/agg/include/agg_vpgen_clip_polygon.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_vpgen_clip_polygon.h 2013-06-04 01:35:26.000000000 +0000 @@ -18,6 +18,9 @@ #include "agg_basics.h" +// https://github.com/mapnik/mapnik/issues/1860 +#include + namespace agg { @@ -25,7 +28,8 @@ // // See Implementation agg_vpgen_clip_polygon.cpp // - class vpgen_clip_polygon + + class MAPNIK_DECL vpgen_clip_polygon { public: vpgen_clip_polygon() : diff -Nru mapnik-2.1.0/deps/agg/include/agg_vpgen_clip_polyline.h mapnik-2.2.0/deps/agg/include/agg_vpgen_clip_polyline.h --- mapnik-2.1.0/deps/agg/include/agg_vpgen_clip_polyline.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_vpgen_clip_polyline.h 2013-06-04 01:35:26.000000000 +0000 @@ -18,6 +18,9 @@ #include "agg_basics.h" +// https://github.com/mapnik/mapnik/issues/1860 +#include + namespace agg { @@ -25,7 +28,7 @@ // // See Implementation agg_vpgen_clip_polyline.cpp // - class vpgen_clip_polyline + class MAPNIK_DECL vpgen_clip_polyline { public: vpgen_clip_polyline() : diff -Nru mapnik-2.1.0/deps/agg/include/agg_vpgen_segmentator.h mapnik-2.2.0/deps/agg/include/agg_vpgen_segmentator.h --- mapnik-2.1.0/deps/agg/include/agg_vpgen_segmentator.h 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/include/agg_vpgen_segmentator.h 2013-06-04 01:35:26.000000000 +0000 @@ -16,7 +16,7 @@ #ifndef AGG_VPGEN_SEGMENTATOR_INCLUDED #define AGG_VPGEN_SEGMENTATOR_INCLUDED -#include +#include #include "agg_basics.h" namespace agg diff -Nru mapnik-2.1.0/deps/agg/src/agg_arc.cpp mapnik-2.2.0/deps/agg/src/agg_arc.cpp --- mapnik-2.1.0/deps/agg/src/agg_arc.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_arc.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,84 +23,84 @@ namespace agg { - //------------------------------------------------------------------------ - arc::arc(double x, double y, - double rx, double ry, - double a1, double a2, - bool ccw) : - m_x(x), m_y(y), m_rx(rx), m_ry(ry), m_scale(1.0) - { - normalize(a1, a2, ccw); - } +//------------------------------------------------------------------------ +arc::arc(double x, double y, + double rx, double ry, + double a1, double a2, + bool ccw) : + m_x(x), m_y(y), m_rx(rx), m_ry(ry), m_scale(1.0) +{ + normalize(a1, a2, ccw); +} - //------------------------------------------------------------------------ - void arc::init(double x, double y, - double rx, double ry, - double a1, double a2, - bool ccw) - { - m_x = x; m_y = y; - m_rx = rx; m_ry = ry; - normalize(a1, a2, ccw); - } - - //------------------------------------------------------------------------ - void arc::approximation_scale(double s) +//------------------------------------------------------------------------ +void arc::init(double x, double y, + double rx, double ry, + double a1, double a2, + bool ccw) +{ + m_x = x; m_y = y; + m_rx = rx; m_ry = ry; + normalize(a1, a2, ccw); +} + +//------------------------------------------------------------------------ +void arc::approximation_scale(double s) +{ + m_scale = s; + if(m_initialized) { - m_scale = s; - if(m_initialized) - { - normalize(m_start, m_end, m_ccw); - } + normalize(m_start, m_end, m_ccw); } +} - //------------------------------------------------------------------------ - void arc::rewind(unsigned) +//------------------------------------------------------------------------ +void arc::rewind(unsigned) +{ + m_path_cmd = path_cmd_move_to; + m_angle = m_start; +} + +//------------------------------------------------------------------------ +unsigned arc::vertex(double* x, double* y) +{ + if(is_stop(m_path_cmd)) return path_cmd_stop; + if((m_angle < m_end - m_da/4) != m_ccw) { - m_path_cmd = path_cmd_move_to; - m_angle = m_start; + *x = m_x + cos(m_end) * m_rx; + *y = m_y + sin(m_end) * m_ry; + m_path_cmd = path_cmd_stop; + return path_cmd_line_to; } - //------------------------------------------------------------------------ - unsigned arc::vertex(double* x, double* y) + *x = m_x + cos(m_angle) * m_rx; + *y = m_y + sin(m_angle) * m_ry; + + m_angle += m_da; + + unsigned pf = m_path_cmd; + m_path_cmd = path_cmd_line_to; + return pf; +} + +//------------------------------------------------------------------------ +void arc::normalize(double a1, double a2, bool ccw) +{ + double ra = (fabs(m_rx) + fabs(m_ry)) / 2; + m_da = acos(ra / (ra + 0.125 / m_scale)) * 2; + if(ccw) { - if(is_stop(m_path_cmd)) return path_cmd_stop; - if((m_angle < m_end - m_da/4) != m_ccw) - { - *x = m_x + cos(m_end) * m_rx; - *y = m_y + sin(m_end) * m_ry; - m_path_cmd = path_cmd_stop; - return path_cmd_line_to; - } - - *x = m_x + cos(m_angle) * m_rx; - *y = m_y + sin(m_angle) * m_ry; - - m_angle += m_da; - - unsigned pf = m_path_cmd; - m_path_cmd = path_cmd_line_to; - return pf; + while(a2 < a1) a2 += pi * 2.0; } - - //------------------------------------------------------------------------ - void arc::normalize(double a1, double a2, bool ccw) + else { - double ra = (fabs(m_rx) + fabs(m_ry)) / 2; - m_da = acos(ra / (ra + 0.125 / m_scale)) * 2; - if(ccw) - { - while(a2 < a1) a2 += pi * 2.0; - } - else - { - while(a1 < a2) a1 += pi * 2.0; - m_da = -m_da; - } - m_ccw = ccw; - m_start = a1; - m_end = a2; - m_initialized = true; + while(a1 < a2) a1 += pi * 2.0; + m_da = -m_da; } + m_ccw = ccw; + m_start = a1; + m_end = a2; + m_initialized = true; +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_arrowhead.cpp mapnik-2.2.0/deps/agg/src/agg_arrowhead.cpp --- mapnik-2.1.0/deps/agg/src/agg_arrowhead.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_arrowhead.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,7 +13,7 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Simple arrowhead/arrowtail generator +// Simple arrowhead/arrowtail generator // //---------------------------------------------------------------------------- @@ -22,89 +22,89 @@ namespace agg { - //------------------------------------------------------------------------ - arrowhead::arrowhead() : - m_head_d1(1.0), - m_head_d2(1.0), - m_head_d3(1.0), - m_head_d4(0.0), - m_tail_d1(1.0), - m_tail_d2(1.0), - m_tail_d3(1.0), - m_tail_d4(0.0), - m_head_flag(false), - m_tail_flag(false), - m_curr_id(0), - m_curr_coord(0) - { - } +//------------------------------------------------------------------------ +arrowhead::arrowhead() : + m_head_d1(1.0), + m_head_d2(1.0), + m_head_d3(1.0), + m_head_d4(0.0), + m_tail_d1(1.0), + m_tail_d2(1.0), + m_tail_d3(1.0), + m_tail_d4(0.0), + m_head_flag(false), + m_tail_flag(false), + m_curr_id(0), + m_curr_coord(0) +{ +} - //------------------------------------------------------------------------ - void arrowhead::rewind(unsigned path_id) +//------------------------------------------------------------------------ +void arrowhead::rewind(unsigned path_id) +{ + m_curr_id = path_id; + m_curr_coord = 0; + if(path_id == 0) { - m_curr_id = path_id; - m_curr_coord = 0; - if(path_id == 0) + if(!m_tail_flag) { - if(!m_tail_flag) - { - m_cmd[0] = path_cmd_stop; - return; - } - m_coord[0] = m_tail_d1; m_coord[1] = 0.0; - m_coord[2] = m_tail_d1 - m_tail_d4; m_coord[3] = m_tail_d3; - m_coord[4] = -m_tail_d2 - m_tail_d4; m_coord[5] = m_tail_d3; - m_coord[6] = -m_tail_d2; m_coord[7] = 0.0; - m_coord[8] = -m_tail_d2 - m_tail_d4; m_coord[9] = -m_tail_d3; - m_coord[10] = m_tail_d1 - m_tail_d4; m_coord[11] = -m_tail_d3; - - m_cmd[0] = path_cmd_move_to; - m_cmd[1] = path_cmd_line_to; - m_cmd[2] = path_cmd_line_to; - m_cmd[3] = path_cmd_line_to; - m_cmd[4] = path_cmd_line_to; - m_cmd[5] = path_cmd_line_to; - m_cmd[7] = path_cmd_end_poly | path_flags_close | path_flags_ccw; - m_cmd[6] = path_cmd_stop; + m_cmd[0] = path_cmd_stop; return; } + m_coord[0] = m_tail_d1; m_coord[1] = 0.0; + m_coord[2] = m_tail_d1 - m_tail_d4; m_coord[3] = m_tail_d3; + m_coord[4] = -m_tail_d2 - m_tail_d4; m_coord[5] = m_tail_d3; + m_coord[6] = -m_tail_d2; m_coord[7] = 0.0; + m_coord[8] = -m_tail_d2 - m_tail_d4; m_coord[9] = -m_tail_d3; + m_coord[10] = m_tail_d1 - m_tail_d4; m_coord[11] = -m_tail_d3; + + m_cmd[0] = path_cmd_move_to; + m_cmd[1] = path_cmd_line_to; + m_cmd[2] = path_cmd_line_to; + m_cmd[3] = path_cmd_line_to; + m_cmd[4] = path_cmd_line_to; + m_cmd[5] = path_cmd_line_to; + m_cmd[7] = path_cmd_end_poly | path_flags_close | path_flags_ccw; + m_cmd[6] = path_cmd_stop; + return; + } - if(path_id == 1) + if(path_id == 1) + { + if(!m_head_flag) { - if(!m_head_flag) - { - m_cmd[0] = path_cmd_stop; - return; - } - m_coord[0] = -m_head_d1; m_coord[1] = 0.0; - m_coord[2] = m_head_d2 + m_head_d4; m_coord[3] = -m_head_d3; - m_coord[4] = m_head_d2; m_coord[5] = 0.0; - m_coord[6] = m_head_d2 + m_head_d4; m_coord[7] = m_head_d3; - - m_cmd[0] = path_cmd_move_to; - m_cmd[1] = path_cmd_line_to; - m_cmd[2] = path_cmd_line_to; - m_cmd[3] = path_cmd_line_to; - m_cmd[4] = path_cmd_end_poly | path_flags_close | path_flags_ccw; - m_cmd[5] = path_cmd_stop; + m_cmd[0] = path_cmd_stop; return; } + m_coord[0] = -m_head_d1; m_coord[1] = 0.0; + m_coord[2] = m_head_d2 + m_head_d4; m_coord[3] = -m_head_d3; + m_coord[4] = m_head_d2; m_coord[5] = 0.0; + m_coord[6] = m_head_d2 + m_head_d4; m_coord[7] = m_head_d3; + + m_cmd[0] = path_cmd_move_to; + m_cmd[1] = path_cmd_line_to; + m_cmd[2] = path_cmd_line_to; + m_cmd[3] = path_cmd_line_to; + m_cmd[4] = path_cmd_end_poly | path_flags_close | path_flags_ccw; + m_cmd[5] = path_cmd_stop; + return; } +} - //------------------------------------------------------------------------ - unsigned arrowhead::vertex(double* x, double* y) +//------------------------------------------------------------------------ +unsigned arrowhead::vertex(double* x, double* y) +{ + if(m_curr_id < 2) { - if(m_curr_id < 2) - { - unsigned curr_idx = m_curr_coord * 2; - *x = m_coord[curr_idx]; - *y = m_coord[curr_idx + 1]; - return m_cmd[m_curr_coord++]; - } - return path_cmd_stop; + unsigned curr_idx = m_curr_coord * 2; + *x = m_coord[curr_idx]; + *y = m_coord[curr_idx + 1]; + return m_cmd[m_curr_coord++]; } + return path_cmd_stop; +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_bezier_arc.cpp mapnik-2.2.0/deps/agg/src/agg_bezier_arc.cpp --- mapnik-2.1.0/deps/agg/src/agg_bezier_arc.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_bezier_arc.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,7 +13,7 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Arc generator. Produces at most 4 consecutive cubic bezier curves, i.e., +// Arc generator. Produces at most 4 consecutive cubic bezier curves, i.e., // 4, 7, 10, or 13 vertices. // //---------------------------------------------------------------------------- @@ -26,233 +26,233 @@ namespace agg { - // This epsilon is used to prevent us from adding degenerate curves - // (converging to a single point). - // The value isn't very critical. Function arc_to_bezier() has a limit - // of the sweep_angle. If fabs(sweep_angle) exceeds pi/2 the curve - // becomes inaccurate. But slight exceeding is quite appropriate. - //-------------------------------------------------bezier_arc_angle_epsilon - const double bezier_arc_angle_epsilon = 0.01; - - //------------------------------------------------------------arc_to_bezier - void arc_to_bezier(double cx, double cy, double rx, double ry, - double start_angle, double sweep_angle, - double* curve) - { - double x0 = cos(sweep_angle / 2.0); - double y0 = sin(sweep_angle / 2.0); - double tx = (1.0 - x0) * 4.0 / 3.0; - double ty = y0 - tx * x0 / y0; - double px[4]; - double py[4]; - px[0] = x0; - py[0] = -y0; - px[1] = x0 + tx; - py[1] = -ty; - px[2] = x0 + tx; - py[2] = ty; - px[3] = x0; - py[3] = y0; +// This epsilon is used to prevent us from adding degenerate curves +// (converging to a single point). +// The value isn't very critical. Function arc_to_bezier() has a limit +// of the sweep_angle. If fabs(sweep_angle) exceeds pi/2 the curve +// becomes inaccurate. But slight exceeding is quite appropriate. +//-------------------------------------------------bezier_arc_angle_epsilon +const double bezier_arc_angle_epsilon = 0.01; + +//------------------------------------------------------------arc_to_bezier +void arc_to_bezier(double cx, double cy, double rx, double ry, + double start_angle, double sweep_angle, + double* curve) +{ + double x0 = cos(sweep_angle / 2.0); + double y0 = sin(sweep_angle / 2.0); + double tx = (1.0 - x0) * 4.0 / 3.0; + double ty = y0 - tx * x0 / y0; + double px[4]; + double py[4]; + px[0] = x0; + py[0] = -y0; + px[1] = x0 + tx; + py[1] = -ty; + px[2] = x0 + tx; + py[2] = ty; + px[3] = x0; + py[3] = y0; - double sn = sin(start_angle + sweep_angle / 2.0); - double cs = cos(start_angle + sweep_angle / 2.0); + double sn = sin(start_angle + sweep_angle / 2.0); + double cs = cos(start_angle + sweep_angle / 2.0); - unsigned i; - for(i = 0; i < 4; i++) - { - curve[i * 2] = cx + rx * (px[i] * cs - py[i] * sn); - curve[i * 2 + 1] = cy + ry * (px[i] * sn + py[i] * cs); - } + unsigned i; + for(i = 0; i < 4; i++) + { + curve[i * 2] = cx + rx * (px[i] * cs - py[i] * sn); + curve[i * 2 + 1] = cy + ry * (px[i] * sn + py[i] * cs); } +} - //------------------------------------------------------------------------ - void bezier_arc::init(double x, double y, - double rx, double ry, - double start_angle, - double sweep_angle) - { - start_angle = fmod(start_angle, 2.0 * pi); - if(sweep_angle >= 2.0 * pi) sweep_angle = 2.0 * pi; - if(sweep_angle <= -2.0 * pi) sweep_angle = -2.0 * pi; +//------------------------------------------------------------------------ +void bezier_arc::init(double x, double y, + double rx, double ry, + double start_angle, + double sweep_angle) +{ + start_angle = fmod(start_angle, 2.0 * pi); + if(sweep_angle >= 2.0 * pi) sweep_angle = 2.0 * pi; + if(sweep_angle <= -2.0 * pi) sweep_angle = -2.0 * pi; - if(fabs(sweep_angle) < 1e-10) - { - m_num_vertices = 4; - m_cmd = path_cmd_line_to; - m_vertices[0] = x + rx * cos(start_angle); - m_vertices[1] = y + ry * sin(start_angle); - m_vertices[2] = x + rx * cos(start_angle + sweep_angle); - m_vertices[3] = y + ry * sin(start_angle + sweep_angle); - return; - } + if(fabs(sweep_angle) < 1e-10) + { + m_num_vertices = 4; + m_cmd = path_cmd_line_to; + m_vertices[0] = x + rx * cos(start_angle); + m_vertices[1] = y + ry * sin(start_angle); + m_vertices[2] = x + rx * cos(start_angle + sweep_angle); + m_vertices[3] = y + ry * sin(start_angle + sweep_angle); + return; + } - double total_sweep = 0.0; - double local_sweep = 0.0; - double prev_sweep; - m_num_vertices = 2; - m_cmd = path_cmd_curve4; - bool done = false; - do + double total_sweep = 0.0; + double local_sweep = 0.0; + double prev_sweep; + m_num_vertices = 2; + m_cmd = path_cmd_curve4; + bool done = false; + do + { + if(sweep_angle < 0.0) { - if(sweep_angle < 0.0) + prev_sweep = total_sweep; + local_sweep = -pi * 0.5; + total_sweep -= pi * 0.5; + if(total_sweep <= sweep_angle + bezier_arc_angle_epsilon) { - prev_sweep = total_sweep; - local_sweep = -pi * 0.5; - total_sweep -= pi * 0.5; - if(total_sweep <= sweep_angle + bezier_arc_angle_epsilon) - { - local_sweep = sweep_angle - prev_sweep; - done = true; - } + local_sweep = sweep_angle - prev_sweep; + done = true; } - else + } + else + { + prev_sweep = total_sweep; + local_sweep = pi * 0.5; + total_sweep += pi * 0.5; + if(total_sweep >= sweep_angle - bezier_arc_angle_epsilon) { - prev_sweep = total_sweep; - local_sweep = pi * 0.5; - total_sweep += pi * 0.5; - if(total_sweep >= sweep_angle - bezier_arc_angle_epsilon) - { - local_sweep = sweep_angle - prev_sweep; - done = true; - } + local_sweep = sweep_angle - prev_sweep; + done = true; } + } - arc_to_bezier(x, y, rx, ry, - start_angle, - local_sweep, - m_vertices + m_num_vertices - 2); + arc_to_bezier(x, y, rx, ry, + start_angle, + local_sweep, + m_vertices + m_num_vertices - 2); - m_num_vertices += 6; - start_angle += local_sweep; - } - while(!done && m_num_vertices < 26); + m_num_vertices += 6; + start_angle += local_sweep; } + while(!done && m_num_vertices < 26); +} - //-------------------------------------------------------------------- - void bezier_arc_svg::init(double x0, double y0, - double rx, double ry, - double angle, - bool large_arc_flag, - bool sweep_flag, - double x2, double y2) - { - m_radii_ok = true; +//-------------------------------------------------------------------- +void bezier_arc_svg::init(double x0, double y0, + double rx, double ry, + double angle, + bool large_arc_flag, + bool sweep_flag, + double x2, double y2) +{ + m_radii_ok = true; - if(rx < 0.0) rx = -rx; - if(ry < 0.0) ry = -rx; + if(rx < 0.0) rx = -rx; + if(ry < 0.0) ry = -rx; - // Calculate the middle point between - // the current and the final points - //------------------------ - double dx2 = (x0 - x2) / 2.0; - double dy2 = (y0 - y2) / 2.0; - - double cos_a = cos(angle); - double sin_a = sin(angle); - - // Calculate (x1, y1) - //------------------------ - double x1 = cos_a * dx2 + sin_a * dy2; - double y1 = -sin_a * dx2 + cos_a * dy2; - - // Ensure radii are large enough - //------------------------ - double prx = rx * rx; - double pry = ry * ry; - double px1 = x1 * x1; - double py1 = y1 * y1; - - // Check that radii are large enough - //------------------------ - double radii_check = px1/prx + py1/pry; - if(radii_check > 1.0) - { - rx = sqrt(radii_check) * rx; - ry = sqrt(radii_check) * ry; - prx = rx * rx; - pry = ry * ry; - if(radii_check > 10.0) m_radii_ok = false; - } + // Calculate the middle point between + // the current and the final points + //------------------------ + double dx2 = (x0 - x2) / 2.0; + double dy2 = (y0 - y2) / 2.0; + + double cos_a = cos(angle); + double sin_a = sin(angle); + + // Calculate (x1, y1) + //------------------------ + double x1 = cos_a * dx2 + sin_a * dy2; + double y1 = -sin_a * dx2 + cos_a * dy2; + + // Ensure radii are large enough + //------------------------ + double prx = rx * rx; + double pry = ry * ry; + double px1 = x1 * x1; + double py1 = y1 * y1; + + // Check that radii are large enough + //------------------------ + double radii_check = px1/prx + py1/pry; + if(radii_check > 1.0) + { + rx = sqrt(radii_check) * rx; + ry = sqrt(radii_check) * ry; + prx = rx * rx; + pry = ry * ry; + if(radii_check > 10.0) m_radii_ok = false; + } - // Calculate (cx1, cy1) - //------------------------ - double sign = (large_arc_flag == sweep_flag) ? -1.0 : 1.0; - double sq = (prx*pry - prx*py1 - pry*px1) / (prx*py1 + pry*px1); - double coef = sign * sqrt((sq < 0) ? 0 : sq); - double cx1 = coef * ((rx * y1) / ry); - double cy1 = coef * -((ry * x1) / rx); - - // - // Calculate (cx, cy) from (cx1, cy1) - //------------------------ - double sx2 = (x0 + x2) / 2.0; - double sy2 = (y0 + y2) / 2.0; - double cx = sx2 + (cos_a * cx1 - sin_a * cy1); - double cy = sy2 + (sin_a * cx1 + cos_a * cy1); - - // Calculate the start_angle (angle1) and the sweep_angle (dangle) - //------------------------ - double ux = (x1 - cx1) / rx; - double uy = (y1 - cy1) / ry; - double vx = (-x1 - cx1) / rx; - double vy = (-y1 - cy1) / ry; - double p, n; - - // Calculate the angle start - //------------------------ - n = sqrt(ux*ux + uy*uy); - p = ux; // (1 * ux) + (0 * uy) - sign = (uy < 0) ? -1.0 : 1.0; - double v = p / n; - if(v < -1.0) v = -1.0; - if(v > 1.0) v = 1.0; - double start_angle = sign * acos(v); - - // Calculate the sweep angle - //------------------------ - n = sqrt((ux*ux + uy*uy) * (vx*vx + vy*vy)); - p = ux * vx + uy * vy; - sign = (ux * vy - uy * vx < 0) ? -1.0 : 1.0; - v = p / n; - if(v < -1.0) v = -1.0; - if(v > 1.0) v = 1.0; - double sweep_angle = sign * acos(v); - if(!sweep_flag && sweep_angle > 0) - { - sweep_angle -= pi * 2.0; - } - else - if (sweep_flag && sweep_angle < 0) + // Calculate (cx1, cy1) + //------------------------ + double sign = (large_arc_flag == sweep_flag) ? -1.0 : 1.0; + double sq = (prx*pry - prx*py1 - pry*px1) / (prx*py1 + pry*px1); + double coef = sign * sqrt((sq < 0) ? 0 : sq); + double cx1 = coef * ((rx * y1) / ry); + double cy1 = coef * -((ry * x1) / rx); + + // + // Calculate (cx, cy) from (cx1, cy1) + //------------------------ + double sx2 = (x0 + x2) / 2.0; + double sy2 = (y0 + y2) / 2.0; + double cx = sx2 + (cos_a * cx1 - sin_a * cy1); + double cy = sy2 + (sin_a * cx1 + cos_a * cy1); + + // Calculate the start_angle (angle1) and the sweep_angle (dangle) + //------------------------ + double ux = (x1 - cx1) / rx; + double uy = (y1 - cy1) / ry; + double vx = (-x1 - cx1) / rx; + double vy = (-y1 - cy1) / ry; + double p, n; + + // Calculate the angle start + //------------------------ + n = sqrt(ux*ux + uy*uy); + p = ux; // (1 * ux) + (0 * uy) + sign = (uy < 0) ? -1.0 : 1.0; + double v = p / n; + if(v < -1.0) v = -1.0; + if(v > 1.0) v = 1.0; + double start_angle = sign * acos(v); + + // Calculate the sweep angle + //------------------------ + n = sqrt((ux*ux + uy*uy) * (vx*vx + vy*vy)); + p = ux * vx + uy * vy; + sign = (ux * vy - uy * vx < 0) ? -1.0 : 1.0; + v = p / n; + if(v < -1.0) v = -1.0; + if(v > 1.0) v = 1.0; + double sweep_angle = sign * acos(v); + if(!sweep_flag && sweep_angle > 0) + { + sweep_angle -= pi * 2.0; + } + else + if (sweep_flag && sweep_angle < 0) { sweep_angle += pi * 2.0; } - // We can now build and transform the resulting arc - //------------------------ - m_arc.init(0.0, 0.0, rx, ry, start_angle, sweep_angle); - trans_affine mtx = trans_affine_rotation(angle); - mtx *= trans_affine_translation(cx, cy); - - for(unsigned i = 2; i < m_arc.num_vertices()-2; i += 2) - { - mtx.transform(m_arc.vertices() + i, m_arc.vertices() + i + 1); - } + // We can now build and transform the resulting arc + //------------------------ + m_arc.init(0.0, 0.0, rx, ry, start_angle, sweep_angle); + trans_affine mtx = trans_affine_rotation(angle); + mtx *= trans_affine_translation(cx, cy); - // We must make sure that the starting and ending points - // exactly coincide with the initial (x0,y0) and (x2,y2) - m_arc.vertices()[0] = x0; - m_arc.vertices()[1] = y0; - if(m_arc.num_vertices() > 2) - { - m_arc.vertices()[m_arc.num_vertices() - 2] = x2; - m_arc.vertices()[m_arc.num_vertices() - 1] = y2; - } + for(unsigned i = 2; i < m_arc.num_vertices()-2; i += 2) + { + mtx.transform(m_arc.vertices() + i, m_arc.vertices() + i + 1); } + // We must make sure that the starting and ending points + // exactly coincide with the initial (x0,y0) and (x2,y2) + m_arc.vertices()[0] = x0; + m_arc.vertices()[1] = y0; + if(m_arc.num_vertices() > 2) + { + m_arc.vertices()[m_arc.num_vertices() - 2] = x2; + m_arc.vertices()[m_arc.num_vertices() - 1] = y2; + } +} + } diff -Nru mapnik-2.1.0/deps/agg/src/agg_bspline.cpp mapnik-2.2.0/deps/agg/src/agg_bspline.cpp --- mapnik-2.1.0/deps/agg/src/agg_bspline.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_bspline.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -21,242 +21,242 @@ namespace agg { - //------------------------------------------------------------------------ - bspline::bspline() : - m_max(0), - m_num(0), - m_x(0), - m_y(0), - m_last_idx(-1) - { - } +//------------------------------------------------------------------------ +bspline::bspline() : + m_max(0), + m_num(0), + m_x(0), + m_y(0), + m_last_idx(-1) +{ +} - //------------------------------------------------------------------------ - bspline::bspline(int num) : - m_max(0), - m_num(0), - m_x(0), - m_y(0), - m_last_idx(-1) - { - init(num); - } +//------------------------------------------------------------------------ +bspline::bspline(int num) : + m_max(0), + m_num(0), + m_x(0), + m_y(0), + m_last_idx(-1) +{ + init(num); +} + +//------------------------------------------------------------------------ +bspline::bspline(int num, const double* x, const double* y) : + m_max(0), + m_num(0), + m_x(0), + m_y(0), + m_last_idx(-1) +{ + init(num, x, y); +} - //------------------------------------------------------------------------ - bspline::bspline(int num, const double* x, const double* y) : - m_max(0), - m_num(0), - m_x(0), - m_y(0), - m_last_idx(-1) - { - init(num, x, y); - } - - //------------------------------------------------------------------------ - void bspline::init(int max) +//------------------------------------------------------------------------ +void bspline::init(int max) +{ + if(max > 2 && max > m_max) { - if(max > 2 && max > m_max) - { - m_am.resize(max * 3); - m_max = max; - m_x = &m_am[m_max]; - m_y = &m_am[m_max * 2]; - } - m_num = 0; - m_last_idx = -1; + m_am.resize(max * 3); + m_max = max; + m_x = &m_am[m_max]; + m_y = &m_am[m_max * 2]; } + m_num = 0; + m_last_idx = -1; +} - //------------------------------------------------------------------------ - void bspline::add_point(double x, double y) +//------------------------------------------------------------------------ +void bspline::add_point(double x, double y) +{ + if(m_num < m_max) { - if(m_num < m_max) - { - m_x[m_num] = x; - m_y[m_num] = y; - ++m_num; - } + m_x[m_num] = x; + m_y[m_num] = y; + ++m_num; } +} - //------------------------------------------------------------------------ - void bspline::prepare() +//------------------------------------------------------------------------ +void bspline::prepare() +{ + if(m_num > 2) { - if(m_num > 2) + int i, k, n1; + double* temp; + double* r; + double* s; + double h, p, d, f, e; + + for(k = 0; k < m_num; k++) { - int i, k, n1; - double* temp; - double* r; - double* s; - double h, p, d, f, e; - - for(k = 0; k < m_num; k++) - { - m_am[k] = 0.0; - } + m_am[k] = 0.0; + } - n1 = 3 * m_num; + n1 = 3 * m_num; - pod_array al(n1); - temp = &al[0]; + pod_array al(n1); + temp = &al[0]; - for(k = 0; k < n1; k++) - { - temp[k] = 0.0; - } + for(k = 0; k < n1; k++) + { + temp[k] = 0.0; + } - r = temp + m_num; - s = temp + m_num * 2; + r = temp + m_num; + s = temp + m_num * 2; - n1 = m_num - 1; - d = m_x[1] - m_x[0]; - e = (m_y[1] - m_y[0]) / d; + n1 = m_num - 1; + d = m_x[1] - m_x[0]; + e = (m_y[1] - m_y[0]) / d; - for(k = 1; k < n1; k++) - { - h = d; - d = m_x[k + 1] - m_x[k]; - f = e; - e = (m_y[k + 1] - m_y[k]) / d; - al[k] = d / (d + h); - r[k] = 1.0 - al[k]; - s[k] = 6.0 * (e - f) / (h + d); - } + for(k = 1; k < n1; k++) + { + h = d; + d = m_x[k + 1] - m_x[k]; + f = e; + e = (m_y[k + 1] - m_y[k]) / d; + al[k] = d / (d + h); + r[k] = 1.0 - al[k]; + s[k] = 6.0 * (e - f) / (h + d); + } - for(k = 1; k < n1; k++) - { - p = 1.0 / (r[k] * al[k - 1] + 2.0); - al[k] *= -p; - s[k] = (s[k] - r[k] * s[k - 1]) * p; - } + for(k = 1; k < n1; k++) + { + p = 1.0 / (r[k] * al[k - 1] + 2.0); + al[k] *= -p; + s[k] = (s[k] - r[k] * s[k - 1]) * p; + } - m_am[n1] = 0.0; - al[n1 - 1] = s[n1 - 1]; - m_am[n1 - 1] = al[n1 - 1]; + m_am[n1] = 0.0; + al[n1 - 1] = s[n1 - 1]; + m_am[n1 - 1] = al[n1 - 1]; - for(k = n1 - 2, i = 0; i < m_num - 2; i++, k--) - { - al[k] = al[k] * al[k + 1] + s[k]; - m_am[k] = al[k]; - } + for(k = n1 - 2, i = 0; i < m_num - 2; i++, k--) + { + al[k] = al[k] * al[k + 1] + s[k]; + m_am[k] = al[k]; } - m_last_idx = -1; } + m_last_idx = -1; +} - //------------------------------------------------------------------------ - void bspline::init(int num, const double* x, const double* y) +//------------------------------------------------------------------------ +void bspline::init(int num, const double* x, const double* y) +{ + if(num > 2) { - if(num > 2) + init(num); + int i; + for(i = 0; i < num; i++) { - init(num); - int i; - for(i = 0; i < num; i++) - { - add_point(*x++, *y++); - } - prepare(); + add_point(*x++, *y++); } - m_last_idx = -1; + prepare(); } + m_last_idx = -1; +} - //------------------------------------------------------------------------ - void bspline::bsearch(int n, const double *x, double x0, int *i) +//------------------------------------------------------------------------ +void bspline::bsearch(int n, const double *x, double x0, int *i) +{ + int j = n - 1; + int k; + + for(*i = 0; (j - *i) > 1; ) { - int j = n - 1; - int k; - - for(*i = 0; (j - *i) > 1; ) - { - if(x0 < x[k = (*i + j) >> 1]) j = k; - else *i = k; - } + if(x0 < x[k = (*i + j) >> 1]) j = k; + else *i = k; } +} - //------------------------------------------------------------------------ - double bspline::interpolation(double x, int i) const - { - int j = i + 1; - double d = m_x[i] - m_x[j]; - double h = x - m_x[j]; - double r = m_x[i] - x; - double p = d * d / 6.0; - return (m_am[j] * r * r * r + m_am[i] * h * h * h) / 6.0 / d + - ((m_y[j] - m_am[j] * p) * r + (m_y[i] - m_am[i] * p) * h) / d; - } +//------------------------------------------------------------------------ +double bspline::interpolation(double x, int i) const +{ + int j = i + 1; + double d = m_x[i] - m_x[j]; + double h = x - m_x[j]; + double r = m_x[i] - x; + double p = d * d / 6.0; + return (m_am[j] * r * r * r + m_am[i] * h * h * h) / 6.0 / d + + ((m_y[j] - m_am[j] * p) * r + (m_y[i] - m_am[i] * p) * h) / d; +} - //------------------------------------------------------------------------ - double bspline::extrapolation_left(double x) const - { - double d = m_x[1] - m_x[0]; - return (-d * m_am[1] / 6 + (m_y[1] - m_y[0]) / d) * - (x - m_x[0]) + - m_y[0]; - } +//------------------------------------------------------------------------ +double bspline::extrapolation_left(double x) const +{ + double d = m_x[1] - m_x[0]; + return (-d * m_am[1] / 6 + (m_y[1] - m_y[0]) / d) * + (x - m_x[0]) + + m_y[0]; +} - //------------------------------------------------------------------------ - double bspline::extrapolation_right(double x) const - { - double d = m_x[m_num - 1] - m_x[m_num - 2]; - return (d * m_am[m_num - 2] / 6 + (m_y[m_num - 1] - m_y[m_num - 2]) / d) * - (x - m_x[m_num - 1]) + - m_y[m_num - 1]; - } +//------------------------------------------------------------------------ +double bspline::extrapolation_right(double x) const +{ + double d = m_x[m_num - 1] - m_x[m_num - 2]; + return (d * m_am[m_num - 2] / 6 + (m_y[m_num - 1] - m_y[m_num - 2]) / d) * + (x - m_x[m_num - 1]) + + m_y[m_num - 1]; +} - //------------------------------------------------------------------------ - double bspline::get(double x) const +//------------------------------------------------------------------------ +double bspline::get(double x) const +{ + if(m_num > 2) { - if(m_num > 2) - { - int i; + int i; - // Extrapolation on the left - if(x < m_x[0]) return extrapolation_left(x); + // Extrapolation on the left + if(x < m_x[0]) return extrapolation_left(x); - // Extrapolation on the right - if(x >= m_x[m_num - 1]) return extrapolation_right(x); + // Extrapolation on the right + if(x >= m_x[m_num - 1]) return extrapolation_right(x); - // Interpolation - bsearch(m_num, m_x, x, &i); - return interpolation(x, i); - } - return 0.0; + // Interpolation + bsearch(m_num, m_x, x, &i); + return interpolation(x, i); } + return 0.0; +} - //------------------------------------------------------------------------ - double bspline::get_stateful(double x) const +//------------------------------------------------------------------------ +double bspline::get_stateful(double x) const +{ + if(m_num > 2) { - if(m_num > 2) - { - // Extrapolation on the left - if(x < m_x[0]) return extrapolation_left(x); + // Extrapolation on the left + if(x < m_x[0]) return extrapolation_left(x); - // Extrapolation on the right - if(x >= m_x[m_num - 1]) return extrapolation_right(x); + // Extrapolation on the right + if(x >= m_x[m_num - 1]) return extrapolation_right(x); - if(m_last_idx >= 0) + if(m_last_idx >= 0) + { + // Check if x is not in current range + if(x < m_x[m_last_idx] || x > m_x[m_last_idx + 1]) { - // Check if x is not in current range - if(x < m_x[m_last_idx] || x > m_x[m_last_idx + 1]) + // Check if x between next points (most probably) + if(m_last_idx < m_num - 2 && + x >= m_x[m_last_idx + 1] && + x <= m_x[m_last_idx + 2]) { - // Check if x between next points (most probably) - if(m_last_idx < m_num - 2 && - x >= m_x[m_last_idx + 1] && - x <= m_x[m_last_idx + 2]) - { - ++m_last_idx; - } - else - if(m_last_idx > 0 && - x >= m_x[m_last_idx - 1] && + ++m_last_idx; + } + else + if(m_last_idx > 0 && + x >= m_x[m_last_idx - 1] && x <= m_x[m_last_idx]) { // x is between pevious points @@ -267,18 +267,18 @@ // Else perform full search bsearch(m_num, m_x, x, &m_last_idx); } - } - return interpolation(x, m_last_idx); - } - else - { - // Interpolation - bsearch(m_num, m_x, x, &m_last_idx); - return interpolation(x, m_last_idx); } + return interpolation(x, m_last_idx); + } + else + { + // Interpolation + bsearch(m_num, m_x, x, &m_last_idx); + return interpolation(x, m_last_idx); } - return 0.0; } + return 0.0; +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_curves.cpp mapnik-2.2.0/deps/agg/src/agg_curves.cpp --- mapnik-2.1.0/deps/agg/src/agg_curves.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_curves.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -20,594 +20,594 @@ namespace agg { - //------------------------------------------------------------------------ - const double curve_distance_epsilon = 1e-30; - const double curve_collinearity_epsilon = 1e-30; - const double curve_angle_tolerance_epsilon = 0.01; - enum curve_recursion_limit_e { curve_recursion_limit = 32 }; +//------------------------------------------------------------------------ +const double curve_distance_epsilon = 1e-30; +const double curve_collinearity_epsilon = 1e-30; +const double curve_angle_tolerance_epsilon = 0.01; +enum curve_recursion_limit_e { curve_recursion_limit = 32 }; - //------------------------------------------------------------------------ - void curve3_inc::approximation_scale(double s) - { - m_scale = s; - } +//------------------------------------------------------------------------ +void curve3_inc::approximation_scale(double s) +{ + m_scale = s; +} - //------------------------------------------------------------------------ - double curve3_inc::approximation_scale() const - { - return m_scale; - } +//------------------------------------------------------------------------ +double curve3_inc::approximation_scale() const +{ + return m_scale; +} - //------------------------------------------------------------------------ - void curve3_inc::init(double x1, double y1, - double x2, double y2, - double x3, double y3) - { - m_start_x = x1; - m_start_y = y1; - m_end_x = x3; - m_end_y = y3; +//------------------------------------------------------------------------ +void curve3_inc::init(double x1, double y1, + double x2, double y2, + double x3, double y3) +{ + m_start_x = x1; + m_start_y = y1; + m_end_x = x3; + m_end_y = y3; - double dx1 = x2 - x1; - double dy1 = y2 - y1; - double dx2 = x3 - x2; - double dy2 = y3 - y2; + double dx1 = x2 - x1; + double dy1 = y2 - y1; + double dx2 = x3 - x2; + double dy2 = y3 - y2; - double len = sqrt(dx1 * dx1 + dy1 * dy1) + sqrt(dx2 * dx2 + dy2 * dy2); + double len = sqrt(dx1 * dx1 + dy1 * dy1) + sqrt(dx2 * dx2 + dy2 * dy2); - m_num_steps = uround(len * 0.25 * m_scale); + m_num_steps = uround(len * 0.25 * m_scale); - if(m_num_steps < 4) - { - m_num_steps = 4; - } + if(m_num_steps < 4) + { + m_num_steps = 4; + } + + double subdivide_step = 1.0 / m_num_steps; + double subdivide_step2 = subdivide_step * subdivide_step; - double subdivide_step = 1.0 / m_num_steps; - double subdivide_step2 = subdivide_step * subdivide_step; + double tmpx = (x1 - x2 * 2.0 + x3) * subdivide_step2; + double tmpy = (y1 - y2 * 2.0 + y3) * subdivide_step2; - double tmpx = (x1 - x2 * 2.0 + x3) * subdivide_step2; - double tmpy = (y1 - y2 * 2.0 + y3) * subdivide_step2; + m_saved_fx = m_fx = x1; + m_saved_fy = m_fy = y1; - m_saved_fx = m_fx = x1; - m_saved_fy = m_fy = y1; - - m_saved_dfx = m_dfx = tmpx + (x2 - x1) * (2.0 * subdivide_step); - m_saved_dfy = m_dfy = tmpy + (y2 - y1) * (2.0 * subdivide_step); + m_saved_dfx = m_dfx = tmpx + (x2 - x1) * (2.0 * subdivide_step); + m_saved_dfy = m_dfy = tmpy + (y2 - y1) * (2.0 * subdivide_step); - m_ddfx = tmpx * 2.0; - m_ddfy = tmpy * 2.0; + m_ddfx = tmpx * 2.0; + m_ddfy = tmpy * 2.0; - m_step = m_num_steps; + m_step = m_num_steps; +} + +//------------------------------------------------------------------------ +void curve3_inc::rewind(unsigned) +{ + if(m_num_steps == 0) + { + m_step = -1; + return; } + m_step = m_num_steps; + m_fx = m_saved_fx; + m_fy = m_saved_fy; + m_dfx = m_saved_dfx; + m_dfy = m_saved_dfy; +} - //------------------------------------------------------------------------ - void curve3_inc::rewind(unsigned) +//------------------------------------------------------------------------ +unsigned curve3_inc::vertex(double* x, double* y) +{ + if(m_step < 0) return path_cmd_stop; + if(m_step == m_num_steps) { - if(m_num_steps == 0) - { - m_step = -1; - return; - } - m_step = m_num_steps; - m_fx = m_saved_fx; - m_fy = m_saved_fy; - m_dfx = m_saved_dfx; - m_dfy = m_saved_dfy; - } - - //------------------------------------------------------------------------ - unsigned curve3_inc::vertex(double* x, double* y) - { - if(m_step < 0) return path_cmd_stop; - if(m_step == m_num_steps) - { - *x = m_start_x; - *y = m_start_y; - --m_step; - return path_cmd_move_to; - } - if(m_step == 0) - { - *x = m_end_x; - *y = m_end_y; - --m_step; - return path_cmd_line_to; - } - m_fx += m_dfx; - m_fy += m_dfy; - m_dfx += m_ddfx; - m_dfy += m_ddfy; - *x = m_fx; - *y = m_fy; + *x = m_start_x; + *y = m_start_y; + --m_step; + return path_cmd_move_to; + } + if(m_step == 0) + { + *x = m_end_x; + *y = m_end_y; --m_step; return path_cmd_line_to; } + m_fx += m_dfx; + m_fy += m_dfy; + m_dfx += m_ddfx; + m_dfy += m_ddfy; + *x = m_fx; + *y = m_fy; + --m_step; + return path_cmd_line_to; +} - //------------------------------------------------------------------------ - void curve3_div::init(double x1, double y1, - double x2, double y2, - double x3, double y3) - { - m_points.remove_all(); - m_distance_tolerance_square = 0.5 / m_approximation_scale; - m_distance_tolerance_square *= m_distance_tolerance_square; - bezier(x1, y1, x2, y2, x3, y3); - m_count = 0; - } - - //------------------------------------------------------------------------ - void curve3_div::recursive_bezier(double x1, double y1, - double x2, double y2, - double x3, double y3, - unsigned level) +//------------------------------------------------------------------------ +void curve3_div::init(double x1, double y1, + double x2, double y2, + double x3, double y3) +{ + m_points.remove_all(); + m_distance_tolerance_square = 0.5 / m_approximation_scale; + m_distance_tolerance_square *= m_distance_tolerance_square; + bezier(x1, y1, x2, y2, x3, y3); + m_count = 0; +} + +//------------------------------------------------------------------------ +void curve3_div::recursive_bezier(double x1, double y1, + double x2, double y2, + double x3, double y3, + unsigned level) +{ + if(level > curve_recursion_limit) { - if(level > curve_recursion_limit) - { - return; - } + return; + } - // Calculate all the mid-points of the line segments - //---------------------- - double x12 = (x1 + x2) / 2; - double y12 = (y1 + y2) / 2; - double x23 = (x2 + x3) / 2; - double y23 = (y2 + y3) / 2; - double x123 = (x12 + x23) / 2; - double y123 = (y12 + y23) / 2; - - double dx = x3-x1; - double dy = y3-y1; - double d = fabs(((x2 - x3) * dy - (y2 - y3) * dx)); - double da; - - if(d > curve_collinearity_epsilon) - { - // Regular case - //----------------- - if(d * d <= m_distance_tolerance_square * (dx*dx + dy*dy)) - { - // If the curvature doesn't exceed the distance_tolerance value - // we tend to finish subdivisions. - //---------------------- - if(m_angle_tolerance < curve_angle_tolerance_epsilon) - { - m_points.add(point_d(x123, y123)); - return; - } + // Calculate all the mid-points of the line segments + //---------------------- + double x12 = (x1 + x2) / 2; + double y12 = (y1 + y2) / 2; + double x23 = (x2 + x3) / 2; + double y23 = (y2 + y3) / 2; + double x123 = (x12 + x23) / 2; + double y123 = (y12 + y23) / 2; - // Angle & Cusp Condition - //---------------------- - da = fabs(atan2(y3 - y2, x3 - x2) - atan2(y2 - y1, x2 - x1)); - if(da >= pi) da = 2*pi - da; + double dx = x3-x1; + double dy = y3-y1; + double d = fabs(((x2 - x3) * dy - (y2 - y3) * dx)); + double da; - if(da < m_angle_tolerance) - { - // Finally we can stop the recursion - //---------------------- - m_points.add(point_d(x123, y123)); - return; - } - } - } - else + if(d > curve_collinearity_epsilon) + { + // Regular case + //----------------- + if(d * d <= m_distance_tolerance_square * (dx*dx + dy*dy)) { - // Collinear case - //------------------ - da = dx*dx + dy*dy; - if(da == 0) + // If the curvature doesn't exceed the distance_tolerance value + // we tend to finish subdivisions. + //---------------------- + if(m_angle_tolerance < curve_angle_tolerance_epsilon) { - d = calc_sq_distance(x1, y1, x2, y2); + m_points.add(point_d(x123, y123)); + return; } - else + + // Angle & Cusp Condition + //---------------------- + da = fabs(atan2(y3 - y2, x3 - x2) - atan2(y2 - y1, x2 - x1)); + if(da >= pi) da = 2*pi - da; + + if(da < m_angle_tolerance) { - d = ((x2 - x1)*dx + (y2 - y1)*dy) / da; - if(d > 0 && d < 1) - { - // Simple collinear case, 1---2---3 - // We can leave just two endpoints - return; - } - if(d <= 0) d = calc_sq_distance(x2, y2, x1, y1); - else if(d >= 1) d = calc_sq_distance(x2, y2, x3, y3); - else d = calc_sq_distance(x2, y2, x1 + d*dx, y1 + d*dy); + // Finally we can stop the recursion + //---------------------- + m_points.add(point_d(x123, y123)); + return; } - if(d < m_distance_tolerance_square) + } + } + else + { + // Collinear case + //------------------ + da = dx*dx + dy*dy; + if(da == 0) + { + d = calc_sq_distance(x1, y1, x2, y2); + } + else + { + d = ((x2 - x1)*dx + (y2 - y1)*dy) / da; + if(d > 0 && d < 1) { - m_points.add(point_d(x2, y2)); + // Simple collinear case, 1---2---3 + // We can leave just two endpoints return; } + if(d <= 0) d = calc_sq_distance(x2, y2, x1, y1); + else if(d >= 1) d = calc_sq_distance(x2, y2, x3, y3); + else d = calc_sq_distance(x2, y2, x1 + d*dx, y1 + d*dy); + } + if(d < m_distance_tolerance_square) + { + m_points.add(point_d(x2, y2)); + return; } - - // Continue subdivision - //---------------------- - recursive_bezier(x1, y1, x12, y12, x123, y123, level + 1); - recursive_bezier(x123, y123, x23, y23, x3, y3, level + 1); } - //------------------------------------------------------------------------ - void curve3_div::bezier(double x1, double y1, - double x2, double y2, - double x3, double y3) - { - m_points.add(point_d(x1, y1)); - recursive_bezier(x1, y1, x2, y2, x3, y3, 0); - m_points.add(point_d(x3, y3)); - } + // Continue subdivision + //---------------------- + recursive_bezier(x1, y1, x12, y12, x123, y123, level + 1); + recursive_bezier(x123, y123, x23, y23, x3, y3, level + 1); +} +//------------------------------------------------------------------------ +void curve3_div::bezier(double x1, double y1, + double x2, double y2, + double x3, double y3) +{ + m_points.add(point_d(x1, y1)); + recursive_bezier(x1, y1, x2, y2, x3, y3, 0); + m_points.add(point_d(x3, y3)); +} - //------------------------------------------------------------------------ - void curve4_inc::approximation_scale(double s) - { - m_scale = s; - } - //------------------------------------------------------------------------ - double curve4_inc::approximation_scale() const - { - return m_scale; - } +//------------------------------------------------------------------------ +void curve4_inc::approximation_scale(double s) +{ + m_scale = s; +} + +//------------------------------------------------------------------------ +double curve4_inc::approximation_scale() const +{ + return m_scale; +} #if defined(_MSC_VER) && _MSC_VER <= 1200 - //------------------------------------------------------------------------ - static double MSC60_fix_ICE(double v) { return v; } +//------------------------------------------------------------------------ +static double MSC60_fix_ICE(double v) { return v; } #endif - //------------------------------------------------------------------------ - void curve4_inc::init(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4) - { - m_start_x = x1; - m_start_y = y1; - m_end_x = x4; - m_end_y = y4; - - double dx1 = x2 - x1; - double dy1 = y2 - y1; - double dx2 = x3 - x2; - double dy2 = y3 - y2; - double dx3 = x4 - x3; - double dy3 = y4 - y3; - - double len = (sqrt(dx1 * dx1 + dy1 * dy1) + - sqrt(dx2 * dx2 + dy2 * dy2) + - sqrt(dx3 * dx3 + dy3 * dy3)) * 0.25 * m_scale; +//------------------------------------------------------------------------ +void curve4_inc::init(double x1, double y1, + double x2, double y2, + double x3, double y3, + double x4, double y4) +{ + m_start_x = x1; + m_start_y = y1; + m_end_x = x4; + m_end_y = y4; + + double dx1 = x2 - x1; + double dy1 = y2 - y1; + double dx2 = x3 - x2; + double dy2 = y3 - y2; + double dx3 = x4 - x3; + double dy3 = y4 - y3; + + double len = (sqrt(dx1 * dx1 + dy1 * dy1) + + sqrt(dx2 * dx2 + dy2 * dy2) + + sqrt(dx3 * dx3 + dy3 * dy3)) * 0.25 * m_scale; #if defined(_MSC_VER) && _MSC_VER <= 1200 - m_num_steps = uround(MSC60_fix_ICE(len)); + m_num_steps = uround(MSC60_fix_ICE(len)); #else - m_num_steps = uround(len); + m_num_steps = uround(len); #endif - if(m_num_steps < 4) - { - m_num_steps = 4; - } + if(m_num_steps < 4) + { + m_num_steps = 4; + } - double subdivide_step = 1.0 / m_num_steps; - double subdivide_step2 = subdivide_step * subdivide_step; - double subdivide_step3 = subdivide_step * subdivide_step * subdivide_step; + double subdivide_step = 1.0 / m_num_steps; + double subdivide_step2 = subdivide_step * subdivide_step; + double subdivide_step3 = subdivide_step * subdivide_step * subdivide_step; - double pre1 = 3.0 * subdivide_step; - double pre2 = 3.0 * subdivide_step2; - double pre4 = 6.0 * subdivide_step2; - double pre5 = 6.0 * subdivide_step3; + double pre1 = 3.0 * subdivide_step; + double pre2 = 3.0 * subdivide_step2; + double pre4 = 6.0 * subdivide_step2; + double pre5 = 6.0 * subdivide_step3; - double tmp1x = x1 - x2 * 2.0 + x3; - double tmp1y = y1 - y2 * 2.0 + y3; + double tmp1x = x1 - x2 * 2.0 + x3; + double tmp1y = y1 - y2 * 2.0 + y3; - double tmp2x = (x2 - x3) * 3.0 - x1 + x4; - double tmp2y = (y2 - y3) * 3.0 - y1 + y4; + double tmp2x = (x2 - x3) * 3.0 - x1 + x4; + double tmp2y = (y2 - y3) * 3.0 - y1 + y4; - m_saved_fx = m_fx = x1; - m_saved_fy = m_fy = y1; + m_saved_fx = m_fx = x1; + m_saved_fy = m_fy = y1; - m_saved_dfx = m_dfx = (x2 - x1) * pre1 + tmp1x * pre2 + tmp2x * subdivide_step3; - m_saved_dfy = m_dfy = (y2 - y1) * pre1 + tmp1y * pre2 + tmp2y * subdivide_step3; + m_saved_dfx = m_dfx = (x2 - x1) * pre1 + tmp1x * pre2 + tmp2x * subdivide_step3; + m_saved_dfy = m_dfy = (y2 - y1) * pre1 + tmp1y * pre2 + tmp2y * subdivide_step3; - m_saved_ddfx = m_ddfx = tmp1x * pre4 + tmp2x * pre5; - m_saved_ddfy = m_ddfy = tmp1y * pre4 + tmp2y * pre5; + m_saved_ddfx = m_ddfx = tmp1x * pre4 + tmp2x * pre5; + m_saved_ddfy = m_ddfy = tmp1y * pre4 + tmp2y * pre5; - m_dddfx = tmp2x * pre5; - m_dddfy = tmp2y * pre5; + m_dddfx = tmp2x * pre5; + m_dddfy = tmp2y * pre5; - m_step = m_num_steps; - } + m_step = m_num_steps; +} - //------------------------------------------------------------------------ - void curve4_inc::rewind(unsigned) +//------------------------------------------------------------------------ +void curve4_inc::rewind(unsigned) +{ + if(m_num_steps == 0) { - if(m_num_steps == 0) - { - m_step = -1; - return; - } - m_step = m_num_steps; - m_fx = m_saved_fx; - m_fy = m_saved_fy; - m_dfx = m_saved_dfx; - m_dfy = m_saved_dfy; - m_ddfx = m_saved_ddfx; - m_ddfy = m_saved_ddfy; + m_step = -1; + return; } + m_step = m_num_steps; + m_fx = m_saved_fx; + m_fy = m_saved_fy; + m_dfx = m_saved_dfx; + m_dfy = m_saved_dfy; + m_ddfx = m_saved_ddfx; + m_ddfy = m_saved_ddfy; +} - //------------------------------------------------------------------------ - unsigned curve4_inc::vertex(double* x, double* y) +//------------------------------------------------------------------------ +unsigned curve4_inc::vertex(double* x, double* y) +{ + if(m_step < 0) return path_cmd_stop; + if(m_step == m_num_steps) { - if(m_step < 0) return path_cmd_stop; - if(m_step == m_num_steps) - { - *x = m_start_x; - *y = m_start_y; - --m_step; - return path_cmd_move_to; - } - - if(m_step == 0) - { - *x = m_end_x; - *y = m_end_y; - --m_step; - return path_cmd_line_to; - } - - m_fx += m_dfx; - m_fy += m_dfy; - m_dfx += m_ddfx; - m_dfy += m_ddfy; - m_ddfx += m_dddfx; - m_ddfy += m_dddfy; + *x = m_start_x; + *y = m_start_y; + --m_step; + return path_cmd_move_to; + } - *x = m_fx; - *y = m_fy; + if(m_step == 0) + { + *x = m_end_x; + *y = m_end_y; --m_step; return path_cmd_line_to; } + m_fx += m_dfx; + m_fy += m_dfy; + m_dfx += m_ddfx; + m_dfy += m_ddfy; + m_ddfx += m_dddfx; + m_ddfy += m_dddfy; + + *x = m_fx; + *y = m_fy; + --m_step; + return path_cmd_line_to; +} - //------------------------------------------------------------------------ - void curve4_div::init(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4) - { - m_points.remove_all(); - m_distance_tolerance_square = 0.5 / m_approximation_scale; - m_distance_tolerance_square *= m_distance_tolerance_square; - bezier(x1, y1, x2, y2, x3, y3, x4, y4); - m_count = 0; - } - - //------------------------------------------------------------------------ - void curve4_div::recursive_bezier(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4, - unsigned level) - { - if(level > curve_recursion_limit) - { - return; - } - - // Calculate all the mid-points of the line segments - //---------------------- - double x12 = (x1 + x2) / 2; - double y12 = (y1 + y2) / 2; - double x23 = (x2 + x3) / 2; - double y23 = (y2 + y3) / 2; - double x34 = (x3 + x4) / 2; - double y34 = (y3 + y4) / 2; - double x123 = (x12 + x23) / 2; - double y123 = (y12 + y23) / 2; - double x234 = (x23 + x34) / 2; - double y234 = (y23 + y34) / 2; - double x1234 = (x123 + x234) / 2; - double y1234 = (y123 + y234) / 2; +//------------------------------------------------------------------------ +void curve4_div::init(double x1, double y1, + double x2, double y2, + double x3, double y3, + double x4, double y4) +{ + m_points.remove_all(); + m_distance_tolerance_square = 0.5 / m_approximation_scale; + m_distance_tolerance_square *= m_distance_tolerance_square; + bezier(x1, y1, x2, y2, x3, y3, x4, y4); + m_count = 0; +} - // Try to approximate the full cubic curve by a single straight line - //------------------ - double dx = x4-x1; - double dy = y4-y1; +//------------------------------------------------------------------------ +void curve4_div::recursive_bezier(double x1, double y1, + double x2, double y2, + double x3, double y3, + double x4, double y4, + unsigned level) +{ + if(level > curve_recursion_limit) + { + return; + } - double d2 = fabs(((x2 - x4) * dy - (y2 - y4) * dx)); - double d3 = fabs(((x3 - x4) * dy - (y3 - y4) * dx)); - double da1, da2, k; + // Calculate all the mid-points of the line segments + //---------------------- + double x12 = (x1 + x2) / 2; + double y12 = (y1 + y2) / 2; + double x23 = (x2 + x3) / 2; + double y23 = (y2 + y3) / 2; + double x34 = (x3 + x4) / 2; + double y34 = (y3 + y4) / 2; + double x123 = (x12 + x23) / 2; + double y123 = (y12 + y23) / 2; + double x234 = (x23 + x34) / 2; + double y234 = (y23 + y34) / 2; + double x1234 = (x123 + x234) / 2; + double y1234 = (y123 + y234) / 2; + + + // Try to approximate the full cubic curve by a single straight line + //------------------ + double dx = x4-x1; + double dy = y4-y1; + + double d2 = fabs(((x2 - x4) * dy - (y2 - y4) * dx)); + double d3 = fabs(((x3 - x4) * dy - (y3 - y4) * dx)); + double da1, da2, k; - switch((int(d2 > curve_collinearity_epsilon) << 1) + - int(d3 > curve_collinearity_epsilon)) + switch((int(d2 > curve_collinearity_epsilon) << 1) + + int(d3 > curve_collinearity_epsilon)) + { + case 0: + // All collinear OR p1==p4 + //---------------------- + k = dx*dx + dy*dy; + if(k == 0) { - case 0: - // All collinear OR p1==p4 - //---------------------- - k = dx*dx + dy*dy; - if(k == 0) + d2 = calc_sq_distance(x1, y1, x2, y2); + d3 = calc_sq_distance(x4, y4, x3, y3); + } + else + { + k = 1 / k; + da1 = x2 - x1; + da2 = y2 - y1; + d2 = k * (da1*dx + da2*dy); + da1 = x3 - x1; + da2 = y3 - y1; + d3 = k * (da1*dx + da2*dy); + if(d2 > 0 && d2 < 1 && d3 > 0 && d3 < 1) { - d2 = calc_sq_distance(x1, y1, x2, y2); - d3 = calc_sq_distance(x4, y4, x3, y3); + // Simple collinear case, 1---2---3---4 + // We can leave just two endpoints + return; } - else - { - k = 1 / k; - da1 = x2 - x1; - da2 = y2 - y1; - d2 = k * (da1*dx + da2*dy); - da1 = x3 - x1; - da2 = y3 - y1; - d3 = k * (da1*dx + da2*dy); - if(d2 > 0 && d2 < 1 && d3 > 0 && d3 < 1) - { - // Simple collinear case, 1---2---3---4 - // We can leave just two endpoints - return; - } - if(d2 <= 0) d2 = calc_sq_distance(x2, y2, x1, y1); - else if(d2 >= 1) d2 = calc_sq_distance(x2, y2, x4, y4); - else d2 = calc_sq_distance(x2, y2, x1 + d2*dx, y1 + d2*dy); + if(d2 <= 0) d2 = calc_sq_distance(x2, y2, x1, y1); + else if(d2 >= 1) d2 = calc_sq_distance(x2, y2, x4, y4); + else d2 = calc_sq_distance(x2, y2, x1 + d2*dx, y1 + d2*dy); - if(d3 <= 0) d3 = calc_sq_distance(x3, y3, x1, y1); - else if(d3 >= 1) d3 = calc_sq_distance(x3, y3, x4, y4); - else d3 = calc_sq_distance(x3, y3, x1 + d3*dx, y1 + d3*dy); + if(d3 <= 0) d3 = calc_sq_distance(x3, y3, x1, y1); + else if(d3 >= 1) d3 = calc_sq_distance(x3, y3, x4, y4); + else d3 = calc_sq_distance(x3, y3, x1 + d3*dx, y1 + d3*dy); + } + if(d2 > d3) + { + if(d2 < m_distance_tolerance_square) + { + m_points.add(point_d(x2, y2)); + return; } - if(d2 > d3) + } + else + { + if(d3 < m_distance_tolerance_square) { - if(d2 < m_distance_tolerance_square) - { - m_points.add(point_d(x2, y2)); - return; - } + m_points.add(point_d(x3, y3)); + return; } - else + } + break; + + case 1: + // p1,p2,p4 are collinear, p3 is significant + //---------------------- + if(d3 * d3 <= m_distance_tolerance_square * (dx*dx + dy*dy)) + { + if(m_angle_tolerance < curve_angle_tolerance_epsilon) { - if(d3 < m_distance_tolerance_square) - { - m_points.add(point_d(x3, y3)); - return; - } + m_points.add(point_d(x23, y23)); + return; } - break; - case 1: - // p1,p2,p4 are collinear, p3 is significant + // Angle Condition //---------------------- - if(d3 * d3 <= m_distance_tolerance_square * (dx*dx + dy*dy)) - { - if(m_angle_tolerance < curve_angle_tolerance_epsilon) - { - m_points.add(point_d(x23, y23)); - return; - } + da1 = fabs(atan2(y4 - y3, x4 - x3) - atan2(y3 - y2, x3 - x2)); + if(da1 >= pi) da1 = 2*pi - da1; - // Angle Condition - //---------------------- - da1 = fabs(atan2(y4 - y3, x4 - x3) - atan2(y3 - y2, x3 - x2)); - if(da1 >= pi) da1 = 2*pi - da1; + if(da1 < m_angle_tolerance) + { + m_points.add(point_d(x2, y2)); + m_points.add(point_d(x3, y3)); + return; + } - if(da1 < m_angle_tolerance) + if(m_cusp_limit != 0.0) + { + if(da1 > m_cusp_limit) { - m_points.add(point_d(x2, y2)); m_points.add(point_d(x3, y3)); return; } + } + } + break; - if(m_cusp_limit != 0.0) - { - if(da1 > m_cusp_limit) - { - m_points.add(point_d(x3, y3)); - return; - } - } + case 2: + // p1,p3,p4 are collinear, p2 is significant + //---------------------- + if(d2 * d2 <= m_distance_tolerance_square * (dx*dx + dy*dy)) + { + if(m_angle_tolerance < curve_angle_tolerance_epsilon) + { + m_points.add(point_d(x23, y23)); + return; } - break; - case 2: - // p1,p3,p4 are collinear, p2 is significant + // Angle Condition //---------------------- - if(d2 * d2 <= m_distance_tolerance_square * (dx*dx + dy*dy)) - { - if(m_angle_tolerance < curve_angle_tolerance_epsilon) - { - m_points.add(point_d(x23, y23)); - return; - } + da1 = fabs(atan2(y3 - y2, x3 - x2) - atan2(y2 - y1, x2 - x1)); + if(da1 >= pi) da1 = 2*pi - da1; - // Angle Condition - //---------------------- - da1 = fabs(atan2(y3 - y2, x3 - x2) - atan2(y2 - y1, x2 - x1)); - if(da1 >= pi) da1 = 2*pi - da1; + if(da1 < m_angle_tolerance) + { + m_points.add(point_d(x2, y2)); + m_points.add(point_d(x3, y3)); + return; + } - if(da1 < m_angle_tolerance) + if(m_cusp_limit != 0.0) + { + if(da1 > m_cusp_limit) { m_points.add(point_d(x2, y2)); - m_points.add(point_d(x3, y3)); return; } - - if(m_cusp_limit != 0.0) - { - if(da1 > m_cusp_limit) - { - m_points.add(point_d(x2, y2)); - return; - } - } } - break; + } + break; - case 3: - // Regular case - //----------------- - if((d2 + d3)*(d2 + d3) <= m_distance_tolerance_square * (dx*dx + dy*dy)) + case 3: + // Regular case + //----------------- + if((d2 + d3)*(d2 + d3) <= m_distance_tolerance_square * (dx*dx + dy*dy)) + { + // If the curvature doesn't exceed the distance_tolerance value + // we tend to finish subdivisions. + //---------------------- + if(m_angle_tolerance < curve_angle_tolerance_epsilon) { - // If the curvature doesn't exceed the distance_tolerance value - // we tend to finish subdivisions. - //---------------------- - if(m_angle_tolerance < curve_angle_tolerance_epsilon) - { - m_points.add(point_d(x23, y23)); - return; - } + m_points.add(point_d(x23, y23)); + return; + } - // Angle & Cusp Condition + // Angle & Cusp Condition + //---------------------- + k = atan2(y3 - y2, x3 - x2); + da1 = fabs(k - atan2(y2 - y1, x2 - x1)); + da2 = fabs(atan2(y4 - y3, x4 - x3) - k); + if(da1 >= pi) da1 = 2*pi - da1; + if(da2 >= pi) da2 = 2*pi - da2; + + if(da1 + da2 < m_angle_tolerance) + { + // Finally we can stop the recursion //---------------------- - k = atan2(y3 - y2, x3 - x2); - da1 = fabs(k - atan2(y2 - y1, x2 - x1)); - da2 = fabs(atan2(y4 - y3, x4 - x3) - k); - if(da1 >= pi) da1 = 2*pi - da1; - if(da2 >= pi) da2 = 2*pi - da2; + m_points.add(point_d(x23, y23)); + return; + } - if(da1 + da2 < m_angle_tolerance) + if(m_cusp_limit != 0.0) + { + if(da1 > m_cusp_limit) { - // Finally we can stop the recursion - //---------------------- - m_points.add(point_d(x23, y23)); + m_points.add(point_d(x2, y2)); return; } - if(m_cusp_limit != 0.0) + if(da2 > m_cusp_limit) { - if(da1 > m_cusp_limit) - { - m_points.add(point_d(x2, y2)); - return; - } - - if(da2 > m_cusp_limit) - { - m_points.add(point_d(x3, y3)); - return; - } + m_points.add(point_d(x3, y3)); + return; } } - break; } - - // Continue subdivision - //---------------------- - recursive_bezier(x1, y1, x12, y12, x123, y123, x1234, y1234, level + 1); - recursive_bezier(x1234, y1234, x234, y234, x34, y34, x4, y4, level + 1); + break; } - //------------------------------------------------------------------------ - void curve4_div::bezier(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4) - { - m_points.add(point_d(x1, y1)); - recursive_bezier(x1, y1, x2, y2, x3, y3, x4, y4, 0); - m_points.add(point_d(x4, y4)); - } + // Continue subdivision + //---------------------- + recursive_bezier(x1, y1, x12, y12, x123, y123, x1234, y1234, level + 1); + recursive_bezier(x1234, y1234, x234, y234, x34, y34, x4, y4, level + 1); +} + +//------------------------------------------------------------------------ +void curve4_div::bezier(double x1, double y1, + double x2, double y2, + double x3, double y3, + double x4, double y4) +{ + m_points.add(point_d(x1, y1)); + recursive_bezier(x1, y1, x2, y2, x3, y3, x4, y4, 0); + m_points.add(point_d(x4, y4)); +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_embedded_raster_fonts.cpp mapnik-2.2.0/deps/agg/src/agg_embedded_raster_fonts.cpp --- mapnik-2.1.0/deps/agg/src/agg_embedded_raster_fonts.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_embedded_raster_fonts.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,10409 +18,10409 @@ namespace agg { - const int8u gse4x6[] = - { - 6, 0, 32, 128-32, +const int8u gse4x6[] = +{ + 6, 0, 32, 128-32, - 0x00,0x00,0x07,0x00,0x0e,0x00,0x15,0x00,0x1c,0x00,0x23,0x00,0x2a,0x00,0x31,0x00,0x38,0x00, - 0x3f,0x00,0x46,0x00,0x4d,0x00,0x54,0x00,0x5b,0x00,0x62,0x00,0x69,0x00,0x70,0x00,0x77,0x00, - 0x7e,0x00,0x85,0x00,0x8c,0x00,0x93,0x00,0x9a,0x00,0xa1,0x00,0xa8,0x00,0xaf,0x00,0xb6,0x00, - 0xbd,0x00,0xc4,0x00,0xcb,0x00,0xd2,0x00,0xd9,0x00,0xe0,0x00,0xe7,0x00,0xee,0x00,0xf5,0x00, - 0xfc,0x00,0x03,0x01,0x0a,0x01,0x11,0x01,0x18,0x01,0x1f,0x01,0x26,0x01,0x2d,0x01,0x34,0x01, - 0x3b,0x01,0x42,0x01,0x49,0x01,0x50,0x01,0x57,0x01,0x5e,0x01,0x65,0x01,0x6c,0x01,0x73,0x01, - 0x7a,0x01,0x81,0x01,0x88,0x01,0x8f,0x01,0x96,0x01,0x9d,0x01,0xa4,0x01,0xab,0x01,0xb2,0x01, - 0xb9,0x01,0xc0,0x01,0xc7,0x01,0xce,0x01,0xd5,0x01,0xdc,0x01,0xe3,0x01,0xea,0x01,0xf1,0x01, - 0xf8,0x01,0xff,0x01,0x06,0x02,0x0d,0x02,0x14,0x02,0x1b,0x02,0x22,0x02,0x29,0x02,0x30,0x02, - 0x37,0x02,0x3e,0x02,0x45,0x02,0x4c,0x02,0x53,0x02,0x5a,0x02,0x61,0x02,0x68,0x02,0x6f,0x02, - 0x76,0x02,0x7d,0x02,0x84,0x02,0x8b,0x02,0x92,0x02,0x99,0x02, + 0x00,0x00,0x07,0x00,0x0e,0x00,0x15,0x00,0x1c,0x00,0x23,0x00,0x2a,0x00,0x31,0x00,0x38,0x00, + 0x3f,0x00,0x46,0x00,0x4d,0x00,0x54,0x00,0x5b,0x00,0x62,0x00,0x69,0x00,0x70,0x00,0x77,0x00, + 0x7e,0x00,0x85,0x00,0x8c,0x00,0x93,0x00,0x9a,0x00,0xa1,0x00,0xa8,0x00,0xaf,0x00,0xb6,0x00, + 0xbd,0x00,0xc4,0x00,0xcb,0x00,0xd2,0x00,0xd9,0x00,0xe0,0x00,0xe7,0x00,0xee,0x00,0xf5,0x00, + 0xfc,0x00,0x03,0x01,0x0a,0x01,0x11,0x01,0x18,0x01,0x1f,0x01,0x26,0x01,0x2d,0x01,0x34,0x01, + 0x3b,0x01,0x42,0x01,0x49,0x01,0x50,0x01,0x57,0x01,0x5e,0x01,0x65,0x01,0x6c,0x01,0x73,0x01, + 0x7a,0x01,0x81,0x01,0x88,0x01,0x8f,0x01,0x96,0x01,0x9d,0x01,0xa4,0x01,0xab,0x01,0xb2,0x01, + 0xb9,0x01,0xc0,0x01,0xc7,0x01,0xce,0x01,0xd5,0x01,0xdc,0x01,0xe3,0x01,0xea,0x01,0xf1,0x01, + 0xf8,0x01,0xff,0x01,0x06,0x02,0x0d,0x02,0x14,0x02,0x1b,0x02,0x22,0x02,0x29,0x02,0x30,0x02, + 0x37,0x02,0x3e,0x02,0x45,0x02,0x4c,0x02,0x53,0x02,0x5a,0x02,0x61,0x02,0x68,0x02,0x6f,0x02, + 0x76,0x02,0x7d,0x02,0x84,0x02,0x8b,0x02,0x92,0x02,0x99,0x02, - 4, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x21 '!' - 0x40,0x40,0x40,0x00,0x40,0x00, + 4, // 0x21 '!' + 0x40,0x40,0x40,0x00,0x40,0x00, - 4, // 0x22 '"' - 0xa0,0xa0,0x00,0x00,0x00,0x00, + 4, // 0x22 '"' + 0xa0,0xa0,0x00,0x00,0x00,0x00, - 4, // 0x23 '#' - 0x60,0xf0,0x60,0xf0,0x60,0x00, + 4, // 0x23 '#' + 0x60,0xf0,0x60,0xf0,0x60,0x00, - 4, // 0x24 '$' - 0x40,0x60,0xc0,0x60,0xc0,0x40, + 4, // 0x24 '$' + 0x40,0x60,0xc0,0x60,0xc0,0x40, - 4, // 0x25 '%' - 0xa0,0x20,0x40,0x80,0xa0,0x00, + 4, // 0x25 '%' + 0xa0,0x20,0x40,0x80,0xa0,0x00, - 4, // 0x26 '&' - 0xe0,0xa0,0x50,0xa0,0xd0,0x00, + 4, // 0x26 '&' + 0xe0,0xa0,0x50,0xa0,0xd0,0x00, - 4, // 0x27 ''' - 0x40,0x40,0x00,0x00,0x00,0x00, + 4, // 0x27 ''' + 0x40,0x40,0x00,0x00,0x00,0x00, - 4, // 0x28 '(' - 0x20,0x40,0x40,0x40,0x20,0x00, + 4, // 0x28 '(' + 0x20,0x40,0x40,0x40,0x20,0x00, - 4, // 0x29 ')' - 0x40,0x20,0x20,0x20,0x40,0x00, + 4, // 0x29 ')' + 0x40,0x20,0x20,0x20,0x40,0x00, - 4, // 0x2a '*' - 0xa0,0x40,0xe0,0x40,0xa0,0x00, + 4, // 0x2a '*' + 0xa0,0x40,0xe0,0x40,0xa0,0x00, - 4, // 0x2b '+' - 0x40,0x40,0xe0,0x40,0x40,0x00, + 4, // 0x2b '+' + 0x40,0x40,0xe0,0x40,0x40,0x00, - 4, // 0x2c ',' - 0x00,0x00,0x00,0x40,0x40,0x80, + 4, // 0x2c ',' + 0x00,0x00,0x00,0x40,0x40,0x80, - 4, // 0x2d '-' - 0x00,0x00,0xe0,0x00,0x00,0x00, + 4, // 0x2d '-' + 0x00,0x00,0xe0,0x00,0x00,0x00, - 4, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x40,0x00, + 4, // 0x2e '.' + 0x00,0x00,0x00,0x00,0x40,0x00, - 4, // 0x2f '/' - 0x10,0x20,0x20,0x40,0x40,0x80, + 4, // 0x2f '/' + 0x10,0x20,0x20,0x40,0x40,0x80, - 4, // 0x30 '0' - 0xe0,0xa0,0xa0,0xa0,0xe0,0x00, + 4, // 0x30 '0' + 0xe0,0xa0,0xa0,0xa0,0xe0,0x00, - 4, // 0x31 '1' - 0x40,0xc0,0x40,0x40,0xe0,0x00, + 4, // 0x31 '1' + 0x40,0xc0,0x40,0x40,0xe0,0x00, - 4, // 0x32 '2' - 0xe0,0xa0,0x20,0x40,0xe0,0x00, + 4, // 0x32 '2' + 0xe0,0xa0,0x20,0x40,0xe0,0x00, - 4, // 0x33 '3' - 0xe0,0x20,0x40,0x20,0xe0,0x00, + 4, // 0x33 '3' + 0xe0,0x20,0x40,0x20,0xe0,0x00, - 4, // 0x34 '4' - 0xa0,0xa0,0xe0,0x20,0x20,0x00, + 4, // 0x34 '4' + 0xa0,0xa0,0xe0,0x20,0x20,0x00, - 4, // 0x35 '5' - 0xe0,0x80,0xc0,0x20,0xc0,0x00, + 4, // 0x35 '5' + 0xe0,0x80,0xc0,0x20,0xc0,0x00, - 4, // 0x36 '6' - 0x40,0x80,0xe0,0xa0,0xe0,0x00, + 4, // 0x36 '6' + 0x40,0x80,0xe0,0xa0,0xe0,0x00, - 4, // 0x37 '7' - 0xe0,0xa0,0x20,0x40,0x40,0x00, + 4, // 0x37 '7' + 0xe0,0xa0,0x20,0x40,0x40,0x00, - 4, // 0x38 '8' - 0xe0,0xa0,0x40,0xa0,0xe0,0x00, + 4, // 0x38 '8' + 0xe0,0xa0,0x40,0xa0,0xe0,0x00, - 4, // 0x39 '9' - 0xe0,0xa0,0xe0,0x20,0xc0,0x00, + 4, // 0x39 '9' + 0xe0,0xa0,0xe0,0x20,0xc0,0x00, - 4, // 0x3a ':' - 0x00,0x40,0x00,0x40,0x00,0x00, + 4, // 0x3a ':' + 0x00,0x40,0x00,0x40,0x00,0x00, - 4, // 0x3b ';' - 0x00,0x40,0x00,0x40,0x40,0x80, + 4, // 0x3b ';' + 0x00,0x40,0x00,0x40,0x40,0x80, - 4, // 0x3c '<' - 0x20,0x40,0x80,0x40,0x20,0x00, + 4, // 0x3c '<' + 0x20,0x40,0x80,0x40,0x20,0x00, - 4, // 0x3d '=' - 0x00,0xe0,0x00,0xe0,0x00,0x00, + 4, // 0x3d '=' + 0x00,0xe0,0x00,0xe0,0x00,0x00, - 4, // 0x3e '>' - 0x80,0x40,0x20,0x40,0x80,0x00, + 4, // 0x3e '>' + 0x80,0x40,0x20,0x40,0x80,0x00, - 4, // 0x3f '?' - 0xc0,0x20,0x40,0x00,0x40,0x00, + 4, // 0x3f '?' + 0xc0,0x20,0x40,0x00,0x40,0x00, - 4, // 0x40 '@' - 0x40,0xa0,0xe0,0xe0,0x80,0x60, + 4, // 0x40 '@' + 0x40,0xa0,0xe0,0xe0,0x80,0x60, - 4, // 0x41 'A' - 0x40,0xa0,0xe0,0xa0,0xa0,0x00, + 4, // 0x41 'A' + 0x40,0xa0,0xe0,0xa0,0xa0,0x00, - 4, // 0x42 'B' - 0xc0,0xa0,0xc0,0xa0,0xc0,0x00, + 4, // 0x42 'B' + 0xc0,0xa0,0xc0,0xa0,0xc0,0x00, - 4, // 0x43 'C' - 0x60,0x80,0x80,0x80,0x60,0x00, + 4, // 0x43 'C' + 0x60,0x80,0x80,0x80,0x60,0x00, - 4, // 0x44 'D' - 0xc0,0xa0,0xa0,0xa0,0xc0,0x00, + 4, // 0x44 'D' + 0xc0,0xa0,0xa0,0xa0,0xc0,0x00, - 4, // 0x45 'E' - 0xe0,0x80,0xc0,0x80,0xe0,0x00, + 4, // 0x45 'E' + 0xe0,0x80,0xc0,0x80,0xe0,0x00, - 4, // 0x46 'F' - 0xe0,0x80,0xc0,0x80,0x80,0x00, + 4, // 0x46 'F' + 0xe0,0x80,0xc0,0x80,0x80,0x00, - 4, // 0x47 'G' - 0x60,0x80,0xa0,0xa0,0x40,0x00, + 4, // 0x47 'G' + 0x60,0x80,0xa0,0xa0,0x40,0x00, - 4, // 0x48 'H' - 0xa0,0xa0,0xe0,0xa0,0xa0,0x00, + 4, // 0x48 'H' + 0xa0,0xa0,0xe0,0xa0,0xa0,0x00, - 4, // 0x49 'I' - 0xe0,0x40,0x40,0x40,0xe0,0x00, + 4, // 0x49 'I' + 0xe0,0x40,0x40,0x40,0xe0,0x00, - 4, // 0x4a 'J' - 0x20,0x20,0x20,0x20,0xa0,0x40, + 4, // 0x4a 'J' + 0x20,0x20,0x20,0x20,0xa0,0x40, - 4, // 0x4b 'K' - 0xa0,0xa0,0xc0,0xc0,0xa0,0x00, + 4, // 0x4b 'K' + 0xa0,0xa0,0xc0,0xc0,0xa0,0x00, - 4, // 0x4c 'L' - 0x80,0x80,0x80,0x80,0xe0,0x00, + 4, // 0x4c 'L' + 0x80,0x80,0x80,0x80,0xe0,0x00, - 4, // 0x4d 'M' - 0xa0,0xe0,0xa0,0xa0,0xa0,0x00, + 4, // 0x4d 'M' + 0xa0,0xe0,0xa0,0xa0,0xa0,0x00, - 4, // 0x4e 'N' - 0x90,0xd0,0xb0,0x90,0x90,0x00, + 4, // 0x4e 'N' + 0x90,0xd0,0xb0,0x90,0x90,0x00, - 4, // 0x4f 'O' - 0x40,0xa0,0xa0,0xa0,0x40,0x00, + 4, // 0x4f 'O' + 0x40,0xa0,0xa0,0xa0,0x40,0x00, - 4, // 0x50 'P' - 0xc0,0xa0,0xa0,0xc0,0x80,0x00, + 4, // 0x50 'P' + 0xc0,0xa0,0xa0,0xc0,0x80,0x00, - 4, // 0x51 'Q' - 0x40,0xa0,0xa0,0xa0,0x60,0x00, + 4, // 0x51 'Q' + 0x40,0xa0,0xa0,0xa0,0x60,0x00, - 4, // 0x52 'R' - 0xc0,0xa0,0xa0,0xc0,0xa0,0x00, + 4, // 0x52 'R' + 0xc0,0xa0,0xa0,0xc0,0xa0,0x00, - 4, // 0x53 'S' - 0x60,0x80,0x40,0x20,0xc0,0x00, + 4, // 0x53 'S' + 0x60,0x80,0x40,0x20,0xc0,0x00, - 4, // 0x54 'T' - 0xe0,0x40,0x40,0x40,0x40,0x00, + 4, // 0x54 'T' + 0xe0,0x40,0x40,0x40,0x40,0x00, - 4, // 0x55 'U' - 0xa0,0xa0,0xa0,0xa0,0xe0,0x00, + 4, // 0x55 'U' + 0xa0,0xa0,0xa0,0xa0,0xe0,0x00, - 4, // 0x56 'V' - 0xa0,0xa0,0xa0,0xa0,0x40,0x00, + 4, // 0x56 'V' + 0xa0,0xa0,0xa0,0xa0,0x40,0x00, - 4, // 0x57 'W' - 0xa0,0xa0,0xa0,0xe0,0xa0,0x00, + 4, // 0x57 'W' + 0xa0,0xa0,0xa0,0xe0,0xa0,0x00, - 4, // 0x58 'X' - 0xa0,0xa0,0x40,0xa0,0xa0,0x00, + 4, // 0x58 'X' + 0xa0,0xa0,0x40,0xa0,0xa0,0x00, - 4, // 0x59 'Y' - 0xa0,0xa0,0x40,0x40,0x40,0x00, + 4, // 0x59 'Y' + 0xa0,0xa0,0x40,0x40,0x40,0x00, - 4, // 0x5a 'Z' - 0xe0,0x20,0x40,0x80,0xe0,0x00, + 4, // 0x5a 'Z' + 0xe0,0x20,0x40,0x80,0xe0,0x00, - 4, // 0x5b '[' - 0xc0,0x80,0x80,0x80,0xc0,0x00, + 4, // 0x5b '[' + 0xc0,0x80,0x80,0x80,0xc0,0x00, - 4, // 0x5c '\' - 0x80,0x40,0x40,0x20,0x20,0x10, + 4, // 0x5c '\' + 0x80,0x40,0x40,0x20,0x20,0x10, - 4, // 0x5d ']' - 0xc0,0x40,0x40,0x40,0xc0,0x00, + 4, // 0x5d ']' + 0xc0,0x40,0x40,0x40,0xc0,0x00, - 4, // 0x5e '^' - 0x40,0xa0,0x00,0x00,0x00,0x00, + 4, // 0x5e '^' + 0x40,0xa0,0x00,0x00,0x00,0x00, - 4, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0xf0, + 4, // 0x5f '_' + 0x00,0x00,0x00,0x00,0x00,0xf0, - 4, // 0x60 '`' - 0x40,0x20,0x00,0x00,0x00,0x00, + 4, // 0x60 '`' + 0x40,0x20,0x00,0x00,0x00,0x00, - 4, // 0x61 'a' - 0x00,0x60,0xa0,0xa0,0x70,0x00, + 4, // 0x61 'a' + 0x00,0x60,0xa0,0xa0,0x70,0x00, - 4, // 0x62 'b' - 0x80,0x80,0xc0,0xa0,0xc0,0x00, + 4, // 0x62 'b' + 0x80,0x80,0xc0,0xa0,0xc0,0x00, - 4, // 0x63 'c' - 0x00,0x60,0x80,0x80,0x60,0x00, + 4, // 0x63 'c' + 0x00,0x60,0x80,0x80,0x60,0x00, - 4, // 0x64 'd' - 0x20,0x20,0x60,0xa0,0x60,0x00, + 4, // 0x64 'd' + 0x20,0x20,0x60,0xa0,0x60,0x00, - 4, // 0x65 'e' - 0x00,0x40,0xe0,0x80,0x60,0x00, + 4, // 0x65 'e' + 0x00,0x40,0xe0,0x80,0x60,0x00, - 4, // 0x66 'f' - 0x20,0x40,0xe0,0x40,0x40,0x00, + 4, // 0x66 'f' + 0x20,0x40,0xe0,0x40,0x40,0x00, - 4, // 0x67 'g' - 0x00,0x60,0xa0,0x60,0x20,0xc0, + 4, // 0x67 'g' + 0x00,0x60,0xa0,0x60,0x20,0xc0, - 4, // 0x68 'h' - 0x80,0x80,0xc0,0xa0,0xa0,0x00, + 4, // 0x68 'h' + 0x80,0x80,0xc0,0xa0,0xa0,0x00, - 4, // 0x69 'i' - 0x40,0x00,0xc0,0x40,0xe0,0x00, + 4, // 0x69 'i' + 0x40,0x00,0xc0,0x40,0xe0,0x00, - 4, // 0x6a 'j' - 0x40,0x00,0xc0,0x40,0x40,0x80, + 4, // 0x6a 'j' + 0x40,0x00,0xc0,0x40,0x40,0x80, - 4, // 0x6b 'k' - 0x80,0x80,0xa0,0xc0,0xa0,0x00, + 4, // 0x6b 'k' + 0x80,0x80,0xa0,0xc0,0xa0,0x00, - 4, // 0x6c 'l' - 0xc0,0x40,0x40,0x40,0xe0,0x00, + 4, // 0x6c 'l' + 0xc0,0x40,0x40,0x40,0xe0,0x00, - 4, // 0x6d 'm' - 0x00,0xa0,0xf0,0xf0,0x90,0x00, + 4, // 0x6d 'm' + 0x00,0xa0,0xf0,0xf0,0x90,0x00, - 4, // 0x6e 'n' - 0x00,0xc0,0xa0,0xa0,0xa0,0x00, + 4, // 0x6e 'n' + 0x00,0xc0,0xa0,0xa0,0xa0,0x00, - 4, // 0x6f 'o' - 0x00,0x40,0xa0,0xa0,0x40,0x00, + 4, // 0x6f 'o' + 0x00,0x40,0xa0,0xa0,0x40,0x00, - 4, // 0x70 'p' - 0x00,0xc0,0xa0,0xc0,0x80,0x80, + 4, // 0x70 'p' + 0x00,0xc0,0xa0,0xc0,0x80,0x80, - 4, // 0x71 'q' - 0x00,0x60,0xa0,0x60,0x20,0x20, + 4, // 0x71 'q' + 0x00,0x60,0xa0,0x60,0x20,0x20, - 4, // 0x72 'r' - 0x00,0xa0,0x50,0x40,0x40,0x00, + 4, // 0x72 'r' + 0x00,0xa0,0x50,0x40,0x40,0x00, - 4, // 0x73 's' - 0x00,0x60,0xc0,0x20,0xc0,0x00, + 4, // 0x73 's' + 0x00,0x60,0xc0,0x20,0xc0,0x00, - 4, // 0x74 't' - 0x40,0x40,0xe0,0x40,0x60,0x00, + 4, // 0x74 't' + 0x40,0x40,0xe0,0x40,0x60,0x00, - 4, // 0x75 'u' - 0x00,0xa0,0xa0,0xa0,0x60,0x00, + 4, // 0x75 'u' + 0x00,0xa0,0xa0,0xa0,0x60,0x00, - 4, // 0x76 'v' - 0x00,0xa0,0xa0,0xa0,0x40,0x00, + 4, // 0x76 'v' + 0x00,0xa0,0xa0,0xa0,0x40,0x00, - 4, // 0x77 'w' - 0x00,0xa0,0xa0,0xe0,0xa0,0x00, + 4, // 0x77 'w' + 0x00,0xa0,0xa0,0xe0,0xa0,0x00, - 4, // 0x78 'x' - 0x00,0xa0,0x40,0xa0,0xa0,0x00, + 4, // 0x78 'x' + 0x00,0xa0,0x40,0xa0,0xa0,0x00, - 4, // 0x79 'y' - 0x00,0xa0,0xa0,0x60,0x20,0xc0, + 4, // 0x79 'y' + 0x00,0xa0,0xa0,0x60,0x20,0xc0, - 4, // 0x7a 'z' - 0x00,0xe0,0x40,0x80,0xe0,0x00, + 4, // 0x7a 'z' + 0x00,0xe0,0x40,0x80,0xe0,0x00, - 4, // 0x7b '{' - 0x30,0x20,0xc0,0x20,0x30,0x00, + 4, // 0x7b '{' + 0x30,0x20,0xc0,0x20,0x30,0x00, - 4, // 0x7c '|' - 0x40,0x40,0x00,0x40,0x40,0x40, + 4, // 0x7c '|' + 0x40,0x40,0x00,0x40,0x40,0x40, - 4, // 0x7d '}' - 0xc0,0x40,0x30,0x40,0xc0,0x00, + 4, // 0x7d '}' + 0xc0,0x40,0x30,0x40,0xc0,0x00, - 4, // 0x7e '~' - 0x50,0xa0,0x00,0x00,0x00,0x00, + 4, // 0x7e '~' + 0x50,0xa0,0x00,0x00,0x00,0x00, - 4, // 0x7f '' - 0x00,0x60,0x90,0xf0,0x00,0x00, - 0 - }; + 4, // 0x7f '' + 0x00,0x60,0x90,0xf0,0x00,0x00, + 0 +}; - const int8u gse4x8[] = - { - 8, 0, 32, 128-32, +const int8u gse4x8[] = +{ + 8, 0, 32, 128-32, - 0x00,0x00,0x09,0x00,0x12,0x00,0x1b,0x00,0x24,0x00,0x2d,0x00,0x36,0x00,0x3f,0x00,0x48,0x00, - 0x51,0x00,0x5a,0x00,0x63,0x00,0x6c,0x00,0x75,0x00,0x7e,0x00,0x87,0x00,0x90,0x00,0x99,0x00, - 0xa2,0x00,0xab,0x00,0xb4,0x00,0xbd,0x00,0xc6,0x00,0xcf,0x00,0xd8,0x00,0xe1,0x00,0xea,0x00, - 0xf3,0x00,0xfc,0x00,0x05,0x01,0x0e,0x01,0x17,0x01,0x20,0x01,0x29,0x01,0x32,0x01,0x3b,0x01, - 0x44,0x01,0x4d,0x01,0x56,0x01,0x5f,0x01,0x68,0x01,0x71,0x01,0x7a,0x01,0x83,0x01,0x8c,0x01, - 0x95,0x01,0x9e,0x01,0xa7,0x01,0xb0,0x01,0xb9,0x01,0xc2,0x01,0xcb,0x01,0xd4,0x01,0xdd,0x01, - 0xe6,0x01,0xef,0x01,0xf8,0x01,0x01,0x02,0x0a,0x02,0x13,0x02,0x1c,0x02,0x25,0x02,0x2e,0x02, - 0x37,0x02,0x40,0x02,0x49,0x02,0x52,0x02,0x5b,0x02,0x64,0x02,0x6d,0x02,0x76,0x02,0x7f,0x02, - 0x88,0x02,0x91,0x02,0x9a,0x02,0xa3,0x02,0xac,0x02,0xb5,0x02,0xbe,0x02,0xc7,0x02,0xd0,0x02, - 0xd9,0x02,0xe2,0x02,0xeb,0x02,0xf4,0x02,0xfd,0x02,0x06,0x03,0x0f,0x03,0x18,0x03,0x21,0x03, - 0x2a,0x03,0x33,0x03,0x3c,0x03,0x45,0x03,0x4e,0x03,0x57,0x03, + 0x00,0x00,0x09,0x00,0x12,0x00,0x1b,0x00,0x24,0x00,0x2d,0x00,0x36,0x00,0x3f,0x00,0x48,0x00, + 0x51,0x00,0x5a,0x00,0x63,0x00,0x6c,0x00,0x75,0x00,0x7e,0x00,0x87,0x00,0x90,0x00,0x99,0x00, + 0xa2,0x00,0xab,0x00,0xb4,0x00,0xbd,0x00,0xc6,0x00,0xcf,0x00,0xd8,0x00,0xe1,0x00,0xea,0x00, + 0xf3,0x00,0xfc,0x00,0x05,0x01,0x0e,0x01,0x17,0x01,0x20,0x01,0x29,0x01,0x32,0x01,0x3b,0x01, + 0x44,0x01,0x4d,0x01,0x56,0x01,0x5f,0x01,0x68,0x01,0x71,0x01,0x7a,0x01,0x83,0x01,0x8c,0x01, + 0x95,0x01,0x9e,0x01,0xa7,0x01,0xb0,0x01,0xb9,0x01,0xc2,0x01,0xcb,0x01,0xd4,0x01,0xdd,0x01, + 0xe6,0x01,0xef,0x01,0xf8,0x01,0x01,0x02,0x0a,0x02,0x13,0x02,0x1c,0x02,0x25,0x02,0x2e,0x02, + 0x37,0x02,0x40,0x02,0x49,0x02,0x52,0x02,0x5b,0x02,0x64,0x02,0x6d,0x02,0x76,0x02,0x7f,0x02, + 0x88,0x02,0x91,0x02,0x9a,0x02,0xa3,0x02,0xac,0x02,0xb5,0x02,0xbe,0x02,0xc7,0x02,0xd0,0x02, + 0xd9,0x02,0xe2,0x02,0xeb,0x02,0xf4,0x02,0xfd,0x02,0x06,0x03,0x0f,0x03,0x18,0x03,0x21,0x03, + 0x2a,0x03,0x33,0x03,0x3c,0x03,0x45,0x03,0x4e,0x03,0x57,0x03, - 4, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x21 '!' - 0x00,0x40,0x40,0x40,0x40,0x00,0x40,0x00, + 4, // 0x21 '!' + 0x00,0x40,0x40,0x40,0x40,0x00,0x40,0x00, - 4, // 0x22 '"' - 0x00,0xa0,0xa0,0x00,0x00,0x00,0x00,0x00, + 4, // 0x22 '"' + 0x00,0xa0,0xa0,0x00,0x00,0x00,0x00,0x00, - 4, // 0x23 '#' - 0x60,0x60,0xf0,0x60,0x60,0xf0,0x60,0x60, + 4, // 0x23 '#' + 0x60,0x60,0xf0,0x60,0x60,0xf0,0x60,0x60, - 4, // 0x24 '$' - 0x40,0x60,0xc0,0xc0,0x60,0x60,0xc0,0x40, + 4, // 0x24 '$' + 0x40,0x60,0xc0,0xc0,0x60,0x60,0xc0,0x40, - 4, // 0x25 '%' - 0x00,0xa0,0x20,0x40,0x40,0x80,0xa0,0x00, + 4, // 0x25 '%' + 0x00,0xa0,0x20,0x40,0x40,0x80,0xa0,0x00, - 4, // 0x26 '&' - 0x00,0x40,0xa0,0xa0,0x40,0xb0,0xa0,0x70, + 4, // 0x26 '&' + 0x00,0x40,0xa0,0xa0,0x40,0xb0,0xa0,0x70, - 4, // 0x27 ''' - 0x00,0x40,0x40,0x00,0x00,0x00,0x00,0x00, + 4, // 0x27 ''' + 0x00,0x40,0x40,0x00,0x00,0x00,0x00,0x00, - 4, // 0x28 '(' - 0x20,0x40,0x80,0x80,0x80,0x80,0x40,0x20, + 4, // 0x28 '(' + 0x20,0x40,0x80,0x80,0x80,0x80,0x40,0x20, - 4, // 0x29 ')' - 0x80,0x40,0x20,0x20,0x20,0x20,0x40,0x80, + 4, // 0x29 ')' + 0x80,0x40,0x20,0x20,0x20,0x20,0x40,0x80, - 4, // 0x2a '*' - 0x00,0xa0,0x40,0xe0,0x40,0xa0,0x00,0x00, + 4, // 0x2a '*' + 0x00,0xa0,0x40,0xe0,0x40,0xa0,0x00,0x00, - 4, // 0x2b '+' - 0x00,0x40,0x40,0xe0,0x40,0x40,0x00,0x00, + 4, // 0x2b '+' + 0x00,0x40,0x40,0xe0,0x40,0x40,0x00,0x00, - 4, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x80, + 4, // 0x2c ',' + 0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x80, - 4, // 0x2d '-' - 0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00, + 4, // 0x2d '-' + 0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00, - 4, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, + 4, // 0x2e '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, - 4, // 0x2f '/' - 0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80, + 4, // 0x2f '/' + 0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80, - 4, // 0x30 '0' - 0x00,0xe0,0xa0,0xa0,0xa0,0xa0,0xe0,0x00, + 4, // 0x30 '0' + 0x00,0xe0,0xa0,0xa0,0xa0,0xa0,0xe0,0x00, - 4, // 0x31 '1' - 0x00,0x40,0xc0,0x40,0x40,0x40,0xe0,0x00, + 4, // 0x31 '1' + 0x00,0x40,0xc0,0x40,0x40,0x40,0xe0,0x00, - 4, // 0x32 '2' - 0x00,0xe0,0xa0,0x20,0x40,0x80,0xe0,0x00, + 4, // 0x32 '2' + 0x00,0xe0,0xa0,0x20,0x40,0x80,0xe0,0x00, - 4, // 0x33 '3' - 0x00,0xe0,0x20,0x40,0x20,0x20,0xe0,0x00, + 4, // 0x33 '3' + 0x00,0xe0,0x20,0x40,0x20,0x20,0xe0,0x00, - 4, // 0x34 '4' - 0x00,0x60,0xa0,0xa0,0xf0,0x20,0x20,0x00, + 4, // 0x34 '4' + 0x00,0x60,0xa0,0xa0,0xf0,0x20,0x20,0x00, - 4, // 0x35 '5' - 0x00,0xe0,0x80,0xc0,0x20,0x20,0xc0,0x00, + 4, // 0x35 '5' + 0x00,0xe0,0x80,0xc0,0x20,0x20,0xc0,0x00, - 4, // 0x36 '6' - 0x00,0x40,0x80,0xe0,0xa0,0xa0,0xe0,0x00, + 4, // 0x36 '6' + 0x00,0x40,0x80,0xe0,0xa0,0xa0,0xe0,0x00, - 4, // 0x37 '7' - 0x00,0xe0,0xa0,0x20,0x40,0x40,0x40,0x00, + 4, // 0x37 '7' + 0x00,0xe0,0xa0,0x20,0x40,0x40,0x40,0x00, - 4, // 0x38 '8' - 0x00,0xe0,0xa0,0x40,0xa0,0xa0,0xe0,0x00, + 4, // 0x38 '8' + 0x00,0xe0,0xa0,0x40,0xa0,0xa0,0xe0,0x00, - 4, // 0x39 '9' - 0x00,0xe0,0xa0,0xe0,0x20,0x20,0x40,0x00, + 4, // 0x39 '9' + 0x00,0xe0,0xa0,0xe0,0x20,0x20,0x40,0x00, - 4, // 0x3a ':' - 0x00,0x00,0x40,0x00,0x00,0x40,0x00,0x00, + 4, // 0x3a ':' + 0x00,0x00,0x40,0x00,0x00,0x40,0x00,0x00, - 4, // 0x3b ';' - 0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x80, + 4, // 0x3b ';' + 0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x80, - 4, // 0x3c '<' - 0x00,0x20,0x40,0x80,0x40,0x20,0x00,0x00, + 4, // 0x3c '<' + 0x00,0x20,0x40,0x80,0x40,0x20,0x00,0x00, - 4, // 0x3d '=' - 0x00,0x00,0xe0,0x00,0xe0,0x00,0x00,0x00, + 4, // 0x3d '=' + 0x00,0x00,0xe0,0x00,0xe0,0x00,0x00,0x00, - 4, // 0x3e '>' - 0x00,0x80,0x40,0x20,0x40,0x80,0x00,0x00, + 4, // 0x3e '>' + 0x00,0x80,0x40,0x20,0x40,0x80,0x00,0x00, - 4, // 0x3f '?' - 0x00,0x40,0xa0,0x20,0x40,0x00,0x40,0x00, + 4, // 0x3f '?' + 0x00,0x40,0xa0,0x20,0x40,0x00,0x40,0x00, - 4, // 0x40 '@' - 0x00,0x40,0xa0,0xe0,0xe0,0x80,0x60,0x00, + 4, // 0x40 '@' + 0x00,0x40,0xa0,0xe0,0xe0,0x80,0x60,0x00, - 4, // 0x41 'A' - 0x00,0x40,0xa0,0xa0,0xe0,0xa0,0xa0,0x00, + 4, // 0x41 'A' + 0x00,0x40,0xa0,0xa0,0xe0,0xa0,0xa0,0x00, - 4, // 0x42 'B' - 0x00,0xc0,0xa0,0xc0,0xa0,0xa0,0xc0,0x00, + 4, // 0x42 'B' + 0x00,0xc0,0xa0,0xc0,0xa0,0xa0,0xc0,0x00, - 4, // 0x43 'C' - 0x00,0x40,0xa0,0x80,0x80,0xa0,0x40,0x00, + 4, // 0x43 'C' + 0x00,0x40,0xa0,0x80,0x80,0xa0,0x40,0x00, - 4, // 0x44 'D' - 0x00,0xc0,0xa0,0xa0,0xa0,0xa0,0xc0,0x00, + 4, // 0x44 'D' + 0x00,0xc0,0xa0,0xa0,0xa0,0xa0,0xc0,0x00, - 4, // 0x45 'E' - 0x00,0xe0,0x80,0xc0,0x80,0x80,0xe0,0x00, + 4, // 0x45 'E' + 0x00,0xe0,0x80,0xc0,0x80,0x80,0xe0,0x00, - 4, // 0x46 'F' - 0x00,0xe0,0x80,0xc0,0x80,0x80,0x80,0x00, + 4, // 0x46 'F' + 0x00,0xe0,0x80,0xc0,0x80,0x80,0x80,0x00, - 4, // 0x47 'G' - 0x00,0x60,0x80,0xa0,0xa0,0xa0,0x40,0x00, + 4, // 0x47 'G' + 0x00,0x60,0x80,0xa0,0xa0,0xa0,0x40,0x00, - 4, // 0x48 'H' - 0x00,0xa0,0xa0,0xe0,0xa0,0xa0,0xa0,0x00, + 4, // 0x48 'H' + 0x00,0xa0,0xa0,0xe0,0xa0,0xa0,0xa0,0x00, - 4, // 0x49 'I' - 0x00,0xe0,0x40,0x40,0x40,0x40,0xe0,0x00, + 4, // 0x49 'I' + 0x00,0xe0,0x40,0x40,0x40,0x40,0xe0,0x00, - 4, // 0x4a 'J' - 0x00,0x20,0x20,0x20,0x20,0xa0,0x40,0x00, + 4, // 0x4a 'J' + 0x00,0x20,0x20,0x20,0x20,0xa0,0x40,0x00, - 4, // 0x4b 'K' - 0x00,0xa0,0xa0,0xc0,0xc0,0xa0,0xa0,0x00, + 4, // 0x4b 'K' + 0x00,0xa0,0xa0,0xc0,0xc0,0xa0,0xa0,0x00, - 4, // 0x4c 'L' - 0x00,0x80,0x80,0x80,0x80,0x80,0xe0,0x00, + 4, // 0x4c 'L' + 0x00,0x80,0x80,0x80,0x80,0x80,0xe0,0x00, - 4, // 0x4d 'M' - 0x00,0xa0,0xe0,0xa0,0xa0,0xa0,0xa0,0x00, + 4, // 0x4d 'M' + 0x00,0xa0,0xe0,0xa0,0xa0,0xa0,0xa0,0x00, - 4, // 0x4e 'N' - 0x00,0x90,0x90,0xd0,0xb0,0x90,0x90,0x00, + 4, // 0x4e 'N' + 0x00,0x90,0x90,0xd0,0xb0,0x90,0x90,0x00, - 4, // 0x4f 'O' - 0x00,0x40,0xa0,0xa0,0xa0,0xa0,0x40,0x00, + 4, // 0x4f 'O' + 0x00,0x40,0xa0,0xa0,0xa0,0xa0,0x40,0x00, - 4, // 0x50 'P' - 0x00,0xc0,0xa0,0xa0,0xc0,0x80,0x80,0x00, + 4, // 0x50 'P' + 0x00,0xc0,0xa0,0xa0,0xc0,0x80,0x80,0x00, - 4, // 0x51 'Q' - 0x00,0x40,0xa0,0xa0,0xa0,0xa0,0x60,0x00, + 4, // 0x51 'Q' + 0x00,0x40,0xa0,0xa0,0xa0,0xa0,0x60,0x00, - 4, // 0x52 'R' - 0x00,0xc0,0xa0,0xa0,0xc0,0xc0,0xa0,0x00, + 4, // 0x52 'R' + 0x00,0xc0,0xa0,0xa0,0xc0,0xc0,0xa0,0x00, - 4, // 0x53 'S' - 0x00,0x60,0x80,0x40,0x20,0x20,0xc0,0x00, + 4, // 0x53 'S' + 0x00,0x60,0x80,0x40,0x20,0x20,0xc0,0x00, - 4, // 0x54 'T' - 0x00,0xe0,0x40,0x40,0x40,0x40,0x40,0x00, + 4, // 0x54 'T' + 0x00,0xe0,0x40,0x40,0x40,0x40,0x40,0x00, - 4, // 0x55 'U' - 0x00,0xa0,0xa0,0xa0,0xa0,0xa0,0x40,0x00, + 4, // 0x55 'U' + 0x00,0xa0,0xa0,0xa0,0xa0,0xa0,0x40,0x00, - 4, // 0x56 'V' - 0x00,0xa0,0xa0,0xa0,0xa0,0x40,0x40,0x00, + 4, // 0x56 'V' + 0x00,0xa0,0xa0,0xa0,0xa0,0x40,0x40,0x00, - 4, // 0x57 'W' - 0x00,0xa0,0xa0,0xa0,0xa0,0xe0,0xa0,0x00, + 4, // 0x57 'W' + 0x00,0xa0,0xa0,0xa0,0xa0,0xe0,0xa0,0x00, - 4, // 0x58 'X' - 0x00,0xa0,0xa0,0x40,0xa0,0xa0,0xa0,0x00, + 4, // 0x58 'X' + 0x00,0xa0,0xa0,0x40,0xa0,0xa0,0xa0,0x00, - 4, // 0x59 'Y' - 0x00,0xa0,0xa0,0x40,0x40,0x40,0x40,0x00, + 4, // 0x59 'Y' + 0x00,0xa0,0xa0,0x40,0x40,0x40,0x40,0x00, - 4, // 0x5a 'Z' - 0x00,0xe0,0x20,0x40,0x40,0x80,0xe0,0x00, + 4, // 0x5a 'Z' + 0x00,0xe0,0x20,0x40,0x40,0x80,0xe0,0x00, - 4, // 0x5b '[' - 0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0xc0, + 4, // 0x5b '[' + 0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0xc0, - 4, // 0x5c '\' - 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10, + 4, // 0x5c '\' + 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10, - 4, // 0x5d ']' - 0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0xc0, + 4, // 0x5d ']' + 0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0xc0, - 4, // 0x5e '^' - 0x00,0x40,0xa0,0x00,0x00,0x00,0x00,0x00, + 4, // 0x5e '^' + 0x00,0x40,0xa0,0x00,0x00,0x00,0x00,0x00, - 4, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0, + 4, // 0x5f '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0, - 4, // 0x60 '`' - 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00, + 4, // 0x60 '`' + 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00, - 4, // 0x61 'a' - 0x00,0x00,0x60,0xa0,0xa0,0xa0,0x70,0x00, + 4, // 0x61 'a' + 0x00,0x00,0x60,0xa0,0xa0,0xa0,0x70,0x00, - 4, // 0x62 'b' - 0x00,0x80,0x80,0xc0,0xa0,0xa0,0xc0,0x00, + 4, // 0x62 'b' + 0x00,0x80,0x80,0xc0,0xa0,0xa0,0xc0,0x00, - 4, // 0x63 'c' - 0x00,0x00,0x40,0xa0,0x80,0xa0,0x40,0x00, + 4, // 0x63 'c' + 0x00,0x00,0x40,0xa0,0x80,0xa0,0x40,0x00, - 4, // 0x64 'd' - 0x00,0x20,0x20,0x60,0xa0,0xa0,0x60,0x00, + 4, // 0x64 'd' + 0x00,0x20,0x20,0x60,0xa0,0xa0,0x60,0x00, - 4, // 0x65 'e' - 0x00,0x00,0x40,0xa0,0xe0,0x80,0x60,0x00, + 4, // 0x65 'e' + 0x00,0x00,0x40,0xa0,0xe0,0x80,0x60,0x00, - 4, // 0x66 'f' - 0x00,0x20,0x40,0x40,0xe0,0x40,0x40,0x00, + 4, // 0x66 'f' + 0x00,0x20,0x40,0x40,0xe0,0x40,0x40,0x00, - 4, // 0x67 'g' - 0x00,0x00,0x60,0xa0,0xa0,0x60,0x20,0xc0, + 4, // 0x67 'g' + 0x00,0x00,0x60,0xa0,0xa0,0x60,0x20,0xc0, - 4, // 0x68 'h' - 0x00,0x80,0x80,0xc0,0xa0,0xa0,0xa0,0x00, + 4, // 0x68 'h' + 0x00,0x80,0x80,0xc0,0xa0,0xa0,0xa0,0x00, - 4, // 0x69 'i' - 0x00,0x40,0x00,0xc0,0x40,0x40,0xe0,0x00, + 4, // 0x69 'i' + 0x00,0x40,0x00,0xc0,0x40,0x40,0xe0,0x00, - 4, // 0x6a 'j' - 0x00,0x40,0x00,0xc0,0x40,0x40,0x40,0x80, + 4, // 0x6a 'j' + 0x00,0x40,0x00,0xc0,0x40,0x40,0x40,0x80, - 4, // 0x6b 'k' - 0x00,0x80,0x80,0xa0,0xc0,0xc0,0xa0,0x00, + 4, // 0x6b 'k' + 0x00,0x80,0x80,0xa0,0xc0,0xc0,0xa0,0x00, - 4, // 0x6c 'l' - 0x00,0xc0,0x40,0x40,0x40,0x40,0xe0,0x00, + 4, // 0x6c 'l' + 0x00,0xc0,0x40,0x40,0x40,0x40,0xe0,0x00, - 4, // 0x6d 'm' - 0x00,0x00,0xa0,0xf0,0xf0,0xf0,0x90,0x00, + 4, // 0x6d 'm' + 0x00,0x00,0xa0,0xf0,0xf0,0xf0,0x90,0x00, - 4, // 0x6e 'n' - 0x00,0x00,0xc0,0xa0,0xa0,0xa0,0xa0,0x00, + 4, // 0x6e 'n' + 0x00,0x00,0xc0,0xa0,0xa0,0xa0,0xa0,0x00, - 4, // 0x6f 'o' - 0x00,0x00,0x40,0xa0,0xa0,0xa0,0x40,0x00, + 4, // 0x6f 'o' + 0x00,0x00,0x40,0xa0,0xa0,0xa0,0x40,0x00, - 4, // 0x70 'p' - 0x00,0x00,0xc0,0xa0,0xa0,0xc0,0x80,0x80, + 4, // 0x70 'p' + 0x00,0x00,0xc0,0xa0,0xa0,0xc0,0x80,0x80, - 4, // 0x71 'q' - 0x00,0x00,0x60,0xa0,0xa0,0x60,0x20,0x20, + 4, // 0x71 'q' + 0x00,0x00,0x60,0xa0,0xa0,0x60,0x20,0x20, - 4, // 0x72 'r' - 0x00,0x00,0xa0,0x50,0x40,0x40,0x40,0x00, + 4, // 0x72 'r' + 0x00,0x00,0xa0,0x50,0x40,0x40,0x40,0x00, - 4, // 0x73 's' - 0x00,0x00,0x60,0x80,0x40,0x20,0xc0,0x00, + 4, // 0x73 's' + 0x00,0x00,0x60,0x80,0x40,0x20,0xc0,0x00, - 4, // 0x74 't' - 0x00,0x40,0x40,0xe0,0x40,0x40,0x20,0x00, + 4, // 0x74 't' + 0x00,0x40,0x40,0xe0,0x40,0x40,0x20,0x00, - 4, // 0x75 'u' - 0x00,0x00,0xa0,0xa0,0xa0,0xa0,0x60,0x00, + 4, // 0x75 'u' + 0x00,0x00,0xa0,0xa0,0xa0,0xa0,0x60,0x00, - 4, // 0x76 'v' - 0x00,0x00,0xa0,0xa0,0xa0,0x40,0x40,0x00, + 4, // 0x76 'v' + 0x00,0x00,0xa0,0xa0,0xa0,0x40,0x40,0x00, - 4, // 0x77 'w' - 0x00,0x00,0xa0,0xa0,0xa0,0xe0,0xa0,0x00, + 4, // 0x77 'w' + 0x00,0x00,0xa0,0xa0,0xa0,0xe0,0xa0,0x00, - 4, // 0x78 'x' - 0x00,0x00,0xa0,0xa0,0x40,0xa0,0xa0,0x00, + 4, // 0x78 'x' + 0x00,0x00,0xa0,0xa0,0x40,0xa0,0xa0,0x00, - 4, // 0x79 'y' - 0x00,0x00,0xa0,0xa0,0xa0,0x60,0x20,0xc0, + 4, // 0x79 'y' + 0x00,0x00,0xa0,0xa0,0xa0,0x60,0x20,0xc0, - 4, // 0x7a 'z' - 0x00,0x00,0xe0,0x20,0x40,0x80,0xe0,0x00, + 4, // 0x7a 'z' + 0x00,0x00,0xe0,0x20,0x40,0x80,0xe0,0x00, - 4, // 0x7b '{' - 0x10,0x20,0x20,0xc0,0x20,0x20,0x10,0x00, + 4, // 0x7b '{' + 0x10,0x20,0x20,0xc0,0x20,0x20,0x10,0x00, - 4, // 0x7c '|' - 0x00,0x40,0x40,0x40,0x00,0x40,0x40,0x40, + 4, // 0x7c '|' + 0x00,0x40,0x40,0x40,0x00,0x40,0x40,0x40, - 4, // 0x7d '}' - 0x80,0x40,0x40,0x30,0x40,0x40,0x80,0x00, + 4, // 0x7d '}' + 0x80,0x40,0x40,0x30,0x40,0x40,0x80,0x00, - 4, // 0x7e '~' - 0x00,0x50,0xa0,0x00,0x00,0x00,0x00,0x00, + 4, // 0x7e '~' + 0x00,0x50,0xa0,0x00,0x00,0x00,0x00,0x00, - 4, // 0x7f '' - 0x00,0x00,0x00,0x60,0x90,0xf0,0x00,0x00, - 0 - }; + 4, // 0x7f '' + 0x00,0x00,0x00,0x60,0x90,0xf0,0x00,0x00, + 0 +}; - const int8u gse5x7[] = - { - 7, 0, 32, 128-32, +const int8u gse5x7[] = +{ + 7, 0, 32, 128-32, - 0x00,0x00,0x08,0x00,0x10,0x00,0x18,0x00,0x20,0x00,0x28,0x00,0x30,0x00,0x38,0x00,0x40,0x00, - 0x48,0x00,0x50,0x00,0x58,0x00,0x60,0x00,0x68,0x00,0x70,0x00,0x78,0x00,0x80,0x00,0x88,0x00, - 0x90,0x00,0x98,0x00,0xa0,0x00,0xa8,0x00,0xb0,0x00,0xb8,0x00,0xc0,0x00,0xc8,0x00,0xd0,0x00, - 0xd8,0x00,0xe0,0x00,0xe8,0x00,0xf0,0x00,0xf8,0x00,0x00,0x01,0x08,0x01,0x10,0x01,0x18,0x01, - 0x20,0x01,0x28,0x01,0x30,0x01,0x38,0x01,0x40,0x01,0x48,0x01,0x50,0x01,0x58,0x01,0x60,0x01, - 0x68,0x01,0x70,0x01,0x78,0x01,0x80,0x01,0x88,0x01,0x90,0x01,0x98,0x01,0xa0,0x01,0xa8,0x01, - 0xb0,0x01,0xb8,0x01,0xc0,0x01,0xc8,0x01,0xd0,0x01,0xd8,0x01,0xe0,0x01,0xe8,0x01,0xf0,0x01, - 0xf8,0x01,0x00,0x02,0x08,0x02,0x10,0x02,0x18,0x02,0x20,0x02,0x28,0x02,0x30,0x02,0x38,0x02, - 0x40,0x02,0x48,0x02,0x50,0x02,0x58,0x02,0x60,0x02,0x68,0x02,0x70,0x02,0x78,0x02,0x80,0x02, - 0x88,0x02,0x90,0x02,0x98,0x02,0xa0,0x02,0xa8,0x02,0xb0,0x02,0xb8,0x02,0xc0,0x02,0xc8,0x02, - 0xd0,0x02,0xd8,0x02,0xe0,0x02,0xe8,0x02,0xf0,0x02,0xf8,0x02, + 0x00,0x00,0x08,0x00,0x10,0x00,0x18,0x00,0x20,0x00,0x28,0x00,0x30,0x00,0x38,0x00,0x40,0x00, + 0x48,0x00,0x50,0x00,0x58,0x00,0x60,0x00,0x68,0x00,0x70,0x00,0x78,0x00,0x80,0x00,0x88,0x00, + 0x90,0x00,0x98,0x00,0xa0,0x00,0xa8,0x00,0xb0,0x00,0xb8,0x00,0xc0,0x00,0xc8,0x00,0xd0,0x00, + 0xd8,0x00,0xe0,0x00,0xe8,0x00,0xf0,0x00,0xf8,0x00,0x00,0x01,0x08,0x01,0x10,0x01,0x18,0x01, + 0x20,0x01,0x28,0x01,0x30,0x01,0x38,0x01,0x40,0x01,0x48,0x01,0x50,0x01,0x58,0x01,0x60,0x01, + 0x68,0x01,0x70,0x01,0x78,0x01,0x80,0x01,0x88,0x01,0x90,0x01,0x98,0x01,0xa0,0x01,0xa8,0x01, + 0xb0,0x01,0xb8,0x01,0xc0,0x01,0xc8,0x01,0xd0,0x01,0xd8,0x01,0xe0,0x01,0xe8,0x01,0xf0,0x01, + 0xf8,0x01,0x00,0x02,0x08,0x02,0x10,0x02,0x18,0x02,0x20,0x02,0x28,0x02,0x30,0x02,0x38,0x02, + 0x40,0x02,0x48,0x02,0x50,0x02,0x58,0x02,0x60,0x02,0x68,0x02,0x70,0x02,0x78,0x02,0x80,0x02, + 0x88,0x02,0x90,0x02,0x98,0x02,0xa0,0x02,0xa8,0x02,0xb0,0x02,0xb8,0x02,0xc0,0x02,0xc8,0x02, + 0xd0,0x02,0xd8,0x02,0xe0,0x02,0xe8,0x02,0xf0,0x02,0xf8,0x02, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x00,0x20,0x00, + 5, // 0x21 '!' + 0x00,0x20,0x20,0x20,0x00,0x20,0x00, - 5, // 0x22 '"' - 0x00,0x50,0x50,0x00,0x00,0x00,0x00, + 5, // 0x22 '"' + 0x00,0x50,0x50,0x00,0x00,0x00,0x00, - 5, // 0x23 '#' - 0x00,0x50,0xf8,0x50,0xf8,0x50,0x00, + 5, // 0x23 '#' + 0x00,0x50,0xf8,0x50,0xf8,0x50,0x00, - 5, // 0x24 '$' - 0x20,0x78,0xa0,0x70,0x28,0xf0,0x20, + 5, // 0x24 '$' + 0x20,0x78,0xa0,0x70,0x28,0xf0,0x20, - 5, // 0x25 '%' - 0x00,0x88,0x10,0x20,0x40,0x88,0x00, + 5, // 0x25 '%' + 0x00,0x88,0x10,0x20,0x40,0x88,0x00, - 5, // 0x26 '&' - 0x00,0x40,0xa0,0x68,0x90,0x68,0x00, + 5, // 0x26 '&' + 0x00,0x40,0xa0,0x68,0x90,0x68,0x00, - 5, // 0x27 ''' - 0x00,0x20,0x20,0x00,0x00,0x00,0x00, + 5, // 0x27 ''' + 0x00,0x20,0x20,0x00,0x00,0x00,0x00, - 5, // 0x28 '(' - 0x10,0x20,0x40,0x40,0x40,0x20,0x10, + 5, // 0x28 '(' + 0x10,0x20,0x40,0x40,0x40,0x20,0x10, - 5, // 0x29 ')' - 0x80,0x40,0x20,0x20,0x20,0x40,0x80, + 5, // 0x29 ')' + 0x80,0x40,0x20,0x20,0x20,0x40,0x80, - 5, // 0x2a '*' - 0x00,0x20,0xa8,0x70,0xa8,0x20,0x00, + 5, // 0x2a '*' + 0x00,0x20,0xa8,0x70,0xa8,0x20,0x00, - 5, // 0x2b '+' - 0x00,0x20,0x20,0xf8,0x20,0x20,0x00, + 5, // 0x2b '+' + 0x00,0x20,0x20,0xf8,0x20,0x20,0x00, - 5, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x20,0x20,0x40, + 5, // 0x2c ',' + 0x00,0x00,0x00,0x00,0x20,0x20,0x40, - 5, // 0x2d '-' - 0x00,0x00,0x00,0xf0,0x00,0x00,0x00, + 5, // 0x2d '-' + 0x00,0x00,0x00,0xf0,0x00,0x00,0x00, - 5, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x40,0x00, + 5, // 0x2e '.' + 0x00,0x00,0x00,0x00,0x00,0x40,0x00, - 5, // 0x2f '/' - 0x00,0x08,0x10,0x20,0x40,0x80,0x00, + 5, // 0x2f '/' + 0x00,0x08,0x10,0x20,0x40,0x80,0x00, - 5, // 0x30 '0' - 0x00,0x60,0x90,0x90,0x90,0x60,0x00, + 5, // 0x30 '0' + 0x00,0x60,0x90,0x90,0x90,0x60,0x00, - 5, // 0x31 '1' - 0x00,0x20,0x60,0x20,0x20,0x70,0x00, + 5, // 0x31 '1' + 0x00,0x20,0x60,0x20,0x20,0x70,0x00, - 5, // 0x32 '2' - 0x00,0x60,0x90,0x20,0x40,0xf0,0x00, + 5, // 0x32 '2' + 0x00,0x60,0x90,0x20,0x40,0xf0,0x00, - 5, // 0x33 '3' - 0x00,0xf0,0x20,0x60,0x10,0xe0,0x00, + 5, // 0x33 '3' + 0x00,0xf0,0x20,0x60,0x10,0xe0,0x00, - 5, // 0x34 '4' - 0x00,0x30,0x50,0x90,0xf0,0x10,0x00, + 5, // 0x34 '4' + 0x00,0x30,0x50,0x90,0xf0,0x10,0x00, - 5, // 0x35 '5' - 0x00,0xf0,0x80,0xe0,0x10,0xe0,0x00, + 5, // 0x35 '5' + 0x00,0xf0,0x80,0xe0,0x10,0xe0,0x00, - 5, // 0x36 '6' - 0x00,0x60,0x80,0xe0,0x90,0x60,0x00, + 5, // 0x36 '6' + 0x00,0x60,0x80,0xe0,0x90,0x60,0x00, - 5, // 0x37 '7' - 0x00,0xf0,0x90,0x20,0x40,0x40,0x00, + 5, // 0x37 '7' + 0x00,0xf0,0x90,0x20,0x40,0x40,0x00, - 5, // 0x38 '8' - 0x00,0x60,0x90,0x60,0x90,0x60,0x00, + 5, // 0x38 '8' + 0x00,0x60,0x90,0x60,0x90,0x60,0x00, - 5, // 0x39 '9' - 0x00,0x60,0x90,0x70,0x10,0x60,0x00, + 5, // 0x39 '9' + 0x00,0x60,0x90,0x70,0x10,0x60,0x00, - 5, // 0x3a ':' - 0x00,0x00,0x20,0x00,0x20,0x00,0x00, + 5, // 0x3a ':' + 0x00,0x00,0x20,0x00,0x20,0x00,0x00, - 5, // 0x3b ';' - 0x00,0x00,0x20,0x00,0x20,0x20,0x40, + 5, // 0x3b ';' + 0x00,0x00,0x20,0x00,0x20,0x20,0x40, - 5, // 0x3c '<' - 0x00,0x10,0x20,0x40,0x20,0x10,0x00, + 5, // 0x3c '<' + 0x00,0x10,0x20,0x40,0x20,0x10,0x00, - 5, // 0x3d '=' - 0x00,0x00,0xf0,0x00,0xf0,0x00,0x00, + 5, // 0x3d '=' + 0x00,0x00,0xf0,0x00,0xf0,0x00,0x00, - 5, // 0x3e '>' - 0x00,0x80,0x40,0x20,0x40,0x80,0x00, + 5, // 0x3e '>' + 0x00,0x80,0x40,0x20,0x40,0x80,0x00, - 5, // 0x3f '?' - 0x00,0x60,0x90,0x20,0x00,0x20,0x00, + 5, // 0x3f '?' + 0x00,0x60,0x90,0x20,0x00,0x20,0x00, - 5, // 0x40 '@' - 0x00,0x60,0x90,0xb0,0x80,0x70,0x00, + 5, // 0x40 '@' + 0x00,0x60,0x90,0xb0,0x80,0x70,0x00, - 5, // 0x41 'A' - 0x00,0x60,0x90,0xf0,0x90,0x90,0x00, + 5, // 0x41 'A' + 0x00,0x60,0x90,0xf0,0x90,0x90,0x00, - 5, // 0x42 'B' - 0x00,0xe0,0x90,0xe0,0x90,0xe0,0x00, + 5, // 0x42 'B' + 0x00,0xe0,0x90,0xe0,0x90,0xe0,0x00, - 5, // 0x43 'C' - 0x00,0x60,0x90,0x80,0x90,0x60,0x00, + 5, // 0x43 'C' + 0x00,0x60,0x90,0x80,0x90,0x60,0x00, - 5, // 0x44 'D' - 0x00,0xe0,0x90,0x90,0x90,0xe0,0x00, + 5, // 0x44 'D' + 0x00,0xe0,0x90,0x90,0x90,0xe0,0x00, - 5, // 0x45 'E' - 0x00,0xf0,0x80,0xe0,0x80,0xf0,0x00, + 5, // 0x45 'E' + 0x00,0xf0,0x80,0xe0,0x80,0xf0,0x00, - 5, // 0x46 'F' - 0x00,0xf0,0x80,0xe0,0x80,0x80,0x00, + 5, // 0x46 'F' + 0x00,0xf0,0x80,0xe0,0x80,0x80,0x00, - 5, // 0x47 'G' - 0x00,0x70,0x80,0xb0,0x90,0x60,0x00, + 5, // 0x47 'G' + 0x00,0x70,0x80,0xb0,0x90,0x60,0x00, - 5, // 0x48 'H' - 0x00,0x90,0x90,0xf0,0x90,0x90,0x00, + 5, // 0x48 'H' + 0x00,0x90,0x90,0xf0,0x90,0x90,0x00, - 5, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x70,0x00, + 5, // 0x49 'I' + 0x00,0x70,0x20,0x20,0x20,0x70,0x00, - 5, // 0x4a 'J' - 0x00,0x70,0x20,0x20,0xa0,0x40,0x00, + 5, // 0x4a 'J' + 0x00,0x70,0x20,0x20,0xa0,0x40,0x00, - 5, // 0x4b 'K' - 0x00,0x90,0xa0,0xc0,0xa0,0x90,0x00, + 5, // 0x4b 'K' + 0x00,0x90,0xa0,0xc0,0xa0,0x90,0x00, - 5, // 0x4c 'L' - 0x00,0x80,0x80,0x80,0x80,0xf0,0x00, + 5, // 0x4c 'L' + 0x00,0x80,0x80,0x80,0x80,0xf0,0x00, - 5, // 0x4d 'M' - 0x00,0x90,0xf0,0x90,0x90,0x90,0x00, + 5, // 0x4d 'M' + 0x00,0x90,0xf0,0x90,0x90,0x90,0x00, - 5, // 0x4e 'N' - 0x00,0x90,0xd0,0xb0,0x90,0x90,0x00, + 5, // 0x4e 'N' + 0x00,0x90,0xd0,0xb0,0x90,0x90,0x00, - 5, // 0x4f 'O' - 0x00,0x60,0x90,0x90,0x90,0x60,0x00, + 5, // 0x4f 'O' + 0x00,0x60,0x90,0x90,0x90,0x60,0x00, - 5, // 0x50 'P' - 0x00,0xe0,0x90,0xe0,0x80,0x80,0x00, + 5, // 0x50 'P' + 0x00,0xe0,0x90,0xe0,0x80,0x80,0x00, - 5, // 0x51 'Q' - 0x00,0x60,0x90,0x90,0xa0,0x50,0x00, + 5, // 0x51 'Q' + 0x00,0x60,0x90,0x90,0xa0,0x50,0x00, - 5, // 0x52 'R' - 0x00,0xe0,0x90,0xe0,0xa0,0x90,0x00, + 5, // 0x52 'R' + 0x00,0xe0,0x90,0xe0,0xa0,0x90,0x00, - 5, // 0x53 'S' - 0x00,0x70,0x80,0x60,0x10,0xe0,0x00, + 5, // 0x53 'S' + 0x00,0x70,0x80,0x60,0x10,0xe0,0x00, - 5, // 0x54 'T' - 0x00,0x70,0x20,0x20,0x20,0x20,0x00, + 5, // 0x54 'T' + 0x00,0x70,0x20,0x20,0x20,0x20,0x00, - 5, // 0x55 'U' - 0x00,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x55 'U' + 0x00,0x90,0x90,0x90,0x90,0x60,0x00, - 5, // 0x56 'V' - 0x00,0x50,0x50,0x50,0x20,0x20,0x00, + 5, // 0x56 'V' + 0x00,0x50,0x50,0x50,0x20,0x20,0x00, - 5, // 0x57 'W' - 0x00,0x90,0x90,0x90,0xf0,0x90,0x00, + 5, // 0x57 'W' + 0x00,0x90,0x90,0x90,0xf0,0x90,0x00, - 5, // 0x58 'X' - 0x00,0x90,0x90,0x60,0x90,0x90,0x00, + 5, // 0x58 'X' + 0x00,0x90,0x90,0x60,0x90,0x90,0x00, - 5, // 0x59 'Y' - 0x00,0x50,0x50,0x20,0x20,0x20,0x00, + 5, // 0x59 'Y' + 0x00,0x50,0x50,0x20,0x20,0x20,0x00, - 5, // 0x5a 'Z' - 0x00,0xf0,0x10,0x20,0x40,0xf0,0x00, + 5, // 0x5a 'Z' + 0x00,0xf0,0x10,0x20,0x40,0xf0,0x00, - 5, // 0x5b '[' - 0x70,0x40,0x40,0x40,0x40,0x40,0x70, + 5, // 0x5b '[' + 0x70,0x40,0x40,0x40,0x40,0x40,0x70, - 5, // 0x5c '\' - 0x00,0x80,0x40,0x20,0x10,0x08,0x00, + 5, // 0x5c '\' + 0x00,0x80,0x40,0x20,0x10,0x08,0x00, - 5, // 0x5d ']' - 0xe0,0x20,0x20,0x20,0x20,0x20,0xe0, + 5, // 0x5d ']' + 0xe0,0x20,0x20,0x20,0x20,0x20,0xe0, - 5, // 0x5e '^' - 0x00,0x20,0x50,0x00,0x00,0x00,0x00, + 5, // 0x5e '^' + 0x00,0x20,0x50,0x00,0x00,0x00,0x00, - 5, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0xf8,0x00, + 5, // 0x5f '_' + 0x00,0x00,0x00,0x00,0x00,0xf8,0x00, - 5, // 0x60 '`' - 0x00,0x40,0x20,0x00,0x00,0x00,0x00, + 5, // 0x60 '`' + 0x00,0x40,0x20,0x00,0x00,0x00,0x00, - 5, // 0x61 'a' - 0x00,0x00,0x60,0xa0,0xa0,0x50,0x00, + 5, // 0x61 'a' + 0x00,0x00,0x60,0xa0,0xa0,0x50,0x00, - 5, // 0x62 'b' - 0x00,0x80,0x80,0xe0,0x90,0xe0,0x00, + 5, // 0x62 'b' + 0x00,0x80,0x80,0xe0,0x90,0xe0,0x00, - 5, // 0x63 'c' - 0x00,0x00,0x70,0x80,0x80,0x70,0x00, + 5, // 0x63 'c' + 0x00,0x00,0x70,0x80,0x80,0x70,0x00, - 5, // 0x64 'd' - 0x00,0x10,0x10,0x70,0x90,0x70,0x00, + 5, // 0x64 'd' + 0x00,0x10,0x10,0x70,0x90,0x70,0x00, - 5, // 0x65 'e' - 0x00,0x00,0x60,0xf0,0x80,0x70,0x00, + 5, // 0x65 'e' + 0x00,0x00,0x60,0xf0,0x80,0x70,0x00, - 5, // 0x66 'f' - 0x00,0x30,0x40,0xe0,0x40,0x40,0x00, + 5, // 0x66 'f' + 0x00,0x30,0x40,0xe0,0x40,0x40,0x00, - 5, // 0x67 'g' - 0x00,0x00,0x70,0x90,0x70,0x10,0x60, + 5, // 0x67 'g' + 0x00,0x00,0x70,0x90,0x70,0x10,0x60, - 5, // 0x68 'h' - 0x00,0x80,0x80,0xe0,0x90,0x90,0x00, + 5, // 0x68 'h' + 0x00,0x80,0x80,0xe0,0x90,0x90,0x00, - 5, // 0x69 'i' - 0x20,0x00,0x60,0x20,0x20,0x70,0x00, + 5, // 0x69 'i' + 0x20,0x00,0x60,0x20,0x20,0x70,0x00, - 5, // 0x6a 'j' - 0x20,0x00,0x60,0x20,0x20,0xa0,0x40, + 5, // 0x6a 'j' + 0x20,0x00,0x60,0x20,0x20,0xa0,0x40, - 5, // 0x6b 'k' - 0x80,0x80,0x90,0xa0,0xe0,0x90,0x00, + 5, // 0x6b 'k' + 0x80,0x80,0x90,0xa0,0xe0,0x90,0x00, - 5, // 0x6c 'l' - 0x00,0x60,0x20,0x20,0x20,0x70,0x00, + 5, // 0x6c 'l' + 0x00,0x60,0x20,0x20,0x20,0x70,0x00, - 5, // 0x6d 'm' - 0x00,0x00,0xa0,0xf0,0xf0,0x90,0x00, + 5, // 0x6d 'm' + 0x00,0x00,0xa0,0xf0,0xf0,0x90,0x00, - 5, // 0x6e 'n' - 0x00,0x00,0xa0,0xd0,0x90,0x90,0x00, + 5, // 0x6e 'n' + 0x00,0x00,0xa0,0xd0,0x90,0x90,0x00, - 5, // 0x6f 'o' - 0x00,0x00,0x60,0x90,0x90,0x60,0x00, + 5, // 0x6f 'o' + 0x00,0x00,0x60,0x90,0x90,0x60,0x00, - 5, // 0x70 'p' - 0x00,0x00,0xe0,0x90,0xe0,0x80,0x80, + 5, // 0x70 'p' + 0x00,0x00,0xe0,0x90,0xe0,0x80,0x80, - 5, // 0x71 'q' - 0x00,0x00,0x70,0x90,0x70,0x10,0x10, + 5, // 0x71 'q' + 0x00,0x00,0x70,0x90,0x70,0x10,0x10, - 5, // 0x72 'r' - 0x00,0x00,0xe0,0x90,0x80,0x80,0x00, + 5, // 0x72 'r' + 0x00,0x00,0xe0,0x90,0x80,0x80,0x00, - 5, // 0x73 's' - 0x00,0x00,0x70,0xe0,0x10,0xe0,0x00, + 5, // 0x73 's' + 0x00,0x00,0x70,0xe0,0x10,0xe0,0x00, - 5, // 0x74 't' - 0x40,0x40,0xe0,0x40,0x40,0x70,0x00, + 5, // 0x74 't' + 0x40,0x40,0xe0,0x40,0x40,0x70,0x00, - 5, // 0x75 'u' - 0x00,0x00,0x90,0x90,0x90,0x70,0x00, + 5, // 0x75 'u' + 0x00,0x00,0x90,0x90,0x90,0x70,0x00, - 5, // 0x76 'v' - 0x00,0x00,0x50,0x50,0x50,0x20,0x00, + 5, // 0x76 'v' + 0x00,0x00,0x50,0x50,0x50,0x20,0x00, - 5, // 0x77 'w' - 0x00,0x00,0x90,0x90,0xf0,0x90,0x00, + 5, // 0x77 'w' + 0x00,0x00,0x90,0x90,0xf0,0x90,0x00, - 5, // 0x78 'x' - 0x00,0x00,0x90,0x60,0x60,0x90,0x00, + 5, // 0x78 'x' + 0x00,0x00,0x90,0x60,0x60,0x90,0x00, - 5, // 0x79 'y' - 0x00,0x00,0x90,0x90,0x70,0x10,0x60, + 5, // 0x79 'y' + 0x00,0x00,0x90,0x90,0x70,0x10,0x60, - 5, // 0x7a 'z' - 0x00,0x00,0xf0,0x20,0x40,0xf0,0x00, + 5, // 0x7a 'z' + 0x00,0x00,0xf0,0x20,0x40,0xf0,0x00, - 5, // 0x7b '{' - 0x10,0x20,0x20,0xc0,0x20,0x20,0x10, + 5, // 0x7b '{' + 0x10,0x20,0x20,0xc0,0x20,0x20,0x10, - 5, // 0x7c '|' - 0x20,0x20,0x20,0x00,0x20,0x20,0x20, + 5, // 0x7c '|' + 0x20,0x20,0x20,0x00,0x20,0x20,0x20, - 5, // 0x7d '}' - 0x40,0x20,0x20,0x18,0x20,0x20,0x40, + 5, // 0x7d '}' + 0x40,0x20,0x20,0x18,0x20,0x20,0x40, - 5, // 0x7e '~' - 0x00,0x40,0xa8,0x10,0x00,0x00,0x00, + 5, // 0x7e '~' + 0x00,0x40,0xa8,0x10,0x00,0x00,0x00, - 5, // 0x7f '' - 0x00,0x00,0x20,0x50,0x88,0xf8,0x00, - 0 - }; + 5, // 0x7f '' + 0x00,0x00,0x20,0x50,0x88,0xf8,0x00, + 0 +}; - const int8u gse5x9[] = - { - 9, 0, 32, 128-32, +const int8u gse5x9[] = +{ + 9, 0, 32, 128-32, - 0x00,0x00,0x0a,0x00,0x14,0x00,0x1e,0x00,0x28,0x00,0x32,0x00,0x3c,0x00,0x46,0x00,0x50,0x00, - 0x5a,0x00,0x64,0x00,0x6e,0x00,0x78,0x00,0x82,0x00,0x8c,0x00,0x96,0x00,0xa0,0x00,0xaa,0x00, - 0xb4,0x00,0xbe,0x00,0xc8,0x00,0xd2,0x00,0xdc,0x00,0xe6,0x00,0xf0,0x00,0xfa,0x00,0x04,0x01, - 0x0e,0x01,0x18,0x01,0x22,0x01,0x2c,0x01,0x36,0x01,0x40,0x01,0x4a,0x01,0x54,0x01,0x5e,0x01, - 0x68,0x01,0x72,0x01,0x7c,0x01,0x86,0x01,0x90,0x01,0x9a,0x01,0xa4,0x01,0xae,0x01,0xb8,0x01, - 0xc2,0x01,0xcc,0x01,0xd6,0x01,0xe0,0x01,0xea,0x01,0xf4,0x01,0xfe,0x01,0x08,0x02,0x12,0x02, - 0x1c,0x02,0x26,0x02,0x30,0x02,0x3a,0x02,0x44,0x02,0x4e,0x02,0x58,0x02,0x62,0x02,0x6c,0x02, - 0x76,0x02,0x80,0x02,0x8a,0x02,0x94,0x02,0x9e,0x02,0xa8,0x02,0xb2,0x02,0xbc,0x02,0xc6,0x02, - 0xd0,0x02,0xda,0x02,0xe4,0x02,0xee,0x02,0xf8,0x02,0x02,0x03,0x0c,0x03,0x16,0x03,0x20,0x03, - 0x2a,0x03,0x34,0x03,0x3e,0x03,0x48,0x03,0x52,0x03,0x5c,0x03,0x66,0x03,0x70,0x03,0x7a,0x03, - 0x84,0x03,0x8e,0x03,0x98,0x03,0xa2,0x03,0xac,0x03,0xb6,0x03, + 0x00,0x00,0x0a,0x00,0x14,0x00,0x1e,0x00,0x28,0x00,0x32,0x00,0x3c,0x00,0x46,0x00,0x50,0x00, + 0x5a,0x00,0x64,0x00,0x6e,0x00,0x78,0x00,0x82,0x00,0x8c,0x00,0x96,0x00,0xa0,0x00,0xaa,0x00, + 0xb4,0x00,0xbe,0x00,0xc8,0x00,0xd2,0x00,0xdc,0x00,0xe6,0x00,0xf0,0x00,0xfa,0x00,0x04,0x01, + 0x0e,0x01,0x18,0x01,0x22,0x01,0x2c,0x01,0x36,0x01,0x40,0x01,0x4a,0x01,0x54,0x01,0x5e,0x01, + 0x68,0x01,0x72,0x01,0x7c,0x01,0x86,0x01,0x90,0x01,0x9a,0x01,0xa4,0x01,0xae,0x01,0xb8,0x01, + 0xc2,0x01,0xcc,0x01,0xd6,0x01,0xe0,0x01,0xea,0x01,0xf4,0x01,0xfe,0x01,0x08,0x02,0x12,0x02, + 0x1c,0x02,0x26,0x02,0x30,0x02,0x3a,0x02,0x44,0x02,0x4e,0x02,0x58,0x02,0x62,0x02,0x6c,0x02, + 0x76,0x02,0x80,0x02,0x8a,0x02,0x94,0x02,0x9e,0x02,0xa8,0x02,0xb2,0x02,0xbc,0x02,0xc6,0x02, + 0xd0,0x02,0xda,0x02,0xe4,0x02,0xee,0x02,0xf8,0x02,0x02,0x03,0x0c,0x03,0x16,0x03,0x20,0x03, + 0x2a,0x03,0x34,0x03,0x3e,0x03,0x48,0x03,0x52,0x03,0x5c,0x03,0x66,0x03,0x70,0x03,0x7a,0x03, + 0x84,0x03,0x8e,0x03,0x98,0x03,0xa2,0x03,0xac,0x03,0xb6,0x03, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, + 5, // 0x21 '!' + 0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, - 5, // 0x22 '"' - 0x00,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x22 '"' + 0x00,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x23 '#' - 0x00,0x50,0x50,0xf8,0x50,0xf8,0x50,0x50,0x00, + 5, // 0x23 '#' + 0x00,0x50,0x50,0xf8,0x50,0xf8,0x50,0x50,0x00, - 5, // 0x24 '$' - 0x00,0x20,0x78,0xa0,0x70,0x28,0xf0,0x20,0x00, + 5, // 0x24 '$' + 0x00,0x20,0x78,0xa0,0x70,0x28,0xf0,0x20,0x00, - 5, // 0x25 '%' - 0x00,0xc8,0xc8,0x10,0x20,0x40,0x98,0x98,0x00, + 5, // 0x25 '%' + 0x00,0xc8,0xc8,0x10,0x20,0x40,0x98,0x98,0x00, - 5, // 0x26 '&' - 0x00,0x40,0xa0,0xa0,0x40,0xa8,0x90,0x68,0x00, + 5, // 0x26 '&' + 0x00,0x40,0xa0,0xa0,0x40,0xa8,0x90,0x68,0x00, - 5, // 0x27 ''' - 0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x27 ''' + 0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x28 '(' - 0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x10, + 5, // 0x28 '(' + 0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x10, - 5, // 0x29 ')' - 0x80,0x40,0x20,0x20,0x20,0x20,0x20,0x40,0x80, + 5, // 0x29 ')' + 0x80,0x40,0x20,0x20,0x20,0x20,0x20,0x40,0x80, - 5, // 0x2a '*' - 0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00, + 5, // 0x2a '*' + 0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00, - 5, // 0x2b '+' - 0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, + 5, // 0x2b '+' + 0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, - 5, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x40, + 5, // 0x2c ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x40, - 5, // 0x2d '-' - 0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00, + 5, // 0x2d '-' + 0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00, - 5, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, + 5, // 0x2e '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, - 5, // 0x2f '/' - 0x00,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80, + 5, // 0x2f '/' + 0x00,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80, - 5, // 0x30 '0' - 0x00,0x60,0x90,0xb0,0xd0,0x90,0x90,0x60,0x00, + 5, // 0x30 '0' + 0x00,0x60,0x90,0xb0,0xd0,0x90,0x90,0x60,0x00, - 5, // 0x31 '1' - 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x70,0x00, + 5, // 0x31 '1' + 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x70,0x00, - 5, // 0x32 '2' - 0x00,0x60,0x90,0x10,0x20,0x40,0x80,0xf0,0x00, + 5, // 0x32 '2' + 0x00,0x60,0x90,0x10,0x20,0x40,0x80,0xf0,0x00, - 5, // 0x33 '3' - 0x00,0xf0,0x10,0x20,0x60,0x10,0x90,0x60,0x00, + 5, // 0x33 '3' + 0x00,0xf0,0x10,0x20,0x60,0x10,0x90,0x60,0x00, - 5, // 0x34 '4' - 0x00,0x30,0x50,0x90,0x90,0xf8,0x10,0x10,0x00, + 5, // 0x34 '4' + 0x00,0x30,0x50,0x90,0x90,0xf8,0x10,0x10,0x00, - 5, // 0x35 '5' - 0x00,0xf0,0x80,0xe0,0x10,0x10,0x10,0xe0,0x00, + 5, // 0x35 '5' + 0x00,0xf0,0x80,0xe0,0x10,0x10,0x10,0xe0,0x00, - 5, // 0x36 '6' - 0x00,0x60,0x80,0xe0,0x90,0x90,0x90,0x60,0x00, + 5, // 0x36 '6' + 0x00,0x60,0x80,0xe0,0x90,0x90,0x90,0x60,0x00, - 5, // 0x37 '7' - 0x00,0xf0,0x90,0x10,0x20,0x40,0x40,0x40,0x00, + 5, // 0x37 '7' + 0x00,0xf0,0x90,0x10,0x20,0x40,0x40,0x40,0x00, - 5, // 0x38 '8' - 0x00,0x60,0x90,0x90,0x60,0x90,0x90,0x60,0x00, + 5, // 0x38 '8' + 0x00,0x60,0x90,0x90,0x60,0x90,0x90,0x60,0x00, - 5, // 0x39 '9' - 0x00,0x60,0x90,0x90,0x70,0x10,0x90,0x60,0x00, + 5, // 0x39 '9' + 0x00,0x60,0x90,0x90,0x70,0x10,0x90,0x60,0x00, - 5, // 0x3a ':' - 0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00, + 5, // 0x3a ':' + 0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00, - 5, // 0x3b ';' - 0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x20,0x40, + 5, // 0x3b ';' + 0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x20,0x40, - 5, // 0x3c '<' - 0x00,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x00, + 5, // 0x3c '<' + 0x00,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x00, - 5, // 0x3d '=' - 0x00,0x00,0x00,0xf0,0x00,0xf0,0x00,0x00,0x00, + 5, // 0x3d '=' + 0x00,0x00,0x00,0xf0,0x00,0xf0,0x00,0x00,0x00, - 5, // 0x3e '>' - 0x00,0x80,0x40,0x20,0x10,0x20,0x40,0x80,0x00, + 5, // 0x3e '>' + 0x00,0x80,0x40,0x20,0x10,0x20,0x40,0x80,0x00, - 5, // 0x3f '?' - 0x00,0x60,0x90,0x10,0x20,0x20,0x00,0x20,0x00, + 5, // 0x3f '?' + 0x00,0x60,0x90,0x10,0x20,0x20,0x00,0x20,0x00, - 5, // 0x40 '@' - 0x00,0x60,0x90,0xb0,0xb0,0xb0,0x80,0x70,0x00, + 5, // 0x40 '@' + 0x00,0x60,0x90,0xb0,0xb0,0xb0,0x80,0x70,0x00, - 5, // 0x41 'A' - 0x00,0x60,0x90,0x90,0xf0,0x90,0x90,0x90,0x00, + 5, // 0x41 'A' + 0x00,0x60,0x90,0x90,0xf0,0x90,0x90,0x90,0x00, - 5, // 0x42 'B' - 0x00,0xe0,0x90,0x90,0xe0,0x90,0x90,0xe0,0x00, + 5, // 0x42 'B' + 0x00,0xe0,0x90,0x90,0xe0,0x90,0x90,0xe0,0x00, - 5, // 0x43 'C' - 0x00,0x60,0x90,0x80,0x80,0x80,0x90,0x60,0x00, + 5, // 0x43 'C' + 0x00,0x60,0x90,0x80,0x80,0x80,0x90,0x60,0x00, - 5, // 0x44 'D' - 0x00,0xe0,0x90,0x90,0x90,0x90,0x90,0xe0,0x00, + 5, // 0x44 'D' + 0x00,0xe0,0x90,0x90,0x90,0x90,0x90,0xe0,0x00, - 5, // 0x45 'E' - 0x00,0xf0,0x80,0x80,0xe0,0x80,0x80,0xf0,0x00, + 5, // 0x45 'E' + 0x00,0xf0,0x80,0x80,0xe0,0x80,0x80,0xf0,0x00, - 5, // 0x46 'F' - 0x00,0xf0,0x80,0x80,0xe0,0x80,0x80,0x80,0x00, + 5, // 0x46 'F' + 0x00,0xf0,0x80,0x80,0xe0,0x80,0x80,0x80,0x00, - 5, // 0x47 'G' - 0x00,0x60,0x90,0x80,0xb0,0x90,0x90,0x60,0x00, + 5, // 0x47 'G' + 0x00,0x60,0x90,0x80,0xb0,0x90,0x90,0x60,0x00, - 5, // 0x48 'H' - 0x00,0x90,0x90,0x90,0xf0,0x90,0x90,0x90,0x00, + 5, // 0x48 'H' + 0x00,0x90,0x90,0x90,0xf0,0x90,0x90,0x90,0x00, - 5, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 5, // 0x49 'I' + 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00, - 5, // 0x4a 'J' - 0x00,0x70,0x20,0x20,0x20,0x20,0xa0,0x40,0x00, + 5, // 0x4a 'J' + 0x00,0x70,0x20,0x20,0x20,0x20,0xa0,0x40,0x00, - 5, // 0x4b 'K' - 0x00,0x90,0x90,0xa0,0xc0,0xa0,0x90,0x90,0x00, + 5, // 0x4b 'K' + 0x00,0x90,0x90,0xa0,0xc0,0xa0,0x90,0x90,0x00, - 5, // 0x4c 'L' - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0xf0,0x00, + 5, // 0x4c 'L' + 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0xf0,0x00, - 5, // 0x4d 'M' - 0x00,0x90,0xf0,0x90,0x90,0x90,0x90,0x90,0x00, + 5, // 0x4d 'M' + 0x00,0x90,0xf0,0x90,0x90,0x90,0x90,0x90,0x00, - 5, // 0x4e 'N' - 0x00,0x90,0x90,0xd0,0xb0,0x90,0x90,0x90,0x00, + 5, // 0x4e 'N' + 0x00,0x90,0x90,0xd0,0xb0,0x90,0x90,0x90,0x00, - 5, // 0x4f 'O' - 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x4f 'O' + 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x60,0x00, - 5, // 0x50 'P' - 0x00,0xe0,0x90,0x90,0xe0,0x80,0x80,0x80,0x00, + 5, // 0x50 'P' + 0x00,0xe0,0x90,0x90,0xe0,0x80,0x80,0x80,0x00, - 5, // 0x51 'Q' - 0x00,0x60,0x90,0x90,0x90,0x90,0xa0,0x50,0x00, + 5, // 0x51 'Q' + 0x00,0x60,0x90,0x90,0x90,0x90,0xa0,0x50,0x00, - 5, // 0x52 'R' - 0x00,0xe0,0x90,0x90,0xe0,0xa0,0x90,0x90,0x00, + 5, // 0x52 'R' + 0x00,0xe0,0x90,0x90,0xe0,0xa0,0x90,0x90,0x00, - 5, // 0x53 'S' - 0x00,0x60,0x90,0x80,0x60,0x10,0x90,0x60,0x00, + 5, // 0x53 'S' + 0x00,0x60,0x90,0x80,0x60,0x10,0x90,0x60,0x00, - 5, // 0x54 'T' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 5, // 0x54 'T' + 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x00, - 5, // 0x55 'U' - 0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x55 'U' + 0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, - 5, // 0x56 'V' - 0x00,0x50,0x50,0x50,0x50,0x50,0x20,0x20,0x00, + 5, // 0x56 'V' + 0x00,0x50,0x50,0x50,0x50,0x50,0x20,0x20,0x00, - 5, // 0x57 'W' - 0x00,0x90,0x90,0x90,0x90,0x90,0xf0,0x90,0x00, + 5, // 0x57 'W' + 0x00,0x90,0x90,0x90,0x90,0x90,0xf0,0x90,0x00, - 5, // 0x58 'X' - 0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x00, + 5, // 0x58 'X' + 0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x00, - 5, // 0x59 'Y' - 0x00,0x50,0x50,0x50,0x20,0x20,0x20,0x20,0x00, + 5, // 0x59 'Y' + 0x00,0x50,0x50,0x50,0x20,0x20,0x20,0x20,0x00, - 5, // 0x5a 'Z' - 0x00,0xf0,0x10,0x10,0x20,0x40,0x80,0xf0,0x00, + 5, // 0x5a 'Z' + 0x00,0xf0,0x10,0x10,0x20,0x40,0x80,0xf0,0x00, - 5, // 0x5b '[' - 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00, + 5, // 0x5b '[' + 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00, - 5, // 0x5c '\' - 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x00, + 5, // 0x5c '\' + 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x00, - 5, // 0x5d ']' - 0xe0,0x20,0x20,0x20,0x20,0x20,0x20,0xe0,0x00, + 5, // 0x5d ']' + 0xe0,0x20,0x20,0x20,0x20,0x20,0x20,0xe0,0x00, - 5, // 0x5e '^' - 0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00, + 5, // 0x5e '^' + 0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00, - 5, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00, + 5, // 0x5f '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00, - 5, // 0x60 '`' - 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x60 '`' + 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x61 'a' - 0x00,0x00,0x60,0x10,0x70,0x90,0x90,0x70,0x00, + 5, // 0x61 'a' + 0x00,0x00,0x60,0x10,0x70,0x90,0x90,0x70,0x00, - 5, // 0x62 'b' - 0x00,0x80,0x80,0xe0,0x90,0x90,0x90,0xe0,0x00, + 5, // 0x62 'b' + 0x00,0x80,0x80,0xe0,0x90,0x90,0x90,0xe0,0x00, - 5, // 0x63 'c' - 0x00,0x00,0x60,0x90,0x80,0x80,0x90,0x60,0x00, + 5, // 0x63 'c' + 0x00,0x00,0x60,0x90,0x80,0x80,0x90,0x60,0x00, - 5, // 0x64 'd' - 0x00,0x10,0x10,0x70,0x90,0x90,0x90,0x70,0x00, + 5, // 0x64 'd' + 0x00,0x10,0x10,0x70,0x90,0x90,0x90,0x70,0x00, - 5, // 0x65 'e' - 0x00,0x00,0x60,0x90,0xf0,0x80,0x80,0x70,0x00, + 5, // 0x65 'e' + 0x00,0x00,0x60,0x90,0xf0,0x80,0x80,0x70,0x00, - 5, // 0x66 'f' - 0x00,0x30,0x40,0x40,0xe0,0x40,0x40,0x40,0x00, + 5, // 0x66 'f' + 0x00,0x30,0x40,0x40,0xe0,0x40,0x40,0x40,0x00, - 5, // 0x67 'g' - 0x00,0x00,0x70,0x90,0x90,0x70,0x10,0x90,0x60, + 5, // 0x67 'g' + 0x00,0x00,0x70,0x90,0x90,0x70,0x10,0x90,0x60, - 5, // 0x68 'h' - 0x00,0x80,0x80,0xe0,0x90,0x90,0x90,0x90,0x00, + 5, // 0x68 'h' + 0x00,0x80,0x80,0xe0,0x90,0x90,0x90,0x90,0x00, - 5, // 0x69 'i' - 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x70,0x00, + 5, // 0x69 'i' + 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x70,0x00, - 5, // 0x6a 'j' - 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0xa0,0x40, + 5, // 0x6a 'j' + 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0xa0,0x40, - 5, // 0x6b 'k' - 0x00,0x80,0x80,0x90,0xa0,0xc0,0xa0,0x90,0x00, + 5, // 0x6b 'k' + 0x00,0x80,0x80,0x90,0xa0,0xc0,0xa0,0x90,0x00, - 5, // 0x6c 'l' - 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 5, // 0x6c 'l' + 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00, - 5, // 0x6d 'm' - 0x00,0x00,0xa0,0xf0,0xf0,0xf0,0x90,0x90,0x00, + 5, // 0x6d 'm' + 0x00,0x00,0xa0,0xf0,0xf0,0xf0,0x90,0x90,0x00, - 5, // 0x6e 'n' - 0x00,0x00,0xa0,0xd0,0x90,0x90,0x90,0x90,0x00, + 5, // 0x6e 'n' + 0x00,0x00,0xa0,0xd0,0x90,0x90,0x90,0x90,0x00, - 5, // 0x6f 'o' - 0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x6f 'o' + 0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x60,0x00, - 5, // 0x70 'p' - 0x00,0x00,0xe0,0x90,0x90,0x90,0xe0,0x80,0x80, + 5, // 0x70 'p' + 0x00,0x00,0xe0,0x90,0x90,0x90,0xe0,0x80,0x80, - 5, // 0x71 'q' - 0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0x10, + 5, // 0x71 'q' + 0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0x10, - 5, // 0x72 'r' - 0x00,0x00,0xe0,0x90,0x80,0x80,0x80,0x80,0x00, + 5, // 0x72 'r' + 0x00,0x00,0xe0,0x90,0x80,0x80,0x80,0x80,0x00, - 5, // 0x73 's' - 0x00,0x00,0x60,0x90,0x40,0x20,0x90,0x60,0x00, + 5, // 0x73 's' + 0x00,0x00,0x60,0x90,0x40,0x20,0x90,0x60,0x00, - 5, // 0x74 't' - 0x00,0x40,0x40,0xe0,0x40,0x40,0x50,0x20,0x00, + 5, // 0x74 't' + 0x00,0x40,0x40,0xe0,0x40,0x40,0x50,0x20,0x00, - 5, // 0x75 'u' - 0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x70,0x00, + 5, // 0x75 'u' + 0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x70,0x00, - 5, // 0x76 'v' - 0x00,0x00,0x50,0x50,0x50,0x50,0x20,0x20,0x00, + 5, // 0x76 'v' + 0x00,0x00,0x50,0x50,0x50,0x50,0x20,0x20,0x00, - 5, // 0x77 'w' - 0x00,0x00,0x90,0x90,0x90,0x90,0xf0,0x90,0x00, + 5, // 0x77 'w' + 0x00,0x00,0x90,0x90,0x90,0x90,0xf0,0x90,0x00, - 5, // 0x78 'x' - 0x00,0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x00, + 5, // 0x78 'x' + 0x00,0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x00, - 5, // 0x79 'y' - 0x00,0x00,0x90,0x90,0x90,0x90,0x70,0x10,0xe0, + 5, // 0x79 'y' + 0x00,0x00,0x90,0x90,0x90,0x90,0x70,0x10,0xe0, - 5, // 0x7a 'z' - 0x00,0x00,0xf0,0x10,0x20,0x40,0x80,0xf0,0x00, + 5, // 0x7a 'z' + 0x00,0x00,0xf0,0x10,0x20,0x40,0x80,0xf0,0x00, - 5, // 0x7b '{' - 0x10,0x20,0x20,0x20,0xc0,0x20,0x20,0x20,0x10, + 5, // 0x7b '{' + 0x10,0x20,0x20,0x20,0xc0,0x20,0x20,0x20,0x10, - 5, // 0x7c '|' - 0x00,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x00, + 5, // 0x7c '|' + 0x00,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x00, - 5, // 0x7d '}' - 0x80,0x40,0x40,0x40,0x30,0x40,0x40,0x40,0x80, + 5, // 0x7d '}' + 0x80,0x40,0x40,0x40,0x30,0x40,0x40,0x40,0x80, - 5, // 0x7e '~' - 0x00,0x40,0xa8,0x10,0x00,0x00,0x00,0x00,0x00, + 5, // 0x7e '~' + 0x00,0x40,0xa8,0x10,0x00,0x00,0x00,0x00,0x00, - 5, // 0x7f '' - 0x00,0x00,0x00,0x20,0x50,0x88,0xf8,0x00,0x00, - 0 - }; + 5, // 0x7f '' + 0x00,0x00,0x00,0x20,0x50,0x88,0xf8,0x00,0x00, + 0 +}; - const int8u gse6x12[] = - { - 12, 0, 32, 128-32, +const int8u gse6x12[] = +{ + 12, 0, 32, 128-32, - 0x00,0x00,0x0d,0x00,0x1a,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x4e,0x00,0x5b,0x00,0x68,0x00, - 0x75,0x00,0x82,0x00,0x8f,0x00,0x9c,0x00,0xa9,0x00,0xb6,0x00,0xc3,0x00,0xd0,0x00,0xdd,0x00, - 0xea,0x00,0xf7,0x00,0x04,0x01,0x11,0x01,0x1e,0x01,0x2b,0x01,0x38,0x01,0x45,0x01,0x52,0x01, - 0x5f,0x01,0x6c,0x01,0x79,0x01,0x86,0x01,0x93,0x01,0xa0,0x01,0xad,0x01,0xba,0x01,0xc7,0x01, - 0xd4,0x01,0xe1,0x01,0xee,0x01,0xfb,0x01,0x08,0x02,0x15,0x02,0x22,0x02,0x2f,0x02,0x3c,0x02, - 0x49,0x02,0x56,0x02,0x63,0x02,0x70,0x02,0x7d,0x02,0x8a,0x02,0x97,0x02,0xa4,0x02,0xb1,0x02, - 0xbe,0x02,0xcb,0x02,0xd8,0x02,0xe5,0x02,0xf2,0x02,0xff,0x02,0x0c,0x03,0x19,0x03,0x26,0x03, - 0x33,0x03,0x40,0x03,0x4d,0x03,0x5a,0x03,0x67,0x03,0x74,0x03,0x81,0x03,0x8e,0x03,0x9b,0x03, - 0xa8,0x03,0xb5,0x03,0xc2,0x03,0xcf,0x03,0xdc,0x03,0xe9,0x03,0xf6,0x03,0x03,0x04,0x10,0x04, - 0x1d,0x04,0x2a,0x04,0x37,0x04,0x44,0x04,0x51,0x04,0x5e,0x04,0x6b,0x04,0x78,0x04,0x85,0x04, - 0x92,0x04,0x9f,0x04,0xac,0x04,0xb9,0x04,0xc6,0x04,0xd3,0x04, + 0x00,0x00,0x0d,0x00,0x1a,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x4e,0x00,0x5b,0x00,0x68,0x00, + 0x75,0x00,0x82,0x00,0x8f,0x00,0x9c,0x00,0xa9,0x00,0xb6,0x00,0xc3,0x00,0xd0,0x00,0xdd,0x00, + 0xea,0x00,0xf7,0x00,0x04,0x01,0x11,0x01,0x1e,0x01,0x2b,0x01,0x38,0x01,0x45,0x01,0x52,0x01, + 0x5f,0x01,0x6c,0x01,0x79,0x01,0x86,0x01,0x93,0x01,0xa0,0x01,0xad,0x01,0xba,0x01,0xc7,0x01, + 0xd4,0x01,0xe1,0x01,0xee,0x01,0xfb,0x01,0x08,0x02,0x15,0x02,0x22,0x02,0x2f,0x02,0x3c,0x02, + 0x49,0x02,0x56,0x02,0x63,0x02,0x70,0x02,0x7d,0x02,0x8a,0x02,0x97,0x02,0xa4,0x02,0xb1,0x02, + 0xbe,0x02,0xcb,0x02,0xd8,0x02,0xe5,0x02,0xf2,0x02,0xff,0x02,0x0c,0x03,0x19,0x03,0x26,0x03, + 0x33,0x03,0x40,0x03,0x4d,0x03,0x5a,0x03,0x67,0x03,0x74,0x03,0x81,0x03,0x8e,0x03,0x9b,0x03, + 0xa8,0x03,0xb5,0x03,0xc2,0x03,0xcf,0x03,0xdc,0x03,0xe9,0x03,0xf6,0x03,0x03,0x04,0x10,0x04, + 0x1d,0x04,0x2a,0x04,0x37,0x04,0x44,0x04,0x51,0x04,0x5e,0x04,0x6b,0x04,0x78,0x04,0x85,0x04, + 0x92,0x04,0x9f,0x04,0xac,0x04,0xb9,0x04,0xc6,0x04,0xd3,0x04, - 6, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, + 6, // 0x21 '!' + 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, - 6, // 0x22 '"' - 0x00,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x22 '"' + 0x00,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x23 '#' - 0x00,0x50,0x50,0xf8,0x50,0x50,0x50,0xf8,0x50,0x50,0x00,0x00, + 6, // 0x23 '#' + 0x00,0x50,0x50,0xf8,0x50,0x50,0x50,0xf8,0x50,0x50,0x00,0x00, - 6, // 0x24 '$' - 0x00,0x20,0x70,0xa8,0xa0,0x70,0x28,0xa8,0x70,0x20,0x00,0x00, + 6, // 0x24 '$' + 0x00,0x20,0x70,0xa8,0xa0,0x70,0x28,0xa8,0x70,0x20,0x00,0x00, - 6, // 0x25 '%' - 0x00,0xc8,0xd8,0x10,0x30,0x20,0x60,0x40,0xd8,0x98,0x00,0x00, + 6, // 0x25 '%' + 0x00,0xc8,0xd8,0x10,0x30,0x20,0x60,0x40,0xd8,0x98,0x00,0x00, - 6, // 0x26 '&' - 0x00,0x60,0x90,0x90,0x90,0x60,0xa8,0x90,0x90,0x68,0x00,0x00, + 6, // 0x26 '&' + 0x00,0x60,0x90,0x90,0x90,0x60,0xa8,0x90,0x90,0x68,0x00,0x00, - 6, // 0x27 ''' - 0x00,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x27 ''' + 0x00,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x28 '(' - 0x00,0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x10,0x00,0x00, + 6, // 0x28 '(' + 0x00,0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x10,0x00,0x00, - 6, // 0x29 ')' - 0x00,0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x40,0x00,0x00, + 6, // 0x29 ')' + 0x00,0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x40,0x00,0x00, - 6, // 0x2a '*' - 0x00,0x00,0x00,0x50,0x20,0xf8,0x20,0x50,0x00,0x00,0x00,0x00, + 6, // 0x2a '*' + 0x00,0x00,0x00,0x50,0x20,0xf8,0x20,0x50,0x00,0x00,0x00,0x00, - 6, // 0x2b '+' - 0x00,0x00,0x20,0x20,0x20,0xf8,0x20,0x20,0x20,0x00,0x00,0x00, + 6, // 0x2b '+' + 0x00,0x00,0x20,0x20,0x20,0xf8,0x20,0x20,0x20,0x00,0x00,0x00, - 6, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40, + 6, // 0x2c ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40, - 6, // 0x2d '-' - 0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2d '-' + 0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00, + 6, // 0x2e '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00, - 6, // 0x2f '/' - 0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00, + 6, // 0x2f '/' + 0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00, - 6, // 0x30 '0' - 0x00,0x70,0x88,0x88,0x98,0xa8,0xc8,0x88,0x88,0x70,0x00,0x00, + 6, // 0x30 '0' + 0x00,0x70,0x88,0x88,0x98,0xa8,0xc8,0x88,0x88,0x70,0x00,0x00, - 6, // 0x31 '1' - 0x00,0x20,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 6, // 0x31 '1' + 0x00,0x20,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, - 6, // 0x32 '2' - 0x00,0x70,0x88,0x88,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x00, + 6, // 0x32 '2' + 0x00,0x70,0x88,0x88,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x00, - 6, // 0x33 '3' - 0x00,0xf8,0x10,0x20,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00, + 6, // 0x33 '3' + 0x00,0xf8,0x10,0x20,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00, - 6, // 0x34 '4' - 0x00,0x10,0x20,0x40,0x90,0x90,0xf8,0x10,0x10,0x10,0x00,0x00, + 6, // 0x34 '4' + 0x00,0x10,0x20,0x40,0x90,0x90,0xf8,0x10,0x10,0x10,0x00,0x00, - 6, // 0x35 '5' - 0x00,0xf8,0x80,0x80,0xf0,0x08,0x08,0x08,0x88,0x70,0x00,0x00, + 6, // 0x35 '5' + 0x00,0xf8,0x80,0x80,0xf0,0x08,0x08,0x08,0x88,0x70,0x00,0x00, - 6, // 0x36 '6' - 0x00,0x70,0x88,0x80,0x80,0xf0,0x88,0x88,0x88,0x70,0x00,0x00, + 6, // 0x36 '6' + 0x00,0x70,0x88,0x80,0x80,0xf0,0x88,0x88,0x88,0x70,0x00,0x00, - 6, // 0x37 '7' - 0x00,0xf8,0x88,0x08,0x08,0x10,0x20,0x20,0x20,0x20,0x00,0x00, + 6, // 0x37 '7' + 0x00,0xf8,0x88,0x08,0x08,0x10,0x20,0x20,0x20,0x20,0x00,0x00, - 6, // 0x38 '8' - 0x00,0x70,0x88,0x88,0x88,0x70,0x88,0x88,0x88,0x70,0x00,0x00, + 6, // 0x38 '8' + 0x00,0x70,0x88,0x88,0x88,0x70,0x88,0x88,0x88,0x70,0x00,0x00, - 6, // 0x39 '9' - 0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x08,0x88,0x70,0x00,0x00, + 6, // 0x39 '9' + 0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x08,0x88,0x70,0x00,0x00, - 6, // 0x3a ':' - 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00, + 6, // 0x3a ':' + 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00, - 6, // 0x3b ';' - 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x20,0x20,0x40, + 6, // 0x3b ';' + 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x20,0x20,0x40, - 6, // 0x3c '<' - 0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x00,0x00, + 6, // 0x3c '<' + 0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x00,0x00, - 6, // 0x3d '=' - 0x00,0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00,0x00,0x00, + 6, // 0x3d '=' + 0x00,0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00,0x00,0x00, - 6, // 0x3e '>' - 0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80,0x00,0x00, + 6, // 0x3e '>' + 0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80,0x00,0x00, - 6, // 0x3f '?' - 0x00,0x70,0x88,0x88,0x08,0x10,0x20,0x20,0x00,0x20,0x00,0x00, + 6, // 0x3f '?' + 0x00,0x70,0x88,0x88,0x08,0x10,0x20,0x20,0x00,0x20,0x00,0x00, - 6, // 0x40 '@' - 0x00,0x70,0x88,0x88,0xb8,0xb8,0xb0,0x80,0x88,0x70,0x00,0x00, + 6, // 0x40 '@' + 0x00,0x70,0x88,0x88,0xb8,0xb8,0xb0,0x80,0x88,0x70,0x00,0x00, - 6, // 0x41 'A' - 0x00,0x20,0x50,0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00,0x00, + 6, // 0x41 'A' + 0x00,0x20,0x50,0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00,0x00, - 6, // 0x42 'B' - 0x00,0xf0,0x88,0x88,0x88,0xf0,0x88,0x88,0x88,0xf0,0x00,0x00, + 6, // 0x42 'B' + 0x00,0xf0,0x88,0x88,0x88,0xf0,0x88,0x88,0x88,0xf0,0x00,0x00, - 6, // 0x43 'C' - 0x00,0x70,0x88,0x88,0x80,0x80,0x80,0x88,0x88,0x70,0x00,0x00, + 6, // 0x43 'C' + 0x00,0x70,0x88,0x88,0x80,0x80,0x80,0x88,0x88,0x70,0x00,0x00, - 6, // 0x44 'D' - 0x00,0xe0,0x90,0x88,0x88,0x88,0x88,0x88,0x90,0xe0,0x00,0x00, + 6, // 0x44 'D' + 0x00,0xe0,0x90,0x88,0x88,0x88,0x88,0x88,0x90,0xe0,0x00,0x00, - 6, // 0x45 'E' - 0x00,0xf8,0x80,0x80,0x80,0xf0,0x80,0x80,0x80,0xf8,0x00,0x00, + 6, // 0x45 'E' + 0x00,0xf8,0x80,0x80,0x80,0xf0,0x80,0x80,0x80,0xf8,0x00,0x00, - 6, // 0x46 'F' - 0x00,0xf8,0x80,0x80,0x80,0xf0,0x80,0x80,0x80,0x80,0x00,0x00, + 6, // 0x46 'F' + 0x00,0xf8,0x80,0x80,0x80,0xf0,0x80,0x80,0x80,0x80,0x00,0x00, - 6, // 0x47 'G' - 0x00,0x70,0x88,0x80,0x80,0xb8,0x88,0x88,0x88,0x70,0x00,0x00, + 6, // 0x47 'G' + 0x00,0x70,0x88,0x80,0x80,0xb8,0x88,0x88,0x88,0x70,0x00,0x00, - 6, // 0x48 'H' - 0x00,0x88,0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x88,0x00,0x00, + 6, // 0x48 'H' + 0x00,0x88,0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x88,0x00,0x00, - 6, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 6, // 0x49 'I' + 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, - 6, // 0x4a 'J' - 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x60,0x00,0x00, + 6, // 0x4a 'J' + 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x60,0x00,0x00, - 6, // 0x4b 'K' - 0x00,0x88,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x88,0x00,0x00, + 6, // 0x4b 'K' + 0x00,0x88,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x88,0x00,0x00, - 6, // 0x4c 'L' - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00,0x00, + 6, // 0x4c 'L' + 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00,0x00, - 6, // 0x4d 'M' - 0x00,0x88,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x88,0x00,0x00, + 6, // 0x4d 'M' + 0x00,0x88,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x88,0x00,0x00, - 6, // 0x4e 'N' - 0x00,0x88,0x88,0xc8,0xa8,0x98,0x88,0x88,0x88,0x88,0x00,0x00, + 6, // 0x4e 'N' + 0x00,0x88,0x88,0xc8,0xa8,0x98,0x88,0x88,0x88,0x88,0x00,0x00, - 6, // 0x4f 'O' - 0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, + 6, // 0x4f 'O' + 0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, - 6, // 0x50 'P' - 0x00,0xf0,0x88,0x88,0x88,0xf0,0x80,0x80,0x80,0x80,0x00,0x00, + 6, // 0x50 'P' + 0x00,0xf0,0x88,0x88,0x88,0xf0,0x80,0x80,0x80,0x80,0x00,0x00, - 6, // 0x51 'Q' - 0x00,0x70,0x88,0x88,0x88,0x88,0x88,0xa8,0x90,0x68,0x00,0x00, + 6, // 0x51 'Q' + 0x00,0x70,0x88,0x88,0x88,0x88,0x88,0xa8,0x90,0x68,0x00,0x00, - 6, // 0x52 'R' - 0x00,0xf0,0x88,0x88,0x88,0x88,0xf0,0xa0,0x90,0x88,0x00,0x00, + 6, // 0x52 'R' + 0x00,0xf0,0x88,0x88,0x88,0x88,0xf0,0xa0,0x90,0x88,0x00,0x00, - 6, // 0x53 'S' - 0x00,0x70,0x88,0x80,0x80,0x70,0x08,0x08,0x88,0x70,0x00,0x00, + 6, // 0x53 'S' + 0x00,0x70,0x88,0x80,0x80,0x70,0x08,0x08,0x88,0x70,0x00,0x00, - 6, // 0x54 'T' - 0x00,0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00, + 6, // 0x54 'T' + 0x00,0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00, - 6, // 0x55 'U' - 0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, + 6, // 0x55 'U' + 0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, - 6, // 0x56 'V' - 0x00,0x88,0x88,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x00,0x00, + 6, // 0x56 'V' + 0x00,0x88,0x88,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x00,0x00, - 6, // 0x57 'W' - 0x00,0x88,0x88,0x88,0x88,0x88,0xa8,0xa8,0xd8,0x88,0x00,0x00, + 6, // 0x57 'W' + 0x00,0x88,0x88,0x88,0x88,0x88,0xa8,0xa8,0xd8,0x88,0x00,0x00, - 6, // 0x58 'X' - 0x00,0x88,0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x88,0x00,0x00, + 6, // 0x58 'X' + 0x00,0x88,0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x88,0x00,0x00, - 6, // 0x59 'Y' - 0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x20,0x00,0x00, + 6, // 0x59 'Y' + 0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x20,0x00,0x00, - 6, // 0x5a 'Z' - 0x00,0xf8,0x08,0x08,0x10,0x20,0x40,0x80,0x80,0xf8,0x00,0x00, + 6, // 0x5a 'Z' + 0x00,0xf8,0x08,0x08,0x10,0x20,0x40,0x80,0x80,0xf8,0x00,0x00, - 6, // 0x5b '[' - 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00, + 6, // 0x5b '[' + 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00, - 6, // 0x5c '\' - 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00,0x00, + 6, // 0x5c '\' + 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00,0x00, - 6, // 0x5d ']' - 0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00, + 6, // 0x5d ']' + 0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00, - 6, // 0x5e '^' - 0x00,0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x5e '^' + 0x00,0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00, + 6, // 0x5f '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00, - 6, // 0x60 '`' - 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x60 '`' + 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x61 'a' - 0x00,0x00,0x00,0x70,0x88,0x08,0x78,0x88,0x88,0x78,0x00,0x00, + 6, // 0x61 'a' + 0x00,0x00,0x00,0x70,0x88,0x08,0x78,0x88,0x88,0x78,0x00,0x00, - 6, // 0x62 'b' - 0x00,0x80,0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0xf0,0x00,0x00, + 6, // 0x62 'b' + 0x00,0x80,0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0xf0,0x00,0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00,0x00, + 6, // 0x63 'c' + 0x00,0x00,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00,0x00, - 6, // 0x64 'd' - 0x00,0x08,0x08,0x08,0x78,0x88,0x88,0x88,0x88,0x78,0x00,0x00, + 6, // 0x64 'd' + 0x00,0x08,0x08,0x08,0x78,0x88,0x88,0x88,0x88,0x78,0x00,0x00, - 6, // 0x65 'e' - 0x00,0x00,0x00,0x70,0x88,0x88,0xf8,0x80,0x80,0x78,0x00,0x00, + 6, // 0x65 'e' + 0x00,0x00,0x00,0x70,0x88,0x88,0xf8,0x80,0x80,0x78,0x00,0x00, - 6, // 0x66 'f' - 0x00,0x18,0x20,0x20,0xf8,0x20,0x20,0x20,0x20,0x20,0x00,0x00, + 6, // 0x66 'f' + 0x00,0x18,0x20,0x20,0xf8,0x20,0x20,0x20,0x20,0x20,0x00,0x00, - 6, // 0x67 'g' - 0x00,0x00,0x00,0x78,0x88,0x88,0x88,0x88,0x78,0x08,0x08,0xf0, + 6, // 0x67 'g' + 0x00,0x00,0x00,0x78,0x88,0x88,0x88,0x88,0x78,0x08,0x08,0xf0, - 6, // 0x68 'h' - 0x00,0x80,0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x88,0x00,0x00, + 6, // 0x68 'h' + 0x00,0x80,0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x88,0x00,0x00, - 6, // 0x69 'i' - 0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 6, // 0x69 'i' + 0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00,0x00, - 6, // 0x6a 'j' - 0x00,0x10,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x90,0x60, + 6, // 0x6a 'j' + 0x00,0x10,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x90,0x60, - 6, // 0x6b 'k' - 0x00,0x80,0x80,0x80,0x88,0x90,0xa0,0xd0,0x88,0x88,0x00,0x00, + 6, // 0x6b 'k' + 0x00,0x80,0x80,0x80,0x88,0x90,0xa0,0xd0,0x88,0x88,0x00,0x00, - 6, // 0x6c 'l' - 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 6, // 0x6c 'l' + 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, - 6, // 0x6d 'm' - 0x00,0x00,0x00,0xd0,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0x00,0x00, + 6, // 0x6d 'm' + 0x00,0x00,0x00,0xd0,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0x00,0x00, - 6, // 0x6e 'n' - 0x00,0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x88,0x88,0x00,0x00, + 6, // 0x6e 'n' + 0x00,0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x88,0x88,0x00,0x00, - 6, // 0x6f 'o' - 0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, + 6, // 0x6f 'o' + 0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, - 6, // 0x70 'p' - 0x00,0x00,0x00,0xf0,0x88,0x88,0x88,0x88,0xf0,0x80,0x80,0x80, + 6, // 0x70 'p' + 0x00,0x00,0x00,0xf0,0x88,0x88,0x88,0x88,0xf0,0x80,0x80,0x80, - 6, // 0x71 'q' - 0x00,0x00,0x00,0x78,0x88,0x88,0x88,0x88,0x78,0x08,0x08,0x08, + 6, // 0x71 'q' + 0x00,0x00,0x00,0x78,0x88,0x88,0x88,0x88,0x78,0x08,0x08,0x08, - 6, // 0x72 'r' - 0x00,0x00,0x00,0xb0,0xc8,0x88,0x80,0x80,0x80,0x80,0x00,0x00, + 6, // 0x72 'r' + 0x00,0x00,0x00,0xb0,0xc8,0x88,0x80,0x80,0x80,0x80,0x00,0x00, - 6, // 0x73 's' - 0x00,0x00,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00,0x00, + 6, // 0x73 's' + 0x00,0x00,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00,0x00, - 6, // 0x74 't' - 0x00,0x40,0x40,0x40,0xe0,0x40,0x40,0x40,0x48,0x30,0x00,0x00, + 6, // 0x74 't' + 0x00,0x40,0x40,0x40,0xe0,0x40,0x40,0x40,0x48,0x30,0x00,0x00, - 6, // 0x75 'u' - 0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x78,0x00,0x00, + 6, // 0x75 'u' + 0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x78,0x00,0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x00,0x00, + 6, // 0x76 'v' + 0x00,0x00,0x00,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x00,0x00, - 6, // 0x77 'w' - 0x00,0x00,0x00,0x88,0x88,0x88,0xa8,0xa8,0xd8,0x88,0x00,0x00, + 6, // 0x77 'w' + 0x00,0x00,0x00,0x88,0x88,0x88,0xa8,0xa8,0xd8,0x88,0x00,0x00, - 6, // 0x78 'x' - 0x00,0x00,0x00,0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x00,0x00, + 6, // 0x78 'x' + 0x00,0x00,0x00,0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x00,0x00, - 6, // 0x79 'y' - 0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x88,0x78,0x08,0x10,0xe0, + 6, // 0x79 'y' + 0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x88,0x78,0x08,0x10,0xe0, - 6, // 0x7a 'z' - 0x00,0x00,0x00,0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x00, + 6, // 0x7a 'z' + 0x00,0x00,0x00,0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x00, - 6, // 0x7b '{' - 0x18,0x20,0x20,0x20,0x20,0xc0,0x20,0x20,0x20,0x20,0x18,0x00, + 6, // 0x7b '{' + 0x18,0x20,0x20,0x20,0x20,0xc0,0x20,0x20,0x20,0x20,0x18,0x00, - 6, // 0x7c '|' - 0x00,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x20,0x00,0x00, + 6, // 0x7c '|' + 0x00,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x20,0x00,0x00, - 6, // 0x7d '}' - 0xc0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xc0,0x00, + 6, // 0x7d '}' + 0xc0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xc0,0x00, - 6, // 0x7e '~' - 0x00,0x00,0x40,0xa8,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x7e '~' + 0x00,0x00,0x40,0xa8,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x7f '' - 0x00,0x00,0x00,0x00,0x20,0x50,0x88,0xf8,0x00,0x00,0x00,0x00, - 0 - }; + 6, // 0x7f '' + 0x00,0x00,0x00,0x00,0x20,0x50,0x88,0xf8,0x00,0x00,0x00,0x00, + 0 +}; - const int8u gse6x9[] = - { - 9, 0, 32, 128-32, +const int8u gse6x9[] = +{ + 9, 0, 32, 128-32, - 0x00,0x00,0x0a,0x00,0x14,0x00,0x1e,0x00,0x28,0x00,0x32,0x00,0x3c,0x00,0x46,0x00,0x50,0x00, - 0x5a,0x00,0x64,0x00,0x6e,0x00,0x78,0x00,0x82,0x00,0x8c,0x00,0x96,0x00,0xa0,0x00,0xaa,0x00, - 0xb4,0x00,0xbe,0x00,0xc8,0x00,0xd2,0x00,0xdc,0x00,0xe6,0x00,0xf0,0x00,0xfa,0x00,0x04,0x01, - 0x0e,0x01,0x18,0x01,0x22,0x01,0x2c,0x01,0x36,0x01,0x40,0x01,0x4a,0x01,0x54,0x01,0x5e,0x01, - 0x68,0x01,0x72,0x01,0x7c,0x01,0x86,0x01,0x90,0x01,0x9a,0x01,0xa4,0x01,0xae,0x01,0xb8,0x01, - 0xc2,0x01,0xcc,0x01,0xd6,0x01,0xe0,0x01,0xea,0x01,0xf4,0x01,0xfe,0x01,0x08,0x02,0x12,0x02, - 0x1c,0x02,0x26,0x02,0x30,0x02,0x3a,0x02,0x44,0x02,0x4e,0x02,0x58,0x02,0x62,0x02,0x6c,0x02, - 0x76,0x02,0x80,0x02,0x8a,0x02,0x94,0x02,0x9e,0x02,0xa8,0x02,0xb2,0x02,0xbc,0x02,0xc6,0x02, - 0xd0,0x02,0xda,0x02,0xe4,0x02,0xee,0x02,0xf8,0x02,0x02,0x03,0x0c,0x03,0x16,0x03,0x20,0x03, - 0x2a,0x03,0x34,0x03,0x3e,0x03,0x48,0x03,0x52,0x03,0x5c,0x03,0x66,0x03,0x70,0x03,0x7a,0x03, - 0x84,0x03,0x8e,0x03,0x98,0x03,0xa2,0x03,0xac,0x03,0xb6,0x03, + 0x00,0x00,0x0a,0x00,0x14,0x00,0x1e,0x00,0x28,0x00,0x32,0x00,0x3c,0x00,0x46,0x00,0x50,0x00, + 0x5a,0x00,0x64,0x00,0x6e,0x00,0x78,0x00,0x82,0x00,0x8c,0x00,0x96,0x00,0xa0,0x00,0xaa,0x00, + 0xb4,0x00,0xbe,0x00,0xc8,0x00,0xd2,0x00,0xdc,0x00,0xe6,0x00,0xf0,0x00,0xfa,0x00,0x04,0x01, + 0x0e,0x01,0x18,0x01,0x22,0x01,0x2c,0x01,0x36,0x01,0x40,0x01,0x4a,0x01,0x54,0x01,0x5e,0x01, + 0x68,0x01,0x72,0x01,0x7c,0x01,0x86,0x01,0x90,0x01,0x9a,0x01,0xa4,0x01,0xae,0x01,0xb8,0x01, + 0xc2,0x01,0xcc,0x01,0xd6,0x01,0xe0,0x01,0xea,0x01,0xf4,0x01,0xfe,0x01,0x08,0x02,0x12,0x02, + 0x1c,0x02,0x26,0x02,0x30,0x02,0x3a,0x02,0x44,0x02,0x4e,0x02,0x58,0x02,0x62,0x02,0x6c,0x02, + 0x76,0x02,0x80,0x02,0x8a,0x02,0x94,0x02,0x9e,0x02,0xa8,0x02,0xb2,0x02,0xbc,0x02,0xc6,0x02, + 0xd0,0x02,0xda,0x02,0xe4,0x02,0xee,0x02,0xf8,0x02,0x02,0x03,0x0c,0x03,0x16,0x03,0x20,0x03, + 0x2a,0x03,0x34,0x03,0x3e,0x03,0x48,0x03,0x52,0x03,0x5c,0x03,0x66,0x03,0x70,0x03,0x7a,0x03, + 0x84,0x03,0x8e,0x03,0x98,0x03,0xa2,0x03,0xac,0x03,0xb6,0x03, - 6, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, + 6, // 0x21 '!' + 0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, - 6, // 0x22 '"' - 0x00,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x22 '"' + 0x00,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x23 '#' - 0x00,0x50,0x50,0xf8,0x50,0xf8,0x50,0x50,0x00, + 6, // 0x23 '#' + 0x00,0x50,0x50,0xf8,0x50,0xf8,0x50,0x50,0x00, - 6, // 0x24 '$' - 0x00,0x70,0xa8,0xa0,0x70,0x28,0xa8,0x70,0x00, + 6, // 0x24 '$' + 0x00,0x70,0xa8,0xa0,0x70,0x28,0xa8,0x70,0x00, - 6, // 0x25 '%' - 0x00,0xc8,0xc8,0x10,0x20,0x40,0x98,0x98,0x00, + 6, // 0x25 '%' + 0x00,0xc8,0xc8,0x10,0x20,0x40,0x98,0x98,0x00, - 6, // 0x26 '&' - 0x00,0x60,0x90,0x90,0x60,0xa8,0x90,0x68,0x00, + 6, // 0x26 '&' + 0x00,0x60,0x90,0x90,0x60,0xa8,0x90,0x68,0x00, - 6, // 0x27 ''' - 0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x27 ''' + 0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x28 '(' - 0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x10, + 6, // 0x28 '(' + 0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x10, - 6, // 0x29 ')' - 0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x40, + 6, // 0x29 ')' + 0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x40, - 6, // 0x2a '*' - 0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00, + 6, // 0x2a '*' + 0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00, - 6, // 0x2b '+' - 0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, + 6, // 0x2b '+' + 0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, - 6, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x40, + 6, // 0x2c ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x40, - 6, // 0x2d '-' - 0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00, + 6, // 0x2d '-' + 0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00, - 6, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, + 6, // 0x2e '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, - 6, // 0x2f '/' - 0x00,0x08,0x08,0x10,0x20,0x40,0x80,0x80,0x00, + 6, // 0x2f '/' + 0x00,0x08,0x08,0x10,0x20,0x40,0x80,0x80,0x00, - 6, // 0x30 '0' - 0x00,0x70,0x88,0x98,0xa8,0xc8,0x88,0x70,0x00, + 6, // 0x30 '0' + 0x00,0x70,0x88,0x98,0xa8,0xc8,0x88,0x70,0x00, - 6, // 0x31 '1' - 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x70,0x00, + 6, // 0x31 '1' + 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x70,0x00, - 6, // 0x32 '2' - 0x00,0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x00, + 6, // 0x32 '2' + 0x00,0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x00, - 6, // 0x33 '3' - 0x00,0xf8,0x10,0x20,0x70,0x08,0x88,0x70,0x00, + 6, // 0x33 '3' + 0x00,0xf8,0x10,0x20,0x70,0x08,0x88,0x70,0x00, - 6, // 0x34 '4' - 0x00,0x10,0x20,0x40,0x90,0xf8,0x10,0x10,0x00, + 6, // 0x34 '4' + 0x00,0x10,0x20,0x40,0x90,0xf8,0x10,0x10,0x00, - 6, // 0x35 '5' - 0x00,0xf8,0x80,0xf0,0x08,0x08,0x88,0x70,0x00, + 6, // 0x35 '5' + 0x00,0xf8,0x80,0xf0,0x08,0x08,0x88,0x70,0x00, - 6, // 0x36 '6' - 0x00,0x70,0x88,0x80,0xf0,0x88,0x88,0x70,0x00, + 6, // 0x36 '6' + 0x00,0x70,0x88,0x80,0xf0,0x88,0x88,0x70,0x00, - 6, // 0x37 '7' - 0x00,0xf8,0x08,0x08,0x10,0x20,0x40,0x40,0x00, + 6, // 0x37 '7' + 0x00,0xf8,0x08,0x08,0x10,0x20,0x40,0x40,0x00, - 6, // 0x38 '8' - 0x00,0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00, + 6, // 0x38 '8' + 0x00,0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00, - 6, // 0x39 '9' - 0x00,0x70,0x88,0x88,0x78,0x08,0x88,0x70,0x00, + 6, // 0x39 '9' + 0x00,0x70,0x88,0x88,0x78,0x08,0x88,0x70,0x00, - 6, // 0x3a ':' - 0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00, + 6, // 0x3a ':' + 0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00, - 6, // 0x3b ';' - 0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x20,0x40, + 6, // 0x3b ';' + 0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x20,0x40, - 6, // 0x3c '<' - 0x00,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x00, + 6, // 0x3c '<' + 0x00,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x00, - 6, // 0x3d '=' - 0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00, + 6, // 0x3d '=' + 0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00, - 6, // 0x3e '>' - 0x00,0x80,0x40,0x20,0x10,0x20,0x40,0x80,0x00, + 6, // 0x3e '>' + 0x00,0x80,0x40,0x20,0x10,0x20,0x40,0x80,0x00, - 6, // 0x3f '?' - 0x00,0x70,0x88,0x08,0x10,0x20,0x00,0x20,0x00, + 6, // 0x3f '?' + 0x00,0x70,0x88,0x08,0x10,0x20,0x00,0x20,0x00, - 6, // 0x40 '@' - 0x00,0x70,0x88,0x88,0xb8,0xb8,0x80,0x70,0x00, + 6, // 0x40 '@' + 0x00,0x70,0x88,0x88,0xb8,0xb8,0x80,0x70,0x00, - 6, // 0x41 'A' - 0x00,0x20,0x50,0x88,0x88,0xf8,0x88,0x88,0x00, + 6, // 0x41 'A' + 0x00,0x20,0x50,0x88,0x88,0xf8,0x88,0x88,0x00, - 6, // 0x42 'B' - 0x00,0xf0,0x88,0x88,0xf0,0x88,0x88,0xf0,0x00, + 6, // 0x42 'B' + 0x00,0xf0,0x88,0x88,0xf0,0x88,0x88,0xf0,0x00, - 6, // 0x43 'C' - 0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00, + 6, // 0x43 'C' + 0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00, - 6, // 0x44 'D' - 0x00,0xe0,0x90,0x88,0x88,0x88,0x90,0xe0,0x00, + 6, // 0x44 'D' + 0x00,0xe0,0x90,0x88,0x88,0x88,0x90,0xe0,0x00, - 6, // 0x45 'E' - 0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x00, + 6, // 0x45 'E' + 0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x00, - 6, // 0x46 'F' - 0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0x80,0x00, + 6, // 0x46 'F' + 0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0x80,0x00, - 6, // 0x47 'G' - 0x00,0x70,0x88,0x80,0xb8,0x88,0x88,0x70,0x00, + 6, // 0x47 'G' + 0x00,0x70,0x88,0x80,0xb8,0x88,0x88,0x70,0x00, - 6, // 0x48 'H' - 0x00,0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00, + 6, // 0x48 'H' + 0x00,0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00, - 6, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 6, // 0x49 'I' + 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00, - 6, // 0x4a 'J' - 0x00,0x38,0x10,0x10,0x10,0x10,0x90,0x60,0x00, + 6, // 0x4a 'J' + 0x00,0x38,0x10,0x10,0x10,0x10,0x90,0x60,0x00, - 6, // 0x4b 'K' - 0x00,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x00, + 6, // 0x4b 'K' + 0x00,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x00, - 6, // 0x4c 'L' - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00, + 6, // 0x4c 'L' + 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00, - 6, // 0x4d 'M' - 0x00,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x00, + 6, // 0x4d 'M' + 0x00,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x00, - 6, // 0x4e 'N' - 0x00,0x88,0x88,0xc8,0xa8,0x98,0x88,0x88,0x00, + 6, // 0x4e 'N' + 0x00,0x88,0x88,0xc8,0xa8,0x98,0x88,0x88,0x00, - 6, // 0x4f 'O' - 0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00, + 6, // 0x4f 'O' + 0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00, - 6, // 0x50 'P' - 0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x80,0x00, + 6, // 0x50 'P' + 0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x80,0x00, - 6, // 0x51 'Q' - 0x00,0x70,0x88,0x88,0x88,0xa8,0x90,0x68,0x00, + 6, // 0x51 'Q' + 0x00,0x70,0x88,0x88,0x88,0xa8,0x90,0x68,0x00, - 6, // 0x52 'R' - 0x00,0xf0,0x88,0x88,0x88,0xf0,0x90,0x88,0x00, + 6, // 0x52 'R' + 0x00,0xf0,0x88,0x88,0x88,0xf0,0x90,0x88,0x00, - 6, // 0x53 'S' - 0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00, + 6, // 0x53 'S' + 0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00, - 6, // 0x54 'T' - 0x00,0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 6, // 0x54 'T' + 0x00,0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x00, - 6, // 0x55 'U' - 0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00, + 6, // 0x55 'U' + 0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00, - 6, // 0x56 'V' - 0x00,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x00, + 6, // 0x56 'V' + 0x00,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x00, - 6, // 0x57 'W' - 0x00,0x88,0x88,0x88,0xa8,0xa8,0xd8,0x88,0x00, + 6, // 0x57 'W' + 0x00,0x88,0x88,0x88,0xa8,0xa8,0xd8,0x88,0x00, - 6, // 0x58 'X' - 0x00,0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x00, + 6, // 0x58 'X' + 0x00,0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x00, - 6, // 0x59 'Y' - 0x00,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x00, + 6, // 0x59 'Y' + 0x00,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x00, - 6, // 0x5a 'Z' - 0x00,0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00, + 6, // 0x5a 'Z' + 0x00,0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00, - 6, // 0x5b '[' - 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70, + 6, // 0x5b '[' + 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70, - 6, // 0x5c '\' - 0x00,0x80,0x80,0x40,0x20,0x10,0x08,0x08,0x00, + 6, // 0x5c '\' + 0x00,0x80,0x80,0x40,0x20,0x10,0x08,0x08,0x00, - 6, // 0x5d ']' - 0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70, + 6, // 0x5d ']' + 0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70, - 6, // 0x5e '^' - 0x00,0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00, + 6, // 0x5e '^' + 0x00,0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00, - 6, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00, + 6, // 0x5f '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00, - 6, // 0x60 '`' - 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x60 '`' + 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x61 'a' - 0x00,0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00, + 6, // 0x61 'a' + 0x00,0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00, - 6, // 0x62 'b' - 0x00,0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x00, + 6, // 0x62 'b' + 0x00,0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x70,0x88,0x80,0x88,0x70,0x00, + 6, // 0x63 'c' + 0x00,0x00,0x00,0x70,0x88,0x80,0x88,0x70,0x00, - 6, // 0x64 'd' - 0x00,0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x00, + 6, // 0x64 'd' + 0x00,0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x00, - 6, // 0x65 'e' - 0x00,0x00,0x00,0x70,0x88,0xf8,0x80,0x78,0x00, + 6, // 0x65 'e' + 0x00,0x00,0x00,0x70,0x88,0xf8,0x80,0x78,0x00, - 6, // 0x66 'f' - 0x00,0x18,0x20,0x20,0xf8,0x20,0x20,0x20,0x00, + 6, // 0x66 'f' + 0x00,0x18,0x20,0x20,0xf8,0x20,0x20,0x20,0x00, - 6, // 0x67 'g' - 0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x70, + 6, // 0x67 'g' + 0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x70, - 6, // 0x68 'h' - 0x00,0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x00, + 6, // 0x68 'h' + 0x00,0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x00, - 6, // 0x69 'i' - 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x70,0x00, + 6, // 0x69 'i' + 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x70,0x00, - 6, // 0x6a 'j' - 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x90,0x60, + 6, // 0x6a 'j' + 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x90,0x60, - 6, // 0x6b 'k' - 0x00,0x00,0x80,0x88,0x90,0xa0,0xd0,0x88,0x00, + 6, // 0x6b 'k' + 0x00,0x00,0x80,0x88,0x90,0xa0,0xd0,0x88,0x00, - 6, // 0x6c 'l' - 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 6, // 0x6c 'l' + 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00, - 6, // 0x6d 'm' - 0x00,0x00,0x00,0xd0,0xa8,0xa8,0xa8,0xa8,0x00, + 6, // 0x6d 'm' + 0x00,0x00,0x00,0xd0,0xa8,0xa8,0xa8,0xa8,0x00, - 6, // 0x6e 'n' - 0x00,0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x00, + 6, // 0x6e 'n' + 0x00,0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x00, - 6, // 0x6f 'o' - 0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00, + 6, // 0x6f 'o' + 0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00, - 6, // 0x70 'p' - 0x00,0x00,0x00,0xf0,0x88,0x88,0xf0,0x80,0x80, + 6, // 0x70 'p' + 0x00,0x00,0x00,0xf0,0x88,0x88,0xf0,0x80,0x80, - 6, // 0x71 'q' - 0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x08, + 6, // 0x71 'q' + 0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x08, - 6, // 0x72 'r' - 0x00,0x00,0x00,0xb8,0xc0,0x80,0x80,0x80,0x00, + 6, // 0x72 'r' + 0x00,0x00,0x00,0xb8,0xc0,0x80,0x80,0x80,0x00, - 6, // 0x73 's' - 0x00,0x00,0x00,0x78,0x80,0x70,0x08,0xf0,0x00, + 6, // 0x73 's' + 0x00,0x00,0x00,0x78,0x80,0x70,0x08,0xf0,0x00, - 6, // 0x74 't' - 0x00,0x40,0x40,0xe0,0x40,0x40,0x48,0x30,0x00, + 6, // 0x74 't' + 0x00,0x40,0x40,0xe0,0x40,0x40,0x48,0x30,0x00, - 6, // 0x75 'u' - 0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x78,0x00, + 6, // 0x75 'u' + 0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x78,0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00, + 6, // 0x76 'v' + 0x00,0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00, - 6, // 0x77 'w' - 0x00,0x00,0x00,0x88,0x88,0xa8,0xd8,0x88,0x00, + 6, // 0x77 'w' + 0x00,0x00,0x00,0x88,0x88,0xa8,0xd8,0x88,0x00, - 6, // 0x78 'x' - 0x00,0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00, + 6, // 0x78 'x' + 0x00,0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00, - 6, // 0x79 'y' - 0x00,0x00,0x00,0x88,0x88,0x88,0x78,0x08,0x70, + 6, // 0x79 'y' + 0x00,0x00,0x00,0x88,0x88,0x88,0x78,0x08,0x70, - 6, // 0x7a 'z' - 0x00,0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x00, + 6, // 0x7a 'z' + 0x00,0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x00, - 6, // 0x7b '{' - 0x18,0x20,0x20,0x20,0xc0,0x20,0x20,0x20,0x18, + 6, // 0x7b '{' + 0x18,0x20,0x20,0x20,0xc0,0x20,0x20,0x20,0x18, - 6, // 0x7c '|' - 0x00,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x00, + 6, // 0x7c '|' + 0x00,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x00, - 6, // 0x7d '}' - 0xc0,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0xc0, + 6, // 0x7d '}' + 0xc0,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0xc0, - 6, // 0x7e '~' - 0x00,0x40,0xa8,0x10,0x00,0x00,0x00,0x00,0x00, + 6, // 0x7e '~' + 0x00,0x40,0xa8,0x10,0x00,0x00,0x00,0x00,0x00, - 6, // 0x7f '' - 0x00,0x00,0x00,0x20,0x50,0x88,0xf8,0x00,0x00, - 0 - }; + 6, // 0x7f '' + 0x00,0x00,0x00,0x20,0x50,0x88,0xf8,0x00,0x00, + 0 +}; - const int8u gse7x11[] = - { - 11, 0, 32, 128-32, +const int8u gse7x11[] = +{ + 11, 0, 32, 128-32, - 0x00,0x00,0x0c,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3c,0x00,0x48,0x00,0x54,0x00,0x60,0x00, - 0x6c,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9c,0x00,0xa8,0x00,0xb4,0x00,0xc0,0x00,0xcc,0x00, - 0xd8,0x00,0xe4,0x00,0xf0,0x00,0xfc,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2c,0x01,0x38,0x01, - 0x44,0x01,0x50,0x01,0x5c,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8c,0x01,0x98,0x01,0xa4,0x01, - 0xb0,0x01,0xbc,0x01,0xc8,0x01,0xd4,0x01,0xe0,0x01,0xec,0x01,0xf8,0x01,0x04,0x02,0x10,0x02, - 0x1c,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4c,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7c,0x02, - 0x88,0x02,0x94,0x02,0xa0,0x02,0xac,0x02,0xb8,0x02,0xc4,0x02,0xd0,0x02,0xdc,0x02,0xe8,0x02, - 0xf4,0x02,0x00,0x03,0x0c,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3c,0x03,0x48,0x03,0x54,0x03, - 0x60,0x03,0x6c,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9c,0x03,0xa8,0x03,0xb4,0x03,0xc0,0x03, - 0xcc,0x03,0xd8,0x03,0xe4,0x03,0xf0,0x03,0xfc,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2c,0x04, - 0x38,0x04,0x44,0x04,0x50,0x04,0x5c,0x04,0x68,0x04,0x74,0x04, + 0x00,0x00,0x0c,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3c,0x00,0x48,0x00,0x54,0x00,0x60,0x00, + 0x6c,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9c,0x00,0xa8,0x00,0xb4,0x00,0xc0,0x00,0xcc,0x00, + 0xd8,0x00,0xe4,0x00,0xf0,0x00,0xfc,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2c,0x01,0x38,0x01, + 0x44,0x01,0x50,0x01,0x5c,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8c,0x01,0x98,0x01,0xa4,0x01, + 0xb0,0x01,0xbc,0x01,0xc8,0x01,0xd4,0x01,0xe0,0x01,0xec,0x01,0xf8,0x01,0x04,0x02,0x10,0x02, + 0x1c,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4c,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7c,0x02, + 0x88,0x02,0x94,0x02,0xa0,0x02,0xac,0x02,0xb8,0x02,0xc4,0x02,0xd0,0x02,0xdc,0x02,0xe8,0x02, + 0xf4,0x02,0x00,0x03,0x0c,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3c,0x03,0x48,0x03,0x54,0x03, + 0x60,0x03,0x6c,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9c,0x03,0xa8,0x03,0xb4,0x03,0xc0,0x03, + 0xcc,0x03,0xd8,0x03,0xe4,0x03,0xf0,0x03,0xfc,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2c,0x04, + 0x38,0x04,0x44,0x04,0x50,0x04,0x5c,0x04,0x68,0x04,0x74,0x04, - 7, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x21 '!' - 0x00,0x10,0x38,0x38,0x38,0x10,0x10,0x00,0x10,0x00,0x00, + 7, // 0x21 '!' + 0x00,0x10,0x38,0x38,0x38,0x10,0x10,0x00,0x10,0x00,0x00, - 7, // 0x22 '"' - 0x00,0x00,0x24,0x24,0x24,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x00,0x00,0x24,0x24,0x24,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x23 '#' - 0x00,0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48,0x00,0x00, + 7, // 0x23 '#' + 0x00,0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48,0x00,0x00, - 7, // 0x24 '$' - 0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x00, + 7, // 0x24 '$' + 0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x00, - 7, // 0x25 '%' - 0x00,0x00,0x42,0xa4,0x48,0x10,0x24,0x4a,0x84,0x00,0x00, + 7, // 0x25 '%' + 0x00,0x00,0x42,0xa4,0x48,0x10,0x24,0x4a,0x84,0x00,0x00, - 7, // 0x26 '&' - 0x00,0x30,0x48,0x48,0x30,0x60,0x94,0x98,0x6c,0x00,0x00, + 7, // 0x26 '&' + 0x00,0x30,0x48,0x48,0x30,0x60,0x94,0x98,0x6c,0x00,0x00, - 7, // 0x27 ''' - 0x00,0x20,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x27 ''' + 0x00,0x20,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x28 '(' - 0x00,0x04,0x08,0x10,0x10,0x10,0x10,0x08,0x04,0x00,0x00, + 7, // 0x28 '(' + 0x00,0x04,0x08,0x10,0x10,0x10,0x10,0x08,0x04,0x00,0x00, - 7, // 0x29 ')' - 0x00,0x40,0x20,0x10,0x10,0x10,0x10,0x20,0x40,0x00,0x00, + 7, // 0x29 ')' + 0x00,0x40,0x20,0x10,0x10,0x10,0x10,0x20,0x40,0x00,0x00, - 7, // 0x2a '*' - 0x00,0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00,0x00, + 7, // 0x2a '*' + 0x00,0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00,0x00, - 7, // 0x2b '+' - 0x00,0x00,0x00,0x10,0x10,0x7c,0x10,0x10,0x00,0x00,0x00, + 7, // 0x2b '+' + 0x00,0x00,0x00,0x10,0x10,0x7c,0x10,0x10,0x00,0x00,0x00, - 7, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60, + 7, // 0x2c ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60, - 7, // 0x2d '-' - 0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2d '-' + 0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00, - 7, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, + 7, // 0x2e '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, - 7, // 0x2f '/' - 0x00,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00, + 7, // 0x2f '/' + 0x00,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00, - 7, // 0x30 '0' - 0x00,0x38,0x44,0x4c,0x54,0x64,0x44,0x44,0x38,0x00,0x00, + 7, // 0x30 '0' + 0x00,0x38,0x44,0x4c,0x54,0x64,0x44,0x44,0x38,0x00,0x00, - 7, // 0x31 '1' - 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x7c,0x00,0x00, + 7, // 0x31 '1' + 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x7c,0x00,0x00, - 7, // 0x32 '2' - 0x00,0x38,0x44,0x04,0x08,0x10,0x20,0x44,0x7c,0x00,0x00, + 7, // 0x32 '2' + 0x00,0x38,0x44,0x04,0x08,0x10,0x20,0x44,0x7c,0x00,0x00, - 7, // 0x33 '3' - 0x00,0x7c,0x48,0x10,0x38,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x33 '3' + 0x00,0x7c,0x48,0x10,0x38,0x04,0x04,0x44,0x38,0x00,0x00, - 7, // 0x34 '4' - 0x00,0x08,0x10,0x20,0x48,0x48,0x7c,0x08,0x1c,0x00,0x00, + 7, // 0x34 '4' + 0x00,0x08,0x10,0x20,0x48,0x48,0x7c,0x08,0x1c,0x00,0x00, - 7, // 0x35 '5' - 0x00,0x7c,0x40,0x40,0x78,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x35 '5' + 0x00,0x7c,0x40,0x40,0x78,0x04,0x04,0x44,0x38,0x00,0x00, - 7, // 0x36 '6' - 0x00,0x18,0x20,0x40,0x78,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x36 '6' + 0x00,0x18,0x20,0x40,0x78,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x37 '7' - 0x00,0x7c,0x44,0x04,0x08,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x37 '7' + 0x00,0x7c,0x44,0x04,0x08,0x10,0x10,0x10,0x10,0x00,0x00, - 7, // 0x38 '8' - 0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x38 '8' + 0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x39 '9' - 0x00,0x38,0x44,0x44,0x44,0x3c,0x04,0x08,0x30,0x00,0x00, + 7, // 0x39 '9' + 0x00,0x38,0x44,0x44,0x44,0x3c,0x04,0x08,0x30,0x00,0x00, - 7, // 0x3a ':' - 0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x30,0x00,0x00,0x00, + 7, // 0x3a ':' + 0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x30,0x00,0x00,0x00, - 7, // 0x3b ';' - 0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x30,0x30,0x60,0x00, + 7, // 0x3b ';' + 0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x30,0x30,0x60,0x00, - 7, // 0x3c '<' - 0x00,0x00,0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x00,0x00, + 7, // 0x3c '<' + 0x00,0x00,0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x00,0x00, - 7, // 0x3d '=' - 0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00, + 7, // 0x3d '=' + 0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00, - 7, // 0x3e '>' - 0x00,0x00,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x00,0x00, + 7, // 0x3e '>' + 0x00,0x00,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x00,0x00, - 7, // 0x3f '?' - 0x00,0x70,0x88,0x88,0x10,0x20,0x20,0x00,0x20,0x00,0x00, + 7, // 0x3f '?' + 0x00,0x70,0x88,0x88,0x10,0x20,0x20,0x00,0x20,0x00,0x00, - 7, // 0x40 '@' - 0x00,0x30,0x48,0x04,0x34,0x54,0x54,0x54,0x28,0x00,0x00, + 7, // 0x40 '@' + 0x00,0x30,0x48,0x04,0x34,0x54,0x54,0x54,0x28,0x00,0x00, - 7, // 0x41 'A' - 0x00,0x10,0x28,0x44,0x44,0x7c,0x44,0x44,0x44,0x00,0x00, + 7, // 0x41 'A' + 0x00,0x10,0x28,0x44,0x44,0x7c,0x44,0x44,0x44,0x00,0x00, - 7, // 0x42 'B' - 0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00, + 7, // 0x42 'B' + 0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00, - 7, // 0x43 'C' - 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00, + 7, // 0x43 'C' + 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00, - 7, // 0x44 'D' - 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00, + 7, // 0x44 'D' + 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00, - 7, // 0x45 'E' - 0x00,0x7c,0x40,0x40,0x70,0x40,0x40,0x40,0x7c,0x00,0x00, + 7, // 0x45 'E' + 0x00,0x7c,0x40,0x40,0x70,0x40,0x40,0x40,0x7c,0x00,0x00, - 7, // 0x46 'F' - 0x00,0x7c,0x40,0x40,0x70,0x40,0x40,0x40,0x40,0x00,0x00, + 7, // 0x46 'F' + 0x00,0x7c,0x40,0x40,0x70,0x40,0x40,0x40,0x40,0x00,0x00, - 7, // 0x47 'G' - 0x00,0x38,0x44,0x40,0x40,0x5c,0x44,0x44,0x38,0x00,0x00, + 7, // 0x47 'G' + 0x00,0x38,0x44,0x40,0x40,0x5c,0x44,0x44,0x38,0x00,0x00, - 7, // 0x48 'H' - 0x00,0x44,0x44,0x44,0x7c,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x48 'H' + 0x00,0x44,0x44,0x44,0x7c,0x44,0x44,0x44,0x44,0x00,0x00, - 7, // 0x49 'I' - 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x49 'I' + 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, - 7, // 0x4a 'J' - 0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x48,0x30,0x00,0x00, + 7, // 0x4a 'J' + 0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x48,0x30,0x00,0x00, - 7, // 0x4b 'K' - 0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x44,0x00,0x00, + 7, // 0x4b 'K' + 0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x44,0x00,0x00, - 7, // 0x4c 'L' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7c,0x00,0x00, + 7, // 0x4c 'L' + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7c,0x00,0x00, - 7, // 0x4d 'M' - 0x00,0x44,0x6c,0x54,0x54,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x4d 'M' + 0x00,0x44,0x6c,0x54,0x54,0x44,0x44,0x44,0x44,0x00,0x00, - 7, // 0x4e 'N' - 0x00,0x44,0x44,0x64,0x54,0x4c,0x44,0x44,0x44,0x00,0x00, + 7, // 0x4e 'N' + 0x00,0x44,0x44,0x64,0x54,0x4c,0x44,0x44,0x44,0x00,0x00, - 7, // 0x4f 'O' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x4f 'O' + 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x50 'P' - 0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, + 7, // 0x50 'P' + 0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, - 7, // 0x51 'Q' - 0x00,0x38,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, + 7, // 0x51 'Q' + 0x00,0x38,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, - 7, // 0x52 'R' - 0x00,0x78,0x44,0x44,0x44,0x78,0x50,0x48,0x44,0x00,0x00, + 7, // 0x52 'R' + 0x00,0x78,0x44,0x44,0x44,0x78,0x50,0x48,0x44,0x00,0x00, - 7, // 0x53 'S' - 0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x44,0x38,0x00,0x00, + 7, // 0x53 'S' + 0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x44,0x38,0x00,0x00, - 7, // 0x54 'T' - 0x00,0x7c,0x54,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x54 'T' + 0x00,0x7c,0x54,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, - 7, // 0x55 'U' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x55 'U' + 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x56 'V' - 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, + 7, // 0x56 'V' + 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, - 7, // 0x57 'W' - 0x00,0x44,0x44,0x44,0x44,0x54,0x54,0x6c,0x44,0x00,0x00, + 7, // 0x57 'W' + 0x00,0x44,0x44,0x44,0x44,0x54,0x54,0x6c,0x44,0x00,0x00, - 7, // 0x58 'X' - 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00, + 7, // 0x58 'X' + 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00, - 7, // 0x59 'Y' - 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x59 'Y' + 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x38,0x00,0x00, - 7, // 0x5a 'Z' - 0x00,0x7c,0x04,0x08,0x10,0x20,0x40,0x44,0x7c,0x00,0x00, + 7, // 0x5a 'Z' + 0x00,0x7c,0x04,0x08,0x10,0x20,0x40,0x44,0x7c,0x00,0x00, - 7, // 0x5b '[' - 0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00,0x00, + 7, // 0x5b '[' + 0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00,0x00, - 7, // 0x5c '\' - 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00,0x00, + 7, // 0x5c '\' + 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00,0x00, - 7, // 0x5d ']' - 0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00,0x00, + 7, // 0x5d ']' + 0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00,0x00, - 7, // 0x5e '^' - 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x5e '^' + 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00, + 7, // 0x5f '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00, - 7, // 0x60 '`' - 0x00,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x60 '`' + 0x00,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x38,0x04,0x3c,0x44,0x44,0x3c,0x00,0x00, + 7, // 0x61 'a' + 0x00,0x00,0x00,0x38,0x04,0x3c,0x44,0x44,0x3c,0x00,0x00, - 7, // 0x62 'b' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00, + 7, // 0x62 'b' + 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x00, + 7, // 0x63 'c' + 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x00, - 7, // 0x64 'd' - 0x00,0x04,0x04,0x3c,0x44,0x44,0x44,0x44,0x3c,0x00,0x00, + 7, // 0x64 'd' + 0x00,0x04,0x04,0x3c,0x44,0x44,0x44,0x44,0x3c,0x00,0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x38,0x44,0x7c,0x40,0x44,0x38,0x00,0x00, + 7, // 0x65 'e' + 0x00,0x00,0x00,0x38,0x44,0x7c,0x40,0x44,0x38,0x00,0x00, - 7, // 0x66 'f' - 0x00,0x18,0x24,0x20,0x70,0x20,0x20,0x20,0x70,0x00,0x00, + 7, // 0x66 'f' + 0x00,0x18,0x24,0x20,0x70,0x20,0x20,0x20,0x70,0x00,0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x3c,0x44,0x44,0x44,0x3c,0x04,0x44,0x38, + 7, // 0x67 'g' + 0x00,0x00,0x00,0x3c,0x44,0x44,0x44,0x3c,0x04,0x44,0x38, - 7, // 0x68 'h' - 0x00,0x40,0x40,0x40,0x58,0x64,0x44,0x44,0x44,0x00,0x00, + 7, // 0x68 'h' + 0x00,0x40,0x40,0x40,0x58,0x64,0x44,0x44,0x44,0x00,0x00, - 7, // 0x69 'i' - 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x69 'i' + 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00, - 7, // 0x6a 'j' - 0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x48,0x30,0x00, + 7, // 0x6a 'j' + 0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x48,0x30,0x00, - 7, // 0x6b 'k' - 0x00,0x40,0x40,0x44,0x48,0x50,0x68,0x44,0x44,0x00,0x00, + 7, // 0x6b 'k' + 0x00,0x40,0x40,0x44,0x48,0x50,0x68,0x44,0x44,0x00,0x00, - 7, // 0x6c 'l' - 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x6c 'l' + 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, - 7, // 0x6d 'm' - 0x00,0x00,0x00,0xa8,0x54,0x54,0x54,0x54,0x54,0x00,0x00, + 7, // 0x6d 'm' + 0x00,0x00,0x00,0xa8,0x54,0x54,0x54,0x54,0x54,0x00,0x00, - 7, // 0x6e 'n' - 0x00,0x00,0x00,0xb8,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x6e 'n' + 0x00,0x00,0x00,0xb8,0x44,0x44,0x44,0x44,0x44,0x00,0x00, - 7, // 0x6f 'o' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x6f 'o' + 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40, + 7, // 0x70 'p' + 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x3c,0x44,0x44,0x44,0x44,0x3c,0x04,0x04, + 7, // 0x71 'q' + 0x00,0x00,0x00,0x3c,0x44,0x44,0x44,0x44,0x3c,0x04,0x04, - 7, // 0x72 'r' - 0x00,0x00,0x00,0x58,0x64,0x44,0x40,0x40,0x40,0x00,0x00, + 7, // 0x72 'r' + 0x00,0x00,0x00,0x58,0x64,0x44,0x40,0x40,0x40,0x00,0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x3c,0x40,0x38,0x04,0x04,0x78,0x00,0x00, + 7, // 0x73 's' + 0x00,0x00,0x00,0x3c,0x40,0x38,0x04,0x04,0x78,0x00,0x00, - 7, // 0x74 't' - 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x24,0x18,0x00,0x00, + 7, // 0x74 't' + 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x24,0x18,0x00,0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x3a,0x00,0x00, + 7, // 0x75 'u' + 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x3a,0x00,0x00, - 7, // 0x76 'v' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x00,0x00, + 7, // 0x76 'v' + 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x00,0x00, - 7, // 0x77 'w' - 0x00,0x00,0x00,0x44,0x44,0x54,0x54,0x6c,0x44,0x00,0x00, + 7, // 0x77 'w' + 0x00,0x00,0x00,0x44,0x44,0x54,0x54,0x6c,0x44,0x00,0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, + 7, // 0x78 'x' + 0x00,0x00,0x00,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x44,0x44,0x44,0x3c,0x04,0x08,0x30,0x00, + 7, // 0x79 'y' + 0x00,0x00,0x00,0x44,0x44,0x44,0x3c,0x04,0x08,0x30,0x00, - 7, // 0x7a 'z' - 0x00,0x00,0x00,0x7c,0x08,0x10,0x20,0x44,0x7c,0x00,0x00, + 7, // 0x7a 'z' + 0x00,0x00,0x00,0x7c,0x08,0x10,0x20,0x44,0x7c,0x00,0x00, - 7, // 0x7b '{' - 0x00,0x0c,0x10,0x10,0x10,0x60,0x10,0x10,0x0c,0x00,0x00, + 7, // 0x7b '{' + 0x00,0x0c,0x10,0x10,0x10,0x60,0x10,0x10,0x0c,0x00,0x00, - 7, // 0x7c '|' - 0x00,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x20,0x00,0x00, + 7, // 0x7c '|' + 0x00,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x20,0x00,0x00, - 7, // 0x7d '}' - 0x00,0x60,0x10,0x10,0x10,0x0c,0x10,0x10,0x60,0x00,0x00, + 7, // 0x7d '}' + 0x00,0x60,0x10,0x10,0x10,0x0c,0x10,0x10,0x60,0x00,0x00, - 7, // 0x7e '~' - 0x00,0x00,0x64,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7e '~' + 0x00,0x00,0x64,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x7f '' - 0x00,0x00,0x00,0x10,0x28,0x44,0x44,0x7c,0x00,0x00,0x00, - 0 - }; + 7, // 0x7f '' + 0x00,0x00,0x00,0x10,0x28,0x44,0x44,0x7c,0x00,0x00,0x00, + 0 +}; - const int8u gse7x11_bold[] = - { - 11, 0, 32, 128-32, +const int8u gse7x11_bold[] = +{ + 11, 0, 32, 128-32, - 0x00,0x00,0x0c,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3c,0x00,0x48,0x00,0x54,0x00,0x60,0x00, - 0x6c,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9c,0x00,0xa8,0x00,0xb4,0x00,0xc0,0x00,0xcc,0x00, - 0xd8,0x00,0xe4,0x00,0xf0,0x00,0xfc,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2c,0x01,0x38,0x01, - 0x44,0x01,0x50,0x01,0x5c,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8c,0x01,0x98,0x01,0xa4,0x01, - 0xb0,0x01,0xbc,0x01,0xc8,0x01,0xd4,0x01,0xe0,0x01,0xec,0x01,0xf8,0x01,0x04,0x02,0x10,0x02, - 0x1c,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4c,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7c,0x02, - 0x88,0x02,0x94,0x02,0xa0,0x02,0xac,0x02,0xb8,0x02,0xc4,0x02,0xd0,0x02,0xdc,0x02,0xe8,0x02, - 0xf4,0x02,0x00,0x03,0x0c,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3c,0x03,0x48,0x03,0x54,0x03, - 0x60,0x03,0x6c,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9c,0x03,0xa8,0x03,0xb4,0x03,0xc0,0x03, - 0xcc,0x03,0xd8,0x03,0xe4,0x03,0xf0,0x03,0xfc,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2c,0x04, - 0x38,0x04,0x44,0x04,0x50,0x04,0x5c,0x04,0x68,0x04,0x74,0x04, + 0x00,0x00,0x0c,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3c,0x00,0x48,0x00,0x54,0x00,0x60,0x00, + 0x6c,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9c,0x00,0xa8,0x00,0xb4,0x00,0xc0,0x00,0xcc,0x00, + 0xd8,0x00,0xe4,0x00,0xf0,0x00,0xfc,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2c,0x01,0x38,0x01, + 0x44,0x01,0x50,0x01,0x5c,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8c,0x01,0x98,0x01,0xa4,0x01, + 0xb0,0x01,0xbc,0x01,0xc8,0x01,0xd4,0x01,0xe0,0x01,0xec,0x01,0xf8,0x01,0x04,0x02,0x10,0x02, + 0x1c,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4c,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7c,0x02, + 0x88,0x02,0x94,0x02,0xa0,0x02,0xac,0x02,0xb8,0x02,0xc4,0x02,0xd0,0x02,0xdc,0x02,0xe8,0x02, + 0xf4,0x02,0x00,0x03,0x0c,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3c,0x03,0x48,0x03,0x54,0x03, + 0x60,0x03,0x6c,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9c,0x03,0xa8,0x03,0xb4,0x03,0xc0,0x03, + 0xcc,0x03,0xd8,0x03,0xe4,0x03,0xf0,0x03,0xfc,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2c,0x04, + 0x38,0x04,0x44,0x04,0x50,0x04,0x5c,0x04,0x68,0x04,0x74,0x04, - 7, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x21 '!' - 0x00,0x30,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00, + 7, // 0x21 '!' + 0x00,0x30,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00, - 7, // 0x22 '"' - 0x00,0x6c,0x6c,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x00,0x6c,0x6c,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x23 '#' - 0x00,0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48,0x00,0x00, + 7, // 0x23 '#' + 0x00,0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48,0x00,0x00, - 7, // 0x24 '$' - 0x30,0x30,0x78,0xcc,0xc0,0x78,0x0c,0xcc,0x78,0x30,0x30, + 7, // 0x24 '$' + 0x30,0x30,0x78,0xcc,0xc0,0x78,0x0c,0xcc,0x78,0x30,0x30, - 7, // 0x25 '%' - 0x00,0x00,0xc4,0x0c,0x18,0x30,0x60,0xc0,0x8c,0x00,0x00, + 7, // 0x25 '%' + 0x00,0x00,0xc4,0x0c,0x18,0x30,0x60,0xc0,0x8c,0x00,0x00, - 7, // 0x26 '&' - 0x00,0x30,0x58,0x58,0x30,0x74,0xdc,0xd8,0x6c,0x00,0x00, + 7, // 0x26 '&' + 0x00,0x30,0x58,0x58,0x30,0x74,0xdc,0xd8,0x6c,0x00,0x00, - 7, // 0x27 ''' - 0x00,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x27 ''' + 0x00,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x28 '(' - 0x00,0x0c,0x18,0x30,0x30,0x30,0x30,0x18,0x0c,0x00,0x00, + 7, // 0x28 '(' + 0x00,0x0c,0x18,0x30,0x30,0x30,0x30,0x18,0x0c,0x00,0x00, - 7, // 0x29 ')' - 0x00,0xc0,0x60,0x30,0x30,0x30,0x30,0x60,0xc0,0x00,0x00, + 7, // 0x29 ')' + 0x00,0xc0,0x60,0x30,0x30,0x30,0x30,0x60,0xc0,0x00,0x00, - 7, // 0x2a '*' - 0x00,0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00,0x00, + 7, // 0x2a '*' + 0x00,0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00,0x00, - 7, // 0x2b '+' - 0x00,0x00,0x00,0x30,0x30,0xfc,0x30,0x30,0x00,0x00,0x00, + 7, // 0x2b '+' + 0x00,0x00,0x00,0x30,0x30,0xfc,0x30,0x30,0x00,0x00,0x00, - 7, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00, + 7, // 0x2c ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00, - 7, // 0x2d '-' - 0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2d '-' + 0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00, - 7, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, + 7, // 0x2e '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, - 7, // 0x2f '/' - 0x00,0x0c,0x0c,0x18,0x18,0x30,0x30,0x60,0x60,0x00,0x00, + 7, // 0x2f '/' + 0x00,0x0c,0x0c,0x18,0x18,0x30,0x30,0x60,0x60,0x00,0x00, - 7, // 0x30 '0' - 0x00,0x78,0xcc,0xcc,0xdc,0xec,0xcc,0xcc,0x78,0x00,0x00, + 7, // 0x30 '0' + 0x00,0x78,0xcc,0xcc,0xdc,0xec,0xcc,0xcc,0x78,0x00,0x00, - 7, // 0x31 '1' - 0x00,0x30,0x70,0xf0,0x30,0x30,0x30,0x30,0xfc,0x00,0x00, + 7, // 0x31 '1' + 0x00,0x30,0x70,0xf0,0x30,0x30,0x30,0x30,0xfc,0x00,0x00, - 7, // 0x32 '2' - 0x00,0x78,0xcc,0xcc,0x18,0x30,0x60,0xcc,0xfc,0x00,0x00, + 7, // 0x32 '2' + 0x00,0x78,0xcc,0xcc,0x18,0x30,0x60,0xcc,0xfc,0x00,0x00, - 7, // 0x33 '3' - 0x00,0xfc,0x98,0x30,0x78,0x0c,0x0c,0xcc,0x78,0x00,0x00, + 7, // 0x33 '3' + 0x00,0xfc,0x98,0x30,0x78,0x0c,0x0c,0xcc,0x78,0x00,0x00, - 7, // 0x34 '4' - 0x00,0x18,0x30,0x68,0xd8,0xd8,0xfc,0x18,0x3c,0x00,0x00, + 7, // 0x34 '4' + 0x00,0x18,0x30,0x68,0xd8,0xd8,0xfc,0x18,0x3c,0x00,0x00, - 7, // 0x35 '5' - 0x00,0xfc,0xc0,0xc0,0xf8,0x0c,0x0c,0xcc,0x78,0x00,0x00, + 7, // 0x35 '5' + 0x00,0xfc,0xc0,0xc0,0xf8,0x0c,0x0c,0xcc,0x78,0x00,0x00, - 7, // 0x36 '6' - 0x00,0x38,0x60,0xc0,0xf8,0xcc,0xcc,0xcc,0x78,0x00,0x00, + 7, // 0x36 '6' + 0x00,0x38,0x60,0xc0,0xf8,0xcc,0xcc,0xcc,0x78,0x00,0x00, - 7, // 0x37 '7' - 0x00,0xfc,0x8c,0x0c,0x18,0x30,0x30,0x30,0x30,0x00,0x00, + 7, // 0x37 '7' + 0x00,0xfc,0x8c,0x0c,0x18,0x30,0x30,0x30,0x30,0x00,0x00, - 7, // 0x38 '8' - 0x00,0x78,0xcc,0xcc,0x78,0xcc,0xcc,0xcc,0x78,0x00,0x00, + 7, // 0x38 '8' + 0x00,0x78,0xcc,0xcc,0x78,0xcc,0xcc,0xcc,0x78,0x00,0x00, - 7, // 0x39 '9' - 0x00,0x78,0xcc,0xcc,0xcc,0x7c,0x0c,0x18,0x70,0x00,0x00, + 7, // 0x39 '9' + 0x00,0x78,0xcc,0xcc,0xcc,0x7c,0x0c,0x18,0x70,0x00,0x00, - 7, // 0x3a ':' - 0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00,0x00, + 7, // 0x3a ':' + 0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00,0x00, - 7, // 0x3b ';' - 0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x60,0x00, + 7, // 0x3b ';' + 0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x60,0x00, - 7, // 0x3c '<' - 0x00,0x00,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x00,0x00, + 7, // 0x3c '<' + 0x00,0x00,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x00,0x00, - 7, // 0x3d '=' - 0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00, + 7, // 0x3d '=' + 0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00, - 7, // 0x3e '>' - 0x00,0x00,0x60,0x30,0x18,0x0c,0x18,0x30,0x60,0x00,0x00, + 7, // 0x3e '>' + 0x00,0x00,0x60,0x30,0x18,0x0c,0x18,0x30,0x60,0x00,0x00, - 7, // 0x3f '?' - 0x00,0x78,0xcc,0xcc,0x18,0x30,0x30,0x00,0x30,0x00,0x00, + 7, // 0x3f '?' + 0x00,0x78,0xcc,0xcc,0x18,0x30,0x30,0x00,0x30,0x00,0x00, - 7, // 0x40 '@' - 0x00,0x70,0x88,0x04,0x74,0xb4,0xb4,0xb4,0x68,0x00,0x00, + 7, // 0x40 '@' + 0x00,0x70,0x88,0x04,0x74,0xb4,0xb4,0xb4,0x68,0x00,0x00, - 7, // 0x41 'A' - 0x00,0x30,0x78,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0x00,0x00, + 7, // 0x41 'A' + 0x00,0x30,0x78,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0x00,0x00, - 7, // 0x42 'B' - 0x00,0xf8,0xcc,0xcc,0xf8,0xcc,0xcc,0xcc,0xf8,0x00,0x00, + 7, // 0x42 'B' + 0x00,0xf8,0xcc,0xcc,0xf8,0xcc,0xcc,0xcc,0xf8,0x00,0x00, - 7, // 0x43 'C' - 0x00,0x78,0xcc,0xc0,0xc0,0xc0,0xc0,0xcc,0x78,0x00,0x00, + 7, // 0x43 'C' + 0x00,0x78,0xcc,0xc0,0xc0,0xc0,0xc0,0xcc,0x78,0x00,0x00, - 7, // 0x44 'D' - 0x00,0xf0,0xd8,0xcc,0xcc,0xcc,0xcc,0xd8,0xf0,0x00,0x00, + 7, // 0x44 'D' + 0x00,0xf0,0xd8,0xcc,0xcc,0xcc,0xcc,0xd8,0xf0,0x00,0x00, - 7, // 0x45 'E' - 0x00,0xfc,0xc4,0xd0,0xf0,0xd0,0xc0,0xc4,0xfc,0x00,0x00, + 7, // 0x45 'E' + 0x00,0xfc,0xc4,0xd0,0xf0,0xd0,0xc0,0xc4,0xfc,0x00,0x00, - 7, // 0x46 'F' - 0x00,0xfc,0xc4,0xd0,0xf0,0xd0,0xc0,0xc0,0xc0,0x00,0x00, + 7, // 0x46 'F' + 0x00,0xfc,0xc4,0xd0,0xf0,0xd0,0xc0,0xc0,0xc0,0x00,0x00, - 7, // 0x47 'G' - 0x00,0x78,0xcc,0xc0,0xc0,0xdc,0xcc,0xcc,0x78,0x00,0x00, + 7, // 0x47 'G' + 0x00,0x78,0xcc,0xc0,0xc0,0xdc,0xcc,0xcc,0x78,0x00,0x00, - 7, // 0x48 'H' - 0x00,0xcc,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0xcc,0x00,0x00, + 7, // 0x48 'H' + 0x00,0xcc,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0xcc,0x00,0x00, - 7, // 0x49 'I' - 0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00, + 7, // 0x49 'I' + 0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00, - 7, // 0x4a 'J' - 0x00,0x3c,0x18,0x18,0x18,0x18,0xd8,0xd8,0x70,0x00,0x00, + 7, // 0x4a 'J' + 0x00,0x3c,0x18,0x18,0x18,0x18,0xd8,0xd8,0x70,0x00,0x00, - 7, // 0x4b 'K' - 0x00,0xcc,0xcc,0xd8,0xf0,0xd8,0xcc,0xcc,0xcc,0x00,0x00, + 7, // 0x4b 'K' + 0x00,0xcc,0xcc,0xd8,0xf0,0xd8,0xcc,0xcc,0xcc,0x00,0x00, - 7, // 0x4c 'L' - 0x00,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc4,0xfc,0x00,0x00, + 7, // 0x4c 'L' + 0x00,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc4,0xfc,0x00,0x00, - 7, // 0x4d 'M' - 0x00,0x84,0xcc,0xfc,0xb4,0xcc,0xcc,0xcc,0xcc,0x00,0x00, + 7, // 0x4d 'M' + 0x00,0x84,0xcc,0xfc,0xb4,0xcc,0xcc,0xcc,0xcc,0x00,0x00, - 7, // 0x4e 'N' - 0x00,0xcc,0xcc,0xec,0xfc,0xdc,0xcc,0xcc,0xcc,0x00,0x00, + 7, // 0x4e 'N' + 0x00,0xcc,0xcc,0xec,0xfc,0xdc,0xcc,0xcc,0xcc,0x00,0x00, - 7, // 0x4f 'O' - 0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00, + 7, // 0x4f 'O' + 0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00, - 7, // 0x50 'P' - 0x00,0xf8,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0xc0,0x00,0x00, + 7, // 0x50 'P' + 0x00,0xf8,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0xc0,0x00,0x00, - 7, // 0x51 'Q' - 0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xdc,0x78,0x18,0x0c,0x00, + 7, // 0x51 'Q' + 0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xdc,0x78,0x18,0x0c,0x00, - 7, // 0x52 'R' - 0x00,0xf8,0xcc,0xcc,0xcc,0xf8,0xd8,0xcc,0xcc,0x00,0x00, + 7, // 0x52 'R' + 0x00,0xf8,0xcc,0xcc,0xcc,0xf8,0xd8,0xcc,0xcc,0x00,0x00, - 7, // 0x53 'S' - 0x00,0x78,0xcc,0xe0,0x70,0x38,0x1c,0xcc,0x78,0x00,0x00, + 7, // 0x53 'S' + 0x00,0x78,0xcc,0xe0,0x70,0x38,0x1c,0xcc,0x78,0x00,0x00, - 7, // 0x54 'T' - 0x00,0xfc,0xb4,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00, + 7, // 0x54 'T' + 0x00,0xfc,0xb4,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00, - 7, // 0x55 'U' - 0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00, + 7, // 0x55 'U' + 0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00, - 7, // 0x56 'V' - 0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00,0x00, + 7, // 0x56 'V' + 0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00,0x00, - 7, // 0x57 'W' - 0x00,0xcc,0xcc,0xcc,0xcc,0xb4,0xfc,0xcc,0x84,0x00,0x00, + 7, // 0x57 'W' + 0x00,0xcc,0xcc,0xcc,0xcc,0xb4,0xfc,0xcc,0x84,0x00,0x00, - 7, // 0x58 'X' - 0x00,0xcc,0xcc,0x78,0x30,0x78,0xcc,0xcc,0xcc,0x00,0x00, + 7, // 0x58 'X' + 0x00,0xcc,0xcc,0x78,0x30,0x78,0xcc,0xcc,0xcc,0x00,0x00, - 7, // 0x59 'Y' - 0x00,0xcc,0xcc,0xcc,0x78,0x30,0x30,0x30,0x78,0x00,0x00, + 7, // 0x59 'Y' + 0x00,0xcc,0xcc,0xcc,0x78,0x30,0x30,0x30,0x78,0x00,0x00, - 7, // 0x5a 'Z' - 0x00,0xfc,0x8c,0x18,0x30,0x60,0xc0,0xc4,0xfc,0x00,0x00, + 7, // 0x5a 'Z' + 0x00,0xfc,0x8c,0x18,0x30,0x60,0xc0,0xc4,0xfc,0x00,0x00, - 7, // 0x5b '[' - 0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x78,0x00,0x00, + 7, // 0x5b '[' + 0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x78,0x00,0x00, - 7, // 0x5c '\' - 0x00,0x60,0x60,0x30,0x30,0x18,0x18,0x0c,0x0c,0x00,0x00, + 7, // 0x5c '\' + 0x00,0x60,0x60,0x30,0x30,0x18,0x18,0x0c,0x0c,0x00,0x00, - 7, // 0x5d ']' - 0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x00,0x00, + 7, // 0x5d ']' + 0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x00,0x00, - 7, // 0x5e '^' - 0x00,0x10,0x38,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x5e '^' + 0x00,0x10,0x38,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00, + 7, // 0x5f '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00, - 7, // 0x60 '`' - 0x00,0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x60 '`' + 0x00,0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x70,0x18,0x78,0xd8,0xd8,0x6c,0x00,0x00, + 7, // 0x61 'a' + 0x00,0x00,0x00,0x70,0x18,0x78,0xd8,0xd8,0x6c,0x00,0x00, - 7, // 0x62 'b' - 0x00,0x60,0x60,0x60,0x78,0x6c,0x6c,0x6c,0x78,0x00,0x00, + 7, // 0x62 'b' + 0x00,0x60,0x60,0x60,0x78,0x6c,0x6c,0x6c,0x78,0x00,0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x78,0xcc,0xc0,0xc0,0xcc,0x78,0x00,0x00, + 7, // 0x63 'c' + 0x00,0x00,0x00,0x78,0xcc,0xc0,0xc0,0xcc,0x78,0x00,0x00, - 7, // 0x64 'd' - 0x00,0x18,0x18,0x18,0x78,0xd8,0xd8,0xd8,0x6c,0x00,0x00, + 7, // 0x64 'd' + 0x00,0x18,0x18,0x18,0x78,0xd8,0xd8,0xd8,0x6c,0x00,0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x78,0xcc,0xfc,0xc0,0xcc,0x78,0x00,0x00, + 7, // 0x65 'e' + 0x00,0x00,0x00,0x78,0xcc,0xfc,0xc0,0xcc,0x78,0x00,0x00, - 7, // 0x66 'f' - 0x00,0x18,0x34,0x30,0x78,0x30,0x30,0x30,0x78,0x00,0x00, + 7, // 0x66 'f' + 0x00,0x18,0x34,0x30,0x78,0x30,0x30,0x30,0x78,0x00,0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x6c,0xd8,0xd8,0xd8,0x78,0x18,0xd8,0x70, + 7, // 0x67 'g' + 0x00,0x00,0x00,0x6c,0xd8,0xd8,0xd8,0x78,0x18,0xd8,0x70, - 7, // 0x68 'h' - 0x00,0xc0,0xc0,0xd8,0xec,0xcc,0xcc,0xcc,0xcc,0x00,0x00, + 7, // 0x68 'h' + 0x00,0xc0,0xc0,0xd8,0xec,0xcc,0xcc,0xcc,0xcc,0x00,0x00, - 7, // 0x69 'i' - 0x00,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x78,0x00,0x00, + 7, // 0x69 'i' + 0x00,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x78,0x00,0x00, - 7, // 0x6a 'j' - 0x00,0x0c,0x00,0x1c,0x0c,0x0c,0x0c,0x0c,0x6c,0x6c,0x38, + 7, // 0x6a 'j' + 0x00,0x0c,0x00,0x1c,0x0c,0x0c,0x0c,0x0c,0x6c,0x6c,0x38, - 7, // 0x6b 'k' - 0x00,0xc0,0xc0,0xcc,0xcc,0xd8,0xf0,0xd8,0xcc,0x00,0x00, + 7, // 0x6b 'k' + 0x00,0xc0,0xc0,0xcc,0xcc,0xd8,0xf0,0xd8,0xcc,0x00,0x00, - 7, // 0x6c 'l' - 0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00, + 7, // 0x6c 'l' + 0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00, - 7, // 0x6d 'm' - 0x00,0x00,0x00,0xe8,0xfc,0xd4,0xd4,0xc4,0xc4,0x00,0x00, + 7, // 0x6d 'm' + 0x00,0x00,0x00,0xe8,0xfc,0xd4,0xd4,0xc4,0xc4,0x00,0x00, - 7, // 0x6e 'n' - 0x00,0x00,0x00,0xd8,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00, + 7, // 0x6e 'n' + 0x00,0x00,0x00,0xd8,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00, - 7, // 0x6f 'o' - 0x00,0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00, + 7, // 0x6f 'o' + 0x00,0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0xc0, + 7, // 0x70 'p' + 0x00,0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0xc0, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x7c,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x0c, + 7, // 0x71 'q' + 0x00,0x00,0x00,0x7c,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x0c, - 7, // 0x72 'r' - 0x00,0x00,0x00,0xd8,0xec,0xcc,0xc0,0xc0,0xc0,0x00,0x00, + 7, // 0x72 'r' + 0x00,0x00,0x00,0xd8,0xec,0xcc,0xc0,0xc0,0xc0,0x00,0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x78,0xcc,0x60,0x18,0xcc,0x78,0x00,0x00, + 7, // 0x73 's' + 0x00,0x00,0x00,0x78,0xcc,0x60,0x18,0xcc,0x78,0x00,0x00, - 7, // 0x74 't' - 0x00,0x20,0x60,0x60,0xf0,0x60,0x60,0x68,0x30,0x00,0x00, + 7, // 0x74 't' + 0x00,0x20,0x60,0x60,0xf0,0x60,0x60,0x68,0x30,0x00,0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0xd8,0xd8,0xd8,0xd8,0xd8,0x6c,0x00,0x00, + 7, // 0x75 'u' + 0x00,0x00,0x00,0xd8,0xd8,0xd8,0xd8,0xd8,0x6c,0x00,0x00, - 7, // 0x76 'v' - 0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00,0x00, + 7, // 0x76 'v' + 0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00,0x00, - 7, // 0x77 'w' - 0x00,0x00,0x00,0xcc,0xcc,0xb4,0xfc,0xcc,0x84,0x00,0x00, + 7, // 0x77 'w' + 0x00,0x00,0x00,0xcc,0xcc,0xb4,0xfc,0xcc,0x84,0x00,0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0xcc,0x78,0x30,0x78,0xcc,0xcc,0x00,0x00, + 7, // 0x78 'x' + 0x00,0x00,0x00,0xcc,0x78,0x30,0x78,0xcc,0xcc,0x00,0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x18,0xf0, + 7, // 0x79 'y' + 0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x18,0xf0, - 7, // 0x7a 'z' - 0x00,0x00,0x00,0xfc,0x98,0x30,0x60,0xc4,0xfc,0x00,0x00, + 7, // 0x7a 'z' + 0x00,0x00,0x00,0xfc,0x98,0x30,0x60,0xc4,0xfc,0x00,0x00, - 7, // 0x7b '{' - 0x1c,0x30,0x30,0x30,0xe0,0x30,0x30,0x30,0x1c,0x00,0x00, + 7, // 0x7b '{' + 0x1c,0x30,0x30,0x30,0xe0,0x30,0x30,0x30,0x1c,0x00,0x00, - 7, // 0x7c '|' - 0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x30,0x30,0x00,0x00, + 7, // 0x7c '|' + 0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x30,0x30,0x00,0x00, - 7, // 0x7d '}' - 0xe0,0x30,0x30,0x30,0x1c,0x30,0x30,0x30,0xe0,0x00,0x00, + 7, // 0x7d '}' + 0xe0,0x30,0x30,0x30,0x1c,0x30,0x30,0x30,0xe0,0x00,0x00, - 7, // 0x7e '~' - 0x00,0x34,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7e '~' + 0x00,0x34,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x7f '' - 0x00,0x00,0x00,0x30,0x78,0xcc,0xcc,0xfc,0x00,0x00,0x00, - 0 - }; + 7, // 0x7f '' + 0x00,0x00,0x00,0x30,0x78,0xcc,0xcc,0xfc,0x00,0x00,0x00, + 0 +}; - const int8u gse7x15[] = - { - 15, 0, 32, 128-32, +const int8u gse7x15[] = +{ + 15, 0, 32, 128-32, - 0x00,0x00,0x10,0x00,0x20,0x00,0x30,0x00,0x40,0x00,0x50,0x00,0x60,0x00,0x70,0x00,0x80,0x00, - 0x90,0x00,0xa0,0x00,0xb0,0x00,0xc0,0x00,0xd0,0x00,0xe0,0x00,0xf0,0x00,0x00,0x01,0x10,0x01, - 0x20,0x01,0x30,0x01,0x40,0x01,0x50,0x01,0x60,0x01,0x70,0x01,0x80,0x01,0x90,0x01,0xa0,0x01, - 0xb0,0x01,0xc0,0x01,0xd0,0x01,0xe0,0x01,0xf0,0x01,0x00,0x02,0x10,0x02,0x20,0x02,0x30,0x02, - 0x40,0x02,0x50,0x02,0x60,0x02,0x70,0x02,0x80,0x02,0x90,0x02,0xa0,0x02,0xb0,0x02,0xc0,0x02, - 0xd0,0x02,0xe0,0x02,0xf0,0x02,0x00,0x03,0x10,0x03,0x20,0x03,0x30,0x03,0x40,0x03,0x50,0x03, - 0x60,0x03,0x70,0x03,0x80,0x03,0x90,0x03,0xa0,0x03,0xb0,0x03,0xc0,0x03,0xd0,0x03,0xe0,0x03, - 0xf0,0x03,0x00,0x04,0x10,0x04,0x20,0x04,0x30,0x04,0x40,0x04,0x50,0x04,0x60,0x04,0x70,0x04, - 0x80,0x04,0x90,0x04,0xa0,0x04,0xb0,0x04,0xc0,0x04,0xd0,0x04,0xe0,0x04,0xf0,0x04,0x00,0x05, - 0x10,0x05,0x20,0x05,0x30,0x05,0x40,0x05,0x50,0x05,0x60,0x05,0x70,0x05,0x80,0x05,0x90,0x05, - 0xa0,0x05,0xb0,0x05,0xc0,0x05,0xd0,0x05,0xe0,0x05,0xf0,0x05, + 0x00,0x00,0x10,0x00,0x20,0x00,0x30,0x00,0x40,0x00,0x50,0x00,0x60,0x00,0x70,0x00,0x80,0x00, + 0x90,0x00,0xa0,0x00,0xb0,0x00,0xc0,0x00,0xd0,0x00,0xe0,0x00,0xf0,0x00,0x00,0x01,0x10,0x01, + 0x20,0x01,0x30,0x01,0x40,0x01,0x50,0x01,0x60,0x01,0x70,0x01,0x80,0x01,0x90,0x01,0xa0,0x01, + 0xb0,0x01,0xc0,0x01,0xd0,0x01,0xe0,0x01,0xf0,0x01,0x00,0x02,0x10,0x02,0x20,0x02,0x30,0x02, + 0x40,0x02,0x50,0x02,0x60,0x02,0x70,0x02,0x80,0x02,0x90,0x02,0xa0,0x02,0xb0,0x02,0xc0,0x02, + 0xd0,0x02,0xe0,0x02,0xf0,0x02,0x00,0x03,0x10,0x03,0x20,0x03,0x30,0x03,0x40,0x03,0x50,0x03, + 0x60,0x03,0x70,0x03,0x80,0x03,0x90,0x03,0xa0,0x03,0xb0,0x03,0xc0,0x03,0xd0,0x03,0xe0,0x03, + 0xf0,0x03,0x00,0x04,0x10,0x04,0x20,0x04,0x30,0x04,0x40,0x04,0x50,0x04,0x60,0x04,0x70,0x04, + 0x80,0x04,0x90,0x04,0xa0,0x04,0xb0,0x04,0xc0,0x04,0xd0,0x04,0xe0,0x04,0xf0,0x04,0x00,0x05, + 0x10,0x05,0x20,0x05,0x30,0x05,0x40,0x05,0x50,0x05,0x60,0x05,0x70,0x05,0x80,0x05,0x90,0x05, + 0xa0,0x05,0xb0,0x05,0xc0,0x05,0xd0,0x05,0xe0,0x05,0xf0,0x05, - 7, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x21 '!' - 0x00,0x00,0x10,0x38,0x38,0x38,0x38,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00, + 7, // 0x21 '!' + 0x00,0x00,0x10,0x38,0x38,0x38,0x38,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00, - 7, // 0x22 '"' - 0x00,0x00,0x24,0x24,0x24,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x00,0x00,0x24,0x24,0x24,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x23 '#' - 0x00,0x00,0x48,0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48,0x48,0x00,0x00,0x00, + 7, // 0x23 '#' + 0x00,0x00,0x48,0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48,0x48,0x00,0x00,0x00, - 7, // 0x24 '$' - 0x00,0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x54,0x38,0x10,0x00,0x00,0x00, + 7, // 0x24 '$' + 0x00,0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x54,0x38,0x10,0x00,0x00,0x00, - 7, // 0x25 '%' - 0x00,0x00,0x44,0x44,0x08,0x08,0x10,0x10,0x20,0x20,0x44,0x44,0x00,0x00,0x00, + 7, // 0x25 '%' + 0x00,0x00,0x44,0x44,0x08,0x08,0x10,0x10,0x20,0x20,0x44,0x44,0x00,0x00,0x00, - 7, // 0x26 '&' - 0x00,0x00,0x00,0x30,0x48,0x48,0x30,0x60,0x94,0x98,0x90,0x6c,0x00,0x00,0x00, + 7, // 0x26 '&' + 0x00,0x00,0x00,0x30,0x48,0x48,0x30,0x60,0x94,0x98,0x90,0x6c,0x00,0x00,0x00, - 7, // 0x27 ''' - 0x00,0x00,0x20,0x20,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x27 ''' + 0x00,0x00,0x20,0x20,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x28 '(' - 0x00,0x04,0x08,0x10,0x20,0x20,0x20,0x20,0x20,0x10,0x08,0x04,0x00,0x00,0x00, + 7, // 0x28 '(' + 0x00,0x04,0x08,0x10,0x20,0x20,0x20,0x20,0x20,0x10,0x08,0x04,0x00,0x00,0x00, - 7, // 0x29 ')' - 0x00,0x40,0x20,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x20,0x40,0x00,0x00,0x00, + 7, // 0x29 ')' + 0x00,0x40,0x20,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x20,0x40,0x00,0x00,0x00, - 7, // 0x2a '*' - 0x00,0x00,0x00,0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2a '*' + 0x00,0x00,0x00,0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00,0x00,0x00,0x00, - 7, // 0x2b '+' - 0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x7c,0x10,0x10,0x10,0x00,0x00,0x00,0x00, + 7, // 0x2b '+' + 0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x7c,0x10,0x10,0x10,0x00,0x00,0x00,0x00, - 7, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x00, + 7, // 0x2c ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x00, - 7, // 0x2d '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2d '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, + 7, // 0x2e '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, - 7, // 0x2f '/' - 0x00,0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00,0x00, + 7, // 0x2f '/' + 0x00,0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00,0x00, - 7, // 0x30 '0' - 0x00,0x00,0x38,0x44,0x44,0x4c,0x54,0x64,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x30 '0' + 0x00,0x00,0x38,0x44,0x44,0x4c,0x54,0x64,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x31 '1' - 0x00,0x00,0x10,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x7c,0x00,0x00,0x00, + 7, // 0x31 '1' + 0x00,0x00,0x10,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x7c,0x00,0x00,0x00, - 7, // 0x32 '2' - 0x00,0x00,0x38,0x44,0x44,0x04,0x08,0x10,0x20,0x40,0x44,0x7c,0x00,0x00,0x00, + 7, // 0x32 '2' + 0x00,0x00,0x38,0x44,0x44,0x04,0x08,0x10,0x20,0x40,0x44,0x7c,0x00,0x00,0x00, - 7, // 0x33 '3' - 0x00,0x00,0x7c,0x44,0x08,0x10,0x38,0x04,0x04,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x33 '3' + 0x00,0x00,0x7c,0x44,0x08,0x10,0x38,0x04,0x04,0x04,0x44,0x38,0x00,0x00,0x00, - 7, // 0x34 '4' - 0x00,0x00,0x08,0x10,0x20,0x40,0x48,0x48,0x7c,0x08,0x08,0x1c,0x00,0x00,0x00, + 7, // 0x34 '4' + 0x00,0x00,0x08,0x10,0x20,0x40,0x48,0x48,0x7c,0x08,0x08,0x1c,0x00,0x00,0x00, - 7, // 0x35 '5' - 0x00,0x00,0x7c,0x40,0x40,0x40,0x78,0x04,0x04,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x35 '5' + 0x00,0x00,0x7c,0x40,0x40,0x40,0x78,0x04,0x04,0x04,0x44,0x38,0x00,0x00,0x00, - 7, // 0x36 '6' - 0x00,0x00,0x18,0x20,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x36 '6' + 0x00,0x00,0x18,0x20,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x37 '7' - 0x00,0x00,0x7c,0x44,0x04,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x00,0x00,0x00, + 7, // 0x37 '7' + 0x00,0x00,0x7c,0x44,0x04,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x00,0x00,0x00, - 7, // 0x38 '8' - 0x00,0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x38 '8' + 0x00,0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x39 '9' - 0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x3c,0x04,0x04,0x08,0x30,0x00,0x00,0x00, + 7, // 0x39 '9' + 0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x3c,0x04,0x04,0x08,0x30,0x00,0x00,0x00, - 7, // 0x3a ':' - 0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00, + 7, // 0x3a ':' + 0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00, - 7, // 0x3b ';' - 0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00, + 7, // 0x3b ';' + 0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00, - 7, // 0x3c '<' - 0x00,0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00,0x00, + 7, // 0x3c '<' + 0x00,0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00,0x00, - 7, // 0x3d '=' - 0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x3d '=' + 0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x3e '>' - 0x00,0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00,0x00, + 7, // 0x3e '>' + 0x00,0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00,0x00, - 7, // 0x3f '?' - 0x00,0x00,0x78,0x84,0x84,0x84,0x08,0x10,0x20,0x20,0x00,0x20,0x00,0x00,0x00, + 7, // 0x3f '?' + 0x00,0x00,0x78,0x84,0x84,0x84,0x08,0x10,0x20,0x20,0x00,0x20,0x00,0x00,0x00, - 7, // 0x40 '@' - 0x00,0x00,0x00,0x30,0x48,0x04,0x34,0x54,0x54,0x54,0x54,0x28,0x00,0x00,0x00, + 7, // 0x40 '@' + 0x00,0x00,0x00,0x30,0x48,0x04,0x34,0x54,0x54,0x54,0x54,0x28,0x00,0x00,0x00, - 7, // 0x41 'A' - 0x00,0x00,0x10,0x28,0x44,0x44,0x44,0x7c,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x41 'A' + 0x00,0x00,0x10,0x28,0x44,0x44,0x44,0x7c,0x44,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x42 'B' - 0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00,0x00, + 7, // 0x42 'B' + 0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00,0x00, - 7, // 0x43 'C' - 0x00,0x00,0x38,0x44,0x44,0x40,0x40,0x40,0x40,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x43 'C' + 0x00,0x00,0x38,0x44,0x44,0x40,0x40,0x40,0x40,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x44 'D' - 0x00,0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00,0x00, + 7, // 0x44 'D' + 0x00,0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00,0x00, - 7, // 0x45 'E' - 0x00,0x00,0x7c,0x40,0x40,0x40,0x70,0x40,0x40,0x40,0x40,0x7c,0x00,0x00,0x00, + 7, // 0x45 'E' + 0x00,0x00,0x7c,0x40,0x40,0x40,0x70,0x40,0x40,0x40,0x40,0x7c,0x00,0x00,0x00, - 7, // 0x46 'F' - 0x00,0x00,0x7c,0x40,0x40,0x40,0x70,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 7, // 0x46 'F' + 0x00,0x00,0x7c,0x40,0x40,0x40,0x70,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 7, // 0x47 'G' - 0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x5c,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x47 'G' + 0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x5c,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x48 'H' - 0x00,0x00,0x44,0x44,0x44,0x44,0x7c,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x48 'H' + 0x00,0x00,0x44,0x44,0x44,0x44,0x7c,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x49 'I' - 0x00,0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 7, // 0x49 'I' + 0x00,0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, - 7, // 0x4a 'J' - 0x00,0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00,0x00, + 7, // 0x4a 'J' + 0x00,0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00,0x00, - 7, // 0x4b 'K' - 0x00,0x00,0x44,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x4b 'K' + 0x00,0x00,0x44,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x4c 'L' - 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7c,0x00,0x00,0x00, + 7, // 0x4c 'L' + 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7c,0x00,0x00,0x00, - 7, // 0x4d 'M' - 0x00,0x00,0x44,0x6c,0x54,0x54,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x4d 'M' + 0x00,0x00,0x44,0x6c,0x54,0x54,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x4e 'N' - 0x00,0x00,0x44,0x44,0x44,0x64,0x54,0x4c,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x4e 'N' + 0x00,0x00,0x44,0x44,0x44,0x64,0x54,0x4c,0x44,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x4f 'O' - 0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x4f 'O' + 0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x50 'P' - 0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 7, // 0x50 'P' + 0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 7, // 0x51 'Q' - 0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00,0x00, + 7, // 0x51 'Q' + 0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00,0x00, - 7, // 0x52 'R' - 0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x50,0x48,0x44,0x44,0x00,0x00,0x00, + 7, // 0x52 'R' + 0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x50,0x48,0x44,0x44,0x00,0x00,0x00, - 7, // 0x53 'S' - 0x00,0x00,0x38,0x44,0x44,0x40,0x38,0x04,0x04,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x53 'S' + 0x00,0x00,0x38,0x44,0x44,0x40,0x38,0x04,0x04,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x54 'T' - 0x00,0x00,0x7c,0x54,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, + 7, // 0x54 'T' + 0x00,0x00,0x7c,0x54,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, - 7, // 0x55 'U' - 0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x55 'U' + 0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x56 'V' - 0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00,0x00, + 7, // 0x56 'V' + 0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00,0x00, - 7, // 0x57 'W' - 0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x54,0x6c,0x44,0x00,0x00,0x00, + 7, // 0x57 'W' + 0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x54,0x6c,0x44,0x00,0x00,0x00, - 7, // 0x58 'X' - 0x00,0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x58 'X' + 0x00,0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x59 'Y' - 0x00,0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 7, // 0x59 'Y' + 0x00,0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, - 7, // 0x5a 'Z' - 0x00,0x00,0x7c,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x40,0x7c,0x00,0x00,0x00, + 7, // 0x5a 'Z' + 0x00,0x00,0x7c,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x40,0x7c,0x00,0x00,0x00, - 7, // 0x5b '[' - 0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00,0x00, + 7, // 0x5b '[' + 0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00,0x00, - 7, // 0x5c '\' - 0x00,0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00,0x00,0x00, + 7, // 0x5c '\' + 0x00,0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00,0x00,0x00, - 7, // 0x5d ']' - 0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00,0x00, + 7, // 0x5d ']' + 0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00,0x00, - 7, // 0x5e '^' - 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x5e '^' + 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00, + 7, // 0x5f '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00, - 7, // 0x60 '`' - 0x00,0x20,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x60 '`' + 0x00,0x20,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x38,0x44,0x04,0x3c,0x44,0x44,0x44,0x3a,0x00,0x00,0x00, + 7, // 0x61 'a' + 0x00,0x00,0x00,0x00,0x38,0x44,0x04,0x3c,0x44,0x44,0x44,0x3a,0x00,0x00,0x00, - 7, // 0x62 'b' - 0x00,0x00,0x40,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00,0x00, + 7, // 0x62 'b' + 0x00,0x00,0x40,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00,0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00,0x00, + 7, // 0x63 'c' + 0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00,0x00, - 7, // 0x64 'd' - 0x00,0x00,0x04,0x04,0x04,0x3c,0x44,0x44,0x44,0x44,0x44,0x3a,0x00,0x00,0x00, + 7, // 0x64 'd' + 0x00,0x00,0x04,0x04,0x04,0x3c,0x44,0x44,0x44,0x44,0x44,0x3a,0x00,0x00,0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x38,0x44,0x44,0x7c,0x40,0x40,0x44,0x38,0x00,0x00,0x00, + 7, // 0x65 'e' + 0x00,0x00,0x00,0x00,0x38,0x44,0x44,0x7c,0x40,0x40,0x44,0x38,0x00,0x00,0x00, - 7, // 0x66 'f' - 0x00,0x00,0x18,0x24,0x20,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, + 7, // 0x66 'f' + 0x00,0x00,0x18,0x24,0x20,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x3a,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x44,0x38,0x00, + 7, // 0x67 'g' + 0x00,0x00,0x00,0x00,0x3a,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x44,0x38,0x00, - 7, // 0x68 'h' - 0x00,0x00,0x40,0x40,0x40,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x68 'h' + 0x00,0x00,0x40,0x40,0x40,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x69 'i' - 0x00,0x00,0x10,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 7, // 0x69 'i' + 0x00,0x00,0x10,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, - 7, // 0x6a 'j' - 0x00,0x00,0x08,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00, + 7, // 0x6a 'j' + 0x00,0x00,0x08,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00, - 7, // 0x6b 'k' - 0x00,0x00,0x40,0x40,0x44,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00,0x00, + 7, // 0x6b 'k' + 0x00,0x00,0x40,0x40,0x44,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00,0x00, - 7, // 0x6c 'l' - 0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 7, // 0x6c 'l' + 0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, - 7, // 0x6d 'm' - 0x00,0x00,0x00,0x00,0xa8,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x00,0x00,0x00, + 7, // 0x6d 'm' + 0x00,0x00,0x00,0x00,0xa8,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x00,0x00,0x00, - 7, // 0x6e 'n' - 0x00,0x00,0x00,0x00,0xb8,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x6e 'n' + 0x00,0x00,0x00,0x00,0xb8,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x6f 'o' - 0x00,0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x6f 'o' + 0x00,0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00, + 7, // 0x70 'p' + 0x00,0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x3c,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x04,0x04,0x00, + 7, // 0x71 'q' + 0x00,0x00,0x00,0x00,0x3c,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x04,0x04,0x00, - 7, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x58,0x64,0x44,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 7, // 0x72 'r' + 0x00,0x00,0x00,0x00,0x58,0x64,0x44,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x73 's' + 0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x74 't' - 0x00,0x00,0x20,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x24,0x18,0x00,0x00,0x00, + 7, // 0x74 't' + 0x00,0x00,0x20,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x24,0x18,0x00,0x00,0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x3a,0x00,0x00,0x00, + 7, // 0x75 'u' + 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x3a,0x00,0x00,0x00, - 7, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00,0x00, + 7, // 0x76 'v' + 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00,0x00, - 7, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x54,0x54,0x6c,0x44,0x00,0x00,0x00, + 7, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x54,0x54,0x6c,0x44,0x00,0x00,0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x78 'x' + 0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x08,0x70,0x00, + 7, // 0x79 'y' + 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x08,0x70,0x00, - 7, // 0x7a 'z' - 0x00,0x00,0x00,0x00,0x7c,0x04,0x08,0x10,0x20,0x40,0x40,0x7c,0x00,0x00,0x00, + 7, // 0x7a 'z' + 0x00,0x00,0x00,0x00,0x7c,0x04,0x08,0x10,0x20,0x40,0x40,0x7c,0x00,0x00,0x00, - 7, // 0x7b '{' - 0x00,0x0c,0x10,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x0c,0x00,0x00, + 7, // 0x7b '{' + 0x00,0x0c,0x10,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x0c,0x00,0x00, - 7, // 0x7c '|' - 0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x00, + 7, // 0x7c '|' + 0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x00, - 7, // 0x7d '}' - 0x00,0x60,0x10,0x10,0x10,0x10,0x10,0x0c,0x10,0x10,0x10,0x10,0x60,0x00,0x00, + 7, // 0x7d '}' + 0x00,0x60,0x10,0x10,0x10,0x10,0x10,0x0c,0x10,0x10,0x10,0x10,0x60,0x00,0x00, - 7, // 0x7e '~' - 0x00,0x00,0x64,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7e '~' + 0x00,0x00,0x64,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x7f '' - 0x00,0x00,0x00,0x00,0x00,0x10,0x28,0x44,0x44,0x7c,0x00,0x00,0x00,0x00,0x00, - 0 - }; + 7, // 0x7f '' + 0x00,0x00,0x00,0x00,0x00,0x10,0x28,0x44,0x44,0x7c,0x00,0x00,0x00,0x00,0x00, + 0 +}; - const int8u gse7x15_bold[] = - { - 15, 0, 32, 128-32, +const int8u gse7x15_bold[] = +{ + 15, 0, 32, 128-32, - 0x00,0x00,0x10,0x00,0x20,0x00,0x30,0x00,0x40,0x00,0x50,0x00,0x60,0x00,0x70,0x00,0x80,0x00, - 0x90,0x00,0xa0,0x00,0xb0,0x00,0xc0,0x00,0xd0,0x00,0xe0,0x00,0xf0,0x00,0x00,0x01,0x10,0x01, - 0x20,0x01,0x30,0x01,0x40,0x01,0x50,0x01,0x60,0x01,0x70,0x01,0x80,0x01,0x90,0x01,0xa0,0x01, - 0xb0,0x01,0xc0,0x01,0xd0,0x01,0xe0,0x01,0xf0,0x01,0x00,0x02,0x10,0x02,0x20,0x02,0x30,0x02, - 0x40,0x02,0x50,0x02,0x60,0x02,0x70,0x02,0x80,0x02,0x90,0x02,0xa0,0x02,0xb0,0x02,0xc0,0x02, - 0xd0,0x02,0xe0,0x02,0xf0,0x02,0x00,0x03,0x10,0x03,0x20,0x03,0x30,0x03,0x40,0x03,0x50,0x03, - 0x60,0x03,0x70,0x03,0x80,0x03,0x90,0x03,0xa0,0x03,0xb0,0x03,0xc0,0x03,0xd0,0x03,0xe0,0x03, - 0xf0,0x03,0x00,0x04,0x10,0x04,0x20,0x04,0x30,0x04,0x40,0x04,0x50,0x04,0x60,0x04,0x70,0x04, - 0x80,0x04,0x90,0x04,0xa0,0x04,0xb0,0x04,0xc0,0x04,0xd0,0x04,0xe0,0x04,0xf0,0x04,0x00,0x05, - 0x10,0x05,0x20,0x05,0x30,0x05,0x40,0x05,0x50,0x05,0x60,0x05,0x70,0x05,0x80,0x05,0x90,0x05, - 0xa0,0x05,0xb0,0x05,0xc0,0x05,0xd0,0x05,0xe0,0x05,0xf0,0x05, + 0x00,0x00,0x10,0x00,0x20,0x00,0x30,0x00,0x40,0x00,0x50,0x00,0x60,0x00,0x70,0x00,0x80,0x00, + 0x90,0x00,0xa0,0x00,0xb0,0x00,0xc0,0x00,0xd0,0x00,0xe0,0x00,0xf0,0x00,0x00,0x01,0x10,0x01, + 0x20,0x01,0x30,0x01,0x40,0x01,0x50,0x01,0x60,0x01,0x70,0x01,0x80,0x01,0x90,0x01,0xa0,0x01, + 0xb0,0x01,0xc0,0x01,0xd0,0x01,0xe0,0x01,0xf0,0x01,0x00,0x02,0x10,0x02,0x20,0x02,0x30,0x02, + 0x40,0x02,0x50,0x02,0x60,0x02,0x70,0x02,0x80,0x02,0x90,0x02,0xa0,0x02,0xb0,0x02,0xc0,0x02, + 0xd0,0x02,0xe0,0x02,0xf0,0x02,0x00,0x03,0x10,0x03,0x20,0x03,0x30,0x03,0x40,0x03,0x50,0x03, + 0x60,0x03,0x70,0x03,0x80,0x03,0x90,0x03,0xa0,0x03,0xb0,0x03,0xc0,0x03,0xd0,0x03,0xe0,0x03, + 0xf0,0x03,0x00,0x04,0x10,0x04,0x20,0x04,0x30,0x04,0x40,0x04,0x50,0x04,0x60,0x04,0x70,0x04, + 0x80,0x04,0x90,0x04,0xa0,0x04,0xb0,0x04,0xc0,0x04,0xd0,0x04,0xe0,0x04,0xf0,0x04,0x00,0x05, + 0x10,0x05,0x20,0x05,0x30,0x05,0x40,0x05,0x50,0x05,0x60,0x05,0x70,0x05,0x80,0x05,0x90,0x05, + 0xa0,0x05,0xb0,0x05,0xc0,0x05,0xd0,0x05,0xe0,0x05,0xf0,0x05, - 7, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x21 '!' - 0x00,0x00,0x00,0x30,0x78,0x78,0x78,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, + 7, // 0x21 '!' + 0x00,0x00,0x00,0x30,0x78,0x78,0x78,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, - 7, // 0x22 '"' - 0x00,0x00,0x6c,0x6c,0x6c,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x00,0x00,0x6c,0x6c,0x6c,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x23 '#' - 0x00,0x00,0x48,0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48,0x48,0x00,0x00,0x00, + 7, // 0x23 '#' + 0x00,0x00,0x48,0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48,0x48,0x00,0x00,0x00, - 7, // 0x24 '$' - 0x00,0x30,0x30,0x78,0xcc,0xe0,0x70,0x38,0x1c,0xcc,0x78,0x30,0x30,0x00,0x00, + 7, // 0x24 '$' + 0x00,0x30,0x30,0x78,0xcc,0xe0,0x70,0x38,0x1c,0xcc,0x78,0x30,0x30,0x00,0x00, - 7, // 0x25 '%' - 0x00,0x00,0x00,0x64,0x6c,0x08,0x18,0x10,0x30,0x20,0x6c,0x4c,0x00,0x00,0x00, + 7, // 0x25 '%' + 0x00,0x00,0x00,0x64,0x6c,0x08,0x18,0x10,0x30,0x20,0x6c,0x4c,0x00,0x00,0x00, - 7, // 0x26 '&' - 0x00,0x00,0x00,0x30,0x58,0x58,0x30,0x74,0xdc,0xd8,0xd8,0x6c,0x00,0x00,0x00, + 7, // 0x26 '&' + 0x00,0x00,0x00,0x30,0x58,0x58,0x30,0x74,0xdc,0xd8,0xd8,0x6c,0x00,0x00,0x00, - 7, // 0x27 ''' - 0x00,0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x27 ''' + 0x00,0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x28 '(' - 0x00,0x0c,0x18,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x18,0x0c,0x00,0x00,0x00, + 7, // 0x28 '(' + 0x00,0x0c,0x18,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x18,0x0c,0x00,0x00,0x00, - 7, // 0x29 ')' - 0x00,0xc0,0x60,0x30,0x18,0x18,0x18,0x18,0x18,0x30,0x60,0xc0,0x00,0x00,0x00, + 7, // 0x29 ')' + 0x00,0xc0,0x60,0x30,0x18,0x18,0x18,0x18,0x18,0x30,0x60,0xc0,0x00,0x00,0x00, - 7, // 0x2a '*' - 0x00,0x00,0x00,0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2a '*' + 0x00,0x00,0x00,0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00,0x00,0x00,0x00, - 7, // 0x2b '+' - 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0xfc,0x30,0x30,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2b '+' + 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0xfc,0x30,0x30,0x00,0x00,0x00,0x00,0x00, - 7, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x00, + 7, // 0x2c ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x00, - 7, // 0x2d '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2d '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, + 7, // 0x2e '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, - 7, // 0x2f '/' - 0x00,0x00,0x0c,0x0c,0x18,0x18,0x30,0x30,0x60,0x60,0xc0,0xc0,0x00,0x00,0x00, + 7, // 0x2f '/' + 0x00,0x00,0x0c,0x0c,0x18,0x18,0x30,0x30,0x60,0x60,0xc0,0xc0,0x00,0x00,0x00, - 7, // 0x30 '0' - 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xdc,0xec,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x30 '0' + 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xdc,0xec,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, - 7, // 0x31 '1' - 0x00,0x00,0x30,0x30,0x70,0xf0,0x30,0x30,0x30,0x30,0x30,0xfc,0x00,0x00,0x00, + 7, // 0x31 '1' + 0x00,0x00,0x30,0x30,0x70,0xf0,0x30,0x30,0x30,0x30,0x30,0xfc,0x00,0x00,0x00, - 7, // 0x32 '2' - 0x00,0x00,0x78,0xcc,0xcc,0x0c,0x18,0x30,0x60,0xc0,0xcc,0xfc,0x00,0x00,0x00, + 7, // 0x32 '2' + 0x00,0x00,0x78,0xcc,0xcc,0x0c,0x18,0x30,0x60,0xc0,0xcc,0xfc,0x00,0x00,0x00, - 7, // 0x33 '3' - 0x00,0x00,0xfc,0x8c,0x18,0x30,0x78,0x0c,0x0c,0x0c,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x33 '3' + 0x00,0x00,0xfc,0x8c,0x18,0x30,0x78,0x0c,0x0c,0x0c,0xcc,0x78,0x00,0x00,0x00, - 7, // 0x34 '4' - 0x00,0x00,0x18,0x30,0x60,0xc8,0xd8,0xd8,0xfc,0x18,0x18,0x3c,0x00,0x00,0x00, + 7, // 0x34 '4' + 0x00,0x00,0x18,0x30,0x60,0xc8,0xd8,0xd8,0xfc,0x18,0x18,0x3c,0x00,0x00,0x00, - 7, // 0x35 '5' - 0x00,0x00,0xfc,0xc0,0xc0,0xc0,0xf8,0x0c,0x0c,0x0c,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x35 '5' + 0x00,0x00,0xfc,0xc0,0xc0,0xc0,0xf8,0x0c,0x0c,0x0c,0xcc,0x78,0x00,0x00,0x00, - 7, // 0x36 '6' - 0x00,0x00,0x38,0x60,0xc0,0xc0,0xf8,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x36 '6' + 0x00,0x00,0x38,0x60,0xc0,0xc0,0xf8,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, - 7, // 0x37 '7' - 0x00,0x00,0xfc,0x8c,0x0c,0x0c,0x18,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00, + 7, // 0x37 '7' + 0x00,0x00,0xfc,0x8c,0x0c,0x0c,0x18,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00, - 7, // 0x38 '8' - 0x00,0x00,0x78,0xcc,0xcc,0xcc,0x78,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x38 '8' + 0x00,0x00,0x78,0xcc,0xcc,0xcc,0x78,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, - 7, // 0x39 '9' - 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x18,0x70,0x00,0x00,0x00, + 7, // 0x39 '9' + 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x18,0x70,0x00,0x00,0x00, - 7, // 0x3a ':' - 0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00, + 7, // 0x3a ':' + 0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00, - 7, // 0x3b ';' - 0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x00, + 7, // 0x3b ';' + 0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x00, - 7, // 0x3c '<' - 0x00,0x00,0x00,0x0c,0x18,0x30,0x60,0xc0,0x60,0x30,0x18,0x0c,0x00,0x00,0x00, + 7, // 0x3c '<' + 0x00,0x00,0x00,0x0c,0x18,0x30,0x60,0xc0,0x60,0x30,0x18,0x0c,0x00,0x00,0x00, - 7, // 0x3d '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x3d '=' + 0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x3e '>' - 0x00,0x00,0x00,0xc0,0x60,0x30,0x18,0x0c,0x18,0x30,0x60,0xc0,0x00,0x00,0x00, + 7, // 0x3e '>' + 0x00,0x00,0x00,0xc0,0x60,0x30,0x18,0x0c,0x18,0x30,0x60,0xc0,0x00,0x00,0x00, - 7, // 0x3f '?' - 0x00,0x00,0x78,0xcc,0xcc,0x18,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, + 7, // 0x3f '?' + 0x00,0x00,0x78,0xcc,0xcc,0x18,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, - 7, // 0x40 '@' - 0x00,0x00,0x00,0x70,0x88,0x04,0x74,0xb4,0xb4,0xb4,0xb4,0x68,0x00,0x00,0x00, + 7, // 0x40 '@' + 0x00,0x00,0x00,0x70,0x88,0x04,0x74,0xb4,0xb4,0xb4,0xb4,0x68,0x00,0x00,0x00, - 7, // 0x41 'A' - 0x00,0x00,0x30,0x78,0xcc,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x41 'A' + 0x00,0x00,0x30,0x78,0xcc,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, - 7, // 0x42 'B' - 0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xf8,0xcc,0xcc,0xcc,0xcc,0xf8,0x00,0x00,0x00, + 7, // 0x42 'B' + 0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xf8,0xcc,0xcc,0xcc,0xcc,0xf8,0x00,0x00,0x00, - 7, // 0x43 'C' - 0x00,0x00,0x78,0xcc,0xc4,0xc0,0xc0,0xc0,0xc0,0xc4,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x43 'C' + 0x00,0x00,0x78,0xcc,0xc4,0xc0,0xc0,0xc0,0xc0,0xc4,0xcc,0x78,0x00,0x00,0x00, - 7, // 0x44 'D' - 0x00,0x00,0xf0,0xd8,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xd8,0xf0,0x00,0x00,0x00, + 7, // 0x44 'D' + 0x00,0x00,0xf0,0xd8,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xd8,0xf0,0x00,0x00,0x00, - 7, // 0x45 'E' - 0x00,0x00,0xfc,0xc4,0xc0,0xd0,0xf0,0xd0,0xc0,0xc0,0xc4,0xfc,0x00,0x00,0x00, + 7, // 0x45 'E' + 0x00,0x00,0xfc,0xc4,0xc0,0xd0,0xf0,0xd0,0xc0,0xc0,0xc4,0xfc,0x00,0x00,0x00, - 7, // 0x46 'F' - 0x00,0x00,0xfc,0xc4,0xc0,0xd0,0xf0,0xd0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00, + 7, // 0x46 'F' + 0x00,0x00,0xfc,0xc4,0xc0,0xd0,0xf0,0xd0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00, - 7, // 0x47 'G' - 0x00,0x00,0x78,0xcc,0xc0,0xc0,0xc0,0xdc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x47 'G' + 0x00,0x00,0x78,0xcc,0xc0,0xc0,0xc0,0xdc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, - 7, // 0x48 'H' - 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x48 'H' + 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, - 7, // 0x49 'I' - 0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, + 7, // 0x49 'I' + 0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, - 7, // 0x4a 'J' - 0x00,0x00,0x3c,0x18,0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0x70,0x00,0x00,0x00, + 7, // 0x4a 'J' + 0x00,0x00,0x3c,0x18,0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0x70,0x00,0x00,0x00, - 7, // 0x4b 'K' - 0x00,0x00,0xcc,0xcc,0xd8,0xd8,0xf0,0xd8,0xd8,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x4b 'K' + 0x00,0x00,0xcc,0xcc,0xd8,0xd8,0xf0,0xd8,0xd8,0xcc,0xcc,0xcc,0x00,0x00,0x00, - 7, // 0x4c 'L' - 0x00,0x00,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc4,0xfc,0x00,0x00,0x00, + 7, // 0x4c 'L' + 0x00,0x00,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc4,0xfc,0x00,0x00,0x00, - 7, // 0x4d 'M' - 0x00,0x00,0x84,0xcc,0xfc,0xb4,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x4d 'M' + 0x00,0x00,0x84,0xcc,0xfc,0xb4,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, - 7, // 0x4e 'N' - 0x00,0x00,0xcc,0xcc,0xcc,0xec,0xfc,0xdc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x4e 'N' + 0x00,0x00,0xcc,0xcc,0xcc,0xec,0xfc,0xdc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, - 7, // 0x4f 'O' - 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x4f 'O' + 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, - 7, // 0x50 'P' - 0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00, + 7, // 0x50 'P' + 0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00, - 7, // 0x51 'Q' - 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xdc,0x78,0x18,0x0c,0x00,0x00, + 7, // 0x51 'Q' + 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xdc,0x78,0x18,0x0c,0x00,0x00, - 7, // 0x52 'R' - 0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xcc,0xf8,0xd8,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x52 'R' + 0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xcc,0xf8,0xd8,0xcc,0xcc,0xcc,0x00,0x00,0x00, - 7, // 0x53 'S' - 0x00,0x00,0x78,0xcc,0xcc,0xe0,0x70,0x38,0x1c,0xcc,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x53 'S' + 0x00,0x00,0x78,0xcc,0xcc,0xe0,0x70,0x38,0x1c,0xcc,0xcc,0x78,0x00,0x00,0x00, - 7, // 0x54 'T' - 0x00,0x00,0xfc,0xb4,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00, + 7, // 0x54 'T' + 0x00,0x00,0xfc,0xb4,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00, - 7, // 0x55 'U' - 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x55 'U' + 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, - 7, // 0x56 'V' - 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00,0x00,0x00, + 7, // 0x56 'V' + 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00,0x00,0x00, - 7, // 0x57 'W' - 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xb4,0xfc,0xcc,0x84,0x00,0x00,0x00, + 7, // 0x57 'W' + 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xb4,0xfc,0xcc,0x84,0x00,0x00,0x00, - 7, // 0x58 'X' - 0x00,0x00,0xcc,0xcc,0xcc,0x78,0x30,0x78,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x58 'X' + 0x00,0x00,0xcc,0xcc,0xcc,0x78,0x30,0x78,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, - 7, // 0x59 'Y' - 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, + 7, // 0x59 'Y' + 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, - 7, // 0x5a 'Z' - 0x00,0x00,0xfc,0x8c,0x0c,0x18,0x30,0x60,0xc0,0xc0,0xc4,0xfc,0x00,0x00,0x00, + 7, // 0x5a 'Z' + 0x00,0x00,0xfc,0x8c,0x0c,0x18,0x30,0x60,0xc0,0xc0,0xc4,0xfc,0x00,0x00,0x00, - 7, // 0x5b '[' - 0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x78,0x00,0x00, + 7, // 0x5b '[' + 0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x78,0x00,0x00, - 7, // 0x5c '\' - 0x00,0x00,0xc0,0xc0,0x60,0x60,0x30,0x30,0x18,0x18,0x0c,0x0c,0x00,0x00,0x00, + 7, // 0x5c '\' + 0x00,0x00,0xc0,0xc0,0x60,0x60,0x30,0x30,0x18,0x18,0x0c,0x0c,0x00,0x00,0x00, - 7, // 0x5d ']' - 0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x00,0x00, + 7, // 0x5d ']' + 0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x00,0x00, - 7, // 0x5e '^' - 0x00,0x10,0x38,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x5e '^' + 0x00,0x10,0x38,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00, + 7, // 0x5f '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00, - 7, // 0x60 '`' - 0x00,0x30,0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x60 '`' + 0x00,0x30,0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x70,0xd8,0x18,0x78,0xd8,0xd8,0xd8,0x6c,0x00,0x00,0x00, + 7, // 0x61 'a' + 0x00,0x00,0x00,0x00,0x70,0xd8,0x18,0x78,0xd8,0xd8,0xd8,0x6c,0x00,0x00,0x00, - 7, // 0x62 'b' - 0x00,0x00,0x60,0x60,0x60,0x78,0x6c,0x6c,0x6c,0x6c,0x6c,0x78,0x00,0x00,0x00, + 7, // 0x62 'b' + 0x00,0x00,0x60,0x60,0x60,0x78,0x6c,0x6c,0x6c,0x6c,0x6c,0x78,0x00,0x00,0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x78,0xcc,0xc0,0xc0,0xc0,0xc0,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x63 'c' + 0x00,0x00,0x00,0x00,0x78,0xcc,0xc0,0xc0,0xc0,0xc0,0xcc,0x78,0x00,0x00,0x00, - 7, // 0x64 'd' - 0x00,0x00,0x18,0x18,0x18,0x78,0xd8,0xd8,0xd8,0xd8,0xd8,0x6c,0x00,0x00,0x00, + 7, // 0x64 'd' + 0x00,0x00,0x18,0x18,0x18,0x78,0xd8,0xd8,0xd8,0xd8,0xd8,0x6c,0x00,0x00,0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x78,0xcc,0xcc,0xfc,0xc0,0xc0,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x65 'e' + 0x00,0x00,0x00,0x00,0x78,0xcc,0xcc,0xfc,0xc0,0xc0,0xcc,0x78,0x00,0x00,0x00, - 7, // 0x66 'f' - 0x00,0x00,0x30,0x68,0x60,0x60,0xf0,0x60,0x60,0x60,0x60,0xf0,0x00,0x00,0x00, + 7, // 0x66 'f' + 0x00,0x00,0x30,0x68,0x60,0x60,0xf0,0x60,0x60,0x60,0x60,0xf0,0x00,0x00,0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x6c,0xd8,0xd8,0xd8,0xd8,0xd8,0x78,0x18,0xd8,0x70,0x00, + 7, // 0x67 'g' + 0x00,0x00,0x00,0x00,0x6c,0xd8,0xd8,0xd8,0xd8,0xd8,0x78,0x18,0xd8,0x70,0x00, - 7, // 0x68 'h' - 0x00,0x00,0xc0,0xc0,0xc0,0xd8,0xec,0xcc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x68 'h' + 0x00,0x00,0xc0,0xc0,0xc0,0xd8,0xec,0xcc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, - 7, // 0x69 'i' - 0x00,0x00,0x30,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, + 7, // 0x69 'i' + 0x00,0x00,0x30,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, - 7, // 0x6a 'j' - 0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0x70,0x00, + 7, // 0x6a 'j' + 0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0x70,0x00, - 7, // 0x6b 'k' - 0x00,0x00,0xc0,0xc0,0xcc,0xcc,0xcc,0xd8,0xf0,0xd8,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x6b 'k' + 0x00,0x00,0xc0,0xc0,0xcc,0xcc,0xcc,0xd8,0xf0,0xd8,0xcc,0xcc,0x00,0x00,0x00, - 7, // 0x6c 'l' - 0x00,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, + 7, // 0x6c 'l' + 0x00,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, - 7, // 0x6d 'm' - 0x00,0x00,0x00,0x00,0xe8,0xfc,0xd4,0xd4,0xd4,0xc4,0xc4,0xc4,0x00,0x00,0x00, + 7, // 0x6d 'm' + 0x00,0x00,0x00,0x00,0xe8,0xfc,0xd4,0xd4,0xd4,0xc4,0xc4,0xc4,0x00,0x00,0x00, - 7, // 0x6e 'n' - 0x00,0x00,0x00,0x00,0xd8,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00, + 7, // 0x6e 'n' + 0x00,0x00,0x00,0x00,0xd8,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00, - 7, // 0x6f 'o' - 0x00,0x00,0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x6f 'o' + 0x00,0x00,0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0xc0,0x00, + 7, // 0x70 'p' + 0x00,0x00,0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0xc0,0x00, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x7c,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x0c,0x00, + 7, // 0x71 'q' + 0x00,0x00,0x00,0x00,0x7c,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x0c,0x00, - 7, // 0x72 'r' - 0x00,0x00,0x00,0x00,0xd8,0xec,0xcc,0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00, + 7, // 0x72 'r' + 0x00,0x00,0x00,0x00,0xd8,0xec,0xcc,0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x00,0x78,0xcc,0xe0,0x70,0x38,0x1c,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x73 's' + 0x00,0x00,0x00,0x00,0x78,0xcc,0xe0,0x70,0x38,0x1c,0xcc,0x78,0x00,0x00,0x00, - 7, // 0x74 't' - 0x00,0x00,0x20,0x60,0x60,0xf0,0x60,0x60,0x60,0x60,0x6c,0x38,0x00,0x00,0x00, + 7, // 0x74 't' + 0x00,0x00,0x20,0x60,0x60,0xf0,0x60,0x60,0x60,0x60,0x6c,0x38,0x00,0x00,0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0x00,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0x6c,0x00,0x00,0x00, + 7, // 0x75 'u' + 0x00,0x00,0x00,0x00,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0x6c,0x00,0x00,0x00, - 7, // 0x76 'v' - 0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00,0x00,0x00, + 7, // 0x76 'v' + 0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00,0x00,0x00, - 7, // 0x77 'w' - 0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xb4,0xfc,0xcc,0x84,0x00,0x00,0x00, + 7, // 0x77 'w' + 0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xb4,0xfc,0xcc,0x84,0x00,0x00,0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x00,0xcc,0xcc,0x78,0x30,0x78,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x78 'x' + 0x00,0x00,0x00,0x00,0xcc,0xcc,0x78,0x30,0x78,0xcc,0xcc,0xcc,0x00,0x00,0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x18,0xf0,0x00, + 7, // 0x79 'y' + 0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x18,0xf0,0x00, - 7, // 0x7a 'z' - 0x00,0x00,0x00,0x00,0xfc,0x8c,0x18,0x30,0x60,0xc0,0xc4,0xfc,0x00,0x00,0x00, + 7, // 0x7a 'z' + 0x00,0x00,0x00,0x00,0xfc,0x8c,0x18,0x30,0x60,0xc0,0xc4,0xfc,0x00,0x00,0x00, - 7, // 0x7b '{' - 0x00,0x1c,0x30,0x30,0x30,0x30,0x30,0xe0,0x30,0x30,0x30,0x30,0x1c,0x00,0x00, + 7, // 0x7b '{' + 0x00,0x1c,0x30,0x30,0x30,0x30,0x30,0xe0,0x30,0x30,0x30,0x30,0x1c,0x00,0x00, - 7, // 0x7c '|' - 0x00,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x00,0x00, + 7, // 0x7c '|' + 0x00,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x00,0x00, - 7, // 0x7d '}' - 0x00,0xe0,0x30,0x30,0x30,0x30,0x30,0x1c,0x30,0x30,0x30,0x30,0xe0,0x00,0x00, + 7, // 0x7d '}' + 0x00,0xe0,0x30,0x30,0x30,0x30,0x30,0x1c,0x30,0x30,0x30,0x30,0xe0,0x00,0x00, - 7, // 0x7e '~' - 0x00,0x00,0x34,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7e '~' + 0x00,0x00,0x34,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x7f '' - 0x00,0x00,0x00,0x00,0x00,0x30,0x78,0xcc,0xcc,0xfc,0x00,0x00,0x00,0x00,0x00, - 0 - }; + 7, // 0x7f '' + 0x00,0x00,0x00,0x00,0x00,0x30,0x78,0xcc,0xcc,0xfc,0x00,0x00,0x00,0x00,0x00, + 0 +}; - const int8u gse8x16[] = - { - 16, 0, 32, 128-32, +const int8u gse8x16[] = +{ + 16, 0, 32, 128-32, - 0x00,0x00,0x11,0x00,0x22,0x00,0x33,0x00,0x44,0x00,0x55,0x00,0x66,0x00,0x77,0x00,0x88,0x00, - 0x99,0x00,0xaa,0x00,0xbb,0x00,0xcc,0x00,0xdd,0x00,0xee,0x00,0xff,0x00,0x10,0x01,0x21,0x01, - 0x32,0x01,0x43,0x01,0x54,0x01,0x65,0x01,0x76,0x01,0x87,0x01,0x98,0x01,0xa9,0x01,0xba,0x01, - 0xcb,0x01,0xdc,0x01,0xed,0x01,0xfe,0x01,0x0f,0x02,0x20,0x02,0x31,0x02,0x42,0x02,0x53,0x02, - 0x64,0x02,0x75,0x02,0x86,0x02,0x97,0x02,0xa8,0x02,0xb9,0x02,0xca,0x02,0xdb,0x02,0xec,0x02, - 0xfd,0x02,0x0e,0x03,0x1f,0x03,0x30,0x03,0x41,0x03,0x52,0x03,0x63,0x03,0x74,0x03,0x85,0x03, - 0x96,0x03,0xa7,0x03,0xb8,0x03,0xc9,0x03,0xda,0x03,0xeb,0x03,0xfc,0x03,0x0d,0x04,0x1e,0x04, - 0x2f,0x04,0x40,0x04,0x51,0x04,0x62,0x04,0x73,0x04,0x84,0x04,0x95,0x04,0xa6,0x04,0xb7,0x04, - 0xc8,0x04,0xd9,0x04,0xea,0x04,0xfb,0x04,0x0c,0x05,0x1d,0x05,0x2e,0x05,0x3f,0x05,0x50,0x05, - 0x61,0x05,0x72,0x05,0x83,0x05,0x94,0x05,0xa5,0x05,0xb6,0x05,0xc7,0x05,0xd8,0x05,0xe9,0x05, - 0xfa,0x05,0x0b,0x06,0x1c,0x06,0x2d,0x06,0x3e,0x06,0x4f,0x06, + 0x00,0x00,0x11,0x00,0x22,0x00,0x33,0x00,0x44,0x00,0x55,0x00,0x66,0x00,0x77,0x00,0x88,0x00, + 0x99,0x00,0xaa,0x00,0xbb,0x00,0xcc,0x00,0xdd,0x00,0xee,0x00,0xff,0x00,0x10,0x01,0x21,0x01, + 0x32,0x01,0x43,0x01,0x54,0x01,0x65,0x01,0x76,0x01,0x87,0x01,0x98,0x01,0xa9,0x01,0xba,0x01, + 0xcb,0x01,0xdc,0x01,0xed,0x01,0xfe,0x01,0x0f,0x02,0x20,0x02,0x31,0x02,0x42,0x02,0x53,0x02, + 0x64,0x02,0x75,0x02,0x86,0x02,0x97,0x02,0xa8,0x02,0xb9,0x02,0xca,0x02,0xdb,0x02,0xec,0x02, + 0xfd,0x02,0x0e,0x03,0x1f,0x03,0x30,0x03,0x41,0x03,0x52,0x03,0x63,0x03,0x74,0x03,0x85,0x03, + 0x96,0x03,0xa7,0x03,0xb8,0x03,0xc9,0x03,0xda,0x03,0xeb,0x03,0xfc,0x03,0x0d,0x04,0x1e,0x04, + 0x2f,0x04,0x40,0x04,0x51,0x04,0x62,0x04,0x73,0x04,0x84,0x04,0x95,0x04,0xa6,0x04,0xb7,0x04, + 0xc8,0x04,0xd9,0x04,0xea,0x04,0xfb,0x04,0x0c,0x05,0x1d,0x05,0x2e,0x05,0x3f,0x05,0x50,0x05, + 0x61,0x05,0x72,0x05,0x83,0x05,0x94,0x05,0xa5,0x05,0xb6,0x05,0xc7,0x05,0xd8,0x05,0xe9,0x05, + 0xfa,0x05,0x0b,0x06,0x1c,0x06,0x2d,0x06,0x3e,0x06,0x4f,0x06, - 8, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x21 '!' - 0x00,0x00,0x10,0x38,0x38,0x38,0x38,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00,0x00, + 8, // 0x21 '!' + 0x00,0x00,0x10,0x38,0x38,0x38,0x38,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00,0x00, - 8, // 0x22 '"' - 0x00,0x24,0x24,0x24,0x24,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x22 '"' + 0x00,0x24,0x24,0x24,0x24,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x23 '#' - 0x00,0x00,0x24,0x24,0x24,0x7e,0x24,0x24,0x7e,0x24,0x24,0x24,0x00,0x00,0x00,0x00, + 8, // 0x23 '#' + 0x00,0x00,0x24,0x24,0x24,0x7e,0x24,0x24,0x7e,0x24,0x24,0x24,0x00,0x00,0x00,0x00, - 8, // 0x24 '$' - 0x00,0x14,0x14,0x3e,0x55,0x54,0x54,0x3e,0x15,0x15,0x55,0x3e,0x14,0x14,0x00,0x00, + 8, // 0x24 '$' + 0x00,0x14,0x14,0x3e,0x55,0x54,0x54,0x3e,0x15,0x15,0x55,0x3e,0x14,0x14,0x00,0x00, - 8, // 0x25 '%' - 0x00,0x00,0x32,0x56,0x6c,0x04,0x08,0x08,0x10,0x13,0x25,0x26,0x00,0x00,0x00,0x00, + 8, // 0x25 '%' + 0x00,0x00,0x32,0x56,0x6c,0x04,0x08,0x08,0x10,0x13,0x25,0x26,0x00,0x00,0x00,0x00, - 8, // 0x26 '&' - 0x00,0x00,0x18,0x24,0x24,0x24,0x18,0x28,0x45,0x46,0x44,0x3b,0x00,0x00,0x00,0x00, + 8, // 0x26 '&' + 0x00,0x00,0x18,0x24,0x24,0x24,0x18,0x28,0x45,0x46,0x44,0x3b,0x00,0x00,0x00,0x00, - 8, // 0x27 ''' - 0x00,0x00,0x08,0x08,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x27 ''' + 0x00,0x00,0x08,0x08,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x28 '(' - 0x00,0x04,0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x04,0x00,0x00,0x00, + 8, // 0x28 '(' + 0x00,0x04,0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x04,0x00,0x00,0x00, - 8, // 0x29 ')' - 0x00,0x10,0x08,0x04,0x04,0x02,0x02,0x02,0x02,0x04,0x04,0x08,0x10,0x00,0x00,0x00, + 8, // 0x29 ')' + 0x00,0x10,0x08,0x04,0x04,0x02,0x02,0x02,0x02,0x04,0x04,0x08,0x10,0x00,0x00,0x00, - 8, // 0x2a '*' - 0x00,0x00,0x00,0x00,0x66,0x24,0x18,0xff,0x18,0x24,0x66,0x00,0x00,0x00,0x00,0x00, + 8, // 0x2a '*' + 0x00,0x00,0x00,0x00,0x66,0x24,0x18,0xff,0x18,0x24,0x66,0x00,0x00,0x00,0x00,0x00, - 8, // 0x2b '+' - 0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x7f,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00, + 8, // 0x2b '+' + 0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x7f,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00, - 8, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x20,0x00, + 8, // 0x2c ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x20,0x00, - 8, // 0x2d '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x2d '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, + 8, // 0x2e '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, - 8, // 0x2f '/' - 0x00,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00,0x00, + 8, // 0x2f '/' + 0x00,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00,0x00, - 8, // 0x30 '0' - 0x00,0x00,0x3c,0x42,0x42,0x46,0x4a,0x52,0x62,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x30 '0' + 0x00,0x00,0x3c,0x42,0x42,0x46,0x4a,0x52,0x62,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x31 '1' - 0x00,0x00,0x08,0x08,0x18,0x38,0x08,0x08,0x08,0x08,0x08,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x31 '1' + 0x00,0x00,0x08,0x08,0x18,0x38,0x08,0x08,0x08,0x08,0x08,0x3e,0x00,0x00,0x00,0x00, - 8, // 0x32 '2' - 0x00,0x00,0x3c,0x42,0x42,0x02,0x04,0x08,0x10,0x20,0x42,0x7e,0x00,0x00,0x00,0x00, + 8, // 0x32 '2' + 0x00,0x00,0x3c,0x42,0x42,0x02,0x04,0x08,0x10,0x20,0x42,0x7e,0x00,0x00,0x00,0x00, - 8, // 0x33 '3' - 0x00,0x00,0x7e,0x42,0x04,0x08,0x1c,0x02,0x02,0x02,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x33 '3' + 0x00,0x00,0x7e,0x42,0x04,0x08,0x1c,0x02,0x02,0x02,0x42,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x34 '4' - 0x00,0x00,0x04,0x08,0x10,0x24,0x44,0x44,0x7e,0x04,0x04,0x0e,0x00,0x00,0x00,0x00, + 8, // 0x34 '4' + 0x00,0x00,0x04,0x08,0x10,0x24,0x44,0x44,0x7e,0x04,0x04,0x0e,0x00,0x00,0x00,0x00, - 8, // 0x35 '5' - 0x00,0x00,0x7e,0x42,0x40,0x40,0x7c,0x02,0x02,0x02,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x35 '5' + 0x00,0x00,0x7e,0x42,0x40,0x40,0x7c,0x02,0x02,0x02,0x42,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x36 '6' - 0x00,0x00,0x1c,0x20,0x40,0x40,0x7c,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x36 '6' + 0x00,0x00,0x1c,0x20,0x40,0x40,0x7c,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x37 '7' - 0x00,0x00,0x7e,0x42,0x42,0x02,0x04,0x08,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00, + 8, // 0x37 '7' + 0x00,0x00,0x7e,0x42,0x42,0x02,0x04,0x08,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00, - 8, // 0x38 '8' - 0x00,0x00,0x3c,0x42,0x42,0x42,0x3c,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x38 '8' + 0x00,0x00,0x3c,0x42,0x42,0x42,0x3c,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x39 '9' - 0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x3e,0x02,0x02,0x04,0x38,0x00,0x00,0x00,0x00, + 8, // 0x39 '9' + 0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x3e,0x02,0x02,0x04,0x38,0x00,0x00,0x00,0x00, - 8, // 0x3a ':' - 0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x3a ':' + 0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x3b ';' - 0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x40,0x00, + 8, // 0x3b ';' + 0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x40,0x00, - 8, // 0x3c '<' - 0x00,0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x02,0x00,0x00,0x00,0x00, + 8, // 0x3c '<' + 0x00,0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x02,0x00,0x00,0x00,0x00, - 8, // 0x3d '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x3d '=' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x3e '>' - 0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x20,0x00,0x00,0x00,0x00, + 8, // 0x3e '>' + 0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x20,0x00,0x00,0x00,0x00, - 8, // 0x3f '?' - 0x00,0x00,0x3c,0x42,0x42,0x42,0x04,0x08,0x08,0x00,0x08,0x08,0x00,0x00,0x00,0x00, + 8, // 0x3f '?' + 0x00,0x00,0x3c,0x42,0x42,0x42,0x04,0x08,0x08,0x00,0x08,0x08,0x00,0x00,0x00,0x00, - 8, // 0x40 '@' - 0x00,0x00,0x3c,0x42,0x01,0x39,0x49,0x49,0x49,0x49,0x49,0x36,0x00,0x00,0x00,0x00, + 8, // 0x40 '@' + 0x00,0x00,0x3c,0x42,0x01,0x39,0x49,0x49,0x49,0x49,0x49,0x36,0x00,0x00,0x00,0x00, - 8, // 0x41 'A' - 0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42,0x00,0x00,0x00,0x00, + 8, // 0x41 'A' + 0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42,0x00,0x00,0x00,0x00, - 8, // 0x42 'B' - 0x00,0x00,0x7c,0x22,0x22,0x22,0x3c,0x22,0x22,0x22,0x22,0x7c,0x00,0x00,0x00,0x00, + 8, // 0x42 'B' + 0x00,0x00,0x7c,0x22,0x22,0x22,0x3c,0x22,0x22,0x22,0x22,0x7c,0x00,0x00,0x00,0x00, - 8, // 0x43 'C' - 0x00,0x00,0x3c,0x42,0x42,0x40,0x40,0x40,0x40,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x43 'C' + 0x00,0x00,0x3c,0x42,0x42,0x40,0x40,0x40,0x40,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x44 'D' - 0x00,0x00,0x7c,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x7c,0x00,0x00,0x00,0x00, + 8, // 0x44 'D' + 0x00,0x00,0x7c,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x7c,0x00,0x00,0x00,0x00, - 8, // 0x45 'E' - 0x00,0x00,0x7e,0x22,0x20,0x28,0x38,0x28,0x20,0x20,0x22,0x7e,0x00,0x00,0x00,0x00, + 8, // 0x45 'E' + 0x00,0x00,0x7e,0x22,0x20,0x28,0x38,0x28,0x20,0x20,0x22,0x7e,0x00,0x00,0x00,0x00, - 8, // 0x46 'F' - 0x00,0x00,0x7e,0x22,0x20,0x28,0x38,0x28,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + 8, // 0x46 'F' + 0x00,0x00,0x7e,0x22,0x20,0x28,0x38,0x28,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, - 8, // 0x47 'G' - 0x00,0x00,0x3c,0x42,0x42,0x40,0x40,0x4e,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x47 'G' + 0x00,0x00,0x3c,0x42,0x42,0x40,0x40,0x4e,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x48 'H' - 0x00,0x00,0x42,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x00,0x00, + 8, // 0x48 'H' + 0x00,0x00,0x42,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x00,0x00, - 8, // 0x49 'I' - 0x00,0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, + 8, // 0x49 'I' + 0x00,0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, - 8, // 0x4a 'J' - 0x00,0x00,0x0e,0x04,0x04,0x04,0x04,0x04,0x04,0x44,0x44,0x38,0x00,0x00,0x00,0x00, + 8, // 0x4a 'J' + 0x00,0x00,0x0e,0x04,0x04,0x04,0x04,0x04,0x04,0x44,0x44,0x38,0x00,0x00,0x00,0x00, - 8, // 0x4b 'K' - 0x00,0x00,0x62,0x22,0x24,0x28,0x30,0x28,0x24,0x22,0x22,0x62,0x00,0x00,0x00,0x00, + 8, // 0x4b 'K' + 0x00,0x00,0x62,0x22,0x24,0x28,0x30,0x28,0x24,0x22,0x22,0x62,0x00,0x00,0x00,0x00, - 8, // 0x4c 'L' - 0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x7e,0x00,0x00,0x00,0x00, + 8, // 0x4c 'L' + 0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x7e,0x00,0x00,0x00,0x00, - 8, // 0x4d 'M' - 0x00,0x00,0x41,0x63,0x55,0x49,0x41,0x41,0x41,0x41,0x41,0x41,0x00,0x00,0x00,0x00, + 8, // 0x4d 'M' + 0x00,0x00,0x41,0x63,0x55,0x49,0x41,0x41,0x41,0x41,0x41,0x41,0x00,0x00,0x00,0x00, - 8, // 0x4e 'N' - 0x00,0x00,0x42,0x42,0x62,0x52,0x4a,0x46,0x42,0x42,0x42,0x42,0x00,0x00,0x00,0x00, + 8, // 0x4e 'N' + 0x00,0x00,0x42,0x42,0x62,0x52,0x4a,0x46,0x42,0x42,0x42,0x42,0x00,0x00,0x00,0x00, - 8, // 0x4f 'O' - 0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x4f 'O' + 0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x50 'P' - 0x00,0x00,0x7c,0x22,0x22,0x22,0x22,0x3c,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + 8, // 0x50 'P' + 0x00,0x00,0x7c,0x22,0x22,0x22,0x22,0x3c,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, - 8, // 0x51 'Q' - 0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x4a,0x44,0x3a,0x02,0x00,0x00,0x00, + 8, // 0x51 'Q' + 0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x4a,0x44,0x3a,0x02,0x00,0x00,0x00, - 8, // 0x52 'R' - 0x00,0x00,0x7c,0x22,0x22,0x22,0x22,0x3c,0x28,0x24,0x22,0x62,0x00,0x00,0x00,0x00, + 8, // 0x52 'R' + 0x00,0x00,0x7c,0x22,0x22,0x22,0x22,0x3c,0x28,0x24,0x22,0x62,0x00,0x00,0x00,0x00, - 8, // 0x53 'S' - 0x00,0x00,0x3c,0x42,0x42,0x40,0x30,0x0c,0x02,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x53 'S' + 0x00,0x00,0x3c,0x42,0x42,0x40,0x30,0x0c,0x02,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x54 'T' - 0x00,0x00,0x7f,0x49,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, + 8, // 0x54 'T' + 0x00,0x00,0x7f,0x49,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, - 8, // 0x55 'U' - 0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x55 'U' + 0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x56 'V' - 0x00,0x00,0x41,0x41,0x41,0x41,0x22,0x22,0x14,0x14,0x08,0x08,0x00,0x00,0x00,0x00, + 8, // 0x56 'V' + 0x00,0x00,0x41,0x41,0x41,0x41,0x22,0x22,0x14,0x14,0x08,0x08,0x00,0x00,0x00,0x00, - 8, // 0x57 'W' - 0x00,0x00,0x41,0x41,0x41,0x41,0x41,0x49,0x49,0x55,0x63,0x41,0x00,0x00,0x00,0x00, + 8, // 0x57 'W' + 0x00,0x00,0x41,0x41,0x41,0x41,0x41,0x49,0x49,0x55,0x63,0x41,0x00,0x00,0x00,0x00, - 8, // 0x58 'X' - 0x00,0x00,0x42,0x42,0x42,0x24,0x18,0x18,0x24,0x42,0x42,0x42,0x00,0x00,0x00,0x00, + 8, // 0x58 'X' + 0x00,0x00,0x42,0x42,0x42,0x24,0x18,0x18,0x24,0x42,0x42,0x42,0x00,0x00,0x00,0x00, - 8, // 0x59 'Y' - 0x00,0x00,0x22,0x22,0x22,0x22,0x14,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, + 8, // 0x59 'Y' + 0x00,0x00,0x22,0x22,0x22,0x22,0x14,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, - 8, // 0x5a 'Z' - 0x00,0x00,0x7e,0x42,0x02,0x04,0x08,0x10,0x20,0x40,0x42,0x7e,0x00,0x00,0x00,0x00, + 8, // 0x5a 'Z' + 0x00,0x00,0x7e,0x42,0x02,0x04,0x08,0x10,0x20,0x40,0x42,0x7e,0x00,0x00,0x00,0x00, - 8, // 0x5b '[' - 0x00,0x1e,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1e,0x00,0x00,0x00, + 8, // 0x5b '[' + 0x00,0x1e,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1e,0x00,0x00,0x00, - 8, // 0x5c '\' - 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x00,0x00,0x00, + 8, // 0x5c '\' + 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x00,0x00,0x00, - 8, // 0x5d ']' - 0x00,0x3c,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x3c,0x00,0x00,0x00, + 8, // 0x5d ']' + 0x00,0x3c,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x3c,0x00,0x00,0x00, - 8, // 0x5e '^' - 0x00,0x00,0x08,0x14,0x22,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x5e '^' + 0x00,0x00,0x08,0x14,0x22,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00, + 8, // 0x5f '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00, - 8, // 0x60 '`' - 0x00,0x00,0x08,0x08,0x08,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x60 '`' + 0x00,0x00,0x08,0x08,0x08,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x04,0x3c,0x44,0x44,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x61 'a' + 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x04,0x3c,0x44,0x44,0x3e,0x00,0x00,0x00,0x00, - 8, // 0x62 'b' - 0x00,0x00,0x60,0x20,0x20,0x38,0x24,0x22,0x22,0x22,0x22,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x62 'b' + 0x00,0x00,0x60,0x20,0x20,0x38,0x24,0x22,0x22,0x22,0x22,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x40,0x40,0x40,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x63 'c' + 0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x40,0x40,0x40,0x42,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x64 'd' - 0x00,0x00,0x0c,0x04,0x04,0x1c,0x24,0x44,0x44,0x44,0x44,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x64 'd' + 0x00,0x00,0x0c,0x04,0x04,0x1c,0x24,0x44,0x44,0x44,0x44,0x3e,0x00,0x00,0x00,0x00, - 8, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x7e,0x40,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x65 'e' + 0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x7e,0x40,0x42,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x66 'f' - 0x00,0x00,0x0c,0x12,0x10,0x10,0x38,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 8, // 0x66 'f' + 0x00,0x00,0x0c,0x12,0x10,0x10,0x38,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, - 8, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x3e,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x44,0x38,0x00, + 8, // 0x67 'g' + 0x00,0x00,0x00,0x00,0x00,0x3e,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x44,0x38,0x00, - 8, // 0x68 'h' - 0x00,0x00,0x60,0x20,0x20,0x2c,0x32,0x22,0x22,0x22,0x22,0x62,0x00,0x00,0x00,0x00, + 8, // 0x68 'h' + 0x00,0x00,0x60,0x20,0x20,0x2c,0x32,0x22,0x22,0x22,0x22,0x62,0x00,0x00,0x00,0x00, - 8, // 0x69 'i' - 0x00,0x00,0x08,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, + 8, // 0x69 'i' + 0x00,0x00,0x08,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, - 8, // 0x6a 'j' - 0x00,0x00,0x04,0x04,0x00,0x0c,0x04,0x04,0x04,0x04,0x04,0x44,0x44,0x38,0x00,0x00, + 8, // 0x6a 'j' + 0x00,0x00,0x04,0x04,0x00,0x0c,0x04,0x04,0x04,0x04,0x04,0x44,0x44,0x38,0x00,0x00, - 8, // 0x6b 'k' - 0x00,0x00,0x60,0x20,0x20,0x22,0x24,0x28,0x38,0x24,0x22,0x62,0x00,0x00,0x00,0x00, + 8, // 0x6b 'k' + 0x00,0x00,0x60,0x20,0x20,0x22,0x24,0x28,0x38,0x24,0x22,0x62,0x00,0x00,0x00,0x00, - 8, // 0x6c 'l' - 0x00,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, + 8, // 0x6c 'l' + 0x00,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, - 8, // 0x6d 'm' - 0x00,0x00,0x00,0x00,0x00,0x76,0x49,0x49,0x49,0x49,0x41,0x41,0x00,0x00,0x00,0x00, + 8, // 0x6d 'm' + 0x00,0x00,0x00,0x00,0x00,0x76,0x49,0x49,0x49,0x49,0x41,0x41,0x00,0x00,0x00,0x00, - 8, // 0x6e 'n' - 0x00,0x00,0x00,0x00,0x00,0x5c,0x22,0x22,0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x00, + 8, // 0x6e 'n' + 0x00,0x00,0x00,0x00,0x00,0x5c,0x22,0x22,0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x00, - 8, // 0x6f 'o' - 0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x6f 'o' + 0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x7c,0x22,0x22,0x22,0x22,0x22,0x3c,0x20,0x20,0x70,0x00, + 8, // 0x70 'p' + 0x00,0x00,0x00,0x00,0x00,0x7c,0x22,0x22,0x22,0x22,0x22,0x3c,0x20,0x20,0x70,0x00, - 8, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x3e,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x04,0x0e,0x00, + 8, // 0x71 'q' + 0x00,0x00,0x00,0x00,0x00,0x3e,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x04,0x0e,0x00, - 8, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x7c,0x22,0x22,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + 8, // 0x72 'r' + 0x00,0x00,0x00,0x00,0x00,0x7c,0x22,0x22,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, - 8, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x40,0x3c,0x02,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x73 's' + 0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x40,0x3c,0x02,0x42,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x74 't' - 0x00,0x00,0x10,0x10,0x10,0x7c,0x10,0x10,0x10,0x10,0x12,0x0c,0x00,0x00,0x00,0x00, + 8, // 0x74 't' + 0x00,0x00,0x10,0x10,0x10,0x7c,0x10,0x10,0x10,0x10,0x12,0x0c,0x00,0x00,0x00,0x00, - 8, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x75 'u' + 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3e,0x00,0x00,0x00,0x00, - 8, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x41,0x41,0x41,0x41,0x22,0x14,0x08,0x00,0x00,0x00,0x00, + 8, // 0x76 'v' + 0x00,0x00,0x00,0x00,0x00,0x41,0x41,0x41,0x41,0x22,0x14,0x08,0x00,0x00,0x00,0x00, - 8, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x41,0x41,0x41,0x49,0x49,0x55,0x22,0x00,0x00,0x00,0x00, + 8, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x00,0x41,0x41,0x41,0x49,0x49,0x55,0x22,0x00,0x00,0x00,0x00, - 8, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x00,0x00,0x00,0x00, + 8, // 0x78 'x' + 0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x00,0x00,0x00,0x00, - 8, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3e,0x02,0x04,0x78,0x00, + 8, // 0x79 'y' + 0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3e,0x02,0x04,0x78,0x00, - 8, // 0x7a 'z' - 0x00,0x00,0x00,0x00,0x00,0x7e,0x44,0x08,0x10,0x20,0x42,0x7e,0x00,0x00,0x00,0x00, + 8, // 0x7a 'z' + 0x00,0x00,0x00,0x00,0x00,0x7e,0x44,0x08,0x10,0x20,0x42,0x7e,0x00,0x00,0x00,0x00, - 8, // 0x7b '{' - 0x00,0x06,0x08,0x08,0x08,0x08,0x08,0x30,0x08,0x08,0x08,0x08,0x08,0x06,0x00,0x00, + 8, // 0x7b '{' + 0x00,0x06,0x08,0x08,0x08,0x08,0x08,0x30,0x08,0x08,0x08,0x08,0x08,0x06,0x00,0x00, - 8, // 0x7c '|' - 0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00, + 8, // 0x7c '|' + 0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00, - 8, // 0x7d '}' - 0x00,0x30,0x08,0x08,0x08,0x08,0x08,0x06,0x08,0x08,0x08,0x08,0x08,0x30,0x00,0x00, + 8, // 0x7d '}' + 0x00,0x30,0x08,0x08,0x08,0x08,0x08,0x06,0x08,0x08,0x08,0x08,0x08,0x30,0x00,0x00, - 8, // 0x7e '~' - 0x00,0x00,0x39,0x4e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x7e '~' + 0x00,0x00,0x39,0x4e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x7f '' - 0x00,0x00,0x00,0x00,0x00,0x08,0x14,0x22,0x41,0x41,0x7f,0x00,0x00,0x00,0x00,0x00, - 0 - }; + 8, // 0x7f '' + 0x00,0x00,0x00,0x00,0x00,0x08,0x14,0x22,0x41,0x41,0x7f,0x00,0x00,0x00,0x00,0x00, + 0 +}; - const int8u gse8x16_bold[] = - { - 16, 0, 32, 128-32, +const int8u gse8x16_bold[] = +{ + 16, 0, 32, 128-32, - 0x00,0x00,0x11,0x00,0x22,0x00,0x33,0x00,0x44,0x00,0x55,0x00,0x66,0x00,0x77,0x00,0x88,0x00, - 0x99,0x00,0xaa,0x00,0xbb,0x00,0xcc,0x00,0xdd,0x00,0xee,0x00,0xff,0x00,0x10,0x01,0x21,0x01, - 0x32,0x01,0x43,0x01,0x54,0x01,0x65,0x01,0x76,0x01,0x87,0x01,0x98,0x01,0xa9,0x01,0xba,0x01, - 0xcb,0x01,0xdc,0x01,0xed,0x01,0xfe,0x01,0x0f,0x02,0x20,0x02,0x31,0x02,0x42,0x02,0x53,0x02, - 0x64,0x02,0x75,0x02,0x86,0x02,0x97,0x02,0xa8,0x02,0xb9,0x02,0xca,0x02,0xdb,0x02,0xec,0x02, - 0xfd,0x02,0x0e,0x03,0x1f,0x03,0x30,0x03,0x41,0x03,0x52,0x03,0x63,0x03,0x74,0x03,0x85,0x03, - 0x96,0x03,0xa7,0x03,0xb8,0x03,0xc9,0x03,0xda,0x03,0xeb,0x03,0xfc,0x03,0x0d,0x04,0x1e,0x04, - 0x2f,0x04,0x40,0x04,0x51,0x04,0x62,0x04,0x73,0x04,0x84,0x04,0x95,0x04,0xa6,0x04,0xb7,0x04, - 0xc8,0x04,0xd9,0x04,0xea,0x04,0xfb,0x04,0x0c,0x05,0x1d,0x05,0x2e,0x05,0x3f,0x05,0x50,0x05, - 0x61,0x05,0x72,0x05,0x83,0x05,0x94,0x05,0xa5,0x05,0xb6,0x05,0xc7,0x05,0xd8,0x05,0xe9,0x05, - 0xfa,0x05,0x0b,0x06,0x1c,0x06,0x2d,0x06,0x3e,0x06,0x4f,0x06, + 0x00,0x00,0x11,0x00,0x22,0x00,0x33,0x00,0x44,0x00,0x55,0x00,0x66,0x00,0x77,0x00,0x88,0x00, + 0x99,0x00,0xaa,0x00,0xbb,0x00,0xcc,0x00,0xdd,0x00,0xee,0x00,0xff,0x00,0x10,0x01,0x21,0x01, + 0x32,0x01,0x43,0x01,0x54,0x01,0x65,0x01,0x76,0x01,0x87,0x01,0x98,0x01,0xa9,0x01,0xba,0x01, + 0xcb,0x01,0xdc,0x01,0xed,0x01,0xfe,0x01,0x0f,0x02,0x20,0x02,0x31,0x02,0x42,0x02,0x53,0x02, + 0x64,0x02,0x75,0x02,0x86,0x02,0x97,0x02,0xa8,0x02,0xb9,0x02,0xca,0x02,0xdb,0x02,0xec,0x02, + 0xfd,0x02,0x0e,0x03,0x1f,0x03,0x30,0x03,0x41,0x03,0x52,0x03,0x63,0x03,0x74,0x03,0x85,0x03, + 0x96,0x03,0xa7,0x03,0xb8,0x03,0xc9,0x03,0xda,0x03,0xeb,0x03,0xfc,0x03,0x0d,0x04,0x1e,0x04, + 0x2f,0x04,0x40,0x04,0x51,0x04,0x62,0x04,0x73,0x04,0x84,0x04,0x95,0x04,0xa6,0x04,0xb7,0x04, + 0xc8,0x04,0xd9,0x04,0xea,0x04,0xfb,0x04,0x0c,0x05,0x1d,0x05,0x2e,0x05,0x3f,0x05,0x50,0x05, + 0x61,0x05,0x72,0x05,0x83,0x05,0x94,0x05,0xa5,0x05,0xb6,0x05,0xc7,0x05,0xd8,0x05,0xe9,0x05, + 0xfa,0x05,0x0b,0x06,0x1c,0x06,0x2d,0x06,0x3e,0x06,0x4f,0x06, - 8, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x21 '!' - 0x00,0x00,0x18,0x3c,0x3c,0x3c,0x3c,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, + 8, // 0x21 '!' + 0x00,0x00,0x18,0x3c,0x3c,0x3c,0x3c,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, - 8, // 0x22 '"' - 0x00,0x66,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x22 '"' + 0x00,0x66,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x23 '#' - 0x00,0x00,0x66,0x66,0x66,0xff,0x66,0x66,0xff,0x66,0x66,0x66,0x00,0x00,0x00,0x00, + 8, // 0x23 '#' + 0x00,0x00,0x66,0x66,0x66,0xff,0x66,0x66,0xff,0x66,0x66,0x66,0x00,0x00,0x00,0x00, - 8, // 0x24 '$' - 0x00,0x08,0x08,0x3e,0x6b,0x6b,0x68,0x3e,0x0b,0x6b,0x6b,0x3e,0x08,0x08,0x00,0x00, + 8, // 0x24 '$' + 0x00,0x08,0x08,0x3e,0x6b,0x6b,0x68,0x3e,0x0b,0x6b,0x6b,0x3e,0x08,0x08,0x00,0x00, - 8, // 0x25 '%' - 0x00,0x00,0x66,0xbe,0xcc,0x0c,0x18,0x18,0x30,0x33,0x65,0x66,0x00,0x00,0x00,0x00, + 8, // 0x25 '%' + 0x00,0x00,0x66,0xbe,0xcc,0x0c,0x18,0x18,0x30,0x33,0x65,0x66,0x00,0x00,0x00,0x00, - 8, // 0x26 '&' - 0x00,0x00,0x1c,0x36,0x36,0x36,0x1c,0x3b,0x6e,0x66,0x66,0x3b,0x00,0x00,0x00,0x00, + 8, // 0x26 '&' + 0x00,0x00,0x1c,0x36,0x36,0x36,0x1c,0x3b,0x6e,0x66,0x66,0x3b,0x00,0x00,0x00,0x00, - 8, // 0x27 ''' - 0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x27 ''' + 0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x28 '(' - 0x00,0x06,0x0c,0x18,0x18,0x30,0x30,0x30,0x30,0x18,0x18,0x0c,0x06,0x00,0x00,0x00, + 8, // 0x28 '(' + 0x00,0x06,0x0c,0x18,0x18,0x30,0x30,0x30,0x30,0x18,0x18,0x0c,0x06,0x00,0x00,0x00, - 8, // 0x29 ')' - 0x00,0x30,0x18,0x0c,0x0c,0x06,0x06,0x06,0x06,0x0c,0x0c,0x18,0x30,0x00,0x00,0x00, + 8, // 0x29 ')' + 0x00,0x30,0x18,0x0c,0x0c,0x06,0x06,0x06,0x06,0x0c,0x0c,0x18,0x30,0x00,0x00,0x00, - 8, // 0x2a '*' - 0x00,0x00,0x00,0x00,0x66,0x24,0x18,0xff,0x18,0x24,0x66,0x00,0x00,0x00,0x00,0x00, + 8, // 0x2a '*' + 0x00,0x00,0x00,0x00,0x66,0x24,0x18,0xff,0x18,0x24,0x66,0x00,0x00,0x00,0x00,0x00, - 8, // 0x2b '+' - 0x00,0x00,0x00,0x00,0x18,0x18,0x18,0xff,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00, + 8, // 0x2b '+' + 0x00,0x00,0x00,0x00,0x18,0x18,0x18,0xff,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00, - 8, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x20,0x00, + 8, // 0x2c ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x20,0x00, - 8, // 0x2d '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x2d '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, + 8, // 0x2e '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, - 8, // 0x2f '/' - 0x00,0x03,0x03,0x06,0x06,0x0c,0x0c,0x18,0x18,0x30,0x30,0x60,0x60,0x00,0x00,0x00, + 8, // 0x2f '/' + 0x00,0x03,0x03,0x06,0x06,0x0c,0x0c,0x18,0x18,0x30,0x30,0x60,0x60,0x00,0x00,0x00, - 8, // 0x30 '0' - 0x00,0x00,0x3e,0x63,0x63,0x67,0x6b,0x73,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x30 '0' + 0x00,0x00,0x3e,0x63,0x63,0x67,0x6b,0x73,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, - 8, // 0x31 '1' - 0x00,0x00,0x0c,0x0c,0x1c,0x3c,0x0c,0x0c,0x0c,0x0c,0x0c,0x3f,0x00,0x00,0x00,0x00, + 8, // 0x31 '1' + 0x00,0x00,0x0c,0x0c,0x1c,0x3c,0x0c,0x0c,0x0c,0x0c,0x0c,0x3f,0x00,0x00,0x00,0x00, - 8, // 0x32 '2' - 0x00,0x00,0x3e,0x63,0x63,0x03,0x06,0x0c,0x18,0x30,0x61,0x7f,0x00,0x00,0x00,0x00, + 8, // 0x32 '2' + 0x00,0x00,0x3e,0x63,0x63,0x03,0x06,0x0c,0x18,0x30,0x61,0x7f,0x00,0x00,0x00,0x00, - 8, // 0x33 '3' - 0x00,0x00,0x7f,0x43,0x06,0x0c,0x1e,0x03,0x03,0x03,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x33 '3' + 0x00,0x00,0x7f,0x43,0x06,0x0c,0x1e,0x03,0x03,0x03,0x63,0x3e,0x00,0x00,0x00,0x00, - 8, // 0x34 '4' - 0x00,0x00,0x06,0x0c,0x18,0x32,0x66,0x66,0x7f,0x06,0x06,0x0f,0x00,0x00,0x00,0x00, + 8, // 0x34 '4' + 0x00,0x00,0x06,0x0c,0x18,0x32,0x66,0x66,0x7f,0x06,0x06,0x0f,0x00,0x00,0x00,0x00, - 8, // 0x35 '5' - 0x00,0x00,0x7f,0x61,0x60,0x60,0x7e,0x03,0x03,0x03,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x35 '5' + 0x00,0x00,0x7f,0x61,0x60,0x60,0x7e,0x03,0x03,0x03,0x63,0x3e,0x00,0x00,0x00,0x00, - 8, // 0x36 '6' - 0x00,0x00,0x1e,0x30,0x60,0x60,0x7e,0x63,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x36 '6' + 0x00,0x00,0x1e,0x30,0x60,0x60,0x7e,0x63,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, - 8, // 0x37 '7' - 0x00,0x00,0x7f,0x63,0x63,0x03,0x06,0x0c,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, + 8, // 0x37 '7' + 0x00,0x00,0x7f,0x63,0x63,0x03,0x06,0x0c,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, - 8, // 0x38 '8' - 0x00,0x00,0x3e,0x63,0x63,0x63,0x3e,0x63,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x38 '8' + 0x00,0x00,0x3e,0x63,0x63,0x63,0x3e,0x63,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, - 8, // 0x39 '9' - 0x00,0x00,0x3e,0x63,0x63,0x63,0x63,0x3f,0x03,0x03,0x06,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x39 '9' + 0x00,0x00,0x3e,0x63,0x63,0x63,0x63,0x3f,0x03,0x03,0x06,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x3a ':' - 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, + 8, // 0x3a ':' + 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, - 8, // 0x3b ';' - 0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x40,0x00, + 8, // 0x3b ';' + 0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x40,0x00, - 8, // 0x3c '<' - 0x00,0x00,0x00,0x06,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x06,0x00,0x00,0x00,0x00, + 8, // 0x3c '<' + 0x00,0x00,0x00,0x06,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x06,0x00,0x00,0x00,0x00, - 8, // 0x3d '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x3d '=' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x3e '>' - 0x00,0x00,0x00,0x30,0x18,0x0c,0x06,0x03,0x06,0x0c,0x18,0x30,0x00,0x00,0x00,0x00, + 8, // 0x3e '>' + 0x00,0x00,0x00,0x30,0x18,0x0c,0x06,0x03,0x06,0x0c,0x18,0x30,0x00,0x00,0x00,0x00, - 8, // 0x3f '?' - 0x00,0x00,0x3e,0x63,0x63,0x63,0x06,0x0c,0x0c,0x00,0x0c,0x0c,0x00,0x00,0x00,0x00, + 8, // 0x3f '?' + 0x00,0x00,0x3e,0x63,0x63,0x63,0x06,0x0c,0x0c,0x00,0x0c,0x0c,0x00,0x00,0x00,0x00, - 8, // 0x40 '@' - 0x00,0x00,0x7c,0x86,0x03,0x73,0xdb,0xdb,0xdb,0xdb,0xdb,0x6e,0x00,0x00,0x00,0x00, + 8, // 0x40 '@' + 0x00,0x00,0x7c,0x86,0x03,0x73,0xdb,0xdb,0xdb,0xdb,0xdb,0x6e,0x00,0x00,0x00,0x00, - 8, // 0x41 'A' - 0x00,0x00,0x08,0x1c,0x36,0x63,0x63,0x63,0x7f,0x63,0x63,0x63,0x00,0x00,0x00,0x00, + 8, // 0x41 'A' + 0x00,0x00,0x08,0x1c,0x36,0x63,0x63,0x63,0x7f,0x63,0x63,0x63,0x00,0x00,0x00,0x00, - 8, // 0x42 'B' - 0x00,0x00,0x7e,0x33,0x33,0x33,0x3e,0x33,0x33,0x33,0x33,0x7e,0x00,0x00,0x00,0x00, + 8, // 0x42 'B' + 0x00,0x00,0x7e,0x33,0x33,0x33,0x3e,0x33,0x33,0x33,0x33,0x7e,0x00,0x00,0x00,0x00, - 8, // 0x43 'C' - 0x00,0x00,0x1e,0x33,0x61,0x60,0x60,0x60,0x60,0x61,0x33,0x1e,0x00,0x00,0x00,0x00, + 8, // 0x43 'C' + 0x00,0x00,0x1e,0x33,0x61,0x60,0x60,0x60,0x60,0x61,0x33,0x1e,0x00,0x00,0x00,0x00, - 8, // 0x44 'D' - 0x00,0x00,0x7c,0x36,0x33,0x33,0x33,0x33,0x33,0x33,0x36,0x7c,0x00,0x00,0x00,0x00, + 8, // 0x44 'D' + 0x00,0x00,0x7c,0x36,0x33,0x33,0x33,0x33,0x33,0x33,0x36,0x7c,0x00,0x00,0x00,0x00, - 8, // 0x45 'E' - 0x00,0x00,0x7f,0x33,0x31,0x34,0x3c,0x34,0x30,0x31,0x33,0x7f,0x00,0x00,0x00,0x00, + 8, // 0x45 'E' + 0x00,0x00,0x7f,0x33,0x31,0x34,0x3c,0x34,0x30,0x31,0x33,0x7f,0x00,0x00,0x00,0x00, - 8, // 0x46 'F' - 0x00,0x00,0x7f,0x33,0x31,0x34,0x3c,0x34,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00, + 8, // 0x46 'F' + 0x00,0x00,0x7f,0x33,0x31,0x34,0x3c,0x34,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00, - 8, // 0x47 'G' - 0x00,0x00,0x1f,0x33,0x61,0x60,0x60,0x6f,0x63,0x63,0x33,0x1e,0x00,0x00,0x00,0x00, + 8, // 0x47 'G' + 0x00,0x00,0x1f,0x33,0x61,0x60,0x60,0x6f,0x63,0x63,0x33,0x1e,0x00,0x00,0x00,0x00, - 8, // 0x48 'H' - 0x00,0x00,0x63,0x63,0x63,0x63,0x7f,0x63,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00, + 8, // 0x48 'H' + 0x00,0x00,0x63,0x63,0x63,0x63,0x7f,0x63,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00, - 8, // 0x49 'I' - 0x00,0x00,0x1e,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, + 8, // 0x49 'I' + 0x00,0x00,0x1e,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, - 8, // 0x4a 'J' - 0x00,0x00,0x0f,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x4a 'J' + 0x00,0x00,0x0f,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x4b 'K' - 0x00,0x00,0x73,0x33,0x36,0x36,0x3c,0x36,0x36,0x33,0x33,0x73,0x00,0x00,0x00,0x00, + 8, // 0x4b 'K' + 0x00,0x00,0x73,0x33,0x36,0x36,0x3c,0x36,0x36,0x33,0x33,0x73,0x00,0x00,0x00,0x00, - 8, // 0x4c 'L' - 0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x33,0x7f,0x00,0x00,0x00,0x00, + 8, // 0x4c 'L' + 0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x33,0x7f,0x00,0x00,0x00,0x00, - 8, // 0x4d 'M' - 0x00,0x00,0x63,0x63,0x77,0x77,0x7f,0x6b,0x6b,0x63,0x63,0x63,0x00,0x00,0x00,0x00, + 8, // 0x4d 'M' + 0x00,0x00,0x63,0x63,0x77,0x77,0x7f,0x6b,0x6b,0x63,0x63,0x63,0x00,0x00,0x00,0x00, - 8, // 0x4e 'N' - 0x00,0x00,0x63,0x63,0x73,0x7b,0x6f,0x67,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00, + 8, // 0x4e 'N' + 0x00,0x00,0x63,0x63,0x73,0x7b,0x6f,0x67,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00, - 8, // 0x4f 'O' - 0x00,0x00,0x1c,0x36,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1c,0x00,0x00,0x00,0x00, + 8, // 0x4f 'O' + 0x00,0x00,0x1c,0x36,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1c,0x00,0x00,0x00,0x00, - 8, // 0x50 'P' - 0x00,0x00,0x7e,0x33,0x33,0x33,0x33,0x3e,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00, + 8, // 0x50 'P' + 0x00,0x00,0x7e,0x33,0x33,0x33,0x33,0x3e,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00, - 8, // 0x51 'Q' - 0x00,0x00,0x1c,0x36,0x63,0x63,0x63,0x63,0x63,0x6f,0x36,0x1e,0x03,0x00,0x00,0x00, + 8, // 0x51 'Q' + 0x00,0x00,0x1c,0x36,0x63,0x63,0x63,0x63,0x63,0x6f,0x36,0x1e,0x03,0x00,0x00,0x00, - 8, // 0x52 'R' - 0x00,0x00,0x7e,0x33,0x33,0x33,0x33,0x3e,0x36,0x33,0x33,0x73,0x00,0x00,0x00,0x00, + 8, // 0x52 'R' + 0x00,0x00,0x7e,0x33,0x33,0x33,0x33,0x3e,0x36,0x33,0x33,0x73,0x00,0x00,0x00,0x00, - 8, // 0x53 'S' - 0x00,0x00,0x3e,0x63,0x63,0x30,0x18,0x0c,0x06,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x53 'S' + 0x00,0x00,0x3e,0x63,0x63,0x30,0x18,0x0c,0x06,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, - 8, // 0x54 'T' - 0x00,0x00,0x3f,0x3f,0x2d,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, + 8, // 0x54 'T' + 0x00,0x00,0x3f,0x3f,0x2d,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, - 8, // 0x55 'U' - 0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x55 'U' + 0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, - 8, // 0x56 'V' - 0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1c,0x08,0x00,0x00,0x00,0x00, + 8, // 0x56 'V' + 0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1c,0x08,0x00,0x00,0x00,0x00, - 8, // 0x57 'W' - 0x00,0x00,0x63,0x63,0x63,0x6b,0x6b,0x7f,0x77,0x77,0x63,0x63,0x00,0x00,0x00,0x00, + 8, // 0x57 'W' + 0x00,0x00,0x63,0x63,0x63,0x6b,0x6b,0x7f,0x77,0x77,0x63,0x63,0x00,0x00,0x00,0x00, - 8, // 0x58 'X' - 0x00,0x00,0x63,0x63,0x63,0x36,0x1c,0x1c,0x36,0x63,0x63,0x63,0x00,0x00,0x00,0x00, + 8, // 0x58 'X' + 0x00,0x00,0x63,0x63,0x63,0x36,0x1c,0x1c,0x36,0x63,0x63,0x63,0x00,0x00,0x00,0x00, - 8, // 0x59 'Y' - 0x00,0x00,0x33,0x33,0x33,0x33,0x1e,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, + 8, // 0x59 'Y' + 0x00,0x00,0x33,0x33,0x33,0x33,0x1e,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, - 8, // 0x5a 'Z' - 0x00,0x00,0x7f,0x63,0x43,0x06,0x0c,0x18,0x30,0x61,0x63,0x7f,0x00,0x00,0x00,0x00, + 8, // 0x5a 'Z' + 0x00,0x00,0x7f,0x63,0x43,0x06,0x0c,0x18,0x30,0x61,0x63,0x7f,0x00,0x00,0x00,0x00, - 8, // 0x5b '[' - 0x00,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x00,0x00,0x00, + 8, // 0x5b '[' + 0x00,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x00,0x00,0x00, - 8, // 0x5c '\' - 0x00,0x60,0x60,0x30,0x30,0x18,0x18,0x0c,0x0c,0x06,0x06,0x03,0x03,0x00,0x00,0x00, + 8, // 0x5c '\' + 0x00,0x60,0x60,0x30,0x30,0x18,0x18,0x0c,0x0c,0x06,0x06,0x03,0x03,0x00,0x00,0x00, - 8, // 0x5d ']' - 0x00,0x7c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x7c,0x00,0x00,0x00, + 8, // 0x5d ']' + 0x00,0x7c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x7c,0x00,0x00,0x00, - 8, // 0x5e '^' - 0x00,0x00,0x08,0x1c,0x36,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x5e '^' + 0x00,0x00,0x08,0x1c,0x36,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00, + 8, // 0x5f '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00, - 8, // 0x60 '`' - 0x00,0x00,0x18,0x18,0x18,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x60 '`' + 0x00,0x00,0x18,0x18,0x18,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x3c,0x66,0x06,0x3e,0x66,0x66,0x3b,0x00,0x00,0x00,0x00, + 8, // 0x61 'a' + 0x00,0x00,0x00,0x00,0x00,0x3c,0x66,0x06,0x3e,0x66,0x66,0x3b,0x00,0x00,0x00,0x00, - 8, // 0x62 'b' - 0x00,0x00,0x70,0x30,0x30,0x3c,0x36,0x33,0x33,0x33,0x33,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x62 'b' + 0x00,0x00,0x70,0x30,0x30,0x3c,0x36,0x33,0x33,0x33,0x33,0x3e,0x00,0x00,0x00,0x00, - 8, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x3e,0x63,0x63,0x60,0x60,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x63 'c' + 0x00,0x00,0x00,0x00,0x00,0x3e,0x63,0x63,0x60,0x60,0x63,0x3e,0x00,0x00,0x00,0x00, - 8, // 0x64 'd' - 0x00,0x00,0x0e,0x06,0x06,0x1e,0x36,0x66,0x66,0x66,0x66,0x3b,0x00,0x00,0x00,0x00, + 8, // 0x64 'd' + 0x00,0x00,0x0e,0x06,0x06,0x1e,0x36,0x66,0x66,0x66,0x66,0x3b,0x00,0x00,0x00,0x00, - 8, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x3e,0x63,0x63,0x7f,0x60,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x65 'e' + 0x00,0x00,0x00,0x00,0x00,0x3e,0x63,0x63,0x7f,0x60,0x63,0x3e,0x00,0x00,0x00,0x00, - 8, // 0x66 'f' - 0x00,0x00,0x0e,0x1b,0x1b,0x18,0x3c,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x66 'f' + 0x00,0x00,0x0e,0x1b,0x1b,0x18,0x3c,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, - 8, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x3b,0x66,0x66,0x66,0x66,0x66,0x3e,0x06,0x66,0x3c,0x00, + 8, // 0x67 'g' + 0x00,0x00,0x00,0x00,0x00,0x3b,0x66,0x66,0x66,0x66,0x66,0x3e,0x06,0x66,0x3c,0x00, - 8, // 0x68 'h' - 0x00,0x00,0x70,0x30,0x30,0x36,0x3b,0x33,0x33,0x33,0x33,0x73,0x00,0x00,0x00,0x00, + 8, // 0x68 'h' + 0x00,0x00,0x70,0x30,0x30,0x36,0x3b,0x33,0x33,0x33,0x33,0x73,0x00,0x00,0x00,0x00, - 8, // 0x69 'i' - 0x00,0x00,0x0c,0x0c,0x00,0x1c,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, + 8, // 0x69 'i' + 0x00,0x00,0x0c,0x0c,0x00,0x1c,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, - 8, // 0x6a 'j' - 0x00,0x00,0x06,0x06,0x00,0x0e,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3c,0x00,0x00, + 8, // 0x6a 'j' + 0x00,0x00,0x06,0x06,0x00,0x0e,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3c,0x00,0x00, - 8, // 0x6b 'k' - 0x00,0x00,0x70,0x30,0x30,0x33,0x33,0x36,0x3c,0x36,0x33,0x73,0x00,0x00,0x00,0x00, + 8, // 0x6b 'k' + 0x00,0x00,0x70,0x30,0x30,0x33,0x33,0x36,0x3c,0x36,0x33,0x73,0x00,0x00,0x00,0x00, - 8, // 0x6c 'l' - 0x00,0x00,0x1c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, + 8, // 0x6c 'l' + 0x00,0x00,0x1c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, - 8, // 0x6d 'm' - 0x00,0x00,0x00,0x00,0x00,0x76,0x7f,0x6b,0x6b,0x6b,0x63,0x63,0x00,0x00,0x00,0x00, + 8, // 0x6d 'm' + 0x00,0x00,0x00,0x00,0x00,0x76,0x7f,0x6b,0x6b,0x6b,0x63,0x63,0x00,0x00,0x00,0x00, - 8, // 0x6e 'n' - 0x00,0x00,0x00,0x00,0x00,0x6e,0x33,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x00,0x00, + 8, // 0x6e 'n' + 0x00,0x00,0x00,0x00,0x00,0x6e,0x33,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x00,0x00, - 8, // 0x6f 'o' - 0x00,0x00,0x00,0x00,0x00,0x3e,0x63,0x63,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x6f 'o' + 0x00,0x00,0x00,0x00,0x00,0x3e,0x63,0x63,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, - 8, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x6e,0x33,0x33,0x33,0x33,0x33,0x3e,0x30,0x30,0x78,0x00, + 8, // 0x70 'p' + 0x00,0x00,0x00,0x00,0x00,0x6e,0x33,0x33,0x33,0x33,0x33,0x3e,0x30,0x30,0x78,0x00, - 8, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x3b,0x66,0x66,0x66,0x66,0x66,0x3e,0x06,0x06,0x0f,0x00, + 8, // 0x71 'q' + 0x00,0x00,0x00,0x00,0x00,0x3b,0x66,0x66,0x66,0x66,0x66,0x3e,0x06,0x06,0x0f,0x00, - 8, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x6e,0x3b,0x33,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00, + 8, // 0x72 'r' + 0x00,0x00,0x00,0x00,0x00,0x6e,0x3b,0x33,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00, - 8, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x3e,0x63,0x60,0x3e,0x03,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x73 's' + 0x00,0x00,0x00,0x00,0x00,0x3e,0x63,0x60,0x3e,0x03,0x63,0x3e,0x00,0x00,0x00,0x00, - 8, // 0x74 't' - 0x00,0x00,0x08,0x18,0x18,0x7e,0x18,0x18,0x18,0x18,0x1b,0x0e,0x00,0x00,0x00,0x00, + 8, // 0x74 't' + 0x00,0x00,0x08,0x18,0x18,0x7e,0x18,0x18,0x18,0x18,0x1b,0x0e,0x00,0x00,0x00,0x00, - 8, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3b,0x00,0x00,0x00,0x00, + 8, // 0x75 'u' + 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3b,0x00,0x00,0x00,0x00, - 8, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x36,0x1c,0x08,0x00,0x00,0x00,0x00, + 8, // 0x76 'v' + 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x36,0x1c,0x08,0x00,0x00,0x00,0x00, - 8, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x6b,0x6b,0x7f,0x36,0x36,0x00,0x00,0x00,0x00, + 8, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x6b,0x6b,0x7f,0x36,0x36,0x00,0x00,0x00,0x00, - 8, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x36,0x1c,0x36,0x63,0x63,0x00,0x00,0x00,0x00, + 8, // 0x78 'x' + 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x36,0x1c,0x36,0x63,0x63,0x00,0x00,0x00,0x00, - 8, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x3f,0x03,0x06,0x7c,0x00, + 8, // 0x79 'y' + 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x3f,0x03,0x06,0x7c,0x00, - 8, // 0x7a 'z' - 0x00,0x00,0x00,0x00,0x00,0x7f,0x63,0x06,0x0c,0x18,0x31,0x7f,0x00,0x00,0x00,0x00, + 8, // 0x7a 'z' + 0x00,0x00,0x00,0x00,0x00,0x7f,0x63,0x06,0x0c,0x18,0x31,0x7f,0x00,0x00,0x00,0x00, - 8, // 0x7b '{' - 0x00,0x03,0x04,0x0c,0x0c,0x0c,0x08,0x30,0x08,0x0c,0x0c,0x0c,0x04,0x03,0x00,0x00, + 8, // 0x7b '{' + 0x00,0x03,0x04,0x0c,0x0c,0x0c,0x08,0x30,0x08,0x0c,0x0c,0x0c,0x04,0x03,0x00,0x00, - 8, // 0x7c '|' - 0x00,0x00,0x0c,0x0c,0x0c,0x0c,0x0c,0x00,0x0c,0x0c,0x0c,0x0c,0x0c,0x00,0x00,0x00, + 8, // 0x7c '|' + 0x00,0x00,0x0c,0x0c,0x0c,0x0c,0x0c,0x00,0x0c,0x0c,0x0c,0x0c,0x0c,0x00,0x00,0x00, - 8, // 0x7d '}' - 0x00,0x60,0x10,0x18,0x18,0x18,0x08,0x06,0x08,0x18,0x18,0x18,0x10,0x60,0x00,0x00, + 8, // 0x7d '}' + 0x00,0x60,0x10,0x18,0x18,0x18,0x08,0x06,0x08,0x18,0x18,0x18,0x10,0x60,0x00,0x00, - 8, // 0x7e '~' - 0x00,0x00,0x3b,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x7e '~' + 0x00,0x00,0x3b,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x7f '' - 0x00,0x00,0x00,0x00,0x00,0x08,0x1c,0x36,0x63,0x63,0x7f,0x00,0x00,0x00,0x00,0x00, - 0 - }; + 8, // 0x7f '' + 0x00,0x00,0x00,0x00,0x00,0x08,0x1c,0x36,0x63,0x63,0x7f,0x00,0x00,0x00,0x00,0x00, + 0 +}; - const int8u mcs11_prop[] = - { - 11, 2, 32, 128-32, - 0x00,0x00,0x0C,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3C,0x00,0x48,0x00,0x54,0x00,0x60,0x00, - 0x6C,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9C,0x00,0xA8,0x00,0xB4,0x00,0xC0,0x00,0xCC,0x00, - 0xD8,0x00,0xE4,0x00,0xF0,0x00,0xFC,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2C,0x01,0x38,0x01, - 0x44,0x01,0x50,0x01,0x5C,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8C,0x01,0x98,0x01,0xA4,0x01, - 0xB0,0x01,0xBC,0x01,0xC8,0x01,0xD4,0x01,0xE0,0x01,0xEC,0x01,0xF8,0x01,0x04,0x02,0x10,0x02, - 0x1C,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4C,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7C,0x02, - 0x88,0x02,0x94,0x02,0xA0,0x02,0xAC,0x02,0xB8,0x02,0xC4,0x02,0xD0,0x02,0xDC,0x02,0xE8,0x02, - 0xF4,0x02,0x00,0x03,0x0C,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3C,0x03,0x48,0x03,0x54,0x03, - 0x60,0x03,0x6C,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9C,0x03,0xA8,0x03,0xB4,0x03,0xC0,0x03, - 0xCC,0x03,0xD8,0x03,0xE4,0x03,0xF0,0x03,0xFC,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2C,0x04, - 0x38,0x04,0x44,0x04,0x50,0x04,0x5C,0x04,0x68,0x04,0x74,0x04, +const int8u mcs11_prop[] = +{ + 11, 2, 32, 128-32, + 0x00,0x00,0x0C,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3C,0x00,0x48,0x00,0x54,0x00,0x60,0x00, + 0x6C,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9C,0x00,0xA8,0x00,0xB4,0x00,0xC0,0x00,0xCC,0x00, + 0xD8,0x00,0xE4,0x00,0xF0,0x00,0xFC,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2C,0x01,0x38,0x01, + 0x44,0x01,0x50,0x01,0x5C,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8C,0x01,0x98,0x01,0xA4,0x01, + 0xB0,0x01,0xBC,0x01,0xC8,0x01,0xD4,0x01,0xE0,0x01,0xEC,0x01,0xF8,0x01,0x04,0x02,0x10,0x02, + 0x1C,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4C,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7C,0x02, + 0x88,0x02,0x94,0x02,0xA0,0x02,0xAC,0x02,0xB8,0x02,0xC4,0x02,0xD0,0x02,0xDC,0x02,0xE8,0x02, + 0xF4,0x02,0x00,0x03,0x0C,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3C,0x03,0x48,0x03,0x54,0x03, + 0x60,0x03,0x6C,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9C,0x03,0xA8,0x03,0xB4,0x03,0xC0,0x03, + 0xCC,0x03,0xD8,0x03,0xE4,0x03,0xF0,0x03,0xFC,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2C,0x04, + 0x38,0x04,0x44,0x04,0x50,0x04,0x5C,0x04,0x68,0x04,0x74,0x04, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, + 4, // 0x21 '!' + 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, - 4, // 0x22 '"' - 0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x22 '"' + 0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x23 '#' - 0x00,0x28,0x28,0x7C,0x28,0x28,0x28,0x7C,0x28,0x28,0x00, + 6, // 0x23 '#' + 0x00,0x28,0x28,0x7C,0x28,0x28,0x28,0x7C,0x28,0x28,0x00, - 6, // 0x24 '$' - 0x10,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x10, + 6, // 0x24 '$' + 0x10,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x10, - 6, // 0x25 '%' - 0x00,0x00,0x68,0xA8,0xD0,0x10,0x20,0x2C,0x54,0x58,0x00, + 6, // 0x25 '%' + 0x00,0x00,0x68,0xA8,0xD0,0x10,0x20,0x2C,0x54,0x58,0x00, - 6, // 0x26 '&' - 0x00,0x20,0x50,0x50,0x50,0x20,0x54,0x54,0x48,0x34,0x00, + 6, // 0x26 '&' + 0x00,0x20,0x50,0x50,0x50,0x20,0x54,0x54,0x48,0x34,0x00, - 3, // 0x27 ''' - 0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x27 ''' + 0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x28 '(' - 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10, + 4, // 0x28 '(' + 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10, - 5, // 0x29 ')' - 0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40, + 5, // 0x29 ')' + 0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40, - 6, // 0x2A '*' - 0x00,0x00,0x28,0x7C,0x38,0x7C,0x28,0x00,0x00,0x00,0x00, + 6, // 0x2A '*' + 0x00,0x00,0x28,0x7C,0x38,0x7C,0x28,0x00,0x00,0x00,0x00, - 6, // 0x2B '+' - 0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, + 6, // 0x2B '+' + 0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, - 4, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0xC0, + 4, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0xC0, - 6, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, - 4, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00, + 4, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00, - 7, // 0x2F '/' - 0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40, + 7, // 0x2F '/' + 0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40, - 6, // 0x30 '0' - 0x00,0x38,0x44,0x44,0x54,0x54,0x54,0x44,0x44,0x38,0x00, + 6, // 0x30 '0' + 0x00,0x38,0x44,0x44,0x54,0x54,0x54,0x44,0x44,0x38,0x00, - 4, // 0x31 '1' - 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 4, // 0x31 '1' + 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, - 6, // 0x32 '2' - 0x00,0x38,0x44,0x44,0x04,0x08,0x10,0x20,0x40,0x7C,0x00, + 6, // 0x32 '2' + 0x00,0x38,0x44,0x44,0x04,0x08,0x10,0x20,0x40,0x7C,0x00, - 6, // 0x33 '3' - 0x00,0x38,0x44,0x04,0x04,0x38,0x04,0x04,0x44,0x38,0x00, + 6, // 0x33 '3' + 0x00,0x38,0x44,0x04,0x04,0x38,0x04,0x04,0x44,0x38,0x00, - 6, // 0x34 '4' - 0x00,0x08,0x18,0x18,0x28,0x28,0x48,0x7C,0x08,0x08,0x00, + 6, // 0x34 '4' + 0x00,0x08,0x18,0x18,0x28,0x28,0x48,0x7C,0x08,0x08,0x00, - 6, // 0x35 '5' - 0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00, + 6, // 0x35 '5' + 0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00, - 6, // 0x36 '6' - 0x00,0x38,0x44,0x40,0x40,0x78,0x44,0x44,0x44,0x38,0x00, + 6, // 0x36 '6' + 0x00,0x38,0x44,0x40,0x40,0x78,0x44,0x44,0x44,0x38,0x00, - 6, // 0x37 '7' - 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x00, + 6, // 0x37 '7' + 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x00, - 6, // 0x38 '8' - 0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00, + 6, // 0x38 '8' + 0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00, - 6, // 0x39 '9' - 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00, + 6, // 0x39 '9' + 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00, - 4, // 0x3A ':' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00, + 4, // 0x3A ':' + 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00, - 4, // 0x3B ';' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0xC0, + 4, // 0x3B ';' + 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0xC0, - 6, // 0x3C '<' - 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00, + 6, // 0x3C '<' + 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00, - 6, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00, + 6, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00, - 6, // 0x3E '>' - 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00, + 6, // 0x3E '>' + 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00, - 6, // 0x3F '?' - 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00, + 6, // 0x3F '?' + 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00, - 6, // 0x40 '@' - 0x00,0x38,0x44,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00, + 6, // 0x40 '@' + 0x00,0x38,0x44,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00, - 6, // 0x41 'A' - 0x00,0x38,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x00, + 6, // 0x41 'A' + 0x00,0x38,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x00, - 6, // 0x42 'B' - 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00, + 6, // 0x42 'B' + 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00, - 6, // 0x43 'C' - 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x40,0x44,0x38,0x00, + 6, // 0x43 'C' + 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x40,0x44,0x38,0x00, - 6, // 0x44 'D' - 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00, + 6, // 0x44 'D' + 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00, - 6, // 0x45 'E' - 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00, + 6, // 0x45 'E' + 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00, - 6, // 0x46 'F' - 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00, + 6, // 0x46 'F' + 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00, - 6, // 0x47 'G' - 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x44,0x4C,0x34,0x00, + 6, // 0x47 'G' + 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x44,0x4C,0x34,0x00, - 6, // 0x48 'H' - 0x00,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00, + 6, // 0x48 'H' + 0x00,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00, - 4, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 4, // 0x49 'I' + 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00, - 6, // 0x4A 'J' - 0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x08,0x48,0x30,0x00, + 6, // 0x4A 'J' + 0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x08,0x48,0x30,0x00, - 6, // 0x4B 'K' - 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x44,0x00, + 6, // 0x4B 'K' + 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x44,0x00, - 6, // 0x4C 'L' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00, + 6, // 0x4C 'L' + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00, - 8, // 0x4D 'M' - 0x00,0x41,0x63,0x55,0x49,0x49,0x41,0x41,0x41,0x41,0x00, + 8, // 0x4D 'M' + 0x00,0x41,0x63,0x55,0x49,0x49,0x41,0x41,0x41,0x41,0x00, - 7, // 0x4E 'N' - 0x00,0x42,0x42,0x62,0x52,0x4A,0x46,0x42,0x42,0x42,0x00, + 7, // 0x4E 'N' + 0x00,0x42,0x42,0x62,0x52,0x4A,0x46,0x42,0x42,0x42,0x00, - 6, // 0x4F 'O' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00, + 6, // 0x4F 'O' + 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00, - 6, // 0x50 'P' - 0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x40,0x00, + 6, // 0x50 'P' + 0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x40,0x00, - 6, // 0x51 'Q' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00, + 6, // 0x51 'Q' + 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00, - 6, // 0x52 'R' - 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x44,0x00, + 6, // 0x52 'R' + 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x44,0x00, - 6, // 0x53 'S' - 0x00,0x38,0x44,0x40,0x40,0x38,0x04,0x04,0x44,0x38,0x00, + 6, // 0x53 'S' + 0x00,0x38,0x44,0x40,0x40,0x38,0x04,0x04,0x44,0x38,0x00, - 6, // 0x54 'T' - 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, + 6, // 0x54 'T' + 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, - 6, // 0x55 'U' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00, + 6, // 0x55 'U' + 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00, - 6, // 0x56 'V' - 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00, + 6, // 0x56 'V' + 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00, - 8, // 0x57 'W' - 0x00,0x41,0x41,0x41,0x41,0x49,0x49,0x49,0x55,0x22,0x00, + 8, // 0x57 'W' + 0x00,0x41,0x41,0x41,0x41,0x49,0x49,0x49,0x55,0x22,0x00, - 6, // 0x58 'X' - 0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00, + 6, // 0x58 'X' + 0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00, - 6, // 0x59 'Y' - 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x10,0x00, + 6, // 0x59 'Y' + 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x10,0x00, - 6, // 0x5A 'Z' - 0x00,0x7C,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00, + 6, // 0x5A 'Z' + 0x00,0x7C,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00, - 5, // 0x5B '[' - 0x30,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x30, + 5, // 0x5B '[' + 0x30,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x30, - 7, // 0x5C '\' - 0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, + 7, // 0x5C '\' + 0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, - 4, // 0x5D ']' - 0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, + 4, // 0x5D ']' + 0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, - 6, // 0x5E '^' - 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x5E '^' + 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00, + 6, // 0x5F '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00, - 4, // 0x60 '`' - 0x00,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x60 '`' + 0x00,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x61 'a' - 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00, + 6, // 0x61 'a' + 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00, - 6, // 0x62 'b' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00, + 6, // 0x62 'b' + 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00, + 6, // 0x63 'c' + 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00, - 6, // 0x64 'd' - 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x00, + 6, // 0x64 'd' + 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x00, - 6, // 0x65 'e' - 0x00,0x00,0x00,0x38,0x44,0x44,0x7C,0x40,0x44,0x38,0x00, + 6, // 0x65 'e' + 0x00,0x00,0x00,0x38,0x44,0x44,0x7C,0x40,0x44,0x38,0x00, - 4, // 0x66 'f' - 0x00,0x10,0x20,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 4, // 0x66 'f' + 0x00,0x10,0x20,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x00, - 6, // 0x67 'g' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x3C,0x04,0x44,0x38, + 6, // 0x67 'g' + 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x3C,0x04,0x44,0x38, - 6, // 0x68 'h' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00, + 6, // 0x68 'h' + 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00, - 2, // 0x69 'i' - 0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, + 2, // 0x69 'i' + 0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, - 3, // 0x6A 'j' - 0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + 3, // 0x6A 'j' + 0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, - 5, // 0x6B 'k' - 0x00,0x40,0x40,0x48,0x50,0x60,0x60,0x50,0x48,0x48,0x00, + 5, // 0x6B 'k' + 0x00,0x40,0x40,0x48,0x50,0x60,0x60,0x50,0x48,0x48,0x00, - 2, // 0x6C 'l' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, + 2, // 0x6C 'l' + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, - 8, // 0x6D 'm' - 0x00,0x00,0x00,0x76,0x49,0x49,0x49,0x49,0x41,0x41,0x00, + 8, // 0x6D 'm' + 0x00,0x00,0x00,0x76,0x49,0x49,0x49,0x49,0x41,0x41,0x00, - 6, // 0x6E 'n' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00, + 6, // 0x6E 'n' + 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00, - 6, // 0x6F 'o' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00, + 6, // 0x6F 'o' + 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00, - 6, // 0x70 'p' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40, + 6, // 0x70 'p' + 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40, - 6, // 0x71 'q' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, + 6, // 0x71 'q' + 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x20,0x20,0x00, + 6, // 0x72 'r' + 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x20,0x20,0x00, - 6, // 0x73 's' - 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00, + 6, // 0x73 's' + 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00, - 5, // 0x74 't' - 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x28,0x10,0x00, + 5, // 0x74 't' + 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x28,0x10,0x00, - 6, // 0x75 'u' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x4C,0x34,0x00, + 6, // 0x75 'u' + 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x4C,0x34,0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00, + 6, // 0x76 'v' + 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00, - 8, // 0x77 'w' - 0x00,0x00,0x00,0x41,0x41,0x41,0x41,0x49,0x49,0x36,0x00, + 8, // 0x77 'w' + 0x00,0x00,0x00,0x41,0x41,0x41,0x41,0x49,0x49,0x36,0x00, - 6, // 0x78 'x' - 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00, + 6, // 0x78 'x' + 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00, - 6, // 0x79 'y' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x3C,0x04,0x08,0x70, + 6, // 0x79 'y' + 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x3C,0x04,0x08,0x70, - 6, // 0x7A 'z' - 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00, + 6, // 0x7A 'z' + 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00, - 5, // 0x7B '{' - 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18, + 5, // 0x7B '{' + 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18, - 3, // 0x7C '|' - 0x00,0x40,0x40,0x40,0x40,0x00,0x40,0x40,0x40,0x40,0x00, + 3, // 0x7C '|' + 0x00,0x40,0x40,0x40,0x40,0x00,0x40,0x40,0x40,0x40,0x00, - 5, // 0x7D '}' - 0xC0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xC0, + 5, // 0x7D '}' + 0xC0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xC0, - 6, // 0x7E '~' - 0x00,0x24,0x54,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x7E '~' + 0x00,0x24,0x54,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x7F '' - 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00, + 6, // 0x7F '' + 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u mcs11_prop_condensed[] = - { - 11, 2, 32, 128-32, - 0x00,0x00,0x0C,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3C,0x00,0x48,0x00,0x54,0x00,0x60,0x00, - 0x6C,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9C,0x00,0xA8,0x00,0xB4,0x00,0xC0,0x00,0xCC,0x00, - 0xD8,0x00,0xE4,0x00,0xF0,0x00,0xFC,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2C,0x01,0x38,0x01, - 0x44,0x01,0x50,0x01,0x5C,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8C,0x01,0x98,0x01,0xA4,0x01, - 0xB0,0x01,0xBC,0x01,0xC8,0x01,0xD4,0x01,0xE0,0x01,0xEC,0x01,0xF8,0x01,0x04,0x02,0x10,0x02, - 0x1C,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4C,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7C,0x02, - 0x88,0x02,0x94,0x02,0xA0,0x02,0xAC,0x02,0xB8,0x02,0xC4,0x02,0xD0,0x02,0xDC,0x02,0xE8,0x02, - 0xF4,0x02,0x00,0x03,0x0C,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3C,0x03,0x48,0x03,0x54,0x03, - 0x60,0x03,0x6C,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9C,0x03,0xA8,0x03,0xB4,0x03,0xC0,0x03, - 0xCC,0x03,0xD8,0x03,0xE4,0x03,0xF0,0x03,0xFC,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2C,0x04, - 0x38,0x04,0x44,0x04,0x50,0x04,0x5C,0x04,0x68,0x04,0x74,0x04, +const int8u mcs11_prop_condensed[] = +{ + 11, 2, 32, 128-32, + 0x00,0x00,0x0C,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3C,0x00,0x48,0x00,0x54,0x00,0x60,0x00, + 0x6C,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9C,0x00,0xA8,0x00,0xB4,0x00,0xC0,0x00,0xCC,0x00, + 0xD8,0x00,0xE4,0x00,0xF0,0x00,0xFC,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2C,0x01,0x38,0x01, + 0x44,0x01,0x50,0x01,0x5C,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8C,0x01,0x98,0x01,0xA4,0x01, + 0xB0,0x01,0xBC,0x01,0xC8,0x01,0xD4,0x01,0xE0,0x01,0xEC,0x01,0xF8,0x01,0x04,0x02,0x10,0x02, + 0x1C,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4C,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7C,0x02, + 0x88,0x02,0x94,0x02,0xA0,0x02,0xAC,0x02,0xB8,0x02,0xC4,0x02,0xD0,0x02,0xDC,0x02,0xE8,0x02, + 0xF4,0x02,0x00,0x03,0x0C,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3C,0x03,0x48,0x03,0x54,0x03, + 0x60,0x03,0x6C,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9C,0x03,0xA8,0x03,0xB4,0x03,0xC0,0x03, + 0xCC,0x03,0xD8,0x03,0xE4,0x03,0xF0,0x03,0xFC,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2C,0x04, + 0x38,0x04,0x44,0x04,0x50,0x04,0x5C,0x04,0x68,0x04,0x74,0x04, - 3, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 3, // 0x21 '!' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x40,0x00, + 3, // 0x21 '!' + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x40,0x00, - 4, // 0x22 '"' - 0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x22 '"' + 0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x23 '#' - 0x00,0x50,0x50,0xF8,0x50,0x50,0x50,0xF8,0x50,0x50,0x00, + 5, // 0x23 '#' + 0x00,0x50,0x50,0xF8,0x50,0x50,0x50,0xF8,0x50,0x50,0x00, - 5, // 0x24 '$' - 0x00,0x40,0x60,0x90,0x80,0x60,0x10,0x90,0x60,0x20,0x00, + 5, // 0x24 '$' + 0x00,0x40,0x60,0x90,0x80,0x60,0x10,0x90,0x60,0x20,0x00, - 5, // 0x25 '%' - 0x00,0x00,0x90,0x90,0x20,0x20,0x40,0x40,0x90,0x90,0x00, + 5, // 0x25 '%' + 0x00,0x00,0x90,0x90,0x20,0x20,0x40,0x40,0x90,0x90,0x00, - 5, // 0x26 '&' - 0x00,0x40,0xA0,0xA0,0xA0,0x40,0xA8,0x90,0x90,0x68,0x00, + 5, // 0x26 '&' + 0x00,0x40,0xA0,0xA0,0xA0,0x40,0xA8,0x90,0x90,0x68,0x00, - 5, // 0x27 ''' - 0x00,0x00,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x27 ''' + 0x00,0x00,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x28 '(' - 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10, + 5, // 0x28 '(' + 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10, - 4, // 0x29 ')' - 0x80,0x40,0x40,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, + 4, // 0x29 ')' + 0x80,0x40,0x40,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, - 5, // 0x2A '*' - 0x00,0x00,0x90,0x60,0xF0,0x60,0x90,0x00,0x00,0x00,0x00, + 5, // 0x2A '*' + 0x00,0x00,0x90,0x60,0xF0,0x60,0x90,0x00,0x00,0x00,0x00, - 5, // 0x2B '+' - 0x00,0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00,0x00, + 5, // 0x2B '+' + 0x00,0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00,0x00, - 4, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0xC0, + 4, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0xC0, - 5, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00, + 5, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00, - 4, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00, + 4, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00, - 6, // 0x2F '/' - 0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, + 6, // 0x2F '/' + 0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, - 5, // 0x30 '0' - 0x00,0x70,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00, + 5, // 0x30 '0' + 0x00,0x70,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00, - 3, // 0x31 '1' - 0x00,0x40,0xC0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, + 3, // 0x31 '1' + 0x00,0x40,0xC0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, - 5, // 0x32 '2' - 0x00,0x60,0x90,0x90,0x10,0x10,0x20,0x40,0x80,0xF0,0x00, + 5, // 0x32 '2' + 0x00,0x60,0x90,0x90,0x10,0x10,0x20,0x40,0x80,0xF0,0x00, - 5, // 0x33 '3' - 0x00,0x60,0x90,0x10,0x10,0x60,0x10,0x10,0x90,0x60,0x00, + 5, // 0x33 '3' + 0x00,0x60,0x90,0x10,0x10,0x60,0x10,0x10,0x90,0x60,0x00, - 5, // 0x34 '4' - 0x00,0x10,0x30,0x30,0x50,0x50,0x90,0xF0,0x10,0x10,0x00, + 5, // 0x34 '4' + 0x00,0x10,0x30,0x30,0x50,0x50,0x90,0xF0,0x10,0x10,0x00, - 5, // 0x35 '5' - 0x00,0xF0,0x80,0x80,0xE0,0x90,0x10,0x10,0x90,0x60,0x00, + 5, // 0x35 '5' + 0x00,0xF0,0x80,0x80,0xE0,0x90,0x10,0x10,0x90,0x60,0x00, - 5, // 0x36 '6' - 0x00,0x60,0x90,0x80,0x80,0xE0,0x90,0x90,0x90,0x60,0x00, + 5, // 0x36 '6' + 0x00,0x60,0x90,0x80,0x80,0xE0,0x90,0x90,0x90,0x60,0x00, - 5, // 0x37 '7' - 0x00,0xF0,0x10,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x00, + 5, // 0x37 '7' + 0x00,0xF0,0x10,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x00, - 5, // 0x38 '8' - 0x00,0x60,0x90,0x90,0x90,0x60,0x90,0x90,0x90,0x60,0x00, + 5, // 0x38 '8' + 0x00,0x60,0x90,0x90,0x90,0x60,0x90,0x90,0x90,0x60,0x00, - 5, // 0x39 '9' - 0x00,0x60,0x90,0x90,0x90,0x70,0x10,0x10,0x90,0x60,0x00, + 5, // 0x39 '9' + 0x00,0x60,0x90,0x90,0x90,0x70,0x10,0x10,0x90,0x60,0x00, - 4, // 0x3A ':' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00, + 4, // 0x3A ':' + 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00, - 4, // 0x3B ';' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0xC0, + 4, // 0x3B ';' + 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0xC0, - 6, // 0x3C '<' - 0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x00, + 6, // 0x3C '<' + 0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x00, - 5, // 0x3D '=' - 0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0x00, + 5, // 0x3D '=' + 0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0x00, - 6, // 0x3E '>' - 0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80,0x00, + 6, // 0x3E '>' + 0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80,0x00, - 5, // 0x3F '?' - 0x00,0x60,0x90,0x10,0x10,0x20,0x40,0x00,0x40,0x00,0x00, + 5, // 0x3F '?' + 0x00,0x60,0x90,0x10,0x10,0x20,0x40,0x00,0x40,0x00,0x00, - 5, // 0x40 '@' - 0x00,0x60,0x90,0x90,0xB0,0xB0,0xB0,0x80,0x80,0x70,0x00, + 5, // 0x40 '@' + 0x00,0x60,0x90,0x90,0xB0,0xB0,0xB0,0x80,0x80,0x70,0x00, - 5, // 0x41 'A' - 0x00,0x60,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x90,0x00, + 5, // 0x41 'A' + 0x00,0x60,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x90,0x00, - 5, // 0x42 'B' - 0x00,0xE0,0x90,0x90,0x90,0xE0,0x90,0x90,0x90,0xE0,0x00, + 5, // 0x42 'B' + 0x00,0xE0,0x90,0x90,0x90,0xE0,0x90,0x90,0x90,0xE0,0x00, - 5, // 0x43 'C' - 0x00,0x60,0x90,0x80,0x80,0x80,0x80,0x80,0x90,0x60,0x00, + 5, // 0x43 'C' + 0x00,0x60,0x90,0x80,0x80,0x80,0x80,0x80,0x90,0x60,0x00, - 5, // 0x44 'D' - 0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00, + 5, // 0x44 'D' + 0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00, - 5, // 0x45 'E' - 0x00,0xF0,0x80,0x80,0x80,0xF0,0x80,0x80,0x80,0xF0,0x00, + 5, // 0x45 'E' + 0x00,0xF0,0x80,0x80,0x80,0xF0,0x80,0x80,0x80,0xF0,0x00, - 5, // 0x46 'F' - 0x00,0xF0,0x80,0x80,0x80,0xF0,0x80,0x80,0x80,0x80,0x00, + 5, // 0x46 'F' + 0x00,0xF0,0x80,0x80,0x80,0xF0,0x80,0x80,0x80,0x80,0x00, - 5, // 0x47 'G' - 0x00,0x70,0x80,0x80,0x80,0xB0,0x90,0x90,0x90,0x60,0x00, + 5, // 0x47 'G' + 0x00,0x70,0x80,0x80,0x80,0xB0,0x90,0x90,0x90,0x60,0x00, - 5, // 0x48 'H' - 0x00,0x90,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x90,0x00, + 5, // 0x48 'H' + 0x00,0x90,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x90,0x00, - 4, // 0x49 'I' - 0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xE0,0x00, + 4, // 0x49 'I' + 0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xE0,0x00, - 5, // 0x4A 'J' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0xA0,0xA0,0x40,0x00, + 5, // 0x4A 'J' + 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0xA0,0xA0,0x40,0x00, - 5, // 0x4B 'K' - 0x00,0x90,0x90,0xA0,0xA0,0xC0,0xA0,0xA0,0x90,0x90,0x00, + 5, // 0x4B 'K' + 0x00,0x90,0x90,0xA0,0xA0,0xC0,0xA0,0xA0,0x90,0x90,0x00, - 5, // 0x4C 'L' - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xF0,0x00, + 5, // 0x4C 'L' + 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xF0,0x00, - 6, // 0x4D 'M' - 0x00,0x88,0xD8,0xA8,0xA8,0xA8,0x88,0x88,0x88,0x88,0x00, + 6, // 0x4D 'M' + 0x00,0x88,0xD8,0xA8,0xA8,0xA8,0x88,0x88,0x88,0x88,0x00, - 5, // 0x4E 'N' - 0x00,0x90,0x90,0xD0,0xD0,0xB0,0xB0,0x90,0x90,0x90,0x00, + 5, // 0x4E 'N' + 0x00,0x90,0x90,0xD0,0xD0,0xB0,0xB0,0x90,0x90,0x90,0x00, - 5, // 0x4F 'O' - 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x4F 'O' + 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, - 5, // 0x50 'P' - 0x00,0xE0,0x90,0x90,0x90,0x90,0xE0,0x80,0x80,0x80,0x00, + 5, // 0x50 'P' + 0x00,0xE0,0x90,0x90,0x90,0x90,0xE0,0x80,0x80,0x80,0x00, - 5, // 0x51 'Q' - 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x30, + 5, // 0x51 'Q' + 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x30, - 5, // 0x52 'R' - 0x00,0xE0,0x90,0x90,0x90,0x90,0xE0,0xA0,0x90,0x90,0x00, + 5, // 0x52 'R' + 0x00,0xE0,0x90,0x90,0x90,0x90,0xE0,0xA0,0x90,0x90,0x00, - 5, // 0x53 'S' - 0x00,0x60,0x90,0x80,0x80,0x60,0x10,0x10,0x90,0x60,0x00, + 5, // 0x53 'S' + 0x00,0x60,0x90,0x80,0x80,0x60,0x10,0x10,0x90,0x60,0x00, - 6, // 0x54 'T' - 0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 6, // 0x54 'T' + 0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, - 5, // 0x55 'U' - 0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x55 'U' + 0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, - 6, // 0x56 'V' - 0x00,0x88,0x88,0x88,0x88,0x50,0x50,0x50,0x20,0x20,0x00, + 6, // 0x56 'V' + 0x00,0x88,0x88,0x88,0x88,0x50,0x50,0x50,0x20,0x20,0x00, - 6, // 0x57 'W' - 0x00,0x88,0x88,0x88,0xA8,0xA8,0xA8,0xA8,0xA8,0x50,0x00, + 6, // 0x57 'W' + 0x00,0x88,0x88,0x88,0xA8,0xA8,0xA8,0xA8,0xA8,0x50,0x00, - 5, // 0x58 'X' - 0x00,0x90,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x90,0x00, + 5, // 0x58 'X' + 0x00,0x90,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x90,0x00, - 6, // 0x59 'Y' - 0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x20,0x00, + 6, // 0x59 'Y' + 0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x20,0x00, - 5, // 0x5A 'Z' - 0x00,0xF0,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0xF0,0x00, + 5, // 0x5A 'Z' + 0x00,0xF0,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0xF0,0x00, - 4, // 0x5B '[' - 0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x60,0x00, + 4, // 0x5B '[' + 0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x60,0x00, - 6, // 0x5C '\' - 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, + 6, // 0x5C '\' + 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, - 4, // 0x5D ']' - 0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60,0x00, + 4, // 0x5D ']' + 0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60,0x00, - 5, // 0x5E '^' - 0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x5E '^' + 0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00, + 5, // 0x5F '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00, - 5, // 0x60 '`' - 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x60 '`' + 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x61 'a' - 0x00,0x00,0x00,0x60,0x90,0x10,0x70,0x90,0x90,0x70,0x00, + 5, // 0x61 'a' + 0x00,0x00,0x00,0x60,0x90,0x10,0x70,0x90,0x90,0x70,0x00, - 5, // 0x62 'b' - 0x00,0x80,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0xE0,0x00, + 5, // 0x62 'b' + 0x00,0x80,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0xE0,0x00, - 5, // 0x63 'c' - 0x00,0x00,0x00,0x60,0x90,0x80,0x80,0x80,0x90,0x60,0x00, + 5, // 0x63 'c' + 0x00,0x00,0x00,0x60,0x90,0x80,0x80,0x80,0x90,0x60,0x00, - 5, // 0x64 'd' - 0x00,0x10,0x10,0x10,0x70,0x90,0x90,0x90,0x90,0x70,0x00, + 5, // 0x64 'd' + 0x00,0x10,0x10,0x10,0x70,0x90,0x90,0x90,0x90,0x70,0x00, - 5, // 0x65 'e' - 0x00,0x00,0x00,0x60,0x90,0x90,0xF0,0x80,0x90,0x60,0x00, + 5, // 0x65 'e' + 0x00,0x00,0x00,0x60,0x90,0x90,0xF0,0x80,0x90,0x60,0x00, - 4, // 0x66 'f' - 0x00,0x20,0x40,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x00, + 4, // 0x66 'f' + 0x00,0x20,0x40,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x00, - 5, // 0x67 'g' - 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0x90,0x60, + 5, // 0x67 'g' + 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0x90,0x60, - 5, // 0x68 'h' - 0x00,0x80,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0x90,0x00, + 5, // 0x68 'h' + 0x00,0x80,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0x90,0x00, - 2, // 0x69 'i' - 0x00,0x80,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, + 2, // 0x69 'i' + 0x00,0x80,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, - 4, // 0x6A 'j' - 0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + 4, // 0x6A 'j' + 0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, - 5, // 0x6B 'k' - 0x00,0x80,0x80,0x90,0x90,0xA0,0xC0,0xA0,0x90,0x90,0x00, + 5, // 0x6B 'k' + 0x00,0x80,0x80,0x90,0x90,0xA0,0xC0,0xA0,0x90,0x90,0x00, - 2, // 0x6C 'l' - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, + 2, // 0x6C 'l' + 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, - 6, // 0x6D 'm' - 0x00,0x00,0x00,0xD0,0xA8,0xA8,0xA8,0x88,0x88,0x88,0x00, + 6, // 0x6D 'm' + 0x00,0x00,0x00,0xD0,0xA8,0xA8,0xA8,0x88,0x88,0x88,0x00, - 5, // 0x6E 'n' - 0x00,0x00,0x00,0xA0,0xD0,0x90,0x90,0x90,0x90,0x90,0x00, + 5, // 0x6E 'n' + 0x00,0x00,0x00,0xA0,0xD0,0x90,0x90,0x90,0x90,0x90,0x00, - 5, // 0x6F 'o' - 0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x6F 'o' + 0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x60,0x00, - 5, // 0x70 'p' - 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0xE0,0x80,0x80, + 5, // 0x70 'p' + 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0xE0,0x80,0x80, - 5, // 0x71 'q' - 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x90,0x70,0x10,0x10, + 5, // 0x71 'q' + 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x90,0x70,0x10,0x10, - 6, // 0x72 'r' - 0x00,0x00,0x00,0xB8,0x48,0x40,0x40,0x40,0x40,0x40,0x00, + 6, // 0x72 'r' + 0x00,0x00,0x00,0xB8,0x48,0x40,0x40,0x40,0x40,0x40,0x00, - 5, // 0x73 's' - 0x00,0x00,0x00,0x60,0x90,0x40,0x20,0x10,0x90,0x60,0x00, + 5, // 0x73 's' + 0x00,0x00,0x00,0x60,0x90,0x40,0x20,0x10,0x90,0x60,0x00, - 4, // 0x74 't' - 0x00,0x40,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x20,0x00, + 4, // 0x74 't' + 0x00,0x40,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x20,0x00, - 5, // 0x75 'u' - 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x70,0x00, + 5, // 0x75 'u' + 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x70,0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x00, + 6, // 0x76 'v' + 0x00,0x00,0x00,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x00, - 6, // 0x77 'w' - 0x00,0x00,0x00,0x88,0x88,0x88,0xA8,0xA8,0xA8,0x50,0x00, + 6, // 0x77 'w' + 0x00,0x00,0x00,0x88,0x88,0x88,0xA8,0xA8,0xA8,0x50,0x00, - 5, // 0x78 'x' - 0x00,0x00,0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x00, + 5, // 0x78 'x' + 0x00,0x00,0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x00, - 5, // 0x79 'y' - 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x70,0x10,0x20,0xC0, + 5, // 0x79 'y' + 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x70,0x10,0x20,0xC0, - 5, // 0x7A 'z' - 0x00,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0x80,0xF0,0x00, + 5, // 0x7A 'z' + 0x00,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0x80,0xF0,0x00, - 5, // 0x7B '{' - 0x30,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x40,0x30, + 5, // 0x7B '{' + 0x30,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x40,0x30, - 3, // 0x7C '|' - 0x00,0x40,0x40,0x40,0x40,0x00,0x40,0x40,0x40,0x40,0x00, + 3, // 0x7C '|' + 0x00,0x40,0x40,0x40,0x40,0x00,0x40,0x40,0x40,0x40,0x00, - 5, // 0x7D '}' - 0xC0,0x20,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0xC0, + 5, // 0x7D '}' + 0xC0,0x20,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0xC0, - 5, // 0x7E '~' - 0x00,0x40,0xA8,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x7E '~' + 0x00,0x40,0xA8,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x7F '' - 0x00,0x20,0x70,0xD8,0x88,0x88,0xF8,0x00,0x00,0x00,0x00, + 5, // 0x7F '' + 0x00,0x20,0x70,0xD8,0x88,0x88,0xF8,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u mcs12_prop[] = - { - 12, 3, 32, 128-32, - 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x4E,0x00,0x5B,0x00,0x68,0x00, - 0x75,0x00,0x82,0x00,0x8F,0x00,0x9C,0x00,0xA9,0x00,0xB6,0x00,0xC3,0x00,0xD0,0x00,0xDD,0x00, - 0xEA,0x00,0xF7,0x00,0x04,0x01,0x11,0x01,0x1E,0x01,0x2B,0x01,0x38,0x01,0x45,0x01,0x52,0x01, - 0x5F,0x01,0x6C,0x01,0x79,0x01,0x86,0x01,0x93,0x01,0xA0,0x01,0xAD,0x01,0xBA,0x01,0xC7,0x01, - 0xD4,0x01,0xE1,0x01,0xEE,0x01,0xFB,0x01,0x08,0x02,0x15,0x02,0x22,0x02,0x2F,0x02,0x3C,0x02, - 0x49,0x02,0x62,0x02,0x6F,0x02,0x7C,0x02,0x89,0x02,0x96,0x02,0xA3,0x02,0xB0,0x02,0xBD,0x02, - 0xCA,0x02,0xD7,0x02,0xF0,0x02,0xFD,0x02,0x0A,0x03,0x17,0x03,0x24,0x03,0x31,0x03,0x3E,0x03, - 0x4B,0x03,0x58,0x03,0x65,0x03,0x72,0x03,0x7F,0x03,0x8C,0x03,0x99,0x03,0xA6,0x03,0xB3,0x03, - 0xC0,0x03,0xCD,0x03,0xDA,0x03,0xE7,0x03,0xF4,0x03,0x01,0x04,0x1A,0x04,0x27,0x04,0x34,0x04, - 0x41,0x04,0x4E,0x04,0x5B,0x04,0x68,0x04,0x75,0x04,0x82,0x04,0x8F,0x04,0xA8,0x04,0xB5,0x04, - 0xC2,0x04,0xCF,0x04,0xDC,0x04,0xE9,0x04,0xF6,0x04,0x03,0x05, +const int8u mcs12_prop[] = +{ + 12, 3, 32, 128-32, + 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x4E,0x00,0x5B,0x00,0x68,0x00, + 0x75,0x00,0x82,0x00,0x8F,0x00,0x9C,0x00,0xA9,0x00,0xB6,0x00,0xC3,0x00,0xD0,0x00,0xDD,0x00, + 0xEA,0x00,0xF7,0x00,0x04,0x01,0x11,0x01,0x1E,0x01,0x2B,0x01,0x38,0x01,0x45,0x01,0x52,0x01, + 0x5F,0x01,0x6C,0x01,0x79,0x01,0x86,0x01,0x93,0x01,0xA0,0x01,0xAD,0x01,0xBA,0x01,0xC7,0x01, + 0xD4,0x01,0xE1,0x01,0xEE,0x01,0xFB,0x01,0x08,0x02,0x15,0x02,0x22,0x02,0x2F,0x02,0x3C,0x02, + 0x49,0x02,0x62,0x02,0x6F,0x02,0x7C,0x02,0x89,0x02,0x96,0x02,0xA3,0x02,0xB0,0x02,0xBD,0x02, + 0xCA,0x02,0xD7,0x02,0xF0,0x02,0xFD,0x02,0x0A,0x03,0x17,0x03,0x24,0x03,0x31,0x03,0x3E,0x03, + 0x4B,0x03,0x58,0x03,0x65,0x03,0x72,0x03,0x7F,0x03,0x8C,0x03,0x99,0x03,0xA6,0x03,0xB3,0x03, + 0xC0,0x03,0xCD,0x03,0xDA,0x03,0xE7,0x03,0xF4,0x03,0x01,0x04,0x1A,0x04,0x27,0x04,0x34,0x04, + 0x41,0x04,0x4E,0x04,0x5B,0x04,0x68,0x04,0x75,0x04,0x82,0x04,0x8F,0x04,0xA8,0x04,0xB5,0x04, + 0xC2,0x04,0xCF,0x04,0xDC,0x04,0xE9,0x04,0xF6,0x04,0x03,0x05, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, + 4, // 0x21 '!' + 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, - 4, // 0x22 '"' - 0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x22 '"' + 0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x23 '#' - 0x28,0x28,0x28,0x7C,0x28,0x28,0x28,0x7C,0x28,0x28,0x28,0x00, + 6, // 0x23 '#' + 0x28,0x28,0x28,0x7C,0x28,0x28,0x28,0x7C,0x28,0x28,0x28,0x00, - 6, // 0x24 '$' - 0x10,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x10,0x00, + 6, // 0x24 '$' + 0x10,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x10,0x00, - 7, // 0x25 '%' - 0x32,0x54,0x64,0x08,0x08,0x10,0x10,0x26,0x2A,0x4C,0x00,0x00, + 7, // 0x25 '%' + 0x32,0x54,0x64,0x08,0x08,0x10,0x10,0x26,0x2A,0x4C,0x00,0x00, - 7, // 0x26 '&' - 0x00,0x30,0x48,0x48,0x48,0x30,0x4A,0x4A,0x44,0x3A,0x00,0x00, + 7, // 0x26 '&' + 0x00,0x30,0x48,0x48,0x48,0x30,0x4A,0x4A,0x44,0x3A,0x00,0x00, - 3, // 0x27 ''' - 0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x27 ''' + 0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x28 '(' - 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x00, + 5, // 0x28 '(' + 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x00, - 5, // 0x29 ')' - 0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x00, + 5, // 0x29 ')' + 0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x00, - 6, // 0x2A '*' - 0x00,0x00,0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x00, + 6, // 0x2A '*' + 0x00,0x00,0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x00, - 6, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, + 6, // 0x2B '+' + 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, - 4, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x40,0x80, + 4, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x40,0x80, - 6, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, - 4, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00, + 4, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00, - 7, // 0x2F '/' - 0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00, + 7, // 0x2F '/' + 0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00, - 7, // 0x30 '0' - 0x00,0x38,0x44,0x44,0x54,0x54,0x54,0x44,0x44,0x38,0x00,0x00, + 7, // 0x30 '0' + 0x00,0x38,0x44,0x44,0x54,0x54,0x54,0x44,0x44,0x38,0x00,0x00, - 4, // 0x31 '1' - 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00, + 4, // 0x31 '1' + 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00, - 7, // 0x32 '2' - 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 7, // 0x32 '2' + 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, - 7, // 0x33 '3' - 0x00,0x38,0x44,0x04,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x33 '3' + 0x00,0x38,0x44,0x04,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00, - 6, // 0x34 '4' - 0x00,0x08,0x18,0x28,0x28,0x48,0x48,0x7C,0x08,0x08,0x00,0x00, + 6, // 0x34 '4' + 0x00,0x08,0x18,0x28,0x28,0x48,0x48,0x7C,0x08,0x08,0x00,0x00, - 7, // 0x35 '5' - 0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x35 '5' + 0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00, - 7, // 0x36 '6' - 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x36 '6' + 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 6, // 0x37 '7' - 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x00,0x00, + 6, // 0x37 '7' + 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x00,0x00, - 7, // 0x38 '8' - 0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x38 '8' + 0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x39 '9' - 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x39 '9' + 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00,0x00, - 4, // 0x3A ':' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00,0x00, + 4, // 0x3A ':' + 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00,0x00, - 4, // 0x3B ';' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x40,0x80, + 4, // 0x3B ';' + 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x40,0x80, - 6, // 0x3C '<' - 0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00, + 6, // 0x3C '<' + 0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00, - 6, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00, + 6, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00, - 6, // 0x3E '>' - 0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00, + 6, // 0x3E '>' + 0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00, - 6, // 0x3F '?' - 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, + 6, // 0x3F '?' + 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, - 7, // 0x40 '@' - 0x00,0x38,0x44,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00,0x00, + 7, // 0x40 '@' + 0x00,0x38,0x44,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00,0x00, - 7, // 0x41 'A' - 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x41 'A' + 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, - 7, // 0x42 'B' - 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00, + 7, // 0x42 'B' + 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00, - 6, // 0x43 'C' - 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00, + 6, // 0x43 'C' + 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00, - 7, // 0x44 'D' - 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00, + 7, // 0x44 'D' + 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00, - 6, // 0x45 'E' - 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x45 'E' + 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00, - 6, // 0x46 'F' - 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00, + 6, // 0x46 'F' + 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00, - 7, // 0x47 'G' - 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x44,0x4C,0x34,0x00,0x00, + 7, // 0x47 'G' + 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x44,0x4C,0x34,0x00,0x00, - 7, // 0x48 'H' - 0x00,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x48 'H' + 0x00,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, - 5, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 5, // 0x49 'I' + 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, - 6, // 0x4A 'J' - 0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00, + 6, // 0x4A 'J' + 0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00, - 6, // 0x4B 'K' - 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x44,0x00,0x00, + 6, // 0x4B 'K' + 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x44,0x00,0x00, - 6, // 0x4C 'L' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x4C 'L' + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, - 9, // 0x4D 'M' - 0x00,0x00,0x41,0x00,0x63,0x00,0x55,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4D 'M' + 0x00,0x00,0x41,0x00,0x63,0x00,0x55,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00, - 7, // 0x4E 'N' - 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x44,0x00,0x00, + 7, // 0x4E 'N' + 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x44,0x00,0x00, - 7, // 0x4F 'O' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x4F 'O' + 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x50 'P' - 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, + 7, // 0x50 'P' + 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, - 7, // 0x51 'Q' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, + 7, // 0x51 'Q' + 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, - 7, // 0x52 'R' - 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00, + 7, // 0x52 'R' + 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00, - 7, // 0x53 'S' - 0x00,0x38,0x44,0x40,0x40,0x38,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x53 'S' + 0x00,0x38,0x44,0x40,0x40,0x38,0x04,0x04,0x44,0x38,0x00,0x00, - 6, // 0x54 'T' - 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 6, // 0x54 'T' + 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, - 7, // 0x55 'U' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x55 'U' + 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 6, // 0x56 'V' - 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, + 6, // 0x56 'V' + 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, - 9, // 0x57 'W' - 0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x55,0x00,0x22,0x00,0x00,0x00,0x00,0x00, + 9, // 0x57 'W' + 0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x55,0x00,0x22,0x00,0x00,0x00,0x00,0x00, - 7, // 0x58 'X' - 0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00, + 7, // 0x58 'X' + 0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00, - 7, // 0x59 'Y' - 0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x59 'Y' + 0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00, - 6, // 0x5A 'Z' - 0x00,0x7C,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x5A 'Z' + 0x00,0x7C,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00, - 4, // 0x5B '[' - 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00, + 4, // 0x5B '[' + 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00, - 7, // 0x5C '\' - 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, + 7, // 0x5C '\' + 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, - 4, // 0x5D ']' - 0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xE0,0x00, + 4, // 0x5D ']' + 0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xE0,0x00, - 6, // 0x5E '^' - 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x5E '^' + 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00, + 6, // 0x5F '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00, - 4, // 0x60 '`' - 0x00,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x60 '`' + 0x00,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00,0x00, + 7, // 0x61 'a' + 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00,0x00, - 7, // 0x62 'b' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00, + 7, // 0x62 'b' + 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00, + 6, // 0x63 'c' + 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00, - 7, // 0x64 'd' - 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, + 7, // 0x64 'd' + 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x38,0x44,0x44,0x7C,0x40,0x44,0x38,0x00,0x00, + 7, // 0x65 'e' + 0x00,0x00,0x00,0x38,0x44,0x44,0x7C,0x40,0x44,0x38,0x00,0x00, - 4, // 0x66 'f' - 0x00,0x30,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 4, // 0x66 'f' + 0x00,0x30,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x78, + 7, // 0x67 'g' + 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x78, - 7, // 0x68 'h' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x68 'h' + 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00, - 3, // 0x69 'i' - 0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x69 'i' + 0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, - 5, // 0x6A 'j' - 0x00,0x10,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x60, + 5, // 0x6A 'j' + 0x00,0x10,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x60, - 6, // 0x6B 'k' - 0x00,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, + 6, // 0x6B 'k' + 0x00,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, - 3, // 0x6C 'l' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x6C 'l' + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, - 9, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6D 'm' + 0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00, - 7, // 0x6E 'n' - 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x6E 'n' + 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0x00,0x00, - 7, // 0x6F 'o' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x6F 'o' + 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x40,0x40, + 7, // 0x70 'p' + 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x40,0x40, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, + 7, // 0x71 'q' + 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 6, // 0x72 'r' + 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x20,0x70,0x00,0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00, + 7, // 0x73 's' + 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00, - 5, // 0x74 't' - 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x20,0x18,0x00,0x00, + 5, // 0x74 't' + 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x20,0x18,0x00,0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00, + 7, // 0x75 'u' + 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, + 6, // 0x76 'v' + 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, - 9, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x36,0x00,0x00,0x00,0x00,0x00, + 9, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x36,0x00,0x00,0x00,0x00,0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, + 7, // 0x78 'x' + 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3C,0x08,0x70, + 7, // 0x79 'y' + 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3C,0x08,0x70, - 6, // 0x7A 'z' - 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 6, // 0x7A 'z' + 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, - 5, // 0x7B '{' - 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00, + 5, // 0x7B '{' + 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00, - 3, // 0x7C '|' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, + 3, // 0x7C '|' + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, - 5, // 0x7D '}' - 0xC0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xC0,0x00, + 5, // 0x7D '}' + 0xC0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xC0,0x00, - 7, // 0x7E '~' - 0x00,0x60,0x92,0x92,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7E '~' + 0x00,0x60,0x92,0x92,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x7F '' - 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7F '' + 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u mcs13_prop[] = - { - 13, 4, 32, 128-32, - 0x00,0x00,0x0E,0x00,0x1C,0x00,0x2A,0x00,0x38,0x00,0x46,0x00,0x54,0x00,0x62,0x00,0x70,0x00, - 0x7E,0x00,0x8C,0x00,0x9A,0x00,0xA8,0x00,0xB6,0x00,0xC4,0x00,0xD2,0x00,0xE0,0x00,0xEE,0x00, - 0xFC,0x00,0x0A,0x01,0x18,0x01,0x26,0x01,0x34,0x01,0x42,0x01,0x50,0x01,0x5E,0x01,0x6C,0x01, - 0x7A,0x01,0x88,0x01,0x96,0x01,0xA4,0x01,0xB2,0x01,0xC0,0x01,0xCE,0x01,0xDC,0x01,0xEA,0x01, - 0xF8,0x01,0x06,0x02,0x14,0x02,0x22,0x02,0x30,0x02,0x3E,0x02,0x4C,0x02,0x5A,0x02,0x68,0x02, - 0x76,0x02,0x91,0x02,0x9F,0x02,0xAD,0x02,0xBB,0x02,0xC9,0x02,0xD7,0x02,0xE5,0x02,0xF3,0x02, - 0x01,0x03,0x0F,0x03,0x2A,0x03,0x38,0x03,0x46,0x03,0x54,0x03,0x62,0x03,0x70,0x03,0x7E,0x03, - 0x8C,0x03,0x9A,0x03,0xA8,0x03,0xB6,0x03,0xC4,0x03,0xD2,0x03,0xE0,0x03,0xEE,0x03,0xFC,0x03, - 0x0A,0x04,0x18,0x04,0x26,0x04,0x34,0x04,0x42,0x04,0x50,0x04,0x6B,0x04,0x79,0x04,0x87,0x04, - 0x95,0x04,0xA3,0x04,0xB1,0x04,0xBF,0x04,0xCD,0x04,0xDB,0x04,0xE9,0x04,0x04,0x05,0x12,0x05, - 0x20,0x05,0x2E,0x05,0x3C,0x05,0x4A,0x05,0x58,0x05,0x66,0x05, +const int8u mcs13_prop[] = +{ + 13, 4, 32, 128-32, + 0x00,0x00,0x0E,0x00,0x1C,0x00,0x2A,0x00,0x38,0x00,0x46,0x00,0x54,0x00,0x62,0x00,0x70,0x00, + 0x7E,0x00,0x8C,0x00,0x9A,0x00,0xA8,0x00,0xB6,0x00,0xC4,0x00,0xD2,0x00,0xE0,0x00,0xEE,0x00, + 0xFC,0x00,0x0A,0x01,0x18,0x01,0x26,0x01,0x34,0x01,0x42,0x01,0x50,0x01,0x5E,0x01,0x6C,0x01, + 0x7A,0x01,0x88,0x01,0x96,0x01,0xA4,0x01,0xB2,0x01,0xC0,0x01,0xCE,0x01,0xDC,0x01,0xEA,0x01, + 0xF8,0x01,0x06,0x02,0x14,0x02,0x22,0x02,0x30,0x02,0x3E,0x02,0x4C,0x02,0x5A,0x02,0x68,0x02, + 0x76,0x02,0x91,0x02,0x9F,0x02,0xAD,0x02,0xBB,0x02,0xC9,0x02,0xD7,0x02,0xE5,0x02,0xF3,0x02, + 0x01,0x03,0x0F,0x03,0x2A,0x03,0x38,0x03,0x46,0x03,0x54,0x03,0x62,0x03,0x70,0x03,0x7E,0x03, + 0x8C,0x03,0x9A,0x03,0xA8,0x03,0xB6,0x03,0xC4,0x03,0xD2,0x03,0xE0,0x03,0xEE,0x03,0xFC,0x03, + 0x0A,0x04,0x18,0x04,0x26,0x04,0x34,0x04,0x42,0x04,0x50,0x04,0x6B,0x04,0x79,0x04,0x87,0x04, + 0x95,0x04,0xA3,0x04,0xB1,0x04,0xBF,0x04,0xCD,0x04,0xDB,0x04,0xE9,0x04,0x04,0x05,0x12,0x05, + 0x20,0x05,0x2E,0x05,0x3C,0x05,0x4A,0x05,0x58,0x05,0x66,0x05, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, + 4, // 0x21 '!' + 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, - 4, // 0x22 '"' - 0x00,0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x22 '"' + 0x00,0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x23 '#' - 0x00,0x28,0x28,0x28,0x7C,0x28,0x28,0x28,0x7C,0x28,0x28,0x28,0x00, + 6, // 0x23 '#' + 0x00,0x28,0x28,0x28,0x7C,0x28,0x28,0x28,0x7C,0x28,0x28,0x28,0x00, - 6, // 0x24 '$' - 0x00,0x10,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x10,0x00, + 6, // 0x24 '$' + 0x00,0x10,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x10,0x00, - 7, // 0x25 '%' - 0x00,0x32,0x54,0x64,0x08,0x08,0x10,0x10,0x26,0x2A,0x4C,0x00,0x00, + 7, // 0x25 '%' + 0x00,0x32,0x54,0x64,0x08,0x08,0x10,0x10,0x26,0x2A,0x4C,0x00,0x00, - 7, // 0x26 '&' - 0x00,0x30,0x48,0x48,0x48,0x30,0x4A,0x4A,0x44,0x3A,0x00,0x00,0x00, + 7, // 0x26 '&' + 0x00,0x30,0x48,0x48,0x48,0x30,0x4A,0x4A,0x44,0x3A,0x00,0x00,0x00, - 3, // 0x27 ''' - 0x00,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x27 ''' + 0x00,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x28 '(' - 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x00,0x00, + 5, // 0x28 '(' + 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x00,0x00, - 5, // 0x29 ')' - 0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x00,0x00, + 5, // 0x29 ')' + 0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x00,0x00, - 6, // 0x2A '*' - 0x00,0x00,0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x00,0x00, + 6, // 0x2A '*' + 0x00,0x00,0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x00,0x00, - 6, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00,0x00, + 6, // 0x2B '+' + 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00,0x00, - 4, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x20,0x40,0x80, + 4, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x20,0x40,0x80, - 6, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00, + 4, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00, - 7, // 0x2F '/' - 0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00, + 7, // 0x2F '/' + 0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00, - 7, // 0x30 '0' - 0x00,0x38,0x44,0x44,0x54,0x54,0x54,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x30 '0' + 0x00,0x38,0x44,0x44,0x54,0x54,0x54,0x44,0x44,0x38,0x00,0x00,0x00, - 4, // 0x31 '1' - 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00, + 4, // 0x31 '1' + 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00, - 7, // 0x32 '2' - 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, + 7, // 0x32 '2' + 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, - 7, // 0x33 '3' - 0x00,0x38,0x44,0x04,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x33 '3' + 0x00,0x38,0x44,0x04,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00,0x00, - 6, // 0x34 '4' - 0x00,0x08,0x18,0x28,0x28,0x48,0x48,0x7C,0x08,0x08,0x00,0x00,0x00, + 6, // 0x34 '4' + 0x00,0x08,0x18,0x28,0x28,0x48,0x48,0x7C,0x08,0x08,0x00,0x00,0x00, - 7, // 0x35 '5' - 0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x35 '5' + 0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00,0x00, - 7, // 0x36 '6' - 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x36 '6' + 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 6, // 0x37 '7' - 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x00,0x00,0x00, + 6, // 0x37 '7' + 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x00,0x00,0x00, - 7, // 0x38 '8' - 0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x38 '8' + 0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x39 '9' - 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x39 '9' + 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00,0x00,0x00, - 4, // 0x3A ':' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00, + 4, // 0x3A ':' + 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00, - 4, // 0x3B ';' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x20,0x40,0x80, + 4, // 0x3B ';' + 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x20,0x40,0x80, - 6, // 0x3C '<' - 0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00, + 6, // 0x3C '<' + 0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00, - 6, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 6, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, - 6, // 0x3E '>' - 0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00, + 6, // 0x3E '>' + 0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00, - 6, // 0x3F '?' - 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00,0x00, + 6, // 0x3F '?' + 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00,0x00, - 7, // 0x40 '@' - 0x00,0x38,0x44,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00,0x00,0x00, + 7, // 0x40 '@' + 0x00,0x38,0x44,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00,0x00,0x00, - 7, // 0x41 'A' - 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x41 'A' + 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x42 'B' - 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00,0x00, + 7, // 0x42 'B' + 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00,0x00, - 6, // 0x43 'C' - 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00,0x00, + 6, // 0x43 'C' + 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00,0x00, - 7, // 0x44 'D' - 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00,0x00, + 7, // 0x44 'D' + 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00,0x00, - 6, // 0x45 'E' - 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00,0x00, + 6, // 0x45 'E' + 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00,0x00, - 6, // 0x46 'F' - 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 6, // 0x46 'F' + 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 7, // 0x47 'G' - 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x44,0x4C,0x34,0x00,0x00,0x00, + 7, // 0x47 'G' + 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x44,0x4C,0x34,0x00,0x00,0x00, - 7, // 0x48 'H' - 0x00,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x48 'H' + 0x00,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00,0x00, - 5, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, + 5, // 0x49 'I' + 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, - 6, // 0x4A 'J' - 0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00,0x00, + 6, // 0x4A 'J' + 0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00,0x00, - 6, // 0x4B 'K' - 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x44,0x00,0x00,0x00, + 6, // 0x4B 'K' + 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x44,0x00,0x00,0x00, - 6, // 0x4C 'L' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00,0x00, + 6, // 0x4C 'L' + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00,0x00, - 9, // 0x4D 'M' - 0x00,0x00,0x41,0x00,0x63,0x00,0x55,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4D 'M' + 0x00,0x00,0x41,0x00,0x63,0x00,0x55,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x4E 'N' - 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x44,0x00,0x00,0x00, + 7, // 0x4E 'N' + 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x44,0x00,0x00,0x00, - 7, // 0x4F 'O' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x4F 'O' + 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x50 'P' - 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00,0x00, + 7, // 0x50 'P' + 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00,0x00, - 7, // 0x51 'Q' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00,0x00, + 7, // 0x51 'Q' + 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00,0x00, - 7, // 0x52 'R' - 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00,0x00, + 7, // 0x52 'R' + 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00,0x00, - 7, // 0x53 'S' - 0x00,0x38,0x44,0x40,0x40,0x38,0x04,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x53 'S' + 0x00,0x38,0x44,0x40,0x40,0x38,0x04,0x04,0x44,0x38,0x00,0x00,0x00, - 6, // 0x54 'T' - 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, + 6, // 0x54 'T' + 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, - 7, // 0x55 'U' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x55 'U' + 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 6, // 0x56 'V' - 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00,0x00, + 6, // 0x56 'V' + 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00,0x00, - 9, // 0x57 'W' - 0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x55,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x57 'W' + 0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x55,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x58 'X' - 0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x58 'X' + 0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x59 'Y' - 0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00,0x00, + 7, // 0x59 'Y' + 0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00,0x00, - 6, // 0x5A 'Z' - 0x00,0x7C,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00,0x00, + 6, // 0x5A 'Z' + 0x00,0x7C,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00,0x00, - 4, // 0x5B '[' - 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00,0x00, + 4, // 0x5B '[' + 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00,0x00, - 7, // 0x5C '\' - 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00,0x00, + 7, // 0x5C '\' + 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00,0x00, - 4, // 0x5D ']' - 0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xE0,0x00,0x00, + 4, // 0x5D ']' + 0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xE0,0x00,0x00, - 6, // 0x5E '^' - 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x5E '^' + 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00, + 6, // 0x5F '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00, - 4, // 0x60 '`' - 0x00,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x60 '`' + 0x00,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00,0x00,0x00, + 7, // 0x61 'a' + 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00,0x00,0x00, - 7, // 0x62 'b' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00,0x00, + 7, // 0x62 'b' + 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00,0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00,0x00, + 6, // 0x63 'c' + 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00,0x00, - 7, // 0x64 'd' - 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x00,0x00,0x00, + 7, // 0x64 'd' + 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x00,0x00,0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x38,0x44,0x44,0x7C,0x40,0x44,0x38,0x00,0x00,0x00, + 7, // 0x65 'e' + 0x00,0x00,0x00,0x38,0x44,0x44,0x7C,0x40,0x44,0x38,0x00,0x00,0x00, - 4, // 0x66 'f' - 0x00,0x30,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 4, // 0x66 'f' + 0x00,0x30,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x44,0x38, + 7, // 0x67 'g' + 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x44,0x38, - 7, // 0x68 'h' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x68 'h' + 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, - 3, // 0x69 'i' - 0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 3, // 0x69 'i' + 0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 5, // 0x6A 'j' - 0x00,0x10,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x60,0x00, + 5, // 0x6A 'j' + 0x00,0x10,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x60,0x00, - 6, // 0x6B 'k' - 0x00,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00,0x00, + 6, // 0x6B 'k' + 0x00,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00,0x00, - 3, // 0x6C 'l' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 3, // 0x6C 'l' + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 9, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6D 'm' + 0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x6E 'n' - 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x6E 'n' + 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x6F 'o' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x6F 'o' + 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40, + 7, // 0x70 'p' + 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x04,0x04, + 7, // 0x71 'q' + 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x04,0x04, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, + 6, // 0x72 'r' + 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x73 's' + 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00,0x00, - 5, // 0x74 't' - 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x20,0x18,0x00,0x00,0x00, + 5, // 0x74 't' + 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x20,0x18,0x00,0x00,0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00,0x00, + 7, // 0x75 'u' + 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00,0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00,0x00, + 6, // 0x76 'v' + 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00,0x00, - 9, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00,0x00, + 7, // 0x78 'x' + 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00,0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x08,0x70, + 7, // 0x79 'y' + 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x08,0x70, - 6, // 0x7A 'z' - 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, + 6, // 0x7A 'z' + 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, - 5, // 0x7B '{' - 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00,0x00, + 5, // 0x7B '{' + 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00,0x00, - 3, // 0x7C '|' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x7C '|' + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, - 5, // 0x7D '}' - 0xC0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xC0,0x00,0x00, + 5, // 0x7D '}' + 0xC0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xC0,0x00,0x00, - 7, // 0x7E '~' - 0x00,0x60,0x92,0x92,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7E '~' + 0x00,0x60,0x92,0x92,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x7F '' - 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7F '' + 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u mcs5x10_mono[] = - { - 10, 2, 32, 128-32, - 0x00,0x00,0x0B,0x00,0x16,0x00,0x21,0x00,0x2C,0x00,0x37,0x00,0x42,0x00,0x4D,0x00,0x58,0x00, - 0x63,0x00,0x6E,0x00,0x79,0x00,0x84,0x00,0x8F,0x00,0x9A,0x00,0xA5,0x00,0xB0,0x00,0xBB,0x00, - 0xC6,0x00,0xD1,0x00,0xDC,0x00,0xE7,0x00,0xF2,0x00,0xFD,0x00,0x08,0x01,0x13,0x01,0x1E,0x01, - 0x29,0x01,0x34,0x01,0x3F,0x01,0x4A,0x01,0x55,0x01,0x60,0x01,0x6B,0x01,0x76,0x01,0x81,0x01, - 0x8C,0x01,0x97,0x01,0xA2,0x01,0xAD,0x01,0xB8,0x01,0xC3,0x01,0xCE,0x01,0xD9,0x01,0xE4,0x01, - 0xEF,0x01,0xFA,0x01,0x05,0x02,0x10,0x02,0x1B,0x02,0x26,0x02,0x31,0x02,0x3C,0x02,0x47,0x02, - 0x52,0x02,0x5D,0x02,0x68,0x02,0x73,0x02,0x7E,0x02,0x89,0x02,0x94,0x02,0x9F,0x02,0xAA,0x02, - 0xB5,0x02,0xC0,0x02,0xCB,0x02,0xD6,0x02,0xE1,0x02,0xEC,0x02,0xF7,0x02,0x02,0x03,0x0D,0x03, - 0x18,0x03,0x23,0x03,0x2E,0x03,0x39,0x03,0x44,0x03,0x4F,0x03,0x5A,0x03,0x65,0x03,0x70,0x03, - 0x7B,0x03,0x86,0x03,0x91,0x03,0x9C,0x03,0xA7,0x03,0xB2,0x03,0xBD,0x03,0xC8,0x03,0xD3,0x03, - 0xDE,0x03,0xE9,0x03,0xF4,0x03,0xFF,0x03,0x0A,0x04,0x15,0x04, +const int8u mcs5x10_mono[] = +{ + 10, 2, 32, 128-32, + 0x00,0x00,0x0B,0x00,0x16,0x00,0x21,0x00,0x2C,0x00,0x37,0x00,0x42,0x00,0x4D,0x00,0x58,0x00, + 0x63,0x00,0x6E,0x00,0x79,0x00,0x84,0x00,0x8F,0x00,0x9A,0x00,0xA5,0x00,0xB0,0x00,0xBB,0x00, + 0xC6,0x00,0xD1,0x00,0xDC,0x00,0xE7,0x00,0xF2,0x00,0xFD,0x00,0x08,0x01,0x13,0x01,0x1E,0x01, + 0x29,0x01,0x34,0x01,0x3F,0x01,0x4A,0x01,0x55,0x01,0x60,0x01,0x6B,0x01,0x76,0x01,0x81,0x01, + 0x8C,0x01,0x97,0x01,0xA2,0x01,0xAD,0x01,0xB8,0x01,0xC3,0x01,0xCE,0x01,0xD9,0x01,0xE4,0x01, + 0xEF,0x01,0xFA,0x01,0x05,0x02,0x10,0x02,0x1B,0x02,0x26,0x02,0x31,0x02,0x3C,0x02,0x47,0x02, + 0x52,0x02,0x5D,0x02,0x68,0x02,0x73,0x02,0x7E,0x02,0x89,0x02,0x94,0x02,0x9F,0x02,0xAA,0x02, + 0xB5,0x02,0xC0,0x02,0xCB,0x02,0xD6,0x02,0xE1,0x02,0xEC,0x02,0xF7,0x02,0x02,0x03,0x0D,0x03, + 0x18,0x03,0x23,0x03,0x2E,0x03,0x39,0x03,0x44,0x03,0x4F,0x03,0x5A,0x03,0x65,0x03,0x70,0x03, + 0x7B,0x03,0x86,0x03,0x91,0x03,0x9C,0x03,0xA7,0x03,0xB2,0x03,0xBD,0x03,0xC8,0x03,0xD3,0x03, + 0xDE,0x03,0xE9,0x03,0xF4,0x03,0xFF,0x03,0x0A,0x04,0x15,0x04, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, + 5, // 0x21 '!' + 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, - 5, // 0x22 '"' - 0x00,0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x22 '"' + 0x00,0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x23 '#' - 0x00,0x50,0x50,0xF8,0x50,0x50,0x50,0xF8,0x50,0x50, + 5, // 0x23 '#' + 0x00,0x50,0x50,0xF8,0x50,0x50,0x50,0xF8,0x50,0x50, - 5, // 0x24 '$' - 0x00,0x40,0x60,0x90,0x80,0x60,0x10,0x90,0x60,0x20, + 5, // 0x24 '$' + 0x00,0x40,0x60,0x90,0x80,0x60,0x10,0x90,0x60,0x20, - 5, // 0x25 '%' - 0x00,0x00,0x90,0x90,0x20,0x20,0x40,0x40,0x90,0x90, + 5, // 0x25 '%' + 0x00,0x00,0x90,0x90,0x20,0x20,0x40,0x40,0x90,0x90, - 5, // 0x26 '&' - 0x00,0x40,0xA0,0xA0,0xA0,0x40,0xA8,0x90,0x90,0x68, + 5, // 0x26 '&' + 0x00,0x40,0xA0,0xA0,0xA0,0x40,0xA8,0x90,0x90,0x68, - 5, // 0x27 ''' - 0x00,0x20,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x27 ''' + 0x00,0x20,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x28 '(' - 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x20,0x20,0x10, + 5, // 0x28 '(' + 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x20,0x20,0x10, - 5, // 0x29 ')' - 0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x20,0x20,0x40, + 5, // 0x29 ')' + 0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x20,0x20,0x40, - 5, // 0x2A '*' - 0x00,0x00,0x90,0x60,0xF0,0x60,0x90,0x00,0x00,0x00, + 5, // 0x2A '*' + 0x00,0x00,0x90,0x60,0xF0,0x60,0x90,0x00,0x00,0x00, - 5, // 0x2B '+' - 0x00,0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00, + 5, // 0x2B '+' + 0x00,0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00, - 5, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0xC0, + 5, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0xC0, - 5, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00, + 5, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00, - 5, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00, + 5, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00, - 5, // 0x2F '/' - 0x00,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x00, + 5, // 0x2F '/' + 0x00,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x00, - 5, // 0x30 '0' - 0x00,0x70,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00, + 5, // 0x30 '0' + 0x00,0x70,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00, - 5, // 0x31 '1' - 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 5, // 0x31 '1' + 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00, - 5, // 0x32 '2' - 0x00,0x60,0x90,0x90,0x10,0x20,0x40,0x80,0xF0,0x00, + 5, // 0x32 '2' + 0x00,0x60,0x90,0x90,0x10,0x20,0x40,0x80,0xF0,0x00, - 5, // 0x33 '3' - 0x00,0x60,0x90,0x10,0x60,0x10,0x10,0x90,0x60,0x00, + 5, // 0x33 '3' + 0x00,0x60,0x90,0x10,0x60,0x10,0x10,0x90,0x60,0x00, - 5, // 0x34 '4' - 0x00,0x10,0x30,0x50,0x50,0x90,0xF0,0x10,0x10,0x00, + 5, // 0x34 '4' + 0x00,0x10,0x30,0x50,0x50,0x90,0xF0,0x10,0x10,0x00, - 5, // 0x35 '5' - 0x00,0xF0,0x80,0x80,0xE0,0x10,0x10,0x90,0x60,0x00, + 5, // 0x35 '5' + 0x00,0xF0,0x80,0x80,0xE0,0x10,0x10,0x90,0x60,0x00, - 5, // 0x36 '6' - 0x00,0x60,0x80,0x80,0xE0,0x90,0x90,0x90,0x60,0x00, + 5, // 0x36 '6' + 0x00,0x60,0x80,0x80,0xE0,0x90,0x90,0x90,0x60,0x00, - 5, // 0x37 '7' - 0x00,0xF0,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x00, + 5, // 0x37 '7' + 0x00,0xF0,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x00, - 5, // 0x38 '8' - 0x00,0x60,0x90,0x90,0x60,0x90,0x90,0x90,0x60,0x00, + 5, // 0x38 '8' + 0x00,0x60,0x90,0x90,0x60,0x90,0x90,0x90,0x60,0x00, - 5, // 0x39 '9' - 0x00,0x60,0x90,0x90,0x90,0x70,0x10,0x10,0x60,0x00, + 5, // 0x39 '9' + 0x00,0x60,0x90,0x90,0x90,0x70,0x10,0x10,0x60,0x00, - 5, // 0x3A ':' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00, + 5, // 0x3A ':' + 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00, - 5, // 0x3B ';' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0xC0, + 5, // 0x3B ';' + 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0xC0, - 5, // 0x3C '<' - 0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08, + 5, // 0x3C '<' + 0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08, - 5, // 0x3D '=' - 0x00,0x00,0x00,0x00,0xF0,0x00,0xF0,0x00,0x00,0x00, + 5, // 0x3D '=' + 0x00,0x00,0x00,0x00,0xF0,0x00,0xF0,0x00,0x00,0x00, - 5, // 0x3E '>' - 0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80, + 5, // 0x3E '>' + 0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80, - 5, // 0x3F '?' - 0x00,0x60,0x90,0x10,0x10,0x20,0x40,0x00,0x40,0x00, + 5, // 0x3F '?' + 0x00,0x60,0x90,0x10,0x10,0x20,0x40,0x00,0x40,0x00, - 5, // 0x40 '@' - 0x00,0x60,0x90,0x90,0xB0,0xB0,0x80,0x80,0x70,0x00, + 5, // 0x40 '@' + 0x00,0x60,0x90,0x90,0xB0,0xB0,0x80,0x80,0x70,0x00, - 5, // 0x41 'A' - 0x00,0x60,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x00, + 5, // 0x41 'A' + 0x00,0x60,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x00, - 5, // 0x42 'B' - 0x00,0xE0,0x90,0x90,0xE0,0x90,0x90,0x90,0xE0,0x00, + 5, // 0x42 'B' + 0x00,0xE0,0x90,0x90,0xE0,0x90,0x90,0x90,0xE0,0x00, - 5, // 0x43 'C' - 0x00,0x60,0x90,0x80,0x80,0x80,0x80,0x90,0x60,0x00, + 5, // 0x43 'C' + 0x00,0x60,0x90,0x80,0x80,0x80,0x80,0x90,0x60,0x00, - 5, // 0x44 'D' - 0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00, + 5, // 0x44 'D' + 0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00, - 5, // 0x45 'E' - 0x00,0xF0,0x80,0x80,0xF0,0x80,0x80,0x80,0xF0,0x00, + 5, // 0x45 'E' + 0x00,0xF0,0x80,0x80,0xF0,0x80,0x80,0x80,0xF0,0x00, - 5, // 0x46 'F' - 0x00,0xF0,0x80,0x80,0xF0,0x80,0x80,0x80,0x80,0x00, + 5, // 0x46 'F' + 0x00,0xF0,0x80,0x80,0xF0,0x80,0x80,0x80,0x80,0x00, - 5, // 0x47 'G' - 0x00,0x60,0x90,0x80,0x80,0xB0,0x90,0x90,0x60,0x00, + 5, // 0x47 'G' + 0x00,0x60,0x90,0x80,0x80,0xB0,0x90,0x90,0x60,0x00, - 5, // 0x48 'H' - 0x00,0x90,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x00, + 5, // 0x48 'H' + 0x00,0x90,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x00, - 5, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 5, // 0x49 'I' + 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00, - 5, // 0x4A 'J' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0xA0,0x40,0x00, + 5, // 0x4A 'J' + 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0xA0,0x40,0x00, - 5, // 0x4B 'K' - 0x00,0x90,0xA0,0xA0,0xC0,0xC0,0xA0,0xA0,0x90,0x00, + 5, // 0x4B 'K' + 0x00,0x90,0xA0,0xA0,0xC0,0xC0,0xA0,0xA0,0x90,0x00, - 5, // 0x4C 'L' - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xF0,0x00, + 5, // 0x4C 'L' + 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xF0,0x00, - 5, // 0x4D 'M' - 0x00,0x90,0x90,0xF0,0xF0,0x90,0x90,0x90,0x90,0x00, + 5, // 0x4D 'M' + 0x00,0x90,0x90,0xF0,0xF0,0x90,0x90,0x90,0x90,0x00, - 5, // 0x4E 'N' - 0x00,0x90,0x90,0xD0,0xD0,0xB0,0xB0,0x90,0x90,0x00, + 5, // 0x4E 'N' + 0x00,0x90,0x90,0xD0,0xD0,0xB0,0xB0,0x90,0x90,0x00, - 5, // 0x4F 'O' - 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x4F 'O' + 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, - 5, // 0x50 'P' - 0x00,0xE0,0x90,0x90,0x90,0xE0,0x80,0x80,0x80,0x00, + 5, // 0x50 'P' + 0x00,0xE0,0x90,0x90,0x90,0xE0,0x80,0x80,0x80,0x00, - 5, // 0x51 'Q' - 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x30, + 5, // 0x51 'Q' + 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x30, - 5, // 0x52 'R' - 0x00,0xE0,0x90,0x90,0x90,0xE0,0xA0,0x90,0x90,0x00, + 5, // 0x52 'R' + 0x00,0xE0,0x90,0x90,0x90,0xE0,0xA0,0x90,0x90,0x00, - 5, // 0x53 'S' - 0x00,0x60,0x90,0x80,0x60,0x10,0x90,0x90,0x60,0x00, + 5, // 0x53 'S' + 0x00,0x60,0x90,0x80,0x60,0x10,0x90,0x90,0x60,0x00, - 5, // 0x54 'T' - 0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 5, // 0x54 'T' + 0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, - 5, // 0x55 'U' - 0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x55 'U' + 0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, - 5, // 0x56 'V' - 0x00,0x90,0x90,0x90,0x50,0x50,0x50,0x20,0x20,0x00, + 5, // 0x56 'V' + 0x00,0x90,0x90,0x90,0x50,0x50,0x50,0x20,0x20,0x00, - 5, // 0x57 'W' - 0x00,0x90,0x90,0x90,0x90,0x90,0xF0,0xF0,0x90,0x00, + 5, // 0x57 'W' + 0x00,0x90,0x90,0x90,0x90,0x90,0xF0,0xF0,0x90,0x00, - 5, // 0x58 'X' - 0x00,0x90,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x00, + 5, // 0x58 'X' + 0x00,0x90,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x00, - 5, // 0x59 'Y' - 0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x00, + 5, // 0x59 'Y' + 0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x00, - 5, // 0x5A 'Z' - 0x00,0xF0,0x10,0x20,0x20,0x40,0x40,0x80,0xF0,0x00, + 5, // 0x5A 'Z' + 0x00,0xF0,0x10,0x20,0x20,0x40,0x40,0x80,0xF0,0x00, - 5, // 0x5B '[' - 0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x60, + 5, // 0x5B '[' + 0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x60, - 5, // 0x5C '\' - 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08, + 5, // 0x5C '\' + 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08, - 5, // 0x5D ']' - 0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, + 5, // 0x5D ']' + 0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, - 5, // 0x5E '^' - 0x00,0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x5E '^' + 0x00,0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00, + 5, // 0x5F '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00, - 5, // 0x60 '`' - 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x60 '`' + 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x61 'a' - 0x00,0x00,0x00,0x60,0x10,0x70,0x90,0x90,0x70,0x00, + 5, // 0x61 'a' + 0x00,0x00,0x00,0x60,0x10,0x70,0x90,0x90,0x70,0x00, - 5, // 0x62 'b' - 0x00,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0xE0,0x00, + 5, // 0x62 'b' + 0x00,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0xE0,0x00, - 5, // 0x63 'c' - 0x00,0x00,0x00,0x60,0x90,0x80,0x80,0x90,0x60,0x00, + 5, // 0x63 'c' + 0x00,0x00,0x00,0x60,0x90,0x80,0x80,0x90,0x60,0x00, - 5, // 0x64 'd' - 0x00,0x10,0x10,0x70,0x90,0x90,0x90,0x90,0x70,0x00, + 5, // 0x64 'd' + 0x00,0x10,0x10,0x70,0x90,0x90,0x90,0x90,0x70,0x00, - 5, // 0x65 'e' - 0x00,0x00,0x00,0x60,0x90,0x90,0xF0,0x80,0x70,0x00, + 5, // 0x65 'e' + 0x00,0x00,0x00,0x60,0x90,0x90,0xF0,0x80,0x70,0x00, - 5, // 0x66 'f' - 0x00,0x30,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x00, + 5, // 0x66 'f' + 0x00,0x30,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x00, - 5, // 0x67 'g' - 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0xE0, + 5, // 0x67 'g' + 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0xE0, - 5, // 0x68 'h' - 0x00,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0x90,0x00, + 5, // 0x68 'h' + 0x00,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0x90,0x00, - 5, // 0x69 'i' - 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00, + 5, // 0x69 'i' + 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00, - 5, // 0x6A 'j' - 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0xC0, + 5, // 0x6A 'j' + 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0xC0, - 5, // 0x6B 'k' - 0x00,0x80,0x80,0x90,0xA0,0xC0,0xA0,0x90,0x90,0x00, + 5, // 0x6B 'k' + 0x00,0x80,0x80,0x90,0xA0,0xC0,0xA0,0x90,0x90,0x00, - 5, // 0x6C 'l' - 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 5, // 0x6C 'l' + 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00, - 5, // 0x6D 'm' - 0x00,0x00,0x00,0x90,0xF0,0x90,0x90,0x90,0x90,0x00, + 5, // 0x6D 'm' + 0x00,0x00,0x00,0x90,0xF0,0x90,0x90,0x90,0x90,0x00, - 5, // 0x6E 'n' - 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x00, + 5, // 0x6E 'n' + 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x00, - 5, // 0x6F 'o' - 0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x6F 'o' + 0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x60,0x00, - 5, // 0x70 'p' - 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0xE0,0x80,0x80, + 5, // 0x70 'p' + 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0xE0,0x80,0x80, - 5, // 0x71 'q' - 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0x10, + 5, // 0x71 'q' + 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0x10, - 5, // 0x72 'r' - 0x00,0x00,0x00,0xB0,0x50,0x40,0x40,0x40,0xE0,0x00, + 5, // 0x72 'r' + 0x00,0x00,0x00,0xB0,0x50,0x40,0x40,0x40,0xE0,0x00, - 5, // 0x73 's' - 0x00,0x00,0x00,0x60,0x90,0x40,0x20,0x90,0x60,0x00, + 5, // 0x73 's' + 0x00,0x00,0x00,0x60,0x90,0x40,0x20,0x90,0x60,0x00, - 5, // 0x74 't' - 0x00,0x40,0x40,0xE0,0x40,0x40,0x40,0x50,0x20,0x00, + 5, // 0x74 't' + 0x00,0x40,0x40,0xE0,0x40,0x40,0x40,0x50,0x20,0x00, - 5, // 0x75 'u' - 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x70,0x00, + 5, // 0x75 'u' + 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x70,0x00, - 5, // 0x76 'v' - 0x00,0x00,0x00,0x90,0x90,0x50,0x50,0x20,0x20,0x00, + 5, // 0x76 'v' + 0x00,0x00,0x00,0x90,0x90,0x50,0x50,0x20,0x20,0x00, - 5, // 0x77 'w' - 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0xF0,0x90,0x00, + 5, // 0x77 'w' + 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0xF0,0x90,0x00, - 5, // 0x78 'x' - 0x00,0x00,0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x00, + 5, // 0x78 'x' + 0x00,0x00,0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x00, - 5, // 0x79 'y' - 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x70,0x10,0xE0, + 5, // 0x79 'y' + 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x70,0x10,0xE0, - 5, // 0x7A 'z' - 0x00,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0xF0,0x00, + 5, // 0x7A 'z' + 0x00,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0xF0,0x00, - 5, // 0x7B '{' - 0x30,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x40,0x30, + 5, // 0x7B '{' + 0x30,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x40,0x30, - 5, // 0x7C '|' - 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 5, // 0x7C '|' + 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, - 5, // 0x7D '}' - 0xC0,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0xC0, + 5, // 0x7D '}' + 0xC0,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0xC0, - 5, // 0x7E '~' - 0x00,0x40,0xA8,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x7E '~' + 0x00,0x40,0xA8,0x10,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x7F '' - 0x00,0x20,0x70,0xD8,0x88,0x88,0xF8,0x00,0x00,0x00, + 5, // 0x7F '' + 0x00,0x20,0x70,0xD8,0x88,0x88,0xF8,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u mcs5x11_mono[] = - { - 11, 3, 32, 128-32, - 0x00,0x00,0x0C,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3C,0x00,0x48,0x00,0x54,0x00,0x60,0x00, - 0x6C,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9C,0x00,0xA8,0x00,0xB4,0x00,0xC0,0x00,0xCC,0x00, - 0xD8,0x00,0xE4,0x00,0xF0,0x00,0xFC,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2C,0x01,0x38,0x01, - 0x44,0x01,0x50,0x01,0x5C,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8C,0x01,0x98,0x01,0xA4,0x01, - 0xB0,0x01,0xBC,0x01,0xC8,0x01,0xD4,0x01,0xE0,0x01,0xEC,0x01,0xF8,0x01,0x04,0x02,0x10,0x02, - 0x1C,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4C,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7C,0x02, - 0x88,0x02,0x94,0x02,0xA0,0x02,0xAC,0x02,0xB8,0x02,0xC4,0x02,0xD0,0x02,0xDC,0x02,0xE8,0x02, - 0xF4,0x02,0x00,0x03,0x0C,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3C,0x03,0x48,0x03,0x54,0x03, - 0x60,0x03,0x6C,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9C,0x03,0xA8,0x03,0xB4,0x03,0xC0,0x03, - 0xCC,0x03,0xD8,0x03,0xE4,0x03,0xF0,0x03,0xFC,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2C,0x04, - 0x38,0x04,0x44,0x04,0x50,0x04,0x5C,0x04,0x68,0x04,0x74,0x04, +const int8u mcs5x11_mono[] = +{ + 11, 3, 32, 128-32, + 0x00,0x00,0x0C,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3C,0x00,0x48,0x00,0x54,0x00,0x60,0x00, + 0x6C,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9C,0x00,0xA8,0x00,0xB4,0x00,0xC0,0x00,0xCC,0x00, + 0xD8,0x00,0xE4,0x00,0xF0,0x00,0xFC,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2C,0x01,0x38,0x01, + 0x44,0x01,0x50,0x01,0x5C,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8C,0x01,0x98,0x01,0xA4,0x01, + 0xB0,0x01,0xBC,0x01,0xC8,0x01,0xD4,0x01,0xE0,0x01,0xEC,0x01,0xF8,0x01,0x04,0x02,0x10,0x02, + 0x1C,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4C,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7C,0x02, + 0x88,0x02,0x94,0x02,0xA0,0x02,0xAC,0x02,0xB8,0x02,0xC4,0x02,0xD0,0x02,0xDC,0x02,0xE8,0x02, + 0xF4,0x02,0x00,0x03,0x0C,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3C,0x03,0x48,0x03,0x54,0x03, + 0x60,0x03,0x6C,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9C,0x03,0xA8,0x03,0xB4,0x03,0xC0,0x03, + 0xCC,0x03,0xD8,0x03,0xE4,0x03,0xF0,0x03,0xFC,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2C,0x04, + 0x38,0x04,0x44,0x04,0x50,0x04,0x5C,0x04,0x68,0x04,0x74,0x04, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, + 5, // 0x21 '!' + 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, - 5, // 0x22 '"' - 0x00,0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x22 '"' + 0x00,0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x23 '#' - 0x00,0x50,0x50,0xF8,0x50,0x50,0x50,0xF8,0x50,0x50,0x00, + 5, // 0x23 '#' + 0x00,0x50,0x50,0xF8,0x50,0x50,0x50,0xF8,0x50,0x50,0x00, - 5, // 0x24 '$' - 0x00,0x40,0x60,0x90,0x80,0x60,0x10,0x90,0x60,0x20,0x00, + 5, // 0x24 '$' + 0x00,0x40,0x60,0x90,0x80,0x60,0x10,0x90,0x60,0x20,0x00, - 5, // 0x25 '%' - 0x00,0x00,0x90,0x90,0x20,0x20,0x40,0x40,0x90,0x90,0x00, + 5, // 0x25 '%' + 0x00,0x00,0x90,0x90,0x20,0x20,0x40,0x40,0x90,0x90,0x00, - 5, // 0x26 '&' - 0x00,0x40,0xA0,0xA0,0x40,0xA8,0x90,0x90,0x68,0x00,0x00, + 5, // 0x26 '&' + 0x00,0x40,0xA0,0xA0,0x40,0xA8,0x90,0x90,0x68,0x00,0x00, - 5, // 0x27 ''' - 0x00,0x20,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x27 ''' + 0x00,0x20,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x28 '(' - 0x00,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x20,0x20,0x10, + 5, // 0x28 '(' + 0x00,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x20,0x20,0x10, - 5, // 0x29 ')' - 0x00,0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x20,0x20,0x40, + 5, // 0x29 ')' + 0x00,0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x20,0x20,0x40, - 5, // 0x2A '*' - 0x00,0x00,0x90,0x60,0xF0,0x60,0x90,0x00,0x00,0x00,0x00, + 5, // 0x2A '*' + 0x00,0x00,0x90,0x60,0xF0,0x60,0x90,0x00,0x00,0x00,0x00, - 5, // 0x2B '+' - 0x00,0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00,0x00, + 5, // 0x2B '+' + 0x00,0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00,0x00, - 5, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x40,0x80, + 5, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x40,0x80, - 5, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00, + 5, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00, - 5, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00, + 5, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00, - 5, // 0x2F '/' - 0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, + 5, // 0x2F '/' + 0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, - 5, // 0x30 '0' - 0x00,0x70,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00,0x00, + 5, // 0x30 '0' + 0x00,0x70,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00,0x00, - 5, // 0x31 '1' - 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 5, // 0x31 '1' + 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, - 5, // 0x32 '2' - 0x00,0x60,0x90,0x90,0x10,0x20,0x40,0x80,0xF0,0x00,0x00, + 5, // 0x32 '2' + 0x00,0x60,0x90,0x90,0x10,0x20,0x40,0x80,0xF0,0x00,0x00, - 5, // 0x33 '3' - 0x00,0x60,0x90,0x10,0x60,0x10,0x10,0x90,0x60,0x00,0x00, + 5, // 0x33 '3' + 0x00,0x60,0x90,0x10,0x60,0x10,0x10,0x90,0x60,0x00,0x00, - 5, // 0x34 '4' - 0x00,0x10,0x30,0x50,0x50,0x90,0xF8,0x10,0x10,0x00,0x00, + 5, // 0x34 '4' + 0x00,0x10,0x30,0x50,0x50,0x90,0xF8,0x10,0x10,0x00,0x00, - 5, // 0x35 '5' - 0x00,0xF0,0x80,0xE0,0x90,0x10,0x10,0x90,0x60,0x00,0x00, + 5, // 0x35 '5' + 0x00,0xF0,0x80,0xE0,0x90,0x10,0x10,0x90,0x60,0x00,0x00, - 5, // 0x36 '6' - 0x00,0x60,0x90,0x80,0xE0,0x90,0x90,0x90,0x60,0x00,0x00, + 5, // 0x36 '6' + 0x00,0x60,0x90,0x80,0xE0,0x90,0x90,0x90,0x60,0x00,0x00, - 5, // 0x37 '7' - 0x00,0xF0,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x00,0x00, + 5, // 0x37 '7' + 0x00,0xF0,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x00,0x00, - 5, // 0x38 '8' - 0x00,0x60,0x90,0x90,0x60,0x90,0x90,0x90,0x60,0x00,0x00, + 5, // 0x38 '8' + 0x00,0x60,0x90,0x90,0x60,0x90,0x90,0x90,0x60,0x00,0x00, - 5, // 0x39 '9' - 0x00,0x60,0x90,0x90,0x90,0x70,0x10,0x90,0x60,0x00,0x00, + 5, // 0x39 '9' + 0x00,0x60,0x90,0x90,0x90,0x70,0x10,0x90,0x60,0x00,0x00, - 5, // 0x3A ':' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00,0x00, + 5, // 0x3A ':' + 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00,0x00, - 5, // 0x3B ';' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x40,0x80, + 5, // 0x3B ';' + 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x40,0x80, - 5, // 0x3C '<' - 0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x00, + 5, // 0x3C '<' + 0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x00, - 5, // 0x3D '=' - 0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0x00, + 5, // 0x3D '=' + 0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0x00, - 5, // 0x3E '>' - 0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80,0x00, + 5, // 0x3E '>' + 0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80,0x00, - 5, // 0x3F '?' - 0x00,0x60,0x90,0x10,0x10,0x20,0x40,0x00,0x40,0x00,0x00, + 5, // 0x3F '?' + 0x00,0x60,0x90,0x10,0x10,0x20,0x40,0x00,0x40,0x00,0x00, - 5, // 0x40 '@' - 0x00,0x60,0x90,0x90,0xB0,0xB0,0x80,0x80,0x70,0x00,0x00, + 5, // 0x40 '@' + 0x00,0x60,0x90,0x90,0xB0,0xB0,0x80,0x80,0x70,0x00,0x00, - 5, // 0x41 'A' - 0x00,0x60,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x00,0x00, + 5, // 0x41 'A' + 0x00,0x60,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x00,0x00, - 5, // 0x42 'B' - 0x00,0xE0,0x90,0x90,0xE0,0x90,0x90,0x90,0xE0,0x00,0x00, + 5, // 0x42 'B' + 0x00,0xE0,0x90,0x90,0xE0,0x90,0x90,0x90,0xE0,0x00,0x00, - 5, // 0x43 'C' - 0x00,0x60,0x90,0x80,0x80,0x80,0x80,0x90,0x60,0x00,0x00, + 5, // 0x43 'C' + 0x00,0x60,0x90,0x80,0x80,0x80,0x80,0x90,0x60,0x00,0x00, - 5, // 0x44 'D' - 0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00,0x00, + 5, // 0x44 'D' + 0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00,0x00, - 5, // 0x45 'E' - 0x00,0xF0,0x80,0x80,0xE0,0x80,0x80,0x80,0xF0,0x00,0x00, + 5, // 0x45 'E' + 0x00,0xF0,0x80,0x80,0xE0,0x80,0x80,0x80,0xF0,0x00,0x00, - 5, // 0x46 'F' - 0x00,0xF0,0x80,0x80,0xE0,0x80,0x80,0x80,0x80,0x00,0x00, + 5, // 0x46 'F' + 0x00,0xF0,0x80,0x80,0xE0,0x80,0x80,0x80,0x80,0x00,0x00, - 5, // 0x47 'G' - 0x00,0x60,0x90,0x80,0x80,0xB0,0x90,0x90,0x60,0x00,0x00, + 5, // 0x47 'G' + 0x00,0x60,0x90,0x80,0x80,0xB0,0x90,0x90,0x60,0x00,0x00, - 5, // 0x48 'H' - 0x00,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x90,0x00,0x00, + 5, // 0x48 'H' + 0x00,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x90,0x00,0x00, - 5, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 5, // 0x49 'I' + 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, - 5, // 0x4A 'J' - 0x00,0x70,0x20,0x20,0x20,0x20,0xA0,0xA0,0x40,0x00,0x00, + 5, // 0x4A 'J' + 0x00,0x70,0x20,0x20,0x20,0x20,0xA0,0xA0,0x40,0x00,0x00, - 5, // 0x4B 'K' - 0x00,0x90,0xA0,0xA0,0xC0,0xA0,0xA0,0x90,0x90,0x00,0x00, + 5, // 0x4B 'K' + 0x00,0x90,0xA0,0xA0,0xC0,0xA0,0xA0,0x90,0x90,0x00,0x00, - 5, // 0x4C 'L' - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xF0,0x00,0x00, + 5, // 0x4C 'L' + 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xF0,0x00,0x00, - 5, // 0x4D 'M' - 0x00,0x90,0xF0,0xF0,0x90,0x90,0x90,0x90,0x90,0x00,0x00, + 5, // 0x4D 'M' + 0x00,0x90,0xF0,0xF0,0x90,0x90,0x90,0x90,0x90,0x00,0x00, - 5, // 0x4E 'N' - 0x00,0x90,0x90,0xD0,0xD0,0xB0,0xB0,0x90,0x90,0x00,0x00, + 5, // 0x4E 'N' + 0x00,0x90,0x90,0xD0,0xD0,0xB0,0xB0,0x90,0x90,0x00,0x00, - 5, // 0x4F 'O' - 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00,0x00, + 5, // 0x4F 'O' + 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00,0x00, - 5, // 0x50 'P' - 0x00,0xE0,0x90,0x90,0x90,0xE0,0x80,0x80,0x80,0x00,0x00, + 5, // 0x50 'P' + 0x00,0xE0,0x90,0x90,0x90,0xE0,0x80,0x80,0x80,0x00,0x00, - 5, // 0x51 'Q' - 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x30,0x00, + 5, // 0x51 'Q' + 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x30,0x00, - 5, // 0x52 'R' - 0x00,0xE0,0x90,0x90,0x90,0xE0,0xA0,0x90,0x90,0x00,0x00, + 5, // 0x52 'R' + 0x00,0xE0,0x90,0x90,0x90,0xE0,0xA0,0x90,0x90,0x00,0x00, - 5, // 0x53 'S' - 0x00,0x60,0x90,0x80,0x60,0x10,0x90,0x90,0x60,0x00,0x00, + 5, // 0x53 'S' + 0x00,0x60,0x90,0x80,0x60,0x10,0x90,0x90,0x60,0x00,0x00, - 5, // 0x54 'T' - 0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00, + 5, // 0x54 'T' + 0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00, - 5, // 0x55 'U' - 0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00,0x00, + 5, // 0x55 'U' + 0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00,0x00, - 5, // 0x56 'V' - 0x00,0x90,0x90,0x90,0x50,0x50,0x50,0x20,0x20,0x00,0x00, + 5, // 0x56 'V' + 0x00,0x90,0x90,0x90,0x50,0x50,0x50,0x20,0x20,0x00,0x00, - 5, // 0x57 'W' - 0x00,0x90,0x90,0x90,0x90,0x90,0xF0,0xF0,0x90,0x00,0x00, + 5, // 0x57 'W' + 0x00,0x90,0x90,0x90,0x90,0x90,0xF0,0xF0,0x90,0x00,0x00, - 5, // 0x58 'X' - 0x00,0x90,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x00,0x00, + 5, // 0x58 'X' + 0x00,0x90,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x00,0x00, - 5, // 0x59 'Y' - 0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x00,0x00, + 5, // 0x59 'Y' + 0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x00,0x00, - 5, // 0x5A 'Z' - 0x00,0xF0,0x10,0x20,0x20,0x40,0x40,0x80,0xF0,0x00,0x00, + 5, // 0x5A 'Z' + 0x00,0xF0,0x10,0x20,0x20,0x40,0x40,0x80,0xF0,0x00,0x00, - 5, // 0x5B '[' - 0x00,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x60, + 5, // 0x5B '[' + 0x00,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x60, - 5, // 0x5C '\' - 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, + 5, // 0x5C '\' + 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, - 5, // 0x5D ']' - 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, + 5, // 0x5D ']' + 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, - 5, // 0x5E '^' - 0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x5E '^' + 0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00, + 5, // 0x5F '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00, - 5, // 0x60 '`' - 0x00,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x60 '`' + 0x00,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x61 'a' - 0x00,0x00,0x00,0x60,0x10,0x70,0x90,0x90,0x70,0x00,0x00, + 5, // 0x61 'a' + 0x00,0x00,0x00,0x60,0x10,0x70,0x90,0x90,0x70,0x00,0x00, - 5, // 0x62 'b' - 0x00,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0xE0,0x00,0x00, + 5, // 0x62 'b' + 0x00,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0xE0,0x00,0x00, - 5, // 0x63 'c' - 0x00,0x00,0x00,0x60,0x90,0x80,0x80,0x90,0x60,0x00,0x00, + 5, // 0x63 'c' + 0x00,0x00,0x00,0x60,0x90,0x80,0x80,0x90,0x60,0x00,0x00, - 5, // 0x64 'd' - 0x00,0x10,0x10,0x70,0x90,0x90,0x90,0x90,0x70,0x00,0x00, + 5, // 0x64 'd' + 0x00,0x10,0x10,0x70,0x90,0x90,0x90,0x90,0x70,0x00,0x00, - 5, // 0x65 'e' - 0x00,0x00,0x00,0x60,0x90,0x90,0xF0,0x80,0x70,0x00,0x00, + 5, // 0x65 'e' + 0x00,0x00,0x00,0x60,0x90,0x90,0xF0,0x80,0x70,0x00,0x00, - 5, // 0x66 'f' - 0x00,0x30,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 5, // 0x66 'f' + 0x00,0x30,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x00,0x00, - 5, // 0x67 'g' - 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x90,0x70,0x10,0xE0, + 5, // 0x67 'g' + 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x90,0x70,0x10,0xE0, - 5, // 0x68 'h' - 0x00,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0x90,0x00,0x00, + 5, // 0x68 'h' + 0x00,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0x90,0x00,0x00, - 5, // 0x69 'i' - 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 5, // 0x69 'i' + 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00,0x00, - 5, // 0x6A 'j' - 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + 5, // 0x6A 'j' + 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, - 5, // 0x6B 'k' - 0x00,0x80,0x80,0x90,0xA0,0xC0,0xA0,0x90,0x90,0x00,0x00, + 5, // 0x6B 'k' + 0x00,0x80,0x80,0x90,0xA0,0xC0,0xA0,0x90,0x90,0x00,0x00, - 5, // 0x6C 'l' - 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 5, // 0x6C 'l' + 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, - 5, // 0x6D 'm' - 0x00,0x00,0x00,0x90,0xF0,0x90,0x90,0x90,0x90,0x00,0x00, + 5, // 0x6D 'm' + 0x00,0x00,0x00,0x90,0xF0,0x90,0x90,0x90,0x90,0x00,0x00, - 5, // 0x6E 'n' - 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x00,0x00, + 5, // 0x6E 'n' + 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x00,0x00, - 5, // 0x6F 'o' - 0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x60,0x00,0x00, + 5, // 0x6F 'o' + 0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x60,0x00,0x00, - 5, // 0x70 'p' - 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0xE0,0x80,0x80, + 5, // 0x70 'p' + 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0xE0,0x80,0x80, - 5, // 0x71 'q' - 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x90,0x70,0x10,0x10, + 5, // 0x71 'q' + 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x90,0x70,0x10,0x10, - 5, // 0x72 'r' - 0x00,0x00,0x00,0xA0,0x50,0x40,0x40,0x40,0xE0,0x00,0x00, + 5, // 0x72 'r' + 0x00,0x00,0x00,0xA0,0x50,0x40,0x40,0x40,0xE0,0x00,0x00, - 5, // 0x73 's' - 0x00,0x00,0x00,0x60,0x90,0x40,0x20,0x90,0x60,0x00,0x00, + 5, // 0x73 's' + 0x00,0x00,0x00,0x60,0x90,0x40,0x20,0x90,0x60,0x00,0x00, - 5, // 0x74 't' - 0x00,0x40,0x40,0xE0,0x40,0x40,0x40,0x40,0x30,0x00,0x00, + 5, // 0x74 't' + 0x00,0x40,0x40,0xE0,0x40,0x40,0x40,0x40,0x30,0x00,0x00, - 5, // 0x75 'u' - 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x70,0x00,0x00, + 5, // 0x75 'u' + 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x70,0x00,0x00, - 5, // 0x76 'v' - 0x00,0x00,0x00,0x90,0x90,0x50,0x50,0x20,0x20,0x00,0x00, + 5, // 0x76 'v' + 0x00,0x00,0x00,0x90,0x90,0x50,0x50,0x20,0x20,0x00,0x00, - 5, // 0x77 'w' - 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0xF0,0x90,0x00,0x00, + 5, // 0x77 'w' + 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0xF0,0x90,0x00,0x00, - 5, // 0x78 'x' - 0x00,0x00,0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x00,0x00, + 5, // 0x78 'x' + 0x00,0x00,0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x00,0x00, - 5, // 0x79 'y' - 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x70,0x10,0xE0, + 5, // 0x79 'y' + 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x70,0x10,0xE0, - 5, // 0x7A 'z' - 0x00,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0xF0,0x00,0x00, + 5, // 0x7A 'z' + 0x00,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0xF0,0x00,0x00, - 5, // 0x7B '{' - 0x30,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x40,0x30, + 5, // 0x7B '{' + 0x30,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x40,0x30, - 5, // 0x7C '|' - 0x00,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x20,0x00, + 5, // 0x7C '|' + 0x00,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x20,0x00, - 5, // 0x7D '}' - 0xC0,0x20,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0xC0, + 5, // 0x7D '}' + 0xC0,0x20,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0xC0, - 5, // 0x7E '~' - 0x00,0x40,0xA8,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x7E '~' + 0x00,0x40,0xA8,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x7F '' - 0x00,0x20,0x70,0xD8,0x88,0x88,0xF8,0x00,0x00,0x00,0x00, + 5, // 0x7F '' + 0x00,0x20,0x70,0xD8,0x88,0x88,0xF8,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u mcs6x10_mono[] = - { - 10, 3, 32, 128-32, - 0x00,0x00,0x0B,0x00,0x16,0x00,0x21,0x00,0x2C,0x00,0x37,0x00,0x42,0x00,0x4D,0x00,0x58,0x00, - 0x63,0x00,0x6E,0x00,0x79,0x00,0x84,0x00,0x8F,0x00,0x9A,0x00,0xA5,0x00,0xB0,0x00,0xBB,0x00, - 0xC6,0x00,0xD1,0x00,0xDC,0x00,0xE7,0x00,0xF2,0x00,0xFD,0x00,0x08,0x01,0x13,0x01,0x1E,0x01, - 0x29,0x01,0x34,0x01,0x3F,0x01,0x4A,0x01,0x55,0x01,0x60,0x01,0x6B,0x01,0x76,0x01,0x81,0x01, - 0x8C,0x01,0x97,0x01,0xA2,0x01,0xAD,0x01,0xB8,0x01,0xC3,0x01,0xCE,0x01,0xD9,0x01,0xE4,0x01, - 0xEF,0x01,0xFA,0x01,0x05,0x02,0x10,0x02,0x1B,0x02,0x26,0x02,0x31,0x02,0x3C,0x02,0x47,0x02, - 0x52,0x02,0x5D,0x02,0x68,0x02,0x73,0x02,0x7E,0x02,0x89,0x02,0x94,0x02,0x9F,0x02,0xAA,0x02, - 0xB5,0x02,0xC0,0x02,0xCB,0x02,0xD6,0x02,0xE1,0x02,0xEC,0x02,0xF7,0x02,0x02,0x03,0x0D,0x03, - 0x18,0x03,0x23,0x03,0x2E,0x03,0x39,0x03,0x44,0x03,0x4F,0x03,0x5A,0x03,0x65,0x03,0x70,0x03, - 0x7B,0x03,0x86,0x03,0x91,0x03,0x9C,0x03,0xA7,0x03,0xB2,0x03,0xBD,0x03,0xC8,0x03,0xD3,0x03, - 0xDE,0x03,0xE9,0x03,0xF4,0x03,0xFF,0x03,0x0A,0x04,0x15,0x04, +const int8u mcs6x10_mono[] = +{ + 10, 3, 32, 128-32, + 0x00,0x00,0x0B,0x00,0x16,0x00,0x21,0x00,0x2C,0x00,0x37,0x00,0x42,0x00,0x4D,0x00,0x58,0x00, + 0x63,0x00,0x6E,0x00,0x79,0x00,0x84,0x00,0x8F,0x00,0x9A,0x00,0xA5,0x00,0xB0,0x00,0xBB,0x00, + 0xC6,0x00,0xD1,0x00,0xDC,0x00,0xE7,0x00,0xF2,0x00,0xFD,0x00,0x08,0x01,0x13,0x01,0x1E,0x01, + 0x29,0x01,0x34,0x01,0x3F,0x01,0x4A,0x01,0x55,0x01,0x60,0x01,0x6B,0x01,0x76,0x01,0x81,0x01, + 0x8C,0x01,0x97,0x01,0xA2,0x01,0xAD,0x01,0xB8,0x01,0xC3,0x01,0xCE,0x01,0xD9,0x01,0xE4,0x01, + 0xEF,0x01,0xFA,0x01,0x05,0x02,0x10,0x02,0x1B,0x02,0x26,0x02,0x31,0x02,0x3C,0x02,0x47,0x02, + 0x52,0x02,0x5D,0x02,0x68,0x02,0x73,0x02,0x7E,0x02,0x89,0x02,0x94,0x02,0x9F,0x02,0xAA,0x02, + 0xB5,0x02,0xC0,0x02,0xCB,0x02,0xD6,0x02,0xE1,0x02,0xEC,0x02,0xF7,0x02,0x02,0x03,0x0D,0x03, + 0x18,0x03,0x23,0x03,0x2E,0x03,0x39,0x03,0x44,0x03,0x4F,0x03,0x5A,0x03,0x65,0x03,0x70,0x03, + 0x7B,0x03,0x86,0x03,0x91,0x03,0x9C,0x03,0xA7,0x03,0xB2,0x03,0xBD,0x03,0xC8,0x03,0xD3,0x03, + 0xDE,0x03,0xE9,0x03,0xF4,0x03,0xFF,0x03,0x0A,0x04,0x15,0x04, - 6, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x21 '!' - 0x00,0x10,0x10,0x10,0x10,0x10,0x00,0x10,0x00,0x00, + 6, // 0x21 '!' + 0x00,0x10,0x10,0x10,0x10,0x10,0x00,0x10,0x00,0x00, - 6, // 0x22 '"' - 0x00,0x28,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x22 '"' + 0x00,0x28,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x23 '#' - 0x00,0x28,0x28,0x7C,0x28,0x28,0x7C,0x28,0x28,0x00, + 6, // 0x23 '#' + 0x00,0x28,0x28,0x7C,0x28,0x28,0x7C,0x28,0x28,0x00, - 6, // 0x24 '$' - 0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x00, + 6, // 0x24 '$' + 0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x00, - 6, // 0x25 '%' - 0x00,0x08,0xC8,0xD0,0x10,0x20,0x2C,0x4C,0x40,0x00, + 6, // 0x25 '%' + 0x00,0x08,0xC8,0xD0,0x10,0x20,0x2C,0x4C,0x40,0x00, - 6, // 0x26 '&' - 0x00,0x20,0x50,0x50,0x24,0x54,0x48,0x34,0x00,0x00, + 6, // 0x26 '&' + 0x00,0x20,0x50,0x50,0x24,0x54,0x48,0x34,0x00,0x00, - 6, // 0x27 ''' - 0x00,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x27 ''' + 0x00,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x28 '(' - 0x08,0x10,0x10,0x20,0x20,0x20,0x10,0x10,0x08,0x00, + 6, // 0x28 '(' + 0x08,0x10,0x10,0x20,0x20,0x20,0x10,0x10,0x08,0x00, - 6, // 0x29 ')' - 0x20,0x10,0x10,0x08,0x08,0x08,0x10,0x10,0x20,0x00, + 6, // 0x29 ')' + 0x20,0x10,0x10,0x08,0x08,0x08,0x10,0x10,0x20,0x00, - 6, // 0x2A '*' - 0x00,0x00,0x28,0x7C,0x38,0x7C,0x28,0x00,0x00,0x00, + 6, // 0x2A '*' + 0x00,0x00,0x28,0x7C,0x38,0x7C,0x28,0x00,0x00,0x00, - 6, // 0x2B '+' - 0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, + 6, // 0x2B '+' + 0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, - 6, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40, + 6, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40, - 6, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, - 6, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, + 6, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, - 6, // 0x2F '/' - 0x00,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00, + 6, // 0x2F '/' + 0x00,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00, - 6, // 0x30 '0' - 0x00,0x38,0x44,0x4C,0x54,0x64,0x44,0x38,0x00,0x00, + 6, // 0x30 '0' + 0x00,0x38,0x44,0x4C,0x54,0x64,0x44,0x38,0x00,0x00, - 6, // 0x31 '1' - 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 6, // 0x31 '1' + 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00, - 6, // 0x32 '2' - 0x00,0x38,0x44,0x04,0x18,0x20,0x40,0x7C,0x00,0x00, + 6, // 0x32 '2' + 0x00,0x38,0x44,0x04,0x18,0x20,0x40,0x7C,0x00,0x00, - 6, // 0x33 '3' - 0x00,0x38,0x44,0x04,0x38,0x04,0x44,0x38,0x00,0x00, + 6, // 0x33 '3' + 0x00,0x38,0x44,0x04,0x38,0x04,0x44,0x38,0x00,0x00, - 6, // 0x34 '4' - 0x00,0x08,0x18,0x28,0x48,0x7C,0x08,0x08,0x00,0x00, + 6, // 0x34 '4' + 0x00,0x08,0x18,0x28,0x48,0x7C,0x08,0x08,0x00,0x00, - 6, // 0x35 '5' - 0x00,0x7C,0x40,0x40,0x78,0x04,0x44,0x38,0x00,0x00, + 6, // 0x35 '5' + 0x00,0x7C,0x40,0x40,0x78,0x04,0x44,0x38,0x00,0x00, - 6, // 0x36 '6' - 0x00,0x38,0x40,0x40,0x78,0x44,0x44,0x38,0x00,0x00, + 6, // 0x36 '6' + 0x00,0x38,0x40,0x40,0x78,0x44,0x44,0x38,0x00,0x00, - 6, // 0x37 '7' - 0x00,0x7C,0x04,0x08,0x10,0x20,0x20,0x20,0x00,0x00, + 6, // 0x37 '7' + 0x00,0x7C,0x04,0x08,0x10,0x20,0x20,0x20,0x00,0x00, - 6, // 0x38 '8' - 0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x38,0x00,0x00, + 6, // 0x38 '8' + 0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x38,0x00,0x00, - 6, // 0x39 '9' - 0x00,0x38,0x44,0x44,0x3C,0x04,0x04,0x38,0x00,0x00, + 6, // 0x39 '9' + 0x00,0x38,0x44,0x44,0x3C,0x04,0x04,0x38,0x00,0x00, - 6, // 0x3A ':' - 0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00, + 6, // 0x3A ':' + 0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00, - 6, // 0x3B ';' - 0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x20,0x40, + 6, // 0x3B ';' + 0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x20,0x40, - 6, // 0x3C '<' - 0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00, + 6, // 0x3C '<' + 0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00, - 6, // 0x3D '=' - 0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00, + 6, // 0x3D '=' + 0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00, - 6, // 0x3E '>' - 0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00, + 6, // 0x3E '>' + 0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00, - 6, // 0x3F '?' - 0x00,0x38,0x44,0x04,0x18,0x10,0x00,0x10,0x00,0x00, + 6, // 0x3F '?' + 0x00,0x38,0x44,0x04,0x18,0x10,0x00,0x10,0x00,0x00, - 6, // 0x40 '@' - 0x00,0x38,0x44,0x5C,0x54,0x5C,0x40,0x38,0x00,0x00, + 6, // 0x40 '@' + 0x00,0x38,0x44,0x5C,0x54,0x5C,0x40,0x38,0x00,0x00, - 6, // 0x41 'A' - 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x00,0x00, + 6, // 0x41 'A' + 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x00,0x00, - 6, // 0x42 'B' - 0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x78,0x00,0x00, + 6, // 0x42 'B' + 0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x78,0x00,0x00, - 6, // 0x43 'C' - 0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00, + 6, // 0x43 'C' + 0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00, - 6, // 0x44 'D' - 0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00, + 6, // 0x44 'D' + 0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00, - 6, // 0x45 'E' - 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x45 'E' + 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x7C,0x00,0x00, - 6, // 0x46 'F' - 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x00,0x00, + 6, // 0x46 'F' + 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x00,0x00, - 6, // 0x47 'G' - 0x00,0x38,0x44,0x40,0x4C,0x44,0x44,0x3C,0x00,0x00, + 6, // 0x47 'G' + 0x00,0x38,0x44,0x40,0x4C,0x44,0x44,0x3C,0x00,0x00, - 6, // 0x48 'H' - 0x00,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x00,0x00, + 6, // 0x48 'H' + 0x00,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x00,0x00, - 6, // 0x49 'I' - 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 6, // 0x49 'I' + 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, - 6, // 0x4A 'J' - 0x00,0x1C,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00, + 6, // 0x4A 'J' + 0x00,0x1C,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00, - 6, // 0x4B 'K' - 0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, + 6, // 0x4B 'K' + 0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, - 6, // 0x4C 'L' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x4C 'L' + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, - 6, // 0x4D 'M' - 0x00,0x44,0x6C,0x54,0x54,0x44,0x44,0x44,0x00,0x00, + 6, // 0x4D 'M' + 0x00,0x44,0x6C,0x54,0x54,0x44,0x44,0x44,0x00,0x00, - 6, // 0x4E 'N' - 0x00,0x44,0x44,0x64,0x54,0x4C,0x44,0x44,0x00,0x00, + 6, // 0x4E 'N' + 0x00,0x44,0x44,0x64,0x54,0x4C,0x44,0x44,0x00,0x00, - 6, // 0x4F 'O' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 6, // 0x4F 'O' + 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 6, // 0x50 'P' - 0x00,0x78,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, + 6, // 0x50 'P' + 0x00,0x78,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, - 6, // 0x51 'Q' - 0x00,0x38,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, + 6, // 0x51 'Q' + 0x00,0x38,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, - 6, // 0x52 'R' - 0x00,0x78,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00, + 6, // 0x52 'R' + 0x00,0x78,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00, - 6, // 0x53 'S' - 0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00, + 6, // 0x53 'S' + 0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00, - 6, // 0x54 'T' - 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 6, // 0x54 'T' + 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, - 6, // 0x55 'U' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 6, // 0x55 'U' + 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 6, // 0x56 'V' - 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x10,0x00,0x00, + 6, // 0x56 'V' + 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x10,0x00,0x00, - 6, // 0x57 'W' - 0x00,0x44,0x44,0x54,0x54,0x54,0x54,0x28,0x00,0x00, + 6, // 0x57 'W' + 0x00,0x44,0x44,0x54,0x54,0x54,0x54,0x28,0x00,0x00, - 6, // 0x58 'X' - 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, + 6, // 0x58 'X' + 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, - 6, // 0x59 'Y' - 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x00,0x00, + 6, // 0x59 'Y' + 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x00,0x00, - 6, // 0x5A 'Z' - 0x00,0x78,0x08,0x10,0x20,0x40,0x40,0x78,0x00,0x00, + 6, // 0x5A 'Z' + 0x00,0x78,0x08,0x10,0x20,0x40,0x40,0x78,0x00,0x00, - 6, // 0x5B '[' - 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, + 6, // 0x5B '[' + 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, - 6, // 0x5C '\' - 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, + 6, // 0x5C '\' + 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, - 6, // 0x5D ']' - 0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, + 6, // 0x5D ']' + 0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, - 6, // 0x5E '^' - 0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x5E '^' + 0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00, + 6, // 0x5F '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00, - 6, // 0x60 '`' - 0x00,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x60 '`' + 0x00,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x61 'a' - 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x3C,0x00,0x00, + 6, // 0x61 'a' + 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x3C,0x00,0x00, - 6, // 0x62 'b' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x78,0x00,0x00, + 6, // 0x62 'b' + 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x78,0x00,0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x3C,0x00,0x00, + 6, // 0x63 'c' + 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x3C,0x00,0x00, - 6, // 0x64 'd' - 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00,0x00, + 6, // 0x64 'd' + 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00,0x00, - 6, // 0x65 'e' - 0x00,0x00,0x00,0x38,0x44,0x78,0x40,0x3C,0x00,0x00, + 6, // 0x65 'e' + 0x00,0x00,0x00,0x38,0x44,0x78,0x40,0x3C,0x00,0x00, - 6, // 0x66 'f' - 0x00,0x0C,0x10,0x10,0x38,0x10,0x10,0x10,0x00,0x00, + 6, // 0x66 'f' + 0x00,0x0C,0x10,0x10,0x38,0x10,0x10,0x10,0x00,0x00, - 6, // 0x67 'g' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x3C,0x04,0x38, + 6, // 0x67 'g' + 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x3C,0x04,0x38, - 6, // 0x68 'h' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x00,0x00, + 6, // 0x68 'h' + 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x00,0x00, - 6, // 0x69 'i' - 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x38,0x00,0x00, + 6, // 0x69 'i' + 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x38,0x00,0x00, - 6, // 0x6A 'j' - 0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x48,0x30, + 6, // 0x6A 'j' + 0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x48,0x30, - 6, // 0x6B 'k' - 0x00,0x40,0x40,0x48,0x50,0x60,0x50,0x48,0x00,0x00, + 6, // 0x6B 'k' + 0x00,0x40,0x40,0x48,0x50,0x60,0x50,0x48,0x00,0x00, - 6, // 0x6C 'l' - 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 6, // 0x6C 'l' + 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, - 6, // 0x6D 'm' - 0x00,0x00,0x00,0x68,0x54,0x54,0x44,0x44,0x00,0x00, + 6, // 0x6D 'm' + 0x00,0x00,0x00,0x68,0x54,0x54,0x44,0x44,0x00,0x00, - 6, // 0x6E 'n' - 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x00,0x00, + 6, // 0x6E 'n' + 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x00,0x00, - 6, // 0x6F 'o' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x38,0x00,0x00, + 6, // 0x6F 'o' + 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x38,0x00,0x00, - 6, // 0x70 'p' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40, + 6, // 0x70 'p' + 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40, - 6, // 0x71 'q' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x3C,0x04,0x04, + 6, // 0x71 'q' + 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x3C,0x04,0x04, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x70,0x00,0x00, + 6, // 0x72 'r' + 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x70,0x00,0x00, - 6, // 0x73 's' - 0x00,0x00,0x00,0x38,0x40,0x38,0x04,0x78,0x00,0x00, + 6, // 0x73 's' + 0x00,0x00,0x00,0x38,0x40,0x38,0x04,0x78,0x00,0x00, - 6, // 0x74 't' - 0x00,0x10,0x10,0x38,0x10,0x10,0x14,0x08,0x00,0x00, + 6, // 0x74 't' + 0x00,0x10,0x10,0x38,0x10,0x10,0x14,0x08,0x00,0x00, - 6, // 0x75 'u' - 0x00,0x00,0x00,0x44,0x44,0x44,0x4C,0x34,0x00,0x00, + 6, // 0x75 'u' + 0x00,0x00,0x00,0x44,0x44,0x44,0x4C,0x34,0x00,0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x10,0x00,0x00, + 6, // 0x76 'v' + 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x10,0x00,0x00, - 6, // 0x77 'w' - 0x00,0x00,0x00,0x44,0x44,0x54,0x7C,0x28,0x00,0x00, + 6, // 0x77 'w' + 0x00,0x00,0x00,0x44,0x44,0x54,0x7C,0x28,0x00,0x00, - 6, // 0x78 'x' - 0x00,0x00,0x00,0x48,0x48,0x30,0x48,0x48,0x00,0x00, + 6, // 0x78 'x' + 0x00,0x00,0x00,0x48,0x48,0x30,0x48,0x48,0x00,0x00, - 6, // 0x79 'y' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x3C,0x04,0x38, + 6, // 0x79 'y' + 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x3C,0x04,0x38, - 6, // 0x7A 'z' - 0x00,0x00,0x00,0x78,0x08,0x30,0x40,0x78,0x00,0x00, + 6, // 0x7A 'z' + 0x00,0x00,0x00,0x78,0x08,0x30,0x40,0x78,0x00,0x00, - 6, // 0x7B '{' - 0x18,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x18,0x00, + 6, // 0x7B '{' + 0x18,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x18,0x00, - 6, // 0x7C '|' - 0x10,0x10,0x10,0x10,0x00,0x10,0x10,0x10,0x10,0x00, + 6, // 0x7C '|' + 0x10,0x10,0x10,0x10,0x00,0x10,0x10,0x10,0x10,0x00, - 6, // 0x7D '}' - 0x60,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x60,0x00, + 6, // 0x7D '}' + 0x60,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x60,0x00, - 6, // 0x7E '~' - 0x00,0x48,0xA8,0x90,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x7E '~' + 0x00,0x48,0xA8,0x90,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x7F '' - 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00, + 6, // 0x7F '' + 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u mcs6x11_mono[] = - { - 11, 3, 32, 128-32, - 0x00,0x00,0x0C,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3C,0x00,0x48,0x00,0x54,0x00,0x60,0x00, - 0x6C,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9C,0x00,0xA8,0x00,0xB4,0x00,0xC0,0x00,0xCC,0x00, - 0xD8,0x00,0xE4,0x00,0xF0,0x00,0xFC,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2C,0x01,0x38,0x01, - 0x44,0x01,0x50,0x01,0x5C,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8C,0x01,0x98,0x01,0xA4,0x01, - 0xB0,0x01,0xBC,0x01,0xC8,0x01,0xD4,0x01,0xE0,0x01,0xEC,0x01,0xF8,0x01,0x04,0x02,0x10,0x02, - 0x1C,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4C,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7C,0x02, - 0x88,0x02,0x94,0x02,0xA0,0x02,0xAC,0x02,0xB8,0x02,0xC4,0x02,0xD0,0x02,0xDC,0x02,0xE8,0x02, - 0xF4,0x02,0x00,0x03,0x0C,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3C,0x03,0x48,0x03,0x54,0x03, - 0x60,0x03,0x6C,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9C,0x03,0xA8,0x03,0xB4,0x03,0xC0,0x03, - 0xCC,0x03,0xD8,0x03,0xE4,0x03,0xF0,0x03,0xFC,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2C,0x04, - 0x38,0x04,0x44,0x04,0x50,0x04,0x5C,0x04,0x68,0x04,0x74,0x04, +const int8u mcs6x11_mono[] = +{ + 11, 3, 32, 128-32, + 0x00,0x00,0x0C,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3C,0x00,0x48,0x00,0x54,0x00,0x60,0x00, + 0x6C,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9C,0x00,0xA8,0x00,0xB4,0x00,0xC0,0x00,0xCC,0x00, + 0xD8,0x00,0xE4,0x00,0xF0,0x00,0xFC,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2C,0x01,0x38,0x01, + 0x44,0x01,0x50,0x01,0x5C,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8C,0x01,0x98,0x01,0xA4,0x01, + 0xB0,0x01,0xBC,0x01,0xC8,0x01,0xD4,0x01,0xE0,0x01,0xEC,0x01,0xF8,0x01,0x04,0x02,0x10,0x02, + 0x1C,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4C,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7C,0x02, + 0x88,0x02,0x94,0x02,0xA0,0x02,0xAC,0x02,0xB8,0x02,0xC4,0x02,0xD0,0x02,0xDC,0x02,0xE8,0x02, + 0xF4,0x02,0x00,0x03,0x0C,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3C,0x03,0x48,0x03,0x54,0x03, + 0x60,0x03,0x6C,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9C,0x03,0xA8,0x03,0xB4,0x03,0xC0,0x03, + 0xCC,0x03,0xD8,0x03,0xE4,0x03,0xF0,0x03,0xFC,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2C,0x04, + 0x38,0x04,0x44,0x04,0x50,0x04,0x5C,0x04,0x68,0x04,0x74,0x04, - 6, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, + 6, // 0x21 '!' + 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, - 6, // 0x22 '"' - 0x00,0x28,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x22 '"' + 0x00,0x28,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x23 '#' - 0x00,0x28,0x28,0x7C,0x28,0x28,0x7C,0x28,0x28,0x00,0x00, + 6, // 0x23 '#' + 0x00,0x28,0x28,0x7C,0x28,0x28,0x7C,0x28,0x28,0x00,0x00, - 6, // 0x24 '$' - 0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x00, + 6, // 0x24 '$' + 0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x00, - 6, // 0x25 '%' - 0x00,0x68,0xA8,0xD0,0x10,0x20,0x2C,0x54,0x58,0x00,0x00, + 6, // 0x25 '%' + 0x00,0x68,0xA8,0xD0,0x10,0x20,0x2C,0x54,0x58,0x00,0x00, - 6, // 0x26 '&' - 0x00,0x20,0x50,0x50,0x20,0x54,0x54,0x48,0x34,0x00,0x00, + 6, // 0x26 '&' + 0x00,0x20,0x50,0x50,0x20,0x54,0x54,0x48,0x34,0x00,0x00, - 6, // 0x27 ''' - 0x00,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x27 ''' + 0x00,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x28 '(' - 0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x00, + 6, // 0x28 '(' + 0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x00, - 6, // 0x29 ')' - 0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x00, + 6, // 0x29 ')' + 0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x00, - 6, // 0x2A '*' - 0x00,0x00,0x28,0x7C,0x38,0x7C,0x28,0x00,0x00,0x00,0x00, + 6, // 0x2A '*' + 0x00,0x00,0x28,0x7C,0x38,0x7C,0x28,0x00,0x00,0x00,0x00, - 6, // 0x2B '+' - 0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, + 6, // 0x2B '+' + 0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, - 6, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40, + 6, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40, - 6, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, - 6, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, + 6, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, - 6, // 0x2F '/' - 0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00, + 6, // 0x2F '/' + 0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00, - 6, // 0x30 '0' - 0x00,0x38,0x44,0x44,0x54,0x54,0x44,0x44,0x38,0x00,0x00, + 6, // 0x30 '0' + 0x00,0x38,0x44,0x44,0x54,0x54,0x44,0x44,0x38,0x00,0x00, - 6, // 0x31 '1' - 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 6, // 0x31 '1' + 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, - 6, // 0x32 '2' - 0x00,0x38,0x44,0x44,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 6, // 0x32 '2' + 0x00,0x38,0x44,0x44,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, - 6, // 0x33 '3' - 0x00,0x38,0x44,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00, + 6, // 0x33 '3' + 0x00,0x38,0x44,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00, - 6, // 0x34 '4' - 0x00,0x08,0x18,0x28,0x28,0x48,0x7C,0x08,0x08,0x00,0x00, + 6, // 0x34 '4' + 0x00,0x08,0x18,0x28,0x28,0x48,0x7C,0x08,0x08,0x00,0x00, - 6, // 0x35 '5' - 0x00,0x7C,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00, + 6, // 0x35 '5' + 0x00,0x7C,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00, - 6, // 0x36 '6' - 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x38,0x00,0x00, + 6, // 0x36 '6' + 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x38,0x00,0x00, - 6, // 0x37 '7' - 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x00,0x00, + 6, // 0x37 '7' + 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x00,0x00, - 6, // 0x38 '8' - 0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, + 6, // 0x38 '8' + 0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, - 6, // 0x39 '9' - 0x00,0x38,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00,0x00, + 6, // 0x39 '9' + 0x00,0x38,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00,0x00, - 6, // 0x3A ':' - 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00, + 6, // 0x3A ':' + 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00, - 6, // 0x3B ';' - 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x20,0x40, + 6, // 0x3B ';' + 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x20,0x40, - 6, // 0x3C '<' - 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00, + 6, // 0x3C '<' + 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00, - 6, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00, + 6, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00, - 6, // 0x3E '>' - 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00, + 6, // 0x3E '>' + 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00, - 6, // 0x3F '?' - 0x00,0x38,0x44,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, + 6, // 0x3F '?' + 0x00,0x38,0x44,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, - 6, // 0x40 '@' - 0x00,0x38,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00,0x00, + 6, // 0x40 '@' + 0x00,0x38,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00,0x00, - 6, // 0x41 'A' - 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x00,0x00, + 6, // 0x41 'A' + 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x00,0x00, - 6, // 0x42 'B' - 0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00, + 6, // 0x42 'B' + 0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00, - 6, // 0x43 'C' - 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00, + 6, // 0x43 'C' + 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00, - 6, // 0x44 'D' - 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00, + 6, // 0x44 'D' + 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00, - 6, // 0x45 'E' - 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x45 'E' + 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00, - 6, // 0x46 'F' - 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00, + 6, // 0x46 'F' + 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00, - 6, // 0x47 'G' - 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x4C,0x34,0x00,0x00, + 6, // 0x47 'G' + 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x4C,0x34,0x00,0x00, - 6, // 0x48 'H' - 0x00,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, + 6, // 0x48 'H' + 0x00,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, - 6, // 0x49 'I' - 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 6, // 0x49 'I' + 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, - 6, // 0x4A 'J' - 0x00,0x1C,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00, + 6, // 0x4A 'J' + 0x00,0x1C,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00, - 6, // 0x4B 'K' - 0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x44,0x00,0x00, + 6, // 0x4B 'K' + 0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x44,0x00,0x00, - 6, // 0x4C 'L' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x4C 'L' + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, - 6, // 0x4D 'M' - 0x00,0x44,0x6C,0x54,0x54,0x54,0x44,0x44,0x44,0x00,0x00, + 6, // 0x4D 'M' + 0x00,0x44,0x6C,0x54,0x54,0x54,0x44,0x44,0x44,0x00,0x00, - 6, // 0x4E 'N' - 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x00,0x00, + 6, // 0x4E 'N' + 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x00,0x00, - 6, // 0x4F 'O' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 6, // 0x4F 'O' + 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 6, // 0x50 'P' - 0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, + 6, // 0x50 'P' + 0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, - 6, // 0x51 'Q' - 0x00,0x38,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, + 6, // 0x51 'Q' + 0x00,0x38,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, - 6, // 0x52 'R' - 0x00,0x78,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00, + 6, // 0x52 'R' + 0x00,0x78,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00, - 6, // 0x53 'S' - 0x00,0x38,0x44,0x40,0x38,0x04,0x04,0x44,0x38,0x00,0x00, + 6, // 0x53 'S' + 0x00,0x38,0x44,0x40,0x38,0x04,0x04,0x44,0x38,0x00,0x00, - 6, // 0x54 'T' - 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 6, // 0x54 'T' + 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, - 6, // 0x55 'U' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 6, // 0x55 'U' + 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 6, // 0x56 'V' - 0x00,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, + 6, // 0x56 'V' + 0x00,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, - 6, // 0x57 'W' - 0x00,0x44,0x44,0x54,0x54,0x54,0x54,0x54,0x28,0x00,0x00, + 6, // 0x57 'W' + 0x00,0x44,0x44,0x54,0x54,0x54,0x54,0x54,0x28,0x00,0x00, - 6, // 0x58 'X' - 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00, + 6, // 0x58 'X' + 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00, - 6, // 0x59 'Y' - 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00, + 6, // 0x59 'Y' + 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00, - 6, // 0x5A 'Z' - 0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x5A 'Z' + 0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00, - 6, // 0x5B '[' - 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, + 6, // 0x5B '[' + 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, - 6, // 0x5C '\' - 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, + 6, // 0x5C '\' + 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, - 6, // 0x5D ']' - 0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, + 6, // 0x5D ']' + 0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, - 6, // 0x5E '^' - 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x5E '^' + 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00, + 6, // 0x5F '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00, - 6, // 0x60 '`' - 0x00,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x60 '`' + 0x00,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x61 'a' - 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x3C,0x00,0x00, + 6, // 0x61 'a' + 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x3C,0x00,0x00, - 6, // 0x62 'b' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00, + 6, // 0x62 'b' + 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x00, + 6, // 0x63 'c' + 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x00, - 6, // 0x64 'd' - 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, + 6, // 0x64 'd' + 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, - 6, // 0x65 'e' - 0x00,0x00,0x00,0x38,0x44,0x7C,0x40,0x44,0x38,0x00,0x00, + 6, // 0x65 'e' + 0x00,0x00,0x00,0x38,0x44,0x7C,0x40,0x44,0x38,0x00,0x00, - 6, // 0x66 'f' - 0x00,0x0C,0x10,0x38,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 6, // 0x66 'f' + 0x00,0x0C,0x10,0x38,0x10,0x10,0x10,0x10,0x10,0x00,0x00, - 6, // 0x67 'g' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x78, + 6, // 0x67 'g' + 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x78, - 6, // 0x68 'h' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 6, // 0x68 'h' + 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00, - 6, // 0x69 'i' - 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 6, // 0x69 'i' + 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00, - 6, // 0x6A 'j' - 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x50,0x20, + 6, // 0x6A 'j' + 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x50,0x20, - 6, // 0x6B 'k' - 0x00,0x40,0x40,0x4C,0x50,0x60,0x50,0x48,0x44,0x00,0x00, + 6, // 0x6B 'k' + 0x00,0x40,0x40,0x4C,0x50,0x60,0x50,0x48,0x44,0x00,0x00, - 6, // 0x6C 'l' - 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 6, // 0x6C 'l' + 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, - 6, // 0x6D 'm' - 0x00,0x00,0x00,0x68,0x54,0x54,0x54,0x44,0x44,0x00,0x00, + 6, // 0x6D 'm' + 0x00,0x00,0x00,0x68,0x54,0x54,0x54,0x44,0x44,0x00,0x00, - 6, // 0x6E 'n' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 6, // 0x6E 'n' + 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00, - 6, // 0x6F 'o' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 6, // 0x6F 'o' + 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 6, // 0x70 'p' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40, + 6, // 0x70 'p' + 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40, - 6, // 0x71 'q' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, + 6, // 0x71 'q' + 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x70,0x00,0x00, + 6, // 0x72 'r' + 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x70,0x00,0x00, - 6, // 0x73 's' - 0x00,0x00,0x00,0x38,0x44,0x30,0x08,0x44,0x38,0x00,0x00, + 6, // 0x73 's' + 0x00,0x00,0x00,0x38,0x44,0x30,0x08,0x44,0x38,0x00,0x00, - 6, // 0x74 't' - 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x18,0x00,0x00, + 6, // 0x74 't' + 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x18,0x00,0x00, - 6, // 0x75 'u' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00, + 6, // 0x75 'u' + 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, + 6, // 0x76 'v' + 0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, - 6, // 0x77 'w' - 0x00,0x00,0x00,0x44,0x44,0x44,0x54,0x7C,0x28,0x00,0x00, + 6, // 0x77 'w' + 0x00,0x00,0x00,0x44,0x44,0x44,0x54,0x7C,0x28,0x00,0x00, - 6, // 0x78 'x' - 0x00,0x00,0x00,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, + 6, // 0x78 'x' + 0x00,0x00,0x00,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, - 6, // 0x79 'y' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x3C,0x08,0x70, + 6, // 0x79 'y' + 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x3C,0x08,0x70, - 6, // 0x7A 'z' - 0x00,0x00,0x00,0x7C,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 6, // 0x7A 'z' + 0x00,0x00,0x00,0x7C,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, - 6, // 0x7B '{' - 0x18,0x20,0x20,0x20,0xC0,0xC0,0x20,0x20,0x20,0x18,0x00, + 6, // 0x7B '{' + 0x18,0x20,0x20,0x20,0xC0,0xC0,0x20,0x20,0x20,0x18,0x00, - 6, // 0x7C '|' - 0x00,0x10,0x10,0x10,0x10,0x00,0x10,0x10,0x10,0x10,0x00, + 6, // 0x7C '|' + 0x00,0x10,0x10,0x10,0x10,0x00,0x10,0x10,0x10,0x10,0x00, - 6, // 0x7D '}' - 0x60,0x10,0x10,0x10,0x0C,0x0C,0x10,0x10,0x10,0x60,0x00, + 6, // 0x7D '}' + 0x60,0x10,0x10,0x10,0x0C,0x0C,0x10,0x10,0x10,0x60,0x00, - 6, // 0x7E '~' - 0x00,0x24,0x54,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x7E '~' + 0x00,0x24,0x54,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x7F '' - 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00, + 6, // 0x7F '' + 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u mcs7x12_mono_high[] = - { - 12, 3, 32, 128-32, - 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x4E,0x00,0x5B,0x00,0x68,0x00, - 0x75,0x00,0x82,0x00,0x8F,0x00,0x9C,0x00,0xA9,0x00,0xB6,0x00,0xC3,0x00,0xD0,0x00,0xDD,0x00, - 0xEA,0x00,0xF7,0x00,0x04,0x01,0x11,0x01,0x1E,0x01,0x2B,0x01,0x38,0x01,0x45,0x01,0x52,0x01, - 0x5F,0x01,0x6C,0x01,0x79,0x01,0x86,0x01,0x93,0x01,0xA0,0x01,0xAD,0x01,0xBA,0x01,0xC7,0x01, - 0xD4,0x01,0xE1,0x01,0xEE,0x01,0xFB,0x01,0x08,0x02,0x15,0x02,0x22,0x02,0x2F,0x02,0x3C,0x02, - 0x49,0x02,0x56,0x02,0x63,0x02,0x70,0x02,0x7D,0x02,0x8A,0x02,0x97,0x02,0xA4,0x02,0xB1,0x02, - 0xBE,0x02,0xCB,0x02,0xD8,0x02,0xE5,0x02,0xF2,0x02,0xFF,0x02,0x0C,0x03,0x19,0x03,0x26,0x03, - 0x33,0x03,0x40,0x03,0x4D,0x03,0x5A,0x03,0x67,0x03,0x74,0x03,0x81,0x03,0x8E,0x03,0x9B,0x03, - 0xA8,0x03,0xB5,0x03,0xC2,0x03,0xCF,0x03,0xDC,0x03,0xE9,0x03,0xF6,0x03,0x03,0x04,0x10,0x04, - 0x1D,0x04,0x2A,0x04,0x37,0x04,0x44,0x04,0x51,0x04,0x5E,0x04,0x6B,0x04,0x78,0x04,0x85,0x04, - 0x92,0x04,0x9F,0x04,0xAC,0x04,0xB9,0x04,0xC6,0x04,0xD3,0x04, +const int8u mcs7x12_mono_high[] = +{ + 12, 3, 32, 128-32, + 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x4E,0x00,0x5B,0x00,0x68,0x00, + 0x75,0x00,0x82,0x00,0x8F,0x00,0x9C,0x00,0xA9,0x00,0xB6,0x00,0xC3,0x00,0xD0,0x00,0xDD,0x00, + 0xEA,0x00,0xF7,0x00,0x04,0x01,0x11,0x01,0x1E,0x01,0x2B,0x01,0x38,0x01,0x45,0x01,0x52,0x01, + 0x5F,0x01,0x6C,0x01,0x79,0x01,0x86,0x01,0x93,0x01,0xA0,0x01,0xAD,0x01,0xBA,0x01,0xC7,0x01, + 0xD4,0x01,0xE1,0x01,0xEE,0x01,0xFB,0x01,0x08,0x02,0x15,0x02,0x22,0x02,0x2F,0x02,0x3C,0x02, + 0x49,0x02,0x56,0x02,0x63,0x02,0x70,0x02,0x7D,0x02,0x8A,0x02,0x97,0x02,0xA4,0x02,0xB1,0x02, + 0xBE,0x02,0xCB,0x02,0xD8,0x02,0xE5,0x02,0xF2,0x02,0xFF,0x02,0x0C,0x03,0x19,0x03,0x26,0x03, + 0x33,0x03,0x40,0x03,0x4D,0x03,0x5A,0x03,0x67,0x03,0x74,0x03,0x81,0x03,0x8E,0x03,0x9B,0x03, + 0xA8,0x03,0xB5,0x03,0xC2,0x03,0xCF,0x03,0xDC,0x03,0xE9,0x03,0xF6,0x03,0x03,0x04,0x10,0x04, + 0x1D,0x04,0x2A,0x04,0x37,0x04,0x44,0x04,0x51,0x04,0x5E,0x04,0x6B,0x04,0x78,0x04,0x85,0x04, + 0x92,0x04,0x9F,0x04,0xAC,0x04,0xB9,0x04,0xC6,0x04,0xD3,0x04, - 7, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x21 '!' - 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x10,0x00,0x00, + 7, // 0x21 '!' + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x10,0x00,0x00, - 7, // 0x22 '"' - 0x28,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x28,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x23 '#' - 0x24,0x24,0x24,0x7E,0x24,0x24,0x24,0x7E,0x24,0x24,0x24,0x00, + 7, // 0x23 '#' + 0x24,0x24,0x24,0x7E,0x24,0x24,0x24,0x7E,0x24,0x24,0x24,0x00, - 7, // 0x24 '$' - 0x10,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x10,0x00, + 7, // 0x24 '$' + 0x10,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x10,0x00, - 7, // 0x25 '%' - 0x32,0x54,0x64,0x08,0x08,0x10,0x10,0x26,0x2A,0x4C,0x00,0x00, + 7, // 0x25 '%' + 0x32,0x54,0x64,0x08,0x08,0x10,0x10,0x26,0x2A,0x4C,0x00,0x00, - 7, // 0x26 '&' - 0x00,0x20,0x50,0x50,0x50,0x20,0x54,0x54,0x48,0x34,0x00,0x00, + 7, // 0x26 '&' + 0x00,0x20,0x50,0x50,0x50,0x20,0x54,0x54,0x48,0x34,0x00,0x00, - 7, // 0x27 ''' - 0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x27 ''' + 0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x28 '(' - 0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x00, + 7, // 0x28 '(' + 0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x00, - 7, // 0x29 ')' - 0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x00, + 7, // 0x29 ')' + 0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x00, - 7, // 0x2A '*' - 0x00,0x00,0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x00, + 7, // 0x2A '*' + 0x00,0x00,0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x00, - 7, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, + 7, // 0x2B '+' + 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, - 7, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40, + 7, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40, - 7, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, - 7, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, + 7, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, - 7, // 0x2F '/' - 0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00, + 7, // 0x2F '/' + 0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00, - 7, // 0x30 '0' - 0x00,0x38,0x44,0x44,0x54,0x54,0x54,0x44,0x44,0x38,0x00,0x00, + 7, // 0x30 '0' + 0x00,0x38,0x44,0x44,0x54,0x54,0x54,0x44,0x44,0x38,0x00,0x00, - 7, // 0x31 '1' - 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x31 '1' + 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, - 7, // 0x32 '2' - 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 7, // 0x32 '2' + 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, - 7, // 0x33 '3' - 0x00,0x38,0x44,0x04,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x33 '3' + 0x00,0x38,0x44,0x04,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00, - 7, // 0x34 '4' - 0x00,0x08,0x18,0x28,0x28,0x48,0x48,0x7C,0x08,0x08,0x00,0x00, + 7, // 0x34 '4' + 0x00,0x08,0x18,0x28,0x28,0x48,0x48,0x7C,0x08,0x08,0x00,0x00, - 7, // 0x35 '5' - 0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x35 '5' + 0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00, - 7, // 0x36 '6' - 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x36 '6' + 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x37 '7' - 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x00,0x00, + 7, // 0x37 '7' + 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x00,0x00, - 7, // 0x38 '8' - 0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x38 '8' + 0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x39 '9' - 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x39 '9' + 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00,0x00, - 7, // 0x3A ':' - 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x00, + 7, // 0x3A ':' + 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x00, - 7, // 0x3B ';' - 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x20,0x40, + 7, // 0x3B ';' + 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x20,0x40, - 7, // 0x3C '<' - 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00, + 7, // 0x3C '<' + 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00, - 7, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00, + 7, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00, - 7, // 0x3E '>' - 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00, + 7, // 0x3E '>' + 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00, - 7, // 0x3F '?' - 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, + 7, // 0x3F '?' + 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, - 7, // 0x40 '@' - 0x00,0x38,0x44,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00,0x00, + 7, // 0x40 '@' + 0x00,0x38,0x44,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00,0x00, - 7, // 0x41 'A' - 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x41 'A' + 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, - 7, // 0x42 'B' - 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00, + 7, // 0x42 'B' + 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00, - 7, // 0x43 'C' - 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00, + 7, // 0x43 'C' + 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00, - 7, // 0x44 'D' - 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00, + 7, // 0x44 'D' + 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00, - 7, // 0x45 'E' - 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00, + 7, // 0x45 'E' + 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00, - 7, // 0x46 'F' - 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00, + 7, // 0x46 'F' + 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00, - 7, // 0x47 'G' - 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x44,0x4C,0x34,0x00,0x00, + 7, // 0x47 'G' + 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x44,0x4C,0x34,0x00,0x00, - 7, // 0x48 'H' - 0x00,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x48 'H' + 0x00,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, - 7, // 0x49 'I' - 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x49 'I' + 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, - 7, // 0x4A 'J' - 0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00, + 7, // 0x4A 'J' + 0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00, - 7, // 0x4B 'K' - 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x44,0x00,0x00, + 7, // 0x4B 'K' + 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x44,0x00,0x00, - 7, // 0x4C 'L' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, + 7, // 0x4C 'L' + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, - 7, // 0x4D 'M' - 0x00,0x44,0x6C,0x6C,0x54,0x54,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x4D 'M' + 0x00,0x44,0x6C,0x6C,0x54,0x54,0x44,0x44,0x44,0x44,0x00,0x00, - 7, // 0x4E 'N' - 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x44,0x00,0x00, + 7, // 0x4E 'N' + 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x44,0x00,0x00, - 7, // 0x4F 'O' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x4F 'O' + 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x50 'P' - 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, + 7, // 0x50 'P' + 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, - 7, // 0x51 'Q' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, + 7, // 0x51 'Q' + 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, - 7, // 0x52 'R' - 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00, + 7, // 0x52 'R' + 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00, - 7, // 0x53 'S' - 0x00,0x38,0x44,0x40,0x40,0x38,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x53 'S' + 0x00,0x38,0x44,0x40,0x40,0x38,0x04,0x04,0x44,0x38,0x00,0x00, - 7, // 0x54 'T' - 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x54 'T' + 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, - 7, // 0x55 'U' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x55 'U' + 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x56 'V' - 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, + 7, // 0x56 'V' + 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, - 7, // 0x57 'W' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x54,0x28,0x00,0x00, + 7, // 0x57 'W' + 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x54,0x28,0x00,0x00, - 7, // 0x58 'X' - 0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00, + 7, // 0x58 'X' + 0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00, - 7, // 0x59 'Y' - 0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x59 'Y' + 0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00, - 7, // 0x5A 'Z' - 0x00,0x7C,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00, + 7, // 0x5A 'Z' + 0x00,0x7C,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00, - 7, // 0x5B '[' - 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, + 7, // 0x5B '[' + 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, - 7, // 0x5C '\' - 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, + 7, // 0x5C '\' + 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, - 7, // 0x5D ']' - 0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, + 7, // 0x5D ']' + 0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, - 7, // 0x5E '^' - 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x5E '^' + 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00, + 7, // 0x5F '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00, - 7, // 0x60 '`' - 0x00,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x60 '`' + 0x00,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00,0x00, + 7, // 0x61 'a' + 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00,0x00, - 7, // 0x62 'b' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00, + 7, // 0x62 'b' + 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00, + 7, // 0x63 'c' + 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00, - 7, // 0x64 'd' - 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, + 7, // 0x64 'd' + 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x38,0x44,0x44,0x7C,0x40,0x44,0x38,0x00,0x00, + 7, // 0x65 'e' + 0x00,0x00,0x00,0x38,0x44,0x44,0x7C,0x40,0x44,0x38,0x00,0x00, - 7, // 0x66 'f' - 0x00,0x0C,0x10,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x66 'f' + 0x00,0x0C,0x10,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x78, + 7, // 0x67 'g' + 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x78, - 7, // 0x68 'h' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x68 'h' + 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00, - 7, // 0x69 'i' - 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x69 'i' + 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, - 7, // 0x6A 'j' - 0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x08,0x48,0x30, + 7, // 0x6A 'j' + 0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x08,0x48,0x30, - 7, // 0x6B 'k' - 0x00,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, + 7, // 0x6B 'k' + 0x00,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, - 7, // 0x6C 'l' - 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x6C 'l' + 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, - 7, // 0x6D 'm' - 0x00,0x00,0x00,0x68,0x54,0x54,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x6D 'm' + 0x00,0x00,0x00,0x68,0x54,0x54,0x44,0x44,0x44,0x44,0x00,0x00, - 7, // 0x6E 'n' - 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x6E 'n' + 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0x00,0x00, - 7, // 0x6F 'o' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x6F 'o' + 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x40,0x40, + 7, // 0x70 'p' + 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x40,0x40, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, + 7, // 0x71 'q' + 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, - 7, // 0x72 'r' - 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 7, // 0x72 'r' + 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x20,0x70,0x00,0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00, + 7, // 0x73 's' + 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00, - 7, // 0x74 't' - 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x24,0x18,0x00,0x00, + 7, // 0x74 't' + 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x24,0x18,0x00,0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00, + 7, // 0x75 'u' + 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00, - 7, // 0x76 'v' - 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, + 7, // 0x76 'v' + 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, - 7, // 0x77 'w' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x54,0x54,0x28,0x00,0x00, + 7, // 0x77 'w' + 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x54,0x54,0x28,0x00,0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, + 7, // 0x78 'x' + 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3C,0x08,0x70, + 7, // 0x79 'y' + 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3C,0x08,0x70, - 7, // 0x7A 'z' - 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 7, // 0x7A 'z' + 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, - 7, // 0x7B '{' - 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00, + 7, // 0x7B '{' + 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00, - 7, // 0x7C '|' - 0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, + 7, // 0x7C '|' + 0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, - 7, // 0x7D '}' - 0x60,0x10,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x10,0x60,0x00, + 7, // 0x7D '}' + 0x60,0x10,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x10,0x60,0x00, - 7, // 0x7E '~' - 0x00,0x60,0x92,0x92,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7E '~' + 0x00,0x60,0x92,0x92,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x7F '' - 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7F '' + 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u mcs7x12_mono_low[] = - { - 12, 4, 32, 128-32, - 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x4E,0x00,0x5B,0x00,0x68,0x00, - 0x75,0x00,0x82,0x00,0x8F,0x00,0x9C,0x00,0xA9,0x00,0xB6,0x00,0xC3,0x00,0xD0,0x00,0xDD,0x00, - 0xEA,0x00,0xF7,0x00,0x04,0x01,0x11,0x01,0x1E,0x01,0x2B,0x01,0x38,0x01,0x45,0x01,0x52,0x01, - 0x5F,0x01,0x6C,0x01,0x79,0x01,0x86,0x01,0x93,0x01,0xA0,0x01,0xAD,0x01,0xBA,0x01,0xC7,0x01, - 0xD4,0x01,0xE1,0x01,0xEE,0x01,0xFB,0x01,0x08,0x02,0x15,0x02,0x22,0x02,0x2F,0x02,0x3C,0x02, - 0x49,0x02,0x56,0x02,0x63,0x02,0x70,0x02,0x7D,0x02,0x8A,0x02,0x97,0x02,0xA4,0x02,0xB1,0x02, - 0xBE,0x02,0xCB,0x02,0xD8,0x02,0xE5,0x02,0xF2,0x02,0xFF,0x02,0x0C,0x03,0x19,0x03,0x26,0x03, - 0x33,0x03,0x40,0x03,0x4D,0x03,0x5A,0x03,0x67,0x03,0x74,0x03,0x81,0x03,0x8E,0x03,0x9B,0x03, - 0xA8,0x03,0xB5,0x03,0xC2,0x03,0xCF,0x03,0xDC,0x03,0xE9,0x03,0xF6,0x03,0x03,0x04,0x10,0x04, - 0x1D,0x04,0x2A,0x04,0x37,0x04,0x44,0x04,0x51,0x04,0x5E,0x04,0x6B,0x04,0x78,0x04,0x85,0x04, - 0x92,0x04,0x9F,0x04,0xAC,0x04,0xB9,0x04,0xC6,0x04,0xD3,0x04, +const int8u mcs7x12_mono_low[] = +{ + 12, 4, 32, 128-32, + 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x4E,0x00,0x5B,0x00,0x68,0x00, + 0x75,0x00,0x82,0x00,0x8F,0x00,0x9C,0x00,0xA9,0x00,0xB6,0x00,0xC3,0x00,0xD0,0x00,0xDD,0x00, + 0xEA,0x00,0xF7,0x00,0x04,0x01,0x11,0x01,0x1E,0x01,0x2B,0x01,0x38,0x01,0x45,0x01,0x52,0x01, + 0x5F,0x01,0x6C,0x01,0x79,0x01,0x86,0x01,0x93,0x01,0xA0,0x01,0xAD,0x01,0xBA,0x01,0xC7,0x01, + 0xD4,0x01,0xE1,0x01,0xEE,0x01,0xFB,0x01,0x08,0x02,0x15,0x02,0x22,0x02,0x2F,0x02,0x3C,0x02, + 0x49,0x02,0x56,0x02,0x63,0x02,0x70,0x02,0x7D,0x02,0x8A,0x02,0x97,0x02,0xA4,0x02,0xB1,0x02, + 0xBE,0x02,0xCB,0x02,0xD8,0x02,0xE5,0x02,0xF2,0x02,0xFF,0x02,0x0C,0x03,0x19,0x03,0x26,0x03, + 0x33,0x03,0x40,0x03,0x4D,0x03,0x5A,0x03,0x67,0x03,0x74,0x03,0x81,0x03,0x8E,0x03,0x9B,0x03, + 0xA8,0x03,0xB5,0x03,0xC2,0x03,0xCF,0x03,0xDC,0x03,0xE9,0x03,0xF6,0x03,0x03,0x04,0x10,0x04, + 0x1D,0x04,0x2A,0x04,0x37,0x04,0x44,0x04,0x51,0x04,0x5E,0x04,0x6B,0x04,0x78,0x04,0x85,0x04, + 0x92,0x04,0x9F,0x04,0xAC,0x04,0xB9,0x04,0xC6,0x04,0xD3,0x04, - 7, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x21 '!' - 0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x10,0x00,0x00, + 7, // 0x21 '!' + 0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x10,0x00,0x00, - 7, // 0x22 '"' - 0x28,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x28,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x23 '#' - 0x00,0x28,0x28,0x7C,0x28,0x28,0x28,0x7C,0x28,0x28,0x00,0x00, + 7, // 0x23 '#' + 0x00,0x28,0x28,0x7C,0x28,0x28,0x28,0x7C,0x28,0x28,0x00,0x00, - 7, // 0x24 '$' - 0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x00,0x00, + 7, // 0x24 '$' + 0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x00,0x00, - 7, // 0x25 '%' - 0x34,0x54,0x68,0x08,0x10,0x10,0x20,0x2C,0x54,0x58,0x00,0x00, + 7, // 0x25 '%' + 0x34,0x54,0x68,0x08,0x10,0x10,0x20,0x2C,0x54,0x58,0x00,0x00, - 7, // 0x26 '&' - 0x00,0x20,0x50,0x50,0x20,0x54,0x54,0x48,0x34,0x00,0x00,0x00, + 7, // 0x26 '&' + 0x00,0x20,0x50,0x50,0x20,0x54,0x54,0x48,0x34,0x00,0x00,0x00, - 7, // 0x27 ''' - 0x00,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x27 ''' + 0x00,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x28 '(' - 0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x00, + 7, // 0x28 '(' + 0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x00, - 7, // 0x29 ')' - 0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x00, + 7, // 0x29 ')' + 0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x00, - 7, // 0x2A '*' - 0x00,0x00,0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x00, + 7, // 0x2A '*' + 0x00,0x00,0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x00, - 7, // 0x2B '+' - 0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00,0x00, + 7, // 0x2B '+' + 0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00,0x00, - 7, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40,0x00, + 7, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40,0x00, - 7, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, + 7, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, - 7, // 0x2F '/' - 0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00, + 7, // 0x2F '/' + 0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00, - 7, // 0x30 '0' - 0x00,0x38,0x44,0x44,0x54,0x54,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x30 '0' + 0x00,0x38,0x44,0x44,0x54,0x54,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x31 '1' - 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 7, // 0x31 '1' + 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, - 7, // 0x32 '2' - 0x00,0x38,0x44,0x44,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, + 7, // 0x32 '2' + 0x00,0x38,0x44,0x44,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, - 7, // 0x33 '3' - 0x00,0x38,0x44,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x33 '3' + 0x00,0x38,0x44,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00,0x00, - 7, // 0x34 '4' - 0x00,0x08,0x18,0x28,0x28,0x48,0x7C,0x08,0x08,0x00,0x00,0x00, + 7, // 0x34 '4' + 0x00,0x08,0x18,0x28,0x28,0x48,0x7C,0x08,0x08,0x00,0x00,0x00, - 7, // 0x35 '5' - 0x00,0x7C,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x35 '5' + 0x00,0x7C,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00,0x00, - 7, // 0x36 '6' - 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x36 '6' + 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x37 '7' - 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x00,0x00,0x00, + 7, // 0x37 '7' + 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x00,0x00,0x00, - 7, // 0x38 '8' - 0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x38 '8' + 0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x39 '9' - 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x39 '9' + 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x44,0x38,0x00,0x00,0x00, - 7, // 0x3A ':' - 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00,0x00, + 7, // 0x3A ':' + 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00,0x00, - 7, // 0x3B ';' - 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x20,0x40,0x00, + 7, // 0x3B ';' + 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x20,0x40,0x00, - 7, // 0x3C '<' - 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00, + 7, // 0x3C '<' + 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00, - 7, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00, + 7, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00, - 7, // 0x3E '>' - 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00, + 7, // 0x3E '>' + 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00, - 7, // 0x3F '?' - 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, + 7, // 0x3F '?' + 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, - 7, // 0x40 '@' - 0x00,0x38,0x44,0x44,0x5C,0x54,0x4C,0x40,0x38,0x00,0x00,0x00, + 7, // 0x40 '@' + 0x00,0x38,0x44,0x44,0x5C,0x54,0x4C,0x40,0x38,0x00,0x00,0x00, - 7, // 0x41 'A' - 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x41 'A' + 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x42 'B' - 0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00,0x00, + 7, // 0x42 'B' + 0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00,0x00, - 7, // 0x43 'C' - 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00,0x00, + 7, // 0x43 'C' + 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00,0x00, - 7, // 0x44 'D' - 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00,0x00, + 7, // 0x44 'D' + 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00,0x00, - 7, // 0x45 'E' - 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00,0x00, + 7, // 0x45 'E' + 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00,0x00, - 7, // 0x46 'F' - 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 7, // 0x46 'F' + 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 7, // 0x47 'G' - 0x00,0x38,0x44,0x40,0x40,0x4C,0x44,0x4C,0x34,0x00,0x00,0x00, + 7, // 0x47 'G' + 0x00,0x38,0x44,0x40,0x40,0x4C,0x44,0x4C,0x34,0x00,0x00,0x00, - 7, // 0x48 'H' - 0x00,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x48 'H' + 0x00,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x49 'I' - 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 7, // 0x49 'I' + 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, - 7, // 0x4A 'J' - 0x00,0x1C,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00,0x00, + 7, // 0x4A 'J' + 0x00,0x1C,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00,0x00, - 7, // 0x4B 'K' - 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x00,0x00,0x00, + 7, // 0x4B 'K' + 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x00,0x00,0x00, - 7, // 0x4C 'L' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00,0x00, + 7, // 0x4C 'L' + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00,0x00, - 7, // 0x4D 'M' - 0x00,0x44,0x6C,0x54,0x54,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x4D 'M' + 0x00,0x44,0x6C,0x54,0x54,0x44,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x4E 'N' - 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x00,0x00,0x00, + 7, // 0x4E 'N' + 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x00,0x00,0x00, - 7, // 0x4F 'O' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x4F 'O' + 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x50 'P' - 0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00,0x00, + 7, // 0x50 'P' + 0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00,0x00, - 7, // 0x51 'Q' - 0x00,0x38,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00,0x00, + 7, // 0x51 'Q' + 0x00,0x38,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00,0x00, - 7, // 0x52 'R' - 0x00,0x78,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00,0x00, + 7, // 0x52 'R' + 0x00,0x78,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00,0x00, - 7, // 0x53 'S' - 0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x53 'S' + 0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x54 'T' - 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, + 7, // 0x54 'T' + 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, - 7, // 0x55 'U' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x55 'U' + 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x56 'V' - 0x00,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00,0x00, + 7, // 0x56 'V' + 0x00,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00,0x00, - 7, // 0x57 'W' - 0x00,0x44,0x44,0x44,0x44,0x44,0x54,0x54,0x28,0x00,0x00,0x00, + 7, // 0x57 'W' + 0x00,0x44,0x44,0x44,0x44,0x44,0x54,0x54,0x28,0x00,0x00,0x00, - 7, // 0x58 'X' - 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x58 'X' + 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x59 'Y' - 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00,0x00, + 7, // 0x59 'Y' + 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00,0x00, - 7, // 0x5A 'Z' - 0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00,0x00, + 7, // 0x5A 'Z' + 0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00,0x00, - 7, // 0x5B '[' - 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, + 7, // 0x5B '[' + 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, - 7, // 0x5C '\' - 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, + 7, // 0x5C '\' + 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, - 7, // 0x5D ']' - 0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, + 7, // 0x5D ']' + 0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, - 7, // 0x5E '^' - 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x5E '^' + 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00, + 7, // 0x5F '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00, - 7, // 0x60 '`' - 0x00,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x60 '`' + 0x00,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x3C,0x00,0x00,0x00, + 7, // 0x61 'a' + 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x3C,0x00,0x00,0x00, - 7, // 0x62 'b' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00,0x00, + 7, // 0x62 'b' + 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00,0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x00,0x00, + 7, // 0x63 'c' + 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x00,0x00, - 7, // 0x64 'd' - 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x3C,0x00,0x00,0x00, + 7, // 0x64 'd' + 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x3C,0x00,0x00,0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x38,0x44,0x7C,0x40,0x44,0x38,0x00,0x00,0x00, + 7, // 0x65 'e' + 0x00,0x00,0x00,0x38,0x44,0x7C,0x40,0x44,0x38,0x00,0x00,0x00, - 7, // 0x66 'f' - 0x00,0x0C,0x10,0x38,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, + 7, // 0x66 'f' + 0x00,0x0C,0x10,0x38,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x44,0x38, + 7, // 0x67 'g' + 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x44,0x38, - 7, // 0x68 'h' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x68 'h' + 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x69 'i' - 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 7, // 0x69 'i' + 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, - 7, // 0x6A 'j' - 0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30, + 7, // 0x6A 'j' + 0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30, - 7, // 0x6B 'k' - 0x00,0x40,0x40,0x4C,0x50,0x60,0x50,0x48,0x44,0x00,0x00,0x00, + 7, // 0x6B 'k' + 0x00,0x40,0x40,0x4C,0x50,0x60,0x50,0x48,0x44,0x00,0x00,0x00, - 7, // 0x6C 'l' - 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 7, // 0x6C 'l' + 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, - 7, // 0x6D 'm' - 0x00,0x00,0x00,0x68,0x54,0x54,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x6D 'm' + 0x00,0x00,0x00,0x68,0x54,0x54,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x6E 'n' - 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x6E 'n' + 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x44,0x00,0x00,0x00, - 7, // 0x6F 'o' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x6F 'o' + 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40, + 7, // 0x70 'p' + 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x04,0x04, + 7, // 0x71 'q' + 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x04,0x04, - 7, // 0x72 'r' - 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x70,0x00,0x00,0x00, + 7, // 0x72 'r' + 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x70,0x00,0x00,0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x38,0x44,0x30,0x08,0x44,0x38,0x00,0x00,0x00, + 7, // 0x73 's' + 0x00,0x00,0x00,0x38,0x44,0x30,0x08,0x44,0x38,0x00,0x00,0x00, - 7, // 0x74 't' - 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x24,0x18,0x00,0x00,0x00, + 7, // 0x74 't' + 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x24,0x18,0x00,0x00,0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00,0x00, + 7, // 0x75 'u' + 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00,0x00, - 7, // 0x76 'v' - 0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00,0x00, + 7, // 0x76 'v' + 0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00,0x00, - 7, // 0x77 'w' - 0x00,0x00,0x00,0x44,0x44,0x44,0x54,0x54,0x28,0x00,0x00,0x00, + 7, // 0x77 'w' + 0x00,0x00,0x00,0x44,0x44,0x44,0x54,0x54,0x28,0x00,0x00,0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00,0x00, + 7, // 0x78 'x' + 0x00,0x00,0x00,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00,0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x08,0x70, + 7, // 0x79 'y' + 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x08,0x70, - 7, // 0x7A 'z' - 0x00,0x00,0x00,0x7C,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, + 7, // 0x7A 'z' + 0x00,0x00,0x00,0x7C,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, - 7, // 0x7B '{' - 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00, + 7, // 0x7B '{' + 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00, - 7, // 0x7C '|' - 0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, + 7, // 0x7C '|' + 0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, - 7, // 0x7D '}' - 0x60,0x10,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x10,0x60,0x00, + 7, // 0x7D '}' + 0x60,0x10,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x10,0x60,0x00, - 7, // 0x7E '~' - 0x00,0x24,0x54,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7E '~' + 0x00,0x24,0x54,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x7F '' - 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7F '' + 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u verdana12[] = - { - 12, 3, 32, 128-32, - 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x5A,0x00,0x67,0x00,0x74,0x00, - 0x81,0x00,0x8E,0x00,0x9B,0x00,0xA8,0x00,0xB5,0x00,0xC2,0x00,0xCF,0x00,0xDC,0x00,0xE9,0x00, - 0xF6,0x00,0x03,0x01,0x10,0x01,0x1D,0x01,0x2A,0x01,0x37,0x01,0x44,0x01,0x51,0x01,0x5E,0x01, - 0x6B,0x01,0x78,0x01,0x85,0x01,0x92,0x01,0x9F,0x01,0xAC,0x01,0xC5,0x01,0xD2,0x01,0xDF,0x01, - 0xEC,0x01,0xF9,0x01,0x06,0x02,0x13,0x02,0x20,0x02,0x2D,0x02,0x3A,0x02,0x47,0x02,0x54,0x02, - 0x61,0x02,0x7A,0x02,0x87,0x02,0xA0,0x02,0xAD,0x02,0xC6,0x02,0xD3,0x02,0xE0,0x02,0xED,0x02, - 0xFA,0x02,0x07,0x03,0x20,0x03,0x2D,0x03,0x3A,0x03,0x47,0x03,0x54,0x03,0x61,0x03,0x6E,0x03, - 0x7B,0x03,0x88,0x03,0x95,0x03,0xA2,0x03,0xAF,0x03,0xBC,0x03,0xC9,0x03,0xD6,0x03,0xE3,0x03, - 0xF0,0x03,0xFD,0x03,0x0A,0x04,0x17,0x04,0x24,0x04,0x31,0x04,0x4A,0x04,0x57,0x04,0x64,0x04, - 0x71,0x04,0x7E,0x04,0x8B,0x04,0x98,0x04,0xA5,0x04,0xB2,0x04,0xBF,0x04,0xCC,0x04,0xD9,0x04, - 0xE6,0x04,0xF3,0x04,0x00,0x05,0x0D,0x05,0x1A,0x05,0x27,0x05, +const int8u verdana12[] = +{ + 12, 3, 32, 128-32, + 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x5A,0x00,0x67,0x00,0x74,0x00, + 0x81,0x00,0x8E,0x00,0x9B,0x00,0xA8,0x00,0xB5,0x00,0xC2,0x00,0xCF,0x00,0xDC,0x00,0xE9,0x00, + 0xF6,0x00,0x03,0x01,0x10,0x01,0x1D,0x01,0x2A,0x01,0x37,0x01,0x44,0x01,0x51,0x01,0x5E,0x01, + 0x6B,0x01,0x78,0x01,0x85,0x01,0x92,0x01,0x9F,0x01,0xAC,0x01,0xC5,0x01,0xD2,0x01,0xDF,0x01, + 0xEC,0x01,0xF9,0x01,0x06,0x02,0x13,0x02,0x20,0x02,0x2D,0x02,0x3A,0x02,0x47,0x02,0x54,0x02, + 0x61,0x02,0x7A,0x02,0x87,0x02,0xA0,0x02,0xAD,0x02,0xC6,0x02,0xD3,0x02,0xE0,0x02,0xED,0x02, + 0xFA,0x02,0x07,0x03,0x20,0x03,0x2D,0x03,0x3A,0x03,0x47,0x03,0x54,0x03,0x61,0x03,0x6E,0x03, + 0x7B,0x03,0x88,0x03,0x95,0x03,0xA2,0x03,0xAF,0x03,0xBC,0x03,0xC9,0x03,0xD6,0x03,0xE3,0x03, + 0xF0,0x03,0xFD,0x03,0x0A,0x04,0x17,0x04,0x24,0x04,0x31,0x04,0x4A,0x04,0x57,0x04,0x64,0x04, + 0x71,0x04,0x7E,0x04,0x8B,0x04,0x98,0x04,0xA5,0x04,0xB2,0x04,0xBF,0x04,0xCC,0x04,0xD9,0x04, + 0xE6,0x04,0xF3,0x04,0x00,0x05,0x0D,0x05,0x1A,0x05,0x27,0x05, - 3, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x21 '!' - 0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, + 5, // 0x21 '!' + 0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, - 5, // 0x22 '"' - 0x00,0x00,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x22 '"' + 0x00,0x00,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x28,0x7C,0x28,0x7C,0x28,0x00,0x00,0x00, + 7, // 0x23 '#' + 0x00,0x00,0x00,0x00,0x28,0x7C,0x28,0x7C,0x28,0x00,0x00,0x00, - 7, // 0x24 '$' - 0x00,0x00,0x10,0x10,0x3C,0x50,0x30,0x18,0x14,0x78,0x10,0x10, + 7, // 0x24 '$' + 0x00,0x00,0x10,0x10,0x3C,0x50,0x30,0x18,0x14,0x78,0x10,0x10, - 11, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x4A,0x00,0x4A,0x00,0x35,0x80,0x0A,0x40,0x0A,0x40,0x11,0x80,0x00,0x00,0x00,0x00, + 11, // 0x25 '%' + 0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x4A,0x00,0x4A,0x00,0x35,0x80,0x0A,0x40,0x0A,0x40,0x11,0x80,0x00,0x00,0x00,0x00, - 7, // 0x26 '&' - 0x00,0x00,0x00,0x30,0x48,0x48,0x32,0x4A,0x44,0x3A,0x00,0x00, + 7, // 0x26 '&' + 0x00,0x00,0x00,0x30,0x48,0x48,0x32,0x4A,0x44,0x3A,0x00,0x00, - 3, // 0x27 ''' - 0x00,0x00,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x27 ''' + 0x00,0x00,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x28 '(' - 0x00,0x00,0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x10, + 4, // 0x28 '(' + 0x00,0x00,0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x10, - 4, // 0x29 ')' - 0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x80, + 4, // 0x29 ')' + 0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x80, - 7, // 0x2A '*' - 0x00,0x10,0x54,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2A '*' + 0x00,0x10,0x54,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, + 7, // 0x2B '+' + 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, - 3, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x80,0x00, + 3, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x80,0x00, - 5, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00, + 5, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00, - 3, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x00, + 3, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x00, - 4, // 0x2F '/' - 0x00,0x00,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x80,0x80,0x00, + 4, // 0x2F '/' + 0x00,0x00,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x80,0x80,0x00, - 7, // 0x30 '0' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x30 '0' + 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x31 '1' - 0x00,0x00,0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x31 '1' + 0x00,0x00,0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00, - 7, // 0x32 '2' - 0x00,0x00,0x00,0x38,0x44,0x04,0x08,0x10,0x20,0x7C,0x00,0x00, + 7, // 0x32 '2' + 0x00,0x00,0x00,0x38,0x44,0x04,0x08,0x10,0x20,0x7C,0x00,0x00, - 7, // 0x33 '3' - 0x00,0x00,0x00,0x38,0x44,0x04,0x18,0x04,0x44,0x38,0x00,0x00, + 7, // 0x33 '3' + 0x00,0x00,0x00,0x38,0x44,0x04,0x18,0x04,0x44,0x38,0x00,0x00, - 7, // 0x34 '4' - 0x00,0x00,0x00,0x08,0x18,0x28,0x48,0x7C,0x08,0x08,0x00,0x00, + 7, // 0x34 '4' + 0x00,0x00,0x00,0x08,0x18,0x28,0x48,0x7C,0x08,0x08,0x00,0x00, - 7, // 0x35 '5' - 0x00,0x00,0x00,0x7C,0x40,0x78,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x35 '5' + 0x00,0x00,0x00,0x7C,0x40,0x78,0x04,0x04,0x44,0x38,0x00,0x00, - 7, // 0x36 '6' - 0x00,0x00,0x00,0x18,0x20,0x40,0x78,0x44,0x44,0x38,0x00,0x00, + 7, // 0x36 '6' + 0x00,0x00,0x00,0x18,0x20,0x40,0x78,0x44,0x44,0x38,0x00,0x00, - 7, // 0x37 '7' - 0x00,0x00,0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x10,0x00,0x00, + 7, // 0x37 '7' + 0x00,0x00,0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x10,0x00,0x00, - 7, // 0x38 '8' - 0x00,0x00,0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x38,0x00,0x00, + 7, // 0x38 '8' + 0x00,0x00,0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x38,0x00,0x00, - 7, // 0x39 '9' - 0x00,0x00,0x00,0x38,0x44,0x44,0x3C,0x04,0x08,0x30,0x00,0x00, + 7, // 0x39 '9' + 0x00,0x00,0x00,0x38,0x44,0x44,0x3C,0x04,0x08,0x30,0x00,0x00, - 4, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x40,0x40,0x00,0x00, + 4, // 0x3A ':' + 0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x40,0x40,0x00,0x00, - 4, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x40,0x40,0x80,0x00, + 4, // 0x3B ';' + 0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x40,0x40,0x80,0x00, - 7, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x04,0x18,0x60,0x18,0x04,0x00,0x00,0x00, + 7, // 0x3C '<' + 0x00,0x00,0x00,0x00,0x04,0x18,0x60,0x18,0x04,0x00,0x00,0x00, - 7, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x7C,0x00,0x00,0x00,0x00, + 7, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x7C,0x00,0x00,0x00,0x00, - 7, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x40,0x30,0x0C,0x30,0x40,0x00,0x00,0x00, + 7, // 0x3E '>' + 0x00,0x00,0x00,0x00,0x40,0x30,0x0C,0x30,0x40,0x00,0x00,0x00, - 6, // 0x3F '?' - 0x00,0x00,0x00,0x70,0x08,0x08,0x10,0x20,0x00,0x20,0x00,0x00, + 6, // 0x3F '?' + 0x00,0x00,0x00,0x70,0x08,0x08,0x10,0x20,0x00,0x20,0x00,0x00, - 10, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x20,0x80,0x4E,0x80,0x52,0x80,0x52,0x80,0x4D,0x00,0x20,0x00,0x1F,0x00,0x00,0x00, + 10, // 0x40 '@' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x20,0x80,0x4E,0x80,0x52,0x80,0x52,0x80,0x4D,0x00,0x20,0x00,0x1F,0x00,0x00,0x00, - 8, // 0x41 'A' - 0x00,0x00,0x00,0x18,0x18,0x24,0x24,0x7E,0x42,0x42,0x00,0x00, + 8, // 0x41 'A' + 0x00,0x00,0x00,0x18,0x18,0x24,0x24,0x7E,0x42,0x42,0x00,0x00, - 7, // 0x42 'B' - 0x00,0x00,0x00,0x70,0x48,0x48,0x78,0x44,0x44,0x78,0x00,0x00, + 7, // 0x42 'B' + 0x00,0x00,0x00,0x70,0x48,0x48,0x78,0x44,0x44,0x78,0x00,0x00, - 8, // 0x43 'C' - 0x00,0x00,0x00,0x1C,0x22,0x40,0x40,0x40,0x22,0x1C,0x00,0x00, + 8, // 0x43 'C' + 0x00,0x00,0x00,0x1C,0x22,0x40,0x40,0x40,0x22,0x1C,0x00,0x00, - 8, // 0x44 'D' - 0x00,0x00,0x00,0x78,0x44,0x42,0x42,0x42,0x44,0x78,0x00,0x00, + 8, // 0x44 'D' + 0x00,0x00,0x00,0x78,0x44,0x42,0x42,0x42,0x44,0x78,0x00,0x00, - 7, // 0x45 'E' - 0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x7C,0x00,0x00, + 7, // 0x45 'E' + 0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x7C,0x00,0x00, - 6, // 0x46 'F' - 0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x00,0x00, + 6, // 0x46 'F' + 0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x00,0x00, - 8, // 0x47 'G' - 0x00,0x00,0x00,0x1C,0x22,0x40,0x4E,0x42,0x22,0x1C,0x00,0x00, + 8, // 0x47 'G' + 0x00,0x00,0x00,0x1C,0x22,0x40,0x4E,0x42,0x22,0x1C,0x00,0x00, - 8, // 0x48 'H' - 0x00,0x00,0x00,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x00,0x00, + 8, // 0x48 'H' + 0x00,0x00,0x00,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x00,0x00, - 5, // 0x49 'I' - 0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 5, // 0x49 'I' + 0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, - 5, // 0x4A 'J' - 0x00,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0xE0,0x00,0x00, + 5, // 0x4A 'J' + 0x00,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0xE0,0x00,0x00, - 7, // 0x4B 'K' - 0x00,0x00,0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, + 7, // 0x4B 'K' + 0x00,0x00,0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, - 6, // 0x4C 'L' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x4C 'L' + 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, - 9, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x55,0x00,0x55,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4D 'M' + 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x55,0x00,0x55,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x00,0x00,0x00,0x00, - 8, // 0x4E 'N' - 0x00,0x00,0x00,0x42,0x62,0x52,0x4A,0x46,0x42,0x42,0x00,0x00, + 8, // 0x4E 'N' + 0x00,0x00,0x00,0x42,0x62,0x52,0x4A,0x46,0x42,0x42,0x00,0x00, - 9, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4F 'O' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, - 7, // 0x50 'P' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x00,0x00, + 7, // 0x50 'P' + 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x00,0x00, - 9, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x04,0x00,0x03,0x00, + 9, // 0x51 'Q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x04,0x00,0x03,0x00, - 7, // 0x52 'R' - 0x00,0x00,0x00,0x78,0x44,0x44,0x78,0x50,0x48,0x44,0x00,0x00, + 7, // 0x52 'R' + 0x00,0x00,0x00,0x78,0x44,0x44,0x78,0x50,0x48,0x44,0x00,0x00, - 7, // 0x53 'S' - 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00, + 7, // 0x53 'S' + 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00, - 7, // 0x54 'T' - 0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x54 'T' + 0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, - 8, // 0x55 'U' - 0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, + 8, // 0x55 'U' + 0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, - 8, // 0x56 'V' - 0x00,0x00,0x00,0x42,0x42,0x42,0x24,0x24,0x18,0x18,0x00,0x00, + 8, // 0x56 'V' + 0x00,0x00,0x00,0x42,0x42,0x42,0x24,0x24,0x18,0x18,0x00,0x00, - 9, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x55,0x00,0x55,0x00,0x22,0x00,0x22,0x00,0x00,0x00,0x00,0x00, + 9, // 0x57 'W' + 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x55,0x00,0x55,0x00,0x22,0x00,0x22,0x00,0x00,0x00,0x00,0x00, - 7, // 0x58 'X' - 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, + 7, // 0x58 'X' + 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, - 7, // 0x59 'Y' - 0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x10,0x10,0x00,0x00, + 7, // 0x59 'Y' + 0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x10,0x10,0x00,0x00, - 7, // 0x5A 'Z' - 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 7, // 0x5A 'Z' + 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, - 4, // 0x5B '[' - 0x00,0x00,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x60, + 4, // 0x5B '[' + 0x00,0x00,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x60, - 4, // 0x5C '\' - 0x00,0x00,0x80,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x00, + 4, // 0x5C '\' + 0x00,0x00,0x80,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x00, - 4, // 0x5D ']' - 0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, + 4, // 0x5D ']' + 0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, - 7, // 0x5E '^' - 0x00,0x00,0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x5E '^' + 0x00,0x00,0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC, + 6, // 0x5F '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC, - 6, // 0x60 '`' - 0x00,0x00,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x60 '`' + 0x00,0x00,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x30,0x08,0x38,0x48,0x38,0x00,0x00, + 6, // 0x61 'a' + 0x00,0x00,0x00,0x00,0x00,0x30,0x08,0x38,0x48,0x38,0x00,0x00, - 6, // 0x62 'b' - 0x00,0x00,0x40,0x40,0x40,0x70,0x48,0x48,0x48,0x70,0x00,0x00, + 6, // 0x62 'b' + 0x00,0x00,0x40,0x40,0x40,0x70,0x48,0x48,0x48,0x70,0x00,0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x40,0x40,0x38,0x00,0x00, + 6, // 0x63 'c' + 0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x40,0x40,0x38,0x00,0x00, - 6, // 0x64 'd' - 0x00,0x00,0x08,0x08,0x08,0x38,0x48,0x48,0x48,0x38,0x00,0x00, + 6, // 0x64 'd' + 0x00,0x00,0x08,0x08,0x08,0x38,0x48,0x48,0x48,0x38,0x00,0x00, - 6, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x78,0x40,0x38,0x00,0x00, + 6, // 0x65 'e' + 0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x78,0x40,0x38,0x00,0x00, - 4, // 0x66 'f' - 0x00,0x00,0x30,0x40,0x40,0xE0,0x40,0x40,0x40,0x40,0x00,0x00, + 4, // 0x66 'f' + 0x00,0x00,0x30,0x40,0x40,0xE0,0x40,0x40,0x40,0x40,0x00,0x00, - 6, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x48,0x48,0x38,0x08,0x30, + 6, // 0x67 'g' + 0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x48,0x48,0x38,0x08,0x30, - 6, // 0x68 'h' - 0x00,0x00,0x40,0x40,0x40,0x70,0x48,0x48,0x48,0x48,0x00,0x00, + 6, // 0x68 'h' + 0x00,0x00,0x40,0x40,0x40,0x70,0x48,0x48,0x48,0x48,0x00,0x00, - 3, // 0x69 'i' - 0x00,0x00,0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x69 'i' + 0x00,0x00,0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x00,0x00, - 3, // 0x6A 'j' - 0x00,0x00,0x00,0x40,0x00,0xC0,0x40,0x40,0x40,0x40,0x40,0x80, + 3, // 0x6A 'j' + 0x00,0x00,0x00,0x40,0x00,0xC0,0x40,0x40,0x40,0x40,0x40,0x80, - 6, // 0x6B 'k' - 0x00,0x00,0x40,0x40,0x40,0x48,0x50,0x60,0x50,0x48,0x00,0x00, + 6, // 0x6B 'k' + 0x00,0x00,0x40,0x40,0x40,0x48,0x50,0x60,0x50,0x48,0x00,0x00, - 3, // 0x6C 'l' - 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x6C 'l' + 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, - 9, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6D 'm' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x00,0x00,0x00,0x00, - 6, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x70,0x48,0x48,0x48,0x48,0x00,0x00, + 6, // 0x6E 'n' + 0x00,0x00,0x00,0x00,0x00,0x70,0x48,0x48,0x48,0x48,0x00,0x00, - 6, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x48,0x48,0x30,0x00,0x00, + 6, // 0x6F 'o' + 0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x48,0x48,0x30,0x00,0x00, - 6, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x70,0x48,0x48,0x48,0x70,0x40,0x40, + 6, // 0x70 'p' + 0x00,0x00,0x00,0x00,0x00,0x70,0x48,0x48,0x48,0x70,0x40,0x40, - 6, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x48,0x48,0x38,0x08,0x08, + 6, // 0x71 'q' + 0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x48,0x48,0x38,0x08,0x08, - 4, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x50,0x60,0x40,0x40,0x40,0x00,0x00, + 4, // 0x72 'r' + 0x00,0x00,0x00,0x00,0x00,0x50,0x60,0x40,0x40,0x40,0x00,0x00, - 6, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x30,0x08,0x70,0x00,0x00, + 6, // 0x73 's' + 0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x30,0x08,0x70,0x00,0x00, - 4, // 0x74 't' - 0x00,0x00,0x00,0x00,0x40,0xF0,0x40,0x40,0x40,0x30,0x00,0x00, + 4, // 0x74 't' + 0x00,0x00,0x00,0x00,0x40,0xF0,0x40,0x40,0x40,0x30,0x00,0x00, - 6, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x48,0x48,0x38,0x00,0x00, + 6, // 0x75 'u' + 0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x48,0x48,0x38,0x00,0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x48,0x30,0x30,0x00,0x00, + 6, // 0x76 'v' + 0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x48,0x30,0x30,0x00,0x00, - 7, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x44,0x54,0x54,0x28,0x28,0x00,0x00, + 7, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x00,0x44,0x54,0x54,0x28,0x28,0x00,0x00, - 6, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x30,0x48,0x48,0x00,0x00, + 6, // 0x78 'x' + 0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x30,0x48,0x48,0x00,0x00, - 6, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x48,0x30,0x10,0x20,0x20, + 6, // 0x79 'y' + 0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x48,0x30,0x10,0x20,0x20, - 5, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x70,0x10,0x20,0x40,0x70,0x00,0x00, + 5, // 0x7A 'z' + 0x00,0x00,0x00,0x00,0x00,0x70,0x10,0x20,0x40,0x70,0x00,0x00, - 6, // 0x7B '{' - 0x00,0x00,0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x18, + 6, // 0x7B '{' + 0x00,0x00,0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x18, - 5, // 0x7C '|' - 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 5, // 0x7C '|' + 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, - 6, // 0x7D '}' - 0x00,0x00,0x60,0x10,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x60, + 6, // 0x7D '}' + 0x00,0x00,0x60,0x10,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x60, - 7, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x58,0x00,0x00,0x00,0x00, + 7, // 0x7E '~' + 0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x58,0x00,0x00,0x00,0x00, - 9, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7F,0x00,0x00,0x00,0x00,0x00, + 9, // 0x7F '' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7F,0x00,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u verdana12_bold[] = - { - 12, 3, 32, 128-32, - 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x5A,0x00,0x67,0x00,0x74,0x00, - 0x81,0x00,0x8E,0x00,0x9B,0x00,0xA8,0x00,0xB5,0x00,0xC2,0x00,0xCF,0x00,0xDC,0x00,0xE9,0x00, - 0xF6,0x00,0x03,0x01,0x10,0x01,0x1D,0x01,0x2A,0x01,0x37,0x01,0x44,0x01,0x51,0x01,0x5E,0x01, - 0x6B,0x01,0x78,0x01,0x85,0x01,0x92,0x01,0x9F,0x01,0xAC,0x01,0xC5,0x01,0xD2,0x01,0xDF,0x01, - 0xEC,0x01,0xF9,0x01,0x06,0x02,0x13,0x02,0x20,0x02,0x2D,0x02,0x3A,0x02,0x47,0x02,0x54,0x02, - 0x61,0x02,0x6E,0x02,0x7B,0x02,0x88,0x02,0x95,0x02,0xA2,0x02,0xAF,0x02,0xBC,0x02,0xC9,0x02, - 0xD6,0x02,0xE3,0x02,0xFC,0x02,0x09,0x03,0x16,0x03,0x23,0x03,0x30,0x03,0x3D,0x03,0x4A,0x03, - 0x57,0x03,0x64,0x03,0x71,0x03,0x7E,0x03,0x8B,0x03,0x98,0x03,0xA5,0x03,0xB2,0x03,0xBF,0x03, - 0xCC,0x03,0xD9,0x03,0xE6,0x03,0xF3,0x03,0x00,0x04,0x0D,0x04,0x26,0x04,0x33,0x04,0x40,0x04, - 0x4D,0x04,0x5A,0x04,0x67,0x04,0x74,0x04,0x81,0x04,0x8E,0x04,0x9B,0x04,0xB4,0x04,0xC1,0x04, - 0xCE,0x04,0xDB,0x04,0xE8,0x04,0xF5,0x04,0x02,0x05,0x0F,0x05, +const int8u verdana12_bold[] = +{ + 12, 3, 32, 128-32, + 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x5A,0x00,0x67,0x00,0x74,0x00, + 0x81,0x00,0x8E,0x00,0x9B,0x00,0xA8,0x00,0xB5,0x00,0xC2,0x00,0xCF,0x00,0xDC,0x00,0xE9,0x00, + 0xF6,0x00,0x03,0x01,0x10,0x01,0x1D,0x01,0x2A,0x01,0x37,0x01,0x44,0x01,0x51,0x01,0x5E,0x01, + 0x6B,0x01,0x78,0x01,0x85,0x01,0x92,0x01,0x9F,0x01,0xAC,0x01,0xC5,0x01,0xD2,0x01,0xDF,0x01, + 0xEC,0x01,0xF9,0x01,0x06,0x02,0x13,0x02,0x20,0x02,0x2D,0x02,0x3A,0x02,0x47,0x02,0x54,0x02, + 0x61,0x02,0x6E,0x02,0x7B,0x02,0x88,0x02,0x95,0x02,0xA2,0x02,0xAF,0x02,0xBC,0x02,0xC9,0x02, + 0xD6,0x02,0xE3,0x02,0xFC,0x02,0x09,0x03,0x16,0x03,0x23,0x03,0x30,0x03,0x3D,0x03,0x4A,0x03, + 0x57,0x03,0x64,0x03,0x71,0x03,0x7E,0x03,0x8B,0x03,0x98,0x03,0xA5,0x03,0xB2,0x03,0xBF,0x03, + 0xCC,0x03,0xD9,0x03,0xE6,0x03,0xF3,0x03,0x00,0x04,0x0D,0x04,0x26,0x04,0x33,0x04,0x40,0x04, + 0x4D,0x04,0x5A,0x04,0x67,0x04,0x74,0x04,0x81,0x04,0x8E,0x04,0x9B,0x04,0xB4,0x04,0xC1,0x04, + 0xCE,0x04,0xDB,0x04,0xE8,0x04,0xF5,0x04,0x02,0x05,0x0F,0x05, - 3, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x21 '!' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x00,0x60,0x00,0x00, + 4, // 0x21 '!' + 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x00,0x60,0x00,0x00, - 5, // 0x22 '"' - 0x00,0x00,0xD8,0xD8,0xD8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x22 '"' + 0x00,0x00,0xD8,0xD8,0xD8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x23 '#' - 0x00,0x00,0x00,0x14,0x14,0x7E,0x28,0xFC,0x50,0x50,0x00,0x00, + 8, // 0x23 '#' + 0x00,0x00,0x00,0x14,0x14,0x7E,0x28,0xFC,0x50,0x50,0x00,0x00, - 6, // 0x24 '$' - 0x00,0x00,0x20,0x20,0x70,0xE8,0xE0,0x38,0xB8,0x70,0x20,0x20, + 6, // 0x24 '$' + 0x00,0x00,0x20,0x20,0x70,0xE8,0xE0,0x38,0xB8,0x70,0x20,0x20, - 11, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x62,0x00,0x94,0x00,0x94,0x00,0x69,0x80,0x0A,0x40,0x0A,0x40,0x11,0x80,0x00,0x00,0x00,0x00, + 11, // 0x25 '%' + 0x00,0x00,0x00,0x00,0x00,0x00,0x62,0x00,0x94,0x00,0x94,0x00,0x69,0x80,0x0A,0x40,0x0A,0x40,0x11,0x80,0x00,0x00,0x00,0x00, - 8, // 0x26 '&' - 0x00,0x00,0x00,0x70,0xD8,0xD8,0x76,0xDC,0xCC,0x76,0x00,0x00, + 8, // 0x26 '&' + 0x00,0x00,0x00,0x70,0xD8,0xD8,0x76,0xDC,0xCC,0x76,0x00,0x00, - 3, // 0x27 ''' - 0x00,0x00,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x27 ''' + 0x00,0x00,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x28 '(' - 0x00,0x00,0x30,0x60,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x60,0x30, + 5, // 0x28 '(' + 0x00,0x00,0x30,0x60,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x60,0x30, - 5, // 0x29 ')' - 0x00,0x00,0xC0,0x60,0x30,0x30,0x30,0x30,0x30,0x30,0x60,0xC0, + 5, // 0x29 ')' + 0x00,0x00,0xC0,0x60,0x30,0x30,0x30,0x30,0x30,0x30,0x60,0xC0, - 6, // 0x2A '*' - 0x00,0x00,0x20,0xA8,0x70,0xA8,0x20,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2A '*' + 0x00,0x00,0x20,0xA8,0x70,0xA8,0x20,0x00,0x00,0x00,0x00,0x00, - 8, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, + 8, // 0x2B '+' + 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, - 3, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x80,0x00, + 3, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x80,0x00, - 4, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00, + 4, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00, - 3, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00,0x00, + 3, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00,0x00, - 6, // 0x2F '/' - 0x00,0x00,0x08,0x08,0x10,0x10,0x20,0x40,0x40,0x80,0x80,0x00, + 6, // 0x2F '/' + 0x00,0x00,0x08,0x08,0x10,0x10,0x20,0x40,0x40,0x80,0x80,0x00, - 6, // 0x30 '0' - 0x00,0x00,0x00,0x70,0xD8,0xD8,0xD8,0xD8,0xD8,0x70,0x00,0x00, + 6, // 0x30 '0' + 0x00,0x00,0x00,0x70,0xD8,0xD8,0xD8,0xD8,0xD8,0x70,0x00,0x00, - 6, // 0x31 '1' - 0x00,0x00,0x00,0x30,0x70,0x30,0x30,0x30,0x30,0x78,0x00,0x00, + 6, // 0x31 '1' + 0x00,0x00,0x00,0x30,0x70,0x30,0x30,0x30,0x30,0x78,0x00,0x00, - 6, // 0x32 '2' - 0x00,0x00,0x00,0x70,0x98,0x18,0x30,0x60,0xC0,0xF8,0x00,0x00, + 6, // 0x32 '2' + 0x00,0x00,0x00,0x70,0x98,0x18,0x30,0x60,0xC0,0xF8,0x00,0x00, - 6, // 0x33 '3' - 0x00,0x00,0x00,0x70,0x98,0x18,0x70,0x18,0x98,0x70,0x00,0x00, + 6, // 0x33 '3' + 0x00,0x00,0x00,0x70,0x98,0x18,0x70,0x18,0x98,0x70,0x00,0x00, - 6, // 0x34 '4' - 0x00,0x00,0x00,0x18,0x38,0x58,0x98,0xFC,0x18,0x18,0x00,0x00, + 6, // 0x34 '4' + 0x00,0x00,0x00,0x18,0x38,0x58,0x98,0xFC,0x18,0x18,0x00,0x00, - 6, // 0x35 '5' - 0x00,0x00,0x00,0xF8,0xC0,0xF0,0x18,0x18,0x98,0x70,0x00,0x00, + 6, // 0x35 '5' + 0x00,0x00,0x00,0xF8,0xC0,0xF0,0x18,0x18,0x98,0x70,0x00,0x00, - 6, // 0x36 '6' - 0x00,0x00,0x00,0x70,0xC0,0xF0,0xD8,0xD8,0xD8,0x70,0x00,0x00, + 6, // 0x36 '6' + 0x00,0x00,0x00,0x70,0xC0,0xF0,0xD8,0xD8,0xD8,0x70,0x00,0x00, - 6, // 0x37 '7' - 0x00,0x00,0x00,0xF8,0x18,0x30,0x30,0x60,0x60,0xC0,0x00,0x00, + 6, // 0x37 '7' + 0x00,0x00,0x00,0xF8,0x18,0x30,0x30,0x60,0x60,0xC0,0x00,0x00, - 6, // 0x38 '8' - 0x00,0x00,0x00,0x70,0xD8,0xD8,0x70,0xD8,0xD8,0x70,0x00,0x00, + 6, // 0x38 '8' + 0x00,0x00,0x00,0x70,0xD8,0xD8,0x70,0xD8,0xD8,0x70,0x00,0x00, - 6, // 0x39 '9' - 0x00,0x00,0x00,0x70,0xD8,0xD8,0xD8,0x78,0x18,0x70,0x00,0x00, + 6, // 0x39 '9' + 0x00,0x00,0x00,0x70,0xD8,0xD8,0xD8,0x78,0x18,0x70,0x00,0x00, - 4, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x00,0x00, + 4, // 0x3A ':' + 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x00,0x00, - 4, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x40,0x00, + 4, // 0x3B ';' + 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x40,0x00, - 8, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x04,0x18,0x60,0x60,0x18,0x04,0x00,0x00, + 8, // 0x3C '<' + 0x00,0x00,0x00,0x00,0x04,0x18,0x60,0x60,0x18,0x04,0x00,0x00, - 8, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x7C,0x00,0x00,0x00,0x00, + 8, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x7C,0x00,0x00,0x00,0x00, - 8, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x40,0x30,0x0C,0x0C,0x30,0x40,0x00,0x00, + 8, // 0x3E '>' + 0x00,0x00,0x00,0x00,0x40,0x30,0x0C,0x0C,0x30,0x40,0x00,0x00, - 6, // 0x3F '?' - 0x00,0x00,0x00,0xF0,0x18,0x18,0x30,0x60,0x00,0x60,0x00,0x00, + 6, // 0x3F '?' + 0x00,0x00,0x00,0xF0,0x18,0x18,0x30,0x60,0x00,0x60,0x00,0x00, - 9, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x42,0x00,0x9D,0x00,0xA5,0x00,0xA5,0x00,0x9E,0x00,0x40,0x00,0x3C,0x00,0x00,0x00, + 9, // 0x40 '@' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x42,0x00,0x9D,0x00,0xA5,0x00,0xA5,0x00,0x9E,0x00,0x40,0x00,0x3C,0x00,0x00,0x00, - 8, // 0x41 'A' - 0x00,0x00,0x00,0x38,0x38,0x6C,0x6C,0x7C,0xC6,0xC6,0x00,0x00, + 8, // 0x41 'A' + 0x00,0x00,0x00,0x38,0x38,0x6C,0x6C,0x7C,0xC6,0xC6,0x00,0x00, - 7, // 0x42 'B' - 0x00,0x00,0x00,0xF8,0xCC,0xCC,0xF8,0xCC,0xCC,0xF8,0x00,0x00, + 7, // 0x42 'B' + 0x00,0x00,0x00,0xF8,0xCC,0xCC,0xF8,0xCC,0xCC,0xF8,0x00,0x00, - 6, // 0x43 'C' - 0x00,0x00,0x00,0x70,0xC8,0xC0,0xC0,0xC0,0xC8,0x70,0x00,0x00, + 6, // 0x43 'C' + 0x00,0x00,0x00,0x70,0xC8,0xC0,0xC0,0xC0,0xC8,0x70,0x00,0x00, - 7, // 0x44 'D' - 0x00,0x00,0x00,0xF8,0xCC,0xCC,0xCC,0xCC,0xCC,0xF8,0x00,0x00, + 7, // 0x44 'D' + 0x00,0x00,0x00,0xF8,0xCC,0xCC,0xCC,0xCC,0xCC,0xF8,0x00,0x00, - 6, // 0x45 'E' - 0x00,0x00,0x00,0xF8,0xC0,0xC0,0xF8,0xC0,0xC0,0xF8,0x00,0x00, + 6, // 0x45 'E' + 0x00,0x00,0x00,0xF8,0xC0,0xC0,0xF8,0xC0,0xC0,0xF8,0x00,0x00, - 6, // 0x46 'F' - 0x00,0x00,0x00,0xF8,0xC0,0xC0,0xF8,0xC0,0xC0,0xC0,0x00,0x00, + 6, // 0x46 'F' + 0x00,0x00,0x00,0xF8,0xC0,0xC0,0xF8,0xC0,0xC0,0xC0,0x00,0x00, - 7, // 0x47 'G' - 0x00,0x00,0x00,0x78,0xC4,0xC0,0xC0,0xDC,0xCC,0x7C,0x00,0x00, + 7, // 0x47 'G' + 0x00,0x00,0x00,0x78,0xC4,0xC0,0xC0,0xDC,0xCC,0x7C,0x00,0x00, - 7, // 0x48 'H' - 0x00,0x00,0x00,0xCC,0xCC,0xCC,0xFC,0xCC,0xCC,0xCC,0x00,0x00, + 7, // 0x48 'H' + 0x00,0x00,0x00,0xCC,0xCC,0xCC,0xFC,0xCC,0xCC,0xCC,0x00,0x00, - 5, // 0x49 'I' - 0x00,0x00,0x00,0xF0,0x60,0x60,0x60,0x60,0x60,0xF0,0x00,0x00, + 5, // 0x49 'I' + 0x00,0x00,0x00,0xF0,0x60,0x60,0x60,0x60,0x60,0xF0,0x00,0x00, - 5, // 0x4A 'J' - 0x00,0x00,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0xE0,0x00,0x00, + 5, // 0x4A 'J' + 0x00,0x00,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0xE0,0x00,0x00, - 7, // 0x4B 'K' - 0x00,0x00,0x00,0xCC,0xD8,0xF0,0xE0,0xF0,0xD8,0xCC,0x00,0x00, + 7, // 0x4B 'K' + 0x00,0x00,0x00,0xCC,0xD8,0xF0,0xE0,0xF0,0xD8,0xCC,0x00,0x00, - 6, // 0x4C 'L' - 0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xF8,0x00,0x00, + 6, // 0x4C 'L' + 0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xF8,0x00,0x00, - 8, // 0x4D 'M' - 0x00,0x00,0x00,0x82,0xC6,0xEE,0xB6,0xB6,0x86,0x86,0x00,0x00, + 8, // 0x4D 'M' + 0x00,0x00,0x00,0x82,0xC6,0xEE,0xB6,0xB6,0x86,0x86,0x00,0x00, - 7, // 0x4E 'N' - 0x00,0x00,0x00,0x84,0xC4,0xE4,0xB4,0x9C,0x8C,0x84,0x00,0x00, + 7, // 0x4E 'N' + 0x00,0x00,0x00,0x84,0xC4,0xE4,0xB4,0x9C,0x8C,0x84,0x00,0x00, - 8, // 0x4F 'O' - 0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00, + 8, // 0x4F 'O' + 0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00, - 7, // 0x50 'P' - 0x00,0x00,0x00,0xF8,0xCC,0xCC,0xCC,0xF8,0xC0,0xC0,0x00,0x00, + 7, // 0x50 'P' + 0x00,0x00,0x00,0xF8,0xCC,0xCC,0xCC,0xF8,0xC0,0xC0,0x00,0x00, - 8, // 0x51 'Q' - 0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x18,0x0E, + 8, // 0x51 'Q' + 0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x18,0x0E, - 7, // 0x52 'R' - 0x00,0x00,0x00,0xF8,0xCC,0xCC,0xF8,0xD8,0xCC,0xC6,0x00,0x00, + 7, // 0x52 'R' + 0x00,0x00,0x00,0xF8,0xCC,0xCC,0xF8,0xD8,0xCC,0xC6,0x00,0x00, - 6, // 0x53 'S' - 0x00,0x00,0x00,0x70,0xC8,0xC0,0x70,0x18,0x98,0x70,0x00,0x00, + 6, // 0x53 'S' + 0x00,0x00,0x00,0x70,0xC8,0xC0,0x70,0x18,0x98,0x70,0x00,0x00, - 6, // 0x54 'T' - 0x00,0x00,0x00,0xFC,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00, + 6, // 0x54 'T' + 0x00,0x00,0x00,0xFC,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00, - 7, // 0x55 'U' - 0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x78,0x00,0x00, + 7, // 0x55 'U' + 0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x78,0x00,0x00, - 7, // 0x56 'V' - 0x00,0x00,0x00,0xCC,0xCC,0x78,0x78,0x78,0x30,0x30,0x00,0x00, + 7, // 0x56 'V' + 0x00,0x00,0x00,0xCC,0xCC,0x78,0x78,0x78,0x30,0x30,0x00,0x00, - 11, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0xCC,0xC0,0xCC,0xC0,0x6D,0x80,0x6D,0x80,0x73,0x80,0x33,0x00,0x33,0x00,0x00,0x00,0x00,0x00, + 11, // 0x57 'W' + 0x00,0x00,0x00,0x00,0x00,0x00,0xCC,0xC0,0xCC,0xC0,0x6D,0x80,0x6D,0x80,0x73,0x80,0x33,0x00,0x33,0x00,0x00,0x00,0x00,0x00, - 7, // 0x58 'X' - 0x00,0x00,0x00,0xCC,0xCC,0x78,0x30,0x78,0xCC,0xCC,0x00,0x00, + 7, // 0x58 'X' + 0x00,0x00,0x00,0xCC,0xCC,0x78,0x30,0x78,0xCC,0xCC,0x00,0x00, - 7, // 0x59 'Y' - 0x00,0x00,0x00,0xCC,0xCC,0x78,0x30,0x30,0x30,0x30,0x00,0x00, + 7, // 0x59 'Y' + 0x00,0x00,0x00,0xCC,0xCC,0x78,0x30,0x30,0x30,0x30,0x00,0x00, - 6, // 0x5A 'Z' - 0x00,0x00,0x00,0xF8,0x18,0x30,0x60,0xC0,0xC0,0xF8,0x00,0x00, + 6, // 0x5A 'Z' + 0x00,0x00,0x00,0xF8,0x18,0x30,0x60,0xC0,0xC0,0xF8,0x00,0x00, - 5, // 0x5B '[' - 0x00,0x00,0x70,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x70, + 5, // 0x5B '[' + 0x00,0x00,0x70,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x70, - 6, // 0x5C '\' - 0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x10,0x10,0x08,0x08,0x00, + 6, // 0x5C '\' + 0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x10,0x10,0x08,0x08,0x00, - 5, // 0x5D ']' - 0x00,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x70, + 5, // 0x5D ']' + 0x00,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x70, - 8, // 0x5E '^' - 0x00,0x00,0x00,0x18,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x5E '^' + 0x00,0x00,0x00,0x18,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC, + 6, // 0x5F '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC, - 6, // 0x60 '`' - 0x00,0x00,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x60 '`' + 0x00,0x00,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x70,0x18,0x78,0xD8,0x78,0x00,0x00, + 6, // 0x61 'a' + 0x00,0x00,0x00,0x00,0x00,0x70,0x18,0x78,0xD8,0x78,0x00,0x00, - 6, // 0x62 'b' - 0x00,0x00,0xC0,0xC0,0xC0,0xF0,0xD8,0xD8,0xD8,0xF0,0x00,0x00, + 6, // 0x62 'b' + 0x00,0x00,0xC0,0xC0,0xC0,0xF0,0xD8,0xD8,0xD8,0xF0,0x00,0x00, - 5, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x70,0xC0,0xC0,0xC0,0x70,0x00,0x00, + 5, // 0x63 'c' + 0x00,0x00,0x00,0x00,0x00,0x70,0xC0,0xC0,0xC0,0x70,0x00,0x00, - 6, // 0x64 'd' - 0x00,0x00,0x18,0x18,0x18,0x78,0xD8,0xD8,0xD8,0x78,0x00,0x00, + 6, // 0x64 'd' + 0x00,0x00,0x18,0x18,0x18,0x78,0xD8,0xD8,0xD8,0x78,0x00,0x00, - 6, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x70,0xD8,0xF8,0xC0,0x78,0x00,0x00, + 6, // 0x65 'e' + 0x00,0x00,0x00,0x00,0x00,0x70,0xD8,0xF8,0xC0,0x78,0x00,0x00, - 5, // 0x66 'f' - 0x00,0x00,0x38,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x00,0x00, + 5, // 0x66 'f' + 0x00,0x00,0x38,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x00,0x00, - 6, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x78,0xD8,0xD8,0xD8,0x78,0x18,0x70, + 6, // 0x67 'g' + 0x00,0x00,0x00,0x00,0x00,0x78,0xD8,0xD8,0xD8,0x78,0x18,0x70, - 6, // 0x68 'h' - 0x00,0x00,0xC0,0xC0,0xC0,0xF0,0xD8,0xD8,0xD8,0xD8,0x00,0x00, + 6, // 0x68 'h' + 0x00,0x00,0xC0,0xC0,0xC0,0xF0,0xD8,0xD8,0xD8,0xD8,0x00,0x00, - 3, // 0x69 'i' - 0x00,0x00,0x00,0xC0,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00, + 3, // 0x69 'i' + 0x00,0x00,0x00,0xC0,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00, - 4, // 0x6A 'j' - 0x00,0x00,0x00,0x60,0x00,0xE0,0x60,0x60,0x60,0x60,0x60,0xC0, + 4, // 0x6A 'j' + 0x00,0x00,0x00,0x60,0x00,0xE0,0x60,0x60,0x60,0x60,0x60,0xC0, - 6, // 0x6B 'k' - 0x00,0x00,0xC0,0xC0,0xC0,0xD8,0xD8,0xF0,0xD8,0xD8,0x00,0x00, + 6, // 0x6B 'k' + 0x00,0x00,0xC0,0xC0,0xC0,0xD8,0xD8,0xF0,0xD8,0xD8,0x00,0x00, - 3, // 0x6C 'l' - 0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00, + 3, // 0x6C 'l' + 0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00, - 9, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF6,0x00,0xDB,0x00,0xDB,0x00,0xDB,0x00,0xDB,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6D 'm' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF6,0x00,0xDB,0x00,0xDB,0x00,0xDB,0x00,0xDB,0x00,0x00,0x00,0x00,0x00, - 6, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0xF0,0xD8,0xD8,0xD8,0xD8,0x00,0x00, + 6, // 0x6E 'n' + 0x00,0x00,0x00,0x00,0x00,0xF0,0xD8,0xD8,0xD8,0xD8,0x00,0x00, - 6, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x70,0xD8,0xD8,0xD8,0x70,0x00,0x00, + 6, // 0x6F 'o' + 0x00,0x00,0x00,0x00,0x00,0x70,0xD8,0xD8,0xD8,0x70,0x00,0x00, - 6, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0xF0,0xD8,0xD8,0xD8,0xF0,0xC0,0xC0, + 6, // 0x70 'p' + 0x00,0x00,0x00,0x00,0x00,0xF0,0xD8,0xD8,0xD8,0xF0,0xC0,0xC0, - 6, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x78,0xD8,0xD8,0xD8,0x78,0x18,0x18, + 6, // 0x71 'q' + 0x00,0x00,0x00,0x00,0x00,0x78,0xD8,0xD8,0xD8,0x78,0x18,0x18, - 4, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0xD0,0xE0,0xC0,0xC0,0xC0,0x00,0x00, + 4, // 0x72 'r' + 0x00,0x00,0x00,0x00,0x00,0xD0,0xE0,0xC0,0xC0,0xC0,0x00,0x00, - 5, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x70,0xC0,0xF0,0x30,0xE0,0x00,0x00, + 5, // 0x73 's' + 0x00,0x00,0x00,0x00,0x00,0x70,0xC0,0xF0,0x30,0xE0,0x00,0x00, - 5, // 0x74 't' - 0x00,0x00,0x00,0x60,0x60,0xF8,0x60,0x60,0x60,0x38,0x00,0x00, + 5, // 0x74 't' + 0x00,0x00,0x00,0x60,0x60,0xF8,0x60,0x60,0x60,0x38,0x00,0x00, - 6, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0xD8,0xD8,0xD8,0xD8,0x78,0x00,0x00, + 6, // 0x75 'u' + 0x00,0x00,0x00,0x00,0x00,0xD8,0xD8,0xD8,0xD8,0x78,0x00,0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0xD8,0xD8,0xD8,0x70,0x70,0x00,0x00, + 6, // 0x76 'v' + 0x00,0x00,0x00,0x00,0x00,0xD8,0xD8,0xD8,0x70,0x70,0x00,0x00, - 9, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDB,0x00,0xDB,0x00,0xDB,0x00,0x66,0x00,0x66,0x00,0x00,0x00,0x00,0x00, + 9, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDB,0x00,0xDB,0x00,0xDB,0x00,0x66,0x00,0x66,0x00,0x00,0x00,0x00,0x00, - 6, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0xD8,0xD8,0x70,0xD8,0xD8,0x00,0x00, + 6, // 0x78 'x' + 0x00,0x00,0x00,0x00,0x00,0xD8,0xD8,0x70,0xD8,0xD8,0x00,0x00, - 6, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0xD8,0xD8,0xD8,0x70,0x70,0x30,0x60, + 6, // 0x79 'y' + 0x00,0x00,0x00,0x00,0x00,0xD8,0xD8,0xD8,0x70,0x70,0x30,0x60, - 5, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0xF0,0x30,0x60,0xC0,0xF0,0x00,0x00, + 5, // 0x7A 'z' + 0x00,0x00,0x00,0x00,0x00,0xF0,0x30,0x60,0xC0,0xF0,0x00,0x00, - 6, // 0x7B '{' - 0x00,0x00,0x18,0x30,0x30,0x30,0xE0,0x30,0x30,0x30,0x30,0x18, + 6, // 0x7B '{' + 0x00,0x00,0x18,0x30,0x30,0x30,0xE0,0x30,0x30,0x30,0x30,0x18, - 5, // 0x7C '|' - 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 5, // 0x7C '|' + 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, - 6, // 0x7D '}' - 0x00,0x00,0xC0,0x60,0x60,0x60,0x38,0x60,0x60,0x60,0x60,0xC0, + 6, // 0x7D '}' + 0x00,0x00,0xC0,0x60,0x60,0x60,0x38,0x60,0x60,0x60,0x60,0xC0, - 8, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x62,0x92,0x8C,0x00,0x00,0x00, + 8, // 0x7E '~' + 0x00,0x00,0x00,0x00,0x00,0x00,0x62,0x92,0x8C,0x00,0x00,0x00, - 9, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7F,0x00,0x00,0x00,0x00,0x00, + 9, // 0x7F '' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7F,0x00,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u verdana13[] = - { - 13, 3, 32, 128-32, - 0x00,0x00,0x0E,0x00,0x1C,0x00,0x2A,0x00,0x45,0x00,0x53,0x00,0x6E,0x00,0x7C,0x00,0x8A,0x00, - 0x98,0x00,0xA6,0x00,0xB4,0x00,0xCF,0x00,0xDD,0x00,0xEB,0x00,0xF9,0x00,0x07,0x01,0x15,0x01, - 0x23,0x01,0x31,0x01,0x3F,0x01,0x4D,0x01,0x5B,0x01,0x69,0x01,0x77,0x01,0x85,0x01,0x93,0x01, - 0xA1,0x01,0xAF,0x01,0xCA,0x01,0xE5,0x01,0x00,0x02,0x0E,0x02,0x29,0x02,0x37,0x02,0x45,0x02, - 0x60,0x02,0x7B,0x02,0x89,0x02,0x97,0x02,0xB2,0x02,0xC0,0x02,0xCE,0x02,0xDC,0x02,0xEA,0x02, - 0xF8,0x02,0x13,0x03,0x21,0x03,0x3C,0x03,0x4A,0x03,0x65,0x03,0x73,0x03,0x81,0x03,0x8F,0x03, - 0x9D,0x03,0xAB,0x03,0xC6,0x03,0xD4,0x03,0xE2,0x03,0xF0,0x03,0xFE,0x03,0x0C,0x04,0x1A,0x04, - 0x35,0x04,0x43,0x04,0x51,0x04,0x5F,0x04,0x6D,0x04,0x7B,0x04,0x89,0x04,0x97,0x04,0xA5,0x04, - 0xB3,0x04,0xC1,0x04,0xCF,0x04,0xDD,0x04,0xEB,0x04,0xF9,0x04,0x14,0x05,0x22,0x05,0x30,0x05, - 0x3E,0x05,0x4C,0x05,0x5A,0x05,0x68,0x05,0x76,0x05,0x84,0x05,0x92,0x05,0xAD,0x05,0xBB,0x05, - 0xC9,0x05,0xD7,0x05,0xE5,0x05,0xF3,0x05,0x01,0x06,0x1C,0x06, +const int8u verdana13[] = +{ + 13, 3, 32, 128-32, + 0x00,0x00,0x0E,0x00,0x1C,0x00,0x2A,0x00,0x45,0x00,0x53,0x00,0x6E,0x00,0x7C,0x00,0x8A,0x00, + 0x98,0x00,0xA6,0x00,0xB4,0x00,0xCF,0x00,0xDD,0x00,0xEB,0x00,0xF9,0x00,0x07,0x01,0x15,0x01, + 0x23,0x01,0x31,0x01,0x3F,0x01,0x4D,0x01,0x5B,0x01,0x69,0x01,0x77,0x01,0x85,0x01,0x93,0x01, + 0xA1,0x01,0xAF,0x01,0xCA,0x01,0xE5,0x01,0x00,0x02,0x0E,0x02,0x29,0x02,0x37,0x02,0x45,0x02, + 0x60,0x02,0x7B,0x02,0x89,0x02,0x97,0x02,0xB2,0x02,0xC0,0x02,0xCE,0x02,0xDC,0x02,0xEA,0x02, + 0xF8,0x02,0x13,0x03,0x21,0x03,0x3C,0x03,0x4A,0x03,0x65,0x03,0x73,0x03,0x81,0x03,0x8F,0x03, + 0x9D,0x03,0xAB,0x03,0xC6,0x03,0xD4,0x03,0xE2,0x03,0xF0,0x03,0xFE,0x03,0x0C,0x04,0x1A,0x04, + 0x35,0x04,0x43,0x04,0x51,0x04,0x5F,0x04,0x6D,0x04,0x7B,0x04,0x89,0x04,0x97,0x04,0xA5,0x04, + 0xB3,0x04,0xC1,0x04,0xCF,0x04,0xDD,0x04,0xEB,0x04,0xF9,0x04,0x14,0x05,0x22,0x05,0x30,0x05, + 0x3E,0x05,0x4C,0x05,0x5A,0x05,0x68,0x05,0x76,0x05,0x84,0x05,0x92,0x05,0xAD,0x05,0xBB,0x05, + 0xC9,0x05,0xD7,0x05,0xE5,0x05,0xF3,0x05,0x01,0x06,0x1C,0x06, - 4, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x21 '!' - 0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, + 4, // 0x21 '!' + 0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, - 5, // 0x22 '"' - 0x00,0x00,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x22 '"' + 0x00,0x00,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,0x0A,0x00,0x3F,0x00,0x14,0x00,0x14,0x00,0x7E,0x00,0x28,0x00,0x28,0x00,0x00,0x00,0x00,0x00, + 9, // 0x23 '#' + 0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,0x0A,0x00,0x3F,0x00,0x14,0x00,0x14,0x00,0x7E,0x00,0x28,0x00,0x28,0x00,0x00,0x00,0x00,0x00, - 7, // 0x24 '$' - 0x00,0x00,0x10,0x10,0x3C,0x50,0x50,0x38,0x14,0x14,0x78,0x10,0x10, + 7, // 0x24 '$' + 0x00,0x00,0x10,0x10,0x3C,0x50,0x50,0x38,0x14,0x14,0x78,0x10,0x10, - 12, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x49,0x00,0x4A,0x00,0x32,0x00,0x04,0xC0,0x05,0x20,0x09,0x20,0x08,0xC0,0x00,0x00,0x00,0x00, + 12, // 0x25 '%' + 0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x49,0x00,0x4A,0x00,0x32,0x00,0x04,0xC0,0x05,0x20,0x09,0x20,0x08,0xC0,0x00,0x00,0x00,0x00, - 8, // 0x26 '&' - 0x00,0x00,0x00,0x30,0x48,0x48,0x32,0x4A,0x44,0x46,0x39,0x00,0x00, + 8, // 0x26 '&' + 0x00,0x00,0x00,0x30,0x48,0x48,0x32,0x4A,0x44,0x46,0x39,0x00,0x00, - 3, // 0x27 ''' - 0x00,0x00,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x27 ''' + 0x00,0x00,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x28 '(' - 0x00,0x00,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10, + 5, // 0x28 '(' + 0x00,0x00,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10, - 5, // 0x29 ')' - 0x00,0x00,0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40, + 5, // 0x29 ')' + 0x00,0x00,0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40, - 7, // 0x2A '*' - 0x00,0x00,0x10,0x54,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2A '*' + 0x00,0x00,0x10,0x54,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00, + 9, // 0x2B '+' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00, - 4, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40, + 4, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40, - 5, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00, + 5, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00, - 4, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00, + 4, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00, - 5, // 0x2F '/' - 0x00,0x00,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, + 5, // 0x2F '/' + 0x00,0x00,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, - 7, // 0x30 '0' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x30 '0' + 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x31 '1' - 0x00,0x00,0x00,0x10,0x70,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00, + 7, // 0x31 '1' + 0x00,0x00,0x00,0x10,0x70,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00, - 7, // 0x32 '2' - 0x00,0x00,0x00,0x38,0x44,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 7, // 0x32 '2' + 0x00,0x00,0x00,0x38,0x44,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, - 7, // 0x33 '3' - 0x00,0x00,0x00,0x38,0x44,0x04,0x18,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x33 '3' + 0x00,0x00,0x00,0x38,0x44,0x04,0x18,0x04,0x04,0x44,0x38,0x00,0x00, - 7, // 0x34 '4' - 0x00,0x00,0x00,0x08,0x18,0x28,0x48,0x88,0xFC,0x08,0x08,0x00,0x00, + 7, // 0x34 '4' + 0x00,0x00,0x00,0x08,0x18,0x28,0x48,0x88,0xFC,0x08,0x08,0x00,0x00, - 7, // 0x35 '5' - 0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x35 '5' + 0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x04,0x04,0x44,0x38,0x00,0x00, - 7, // 0x36 '6' - 0x00,0x00,0x00,0x18,0x20,0x40,0x78,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x36 '6' + 0x00,0x00,0x00,0x18,0x20,0x40,0x78,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x37 '7' - 0x00,0x00,0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x00,0x00, + 7, // 0x37 '7' + 0x00,0x00,0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x00,0x00, - 7, // 0x38 '8' - 0x00,0x00,0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x38 '8' + 0x00,0x00,0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x39 '9' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x08,0x30,0x00,0x00, + 7, // 0x39 '9' + 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x08,0x30,0x00,0x00, - 5, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x20,0x20,0x00,0x00, + 5, // 0x3A ':' + 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x20,0x20,0x00,0x00, - 5, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x20,0x20,0x20,0x40, + 5, // 0x3B ';' + 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x20,0x20,0x20,0x40, - 9, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3C '<' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3E '>' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x3F '?' - 0x00,0x00,0x00,0x70,0x08,0x08,0x10,0x20,0x20,0x00,0x20,0x00,0x00, + 6, // 0x3F '?' + 0x00,0x00,0x00,0x70,0x08,0x08,0x10,0x20,0x20,0x00,0x20,0x00,0x00, - 10, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x20,0x80,0x4E,0x80,0x52,0x80,0x52,0x80,0x52,0x80,0x4D,0x00,0x20,0x00,0x1E,0x00,0x00,0x00, + 10, // 0x40 '@' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x20,0x80,0x4E,0x80,0x52,0x80,0x52,0x80,0x52,0x80,0x4D,0x00,0x20,0x00,0x1E,0x00,0x00,0x00, - 8, // 0x41 'A' - 0x00,0x00,0x00,0x18,0x18,0x24,0x24,0x24,0x7E,0x42,0x42,0x00,0x00, + 8, // 0x41 'A' + 0x00,0x00,0x00,0x18,0x18,0x24,0x24,0x24,0x7E,0x42,0x42,0x00,0x00, - 8, // 0x42 'B' - 0x00,0x00,0x00,0x78,0x44,0x44,0x7C,0x42,0x42,0x42,0x7C,0x00,0x00, + 8, // 0x42 'B' + 0x00,0x00,0x00,0x78,0x44,0x44,0x7C,0x42,0x42,0x42,0x7C,0x00,0x00, - 9, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x43 'C' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, - 9, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 9, // 0x44 'D' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, - 7, // 0x45 'E' - 0x00,0x00,0x00,0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x7C,0x00,0x00, + 7, // 0x45 'E' + 0x00,0x00,0x00,0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x7C,0x00,0x00, - 6, // 0x46 'F' - 0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00, + 6, // 0x46 'F' + 0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00, - 9, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x47,0x00,0x41,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x47 'G' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x47,0x00,0x41,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, - 8, // 0x48 'H' - 0x00,0x00,0x00,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x42,0x00,0x00, + 8, // 0x48 'H' + 0x00,0x00,0x00,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x42,0x00,0x00, - 5, // 0x49 'I' - 0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 5, // 0x49 'I' + 0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, - 5, // 0x4A 'J' - 0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0xE0,0x00,0x00, + 5, // 0x4A 'J' + 0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0xE0,0x00,0x00, - 8, // 0x4B 'K' - 0x00,0x00,0x00,0x42,0x44,0x48,0x50,0x70,0x48,0x44,0x42,0x00,0x00, + 8, // 0x4B 'K' + 0x00,0x00,0x00,0x42,0x44,0x48,0x50,0x70,0x48,0x44,0x42,0x00,0x00, - 6, // 0x4C 'L' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x4C 'L' + 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, - 9, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x55,0x00,0x55,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4D 'M' + 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x55,0x00,0x55,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00, - 8, // 0x4E 'N' - 0x00,0x00,0x00,0x62,0x62,0x52,0x52,0x4A,0x4A,0x46,0x46,0x00,0x00, + 8, // 0x4E 'N' + 0x00,0x00,0x00,0x62,0x62,0x52,0x52,0x4A,0x4A,0x46,0x46,0x00,0x00, - 9, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4F 'O' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, - 7, // 0x50 'P' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, + 7, // 0x50 'P' + 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, - 9, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x04,0x00,0x03,0x00, + 9, // 0x51 'Q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x04,0x00,0x03,0x00, - 8, // 0x52 'R' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x48,0x44,0x42,0x00,0x00, + 8, // 0x52 'R' + 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x48,0x44,0x42,0x00,0x00, - 8, // 0x53 'S' - 0x00,0x00,0x00,0x3C,0x42,0x40,0x30,0x0C,0x02,0x42,0x3C,0x00,0x00, + 8, // 0x53 'S' + 0x00,0x00,0x00,0x3C,0x42,0x40,0x30,0x0C,0x02,0x42,0x3C,0x00,0x00, - 7, // 0x54 'T' - 0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x54 'T' + 0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, - 8, // 0x55 'U' - 0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, + 8, // 0x55 'U' + 0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, - 8, // 0x56 'V' - 0x00,0x00,0x00,0x42,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x00,0x00, + 8, // 0x56 'V' + 0x00,0x00,0x00,0x42,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x00,0x00, - 11, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x40,0x44,0x40,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00, + 11, // 0x57 'W' + 0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x40,0x44,0x40,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00, - 8, // 0x58 'X' - 0x00,0x00,0x00,0x42,0x42,0x24,0x18,0x18,0x24,0x42,0x42,0x00,0x00, + 8, // 0x58 'X' + 0x00,0x00,0x00,0x42,0x42,0x24,0x18,0x18,0x24,0x42,0x42,0x00,0x00, - 7, // 0x59 'Y' - 0x00,0x00,0x00,0x82,0x44,0x28,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x59 'Y' + 0x00,0x00,0x00,0x82,0x44,0x28,0x10,0x10,0x10,0x10,0x10,0x00,0x00, - 8, // 0x5A 'Z' - 0x00,0x00,0x00,0x7E,0x02,0x04,0x08,0x10,0x20,0x40,0x7E,0x00,0x00, + 8, // 0x5A 'Z' + 0x00,0x00,0x00,0x7E,0x02,0x04,0x08,0x10,0x20,0x40,0x7E,0x00,0x00, - 5, // 0x5B '[' - 0x00,0x00,0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70, + 5, // 0x5B '[' + 0x00,0x00,0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70, - 5, // 0x5C '\' - 0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, + 5, // 0x5C '\' + 0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, - 5, // 0x5D ']' - 0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70, + 5, // 0x5D ']' + 0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70, - 9, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x14,0x00,0x22,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x5E '^' + 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x14,0x00,0x22,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE, + 7, // 0x5F '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE, - 7, // 0x60 '`' - 0x00,0x00,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x60 '`' + 0x00,0x00,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x3C,0x00,0x00, + 7, // 0x61 'a' + 0x00,0x00,0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x3C,0x00,0x00, - 7, // 0x62 'b' - 0x00,0x00,0x40,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00, + 7, // 0x62 'b' + 0x00,0x00,0x40,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x00, + 6, // 0x63 'c' + 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x00, - 7, // 0x64 'd' - 0x00,0x00,0x04,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, + 7, // 0x64 'd' + 0x00,0x00,0x04,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x7C,0x40,0x44,0x38,0x00,0x00, + 7, // 0x65 'e' + 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x7C,0x40,0x44,0x38,0x00,0x00, - 4, // 0x66 'f' - 0x00,0x00,0x30,0x40,0x40,0xF0,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 4, // 0x66 'f' + 0x00,0x00,0x30,0x40,0x40,0xF0,0x40,0x40,0x40,0x40,0x40,0x00,0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x38, + 7, // 0x67 'g' + 0x00,0x00,0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x38, - 7, // 0x68 'h' - 0x00,0x00,0x40,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x68 'h' + 0x00,0x00,0x40,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00, - 3, // 0x69 'i' - 0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x69 'i' + 0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, - 4, // 0x6A 'j' - 0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0xC0, + 4, // 0x6A 'j' + 0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0xC0, - 7, // 0x6B 'k' - 0x00,0x00,0x40,0x40,0x40,0x44,0x48,0x50,0x70,0x48,0x44,0x00,0x00, + 7, // 0x6B 'k' + 0x00,0x00,0x40,0x40,0x40,0x44,0x48,0x50,0x70,0x48,0x44,0x00,0x00, - 3, // 0x6C 'l' - 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x6C 'l' + 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, - 11, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7B,0x80,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x00,0x00,0x00,0x00, + 11, // 0x6D 'm' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7B,0x80,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x00,0x00,0x00,0x00, - 7, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x6E 'n' + 0x00,0x00,0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00, - 7, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x6F 'o' + 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40, + 7, // 0x70 'p' + 0x00,0x00,0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, + 7, // 0x71 'q' + 0x00,0x00,0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, - 5, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x58,0x60,0x40,0x40,0x40,0x40,0x00,0x00, + 5, // 0x72 'r' + 0x00,0x00,0x00,0x00,0x00,0x58,0x60,0x40,0x40,0x40,0x40,0x00,0x00, - 6, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x60,0x18,0x08,0x70,0x00,0x00, + 6, // 0x73 's' + 0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x60,0x18,0x08,0x70,0x00,0x00, - 4, // 0x74 't' - 0x00,0x00,0x00,0x40,0x40,0xF0,0x40,0x40,0x40,0x40,0x30,0x00,0x00, + 4, // 0x74 't' + 0x00,0x00,0x00,0x40,0x40,0xF0,0x40,0x40,0x40,0x40,0x30,0x00,0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, + 7, // 0x75 'u' + 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, - 7, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, + 7, // 0x76 'v' + 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, - 9, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x49,0x00,0x49,0x00,0x55,0x00,0x55,0x00,0x22,0x00,0x22,0x00,0x00,0x00,0x00,0x00, + 9, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x49,0x00,0x49,0x00,0x55,0x00,0x55,0x00,0x22,0x00,0x22,0x00,0x00,0x00,0x00,0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x44,0x28,0x10,0x10,0x28,0x44,0x00,0x00, + 7, // 0x78 'x' + 0x00,0x00,0x00,0x00,0x00,0x44,0x28,0x10,0x10,0x28,0x44,0x00,0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x44,0x28,0x28,0x28,0x10,0x10,0x10,0x20, + 7, // 0x79 'y' + 0x00,0x00,0x00,0x00,0x00,0x44,0x28,0x28,0x28,0x10,0x10,0x10,0x20, - 6, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x78,0x08,0x10,0x20,0x40,0x78,0x00,0x00, + 6, // 0x7A 'z' + 0x00,0x00,0x00,0x00,0x00,0x78,0x08,0x10,0x20,0x40,0x78,0x00,0x00, - 7, // 0x7B '{' - 0x00,0x00,0x0C,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x0C, + 7, // 0x7B '{' + 0x00,0x00,0x0C,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x0C, - 5, // 0x7C '|' - 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 5, // 0x7C '|' + 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, - 7, // 0x7D '}' - 0x00,0x00,0x60,0x10,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x10,0x60, + 7, // 0x7D '}' + 0x00,0x00,0x60,0x10,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x10,0x60, - 9, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x49,0x00,0x46,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x7E '~' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x49,0x00,0x46,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x7F,0x80,0x00,0x00,0x00,0x00, + 11, // 0x7F '' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x7F,0x80,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u verdana13_bold[] = - { - 13, 3, 32, 128-32, - 0x00,0x00,0x0E,0x00,0x1C,0x00,0x2A,0x00,0x45,0x00,0x53,0x00,0x6E,0x00,0x89,0x00,0x97,0x00, - 0xA5,0x00,0xB3,0x00,0xC1,0x00,0xDC,0x00,0xEA,0x00,0xF8,0x00,0x06,0x01,0x14,0x01,0x22,0x01, - 0x30,0x01,0x3E,0x01,0x4C,0x01,0x5A,0x01,0x68,0x01,0x76,0x01,0x84,0x01,0x92,0x01,0xA0,0x01, - 0xAE,0x01,0xBC,0x01,0xD7,0x01,0xF2,0x01,0x0D,0x02,0x1B,0x02,0x36,0x02,0x51,0x02,0x5F,0x02, - 0x6D,0x02,0x88,0x02,0x96,0x02,0xA4,0x02,0xBF,0x02,0xDA,0x02,0xE8,0x02,0xF6,0x02,0x04,0x03, - 0x12,0x03,0x2D,0x03,0x48,0x03,0x63,0x03,0x71,0x03,0x8C,0x03,0x9A,0x03,0xA8,0x03,0xB6,0x03, - 0xD1,0x03,0xDF,0x03,0xFA,0x03,0x08,0x04,0x16,0x04,0x24,0x04,0x32,0x04,0x40,0x04,0x4E,0x04, - 0x69,0x04,0x77,0x04,0x85,0x04,0x93,0x04,0xA1,0x04,0xAF,0x04,0xBD,0x04,0xCB,0x04,0xD9,0x04, - 0xE7,0x04,0xF5,0x04,0x03,0x05,0x11,0x05,0x1F,0x05,0x2D,0x05,0x48,0x05,0x56,0x05,0x64,0x05, - 0x72,0x05,0x80,0x05,0x8E,0x05,0x9C,0x05,0xAA,0x05,0xB8,0x05,0xC6,0x05,0xE1,0x05,0xEF,0x05, - 0xFD,0x05,0x0B,0x06,0x19,0x06,0x27,0x06,0x35,0x06,0x50,0x06, +const int8u verdana13_bold[] = +{ + 13, 3, 32, 128-32, + 0x00,0x00,0x0E,0x00,0x1C,0x00,0x2A,0x00,0x45,0x00,0x53,0x00,0x6E,0x00,0x89,0x00,0x97,0x00, + 0xA5,0x00,0xB3,0x00,0xC1,0x00,0xDC,0x00,0xEA,0x00,0xF8,0x00,0x06,0x01,0x14,0x01,0x22,0x01, + 0x30,0x01,0x3E,0x01,0x4C,0x01,0x5A,0x01,0x68,0x01,0x76,0x01,0x84,0x01,0x92,0x01,0xA0,0x01, + 0xAE,0x01,0xBC,0x01,0xD7,0x01,0xF2,0x01,0x0D,0x02,0x1B,0x02,0x36,0x02,0x51,0x02,0x5F,0x02, + 0x6D,0x02,0x88,0x02,0x96,0x02,0xA4,0x02,0xBF,0x02,0xDA,0x02,0xE8,0x02,0xF6,0x02,0x04,0x03, + 0x12,0x03,0x2D,0x03,0x48,0x03,0x63,0x03,0x71,0x03,0x8C,0x03,0x9A,0x03,0xA8,0x03,0xB6,0x03, + 0xD1,0x03,0xDF,0x03,0xFA,0x03,0x08,0x04,0x16,0x04,0x24,0x04,0x32,0x04,0x40,0x04,0x4E,0x04, + 0x69,0x04,0x77,0x04,0x85,0x04,0x93,0x04,0xA1,0x04,0xAF,0x04,0xBD,0x04,0xCB,0x04,0xD9,0x04, + 0xE7,0x04,0xF5,0x04,0x03,0x05,0x11,0x05,0x1F,0x05,0x2D,0x05,0x48,0x05,0x56,0x05,0x64,0x05, + 0x72,0x05,0x80,0x05,0x8E,0x05,0x9C,0x05,0xAA,0x05,0xB8,0x05,0xC6,0x05,0xE1,0x05,0xEF,0x05, + 0xFD,0x05,0x0B,0x06,0x19,0x06,0x27,0x06,0x35,0x06,0x50,0x06, - 4, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x21 '!' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x60,0x00,0x00, + 4, // 0x21 '!' + 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x60,0x00,0x00, - 7, // 0x22 '"' - 0x00,0x00,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x00,0x00,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,0x0A,0x00,0x3F,0x00,0x14,0x00,0x14,0x00,0x7E,0x00,0x28,0x00,0x28,0x00,0x00,0x00,0x00,0x00, + 9, // 0x23 '#' + 0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,0x0A,0x00,0x3F,0x00,0x14,0x00,0x14,0x00,0x7E,0x00,0x28,0x00,0x28,0x00,0x00,0x00,0x00,0x00, - 8, // 0x24 '$' - 0x00,0x00,0x08,0x08,0x3C,0x6A,0x68,0x3C,0x16,0x56,0x3C,0x10,0x10, + 8, // 0x24 '$' + 0x00,0x00,0x08,0x08,0x3C,0x6A,0x68,0x3C,0x16,0x56,0x3C,0x10,0x10, - 14, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x80,0x6C,0x80,0x6D,0x00,0x6D,0x70,0x3A,0xD8,0x02,0xD8,0x04,0xD8,0x04,0x70,0x00,0x00,0x00,0x00, + 14, // 0x25 '%' + 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x80,0x6C,0x80,0x6D,0x00,0x6D,0x70,0x3A,0xD8,0x02,0xD8,0x04,0xD8,0x04,0x70,0x00,0x00,0x00,0x00, - 10, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x6C,0x00,0x6C,0x00,0x39,0x80,0x6D,0x00,0x66,0x00,0x63,0x00,0x3D,0x80,0x00,0x00,0x00,0x00, + 10, // 0x26 '&' + 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x6C,0x00,0x6C,0x00,0x39,0x80,0x6D,0x00,0x66,0x00,0x63,0x00,0x3D,0x80,0x00,0x00,0x00,0x00, - 4, // 0x27 ''' - 0x00,0x00,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x27 ''' + 0x00,0x00,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x28 '(' - 0x00,0x00,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18, + 6, // 0x28 '(' + 0x00,0x00,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18, - 6, // 0x29 ')' - 0x00,0x00,0x60,0x30,0x30,0x18,0x18,0x18,0x18,0x18,0x30,0x30,0x60, + 6, // 0x29 ')' + 0x00,0x00,0x60,0x30,0x30,0x18,0x18,0x18,0x18,0x18,0x30,0x30,0x60, - 8, // 0x2A '*' - 0x00,0x00,0x10,0x54,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x2A '*' + 0x00,0x00,0x10,0x54,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00, + 9, // 0x2B '+' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00, - 4, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x40, + 4, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x40, - 6, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00, - 4, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00, + 4, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00, - 8, // 0x2F '/' - 0x00,0x00,0x06,0x06,0x0C,0x0C,0x18,0x18,0x18,0x30,0x30,0x60,0x60, + 8, // 0x2F '/' + 0x00,0x00,0x06,0x06,0x0C,0x0C,0x18,0x18,0x18,0x30,0x30,0x60,0x60, - 8, // 0x30 '0' - 0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00, + 8, // 0x30 '0' + 0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00, - 8, // 0x31 '1' - 0x00,0x00,0x00,0x18,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00, + 8, // 0x31 '1' + 0x00,0x00,0x00,0x18,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00, - 8, // 0x32 '2' - 0x00,0x00,0x00,0x3C,0x66,0x06,0x0C,0x18,0x30,0x60,0x7E,0x00,0x00, + 8, // 0x32 '2' + 0x00,0x00,0x00,0x3C,0x66,0x06,0x0C,0x18,0x30,0x60,0x7E,0x00,0x00, - 8, // 0x33 '3' - 0x00,0x00,0x00,0x3C,0x66,0x06,0x1C,0x06,0x06,0x66,0x3C,0x00,0x00, + 8, // 0x33 '3' + 0x00,0x00,0x00,0x3C,0x66,0x06,0x1C,0x06,0x06,0x66,0x3C,0x00,0x00, - 8, // 0x34 '4' - 0x00,0x00,0x00,0x04,0x0C,0x1C,0x2C,0x4C,0x7E,0x0C,0x0C,0x00,0x00, + 8, // 0x34 '4' + 0x00,0x00,0x00,0x04,0x0C,0x1C,0x2C,0x4C,0x7E,0x0C,0x0C,0x00,0x00, - 8, // 0x35 '5' - 0x00,0x00,0x00,0x3E,0x30,0x30,0x3C,0x06,0x06,0x66,0x3C,0x00,0x00, + 8, // 0x35 '5' + 0x00,0x00,0x00,0x3E,0x30,0x30,0x3C,0x06,0x06,0x66,0x3C,0x00,0x00, - 8, // 0x36 '6' - 0x00,0x00,0x00,0x1C,0x30,0x60,0x7C,0x66,0x66,0x66,0x3C,0x00,0x00, + 8, // 0x36 '6' + 0x00,0x00,0x00,0x1C,0x30,0x60,0x7C,0x66,0x66,0x66,0x3C,0x00,0x00, - 8, // 0x37 '7' - 0x00,0x00,0x00,0x7E,0x06,0x0C,0x0C,0x18,0x18,0x30,0x30,0x00,0x00, + 8, // 0x37 '7' + 0x00,0x00,0x00,0x7E,0x06,0x0C,0x0C,0x18,0x18,0x30,0x30,0x00,0x00, - 8, // 0x38 '8' - 0x00,0x00,0x00,0x3C,0x66,0x66,0x3C,0x66,0x66,0x66,0x3C,0x00,0x00, + 8, // 0x38 '8' + 0x00,0x00,0x00,0x3C,0x66,0x66,0x3C,0x66,0x66,0x66,0x3C,0x00,0x00, - 8, // 0x39 '9' - 0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x3E,0x06,0x0C,0x38,0x00,0x00, + 8, // 0x39 '9' + 0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x3E,0x06,0x0C,0x38,0x00,0x00, - 4, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00,0x00, + 4, // 0x3A ':' + 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00,0x00, - 4, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x60,0x40, + 4, // 0x3B ';' + 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x60,0x40, - 9, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3C '<' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0x00,0x00,0x00, - 9, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3E '>' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x00,0x00,0x00,0x00, - 7, // 0x3F '?' - 0x00,0x00,0x00,0x38,0x4C,0x0C,0x18,0x30,0x30,0x00,0x30,0x00,0x00, + 7, // 0x3F '?' + 0x00,0x00,0x00,0x38,0x4C,0x0C,0x18,0x30,0x30,0x00,0x30,0x00,0x00, - 11, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x20,0x40,0x4F,0x40,0x5B,0x40,0x5B,0x40,0x5B,0x40,0x4F,0x80,0x20,0x00,0x1F,0x00,0x00,0x00, + 11, // 0x40 '@' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x20,0x40,0x4F,0x40,0x5B,0x40,0x5B,0x40,0x5B,0x40,0x4F,0x80,0x20,0x00,0x1F,0x00,0x00,0x00, - 9, // 0x41 'A' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x1C,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x7F,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00, + 9, // 0x41 'A' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x1C,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x7F,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00, - 8, // 0x42 'B' - 0x00,0x00,0x00,0x7C,0x66,0x66,0x7C,0x66,0x66,0x66,0x7C,0x00,0x00, + 8, // 0x42 'B' + 0x00,0x00,0x00,0x7C,0x66,0x66,0x7C,0x66,0x66,0x66,0x7C,0x00,0x00, - 8, // 0x43 'C' - 0x00,0x00,0x00,0x3C,0x62,0x60,0x60,0x60,0x60,0x62,0x3C,0x00,0x00, + 8, // 0x43 'C' + 0x00,0x00,0x00,0x3C,0x62,0x60,0x60,0x60,0x60,0x62,0x3C,0x00,0x00, - 9, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x66,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x66,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 9, // 0x44 'D' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x66,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x66,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, - 8, // 0x45 'E' - 0x00,0x00,0x00,0x7E,0x60,0x60,0x7E,0x60,0x60,0x60,0x7E,0x00,0x00, + 8, // 0x45 'E' + 0x00,0x00,0x00,0x7E,0x60,0x60,0x7E,0x60,0x60,0x60,0x7E,0x00,0x00, - 8, // 0x46 'F' - 0x00,0x00,0x00,0x7E,0x60,0x60,0x7E,0x60,0x60,0x60,0x60,0x00,0x00, + 8, // 0x46 'F' + 0x00,0x00,0x00,0x7E,0x60,0x60,0x7E,0x60,0x60,0x60,0x60,0x00,0x00, - 9, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x61,0x00,0x60,0x00,0x60,0x00,0x67,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x00,0x00,0x00,0x00, + 9, // 0x47 'G' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x61,0x00,0x60,0x00,0x60,0x00,0x67,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x00,0x00,0x00,0x00, - 9, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00, + 9, // 0x48 'H' + 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00, - 6, // 0x49 'I' - 0x00,0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00, + 6, // 0x49 'I' + 0x00,0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00, - 6, // 0x4A 'J' - 0x00,0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0xF0,0x00,0x00, + 6, // 0x4A 'J' + 0x00,0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0xF0,0x00,0x00, - 8, // 0x4B 'K' - 0x00,0x00,0x00,0x66,0x6C,0x78,0x70,0x70,0x78,0x6C,0x66,0x00,0x00, + 8, // 0x4B 'K' + 0x00,0x00,0x00,0x66,0x6C,0x78,0x70,0x70,0x78,0x6C,0x66,0x00,0x00, - 7, // 0x4C 'L' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7E,0x00,0x00, + 7, // 0x4C 'L' + 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7E,0x00,0x00, - 10, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x80,0x71,0x80,0x7B,0x80,0x5D,0x80,0x49,0x80,0x41,0x80,0x41,0x80,0x41,0x80,0x00,0x00,0x00,0x00, + 10, // 0x4D 'M' + 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x80,0x71,0x80,0x7B,0x80,0x5D,0x80,0x49,0x80,0x41,0x80,0x41,0x80,0x41,0x80,0x00,0x00,0x00,0x00, - 9, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x61,0x00,0x71,0x00,0x59,0x00,0x4D,0x00,0x47,0x00,0x43,0x00,0x41,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4E 'N' + 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x61,0x00,0x71,0x00,0x59,0x00,0x4D,0x00,0x47,0x00,0x43,0x00,0x41,0x00,0x00,0x00,0x00,0x00, - 9, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4F 'O' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, - 8, // 0x50 'P' - 0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x00,0x00, + 8, // 0x50 'P' + 0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x00,0x00, - 9, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x0C,0x00,0x07,0x00, + 9, // 0x51 'Q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x0C,0x00,0x07,0x00, - 8, // 0x52 'R' - 0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x7C,0x6C,0x66,0x63,0x00,0x00, + 8, // 0x52 'R' + 0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x7C,0x6C,0x66,0x63,0x00,0x00, - 8, // 0x53 'S' - 0x00,0x00,0x00,0x3C,0x62,0x60,0x7C,0x3E,0x06,0x46,0x3C,0x00,0x00, + 8, // 0x53 'S' + 0x00,0x00,0x00,0x3C,0x62,0x60,0x7C,0x3E,0x06,0x46,0x3C,0x00,0x00, - 8, // 0x54 'T' - 0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00, + 8, // 0x54 'T' + 0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00, - 9, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x55 'U' + 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, - 8, // 0x56 'V' - 0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x3C,0x3C,0x18,0x18,0x00,0x00, + 8, // 0x56 'V' + 0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x3C,0x3C,0x18,0x18,0x00,0x00, - 12, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x60,0x66,0x60,0x66,0x60,0x36,0xC0,0x3F,0xC0,0x39,0xC0,0x19,0x80,0x19,0x80,0x00,0x00,0x00,0x00, + 12, // 0x57 'W' + 0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x60,0x66,0x60,0x66,0x60,0x36,0xC0,0x3F,0xC0,0x39,0xC0,0x19,0x80,0x19,0x80,0x00,0x00,0x00,0x00, - 8, // 0x58 'X' - 0x00,0x00,0x00,0x66,0x66,0x3C,0x18,0x18,0x3C,0x66,0x66,0x00,0x00, + 8, // 0x58 'X' + 0x00,0x00,0x00,0x66,0x66,0x3C,0x18,0x18,0x3C,0x66,0x66,0x00,0x00, - 8, // 0x59 'Y' - 0x00,0x00,0x00,0x66,0x66,0x3C,0x3C,0x18,0x18,0x18,0x18,0x00,0x00, + 8, // 0x59 'Y' + 0x00,0x00,0x00,0x66,0x66,0x3C,0x3C,0x18,0x18,0x18,0x18,0x00,0x00, - 8, // 0x5A 'Z' - 0x00,0x00,0x00,0x7E,0x06,0x0E,0x1C,0x38,0x70,0x60,0x7E,0x00,0x00, + 8, // 0x5A 'Z' + 0x00,0x00,0x00,0x7E,0x06,0x0E,0x1C,0x38,0x70,0x60,0x7E,0x00,0x00, - 6, // 0x5B '[' - 0x00,0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x78, + 6, // 0x5B '[' + 0x00,0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x78, - 8, // 0x5C '\' - 0x00,0x00,0x60,0x60,0x30,0x30,0x18,0x18,0x18,0x0C,0x0C,0x06,0x06, + 8, // 0x5C '\' + 0x00,0x00,0x60,0x60,0x30,0x30,0x18,0x18,0x18,0x0C,0x0C,0x06,0x06, - 6, // 0x5D ']' - 0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78, + 6, // 0x5D ']' + 0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78, - 10, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x5E '^' + 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, + 8, // 0x5F '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, - 8, // 0x60 '`' - 0x00,0x00,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x60 '`' + 0x00,0x00,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3E,0x00,0x00, + 8, // 0x61 'a' + 0x00,0x00,0x00,0x00,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3E,0x00,0x00, - 8, // 0x62 'b' - 0x00,0x00,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x7C,0x00,0x00, + 8, // 0x62 'b' + 0x00,0x00,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x7C,0x00,0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x60,0x60,0x60,0x60,0x3C,0x00,0x00, + 7, // 0x63 'c' + 0x00,0x00,0x00,0x00,0x00,0x3C,0x60,0x60,0x60,0x60,0x3C,0x00,0x00, - 8, // 0x64 'd' - 0x00,0x00,0x06,0x06,0x06,0x3E,0x66,0x66,0x66,0x66,0x3E,0x00,0x00, + 8, // 0x64 'd' + 0x00,0x00,0x06,0x06,0x06,0x3E,0x66,0x66,0x66,0x66,0x3E,0x00,0x00, - 8, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x7E,0x60,0x62,0x3C,0x00,0x00, + 8, // 0x65 'e' + 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x7E,0x60,0x62,0x3C,0x00,0x00, - 5, // 0x66 'f' - 0x00,0x00,0x38,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x00,0x00, + 5, // 0x66 'f' + 0x00,0x00,0x38,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x00,0x00, - 8, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x3E,0x06,0x3C, + 8, // 0x67 'g' + 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x3E,0x06,0x3C, - 8, // 0x68 'h' - 0x00,0x00,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x00,0x00, + 8, // 0x68 'h' + 0x00,0x00,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x00,0x00, - 4, // 0x69 'i' - 0x00,0x00,0x00,0x60,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, + 4, // 0x69 'i' + 0x00,0x00,0x00,0x60,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, - 5, // 0x6A 'j' - 0x00,0x00,0x00,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0xE0, + 5, // 0x6A 'j' + 0x00,0x00,0x00,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0xE0, - 8, // 0x6B 'k' - 0x00,0x00,0x60,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0x00,0x00, + 8, // 0x6B 'k' + 0x00,0x00,0x60,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0x00,0x00, - 4, // 0x6C 'l' - 0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, + 4, // 0x6C 'l' + 0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, - 12, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7D,0xC0,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x00,0x00,0x00,0x00, + 12, // 0x6D 'm' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7D,0xC0,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x00,0x00,0x00,0x00, - 8, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x66,0x00,0x00, + 8, // 0x6E 'n' + 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x66,0x00,0x00, - 8, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x3C,0x00,0x00, + 8, // 0x6F 'o' + 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x3C,0x00,0x00, - 8, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x7C,0x60,0x60, + 8, // 0x70 'p' + 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x7C,0x60,0x60, - 8, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x3E,0x06,0x06, + 8, // 0x71 'q' + 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x3E,0x06,0x06, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x6C,0x7C,0x60,0x60,0x60,0x60,0x00,0x00, + 6, // 0x72 'r' + 0x00,0x00,0x00,0x00,0x00,0x6C,0x7C,0x60,0x60,0x60,0x60,0x00,0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x60,0x78,0x3C,0x0C,0x78,0x00,0x00, + 7, // 0x73 's' + 0x00,0x00,0x00,0x00,0x00,0x3C,0x60,0x78,0x3C,0x0C,0x78,0x00,0x00, - 5, // 0x74 't' - 0x00,0x00,0x00,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x38,0x00,0x00, + 5, // 0x74 't' + 0x00,0x00,0x00,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x38,0x00,0x00, - 8, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x3E,0x00,0x00, + 8, // 0x75 'u' + 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x3E,0x00,0x00, - 8, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x3C,0x18,0x00,0x00, + 8, // 0x76 'v' + 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x3C,0x18,0x00,0x00, - 10, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6D,0x80,0x6D,0x80,0x6D,0x80,0x6D,0x80,0x33,0x00,0x33,0x00,0x00,0x00,0x00,0x00, + 10, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6D,0x80,0x6D,0x80,0x6D,0x80,0x6D,0x80,0x33,0x00,0x33,0x00,0x00,0x00,0x00,0x00, - 8, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x3C,0x3C,0x66,0x66,0x00,0x00, + 8, // 0x78 'x' + 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x3C,0x3C,0x66,0x66,0x00,0x00, - 8, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x3C,0x3C,0x18,0x18,0x30,0x30, + 8, // 0x79 'y' + 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x3C,0x3C,0x18,0x18,0x30,0x30, - 7, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x0C,0x18,0x30,0x60,0x7C,0x00,0x00, + 7, // 0x7A 'z' + 0x00,0x00,0x00,0x00,0x00,0x7C,0x0C,0x18,0x30,0x60,0x7C,0x00,0x00, - 8, // 0x7B '{' - 0x00,0x00,0x0E,0x18,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0E, + 8, // 0x7B '{' + 0x00,0x00,0x0E,0x18,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0E, - 6, // 0x7C '|' - 0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 6, // 0x7C '|' + 0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, - 8, // 0x7D '}' - 0x00,0x00,0x70,0x18,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x18,0x70, + 8, // 0x7D '}' + 0x00,0x00,0x70,0x18,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x18,0x70, - 9, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x49,0x00,0x49,0x00,0x46,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x7E '~' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x49,0x00,0x49,0x00,0x46,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x7F,0x80,0x00,0x00,0x00,0x00, + 11, // 0x7F '' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x7F,0x80,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u verdana14[] = - { - 14, 3, 32, 128-32, - 0x00,0x00,0x0F,0x00,0x1E,0x00,0x2D,0x00,0x4A,0x00,0x59,0x00,0x76,0x00,0x93,0x00,0xA2,0x00, - 0xB1,0x00,0xC0,0x00,0xCF,0x00,0xEC,0x00,0xFB,0x00,0x0A,0x01,0x19,0x01,0x28,0x01,0x37,0x01, - 0x46,0x01,0x55,0x01,0x64,0x01,0x73,0x01,0x82,0x01,0x91,0x01,0xA0,0x01,0xAF,0x01,0xBE,0x01, - 0xCD,0x01,0xDC,0x01,0xF9,0x01,0x16,0x02,0x33,0x02,0x42,0x02,0x5F,0x02,0x6E,0x02,0x7D,0x02, - 0x9A,0x02,0xB7,0x02,0xC6,0x02,0xD5,0x02,0xF2,0x02,0x0F,0x03,0x1E,0x03,0x2D,0x03,0x3C,0x03, - 0x4B,0x03,0x68,0x03,0x85,0x03,0xA2,0x03,0xB1,0x03,0xCE,0x03,0xDD,0x03,0xEC,0x03,0xFB,0x03, - 0x18,0x04,0x27,0x04,0x44,0x04,0x53,0x04,0x62,0x04,0x71,0x04,0x80,0x04,0x8F,0x04,0x9E,0x04, - 0xBB,0x04,0xCA,0x04,0xD9,0x04,0xE8,0x04,0xF7,0x04,0x06,0x05,0x15,0x05,0x24,0x05,0x33,0x05, - 0x42,0x05,0x51,0x05,0x60,0x05,0x6F,0x05,0x7E,0x05,0x8D,0x05,0xAA,0x05,0xB9,0x05,0xC8,0x05, - 0xD7,0x05,0xE6,0x05,0xF5,0x05,0x04,0x06,0x13,0x06,0x22,0x06,0x31,0x06,0x4E,0x06,0x5D,0x06, - 0x6C,0x06,0x7B,0x06,0x8A,0x06,0x99,0x06,0xA8,0x06,0xC5,0x06, +const int8u verdana14[] = +{ + 14, 3, 32, 128-32, + 0x00,0x00,0x0F,0x00,0x1E,0x00,0x2D,0x00,0x4A,0x00,0x59,0x00,0x76,0x00,0x93,0x00,0xA2,0x00, + 0xB1,0x00,0xC0,0x00,0xCF,0x00,0xEC,0x00,0xFB,0x00,0x0A,0x01,0x19,0x01,0x28,0x01,0x37,0x01, + 0x46,0x01,0x55,0x01,0x64,0x01,0x73,0x01,0x82,0x01,0x91,0x01,0xA0,0x01,0xAF,0x01,0xBE,0x01, + 0xCD,0x01,0xDC,0x01,0xF9,0x01,0x16,0x02,0x33,0x02,0x42,0x02,0x5F,0x02,0x6E,0x02,0x7D,0x02, + 0x9A,0x02,0xB7,0x02,0xC6,0x02,0xD5,0x02,0xF2,0x02,0x0F,0x03,0x1E,0x03,0x2D,0x03,0x3C,0x03, + 0x4B,0x03,0x68,0x03,0x85,0x03,0xA2,0x03,0xB1,0x03,0xCE,0x03,0xDD,0x03,0xEC,0x03,0xFB,0x03, + 0x18,0x04,0x27,0x04,0x44,0x04,0x53,0x04,0x62,0x04,0x71,0x04,0x80,0x04,0x8F,0x04,0x9E,0x04, + 0xBB,0x04,0xCA,0x04,0xD9,0x04,0xE8,0x04,0xF7,0x04,0x06,0x05,0x15,0x05,0x24,0x05,0x33,0x05, + 0x42,0x05,0x51,0x05,0x60,0x05,0x6F,0x05,0x7E,0x05,0x8D,0x05,0xAA,0x05,0xB9,0x05,0xC8,0x05, + 0xD7,0x05,0xE6,0x05,0xF5,0x05,0x04,0x06,0x13,0x06,0x22,0x06,0x31,0x06,0x4E,0x06,0x5D,0x06, + 0x6C,0x06,0x7B,0x06,0x8A,0x06,0x99,0x06,0xA8,0x06,0xC5,0x06, - 4, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x21 '!' - 0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, + 5, // 0x21 '!' + 0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, - 6, // 0x22 '"' - 0x00,0x00,0x48,0x48,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x22 '"' + 0x00,0x00,0x48,0x48,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x09,0x00,0x12,0x00,0x3F,0x80,0x12,0x00,0x12,0x00,0x7F,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00, + 10, // 0x23 '#' + 0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x09,0x00,0x12,0x00,0x3F,0x80,0x12,0x00,0x12,0x00,0x7F,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00, - 8, // 0x24 '$' - 0x00,0x00,0x10,0x10,0x3E,0x50,0x50,0x30,0x1C,0x12,0x12,0x7C,0x10,0x10, + 8, // 0x24 '$' + 0x00,0x00,0x10,0x10,0x3E,0x50,0x50,0x30,0x1C,0x12,0x12,0x7C,0x10,0x10, - 13, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x80,0x49,0x00,0x49,0x00,0x4A,0x00,0x32,0x60,0x02,0x90,0x04,0x90,0x04,0x90,0x08,0x60,0x00,0x00,0x00,0x00, + 13, // 0x25 '%' + 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x80,0x49,0x00,0x49,0x00,0x4A,0x00,0x32,0x60,0x02,0x90,0x04,0x90,0x04,0x90,0x08,0x60,0x00,0x00,0x00,0x00, - 10, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x39,0x00,0x45,0x00,0x42,0x00,0x43,0x00,0x3C,0x80,0x00,0x00,0x00,0x00, + 10, // 0x26 '&' + 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x39,0x00,0x45,0x00,0x42,0x00,0x43,0x00,0x3C,0x80,0x00,0x00,0x00,0x00, - 3, // 0x27 ''' - 0x00,0x00,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x27 ''' + 0x00,0x00,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x28 '(' - 0x00,0x00,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10, + 5, // 0x28 '(' + 0x00,0x00,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10, - 5, // 0x29 ')' - 0x00,0x00,0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40, + 5, // 0x29 ')' + 0x00,0x00,0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40, - 8, // 0x2A '*' - 0x00,0x00,0x10,0x54,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x2A '*' + 0x00,0x00,0x10,0x54,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00, + 9, // 0x2B '+' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00, - 4, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40, + 4, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40, - 5, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00, + 5, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00, - 4, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00, + 4, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00, - 5, // 0x2F '/' - 0x00,0x00,0x08,0x08,0x10,0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x40,0x80, + 5, // 0x2F '/' + 0x00,0x00,0x08,0x08,0x10,0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x40,0x80, - 8, // 0x30 '0' - 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, + 8, // 0x30 '0' + 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, - 8, // 0x31 '1' - 0x00,0x00,0x00,0x08,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00, + 8, // 0x31 '1' + 0x00,0x00,0x00,0x08,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00, - 8, // 0x32 '2' - 0x00,0x00,0x00,0x3C,0x42,0x42,0x02,0x04,0x18,0x20,0x40,0x7E,0x00,0x00, + 8, // 0x32 '2' + 0x00,0x00,0x00,0x3C,0x42,0x42,0x02,0x04,0x18,0x20,0x40,0x7E,0x00,0x00, - 8, // 0x33 '3' - 0x00,0x00,0x00,0x3C,0x42,0x02,0x02,0x1C,0x02,0x02,0x42,0x3C,0x00,0x00, + 8, // 0x33 '3' + 0x00,0x00,0x00,0x3C,0x42,0x02,0x02,0x1C,0x02,0x02,0x42,0x3C,0x00,0x00, - 8, // 0x34 '4' - 0x00,0x00,0x00,0x04,0x0C,0x14,0x24,0x44,0x7F,0x04,0x04,0x04,0x00,0x00, + 8, // 0x34 '4' + 0x00,0x00,0x00,0x04,0x0C,0x14,0x24,0x44,0x7F,0x04,0x04,0x04,0x00,0x00, - 8, // 0x35 '5' - 0x00,0x00,0x00,0x7E,0x40,0x40,0x7C,0x02,0x02,0x02,0x42,0x3C,0x00,0x00, + 8, // 0x35 '5' + 0x00,0x00,0x00,0x7E,0x40,0x40,0x7C,0x02,0x02,0x02,0x42,0x3C,0x00,0x00, - 8, // 0x36 '6' - 0x00,0x00,0x00,0x1C,0x20,0x40,0x7C,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, + 8, // 0x36 '6' + 0x00,0x00,0x00,0x1C,0x20,0x40,0x7C,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, - 8, // 0x37 '7' - 0x00,0x00,0x00,0x7E,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x00,0x00, + 8, // 0x37 '7' + 0x00,0x00,0x00,0x7E,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x00,0x00, - 8, // 0x38 '8' - 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x3C,0x42,0x42,0x42,0x3C,0x00,0x00, + 8, // 0x38 '8' + 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x3C,0x42,0x42,0x42,0x3C,0x00,0x00, - 8, // 0x39 '9' - 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x3E,0x02,0x04,0x38,0x00,0x00, + 8, // 0x39 '9' + 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x3E,0x02,0x04,0x38,0x00,0x00, - 5, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0x00,0x00, + 5, // 0x3A ':' + 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0x00,0x00, - 5, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0x20,0x40, + 5, // 0x3B ';' + 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0x20,0x40, - 9, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3C '<' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0x00,0x00,0x00, - 9, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3E '>' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x00,0x00,0x00,0x00, - 7, // 0x3F '?' - 0x00,0x00,0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, + 7, // 0x3F '?' + 0x00,0x00,0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, - 12, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x27,0x40,0x49,0x20,0x49,0x20,0x49,0x20,0x49,0x20,0x27,0xC0,0x30,0x00,0x0F,0x00,0x00,0x00, + 12, // 0x40 '@' + 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x27,0x40,0x49,0x20,0x49,0x20,0x49,0x20,0x49,0x20,0x27,0xC0,0x30,0x00,0x0F,0x00,0x00,0x00, - 8, // 0x41 'A' - 0x00,0x00,0x00,0x18,0x18,0x24,0x24,0x42,0x42,0x7E,0x81,0x81,0x00,0x00, + 8, // 0x41 'A' + 0x00,0x00,0x00,0x18,0x18,0x24,0x24,0x42,0x42,0x7E,0x81,0x81,0x00,0x00, - 8, // 0x42 'B' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x7C,0x42,0x42,0x42,0x7C,0x00,0x00, + 8, // 0x42 'B' + 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x7C,0x42,0x42,0x42,0x7C,0x00,0x00, - 9, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x43 'C' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, - 9, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 9, // 0x44 'D' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, - 8, // 0x45 'E' - 0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x7E,0x00,0x00, + 8, // 0x45 'E' + 0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x7E,0x00,0x00, - 7, // 0x46 'F' - 0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x40,0x00,0x00, + 7, // 0x46 'F' + 0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x40,0x00,0x00, - 9, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x47,0x00,0x41,0x00,0x41,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x47 'G' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x47,0x00,0x41,0x00,0x41,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, - 9, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7F,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00, + 9, // 0x48 'H' + 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7F,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00, - 5, // 0x49 'I' - 0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 5, // 0x49 'I' + 0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, - 5, // 0x4A 'J' - 0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xE0,0x00,0x00, + 5, // 0x4A 'J' + 0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xE0,0x00,0x00, - 8, // 0x4B 'K' - 0x00,0x00,0x00,0x42,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x42,0x00,0x00, + 8, // 0x4B 'K' + 0x00,0x00,0x00,0x42,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x42,0x00,0x00, - 7, // 0x4C 'L' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7E,0x00,0x00, + 7, // 0x4C 'L' + 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7E,0x00,0x00, - 10, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x52,0x80,0x52,0x80,0x52,0x80,0x4C,0x80,0x4C,0x80,0x40,0x80,0x40,0x80,0x00,0x00,0x00,0x00, + 10, // 0x4D 'M' + 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x52,0x80,0x52,0x80,0x52,0x80,0x4C,0x80,0x4C,0x80,0x40,0x80,0x40,0x80,0x00,0x00,0x00,0x00, - 9, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x00,0x61,0x00,0x51,0x00,0x51,0x00,0x49,0x00,0x45,0x00,0x45,0x00,0x43,0x00,0x43,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4E 'N' + 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x00,0x61,0x00,0x51,0x00,0x51,0x00,0x49,0x00,0x45,0x00,0x45,0x00,0x43,0x00,0x43,0x00,0x00,0x00,0x00,0x00, - 10, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, + 10, // 0x4F 'O' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, - 8, // 0x50 'P' - 0x00,0x00,0x00,0x7C,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40,0x00,0x00, + 8, // 0x50 'P' + 0x00,0x00,0x00,0x7C,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40,0x00,0x00, - 10, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x02,0x00,0x01,0x80, + 10, // 0x51 'Q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x02,0x00,0x01,0x80, - 8, // 0x52 'R' - 0x00,0x00,0x00,0x7C,0x42,0x42,0x42,0x7C,0x48,0x44,0x42,0x41,0x00,0x00, + 8, // 0x52 'R' + 0x00,0x00,0x00,0x7C,0x42,0x42,0x42,0x7C,0x48,0x44,0x42,0x41,0x00,0x00, - 8, // 0x53 'S' - 0x00,0x00,0x00,0x3C,0x42,0x40,0x40,0x3C,0x02,0x02,0x42,0x3C,0x00,0x00, + 8, // 0x53 'S' + 0x00,0x00,0x00,0x3C,0x42,0x40,0x40,0x3C,0x02,0x02,0x42,0x3C,0x00,0x00, - 7, // 0x54 'T' - 0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x54 'T' + 0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, - 9, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, + 9, // 0x55 'U' + 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, - 8, // 0x56 'V' - 0x00,0x00,0x00,0x81,0x81,0x42,0x42,0x42,0x24,0x24,0x18,0x18,0x00,0x00, + 8, // 0x56 'V' + 0x00,0x00,0x00,0x81,0x81,0x42,0x42,0x42,0x24,0x24,0x18,0x18,0x00,0x00, - 13, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x10,0x42,0x10,0x45,0x10,0x45,0x10,0x25,0x20,0x28,0xA0,0x28,0xA0,0x10,0x40,0x10,0x40,0x00,0x00,0x00,0x00, + 13, // 0x57 'W' + 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x10,0x42,0x10,0x45,0x10,0x45,0x10,0x25,0x20,0x28,0xA0,0x28,0xA0,0x10,0x40,0x10,0x40,0x00,0x00,0x00,0x00, - 8, // 0x58 'X' - 0x00,0x00,0x00,0x42,0x42,0x24,0x18,0x18,0x18,0x24,0x42,0x42,0x00,0x00, + 8, // 0x58 'X' + 0x00,0x00,0x00,0x42,0x42,0x24,0x18,0x18,0x18,0x24,0x42,0x42,0x00,0x00, - 7, // 0x59 'Y' - 0x00,0x00,0x00,0x82,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x59 'Y' + 0x00,0x00,0x00,0x82,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x10,0x00,0x00, - 8, // 0x5A 'Z' - 0x00,0x00,0x00,0x7E,0x02,0x04,0x08,0x10,0x10,0x20,0x40,0x7E,0x00,0x00, + 8, // 0x5A 'Z' + 0x00,0x00,0x00,0x7E,0x02,0x04,0x08,0x10,0x10,0x20,0x40,0x7E,0x00,0x00, - 5, // 0x5B '[' - 0x00,0x00,0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70, + 5, // 0x5B '[' + 0x00,0x00,0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70, - 5, // 0x5C '\' - 0x00,0x00,0x80,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x08, + 5, // 0x5C '\' + 0x00,0x00,0x80,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x08, - 5, // 0x5D ']' - 0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70, + 5, // 0x5D ']' + 0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70, - 10, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x12,0x00,0x21,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x5E '^' + 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x12,0x00,0x21,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, + 8, // 0x5F '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, - 8, // 0x60 '`' - 0x00,0x00,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x60 '`' + 0x00,0x00,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x02,0x02,0x3E,0x42,0x42,0x3E,0x00,0x00, + 8, // 0x61 'a' + 0x00,0x00,0x00,0x00,0x00,0x3C,0x02,0x02,0x3E,0x42,0x42,0x3E,0x00,0x00, - 8, // 0x62 'b' - 0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0x7C,0x00,0x00, + 8, // 0x62 'b' + 0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0x7C,0x00,0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00, + 6, // 0x63 'c' + 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00, - 8, // 0x64 'd' - 0x00,0x00,0x02,0x02,0x02,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00, + 8, // 0x64 'd' + 0x00,0x00,0x02,0x02,0x02,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00, - 8, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x7E,0x40,0x42,0x3C,0x00,0x00, + 8, // 0x65 'e' + 0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x7E,0x40,0x42,0x3C,0x00,0x00, - 4, // 0x66 'f' - 0x00,0x00,0x30,0x40,0x40,0xF0,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 4, // 0x66 'f' + 0x00,0x00,0x30,0x40,0x40,0xF0,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, - 8, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x02,0x3C, + 8, // 0x67 'g' + 0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x02,0x3C, - 8, // 0x68 'h' - 0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0x42,0x00,0x00, + 8, // 0x68 'h' + 0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0x42,0x00,0x00, - 3, // 0x69 'i' - 0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x69 'i' + 0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, - 4, // 0x6A 'j' - 0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xC0, + 4, // 0x6A 'j' + 0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xC0, - 7, // 0x6B 'k' - 0x00,0x00,0x40,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, + 7, // 0x6B 'k' + 0x00,0x00,0x40,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, - 3, // 0x6C 'l' - 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x6C 'l' + 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, - 11, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7B,0x80,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x00,0x00,0x00,0x00, + 11, // 0x6D 'm' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7B,0x80,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x00,0x00,0x00,0x00, - 8, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x42,0x42,0x00,0x00, + 8, // 0x6E 'n' + 0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x42,0x42,0x00,0x00, - 8, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, + 8, // 0x6F 'o' + 0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, - 8, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x42,0x7C,0x40,0x40, + 8, // 0x70 'p' + 0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x42,0x7C,0x40,0x40, - 8, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x02,0x02, + 8, // 0x71 'q' + 0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x02,0x02, - 5, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x58,0x60,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 5, // 0x72 'r' + 0x00,0x00,0x00,0x00,0x00,0x58,0x60,0x40,0x40,0x40,0x40,0x40,0x00,0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x40,0x40,0x38,0x04,0x04,0x78,0x00,0x00, + 7, // 0x73 's' + 0x00,0x00,0x00,0x00,0x00,0x3C,0x40,0x40,0x38,0x04,0x04,0x78,0x00,0x00, - 5, // 0x74 't' - 0x00,0x00,0x00,0x40,0x40,0xF8,0x40,0x40,0x40,0x40,0x40,0x38,0x00,0x00, + 5, // 0x74 't' + 0x00,0x00,0x00,0x40,0x40,0xF8,0x40,0x40,0x40,0x40,0x40,0x38,0x00,0x00, - 8, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00, + 8, // 0x75 'u' + 0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00, - 7, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, + 7, // 0x76 'v' + 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, - 11, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x40,0x44,0x40,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00, + 11, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x40,0x44,0x40,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, + 7, // 0x78 'x' + 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x10,0x20, + 7, // 0x79 'y' + 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x10,0x20, - 7, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 7, // 0x7A 'z' + 0x00,0x00,0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, - 8, // 0x7B '{' - 0x00,0x00,0x0C,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x10,0x0C, + 8, // 0x7B '{' + 0x00,0x00,0x0C,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x10,0x0C, - 5, // 0x7C '|' - 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 5, // 0x7C '|' + 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, - 8, // 0x7D '}' - 0x00,0x00,0x30,0x08,0x08,0x08,0x08,0x06,0x08,0x08,0x08,0x08,0x08,0x30, + 8, // 0x7D '}' + 0x00,0x00,0x30,0x08,0x08,0x08,0x08,0x06,0x08,0x08,0x08,0x08,0x08,0x30, - 10, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x80,0x4C,0x80,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x7E '~' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x80,0x4C,0x80,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0xE0,0x00,0x00,0x00,0x00, + 12, // 0x7F '' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0xE0,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u verdana14_bold[] = - { - 14, 3, 32, 128-32, - 0x00,0x00,0x0F,0x00,0x1E,0x00,0x2D,0x00,0x4A,0x00,0x67,0x00,0x84,0x00,0xA1,0x00,0xB0,0x00, - 0xBF,0x00,0xCE,0x00,0xEB,0x00,0x08,0x01,0x17,0x01,0x26,0x01,0x35,0x01,0x44,0x01,0x61,0x01, - 0x7E,0x01,0x9B,0x01,0xB8,0x01,0xD5,0x01,0xF2,0x01,0x0F,0x02,0x2C,0x02,0x49,0x02,0x66,0x02, - 0x75,0x02,0x84,0x02,0xA1,0x02,0xBE,0x02,0xDB,0x02,0xEA,0x02,0x07,0x03,0x24,0x03,0x41,0x03, - 0x5E,0x03,0x7B,0x03,0x8A,0x03,0x99,0x03,0xB6,0x03,0xD3,0x03,0xE2,0x03,0xF1,0x03,0x0E,0x04, - 0x1D,0x04,0x3A,0x04,0x57,0x04,0x74,0x04,0x91,0x04,0xAE,0x04,0xCB,0x04,0xE8,0x04,0xF7,0x04, - 0x14,0x05,0x31,0x05,0x4E,0x05,0x6B,0x05,0x88,0x05,0x97,0x05,0xA6,0x05,0xB5,0x05,0xC4,0x05, - 0xE1,0x05,0xFE,0x05,0x1B,0x06,0x2A,0x06,0x39,0x06,0x48,0x06,0x57,0x06,0x66,0x06,0x75,0x06, - 0x84,0x06,0x93,0x06,0xA2,0x06,0xB1,0x06,0xC0,0x06,0xCF,0x06,0xEC,0x06,0xFB,0x06,0x0A,0x07, - 0x19,0x07,0x28,0x07,0x37,0x07,0x46,0x07,0x55,0x07,0x64,0x07,0x73,0x07,0x90,0x07,0x9F,0x07, - 0xAE,0x07,0xBD,0x07,0xDA,0x07,0xE9,0x07,0x06,0x08,0x23,0x08, +const int8u verdana14_bold[] = +{ + 14, 3, 32, 128-32, + 0x00,0x00,0x0F,0x00,0x1E,0x00,0x2D,0x00,0x4A,0x00,0x67,0x00,0x84,0x00,0xA1,0x00,0xB0,0x00, + 0xBF,0x00,0xCE,0x00,0xEB,0x00,0x08,0x01,0x17,0x01,0x26,0x01,0x35,0x01,0x44,0x01,0x61,0x01, + 0x7E,0x01,0x9B,0x01,0xB8,0x01,0xD5,0x01,0xF2,0x01,0x0F,0x02,0x2C,0x02,0x49,0x02,0x66,0x02, + 0x75,0x02,0x84,0x02,0xA1,0x02,0xBE,0x02,0xDB,0x02,0xEA,0x02,0x07,0x03,0x24,0x03,0x41,0x03, + 0x5E,0x03,0x7B,0x03,0x8A,0x03,0x99,0x03,0xB6,0x03,0xD3,0x03,0xE2,0x03,0xF1,0x03,0x0E,0x04, + 0x1D,0x04,0x3A,0x04,0x57,0x04,0x74,0x04,0x91,0x04,0xAE,0x04,0xCB,0x04,0xE8,0x04,0xF7,0x04, + 0x14,0x05,0x31,0x05,0x4E,0x05,0x6B,0x05,0x88,0x05,0x97,0x05,0xA6,0x05,0xB5,0x05,0xC4,0x05, + 0xE1,0x05,0xFE,0x05,0x1B,0x06,0x2A,0x06,0x39,0x06,0x48,0x06,0x57,0x06,0x66,0x06,0x75,0x06, + 0x84,0x06,0x93,0x06,0xA2,0x06,0xB1,0x06,0xC0,0x06,0xCF,0x06,0xEC,0x06,0xFB,0x06,0x0A,0x07, + 0x19,0x07,0x28,0x07,0x37,0x07,0x46,0x07,0x55,0x07,0x64,0x07,0x73,0x07,0x90,0x07,0x9F,0x07, + 0xAE,0x07,0xBD,0x07,0xDA,0x07,0xE9,0x07,0x06,0x08,0x23,0x08, - 4, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x21 '!' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x60,0x60,0x00,0x00, + 5, // 0x21 '!' + 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x60,0x60,0x00,0x00, - 7, // 0x22 '"' - 0x00,0x00,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x00,0x00,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x09,0x00,0x3F,0x80,0x3F,0x80,0x12,0x00,0x7F,0x00,0x7F,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00, + 10, // 0x23 '#' + 0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x09,0x00,0x3F,0x80,0x3F,0x80,0x12,0x00,0x7F,0x00,0x7F,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00, - 9, // 0x24 '$' - 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x69,0x00,0x68,0x00,0x7E,0x00,0x3F,0x00,0x0B,0x00,0x4B,0x00,0x3E,0x00,0x08,0x00,0x08,0x00, + 9, // 0x24 '$' + 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x69,0x00,0x68,0x00,0x7E,0x00,0x3F,0x00,0x0B,0x00,0x4B,0x00,0x3E,0x00,0x08,0x00,0x08,0x00, - 15, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x6C,0x40,0x6C,0x80,0x6C,0xB8,0x6D,0x6C,0x3A,0x6C,0x02,0x6C,0x04,0x6C,0x04,0x38,0x00,0x00,0x00,0x00, + 15, // 0x25 '%' + 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x6C,0x40,0x6C,0x80,0x6C,0xB8,0x6D,0x6C,0x3A,0x6C,0x02,0x6C,0x04,0x6C,0x04,0x38,0x00,0x00,0x00,0x00, - 10, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x6C,0x00,0x6C,0x00,0x6C,0x00,0x39,0x80,0x6D,0x00,0x66,0x00,0x63,0x00,0x3D,0x80,0x00,0x00,0x00,0x00, + 10, // 0x26 '&' + 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x6C,0x00,0x6C,0x00,0x6C,0x00,0x39,0x80,0x6D,0x00,0x66,0x00,0x63,0x00,0x3D,0x80,0x00,0x00,0x00,0x00, - 4, // 0x27 ''' - 0x00,0x00,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x27 ''' + 0x00,0x00,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x28 '(' - 0x00,0x00,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18, + 7, // 0x28 '(' + 0x00,0x00,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18, - 7, // 0x29 ')' - 0x00,0x00,0x30,0x18,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x18,0x30, + 7, // 0x29 ')' + 0x00,0x00,0x30,0x18,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x18,0x30, - 9, // 0x2A '*' - 0x00,0x00,0x00,0x00,0x08,0x00,0x2A,0x00,0x1C,0x00,0x1C,0x00,0x2A,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x2A '*' + 0x00,0x00,0x00,0x00,0x08,0x00,0x2A,0x00,0x1C,0x00,0x1C,0x00,0x2A,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x2B '+' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x40, + 4, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x40, - 6, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00, + 4, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00, - 8, // 0x2F '/' - 0x00,0x00,0x06,0x06,0x0C,0x0C,0x0C,0x18,0x18,0x30,0x30,0x30,0x60,0x60, + 8, // 0x2F '/' + 0x00,0x00,0x06,0x06,0x0C,0x0C,0x0C,0x18,0x18,0x30,0x30,0x30,0x60,0x60, - 9, // 0x30 '0' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x30 '0' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, - 9, // 0x31 '1' - 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x3C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x3F,0x00,0x00,0x00,0x00,0x00, + 9, // 0x31 '1' + 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x3C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x3F,0x00,0x00,0x00,0x00,0x00, - 9, // 0x32 '2' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x7F,0x00,0x00,0x00,0x00,0x00, + 9, // 0x32 '2' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x7F,0x00,0x00,0x00,0x00,0x00, - 9, // 0x33 '3' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x03,0x00,0x03,0x00,0x1E,0x00,0x03,0x00,0x03,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x33 '3' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x03,0x00,0x03,0x00,0x1E,0x00,0x03,0x00,0x03,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, - 9, // 0x34 '4' - 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0E,0x00,0x16,0x00,0x16,0x00,0x26,0x00,0x46,0x00,0x7F,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00, + 9, // 0x34 '4' + 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0E,0x00,0x16,0x00,0x16,0x00,0x26,0x00,0x46,0x00,0x7F,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00, - 9, // 0x35 '5' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x30,0x00,0x30,0x00,0x3E,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x35 '5' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x30,0x00,0x30,0x00,0x3E,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, - 9, // 0x36 '6' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x30,0x00,0x60,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x36 '6' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x30,0x00,0x60,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, - 9, // 0x37 '7' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x00,0x00,0x00,0x00, + 9, // 0x37 '7' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x00,0x00,0x00,0x00, - 9, // 0x38 '8' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x38 '8' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, - 9, // 0x39 '9' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x03,0x00,0x06,0x00,0x3C,0x00,0x00,0x00,0x00,0x00, + 9, // 0x39 '9' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x03,0x00,0x06,0x00,0x3C,0x00,0x00,0x00,0x00,0x00, - 5, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00,0x00, + 5, // 0x3A ':' + 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00,0x00, - 5, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x60,0x40, + 5, // 0x3B ';' + 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x60,0x40, - 10, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x00,0x00,0x00,0x00,0x00, + 10, // 0x3C '<' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x00,0x00,0x00,0x00,0x00, - 10, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x00,0x00,0x00,0x00, + 10, // 0x3E '>' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x00,0x00,0x00,0x00, - 7, // 0x3F '?' - 0x00,0x00,0x00,0x38,0x4C,0x0C,0x18,0x30,0x30,0x00,0x30,0x30,0x00,0x00, + 7, // 0x3F '?' + 0x00,0x00,0x00,0x38,0x4C,0x0C,0x18,0x30,0x30,0x00,0x30,0x30,0x00,0x00, - 12, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x2F,0x40,0x5B,0x20,0x5B,0x20,0x5B,0x20,0x5B,0x20,0x2F,0xC0,0x30,0x00,0x0F,0x00,0x00,0x00, + 12, // 0x40 '@' + 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x2F,0x40,0x5B,0x20,0x5B,0x20,0x5B,0x20,0x5B,0x20,0x2F,0xC0,0x30,0x00,0x0F,0x00,0x00,0x00, - 9, // 0x41 'A' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x1C,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x7F,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00, + 9, // 0x41 'A' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x1C,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x7F,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00, - 9, // 0x42 'B' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x66,0x00,0x66,0x00,0x66,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x42 'B' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x66,0x00,0x66,0x00,0x66,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00, - 9, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x31,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x31,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x43 'C' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x31,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x31,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, - 10, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00, + 10, // 0x44 'D' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00, - 8, // 0x45 'E' - 0x00,0x00,0x00,0x7E,0x60,0x60,0x60,0x7E,0x60,0x60,0x60,0x7E,0x00,0x00, + 8, // 0x45 'E' + 0x00,0x00,0x00,0x7E,0x60,0x60,0x60,0x7E,0x60,0x60,0x60,0x7E,0x00,0x00, - 8, // 0x46 'F' - 0x00,0x00,0x00,0x7E,0x60,0x60,0x60,0x7E,0x60,0x60,0x60,0x60,0x00,0x00, + 8, // 0x46 'F' + 0x00,0x00,0x00,0x7E,0x60,0x60,0x60,0x7E,0x60,0x60,0x60,0x60,0x00,0x00, - 10, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x30,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x67,0x80,0x61,0x80,0x31,0x80,0x1F,0x80,0x00,0x00,0x00,0x00, + 10, // 0x47 'G' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x30,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x67,0x80,0x61,0x80,0x31,0x80,0x1F,0x80,0x00,0x00,0x00,0x00, - 10, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x7F,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00, + 10, // 0x48 'H' + 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x7F,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00, - 6, // 0x49 'I' - 0x00,0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00, + 6, // 0x49 'I' + 0x00,0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00, - 7, // 0x4A 'J' - 0x00,0x00,0x00,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0xF8,0x00,0x00, + 7, // 0x4A 'J' + 0x00,0x00,0x00,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0xF8,0x00,0x00, - 9, // 0x4B 'K' - 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x66,0x00,0x6C,0x00,0x78,0x00,0x70,0x00,0x78,0x00,0x6C,0x00,0x66,0x00,0x63,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4B 'K' + 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x66,0x00,0x6C,0x00,0x78,0x00,0x70,0x00,0x78,0x00,0x6C,0x00,0x66,0x00,0x63,0x00,0x00,0x00,0x00,0x00, - 8, // 0x4C 'L' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7F,0x00,0x00, + 8, // 0x4C 'L' + 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7F,0x00,0x00, - 11, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x71,0xC0,0x71,0xC0,0x5A,0xC0,0x5A,0xC0,0x4C,0xC0,0x4C,0xC0,0x40,0xC0,0x40,0xC0,0x00,0x00,0x00,0x00, + 11, // 0x4D 'M' + 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x71,0xC0,0x71,0xC0,0x5A,0xC0,0x5A,0xC0,0x4C,0xC0,0x4C,0xC0,0x40,0xC0,0x40,0xC0,0x00,0x00,0x00,0x00, - 10, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x80,0x70,0x80,0x58,0x80,0x58,0x80,0x4C,0x80,0x46,0x80,0x46,0x80,0x43,0x80,0x41,0x80,0x00,0x00,0x00,0x00, + 10, // 0x4E 'N' + 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x80,0x70,0x80,0x58,0x80,0x58,0x80,0x4C,0x80,0x46,0x80,0x46,0x80,0x43,0x80,0x41,0x80,0x00,0x00,0x00,0x00, - 11, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00, + 11, // 0x4F 'O' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00, - 9, // 0x50 'P' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00, + 9, // 0x50 'P' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00, - 11, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x06,0x00,0x03,0xC0, + 11, // 0x51 'Q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x06,0x00,0x03,0xC0, - 9, // 0x52 'R' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x6C,0x00,0x66,0x00,0x63,0x00,0x61,0x80,0x00,0x00,0x00,0x00, + 9, // 0x52 'R' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x6C,0x00,0x66,0x00,0x63,0x00,0x61,0x80,0x00,0x00,0x00,0x00, - 9, // 0x53 'S' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x61,0x00,0x60,0x00,0x70,0x00,0x3E,0x00,0x07,0x00,0x03,0x00,0x43,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x53 'S' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x61,0x00,0x60,0x00,0x70,0x00,0x3E,0x00,0x07,0x00,0x03,0x00,0x43,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, - 8, // 0x54 'T' - 0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00, + 8, // 0x54 'T' + 0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00, - 10, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00, + 10, // 0x55 'U' + 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00, - 9, // 0x56 'V' - 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, + 9, // 0x56 'V' + 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, - 14, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x18,0x63,0x18,0x63,0x18,0x33,0x30,0x37,0xB0,0x34,0xB0,0x1C,0xE0,0x18,0x60,0x18,0x60,0x00,0x00,0x00,0x00, + 14, // 0x57 'W' + 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x18,0x63,0x18,0x63,0x18,0x33,0x30,0x37,0xB0,0x34,0xB0,0x1C,0xE0,0x18,0x60,0x18,0x60,0x00,0x00,0x00,0x00, - 9, // 0x58 'X' - 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x36,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00, + 9, // 0x58 'X' + 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x36,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00, - 10, // 0x59 'Y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00, + 10, // 0x59 'Y' + 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00, - 8, // 0x5A 'Z' - 0x00,0x00,0x00,0x7E,0x0C,0x0C,0x18,0x18,0x30,0x30,0x60,0x7E,0x00,0x00, + 8, // 0x5A 'Z' + 0x00,0x00,0x00,0x7E,0x0C,0x0C,0x18,0x18,0x30,0x30,0x60,0x7E,0x00,0x00, - 6, // 0x5B '[' - 0x00,0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x78, + 6, // 0x5B '[' + 0x00,0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x78, - 8, // 0x5C '\' - 0x00,0x00,0x60,0x60,0x30,0x30,0x30,0x18,0x18,0x0C,0x0C,0x0C,0x06,0x06, + 8, // 0x5C '\' + 0x00,0x00,0x60,0x60,0x30,0x30,0x30,0x18,0x18,0x0C,0x0C,0x0C,0x06,0x06, - 6, // 0x5D ']' - 0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78, + 6, // 0x5D ']' + 0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78, - 10, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x5E '^' + 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x5F '_' - 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,0x80, + 9, // 0x5F '_' + 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,0x80, - 9, // 0x60 '`' - 0x00,0x00,0x00,0x00,0x30,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x60 '`' + 0x00,0x00,0x00,0x00,0x30,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x06,0x3E,0x66,0x66,0x66,0x3E,0x00,0x00, + 8, // 0x61 'a' + 0x00,0x00,0x00,0x00,0x00,0x3C,0x06,0x3E,0x66,0x66,0x66,0x3E,0x00,0x00, - 8, // 0x62 'b' - 0x00,0x00,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x7C,0x00,0x00, + 8, // 0x62 'b' + 0x00,0x00,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x7C,0x00,0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x62,0x60,0x60,0x60,0x62,0x3C,0x00,0x00, + 7, // 0x63 'c' + 0x00,0x00,0x00,0x00,0x00,0x3C,0x62,0x60,0x60,0x60,0x62,0x3C,0x00,0x00, - 8, // 0x64 'd' - 0x00,0x00,0x06,0x06,0x06,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x00,0x00, + 8, // 0x64 'd' + 0x00,0x00,0x06,0x06,0x06,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x00,0x00, - 8, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x7E,0x60,0x62,0x3C,0x00,0x00, + 8, // 0x65 'e' + 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x7E,0x60,0x62,0x3C,0x00,0x00, - 5, // 0x66 'f' - 0x00,0x00,0x38,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, + 5, // 0x66 'f' + 0x00,0x00,0x38,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, - 8, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x06,0x3C, + 8, // 0x67 'g' + 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x06,0x3C, - 8, // 0x68 'h' - 0x00,0x00,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00, + 8, // 0x68 'h' + 0x00,0x00,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00, - 4, // 0x69 'i' - 0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, + 4, // 0x69 'i' + 0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, - 5, // 0x6A 'j' - 0x00,0x00,0x30,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xE0, + 5, // 0x6A 'j' + 0x00,0x00,0x30,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xE0, - 8, // 0x6B 'k' - 0x00,0x00,0x60,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0x63,0x00,0x00, + 8, // 0x6B 'k' + 0x00,0x00,0x60,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0x63,0x00,0x00, - 4, // 0x6C 'l' - 0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, + 4, // 0x6C 'l' + 0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, - 12, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0xC0,0x77,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x00,0x00,0x00,0x00, + 12, // 0x6D 'm' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0xC0,0x77,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x00,0x00,0x00,0x00, - 8, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00, + 8, // 0x6E 'n' + 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00, - 8, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00, + 8, // 0x6F 'o' + 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00, - 8, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60, + 8, // 0x70 'p' + 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60, - 8, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x06,0x06, + 8, // 0x71 'q' + 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x06,0x06, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x6C,0x7C,0x60,0x60,0x60,0x60,0x60,0x00,0x00, + 6, // 0x72 'r' + 0x00,0x00,0x00,0x00,0x00,0x6C,0x7C,0x60,0x60,0x60,0x60,0x60,0x00,0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x60,0x60,0x38,0x0C,0x0C,0x78,0x00,0x00, + 7, // 0x73 's' + 0x00,0x00,0x00,0x00,0x00,0x3C,0x60,0x60,0x38,0x0C,0x0C,0x78,0x00,0x00, - 5, // 0x74 't' - 0x00,0x00,0x00,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x38,0x00,0x00, + 5, // 0x74 't' + 0x00,0x00,0x00,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x38,0x00,0x00, - 8, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3E,0x00,0x00, + 8, // 0x75 'u' + 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3E,0x00,0x00, - 8, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x3C,0x3C,0x18,0x00,0x00, + 8, // 0x76 'v' + 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x3C,0x3C,0x18,0x00,0x00, - 12, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x60,0x66,0x60,0x66,0x60,0x69,0x60,0x39,0xC0,0x30,0xC0,0x30,0xC0,0x00,0x00,0x00,0x00, + 12, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x60,0x66,0x60,0x66,0x60,0x69,0x60,0x39,0xC0,0x30,0xC0,0x30,0xC0,0x00,0x00,0x00,0x00, - 8, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x3C,0x18,0x3C,0x66,0x66,0x00,0x00, + 8, // 0x78 'x' + 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x3C,0x18,0x3C,0x66,0x66,0x00,0x00, - 8, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x3C,0x3C,0x18,0x18,0x30, + 8, // 0x79 'y' + 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x3C,0x3C,0x18,0x18,0x30, - 7, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x0C,0x18,0x38,0x30,0x60,0x7C,0x00,0x00, + 7, // 0x7A 'z' + 0x00,0x00,0x00,0x00,0x00,0x7C,0x0C,0x18,0x38,0x30,0x60,0x7C,0x00,0x00, - 9, // 0x7B '{' - 0x00,0x00,0x00,0x00,0x0E,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x70,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x0E,0x00, + 9, // 0x7B '{' + 0x00,0x00,0x00,0x00,0x0E,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x70,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x0E,0x00, - 6, // 0x7C '|' - 0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 6, // 0x7C '|' + 0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, - 9, // 0x7D '}' - 0x00,0x00,0x00,0x00,0x38,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x07,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x38,0x00, + 9, // 0x7D '}' + 0x00,0x00,0x00,0x00,0x38,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x07,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x38,0x00, - 10, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x80,0x48,0x80,0x44,0x80,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x7E '~' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x80,0x48,0x80,0x44,0x80,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0xE0,0x00,0x00,0x00,0x00, + 12, // 0x7F '' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0xE0,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u verdana16[] = - { - 16, 4, 32, 128-32, - 0x00,0x00,0x11,0x00,0x22,0x00,0x33,0x00,0x54,0x00,0x65,0x00,0x86,0x00,0xA7,0x00,0xB8,0x00, - 0xC9,0x00,0xDA,0x00,0xFB,0x00,0x1C,0x01,0x2D,0x01,0x3E,0x01,0x4F,0x01,0x60,0x01,0x71,0x01, - 0x82,0x01,0x93,0x01,0xA4,0x01,0xB5,0x01,0xC6,0x01,0xD7,0x01,0xE8,0x01,0xF9,0x01,0x0A,0x02, - 0x1B,0x02,0x2C,0x02,0x4D,0x02,0x6E,0x02,0x8F,0x02,0xA0,0x02,0xC1,0x02,0xE2,0x02,0xF3,0x02, - 0x14,0x03,0x35,0x03,0x46,0x03,0x57,0x03,0x78,0x03,0x99,0x03,0xAA,0x03,0xBB,0x03,0xCC,0x03, - 0xDD,0x03,0xFE,0x03,0x1F,0x04,0x40,0x04,0x51,0x04,0x72,0x04,0x93,0x04,0xB4,0x04,0xD5,0x04, - 0xF6,0x04,0x17,0x05,0x38,0x05,0x59,0x05,0x7A,0x05,0x9B,0x05,0xAC,0x05,0xBD,0x05,0xCE,0x05, - 0xEF,0x05,0x00,0x06,0x11,0x06,0x22,0x06,0x33,0x06,0x44,0x06,0x55,0x06,0x66,0x06,0x77,0x06, - 0x88,0x06,0x99,0x06,0xAA,0x06,0xBB,0x06,0xCC,0x06,0xDD,0x06,0xFE,0x06,0x0F,0x07,0x20,0x07, - 0x31,0x07,0x42,0x07,0x53,0x07,0x64,0x07,0x75,0x07,0x86,0x07,0x97,0x07,0xB8,0x07,0xC9,0x07, - 0xDA,0x07,0xEB,0x07,0xFC,0x07,0x0D,0x08,0x1E,0x08,0x3F,0x08, +const int8u verdana16[] = +{ + 16, 4, 32, 128-32, + 0x00,0x00,0x11,0x00,0x22,0x00,0x33,0x00,0x54,0x00,0x65,0x00,0x86,0x00,0xA7,0x00,0xB8,0x00, + 0xC9,0x00,0xDA,0x00,0xFB,0x00,0x1C,0x01,0x2D,0x01,0x3E,0x01,0x4F,0x01,0x60,0x01,0x71,0x01, + 0x82,0x01,0x93,0x01,0xA4,0x01,0xB5,0x01,0xC6,0x01,0xD7,0x01,0xE8,0x01,0xF9,0x01,0x0A,0x02, + 0x1B,0x02,0x2C,0x02,0x4D,0x02,0x6E,0x02,0x8F,0x02,0xA0,0x02,0xC1,0x02,0xE2,0x02,0xF3,0x02, + 0x14,0x03,0x35,0x03,0x46,0x03,0x57,0x03,0x78,0x03,0x99,0x03,0xAA,0x03,0xBB,0x03,0xCC,0x03, + 0xDD,0x03,0xFE,0x03,0x1F,0x04,0x40,0x04,0x51,0x04,0x72,0x04,0x93,0x04,0xB4,0x04,0xD5,0x04, + 0xF6,0x04,0x17,0x05,0x38,0x05,0x59,0x05,0x7A,0x05,0x9B,0x05,0xAC,0x05,0xBD,0x05,0xCE,0x05, + 0xEF,0x05,0x00,0x06,0x11,0x06,0x22,0x06,0x33,0x06,0x44,0x06,0x55,0x06,0x66,0x06,0x77,0x06, + 0x88,0x06,0x99,0x06,0xAA,0x06,0xBB,0x06,0xCC,0x06,0xDD,0x06,0xFE,0x06,0x0F,0x07,0x20,0x07, + 0x31,0x07,0x42,0x07,0x53,0x07,0x64,0x07,0x75,0x07,0x86,0x07,0x97,0x07,0xB8,0x07,0xC9,0x07, + 0xDA,0x07,0xEB,0x07,0xFC,0x07,0x0D,0x08,0x1E,0x08,0x3F,0x08, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x21 '!' - 0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x00,0x00,0x00, + 5, // 0x21 '!' + 0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x00,0x00,0x00, - 5, // 0x22 '"' - 0x00,0x00,0x00,0x50,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x22 '"' + 0x00,0x00,0x00,0x50,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x09,0x00,0x3F,0x80,0x12,0x00,0x12,0x00,0x7F,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x23 '#' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x09,0x00,0x3F,0x80,0x12,0x00,0x12,0x00,0x7F,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x24 '$' - 0x00,0x00,0x00,0x10,0x10,0x3E,0x50,0x50,0x30,0x1C,0x12,0x12,0x7C,0x10,0x10,0x00, + 8, // 0x24 '$' + 0x00,0x00,0x00,0x10,0x10,0x3E,0x50,0x50,0x30,0x1C,0x12,0x12,0x7C,0x10,0x10,0x00, - 13, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x44,0x80,0x45,0x00,0x45,0x00,0x3A,0xE0,0x05,0x10,0x05,0x10,0x09,0x10,0x10,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x25 '%' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x44,0x80,0x45,0x00,0x45,0x00,0x3A,0xE0,0x05,0x10,0x05,0x10,0x09,0x10,0x10,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x38,0x80,0x45,0x00,0x42,0x00,0x46,0x00,0x39,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x26 '&' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x38,0x80,0x45,0x00,0x42,0x00,0x46,0x00,0x39,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 3, // 0x27 ''' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x27 ''' + 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x28 '(' - 0x00,0x00,0x00,0x08,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x08, + 6, // 0x28 '(' + 0x00,0x00,0x00,0x08,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x08, - 6, // 0x29 ')' - 0x00,0x00,0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40, + 6, // 0x29 ')' + 0x00,0x00,0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40, - 9, // 0x2A '*' - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x2A '*' + 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x2B '+' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x00, + 5, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x00, - 7, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, + 5, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, - 6, // 0x2F '/' - 0x00,0x00,0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, + 6, // 0x2F '/' + 0x00,0x00,0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, - 8, // 0x30 '0' - 0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x30 '0' + 0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,0x00, - 8, // 0x31 '1' - 0x00,0x00,0x00,0x00,0x08,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,0x00, + 8, // 0x31 '1' + 0x00,0x00,0x00,0x00,0x08,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,0x00, - 8, // 0x32 '2' - 0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x02,0x04,0x18,0x20,0x40,0x7E,0x00,0x00,0x00, + 8, // 0x32 '2' + 0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x02,0x04,0x18,0x20,0x40,0x7E,0x00,0x00,0x00, - 8, // 0x33 '3' - 0x00,0x00,0x00,0x00,0x3C,0x42,0x02,0x02,0x1C,0x02,0x02,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x33 '3' + 0x00,0x00,0x00,0x00,0x3C,0x42,0x02,0x02,0x1C,0x02,0x02,0x42,0x3C,0x00,0x00,0x00, - 8, // 0x34 '4' - 0x00,0x00,0x00,0x00,0x04,0x0C,0x14,0x24,0x44,0x7F,0x04,0x04,0x04,0x00,0x00,0x00, + 8, // 0x34 '4' + 0x00,0x00,0x00,0x00,0x04,0x0C,0x14,0x24,0x44,0x7F,0x04,0x04,0x04,0x00,0x00,0x00, - 8, // 0x35 '5' - 0x00,0x00,0x00,0x00,0x3E,0x20,0x20,0x20,0x3C,0x02,0x02,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x35 '5' + 0x00,0x00,0x00,0x00,0x3E,0x20,0x20,0x20,0x3C,0x02,0x02,0x42,0x3C,0x00,0x00,0x00, - 8, // 0x36 '6' - 0x00,0x00,0x00,0x00,0x1C,0x20,0x40,0x7C,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x36 '6' + 0x00,0x00,0x00,0x00,0x1C,0x20,0x40,0x7C,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,0x00, - 8, // 0x37 '7' - 0x00,0x00,0x00,0x00,0x7E,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x10,0x00,0x00,0x00, + 8, // 0x37 '7' + 0x00,0x00,0x00,0x00,0x7E,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x10,0x00,0x00,0x00, - 8, // 0x38 '8' - 0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x3C,0x42,0x42,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x38 '8' + 0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x3C,0x42,0x42,0x42,0x3C,0x00,0x00,0x00, - 8, // 0x39 '9' - 0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x3E,0x02,0x04,0x38,0x00,0x00,0x00, + 8, // 0x39 '9' + 0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x3E,0x02,0x04,0x38,0x00,0x00,0x00, - 6, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, + 6, // 0x3A ':' + 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, - 6, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x00, + 6, // 0x3B ';' + 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x00, - 9, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3C '<' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3E '>' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x3F '?' - 0x00,0x00,0x00,0x00,0x38,0x44,0x04,0x08,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00, + 7, // 0x3F '?' + 0x00,0x00,0x00,0x00,0x38,0x44,0x04,0x08,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00, - 13, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x10,0x40,0x27,0xA0,0x48,0x90,0x48,0x90,0x48,0x90,0x48,0x90,0x48,0x90,0x27,0xE0,0x10,0x00,0x0F,0x80,0x00,0x00, + 13, // 0x40 '@' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x10,0x40,0x27,0xA0,0x48,0x90,0x48,0x90,0x48,0x90,0x48,0x90,0x48,0x90,0x27,0xE0,0x10,0x00,0x0F,0x80,0x00,0x00, - 9, // 0x41 'A' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x14,0x00,0x14,0x00,0x22,0x00,0x22,0x00,0x3E,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x41 'A' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x14,0x00,0x14,0x00,0x22,0x00,0x22,0x00,0x3E,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x42 'B' - 0x00,0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x7C,0x42,0x42,0x42,0x7C,0x00,0x00,0x00, + 8, // 0x42 'B' + 0x00,0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x7C,0x42,0x42,0x42,0x7C,0x00,0x00,0x00, - 9, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x43 'C' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x44 'D' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x45 'E' - 0x00,0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x7E,0x00,0x00,0x00, + 8, // 0x45 'E' + 0x00,0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x7E,0x00,0x00,0x00, - 8, // 0x46 'F' - 0x00,0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 8, // 0x46 'F' + 0x00,0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 9, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x47,0x00,0x41,0x00,0x21,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x47 'G' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x47,0x00,0x41,0x00,0x21,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7F,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x48 'H' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7F,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x49 'I' - 0x00,0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, + 5, // 0x49 'I' + 0x00,0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, - 6, // 0x4A 'J' - 0x00,0x00,0x00,0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xF0,0x00,0x00,0x00, + 6, // 0x4A 'J' + 0x00,0x00,0x00,0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xF0,0x00,0x00,0x00, - 8, // 0x4B 'K' - 0x00,0x00,0x00,0x00,0x42,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x42,0x00,0x00,0x00, + 8, // 0x4B 'K' + 0x00,0x00,0x00,0x00,0x42,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x42,0x00,0x00,0x00, - 7, // 0x4C 'L' - 0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7E,0x00,0x00,0x00, + 7, // 0x4C 'L' + 0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7E,0x00,0x00,0x00, - 11, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x51,0x40,0x51,0x40,0x4A,0x40,0x4A,0x40,0x44,0x40,0x44,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x4D 'M' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x51,0x40,0x51,0x40,0x4A,0x40,0x4A,0x40,0x44,0x40,0x44,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x00,0x61,0x00,0x51,0x00,0x51,0x00,0x49,0x00,0x45,0x00,0x45,0x00,0x43,0x00,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4E 'N' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x00,0x61,0x00,0x51,0x00,0x51,0x00,0x49,0x00,0x45,0x00,0x45,0x00,0x43,0x00,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x4F 'O' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x50 'P' - 0x00,0x00,0x00,0x00,0x7C,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40,0x00,0x00,0x00, + 8, // 0x50 'P' + 0x00,0x00,0x00,0x00,0x7C,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40,0x00,0x00,0x00, - 10, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x02,0x00,0x01,0x80,0x00,0x00, + 10, // 0x51 'Q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x02,0x00,0x01,0x80,0x00,0x00, - 9, // 0x52 'R' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x44,0x00,0x78,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x52 'R' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x44,0x00,0x78,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x53 'S' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x40,0x00,0x40,0x00,0x3E,0x00,0x01,0x00,0x01,0x00,0x41,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x53 'S' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x40,0x00,0x40,0x00,0x3E,0x00,0x01,0x00,0x01,0x00,0x41,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x54 'T' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x54 'T' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x55 'U' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x56 'V' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x56 'V' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 13, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x10,0x42,0x10,0x45,0x10,0x45,0x10,0x25,0x20,0x28,0xA0,0x28,0xA0,0x10,0x40,0x10,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x57 'W' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x10,0x42,0x10,0x45,0x10,0x45,0x10,0x25,0x20,0x28,0xA0,0x28,0xA0,0x10,0x40,0x10,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x58 'X' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x14,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x58 'X' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x14,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x59 'Y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x59 'Y' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x5A 'Z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x01,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x5A 'Z' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x01,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x5B '[' - 0x00,0x00,0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, + 6, // 0x5B '[' + 0x00,0x00,0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, - 6, // 0x5C '\' - 0x00,0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, + 6, // 0x5C '\' + 0x00,0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, - 6, // 0x5D ']' - 0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00, + 6, // 0x5D ']' + 0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00, - 11, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0A,0x00,0x11,0x00,0x20,0x80,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x5E '^' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0A,0x00,0x11,0x00,0x20,0x80,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00, + 8, // 0x5F '_' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00, - 8, // 0x60 '`' - 0x00,0x00,0x00,0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x60 '`' + 0x00,0x00,0x00,0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x02,0x02,0x3E,0x42,0x42,0x3E,0x00,0x00,0x00, + 8, // 0x61 'a' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x02,0x02,0x3E,0x42,0x42,0x3E,0x00,0x00,0x00, - 8, // 0x62 'b' - 0x00,0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0x7C,0x00,0x00,0x00, + 8, // 0x62 'b' + 0x00,0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0x7C,0x00,0x00,0x00, - 8, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x40,0x40,0x40,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x63 'c' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x40,0x40,0x40,0x42,0x3C,0x00,0x00,0x00, - 8, // 0x64 'd' - 0x00,0x00,0x00,0x02,0x02,0x02,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00,0x00, + 8, // 0x64 'd' + 0x00,0x00,0x00,0x02,0x02,0x02,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00,0x00, - 8, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x7E,0x40,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x65 'e' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x7E,0x40,0x42,0x3C,0x00,0x00,0x00, - 6, // 0x66 'f' - 0x00,0x00,0x00,0x1C,0x20,0x20,0x78,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00, + 6, // 0x66 'f' + 0x00,0x00,0x00,0x1C,0x20,0x20,0x78,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00, - 8, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x02,0x02,0x3C, + 8, // 0x67 'g' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x02,0x02,0x3C, - 8, // 0x68 'h' - 0x00,0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x00, + 8, // 0x68 'h' + 0x00,0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x00, - 3, // 0x69 'i' - 0x00,0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 3, // 0x69 'i' + 0x00,0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 4, // 0x6A 'j' - 0x00,0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xC0, + 4, // 0x6A 'j' + 0x00,0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xC0, - 7, // 0x6B 'k' - 0x00,0x00,0x00,0x40,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00,0x00, + 7, // 0x6B 'k' + 0x00,0x00,0x00,0x40,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00,0x00, - 3, // 0x6C 'l' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 3, // 0x6C 'l' + 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 11, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x59,0x80,0x66,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x6D 'm' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x59,0x80,0x66,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x00, + 8, // 0x6E 'n' + 0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x00, - 8, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x6F 'o' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,0x00, - 8, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40, + 8, // 0x70 'p' + 0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40, - 8, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x02,0x02,0x02, + 8, // 0x71 'q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x02,0x02,0x02, - 5, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x60,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 5, // 0x72 'r' + 0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x60,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x40,0x40,0x38,0x04,0x04,0x78,0x00,0x00,0x00, + 7, // 0x73 's' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x40,0x40,0x38,0x04,0x04,0x78,0x00,0x00,0x00, - 6, // 0x74 't' - 0x00,0x00,0x00,0x00,0x20,0x20,0x78,0x20,0x20,0x20,0x20,0x20,0x18,0x00,0x00,0x00, + 6, // 0x74 't' + 0x00,0x00,0x00,0x00,0x20,0x20,0x78,0x20,0x20,0x20,0x20,0x20,0x18,0x00,0x00,0x00, - 8, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00,0x00, + 8, // 0x75 'u' + 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00,0x00, - 8, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x00,0x00,0x00, + 8, // 0x76 'v' + 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x00,0x00,0x00, - 11, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x40,0x44,0x40,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x40,0x44,0x40,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00,0x00, + 7, // 0x78 'x' + 0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00,0x00, - 8, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x10,0x10,0x20, + 8, // 0x79 'y' + 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x10,0x10,0x20, - 7, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, + 7, // 0x7A 'z' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, - 8, // 0x7B '{' - 0x00,0x00,0x00,0x0C,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x10,0x0C,0x00, + 8, // 0x7B '{' + 0x00,0x00,0x00,0x0C,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x10,0x0C,0x00, - 7, // 0x7C '|' - 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, + 7, // 0x7C '|' + 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, - 8, // 0x7D '}' - 0x00,0x00,0x00,0x30,0x08,0x08,0x08,0x08,0x06,0x08,0x08,0x08,0x08,0x08,0x30,0x00, + 8, // 0x7D '}' + 0x00,0x00,0x00,0x30,0x08,0x08,0x08,0x08,0x06,0x08,0x08,0x08,0x08,0x08,0x30,0x00, - 11, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x80,0x4C,0x80,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x7E '~' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x80,0x4C,0x80,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 13, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF0,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x3F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x7F '' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF0,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x3F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u verdana16_bold[] = - { - 16, 4, 32, 128-32, - 0x00,0x00,0x11,0x00,0x22,0x00,0x33,0x00,0x54,0x00,0x75,0x00,0xA6,0x00,0xC7,0x00,0xD8,0x00, - 0xE9,0x00,0xFA,0x00,0x1B,0x01,0x3C,0x01,0x4D,0x01,0x5E,0x01,0x6F,0x01,0x90,0x01,0xB1,0x01, - 0xD2,0x01,0xF3,0x01,0x14,0x02,0x35,0x02,0x56,0x02,0x77,0x02,0x98,0x02,0xB9,0x02,0xDA,0x02, - 0xEB,0x02,0xFC,0x02,0x1D,0x03,0x3E,0x03,0x5F,0x03,0x70,0x03,0x91,0x03,0xB2,0x03,0xD3,0x03, - 0xF4,0x03,0x15,0x04,0x36,0x04,0x57,0x04,0x78,0x04,0x99,0x04,0xAA,0x04,0xBB,0x04,0xDC,0x04, - 0xED,0x04,0x0E,0x05,0x2F,0x05,0x50,0x05,0x71,0x05,0x92,0x05,0xB3,0x05,0xD4,0x05,0xE5,0x05, - 0x06,0x06,0x27,0x06,0x48,0x06,0x69,0x06,0x8A,0x06,0xAB,0x06,0xBC,0x06,0xDD,0x06,0xEE,0x06, - 0x0F,0x07,0x30,0x07,0x51,0x07,0x72,0x07,0x93,0x07,0xA4,0x07,0xC5,0x07,0xE6,0x07,0xF7,0x07, - 0x18,0x08,0x39,0x08,0x4A,0x08,0x5B,0x08,0x6C,0x08,0x7D,0x08,0x9E,0x08,0xBF,0x08,0xE0,0x08, - 0x01,0x09,0x22,0x09,0x33,0x09,0x44,0x09,0x55,0x09,0x76,0x09,0x97,0x09,0xB8,0x09,0xD9,0x09, - 0xFA,0x09,0x0B,0x0A,0x2C,0x0A,0x3D,0x0A,0x5E,0x0A,0x7F,0x0A, +const int8u verdana16_bold[] = +{ + 16, 4, 32, 128-32, + 0x00,0x00,0x11,0x00,0x22,0x00,0x33,0x00,0x54,0x00,0x75,0x00,0xA6,0x00,0xC7,0x00,0xD8,0x00, + 0xE9,0x00,0xFA,0x00,0x1B,0x01,0x3C,0x01,0x4D,0x01,0x5E,0x01,0x6F,0x01,0x90,0x01,0xB1,0x01, + 0xD2,0x01,0xF3,0x01,0x14,0x02,0x35,0x02,0x56,0x02,0x77,0x02,0x98,0x02,0xB9,0x02,0xDA,0x02, + 0xEB,0x02,0xFC,0x02,0x1D,0x03,0x3E,0x03,0x5F,0x03,0x70,0x03,0x91,0x03,0xB2,0x03,0xD3,0x03, + 0xF4,0x03,0x15,0x04,0x36,0x04,0x57,0x04,0x78,0x04,0x99,0x04,0xAA,0x04,0xBB,0x04,0xDC,0x04, + 0xED,0x04,0x0E,0x05,0x2F,0x05,0x50,0x05,0x71,0x05,0x92,0x05,0xB3,0x05,0xD4,0x05,0xE5,0x05, + 0x06,0x06,0x27,0x06,0x48,0x06,0x69,0x06,0x8A,0x06,0xAB,0x06,0xBC,0x06,0xDD,0x06,0xEE,0x06, + 0x0F,0x07,0x30,0x07,0x51,0x07,0x72,0x07,0x93,0x07,0xA4,0x07,0xC5,0x07,0xE6,0x07,0xF7,0x07, + 0x18,0x08,0x39,0x08,0x4A,0x08,0x5B,0x08,0x6C,0x08,0x7D,0x08,0x9E,0x08,0xBF,0x08,0xE0,0x08, + 0x01,0x09,0x22,0x09,0x33,0x09,0x44,0x09,0x55,0x09,0x76,0x09,0x97,0x09,0xB8,0x09,0xD9,0x09, + 0xFA,0x09,0x0B,0x0A,0x2C,0x0A,0x3D,0x0A,0x5E,0x0A,0x7F,0x0A, - 4, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x21 '!' - 0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, + 6, // 0x21 '!' + 0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, - 7, // 0x22 '"' - 0x00,0x00,0x00,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x00,0x00,0x00,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x09,0x00,0x3F,0x80,0x3F,0x80,0x12,0x00,0x7F,0x00,0x7F,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x23 '#' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x09,0x00,0x3F,0x80,0x3F,0x80,0x12,0x00,0x7F,0x00,0x7F,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x24 '$' - 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x69,0x00,0x68,0x00,0x78,0x00,0x3E,0x00,0x0F,0x00,0x0B,0x00,0x4B,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x00,0x00, + 9, // 0x24 '$' + 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x69,0x00,0x68,0x00,0x78,0x00,0x3E,0x00,0x0F,0x00,0x0B,0x00,0x4B,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x00,0x00, - 17, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x20,0x00,0x66,0x20,0x00,0x66,0x40,0x00,0x66,0x5E,0x00,0x66,0xB3,0x00,0x3D,0x33,0x00,0x01,0x33,0x00,0x02,0x33,0x00,0x02,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 17, // 0x25 '%' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x20,0x00,0x66,0x20,0x00,0x66,0x40,0x00,0x66,0x5E,0x00,0x66,0xB3,0x00,0x3D,0x33,0x00,0x01,0x33,0x00,0x02,0x33,0x00,0x02,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x66,0x00,0x66,0x00,0x66,0xC0,0x3C,0xC0,0x66,0x80,0x63,0x00,0x63,0x80,0x3C,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x26 '&' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x66,0x00,0x66,0x00,0x66,0xC0,0x3C,0xC0,0x66,0x80,0x63,0x00,0x63,0x80,0x3C,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x27 ''' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x27 ''' + 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x28 '(' - 0x00,0x00,0x00,0x0C,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18,0x0C, + 7, // 0x28 '(' + 0x00,0x00,0x00,0x0C,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18,0x0C, - 7, // 0x29 ')' - 0x00,0x00,0x00,0x60,0x30,0x18,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x18,0x30,0x60, + 7, // 0x29 ')' + 0x00,0x00,0x00,0x60,0x30,0x18,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x18,0x30,0x60, - 9, // 0x2A '*' - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x49,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x49,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x2A '*' + 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x49,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x49,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x3F,0x80,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x2B '+' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x3F,0x80,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x60,0x60,0xC0,0xC0, + 5, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x60,0x60,0xC0,0xC0, - 7, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, + 5, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, - 9, // 0x2F '/' - 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x60,0x00,0x00,0x00, + 9, // 0x2F '/' + 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x60,0x00,0x00,0x00, - 9, // 0x30 '0' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x30 '0' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x31 '1' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x3C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x31 '1' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x3C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x32 '2' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x32 '2' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x33 '3' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x03,0x00,0x0E,0x00,0x03,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x33 '3' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x03,0x00,0x0E,0x00,0x03,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x34 '4' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0E,0x00,0x16,0x00,0x26,0x00,0x46,0x00,0x7F,0x80,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x34 '4' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0E,0x00,0x16,0x00,0x26,0x00,0x46,0x00,0x7F,0x80,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x35 '5' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x30,0x00,0x30,0x00,0x3E,0x00,0x03,0x00,0x03,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x35 '5' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x30,0x00,0x30,0x00,0x3E,0x00,0x03,0x00,0x03,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x36 '6' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x30,0x00,0x60,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x36 '6' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x30,0x00,0x60,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x37 '7' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x37 '7' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x38 '8' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x38 '8' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x39 '9' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x03,0x00,0x06,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x39 '9' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x03,0x00,0x06,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, + 5, // 0x3A ':' + 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, - 5, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x38,0x30,0x30,0x60,0x60, + 5, // 0x3B ';' + 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x38,0x30,0x30,0x60,0x60, - 11, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x3C '<' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,0x00,0x00,0x00,0x00,0x3F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,0x00,0x00,0x00,0x00,0x3F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x40,0x01,0x80,0x06,0x00,0x18,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x3E '>' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x40,0x01,0x80,0x06,0x00,0x18,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x3F '?' - 0x00,0x00,0x00,0x00,0x3C,0x66,0x06,0x0C,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00, + 8, // 0x3F '?' + 0x00,0x00,0x00,0x00,0x3C,0x66,0x06,0x0C,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00, - 13, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x30,0x60,0x27,0xA0,0x4D,0x90,0x4D,0x90,0x4D,0x90,0x4D,0x90,0x27,0xE0,0x30,0x00,0x0F,0x80,0x00,0x00,0x00,0x00, + 13, // 0x40 '@' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x30,0x60,0x27,0xA0,0x4D,0x90,0x4D,0x90,0x4D,0x90,0x4D,0x90,0x27,0xE0,0x30,0x00,0x0F,0x80,0x00,0x00,0x00,0x00, - 10, // 0x41 'A' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x1E,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x7F,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x41 'A' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x1E,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x7F,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x42 'B' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x42 'B' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x61,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x61,0x80,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x43 'C' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x61,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x61,0x80,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x44 'D' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x45 'E' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x45 'E' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x46 'F' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x46 'F' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x61,0x80,0x60,0x00,0x60,0x00,0x63,0x80,0x61,0x80,0x31,0x80,0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x47 'G' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x61,0x80,0x60,0x00,0x60,0x00,0x63,0x80,0x61,0x80,0x31,0x80,0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x7F,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x48 'H' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x7F,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x49 'I' - 0x00,0x00,0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, + 6, // 0x49 'I' + 0x00,0x00,0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, - 7, // 0x4A 'J' - 0x00,0x00,0x00,0x00,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0xF8,0x00,0x00,0x00, + 7, // 0x4A 'J' + 0x00,0x00,0x00,0x00,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0xF8,0x00,0x00,0x00, - 9, // 0x4B 'K' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x66,0x00,0x6C,0x00,0x78,0x00,0x78,0x00,0x6C,0x00,0x66,0x00,0x63,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4B 'K' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x66,0x00,0x6C,0x00,0x78,0x00,0x78,0x00,0x6C,0x00,0x66,0x00,0x63,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x4C 'L' - 0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7F,0x00,0x00,0x00, + 8, // 0x4C 'L' + 0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7F,0x00,0x00,0x00, - 12, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0xE0,0x70,0xE0,0x59,0x60,0x59,0x60,0x4E,0x60,0x4E,0x60,0x44,0x60,0x44,0x60,0x40,0x60,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x4D 'M' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0xE0,0x70,0xE0,0x59,0x60,0x59,0x60,0x4E,0x60,0x4E,0x60,0x44,0x60,0x44,0x60,0x40,0x60,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x80,0x70,0x80,0x58,0x80,0x58,0x80,0x4C,0x80,0x46,0x80,0x46,0x80,0x43,0x80,0x43,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x4E 'N' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x80,0x70,0x80,0x58,0x80,0x58,0x80,0x4C,0x80,0x46,0x80,0x46,0x80,0x43,0x80,0x43,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x4F 'O' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x50 'P' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x50 'P' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x03,0x00,0x01,0xC0,0x00,0x00, + 11, // 0x51 'Q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x03,0x00,0x01,0xC0,0x00,0x00, - 9, // 0x52 'R' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x6C,0x00,0x66,0x00,0x63,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x52 'R' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x6C,0x00,0x66,0x00,0x63,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x53 'S' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x70,0x00,0x3E,0x00,0x07,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x53 'S' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x70,0x00,0x3E,0x00,0x07,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x54 'T' - 0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00, + 8, // 0x54 'T' + 0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00, - 10, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x55 'U' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x56 'V' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x33,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x56 'V' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x33,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 14, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x18,0x63,0x18,0x63,0x18,0x33,0x30,0x37,0xB0,0x34,0xB0,0x1C,0xE0,0x18,0x60,0x18,0x60,0x00,0x00,0x00,0x00,0x00,0x00, + 14, // 0x57 'W' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x18,0x63,0x18,0x63,0x18,0x33,0x30,0x37,0xB0,0x34,0xB0,0x1C,0xE0,0x18,0x60,0x18,0x60,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x58 'X' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x33,0x00,0x33,0x00,0x1E,0x00,0x0C,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x58 'X' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x33,0x00,0x33,0x00,0x1E,0x00,0x0C,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x59 'Y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x59 'Y' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x5A 'Z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x5A 'Z' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x5B '[' - 0x00,0x00,0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x78,0x00, + 6, // 0x5B '[' + 0x00,0x00,0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x78,0x00, - 9, // 0x5C '\' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x03,0x00,0x00,0x00, + 9, // 0x5C '\' + 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x03,0x00,0x00,0x00, - 6, // 0x5D ']' - 0x00,0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x00, + 6, // 0x5D ']' + 0x00,0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x00, - 10, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x5E '^' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x5F '_' - 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,0x80,0x00,0x00, + 9, // 0x5F '_' + 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,0x80,0x00,0x00, - 9, // 0x60 '`' - 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x60 '`' + 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x03,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x61 'a' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x03,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x62 'b' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6E,0x00,0x73,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x62 'b' + 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6E,0x00,0x73,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x60,0x60,0x60,0x63,0x3E,0x00,0x00,0x00, + 8, // 0x63 'c' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x60,0x60,0x60,0x63,0x3E,0x00,0x00,0x00, - 9, // 0x64 'd' - 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x67,0x00,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x64 'd' + 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x67,0x00,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x7F,0x00,0x60,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x65 'e' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x7F,0x00,0x60,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x66 'f' - 0x00,0x00,0x00,0x38,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 5, // 0x66 'f' + 0x00,0x00,0x00,0x38,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, - 9, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x67,0x00,0x3B,0x00,0x03,0x00,0x03,0x00,0x3E,0x00, + 9, // 0x67 'g' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x67,0x00,0x3B,0x00,0x03,0x00,0x03,0x00,0x3E,0x00, - 9, // 0x68 'h' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6E,0x00,0x73,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x68 'h' + 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6E,0x00,0x73,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x69 'i' - 0x00,0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 4, // 0x69 'i' + 0x00,0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, - 5, // 0x6A 'j' - 0x00,0x00,0x00,0x30,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xE0, + 5, // 0x6A 'j' + 0x00,0x00,0x00,0x30,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xE0, - 8, // 0x6B 'k' - 0x00,0x00,0x00,0x60,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0x63,0x00,0x00,0x00, + 8, // 0x6B 'k' + 0x00,0x00,0x00,0x60,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0x63,0x00,0x00,0x00, - 4, // 0x6C 'l' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 4, // 0x6C 'l' + 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, - 14, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x70,0x73,0x98,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x00,0x00,0x00,0x00,0x00,0x00, + 14, // 0x6D 'm' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x70,0x73,0x98,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x00,0x73,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6E 'n' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x00,0x73,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6F 'o' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x00,0x73,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00, + 9, // 0x70 'p' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x00,0x73,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00, - 9, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x67,0x00,0x3B,0x00,0x03,0x00,0x03,0x00,0x03,0x00, + 9, // 0x71 'q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x67,0x00,0x3B,0x00,0x03,0x00,0x03,0x00,0x03,0x00, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0x7C,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 6, // 0x72 'r' + 0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0x7C,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, - 8, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x60,0x70,0x3C,0x0E,0x06,0x7C,0x00,0x00,0x00, + 8, // 0x73 's' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x60,0x70,0x3C,0x0E,0x06,0x7C,0x00,0x00,0x00, - 6, // 0x74 't' - 0x00,0x00,0x00,0x00,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x38,0x00,0x00,0x00, + 6, // 0x74 't' + 0x00,0x00,0x00,0x00,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x38,0x00,0x00,0x00, - 9, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x67,0x00,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x75 'u' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x67,0x00,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x76 'v' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x60,0x66,0x60,0x66,0x60,0x69,0x60,0x39,0xC0,0x30,0xC0,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x60,0x66,0x60,0x66,0x60,0x69,0x60,0x39,0xC0,0x30,0xC0,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x1C,0x00,0x36,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x78 'x' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x1C,0x00,0x36,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00, + 9, // 0x79 'y' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00, - 8, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x06,0x0C,0x18,0x30,0x60,0x7E,0x00,0x00,0x00, + 8, // 0x7A 'z' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x06,0x0C,0x18,0x30,0x60,0x7E,0x00,0x00,0x00, - 9, // 0x7B '{' - 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x70,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x07,0x00,0x00,0x00, + 9, // 0x7B '{' + 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x70,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x07,0x00,0x00,0x00, - 8, // 0x7C '|' - 0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00, + 8, // 0x7C '|' + 0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00, - 9, // 0x7D '}' - 0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x07,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x70,0x00,0x00,0x00, + 9, // 0x7D '}' + 0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x07,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x70,0x00,0x00,0x00, - 11, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x44,0x40,0x44,0x40,0x43,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x7E '~' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x44,0x40,0x44,0x40,0x43,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 13, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF0,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x3F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x7F '' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF0,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x3F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u verdana17[] = - { - 17, 4, 32, 128-32, - 0x00,0x00,0x12,0x00,0x24,0x00,0x36,0x00,0x59,0x00,0x7C,0x00,0x9F,0x00,0xC2,0x00,0xD4,0x00, - 0xE6,0x00,0xF8,0x00,0x1B,0x01,0x3E,0x01,0x50,0x01,0x62,0x01,0x74,0x01,0x86,0x01,0xA9,0x01, - 0xCC,0x01,0xEF,0x01,0x12,0x02,0x35,0x02,0x58,0x02,0x7B,0x02,0x9E,0x02,0xC1,0x02,0xE4,0x02, - 0xF6,0x02,0x08,0x03,0x2B,0x03,0x4E,0x03,0x71,0x03,0x83,0x03,0xA6,0x03,0xC9,0x03,0xEC,0x03, - 0x0F,0x04,0x32,0x04,0x55,0x04,0x67,0x04,0x8A,0x04,0xAD,0x04,0xBF,0x04,0xD1,0x04,0xF4,0x04, - 0x06,0x05,0x29,0x05,0x4C,0x05,0x6F,0x05,0x81,0x05,0xA4,0x05,0xC7,0x05,0xEA,0x05,0x0D,0x06, - 0x30,0x06,0x53,0x06,0x76,0x06,0x99,0x06,0xBC,0x06,0xDF,0x06,0xF1,0x06,0x03,0x07,0x15,0x07, - 0x38,0x07,0x5B,0x07,0x7E,0x07,0x90,0x07,0xB3,0x07,0xC5,0x07,0xE8,0x07,0xFA,0x07,0x0C,0x08, - 0x2F,0x08,0x52,0x08,0x64,0x08,0x76,0x08,0x88,0x08,0x9A,0x08,0xBD,0x08,0xE0,0x08,0x03,0x09, - 0x26,0x09,0x49,0x09,0x5B,0x09,0x6D,0x09,0x7F,0x09,0xA2,0x09,0xB4,0x09,0xD7,0x09,0xFA,0x09, - 0x0C,0x0A,0x1E,0x0A,0x41,0x0A,0x53,0x0A,0x76,0x0A,0x99,0x0A, +const int8u verdana17[] = +{ + 17, 4, 32, 128-32, + 0x00,0x00,0x12,0x00,0x24,0x00,0x36,0x00,0x59,0x00,0x7C,0x00,0x9F,0x00,0xC2,0x00,0xD4,0x00, + 0xE6,0x00,0xF8,0x00,0x1B,0x01,0x3E,0x01,0x50,0x01,0x62,0x01,0x74,0x01,0x86,0x01,0xA9,0x01, + 0xCC,0x01,0xEF,0x01,0x12,0x02,0x35,0x02,0x58,0x02,0x7B,0x02,0x9E,0x02,0xC1,0x02,0xE4,0x02, + 0xF6,0x02,0x08,0x03,0x2B,0x03,0x4E,0x03,0x71,0x03,0x83,0x03,0xA6,0x03,0xC9,0x03,0xEC,0x03, + 0x0F,0x04,0x32,0x04,0x55,0x04,0x67,0x04,0x8A,0x04,0xAD,0x04,0xBF,0x04,0xD1,0x04,0xF4,0x04, + 0x06,0x05,0x29,0x05,0x4C,0x05,0x6F,0x05,0x81,0x05,0xA4,0x05,0xC7,0x05,0xEA,0x05,0x0D,0x06, + 0x30,0x06,0x53,0x06,0x76,0x06,0x99,0x06,0xBC,0x06,0xDF,0x06,0xF1,0x06,0x03,0x07,0x15,0x07, + 0x38,0x07,0x5B,0x07,0x7E,0x07,0x90,0x07,0xB3,0x07,0xC5,0x07,0xE8,0x07,0xFA,0x07,0x0C,0x08, + 0x2F,0x08,0x52,0x08,0x64,0x08,0x76,0x08,0x88,0x08,0x9A,0x08,0xBD,0x08,0xE0,0x08,0x03,0x09, + 0x26,0x09,0x49,0x09,0x5B,0x09,0x6D,0x09,0x7F,0x09,0xA2,0x09,0xB4,0x09,0xD7,0x09,0xFA,0x09, + 0x0C,0x0A,0x1E,0x0A,0x41,0x0A,0x53,0x0A,0x76,0x0A,0x99,0x0A, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x21 '!' - 0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x00,0x00,0x00, + 6, // 0x21 '!' + 0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x00,0x00,0x00, - 6, // 0x22 '"' - 0x00,0x00,0x00,0x48,0x48,0x48,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x22 '"' + 0x00,0x00,0x00,0x48,0x48,0x48,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x04,0x80,0x09,0x00,0x3F,0xC0,0x09,0x00,0x12,0x00,0x7F,0x80,0x12,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x23 '#' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x04,0x80,0x09,0x00,0x3F,0xC0,0x09,0x00,0x12,0x00,0x7F,0x80,0x12,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x24 '$' - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x49,0x00,0x48,0x00,0x48,0x00,0x3E,0x00,0x09,0x00,0x09,0x00,0x49,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x00,0x00, + 9, // 0x24 '$' + 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x49,0x00,0x48,0x00,0x48,0x00,0x3E,0x00,0x09,0x00,0x09,0x00,0x49,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x00,0x00, - 15, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x20,0x44,0x40,0x44,0x80,0x44,0x80,0x45,0x38,0x39,0x44,0x02,0x44,0x04,0x44,0x04,0x44,0x08,0x38,0x00,0x00,0x00,0x00,0x00,0x00, + 15, // 0x25 '%' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x20,0x44,0x40,0x44,0x80,0x44,0x80,0x45,0x38,0x39,0x44,0x02,0x44,0x04,0x44,0x04,0x44,0x08,0x38,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x42,0x00,0x42,0x00,0x44,0x00,0x38,0x80,0x44,0x80,0x42,0x80,0x41,0x00,0x22,0x80,0x1C,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x26 '&' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x42,0x00,0x42,0x00,0x44,0x00,0x38,0x80,0x44,0x80,0x42,0x80,0x41,0x00,0x22,0x80,0x1C,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x27 ''' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x27 ''' + 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x28 '(' - 0x00,0x00,0x00,0x08,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x08, + 6, // 0x28 '(' + 0x00,0x00,0x00,0x08,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x08, - 6, // 0x29 ')' - 0x00,0x00,0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40, + 6, // 0x29 ')' + 0x00,0x00,0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40, - 9, // 0x2A '*' - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x49,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x49,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x2A '*' + 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x49,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x49,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x7F,0xC0,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x2B '+' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x7F,0xC0,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x00, + 5, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x00, - 7, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, + 5, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, - 6, // 0x2F '/' - 0x00,0x00,0x00,0x04,0x08,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x80,0x80,0x00, + 6, // 0x2F '/' + 0x00,0x00,0x00,0x04,0x08,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x80,0x80,0x00, - 9, // 0x30 '0' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x30 '0' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x31 '1' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x38,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x31 '1' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x38,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x32 '2' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x01,0x00,0x01,0x00,0x02,0x00,0x0C,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x32 '2' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x01,0x00,0x01,0x00,0x02,0x00,0x0C,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x33 '3' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x01,0x00,0x02,0x00,0x1C,0x00,0x02,0x00,0x01,0x00,0x01,0x00,0x42,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x33 '3' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x01,0x00,0x02,0x00,0x1C,0x00,0x02,0x00,0x01,0x00,0x01,0x00,0x42,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x34 '4' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x06,0x00,0x0A,0x00,0x12,0x00,0x22,0x00,0x42,0x00,0x7F,0x80,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x34 '4' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x06,0x00,0x0A,0x00,0x12,0x00,0x22,0x00,0x42,0x00,0x7F,0x80,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x35 '5' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7C,0x00,0x02,0x00,0x01,0x00,0x01,0x00,0x42,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x35 '5' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7C,0x00,0x02,0x00,0x01,0x00,0x01,0x00,0x42,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x36 '6' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x30,0x00,0x20,0x00,0x40,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x36 '6' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x30,0x00,0x20,0x00,0x40,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x37 '7' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x10,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x37 '7' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x10,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x38 '8' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x3E,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x38 '8' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x3E,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x39 '9' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x21,0x00,0x1F,0x00,0x01,0x00,0x02,0x00,0x06,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x39 '9' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x21,0x00,0x1F,0x00,0x01,0x00,0x02,0x00,0x06,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, + 6, // 0x3A ':' + 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, - 6, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x00, + 6, // 0x3B ';' + 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x00, - 11, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x06,0x00,0x18,0x00,0x60,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x3C '<' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x06,0x00,0x18,0x00,0x60,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xC0,0x00,0x00,0x00,0x00,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xC0,0x00,0x00,0x00,0x00,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x3E '>' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x3F '?' - 0x00,0x00,0x00,0x00,0x3C,0x42,0x02,0x02,0x0C,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00, + 8, // 0x3F '?' + 0x00,0x00,0x00,0x00,0x3C,0x42,0x02,0x02,0x0C,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00, - 14, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x18,0x20,0x20,0x10,0x27,0xC8,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x27,0xF0,0x20,0x00,0x18,0x00,0x07,0xC0,0x00,0x00, + 14, // 0x40 '@' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x18,0x20,0x20,0x10,0x27,0xC8,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x27,0xF0,0x20,0x00,0x18,0x00,0x07,0xC0,0x00,0x00, - 10, // 0x41 'A' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x12,0x00,0x12,0x00,0x21,0x00,0x21,0x00,0x21,0x00,0x7F,0x80,0x40,0x80,0x80,0x40,0x80,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x41 'A' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x12,0x00,0x12,0x00,0x21,0x00,0x21,0x00,0x21,0x00,0x7F,0x80,0x40,0x80,0x80,0x40,0x80,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x42 'B' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7E,0x00,0x41,0x00,0x40,0x80,0x40,0x80,0x41,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x42 'B' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7E,0x00,0x41,0x00,0x40,0x80,0x40,0x80,0x41,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0x80,0x20,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x30,0x80,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x43 'C' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0x80,0x20,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x30,0x80,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x80,0x40,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x41,0x80,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x44 'D' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x80,0x40,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x41,0x80,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x45 'E' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x45 'E' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x46 'F' - 0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 8, // 0x46 'F' + 0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 11, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x20,0x40,0x40,0x00,0x40,0x00,0x43,0xC0,0x40,0x40,0x20,0x40,0x30,0x40,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x47 'G' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x20,0x40,0x40,0x00,0x40,0x00,0x43,0xC0,0x40,0x40,0x20,0x40,0x30,0x40,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x7F,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x48 'H' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x7F,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x49 'I' - 0x00,0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, + 5, // 0x49 'I' + 0x00,0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, - 6, // 0x4A 'J' - 0x00,0x00,0x00,0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xF0,0x00,0x00,0x00, + 6, // 0x4A 'J' + 0x00,0x00,0x00,0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xF0,0x00,0x00,0x00, - 10, // 0x4B 'K' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x42,0x00,0x44,0x00,0x48,0x00,0x50,0x00,0x68,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x4B 'K' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x42,0x00,0x44,0x00,0x48,0x00,0x50,0x00,0x68,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x4C 'L' - 0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x00,0x00,0x00, + 8, // 0x4C 'L' + 0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x00,0x00,0x00, - 11, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x51,0x40,0x51,0x40,0x4A,0x40,0x4A,0x40,0x44,0x40,0x44,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x4D 'M' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x51,0x40,0x51,0x40,0x4A,0x40,0x4A,0x40,0x44,0x40,0x44,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x80,0x60,0x80,0x50,0x80,0x48,0x80,0x48,0x80,0x44,0x80,0x44,0x80,0x42,0x80,0x41,0x80,0x41,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x4E 'N' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x80,0x60,0x80,0x50,0x80,0x48,0x80,0x48,0x80,0x44,0x80,0x44,0x80,0x42,0x80,0x41,0x80,0x41,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x31,0x80,0x20,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x80,0x31,0x80,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x4F 'O' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x31,0x80,0x20,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x80,0x31,0x80,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x50 'P' - 0x00,0x00,0x00,0x00,0x7C,0x42,0x41,0x41,0x42,0x7C,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 8, // 0x50 'P' + 0x00,0x00,0x00,0x00,0x7C,0x42,0x41,0x41,0x42,0x7C,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 11, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x31,0x80,0x20,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x80,0x31,0x80,0x0E,0x00,0x02,0x00,0x02,0x00,0x01,0xC0, + 11, // 0x51 'Q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x31,0x80,0x20,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x80,0x31,0x80,0x0E,0x00,0x02,0x00,0x02,0x00,0x01,0xC0, - 10, // 0x52 'R' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x44,0x00,0x78,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x52 'R' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x44,0x00,0x78,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x53 'S' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x20,0x80,0x40,0x00,0x40,0x00,0x38,0x00,0x07,0x00,0x00,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x53 'S' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x20,0x80,0x40,0x00,0x40,0x00,0x38,0x00,0x07,0x00,0x00,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x54 'T' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x80,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x54 'T' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x80,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x55 'U' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x56 'V' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x80,0x40,0x40,0x80,0x40,0x80,0x21,0x00,0x21,0x00,0x21,0x00,0x12,0x00,0x12,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x56 'V' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x80,0x40,0x40,0x80,0x40,0x80,0x21,0x00,0x21,0x00,0x21,0x00,0x12,0x00,0x12,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 15, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x04,0x41,0x04,0x22,0x88,0x22,0x88,0x22,0x88,0x14,0x50,0x14,0x50,0x14,0x50,0x08,0x20,0x08,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 15, // 0x57 'W' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x04,0x41,0x04,0x22,0x88,0x22,0x88,0x22,0x88,0x14,0x50,0x14,0x50,0x14,0x50,0x08,0x20,0x08,0x20,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x58 'X' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x21,0x00,0x12,0x00,0x12,0x00,0x0C,0x00,0x0C,0x00,0x12,0x00,0x12,0x00,0x21,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x58 'X' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x21,0x00,0x12,0x00,0x12,0x00,0x0C,0x00,0x0C,0x00,0x12,0x00,0x12,0x00,0x21,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x59 'Y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x41,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x59 'Y' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x41,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x5A 'Z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x80,0x01,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x5A 'Z' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x80,0x01,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x5B '[' - 0x00,0x00,0x00,0x3C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3C, + 6, // 0x5B '[' + 0x00,0x00,0x00,0x3C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3C, - 6, // 0x5C '\' - 0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x08,0x08,0x04,0x00, + 6, // 0x5C '\' + 0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x08,0x08,0x04,0x00, - 6, // 0x5D ']' - 0x00,0x00,0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78, + 6, // 0x5D ']' + 0x00,0x00,0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78, - 11, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0A,0x00,0x11,0x00,0x20,0x80,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x5E '^' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0A,0x00,0x11,0x00,0x20,0x80,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x5F '_' - 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,0x80,0x00,0x00, + 9, // 0x5F '_' + 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,0x80,0x00,0x00, - 9, // 0x60 '`' - 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,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, + 9, // 0x60 '`' + 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,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, - 8, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x02,0x3E,0x42,0x42,0x46,0x3A,0x00,0x00,0x00, + 8, // 0x61 'a' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x02,0x3E,0x42,0x42,0x46,0x3A,0x00,0x00,0x00, - 9, // 0x62 'b' - 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x5C,0x00,0x62,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x62 'b' + 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x5C,0x00,0x62,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x40,0x40,0x40,0x40,0x22,0x1C,0x00,0x00,0x00, + 7, // 0x63 'c' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x40,0x40,0x40,0x40,0x22,0x1C,0x00,0x00,0x00, - 9, // 0x64 'd' - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x64 'd' + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x42,0x7E,0x40,0x40,0x22,0x1C,0x00,0x00,0x00, + 8, // 0x65 'e' + 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x42,0x7E,0x40,0x40,0x22,0x1C,0x00,0x00,0x00, - 6, // 0x66 'f' - 0x00,0x00,0x00,0x1C,0x20,0x20,0x7C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00, + 6, // 0x66 'f' + 0x00,0x00,0x00,0x1C,0x20,0x20,0x7C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00, - 9, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x01,0x00,0x22,0x00,0x1C,0x00, + 9, // 0x67 'g' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x01,0x00,0x22,0x00,0x1C,0x00, - 9, // 0x68 'h' - 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x5E,0x00,0x61,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x68 'h' + 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x5E,0x00,0x61,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 3, // 0x69 'i' - 0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 3, // 0x69 'i' + 0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 5, // 0x6A 'j' - 0x00,0x00,0x00,0x00,0x10,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xE0, + 5, // 0x6A 'j' + 0x00,0x00,0x00,0x00,0x10,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xE0, - 8, // 0x6B 'k' - 0x00,0x00,0x00,0x40,0x40,0x40,0x42,0x44,0x48,0x50,0x70,0x48,0x44,0x42,0x00,0x00,0x00, + 8, // 0x6B 'k' + 0x00,0x00,0x00,0x40,0x40,0x40,0x42,0x44,0x48,0x50,0x70,0x48,0x44,0x42,0x00,0x00,0x00, - 3, // 0x6C 'l' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 3, // 0x6C 'l' + 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 13, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0xE0,0x63,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x6D 'm' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0xE0,0x63,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5E,0x00,0x61,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6E 'n' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5E,0x00,0x61,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6F 'o' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x00,0x62,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x40,0x00,0x40,0x00,0x40,0x00, + 9, // 0x70 'p' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x00,0x62,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x40,0x00,0x40,0x00,0x40,0x00, - 9, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x01,0x00,0x01,0x00,0x01,0x00, + 9, // 0x71 'q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x01,0x00,0x01,0x00,0x01,0x00, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 6, // 0x72 'r' + 0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 8, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x40,0x30,0x0C,0x02,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x73 's' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x40,0x30,0x0C,0x02,0x42,0x3C,0x00,0x00,0x00, - 6, // 0x74 't' - 0x00,0x00,0x00,0x00,0x20,0x20,0x7C,0x20,0x20,0x20,0x20,0x20,0x20,0x1C,0x00,0x00,0x00, + 6, // 0x74 't' + 0x00,0x00,0x00,0x00,0x20,0x20,0x7C,0x20,0x20,0x20,0x20,0x20,0x20,0x1C,0x00,0x00,0x00, - 9, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x43,0x00,0x3D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x75 'u' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x43,0x00,0x3D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x18,0x00,0x00,0x00, + 8, // 0x76 'v' + 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x18,0x00,0x00,0x00, - 11, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x40,0x44,0x40,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x40,0x44,0x40,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x14,0x00,0x22,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x78 'x' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x14,0x00,0x22,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x18,0x10,0x10,0x20, + 8, // 0x79 'y' + 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x18,0x10,0x10,0x20, - 8, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x02,0x04,0x08,0x10,0x20,0x40,0x7E,0x00,0x00,0x00, + 8, // 0x7A 'z' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x02,0x04,0x08,0x10,0x20,0x40,0x7E,0x00,0x00,0x00, - 9, // 0x7B '{' - 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x60,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x07,0x00, + 9, // 0x7B '{' + 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x60,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x07,0x00, - 6, // 0x7C '|' - 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 6, // 0x7C '|' + 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, - 9, // 0x7D '}' - 0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x04,0x00,0x03,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x70,0x00, + 9, // 0x7D '}' + 0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x04,0x00,0x03,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x70,0x00, - 11, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x44,0x40,0x44,0x40,0x43,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x7E '~' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x44,0x40,0x44,0x40,0x43,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 14, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, + 14, // 0x7F '' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u verdana17_bold[] = - { - 17, 4, 32, 128-32, - 0x00,0x00,0x12,0x00,0x24,0x00,0x36,0x00,0x59,0x00,0x7C,0x00,0xB0,0x00,0xD3,0x00,0xE5,0x00, - 0xF7,0x00,0x09,0x01,0x2C,0x01,0x4F,0x01,0x61,0x01,0x73,0x01,0x85,0x01,0xA8,0x01,0xCB,0x01, - 0xEE,0x01,0x11,0x02,0x34,0x02,0x57,0x02,0x7A,0x02,0x9D,0x02,0xC0,0x02,0xE3,0x02,0x06,0x03, - 0x18,0x03,0x2A,0x03,0x4D,0x03,0x70,0x03,0x93,0x03,0xB6,0x03,0xD9,0x03,0xFC,0x03,0x1F,0x04, - 0x42,0x04,0x65,0x04,0x88,0x04,0xAB,0x04,0xCE,0x04,0xF1,0x04,0x03,0x05,0x15,0x05,0x38,0x05, - 0x5B,0x05,0x7E,0x05,0xA1,0x05,0xC4,0x05,0xE7,0x05,0x0A,0x06,0x2D,0x06,0x50,0x06,0x73,0x06, - 0x96,0x06,0xB9,0x06,0xDC,0x06,0xFF,0x06,0x22,0x07,0x45,0x07,0x57,0x07,0x7A,0x07,0x8C,0x07, - 0xAF,0x07,0xD2,0x07,0xF5,0x07,0x18,0x08,0x3B,0x08,0x4D,0x08,0x70,0x08,0x93,0x08,0xA5,0x08, - 0xC8,0x08,0xEB,0x08,0xFD,0x08,0x0F,0x09,0x32,0x09,0x44,0x09,0x67,0x09,0x8A,0x09,0xAD,0x09, - 0xD0,0x09,0xF3,0x09,0x05,0x0A,0x17,0x0A,0x29,0x0A,0x4C,0x0A,0x6F,0x0A,0x92,0x0A,0xB5,0x0A, - 0xD8,0x0A,0xEA,0x0A,0x0D,0x0B,0x1F,0x0B,0x42,0x0B,0x65,0x0B, +const int8u verdana17_bold[] = +{ + 17, 4, 32, 128-32, + 0x00,0x00,0x12,0x00,0x24,0x00,0x36,0x00,0x59,0x00,0x7C,0x00,0xB0,0x00,0xD3,0x00,0xE5,0x00, + 0xF7,0x00,0x09,0x01,0x2C,0x01,0x4F,0x01,0x61,0x01,0x73,0x01,0x85,0x01,0xA8,0x01,0xCB,0x01, + 0xEE,0x01,0x11,0x02,0x34,0x02,0x57,0x02,0x7A,0x02,0x9D,0x02,0xC0,0x02,0xE3,0x02,0x06,0x03, + 0x18,0x03,0x2A,0x03,0x4D,0x03,0x70,0x03,0x93,0x03,0xB6,0x03,0xD9,0x03,0xFC,0x03,0x1F,0x04, + 0x42,0x04,0x65,0x04,0x88,0x04,0xAB,0x04,0xCE,0x04,0xF1,0x04,0x03,0x05,0x15,0x05,0x38,0x05, + 0x5B,0x05,0x7E,0x05,0xA1,0x05,0xC4,0x05,0xE7,0x05,0x0A,0x06,0x2D,0x06,0x50,0x06,0x73,0x06, + 0x96,0x06,0xB9,0x06,0xDC,0x06,0xFF,0x06,0x22,0x07,0x45,0x07,0x57,0x07,0x7A,0x07,0x8C,0x07, + 0xAF,0x07,0xD2,0x07,0xF5,0x07,0x18,0x08,0x3B,0x08,0x4D,0x08,0x70,0x08,0x93,0x08,0xA5,0x08, + 0xC8,0x08,0xEB,0x08,0xFD,0x08,0x0F,0x09,0x32,0x09,0x44,0x09,0x67,0x09,0x8A,0x09,0xAD,0x09, + 0xD0,0x09,0xF3,0x09,0x05,0x0A,0x17,0x0A,0x29,0x0A,0x4C,0x0A,0x6F,0x0A,0x92,0x0A,0xB5,0x0A, + 0xD8,0x0A,0xEA,0x0A,0x0D,0x0B,0x1F,0x0B,0x42,0x0B,0x65,0x0B, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x21 '!' - 0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, + 6, // 0x21 '!' + 0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, - 8, // 0x22 '"' - 0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x22 '"' + 0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x3F,0xE0,0x3F,0xE0,0x08,0x80,0x11,0x00,0x7F,0xC0,0x7F,0xC0,0x22,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x23 '#' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x3F,0xE0,0x3F,0xE0,0x08,0x80,0x11,0x00,0x7F,0xC0,0x7F,0xC0,0x22,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x24 '$' - 0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x1F,0x00,0x34,0x80,0x64,0x00,0x74,0x00,0x3C,0x00,0x0F,0x00,0x0B,0x80,0x09,0x80,0x4B,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x00,0x00, + 10, // 0x24 '$' + 0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x1F,0x00,0x34,0x80,0x64,0x00,0x74,0x00,0x3C,0x00,0x0F,0x00,0x0B,0x80,0x09,0x80,0x4B,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x00,0x00, - 18, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x08,0x00,0x66,0x10,0x00,0x66,0x20,0x00,0x66,0x2F,0x00,0x66,0x59,0x80,0x66,0x99,0x80,0x3D,0x19,0x80,0x01,0x19,0x80,0x02,0x19,0x80,0x04,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 18, // 0x25 '%' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x08,0x00,0x66,0x10,0x00,0x66,0x20,0x00,0x66,0x2F,0x00,0x66,0x59,0x80,0x66,0x99,0x80,0x3D,0x19,0x80,0x01,0x19,0x80,0x02,0x19,0x80,0x04,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x36,0x00,0x1C,0x60,0x36,0x60,0x63,0x60,0x61,0xC0,0x31,0xC0,0x1F,0x60,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x26 '&' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x36,0x00,0x1C,0x60,0x36,0x60,0x63,0x60,0x61,0xC0,0x31,0xC0,0x1F,0x60,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x27 ''' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x27 ''' + 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x28 '(' - 0x00,0x00,0x00,0x0C,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18,0x0C, + 8, // 0x28 '(' + 0x00,0x00,0x00,0x0C,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18,0x0C, - 8, // 0x29 ')' - 0x00,0x00,0x00,0x30,0x18,0x0C,0x0C,0x06,0x06,0x06,0x06,0x06,0x06,0x0C,0x0C,0x18,0x30, + 8, // 0x29 ')' + 0x00,0x00,0x00,0x30,0x18,0x0C,0x0C,0x06,0x06,0x06,0x06,0x06,0x06,0x0C,0x0C,0x18,0x30, - 10, // 0x2A '*' - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x49,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x49,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x2A '*' + 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x49,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x49,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x7F,0xC0,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x2B '+' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x7F,0xC0,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x60,0x60,0xC0,0xC0,0x00, + 5, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x60,0x60,0xC0,0xC0,0x00, - 7, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x00, + 5, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x00, - 10, // 0x2F '/' - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x60,0x00,0x00,0x00, + 10, // 0x2F '/' + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x60,0x00,0x00,0x00, - 10, // 0x30 '0' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x30 '0' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x31 '1' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x3C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x31 '1' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x3C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x32 '2' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x61,0x80,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x32 '2' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x61,0x80,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x33 '3' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x61,0x80,0x01,0x80,0x0F,0x00,0x03,0x00,0x01,0x80,0x61,0x80,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x33 '3' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x61,0x80,0x01,0x80,0x0F,0x00,0x03,0x00,0x01,0x80,0x61,0x80,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x34 '4' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x07,0x00,0x0B,0x00,0x13,0x00,0x23,0x00,0x43,0x00,0x7F,0xC0,0x03,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x34 '4' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x07,0x00,0x0B,0x00,0x13,0x00,0x23,0x00,0x43,0x00,0x7F,0xC0,0x03,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x35 '5' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,0x30,0x00,0x30,0x00,0x3E,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0x61,0x80,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x35 '5' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,0x30,0x00,0x30,0x00,0x3E,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0x61,0x80,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x36 '6' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x38,0x00,0x30,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x36 '6' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x38,0x00,0x30,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x37 '7' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x37 '7' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x38 '8' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x3F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x38 '8' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x3F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x39 '9' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x03,0x00,0x07,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x39 '9' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x03,0x00,0x07,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x00, + 6, // 0x3A ':' + 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x00, - 6, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x38,0x30,0x30,0x60,0x60,0x00, + 6, // 0x3B ';' + 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x38,0x30,0x30,0x60,0x60,0x00, - 12, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x3C '<' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x40,0x01,0x80,0x06,0x00,0x18,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x3E '>' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x40,0x01,0x80,0x06,0x00,0x18,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x3F '?' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3F '?' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 14, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x18,0x20,0x20,0x10,0x27,0xC8,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x27,0xF0,0x20,0x00,0x18,0x00,0x07,0xC0,0x00,0x00, + 14, // 0x40 '@' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x18,0x20,0x20,0x10,0x27,0xC8,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x27,0xF0,0x20,0x00,0x18,0x00,0x07,0xC0,0x00,0x00, - 11, // 0x41 'A' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x1B,0x00,0x1B,0x00,0x31,0x80,0x3F,0x80,0x31,0x80,0x60,0xC0,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x41 'A' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x1B,0x00,0x1B,0x00,0x31,0x80,0x3F,0x80,0x31,0x80,0x60,0xC0,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x42 'B' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x42 'B' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x30,0xC0,0x30,0xC0,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x30,0xC0,0x30,0xC0,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x43 'C' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x30,0xC0,0x30,0xC0,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x30,0xC0,0x30,0xC0,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x61,0x80,0x61,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x61,0x80,0x61,0x80,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x44 'D' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x61,0x80,0x61,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x61,0x80,0x61,0x80,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x45 'E' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x45 'E' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x46 'F' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x46 'F' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x30,0xC0,0x30,0xC0,0x60,0x00,0x60,0x00,0x63,0xC0,0x60,0xC0,0x30,0xC0,0x30,0xC0,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x47 'G' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x30,0xC0,0x30,0xC0,0x60,0x00,0x60,0x00,0x63,0xC0,0x60,0xC0,0x30,0xC0,0x30,0xC0,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x7F,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x48 'H' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x7F,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x49 'I' - 0x00,0x00,0x00,0x00,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00, + 8, // 0x49 'I' + 0x00,0x00,0x00,0x00,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00, - 8, // 0x4A 'J' - 0x00,0x00,0x00,0x00,0x3E,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x0C,0xF8,0x00,0x00,0x00, + 8, // 0x4A 'J' + 0x00,0x00,0x00,0x00,0x3E,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x0C,0xF8,0x00,0x00,0x00, - 11, // 0x4B 'K' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x61,0x80,0x63,0x00,0x66,0x00,0x6C,0x00,0x7C,0x00,0x76,0x00,0x63,0x00,0x61,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x4B 'K' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x61,0x80,0x63,0x00,0x66,0x00,0x6C,0x00,0x7C,0x00,0x76,0x00,0x63,0x00,0x61,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x4C 'L' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4C 'L' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 13, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x70,0x70,0x70,0x70,0xF0,0x58,0xB0,0x59,0xB0,0x4D,0x30,0x4F,0x30,0x46,0x30,0x46,0x30,0x40,0x30,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x4D 'M' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x70,0x70,0x70,0x70,0xF0,0x58,0xB0,0x59,0xB0,0x4D,0x30,0x4F,0x30,0x46,0x30,0x46,0x30,0x40,0x30,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x40,0x70,0x40,0x58,0x40,0x4C,0x40,0x4C,0x40,0x46,0x40,0x43,0x40,0x43,0x40,0x41,0xC0,0x40,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x4E 'N' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x40,0x70,0x40,0x58,0x40,0x4C,0x40,0x4C,0x40,0x46,0x40,0x43,0x40,0x43,0x40,0x41,0xC0,0x40,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x30,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x4F 'O' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x30,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x50 'P' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x50 'P' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x30,0xC0,0x0F,0x80,0x03,0x00,0x03,0x00,0x01,0xE0, + 12, // 0x51 'Q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x30,0xC0,0x0F,0x80,0x03,0x00,0x03,0x00,0x01,0xE0, - 11, // 0x52 'R' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x63,0x00,0x61,0x80,0x60,0xC0,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x52 'R' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x63,0x00,0x61,0x80,0x60,0xC0,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x53 'S' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x61,0x80,0x60,0x00,0x3E,0x00,0x1F,0x00,0x01,0x80,0x61,0x80,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x53 'S' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x61,0x80,0x60,0x00,0x3E,0x00,0x1F,0x00,0x01,0x80,0x61,0x80,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x54 'T' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x54 'T' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x55 'U' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x56 'V' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x31,0x80,0x31,0x80,0x1B,0x00,0x1B,0x00,0x0E,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x56 'V' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x31,0x80,0x31,0x80,0x1B,0x00,0x1B,0x00,0x0E,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 16, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x86,0x61,0x86,0x63,0xC6,0x32,0x4C,0x36,0x6C,0x36,0x6C,0x34,0x2C,0x1C,0x38,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00, + 16, // 0x57 'W' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x86,0x61,0x86,0x63,0xC6,0x32,0x4C,0x36,0x6C,0x36,0x6C,0x34,0x2C,0x1C,0x38,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x58 'X' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x31,0x80,0x31,0x80,0x1B,0x00,0x0E,0x00,0x0E,0x00,0x1B,0x00,0x31,0x80,0x31,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x58 'X' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x31,0x80,0x31,0x80,0x1B,0x00,0x0E,0x00,0x0E,0x00,0x1B,0x00,0x31,0x80,0x31,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x59 'Y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x59 'Y' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x5A 'Z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x5A 'Z' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x5B '[' - 0x00,0x00,0x00,0x3E,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3E, + 8, // 0x5B '[' + 0x00,0x00,0x00,0x3E,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3E, - 10, // 0x5C '\' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0x00,0x00, + 10, // 0x5C '\' + 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0x00,0x00, - 8, // 0x5D ']' - 0x00,0x00,0x00,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x7C, + 8, // 0x5D ']' + 0x00,0x00,0x00,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x7C, - 12, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0E,0x00,0x1B,0x00,0x31,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x5E '^' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0E,0x00,0x1B,0x00,0x31,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x5F '_' - 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,0xC0,0x00,0x00, + 10, // 0x5F '_' + 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,0xC0,0x00,0x00, - 10, // 0x60 '`' - 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x0C,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, + 10, // 0x60 '`' + 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x0C,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, - 9, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x03,0x00,0x03,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x61 'a' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x03,0x00,0x03,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x62 'b' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x62 'b' + 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x33,0x60,0x60,0x60,0x60,0x33,0x1E,0x00,0x00,0x00, + 8, // 0x63 'c' + 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x33,0x60,0x60,0x60,0x60,0x33,0x1E,0x00,0x00,0x00, - 10, // 0x64 'd' - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x64 'd' + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x63,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x65 'e' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x63,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x66 'f' - 0x00,0x00,0x00,0x1C,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00, + 6, // 0x66 'f' + 0x00,0x00,0x00,0x1C,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00, - 10, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x01,0x80,0x03,0x00,0x3E,0x00, + 10, // 0x67 'g' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x01,0x80,0x03,0x00,0x3E,0x00, - 10, // 0x68 'h' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6F,0x00,0x71,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x68 'h' + 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6F,0x00,0x71,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x69 'i' - 0x00,0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 4, // 0x69 'i' + 0x00,0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, - 6, // 0x6A 'j' - 0x00,0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF0, + 6, // 0x6A 'j' + 0x00,0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF0, - 9, // 0x6B 'k' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x63,0x00,0x66,0x00,0x6C,0x00,0x78,0x00,0x7C,0x00,0x66,0x00,0x63,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6B 'k' + 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x63,0x00,0x66,0x00,0x6C,0x00,0x78,0x00,0x7C,0x00,0x66,0x00,0x63,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x6C 'l' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 4, // 0x6C 'l' + 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, - 14, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x70,0x73,0x98,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x00,0x00,0x00,0x00,0x00,0x00, + 14, // 0x6D 'm' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x70,0x73,0x98,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6F,0x00,0x71,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x6E 'n' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6F,0x00,0x71,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x6F 'o' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00, + 10, // 0x70 'p' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00, - 10, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x01,0x80,0x01,0x80,0x01,0x80, + 10, // 0x71 'q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x01,0x80,0x01,0x80,0x01,0x80, - 7, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x7E,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 7, // 0x72 'r' + 0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x7E,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, - 8, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x62,0x60,0x7C,0x3E,0x06,0x46,0x3C,0x00,0x00,0x00, + 8, // 0x73 's' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x62,0x60,0x7C,0x3E,0x06,0x46,0x3C,0x00,0x00,0x00, - 6, // 0x74 't' - 0x00,0x00,0x00,0x00,0x60,0x60,0xFC,0x60,0x60,0x60,0x60,0x60,0x60,0x3C,0x00,0x00,0x00, + 6, // 0x74 't' + 0x00,0x00,0x00,0x00,0x60,0x60,0xFC,0x60,0x60,0x60,0x60,0x60,0x60,0x3C,0x00,0x00,0x00, - 10, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x80,0x3D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x75 'u' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x80,0x3D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x76 'v' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 14, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x18,0x63,0x18,0x33,0x30,0x37,0xB0,0x34,0xB0,0x1C,0xE0,0x1C,0xE0,0x0C,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 14, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x18,0x63,0x18,0x33,0x30,0x37,0xB0,0x34,0xB0,0x1C,0xE0,0x1C,0xE0,0x0C,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x36,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x78 'x' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x36,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00, + 9, // 0x79 'y' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00, - 8, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x06,0x0C,0x18,0x18,0x30,0x60,0x7E,0x00,0x00,0x00, + 8, // 0x7A 'z' + 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x06,0x0C,0x18,0x18,0x30,0x60,0x7E,0x00,0x00,0x00, - 10, // 0x7B '{' - 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x70,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x07,0x80, + 10, // 0x7B '{' + 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x70,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x07,0x80, - 8, // 0x7C '|' - 0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 8, // 0x7C '|' + 0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, - 10, // 0x7D '}' - 0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x06,0x00,0x03,0x80,0x06,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x78,0x00, + 10, // 0x7D '}' + 0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x06,0x00,0x03,0x80,0x06,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x78,0x00, - 12, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x20,0x24,0x20,0x46,0x20,0x42,0x40,0x41,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x7E '~' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x20,0x24,0x20,0x46,0x20,0x42,0x40,0x41,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 14, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, + 14, // 0x7F '' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u verdana18[] = - { - 18, 4, 32, 128-32, - 0x00,0x00,0x13,0x00,0x26,0x00,0x39,0x00,0x5E,0x00,0x83,0x00,0xA8,0x00,0xCD,0x00,0xE0,0x00, - 0xF3,0x00,0x06,0x01,0x2B,0x01,0x50,0x01,0x63,0x01,0x76,0x01,0x89,0x01,0x9C,0x01,0xC1,0x01, - 0xE6,0x01,0x0B,0x02,0x30,0x02,0x55,0x02,0x7A,0x02,0x9F,0x02,0xC4,0x02,0xE9,0x02,0x0E,0x03, - 0x21,0x03,0x34,0x03,0x59,0x03,0x7E,0x03,0xA3,0x03,0xB6,0x03,0xDB,0x03,0x00,0x04,0x25,0x04, - 0x4A,0x04,0x6F,0x04,0x94,0x04,0xB9,0x04,0xDE,0x04,0x03,0x05,0x16,0x05,0x29,0x05,0x4E,0x05, - 0x61,0x05,0x86,0x05,0xAB,0x05,0xD0,0x05,0xF5,0x05,0x1A,0x06,0x3F,0x06,0x64,0x06,0x89,0x06, - 0xAE,0x06,0xD3,0x06,0xF8,0x06,0x1D,0x07,0x42,0x07,0x67,0x07,0x7A,0x07,0x8D,0x07,0xA0,0x07, - 0xC5,0x07,0xEA,0x07,0x0F,0x08,0x34,0x08,0x59,0x08,0x6C,0x08,0x91,0x08,0xB6,0x08,0xC9,0x08, - 0xEE,0x08,0x13,0x09,0x26,0x09,0x39,0x09,0x5E,0x09,0x71,0x09,0x96,0x09,0xBB,0x09,0xE0,0x09, - 0x05,0x0A,0x2A,0x0A,0x3D,0x0A,0x50,0x0A,0x63,0x0A,0x88,0x0A,0xAD,0x0A,0xD2,0x0A,0xF7,0x0A, - 0x1C,0x0B,0x41,0x0B,0x66,0x0B,0x79,0x0B,0x9E,0x0B,0xC3,0x0B, +const int8u verdana18[] = +{ + 18, 4, 32, 128-32, + 0x00,0x00,0x13,0x00,0x26,0x00,0x39,0x00,0x5E,0x00,0x83,0x00,0xA8,0x00,0xCD,0x00,0xE0,0x00, + 0xF3,0x00,0x06,0x01,0x2B,0x01,0x50,0x01,0x63,0x01,0x76,0x01,0x89,0x01,0x9C,0x01,0xC1,0x01, + 0xE6,0x01,0x0B,0x02,0x30,0x02,0x55,0x02,0x7A,0x02,0x9F,0x02,0xC4,0x02,0xE9,0x02,0x0E,0x03, + 0x21,0x03,0x34,0x03,0x59,0x03,0x7E,0x03,0xA3,0x03,0xB6,0x03,0xDB,0x03,0x00,0x04,0x25,0x04, + 0x4A,0x04,0x6F,0x04,0x94,0x04,0xB9,0x04,0xDE,0x04,0x03,0x05,0x16,0x05,0x29,0x05,0x4E,0x05, + 0x61,0x05,0x86,0x05,0xAB,0x05,0xD0,0x05,0xF5,0x05,0x1A,0x06,0x3F,0x06,0x64,0x06,0x89,0x06, + 0xAE,0x06,0xD3,0x06,0xF8,0x06,0x1D,0x07,0x42,0x07,0x67,0x07,0x7A,0x07,0x8D,0x07,0xA0,0x07, + 0xC5,0x07,0xEA,0x07,0x0F,0x08,0x34,0x08,0x59,0x08,0x6C,0x08,0x91,0x08,0xB6,0x08,0xC9,0x08, + 0xEE,0x08,0x13,0x09,0x26,0x09,0x39,0x09,0x5E,0x09,0x71,0x09,0x96,0x09,0xBB,0x09,0xE0,0x09, + 0x05,0x0A,0x2A,0x0A,0x3D,0x0A,0x50,0x0A,0x63,0x0A,0x88,0x0A,0xAD,0x0A,0xD2,0x0A,0xF7,0x0A, + 0x1C,0x0B,0x41,0x0B,0x66,0x0B,0x79,0x0B,0x9E,0x0B,0xC3,0x0B, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x21 '!' - 0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x00,0x00,0x00, + 6, // 0x21 '!' + 0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x00,0x00,0x00, - 7, // 0x22 '"' - 0x00,0x00,0x00,0x48,0x48,0x48,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x00,0x00,0x00,0x48,0x48,0x48,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x04,0x80,0x09,0x00,0x3F,0xC0,0x09,0x00,0x11,0x00,0x12,0x00,0x7F,0x80,0x12,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x23 '#' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x04,0x80,0x09,0x00,0x3F,0xC0,0x09,0x00,0x11,0x00,0x12,0x00,0x7F,0x80,0x12,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x24 '$' - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x49,0x00,0x48,0x00,0x48,0x00,0x38,0x00,0x0E,0x00,0x09,0x00,0x09,0x00,0x49,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x08,0x00, + 10, // 0x24 '$' + 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x49,0x00,0x48,0x00,0x48,0x00,0x38,0x00,0x0E,0x00,0x09,0x00,0x09,0x00,0x49,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x08,0x00, - 16, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x20,0x44,0x40,0x44,0x40,0x44,0x80,0x44,0x80,0x38,0x9C,0x01,0x22,0x01,0x22,0x02,0x22,0x02,0x22,0x04,0x1C,0x00,0x00,0x00,0x00,0x00,0x00, + 16, // 0x25 '%' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x20,0x44,0x40,0x44,0x40,0x44,0x80,0x44,0x80,0x38,0x9C,0x01,0x22,0x01,0x22,0x02,0x22,0x02,0x22,0x04,0x1C,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x21,0x00,0x21,0x00,0x1E,0x40,0x24,0x40,0x42,0x40,0x41,0x40,0x40,0x80,0x21,0x40,0x1E,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x26 '&' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x21,0x00,0x21,0x00,0x1E,0x40,0x24,0x40,0x42,0x40,0x41,0x40,0x40,0x80,0x21,0x40,0x1E,0x20,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x27 ''' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x27 ''' + 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x28 '(' - 0x00,0x00,0x00,0x08,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x08, + 7, // 0x28 '(' + 0x00,0x00,0x00,0x08,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x08, - 7, // 0x29 ')' - 0x00,0x00,0x00,0x20,0x10,0x08,0x08,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x20, + 7, // 0x29 ')' + 0x00,0x00,0x00,0x20,0x10,0x08,0x08,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x20, - 10, // 0x2A '*' - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x49,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x49,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x2A '*' + 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x49,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x49,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x3F,0xE0,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x2B '+' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x3F,0xE0,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x40, + 5, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x40, - 7, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, + 5, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, - 7, // 0x2F '/' - 0x00,0x00,0x00,0x02,0x04,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x80,0x00, + 7, // 0x2F '/' + 0x00,0x00,0x00,0x02,0x04,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x80,0x00, - 10, // 0x30 '0' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x30 '0' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x31 '1' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x1C,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x31 '1' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x1C,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x32 '2' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x01,0x00,0x02,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x32 '2' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x01,0x00,0x02,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x33 '3' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x40,0x80,0x00,0x80,0x01,0x00,0x0E,0x00,0x01,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x41,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x33 '3' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x40,0x80,0x00,0x80,0x01,0x00,0x0E,0x00,0x01,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x41,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x34 '4' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x05,0x00,0x09,0x00,0x11,0x00,0x21,0x00,0x41,0x00,0x7F,0xC0,0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x34 '4' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x05,0x00,0x09,0x00,0x11,0x00,0x21,0x00,0x41,0x00,0x7F,0xC0,0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x35 '5' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,0x20,0x00,0x20,0x00,0x20,0x00,0x3E,0x00,0x01,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x41,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x35 '5' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,0x20,0x00,0x20,0x00,0x20,0x00,0x3E,0x00,0x01,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x41,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x36 '6' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x5E,0x00,0x61,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x36 '6' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x5E,0x00,0x61,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x37 '7' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x10,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x37 '7' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x10,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x38 '8' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x38 '8' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x39 '9' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x20,0x80,0x1F,0x80,0x00,0x80,0x01,0x00,0x02,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x39 '9' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x20,0x80,0x1F,0x80,0x00,0x80,0x01,0x00,0x02,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00, + 7, // 0x3A ':' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00, - 7, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x20,0x20, + 7, // 0x3B ';' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x20,0x20, - 12, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x3C '<' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x3E '>' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x3F '?' - 0x00,0x00,0x00,0x00,0x3C,0x42,0x02,0x02,0x04,0x08,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00, + 8, // 0x3F '?' + 0x00,0x00,0x00,0x00,0x3C,0x42,0x02,0x02,0x04,0x08,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00, - 15, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x18,0x60,0x20,0x10,0x23,0xD0,0x44,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x44,0x48,0x23,0xF0,0x20,0x00,0x18,0x00,0x07,0xC0,0x00,0x00, + 15, // 0x40 '@' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x18,0x60,0x20,0x10,0x23,0xD0,0x44,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x44,0x48,0x23,0xF0,0x20,0x00,0x18,0x00,0x07,0xC0,0x00,0x00, - 10, // 0x41 'A' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x12,0x00,0x12,0x00,0x12,0x00,0x21,0x00,0x21,0x00,0x40,0x80,0x7F,0x80,0x40,0x80,0x80,0x40,0x80,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x41 'A' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x12,0x00,0x12,0x00,0x12,0x00,0x21,0x00,0x21,0x00,0x40,0x80,0x7F,0x80,0x40,0x80,0x80,0x40,0x80,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x42 'B' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7E,0x00,0x41,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x41,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x42 'B' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7E,0x00,0x41,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x41,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x20,0x40,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x20,0x40,0x30,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x43 'C' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x20,0x40,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x20,0x40,0x30,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x80,0x40,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x41,0x80,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x44 'D' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x80,0x40,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x41,0x80,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x45 'E' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x45 'E' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x46 'F' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x46 'F' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x30,0x60,0x20,0x20,0x40,0x00,0x40,0x00,0x41,0xE0,0x40,0x20,0x40,0x20,0x20,0x20,0x30,0x20,0x0F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x47 'G' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x30,0x60,0x20,0x20,0x40,0x00,0x40,0x00,0x41,0xE0,0x40,0x20,0x40,0x20,0x20,0x20,0x30,0x20,0x0F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0xC0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x48 'H' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0xC0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x49 'I' - 0x00,0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, + 5, // 0x49 'I' + 0x00,0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, - 7, // 0x4A 'J' - 0x00,0x00,0x00,0x00,0x3C,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0xF0,0x00,0x00,0x00, + 7, // 0x4A 'J' + 0x00,0x00,0x00,0x00,0x3C,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0xF0,0x00,0x00,0x00, - 10, // 0x4B 'K' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x41,0x00,0x42,0x00,0x44,0x00,0x48,0x00,0x50,0x00,0x68,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x4B 'K' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x41,0x00,0x42,0x00,0x44,0x00,0x48,0x00,0x50,0x00,0x68,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x4C 'L' - 0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x00,0x00,0x00, + 8, // 0x4C 'L' + 0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x00,0x00,0x00, - 13, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x30,0x50,0x50,0x50,0x50,0x48,0x90,0x48,0x90,0x45,0x10,0x45,0x10,0x42,0x10,0x42,0x10,0x40,0x10,0x40,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x4D 'M' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x30,0x50,0x50,0x50,0x50,0x48,0x90,0x48,0x90,0x45,0x10,0x45,0x10,0x42,0x10,0x42,0x10,0x40,0x10,0x40,0x10,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x60,0x40,0x50,0x40,0x48,0x40,0x48,0x40,0x44,0x40,0x42,0x40,0x42,0x40,0x41,0x40,0x40,0xC0,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x4E 'N' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x60,0x40,0x50,0x40,0x48,0x40,0x48,0x40,0x44,0x40,0x42,0x40,0x42,0x40,0x41,0x40,0x40,0xC0,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x20,0x40,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x20,0x40,0x30,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x4F 'O' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x20,0x40,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x20,0x40,0x30,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x50 'P' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x41,0x00,0x7E,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x50 'P' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x41,0x00,0x7E,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x20,0x40,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x20,0x40,0x30,0xC0,0x0F,0x00,0x01,0x00,0x01,0x00,0x00,0xE0, + 12, // 0x51 'Q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x20,0x40,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x20,0x40,0x30,0xC0,0x0F,0x00,0x01,0x00,0x01,0x00,0x00,0xE0, - 10, // 0x52 'R' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x52 'R' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x53 'S' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x20,0x80,0x40,0x00,0x40,0x00,0x20,0x00,0x1E,0x00,0x01,0x00,0x00,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x53 'S' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x20,0x80,0x40,0x00,0x40,0x00,0x20,0x00,0x1E,0x00,0x01,0x00,0x00,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x54 'T' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x80,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x54 'T' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x80,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x55 'U' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x56 'V' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x80,0x40,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x21,0x00,0x12,0x00,0x12,0x00,0x12,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x56 'V' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x80,0x40,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x21,0x00,0x12,0x00,0x12,0x00,0x12,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 15, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x04,0x41,0x04,0x22,0x88,0x22,0x88,0x22,0x88,0x12,0x90,0x14,0x50,0x14,0x50,0x14,0x50,0x08,0x20,0x08,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 15, // 0x57 'W' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x04,0x41,0x04,0x22,0x88,0x22,0x88,0x22,0x88,0x12,0x90,0x14,0x50,0x14,0x50,0x14,0x50,0x08,0x20,0x08,0x20,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x58 'X' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x21,0x00,0x21,0x00,0x12,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x12,0x00,0x21,0x00,0x21,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x58 'X' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x21,0x00,0x21,0x00,0x12,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x12,0x00,0x21,0x00,0x21,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x59 'Y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x41,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x59 'Y' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x41,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x5A 'Z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x80,0x01,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x5A 'Z' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x80,0x01,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x5B '[' - 0x00,0x00,0x00,0x3C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3C, + 7, // 0x5B '[' + 0x00,0x00,0x00,0x3C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3C, - 7, // 0x5C '\' - 0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x04,0x02,0x00, + 7, // 0x5C '\' + 0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x04,0x02,0x00, - 7, // 0x5D ']' - 0x00,0x00,0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78, + 7, // 0x5D ']' + 0x00,0x00,0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78, - 12, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x09,0x00,0x10,0x80,0x20,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x5E '^' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x09,0x00,0x10,0x80,0x20,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x5F '_' - 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,0xC0,0x00,0x00, + 10, // 0x5F '_' + 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,0xC0,0x00,0x00, - 10, // 0x60 '`' - 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,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, + 10, // 0x60 '`' + 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,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, - 9, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x01,0x00,0x3F,0x00,0x41,0x00,0x41,0x00,0x43,0x00,0x3D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x61 'a' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x01,0x00,0x3F,0x00,0x41,0x00,0x41,0x00,0x43,0x00,0x3D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x62 'b' - 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x5C,0x00,0x62,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x62 'b' + 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x5C,0x00,0x62,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x21,0x40,0x40,0x40,0x40,0x21,0x1E,0x00,0x00,0x00, + 8, // 0x63 'c' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x21,0x40,0x40,0x40,0x40,0x21,0x1E,0x00,0x00,0x00, - 9, // 0x64 'd' - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x64 'd' + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x65 'e' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x66 'f' - 0x00,0x00,0x00,0x1C,0x20,0x20,0x20,0x7C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00, + 6, // 0x66 'f' + 0x00,0x00,0x00,0x1C,0x20,0x20,0x20,0x7C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00, - 9, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x01,0x00,0x22,0x00,0x1C,0x00, + 9, // 0x67 'g' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x01,0x00,0x22,0x00,0x1C,0x00, - 9, // 0x68 'h' - 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x5E,0x00,0x61,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x68 'h' + 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x5E,0x00,0x61,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 3, // 0x69 'i' - 0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 3, // 0x69 'i' + 0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 5, // 0x6A 'j' - 0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xE0, + 5, // 0x6A 'j' + 0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xE0, - 9, // 0x6B 'k' - 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x42,0x00,0x44,0x00,0x48,0x00,0x50,0x00,0x68,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6B 'k' + 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x42,0x00,0x44,0x00,0x48,0x00,0x50,0x00,0x68,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 3, // 0x6C 'l' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 3, // 0x6C 'l' + 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 15, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2E,0x70,0x31,0x88,0x21,0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00, + 15, // 0x6D 'm' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2E,0x70,0x31,0x88,0x21,0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5E,0x00,0x61,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6E 'n' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5E,0x00,0x61,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x6F 'o' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x00,0x62,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x40,0x00,0x40,0x00,0x40,0x00, + 9, // 0x70 'p' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x00,0x62,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x40,0x00,0x40,0x00,0x40,0x00, - 9, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x01,0x00,0x01,0x00,0x01,0x00, + 9, // 0x71 'q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x01,0x00,0x01,0x00,0x01,0x00, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 6, // 0x72 'r' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, - 8, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x40,0x30,0x0C,0x02,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x73 's' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x40,0x30,0x0C,0x02,0x42,0x3C,0x00,0x00,0x00, - 6, // 0x74 't' - 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x7C,0x20,0x20,0x20,0x20,0x20,0x20,0x1C,0x00,0x00,0x00, + 6, // 0x74 't' + 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x7C,0x20,0x20,0x20,0x20,0x20,0x20,0x1C,0x00,0x00,0x00, - 9, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x43,0x00,0x3D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x75 'u' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x43,0x00,0x3D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x76 'v' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 13, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x10,0x42,0x10,0x25,0x20,0x25,0x20,0x28,0xA0,0x28,0xA0,0x10,0x40,0x10,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x10,0x42,0x10,0x25,0x20,0x25,0x20,0x28,0xA0,0x28,0xA0,0x10,0x40,0x10,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x14,0x00,0x22,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x78 'x' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x14,0x00,0x22,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x10,0x00, + 9, // 0x79 'y' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x10,0x00, - 9, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x7A 'z' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x7B '{' - 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x60,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x07,0x00, + 10, // 0x7B '{' + 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x60,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x07,0x00, - 7, // 0x7C '|' - 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 7, // 0x7C '|' + 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, - 10, // 0x7D '}' - 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x01,0x80,0x02,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x38,0x00, + 10, // 0x7D '}' + 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x01,0x80,0x02,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x38,0x00, - 12, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x20,0x24,0x20,0x42,0x40,0x41,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x7E '~' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x20,0x24,0x20,0x42,0x40,0x41,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 15, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, + 15, // 0x7F '' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; - const int8u verdana18_bold[] = - { - 18, 4, 32, 128-32, - 0x00,0x00,0x13,0x00,0x26,0x00,0x4B,0x00,0x70,0x00,0x95,0x00,0xCC,0x00,0xF1,0x00,0x04,0x01, - 0x17,0x01,0x2A,0x01,0x4F,0x01,0x74,0x01,0x87,0x01,0x9A,0x01,0xAD,0x01,0xD2,0x01,0xF7,0x01, - 0x1C,0x02,0x41,0x02,0x66,0x02,0x8B,0x02,0xB0,0x02,0xD5,0x02,0xFA,0x02,0x1F,0x03,0x44,0x03, - 0x57,0x03,0x6A,0x03,0x8F,0x03,0xB4,0x03,0xD9,0x03,0xFE,0x03,0x23,0x04,0x48,0x04,0x6D,0x04, - 0x92,0x04,0xB7,0x04,0xDC,0x04,0x01,0x05,0x26,0x05,0x4B,0x05,0x5E,0x05,0x71,0x05,0x96,0x05, - 0xBB,0x05,0xE0,0x05,0x05,0x06,0x2A,0x06,0x4F,0x06,0x74,0x06,0x99,0x06,0xBE,0x06,0xE3,0x06, - 0x08,0x07,0x2D,0x07,0x52,0x07,0x77,0x07,0x9C,0x07,0xC1,0x07,0xD4,0x07,0xF9,0x07,0x0C,0x08, - 0x31,0x08,0x56,0x08,0x7B,0x08,0xA0,0x08,0xC5,0x08,0xD8,0x08,0xFD,0x08,0x22,0x09,0x35,0x09, - 0x5A,0x09,0x7F,0x09,0x92,0x09,0xA5,0x09,0xCA,0x09,0xDD,0x09,0x02,0x0A,0x27,0x0A,0x4C,0x0A, - 0x71,0x0A,0x96,0x0A,0xA9,0x0A,0xCE,0x0A,0xE1,0x0A,0x06,0x0B,0x2B,0x0B,0x50,0x0B,0x75,0x0B, - 0x9A,0x0B,0xBF,0x0B,0xE4,0x0B,0xF7,0x0B,0x1C,0x0C,0x41,0x0C, +const int8u verdana18_bold[] = +{ + 18, 4, 32, 128-32, + 0x00,0x00,0x13,0x00,0x26,0x00,0x4B,0x00,0x70,0x00,0x95,0x00,0xCC,0x00,0xF1,0x00,0x04,0x01, + 0x17,0x01,0x2A,0x01,0x4F,0x01,0x74,0x01,0x87,0x01,0x9A,0x01,0xAD,0x01,0xD2,0x01,0xF7,0x01, + 0x1C,0x02,0x41,0x02,0x66,0x02,0x8B,0x02,0xB0,0x02,0xD5,0x02,0xFA,0x02,0x1F,0x03,0x44,0x03, + 0x57,0x03,0x6A,0x03,0x8F,0x03,0xB4,0x03,0xD9,0x03,0xFE,0x03,0x23,0x04,0x48,0x04,0x6D,0x04, + 0x92,0x04,0xB7,0x04,0xDC,0x04,0x01,0x05,0x26,0x05,0x4B,0x05,0x5E,0x05,0x71,0x05,0x96,0x05, + 0xBB,0x05,0xE0,0x05,0x05,0x06,0x2A,0x06,0x4F,0x06,0x74,0x06,0x99,0x06,0xBE,0x06,0xE3,0x06, + 0x08,0x07,0x2D,0x07,0x52,0x07,0x77,0x07,0x9C,0x07,0xC1,0x07,0xD4,0x07,0xF9,0x07,0x0C,0x08, + 0x31,0x08,0x56,0x08,0x7B,0x08,0xA0,0x08,0xC5,0x08,0xD8,0x08,0xFD,0x08,0x22,0x09,0x35,0x09, + 0x5A,0x09,0x7F,0x09,0x92,0x09,0xA5,0x09,0xCA,0x09,0xDD,0x09,0x02,0x0A,0x27,0x0A,0x4C,0x0A, + 0x71,0x0A,0x96,0x0A,0xA9,0x0A,0xCE,0x0A,0xE1,0x0A,0x06,0x0B,0x2B,0x0B,0x50,0x0B,0x75,0x0B, + 0x9A,0x0B,0xBF,0x0B,0xE4,0x0B,0xF7,0x0B,0x1C,0x0C,0x41,0x0C, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x21 '!' - 0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, + 6, // 0x21 '!' + 0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, - 9, // 0x22 '"' - 0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x22 '"' + 0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 13, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x20,0x04,0x20,0x08,0x40,0x3F,0xF0,0x3F,0xF0,0x08,0x40,0x10,0x80,0x7F,0xE0,0x7F,0xE0,0x21,0x00,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x23 '#' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x20,0x04,0x20,0x08,0x40,0x3F,0xF0,0x3F,0xF0,0x08,0x40,0x10,0x80,0x7F,0xE0,0x7F,0xE0,0x21,0x00,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x24 '$' - 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x1F,0x80,0x34,0xC0,0x64,0xC0,0x64,0x00,0x3C,0x00,0x07,0x80,0x04,0xC0,0x64,0xC0,0x65,0x80,0x3F,0x00,0x04,0x00,0x04,0x00,0x00,0x00, + 11, // 0x24 '$' + 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x1F,0x80,0x34,0xC0,0x64,0xC0,0x64,0x00,0x3C,0x00,0x07,0x80,0x04,0xC0,0x64,0xC0,0x65,0x80,0x3F,0x00,0x04,0x00,0x04,0x00,0x00,0x00, - 19, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x08,0x00,0x63,0x10,0x00,0x63,0x10,0x00,0x63,0x20,0x00,0x63,0x2F,0x80,0x63,0x58,0xC0,0x3E,0x98,0xC0,0x00,0x98,0xC0,0x01,0x18,0xC0,0x01,0x18,0xC0,0x02,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 19, // 0x25 '%' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x08,0x00,0x63,0x10,0x00,0x63,0x10,0x00,0x63,0x20,0x00,0x63,0x2F,0x80,0x63,0x58,0xC0,0x3E,0x98,0xC0,0x00,0x98,0xC0,0x01,0x18,0xC0,0x01,0x18,0xC0,0x02,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 13, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x33,0x00,0x1E,0x60,0x36,0x60,0x63,0x60,0x61,0xC0,0x60,0xC0,0x30,0xE0,0x1F,0x30,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x26 '&' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x33,0x00,0x1E,0x60,0x36,0x60,0x63,0x60,0x61,0xC0,0x60,0xC0,0x30,0xE0,0x1F,0x30,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x27 ''' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x27 ''' + 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x28 '(' - 0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18,0x0C,0x06, + 8, // 0x28 '(' + 0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18,0x0C,0x06, - 8, // 0x29 ')' - 0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x0C,0x06,0x06,0x06,0x06,0x06,0x0C,0x0C,0x18,0x30,0x60, + 8, // 0x29 ')' + 0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x0C,0x06,0x06,0x06,0x06,0x06,0x0C,0x0C,0x18,0x30,0x60, - 11, // 0x2A '*' - 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x24,0x80,0x15,0x00,0x0E,0x00,0x15,0x00,0x24,0x80,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x2A '*' + 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x24,0x80,0x15,0x00,0x0E,0x00,0x15,0x00,0x24,0x80,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 13, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x3F,0xE0,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x2B '+' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x3F,0xE0,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x60,0x60,0x60,0xC0,0xC0, + 5, // 0x2C ',' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x60,0x60,0x60,0xC0,0xC0, - 7, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2D '-' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 5, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x00, + 5, // 0x2E '.' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x00, - 10, // 0x2F '/' - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x60,0x00,0x00,0x00, + 10, // 0x2F '/' + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x60,0x00,0x00,0x00, - 11, // 0x30 '0' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x30 '0' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x31 '1' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x1E,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x31 '1' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x1E,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x32 '2' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x60,0xC0,0x00,0xC0,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x32 '2' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x60,0xC0,0x00,0xC0,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x33 '3' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x60,0xC0,0x00,0xC0,0x01,0x80,0x0F,0x00,0x01,0x80,0x00,0xC0,0x60,0xC0,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x33 '3' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x60,0xC0,0x00,0xC0,0x01,0x80,0x0F,0x00,0x01,0x80,0x00,0xC0,0x60,0xC0,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x34 '4' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x03,0x80,0x05,0x80,0x09,0x80,0x11,0x80,0x21,0x80,0x41,0x80,0x7F,0xE0,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x34 '4' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x03,0x80,0x05,0x80,0x09,0x80,0x11,0x80,0x21,0x80,0x41,0x80,0x7F,0xE0,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x35 '5' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xC0,0x30,0x00,0x30,0x00,0x30,0x00,0x3F,0x00,0x01,0x80,0x00,0xC0,0x00,0xC0,0x60,0xC0,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x35 '5' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xC0,0x30,0x00,0x30,0x00,0x30,0x00,0x3F,0x00,0x01,0x80,0x00,0xC0,0x00,0xC0,0x60,0xC0,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x36 '6' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x18,0x00,0x30,0x00,0x60,0x00,0x6F,0x00,0x71,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x36 '6' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x18,0x00,0x30,0x00,0x60,0x00,0x6F,0x00,0x71,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x37 '7' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,0x00,0xC0,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x37 '7' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,0x00,0xC0,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x38 '8' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x38 '8' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x39 '9' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0xC0,0x1E,0xC0,0x00,0xC0,0x01,0x80,0x03,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x39 '9' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0xC0,0x1E,0xC0,0x00,0xC0,0x01,0x80,0x03,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x00, + 6, // 0x3A ':' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x00, - 6, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x38,0x30,0x30,0x30,0x60,0x60, + 6, // 0x3B ';' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x38,0x30,0x30,0x30,0x60,0x60, - 13, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x3C '<' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00, - 13, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x3D '=' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 13, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x60,0x00,0x60,0x01,0x80,0x06,0x00,0x18,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x3E '>' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x60,0x00,0x60,0x01,0x80,0x06,0x00,0x18,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 9, // 0x3F '?' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3F '?' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 14, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x18,0x60,0x20,0x10,0x27,0xD0,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x27,0xF0,0x20,0x00,0x18,0x00,0x07,0xC0,0x00,0x00, + 14, // 0x40 '@' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x18,0x60,0x20,0x10,0x27,0xD0,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x27,0xF0,0x20,0x00,0x18,0x00,0x07,0xC0,0x00,0x00, - 12, // 0x41 'A' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x0F,0x00,0x0F,0x00,0x19,0x80,0x19,0x80,0x30,0xC0,0x3F,0xC0,0x30,0xC0,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x41 'A' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x0F,0x00,0x0F,0x00,0x19,0x80,0x19,0x80,0x30,0xC0,0x3F,0xC0,0x30,0xC0,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x42 'B' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x42 'B' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x38,0xC0,0x30,0xC0,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x30,0xC0,0x38,0xC0,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x43 'C' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x38,0xC0,0x30,0xC0,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x30,0xC0,0x38,0xC0,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0xC0,0x60,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xC0,0x61,0xC0,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x44 'D' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0xC0,0x60,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xC0,0x61,0xC0,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x45 'E' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x45 'E' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x46 'F' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x46 'F' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xC0,0x38,0x60,0x30,0x60,0x60,0x00,0x60,0x00,0x63,0xE0,0x60,0x60,0x60,0x60,0x30,0x60,0x38,0x60,0x0F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x47 'G' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xC0,0x38,0x60,0x30,0x60,0x60,0x00,0x60,0x00,0x63,0xE0,0x60,0x60,0x60,0x60,0x30,0x60,0x38,0x60,0x0F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7F,0xE0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x48 'H' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7F,0xE0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x49 'I' - 0x00,0x00,0x00,0x00,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00, + 8, // 0x49 'I' + 0x00,0x00,0x00,0x00,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00, - 8, // 0x4A 'J' - 0x00,0x00,0x00,0x00,0x3E,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x0C,0xF8,0x00,0x00,0x00, + 8, // 0x4A 'J' + 0x00,0x00,0x00,0x00,0x3E,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x0C,0xF8,0x00,0x00,0x00, - 12, // 0x4B 'K' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0xC0,0x61,0x80,0x63,0x00,0x66,0x00,0x6C,0x00,0x7E,0x00,0x73,0x00,0x61,0x80,0x60,0xC0,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x4B 'K' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0xC0,0x61,0x80,0x63,0x00,0x66,0x00,0x6C,0x00,0x7E,0x00,0x73,0x00,0x61,0x80,0x60,0xC0,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x4C 'L' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x4C 'L' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 14, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x38,0x70,0x38,0x70,0x78,0x58,0x58,0x58,0xD8,0x4C,0x98,0x4D,0x98,0x47,0x18,0x47,0x18,0x42,0x18,0x40,0x18,0x00,0x00,0x00,0x00,0x00,0x00, + 14, // 0x4D 'M' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x38,0x70,0x38,0x70,0x78,0x58,0x58,0x58,0xD8,0x4C,0x98,0x4D,0x98,0x47,0x18,0x47,0x18,0x42,0x18,0x40,0x18,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x20,0x70,0x20,0x58,0x20,0x4C,0x20,0x4C,0x20,0x46,0x20,0x43,0x20,0x43,0x20,0x41,0xA0,0x40,0xE0,0x40,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x4E 'N' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x20,0x70,0x20,0x58,0x20,0x4C,0x20,0x4C,0x20,0x46,0x20,0x43,0x20,0x43,0x20,0x41,0xA0,0x40,0xE0,0x40,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, - 13, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x38,0xE0,0x30,0x60,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x30,0x60,0x38,0xE0,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x4F 'O' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x38,0xE0,0x30,0x60,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x30,0x60,0x38,0xE0,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x50 'P' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x50 'P' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 13, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x38,0xE0,0x30,0x60,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x30,0x60,0x38,0xE0,0x0F,0x80,0x03,0x00,0x03,0x80,0x01,0xF0, + 13, // 0x51 'Q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x38,0xE0,0x30,0x60,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x30,0x60,0x38,0xE0,0x0F,0x80,0x03,0x00,0x03,0x80,0x01,0xF0, - 12, // 0x52 'R' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0x60,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x52 'R' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0x60,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x53 'S' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x30,0xC0,0x60,0xC0,0x60,0x00,0x7C,0x00,0x3F,0x80,0x03,0xC0,0x00,0xC0,0x60,0xC0,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x53 'S' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x30,0xC0,0x60,0xC0,0x60,0x00,0x7C,0x00,0x3F,0x80,0x03,0xC0,0x00,0xC0,0x60,0xC0,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x54 'T' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x54 'T' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 12, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x55 'U' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x56 'V' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x31,0x80,0x31,0x80,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x0E,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x56 'V' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x31,0x80,0x31,0x80,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x0E,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 16, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x86,0x61,0x86,0x63,0xC6,0x33,0xCC,0x32,0x4C,0x32,0x4C,0x1E,0x78,0x1C,0x38,0x1C,0x38,0x0C,0x30,0x0C,0x30,0x00,0x00,0x00,0x00,0x00,0x00, + 16, // 0x57 'W' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x86,0x61,0x86,0x63,0xC6,0x33,0xCC,0x32,0x4C,0x32,0x4C,0x1E,0x78,0x1C,0x38,0x1C,0x38,0x0C,0x30,0x0C,0x30,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x58 'X' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x31,0x80,0x31,0x80,0x1B,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x1B,0x00,0x31,0x80,0x31,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x58 'X' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x31,0x80,0x31,0x80,0x1B,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x1B,0x00,0x31,0x80,0x31,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x59 'Y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x59 'Y' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x5A 'Z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0x80,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x5A 'Z' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0x80,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x5B '[' - 0x00,0x00,0x00,0x3E,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3E, + 8, // 0x5B '[' + 0x00,0x00,0x00,0x3E,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3E, - 10, // 0x5C '\' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0x00,0x00, + 10, // 0x5C '\' + 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0x00,0x00, - 8, // 0x5D ']' - 0x00,0x00,0x00,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x7C, + 8, // 0x5D ']' + 0x00,0x00,0x00,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x7C, - 13, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0F,0x00,0x19,0x80,0x30,0xC0,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x5E '^' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0F,0x00,0x19,0x80,0x30,0xC0,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x5F '_' - 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,0xE0,0x00,0x00, + 11, // 0x5F '_' + 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,0xE0,0x00,0x00, - 11, // 0x60 '`' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x0C,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, + 11, // 0x60 '`' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x0C,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, - 10, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x01,0x80,0x01,0x80,0x3F,0x80,0x61,0x80,0x61,0x80,0x63,0x80,0x3D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x61 'a' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x01,0x80,0x01,0x80,0x3F,0x80,0x61,0x80,0x61,0x80,0x63,0x80,0x3D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x62 'b' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x62 'b' + 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 8, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x33,0x60,0x60,0x60,0x60,0x33,0x1E,0x00,0x00,0x00, + 8, // 0x63 'c' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x33,0x60,0x60,0x60,0x60,0x33,0x1E,0x00,0x00,0x00, - 10, // 0x64 'd' - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x64 'd' + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x7F,0x80,0x60,0x00,0x60,0x00,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x65 'e' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x7F,0x80,0x60,0x00,0x60,0x00,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 6, // 0x66 'f' - 0x00,0x00,0x00,0x1C,0x30,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00, + 6, // 0x66 'f' + 0x00,0x00,0x00,0x1C,0x30,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00, - 10, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x01,0x80,0x03,0x00,0x3E,0x00, + 10, // 0x67 'g' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x01,0x80,0x03,0x00,0x3E,0x00, - 10, // 0x68 'h' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6F,0x00,0x71,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x68 'h' + 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6F,0x00,0x71,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x69 'i' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 4, // 0x69 'i' + 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, - 6, // 0x6A 'j' - 0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF0, + 6, // 0x6A 'j' + 0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF0, - 10, // 0x6B 'k' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x61,0x80,0x63,0x00,0x66,0x00,0x6C,0x00,0x7E,0x00,0x73,0x00,0x61,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x6B 'k' + 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x61,0x80,0x63,0x00,0x66,0x00,0x6C,0x00,0x7E,0x00,0x73,0x00,0x61,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, - 4, // 0x6C 'l' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 4, // 0x6C 'l' + 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, - 16, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6F,0x3C,0x71,0xC6,0x61,0x86,0x61,0x86,0x61,0x86,0x61,0x86,0x61,0x86,0x61,0x86,0x00,0x00,0x00,0x00,0x00,0x00, + 16, // 0x6D 'm' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6F,0x3C,0x71,0xC6,0x61,0x86,0x61,0x86,0x61,0x86,0x61,0x86,0x61,0x86,0x61,0x86,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6F,0x00,0x71,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x6E 'n' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6F,0x00,0x71,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x6F 'o' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00, + 10, // 0x70 'p' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00, - 10, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x01,0x80,0x01,0x80,0x01,0x80, + 10, // 0x71 'q' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x01,0x80,0x01,0x80,0x01,0x80, - 7, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x7E,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 7, // 0x72 'r' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x7E,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, - 9, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x61,0x00,0x60,0x00,0x7E,0x00,0x3F,0x00,0x03,0x00,0x43,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x73 's' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x61,0x00,0x60,0x00,0x7E,0x00,0x3F,0x00,0x03,0x00,0x43,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 7, // 0x74 't' - 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x7E,0x30,0x30,0x30,0x30,0x30,0x30,0x1E,0x00,0x00,0x00, + 7, // 0x74 't' + 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x7E,0x30,0x30,0x30,0x30,0x30,0x30,0x1E,0x00,0x00,0x00, - 10, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x80,0x3D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x75 'u' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x80,0x3D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x33,0x00,0x33,0x00,0x33,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x76 'v' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x33,0x00,0x33,0x00,0x33,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 14, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x18,0x63,0x18,0x63,0x18,0x37,0xB0,0x34,0xB0,0x3C,0xF0,0x18,0x60,0x18,0x60,0x00,0x00,0x00,0x00,0x00,0x00, + 14, // 0x77 'w' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x18,0x63,0x18,0x63,0x18,0x37,0xB0,0x34,0xB0,0x3C,0xF0,0x18,0x60,0x18,0x60,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x33,0x00,0x33,0x00,0x1E,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x78 'x' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x33,0x00,0x33,0x00,0x1E,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 10, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x33,0x00,0x33,0x00,0x33,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00, + 10, // 0x79 'y' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x33,0x00,0x33,0x00,0x33,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00, - 9, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x7A 'z' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 11, // 0x7B '{' - 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x70,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x07,0x80, + 11, // 0x7B '{' + 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x70,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x07,0x80, - 8, // 0x7C '|' - 0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 8, // 0x7C '|' + 0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, - 11, // 0x7D '}' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x01,0xC0,0x03,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x3C,0x00, + 11, // 0x7D '}' + 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x01,0xC0,0x03,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x3C,0x00, - 13, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x10,0x24,0x10,0x42,0x10,0x41,0x20,0x40,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x7E '~' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x10,0x24,0x10,0x42,0x10,0x41,0x20,0x40,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 15, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, + 15, // 0x7F '' + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, - 0 - }; + 0 +}; } diff -Nru mapnik-2.1.0/deps/agg/src/agg_gsv_text.cpp mapnik-2.2.0/deps/agg/src/agg_gsv_text.cpp --- mapnik-2.1.0/deps/agg/src/agg_gsv_text.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_gsv_text.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -25,653 +25,653 @@ namespace agg { - int8u gsv_default_font[] = - { - 0x40,0x00,0x6c,0x0f,0x15,0x00,0x0e,0x00,0xf9,0xff, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x0d,0x0a,0x0d,0x0a,0x46,0x6f,0x6e,0x74,0x20,0x28, - 0x63,0x29,0x20,0x4d,0x69,0x63,0x72,0x6f,0x50,0x72, - 0x6f,0x66,0x20,0x32,0x37,0x20,0x53,0x65,0x70,0x74, - 0x65,0x6d,0x62,0x2e,0x31,0x39,0x38,0x39,0x00,0x0d, - 0x0a,0x0d,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x02,0x00,0x12,0x00,0x34,0x00,0x46,0x00,0x94,0x00, - 0xd0,0x00,0x2e,0x01,0x3e,0x01,0x64,0x01,0x8a,0x01, - 0x98,0x01,0xa2,0x01,0xb4,0x01,0xba,0x01,0xc6,0x01, - 0xcc,0x01,0xf0,0x01,0xfa,0x01,0x18,0x02,0x38,0x02, - 0x44,0x02,0x68,0x02,0x98,0x02,0xa2,0x02,0xde,0x02, - 0x0e,0x03,0x24,0x03,0x40,0x03,0x48,0x03,0x52,0x03, - 0x5a,0x03,0x82,0x03,0xec,0x03,0xfa,0x03,0x26,0x04, - 0x4c,0x04,0x6a,0x04,0x7c,0x04,0x8a,0x04,0xb6,0x04, - 0xc4,0x04,0xca,0x04,0xe0,0x04,0xee,0x04,0xf8,0x04, - 0x0a,0x05,0x18,0x05,0x44,0x05,0x5e,0x05,0x8e,0x05, - 0xac,0x05,0xd6,0x05,0xe0,0x05,0xf6,0x05,0x00,0x06, - 0x12,0x06,0x1c,0x06,0x28,0x06,0x36,0x06,0x48,0x06, - 0x4e,0x06,0x60,0x06,0x6e,0x06,0x74,0x06,0x84,0x06, - 0xa6,0x06,0xc8,0x06,0xe6,0x06,0x08,0x07,0x2c,0x07, - 0x3c,0x07,0x68,0x07,0x7c,0x07,0x8c,0x07,0xa2,0x07, - 0xb0,0x07,0xb6,0x07,0xd8,0x07,0xec,0x07,0x10,0x08, - 0x32,0x08,0x54,0x08,0x64,0x08,0x88,0x08,0x98,0x08, - 0xac,0x08,0xb6,0x08,0xc8,0x08,0xd2,0x08,0xe4,0x08, - 0xf2,0x08,0x3e,0x09,0x48,0x09,0x94,0x09,0xc2,0x09, - 0xc4,0x09,0xd0,0x09,0xe2,0x09,0x04,0x0a,0x0e,0x0a, - 0x26,0x0a,0x34,0x0a,0x4a,0x0a,0x66,0x0a,0x70,0x0a, - 0x7e,0x0a,0x8e,0x0a,0x9a,0x0a,0xa6,0x0a,0xb4,0x0a, - 0xd8,0x0a,0xe2,0x0a,0xf6,0x0a,0x18,0x0b,0x22,0x0b, - 0x32,0x0b,0x56,0x0b,0x60,0x0b,0x6e,0x0b,0x7c,0x0b, - 0x8a,0x0b,0x9c,0x0b,0x9e,0x0b,0xb2,0x0b,0xc2,0x0b, - 0xd8,0x0b,0xf4,0x0b,0x08,0x0c,0x30,0x0c,0x56,0x0c, - 0x72,0x0c,0x90,0x0c,0xb2,0x0c,0xce,0x0c,0xe2,0x0c, - 0xfe,0x0c,0x10,0x0d,0x26,0x0d,0x36,0x0d,0x42,0x0d, - 0x4e,0x0d,0x5c,0x0d,0x78,0x0d,0x8c,0x0d,0x8e,0x0d, - 0x90,0x0d,0x92,0x0d,0x94,0x0d,0x96,0x0d,0x98,0x0d, - 0x9a,0x0d,0x9c,0x0d,0x9e,0x0d,0xa0,0x0d,0xa2,0x0d, - 0xa4,0x0d,0xa6,0x0d,0xa8,0x0d,0xaa,0x0d,0xac,0x0d, - 0xae,0x0d,0xb0,0x0d,0xb2,0x0d,0xb4,0x0d,0xb6,0x0d, - 0xb8,0x0d,0xba,0x0d,0xbc,0x0d,0xbe,0x0d,0xc0,0x0d, - 0xc2,0x0d,0xc4,0x0d,0xc6,0x0d,0xc8,0x0d,0xca,0x0d, - 0xcc,0x0d,0xce,0x0d,0xd0,0x0d,0xd2,0x0d,0xd4,0x0d, - 0xd6,0x0d,0xd8,0x0d,0xda,0x0d,0xdc,0x0d,0xde,0x0d, - 0xe0,0x0d,0xe2,0x0d,0xe4,0x0d,0xe6,0x0d,0xe8,0x0d, - 0xea,0x0d,0xec,0x0d,0x0c,0x0e,0x26,0x0e,0x48,0x0e, - 0x64,0x0e,0x88,0x0e,0x92,0x0e,0xa6,0x0e,0xb4,0x0e, - 0xd0,0x0e,0xee,0x0e,0x02,0x0f,0x16,0x0f,0x26,0x0f, - 0x3c,0x0f,0x58,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f, - 0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f, - 0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f, - 0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x10,0x80, - 0x05,0x95,0x00,0x72,0x00,0xfb,0xff,0x7f,0x01,0x7f, - 0x01,0x01,0xff,0x01,0x05,0xfe,0x05,0x95,0xff,0x7f, - 0x00,0x7a,0x01,0x86,0xff,0x7a,0x01,0x87,0x01,0x7f, - 0xfe,0x7a,0x0a,0x87,0xff,0x7f,0x00,0x7a,0x01,0x86, - 0xff,0x7a,0x01,0x87,0x01,0x7f,0xfe,0x7a,0x05,0xf2, - 0x0b,0x95,0xf9,0x64,0x0d,0x9c,0xf9,0x64,0xfa,0x91, - 0x0e,0x00,0xf1,0xfa,0x0e,0x00,0x04,0xfc,0x08,0x99, - 0x00,0x63,0x04,0x9d,0x00,0x63,0x04,0x96,0xff,0x7f, - 0x01,0x7f,0x01,0x01,0x00,0x01,0xfe,0x02,0xfd,0x01, - 0xfc,0x00,0xfd,0x7f,0xfe,0x7e,0x00,0x7e,0x01,0x7e, - 0x01,0x7f,0x02,0x7f,0x06,0x7e,0x02,0x7f,0x02,0x7e, - 0xf2,0x89,0x02,0x7e,0x02,0x7f,0x06,0x7e,0x02,0x7f, - 0x01,0x7f,0x01,0x7e,0x00,0x7c,0xfe,0x7e,0xfd,0x7f, - 0xfc,0x00,0xfd,0x01,0xfe,0x02,0x00,0x01,0x01,0x01, - 0x01,0x7f,0xff,0x7f,0x10,0xfd,0x15,0x95,0xee,0x6b, - 0x05,0x95,0x02,0x7e,0x00,0x7e,0xff,0x7e,0xfe,0x7f, - 0xfe,0x00,0xfe,0x02,0x00,0x02,0x01,0x02,0x02,0x01, - 0x02,0x00,0x02,0x7f,0x03,0x7f,0x03,0x00,0x03,0x01, - 0x02,0x01,0xfc,0xf2,0xfe,0x7f,0xff,0x7e,0x00,0x7e, - 0x02,0x7e,0x02,0x00,0x02,0x01,0x01,0x02,0x00,0x02, - 0xfe,0x02,0xfe,0x00,0x07,0xf9,0x15,0x8d,0xff,0x7f, - 0x01,0x7f,0x01,0x01,0x00,0x01,0xff,0x01,0xff,0x00, - 0xff,0x7f,0xff,0x7e,0xfe,0x7b,0xfe,0x7d,0xfe,0x7e, - 0xfe,0x7f,0xfd,0x00,0xfd,0x01,0xff,0x02,0x00,0x03, - 0x01,0x02,0x06,0x04,0x02,0x02,0x01,0x02,0x00,0x02, - 0xff,0x02,0xfe,0x01,0xfe,0x7f,0xff,0x7e,0x00,0x7e, - 0x01,0x7d,0x02,0x7d,0x05,0x79,0x02,0x7e,0x03,0x7f, - 0x01,0x00,0x01,0x01,0x00,0x01,0xf1,0xfe,0xfe,0x01, - 0xff,0x02,0x00,0x03,0x01,0x02,0x02,0x02,0x00,0x86, - 0x01,0x7e,0x08,0x75,0x02,0x7e,0x02,0x7f,0x05,0x80, - 0x05,0x93,0xff,0x01,0x01,0x01,0x01,0x7f,0x00,0x7e, - 0xff,0x7e,0xff,0x7f,0x06,0xf1,0x0b,0x99,0xfe,0x7e, - 0xfe,0x7d,0xfe,0x7c,0xff,0x7b,0x00,0x7c,0x01,0x7b, - 0x02,0x7c,0x02,0x7d,0x02,0x7e,0xfe,0x9e,0xfe,0x7c, - 0xff,0x7d,0xff,0x7b,0x00,0x7c,0x01,0x7b,0x01,0x7d, - 0x02,0x7c,0x05,0x85,0x03,0x99,0x02,0x7e,0x02,0x7d, - 0x02,0x7c,0x01,0x7b,0x00,0x7c,0xff,0x7b,0xfe,0x7c, - 0xfe,0x7d,0xfe,0x7e,0x02,0x9e,0x02,0x7c,0x01,0x7d, - 0x01,0x7b,0x00,0x7c,0xff,0x7b,0xff,0x7d,0xfe,0x7c, - 0x09,0x85,0x08,0x95,0x00,0x74,0xfb,0x89,0x0a,0x7a, - 0x00,0x86,0xf6,0x7a,0x0d,0xf4,0x0d,0x92,0x00,0x6e, - 0xf7,0x89,0x12,0x00,0x04,0xf7,0x06,0x81,0xff,0x7f, - 0xff,0x01,0x01,0x01,0x01,0x7f,0x00,0x7e,0xff,0x7e, - 0xff,0x7f,0x06,0x84,0x04,0x89,0x12,0x00,0x04,0xf7, - 0x05,0x82,0xff,0x7f,0x01,0x7f,0x01,0x01,0xff,0x01, - 0x05,0xfe,0x00,0xfd,0x0e,0x18,0x00,0xeb,0x09,0x95, - 0xfd,0x7f,0xfe,0x7d,0xff,0x7b,0x00,0x7d,0x01,0x7b, - 0x02,0x7d,0x03,0x7f,0x02,0x00,0x03,0x01,0x02,0x03, - 0x01,0x05,0x00,0x03,0xff,0x05,0xfe,0x03,0xfd,0x01, - 0xfe,0x00,0x0b,0xeb,0x06,0x91,0x02,0x01,0x03,0x03, - 0x00,0x6b,0x09,0x80,0x04,0x90,0x00,0x01,0x01,0x02, - 0x01,0x01,0x02,0x01,0x04,0x00,0x02,0x7f,0x01,0x7f, - 0x01,0x7e,0x00,0x7e,0xff,0x7e,0xfe,0x7d,0xf6,0x76, - 0x0e,0x00,0x03,0x80,0x05,0x95,0x0b,0x00,0xfa,0x78, - 0x03,0x00,0x02,0x7f,0x01,0x7f,0x01,0x7d,0x00,0x7e, - 0xff,0x7d,0xfe,0x7e,0xfd,0x7f,0xfd,0x00,0xfd,0x01, - 0xff,0x01,0xff,0x02,0x11,0xfc,0x0d,0x95,0xf6,0x72, - 0x0f,0x00,0xfb,0x8e,0x00,0x6b,0x07,0x80,0x0f,0x95, - 0xf6,0x00,0xff,0x77,0x01,0x01,0x03,0x01,0x03,0x00, - 0x03,0x7f,0x02,0x7e,0x01,0x7d,0x00,0x7e,0xff,0x7d, - 0xfe,0x7e,0xfd,0x7f,0xfd,0x00,0xfd,0x01,0xff,0x01, - 0xff,0x02,0x11,0xfc,0x10,0x92,0xff,0x02,0xfd,0x01, - 0xfe,0x00,0xfd,0x7f,0xfe,0x7d,0xff,0x7b,0x00,0x7b, - 0x01,0x7c,0x02,0x7e,0x03,0x7f,0x01,0x00,0x03,0x01, - 0x02,0x02,0x01,0x03,0x00,0x01,0xff,0x03,0xfe,0x02, - 0xfd,0x01,0xff,0x00,0xfd,0x7f,0xfe,0x7e,0xff,0x7d, - 0x10,0xf9,0x11,0x95,0xf6,0x6b,0xfc,0x95,0x0e,0x00, - 0x03,0xeb,0x08,0x95,0xfd,0x7f,0xff,0x7e,0x00,0x7e, - 0x01,0x7e,0x02,0x7f,0x04,0x7f,0x03,0x7f,0x02,0x7e, - 0x01,0x7e,0x00,0x7d,0xff,0x7e,0xff,0x7f,0xfd,0x7f, - 0xfc,0x00,0xfd,0x01,0xff,0x01,0xff,0x02,0x00,0x03, - 0x01,0x02,0x02,0x02,0x03,0x01,0x04,0x01,0x02,0x01, - 0x01,0x02,0x00,0x02,0xff,0x02,0xfd,0x01,0xfc,0x00, - 0x0c,0xeb,0x10,0x8e,0xff,0x7d,0xfe,0x7e,0xfd,0x7f, - 0xff,0x00,0xfd,0x01,0xfe,0x02,0xff,0x03,0x00,0x01, - 0x01,0x03,0x02,0x02,0x03,0x01,0x01,0x00,0x03,0x7f, - 0x02,0x7e,0x01,0x7c,0x00,0x7b,0xff,0x7b,0xfe,0x7d, - 0xfd,0x7f,0xfe,0x00,0xfd,0x01,0xff,0x02,0x10,0xfd, - 0x05,0x8e,0xff,0x7f,0x01,0x7f,0x01,0x01,0xff,0x01, - 0x00,0xf4,0xff,0x7f,0x01,0x7f,0x01,0x01,0xff,0x01, - 0x05,0xfe,0x05,0x8e,0xff,0x7f,0x01,0x7f,0x01,0x01, - 0xff,0x01,0x01,0xf3,0xff,0x7f,0xff,0x01,0x01,0x01, - 0x01,0x7f,0x00,0x7e,0xff,0x7e,0xff,0x7f,0x06,0x84, - 0x14,0x92,0xf0,0x77,0x10,0x77,0x04,0x80,0x04,0x8c, - 0x12,0x00,0xee,0xfa,0x12,0x00,0x04,0xfa,0x04,0x92, - 0x10,0x77,0xf0,0x77,0x14,0x80,0x03,0x90,0x00,0x01, - 0x01,0x02,0x01,0x01,0x02,0x01,0x04,0x00,0x02,0x7f, - 0x01,0x7f,0x01,0x7e,0x00,0x7e,0xff,0x7e,0xff,0x7f, - 0xfc,0x7e,0x00,0x7d,0x00,0xfb,0xff,0x7f,0x01,0x7f, - 0x01,0x01,0xff,0x01,0x09,0xfe,0x12,0x8d,0xff,0x02, - 0xfe,0x01,0xfd,0x00,0xfe,0x7f,0xff,0x7f,0xff,0x7d, - 0x00,0x7d,0x01,0x7e,0x02,0x7f,0x03,0x00,0x02,0x01, - 0x01,0x02,0xfb,0x88,0xfe,0x7e,0xff,0x7d,0x00,0x7d, - 0x01,0x7e,0x01,0x7f,0x07,0x8b,0xff,0x78,0x00,0x7e, - 0x02,0x7f,0x02,0x00,0x02,0x02,0x01,0x03,0x00,0x02, - 0xff,0x03,0xff,0x02,0xfe,0x02,0xfe,0x01,0xfd,0x01, - 0xfd,0x00,0xfd,0x7f,0xfe,0x7f,0xfe,0x7e,0xff,0x7e, - 0xff,0x7d,0x00,0x7d,0x01,0x7d,0x01,0x7e,0x02,0x7e, - 0x02,0x7f,0x03,0x7f,0x03,0x00,0x03,0x01,0x02,0x01, - 0x01,0x01,0xfe,0x8d,0xff,0x78,0x00,0x7e,0x01,0x7f, - 0x08,0xfb,0x09,0x95,0xf8,0x6b,0x08,0x95,0x08,0x6b, - 0xf3,0x87,0x0a,0x00,0x04,0xf9,0x04,0x95,0x00,0x6b, - 0x00,0x95,0x09,0x00,0x03,0x7f,0x01,0x7f,0x01,0x7e, - 0x00,0x7e,0xff,0x7e,0xff,0x7f,0xfd,0x7f,0xf7,0x80, - 0x09,0x00,0x03,0x7f,0x01,0x7f,0x01,0x7e,0x00,0x7d, - 0xff,0x7e,0xff,0x7f,0xfd,0x7f,0xf7,0x00,0x11,0x80, - 0x12,0x90,0xff,0x02,0xfe,0x02,0xfe,0x01,0xfc,0x00, - 0xfe,0x7f,0xfe,0x7e,0xff,0x7e,0xff,0x7d,0x00,0x7b, - 0x01,0x7d,0x01,0x7e,0x02,0x7e,0x02,0x7f,0x04,0x00, - 0x02,0x01,0x02,0x02,0x01,0x02,0x03,0xfb,0x04,0x95, - 0x00,0x6b,0x00,0x95,0x07,0x00,0x03,0x7f,0x02,0x7e, - 0x01,0x7e,0x01,0x7d,0x00,0x7b,0xff,0x7d,0xff,0x7e, - 0xfe,0x7e,0xfd,0x7f,0xf9,0x00,0x11,0x80,0x04,0x95, - 0x00,0x6b,0x00,0x95,0x0d,0x00,0xf3,0xf6,0x08,0x00, - 0xf8,0xf5,0x0d,0x00,0x02,0x80,0x04,0x95,0x00,0x6b, - 0x00,0x95,0x0d,0x00,0xf3,0xf6,0x08,0x00,0x06,0xf5, - 0x12,0x90,0xff,0x02,0xfe,0x02,0xfe,0x01,0xfc,0x00, - 0xfe,0x7f,0xfe,0x7e,0xff,0x7e,0xff,0x7d,0x00,0x7b, - 0x01,0x7d,0x01,0x7e,0x02,0x7e,0x02,0x7f,0x04,0x00, - 0x02,0x01,0x02,0x02,0x01,0x02,0x00,0x03,0xfb,0x80, - 0x05,0x00,0x03,0xf8,0x04,0x95,0x00,0x6b,0x0e,0x95, - 0x00,0x6b,0xf2,0x8b,0x0e,0x00,0x04,0xf5,0x04,0x95, - 0x00,0x6b,0x04,0x80,0x0c,0x95,0x00,0x70,0xff,0x7d, - 0xff,0x7f,0xfe,0x7f,0xfe,0x00,0xfe,0x01,0xff,0x01, - 0xff,0x03,0x00,0x02,0x0e,0xf9,0x04,0x95,0x00,0x6b, - 0x0e,0x95,0xf2,0x72,0x05,0x85,0x09,0x74,0x03,0x80, - 0x04,0x95,0x00,0x6b,0x00,0x80,0x0c,0x00,0x01,0x80, - 0x04,0x95,0x00,0x6b,0x00,0x95,0x08,0x6b,0x08,0x95, - 0xf8,0x6b,0x08,0x95,0x00,0x6b,0x04,0x80,0x04,0x95, - 0x00,0x6b,0x00,0x95,0x0e,0x6b,0x00,0x95,0x00,0x6b, - 0x04,0x80,0x09,0x95,0xfe,0x7f,0xfe,0x7e,0xff,0x7e, - 0xff,0x7d,0x00,0x7b,0x01,0x7d,0x01,0x7e,0x02,0x7e, - 0x02,0x7f,0x04,0x00,0x02,0x01,0x02,0x02,0x01,0x02, - 0x01,0x03,0x00,0x05,0xff,0x03,0xff,0x02,0xfe,0x02, - 0xfe,0x01,0xfc,0x00,0x0d,0xeb,0x04,0x95,0x00,0x6b, - 0x00,0x95,0x09,0x00,0x03,0x7f,0x01,0x7f,0x01,0x7e, - 0x00,0x7d,0xff,0x7e,0xff,0x7f,0xfd,0x7f,0xf7,0x00, - 0x11,0xf6,0x09,0x95,0xfe,0x7f,0xfe,0x7e,0xff,0x7e, - 0xff,0x7d,0x00,0x7b,0x01,0x7d,0x01,0x7e,0x02,0x7e, - 0x02,0x7f,0x04,0x00,0x02,0x01,0x02,0x02,0x01,0x02, - 0x01,0x03,0x00,0x05,0xff,0x03,0xff,0x02,0xfe,0x02, - 0xfe,0x01,0xfc,0x00,0x03,0xef,0x06,0x7a,0x04,0x82, - 0x04,0x95,0x00,0x6b,0x00,0x95,0x09,0x00,0x03,0x7f, - 0x01,0x7f,0x01,0x7e,0x00,0x7e,0xff,0x7e,0xff,0x7f, - 0xfd,0x7f,0xf7,0x00,0x07,0x80,0x07,0x75,0x03,0x80, - 0x11,0x92,0xfe,0x02,0xfd,0x01,0xfc,0x00,0xfd,0x7f, - 0xfe,0x7e,0x00,0x7e,0x01,0x7e,0x01,0x7f,0x02,0x7f, - 0x06,0x7e,0x02,0x7f,0x01,0x7f,0x01,0x7e,0x00,0x7d, - 0xfe,0x7e,0xfd,0x7f,0xfc,0x00,0xfd,0x01,0xfe,0x02, - 0x11,0xfd,0x08,0x95,0x00,0x6b,0xf9,0x95,0x0e,0x00, - 0x01,0xeb,0x04,0x95,0x00,0x71,0x01,0x7d,0x02,0x7e, - 0x03,0x7f,0x02,0x00,0x03,0x01,0x02,0x02,0x01,0x03, - 0x00,0x0f,0x04,0xeb,0x01,0x95,0x08,0x6b,0x08,0x95, - 0xf8,0x6b,0x09,0x80,0x02,0x95,0x05,0x6b,0x05,0x95, - 0xfb,0x6b,0x05,0x95,0x05,0x6b,0x05,0x95,0xfb,0x6b, - 0x07,0x80,0x03,0x95,0x0e,0x6b,0x00,0x95,0xf2,0x6b, - 0x11,0x80,0x01,0x95,0x08,0x76,0x00,0x75,0x08,0x95, - 0xf8,0x76,0x09,0xf5,0x11,0x95,0xf2,0x6b,0x00,0x95, - 0x0e,0x00,0xf2,0xeb,0x0e,0x00,0x03,0x80,0x03,0x93, - 0x00,0x6c,0x01,0x94,0x00,0x6c,0xff,0x94,0x05,0x00, - 0xfb,0xec,0x05,0x00,0x02,0x81,0x00,0x95,0x0e,0x68, - 0x00,0x83,0x06,0x93,0x00,0x6c,0x01,0x94,0x00,0x6c, - 0xfb,0x94,0x05,0x00,0xfb,0xec,0x05,0x00,0x03,0x81, - 0x03,0x87,0x08,0x05,0x08,0x7b,0xf0,0x80,0x08,0x04, - 0x08,0x7c,0x03,0xf9,0x01,0x80,0x10,0x00,0x01,0x80, - 0x06,0x95,0xff,0x7f,0xff,0x7e,0x00,0x7e,0x01,0x7f, - 0x01,0x01,0xff,0x01,0x05,0xef,0x0f,0x8e,0x00,0x72, - 0x00,0x8b,0xfe,0x02,0xfe,0x01,0xfd,0x00,0xfe,0x7f, - 0xfe,0x7e,0xff,0x7d,0x00,0x7e,0x01,0x7d,0x02,0x7e, - 0x02,0x7f,0x03,0x00,0x02,0x01,0x02,0x02,0x04,0xfd, - 0x04,0x95,0x00,0x6b,0x00,0x8b,0x02,0x02,0x02,0x01, - 0x03,0x00,0x02,0x7f,0x02,0x7e,0x01,0x7d,0x00,0x7e, - 0xff,0x7d,0xfe,0x7e,0xfe,0x7f,0xfd,0x00,0xfe,0x01, - 0xfe,0x02,0x0f,0xfd,0x0f,0x8b,0xfe,0x02,0xfe,0x01, - 0xfd,0x00,0xfe,0x7f,0xfe,0x7e,0xff,0x7d,0x00,0x7e, - 0x01,0x7d,0x02,0x7e,0x02,0x7f,0x03,0x00,0x02,0x01, - 0x02,0x02,0x03,0xfd,0x0f,0x95,0x00,0x6b,0x00,0x8b, - 0xfe,0x02,0xfe,0x01,0xfd,0x00,0xfe,0x7f,0xfe,0x7e, - 0xff,0x7d,0x00,0x7e,0x01,0x7d,0x02,0x7e,0x02,0x7f, - 0x03,0x00,0x02,0x01,0x02,0x02,0x04,0xfd,0x03,0x88, - 0x0c,0x00,0x00,0x02,0xff,0x02,0xff,0x01,0xfe,0x01, - 0xfd,0x00,0xfe,0x7f,0xfe,0x7e,0xff,0x7d,0x00,0x7e, - 0x01,0x7d,0x02,0x7e,0x02,0x7f,0x03,0x00,0x02,0x01, - 0x02,0x02,0x03,0xfd,0x0a,0x95,0xfe,0x00,0xfe,0x7f, - 0xff,0x7d,0x00,0x6f,0xfd,0x8e,0x07,0x00,0x03,0xf2, - 0x0f,0x8e,0x00,0x70,0xff,0x7d,0xff,0x7f,0xfe,0x7f, - 0xfd,0x00,0xfe,0x01,0x09,0x91,0xfe,0x02,0xfe,0x01, - 0xfd,0x00,0xfe,0x7f,0xfe,0x7e,0xff,0x7d,0x00,0x7e, - 0x01,0x7d,0x02,0x7e,0x02,0x7f,0x03,0x00,0x02,0x01, - 0x02,0x02,0x04,0xfd,0x04,0x95,0x00,0x6b,0x00,0x8a, - 0x03,0x03,0x02,0x01,0x03,0x00,0x02,0x7f,0x01,0x7d, - 0x00,0x76,0x04,0x80,0x03,0x95,0x01,0x7f,0x01,0x01, - 0xff,0x01,0xff,0x7f,0x01,0xf9,0x00,0x72,0x04,0x80, - 0x05,0x95,0x01,0x7f,0x01,0x01,0xff,0x01,0xff,0x7f, - 0x01,0xf9,0x00,0x6f,0xff,0x7d,0xfe,0x7f,0xfe,0x00, - 0x09,0x87,0x04,0x95,0x00,0x6b,0x0a,0x8e,0xf6,0x76, - 0x04,0x84,0x07,0x78,0x02,0x80,0x04,0x95,0x00,0x6b, - 0x04,0x80,0x04,0x8e,0x00,0x72,0x00,0x8a,0x03,0x03, - 0x02,0x01,0x03,0x00,0x02,0x7f,0x01,0x7d,0x00,0x76, - 0x00,0x8a,0x03,0x03,0x02,0x01,0x03,0x00,0x02,0x7f, - 0x01,0x7d,0x00,0x76,0x04,0x80,0x04,0x8e,0x00,0x72, - 0x00,0x8a,0x03,0x03,0x02,0x01,0x03,0x00,0x02,0x7f, - 0x01,0x7d,0x00,0x76,0x04,0x80,0x08,0x8e,0xfe,0x7f, - 0xfe,0x7e,0xff,0x7d,0x00,0x7e,0x01,0x7d,0x02,0x7e, - 0x02,0x7f,0x03,0x00,0x02,0x01,0x02,0x02,0x01,0x03, - 0x00,0x02,0xff,0x03,0xfe,0x02,0xfe,0x01,0xfd,0x00, - 0x0b,0xf2,0x04,0x8e,0x00,0x6b,0x00,0x92,0x02,0x02, - 0x02,0x01,0x03,0x00,0x02,0x7f,0x02,0x7e,0x01,0x7d, - 0x00,0x7e,0xff,0x7d,0xfe,0x7e,0xfe,0x7f,0xfd,0x00, - 0xfe,0x01,0xfe,0x02,0x0f,0xfd,0x0f,0x8e,0x00,0x6b, - 0x00,0x92,0xfe,0x02,0xfe,0x01,0xfd,0x00,0xfe,0x7f, - 0xfe,0x7e,0xff,0x7d,0x00,0x7e,0x01,0x7d,0x02,0x7e, - 0x02,0x7f,0x03,0x00,0x02,0x01,0x02,0x02,0x04,0xfd, - 0x04,0x8e,0x00,0x72,0x00,0x88,0x01,0x03,0x02,0x02, - 0x02,0x01,0x03,0x00,0x01,0xf2,0x0e,0x8b,0xff,0x02, - 0xfd,0x01,0xfd,0x00,0xfd,0x7f,0xff,0x7e,0x01,0x7e, - 0x02,0x7f,0x05,0x7f,0x02,0x7f,0x01,0x7e,0x00,0x7f, - 0xff,0x7e,0xfd,0x7f,0xfd,0x00,0xfd,0x01,0xff,0x02, - 0x0e,0xfd,0x05,0x95,0x00,0x6f,0x01,0x7d,0x02,0x7f, - 0x02,0x00,0xf8,0x8e,0x07,0x00,0x03,0xf2,0x04,0x8e, - 0x00,0x76,0x01,0x7d,0x02,0x7f,0x03,0x00,0x02,0x01, - 0x03,0x03,0x00,0x8a,0x00,0x72,0x04,0x80,0x02,0x8e, - 0x06,0x72,0x06,0x8e,0xfa,0x72,0x08,0x80,0x03,0x8e, - 0x04,0x72,0x04,0x8e,0xfc,0x72,0x04,0x8e,0x04,0x72, - 0x04,0x8e,0xfc,0x72,0x07,0x80,0x03,0x8e,0x0b,0x72, - 0x00,0x8e,0xf5,0x72,0x0e,0x80,0x02,0x8e,0x06,0x72, - 0x06,0x8e,0xfa,0x72,0xfe,0x7c,0xfe,0x7e,0xfe,0x7f, - 0xff,0x00,0x0f,0x87,0x0e,0x8e,0xf5,0x72,0x00,0x8e, - 0x0b,0x00,0xf5,0xf2,0x0b,0x00,0x03,0x80,0x09,0x99, - 0xfe,0x7f,0xff,0x7f,0xff,0x7e,0x00,0x7e,0x01,0x7e, - 0x01,0x7f,0x01,0x7e,0x00,0x7e,0xfe,0x7e,0x01,0x8e, - 0xff,0x7e,0x00,0x7e,0x01,0x7e,0x01,0x7f,0x01,0x7e, - 0x00,0x7e,0xff,0x7e,0xfc,0x7e,0x04,0x7e,0x01,0x7e, - 0x00,0x7e,0xff,0x7e,0xff,0x7f,0xff,0x7e,0x00,0x7e, - 0x01,0x7e,0xff,0x8e,0x02,0x7e,0x00,0x7e,0xff,0x7e, - 0xff,0x7f,0xff,0x7e,0x00,0x7e,0x01,0x7e,0x01,0x7f, - 0x02,0x7f,0x05,0x87,0x04,0x95,0x00,0x77,0x00,0xfd, - 0x00,0x77,0x04,0x80,0x05,0x99,0x02,0x7f,0x01,0x7f, - 0x01,0x7e,0x00,0x7e,0xff,0x7e,0xff,0x7f,0xff,0x7e, - 0x00,0x7e,0x02,0x7e,0xff,0x8e,0x01,0x7e,0x00,0x7e, - 0xff,0x7e,0xff,0x7f,0xff,0x7e,0x00,0x7e,0x01,0x7e, - 0x04,0x7e,0xfc,0x7e,0xff,0x7e,0x00,0x7e,0x01,0x7e, - 0x01,0x7f,0x01,0x7e,0x00,0x7e,0xff,0x7e,0x01,0x8e, - 0xfe,0x7e,0x00,0x7e,0x01,0x7e,0x01,0x7f,0x01,0x7e, - 0x00,0x7e,0xff,0x7e,0xff,0x7f,0xfe,0x7f,0x09,0x87, - 0x03,0x86,0x00,0x02,0x01,0x03,0x02,0x01,0x02,0x00, - 0x02,0x7f,0x04,0x7d,0x02,0x7f,0x02,0x00,0x02,0x01, - 0x01,0x02,0xee,0xfe,0x01,0x02,0x02,0x01,0x02,0x00, - 0x02,0x7f,0x04,0x7d,0x02,0x7f,0x02,0x00,0x02,0x01, - 0x01,0x03,0x00,0x02,0x03,0xf4,0x10,0x80,0x03,0x80, - 0x07,0x15,0x08,0x6b,0xfe,0x85,0xf5,0x00,0x10,0xfb, - 0x0d,0x95,0xf6,0x00,0x00,0x6b,0x0a,0x00,0x02,0x02, - 0x00,0x08,0xfe,0x02,0xf6,0x00,0x0e,0xf4,0x03,0x80, - 0x00,0x15,0x0a,0x00,0x02,0x7e,0x00,0x7e,0x00,0x7d, - 0x00,0x7e,0xfe,0x7f,0xf6,0x00,0x0a,0x80,0x02,0x7e, - 0x01,0x7e,0x00,0x7d,0xff,0x7d,0xfe,0x7f,0xf6,0x00, - 0x10,0x80,0x03,0x80,0x00,0x15,0x0c,0x00,0xff,0x7e, - 0x03,0xed,0x03,0xfd,0x00,0x03,0x02,0x00,0x00,0x12, - 0x02,0x03,0x0a,0x00,0x00,0x6b,0x02,0x00,0x00,0x7d, - 0xfe,0x83,0xf4,0x00,0x11,0x80,0x0f,0x80,0xf4,0x00, - 0x00,0x15,0x0c,0x00,0xff,0xf6,0xf5,0x00,0x0f,0xf5, - 0x04,0x95,0x07,0x76,0x00,0x0a,0x07,0x80,0xf9,0x76, - 0x00,0x75,0xf8,0x80,0x07,0x0c,0x09,0xf4,0xf9,0x0c, - 0x09,0xf4,0x03,0x92,0x02,0x03,0x07,0x00,0x03,0x7d, - 0x00,0x7b,0xfc,0x7e,0x04,0x7d,0x00,0x7a,0xfd,0x7e, - 0xf9,0x00,0xfe,0x02,0x06,0x89,0x02,0x00,0x06,0xf5, - 0x03,0x95,0x00,0x6b,0x0c,0x15,0x00,0x6b,0x02,0x80, - 0x03,0x95,0x00,0x6b,0x0c,0x15,0x00,0x6b,0xf8,0x96, - 0x03,0x00,0x07,0xea,0x03,0x80,0x00,0x15,0x0c,0x80, - 0xf7,0x76,0xfd,0x00,0x03,0x80,0x0a,0x75,0x03,0x80, - 0x03,0x80,0x07,0x13,0x02,0x02,0x03,0x00,0x00,0x6b, - 0x02,0x80,0x03,0x80,0x00,0x15,0x09,0x6b,0x09,0x15, - 0x00,0x6b,0x03,0x80,0x03,0x80,0x00,0x15,0x00,0xf6, - 0x0d,0x00,0x00,0x8a,0x00,0x6b,0x03,0x80,0x07,0x80, - 0xfd,0x00,0xff,0x03,0x00,0x04,0x00,0x07,0x00,0x04, - 0x01,0x02,0x03,0x01,0x06,0x00,0x03,0x7f,0x01,0x7e, - 0x01,0x7c,0x00,0x79,0xff,0x7c,0xff,0x7d,0xfd,0x00, - 0xfa,0x00,0x0e,0x80,0x03,0x80,0x00,0x15,0x0c,0x00, - 0x00,0x6b,0x02,0x80,0x03,0x80,0x00,0x15,0x0a,0x00, - 0x02,0x7f,0x01,0x7d,0x00,0x7b,0xff,0x7e,0xfe,0x7f, - 0xf6,0x00,0x10,0xf7,0x11,0x8f,0xff,0x03,0xff,0x02, - 0xfe,0x01,0xfa,0x00,0xfd,0x7f,0xff,0x7e,0x00,0x7c, - 0x00,0x79,0x00,0x7b,0x01,0x7e,0x03,0x00,0x06,0x00, - 0x02,0x00,0x01,0x03,0x01,0x02,0x03,0xfb,0x03,0x95, - 0x0c,0x00,0xfa,0x80,0x00,0x6b,0x09,0x80,0x03,0x95, - 0x00,0x77,0x06,0x7a,0x06,0x06,0x00,0x09,0xfa,0xf1, - 0xfa,0x7a,0x0e,0x80,0x03,0x87,0x00,0x0b,0x02,0x02, - 0x03,0x00,0x02,0x7e,0x01,0x02,0x04,0x00,0x02,0x7e, - 0x00,0x75,0xfe,0x7e,0xfc,0x00,0xff,0x01,0xfe,0x7f, - 0xfd,0x00,0xfe,0x02,0x07,0x8e,0x00,0x6b,0x09,0x80, - 0x03,0x80,0x0e,0x15,0xf2,0x80,0x0e,0x6b,0x03,0x80, - 0x03,0x95,0x00,0x6b,0x0e,0x00,0x00,0x7d,0xfe,0x98, - 0x00,0x6b,0x05,0x80,0x03,0x95,0x00,0x75,0x02,0x7d, - 0x0a,0x00,0x00,0x8e,0x00,0x6b,0x02,0x80,0x03,0x95, - 0x00,0x6b,0x10,0x00,0x00,0x15,0xf8,0x80,0x00,0x6b, - 0x0a,0x80,0x03,0x95,0x00,0x6b,0x10,0x00,0x00,0x15, - 0xf8,0x80,0x00,0x6b,0x0a,0x00,0x00,0x7d,0x02,0x83, - 0x10,0x80,0x03,0x95,0x00,0x6b,0x09,0x00,0x03,0x02, - 0x00,0x08,0xfd,0x02,0xf7,0x00,0x0e,0x89,0x00,0x6b, - 0x03,0x80,0x03,0x95,0x00,0x6b,0x09,0x00,0x03,0x02, - 0x00,0x08,0xfd,0x02,0xf7,0x00,0x0e,0xf4,0x03,0x92, - 0x02,0x03,0x07,0x00,0x03,0x7d,0x00,0x70,0xfd,0x7e, - 0xf9,0x00,0xfe,0x02,0x03,0x89,0x09,0x00,0x02,0xf5, - 0x03,0x80,0x00,0x15,0x00,0xf5,0x07,0x00,0x00,0x08, - 0x02,0x03,0x06,0x00,0x02,0x7d,0x00,0x70,0xfe,0x7e, - 0xfa,0x00,0xfe,0x02,0x00,0x08,0x0c,0xf6,0x0f,0x80, - 0x00,0x15,0xf6,0x00,0xfe,0x7d,0x00,0x79,0x02,0x7e, - 0x0a,0x00,0xf4,0xf7,0x07,0x09,0x07,0xf7,0x03,0x8c, - 0x01,0x02,0x01,0x01,0x05,0x00,0x02,0x7f,0x01,0x7e, - 0x00,0x74,0x00,0x86,0xff,0x01,0xfe,0x01,0xfb,0x00, - 0xff,0x7f,0xff,0x7f,0x00,0x7c,0x01,0x7e,0x01,0x00, - 0x05,0x00,0x02,0x00,0x01,0x02,0x03,0xfe,0x04,0x8e, - 0x02,0x01,0x04,0x00,0x02,0x7f,0x01,0x7e,0x00,0x77, - 0xff,0x7e,0xfe,0x7f,0xfc,0x00,0xfe,0x01,0xff,0x02, - 0x00,0x09,0x01,0x02,0x02,0x02,0x03,0x01,0x02,0x01, - 0x01,0x01,0x01,0x02,0x02,0xeb,0x03,0x80,0x00,0x15, - 0x03,0x00,0x02,0x7e,0x00,0x7b,0xfe,0x7e,0xfd,0x00, - 0x03,0x80,0x04,0x00,0x03,0x7e,0x00,0x78,0xfd,0x7e, - 0xf9,0x00,0x0c,0x80,0x03,0x8c,0x02,0x02,0x02,0x01, - 0x03,0x00,0x02,0x7f,0x01,0x7d,0xfe,0x7e,0xf9,0x7d, - 0xff,0x7e,0x00,0x7d,0x03,0x7f,0x02,0x00,0x03,0x01, - 0x02,0x01,0x02,0xfe,0x0d,0x8c,0xff,0x02,0xfe,0x01, - 0xfc,0x00,0xfe,0x7f,0xff,0x7e,0x00,0x77,0x01,0x7e, - 0x02,0x7f,0x04,0x00,0x02,0x01,0x01,0x02,0x00,0x0f, - 0xff,0x02,0xfe,0x01,0xf9,0x00,0x0c,0xeb,0x03,0x88, - 0x0a,0x00,0x00,0x02,0x00,0x03,0xfe,0x02,0xfa,0x00, - 0xff,0x7e,0xff,0x7d,0x00,0x7b,0x01,0x7c,0x01,0x7f, - 0x06,0x00,0x02,0x02,0x03,0xfe,0x03,0x8f,0x06,0x77, - 0x06,0x09,0xfa,0x80,0x00,0x71,0xff,0x87,0xfb,0x79, - 0x07,0x87,0x05,0x79,0x02,0x80,0x03,0x8d,0x02,0x02, - 0x06,0x00,0x02,0x7e,0x00,0x7d,0xfc,0x7d,0x04,0x7e, - 0x00,0x7d,0xfe,0x7e,0xfa,0x00,0xfe,0x02,0x04,0x85, - 0x02,0x00,0x06,0xf9,0x03,0x8f,0x00,0x73,0x01,0x7e, - 0x07,0x00,0x02,0x02,0x00,0x0d,0x00,0xf3,0x01,0x7e, - 0x03,0x80,0x03,0x8f,0x00,0x73,0x01,0x7e,0x07,0x00, - 0x02,0x02,0x00,0x0d,0x00,0xf3,0x01,0x7e,0xf8,0x90, - 0x03,0x00,0x08,0xf0,0x03,0x80,0x00,0x15,0x00,0xf3, - 0x02,0x00,0x06,0x07,0xfa,0xf9,0x07,0x78,0x03,0x80, - 0x03,0x80,0x04,0x0c,0x02,0x03,0x04,0x00,0x00,0x71, - 0x02,0x80,0x03,0x80,0x00,0x0f,0x06,0x77,0x06,0x09, - 0x00,0x71,0x02,0x80,0x03,0x80,0x00,0x0f,0x0a,0xf1, - 0x00,0x0f,0xf6,0xf8,0x0a,0x00,0x02,0xf9,0x05,0x80, - 0xff,0x01,0xff,0x04,0x00,0x05,0x01,0x03,0x01,0x02, - 0x06,0x00,0x02,0x7e,0x00,0x7d,0x00,0x7b,0x00,0x7c, - 0xfe,0x7f,0xfa,0x00,0x0b,0x80,0x03,0x80,0x00,0x0f, - 0x00,0xfb,0x01,0x03,0x01,0x02,0x05,0x00,0x02,0x7e, - 0x01,0x7d,0x00,0x76,0x03,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x0a,0x8f,0x02,0x7f,0x01,0x7e,0x00,0x76, - 0xff,0x7f,0xfe,0x7f,0xfb,0x00,0xff,0x01,0xff,0x01, - 0x00,0x0a,0x01,0x02,0x01,0x01,0x05,0x00,0xf9,0x80, - 0x00,0x6b,0x0c,0x86,0x0d,0x8a,0xff,0x03,0xfe,0x02, - 0xfb,0x00,0xff,0x7e,0xff,0x7d,0x00,0x7b,0x01,0x7c, - 0x01,0x7f,0x05,0x00,0x02,0x01,0x01,0x03,0x03,0xfc, - 0x03,0x80,0x00,0x0f,0x00,0xfb,0x01,0x03,0x01,0x02, - 0x04,0x00,0x01,0x7e,0x01,0x7d,0x00,0x76,0x00,0x8a, - 0x01,0x03,0x02,0x02,0x03,0x00,0x02,0x7e,0x01,0x7d, - 0x00,0x76,0x03,0x80,0x03,0x8f,0x00,0x74,0x01,0x7e, - 0x02,0x7f,0x04,0x00,0x02,0x01,0x01,0x01,0x00,0x8d, - 0x00,0x6e,0xff,0x7e,0xfe,0x7f,0xfb,0x00,0xfe,0x01, - 0x0c,0x85,0x03,0x8d,0x01,0x02,0x03,0x00,0x02,0x7e, - 0x01,0x02,0x03,0x00,0x02,0x7e,0x00,0x74,0xfe,0x7f, - 0xfd,0x00,0xff,0x01,0xfe,0x7f,0xfd,0x00,0xff,0x01, - 0x00,0x0c,0x06,0x82,0x00,0x6b,0x08,0x86,0x03,0x80, - 0x0a,0x0f,0xf6,0x80,0x0a,0x71,0x03,0x80,0x03,0x8f, - 0x00,0x73,0x01,0x7e,0x07,0x00,0x02,0x02,0x00,0x0d, - 0x00,0xf3,0x01,0x7e,0x00,0x7e,0x03,0x82,0x03,0x8f, - 0x00,0x79,0x02,0x7e,0x08,0x00,0x00,0x89,0x00,0x71, - 0x02,0x80,0x03,0x8f,0x00,0x73,0x01,0x7e,0x03,0x00, - 0x02,0x02,0x00,0x0d,0x00,0xf3,0x01,0x7e,0x03,0x00, - 0x02,0x02,0x00,0x0d,0x00,0xf3,0x01,0x7e,0x03,0x80, - 0x03,0x8f,0x00,0x73,0x01,0x7e,0x03,0x00,0x02,0x02, - 0x00,0x0d,0x00,0xf3,0x01,0x7e,0x03,0x00,0x02,0x02, - 0x00,0x0d,0x00,0xf3,0x01,0x7e,0x00,0x7e,0x03,0x82, - 0x03,0x8d,0x00,0x02,0x02,0x00,0x00,0x71,0x08,0x00, - 0x02,0x02,0x00,0x06,0xfe,0x02,0xf8,0x00,0x0c,0xf6, - 0x03,0x8f,0x00,0x71,0x07,0x00,0x02,0x02,0x00,0x06, - 0xfe,0x02,0xf9,0x00,0x0c,0x85,0x00,0x71,0x02,0x80, - 0x03,0x8f,0x00,0x71,0x07,0x00,0x03,0x02,0x00,0x06, - 0xfd,0x02,0xf9,0x00,0x0c,0xf6,0x03,0x8d,0x02,0x02, - 0x06,0x00,0x02,0x7e,0x00,0x75,0xfe,0x7e,0xfa,0x00, - 0xfe,0x02,0x04,0x85,0x06,0x00,0x02,0xf9,0x03,0x80, - 0x00,0x0f,0x00,0xf8,0x04,0x00,0x00,0x06,0x02,0x02, - 0x04,0x00,0x02,0x7e,0x00,0x75,0xfe,0x7e,0xfc,0x00, - 0xfe,0x02,0x00,0x05,0x0a,0xf9,0x0d,0x80,0x00,0x0f, - 0xf7,0x00,0xff,0x7e,0x00,0x7b,0x01,0x7e,0x09,0x00, - 0xf6,0xfa,0x04,0x06,0x08,0xfa - }; - - //------------------------------------------------------------------------- - gsv_text::gsv_text() : - m_x(0.0), - m_y(0.0), - m_start_x(0.0), - m_width(10.0), - m_height(0.0), - m_space(0.0), - m_line_space(0.0), - m_text(m_chr), - m_text_buf(), - m_cur_chr(m_chr), - m_font(gsv_default_font), - m_loaded_font(), - m_status(initial), - m_big_endian(false), - m_flip(false) - { - m_chr[0] = m_chr[1] = 0; +int8u gsv_default_font[] = +{ + 0x40,0x00,0x6c,0x0f,0x15,0x00,0x0e,0x00,0xf9,0xff, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x0d,0x0a,0x0d,0x0a,0x46,0x6f,0x6e,0x74,0x20,0x28, + 0x63,0x29,0x20,0x4d,0x69,0x63,0x72,0x6f,0x50,0x72, + 0x6f,0x66,0x20,0x32,0x37,0x20,0x53,0x65,0x70,0x74, + 0x65,0x6d,0x62,0x2e,0x31,0x39,0x38,0x39,0x00,0x0d, + 0x0a,0x0d,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x02,0x00,0x12,0x00,0x34,0x00,0x46,0x00,0x94,0x00, + 0xd0,0x00,0x2e,0x01,0x3e,0x01,0x64,0x01,0x8a,0x01, + 0x98,0x01,0xa2,0x01,0xb4,0x01,0xba,0x01,0xc6,0x01, + 0xcc,0x01,0xf0,0x01,0xfa,0x01,0x18,0x02,0x38,0x02, + 0x44,0x02,0x68,0x02,0x98,0x02,0xa2,0x02,0xde,0x02, + 0x0e,0x03,0x24,0x03,0x40,0x03,0x48,0x03,0x52,0x03, + 0x5a,0x03,0x82,0x03,0xec,0x03,0xfa,0x03,0x26,0x04, + 0x4c,0x04,0x6a,0x04,0x7c,0x04,0x8a,0x04,0xb6,0x04, + 0xc4,0x04,0xca,0x04,0xe0,0x04,0xee,0x04,0xf8,0x04, + 0x0a,0x05,0x18,0x05,0x44,0x05,0x5e,0x05,0x8e,0x05, + 0xac,0x05,0xd6,0x05,0xe0,0x05,0xf6,0x05,0x00,0x06, + 0x12,0x06,0x1c,0x06,0x28,0x06,0x36,0x06,0x48,0x06, + 0x4e,0x06,0x60,0x06,0x6e,0x06,0x74,0x06,0x84,0x06, + 0xa6,0x06,0xc8,0x06,0xe6,0x06,0x08,0x07,0x2c,0x07, + 0x3c,0x07,0x68,0x07,0x7c,0x07,0x8c,0x07,0xa2,0x07, + 0xb0,0x07,0xb6,0x07,0xd8,0x07,0xec,0x07,0x10,0x08, + 0x32,0x08,0x54,0x08,0x64,0x08,0x88,0x08,0x98,0x08, + 0xac,0x08,0xb6,0x08,0xc8,0x08,0xd2,0x08,0xe4,0x08, + 0xf2,0x08,0x3e,0x09,0x48,0x09,0x94,0x09,0xc2,0x09, + 0xc4,0x09,0xd0,0x09,0xe2,0x09,0x04,0x0a,0x0e,0x0a, + 0x26,0x0a,0x34,0x0a,0x4a,0x0a,0x66,0x0a,0x70,0x0a, + 0x7e,0x0a,0x8e,0x0a,0x9a,0x0a,0xa6,0x0a,0xb4,0x0a, + 0xd8,0x0a,0xe2,0x0a,0xf6,0x0a,0x18,0x0b,0x22,0x0b, + 0x32,0x0b,0x56,0x0b,0x60,0x0b,0x6e,0x0b,0x7c,0x0b, + 0x8a,0x0b,0x9c,0x0b,0x9e,0x0b,0xb2,0x0b,0xc2,0x0b, + 0xd8,0x0b,0xf4,0x0b,0x08,0x0c,0x30,0x0c,0x56,0x0c, + 0x72,0x0c,0x90,0x0c,0xb2,0x0c,0xce,0x0c,0xe2,0x0c, + 0xfe,0x0c,0x10,0x0d,0x26,0x0d,0x36,0x0d,0x42,0x0d, + 0x4e,0x0d,0x5c,0x0d,0x78,0x0d,0x8c,0x0d,0x8e,0x0d, + 0x90,0x0d,0x92,0x0d,0x94,0x0d,0x96,0x0d,0x98,0x0d, + 0x9a,0x0d,0x9c,0x0d,0x9e,0x0d,0xa0,0x0d,0xa2,0x0d, + 0xa4,0x0d,0xa6,0x0d,0xa8,0x0d,0xaa,0x0d,0xac,0x0d, + 0xae,0x0d,0xb0,0x0d,0xb2,0x0d,0xb4,0x0d,0xb6,0x0d, + 0xb8,0x0d,0xba,0x0d,0xbc,0x0d,0xbe,0x0d,0xc0,0x0d, + 0xc2,0x0d,0xc4,0x0d,0xc6,0x0d,0xc8,0x0d,0xca,0x0d, + 0xcc,0x0d,0xce,0x0d,0xd0,0x0d,0xd2,0x0d,0xd4,0x0d, + 0xd6,0x0d,0xd8,0x0d,0xda,0x0d,0xdc,0x0d,0xde,0x0d, + 0xe0,0x0d,0xe2,0x0d,0xe4,0x0d,0xe6,0x0d,0xe8,0x0d, + 0xea,0x0d,0xec,0x0d,0x0c,0x0e,0x26,0x0e,0x48,0x0e, + 0x64,0x0e,0x88,0x0e,0x92,0x0e,0xa6,0x0e,0xb4,0x0e, + 0xd0,0x0e,0xee,0x0e,0x02,0x0f,0x16,0x0f,0x26,0x0f, + 0x3c,0x0f,0x58,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f, + 0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f, + 0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f, + 0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x10,0x80, + 0x05,0x95,0x00,0x72,0x00,0xfb,0xff,0x7f,0x01,0x7f, + 0x01,0x01,0xff,0x01,0x05,0xfe,0x05,0x95,0xff,0x7f, + 0x00,0x7a,0x01,0x86,0xff,0x7a,0x01,0x87,0x01,0x7f, + 0xfe,0x7a,0x0a,0x87,0xff,0x7f,0x00,0x7a,0x01,0x86, + 0xff,0x7a,0x01,0x87,0x01,0x7f,0xfe,0x7a,0x05,0xf2, + 0x0b,0x95,0xf9,0x64,0x0d,0x9c,0xf9,0x64,0xfa,0x91, + 0x0e,0x00,0xf1,0xfa,0x0e,0x00,0x04,0xfc,0x08,0x99, + 0x00,0x63,0x04,0x9d,0x00,0x63,0x04,0x96,0xff,0x7f, + 0x01,0x7f,0x01,0x01,0x00,0x01,0xfe,0x02,0xfd,0x01, + 0xfc,0x00,0xfd,0x7f,0xfe,0x7e,0x00,0x7e,0x01,0x7e, + 0x01,0x7f,0x02,0x7f,0x06,0x7e,0x02,0x7f,0x02,0x7e, + 0xf2,0x89,0x02,0x7e,0x02,0x7f,0x06,0x7e,0x02,0x7f, + 0x01,0x7f,0x01,0x7e,0x00,0x7c,0xfe,0x7e,0xfd,0x7f, + 0xfc,0x00,0xfd,0x01,0xfe,0x02,0x00,0x01,0x01,0x01, + 0x01,0x7f,0xff,0x7f,0x10,0xfd,0x15,0x95,0xee,0x6b, + 0x05,0x95,0x02,0x7e,0x00,0x7e,0xff,0x7e,0xfe,0x7f, + 0xfe,0x00,0xfe,0x02,0x00,0x02,0x01,0x02,0x02,0x01, + 0x02,0x00,0x02,0x7f,0x03,0x7f,0x03,0x00,0x03,0x01, + 0x02,0x01,0xfc,0xf2,0xfe,0x7f,0xff,0x7e,0x00,0x7e, + 0x02,0x7e,0x02,0x00,0x02,0x01,0x01,0x02,0x00,0x02, + 0xfe,0x02,0xfe,0x00,0x07,0xf9,0x15,0x8d,0xff,0x7f, + 0x01,0x7f,0x01,0x01,0x00,0x01,0xff,0x01,0xff,0x00, + 0xff,0x7f,0xff,0x7e,0xfe,0x7b,0xfe,0x7d,0xfe,0x7e, + 0xfe,0x7f,0xfd,0x00,0xfd,0x01,0xff,0x02,0x00,0x03, + 0x01,0x02,0x06,0x04,0x02,0x02,0x01,0x02,0x00,0x02, + 0xff,0x02,0xfe,0x01,0xfe,0x7f,0xff,0x7e,0x00,0x7e, + 0x01,0x7d,0x02,0x7d,0x05,0x79,0x02,0x7e,0x03,0x7f, + 0x01,0x00,0x01,0x01,0x00,0x01,0xf1,0xfe,0xfe,0x01, + 0xff,0x02,0x00,0x03,0x01,0x02,0x02,0x02,0x00,0x86, + 0x01,0x7e,0x08,0x75,0x02,0x7e,0x02,0x7f,0x05,0x80, + 0x05,0x93,0xff,0x01,0x01,0x01,0x01,0x7f,0x00,0x7e, + 0xff,0x7e,0xff,0x7f,0x06,0xf1,0x0b,0x99,0xfe,0x7e, + 0xfe,0x7d,0xfe,0x7c,0xff,0x7b,0x00,0x7c,0x01,0x7b, + 0x02,0x7c,0x02,0x7d,0x02,0x7e,0xfe,0x9e,0xfe,0x7c, + 0xff,0x7d,0xff,0x7b,0x00,0x7c,0x01,0x7b,0x01,0x7d, + 0x02,0x7c,0x05,0x85,0x03,0x99,0x02,0x7e,0x02,0x7d, + 0x02,0x7c,0x01,0x7b,0x00,0x7c,0xff,0x7b,0xfe,0x7c, + 0xfe,0x7d,0xfe,0x7e,0x02,0x9e,0x02,0x7c,0x01,0x7d, + 0x01,0x7b,0x00,0x7c,0xff,0x7b,0xff,0x7d,0xfe,0x7c, + 0x09,0x85,0x08,0x95,0x00,0x74,0xfb,0x89,0x0a,0x7a, + 0x00,0x86,0xf6,0x7a,0x0d,0xf4,0x0d,0x92,0x00,0x6e, + 0xf7,0x89,0x12,0x00,0x04,0xf7,0x06,0x81,0xff,0x7f, + 0xff,0x01,0x01,0x01,0x01,0x7f,0x00,0x7e,0xff,0x7e, + 0xff,0x7f,0x06,0x84,0x04,0x89,0x12,0x00,0x04,0xf7, + 0x05,0x82,0xff,0x7f,0x01,0x7f,0x01,0x01,0xff,0x01, + 0x05,0xfe,0x00,0xfd,0x0e,0x18,0x00,0xeb,0x09,0x95, + 0xfd,0x7f,0xfe,0x7d,0xff,0x7b,0x00,0x7d,0x01,0x7b, + 0x02,0x7d,0x03,0x7f,0x02,0x00,0x03,0x01,0x02,0x03, + 0x01,0x05,0x00,0x03,0xff,0x05,0xfe,0x03,0xfd,0x01, + 0xfe,0x00,0x0b,0xeb,0x06,0x91,0x02,0x01,0x03,0x03, + 0x00,0x6b,0x09,0x80,0x04,0x90,0x00,0x01,0x01,0x02, + 0x01,0x01,0x02,0x01,0x04,0x00,0x02,0x7f,0x01,0x7f, + 0x01,0x7e,0x00,0x7e,0xff,0x7e,0xfe,0x7d,0xf6,0x76, + 0x0e,0x00,0x03,0x80,0x05,0x95,0x0b,0x00,0xfa,0x78, + 0x03,0x00,0x02,0x7f,0x01,0x7f,0x01,0x7d,0x00,0x7e, + 0xff,0x7d,0xfe,0x7e,0xfd,0x7f,0xfd,0x00,0xfd,0x01, + 0xff,0x01,0xff,0x02,0x11,0xfc,0x0d,0x95,0xf6,0x72, + 0x0f,0x00,0xfb,0x8e,0x00,0x6b,0x07,0x80,0x0f,0x95, + 0xf6,0x00,0xff,0x77,0x01,0x01,0x03,0x01,0x03,0x00, + 0x03,0x7f,0x02,0x7e,0x01,0x7d,0x00,0x7e,0xff,0x7d, + 0xfe,0x7e,0xfd,0x7f,0xfd,0x00,0xfd,0x01,0xff,0x01, + 0xff,0x02,0x11,0xfc,0x10,0x92,0xff,0x02,0xfd,0x01, + 0xfe,0x00,0xfd,0x7f,0xfe,0x7d,0xff,0x7b,0x00,0x7b, + 0x01,0x7c,0x02,0x7e,0x03,0x7f,0x01,0x00,0x03,0x01, + 0x02,0x02,0x01,0x03,0x00,0x01,0xff,0x03,0xfe,0x02, + 0xfd,0x01,0xff,0x00,0xfd,0x7f,0xfe,0x7e,0xff,0x7d, + 0x10,0xf9,0x11,0x95,0xf6,0x6b,0xfc,0x95,0x0e,0x00, + 0x03,0xeb,0x08,0x95,0xfd,0x7f,0xff,0x7e,0x00,0x7e, + 0x01,0x7e,0x02,0x7f,0x04,0x7f,0x03,0x7f,0x02,0x7e, + 0x01,0x7e,0x00,0x7d,0xff,0x7e,0xff,0x7f,0xfd,0x7f, + 0xfc,0x00,0xfd,0x01,0xff,0x01,0xff,0x02,0x00,0x03, + 0x01,0x02,0x02,0x02,0x03,0x01,0x04,0x01,0x02,0x01, + 0x01,0x02,0x00,0x02,0xff,0x02,0xfd,0x01,0xfc,0x00, + 0x0c,0xeb,0x10,0x8e,0xff,0x7d,0xfe,0x7e,0xfd,0x7f, + 0xff,0x00,0xfd,0x01,0xfe,0x02,0xff,0x03,0x00,0x01, + 0x01,0x03,0x02,0x02,0x03,0x01,0x01,0x00,0x03,0x7f, + 0x02,0x7e,0x01,0x7c,0x00,0x7b,0xff,0x7b,0xfe,0x7d, + 0xfd,0x7f,0xfe,0x00,0xfd,0x01,0xff,0x02,0x10,0xfd, + 0x05,0x8e,0xff,0x7f,0x01,0x7f,0x01,0x01,0xff,0x01, + 0x00,0xf4,0xff,0x7f,0x01,0x7f,0x01,0x01,0xff,0x01, + 0x05,0xfe,0x05,0x8e,0xff,0x7f,0x01,0x7f,0x01,0x01, + 0xff,0x01,0x01,0xf3,0xff,0x7f,0xff,0x01,0x01,0x01, + 0x01,0x7f,0x00,0x7e,0xff,0x7e,0xff,0x7f,0x06,0x84, + 0x14,0x92,0xf0,0x77,0x10,0x77,0x04,0x80,0x04,0x8c, + 0x12,0x00,0xee,0xfa,0x12,0x00,0x04,0xfa,0x04,0x92, + 0x10,0x77,0xf0,0x77,0x14,0x80,0x03,0x90,0x00,0x01, + 0x01,0x02,0x01,0x01,0x02,0x01,0x04,0x00,0x02,0x7f, + 0x01,0x7f,0x01,0x7e,0x00,0x7e,0xff,0x7e,0xff,0x7f, + 0xfc,0x7e,0x00,0x7d,0x00,0xfb,0xff,0x7f,0x01,0x7f, + 0x01,0x01,0xff,0x01,0x09,0xfe,0x12,0x8d,0xff,0x02, + 0xfe,0x01,0xfd,0x00,0xfe,0x7f,0xff,0x7f,0xff,0x7d, + 0x00,0x7d,0x01,0x7e,0x02,0x7f,0x03,0x00,0x02,0x01, + 0x01,0x02,0xfb,0x88,0xfe,0x7e,0xff,0x7d,0x00,0x7d, + 0x01,0x7e,0x01,0x7f,0x07,0x8b,0xff,0x78,0x00,0x7e, + 0x02,0x7f,0x02,0x00,0x02,0x02,0x01,0x03,0x00,0x02, + 0xff,0x03,0xff,0x02,0xfe,0x02,0xfe,0x01,0xfd,0x01, + 0xfd,0x00,0xfd,0x7f,0xfe,0x7f,0xfe,0x7e,0xff,0x7e, + 0xff,0x7d,0x00,0x7d,0x01,0x7d,0x01,0x7e,0x02,0x7e, + 0x02,0x7f,0x03,0x7f,0x03,0x00,0x03,0x01,0x02,0x01, + 0x01,0x01,0xfe,0x8d,0xff,0x78,0x00,0x7e,0x01,0x7f, + 0x08,0xfb,0x09,0x95,0xf8,0x6b,0x08,0x95,0x08,0x6b, + 0xf3,0x87,0x0a,0x00,0x04,0xf9,0x04,0x95,0x00,0x6b, + 0x00,0x95,0x09,0x00,0x03,0x7f,0x01,0x7f,0x01,0x7e, + 0x00,0x7e,0xff,0x7e,0xff,0x7f,0xfd,0x7f,0xf7,0x80, + 0x09,0x00,0x03,0x7f,0x01,0x7f,0x01,0x7e,0x00,0x7d, + 0xff,0x7e,0xff,0x7f,0xfd,0x7f,0xf7,0x00,0x11,0x80, + 0x12,0x90,0xff,0x02,0xfe,0x02,0xfe,0x01,0xfc,0x00, + 0xfe,0x7f,0xfe,0x7e,0xff,0x7e,0xff,0x7d,0x00,0x7b, + 0x01,0x7d,0x01,0x7e,0x02,0x7e,0x02,0x7f,0x04,0x00, + 0x02,0x01,0x02,0x02,0x01,0x02,0x03,0xfb,0x04,0x95, + 0x00,0x6b,0x00,0x95,0x07,0x00,0x03,0x7f,0x02,0x7e, + 0x01,0x7e,0x01,0x7d,0x00,0x7b,0xff,0x7d,0xff,0x7e, + 0xfe,0x7e,0xfd,0x7f,0xf9,0x00,0x11,0x80,0x04,0x95, + 0x00,0x6b,0x00,0x95,0x0d,0x00,0xf3,0xf6,0x08,0x00, + 0xf8,0xf5,0x0d,0x00,0x02,0x80,0x04,0x95,0x00,0x6b, + 0x00,0x95,0x0d,0x00,0xf3,0xf6,0x08,0x00,0x06,0xf5, + 0x12,0x90,0xff,0x02,0xfe,0x02,0xfe,0x01,0xfc,0x00, + 0xfe,0x7f,0xfe,0x7e,0xff,0x7e,0xff,0x7d,0x00,0x7b, + 0x01,0x7d,0x01,0x7e,0x02,0x7e,0x02,0x7f,0x04,0x00, + 0x02,0x01,0x02,0x02,0x01,0x02,0x00,0x03,0xfb,0x80, + 0x05,0x00,0x03,0xf8,0x04,0x95,0x00,0x6b,0x0e,0x95, + 0x00,0x6b,0xf2,0x8b,0x0e,0x00,0x04,0xf5,0x04,0x95, + 0x00,0x6b,0x04,0x80,0x0c,0x95,0x00,0x70,0xff,0x7d, + 0xff,0x7f,0xfe,0x7f,0xfe,0x00,0xfe,0x01,0xff,0x01, + 0xff,0x03,0x00,0x02,0x0e,0xf9,0x04,0x95,0x00,0x6b, + 0x0e,0x95,0xf2,0x72,0x05,0x85,0x09,0x74,0x03,0x80, + 0x04,0x95,0x00,0x6b,0x00,0x80,0x0c,0x00,0x01,0x80, + 0x04,0x95,0x00,0x6b,0x00,0x95,0x08,0x6b,0x08,0x95, + 0xf8,0x6b,0x08,0x95,0x00,0x6b,0x04,0x80,0x04,0x95, + 0x00,0x6b,0x00,0x95,0x0e,0x6b,0x00,0x95,0x00,0x6b, + 0x04,0x80,0x09,0x95,0xfe,0x7f,0xfe,0x7e,0xff,0x7e, + 0xff,0x7d,0x00,0x7b,0x01,0x7d,0x01,0x7e,0x02,0x7e, + 0x02,0x7f,0x04,0x00,0x02,0x01,0x02,0x02,0x01,0x02, + 0x01,0x03,0x00,0x05,0xff,0x03,0xff,0x02,0xfe,0x02, + 0xfe,0x01,0xfc,0x00,0x0d,0xeb,0x04,0x95,0x00,0x6b, + 0x00,0x95,0x09,0x00,0x03,0x7f,0x01,0x7f,0x01,0x7e, + 0x00,0x7d,0xff,0x7e,0xff,0x7f,0xfd,0x7f,0xf7,0x00, + 0x11,0xf6,0x09,0x95,0xfe,0x7f,0xfe,0x7e,0xff,0x7e, + 0xff,0x7d,0x00,0x7b,0x01,0x7d,0x01,0x7e,0x02,0x7e, + 0x02,0x7f,0x04,0x00,0x02,0x01,0x02,0x02,0x01,0x02, + 0x01,0x03,0x00,0x05,0xff,0x03,0xff,0x02,0xfe,0x02, + 0xfe,0x01,0xfc,0x00,0x03,0xef,0x06,0x7a,0x04,0x82, + 0x04,0x95,0x00,0x6b,0x00,0x95,0x09,0x00,0x03,0x7f, + 0x01,0x7f,0x01,0x7e,0x00,0x7e,0xff,0x7e,0xff,0x7f, + 0xfd,0x7f,0xf7,0x00,0x07,0x80,0x07,0x75,0x03,0x80, + 0x11,0x92,0xfe,0x02,0xfd,0x01,0xfc,0x00,0xfd,0x7f, + 0xfe,0x7e,0x00,0x7e,0x01,0x7e,0x01,0x7f,0x02,0x7f, + 0x06,0x7e,0x02,0x7f,0x01,0x7f,0x01,0x7e,0x00,0x7d, + 0xfe,0x7e,0xfd,0x7f,0xfc,0x00,0xfd,0x01,0xfe,0x02, + 0x11,0xfd,0x08,0x95,0x00,0x6b,0xf9,0x95,0x0e,0x00, + 0x01,0xeb,0x04,0x95,0x00,0x71,0x01,0x7d,0x02,0x7e, + 0x03,0x7f,0x02,0x00,0x03,0x01,0x02,0x02,0x01,0x03, + 0x00,0x0f,0x04,0xeb,0x01,0x95,0x08,0x6b,0x08,0x95, + 0xf8,0x6b,0x09,0x80,0x02,0x95,0x05,0x6b,0x05,0x95, + 0xfb,0x6b,0x05,0x95,0x05,0x6b,0x05,0x95,0xfb,0x6b, + 0x07,0x80,0x03,0x95,0x0e,0x6b,0x00,0x95,0xf2,0x6b, + 0x11,0x80,0x01,0x95,0x08,0x76,0x00,0x75,0x08,0x95, + 0xf8,0x76,0x09,0xf5,0x11,0x95,0xf2,0x6b,0x00,0x95, + 0x0e,0x00,0xf2,0xeb,0x0e,0x00,0x03,0x80,0x03,0x93, + 0x00,0x6c,0x01,0x94,0x00,0x6c,0xff,0x94,0x05,0x00, + 0xfb,0xec,0x05,0x00,0x02,0x81,0x00,0x95,0x0e,0x68, + 0x00,0x83,0x06,0x93,0x00,0x6c,0x01,0x94,0x00,0x6c, + 0xfb,0x94,0x05,0x00,0xfb,0xec,0x05,0x00,0x03,0x81, + 0x03,0x87,0x08,0x05,0x08,0x7b,0xf0,0x80,0x08,0x04, + 0x08,0x7c,0x03,0xf9,0x01,0x80,0x10,0x00,0x01,0x80, + 0x06,0x95,0xff,0x7f,0xff,0x7e,0x00,0x7e,0x01,0x7f, + 0x01,0x01,0xff,0x01,0x05,0xef,0x0f,0x8e,0x00,0x72, + 0x00,0x8b,0xfe,0x02,0xfe,0x01,0xfd,0x00,0xfe,0x7f, + 0xfe,0x7e,0xff,0x7d,0x00,0x7e,0x01,0x7d,0x02,0x7e, + 0x02,0x7f,0x03,0x00,0x02,0x01,0x02,0x02,0x04,0xfd, + 0x04,0x95,0x00,0x6b,0x00,0x8b,0x02,0x02,0x02,0x01, + 0x03,0x00,0x02,0x7f,0x02,0x7e,0x01,0x7d,0x00,0x7e, + 0xff,0x7d,0xfe,0x7e,0xfe,0x7f,0xfd,0x00,0xfe,0x01, + 0xfe,0x02,0x0f,0xfd,0x0f,0x8b,0xfe,0x02,0xfe,0x01, + 0xfd,0x00,0xfe,0x7f,0xfe,0x7e,0xff,0x7d,0x00,0x7e, + 0x01,0x7d,0x02,0x7e,0x02,0x7f,0x03,0x00,0x02,0x01, + 0x02,0x02,0x03,0xfd,0x0f,0x95,0x00,0x6b,0x00,0x8b, + 0xfe,0x02,0xfe,0x01,0xfd,0x00,0xfe,0x7f,0xfe,0x7e, + 0xff,0x7d,0x00,0x7e,0x01,0x7d,0x02,0x7e,0x02,0x7f, + 0x03,0x00,0x02,0x01,0x02,0x02,0x04,0xfd,0x03,0x88, + 0x0c,0x00,0x00,0x02,0xff,0x02,0xff,0x01,0xfe,0x01, + 0xfd,0x00,0xfe,0x7f,0xfe,0x7e,0xff,0x7d,0x00,0x7e, + 0x01,0x7d,0x02,0x7e,0x02,0x7f,0x03,0x00,0x02,0x01, + 0x02,0x02,0x03,0xfd,0x0a,0x95,0xfe,0x00,0xfe,0x7f, + 0xff,0x7d,0x00,0x6f,0xfd,0x8e,0x07,0x00,0x03,0xf2, + 0x0f,0x8e,0x00,0x70,0xff,0x7d,0xff,0x7f,0xfe,0x7f, + 0xfd,0x00,0xfe,0x01,0x09,0x91,0xfe,0x02,0xfe,0x01, + 0xfd,0x00,0xfe,0x7f,0xfe,0x7e,0xff,0x7d,0x00,0x7e, + 0x01,0x7d,0x02,0x7e,0x02,0x7f,0x03,0x00,0x02,0x01, + 0x02,0x02,0x04,0xfd,0x04,0x95,0x00,0x6b,0x00,0x8a, + 0x03,0x03,0x02,0x01,0x03,0x00,0x02,0x7f,0x01,0x7d, + 0x00,0x76,0x04,0x80,0x03,0x95,0x01,0x7f,0x01,0x01, + 0xff,0x01,0xff,0x7f,0x01,0xf9,0x00,0x72,0x04,0x80, + 0x05,0x95,0x01,0x7f,0x01,0x01,0xff,0x01,0xff,0x7f, + 0x01,0xf9,0x00,0x6f,0xff,0x7d,0xfe,0x7f,0xfe,0x00, + 0x09,0x87,0x04,0x95,0x00,0x6b,0x0a,0x8e,0xf6,0x76, + 0x04,0x84,0x07,0x78,0x02,0x80,0x04,0x95,0x00,0x6b, + 0x04,0x80,0x04,0x8e,0x00,0x72,0x00,0x8a,0x03,0x03, + 0x02,0x01,0x03,0x00,0x02,0x7f,0x01,0x7d,0x00,0x76, + 0x00,0x8a,0x03,0x03,0x02,0x01,0x03,0x00,0x02,0x7f, + 0x01,0x7d,0x00,0x76,0x04,0x80,0x04,0x8e,0x00,0x72, + 0x00,0x8a,0x03,0x03,0x02,0x01,0x03,0x00,0x02,0x7f, + 0x01,0x7d,0x00,0x76,0x04,0x80,0x08,0x8e,0xfe,0x7f, + 0xfe,0x7e,0xff,0x7d,0x00,0x7e,0x01,0x7d,0x02,0x7e, + 0x02,0x7f,0x03,0x00,0x02,0x01,0x02,0x02,0x01,0x03, + 0x00,0x02,0xff,0x03,0xfe,0x02,0xfe,0x01,0xfd,0x00, + 0x0b,0xf2,0x04,0x8e,0x00,0x6b,0x00,0x92,0x02,0x02, + 0x02,0x01,0x03,0x00,0x02,0x7f,0x02,0x7e,0x01,0x7d, + 0x00,0x7e,0xff,0x7d,0xfe,0x7e,0xfe,0x7f,0xfd,0x00, + 0xfe,0x01,0xfe,0x02,0x0f,0xfd,0x0f,0x8e,0x00,0x6b, + 0x00,0x92,0xfe,0x02,0xfe,0x01,0xfd,0x00,0xfe,0x7f, + 0xfe,0x7e,0xff,0x7d,0x00,0x7e,0x01,0x7d,0x02,0x7e, + 0x02,0x7f,0x03,0x00,0x02,0x01,0x02,0x02,0x04,0xfd, + 0x04,0x8e,0x00,0x72,0x00,0x88,0x01,0x03,0x02,0x02, + 0x02,0x01,0x03,0x00,0x01,0xf2,0x0e,0x8b,0xff,0x02, + 0xfd,0x01,0xfd,0x00,0xfd,0x7f,0xff,0x7e,0x01,0x7e, + 0x02,0x7f,0x05,0x7f,0x02,0x7f,0x01,0x7e,0x00,0x7f, + 0xff,0x7e,0xfd,0x7f,0xfd,0x00,0xfd,0x01,0xff,0x02, + 0x0e,0xfd,0x05,0x95,0x00,0x6f,0x01,0x7d,0x02,0x7f, + 0x02,0x00,0xf8,0x8e,0x07,0x00,0x03,0xf2,0x04,0x8e, + 0x00,0x76,0x01,0x7d,0x02,0x7f,0x03,0x00,0x02,0x01, + 0x03,0x03,0x00,0x8a,0x00,0x72,0x04,0x80,0x02,0x8e, + 0x06,0x72,0x06,0x8e,0xfa,0x72,0x08,0x80,0x03,0x8e, + 0x04,0x72,0x04,0x8e,0xfc,0x72,0x04,0x8e,0x04,0x72, + 0x04,0x8e,0xfc,0x72,0x07,0x80,0x03,0x8e,0x0b,0x72, + 0x00,0x8e,0xf5,0x72,0x0e,0x80,0x02,0x8e,0x06,0x72, + 0x06,0x8e,0xfa,0x72,0xfe,0x7c,0xfe,0x7e,0xfe,0x7f, + 0xff,0x00,0x0f,0x87,0x0e,0x8e,0xf5,0x72,0x00,0x8e, + 0x0b,0x00,0xf5,0xf2,0x0b,0x00,0x03,0x80,0x09,0x99, + 0xfe,0x7f,0xff,0x7f,0xff,0x7e,0x00,0x7e,0x01,0x7e, + 0x01,0x7f,0x01,0x7e,0x00,0x7e,0xfe,0x7e,0x01,0x8e, + 0xff,0x7e,0x00,0x7e,0x01,0x7e,0x01,0x7f,0x01,0x7e, + 0x00,0x7e,0xff,0x7e,0xfc,0x7e,0x04,0x7e,0x01,0x7e, + 0x00,0x7e,0xff,0x7e,0xff,0x7f,0xff,0x7e,0x00,0x7e, + 0x01,0x7e,0xff,0x8e,0x02,0x7e,0x00,0x7e,0xff,0x7e, + 0xff,0x7f,0xff,0x7e,0x00,0x7e,0x01,0x7e,0x01,0x7f, + 0x02,0x7f,0x05,0x87,0x04,0x95,0x00,0x77,0x00,0xfd, + 0x00,0x77,0x04,0x80,0x05,0x99,0x02,0x7f,0x01,0x7f, + 0x01,0x7e,0x00,0x7e,0xff,0x7e,0xff,0x7f,0xff,0x7e, + 0x00,0x7e,0x02,0x7e,0xff,0x8e,0x01,0x7e,0x00,0x7e, + 0xff,0x7e,0xff,0x7f,0xff,0x7e,0x00,0x7e,0x01,0x7e, + 0x04,0x7e,0xfc,0x7e,0xff,0x7e,0x00,0x7e,0x01,0x7e, + 0x01,0x7f,0x01,0x7e,0x00,0x7e,0xff,0x7e,0x01,0x8e, + 0xfe,0x7e,0x00,0x7e,0x01,0x7e,0x01,0x7f,0x01,0x7e, + 0x00,0x7e,0xff,0x7e,0xff,0x7f,0xfe,0x7f,0x09,0x87, + 0x03,0x86,0x00,0x02,0x01,0x03,0x02,0x01,0x02,0x00, + 0x02,0x7f,0x04,0x7d,0x02,0x7f,0x02,0x00,0x02,0x01, + 0x01,0x02,0xee,0xfe,0x01,0x02,0x02,0x01,0x02,0x00, + 0x02,0x7f,0x04,0x7d,0x02,0x7f,0x02,0x00,0x02,0x01, + 0x01,0x03,0x00,0x02,0x03,0xf4,0x10,0x80,0x03,0x80, + 0x07,0x15,0x08,0x6b,0xfe,0x85,0xf5,0x00,0x10,0xfb, + 0x0d,0x95,0xf6,0x00,0x00,0x6b,0x0a,0x00,0x02,0x02, + 0x00,0x08,0xfe,0x02,0xf6,0x00,0x0e,0xf4,0x03,0x80, + 0x00,0x15,0x0a,0x00,0x02,0x7e,0x00,0x7e,0x00,0x7d, + 0x00,0x7e,0xfe,0x7f,0xf6,0x00,0x0a,0x80,0x02,0x7e, + 0x01,0x7e,0x00,0x7d,0xff,0x7d,0xfe,0x7f,0xf6,0x00, + 0x10,0x80,0x03,0x80,0x00,0x15,0x0c,0x00,0xff,0x7e, + 0x03,0xed,0x03,0xfd,0x00,0x03,0x02,0x00,0x00,0x12, + 0x02,0x03,0x0a,0x00,0x00,0x6b,0x02,0x00,0x00,0x7d, + 0xfe,0x83,0xf4,0x00,0x11,0x80,0x0f,0x80,0xf4,0x00, + 0x00,0x15,0x0c,0x00,0xff,0xf6,0xf5,0x00,0x0f,0xf5, + 0x04,0x95,0x07,0x76,0x00,0x0a,0x07,0x80,0xf9,0x76, + 0x00,0x75,0xf8,0x80,0x07,0x0c,0x09,0xf4,0xf9,0x0c, + 0x09,0xf4,0x03,0x92,0x02,0x03,0x07,0x00,0x03,0x7d, + 0x00,0x7b,0xfc,0x7e,0x04,0x7d,0x00,0x7a,0xfd,0x7e, + 0xf9,0x00,0xfe,0x02,0x06,0x89,0x02,0x00,0x06,0xf5, + 0x03,0x95,0x00,0x6b,0x0c,0x15,0x00,0x6b,0x02,0x80, + 0x03,0x95,0x00,0x6b,0x0c,0x15,0x00,0x6b,0xf8,0x96, + 0x03,0x00,0x07,0xea,0x03,0x80,0x00,0x15,0x0c,0x80, + 0xf7,0x76,0xfd,0x00,0x03,0x80,0x0a,0x75,0x03,0x80, + 0x03,0x80,0x07,0x13,0x02,0x02,0x03,0x00,0x00,0x6b, + 0x02,0x80,0x03,0x80,0x00,0x15,0x09,0x6b,0x09,0x15, + 0x00,0x6b,0x03,0x80,0x03,0x80,0x00,0x15,0x00,0xf6, + 0x0d,0x00,0x00,0x8a,0x00,0x6b,0x03,0x80,0x07,0x80, + 0xfd,0x00,0xff,0x03,0x00,0x04,0x00,0x07,0x00,0x04, + 0x01,0x02,0x03,0x01,0x06,0x00,0x03,0x7f,0x01,0x7e, + 0x01,0x7c,0x00,0x79,0xff,0x7c,0xff,0x7d,0xfd,0x00, + 0xfa,0x00,0x0e,0x80,0x03,0x80,0x00,0x15,0x0c,0x00, + 0x00,0x6b,0x02,0x80,0x03,0x80,0x00,0x15,0x0a,0x00, + 0x02,0x7f,0x01,0x7d,0x00,0x7b,0xff,0x7e,0xfe,0x7f, + 0xf6,0x00,0x10,0xf7,0x11,0x8f,0xff,0x03,0xff,0x02, + 0xfe,0x01,0xfa,0x00,0xfd,0x7f,0xff,0x7e,0x00,0x7c, + 0x00,0x79,0x00,0x7b,0x01,0x7e,0x03,0x00,0x06,0x00, + 0x02,0x00,0x01,0x03,0x01,0x02,0x03,0xfb,0x03,0x95, + 0x0c,0x00,0xfa,0x80,0x00,0x6b,0x09,0x80,0x03,0x95, + 0x00,0x77,0x06,0x7a,0x06,0x06,0x00,0x09,0xfa,0xf1, + 0xfa,0x7a,0x0e,0x80,0x03,0x87,0x00,0x0b,0x02,0x02, + 0x03,0x00,0x02,0x7e,0x01,0x02,0x04,0x00,0x02,0x7e, + 0x00,0x75,0xfe,0x7e,0xfc,0x00,0xff,0x01,0xfe,0x7f, + 0xfd,0x00,0xfe,0x02,0x07,0x8e,0x00,0x6b,0x09,0x80, + 0x03,0x80,0x0e,0x15,0xf2,0x80,0x0e,0x6b,0x03,0x80, + 0x03,0x95,0x00,0x6b,0x0e,0x00,0x00,0x7d,0xfe,0x98, + 0x00,0x6b,0x05,0x80,0x03,0x95,0x00,0x75,0x02,0x7d, + 0x0a,0x00,0x00,0x8e,0x00,0x6b,0x02,0x80,0x03,0x95, + 0x00,0x6b,0x10,0x00,0x00,0x15,0xf8,0x80,0x00,0x6b, + 0x0a,0x80,0x03,0x95,0x00,0x6b,0x10,0x00,0x00,0x15, + 0xf8,0x80,0x00,0x6b,0x0a,0x00,0x00,0x7d,0x02,0x83, + 0x10,0x80,0x03,0x95,0x00,0x6b,0x09,0x00,0x03,0x02, + 0x00,0x08,0xfd,0x02,0xf7,0x00,0x0e,0x89,0x00,0x6b, + 0x03,0x80,0x03,0x95,0x00,0x6b,0x09,0x00,0x03,0x02, + 0x00,0x08,0xfd,0x02,0xf7,0x00,0x0e,0xf4,0x03,0x92, + 0x02,0x03,0x07,0x00,0x03,0x7d,0x00,0x70,0xfd,0x7e, + 0xf9,0x00,0xfe,0x02,0x03,0x89,0x09,0x00,0x02,0xf5, + 0x03,0x80,0x00,0x15,0x00,0xf5,0x07,0x00,0x00,0x08, + 0x02,0x03,0x06,0x00,0x02,0x7d,0x00,0x70,0xfe,0x7e, + 0xfa,0x00,0xfe,0x02,0x00,0x08,0x0c,0xf6,0x0f,0x80, + 0x00,0x15,0xf6,0x00,0xfe,0x7d,0x00,0x79,0x02,0x7e, + 0x0a,0x00,0xf4,0xf7,0x07,0x09,0x07,0xf7,0x03,0x8c, + 0x01,0x02,0x01,0x01,0x05,0x00,0x02,0x7f,0x01,0x7e, + 0x00,0x74,0x00,0x86,0xff,0x01,0xfe,0x01,0xfb,0x00, + 0xff,0x7f,0xff,0x7f,0x00,0x7c,0x01,0x7e,0x01,0x00, + 0x05,0x00,0x02,0x00,0x01,0x02,0x03,0xfe,0x04,0x8e, + 0x02,0x01,0x04,0x00,0x02,0x7f,0x01,0x7e,0x00,0x77, + 0xff,0x7e,0xfe,0x7f,0xfc,0x00,0xfe,0x01,0xff,0x02, + 0x00,0x09,0x01,0x02,0x02,0x02,0x03,0x01,0x02,0x01, + 0x01,0x01,0x01,0x02,0x02,0xeb,0x03,0x80,0x00,0x15, + 0x03,0x00,0x02,0x7e,0x00,0x7b,0xfe,0x7e,0xfd,0x00, + 0x03,0x80,0x04,0x00,0x03,0x7e,0x00,0x78,0xfd,0x7e, + 0xf9,0x00,0x0c,0x80,0x03,0x8c,0x02,0x02,0x02,0x01, + 0x03,0x00,0x02,0x7f,0x01,0x7d,0xfe,0x7e,0xf9,0x7d, + 0xff,0x7e,0x00,0x7d,0x03,0x7f,0x02,0x00,0x03,0x01, + 0x02,0x01,0x02,0xfe,0x0d,0x8c,0xff,0x02,0xfe,0x01, + 0xfc,0x00,0xfe,0x7f,0xff,0x7e,0x00,0x77,0x01,0x7e, + 0x02,0x7f,0x04,0x00,0x02,0x01,0x01,0x02,0x00,0x0f, + 0xff,0x02,0xfe,0x01,0xf9,0x00,0x0c,0xeb,0x03,0x88, + 0x0a,0x00,0x00,0x02,0x00,0x03,0xfe,0x02,0xfa,0x00, + 0xff,0x7e,0xff,0x7d,0x00,0x7b,0x01,0x7c,0x01,0x7f, + 0x06,0x00,0x02,0x02,0x03,0xfe,0x03,0x8f,0x06,0x77, + 0x06,0x09,0xfa,0x80,0x00,0x71,0xff,0x87,0xfb,0x79, + 0x07,0x87,0x05,0x79,0x02,0x80,0x03,0x8d,0x02,0x02, + 0x06,0x00,0x02,0x7e,0x00,0x7d,0xfc,0x7d,0x04,0x7e, + 0x00,0x7d,0xfe,0x7e,0xfa,0x00,0xfe,0x02,0x04,0x85, + 0x02,0x00,0x06,0xf9,0x03,0x8f,0x00,0x73,0x01,0x7e, + 0x07,0x00,0x02,0x02,0x00,0x0d,0x00,0xf3,0x01,0x7e, + 0x03,0x80,0x03,0x8f,0x00,0x73,0x01,0x7e,0x07,0x00, + 0x02,0x02,0x00,0x0d,0x00,0xf3,0x01,0x7e,0xf8,0x90, + 0x03,0x00,0x08,0xf0,0x03,0x80,0x00,0x15,0x00,0xf3, + 0x02,0x00,0x06,0x07,0xfa,0xf9,0x07,0x78,0x03,0x80, + 0x03,0x80,0x04,0x0c,0x02,0x03,0x04,0x00,0x00,0x71, + 0x02,0x80,0x03,0x80,0x00,0x0f,0x06,0x77,0x06,0x09, + 0x00,0x71,0x02,0x80,0x03,0x80,0x00,0x0f,0x0a,0xf1, + 0x00,0x0f,0xf6,0xf8,0x0a,0x00,0x02,0xf9,0x05,0x80, + 0xff,0x01,0xff,0x04,0x00,0x05,0x01,0x03,0x01,0x02, + 0x06,0x00,0x02,0x7e,0x00,0x7d,0x00,0x7b,0x00,0x7c, + 0xfe,0x7f,0xfa,0x00,0x0b,0x80,0x03,0x80,0x00,0x0f, + 0x00,0xfb,0x01,0x03,0x01,0x02,0x05,0x00,0x02,0x7e, + 0x01,0x7d,0x00,0x76,0x03,0x80,0x10,0x80,0x10,0x80, + 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, + 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, + 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, + 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, + 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, + 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, + 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, + 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, + 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, + 0x10,0x80,0x0a,0x8f,0x02,0x7f,0x01,0x7e,0x00,0x76, + 0xff,0x7f,0xfe,0x7f,0xfb,0x00,0xff,0x01,0xff,0x01, + 0x00,0x0a,0x01,0x02,0x01,0x01,0x05,0x00,0xf9,0x80, + 0x00,0x6b,0x0c,0x86,0x0d,0x8a,0xff,0x03,0xfe,0x02, + 0xfb,0x00,0xff,0x7e,0xff,0x7d,0x00,0x7b,0x01,0x7c, + 0x01,0x7f,0x05,0x00,0x02,0x01,0x01,0x03,0x03,0xfc, + 0x03,0x80,0x00,0x0f,0x00,0xfb,0x01,0x03,0x01,0x02, + 0x04,0x00,0x01,0x7e,0x01,0x7d,0x00,0x76,0x00,0x8a, + 0x01,0x03,0x02,0x02,0x03,0x00,0x02,0x7e,0x01,0x7d, + 0x00,0x76,0x03,0x80,0x03,0x8f,0x00,0x74,0x01,0x7e, + 0x02,0x7f,0x04,0x00,0x02,0x01,0x01,0x01,0x00,0x8d, + 0x00,0x6e,0xff,0x7e,0xfe,0x7f,0xfb,0x00,0xfe,0x01, + 0x0c,0x85,0x03,0x8d,0x01,0x02,0x03,0x00,0x02,0x7e, + 0x01,0x02,0x03,0x00,0x02,0x7e,0x00,0x74,0xfe,0x7f, + 0xfd,0x00,0xff,0x01,0xfe,0x7f,0xfd,0x00,0xff,0x01, + 0x00,0x0c,0x06,0x82,0x00,0x6b,0x08,0x86,0x03,0x80, + 0x0a,0x0f,0xf6,0x80,0x0a,0x71,0x03,0x80,0x03,0x8f, + 0x00,0x73,0x01,0x7e,0x07,0x00,0x02,0x02,0x00,0x0d, + 0x00,0xf3,0x01,0x7e,0x00,0x7e,0x03,0x82,0x03,0x8f, + 0x00,0x79,0x02,0x7e,0x08,0x00,0x00,0x89,0x00,0x71, + 0x02,0x80,0x03,0x8f,0x00,0x73,0x01,0x7e,0x03,0x00, + 0x02,0x02,0x00,0x0d,0x00,0xf3,0x01,0x7e,0x03,0x00, + 0x02,0x02,0x00,0x0d,0x00,0xf3,0x01,0x7e,0x03,0x80, + 0x03,0x8f,0x00,0x73,0x01,0x7e,0x03,0x00,0x02,0x02, + 0x00,0x0d,0x00,0xf3,0x01,0x7e,0x03,0x00,0x02,0x02, + 0x00,0x0d,0x00,0xf3,0x01,0x7e,0x00,0x7e,0x03,0x82, + 0x03,0x8d,0x00,0x02,0x02,0x00,0x00,0x71,0x08,0x00, + 0x02,0x02,0x00,0x06,0xfe,0x02,0xf8,0x00,0x0c,0xf6, + 0x03,0x8f,0x00,0x71,0x07,0x00,0x02,0x02,0x00,0x06, + 0xfe,0x02,0xf9,0x00,0x0c,0x85,0x00,0x71,0x02,0x80, + 0x03,0x8f,0x00,0x71,0x07,0x00,0x03,0x02,0x00,0x06, + 0xfd,0x02,0xf9,0x00,0x0c,0xf6,0x03,0x8d,0x02,0x02, + 0x06,0x00,0x02,0x7e,0x00,0x75,0xfe,0x7e,0xfa,0x00, + 0xfe,0x02,0x04,0x85,0x06,0x00,0x02,0xf9,0x03,0x80, + 0x00,0x0f,0x00,0xf8,0x04,0x00,0x00,0x06,0x02,0x02, + 0x04,0x00,0x02,0x7e,0x00,0x75,0xfe,0x7e,0xfc,0x00, + 0xfe,0x02,0x00,0x05,0x0a,0xf9,0x0d,0x80,0x00,0x0f, + 0xf7,0x00,0xff,0x7e,0x00,0x7b,0x01,0x7e,0x09,0x00, + 0xf6,0xfa,0x04,0x06,0x08,0xfa +}; + +//------------------------------------------------------------------------- +gsv_text::gsv_text() : + m_x(0.0), + m_y(0.0), + m_start_x(0.0), + m_width(10.0), + m_height(0.0), + m_space(0.0), + m_line_space(0.0), + m_text(m_chr), + m_text_buf(), + m_cur_chr(m_chr), + m_font(gsv_default_font), + m_loaded_font(), + m_status(initial), + m_big_endian(false), + m_flip(false) +{ + m_chr[0] = m_chr[1] = 0; - int t = 1; - if(*(char*)&t == 0) m_big_endian = true; - } + int t = 1; + if(*(char*)&t == 0) m_big_endian = true; +} - //------------------------------------------------------------------------- - void gsv_text::font(const void* font) - { - m_font = font; - if(m_font == 0) m_font = &m_loaded_font[0]; - } +//------------------------------------------------------------------------- +void gsv_text::font(const void* font) +{ + m_font = font; + if(m_font == 0) m_font = &m_loaded_font[0]; +} - //------------------------------------------------------------------------- - void gsv_text::size(double height, double width) - { - m_height = height; - m_width = width; - } +//------------------------------------------------------------------------- +void gsv_text::size(double height, double width) +{ + m_height = height; + m_width = width; +} - //------------------------------------------------------------------------- - void gsv_text::space(double space) - { - m_space = space; - } +//------------------------------------------------------------------------- +void gsv_text::space(double space) +{ + m_space = space; +} - //------------------------------------------------------------------------- - void gsv_text::line_space(double line_space) - { - m_line_space = line_space; - } +//------------------------------------------------------------------------- +void gsv_text::line_space(double line_space) +{ + m_line_space = line_space; +} - //------------------------------------------------------------------------- - void gsv_text::start_point(double x, double y) - { - m_x = m_start_x = x; - m_y = y; - //if(m_flip) m_y += m_height; - } +//------------------------------------------------------------------------- +void gsv_text::start_point(double x, double y) +{ + m_x = m_start_x = x; + m_y = y; + //if(m_flip) m_y += m_height; +} - //------------------------------------------------------------------------- - void gsv_text::load_font(const char* file) - { - m_loaded_font.resize(0); - FILE* fd = fopen(file, "rb"); - if(fd) +//------------------------------------------------------------------------- +void gsv_text::load_font(const char* file) +{ + m_loaded_font.resize(0); + FILE* fd = fopen(file, "rb"); + if(fd) + { + unsigned len; + + fseek(fd, 0l, SEEK_END); + len = ftell(fd); + fseek(fd, 0l, SEEK_SET); + if(len > 0) { - unsigned len; - - fseek(fd, 0l, SEEK_END); - len = ftell(fd); - fseek(fd, 0l, SEEK_SET); - if(len > 0) + m_loaded_font.resize(len); + if (fread(&m_loaded_font[0], 1, len, fd) == len) { - m_loaded_font.resize(len); - if (fread(&m_loaded_font[0], 1, len, fd) == len) - { - m_font = &m_loaded_font[0]; - } + m_font = &m_loaded_font[0]; } - fclose(fd); } + fclose(fd); } +} - //------------------------------------------------------------------------- - void gsv_text::text(const char* text) +//------------------------------------------------------------------------- +void gsv_text::text(const char* text) +{ + if(text == 0) { - if(text == 0) - { - m_chr[0] = 0; - m_text = m_chr; - return; - } - unsigned new_size = strlen(text) + 1; - if(new_size > m_text_buf.size()) - { - m_text_buf.resize(new_size); - } - memcpy(&m_text_buf[0], text, new_size); - m_text = &m_text_buf[0]; + m_chr[0] = 0; + m_text = m_chr; + return; } - - //------------------------------------------------------------------------- - void gsv_text::rewind(unsigned) + unsigned new_size = strlen(text) + 1; + if(new_size > m_text_buf.size()) { - m_status = initial; - if(m_font == 0) return; - - m_indices = (int8u*)m_font; - double base_height = value(m_indices + 4); - m_indices += value(m_indices); - m_glyphs = (int8*)(m_indices + 257*2); - m_h = m_height / base_height; - m_w = (m_width == 0.0) ? m_h : m_width / base_height; - if(m_flip) m_h = -m_h; - m_cur_chr = m_text; + m_text_buf.resize(new_size); } + memcpy(&m_text_buf[0], text, new_size); + m_text = &m_text_buf[0]; +} + +//------------------------------------------------------------------------- +void gsv_text::rewind(unsigned) +{ + m_status = initial; + if(m_font == 0) return; + + m_indices = (int8u*)m_font; + double base_height = value(m_indices + 4); + m_indices += value(m_indices); + m_glyphs = (int8*)(m_indices + 257*2); + m_h = m_height / base_height; + m_w = (m_width == 0.0) ? m_h : m_width / base_height; + if(m_flip) m_h = -m_h; + m_cur_chr = m_text; +} + +//------------------------------------------------------------------------- +unsigned gsv_text::vertex(double* x, double* y) +{ + unsigned idx; + int8 yc, yf; + int dx, dy; + bool quit = false; - //------------------------------------------------------------------------- - unsigned gsv_text::vertex(double* x, double* y) + while(!quit) { - unsigned idx; - int8 yc, yf; - int dx, dy; - bool quit = false; - - while(!quit) + switch(m_status) { - switch(m_status) + case initial: + if(m_font == 0) { - case initial: - if(m_font == 0) - { - quit = true; - break; - } - m_status = next_char; + quit = true; + break; + } + m_status = next_char; - case next_char: - if(*m_cur_chr == 0) - { - quit = true; - break; - } - idx = (*m_cur_chr++) & 0xFF; - if(idx == '\n') - { - m_x = m_start_x; - m_y -= m_flip ? -m_height - m_line_space : m_height + m_line_space; - break; - } - idx <<= 1; - m_bglyph = m_glyphs + value(m_indices + idx); - m_eglyph = m_glyphs + value(m_indices + idx + 2); - m_status = start_glyph; - - case start_glyph: - *x = m_x; - *y = m_y; - m_status = glyph; - return path_cmd_move_to; - - case glyph: - if(m_bglyph >= m_eglyph) - { - m_status = next_char; - m_x += m_space; - break; - } - dx = int(*m_bglyph++); - yf = (yc = *m_bglyph++) & 0x80; - yc <<= 1; - yc >>= 1; - dy = int(yc); - m_x += double(dx) * m_w; - m_y += double(dy) * m_h; - *x = m_x; - *y = m_y; - return yf ? path_cmd_move_to : path_cmd_line_to; + case next_char: + if(*m_cur_chr == 0) + { + quit = true; + break; } + idx = (*m_cur_chr++) & 0xFF; + if(idx == '\n') + { + m_x = m_start_x; + m_y -= m_flip ? -m_height - m_line_space : m_height + m_line_space; + break; + } + idx <<= 1; + m_bglyph = m_glyphs + value(m_indices + idx); + m_eglyph = m_glyphs + value(m_indices + idx + 2); + m_status = start_glyph; + + case start_glyph: + *x = m_x; + *y = m_y; + m_status = glyph; + return path_cmd_move_to; + case glyph: + if(m_bglyph >= m_eglyph) + { + m_status = next_char; + m_x += m_space; + break; + } + dx = int(*m_bglyph++); + yf = (yc = *m_bglyph++) & 0x80; + yc <<= 1; + yc >>= 1; + dy = int(yc); + m_x += double(dx) * m_w; + m_y += double(dy) * m_h; + *x = m_x; + *y = m_y; + return yf ? path_cmd_move_to : path_cmd_line_to; } - return path_cmd_stop; - } - //------------------------------------------------------------------------- - double gsv_text::text_width() - { - double x1, y1, x2, y2; - bounding_rect_single(*this, 0, &x1, &y1, &x2, &y2); - return x2 - x1; } + return path_cmd_stop; +} + +//------------------------------------------------------------------------- +double gsv_text::text_width() +{ + double x1, y1, x2, y2; + bounding_rect_single(*this, 0, &x1, &y1, &x2, &y2); + return x2 - x1; +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_image_filters.cpp mapnik-2.2.0/deps/agg/src/agg_image_filters.cpp --- mapnik-2.1.0/deps/agg/src/agg_image_filters.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_image_filters.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,80 +23,80 @@ namespace agg { - //-------------------------------------------------------------------- - void image_filter_lut::realloc_lut(double radius) +//-------------------------------------------------------------------- +void image_filter_lut::realloc_lut(double radius) +{ + m_radius = radius; + m_diameter = uceil(radius) * 2; + m_start = -int(m_diameter / 2 - 1); + unsigned size = m_diameter << image_subpixel_shift; + if(size > m_weight_array.size()) { - m_radius = radius; - m_diameter = uceil(radius) * 2; - m_start = -int(m_diameter / 2 - 1); - unsigned size = m_diameter << image_subpixel_shift; - if(size > m_weight_array.size()) - { - m_weight_array.resize(size); - } + m_weight_array.resize(size); } +} - //-------------------------------------------------------------------- - // This function normalizes integer values and corrects the rounding - // errors. It doesn't do anything with the source floating point values - // (m_weight_array_dbl), it corrects only integers according to the rule - // of 1.0 which means that any sum of pixel weights must be equal to 1.0. - // So, the filter function must produce a graph of the proper shape. - //-------------------------------------------------------------------- - void image_filter_lut::normalize() - { - unsigned i; - int flip = 1; +//-------------------------------------------------------------------- +// This function normalizes integer values and corrects the rounding +// errors. It doesn't do anything with the source floating point values +// (m_weight_array_dbl), it corrects only integers according to the rule +// of 1.0 which means that any sum of pixel weights must be equal to 1.0. +// So, the filter function must produce a graph of the proper shape. +//-------------------------------------------------------------------- +void image_filter_lut::normalize() +{ + unsigned i; + int flip = 1; - for(i = 0; i < image_subpixel_scale; i++) + for(i = 0; i < image_subpixel_scale; i++) + { + for(;;) { - for(;;) + int sum = 0; + unsigned j; + for(j = 0; j < m_diameter; j++) { - int sum = 0; - unsigned j; - for(j = 0; j < m_diameter; j++) - { - sum += m_weight_array[j * image_subpixel_scale + i]; - } + sum += m_weight_array[j * image_subpixel_scale + i]; + } - if(sum == image_filter_scale) break; + if(sum == image_filter_scale) break; - double k = double(image_filter_scale) / double(sum); - sum = 0; - for(j = 0; j < m_diameter; j++) - { - sum += m_weight_array[j * image_subpixel_scale + i] = - iround(m_weight_array[j * image_subpixel_scale + i] * k); - } + double k = double(image_filter_scale) / double(sum); + sum = 0; + for(j = 0; j < m_diameter; j++) + { + sum += m_weight_array[j * image_subpixel_scale + i] = + iround(m_weight_array[j * image_subpixel_scale + i] * k); + } - sum -= image_filter_scale; - int inc = (sum > 0) ? -1 : 1; + sum -= image_filter_scale; + int inc = (sum > 0) ? -1 : 1; - for(j = 0; j < m_diameter && sum; j++) + for(j = 0; j < m_diameter && sum; j++) + { + flip ^= 1; + unsigned idx = flip ? m_diameter/2 + j/2 : m_diameter/2 - j/2; + int v = m_weight_array[idx * image_subpixel_scale + i]; + if(v < image_filter_scale) { - flip ^= 1; - unsigned idx = flip ? m_diameter/2 + j/2 : m_diameter/2 - j/2; - int v = m_weight_array[idx * image_subpixel_scale + i]; - if(v < image_filter_scale) - { - m_weight_array[idx * image_subpixel_scale + i] += inc; - sum += inc; - } + m_weight_array[idx * image_subpixel_scale + i] += inc; + sum += inc; } } } + } - unsigned pivot = m_diameter << (image_subpixel_shift - 1); + unsigned pivot = m_diameter << (image_subpixel_shift - 1); - for(i = 0; i < pivot; i++) - { - m_weight_array[pivot + i] = m_weight_array[pivot - i]; - } - unsigned end = (diameter() << image_subpixel_shift) - 1; - m_weight_array[0] = m_weight_array[end]; + for(i = 0; i < pivot; i++) + { + m_weight_array[pivot + i] = m_weight_array[pivot - i]; } + unsigned end = (diameter() << image_subpixel_shift) - 1; + m_weight_array[0] = m_weight_array[end]; +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_line_aa_basics.cpp mapnik-2.2.0/deps/agg/src/agg_line_aa_basics.cpp --- mapnik-2.1.0/deps/agg/src/agg_line_aa_basics.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_line_aa_basics.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,65 +18,65 @@ namespace agg { - //------------------------------------------------------------------------- - // The number of the octant is determined as a 3-bit value as follows: - // bit 0 = vertical flag - // bit 1 = sx < 0 - // bit 2 = sy < 0 - // - // [N] shows the number of the orthogonal quadrant - // shows the number of the diagonal quadrant - // <1> - // [1] | [0] - // . (3)011 | 001(1) . - // . | . - // . | . - // . | . - // (2)010 .|. 000(0) - // <2> ----------.+.----------- <0> - // (6)110 . | . 100(4) - // . | . - // . | . - // . | . - // (7)111 | 101(5) - // [2] | [3] - // <3> - // 0,1,2,3,4,5,6,7 - const int8u line_parameters::s_orthogonal_quadrant[8] = { 0,0,1,1,3,3,2,2 }; - const int8u line_parameters::s_diagonal_quadrant[8] = { 0,1,2,1,0,3,2,3 }; +//------------------------------------------------------------------------- +// The number of the octant is determined as a 3-bit value as follows: +// bit 0 = vertical flag +// bit 1 = sx < 0 +// bit 2 = sy < 0 +// +// [N] shows the number of the orthogonal quadrant +// shows the number of the diagonal quadrant +// <1> +// [1] | [0] +// . (3)011 | 001(1) . +// . | . +// . | . +// . | . +// (2)010 .|. 000(0) +// <2> ----------.+.----------- <0> +// (6)110 . | . 100(4) +// . | . +// . | . +// . | . +// (7)111 | 101(5) +// [2] | [3] +// <3> +// 0,1,2,3,4,5,6,7 +const int8u line_parameters::s_orthogonal_quadrant[8] = { 0,0,1,1,3,3,2,2 }; +const int8u line_parameters::s_diagonal_quadrant[8] = { 0,1,2,1,0,3,2,3 }; + +//------------------------------------------------------------------------- +void bisectrix(const line_parameters& l1, + const line_parameters& l2, + int* x, int* y) +{ + double k = double(l2.len) / double(l1.len); + double tx = l2.x2 - (l2.x1 - l1.x1) * k; + double ty = l2.y2 - (l2.y1 - l1.y1) * k; + + //All bisectrices must be on the right of the line + //If the next point is on the left (l1 => l2.2) + //then the bisectix should be rotated by 180 degrees. + if(double(l2.x2 - l2.x1) * double(l2.y1 - l1.y1) < + double(l2.y2 - l2.y1) * double(l2.x1 - l1.x1) + 100.0) + { + tx -= (tx - l2.x1) * 2.0; + ty -= (ty - l2.y1) * 2.0; + } - //------------------------------------------------------------------------- - void bisectrix(const line_parameters& l1, - const line_parameters& l2, - int* x, int* y) + // Check if the bisectrix is too short + double dx = tx - l2.x1; + double dy = ty - l2.y1; + if((int)sqrt(dx * dx + dy * dy) < line_subpixel_scale) { - double k = double(l2.len) / double(l1.len); - double tx = l2.x2 - (l2.x1 - l1.x1) * k; - double ty = l2.y2 - (l2.y1 - l1.y1) * k; - - //All bisectrices must be on the right of the line - //If the next point is on the left (l1 => l2.2) - //then the bisectix should be rotated by 180 degrees. - if(double(l2.x2 - l2.x1) * double(l2.y1 - l1.y1) < - double(l2.y2 - l2.y1) * double(l2.x1 - l1.x1) + 100.0) - { - tx -= (tx - l2.x1) * 2.0; - ty -= (ty - l2.y1) * 2.0; - } - - // Check if the bisectrix is too short - double dx = tx - l2.x1; - double dy = ty - l2.y1; - if((int)sqrt(dx * dx + dy * dy) < line_subpixel_scale) - { - *x = (l2.x1 + l2.x1 + (l2.y1 - l1.y1) + (l2.y2 - l2.y1)) >> 1; - *y = (l2.y1 + l2.y1 - (l2.x1 - l1.x1) - (l2.x2 - l2.x1)) >> 1; - return; - } - *x = iround(tx); - *y = iround(ty); + *x = (l2.x1 + l2.x1 + (l2.y1 - l1.y1) + (l2.y2 - l2.y1)) >> 1; + *y = (l2.y1 + l2.y1 - (l2.x1 - l1.x1) - (l2.x2 - l2.x1)) >> 1; + return; } + *x = iround(tx); + *y = iround(ty); +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_line_profile_aa.cpp mapnik-2.2.0/deps/agg/src/agg_line_profile_aa.cpp --- mapnik-2.1.0/deps/agg/src/agg_line_profile_aa.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_line_profile_aa.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,98 +18,98 @@ namespace agg { - //--------------------------------------------------------------------- - void line_profile_aa::width(double w) +//--------------------------------------------------------------------- +void line_profile_aa::width(double w) +{ + if(w < 0.0) w = 0.0; + + if(w < m_smoother_width) w += w; + else w += m_smoother_width; + + w *= 0.5; + + w -= m_smoother_width; + double s = m_smoother_width; + if(w < 0.0) { - if(w < 0.0) w = 0.0; + s += w; + w = 0.0; + } + set(w, s); +} - if(w < m_smoother_width) w += w; - else w += m_smoother_width; - w *= 0.5; - - w -= m_smoother_width; - double s = m_smoother_width; - if(w < 0.0) - { - s += w; - w = 0.0; - } - set(w, s); - } - - - //--------------------------------------------------------------------- - line_profile_aa::value_type* line_profile_aa::profile(double w) - { - m_subpixel_width = uround(w * subpixel_scale); - unsigned size = m_subpixel_width + subpixel_scale * 6; - if(size > m_profile.size()) - { - m_profile.resize(size); - } - return &m_profile[0]; - } - - - //--------------------------------------------------------------------- - void line_profile_aa::set(double center_width, double smoother_width) - { - double base_val = 1.0; - if(center_width == 0.0) center_width = 1.0 / subpixel_scale; - if(smoother_width == 0.0) smoother_width = 1.0 / subpixel_scale; - - double width = center_width + smoother_width; - if(width < m_min_width) - { - double k = width / m_min_width; - base_val *= k; - center_width /= k; - smoother_width /= k; - } - - value_type* ch = profile(center_width + smoother_width); - - unsigned subpixel_center_width = unsigned(center_width * subpixel_scale); - unsigned subpixel_smoother_width = unsigned(smoother_width * subpixel_scale); - - value_type* ch_center = ch + subpixel_scale*2; - value_type* ch_smoother = ch_center + subpixel_center_width; - - unsigned i; - - unsigned val = m_gamma[unsigned(base_val * aa_mask)]; - ch = ch_center; - for(i = 0; i < subpixel_center_width; i++) - { - *ch++ = (value_type)val; - } - - for(i = 0; i < subpixel_smoother_width; i++) - { - *ch_smoother++ = - m_gamma[unsigned((base_val - - base_val * - (double(i) / subpixel_smoother_width)) * aa_mask)]; - } - - unsigned n_smoother = profile_size() - - subpixel_smoother_width - - subpixel_center_width - - subpixel_scale*2; - - val = m_gamma[0]; - for(i = 0; i < n_smoother; i++) - { - *ch_smoother++ = (value_type)val; - } - - ch = ch_center; - for(i = 0; i < subpixel_scale*2; i++) - { - *--ch = *ch_center++; - } +//--------------------------------------------------------------------- +line_profile_aa::value_type* line_profile_aa::profile(double w) +{ + m_subpixel_width = uround(w * subpixel_scale); + unsigned size = m_subpixel_width + subpixel_scale * 6; + if(size > m_profile.size()) + { + m_profile.resize(size); } + return &m_profile[0]; +} + + +//--------------------------------------------------------------------- +void line_profile_aa::set(double center_width, double smoother_width) +{ + double base_val = 1.0; + if(center_width == 0.0) center_width = 1.0 / subpixel_scale; + if(smoother_width == 0.0) smoother_width = 1.0 / subpixel_scale; + + double width = center_width + smoother_width; + if(width < m_min_width) + { + double k = width / m_min_width; + base_val *= k; + center_width /= k; + smoother_width /= k; + } + + value_type* ch = profile(center_width + smoother_width); + + unsigned subpixel_center_width = unsigned(center_width * subpixel_scale); + unsigned subpixel_smoother_width = unsigned(smoother_width * subpixel_scale); + + value_type* ch_center = ch + subpixel_scale*2; + value_type* ch_smoother = ch_center + subpixel_center_width; + + unsigned i; + + unsigned val = m_gamma[unsigned(base_val * aa_mask)]; + ch = ch_center; + for(i = 0; i < subpixel_center_width; i++) + { + *ch++ = (value_type)val; + } + + for(i = 0; i < subpixel_smoother_width; i++) + { + *ch_smoother++ = + m_gamma[unsigned((base_val - + base_val * + (double(i) / subpixel_smoother_width)) * aa_mask)]; + } + + unsigned n_smoother = profile_size() - + subpixel_smoother_width - + subpixel_center_width - + subpixel_scale*2; + + val = m_gamma[0]; + for(i = 0; i < n_smoother; i++) + { + *ch_smoother++ = (value_type)val; + } + + ch = ch_center; + for(i = 0; i < subpixel_scale*2; i++) + { + *--ch = *ch_center++; + } +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_pixfmt_rgba.cpp mapnik-2.2.0/deps/agg/src/agg_pixfmt_rgba.cpp --- mapnik-2.1.0/deps/agg/src/agg_pixfmt_rgba.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_pixfmt_rgba.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,147 @@ +#include "agg_pixfmt_rgba.h" +#include +#include +//#include + +namespace agg +{ + + +template +void comp_op_rgba_hue::blend_pix(value_type* p, + unsigned sr, unsigned sg, unsigned sb, + unsigned sa, unsigned cover) +{ + if (cover < 255) + { + sr = (sr * cover + 255) >> 8; + sg = (sg * cover + 255) >> 8; + sb = (sb * cover + 255) >> 8; + sa = (sa * cover + 255) >> 8; + } + + if (sa > 0) + { + using namespace boost; + using namespace gil; + using namespace hsv_color_space; + rgb8_pixel_t rgb_src(sr,sg,sb); + rgb8_pixel_t rgb_dst(p[Order::R],p[Order::G],p[Order::B]); + hsv32f_pixel_t hsv_src,hsv_dst; + color_convert(rgb_src, hsv_src); + color_convert(rgb_dst, hsv_dst); + get_color(hsv_dst,hue_t()) = get_color(hsv_src,hue_t()); + color_convert(hsv_dst, rgb_dst); + p[Order::R] = get_color(rgb_dst,red_t()); + p[Order::G] = get_color(rgb_dst,green_t()); + p[Order::B] = get_color(rgb_dst,blue_t()); + p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift)); + } +} + +template +void comp_op_rgba_saturation::blend_pix(value_type* p, + unsigned sr, unsigned sg, unsigned sb, + unsigned sa, unsigned cover) +{ + if (cover < 255) + { + sr = (sr * cover + 255) >> 8; + sg = (sg * cover + 255) >> 8; + sb = (sb * cover + 255) >> 8; + sa = (sa * cover + 255) >> 8; + } + + if (sa > 0) + { + using namespace boost; + using namespace gil; + using namespace hsv_color_space; + rgb8_pixel_t rgb_src(sr,sg,sb); + rgb8_pixel_t rgb_dst(p[Order::R],p[Order::G],p[Order::B]); + hsv32f_pixel_t hsv_src,hsv_dst; + color_convert( rgb_src, hsv_src); + color_convert( rgb_dst, hsv_dst); + get_color(hsv_dst,saturation_t()) = get_color(hsv_src,saturation_t()); + color_convert(hsv_dst, rgb_dst); + p[Order::R] = get_color(rgb_dst,red_t()); + p[Order::G] = get_color(rgb_dst,green_t()); + p[Order::B] = get_color(rgb_dst,blue_t()); + p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift)); + } +} + +template +void comp_op_rgba_color::blend_pix(value_type* p, + unsigned sr, unsigned sg, unsigned sb, + unsigned sa, unsigned cover) +{ + if (cover < 255) + { + sr = (sr * cover + 255) >> 8; + sg = (sg * cover + 255) >> 8; + sb = (sb * cover + 255) >> 8; + sa = (sa * cover + 255) >> 8; + } + + if (sa > 0) + { + using namespace boost; + using namespace gil; + using namespace hsv_color_space; + rgb8_pixel_t rgb_src(sr,sg,sb); + rgb8_pixel_t rgb_dst(p[Order::R],p[Order::G],p[Order::B]); + hsv32f_pixel_t hsv_src,hsv_dst; + color_convert( rgb_src, hsv_src); + color_convert( rgb_dst, hsv_dst); + get_color(hsv_dst,hue_t()) = get_color(hsv_src,hue_t()); + get_color(hsv_dst,saturation_t()) = get_color(hsv_src,saturation_t()); + color_convert(hsv_dst, rgb_dst); + p[Order::R] = get_color(rgb_dst,red_t()); + p[Order::G] = get_color(rgb_dst,green_t()); + p[Order::B] = get_color(rgb_dst,blue_t()); + p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift)); + } +} + +template +void comp_op_rgba_value::blend_pix(value_type* p, + unsigned sr, unsigned sg, unsigned sb, + unsigned sa, unsigned cover) +{ + if (cover < 255) + { + sr = (sr * cover + 255) >> 8; + sg = (sg * cover + 255) >> 8; + sb = (sb * cover + 255) >> 8; + sa = (sa * cover + 255) >> 8; + } + + if (sa > 0) + { + using namespace boost; + using namespace gil; + using namespace hsv_color_space; + rgb8_pixel_t rgb_src(sr,sg,sb); + rgb8_pixel_t rgb_dst(p[Order::R],p[Order::G],p[Order::B]); + hsv32f_pixel_t hsv_src,hsv_dst; + color_convert( rgb_src, hsv_src); + color_convert( rgb_dst, hsv_dst); + get_color(hsv_dst,value_t()) = get_color(hsv_src,value_t()); + color_convert(hsv_dst, rgb_dst); + p[Order::R] = get_color(rgb_dst,red_t()); + p[Order::G] = get_color(rgb_dst,green_t()); + p[Order::B] = get_color(rgb_dst,blue_t()); + p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift)); + } +} + + +template struct comp_op_rgba_hue; +template struct comp_op_rgba_saturation; +template struct comp_op_rgba_color; +template struct comp_op_rgba_value; + + + +} diff -Nru mapnik-2.1.0/deps/agg/src/agg_rounded_rect.cpp mapnik-2.2.0/deps/agg/src/agg_rounded_rect.cpp --- mapnik-2.1.0/deps/agg/src/agg_rounded_rect.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_rounded_rect.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,141 +23,141 @@ namespace agg { - //------------------------------------------------------------------------ - rounded_rect::rounded_rect(double x1, double y1, double x2, double y2, double r) : - m_x1(x1), m_y1(y1), m_x2(x2), m_y2(y2), - m_rx1(r), m_ry1(r), m_rx2(r), m_ry2(r), - m_rx3(r), m_ry3(r), m_rx4(r), m_ry4(r) - { - if(x1 > x2) { m_x1 = x2; m_x2 = x1; } - if(y1 > y2) { m_y1 = y2; m_y2 = y1; } - } +//------------------------------------------------------------------------ +rounded_rect::rounded_rect(double x1, double y1, double x2, double y2, double r) : + m_x1(x1), m_y1(y1), m_x2(x2), m_y2(y2), + m_rx1(r), m_ry1(r), m_rx2(r), m_ry2(r), + m_rx3(r), m_ry3(r), m_rx4(r), m_ry4(r) +{ + if(x1 > x2) { m_x1 = x2; m_x2 = x1; } + if(y1 > y2) { m_y1 = y2; m_y2 = y1; } +} - //-------------------------------------------------------------------- - void rounded_rect::rect(double x1, double y1, double x2, double y2) - { - m_x1 = x1; - m_y1 = y1; - m_x2 = x2; - m_y2 = y2; - if(x1 > x2) { m_x1 = x2; m_x2 = x1; } - if(y1 > y2) { m_y1 = y2; m_y2 = y1; } - } +//-------------------------------------------------------------------- +void rounded_rect::rect(double x1, double y1, double x2, double y2) +{ + m_x1 = x1; + m_y1 = y1; + m_x2 = x2; + m_y2 = y2; + if(x1 > x2) { m_x1 = x2; m_x2 = x1; } + if(y1 > y2) { m_y1 = y2; m_y2 = y1; } +} - //-------------------------------------------------------------------- - void rounded_rect::radius(double r) - { - m_rx1 = m_ry1 = m_rx2 = m_ry2 = m_rx3 = m_ry3 = m_rx4 = m_ry4 = r; - } +//-------------------------------------------------------------------- +void rounded_rect::radius(double r) +{ + m_rx1 = m_ry1 = m_rx2 = m_ry2 = m_rx3 = m_ry3 = m_rx4 = m_ry4 = r; +} - //-------------------------------------------------------------------- - void rounded_rect::radius(double rx, double ry) - { - m_rx1 = m_rx2 = m_rx3 = m_rx4 = rx; - m_ry1 = m_ry2 = m_ry3 = m_ry4 = ry; - } +//-------------------------------------------------------------------- +void rounded_rect::radius(double rx, double ry) +{ + m_rx1 = m_rx2 = m_rx3 = m_rx4 = rx; + m_ry1 = m_ry2 = m_ry3 = m_ry4 = ry; +} - //-------------------------------------------------------------------- - void rounded_rect::radius(double rx_bottom, double ry_bottom, - double rx_top, double ry_top) - { - m_rx1 = m_rx2 = rx_bottom; - m_rx3 = m_rx4 = rx_top; - m_ry1 = m_ry2 = ry_bottom; - m_ry3 = m_ry4 = ry_top; - } +//-------------------------------------------------------------------- +void rounded_rect::radius(double rx_bottom, double ry_bottom, + double rx_top, double ry_top) +{ + m_rx1 = m_rx2 = rx_bottom; + m_rx3 = m_rx4 = rx_top; + m_ry1 = m_ry2 = ry_bottom; + m_ry3 = m_ry4 = ry_top; +} - //-------------------------------------------------------------------- - void rounded_rect::radius(double rx1, double ry1, double rx2, double ry2, - double rx3, double ry3, double rx4, double ry4) - { - m_rx1 = rx1; m_ry1 = ry1; m_rx2 = rx2; m_ry2 = ry2; - m_rx3 = rx3; m_ry3 = ry3; m_rx4 = rx4; m_ry4 = ry4; - } +//-------------------------------------------------------------------- +void rounded_rect::radius(double rx1, double ry1, double rx2, double ry2, + double rx3, double ry3, double rx4, double ry4) +{ + m_rx1 = rx1; m_ry1 = ry1; m_rx2 = rx2; m_ry2 = ry2; + m_rx3 = rx3; m_ry3 = ry3; m_rx4 = rx4; m_ry4 = ry4; +} - //-------------------------------------------------------------------- - void rounded_rect::normalize_radius() - { - double dx = fabs(m_x2 - m_x1); - double dy = fabs(m_y2 - m_y1); +//-------------------------------------------------------------------- +void rounded_rect::normalize_radius() +{ + double dx = fabs(m_x2 - m_x1); + double dy = fabs(m_y2 - m_y1); - double k = 1.0; - double t; - t = dx / (m_rx1 + m_rx2); if(t < k) k = t; - t = dx / (m_rx3 + m_rx4); if(t < k) k = t; - t = dy / (m_ry1 + m_ry2); if(t < k) k = t; - t = dy / (m_ry3 + m_ry4); if(t < k) k = t; - - if(k < 1.0) - { - m_rx1 *= k; m_ry1 *= k; m_rx2 *= k; m_ry2 *= k; - m_rx3 *= k; m_ry3 *= k; m_rx4 *= k; m_ry4 *= k; - } - } + double k = 1.0; + double t; + t = dx / (m_rx1 + m_rx2); if(t < k) k = t; + t = dx / (m_rx3 + m_rx4); if(t < k) k = t; + t = dy / (m_ry1 + m_ry2); if(t < k) k = t; + t = dy / (m_ry3 + m_ry4); if(t < k) k = t; - //-------------------------------------------------------------------- - void rounded_rect::rewind(unsigned) + if(k < 1.0) { - m_status = 0; + m_rx1 *= k; m_ry1 *= k; m_rx2 *= k; m_ry2 *= k; + m_rx3 *= k; m_ry3 *= k; m_rx4 *= k; m_ry4 *= k; } +} + +//-------------------------------------------------------------------- +void rounded_rect::rewind(unsigned) +{ + m_status = 0; +} - //-------------------------------------------------------------------- - unsigned rounded_rect::vertex(double* x, double* y) +//-------------------------------------------------------------------- +unsigned rounded_rect::vertex(double* x, double* y) +{ + unsigned cmd = path_cmd_stop; + switch(m_status) { - unsigned cmd = path_cmd_stop; - switch(m_status) - { - case 0: - m_arc.init(m_x1 + m_rx1, m_y1 + m_ry1, m_rx1, m_ry1, - pi, pi+pi*0.5); - m_arc.rewind(0); - m_status++; - - case 1: - cmd = m_arc.vertex(x, y); - if(is_stop(cmd)) m_status++; - else return cmd; - - case 2: - m_arc.init(m_x2 - m_rx2, m_y1 + m_ry2, m_rx2, m_ry2, - pi+pi*0.5, 0.0); - m_arc.rewind(0); - m_status++; - - case 3: - cmd = m_arc.vertex(x, y); - if(is_stop(cmd)) m_status++; - else return path_cmd_line_to; - - case 4: - m_arc.init(m_x2 - m_rx3, m_y2 - m_ry3, m_rx3, m_ry3, - 0.0, pi*0.5); - m_arc.rewind(0); - m_status++; - - case 5: - cmd = m_arc.vertex(x, y); - if(is_stop(cmd)) m_status++; - else return path_cmd_line_to; - - case 6: - m_arc.init(m_x1 + m_rx4, m_y2 - m_ry4, m_rx4, m_ry4, - pi*0.5, pi); - m_arc.rewind(0); - m_status++; - - case 7: - cmd = m_arc.vertex(x, y); - if(is_stop(cmd)) m_status++; - else return path_cmd_line_to; - - case 8: - cmd = path_cmd_end_poly | path_flags_close | path_flags_ccw; - m_status++; - break; - } - return cmd; + case 0: + m_arc.init(m_x1 + m_rx1, m_y1 + m_ry1, m_rx1, m_ry1, + pi, pi+pi*0.5); + m_arc.rewind(0); + m_status++; + + case 1: + cmd = m_arc.vertex(x, y); + if(is_stop(cmd)) m_status++; + else return cmd; + + case 2: + m_arc.init(m_x2 - m_rx2, m_y1 + m_ry2, m_rx2, m_ry2, + pi+pi*0.5, 0.0); + m_arc.rewind(0); + m_status++; + + case 3: + cmd = m_arc.vertex(x, y); + if(is_stop(cmd)) m_status++; + else return path_cmd_line_to; + + case 4: + m_arc.init(m_x2 - m_rx3, m_y2 - m_ry3, m_rx3, m_ry3, + 0.0, pi*0.5); + m_arc.rewind(0); + m_status++; + + case 5: + cmd = m_arc.vertex(x, y); + if(is_stop(cmd)) m_status++; + else return path_cmd_line_to; + + case 6: + m_arc.init(m_x1 + m_rx4, m_y2 - m_ry4, m_rx4, m_ry4, + pi*0.5, pi); + m_arc.rewind(0); + m_status++; + + case 7: + cmd = m_arc.vertex(x, y); + if(is_stop(cmd)) m_status++; + else return path_cmd_line_to; + + case 8: + cmd = path_cmd_end_poly | path_flags_close | path_flags_ccw; + m_status++; + break; } + return cmd; +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_sqrt_tables.cpp mapnik-2.2.0/deps/agg/src/agg_sqrt_tables.cpp --- mapnik-2.1.0/deps/agg/src/agg_sqrt_tables.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_sqrt_tables.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -21,95 +21,95 @@ namespace agg { - int16u g_sqrt_table[1024] = //----------g_sqrt_table - { - 0, - 2048,2896,3547,4096,4579,5017,5418,5793,6144,6476,6792,7094,7384,7663,7932,8192,8444, - 8689,8927,9159,9385,9606,9822,10033,10240,10443,10642,10837,11029,11217,11403,11585, - 11765,11942,12116,12288,12457,12625,12790,12953,13114,13273,13430,13585,13738,13890, - 14040,14189,14336,14482,14626,14768,14910,15050,15188,15326,15462,15597,15731,15864, - 15995,16126,16255,16384,16512,16638,16764,16888,17012,17135,17257,17378,17498,17618, - 17736,17854,17971,18087,18203,18318,18432,18545,18658,18770,18882,18992,19102,19212, - 19321,19429,19537,19644,19750,19856,19961,20066,20170,20274,20377,20480,20582,20684, - 20785,20886,20986,21085,21185,21283,21382,21480,21577,21674,21771,21867,21962,22058, - 22153,22247,22341,22435,22528,22621,22713,22806,22897,22989,23080,23170,23261,23351, - 23440,23530,23619,23707,23796,23884,23971,24059,24146,24232,24319,24405,24491,24576, - 24661,24746,24831,24915,24999,25083,25166,25249,25332,25415,25497,25580,25661,25743, - 25824,25905,25986,26067,26147,26227,26307,26387,26466,26545,26624,26703,26781,26859, - 26937,27015,27092,27170,27247,27324,27400,27477,27553,27629,27705,27780,27856,27931, - 28006,28081,28155,28230,28304,28378,28452,28525,28599,28672,28745,28818,28891,28963, - 29035,29108,29180,29251,29323,29394,29466,29537,29608,29678,29749,29819,29890,29960, - 30030,30099,30169,30238,30308,30377,30446,30515,30583,30652,30720,30788,30856,30924, - 30992,31059,31127,31194,31261,31328,31395,31462,31529,31595,31661,31727,31794,31859, - 31925,31991,32056,32122,32187,32252,32317,32382,32446,32511,32575,32640,32704,32768, - 32832,32896,32959,33023,33086,33150,33213,33276,33339,33402,33465,33527,33590,33652, - 33714,33776,33839,33900,33962,34024,34086,34147,34208,34270,34331,34392,34453,34514, - 34574,34635,34695,34756,34816,34876,34936,34996,35056,35116,35176,35235,35295,35354, - 35413,35472,35531,35590,35649,35708,35767,35825,35884,35942,36001,36059,36117,36175, - 36233,36291,36348,36406,36464,36521,36578,36636,36693,36750,36807,36864,36921,36978, - 37034,37091,37147,37204,37260,37316,37372,37429,37485,37540,37596,37652,37708,37763, - 37819,37874,37929,37985,38040,38095,38150,38205,38260,38315,38369,38424,38478,38533, - 38587,38642,38696,38750,38804,38858,38912,38966,39020,39073,39127,39181,39234,39287, - 39341,39394,39447,39500,39553,39606,39659,39712,39765,39818,39870,39923,39975,40028, - 40080,40132,40185,40237,40289,40341,40393,40445,40497,40548,40600,40652,40703,40755, - 40806,40857,40909,40960,41011,41062,41113,41164,41215,41266,41317,41368,41418,41469, - 41519,41570,41620,41671,41721,41771,41821,41871,41922,41972,42021,42071,42121,42171, - 42221,42270,42320,42369,42419,42468,42518,42567,42616,42665,42714,42763,42813,42861, - 42910,42959,43008,43057,43105,43154,43203,43251,43300,43348,43396,43445,43493,43541, - 43589,43637,43685,43733,43781,43829,43877,43925,43972,44020,44068,44115,44163,44210, - 44258,44305,44352,44400,44447,44494,44541,44588,44635,44682,44729,44776,44823,44869, - 44916,44963,45009,45056,45103,45149,45195,45242,45288,45334,45381,45427,45473,45519, - 45565,45611,45657,45703,45749,45795,45840,45886,45932,45977,46023,46069,46114,46160, - 46205,46250,46296,46341,46386,46431,46477,46522,46567,46612,46657,46702,46746,46791, - 46836,46881,46926,46970,47015,47059,47104,47149,47193,47237,47282,47326,47370,47415, - 47459,47503,47547,47591,47635,47679,47723,47767,47811,47855,47899,47942,47986,48030, - 48074,48117,48161,48204,48248,48291,48335,48378,48421,48465,48508,48551,48594,48637, - 48680,48723,48766,48809,48852,48895,48938,48981,49024,49067,49109,49152,49195,49237, - 49280,49322,49365,49407,49450,49492,49535,49577,49619,49661,49704,49746,49788,49830, - 49872,49914,49956,49998,50040,50082,50124,50166,50207,50249,50291,50332,50374,50416, - 50457,50499,50540,50582,50623,50665,50706,50747,50789,50830,50871,50912,50954,50995, - 51036,51077,51118,51159,51200,51241,51282,51323,51364,51404,51445,51486,51527,51567, - 51608,51649,51689,51730,51770,51811,51851,51892,51932,51972,52013,52053,52093,52134, - 52174,52214,52254,52294,52334,52374,52414,52454,52494,52534,52574,52614,52654,52694, - 52734,52773,52813,52853,52892,52932,52972,53011,53051,53090,53130,53169,53209,53248, - 53287,53327,53366,53405,53445,53484,53523,53562,53601,53640,53679,53719,53758,53797, - 53836,53874,53913,53952,53991,54030,54069,54108,54146,54185,54224,54262,54301,54340, - 54378,54417,54455,54494,54532,54571,54609,54647,54686,54724,54762,54801,54839,54877, - 54915,54954,54992,55030,55068,55106,55144,55182,55220,55258,55296,55334,55372,55410, - 55447,55485,55523,55561,55599,55636,55674,55712,55749,55787,55824,55862,55900,55937, - 55975,56012,56049,56087,56124,56162,56199,56236,56273,56311,56348,56385,56422,56459, - 56497,56534,56571,56608,56645,56682,56719,56756,56793,56830,56867,56903,56940,56977, - 57014,57051,57087,57124,57161,57198,57234,57271,57307,57344,57381,57417,57454,57490, - 57527,57563,57599,57636,57672,57709,57745,57781,57817,57854,57890,57926,57962,57999, - 58035,58071,58107,58143,58179,58215,58251,58287,58323,58359,58395,58431,58467,58503, - 58538,58574,58610,58646,58682,58717,58753,58789,58824,58860,58896,58931,58967,59002, - 59038,59073,59109,59144,59180,59215,59251,59286,59321,59357,59392,59427,59463,59498, - 59533,59568,59603,59639,59674,59709,59744,59779,59814,59849,59884,59919,59954,59989, - 60024,60059,60094,60129,60164,60199,60233,60268,60303,60338,60373,60407,60442,60477, - 60511,60546,60581,60615,60650,60684,60719,60753,60788,60822,60857,60891,60926,60960, - 60995,61029,61063,61098,61132,61166,61201,61235,61269,61303,61338,61372,61406,61440, - 61474,61508,61542,61576,61610,61644,61678,61712,61746,61780,61814,61848,61882,61916, - 61950,61984,62018,62051,62085,62119,62153,62186,62220,62254,62287,62321,62355,62388, - 62422,62456,62489,62523,62556,62590,62623,62657,62690,62724,62757,62790,62824,62857, - 62891,62924,62957,62991,63024,63057,63090,63124,63157,63190,63223,63256,63289,63323, - 63356,63389,63422,63455,63488,63521,63554,63587,63620,63653,63686,63719,63752,63785, - 63817,63850,63883,63916,63949,63982,64014,64047,64080,64113,64145,64178,64211,64243, - 64276,64309,64341,64374,64406,64439,64471,64504,64536,64569,64601,64634,64666,64699, - 64731,64763,64796,64828,64861,64893,64925,64957,64990,65022,65054,65086,65119,65151, - 65183,65215,65247,65279,65312,65344,65376,65408,65440,65472,65504 - }; +int16u g_sqrt_table[1024] = //----------g_sqrt_table +{ + 0, + 2048,2896,3547,4096,4579,5017,5418,5793,6144,6476,6792,7094,7384,7663,7932,8192,8444, + 8689,8927,9159,9385,9606,9822,10033,10240,10443,10642,10837,11029,11217,11403,11585, + 11765,11942,12116,12288,12457,12625,12790,12953,13114,13273,13430,13585,13738,13890, + 14040,14189,14336,14482,14626,14768,14910,15050,15188,15326,15462,15597,15731,15864, + 15995,16126,16255,16384,16512,16638,16764,16888,17012,17135,17257,17378,17498,17618, + 17736,17854,17971,18087,18203,18318,18432,18545,18658,18770,18882,18992,19102,19212, + 19321,19429,19537,19644,19750,19856,19961,20066,20170,20274,20377,20480,20582,20684, + 20785,20886,20986,21085,21185,21283,21382,21480,21577,21674,21771,21867,21962,22058, + 22153,22247,22341,22435,22528,22621,22713,22806,22897,22989,23080,23170,23261,23351, + 23440,23530,23619,23707,23796,23884,23971,24059,24146,24232,24319,24405,24491,24576, + 24661,24746,24831,24915,24999,25083,25166,25249,25332,25415,25497,25580,25661,25743, + 25824,25905,25986,26067,26147,26227,26307,26387,26466,26545,26624,26703,26781,26859, + 26937,27015,27092,27170,27247,27324,27400,27477,27553,27629,27705,27780,27856,27931, + 28006,28081,28155,28230,28304,28378,28452,28525,28599,28672,28745,28818,28891,28963, + 29035,29108,29180,29251,29323,29394,29466,29537,29608,29678,29749,29819,29890,29960, + 30030,30099,30169,30238,30308,30377,30446,30515,30583,30652,30720,30788,30856,30924, + 30992,31059,31127,31194,31261,31328,31395,31462,31529,31595,31661,31727,31794,31859, + 31925,31991,32056,32122,32187,32252,32317,32382,32446,32511,32575,32640,32704,32768, + 32832,32896,32959,33023,33086,33150,33213,33276,33339,33402,33465,33527,33590,33652, + 33714,33776,33839,33900,33962,34024,34086,34147,34208,34270,34331,34392,34453,34514, + 34574,34635,34695,34756,34816,34876,34936,34996,35056,35116,35176,35235,35295,35354, + 35413,35472,35531,35590,35649,35708,35767,35825,35884,35942,36001,36059,36117,36175, + 36233,36291,36348,36406,36464,36521,36578,36636,36693,36750,36807,36864,36921,36978, + 37034,37091,37147,37204,37260,37316,37372,37429,37485,37540,37596,37652,37708,37763, + 37819,37874,37929,37985,38040,38095,38150,38205,38260,38315,38369,38424,38478,38533, + 38587,38642,38696,38750,38804,38858,38912,38966,39020,39073,39127,39181,39234,39287, + 39341,39394,39447,39500,39553,39606,39659,39712,39765,39818,39870,39923,39975,40028, + 40080,40132,40185,40237,40289,40341,40393,40445,40497,40548,40600,40652,40703,40755, + 40806,40857,40909,40960,41011,41062,41113,41164,41215,41266,41317,41368,41418,41469, + 41519,41570,41620,41671,41721,41771,41821,41871,41922,41972,42021,42071,42121,42171, + 42221,42270,42320,42369,42419,42468,42518,42567,42616,42665,42714,42763,42813,42861, + 42910,42959,43008,43057,43105,43154,43203,43251,43300,43348,43396,43445,43493,43541, + 43589,43637,43685,43733,43781,43829,43877,43925,43972,44020,44068,44115,44163,44210, + 44258,44305,44352,44400,44447,44494,44541,44588,44635,44682,44729,44776,44823,44869, + 44916,44963,45009,45056,45103,45149,45195,45242,45288,45334,45381,45427,45473,45519, + 45565,45611,45657,45703,45749,45795,45840,45886,45932,45977,46023,46069,46114,46160, + 46205,46250,46296,46341,46386,46431,46477,46522,46567,46612,46657,46702,46746,46791, + 46836,46881,46926,46970,47015,47059,47104,47149,47193,47237,47282,47326,47370,47415, + 47459,47503,47547,47591,47635,47679,47723,47767,47811,47855,47899,47942,47986,48030, + 48074,48117,48161,48204,48248,48291,48335,48378,48421,48465,48508,48551,48594,48637, + 48680,48723,48766,48809,48852,48895,48938,48981,49024,49067,49109,49152,49195,49237, + 49280,49322,49365,49407,49450,49492,49535,49577,49619,49661,49704,49746,49788,49830, + 49872,49914,49956,49998,50040,50082,50124,50166,50207,50249,50291,50332,50374,50416, + 50457,50499,50540,50582,50623,50665,50706,50747,50789,50830,50871,50912,50954,50995, + 51036,51077,51118,51159,51200,51241,51282,51323,51364,51404,51445,51486,51527,51567, + 51608,51649,51689,51730,51770,51811,51851,51892,51932,51972,52013,52053,52093,52134, + 52174,52214,52254,52294,52334,52374,52414,52454,52494,52534,52574,52614,52654,52694, + 52734,52773,52813,52853,52892,52932,52972,53011,53051,53090,53130,53169,53209,53248, + 53287,53327,53366,53405,53445,53484,53523,53562,53601,53640,53679,53719,53758,53797, + 53836,53874,53913,53952,53991,54030,54069,54108,54146,54185,54224,54262,54301,54340, + 54378,54417,54455,54494,54532,54571,54609,54647,54686,54724,54762,54801,54839,54877, + 54915,54954,54992,55030,55068,55106,55144,55182,55220,55258,55296,55334,55372,55410, + 55447,55485,55523,55561,55599,55636,55674,55712,55749,55787,55824,55862,55900,55937, + 55975,56012,56049,56087,56124,56162,56199,56236,56273,56311,56348,56385,56422,56459, + 56497,56534,56571,56608,56645,56682,56719,56756,56793,56830,56867,56903,56940,56977, + 57014,57051,57087,57124,57161,57198,57234,57271,57307,57344,57381,57417,57454,57490, + 57527,57563,57599,57636,57672,57709,57745,57781,57817,57854,57890,57926,57962,57999, + 58035,58071,58107,58143,58179,58215,58251,58287,58323,58359,58395,58431,58467,58503, + 58538,58574,58610,58646,58682,58717,58753,58789,58824,58860,58896,58931,58967,59002, + 59038,59073,59109,59144,59180,59215,59251,59286,59321,59357,59392,59427,59463,59498, + 59533,59568,59603,59639,59674,59709,59744,59779,59814,59849,59884,59919,59954,59989, + 60024,60059,60094,60129,60164,60199,60233,60268,60303,60338,60373,60407,60442,60477, + 60511,60546,60581,60615,60650,60684,60719,60753,60788,60822,60857,60891,60926,60960, + 60995,61029,61063,61098,61132,61166,61201,61235,61269,61303,61338,61372,61406,61440, + 61474,61508,61542,61576,61610,61644,61678,61712,61746,61780,61814,61848,61882,61916, + 61950,61984,62018,62051,62085,62119,62153,62186,62220,62254,62287,62321,62355,62388, + 62422,62456,62489,62523,62556,62590,62623,62657,62690,62724,62757,62790,62824,62857, + 62891,62924,62957,62991,63024,63057,63090,63124,63157,63190,63223,63256,63289,63323, + 63356,63389,63422,63455,63488,63521,63554,63587,63620,63653,63686,63719,63752,63785, + 63817,63850,63883,63916,63949,63982,64014,64047,64080,64113,64145,64178,64211,64243, + 64276,64309,64341,64374,64406,64439,64471,64504,64536,64569,64601,64634,64666,64699, + 64731,64763,64796,64828,64861,64893,64925,64957,64990,65022,65054,65086,65119,65151, + 65183,65215,65247,65279,65312,65344,65376,65408,65440,65472,65504 +}; + +int8 g_elder_bit_table[256] = //---------g_elder_bit_table +{ + 0,0,1,1,2,2,2,2,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,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,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,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,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,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,7,7,7,7 +}; - int8 g_elder_bit_table[256] = //---------g_elder_bit_table - { - 0,0,1,1,2,2,2,2,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,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,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,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,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,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,7,7,7,7 - }; - } diff -Nru mapnik-2.1.0/deps/agg/src/agg_trans_affine.cpp mapnik-2.2.0/deps/agg/src/agg_trans_affine.cpp --- mapnik-2.1.0/deps/agg/src/agg_trans_affine.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_trans_affine.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -22,173 +22,173 @@ namespace agg { - const trans_affine trans_affine::identity; +const trans_affine trans_affine::identity; - //------------------------------------------------------------------------ - const trans_affine& trans_affine::parl_to_parl(const double* src, - const double* dst) - { - sx = src[2] - src[0]; - shy = src[3] - src[1]; - shx = src[4] - src[0]; - sy = src[5] - src[1]; - tx = src[0]; - ty = src[1]; - invert(); - multiply(trans_affine(dst[2] - dst[0], dst[3] - dst[1], - dst[4] - dst[0], dst[5] - dst[1], - dst[0], dst[1])); - return *this; - } - - //------------------------------------------------------------------------ - const trans_affine& trans_affine::rect_to_parl(double x1, double y1, - double x2, double y2, - const double* parl) - { - double src[6]; - src[0] = x1; src[1] = y1; - src[2] = x2; src[3] = y1; - src[4] = x2; src[5] = y2; - parl_to_parl(src, parl); - return *this; - } - - //------------------------------------------------------------------------ - const trans_affine& trans_affine::parl_to_rect(const double* parl, - double x1, double y1, - double x2, double y2) - { - double dst[6]; - dst[0] = x1; dst[1] = y1; - dst[2] = x2; dst[3] = y1; - dst[4] = x2; dst[5] = y2; - parl_to_parl(parl, dst); - return *this; - } - - //------------------------------------------------------------------------ - const trans_affine& trans_affine::multiply(const trans_affine& m) - { - double t0 = sx * m.sx + shy * m.shx; - double t2 = shx * m.sx + sy * m.shx; - double t4 = tx * m.sx + ty * m.shx + m.tx; - shy = sx * m.shy + shy * m.sy; - sy = shx * m.shy + sy * m.sy; - ty = tx * m.shy + ty * m.sy + m.ty; - sx = t0; - shx = t2; - tx = t4; - return *this; - } - - - //------------------------------------------------------------------------ - const trans_affine& trans_affine::invert() - { - double d = determinant_reciprocal(); - - double t0 = sy * d; - sy = sx * d; - shy = -shy * d; - shx = -shx * d; - - double t4 = -tx * t0 - ty * shx; - ty = -tx * shy - ty * sy; - - sx = t0; - tx = t4; - return *this; - } - - - //------------------------------------------------------------------------ - const trans_affine& trans_affine::flip_x() - { - sx = -sx; - shy = -shy; - tx = -tx; - return *this; - } - - //------------------------------------------------------------------------ - const trans_affine& trans_affine::flip_y() - { - shx = -shx; - sy = -sy; - ty = -ty; - return *this; - } - - //------------------------------------------------------------------------ - const trans_affine& trans_affine::reset() - { - sx = sy = 1.0; - shy = shx = tx = ty = 0.0; - return *this; - } - - //------------------------------------------------------------------------ - bool trans_affine::is_identity(double epsilon) const - { - return is_equal_eps(sx, 1.0, epsilon) && - is_equal_eps(shy, 0.0, epsilon) && - is_equal_eps(shx, 0.0, epsilon) && - is_equal_eps(sy, 1.0, epsilon) && - is_equal_eps(tx, 0.0, epsilon) && - is_equal_eps(ty, 0.0, epsilon); - } - - //------------------------------------------------------------------------ - bool trans_affine::is_valid(double epsilon) const - { - return fabs(sx) > epsilon && fabs(sy) > epsilon; - } - - //------------------------------------------------------------------------ - bool trans_affine::is_equal(const trans_affine& m, double epsilon) const - { - return is_equal_eps(sx, m.sx, epsilon) && - is_equal_eps(shy, m.shy, epsilon) && - is_equal_eps(shx, m.shx, epsilon) && - is_equal_eps(sy, m.sy, epsilon) && - is_equal_eps(tx, m.tx, epsilon) && - is_equal_eps(ty, m.ty, epsilon); - } - - //------------------------------------------------------------------------ - double trans_affine::rotation() const - { - double x1 = 0.0; - double y1 = 0.0; - double x2 = 1.0; - double y2 = 0.0; - transform(&x1, &y1); - transform(&x2, &y2); - return atan2(y2-y1, x2-x1); - } - - //------------------------------------------------------------------------ - void trans_affine::translation(double* dx, double* dy) const - { - *dx = tx; - *dy = ty; - } - - //------------------------------------------------------------------------ - void trans_affine::scaling(double* x, double* y) const - { - double x1 = 0.0; - double y1 = 0.0; - double x2 = 1.0; - double y2 = 1.0; - trans_affine t(*this); - t *= trans_affine_rotation(-rotation()); - t.transform(&x1, &y1); - t.transform(&x2, &y2); - *x = x2 - x1; - *y = y2 - y1; - } +//------------------------------------------------------------------------ +const trans_affine& trans_affine::parl_to_parl(const double* src, + const double* dst) +{ + sx = src[2] - src[0]; + shy = src[3] - src[1]; + shx = src[4] - src[0]; + sy = src[5] - src[1]; + tx = src[0]; + ty = src[1]; + invert(); + multiply(trans_affine(dst[2] - dst[0], dst[3] - dst[1], + dst[4] - dst[0], dst[5] - dst[1], + dst[0], dst[1])); + return *this; +} + +//------------------------------------------------------------------------ +const trans_affine& trans_affine::rect_to_parl(double x1, double y1, + double x2, double y2, + const double* parl) +{ + double src[6]; + src[0] = x1; src[1] = y1; + src[2] = x2; src[3] = y1; + src[4] = x2; src[5] = y2; + parl_to_parl(src, parl); + return *this; +} + +//------------------------------------------------------------------------ +const trans_affine& trans_affine::parl_to_rect(const double* parl, + double x1, double y1, + double x2, double y2) +{ + double dst[6]; + dst[0] = x1; dst[1] = y1; + dst[2] = x2; dst[3] = y1; + dst[4] = x2; dst[5] = y2; + parl_to_parl(parl, dst); + return *this; +} + +//------------------------------------------------------------------------ +const trans_affine& trans_affine::multiply(const trans_affine& m) +{ + double t0 = sx * m.sx + shy * m.shx; + double t2 = shx * m.sx + sy * m.shx; + double t4 = tx * m.sx + ty * m.shx + m.tx; + shy = sx * m.shy + shy * m.sy; + sy = shx * m.shy + sy * m.sy; + ty = tx * m.shy + ty * m.sy + m.ty; + sx = t0; + shx = t2; + tx = t4; + return *this; +} + + +//------------------------------------------------------------------------ +const trans_affine& trans_affine::invert() +{ + double d = determinant_reciprocal(); + + double t0 = sy * d; + sy = sx * d; + shy = -shy * d; + shx = -shx * d; + + double t4 = -tx * t0 - ty * shx; + ty = -tx * shy - ty * sy; + + sx = t0; + tx = t4; + return *this; +} + + +//------------------------------------------------------------------------ +const trans_affine& trans_affine::flip_x() +{ + sx = -sx; + shy = -shy; + tx = -tx; + return *this; +} + +//------------------------------------------------------------------------ +const trans_affine& trans_affine::flip_y() +{ + shx = -shx; + sy = -sy; + ty = -ty; + return *this; +} + +//------------------------------------------------------------------------ +const trans_affine& trans_affine::reset() +{ + sx = sy = 1.0; + shy = shx = tx = ty = 0.0; + return *this; +} + +//------------------------------------------------------------------------ +bool trans_affine::is_identity(double epsilon) const +{ + return is_equal_eps(sx, 1.0, epsilon) && + is_equal_eps(shy, 0.0, epsilon) && + is_equal_eps(shx, 0.0, epsilon) && + is_equal_eps(sy, 1.0, epsilon) && + is_equal_eps(tx, 0.0, epsilon) && + is_equal_eps(ty, 0.0, epsilon); +} + +//------------------------------------------------------------------------ +bool trans_affine::is_valid(double epsilon) const +{ + return fabs(sx) > epsilon && fabs(sy) > epsilon; +} + +//------------------------------------------------------------------------ +bool trans_affine::is_equal(const trans_affine& m, double epsilon) const +{ + return is_equal_eps(sx, m.sx, epsilon) && + is_equal_eps(shy, m.shy, epsilon) && + is_equal_eps(shx, m.shx, epsilon) && + is_equal_eps(sy, m.sy, epsilon) && + is_equal_eps(tx, m.tx, epsilon) && + is_equal_eps(ty, m.ty, epsilon); +} + +//------------------------------------------------------------------------ +double trans_affine::rotation() const +{ + double x1 = 0.0; + double y1 = 0.0; + double x2 = 1.0; + double y2 = 0.0; + transform(&x1, &y1); + transform(&x2, &y2); + return atan2(y2-y1, x2-x1); +} + +//------------------------------------------------------------------------ +void trans_affine::translation(double* dx, double* dy) const +{ + *dx = tx; + *dy = ty; +} + +//------------------------------------------------------------------------ +void trans_affine::scaling(double* x, double* y) const +{ + double x1 = 0.0; + double y1 = 0.0; + double x2 = 1.0; + double y2 = 1.0; + trans_affine t(*this); + t *= trans_affine_rotation(-rotation()); + t.transform(&x1, &y1); + t.transform(&x2, &y2); + *x = x2 - x1; + *y = y2 - y1; +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_trans_double_path.cpp mapnik-2.2.0/deps/agg/src/agg_trans_double_path.cpp --- mapnik-2.1.0/deps/agg/src/agg_trans_double_path.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_trans_double_path.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,176 +19,176 @@ namespace agg { - //------------------------------------------------------------------------ - trans_double_path::trans_double_path() : - m_base_length(0.0), - m_base_height(1.0), - m_kindex1(0.0), - m_kindex2(0.0), - m_status1(initial), - m_status2(initial), - m_preserve_x_scale(true) - { - } +//------------------------------------------------------------------------ +trans_double_path::trans_double_path() : + m_base_length(0.0), + m_base_height(1.0), + m_kindex1(0.0), + m_kindex2(0.0), + m_status1(initial), + m_status2(initial), + m_preserve_x_scale(true) +{ +} - //------------------------------------------------------------------------ - void trans_double_path::reset() - { - m_src_vertices1.remove_all(); - m_src_vertices2.remove_all(); - m_kindex1 = 0.0; - m_kindex1 = 0.0; - m_status1 = initial; - m_status2 = initial; - } +//------------------------------------------------------------------------ +void trans_double_path::reset() +{ + m_src_vertices1.remove_all(); + m_src_vertices2.remove_all(); + m_kindex1 = 0.0; + m_kindex1 = 0.0; + m_status1 = initial; + m_status2 = initial; +} - //------------------------------------------------------------------------ - void trans_double_path::move_to1(double x, double y) +//------------------------------------------------------------------------ +void trans_double_path::move_to1(double x, double y) +{ + if(m_status1 == initial) { - if(m_status1 == initial) - { - m_src_vertices1.modify_last(vertex_dist(x, y)); - m_status1 = making_path; - } - else - { - line_to1(x, y); - } + m_src_vertices1.modify_last(vertex_dist(x, y)); + m_status1 = making_path; } + else + { + line_to1(x, y); + } +} - //------------------------------------------------------------------------ - void trans_double_path::line_to1(double x, double y) +//------------------------------------------------------------------------ +void trans_double_path::line_to1(double x, double y) +{ + if(m_status1 == making_path) { - if(m_status1 == making_path) - { - m_src_vertices1.add(vertex_dist(x, y)); - } + m_src_vertices1.add(vertex_dist(x, y)); } +} - //------------------------------------------------------------------------ - void trans_double_path::move_to2(double x, double y) +//------------------------------------------------------------------------ +void trans_double_path::move_to2(double x, double y) +{ + if(m_status2 == initial) { - if(m_status2 == initial) - { - m_src_vertices2.modify_last(vertex_dist(x, y)); - m_status2 = making_path; - } - else - { - line_to2(x, y); - } + m_src_vertices2.modify_last(vertex_dist(x, y)); + m_status2 = making_path; + } + else + { + line_to2(x, y); } +} - //------------------------------------------------------------------------ - void trans_double_path::line_to2(double x, double y) +//------------------------------------------------------------------------ +void trans_double_path::line_to2(double x, double y) +{ + if(m_status2 == making_path) { - if(m_status2 == making_path) - { - m_src_vertices2.add(vertex_dist(x, y)); - } + m_src_vertices2.add(vertex_dist(x, y)); } +} - //------------------------------------------------------------------------ - double trans_double_path::finalize_path(vertex_storage& vertices) - { - unsigned i; - double dist; - double d; +//------------------------------------------------------------------------ +double trans_double_path::finalize_path(vertex_storage& vertices) +{ + unsigned i; + double dist; + double d; - vertices.close(false); - if(vertices.size() > 2) + vertices.close(false); + if(vertices.size() > 2) + { + if(vertices[vertices.size() - 2].dist * 10.0 < + vertices[vertices.size() - 3].dist) { - if(vertices[vertices.size() - 2].dist * 10.0 < - vertices[vertices.size() - 3].dist) - { - d = vertices[vertices.size() - 3].dist + - vertices[vertices.size() - 2].dist; + d = vertices[vertices.size() - 3].dist + + vertices[vertices.size() - 2].dist; - vertices[vertices.size() - 2] = - vertices[vertices.size() - 1]; + vertices[vertices.size() - 2] = + vertices[vertices.size() - 1]; - vertices.remove_last(); - vertices[vertices.size() - 2].dist = d; - } - } - - dist = 0; - for(i = 0; i < vertices.size(); i++) - { - vertex_dist& v = vertices[i]; - d = v.dist; - v.dist = dist; - dist += d; + vertices.remove_last(); + vertices[vertices.size() - 2].dist = d; } - - return (vertices.size() - 1) / dist; } - - //------------------------------------------------------------------------ - void trans_double_path::finalize_paths() + dist = 0; + for(i = 0; i < vertices.size(); i++) { - if(m_status1 == making_path && m_src_vertices1.size() > 1 && - m_status2 == making_path && m_src_vertices2.size() > 1) - { - m_kindex1 = finalize_path(m_src_vertices1); - m_kindex2 = finalize_path(m_src_vertices2); - m_status1 = ready; - m_status2 = ready; - } + vertex_dist& v = vertices[i]; + d = v.dist; + v.dist = dist; + dist += d; } + return (vertices.size() - 1) / dist; +} + - //------------------------------------------------------------------------ - double trans_double_path::total_length1() const +//------------------------------------------------------------------------ +void trans_double_path::finalize_paths() +{ + if(m_status1 == making_path && m_src_vertices1.size() > 1 && + m_status2 == making_path && m_src_vertices2.size() > 1) { - if(m_base_length >= 1e-10) return m_base_length; - return (m_status1 == ready) ? - m_src_vertices1[m_src_vertices1.size() - 1].dist : - 0.0; + m_kindex1 = finalize_path(m_src_vertices1); + m_kindex2 = finalize_path(m_src_vertices2); + m_status1 = ready; + m_status2 = ready; } +} - //------------------------------------------------------------------------ - double trans_double_path::total_length2() const - { - if(m_base_length >= 1e-10) return m_base_length; - return (m_status2 == ready) ? - m_src_vertices2[m_src_vertices2.size() - 1].dist : - 0.0; - } +//------------------------------------------------------------------------ +double trans_double_path::total_length1() const +{ + if(m_base_length >= 1e-10) return m_base_length; + return (m_status1 == ready) ? + m_src_vertices1[m_src_vertices1.size() - 1].dist : + 0.0; +} - //------------------------------------------------------------------------ - void trans_double_path::transform1(const vertex_storage& vertices, - double kindex, double kx, - double *x, double* y) const - { - double x1 = 0.0; - double y1 = 0.0; - double dx = 1.0; - double dy = 1.0; - double d = 0.0; - double dd = 1.0; - *x *= kx; - if(*x < 0.0) - { - // Extrapolation on the left - //-------------------------- - x1 = vertices[0].x; - y1 = vertices[0].y; - dx = vertices[1].x - x1; - dy = vertices[1].y - y1; - dd = vertices[1].dist - vertices[0].dist; - d = *x; - } - else +//------------------------------------------------------------------------ +double trans_double_path::total_length2() const +{ + if(m_base_length >= 1e-10) return m_base_length; + return (m_status2 == ready) ? + m_src_vertices2[m_src_vertices2.size() - 1].dist : + 0.0; +} + + +//------------------------------------------------------------------------ +void trans_double_path::transform1(const vertex_storage& vertices, + double kindex, double kx, + double *x, double* y) const +{ + double x1 = 0.0; + double y1 = 0.0; + double dx = 1.0; + double dy = 1.0; + double d = 0.0; + double dd = 1.0; + *x *= kx; + if(*x < 0.0) + { + // Extrapolation on the left + //-------------------------- + x1 = vertices[0].x; + y1 = vertices[0].y; + dx = vertices[1].x - x1; + dy = vertices[1].y - y1; + dd = vertices[1].dist - vertices[0].dist; + d = *x; + } + else if(*x > vertices[vertices.size() - 1].dist) { // Extrapolation on the right @@ -211,13 +211,13 @@ if(m_preserve_x_scale) { unsigned k; - for(i = 0; (j - i) > 1; ) + for(i = 0; (j - i) > 1; ) { - if(*x < vertices[k = (i + j) >> 1].dist) + if(*x < vertices[k = (i + j) >> 1].dist) { - j = k; + j = k; } - else + else { i = k; } @@ -238,36 +238,36 @@ dx = vertices[j].x - x1; dy = vertices[j].y - y1; } - *x = x1 + dx * d / dd; - *y = y1 + dy * d / dd; - } + *x = x1 + dx * d / dd; + *y = y1 + dy * d / dd; +} - //------------------------------------------------------------------------ - void trans_double_path::transform(double *x, double *y) const +//------------------------------------------------------------------------ +void trans_double_path::transform(double *x, double *y) const +{ + if(m_status1 == ready && m_status2 == ready) { - if(m_status1 == ready && m_status2 == ready) + if(m_base_length > 1e-10) { - if(m_base_length > 1e-10) - { - *x *= m_src_vertices1[m_src_vertices1.size() - 1].dist / - m_base_length; - } + *x *= m_src_vertices1[m_src_vertices1.size() - 1].dist / + m_base_length; + } - double x1 = *x; - double y1 = *y; - double x2 = *x; - double y2 = *y; - double dd = m_src_vertices2[m_src_vertices2.size() - 1].dist / - m_src_vertices1[m_src_vertices1.size() - 1].dist; + double x1 = *x; + double y1 = *y; + double x2 = *x; + double y2 = *y; + double dd = m_src_vertices2[m_src_vertices2.size() - 1].dist / + m_src_vertices1[m_src_vertices1.size() - 1].dist; - transform1(m_src_vertices1, m_kindex1, 1.0, &x1, &y1); - transform1(m_src_vertices2, m_kindex2, dd, &x2, &y2); + transform1(m_src_vertices1, m_kindex1, 1.0, &x1, &y1); + transform1(m_src_vertices2, m_kindex2, dd, &x2, &y2); - *x = x1 + *y * (x2 - x1) / m_base_height; - *y = y1 + *y * (y2 - y1) / m_base_height; - } + *x = x1 + *y * (x2 - x1) / m_base_height; + *y = y1 + *y * (y2 - y1) / m_base_height; } +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_trans_single_path.cpp mapnik-2.2.0/deps/agg/src/agg_trans_single_path.cpp --- mapnik-2.1.0/deps/agg/src/agg_trans_single_path.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_trans_single_path.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -20,127 +20,127 @@ namespace agg { - //------------------------------------------------------------------------ - trans_single_path::trans_single_path() : - m_base_length(0.0), - m_kindex(0.0), - m_status(initial), - m_preserve_x_scale(true) - { - } +//------------------------------------------------------------------------ +trans_single_path::trans_single_path() : + m_base_length(0.0), + m_kindex(0.0), + m_status(initial), + m_preserve_x_scale(true) +{ +} + +//------------------------------------------------------------------------ +void trans_single_path::reset() +{ + m_src_vertices.remove_all(); + m_kindex = 0.0; + m_status = initial; +} - //------------------------------------------------------------------------ - void trans_single_path::reset() +//------------------------------------------------------------------------ +void trans_single_path::move_to(double x, double y) +{ + if(m_status == initial) { - m_src_vertices.remove_all(); - m_kindex = 0.0; - m_status = initial; + m_src_vertices.modify_last(vertex_dist(x, y)); + m_status = making_path; } - - //------------------------------------------------------------------------ - void trans_single_path::move_to(double x, double y) + else { - if(m_status == initial) - { - m_src_vertices.modify_last(vertex_dist(x, y)); - m_status = making_path; - } - else - { - line_to(x, y); - } + line_to(x, y); } +} - //------------------------------------------------------------------------ - void trans_single_path::line_to(double x, double y) +//------------------------------------------------------------------------ +void trans_single_path::line_to(double x, double y) +{ + if(m_status == making_path) { - if(m_status == making_path) - { - m_src_vertices.add(vertex_dist(x, y)); - } + m_src_vertices.add(vertex_dist(x, y)); } +} - //------------------------------------------------------------------------ - void trans_single_path::finalize_path() +//------------------------------------------------------------------------ +void trans_single_path::finalize_path() +{ + if(m_status == making_path && m_src_vertices.size() > 1) { - if(m_status == making_path && m_src_vertices.size() > 1) - { - unsigned i; - double dist; - double d; + unsigned i; + double dist; + double d; - m_src_vertices.close(false); - if(m_src_vertices.size() > 2) + m_src_vertices.close(false); + if(m_src_vertices.size() > 2) + { + if(m_src_vertices[m_src_vertices.size() - 2].dist * 10.0 < + m_src_vertices[m_src_vertices.size() - 3].dist) { - if(m_src_vertices[m_src_vertices.size() - 2].dist * 10.0 < - m_src_vertices[m_src_vertices.size() - 3].dist) - { - d = m_src_vertices[m_src_vertices.size() - 3].dist + - m_src_vertices[m_src_vertices.size() - 2].dist; + d = m_src_vertices[m_src_vertices.size() - 3].dist + + m_src_vertices[m_src_vertices.size() - 2].dist; - m_src_vertices[m_src_vertices.size() - 2] = - m_src_vertices[m_src_vertices.size() - 1]; + m_src_vertices[m_src_vertices.size() - 2] = + m_src_vertices[m_src_vertices.size() - 1]; - m_src_vertices.remove_last(); - m_src_vertices[m_src_vertices.size() - 2].dist = d; - } + m_src_vertices.remove_last(); + m_src_vertices[m_src_vertices.size() - 2].dist = d; } + } - dist = 0.0; - for(i = 0; i < m_src_vertices.size(); i++) - { - vertex_dist& v = m_src_vertices[i]; - double d = v.dist; - v.dist = dist; - dist += d; - } - m_kindex = (m_src_vertices.size() - 1) / dist; - m_status = ready; + dist = 0.0; + for(i = 0; i < m_src_vertices.size(); i++) + { + vertex_dist& v = m_src_vertices[i]; + double d = v.dist; + v.dist = dist; + dist += d; } + m_kindex = (m_src_vertices.size() - 1) / dist; + m_status = ready; } +} - //------------------------------------------------------------------------ - double trans_single_path::total_length() const - { - if(m_base_length >= 1e-10) return m_base_length; - return (m_status == ready) ? - m_src_vertices[m_src_vertices.size() - 1].dist : - 0.0; - } +//------------------------------------------------------------------------ +double trans_single_path::total_length() const +{ + if(m_base_length >= 1e-10) return m_base_length; + return (m_status == ready) ? + m_src_vertices[m_src_vertices.size() - 1].dist : + 0.0; +} - //------------------------------------------------------------------------ - void trans_single_path::transform(double *x, double *y) const +//------------------------------------------------------------------------ +void trans_single_path::transform(double *x, double *y) const +{ + if(m_status == ready) { - if(m_status == ready) + if(m_base_length > 1e-10) { - if(m_base_length > 1e-10) - { - *x *= m_src_vertices[m_src_vertices.size() - 1].dist / - m_base_length; - } + *x *= m_src_vertices[m_src_vertices.size() - 1].dist / + m_base_length; + } - double x1 = 0.0; - double y1 = 0.0; - double dx = 1.0; - double dy = 1.0; - double d = 0.0; - double dd = 1.0; - if(*x < 0.0) - { - // Extrapolation on the left - //-------------------------- - x1 = m_src_vertices[0].x; - y1 = m_src_vertices[0].y; - dx = m_src_vertices[1].x - x1; - dy = m_src_vertices[1].y - y1; - dd = m_src_vertices[1].dist - m_src_vertices[0].dist; - d = *x; - } - else + double x1 = 0.0; + double y1 = 0.0; + double dx = 1.0; + double dy = 1.0; + double d = 0.0; + double dd = 1.0; + if(*x < 0.0) + { + // Extrapolation on the left + //-------------------------- + x1 = m_src_vertices[0].x; + y1 = m_src_vertices[0].y; + dx = m_src_vertices[1].x - x1; + dy = m_src_vertices[1].y - y1; + dd = m_src_vertices[1].dist - m_src_vertices[0].dist; + d = *x; + } + else if(*x > m_src_vertices[m_src_vertices.size() - 1].dist) { // Extrapolation on the right @@ -163,13 +163,13 @@ if(m_preserve_x_scale) { unsigned k; - for(i = 0; (j - i) > 1; ) + for(i = 0; (j - i) > 1; ) { - if(*x < m_src_vertices[k = (i + j) >> 1].dist) + if(*x < m_src_vertices[k = (i + j) >> 1].dist) { - j = k; + j = k; } - else + else { i = k; } @@ -190,12 +190,12 @@ dx = m_src_vertices[j].x - x1; dy = m_src_vertices[j].y - y1; } - double x2 = x1 + dx * d / dd; - double y2 = y1 + dy * d / dd; - *x = x2 - *y * dy / dd; - *y = y2 + *y * dx / dd; - } + double x2 = x1 + dx * d / dd; + double y2 = y1 + dy * d / dd; + *x = x2 - *y * dy / dd; + *y = y2 + *y * dx / dd; } +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_trans_warp_magnifier.cpp mapnik-2.2.0/deps/agg/src/agg_trans_warp_magnifier.cpp --- mapnik-2.1.0/deps/agg/src/agg_trans_warp_magnifier.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_trans_warp_magnifier.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,52 +19,52 @@ namespace agg { - //------------------------------------------------------------------------ - void trans_warp_magnifier::transform(double* x, double* y) const +//------------------------------------------------------------------------ +void trans_warp_magnifier::transform(double* x, double* y) const +{ + double dx = *x - m_xc; + double dy = *y - m_yc; + double r = sqrt(dx * dx + dy * dy); + if(r < m_radius) { - double dx = *x - m_xc; - double dy = *y - m_yc; - double r = sqrt(dx * dx + dy * dy); - if(r < m_radius) - { - *x = m_xc + dx * m_magn; - *y = m_yc + dy * m_magn; - return; - } - - double m = (r + m_radius * (m_magn - 1.0)) / r; - *x = m_xc + dx * m; - *y = m_yc + dy * m; + *x = m_xc + dx * m_magn; + *y = m_yc + dy * m_magn; + return; } - //------------------------------------------------------------------------ - void trans_warp_magnifier::inverse_transform(double* x, double* y) const + double m = (r + m_radius * (m_magn - 1.0)) / r; + *x = m_xc + dx * m; + *y = m_yc + dy * m; +} + +//------------------------------------------------------------------------ +void trans_warp_magnifier::inverse_transform(double* x, double* y) const +{ + // New version by Andrew Skalkin + //----------------- + double dx = *x - m_xc; + double dy = *y - m_yc; + double r = sqrt(dx * dx + dy * dy); + + if(r < m_radius * m_magn) { - // New version by Andrew Skalkin - //----------------- - double dx = *x - m_xc; - double dy = *y - m_yc; - double r = sqrt(dx * dx + dy * dy); - - if(r < m_radius * m_magn) - { - *x = m_xc + dx / m_magn; - *y = m_yc + dy / m_magn; - } - else - { - double rnew = r - m_radius * (m_magn - 1.0); - *x = m_xc + rnew * dx / r; - *y = m_yc + rnew * dy / r; - } - - // Old version - //----------------- - //trans_warp_magnifier t(*this); - //t.magnification(1.0 / m_magn); - //t.radius(m_radius * m_magn); - //t.transform(x, y); + *x = m_xc + dx / m_magn; + *y = m_yc + dy / m_magn; } + else + { + double rnew = r - m_radius * (m_magn - 1.0); + *x = m_xc + rnew * dx / r; + *y = m_yc + rnew * dy / r; + } + + // Old version + //----------------- + //trans_warp_magnifier t(*this); + //t.magnification(1.0 / m_magn); + //t.radius(m_radius * m_magn); + //t.transform(x, y); +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_vcgen_bspline.cpp mapnik-2.2.0/deps/agg/src/agg_vcgen_bspline.cpp --- mapnik-2.1.0/deps/agg/src/agg_vcgen_bspline.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_vcgen_bspline.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,176 +18,176 @@ namespace agg { - //------------------------------------------------------------------------ - vcgen_bspline::vcgen_bspline() : - m_src_vertices(), - m_spline_x(), - m_spline_y(), - m_interpolation_step(1.0/50.0), - m_closed(0), - m_status(initial), - m_src_vertex(0) - { - } +//------------------------------------------------------------------------ +vcgen_bspline::vcgen_bspline() : + m_src_vertices(), + m_spline_x(), + m_spline_y(), + m_interpolation_step(1.0/50.0), + m_closed(0), + m_status(initial), + m_src_vertex(0) +{ +} - //------------------------------------------------------------------------ - void vcgen_bspline::remove_all() - { - m_src_vertices.remove_all(); - m_closed = 0; - m_status = initial; - m_src_vertex = 0; - } +//------------------------------------------------------------------------ +void vcgen_bspline::remove_all() +{ + m_src_vertices.remove_all(); + m_closed = 0; + m_status = initial; + m_src_vertex = 0; +} - //------------------------------------------------------------------------ - void vcgen_bspline::add_vertex(double x, double y, unsigned cmd) +//------------------------------------------------------------------------ +void vcgen_bspline::add_vertex(double x, double y, unsigned cmd) +{ + m_status = initial; + if(is_move_to(cmd)) + { + m_src_vertices.modify_last(point_d(x, y)); + } + else { - m_status = initial; - if(is_move_to(cmd)) + if(is_vertex(cmd)) { - m_src_vertices.modify_last(point_d(x, y)); + m_src_vertices.add(point_d(x, y)); } else { - if(is_vertex(cmd)) - { - m_src_vertices.add(point_d(x, y)); - } - else - { - m_closed = get_close_flag(cmd); - } + m_closed = get_close_flag(cmd); } } +} - //------------------------------------------------------------------------ - void vcgen_bspline::rewind(unsigned) +//------------------------------------------------------------------------ +void vcgen_bspline::rewind(unsigned) +{ + m_cur_abscissa = 0.0; + m_max_abscissa = 0.0; + m_src_vertex = 0; + if(m_status == initial && m_src_vertices.size() > 2) { + if(m_closed) + { + m_spline_x.init(m_src_vertices.size() + 8); + m_spline_y.init(m_src_vertices.size() + 8); + m_spline_x.add_point(0.0, m_src_vertices.prev(m_src_vertices.size() - 3).x); + m_spline_y.add_point(0.0, m_src_vertices.prev(m_src_vertices.size() - 3).y); + m_spline_x.add_point(1.0, m_src_vertices[m_src_vertices.size() - 3].x); + m_spline_y.add_point(1.0, m_src_vertices[m_src_vertices.size() - 3].y); + m_spline_x.add_point(2.0, m_src_vertices[m_src_vertices.size() - 2].x); + m_spline_y.add_point(2.0, m_src_vertices[m_src_vertices.size() - 2].y); + m_spline_x.add_point(3.0, m_src_vertices[m_src_vertices.size() - 1].x); + m_spline_y.add_point(3.0, m_src_vertices[m_src_vertices.size() - 1].y); + } + else + { + m_spline_x.init(m_src_vertices.size()); + m_spline_y.init(m_src_vertices.size()); + } + unsigned i; + for(i = 0; i < m_src_vertices.size(); i++) + { + double x = m_closed ? i + 4 : i; + m_spline_x.add_point(x, m_src_vertices[i].x); + m_spline_y.add_point(x, m_src_vertices[i].y); + } m_cur_abscissa = 0.0; - m_max_abscissa = 0.0; - m_src_vertex = 0; - if(m_status == initial && m_src_vertices.size() > 2) + m_max_abscissa = m_src_vertices.size() - 1; + if(m_closed) { - if(m_closed) - { - m_spline_x.init(m_src_vertices.size() + 8); - m_spline_y.init(m_src_vertices.size() + 8); - m_spline_x.add_point(0.0, m_src_vertices.prev(m_src_vertices.size() - 3).x); - m_spline_y.add_point(0.0, m_src_vertices.prev(m_src_vertices.size() - 3).y); - m_spline_x.add_point(1.0, m_src_vertices[m_src_vertices.size() - 3].x); - m_spline_y.add_point(1.0, m_src_vertices[m_src_vertices.size() - 3].y); - m_spline_x.add_point(2.0, m_src_vertices[m_src_vertices.size() - 2].x); - m_spline_y.add_point(2.0, m_src_vertices[m_src_vertices.size() - 2].y); - m_spline_x.add_point(3.0, m_src_vertices[m_src_vertices.size() - 1].x); - m_spline_y.add_point(3.0, m_src_vertices[m_src_vertices.size() - 1].y); - } - else - { - m_spline_x.init(m_src_vertices.size()); - m_spline_y.init(m_src_vertices.size()); - } - unsigned i; - for(i = 0; i < m_src_vertices.size(); i++) - { - double x = m_closed ? i + 4 : i; - m_spline_x.add_point(x, m_src_vertices[i].x); - m_spline_y.add_point(x, m_src_vertices[i].y); - } - m_cur_abscissa = 0.0; - m_max_abscissa = m_src_vertices.size() - 1; - if(m_closed) - { - m_cur_abscissa = 4.0; - m_max_abscissa += 5.0; - m_spline_x.add_point(m_src_vertices.size() + 4, m_src_vertices[0].x); - m_spline_y.add_point(m_src_vertices.size() + 4, m_src_vertices[0].y); - m_spline_x.add_point(m_src_vertices.size() + 5, m_src_vertices[1].x); - m_spline_y.add_point(m_src_vertices.size() + 5, m_src_vertices[1].y); - m_spline_x.add_point(m_src_vertices.size() + 6, m_src_vertices[2].x); - m_spline_y.add_point(m_src_vertices.size() + 6, m_src_vertices[2].y); - m_spline_x.add_point(m_src_vertices.size() + 7, m_src_vertices.next(2).x); - m_spline_y.add_point(m_src_vertices.size() + 7, m_src_vertices.next(2).y); - } - m_spline_x.prepare(); - m_spline_y.prepare(); + m_cur_abscissa = 4.0; + m_max_abscissa += 5.0; + m_spline_x.add_point(m_src_vertices.size() + 4, m_src_vertices[0].x); + m_spline_y.add_point(m_src_vertices.size() + 4, m_src_vertices[0].y); + m_spline_x.add_point(m_src_vertices.size() + 5, m_src_vertices[1].x); + m_spline_y.add_point(m_src_vertices.size() + 5, m_src_vertices[1].y); + m_spline_x.add_point(m_src_vertices.size() + 6, m_src_vertices[2].x); + m_spline_y.add_point(m_src_vertices.size() + 6, m_src_vertices[2].y); + m_spline_x.add_point(m_src_vertices.size() + 7, m_src_vertices.next(2).x); + m_spline_y.add_point(m_src_vertices.size() + 7, m_src_vertices.next(2).y); } - m_status = ready; + m_spline_x.prepare(); + m_spline_y.prepare(); } + m_status = ready; +} - //------------------------------------------------------------------------ - unsigned vcgen_bspline::vertex(double* x, double* y) +//------------------------------------------------------------------------ +unsigned vcgen_bspline::vertex(double* x, double* y) +{ + unsigned cmd = path_cmd_line_to; + while(!is_stop(cmd)) { - unsigned cmd = path_cmd_line_to; - while(!is_stop(cmd)) + switch(m_status) { - switch(m_status) + case initial: + rewind(0); + + case ready: + if(m_src_vertices.size() < 2) { - case initial: - rewind(0); + cmd = path_cmd_stop; + break; + } - case ready: - if(m_src_vertices.size() < 2) - { - cmd = path_cmd_stop; - break; - } + if(m_src_vertices.size() == 2) + { + *x = m_src_vertices[m_src_vertex].x; + *y = m_src_vertices[m_src_vertex].y; + m_src_vertex++; + if(m_src_vertex == 1) return path_cmd_move_to; + if(m_src_vertex == 2) return path_cmd_line_to; + cmd = path_cmd_stop; + break; + } - if(m_src_vertices.size() == 2) + cmd = path_cmd_move_to; + m_status = polygon; + m_src_vertex = 0; + + case polygon: + if(m_cur_abscissa >= m_max_abscissa) + { + if(m_closed) { - *x = m_src_vertices[m_src_vertex].x; - *y = m_src_vertices[m_src_vertex].y; - m_src_vertex++; - if(m_src_vertex == 1) return path_cmd_move_to; - if(m_src_vertex == 2) return path_cmd_line_to; - cmd = path_cmd_stop; + m_status = end_poly; break; } - - cmd = path_cmd_move_to; - m_status = polygon; - m_src_vertex = 0; - - case polygon: - if(m_cur_abscissa >= m_max_abscissa) + else { - if(m_closed) - { - m_status = end_poly; - break; - } - else - { - *x = m_src_vertices[m_src_vertices.size() - 1].x; - *y = m_src_vertices[m_src_vertices.size() - 1].y; - m_status = end_poly; - return path_cmd_line_to; - } + *x = m_src_vertices[m_src_vertices.size() - 1].x; + *y = m_src_vertices[m_src_vertices.size() - 1].y; + m_status = end_poly; + return path_cmd_line_to; } + } - *x = m_spline_x.get_stateful(m_cur_abscissa); - *y = m_spline_y.get_stateful(m_cur_abscissa); - m_src_vertex++; - m_cur_abscissa += m_interpolation_step; - return (m_src_vertex == 1) ? path_cmd_move_to : path_cmd_line_to; - - case end_poly: - m_status = stop; - return path_cmd_end_poly | m_closed; + *x = m_spline_x.get_stateful(m_cur_abscissa); + *y = m_spline_y.get_stateful(m_cur_abscissa); + m_src_vertex++; + m_cur_abscissa += m_interpolation_step; + return (m_src_vertex == 1) ? path_cmd_move_to : path_cmd_line_to; + + case end_poly: + m_status = stop; + return path_cmd_end_poly | m_closed; - case stop: - return path_cmd_stop; - } + case stop: + return path_cmd_stop; } - return cmd; } + return cmd; +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_vcgen_contour.cpp mapnik-2.2.0/deps/agg/src/agg_vcgen_contour.cpp --- mapnik-2.1.0/deps/agg/src/agg_vcgen_contour.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_vcgen_contour.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,143 +23,143 @@ namespace agg { - //------------------------------------------------------------------------ - vcgen_contour::vcgen_contour() : - m_stroker(), - m_width(1), - m_src_vertices(), - m_out_vertices(), - m_status(initial), - m_src_vertex(0), - m_closed(0), - m_orientation(0), - m_auto_detect(false) - { - } +//------------------------------------------------------------------------ +vcgen_contour::vcgen_contour() : + m_stroker(), + m_width(1), + m_src_vertices(), + m_out_vertices(), + m_status(initial), + m_src_vertex(0), + m_closed(0), + m_orientation(0), + m_auto_detect(false) +{ +} + +//------------------------------------------------------------------------ +void vcgen_contour::remove_all() +{ + m_src_vertices.remove_all(); + m_closed = 0; + m_orientation = 0; + m_status = initial; +} - //------------------------------------------------------------------------ - void vcgen_contour::remove_all() +//------------------------------------------------------------------------ +void vcgen_contour::add_vertex(double x, double y, unsigned cmd) +{ + m_status = initial; + if(is_move_to(cmd)) { - m_src_vertices.remove_all(); - m_closed = 0; - m_orientation = 0; - m_status = initial; + m_src_vertices.modify_last(vertex_dist(x, y)); } - - //------------------------------------------------------------------------ - void vcgen_contour::add_vertex(double x, double y, unsigned cmd) + else { - m_status = initial; - if(is_move_to(cmd)) + if(is_vertex(cmd)) { - m_src_vertices.modify_last(vertex_dist(x, y)); + m_src_vertices.add(vertex_dist(x, y)); } else { - if(is_vertex(cmd)) - { - m_src_vertices.add(vertex_dist(x, y)); - } - else + if(is_end_poly(cmd)) { - if(is_end_poly(cmd)) + m_closed = get_close_flag(cmd); + if(m_orientation == path_flags_none) { - m_closed = get_close_flag(cmd); - if(m_orientation == path_flags_none) - { - m_orientation = get_orientation(cmd); - } + m_orientation = get_orientation(cmd); } } } } +} - //------------------------------------------------------------------------ - void vcgen_contour::rewind(unsigned) +//------------------------------------------------------------------------ +void vcgen_contour::rewind(unsigned) +{ + if(m_status == initial) { - if(m_status == initial) + m_src_vertices.close(true); + if(m_auto_detect) { - m_src_vertices.close(true); - if(m_auto_detect) - { - if(!is_oriented(m_orientation)) - { - m_orientation = (calc_polygon_area(m_src_vertices) > 0.0) ? - path_flags_ccw : - path_flags_cw; - } - } - if(is_oriented(m_orientation)) + if(!is_oriented(m_orientation)) { - m_stroker.width(is_ccw(m_orientation) ? m_width : -m_width); + m_orientation = (calc_polygon_area(m_src_vertices) > 0.0) ? + path_flags_ccw : + path_flags_cw; } } - m_status = ready; - m_src_vertex = 0; + if(is_oriented(m_orientation)) + { + m_stroker.width(is_ccw(m_orientation) ? m_width : -m_width); + } } + m_status = ready; + m_src_vertex = 0; +} - //------------------------------------------------------------------------ - unsigned vcgen_contour::vertex(double* x, double* y) +//------------------------------------------------------------------------ +unsigned vcgen_contour::vertex(double* x, double* y) +{ + unsigned cmd = path_cmd_line_to; + while(!is_stop(cmd)) { - unsigned cmd = path_cmd_line_to; - while(!is_stop(cmd)) + switch(m_status) { - switch(m_status) - { - case initial: - rewind(0); + case initial: + rewind(0); - case ready: - if(m_src_vertices.size() < 2 + unsigned(m_closed != 0)) - { - cmd = path_cmd_stop; - break; - } - m_status = outline; - cmd = path_cmd_move_to; - m_src_vertex = 0; - m_out_vertex = 0; - - case outline: - if(m_src_vertex >= m_src_vertices.size()) - { - m_status = end_poly; - break; - } - m_stroker.calc_join(m_out_vertices, - m_src_vertices.prev(m_src_vertex), - m_src_vertices.curr(m_src_vertex), - m_src_vertices.next(m_src_vertex), - m_src_vertices.prev(m_src_vertex).dist, - m_src_vertices.curr(m_src_vertex).dist); - ++m_src_vertex; - m_status = out_vertices; - m_out_vertex = 0; - - case out_vertices: - if(m_out_vertex >= m_out_vertices.size()) - { - m_status = outline; - } - else - { - const point_d& c = m_out_vertices[m_out_vertex++]; - *x = c.x; - *y = c.y; - return cmd; - } + case ready: + if(m_src_vertices.size() < 2 + unsigned(m_closed != 0)) + { + cmd = path_cmd_stop; break; + } + m_status = outline; + cmd = path_cmd_move_to; + m_src_vertex = 0; + m_out_vertex = 0; - case end_poly: - if(!m_closed) return path_cmd_stop; - m_status = stop; - return path_cmd_end_poly | path_flags_close | path_flags_ccw; + case outline: + if(m_src_vertex >= m_src_vertices.size()) + { + m_status = end_poly; + break; + } + m_stroker.calc_join(m_out_vertices, + m_src_vertices.prev(m_src_vertex), + m_src_vertices.curr(m_src_vertex), + m_src_vertices.next(m_src_vertex), + m_src_vertices.prev(m_src_vertex).dist, + m_src_vertices.curr(m_src_vertex).dist); + ++m_src_vertex; + m_status = out_vertices; + m_out_vertex = 0; - case stop: - return path_cmd_stop; + case out_vertices: + if(m_out_vertex >= m_out_vertices.size()) + { + m_status = outline; } + else + { + const point_d& c = m_out_vertices[m_out_vertex++]; + *x = c.x; + *y = c.y; + return cmd; + } + break; + + case end_poly: + if(!m_closed) return path_cmd_stop; + m_status = stop; + return path_cmd_end_poly | path_flags_close | path_flags_ccw; + + case stop: + return path_cmd_stop; } - return cmd; } + return cmd; +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_vcgen_dash.cpp mapnik-2.2.0/deps/agg/src/agg_vcgen_dash.cpp --- mapnik-2.1.0/deps/agg/src/agg_vcgen_dash.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_vcgen_dash.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -24,211 +24,211 @@ namespace agg { - //------------------------------------------------------------------------ - vcgen_dash::vcgen_dash() : - m_total_dash_len(0.0), - m_num_dashes(0), - m_dash_start(0.0), - m_shorten(0.0), - m_curr_dash_start(0.0), - m_curr_dash(0), - m_src_vertices(), - m_closed(0), - m_status(initial), - m_src_vertex(0) - { - } +//------------------------------------------------------------------------ +vcgen_dash::vcgen_dash() : + m_total_dash_len(0.0), + m_num_dashes(0), + m_dash_start(0.0), + m_shorten(0.0), + m_curr_dash_start(0.0), + m_curr_dash(0), + m_src_vertices(), + m_closed(0), + m_status(initial), + m_src_vertex(0) +{ +} - //------------------------------------------------------------------------ - void vcgen_dash::remove_all_dashes() - { - m_total_dash_len = 0.0; - m_num_dashes = 0; - m_curr_dash_start = 0.0; - m_curr_dash = 0; - } +//------------------------------------------------------------------------ +void vcgen_dash::remove_all_dashes() +{ + m_total_dash_len = 0.0; + m_num_dashes = 0; + m_curr_dash_start = 0.0; + m_curr_dash = 0; +} - //------------------------------------------------------------------------ - void vcgen_dash::add_dash(double dash_len, double gap_len) +//------------------------------------------------------------------------ +void vcgen_dash::add_dash(double dash_len, double gap_len) +{ + if(m_num_dashes < max_dashes) { - if(m_num_dashes < max_dashes) - { - m_total_dash_len += dash_len + gap_len; - m_dashes[m_num_dashes++] = dash_len; - m_dashes[m_num_dashes++] = gap_len; - } + m_total_dash_len += dash_len + gap_len; + m_dashes[m_num_dashes++] = dash_len; + m_dashes[m_num_dashes++] = gap_len; } +} - //------------------------------------------------------------------------ - void vcgen_dash::dash_start(double ds) - { - m_dash_start = ds; - calc_dash_start(fabs(ds)); - } +//------------------------------------------------------------------------ +void vcgen_dash::dash_start(double ds) +{ + m_dash_start = ds; + calc_dash_start(fabs(ds)); +} - //------------------------------------------------------------------------ - void vcgen_dash::calc_dash_start(double ds) - { - m_curr_dash = 0; - m_curr_dash_start = 0.0; - while(ds > 0.0) +//------------------------------------------------------------------------ +void vcgen_dash::calc_dash_start(double ds) +{ + m_curr_dash = 0; + m_curr_dash_start = 0.0; + while(ds > 0.0) + { + if(ds > m_dashes[m_curr_dash]) + { + ds -= m_dashes[m_curr_dash]; + ++m_curr_dash; + m_curr_dash_start = 0.0; + if(m_curr_dash >= m_num_dashes) m_curr_dash = 0; + } + else { - if(ds > m_dashes[m_curr_dash]) - { - ds -= m_dashes[m_curr_dash]; - ++m_curr_dash; - m_curr_dash_start = 0.0; - if(m_curr_dash >= m_num_dashes) m_curr_dash = 0; - } - else - { - m_curr_dash_start = ds; - ds = 0.0; - } + m_curr_dash_start = ds; + ds = 0.0; } } +} - //------------------------------------------------------------------------ - void vcgen_dash::remove_all() - { - m_status = initial; - m_src_vertices.remove_all(); - m_closed = 0; - } +//------------------------------------------------------------------------ +void vcgen_dash::remove_all() +{ + m_status = initial; + m_src_vertices.remove_all(); + m_closed = 0; +} - //------------------------------------------------------------------------ - void vcgen_dash::add_vertex(double x, double y, unsigned cmd) +//------------------------------------------------------------------------ +void vcgen_dash::add_vertex(double x, double y, unsigned cmd) +{ + m_status = initial; + if(is_move_to(cmd)) { - m_status = initial; - if(is_move_to(cmd)) + m_src_vertices.modify_last(vertex_dist(x, y)); + } + else + { + if(is_vertex(cmd)) { - m_src_vertices.modify_last(vertex_dist(x, y)); + m_src_vertices.add(vertex_dist(x, y)); } else { - if(is_vertex(cmd)) - { - m_src_vertices.add(vertex_dist(x, y)); - } - else - { - m_closed = get_close_flag(cmd); - } + m_closed = get_close_flag(cmd); } } +} - //------------------------------------------------------------------------ - void vcgen_dash::rewind(unsigned) +//------------------------------------------------------------------------ +void vcgen_dash::rewind(unsigned) +{ + if(m_status == initial) { - if(m_status == initial) - { - m_src_vertices.close(m_closed != 0); - shorten_path(m_src_vertices, m_shorten, m_closed); - } - m_status = ready; - m_src_vertex = 0; + m_src_vertices.close(m_closed != 0); + shorten_path(m_src_vertices, m_shorten, m_closed); } + m_status = ready; + m_src_vertex = 0; +} - //------------------------------------------------------------------------ - unsigned vcgen_dash::vertex(double* x, double* y) +//------------------------------------------------------------------------ +unsigned vcgen_dash::vertex(double* x, double* y) +{ + unsigned cmd = path_cmd_move_to; + while(!is_stop(cmd)) { - unsigned cmd = path_cmd_move_to; - while(!is_stop(cmd)) + switch(m_status) { - switch(m_status) + case initial: + rewind(0); + + case ready: + if(m_num_dashes < 2 || m_src_vertices.size() < 2) { - case initial: - rewind(0); + cmd = path_cmd_stop; + break; + } + m_status = polyline; + m_src_vertex = 1; + m_v1 = &m_src_vertices[0]; + m_v2 = &m_src_vertices[1]; + m_curr_rest = m_v1->dist; + *x = m_v1->x; + *y = m_v1->y; + if(m_dash_start >= 0.0) calc_dash_start(m_dash_start); + return path_cmd_move_to; + + case polyline: + { + double dash_rest = m_dashes[m_curr_dash] - m_curr_dash_start; + + unsigned cmd = (m_curr_dash & 1) ? + path_cmd_move_to : + path_cmd_line_to; - case ready: - if(m_num_dashes < 2 || m_src_vertices.size() < 2) - { - cmd = path_cmd_stop; - break; - } - m_status = polyline; - m_src_vertex = 1; - m_v1 = &m_src_vertices[0]; - m_v2 = &m_src_vertices[1]; + if(m_curr_rest > dash_rest) + { + m_curr_rest -= dash_rest; + ++m_curr_dash; + if(m_curr_dash >= m_num_dashes) m_curr_dash = 0; + m_curr_dash_start = 0.0; + *x = m_v2->x - (m_v2->x - m_v1->x) * m_curr_rest / m_v1->dist; + *y = m_v2->y - (m_v2->y - m_v1->y) * m_curr_rest / m_v1->dist; + } + else + { + m_curr_dash_start += m_curr_rest; + *x = m_v2->x; + *y = m_v2->y; + ++m_src_vertex; + m_v1 = m_v2; m_curr_rest = m_v1->dist; - *x = m_v1->x; - *y = m_v1->y; - if(m_dash_start >= 0.0) calc_dash_start(m_dash_start); - return path_cmd_move_to; - - case polyline: + if(m_closed) { - double dash_rest = m_dashes[m_curr_dash] - m_curr_dash_start; - - unsigned cmd = (m_curr_dash & 1) ? - path_cmd_move_to : - path_cmd_line_to; - - if(m_curr_rest > dash_rest) + if(m_src_vertex > m_src_vertices.size()) { - m_curr_rest -= dash_rest; - ++m_curr_dash; - if(m_curr_dash >= m_num_dashes) m_curr_dash = 0; - m_curr_dash_start = 0.0; - *x = m_v2->x - (m_v2->x - m_v1->x) * m_curr_rest / m_v1->dist; - *y = m_v2->y - (m_v2->y - m_v1->y) * m_curr_rest / m_v1->dist; + m_status = stop; } else { - m_curr_dash_start += m_curr_rest; - *x = m_v2->x; - *y = m_v2->y; - ++m_src_vertex; - m_v1 = m_v2; - m_curr_rest = m_v1->dist; - if(m_closed) - { - if(m_src_vertex > m_src_vertices.size()) - { - m_status = stop; - } - else - { - m_v2 = &m_src_vertices - [ - (m_src_vertex >= m_src_vertices.size()) ? 0 : - m_src_vertex + m_v2 = &m_src_vertices + [ + (m_src_vertex >= m_src_vertices.size()) ? 0 : + m_src_vertex ]; - } - } - else - { - if(m_src_vertex >= m_src_vertices.size()) - { - m_status = stop; - } - else - { - m_v2 = &m_src_vertices[m_src_vertex]; - } - } } - return cmd; } - break; - - case stop: - cmd = path_cmd_stop; - break; + else + { + if(m_src_vertex >= m_src_vertices.size()) + { + m_status = stop; + } + else + { + m_v2 = &m_src_vertices[m_src_vertex]; + } + } } + return cmd; + } + break; + case stop: + cmd = path_cmd_stop; + break; } - return path_cmd_stop; + } + return path_cmd_stop; +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_vcgen_markers_term.cpp mapnik-2.2.0/deps/agg/src/agg_vcgen_markers_term.cpp --- mapnik-2.1.0/deps/agg/src/agg_vcgen_markers_term.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_vcgen_markers_term.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -22,82 +22,82 @@ namespace agg { - //------------------------------------------------------------------------ - void vcgen_markers_term::remove_all() - { - m_markers.remove_all(); - } +//------------------------------------------------------------------------ +void vcgen_markers_term::remove_all() +{ + m_markers.remove_all(); +} - //------------------------------------------------------------------------ - void vcgen_markers_term::add_vertex(double x, double y, unsigned cmd) +//------------------------------------------------------------------------ +void vcgen_markers_term::add_vertex(double x, double y, unsigned cmd) +{ + if(is_move_to(cmd)) { - if(is_move_to(cmd)) + if(m_markers.size() & 1) + { + // Initial state, the first coordinate was added. + // If two of more calls of start_vertex() occures + // we just modify the last one. + m_markers.modify_last(coord_type(x, y)); + } + else + { + m_markers.add(coord_type(x, y)); + } + } + else + { + if(is_vertex(cmd)) { if(m_markers.size() & 1) { // Initial state, the first coordinate was added. - // If two of more calls of start_vertex() occures - // we just modify the last one. - m_markers.modify_last(coord_type(x, y)); - } - else - { + // Add three more points, 0,1,1,0 m_markers.add(coord_type(x, y)); + m_markers.add(m_markers[m_markers.size() - 1]); + m_markers.add(m_markers[m_markers.size() - 3]); } - } - else - { - if(is_vertex(cmd)) + else { - if(m_markers.size() & 1) + if(m_markers.size()) { - // Initial state, the first coordinate was added. - // Add three more points, 0,1,1,0 - m_markers.add(coord_type(x, y)); - m_markers.add(m_markers[m_markers.size() - 1]); - m_markers.add(m_markers[m_markers.size() - 3]); - } - else - { - if(m_markers.size()) - { - // Replace two last points: 0,1,1,0 -> 0,1,2,1 - m_markers[m_markers.size() - 1] = m_markers[m_markers.size() - 2]; - m_markers[m_markers.size() - 2] = coord_type(x, y); - } + // Replace two last points: 0,1,1,0 -> 0,1,2,1 + m_markers[m_markers.size() - 1] = m_markers[m_markers.size() - 2]; + m_markers[m_markers.size() - 2] = coord_type(x, y); } } } } +} - //------------------------------------------------------------------------ - void vcgen_markers_term::rewind(unsigned path_id) - { - m_curr_id = path_id * 2; - m_curr_idx = m_curr_id; - } +//------------------------------------------------------------------------ +void vcgen_markers_term::rewind(unsigned path_id) +{ + m_curr_id = path_id * 2; + m_curr_idx = m_curr_id; +} - //------------------------------------------------------------------------ - unsigned vcgen_markers_term::vertex(double* x, double* y) +//------------------------------------------------------------------------ +unsigned vcgen_markers_term::vertex(double* x, double* y) +{ + if(m_curr_id > 2 || m_curr_idx >= m_markers.size()) { - if(m_curr_id > 2 || m_curr_idx >= m_markers.size()) - { - return path_cmd_stop; - } - const coord_type& c = m_markers[m_curr_idx]; - *x = c.x; - *y = c.y; - if(m_curr_idx & 1) - { - m_curr_idx += 3; - return path_cmd_line_to; - } - ++m_curr_idx; - return path_cmd_move_to; + return path_cmd_stop; + } + const coord_type& c = m_markers[m_curr_idx]; + *x = c.x; + *y = c.y; + if(m_curr_idx & 1) + { + m_curr_idx += 3; + return path_cmd_line_to; } + ++m_curr_idx; + return path_cmd_move_to; +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_vcgen_smooth_poly1.cpp mapnik-2.2.0/deps/agg/src/agg_vcgen_smooth_poly1.cpp --- mapnik-2.1.0/deps/agg/src/agg_vcgen_smooth_poly1.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_vcgen_smooth_poly1.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -22,204 +22,204 @@ namespace agg { - //------------------------------------------------------------------------ - vcgen_smooth_poly1::vcgen_smooth_poly1() : - m_src_vertices(), - m_smooth_value(0.5), - m_closed(0), - m_status(initial), - m_src_vertex(0) - { - } +//------------------------------------------------------------------------ +vcgen_smooth_poly1::vcgen_smooth_poly1() : + m_src_vertices(), + m_smooth_value(0.5), + m_closed(0), + m_status(initial), + m_src_vertex(0) +{ +} - //------------------------------------------------------------------------ - void vcgen_smooth_poly1::remove_all() - { - m_src_vertices.remove_all(); - m_closed = 0; - m_status = initial; - } +//------------------------------------------------------------------------ +void vcgen_smooth_poly1::remove_all() +{ + m_src_vertices.remove_all(); + m_closed = 0; + m_status = initial; +} - //------------------------------------------------------------------------ - void vcgen_smooth_poly1::add_vertex(double x, double y, unsigned cmd) +//------------------------------------------------------------------------ +void vcgen_smooth_poly1::add_vertex(double x, double y, unsigned cmd) +{ + m_status = initial; + if(is_move_to(cmd)) + { + m_src_vertices.modify_last(vertex_dist(x, y)); + } + else { - m_status = initial; - if(is_move_to(cmd)) + if(is_vertex(cmd)) { - m_src_vertices.modify_last(vertex_dist(x, y)); + m_src_vertices.add(vertex_dist(x, y)); } else { - if(is_vertex(cmd)) - { - m_src_vertices.add(vertex_dist(x, y)); - } - else - { - m_closed = get_close_flag(cmd); - } + m_closed = get_close_flag(cmd); } } +} - //------------------------------------------------------------------------ - void vcgen_smooth_poly1::rewind(unsigned) +//------------------------------------------------------------------------ +void vcgen_smooth_poly1::rewind(unsigned) +{ + if(m_status == initial) { - if(m_status == initial) - { - m_src_vertices.close(m_closed != 0); - } - m_status = ready; - m_src_vertex = 0; + m_src_vertices.close(m_closed != 0); } + m_status = ready; + m_src_vertex = 0; +} - //------------------------------------------------------------------------ - void vcgen_smooth_poly1::calculate(const vertex_dist& v0, - const vertex_dist& v1, - const vertex_dist& v2, - const vertex_dist& v3) - { +//------------------------------------------------------------------------ +void vcgen_smooth_poly1::calculate(const vertex_dist& v0, + const vertex_dist& v1, + const vertex_dist& v2, + const vertex_dist& v3) +{ - double k1 = v0.dist / (v0.dist + v1.dist); - double k2 = v1.dist / (v1.dist + v2.dist); + double k1 = v0.dist / (v0.dist + v1.dist); + double k2 = v1.dist / (v1.dist + v2.dist); - double xm1 = v0.x + (v2.x - v0.x) * k1; - double ym1 = v0.y + (v2.y - v0.y) * k1; - double xm2 = v1.x + (v3.x - v1.x) * k2; - double ym2 = v1.y + (v3.y - v1.y) * k2; - - m_ctrl1_x = v1.x + m_smooth_value * (v2.x - xm1); - m_ctrl1_y = v1.y + m_smooth_value * (v2.y - ym1); - m_ctrl2_x = v2.x + m_smooth_value * (v1.x - xm2); - m_ctrl2_y = v2.y + m_smooth_value * (v1.y - ym2); - } + double xm1 = v0.x + (v2.x - v0.x) * k1; + double ym1 = v0.y + (v2.y - v0.y) * k1; + double xm2 = v1.x + (v3.x - v1.x) * k2; + double ym2 = v1.y + (v3.y - v1.y) * k2; + + m_ctrl1_x = v1.x + m_smooth_value * (v2.x - xm1); + m_ctrl1_y = v1.y + m_smooth_value * (v2.y - ym1); + m_ctrl2_x = v2.x + m_smooth_value * (v1.x - xm2); + m_ctrl2_y = v2.y + m_smooth_value * (v1.y - ym2); +} - //------------------------------------------------------------------------ - unsigned vcgen_smooth_poly1::vertex(double* x, double* y) +//------------------------------------------------------------------------ +unsigned vcgen_smooth_poly1::vertex(double* x, double* y) +{ + unsigned cmd = path_cmd_line_to; + while(!is_stop(cmd)) { - unsigned cmd = path_cmd_line_to; - while(!is_stop(cmd)) + switch(m_status) { - switch(m_status) - { - case initial: - rewind(0); + case initial: + rewind(0); - case ready: - if(m_src_vertices.size() < 2) - { - cmd = path_cmd_stop; - break; - } + case ready: + if(m_src_vertices.size() < 2) + { + cmd = path_cmd_stop; + break; + } - if(m_src_vertices.size() == 2) - { - *x = m_src_vertices[m_src_vertex].x; - *y = m_src_vertices[m_src_vertex].y; - m_src_vertex++; - if(m_src_vertex == 1) return path_cmd_move_to; - if(m_src_vertex == 2) return path_cmd_line_to; - cmd = path_cmd_stop; - break; - } + if(m_src_vertices.size() == 2) + { + *x = m_src_vertices[m_src_vertex].x; + *y = m_src_vertices[m_src_vertex].y; + m_src_vertex++; + if(m_src_vertex == 1) return path_cmd_move_to; + if(m_src_vertex == 2) return path_cmd_line_to; + cmd = path_cmd_stop; + break; + } - cmd = path_cmd_move_to; - m_status = polygon; - m_src_vertex = 0; + cmd = path_cmd_move_to; + m_status = polygon; + m_src_vertex = 0; - case polygon: - if(m_closed) + case polygon: + if(m_closed) + { + if(m_src_vertex >= m_src_vertices.size()) { - if(m_src_vertex >= m_src_vertices.size()) - { - *x = m_src_vertices[0].x; - *y = m_src_vertices[0].y; - m_status = end_poly; - return path_cmd_curve4; - } + *x = m_src_vertices[0].x; + *y = m_src_vertices[0].y; + m_status = end_poly; + return path_cmd_curve4; } - else + } + else + { + if(m_src_vertex >= m_src_vertices.size() - 1) { - if(m_src_vertex >= m_src_vertices.size() - 1) - { - *x = m_src_vertices[m_src_vertices.size() - 1].x; - *y = m_src_vertices[m_src_vertices.size() - 1].y; - m_status = end_poly; - return path_cmd_curve3; - } + *x = m_src_vertices[m_src_vertices.size() - 1].x; + *y = m_src_vertices[m_src_vertices.size() - 1].y; + m_status = end_poly; + return path_cmd_curve3; } + } - calculate(m_src_vertices.prev(m_src_vertex), - m_src_vertices.curr(m_src_vertex), - m_src_vertices.next(m_src_vertex), - m_src_vertices.next(m_src_vertex + 1)); + calculate(m_src_vertices.prev(m_src_vertex), + m_src_vertices.curr(m_src_vertex), + m_src_vertices.next(m_src_vertex), + m_src_vertices.next(m_src_vertex + 1)); + + *x = m_src_vertices[m_src_vertex].x; + *y = m_src_vertices[m_src_vertex].y; + m_src_vertex++; - *x = m_src_vertices[m_src_vertex].x; - *y = m_src_vertices[m_src_vertex].y; - m_src_vertex++; - - if(m_closed) + if(m_closed) + { + m_status = ctrl1; + return ((m_src_vertex == 1) ? + path_cmd_move_to : + path_cmd_curve4); + } + else + { + if(m_src_vertex == 1) { - m_status = ctrl1; - return ((m_src_vertex == 1) ? - path_cmd_move_to : - path_cmd_curve4); + m_status = ctrl_b; + return path_cmd_move_to; } - else + if(m_src_vertex >= m_src_vertices.size() - 1) { - if(m_src_vertex == 1) - { - m_status = ctrl_b; - return path_cmd_move_to; - } - if(m_src_vertex >= m_src_vertices.size() - 1) - { - m_status = ctrl_e; - return path_cmd_curve3; - } - m_status = ctrl1; - return path_cmd_curve4; + m_status = ctrl_e; + return path_cmd_curve3; } - break; - - case ctrl_b: - *x = m_ctrl2_x; - *y = m_ctrl2_y; - m_status = polygon; - return path_cmd_curve3; - - case ctrl_e: - *x = m_ctrl1_x; - *y = m_ctrl1_y; - m_status = polygon; - return path_cmd_curve3; - - case ctrl1: - *x = m_ctrl1_x; - *y = m_ctrl1_y; - m_status = ctrl2; - return path_cmd_curve4; - - case ctrl2: - *x = m_ctrl2_x; - *y = m_ctrl2_y; - m_status = polygon; + m_status = ctrl1; return path_cmd_curve4; + } + break; - case end_poly: - m_status = stop; - return path_cmd_end_poly | m_closed; + case ctrl_b: + *x = m_ctrl2_x; + *y = m_ctrl2_y; + m_status = polygon; + return path_cmd_curve3; + + case ctrl_e: + *x = m_ctrl1_x; + *y = m_ctrl1_y; + m_status = polygon; + return path_cmd_curve3; + + case ctrl1: + *x = m_ctrl1_x; + *y = m_ctrl1_y; + m_status = ctrl2; + return path_cmd_curve4; + + case ctrl2: + *x = m_ctrl2_x; + *y = m_ctrl2_y; + m_status = polygon; + return path_cmd_curve4; + + case end_poly: + m_status = stop; + return path_cmd_end_poly | m_closed; - case stop: - return path_cmd_stop; - } + case stop: + return path_cmd_stop; } - return cmd; } + return cmd; +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_vcgen_stroke.cpp mapnik-2.2.0/deps/agg/src/agg_vcgen_stroke.cpp --- mapnik-2.1.0/deps/agg/src/agg_vcgen_stroke.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_vcgen_stroke.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,191 +23,191 @@ namespace agg { - //------------------------------------------------------------------------ - vcgen_stroke::vcgen_stroke() : - m_stroker(), - m_src_vertices(), - m_out_vertices(), - m_shorten(0.0), - m_closed(0), - m_status(initial), - m_src_vertex(0), - m_out_vertex(0) - { - } +//------------------------------------------------------------------------ +vcgen_stroke::vcgen_stroke() : + m_stroker(), + m_src_vertices(), + m_out_vertices(), + m_shorten(0.0), + m_closed(0), + m_status(initial), + m_src_vertex(0), + m_out_vertex(0) +{ +} - //------------------------------------------------------------------------ - void vcgen_stroke::remove_all() - { - m_src_vertices.remove_all(); - m_closed = 0; - m_status = initial; - } +//------------------------------------------------------------------------ +void vcgen_stroke::remove_all() +{ + m_src_vertices.remove_all(); + m_closed = 0; + m_status = initial; +} - //------------------------------------------------------------------------ - void vcgen_stroke::add_vertex(double x, double y, unsigned cmd) +//------------------------------------------------------------------------ +void vcgen_stroke::add_vertex(double x, double y, unsigned cmd) +{ + m_status = initial; + if(is_move_to(cmd)) + { + m_src_vertices.modify_last(vertex_dist(x, y)); + } + else { - m_status = initial; - if(is_move_to(cmd)) + if(is_vertex(cmd)) { - m_src_vertices.modify_last(vertex_dist(x, y)); + m_src_vertices.add(vertex_dist(x, y)); } else { - if(is_vertex(cmd)) - { - m_src_vertices.add(vertex_dist(x, y)); - } - else - { - m_closed = get_close_flag(cmd); - } + m_closed = get_close_flag(cmd); } } +} - //------------------------------------------------------------------------ - void vcgen_stroke::rewind(unsigned) +//------------------------------------------------------------------------ +void vcgen_stroke::rewind(unsigned) +{ + if(m_status == initial) { - if(m_status == initial) - { - m_src_vertices.close(m_closed != 0); - shorten_path(m_src_vertices, m_shorten, m_closed); - if(m_src_vertices.size() < 3) m_closed = 0; - } - m_status = ready; - m_src_vertex = 0; - m_out_vertex = 0; + m_src_vertices.close(m_closed != 0); + shorten_path(m_src_vertices, m_shorten, m_closed); + if(m_src_vertices.size() < 3) m_closed = 0; } + m_status = ready; + m_src_vertex = 0; + m_out_vertex = 0; +} - //------------------------------------------------------------------------ - unsigned vcgen_stroke::vertex(double* x, double* y) +//------------------------------------------------------------------------ +unsigned vcgen_stroke::vertex(double* x, double* y) +{ + unsigned cmd = path_cmd_line_to; + while(!is_stop(cmd)) { - unsigned cmd = path_cmd_line_to; - while(!is_stop(cmd)) + switch(m_status) { - switch(m_status) - { - case initial: - rewind(0); + case initial: + rewind(0); - case ready: - if(m_src_vertices.size() < 2 + unsigned(m_closed != 0)) - { - cmd = path_cmd_stop; - break; - } - m_status = m_closed ? outline1 : cap1; - cmd = path_cmd_move_to; - m_src_vertex = 0; - m_out_vertex = 0; - break; - - case cap1: - m_stroker.calc_cap(m_out_vertices, - m_src_vertices[0], - m_src_vertices[1], - m_src_vertices[0].dist); - m_src_vertex = 1; - m_prev_status = outline1; - m_status = out_vertices; - m_out_vertex = 0; - break; - - case cap2: - m_stroker.calc_cap(m_out_vertices, - m_src_vertices[m_src_vertices.size() - 1], - m_src_vertices[m_src_vertices.size() - 2], - m_src_vertices[m_src_vertices.size() - 2].dist); - m_prev_status = outline2; - m_status = out_vertices; - m_out_vertex = 0; + case ready: + if(m_src_vertices.size() < 2 + unsigned(m_closed != 0)) + { + cmd = path_cmd_stop; break; + } + m_status = m_closed ? outline1 : cap1; + cmd = path_cmd_move_to; + m_src_vertex = 0; + m_out_vertex = 0; + break; + + case cap1: + m_stroker.calc_cap(m_out_vertices, + m_src_vertices[0], + m_src_vertices[1], + m_src_vertices[0].dist); + m_src_vertex = 1; + m_prev_status = outline1; + m_status = out_vertices; + m_out_vertex = 0; + break; + + case cap2: + m_stroker.calc_cap(m_out_vertices, + m_src_vertices[m_src_vertices.size() - 1], + m_src_vertices[m_src_vertices.size() - 2], + m_src_vertices[m_src_vertices.size() - 2].dist); + m_prev_status = outline2; + m_status = out_vertices; + m_out_vertex = 0; + break; - case outline1: - if(m_closed) - { - if(m_src_vertex >= m_src_vertices.size()) - { - m_prev_status = close_first; - m_status = end_poly1; - break; - } - } - else + case outline1: + if(m_closed) + { + if(m_src_vertex >= m_src_vertices.size()) { - if(m_src_vertex >= m_src_vertices.size() - 1) - { - m_status = cap2; - break; - } + m_prev_status = close_first; + m_status = end_poly1; + break; } - m_stroker.calc_join(m_out_vertices, - m_src_vertices.prev(m_src_vertex), - m_src_vertices.curr(m_src_vertex), - m_src_vertices.next(m_src_vertex), - m_src_vertices.prev(m_src_vertex).dist, - m_src_vertices.curr(m_src_vertex).dist); - ++m_src_vertex; - m_prev_status = m_status; - m_status = out_vertices; - m_out_vertex = 0; - break; - - case close_first: - m_status = outline2; - cmd = path_cmd_move_to; - - case outline2: - if(m_src_vertex <= unsigned(m_closed == 0)) + } + else + { + if(m_src_vertex >= m_src_vertices.size() - 1) { - m_status = end_poly2; - m_prev_status = stop; + m_status = cap2; break; } + } + m_stroker.calc_join(m_out_vertices, + m_src_vertices.prev(m_src_vertex), + m_src_vertices.curr(m_src_vertex), + m_src_vertices.next(m_src_vertex), + m_src_vertices.prev(m_src_vertex).dist, + m_src_vertices.curr(m_src_vertex).dist); + ++m_src_vertex; + m_prev_status = m_status; + m_status = out_vertices; + m_out_vertex = 0; + break; + + case close_first: + m_status = outline2; + cmd = path_cmd_move_to; - --m_src_vertex; - m_stroker.calc_join(m_out_vertices, - m_src_vertices.next(m_src_vertex), - m_src_vertices.curr(m_src_vertex), - m_src_vertices.prev(m_src_vertex), - m_src_vertices.curr(m_src_vertex).dist, - m_src_vertices.prev(m_src_vertex).dist); - - m_prev_status = m_status; - m_status = out_vertices; - m_out_vertex = 0; - break; - - case out_vertices: - if(m_out_vertex >= m_out_vertices.size()) - { - m_status = m_prev_status; - } - else - { - const point_d& c = m_out_vertices[m_out_vertex++]; - *x = c.x; - *y = c.y; - return cmd; - } + case outline2: + if(m_src_vertex <= unsigned(m_closed == 0)) + { + m_status = end_poly2; + m_prev_status = stop; break; + } - case end_poly1: - m_status = m_prev_status; - return path_cmd_end_poly | path_flags_close | path_flags_ccw; + --m_src_vertex; + m_stroker.calc_join(m_out_vertices, + m_src_vertices.next(m_src_vertex), + m_src_vertices.curr(m_src_vertex), + m_src_vertices.prev(m_src_vertex), + m_src_vertices.curr(m_src_vertex).dist, + m_src_vertices.prev(m_src_vertex).dist); + + m_prev_status = m_status; + m_status = out_vertices; + m_out_vertex = 0; + break; - case end_poly2: + case out_vertices: + if(m_out_vertex >= m_out_vertices.size()) + { m_status = m_prev_status; - return path_cmd_end_poly | path_flags_close | path_flags_cw; - - case stop: - cmd = path_cmd_stop; - break; } + else + { + const point_d& c = m_out_vertices[m_out_vertex++]; + *x = c.x; + *y = c.y; + return cmd; + } + break; + + case end_poly1: + m_status = m_prev_status; + return path_cmd_end_poly | path_flags_close | path_flags_ccw; + + case end_poly2: + m_status = m_prev_status; + return path_cmd_end_poly | path_flags_close | path_flags_cw; + + case stop: + cmd = path_cmd_stop; + break; } - return cmd; } + return cmd; +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_vpgen_clip_polygon.cpp mapnik-2.2.0/deps/agg/src/agg_vpgen_clip_polygon.cpp --- mapnik-2.1.0/deps/agg/src/agg_vpgen_clip_polygon.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_vpgen_clip_polygon.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,115 +19,115 @@ namespace agg { - //------------------------------------------------------------------------ - // Determine the clipping code of the vertex according to the - // Cyrus-Beck line clipping algorithm - // - // | | - // 0110 | 0010 | 0011 - // | | - // -------+--------+-------- clip_box.y2 - // | | - // 0100 | 0000 | 0001 - // | | - // -------+--------+-------- clip_box.y1 - // | | - // 1100 | 1000 | 1001 - // | | - // clip_box.x1 clip_box.x2 - // - // - unsigned vpgen_clip_polygon::clipping_flags(double x, double y) +//------------------------------------------------------------------------ +// Determine the clipping code of the vertex according to the +// Cyrus-Beck line clipping algorithm +// +// | | +// 0110 | 0010 | 0011 +// | | +// -------+--------+-------- clip_box.y2 +// | | +// 0100 | 0000 | 0001 +// | | +// -------+--------+-------- clip_box.y1 +// | | +// 1100 | 1000 | 1001 +// | | +// clip_box.x1 clip_box.x2 +// +// +unsigned vpgen_clip_polygon::clipping_flags(double x, double y) +{ + if(x < m_clip_box.x1) { - if(x < m_clip_box.x1) - { - if(y > m_clip_box.y2) return 6; - if(y < m_clip_box.y1) return 12; - return 4; - } + if(y > m_clip_box.y2) return 6; + if(y < m_clip_box.y1) return 12; + return 4; + } - if(x > m_clip_box.x2) - { - if(y > m_clip_box.y2) return 3; - if(y < m_clip_box.y1) return 9; - return 1; - } + if(x > m_clip_box.x2) + { + if(y > m_clip_box.y2) return 3; + if(y < m_clip_box.y1) return 9; + return 1; + } - if(y > m_clip_box.y2) return 2; - if(y < m_clip_box.y1) return 8; + if(y > m_clip_box.y2) return 2; + if(y < m_clip_box.y1) return 8; - return 0; - } + return 0; +} + +//---------------------------------------------------------------------------- +void vpgen_clip_polygon::reset() +{ + m_vertex = 0; + m_num_vertices = 0; +} - //---------------------------------------------------------------------------- - void vpgen_clip_polygon::reset() +//---------------------------------------------------------------------------- +void vpgen_clip_polygon::move_to(double x, double y) +{ + m_vertex = 0; + m_num_vertices = 0; + m_clip_flags = clipping_flags(x, y); + if(m_clip_flags == 0) { - m_vertex = 0; - m_num_vertices = 0; + m_x[0] = x; + m_y[0] = y; + m_num_vertices = 1; } + m_x1 = x; + m_y1 = y; + m_cmd = path_cmd_move_to; +} - //---------------------------------------------------------------------------- - void vpgen_clip_polygon::move_to(double x, double y) + +//---------------------------------------------------------------------------- +void vpgen_clip_polygon::line_to(double x, double y) +{ + m_vertex = 0; + m_num_vertices = 0; + unsigned flags = clipping_flags(x, y); + + if(m_clip_flags == flags) { - m_vertex = 0; - m_num_vertices = 0; - m_clip_flags = clipping_flags(x, y); - if(m_clip_flags == 0) + if(flags == 0) { m_x[0] = x; m_y[0] = y; m_num_vertices = 1; } - m_x1 = x; - m_y1 = y; - m_cmd = path_cmd_move_to; } - - - //---------------------------------------------------------------------------- - void vpgen_clip_polygon::line_to(double x, double y) + else { - m_vertex = 0; - m_num_vertices = 0; - unsigned flags = clipping_flags(x, y); - - if(m_clip_flags == flags) - { - if(flags == 0) - { - m_x[0] = x; - m_y[0] = y; - m_num_vertices = 1; - } - } - else - { - m_num_vertices = clip_liang_barsky(m_x1, m_y1, - x, y, - m_clip_box, - m_x, m_y); - } - - m_clip_flags = flags; - m_x1 = x; - m_y1 = y; + m_num_vertices = clip_liang_barsky(m_x1, m_y1, + x, y, + m_clip_box, + m_x, m_y); } + m_clip_flags = flags; + m_x1 = x; + m_y1 = y; +} - //---------------------------------------------------------------------------- - unsigned vpgen_clip_polygon::vertex(double* x, double* y) + +//---------------------------------------------------------------------------- +unsigned vpgen_clip_polygon::vertex(double* x, double* y) +{ + if(m_vertex < m_num_vertices) { - if(m_vertex < m_num_vertices) - { - *x = m_x[m_vertex]; - *y = m_y[m_vertex]; - ++m_vertex; - unsigned cmd = m_cmd; - m_cmd = path_cmd_line_to; - return cmd; - } - return path_cmd_stop; + *x = m_x[m_vertex]; + *y = m_y[m_vertex]; + ++m_vertex; + unsigned cmd = m_cmd; + m_cmd = path_cmd_line_to; + return cmd; } + return path_cmd_stop; +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_vpgen_clip_polyline.cpp mapnik-2.2.0/deps/agg/src/agg_vpgen_clip_polyline.cpp --- mapnik-2.1.0/deps/agg/src/agg_vpgen_clip_polyline.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_vpgen_clip_polyline.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,60 +18,60 @@ namespace agg { - //---------------------------------------------------------------------------- - void vpgen_clip_polyline::reset() - { - m_vertex = 0; - m_num_vertices = 0; - m_move_to = false; - } +//---------------------------------------------------------------------------- +void vpgen_clip_polyline::reset() +{ + m_vertex = 0; + m_num_vertices = 0; + m_move_to = false; +} - //---------------------------------------------------------------------------- - void vpgen_clip_polyline::move_to(double x, double y) - { - m_vertex = 0; - m_num_vertices = 0; - m_x1 = x; - m_y1 = y; - m_move_to = true; - } +//---------------------------------------------------------------------------- +void vpgen_clip_polyline::move_to(double x, double y) +{ + m_vertex = 0; + m_num_vertices = 0; + m_x1 = x; + m_y1 = y; + m_move_to = true; +} - //---------------------------------------------------------------------------- - void vpgen_clip_polyline::line_to(double x, double y) +//---------------------------------------------------------------------------- +void vpgen_clip_polyline::line_to(double x, double y) +{ + double x2 = x; + double y2 = y; + unsigned flags = clip_line_segment(&m_x1, &m_y1, &x2, &y2, m_clip_box); + + m_vertex = 0; + m_num_vertices = 0; + if((flags & 4) == 0) { - double x2 = x; - double y2 = y; - unsigned flags = clip_line_segment(&m_x1, &m_y1, &x2, &y2, m_clip_box); - - m_vertex = 0; - m_num_vertices = 0; - if((flags & 4) == 0) + if((flags & 1) != 0 || m_move_to) { - if((flags & 1) != 0 || m_move_to) - { - m_x[0] = m_x1; - m_y[0] = m_y1; - m_cmd[0] = path_cmd_move_to; - m_num_vertices = 1; - } - m_x[m_num_vertices] = x2; - m_y[m_num_vertices] = y2; - m_cmd[m_num_vertices++] = path_cmd_line_to; - m_move_to = (flags & 2) != 0; + m_x[0] = m_x1; + m_y[0] = m_y1; + m_cmd[0] = path_cmd_move_to; + m_num_vertices = 1; } - m_x1 = x; - m_y1 = y; + m_x[m_num_vertices] = x2; + m_y[m_num_vertices] = y2; + m_cmd[m_num_vertices++] = path_cmd_line_to; + m_move_to = (flags & 2) != 0; } + m_x1 = x; + m_y1 = y; +} - //---------------------------------------------------------------------------- - unsigned vpgen_clip_polyline::vertex(double* x, double* y) +//---------------------------------------------------------------------------- +unsigned vpgen_clip_polyline::vertex(double* x, double* y) +{ + if(m_vertex < m_num_vertices) { - if(m_vertex < m_num_vertices) - { - *x = m_x[m_vertex]; - *y = m_y[m_vertex]; - return m_cmd[m_vertex++]; - } - return path_cmd_stop; + *x = m_x[m_vertex]; + *y = m_y[m_vertex]; + return m_cmd[m_vertex++]; } + return path_cmd_stop; +} } diff -Nru mapnik-2.1.0/deps/agg/src/agg_vpgen_segmentator.cpp mapnik-2.2.0/deps/agg/src/agg_vpgen_segmentator.cpp --- mapnik-2.1.0/deps/agg/src/agg_vpgen_segmentator.cpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/deps/agg/src/agg_vpgen_segmentator.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,49 +19,49 @@ namespace agg { - void vpgen_segmentator::move_to(double x, double y) - { - m_x1 = x; - m_y1 = y; - m_dx = 0.0; - m_dy = 0.0; - m_dl = 2.0; - m_ddl = 2.0; - m_cmd = path_cmd_move_to; - } +void vpgen_segmentator::move_to(double x, double y) +{ + m_x1 = x; + m_y1 = y; + m_dx = 0.0; + m_dy = 0.0; + m_dl = 2.0; + m_ddl = 2.0; + m_cmd = path_cmd_move_to; +} - void vpgen_segmentator::line_to(double x, double y) - { - m_x1 += m_dx; - m_y1 += m_dy; - m_dx = x - m_x1; - m_dy = y - m_y1; - double len = sqrt(m_dx * m_dx + m_dy * m_dy) * m_approximation_scale; - if(len < 1e-30) len = 1e-30; - m_ddl = 1.0 / len; - m_dl = (m_cmd == path_cmd_move_to) ? 0.0 : m_ddl; - if(m_cmd == path_cmd_stop) m_cmd = path_cmd_line_to; - } +void vpgen_segmentator::line_to(double x, double y) +{ + m_x1 += m_dx; + m_y1 += m_dy; + m_dx = x - m_x1; + m_dy = y - m_y1; + double len = sqrt(m_dx * m_dx + m_dy * m_dy) * m_approximation_scale; + if(len < 1e-30) len = 1e-30; + m_ddl = 1.0 / len; + m_dl = (m_cmd == path_cmd_move_to) ? 0.0 : m_ddl; + if(m_cmd == path_cmd_stop) m_cmd = path_cmd_line_to; +} - unsigned vpgen_segmentator::vertex(double* x, double* y) - { - if(m_cmd == path_cmd_stop) return path_cmd_stop; +unsigned vpgen_segmentator::vertex(double* x, double* y) +{ + if(m_cmd == path_cmd_stop) return path_cmd_stop; - unsigned cmd = m_cmd; - m_cmd = path_cmd_line_to; - if(m_dl >= 1.0 - m_ddl) - { - m_dl = 1.0; - m_cmd = path_cmd_stop; - *x = m_x1 + m_dx; - *y = m_y1 + m_dy; - return cmd; - } - *x = m_x1 + m_dx * m_dl; - *y = m_y1 + m_dy * m_dl; - m_dl += m_ddl; + unsigned cmd = m_cmd; + m_cmd = path_cmd_line_to; + if(m_dl >= 1.0 - m_ddl) + { + m_dl = 1.0; + m_cmd = path_cmd_stop; + *x = m_x1 + m_dx; + *y = m_y1 + m_dy; return cmd; } + *x = m_x1 + m_dx * m_dl; + *y = m_y1 + m_dy * m_dl; + m_dl += m_ddl; + return cmd; +} } diff -Nru mapnik-2.1.0/deps/clipper/build.py mapnik-2.2.0/deps/clipper/build.py --- mapnik-2.1.0/deps/clipper/build.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/deps/clipper/build.py 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,32 @@ +# This file is part of Mapnik (c++ mapping toolkit) +# Copyright (C) 2013 Artem Pavlenko +# +# Mapnik is free software; you can redistribute 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 any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 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. +# +# + +import os +from glob import glob + +Import('env') + +clipper_env = env.Clone() + +if env['SUNCC']: + cxxflags = env['CUSTOM_CXXFLAGS'] + ' -O -KPIC -DNDEBUG' +else: + cxxflags = env['CUSTOM_CXXFLAGS'] + ' -O%s -fPIC -DNDEBUG' % env['OPTIMIZATION'] + +clipper_env.StaticLibrary('clipper', ['./src/clipper.cpp',], LIBS=[], CXXFLAGS=cxxflags, LINKFLAGS=env['CUSTOM_LDFLAGS']) diff -Nru mapnik-2.1.0/deps/clipper/include/clipper.hpp mapnik-2.2.0/deps/clipper/include/clipper.hpp --- mapnik-2.1.0/deps/clipper/include/clipper.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/deps/clipper/include/clipper.hpp 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,345 @@ +/******************************************************************************* +* * +* Author : Angus Johnson * +* Version : 5.1.5 * +* Date : 4 May 2013 * +* Website : http://www.angusj.com * +* Copyright : Angus Johnson 2010-2013 * +* * +* License: * +* Use, modification & distribution is subject to Boost Software License Ver 1. * +* http://www.boost.org/LICENSE_1_0.txt * +* * +* Attributions: * +* The code in this library is an extension of Bala Vatti's clipping algorithm: * +* "A generic solution to polygon clipping" * +* Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63. * +* http://portal.acm.org/citation.cfm?id=129906 * +* * +* Computer graphics and geometric modeling: implementation and algorithms * +* By Max K. Agoston * +* Springer; 1 edition (January 4, 2005) * +* http://books.google.com/books?q=vatti+clipping+agoston * +* * +* See also: * +* "Polygon Offsetting by Computing Winding Numbers" * +* Paper no. DETC2005-85513 pp. 565-575 * +* ASME 2005 International Design Engineering Technical Conferences * +* and Computers and Information in Engineering Conference (IDETC/CIE2005) * +* September 24-28, 2005 , Long Beach, California, USA * +* http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf * +* * +*******************************************************************************/ + +#ifndef clipper_hpp +#define clipper_hpp + +#include + +#include +#include +#include +#include +#include + +namespace ClipperLib { + +enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor }; +enum PolyType { ptSubject, ptClip }; +//By far the most widely used winding rules for polygon filling are +//EvenOdd & NonZero (GDI, GDI+, XLib, OpenGL, Cairo, AGG, Quartz, SVG, Gr32) +//Others rules include Positive, Negative and ABS_GTR_EQ_TWO (only in OpenGL) +//see http://glprogramming.com/red/chapter11.html +enum PolyFillType { pftEvenOdd, pftNonZero, pftPositive, pftNegative }; + +typedef signed long long long64; +typedef unsigned long long ulong64; + +struct IntPoint { +public: + long64 X; + long64 Y; + IntPoint(long64 x = 0, long64 y = 0): X(x), Y(y) {}; + friend std::ostream& operator <<(std::ostream &s, IntPoint &p); +}; + +typedef std::vector< IntPoint > Polygon; +typedef std::vector< Polygon > Polygons; + + +std::ostream& operator <<(std::ostream &s, Polygon &p); +std::ostream& operator <<(std::ostream &s, Polygons &p); + +class PolyNode; +typedef std::vector< PolyNode* > PolyNodes; + +class PolyNode +{ +public: + PolyNode(); + Polygon Contour; + PolyNodes Childs; + PolyNode* Parent; + PolyNode* GetNext() const; + bool IsHole() const; + int ChildCount() const; +private: + PolyNode* GetNextSiblingUp() const; + unsigned Index; //node index in Parent.Childs + void AddChild(PolyNode& child); + friend class Clipper; //to access Index +}; + +class PolyTree: public PolyNode +{ +public: + ~PolyTree(){Clear();}; + PolyNode* GetFirst() const; + void Clear(); + int Total() const; +private: + PolyNodes AllNodes; + friend class Clipper; //to access AllNodes +}; + +enum JoinType { jtSquare, jtRound, jtMiter }; + +bool Orientation(const Polygon &poly); +MAPNIK_DECL double Area(const Polygon &poly); + +void OffsetPolygons(const Polygons &in_polys, Polygons &out_polys, + double delta, JoinType jointype = jtSquare, double limit = 0, bool autoFix = true); + +void SimplifyPolygon(const Polygon &in_poly, Polygons &out_polys, PolyFillType fillType = pftEvenOdd); +void SimplifyPolygons(const Polygons &in_polys, Polygons &out_polys, PolyFillType fillType = pftEvenOdd); +void SimplifyPolygons(Polygons &polys, PolyFillType fillType = pftEvenOdd); + +void CleanPolygon(Polygon& in_poly, Polygon& out_poly, double distance = 1.415); +void CleanPolygons(Polygons& in_polys, Polygons& out_polys, double distance = 1.415); + +void PolyTreeToPolygons(PolyTree& polytree, Polygons& polygons); + +void ReversePolygon(Polygon& p); +void ReversePolygons(Polygons& p); + +//used internally ... +enum EdgeSide { esLeft = 1, esRight = 2}; +enum IntersectProtects { ipNone = 0, ipLeft = 1, ipRight = 2, ipBoth = 3 }; + +struct TEdge { + long64 xbot; + long64 ybot; + long64 xcurr; + long64 ycurr; + long64 xtop; + long64 ytop; + double dx; + long64 deltaX; + long64 deltaY; + PolyType polyType; + EdgeSide side; + int windDelta; //1 or -1 depending on winding direction + int windCnt; + int windCnt2; //winding count of the opposite polytype + int outIdx; + TEdge *next; + TEdge *prev; + TEdge *nextInLML; + TEdge *nextInAEL; + TEdge *prevInAEL; + TEdge *nextInSEL; + TEdge *prevInSEL; +}; + +struct IntersectNode { + TEdge *edge1; + TEdge *edge2; + IntPoint pt; + IntersectNode *next; +}; + +struct LocalMinima { + long64 Y; + TEdge *leftBound; + TEdge *rightBound; + LocalMinima *next; +}; + +struct Scanbeam { + long64 Y; + Scanbeam *next; +}; + +struct OutPt; //forward declaration + +struct OutRec { + int idx; + bool isHole; + OutRec *FirstLeft; //see comments in clipper.pas + PolyNode *polyNode; + OutPt *pts; + OutPt *bottomPt; +}; + +struct OutPt { + int idx; + IntPoint pt; + OutPt *next; + OutPt *prev; +}; + +struct JoinRec { + IntPoint pt1a; + IntPoint pt1b; + int poly1Idx; + IntPoint pt2a; + IntPoint pt2b; + int poly2Idx; +}; + +struct HorzJoinRec { + TEdge *edge; + int savedIdx; +}; + +struct IntRect { long64 left; long64 top; long64 right; long64 bottom; }; + +typedef std::vector < OutRec* > PolyOutList; +typedef std::vector < TEdge* > EdgeList; +typedef std::vector < JoinRec* > JoinList; +typedef std::vector < HorzJoinRec* > HorzJoinList; + +//ClipperBase is the ancestor to the Clipper class. It should not be +//instantiated directly. This class simply abstracts the conversion of sets of +//polygon coordinates into edge objects that are stored in a LocalMinima list. +class MAPNIK_DECL ClipperBase +{ +public: + ClipperBase(); + virtual ~ClipperBase(); + bool AddPolygon(const Polygon &pg, PolyType polyType); + bool AddPolygons( const Polygons &ppg, PolyType polyType); + virtual void Clear(); + IntRect GetBounds(); +protected: + void DisposeLocalMinimaList(); + TEdge* AddBoundsToLML(TEdge *e); + void PopLocalMinima(); + virtual void Reset(); + void InsertLocalMinima(LocalMinima *newLm); + LocalMinima *m_CurrentLM; + LocalMinima *m_MinimaList; + bool m_UseFullRange; + EdgeList m_edges; +}; + +class MAPNIK_DECL Clipper : public virtual ClipperBase +{ +public: + Clipper(); + ~Clipper(); + bool Execute(ClipType clipType, + Polygons &solution, + PolyFillType subjFillType = pftEvenOdd, + PolyFillType clipFillType = pftEvenOdd); + bool Execute(ClipType clipType, + PolyTree &polytree, + PolyFillType subjFillType = pftEvenOdd, + PolyFillType clipFillType = pftEvenOdd); + void Clear(); + bool ReverseSolution() {return m_ReverseOutput;}; + void ReverseSolution(bool value) {m_ReverseOutput = value;}; + bool ForceSimple() {return m_ForceSimple;}; + void ForceSimple(bool value) {m_ForceSimple = value;}; +protected: + void Reset(); + virtual bool ExecuteInternal(); +private: + PolyOutList m_PolyOuts; + JoinList m_Joins; + HorzJoinList m_HorizJoins; + ClipType m_ClipType; + Scanbeam *m_Scanbeam; + TEdge *m_ActiveEdges; + TEdge *m_SortedEdges; + IntersectNode *m_IntersectNodes; + bool m_ExecuteLocked; + PolyFillType m_ClipFillType; + PolyFillType m_SubjFillType; + bool m_ReverseOutput; + bool m_UsingPolyTree; + bool m_ForceSimple; + void DisposeScanbeamList(); + void SetWindingCount(TEdge& edge); + bool IsEvenOddFillType(const TEdge& edge) const; + bool IsEvenOddAltFillType(const TEdge& edge) const; + void InsertScanbeam(const long64 Y); + long64 PopScanbeam(); + void InsertLocalMinimaIntoAEL(const long64 botY); + void InsertEdgeIntoAEL(TEdge *edge); + void AddEdgeToSEL(TEdge *edge); + void CopyAELToSEL(); + void DeleteFromSEL(TEdge *e); + void DeleteFromAEL(TEdge *e); + void UpdateEdgeIntoAEL(TEdge *&e); + void SwapPositionsInSEL(TEdge *edge1, TEdge *edge2); + bool IsContributing(const TEdge& edge) const; + bool IsTopHorz(const long64 XPos); + void SwapPositionsInAEL(TEdge *edge1, TEdge *edge2); + void DoMaxima(TEdge *e, long64 topY); + void ProcessHorizontals(); + void ProcessHorizontal(TEdge *horzEdge); + void AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); + void AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); + OutRec* GetOutRec(int idx); + void AppendPolygon(TEdge *e1, TEdge *e2); + void IntersectEdges(TEdge *e1, TEdge *e2, + const IntPoint &pt, const IntersectProtects protects); + OutRec* CreateOutRec(); + void AddOutPt(TEdge *e, const IntPoint &pt); + void DisposeAllPolyPts(); + void DisposeOutRec(PolyOutList::size_type index); + bool ProcessIntersections(const long64 botY, const long64 topY); + void AddIntersectNode(TEdge *e1, TEdge *e2, const IntPoint &pt); + void BuildIntersectList(const long64 botY, const long64 topY); + void ProcessIntersectList(); + void ProcessEdgesAtTopOfScanbeam(const long64 topY); + void BuildResult(Polygons& polys); + void BuildResult2(PolyTree& polytree); + void SetHoleState(TEdge *e, OutRec *outrec); + void DisposeIntersectNodes(); + bool FixupIntersectionOrder(); + void FixupOutPolygon(OutRec &outrec); + bool IsHole(TEdge *e); + void FixHoleLinkage(OutRec &outrec); + void AddJoin(TEdge *e1, TEdge *e2, int e1OutIdx = -1, int e2OutIdx = -1); + void ClearJoins(); + void AddHorzJoin(TEdge *e, int idx); + void ClearHorzJoins(); + bool JoinPoints(const JoinRec *j, OutPt *&p1, OutPt *&p2); + void FixupJoinRecs(JoinRec *j, OutPt *pt, unsigned startIdx); + void JoinCommonEdges(); + void DoSimplePolygons(); + void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec); + void FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec); +}; + +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ + +class clipperException : public std::exception +{ + public: + clipperException(const char* description): m_descr(description) {} + virtual ~clipperException() throw() {} + virtual const char* what() const throw() {return m_descr.c_str();} + private: + std::string m_descr; +}; +//------------------------------------------------------------------------------ + +} //ClipperLib namespace + +#endif //clipper_hpp + + diff -Nru mapnik-2.1.0/deps/clipper/src/clipper.cpp mapnik-2.2.0/deps/clipper/src/clipper.cpp --- mapnik-2.1.0/deps/clipper/src/clipper.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/deps/clipper/src/clipper.cpp 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,3574 @@ +/******************************************************************************* +* * +* Author : Angus Johnson * +* Version : 5.1.5 * +* Date : 4 May 2013 * +* Website : http://www.angusj.com * +* Copyright : Angus Johnson 2010-2013 * +* * +* License: * +* Use, modification & distribution is subject to Boost Software License Ver 1. * +* http://www.boost.org/LICENSE_1_0.txt * +* * +* Attributions: * +* The code in this library is an extension of Bala Vatti's clipping algorithm: * +* "A generic solution to polygon clipping" * +* Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63. * +* http://portal.acm.org/citation.cfm?id=129906 * +* * +* Computer graphics and geometric modeling: implementation and algorithms * +* By Max K. Agoston * +* Springer; 1 edition (January 4, 2005) * +* http://books.google.com/books?q=vatti+clipping+agoston * +* * +* See also: * +* "Polygon Offsetting by Computing Winding Numbers" * +* Paper no. DETC2005-85513 pp. 565-575 * +* ASME 2005 International Design Engineering Technical Conferences * +* and Computers and Information in Engineering Conference (IDETC/CIE2005) * +* September 24-28, 2005 , Long Beach, California, USA * +* http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf * +* * +*******************************************************************************/ + +/******************************************************************************* +* * +* This is a translation of the Delphi Clipper library and the naming style * +* used has retained a Delphi flavour. * +* * +*******************************************************************************/ + +#include "clipper.hpp" +#include +#include +#include +#include +#include +#include +#include + +namespace ClipperLib { + +static long64 const loRange = 0x3FFFFFFF; +static long64 const hiRange = 0x3FFFFFFFFFFFFFFFLL; +static double const pi = 3.141592653589793238; +enum Direction { dRightToLeft, dLeftToRight }; + +#define HORIZONTAL (-1.0E+40) +#define TOLERANCE (1.0e-20) +#define NEAR_ZERO(val) (((val) > -TOLERANCE) && ((val) < TOLERANCE)) +#define NEAR_EQUAL(a, b) NEAR_ZERO((a) - (b)) + +inline long64 Abs(long64 val) +{ + return val < 0 ? -val : val; +} + +//------------------------------------------------------------------------------ +// PolyTree methods ... +//------------------------------------------------------------------------------ + +void PolyTree::Clear() +{ + for (PolyNodes::size_type i = 0; i < AllNodes.size(); ++i) + delete AllNodes[i]; + AllNodes.resize(0); + Childs.resize(0); +} +//------------------------------------------------------------------------------ + +PolyNode* PolyTree::GetFirst() const +{ + if (!Childs.empty()) + return Childs[0]; + else + return 0; +} +//------------------------------------------------------------------------------ + +int PolyTree::Total() const +{ + return AllNodes.size(); +} + +//------------------------------------------------------------------------------ +// PolyNode methods ... +//------------------------------------------------------------------------------ + +PolyNode::PolyNode(): Childs(), Parent(0), Index(0) +{ +} +//------------------------------------------------------------------------------ + +int PolyNode::ChildCount() const +{ + return Childs.size(); +} +//------------------------------------------------------------------------------ + +void PolyNode::AddChild(PolyNode& child) +{ + unsigned cnt = Childs.size(); + Childs.push_back(&child); + child.Parent = this; + child.Index = cnt; +} +//------------------------------------------------------------------------------ + +PolyNode* PolyNode::GetNext() const +{ + if (!Childs.empty()) + return Childs[0]; + else + return GetNextSiblingUp(); +} +//------------------------------------------------------------------------------ + +PolyNode* PolyNode::GetNextSiblingUp() const +{ + if (!Parent) //protects against PolyTree.GetNextSiblingUp() + return 0; + else if (Index == Parent->Childs.size() - 1) + return Parent->GetNextSiblingUp(); + else + return Parent->Childs[Index + 1]; +} +//------------------------------------------------------------------------------ + +bool PolyNode::IsHole() const +{ + bool result = true; + PolyNode* node = Parent; + while (node) + { + result = !result; + node = node->Parent; + } + return result; +} + +//------------------------------------------------------------------------------ +// Int128 class (enables safe math on signed 64bit integers) +// eg Int128 val1((long64)9223372036854775807); //ie 2^63 -1 +// Int128 val2((long64)9223372036854775807); +// Int128 val3 = val1 * val2; +// val3.AsString => "85070591730234615847396907784232501249" (8.5e+37) +//------------------------------------------------------------------------------ + +class Int128 +{ + public: + + ulong64 lo; + long64 hi; + + Int128(long64 _lo = 0) + { + lo = (ulong64)_lo; + if (_lo < 0) hi = -1; else hi = 0; + } + + + Int128(const Int128 &val): lo(val.lo), hi(val.hi){} + + Int128(const long64& _hi, const ulong64& _lo): lo(_lo), hi(_hi){} + + long64 operator = (const long64 &val) + { + lo = (ulong64)val; + if (val < 0) hi = -1; else hi = 0; + return val; + } + + bool operator == (const Int128 &val) const + {return (hi == val.hi && lo == val.lo);} + + bool operator != (const Int128 &val) const + { return !(*this == val);} + + bool operator > (const Int128 &val) const + { + if (hi != val.hi) + return hi > val.hi; + else + return lo > val.lo; + } + + bool operator < (const Int128 &val) const + { + if (hi != val.hi) + return hi < val.hi; + else + return lo < val.lo; + } + + bool operator >= (const Int128 &val) const + { return !(*this < val);} + + bool operator <= (const Int128 &val) const + { return !(*this > val);} + + Int128& operator += (const Int128 &rhs) + { + hi += rhs.hi; + lo += rhs.lo; + if (lo < rhs.lo) hi++; + return *this; + } + + Int128 operator + (const Int128 &rhs) const + { + Int128 result(*this); + result+= rhs; + return result; + } + + Int128& operator -= (const Int128 &rhs) + { + *this += -rhs; + return *this; + } + + Int128 operator - (const Int128 &rhs) const + { + Int128 result(*this); + result -= rhs; + return result; + } + + Int128 operator-() const //unary negation + { + if (lo == 0) + return Int128(-hi,0); + else + return Int128(~hi,~lo +1); + } + + Int128 operator/ (const Int128 &rhs) const + { + if (rhs.lo == 0 && rhs.hi == 0) + throw "Int128 operator/: divide by zero"; + + bool negate = (rhs.hi < 0) != (hi < 0); + Int128 dividend = *this; + Int128 divisor = rhs; + if (dividend.hi < 0) dividend = -dividend; + if (divisor.hi < 0) divisor = -divisor; + + if (divisor < dividend) + { + Int128 result = Int128(0); + Int128 cntr = Int128(1); + while (divisor.hi >= 0 && !(divisor > dividend)) + { + divisor.hi <<= 1; + if ((long64)divisor.lo < 0) divisor.hi++; + divisor.lo <<= 1; + + cntr.hi <<= 1; + if ((long64)cntr.lo < 0) cntr.hi++; + cntr.lo <<= 1; + } + divisor.lo >>= 1; + if ((divisor.hi & 1) == 1) + divisor.lo |= 0x8000000000000000LL; + divisor.hi = (ulong64)divisor.hi >> 1; + + cntr.lo >>= 1; + if ((cntr.hi & 1) == 1) + cntr.lo |= 0x8000000000000000LL; + cntr.hi >>= 1; + + while (cntr.hi != 0 || cntr.lo != 0) + { + if (!(dividend < divisor)) + { + dividend -= divisor; + result.hi |= cntr.hi; + result.lo |= cntr.lo; + } + divisor.lo >>= 1; + if ((divisor.hi & 1) == 1) + divisor.lo |= 0x8000000000000000LL; + divisor.hi >>= 1; + + cntr.lo >>= 1; + if ((cntr.hi & 1) == 1) + cntr.lo |= 0x8000000000000000LL; + cntr.hi >>= 1; + } + if (negate) result = -result; + return result; + } + else if (rhs.hi == this->hi && rhs.lo == this->lo) + return Int128(1); + else + return Int128(0); + } + + double AsDouble() const + { + const double shift64 = 18446744073709551616.0; //2^64 + if (hi < 0) + { + if (lo == 0) return (double)hi * shift64; + else return -(double)(~lo + ~hi * shift64); + } + else + return (double)(lo + hi * shift64); + } +}; + +Int128 Int128Mul (long64 lhs, long64 rhs) +{ + bool negate = (lhs < 0) != (rhs < 0); + + if (lhs < 0) lhs = -lhs; + ulong64 int1Hi = ulong64(lhs) >> 32; + ulong64 int1Lo = ulong64(lhs & 0xFFFFFFFF); + + if (rhs < 0) rhs = -rhs; + ulong64 int2Hi = ulong64(rhs) >> 32; + ulong64 int2Lo = ulong64(rhs & 0xFFFFFFFF); + + //nb: see comments in clipper.pas + ulong64 a = int1Hi * int2Hi; + ulong64 b = int1Lo * int2Lo; + ulong64 c = int1Hi * int2Lo + int1Lo * int2Hi; + + Int128 tmp; + tmp.hi = long64(a + (c >> 32)); + tmp.lo = long64(c << 32); + tmp.lo += long64(b); + if (tmp.lo < b) tmp.hi++; + if (negate) tmp = -tmp; + return tmp; +} + +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ + +bool FullRangeNeeded(const Polygon &pts) +{ + bool result = false; + for (Polygon::size_type i = 0; i < pts.size(); ++i) + { + if (Abs(pts[i].X) > hiRange || Abs(pts[i].Y) > hiRange) + throw "Coordinate exceeds range bounds."; + else if (Abs(pts[i].X) > loRange || Abs(pts[i].Y) > loRange) + result = true; + } + return result; +} +//------------------------------------------------------------------------------ + +bool Orientation(const Polygon &poly) +{ + return Area(poly) >= 0; +} +//------------------------------------------------------------------------------ + +inline bool PointsEqual( const IntPoint &pt1, const IntPoint &pt2) +{ + return ( pt1.X == pt2.X && pt1.Y == pt2.Y ); +} +//------------------------------------------------------------------------------ + +double Area(const Polygon &poly) +{ + int highI = (int)poly.size() -1; + if (highI < 2) return 0; + + if (FullRangeNeeded(poly)) { + Int128 a; + a = Int128Mul(poly[highI].X + poly[0].X, poly[0].Y - poly[highI].Y); + for (int i = 1; i <= highI; ++i) + a += Int128Mul(poly[i - 1].X + poly[i].X, poly[i].Y - poly[i -1].Y); + return a.AsDouble() / 2; + } + else + { + double a; + a = ((double)poly[highI].X + poly[0].X) * ((double)poly[0].Y - poly[highI].Y); + for (int i = 1; i <= highI; ++i) + a += ((double)poly[i - 1].X + poly[i].X) * ((double)poly[i].Y - poly[i - 1].Y); + return a / 2; + } +} +//------------------------------------------------------------------------------ + +double Area(const OutRec &outRec, bool UseFullInt64Range) +{ + OutPt *op = outRec.pts; + if (!op) return 0; + if (UseFullInt64Range) { + Int128 a(0); + do { + a += Int128Mul(op->pt.X + op->prev->pt.X, op->prev->pt.Y - op->pt.Y); + op = op->next; + } while (op != outRec.pts); + return a.AsDouble() / 2; + } + else + { + double a = 0; + do { + a = a + (op->pt.X + op->prev->pt.X) * (op->prev->pt.Y - op->pt.Y); + op = op->next; + } while (op != outRec.pts); + return a / 2; + } +} +//------------------------------------------------------------------------------ + +bool PointIsVertex(const IntPoint &pt, OutPt *pp) +{ + OutPt *pp2 = pp; + do + { + if (PointsEqual(pp2->pt, pt)) return true; + pp2 = pp2->next; + } + while (pp2 != pp); + return false; +} +//------------------------------------------------------------------------------ + +bool PointOnLineSegment(const IntPoint pt, + const IntPoint linePt1, const IntPoint linePt2, bool UseFullInt64Range) +{ + if (UseFullInt64Range) + return ((pt.X == linePt1.X) && (pt.Y == linePt1.Y)) || + ((pt.X == linePt2.X) && (pt.Y == linePt2.Y)) || + (((pt.X > linePt1.X) == (pt.X < linePt2.X)) && + ((pt.Y > linePt1.Y) == (pt.Y < linePt2.Y)) && + ((Int128Mul((pt.X - linePt1.X), (linePt2.Y - linePt1.Y)) == + Int128Mul((linePt2.X - linePt1.X), (pt.Y - linePt1.Y))))); + else + return ((pt.X == linePt1.X) && (pt.Y == linePt1.Y)) || + ((pt.X == linePt2.X) && (pt.Y == linePt2.Y)) || + (((pt.X > linePt1.X) == (pt.X < linePt2.X)) && + ((pt.Y > linePt1.Y) == (pt.Y < linePt2.Y)) && + ((pt.X - linePt1.X) * (linePt2.Y - linePt1.Y) == + (linePt2.X - linePt1.X) * (pt.Y - linePt1.Y))); +} +//------------------------------------------------------------------------------ + +bool PointOnPolygon(const IntPoint pt, + OutPt *pp, bool UseFullInt64Range) +{ + OutPt *pp2 = pp; + for (;;) + { + if (PointOnLineSegment(pt, pp2->pt, pp2->next->pt, UseFullInt64Range)) + return true; + pp2 = pp2->next; + if (pp2 == pp) return false; + } +} +//------------------------------------------------------------------------------ + +bool PointInPolygon(const IntPoint &pt, OutPt *pp, bool UseFullInt64Range) +{ + OutPt *pp2 = pp; + bool result = false; + if (UseFullInt64Range) { + do + { + if ((((pp2->pt.Y <= pt.Y) && (pt.Y < pp2->prev->pt.Y)) || + ((pp2->prev->pt.Y <= pt.Y) && (pt.Y < pp2->pt.Y))) && + Int128(pt.X - pp2->pt.X) < + Int128Mul(pp2->prev->pt.X - pp2->pt.X, pt.Y - pp2->pt.Y) / + Int128(pp2->prev->pt.Y - pp2->pt.Y)) + result = !result; + pp2 = pp2->next; + } + while (pp2 != pp); + } + else + { + do + { + if ((((pp2->pt.Y <= pt.Y) && (pt.Y < pp2->prev->pt.Y)) || + ((pp2->prev->pt.Y <= pt.Y) && (pt.Y < pp2->pt.Y))) && + (pt.X < (pp2->prev->pt.X - pp2->pt.X) * (pt.Y - pp2->pt.Y) / + (pp2->prev->pt.Y - pp2->pt.Y) + pp2->pt.X )) result = !result; + pp2 = pp2->next; + } + while (pp2 != pp); + } + return result; +} +//------------------------------------------------------------------------------ + +bool SlopesEqual(TEdge &e1, TEdge &e2, bool UseFullInt64Range) +{ + if (UseFullInt64Range) + return Int128Mul(e1.deltaY, e2.deltaX) == Int128Mul(e1.deltaX, e2.deltaY); + else return e1.deltaY * e2.deltaX == e1.deltaX * e2.deltaY; +} +//------------------------------------------------------------------------------ + +bool SlopesEqual(const IntPoint pt1, const IntPoint pt2, + const IntPoint pt3, bool UseFullInt64Range) +{ + if (UseFullInt64Range) + return Int128Mul(pt1.Y-pt2.Y, pt2.X-pt3.X) == Int128Mul(pt1.X-pt2.X, pt2.Y-pt3.Y); + else return (pt1.Y-pt2.Y)*(pt2.X-pt3.X) == (pt1.X-pt2.X)*(pt2.Y-pt3.Y); +} +//------------------------------------------------------------------------------ + +bool SlopesEqual(const IntPoint pt1, const IntPoint pt2, + const IntPoint pt3, const IntPoint pt4, bool UseFullInt64Range) +{ + if (UseFullInt64Range) + return Int128Mul(pt1.Y-pt2.Y, pt3.X-pt4.X) == Int128Mul(pt1.X-pt2.X, pt3.Y-pt4.Y); + else return (pt1.Y-pt2.Y)*(pt3.X-pt4.X) == (pt1.X-pt2.X)*(pt3.Y-pt4.Y); +} +//------------------------------------------------------------------------------ + +double GetDx(const IntPoint pt1, const IntPoint pt2) +{ + return (pt1.Y == pt2.Y) ? + HORIZONTAL : (double)(pt2.X - pt1.X) / (pt2.Y - pt1.Y); +} +//--------------------------------------------------------------------------- + +void SetDx(TEdge &e) +{ + e.deltaX = (e.xtop - e.xbot); + e.deltaY = (e.ytop - e.ybot); + + if (e.deltaY == 0) e.dx = HORIZONTAL; + else e.dx = (double)(e.deltaX) / e.deltaY; +} +//--------------------------------------------------------------------------- + +void SwapSides(TEdge &edge1, TEdge &edge2) +{ + EdgeSide side = edge1.side; + edge1.side = edge2.side; + edge2.side = side; +} +//------------------------------------------------------------------------------ + +void SwapPolyIndexes(TEdge &edge1, TEdge &edge2) +{ + int outIdx = edge1.outIdx; + edge1.outIdx = edge2.outIdx; + edge2.outIdx = outIdx; +} +//------------------------------------------------------------------------------ + +inline long64 Round(double val) +{ + return (val < 0) ? static_cast(val - 0.5) : static_cast(val + 0.5); +} +//------------------------------------------------------------------------------ + +long64 TopX(TEdge &edge, const long64 currentY) +{ + return ( currentY == edge.ytop ) ? + edge.xtop : edge.xbot + Round(edge.dx *(currentY - edge.ybot)); +} +//------------------------------------------------------------------------------ + +bool IntersectPoint(TEdge &edge1, TEdge &edge2, + IntPoint &ip, bool UseFullInt64Range) +{ + double b1, b2; + if (SlopesEqual(edge1, edge2, UseFullInt64Range)) + { + if (edge2.ybot > edge1.ybot) ip.Y = edge2.ybot; + else ip.Y = edge1.ybot; + return false; + } + else if (NEAR_ZERO(edge1.dx)) + { + ip.X = edge1.xbot; + if (NEAR_EQUAL(edge2.dx, HORIZONTAL)) + ip.Y = edge2.ybot; + else + { + b2 = edge2.ybot - (edge2.xbot / edge2.dx); + ip.Y = Round(ip.X / edge2.dx + b2); + } + } + else if (NEAR_ZERO(edge2.dx)) + { + ip.X = edge2.xbot; + if (NEAR_EQUAL(edge1.dx, HORIZONTAL)) + ip.Y = edge1.ybot; + else + { + b1 = edge1.ybot - (edge1.xbot / edge1.dx); + ip.Y = Round(ip.X / edge1.dx + b1); + } + } + else + { + b1 = edge1.xbot - edge1.ybot * edge1.dx; + b2 = edge2.xbot - edge2.ybot * edge2.dx; + double q = (b2-b1) / (edge1.dx - edge2.dx); + ip.Y = Round(q); + if (std::fabs(edge1.dx) < std::fabs(edge2.dx)) + ip.X = Round(edge1.dx * q + b1); + else + ip.X = Round(edge2.dx * q + b2); + } + + if (ip.Y < edge1.ytop || ip.Y < edge2.ytop) + { + if (edge1.ytop > edge2.ytop) + { + ip.X = edge1.xtop; + ip.Y = edge1.ytop; + return TopX(edge2, edge1.ytop) < edge1.xtop; + } + else + { + ip.X = edge2.xtop; + ip.Y = edge2.ytop; + return TopX(edge1, edge2.ytop) > edge2.xtop; + } + } + else + return true; +} +//------------------------------------------------------------------------------ + +void ReversePolyPtLinks(OutPt *pp) +{ + if (!pp) return; + OutPt *pp1, *pp2; + pp1 = pp; + do { + pp2 = pp1->next; + pp1->next = pp1->prev; + pp1->prev = pp2; + pp1 = pp2; + } while( pp1 != pp ); +} +//------------------------------------------------------------------------------ + +void DisposeOutPts(OutPt*& pp) +{ + if (pp == 0) return; + pp->prev->next = 0; + while( pp ) + { + OutPt *tmpPp = pp; + pp = pp->next; + delete tmpPp; + } +} +//------------------------------------------------------------------------------ + +void InitEdge(TEdge *e, TEdge *eNext, + TEdge *ePrev, const IntPoint &pt, PolyType polyType) +{ + std::memset( e, 0, sizeof( TEdge )); + + e->next = eNext; + e->prev = ePrev; + e->xcurr = pt.X; + e->ycurr = pt.Y; + if (e->ycurr >= e->next->ycurr) + { + e->xbot = e->xcurr; + e->ybot = e->ycurr; + e->xtop = e->next->xcurr; + e->ytop = e->next->ycurr; + e->windDelta = 1; + } else + { + e->xtop = e->xcurr; + e->ytop = e->ycurr; + e->xbot = e->next->xcurr; + e->ybot = e->next->ycurr; + e->windDelta = -1; + } + SetDx(*e); + e->polyType = polyType; + e->outIdx = -1; +} +//------------------------------------------------------------------------------ + +inline void SwapX(TEdge &e) +{ + //swap horizontal edges' top and bottom x's so they follow the natural + //progression of the bounds - ie so their xbots will align with the + //adjoining lower edge. [Helpful in the ProcessHorizontal() method.] + e.xcurr = e.xtop; + e.xtop = e.xbot; + e.xbot = e.xcurr; +} +//------------------------------------------------------------------------------ + +void SwapPoints(IntPoint &pt1, IntPoint &pt2) +{ + IntPoint tmp = pt1; + pt1 = pt2; + pt2 = tmp; +} +//------------------------------------------------------------------------------ + +bool GetOverlapSegment(IntPoint pt1a, IntPoint pt1b, IntPoint pt2a, + IntPoint pt2b, IntPoint &pt1, IntPoint &pt2) +{ + //precondition: segments are colinear. + if (Abs(pt1a.X - pt1b.X) > Abs(pt1a.Y - pt1b.Y)) + { + if (pt1a.X > pt1b.X) SwapPoints(pt1a, pt1b); + if (pt2a.X > pt2b.X) SwapPoints(pt2a, pt2b); + if (pt1a.X > pt2a.X) pt1 = pt1a; else pt1 = pt2a; + if (pt1b.X < pt2b.X) pt2 = pt1b; else pt2 = pt2b; + return pt1.X < pt2.X; + } else + { + if (pt1a.Y < pt1b.Y) SwapPoints(pt1a, pt1b); + if (pt2a.Y < pt2b.Y) SwapPoints(pt2a, pt2b); + if (pt1a.Y < pt2a.Y) pt1 = pt1a; else pt1 = pt2a; + if (pt1b.Y > pt2b.Y) pt2 = pt1b; else pt2 = pt2b; + return pt1.Y > pt2.Y; + } +} +//------------------------------------------------------------------------------ + +bool FirstIsBottomPt(const OutPt* btmPt1, const OutPt* btmPt2) +{ + OutPt *p = btmPt1->prev; + while (PointsEqual(p->pt, btmPt1->pt) && (p != btmPt1)) p = p->prev; + double dx1p = std::fabs(GetDx(btmPt1->pt, p->pt)); + p = btmPt1->next; + while (PointsEqual(p->pt, btmPt1->pt) && (p != btmPt1)) p = p->next; + double dx1n = std::fabs(GetDx(btmPt1->pt, p->pt)); + + p = btmPt2->prev; + while (PointsEqual(p->pt, btmPt2->pt) && (p != btmPt2)) p = p->prev; + double dx2p = std::fabs(GetDx(btmPt2->pt, p->pt)); + p = btmPt2->next; + while (PointsEqual(p->pt, btmPt2->pt) && (p != btmPt2)) p = p->next; + double dx2n = std::fabs(GetDx(btmPt2->pt, p->pt)); + return (dx1p >= dx2p && dx1p >= dx2n) || (dx1n >= dx2p && dx1n >= dx2n); +} +//------------------------------------------------------------------------------ + +OutPt* GetBottomPt(OutPt *pp) +{ + OutPt* dups = 0; + OutPt* p = pp->next; + while (p != pp) + { + if (p->pt.Y > pp->pt.Y) + { + pp = p; + dups = 0; + } + else if (p->pt.Y == pp->pt.Y && p->pt.X <= pp->pt.X) + { + if (p->pt.X < pp->pt.X) + { + dups = 0; + pp = p; + } else + { + if (p->next != pp && p->prev != pp) dups = p; + } + } + p = p->next; + } + if (dups) + { + //there appears to be at least 2 vertices at bottomPt so ... + while (dups != p) + { + if (!FirstIsBottomPt(p, dups)) pp = dups; + dups = dups->next; + while (!PointsEqual(dups->pt, pp->pt)) dups = dups->next; + } + } + return pp; +} +//------------------------------------------------------------------------------ + +bool FindSegment(OutPt* &pp, bool UseFullInt64Range, + IntPoint &pt1, IntPoint &pt2) +{ + //outPt1 & outPt2 => the overlap segment (if the function returns true) + if (!pp) return false; + OutPt* pp2 = pp; + IntPoint pt1a = pt1, pt2a = pt2; + do + { + if (SlopesEqual(pt1a, pt2a, pp->pt, pp->prev->pt, UseFullInt64Range) && + SlopesEqual(pt1a, pt2a, pp->pt, UseFullInt64Range) && + GetOverlapSegment(pt1a, pt2a, pp->pt, pp->prev->pt, pt1, pt2)) + return true; + pp = pp->next; + } + while (pp != pp2); + return false; +} +//------------------------------------------------------------------------------ + +bool Pt3IsBetweenPt1AndPt2(const IntPoint pt1, + const IntPoint pt2, const IntPoint pt3) +{ + if (PointsEqual(pt1, pt3) || PointsEqual(pt2, pt3)) return true; + else if (pt1.X != pt2.X) return (pt1.X < pt3.X) == (pt3.X < pt2.X); + else return (pt1.Y < pt3.Y) == (pt3.Y < pt2.Y); +} +//------------------------------------------------------------------------------ + +OutPt* InsertPolyPtBetween(OutPt* p1, OutPt* p2, const IntPoint pt) +{ + if (p1 == p2) throw "JoinError"; + OutPt* result = new OutPt; + result->pt = pt; + if (p2 == p1->next) + { + p1->next = result; + p2->prev = result; + result->next = p2; + result->prev = p1; + } else + { + p2->next = result; + p1->prev = result; + result->next = p1; + result->prev = p2; + } + return result; +} + +//------------------------------------------------------------------------------ +// ClipperBase class methods ... +//------------------------------------------------------------------------------ + +ClipperBase::ClipperBase() //constructor +{ + m_MinimaList = 0; + m_CurrentLM = 0; + m_UseFullRange = true; +} +//------------------------------------------------------------------------------ + +ClipperBase::~ClipperBase() //destructor +{ + Clear(); +} +//------------------------------------------------------------------------------ + +bool ClipperBase::AddPolygon( const Polygon &pg, PolyType polyType) +{ + int len = (int)pg.size(); + if (len < 3) return false; + + Polygon p(len); + p[0] = pg[0]; + int j = 0; + + long64 maxVal; + if (m_UseFullRange) maxVal = hiRange; else maxVal = loRange; + + for (int i = 0; i < len; ++i) + { + if (Abs(pg[i].X) > maxVal || Abs(pg[i].Y) > maxVal) + { + if (Abs(pg[i].X) > hiRange || Abs(pg[i].Y) > hiRange) + throw "Coordinate exceeds range bounds"; + maxVal = hiRange; + m_UseFullRange = true; + } + + if (i == 0 || PointsEqual(p[j], pg[i])) continue; + else if (j > 0 && SlopesEqual(p[j-1], p[j], pg[i], m_UseFullRange)) + { + if (PointsEqual(p[j-1], pg[i])) j--; + } else j++; + p[j] = pg[i]; + } + if (j < 2) return false; + + len = j+1; + while (len > 2) + { + //nb: test for point equality before testing slopes ... + if (PointsEqual(p[j], p[0])) j--; + else if (PointsEqual(p[0], p[1]) || + SlopesEqual(p[j], p[0], p[1], m_UseFullRange)) + p[0] = p[j--]; + else if (SlopesEqual(p[j-1], p[j], p[0], m_UseFullRange)) j--; + else if (SlopesEqual(p[0], p[1], p[2], m_UseFullRange)) + { + for (int i = 2; i <= j; ++i) p[i-1] = p[i]; + j--; + } + else break; + len--; + } + if (len < 3) return false; + + //create a new edge array ... + TEdge *edges = new TEdge [len]; + m_edges.push_back(edges); + + //convert vertices to a double-linked-list of edges and initialize ... + edges[0].xcurr = p[0].X; + edges[0].ycurr = p[0].Y; + InitEdge(&edges[len-1], &edges[0], &edges[len-2], p[len-1], polyType); + for (int i = len-2; i > 0; --i) + InitEdge(&edges[i], &edges[i+1], &edges[i-1], p[i], polyType); + InitEdge(&edges[0], &edges[1], &edges[len-1], p[0], polyType); + + //reset xcurr & ycurr and find 'eHighest' (given the Y axis coordinates + //increase downward so the 'highest' edge will have the smallest ytop) ... + TEdge *e = &edges[0]; + TEdge *eHighest = e; + do + { + e->xcurr = e->xbot; + e->ycurr = e->ybot; + if (e->ytop < eHighest->ytop) eHighest = e; + e = e->next; + } + while ( e != &edges[0]); + + //make sure eHighest is positioned so the following loop works safely ... + if (eHighest->windDelta > 0) eHighest = eHighest->next; + if (NEAR_EQUAL(eHighest->dx, HORIZONTAL)) eHighest = eHighest->next; + + //finally insert each local minima ... + e = eHighest; + do { + e = AddBoundsToLML(e); + } + while( e != eHighest ); + return true; +} +//------------------------------------------------------------------------------ + +void ClipperBase::InsertLocalMinima(LocalMinima *newLm) +{ + if( ! m_MinimaList ) + { + m_MinimaList = newLm; + } + else if( newLm->Y >= m_MinimaList->Y ) + { + newLm->next = m_MinimaList; + m_MinimaList = newLm; + } else + { + LocalMinima* tmpLm = m_MinimaList; + while( tmpLm->next && ( newLm->Y < tmpLm->next->Y ) ) + tmpLm = tmpLm->next; + newLm->next = tmpLm->next; + tmpLm->next = newLm; + } +} +//------------------------------------------------------------------------------ + +TEdge* ClipperBase::AddBoundsToLML(TEdge *e) +{ + //Starting at the top of one bound we progress to the bottom where there's + //a local minima. We then go to the top of the next bound. These two bounds + //form the left and right (or right and left) bounds of the local minima. + e->nextInLML = 0; + e = e->next; + for (;;) + { + if (NEAR_EQUAL(e->dx, HORIZONTAL)) + { + //nb: proceed through horizontals when approaching from their right, + // but break on horizontal minima if approaching from their left. + // This ensures 'local minima' are always on the left of horizontals. + if (e->next->ytop < e->ytop && e->next->xbot > e->prev->xbot) break; + if (e->xtop != e->prev->xbot) SwapX(*e); + e->nextInLML = e->prev; + } + else if (e->ycurr == e->prev->ycurr) break; + else e->nextInLML = e->prev; + e = e->next; + } + + //e and e.prev are now at a local minima ... + LocalMinima* newLm = new LocalMinima; + newLm->next = 0; + newLm->Y = e->prev->ybot; + + if ( NEAR_EQUAL(e->dx, HORIZONTAL) ) //horizontal edges never start a left bound + { + if (e->xbot != e->prev->xbot) SwapX(*e); + newLm->leftBound = e->prev; + newLm->rightBound = e; + } else if (e->dx < e->prev->dx) + { + newLm->leftBound = e->prev; + newLm->rightBound = e; + } else + { + newLm->leftBound = e; + newLm->rightBound = e->prev; + } + newLm->leftBound->side = esLeft; + newLm->rightBound->side = esRight; + InsertLocalMinima( newLm ); + + for (;;) + { + if ( e->next->ytop == e->ytop && !NEAR_EQUAL(e->next->dx, HORIZONTAL) ) break; + e->nextInLML = e->next; + e = e->next; + if ( NEAR_EQUAL(e->dx, HORIZONTAL) && e->xbot != e->prev->xtop) SwapX(*e); + } + return e->next; +} +//------------------------------------------------------------------------------ + +bool ClipperBase::AddPolygons(const Polygons &ppg, PolyType polyType) +{ + bool result = false; + for (Polygons::size_type i = 0; i < ppg.size(); ++i) + if (AddPolygon(ppg[i], polyType)) result = true; + return result; +} +//------------------------------------------------------------------------------ + +void ClipperBase::Clear() +{ + DisposeLocalMinimaList(); + for (EdgeList::size_type i = 0; i < m_edges.size(); ++i) delete [] m_edges[i]; + m_edges.clear(); + m_UseFullRange = false; +} +//------------------------------------------------------------------------------ + +void ClipperBase::Reset() +{ + m_CurrentLM = m_MinimaList; + if( !m_CurrentLM ) return; //ie nothing to process + + //reset all edges ... + LocalMinima* lm = m_MinimaList; + while( lm ) + { + TEdge* e = lm->leftBound; + while( e ) + { + e->xcurr = e->xbot; + e->ycurr = e->ybot; + e->side = esLeft; + e->outIdx = -1; + e = e->nextInLML; + } + e = lm->rightBound; + while( e ) + { + e->xcurr = e->xbot; + e->ycurr = e->ybot; + e->side = esRight; + e->outIdx = -1; + e = e->nextInLML; + } + lm = lm->next; + } +} +//------------------------------------------------------------------------------ + +void ClipperBase::DisposeLocalMinimaList() +{ + while( m_MinimaList ) + { + LocalMinima* tmpLm = m_MinimaList->next; + delete m_MinimaList; + m_MinimaList = tmpLm; + } + m_CurrentLM = 0; +} +//------------------------------------------------------------------------------ + +void ClipperBase::PopLocalMinima() +{ + if( ! m_CurrentLM ) return; + m_CurrentLM = m_CurrentLM->next; +} +//------------------------------------------------------------------------------ + +IntRect ClipperBase::GetBounds() +{ + IntRect result; + LocalMinima* lm = m_MinimaList; + if (!lm) + { + result.left = result.top = result.right = result.bottom = 0; + return result; + } + result.left = lm->leftBound->xbot; + result.top = lm->leftBound->ybot; + result.right = lm->leftBound->xbot; + result.bottom = lm->leftBound->ybot; + while (lm) + { + if (lm->leftBound->ybot > result.bottom) + result.bottom = lm->leftBound->ybot; + TEdge* e = lm->leftBound; + for (;;) { + TEdge* bottomE = e; + while (e->nextInLML) + { + if (e->xbot < result.left) result.left = e->xbot; + if (e->xbot > result.right) result.right = e->xbot; + e = e->nextInLML; + } + if (e->xbot < result.left) result.left = e->xbot; + if (e->xbot > result.right) result.right = e->xbot; + if (e->xtop < result.left) result.left = e->xtop; + if (e->xtop > result.right) result.right = e->xtop; + if (e->ytop < result.top) result.top = e->ytop; + + if (bottomE == lm->leftBound) e = lm->rightBound; + else break; + } + lm = lm->next; + } + return result; +} + + +//------------------------------------------------------------------------------ +// TClipper methods ... +//------------------------------------------------------------------------------ + +Clipper::Clipper() : ClipperBase() //constructor +{ + m_Scanbeam = 0; + m_ActiveEdges = 0; + m_SortedEdges = 0; + m_IntersectNodes = 0; + m_ExecuteLocked = false; + m_UseFullRange = false; + m_ReverseOutput = false; + m_ForceSimple = false; +} +//------------------------------------------------------------------------------ + +Clipper::~Clipper() //destructor +{ + Clear(); + DisposeScanbeamList(); +} +//------------------------------------------------------------------------------ + +void Clipper::Clear() +{ + if (m_edges.empty()) return; //avoids problems with ClipperBase destructor + DisposeAllPolyPts(); + ClipperBase::Clear(); +} +//------------------------------------------------------------------------------ + +void Clipper::DisposeScanbeamList() +{ + while ( m_Scanbeam ) { + Scanbeam* sb2 = m_Scanbeam->next; + delete m_Scanbeam; + m_Scanbeam = sb2; + } +} +//------------------------------------------------------------------------------ + +void Clipper::Reset() +{ + ClipperBase::Reset(); + m_Scanbeam = 0; + m_ActiveEdges = 0; + m_SortedEdges = 0; + DisposeAllPolyPts(); + LocalMinima* lm = m_MinimaList; + while (lm) + { + InsertScanbeam(lm->Y); + InsertScanbeam(lm->leftBound->ytop); + lm = lm->next; + } +} +//------------------------------------------------------------------------------ + +bool Clipper::Execute(ClipType clipType, Polygons &solution, + PolyFillType subjFillType, PolyFillType clipFillType) +{ + if( m_ExecuteLocked ) return false; + m_ExecuteLocked = true; + solution.resize(0); + m_SubjFillType = subjFillType; + m_ClipFillType = clipFillType; + m_ClipType = clipType; + m_UsingPolyTree = false; + bool succeeded = ExecuteInternal(); + if (succeeded) BuildResult(solution); + m_ExecuteLocked = false; + return succeeded; +} +//------------------------------------------------------------------------------ + +bool Clipper::Execute(ClipType clipType, PolyTree& polytree, + PolyFillType subjFillType, PolyFillType clipFillType) +{ + if( m_ExecuteLocked ) return false; + m_ExecuteLocked = true; + m_SubjFillType = subjFillType; + m_ClipFillType = clipFillType; + m_ClipType = clipType; + m_UsingPolyTree = true; + bool succeeded = ExecuteInternal(); + if (succeeded) BuildResult2(polytree); + m_ExecuteLocked = false; + return succeeded; +} +//------------------------------------------------------------------------------ + +void Clipper::FixHoleLinkage(OutRec &outrec) +{ + //skip OutRecs that (a) contain outermost polygons or + //(b) already have the correct owner/child linkage ... + if (!outrec.FirstLeft || + (outrec.isHole != outrec.FirstLeft->isHole && + outrec.FirstLeft->pts)) return; + + OutRec* orfl = outrec.FirstLeft; + while (orfl && ((orfl->isHole == outrec.isHole) || !orfl->pts)) + orfl = orfl->FirstLeft; + outrec.FirstLeft = orfl; +} +//------------------------------------------------------------------------------ + +bool Clipper::ExecuteInternal() +{ + bool succeeded; + try { + Reset(); + if (!m_CurrentLM ) return true; + long64 botY = PopScanbeam(); + do { + InsertLocalMinimaIntoAEL(botY); + ClearHorzJoins(); + ProcessHorizontals(); + long64 topY = PopScanbeam(); + succeeded = ProcessIntersections(botY, topY); + if (!succeeded) break; + ProcessEdgesAtTopOfScanbeam(topY); + botY = topY; + } while( m_Scanbeam ); + } + catch(...) { + succeeded = false; + } + + if (succeeded) + { + //tidy up output polygons and fix orientations where necessary ... + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) + { + OutRec *outRec = m_PolyOuts[i]; + if (!outRec->pts) continue; + FixupOutPolygon(*outRec); + if (!outRec->pts) continue; + + if ((outRec->isHole ^ m_ReverseOutput) == (Area(*outRec, m_UseFullRange) > 0)) + ReversePolyPtLinks(outRec->pts); + } + + if (!m_Joins.empty()) JoinCommonEdges(); + if (m_ForceSimple) DoSimplePolygons(); + } + + ClearJoins(); + ClearHorzJoins(); + return succeeded; +} +//------------------------------------------------------------------------------ + +void Clipper::InsertScanbeam(const long64 Y) +{ + if( !m_Scanbeam ) + { + m_Scanbeam = new Scanbeam; + m_Scanbeam->next = 0; + m_Scanbeam->Y = Y; + } + else if( Y > m_Scanbeam->Y ) + { + Scanbeam* newSb = new Scanbeam; + newSb->Y = Y; + newSb->next = m_Scanbeam; + m_Scanbeam = newSb; + } else + { + Scanbeam* sb2 = m_Scanbeam; + while( sb2->next && ( Y <= sb2->next->Y ) ) sb2 = sb2->next; + if( Y == sb2->Y ) return; //ie ignores duplicates + Scanbeam* newSb = new Scanbeam; + newSb->Y = Y; + newSb->next = sb2->next; + sb2->next = newSb; + } +} +//------------------------------------------------------------------------------ + +long64 Clipper::PopScanbeam() +{ + long64 Y = m_Scanbeam->Y; + Scanbeam* sb2 = m_Scanbeam; + m_Scanbeam = m_Scanbeam->next; + delete sb2; + return Y; +} +//------------------------------------------------------------------------------ + +void Clipper::DisposeAllPolyPts(){ + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) + DisposeOutRec(i); + m_PolyOuts.clear(); +} +//------------------------------------------------------------------------------ + +void Clipper::DisposeOutRec(PolyOutList::size_type index) +{ + OutRec *outRec = m_PolyOuts[index]; + if (outRec->pts) DisposeOutPts(outRec->pts); + delete outRec; + m_PolyOuts[index] = 0; +} +//------------------------------------------------------------------------------ + +void Clipper::SetWindingCount(TEdge &edge) +{ + TEdge *e = edge.prevInAEL; + //find the edge of the same polytype that immediately preceeds 'edge' in AEL + while ( e && e->polyType != edge.polyType ) e = e->prevInAEL; + if ( !e ) + { + edge.windCnt = edge.windDelta; + edge.windCnt2 = 0; + e = m_ActiveEdges; //ie get ready to calc windCnt2 + } else if ( IsEvenOddFillType(edge) ) + { + //EvenOdd filling ... + edge.windCnt = 1; + edge.windCnt2 = e->windCnt2; + e = e->nextInAEL; //ie get ready to calc windCnt2 + } else + { + //nonZero, Positive or Negative filling ... + if ( e->windCnt * e->windDelta < 0 ) + { + if (Abs(e->windCnt) > 1) + { + if (e->windDelta * edge.windDelta < 0) edge.windCnt = e->windCnt; + else edge.windCnt = e->windCnt + edge.windDelta; + } else + edge.windCnt = e->windCnt + e->windDelta + edge.windDelta; + } else + { + if ( Abs(e->windCnt) > 1 && e->windDelta * edge.windDelta < 0) + edge.windCnt = e->windCnt; + else if ( e->windCnt + edge.windDelta == 0 ) + edge.windCnt = e->windCnt; + else edge.windCnt = e->windCnt + edge.windDelta; + } + edge.windCnt2 = e->windCnt2; + e = e->nextInAEL; //ie get ready to calc windCnt2 + } + + //update windCnt2 ... + if ( IsEvenOddAltFillType(edge) ) + { + //EvenOdd filling ... + while ( e != &edge ) + { + edge.windCnt2 = (edge.windCnt2 == 0) ? 1 : 0; + e = e->nextInAEL; + } + } else + { + //nonZero, Positive or Negative filling ... + while ( e != &edge ) + { + edge.windCnt2 += e->windDelta; + e = e->nextInAEL; + } + } +} +//------------------------------------------------------------------------------ + +bool Clipper::IsEvenOddFillType(const TEdge& edge) const +{ + if (edge.polyType == ptSubject) + return m_SubjFillType == pftEvenOdd; else + return m_ClipFillType == pftEvenOdd; +} +//------------------------------------------------------------------------------ + +bool Clipper::IsEvenOddAltFillType(const TEdge& edge) const +{ + if (edge.polyType == ptSubject) + return m_ClipFillType == pftEvenOdd; else + return m_SubjFillType == pftEvenOdd; +} +//------------------------------------------------------------------------------ + +bool Clipper::IsContributing(const TEdge& edge) const +{ + PolyFillType pft, pft2; + if (edge.polyType == ptSubject) + { + pft = m_SubjFillType; + pft2 = m_ClipFillType; + } else + { + pft = m_ClipFillType; + pft2 = m_SubjFillType; + } + + switch(pft) + { + case pftEvenOdd: + case pftNonZero: + if (Abs(edge.windCnt) != 1) return false; + break; + case pftPositive: + if (edge.windCnt != 1) return false; + break; + default: //pftNegative + if (edge.windCnt != -1) return false; + } + + switch(m_ClipType) + { + case ctIntersection: + switch(pft2) + { + case pftEvenOdd: + case pftNonZero: + return (edge.windCnt2 != 0); + case pftPositive: + return (edge.windCnt2 > 0); + default: + return (edge.windCnt2 < 0); + } + case ctUnion: + switch(pft2) + { + case pftEvenOdd: + case pftNonZero: + return (edge.windCnt2 == 0); + case pftPositive: + return (edge.windCnt2 <= 0); + default: + return (edge.windCnt2 >= 0); + } + case ctDifference: + if (edge.polyType == ptSubject) + switch(pft2) + { + case pftEvenOdd: + case pftNonZero: + return (edge.windCnt2 == 0); + case pftPositive: + return (edge.windCnt2 <= 0); + default: + return (edge.windCnt2 >= 0); + } + else + switch(pft2) + { + case pftEvenOdd: + case pftNonZero: + return (edge.windCnt2 != 0); + case pftPositive: + return (edge.windCnt2 > 0); + default: + return (edge.windCnt2 < 0); + } + default: + return true; + } +} +//------------------------------------------------------------------------------ + +void Clipper::AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt) +{ + TEdge *e, *prevE; + if( NEAR_EQUAL(e2->dx, HORIZONTAL) || ( e1->dx > e2->dx ) ) + { + AddOutPt( e1, pt ); + e2->outIdx = e1->outIdx; + e1->side = esLeft; + e2->side = esRight; + e = e1; + if (e->prevInAEL == e2) + prevE = e2->prevInAEL; + else + prevE = e->prevInAEL; + } else + { + AddOutPt( e2, pt ); + e1->outIdx = e2->outIdx; + e1->side = esRight; + e2->side = esLeft; + e = e2; + if (e->prevInAEL == e1) + prevE = e1->prevInAEL; + else + prevE = e->prevInAEL; + } + if (prevE && prevE->outIdx >= 0 && + (TopX(*prevE, pt.Y) == TopX(*e, pt.Y)) && + SlopesEqual(*e, *prevE, m_UseFullRange)) + AddJoin(e, prevE, -1, -1); +} +//------------------------------------------------------------------------------ + +void Clipper::AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt) +{ + AddOutPt( e1, pt ); + if( e1->outIdx == e2->outIdx ) + { + e1->outIdx = -1; + e2->outIdx = -1; + } + else if (e1->outIdx < e2->outIdx) + AppendPolygon(e1, e2); + else + AppendPolygon(e2, e1); +} +//------------------------------------------------------------------------------ + +void Clipper::AddEdgeToSEL(TEdge *edge) +{ + //SEL pointers in PEdge are reused to build a list of horizontal edges. + //However, we don't need to worry about order with horizontal edge processing. + if( !m_SortedEdges ) + { + m_SortedEdges = edge; + edge->prevInSEL = 0; + edge->nextInSEL = 0; + } + else + { + edge->nextInSEL = m_SortedEdges; + edge->prevInSEL = 0; + m_SortedEdges->prevInSEL = edge; + m_SortedEdges = edge; + } +} +//------------------------------------------------------------------------------ + +void Clipper::CopyAELToSEL() +{ + TEdge* e = m_ActiveEdges; + m_SortedEdges = e; + while ( e ) + { + e->prevInSEL = e->prevInAEL; + e->nextInSEL = e->nextInAEL; + e = e->nextInAEL; + } +} +//------------------------------------------------------------------------------ + +void Clipper::AddJoin(TEdge *e1, TEdge *e2, int e1OutIdx, int e2OutIdx) +{ + JoinRec* jr = new JoinRec; + if (e1OutIdx >= 0) + jr->poly1Idx = e1OutIdx; else + jr->poly1Idx = e1->outIdx; + jr->pt1a = IntPoint(e1->xcurr, e1->ycurr); + jr->pt1b = IntPoint(e1->xtop, e1->ytop); + if (e2OutIdx >= 0) + jr->poly2Idx = e2OutIdx; else + jr->poly2Idx = e2->outIdx; + jr->pt2a = IntPoint(e2->xcurr, e2->ycurr); + jr->pt2b = IntPoint(e2->xtop, e2->ytop); + m_Joins.push_back(jr); +} +//------------------------------------------------------------------------------ + +void Clipper::ClearJoins() +{ + for (JoinList::size_type i = 0; i < m_Joins.size(); i++) + delete m_Joins[i]; + m_Joins.resize(0); +} +//------------------------------------------------------------------------------ + +void Clipper::AddHorzJoin(TEdge *e, int idx) +{ + HorzJoinRec* hj = new HorzJoinRec; + hj->edge = e; + hj->savedIdx = idx; + m_HorizJoins.push_back(hj); +} +//------------------------------------------------------------------------------ + +void Clipper::ClearHorzJoins() +{ + for (HorzJoinList::size_type i = 0; i < m_HorizJoins.size(); i++) + delete m_HorizJoins[i]; + m_HorizJoins.resize(0); +} +//------------------------------------------------------------------------------ + +void Clipper::InsertLocalMinimaIntoAEL(const long64 botY) +{ + while( m_CurrentLM && ( m_CurrentLM->Y == botY ) ) + { + TEdge* lb = m_CurrentLM->leftBound; + TEdge* rb = m_CurrentLM->rightBound; + + InsertEdgeIntoAEL( lb ); + InsertScanbeam( lb->ytop ); + InsertEdgeIntoAEL( rb ); + + if (IsEvenOddFillType(*lb)) + { + lb->windDelta = 1; + rb->windDelta = 1; + } + else + { + rb->windDelta = -lb->windDelta; + } + SetWindingCount( *lb ); + rb->windCnt = lb->windCnt; + rb->windCnt2 = lb->windCnt2; + + if( NEAR_EQUAL(rb->dx, HORIZONTAL) ) + { + //nb: only rightbounds can have a horizontal bottom edge + AddEdgeToSEL( rb ); + InsertScanbeam( rb->nextInLML->ytop ); + } + else + InsertScanbeam( rb->ytop ); + + if( IsContributing(*lb) ) + AddLocalMinPoly( lb, rb, IntPoint(lb->xcurr, m_CurrentLM->Y) ); + + //if any output polygons share an edge, they'll need joining later ... + if (rb->outIdx >= 0 && NEAR_EQUAL(rb->dx, HORIZONTAL)) + { + for (HorzJoinList::size_type i = 0; i < m_HorizJoins.size(); ++i) + { + IntPoint pt, pt2; //returned by GetOverlapSegment() but unused here. + HorzJoinRec* hj = m_HorizJoins[i]; + //if horizontals rb and hj.edge overlap, flag for joining later ... + if (GetOverlapSegment(IntPoint(hj->edge->xbot, hj->edge->ybot), + IntPoint(hj->edge->xtop, hj->edge->ytop), + IntPoint(rb->xbot, rb->ybot), + IntPoint(rb->xtop, rb->ytop), pt, pt2)) + AddJoin(hj->edge, rb, hj->savedIdx); + } + } + + if( lb->nextInAEL != rb ) + { + if (rb->outIdx >= 0 && rb->prevInAEL->outIdx >= 0 && + SlopesEqual(*rb->prevInAEL, *rb, m_UseFullRange)) + AddJoin(rb, rb->prevInAEL); + + TEdge* e = lb->nextInAEL; + IntPoint pt = IntPoint(lb->xcurr, lb->ycurr); + while( e != rb ) + { + if(!e) throw clipperException("InsertLocalMinimaIntoAEL: missing rightbound!"); + //nb: For calculating winding counts etc, IntersectEdges() assumes + //that param1 will be to the right of param2 ABOVE the intersection ... + IntersectEdges( rb , e , pt , ipNone); //order important here + e = e->nextInAEL; + } + } + PopLocalMinima(); + } +} +//------------------------------------------------------------------------------ + +void Clipper::DeleteFromAEL(TEdge *e) +{ + TEdge* AelPrev = e->prevInAEL; + TEdge* AelNext = e->nextInAEL; + if( !AelPrev && !AelNext && (e != m_ActiveEdges) ) return; //already deleted + if( AelPrev ) AelPrev->nextInAEL = AelNext; + else m_ActiveEdges = AelNext; + if( AelNext ) AelNext->prevInAEL = AelPrev; + e->nextInAEL = 0; + e->prevInAEL = 0; +} +//------------------------------------------------------------------------------ + +void Clipper::DeleteFromSEL(TEdge *e) +{ + TEdge* SelPrev = e->prevInSEL; + TEdge* SelNext = e->nextInSEL; + if( !SelPrev && !SelNext && (e != m_SortedEdges) ) return; //already deleted + if( SelPrev ) SelPrev->nextInSEL = SelNext; + else m_SortedEdges = SelNext; + if( SelNext ) SelNext->prevInSEL = SelPrev; + e->nextInSEL = 0; + e->prevInSEL = 0; +} +//------------------------------------------------------------------------------ + +void Clipper::IntersectEdges(TEdge *e1, TEdge *e2, + const IntPoint &pt, const IntersectProtects protects) +{ + //e1 will be to the left of e2 BELOW the intersection. Therefore e1 is before + //e2 in AEL except when e1 is being inserted at the intersection point ... + bool e1stops = !(ipLeft & protects) && !e1->nextInLML && + e1->xtop == pt.X && e1->ytop == pt.Y; + bool e2stops = !(ipRight & protects) && !e2->nextInLML && + e2->xtop == pt.X && e2->ytop == pt.Y; + bool e1Contributing = ( e1->outIdx >= 0 ); + bool e2contributing = ( e2->outIdx >= 0 ); + + //update winding counts... + //assumes that e1 will be to the right of e2 ABOVE the intersection + if ( e1->polyType == e2->polyType ) + { + if ( IsEvenOddFillType( *e1) ) + { + int oldE1WindCnt = e1->windCnt; + e1->windCnt = e2->windCnt; + e2->windCnt = oldE1WindCnt; + } else + { + if (e1->windCnt + e2->windDelta == 0 ) e1->windCnt = -e1->windCnt; + else e1->windCnt += e2->windDelta; + if ( e2->windCnt - e1->windDelta == 0 ) e2->windCnt = -e2->windCnt; + else e2->windCnt -= e1->windDelta; + } + } else + { + if (!IsEvenOddFillType(*e2)) e1->windCnt2 += e2->windDelta; + else e1->windCnt2 = ( e1->windCnt2 == 0 ) ? 1 : 0; + if (!IsEvenOddFillType(*e1)) e2->windCnt2 -= e1->windDelta; + else e2->windCnt2 = ( e2->windCnt2 == 0 ) ? 1 : 0; + } + + PolyFillType e1FillType, e2FillType, e1FillType2, e2FillType2; + if (e1->polyType == ptSubject) + { + e1FillType = m_SubjFillType; + e1FillType2 = m_ClipFillType; + } else + { + e1FillType = m_ClipFillType; + e1FillType2 = m_SubjFillType; + } + if (e2->polyType == ptSubject) + { + e2FillType = m_SubjFillType; + e2FillType2 = m_ClipFillType; + } else + { + e2FillType = m_ClipFillType; + e2FillType2 = m_SubjFillType; + } + + long64 e1Wc, e2Wc; + switch (e1FillType) + { + case pftPositive: e1Wc = e1->windCnt; break; + case pftNegative: e1Wc = -e1->windCnt; break; + default: e1Wc = Abs(e1->windCnt); + } + switch(e2FillType) + { + case pftPositive: e2Wc = e2->windCnt; break; + case pftNegative: e2Wc = -e2->windCnt; break; + default: e2Wc = Abs(e2->windCnt); + } + + if ( e1Contributing && e2contributing ) + { + if ( e1stops || e2stops || + (e1Wc != 0 && e1Wc != 1) || (e2Wc != 0 && e2Wc != 1) || + (e1->polyType != e2->polyType && m_ClipType != ctXor) ) + AddLocalMaxPoly(e1, e2, pt); + else + { + AddOutPt(e1, pt); + AddOutPt(e2, pt); + SwapSides( *e1 , *e2 ); + SwapPolyIndexes( *e1 , *e2 ); + } + } + else if ( e1Contributing ) + { + if (e2Wc == 0 || e2Wc == 1) + { + AddOutPt(e1, pt); + SwapSides(*e1, *e2); + SwapPolyIndexes(*e1, *e2); + } + } + else if ( e2contributing ) + { + if (e1Wc == 0 || e1Wc == 1) + { + AddOutPt(e2, pt); + SwapSides(*e1, *e2); + SwapPolyIndexes(*e1, *e2); + } + } + else if ( (e1Wc == 0 || e1Wc == 1) && + (e2Wc == 0 || e2Wc == 1) && !e1stops && !e2stops ) + { + //neither edge is currently contributing ... + + long64 e1Wc2, e2Wc2; + switch (e1FillType2) + { + case pftPositive: e1Wc2 = e1->windCnt2; break; + case pftNegative : e1Wc2 = -e1->windCnt2; break; + default: e1Wc2 = Abs(e1->windCnt2); + } + switch (e2FillType2) + { + case pftPositive: e2Wc2 = e2->windCnt2; break; + case pftNegative: e2Wc2 = -e2->windCnt2; break; + default: e2Wc2 = Abs(e2->windCnt2); + } + + if (e1->polyType != e2->polyType) + AddLocalMinPoly(e1, e2, pt); + else if (e1Wc == 1 && e2Wc == 1) + switch( m_ClipType ) { + case ctIntersection: + if (e1Wc2 > 0 && e2Wc2 > 0) + AddLocalMinPoly(e1, e2, pt); + break; + case ctUnion: + if ( e1Wc2 <= 0 && e2Wc2 <= 0 ) + AddLocalMinPoly(e1, e2, pt); + break; + case ctDifference: + if (((e1->polyType == ptClip) && (e1Wc2 > 0) && (e2Wc2 > 0)) || + ((e1->polyType == ptSubject) && (e1Wc2 <= 0) && (e2Wc2 <= 0))) + AddLocalMinPoly(e1, e2, pt); + break; + case ctXor: + AddLocalMinPoly(e1, e2, pt); + } + else + SwapSides( *e1, *e2 ); + } + + if( (e1stops != e2stops) && + ( (e1stops && (e1->outIdx >= 0)) || (e2stops && (e2->outIdx >= 0)) ) ) + { + SwapSides( *e1, *e2 ); + SwapPolyIndexes( *e1, *e2 ); + } + + //finally, delete any non-contributing maxima edges ... + if( e1stops ) DeleteFromAEL( e1 ); + if( e2stops ) DeleteFromAEL( e2 ); +} +//------------------------------------------------------------------------------ + +void Clipper::SetHoleState(TEdge *e, OutRec *outrec) +{ + bool isHole = false; + TEdge *e2 = e->prevInAEL; + while (e2) + { + if (e2->outIdx >= 0) + { + isHole = !isHole; + if (! outrec->FirstLeft) + outrec->FirstLeft = m_PolyOuts[e2->outIdx]; + } + e2 = e2->prevInAEL; + } + if (isHole) outrec->isHole = true; +} +//------------------------------------------------------------------------------ + +OutRec* GetLowermostRec(OutRec *outRec1, OutRec *outRec2) +{ + //work out which polygon fragment has the correct hole state ... + if (!outRec1->bottomPt) + outRec1->bottomPt = GetBottomPt(outRec1->pts); + if (!outRec2->bottomPt) + outRec2->bottomPt = GetBottomPt(outRec2->pts); + OutPt *outPt1 = outRec1->bottomPt; + OutPt *outPt2 = outRec2->bottomPt; + if (outPt1->pt.Y > outPt2->pt.Y) return outRec1; + else if (outPt1->pt.Y < outPt2->pt.Y) return outRec2; + else if (outPt1->pt.X < outPt2->pt.X) return outRec1; + else if (outPt1->pt.X > outPt2->pt.X) return outRec2; + else if (outPt1->next == outPt1) return outRec2; + else if (outPt2->next == outPt2) return outRec1; + else if (FirstIsBottomPt(outPt1, outPt2)) return outRec1; + else return outRec2; +} +//------------------------------------------------------------------------------ + +bool Param1RightOfParam2(OutRec* outRec1, OutRec* outRec2) +{ + do + { + outRec1 = outRec1->FirstLeft; + if (outRec1 == outRec2) return true; + } while (outRec1); + return false; +} +//------------------------------------------------------------------------------ + +OutRec* Clipper::GetOutRec(int idx) +{ + OutRec* outrec = m_PolyOuts[idx]; + while (outrec != m_PolyOuts[outrec->idx]) + outrec = m_PolyOuts[outrec->idx]; + return outrec; +} +//------------------------------------------------------------------------------ + +void Clipper::AppendPolygon(TEdge *e1, TEdge *e2) +{ + //get the start and ends of both output polygons ... + OutRec *outRec1 = m_PolyOuts[e1->outIdx]; + OutRec *outRec2 = m_PolyOuts[e2->outIdx]; + + OutRec *holeStateRec; + if (Param1RightOfParam2(outRec1, outRec2)) + holeStateRec = outRec2; + else if (Param1RightOfParam2(outRec2, outRec1)) + holeStateRec = outRec1; + else + holeStateRec = GetLowermostRec(outRec1, outRec2); + + OutPt* p1_lft = outRec1->pts; + OutPt* p1_rt = p1_lft->prev; + OutPt* p2_lft = outRec2->pts; + OutPt* p2_rt = p2_lft->prev; + + EdgeSide side; + //join e2 poly onto e1 poly and delete pointers to e2 ... + if( e1->side == esLeft ) + { + if( e2->side == esLeft ) + { + //z y x a b c + ReversePolyPtLinks(p2_lft); + p2_lft->next = p1_lft; + p1_lft->prev = p2_lft; + p1_rt->next = p2_rt; + p2_rt->prev = p1_rt; + outRec1->pts = p2_rt; + } else + { + //x y z a b c + p2_rt->next = p1_lft; + p1_lft->prev = p2_rt; + p2_lft->prev = p1_rt; + p1_rt->next = p2_lft; + outRec1->pts = p2_lft; + } + side = esLeft; + } else + { + if( e2->side == esRight ) + { + //a b c z y x + ReversePolyPtLinks(p2_lft); + p1_rt->next = p2_rt; + p2_rt->prev = p1_rt; + p2_lft->next = p1_lft; + p1_lft->prev = p2_lft; + } else + { + //a b c x y z + p1_rt->next = p2_lft; + p2_lft->prev = p1_rt; + p1_lft->prev = p2_rt; + p2_rt->next = p1_lft; + } + side = esRight; + } + + outRec1->bottomPt = 0; + if (holeStateRec == outRec2) + { + if (outRec2->FirstLeft != outRec1) + outRec1->FirstLeft = outRec2->FirstLeft; + outRec1->isHole = outRec2->isHole; + } + outRec2->pts = 0; + outRec2->bottomPt = 0; + + outRec2->FirstLeft = outRec1; + + int OKIdx = e1->outIdx; + int ObsoleteIdx = e2->outIdx; + + e1->outIdx = -1; //nb: safe because we only get here via AddLocalMaxPoly + e2->outIdx = -1; + + TEdge* e = m_ActiveEdges; + while( e ) + { + if( e->outIdx == ObsoleteIdx ) + { + e->outIdx = OKIdx; + e->side = side; + break; + } + e = e->nextInAEL; + } + + outRec2->idx = outRec1->idx; +} +//------------------------------------------------------------------------------ + +OutRec* Clipper::CreateOutRec() +{ + OutRec* result = new OutRec; + result->isHole = false; + result->FirstLeft = 0; + result->pts = 0; + result->bottomPt = 0; + result->polyNode = 0; + m_PolyOuts.push_back(result); + result->idx = (int)m_PolyOuts.size()-1; + return result; +} +//------------------------------------------------------------------------------ + +void Clipper::AddOutPt(TEdge *e, const IntPoint &pt) +{ + bool ToFront = (e->side == esLeft); + if( e->outIdx < 0 ) + { + OutRec *outRec = CreateOutRec(); + e->outIdx = outRec->idx; + OutPt* op = new OutPt; + outRec->pts = op; + op->pt = pt; + op->idx = outRec->idx; + op->next = op; + op->prev = op; + SetHoleState(e, outRec); + } else + { + OutRec *outRec = m_PolyOuts[e->outIdx]; + OutPt* op = outRec->pts; + if ((ToFront && PointsEqual(pt, op->pt)) || + (!ToFront && PointsEqual(pt, op->prev->pt))) return; + + OutPt* op2 = new OutPt; + op2->pt = pt; + op2->idx = outRec->idx; + op2->next = op; + op2->prev = op->prev; + op2->prev->next = op2; + op->prev = op2; + if (ToFront) outRec->pts = op2; + } +} +//------------------------------------------------------------------------------ + +void Clipper::ProcessHorizontals() +{ + TEdge* horzEdge = m_SortedEdges; + while( horzEdge ) + { + DeleteFromSEL( horzEdge ); + ProcessHorizontal( horzEdge ); + horzEdge = m_SortedEdges; + } +} +//------------------------------------------------------------------------------ + +bool Clipper::IsTopHorz(const long64 XPos) +{ + TEdge* e = m_SortedEdges; + while( e ) + { + if( ( XPos >= std::min(e->xcurr, e->xtop) ) && + ( XPos <= std::max(e->xcurr, e->xtop) ) ) return false; + e = e->nextInSEL; + } + return true; +} +//------------------------------------------------------------------------------ + +inline bool IsMinima(TEdge *e) +{ + return e && (e->prev->nextInLML != e) && (e->next->nextInLML != e); +} +//------------------------------------------------------------------------------ + +inline bool IsMaxima(TEdge *e, const long64 Y) +{ + return e && e->ytop == Y && !e->nextInLML; +} +//------------------------------------------------------------------------------ + +inline bool IsIntermediate(TEdge *e, const long64 Y) +{ + return e->ytop == Y && e->nextInLML; +} +//------------------------------------------------------------------------------ + +TEdge *GetMaximaPair(TEdge *e) +{ + if( !IsMaxima(e->next, e->ytop) || e->next->xtop != e->xtop ) + return e->prev; else + return e->next; +} +//------------------------------------------------------------------------------ + +void Clipper::SwapPositionsInAEL(TEdge *edge1, TEdge *edge2) +{ + if( edge1->nextInAEL == edge2 ) + { + TEdge* next = edge2->nextInAEL; + if( next ) next->prevInAEL = edge1; + TEdge* prev = edge1->prevInAEL; + if( prev ) prev->nextInAEL = edge2; + edge2->prevInAEL = prev; + edge2->nextInAEL = edge1; + edge1->prevInAEL = edge2; + edge1->nextInAEL = next; + } + else if( edge2->nextInAEL == edge1 ) + { + TEdge* next = edge1->nextInAEL; + if( next ) next->prevInAEL = edge2; + TEdge* prev = edge2->prevInAEL; + if( prev ) prev->nextInAEL = edge1; + edge1->prevInAEL = prev; + edge1->nextInAEL = edge2; + edge2->prevInAEL = edge1; + edge2->nextInAEL = next; + } + else + { + TEdge* next = edge1->nextInAEL; + TEdge* prev = edge1->prevInAEL; + edge1->nextInAEL = edge2->nextInAEL; + if( edge1->nextInAEL ) edge1->nextInAEL->prevInAEL = edge1; + edge1->prevInAEL = edge2->prevInAEL; + if( edge1->prevInAEL ) edge1->prevInAEL->nextInAEL = edge1; + edge2->nextInAEL = next; + if( edge2->nextInAEL ) edge2->nextInAEL->prevInAEL = edge2; + edge2->prevInAEL = prev; + if( edge2->prevInAEL ) edge2->prevInAEL->nextInAEL = edge2; + } + + if( !edge1->prevInAEL ) m_ActiveEdges = edge1; + else if( !edge2->prevInAEL ) m_ActiveEdges = edge2; +} +//------------------------------------------------------------------------------ + +void Clipper::SwapPositionsInSEL(TEdge *edge1, TEdge *edge2) +{ + if( !( edge1->nextInSEL ) && !( edge1->prevInSEL ) ) return; + if( !( edge2->nextInSEL ) && !( edge2->prevInSEL ) ) return; + + if( edge1->nextInSEL == edge2 ) + { + TEdge* next = edge2->nextInSEL; + if( next ) next->prevInSEL = edge1; + TEdge* prev = edge1->prevInSEL; + if( prev ) prev->nextInSEL = edge2; + edge2->prevInSEL = prev; + edge2->nextInSEL = edge1; + edge1->prevInSEL = edge2; + edge1->nextInSEL = next; + } + else if( edge2->nextInSEL == edge1 ) + { + TEdge* next = edge1->nextInSEL; + if( next ) next->prevInSEL = edge2; + TEdge* prev = edge2->prevInSEL; + if( prev ) prev->nextInSEL = edge1; + edge1->prevInSEL = prev; + edge1->nextInSEL = edge2; + edge2->prevInSEL = edge1; + edge2->nextInSEL = next; + } + else + { + TEdge* next = edge1->nextInSEL; + TEdge* prev = edge1->prevInSEL; + edge1->nextInSEL = edge2->nextInSEL; + if( edge1->nextInSEL ) edge1->nextInSEL->prevInSEL = edge1; + edge1->prevInSEL = edge2->prevInSEL; + if( edge1->prevInSEL ) edge1->prevInSEL->nextInSEL = edge1; + edge2->nextInSEL = next; + if( edge2->nextInSEL ) edge2->nextInSEL->prevInSEL = edge2; + edge2->prevInSEL = prev; + if( edge2->prevInSEL ) edge2->prevInSEL->nextInSEL = edge2; + } + + if( !edge1->prevInSEL ) m_SortedEdges = edge1; + else if( !edge2->prevInSEL ) m_SortedEdges = edge2; +} +//------------------------------------------------------------------------------ + +TEdge* GetNextInAEL(TEdge *e, Direction dir) +{ + return dir == dLeftToRight ? e->nextInAEL : e->prevInAEL; +} +//------------------------------------------------------------------------------ + +void Clipper::ProcessHorizontal(TEdge *horzEdge) +{ + Direction dir; + long64 horzLeft, horzRight; + + if( horzEdge->xcurr < horzEdge->xtop ) + { + horzLeft = horzEdge->xcurr; + horzRight = horzEdge->xtop; + dir = dLeftToRight; + } else + { + horzLeft = horzEdge->xtop; + horzRight = horzEdge->xcurr; + dir = dRightToLeft; + } + + TEdge* eMaxPair; + if( horzEdge->nextInLML ) eMaxPair = 0; + else eMaxPair = GetMaximaPair(horzEdge); + + TEdge* e = GetNextInAEL( horzEdge , dir ); + while( e ) + { + if ( e->xcurr == horzEdge->xtop && !eMaxPair ) + { + if (SlopesEqual(*e, *horzEdge->nextInLML, m_UseFullRange)) + { + //if output polygons share an edge, they'll need joining later ... + if (horzEdge->outIdx >= 0 && e->outIdx >= 0) + AddJoin(horzEdge->nextInLML, e, horzEdge->outIdx); + break; //we've reached the end of the horizontal line + } + else if (e->dx < horzEdge->nextInLML->dx) + //we really have got to the end of the intermediate horz edge so quit. + //nb: More -ve slopes follow more +ve slopes ABOVE the horizontal. + break; + } + + TEdge* eNext = GetNextInAEL( e, dir ); + + if (eMaxPair || + ((dir == dLeftToRight) && (e->xcurr < horzRight)) || + ((dir == dRightToLeft) && (e->xcurr > horzLeft))) + { + //so far we're still in range of the horizontal edge + if( e == eMaxPair ) + { + //horzEdge is evidently a maxima horizontal and we've arrived at its end. + if (dir == dLeftToRight) + IntersectEdges(horzEdge, e, IntPoint(e->xcurr, horzEdge->ycurr), ipNone); + else + IntersectEdges(e, horzEdge, IntPoint(e->xcurr, horzEdge->ycurr), ipNone); + if (eMaxPair->outIdx >= 0) throw clipperException("ProcessHorizontal error"); + return; + } + else if( NEAR_EQUAL(e->dx, HORIZONTAL) && !IsMinima(e) && !(e->xcurr > e->xtop) ) + { + //An overlapping horizontal edge. Overlapping horizontal edges are + //processed as if layered with the current horizontal edge (horizEdge) + //being infinitesimally lower that the next (e). Therfore, we + //intersect with e only if e.xcurr is within the bounds of horzEdge ... + if( dir == dLeftToRight ) + IntersectEdges( horzEdge , e, IntPoint(e->xcurr, horzEdge->ycurr), + (IsTopHorz( e->xcurr ))? ipLeft : ipBoth ); + else + IntersectEdges( e, horzEdge, IntPoint(e->xcurr, horzEdge->ycurr), + (IsTopHorz( e->xcurr ))? ipRight : ipBoth ); + } + else if( dir == dLeftToRight ) + { + IntersectEdges( horzEdge, e, IntPoint(e->xcurr, horzEdge->ycurr), + (IsTopHorz( e->xcurr ))? ipLeft : ipBoth ); + } + else + { + IntersectEdges( e, horzEdge, IntPoint(e->xcurr, horzEdge->ycurr), + (IsTopHorz( e->xcurr ))? ipRight : ipBoth ); + } + SwapPositionsInAEL( horzEdge, e ); + } + else if( (dir == dLeftToRight && e->xcurr >= horzRight) || + (dir == dRightToLeft && e->xcurr <= horzLeft) ) break; + e = eNext; + } //end while + + if( horzEdge->nextInLML ) + { + if( horzEdge->outIdx >= 0 ) + AddOutPt( horzEdge, IntPoint(horzEdge->xtop, horzEdge->ytop)); + UpdateEdgeIntoAEL( horzEdge ); + } + else + { + if ( horzEdge->outIdx >= 0 ) + IntersectEdges( horzEdge, eMaxPair, + IntPoint(horzEdge->xtop, horzEdge->ycurr), ipBoth); + if (eMaxPair->outIdx >= 0) throw clipperException("ProcessHorizontal error"); + DeleteFromAEL(eMaxPair); + DeleteFromAEL(horzEdge); + } +} +//------------------------------------------------------------------------------ + +void Clipper::UpdateEdgeIntoAEL(TEdge *&e) +{ + if( !e->nextInLML ) throw + clipperException("UpdateEdgeIntoAEL: invalid call"); + TEdge* AelPrev = e->prevInAEL; + TEdge* AelNext = e->nextInAEL; + e->nextInLML->outIdx = e->outIdx; + if( AelPrev ) AelPrev->nextInAEL = e->nextInLML; + else m_ActiveEdges = e->nextInLML; + if( AelNext ) AelNext->prevInAEL = e->nextInLML; + e->nextInLML->side = e->side; + e->nextInLML->windDelta = e->windDelta; + e->nextInLML->windCnt = e->windCnt; + e->nextInLML->windCnt2 = e->windCnt2; + e = e->nextInLML; + e->prevInAEL = AelPrev; + e->nextInAEL = AelNext; + if( !NEAR_EQUAL(e->dx, HORIZONTAL) ) InsertScanbeam( e->ytop ); +} +//------------------------------------------------------------------------------ + +bool Clipper::ProcessIntersections(const long64 botY, const long64 topY) +{ + if( !m_ActiveEdges ) return true; + try { + BuildIntersectList(botY, topY); + if (!m_IntersectNodes) return true; + if (!m_IntersectNodes->next || FixupIntersectionOrder()) ProcessIntersectList(); + else return false; + } + catch(...) { + m_SortedEdges = 0; + DisposeIntersectNodes(); + throw clipperException("ProcessIntersections error"); + } + m_SortedEdges = 0; + return true; +} +//------------------------------------------------------------------------------ + +void Clipper::DisposeIntersectNodes() +{ + while ( m_IntersectNodes ) + { + IntersectNode* iNode = m_IntersectNodes->next; + delete m_IntersectNodes; + m_IntersectNodes = iNode; + } +} +//------------------------------------------------------------------------------ + +void Clipper::BuildIntersectList(const long64 botY, const long64 topY) +{ + if ( !m_ActiveEdges ) return; + + //prepare for sorting ... + TEdge* e = m_ActiveEdges; + m_SortedEdges = e; + while( e ) + { + e->prevInSEL = e->prevInAEL; + e->nextInSEL = e->nextInAEL; + e->xcurr = TopX( *e, topY ); + e = e->nextInAEL; + } + + //bubblesort ... + bool isModified = true; + while( isModified && m_SortedEdges ) + { + isModified = false; + e = m_SortedEdges; + while( e->nextInSEL ) + { + TEdge *eNext = e->nextInSEL; + IntPoint pt; + if(e->xcurr > eNext->xcurr) + { + if (!IntersectPoint(*e, *eNext, pt, m_UseFullRange) && e->xcurr > eNext->xcurr +1) + throw clipperException("Intersection error"); + if (pt.Y > botY) + { + pt.Y = botY; + pt.X = TopX(*e, pt.Y); + } + AddIntersectNode( e, eNext, pt ); + SwapPositionsInSEL(e, eNext); + isModified = true; + } + else + e = eNext; + } + if( e->prevInSEL ) e->prevInSEL->nextInSEL = 0; + else break; + } + m_SortedEdges = 0; +} +//------------------------------------------------------------------------------ + +void Clipper::AddIntersectNode(TEdge *e1, TEdge *e2, const IntPoint &pt) +{ + IntersectNode* newNode = new IntersectNode; + newNode->edge1 = e1; + newNode->edge2 = e2; + newNode->pt = pt; + newNode->next = 0; + if( !m_IntersectNodes ) m_IntersectNodes = newNode; + else if(newNode->pt.Y > m_IntersectNodes->pt.Y ) + { + newNode->next = m_IntersectNodes; + m_IntersectNodes = newNode; + } + else + { + IntersectNode* iNode = m_IntersectNodes; + while(iNode->next && newNode->pt.Y <= iNode->next->pt.Y) + iNode = iNode->next; + newNode->next = iNode->next; + iNode->next = newNode; + } +} +//------------------------------------------------------------------------------ + +void Clipper::ProcessIntersectList() +{ + while( m_IntersectNodes ) + { + IntersectNode* iNode = m_IntersectNodes->next; + { + IntersectEdges( m_IntersectNodes->edge1 , + m_IntersectNodes->edge2 , m_IntersectNodes->pt, ipBoth ); + SwapPositionsInAEL( m_IntersectNodes->edge1 , m_IntersectNodes->edge2 ); + } + delete m_IntersectNodes; + m_IntersectNodes = iNode; + } +} +//------------------------------------------------------------------------------ + +void Clipper::DoMaxima(TEdge *e, long64 topY) +{ + TEdge* eMaxPair = GetMaximaPair(e); + long64 X = e->xtop; + TEdge* eNext = e->nextInAEL; + while( eNext != eMaxPair ) + { + if (!eNext) throw clipperException("DoMaxima error"); + IntersectEdges( e, eNext, IntPoint(X, topY), ipBoth ); + SwapPositionsInAEL(e, eNext); + eNext = e->nextInAEL; + } + if( e->outIdx < 0 && eMaxPair->outIdx < 0 ) + { + DeleteFromAEL( e ); + DeleteFromAEL( eMaxPair ); + } + else if( e->outIdx >= 0 && eMaxPair->outIdx >= 0 ) + { + IntersectEdges( e, eMaxPair, IntPoint(X, topY), ipNone ); + } + else throw clipperException("DoMaxima error"); +} +//------------------------------------------------------------------------------ + +void Clipper::ProcessEdgesAtTopOfScanbeam(const long64 topY) +{ + TEdge* e = m_ActiveEdges; + while( e ) + { + //1. process maxima, treating them as if they're 'bent' horizontal edges, + // but exclude maxima with horizontal edges. nb: e can't be a horizontal. + if( IsMaxima(e, topY) && !NEAR_EQUAL(GetMaximaPair(e)->dx, HORIZONTAL) ) + { + //'e' might be removed from AEL, as may any following edges so ... + TEdge* ePrev = e->prevInAEL; + DoMaxima(e, topY); + if( !ePrev ) e = m_ActiveEdges; + else e = ePrev->nextInAEL; + } + else + { + bool intermediateVert = IsIntermediate(e, topY); + //2. promote horizontal edges, otherwise update xcurr and ycurr ... + if (intermediateVert && NEAR_EQUAL(e->nextInLML->dx, HORIZONTAL) ) + { + if (e->outIdx >= 0) + { + AddOutPt(e, IntPoint(e->xtop, e->ytop)); + + for (HorzJoinList::size_type i = 0; i < m_HorizJoins.size(); ++i) + { + IntPoint pt, pt2; + HorzJoinRec* hj = m_HorizJoins[i]; + if (GetOverlapSegment(IntPoint(hj->edge->xbot, hj->edge->ybot), + IntPoint(hj->edge->xtop, hj->edge->ytop), + IntPoint(e->nextInLML->xbot, e->nextInLML->ybot), + IntPoint(e->nextInLML->xtop, e->nextInLML->ytop), pt, pt2)) + AddJoin(hj->edge, e->nextInLML, hj->savedIdx, e->outIdx); + } + + AddHorzJoin(e->nextInLML, e->outIdx); + } + UpdateEdgeIntoAEL(e); + AddEdgeToSEL(e); + } else + { + e->xcurr = TopX( *e, topY ); + e->ycurr = topY; + + if (m_ForceSimple && e->prevInAEL && + e->prevInAEL->xcurr == e->xcurr && + e->outIdx >= 0 && e->prevInAEL->outIdx >= 0) + { + if (intermediateVert) + AddOutPt(e->prevInAEL, IntPoint(e->xcurr, topY)); + else + AddOutPt(e, IntPoint(e->xcurr, topY)); + } + } + e = e->nextInAEL; + } + } + + //3. Process horizontals at the top of the scanbeam ... + ProcessHorizontals(); + + //4. Promote intermediate vertices ... + e = m_ActiveEdges; + while( e ) + { + if( IsIntermediate( e, topY ) ) + { + if( e->outIdx >= 0 ) AddOutPt(e, IntPoint(e->xtop,e->ytop)); + UpdateEdgeIntoAEL(e); + + //if output polygons share an edge, they'll need joining later ... + TEdge* ePrev = e->prevInAEL; + TEdge* eNext = e->nextInAEL; + if (ePrev && ePrev->xcurr == e->xbot && + ePrev->ycurr == e->ybot && e->outIdx >= 0 && + ePrev->outIdx >= 0 && ePrev->ycurr > ePrev->ytop && + SlopesEqual(*e, *ePrev, m_UseFullRange)) + { + AddOutPt(ePrev, IntPoint(e->xbot, e->ybot)); + AddJoin(e, ePrev); + } + else if (eNext && eNext->xcurr == e->xbot && + eNext->ycurr == e->ybot && e->outIdx >= 0 && + eNext->outIdx >= 0 && eNext->ycurr > eNext->ytop && + SlopesEqual(*e, *eNext, m_UseFullRange)) + { + AddOutPt(eNext, IntPoint(e->xbot, e->ybot)); + AddJoin(e, eNext); + } + } + e = e->nextInAEL; + } +} +//------------------------------------------------------------------------------ + +void Clipper::FixupOutPolygon(OutRec &outrec) +{ + //FixupOutPolygon() - removes duplicate points and simplifies consecutive + //parallel edges by removing the middle vertex. + OutPt *lastOK = 0; + outrec.bottomPt = 0; + OutPt *pp = outrec.pts; + + for (;;) + { + if (pp->prev == pp || pp->prev == pp->next ) + { + DisposeOutPts(pp); + outrec.pts = 0; + return; + } + //test for duplicate points and for same slope (cross-product) ... + if ( PointsEqual(pp->pt, pp->next->pt) || + SlopesEqual(pp->prev->pt, pp->pt, pp->next->pt, m_UseFullRange) ) + { + lastOK = 0; + OutPt *tmp = pp; + pp->prev->next = pp->next; + pp->next->prev = pp->prev; + pp = pp->prev; + delete tmp; + } + else if (pp == lastOK) break; + else + { + if (!lastOK) lastOK = pp; + pp = pp->next; + } + } + outrec.pts = pp; +} +//------------------------------------------------------------------------------ + +void Clipper::BuildResult(Polygons &polys) +{ + polys.reserve(m_PolyOuts.size()); + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) + { + if (m_PolyOuts[i]->pts) + { + Polygon pg; + OutPt* p = m_PolyOuts[i]->pts; + do + { + pg.push_back(p->pt); + p = p->prev; + } while (p != m_PolyOuts[i]->pts); + if (pg.size() > 2) + polys.push_back(pg); + } + } +} +//------------------------------------------------------------------------------ + +int PointCount(OutPt *pts) +{ + if (!pts) return 0; + int result = 0; + OutPt* p = pts; + do + { + result++; + p = p->next; + } + while (p != pts); + return result; +} +//------------------------------------------------------------------------------ + +void Clipper::BuildResult2(PolyTree& polytree) +{ + polytree.Clear(); + polytree.AllNodes.reserve(m_PolyOuts.size()); + //add each output polygon/contour to polytree ... + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); i++) + { + OutRec* outRec = m_PolyOuts[i]; + int cnt = PointCount(outRec->pts); + if (cnt < 3) continue; + FixHoleLinkage(*outRec); + PolyNode* pn = new PolyNode(); + //nb: polytree takes ownership of all the PolyNodes + polytree.AllNodes.push_back(pn); + outRec->polyNode = pn; + pn->Parent = 0; + pn->Index = 0; + pn->Contour.reserve(cnt); + OutPt *op = outRec->pts; + for (int j = 0; j < cnt; j++) + { + pn->Contour.push_back(op->pt); + op = op->prev; + } + } + + //fixup PolyNode links etc ... + polytree.Childs.reserve(m_PolyOuts.size()); + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); i++) + { + OutRec* outRec = m_PolyOuts[i]; + if (!outRec->polyNode) continue; + if (outRec->FirstLeft) + outRec->FirstLeft->polyNode->AddChild(*outRec->polyNode); + else + polytree.AddChild(*outRec->polyNode); + } +} +//------------------------------------------------------------------------------ + +void SwapIntersectNodes(IntersectNode &int1, IntersectNode &int2) +{ + //just swap the contents (because fIntersectNodes is a single-linked-list) + IntersectNode inode = int1; //gets a copy of Int1 + int1.edge1 = int2.edge1; + int1.edge2 = int2.edge2; + int1.pt = int2.pt; + int2.edge1 = inode.edge1; + int2.edge2 = inode.edge2; + int2.pt = inode.pt; +} +//------------------------------------------------------------------------------ + +inline bool EdgesAdjacent(const IntersectNode &inode) +{ + return (inode.edge1->nextInSEL == inode.edge2) || + (inode.edge1->prevInSEL == inode.edge2); +} +//------------------------------------------------------------------------------ + +bool Clipper::FixupIntersectionOrder() +{ + //pre-condition: intersections are sorted bottom-most (then left-most) first. + //Now it's crucial that intersections are made only between adjacent edges, + //so to ensure this the order of intersections may need adjusting ... + IntersectNode *inode = m_IntersectNodes; + CopyAELToSEL(); + while (inode) + { + if (!EdgesAdjacent(*inode)) + { + IntersectNode *nextNode = inode->next; + while (nextNode && !EdgesAdjacent(*nextNode)) + nextNode = nextNode->next; + if (!nextNode) + return false; + SwapIntersectNodes(*inode, *nextNode); + } + SwapPositionsInSEL(inode->edge1, inode->edge2); + inode = inode->next; + } + return true; +} +//------------------------------------------------------------------------------ + +bool E2InsertsBeforeE1(TEdge &e1, TEdge &e2) +{ + if (e2.xcurr == e1.xcurr) + { + if (e2.ytop > e1.ytop) + return e2.xtop < TopX(e1, e2.ytop); + else return e1.xtop > TopX(e2, e1.ytop); + } + else return e2.xcurr < e1.xcurr; +} +//------------------------------------------------------------------------------ + +void Clipper::InsertEdgeIntoAEL(TEdge *edge) +{ + edge->prevInAEL = 0; + edge->nextInAEL = 0; + if( !m_ActiveEdges ) + { + m_ActiveEdges = edge; + } + else if( E2InsertsBeforeE1(*m_ActiveEdges, *edge) ) + { + edge->nextInAEL = m_ActiveEdges; + m_ActiveEdges->prevInAEL = edge; + m_ActiveEdges = edge; + } else + { + TEdge* e = m_ActiveEdges; + while( e->nextInAEL && !E2InsertsBeforeE1(*e->nextInAEL , *edge) ) + e = e->nextInAEL; + edge->nextInAEL = e->nextInAEL; + if( e->nextInAEL ) e->nextInAEL->prevInAEL = edge; + edge->prevInAEL = e; + e->nextInAEL = edge; + } +} +//---------------------------------------------------------------------- + +bool Clipper::JoinPoints(const JoinRec *j, OutPt *&p1, OutPt *&p2) +{ + OutRec *outRec1 = m_PolyOuts[j->poly1Idx]; + OutRec *outRec2 = m_PolyOuts[j->poly2Idx]; + if (!outRec1 || !outRec2) return false; + OutPt *pp1a = outRec1->pts; + OutPt *pp2a = outRec2->pts; + IntPoint pt1 = j->pt2a, pt2 = j->pt2b; + IntPoint pt3 = j->pt1a, pt4 = j->pt1b; + if (!FindSegment(pp1a, m_UseFullRange, pt1, pt2)) return false; + if (outRec1 == outRec2) + { + //we're searching the same polygon for overlapping segments so + //segment 2 mustn't be the same as segment 1 ... + pp2a = pp1a->next; + if (!FindSegment(pp2a, m_UseFullRange, pt3, pt4) || (pp2a == pp1a)) + return false; + } + else if (!FindSegment(pp2a, m_UseFullRange, pt3, pt4)) return false; + + if (!GetOverlapSegment(pt1, pt2, pt3, pt4, pt1, pt2)) return false; + + OutPt *p3, *p4, *prev = pp1a->prev; + //get p1 & p2 polypts - the overlap start & endpoints on poly1 + if (PointsEqual(pp1a->pt, pt1)) p1 = pp1a; + else if (PointsEqual(prev->pt, pt1)) p1 = prev; + else p1 = InsertPolyPtBetween(pp1a, prev, pt1); + + if (PointsEqual(pp1a->pt, pt2)) p2 = pp1a; + else if (PointsEqual(prev->pt, pt2)) p2 = prev; + else if ((p1 == pp1a) || (p1 == prev)) + p2 = InsertPolyPtBetween(pp1a, prev, pt2); + else if (Pt3IsBetweenPt1AndPt2(pp1a->pt, p1->pt, pt2)) + p2 = InsertPolyPtBetween(pp1a, p1, pt2); else + p2 = InsertPolyPtBetween(p1, prev, pt2); + + //get p3 & p4 polypts - the overlap start & endpoints on poly2 + prev = pp2a->prev; + if (PointsEqual(pp2a->pt, pt1)) p3 = pp2a; + else if (PointsEqual(prev->pt, pt1)) p3 = prev; + else p3 = InsertPolyPtBetween(pp2a, prev, pt1); + + if (PointsEqual(pp2a->pt, pt2)) p4 = pp2a; + else if (PointsEqual(prev->pt, pt2)) p4 = prev; + else if ((p3 == pp2a) || (p3 == prev)) + p4 = InsertPolyPtBetween(pp2a, prev, pt2); + else if (Pt3IsBetweenPt1AndPt2(pp2a->pt, p3->pt, pt2)) + p4 = InsertPolyPtBetween(pp2a, p3, pt2); else + p4 = InsertPolyPtBetween(p3, prev, pt2); + + //p1.pt == p3.pt and p2.pt == p4.pt so join p1 to p3 and p2 to p4 ... + if (p1->next == p2 && p3->prev == p4) + { + p1->next = p3; + p3->prev = p1; + p2->prev = p4; + p4->next = p2; + return true; + } + else if (p1->prev == p2 && p3->next == p4) + { + p1->prev = p3; + p3->next = p1; + p2->next = p4; + p4->prev = p2; + return true; + } + else + return false; //an orientation is probably wrong +} +//---------------------------------------------------------------------- + +void Clipper::FixupJoinRecs(JoinRec *j, OutPt *pt, unsigned startIdx) +{ + for (JoinList::size_type k = startIdx; k < m_Joins.size(); k++) + { + JoinRec* j2 = m_Joins[k]; + if (j2->poly1Idx == j->poly1Idx && PointIsVertex(j2->pt1a, pt)) + j2->poly1Idx = j->poly2Idx; + if (j2->poly2Idx == j->poly1Idx && PointIsVertex(j2->pt2a, pt)) + j2->poly2Idx = j->poly2Idx; + } +} +//---------------------------------------------------------------------- + +bool Poly2ContainsPoly1(OutPt* outPt1, OutPt* outPt2, bool UseFullInt64Range) +{ + OutPt* pt = outPt1; + //Because the polygons may be touching, we need to find a vertex that + //isn't touching the other polygon ... + if (PointOnPolygon(pt->pt, outPt2, UseFullInt64Range)) + { + pt = pt->next; + while (pt != outPt1 && PointOnPolygon(pt->pt, outPt2, UseFullInt64Range)) + pt = pt->next; + if (pt == outPt1) return true; + } + return PointInPolygon(pt->pt, outPt2, UseFullInt64Range); +} +//---------------------------------------------------------------------- + +void Clipper::FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec) +{ + + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) + { + OutRec* outRec = m_PolyOuts[i]; + if (outRec->pts && outRec->FirstLeft == OldOutRec) + { + if (Poly2ContainsPoly1(outRec->pts, NewOutRec->pts, m_UseFullRange)) + outRec->FirstLeft = NewOutRec; + } + } +} +//---------------------------------------------------------------------- + +void Clipper::FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec) +{ + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) + { + OutRec* outRec = m_PolyOuts[i]; + if (outRec->FirstLeft == OldOutRec) outRec->FirstLeft = NewOutRec; + } +} +//---------------------------------------------------------------------- + +void Clipper::JoinCommonEdges() +{ + for (JoinList::size_type i = 0; i < m_Joins.size(); i++) + { + JoinRec* j = m_Joins[i]; + + OutRec *outRec1 = GetOutRec(j->poly1Idx); + OutRec *outRec2 = GetOutRec(j->poly2Idx); + + if (!outRec1->pts || !outRec2->pts) continue; + + //get the polygon fragment with the correct hole state (FirstLeft) + //before calling JoinPoints() ... + OutRec *holeStateRec; + if (outRec1 == outRec2) holeStateRec = outRec1; + else if (Param1RightOfParam2(outRec1, outRec2)) holeStateRec = outRec2; + else if (Param1RightOfParam2(outRec2, outRec1)) holeStateRec = outRec1; + else holeStateRec = GetLowermostRec(outRec1, outRec2); + + OutPt *p1, *p2; + if (!JoinPoints(j, p1, p2)) continue; + + if (outRec1 == outRec2) + { + //instead of joining two polygons, we've just created a new one by + //splitting one polygon into two. + outRec1->pts = p1; + outRec1->bottomPt = 0; + outRec2 = CreateOutRec(); + outRec2->pts = p2; + + if (Poly2ContainsPoly1(outRec2->pts, outRec1->pts, m_UseFullRange)) + { + //outRec2 is contained by outRec1 ... + outRec2->isHole = !outRec1->isHole; + outRec2->FirstLeft = outRec1; + + FixupJoinRecs(j, p2, i+1); + + //fixup FirstLeft pointers that may need reassigning to OutRec1 + if (m_UsingPolyTree) FixupFirstLefts2(outRec2, outRec1); + + FixupOutPolygon(*outRec1); //nb: do this BEFORE testing orientation + FixupOutPolygon(*outRec2); // but AFTER calling FixupJoinRecs() + + + if ((outRec2->isHole ^ m_ReverseOutput) == (Area(*outRec2, m_UseFullRange) > 0)) + ReversePolyPtLinks(outRec2->pts); + + } else if (Poly2ContainsPoly1(outRec1->pts, outRec2->pts, m_UseFullRange)) + { + //outRec1 is contained by outRec2 ... + outRec2->isHole = outRec1->isHole; + outRec1->isHole = !outRec2->isHole; + outRec2->FirstLeft = outRec1->FirstLeft; + outRec1->FirstLeft = outRec2; + + FixupJoinRecs(j, p2, i+1); + + //fixup FirstLeft pointers that may need reassigning to OutRec1 + if (m_UsingPolyTree) FixupFirstLefts2(outRec1, outRec2); + + FixupOutPolygon(*outRec1); //nb: do this BEFORE testing orientation + FixupOutPolygon(*outRec2); // but AFTER calling FixupJoinRecs() + + if ((outRec1->isHole ^ m_ReverseOutput) == (Area(*outRec1, m_UseFullRange) > 0)) + ReversePolyPtLinks(outRec1->pts); + } + else + { + //the 2 polygons are completely separate ... + outRec2->isHole = outRec1->isHole; + outRec2->FirstLeft = outRec1->FirstLeft; + + FixupJoinRecs(j, p2, i+1); + + //fixup FirstLeft pointers that may need reassigning to OutRec2 + if (m_UsingPolyTree) FixupFirstLefts1(outRec1, outRec2); + + FixupOutPolygon(*outRec1); //nb: do this BEFORE testing orientation + FixupOutPolygon(*outRec2); // but AFTER calling FixupJoinRecs() + } + + } else + { + //joined 2 polygons together ... + + //cleanup redundant edges ... + FixupOutPolygon(*outRec1); + + outRec2->pts = 0; + outRec2->bottomPt = 0; + outRec2->idx = outRec1->idx; + + outRec1->isHole = holeStateRec->isHole; + if (holeStateRec == outRec2) + outRec1->FirstLeft = outRec2->FirstLeft; + outRec2->FirstLeft = outRec1; + + //fixup FirstLeft pointers that may need reassigning to OutRec1 + if (m_UsingPolyTree) FixupFirstLefts2(outRec2, outRec1); + } + } +} +//------------------------------------------------------------------------------ + +inline void UpdateOutPtIdxs(OutRec& outrec) +{ + OutPt* op = outrec.pts; + do + { + op->idx = outrec.idx; + op = op->prev; + } + while(op != outrec.pts); +} +//------------------------------------------------------------------------------ + +void Clipper::DoSimplePolygons() +{ + PolyOutList::size_type i = 0; + while (i < m_PolyOuts.size()) + { + OutRec* outrec = m_PolyOuts[i++]; + OutPt* op = outrec->pts; + if (!op) continue; + do //for each Pt in Polygon until duplicate found do ... + { + OutPt* op2 = op->next; + while (op2 != outrec->pts) + { + if (PointsEqual(op->pt, op2->pt) && op2->next != op && op2->prev != op) + { + //split the polygon into two ... + OutPt* op3 = op->prev; + OutPt* op4 = op2->prev; + op->prev = op4; + op4->next = op; + op2->prev = op3; + op3->next = op2; + + outrec->pts = op; + OutRec* outrec2 = CreateOutRec(); + outrec2->pts = op2; + UpdateOutPtIdxs(*outrec2); + if (Poly2ContainsPoly1(outrec2->pts, outrec->pts, m_UseFullRange)) + { + //OutRec2 is contained by OutRec1 ... + outrec2->isHole = !outrec->isHole; + outrec2->FirstLeft = outrec; + } + else + if (Poly2ContainsPoly1(outrec->pts, outrec2->pts, m_UseFullRange)) + { + //OutRec1 is contained by OutRec2 ... + outrec2->isHole = outrec->isHole; + outrec->isHole = !outrec2->isHole; + outrec2->FirstLeft = outrec->FirstLeft; + outrec->FirstLeft = outrec2; + } else + { + //the 2 polygons are separate ... + outrec2->isHole = outrec->isHole; + outrec2->FirstLeft = outrec->FirstLeft; + } + op2 = op; //ie get ready for the next iteration + } + op2 = op2->next; + } + op = op->next; + } + while (op != outrec->pts); + } +} +//------------------------------------------------------------------------------ + +void ReversePolygon(Polygon& p) +{ + std::reverse(p.begin(), p.end()); +} +//------------------------------------------------------------------------------ + +void ReversePolygons(Polygons& p) +{ + for (Polygons::size_type i = 0; i < p.size(); ++i) + ReversePolygon(p[i]); +} + +//------------------------------------------------------------------------------ +// OffsetPolygon functions ... +//------------------------------------------------------------------------------ + +struct DoublePoint +{ + double X; + double Y; + DoublePoint(double x = 0, double y = 0) : X(x), Y(y) {} +}; +//------------------------------------------------------------------------------ + +Polygon BuildArc(const IntPoint &pt, + const double a1, const double a2, const double r, double limit) +{ + //see notes in clipper.pas regarding steps + double arcFrac = std::fabs(a2 - a1) / (2 * pi); + int steps = (int)(arcFrac * pi / std::acos(1 - limit / std::fabs(r))); + if (steps < 2) steps = 2; + else if (steps > (int)(222.0 * arcFrac)) steps = (int)(222.0 * arcFrac); + + double x = std::cos(a1); + double y = std::sin(a1); + double c = std::cos((a2 - a1) / steps); + double s = std::sin((a2 - a1) / steps); + Polygon result(steps +1); + for (int i = 0; i <= steps; ++i) + { + result[i].X = pt.X + Round(x * r); + result[i].Y = pt.Y + Round(y * r); + double x2 = x; + x = x * c - s * y; //cross product + y = x2 * s + y * c; //dot product + } + return result; +} +//------------------------------------------------------------------------------ + +DoublePoint GetUnitNormal(const IntPoint &pt1, const IntPoint &pt2) +{ + if(pt2.X == pt1.X && pt2.Y == pt1.Y) + return DoublePoint(0, 0); + + double dx = (double)(pt2.X - pt1.X); + double dy = (double)(pt2.Y - pt1.Y); + double f = 1 *1.0/ std::sqrt( dx*dx + dy*dy ); + dx *= f; + dy *= f; + return DoublePoint(dy, -dx); +} + +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ + +class PolyOffsetBuilder +{ +private: + Polygons m_p; + Polygon* m_curr_poly; + std::vector normals; + double m_delta, m_RMin, m_R; + size_t m_i, m_j, m_k; + static const int buffLength = 128; + JoinType m_jointype; + +public: + +PolyOffsetBuilder(const Polygons& in_polys, Polygons& out_polys, + double delta, JoinType jointype, double limit, bool autoFix) +{ + //nb precondition - out_polys != ptsin_polys + if (NEAR_ZERO(delta)) + { + out_polys = in_polys; + return; + } + + this->m_p = in_polys; + this->m_delta = delta; + this->m_jointype = jointype; + + //ChecksInput - fixes polygon orientation if necessary and removes + //duplicate vertices. Can be set false when you're sure that polygon + //orientation is correct and that there are no duplicate vertices. + if (autoFix) + { + size_t Len = m_p.size(), botI = 0; + while (botI < Len && m_p[botI].empty()) botI++; + if (botI == Len) return; + + //botPt: used to find the lowermost (in inverted Y-axis) & leftmost point + //This point (on m_p[botI]) must be on an outer polygon ring and if + //its orientation is false (counterclockwise) then assume all polygons + //need reversing ... + IntPoint botPt = m_p[botI][0]; + for (size_t i = botI; i < Len; ++i) + { + if (m_p[i].size() < 3) continue; + if (UpdateBotPt(m_p[i][0], botPt)) botI = i; + Polygon::iterator it = m_p[i].begin() +1; + while (it != m_p[i].end()) + { + if (PointsEqual(*it, *(it -1))) + it = m_p[i].erase(it); + else + { + if (UpdateBotPt(*it, botPt)) botI = i; + ++it; + } + } + } + if (!Orientation(m_p[botI])) + ReversePolygons(m_p); + } + + switch (jointype) + { + case jtRound: + if (limit <= 0) limit = 0.25; + else if (limit > std::fabs(delta)) limit = std::fabs(delta); + break; + case jtMiter: + if (limit < 2) limit = 2; + break; + default: //unused + limit = 1; + } + m_RMin = 2.0/(limit*limit); + + double deltaSq = delta*delta; + out_polys.clear(); + out_polys.resize(m_p.size()); + for (m_i = 0; m_i < m_p.size(); m_i++) + { + m_curr_poly = &out_polys[m_i]; + size_t len = m_p[m_i].size(); + if (len > 1 && m_p[m_i][0].X == m_p[m_i][len - 1].X && + m_p[m_i][0].Y == m_p[m_i][len-1].Y) len--; + + //when 'shrinking' polygons - to minimize artefacts + //strip those polygons that have an area < pi * delta^2 ... + double a1 = Area(m_p[m_i]); + if (delta < 0) { if (a1 > 0 && a1 < deltaSq *pi) len = 0; } + else if (a1 < 0 && -a1 < deltaSq *pi) len = 0; //holes have neg. area + + if (len == 0 || (len < 3 && delta <= 0)) + continue; + else if (len == 1) + { + Polygon arc; + arc = BuildArc(m_p[m_i][len-1], 0, 2 * pi, delta, limit); + out_polys[m_i] = arc; + continue; + } + + //build normals ... + normals.clear(); + normals.resize(len); + normals[len-1] = GetUnitNormal(m_p[m_i][len-1], m_p[m_i][0]); + for (m_j = 0; m_j < len -1; ++m_j) + normals[m_j] = GetUnitNormal(m_p[m_i][m_j], m_p[m_i][m_j+1]); + + m_k = len -1; + for (m_j = 0; m_j < len; ++m_j) + { + switch (jointype) + { + case jtMiter: + { + m_R = 1 + (normals[m_j].X*normals[m_k].X + + normals[m_j].Y*normals[m_k].Y); + if (m_R >= m_RMin) DoMiter(); else DoSquare(limit); + break; + } + case jtSquare: DoSquare(1.0); break; + case jtRound: DoRound(limit); break; + } + m_k = m_j; + } + } + + //finally, clean up untidy corners using Clipper ... + Clipper clpr; + clpr.AddPolygons(out_polys, ptSubject); + if (delta > 0) + { + if (!clpr.Execute(ctUnion, out_polys, pftPositive, pftPositive)) + out_polys.clear(); + } + else + { + IntRect r = clpr.GetBounds(); + Polygon outer(4); + outer[0] = IntPoint(r.left - 10, r.bottom + 10); + outer[1] = IntPoint(r.right + 10, r.bottom + 10); + outer[2] = IntPoint(r.right + 10, r.top - 10); + outer[3] = IntPoint(r.left - 10, r.top - 10); + + clpr.AddPolygon(outer, ptSubject); + if (clpr.Execute(ctUnion, out_polys, pftNegative, pftNegative)) + { + out_polys.erase(out_polys.begin()); + ReversePolygons(out_polys); + + } else + out_polys.clear(); + } +} +//------------------------------------------------------------------------------ + +private: + +void AddPoint(const IntPoint& pt) +{ + if (m_curr_poly->size() == m_curr_poly->capacity()) + m_curr_poly->reserve(m_curr_poly->capacity() + buffLength); + m_curr_poly->push_back(pt); +} +//------------------------------------------------------------------------------ + +void DoSquare(double mul) +{ + IntPoint pt1 = IntPoint((long64)Round(m_p[m_i][m_j].X + normals[m_k].X * m_delta), + (long64)Round(m_p[m_i][m_j].Y + normals[m_k].Y * m_delta)); + IntPoint pt2 = IntPoint((long64)Round(m_p[m_i][m_j].X + normals[m_j].X * m_delta), + (long64)Round(m_p[m_i][m_j].Y + normals[m_j].Y * m_delta)); + if ((normals[m_k].X * normals[m_j].Y - normals[m_j].X * normals[m_k].Y) * m_delta >= 0) + { + double a1 = std::atan2(normals[m_k].Y, normals[m_k].X); + double a2 = std::atan2(-normals[m_j].Y, -normals[m_j].X); + a1 = std::fabs(a2 - a1); + if (a1 > pi) a1 = pi * 2 - a1; + double dx = std::tan((pi - a1) / 4) * std::fabs(m_delta * mul); + pt1 = IntPoint((long64)(pt1.X -normals[m_k].Y * dx), + (long64)(pt1.Y + normals[m_k].X * dx)); + AddPoint(pt1); + pt2 = IntPoint((long64)(pt2.X + normals[m_j].Y * dx), + (long64)(pt2.Y -normals[m_j].X * dx)); + AddPoint(pt2); + } + else + { + AddPoint(pt1); + AddPoint(m_p[m_i][m_j]); + AddPoint(pt2); + } +} +//------------------------------------------------------------------------------ + +void DoMiter() +{ + if ((normals[m_k].X * normals[m_j].Y - normals[m_j].X * normals[m_k].Y) * m_delta >= 0) + { + double q = m_delta / m_R; + AddPoint(IntPoint((long64)Round(m_p[m_i][m_j].X + + (normals[m_k].X + normals[m_j].X) * q), + (long64)Round(m_p[m_i][m_j].Y + (normals[m_k].Y + normals[m_j].Y) * q))); + } + else + { + IntPoint pt1 = IntPoint((long64)Round(m_p[m_i][m_j].X + normals[m_k].X * + m_delta), (long64)Round(m_p[m_i][m_j].Y + normals[m_k].Y * m_delta)); + IntPoint pt2 = IntPoint((long64)Round(m_p[m_i][m_j].X + normals[m_j].X * + m_delta), (long64)Round(m_p[m_i][m_j].Y + normals[m_j].Y * m_delta)); + AddPoint(pt1); + AddPoint(m_p[m_i][m_j]); + AddPoint(pt2); + } +} +//------------------------------------------------------------------------------ + +void DoRound(double limit) +{ + IntPoint pt1 = IntPoint((long64)Round(m_p[m_i][m_j].X + normals[m_k].X * m_delta), + (long64)Round(m_p[m_i][m_j].Y + normals[m_k].Y * m_delta)); + IntPoint pt2 = IntPoint((long64)Round(m_p[m_i][m_j].X + normals[m_j].X * m_delta), + (long64)Round(m_p[m_i][m_j].Y + normals[m_j].Y * m_delta)); + AddPoint(pt1); + //round off reflex angles (ie > 180 deg) unless almost flat (ie < ~10deg). + if ((normals[m_k].X*normals[m_j].Y - normals[m_j].X*normals[m_k].Y) * m_delta >= 0) + { + if (normals[m_j].X * normals[m_k].X + normals[m_j].Y * normals[m_k].Y < 0.985) + { + double a1 = std::atan2(normals[m_k].Y, normals[m_k].X); + double a2 = std::atan2(normals[m_j].Y, normals[m_j].X); + if (m_delta > 0 && a2 < a1) a2 += pi *2; + else if (m_delta < 0 && a2 > a1) a2 -= pi *2; + Polygon arc = BuildArc(m_p[m_i][m_j], a1, a2, m_delta, limit); + for (Polygon::size_type m = 0; m < arc.size(); m++) + AddPoint(arc[m]); + } + } + else + AddPoint(m_p[m_i][m_j]); + AddPoint(pt2); +} +//-------------------------------------------------------------------------- + +bool UpdateBotPt(const IntPoint &pt, IntPoint &botPt) +{ + if (pt.Y > botPt.Y || (pt.Y == botPt.Y && pt.X < botPt.X)) + { + botPt = pt; + return true; + } + else return false; +} +//-------------------------------------------------------------------------- + +}; //end PolyOffsetBuilder + +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ + +void OffsetPolygons(const Polygons &in_polys, Polygons &out_polys, + double delta, JoinType jointype, double limit, bool autoFix) +{ + if (&out_polys == &in_polys) + { + Polygons poly2(in_polys); + PolyOffsetBuilder(poly2, out_polys, delta, jointype, limit, autoFix); + } + else PolyOffsetBuilder(in_polys, out_polys, delta, jointype, limit, autoFix); +} +//------------------------------------------------------------------------------ + +void SimplifyPolygon(const Polygon &in_poly, Polygons &out_polys, PolyFillType fillType) +{ + Clipper c; + c.ForceSimple(true); + c.AddPolygon(in_poly, ptSubject); + c.Execute(ctUnion, out_polys, fillType, fillType); +} +//------------------------------------------------------------------------------ + +void SimplifyPolygons(const Polygons &in_polys, Polygons &out_polys, PolyFillType fillType) +{ + Clipper c; + c.ForceSimple(true); + c.AddPolygons(in_polys, ptSubject); + c.Execute(ctUnion, out_polys, fillType, fillType); +} +//------------------------------------------------------------------------------ + +void SimplifyPolygons(Polygons &polys, PolyFillType fillType) +{ + SimplifyPolygons(polys, polys, fillType); +} +//------------------------------------------------------------------------------ + +inline double DistanceSqrd(const IntPoint& pt1, const IntPoint& pt2) +{ + double dx = ((double)pt1.X - pt2.X); + double dy = ((double)pt1.Y - pt2.Y); + return (dx*dx + dy*dy); +} +//------------------------------------------------------------------------------ + +DoublePoint ClosestPointOnLine(const IntPoint& pt, const IntPoint& linePt1, const IntPoint& linePt2) +{ + double dx = ((double)linePt2.X - linePt1.X); + double dy = ((double)linePt2.Y - linePt1.Y); + if (dx == 0 && dy == 0) + return DoublePoint((double)linePt1.X, (double)linePt1.Y); + double q = ((pt.X-linePt1.X)*dx + (pt.Y-linePt1.Y)*dy) / (dx*dx + dy*dy); + return DoublePoint( + (1-q)*linePt1.X + q*linePt2.X, + (1-q)*linePt1.Y + q*linePt2.Y); +} +//------------------------------------------------------------------------------ + +bool SlopesNearColinear(const IntPoint& pt1, + const IntPoint& pt2, const IntPoint& pt3, double distSqrd) +{ + if (DistanceSqrd(pt1, pt2) > DistanceSqrd(pt1, pt3)) return false; + DoublePoint cpol = ClosestPointOnLine(pt2, pt1, pt3); + double dx = pt2.X - cpol.X; + double dy = pt2.Y - cpol.Y; + return (dx*dx + dy*dy) < distSqrd; +} +//------------------------------------------------------------------------------ + +bool PointsAreClose(IntPoint pt1, IntPoint pt2, double distSqrd) +{ + double dx = (double)pt1.X - pt2.X; + double dy = (double)pt1.Y - pt2.Y; + return ((dx * dx) + (dy * dy) <= distSqrd); +} +//------------------------------------------------------------------------------ + +void CleanPolygon(Polygon& in_poly, Polygon& out_poly, double distance) +{ + //distance = proximity in units/pixels below which vertices + //will be stripped. Default ~= sqrt(2). + int highI = in_poly.size() -1; + double distSqrd = distance * distance; + while (highI > 0 && PointsAreClose(in_poly[highI], in_poly[0], distSqrd)) highI--; + if (highI < 2) { out_poly.clear(); return; } + + out_poly.resize(highI + 1); + IntPoint pt = in_poly[highI]; + int i = 0, k = 0; + for (;;) + { + while (i <= highI && PointsAreClose(pt, in_poly[i+1], distSqrd)) i+=2; + int i2 = i; + while (i <= highI && PointsAreClose(in_poly[i], in_poly[i+1], distSqrd) || + SlopesNearColinear(pt, in_poly[i], in_poly[+1], distSqrd)) i++; + if (i >= highI) break; + else if (i != i2) continue; + pt = in_poly[i++]; + out_poly[k++] = pt; + } + if (i <= highI) out_poly[k++] = in_poly[i]; + if (k > 2 && SlopesNearColinear(out_poly[k -2], out_poly[k -1], out_poly[0], distSqrd)) k--; + if (k < 3) out_poly.clear(); + else if (k <= highI) out_poly.resize(k); +} +//------------------------------------------------------------------------------ + +void CleanPolygons(Polygons& in_polys, Polygons& out_polys, double distance) +{ + for (Polygons::size_type i = 0; i < in_polys.size(); ++i) + CleanPolygon(in_polys[i], out_polys[i], distance); +} +//------------------------------------------------------------------------------ + +void AddPolyNodeToPolygons(PolyNode& polynode, Polygons& polygons) +{ + if (!polynode.Contour.empty()) + polygons.push_back(polynode.Contour); + for (int i = 0; i < polynode.ChildCount(); ++i) + AddPolyNodeToPolygons(*polynode.Childs[i], polygons); +} +//------------------------------------------------------------------------------ + +void PolyTreeToPolygons(PolyTree& polytree, Polygons& polygons) +{ + polygons.resize(0); + polygons.reserve(polytree.Total()); + AddPolyNodeToPolygons(polytree, polygons); +} +//------------------------------------------------------------------------------ + +std::ostream& operator <<(std::ostream &s, IntPoint& p) +{ + s << p.X << ' ' << p.Y << "\n"; + return s; +} +//------------------------------------------------------------------------------ + +std::ostream& operator <<(std::ostream &s, Polygon &p) +{ + for (Polygon::size_type i = 0; i < p.size(); i++) + s << p[i]; + s << "\n"; + return s; +} +//------------------------------------------------------------------------------ + +std::ostream& operator <<(std::ostream &s, Polygons &p) +{ + for (Polygons::size_type i = 0; i < p.size(); i++) + s << p[i]; + s << "\n"; + return s; +} +//------------------------------------------------------------------------------ + +} //ClipperLib namespace diff -Nru mapnik-2.1.0/deps/mapnik/build.py mapnik-2.2.0/deps/mapnik/build.py --- mapnik-2.1.0/deps/mapnik/build.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/deps/mapnik/build.py 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,18 @@ +import os +from glob import glob + +Import('env') + +subdirs = { + 'sparsehash':'sparsehash', + 'sparsehash/internal':'sparsehash/internal', + '../agg/include':'agg', + '../clipper/include':'agg' +} + +if 'install' in COMMAND_LINE_TARGETS: + for k,v in subdirs.items(): + pathdir = os.path.join(k,'*') + includes = glob(pathdir) + inc_target = os.path.normpath(env['INSTALL_PREFIX']+'/include/mapnik/'+v) + env.Alias(target='install', source=env.Install(inc_target, includes)) diff -Nru mapnik-2.1.0/deps/mapnik/sparsehash/dense_hash_map mapnik-2.2.0/deps/mapnik/sparsehash/dense_hash_map --- mapnik-2.1.0/deps/mapnik/sparsehash/dense_hash_map 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/deps/mapnik/sparsehash/dense_hash_map 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,369 @@ +// Copyright (c) 2005, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// ---- +// +// This is just a very thin wrapper over densehashtable.h, just +// like sgi stl's stl_hash_map is a very thin wrapper over +// stl_hashtable. The major thing we define is operator[], because +// we have a concept of a data_type which stl_hashtable doesn't +// (it only has a key and a value). +// +// NOTE: this is exactly like sparse_hash_map.h, with the word +// "sparse" replaced by "dense", except for the addition of +// set_empty_key(). +// +// YOU MUST CALL SET_EMPTY_KEY() IMMEDIATELY AFTER CONSTRUCTION. +// +// Otherwise your program will die in mysterious ways. (Note if you +// use the constructor that takes an InputIterator range, you pass in +// the empty key in the constructor, rather than after. As a result, +// this constructor differs from the standard STL version.) +// +// In other respects, we adhere mostly to the STL semantics for +// hash-map. One important exception is that insert() may invalidate +// iterators entirely -- STL semantics are that insert() may reorder +// iterators, but they all still refer to something valid in the +// hashtable. Not so for us. Likewise, insert() may invalidate +// pointers into the hashtable. (Whether insert invalidates iterators +// and pointers depends on whether it results in a hashtable resize). +// On the plus side, delete() doesn't invalidate iterators or pointers +// at all, or even change the ordering of elements. +// +// Here are a few "power user" tips: +// +// 1) set_deleted_key(): +// If you want to use erase() you *must* call set_deleted_key(), +// in addition to set_empty_key(), after construction. +// The deleted and empty keys must differ. +// +// 2) resize(0): +// When an item is deleted, its memory isn't freed right +// away. This allows you to iterate over a hashtable, +// and call erase(), without invalidating the iterator. +// To force the memory to be freed, call resize(0). +// For tr1 compatibility, this can also be called as rehash(0). +// +// 3) min_load_factor(0.0) +// Setting the minimum load factor to 0.0 guarantees that +// the hash table will never shrink. +// +// Roughly speaking: +// (1) dense_hash_map: fastest, uses the most memory unless entries are small +// (2) sparse_hash_map: slowest, uses the least memory +// (3) hash_map / unordered_map (STL): in the middle +// +// Typically I use sparse_hash_map when I care about space and/or when +// I need to save the hashtable on disk. I use hash_map otherwise. I +// don't personally use dense_hash_set ever; some people use it for +// small sets with lots of lookups. +// +// - dense_hash_map has, typically, about 78% memory overhead (if your +// data takes up X bytes, the hash_map uses .78X more bytes in overhead). +// - sparse_hash_map has about 4 bits overhead per entry. +// - sparse_hash_map can be 3-7 times slower than the others for lookup and, +// especially, inserts. See time_hash_map.cc for details. +// +// See /usr/(local/)?doc/sparsehash-*/dense_hash_map.html +// for information about how to use this class. + +#ifndef _DENSE_HASH_MAP_H_ +#define _DENSE_HASH_MAP_H_ + +#include +#include // needed by stl_alloc +#include // for equal_to<>, select1st<>, etc +#include // for alloc +#include // for pair<> +#include // IWYU pragma: export +#include +#include HASH_FUN_H // for hash<> +_START_GOOGLE_NAMESPACE_ + +template , // defined in sparseconfig.h + class EqualKey = std::equal_to, + class Alloc = libc_allocator_with_realloc > > +class dense_hash_map { + private: + // Apparently select1st is not stl-standard, so we define our own + struct SelectKey { + typedef const Key& result_type; + const Key& operator()(const std::pair& p) const { + return p.first; + } + }; + struct SetKey { + void operator()(std::pair* value, const Key& new_key) const { + *const_cast(&value->first) = new_key; + // It would be nice to clear the rest of value here as well, in + // case it's taking up a lot of memory. We do this by clearing + // the value. This assumes T has a zero-arg constructor! + value->second = T(); + } + }; + // For operator[]. + struct DefaultValue { + std::pair operator()(const Key& key) { + return std::make_pair(key, T()); + } + }; + + // The actual data + typedef dense_hashtable, Key, HashFcn, SelectKey, + SetKey, EqualKey, Alloc> ht; + ht rep; + + public: + typedef typename ht::key_type key_type; + typedef T data_type; + typedef T mapped_type; + typedef typename ht::value_type value_type; + typedef typename ht::hasher hasher; + typedef typename ht::key_equal key_equal; + typedef Alloc allocator_type; + + typedef typename ht::size_type size_type; + typedef typename ht::difference_type difference_type; + typedef typename ht::pointer pointer; + typedef typename ht::const_pointer const_pointer; + typedef typename ht::reference reference; + typedef typename ht::const_reference const_reference; + + typedef typename ht::iterator iterator; + typedef typename ht::const_iterator const_iterator; + typedef typename ht::local_iterator local_iterator; + typedef typename ht::const_local_iterator const_local_iterator; + + // Iterator functions + iterator begin() { return rep.begin(); } + iterator end() { return rep.end(); } + const_iterator begin() const { return rep.begin(); } + const_iterator end() const { return rep.end(); } + + + // These come from tr1's unordered_map. For us, a bucket has 0 or 1 elements. + local_iterator begin(size_type i) { return rep.begin(i); } + local_iterator end(size_type i) { return rep.end(i); } + const_local_iterator begin(size_type i) const { return rep.begin(i); } + const_local_iterator end(size_type i) const { return rep.end(i); } + + // Accessor functions + allocator_type get_allocator() const { return rep.get_allocator(); } + hasher hash_funct() const { return rep.hash_funct(); } + hasher hash_function() const { return hash_funct(); } + key_equal key_eq() const { return rep.key_eq(); } + + + // Constructors + explicit dense_hash_map(size_type expected_max_items_in_table = 0, + const hasher& hf = hasher(), + const key_equal& eql = key_equal(), + const allocator_type& alloc = allocator_type()) + : rep(expected_max_items_in_table, hf, eql, SelectKey(), SetKey(), alloc) { + } + + template + dense_hash_map(InputIterator f, InputIterator l, + const key_type& empty_key_val, + size_type expected_max_items_in_table = 0, + const hasher& hf = hasher(), + const key_equal& eql = key_equal(), + const allocator_type& alloc = allocator_type()) + : rep(expected_max_items_in_table, hf, eql, SelectKey(), SetKey(), alloc) { + set_empty_key(empty_key_val); + rep.insert(f, l); + } + // We use the default copy constructor + // We use the default operator=() + // We use the default destructor + + void clear() { rep.clear(); } + // This clears the hash map without resizing it down to the minimum + // bucket count, but rather keeps the number of buckets constant + void clear_no_resize() { rep.clear_no_resize(); } + void swap(dense_hash_map& hs) { rep.swap(hs.rep); } + + + // Functions concerning size + size_type size() const { return rep.size(); } + size_type max_size() const { return rep.max_size(); } + bool empty() const { return rep.empty(); } + size_type bucket_count() const { return rep.bucket_count(); } + size_type max_bucket_count() const { return rep.max_bucket_count(); } + + // These are tr1 methods. bucket() is the bucket the key is or would be in. + size_type bucket_size(size_type i) const { return rep.bucket_size(i); } + size_type bucket(const key_type& key) const { return rep.bucket(key); } + float load_factor() const { + return size() * 1.0f / bucket_count(); + } + float max_load_factor() const { + float shrink, grow; + rep.get_resizing_parameters(&shrink, &grow); + return grow; + } + void max_load_factor(float new_grow) { + float shrink, grow; + rep.get_resizing_parameters(&shrink, &grow); + rep.set_resizing_parameters(shrink, new_grow); + } + // These aren't tr1 methods but perhaps ought to be. + float min_load_factor() const { + float shrink, grow; + rep.get_resizing_parameters(&shrink, &grow); + return shrink; + } + void min_load_factor(float new_shrink) { + float shrink, grow; + rep.get_resizing_parameters(&shrink, &grow); + rep.set_resizing_parameters(new_shrink, grow); + } + // Deprecated; use min_load_factor() or max_load_factor() instead. + void set_resizing_parameters(float shrink, float grow) { + rep.set_resizing_parameters(shrink, grow); + } + + void resize(size_type hint) { rep.resize(hint); } + void rehash(size_type hint) { resize(hint); } // the tr1 name + + // Lookup routines + iterator find(const key_type& key) { return rep.find(key); } + const_iterator find(const key_type& key) const { return rep.find(key); } + + data_type& operator[](const key_type& key) { // This is our value-add! + // If key is in the hashtable, returns find(key)->second, + // otherwise returns insert(value_type(key, T()).first->second. + // Note it does not create an empty T unless the find fails. + return rep.template find_or_insert(key).second; + } + + size_type count(const key_type& key) const { return rep.count(key); } + + std::pair equal_range(const key_type& key) { + return rep.equal_range(key); + } + std::pair equal_range(const key_type& key) + const { + return rep.equal_range(key); + } + + + // Insertion routines + std::pair insert(const value_type& obj) { + return rep.insert(obj); + } + template void insert(InputIterator f, InputIterator l) { + rep.insert(f, l); + } + void insert(const_iterator f, const_iterator l) { + rep.insert(f, l); + } + // Required for std::insert_iterator; the passed-in iterator is ignored. + iterator insert(iterator, const value_type& obj) { + return insert(obj).first; + } + + // Deletion and empty routines + // THESE ARE NON-STANDARD! I make you specify an "impossible" key + // value to identify deleted and empty buckets. You can change the + // deleted key as time goes on, or get rid of it entirely to be insert-only. + void set_empty_key(const key_type& key) { // YOU MUST CALL THIS! + rep.set_empty_key(value_type(key, data_type())); // rep wants a value + } + key_type empty_key() const { + return rep.empty_key().first; // rep returns a value + } + + void set_deleted_key(const key_type& key) { rep.set_deleted_key(key); } + void clear_deleted_key() { rep.clear_deleted_key(); } + key_type deleted_key() const { return rep.deleted_key(); } + + // These are standard + size_type erase(const key_type& key) { return rep.erase(key); } + void erase(iterator it) { rep.erase(it); } + void erase(iterator f, iterator l) { rep.erase(f, l); } + + + // Comparison + bool operator==(const dense_hash_map& hs) const { return rep == hs.rep; } + bool operator!=(const dense_hash_map& hs) const { return rep != hs.rep; } + + + // I/O -- this is an add-on for writing hash map to disk + // + // For maximum flexibility, this does not assume a particular + // file type (though it will probably be a FILE *). We just pass + // the fp through to rep. + + // If your keys and values are simple enough, you can pass this + // serializer to serialize()/unserialize(). "Simple enough" means + // value_type is a POD type that contains no pointers. Note, + // however, we don't try to normalize endianness. + typedef typename ht::NopointerSerializer NopointerSerializer; + + // serializer: a class providing operator()(OUTPUT*, const value_type&) + // (writing value_type to OUTPUT). You can specify a + // NopointerSerializer object if appropriate (see above). + // fp: either a FILE*, OR an ostream*/subclass_of_ostream*, OR a + // pointer to a class providing size_t Write(const void*, size_t), + // which writes a buffer into a stream (which fp presumably + // owns) and returns the number of bytes successfully written. + // Note basic_ostream is not currently supported. + template + bool serialize(ValueSerializer serializer, OUTPUT* fp) { + return rep.serialize(serializer, fp); + } + + // serializer: a functor providing operator()(INPUT*, value_type*) + // (reading from INPUT and into value_type). You can specify a + // NopointerSerializer object if appropriate (see above). + // fp: either a FILE*, OR an istream*/subclass_of_istream*, OR a + // pointer to a class providing size_t Read(void*, size_t), + // which reads into a buffer from a stream (which fp presumably + // owns) and returns the number of bytes successfully read. + // Note basic_istream is not currently supported. + // NOTE: Since value_type is std::pair, ValueSerializer + // may need to do a const cast in order to fill in the key. + template + bool unserialize(ValueSerializer serializer, INPUT* fp) { + return rep.unserialize(serializer, fp); + } +}; + +// We need a global swap as well +template +inline void swap(dense_hash_map& hm1, + dense_hash_map& hm2) { + hm1.swap(hm2); +} + +_END_GOOGLE_NAMESPACE_ + +#endif /* _DENSE_HASH_MAP_H_ */ diff -Nru mapnik-2.1.0/deps/mapnik/sparsehash/internal/densehashtable.h mapnik-2.2.0/deps/mapnik/sparsehash/internal/densehashtable.h --- mapnik-2.1.0/deps/mapnik/sparsehash/internal/densehashtable.h 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/deps/mapnik/sparsehash/internal/densehashtable.h 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,1319 @@ +// Copyright (c) 2005, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// +// A dense hashtable is a particular implementation of +// a hashtable: one that is meant to minimize memory allocation. +// It does this by using an array to store all the data. We +// steal a value from the key space to indicate "empty" array +// elements (ie indices where no item lives) and another to indicate +// "deleted" elements. +// +// (Note it is possible to change the value of the delete key +// on the fly; you can even remove it, though after that point +// the hashtable is insert_only until you set it again. The empty +// value however can't be changed.) +// +// To minimize allocation and pointer overhead, we use internal +// probing, in which the hashtable is a single table, and collisions +// are resolved by trying to insert again in another bucket. The +// most cache-efficient internal probing schemes are linear probing +// (which suffers, alas, from clumping) and quadratic probing, which +// is what we implement by default. +// +// Type requirements: value_type is required to be Copy Constructible +// and Default Constructible. It is not required to be (and commonly +// isn't) Assignable. +// +// You probably shouldn't use this code directly. Use dense_hash_map<> +// or dense_hash_set<> instead. + +// You can change the following below: +// HT_OCCUPANCY_PCT -- how full before we double size +// HT_EMPTY_PCT -- how empty before we halve size +// HT_MIN_BUCKETS -- default smallest bucket size +// +// You can also change enlarge_factor (which defaults to +// HT_OCCUPANCY_PCT), and shrink_factor (which defaults to +// HT_EMPTY_PCT) with set_resizing_parameters(). +// +// How to decide what values to use? +// shrink_factor's default of .4 * OCCUPANCY_PCT, is probably good. +// HT_MIN_BUCKETS is probably unnecessary since you can specify +// (indirectly) the starting number of buckets at construct-time. +// For enlarge_factor, you can use this chart to try to trade-off +// expected lookup time to the space taken up. By default, this +// code uses quadratic probing, though you can change it to linear +// via JUMP_ below if you really want to. +// +// From http://www.augustana.ca/~mohrj/courses/1999.fall/csc210/lecture_notes/hashing.html +// NUMBER OF PROBES / LOOKUP Successful Unsuccessful +// Quadratic collision resolution 1 - ln(1-L) - L/2 1/(1-L) - L - ln(1-L) +// Linear collision resolution [1+1/(1-L)]/2 [1+1/(1-L)2]/2 +// +// -- enlarge_factor -- 0.10 0.50 0.60 0.75 0.80 0.90 0.99 +// QUADRATIC COLLISION RES. +// probes/successful lookup 1.05 1.44 1.62 2.01 2.21 2.85 5.11 +// probes/unsuccessful lookup 1.11 2.19 2.82 4.64 5.81 11.4 103.6 +// LINEAR COLLISION RES. +// probes/successful lookup 1.06 1.5 1.75 2.5 3.0 5.5 50.5 +// probes/unsuccessful lookup 1.12 2.5 3.6 8.5 13.0 50.0 5000.0 + +#ifndef _DENSEHASHTABLE_H_ +#define _DENSEHASHTABLE_H_ + +#include +#include +#include // for FILE, fwrite, fread +#include // For swap(), eg +#include // For iterator tags +#include // for numeric_limits +#include // For uninitialized_fill +#include // for pair +#include +#include +#include +#include // For length_error + +_START_GOOGLE_NAMESPACE_ + +namespace base { // just to make google->opensource transition easier +using GOOGLE_NAMESPACE::true_type; +using GOOGLE_NAMESPACE::false_type; +using GOOGLE_NAMESPACE::integral_constant; +using GOOGLE_NAMESPACE::is_same; +using GOOGLE_NAMESPACE::remove_const; +} + +// The probing method +// Linear probing +// #define JUMP_(key, num_probes) ( 1 ) +// Quadratic probing +#define JUMP_(key, num_probes) ( num_probes ) + +// Hashtable class, used to implement the hashed associative containers +// hash_set and hash_map. + +// Value: what is stored in the table (each bucket is a Value). +// Key: something in a 1-to-1 correspondence to a Value, that can be used +// to search for a Value in the table (find() takes a Key). +// HashFcn: Takes a Key and returns an integer, the more unique the better. +// ExtractKey: given a Value, returns the unique Key associated with it. +// Must inherit from unary_function, or at least have a +// result_type enum indicating the return type of operator(). +// SetKey: given a Value* and a Key, modifies the value such that +// ExtractKey(value) == key. We guarantee this is only called +// with key == deleted_key or key == empty_key. +// EqualKey: Given two Keys, says whether they are the same (that is, +// if they are both associated with the same Value). +// Alloc: STL allocator to use to allocate memory. + +template +class dense_hashtable; + +template +struct dense_hashtable_iterator; + +template +struct dense_hashtable_const_iterator; + +// We're just an array, but we need to skip over empty and deleted elements +template +struct dense_hashtable_iterator { + private: + typedef typename A::template rebind::other value_alloc_type; + + public: + typedef dense_hashtable_iterator iterator; + typedef dense_hashtable_const_iterator const_iterator; + + typedef std::forward_iterator_tag iterator_category; // very little defined! + typedef V value_type; + typedef typename value_alloc_type::difference_type difference_type; + typedef typename value_alloc_type::size_type size_type; + typedef typename value_alloc_type::reference reference; + typedef typename value_alloc_type::pointer pointer; + + // "Real" constructor and default constructor + dense_hashtable_iterator(const dense_hashtable *h, + pointer it, pointer it_end, bool advance) + : ht(h), pos(it), end(it_end) { + if (advance) advance_past_empty_and_deleted(); + } + dense_hashtable_iterator() { } + // The default destructor is fine; we don't define one + // The default operator= is fine; we don't define one + + // Happy dereferencer + reference operator*() const { return *pos; } + pointer operator->() const { return &(operator*()); } + + // Arithmetic. The only hard part is making sure that + // we're not on an empty or marked-deleted array element + void advance_past_empty_and_deleted() { + while ( pos != end && (ht->test_empty(*this) || ht->test_deleted(*this)) ) + ++pos; + } + iterator& operator++() { + assert(pos != end); ++pos; advance_past_empty_and_deleted(); return *this; + } + iterator operator++(int) { iterator tmp(*this); ++*this; return tmp; } + + // Comparison. + bool operator==(const iterator& it) const { return pos == it.pos; } + bool operator!=(const iterator& it) const { return pos != it.pos; } + + + // The actual data + const dense_hashtable *ht; + pointer pos, end; +}; + + +// Now do it all again, but with const-ness! +template +struct dense_hashtable_const_iterator { + private: + typedef typename A::template rebind::other value_alloc_type; + + public: + typedef dense_hashtable_iterator iterator; + typedef dense_hashtable_const_iterator const_iterator; + + typedef std::forward_iterator_tag iterator_category; // very little defined! + typedef V value_type; + typedef typename value_alloc_type::difference_type difference_type; + typedef typename value_alloc_type::size_type size_type; + typedef typename value_alloc_type::const_reference reference; + typedef typename value_alloc_type::const_pointer pointer; + + // "Real" constructor and default constructor + dense_hashtable_const_iterator( + const dense_hashtable *h, + pointer it, pointer it_end, bool advance) + : ht(h), pos(it), end(it_end) { + if (advance) advance_past_empty_and_deleted(); + } + dense_hashtable_const_iterator() + : ht(NULL), pos(pointer()), end(pointer()) { } + // This lets us convert regular iterators to const iterators + dense_hashtable_const_iterator(const iterator &it) + : ht(it.ht), pos(it.pos), end(it.end) { } + // The default destructor is fine; we don't define one + // The default operator= is fine; we don't define one + + // Happy dereferencer + reference operator*() const { return *pos; } + pointer operator->() const { return &(operator*()); } + + // Arithmetic. The only hard part is making sure that + // we're not on an empty or marked-deleted array element + void advance_past_empty_and_deleted() { + while ( pos != end && (ht->test_empty(*this) || ht->test_deleted(*this)) ) + ++pos; + } + const_iterator& operator++() { + assert(pos != end); ++pos; advance_past_empty_and_deleted(); return *this; + } + const_iterator operator++(int) { const_iterator tmp(*this); ++*this; return tmp; } + + // Comparison. + bool operator==(const const_iterator& it) const { return pos == it.pos; } + bool operator!=(const const_iterator& it) const { return pos != it.pos; } + + + // The actual data + const dense_hashtable *ht; + pointer pos, end; +}; + +template +class dense_hashtable { + private: + typedef typename Alloc::template rebind::other value_alloc_type; + + public: + typedef Key key_type; + typedef Value value_type; + typedef HashFcn hasher; + typedef EqualKey key_equal; + typedef Alloc allocator_type; + + typedef typename value_alloc_type::size_type size_type; + typedef typename value_alloc_type::difference_type difference_type; + typedef typename value_alloc_type::reference reference; + typedef typename value_alloc_type::const_reference const_reference; + typedef typename value_alloc_type::pointer pointer; + typedef typename value_alloc_type::const_pointer const_pointer; + typedef dense_hashtable_iterator + iterator; + + typedef dense_hashtable_const_iterator + const_iterator; + + // These come from tr1. For us they're the same as regular iterators. + typedef iterator local_iterator; + typedef const_iterator const_local_iterator; + + // How full we let the table get before we resize, by default. + // Knuth says .8 is good -- higher causes us to probe too much, + // though it saves memory. + static const int HT_OCCUPANCY_PCT; // defined at the bottom of this file + + // How empty we let the table get before we resize lower, by default. + // (0.0 means never resize lower.) + // It should be less than OCCUPANCY_PCT / 2 or we thrash resizing + static const int HT_EMPTY_PCT; // defined at the bottom of this file + + // Minimum size we're willing to let hashtables be. + // Must be a power of two, and at least 4. + // Note, however, that for a given hashtable, the initial size is a + // function of the first constructor arg, and may be >HT_MIN_BUCKETS. + static const size_type HT_MIN_BUCKETS = 4; + + // By default, if you don't specify a hashtable size at + // construction-time, we use this size. Must be a power of two, and + // at least HT_MIN_BUCKETS. + static const size_type HT_DEFAULT_STARTING_BUCKETS = 32; + + // ITERATOR FUNCTIONS + iterator begin() { return iterator(this, table, + table + num_buckets, true); } + iterator end() { return iterator(this, table + num_buckets, + table + num_buckets, true); } + const_iterator begin() const { return const_iterator(this, table, + table+num_buckets,true);} + const_iterator end() const { return const_iterator(this, table + num_buckets, + table+num_buckets,true);} + + // These come from tr1 unordered_map. They iterate over 'bucket' n. + // We'll just consider bucket n to be the n-th element of the table. + local_iterator begin(size_type i) { + return local_iterator(this, table + i, table + i+1, false); + } + local_iterator end(size_type i) { + local_iterator it = begin(i); + if (!test_empty(i) && !test_deleted(i)) + ++it; + return it; + } + const_local_iterator begin(size_type i) const { + return const_local_iterator(this, table + i, table + i+1, false); + } + const_local_iterator end(size_type i) const { + const_local_iterator it = begin(i); + if (!test_empty(i) && !test_deleted(i)) + ++it; + return it; + } + + // ACCESSOR FUNCTIONS for the things we templatize on, basically + hasher hash_funct() const { return settings; } + key_equal key_eq() const { return key_info; } + allocator_type get_allocator() const { + return allocator_type(val_info); + } + + // Accessor function for statistics gathering. + int num_table_copies() const { return settings.num_ht_copies(); } + + private: + // Annoyingly, we can't copy values around, because they might have + // const components (they're probably pair). We use + // explicit destructor invocation and placement new to get around + // this. Arg. + void set_value(pointer dst, const_reference src) { + dst->~value_type(); // delete the old value, if any + new(dst) value_type(src); + } + + void destroy_buckets(size_type first, size_type last) { + for ( ; first != last; ++first) + table[first].~value_type(); + } + + // DELETE HELPER FUNCTIONS + // This lets the user describe a key that will indicate deleted + // table entries. This key should be an "impossible" entry -- + // if you try to insert it for real, you won't be able to retrieve it! + // (NB: while you pass in an entire value, only the key part is looked + // at. This is just because I don't know how to assign just a key.) + private: + void squash_deleted() { // gets rid of any deleted entries we have + if ( num_deleted ) { // get rid of deleted before writing + dense_hashtable tmp(*this); // copying will get rid of deleted + swap(tmp); // now we are tmp + } + assert(num_deleted == 0); + } + + // Test if the given key is the deleted indicator. Requires + // num_deleted > 0, for correctness of read(), and because that + // guarantees that key_info.delkey is valid. + bool test_deleted_key(const key_type& key) const { + assert(num_deleted > 0); + return equals(key_info.delkey, key); + } + + public: + void set_deleted_key(const key_type &key) { + // the empty indicator (if specified) and the deleted indicator + // must be different + assert((!settings.use_empty() || !equals(key, get_key(val_info.emptyval))) + && "Passed the empty-key to set_deleted_key"); + // It's only safe to change what "deleted" means if we purge deleted guys + squash_deleted(); + settings.set_use_deleted(true); + key_info.delkey = key; + } + void clear_deleted_key() { + squash_deleted(); + settings.set_use_deleted(false); + } + key_type deleted_key() const { + assert(settings.use_deleted() + && "Must set deleted key before calling deleted_key"); + return key_info.delkey; + } + + // These are public so the iterators can use them + // True if the item at position bucknum is "deleted" marker + bool test_deleted(size_type bucknum) const { + // Invariant: !use_deleted() implies num_deleted is 0. + assert(settings.use_deleted() || num_deleted == 0); + return num_deleted > 0 && test_deleted_key(get_key(table[bucknum])); + } + bool test_deleted(const iterator &it) const { + // Invariant: !use_deleted() implies num_deleted is 0. + assert(settings.use_deleted() || num_deleted == 0); + return num_deleted > 0 && test_deleted_key(get_key(*it)); + } + bool test_deleted(const const_iterator &it) const { + // Invariant: !use_deleted() implies num_deleted is 0. + assert(settings.use_deleted() || num_deleted == 0); + return num_deleted > 0 && test_deleted_key(get_key(*it)); + } + + private: + void check_use_deleted(const char* caller) { + (void)caller; // could log it if the assert failed + assert(settings.use_deleted()); + } + + // Set it so test_deleted is true. true if object didn't used to be deleted. + bool set_deleted(iterator &it) { + check_use_deleted("set_deleted()"); + bool retval = !test_deleted(it); + // &* converts from iterator to value-type. + set_key(&(*it), key_info.delkey); + return retval; + } + // Set it so test_deleted is false. true if object used to be deleted. + bool clear_deleted(iterator &it) { + check_use_deleted("clear_deleted()"); + // Happens automatically when we assign something else in its place. + return test_deleted(it); + } + + // We also allow to set/clear the deleted bit on a const iterator. + // We allow a const_iterator for the same reason you can delete a + // const pointer: it's convenient, and semantically you can't use + // 'it' after it's been deleted anyway, so its const-ness doesn't + // really matter. + bool set_deleted(const_iterator &it) { + check_use_deleted("set_deleted()"); + bool retval = !test_deleted(it); + set_key(const_cast(&(*it)), key_info.delkey); + return retval; + } + // Set it so test_deleted is false. true if object used to be deleted. + bool clear_deleted(const_iterator &it) { + check_use_deleted("clear_deleted()"); + return test_deleted(it); + } + + // EMPTY HELPER FUNCTIONS + // This lets the user describe a key that will indicate empty (unused) + // table entries. This key should be an "impossible" entry -- + // if you try to insert it for real, you won't be able to retrieve it! + // (NB: while you pass in an entire value, only the key part is looked + // at. This is just because I don't know how to assign just a key.) + public: + // These are public so the iterators can use them + // True if the item at position bucknum is "empty" marker + bool test_empty(size_type bucknum) const { + assert(settings.use_empty()); // we always need to know what's empty! + return equals(get_key(val_info.emptyval), get_key(table[bucknum])); + } + bool test_empty(const iterator &it) const { + assert(settings.use_empty()); // we always need to know what's empty! + return equals(get_key(val_info.emptyval), get_key(*it)); + } + bool test_empty(const const_iterator &it) const { + assert(settings.use_empty()); // we always need to know what's empty! + return equals(get_key(val_info.emptyval), get_key(*it)); + } + + private: + void fill_range_with_empty(pointer table_start, pointer table_end) { + std::uninitialized_fill(table_start, table_end, val_info.emptyval); + } + + public: + // TODO(csilvers): change all callers of this to pass in a key instead, + // and take a const key_type instead of const value_type. + void set_empty_key(const_reference val) { + // Once you set the empty key, you can't change it + assert(!settings.use_empty() && "Calling set_empty_key multiple times"); + // The deleted indicator (if specified) and the empty indicator + // must be different. + assert((!settings.use_deleted() || !equals(get_key(val), key_info.delkey)) + && "Setting the empty key the same as the deleted key"); + settings.set_use_empty(true); + set_value(&val_info.emptyval, val); + + assert(!table); // must set before first use + // num_buckets was set in constructor even though table was NULL + table = val_info.allocate(num_buckets); + assert(table); + fill_range_with_empty(table, table + num_buckets); + } + // TODO(user): return a key_type rather than a value_type + value_type empty_key() const { + assert(settings.use_empty()); + return val_info.emptyval; + } + + // FUNCTIONS CONCERNING SIZE + public: + size_type size() const { return num_elements - num_deleted; } + size_type max_size() const { return val_info.max_size(); } + bool empty() const { return size() == 0; } + size_type bucket_count() const { return num_buckets; } + size_type max_bucket_count() const { return max_size(); } + size_type nonempty_bucket_count() const { return num_elements; } + // These are tr1 methods. Their idea of 'bucket' doesn't map well to + // what we do. We just say every bucket has 0 or 1 items in it. + size_type bucket_size(size_type i) const { + return begin(i) == end(i) ? 0 : 1; + } + + private: + // Because of the above, size_type(-1) is never legal; use it for errors + static const size_type ILLEGAL_BUCKET = size_type(-1); + + // Used after a string of deletes. Returns true if we actually shrunk. + // TODO(csilvers): take a delta so we can take into account inserts + // done after shrinking. Maybe make part of the Settings class? + bool maybe_shrink() { + assert(num_elements >= num_deleted); + assert((bucket_count() & (bucket_count()-1)) == 0); // is a power of two + assert(bucket_count() >= HT_MIN_BUCKETS); + bool retval = false; + + // If you construct a hashtable with < HT_DEFAULT_STARTING_BUCKETS, + // we'll never shrink until you get relatively big, and we'll never + // shrink below HT_DEFAULT_STARTING_BUCKETS. Otherwise, something + // like "dense_hash_set x; x.insert(4); x.erase(4);" will + // shrink us down to HT_MIN_BUCKETS buckets, which is too small. + const size_type num_remain = num_elements - num_deleted; + const size_type shrink_threshold = settings.shrink_threshold(); + if (shrink_threshold > 0 && num_remain < shrink_threshold && + bucket_count() > HT_DEFAULT_STARTING_BUCKETS) { + const float shrink_factor = settings.shrink_factor(); + size_type sz = bucket_count() / 2; // find how much we should shrink + while (sz > HT_DEFAULT_STARTING_BUCKETS && + num_remain < sz * shrink_factor) { + sz /= 2; // stay a power of 2 + } + dense_hashtable tmp(*this, sz); // Do the actual resizing + swap(tmp); // now we are tmp + retval = true; + } + settings.set_consider_shrink(false); // because we just considered it + return retval; + } + + // We'll let you resize a hashtable -- though this makes us copy all! + // When you resize, you say, "make it big enough for this many more elements" + // Returns true if we actually resized, false if size was already ok. + bool resize_delta(size_type delta) { + bool did_resize = false; + if ( settings.consider_shrink() ) { // see if lots of deletes happened + if ( maybe_shrink() ) + did_resize = true; + } + if (num_elements >= + (std::numeric_limits::max)() - delta) { + throw std::length_error("resize overflow"); + } + if ( bucket_count() >= HT_MIN_BUCKETS && + (num_elements + delta) <= settings.enlarge_threshold() ) + return did_resize; // we're ok as we are + + // Sometimes, we need to resize just to get rid of all the + // "deleted" buckets that are clogging up the hashtable. So when + // deciding whether to resize, count the deleted buckets (which + // are currently taking up room). But later, when we decide what + // size to resize to, *don't* count deleted buckets, since they + // get discarded during the resize. + const size_type needed_size = settings.min_buckets(num_elements + delta, 0); + if ( needed_size <= bucket_count() ) // we have enough buckets + return did_resize; + + size_type resize_to = + settings.min_buckets(num_elements - num_deleted + delta, bucket_count()); + + if (resize_to < needed_size && // may double resize_to + resize_to < (std::numeric_limits::max)() / 2) { + // This situation means that we have enough deleted elements, + // that once we purge them, we won't actually have needed to + // grow. But we may want to grow anyway: if we just purge one + // element, say, we'll have to grow anyway next time we + // insert. Might as well grow now, since we're already going + // through the trouble of copying (in order to purge the + // deleted elements). + const size_type target = + static_cast(settings.shrink_size(resize_to*2)); + if (num_elements - num_deleted + delta >= target) { + // Good, we won't be below the shrink threshhold even if we double. + resize_to *= 2; + } + } + dense_hashtable tmp(*this, resize_to); + swap(tmp); // now we are tmp + return true; + } + + // We require table be not-NULL and empty before calling this. + void resize_table(size_type /*old_size*/, size_type new_size, + base::true_type) { + table = val_info.realloc_or_die(table, new_size); + } + + void resize_table(size_type old_size, size_type new_size, base::false_type) { + val_info.deallocate(table, old_size); + table = val_info.allocate(new_size); + } + + // Used to actually do the rehashing when we grow/shrink a hashtable + void copy_from(const dense_hashtable &ht, size_type min_buckets_wanted) { + clear_to_size(settings.min_buckets(ht.size(), min_buckets_wanted)); + + // We use a normal iterator to get non-deleted bcks from ht + // We could use insert() here, but since we know there are + // no duplicates and no deleted items, we can be more efficient + assert((bucket_count() & (bucket_count()-1)) == 0); // a power of two + for ( const_iterator it = ht.begin(); it != ht.end(); ++it ) { + size_type num_probes = 0; // how many times we've probed + size_type bucknum; + const size_type bucket_count_minus_one = bucket_count() - 1; + for (bucknum = hash(get_key(*it)) & bucket_count_minus_one; + !test_empty(bucknum); // not empty + bucknum = (bucknum + JUMP_(key, num_probes)) & bucket_count_minus_one) { + ++num_probes; + assert(num_probes < bucket_count() + && "Hashtable is full: an error in key_equal<> or hash<>"); + } + set_value(&table[bucknum], *it); // copies the value to here + num_elements++; + } + settings.inc_num_ht_copies(); + } + + // Required by the spec for hashed associative container + public: + // Though the docs say this should be num_buckets, I think it's much + // more useful as num_elements. As a special feature, calling with + // req_elements==0 will cause us to shrink if we can, saving space. + void resize(size_type req_elements) { // resize to this or larger + if ( settings.consider_shrink() || req_elements == 0 ) + maybe_shrink(); + if ( req_elements > num_elements ) + resize_delta(req_elements - num_elements); + } + + // Get and change the value of shrink_factor and enlarge_factor. The + // description at the beginning of this file explains how to choose + // the values. Setting the shrink parameter to 0.0 ensures that the + // table never shrinks. + void get_resizing_parameters(float* shrink, float* grow) const { + *shrink = settings.shrink_factor(); + *grow = settings.enlarge_factor(); + } + void set_resizing_parameters(float shrink, float grow) { + settings.set_resizing_parameters(shrink, grow); + settings.reset_thresholds(bucket_count()); + } + + // CONSTRUCTORS -- as required by the specs, we take a size, + // but also let you specify a hashfunction, key comparator, + // and key extractor. We also define a copy constructor and =. + // DESTRUCTOR -- needs to free the table + explicit dense_hashtable(size_type expected_max_items_in_table = 0, + const HashFcn& hf = HashFcn(), + const EqualKey& eql = EqualKey(), + const ExtractKey& ext = ExtractKey(), + const SetKey& set = SetKey(), + const Alloc& alloc = Alloc()) + : settings(hf), + key_info(ext, set, eql), + num_deleted(0), + num_elements(0), + num_buckets(expected_max_items_in_table == 0 + ? HT_DEFAULT_STARTING_BUCKETS + : settings.min_buckets(expected_max_items_in_table, 0)), + val_info(alloc_impl(alloc)), + table(NULL) { + // table is NULL until emptyval is set. However, we set num_buckets + // here so we know how much space to allocate once emptyval is set + settings.reset_thresholds(bucket_count()); + } + + // As a convenience for resize(), we allow an optional second argument + // which lets you make this new hashtable a different size than ht + dense_hashtable(const dense_hashtable& ht, + size_type min_buckets_wanted = HT_DEFAULT_STARTING_BUCKETS) + : settings(ht.settings), + key_info(ht.key_info), + num_deleted(0), + num_elements(0), + num_buckets(0), + val_info(ht.val_info), + table(NULL) { + if (!ht.settings.use_empty()) { + // If use_empty isn't set, copy_from will crash, so we do our own copying. + assert(ht.empty()); + num_buckets = settings.min_buckets(ht.size(), min_buckets_wanted); + settings.reset_thresholds(bucket_count()); + return; + } + settings.reset_thresholds(bucket_count()); + copy_from(ht, min_buckets_wanted); // copy_from() ignores deleted entries + } + + dense_hashtable& operator= (const dense_hashtable& ht) { + if (&ht == this) return *this; // don't copy onto ourselves + if (!ht.settings.use_empty()) { + assert(ht.empty()); + dense_hashtable empty_table(ht); // empty table with ht's thresholds + this->swap(empty_table); + return *this; + } + settings = ht.settings; + key_info = ht.key_info; + set_value(&val_info.emptyval, ht.val_info.emptyval); + // copy_from() calls clear and sets num_deleted to 0 too + copy_from(ht, HT_MIN_BUCKETS); + // we purposefully don't copy the allocator, which may not be copyable + return *this; + } + + ~dense_hashtable() { + if (table) { + destroy_buckets(0, num_buckets); + val_info.deallocate(table, num_buckets); + } + } + + // Many STL algorithms use swap instead of copy constructors + void swap(dense_hashtable& ht) { + std::swap(settings, ht.settings); + std::swap(key_info, ht.key_info); + std::swap(num_deleted, ht.num_deleted); + std::swap(num_elements, ht.num_elements); + std::swap(num_buckets, ht.num_buckets); + { value_type tmp; // for annoying reasons, swap() doesn't work + set_value(&tmp, val_info.emptyval); + set_value(&val_info.emptyval, ht.val_info.emptyval); + set_value(&ht.val_info.emptyval, tmp); + } + std::swap(table, ht.table); + settings.reset_thresholds(bucket_count()); // also resets consider_shrink + ht.settings.reset_thresholds(ht.bucket_count()); + // we purposefully don't swap the allocator, which may not be swap-able + } + + private: + void clear_to_size(size_type new_num_buckets) { + if (!table) { + table = val_info.allocate(new_num_buckets); + } else { + destroy_buckets(0, num_buckets); + if (new_num_buckets != num_buckets) { // resize, if necessary + typedef base::integral_constant >::value> + realloc_ok; + resize_table(num_buckets, new_num_buckets, realloc_ok()); + } + } + assert(table); + fill_range_with_empty(table, table + new_num_buckets); + num_elements = 0; + num_deleted = 0; + num_buckets = new_num_buckets; // our new size + settings.reset_thresholds(bucket_count()); + } + + public: + // It's always nice to be able to clear a table without deallocating it + void clear() { + // If the table is already empty, and the number of buckets is + // already as we desire, there's nothing to do. + const size_type new_num_buckets = settings.min_buckets(0, 0); + if (num_elements == 0 && new_num_buckets == num_buckets) { + return; + } + clear_to_size(new_num_buckets); + } + + // Clear the table without resizing it. + // Mimicks the stl_hashtable's behaviour when clear()-ing in that it + // does not modify the bucket count + void clear_no_resize() { + if (num_elements > 0) { + assert(table); + destroy_buckets(0, num_buckets); + fill_range_with_empty(table, table + num_buckets); + } + // don't consider to shrink before another erase() + settings.reset_thresholds(bucket_count()); + num_elements = 0; + num_deleted = 0; + } + + // LOOKUP ROUTINES + private: + // Returns a pair of positions: 1st where the object is, 2nd where + // it would go if you wanted to insert it. 1st is ILLEGAL_BUCKET + // if object is not found; 2nd is ILLEGAL_BUCKET if it is. + // Note: because of deletions where-to-insert is not trivial: it's the + // first deleted bucket we see, as long as we don't find the key later + std::pair find_position(const key_type &key) const { + size_type num_probes = 0; // how many times we've probed + const size_type bucket_count_minus_one = bucket_count() - 1; + size_type bucknum = hash(key) & bucket_count_minus_one; + size_type insert_pos = ILLEGAL_BUCKET; // where we would insert + while ( 1 ) { // probe until something happens + if ( test_empty(bucknum) ) { // bucket is empty + if ( insert_pos == ILLEGAL_BUCKET ) // found no prior place to insert + return std::pair(ILLEGAL_BUCKET, bucknum); + else + return std::pair(ILLEGAL_BUCKET, insert_pos); + + } else if ( test_deleted(bucknum) ) {// keep searching, but mark to insert + if ( insert_pos == ILLEGAL_BUCKET ) + insert_pos = bucknum; + + } else if ( equals(key, get_key(table[bucknum])) ) { + return std::pair(bucknum, ILLEGAL_BUCKET); + } + ++num_probes; // we're doing another probe + bucknum = (bucknum + JUMP_(key, num_probes)) & bucket_count_minus_one; + assert(num_probes < bucket_count() + && "Hashtable is full: an error in key_equal<> or hash<>"); + } + } + + public: + + iterator find(const key_type& key) { + if ( size() == 0 ) return end(); + std::pair pos = find_position(key); + if ( pos.first == ILLEGAL_BUCKET ) // alas, not there + return end(); + else + return iterator(this, table + pos.first, table + num_buckets, false); + } + + const_iterator find(const key_type& key) const { + if ( size() == 0 ) return end(); + std::pair pos = find_position(key); + if ( pos.first == ILLEGAL_BUCKET ) // alas, not there + return end(); + else + return const_iterator(this, table + pos.first, table+num_buckets, false); + } + + // This is a tr1 method: the bucket a given key is in, or what bucket + // it would be put in, if it were to be inserted. Shrug. + size_type bucket(const key_type& key) const { + std::pair pos = find_position(key); + return pos.first == ILLEGAL_BUCKET ? pos.second : pos.first; + } + + // Counts how many elements have key key. For maps, it's either 0 or 1. + size_type count(const key_type &key) const { + std::pair pos = find_position(key); + return pos.first == ILLEGAL_BUCKET ? 0 : 1; + } + + // Likewise, equal_range doesn't really make sense for us. Oh well. + std::pair equal_range(const key_type& key) { + iterator pos = find(key); // either an iterator or end + if (pos == end()) { + return std::pair(pos, pos); + } else { + const iterator startpos = pos++; + return std::pair(startpos, pos); + } + } + std::pair equal_range(const key_type& key) + const { + const_iterator pos = find(key); // either an iterator or end + if (pos == end()) { + return std::pair(pos, pos); + } else { + const const_iterator startpos = pos++; + return std::pair(startpos, pos); + } + } + + + // INSERTION ROUTINES + private: + // Private method used by insert_noresize and find_or_insert. + iterator insert_at(const_reference obj, size_type pos) { + if (size() >= max_size()) { + throw std::length_error("insert overflow"); + } + if ( test_deleted(pos) ) { // just replace if it's been del. + // shrug: shouldn't need to be const. + const_iterator delpos(this, table + pos, table + num_buckets, false); + clear_deleted(delpos); + assert( num_deleted > 0); + --num_deleted; // used to be, now it isn't + } else { + ++num_elements; // replacing an empty bucket + } + set_value(&table[pos], obj); + return iterator(this, table + pos, table + num_buckets, false); + } + + // If you know *this is big enough to hold obj, use this routine + std::pair insert_noresize(const_reference obj) { + // First, double-check we're not inserting delkey or emptyval + assert((!settings.use_empty() || !equals(get_key(obj), + get_key(val_info.emptyval))) + && "Inserting the empty key"); + assert((!settings.use_deleted() || !equals(get_key(obj), key_info.delkey)) + && "Inserting the deleted key"); + const std::pair pos = find_position(get_key(obj)); + if ( pos.first != ILLEGAL_BUCKET) { // object was already there + return std::pair(iterator(this, table + pos.first, + table + num_buckets, false), + false); // false: we didn't insert + } else { // pos.second says where to put it + return std::pair(insert_at(obj, pos.second), true); + } + } + + // Specializations of insert(it, it) depending on the power of the iterator: + // (1) Iterator supports operator-, resize before inserting + template + void insert(ForwardIterator f, ForwardIterator l, std::forward_iterator_tag) { + size_t dist = std::distance(f, l); + if (dist >= (std::numeric_limits::max)()) { + throw std::length_error("insert-range overflow"); + } + resize_delta(static_cast(dist)); + for ( ; dist > 0; --dist, ++f) { + insert_noresize(*f); + } + } + + // (2) Arbitrary iterator, can't tell how much to resize + template + void insert(InputIterator f, InputIterator l, std::input_iterator_tag) { + for ( ; f != l; ++f) + insert(*f); + } + + public: + // This is the normal insert routine, used by the outside world + std::pair insert(const_reference obj) { + resize_delta(1); // adding an object, grow if need be + return insert_noresize(obj); + } + + // When inserting a lot at a time, we specialize on the type of iterator + template + void insert(InputIterator f, InputIterator l) { + // specializes on iterator type + insert(f, l, + typename std::iterator_traits::iterator_category()); + } + + // DefaultValue is a functor that takes a key and returns a value_type + // representing the default value to be inserted if none is found. + template + value_type& find_or_insert(const key_type& key) { + // First, double-check we're not inserting emptykey or delkey + assert((!settings.use_empty() || !equals(key, get_key(val_info.emptyval))) + && "Inserting the empty key"); + assert((!settings.use_deleted() || !equals(key, key_info.delkey)) + && "Inserting the deleted key"); + const std::pair pos = find_position(key); + DefaultValue default_value; + if ( pos.first != ILLEGAL_BUCKET) { // object was already there + return table[pos.first]; + } else if (resize_delta(1)) { // needed to rehash to make room + // Since we resized, we can't use pos, so recalculate where to insert. + return *insert_noresize(default_value(key)).first; + } else { // no need to rehash, insert right here + return *insert_at(default_value(key), pos.second); + } + } + + + // DELETION ROUTINES + size_type erase(const key_type& key) { + // First, double-check we're not trying to erase delkey or emptyval. + assert((!settings.use_empty() || !equals(key, get_key(val_info.emptyval))) + && "Erasing the empty key"); + assert((!settings.use_deleted() || !equals(key, key_info.delkey)) + && "Erasing the deleted key"); + const_iterator pos = find(key); // shrug: shouldn't need to be const + if ( pos != end() ) { + assert(!test_deleted(pos)); // or find() shouldn't have returned it + set_deleted(pos); + ++num_deleted; + settings.set_consider_shrink(true); // will think about shrink after next insert + return 1; // because we deleted one thing + } else { + return 0; // because we deleted nothing + } + } + + // We return the iterator past the deleted item. + void erase(iterator pos) { + if ( pos == end() ) return; // sanity check + if ( set_deleted(pos) ) { // true if object has been newly deleted + ++num_deleted; + settings.set_consider_shrink(true); // will think about shrink after next insert + } + } + + void erase(iterator f, iterator l) { + for ( ; f != l; ++f) { + if ( set_deleted(f) ) // should always be true + ++num_deleted; + } + settings.set_consider_shrink(true); // will think about shrink after next insert + } + + // We allow you to erase a const_iterator just like we allow you to + // erase an iterator. This is in parallel to 'delete': you can delete + // a const pointer just like a non-const pointer. The logic is that + // you can't use the object after it's erased anyway, so it doesn't matter + // if it's const or not. + void erase(const_iterator pos) { + if ( pos == end() ) return; // sanity check + if ( set_deleted(pos) ) { // true if object has been newly deleted + ++num_deleted; + settings.set_consider_shrink(true); // will think about shrink after next insert + } + } + void erase(const_iterator f, const_iterator l) { + for ( ; f != l; ++f) { + if ( set_deleted(f) ) // should always be true + ++num_deleted; + } + settings.set_consider_shrink(true); // will think about shrink after next insert + } + + + // COMPARISON + bool operator==(const dense_hashtable& ht) const { + if (size() != ht.size()) { + return false; + } else if (this == &ht) { + return true; + } else { + // Iterate through the elements in "this" and see if the + // corresponding element is in ht + for ( const_iterator it = begin(); it != end(); ++it ) { + const_iterator it2 = ht.find(get_key(*it)); + if ((it2 == ht.end()) || (*it != *it2)) { + return false; + } + } + return true; + } + } + bool operator!=(const dense_hashtable& ht) const { + return !(*this == ht); + } + + + // I/O + // We support reading and writing hashtables to disk. Alas, since + // I don't know how to write a hasher or key_equal, you have to make + // sure everything but the table is the same. We compact before writing. + private: + // Every time the disk format changes, this should probably change too + typedef unsigned long MagicNumberType; + static const MagicNumberType MAGIC_NUMBER = 0x13578642; + + public: + // I/O -- this is an add-on for writing hash table to disk + // + // INPUT and OUTPUT must be either a FILE, *or* a C++ stream + // (istream, ostream, etc) *or* a class providing + // Read(void*, size_t) and Write(const void*, size_t) + // (respectively), which writes a buffer into a stream + // (which the INPUT/OUTPUT instance presumably owns). + + typedef sparsehash_internal::pod_serializer NopointerSerializer; + + // ValueSerializer: a functor. operator()(OUTPUT*, const value_type&) + template + bool serialize(ValueSerializer serializer, OUTPUT *fp) { + squash_deleted(); // so we don't have to worry about delkey + if ( !sparsehash_internal::write_bigendian_number(fp, MAGIC_NUMBER, 4) ) + return false; + if ( !sparsehash_internal::write_bigendian_number(fp, num_buckets, 8) ) + return false; + if ( !sparsehash_internal::write_bigendian_number(fp, num_elements, 8) ) + return false; + // Now write a bitmap of non-empty buckets. + for ( size_type i = 0; i < num_buckets; i += 8 ) { + unsigned char bits = 0; + for ( int bit = 0; bit < 8; ++bit ) { + if ( i + bit < num_buckets && !test_empty(i + bit) ) + bits |= (1 << bit); + } + if ( !sparsehash_internal::write_data(fp, &bits, sizeof(bits)) ) + return false; + for ( int bit = 0; bit < 8; ++bit ) { + if ( bits & (1 << bit) ) { + if ( !serializer(fp, table[i + bit]) ) return false; + } + } + } + return true; + } + + // INPUT: anything we've written an overload of read_data() for. + // ValueSerializer: a functor. operator()(INPUT*, value_type*) + template + bool unserialize(ValueSerializer serializer, INPUT *fp) { + assert(settings.use_empty() && "empty_key not set for read"); + + clear(); // just to be consistent + MagicNumberType magic_read; + if ( !sparsehash_internal::read_bigendian_number(fp, &magic_read, 4) ) + return false; + if ( magic_read != MAGIC_NUMBER ) { + return false; + } + size_type new_num_buckets; + if ( !sparsehash_internal::read_bigendian_number(fp, &new_num_buckets, 8) ) + return false; + clear_to_size(new_num_buckets); + if ( !sparsehash_internal::read_bigendian_number(fp, &num_elements, 8) ) + return false; + + // Read the bitmap of non-empty buckets. + for (size_type i = 0; i < num_buckets; i += 8) { + unsigned char bits; + if ( !sparsehash_internal::read_data(fp, &bits, sizeof(bits)) ) + return false; + for ( int bit = 0; bit < 8; ++bit ) { + if ( i + bit < num_buckets && (bits & (1 << bit)) ) { // not empty + if ( !serializer(fp, &table[i + bit]) ) return false; + } + } + } + return true; + } + + private: + template + class alloc_impl : public A { + public: + typedef typename A::pointer pointer; + typedef typename A::size_type size_type; + + // Convert a normal allocator to one that has realloc_or_die() + alloc_impl(const A& a) : A(a) { } + + // realloc_or_die should only be used when using the default + // allocator (libc_allocator_with_realloc). + pointer realloc_or_die(pointer /*ptr*/, size_type /*n*/) { + fprintf(stderr, "realloc_or_die is only supported for " + "libc_allocator_with_realloc\n"); + exit(1); + return NULL; + } + }; + + // A template specialization of alloc_impl for + // libc_allocator_with_realloc that can handle realloc_or_die. + template + class alloc_impl > + : public libc_allocator_with_realloc { + public: + typedef typename libc_allocator_with_realloc::pointer pointer; + typedef typename libc_allocator_with_realloc::size_type size_type; + + alloc_impl(const libc_allocator_with_realloc& a) + : libc_allocator_with_realloc(a) { } + + pointer realloc_or_die(pointer ptr, size_type n) { + pointer retval = this->reallocate(ptr, n); + if (retval == NULL) { + fprintf(stderr, "sparsehash: FATAL ERROR: failed to reallocate " + "%lu elements for ptr %p", static_cast(n), ptr); + exit(1); + } + return retval; + } + }; + + // Package allocator with emptyval to eliminate memory needed for + // the zero-size allocator. + // If new fields are added to this class, we should add them to + // operator= and swap. + class ValInfo : public alloc_impl { + public: + typedef typename alloc_impl::value_type value_type; + + ValInfo(const alloc_impl& a) + : alloc_impl(a), emptyval() { } + ValInfo(const ValInfo& v) + : alloc_impl(v), emptyval(v.emptyval) { } + + value_type emptyval; // which key marks unused entries + }; + + + // Package functors with another class to eliminate memory needed for + // zero-size functors. Since ExtractKey and hasher's operator() might + // have the same function signature, they must be packaged in + // different classes. + struct Settings : + sparsehash_internal::sh_hashtable_settings { + explicit Settings(const hasher& hf) + : sparsehash_internal::sh_hashtable_settings( + hf, HT_OCCUPANCY_PCT / 100.0f, HT_EMPTY_PCT / 100.0f) {} + }; + + // Packages ExtractKey and SetKey functors. + class KeyInfo : public ExtractKey, public SetKey, public EqualKey { + public: + KeyInfo(const ExtractKey& ek, const SetKey& sk, const EqualKey& eq) + : ExtractKey(ek), + SetKey(sk), + EqualKey(eq) { + } + + // We want to return the exact same type as ExtractKey: Key or const Key& + typename ExtractKey::result_type get_key(const_reference v) const { + return ExtractKey::operator()(v); + } + void set_key(pointer v, const key_type& k) const { + SetKey::operator()(v, k); + } + bool equals(const key_type& a, const key_type& b) const { + return EqualKey::operator()(a, b); + } + + // Which key marks deleted entries. + // TODO(csilvers): make a pointer, and get rid of use_deleted (benchmark!) + typename base::remove_const::type delkey; + }; + + // Utility functions to access the templated operators + size_type hash(const key_type& v) const { + return settings.hash(v); + } + bool equals(const key_type& a, const key_type& b) const { + return key_info.equals(a, b); + } + typename ExtractKey::result_type get_key(const_reference v) const { + return key_info.get_key(v); + } + void set_key(pointer v, const key_type& k) const { + key_info.set_key(v, k); + } + + private: + // Actual data + Settings settings; + KeyInfo key_info; + + size_type num_deleted; // how many occupied buckets are marked deleted + size_type num_elements; + size_type num_buckets; + ValInfo val_info; // holds emptyval, and also the allocator + pointer table; +}; + + +// We need a global swap as well +template +inline void swap(dense_hashtable &x, + dense_hashtable &y) { + x.swap(y); +} + +#undef JUMP_ + +template +const typename dense_hashtable::size_type + dense_hashtable::ILLEGAL_BUCKET; + +// How full we let the table get before we resize. Knuth says .8 is +// good -- higher causes us to probe too much, though saves memory. +// However, we go with .5, getting better performance at the cost of +// more space (a trade-off densehashtable explicitly chooses to make). +// Feel free to play around with different values, though, via +// max_load_factor() and/or set_resizing_parameters(). +template +const int dense_hashtable::HT_OCCUPANCY_PCT = 50; + +// How empty we let the table get before we resize lower. +// It should be less than OCCUPANCY_PCT / 2 or we thrash resizing. +template +const int dense_hashtable::HT_EMPTY_PCT + = static_cast(0.4 * + dense_hashtable::HT_OCCUPANCY_PCT); + +_END_GOOGLE_NAMESPACE_ + +#endif /* _DENSEHASHTABLE_H_ */ diff -Nru mapnik-2.1.0/deps/mapnik/sparsehash/internal/hashtable-common.h mapnik-2.2.0/deps/mapnik/sparsehash/internal/hashtable-common.h --- mapnik-2.1.0/deps/mapnik/sparsehash/internal/hashtable-common.h 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/deps/mapnik/sparsehash/internal/hashtable-common.h 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,381 @@ +// Copyright (c) 2010, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// +// Provides classes shared by both sparse and dense hashtable. +// +// sh_hashtable_settings has parameters for growing and shrinking +// a hashtable. It also packages zero-size functor (ie. hasher). +// +// Other functions and classes provide common code for serializing +// and deserializing hashtables to a stream (such as a FILE*). + +#ifndef UTIL_GTL_HASHTABLE_COMMON_H_ +#define UTIL_GTL_HASHTABLE_COMMON_H_ + +#include +#include +#include +#include // for size_t +#include +#include // For length_error + +_START_GOOGLE_NAMESPACE_ + +template struct SparsehashCompileAssert { }; +#define SPARSEHASH_COMPILE_ASSERT(expr, msg) \ + typedef SparsehashCompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] + +namespace sparsehash_internal { + +// Adaptor methods for reading/writing data from an INPUT or OUPTUT +// variable passed to serialize() or unserialize(). For now we +// have implemented INPUT/OUTPUT for FILE*, istream*/ostream* (note +// they are pointers, unlike typical use), or else a pointer to +// something that supports a Read()/Write() method. +// +// For technical reasons, we implement read_data/write_data in two +// stages. The actual work is done in *_data_internal, which takes +// the stream argument twice: once as a template type, and once with +// normal type information. (We only use the second version.) We do +// this because of how C++ picks what function overload to use. If we +// implemented this the naive way: +// bool read_data(istream* is, const void* data, size_t length); +// template read_data(T* fp, const void* data, size_t length); +// C++ would prefer the second version for every stream type except +// istream. However, we want C++ to prefer the first version for +// streams that are *subclasses* of istream, such as istringstream. +// This is not possible given the way template types are resolved. So +// we split the stream argument in two, one of which is templated and +// one of which is not. The specialized functions (like the istream +// version above) ignore the template arg and use the second, 'type' +// arg, getting subclass matching as normal. The 'catch-all' +// functions (the second version above) use the template arg to deduce +// the type, and use a second, void* arg to achieve the desired +// 'catch-all' semantics. + +// ----- low-level I/O for FILE* ---- + +template +inline bool read_data_internal(Ignored*, FILE* fp, + void* data, size_t length) { + return fread(data, length, 1, fp) == 1; +} + +template +inline bool write_data_internal(Ignored*, FILE* fp, + const void* data, size_t length) { + return fwrite(data, length, 1, fp) == 1; +} + +// ----- low-level I/O for iostream ---- + +// We want the caller to be responsible for #including , not +// us, because iostream is a big header! According to the standard, +// it's only legal to delay the instantiation the way we want to if +// the istream/ostream is a template type. So we jump through hoops. +template +inline bool read_data_internal_for_istream(ISTREAM* fp, + void* data, size_t length) { + return fp->read(reinterpret_cast(data), length).good(); +} +template +inline bool read_data_internal(Ignored*, std::istream* fp, + void* data, size_t length) { + return read_data_internal_for_istream(fp, data, length); +} + +template +inline bool write_data_internal_for_ostream(OSTREAM* fp, + const void* data, size_t length) { + return fp->write(reinterpret_cast(data), length).good(); +} +template +inline bool write_data_internal(Ignored*, std::ostream* fp, + const void* data, size_t length) { + return write_data_internal_for_ostream(fp, data, length); +} + +// ----- low-level I/O for custom streams ---- + +// The INPUT type needs to support a Read() method that takes a +// buffer and a length and returns the number of bytes read. +template +inline bool read_data_internal(INPUT* fp, void*, + void* data, size_t length) { + return static_cast(fp->Read(data, length)) == length; +} + +// The OUTPUT type needs to support a Write() operation that takes +// a buffer and a length and returns the number of bytes written. +template +inline bool write_data_internal(OUTPUT* fp, void*, + const void* data, size_t length) { + return static_cast(fp->Write(data, length)) == length; +} + +// ----- low-level I/O: the public API ---- + +template +inline bool read_data(INPUT* fp, void* data, size_t length) { + return read_data_internal(fp, fp, data, length); +} + +template +inline bool write_data(OUTPUT* fp, const void* data, size_t length) { + return write_data_internal(fp, fp, data, length); +} + +// Uses read_data() and write_data() to read/write an integer. +// length is the number of bytes to read/write (which may differ +// from sizeof(IntType), allowing us to save on a 32-bit system +// and load on a 64-bit system). Excess bytes are taken to be 0. +// INPUT and OUTPUT must match legal inputs to read/write_data (above). +template +bool read_bigendian_number(INPUT* fp, IntType* value, size_t length) { + *value = 0; + unsigned char byte; + // We require IntType to be unsigned or else the shifting gets all screwy. + SPARSEHASH_COMPILE_ASSERT(static_cast(-1) > static_cast(0), + serializing_int_requires_an_unsigned_type); + for (size_t i = 0; i < length; ++i) { + if (!read_data(fp, &byte, sizeof(byte))) return false; + *value |= static_cast(byte) << ((length - 1 - i) * 8); + } + return true; +} + +template +bool write_bigendian_number(OUTPUT* fp, IntType value, size_t length) { + unsigned char byte; + // We require IntType to be unsigned or else the shifting gets all screwy. + SPARSEHASH_COMPILE_ASSERT(static_cast(-1) > static_cast(0), + serializing_int_requires_an_unsigned_type); + for (size_t i = 0; i < length; ++i) { + byte = (sizeof(value) <= length-1 - i) + ? 0 : static_cast((value >> ((length-1 - i) * 8)) & 255); + if (!write_data(fp, &byte, sizeof(byte))) return false; + } + return true; +} + +// If your keys and values are simple enough, you can pass this +// serializer to serialize()/unserialize(). "Simple enough" means +// value_type is a POD type that contains no pointers. Note, +// however, we don't try to normalize endianness. +// This is the type used for NopointerSerializer. +template struct pod_serializer { + template + bool operator()(INPUT* fp, value_type* value) const { + return read_data(fp, value, sizeof(*value)); + } + + template + bool operator()(OUTPUT* fp, const value_type& value) const { + return write_data(fp, &value, sizeof(value)); + } +}; + + +// Settings contains parameters for growing and shrinking the table. +// It also packages zero-size functor (ie. hasher). +// +// It does some munging of the hash value in cases where we think +// (fear) the original hash function might not be very good. In +// particular, the default hash of pointers is the identity hash, +// so probably all the low bits are 0. We identify when we think +// we're hashing a pointer, and chop off the low bits. Note this +// isn't perfect: even when the key is a pointer, we can't tell +// for sure that the hash is the identity hash. If it's not, this +// is needless work (and possibly, though not likely, harmful). + +template +class sh_hashtable_settings : public HashFunc { + public: + typedef Key key_type; + typedef HashFunc hasher; + typedef SizeType size_type; + + public: + sh_hashtable_settings(const hasher& hf, + const float ht_occupancy_flt, + const float ht_empty_flt) + : hasher(hf), + enlarge_threshold_(0), + shrink_threshold_(0), + consider_shrink_(false), + use_empty_(false), + use_deleted_(false), + num_ht_copies_(0) { + set_enlarge_factor(ht_occupancy_flt); + set_shrink_factor(ht_empty_flt); + } + + size_type hash(const key_type& v) const { + // We munge the hash value when we don't trust hasher::operator(). + return hash_munger::MungedHash(hasher::operator()(v)); + } + + float enlarge_factor() const { + return enlarge_factor_; + } + void set_enlarge_factor(float f) { + enlarge_factor_ = f; + } + float shrink_factor() const { + return shrink_factor_; + } + void set_shrink_factor(float f) { + shrink_factor_ = f; + } + + size_type enlarge_threshold() const { + return enlarge_threshold_; + } + void set_enlarge_threshold(size_type t) { + enlarge_threshold_ = t; + } + size_type shrink_threshold() const { + return shrink_threshold_; + } + void set_shrink_threshold(size_type t) { + shrink_threshold_ = t; + } + + size_type enlarge_size(size_type x) const { + return static_cast(x * enlarge_factor_); + } + size_type shrink_size(size_type x) const { + return static_cast(x * shrink_factor_); + } + + bool consider_shrink() const { + return consider_shrink_; + } + void set_consider_shrink(bool t) { + consider_shrink_ = t; + } + + bool use_empty() const { + return use_empty_; + } + void set_use_empty(bool t) { + use_empty_ = t; + } + + bool use_deleted() const { + return use_deleted_; + } + void set_use_deleted(bool t) { + use_deleted_ = t; + } + + size_type num_ht_copies() const { + return static_cast(num_ht_copies_); + } + void inc_num_ht_copies() { + ++num_ht_copies_; + } + + // Reset the enlarge and shrink thresholds + void reset_thresholds(size_type num_buckets) { + set_enlarge_threshold(enlarge_size(num_buckets)); + set_shrink_threshold(shrink_size(num_buckets)); + // whatever caused us to reset already considered + set_consider_shrink(false); + } + + // Caller is resposible for calling reset_threshold right after + // set_resizing_parameters. + void set_resizing_parameters(float shrink, float grow) { + assert(shrink >= 0.0); + assert(grow <= 1.0); + if (shrink > grow/2.0f) + shrink = grow / 2.0f; // otherwise we thrash hashtable size + set_shrink_factor(shrink); + set_enlarge_factor(grow); + } + + // This is the smallest size a hashtable can be without being too crowded + // If you like, you can give a min #buckets as well as a min #elts + size_type min_buckets(size_type num_elts, size_type min_buckets_wanted) { + float enlarge = enlarge_factor(); + size_type sz = HT_MIN_BUCKETS; // min buckets allowed + while ( sz < min_buckets_wanted || + num_elts >= static_cast(sz * enlarge) ) { + // This just prevents overflowing size_type, since sz can exceed + // max_size() here. + if (static_cast(sz * 2) < sz) { + throw std::length_error("resize overflow"); // protect against overflow + } + sz *= 2; + } + return sz; + } + + private: + template class hash_munger { + public: + static size_t MungedHash(size_t hash) { + return hash; + } + }; + // This matches when the hashtable key is a pointer. + template class hash_munger { + public: + static size_t MungedHash(size_t hash) { + // TODO(csilvers): consider rotating instead: + // static const int shift = (sizeof(void *) == 4) ? 2 : 3; + // return (hash << (sizeof(hash) * 8) - shift)) | (hash >> shift); + // This matters if we ever change sparse/dense_hash_* to compare + // hashes before comparing actual values. It's speedy on x86. + return hash / sizeof(void*); // get rid of known-0 bits + } + }; + + size_type enlarge_threshold_; // table.size() * enlarge_factor + size_type shrink_threshold_; // table.size() * shrink_factor + float enlarge_factor_; // how full before resize + float shrink_factor_; // how empty before resize + // consider_shrink=true if we should try to shrink before next insert + bool consider_shrink_; + bool use_empty_; // used only by densehashtable, not sparsehashtable + bool use_deleted_; // false until delkey has been set + // num_ht_copies is a counter incremented every Copy/Move + unsigned int num_ht_copies_; +}; + +} // namespace sparsehash_internal + +#undef SPARSEHASH_COMPILE_ASSERT +_END_GOOGLE_NAMESPACE_ + +#endif // UTIL_GTL_HASHTABLE_COMMON_H_ diff -Nru mapnik-2.1.0/deps/mapnik/sparsehash/internal/libc_allocator_with_realloc.h mapnik-2.2.0/deps/mapnik/sparsehash/internal/libc_allocator_with_realloc.h --- mapnik-2.1.0/deps/mapnik/sparsehash/internal/libc_allocator_with_realloc.h 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/deps/mapnik/sparsehash/internal/libc_allocator_with_realloc.h 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,119 @@ +// Copyright (c) 2010, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- + +#ifndef UTIL_GTL_LIBC_ALLOCATOR_WITH_REALLOC_H_ +#define UTIL_GTL_LIBC_ALLOCATOR_WITH_REALLOC_H_ + +#include +#include // for malloc/realloc/free +#include // for ptrdiff_t +#include // for placement new + +_START_GOOGLE_NAMESPACE_ + +template +class libc_allocator_with_realloc { + public: + typedef T value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + typedef T* pointer; + typedef const T* const_pointer; + typedef T& reference; + typedef const T& const_reference; + + libc_allocator_with_realloc() {} + libc_allocator_with_realloc(const libc_allocator_with_realloc&) {} + ~libc_allocator_with_realloc() {} + + pointer address(reference r) const { return &r; } + const_pointer address(const_reference r) const { return &r; } + + pointer allocate(size_type n, const_pointer = 0) { + return static_cast(malloc(n * sizeof(value_type))); + } + void deallocate(pointer p, size_type) { + free(p); + } + pointer reallocate(pointer p, size_type n) { + return static_cast(realloc(p, n * sizeof(value_type))); + } + + size_type max_size() const { + return static_cast(-1) / sizeof(value_type); + } + + void construct(pointer p, const value_type& val) { + new(p) value_type(val); + } + void destroy(pointer p) { p->~value_type(); } + + template + libc_allocator_with_realloc(const libc_allocator_with_realloc&) {} + + template + struct rebind { + typedef libc_allocator_with_realloc other; + }; +}; + +// libc_allocator_with_realloc specialization. +template<> +class libc_allocator_with_realloc { + public: + typedef void value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef void* pointer; + typedef const void* const_pointer; + + template + struct rebind { + typedef libc_allocator_with_realloc other; + }; +}; + +template +inline bool operator==(const libc_allocator_with_realloc&, + const libc_allocator_with_realloc&) { + return true; +} + +template +inline bool operator!=(const libc_allocator_with_realloc&, + const libc_allocator_with_realloc&) { + return false; +} + +_END_GOOGLE_NAMESPACE_ + +#endif // UTIL_GTL_LIBC_ALLOCATOR_WITH_REALLOC_H_ diff -Nru mapnik-2.1.0/deps/mapnik/sparsehash/internal/sparseconfig.h mapnik-2.2.0/deps/mapnik/sparsehash/internal/sparseconfig.h --- mapnik-2.1.0/deps/mapnik/sparsehash/internal/sparseconfig.h 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/deps/mapnik/sparsehash/internal/sparseconfig.h 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,46 @@ +/* + * NOTE: This file is for internal use only. + * Do not use these #defines in your own program! + */ + +/* Namespace for Google classes */ +#define GOOGLE_NAMESPACE ::google + +/* the location of the header defining hash functions */ +#define HASH_FUN_H + +/* the namespace of the hash<> function */ +#define HASH_NAMESPACE boost + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if the system has the type `long long'. */ +#define HAVE_LONG_LONG 1 + +/* Define to 1 if you have the `memcpy' function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if the system has the type `uint16_t'. */ +#define HAVE_UINT16_T 1 + +/* Define to 1 if the system has the type `u_int16_t'. */ +#define HAVE_U_INT16_T 1 + +/* Define to 1 if the system has the type `__uint16'. */ +/* #undef HAVE___UINT16 */ + +/* The system-provided hash function including the namespace. */ +#define SPARSEHASH_HASH HASH_NAMESPACE::hash + +/* Stops putting the code inside the Google namespace */ +#define _END_GOOGLE_NAMESPACE_ } + +/* Puts following code inside the Google namespace */ +#define _START_GOOGLE_NAMESPACE_ namespace google { diff -Nru mapnik-2.1.0/deps/mapnik/sparsehash/template_util.h mapnik-2.2.0/deps/mapnik/sparsehash/template_util.h --- mapnik-2.1.0/deps/mapnik/sparsehash/template_util.h 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/deps/mapnik/sparsehash/template_util.h 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,134 @@ +// Copyright 2005 Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// ---- +// +// Template metaprogramming utility functions. +// +// This code is compiled directly on many platforms, including client +// platforms like Windows, Mac, and embedded systems. Before making +// any changes here, make sure that you're not breaking any platforms. +// +// +// The names choosen here reflect those used in tr1 and the boost::mpl +// library, there are similar operations used in the Loki library as +// well. I prefer the boost names for 2 reasons: +// 1. I think that portions of the Boost libraries are more likely to +// be included in the c++ standard. +// 2. It is not impossible that some of the boost libraries will be +// included in our own build in the future. +// Both of these outcomes means that we may be able to directly replace +// some of these with boost equivalents. +// +#ifndef BASE_TEMPLATE_UTIL_H_ +#define BASE_TEMPLATE_UTIL_H_ + +#include +_START_GOOGLE_NAMESPACE_ + +// Types small_ and big_ are guaranteed such that sizeof(small_) < +// sizeof(big_) +typedef char small_; + +struct big_ { + char dummy[2]; +}; + +// Identity metafunction. +template +struct identity_ { + typedef T type; +}; + +// integral_constant, defined in tr1, is a wrapper for an integer +// value. We don't really need this generality; we could get away +// with hardcoding the integer type to bool. We use the fully +// general integer_constant for compatibility with tr1. + +template +struct integral_constant { + static const T value = v; + typedef T value_type; + typedef integral_constant type; +}; + +template const T integral_constant::value; + + +// Abbreviations: true_type and false_type are structs that represent boolean +// true and false values. Also define the boost::mpl versions of those names, +// true_ and false_. +typedef integral_constant true_type; +typedef integral_constant false_type; +typedef true_type true_; +typedef false_type false_; + +// if_ is a templatized conditional statement. +// if_ is a compile time evaluation of cond. +// if_<>::type contains A if cond is true, B otherwise. +template +struct if_{ + typedef A type; +}; + +template +struct if_ { + typedef B type; +}; + + +// type_equals_ is a template type comparator, similar to Loki IsSameType. +// type_equals_::value is true iff "A" is the same type as "B". +// +// New code should prefer base::is_same, defined in base/type_traits.h. +// It is functionally identical, but is_same is the standard spelling. +template +struct type_equals_ : public false_ { +}; + +template +struct type_equals_ : public true_ { +}; + +// and_ is a template && operator. +// and_::value evaluates "A::value && B::value". +template +struct and_ : public integral_constant { +}; + +// or_ is a template || operator. +// or_::value evaluates "A::value || B::value". +template +struct or_ : public integral_constant { +}; + + +_END_GOOGLE_NAMESPACE_ + +#endif // BASE_TEMPLATE_UTIL_H_ diff -Nru mapnik-2.1.0/deps/mapnik/sparsehash/type_traits.h mapnik-2.2.0/deps/mapnik/sparsehash/type_traits.h --- mapnik-2.1.0/deps/mapnik/sparsehash/type_traits.h 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/deps/mapnik/sparsehash/type_traits.h 2013-06-04 01:35:26.000000000 +0000 @@ -0,0 +1,342 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// ---- +// +// This code is compiled directly on many platforms, including client +// platforms like Windows, Mac, and embedded systems. Before making +// any changes here, make sure that you're not breaking any platforms. +// +// Define a small subset of tr1 type traits. The traits we define are: +// is_integral +// is_floating_point +// is_pointer +// is_enum +// is_reference +// is_pod +// has_trivial_constructor +// has_trivial_copy +// has_trivial_assign +// has_trivial_destructor +// remove_const +// remove_volatile +// remove_cv +// remove_reference +// add_reference +// remove_pointer +// is_same +// is_convertible +// We can add more type traits as required. + +#ifndef BASE_TYPE_TRAITS_H_ +#define BASE_TYPE_TRAITS_H_ + +#include +#include // For pair + +#include // For true_type and false_type + +_START_GOOGLE_NAMESPACE_ + +template struct is_integral; +template struct is_floating_point; +template struct is_pointer; +// MSVC can't compile this correctly, and neither can gcc 3.3.5 (at least) +#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) +// is_enum uses is_convertible, which is not available on MSVC. +template struct is_enum; +#endif +template struct is_reference; +template struct is_pod; +template struct has_trivial_constructor; +template struct has_trivial_copy; +template struct has_trivial_assign; +template struct has_trivial_destructor; +template struct remove_const; +template struct remove_volatile; +template struct remove_cv; +template struct remove_reference; +template struct add_reference; +template struct remove_pointer; +template struct is_same; +#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) +template struct is_convertible; +#endif + +// is_integral is false except for the built-in integer types. A +// cv-qualified type is integral if and only if the underlying type is. +template struct is_integral : false_type { }; +template<> struct is_integral : true_type { }; +template<> struct is_integral : true_type { }; +template<> struct is_integral : true_type { }; +template<> struct is_integral : true_type { }; +#if defined(_MSC_VER) +// wchar_t is not by default a distinct type from unsigned short in +// Microsoft C. +// See http://msdn2.microsoft.com/en-us/library/dh8che7s(VS.80).aspx +template<> struct is_integral<__wchar_t> : true_type { }; +#else +template<> struct is_integral : true_type { }; +#endif +template<> struct is_integral : true_type { }; +template<> struct is_integral : true_type { }; +template<> struct is_integral : true_type { }; +template<> struct is_integral : true_type { }; +template<> struct is_integral : true_type { }; +template<> struct is_integral : true_type { }; +#ifdef HAVE_LONG_LONG +template<> struct is_integral : true_type { }; +template<> struct is_integral : true_type { }; +#endif +template struct is_integral : is_integral { }; +template struct is_integral : is_integral { }; +template struct is_integral : is_integral { }; + +// is_floating_point is false except for the built-in floating-point types. +// A cv-qualified type is integral if and only if the underlying type is. +template struct is_floating_point : false_type { }; +template<> struct is_floating_point : true_type { }; +template<> struct is_floating_point : true_type { }; +template<> struct is_floating_point : true_type { }; +template struct is_floating_point + : is_floating_point { }; +template struct is_floating_point + : is_floating_point { }; +template struct is_floating_point + : is_floating_point { }; + +// is_pointer is false except for pointer types. A cv-qualified type (e.g. +// "int* const", as opposed to "int const*") is cv-qualified if and only if +// the underlying type is. +template struct is_pointer : false_type { }; +template struct is_pointer : true_type { }; +template struct is_pointer : is_pointer { }; +template struct is_pointer : is_pointer { }; +template struct is_pointer : is_pointer { }; + +#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) + +namespace internal { + +template struct is_class_or_union { + template static small_ tester(void (U::*)()); + template static big_ tester(...); + static const bool value = sizeof(tester(0)) == sizeof(small_); +}; + +// is_convertible chokes if the first argument is an array. That's why +// we use add_reference here. +template struct is_enum_impl + : is_convertible::type, int> { }; + +template struct is_enum_impl : false_type { }; + +} // namespace internal + +// Specified by TR1 [4.5.1] primary type categories. + +// Implementation note: +// +// Each type is either void, integral, floating point, array, pointer, +// reference, member object pointer, member function pointer, enum, +// union or class. Out of these, only integral, floating point, reference, +// class and enum types are potentially convertible to int. Therefore, +// if a type is not a reference, integral, floating point or class and +// is convertible to int, it's a enum. Adding cv-qualification to a type +// does not change whether it's an enum. +// +// Is-convertible-to-int check is done only if all other checks pass, +// because it can't be used with some types (e.g. void or classes with +// inaccessible conversion operators). +template struct is_enum + : internal::is_enum_impl< + is_same::value || + is_integral::value || + is_floating_point::value || + is_reference::value || + internal::is_class_or_union::value, + T> { }; + +template struct is_enum : is_enum { }; +template struct is_enum : is_enum { }; +template struct is_enum : is_enum { }; + +#endif + +// is_reference is false except for reference types. +template struct is_reference : false_type {}; +template struct is_reference : true_type {}; + + +// We can't get is_pod right without compiler help, so fail conservatively. +// We will assume it's false except for arithmetic types, enumerations, +// pointers and cv-qualified versions thereof. Note that std::pair +// is not a POD even if T and U are PODs. +template struct is_pod + : integral_constant::value || + is_floating_point::value || +#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) + // is_enum is not available on MSVC. + is_enum::value || +#endif + is_pointer::value)> { }; +template struct is_pod : is_pod { }; +template struct is_pod : is_pod { }; +template struct is_pod : is_pod { }; + + +// We can't get has_trivial_constructor right without compiler help, so +// fail conservatively. We will assume it's false except for: (1) types +// for which is_pod is true. (2) std::pair of types with trivial +// constructors. (3) array of a type with a trivial constructor. +// (4) const versions thereof. +template struct has_trivial_constructor : is_pod { }; +template struct has_trivial_constructor > + : integral_constant::value && + has_trivial_constructor::value)> { }; +template struct has_trivial_constructor + : has_trivial_constructor { }; +template struct has_trivial_constructor + : has_trivial_constructor { }; + +// We can't get has_trivial_copy right without compiler help, so fail +// conservatively. We will assume it's false except for: (1) types +// for which is_pod is true. (2) std::pair of types with trivial copy +// constructors. (3) array of a type with a trivial copy constructor. +// (4) const versions thereof. +template struct has_trivial_copy : is_pod { }; +template struct has_trivial_copy > + : integral_constant::value && + has_trivial_copy::value)> { }; +template struct has_trivial_copy + : has_trivial_copy { }; +template struct has_trivial_copy : has_trivial_copy { }; + +// We can't get has_trivial_assign right without compiler help, so fail +// conservatively. We will assume it's false except for: (1) types +// for which is_pod is true. (2) std::pair of types with trivial copy +// constructors. (3) array of a type with a trivial assign constructor. +template struct has_trivial_assign : is_pod { }; +template struct has_trivial_assign > + : integral_constant::value && + has_trivial_assign::value)> { }; +template struct has_trivial_assign + : has_trivial_assign { }; + +// We can't get has_trivial_destructor right without compiler help, so +// fail conservatively. We will assume it's false except for: (1) types +// for which is_pod is true. (2) std::pair of types with trivial +// destructors. (3) array of a type with a trivial destructor. +// (4) const versions thereof. +template struct has_trivial_destructor : is_pod { }; +template struct has_trivial_destructor > + : integral_constant::value && + has_trivial_destructor::value)> { }; +template struct has_trivial_destructor + : has_trivial_destructor { }; +template struct has_trivial_destructor + : has_trivial_destructor { }; + +// Specified by TR1 [4.7.1] +template struct remove_const { typedef T type; }; +template struct remove_const { typedef T type; }; +template struct remove_volatile { typedef T type; }; +template struct remove_volatile { typedef T type; }; +template struct remove_cv { + typedef typename remove_const::type>::type type; +}; + + +// Specified by TR1 [4.7.2] Reference modifications. +template struct remove_reference { typedef T type; }; +template struct remove_reference { typedef T type; }; + +template struct add_reference { typedef T& type; }; +template struct add_reference { typedef T& type; }; + +// Specified by TR1 [4.7.4] Pointer modifications. +template struct remove_pointer { typedef T type; }; +template struct remove_pointer { typedef T type; }; +template struct remove_pointer { typedef T type; }; +template struct remove_pointer { typedef T type; }; +template struct remove_pointer { + typedef T type; }; + +// Specified by TR1 [4.6] Relationships between types +template struct is_same : public false_type { }; +template struct is_same : public true_type { }; + +// Specified by TR1 [4.6] Relationships between types +#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) +namespace internal { + +// This class is an implementation detail for is_convertible, and you +// don't need to know how it works to use is_convertible. For those +// who care: we declare two different functions, one whose argument is +// of type To and one with a variadic argument list. We give them +// return types of different size, so we can use sizeof to trick the +// compiler into telling us which function it would have chosen if we +// had called it with an argument of type From. See Alexandrescu's +// _Modern C++ Design_ for more details on this sort of trick. + +template +struct ConvertHelper { + static small_ Test(To); + static big_ Test(...); + static From Create(); +}; +} // namespace internal + +// Inherits from true_type if From is convertible to To, false_type otherwise. +template +struct is_convertible + : integral_constant::Test( + internal::ConvertHelper::Create())) + == sizeof(small_)> { +}; +#endif + +_END_GOOGLE_NAMESPACE_ + +// Right now these macros are no-ops, and mostly just document the fact +// these types are PODs, for human use. They may be made more contentful +// later. The typedef is just to make it legal to put a semicolon after +// these macros. +#define DECLARE_POD(TypeName) typedef int Dummy_Type_For_DECLARE_POD +#define DECLARE_NESTED_POD(TypeName) DECLARE_POD(TypeName) +#define PROPAGATE_POD_FROM_TEMPLATE_ARGUMENT(TemplateName) \ + typedef int Dummy_Type_For_PROPAGATE_POD_FROM_TEMPLATE_ARGUMENT +#define ENFORCE_POD(TypeName) typedef int Dummy_Type_For_ENFORCE_POD + +#endif // BASE_TYPE_TRAITS_H_ diff -Nru mapnik-2.1.0/docs/contributing.markdown mapnik-2.2.0/docs/contributing.markdown --- mapnik-2.1.0/docs/contributing.markdown 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/docs/contributing.markdown 2013-06-04 01:35:26.000000000 +0000 @@ -2,11 +2,11 @@ ## Community -Mapnik is an open source community creating a tool to enable to the craft of making beautiful maps. Working together collaboratively towards this goal is what makes it all possible and fun. +Mapnik is a creative community focused on making beautiful maps with beautiful software. -We host our code on github.com/mapnik and encourage anyone interested to fork the repository and provide pull requests or patches for things they want to see added. +We host our code on github.com/mapnik and encourage anyone interested to fork the repository and provide pull requests or patches for things they want to see added or fixed. -If you just have a question about the code, or a feature you want to discuss then feel free to create a new issue. +If you just have a question about the code, or a feature you want to discuss then feel free to create a new issue at github.com/mapnik-support. ## Code Philosophy @@ -15,10 +15,9 @@ Also read the design philosophy page for the motivations that lead to code decisions. -Templates are good, within reason. We seek to use templates were possible for flexible code, but not in cases where functional -patterns would be just as concise and clear. +Templates are good, within reason. We seek to use templates where possible for flexible code, but not in cases where functional patterns would be just as concise and clear. -In general we use Boost, it makes more possible in C++. It is a big build time dependency (as in time to compile against and # of headers) but ultimately compiles to small object code and is very fast (particularly spirit). It also has no dependencies itself (it's really an extension to the C++ language) so requiring it is much easier than requiring a hard dependency that itself has other dependencies. This is a big reason that we prefer AGG to Cairo as our primary renderer. Also AGG, besides producing the best visual output, strikes an excellent balance between speed and thread safety by using very lightweight objects. Cairo not so much. +In general we use Boost, it makes more possible in C++. It is a big build time dependency (as in time to compile against and # of headers) but ultimately compiles to small object code and is very fast (particularly spirit). It also has no dependencies itself (it's really an extension to the C++ language) so requiring it is much easier than requiring a hard dependency that itself has other dependencies. This is a big reason that we prefer AGG to Cairo as our primary renderer. Also AGG produces the best visual output and strikes an excellent balance between speed and thread safety by using very lightweight objects. Cairo not so much. You will also notice that we don't use many of the standard geo libraries when we could. For instance we don't use GDAL, OGR, or GEOS anywhere in core, and only leverage them in optional plugins. We feel we can often write code that is faster and more thread safe than these libraries but that still does the job. If this ever changes we can adapt and start using these libraries or others as dependencies - nothing is nicer than standing on the shoulders of giants when it makes sense. @@ -85,6 +84,15 @@ If you see bits of code around that do not follow these please don't hesitate to flag the issue or correct it yourself. +#### Avoid boost::lexical_cast + +It's slow both to compile and at runtime. + +#### Avoid sstream objects if possible + +They should never be used in performance critical code because they trigger std::locale usage +which triggers locks + #### Spaces not tabs, and avoid trailing whitespace #### Indentation is four spaces @@ -153,6 +161,14 @@ // more... } +#### Prefer `empty()` over `size() == 0` if container supports it + +This avoids implicit conversions to bool and reduces compiler warnings. + + if (container.empty()) // please + + if (container.size() == 0) // no + ### Other C++ style resources diff -Nru mapnik-2.1.0/fonts/build.py mapnik-2.2.0/fonts/build.py --- mapnik-2.1.0/fonts/build.py 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/fonts/build.py 2013-06-04 01:35:26.000000000 +0000 @@ -15,22 +15,19 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -# $Id$ +# import os import glob Import('env') -# grab all the deja vu fonts -includes = glob.glob('*/*/*.ttf') - -# grab single unifont ttf (available at http://unifoundry.com/unifont.html) -includes.extend(glob.glob('unifont*.ttf')) - -target_path = env['MAPNIK_FONTS_DEST'] - -if 'uninstall' not in COMMAND_LINE_TARGETS and not env['SYSTEM_FONTS']: - env.Alias(target='install', source=env.Install(target_path, includes)) - -env['create_uninstall_target'](env, target_path) \ No newline at end of file +if not env['SYSTEM_FONTS']: + # grab all the deja vu fonts + includes = glob.glob('*/*/*.ttf') + # grab single unifont ttf (available at http://unifoundry.com/unifont.html) + includes.extend(glob.glob('unifont*.ttf')) + target_path = env['MAPNIK_FONTS_DEST'] + if 'uninstall' not in COMMAND_LINE_TARGETS: + env.Alias(target='install', source=env.Install(target_path, includes)) + env['create_uninstall_target'](env, target_path) \ No newline at end of file diff -Nru mapnik-2.1.0/include/build.py mapnik-2.2.0/include/build.py --- mapnik-2.1.0/include/build.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/build.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,19 @@ +import os +from glob import glob + +Import('env') + +base = './mapnik/' +subdirs = ['','svg','wkt','grid','json','util','text_placements','formatting'] + +if env['SVG_RENDERER']: + subdirs.append('svg/output') + +if 'install' in COMMAND_LINE_TARGETS: + for subdir in subdirs: + pathdir = os.path.join(base,subdir,'*.hpp') + includes = glob(pathdir) + inc_target = os.path.normpath(env['INSTALL_PREFIX']+'/include/mapnik/'+subdir) + env.Alias(target='install', source=env.Install(inc_target, includes)) + +env['create_uninstall_target'](env, os.path.normpath(env['INSTALL_PREFIX']+'/include/mapnik/')) diff -Nru mapnik-2.1.0/include/mapnik/agg_helpers.hpp mapnik-2.2.0/include/mapnik/agg_helpers.hpp --- mapnik-2.1.0/include/mapnik/agg_helpers.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/agg_helpers.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,6 +23,10 @@ #ifndef MAPNIK_AGG_HELPERS_HPP #define MAPNIK_AGG_HELPERS_HPP +// mapnik +#include +#include + // agg #include "agg_basics.h" #include "agg_gamma_functions.h" diff -Nru mapnik-2.1.0/include/mapnik/agg_pattern_source.hpp mapnik-2.2.0/include/mapnik/agg_pattern_source.hpp --- mapnik-2.1.0/include/mapnik/agg_pattern_source.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/agg_pattern_source.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,9 +25,7 @@ // mapnik #include - -// boost -#include +#include // agg #include "agg_color_rgba.h" @@ -35,7 +33,7 @@ namespace mapnik { -class pattern_source : private boost::noncopyable +class pattern_source : private mapnik::noncopyable { public: pattern_source(image_data_32 const& pattern) diff -Nru mapnik-2.1.0/include/mapnik/agg_rasterizer.hpp mapnik-2.2.0/include/mapnik/agg_rasterizer.hpp --- mapnik-2.1.0/include/mapnik/agg_rasterizer.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/agg_rasterizer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,15 +23,15 @@ #ifndef MAPNIK_AGG_RASTERIZER_HPP #define MAPNIK_AGG_RASTERIZER_HPP -// boost -#include +// mapnik +#include // agg #include "agg_rasterizer_scanline_aa.h" namespace mapnik { -struct rasterizer : agg::rasterizer_scanline_aa<>, boost::noncopyable {}; +struct rasterizer : agg::rasterizer_scanline_aa<>, mapnik::noncopyable {}; } diff -Nru mapnik-2.1.0/include/mapnik/agg_renderer.hpp mapnik-2.2.0/include/mapnik/agg_renderer.hpp --- mapnik-2.1.0/include/mapnik/agg_renderer.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/agg_renderer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,36 +24,42 @@ #define MAPNIK_AGG_RENDERER_HPP // mapnik -#include +#include // for MAPNIK_DECL #include -#include -#include -#include -#include // for all symbolizers +#include // for face_manager, etc +#include // for noncopyable +#include // for rule, symbolizers +#include // for box2d +#include // for color +#include // for CoordTransform +#include // for composite_mode_e +#include +#include // boost -#include #include #include -#include -// FIXME -// forward declare so that -// apps using mapnik do not -// need agg headers -namespace agg { -struct trans_affine; -} +// fwd declaration to avoid depedence on agg headers +namespace agg { struct trans_affine; } +// fwd declarations to speed up compile namespace mapnik { + class Map; + class feature_impl; + class feature_type_style; + class label_collision_detector4; + class layer; + class marker; + class proj_transform; + struct rasterizer; +} -class marker; - -struct rasterizer; +namespace mapnik { template class MAPNIK_DECL agg_renderer : public feature_style_processor >, - private boost::noncopyable + private mapnik::noncopyable { public: @@ -64,6 +70,8 @@ // create with external placement detector, possibly non-empty agg_renderer(Map const &m, T & pixmap, boost::shared_ptr detector, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0); + // pass in mapnik::request object to provide the mutable things per render + agg_renderer(Map const& m, request const& req, T & pixmap, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0); ~agg_renderer(); void start_map_processing(Map const& map); void end_map_processing(Map const& map); @@ -106,6 +114,9 @@ void process(markers_symbolizer const& sym, mapnik::feature_impl & feature, proj_transform const& prj_trans); + void process(debug_symbolizer const& sym, + feature_impl & feature, + proj_transform const& prj_trans); inline bool process(rule::symbolizers const& /*syms*/, mapnik::feature_impl & /*feature*/, @@ -113,9 +124,13 @@ { // agg renderer doesn't support processing of multiple symbolizers. return false; - }; + } void painted(bool painted); + inline eAttributeCollectionPolicy attribute_collection_policy() const + { + return DEFAULT; + } protected: template @@ -139,7 +154,9 @@ boost::shared_ptr detector_; boost::scoped_ptr ras_ptr; box2d query_extent_; - void setup(Map const &m); + gamma_method_e gamma_method_; + double gamma_; + void setup(Map const& m); }; } diff -Nru mapnik-2.1.0/include/mapnik/attribute.hpp mapnik-2.2.0/include/mapnik/attribute.hpp --- mapnik-2.1.0/include/mapnik/attribute.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/attribute.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,7 +24,7 @@ #define MAPNIK_ATTRIBUTE_HPP // mapnik -#include +#include #include // stl @@ -52,14 +52,14 @@ template V value(F const& f) const { - int type = 0; + mapnik::value_integer type = 0; geometry_container::const_iterator itr = f.paths().begin(); geometry_container::const_iterator end = f.paths().end(); for ( ; itr != end; ++itr) { if (type != 0 && itr->type() != type) { - return 4; // Collection + return value_integer(4); // Collection } type = itr->type(); } diff -Nru mapnik-2.1.0/include/mapnik/attribute_collector.hpp mapnik-2.2.0/include/mapnik/attribute_collector.hpp --- mapnik-2.1.0/include/mapnik/attribute_collector.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/attribute_collector.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,15 +24,35 @@ #define MAPNIK_ATTRIBUTE_COLLECTOR_HPP // mapnik -#include #include +#include +#include +#include // for transform_list_ptr +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for rule::symbolizers +#include // for expression_ptr, etc +#include +#include +#include // for path_processor_type +#include // for path_expression_ptr +#include // for text_placements + // boost -#include -#include #include +#include +#include + // stl #include -#include namespace mapnik { @@ -207,7 +227,7 @@ }; -class attribute_collector : public boost::noncopyable +class attribute_collector : public mapnik::noncopyable { private: std::set& names_; diff -Nru mapnik-2.1.0/include/mapnik/attribute_descriptor.hpp mapnik-2.2.0/include/mapnik/attribute_descriptor.hpp --- mapnik-2.1.0/include/mapnik/attribute_descriptor.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/attribute_descriptor.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -79,7 +79,7 @@ return name_; } - unsigned get_type() const + unsigned int get_type() const { return type_; } @@ -101,7 +101,7 @@ private: std::string name_; - int type_; + unsigned int type_; bool primary_key_; int size_; int precision_; diff -Nru mapnik-2.1.0/include/mapnik/boolean.hpp mapnik-2.2.0/include/mapnik/boolean.hpp --- mapnik-2.1.0/include/mapnik/boolean.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/boolean.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,48 +24,48 @@ // std #include - -// boost -#include +#include +#include +#include namespace mapnik { -/** Helper for class bool */ + +// Helper for class bool class boolean { public: - boolean(): b_(false) {} - boolean(bool b) : b_(b) {} - boolean(boolean const& b) : b_(b.b_) {} + boolean() + : b_(false) {} + boolean(bool b) + : b_(b) {} + boolean(boolean const& b) + : b_(b.b_) {} operator bool() const { return b_; } - boolean & operator = (boolean const& other) + boolean & operator =(boolean const& other) { + if (this == &other) + return *this; b_ = other.b_; - return * this; - } - - boolean & operator = (bool other) - { - b_ = other; - return * this; + return *this; } private: bool b_; }; -/** Special stream input operator for boolean values */ +// Special stream input operator for boolean values template std::basic_istream & operator >> ( std::basic_istream & s, boolean & b ) { std::string word; s >> word; - boost::algorithm::to_lower(word); + std::transform(word.begin(), word.end(), word.begin(), ::tolower); if ( s ) { if ( word == "true" || word == "yes" || word == "on" || diff -Nru mapnik-2.1.0/include/mapnik/box2d.hpp mapnik-2.2.0/include/mapnik/box2d.hpp --- mapnik-2.1.0/include/mapnik/box2d.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/box2d.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -67,6 +67,10 @@ T miny() const; T maxx() const; T maxy() const; + void set_minx(T v); + void set_miny(T v); + void set_maxx(T v); + void set_maxy(T v); T width() const; T height() const; void width(T w); @@ -87,7 +91,8 @@ void re_center(const coord& c); void init(T x0,T y0,T x1,T y1); void clip(const box2d_type &other); - bool from_string(const std::string& s); + void pad(T padding); + bool from_string(std::string const& s); bool valid() const; // define some operators diff -Nru mapnik-2.1.0/include/mapnik/building_symbolizer.hpp mapnik-2.2.0/include/mapnik/building_symbolizer.hpp --- mapnik-2.1.0/include/mapnik/building_symbolizer.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/building_symbolizer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,6 +25,7 @@ // mapnik #include +#include #include #include diff -Nru mapnik-2.1.0/include/mapnik/cairo_context.hpp mapnik-2.2.0/include/mapnik/cairo_context.hpp --- mapnik-2.1.0/include/mapnik/cairo_context.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/cairo_context.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,417 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + + +#ifndef MAPNIK_CAIRO_CONTEXT_HPP +#define MAPNIK_CAIRO_CONTEXT_HPP + +// mapnik +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// boost +#include + +// cairo +#include + +// stl +#include +#include +#include + +// agg +#include "agg_basics.h" + +namespace mapnik { + +class text_path; + +typedef cairo_status_t ErrorStatus; + +/// Throws the appropriate exception, if exceptions are enabled. +inline void throw_exception(ErrorStatus status) +{ + throw std::runtime_error("cairo: fixme"); +} + +//We inline this because it is called so often. +inline void check_status_and_throw_exception(ErrorStatus status) +{ + if(status != CAIRO_STATUS_SUCCESS) + throw_exception(status); +} + +template +void check_object_status_and_throw_exception(const T& object) +{ + check_status_and_throw_exception(object.get_status()); +} + +class cairo_face : private mapnik::noncopyable +{ +public: + cairo_face(boost::shared_ptr const& engine, face_ptr const& face); + ~cairo_face(); + cairo_font_face_t * face() const; +private: + class handle + { + public: + handle(boost::shared_ptr const& engine, face_ptr const& face) + : engine_(engine), face_(face) {} + + private: + boost::shared_ptr engine_; + face_ptr face_; + }; + + static void destroy(void *data) + { + handle *h = static_cast(data); + delete h; + } + +private: + face_ptr face_; + cairo_font_face_t *c_face_; +}; + +typedef boost::shared_ptr cairo_face_ptr; + +class cairo_face_manager : private mapnik::noncopyable +{ +public: + cairo_face_manager(boost::shared_ptr engine); + cairo_face_ptr get_face(face_ptr face); + +private: + typedef std::map cairo_face_cache; + boost::shared_ptr font_engine_; + cairo_face_cache cache_; +}; + +class cairo_pattern : private mapnik::noncopyable +{ +public: + cairo_pattern(image_data_32 const& data) + { + int pixels = data.width() * data.height(); + const unsigned int *in_ptr = data.getData(); + const unsigned int *in_end = in_ptr + pixels; + unsigned int *out_ptr; + + surface_ = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, data.width(), data.height()); + + out_ptr = reinterpret_cast(cairo_image_surface_get_data(surface_)); + + while (in_ptr < in_end) + { + unsigned int in = *in_ptr++; + unsigned int r = (in >> 0) & 0xff; + unsigned int g = (in >> 8) & 0xff; + unsigned int b = (in >> 16) & 0xff; + unsigned int a = (in >> 24) & 0xff; + + //r = r * a / 255; + //g = g * a / 255; + //b = b * a / 255; + + *out_ptr++ = (a << 24) | (r << 16) | (g << 8) | b; + } + // mark the surface as dirty as we've modified it behind cairo's back + cairo_surface_mark_dirty(surface_); + pattern_ = cairo_pattern_create_for_surface(surface_); + } + + ~cairo_pattern() + { + if (surface_) cairo_surface_destroy(surface_); + if (pattern_) cairo_pattern_destroy(pattern_); + } + + void set_matrix(cairo_matrix_t const& matrix) + { + cairo_pattern_set_matrix(pattern_, &matrix); + } + + void set_origin(double x, double y) + { + cairo_matrix_t matrix; + cairo_pattern_get_matrix(pattern_,&matrix); + matrix.x0 = -x; + matrix.y0 = -y; + cairo_pattern_set_matrix(pattern_,&matrix); + } + + void set_extend(cairo_extend_t extend) + { + cairo_pattern_set_extend(pattern_, extend); + } + + void set_filter(cairo_filter_t filter) + { + cairo_pattern_set_filter(pattern_, filter); + } + + cairo_pattern_t * pattern() const + { + return pattern_; + } + +private: + cairo_surface_t * surface_; + cairo_pattern_t * pattern_; +}; + + +class cairo_gradient : private mapnik::noncopyable +{ +public: + cairo_gradient(const mapnik::gradient &grad, double opacity=1.0) + { + double x1,x2,y1,y2,rad; + grad.get_control_points(x1,y1,x2,y2,rad); + if (grad.get_gradient_type() == LINEAR) + { + pattern_ = cairo_pattern_create_linear(x1, y1, x2, y2); + } + else if (grad.get_gradient_type() == RADIAL) + { + pattern_ = cairo_pattern_create_radial(x1, y1, 0, x2, y2, rad); + } + + units_ = grad.get_units(); + + BOOST_FOREACH ( mapnik::stop_pair const& st, grad.get_stop_array() ) + { + mapnik::color const& stop_color = st.second; + double r= static_cast (stop_color.red())/255.0; + double g= static_cast (stop_color.green())/255.0; + double b= static_cast (stop_color.blue())/255.0; + double a= static_cast (stop_color.alpha())/255.0; + cairo_pattern_add_color_stop_rgba(pattern_,st.first, r, g, b, a*opacity); + } + + double m[6]; + agg::trans_affine tr = grad.get_transform(); + tr.invert(); + tr.store_to(m); + cairo_matrix_t matrix; + cairo_matrix_init(&matrix,m[0],m[1],m[2],m[3],m[4],m[5]); + cairo_pattern_set_matrix(pattern_, &matrix); + } + + ~cairo_gradient() + { + if (pattern_) + cairo_pattern_destroy(pattern_); + } + + + cairo_pattern_t * gradient() const + { + return pattern_; + } + + gradient_unit_e units() const + { + return units_; + } + +private: + cairo_pattern_t * pattern_; + gradient_unit_e units_; + +}; + +struct cairo_closer +{ + void operator() (cairo_t * obj) + { + if (obj) cairo_destroy(obj); + } +}; + +struct cairo_surface_closer +{ + void operator() (cairo_surface_t * surface) + { + if (surface) cairo_surface_destroy(surface); + } +}; + +typedef boost::shared_ptr cairo_ptr; +typedef boost::shared_ptr cairo_surface_ptr; + +inline cairo_ptr create_context(cairo_surface_ptr const& surface) +{ + return cairo_ptr(cairo_create(&*surface),cairo_closer()); +} + +class cairo_context : private mapnik::noncopyable +{ +public: + + cairo_context(cairo_ptr const& cairo); + + inline ErrorStatus get_status() const + { + return cairo_status(cairo_.get()); + } + + void clip(); + void show_page(); + void set_color(color const &color, double opacity = 1.0); + void set_color(double r, double g, double b, double opacity = 1.0); + void set_operator(composite_mode_e comp_op); + void set_line_join(line_join_e join); + void set_line_cap(line_cap_e cap); + void set_miter_limit(double limit); + void set_line_width(double width); + void set_dash(dash_array const &dashes, double scale_factor); + void set_fill_rule(cairo_fill_rule_t fill_rule); + void move_to(double x, double y); + void curve_to(double ct1_x, double ct1_y, double ct2_x, double ct2_y, double end_x, double end_y); + void close_path(); + void line_to(double x, double y); + void rectangle(double x, double y, double w, double h); + void stroke(); + void fill(); + void paint(); + void set_pattern(cairo_pattern const& pattern); + void set_gradient(cairo_gradient const& pattern, box2d const& bbox); + void add_image(double x, double y, image_data_32 & data, double opacity = 1.0); + void add_image(agg::trans_affine const& tr, image_data_32 & data, double opacity = 1.0); + void set_font_face(cairo_face_manager & manager, face_ptr face); + void set_font_matrix(cairo_matrix_t const& matrix); + void set_matrix(cairo_matrix_t const& matrix); + void transform(cairo_matrix_t const& matrix); + void translate(double x, double y); + void save(); + void restore(); + void show_glyph(unsigned long index, double x, double y); + void glyph_path(unsigned long index, double x, double y); + void add_text(text_path const& path, + cairo_face_manager & manager, + face_manager & font_manager, + double scale_factor = 1.0); + + template + void add_path(T& path, unsigned start_index = 0) + { + double x, y; + path.rewind(start_index); + for (unsigned cm = path.vertex(&x, &y); cm != SEG_END; cm = path.vertex(&x, &y)) + { + if (cm == SEG_MOVETO) + { + move_to(x, y); + } + else if (cm == SEG_LINETO) + { + line_to(x, y); + } + else if (cm == SEG_CLOSE) + { + close_path(); + } + } + } + + template + void add_agg_path(T& path, unsigned start_index = 0) + { + double x=0; + double y=0; + + path.rewind(start_index); + + for (unsigned cm = path.vertex(&x, &y); !agg::is_stop(cm); cm = path.vertex(&x, &y)) + { + if (agg::is_move_to(cm)) + { + move_to(x, y); + } + else if (agg::is_drawing(cm)) + { + if (agg::is_curve3(cm)) + { + double end_x=0; + double end_y=0; + + MAPNIK_LOG_WARN(cairo_renderer) << "Curve 3 not implemented"; + + path.vertex(&end_x, &end_y); + + curve_to(x,y,x,y,end_x,end_y); + } + else if (agg::is_curve4(cm)) + { + double ct2_x=0; + double ct2_y=0; + double end_x=0; + double end_y=0; + + path.vertex(&ct2_x, &ct2_y); + path.vertex(&end_x, &end_y); + + curve_to(x,y,ct2_x,ct2_y,end_x,end_y); + } + else if (agg::is_line_to(cm)) + { + line_to(x, y); + } + else + { + MAPNIK_LOG_WARN(cairo_renderer) << "Unimplemented drawing command: " << cm; + move_to(x, y); + } + } + else if (agg::is_close(cm)) + { + close_path(); + } + else + { + MAPNIK_LOG_WARN(cairo_renderer) << "Unimplemented path command: " << cm; + } + } + } + +private: + cairo_ptr cairo_; +}; + + +} + + +#endif // MAPNIK_CAIRO_CONTEXT_HPP diff -Nru mapnik-2.1.0/include/mapnik/cairo_renderer.hpp mapnik-2.2.0/include/mapnik/cairo_renderer.hpp --- mapnik-2.1.0/include/mapnik/cairo_renderer.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/cairo_renderer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -31,14 +31,16 @@ #include #include #include +#include #include // for all symbolizers +#include +#include +#include // cairo -#include -#include +#include // boost -#include #include // FIXME @@ -53,26 +55,26 @@ class marker; -class cairo_face; - -typedef boost::shared_ptr cairo_face_ptr; - -class cairo_face_manager : private boost::noncopyable -{ -public: - cairo_face_manager(boost::shared_ptr engine); - cairo_face_ptr get_face(face_ptr face); - -private: - typedef std::map cairo_face_cache; - boost::shared_ptr font_engine_; - cairo_face_cache cache_; -}; - -class MAPNIK_DECL cairo_renderer_base : private boost::noncopyable +class MAPNIK_DECL cairo_renderer_base : private mapnik::noncopyable { protected: - cairo_renderer_base(Map const& m, Cairo::RefPtr const& context, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0); + cairo_renderer_base(Map const& m, + cairo_ptr const& cairo, + double scale_factor=1.0, + unsigned offset_x=0, + unsigned offset_y=0); + cairo_renderer_base(Map const& m, + request const& req, + cairo_ptr const& cairo, + double scale_factor=1.0, + unsigned offset_x=0, + unsigned offset_y=0); + cairo_renderer_base(Map const& m, + cairo_ptr const& cairo, + boost::shared_ptr detector, + double scale_factor=1.0, + unsigned offset_x=0, + unsigned offset_y=0); public: ~cairo_renderer_base(); void start_map_processing(Map const& map); @@ -116,19 +118,26 @@ { // cairo renderer doesn't support processing of multiple symbolizers. return false; - }; + } void painted(bool /*painted*/) { // nothing to do } - void render_marker(pixel_position const& pos, marker const& marker, const agg::trans_affine & mtx, double opacity=1.0, bool recenter=true); + inline eAttributeCollectionPolicy attribute_collection_policy() const + { + return DEFAULT; + } + + void render_marker(pixel_position const& pos, + marker const& marker, + agg::trans_affine const& mtx, + double opacity=1.0, + bool recenter=true); void render_box(box2d const& b); protected: - - Map const& m_; - Cairo::RefPtr context_; + cairo_context context_; unsigned width_; unsigned height_; double scale_factor_; @@ -136,8 +145,9 @@ boost::shared_ptr font_engine_; face_manager font_manager_; cairo_face_manager face_manager_; - label_collision_detector4 detector_; + boost::shared_ptr detector_; box2d query_extent_; + void setup(Map const& m); }; template @@ -146,7 +156,23 @@ { public: typedef cairo_renderer_base processor_impl_type; - cairo_renderer(Map const& m, Cairo::RefPtr const& surface, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0); + cairo_renderer(Map const& m, + T const& obj, + double scale_factor=1.0, + unsigned offset_x=0, + unsigned offset_y=0); + cairo_renderer(Map const& m, + request const& req, + T const& obj, + double scale_factor=1.0, + unsigned offset_x=0, + unsigned offset_y=0); + cairo_renderer(Map const& m, + T const& obj, + boost::shared_ptr detector, + double scale_factor=1.0, + unsigned offset_x=0, + unsigned offset_y=0); void end_map_processing(Map const& map); }; } diff -Nru mapnik-2.1.0/include/mapnik/char_info.hpp mapnik-2.2.0/include/mapnik/char_info.hpp --- mapnik-2.1.0/include/mapnik/char_info.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/char_info.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -20,15 +20,16 @@ * *****************************************************************************/ -#ifndef CHAR_INFO_HPP -#define CHAR_INFO_HPP +#ifndef MAPNIK_CHAR_INFO_HPP +#define MAPNIK_CHAR_INFO_HPP #include namespace mapnik { struct char_properties; -class char_info { +class char_info +{ public: char_info(unsigned c_, double width_, double ymax_, double ymin_, double line_height_) : c(c_), @@ -36,7 +37,7 @@ line_height(line_height_), ymin(ymin_), ymax(ymax_), - avg_height(ymax_-ymin_), + avg_height(ymax - ymin), format() { } @@ -52,6 +53,8 @@ { } + double height() const { return ymax-ymin; } + unsigned c; double width; double line_height; @@ -59,7 +62,8 @@ double ymax; double avg_height; char_properties *format; - double height() const { return ymax-ymin; } + }; } -#endif + +#endif //MAPNIK_CHAR_INFO_HPP diff -Nru mapnik-2.1.0/include/mapnik/color.hpp mapnik-2.2.0/include/mapnik/color.hpp --- mapnik-2.1.0/include/mapnik/color.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/color.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -47,70 +47,86 @@ public: color() - : red_(0xff), + : red_(0xff), green_(0xff), blue_(0xff), alpha_(0xff) {} - color(unsigned red, unsigned green, unsigned blue, unsigned alpha = 0xff) - : red_(red), + color(boost::uint8_t red, boost::uint8_t green, boost::uint8_t blue, boost::uint8_t alpha = 0xff) + : red_(red), green_(green), blue_(blue), alpha_(alpha) {} - color( std::string const& css_string); - color(const color& rhs) - : red_(rhs.red_), + : red_(rhs.red_), green_(rhs.green_), blue_(rhs.blue_), alpha_(rhs.alpha_) {} - color& operator=(const color& rhs) - { - if (this==&rhs) return *this; - red_=rhs.red_; - green_=rhs.green_; - blue_=rhs.blue_; - alpha_=rhs.alpha_; + color( std::string const& str); + + std::string to_string() const; + std::string to_hex_string() const; + void premultiply(); + void demultiply(); + + color& operator=(color const& rhs) + { + if (this==&rhs) return *this; - } - inline unsigned red() const + red_ = rhs.red_; + green_ = rhs.green_; + blue_ = rhs.blue_; + alpha_ = rhs.alpha_; + + return *this; + } + + inline bool operator==(color const& rhs) const + { + return (red_== rhs.red()) && + (green_ == rhs.green()) && + (blue_ == rhs.blue()) && + (alpha_ == rhs.alpha()); + } + + inline boost::uint8_t red() const { return red_; } - inline unsigned green() const + inline boost::uint8_t green() const { return green_; } - inline unsigned blue() const + inline boost::uint8_t blue() const { return blue_; } - inline unsigned alpha() const + inline boost::uint8_t alpha() const { return alpha_; } - inline void set_red(unsigned red) + inline void set_red(boost::uint8_t red) { red_ = red; } - inline void set_green(unsigned green) + inline void set_green(boost::uint8_t green) { green_ = green; } - inline void set_blue(unsigned blue) + inline void set_blue(boost::uint8_t blue) { blue_ = blue; } - inline void set_alpha(unsigned alpha) + inline void set_alpha(boost::uint8_t alpha) { alpha_ = alpha; } @@ -123,18 +139,6 @@ return (alpha_ << 24) | (blue_ << 16) | (green_ << 8) | (red_) ; #endif } - - inline bool operator==(color const& rhs) const - { - return (red_== rhs.red()) && - (green_ == rhs.green()) && - (blue_ == rhs.blue()) && - (alpha_ == rhs.alpha()); - - } - - std::string to_string() const; - std::string to_hex_string() const; }; template diff -Nru mapnik-2.1.0/include/mapnik/color_factory.hpp mapnik-2.2.0/include/mapnik/color_factory.hpp --- mapnik-2.1.0/include/mapnik/color_factory.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/color_factory.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,27 +24,16 @@ #define MAPNIK_COLOR_FACTORY_HPP // mapnik -#include +#include +#include -// boost -#include +#include namespace mapnik { -class color; +MAPNIK_DECL mapnik::color parse_color(std::string const& str); +MAPNIK_DECL mapnik::color parse_color(std::string const& str, mapnik::css_color_grammar const& g); -template struct css_color_grammar; -class MAPNIK_DECL color_factory : boost::noncopyable -{ -public: - - static void init_from_string(color & c, std::string const& css_color); - - static bool parse_from_string(color & c, std::string const& css_color, - mapnik::css_color_grammar const& g); - - static color from_string(std::string const& css_color); -}; } #endif // MAPNIK_COLOR_FACTORY_HPP diff -Nru mapnik-2.1.0/include/mapnik/config.hpp mapnik-2.2.0/include/mapnik/config.hpp --- mapnik-2.1.0/include/mapnik/config.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/config.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -39,9 +39,15 @@ # pragma warning(disable : 4996) //_CRT_SECURE_NO_DEPRECATE # endif #else +# if __GNUC__ >= 4 +# define MAPNIK_EXP __attribute__ ((visibility ("default"))) +# define MAPNIK_DECL __attribute__ ((visibility ("default"))) +# define MAPNIK_IMP __attribute__ ((visibility ("default"))) +# else # define MAPNIK_EXP -# define MAPNIK_IMP # define MAPNIK_DECL +# define MAPNIK_IMP +# endif #endif #define PROJ_ENVELOPE_POINTS 20 diff -Nru mapnik-2.1.0/include/mapnik/config_error.hpp mapnik-2.2.0/include/mapnik/config_error.hpp --- mapnik-2.1.0/include/mapnik/config_error.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/config_error.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,24 +23,30 @@ #ifndef MAPNIK_CONFIG_ERROR_HPP #define MAPNIK_CONFIG_ERROR_HPP -#include -#include +#include + +#include +#include namespace mapnik { class xml_node; + class config_error : public std::exception { public: config_error(std::string const& what); - config_error(std::string const& what, xml_node const& node); - config_error(std::string const& what, unsigned line_number, std::string const& filename); + config_error(std::string const& what, + xml_node const& node); + config_error(std::string const& what, + unsigned line_number, + std::string const& filename); virtual ~config_error() throw() {} virtual const char * what() const throw(); - void append_context(const std::string & ctx) const; - void append_context(const std::string & ctx, xml_node const& node) const; + void append_context(std::string const& ctx) const; + void append_context(std::string const& ctx, xml_node const& node) const; void append_context(xml_node const& node) const; protected: mutable std::string what_; diff -Nru mapnik-2.1.0/include/mapnik/coord.hpp mapnik-2.2.0/include/mapnik/coord.hpp --- mapnik-2.1.0/include/mapnik/coord.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/coord.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -52,8 +52,8 @@ public: coord() : x(),y() {} - coord(T x,T y) - : x(x),y(y) {} + coord(T x_,T y_) + : x(x_),y(y_) {} template coord (const coord& rhs) : x(type(rhs.x)), @@ -128,8 +128,8 @@ public: coord() : x(),y(),z() {} - coord(T x,T y,T z) - : x(x),y(y),z(z) {} + coord(T x_,T y_,T z_) + : x(x_),y(y_),z(z_) {} template coord (const coord& rhs) : x(type(rhs.x)), diff -Nru mapnik-2.1.0/include/mapnik/css_color_grammar.hpp mapnik-2.2.0/include/mapnik/css_color_grammar.hpp --- mapnik-2.1.0/include/mapnik/css_color_grammar.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/css_color_grammar.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -27,7 +27,6 @@ #include // spirit2 -#include #include #include @@ -40,6 +39,25 @@ // stl #include +namespace mapnik { + +// http://www.w3.org/TR/css3-color/#hsl-color +inline double hue_to_rgb( double m1, double m2, double h) +{ + if (h < 0.0) h = h + 1.0; + else if (h > 1) h = h - 1.0; + + if (h * 6 < 1.0) + return m1 + (m2 - m1) * h * 6.0; + if (h * 2 < 1.0) + return m2; + if (h * 3 < 2.0) + return m1 + (m2 - m1)* (2.0/3.0 - h) * 6.0; + return m1; +} + +} // namespace mapnik + // boost #include #if BOOST_VERSION >= 104500 @@ -105,9 +123,6 @@ } }; -// http://www.w3.org/TR/css3-color/#hsl-color -inline double hue_to_rgb( double m1, double m2, double h); - struct hsl_conv_impl { template @@ -396,22 +411,6 @@ } }; - -// http://www.w3.org/TR/css3-color/#hsl-color -inline double hue_to_rgb( double m1, double m2, double h) -{ - if (h < 0.0) h = h + 1.0; - else if (h > 1) h = h - 1.0; - - if (h * 6 < 1.0) - return m1 + (m2 - m1) * h * 6.0; - if (h * 2 < 1.0) - return m2; - if (h * 3 < 2.0) - return m1 + (m2 - m1)* (2.0/3.0 - h) * 6.0; - return m1; -} - struct hsl_conv_impl { template diff -Nru mapnik-2.1.0/include/mapnik/css_color_grammar_impl.hpp mapnik-2.2.0/include/mapnik/css_color_grammar_impl.hpp --- mapnik-2.1.0/include/mapnik/css_color_grammar_impl.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/css_color_grammar_impl.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,102 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// NOTE: This is an implementation header file and is only meant to be included +// from implementation files. It therefore doesn't have an include guard. + +// boost +#include + +#if BOOST_VERSION >= 104500 + +#include + +namespace mapnik +{ + +template +css_color_grammar::css_color_grammar() + : css_color_grammar::base_type(css_color) + +{ + using qi::lit; + using qi::_val; + using qi::double_; + using qi::_1; + using qi::_a; + using qi::_b; + using qi::_c; + using ascii::no_case; + using phoenix::at_c; + + css_color %= rgba_color + | rgba_percent_color + | hsl_percent_color + | hex_color + | hex_color_small + | no_case[named]; + + hex_color = lit('#') + >> hex2 [ at_c<0>(_val) = _1 ] + >> hex2 [ at_c<1>(_val) = _1 ] + >> hex2 [ at_c<2>(_val) = _1 ] + >>-hex2 [ at_c<3>(_val) = _1 ] + ; + + hex_color_small = lit('#') + >> hex1 [ at_c<0>(_val) = _1 | _1 << 4 ] + >> hex1 [ at_c<1>(_val) = _1 | _1 << 4 ] + >> hex1 [ at_c<2>(_val) = _1 | _1 << 4 ] + >>-hex1 [ at_c<3>(_val) = _1 | _1 << 4 ] + ; + + rgba_color = lit("rgb") >> -lit('a') + >> lit('(') + >> dec3 [at_c<0>(_val) = _1] >> ',' + >> dec3 [at_c<1>(_val) = _1] >> ',' + >> dec3 [at_c<2>(_val) = _1] + >> -(','>> -double_ [at_c<3>(_val) = alpha_converter(_1)]) + >> lit(')') + ; + + rgba_percent_color = lit("rgb") >> -lit('a') + >> lit('(') + >> double_ [at_c<0>(_val) = percent_converter(_1)] >> '%' >> ',' + >> double_ [at_c<1>(_val) = percent_converter(_1)] >> '%' >> ',' + >> double_ [at_c<2>(_val) = percent_converter(_1)] >> '%' + >> -(','>> -double_ [at_c<3>(_val) = alpha_converter(_1)]) + >> lit(')') + ; + + hsl_percent_color = lit("hsl") >> -lit('a') + >> lit('(') + >> double_ [ _a = _1] >> ',' // hue 0..360 + >> double_ [ _b = _1] >> '%' >> ',' // saturation 0..100% + >> double_ [ _c = _1] >> '%' // lightness 0..100% + >> -(','>> -double_ [at_c<3>(_val) = alpha_converter(_1)]) // opacity 0...1 + >> lit (')') [ hsl_converter(_val,_a,_b,_c)] + ; +} + +} + +#endif diff -Nru mapnik-2.1.0/include/mapnik/ctrans.hpp mapnik-2.2.0/include/mapnik/ctrans.hpp --- mapnik-2.1.0/include/mapnik/ctrans.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/ctrans.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,7 +24,6 @@ #define MAPNIK_CTRANS_HPP // mapnik -#include #include #include #include @@ -38,8 +37,27 @@ template struct MAPNIK_DECL coord_transform { + // SFINAE value_type detector + template + struct void_type + { + typedef void type; + }; + + template + struct select_value_type + { + typedef D type; + }; + + template + struct select_value_type::type> + { + typedef typename T::value_type type; + }; + typedef std::size_t size_type; - //typedef typename Geometry::value_type value_type; + typedef typename select_value_type::type value_type; coord_transform(Transform const& t, Geometry & geom, @@ -81,6 +99,11 @@ geom_.rewind(pos); } + unsigned type() const + { + return static_cast(geom_.type()); + } + Geometry const& geom() const { return geom_; diff -Nru mapnik-2.1.0/include/mapnik/datasource.hpp mapnik-2.2.0/include/mapnik/datasource.hpp --- mapnik-2.1.0/include/mapnik/datasource.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/datasource.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -29,10 +29,11 @@ #include #include #include +#include // boost -#include #include +#include // stl #include @@ -40,20 +41,18 @@ namespace mapnik { -typedef MAPNIK_DECL boost::shared_ptr feature_ptr; - -struct MAPNIK_DECL Featureset : private boost::noncopyable +struct MAPNIK_DECL Featureset : private mapnik::noncopyable { virtual feature_ptr next() = 0; virtual ~Featureset() {} }; -typedef MAPNIK_DECL boost::shared_ptr featureset_ptr; +typedef boost::shared_ptr featureset_ptr; class MAPNIK_DECL datasource_exception : public std::exception { public: - datasource_exception(const std::string& message = std::string("no reason")) + datasource_exception(std::string const& message) : message_(message) { } @@ -70,7 +69,7 @@ std::string message_; }; -class MAPNIK_DECL datasource : private boost::noncopyable +class MAPNIK_DECL datasource : private mapnik::noncopyable { public: enum datasource_t { @@ -86,10 +85,7 @@ }; datasource (parameters const& params) - : params_(params), - is_bound_(false) - { - } + : params_(params) {} /*! * @brief Get the configuration parameters of the data source. @@ -103,30 +99,28 @@ return params_; } + parameters & params() + { + return params_; + } + /*! * @brief Get the type of the datasource * @return The type of the datasource (Vector or Raster) */ virtual datasource_t type() const = 0; - - /*! - * @brief Connect to the datasource - */ - virtual void bind() const {} - - virtual featureset_ptr features(const query& q) const = 0; - virtual featureset_ptr features_at_point(coord2d const& pt) const = 0; + virtual featureset_ptr features(query const& q) const = 0; + virtual featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const = 0; virtual box2d envelope() const = 0; virtual boost::optional get_geometry_type() const = 0; virtual layer_descriptor get_descriptor() const = 0; virtual ~datasource() {} protected: parameters params_; - mutable bool is_bound_; }; typedef const char * datasource_name(); -typedef datasource* create_ds(const parameters& params, bool bind); +typedef datasource* create_ds(parameters const& params); typedef void destroy_ds(datasource *ds); class datasource_deleter @@ -140,19 +134,23 @@ typedef boost::shared_ptr datasource_ptr; -#define DATASOURCE_PLUGIN(classname) \ - extern "C" MAPNIK_EXP const char * datasource_name() \ - { \ - return classname::name(); \ - } \ - extern "C" MAPNIK_EXP datasource* create(const parameters ¶ms, bool bind) \ - { \ - return new classname(params, bind); \ - } \ - extern "C" MAPNIK_EXP void destroy(datasource *ds) \ - { \ - delete ds; \ - } +#ifdef MAPNIK_STATIC_PLUGINS + #define DATASOURCE_PLUGIN(classname) +#else + #define DATASOURCE_PLUGIN(classname) \ + extern "C" MAPNIK_EXP const char * datasource_name() \ + { \ + return classname::name(); \ + } \ + extern "C" MAPNIK_EXP datasource* create(parameters const& params) \ + { \ + return new classname(params); \ + } \ + extern "C" MAPNIK_EXP void destroy(datasource *ds) \ + { \ + delete ds; \ + } +#endif } diff -Nru mapnik-2.1.0/include/mapnik/datasource_cache.hpp mapnik-2.2.0/include/mapnik/datasource_cache.hpp --- mapnik-2.1.0/include/mapnik/datasource_cache.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/datasource_cache.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,37 +26,36 @@ // mapnik #include #include -#include #include +#include // boost -#include #include // stl #include namespace mapnik { -class MAPNIK_DECL datasource_cache : - public singleton , - private boost::noncopyable + +class PluginInfo; + +class MAPNIK_DECL datasource_cache + : public singleton, + private mapnik::noncopyable { friend class CreateStatic; +public: + std::vector plugin_names(); + std::string plugin_directories(); + void register_datasources(std::string const& path); + bool register_datasource(std::string const& path); + boost::shared_ptr create(parameters const& params); private: datasource_cache(); ~datasource_cache(); - datasource_cache(const datasource_cache&); - datasource_cache& operator=(const datasource_cache&); - static std::map > plugins_; - static bool registered_; - static bool insert(const std::string& name,const lt_dlhandle module); - static std::vector plugin_directories_; -public: - static std::vector plugin_names(); - static std::string plugin_directories(); - static void register_datasources(std::string const& path); - static bool register_datasource(std::string const& path); - static boost::shared_ptr create(parameters const& params, bool bind=true); + std::map > plugins_; + bool registered_; + std::vector plugin_directories_; }; } diff -Nru mapnik-2.1.0/include/mapnik/debug.hpp mapnik-2.2.0/include/mapnik/debug.hpp --- mapnik-2.1.0/include/mapnik/debug.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/debug.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,9 +26,9 @@ // mapnik (should not depend on anything that need to use this) #include #include +#include // boost -#include #include #ifdef MAPNIK_THREADSAFE #include @@ -50,7 +50,7 @@ */ class MAPNIK_DECL logger : public singleton, - private boost::noncopyable + private mapnik::noncopyable { public: enum severity_type @@ -79,7 +79,7 @@ } // per object security levels - static severity_type get_object_severity(const std::string& object_name) + static severity_type get_object_severity(std::string const& object_name) { severity_map::iterator it = object_severity_level_.find(object_name); if (object_name.empty() || it == object_severity_level_.end()) @@ -92,7 +92,7 @@ } } - static void set_object_severity(const std::string& object_name, + static void set_object_severity(std::string const& object_name, const severity_type& security_level) { #ifdef MAPNIK_THREADSAFE @@ -119,7 +119,7 @@ return format_; } - static void set_format(const std::string& format) + static void set_format(std::string const& format) { #ifdef MAPNIK_THREADSAFE boost::mutex::scoped_lock lock(format_mutex_); @@ -131,7 +131,7 @@ static std::string str(); // output - static void use_file(const std::string& filepath); + static void use_file(std::string const& filepath); static void use_console(); private: @@ -186,7 +186,7 @@ class Ch = char, class Tr = std::char_traits, class A = std::allocator > - class base_log : public boost::noncopyable + class base_log : public mapnik::noncopyable { public: typedef OutputPolicy output_policy; @@ -245,7 +245,7 @@ class Ch = char, class Tr = std::char_traits, class A = std::allocator > - class base_log_always : public boost::noncopyable + class base_log_always : public mapnik::noncopyable { public: typedef OutputPolicy output_policy; diff -Nru mapnik-2.1.0/include/mapnik/debug_symbolizer.hpp mapnik-2.2.0/include/mapnik/debug_symbolizer.hpp --- mapnik-2.1.0/include/mapnik/debug_symbolizer.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/debug_symbolizer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,56 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_DEBUG_SYMBOLIZER_HPP +#define MAPNIK_DEBUG_SYMBOLIZER_HPP + +#include +#include +#include + +namespace mapnik +{ + +enum debug_symbolizer_mode_enum { + DEBUG_SYM_MODE_COLLISION, + DEBUG_SYM_MODE_VERTEX, + debug_symbolizer_mode_enum_MAX +}; + +DEFINE_ENUM( debug_symbolizer_mode_e, debug_symbolizer_mode_enum ); + +struct MAPNIK_DECL debug_symbolizer : + public symbolizer_base +{ + debug_symbolizer(); + debug_symbolizer(debug_symbolizer const& rhs); + debug_symbolizer_mode_e get_mode() const; + void set_mode(debug_symbolizer_mode_e mode); + +private: + debug_symbolizer_mode_e mode_; + +}; + +} + +#endif // DEBUG_SYMBOLIZER_HPP diff -Nru mapnik-2.1.0/include/mapnik/enumeration.hpp mapnik-2.2.0/include/mapnik/enumeration.hpp --- mapnik-2.1.0/include/mapnik/enumeration.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/enumeration.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,7 +25,6 @@ // mapnik #include -#include // stl #include @@ -45,7 +44,7 @@ what_( what ) { } - virtual ~illegal_enum_value() throw() {}; + virtual ~illegal_enum_value() throw() {} virtual const char * what() const throw() { @@ -136,19 +135,19 @@ * @endcode */ -template +template class MAPNIK_DECL enumeration { public: typedef ENUM native_type; enumeration() - : value_() {} + : value_() {} enumeration( ENUM v ) - : value_(v) {} + : value_(v) {} - enumeration( const enumeration & other ) - : value_(other.value_) {} + enumeration( enumeration const& other ) + : value_(other.value_) {} /** Assignment operator for native enum values. */ void operator=(ENUM v) @@ -157,7 +156,7 @@ } /** Assignment operator. */ - void operator=(const enumeration & other) + void operator=(enumeration const& other) { value_ = other.value_; } @@ -173,11 +172,6 @@ MAX = THE_MAX }; - ENUM max() const - { - return THE_MAX; - } - /** Converts @p str to an enum. * @throw illegal_enum_value @p str is not a legal identifier. * */ @@ -226,7 +220,7 @@ { from_string( word ); } - catch (const illegal_enum_value &) + catch (illegal_enum_value const&) { is.setstate(std::ios::failbit); } @@ -261,21 +255,17 @@ { if (our_strings_[i] == 0 ) { - MAPNIK_LOG_ERROR(enumeration) - << "### FATAL: Not enough strings for enum " - << our_name_ << " defined in file '" << filename - << "' at line " << line_no; - //std::exit(1); + std::cerr << "### FATAL: Not enough strings for enum " + << our_name_ << " defined in file '" << filename + << "' at line " << line_no; } } if ( std::string("") != our_strings_[THE_MAX]) { - MAPNIK_LOG_ERROR(enumeration) - << "### FATAL: The string array for enum " << our_name_ - << " defined in file '" << filename << "' at line " << line_no - << " has too many items or is not terminated with an " - << "empty string"; - //std::exit(1); + std::cerr << "### FATAL: The string array for enum " << our_name_ + << " defined in file '" << filename << "' at line " << line_no + << " has too many items or is not terminated with an " + << "empty string"; } return true; } @@ -330,8 +320,14 @@ /** Helper macro. Creates a typedef. * @relates mapnik::enumeration */ +#ifdef _MSC_VER +#define DEFINE_ENUM( name, e) \ + template enumeration; \ + typedef enumeration name +#else #define DEFINE_ENUM( name, e) \ typedef enumeration name +#endif /** Helper macro. Runs the verify_mapnik_enum() method during static initialization. * @relates mapnik::enumeration diff -Nru mapnik-2.1.0/include/mapnik/expression.hpp mapnik-2.2.0/include/mapnik/expression.hpp --- mapnik-2.1.0/include/mapnik/expression.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/expression.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,29 +25,26 @@ // mapnik #include -#include +#include + +// boost +#include // stl #include +#include namespace mapnik { -typedef boost::shared_ptr expression_ptr; +// fwd declare to reduce compile time template struct expression_grammar; +typedef boost::shared_ptr expression_ptr; +typedef std::set expression_set; -class expression_factory -{ -public: - static expression_ptr compile(std::string const& str,transcoder const& tr); - static bool parse_from_string(expression_ptr const& expr, - std::string const& str, - mapnik::expression_grammar const& g); -}; - -MAPNIK_DECL expression_ptr parse_expression (std::string const& wkt, std::string const& encoding); -MAPNIK_DECL expression_ptr parse_expression (std::string const& wkt); +MAPNIK_DECL expression_ptr parse_expression (std::string const& wkt, std::string const& encoding = "UTF8"); +MAPNIK_DECL expression_ptr parse_expression (std::string const& wkt, mapnik::expression_grammar const& g); } #endif // MAPNIK_EXPRESSION_HPP diff -Nru mapnik-2.1.0/include/mapnik/expression_evaluator.hpp mapnik-2.2.0/include/mapnik/expression_evaluator.hpp --- mapnik-2.1.0/include/mapnik/expression_evaluator.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/expression_evaluator.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,7 +23,14 @@ #ifndef MAPNIK_EXPRESSION_EVALUATOR_HPP #define MAPNIK_EXPRESSION_EVALUATOR_HPP +// mapnik +#include +#include +#include + // boost +#include +#include #include #if defined(BOOST_REGEX_HAS_ICU) #include @@ -50,9 +57,9 @@ return attr.value(feature_); } - value_type operator() (geometry_type_attribute const& attr) const + value_type operator() (geometry_type_attribute const& geom) const { - return attr.value(feature_); + return geom.value(feature_); } value_type operator() (binary_node const & x) const diff -Nru mapnik-2.1.0/include/mapnik/expression_grammar.hpp mapnik-2.2.0/include/mapnik/expression_grammar.hpp --- mapnik-2.1.0/include/mapnik/expression_grammar.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/expression_grammar.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,28 +24,17 @@ #define MAPNIK_EXPRESSIONS_GRAMMAR_HPP // mapnik -#include +#include +#include +#include #include -// boost -#include -#include -#include - // spirit2 #include -#include - -// fusion -#include +#include // phoenix -#include -#include -#include #include -#include -#include namespace mapnik { @@ -108,7 +97,7 @@ mapnik::transcoder const& tr_; }; -struct geometry_types : qi::symbols +struct geometry_types : qi::symbols { geometry_types() { @@ -121,6 +110,12 @@ } }; +template +struct integer_parser +{ + typedef qi::int_parser type; +}; + template struct expression_grammar : qi::grammar { @@ -129,6 +124,7 @@ explicit expression_grammar(mapnik::transcoder const& tr); qi::real_parser > strict_double; + typename integer_parser::type int__; boost::phoenix::function unicode_; boost::phoenix::function regex_match_; boost::phoenix::function regex_replace_; diff -Nru mapnik-2.1.0/include/mapnik/expression_grammar_impl.hpp mapnik-2.2.0/include/mapnik/expression_grammar_impl.hpp --- mapnik-2.1.0/include/mapnik/expression_grammar_impl.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/expression_grammar_impl.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,191 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2012 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// NOTE: This is an implementation header file and is only meant to be included +// from implementation files. It therefore doesn't have an include guard. + +// mapnik +#include +#include +#include +#include + +// boost +#include +#include +#include +#include + +// fwd declare +namespace mapnik { + struct attribute; + struct geometry_type_attribute; +} + +namespace mapnik +{ + +template +expr_node regex_match_impl::operator() (T0 & node, T1 const& pattern) const +{ +#if defined(BOOST_REGEX_HAS_ICU) + return regex_match_node(node,tr_.transcode(pattern.c_str())); +#else + return regex_match_node(node,pattern); +#endif +} + +template +expr_node regex_replace_impl::operator() (T0 & node, T1 const& pattern, T2 const& format) const +{ +#if defined(BOOST_REGEX_HAS_ICU) + return regex_replace_node(node,tr_.transcode(pattern.c_str()),tr_.transcode(format.c_str())); +#else + return regex_replace_node(node,pattern,format); +#endif +} + +template +expression_grammar::expression_grammar(mapnik::transcoder const& tr) + : expression_grammar::base_type(expr), + unicode_(unicode_impl(tr)), + regex_match_(regex_match_impl(tr)), + regex_replace_(regex_replace_impl(tr)) +{ + using boost::phoenix::construct; + using qi::_1; + using qi::_a; + using qi::_b; + using qi::_r1; +#if BOOST_VERSION > 104200 + using qi::no_skip; +#endif + using qi::lexeme; + using qi::_val; + using qi::lit; + using qi::double_; + using qi::hex; + using qi::omit; + using standard_wide::char_; + using standard_wide::no_case; + + expr = logical_expr.alias(); + + logical_expr = not_expr [_val = _1] + >> + *( ( ( lit("and") | lit("&&")) >> not_expr [_val && _1] ) + | (( lit("or") | lit("||")) >> not_expr [_val || _1]) + ) + ; + + not_expr = + cond_expr [_val = _1 ] + | ((lit("not") | lit('!')) >> cond_expr [ _val = !_1 ]) + ; + + cond_expr = equality_expr [_val = _1] | additive_expr [_val = _1] + ; + + equality_expr = + relational_expr [_val = _1] + >> *( ( (lit("=") | lit("eq") | lit("is")) >> relational_expr [_val == _1]) + | (( lit("!=") | lit("<>") | lit("neq") ) >> relational_expr [_val != _1]) + ) + ; + + regex_match_expr = lit(".match") + >> lit('(') + >> ustring [_val = _1] + >> lit(')') + ; + + regex_replace_expr = + lit(".replace") + >> lit('(') + >> ustring [_a = _1] + >> lit(',') + >> ustring [_b = _1] + >> lit(')') [_val = regex_replace_(_r1,_a,_b)] + ; + + relational_expr = additive_expr[_val = _1] + >> + *( ( (lit("<=") | lit("le") ) >> additive_expr [ _val <= _1 ]) + | ( (lit('<') | lit("lt") ) >> additive_expr [ _val < _1 ]) + | ( (lit(">=") | lit("ge") ) >> additive_expr [ _val >= _1 ]) + | ( (lit('>') | lit("gt") ) >> additive_expr [ _val > _1 ]) + ) + ; + + additive_expr = multiplicative_expr [_val = _1] + >> * ( '+' >> multiplicative_expr[_val += _1] + | '-' >> multiplicative_expr[_val -= _1] + ) + ; + + multiplicative_expr = unary_expr [_val = _1] + >> *( '*' >> unary_expr [_val *= _1] + | '/' >> unary_expr [_val /= _1] + | '%' >> unary_expr [_val %= _1] + | regex_match_expr[_val = regex_match_(_val, _1)] + | regex_replace_expr(_val) [_val = _1] + ) + ; + + unary_expr = primary_expr [_val = _1] + | '+' >> primary_expr [_val = _1] + | '-' >> primary_expr [_val = -_1] + ; + + primary_expr = strict_double [_val = _1] + | int__[_val = _1] + | no_case[lit("true")] [_val = true] + | no_case[lit("false")] [_val = false] + | no_case[lit("null")] [_val = value_null() ] + | no_case[geom_type][_val = _1 ] + | ustring [_val = unicode_(_1) ] + | lit("[mapnik::geometry_type]")[_val = construct()] + | attr [_val = construct( _1 ) ] + | '(' >> expr [_val = _1 ] >> ')' + ; + + unesc_char.add("\\a", '\a')("\\b", '\b')("\\f", '\f')("\\n", '\n') + ("\\r", '\r')("\\t", '\t')("\\v", '\v')("\\\\", '\\') + ("\\\'", '\'')("\\\"", '\"') + ; + +#if BOOST_VERSION > 104500 + quote_char %= char_('\'') | char_('"'); + ustring %= omit[quote_char[_a = _1]] + >> *(unesc_char | "\\x" >> hex | (char_ - lit(_a))) + >> lit(_a); + attr %= '[' >> no_skip[+~char_(']')] >> ']'; +#else + ustring %= lit('\'') + >> *(unesc_char | "\\x" >> hex | (char_ - lit('\''))) + >> lit('\''); + attr %= '[' >> lexeme[+(char_ - ']')] >> ']'; +#endif + +} + +} diff -Nru mapnik-2.1.0/include/mapnik/expression_node.hpp mapnik-2.2.0/include/mapnik/expression_node.hpp --- mapnik-2.1.0/include/mapnik/expression_node.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/expression_node.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,174 +26,18 @@ // mapnik #include #include +#include // boost #include #if defined(BOOST_REGEX_HAS_ICU) #include #endif -#include -#include #include namespace mapnik { -namespace tags { -struct negate -{ - static const char* str() - { - return "-"; - } -}; - -struct plus -{ - static const char* str() - { - return "+"; - } -}; - -struct minus -{ - static const char* str() - { - return "-"; - } -}; - -struct mult -{ - static const char* str() - { - return "*"; - } -}; - -struct div -{ - static const char* str() - { - return "/"; - } -}; - - -struct mod -{ - static const char* str() - { - return "%"; - } -}; - -struct less -{ - static const char* str() - { - return "<"; - } -}; - -struct less_equal -{ - static const char* str() - { - return "<="; - } -}; - -struct greater -{ - static const char* str() - { - return ">"; - } -}; - -struct greater_equal -{ - static const char* str() - { - return ">="; - } -}; - -struct equal_to -{ - static const char* str() - { - return "="; - } -}; - -struct not_equal_to -{ - static const char* str() - { - return "!="; - } -}; - -struct logical_not -{ - static const char* str() - { - return "not "; - } -}; - -struct logical_and -{ - static const char* str() - { - return " and "; - } -}; - -struct logical_or -{ - static const char* str() - { - return " or "; - } -}; - -} // end operation tags - - -template struct binary_node; -template struct unary_node; -struct regex_match_node; -struct regex_replace_node; - -typedef mapnik::value value_type; - -typedef boost::variant < -value_type, -attribute, -geometry_type_attribute, -boost::recursive_wrapper >, -boost::recursive_wrapper >, -boost::recursive_wrapper >, -boost::recursive_wrapper >, -boost::recursive_wrapper >, -boost::recursive_wrapper >, -boost::recursive_wrapper >, -boost::recursive_wrapper >, -boost::recursive_wrapper >, -boost::recursive_wrapper >, -boost::recursive_wrapper >, -boost::recursive_wrapper >, -boost::recursive_wrapper >, -boost::recursive_wrapper >, -boost::recursive_wrapper >, -boost::recursive_wrapper, -boost::recursive_wrapper -> expr_node; - template struct make_op; template <> struct make_op { typedef std::negate type;}; template <> struct make_op { typedef std::plus type;}; diff -Nru mapnik-2.1.0/include/mapnik/expression_node_types.hpp mapnik-2.2.0/include/mapnik/expression_node_types.hpp --- mapnik-2.1.0/include/mapnik/expression_node_types.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/expression_node_types.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,203 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_EXPRESSION_NODE_TYPES_HPP +#define MAPNIK_EXPRESSION_NODE_TYPES_HPP + +// mapnik +//#include +//#include + +// boost +#include + +namespace boost { template class recursive_wrapper; } + +namespace mapnik +{ + +struct attribute; +struct geometry_type_attribute; +namespace value_adl_barrier { + class value; +} +using value_adl_barrier::value; + +namespace tags { +struct negate +{ + static const char* str() + { + return "-"; + } +}; + +struct plus +{ + static const char* str() + { + return "+"; + } +}; + +struct minus +{ + static const char* str() + { + return "-"; + } +}; + +struct mult +{ + static const char* str() + { + return "*"; + } +}; + +struct div +{ + static const char* str() + { + return "/"; + } +}; + + +struct mod +{ + static const char* str() + { + return "%"; + } +}; + +struct less +{ + static const char* str() + { + return "<"; + } +}; + +struct less_equal +{ + static const char* str() + { + return "<="; + } +}; + +struct greater +{ + static const char* str() + { + return ">"; + } +}; + +struct greater_equal +{ + static const char* str() + { + return ">="; + } +}; + +struct equal_to +{ + static const char* str() + { + return "="; + } +}; + +struct not_equal_to +{ + static const char* str() + { + return "!="; + } +}; + +struct logical_not +{ + static const char* str() + { + return "not "; + } +}; + +struct logical_and +{ + static const char* str() + { + return " and "; + } +}; + +struct logical_or +{ + static const char* str() + { + return " or "; + } +}; + +} // end operation tags + + +template struct binary_node; +template struct unary_node; +struct regex_match_node; +struct regex_replace_node; + +typedef mapnik::value value_type; + +typedef boost::variant < +value_type, +attribute, +geometry_type_attribute, +boost::recursive_wrapper >, +boost::recursive_wrapper >, +boost::recursive_wrapper >, +boost::recursive_wrapper >, +boost::recursive_wrapper >, +boost::recursive_wrapper >, +boost::recursive_wrapper >, +boost::recursive_wrapper >, +boost::recursive_wrapper >, +boost::recursive_wrapper >, +boost::recursive_wrapper >, +boost::recursive_wrapper >, +boost::recursive_wrapper >, +boost::recursive_wrapper >, +boost::recursive_wrapper >, +boost::recursive_wrapper, +boost::recursive_wrapper +> expr_node; + +} + + +#endif //MAPNIK_EXPRESSION_NODE_HPP diff -Nru mapnik-2.1.0/include/mapnik/expression_string.hpp mapnik-2.2.0/include/mapnik/expression_string.hpp --- mapnik-2.1.0/include/mapnik/expression_string.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/expression_string.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,10 +25,14 @@ // mapnik #include -#include +#include + +// boost +#include // stl #include +#include namespace mapnik { diff -Nru mapnik-2.1.0/include/mapnik/factory.hpp mapnik-2.2.0/include/mapnik/factory.hpp --- mapnik-2.1.0/include/mapnik/factory.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/factory.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -40,7 +40,7 @@ { const char* what() const throw() { - return "uknown object type"; + return "unknown object type"; } }; static product_type* on_unknown_type(const key_type&) @@ -76,14 +76,24 @@ return map_.erase(key)==1; } - product_type* create_object(const key_type& key,const std::string& file) + product_type* create_object(const key_type& key,std::string const& file) { typename product_map::const_iterator pos=map_.find(key); if (pos!=map_.end()) { return (pos->second)(file); } - return factory_error_policy::on_unknown_type(key); + return 0; + } + + product_type* create_object(const key_type& key, char const* data, std::size_t size) + { + typename product_map::const_iterator pos=map_.find(key); + if (pos!=map_.end()) + { + return (pos->second)(data, size); + } + return 0; } }; } diff -Nru mapnik-2.1.0/include/mapnik/feature.hpp mapnik-2.2.0/include/mapnik/feature.hpp --- mapnik-2.1.0/include/mapnik/feature.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/feature.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,41 +25,38 @@ // mapnik #include +#include #include +#include #include -#include #include +#include + // boost -#include -#if BOOST_VERSION >= 104000 -#include -#else -#include -#endif -#include #include -#include +#include // stl #include #include -#include +#include // for basic_ostream, operator<<, etc +#include // for basic_stringstream +#include // for out_of_range namespace mapnik { -typedef boost::shared_ptr raster_ptr; - +class raster; class feature_impl; +typedef boost::shared_ptr raster_ptr; + template -class context : private boost::noncopyable, - public boost::associative_property_map +class context : private mapnik::noncopyable { friend class feature_impl; public: typedef T map_type; - typedef typename boost::associative_property_map base_type; typedef typename map_type::value_type value_type; typedef typename map_type::key_type key_type; typedef typename map_type::size_type size_type; @@ -68,7 +65,7 @@ typedef typename map_type::const_iterator const_iterator; context() - : base_type(mapping_) {} + : mapping_() {} size_type push(key_type const& name) { @@ -90,10 +87,12 @@ map_type mapping_; }; -typedef MAPNIK_DECL context > context_type; -typedef MAPNIK_DECL boost::shared_ptr context_ptr; +typedef context > context_type; +typedef boost::shared_ptr context_ptr; + +static const value default_value; -class MAPNIK_DECL feature_impl : private boost::noncopyable +class MAPNIK_DECL feature_impl : private mapnik::noncopyable { friend class feature_kv_iterator; public: @@ -102,7 +101,7 @@ typedef std::vector cont_type; typedef feature_kv_iterator iterator; - feature_impl(context_ptr const& ctx, int id) + feature_impl(context_ptr const& ctx, mapnik::value_integer id) : id_(id), ctx_(ctx), data_(ctx_->mapping_.size()), @@ -110,9 +109,9 @@ raster_() {} - inline int id() const { return id_;} + inline mapnik::value_integer id() const { return id_;} - inline void set_id(int id) { id_ = id;} + inline void set_id(mapnik::value_integer id) { id_ = id;} template void put(context_type::key_type const& key, T const& val) @@ -126,7 +125,6 @@ put_new(key,value(val)); } - void put(context_type::key_type const& key, value const& val) { context_type::map_type::const_iterator itr = ctx_->mapping_.find(key); @@ -141,7 +139,6 @@ } } - void put_new(context_type::key_type const& key, value const& val) { context_type::map_type::const_iterator itr = ctx_->mapping_.find(key); @@ -158,7 +155,6 @@ } } - bool has_key(context_type::key_type const& key) const { return (ctx_->mapping_.find(key) != ctx_->mapping_.end()); @@ -170,21 +166,14 @@ if (itr != ctx_->mapping_.end()) return get(itr->second); else - throw std::out_of_range(std::string("Key does not exist: '") + key + "'"); + return default_value; } value_type const& get(std::size_t index) const { if (index < data_.size()) return data_[index]; - throw std::out_of_range("Index out of range"); - } - - boost::optional get_optional(std::size_t index) const - { - if (index < data_.size()) - return boost::optional(data_[index]); - return boost::optional(); + return default_value; } std::size_t size() const @@ -246,7 +235,7 @@ geometry_type const& geom = get_geometry(i); if (i==0) { - box2d const& box = geom.envelope(); + box2d box = geom.envelope(); result.init(box.minx(),box.miny(),box.maxx(),box.maxy()); } else @@ -257,7 +246,7 @@ return result; } - const raster_ptr& get_raster() const + raster_ptr const& get_raster() const { return raster_; } @@ -288,7 +277,14 @@ std::size_t index = itr->second; if (index < data_.size()) { - ss << " " << itr->first << ":" << data_[itr->second] << std::endl; + if (data_[itr->second] == mapnik::value_null()) + { + ss << " " << itr->first << ":null" << std::endl; + } + else + { + ss << " " << itr->first << ":" << data_[itr->second] << std::endl; + } } } ss << ")" << std::endl; @@ -296,7 +292,7 @@ } private: - int id_; + mapnik::value_integer id_; context_ptr ctx_; cont_type data_; boost::ptr_vector geom_cont_; @@ -310,8 +306,11 @@ return out; } +// TODO - remove at Mapnik 3.x typedef feature_impl Feature; +typedef boost::shared_ptr feature_ptr; + } #endif // MAPNIK_FEATURE_HPP diff -Nru mapnik-2.1.0/include/mapnik/feature_factory.hpp mapnik-2.2.0/include/mapnik/feature_factory.hpp --- mapnik-2.1.0/include/mapnik/feature_factory.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/feature_factory.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,6 +25,7 @@ // mapnik #include +#include // boost #include @@ -34,11 +35,11 @@ { struct feature_factory { - static boost::shared_ptr create (context_ptr const& ctx, int fid) + static boost::shared_ptr create (context_ptr const& ctx, mapnik::value_integer fid) { - //return boost::allocate_shared(boost::pool_allocator(),fid); - //return boost::allocate_shared(boost::fast_pool_allocator(),fid); - return boost::make_shared(ctx,fid); + //return boost::allocate_shared(boost::pool_allocator(),fid); + //return boost::allocate_shared(boost::fast_pool_allocator(),fid); + return boost::make_shared(ctx,fid); } }; } diff -Nru mapnik-2.1.0/include/mapnik/feature_kv_iterator.hpp mapnik-2.2.0/include/mapnik/feature_kv_iterator.hpp --- mapnik-2.1.0/include/mapnik/feature_kv_iterator.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/feature_kv_iterator.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,12 +26,14 @@ // mapnik #include #include + // boost +#include #include #include #include #include -#include + // stl #include diff -Nru mapnik-2.1.0/include/mapnik/feature_style_processor.hpp mapnik-2.2.0/include/mapnik/feature_style_processor.hpp --- mapnik-2.1.0/include/mapnik/feature_style_processor.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/feature_style_processor.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,8 +24,8 @@ #define MAPNIK_FEATURE_STYLE_PROCESSOR_HPP // mapnik -#include -#include +#include // for featureset_ptr +#include // stl #include @@ -39,43 +39,59 @@ class layer; class projection; class proj_transform; +class feature_type_style; +class rule_cache; + +enum eAttributeCollectionPolicy +{ + DEFAULT = 0, + COLLECT_ALL = 1 +}; template -class feature_style_processor +class MAPNIK_DECL feature_style_processor { struct symbol_dispatch; public: - explicit feature_style_processor(Map const& m, double scale_factor = 1.0); + explicit feature_style_processor(Map const& m, + double scale_factor = 1.0); /*! - * @return apply renderer to all map layers. + * \brief apply renderer to all map layers. */ - void apply(); + void apply(double scale_denom_override=0.0); /*! - * @return apply renderer to a single layer, providing pre-populated set of query attribute names. + * \brief apply renderer to a single layer, providing pre-populated set of query attribute names. */ - void apply(mapnik::layer const& lyr, std::set& names); -private: + void apply(mapnik::layer const& lyr, + std::set& names, + double scale_denom_override=0.0); /*! - * @return render a layer given a projection and scale. + * \brief render a layer given a projection and scale. */ void apply_to_layer(layer const& lay, Processor & p, projection const& proj0, + double scale, double scale_denom, + unsigned width, + unsigned height, + box2d const& extent, + int buffer_size, std::set& names); +private: /*! - * @return renders a featureset with the given styles. + * \brief renders a featureset with the given styles. */ void render_style(layer const& lay, Processor & p, - feature_type_style* style, + feature_type_style const* style, + rule_cache const& rules, std::string const& style_name, featureset_ptr features, - proj_transform const& prj_trans, - double scale_denom); + proj_transform const& prj_trans); Map const& m_; double scale_factor_; diff -Nru mapnik-2.1.0/include/mapnik/feature_style_processor_impl.hpp mapnik-2.2.0/include/mapnik/feature_style_processor_impl.hpp --- mapnik-2.1.0/include/mapnik/feature_style_processor_impl.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/feature_style_processor_impl.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,699 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// NOTE: This is an implementation header file and is only meant to be included +// from implementation files. It therefore doesn't have an include guard. To +// create a custom feature_style_processor, include this file and instantiate +// the template with the desired template arguments. + +// mapnik +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// boost +#include +#include +#include +#include + +// stl +#include +#include + +#if defined(RENDERING_STATS) +#include +#include +#include +#endif + +namespace mapnik +{ + +template struct has_process; + +template +struct process_impl +{ + template + static void process(T0 & ren, T1 const& sym, T2 & f, T3 const& tr) + { + ren.process(sym,f,tr); + } +}; + +template <> // No-op specialization +struct process_impl +{ + template + static void process(T0 & ren, T1 const& sym, T2 & f, T3 const& tr) + { + boost::ignore_unused_variable_warning(ren); + boost::ignore_unused_variable_warning(f); + boost::ignore_unused_variable_warning(tr); +#ifdef MAPNIK_DEBUG + std::clog << "NO-OP ...\n"; +#endif + } +}; + +/** Calls the renderer's process function, + * \param output Renderer + * \param f Feature to process + * \param prj_trans Projection + * \param sym Symbolizer object + */ +template +struct feature_style_processor::symbol_dispatch : public boost::static_visitor<> +{ + symbol_dispatch (Processor & output, + mapnik::feature_impl & f, + proj_transform const& prj_trans) + : output_(output), + f_(f), + prj_trans_(prj_trans) {} + + template + void operator () (T const& sym) const + { + process_impl::value>::process(output_,sym,f_,prj_trans_); + } + + Processor & output_; + mapnik::feature_impl & f_; + proj_transform const& prj_trans_; +}; + +typedef char (&no_tag)[1]; +typedef char (&yes_tag)[2]; + +template +struct process_memfun_helper {}; + +template no_tag has_process_helper(...); +template yes_tag has_process_helper(process_memfun_helper* p); + +template +struct has_process +{ + typedef typename T0::processor_impl_type processor_impl_type; + BOOST_STATIC_CONSTANT(bool + , value = sizeof(has_process_helper(0)) == sizeof(yes_tag) + ); +}; + +template +feature_style_processor::feature_style_processor(Map const& m, double scale_factor) + : m_(m), + scale_factor_(scale_factor) +{ + // https://github.com/mapnik/mapnik/issues/1100 + if (scale_factor_ <= 0) + { + throw std::runtime_error("scale_factor must be greater than 0.0"); + } +} + +template +void feature_style_processor::apply(double scale_denom) +{ +#if defined(RENDERING_STATS) + std::clog << "\n//-- starting rendering timer...\n"; + mapnik::progress_timer t(std::clog, "total map rendering"); +#endif + + Processor & p = static_cast(*this); + p.start_map_processing(m_); + + projection proj(m_.srs(),true); + if (scale_denom <= 0.0) + scale_denom = mapnik::scale_denominator(m_.scale(),proj.is_geographic()); + scale_denom *= scale_factor_; + + BOOST_FOREACH ( layer const& lyr, m_.layers() ) + { + if (lyr.visible(scale_denom)) + { + std::set names; + apply_to_layer(lyr, + p, + proj, + m_.scale(), + scale_denom, + m_.width(), + m_.height(), + m_.get_current_extent(), + m_.buffer_size(), + names); + + } + } + + p.end_map_processing(m_); + +#if defined(RENDERING_STATS) + t.stop(); + std::clog << "//-- rendering timer stopped...\n\n"; +#endif + +} + +template +void feature_style_processor::apply(mapnik::layer const& lyr, + std::set& names, + double scale_denom) +{ + Processor & p = static_cast(*this); + p.start_map_processing(m_); + projection proj(m_.srs(),true); + if (scale_denom <= 0.0) + scale_denom = mapnik::scale_denominator(m_.scale(),proj.is_geographic()); + scale_denom *= scale_factor_; + + if (lyr.visible(scale_denom)) + { + apply_to_layer(lyr, + p, + proj, + m_.scale(), + scale_denom, + m_.width(), + m_.height(), + m_.get_current_extent(), + m_.buffer_size(), + names); + } + p.end_map_processing(m_); +} + +template +void feature_style_processor::apply_to_layer(layer const& lay, Processor & p, + projection const& proj0, + double scale, + double scale_denom, + unsigned width, + unsigned height, + box2d const& extent, + int buffer_size, + std::set& names) +{ + std::vector const& style_names = lay.styles(); + + unsigned int num_styles = style_names.size(); + if (! num_styles) + { + MAPNIK_LOG_DEBUG(feature_style_processor) << "feature_style_processor: No style for layer=" << lay.name(); + + return; + } + + mapnik::datasource_ptr ds = lay.datasource(); + if (! ds) + { + MAPNIK_LOG_DEBUG(feature_style_processor) << "feature_style_processor: No datasource for layer=" << lay.name(); + + return; + } + +#if defined(RENDERING_STATS) + progress_timer layer_timer(std::clog, "rendering total for layer: '" + lay.name() + "'"); +#endif + + projection proj1(lay.srs(),true); + proj_transform prj_trans(proj0,proj1); + +#if defined(RENDERING_STATS) + if (! prj_trans.equal()) + { + std::clog << "notice: reprojecting layer: '" << lay.name() << "' from/to:\n\t'" + << lay.srs() << "'\n\t'" + << m_.srs() << "'\n"; + } +#endif + + + box2d query_ext = extent; // unbuffered + box2d buffered_query_ext(query_ext); // buffered + + double buffer_padding = 2.0 * scale; + boost::optional layer_buffer_size = lay.buffer_size(); + if (layer_buffer_size) // if layer overrides buffer size, use this value to compute buffered extent + { + buffer_padding *= *layer_buffer_size; + } + else + { + buffer_padding *= buffer_size; + } + buffered_query_ext.width(query_ext.width() + buffer_padding); + buffered_query_ext.height(query_ext.height() + buffer_padding); + + // clip buffered extent by maximum extent, if supplied + boost::optional > const& maximum_extent = m_.maximum_extent(); + if (maximum_extent) { + buffered_query_ext.clip(*maximum_extent); + } + + box2d layer_ext = lay.envelope(); + bool fw_success = false; + bool early_return = false; + + // first, try intersection of map extent forward projected into layer srs + if (prj_trans.forward(buffered_query_ext, PROJ_ENVELOPE_POINTS) && buffered_query_ext.intersects(layer_ext)) + { + fw_success = true; + layer_ext.clip(buffered_query_ext); + } + // if no intersection and projections are also equal, early return + else if (prj_trans.equal()) + { + early_return = true; + } + // next try intersection of layer extent back projected into map srs + else if (prj_trans.backward(layer_ext, PROJ_ENVELOPE_POINTS) && buffered_query_ext.intersects(layer_ext)) + { + layer_ext.clip(buffered_query_ext); + // forward project layer extent back into native projection + if (! prj_trans.forward(layer_ext, PROJ_ENVELOPE_POINTS)) + { + MAPNIK_LOG_ERROR(feature_style_processor) + << "feature_style_processor: Layer=" << lay.name() + << " extent=" << layer_ext << " in map projection " + << " did not reproject properly back to layer projection"; + } + } + else + { + // if no intersection then nothing to do for layer + early_return = true; + } + + if (early_return) + { + // check for styles needing compositing operations applied + // https://github.com/mapnik/mapnik/issues/1477 + BOOST_FOREACH(std::string const& style_name, style_names) + { + boost::optional style=m_.find_style(style_name); + if (!style) + { + continue; + } + if (style->comp_op() || style->image_filters().size() > 0) + { + if (style->active(scale_denom)) + { + // trigger any needed compositing ops + p.start_style_processing(*style); + p.end_style_processing(*style); + } + } + } +#if defined(RENDERING_STATS) + layer_timer.discard(); +#endif + return; + } + + // if we've got this far, now prepare the unbuffered extent + // which is used as a bbox for clipping geometries + if (maximum_extent) + { + query_ext.clip(*maximum_extent); + } + + box2d layer_ext2 = lay.envelope(); + if (fw_success) + { + if (prj_trans.forward(query_ext, PROJ_ENVELOPE_POINTS)) + { + layer_ext2.clip(query_ext); + } + } + else + { + if (prj_trans.backward(layer_ext2, PROJ_ENVELOPE_POINTS)) + { + layer_ext2.clip(query_ext); + prj_trans.forward(layer_ext2, PROJ_ENVELOPE_POINTS); + } + } + + p.start_layer_processing(lay, layer_ext2); + + double qw = query_ext.width()>0 ? query_ext.width() : 1; + double qh = query_ext.height()>0 ? query_ext.height() : 1; + query::resolution_type res(width/qw, + height/qh); + + query q(layer_ext,res,scale_denom,extent); + std::vector active_styles; + attribute_collector collector(names); + double filt_factor = 1.0; + directive_collector d_collector(filt_factor); + boost::ptr_vector rule_caches; + + // iterate through all named styles collecting active styles and attribute names + BOOST_FOREACH(std::string const& style_name, style_names) + { + boost::optional style=m_.find_style(style_name); + if (!style) + { + MAPNIK_LOG_DEBUG(feature_style_processor) + << "feature_style_processor: Style=" << style_name + << " required for layer=" << lay.name() << " does not exist."; + + continue; + } + + std::vector const& rules = style->get_rules(); + bool active_rules = false; + std::auto_ptr rc(new rule_cache); + BOOST_FOREACH(rule const& r, rules) + { + if (r.active(scale_denom)) + { + rc->add_rule(r); + active_rules = true; + if (ds->type() == datasource::Vector) + { + collector(r); + } + // TODO - in the future rasters should be able to be filtered. + } + } + if (active_rules) + { + rule_caches.push_back(rc); + active_styles.push_back(&(*style)); + } + } + + // Don't even try to do more work if there are no active styles. + if (active_styles.size() > 0) + { + if (p.attribute_collection_policy() == COLLECT_ALL) + { + layer_descriptor lay_desc = ds->get_descriptor(); + BOOST_FOREACH(attribute_descriptor const& desc, lay_desc.get_descriptors()) + { + q.add_property_name(desc.get_name()); + } + } + else + { + BOOST_FOREACH(std::string const& name, names) + { + q.add_property_name(name); + } + } + + // Update filter_factor for all enabled raster layers. + BOOST_FOREACH (feature_type_style const* style, active_styles) + { + BOOST_FOREACH(rule const& r, style->get_rules()) + { + if (r.active(scale_denom) && + ds->type() == datasource::Raster && + ds->params().get("filter_factor",0.0) == 0.0) + { + BOOST_FOREACH (rule::symbolizers::value_type sym, r.get_symbolizers()) + { + // if multiple raster symbolizers, last will be respected + // should we warn or throw? + boost::apply_visitor(d_collector,sym); + } + q.set_filter_factor(filt_factor); + } + } + } + + // Also query the group by attribute + std::string group_by = lay.group_by(); + if (group_by != "") + { + q.add_property_name(group_by); + } + + bool cache_features = lay.cache_features() && active_styles.size() > 1; + + // Render incrementally when the column that we group by + // changes value. + if (group_by != "") + { + featureset_ptr features = ds->features(q); + if (features) { + // Cache all features into the memory_datasource before rendering. + memory_datasource cache(ds->type(),false); + feature_ptr feature, prev; + + while ((feature = features->next())) + { + if (prev && prev->get(group_by) != feature->get(group_by)) + { + // We're at a value boundary, so render what we have + // up to this point. + int i = 0; + BOOST_FOREACH (feature_type_style const* style, active_styles) + { + render_style(lay, p, style, rule_caches[i], style_names[i], + cache.features(q), prj_trans); + i++; + } + cache.clear(); + } + cache.push(feature); + prev = feature; + } + + int i = 0; + BOOST_FOREACH (feature_type_style const* style, active_styles) + { + render_style(lay, p, style, rule_caches[i], style_names[i], + cache.features(q), prj_trans); + i++; + } + } + } + else if (cache_features) + { + memory_datasource cache(ds->type(),false); + featureset_ptr features = ds->features(q); + if (features) { + // Cache all features into the memory_datasource before rendering. + feature_ptr feature; + while ((feature = features->next())) + { + cache.push(feature); + } + } + int i = 0; + BOOST_FOREACH (feature_type_style const* style, active_styles) + { + render_style(lay, p, style, rule_caches[i], style_names[i], + cache.features(q), prj_trans); + i++; + } + } + // We only have a single style and no grouping. + else + { + int i = 0; + BOOST_FOREACH (feature_type_style const* style, active_styles) + { + render_style(lay, p, style, rule_caches[i], style_names[i], + ds->features(q), prj_trans); + i++; + } + } + } + +#if defined(RENDERING_STATS) + layer_timer.stop(); +#endif + + p.end_layer_processing(lay); +} + + +template +void feature_style_processor::render_style( + layer const& lay, + Processor & p, + feature_type_style const* style, + rule_cache const& rc, + std::string const& style_name, + featureset_ptr features, + proj_transform const& prj_trans) +{ + p.start_style_processing(*style); + if (!features) + { + p.end_style_processing(*style); + return; + } + +#if defined(RENDERING_STATS) + std::ostringstream s1; + s1 << "rendering style for layer: '" << lay.name() + << "' and style '" << style_name << "'"; + mapnik::progress_timer style_timer(std::clog, s1.str()); + + int feature_processed_count = 0; + int feature_count = 0; +#endif + + feature_ptr feature; + while ((feature = features->next())) + { +#if defined(RENDERING_STATS) + feature_count++; + bool feat_processed = false; +#endif + + bool do_else = true; + bool do_also = false; + + BOOST_FOREACH(rule const* r, rc.get_if_rules() ) + { + expression_ptr const& expr=r->get_filter(); + value_type result = boost::apply_visitor(evaluate(*feature),*expr); + if (result.to_bool()) + { +#if defined(RENDERING_STATS) + feat_processed = true; +#endif + + p.painted(true); + + do_else=false; + do_also=true; + rule::symbolizers const& symbols = r->get_symbolizers(); + + // if the underlying renderer is not able to process the complete set of symbolizers, + // process one by one. + if(!p.process(symbols,*feature,prj_trans)) + { + + BOOST_FOREACH (symbolizer const& sym, symbols) + { + boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym); + } + } + if (style->get_filter_mode() == FILTER_FIRST) + { + // Stop iterating over rules and proceed with next feature. + do_also=false; + break; + } + } + } + if (do_else) + { + BOOST_FOREACH( rule const* r, rc.get_else_rules() ) + { +#if defined(RENDERING_STATS) + feat_processed = true; +#endif + + p.painted(true); + + rule::symbolizers const& symbols = r->get_symbolizers(); + // if the underlying renderer is not able to process the complete set of symbolizers, + // process one by one. + if(!p.process(symbols,*feature,prj_trans)) + { + BOOST_FOREACH (symbolizer const& sym, symbols) + { + boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym); + } + } + } + } + if (do_also) + { + BOOST_FOREACH( rule const* r, rc.get_also_rules() ) + { +#if defined(RENDERING_STATS) + feat_processed = true; +#endif + + p.painted(true); + + rule::symbolizers const& symbols = r->get_symbolizers(); + // if the underlying renderer is not able to process the complete set of symbolizers, + // process one by one. + if(!p.process(symbols,*feature,prj_trans)) + { + BOOST_FOREACH (symbolizer const& sym, symbols) + { + boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym); + } + } + } + } +#if defined(RENDERING_STATS) + if (feat_processed) + feature_processed_count++; +#endif + } + +#if defined(RENDERING_STATS) + style_timer.stop(); + + // done with style + std::ostringstream s; + if (feature_count > 0) + { + double perc_processed = ((double)feature_processed_count/(double)feature_count)*100.0; + + s << "percent rendered: " << perc_processed << "% - " << feature_processed_count + << " rendered for " << feature_count << " queried for "; + s << std::setw(15 - (int)s.tellp()) << " layer '" << lay.name() << "' and style '" << style_name << "'\n"; + } + else + { + s << "" << std::setw(15) << "- no features returned from query for layer '" << lay.name() << "' and style '" << style_name << "'\n"; + } + std::clog << s.str(); + style_timer.discard(); +#endif + p.end_style_processing(*style); +} + +} diff -Nru mapnik-2.1.0/include/mapnik/feature_type_style.hpp mapnik-2.2.0/include/mapnik/feature_type_style.hpp --- mapnik-2.1.0/include/mapnik/feature_type_style.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/feature_type_style.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,19 +24,23 @@ #define MAPNIK_FEATURE_TYPE_STYLE_HPP // mapnik +#include #include -#include #include #include +#include // boost #include + // stl #include namespace mapnik { +class rule; + enum filter_mode_enum { FILTER_ALL, FILTER_FIRST, @@ -46,7 +50,6 @@ DEFINE_ENUM( filter_mode_e, filter_mode_enum ); typedef std::vector rules; -typedef std::vector rule_ptrs; class MAPNIK_DECL feature_type_style { @@ -58,11 +61,6 @@ std::vector direct_filters_; // comp-op boost::optional comp_op_; - // The rule_ptrs vectors are only valid for the scale_denom_validity_. - double scale_denom_validity_; - rule_ptrs if_rules_; - rule_ptrs else_rules_; - rule_ptrs also_rules_; float opacity_; public: feature_type_style(); @@ -72,17 +70,14 @@ feature_type_style& operator=(feature_type_style const& rhs); void add_rule(rule const& rule); - rules const& get_rules() const; - rule_ptrs const& get_if_rules(double scale_denom); - rule_ptrs const& get_else_rules(double scale_denom); - rule_ptrs const& get_also_rules(double scale_denom); - rules& get_rules_nonconst(); - void set_filter_mode(filter_mode_e mode); + bool active(double scale_denom) const; + void set_filter_mode(filter_mode_e mode); filter_mode_e get_filter_mode() const; + // filters std::vector const& image_filters() const; std::vector & image_filters(); @@ -96,9 +91,6 @@ ~feature_type_style() {} -private: - void update_rule_cache(double scale_denom); - }; } diff -Nru mapnik-2.1.0/include/mapnik/filter_factory.hpp mapnik-2.2.0/include/mapnik/filter_factory.hpp --- mapnik-2.1.0/include/mapnik/filter_factory.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/filter_factory.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -1,2 +1,8 @@ +// TODO - remove this file at mapnik 3.x +#ifdef _MSC_VER +#pragma NOTE("filter_factory.hpp" is now called "expression.hpp") +#else #warning "filter_factory.hpp" is now called "expression.hpp" +#endif + #include diff -Nru mapnik-2.1.0/include/mapnik/filter_featureset.hpp mapnik-2.2.0/include/mapnik/filter_featureset.hpp --- mapnik-2.1.0/include/mapnik/filter_featureset.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/filter_featureset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,7 +24,8 @@ #define MAPNIK_FILTER_FEATURESET_HPP // mapnik -#include +#include // for featureset_ptr +#include namespace mapnik { diff -Nru mapnik-2.1.0/include/mapnik/font_engine_freetype.hpp mapnik-2.2.0/include/mapnik/font_engine_freetype.hpp --- mapnik-2.1.0/include/mapnik/font_engine_freetype.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/font_engine_freetype.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -27,26 +27,20 @@ #include #include #include +#include #include #include #include #include -#include #include - -// freetype2 -extern "C" -{ -#include -#include FT_FREETYPE_H -#include FT_GLYPH_H -#include FT_STROKER_H -} +#include +#include +#include +#include // boost #include #include -#include #include #include #ifdef MAPNIK_THREADSAFE @@ -57,21 +51,24 @@ #include #include #include -#include -#include // uci #include +struct FT_LibraryRec_; + namespace mapnik { class font_face; class text_path; class string_info; +struct char_properties; +class stroker; +struct glyph_t; typedef boost::shared_ptr face_ptr; -class MAPNIK_DECL font_glyph : private boost::noncopyable +class MAPNIK_DECL font_glyph : private mapnik::noncopyable { public: font_glyph(face_ptr face, unsigned index) @@ -93,148 +90,30 @@ typedef boost::shared_ptr glyph_ptr; -class font_face : boost::noncopyable -{ -public: - font_face(FT_Face face) - : face_(face) {} - - std::string family_name() const - { - return std::string(face_->family_name); - } - - std::string style_name() const - { - return std::string(face_->style_name); - } - - FT_GlyphSlot glyph() const - { - return face_->glyph; - } - - FT_Face get_face() const - { - return face_; - } - - unsigned get_char(unsigned c) const - { - return FT_Get_Char_Index(face_, c); - } - - bool set_pixel_sizes(unsigned size) - { - if (! FT_Set_Pixel_Sizes( face_, 0, size )) - return true; - return false; - } - - bool set_character_sizes(float size) - { - if ( !FT_Set_Char_Size(face_,0,(FT_F26Dot6)(size * (1<<6)),0,0)) - return true; - return false; - } - - ~font_face() - { - MAPNIK_LOG_DEBUG(font_engine_freetype) << "font_face: Clean up face \"" << family_name() << " " << style_name() << "\""; - - FT_Done_Face(face_); - } -private: - FT_Face face_; -}; -class MAPNIK_DECL font_face_set : private boost::noncopyable +class MAPNIK_DECL font_face_set : private mapnik::noncopyable { public: + typedef std::vector container_type; + typedef container_type::size_type size_type; + font_face_set(void) : faces_(), dimension_cache_() {} - void add(face_ptr face) - { - faces_.push_back(face); - dimension_cache_.clear(); //Make sure we don't use old cached data - } - - unsigned size() const - { - return faces_.size(); - } - - glyph_ptr get_glyph(unsigned c) const - { - BOOST_FOREACH ( face_ptr const& face, faces_) - { - FT_UInt g = face->get_char(c); - if (g) return boost::make_shared(face, g); - } - - // Final fallback to empty square if nothing better in any font - return boost::make_shared(*faces_.begin(), 0); - } - - char_info character_dimensions(const unsigned c); - + void add(face_ptr face); + size_type size() const; + glyph_ptr get_glyph(unsigned c) const; + char_info character_dimensions(unsigned c); void get_string_info(string_info & info, UnicodeString const& ustr, char_properties *format); - - void set_pixel_sizes(unsigned size) - { - BOOST_FOREACH ( face_ptr const& face, faces_) - { - face->set_pixel_sizes(size); - } - } - - void set_character_sizes(float size) - { - BOOST_FOREACH ( face_ptr const& face, faces_) - { - face->set_character_sizes(size); - } - } + void set_pixel_sizes(unsigned size); + void set_character_sizes(double size); private: - std::vector faces_; + container_type faces_; std::map dimension_cache_; }; -// FT_Stroker wrapper -class stroker : boost::noncopyable -{ -public: - explicit stroker(FT_Stroker s) - : s_(s) {} - - void init(double radius) - { - FT_Stroker_Set(s_, (FT_Fixed) (radius * (1<<6)), - FT_STROKER_LINECAP_ROUND, - FT_STROKER_LINEJOIN_ROUND, - 0); - } - - FT_Stroker const& get() const - { - return s_; - } - - ~stroker() - { - MAPNIK_LOG_DEBUG(font_engine_freetype) << "stroker: Destroy stroker=" << s_; - - FT_Stroker_Done(s_); - } -private: - FT_Stroker s_; -}; - - - typedef boost::shared_ptr face_set_ptr; typedef boost::shared_ptr stroker_ptr; @@ -250,7 +129,7 @@ static bool register_font(std::string const& file_name); /*! \brief register a font file - * @param file_name - path to a directory containing fonts or subdirectories. + * @param dir - path to a directory containing fonts or subdirectories. * @param recurse - default false, whether to search for fonts in sub directories. * @return bool - true if at least one face was successfully registered. */ @@ -262,15 +141,16 @@ virtual ~freetype_engine(); freetype_engine(); private: - FT_Library library_; + FT_LibraryRec_ * library_; #ifdef MAPNIK_THREADSAFE static boost::mutex mutex_; #endif static std::map > name2file_; + static std::map memory_fonts_; }; template -class MAPNIK_DECL face_manager : private boost::noncopyable +class MAPNIK_DECL face_manager : private mapnik::noncopyable { typedef T font_engine_type; typedef std::map face_ptr_cache_type; @@ -314,9 +194,9 @@ { std::vector const& names = fset.get_face_names(); face_set_ptr face_set = boost::make_shared(); - for (std::vector::const_iterator name = names.begin(); name != names.end(); ++name) + BOOST_FOREACH( std::string const& name, names) { - face_ptr face = get_face(*name); + face_ptr face = get_face(name); if (face) { face_set->add(face); @@ -325,7 +205,7 @@ else { MAPNIK_LOG_DEBUG(font_engine_freetype) - << "Failed to find face '" << *name + << "Failed to find face '" << name << "' in font set '" << fset.get_name() << "'\n"; } #endif @@ -333,11 +213,11 @@ return face_set; } - face_set_ptr get_face_set(std::string const& name, font_set const& fset) + face_set_ptr get_face_set(std::string const& name, boost::optional fset) { - if (fset.size() > 0) + if (fset && fset->size() > 0) { - return get_face_set(fset); + return get_face_set(*fset); } else { @@ -345,7 +225,7 @@ } } - stroker_ptr get_stroker() + inline stroker_ptr get_stroker() { return stroker_; } @@ -357,73 +237,25 @@ }; template -struct text_renderer : private boost::noncopyable +struct text_renderer : private mapnik::noncopyable { - struct glyph_t : boost::noncopyable - { - FT_Glyph image; - char_properties *properties; - glyph_t(FT_Glyph image_, char_properties *properties_) - : image(image_), properties(properties_) {} - ~glyph_t () { FT_Done_Glyph(image);} - }; typedef boost::ptr_vector glyphs_t; typedef T pixmap_type; text_renderer (pixmap_type & pixmap, - face_manager &font_manager_, - stroker & s, + face_manager & font_manager, + halo_rasterizer_e rasterizer, composite_mode_e comp_op = src_over, double scale_factor=1.0); box2d prepare_glyphs(text_path const& path); - void render(pixel_position pos); - void render_id(int feature_id, pixel_position pos, double min_radius=1.0); - + void render(pixel_position const& pos); + void render_id(mapnik::value_integer feature_id, + pixel_position const& pos); private: - - void render_bitmap(FT_Bitmap *bitmap, unsigned rgba, int x, int y, double opacity) - { - int x_max=x+bitmap->width; - int y_max=y+bitmap->rows; - int i,p,j,q; - - for (i=x,p=0;ibuffer[q*bitmap->width+p]; - if (gray) - { - pixmap_.blendPixel2(i, j, rgba, gray, opacity); - } - } - } - } - - void render_bitmap_id(FT_Bitmap *bitmap,int feature_id,int x,int y) - { - int x_max=x+bitmap->width; - int y_max=y+bitmap->rows; - int i,p,j,q; - - for (i=x,p=0;ibuffer[q*bitmap->width+p]; - if (gray) - { - pixmap_.setPixel(i,j,feature_id); - //pixmap_.blendPixel2(i,j,rgba,gray,opacity_); - } - } - } - } - pixmap_type & pixmap_; - face_manager &font_manager_; - stroker & stroker_; + face_manager & font_manager_; + halo_rasterizer_e rasterizer_; glyphs_t glyphs_; composite_mode_e comp_op_; double scale_factor_; diff -Nru mapnik-2.1.0/include/mapnik/font_set.hpp mapnik-2.2.0/include/mapnik/font_set.hpp --- mapnik-2.1.0/include/mapnik/font_set.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/font_set.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -35,11 +35,11 @@ class MAPNIK_DECL font_set { public: - font_set(); font_set(std::string const& name); font_set(font_set const& rhs); font_set& operator=(font_set const& rhs); unsigned size() const; + void set_name(std::string const& name); std::string const& get_name() const; void add_face_name(std::string); std::vector const& get_face_names() const; diff -Nru mapnik-2.1.0/include/mapnik/font_util.hpp mapnik-2.2.0/include/mapnik/font_util.hpp --- mapnik-2.1.0/include/mapnik/font_util.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/font_util.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,145 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + + +#ifndef MAPNIK_FONT_UTIL_HPP +#define MAPNIK_FONT_UTIL_HPP + +// mapnik +#include + +#include + +// freetype2 +extern "C" +{ +#include +#include FT_FREETYPE_H +#include FT_GLYPH_H +#include FT_STROKER_H +} + +namespace mapnik +{ +struct char_properties; + +struct glyph_t : mapnik::noncopyable +{ + FT_Glyph image; + char_properties *properties; + glyph_t(FT_Glyph image_, char_properties *properties_) + : image(image_), + properties(properties_) {} + ~glyph_t() + { + FT_Done_Glyph(image); + } +}; + + +// FT_Stroker wrapper +class stroker : mapnik::noncopyable +{ +public: + explicit stroker(FT_Stroker s) + : s_(s) {} + + void init(double radius) + { + FT_Stroker_Set(s_, (FT_Fixed) (radius * (1<<6)), + FT_STROKER_LINECAP_ROUND, + FT_STROKER_LINEJOIN_ROUND, + 0); + } + + FT_Stroker const& get() const + { + return s_; + } + + ~stroker() + { + FT_Stroker_Done(s_); + } +private: + FT_Stroker s_; +}; + + +class font_face : mapnik::noncopyable +{ +public: + font_face(FT_Face face) + : face_(face) {} + + std::string family_name() const + { + return std::string(face_->family_name); + } + + std::string style_name() const + { + return std::string(face_->style_name); + } + + FT_GlyphSlot glyph() const + { + return face_->glyph; + } + + FT_Face get_face() const + { + return face_; + } + + unsigned get_char(unsigned c) const + { + return FT_Get_Char_Index(face_, c); + } + + bool set_pixel_sizes(unsigned size) + { + if (! FT_Set_Pixel_Sizes( face_, 0, size )) + return true; + return false; + } + + bool set_character_sizes(double size) + { + if ( !FT_Set_Char_Size(face_,0,(FT_F26Dot6)(size * (1<<6)),0,0)) + return true; + return false; + } + + ~font_face() + { + FT_Done_Face(face_); + } + +private: + FT_Face face_; +}; + +} + + +#endif // MAPNIK_FONT_UTIL_HPP diff -Nru mapnik-2.1.0/include/mapnik/formatting/base.hpp mapnik-2.2.0/include/mapnik/formatting/base.hpp --- mapnik-2.1.0/include/mapnik/formatting/base.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/formatting/base.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,18 +23,14 @@ #define FORMATTING_BASE_HPP // mapnik -#include #include -// stl -#include - // boost -#include +#include namespace mapnik { -typedef std::set expression_set; +class feature_impl; class processed_text; class xml_node; struct char_properties; @@ -44,13 +40,13 @@ class node; typedef boost::shared_ptr node_ptr; -class node +class MAPNIK_DECL node { public: virtual ~node() {} virtual void to_xml(boost::property_tree::ptree &xml) const; static node_ptr from_xml(xml_node const& xml); - virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const = 0; + virtual void apply(char_properties const& p, feature_impl const& feature, processed_text &output) const = 0; virtual void add_expressions(expression_set &output) const; }; } //ns formatting diff -Nru mapnik-2.1.0/include/mapnik/formatting/expression.hpp mapnik-2.2.0/include/mapnik/formatting/expression.hpp --- mapnik-2.1.0/include/mapnik/formatting/expression.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/formatting/expression.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2012 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef FORMATTING_EXPRESSION_HPP -#define FORMATTING_EXPRESSION_HPP - -#include -#include - -namespace mapnik { -namespace formatting { -class expression_format: public node { -public: - void to_xml(boost::property_tree::ptree &xml) const; - static node_ptr from_xml(xml_node const& xml); - virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const; - virtual void add_expressions(expression_set &output) const; - - void set_child(node_ptr child); - node_ptr get_child() const; - - expression_ptr face_name; - expression_ptr text_size; - expression_ptr character_spacing; - expression_ptr line_spacing; - expression_ptr text_opacity; - expression_ptr wrap_before; - expression_ptr wrap_char; - expression_ptr fill; - expression_ptr halo_fill; - expression_ptr halo_radius; - -private: - node_ptr child_; - static expression_ptr get_expression(xml_node const& xml, std::string name); -}; -} //ns formatting -} //ns mapnik -#endif // FORMATTING_EXPRESSION_HPP diff -Nru mapnik-2.1.0/include/mapnik/formatting/expression_format.hpp mapnik-2.2.0/include/mapnik/formatting/expression_format.hpp --- mapnik-2.1.0/include/mapnik/formatting/expression_format.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/formatting/expression_format.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,67 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2012 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef FORMATTING_EXPRESSION_HPP +#define FORMATTING_EXPRESSION_HPP + +#include +#include + +// boost +#include + +namespace mapnik { + +class feature_impl; +class processed_text; +class xml_node; +struct char_properties; + +namespace formatting { +class MAPNIK_DECL expression_format: public node { +public: + void to_xml(boost::property_tree::ptree &xml) const; + static node_ptr from_xml(xml_node const& xml); + virtual void apply(char_properties const& p, feature_impl const& feature, processed_text &output) const; + virtual void add_expressions(expression_set &output) const; + + void set_child(node_ptr child); + node_ptr get_child() const; + + expression_ptr face_name; + expression_ptr text_size; + expression_ptr character_spacing; + expression_ptr line_spacing; + expression_ptr text_opacity; + expression_ptr wrap_before; + expression_ptr wrap_char; + expression_ptr fill; + expression_ptr halo_fill; + expression_ptr halo_radius; + +private: + node_ptr child_; + static expression_ptr get_expression(xml_node const& xml, std::string name); +}; +} //ns formatting +} //ns mapnik +#endif // FORMATTING_EXPRESSION_HPP diff -Nru mapnik-2.1.0/include/mapnik/formatting/format.hpp mapnik-2.2.0/include/mapnik/formatting/format.hpp --- mapnik-2.1.0/include/mapnik/formatting/format.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/formatting/format.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,14 +25,18 @@ #include #include +#include + +// boost +#include namespace mapnik { namespace formatting { -class format_node: public node { +class MAPNIK_DECL format_node: public node { public: void to_xml(boost::property_tree::ptree &xml) const; static node_ptr from_xml(xml_node const& xml); - virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const; + virtual void apply(char_properties const& p, feature_impl const& feature, processed_text &output) const; virtual void add_expressions(expression_set &output) const; void set_child(node_ptr child); diff -Nru mapnik-2.1.0/include/mapnik/formatting/list.hpp mapnik-2.2.0/include/mapnik/formatting/list.hpp --- mapnik-2.1.0/include/mapnik/formatting/list.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/formatting/list.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,15 +22,20 @@ #ifndef FORMATTING_LIST_HPP #define FORMATTING_LIST_HPP +// mapnik #include +#include + +// boost +#include namespace mapnik { namespace formatting { -class list_node: public node { +class MAPNIK_DECL list_node: public node { public: list_node() : node(), children_() {} virtual void to_xml(boost::property_tree::ptree &xml) const; - virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const; + virtual void apply(char_properties const& p, feature_impl const& feature, processed_text &output) const; virtual void add_expressions(expression_set &output) const; void push_back(node_ptr n); diff -Nru mapnik-2.1.0/include/mapnik/formatting/registry.hpp mapnik-2.2.0/include/mapnik/formatting/registry.hpp --- mapnik-2.1.0/include/mapnik/formatting/registry.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/formatting/registry.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,9 +25,7 @@ // mapnik #include #include - -// boost -#include +#include // stl #include @@ -41,7 +39,7 @@ typedef node_ptr (*from_xml_function_ptr)(xml_node const& xml); class registry : public singleton, - private boost::noncopyable + private mapnik::noncopyable { public: registry(); diff -Nru mapnik-2.1.0/include/mapnik/formatting/text.hpp mapnik-2.2.0/include/mapnik/formatting/text.hpp --- mapnik-2.1.0/include/mapnik/formatting/text.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/formatting/text.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,16 +23,20 @@ #define FORMATTING_TEXT_HPP #include +#include + +// boost +#include namespace mapnik { namespace formatting { -class text_node: public node { +class MAPNIK_DECL text_node: public node { public: text_node(expression_ptr text): node(), text_(text) {} text_node(std::string text): node(), text_(parse_expression(text)) {} void to_xml(boost::property_tree::ptree &xml) const; static node_ptr from_xml(xml_node const& xml); - virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const; + virtual void apply(char_properties const& p, feature_impl const& feature, processed_text &output) const; virtual void add_expressions(expression_set &output) const; void set_text(expression_ptr text); diff -Nru mapnik-2.1.0/include/mapnik/geom_util.hpp mapnik-2.2.0/include/mapnik/geom_util.hpp --- mapnik-2.1.0/include/mapnik/geom_util.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/geom_util.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -200,10 +200,10 @@ struct filter_in_box { box2d box_; - explicit filter_in_box(const box2d& box) + explicit filter_in_box(box2d const& box) : box_(box) {} - bool pass(const box2d& extent) const + bool pass(box2d const& extent) const { return extent.intersects(box_); } @@ -211,12 +211,16 @@ struct filter_at_point { - coord2d pt_; - explicit filter_at_point(const coord2d& pt) - : pt_(pt) {} - bool pass(const box2d& extent) const + box2d box_; + explicit filter_at_point(coord2d const& pt, double tol=0) + : box_(pt,pt) + { + box_.pad(tol); + } + + bool pass(box2d const& extent) const { - return extent.contains(pt_); + return extent.intersects(box_); } }; @@ -234,6 +238,7 @@ double length = 0; while (SEG_END != (command = path.vertex(&x1, &y1))) { + if (command == SEG_CLOSE) continue; length += distance(x0,y0,x1,y1); x0 = x1; y0 = y1; @@ -257,6 +262,7 @@ double dist = 0.0; while (SEG_END != (command = path.vertex(&x1, &y1))) { + if (command == SEG_CLOSE) continue; double seg_length = distance(x0, y0, x1, y1); if ( dist + seg_length >= mid_length) @@ -296,6 +302,7 @@ unsigned count = 1; while (SEG_END != (command = path.vertex(&x1, &y1))) { + if (command == SEG_CLOSE) continue; double dx0 = x0 - start_x; double dy0 = y0 - start_y; double dx1 = x1 - start_x; @@ -329,6 +336,74 @@ return true; } +// Compute centroid over a set of paths +template +bool centroid_geoms(Iter start, Iter end, double & x, double & y) +{ + double x0 = 0.0; + double y0 = 0.0; + double x1 = 0.0; + double y1 = 0.0; + double start_x = x0; + double start_y = y0; + + double atmp = 0.0; + double xtmp = 0.0; + double ytmp = 0.0; + unsigned count = 0; + + while (start!=end) + { + typename Iter::value_type & path = *start++; + path.rewind(0); + unsigned command = path.vertex(&x0, &y0); + if (command == SEG_END) continue; + + if ( ! count++ ) { + start_x = x0; + start_y = y0; + } + + while (SEG_END != (command = path.vertex(&x1, &y1))) + { + if (command == SEG_CLOSE) continue; + double dx0 = x0 - start_x; + double dy0 = y0 - start_y; + double dx1 = x1 - start_x; + double dy1 = y1 - start_y; + double ai = dx0 * dy1 - dx1 * dy0; + atmp += ai; + xtmp += (dx1 + dx0) * ai; + ytmp += (dy1 + dy0) * ai; + x0 = x1; + y0 = y1; + ++count; + } + + } + + if (count == 0) return false; + + if (count <= 2) { + x = (start_x + x0) * 0.5; + y = (start_y + y0) * 0.5; + return true; + } + + if (atmp != 0) + { + x = (xtmp/(3*atmp)) + start_x; + y = (ytmp/(3*atmp)) + start_y; + } + else + { + x = x0; + y = y0; + } + + return true; +} + template bool hit_test(PathType & path, double x, double y, double tol) { @@ -343,6 +418,7 @@ unsigned count = 0; while (SEG_END != (command = path.vertex(&x1, &y1))) { + if (command == SEG_CLOSE) continue; ++count; if (command == SEG_MOVETO) { @@ -361,7 +437,7 @@ if (count == 0) // one vertex { - return distance(x, y, x0, y0) <= fabs(tol); + return distance(x, y, x0, y0) <= std::fabs(tol); } return inside; } @@ -390,6 +466,8 @@ double y1 = 0; while (SEG_END != (command = path.vertex(&x1, &y1))) { + if (command == SEG_CLOSE) + continue; if (command != SEG_MOVETO) { // if the segments overlap @@ -427,9 +505,9 @@ double max_width = 0; for (unsigned ii = 1; ii < intersections.size(); ++ii) { - double x1=intersections[ii]; - double xc=(x0+x1)/2.0; - double width = std::fabs(x1-x0); + double xi=intersections[ii]; + double xc=(x0+xi)/2.0; + double width = std::fabs(xi-x0); if (width > max_width && hit_test(path,xc,y,0)) { x=xc; diff -Nru mapnik-2.1.0/include/mapnik/geometry.hpp mapnik-2.2.0/include/mapnik/geometry.hpp --- mapnik-2.1.0/include/mapnik/geometry.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/geometry.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,10 +26,10 @@ // mapnik #include #include +#include // boost #include -#include #include namespace mapnik { @@ -42,7 +42,7 @@ }; template class Container=vertex_vector> -class geometry : private::boost::noncopyable +class geometry : private mapnik::noncopyable { public: typedef T coord_type; @@ -91,10 +91,11 @@ double x = 0; double y = 0; rewind(0); - for (unsigned i=0;i 3) - { - cont_.set_command(cont_.size() - 1, SEG_CLOSE); - } + push_vertex(0,0,SEG_CLOSE); } unsigned vertex(double* x, double* y) const diff -Nru mapnik-2.1.0/include/mapnik/global.hpp mapnik-2.2.0/include/mapnik/global.hpp --- mapnik-2.1.0/include/mapnik/global.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/global.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2011 Artem Pavlenko + * Copyright (C) 2013 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,6 +29,7 @@ // stl #include +#include namespace mapnik { @@ -155,14 +156,14 @@ #ifdef _WINDOWS // msvc doesn't have rint in -inline int rint( double val) +inline int rint(double val) { - return int(floor(val + 0.5)); + return int(std::floor(val + 0.5)); } -inline double round (double val) +inline double round(double val) { - return floor(val); + return std::floor(val); } #define _USE_MATH_DEFINES diff -Nru mapnik-2.1.0/include/mapnik/graphics.hpp mapnik-2.2.0/include/mapnik/graphics.hpp --- mapnik-2.1.0/include/mapnik/graphics.hpp 2012-08-23 21:57:05.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/graphics.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -37,7 +37,7 @@ // cairo #ifdef HAVE_CAIRO -#include +#include #endif // boost @@ -58,7 +58,7 @@ image_32(int width,int height); image_32(image_32 const& rhs); #ifdef HAVE_CAIRO - image_32(Cairo::RefPtr rhs); + explicit image_32(cairo_surface_ptr const& surface); #endif ~image_32(); @@ -72,6 +72,11 @@ return painted_; } + inline void clear() + { + std::memset(data_.getData(),0,sizeof(mapnik::image_data_32::pixel_type)*data_.width()*data_.height()); + } + boost::optional const& get_background() const; void set_background(const color& c); @@ -113,9 +118,9 @@ private: - inline bool checkBounds(unsigned x, unsigned y) const + inline bool checkBounds(int x, int y) const { - return (x < width_ && y < height_); + return (x >= 0 && x < static_cast(width_) && y >= 0 && y < static_cast(height_)); } public: @@ -179,9 +184,9 @@ #endif } } - + void composite_pixel(unsigned op, int x,int y,unsigned c, unsigned cover, double opacity); - + inline unsigned width() const { return width_; diff -Nru mapnik-2.1.0/include/mapnik/grid/grid.hpp mapnik-2.2.0/include/mapnik/grid/grid.hpp --- mapnik-2.1.0/include/mapnik/grid/grid.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/grid/grid.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,7 +25,6 @@ // mapnik #include -#include #include #include #include @@ -82,6 +81,8 @@ ~hit_grid() {} + void clear(); + inline void painted(bool painted) { painted_ = painted; @@ -255,7 +256,7 @@ }; -typedef MAPNIK_DECL hit_grid grid; +typedef hit_grid grid; } #endif //MAPNIK_GRID_HPP diff -Nru mapnik-2.1.0/include/mapnik/grid/grid_marker_helpers.hpp mapnik-2.2.0/include/mapnik/grid/grid_marker_helpers.hpp --- mapnik-2.1.0/include/mapnik/grid/grid_marker_helpers.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/grid/grid_marker_helpers.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -44,8 +44,8 @@ template struct raster_markers_rasterizer_dispatch_grid { - typedef mapnik::gray32 color_type; typedef typename RendererBase::pixfmt_type pixfmt_type; + typedef typename RendererBase::pixfmt_type::color_type color_type; raster_markers_rasterizer_dispatch_grid(BufferType & render_buffer, Rasterizer & ras, @@ -78,11 +78,17 @@ { marker_placement_e placement_method = sym_.get_marker_placement(); box2d bbox_(0,0, src_.width(),src_.height()); - if (placement_method != MARKER_LINE_PLACEMENT) + if (placement_method != MARKER_LINE_PLACEMENT || + path.type() == Point) { double x = 0; double y = 0; - if (placement_method == MARKER_INTERIOR_PLACEMENT) + if (path.type() == LineString) + { + if (!label::middle_point(path, x, y)) + return; + } + else if (placement_method == MARKER_INTERIOR_PLACEMENT) { if (!label::interior_position(path, x, y)) return; @@ -150,7 +156,7 @@ ras_.line_to_d(p[4],p[5]); ras_.line_to_d(p[6],p[7]); RendererType ren(renb_); - ren.color(mapnik::gray32(feature_.id())); + ren.color(color_type(feature_.id())); agg::render_scanlines(ras_, sl_, ren); } @@ -209,11 +215,17 @@ void add_path(T & path) { marker_placement_e placement_method = sym_.get_marker_placement(); - if (placement_method != MARKER_LINE_PLACEMENT) + if (placement_method != MARKER_LINE_PLACEMENT || + path.type() == Point) { double x = 0; double y = 0; - if (placement_method == MARKER_INTERIOR_PLACEMENT) + if (path.type() == LineString) + { + if (!label::middle_point(path, x, y)) + return; + } + else if (placement_method == MARKER_INTERIOR_PLACEMENT) { if (!label::interior_position(path, x, y)) return; diff -Nru mapnik-2.1.0/include/mapnik/grid/grid_pixel.hpp mapnik-2.2.0/include/mapnik/grid/grid_pixel.hpp --- mapnik-2.1.0/include/mapnik/grid/grid_pixel.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/grid/grid_pixel.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -165,12 +165,17 @@ static self_type no_color() { return self_type(0,0); } }; -//==================================================================gray16 +//==================================================================gray32 struct gray32 { typedef agg::int32 value_type; typedef agg::int64u calc_type; typedef agg::int64 long_type; + // NOTE: don't touch this enum since enums cannot be + // 64 bit and we need to ensure that alpha = base_mask + // in grid_pixfmt.hpp#blend_hiline#l256 + // otherwise code will get invoked that breaks + // with 32 bit or 64 bit ints (blender_gray::blend_pix) enum base_scale_e { base_shift = 16, @@ -186,8 +191,8 @@ gray32() {} //-------------------------------------------------------------------- - gray32(unsigned v_, unsigned a_=base_mask) : - v(agg::int32(v_)), a(agg::int32(a_)) {} + gray32(value_type v_, unsigned a_=base_mask) : + v(v_), a(value_type(a_)) {} //-------------------------------------------------------------------- gray32(const self_type& c, unsigned a_) : @@ -302,6 +307,148 @@ static self_type no_color() { return self_type(0,0); } }; +//==================================================================gray64 +struct gray64 +{ + typedef agg::int64 value_type; + typedef agg::int64u calc_type; + typedef agg::int64 long_type; + // NOTE: don't touch this enum since enums cannot be + // 64 bit and we need to ensure that alpha = base_mask + // in grid_pixfmt.hpp#blend_hiline#l256 + // otherwise code will get invoked that breaks + // with 32 bit or 64 bit ints (blender_gray::blend_pix) + enum base_scale_e + { + base_shift = 16, + base_scale = 1 << base_shift, + base_mask = base_scale - 1 + }; + typedef gray64 self_type; + + value_type v; + value_type a; + + //-------------------------------------------------------------------- + gray64() {} + + //-------------------------------------------------------------------- + gray64(value_type v_, unsigned a_=base_mask) : + v(v_), a(value_type(a_)) {} + + //-------------------------------------------------------------------- + gray64(const self_type& c, unsigned a_) : + v(c.v), a(value_type(a_)) {} + + //-------------------------------------------------------------------- + void clear() + { + v = a = 0; + } + + //-------------------------------------------------------------------- + const self_type& transparent() + { + a = 0; + return *this; + } + + //-------------------------------------------------------------------- + void opacity(double a_) + { + if(a_ < 0.0) a_ = 0.0; + if(a_ > 1.0) a_ = 1.0; + a = (value_type)agg::uround(a_ * double(base_mask)); + } + + //-------------------------------------------------------------------- + double opacity() const + { + return double(a) / double(base_mask); + } + + + //-------------------------------------------------------------------- + const self_type& premultiply() + { + if(a == base_mask) return *this; + if(a == 0) + { + v = 0; + return *this; + } + v = value_type((calc_type(v) * a) >> base_shift); + return *this; + } + + //-------------------------------------------------------------------- + const self_type& premultiply(unsigned a_) + { + if(a == base_mask && a_ >= base_mask) return *this; + if(a == 0 || a_ == 0) + { + v = a = 0; + return *this; + } + calc_type v_ = (calc_type(v) * a_) / a; + v = value_type((v_ > a_) ? a_ : v_); + a = value_type(a_); + return *this; + } + + //-------------------------------------------------------------------- + const self_type& demultiply() + { + if(a == base_mask) return *this; + if(a == 0) + { + v = 0; + return *this; + } + calc_type v_ = (calc_type(v) * base_mask) / a; + v = value_type((v_ > base_mask) ? base_mask : v_); + return *this; + } + + //-------------------------------------------------------------------- + self_type gradient(self_type c, double k) const + { + self_type ret; + calc_type ik = agg::uround(k * base_scale); + ret.v = value_type(calc_type(v) + (((calc_type(c.v) - v) * ik) >> base_shift)); + ret.a = value_type(calc_type(a) + (((calc_type(c.a) - a) * ik) >> base_shift)); + return ret; + } + + //-------------------------------------------------------------------- + AGG_INLINE void add(const self_type& c, unsigned cover) + { + calc_type cv, ca; + if(cover == agg::cover_mask) + { + if(c.a == base_mask) + { + *this = c; + } + else + { + cv = v + c.v; v = (cv > calc_type(base_mask)) ? calc_type(base_mask) : cv; + ca = a + c.a; a = (ca > calc_type(base_mask)) ? calc_type(base_mask) : ca; + } + } + else + { + cv = v + ((c.v * cover + agg::cover_mask/2) >> agg::cover_shift); + ca = a + ((c.a * cover + agg::cover_mask/2) >> agg::cover_shift); + v = (cv > calc_type(base_mask)) ? calc_type(base_mask) : cv; + a = (ca > calc_type(base_mask)) ? calc_type(base_mask) : ca; + } + } + + //-------------------------------------------------------------------- + static self_type no_color() { return self_type(0,0); } +}; + } #endif diff -Nru mapnik-2.1.0/include/mapnik/grid/grid_pixfmt.hpp mapnik-2.2.0/include/mapnik/grid/grid_pixfmt.hpp --- mapnik-2.1.0/include/mapnik/grid/grid_pixfmt.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/grid/grid_pixfmt.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -258,7 +258,16 @@ const color_type& c, agg::int8u cover) { - if (c.a) + value_type* p = (value_type*) + m_rbuf->row_ptr(x, y, len) + x * Step + Offset; + do + { + *p = c.v; + p += Step; + } + while(--len); + // We ignore alpha since grid_renderer is a binary renderer for now + /*if (c.a) { value_type* p = (value_type*) m_rbuf->row_ptr(x, y, len) + x * Step + Offset; @@ -282,7 +291,7 @@ } while(--len); } - } + }*/ } @@ -638,7 +647,12 @@ typedef blender_gray blender_gray32; typedef pixfmt_alpha_blend_gray pixfmt_gray32; //----pixfmt_gray16 + mapnik::grid_rendering_buffer> pixfmt_gray32; //----pixfmt_gray32 + +typedef blender_gray blender_gray64; + +typedef pixfmt_alpha_blend_gray pixfmt_gray64; //----pixfmt_gray64 } diff -Nru mapnik-2.1.0/include/mapnik/grid/grid_rasterizer.hpp mapnik-2.2.0/include/mapnik/grid/grid_rasterizer.hpp --- mapnik-2.1.0/include/mapnik/grid/grid_rasterizer.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/grid/grid_rasterizer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,12 +23,12 @@ #ifndef MAPNIK_GRID_RASTERIZER_HPP #define MAPNIK_GRID_RASTERIZER_HPP -#include +#include #include "agg_rasterizer_scanline_aa.h" namespace mapnik { -struct grid_rasterizer : agg::rasterizer_scanline_aa<>, boost::noncopyable {}; +struct grid_rasterizer : agg::rasterizer_scanline_aa<>, mapnik::noncopyable {}; } diff -Nru mapnik-2.1.0/include/mapnik/grid/grid_renderer.hpp mapnik-2.2.0/include/mapnik/grid/grid_renderer.hpp --- mapnik-2.1.0/include/mapnik/grid/grid_renderer.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/grid/grid_renderer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -27,38 +27,47 @@ #include #include #include -#include -#include -#include // for all symbolizers #include +#include +#include // for rule, symbolizers +#include // for box2d +#include // for color +#include // for CoordTransform +#include // for composite_mode_e +#include // boost -#include #include +#include -// FIXME -// forward declare so that -// apps using mapnik do not -// need agg headers -namespace agg { -struct trans_affine; -} +// fwd declaration to avoid depedence on agg headers +namespace agg { struct trans_affine; } +// fwd declarations to speed up compile namespace mapnik { + class Map; + class feature_impl; + class feature_type_style; + class label_collision_detector4; + class layer; + class marker; + class proj_transform; + struct grid_rasterizer; + class request; +} -class marker; - -struct grid_rasterizer; +namespace mapnik { template class MAPNIK_DECL grid_renderer : public feature_style_processor >, - private boost::noncopyable + private mapnik::noncopyable { public: typedef T buffer_type; typedef grid_renderer processor_impl_type; grid_renderer(Map const& m, T & pixmap, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0); + grid_renderer(Map const& m, request const& req, T & pixmap, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0); ~grid_renderer(); void start_map_processing(Map const& map); void end_map_processing(Map const& map); @@ -104,11 +113,15 @@ { // grid renderer doesn't support processing of multiple symbolizers. return false; - }; + } void painted(bool painted) { pixmap_.painted(painted); } + inline eAttributeCollectionPolicy attribute_collection_policy() const + { + return DEFAULT; + } private: buffer_type & pixmap_; diff -Nru mapnik-2.1.0/include/mapnik/grid/grid_renderer_base.hpp mapnik-2.2.0/include/mapnik/grid/grid_renderer_base.hpp --- mapnik-2.1.0/include/mapnik/grid/grid_renderer_base.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/grid/grid_renderer_base.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,40 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2012 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_GRID_RENDERER_BASE_HPP +#define MAPNIK_GRID_RENDERER_BASE_HPP + +#include "agg_renderer_base.h" +#include +#include + +namespace mapnik { + +#ifdef BIGINT +typedef agg::renderer_base grid_renderer_base_type; +#else +typedef agg::renderer_base grid_renderer_base_type; +#endif + +} + +#endif //MAPNIK_AGG_RASTERIZER_HPP diff -Nru mapnik-2.1.0/include/mapnik/grid/grid_view.hpp mapnik-2.2.0/include/mapnik/grid/grid_view.hpp --- mapnik-2.1.0/include/mapnik/grid/grid_view.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/grid/grid_view.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -201,7 +201,7 @@ feature_type const& features_; }; -typedef hit_grid_view > grid_view; +typedef hit_grid_view > grid_view; } diff -Nru mapnik-2.1.0/include/mapnik/hash_variant.hpp mapnik-2.2.0/include/mapnik/hash_variant.hpp --- mapnik-2.1.0/include/mapnik/hash_variant.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/hash_variant.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// boost variant/detail/hash_variant.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2011 +// Antony Polukhin +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// TODO: Remove this file once the minimum Boost version is bumped to 1.50 + +#ifndef BOOST_HASH_VARIANT_FUNCTION_HPP +#define BOOST_HASH_VARIANT_FUNCTION_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include +#include + +namespace boost { + + namespace detail { namespace variant { + struct variant_hasher: public boost::static_visitor { + template + std::size_t operator()(T const& val) const { + using namespace boost; + hash hasher; + return hasher(val); + } + }; + }} + + template < BOOST_VARIANT_ENUM_PARAMS(typename T) > + std::size_t hash_value(variant< BOOST_VARIANT_ENUM_PARAMS(T) > const& val) { + std::size_t seed = boost::apply_visitor(detail::variant::variant_hasher(), val); + hash_combine(seed, val.which()); + return seed; + } +} + +#endif diff -Nru mapnik-2.1.0/include/mapnik/hextree.hpp mapnik-2.2.0/include/mapnik/hextree.hpp --- mapnik-2.1.0/include/mapnik/hextree.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/hextree.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,11 +26,10 @@ // mapnik #include #include +#include // boost -#include #include -#include #if BOOST_VERSION >= 104600 #include #endif @@ -38,7 +37,6 @@ // stl #include -#include #include #include #include @@ -61,7 +59,7 @@ }; template -class hextree : private boost::noncopyable +class hextree : private mapnik::noncopyable { struct node { @@ -132,7 +130,6 @@ // index remaping of sorted_pal_ indexes to indexes of returned image palette std::vector pal_remap_; // rgba hashtable for quantization - typedef boost::unordered_map rgba_hash_table; mutable rgba_hash_table color_hashmap_; // gamma correction to prioritize dark colors (>1.0) double gamma_; @@ -153,9 +150,16 @@ colors_(0), has_holes_(false), root_(new node()), +#ifdef USE_DENSE_HASH_MAP + // TODO - test for any benefit to initializing at a larger size + color_hashmap_(), +#endif trans_mode_(FULL_TRANSPARENCY) { setGamma(g); +#ifdef USE_DENSE_HASH_MAP + color_hashmap_.set_empty_key(0); +#endif } ~hextree() @@ -238,9 +242,9 @@ } // return color index in returned earlier palette - int quantize(rgba const& c) const + int quantize(unsigned val) const { - byte a = preprocessAlpha(c.a); + byte a = preprocessAlpha(U2ALPHA(val)); unsigned ind=0; if (a < InsertPolicy::MIN_ALPHA || colors_ == 0) { @@ -251,9 +255,10 @@ return pal_remap_[has_holes_?1:0]; } - rgba_hash_table::iterator it = color_hashmap_.find(c); + rgba_hash_table::iterator it = color_hashmap_.find(val); if (it == color_hashmap_.end()) { + rgba c(val); int dr, dg, db, da; int dist, newdist; @@ -313,7 +318,7 @@ } } //put found index in hash map - color_hashmap_[c] = ind; + color_hashmap_[val] = ind; } else { diff -Nru mapnik-2.1.0/include/mapnik/hit_test_filter.hpp mapnik-2.2.0/include/mapnik/hit_test_filter.hpp --- mapnik-2.1.0/include/mapnik/hit_test_filter.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/hit_test_filter.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -38,7 +38,7 @@ y_(y), tol_(tol) {} - bool pass(Feature & feature) + bool pass(feature_impl & feature) { BOOST_FOREACH(geometry_type & geom, feature.paths()) { diff -Nru mapnik-2.1.0/include/mapnik/image_filter.hpp mapnik-2.2.0/include/mapnik/image_filter.hpp --- mapnik-2.1.0/include/mapnik/image_filter.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/image_filter.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,16 +26,23 @@ //mapnik #include +#include + // boost +#include #include #include +#include + // agg #include "agg_basics.h" #include "agg_rendering_buffer.h" #include "agg_pixfmt_rgba.h" #include "agg_scanline_u.h" #include "agg_blur.h" - +#include "agg_gradient_lut.h" +// stl +#include // 8-bit YUV //Y = ( ( 66 * R + 129 * G + 25 * B + 128) >> 8) + 16 @@ -112,23 +119,51 @@ //convolve_rows_fixed(src_view,kernel,src_view); // convolve_cols_fixed(src_view,kernel,dst_view); -using namespace boost::gil; - namespace mapnik { namespace filter { namespace detail { -static const float blur_matrix[] = {0.1111,0.1111,0.1111,0.1111,0.1111,0.1111,0.1111,0.1111,0.1111}; +static const float blur_matrix[] = {0.1111f,0.1111f,0.1111f,0.1111f,0.1111f,0.1111f,0.1111f,0.1111f,0.1111f}; static const float emboss_matrix[] = {-2,-1,0,-1,1,1,0,1,2}; static const float sharpen_matrix[] = {0,-1,0,-1,5,-1,0,-1,0 }; static const float edge_detect_matrix[] = {0,1,0,1,-4,1,0,1,0 }; } +using boost::gil::rgba8_image_t; +using boost::gil::rgba8_view_t; + +template +boost::gil::rgba8_view_t rgba8_view(Image & img) +{ + using boost::gil::interleaved_view; + using boost::gil::rgba8_pixel_t; + return interleaved_view(img.width(), img.height(), + reinterpret_cast(img.raw_data()), + img.width() * sizeof(rgba8_pixel_t)); +} + +template +struct double_buffer +{ + boost::gil::rgba8_image_t dst_buffer; + boost::gil::rgba8_view_t dst_view; + boost::gil::rgba8_view_t src_view; + + explicit double_buffer(Image & src) + : dst_buffer(src.width(), src.height()) + , dst_view(view(dst_buffer)) + , src_view(rgba8_view(src)) {} + + ~double_buffer() + { + copy_pixels(dst_view, src_view); + } +}; template void process_channel_impl (Src const& src, Dst & dst, Conv const& k) { - using namespace boost::gil; - typedef boost::gil::bits32f bits_type; + using boost::gil::bits32f; + bits32f out_value = k[0]*src[0] + k[1]*src[1] + k[2]*src[2] + k[3]*src[3] + k[4]*src[4] + k[5]*src[5] + @@ -175,8 +210,7 @@ template void process_channel (Src const& src, Dst & dst, mapnik::filter::sobel) { - using namespace boost::gil; - typedef boost::gil::bits32f bits_type; + using boost::gil::bits32f; bits32f x_gradient = (src[2] + 2*src[5] + src[8]) - (src[0] + 2*src[3] + src[6]); @@ -193,9 +227,12 @@ -template -void apply_convolution_3x3(Src const& src_view, Dst & dst_view, FilterTag filter_tag) +template +void apply_convolution_3x3(Src const& src_view, Dst & dst_view, Filter const& filter) { + using boost::gil::bits32f; + using boost::gil::point2; + // p0 p1 p2 // p3 p4 p5 // p6 p7 p8 @@ -251,7 +288,7 @@ p[1] = p[7]; p[2] = p[8]; - process_channel(p, (*dst_it)[i], filter_tag); + process_channel(p, (*dst_it)[i], filter); } ++src_loc.x(); ++dst_it; @@ -298,7 +335,7 @@ p[5] = src_loc[loc21][i]; p[8] = src_loc[loc22][i]; } - process_channel(p, (*dst_it)[i], filter_tag); + process_channel(p, (*dst_it)[i], filter); } ++dst_it; ++src_loc.x(); @@ -346,39 +383,18 @@ p[7] = p[1]; p[8] = p[2]; - process_channel(p, (*dst_it)[i], filter_tag); + process_channel(p, (*dst_it)[i], filter); } ++src_loc.x(); ++dst_it; } } -template -void apply_filter(Src const& src, Dst & dst, FilterTag filter_tag) +template +void apply_filter(Src & src, Filter const& filter) { - using namespace boost::gil; - rgba8_view_t src_view = interleaved_view(src.width(),src.height(), - (rgba8_pixel_t*) src.raw_data(), - src.width()*4); - rgba8_view_t dst_view = interleaved_view(dst.width(),dst.height(), - (rgba8_pixel_t*) dst.raw_data(), - dst.width()*4); - - typedef boost::mpl::vector channels; - - apply_convolution_3x3(src_view,dst_view,filter_tag); -} - -template -void apply_filter(Src & src, FilterTag filter_tag) -{ - using namespace boost::gil; - rgba8_view_t src_view = interleaved_view(src.width(),src.height(), - (rgba8_pixel_t*) src.raw_data(), - src.width()*4); - rgba8_image_t temp_buffer(src_view.dimensions()); - apply_convolution_3x3(src_view,boost::gil::view(temp_buffer), filter_tag); - boost::gil::copy_pixels(view(temp_buffer), src_view); + double_buffer tb(src); + apply_convolution_3x3(tb.src_view, tb.dst_view, filter); } template @@ -389,17 +405,196 @@ agg::stack_blur_rgba32(pixf,op.rx,op.ry); } +template +void apply_filter(Src & src, colorize_alpha const& op) +{ + using namespace boost::gil; + + agg::gradient_lut > grad_lut; + grad_lut.remove_all(); + std::size_t size = op.size(); + if (size < 2) return; + + double step = 1.0/(size-1); + double offset = 0.0; + BOOST_FOREACH( mapnik::filter::color_stop const& stop, op) + { + mapnik::color const& c = stop.color; + double stop_offset = stop.offset; + if (stop_offset == 0) + { + stop_offset = offset; + } + grad_lut.add_color(stop_offset, agg::rgba(c.red()/256.0, + c.green()/256.0, + c.blue()/256.0, + c.alpha()/256.0)); + offset += step; + } + grad_lut.build_lut(); + + rgba8_view_t src_view = rgba8_view(src); + for (int y=0; y 0) + { + agg::rgba8 c = grad_lut[a]; + r = (c.r * a + 255) >> 8; + g = (c.g * a + 255) >> 8; + b = (c.b * a + 255) >> 8; +#if 0 + // rainbow + r = 0; + g = 0; + b = 0; + if (a < 64) + { + g = a * 4; + b = 255; + } + else if (a >= 64 && a < 128) + { + g = 255; + b = 255 - ((a - 64) * 4); + } + else if (a >= 128 && a < 192) + { + r = (a - 128) * 4; + g = 255; + } + else // >= 192 + { + r = 255; + g = 255 - ((a - 192) * 4); + } + r = (r * a + 255) >> 8; + g = (g * a + 255) >> 8; + b = (b * a + 255) >> 8; +#endif + } + } + } +} + +/* +template +void apply_filter(Src & src, hsla const& transform) +{ + using namespace boost::gil; + bool tinting = !transform.is_identity(); + bool set_alpha = !transform.is_alpha_identity(); + // todo - filters be able to report if they + // should be run to avoid overhead of temp buffer + if (tinting || set_alpha) + { + rgba8_view_t src_view = rgba8_view(src); + for (int y=0; y 0.01) + { + a2 = transform.a0 + (a2 * (transform.a1 - transform.a0)); + a = static_cast(std::floor((a2 * 255.0) +.5)); + if (a > 255) a = 255; + if (a < 0) a = 0; + } + if (tinting && a2 > 0.01) + { + double h; + double s; + double l; + // demultiply + if (a1 <= 0.0) + { + r = g = b = 0; + continue; + } + else if (a1 < 1) + { + r /= a1; + g /= a1; + b /= a1; + } + rgb2hsl(r,g,b,h,s,l); + double h2 = transform.h0 + (h * (transform.h1 - transform.h0)); + double s2 = transform.s0 + (s * (transform.s1 - transform.s0)); + double l2 = transform.l0 + (l * (transform.l1 - transform.l0)); + if (h2 > 1) { std::clog << "h2: " << h2 << "\n"; h2 = 1; } + else if (h2 < 0) { std::clog << "h2: " << h2 << "\n"; h2 = 0; } + if (s2 > 1) { std::clog << "h2: " << h2 << "\n"; s2 = 1; } + else if (s2 < 0) { std::clog << "s2: " << s2 << "\n"; s2 = 0; } + if (l2 > 1) { std::clog << "h2: " << h2 << "\n"; l2 = 1; } + else if (l2 < 0) { std::clog << "l2: " << l2 << "\n"; l2 = 0; } + hsl2rgb(h2,s2,l2,r,g,b); + // premultiply + // we only work with premultiplied source, + // thus all color values must be <= alpha + r *= a2; + g *= a2; + b *= a2; + } + else + { + // demultiply + if (a1 <= 0.0) + { + r = g = b = 0; + continue; + } + else if (a1 < 1) + { + r /= a1; + g /= a1; + b /= a1; + } + // premultiply + // we only work with premultiplied source, + // thus all color values must be <= alpha + r *= a2; + g *= a2; + b *= a2; + } + } + } + } +} +*/ template -void apply_filter(Src & src, gray) +void apply_filter(Src & src, gray const& op) { using namespace boost::gil; - typedef pixel::type, gray_layout_t> gray_pixel_t; - rgba8_view_t src_view = interleaved_view(src.width(),src.height(), - (rgba8_pixel_t*) src.raw_data(), - src.width()*4); - boost::gil::copy_and_convert_pixels(color_converted_view(src_view), src_view); + rgba8_view_t src_view = rgba8_view(src); + + for (int y=0; y> 14); + r = g = b = v; + } + } } template @@ -431,51 +626,41 @@ } template -void apply_filter(Src & src, x_gradient) +void apply_filter(Src & src, x_gradient const& op) { - using namespace boost::gil; - - rgba8_view_t src_view = interleaved_view(src.width(),src.height(), - (rgba8_pixel_t*) src.raw_data(), - src.width()*4); - - rgba8_image_t temp_buffer(src_view.dimensions()); - rgba8_view_t dst_view = view(temp_buffer); - - x_gradient_impl(src_view, dst_view); - boost::gil::copy_pixels(view(temp_buffer), src_view); + double_buffer tb(src); + x_gradient_impl(tb.src_view, tb.dst_view); } template -void apply_filter(Src & src, y_gradient) +void apply_filter(Src & src, y_gradient const& op) { - using namespace boost::gil; - rgba8_view_t src_view = interleaved_view(src.width(),src.height(), - (rgba8_pixel_t*) src.raw_data(), - src.width()*4); - rgba8_image_t temp_buffer(src_view.dimensions()); - rgba8_view_t dst_view = view(temp_buffer); - x_gradient_impl(rotated90ccw_view(src_view), rotated90ccw_view(dst_view)); - boost::gil::copy_pixels(view(temp_buffer), src_view); + double_buffer tb(src); + x_gradient_impl(rotated90ccw_view(tb.src_view), + rotated90ccw_view(tb.dst_view)); } template -void apply_filter(Src & src, invert) +void apply_filter(Src & src, invert const& op) { using namespace boost::gil; - rgba8_view_t src_view = interleaved_view(src.width(),src.height(), - (rgba8_pixel_t*) src.raw_data(), - src.width()*4); + rgba8_view_t src_view = rgba8_view(src); + for (int y=0; y - void operator () (T const& filter_tag) + void operator () (T const& filter) { - apply_filter(src_,filter_tag); + apply_filter(src_, filter); } Src & src_; diff -Nru mapnik-2.1.0/include/mapnik/image_filter_grammar.hpp mapnik-2.2.0/include/mapnik/image_filter_grammar.hpp --- mapnik-2.1.0/include/mapnik/image_filter_grammar.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/image_filter_grammar.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,22 +25,56 @@ // boost #include - +#include +// mapnik +#include +#include // stl #include +BOOST_FUSION_ADAPT_STRUCT( + mapnik::filter::color_stop, + (mapnik::color, color ) + (double, offset) +) + namespace mapnik { namespace qi = boost::spirit::qi; +struct percent_offset_impl +{ + template + struct result + { + typedef double type; + }; + + double operator() (double val) const + { + double result = std::abs(val/100.0); + if (result > 1.0) result = 1.0; + return result; + } +}; + + template struct image_filter_grammar : qi::grammar { image_filter_grammar(); qi::rule start; - qi::rule, qi::ascii::space_type> filter; + qi::rule filter; + qi::rule, void(ContType&), qi::ascii::space_type> agg_blur_filter; + //qi::rule, + // void(ContType&), qi::ascii::space_type> hsla_filter; + qi::rule, void(ContType&), qi::ascii::space_type> colorize_alpha_filter; + qi::rule no_args; qi::uint_parser< unsigned, 10, 1, 3 > radius_; + css_color_grammar css_color_; + qi::rule color_stop_offset; + phoenix::function percent_offset; }; } diff -Nru mapnik-2.1.0/include/mapnik/image_filter_types.hpp mapnik-2.2.0/include/mapnik/image_filter_types.hpp --- mapnik-2.1.0/include/mapnik/image_filter_types.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/image_filter_types.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,12 +23,16 @@ #ifndef MAPNIK_IMAGE_FILTER_TYPES_HPP #define MAPNIK_IMAGE_FILTER_TYPES_HPP +// mapnik +#include +#include // boost #include -#include -#include +#include // stl -#include +#include +#include +#include // for std::back_insert_iterator namespace mapnik { namespace filter { @@ -50,6 +54,66 @@ unsigned ry; }; +/* +struct hsla +{ + hsla(double _h0, double _h1, + double _s0, double _s1, + double _l0, double _l1, + double _a0, double _a1) : + h0(_h0), + h1(_h1), + s0(_s0), + s1(_s1), + l0(_l0), + l1(_l1), + a0(_a0), + a1(_a1) {} + inline bool is_identity() const { + return (h0 == 0 && + h1 == 1 && + s0 == 0 && + s1 == 1 && + l0 == 0 && + l1 == 1); + } + inline bool is_alpha_identity() const { + return (a0 == 0 && + a1 == 1); + } + std::string to_string() const { + std::ostringstream s; + s << h0 << "x" << h1 << ";" + << s0 << "x" << s1 << ";" + << l0 << "x" << l1 << ";" + << a0 << "x" << a1; + return s.str(); + } + double h0; + double h1; + double s0; + double s1; + double l0; + double l1; + double a0; + double a1; +}; +*/ + +struct color_stop +{ + color_stop() {} + color_stop(mapnik::color const& c, double val = 0.0) + : color(c),offset(val) {} + mapnik::color color; + double offset; +}; + +struct colorize_alpha : std::vector +{ + colorize_alpha() {} +}; + typedef boost::variant filter_type; + filter::invert, + //filter::hsla, + filter::colorize_alpha> filter_type; inline std::ostream& operator<< (std::ostream& os, blur) { @@ -75,9 +141,20 @@ inline std::ostream& operator<< (std::ostream& os, agg_stack_blur const& filter) { - os << "agg-stack-blur:" << filter.rx << ',' << filter.ry; + os << "agg-stack-blur(" << filter.rx << ',' << filter.ry << ')'; + return os; +} + +/* +inline std::ostream& operator<< (std::ostream& os, hsla const& filter) +{ + os << "hsla(" << filter.h0 << 'x' << filter.h1 << ':' + << filter.s0 << 'x' << filter.s1 << ':' + << filter.l0 << 'x' << filter.l1 << ':' + << filter.a0 << 'x' << filter.a1 << ')'; return os; } +*/ inline std::ostream& operator<< (std::ostream& os, emboss) { @@ -121,36 +198,11 @@ return os; } -template -struct to_string_visitor : boost::static_visitor -{ - to_string_visitor(Out & out) - : out_(out) {} +inline std::ostream& operator<< (std::ostream& os, filter_type const& filter); - template - void operator () (T const& filter_tag) - { - out_ << filter_tag; - } - - Out & out_; -}; +MAPNIK_DECL bool generate_image_filters(std::back_insert_iterator & sink, std::vector const& v); -inline std::ostream& operator<< (std::ostream& os, filter_type const& filter) -{ - to_string_visitor visitor(os); - boost::apply_visitor(visitor, filter); - return os; -} - -template -bool generate_image_filters(OutputIterator& sink, Container const& v) -{ - using boost::spirit::karma::stream; - using boost::spirit::karma::generate; - bool r = generate(sink, stream % ' ', v); - return r; -} +MAPNIK_DECL bool parse_image_filters(std::string const& filters, std::vector& image_filters); }} diff -Nru mapnik-2.1.0/include/mapnik/image_reader.hpp mapnik-2.2.0/include/mapnik/image_reader.hpp --- mapnik-2.1.0/include/mapnik/image_reader.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/image_reader.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,19 +26,23 @@ // mapnik #include #include - +#include +#include +// boost +#include // stl #include #include namespace mapnik { + class image_reader_exception : public std::exception { private: std::string message_; public: - image_reader_exception(const std::string& message) + image_reader_exception(std::string const& message) : message_(message) {} ~image_reader_exception() throw() {} @@ -49,17 +53,21 @@ } }; -struct MAPNIK_DECL image_reader +struct MAPNIK_DECL image_reader : private mapnik::noncopyable { virtual unsigned width() const=0; virtual unsigned height() const=0; + virtual bool premultiplied_alpha() const=0; virtual void read(unsigned x,unsigned y,image_data_32& image)=0; virtual ~image_reader() {} }; -bool register_image_reader(const std::string& type,image_reader* (*)(const std::string&)); -MAPNIK_DECL image_reader* get_image_reader(const std::string& file,const std::string& type); -MAPNIK_DECL image_reader* get_image_reader(const std::string& file); +bool register_image_reader(std::string const& type,image_reader* (*)(std::string const&)); +bool register_image_reader(std::string const& type,image_reader* (*)(char const*, std::size_t)); + +MAPNIK_DECL image_reader* get_image_reader(std::string const& file,std::string const& type); +MAPNIK_DECL image_reader* get_image_reader(std::string const& file); +MAPNIK_DECL image_reader* get_image_reader(char const* data, size_t size); } diff -Nru mapnik-2.1.0/include/mapnik/image_scaling.hpp mapnik-2.2.0/include/mapnik/image_scaling.hpp --- mapnik-2.1.0/include/mapnik/image_scaling.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/image_scaling.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -61,11 +61,11 @@ void scale_image_agg(Image & target, Image const& source, scaling_method_e scaling_method, - double scale_factor, + double image_ratio_x, + double image_ratio_y, double x_off_f=0, double y_off_f=0, - double filter_radius=2, - double ratio=1); + double filter_radius=2); template void scale_image_bilinear_old(Image & target, diff -Nru mapnik-2.1.0/include/mapnik/image_util.hpp mapnik-2.2.0/include/mapnik/image_util.hpp --- mapnik-2.1.0/include/mapnik/image_util.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/image_util.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,28 +25,32 @@ // mapnik #include -#include #ifdef _MSC_VER #include #endif // boost -#include +#include #include // stl #include +#include namespace mapnik { +// fwd declares class Map; +class rgba_palette; +class image_32; + class ImageWriterException : public std::exception { private: std::string message_; public: - ImageWriterException(const std::string& message) + ImageWriterException(std::string const& message) : message_(message) {} ~ImageWriterException() throw() {} @@ -60,6 +64,9 @@ #if defined(HAVE_CAIRO) MAPNIK_DECL void save_to_cairo_file(mapnik::Map const& map, std::string const& filename, + double scale_factor=1.0); +MAPNIK_DECL void save_to_cairo_file(mapnik::Map const& map, + std::string const& filename, std::string const& type, double scale_factor=1.0); #endif @@ -188,7 +195,6 @@ /////////// save_to_file //////////////////////////////////////////////// -class image_32; MAPNIK_DECL void save_to_file(image_32 const& image, std::string const& file); diff -Nru mapnik-2.1.0/include/mapnik/internal/dump_xml.hpp mapnik-2.2.0/include/mapnik/internal/dump_xml.hpp --- mapnik-2.1.0/include/mapnik/internal/dump_xml.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/internal/dump_xml.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -1,6 +1,7 @@ #ifndef DUMP_XML_HPP #define DUMP_XML_HPP #include + namespace mapnik { diff -Nru mapnik-2.1.0/include/mapnik/jpeg_io.hpp mapnik-2.2.0/include/mapnik/jpeg_io.hpp --- mapnik-2.1.0/include/mapnik/jpeg_io.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/jpeg_io.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -35,10 +35,10 @@ #include } -namespace mapnik { - #define BUFFER_SIZE 4096 +namespace jpeg_detail { + typedef struct { struct jpeg_destination_mgr pub; @@ -76,6 +76,10 @@ dest->out->flush(); } +} + +namespace mapnik { + template void save_as_jpeg(T1 & file,int quality, T2 const& image) { @@ -89,11 +93,11 @@ jpeg_create_compress(&cinfo); cinfo.dest = (struct jpeg_destination_mgr *)(*cinfo.mem->alloc_small) - ((j_common_ptr) &cinfo, JPOOL_PERMANENT, sizeof(dest_mgr)); - dest_mgr * dest = (dest_mgr*) cinfo.dest; - dest->pub.init_destination = init_destination; - dest->pub.empty_output_buffer = empty_output_buffer; - dest->pub.term_destination = term_destination; + ((j_common_ptr) &cinfo, JPOOL_PERMANENT, sizeof(jpeg_detail::dest_mgr)); + jpeg_detail::dest_mgr * dest = (jpeg_detail::dest_mgr*) cinfo.dest; + dest->pub.init_destination = jpeg_detail::init_destination; + dest->pub.empty_output_buffer = jpeg_detail::empty_output_buffer; + dest->pub.term_destination = jpeg_detail::term_destination; dest->out = &file; //jpeg_stdio_dest(&cinfo, fp); diff -Nru mapnik-2.1.0/include/mapnik/json/feature_collection_grammar.hpp mapnik-2.2.0/include/mapnik/json/feature_collection_grammar.hpp --- mapnik-2.1.0/include/mapnik/json/feature_collection_grammar.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/json/feature_collection_grammar.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,17 +24,13 @@ #define MAPNIK_FEATURE_COLLECTION_GRAMMAR_HPP // mapnik +#include #include +#include // spirit::qi -#include #include #include -#include -#include - -// stl -#include namespace mapnik { namespace json { @@ -91,7 +87,7 @@ > lit(']') ; - feature = eps[_a = construct(new_(ctx_,generate_id_()))] + feature = eps[_a = phoenix::construct(new_(ctx_,generate_id_()))] >> feature_g(*_a)[push_back(_r1,_a)] ; diff -Nru mapnik-2.1.0/include/mapnik/json/feature_collection_parser.hpp mapnik-2.2.0/include/mapnik/json/feature_collection_parser.hpp --- mapnik-2.1.0/include/mapnik/json/feature_collection_parser.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/json/feature_collection_parser.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,11 +26,12 @@ // mapnik #include #include -#include +#include +#include // boost #include -#include + // stl #include @@ -39,16 +40,16 @@ template struct feature_collection_grammar; template -class feature_collection_parser : private boost::noncopyable +class MAPNIK_DECL feature_collection_parser : private mapnik::noncopyable { typedef Iterator iterator_type; - typedef mapnik::Feature feature_type; + typedef mapnik::feature_impl feature_type; public: feature_collection_parser(mapnik::context_ptr const& ctx, mapnik::transcoder const& tr); ~feature_collection_parser(); - bool parse(iterator_type first, iterator_type last, std::vector & features); + bool parse(iterator_type first, iterator_type last, std::vector & features); private: - boost::scoped_ptr > grammar_; + boost::scoped_ptr > grammar_; }; }} diff -Nru mapnik-2.1.0/include/mapnik/json/feature_generator_grammar.hpp mapnik-2.2.0/include/mapnik/json/feature_generator_grammar.hpp --- mapnik-2.1.0/include/mapnik/json/feature_generator_grammar.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/json/feature_generator_grammar.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,6 +25,7 @@ // mapnik #include +#include #include #include #include @@ -43,29 +44,29 @@ namespace boost { namespace spirit { namespace traits { template <> -struct is_container : mpl::false_ {} ; +struct is_container : mpl::false_ {} ; template <> -struct container_iterator +struct container_iterator { typedef mapnik::feature_kv_iterator2 type; }; template <> -struct begin_container +struct begin_container { static mapnik::feature_kv_iterator2 - call (mapnik::Feature const& f) + call (mapnik::feature_impl const& f) { return mapnik::feature_kv_iterator2(mapnik::value_not_null(),f.begin(),f.end()); } }; template <> -struct end_container +struct end_container { static mapnik::feature_kv_iterator2 - call (mapnik::Feature const& f) + call (mapnik::feature_impl const& f) { return mapnik::feature_kv_iterator2(mapnik::value_not_null(),f.end(),f.end()); } @@ -94,7 +95,7 @@ template struct result { typedef int type; }; - int operator() (mapnik::Feature const& f) const + int operator() (mapnik::feature_impl const& f) const { return f.id(); } @@ -107,7 +108,7 @@ template struct result { typedef properties_range_type type; }; - properties_range_type operator() (mapnik::Feature const& f) const + properties_range_type operator() (mapnik::feature_impl const& f) const { return boost::make_iterator_range(f.begin(),f.end()); } @@ -148,9 +149,14 @@ using boost::spirit::karma::maxwidth; using boost::spirit::karma::right_align; - esc_char.add('\a', "\\a")('\b', "\\b")('\f', "\\f")('\n', "\\n") - ('\r', "\\r")('\t', "\\t")('\v', "\\v")('\\', "\\\\") - ('\'', "\\\'")('\"', "\\\"") + esc_char.add + ('"', "\\\"") + ('\\', "\\\\") + ('\b', "\\b") + ('\f', "\\f") + ('\n', "\\n") + ('\r', "\\r") + ('\t', "\\t") ; esc_str = karma::lit(karma::_r1) @@ -168,7 +174,7 @@ template struct feature_generator_grammar: - karma::grammar + karma::grammar { typedef boost::tuple pair_type; typedef make_properties_range::properties_range_type range_type; @@ -181,7 +187,8 @@ using boost::spirit::karma::lit; using boost::spirit::karma::uint_; using boost::spirit::karma::bool_; - using boost::spirit::karma::int_; + //using boost::spirit::karma::int_; + //using boost::spirit::karma::long_long; using boost::spirit::karma::double_; using boost::spirit::karma::_val; using boost::spirit::karma::_1; @@ -207,7 +214,7 @@ << value(phoenix::at_c<1>(_val)) ; - value = (value_null_| bool_ | int_| double_ | ustring)[_1 = value_base_(_r1)] + value = (value_null_| bool_ | int__ | double_ | ustring)[_1 = value_base_(_r1)] ; value_null_ = string[_1 = "null"] @@ -218,14 +225,15 @@ } // rules - karma::rule feature; + karma::rule feature; multi_geometry_generator_grammar geometry; escaped_string escaped_string_; - karma::rule properties; + karma::rule properties; karma::rule pair; karma::rule value; karma::rule value_null_; karma::rule ustring; + typename karma::int_generator int__; // phoenix functions phoenix::function id_; phoenix::function value_base_; diff -Nru mapnik-2.1.0/include/mapnik/json/feature_grammar.hpp mapnik-2.2.0/include/mapnik/json/feature_grammar.hpp --- mapnik-2.1.0/include/mapnik/json/feature_grammar.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/json/feature_grammar.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,16 +26,16 @@ // mapnik #include #include +#include +#include +#include // spirit::qi -#include +#include +#include #include #include -#include -#include - -// stl -#include +#include namespace mapnik { namespace json { @@ -62,6 +62,7 @@ { return mapnik::value(val); } + mapnik::transcoder const& tr_; }; @@ -112,9 +113,11 @@ qi::rule value; qi::symbols unesc_char; qi::uint_parser< unsigned, 16, 4, 4 > hex4 ; + qi::int_parser int__; qi::rule string_; qi::rule key_value; - qi::rule(),space_type> number; + qi::rule(),space_type> number; qi::rule object; qi::rule array; qi::rule pairs; @@ -126,10 +129,11 @@ qi::rule properties; qi::rule, void(FeatureType &),space_type> attributes; - qi::rule(), space_type> attribute_value; + qi::rule(), space_type> attribute_value; phoenix::function put_property_; phoenix::function extract_geometry_; + boost::phoenix::function where_message_; geometry_grammar geometry_grammar_; }; diff -Nru mapnik-2.1.0/include/mapnik/json/geojson_generator.hpp mapnik-2.2.0/include/mapnik/json/geojson_generator.hpp --- mapnik-2.1.0/include/mapnik/json/geojson_generator.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/json/geojson_generator.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,9 +25,11 @@ #include #include +#include + #include -#include #include +#include namespace mapnik { namespace json { @@ -36,18 +38,18 @@ template struct feature_generator_grammar; template struct multi_geometry_generator_grammar; -class MAPNIK_DECL feature_generator : private boost::noncopyable +class MAPNIK_DECL feature_generator : private mapnik::noncopyable { typedef std::back_insert_iterator sink_type; public: feature_generator(); ~feature_generator(); - bool generate(std::string & geojson, mapnik::Feature const& f); + bool generate(std::string & geojson, mapnik::feature_impl const& f); private: boost::scoped_ptr > grammar_; }; -class MAPNIK_DECL geometry_generator : private boost::noncopyable +class MAPNIK_DECL geometry_generator : private mapnik::noncopyable { typedef std::back_insert_iterator sink_type; public: @@ -60,15 +62,15 @@ #else -class MAPNIK_DECL feature_generator : private boost::noncopyable +class MAPNIK_DECL feature_generator : private mapnik::noncopyable { public: feature_generator() {} ~feature_generator() {} - bool generate(std::string & geojson, mapnik::Feature const& f); + bool generate(std::string & geojson, mapnik::feature_impl const& f); }; -class MAPNIK_DECL geometry_generator : private boost::noncopyable +class MAPNIK_DECL geometry_generator : private mapnik::noncopyable { public: geometry_generator() {} diff -Nru mapnik-2.1.0/include/mapnik/json/geometry_generator_grammar.hpp mapnik-2.2.0/include/mapnik/json/geometry_generator_grammar.hpp --- mapnik-2.1.0/include/mapnik/json/geometry_generator_grammar.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/json/geometry_generator_grammar.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,8 +26,9 @@ // mapnik #include #include -#include +#include #include +#include // for CommandType::SEG_MOVETO // boost #include @@ -36,8 +37,9 @@ #include #include #include -#include +#include #include +#include // trunc to avoid needing C++11 //#define BOOST_SPIRIT_USE_PHOENIX_V3 1 @@ -116,7 +118,28 @@ { typedef boost::spirit::karma::real_policies base_type; static int floatfield(T n) { return base_type::fmtflags::fixed; } - static unsigned precision(T n) { return 12 ;} + + static unsigned precision(T n) + { + if (n == 0.0) return 0; + using namespace boost::spirit; + return static_cast(15 - boost::math::trunc(log10(traits::get_absolute_value(n)))); + } + + template + static bool dot(OutputIterator& sink, T n, unsigned precision) + { + if (n == 0) return true; + return base_type::dot(sink, n, precision); + } + + template + static bool fraction_part(OutputIterator& sink, T n + , unsigned adjprec, unsigned precision) + { + if (n == 0) return true; + return base_type::fraction_part(sink, n, adjprec, precision); + } }; } @@ -136,15 +159,14 @@ using boost::spirit::karma::_a; using boost::spirit::karma::_r1; using boost::spirit::karma::eps; - using boost::spirit::karma::string; - + coordinates = point | linestring | polygon ; - + point = &uint_(mapnik::Point)[_1 = _type(_val)] << point_coord [_1 = _first(_val)] ; - + linestring = &uint_(mapnik::LineString)[_1 = _type(_val)] << lit('[') << coords @@ -156,39 +178,39 @@ << coords2 << lit("]]") ; - - point_coord = &uint_ - << lit('[') + + point_coord = &uint_ + << lit('[') << coord_type << lit(',') << coord_type << lit("]") ; - + polygon_coord %= ( &uint_(mapnik::SEG_MOVETO) << eps[_r1 += 1] - << string[ if_ (_r1 > 1) [_1 = "],["] + << karma::string[ if_ (_r1 > 1) [_1 = "],["] .else_[_1 = '[' ]] | &uint_ << lit(',')) << lit('[') << coord_type << lit(',') << coord_type << lit(']') ; - + coords2 %= *polygon_coord(_a) ; - + coords = point_coord % lit(',') ; - + } // rules karma::rule coordinates; karma::rule point; karma::rule linestring; karma::rule polygon; - + karma::rule coords; karma::rule, geometry_type const& ()> coords2; karma::rule point_coord; karma::rule polygon_coord; - + // phoenix functions phoenix::function _type; phoenix::function _first; @@ -200,7 +222,7 @@ template struct multi_geometry_generator_grammar : - karma::grammar >, + karma::grammar >, geometry_container const& ()> { @@ -213,7 +235,6 @@ using boost::spirit::karma::_1; using boost::spirit::karma::_a; using boost::spirit::karma::_r1; - using boost::spirit::karma::string; geometry_types.add (mapnik::Point,"\"Point\"") @@ -223,36 +244,36 @@ (mapnik::LineString + 3,"\"MultiLineString\"") (mapnik::Polygon + 3,"\"MultiPolygon\"") ; - - start %= ( eps(phoenix::at_c<1>(_a))[_a = _multi_type(_val)] + + start %= ( eps(phoenix::at_c<1>(_a))[_a = _multi_type(_val)] << lit("{\"type\":\"GeometryCollection\",\"geometries\":[") << geometry_collection << lit("]}") | - geometry) + geometry) ; - + geometry_collection = -(geometry2 % lit(',')) ; - - geometry = (lit("{\"type\":") - << geometry_types[_1 = phoenix::at_c<0>(_a)][_a = _multi_type(_val)] + + geometry = (lit("{\"type\":") + << geometry_types[_1 = phoenix::at_c<0>(_a)][_a = _multi_type(_val)] << lit(",\"coordinates\":") - << string[ if_ (phoenix::at_c<0>(_a) > 3) [_1 = '[']] + << karma::string[ if_ (phoenix::at_c<0>(_a) > 3) [_1 = '[']] << coordinates - << string[ if_ (phoenix::at_c<0>(_a) > 3) [_1 = ']']] - << lit('}')) | lit("null") + << karma::string[ if_ (phoenix::at_c<0>(_a) > 3) [_1 = ']']] + << lit('}')) | lit("null") ; - - geometry2 = lit("{\"type\":") + + geometry2 = lit("{\"type\":") << geometry_types[_1 = _a][_a = type_(_val)] << lit(",\"coordinates\":") << path - << lit('}') + << lit('}') ; - + coordinates %= path % lit(',') ; - + } // rules karma::rule >, diff -Nru mapnik-2.1.0/include/mapnik/json/geometry_grammar.hpp mapnik-2.2.0/include/mapnik/json/geometry_grammar.hpp --- mapnik-2.1.0/include/mapnik/json/geometry_grammar.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/json/geometry_grammar.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,23 +24,16 @@ #define MAPNIK_GEOMETRY_GRAMMAR_HPP // mapnik -#include +#include // for geometry_type +#include // for CommandType // spirit::qi -#include #include -#include -#include -#include - -// stl -#include +#include namespace mapnik { namespace json { namespace qi = boost::spirit::qi; -namespace phoenix = boost::phoenix; -namespace fusion = boost::fusion; namespace standard_wide = boost::spirit::standard_wide; using standard_wide::space_type; @@ -72,7 +65,7 @@ void operator() (T path) const { BOOST_ASSERT( path!=0 ); - path->close(); + path->close_path(); } }; @@ -91,6 +84,25 @@ } }; +struct where_message +{ + template + struct result + { + typedef std::string type; + }; + + template + std::string operator() (Iterator first, Iterator last, std::size_t size) const + { + std::string str(first, last); + if (str.length() > size) + return str.substr(0, size) + "..." ; + return str; + } +}; + + template struct geometry_grammar : qi::grammar, void(boost::ptr_vector& ) @@ -125,6 +137,7 @@ boost::phoenix::function push_vertex_; boost::phoenix::function close_path_; boost::phoenix::function cleanup_; + boost::phoenix::function where_message_; }; }} diff -Nru mapnik-2.1.0/include/mapnik/json/geometry_parser.hpp mapnik-2.2.0/include/mapnik/json/geometry_parser.hpp --- mapnik-2.1.0/include/mapnik/json/geometry_parser.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/json/geometry_parser.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,10 +26,11 @@ // mapnik #include #include +#include // boost #include -#include + // stl //#include @@ -40,7 +41,7 @@ MAPNIK_DECL bool from_geojson(std::string const& json, boost::ptr_vector & paths); template -class geometry_parser : private boost::noncopyable +class MAPNIK_DECL geometry_parser : private mapnik::noncopyable { typedef Iterator iterator_type; public: diff -Nru mapnik-2.1.0/include/mapnik/label_collision_detector.hpp mapnik-2.2.0/include/mapnik/label_collision_detector.hpp --- mapnik-2.1.0/include/mapnik/label_collision_detector.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/label_collision_detector.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,6 +25,7 @@ // mapnik #include +#include // stl #include @@ -63,7 +64,7 @@ }; // quad_tree based label collision detector -class label_collision_detector2 : boost::noncopyable +class label_collision_detector2 : mapnik::noncopyable { typedef quad_tree > tree_t; tree_t tree_; @@ -97,7 +98,7 @@ }; // quad_tree based label collision detector with seperate check/insert -class label_collision_detector3 : boost::noncopyable +class label_collision_detector3 : mapnik::noncopyable { typedef quad_tree< box2d > tree_t; tree_t tree_; @@ -135,7 +136,7 @@ //quad tree based label collision detector so labels dont appear within a given distance -class label_collision_detector4 : boost::noncopyable +class label_collision_detector4 : mapnik::noncopyable { public: struct label diff -Nru mapnik-2.1.0/include/mapnik/layer.hpp mapnik-2.2.0/include/mapnik/layer.hpp --- mapnik-2.1.0/include/mapnik/layer.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/layer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,6 +26,7 @@ // mapnik #include #include +#include // stl #include @@ -44,10 +45,10 @@ { public: layer(std::string const& name, - std::string const& srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"); + std::string const& srs=MAPNIK_LONGLAT_PROJ); layer(layer const& l); - layer& operator=(layer const& l); + layer& operator=(layer const& rhs); bool operator==(layer const& other) const; /*! @@ -90,7 +91,7 @@ std::vector& styles(); /*! - * @param max_zoom The minimum zoom level to set + * @param min_zoom The minimum zoom level to set */ void set_min_zoom(double min_zoom); @@ -136,7 +137,7 @@ * * @return true if this layer's data is active and visible at a given scale. * Otherwise returns False. - * @return false if: + * false if: * scale >= minzoom - 1e-6 * or * scale < maxzoom + 1e-6 @@ -154,7 +155,7 @@ bool clear_label_cache() const; /*! - * @param clear_cache Set whether this layer's features should be cached if used by multiple styles. + * @param cache_features Set whether this layer's features should be cached if used by multiple styles. */ void set_cache_features(bool cache_features); @@ -164,7 +165,7 @@ bool cache_features() const; /*! - * @param group_by Set the field rendering of this layer is grouped by. + * @param column Set the field rendering of this layer is grouped by. */ void set_group_by(std::string column); @@ -194,10 +195,11 @@ boost::optional > const& maximum_extent() const; void reset_maximum_extent(); void set_buffer_size(int size); - int buffer_size() const; + boost::optional const& buffer_size() const; + void reset_buffer_size(); ~layer(); private: - void swap(const layer& other); + void swap(layer& other); std::string name_; std::string srs_; @@ -211,7 +213,7 @@ std::string group_by_; std::vector styles_; datasource_ptr ds_; - int buffer_size_; + boost::optional buffer_size_; boost::optional > maximum_extent_; }; } diff -Nru mapnik-2.1.0/include/mapnik/line_pattern_symbolizer.hpp mapnik-2.2.0/include/mapnik/line_pattern_symbolizer.hpp --- mapnik-2.1.0/include/mapnik/line_pattern_symbolizer.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/line_pattern_symbolizer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,8 +24,9 @@ #define MAPNIK_LINE_PATTERN_SYMBOLIZER_HPP // mapnik +#include #include -//#include +#include namespace mapnik { diff -Nru mapnik-2.1.0/include/mapnik/line_symbolizer.hpp mapnik-2.2.0/include/mapnik/line_symbolizer.hpp --- mapnik-2.1.0/include/mapnik/line_symbolizer.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/line_symbolizer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,6 +24,8 @@ #define MAPNIK_LINE_SYMBOLIZER_HPP // mapnik +#include +#include #include #include #include diff -Nru mapnik-2.1.0/include/mapnik/load_map.hpp mapnik-2.2.0/include/mapnik/load_map.hpp --- mapnik-2.1.0/include/mapnik/load_map.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/load_map.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -32,7 +32,7 @@ namespace mapnik { -MAPNIK_DECL void load_map(Map & map, std::string const& filename, bool strict = false); +MAPNIK_DECL void load_map(Map & map, std::string const& filename, bool strict = false, std::string base_path=""); MAPNIK_DECL void load_map_string(Map & map, std::string const& str, bool strict = false, std::string base_path=""); } diff -Nru mapnik-2.1.0/include/mapnik/map.hpp mapnik-2.2.0/include/mapnik/map.hpp --- mapnik-2.1.0/include/mapnik/map.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/map.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,11 +24,13 @@ #define MAPNIK_MAP_HPP // mapnik +#include +#include #include -#include -#include +#include // for featureset_ptr #include #include +#include // boost #include @@ -36,6 +38,7 @@ namespace mapnik { +class feature_type_style; class CoordTransform; class MAPNIK_DECL Map @@ -103,20 +106,20 @@ * @param height Initial map height. * @param srs Initial map projection. */ - Map(int width, int height, std::string const& srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"); + Map(int width, int height, std::string const& srs=MAPNIK_LONGLAT_PROJ); /*! \brief Copy Constructur. * * @param rhs Map to copy from. */ - Map(const Map& rhs); + Map(Map const& rhs); /*! \brief Assignment operator * * TODO: to be documented * */ - Map& operator=(const Map& rhs); + Map& operator=(Map const& rhs); /*! \brief Get all styles * @return Const reference to styles @@ -152,14 +155,14 @@ * @param name The name of the style. * @param style The style to insert. * @return true If success. - * @return false If no success. + * false If no success. */ bool insert_style(std::string const& name,feature_type_style const& style); /*! \brief Remove a style from the map. * @param name The name of the style. */ - void remove_style(const std::string& name); + void remove_style(std::string const& name); /*! \brief Find a style. * @param name The name of the style. @@ -169,9 +172,9 @@ /*! \brief Insert a fontset into the map. * @param name The name of the fontset. - * @param style The fontset to insert. + * @param fontset The fontset to insert. * @return true If success. - * @return false If failure. + * false If failure. */ bool insert_fontset(std::string const& name, font_set const& fontset); @@ -198,13 +201,13 @@ /*! \brief Add a layer to the map. * @param l The layer to add. */ - void addLayer(const layer& l); + void addLayer(layer const& l); /*! \brief Get a layer. * @param index layer number. * @return Constant layer. */ - const layer& getLayer(size_t index) const; + layer const& getLayer(size_t index) const; /*! \brief Get a layer. * @param index layer number. @@ -264,7 +267,7 @@ /*! \brief Set the map background color. * @param c Background color. */ - void set_background(const color& c); + void set_background(color const& c); /*! \brief Get the map background color * @return Background color as boost::optional @@ -273,7 +276,7 @@ boost::optional const& background() const; /*! \brief Set the map background image filename. - * @param c Background image filename. + * @param image_filename Background image filename. */ void set_background_image(std::string const& image_filename); @@ -309,8 +312,8 @@ */ std::string const& base_path() const; - /*! \brief Set the map base path where paths should be releative to. - * @param srs Map base_path. + /*! \brief Set the map base path where paths should be relative to. + * @param base Map base_path. */ void set_base_path(std::string const& base); @@ -324,7 +327,7 @@ * Aspect is handled automatic if not fitting to width/height. * @param box The bounding box where to zoom. */ - void zoom_to_box(const box2d& box); + void zoom_to_box(box2d const& box); /*! \brief Zoom the map to show all data. */ @@ -337,7 +340,7 @@ /*! \brief Get current bounding box. * @return The current bounding box. */ - const box2d& get_current_extent() const; + box2d const& get_current_extent() const; /*! \brief Get current buffered bounding box. * @return The current buffered bounding box. diff -Nru mapnik-2.1.0/include/mapnik/mapped_memory_cache.hpp mapnik-2.2.0/include/mapnik/mapped_memory_cache.hpp --- mapnik-2.1.0/include/mapnik/mapped_memory_cache.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/mapped_memory_cache.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,9 +26,9 @@ // mapnik #include #include +#include // boost -#include #include #include #include @@ -41,18 +41,18 @@ typedef boost::shared_ptr mapped_region_ptr; -struct MAPNIK_DECL mapped_memory_cache : - public singleton , - private boost::noncopyable +class MAPNIK_DECL mapped_memory_cache : + public singleton, + private mapnik::noncopyable { friend class CreateStatic; - static boost::unordered_map cache_; - static bool insert(std::string const& key, mapped_region_ptr); - static boost::optional find(std::string const& key, bool update_cache = false); - static void clear(); + boost::unordered_map cache_; +public: + bool insert(std::string const& key, mapped_region_ptr); + boost::optional find(std::string const& key, bool update_cache = false); + void clear(); }; } #endif // MAPNIK_MAPPED_MEMORY_CACHE_HPP - diff -Nru mapnik-2.1.0/include/mapnik/marker.hpp mapnik-2.2.0/include/mapnik/marker.hpp --- mapnik-2.1.0/include/mapnik/marker.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/marker.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -29,12 +29,12 @@ #include #include #include +#include // agg #include "agg_path_storage.h" // boost -#include #include #include #include @@ -55,7 +55,7 @@ * A class to hold either vector or bitmap marker data. This allows these to be treated equally * in the image caches and most of the render paths. */ -class marker: private boost::noncopyable +class marker: private mapnik::noncopyable { public: marker() @@ -100,17 +100,25 @@ inline double width() const { if (is_bitmap()) + { return (*bitmap_data_)->width(); + } else if (is_vector()) + { return (*vector_data_)->bounding_box().width(); + } return 0; } inline double height() const { if (is_bitmap()) + { return (*bitmap_data_)->height(); + } else if (is_vector()) + { return (*vector_data_)->bounding_box().height(); + } return 0; } diff -Nru mapnik-2.1.0/include/mapnik/marker_cache.hpp mapnik-2.2.0/include/mapnik/marker_cache.hpp --- mapnik-2.1.0/include/mapnik/marker_cache.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/marker_cache.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,9 +26,9 @@ // mapnik #include #include +#include // boost -#include #include #include #include @@ -43,21 +43,21 @@ class MAPNIK_DECL marker_cache : public singleton , - private boost::noncopyable + private mapnik::noncopyable { friend class CreateUsingNew; private: marker_cache(); ~marker_cache(); - static bool insert_marker(std::string const& key, marker_ptr path); - static boost::unordered_map marker_cache_; - static bool insert_svg(std::string const& name, std::string const& svg_string); - static boost::unordered_map svg_cache_; + bool insert_marker(std::string const& key, marker_ptr path); + boost::unordered_map marker_cache_; + bool insert_svg(std::string const& name, std::string const& svg_string); + boost::unordered_map svg_cache_; public: - static std::string known_svg_prefix_; - static bool is_uri(std::string const& path); - static boost::optional find(std::string const& key, bool update_cache = false); - static void clear(); + std::string known_svg_prefix_; + bool is_uri(std::string const& path); + boost::optional find(std::string const& key, bool update_cache = false); + void clear(); }; } diff -Nru mapnik-2.1.0/include/mapnik/marker_helpers.hpp mapnik-2.2.0/include/mapnik/marker_helpers.hpp --- mapnik-2.1.0/include/mapnik/marker_helpers.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/marker_helpers.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,6 +24,7 @@ #define MAPNIK_MARKER_HELPERS_HPP #include +#include #include #include #include @@ -47,9 +48,11 @@ #include "agg_image_accessors.h" #include "agg_pixfmt_rgba.h" #include "agg_span_image_filter_rgba.h" +#include "agg_span_interpolator_linear.h" // boost #include +#include namespace mapnik { @@ -67,7 +70,8 @@ agg::trans_affine const& marker_trans, markers_symbolizer const& sym, Detector & detector, - double scale_factor) + double scale_factor, + bool snap_to_pixels) : buf_(render_buffer), pixf_(buf_), renb_(pixf_), @@ -77,7 +81,8 @@ marker_trans_(marker_trans), sym_(sym), detector_(detector), - scale_factor_(scale_factor) + scale_factor_(scale_factor), + snap_to_pixels_(snap_to_pixels) { pixf_.comp_op(static_cast(sym_.comp_op())); } @@ -87,11 +92,17 @@ { marker_placement_e placement_method = sym_.get_marker_placement(); - if (placement_method != MARKER_LINE_PLACEMENT) + if (placement_method != MARKER_LINE_PLACEMENT || + path.type() == Point) { double x = 0; double y = 0; - if (placement_method == MARKER_INTERIOR_PLACEMENT) + if (path.type() == LineString) + { + if (!label::middle_point(path, x, y)) + return; + } + else if (placement_method == MARKER_INTERIOR_PLACEMENT) { if (!label::interior_position(path, x, y)) return; @@ -103,6 +114,13 @@ } agg::trans_affine matrix = marker_trans_; matrix.translate(x,y); + if (snap_to_pixels_) + { + // https://github.com/mapnik/mapnik/issues/1316 + matrix.tx = std::floor(matrix.tx+.5); + matrix.ty = std::floor(matrix.ty+.5); + } + // TODO https://github.com/mapnik/mapnik/issues/1754 box2d transformed_bbox = bbox_ * matrix; if (sym_.get_allow_overlap() || @@ -145,6 +163,7 @@ markers_symbolizer const& sym_; Detector & detector_; double scale_factor_; + bool snap_to_pixels_; }; template @@ -163,7 +182,8 @@ agg::trans_affine const& marker_trans, markers_symbolizer const& sym, Detector & detector, - double scale_factor) + double scale_factor, + bool snap_to_pixels) : buf_(render_buffer), pixf_(buf_), renb_(pixf_), @@ -172,7 +192,8 @@ marker_trans_(marker_trans), sym_(sym), detector_(detector), - scale_factor_(scale_factor) + scale_factor_(scale_factor), + snap_to_pixels_(snap_to_pixels) { pixf_.comp_op(static_cast(sym_.comp_op())); } @@ -183,11 +204,17 @@ marker_placement_e placement_method = sym_.get_marker_placement(); box2d bbox_(0,0, src_.width(),src_.height()); - if (placement_method != MARKER_LINE_PLACEMENT) + if (placement_method != MARKER_LINE_PLACEMENT || + path.type() == Point) { double x = 0; double y = 0; - if (placement_method == MARKER_INTERIOR_PLACEMENT) + if (path.type() == LineString) + { + if (!label::middle_point(path, x, y)) + return; + } + else if (placement_method == MARKER_INTERIOR_PLACEMENT) { if (!label::interior_position(path, x, y)) return; @@ -231,41 +258,66 @@ void render_raster_marker(agg::trans_affine const& marker_tr, double opacity) { + typedef agg::pixfmt_rgba32_pre pixfmt_pre; double width = src_.width(); double height = src_.height(); - double p[8]; - p[0] = 0; p[1] = 0; - p[2] = width; p[3] = 0; - p[4] = width; p[5] = height; - p[6] = 0; p[7] = height; - marker_tr.transform(&p[0], &p[1]); - marker_tr.transform(&p[2], &p[3]); - marker_tr.transform(&p[4], &p[5]); - marker_tr.transform(&p[6], &p[7]); - ras_.move_to_d(p[0],p[1]); - ras_.line_to_d(p[2],p[3]); - ras_.line_to_d(p[4],p[5]); - ras_.line_to_d(p[6],p[7]); - agg::span_allocator sa; - agg::image_filter_bilinear filter_kernel; - agg::image_filter_lut filter(filter_kernel, false); - agg::rendering_buffer marker_buf((unsigned char *)src_.getBytes(), - src_.width(), - src_.height(), - src_.width()*4); - agg::pixfmt_rgba32_pre pixf(marker_buf); - typedef agg::image_accessor_clone img_accessor_type; - typedef agg::span_interpolator_linear interpolator_type; - typedef agg::span_image_filter_rgba_2x2 span_gen_type; - typedef agg::renderer_scanline_aa_alpha, - span_gen_type> renderer_type; - img_accessor_type ia(pixf); - interpolator_type interpolator(agg::trans_affine(p, 0, 0, width, height) ); - span_gen_type sg(ia, interpolator, filter); - renderer_type rp(renb_,sa, sg, unsigned(opacity*255)); - agg::render_scanlines(ras_, sl_, rp); + if (std::fabs(1.0 - scale_factor_) < 0.001 + && (std::fabs(1.0 - marker_tr.sx) < agg::affine_epsilon) + && (std::fabs(0.0 - marker_tr.shy) < agg::affine_epsilon) + && (std::fabs(0.0 - marker_tr.shx) < agg::affine_epsilon) + && (std::fabs(1.0 - marker_tr.sy) < agg::affine_epsilon)) + { + agg::rendering_buffer src_buffer((unsigned char *)src_.getBytes(),src_.width(),src_.height(),src_.width() * 4); + pixfmt_pre pixf_mask(src_buffer); + renb_.blend_from(pixf_mask, + 0, + std::floor(marker_tr.tx + .5), + std::floor(marker_tr.ty + .5), + unsigned(255*sym_.get_opacity())); + } + else + { + typedef agg::image_accessor_clone img_accessor_type; + typedef agg::span_interpolator_linear<> interpolator_type; + //typedef agg::span_image_filter_rgba_2x2 span_gen_type; + typedef agg::span_image_resample_rgba_affine span_gen_type; + typedef agg::renderer_scanline_aa_alpha, + span_gen_type> renderer_type; + + double p[8]; + p[0] = 0; p[1] = 0; + p[2] = width; p[3] = 0; + p[4] = width; p[5] = height; + p[6] = 0; p[7] = height; + marker_tr.transform(&p[0], &p[1]); + marker_tr.transform(&p[2], &p[3]); + marker_tr.transform(&p[4], &p[5]); + marker_tr.transform(&p[6], &p[7]); + agg::span_allocator sa; + agg::image_filter_lut filter; + filter.calculate(agg::image_filter_bilinear(), true); + agg::rendering_buffer marker_buf((unsigned char *)src_.getBytes(), + src_.width(), + src_.height(), + src_.width()*4); + pixfmt_pre pixf(marker_buf); + img_accessor_type ia(pixf); + agg::trans_affine final_tr(p, 0, 0, width, height); + if (snap_to_pixels_) + { + final_tr.tx = std::floor(final_tr.tx+.5); + final_tr.ty = std::floor(final_tr.ty+.5); + } + interpolator_type interpolator(final_tr); + span_gen_type sg(ia, interpolator, filter); + renderer_type rp(renb_,sa, sg, unsigned(opacity*255)); + ras_.move_to_d(p[0],p[1]); + ras_.line_to_d(p[2],p[3]); + ras_.line_to_d(p[4],p[5]); + ras_.line_to_d(p[6],p[7]); + agg::render_scanlines(ras_, sl_, rp); + } } private: @@ -279,6 +331,7 @@ markers_symbolizer const& sym_; Detector & detector_; double scale_factor_; + bool snap_to_pixels_; }; @@ -291,17 +344,17 @@ double height = 0; if (width_expr && height_expr) { - width = boost::apply_visitor(evaluate(feature), *width_expr).to_double(); - height = boost::apply_visitor(evaluate(feature), *height_expr).to_double(); + width = boost::apply_visitor(evaluate(feature), *width_expr).to_double(); + height = boost::apply_visitor(evaluate(feature), *height_expr).to_double(); } else if (width_expr) { - width = boost::apply_visitor(evaluate(feature), *width_expr).to_double(); + width = boost::apply_visitor(evaluate(feature), *width_expr).to_double(); height = width; } else if (height_expr) { - height = boost::apply_visitor(evaluate(feature), *height_expr).to_double(); + height = boost::apply_visitor(evaluate(feature), *height_expr).to_double(); width = height; } svg::svg_converter_type styled_svg(svg_path, marker_ellipse.attributes()); @@ -313,6 +366,8 @@ styled_svg.pop_attr(); double lox,loy,hix,hiy; styled_svg.bounding_rect(&lox, &loy, &hix, &hiy); + styled_svg.set_dimensions(width,height); + marker_ellipse.set_dimensions(width,height); marker_ellipse.set_bounding_box(lox,loy,hix,hiy); } @@ -367,37 +422,103 @@ } template -void setup_transform_scaling(agg::trans_affine & tr, box2d const& bbox, mapnik::feature_impl const& feature, T const& sym) +void setup_transform_scaling(agg::trans_affine & tr, + double svg_width, + double svg_height, + mapnik::feature_impl const& feature, + T const& sym) { double width = 0; double height = 0; expression_ptr const& width_expr = sym.get_width(); if (width_expr) - width = boost::apply_visitor(evaluate(feature), *width_expr).to_double(); + width = boost::apply_visitor(evaluate(feature), *width_expr).to_double(); expression_ptr const& height_expr = sym.get_height(); if (height_expr) - height = boost::apply_visitor(evaluate(feature), *height_expr).to_double(); + height = boost::apply_visitor(evaluate(feature), *height_expr).to_double(); if (width > 0 && height > 0) { - double sx = width/bbox.width(); - double sy = height/bbox.height(); + double sx = width/svg_width; + double sy = height/svg_height; tr *= agg::trans_affine_scaling(sx,sy); } else if (width > 0) { - double sx = width/bbox.width(); + double sx = width/svg_width; tr *= agg::trans_affine_scaling(sx); } else if (height > 0) { - double sy = height/bbox.height(); + double sy = height/svg_height; tr *= agg::trans_affine_scaling(sy); } } +// Apply markers to a feature with multiple geometries +template +void apply_markers_multi(feature_impl & feature, Converter& converter, markers_symbolizer const& sym) +{ + std::size_t geom_count = feature.paths().size(); + if (geom_count == 1) + { + converter.apply(feature.paths()[0]); + } + else if (geom_count > 1) + { + marker_multi_policy_e multi_policy = sym.get_marker_multi_policy(); + marker_placement_e placement = sym.get_marker_placement(); + if (placement == MARKER_POINT_PLACEMENT && + multi_policy == MARKER_WHOLE_MULTI) + { + double x, y; + if (label::centroid_geoms(feature.paths().begin(), feature.paths().end(), x, y)) + { + geometry_type pt(Point); + pt.move_to(x, y); + // unset any clipping since we're now dealing with a point + converter.template unset(); + converter.apply(pt); + } + } + else if ((placement == MARKER_POINT_PLACEMENT || placement == MARKER_INTERIOR_PLACEMENT) && + multi_policy == MARKER_LARGEST_MULTI) + { + // Only apply to path with largest envelope area + // TODO: consider using true area for polygon types + double maxarea = 0; + geometry_type* largest = 0; + BOOST_FOREACH(geometry_type & geom, feature.paths()) + { + const box2d& env = geom.envelope(); + double area = env.width() * env.height(); + if (area > maxarea) + { + maxarea = area; + largest = &geom; + } + } + if (largest) + { + converter.apply(*largest); + } + } + else + { + if (multi_policy != MARKER_EACH_MULTI && placement != MARKER_POINT_PLACEMENT) + { + MAPNIK_LOG_WARN(marker_symbolizer) << "marker_multi_policy != 'each' has no effect with marker_placement != 'point'"; + } + BOOST_FOREACH(geometry_type & path, feature.paths()) + { + converter.apply(path); + } + } + } +} + } #endif //MAPNIK_MARKER_HELPERS_HPP diff -Nru mapnik-2.1.0/include/mapnik/markers_placement.hpp mapnik-2.2.0/include/mapnik/markers_placement.hpp --- mapnik-2.1.0/include/mapnik/markers_placement.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/markers_placement.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,23 +24,16 @@ #define MAPNIK_MARKERS_PLACEMENT_HPP // mapnik -#include -#include #include +#include #include #include //round #include - -// boost -#include +#include // agg #include "agg_basics.h" -#include "agg_conv_clip_polygon.h" -#include "agg_conv_clip_polyline.h" #include "agg_trans_affine.h" -#include "agg_conv_transform.h" -#include "agg_conv_smooth_poly1.h" // stl #include @@ -48,7 +41,7 @@ namespace mapnik { template -class markers_placement : boost::noncopyable +class markers_placement : mapnik::noncopyable { public: /** Constructor for markers_placement object. @@ -60,19 +53,34 @@ * converted to a positive value with similar magnitude, but * choosen to optimize marker placement. 0 = no markers */ - markers_placement(Locator &locator, box2d const& size, agg::trans_affine const& tr, Detector &detector, double spacing, double max_error, bool allow_overlap) + markers_placement(Locator &locator, + box2d const& size, + agg::trans_affine const& tr, + Detector &detector, + double spacing, + double max_error, + bool allow_overlap) : locator_(locator), size_(size), tr_(tr), detector_(detector), max_error_(max_error), - allow_overlap_(allow_overlap) + allow_overlap_(allow_overlap), + marker_width_((size_ * tr_).width()), + done_(false), + last_x(0.0), + last_y(0.0), + next_x(0.0), + next_y(0.0), + error_(0.0), + spacing_left_(0.0), + marker_nr_(0) { - marker_width_ = (size_ * tr_).width(); if (spacing >= 0) { spacing_ = spacing; - } else if (spacing < 0) + } + else if (spacing < 0) { spacing_ = find_optimal_spacing(-spacing); } @@ -87,10 +95,10 @@ { locator_.rewind(0); //Get first point - done_ = agg::is_stop(locator_.vertex(&next_x, &next_y)) || spacing_ < marker_width_; + done_ = agg::is_stop(locator_.vertex(&next_x, &next_y)); last_x = next_x; last_y = next_y; // Force request of new segment - error_ = 0; + error_ = 0.0; marker_nr_ = 0; } @@ -104,7 +112,10 @@ */ bool get_point(double & x, double & y, double & angle, bool add_to_detector = true) { - if (done_) return false; + if (done_) + { + return false; + } unsigned cmd; /* This functions starts at the position of the previous marker, walks along the path, counting how far it has to go in spacing_left. @@ -116,16 +127,19 @@ error = 0: Perfect position. error < 0: Marker too near to the beginning of the path. */ - if (marker_nr_++ == 0) + if (marker_nr_ == 0) { //First marker + marker_nr_++; spacing_left_ = spacing_ / 2; - } else + } + else { spacing_left_ = spacing_; } spacing_left_ -= error_; - error_ = 0; + error_ = 0.0; + double max_err_allowed = max_error_ * spacing_; //Loop exits when a position is found or when no more segments are available while (true) { @@ -135,22 +149,21 @@ set_spacing_left(marker_width_/2); //Only moves forward } //Error for this marker is too large. Skip to the next position. - if (abs(error_) > max_error_ * spacing_) + if (std::fabs(error_) > max_err_allowed) { - if (error_ > spacing_) + while (error_ > spacing_) { - error_ = 0; //Avoid moving backwards - MAPNIK_LOG_WARN(markers_placement) << "Extremely large error in markers_placement. Please file a bug report."; + error_ -= spacing_; //Avoid moving backwards } spacing_left_ += spacing_ - error_; - error_ = 0; + error_ = 0.0; } double dx = next_x - last_x; double dy = next_y - last_y; double segment_length = std::sqrt(dx * dx + dy * dy); if (segment_length <= spacing_left_) { - //Segment is to short to place marker. Find next segment + //Segment is too short to place marker. Find next segment spacing_left_ -= segment_length; last_x = next_x; last_y = next_y; @@ -160,7 +173,7 @@ last_x = next_x; last_y = next_y; } - if (agg::is_stop(cmd)) + if (agg::is_stop(cmd) || cmd == SEG_CLOSE) { done_ = true; return false; @@ -178,7 +191,8 @@ //Segment to short => Skip this segment set_spacing_left(segment_length + marker_width_/2); //Only moves forward continue; - } else if (segment_length - spacing_left_ < marker_width_/2) + } + else if (segment_length - spacing_left_ < marker_width_/2) { //Segment is long enough, but we are to close to the end //Note: This function moves backwards. This could lead to an infinite @@ -187,14 +201,15 @@ if (error_ == 0) { set_spacing_left(segment_length - marker_width_/2, true); - } else + } + else { //Skip this segment set_spacing_left(segment_length + marker_width_/2); //Only moves forward } continue; //Force checking of max_error constraint } - angle = atan2(dy, dx); + angle = std::atan2(dy, dx); x = last_x + dx * (spacing_left_ / segment_length); y = last_y + dy * (spacing_left_ / segment_length); box2d box = perform_transform(angle, x, y); @@ -217,13 +232,15 @@ agg::trans_affine tr_; Detector &detector_; double spacing_; - double marker_width_; double max_error_; bool allow_overlap_; + double marker_width_; bool done_; - double last_x, last_y; - double next_x, next_y; + double last_x; + double last_y; + double next_x; + double next_y; /** If a marker could not be placed at the exact point where it should * go the next marker's distance will be a bit lower. */ double error_; @@ -270,7 +287,7 @@ last_y = next_y; } } - unsigned points = round(length / s); + unsigned points = static_cast(round(length / s)); if (points == 0) return 0.0; //Path to short return length / points; } diff -Nru mapnik-2.1.0/include/mapnik/markers_symbolizer.hpp mapnik-2.2.0/include/mapnik/markers_symbolizer.hpp --- mapnik-2.1.0/include/mapnik/markers_symbolizer.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/markers_symbolizer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,12 +24,13 @@ #define MAPNIK_MARKERS_SYMBOLIZER_HPP //mapnik -#include -#include #include +#include #include +#include #include #include +#include // boost #include @@ -46,6 +47,15 @@ DEFINE_ENUM( marker_placement_e, marker_placement_enum ); +enum marker_multi_policy_enum { + MARKER_EACH_MULTI, // each component in a multi gets its marker + MARKER_WHOLE_MULTI, // consider all components of a multi as a whole + MARKER_LARGEST_MULTI, // only the largest component of a multi gets a marker + marker_multi_policy_enum_MAX +}; + +DEFINE_ENUM( marker_multi_policy_e, marker_multi_policy_enum ); + struct MAPNIK_DECL markers_symbolizer : public symbolizer_with_image, public symbolizer_base { @@ -74,6 +84,8 @@ boost::optional get_stroke() const; void set_marker_placement(marker_placement_e marker_p); marker_placement_e get_marker_placement() const; + void set_marker_multi_policy(marker_multi_policy_e marker_p); + marker_multi_policy_e get_marker_multi_policy() const; private: expression_ptr width_; expression_ptr height_; @@ -86,6 +98,7 @@ boost::optional opacity_; boost::optional stroke_; marker_placement_e marker_p_; + marker_multi_policy_e marker_mp_; }; } diff -Nru mapnik-2.1.0/include/mapnik/memory.hpp mapnik-2.2.0/include/mapnik/memory.hpp --- mapnik-2.1.0/include/mapnik/memory.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/memory.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,8 +23,6 @@ #ifndef MAPNIK_MEMORY_HPP #define MAPNIK_MEMORY_HPP -// stl -#include #include namespace mapnik diff -Nru mapnik-2.1.0/include/mapnik/memory_datasource.hpp mapnik-2.2.0/include/mapnik/memory_datasource.hpp --- mapnik-2.1.0/include/mapnik/memory_datasource.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/memory_datasource.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -28,7 +28,7 @@ #include // stl -#include +#include namespace mapnik { @@ -36,20 +36,24 @@ { friend class memory_featureset; public: - memory_datasource(); + memory_datasource(datasource::datasource_t type=datasource::Vector, bool bbox_check=true); virtual ~memory_datasource(); void push(feature_ptr feature); datasource::datasource_t type() const; - featureset_ptr features(const query& q) const; - featureset_ptr features_at_point(coord2d const& pt) const; + featureset_ptr features(query const& q) const; + featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const; + void set_envelope(box2d const& box); box2d envelope() const; boost::optional get_geometry_type() const; layer_descriptor get_descriptor() const; size_t size() const; void clear(); private: - std::vector features_; + std::deque features_; mapnik::layer_descriptor desc_; + datasource::datasource_t type_; + bool bbox_check_; + mutable box2d extent_; }; } diff -Nru mapnik-2.1.0/include/mapnik/memory_featureset.hpp mapnik-2.2.0/include/mapnik/memory_featureset.hpp --- mapnik-2.1.0/include/mapnik/memory_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/memory_featureset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,27 +24,34 @@ #define MAPNIK_MEMORY_FEATURESET_HPP // mapnik -#include +#include +#include +#include #include +#include +#include -// boost -#include +#include namespace mapnik { class memory_featureset : public Featureset { public: - memory_featureset(box2d const& bbox, memory_datasource const& ds) + memory_featureset(box2d const& bbox, memory_datasource const& ds, bool bbox_check = true) : bbox_(bbox), pos_(ds.features_.begin()), - end_(ds.features_.end()) + end_(ds.features_.end()), + type_(ds.type()), + bbox_check_(bbox_check) {} - memory_featureset(box2d const& bbox, std::vector const& features) + memory_featureset(box2d const& bbox, std::deque const& features, bool bbox_check = true) : bbox_(bbox), pos_(features.begin()), - end_(features.end()) + end_(features.end()), + type_(datasource::Vector), + bbox_check_(bbox_check) {} virtual ~memory_featureset() {} @@ -53,27 +60,43 @@ { while (pos_ != end_) { - for (unsigned i=0; i<(*pos_)->num_geometries();++i) + if (!bbox_check_) { - geometry_type & geom = (*pos_)->get_geometry(i); - - MAPNIK_LOG_DEBUG(memory_featureset) << "memory_featureset: BBox=" << bbox_ << ",Envelope=" << geom.envelope(); - - if (bbox_.intersects(geom.envelope())) + return *pos_++; + } + else + { + if (type_ == datasource::Raster) { - return *pos_++; + raster_ptr const& source = (*pos_)->get_raster(); + if (source && bbox_.intersects(source->ext_)) + { + return *pos_++; + } } + else + { + for (unsigned i=0; i<(*pos_)->num_geometries();++i) + { + geometry_type & geom = (*pos_)->get_geometry(i); + if (bbox_.intersects(geom.envelope())) + { + return *pos_++; + } + } + } + ++pos_; } - ++pos_; } - return feature_ptr(); } private: box2d bbox_; - std::vector::const_iterator pos_; - std::vector::const_iterator end_; + std::deque::const_iterator pos_; + std::deque::const_iterator end_; + datasource::datasource_t type_; + bool bbox_check_; }; } diff -Nru mapnik-2.1.0/include/mapnik/miniz_png.hpp mapnik-2.2.0/include/mapnik/miniz_png.hpp --- mapnik-2.1.0/include/mapnik/miniz_png.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/miniz_png.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,83 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2012 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_MINIZ_PNG_HPP +#define MAPNIK_MINIZ_PNG_HPP + +// mapnik +#include + +// stl +#include +#include +#include + +/* miniz.c porting issues: + - duplicate symbols in python bindings require moving miniz.c include to just cpp file + - due to http://code.google.com/p/miniz/issues/detail?id=7 + - avoiding including miniz.c here requires fwd declaring the two structs below + - being able to fwd declare requires removing typedef from struct declarations in miniz.c + - being able to fwd declare also requires using pointers to structs +*/ + +// TODO: try using #define MINIZ_HEADER_FILE_ONLY +struct tdefl_output_buffer; +struct tdefl_compressor; + +namespace mapnik { namespace MiniZ { + +using mapnik::rgb; + +class PNGWriter { + +public: + PNGWriter(int level, int strategy); + ~PNGWriter(); +private: + inline void writeUInt32BE(unsigned char *target, unsigned int value); + size_t startChunk(const unsigned char header[], size_t length); + void finishChunk(size_t start); +public: + void writeIHDR(unsigned int width, unsigned int height, unsigned char pixel_depth); + void writePLTE(std::vector const& palette); + void writetRNS(std::vector const& alpha); + template + void writeIDAT(T const& image); + template + void writeIDATStripAlpha(T const& image); + void writeIEND(); + void toStream(std::ostream& stream); + +private: + tdefl_compressor *compressor; + tdefl_output_buffer *buffer; + static const unsigned char preamble[]; + static const unsigned char IHDR_tpl[]; + static const unsigned char PLTE_tpl[]; + static const unsigned char tRNS_tpl[]; + static const unsigned char IDAT_tpl[]; + static const unsigned char IEND_tpl[]; +}; + +}} + +#endif // MAPNIK_MINIZ_PNG_HPP diff -Nru mapnik-2.1.0/include/mapnik/noncopyable.hpp mapnik-2.2.0/include/mapnik/noncopyable.hpp --- mapnik-2.1.0/include/mapnik/noncopyable.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/noncopyable.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,45 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2012 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_NONCOPYABLE_HPP +#define MAPNIK_NONCOPYABLE_HPP + +namespace mapnik { + +namespace non_copyable_ +{ + class noncopyable + { + protected: + noncopyable() {} + ~noncopyable() {} + private: + noncopyable( const noncopyable& ); + const noncopyable& operator=( const noncopyable& ); + }; +} + +typedef non_copyable_::noncopyable noncopyable; + +} // namespace mapnik + +#endif // MAPNIK_NONCOPYABLE_HPP diff -Nru mapnik-2.1.0/include/mapnik/octree.hpp mapnik-2.2.0/include/mapnik/octree.hpp --- mapnik-2.1.0/include/mapnik/octree.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/octree.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,13 +26,10 @@ // mapnik #include #include - -// boost -#include +#include // stl #include -#include #include #include @@ -52,11 +49,11 @@ }; template -class octree : private boost::noncopyable +class octree : private mapnik::noncopyable { struct node { - node () + node() : reds(0), greens(0), blues(0), @@ -68,14 +65,22 @@ memset(&children_[0],0,sizeof(children_)); } - ~node () + ~node() { - for (unsigned i = 0;i < 8; ++i) { - if (children_[i] != 0) delete children_[i],children_[i]=0; + for (unsigned i = 0;i < 8; ++i) + { + if (children_[i] != 0) + { + delete children_[i]; + children_[i]=0; + } } } - bool is_leaf() const { return count == 0; } + bool is_leaf() const + { + return count == 0; + } node * children_[8]; boost::uint64_t reds; boost::uint64_t greens; @@ -83,8 +88,8 @@ unsigned count; double reduce_cost; unsigned count_cum; - byte children_count; - byte index; + byte children_count; + byte index; }; struct node_cmp { @@ -99,7 +104,6 @@ unsigned colors_; unsigned offset_; unsigned leaf_level_; - bool has_alfa_; public: explicit octree(unsigned max_colors=256) @@ -107,11 +111,13 @@ colors_(0), offset_(0), leaf_level_(InsertPolicy::MAX_LEVELS), - has_alfa_(false), root_(new node()) {} - ~octree() { delete root_;} + ~octree() + { + delete root_; + } unsigned colors() { @@ -133,21 +139,12 @@ return offset_; } - void hasAlfa(bool v) - { - has_alfa_=v; - } - - bool hasAlfa() - { - return has_alfa_; - } - void insert(T const& data) { unsigned level = 0; node * cur_node = root_; - while (true) { + while (true) + { cur_node->count_cum++; cur_node->reds += data.r; cur_node->greens += data.g; @@ -163,7 +160,8 @@ } unsigned idx = InsertPolicy::index_from_level(level,data); - if (cur_node->children_[idx] == 0) { + if (cur_node->children_[idx] == 0) + { cur_node->children_count++; cur_node->children_[idx] = new node(); if (level < leaf_level_-1) @@ -176,14 +174,17 @@ } } - int quantize(rgb const& c) const + int quantize(unsigned val) const { unsigned level = 0; + rgb c(val); node * cur_node = root_; while (cur_node) { if (cur_node->children_count == 0) + { return cur_node->index + offset_; + } unsigned idx = InsertPolicy::index_from_level(level,c); cur_node = cur_node->children_[idx]; ++level; @@ -193,11 +194,6 @@ void create_palette(std::vector & palette) { - if (has_alfa_) - { - max_colors_--; - palette.push_back(rgb(0,0,0)); - } reduce(); palette.reserve(colors_); create_palette(palette, root_); @@ -207,23 +203,26 @@ { r->reduce_cost = 0; if (r->children_count==0) + { return; + } double mean_r = static_cast(r->reds / r->count_cum); double mean_g = static_cast(r->greens / r->count_cum); double mean_b = static_cast(r->blues / r->count_cum); - for (unsigned idx=0; idx < 8; ++idx) if (r->children_[idx] != 0) - { - double dr,dg,db; - computeCost(r->children_[idx]); - - dr = r->children_[idx]->reds / r->children_[idx]->count_cum - mean_r; - dg = r->children_[idx]->greens / r->children_[idx]->count_cum - mean_g; - db = r->children_[idx]->blues / r->children_[idx]->count_cum - mean_b; - - r->reduce_cost += r->children_[idx]->reduce_cost; - r->reduce_cost += (dr*dr + dg*dg + db*db) * r->children_[idx]->count_cum; - } + for (unsigned idx=0; idx < 8; ++idx) + { + if (r->children_[idx] != 0) + { + double dr,dg,db; + computeCost(r->children_[idx]); + dr = r->children_[idx]->reds / r->children_[idx]->count_cum - mean_r; + dg = r->children_[idx]->greens / r->children_[idx]->count_cum - mean_g; + db = r->children_[idx]->blues / r->children_[idx]->count_cum - mean_b; + r->reduce_cost += r->children_[idx]->reduce_cost; + r->reduce_cost += (dr*dr + dg*dg + db*db) * r->children_[idx]->count_cum; + } + } } void reduce() @@ -236,30 +235,39 @@ { std::sort(reducible_[i].begin(), reducible_[i].end(),node_cmp()); } - while ( colors_ > max_colors_ && colors_ > 1) + while (colors_ > max_colors_ && colors_ > 1) { while (leaf_level_ >0 && reducible_[leaf_level_-1].size() == 0) { --leaf_level_; } - if (leaf_level_ <= 0) return; + if (leaf_level_ <= 0) + { + return; + } // select best of all reducible: unsigned red_idx = leaf_level_-1; - unsigned bestv = (*reducible_[red_idx].begin())->reduce_cost; - for(unsigned i=red_idx; i>=InsertPolicy::MIN_LEVELS; i--) if (!reducible_[i].empty()){ + unsigned bestv = static_cast((*reducible_[red_idx].begin())->reduce_cost); + for(unsigned i=red_idx; i>=InsertPolicy::MIN_LEVELS; i--) + { + if (!reducible_[i].empty()) + { node *nd = *reducible_[i].begin(); unsigned gch = 0; - for(unsigned idx=0; idx<8; idx++){ + for(unsigned idx=0; idx<8; idx++) + { if (nd->children_[idx]) gch += nd->children_[idx]->children_count; } - if (gch==0 && nd->reduce_cost < bestv){ + if (gch==0 && nd->reduce_cost < bestv) + { bestv = static_cast(nd->reduce_cost); red_idx = i; } } + } typename std::deque::iterator pos = reducible_[red_idx].begin(); node * cur_node = *pos; @@ -297,7 +305,9 @@ for (unsigned i=0; i < 8 ;++i) { if (itr->children_[i] != 0) + { create_palette(palette, itr->children_[i]); + } } } private: diff -Nru mapnik-2.1.0/include/mapnik/offset_converter.hpp mapnik-2.2.0/include/mapnik/offset_converter.hpp --- mapnik-2.1.0/include/mapnik/offset_converter.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/offset_converter.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,7 +23,10 @@ #ifndef MAPNIK_OFFSET_CONVERTER_HPP #define MAPNIK_OFFSET_CONVERTER_HPP +#ifdef MAPNIK_LOG #include +#endif +#include #include #include #include @@ -31,11 +34,13 @@ // boost #include +// stl +#include + namespace mapnik { const double pi = boost::math::constants::pi(); -const double half_pi = pi/2.0; template struct MAPNIK_DECL offset_converter @@ -211,8 +216,8 @@ */ static void displace(vertex2d & v, double dx, double dy, double a) { - v.x += dx * cos(a) - dy * sin(a); - v.y += dx * sin(a) + dy * cos(a); + v.x += dx * std::cos(a) - dy * std::sin(a); + v.y += dx * std::sin(a) + dy * std::cos(a); } /** @@ -220,8 +225,8 @@ */ void displace(vertex2d & v, double a) const { - v.x += offset_ * sin(a); - v.y -= offset_ * cos(a); + v.x += offset_ * std::sin(a); + v.y -= offset_ * std::cos(a); } /** @@ -229,16 +234,16 @@ */ void displace(vertex2d & v, vertex2d const& u, double a) const { - v.x = u.x + offset_ * sin(a); - v.y = u.y - offset_ * cos(a); + v.x = u.x + offset_ * std::sin(a); + v.y = u.y - offset_ * std::cos(a); v.cmd = u.cmd; } void displace2(vertex2d & v, double a, double b) const { - double sa = offset_ * sin(a); - double ca = offset_ * cos(a); - double h = tan(0.5 * (b - a)); + double sa = offset_ * std::sin(a); + double ca = offset_ * std::cos(a); + double h = std::tan(0.5 * (b - a)); v.x = v.x + sa + h * ca; v.y = v.y - ca + h * sa; } @@ -259,7 +264,7 @@ return status_ = process; double angle_a = 0; - double angle_b = atan2((v2.y - v1.y), (v2.x - v1.x)); + double angle_b = std::atan2((v2.y - v1.y), (v2.x - v1.x)); double joint_angle; // first vertex @@ -271,15 +276,15 @@ // a fake vertex two offset-lengths before the first, and expect // intersection detection smoothes it out. pre_first_ = v1; - displace(pre_first_, -2 * fabs(offset_), 0, angle_b); + displace(pre_first_, -2 * std::fabs(offset_), 0, angle_b); while ((v1 = v2, v2.cmd = geom_.vertex(&v2.x, &v2.y)) != SEG_END) { angle_a = angle_b; - angle_b = atan2((v2.y - v1.y), (v2.x - v1.x)); + angle_b = std::atan2((v2.y - v1.y), (v2.x - v1.x)); joint_angle = explement_reflex_angle(angle_b - angle_a); - double half_turns = half_turn_segments_ * fabs(joint_angle); + double half_turns = half_turn_segments_ * std::fabs(joint_angle); int bulge_steps = 0; if (offset_ < 0.0) @@ -287,7 +292,7 @@ if (joint_angle > 0.0) joint_angle = joint_angle - 2 * pi; else - bulge_steps = 1 + int(floor(half_turns / pi)); + bulge_steps = 1 + int(std::floor(half_turns / pi)); } else { diff -Nru mapnik-2.1.0/include/mapnik/palette.hpp mapnik-2.2.0/include/mapnik/palette.hpp --- mapnik-2.1.0/include/mapnik/palette.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/palette.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,19 +26,20 @@ // mapnik #include #include +#include -// boost -#include -#include +#define USE_DENSE_HASH_MAP + +#ifdef USE_DENSE_HASH_MAP + #include + typedef google::dense_hash_map rgba_hash_table; +#else + #include + typedef boost::unordered_map rgba_hash_table; +#endif // stl #include -#include -#include -#include -#include -#include - #ifdef MAPNIK_BIG_ENDIAN #define U2RED(x) (((x)>>24)&0xff) @@ -63,7 +64,7 @@ byte g; byte b; - inline rgb(byte r_, byte g_, byte b_) : r(r_), g(g_), b(b_) {}; + inline rgb(byte r_, byte g_, byte b_) : r(r_), g(g_), b(b_) {} rgb(rgba const& c); inline bool operator==(const rgb& y) const @@ -102,32 +103,16 @@ return r == y.r && g == y.g && b == y.b && a == y.a; } - inline operator unsigned() const - { -#ifdef MAPNIK_BIG_ENDIAN - return (r << 24) | (g << 16) | (b << 8) | a; -#else - return r | (g << 8) | (b << 16) | (a << 24); -#endif - } - // ordering by mean(a,r,g,b), a, r, g, b struct mean_sort_cmp { bool operator() (const rgba& x, const rgba& y) const; }; - struct hash_func : public std::unary_function - { - std::size_t operator()(rgba const& p) const; - }; }; -typedef boost::unordered_map rgba_hash_table; - - -class MAPNIK_DECL rgba_palette : private boost::noncopyable { +class MAPNIK_DECL rgba_palette : private mapnik::noncopyable { public: enum palette_type { PALETTE_RGBA = 0, PALETTE_RGB = 1, PALETTE_ACT = 2 }; @@ -137,20 +122,10 @@ const std::vector& palette() const; const std::vector& alphaTable() const; - unsigned quantize(rgba const& c) const; - inline unsigned quantize(unsigned const& c) const - { - rgba_hash_table::const_iterator it = color_hashmap_.find(c); - if (it != color_hashmap_.end()) - { - return it->second; - } - else { - return quantize(rgba(U2RED(c), U2GREEN(c), U2BLUE(c), U2ALPHA(c))); - } - } + unsigned char quantize(unsigned c) const; bool valid() const; + std::string to_string() const; private: void parse(std::string const& pal, palette_type type); diff -Nru mapnik-2.1.0/include/mapnik/params.hpp mapnik-2.2.0/include/mapnik/params.hpp --- mapnik-2.1.0/include/mapnik/params.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/params.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,14 +23,13 @@ #ifndef MAPNIK_PARAMS_HPP #define MAPNIK_PARAMS_HPP +// mapnik +#include +#include + // boost -#include +#include #include -#include -#include - -// mapnik -#include // stl #include @@ -38,71 +37,58 @@ namespace mapnik { -typedef boost::variant value_holder; -typedef std::pair parameter; -typedef std::map param_map; -template -struct value_extractor_visitor : public boost::static_visitor<> -{ - value_extractor_visitor(boost::optional & var) - :var_(var) {} - - void operator () (T val) const - { - var_ = val; - } - - template - void operator () (T1 val) const - { - try - { - var_ = boost::lexical_cast(val); - } - catch (boost::bad_lexical_cast & ) {} - } - - boost::optional & var_; -}; +// fwd declare +class boolean; +typedef boost::variant value_holder; +typedef std::pair parameter; +typedef std::map param_map; -class parameters : public param_map +class MAPNIK_DECL parameters : public param_map { - template - struct converter - { - typedef boost::optional return_type; - static return_type extract(parameters const& params, - std::string const& name, - boost::optional const& default_value) - { - boost::optional result(default_value); - parameters::const_iterator itr = params.find(name); - if (itr != params.end()) - { - boost::apply_visitor(value_extractor_visitor(result),itr->second); - } - return result; - } - }; - public: - parameters() {} - template - boost::optional get(std::string const& key) const - { - return converter::extract(*this,key, boost::none); - } - + boost::optional get(std::string const& key) const; template - boost::optional get(std::string const& key, T const& default_value) const - { - return converter::extract(*this,key,boost::optional(default_value)); - } + boost::optional get(std::string const& key, T const& default_opt_value) const; + }; + +#ifdef _MSC_VER +template MAPNIK_DECL +boost::optional parameters::get(std::string const& key) const; +template MAPNIK_DECL +boost::optional parameters::get(std::string const& key, + std::string const& default_opt_value) const; +template MAPNIK_DECL +boost::optional parameters::get(std::string const& key) const; +template MAPNIK_DECL +boost::optional parameters::get(std::string const& key, + value_double const& default_opt_value) const; + +template MAPNIK_DECL +boost::optional parameters::get(std::string const& key) const; +template MAPNIK_DECL +boost::optional parameters::get(std::string const& key, + int const& default_opt_value) const; +#ifdef BIGINT +template MAPNIK_DECL +boost::optional parameters::get(std::string const& key) const; +template MAPNIK_DECL +boost::optional parameters::get(std::string const& key, + value_integer const& default_opt_value) const; +#endif + +template MAPNIK_DECL +boost::optional parameters::get(std::string const& key) const; +template MAPNIK_DECL +boost::optional parameters::get(std::string const& key, + mapnik::boolean const& default_opt_value) const; + +#endif + } #endif // MAPNIK_PARAMS_HPP diff -Nru mapnik-2.1.0/include/mapnik/params_impl.hpp mapnik-2.2.0/include/mapnik/params_impl.hpp --- mapnik-2.1.0/include/mapnik/params_impl.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/params_impl.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,208 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// NOTE: This is an implementation header file and is only meant to be included +// from implementation files. It therefore doesn't have an include guard. + +// mapnik +#include +#include +#include +#include +// boost +#include +#include // keep gcc happy +#include +#include +#include +#include + +// stl +#include +#include + + +namespace mapnik { namespace detail { + + +template +struct extract_value +{ + static inline boost::optional do_extract_from_string(std::string const& source) + { + std::string err_msg = (boost::format("No conversion from std::string to %s") % typeid(T).name()).str(); + throw std::runtime_error(err_msg); + } +}; + +template <> +struct extract_value +{ + static inline boost::optional do_extract_from_string(std::string const& source) + { + bool result; + if (mapnik::util::string2bool(source, result)) + return boost::optional(result); + return boost::optional(); + } +}; + +template <> +struct extract_value +{ + static inline boost::optional do_extract_from_string(std::string const& source) + { + mapnik::value_integer result; + if (mapnik::util::string2int(source, result)) + return boost::optional(result); + return boost::optional(); + } +}; + +#ifdef BIGINT + +template <> +struct extract_value +{ + static inline boost::optional do_extract_from_string(std::string const& source) + { + mapnik::value_integer result; + if (mapnik::util::string2int(source, result)) + return boost::optional(result); + return boost::optional(); + } +}; + +#endif + +template <> +struct extract_value +{ + static inline boost::optional do_extract_from_string(std::string const& source) + { + mapnik::value_double result; + if (mapnik::util::string2double(source, result)) + return boost::optional(result); + return boost::optional(); + } +}; + +template <> +struct extract_value +{ + static inline boost::optional do_extract_from_string(std::string const& source) + { + return boost::optional(); // FIXME + } +}; + + +template <> +struct extract_value +{ + static inline boost::optional do_extract_from_string(std::string const& source) + { + return boost::optional(source); + } +}; + + + +template +boost::optional param_cast(std::string const& source) +{ + return extract_value::do_extract_from_string(source); +} + +} // end namespace detail + +template +struct value_extractor_visitor : public boost::static_visitor<> +{ + + value_extractor_visitor(boost::optional & var) + :var_(var) {} + + void operator() (std::string const& val) const + { + var_ = detail::param_cast(val); + + } + + template + void operator () (T1 val) const + { + try + { + var_ = boost::lexical_cast(val); + } + catch (boost::bad_lexical_cast const& ) + { + std::string err_msg = (boost::format("Failed converting from %s to %s") + % typeid(T1).name() + % typeid(T).name()).str(); + throw std::runtime_error(err_msg); + } + } + + + boost::optional & var_; +}; + +namespace params_detail { + +template +struct converter +{ + typedef T value_type; + typedef boost::optional return_type; + static return_type extract(parameters const& params, + std::string const& name, + boost::optional const& default_opt_value) + { + boost::optional result(default_opt_value); + parameters::const_iterator itr = params.find(name); + if (itr != params.end()) + { + boost::apply_visitor(value_extractor_visitor(result),itr->second); + } + return result; + } +}; + +} // end namespace params_detail + + +template +boost::optional parameters::get(std::string const& key) const +{ + return params_detail::converter::extract(*this,key, boost::none); +} + +template +boost::optional parameters::get(std::string const& key, T const& default_opt_value) const +{ + return params_detail::converter::extract(*this,key,boost::optional(default_opt_value)); +} + + +} diff -Nru mapnik-2.1.0/include/mapnik/parse_path.hpp mapnik-2.2.0/include/mapnik/parse_path.hpp --- mapnik-2.1.0/include/mapnik/parse_path.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/parse_path.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,126 +25,30 @@ // mapnik #include -#include -#include -#include - -// boost -#include -#include -#include +#include // stl #include -#include +#include namespace mapnik { -typedef boost::variant path_component; -typedef std::vector path_expression; -typedef boost::shared_ptr path_expression_ptr; +// fwd declare to reduce compile time template struct path_expression_grammar; +class feature_impl; MAPNIK_DECL path_expression_ptr parse_path(std::string const & str); -MAPNIK_DECL bool parse_path_from_string(path_expression_ptr const& path, - std::string const & str, - path_expression_grammar const& g); +MAPNIK_DECL path_expression_ptr parse_path(std::string const & str, + path_expression_grammar const& g); - -template -struct path_processor +struct MAPNIK_DECL path_processor { - typedef T feature_type; - struct path_visitor_ : boost::static_visitor - { - path_visitor_ (std::string & filename, feature_type const& f) - : filename_(filename), - feature_(f) {} - - void operator() (std::string const& token) const - { - filename_ += token; - } - - void operator() (attribute const& attr) const - { - // convert mapnik::value to std::string - value const& val = feature_.get(attr.name()); - filename_ += val.to_string(); - } - - std::string & filename_; - feature_type const& feature_; - }; - - struct to_string_ : boost::static_visitor - { - to_string_ (std::string & str) - : str_(str) {} - - void operator() (std::string const& token) const - { - str_ += token; - } - - void operator() (attribute const& attr) const - { - str_ += "["; - str_ += attr.name(); - str_ += "]"; - } - - std::string & str_; - }; - - template - struct collect_ : boost::static_visitor - { - collect_ (T1 & cont) - : cont_(cont) {} - - void operator() (std::string const& token) const - { - boost::ignore_unused_variable_warning(token); - } - - void operator() (attribute const& attr) const - { - cont_.insert(attr.name()); - } - - T1 & cont_; - }; - - static std::string evaluate(path_expression const& path,feature_type const& f) - { - std::string out; - path_visitor_ eval(out,f); - BOOST_FOREACH( mapnik::path_component const& token, path) - boost::apply_visitor(eval,token); - return out; - } - - static std::string to_string(path_expression const& path) - { - std::string str; - to_string_ visitor(str); - BOOST_FOREACH( mapnik::path_component const& token, path) - boost::apply_visitor(visitor,token); - return str; - } - - template - static void collect_attributes(path_expression const& path, T2 & names) - { - typedef T2 cont_type; - collect_ visitor(names); - BOOST_FOREACH( mapnik::path_component const& token, path) - boost::apply_visitor(visitor,token); - } + static std::string evaluate(path_expression const& path, feature_impl const& f); + static std::string to_string(path_expression const& path); + static void collect_attributes(path_expression const& path, std::set& names); }; -typedef mapnik::path_processor path_processor_type; +typedef mapnik::path_processor path_processor_type; } diff -Nru mapnik-2.1.0/include/mapnik/parse_transform.hpp mapnik-2.2.0/include/mapnik/parse_transform.hpp --- mapnik-2.1.0/include/mapnik/parse_transform.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/parse_transform.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,14 +25,14 @@ // mapnik #include -#include +#include // for transform_list_ptr namespace mapnik { template struct transform_expression_grammar; typedef transform_expression_grammar - transform_expression_grammar__string; + transform_expression_grammar_string; MAPNIK_DECL transform_list_ptr parse_transform(std::string const& str); @@ -41,7 +41,7 @@ MAPNIK_DECL bool parse_transform(transform_list& list, std::string const& str, - transform_expression_grammar__string const& g); + transform_expression_grammar_string const& g); } // namespace mapnik diff -Nru mapnik-2.1.0/include/mapnik/path_expression.hpp mapnik-2.2.0/include/mapnik/path_expression.hpp --- mapnik-2.1.0/include/mapnik/path_expression.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/path_expression.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,45 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_PATH_EXPRESSION_HPP +#define MAPNIK_PATH_EXPRESSION_HPP + +// boost +#include +#include + +// stl +#include +#include + +namespace mapnik +{ + +struct attribute; + +typedef boost::variant path_component; +typedef std::vector path_expression; +typedef boost::shared_ptr path_expression_ptr; + +} + +#endif // MAPNIK_PATH_EXPRESSION_HPP diff -Nru mapnik-2.1.0/include/mapnik/path_expression_grammar.hpp mapnik-2.2.0/include/mapnik/path_expression_grammar.hpp --- mapnik-2.1.0/include/mapnik/path_expression_grammar.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/path_expression_grammar.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,10 +24,7 @@ #define MAPNIK_PATH_EXPRESSIONS_GRAMMAR_HPP // mapnik -#include - -// boost -#include +#include // spirit2 #include @@ -39,14 +36,13 @@ namespace mapnik { + using namespace boost; namespace qi = boost::spirit::qi; namespace phoenix = boost::phoenix; namespace standard_wide = boost::spirit::standard_wide; using standard_wide::space_type; -using standard_wide::space; -typedef boost::variant path_component; template struct path_expression_grammar : qi::grammar(), space_type> diff -Nru mapnik-2.1.0/include/mapnik/pixel_position.hpp mapnik-2.2.0/include/mapnik/pixel_position.hpp --- mapnik-2.1.0/include/mapnik/pixel_position.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/pixel_position.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,12 +22,12 @@ #ifndef MAPNIK_PIXEL_POSITION_HPP #define MAPNIK_PIXEL_POSITION_HPP -/** Store a pixel position. */ +// Store a pixel position. struct pixel_position { double x; double y; - pixel_position(double x, double y) : x(x), y(y) { } + pixel_position(double x_, double y_) : x(x_), y(y_) { } pixel_position() : x(0), y(0) { } }; diff -Nru mapnik-2.1.0/include/mapnik/placement_finder.hpp mapnik-2.2.0/include/mapnik/placement_finder.hpp --- mapnik-2.1.0/include/mapnik/placement_finder.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/placement_finder.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,11 +25,13 @@ // mapnik #include +#include #include -#include +//#include #include #include #include +#include // agg @@ -54,10 +56,10 @@ template -class placement_finder : boost::noncopyable +class placement_finder : mapnik::noncopyable { public: - placement_finder(Feature const& feature, + placement_finder(feature_impl const& feature, text_placement_info const& placement_info, string_info const& info, DetectorT & detector, diff -Nru mapnik-2.1.0/include/mapnik/plugin.hpp mapnik-2.2.0/include/mapnik/plugin.hpp --- mapnik-2.1.0/include/mapnik/plugin.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/plugin.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,27 +23,35 @@ #ifndef MAPNIK_PLUGIN_HPP #define MAPNIK_PLUGIN_HPP -// boost -#include +// mapnik +#include // stl #include -// ltdl -#include - namespace mapnik { -class PluginInfo : boost::noncopyable + +// Opaque structure for handle +typedef struct _mapnik_lib_t mapnik_lib_t; + +class PluginInfo : mapnik::noncopyable { -private: - std::string name_; - lt_dlhandle module_; public: - PluginInfo (const std::string& name,const lt_dlhandle module); + typedef const char * name_func(); + PluginInfo (std::string const& filename, + std::string const& library_name); ~PluginInfo(); - const std::string& name() const; - lt_dlhandle handle() const; + std::string const& name() const; + bool valid() const; + std::string get_error() const; + void * get_symbol(std::string const& sym_name) const; + static void init(); + static void exit(); +private: + std::string filename_; + std::string name_; + mapnik_lib_t * module_; }; } diff -Nru mapnik-2.1.0/include/mapnik/png_io.hpp mapnik-2.2.0/include/mapnik/png_io.hpp --- mapnik-2.1.0/include/mapnik/png_io.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/png_io.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,13 +24,20 @@ #define MAPNIK_PNG_IO_HPP // mapnik -#include #include #include #include +#include #include + // zlib -#include +#include // for Z_DEFAULT_COMPRESSION + +// boost +#include + +// stl +#include extern "C" { @@ -56,8 +63,32 @@ } template -void save_as_png(T1 & file , T2 const& image, int compression = Z_DEFAULT_COMPRESSION, int strategy = Z_DEFAULT_STRATEGY) +void save_as_png(T1 & file, + T2 const& image, + int compression = Z_DEFAULT_COMPRESSION, + int strategy = Z_DEFAULT_STRATEGY, + int trans_mode = -1, + bool use_miniz = false) + { + if (use_miniz) + { + MiniZ::PNGWriter writer(compression,strategy); + if (trans_mode == 0) + { + writer.writeIHDR(image.width(), image.height(), 24); + writer.writeIDATStripAlpha(image); + } + else + { + writer.writeIHDR(image.width(), image.height(), 32); + writer.writeIDAT(image); + } + writer.writeIEND(); + writer.toStream(file); + return; + } + png_voidp error_ptr=0; png_structp png_ptr=png_create_write_struct(PNG_LIBPNG_VER_STRING, error_ptr,0, 0); @@ -91,32 +122,35 @@ png_set_compression_buffer_size(png_ptr, 32768); png_set_IHDR(png_ptr, info_ptr,image.width(),image.height(),8, - PNG_COLOR_TYPE_RGB_ALPHA,PNG_INTERLACE_NONE, + (trans_mode == 0) ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGB_ALPHA,PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,PNG_FILTER_TYPE_DEFAULT); - png_write_info(png_ptr, info_ptr); - for (unsigned i=0;i row_pointers(new png_bytep[image.height()]); + for (unsigned int i = 0; i < image.height(); i++) { - png_write_row(png_ptr,(png_bytep)image.getRow(i)); + row_pointers[i] = (png_bytep)image.getRow(i); } - - png_write_end(png_ptr, info_ptr); + png_set_rows(png_ptr, info_ptr, row_pointers.get()); + png_write_png(png_ptr, info_ptr, (trans_mode == 0) ? PNG_TRANSFORM_STRIP_FILLER_AFTER : PNG_TRANSFORM_IDENTITY, NULL); png_destroy_write_struct(&png_ptr, &info_ptr); } template -void reduce_8 (T const& in, image_data_8 & out, octree trees[], unsigned limits[], unsigned levels, std::vector & alpha) +void reduce_8(T const& in, + image_data_8 & out, + octree trees[], + unsigned limits[], + unsigned levels, + std::vector & alpha) { unsigned width = in.width(); unsigned height = in.height(); - //unsigned alphaCount[alpha.size()]; std::vector alphaCount(alpha.size()); for(unsigned i=0; i0; j--){ - if (U2ALPHA(val)>=limits[j] && trees[j].colors()>0) { - index = idx = trees[j].quantize(c); + for(int j=levels-1; j>0; j--) + { + if (U2ALPHA(val)>=limits[j] && trees[j].colors()>0) + { + index = idx = trees[j].quantize(val); break; } } @@ -144,38 +179,43 @@ for(unsigned i=0; i -void reduce_4 (T const& in, image_data_8 & out, octree trees[], unsigned limits[], unsigned levels, std::vector & alpha) +void reduce_4(T const& in, + image_data_8 & out, + octree trees[], + unsigned limits[], + unsigned levels, + std::vector & alpha) { unsigned width = in.width(); unsigned height = in.height(); - //unsigned alphaCount[alpha.size()]; std::vector alphaCount(alpha.size()); for(unsigned i=0; i0; j--){ - if (U2ALPHA(val)>=limits[j] && trees[j].colors()>0) { - index = idx = trees[j].quantize(c); + for(int j=levels-1; j>0; j--) + { + if (U2ALPHA(val)>=limits[j] && trees[j].colors()>0) + { + index = idx = trees[j].quantize(val); break; } } @@ -184,20 +224,29 @@ alpha[idx]+=U2ALPHA(val); alphaCount[idx]++; } - if (x%2 == 0) index = index<<4; + if (x%2 == 0) + { + index = index<<4; + } row_out[x>>1] |= index; } } for(unsigned i=0; i -void reduce_1(T const&, image_data_8 & out, octree /*trees*/[], unsigned /*limits*/[], std::vector & /*alpha*/) +void reduce_1(T const&, + image_data_8 & out, + octree /*trees*/[], + unsigned /*limits*/[], + std::vector & /*alpha*/) { out.set(0); // only one color!!! } @@ -210,13 +259,31 @@ unsigned color_depth, int compression, int strategy, - std::vector const&alpha) + std::vector const&alpha, + bool use_miniz) { + if (use_miniz) + { + MiniZ::PNGWriter writer(compression,strategy); + // image.width()/height() does not reflect the actual image dimensions; it + // refers to the quantized scanlines. + writer.writeIHDR(width, height, color_depth); + writer.writePLTE(palette); + writer.writetRNS(alpha); + writer.writeIDAT(image); + writer.writeIEND(); + writer.toStream(file); + return; + } + png_voidp error_ptr=0; png_structp png_ptr=png_create_write_struct(PNG_LIBPNG_VER_STRING, error_ptr,0, 0); - if (!png_ptr) return; + if (!png_ptr) + { + return; + } // switch on optimization only if supported #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200) && defined(PNG_MMX_CODE_SUPPORTED) @@ -260,10 +327,14 @@ { trans[i]=alpha[i]; if (alpha[i]<255) + { alphaSize = i+1; + } } if (alphaSize>0) + { png_set_tRNS(png_ptr, info_ptr, (png_bytep)&trans[0], alphaSize, 0); + } } png_write_info(png_ptr, info_ptr); @@ -277,8 +348,13 @@ } template -void save_as_png8_oct(T1 & file, T2 const& image, const unsigned max_colors = 256, - int compression = Z_DEFAULT_COMPRESSION, int strategy = Z_DEFAULT_STRATEGY, int trans_mode = -1) +void save_as_png8_oct(T1 & file, + T2 const& image, + const unsigned max_colors = 256, + int compression = Z_DEFAULT_COMPRESSION, + int strategy = Z_DEFAULT_STRATEGY, + int trans_mode = -1, + bool use_miniz = false) { // number of alpha ranges in png8 format; 2 results in smallest image with binary transparency // 3 is minimum for semitransparency, 4 is recommended, anything else is worse @@ -288,70 +364,117 @@ unsigned alphaHist[256];//transparency histogram unsigned semiCount = 0;//sum of semitransparent pixels unsigned meanAlpha = 0; - for(int i=0; i<256; i++){ - alphaHist[i] = 0; + + if (trans_mode == 0) + { + meanAlpha = 255; } - for (unsigned y = 0; y < height; ++y){ - for (unsigned x = 0; x < width; ++x){ - unsigned val = U2ALPHA((unsigned)image.getRow(y)[x]); - if (trans_mode==0) - val=255; - alphaHist[val]++; - meanAlpha += val; - if (val>0 && val<255) - semiCount++; + else + { + for(int i=0; i<256; i++) + { + alphaHist[i] = 0; } + for (unsigned y = 0; y < height; ++y) + { + for (unsigned x = 0; x < width; ++x) + { + unsigned val = U2ALPHA((unsigned)image.getRow(y)[x]); + alphaHist[val]++; + meanAlpha += val; + if (val>0 && val<255) + { + semiCount++; + } + } + } + meanAlpha /= width*height; } - meanAlpha /= width*height; // transparency ranges division points unsigned limits[MAX_OCTREE_LEVELS+1]; limits[0] = 0; - limits[1] = (alphaHist[0]>0)?1:0; + limits[1] = (trans_mode!=0 && alphaHist[0]>0)?1:0; limits[TRANSPARENCY_LEVELS] = 256; - unsigned alphaHistSum = 0; - for(unsigned j=1; j256/(TRANSPARENCY_LEVELS-1)) + { limits[1]=256/(TRANSPARENCY_LEVELS-1); + } // avoid too wide full opaque range if (limits[TRANSPARENCY_LEVELS-1]<212) + { limits[TRANSPARENCY_LEVELS-1]=212; - if (TRANSPARENCY_LEVELS==2) { + } + if (TRANSPARENCY_LEVELS==2) + { limits[1]=127; } // estimated number of colors from palette assigned to chosen ranges unsigned cols[MAX_OCTREE_LEVELS]; // count colors - for(unsigned j=1; j<=TRANSPARENCY_LEVELS; j++) { - cols[j-1] = 0; - for(unsigned i=limits[j-1]; i0?1:0; // fully transparent color (one or not at all) - if (max_colors>=64) { + if (max_colors>=64) + { // give chance less populated but not empty cols to have at least few colors(12) unsigned minCols = (12+1)*divCoef/(max_colors-cols[0]); - for(unsigned j=1; j12 && cols[j]12 && cols[j] trees[MAX_OCTREE_LEVELS]; for(unsigned j=1; j0; j--){ - if (cols[j]>0 && U2ALPHA(val)>=limits[j]) { + for(unsigned j=TRANSPARENCY_LEVELS-1; j>0; j--) + { + if (cols[j]>0 && U2ALPHA(val)>=limits[j]) + { trees[j].insert(mapnik::rgb(U2RED(val), U2GREEN(val), U2BLUE(val))); break; } @@ -390,11 +516,16 @@ std::vector palette; palette.reserve(max_colors); if (cols[0]) + { palette.push_back(rgb(0,0,0)); + } - for(unsigned j=1; j0) { - if (leftovers>0) { + for(unsigned j=1; j0) + { + if (leftovers>0) + { cols[j] += leftovers; trees[j].setMaxColors(cols[j]); leftovers = 0; @@ -405,7 +536,8 @@ assert(pal.size() <= max_colors); leftovers = cols[j]-pal.size(); cols[j] = pal.size(); - for(unsigned i=0; i alphaTable; //alphaTable.resize(palette.size());//allow semitransparency also in almost opaque range if (trans_mode != 0) + { alphaTable.resize(palette.size() - cols[TRANSPARENCY_LEVELS-1]); + } if (palette.size() > 16 ) { // >16 && <=256 colors -> write 8-bit color depth image_data_8 reduced_image(width,height); reduce_8(image, reduced_image, trees, limits, TRANSPARENCY_LEVELS, alphaTable); - save_as_png(file,palette,reduced_image,width,height,8,compression,strategy,alphaTable); + save_as_png(file,palette,reduced_image,width,height,8,compression,strategy,alphaTable,use_miniz); } else if (palette.size() == 1) { @@ -432,11 +566,12 @@ unsigned image_height = height; image_data_8 reduced_image(image_width,image_height); reduce_1(image,reduced_image,trees, limits, alphaTable); - if (meanAlpha<255 && cols[0]==0) { + if (meanAlpha<255 && cols[0]==0) + { alphaTable.resize(1); alphaTable[0] = meanAlpha; } - save_as_png(file,palette,reduced_image,width,height,1,compression,strategy,alphaTable); + save_as_png(file,palette,reduced_image,width,height,1,compression,strategy,alphaTable,use_miniz); } else { @@ -445,15 +580,20 @@ unsigned image_height = height; image_data_8 reduced_image(image_width,image_height); reduce_4(image, reduced_image, trees, limits, TRANSPARENCY_LEVELS, alphaTable); - save_as_png(file,palette,reduced_image,width,height,4,compression,strategy,alphaTable); + save_as_png(file,palette,reduced_image,width,height,4,compression,strategy,alphaTable,use_miniz); } } template -void save_as_png8(T1 & file, T2 const& image, T3 const & tree, - std::vector const& palette, std::vector const& alphaTable, - int compression = Z_DEFAULT_COMPRESSION, int strategy = Z_DEFAULT_STRATEGY) +void save_as_png8(T1 & file, + T2 const& image, + T3 const & tree, + std::vector const& palette, + std::vector const& alphaTable, + int compression = Z_DEFAULT_COMPRESSION, + int strategy = Z_DEFAULT_STRATEGY, + bool use_miniz = false) { unsigned width = image.width(); unsigned height = image.height(); @@ -462,18 +602,16 @@ { // >16 && <=256 colors -> write 8-bit color depth image_data_8 reduced_image(width, height); - for (unsigned y = 0; y < height; ++y) { mapnik::image_data_32::pixel_type const * row = image.getRow(y); mapnik::image_data_8::pixel_type * row_out = reduced_image.getRow(y); - for (unsigned x = 0; x < width; ++x) { row_out[x] = tree.quantize(row[x]); } } - save_as_png(file, palette, reduced_image, width, height, 8, compression, strategy, alphaTable); + save_as_png(file, palette, reduced_image, width, height, 8, compression, strategy, alphaTable, use_miniz); } else if (palette.size() == 1) { @@ -482,7 +620,7 @@ unsigned image_height = height; image_data_8 reduced_image(image_width, image_height); reduced_image.set(0); - save_as_png(file, palette, reduced_image, width, height, 1, compression, strategy, alphaTable); + save_as_png(file, palette, reduced_image, width, height, 1, compression, strategy, alphaTable, use_miniz); } else { @@ -495,23 +633,30 @@ mapnik::image_data_32::pixel_type const * row = image.getRow(y); mapnik::image_data_8::pixel_type * row_out = reduced_image.getRow(y); byte index = 0; - for (unsigned x = 0; x < width; ++x) { index = tree.quantize(row[x]); - if (x%2 == 0) index = index<<4; + if (x%2 == 0) + { + index = index<<4; + } row_out[x>>1] |= index; } } - save_as_png(file, palette, reduced_image, width, height, 4, compression, strategy, alphaTable); + save_as_png(file, palette, reduced_image, width, height, 4, compression, strategy, alphaTable, use_miniz); } } template -void save_as_png8_hex(T1 & file, T2 const& image, int colors = 256, - int compression = Z_DEFAULT_COMPRESSION, int strategy = Z_DEFAULT_STRATEGY, - int trans_mode = -1, double gamma = 2.0) +void save_as_png8_hex(T1 & file, + T2 const& image, + int colors = 256, + int compression = Z_DEFAULT_COMPRESSION, + int strategy = Z_DEFAULT_STRATEGY, + int trans_mode = -1, + double gamma = 2.0, + bool use_miniz = false) { unsigned width = image.width(); unsigned height = image.height(); @@ -519,9 +664,13 @@ // structure for color quantization hextree tree(colors); if (trans_mode >= 0) + { tree.setTransMode(trans_mode); + } if (gamma > 0) + { tree.setGamma(gamma); + } for (unsigned y = 0; y < height; ++y) { @@ -537,7 +686,6 @@ std::vector pal; tree.create_palette(pal); assert(int(pal.size()) <= colors); - std::vector palette; std::vector alphaTable; for(unsigned i=0; i >(file, image, tree, palette, alphaTable, compression, strategy); + save_as_png8 >(file, image, tree, palette, alphaTable, compression, strategy, use_miniz); } template -void save_as_png8_pal(T1 & file, T2 const& image, rgba_palette const& pal, - int compression = Z_DEFAULT_COMPRESSION, int strategy = Z_DEFAULT_STRATEGY) +void save_as_png8_pal(T1 & file, + T2 const& image, + rgba_palette const& pal, + int compression = Z_DEFAULT_COMPRESSION, + int strategy = Z_DEFAULT_STRATEGY, + bool use_miniz = false) { - save_as_png8(file, image, pal, pal.palette(), pal.alphaTable(), compression, strategy); + save_as_png8(file, image, pal, pal.palette(), pal.alphaTable(), compression, strategy, use_miniz); } } diff -Nru mapnik-2.1.0/include/mapnik/point_symbolizer.hpp mapnik-2.2.0/include/mapnik/point_symbolizer.hpp --- mapnik-2.1.0/include/mapnik/point_symbolizer.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/point_symbolizer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,6 +24,7 @@ #define MAPNIK_POINT_SYMBOLIZER_HPP // mapnik +#include #include #include diff -Nru mapnik-2.1.0/include/mapnik/polygon_clipper.hpp mapnik-2.2.0/include/mapnik/polygon_clipper.hpp --- mapnik-2.1.0/include/mapnik/polygon_clipper.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/polygon_clipper.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,237 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MAPNIK_POLYGON_CLIPPER_HPP +#define MAPNIK_POLYGON_CLIPPER_HPP + +// stl +#include +#include + +// mapnik +#include +#include + +// boost +#include +#include +#include +#include +#include +#include +#include + +BOOST_GEOMETRY_REGISTER_POINT_2D(mapnik::coord2d, double, cs::cartesian, x, y) + +// register mapnik::box2d +namespace boost { namespace geometry { namespace traits +{ + +template<> struct tag > { typedef box_tag type; }; + +template<> struct point_type > { typedef mapnik::coord2d type; }; + +template <> +struct indexed_access, min_corner, 0> +{ + typedef coordinate_type::type ct; + static inline ct get(mapnik::box2d const& b) { return b.minx();} + static inline void set(mapnik::box2d &b, ct const& value) { b.set_minx(value); } +}; + +template <> +struct indexed_access, min_corner, 1> +{ + typedef coordinate_type::type ct; + static inline ct get(mapnik::box2d const& b) { return b.miny();} + static inline void set(mapnik::box2d &b, ct const& value) { b.set_miny(value); } +}; + +template <> +struct indexed_access, max_corner, 0> +{ + typedef coordinate_type::type ct; + static inline ct get(mapnik::box2d const& b) { return b.maxx();} + static inline void set(mapnik::box2d &b, ct const& value) { b.set_maxx(value); } +}; + +template <> +struct indexed_access, max_corner, 1> +{ + typedef coordinate_type::type ct; + static inline ct get(mapnik::box2d const& b) { return b.maxy();} + static inline void set(mapnik::box2d &b , ct const& value) { b.set_maxy(value); } +}; + +}}} + +namespace mapnik { + +using namespace boost::geometry; + +template +struct polygon_clipper +{ + typedef mapnik::coord2d point_2d; + typedef model::polygon polygon_2d; + typedef std::deque polygon_list; + + polygon_clipper(Geometry & geom) + : clip_box_(), + geom_(geom) + { + + } + + polygon_clipper( box2d const& clip_box,Geometry & geom) + : clip_box_(clip_box), + geom_(geom) + { + init(); + } + + void set_clip_box(box2d const& clip_box) + { + clip_box_ = clip_box; + init(); + } + + unsigned type() const + { + return geom_.type(); + } + + void rewind(unsigned path_id) + { + output_.rewind(path_id); + } + + unsigned vertex (double * x, double * y) + { + return output_.vertex(x,y); + } + +private: + + void init() + { + polygon_2d subject_poly; + double x,y; + double prev_x, prev_y; + geom_.rewind(0); + unsigned ring_count = 0; + while (true) + { + unsigned cmd = geom_.vertex(&x,&y); + if (cmd == SEG_END) break; + if (cmd == SEG_MOVETO) + { + prev_x = x; + prev_y = y; + if (ring_count == 0) + { + append(subject_poly, make(x,y)); + } + else + { + subject_poly.inners().push_back(polygon_2d::inner_container_type::value_type()); + append(subject_poly.inners().back(),make(x,y)); + } + ++ring_count; + } + else if (cmd == SEG_LINETO) + { + if (std::abs(x - prev_x) < 1e-12 && std::abs(y - prev_y) < 1e-12) + { + std::cerr << std::setprecision(12) << "coincident vertices:(" << prev_x << "," + << prev_y << ") , (" << x << "," << y << ")" << std::endl; + continue; + } + prev_x = x; + prev_x = y; + if (ring_count == 1) + { + append(subject_poly, make(x,y)); + } + else + { + append(subject_poly.inners().back(),make(x,y)); + } + } + } + + polygon_list clipped_polygons; + + try + { + boost::geometry::intersection(clip_box_, subject_poly, clipped_polygons); + } + catch (boost::geometry::exception const& ex) + { + std::cerr << ex.what() << std::endl; + } + + BOOST_FOREACH(polygon_2d const& poly, clipped_polygons) + { + bool move_to = true; + BOOST_FOREACH(point_2d const& c, boost::geometry::exterior_ring(poly)) + { + if (move_to) + { + move_to = false; + output_.move_to(c.x,c.y); + } + else + { + output_.line_to(c.x,c.y); + } + } + output_.close_path(); + // interior rings + BOOST_FOREACH(polygon_2d::inner_container_type::value_type const& ring, boost::geometry::interior_rings(poly)) + { + move_to = true; + BOOST_FOREACH(point_2d const& c, ring) + { + if (move_to) + { + move_to = false; + output_.move_to(c.x,c.y); + } + else + { + output_.line_to(c.x,c.y); + } + } + output_.close_path(); + } + } + } + + box2d clip_box_; + Geometry & geom_; + mapnik::geometry_type output_; + +}; + +} + +#endif //MAPNIK_POLYGON_CLIPPER_HPP diff -Nru mapnik-2.1.0/include/mapnik/polygon_pattern_symbolizer.hpp mapnik-2.2.0/include/mapnik/polygon_pattern_symbolizer.hpp --- mapnik-2.1.0/include/mapnik/polygon_pattern_symbolizer.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/polygon_pattern_symbolizer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,6 +24,8 @@ #define MAPNIK_POLYGON_PATTERN_SYMBOLIZER_HPP // mapnik +#include +#include #include #include #include diff -Nru mapnik-2.1.0/include/mapnik/polygon_symbolizer.hpp mapnik-2.2.0/include/mapnik/polygon_symbolizer.hpp --- mapnik-2.1.0/include/mapnik/polygon_symbolizer.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/polygon_symbolizer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,8 +25,8 @@ // mapnik #include +#include #include -#include #include namespace mapnik diff -Nru mapnik-2.1.0/include/mapnik/pool.hpp mapnik-2.2.0/include/mapnik/pool.hpp --- mapnik-2.1.0/include/mapnik/pool.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/pool.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,61 +26,38 @@ // mapnik #include #include +#include // boost #include -#include #ifdef MAPNIK_THREADSAFE #include #endif // stl -#include #include #include #include +#include namespace mapnik { -template -class PoolGuard -{ -private: - const T& obj_; - PoolT& pool_; -public: - explicit PoolGuard(const T& ptr,PoolT& pool) - : obj_(ptr), - pool_(pool) {} - - ~PoolGuard() - { - pool_->returnObject(obj_); - } - -private: - PoolGuard(); - PoolGuard(const PoolGuard&); - PoolGuard& operator=(const PoolGuard&); -}; - template class Creator> -class Pool : private boost::noncopyable +class Pool : private mapnik::noncopyable { typedef boost::shared_ptr HolderType; typedef std::deque ContType; Creator creator_; - const unsigned initialSize_; - const unsigned maxSize_; - ContType usedPool_; - ContType unusedPool_; + unsigned initialSize_; + unsigned maxSize_; + ContType pool_; #ifdef MAPNIK_THREADSAFE mutable boost::mutex mutex_; #endif public: - Pool(const Creator& creator,unsigned initialSize=1, unsigned maxSize=10) + Pool(const Creator& creator,unsigned initialSize, unsigned maxSize) :creator_(creator), initialSize_(initialSize), maxSize_(maxSize) @@ -89,7 +66,7 @@ { HolderType conn(creator_()); if (conn->isOK()) - unusedPool_.push_back(conn); + pool_.push_back(conn); } } @@ -98,30 +75,33 @@ #ifdef MAPNIK_THREADSAFE mutex::scoped_lock lock(mutex_); #endif - typename ContType::iterator itr=unusedPool_.begin(); - while ( itr!=unusedPool_.end()) - { - MAPNIK_LOG_DEBUG(pool) << "pool: Borrow instance=" << (*itr).get(); - if ((*itr)->isOK()) + typename ContType::iterator itr=pool_.begin(); + while ( itr!=pool_.end()) + { + if (!itr->unique()) { - usedPool_.push_back(*itr); - unusedPool_.erase(itr); - return usedPool_[usedPool_.size()-1]; + ++itr; + } + else if ((*itr)->isOK()) + { + MAPNIK_LOG_DEBUG(pool) << "pool: Borrow instance=" << (*itr).get(); + return *itr; } else { MAPNIK_LOG_DEBUG(pool) << "pool: Bad connection (erase) instance=" << (*itr).get(); - itr=unusedPool_.erase(itr); + itr=pool_.erase(itr); } } - if (usedPool_.size() < maxSize_) + // all connection have been taken, check if we allowed to grow pool + if (pool_.size() < maxSize_) { HolderType conn(creator_()); if (conn->isOK()) { - usedPool_.push_back(conn); + pool_.push_back(conn); MAPNIK_LOG_DEBUG(pool) << "pool: Create connection=" << conn.get(); @@ -131,33 +111,60 @@ return HolderType(); } - void returnObject(HolderType obj) + unsigned size() const { #ifdef MAPNIK_THREADSAFE mutex::scoped_lock lock(mutex_); #endif - typename ContType::iterator itr=usedPool_.begin(); - while (itr != usedPool_.end()) - { - if (obj.get()==(*itr).get()) - { - MAPNIK_LOG_DEBUG(pool) << "pool: Return instance=" << (*itr).get(); + return pool_.size(); + } - unusedPool_.push_back(*itr); - usedPool_.erase(itr); - return; - } - ++itr; - } + unsigned max_size() const + { +#ifdef MAPNIK_THREADSAFE + mutex::scoped_lock lock(mutex_); +#endif + return maxSize_; + } + + void set_max_size(unsigned size) + { +#ifdef MAPNIK_THREADSAFE + mutex::scoped_lock lock(mutex_); +#endif + maxSize_ = std::max(maxSize_,size); } - std::pair size() const + unsigned initial_size() const { #ifdef MAPNIK_THREADSAFE mutex::scoped_lock lock(mutex_); #endif - std::pair size(unusedPool_.size(),usedPool_.size()); - return size; + return initialSize_; + } + + void set_initial_size(unsigned size) + { +#ifdef MAPNIK_THREADSAFE + mutex::scoped_lock lock(mutex_); +#endif + if (size > initialSize_) + { + initialSize_ = size; + unsigned total_size = pool_.size(); + // ensure we don't have ghost obj's in the pool. + if (total_size < initialSize_) + { + unsigned grow_size = initialSize_ - total_size ; + + for (unsigned i=0; i < grow_size; ++i) + { + HolderType conn(creator_()); + if (conn->isOK()) + pool_.push_back(conn); + } + } + } } }; diff -Nru mapnik-2.1.0/include/mapnik/processed_text.hpp mapnik-2.2.0/include/mapnik/processed_text.hpp --- mapnik-2.1.0/include/mapnik/processed_text.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/processed_text.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,13 +24,20 @@ // mapnik #include -#include #include +#include + +// stl +#include namespace mapnik { -class processed_text : boost::noncopyable +// fwd declares +class freetype_engine; +template class face_manager; + +class MAPNIK_DECL processed_text : mapnik::noncopyable { public: class processed_expression diff -Nru mapnik-2.1.0/include/mapnik/proj_transform.hpp mapnik-2.2.0/include/mapnik/proj_transform.hpp --- mapnik-2.1.0/include/mapnik/proj_transform.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/proj_transform.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,13 +26,11 @@ // mapnik #include #include - -// boost -#include +#include namespace mapnik { -class MAPNIK_DECL proj_transform : private boost::noncopyable +class MAPNIK_DECL proj_transform : private mapnik::noncopyable { public: proj_transform(projection const& source, @@ -51,12 +49,13 @@ mapnik::projection const& dest() const; private: - projection const source_; - projection const dest_; + projection const& source_; + projection const& dest_; bool is_source_longlat_; bool is_dest_longlat_; bool is_source_equal_dest_; bool wgs84_to_merc_; + bool merc_to_wgs84_; }; } diff -Nru mapnik-2.1.0/include/mapnik/projection.hpp mapnik-2.2.0/include/mapnik/projection.hpp --- mapnik-2.1.0/include/mapnik/projection.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/projection.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,20 +24,14 @@ #define MAPNIK_PROJECTION_HPP // mapnik -#include - -// proj4 -#include +#include +#include // boost -#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 -#include -#endif -#include +#include // stl #include -#include #include namespace mapnik { @@ -53,7 +47,9 @@ { friend class proj_transform; public: - explicit projection(std::string const& params = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"); + + projection(std::string const& params, + bool defer_proj_init = false); projection(projection const& rhs); ~projection(); @@ -62,28 +58,33 @@ bool operator!=(const projection& other) const; bool is_initialized() const; bool is_geographic() const; + boost::optional well_known() const; std::string const& params() const; - - void forward(double & x, double &y ) const; + void forward(double & x, double & y) const; void inverse(double & x,double & y) const; - std::string expanded() const; + void init_proj4() const; private: - void init(); void swap (projection& rhs); private: std::string params_; - projPJ proj_; - bool is_geographic_; -#if PJ_VERSION >= 480 - projCtx proj_ctx_; -#elif defined(MAPNIK_THREADSAFE) - static boost::mutex mutex_; -#endif + bool defer_proj_init_; + mutable bool is_geographic_; + mutable void * proj_; + mutable void * proj_ctx_; }; +template +std::basic_ostream & +operator << ( std::basic_ostream & s, mapnik::projection const& p ) +{ + s << "projection(\"" << p.params() << "\")"; + return s; +} + + } #endif // MAPNIK_PROJECTION_HPP diff -Nru mapnik-2.1.0/include/mapnik/ptree_helpers.hpp mapnik-2.2.0/include/mapnik/ptree_helpers.hpp --- mapnik-2.1.0/include/mapnik/ptree_helpers.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/ptree_helpers.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,6 +23,9 @@ #ifndef MAPNIK_PTREE_HELPERS_HPP #define MAPNIK_PTREE_HELPERS_HPP +// stl +#include + // boost #include diff -Nru mapnik-2.1.0/include/mapnik/quad_tree.hpp mapnik-2.2.0/include/mapnik/quad_tree.hpp --- mapnik-2.1.0/include/mapnik/quad_tree.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/quad_tree.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,10 +25,10 @@ // mapnik #include +#include // boost #include -#include // stl #include @@ -37,7 +37,7 @@ namespace mapnik { template -class quad_tree : boost::noncopyable +class quad_tree : mapnik::noncopyable { struct node { diff -Nru mapnik-2.1.0/include/mapnik/query.hpp mapnik-2.2.0/include/mapnik/query.hpp --- mapnik-2.1.0/include/mapnik/query.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/query.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,14 +25,13 @@ //mapnik #include -#include // boost #include // stl #include -#include +#include namespace mapnik { diff -Nru mapnik-2.1.0/include/mapnik/raster.hpp mapnik-2.2.0/include/mapnik/raster.hpp --- mapnik-2.1.0/include/mapnik/raster.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/raster.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,17 +26,21 @@ // mapnik #include #include +#include namespace mapnik { -struct raster +class raster : private mapnik::noncopyable { +public: box2d ext_; image_data_32 data_; - raster(box2d const& ext,image_data_32 const& data) + bool premultiplied_alpha_; + raster(box2d const& ext, unsigned width, unsigned height, bool premultiplied_alpha = false) : ext_(ext), - data_(data) {} + data_(width,height), + premultiplied_alpha_(premultiplied_alpha) + {} }; } #endif // MAPNIK_RASTER_HPP - diff -Nru mapnik-2.1.0/include/mapnik/raster_colorizer.hpp mapnik-2.2.0/include/mapnik/raster_colorizer.hpp --- mapnik-2.1.0/include/mapnik/raster_colorizer.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/raster_colorizer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -40,7 +40,6 @@ // mapnik #include #include -#include #include // boost @@ -52,6 +51,10 @@ namespace mapnik { +class feature_impl; +class raster; + + //! \brief Enumerates the modes of interpolation enum colorizer_mode_enum { @@ -72,7 +75,7 @@ //! //! \param[in] value The stop value //! \param[in] mode The stop mode - //! \param[in] color The stop color + //! \param[in] _color The stop color colorizer_stop(float value = 0, colorizer_mode mode = COLORIZER_INHERIT, color const& _color = color(0,0,0,0), @@ -87,39 +90,39 @@ //! \brief Set the stop value //! \param[in] value The stop value - inline void set_value(float value) { value_ = value; }; + inline void set_value(float value) { value_ = value; } //! \brief Get the stop value //! \return The stop value - inline float get_value() const {return value_; }; + inline float get_value() const { return value_; } //! \brief Set the stop mode //! \param[in] mode The stop mode - inline void set_mode(colorizer_mode mode) { mode_ = mode; }; - inline void set_mode_enum(colorizer_mode_enum mode) { set_mode(mode); }; + inline void set_mode(colorizer_mode mode) { mode_ = mode; } + inline void set_mode_enum(colorizer_mode_enum mode) { set_mode(mode); } //! \brief Get the stop mode //! \return The stop mode - inline colorizer_mode get_mode() const { return mode_; }; - inline colorizer_mode_enum get_mode_enum() const { return get_mode(); }; + inline colorizer_mode get_mode() const { return mode_; } + inline colorizer_mode_enum get_mode_enum() const { return get_mode(); } //! \brief set the stop color - //! \param[in] the stop color - inline void set_color(color const& _color) { color_ = _color; }; + //! \param[in] _color The stop color + inline void set_color(color const& _color) { color_ = _color; } //! \brief get the stop color //! \return The stop color - inline color const& get_color() const {return color_; }; + inline color const& get_color() const { return color_; } //! \brief set the stop label - //! \param[in] the stop label - inline void set_label(std::string const& label) { label_ = label; }; + //! \param[in] label The stop label + inline void set_label(std::string const& label) { label_ = label; } //! \brief get the stop label //! \return The stop label - inline std::string const& get_label() const {return label_; }; + inline std::string const& get_label() const { return label_; } //! \brief Equality operator @@ -160,22 +163,22 @@ void set_default_mode(colorizer_mode mode) { default_mode_ = (mode == COLORIZER_INHERIT) ? COLORIZER_LINEAR:(colorizer_mode_enum)mode; - }; + } - void set_default_mode_enum(colorizer_mode_enum mode) { set_default_mode(mode); }; + void set_default_mode_enum(colorizer_mode_enum mode) { set_default_mode(mode); } //! \brief Get the default mode //! \return The default mode - colorizer_mode get_default_mode() const {return default_mode_; }; - colorizer_mode_enum get_default_mode_enum() const {return get_default_mode(); }; + colorizer_mode get_default_mode() const { return default_mode_; } + colorizer_mode_enum get_default_mode_enum() const { return get_default_mode(); } //! \brief Set the default color //! \param[in] color The default color - void set_default_color(color const& color) { default_color_ = color; }; + void set_default_color(color const& color) { default_color_ = color; } //! \brief Get the default color //! \return The default color - color const& get_default_color() const {return default_color_; }; + color const& get_default_color() const { return default_color_; } //! \brief Add a stop @@ -186,18 +189,18 @@ //! \brief Set the list of stops //! \param[in] stops The list of stops - void set_stops(colorizer_stops const& stops) { stops_ = stops; }; + void set_stops(colorizer_stops const& stops) { stops_ = stops; } //! \brief Get the list of stops //! \return The list of stops - colorizer_stops const& get_stops() const {return stops_; }; + colorizer_stops const& get_stops() const { return stops_; } //! \brief Colorize a raster //! //! \param[in, out] raster A raster stored in float32 single channel format, which gets colorized in place. - //! \param[in] feature used to find 'NODATA' information if available - void colorize(raster_ptr const& raster, Feature const& f) const; + //! \param[in] f The feature used to find 'NODATA' information if available + void colorize(boost::shared_ptr const& raster, feature_impl const& f) const; //! \brief Perform the translation of input to output @@ -209,11 +212,11 @@ //! \brief Set the epsilon value for exact mode //! \param[in] e The epsilon value - inline void set_epsilon(const float e) { if(e > 0) epsilon_ = e; }; + inline void set_epsilon(const float e) { if(e > 0) epsilon_ = e; } //! \brief Get the epsilon value for exact mode //! \return The epsilon value - inline float get_epsilon() const { return epsilon_; }; + inline float get_epsilon() const { return epsilon_; } private: colorizer_stops stops_; //!< The vector of stops diff -Nru mapnik-2.1.0/include/mapnik/raster_symbolizer.hpp mapnik-2.2.0/include/mapnik/raster_symbolizer.hpp --- mapnik-2.1.0/include/mapnik/raster_symbolizer.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/raster_symbolizer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,149 +25,39 @@ // mapnik #include -#include -#include #include -#include -#include +#include #include // boost -#include +#include + +//stl +#include namespace mapnik { + struct MAPNIK_DECL raster_symbolizer : public symbolizer_base { + raster_symbolizer(); + raster_symbolizer(raster_symbolizer const& rhs); - raster_symbolizer() - : symbolizer_base(), - mode_("normal"), - scaling_(SCALING_NEAR), - opacity_(1.0), - colorizer_(), - filter_factor_(-1), - mesh_size_(16) {} - - raster_symbolizer(const raster_symbolizer &rhs) - : symbolizer_base(rhs), - mode_(rhs.mode_), - scaling_(rhs.scaling_), - opacity_(rhs.opacity_), - colorizer_(rhs.colorizer_), - filter_factor_(rhs.filter_factor_), - mesh_size_(rhs.mesh_size_) {} - - std::string const& get_mode() const - { - MAPNIK_LOG_ERROR(raster_symbolizer) << "getting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x"; - return mode_; - } - void set_mode(std::string const& mode) - { - MAPNIK_LOG_ERROR(raster_symbolizer) << "setting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x"; - mode_ = mode; - if (mode == "normal") - { - MAPNIK_LOG_ERROR(raster_symbolizer) << "converting 'mode=normal' to 'comp-op:src_over'"; - this->set_comp_op(src_over); - } - else - { - std::string mode2 = boost::algorithm::replace_last_copy(mode,"2",""); - boost::optional comp_op = comp_op_from_string(mode2); - if (comp_op) - { - MAPNIK_LOG_ERROR(raster_symbolizer) << "converting 'mode:" << mode << "' to 'comp-op:" + *comp_op_to_string(*comp_op) + "'"; - this->set_comp_op(*comp_op); - } - else - { - MAPNIK_LOG_ERROR(raster_symbolizer) << "could not convert mode '" << mode << "' into comp-op, defaulting to 'comp-op:src-over'"; - } - } - } - scaling_method_e get_scaling_method() const - { - return scaling_; - } - void set_scaling_method(scaling_method_e scaling) - { - scaling_ = scaling; - } - void set_opacity(float opacity) - { - opacity_ = opacity; - } - float get_opacity() const - { - return opacity_; - } - raster_colorizer_ptr get_colorizer() const - { - return colorizer_; - } - void set_colorizer(raster_colorizer_ptr const& colorizer) - { - colorizer_ = colorizer; - } - double get_filter_factor() const - { - return filter_factor_; - } - void set_filter_factor(double filter_factor) - { - filter_factor_=filter_factor; - } - double calculate_filter_factor() const - { - if (filter_factor_ > 0) - { - // respect explicitly specified values - return filter_factor_; - } else { - double ff = 1.0; - - switch(scaling_) - { - case SCALING_NEAR: - ff = 1.0; - break; - - // TODO potentially some of these algorithms would use filter_factor >2.0. - // Contributions welcome from someone who knows more about them. - case SCALING_BILINEAR: - case SCALING_BILINEAR8: - case SCALING_BICUBIC: - case SCALING_SPLINE16: - case SCALING_SPLINE36: - case SCALING_HANNING: - case SCALING_HAMMING: - case SCALING_HERMITE: - case SCALING_KAISER: - case SCALING_QUADRIC: - case SCALING_CATROM: - case SCALING_GAUSSIAN: - case SCALING_BESSEL: - case SCALING_MITCHELL: - case SCALING_SINC: - case SCALING_LANCZOS: - case SCALING_BLACKMAN: - ff = 2.0; - break; - } - return ff; - } - } - unsigned get_mesh_size() const - { - return mesh_size_; - } - void set_mesh_size(unsigned mesh_size) - { - mesh_size_=mesh_size; - } - + std::string const& get_mode() const; + void set_mode(std::string const& mode); + scaling_method_e get_scaling_method() const; + void set_scaling_method(scaling_method_e scaling); + void set_opacity(float opacity); + float get_opacity() const; + raster_colorizer_ptr get_colorizer() const; + void set_colorizer(raster_colorizer_ptr const& colorizer); + double get_filter_factor() const; + void set_filter_factor(double filter_factor); + double calculate_filter_factor() const; + unsigned get_mesh_size() const; + void set_mesh_size(unsigned mesh_size); + boost::optional premultiplied() const; + void set_premultiplied(bool premultiplied); private: std::string mode_; @@ -176,6 +66,7 @@ raster_colorizer_ptr colorizer_; double filter_factor_; unsigned mesh_size_; + boost::optional premultiplied_; }; } diff -Nru mapnik-2.1.0/include/mapnik/request.hpp mapnik-2.2.0/include/mapnik/request.hpp --- mapnik-2.1.0/include/mapnik/request.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/request.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,60 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_REQUEST_HPP +#define MAPNIK_REQUEST_HPP + +// mapnik +#include +#include + +// boost +#include + +namespace mapnik +{ + +class MAPNIK_DECL request +{ +public: + request(unsigned width, + unsigned height, + box2d const& extent); + unsigned width() const; + unsigned height() const; + void set_buffer_size(int buffer_size); + int buffer_size() const; + box2d const& extent() const; + void set_extent(box2d const& box); + box2d get_buffered_extent() const; + double scale() const; + ~request(); +private: + unsigned width_; + unsigned height_; + box2d extent_; + int buffer_size_; +}; + +} + +#endif // MAPNIK_REQUEST_HPP diff -Nru mapnik-2.1.0/include/mapnik/rule.hpp mapnik-2.2.0/include/mapnik/rule.hpp --- mapnik-2.1.0/include/mapnik/rule.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/rule.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -34,19 +34,19 @@ #include #include #include +#include #include #include #include +#include // MAPNIK_DECL // boost -#include -#include -#include -#include +#include // stl #include #include +#include namespace mapnik { @@ -108,6 +108,12 @@ return (&lhs == &rhs); } +inline bool operator==(debug_symbolizer const& lhs, + debug_symbolizer const& rhs) +{ + return (&lhs == &rhs); +} + typedef boost::variant symbolizer; + markers_symbolizer, + debug_symbolizer> symbolizer; -class rule +class MAPNIK_DECL rule { public: typedef std::vector symbolizers; @@ -133,255 +140,39 @@ bool else_filter_; bool also_filter_; - struct deepcopy_symbolizer : public boost::static_visitor<> - { - - void operator () (markers_symbolizer & sym) const - { - copy_path_ptr(sym); - } - - void operator () (point_symbolizer & sym) const - { - copy_path_ptr(sym); - } - - void operator () (polygon_pattern_symbolizer & sym) const - { - copy_path_ptr(sym); - } - - void operator () (line_pattern_symbolizer & sym) const - { - copy_path_ptr(sym); - } - - void operator () (raster_symbolizer & sym) const - { - raster_colorizer_ptr old_colorizer = sym.get_colorizer(); - raster_colorizer_ptr new_colorizer = raster_colorizer_ptr(); - new_colorizer->set_stops(old_colorizer->get_stops()); - new_colorizer->set_default_mode(old_colorizer->get_default_mode()); - new_colorizer->set_default_color(old_colorizer->get_default_color()); - new_colorizer->set_epsilon(old_colorizer->get_epsilon()); - sym.set_colorizer(new_colorizer); - } - - void operator () (text_symbolizer & sym) const - { - copy_text_ptr(sym); - } - - void operator () (shield_symbolizer & sym) const - { - copy_path_ptr(sym); - copy_text_ptr(sym); - } - - void operator () (building_symbolizer & sym) const - { - copy_height_ptr(sym); - } - - - template void operator () (T &sym) const - { - boost::ignore_unused_variable_warning(sym); - } - - private: - template - void copy_path_ptr(T & sym) const - { - std::string path = path_processor_type::to_string(*sym.get_filename()); - sym.set_filename( parse_path(path) ); - } - - template - void copy_text_ptr(T & sym) const - { - boost::ignore_unused_variable_warning(sym); - MAPNIK_LOG_WARN(rule) << "rule: deep copying TextSymbolizers is broken!"; - } - - template - void copy_height_ptr(T & sym) const - { - std::string height_expr = to_expression_string(*sym.height()); - sym.set_height(parse_expression(height_expr,"utf8")); - } - }; - public: - rule() - : name_(), - min_scale_(0), - max_scale_(std::numeric_limits::infinity()), - syms_(), - filter_(boost::make_shared(true)), - else_filter_(false), - also_filter_(false) {} - - rule(const std::string& name, - double min_scale_denominator=0, - double max_scale_denominator=std::numeric_limits::infinity()) - : name_(name), - min_scale_(min_scale_denominator), - max_scale_(max_scale_denominator), - syms_(), - filter_(boost::make_shared(true)), - else_filter_(false), - also_filter_(false) {} - - rule(const rule& rhs, bool deep_copy = false) - : name_(rhs.name_), - min_scale_(rhs.min_scale_), - max_scale_(rhs.max_scale_), - syms_(rhs.syms_), - filter_(rhs.filter_), - else_filter_(rhs.else_filter_), - also_filter_(rhs.also_filter_) - { - if (deep_copy) { - - std::string expr = to_expression_string(*filter_); - filter_ = parse_expression(expr,"utf8"); - symbolizers::const_iterator it = syms_.begin(); - symbolizers::const_iterator end = syms_.end(); - - for(; it != end; ++it) - { - boost::apply_visitor(deepcopy_symbolizer(),*it); - } - } - } - - rule& operator=(rule const& rhs) - { - rule tmp(rhs); - swap(tmp); - return *this; - } - bool operator==(rule const& other) - { - return (this == &other); - } - - void set_max_scale(double scale) - { - max_scale_=scale; - } - - double get_max_scale() const - { - return max_scale_; - } - - void set_min_scale(double scale) - { - min_scale_=scale; - } - - double get_min_scale() const - { - return min_scale_; - } - - void set_name(std::string const& name) - { - name_=name; - } - - std::string const& get_name() const - { - return name_; - } - - void append(const symbolizer& sym) - { - syms_.push_back(sym); - } - - void remove_at(size_t index) - { - if (index < syms_.size()) - { - syms_.erase(syms_.begin()+index); - } - } - - const symbolizers& get_symbolizers() const - { - return syms_; - } - - symbolizers::const_iterator begin() const - { - return syms_.begin(); - } - - symbolizers::const_iterator end() const - { - return syms_.end(); - } - - symbolizers::iterator begin() - { - return syms_.begin(); - } - - symbolizers::iterator end() - { - return syms_.end(); - } - - void set_filter(const expression_ptr& filter) - { - filter_=filter; - } - - expression_ptr const& get_filter() const - { - return filter_; - } - - void set_else(bool else_filter) - { - else_filter_=else_filter; - } - - bool has_else_filter() const - { - return else_filter_; - } - - void set_also(bool also_filter) - { - also_filter_=also_filter; - } - - bool has_also_filter() const - { - return also_filter_; - } - - bool active(double scale) const - { - return ( scale >= min_scale_ - 1e-6 && scale < max_scale_ + 1e-6); - } + rule(); + rule(std::string const& name, + double min_scale_denominator = 0, + double max_scale_denominator = std::numeric_limits::infinity()); + rule(const rule& rhs, bool deep_copy = false); + + rule& operator=(rule const& rhs); + bool operator==(rule const& other); + void set_max_scale(double scale); + double get_max_scale() const; + void set_min_scale(double scale); + double get_min_scale() const; + void set_name(std::string const& name); + std::string const& get_name() const; + void append(symbolizer const& sym); + void remove_at(size_t index); + const symbolizers& get_symbolizers() const; + symbolizers::const_iterator begin() const; + symbolizers::const_iterator end() const; + symbolizers::iterator begin(); + symbolizers::iterator end(); + void set_filter(expression_ptr const& filter); + expression_ptr const& get_filter() const; + void set_else(bool else_filter); + bool has_else_filter() const; + void set_also(bool also_filter); + bool has_also_filter() const; + bool active(double scale) const; private: - void swap(rule& rhs) throw() - { - name_=rhs.name_; - min_scale_=rhs.min_scale_; - max_scale_=rhs.max_scale_; - syms_=rhs.syms_; - filter_=rhs.filter_; - else_filter_=rhs.else_filter_; - also_filter_=rhs.also_filter_; - } + void swap(rule& rhs) throw(); }; } diff -Nru mapnik-2.1.0/include/mapnik/rule_cache.hpp mapnik-2.2.0/include/mapnik/rule_cache.hpp --- mapnik-2.1.0/include/mapnik/rule_cache.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/rule_cache.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,87 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_RULE_CACHE_HPP +#define MAPNIK_RULE_CACHE_HPP + +// mapnik +#include +#include + +// boost +#include + +// stl +#include + +namespace mapnik +{ + +class rule_cache +{ +public: + typedef std::vector rule_ptrs; + rule_cache() + : if_rules_(), + else_rules_(), + also_rules_() {} + + void add_rule(rule const& r) + { + if (r.has_else_filter()) + { + else_rules_.push_back(&r); + } + else if (r.has_also_filter()) + { + also_rules_.push_back(&r); + } + else + { + if_rules_.push_back(&r); + } + } + + rule_ptrs const& get_if_rules() const + { + return if_rules_; + } + + rule_ptrs const& get_else_rules() const + { + return else_rules_; + } + + rule_ptrs const& get_also_rules() const + { + return also_rules_; + } + +private: + rule_ptrs if_rules_; + rule_ptrs else_rules_; + rule_ptrs also_rules_; +}; + +} + +#endif // MAPNIK_RULE_CACHE_HPP diff -Nru mapnik-2.1.0/include/mapnik/scale_denominator.hpp mapnik-2.2.0/include/mapnik/scale_denominator.hpp --- mapnik-2.1.0/include/mapnik/scale_denominator.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/scale_denominator.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -28,8 +28,7 @@ namespace mapnik { -class Map; -MAPNIK_DECL double scale_denominator(Map const& map, bool geographic); +MAPNIK_DECL double scale_denominator(double map_scale, bool geographic); } #endif // MAPNIK_SCALE_DENOMINATOR_HPP diff -Nru mapnik-2.1.0/include/mapnik/shield_symbolizer.hpp mapnik-2.2.0/include/mapnik/shield_symbolizer.hpp --- mapnik-2.1.0/include/mapnik/shield_symbolizer.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/shield_symbolizer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,11 +24,13 @@ #define MAPNIK_SHIELD_SYMBOLIZER_HPP // mapnik +#include +#include #include +#include #include // boost -#include #include namespace mapnik diff -Nru mapnik-2.1.0/include/mapnik/simplify.hpp mapnik-2.2.0/include/mapnik/simplify.hpp --- mapnik-2.1.0/include/mapnik/simplify.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/simplify.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,29 @@ +#ifndef MAPNIK_SIMPLIFY_HPP +#define MAPNIK_SIMPLIFY_HPP + +// mapnik +#include + +// stl +#include + +// boost +#include + +namespace mapnik +{ + +enum simplify_algorithm_e +{ + radial_distance = 0, + douglas_peucker, + visvalingam_whyatt, + zhao_saalfeld +}; + +MAPNIK_DECL boost::optional simplify_algorithm_from_string(std::string const& name); +MAPNIK_DECL boost::optional simplify_algorithm_to_string(simplify_algorithm_e algorithm); + +} + +#endif // MAPNIK_SIMPLIFY_HPP diff -Nru mapnik-2.1.0/include/mapnik/simplify_converter.hpp mapnik-2.2.0/include/mapnik/simplify_converter.hpp --- mapnik-2.1.0/include/mapnik/simplify_converter.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/simplify_converter.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,457 @@ +#ifndef MAPNIK_SIMPLIFY_CONVERTER_HPP +#define MAPNIK_SIMPLIFY_CONVERTER_HPP + +// mapnik +#include +#include +#include +#include +#include + +// stl +#include +#include +#include +#include +#include +#include + +// boost +#include + +namespace mapnik +{ + +struct weighted_vertex : private mapnik::noncopyable +{ + vertex2d coord; + double weight; + weighted_vertex *prev; + weighted_vertex *next; + + weighted_vertex(vertex2d coord_) : + coord(coord_), + weight(std::numeric_limits::infinity()), + prev(NULL), + next(NULL) {} + + double nominalWeight() + { + if (prev == NULL || next == NULL || coord.cmd != SEG_LINETO) { + return std::numeric_limits::infinity(); + } + vertex2d const& A = prev->coord; + vertex2d const& B = next->coord; + vertex2d const& C = coord; + return std::abs((double)((A.x - C.x) * (B.y - A.y) - (A.x - B.x) * (C.y - A.y))) / 2.0; + } + + struct ascending_sort + { + bool operator() (const weighted_vertex *a, const weighted_vertex *b) + { + return b->weight > a->weight; + } + }; +}; + +struct sleeve +{ + vertex2d v[5]; + + sleeve(vertex2d const& v0, vertex2d const& v1, double offset) + { + double a = std::atan2((v1.y - v0.y), (v1.x - v0.x)); + double dx = offset * std::cos(a); + double dy = offset * std::sin(a); + v[0].x = v0.x + dy; + v[0].y = v0.y - dx; + v[1].x = v0.x - dy; + v[1].y = v0.y + dx; + v[2].x = v1.x - dy; + v[2].y = v1.y + dx; + v[3].x = v1.x + dy; + v[3].y = v1.y - dx; + v[4].x = v0.x + dy; + v[4].y = v0.y - dx; + } + + bool inside(vertex2d const& q) + { + bool inside=false; + + for (unsigned i=0;i<4;++i) + { + if ((((v[i+1].y <= q.y) && (q.y < v[i].y)) || + ((v[i].y <= q.y) && (q.y < v[i+1].y))) && + (q.x < (v[i].x - v[i+1].x) * (q.y - v[i+1].y)/ (v[i].y - v[i+1].y) + v[i+1].x)) + inside=!inside; + } + return inside; + } + void print() + { + std::cerr << "LINESTRING(" + << v[0].x << " " << -v[0].y << "," + << v[1].x << " " << -v[1].y << "," + << v[2].x << " " << -v[2].y << "," + << v[3].x << " " << -v[3].y << "," + << v[0].x << " " << -v[0].y << ")" << std::endl; + + } +}; + +template +struct MAPNIK_DECL simplify_converter +{ +public: + simplify_converter(Geometry& geom) + : geom_(geom), + tolerance_(0.0), + status_(initial), + algorithm_(radial_distance), + pos_(0) + {} + + enum status + { + initial, + process, + closing, + end, + cache + }; + + simplify_algorithm_e get_simplify_algorithm() + { + return algorithm_; + } + + void set_simplify_algorithm(simplify_algorithm_e value) + { + if (algorithm_ != value) + { + algorithm_ = value; + reset(); + } + } + + double get_simplify_tolerance() + { + return tolerance_; + } + + void set_simplify_tolerance(double value) + { + if (tolerance_ != value) { + tolerance_ = value; + reset(); + } + } + + void reset() + { + geom_.rewind(0); + vertices_.clear(); + status_ = initial; + pos_ = 0; + } + + void rewind(unsigned int) const + { + pos_ = 0; + } + + unsigned vertex(double* x, double* y) + { + if (tolerance_ == 0.0) + return geom_.vertex(x, y); + + if (status_ == initial) + init_vertices(); + + return output_vertex(x, y); + } + +private: + unsigned output_vertex(double* x, double* y) + { + switch (algorithm_) + { + case visvalingam_whyatt: + return output_vertex_cached(x, y); + case radial_distance: + return output_vertex_distance(x, y); + case zhao_saalfeld: + return output_vertex_sleeve(x, y); + default: + throw std::runtime_error("simplification algorithm not yet implemented"); + } + + return SEG_END; + } + + unsigned output_vertex_cached(double* x, double* y) { + if (pos_ >= vertices_.size()) + return SEG_END; + + previous_vertex_ = vertices_[pos_]; + *x = previous_vertex_.x; + *y = previous_vertex_.y; + pos_++; + return previous_vertex_.cmd; + } + + unsigned output_vertex_distance(double* x, double* y) { + if (status_ == closing) { + status_ = end; + return SEG_CLOSE; + } + + vertex2d last(vertex2d::no_init); + vertex2d vtx(vertex2d::no_init); + while ((vtx.cmd = geom_.vertex(&vtx.x, &vtx.y)) != SEG_END) + { + if (vtx.cmd == SEG_LINETO) { + if (distance_to_previous(vtx) > tolerance_) { + // Only output a vertex if it's far enough away from the previous + break; + } else { + last = vtx; + // continue + } + } else if (vtx.cmd == SEG_CLOSE) { + if (last.cmd == vertex2d::no_init) { + // The previous vertex was already output in the previous call. + // We can now safely output SEG_CLOSE. + status_ = end; + } else { + // We eliminated the previous point because it was too close, but + // we have to output it now anyway, since this is the end of the + // vertex stream. Make sure that we output SEG_CLOSE in the next call. + vtx = last; + status_ = closing; + } + break; + } else if (vtx.cmd == SEG_MOVETO) { + break; + } else { + throw std::runtime_error("Unknown vertex command"); + } + } + + previous_vertex_ = vtx; + *x = vtx.x; + *y = vtx.y; + return vtx.cmd; + } + + template + bool fit_sleeve(Iterator itr,Iterator end, vertex2d const& v) + { + sleeve s(*itr,v,tolerance_); + ++itr; // skip first vertex + for (; itr!=end; ++itr) + { + if (!s.inside(*itr)) + { + return false; + } + } + return true; + } + + unsigned output_vertex_sleeve(double* x, double* y) + { + vertex2d vtx(vertex2d::no_init); + std::size_t min_size = 1; + while ((vtx.cmd = geom_.vertex(&vtx.x, &vtx.y)) != SEG_END) + { + //if ((std::fabs(vtx.x - previous_vertex_.x) < 0.5) && + // (std::fabs(vtx.y - previous_vertex_.y) < 0.5)) + // continue; + + if (status_ == cache && + vertices_.size() >= min_size) + status_ = process; + + previous_vertex_ = vtx; + + if (vtx.cmd == SEG_MOVETO) + { + if (sleeve_cont_.size() > 1) + { + vertices_.push_back(sleeve_cont_.back()); + sleeve_cont_.clear(); + } + vertices_.push_back(vtx); + sleeve_cont_.push_back(vtx); + if (status_ == process) break; + } + else if (vtx.cmd == SEG_LINETO) + { + if (sleeve_cont_.size() > 1 && !fit_sleeve(sleeve_cont_.begin(), sleeve_cont_.end(), vtx)) + { + vertex2d last = vtx; + vtx = sleeve_cont_.back(); + sleeve_cont_.clear(); + sleeve_cont_.push_back(vtx); + sleeve_cont_.push_back(last); + vertices_.push_back(vtx); + if (status_ == process) break; + } + else + { + sleeve_cont_.push_back(vtx); + } + } + else if (vtx.cmd == SEG_CLOSE) + { + if (sleeve_cont_.size() > 1) + { + vertices_.push_back(sleeve_cont_.back()); + sleeve_cont_.clear(); + } + vertices_.push_back(vtx); + if (status_ == process) break; + } + } + + if (status_ == cache) + { + if (vertices_.size() < min_size) + return SEG_END; + status_ = process; + } + + if (vtx.cmd == SEG_END) + { + if (sleeve_cont_.size() > 1) + { + vertices_.push_back(sleeve_cont_.back()); + } + sleeve_cont_.clear(); + vertices_.push_back(vtx); + } + + if (vertices_.size() > 0) + { + vertex2d v = vertices_.front(); + vertices_.pop_front(); + *x = v.x; + *y = v.y; + return v.cmd; + } + return SEG_END; + } + + double distance_to_previous(vertex2d const& vtx) { + double dx = previous_vertex_.x - vtx.x; + double dy = previous_vertex_.y - vtx.y; + return dx * dx + dy * dy; + } + + status init_vertices() + { + if (status_ != initial) // already initialized + return status_; + + reset(); + + switch (algorithm_) { + case visvalingam_whyatt: + return init_vertices_visvalingam_whyatt(); + case radial_distance: + // Use + vertices_.push_back(vertex2d(vertex2d::no_init)); + return status_ = process; + case zhao_saalfeld: + return status_ = cache; + default: + throw std::runtime_error("simplification algorithm not yet implemented"); + } + } + + status init_vertices_visvalingam_whyatt() + { + typedef std::set VertexSet; + typedef std::vector VertexList; + + std::vector v_list; + vertex2d vtx(vertex2d::no_init); + while ((vtx.cmd = geom_.vertex(&vtx.x, &vtx.y)) != SEG_END) + { + v_list.push_back(new weighted_vertex(vtx)); + } + + if (v_list.empty()) { + return status_ = process; + } + + // Connect the vertices in a linked list and insert them into the set. + VertexSet v; + for (VertexList::iterator i = v_list.begin(); i != v_list.end(); ++i) + { + (*i)->prev = i == v_list.begin() ? NULL : *(i - 1); + (*i)->next = i + 1 == v_list.end() ? NULL : *(i + 1); + (*i)->weight = (*i)->nominalWeight(); + v.insert(*i); + } + + // Use Visvalingam-Whyatt algorithm to calculate each point's weight. + while (v.size() > 0) + { + VertexSet::iterator lowest = v.begin(); + weighted_vertex *removed = *lowest; + if (removed->weight >= tolerance_) { + break; + } + + v.erase(lowest); + + // Connect adjacent vertices with each other + if (removed->prev) removed->prev->next = removed->next; + if (removed->next) removed->next->prev = removed->prev; + // Adjust weight and reinsert prev/next to move them to their correct position. + if (removed->prev) { + v.erase(removed->prev); + removed->prev->weight = std::max(removed->weight, removed->prev->nominalWeight()); + v.insert(removed->prev); + } + if (removed->next) { + v.erase(removed->next); + removed->next->weight = std::max(removed->weight, removed->next->nominalWeight()); + v.insert(removed->next); + } + } + + v.clear(); + + // Traverse the remaining list and insert them into the vertex cache. + for (VertexList::iterator i = v_list.begin(); i != v_list.end(); ++i) + { + if ((*i)->weight >= tolerance_) + { + vertices_.push_back((*i)->coord); + } + delete *i; + } + + // Initialization finished. + return status_ = process; + } + + Geometry& geom_; + double tolerance_; + status status_; + simplify_algorithm_e algorithm_; + std::deque vertices_; + std::deque sleeve_cont_; + vertex2d previous_vertex_; + mutable size_t pos_; +}; + + +} + +#endif // MAPNIK_SIMPLIFY_CONVERTER_HPP diff -Nru mapnik-2.1.0/include/mapnik/sql_utils.hpp mapnik-2.2.0/include/mapnik/sql_utils.hpp --- mapnik-2.1.0/include/mapnik/sql_utils.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/sql_utils.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,40 +23,39 @@ #ifndef MAPNIK_SQL_UTILS_HPP #define MAPNIK_SQL_UTILS_HPP +// mapnik +#include // for trim + // boost -#include -#include +#include "boost/algorithm/string/replace.hpp" // for ireplace_all, etc + +// stl +#include +#include +#include namespace mapnik { namespace sql_utils { - inline std::string unquote_double(const std::string& sql) + inline std::string unquote_double(std::string const& sql) { std::string table_name = sql; - boost::algorithm::trim_if(table_name,boost::algorithm::is_any_of("\"")); + util::unquote_double(table_name); return table_name; } - inline std::string unquote(const std::string& sql) + inline std::string unquote(std::string const& sql) { std::string table_name = sql; - boost::algorithm::trim_if(table_name,boost::algorithm::is_any_of("\"\'")); + util::unquote(table_name); return table_name; } - inline void quote_attr(std::ostringstream& s, const std::string& field) + inline void quote_attr(std::ostringstream & s, std::string const& field) { - if (boost::algorithm::icontains(field,".")) { - std::vector parts; - boost::split(parts, field, boost::is_any_of(".")); - s << ",\"" << parts[0] << "\".\"" << parts[1] << "\""; - } - else - { - s << ",\"" + field + "\""; - } + s << ",\"" << field << "\""; } - inline std::string table_from_sql(const std::string& sql) + inline std::string table_from_sql(std::string const& sql) { std::string table_name = sql; boost::algorithm::replace_all(table_name,"\n"," "); @@ -78,120 +77,6 @@ } return table_name; } - - inline std::string numeric2string(const char* buf) - { - int16_t ndigits = int2net(buf); - int16_t weight = int2net(buf+2); - int16_t sign = int2net(buf+4); - int16_t dscale = int2net(buf+6); - - boost::scoped_array digits(new int16_t[ndigits]); - for (int n=0; n < ndigits ;++n) - { - digits[n] = int2net(buf+8+n*2); - } - - std::ostringstream ss; - - if (sign == 0x4000) ss << "-"; - - int i = std::max(weight,int16_t(0)); - int d = 0; - - // Each numeric "digit" is actually a value between 0000 and 9999 stored in a 16 bit field. - // For example, the number 1234567809990001 is stored as four digits: [1234] [5678] [999] [1]. - // Note that the last two digits show that the leading 0's are lost when the number is split. - // We must be careful to re-insert these 0's when building the string. - - while ( i >= 0) - { - if (i <= weight && d < ndigits) - { - // All digits after the first must be padded to make the field 4 characters long - if (d != 0) - { -#ifdef _WINDOWS - int dig = digits[d]; - if (dig < 10) - { - ss << "000"; // 0000 - 0009 - } - else if (dig < 100) - { - ss << "00"; // 0010 - 0099 - } - else - { - ss << "0"; // 0100 - 0999; - } -#else - switch(digits[d]) - { - case 0 ... 9: - ss << "000"; // 0000 - 0009 - break; - case 10 ... 99: - ss << "00"; // 0010 - 0099 - break; - case 100 ... 999: - ss << "0"; // 0100 - 0999 - break; - } -#endif - } - ss << digits[d++]; - } - else - { - if (d == 0) - ss << "0"; - else - ss << "0000"; - } - - i--; - } - if (dscale > 0) - { - ss << '.'; - // dscale counts the number of decimal digits following the point, not the numeric digits - while (dscale > 0) - { - int value; - if (i <= weight && d < ndigits) - value = digits[d++]; - else - value = 0; - - // Output up to 4 decimal digits for this value - if (dscale > 0) { - ss << (value / 1000); - value %= 1000; - dscale--; - } - if (dscale > 0) { - ss << (value / 100); - value %= 100; - dscale--; - } - if (dscale > 0) { - ss << (value / 10); - value %= 10; - dscale--; - } - if (dscale > 0) { - ss << value; - dscale--; - } - - i--; - } - } - return ss.str(); - } - } - -} +}} #endif // MAPNIK_SQL_UTILS_HPP diff -Nru mapnik-2.1.0/include/mapnik/stroke.hpp mapnik-2.2.0/include/mapnik/stroke.hpp --- mapnik-2.1.0/include/mapnik/stroke.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/stroke.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,6 +24,7 @@ #define MAPNIK_STROKE_HPP // mapnik +#include #include #include #include @@ -33,9 +34,7 @@ namespace mapnik { -using std::pair; -using std::vector; -typedef vector > dash_array; +typedef std::vector > dash_array; // if you add new tokens, don't forget to add them to the corresponding // string array in the cpp file. diff -Nru mapnik-2.1.0/include/mapnik/svg/output/svg_generator.hpp mapnik-2.2.0/include/mapnik/svg/output/svg_generator.hpp --- mapnik-2.1.0/include/mapnik/svg/output/svg_generator.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/output/svg_generator.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,76 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_SVG_GENERATOR_HPP +#define MAPNIK_SVG_GENERATOR_HPP + +// mapnik +#include +#include +#include +#include +#include +#include +#include + + +namespace mapnik { namespace svg { + + /*! + * @brief Performs the actual generation of output calling the underlying library. + * A method to generate each kind of SVG tag is provided. The information needed + * needed to generate the attributes of a tag is passed within a *_output_attributes + * structure. + */ + template + class svg_generator : private mapnik::noncopyable + { + typedef svg::svg_root_attributes_grammar root_attributes_grammar; + typedef svg::svg_rect_attributes_grammar rect_attributes_grammar; + typedef svg::svg_path_attributes_grammar path_attributes_grammar; + typedef svg::svg_path_dash_array_grammar path_dash_array_grammar; + + public: + explicit svg_generator(OutputIterator& output_iterator); + ~svg_generator(); + + void generate_header(); + void generate_opening_root(root_output_attributes const& root_attributes); + void generate_closing_root(); + void generate_rect(rect_output_attributes const& rect_attributes); + template + void generate_path(PathType const& path, path_output_attributes const& path_attributes) + { + util::svg_generator svg_path_grammer; + karma::generate(output_iterator_, lit("\n"), path_attributes); + } + + private: + OutputIterator& output_iterator_; + }; + }} + +#endif // MAPNIK_SVG_GENERATOR_HPP diff -Nru mapnik-2.1.0/include/mapnik/svg/output/svg_output_attributes.hpp mapnik-2.2.0/include/mapnik/svg/output/svg_output_attributes.hpp --- mapnik-2.1.0/include/mapnik/svg/output/svg_output_attributes.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/output/svg_output_attributes.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,201 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_SVG_OUTPUT_ATTRIBUTES +#define MAPNIK_SVG_OUTPUT_ATTRIBUTES + +// mapnik +#include +#include + +// stl +#include + +namespace mapnik { namespace svg { + + /*! + * @brief SVG path tag attributes. + * This structure encapsulates the values needed to + * generate a path tag. It is meant to be filled with + * the values stored in line_ and polygon_ symbolizers. + * + * The values are stored using the variable types that + * are required for output generation, but the interface + * is written with the original types. "set" methods + * perform the necessary conversions (i.e. from color to + * hex string). + */ + struct path_output_attributes + { + path_output_attributes() + : fill_color_("none"), + fill_opacity_(1.0), + stroke_color_("none"), + stroke_opacity_(1.0), + stroke_width_(0.0), + stroke_linecap_("butt"), + stroke_linejoin_("miter"), + stroke_dasharray_(), + stroke_dashoffset_(0.0) + {} + + void set_fill_color(color const& fill_color); + void set_fill_opacity(double fill_opacity); + void set_stroke_color(color const& stroke_color); + void set_stroke_opacity(double stroke_opacity); + void set_stroke_width(double stroke_width); + void set_stroke_linecap(line_cap_e stroke_linecap); + void set_stroke_linejoin(line_join_e stroke_linejoin); + void set_stroke_dasharray(dash_array const& stroke_dasharray); + void set_stroke_dashoffset(double stroke_dashoffset); + + std::string const& fill_color() const; + double fill_opacity() const; + std::string const& stroke_color() const; + double stroke_opacity() const; + double stroke_width() const; + std::string const& stroke_linecap() const; + std::string const& stroke_linejoin() const; + dash_array const& stroke_dasharray() const; + double stroke_dashoffset() const; + + /*! + * @brief Set members back to their default values. + */ + void reset(); + + //private: + // polygon symbolizer attributes. + std::string fill_color_; + double fill_opacity_; + + // line symbolizer attributes. + std::string stroke_color_; + double stroke_opacity_; + double stroke_width_; + std::string stroke_linecap_; + std::string stroke_linejoin_; + dash_array stroke_dasharray_; + double stroke_dashoffset_; + }; + + /*! + * @brief SVG rect tag attributes. + * This structure encapsulates the values needed to + * generate a rect tag. It is is meant to be used to + * store background color information. + * + * The values are stored using the variable types that + * are required for output generation, but the interface + * is written with the original types. "set" methods + * perform the necessary conversions (i.e. from color to + * hex string + */ + struct rect_output_attributes + { + rect_output_attributes() + : x_(0), + y_(0), + width_(400), + height_(400), + fill_color_("#000000") + {} + + rect_output_attributes(const int x, const int y, const unsigned width, const unsigned height, color const& fill_color) + : x_(x), + y_(y), + width_(width), + height_(height), + fill_color_(fill_color.to_hex_string()) + {} + + void set_x(const int x); + void set_y(const int y); + void set_width(const unsigned width); + void set_height(const unsigned height); + void set_fill_color(color const& fill_color); + + int x() const; + int y() const; + int width() const; + int height() const; + std::string const& fill_color() const; + + /*! + * @brief Set members back to their default values. + */ + void reset(); + + //private: + int x_; + int y_; + unsigned width_; + unsigned height_; + std::string fill_color_; + }; + + /*! + * @brief SVG root tag attributes. + * This structure encapsulates the values needed to + * generate an svg (root) tag. + * + * The values are stored using the variable types that + * are required for output generation, but the interface + * is written with the original types. "set" methods + * perform the necessary conversions (i.e. from color to + * hex string + */ + struct root_output_attributes + { + root_output_attributes(); + + root_output_attributes(const unsigned width, const unsigned height); + + void set_width(const unsigned width); + void set_height(const unsigned height); + void set_svg_version(double svg_version); + void set_svg_namespace_url(std::string const& svg_namespace_url); + + unsigned width() const; + unsigned height() const; + double svg_version() const; + std::string const& svg_namespace_url() const; + + /*! + * @brief Set members back to their default values. + */ + void reset(); + + // SVG version to which the generated document will be compliant. + static const double SVG_VERSION; + // SVG XML namespace url. + static const std::string SVG_NAMESPACE_URL; + + //private: + unsigned width_; + unsigned height_; + double svg_version_; + std::string svg_namespace_url_; + }; + }} + +#endif // MAPNIK_SVG_OUTPUT_ATTRIBUTES diff -Nru mapnik-2.1.0/include/mapnik/svg/output/svg_output_grammars.hpp mapnik-2.2.0/include/mapnik/svg/output/svg_output_grammars.hpp --- mapnik-2.1.0/include/mapnik/svg/output/svg_output_grammars.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/output/svg_output_grammars.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,183 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef SVG_OUTPUT_GRAMMARS_HPP +#define SVG_OUTPUT_GRAMMARS_HPP + +// mapnik +#include + +// fwd declare +namespace mapnik { namespace svg { + struct path_output_attributes; + struct rect_output_attributes; + struct root_output_attributes; +} } + +// boost +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/*! + * mapnik::svg::path_output_attributes is adapted as a fusion sequence + * in order to be used directly by the svg_path_attributes_grammar (below). + * + * This adaptation is the primary reason why the attributes are stored in + * this structure before being passed to the generate_path method. + */ +BOOST_FUSION_ADAPT_STRUCT( + mapnik::svg::path_output_attributes, + (std::string, fill_color_) + (double, fill_opacity_) + (std::string, stroke_color_) + (double, stroke_opacity_) + (double, stroke_width_) + (std::string, stroke_linecap_) + (std::string, stroke_linejoin_) + (double, stroke_dashoffset_) + ) + +/*! + * mapnik::svg::rect_output_attributes is adapted as a fusion sequence + * in order to be used directly by the svg_rect_attributes_grammar (below). + */ +BOOST_FUSION_ADAPT_STRUCT( + mapnik::svg::rect_output_attributes, + (int, x_) + (int, y_) + (unsigned, width_) + (unsigned, height_) + (std::string, fill_color_) + ) + +/*! + * mapnik::svg::root_output_attributes is adapted as a fusion sequence + * in order to be used directly by the svg_root_attributes_grammar (below). + */ +BOOST_FUSION_ADAPT_STRUCT( + mapnik::svg::root_output_attributes, + (unsigned, width_) + (unsigned, height_) + (double, svg_version_) + (std::string, svg_namespace_url_) + ) + +namespace mapnik { namespace svg { + + using namespace boost::spirit; + using namespace boost::phoenix; + + +template +struct svg_path_attributes_grammar : karma::grammar +{ + explicit svg_path_attributes_grammar() + : svg_path_attributes_grammar::base_type(svg_path_attributes) + { + using karma::double_; + using karma::string; + using repository::confix; + + svg_path_attributes = + lit("fill=") << confix('"', '"')[string] + << lit(" fill-opacity=") << confix('"', '"')[double_] + << lit(" stroke=") << confix('"', '"')[string] + << lit(" stroke-opacity=") << confix('"', '"')[double_] + << lit(" stroke-width=") << confix('"', '"')[double_ << lit("px")] + << lit(" stroke-linecap=") << confix('"', '"')[string] + << lit(" stroke-linejoin=") << confix('"', '"')[string] + << lit(" stroke-dashoffset=") << confix('"', '"')[double_ << lit("px")]; + } + + karma::rule svg_path_attributes; +}; + +template +struct svg_path_dash_array_grammar : karma::grammar +{ + explicit svg_path_dash_array_grammar() + : svg_path_dash_array_grammar::base_type(svg_path_dash_array) + { + using karma::double_; + using repository::confix; + + svg_path_dash_array = + lit("stroke-dasharray=") + << confix('"', '"')[ + -((double_ << lit(',') << double_) % lit(','))]; + } + + karma::rule svg_path_dash_array; +}; + +template +struct svg_rect_attributes_grammar : karma::grammar +{ + explicit svg_rect_attributes_grammar() + : svg_rect_attributes_grammar::base_type(svg_rect_attributes) + { + using karma::int_; + using karma::string; + using repository::confix; + + svg_rect_attributes = + lit("x=") << confix('"', '"')[int_] + << lit(" y=") << confix('"', '"')[int_] + << lit(" width=") << confix('"', '"')[int_ << lit("px")] + << lit(" height=") << confix('"', '"')[int_ << lit("px")] + << lit(" fill=") << confix('"', '"')[string]; + } + + karma::rule svg_rect_attributes; +}; + +template +struct svg_root_attributes_grammar : karma::grammar +{ + explicit svg_root_attributes_grammar() + : svg_root_attributes_grammar::base_type(svg_root_attributes) + { + using karma::int_; + using karma::string; + using karma::double_; + using repository::confix; + + svg_root_attributes = + lit("width=") << confix('"', '"')[int_ << lit("px")] + << lit(" height=") << confix('"', '"')[int_ << lit("px")] + << " version=" << confix('"', '"')[double_] + << " xmlns=" << confix('"', '"')[string]; + } + + karma::rule svg_root_attributes; +}; +} +} + +#endif // SVG_OUTPUT_GRAMMARS_HPP diff -Nru mapnik-2.1.0/include/mapnik/svg/output/svg_path_iterator.hpp mapnik-2.2.0/include/mapnik/svg/output/svg_path_iterator.hpp --- mapnik-2.1.0/include/mapnik/svg/output/svg_path_iterator.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/output/svg_path_iterator.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,181 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef SVG_PATH_ITERATOR_HPP +#define SVG_PATH_ITERATOR_HPP + +// mapnik +#include +#include + +// boost +#include +#include +#include +#include + +namespace mapnik { +namespace svg { + +using namespace mapnik; + +/* + * @brief Iterator class used to iterate over geometry vertexes. + * Since mapnik::geometry provides access to the components of + * a vertex only through variables passed by reference, + * geometry_iterator retrieves these components (command, x coord, + * and y coord) and makes them available inside tuples. + * + * This iterator exposes the behavior of a forward iterator and + * subclasses boost::iterator_adaptor, which already implements + * several iterator operations, such as dereferencing. + * + * @tparam Value the type of sequence element dereferenced. + * @tparam Container the sequence over which it iterates. + */ +template +class path_iterator + : public boost::iterator_adaptor, + Value*, + boost::use_default, + boost::forward_traversal_tag> +{ +public: + typedef Value value_type; + typedef Container container_type; + //typedef typename Container::value_type value_component_type; + + /*! + * @brief Constructor that initializes the reference to the current element to null. + * This constructor is suitable to mark the end of the iterator (analogous to + * calling end_iterator() in an STL container). + * + * @param geometry the geometry that handles the vector of vertexes. + */ + path_iterator(Container const& path) + : path_iterator::iterator_adaptor_(0), + path_(path), + first_value_(boost::make_shared(0,0,0)) + {} + + /*! + * This constructor receives the first element of the sequence as a pointer. + * Since the container type will likely be a mapnik::geometry, this + * first element would need to be obtained in a similar way as the increment + * method below. For this reason, most of the time this constructor will + * be called with a null pointer. The body of the constructor makes a call + * to increment() in order to obtain this first element from the container. + * + * @param p pointer to the first element of the sequence. + * @param geometry the geometry that handles the vector of vertexes. + */ + explicit path_iterator(Value* first_element, Container const& path) + : path_iterator::iterator_adaptor_(first_element), + path_(path), + first_value_(boost::make_shared(0,0,0)) + { + this->increment(); + } + + struct enabler {}; + + /*! + * @brief Constructor that enables operation between const and non-const iterators. + * @sa http://www.boost.org/doc/libs/1_45_0/libs/iterator/doc/iterator_facade.html#interoperability + */ + template + path_iterator(path_iterator const& other, + typename boost::enable_if, + enabler>::type = enabler()) + : path_iterator::iterator_adaptor_(other.base()) {} + +private: + + // grant access to iterator_adaptor to handle iteration properly. + friend class boost::iterator_core_access; + + /*! + * @brief Advance the iterator. + */ + void increment() + { + // variables used to extract vertex components. + geometry_type::coord_type x; + geometry_type::coord_type y; + + // extract next vertex components. + unsigned cmd = path_.vertex(&x, &y); + + if(cmd == SEG_END) + { + // if the end of the sequence is reached, set the reference + // to the current element to null, so it matches the value + // that marks the end of the sequence as defined in the + // "end_iterator" constructor. + this->base_reference() = 0; + } + else if(this->base_reference() == 0) + { + // the first element of the container is stored in the + // member variable 'first_value_' and later assigned + // to the reference that boost::iterator_adaptor stores + // to track the current element. + // + // 'first_value_' is used as intermediate storage + // because the compiler prohibits the assignment of the + // address of a temporary object (&Value(...)). + *first_value_ = Value(cmd, x, y); + this->base_reference() = first_value_.get(); + } + else + { + // point the reference to the current element to the next. + *(this->base_reference()) = Value(cmd, x, y); + } + } + + /*! + * @brief Test whether the current element is equal to 'other'. + * @tparam OtherValue the value type of the other iterator (it may be const or non-const). + * @param other iterator to compare to current element. + */ + template + bool equal(path_iterator const& other) const + { + return this->base_reference() == other.base(); + } + + Container const& path_; + boost::shared_ptr first_value_; +}; + +/*! + * @brief Specialization of geometry_iterator, as needed by mapnik::svg::svg_path_data_grammar. + * The Value type is a boost::tuple that holds 5 elements, the command and the x and y coordinate. + * Each coordinate is stored twice to match the needs of the grammar. + */ +//typedef path_iterator, +// coord_transform > path_iterator_type; + +}} + +#endif //SVG_PATH_ITERATOR_HPP diff -Nru mapnik-2.1.0/include/mapnik/svg/output/svg_renderer.hpp mapnik-2.2.0/include/mapnik/svg/output/svg_renderer.hpp --- mapnik-2.1.0/include/mapnik/svg/output/svg_renderer.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/output/svg_renderer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,186 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_SVG_RENDERER_HPP +#define MAPNIK_SVG_RENDERER_HPP + +// mapnik +#include +#include +#include +#include +#include +#include +#include // for rule, symbolizers +#include // for box2d +#include // for color +#include // for CoordTransform +#include // for composite_mode_e +#include + +// boost +#include +#include +#include + +// stl +#include + +// fwd declaration to avoid depedence on agg headers +namespace agg { struct trans_affine; } + +// fwd declarations to speed up compile +namespace mapnik { + class Map; + class feature_impl; + class feature_type_style; + class label_collision_detector4; + class layer; + class marker; + class proj_transform; +} + +namespace mapnik +{ +// parameterized with the type of output iterator it will use for output. +// output iterators add more flexibility than streams, because iterators +// can target many other output destinations besides streams. +template +class MAPNIK_DECL svg_renderer : public feature_style_processor >, + private mapnik::noncopyable +{ +public: + typedef svg_renderer processor_impl_type; + svg_renderer(Map const& m, OutputIterator& output_iterator, unsigned offset_x=0, unsigned offset_y=0); + ~svg_renderer(); + + void start_map_processing(Map const& map); + void end_map_processing(Map const& map); + void start_layer_processing(layer const& lay, box2d const& query_extent); + void end_layer_processing(layer const& lay); + void start_style_processing(feature_type_style const& st) {} + void end_style_processing(feature_type_style const& st) {} + + /*! + * @brief Overloads that process each kind of symbolizer individually. + */ + void process(point_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); + void process(line_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); + void process(line_pattern_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); + void process(polygon_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); + void process(polygon_pattern_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); + void process(raster_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); + void process(shield_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); + void process(text_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); + void process(building_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); + void process(markers_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); + void process(debug_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans) {} + + /*! + * @brief Overload that process the whole set of symbolizers of a rule. + * @return true, meaning that this renderer can process multiple symbolizers. + */ + bool process(rule::symbolizers const& syms, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); + + void painted(bool painted) + { + // nothing to do + } + + inline eAttributeCollectionPolicy attribute_collection_policy() const + { + return DEFAULT; + } + + inline OutputIterator& get_output_iterator() + { + return output_iterator_; + } + + inline const OutputIterator& get_output_iterator() const + { + return output_iterator_; + } + +private: + OutputIterator& output_iterator_; + const int width_; + const int height_; + CoordTransform t_; + svg::svg_generator generator_; + svg::path_output_attributes path_attributes_; + box2d query_extent_; + bool painted_; + + /*! + * @brief Visitor that makes the calls to process each symbolizer when stored in a boost::variant. + * This object follows the model of that found in feature_style_processor. It appears here, because + * the logic that iterates over the set of symbolizer has been moved to an SVG renderer's internal + * method. + */ + struct symbol_dispatch : public boost::static_visitor<> + { + symbol_dispatch(svg_renderer& processor, + mapnik::feature_impl & feature, + proj_transform const& prj_trans) + : processor_(processor), + feature_(feature), + prj_trans_(prj_trans) {} + + template + void operator()(Symbolizer const& sym) const + { + processor_.process(sym, feature_, prj_trans_); + } + + svg_renderer& processor_; + mapnik::feature_impl & feature_; + proj_transform const& prj_trans_; + }; +}; +} + +#endif // MAPNIK_SVG_RENDERER_HPP diff -Nru mapnik-2.1.0/include/mapnik/svg/svg_converter.hpp mapnik-2.2.0/include/mapnik/svg/svg_converter.hpp --- mapnik-2.1.0/include/mapnik/svg/svg_converter.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/svg_converter.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,9 +26,7 @@ // mapnik #include #include - -// boost -#include +#include // agg #include "agg_path_storage.h" @@ -46,7 +44,7 @@ namespace svg { template -class svg_converter : boost::noncopyable +class svg_converter : mapnik::noncopyable { public: @@ -266,6 +264,7 @@ { cur_attr().fill_opacity = op; } + void stroke_opacity(double op) { cur_attr().stroke_opacity = op; @@ -273,8 +272,7 @@ void opacity(double op) { - cur_attr().stroke_opacity = op; - cur_attr().fill_opacity = op; + cur_attr().opacity = op; } void line_join(agg::line_join_e join) @@ -310,6 +308,22 @@ agg::bounding_rect(trans, *this, 0, attributes_.size(), x1, y1, x2, y2); } + void set_dimensions(double w, double h) + { + svg_width_ = w; + svg_height_ = h; + } + + double width() + { + return svg_width_; + } + + double height() + { + return svg_height_; + } + VertexSource & storage() { return source_; @@ -335,6 +349,8 @@ AttributeSource & attributes_; AttributeSource attr_stack_; agg::trans_affine transform_; + double svg_width_; + double svg_height_; }; diff -Nru mapnik-2.1.0/include/mapnik/svg/svg_generator.hpp mapnik-2.2.0/include/mapnik/svg/svg_generator.hpp --- mapnik-2.1.0/include/mapnik/svg/svg_generator.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/svg_generator.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef MAPNIK_SVG_GENERATOR_HPP -#define MAPNIK_SVG_GENERATOR_HPP - -// mapnik -#include -#include -#include -#include -#include - -// boost -#include - -namespace mapnik { namespace svg { - - /*! - * @brief Performs the actual generation of output calling the underlying library. - * A method to generate each kind of SVG tag is provided. The information needed - * needed to generate the attributes of a tag is passed within a *_output_attributes - * structure. - */ - template - class svg_generator : private boost::noncopyable - { - typedef coord_transform path_type; - - typedef svg::svg_root_attributes_grammar root_attributes_grammar; - typedef svg::svg_rect_attributes_grammar rect_attributes_grammar; - typedef svg::svg_path_data_grammar path_data_grammar; - typedef svg::svg_path_attributes_grammar path_attributes_grammar; - typedef svg::svg_path_dash_array_grammar path_dash_array_grammar; - - public: - explicit svg_generator(OutputIterator& output_iterator); - ~svg_generator(); - - void generate_header(); - void generate_opening_root(root_output_attributes const& root_attributes); - void generate_closing_root(); - void generate_rect(rect_output_attributes const& rect_attributes); - void generate_path(path_type const& path, path_output_attributes const& path_attributes); - - private: - OutputIterator& output_iterator_; - }; - }} - -#endif // MAPNIK_SVG_GENERATOR_HPP diff -Nru mapnik-2.1.0/include/mapnik/svg/svg_output_attributes.hpp mapnik-2.2.0/include/mapnik/svg/svg_output_attributes.hpp --- mapnik-2.1.0/include/mapnik/svg/svg_output_attributes.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/svg_output_attributes.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,201 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef MAPNIK_SVG_OUTPUT_ATTRIBUTES -#define MAPNIK_SVG_OUTPUT_ATTRIBUTES - -// mapnik -#include -#include - -// stl -#include - -namespace mapnik { namespace svg { - - /*! - * @brief SVG path tag attributes. - * This structure encapsulates the values needed to - * generate a path tag. It is meant to be filled with - * the values stored in line_ and polygon_ symbolizers. - * - * The values are stored using the variable types that - * are required for output generation, but the interface - * is written with the original types. "set" methods - * perform the necessary conversions (i.e. from color to - * hex string). - */ - struct path_output_attributes - { - path_output_attributes() - : fill_color_("none"), - fill_opacity_(1.0), - stroke_color_("none"), - stroke_opacity_(1.0), - stroke_width_(0.0), - stroke_linecap_("butt"), - stroke_linejoin_("miter"), - stroke_dasharray_(), - stroke_dashoffset_(0.0) - {} - - void set_fill_color(color const& fill_color); - void set_fill_opacity(const double fill_opacity); - void set_stroke_color(color const& stroke_color); - void set_stroke_opacity(const double stroke_opacity); - void set_stroke_width(const double stroke_width); - void set_stroke_linecap(const line_cap_e stroke_linecap); - void set_stroke_linejoin(const line_join_e stroke_linejoin); - void set_stroke_dasharray(const dash_array stroke_dasharray); - void set_stroke_dashoffset(const double stroke_dashoffset); - - const std::string fill_color() const; - const double fill_opacity() const; - const std::string stroke_color() const; - const double stroke_opacity() const; - const double stroke_width() const; - const std::string stroke_linecap() const; - const std::string stroke_linejoin() const; - const dash_array stroke_dasharray() const; - const double stroke_dashoffset() const; - - /*! - * @brief Set members back to their default values. - */ - void reset(); - - //private: - // polygon symbolizer attributes. - std::string fill_color_; - double fill_opacity_; - - // line symbolizer attributes. - std::string stroke_color_; - double stroke_opacity_; - double stroke_width_; - std::string stroke_linecap_; - std::string stroke_linejoin_; - dash_array stroke_dasharray_; - double stroke_dashoffset_; - }; - - /*! - * @brief SVG rect tag attributes. - * This structure encapsulates the values needed to - * generate a rect tag. It is is meant to be used to - * store background color information. - * - * The values are stored using the variable types that - * are required for output generation, but the interface - * is written with the original types. "set" methods - * perform the necessary conversions (i.e. from color to - * hex string - */ - struct rect_output_attributes - { - rect_output_attributes() - : x_(0), - y_(0), - width_(400), - height_(400), - fill_color_("#000000") - {} - - rect_output_attributes(const int x, const int y, const unsigned width, const unsigned height, color const& fill_color) - : x_(x), - y_(y), - width_(width), - height_(height), - fill_color_(fill_color.to_hex_string()) - {} - - void set_x(const int x); - void set_y(const int y); - void set_width(const unsigned width); - void set_height(const unsigned height); - void set_fill_color(color const& fill_color); - - const int x() const; - const int y() const; - const int width() const; - const int height() const; - const std::string fill_color() const; - - /*! - * @brief Set members back to their default values. - */ - void reset(); - - //private: - int x_; - int y_; - unsigned width_; - unsigned height_; - std::string fill_color_; - }; - - /*! - * @brief SVG root tag attributes. - * This structure encapsulates the values needed to - * generate an svg (root) tag. - * - * The values are stored using the variable types that - * are required for output generation, but the interface - * is written with the original types. "set" methods - * perform the necessary conversions (i.e. from color to - * hex string - */ - struct root_output_attributes - { - root_output_attributes(); - - root_output_attributes(const unsigned width, const unsigned height); - - void set_width(const unsigned width); - void set_height(const unsigned height); - void set_svg_version(const double svg_version); - void set_svg_namespace_url(std::string const& svg_namespace_url); - - const unsigned width() const; - const unsigned height() const; - const double svg_version() const; - const std::string svg_namespace_url() const; - - /*! - * @brief Set members back to their default values. - */ - void reset(); - - // SVG version to which the generated document will be compliant. - static const double SVG_VERSION; - // SVG XML namespace url. - static const std::string SVG_NAMESPACE_URL; - - //private: - unsigned width_; - unsigned height_; - double svg_version_; - std::string svg_namespace_url_; - }; - }} - -#endif // MAPNIK_SVG_OUTPUT_ATTRIBUTES diff -Nru mapnik-2.1.0/include/mapnik/svg/svg_output_grammars.hpp mapnik-2.2.0/include/mapnik/svg/svg_output_grammars.hpp --- mapnik-2.1.0/include/mapnik/svg/svg_output_grammars.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/svg_output_grammars.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,255 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef SVG_OUTPUT_GRAMMARS_HPP -#define SVG_OUTPUT_GRAMMARS_HPP - -// mapnik -#include -#include -#include -#include -#include - -// boost -#include -#include -#include -#include -#include -#include -#include -#include - -// std -#include - -/*! - * mapnik::svg::path_output_attributes is adapted as a fusion sequence - * in order to be used directly by the svg_path_attributes_grammar (below). - * - * This adaptation is the primary reason why the attributes are stored in - * this structure before being passed to the generate_path method. - */ -BOOST_FUSION_ADAPT_STRUCT( - mapnik::svg::path_output_attributes, - (std::string, fill_color_) - (double, fill_opacity_) - (std::string, stroke_color_) - (double, stroke_opacity_) - (double, stroke_width_) - (std::string, stroke_linecap_) - (std::string, stroke_linejoin_) - (double, stroke_dashoffset_) - ) - -/*! - * mapnik::svg::rect_output_attributes is adapted as a fusion sequence - * in order to be used directly by the svg_rect_attributes_grammar (below). - */ -BOOST_FUSION_ADAPT_STRUCT( - mapnik::svg::rect_output_attributes, - (int, x_) - (int, y_) - (unsigned, width_) - (unsigned, height_) - (std::string, fill_color_) - ) - -/*! - * mapnik::svg::root_output_attributes is adapted as a fusion sequence - * in order to be used directly by the svg_root_attributes_grammar (below). - */ -BOOST_FUSION_ADAPT_STRUCT( - mapnik::svg::root_output_attributes, - (unsigned, width_) - (unsigned, height_) - (double, svg_version_) - (std::string, svg_namespace_url_) - ) - -/*! - * mapnik::geometry_type is adapted to conform to the concepts - * required by Karma to be recognized as a container of - * attributes for output generation. - */ -namespace boost { namespace spirit { namespace traits { - - typedef mapnik::coord_transform path_type; - - template <> - struct is_container - : mpl::true_ {}; - - template <> - struct container_iterator - { - typedef mapnik::svg::path_iterator_type type; - }; - - template <> - struct begin_container - { - static mapnik::svg::path_iterator_type - call(path_type const& path) - { - return mapnik::svg::path_iterator_type(0, path); - } - }; - - template <> - struct end_container - { - static mapnik::svg::path_iterator_type - call(path_type const& path) - { - return mapnik::svg::path_iterator_type(path); - } - }; - }}} - -namespace mapnik { namespace svg { - - using namespace boost::spirit; - using namespace boost::phoenix; - - template - struct svg_path_data_grammar : karma::grammar - { - typedef path_iterator_type::value_type vertex_type; - - explicit svg_path_data_grammar(PathType const& path_type) - : svg_path_data_grammar::base_type(svg_path), - path_type_(path_type) - { - using karma::int_; - using karma::double_; - using repository::confix; - - svg_path = - lit("d=") - << confix('"', '"')[ - -(path_vertex % lit(' '))]; - - path_vertex = - path_vertex_command - << double_ - << lit(' ') - << double_; - - path_vertex_command = &int_(1) << lit('M') | lit('L'); - } - - karma::rule svg_path; - karma::rule path_vertex; - karma::rule path_vertex_command; - - PathType const& path_type_; - }; - -template -struct svg_path_attributes_grammar : karma::grammar -{ - explicit svg_path_attributes_grammar() - : svg_path_attributes_grammar::base_type(svg_path_attributes) - { - using karma::double_; - using karma::string; - using repository::confix; - - svg_path_attributes = - lit("fill=") << confix('"', '"')[string] - << lit(" fill-opacity=") << confix('"', '"')[double_] - << lit(" stroke=") << confix('"', '"')[string] - << lit(" stroke-opacity=") << confix('"', '"')[double_] - << lit(" stroke-width=") << confix('"', '"')[double_ << lit("px")] - << lit(" stroke-linecap=") << confix('"', '"')[string] - << lit(" stroke-linejoin=") << confix('"', '"')[string] - << lit(" stroke-dashoffset=") << confix('"', '"')[double_ << lit("px")]; - } - - karma::rule svg_path_attributes; -}; - -template -struct svg_path_dash_array_grammar : karma::grammar -{ - explicit svg_path_dash_array_grammar() - : svg_path_dash_array_grammar::base_type(svg_path_dash_array) - { - using karma::double_; - using repository::confix; - - svg_path_dash_array = - lit("stroke-dasharray=") - << confix('"', '"')[ - -((double_ << lit(',') << double_) % lit(','))]; - } - - karma::rule svg_path_dash_array; -}; - -template -struct svg_rect_attributes_grammar : karma::grammar -{ - explicit svg_rect_attributes_grammar() - : svg_rect_attributes_grammar::base_type(svg_rect_attributes) - { - using karma::int_; - using karma::string; - using repository::confix; - - svg_rect_attributes = - lit("x=") << confix('"', '"')[int_] - << lit(" y=") << confix('"', '"')[int_] - << lit(" width=") << confix('"', '"')[int_ << lit("px")] - << lit(" height=") << confix('"', '"')[int_ << lit("px")] - << lit(" fill=") << confix('"', '"')[string]; - } - - karma::rule svg_rect_attributes; -}; - -template -struct svg_root_attributes_grammar : karma::grammar -{ - explicit svg_root_attributes_grammar() - : svg_root_attributes_grammar::base_type(svg_root_attributes) - { - using karma::int_; - using karma::string; - using karma::double_; - using repository::confix; - - svg_root_attributes = - lit("width=") << confix('"', '"')[int_ << lit("px")] - << lit(" height=") << confix('"', '"')[int_ << lit("px")] - << " version=" << confix('"', '"')[double_] - << " xmlns=" << confix('"', '"')[string]; - } - - karma::rule svg_root_attributes; -}; -} -} - -#endif // SVG_OUTPUT_GRAMMARS_HPP diff -Nru mapnik-2.1.0/include/mapnik/svg/svg_parser.hpp mapnik-2.2.0/include/mapnik/svg/svg_parser.hpp --- mapnik-2.1.0/include/mapnik/svg/svg_parser.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/svg_parser.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -28,50 +28,27 @@ #include #include #include - -// boost -#include -#include +#include // stl #include namespace mapnik { namespace svg { - class svg_parser : private boost::noncopyable + class svg_parser : private mapnik::noncopyable { public: explicit svg_parser(svg_converter_type & path); ~svg_parser(); void parse(std::string const& filename); void parse_from_string(std::string const& svg); - private: - bool parse_reader(xmlTextReaderPtr reader); - void process_node(xmlTextReaderPtr reader); - void start_element(xmlTextReaderPtr reader); - void end_element(xmlTextReaderPtr reader); - void parse_path(xmlTextReaderPtr reader); - void parse_polygon(xmlTextReaderPtr reader); - void parse_polyline(xmlTextReaderPtr reader); - void parse_line(xmlTextReaderPtr reader); - void parse_rect(xmlTextReaderPtr reader); - void parse_circle(xmlTextReaderPtr reader); - void parse_ellipse(xmlTextReaderPtr reader); - void parse_linear_gradient(xmlTextReaderPtr reader); - void parse_radial_gradient(xmlTextReaderPtr reader); - bool parse_common_gradient(xmlTextReaderPtr reader); - void parse_gradient_stop(xmlTextReaderPtr reader); - void parse_pattern(xmlTextReaderPtr reader); - void parse_attr(xmlTextReaderPtr reader); - void parse_attr(const xmlChar * name, const xmlChar * value ); - private: svg_converter_type & path_; bool is_defs_; std::map gradient_map_; std::pair temporary_gradient_; }; - }} +}} #endif // MAPNIK_SVG_PARSER_HPP diff -Nru mapnik-2.1.0/include/mapnik/svg/svg_path_adapter.hpp mapnik-2.2.0/include/mapnik/svg/svg_path_adapter.hpp --- mapnik-2.1.0/include/mapnik/svg/svg_path_adapter.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/svg_path_adapter.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,7 +24,7 @@ #define MAPNIK_SVG_PATH_ADAPTER_HPP // mapnik -#include +#include // agg #include "agg_math.h" @@ -40,7 +40,7 @@ using namespace agg; -template class path_adapter : boost::noncopyable +template class path_adapter : mapnik::noncopyable { public: typedef VertexContainer container_type; @@ -369,8 +369,8 @@ double y0 = 0.0; vertices_.last_vertex(&x0, &y0); - rx = fabs(rx); - ry = fabs(ry); + rx = std::fabs(rx); + ry = std::fabs(ry); // Ensure radii are valid //------------------------- @@ -838,7 +838,7 @@ } -template class vertex_stl_adapter : boost::noncopyable +template class vertex_stl_adapter : mapnik::noncopyable { public: diff -Nru mapnik-2.1.0/include/mapnik/svg/svg_path_attributes.hpp mapnik-2.2.0/include/mapnik/svg/svg_path_attributes.hpp --- mapnik-2.1.0/include/mapnik/svg/svg_path_attributes.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/svg_path_attributes.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -38,6 +38,7 @@ struct path_attributes { unsigned index; + double opacity; agg::rgba8 fill_color; double fill_opacity; agg::rgba8 stroke_color; @@ -58,6 +59,7 @@ // Empty constructor path_attributes() : index(0), + opacity(1.0), fill_color(agg::rgba(0,0,0)), fill_opacity(1.0), stroke_color(agg::rgba(0,0,0)), @@ -80,6 +82,7 @@ // Copy constructor path_attributes(const path_attributes& attr) : index(attr.index), + opacity(attr.opacity), fill_color(attr.fill_color), fill_opacity(attr.fill_opacity), stroke_color(attr.stroke_color), @@ -101,6 +104,7 @@ // Copy constructor with new index value path_attributes(path_attributes const& attr, unsigned idx) : index(idx), + opacity(attr.opacity), fill_color(attr.fill_color), fill_opacity(attr.fill_opacity), stroke_color(attr.stroke_color), diff -Nru mapnik-2.1.0/include/mapnik/svg/svg_path_grammar.hpp mapnik-2.2.0/include/mapnik/svg/svg_path_grammar.hpp --- mapnik-2.1.0/include/mapnik/svg/svg_path_grammar.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/svg_path_grammar.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -35,7 +35,6 @@ namespace mapnik { namespace svg { using namespace boost::spirit; - using namespace boost::fusion; using namespace boost::phoenix; template @@ -135,7 +134,7 @@ qi::rule,SkipType> A; // A,a qi::rule Z; // Z,z - qi::rule(),SkipType> coord; + qi::rule(),SkipType> coord; // commands function > move_to_; diff -Nru mapnik-2.1.0/include/mapnik/svg/svg_path_iterator.hpp mapnik-2.2.0/include/mapnik/svg/svg_path_iterator.hpp --- mapnik-2.1.0/include/mapnik/svg/svg_path_iterator.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/svg_path_iterator.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,181 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef SVG_PATH_ITERATOR_HPP -#define SVG_PATH_ITERATOR_HPP - -// mapnik -#include -#include - -// boost -#include -#include -#include -#include - -namespace mapnik { -namespace svg { - -using namespace mapnik; - -/* - * @brief Iterator class used to iterate over geometry vertexes. - * Since mapnik::geometry provides access to the components of - * a vertex only through variables passed by reference, - * geometry_iterator retrieves these components (command, x coord, - * and y coord) and makes them available inside tuples. - * - * This iterator exposes the behavior of a forward iterator and - * subclasses boost::iterator_adaptor, which already implements - * several iterator operations, such as dereferencing. - * - * @tparam Value the type of sequence element dereferenced. - * @tparam Container the sequence over which it iterates. - */ -template -class path_iterator - : public boost::iterator_adaptor, - Value*, - boost::use_default, - boost::forward_traversal_tag> -{ -public: - typedef Value value_type; - typedef Container container_type; - typedef typename Container::value_type value_component_type; - - /*! - * @brief Constructor that initializes the reference to the current element to null. - * This constructor is suitable to mark the end of the iterator (analogous to - * calling end_iterator() in an STL container). - * - * @param geometry the geometry that handles the vector of vertexes. - */ - path_iterator(Container const& path) - : path_iterator::iterator_adaptor_(0), - path_(path), - first_value_(boost::make_shared(0,0,0)) - {} - - /*! - * This constructor receives the first element of the sequence as a pointer. - * Since the container type will likely be a mapnik::geometry, this - * first element would need to be obtained in a similar way as the increment - * method below. For this reason, most of the time this constructor will - * be called with a null pointer. The body of the constructor makes a call - * to increment() in order to obtain this first element from the container. - * - * @param p pointer to the first element of the sequence. - * @param geometry the geometry that handles the vector of vertexes. - */ - explicit path_iterator(Value* first_element, Container const& path) - : path_iterator::iterator_adaptor_(first_element), - path_(path), - first_value_(boost::make_shared(0,0,0)) - { - this->increment(); - } - - struct enabler {}; - - /*! - * @brief Constructor that enables operation between const and non-const iterators. - * @sa http://www.boost.org/doc/libs/1_45_0/libs/iterator/doc/iterator_facade.html#interoperability - */ - template - path_iterator(path_iterator const& other, - typename boost::enable_if, - enabler>::type = enabler()) - : path_iterator::iterator_adaptor_(other.base()) {} - -private: - - // grant access to iterator_adaptor to handle iteration properly. - friend class boost::iterator_core_access; - - /*! - * @brief Advance the iterator. - */ - void increment() - { - // variables used to extract vertex components. - geometry_type::value_type x; - geometry_type::value_type y; - - // extract next vertex components. - unsigned cmd = path_.vertex(&x, &y); - - if(cmd == SEG_END) - { - // if the end of the sequence is reached, set the reference - // to the current element to null, so it matches the value - // that marks the end of the sequence as defined in the - // "end_iterator" constructor. - this->base_reference() = 0; - } - else if(this->base_reference() == 0) - { - // the first element of the container is stored in the - // member variable 'first_value_' and later assigned - // to the reference that boost::iterator_adaptor stores - // to track the current element. - // - // 'first_value_' is used as intermediate storage - // because the compiler prohibits the assignment of the - // address of a temporary object (&Value(...)). - *first_value_ = Value(cmd, x, y); - this->base_reference() = first_value_.get(); - } - else - { - // point the reference to the current element to the next. - *(this->base_reference()) = Value(cmd, x, y); - } - } - - /*! - * @brief Test whether the current element is equal to 'other'. - * @tparam OtherValue the value type of the other iterator (it may be const or non-const). - * @param other iterator to compare to current element. - */ - template - bool equal(path_iterator const& other) const - { - return this->base_reference() == other.base(); - } - - Container const& path_; - boost::shared_ptr first_value_; -}; - -/*! - * @brief Specialization of geometry_iterator, as needed by mapnik::svg::svg_path_data_grammar. - * The Value type is a boost::tuple that holds 5 elements, the command and the x and y coordinate. - * Each coordinate is stored twice to match the needs of the grammar. - */ -typedef path_iterator, - coord_transform > path_iterator_type; - -}} - -#endif //SVG_PATH_ITERATOR_HPP diff -Nru mapnik-2.1.0/include/mapnik/svg/svg_points_grammar.hpp mapnik-2.2.0/include/mapnik/svg/svg_points_grammar.hpp --- mapnik-2.1.0/include/mapnik/svg/svg_points_grammar.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/svg_points_grammar.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -34,7 +34,6 @@ namespace mapnik { namespace svg { using namespace boost::spirit; - using namespace boost::fusion; using namespace boost::phoenix; template @@ -58,7 +57,7 @@ // rules qi::rule start; - qi::rule(),SkipType> coord; + qi::rule(),SkipType> coord; // commands function > move_to_; diff -Nru mapnik-2.1.0/include/mapnik/svg/svg_renderer.hpp mapnik-2.2.0/include/mapnik/svg/svg_renderer.hpp --- mapnik-2.1.0/include/mapnik/svg/svg_renderer.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/svg_renderer.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,443 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef MAPNIK_SVG_RENDERER_HPP -#define MAPNIK_SVG_RENDERER_HPP - -// mapnik -#include -#include -#include -#include -#include - -// boost -#include -#include - -// agg -#include "agg_path_storage.h" -#include "agg_conv_transform.h" -#include "agg_conv_stroke.h" -#include "agg_conv_contour.h" -#include "agg_conv_curve.h" -#include "agg_color_rgba.h" -#include "agg_bounding_rect.h" -#include "agg_rendering_buffer.h" -#include "agg_rasterizer_scanline_aa.h" -#include "agg_scanline_u.h" -#include "agg_scanline_p.h" -#include "agg_scanline_bin.h" -#include "agg_renderer_scanline.h" -#include "agg_span_allocator.h" -#include "agg_span_gradient.h" -#include "agg_gradient_lut.h" -#include "agg_gamma_lut.h" -#include "agg_span_interpolator_linear.h" -#include "agg_pixfmt_rgba.h" - -namespace mapnik { -namespace svg { - - -/** - * Arbitrary linear gradient specified by two control points. Gradient - * value is taken as the normalised distance along the line segment - * represented by the two points. - */ -class linear_gradient_from_segment -{ -public: - linear_gradient_from_segment(double x1, double y1, double x2, double y2) : - x1_(x1*agg::gradient_subpixel_scale), - y1_(y1*agg::gradient_subpixel_scale), - x2_(x2*agg::gradient_subpixel_scale), - y2_(y2*agg::gradient_subpixel_scale) - { - double dx = x2_-x1_; - double dy = y2_-y1_; - length_sqr_ = dx*dx+dy*dy; - } - - int calculate(int x, int y, int d) const - { - if (length_sqr_ <= 0) - return 0; - double u = ((x-x1_)*(x2_-x1_) + (y-y1_)*(y2_-y1_))/length_sqr_; - if (u < 0) - u = 0; - else if (u > 1) - u = 1; - return static_cast(u*d); - } -private: - double x1_; - double y1_; - double x2_; - double y2_; - - double length_sqr_; - -}; - -template -class svg_renderer : boost::noncopyable -{ -public: - typedef agg::conv_curve curved_type; - typedef agg::conv_stroke curved_stroked_type; - typedef agg::conv_transform curved_stroked_trans_type; - typedef agg::conv_transform curved_trans_type; - typedef agg::conv_contour curved_trans_contour_type; - typedef agg::renderer_base renderer_base; - - svg_renderer(VertexSource & source, AttributeSource const& attributes) - : source_(source), - curved_(source_), - curved_stroked_(curved_), - attributes_(attributes) {} - - template - void render_gradient(Rasterizer& ras, - Scanline& sl, - Renderer& ren, - const gradient &grad, - agg::trans_affine const& mtx, - double opacity, - const box2d &symbol_bbox, - const box2d &path_bbox) - { - typedef agg::gamma_lut gamma_lut_type; - typedef agg::gradient_lut, 1024> color_func_type; - typedef agg::span_interpolator_linear<> interpolator_type; - typedef agg::span_allocator span_allocator_type; - - span_allocator_type m_alloc; - color_func_type m_gradient_lut; - gamma_lut_type m_gamma_lut; - - double x1,x2,y1,y2,radius; - grad.get_control_points(x1,y1,x2,y2,radius); - - m_gradient_lut.remove_all(); - BOOST_FOREACH ( mapnik::stop_pair const& st, grad.get_stop_array() ) - { - mapnik::color const& stop_color = st.second; - unsigned r = stop_color.red(); - unsigned g = stop_color.green(); - unsigned b = stop_color.blue(); - unsigned a = stop_color.alpha(); - m_gradient_lut.add_color(st.first, agg::rgba8_pre(r, g, b, int(a * opacity))); - } - m_gradient_lut.build_lut(); - - agg::trans_affine transform = mtx; - transform.invert(); - agg::trans_affine tr; - tr = grad.get_transform(); - tr.invert(); - transform *= tr; - - if (grad.get_units() != USER_SPACE_ON_USE) - { - double bx1=symbol_bbox.minx(); - double by1=symbol_bbox.miny(); - double bx2=symbol_bbox.maxx(); - double by2=symbol_bbox.maxy(); - - if (grad.get_units() == OBJECT_BOUNDING_BOX) - { - bx1=path_bbox.minx(); - by1=path_bbox.miny(); - bx2=path_bbox.maxx(); - by2=path_bbox.maxy(); - } - - transform.translate(-bx1,-by1); - transform.scale(1.0/(bx2-bx1),1.0/(by2-by1)); - } - - - if (grad.get_gradient_type() == RADIAL) - { - typedef agg::gradient_radial_focus gradient_adaptor_type; - typedef agg::span_gradient span_gradient_type; - - // the agg radial gradient assumes it is centred on 0 - transform.translate(-x2,-y2); - - // scale everything up since agg turns things into integers a bit too soon - int scaleup=255; - radius*=scaleup; - x1*=scaleup; - y1*=scaleup; - x2*=scaleup; - y2*=scaleup; - - transform.scale(scaleup,scaleup); - interpolator_type span_interpolator(transform); - gradient_adaptor_type gradient_adaptor(radius,(x1-x2),(y1-y2)); - - span_gradient_type span_gradient(span_interpolator, - gradient_adaptor, - m_gradient_lut, - 0, radius); - - render_scanlines_aa(ras, sl, ren, m_alloc, span_gradient); - } - else - { - typedef linear_gradient_from_segment gradient_adaptor_type; - typedef agg::span_gradient span_gradient_type; - - // scale everything up since agg turns things into integers a bit too soon - int scaleup=255; - x1*=scaleup; - y1*=scaleup; - x2*=scaleup; - y2*=scaleup; - - transform.scale(scaleup,scaleup); - - interpolator_type span_interpolator(transform); - gradient_adaptor_type gradient_adaptor(x1,y1,x2,y2); - - span_gradient_type span_gradient(span_interpolator, - gradient_adaptor, - m_gradient_lut, - 0, scaleup); - - render_scanlines_aa(ras, sl, ren, m_alloc, span_gradient); - } - } - - template - void render(Rasterizer& ras, - Scanline& sl, - Renderer& ren, - agg::trans_affine const& mtx, - double opacity, - box2d const& symbol_bbox) - - { - using namespace agg; - - trans_affine transform; - curved_stroked_trans_type curved_stroked_trans(curved_stroked_,transform); - curved_trans_type curved_trans(curved_,transform); - curved_trans_contour_type curved_trans_contour(curved_trans); - - curved_trans_contour.auto_detect_orientation(true); - - for(unsigned i = 0; i < attributes_.size(); ++i) - { - mapnik::svg::path_attributes const& attr = attributes_[i]; - if (!attr.visibility_flag) - continue; - - transform = attr.transform; - - double bx1,by1,bx2,by2; - bounding_rect_single(curved_trans, attr.index, &bx1, &by1, &bx2, &by2); - box2d path_bbox(bx1,by1,bx2,by2); - - transform *= mtx; - double scl = transform.scale(); - //curved_.approximation_method(curve_inc); - curved_.approximation_scale(scl); - curved_.angle_tolerance(0.0); - - rgba8 color; - - if (attr.fill_flag || attr.fill_gradient.get_gradient_type() != NO_GRADIENT) - { - ras.reset(); - - // https://github.com/mapnik/mapnik/issues/1129 - if(fabs(curved_trans_contour.width()) <= 1) - { - ras.add_path(curved_trans, attr.index); - } - else - { - curved_trans_contour.miter_limit(attr.miter_limit); - ras.add_path(curved_trans_contour, attr.index); - } - - if(attr.fill_gradient.get_gradient_type() != NO_GRADIENT) - { - render_gradient(ras, sl, ren, attr.fill_gradient, transform, attr.fill_opacity * opacity, symbol_bbox, path_bbox); - } - else - { - ras.filling_rule(attr.even_odd_flag ? fill_even_odd : fill_non_zero); - color = attr.fill_color; - color.opacity(color.opacity() * attr.fill_opacity * opacity); - ScanlineRenderer ren_s(ren); - color.premultiply(); - ren_s.color(color); - render_scanlines(ras, sl, ren_s); - } - } - - if (attr.stroke_flag || attr.stroke_gradient.get_gradient_type() != NO_GRADIENT) - { - curved_stroked_.width(attr.stroke_width); - //m_curved_stroked.line_join((attr.line_join == miter_join) ? miter_join_round : attr.line_join); - curved_stroked_.line_join(attr.line_join); - curved_stroked_.line_cap(attr.line_cap); - curved_stroked_.miter_limit(attr.miter_limit); - curved_stroked_.inner_join(inner_round); - curved_stroked_.approximation_scale(scl); - - // If the *visual* line width is considerable we - // turn on processing of curve cusps. - //--------------------- - if(attr.stroke_width * scl > 1.0) - { - curved_.angle_tolerance(0.2); - } - ras.reset(); - ras.add_path(curved_stroked_trans, attr.index); - - if(attr.stroke_gradient.get_gradient_type() != NO_GRADIENT) - { - render_gradient(ras, sl, ren, attr.stroke_gradient, transform, attr.stroke_opacity * opacity, symbol_bbox, path_bbox); - } - else - { - ras.filling_rule(fill_non_zero); - color = attr.stroke_color; - color.opacity(color.opacity() * attr.stroke_opacity * opacity); - ScanlineRenderer ren_s(ren); - color.premultiply(); - ren_s.color(color); - render_scanlines(ras, sl, ren_s); - } - } - } - } - - template - void render_id(Rasterizer& ras, - Scanline& sl, - Renderer& ren, - int feature_id, - agg::trans_affine const& mtx, - double opacity, - const box2d &symbol_bbox) - - { - using namespace agg; - - trans_affine transform; - curved_stroked_trans_type curved_stroked_trans(curved_stroked_,transform); - curved_trans_type curved_trans(curved_,transform); - curved_trans_contour_type curved_trans_contour(curved_trans); - - curved_trans_contour.auto_detect_orientation(true); - - for(unsigned i = 0; i < attributes_.size(); ++i) - { - mapnik::svg::path_attributes const& attr = attributes_[i]; - if (!attr.visibility_flag) - continue; - - transform = attr.transform; - - double bx1,by1,bx2,by2; - bounding_rect_single(curved_trans, attr.index, &bx1, &by1, &bx2, &by2); - box2d path_bbox(bx1,by1,bx2,by2); - - transform *= mtx; - double scl = transform.scale(); - //curved_.approximation_method(curve_inc); - curved_.approximation_scale(scl); - curved_.angle_tolerance(0.0); - - mapnik::gray32 color(feature_id); - - if (attr.fill_flag || attr.fill_gradient.get_gradient_type() != NO_GRADIENT) - { - ras.reset(); - - if(fabs(curved_trans_contour.width()) <= 1) - { - ras.add_path(curved_trans, attr.index); - } - else - { - curved_trans_contour.miter_limit(attr.miter_limit); - ras.add_path(curved_trans_contour, attr.index); - } - - ras.filling_rule(attr.even_odd_flag ? fill_even_odd : fill_non_zero); - ScanlineRenderer ren_s(ren); - ren_s.color(color); - render_scanlines(ras, sl, ren_s); - } - - if (attr.stroke_flag || attr.stroke_gradient.get_gradient_type() != NO_GRADIENT) - { - curved_stroked_.width(attr.stroke_width); - //m_curved_stroked.line_join((attr.line_join == miter_join) ? miter_join_round : attr.line_join); - curved_stroked_.line_join(attr.line_join); - curved_stroked_.line_cap(attr.line_cap); - curved_stroked_.miter_limit(attr.miter_limit); - curved_stroked_.inner_join(inner_round); - curved_stroked_.approximation_scale(scl); - - // If the *visual* line width is considerable we - // turn on processing of curve cusps. - //--------------------- - if(attr.stroke_width * scl > 1.0) - { - curved_.angle_tolerance(0.2); - } - ras.reset(); - ras.add_path(curved_stroked_trans, attr.index); - - ras.filling_rule(fill_non_zero); - ScanlineRenderer ren_s(ren); - ren_s.color(color); - render_scanlines(ras, sl, ren_s); - } - } - } - -private: - - VertexSource & source_; - curved_type curved_; - curved_stroked_type curved_stroked_; - AttributeSource const& attributes_; -}; - -}} - -#endif //MAPNIK_SVG_RENDERER_HPP diff -Nru mapnik-2.1.0/include/mapnik/svg/svg_renderer_agg.hpp mapnik-2.2.0/include/mapnik/svg/svg_renderer_agg.hpp --- mapnik-2.1.0/include/mapnik/svg/svg_renderer_agg.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/svg_renderer_agg.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,442 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_SVG_RENDERER_AGG_HPP +#define MAPNIK_SVG_RENDERER_AGG_HPP + +// mapnik +#include +#include +#include +#include +#include + +// boost +#include + +// agg +#include "agg_path_storage.h" +#include "agg_conv_transform.h" +#include "agg_conv_stroke.h" +#include "agg_conv_contour.h" +#include "agg_conv_curve.h" +#include "agg_color_rgba.h" +#include "agg_bounding_rect.h" +#include "agg_rendering_buffer.h" +#include "agg_rasterizer_scanline_aa.h" +#include "agg_scanline_u.h" +#include "agg_scanline_p.h" +#include "agg_scanline_bin.h" +#include "agg_renderer_scanline.h" +#include "agg_span_allocator.h" +#include "agg_span_gradient.h" +#include "agg_gradient_lut.h" +#include "agg_gamma_lut.h" +#include "agg_span_interpolator_linear.h" +#include "agg_pixfmt_rgba.h" + +namespace mapnik { +namespace svg { + + +/** + * Arbitrary linear gradient specified by two control points. Gradient + * value is taken as the normalised distance along the line segment + * represented by the two points. + */ +class linear_gradient_from_segment +{ +public: + linear_gradient_from_segment(double x1, double y1, double x2, double y2) : + x1_(x1*agg::gradient_subpixel_scale), + y1_(y1*agg::gradient_subpixel_scale), + x2_(x2*agg::gradient_subpixel_scale), + y2_(y2*agg::gradient_subpixel_scale) + { + double dx = x2_-x1_; + double dy = y2_-y1_; + length_sqr_ = dx*dx+dy*dy; + } + + int calculate(int x, int y, int d) const + { + if (length_sqr_ <= 0) + return 0; + double u = ((x-x1_)*(x2_-x1_) + (y-y1_)*(y2_-y1_))/length_sqr_; + if (u < 0) + u = 0; + else if (u > 1) + u = 1; + return static_cast(u*d); + } +private: + double x1_; + double y1_; + double x2_; + double y2_; + + double length_sqr_; + +}; + +template +class svg_renderer_agg : mapnik::noncopyable +{ +public: + typedef agg::conv_curve curved_type; + typedef agg::conv_stroke curved_stroked_type; + typedef agg::conv_transform curved_stroked_trans_type; + typedef agg::conv_transform curved_trans_type; + typedef agg::conv_contour curved_trans_contour_type; + typedef agg::renderer_base renderer_base; + + svg_renderer_agg(VertexSource & source, AttributeSource const& attributes) + : source_(source), + curved_(source_), + curved_stroked_(curved_), + attributes_(attributes) {} + + template + void render_gradient(Rasterizer& ras, + Scanline& sl, + Renderer& ren, + const gradient &grad, + agg::trans_affine const& mtx, + double opacity, + const box2d &symbol_bbox, + const box2d &path_bbox) + { + typedef agg::gamma_lut gamma_lut_type; + typedef agg::gradient_lut, 1024> color_func_type; + typedef agg::span_interpolator_linear<> interpolator_type; + typedef agg::span_allocator span_allocator_type; + + span_allocator_type m_alloc; + color_func_type m_gradient_lut; + gamma_lut_type m_gamma_lut; + + double x1,x2,y1,y2,radius; + grad.get_control_points(x1,y1,x2,y2,radius); + + m_gradient_lut.remove_all(); + BOOST_FOREACH ( mapnik::stop_pair const& st, grad.get_stop_array() ) + { + mapnik::color const& stop_color = st.second; + unsigned r = stop_color.red(); + unsigned g = stop_color.green(); + unsigned b = stop_color.blue(); + unsigned a = stop_color.alpha(); + m_gradient_lut.add_color(st.first, agg::rgba8_pre(r, g, b, int(a * opacity))); + } + m_gradient_lut.build_lut(); + + agg::trans_affine transform = mtx; + transform.invert(); + agg::trans_affine tr; + tr = grad.get_transform(); + tr.invert(); + transform *= tr; + + if (grad.get_units() != USER_SPACE_ON_USE) + { + double bx1=symbol_bbox.minx(); + double by1=symbol_bbox.miny(); + double bx2=symbol_bbox.maxx(); + double by2=symbol_bbox.maxy(); + + if (grad.get_units() == OBJECT_BOUNDING_BOX) + { + bx1=path_bbox.minx(); + by1=path_bbox.miny(); + bx2=path_bbox.maxx(); + by2=path_bbox.maxy(); + } + + transform.translate(-bx1,-by1); + transform.scale(1.0/(bx2-bx1),1.0/(by2-by1)); + } + + + if (grad.get_gradient_type() == RADIAL) + { + typedef agg::gradient_radial_focus gradient_adaptor_type; + typedef agg::span_gradient span_gradient_type; + + // the agg radial gradient assumes it is centred on 0 + transform.translate(-x2,-y2); + + // scale everything up since agg turns things into integers a bit too soon + int scaleup=255; + radius*=scaleup; + x1*=scaleup; + y1*=scaleup; + x2*=scaleup; + y2*=scaleup; + + transform.scale(scaleup,scaleup); + interpolator_type span_interpolator(transform); + gradient_adaptor_type gradient_adaptor(radius,(x1-x2),(y1-y2)); + + span_gradient_type span_gradient(span_interpolator, + gradient_adaptor, + m_gradient_lut, + 0, radius); + + render_scanlines_aa(ras, sl, ren, m_alloc, span_gradient); + } + else + { + typedef linear_gradient_from_segment gradient_adaptor_type; + typedef agg::span_gradient span_gradient_type; + + // scale everything up since agg turns things into integers a bit too soon + int scaleup=255; + x1*=scaleup; + y1*=scaleup; + x2*=scaleup; + y2*=scaleup; + + transform.scale(scaleup,scaleup); + + interpolator_type span_interpolator(transform); + gradient_adaptor_type gradient_adaptor(x1,y1,x2,y2); + + span_gradient_type span_gradient(span_interpolator, + gradient_adaptor, + m_gradient_lut, + 0, scaleup); + + render_scanlines_aa(ras, sl, ren, m_alloc, span_gradient); + } + } + + template + void render(Rasterizer& ras, + Scanline& sl, + Renderer& ren, + agg::trans_affine const& mtx, + double opacity, + box2d const& symbol_bbox) + + { + using namespace agg; + + trans_affine transform; + curved_stroked_trans_type curved_stroked_trans(curved_stroked_,transform); + curved_trans_type curved_trans(curved_,transform); + curved_trans_contour_type curved_trans_contour(curved_trans); + + curved_trans_contour.auto_detect_orientation(true); + + for(unsigned i = 0; i < attributes_.size(); ++i) + { + mapnik::svg::path_attributes const& attr = attributes_[i]; + if (!attr.visibility_flag) + continue; + + transform = attr.transform; + + double bx1,by1,bx2,by2; + bounding_rect_single(curved_trans, attr.index, &bx1, &by1, &bx2, &by2); + box2d path_bbox(bx1,by1,bx2,by2); + + transform *= mtx; + double scl = transform.scale(); + //curved_.approximation_method(curve_inc); + curved_.approximation_scale(scl); + curved_.angle_tolerance(0.0); + + typename PixelFormat::color_type color; + + if (attr.fill_flag || attr.fill_gradient.get_gradient_type() != NO_GRADIENT) + { + ras.reset(); + + // https://github.com/mapnik/mapnik/issues/1129 + if(std::fabs(curved_trans_contour.width()) <= 1) + { + ras.add_path(curved_trans, attr.index); + } + else + { + curved_trans_contour.miter_limit(attr.miter_limit); + ras.add_path(curved_trans_contour, attr.index); + } + + if(attr.fill_gradient.get_gradient_type() != NO_GRADIENT) + { + render_gradient(ras, sl, ren, attr.fill_gradient, transform, attr.fill_opacity * attr.opacity * opacity, symbol_bbox, path_bbox); + } + else + { + ras.filling_rule(attr.even_odd_flag ? fill_even_odd : fill_non_zero); + color = attr.fill_color; + color.opacity(color.opacity() * attr.fill_opacity * attr.opacity * opacity); + ScanlineRenderer ren_s(ren); + color.premultiply(); + ren_s.color(color); + render_scanlines(ras, sl, ren_s); + } + } + + if (attr.stroke_flag || attr.stroke_gradient.get_gradient_type() != NO_GRADIENT) + { + curved_stroked_.width(attr.stroke_width); + //m_curved_stroked.line_join((attr.line_join == miter_join) ? miter_join_round : attr.line_join); + curved_stroked_.line_join(attr.line_join); + curved_stroked_.line_cap(attr.line_cap); + curved_stroked_.miter_limit(attr.miter_limit); + curved_stroked_.inner_join(inner_round); + curved_stroked_.approximation_scale(scl); + + // If the *visual* line width is considerable we + // turn on processing of curve cusps. + //--------------------- + if(attr.stroke_width * scl > 1.0) + { + curved_.angle_tolerance(0.2); + } + ras.reset(); + ras.add_path(curved_stroked_trans, attr.index); + + if(attr.stroke_gradient.get_gradient_type() != NO_GRADIENT) + { + render_gradient(ras, sl, ren, attr.stroke_gradient, transform, attr.stroke_opacity * attr.opacity * opacity, symbol_bbox, path_bbox); + } + else + { + ras.filling_rule(fill_non_zero); + color = attr.stroke_color; + color.opacity(color.opacity() * attr.stroke_opacity * attr.opacity * opacity); + ScanlineRenderer ren_s(ren); + color.premultiply(); + ren_s.color(color); + render_scanlines(ras, sl, ren_s); + } + } + } + } + + template + void render_id(Rasterizer& ras, + Scanline& sl, + Renderer& ren, + int feature_id, + agg::trans_affine const& mtx, + double opacity, + const box2d &symbol_bbox) + + { + using namespace agg; + + trans_affine transform; + curved_stroked_trans_type curved_stroked_trans(curved_stroked_,transform); + curved_trans_type curved_trans(curved_,transform); + curved_trans_contour_type curved_trans_contour(curved_trans); + + curved_trans_contour.auto_detect_orientation(true); + + for(unsigned i = 0; i < attributes_.size(); ++i) + { + mapnik::svg::path_attributes const& attr = attributes_[i]; + if (!attr.visibility_flag) + continue; + + transform = attr.transform; + + double bx1,by1,bx2,by2; + bounding_rect_single(curved_trans, attr.index, &bx1, &by1, &bx2, &by2); + box2d path_bbox(bx1,by1,bx2,by2); + + transform *= mtx; + double scl = transform.scale(); + //curved_.approximation_method(curve_inc); + curved_.approximation_scale(scl); + curved_.angle_tolerance(0.0); + + typename PixelFormat::color_type color(feature_id); + + if (attr.fill_flag || attr.fill_gradient.get_gradient_type() != NO_GRADIENT) + { + ras.reset(); + + if(std::fabs(curved_trans_contour.width()) <= 1) + { + ras.add_path(curved_trans, attr.index); + } + else + { + curved_trans_contour.miter_limit(attr.miter_limit); + ras.add_path(curved_trans_contour, attr.index); + } + + ras.filling_rule(attr.even_odd_flag ? fill_even_odd : fill_non_zero); + ScanlineRenderer ren_s(ren); + ren_s.color(color); + render_scanlines(ras, sl, ren_s); + } + + if (attr.stroke_flag || attr.stroke_gradient.get_gradient_type() != NO_GRADIENT) + { + curved_stroked_.width(attr.stroke_width); + //m_curved_stroked.line_join((attr.line_join == miter_join) ? miter_join_round : attr.line_join); + curved_stroked_.line_join(attr.line_join); + curved_stroked_.line_cap(attr.line_cap); + curved_stroked_.miter_limit(attr.miter_limit); + curved_stroked_.inner_join(inner_round); + curved_stroked_.approximation_scale(scl); + + // If the *visual* line width is considerable we + // turn on processing of curve cusps. + //--------------------- + if(attr.stroke_width * scl > 1.0) + { + curved_.angle_tolerance(0.2); + } + ras.reset(); + ras.add_path(curved_stroked_trans, attr.index); + + ras.filling_rule(fill_non_zero); + ScanlineRenderer ren_s(ren); + ren_s.color(color); + render_scanlines(ras, sl, ren_s); + } + } + } + +private: + + VertexSource & source_; + curved_type curved_; + curved_stroked_type curved_stroked_; + AttributeSource const& attributes_; +}; + +}} + +#endif //MAPNIK_SVG_RENDERER_AGG_HPP diff -Nru mapnik-2.1.0/include/mapnik/svg/svg_storage.hpp mapnik-2.2.0/include/mapnik/svg/svg_storage.hpp --- mapnik-2.1.0/include/mapnik/svg/svg_storage.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/svg_storage.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,18 +25,18 @@ // mapnik #include - -// boost -#include +#include namespace mapnik { namespace svg { template -class svg_storage : boost::noncopyable +class svg_storage : mapnik::noncopyable { public: - svg_storage() {} + svg_storage() : + svg_width_(0), + svg_height_(0) {} VertexSource & source() // FIXME!! make const { @@ -63,11 +63,29 @@ return bounding_box_; } + double width() const + { + return svg_width_; + } + + double height() const + { + return svg_height_; + } + + void set_dimensions(double w, double h) + { + svg_width_ = w; + svg_height_ = h; + } + private: VertexSource source_; AttributeSource attributes_; box2d bounding_box_; + double svg_width_; + double svg_height_; }; diff -Nru mapnik-2.1.0/include/mapnik/svg/svg_transform_grammar.hpp mapnik-2.2.0/include/mapnik/svg/svg_transform_grammar.hpp --- mapnik-2.1.0/include/mapnik/svg/svg_transform_grammar.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg/svg_transform_grammar.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -34,7 +34,7 @@ #include #include #include -#include +#include namespace mapnik { namespace svg { diff -Nru mapnik-2.1.0/include/mapnik/svg_renderer.hpp mapnik-2.2.0/include/mapnik/svg_renderer.hpp --- mapnik-2.1.0/include/mapnik/svg_renderer.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/svg_renderer.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,147 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef MAPNIK_SVG_RENDERER_HPP -#define MAPNIK_SVG_RENDERER_HPP - -// mapnik -#include -#include -#include -#include - -// stl -#include - -namespace mapnik -{ -// parameterized with the type of output iterator it will use for output. -// output iterators add more flexibility than streams, because iterators -// can target many other output destinations besides streams. -template -class MAPNIK_DECL svg_renderer : public feature_style_processor >, - private boost::noncopyable -{ -public: - svg_renderer(Map const& m, OutputIterator& output_iterator, unsigned offset_x=0, unsigned offset_y=0); - ~svg_renderer(); - - void start_map_processing(Map const& map); - void end_map_processing(Map const& map); - void start_layer_processing(layer const& lay); - void end_layer_processing(layer const& lay); - - /*! - * @brief Overloads that process each kind of symbolizer individually. - */ - void process(point_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); - void process(line_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); - void process(line_pattern_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); - void process(polygon_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); - void process(polygon_pattern_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); - void process(raster_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); - void process(shield_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); - void process(text_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); - void process(building_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); - void process(markers_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); - - /*! - * @brief Overload that process the whole set of symbolizers of a rule. - * @return true, meaning that this renderer can process multiple symbolizers. - */ - bool process(rule::symbolizers const& syms, - Feature const& feature, - proj_transform const& prj_trans); - - void painted(bool painted) - { - // nothing to do - } - - inline OutputIterator& get_output_iterator() - { - return output_iterator_; - } - - inline const OutputIterator& get_output_iterator() const - { - return output_iterator_; - } - -private: - OutputIterator& output_iterator_; - const int width_; - const int height_; - CoordTransform t_; - svg::svg_generator generator_; - svg::path_output_attributes path_attributes_; - bool painted_; - - /*! - * @brief Visitor that makes the calls to process each symbolizer when stored in a boost::variant. - * This object follows the model of that found in feature_style_processor. It appears here, because - * the logic that iterates over the set of symbolizer has been moved to an SVG renderer's internal - * method. - */ - struct symbol_dispatch : public boost::static_visitor<> - { - symbol_dispatch(svg_renderer& processor, - Feature const& feature, - proj_transform const& prj_trans) - : processor_(processor), - feature_(feature), - prj_trans_(prj_trans) {} - - template - void operator()(Symbolizer const& sym) const - { - processor_.process(sym, feature_, prj_trans_); - } - - svg_renderer& processor_; - Feature const& feature_; - proj_transform const& prj_trans_; - }; -}; -} - -#endif // MAPNIK_SVG_RENDERER_HPP diff -Nru mapnik-2.1.0/include/mapnik/symbolizer.hpp mapnik-2.2.0/include/mapnik/symbolizer.hpp --- mapnik-2.1.0/include/mapnik/symbolizer.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/symbolizer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,24 +25,33 @@ // mapnik #include -#include +#include #include -#include +#include // boost -#include #include +// stl +#include +#include + +namespace agg { struct trans_affine; } + namespace mapnik { +// fwd declares +// TODO - move these transform declares to own header +namespace detail { struct transform_node; } +typedef std::vector transform_list; +typedef boost::shared_ptr transform_list_ptr; typedef transform_list_ptr transform_type; +class feature_impl; -MAPNIK_DECL void evaluate_transform(agg::trans_affine& tr, Feature const& feature, +MAPNIK_DECL void evaluate_transform(agg::trans_affine& tr, feature_impl const& feature, transform_type const& trans_expr); -class Map; - class MAPNIK_DECL symbolizer_base { public: @@ -55,12 +64,18 @@ std::string get_transform_string() const; void set_clip(bool clip); bool clip() const; + void set_simplify_algorithm(simplify_algorithm_e algorithm); + simplify_algorithm_e simplify_algorithm() const; + void set_simplify_tolerance(double simplify_tolerance); + double simplify_tolerance() const; void set_smooth(double smooth); double smooth() const; private: composite_mode_e comp_op_; transform_type affine_transform_; bool clip_; + simplify_algorithm_e simplify_algorithm_value_; + double simplify_tolerance_value_; double smooth_value_; }; @@ -72,7 +87,7 @@ void set_filename(path_expression_ptr const& filename); void set_opacity(float opacity); float get_opacity() const; - void set_image_transform(transform_type const& tr); + void set_image_transform(transform_type const& tr); transform_type const& get_image_transform() const; std::string get_image_transform_string() const; protected: diff -Nru mapnik-2.1.0/include/mapnik/symbolizer_hash.hpp mapnik-2.2.0/include/mapnik/symbolizer_hash.hpp --- mapnik-2.1.0/include/mapnik/symbolizer_hash.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/symbolizer_hash.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,66 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_SYMBOLIZER_HASH_HPP +#define MAPNIK_SYMBOLIZER_HASH_HPP + +#include +#include + +#include +#include + +namespace mapnik { + +struct symbolizer_hash +{ + template + static std::size_t value(T const& sym) + { + std::size_t seed = 0; + return seed; + } + // specialisation for polygon_symbolizer + static std::size_t value(polygon_symbolizer const& sym) + { + std::size_t seed = Polygon; + boost::hash_combine(seed, sym.get_fill().rgba()); + boost::hash_combine(seed, sym.get_opacity()); + return seed; + } + + // specialisation for line_symbolizer + static std::size_t value(line_symbolizer const& sym) + { + std::size_t seed = LineString; + boost::hash_combine(seed, sym.get_stroke().get_color().rgba()); + boost::hash_combine(seed, sym.get_stroke().get_width()); + boost::hash_combine(seed, sym.get_stroke().get_opacity()); + boost::hash_combine(seed, static_cast(sym.get_stroke().get_line_cap())); + boost::hash_combine(seed, static_cast(sym.get_stroke().get_line_join())); + return seed; + } +}; + +} + +#endif // MAPNIK_SYMBOLIZER_HASH_HPP diff -Nru mapnik-2.1.0/include/mapnik/symbolizer_helpers.hpp mapnik-2.2.0/include/mapnik/symbolizer_helpers.hpp --- mapnik-2.1.0/include/mapnik/symbolizer_helpers.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/symbolizer_helpers.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,16 +25,25 @@ //mapnik #include #include -#include #include -#include #include #include -#include //boost #include +// agg +#include "agg_trans_affine.h" + +// fwd declares +namespace mapnik { + class CoordTransform; + class marker; + class proj_transform; + class string_info; + class text_path; + template class placement_finder; +} namespace mapnik { @@ -48,7 +57,7 @@ { public: text_symbolizer_helper(text_symbolizer const& sym, - Feature const& feature, + feature_impl const& feature, proj_transform const& prj_trans, unsigned width, unsigned height, @@ -95,7 +104,7 @@ //Input text_symbolizer const& sym_; - Feature const& feature_; + feature_impl const& feature_; proj_transform const& prj_trans_; CoordTransform const& t_; FaceManagerT & font_manager_; @@ -133,7 +142,7 @@ { public: shield_symbolizer_helper(shield_symbolizer const& sym, - Feature const& feature, + feature_impl const& feature, proj_transform const& prj_trans, unsigned width, unsigned height, diff -Nru mapnik-2.1.0/include/mapnik/text_path.hpp mapnik-2.2.0/include/mapnik/text_path.hpp --- mapnik-2.1.0/include/mapnik/text_path.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/text_path.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,12 +26,12 @@ // mapnik #include #include +#include //stl #include // boost -#include #include // uci @@ -40,7 +40,7 @@ namespace mapnik { -class string_info : private boost::noncopyable +class string_info : private mapnik::noncopyable { protected: typedef std::vector characters_t; @@ -99,7 +99,7 @@ return at(i); } - UnicodeString const& get_string() const + UnicodeString const& get_string() const { return text_; } @@ -110,10 +110,10 @@ return (text_.indexOf(break_char) >= 0); } - /** Resets object to initial state. */ - void clear(void) + // Resets object to initial state. + void clear() { - text_ = ""; + text_.remove(); characters_.clear(); } }; @@ -121,8 +121,8 @@ typedef char_info const * char_info_ptr; -/** List of all characters and their positions and formats for a placement. */ -class text_path : boost::noncopyable +// List of all characters and their positions and formats for a placement. +class text_path : mapnik::noncopyable { struct character_node { @@ -140,12 +140,12 @@ ~character_node() {} - void vertex(char_info_ptr *c_, double *x_, double *y_, double *angle_) const + void vertex(char_info_ptr & c_, double & x_, double & y_, double & angle_) const { - *c_ = c; - *x_ = pos.x; - *y_ = pos.y; - *angle_ = angle; + c_ = c; + x_ = pos.x; + y_ = pos.y; + angle_ = angle; } }; @@ -172,7 +172,7 @@ } /** Return node. Always returns a new node. Has no way to report that there are no more nodes. */ - void vertex(char_info_ptr *c, double *x, double *y, double *angle) const + void vertex(char_info_ptr & c, double & x, double & y, double & angle) const { nodes_[itr_++].vertex(c, x, y, angle); } diff -Nru mapnik-2.1.0/include/mapnik/text_placements/base.hpp mapnik-2.2.0/include/mapnik/text_placements/base.hpp --- mapnik-2.1.0/include/mapnik/text_placements/base.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/text_placements/base.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -37,7 +37,7 @@ * This placement has first to be tested by placement_finder to verify it * can actually be used. */ -class text_placement_info : boost::noncopyable +class MAPNIK_DECL text_placement_info : mapnik::noncopyable { public: /** Constructor. Takes the parent text_placements object as a parameter @@ -77,7 +77,7 @@ * semantics. Basically this class just makes sure a pointer of the right * class is returned by the get_placement_info call. */ -class text_placements +class MAPNIK_DECL text_placements { public: text_placements(); diff -Nru mapnik-2.1.0/include/mapnik/text_placements/registry.hpp mapnik-2.2.0/include/mapnik/text_placements/registry.hpp --- mapnik-2.1.0/include/mapnik/text_placements/registry.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/text_placements/registry.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,9 +25,7 @@ // mapnik #include #include - -// boost -#include +#include // stl #include @@ -42,7 +40,7 @@ xml_node const& xml, fontset_map const & fontsets); class registry : public singleton, - private boost::noncopyable + private mapnik::noncopyable { public: registry(); diff -Nru mapnik-2.1.0/include/mapnik/text_properties.hpp mapnik-2.2.0/include/mapnik/text_properties.hpp --- mapnik-2.1.0/include/mapnik/text_properties.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/text_properties.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,6 +24,9 @@ // mapnik #include +#include +#include +#include #include #include #include @@ -33,7 +36,8 @@ #include // boost -#include +#include +#include namespace mapnik { @@ -50,7 +54,7 @@ typedef std::map fontset_map; -struct char_properties +struct MAPNIK_DECL char_properties { char_properties(); /** Construct object from XML. */ @@ -58,8 +62,8 @@ /** Write object to XML ptree. */ void to_xml(boost::property_tree::ptree &node, bool explicit_defaults, char_properties const& dfl=char_properties()) const; std::string face_name; - font_set fontset; - float text_size; + boost::optional fontset; + double text_size; double character_spacing; double line_spacing; //Largest total height (fontsize+line_spacing) per line is chosen double text_opacity; @@ -121,7 +125,7 @@ /** Contains all text symbolizer properties which are not directly related to text formatting. */ -struct text_symbolizer_properties +struct MAPNIK_DECL text_symbolizer_properties { text_symbolizer_properties(); /** Load all values from XML ptree. */ @@ -132,7 +136,7 @@ /** Takes a feature and produces formated text as output. * The output object has to be created by the caller and passed in for thread safety. */ - void process(processed_text &output, Feature const& feature) const; + void process(processed_text &output, feature_impl const& feature) const; /** Automatically create processing instructions for a single expression. */ void set_old_style_expression(expression_ptr expr); /** Sets new format tree. */ @@ -151,7 +155,7 @@ justify_alignment_e jalign; vertical_alignment_e valign; /** distance between repeated labels on a single geometry */ - unsigned label_spacing; + double label_spacing; /** distance the label can be moved on the line to fit, if 0 the default is used */ unsigned label_position_tolerance; bool avoid_edges; @@ -164,8 +168,8 @@ bool allow_overlap; /** Only consider geometry with largest bbox (polygons) */ bool largest_bbox_only; - unsigned text_ratio; - unsigned wrap_width; + double text_ratio; + double wrap_width; /** Default values for char_properties. */ char_properties format; private: diff -Nru mapnik-2.1.0/include/mapnik/text_symbolizer.hpp mapnik-2.2.0/include/mapnik/text_symbolizer.hpp --- mapnik-2.1.0/include/mapnik/text_symbolizer.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/text_symbolizer.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -46,6 +46,15 @@ namespace mapnik { +enum halo_rasterizer_enum +{ + HALO_RASTERIZER_FULL, + HALO_RASTERIZER_FAST, + halo_rasterizer_enum_MAX +}; + +DEFINE_ENUM(halo_rasterizer_e, halo_rasterizer_enum); + struct MAPNIK_DECL text_symbolizer : public symbolizer_base { // Note - we do not use boost::make_shared below as VC2008 and VC2010 are @@ -66,33 +75,33 @@ expression_ptr get_orientation() const func_deprecated; // orienation (rotation angle atm) void set_orientation(expression_ptr expr); - unsigned get_text_ratio() const func_deprecated; // target ratio for text bounding box in pixels - void set_text_ratio(unsigned ratio); - unsigned get_wrap_width() const func_deprecated; // width to wrap text at, or trigger ratio - void set_wrap_width(unsigned ratio); + double get_text_ratio() const func_deprecated; // target ratio for text bounding box in pixels + void set_text_ratio(double ratio); + double get_wrap_width() const func_deprecated; // width to wrap text at, or trigger ratio + void set_wrap_width(double width); unsigned char get_wrap_char() const func_deprecated; // character used to wrap lines std::string get_wrap_char_string() const func_deprecated; // character used to wrap lines as std::string void set_wrap_char(unsigned char character); void set_wrap_char_from_string(std::string const& character); text_transform_e get_text_transform() const func_deprecated; // text conversion on strings before display void set_text_transform(text_transform_e convert); - unsigned get_line_spacing() const func_deprecated; // spacing between lines of text - void set_line_spacing(unsigned spacing); - unsigned get_character_spacing() const func_deprecated; // spacing between characters in text - void set_character_spacing(unsigned spacing); - unsigned get_label_spacing() const func_deprecated; // spacing between repeated labels on lines - void set_label_spacing(unsigned spacing); + double get_line_spacing() const func_deprecated; // spacing between lines of text + void set_line_spacing(double spacing); + double get_character_spacing() const func_deprecated; // spacing between characters in text + void set_character_spacing(double spacing); + double get_label_spacing() const func_deprecated; // spacing between repeated labels on lines + void set_label_spacing(double spacing); unsigned get_label_position_tolerance() const func_deprecated; //distance the label can be moved on the line to fit, if 0 the default is used void set_label_position_tolerance(unsigned tolerance); bool get_force_odd_labels() const func_deprecated; // try render an odd amount of labels void set_force_odd_labels(bool force); double get_max_char_angle_delta() const func_deprecated; // maximum change in angle between adjacent characters void set_max_char_angle_delta(double angle); - float get_text_size() const func_deprecated; - void set_text_size(float size); + double get_text_size() const func_deprecated; + void set_text_size(double size); std::string const& get_face_name() const func_deprecated; void set_face_name(std::string face_name); - font_set const& get_fontset() const func_deprecated; + boost::optional const& get_fontset() const func_deprecated; void set_fontset(font_set const& fset); color const& get_fill() const func_deprecated; void set_fill(color const& fill); @@ -100,6 +109,8 @@ color const& get_halo_fill() const func_deprecated; void set_halo_radius(double radius); double get_halo_radius() const func_deprecated; + void set_halo_rasterizer(halo_rasterizer_e rasterizer_p); + halo_rasterizer_e get_halo_rasterizer() const; void set_label_placement(label_placement_e label_p); label_placement_e get_label_placement() const func_deprecated; void set_vertical_alignment(vertical_alignment_e valign); @@ -131,6 +142,7 @@ bool largest_bbox_only() const; private: text_placements_ptr placement_options_; + halo_rasterizer_e halo_rasterizer_; }; } diff -Nru mapnik-2.1.0/include/mapnik/tiff_io.hpp mapnik-2.2.0/include/mapnik/tiff_io.hpp --- mapnik-2.1.0/include/mapnik/tiff_io.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/tiff_io.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,8 +24,7 @@ #define MAPNIK_TIFF_IO_HPP #include - -#include +#include extern "C" { @@ -45,37 +44,89 @@ static tsize_t tiff_write_proc(thandle_t fd, tdata_t buf, tsize_t size) { - std::ostream* out = (std::ostream*)fd; + std::ostream* out = reinterpret_cast(fd); + std::ios::pos_type pos = out->tellp(); + std::streamsize request_size = size; + if (static_cast(request_size) != size) + return static_cast(-1); + out->write(reinterpret_cast(buf), size); - out->write((const char*)buf, size); - - return size; + if( static_cast(pos) == -1 ) + { + return size; + } + else + { + return static_cast(out->tellp()-pos); + } } static toff_t tiff_seek_proc(thandle_t fd, toff_t off, int whence) { - if (off == 0xFFFFFFFF) - { - return 0xFFFFFFFF; - } + std::ostream* out = reinterpret_cast(fd); - std::ostream* out = (std::ostream*)fd; + if( out->fail() ) + return static_cast(-1); + + if( static_cast(out->tellp()) == -1) + return static_cast< toff_t >( 0 ); switch(whence) { + case SEEK_SET: + out->seekp(off, std::ios_base::beg); + break; case SEEK_CUR: out->seekp(off, std::ios_base::cur); break; case SEEK_END: out->seekp(off, std::ios_base::end); break; - case SEEK_SET: - default: - out->seekp(off, std::ios_base::beg); - break; } + // grow std::stringstream buffer (re: libtiff/tif_stream.cxx) + std::ios::pos_type pos = out->tellp(); + // second check needed for clang (libcxx doesn't set failbit when seeking beyond the current buffer size + if( out->fail() || off != pos) + { + std::ios::iostate old_state; + std::ios::pos_type origin; + old_state = out->rdstate(); + // reset the fail bit or else tellp() won't work below + out->clear(out->rdstate() & ~std::ios::failbit); + switch( whence ) + { + case SEEK_SET: + default: + origin = 0L; + break; + case SEEK_CUR: + origin = out->tellp(); + break; + case SEEK_END: + out->seekp(0, std::ios::end); + origin = out->tellp(); + break; + } + // restore original stream state + out->clear(old_state); - return (toff_t)out->tellp(); + // only do something if desired seek position is valid + if( (static_cast(origin) + off) > 0L) + { + uint64_t num_fill; + // clear the fail bit + out->clear(out->rdstate() & ~std::ios::failbit); + // extend the stream to the expected size + out->seekp(0, std::ios::end); + num_fill = (static_cast(origin)) + off - out->tellp(); + for( uint64_t i = 0; i < num_fill; ++i) + out->put('\0'); + + // retry the seek + out->seekp(static_cast(static_cast(origin) + off), std::ios::beg); + } + } + return static_cast(out->tellp()); } static int tiff_close_proc(thandle_t fd) @@ -87,8 +138,12 @@ static toff_t tiff_size_proc(thandle_t fd) { - std::ostream* out = (std::ostream*)fd; - return (toff_t)out->tellp(); + std::ostream* out = reinterpret_cast(fd); + std::ios::pos_type pos = out->tellp(); + out->seekp(0, std::ios::end); + std::ios::pos_type len = out->tellp(); + out->seekp(pos); + return (toff_t)len; } static tsize_t tiff_dummy_read_proc(thandle_t fd, tdata_t buf, tsize_t size) @@ -113,7 +168,7 @@ const int scanline_size = sizeof(unsigned char) * width * 3; TIFF* output = RealTIFFOpen("mapnik_tiff_stream", - "w", + "wm", (thandle_t)&file, tiff_dummy_read_proc, tiff_write_proc, @@ -124,7 +179,7 @@ tiff_dummy_unmap_proc); if (! output) { - // throw ? + throw ImageWriterException("Could not write TIFF"); } TIFFSetField(output, TIFFTAG_IMAGEWIDTH, width); diff -Nru mapnik-2.1.0/include/mapnik/transform_expression.hpp mapnik-2.2.0/include/mapnik/transform_expression.hpp --- mapnik-2.1.0/include/mapnik/transform_expression.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/transform_expression.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -29,7 +29,7 @@ // boost #include #include -#include +#include // fusion #include @@ -71,7 +71,7 @@ translate_node(expr_node const& tx, boost::optional const& ty) : tx_(tx) - , ty_(ty ? *ty : value_null()) {} + , ty_(ty ? expr_node(*ty) : value_null()) {} }; struct scale_node @@ -82,7 +82,7 @@ scale_node(expr_node const& sx, boost::optional const& sy) : sx_(sx) - , sy_(sy ? *sy : value_null()) {} + , sy_(sy ? expr_node(*sy) : value_null()) {} }; struct rotate_node @@ -104,8 +104,8 @@ boost::optional const& cx, boost::optional const& cy) : angle_(angle) - , cx_(cx ? *cx : value_null()) - , cy_(cy ? *cy : value_null()) {} + , cx_(cx ? expr_node(*cx) : value_null()) + , cy_(cy ? expr_node(*cy) : value_null()) {} rotate_node(expr_node const& angle, boost::optional const& center) diff -Nru mapnik-2.1.0/include/mapnik/transform_expression_grammar.hpp mapnik-2.2.0/include/mapnik/transform_expression_grammar.hpp --- mapnik-2.1.0/include/mapnik/transform_expression_grammar.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/transform_expression_grammar.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -28,7 +28,7 @@ #include // spirit -#include +#include namespace mapnik { diff -Nru mapnik-2.1.0/include/mapnik/transform_processor.hpp mapnik-2.2.0/include/mapnik/transform_processor.hpp --- mapnik-2.1.0/include/mapnik/transform_processor.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/transform_processor.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,20 +25,25 @@ // mapnik #include +#ifdef MAPNIK_LOG #include -#include +#endif #include #include #include // boost #include +#include +#include // agg #include namespace mapnik { +class feature_impl; + template struct expression_attributes; template @@ -225,7 +230,7 @@ } }; -typedef mapnik::transform_processor transform_processor_type; +typedef mapnik::transform_processor transform_processor_type; } // namespace mapnik diff -Nru mapnik-2.1.0/include/mapnik/unicode.hpp mapnik-2.2.0/include/mapnik/unicode.hpp --- mapnik-2.1.0/include/mapnik/unicode.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/unicode.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,13 +25,13 @@ //mapnik #include +#include // icu #include #include // boost -#include #include // stl @@ -39,7 +39,7 @@ namespace mapnik { -class MAPNIK_DECL transcoder : private boost::noncopyable +class MAPNIK_DECL transcoder : private mapnik::noncopyable { public: explicit transcoder (std::string const& encoding); @@ -51,4 +51,10 @@ }; } +namespace U_ICU_NAMESPACE { +inline std::size_t hash_value(const UnicodeString& val) { + return val.hashCode(); +} +} + #endif // MAPNIK_UNICODE_HPP diff -Nru mapnik-2.1.0/include/mapnik/util/container_adapter.hpp mapnik-2.2.0/include/mapnik/util/container_adapter.hpp --- mapnik-2.1.0/include/mapnik/util/container_adapter.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/util/container_adapter.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,13 +24,11 @@ #define CONTAINER_ADAPTER_HPP // mapnik -#include #include -#include +#include // boost -#include -#include +#include namespace boost { namespace spirit { namespace traits { @@ -40,26 +38,26 @@ template <> struct container_iterator { - typedef mapnik::util::vertex_iterator type; + typedef mapnik::util::path_iterator type; }; template <> struct begin_container { - static mapnik::util::vertex_iterator + static mapnik::util::path_iterator call (mapnik::geometry_type const& g) { - return mapnik::util::vertex_iterator(g.data()); + return mapnik::util::path_iterator(g); } }; template <> struct end_container { - static mapnik::util::vertex_iterator + static mapnik::util::path_iterator call (mapnik::geometry_type const& g) { - return mapnik::util::vertex_iterator(); + return mapnik::util::path_iterator(); } }; diff -Nru mapnik-2.1.0/include/mapnik/util/conversions.hpp mapnik-2.2.0/include/mapnik/util/conversions.hpp --- mapnik-2.1.0/include/mapnik/util/conversions.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/util/conversions.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,80 +25,43 @@ // mapnik #include +#include // stl #include -// boost -#include -#include - -// boost -#include - -#if BOOST_VERSION >= 104500 -#include -#include -#else -#include -#endif namespace mapnik { namespace util { -MAPNIK_DECL bool string2int(const char * value, int & result); +/* +Note: this file intentionally provides non-templated methods +to avoid the compile time overhead given it is included +by many other headers inside mapnik. +*/ + +MAPNIK_DECL bool string2bool(std::string const& value, bool & result); +MAPNIK_DECL bool string2bool(const char * iter, const char * end, bool & result); + MAPNIK_DECL bool string2int(std::string const& value, int & result); +MAPNIK_DECL bool string2int(const char * iter, const char * end, int & result); + +#ifdef BIGINT +MAPNIK_DECL bool string2int(std::string const& value, mapnik::value_integer & result); +MAPNIK_DECL bool string2int(const char * iter, const char * end, mapnik::value_integer & result); +#endif MAPNIK_DECL bool string2double(std::string const& value, double & result); -MAPNIK_DECL bool string2double(const char * value, double & result); +MAPNIK_DECL bool string2double(const char * iter, const char * end, double & result); MAPNIK_DECL bool string2float(std::string const& value, float & result); -MAPNIK_DECL bool string2float(const char * value, float & result); - -#if BOOST_VERSION >= 104500 -// generic -template -bool to_string(std::string & str, T value) -{ - namespace karma = boost::spirit::karma; - std::back_insert_iterator sink(str); - return karma::generate(sink, value); -} - -template -struct double_policy : boost::spirit::karma::real_policies -{ - typedef boost::spirit::karma::real_policies base_type; - static int floatfield(T n) { return base_type::fmtflags::fixed; } - static unsigned precision(T n) { return 16 ;} -}; - - -// specialisation for double -template <> -inline bool to_string(std::string & str, double value) -{ - namespace karma = boost::spirit::karma; - typedef boost::spirit::karma::real_generator > double_type; - std::back_insert_iterator sink(str); - return karma::generate(sink, double_type(), value); -} - -#else - -template -bool to_string(std::string & str, T value) -{ - try - { - str = boost::lexical_cast(value); - return true; - } - catch (std::exception const& ex) - { - return false; - } -} +MAPNIK_DECL bool string2float(const char * iter, const char * end, float & result); +MAPNIK_DECL bool to_string(std::string & str, int value); +#ifdef BIGINT +MAPNIK_DECL bool to_string(std::string & str, mapnik::value_integer value); #endif +MAPNIK_DECL bool to_string(std::string & str, unsigned value); +MAPNIK_DECL bool to_string(std::string & str, bool value); +MAPNIK_DECL bool to_string(std::string & str, double value); }} diff -Nru mapnik-2.1.0/include/mapnik/util/fs.hpp mapnik-2.2.0/include/mapnik/util/fs.hpp --- mapnik-2.1.0/include/mapnik/util/fs.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/util/fs.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,46 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_FS_HPP +#define MAPNIK_FS_HPP + +// mapnik +#include + +// stl +#include + +namespace mapnik { namespace util { + +MAPNIK_DECL bool exists(std::string const& value); +MAPNIK_DECL bool is_directory(std::string const& value); +MAPNIK_DECL bool remove(std::string const& value); +MAPNIK_DECL bool is_relative(std::string const& value); +MAPNIK_DECL std::string make_relative(std::string const& filepath, std::string const& base); +MAPNIK_DECL std::string make_absolute(std::string const& filepath, std::string const& base); +MAPNIK_DECL std::string dirname(std::string const& value); + +}} + + + +#endif \ No newline at end of file diff -Nru mapnik-2.1.0/include/mapnik/util/geometry_svg_generator.hpp mapnik-2.2.0/include/mapnik/util/geometry_svg_generator.hpp --- mapnik-2.1.0/include/mapnik/util/geometry_svg_generator.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/util/geometry_svg_generator.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,8 +25,9 @@ // mapnik #include -#include -#include +#include // for container stuff +#include // for container stuff +#include #include // boost @@ -36,37 +37,86 @@ #include #include #include -#include +#include #include +#include //#define BOOST_SPIRIT_USE_PHOENIX_V3 1 +/*! + * adapted to conform to the concepts + * required by Karma to be recognized as a container of + * attributes for output generation. + */ +namespace boost { namespace spirit { namespace traits { + +// TODO - this needs to be made generic to any path type +typedef mapnik::coord_transform path_type; + +template <> +struct is_container : mpl::true_ {} ; + +template <> +struct container_iterator +{ + typedef mapnik::util::path_iterator type; +}; + +template <> +struct begin_container +{ + static mapnik::util::path_iterator + call (path_type const& g) + { + return mapnik::util::path_iterator(g); + } +}; + +template <> +struct end_container +{ + static mapnik::util::path_iterator + call (path_type const& g) + { + return mapnik::util::path_iterator(); + } +}; + +}}} + + namespace mapnik { namespace util { namespace karma = boost::spirit::karma; namespace phoenix = boost::phoenix; namespace svg_detail { + + template struct get_type { template struct result { typedef int type; }; - int operator() (geometry_type const& geom) const + int operator() (Geometry const& geom) const { - return (int)geom.type(); + return static_cast(geom.type()); } }; + template struct get_first { - template - struct result { typedef geometry_type::value_type const type; }; + typedef T geometry_type; + + template + struct result { typedef typename geometry_type::value_type const type; }; - geometry_type::value_type const operator() (geometry_type const& geom) const + typename geometry_type::value_type const operator() (geometry_type const& geom) const { - geometry_type::value_type coord; - boost::get<0>(coord) = geom.vertex(0,&boost::get<1>(coord),&boost::get<2>(coord)); + typename geometry_type::value_type coord; + geom.rewind(0); + boost::get<0>(coord) = geom.vertex(&boost::get<1>(coord),&boost::get<2>(coord)); return coord; } }; @@ -80,11 +130,14 @@ }; } - template + template struct svg_generator : - karma::grammar + karma::grammar { + typedef Geometry geometry_type; + typedef typename boost::remove_pointer::type coord_type; + svg_generator() : svg_generator::base_type(svg) { @@ -102,22 +155,22 @@ ; svg_point = &uint_ - << lit("cx=\"") << coord_type - << lit("\" cy=\"") << coord_type + << lit("cx=\"") << coordinate + << lit("\" cy=\"") << coordinate << lit('\"') ; linestring = &uint_(mapnik::LineString)[_1 = _type(_val)] - << svg_path + << svg_path << lit('\"') ; polygon = &uint_(mapnik::Polygon)[_1 = _type(_val)] - << svg_path + << svg_path << lit('\"') ; - svg_path %= ((&uint_(mapnik::SEG_MOVETO) << lit('M') + svg_path %= ((&uint_(mapnik::SEG_MOVETO) << lit("d=\"") << lit('M') | &uint_(mapnik::SEG_LINETO) [_a +=1] << karma::string [if_(_a == 1) [_1 = "L" ] ]) - << lit(' ') << coord_type << lit(' ') << coord_type) % lit(' ') + << lit(' ') << coordinate << lit(' ') << coordinate) % lit(' ') ; @@ -129,14 +182,14 @@ karma::rule linestring; karma::rule polygon; - karma::rule svg_point; + karma::rule svg_point; karma::rule, geometry_type const& ()> svg_path; // phoenix functions - phoenix::function _type; - phoenix::function _first; + phoenix::function > _type; + phoenix::function > _first; // - karma::real_generator > coord_type; + karma::real_generator > coordinate; }; diff -Nru mapnik-2.1.0/include/mapnik/util/geometry_to_ds_type.hpp mapnik-2.2.0/include/mapnik/util/geometry_to_ds_type.hpp --- mapnik-2.1.0/include/mapnik/util/geometry_to_ds_type.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/util/geometry_to_ds_type.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -33,7 +33,7 @@ namespace mapnik { namespace util { - void to_ds_type(mapnik::geometry_container const& paths, + static inline void to_ds_type(mapnik::geometry_container const& paths, boost::optional & result) { if (paths.size() == 1) diff -Nru mapnik-2.1.0/include/mapnik/util/geometry_to_svg.hpp mapnik-2.2.0/include/mapnik/util/geometry_to_svg.hpp --- mapnik-2.1.0/include/mapnik/util/geometry_to_svg.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/util/geometry_to_svg.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,7 +26,6 @@ // mapnik #include #include -#include #include // boost @@ -40,7 +39,7 @@ { typedef std::back_insert_iterator sink_type; sink_type sink(svg); - svg_generator generator; + svg_generator generator; bool result = karma::generate(sink, generator, geom); return result; } diff -Nru mapnik-2.1.0/include/mapnik/util/geometry_to_wkb.hpp mapnik-2.2.0/include/mapnik/util/geometry_to_wkb.hpp --- mapnik-2.1.0/include/mapnik/util/geometry_to_wkb.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/util/geometry_to_wkb.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -39,241 +39,246 @@ namespace mapnik { namespace util { - std::string to_hex(const char* blob, unsigned size) - { - std::string buf; - buf.reserve(size*2); - std::ostringstream s(buf); - s.seekp(0); - char hex[3]; - std::memset(hex,0,3); - for ( unsigned pos=0; pos < size; ++pos) - { - std::sprintf (hex, "%02x", int(blob[pos]) & 0xff); - s << hex; - } - return s.str(); - } - - enum wkbByteOrder { - wkbXDR=0, - wkbNDR=1 - }; - - - inline void reverse_bytes(char size, char *address) - { - char * first = address; - char * last = first + size - 1; - for(;first < last;++first, --last) - { - char x = *last; - *last = *first; - *first = x; - } - } - - template - inline void write (S & stream, T val, std::size_t size, wkbByteOrder byte_order) - { +std::string to_hex(const char* blob, unsigned size) +{ + std::string buf; + buf.reserve(size*2); + std::ostringstream s(buf); + s.seekp(0); + char hex[3]; + std::memset(hex,0,3); + for ( unsigned pos=0; pos < size; ++pos) + { + std::sprintf (hex, "%02x", int(blob[pos]) & 0xff); + s << hex; + } + return s.str(); +} + +enum wkbByteOrder { + wkbXDR=0, + wkbNDR=1 +}; + + +inline void reverse_bytes(char size, char *address) +{ + char * first = address; + char * last = first + size - 1; + for(;first < last;++first, --last) + { + char x = *last; + *last = *first; + *first = x; + } +} + +template +inline void write (S & stream, T val, std::size_t size, wkbByteOrder byte_order) +{ #ifdef MAPNIK_BIG_ENDIAN - bool need_swap = byte_order ? wkbNDR : wkbXDR; + bool need_swap = byte_order ? wkbNDR : wkbXDR; #else - bool need_swap = byte_order ? wkbXDR : wkbNDR; + bool need_swap = byte_order ? wkbXDR : wkbNDR; #endif - char* buf = reinterpret_cast(&val); - if (need_swap) - { - reverse_bytes(size,buf); - } - stream.write(buf,size); + char* buf = reinterpret_cast(&val); + if (need_swap) + { + reverse_bytes(size,buf); } + stream.write(buf,size); +} - struct wkb_buffer +struct wkb_buffer +{ + wkb_buffer(std::size_t size) + : size_(size), + data_( (size_!=0) ? static_cast(::operator new (size_)):0) + {} + + ~wkb_buffer() + { + ::operator delete(data_); + } + + inline std::size_t size() const + { + return size_; + } + + inline char* buffer() + { + return data_; + } + + std::size_t size_; + char * data_; +}; + +typedef boost::shared_ptr wkb_buffer_ptr; + +template +wkb_buffer_ptr to_point_wkb( GeometryType const& g, wkbByteOrder byte_order) +{ + assert(g.size() == 1); + std::size_t size = 1 + 4 + 8*2 ; // byteOrder + wkbType + Point + wkb_buffer_ptr wkb = boost::make_shared(size); + boost::interprocess::bufferstream ss(wkb->buffer(), wkb->size(), std::ios::out | std::ios::binary); + ss.write(reinterpret_cast(&byte_order),1); + int type = static_cast(mapnik::Point); + write(ss,type,4,byte_order); + double x = 0; + double y = 0; + g.vertex(0,&x,&y); + write(ss,x,8,byte_order); + write(ss,y,8,byte_order); + assert(ss.good()); + return wkb; +} + +template +wkb_buffer_ptr to_line_string_wkb( GeometryType const& g, wkbByteOrder byte_order) +{ + unsigned num_points = g.size(); + assert(num_points > 1); + std::size_t size = 1 + 4 + 4 + 8*2*num_points ; // byteOrder + wkbType + numPoints + Point*numPoints + wkb_buffer_ptr wkb = boost::make_shared(size); + boost::interprocess::bufferstream ss(wkb->buffer(), wkb->size(), std::ios::out | std::ios::binary); + ss.write(reinterpret_cast(&byte_order),1); + int type = static_cast(mapnik::LineString); + write(ss,type,4,byte_order); + write(ss,num_points,4,byte_order); + double x = 0; + double y = 0; + for (unsigned i=0; i< num_points; ++i) { - wkb_buffer(std::size_t size) - : size_(size), - data_( (size_!=0) ? static_cast(::operator new (size_)):0) - {} - - ~wkb_buffer() - { - ::operator delete(data_); - } - - inline std::size_t size() const - { - return size_; - } - - inline char* buffer() - { - return data_; - } - - std::size_t size_; - char * data_; - }; - - typedef boost::shared_ptr wkb_buffer_ptr; - - wkb_buffer_ptr to_point_wkb( geometry_type const& g, wkbByteOrder byte_order) - { - assert(g.size() == 1); - std::size_t size = 1 + 4 + 8*2 ; // byteOrder + wkbType + Point - wkb_buffer_ptr wkb = boost::make_shared(size); - boost::interprocess::bufferstream ss(wkb->buffer(), wkb->size(), std::ios::out | std::ios::binary); - ss.write(reinterpret_cast(&byte_order),1); - int type = static_cast(mapnik::Point); - write(ss,type,4,byte_order); - double x(0); - double y(0); - g.vertex(0,&x,&y); + g.vertex(i,&x,&y); write(ss,x,8,byte_order); write(ss,y,8,byte_order); - assert(ss.good()); - return wkb; } - - wkb_buffer_ptr to_line_string_wkb( geometry_type const& g, wkbByteOrder byte_order) + assert(ss.good()); + return wkb; +} + +template +wkb_buffer_ptr to_polygon_wkb( GeometryType const& g, wkbByteOrder byte_order) +{ + unsigned num_points = g.size(); + assert(num_points > 1); + + typedef std::pair point_type; + typedef std::vector linear_ring; + boost::ptr_vector rings; + + double x = 0; + double y = 0; + std::size_t size = 1 + 4 + 4 ; // byteOrder + wkbType + numRings + for (unsigned i=0; i< num_points; ++i) { - unsigned num_points = g.size(); - assert(num_points > 1); - std::size_t size = 1 + 4 + 4 + 8*2*num_points ; // byteOrder + wkbType + numPoints + Point*numPoints - wkb_buffer_ptr wkb = boost::make_shared(size); - boost::interprocess::bufferstream ss(wkb->buffer(), wkb->size(), std::ios::out | std::ios::binary); - ss.write(reinterpret_cast(&byte_order),1); - int type = static_cast(mapnik::LineString); - write(ss,type,4,byte_order); - write(ss,num_points,4,byte_order); - double x(0); - double y(0); - for (unsigned i=0; i< num_points; ++i) + unsigned command = g.vertex(i,&x,&y); + if (command == SEG_MOVETO) { - g.vertex(i,&x,&y); - write(ss,x,8,byte_order); - write(ss,y,8,byte_order); - } - assert(ss.good()); - return wkb; - } - - wkb_buffer_ptr to_polygon_wkb( geometry_type const& g, wkbByteOrder byte_order) - { - unsigned num_points = g.size(); - assert(num_points > 1); - - typedef std::pair point_type; - typedef std::vector linear_ring; - boost::ptr_vector rings; - - double x(0); - double y(0); - std::size_t size = 1 + 4 + 4 ; // byteOrder + wkbType + numRings - for (unsigned i=0; i< num_points; ++i) - { - unsigned command = g.vertex(i,&x,&y); - if (command == SEG_MOVETO) - { - rings.push_back(new linear_ring); // start new loop - size += 4; // num_points - } + rings.push_back(new linear_ring); // start new loop rings.back().push_back(std::make_pair(x,y)); + size += 4; // num_points size += 2 * 8; // point } - unsigned num_rings = rings.size(); - wkb_buffer_ptr wkb = boost::make_shared(size); - boost::interprocess::bufferstream ss(wkb->buffer(), wkb->size(), std::ios::out | std::ios::binary); - - ss.write(reinterpret_cast(&byte_order),1); - int type = static_cast(mapnik::Polygon); - write(ss,type,4,byte_order); - write(ss,num_rings,4,byte_order); - - BOOST_FOREACH ( linear_ring const& ring, rings) + else if (command == SEG_LINETO) { - unsigned num_points = ring.size(); - write(ss,num_points,4,byte_order); - BOOST_FOREACH ( point_type const& pt, ring) - { - double x = pt.first; - double y = pt.second; - write(ss,x,8,byte_order); - write(ss,y,8,byte_order); - } + rings.back().push_back(std::make_pair(x,y)); + size += 2 * 8; // point } - - assert(ss.good()); - return wkb; } - - wkb_buffer_ptr to_wkb(geometry_type const& g, wkbByteOrder byte_order ) - { - wkb_buffer_ptr wkb; - - switch (g.type()) - { - case mapnik::Point: - wkb = to_point_wkb(g, byte_order); - break; - case mapnik::LineString: - wkb = to_line_string_wkb(g, byte_order); - break; - case mapnik::Polygon: - wkb = to_polygon_wkb(g, byte_order); - break; - default: - break; + unsigned num_rings = rings.size(); + wkb_buffer_ptr wkb = boost::make_shared(size); + boost::interprocess::bufferstream ss(wkb->buffer(), wkb->size(), std::ios::out | std::ios::binary); + + ss.write(reinterpret_cast(&byte_order),1); + int type = static_cast(mapnik::Polygon); + write(ss,type,4,byte_order); + write(ss,num_rings,4,byte_order); + + BOOST_FOREACH ( linear_ring const& ring, rings) + { + unsigned num_ring_points = ring.size(); + write(ss,num_ring_points,4,byte_order); + BOOST_FOREACH ( point_type const& pt, ring) + { + write(ss,pt.first,8,byte_order); + write(ss,pt.second,8,byte_order); + } + } + + assert(ss.good()); + return wkb; +} + +template +wkb_buffer_ptr to_wkb(GeometryType const& g, wkbByteOrder byte_order ) +{ + wkb_buffer_ptr wkb; + + switch (g.type()) + { + case mapnik::Point: + wkb = to_point_wkb(g, byte_order); + break; + case mapnik::LineString: + wkb = to_line_string_wkb(g, byte_order); + break; + case mapnik::Polygon: + wkb = to_polygon_wkb(g, byte_order); + break; + default: + break; + } + return wkb; +} + +wkb_buffer_ptr to_wkb(geometry_container const& paths, wkbByteOrder byte_order ) +{ + if (paths.size() == 1) + { + // single geometry + return to_wkb(paths.front(), byte_order); + } + + if (paths.size() > 1) + { + // multi geometry or geometry collection + std::vector wkb_cont; + bool collection = false; + int multi_type = 0; + size_t multi_size = 1 + 4 + 4; + geometry_container::const_iterator itr = paths.begin(); + geometry_container::const_iterator end = paths.end(); + for ( ; itr!=end; ++itr) + { + wkb_buffer_ptr wkb = to_wkb(*itr,byte_order); + multi_size += wkb->size(); + int type = static_cast(itr->type()); + if (multi_type > 0 && multi_type != itr->type()) + collection = true; + multi_type = type; + wkb_cont.push_back(wkb); } - return wkb; - } - wkb_buffer_ptr to_wkb(geometry_container const& paths, wkbByteOrder byte_order ) - { - if (paths.size() == 1) - { - // single geometry - return to_wkb(paths.front(), byte_order); - } + wkb_buffer_ptr multi_wkb = boost::make_shared(multi_size); + boost::interprocess::bufferstream ss(multi_wkb->buffer(), multi_wkb->size(), std::ios::out | std::ios::binary); + ss.write(reinterpret_cast(&byte_order),1); + multi_type = collection ? 7 : multi_type + 3; + write(ss,multi_type, 4, byte_order); + write(ss,paths.size(),4,byte_order); - if (paths.size() > 1) + BOOST_FOREACH ( wkb_buffer_ptr const& wkb, wkb_cont) { - // multi geometry or geometry collection - std::vector wkb_cont; - bool collection = false; - int multi_type = 0; - size_t multi_size = 1 + 4 + 4; - geometry_container::const_iterator itr = paths.begin(); - geometry_container::const_iterator end = paths.end(); - for ( ; itr!=end; ++itr) - { - wkb_buffer_ptr wkb = to_wkb(*itr,byte_order); - multi_size += wkb->size(); - int type = static_cast(itr->type()); - if (multi_type > 0 && multi_type != itr->type()) - collection = true; - multi_type = type; - wkb_cont.push_back(wkb); - } - - wkb_buffer_ptr multi_wkb = boost::make_shared(multi_size); - boost::interprocess::bufferstream ss(multi_wkb->buffer(), multi_wkb->size(), std::ios::out | std::ios::binary); - ss.write(reinterpret_cast(&byte_order),1); - multi_type = collection ? 7 : multi_type + 3; - write(ss,multi_type, 4, byte_order); - write(ss,paths.size(),4,byte_order); - - BOOST_FOREACH ( wkb_buffer_ptr const& wkb, wkb_cont) - { - ss.write(wkb->buffer(),wkb->size()); - } - return multi_wkb; + ss.write(wkb->buffer(),wkb->size()); } - - return wkb_buffer_ptr(); + return multi_wkb; } - }} - + return wkb_buffer_ptr(); +} +}} #endif // MAPNIK_GEOMETRY_TO_WKB_HPP diff -Nru mapnik-2.1.0/include/mapnik/util/geometry_to_wkt.hpp mapnik-2.2.0/include/mapnik/util/geometry_to_wkt.hpp --- mapnik-2.1.0/include/mapnik/util/geometry_to_wkt.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/util/geometry_to_wkt.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,35 +24,14 @@ #define MAPNIK_GEOMETRY_TO_WKT_HPP // mapnik -#include +#include #include -#include -#include - -// boost -#include namespace mapnik { namespace util { -namespace karma = boost::spirit::karma; +MAPNIK_DECL bool to_wkt(std::string & wkt, mapnik::geometry_type const& geom); -bool to_wkt(std::string & wkt, mapnik::geometry_type const& geom) -{ - typedef std::back_insert_iterator sink_type; - sink_type sink(wkt); - wkt_generator generator(true); - bool result = karma::generate(sink, generator, geom); - return result; -} - -bool to_wkt(std::string & wkt, mapnik::geometry_container const& geom) -{ - typedef std::back_insert_iterator sink_type; - sink_type sink(wkt); - wkt_multi_generator generator; - bool result = karma::generate(sink, generator, geom); - return result; -} +MAPNIK_DECL bool to_wkt(std::string & wkt, mapnik::geometry_container const& geom); }} diff -Nru mapnik-2.1.0/include/mapnik/util/geometry_wkt_generator.hpp mapnik-2.2.0/include/mapnik/util/geometry_wkt_generator.hpp --- mapnik-2.1.0/include/mapnik/util/geometry_wkt_generator.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/util/geometry_wkt_generator.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,6 +26,7 @@ // mapnik #include #include +#include // for CommandType::SEG_MOVETO // boost #include @@ -34,10 +35,11 @@ #include #include #include -#include +#include #include +#include - +#include // trunc to avoid needing C++11 //#define BOOST_SPIRIT_USE_PHOENIX_V3 1 namespace boost { namespace spirit { namespace traits { @@ -50,7 +52,6 @@ }}} - namespace mapnik { namespace util { namespace karma = boost::spirit::karma; @@ -58,45 +59,82 @@ namespace detail { +template struct get_type { template struct result { typedef int type; }; - int operator() (geometry_type const& geom) const + int operator() (Geometry const& geom) const { return static_cast(geom.type()); } }; +template struct get_first { - template - struct result { typedef geometry_type::value_type const type; }; + typedef T geometry_type; + + template + struct result { typedef typename geometry_type::value_type const type; }; - geometry_type::value_type const operator() (geometry_type const& geom) const + typename geometry_type::value_type const operator() (geometry_type const& geom) const { - geometry_type::value_type coord; - boost::get<0>(coord) = geom.vertex(0,&boost::get<1>(coord),&boost::get<2>(coord)); + typename geometry_type::value_type coord; + geom.rewind(0); + boost::get<0>(coord) = geom.vertex(&boost::get<1>(coord),&boost::get<2>(coord)); return coord; } }; - +template struct multi_geometry_ { - template - struct result { typedef bool type; }; + typedef T geometry_container; + template + struct result { typedef bool type; }; bool operator() (geometry_container const& geom) const { return geom.size() > 1 ? true : false; } }; +template +struct get_x +{ + typedef T value_type; + + template + struct result { typedef double type; }; + + double operator() (value_type const& val) const + { + return boost::get<1>(val); + } +}; + +template +struct get_y +{ + typedef T value_type; + + template + struct result { typedef double type; }; + + double operator() (value_type const& val) const + { + return boost::get<2>(val); + } +}; + +template struct multi_geometry_type { - template + typedef T geometry_container; + + template struct result { typedef boost::tuple type; }; boost::tuple operator() (geometry_container const& geom) const; @@ -108,15 +146,39 @@ { typedef boost::spirit::karma::real_policies base_type; static int floatfield(T n) { return base_type::fmtflags::fixed; } - static unsigned precision(T n) { return 6 ;} + static unsigned precision(T n) + { + if (n == 0.0) return 0; + return 6; + //using namespace boost::spirit; // for traits + //return std::max(6u, static_cast(15 - boost::math::trunc(log10(traits::get_absolute_value(n))))); + } + + template + static bool dot(OutputIterator& sink, T n, unsigned precision) + { + if (n == 0) return true; + return base_type::dot(sink, n, precision); + } + + template + static bool fraction_part(OutputIterator& sink, T n + , unsigned adjprec, unsigned precision) + { + if (n == 0) return true; + return base_type::fraction_part(sink, n, adjprec, precision); + } }; } -template +template struct wkt_generator : - karma::grammar + karma::grammar { + typedef Geometry geometry_type; + typedef typename boost::remove_pointer::type coord_type; + wkt_generator(bool single = false); // rules karma::rule wkt; @@ -125,34 +187,38 @@ karma::rule polygon; karma::rule coords; - karma::rule, geometry_type const& ()> coords2; - karma::rule point_coord; - karma::rule polygon_coord; + karma::rule, geometry_type const& ()> coords2; + karma::rule point_coord; + karma::rule, coord_type (unsigned&, double&, double& )> polygon_coord; // phoenix functions - phoenix::function _type; - phoenix::function _first; + phoenix::function > _type; + phoenix::function > _first; + phoenix::function > _x; + phoenix::function > _y; // - karma::real_generator > coord_type; + karma::real_generator > coordinate; }; -template +template struct wkt_multi_generator : - karma::grammar >, geometry_container const& ()> + karma::grammar >, GeometryContainer const& ()> { + typedef GeometryContainer geometry_contaner; + typedef boost::remove_pointer::type geometry_type; wkt_multi_generator(); // rules - karma::rule >, geometry_container const& ()> wkt; - karma::rule geometry; + karma::rule >, GeometryContainer const& ()> wkt; + karma::rule geometry; karma::rule single_geometry; - karma::rule multi_geometry; - wkt_generator path; + karma::rule multi_geometry; + wkt_generator path; // phoenix - phoenix::function is_multi; - phoenix::function _multi_type; - phoenix::function _type; + phoenix::function > is_multi; + phoenix::function > _multi_type; + phoenix::function > _type; // karma::symbols geometry_types; }; diff -Nru mapnik-2.1.0/include/mapnik/util/hsl.hpp mapnik-2.2.0/include/mapnik/util/hsl.hpp --- mapnik-2.1.0/include/mapnik/util/hsl.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/util/hsl.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,73 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_HSL_HPP +#define MAPNIK_HSL_HPP + +#include + +namespace mapnik { + +static inline void rgb2hsl(unsigned char red, unsigned char green, unsigned char blue, + double & h, double & s, double & l) { + double r = red/255.0; + double g = green/255.0; + double b = blue/255.0; + double max = std::max(r,std::max(g,b)); + double min = std::min(r,std::min(g,b)); + double delta = max - min; + double gamma = max + min; + h = s = l = gamma / 2.0; + if (delta > 0.0) { + s = l > 0.5 ? delta / (2.0 - gamma) : delta / gamma; + if (max == r && max != g) h = (g - b) / delta + (g < b ? 6.0 : 0.0); + else if (max == g && max != b) h = (b - r) / delta + 2.0; + else if (max == b && max != r) h = (r - g) / delta + 4.0; + h /= 6.0; + } +} + +static inline double hueToRGB(double m1, double m2, double h) { + // poor mans fmod + if(h < 0) h += 1; + if(h > 1) h -= 1; + if (h * 6 < 1) return m1 + (m2 - m1) * h * 6; + if (h * 2 < 1) return m2; + if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6; + return m1; +} + +static inline void hsl2rgb(double h, double s, double l, + unsigned char & r, unsigned char & g, unsigned char & b) { + if (!s) { + r = g = b = static_cast(l * 255); + } + double m2 = (l <= 0.5) ? l * (s + 1) : l + s - l * s; + double m1 = l * 2 - m2; + r = static_cast(hueToRGB(m1, m2, h + 0.33333) * 255); + g = static_cast(hueToRGB(m1, m2, h) * 255); + b = static_cast(hueToRGB(m1, m2, h - 0.33333) * 255); +} + +} + +#endif // end MAPNIK_HSL_HPP \ No newline at end of file diff -Nru mapnik-2.1.0/include/mapnik/util/path_iterator.hpp mapnik-2.2.0/include/mapnik/util/path_iterator.hpp --- mapnik-2.1.0/include/mapnik/util/path_iterator.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/util/path_iterator.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,85 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_VERTEX_ITERATOR_HPP +#define MAPNIK_VERTEX_ITERATOR_HPP + +// mapnik +#include + +// boost +#include +#include + +namespace mapnik { namespace util { + +template +class path_iterator + : public boost::iterator_facade< path_iterator, + boost::tuple const, + boost::forward_traversal_tag + > +{ + +public: + typedef T path_type; + typedef typename boost::tuple value_type; + + path_iterator() + : v_(mapnik::SEG_END,0,0), + vertices_() + {} + + explicit path_iterator(path_type const& vertices) + : vertices_(&vertices) + { + vertices_->rewind(0); + increment(); + } + +private: + friend class boost::iterator_core_access; + + void increment() + { + boost::get<0>(v_) = vertices_->vertex( &boost::get<1>(v_), &boost::get<2>(v_)); + } + + bool equal( path_iterator const& other) const + { + return boost::get<0>(v_) == boost::get<0>(other.v_); + } + + value_type const& dereference() const + { + return v_; + } + + value_type v_; + const path_type *vertices_; + unsigned pos_; +}; + +}} + + +#endif // MAPNIK_VERTEX_ITERATOR_HPP diff -Nru mapnik-2.1.0/include/mapnik/util/trim.hpp mapnik-2.2.0/include/mapnik/util/trim.hpp --- mapnik-2.1.0/include/mapnik/util/trim.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/util/trim.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,97 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2012 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_TRIM_HPP +#define MAPNIK_TRIM_HPP + +// stl +#include +#include + +namespace mapnik { namespace util { + +/* + https://github.com/mapnik/mapnik/issues/1633 + faster trim (than boost::trim) + that intentionally does not respect + std::locale to avoid overhead in cases + where the locale is not critical +*/ + +static inline bool not_whitespace(int ch) +{ + if (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t') return false; + return true; +} + +// trim from start +static inline std::string & ltrim(std::string & s) +{ + s.erase(s.begin(), std::find_if(s.begin(), s.end(), not_whitespace)); + return s; +} + +// trim from end +static inline std::string & rtrim(std::string & s) +{ + s.erase(std::find_if(s.rbegin(), s.rend(), not_whitespace).base(), s.end()); + return s; +} + +// trim from both ends +static inline void trim(std::string & s) +{ + ltrim(rtrim(s)); +} + +static inline std::string trim_copy(std::string s) +{ + return ltrim(rtrim(s)); +} + +static inline bool not_double_quote(int ch) +{ + if (ch == '"') return false; + return true; +} + +static inline void unquote_double(std::string & s) +{ + s.erase(s.begin(), std::find_if(s.begin(), s.end(), not_double_quote)); + s.erase(std::find_if(s.rbegin(), s.rend(), not_double_quote).base(), s.end()); +} + +static inline bool not_quoted(int ch) +{ + if (ch == '"' || ch == '\'') return false; + return true; +} + +static inline void unquote(std::string & s) +{ + s.erase(s.begin(), std::find_if(s.begin(), s.end(), not_quoted)); + s.erase(std::find_if(s.rbegin(), s.rend(), not_quoted).base(), s.end()); +} + +}} // end of namespace mapnik + +#endif // MAPNIK_TRIM_HPP diff -Nru mapnik-2.1.0/include/mapnik/util/vertex_iterator.hpp mapnik-2.2.0/include/mapnik/util/vertex_iterator.hpp --- mapnik-2.1.0/include/mapnik/util/vertex_iterator.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/util/vertex_iterator.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,87 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef MAPNIK_VERTEX_ITERATOR_HPP -#define MAPNIK_VERTEX_ITERATOR_HPP - -// mapnik -#include -#include - -// boost -#include -#include - -namespace mapnik { namespace util { - - template - class vertex_iterator - : public boost::iterator_facade< vertex_iterator, - typename boost::tuple const, - boost::forward_traversal_tag - > - { - - public: - typedef typename boost::tuple value_type; - typedef vertex_vector container_type; - - vertex_iterator() - : v_(SEG_END,0,0), - vertices_(), - pos_(0) - {} - - explicit vertex_iterator(container_type const& vertices) - : vertices_(&vertices), - pos_(0) - { - increment(); - } - - private: - friend class boost::iterator_core_access; - - void increment() - { - boost::get<0>(v_) = vertices_->get_vertex(pos_++, &boost::get<1>(v_), &boost::get<2>(v_)); - } - - bool equal( vertex_iterator const& other) const - { - return boost::get<0>(v_) == boost::get<0>(other.v_); - } - - value_type const& dereference() const - { - return v_; - } - - value_type v_; - container_type const *vertices_; - unsigned pos_; - }; - - }} - - -#endif // MAPNIK_VERTEX_ITERATOR_HPP diff -Nru mapnik-2.1.0/include/mapnik/utils.hpp mapnik-2.2.0/include/mapnik/utils.hpp --- mapnik-2.1.0/include/mapnik/utils.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/utils.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,6 +23,8 @@ #ifndef MAPNIK_UTILS_HPP #define MAPNIK_UTILS_HPP +#include + // boost #ifdef MAPNIK_THREADSAFE #include @@ -33,13 +35,12 @@ #include #include #include -#include -#include #include #include namespace mapnik { + #ifdef MAPNIK_THREADSAFE using boost::mutex; #endif @@ -84,85 +85,103 @@ return new(&staticMemory) T; } #ifdef __SUNPRO_CC - // Sun C++ Compiler doesn't handle `volatile` keyword same as GCC. +// Sun C++ Compiler doesn't handle `volatile` keyword same as GCC. static void destroy(T* obj) #else - static void destroy(volatile T* obj) + static void destroy(volatile T* obj) #endif { obj->~T(); } }; +#ifdef __GNUC__ template class CreatePolicy=CreateStatic> class singleton + template class CreatePolicy=CreateStatic> class MAPNIK_DECL singleton { +#else + template class CreatePolicy=CreateStatic> class singleton + { +#endif + #ifdef __SUNPRO_CC - /* Sun's C++ compiler will issue the following errors if CreatePolicy is used: - Error: A class template name was expected instead of mapnik::CreatePolicy - Error: A "friend" declaration must specify a class or function. - */ - friend class CreatePolicy; +/* Sun's C++ compiler will issue the following errors if CreatePolicy is used: + Error: A class template name was expected instead of mapnik::CreatePolicy + Error: A "friend" declaration must specify a class or function. +*/ + friend class CreatePolicy; #else - friend class CreatePolicy; + friend class CreatePolicy; #endif - static T* pInstance_; - static bool destroyed_; - singleton(const singleton &rhs); - singleton& operator=(const singleton&); + static T* pInstance_; + static bool destroyed_; + singleton(const singleton &rhs); + singleton& operator=(const singleton&); - static void onDeadReference() - { - throw std::runtime_error("dead reference!"); - } + static void onDeadReference() + { + throw std::runtime_error("dead reference!"); + } - static void DestroySingleton() - { - CreatePolicy::destroy(pInstance_); - pInstance_ = 0; - destroyed_ = true; - } + static void DestroySingleton() + { + CreatePolicy::destroy(pInstance_); + pInstance_ = 0; + destroyed_ = true; + } -protected: + protected: #ifdef MAPNIK_THREADSAFE - static mutex mutex_; + static mutex mutex_; #endif - singleton() {} -public: - static T* instance() - { - if (! pInstance_) + singleton() {} + public: + static T& instance() { -#ifdef MAPNIK_THREADSAFE - mutex::scoped_lock lock(mutex_); -#endif if (! pInstance_) { - if (destroyed_) +#ifdef MAPNIK_THREADSAFE + mutex::scoped_lock lock(mutex_); +#endif + if (! pInstance_) { - onDeadReference(); - } - else - { - pInstance_ = CreatePolicy::create(); - - // register destruction - std::atexit(&DestroySingleton); + if (destroyed_) + { + destroyed_ = false; + onDeadReference(); + } + else + { + pInstance_ = CreatePolicy::create(); + + // register destruction + std::atexit(&DestroySingleton); + } } } + return *pInstance_; } - return pInstance_; - } -}; + }; #ifdef MAPNIK_THREADSAFE -template class CreatePolicy> mutex singleton::mutex_; + template class CreatePolicy> mutex singleton::mutex_; #endif -template class CreatePolicy> T* singleton::pInstance_=0; -template class CreatePolicy> bool singleton::destroyed_=false; + template class CreatePolicy> T* singleton::pInstance_=0; + template class CreatePolicy> bool singleton::destroyed_=false; + + +#ifdef _WINDOWS + +// UTF8 <--> UTF16 conversion routines + +MAPNIK_DECL std::string utf16_to_utf8(std::wstring const& wstr); +MAPNIK_DECL std::wstring utf8_to_utf16(std::string const& str); + +#endif // _WINDOWS } diff -Nru mapnik-2.1.0/include/mapnik/value.hpp mapnik-2.2.0/include/mapnik/value.hpp --- mapnik-2.1.0/include/mapnik/value.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/value.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,20 +24,24 @@ #define MAPNIK_VALUE_HPP // mapnik +#include #include #include #include // boost -#include +#include +#include +#include +#include #include #include +#include +#include "hash_variant.hpp" // stl -#include #include #include - // uci #include #include @@ -47,10 +51,10 @@ inline void to_utf8(UnicodeString const& input, std::string & target) { - if (input.length() == 0) return; + if (input.isEmpty()) return; const int BUF_SIZE = 256; - char buf [BUF_SIZE]; + char buf [BUF_SIZE]; int len; UErrorCode err = U_ZERO_ERROR; @@ -60,91 +64,67 @@ boost::scoped_array buf_ptr(new char [len+1]); err = U_ZERO_ERROR; u_strToUTF8(buf_ptr.get() , len + 1, &len, input.getBuffer(), input.length(), &err); - target.assign(buf_ptr.get() , len); + target.assign(buf_ptr.get() , static_cast(len)); } else { - target.assign(buf, len); + target.assign(buf, static_cast(len)); } } -struct value_null -{ - template - value_null operator+ (T const& other) const - { - boost::ignore_unused_variable_warning(other); - return *this; - } +typedef boost::variant value_base; - template - value_null operator- (T const& other) const - { - boost::ignore_unused_variable_warning(other); - return *this; - } +namespace impl { - template - value_null operator* (T const& other) const +struct equals + : public boost::static_visitor +{ + bool operator() (value_integer lhs, value_double rhs) const { - boost::ignore_unused_variable_warning(other); - return *this; + return lhs == rhs; } - template - value_null operator/ (T const& other) const + bool operator() (value_bool lhs, value_double rhs) const { - boost::ignore_unused_variable_warning(other); - return *this; + return lhs == rhs; } - template - value_null operator% (T const& other) const + bool operator() (value_double lhs, value_integer rhs) const { - boost::ignore_unused_variable_warning(other); - return *this; + return lhs == rhs; } -}; - -typedef boost::variant value_base; - -namespace impl { -struct equals - : public boost::static_visitor -{ - template - bool operator() (const T &, const U &) const + bool operator() (value_bool lhs, value_integer rhs) const { - return false; + return lhs == rhs; } - template - bool operator() (T lhs, T rhs) const + bool operator() (value_integer lhs, value_bool rhs) const { - return lhs == rhs; + return lhs == rhs; } - bool operator() (int lhs, double rhs) const + bool operator() (value_double lhs, value_bool rhs) const { return lhs == rhs; } - bool operator() (double lhs, int rhs) const + bool operator() (value_unicode_string const& lhs, + value_unicode_string const& rhs) const { - return (lhs == rhs)? true : false ; + return (lhs == rhs) ? true: false; } - bool operator() (UnicodeString const& lhs, - UnicodeString const& rhs) const + template + bool operator() (T lhs, T rhs) const { - return (lhs == rhs) ? true: false; + return lhs == rhs; } - bool operator() (value_null, value_null) const + template + bool operator() (T const& lhs, U const& rhs) const { - // this changed from false to true - https://github.com/mapnik/mapnik/issues/794 - return true; + return false; } }; @@ -163,41 +143,51 @@ return lhs != rhs; } - bool operator() (int lhs, double rhs) const + bool operator() (value_integer lhs, value_double rhs) const { return lhs != rhs; } - bool operator() (double lhs, int rhs) const + bool operator() (value_bool lhs, value_double rhs) const { return lhs != rhs; } - bool operator() (UnicodeString const& lhs, - UnicodeString const& rhs) const + bool operator() (value_double lhs, value_integer rhs) const { - return (lhs != rhs)? true : false; + return lhs != rhs; } - bool operator() (value_null, value_null) const + bool operator() (value_bool lhs, value_integer rhs) const { - // TODO - needs review - https://github.com/mapnik/mapnik/issues/794 - return false; + return lhs != rhs; } - template - bool operator() (value_null, const T &) const + bool operator() (value_integer lhs, value_bool rhs) const { - // TODO - needs review - https://github.com/mapnik/mapnik/issues/794 - return false; + return lhs != rhs; } - template - bool operator() (const T &, value_null) const + bool operator() (value_double lhs, value_bool rhs) const { - // TODO - needs review - https://github.com/mapnik/mapnik/issues/794 - return false; + return lhs != rhs; + } + + bool operator() (value_unicode_string const& lhs, + value_unicode_string const& rhs) const + { + return (lhs != rhs)? true : false; } + + // back compatibility shim to equate empty string with null for != test + // https://github.com/mapnik/mapnik/issues/1859 + // TODO - consider removing entire specialization at Mapnik 3.x + bool operator() (value_null lhs,value_unicode_string const& rhs) const + { + if (rhs.isEmpty()) return false; + return true; + } + }; struct greater_than @@ -215,17 +205,17 @@ return lhs > rhs; } - bool operator() (int lhs, double rhs) const + bool operator() (value_integer lhs, value_double rhs) const { return lhs > rhs; } - bool operator() (double lhs, int rhs) const + bool operator() (value_double lhs, value_integer rhs) const { return lhs > rhs; } - bool operator() (UnicodeString const& lhs, UnicodeString const& rhs) const + bool operator() (value_unicode_string const& lhs, value_unicode_string const& rhs) const { return (lhs > rhs) ? true : false ; } @@ -251,17 +241,17 @@ return lhs >= rhs; } - bool operator() (int lhs, double rhs) const + bool operator() (value_integer lhs, value_double rhs) const { return lhs >= rhs; } - bool operator() (double lhs, int rhs) const + bool operator() (value_double lhs, value_integer rhs) const { return lhs >= rhs; } - bool operator() (UnicodeString const& lhs, UnicodeString const& rhs) const + bool operator() (value_unicode_string const& lhs, value_unicode_string const& rhs) const { return ( lhs >= rhs ) ? true : false ; } @@ -287,18 +277,18 @@ return lhs < rhs; } - bool operator() (int lhs, double rhs) const + bool operator() (value_integer lhs, value_double rhs) const { return lhs < rhs; } - bool operator() (double lhs, int rhs) const + bool operator() (value_double lhs, value_integer rhs) const { return lhs < rhs; } - bool operator()(UnicodeString const& lhs, - UnicodeString const& rhs ) const + bool operator()(value_unicode_string const& lhs, + value_unicode_string const& rhs ) const { return (lhs < rhs) ? true : false ; } @@ -324,18 +314,18 @@ return lhs <= rhs; } - bool operator() (int lhs, double rhs) const + bool operator() (value_integer lhs, value_double rhs) const { return lhs <= rhs; } - bool operator() (double lhs, int rhs) const + bool operator() (value_double lhs, value_integer rhs) const { return lhs <= rhs; } - bool operator()(UnicodeString const& lhs, - UnicodeString const& rhs ) const + bool operator()(value_unicode_string const& lhs, + value_unicode_string const& rhs ) const { return (lhs <= rhs) ? true : false ; } @@ -350,64 +340,68 @@ struct add : public boost::static_visitor { typedef V value_type; - - template - value_type operator() (T lhs, T rhs) const - { - return lhs + rhs ; - } - - value_type operator() (UnicodeString const& lhs , - UnicodeString const& rhs ) const + value_type operator() (value_unicode_string const& lhs , + value_unicode_string const& rhs ) const { return lhs + rhs; } - value_type operator() (double lhs, int rhs) const + value_type operator() (value_double lhs, value_integer rhs) const { return lhs + rhs; } - value_type operator() (int lhs, double rhs) const + value_type operator() (value_integer lhs, value_double rhs) const { return lhs + rhs; } - value_type operator() (UnicodeString const& lhs, value_null rhs) const + value_type operator() (value_unicode_string const& lhs, value_null rhs) const { boost::ignore_unused_variable_warning(rhs); return lhs; } - value_type operator() (value_null lhs, UnicodeString const& rhs) const + value_type operator() (value_null lhs, value_unicode_string const& rhs) const { boost::ignore_unused_variable_warning(lhs); return rhs; } template - value_type operator() (UnicodeString const& lhs, R const& rhs) const + value_type operator() (value_unicode_string const& lhs, R const& rhs) const { std::string val; if (util::to_string(val,rhs)) - return lhs + UnicodeString(val.c_str()); + return lhs + value_unicode_string(val.c_str()); return lhs; } template - value_type operator() (L const& lhs , UnicodeString const& rhs) const + value_type operator() (L const& lhs , value_unicode_string const& rhs) const { std::string val; if (util::to_string(val,lhs)) - return UnicodeString(val.c_str()) + rhs; + return value_unicode_string(val.c_str()) + rhs; return rhs; } + template + value_type operator() (T lhs, T rhs) const + { + return lhs + rhs ; + } + template value_type operator() (T1 const& lhs, T2 const&) const { return lhs; } + + value_type operator() (value_bool lhs, value_bool rhs) const + { + return value_integer(lhs + rhs); + } }; template @@ -421,26 +415,31 @@ } template - value_type operator() (T lhs, T rhs) const + value_type operator() (T lhs, T rhs) const { return lhs - rhs ; } - value_type operator() (UnicodeString const& lhs, - UnicodeString const& ) const + value_type operator() (value_unicode_string const& lhs, + value_unicode_string const& ) const { return lhs; } - value_type operator() (double lhs, int rhs) const + value_type operator() (value_double lhs, value_integer rhs) const { return lhs - rhs; } - value_type operator() (int lhs, double rhs) const + value_type operator() (value_integer lhs, value_double rhs) const { return lhs - rhs; } + + value_type operator() (value_bool lhs, value_bool rhs) const + { + return value_integer(lhs - rhs); + } }; template @@ -458,21 +457,28 @@ return lhs * rhs; } - value_type operator() (UnicodeString const& lhs, - UnicodeString const& ) const + value_type operator() (value_unicode_string const& lhs, + value_unicode_string const& ) const { return lhs; } - value_type operator() (double lhs, int rhs) const + value_type operator() (value_double lhs, value_integer rhs) const { return lhs * rhs; } - value_type operator() (int lhs, double rhs) const + value_type operator() (value_integer lhs, value_double rhs) const { return lhs * rhs; } + + value_type operator() (value_bool lhs, value_bool rhs) const + { + boost::ignore_unused_variable_warning(lhs); + boost::ignore_unused_variable_warning(rhs); + return value_integer(0); + } }; template @@ -491,25 +497,25 @@ return lhs / rhs; } - value_type operator() (bool lhs, bool rhs ) const + value_type operator() (value_bool lhs, value_bool rhs ) const { boost::ignore_unused_variable_warning(lhs); boost::ignore_unused_variable_warning(rhs); return false; } - value_type operator() (UnicodeString const& lhs, - UnicodeString const&) const + value_type operator() (value_unicode_string const& lhs, + value_unicode_string const&) const { return lhs; } - value_type operator() (double lhs, int rhs) const + value_type operator() (value_double lhs, value_integer rhs) const { return lhs / rhs; } - value_type operator() (int lhs, double rhs) const + value_type operator() (value_integer lhs, value_double rhs) const { return lhs / rhs; } @@ -531,31 +537,31 @@ return lhs % rhs; } - value_type operator() (UnicodeString const& lhs, - UnicodeString const&) const + value_type operator() (value_unicode_string const& lhs, + value_unicode_string const&) const { return lhs; } - value_type operator() (bool lhs, - bool rhs) const + value_type operator() (value_bool lhs, + value_bool rhs) const { boost::ignore_unused_variable_warning(lhs); boost::ignore_unused_variable_warning(rhs); return false; } - value_type operator() (double lhs, int rhs) const + value_type operator() (value_double lhs, value_integer rhs) const { - return std::fmod(lhs, rhs); + return std::fmod(lhs, static_cast(rhs)); } - value_type operator() (int lhs, double rhs) const + value_type operator() (value_integer lhs, value_double rhs) const { - return std::fmod(lhs, rhs); + return std::fmod(static_cast(lhs), rhs); } - value_type operator() (double lhs, double rhs) const + value_type operator() (value_double lhs, value_double rhs) const { return std::fmod(lhs, rhs); } @@ -577,39 +583,38 @@ return val; } - value_type operator() (bool val) const + value_type operator() (value_bool val) const { - return val ? -1 : 0; + return val ? value_integer(-1) : value_integer(0); } - value_type operator() (UnicodeString const& ustr) const + value_type operator() (value_unicode_string const& ustr) const { - UnicodeString inplace(ustr); + value_unicode_string inplace(ustr); return inplace.reverse(); } }; -struct to_bool : public boost::static_visitor +struct to_bool : public boost::static_visitor { - bool operator() (bool val) const + value_bool operator() (value_bool val) const { return val; } - bool operator() (UnicodeString const& ustr) const + value_bool operator() (value_unicode_string const& ustr) const { - boost::ignore_unused_variable_warning(ustr); - return true; + return !ustr.isEmpty(); } - bool operator() (value_null const& val) const + value_bool operator() (value_null const& val) const { boost::ignore_unused_variable_warning(val); return false; } template - bool operator() (T val) const + value_bool operator() (T val) const { return val > 0 ? true : false; } @@ -626,14 +631,14 @@ } // specializations - std::string operator() (UnicodeString const& val) const + std::string operator() (value_unicode_string const& val) const { std::string utf8; to_utf8(val,utf8); return utf8; } - std::string operator() (double val) const + std::string operator() (value_double val) const { std::string str; util::to_string(str, val); // TODO set precision(16) @@ -647,54 +652,61 @@ } }; -struct to_unicode : public boost::static_visitor +struct to_unicode : public boost::static_visitor { template - UnicodeString operator() (T val) const + value_unicode_string operator() (T val) const { std::string str; util::to_string(str,val); - return UnicodeString(str.c_str()); + return value_unicode_string(str.c_str()); } // specializations - UnicodeString const& operator() (UnicodeString const& val) const + value_unicode_string const& operator() (value_unicode_string const& val) const { return val; } - UnicodeString operator() (double val) const + value_unicode_string operator() (value_double val) const { std::string str; util::to_string(str,val); - return UnicodeString(str.c_str()); + return value_unicode_string(str.c_str()); } - UnicodeString operator() (value_null const& val) const + value_unicode_string operator() (value_null const& val) const { boost::ignore_unused_variable_warning(val); - return UnicodeString(""); + return value_unicode_string(""); } }; struct to_expression_string : public boost::static_visitor { - std::string operator() (UnicodeString const& val) const + std::string operator() (value_unicode_string const& val) const { std::string utf8; to_utf8(val,utf8); return "'" + utf8 + "'"; } - std::string operator() (double val) const + std::string operator() (value_integer val) const + { + std::string output; + util::to_string(output,val); + return output; + } + + std::string operator() (value_double val) const { std::string output; util::to_string(output,val); // TODO precision(16) return output; } - std::string operator() (bool val) const + std::string operator() (value_bool val) const { return val ? "true":"false"; } @@ -704,79 +716,83 @@ boost::ignore_unused_variable_warning(val); return "null"; } +}; - template - std::string operator() (T val) const +struct to_double : public boost::static_visitor +{ + value_double operator() (value_double val) const { - std::stringstream ss; - ss << val; - return ss.str(); + return val; } -}; -struct to_double : public boost::static_visitor -{ - double operator() (int val) const + value_double operator() (value_integer val) const { - return static_cast(val); + return static_cast(val); } - double operator() (double val) const + value_double operator() (value_bool val) const { - return val; + return static_cast(val); } - double operator() (std::string const& val) const + value_double operator() (std::string const& val) const { - double result; + value_double result; if (util::string2double(val,result)) return result; return 0; } - double operator() (UnicodeString const& val) const + + value_double operator() (value_unicode_string const& val) const { std::string utf8; to_utf8(val,utf8); return operator()(utf8); } - double operator() (value_null const& val) const + value_double operator() (value_null const& val) const { boost::ignore_unused_variable_warning(val); return 0.0; } }; -struct to_int : public boost::static_visitor +struct to_int : public boost::static_visitor { - int operator() (int val) const + value_integer operator() (value_integer val) const { return val; } - int operator() (double val) const + value_integer operator() (value_double val) const + { + return static_cast(rint(val)); + } + + value_integer operator() (value_bool val) const { - return rint(val); + return static_cast(val); } - int operator() (std::string const& val) const + value_integer operator() (std::string const& val) const { - int result; + value_integer result; if (util::string2int(val,result)) return result; - return 0; + return value_integer(0); } - int operator() (UnicodeString const& val) const + + value_integer operator() (value_unicode_string const& val) const { std::string utf8; to_utf8(val,utf8); return operator()(utf8); } - int operator() (value_null const& val) const + value_integer operator() (value_null const& val) const { boost::ignore_unused_variable_warning(val); - return 0; + return value_integer(0); } }; @@ -842,7 +858,7 @@ bool is_null() const; - bool to_bool() const + value_bool to_bool() const { return boost::apply_visitor(impl::to_bool(),base_); } @@ -857,21 +873,20 @@ return boost::apply_visitor(impl::to_string(),base_); } - UnicodeString to_unicode() const + value_unicode_string to_unicode() const { return boost::apply_visitor(impl::to_unicode(),base_); } - double to_double() const + value_double to_double() const { return boost::apply_visitor(impl::to_double(),base_); } - double to_int() const + value_integer to_int() const { return boost::apply_visitor(impl::to_int(),base_); } - }; inline const value operator+(value const& p1,value const& p2) @@ -913,6 +928,10 @@ return out; } +inline std::size_t hash_value(const value& val) { + return hash_value(val.base()); +} + } // namespace value_adl_barrier using value_adl_barrier::value; diff -Nru mapnik-2.1.0/include/mapnik/value_error.hpp mapnik-2.2.0/include/mapnik/value_error.hpp --- mapnik-2.1.0/include/mapnik/value_error.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/value_error.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,8 +23,10 @@ #ifndef MAPNIK_VALUE_ERROR_HPP #define MAPNIK_VALUE_ERROR_HPP -#include -#include +#include + +#include +#include namespace mapnik { @@ -39,7 +41,7 @@ { } - virtual ~value_error() throw() {}; + virtual ~value_error() throw() {} virtual const char * what() const throw() { diff -Nru mapnik-2.1.0/include/mapnik/value_types.hpp mapnik-2.2.0/include/mapnik/value_types.hpp --- mapnik-2.1.0/include/mapnik/value_types.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/value_types.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,102 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2012 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_VALUE_TYPES_HPP +#define MAPNIK_VALUE_TYPES_HPP + +// icu +#include // for UnicodeString + +// boost +//#include + +// stl +#include // for ostream + +namespace mapnik { + +#ifdef BIGINT +//typedef boost::long_long_type value_integer; +typedef long long value_integer; +#else +typedef int value_integer; +#endif + +typedef double value_double; +typedef UnicodeString value_unicode_string; +typedef bool value_bool; + +struct value_null +{ + bool operator==(value_null const& other) const + { + return true; + } + + bool operator!=(value_null const& other) const + { + return false; + } + + template + value_null operator+ (T const& /*other*/) const + { + return *this; + } + + template + value_null operator- (T const& /*other*/) const + { + return *this; + } + + template + value_null operator* (T const& /*other*/) const + { + return *this; + } + + template + value_null operator/ (T const& /*other*/) const + { + return *this; + } + + template + value_null operator% (T const& /*other*/) const + { + return *this; + } +}; + +inline std::size_t hash_value(const value_null& val) { + return 0; +} + +inline std::ostream& operator<< (std::ostream & out,value_null const& v) +{ + return out; +} + +} // namespace mapnik + +#endif // MAPNIK_VALUE_TYPES_HPP diff -Nru mapnik-2.1.0/include/mapnik/version.hpp mapnik-2.2.0/include/mapnik/version.hpp --- mapnik-2.1.0/include/mapnik/version.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/version.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,10 +26,10 @@ #define MAPNIK_VERSION_IS_RELEASE 1 #define MAPNIK_MAJOR_VERSION 2 -#define MAPNIK_MINOR_VERSION 1 +#define MAPNIK_MINOR_VERSION 2 #define MAPNIK_PATCH_VERSION 0 -// translates to 200100 +// translates to 200200 #define MAPNIK_VERSION (MAPNIK_MAJOR_VERSION*100000) + (MAPNIK_MINOR_VERSION*100) + (MAPNIK_PATCH_VERSION) #ifndef MAPNIK_STRINGIFY diff -Nru mapnik-2.1.0/include/mapnik/vertex.hpp mapnik-2.2.0/include/mapnik/vertex.hpp --- mapnik-2.1.0/include/mapnik/vertex.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/vertex.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -56,8 +56,8 @@ explicit vertex(no_init_t) {} - vertex(coord_type x,coord_type y,unsigned cmd) - : x(x),y(y),cmd(cmd) {} + vertex(coord_type x_,coord_type y_,unsigned cmd_) + : x(x_),y(y_),cmd(cmd_) {} template vertex(const vertex& rhs) diff -Nru mapnik-2.1.0/include/mapnik/vertex_converters.hpp mapnik-2.2.0/include/mapnik/vertex_converters.hpp --- mapnik-2.1.0/include/mapnik/vertex_converters.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/vertex_converters.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,6 +25,7 @@ // boost #include + // mpl #include #include @@ -36,33 +37,42 @@ #include #include #include + // fusion +#include #include #include #include -//#include #include -#include #include // mapnik #include #include +#include +#include + // agg #include "agg_conv_clip_polygon.h" #include "agg_conv_clip_polyline.h" +#include "agg_conv_close_polygon.h" #include "agg_conv_smooth_poly1.h" #include "agg_conv_stroke.h" #include "agg_conv_dash.h" #include "agg_conv_transform.h" +#include "agg_conv_clipper.h" +#include "agg_path_storage.h" namespace mapnik { struct transform_tag {}; struct clip_line_tag {}; struct clip_poly_tag {}; +struct clipper_tag {}; +struct close_poly_tag {}; struct smooth_tag {}; +struct simplify_tag {}; struct stroke_tag {}; struct dash_tag {}; struct affine_transform_tag {}; @@ -95,6 +105,19 @@ } }; +template +struct converter_traits +{ + typedef T geometry_type; + typedef simplify_converter conv_type; + + template + static void setup(geometry_type & geom, Args const& args) + { + geom.set_simplify_algorithm(boost::fusion::at_c<2>(args).simplify_algorithm()); + geom.set_simplify_tolerance(boost::fusion::at_c<2>(args).simplify_tolerance()); + } +}; template struct converter_traits @@ -159,7 +182,6 @@ { typedef T geometry_type; typedef typename agg::conv_clip_polygon conv_type; - template static void setup(geometry_type & geom, Args const& args) { @@ -168,6 +190,37 @@ } }; +template +struct converter_traits +{ + typedef T geometry_type; + typedef typename agg::conv_clipper conv_type; + template + static void setup(geometry_type & geom, Args const& args) + { + typename boost::mpl::at >::type box = boost::fusion::at_c<0>(args); + agg::path_storage * ps = new agg::path_storage(); // FIXME: this will leak memory! + ps->move_to(box.minx(),box.miny()); + ps->line_to(box.minx(),box.maxy()); + ps->line_to(box.maxx(),box.maxy()); + ps->line_to(box.maxx(),box.miny()); + ps->close_polygon(); + geom.attach2(*ps, agg::clipper_non_zero); + //geom.reverse(true); + } +}; + +template +struct converter_traits +{ + typedef T geometry_type; + typedef typename agg::conv_close_polygon conv_type; + template + static void setup(geometry_type & geom, Args const& args) + { + // no-op + } +}; template struct converter_traits @@ -214,7 +267,8 @@ static void setup(geometry_type & geom, Args const& args) { typename boost::mpl::at >::type sym = boost::fusion::at_c<2>(args); - geom.set_offset(sym.offset()); + double scale_factor = boost::fusion::at_c<6>(args); + geom.set_offset(sym.offset()*scale_factor); } }; @@ -299,7 +353,7 @@ template -struct vertex_converter : private boost::noncopyable +struct vertex_converter : private mapnik::noncopyable { typedef C conv_types; typedef B bbox_type; @@ -347,6 +401,16 @@ disp_.vec_[index]=1; } + template + void unset() + { + typedef typename boost::mpl::find::type iter; + typedef typename boost::mpl::end::type end; + std::size_t index = boost::mpl::distance::value - 1; + if (index < disp_.vec_.size()) + disp_.vec_[index]=0; + } + detail::dispatcher disp_; }; diff -Nru mapnik-2.1.0/include/mapnik/vertex_vector.hpp mapnik-2.2.0/include/mapnik/vertex_vector.hpp --- mapnik-2.1.0/include/mapnik/vertex_vector.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/vertex_vector.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -29,9 +29,9 @@ // mapnik #include +#include // boost -#include #include #include // required for memcpy with linux/g++ @@ -40,7 +40,7 @@ { template -class vertex_vector : private boost::noncopyable +class vertex_vector : private mapnik::noncopyable { typedef T coord_type; typedef vertex vertex_type; diff -Nru mapnik-2.1.0/include/mapnik/warp.hpp mapnik-2.2.0/include/mapnik/warp.hpp --- mapnik-2.1.0/include/mapnik/warp.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/warp.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,12 +24,13 @@ #define MAPNIK_WARP_HPP // mapnik -#include -#include #include namespace mapnik { +class raster; +class proj_transform; + void reproject_and_scale_raster(raster & target, raster const& source, proj_transform const& prj_trans, diff -Nru mapnik-2.1.0/include/mapnik/well_known_srs.hpp mapnik-2.2.0/include/mapnik/well_known_srs.hpp --- mapnik-2.1.0/include/mapnik/well_known_srs.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/well_known_srs.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,94 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_WELL_KNOWN_SRS_HPP +#define MAPNIK_WELL_KNOWN_SRS_HPP + +// mapnik +#include // for M_PI on windows +#include + +// boost +#include + +// stl +#include + +namespace mapnik { + +enum well_known_srs_enum { + WGS_84, + G_MERC, + well_known_srs_enum_MAX +}; + +DEFINE_ENUM( well_known_srs_e, well_known_srs_enum ); + +static const double EARTH_RADIUS = 6378137.0; +static const double EARTH_DIAMETER = EARTH_RADIUS * 2.0; +static const double EARTH_CIRCUMFERENCE = EARTH_DIAMETER * M_PI; +static const double MAXEXTENT = EARTH_CIRCUMFERENCE / 2.0; +static const double M_PI_by2 = M_PI / 2; +static const double D2R = M_PI / 180; +static const double R2D = 180 / M_PI; +static const double M_PIby360 = M_PI / 360; +static const double MAXEXTENTby180 = MAXEXTENT / 180; +static const double MAX_LATITUDE = R2D * (2 * std::atan(std::exp(180 * D2R)) - M_PI_by2); +static const std::string MAPNIK_LONGLAT_PROJ = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"; +static const std::string MAPNIK_GMERC_PROJ = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"; + +boost::optional is_well_known_srs(std::string const& srs); + +boost::optional is_known_geographic(std::string const& srs); + +static inline bool lonlat2merc(double * x, double * y , int point_count) +{ + for(int i=0; i 180) x[i] = 180; + else if (x[i] < -180) x[i] = -180; + if (y[i] > MAX_LATITUDE) y[i] = MAX_LATITUDE; + else if (y[i] < -MAX_LATITUDE) y[i] = -MAX_LATITUDE; + x[i] = x[i] * MAXEXTENTby180; + y[i] = std::log(std::tan((90 + y[i]) * M_PIby360)) * R2D; + y[i] = y[i] * MAXEXTENTby180; + } + return true; +} + +static inline bool merc2lonlat(double * x, double * y , int point_count) +{ + for(int i=0; i MAXEXTENT) x[i] = MAXEXTENT; + else if (x[i] < -MAXEXTENT) x[i] = -MAXEXTENT; + if (y[i] > MAXEXTENT) y[i] = MAXEXTENT; + else if (y[i] < -MAXEXTENT) y[i] = -MAXEXTENT; + x[i] = (x[i] / MAXEXTENT) * 180; + y[i] = (y[i] / MAXEXTENT) * 180; + y[i] = R2D * (2 * std::atan(std::exp(y[i] * D2R)) - M_PI_by2); + } + return true; +} + +} + +#endif // MAPNIK_WELL_KNOWN_SRS_HPP diff -Nru mapnik-2.1.0/include/mapnik/wkb.hpp mapnik-2.2.0/include/mapnik/wkb.hpp --- mapnik-2.1.0/include/mapnik/wkb.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/wkb.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,9 +25,7 @@ // mapnik #include - -// boost -#include +#include namespace mapnik { @@ -50,7 +48,7 @@ wkbSpatiaLite=3 }; -class MAPNIK_DECL geometry_utils : private boost::noncopyable +class MAPNIK_DECL geometry_utils : private mapnik::noncopyable { public: diff -Nru mapnik-2.1.0/include/mapnik/wkt/wkt_factory.hpp mapnik-2.2.0/include/mapnik/wkt/wkt_factory.hpp --- mapnik-2.1.0/include/mapnik/wkt/wkt_factory.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/wkt/wkt_factory.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -27,8 +27,9 @@ #include #include #include +#include + // boost -#include #include #include #include @@ -42,7 +43,7 @@ #if BOOST_VERSION >= 104700 -class wkt_parser : boost::noncopyable +class MAPNIK_DECL wkt_parser : mapnik::noncopyable { typedef std::string::const_iterator iterator_type; public: diff -Nru mapnik-2.1.0/include/mapnik/wkt/wkt_grammar.hpp mapnik-2.2.0/include/mapnik/wkt/wkt_grammar.hpp --- mapnik-2.1.0/include/mapnik/wkt/wkt_grammar.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/wkt/wkt_grammar.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include // mapnik #include @@ -71,7 +71,7 @@ void operator() (T path) const { BOOST_ASSERT( path!=0 ); - path->close(); + path->close_path(); } }; diff -Nru mapnik-2.1.0/include/mapnik/xml_attribute_cast.hpp mapnik-2.2.0/include/mapnik/xml_attribute_cast.hpp --- mapnik-2.1.0/include/mapnik/xml_attribute_cast.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/xml_attribute_cast.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,197 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_XML_ATTRIBUTE_CAST_HPP +#define MAPNIK_XML_ATTRIBUTE_CAST_HPP + +//mapnik +#include +#include +#include +#include +#include +#include + +// boost +#include +#include + +// stl +#include +#include + +namespace mapnik { namespace detail { + +template +struct do_xml_attribute_cast +{ + static inline boost::optional xml_attribute_cast_impl(xml_tree const& tree, std::string const& source) + { + std::string err_msg = (boost::format("No conversion from std::string to %s") % typeid(T).name()).str(); + throw std::runtime_error(err_msg); + } +}; + +// specialization for mapnik::boolean +template <> +struct do_xml_attribute_cast +{ + static inline boost::optional xml_attribute_cast_impl(xml_tree const& tree, std::string const& source) + { + bool result; + if (mapnik::util::string2bool(source, result)) + return boost::optional(result); + return boost::optional(); + } +}; + +// specialization for int +template <> +struct do_xml_attribute_cast +{ + static inline boost::optional xml_attribute_cast_impl(xml_tree const& tree, std::string const& source) + { + int result; + if (mapnik::util::string2int(source, result)) + return boost::optional(result); + return boost::optional(); + } +}; + +#ifdef BIGINT +// specialization for long long +template <> +struct do_xml_attribute_cast +{ + static inline boost::optional xml_attribute_cast_impl(xml_tree const& tree, std::string const& source) + { + int result; + if (mapnik::util::string2int(source, result)) + return boost::optional(result); + return boost::optional(); + } +}; + +#endif + +// specialization for unsigned + +template <> +struct do_xml_attribute_cast +{ + static inline boost::optional xml_attribute_cast_impl(xml_tree const& tree, std::string const& source) + { + int result; + if (mapnik::util::string2int(source, result)) + return boost::optional(result); + return boost::optional(); + } +}; + +// specialization for float +template <> +struct do_xml_attribute_cast +{ + static inline boost::optional xml_attribute_cast_impl(xml_tree const& tree, std::string const& source) + { + float result; + if (mapnik::util::string2float(source, result)) + return boost::optional(result); + return boost::optional(); + } +}; + +// specialization for double +template <> +struct do_xml_attribute_cast +{ + static inline boost::optional xml_attribute_cast_impl(xml_tree const& tree, std::string const& source) + { + double result; + if (mapnik::util::string2double(source, result)) + return boost::optional(result); + return boost::optional(); + } +}; + +// specialization for mapnik::enumeration +template +struct do_xml_attribute_cast > +{ + static inline boost::optional > xml_attribute_cast_impl(xml_tree const& tree, std::string const& source) + { + typedef typename boost::optional > result_type; + try + { + mapnik::enumeration e; + e.from_string(source); + return result_type(e); + } + catch (illegal_enum_value const& ex) + { + MAPNIK_LOG_ERROR(do_xml_attribute_cast) << ex.what(); + return result_type(); + } + } +}; + +// specialization for mapnik::color +template <> +struct do_xml_attribute_cast +{ + static inline boost::optional xml_attribute_cast_impl(xml_tree const& tree, std::string const& source) + { + return parse_color(source, tree.color_grammar); + } +}; + +// specialization for std::string +template <> +struct do_xml_attribute_cast +{ + static inline boost::optional xml_attribute_cast_impl(xml_tree const& tree, std::string const& source) + { + return boost::optional(source); + } +}; + +// specialization for mapnik::expression_ptr +template <> +struct do_xml_attribute_cast +{ + static inline boost::optional xml_attribute_cast_impl(xml_tree const& tree, std::string const& source) + { + return parse_expression(source, tree.expr_grammar); + } +}; + +} // end namespace detail + +template +boost::optional xml_attribute_cast(xml_tree const& tree, std::string const& source) +{ + return detail::do_xml_attribute_cast::xml_attribute_cast_impl(tree, source); +} + +} // end namespace mapnik + +#endif // MAPNIK_XML_ATTRIBUTE_CAST_HPP diff -Nru mapnik-2.1.0/include/mapnik/xml_node.hpp mapnik-2.2.0/include/mapnik/xml_node.hpp --- mapnik-2.1.0/include/mapnik/xml_node.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/xml_node.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -100,6 +100,7 @@ void set_processed(bool processed) const; unsigned line() const; + std::string line_to_string() const; const_iterator begin() const; const_iterator end() const; diff -Nru mapnik-2.1.0/include/mapnik/xml_tree.hpp mapnik-2.2.0/include/mapnik/xml_tree.hpp --- mapnik-2.1.0/include/mapnik/xml_tree.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/include/mapnik/xml_tree.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -31,6 +31,7 @@ #include #include #include +#include // boost #include diff -Nru mapnik-2.1.0/plugins/input/csv/build.py mapnik-2.2.0/plugins/input/csv/build.py --- mapnik-2.1.0/plugins/input/csv/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/csv/build.py 2013-06-04 01:35:27.000000000 +0000 @@ -1,37 +1,73 @@ -#!/usr/bin/env python +# +# This file is part of Mapnik (c++ mapping toolkit) +# +# Copyright (C) 2013 Artem Pavlenko +# +# Mapnik is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# -import os -Import ('plugin_base') Import ('env') -PLUGIN_NAME = 'csv' +can_build = False -install_dest = env['MAPNIK_INPUT_PLUGINS_DEST'] -plugin_env = plugin_base.Clone() +if env.get('BOOST_LIB_VERSION_FROM_HEADER'): + boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1]) + if boost_version_from_header >= 47: + can_build = True + +if not can_build: + print 'WARNING: skipping building the optional geojson datasource plugin which requires boost >= 1.47' +else: + Import ('plugin_base') + + PLUGIN_NAME = 'csv' + + plugin_env = plugin_base.Clone() + + plugin_sources = Split( + """ + %(PLUGIN_NAME)s_datasource.cpp + """ % locals() + ) + + # Link Library to Dependencies + libraries = [] + libraries.append('boost_system%s' % env['BOOST_APPEND']) + libraries.append(env['ICU_LIB_NAME']) + + if env['PLUGIN_LINKING'] == 'shared': + libraries.append('mapnik') + + TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, + SHLIBPREFIX='', + SHLIBSUFFIX='.input', + source=plugin_sources, + LIBS=libraries, + LINKFLAGS=env.get('CUSTOM_LDFLAGS')) + + # if the plugin links to libmapnik ensure it is built first + Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + + if 'uninstall' not in COMMAND_LINE_TARGETS: + env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET) + env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) + + plugin_obj = { + 'LIBS': libraries, + 'SOURCES': plugin_sources, + } -plugin_sources = Split( - """ - %(PLUGIN_NAME)s_datasource.cpp - """ % locals() - ) - -libraries = [] -libraries.append('mapnik') -libraries.append('boost_system%s' % env['BOOST_APPEND']) -libraries.append(env['ICU_LIB_NAME']) - -TARGET = plugin_env.SharedLibrary( - '../%s' % PLUGIN_NAME, - SHLIBPREFIX='', - SHLIBSUFFIX='.input', - source=plugin_sources, - LIBS=libraries, - LINKFLAGS=env.get('CUSTOM_LDFLAGS') - ) - -# if the plugin links to libmapnik ensure it is built first -Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) - -if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Install(install_dest, TARGET) - env.Alias('install', install_dest) + Return('plugin_obj') diff -Nru mapnik-2.1.0/plugins/input/csv/csv_datasource.cpp mapnik-2.2.0/plugins/input/csv/csv_datasource.cpp --- mapnik-2.1.0/plugins/input/csv/csv_datasource.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/csv/csv_datasource.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -27,11 +27,11 @@ #include #include #include -#include -#include // mapnik #include +#include +#include #include #include #include @@ -41,6 +41,8 @@ #include #include #include +#include +#include // stl #include @@ -48,30 +50,29 @@ #include #include #include +#include using mapnik::datasource; using mapnik::parameters; -using namespace boost::spirit; DATASOURCE_PLUGIN(csv_datasource) -csv_datasource::csv_datasource(parameters const& params, bool bind) +csv_datasource::csv_datasource(parameters const& params) : datasource(params), - desc_(*params_.get("type"), *params_.get("encoding", "utf-8")), + desc_(*params.get("type"), *params.get("encoding", "utf-8")), extent_(), filename_(), inline_string_(), file_length_(0), - row_limit_(*params_.get("row_limit", 0)), + row_limit_(*params.get("row_limit", 0)), features_(), - escape_(*params_.get("escape", "")), - separator_(*params_.get("separator", "")), - quote_(*params_.get("quote", "")), + escape_(*params.get("escape", "")), + separator_(*params.get("separator", "")), + quote_(*params.get("quote", "")), headers_(), - manual_headers_(boost::trim_copy(*params_.get("headers", ""))), - strict_(*params_.get("strict", false)), - quiet_(*params_.get("quiet", false)), - filesize_max_(*params_.get("filesize_max", 20.0)), // MB + manual_headers_(mapnik::util::trim_copy(*params.get("headers", ""))), + strict_(*params.get("strict", false)), + filesize_max_(*params.get("filesize_max", 20.0)), // MB ctx_(boost::make_shared()) { /* TODO: @@ -96,36 +97,22 @@ http://boost-spirit.com/home/articles/qi-example/tracking-the-input-position-while-parsing/ */ - boost::optional inline_string = params_.get("inline"); + boost::optional inline_string = params.get("inline"); if (inline_string) { inline_string_ = *inline_string; } else { - boost::optional file = params_.get("file"); + boost::optional file = params.get("file"); if (!file) throw mapnik::datasource_exception("CSV Plugin: missing parameter"); - boost::optional base = params_.get("base"); + boost::optional base = params.get("base"); if (base) filename_ = *base + "/" + *file; else filename_ = *file; } - - if (bind) - { - this->bind(); - } -} - - -csv_datasource::~csv_datasource() { } - -void csv_datasource::bind() const -{ - if (is_bound_) return; - if (!inline_string_.empty()) { std::istringstream in(inline_string_); @@ -133,20 +120,28 @@ } else { +#if defined (_WINDOWS) + std::ifstream in(mapnik::utf8_to_utf16(filename_),std::ios_base::in | std::ios_base::binary); +#else std::ifstream in(filename_.c_str(),std::ios_base::in | std::ios_base::binary); +#endif if (!in.is_open()) + { throw mapnik::datasource_exception("CSV Plugin: could not open: '" + filename_ + "'"); + } parse_csv(in,escape_, separator_, quote_); in.close(); } - is_bound_ = true; } + +csv_datasource::~csv_datasource() { } + template -void csv_datasource::parse_csv(T& stream, +void csv_datasource::parse_csv(T & stream, std::string const& escape, std::string const& separator, - std::string const& quote) const + std::string const& quote) { stream.seekg(0, std::ios::end); file_length_ = stream.tellg(); @@ -159,9 +154,8 @@ if (file_mb > filesize_max_) { std::ostringstream s; - s << "CSV Plugin: csv file is greater than " << filesize_max_ << "MB " - << " - you should use a more efficient data format like sqlite, postgis or a shapefile " - << " to render this data (set 'filesize_max=0' to disable this restriction if you have lots of memory)"; + s << "CSV Plugin: csv file is greater than "; + s << filesize_max_ << "MB - you should use a more efficient data format like sqlite, postgis or a shapefile to render this data (set 'filesize_max=0' to disable this restriction if you have lots of memory)"; throw mapnik::datasource_exception(s.str()); } } @@ -171,31 +165,20 @@ // autodetect newlines char newline = '\n'; - int newline_count = 0; - int carriage_count = 0; - for (unsigned idx = 0; idx < file_length_; idx++) + bool has_newline = false; + for (unsigned lidx = 0; lidx < file_length_ && lidx < 4000; lidx++) { char c = static_cast(stream.get()); - if (c == '\n') - { - ++newline_count; - } - else if (c == '\r') + if (c == '\r') { - ++carriage_count; + newline = '\r'; + has_newline = true; + break; } - // read at least 2000 bytes before testing - if (idx == file_length_-1 || idx > 4000) + if (c == '\n') { - if (newline_count > carriage_count) - { - break; - } - else if (carriage_count > newline_count) - { - newline = '\r'; - break; - } + has_newline = true; + break; } } @@ -208,7 +191,7 @@ // if user has not passed a separator manually // then attempt to detect by reading first line - std::string sep = boost::trim_copy(separator); + std::string sep = mapnik::util::trim_copy(separator); if (sep.empty()) { // default to ',' @@ -252,13 +235,14 @@ typedef boost::escaped_list_separator escape_type; - std::string esc = boost::trim_copy(escape); + std::string esc = mapnik::util::trim_copy(escape); if (esc.empty()) esc = "\\"; - std::string quo = boost::trim_copy(quote); + std::string quo = mapnik::util::trim_copy(quote); if (quo.empty()) quo = "\""; - MAPNIK_LOG_DEBUG(csv) << "csv_datasource: csv grammer: sep: '" << sep << "' quo: '" << quo << "' esc: '" << esc; + MAPNIK_LOG_DEBUG(csv) << "csv_datasource: csv grammar: sep: '" << sep + << "' quo: '" << quo << "' esc: '" << esc << "'"; boost::escaped_list_separator grammer; try @@ -268,9 +252,9 @@ } catch(std::exception const& ex) { - std::ostringstream s; - s << "CSV Plugin: " << ex.what(); - throw mapnik::datasource_exception(s.str()); + std::string s("CSV Plugin: "); + s += ex.what(); + throw mapnik::datasource_exception(s); } typedef boost::tokenizer< escape_type > Tokenizer; @@ -292,8 +276,9 @@ unsigned idx(0); for (; beg != tok.end(); ++beg) { - std::string val = boost::trim_copy(*beg); - std::string lower_val = boost::algorithm::to_lower_copy(val); + std::string val = mapnik::util::trim_copy(*beg); + std::string lower_val = val; + std::transform(lower_val.begin(), lower_val.end(), lower_val.begin(), ::tolower); if (lower_val == "wkt" || (lower_val.find("geom") != std::string::npos)) { @@ -335,7 +320,7 @@ Tokenizer::iterator beg = tok.begin(); std::string val; if (beg != tok.end()) - val = boost::trim_copy(*beg); + val = mapnik::util::trim_copy(*beg); // skip blank lines if (val.empty()) @@ -349,16 +334,16 @@ for (; beg != tok.end(); ++beg) { ++idx; - val = boost::trim_copy(*beg); + val = mapnik::util::trim_copy(*beg); if (val.empty()) { if (strict_) { std::ostringstream s; - s << "CSV Plugin: expected a column header at line " - << line_number << ", column " << idx - << " - ensure this row contains valid header fields: '" - << csv_line << "'\n"; + s << "CSV Plugin: expected a column header at line "; + s << line_number << ", column " << idx; + s << " - ensure this row contains valid header fields: '"; + s << csv_line << "'\n"; throw mapnik::datasource_exception(s.str()); } else @@ -371,7 +356,8 @@ } else { - std::string lower_val = boost::algorithm::to_lower_copy(val); + std::string lower_val = val; + std::transform(lower_val.begin(), lower_val.end(), lower_val.begin(), ::tolower); if (lower_val == "wkt" || (lower_val.find("geom") != std::string::npos)) { @@ -408,21 +394,19 @@ } catch(const std::exception & ex) { - std::ostringstream s; - s << "CSV Plugin: error parsing headers: " << ex.what(); - throw mapnik::datasource_exception(s.str()); + std::string s("CSV Plugin: error parsing headers: "); + s += ex.what(); + throw mapnik::datasource_exception(s); } } } if (!has_wkt_field && !has_json_field && (!has_lon_field || !has_lat_field) ) { - std::ostringstream s; - s << "CSV Plugin: could not detect column headers with the name of wkt, geojson, x/y, or latitude/longitude - this is required for reading geometry data"; - throw mapnik::datasource_exception(s.str()); + throw mapnik::datasource_exception("CSV Plugin: could not detect column headers with the name of wkt, geojson, x/y, or latitude/longitude - this is required for reading geometry data"); } - int feature_count(1); + mapnik::value_integer feature_count(0); bool extent_initialized = false; std::size_t num_headers = headers_.size(); @@ -435,12 +419,23 @@ mapnik::wkt_parser parse_wkt; mapnik::json::geometry_parser parse_json; - while (std::getline(stream,csv_line,newline)) + // handle rare case of a single line of data and user-provided headers + // where a lack of a newline will mean that std::getline returns false + bool is_first_row = false; + if (!has_newline) { + stream >> csv_line; + if (!csv_line.empty()) + { + is_first_row = true; + } + } + while (std::getline(stream,csv_line,newline) || is_first_row) + { + is_first_row = false; if ((row_limit_ > 0) && (line_number > row_limit_)) { MAPNIK_LOG_DEBUG(csv) << "csv_datasource: row limit hit, exiting at feature: " << feature_count; - break; } @@ -466,7 +461,7 @@ { csv_utils::fix_json_quoting(csv_line); } - + Tokenizer tok(csv_line, grammer); Tokenizer::iterator beg = tok.begin(); @@ -495,7 +490,8 @@ } } - mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,feature_count)); + // NOTE: we use ++feature_count here because feature id's should start at 1; + mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,++feature_count)); double x(0); double y(0); bool parsed_x = false; @@ -523,7 +519,7 @@ } else { - value = boost::trim_copy(*beg); + value = mapnik::util::trim_copy(*beg); ++beg; } @@ -596,7 +592,7 @@ MAPNIK_LOG_ERROR(csv) << s.str(); } } - } + } } else { @@ -664,7 +660,9 @@ } } - // now, add all values as attributes + // now, add attributes, skipping any WKT or JSON fields + if ((has_wkt_field) && (i == wkt_idx)) continue; + if ((has_json_field) && (i == json_idx)) continue; /* First we detect likely strings, then try parsing likely numbers, finally falling back to string type * We intentionally do not try to detect boolean or null types @@ -674,27 +672,31 @@ to assume are numbers) */ + bool matched = false; bool has_dot = value.find(".") != std::string::npos; if (value.empty() || (value_length > 20) || (value_length > 1 && !has_dot && value[0] == '0')) { + matched = true; feature->put(fld_name,tr.transcode(value.c_str())); if (feature_count == 1) { desc_.add_descriptor(mapnik::attribute_descriptor(fld_name,mapnik::String)); } } - else if ((value[0] >= '0' && value[0] <= '9') || value[0] == '-') + else if ((value[0] >= '0' && value[0] <= '9') || + value[0] == '-' || + value[0] == '+' || + value[0] == '.') { - double float_val = 0.0; - std::string::const_iterator str_beg = value.begin(); - std::string::const_iterator str_end = value.end(); - bool r = qi::phrase_parse(str_beg,str_end,qi::double_,ascii::space,float_val); - if (r && (str_beg == str_end)) + bool has_e = value.find("e") != std::string::npos; + if (has_dot || has_e) { - if (has_dot) + double float_val = 0.0; + if (mapnik::util::string2double(value,float_val)) { + matched = true; feature->put(fld_name,float_val); if (feature_count == 1) { @@ -703,9 +705,14 @@ fld_name,mapnik::Double)); } } - else + } + else + { + mapnik::value_integer int_val = 0; + if (mapnik::util::string2int(value,int_val)) { - feature->put(fld_name,static_cast(float_val)); + matched = true; + feature->put(fld_name,int_val); if (feature_count == 1) { desc_.add_descriptor( @@ -714,19 +721,8 @@ } } } - else - { - // fallback to normal string - feature->put(fld_name,tr.transcode(value.c_str())); - if (feature_count == 1) - { - desc_.add_descriptor( - mapnik::attribute_descriptor( - fld_name,mapnik::String)); - } - } } - else + if (!matched) { // fallback to normal string feature->put(fld_name,tr.transcode(value.c_str())); @@ -754,7 +750,6 @@ extent_.expand_to_include(feature->envelope()); } features_.push_back(feature); - ++feature_count; null_geom = false; } else @@ -782,7 +777,6 @@ pt->move_to(x,y); feature->add_geometry(pt); features_.push_back(feature); - ++feature_count; null_geom = false; if (!extent_initialized) { @@ -836,6 +830,9 @@ else { MAPNIK_LOG_ERROR(csv) << s.str(); + // with no geometry we will never + // add this feature so drop the count + feature_count--; continue; } } @@ -869,7 +866,7 @@ } } } - if (!feature_count > 0) + if (feature_count < 1) { MAPNIK_LOG_ERROR(csv) << "CSV Plugin: could not parse any lines of data"; } @@ -887,14 +884,11 @@ mapnik::box2d csv_datasource::envelope() const { - if (!is_bound_) bind(); - return extent_; } boost::optional csv_datasource::get_geometry_type() const { - if (! is_bound_) bind(); boost::optional result; int multi_type = 0; unsigned num_features = features_.size(); @@ -917,15 +911,11 @@ mapnik::layer_descriptor csv_datasource::get_descriptor() const { - if (!is_bound_) bind(); - return desc_; } mapnik::featureset_ptr csv_datasource::features(mapnik::query const& q) const { - if (!is_bound_) bind(); - const std::set& attribute_names = q.property_names(); std::set::const_iterator pos = attribute_names.begin(); while (pos != attribute_names.end()) @@ -939,25 +929,19 @@ break; } } - if (! found_name) { std::ostringstream s; - s << "CSV Plugin: no attribute '" << *pos << "'. Valid attributes are: " << boost::algorithm::join(headers_, ",") << "."; - throw mapnik::datasource_exception(s.str()); } ++pos; } - return boost::make_shared(q.get_bbox(),features_); } -mapnik::featureset_ptr csv_datasource::features_at_point(mapnik::coord2d const& pt) const +mapnik::featureset_ptr csv_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const { - if (!is_bound_) bind(); - throw mapnik::datasource_exception("CSV Plugin: features_at_point is not supported yet"); } diff -Nru mapnik-2.1.0/plugins/input/csv/csv_datasource.hpp mapnik-2.2.0/plugins/input/csv/csv_datasource.hpp --- mapnik-2.1.0/plugins/input/csv/csv_datasource.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/csv/csv_datasource.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -31,51 +31,51 @@ #include #include #include +#include // boost #include // stl #include +#include #include class csv_datasource : public mapnik::datasource { public: - csv_datasource(mapnik::parameters const& params, bool bind=true); + csv_datasource(mapnik::parameters const& params); virtual ~csv_datasource (); mapnik::datasource::datasource_t type() const; static const char * name(); mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; + mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; mapnik::box2d envelope() const; boost::optional get_geometry_type() const; mapnik::layer_descriptor get_descriptor() const; - void bind() const; template - void parse_csv(T& stream, + void parse_csv(T & stream, std::string const& escape, std::string const& separator, - std::string const& quote) const; + std::string const& quote); private: - mutable mapnik::layer_descriptor desc_; - mutable mapnik::box2d extent_; - mutable std::string filename_; - mutable std::string inline_string_; - mutable unsigned file_length_; - mutable int row_limit_; - mutable std::vector features_; - mutable std::string escape_; - mutable std::string separator_; - mutable std::string quote_; - mutable std::vector headers_; - mutable std::string manual_headers_; - mutable bool strict_; - mutable bool quiet_; - mutable double filesize_max_; - mutable mapnik::context_ptr ctx_; + mapnik::layer_descriptor desc_; + mapnik::box2d extent_; + std::string filename_; + std::string inline_string_; + unsigned file_length_; + mapnik::value_integer row_limit_; + std::deque features_; + std::string escape_; + std::string separator_; + std::string quote_; + std::vector headers_; + std::string manual_headers_; + bool strict_; + double filesize_max_; + mapnik::context_ptr ctx_; }; #endif // MAPNIK_CSV_DATASOURCE_HPP diff -Nru mapnik-2.1.0/plugins/input/csv/csv_utils.hpp mapnik-2.2.0/plugins/input/csv/csv_utils.hpp --- mapnik-2.1.0/plugins/input/csv/csv_utils.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/csv/csv_utils.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -29,7 +29,7 @@ namespace csv_utils { - static void fix_json_quoting(std::string & csv_line) + static inline void fix_json_quoting(std::string & csv_line) { std::string wrapping_char; std::string::size_type j_idx = std::string::npos; diff -Nru mapnik-2.1.0/plugins/input/gdal/build.py mapnik-2.2.0/plugins/input/gdal/build.py --- mapnik-2.1.0/plugins/input/gdal/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/gdal/build.py 2013-06-04 01:35:27.000000000 +0000 @@ -1,7 +1,7 @@ # # This file is part of Mapnik (c++ mapping toolkit) # -# Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon +# Copyright (C) 2013 Artem Pavlenko # # Mapnik is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,40 +17,55 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# Import ('plugin_base') Import ('env') +from copy import copy -prefix = env['PREFIX'] +PLUGIN_NAME = 'gdal' plugin_env = plugin_base.Clone() -gdal_src = Split( +plugin_sources = Split( """ - gdal_datasource.cpp - gdal_featureset.cpp - """ - ) - -# clear out and rebuild libs -plugin_env['LIBS'] = [env['PLUGINS']['gdal']['lib']] + %(PLUGIN_NAME)s_datasource.cpp + %(PLUGIN_NAME)s_featureset.cpp + """ % locals() +) -# Link Library to Dependencies -plugin_env['LIBS'].append('mapnik') -plugin_env['LIBS'].append('boost_system%s' % env['BOOST_APPEND']) -plugin_env['LIBS'].append(env['ICU_LIB_NAME']) +plugin_env['LIBS'] = [] if env['RUNTIME_LINK'] == 'static': cmd = 'gdal-config --dep-libs' plugin_env.ParseConfig(cmd) - plugin_env['LIBS'].append('proj') -input_plugin = plugin_env.SharedLibrary('../gdal', source=gdal_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LINKFLAGS=env['CUSTOM_LDFLAGS']) +# Link Library to Dependencies +plugin_env.Append(LIBS=env['PLUGINS']['gdal']['lib']) +libraries = copy(plugin_env['LIBS']) -# if the plugin links to libmapnik ensure it is built first -Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) +if env['PLUGIN_LINKING'] == 'shared': + libraries.append('mapnik') + libraries.append(env['ICU_LIB_NAME']) + libraries.append('boost_system%s' % env['BOOST_APPEND']) + + TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, + SHLIBPREFIX='', + SHLIBSUFFIX='.input', + source=plugin_sources, + LIBS=libraries, + LINKFLAGS=env['CUSTOM_LDFLAGS']) + + # if the plugin links to libmapnik ensure it is built first + Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + + if 'uninstall' not in COMMAND_LINE_TARGETS: + env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET) + env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) + +plugin_obj = { + 'LIBS': libraries, + 'SOURCES': plugin_sources, +} -if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin) - env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) +Return('plugin_obj') diff -Nru mapnik-2.1.0/plugins/input/gdal/gdal_datasource.cpp mapnik-2.2.0/plugins/input/gdal/gdal_datasource.cpp --- mapnik-2.1.0/plugins/input/gdal/gdal_datasource.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/gdal/gdal_datasource.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -73,20 +74,24 @@ } -gdal_datasource::gdal_datasource(parameters const& params, bool bind) +gdal_datasource::gdal_datasource(parameters const& params) : datasource(params), desc_(*params.get("type"), "utf-8"), - filter_factor_(*params_.get("filter_factor", 0.0)), - nodata_value_(params_.get("nodata")) + filter_factor_(*params.get("filter_factor", 0.0)), + nodata_value_(params.get("nodata")) { MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Initializing..."; +#ifdef MAPNIK_STATS + mapnik::progress_timer __stats__(std::clog, "gdal_datasource::init"); +#endif + GDALAllRegister(); boost::optional file = params.get("file"); if (! file) throw datasource_exception("missing parameter"); - boost::optional base = params_.get("base"); + boost::optional base = params.get("base"); if (base) { dataset_name_ = *base + "/" + *file; @@ -96,22 +101,8 @@ dataset_name_ = *file; } - if (bind) - { - this->bind(); - } -} - -void gdal_datasource::bind() const -{ - if (is_bound_) return; - -#ifdef MAPNIK_STATS - mapnik::progress_timer __stats__(std::clog, "gdal_datasource::bind"); -#endif - - shared_dataset_ = *params_.get("shared", false); - band_ = *params_.get("band", -1); + shared_dataset_ = *params.get("shared", false); + band_ = *params.get("band", -1); GDALDataset *dataset = open_dataset(); @@ -121,7 +112,7 @@ double tr[6]; bool bbox_override = false; - boost::optional bbox_s = params_.get("bbox"); + boost::optional bbox_s = params.get("extent"); if (bbox_s) { MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: BBox Parameter=" << *bbox_s; @@ -188,7 +179,6 @@ MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Raster Size=" << width_ << "," << height_; MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Raster Extent=" << extent_; - is_bound_ = true; } gdal_datasource::~gdal_datasource() @@ -207,8 +197,6 @@ box2d gdal_datasource::envelope() const { - if (! is_bound_) bind(); - return extent_; } @@ -224,8 +212,6 @@ featureset_ptr gdal_datasource::features(query const& q) const { - if (! is_bound_) bind(); - #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "gdal_datasource::features"); #endif @@ -246,10 +232,8 @@ nodata_value_)); } -featureset_ptr gdal_datasource::features_at_point(coord2d const& pt) const +featureset_ptr gdal_datasource::features_at_point(coord2d const& pt, double tol) const { - if (! is_bound_) bind(); - #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "gdal_datasource::features_at_point"); #endif diff -Nru mapnik-2.1.0/plugins/input/gdal/gdal_datasource.hpp mapnik-2.2.0/plugins/input/gdal/gdal_datasource.hpp --- mapnik-2.1.0/plugins/input/gdal/gdal_datasource.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/gdal/gdal_datasource.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -45,28 +45,27 @@ class gdal_datasource : public mapnik::datasource { public: - gdal_datasource(mapnik::parameters const& params, bool bind = true); + gdal_datasource(mapnik::parameters const& params); virtual ~gdal_datasource(); mapnik::datasource::datasource_t type() const; static const char * name(); mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; + mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; mapnik::box2d envelope() const; boost::optional get_geometry_type() const; mapnik::layer_descriptor get_descriptor() const; - void bind() const; private: GDALDataset* open_dataset() const; - mutable mapnik::box2d extent_; + mapnik::box2d extent_; std::string dataset_name_; - mutable int band_; + int band_; mapnik::layer_descriptor desc_; - mutable unsigned width_; - mutable unsigned height_; - mutable double dx_; - mutable double dy_; - mutable int nbands_; - mutable bool shared_dataset_; + unsigned width_; + unsigned height_; + double dx_; + double dy_; + int nbands_; + bool shared_dataset_; double filter_factor_; boost::optional nodata_value_; }; diff -Nru mapnik-2.1.0/plugins/input/gdal/gdal_featureset.cpp mapnik-2.2.0/plugins/input/gdal/gdal_featureset.cpp --- mapnik-2.1.0/plugins/input/gdal/gdal_featureset.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/gdal/gdal_featureset.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,11 +23,18 @@ // mapnik #include #include +#include +#include #include +#include #include // boost #include +#include + +// stl +#include #include "gdal_featureset.hpp" #include @@ -35,7 +42,6 @@ using mapnik::query; using mapnik::coord2d; using mapnik::box2d; -using mapnik::Feature; using mapnik::feature_ptr; using mapnik::CoordTransform; using mapnik::geometry_type; @@ -134,8 +140,8 @@ box2d box = t.forward(intersect); //size of resized output pixel in source image domain - double margin_x = 1.0 / (fabs(dx_) * boost::get<0>(q.resolution())); - double margin_y = 1.0 / (fabs(dy_) * boost::get<1>(q.resolution())); + double margin_x = 1.0 / (std::fabs(dx_) * boost::get<0>(q.resolution())); + double margin_y = 1.0 / (std::fabs(dy_) * boost::get<1>(q.resolution())); if (margin_x < 1) { margin_x = 1.0; @@ -200,8 +206,8 @@ // if layer-level filter_factor is set, apply it if (filter_factor_) { - im_width *= filter_factor_; - im_height *= filter_factor_; + im_width = int(im_width * filter_factor_ + 0.5); + im_height = int(im_height * filter_factor_ + 0.5); MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Applying layer filter_factor=" << filter_factor_; } @@ -209,8 +215,8 @@ else { double sym_downsample_factor = q.get_filter_factor(); - im_width *= sym_downsample_factor; - im_height *= sym_downsample_factor; + im_width = int(im_width * sym_downsample_factor + 0.5); + im_height = int(im_height * sym_downsample_factor + 0.5); } // case where we need to avoid upsampling so that the @@ -223,14 +229,14 @@ if (im_width > 0 && im_height > 0) { - mapnik::image_data_32 image(im_width, im_height); + mapnik::raster_ptr raster = boost::make_shared(intersect, im_width, im_height); + feature->set_raster(raster); + mapnik::image_data_32 & image = raster->data_; image.set(0xffffffff); MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Image Size=(" << im_width << "," << im_height << ")"; MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Reading band=" << band_; - typedef std::vector pallete; - if (band_ > 0) // we are querying a single band { if (band_ > nbands_) @@ -255,7 +261,6 @@ imageData, image.width(), image.height(), GDT_Float32, 0, 0); - feature->set_raster(boost::make_shared(intersect,image)); if (hasNoData) { feature->put("NODATA",nodata); @@ -446,10 +451,10 @@ { MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Loading colour table..."; - unsigned nodata_value = static_cast(nodata); + unsigned nodata_value = static_cast(std::floor(nodata+.5)); // FIXME: is it realy unsigned ? if (hasNoData) { - feature->put("NODATA",static_cast(nodata_value)); + feature->put("NODATA",static_cast(nodata_value)); } for (unsigned y = 0; y < image.height(); ++y) { @@ -488,8 +493,6 @@ alpha->RasterIO(GF_Read, x_off, y_off, width, height, image.getBytes() + 3, image.width(), image.height(), GDT_Byte, 4, 4 * image.width()); } - - feature->set_raster(mapnik::raster_ptr(new mapnik::raster(intersect, image))); } return feature; } diff -Nru mapnik-2.1.0/plugins/input/gdal/gdal_featureset.hpp mapnik-2.2.0/plugins/input/gdal/gdal_featureset.hpp --- mapnik-2.1.0/plugins/input/gdal/gdal_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/gdal/gdal_featureset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,7 +25,6 @@ // mapnik #include -#include // boost #include diff -Nru mapnik-2.1.0/plugins/input/geojson/build.py mapnik-2.2.0/plugins/input/geojson/build.py --- mapnik-2.1.0/plugins/input/geojson/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/geojson/build.py 2013-06-04 01:35:27.000000000 +0000 @@ -1,7 +1,7 @@ # # This file is part of Mapnik (c++ mapping toolkit) # -# Copyright (C) 2012 Artem Pavlenko +# Copyright (C) 2013 Artem Pavlenko # # Mapnik is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,7 +17,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # - +# Import ('env') @@ -32,27 +32,45 @@ print 'WARNING: skipping building the optional geojson datasource plugin which requires boost >= 1.47' else: Import ('plugin_base') - prefix = env['PREFIX'] + + PLUGIN_NAME = 'geojson' + plugin_env = plugin_base.Clone() - geojson_src = Split( - """ - geojson_datasource.cpp - geojson_featureset.cpp + + plugin_sources = Split( """ - ) - libraries = [] + %(PLUGIN_NAME)s_datasource.cpp + %(PLUGIN_NAME)s_featureset.cpp + """ % locals() + ) + # Link Library to Dependencies - libraries.append('mapnik') + libraries = [] libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) if env['THREADING'] == 'multi': libraries.append('boost_thread%s' % env['BOOST_APPEND']) - input_plugin = plugin_env.SharedLibrary('../geojson', source=geojson_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) + if env['PLUGIN_LINKING'] == 'shared': + libraries.append('mapnik') - # if the plugin links to libmapnik ensure it is built first - Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, + SHLIBPREFIX='', + SHLIBSUFFIX='.input', + source=plugin_sources, + LIBS=libraries, + LINKFLAGS=env['CUSTOM_LDFLAGS']) + + # if the plugin links to libmapnik ensure it is built first + Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + + if 'uninstall' not in COMMAND_LINE_TARGETS: + env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET) + env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) + + plugin_obj = { + 'LIBS': libraries, + 'SOURCES': plugin_sources, + } - if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin) - env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) + Return('plugin_obj') diff -Nru mapnik-2.1.0/plugins/input/geojson/geojson_datasource.cpp mapnik-2.2.0/plugins/input/geojson/geojson_datasource.cpp --- mapnik-2.1.0/plugins/input/geojson/geojson_datasource.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/geojson/geojson_datasource.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,7 +24,6 @@ #include "geojson_featureset.hpp" #include -#include #include // boost @@ -37,11 +36,17 @@ #include #include #include + // mapnik +#include +#include +#include +#include #include #include #include #include +#include #include using mapnik::datasource; @@ -49,27 +54,9 @@ DATASOURCE_PLUGIN(geojson_datasource) -geojson_datasource::geojson_datasource(parameters const& params, bool bind) -: datasource(params), - type_(datasource::Vector), - desc_(*params_.get("type"), - *params_.get("encoding","utf-8")), - file_(*params_.get("file","")), - extent_(), - tr_(new mapnik::transcoder(*params_.get("encoding","utf-8"))), - features_(), - tree_(16,1) -{ - if (file_.empty()) throw mapnik::datasource_exception("GeoJSON Plugin: missing parameter"); - if (bind) - { - this->bind(); - } -} - struct attr_value_converter : public boost::static_visitor { - mapnik::eAttributeType operator() (int /*val*/) const + mapnik::eAttributeType operator() (mapnik::value_integer /*val*/) const { return mapnik::Integer; } @@ -105,52 +92,74 @@ } }; -void geojson_datasource::bind() const +geojson_datasource::geojson_datasource(parameters const& params) +: datasource(params), + type_(datasource::Vector), + desc_(*params.get("type"), + *params.get("encoding","utf-8")), + file_(*params.get("file","")), + extent_(), + tr_(new mapnik::transcoder(*params.get("encoding","utf-8"))), + features_(), + tree_(16,1) { - if (is_bound_) return; + if (file_.empty()) throw mapnik::datasource_exception("GeoJSON Plugin: missing parameter"); - typedef std::istreambuf_iterator base_iterator_type; - - std::ifstream is(file_.c_str()); - boost::spirit::multi_pass begin = + boost::optional base = params.get("base"); + if (base) + { + file_ = *base + "/" + file_; + } + + typedef std::istreambuf_iterator base_iterator_type; + +#if defined (_WINDOWS) + std::ifstream is(mapnik::utf8_to_utf16(file_),std::ios_base::in | std::ios_base::binary); +#else + std::ifstream is(file_.c_str(),std::ios_base::in | std::ios_base::binary); +#endif + if (!is.is_open()) + { + throw mapnik::datasource_exception("GeoJSON Plugin: could not open: '" + file_ + "'"); + } + + boost::spirit::multi_pass begin = boost::spirit::make_default_multi_pass(base_iterator_type(is)); - boost::spirit::multi_pass end = + boost::spirit::multi_pass end = boost::spirit::make_default_multi_pass(base_iterator_type()); - + mapnik::context_ptr ctx = boost::make_shared(); mapnik::json::feature_collection_parser > p(ctx,*tr_); bool result = p.parse(begin,end, features_); - if (!result) + if (!result) { - MAPNIK_LOG_WARN(geojson) << "geojson_datasource: Failed parse GeoJSON file " << file_; - return; + throw mapnik::datasource_exception("geojson_datasource: Failed parse GeoJSON file '" + file_ + "'"); } - + bool first = true; std::size_t count=0; BOOST_FOREACH (mapnik::feature_ptr f, features_) { mapnik::box2d const& box = f->envelope(); - if (first) + if (first) { extent_ = box; first = false; - mapnik::feature_kv_iterator itr = f->begin(); - mapnik::feature_kv_iterator end = f->end(); - for ( ;itr!=end; ++itr) + mapnik::feature_kv_iterator f_itr = f->begin(); + mapnik::feature_kv_iterator f_end = f->end(); + for ( ;f_itr!=f_end; ++f_itr) { - desc_.add_descriptor(mapnik::attribute_descriptor(boost::get<0>(*itr), - boost::apply_visitor(attr_value_converter(),boost::get<1>(*itr).base()))); + desc_.add_descriptor(mapnik::attribute_descriptor(boost::get<0>(*f_itr), + boost::apply_visitor(attr_value_converter(),boost::get<1>(*f_itr).base()))); } } else { extent_.expand_to_include(box); - } + } tree_.insert(box_type(point_type(box.minx(),box.miny()),point_type(box.maxx(),box.maxy())), count++); } - is_bound_ = true; } geojson_datasource::~geojson_datasource() { } @@ -160,33 +169,45 @@ return "geojson"; } -boost::optional geojson_datasource::get_geometry_type() const +boost::optional geojson_datasource::get_geometry_type() const { - return boost::optional(); + boost::optional result; + int multi_type = 0; + unsigned num_features = features_.size(); + for (unsigned i = 0; i < num_features && i < 5; ++i) + { + mapnik::util::to_ds_type(features_[i]->paths(),result); + if (result) + { + int type = static_cast(*result); + if (multi_type > 0 && multi_type != type) + { + result.reset(mapnik::datasource::Collection); + return result; + } + multi_type = type; + } + } + return result; } -mapnik::datasource::datasource_t geojson_datasource::type() const +mapnik::datasource::datasource_t geojson_datasource::type() const { return type_; } mapnik::box2d geojson_datasource::envelope() const { - if (!is_bound_) bind(); return extent_; } mapnik::layer_descriptor geojson_datasource::get_descriptor() const { - if (!is_bound_) bind(); - return desc_; } mapnik::featureset_ptr geojson_datasource::features(mapnik::query const& q) const { - if (!is_bound_) bind(); - // if the query box intersects our world extent then query for features mapnik::box2d const& b = q.get_bbox(); if (extent_.intersects(b)) @@ -194,14 +215,22 @@ box_type box(point_type(b.minx(),b.miny()),point_type(b.maxx(),b.maxy())); index_array_ = tree_.find(box); return boost::make_shared(features_, index_array_.begin(), index_array_.end()); - } + } // otherwise return an empty featureset pointer return mapnik::featureset_ptr(); } -// FIXME -mapnik::featureset_ptr geojson_datasource::features_at_point(mapnik::coord2d const& pt) const +mapnik::featureset_ptr geojson_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const { - if (!is_bound_) bind(); - return mapnik::featureset_ptr(); + mapnik::box2d query_bbox(pt, pt); + query_bbox.pad(tol); + mapnik::query q(query_bbox); + std::vector const& desc = desc_.get_descriptors(); + std::vector::const_iterator itr = desc.begin(); + std::vector::const_iterator end = desc.end(); + for ( ;itr!=end;++itr) + { + q.add_property_name(itr->get_name()); + } + return features(q); } diff -Nru mapnik-2.1.0/plugins/input/geojson/geojson_datasource.hpp mapnik-2.2.0/plugins/input/geojson/geojson_datasource.hpp --- mapnik-2.1.0/plugins/input/geojson/geojson_datasource.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/geojson/geojson_datasource.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -31,6 +31,7 @@ #include #include #include +#include // boost #include @@ -38,7 +39,6 @@ #include #include #include -#include #include #include @@ -56,25 +56,24 @@ typedef boost::geometry::index::rtree spatial_index_type; // constructor - geojson_datasource(mapnik::parameters const& params, bool bind=true); + geojson_datasource(mapnik::parameters const& params); virtual ~geojson_datasource (); mapnik::datasource::datasource_t type() const; static const char * name(); mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; + mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; mapnik::box2d envelope() const; mapnik::layer_descriptor get_descriptor() const; boost::optional get_geometry_type() const; - void bind() const; private: mapnik::datasource::datasource_t type_; - mutable std::map statistics_; - mutable mapnik::layer_descriptor desc_; - mutable std::string file_; - mutable mapnik::box2d extent_; + std::map statistics_; + mapnik::layer_descriptor desc_; + std::string file_; + mapnik::box2d extent_; boost::shared_ptr tr_; - mutable std::vector features_; - mutable spatial_index_type tree_; + std::vector features_; + spatial_index_type tree_; mutable std::deque index_array_; }; diff -Nru mapnik-2.1.0/plugins/input/geojson/geojson_featureset.hpp mapnik-2.2.0/plugins/input/geojson/geojson_featureset.hpp --- mapnik-2.1.0/plugins/input/geojson/geojson_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/geojson/geojson_featureset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -1,7 +1,7 @@ #ifndef GEOJSON_FEATURESET_HPP #define GEOJSON_FEATURESET_HPP -#include +#include #include "geojson_datasource.hpp" #include diff -Nru mapnik-2.1.0/plugins/input/geos/build.py mapnik-2.2.0/plugins/input/geos/build.py --- mapnik-2.1.0/plugins/input/geos/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/geos/build.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -# -# This file is part of Mapnik (c++ mapping toolkit) -# -# Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon -# -# Mapnik is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# $Id$ - - -Import ('plugin_base') -Import ('env') - -prefix = env['PREFIX'] - -plugin_env = plugin_base.Clone() - -geos_src = Split( - """ - geos_datasource.cpp - geos_featureset.cpp - """ - ) - -libraries = [env['PLUGINS']['geos']['lib']] - -# Link Library to Dependencies -libraries.append('mapnik') -libraries.append(env['ICU_LIB_NAME']) -libraries.append('boost_system%s' % env['BOOST_APPEND']) -libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) - -input_plugin = plugin_env.SharedLibrary('../geos', source=geos_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) - -# if the plugin links to libmapnik ensure it is built first -Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) - -if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin) - env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) diff -Nru mapnik-2.1.0/plugins/input/geos/geos_datasource.cpp mapnik-2.2.0/plugins/input/geos/geos_datasource.cpp --- mapnik-2.1.0/plugins/input/geos/geos_datasource.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/geos/geos_datasource.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,337 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#include "geos_datasource.hpp" -#include "geos_featureset.hpp" - -// stl -#include -#include -#include -#include - -// mapnik -#include -#include -#include -#include - -// boost -#include -#include -#include -#include -#include - -// geos -#include - -using mapnik::box2d; -using mapnik::coord2d; -using mapnik::query; -using mapnik::featureset_ptr; -using mapnik::layer_descriptor; -using mapnik::attribute_descriptor; -using mapnik::datasource_exception; -using mapnik::datasource; -using mapnik::parameters; -using mapnik::filter_in_box; -using mapnik::filter_at_point; - -DATASOURCE_PLUGIN(geos_datasource) - -void geos_notice(const char* format, ...) -{ -#ifdef MAPNIK_LOG - char buffer[512]; - va_list args; - va_start(args, format); - vsnprintf(buffer, 512, format, args); - va_end(args); - - MAPNIK_LOG_WARN(geos) << "geos_datasource: " << buffer; -#endif -} - -void geos_error(const char* format, ...) -{ -#ifdef MAPNIK_LOG - char buffer[512]; - va_list args; - va_start(args, format); - vsnprintf(buffer, 512, format, args); - va_end(args); - - MAPNIK_LOG_ERROR(geos) << "geos_datasource: " << buffer; -#endif -} - - -geos_datasource::geos_datasource(parameters const& params, bool bind) - : datasource(params), - extent_(), - extent_initialized_(false), - type_(datasource::Vector), - desc_(*params.get("type"), *params.get("encoding", "utf-8")), - geometry_data_(""), - geometry_data_name_("name"), - geometry_id_(1) -{ - boost::optional geometry = params.get("wkt"); - if (! geometry) throw datasource_exception("missing parameter"); - geometry_string_ = *geometry; - - boost::optional ext = params_.get("extent"); - if (ext) extent_initialized_ = extent_.from_string(*ext); - - boost::optional id = params_.get("gid"); - if (id) geometry_id_ = *id; - - boost::optional gdata = params_.get("field_data"); - if (gdata) geometry_data_ = *gdata; - - boost::optional gdata_name = params_.get("field_name"); - if (gdata_name) geometry_data_name_ = *gdata_name; - - desc_.add_descriptor(attribute_descriptor(geometry_data_name_, mapnik::String)); - - if (bind) - { - this->bind(); - } -} - -geos_datasource::~geos_datasource() -{ - if (is_bound_) - { - geometry_.set_feature(0); - - finishGEOS(); - } -} - -void geos_datasource::bind() const -{ - if (is_bound_) return; - -#ifdef MAPNIK_STATS - mapnik::progress_timer __stats__(std::clog, "geos_datasource::bind"); -#endif - - // open geos driver - initGEOS(geos_notice, geos_error); - - // parse the string into geometry - geometry_.set_feature(GEOSGeomFromWKT(geometry_string_.c_str())); - if (*geometry_ == NULL || ! GEOSisValid(*geometry_)) - { - throw datasource_exception("GEOS Plugin: invalid geometry specified"); - } - - // try to obtain the extent from the geometry itself - if (! extent_initialized_) - { -#ifdef MAPNIK_STATS - mapnik::progress_timer __stats2__(std::clog, "geos_datasource::bind(initialize_extent)"); -#endif - - MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Initializing extent from geometry"; - - if (GEOSGeomTypeId(*geometry_) == GEOS_POINT) - { - double x, y; - unsigned int size; - - const GEOSCoordSequence* cs = GEOSGeom_getCoordSeq(*geometry_); - - GEOSCoordSeq_getSize(cs, &size); - GEOSCoordSeq_getX(cs, 0, &x); - GEOSCoordSeq_getY(cs, 0, &y); - - extent_.init(x, y, x, y); - extent_initialized_ = true; - } - else - { - geos_feature_ptr envelope (GEOSEnvelope(*geometry_)); - if (*envelope != NULL && GEOSisValid(*envelope)) - { -#ifdef MAPNIK_LOG - char* wkt = GEOSGeomToWKT(*envelope); - MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Getting coord sequence from=" << wkt; - GEOSFree(wkt); -#endif - - const GEOSGeometry* exterior = GEOSGetExteriorRing(*envelope); - if (exterior != NULL && GEOSisValid(exterior)) - { - const GEOSCoordSequence* cs = GEOSGeom_getCoordSeq(exterior); - if (cs != NULL) - { - MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Iterating boundary points"; - - double x, y; - double minx = std::numeric_limits::max(), - miny = std::numeric_limits::max(), - maxx = -std::numeric_limits::max(), - maxy = -std::numeric_limits::max(); - - unsigned int num_points; - GEOSCoordSeq_getSize(cs, &num_points); - - for (unsigned int i = 0; i < num_points; ++i) - { - GEOSCoordSeq_getX(cs, i, &x); - GEOSCoordSeq_getY(cs, i, &y); - - if (x < minx) minx = x; - if (x > maxx) maxx = x; - if (y < miny) miny = y; - if (y > maxy) maxy = y; - } - - extent_.init(minx, miny, maxx, maxy); - extent_initialized_ = true; - } - } - } - } - } - - if (! extent_initialized_) - { - throw datasource_exception("GEOS Plugin: cannot determine extent for geometry"); - } - - is_bound_ = true; -} - -const char * geos_datasource::name() -{ - return "geos"; -} - -mapnik::datasource::datasource_t geos_datasource::type() const -{ - return type_; -} - -box2d geos_datasource::envelope() const -{ - if (! is_bound_) bind(); - - return extent_; -} - -boost::optional geos_datasource::get_geometry_type() const -{ - if (! is_bound_) bind(); - boost::optional result; - -#ifdef MAPNIK_STATS - mapnik::progress_timer __stats__(std::clog, "geos_datasource::get_geometry_type"); -#endif - - // get geometry type - const int type = GEOSGeomTypeId(*geometry_); - switch (type) - { - case GEOS_POINT: - case GEOS_MULTIPOINT: - result.reset(mapnik::datasource::Point); - break; - case GEOS_LINESTRING: - case GEOS_LINEARRING: - case GEOS_MULTILINESTRING: - result.reset(mapnik::datasource::LineString); - break; - case GEOS_POLYGON: - case GEOS_MULTIPOLYGON: - result.reset(mapnik::datasource::Polygon); - break; - case GEOS_GEOMETRYCOLLECTION: - result.reset(mapnik::datasource::Collection); - break; - default: - break; - } - - return result; -} - -layer_descriptor geos_datasource::get_descriptor() const -{ - if (! is_bound_) bind(); - - return desc_; -} - -featureset_ptr geos_datasource::features(query const& q) const -{ - if (! is_bound_) bind(); - -#ifdef MAPNIK_STATS - mapnik::progress_timer __stats__(std::clog, "geos_datasource::features"); -#endif - - const mapnik::box2d extent = q.get_bbox(); - - std::ostringstream s; - s << "POLYGON((" - << extent.minx() << " " << extent.miny() << "," - << extent.maxx() << " " << extent.miny() << "," - << extent.maxx() << " " << extent.maxy() << "," - << extent.minx() << " " << extent.maxy() << "," - << extent.minx() << " " << extent.miny() - << "))"; - - MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Using extent=" << s.str(); - - return boost::make_shared(*geometry_, - GEOSGeomFromWKT(s.str().c_str()), - geometry_id_, - geometry_data_, - geometry_data_name_, - desc_.get_encoding()); -} - -featureset_ptr geos_datasource::features_at_point(coord2d const& pt) const -{ - if (! is_bound_) bind(); - -#ifdef MAPNIK_STATS - mapnik::progress_timer __stats__(std::clog, "geos_datasource::features_at_point"); -#endif - - std::ostringstream s; - s << "POINT(" << pt.x << " " << pt.y << ")"; - - MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Using point=" << s.str(); - - return boost::make_shared(*geometry_, - GEOSGeomFromWKT(s.str().c_str()), - geometry_id_, - geometry_data_, - geometry_data_name_, - desc_.get_encoding()); -} diff -Nru mapnik-2.1.0/plugins/input/geos/geos_datasource.hpp mapnik-2.2.0/plugins/input/geos/geos_datasource.hpp --- mapnik-2.1.0/plugins/input/geos/geos_datasource.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/geos/geos_datasource.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef GEOS_DATASOURCE_HPP -#define GEOS_DATASOURCE_HPP - -// mapnik -#include -#include -#include -#include -#include -#include -#include - -// boost -#include -#include - -// stl -#include -#include - -#include "geos_feature_ptr.hpp" - -class geos_datasource : public mapnik::datasource -{ -public: - geos_datasource(mapnik::parameters const& params, bool bind = true); - virtual ~geos_datasource (); - mapnik::datasource::datasource_t type() const; - static const char * name(); - mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; - mapnik::box2d envelope() const; - boost::optional get_geometry_type() const; - mapnik::layer_descriptor get_descriptor() const; - void bind() const; - -private: - mutable mapnik::box2d extent_; - mutable bool extent_initialized_; - mapnik::datasource::datasource_t type_; - mutable mapnik::layer_descriptor desc_; - mutable geos_feature_ptr geometry_; - mutable std::string geometry_data_; - mutable std::string geometry_data_name_; - mutable int geometry_id_; - std::string geometry_string_; -}; - -#endif // GEOS_DATASOURCE_HPP diff -Nru mapnik-2.1.0/plugins/input/geos/geos_feature_ptr.hpp mapnik-2.2.0/plugins/input/geos/geos_feature_ptr.hpp --- mapnik-2.1.0/plugins/input/geos/geos_feature_ptr.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/geos/geos_feature_ptr.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,109 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ -//$Id$ - -#ifndef GEOS_FEATURE_PTR_HPP -#define GEOS_FEATURE_PTR_HPP - -// geos -#include -#include - -class geos_feature_ptr -{ -public: - geos_feature_ptr () - : feat_ (NULL) - { - } - - explicit geos_feature_ptr (GEOSGeometry* const feat) - : feat_ (feat) - { - } - - ~geos_feature_ptr () - { - if (feat_ != NULL) - GEOSGeom_destroy(feat_); - } - - void set_feature (GEOSGeometry* const feat) - { - if (feat_ != NULL) - GEOSGeom_destroy(feat_); - - feat_ = feat; - } - - GEOSGeometry* operator*() - { - return feat_; - } - -private: - GEOSGeometry* feat_; -}; - - -class geos_wkb_ptr -{ -public: - geos_wkb_ptr (GEOSGeometry* const geometry) - : data_ (NULL), - size_ (0) - { - data_ = GEOSGeomToWKB_buf(geometry, &size_); - } - - ~geos_wkb_ptr () - { - if (data_ != NULL) - { - // We use std::free here instead of GEOSFree(data_) to support geos 3.1.0 - std::free(data_); - } - } - - bool is_valid() const - { - return (data_ != NULL) && (size_ > 0); - } - - unsigned int size() const - { - return (unsigned int) size_; - } - - const char* data() - { - return reinterpret_cast(data_); - } - -private: - unsigned char* data_; - size_t size_; -}; - - -#endif // GEOS_FEATURE_PTR_HPP - diff -Nru mapnik-2.1.0/plugins/input/geos/geos_featureset.cpp mapnik-2.2.0/plugins/input/geos/geos_featureset.cpp --- mapnik-2.1.0/plugins/input/geos/geos_featureset.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/geos/geos_featureset.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,132 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// stl -#include -#include - -// mapnik -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "geos_featureset.hpp" - -using mapnik::query; -using mapnik::box2d; -using mapnik::Feature; -using mapnik::feature_ptr; -using mapnik::geometry_utils; -using mapnik::transcoder; -using mapnik::feature_factory; - -geos_featureset::geos_featureset(GEOSGeometry* geometry, - GEOSGeometry* extent, - int identifier, - const std::string& field, - const std::string& field_name, - const std::string& encoding) - : geometry_(geometry), - tr_(new transcoder(encoding)), - extent_(extent), - identifier_(identifier), - field_(field), - field_name_(field_name), - already_rendered_(false), - ctx_(boost::make_shared()) -{ - ctx_->push(field_name); -} - -geos_featureset::~geos_featureset() -{ -} - -feature_ptr geos_featureset::next() -{ - if (! already_rendered_) - { - already_rendered_ = true; - - if (GEOSisValid(geometry_) && ! GEOSisEmpty(geometry_)) - { - bool render_geometry = true; - - if (*extent_ != NULL && GEOSisValid(*extent_) && ! GEOSisEmpty(*extent_)) - { - const int type = GEOSGeomTypeId(*extent_); - render_geometry = false; - - switch (type) - { - case GEOS_POINT: - if (GEOSIntersects(*extent_, geometry_)) - { - render_geometry = true; - } - break; - - case GEOS_POLYGON: - if (GEOSContains(*extent_, geometry_) - || GEOSWithin(geometry_, *extent_) - || GEOSEquals(geometry_, *extent_)) - { - render_geometry = true; - } - break; - - default: - MAPNIK_LOG_DEBUG(geos) << "geos_featureset: Unknown extent geometry_type=" << type; - break; - } - } - - if (render_geometry) - { - geos_wkb_ptr wkb(geometry_); - if (wkb.is_valid()) - { - feature_ptr feature(feature_factory::create(ctx_,identifier_)); - - if (geometry_utils::from_wkb(feature->paths(), - wkb.data(), - wkb.size()) - && field_ != "") - { - feature->put(field_name_, tr_->transcode(field_.c_str())); - } - - return feature; - } - } - } - } - - return feature_ptr(); -} diff -Nru mapnik-2.1.0/plugins/input/geos/geos_featureset.hpp mapnik-2.2.0/plugins/input/geos/geos_featureset.hpp --- mapnik-2.1.0/plugins/input/geos/geos_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/geos/geos_featureset.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef GEOS_FEATURESET_HPP -#define GEOS_FEATURESET_HPP - -// mapnik -#include -#include -#include - -// boost -#include - -// geos -#include - -#include "geos_feature_ptr.hpp" - -class geos_featureset : public mapnik::Featureset -{ -public: - geos_featureset(GEOSGeometry* geometry, - GEOSGeometry* extent, - int identifier, - const std::string& field, - const std::string& field_name, - const std::string& encoding); - virtual ~geos_featureset(); - mapnik::feature_ptr next(); - -private: - GEOSGeometry* geometry_; - boost::scoped_ptr tr_; - geos_feature_ptr extent_; - int identifier_; - std::string field_; - std::string field_name_; - bool already_rendered_; - mapnik::context_ptr ctx_; - - geos_featureset(const geos_featureset&); - const geos_featureset& operator=(const geos_featureset&); -}; - -#endif // GEOS_FEATURESET_HPP diff -Nru mapnik-2.1.0/plugins/input/kismet/build.py mapnik-2.2.0/plugins/input/kismet/build.py --- mapnik-2.1.0/plugins/input/kismet/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/kismet/build.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -# -# This file is part of Mapnik (c++ mapping toolkit) -# -# Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon -# -# Mapnik is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# $Id$ - -Import ('plugin_base') -Import ('env') - -prefix = env['PREFIX'] - -plugin_env = plugin_base.Clone() - -kismet_src = Split( - """ - kismet_datasource.cpp - kismet_featureset.cpp - """ - ) - -libraries = [] -# Link Library to Dependencies -libraries.append('mapnik') -libraries.append(env['ICU_LIB_NAME']) -libraries.append('boost_system%s' % env['BOOST_APPEND']) -if env['THREADING'] == 'multi': - libraries.append('boost_thread%s' % env['BOOST_APPEND']) - -input_plugin = plugin_env.SharedLibrary('../kismet', source=kismet_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) - -# if the plugin links to libmapnik ensure it is built first -Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) - -if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin) - env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) diff -Nru mapnik-2.1.0/plugins/input/kismet/kismet_datasource.cpp mapnik-2.2.0/plugins/input/kismet/kismet_datasource.cpp --- mapnik-2.1.0/plugins/input/kismet/kismet_datasource.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/kismet/kismet_datasource.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,308 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// network -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// mapnik -#include -#include - -// boost -#include -#include -#include -#include - -#include "kismet_datasource.hpp" -#include "kismet_featureset.hpp" - -#define MAX_TCP_BUFFER 4096 // maximum accepted TCP data block size - -// If you change this also change the according kismet command length ! -#define MAX_KISMET_LINE 1024 // maximum length of a kismet command (assumed) -#define KISMET_COMMAND "*NETWORK: \001%1024[^\001]\001 %1024s %d %lf %lf" - -using mapnik::datasource; -using mapnik::parameters; - -DATASOURCE_PLUGIN(kismet_datasource) - -using mapnik::box2d; -using mapnik::coord2d; -using mapnik::query; -using mapnik::featureset_ptr; -using mapnik::layer_descriptor; -using mapnik::attribute_descriptor; -using mapnik::datasource_exception; - -boost::mutex knd_list_mutex; -std::list knd_list; -const unsigned int queue_size = 20; - -kismet_datasource::kismet_datasource(parameters const& params, bool bind) - : datasource(params), - extent_(), - extent_initialized_(false), - type_(datasource::Vector), - srs_("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"), - desc_(*params.get("type"), *params.get("encoding","utf-8")) -{ - boost::optional host = params_.get("host"); - if (host) - { - host_ = *host; - } - else - { - throw datasource_exception("Kismet Plugin: missing parameter"); - } - - boost::optional port = params_.get("port", 2501); - if (port) - { - port_ = *port; - } - - boost::optional srs = params_.get("srs"); - if (srs) - { - srs_ = *srs; - } - - boost::optional ext = params_.get("extent"); - if (ext) - { - extent_initialized_ = extent_.from_string(*ext); - } - - kismet_thread.reset(new boost::thread(boost::bind(&kismet_datasource::run, this, host_, port_))); - - if (bind) - { - this->bind(); - } -} - -void kismet_datasource::bind() const -{ - if (is_bound_) return; - - is_bound_ = true; -} - -kismet_datasource::~kismet_datasource() -{ -} - -const char * kismet_datasource::name() -{ - return "kismet"; -} - -mapnik::datasource::datasource_t kismet_datasource::type() const -{ - return type_; -} - -box2d kismet_datasource::envelope() const -{ - if (! is_bound_) bind(); - return extent_; -} - -boost::optional kismet_datasource::get_geometry_type() const -{ - return boost::optional(mapnik::datasource::Point); -} - -layer_descriptor kismet_datasource::get_descriptor() const -{ - return desc_; -} - -featureset_ptr kismet_datasource::features(query const& q) const -{ - if (! is_bound_) bind(); - - MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource::features()"; - - // TODO: use box2d to filter bbox before adding to featureset_ptr - // mapnik::box2d const& e = q.get_bbox(); - - boost::mutex::scoped_lock lock(knd_list_mutex); - return boost::make_shared(knd_list, - srs_, - desc_.get_encoding()); - - // TODO: if illegal: - // return featureset_ptr(); -} - -featureset_ptr kismet_datasource::features_at_point(coord2d const& pt) const -{ - if (! is_bound_) bind(); - - MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource::features_at_point()"; - - return featureset_ptr(); -} - -void kismet_datasource::run(const std::string& ip_host, const unsigned int port) -{ - MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: Enter run"; - - int sockfd, n; - struct sockaddr_in sock_addr; - struct in_addr inadr; - struct hostent* host; - char buffer[MAX_TCP_BUFFER]; // TCP data send from kismet_server - std::string command; - - if (inet_aton(ip_host.c_str(), &inadr)) - { - host = gethostbyaddr((char*)&inadr, sizeof(inadr), AF_INET); - } - else - { - host = gethostbyname(ip_host.c_str()); - } - - if (host == NULL) - { - MAPNIK_LOG_ERROR(kismet) << "Kismet Plugin: error while searching host"; - return; - } - - sock_addr.sin_family = AF_INET; - sock_addr.sin_port = htons(port); - memcpy(&sock_addr.sin_addr, host->h_addr_list[0], sizeof(sock_addr.sin_addr)); - - if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) < 0) - { - MAPNIK_LOG_ERROR(kismet) << "Kismet Plugin: error while creating socket"; - return; - } - - if (connect(sockfd, (struct sockaddr*) &sock_addr, sizeof(sock_addr))) - { - MAPNIK_LOG_ERROR(kismet) << "Kismet Plugin: Error while connecting"; - return; - } - - command = "!1 ENABLE NETWORK ssid,bssid,wep,bestlat,bestlon\n"; - - if (write(sockfd, command.c_str(), command.length()) != (signed)command.length()) - { - MAPNIK_LOG_ERROR(kismet) << "Kismet Plugin: Error sending command to " << ip_host; - - close(sockfd); - return; - } - - char ssid[MAX_KISMET_LINE] = {}; - char bssid[MAX_KISMET_LINE] = {}; - double bestlat = 0; - double bestlon = 0; - int crypt = crypt_none; - - // BUG: if kismet_server is active sending after mapnik was killed and then restarted the - // assert is called. Needs to be analyzed! - while ((n = read(sockfd, buffer, sizeof(buffer))) > 0) - { - assert(n < MAX_TCP_BUFFER); - - buffer[n] = '\0'; - std::string bufferObj(buffer); // TCP data send from kismet_server as STL string - - MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: buffer_obj=" << bufferObj; - - std::string::size_type found = 0; - std::string::size_type search_start = 0; - std::string kismet_line; // contains a line from kismet_server - do - { - found = bufferObj.find('\n', search_start); - if (found != std::string::npos) - { - kismet_line.assign(bufferObj, search_start, found - search_start); - - MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: line=" << kismet_line; - - int param_number = 5; // the number of parameters to parse - - // Attention: string length specified to the constant! - if (sscanf (kismet_line.c_str(), - KISMET_COMMAND, - ssid, - bssid, - &crypt, - &bestlat, - &bestlon) == param_number) - { - MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: ssid=" << ssid - << ", bssid=" << bssid - << ", crypt=" << crypt - << ", bestlat=" << bestlat - << ", bestlon=" << bestlon; - - kismet_network_data knd(ssid, bssid, bestlat, bestlon, crypt); - - boost::mutex::scoped_lock lock(knd_list_mutex); - - // the queue only grows to a max size - if (knd_list.size () >= queue_size) - { - knd_list.pop_front(); - } - - knd_list.push_back(knd); - } - else - { - // do nothing if not matched! - } - - search_start = found + 1; - } - } - while (found != std::string::npos); - } - - if (n < 0) - { - MAPNIK_LOG_ERROR(kismet) << "Kismet Plugin: error while reading from socket"; - } - - close(sockfd); - - MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: Exit run"; -} - diff -Nru mapnik-2.1.0/plugins/input/kismet/kismet_datasource.hpp mapnik-2.2.0/plugins/input/kismet/kismet_datasource.hpp --- mapnik-2.1.0/plugins/input/kismet/kismet_datasource.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/kismet/kismet_datasource.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef KISMET_DATASOURCE_HPP -#define KISMET_DATASOURCE_HPP - -// mapnik -#include -#include -#include -#include -#include -#include -#include - -// boost -#include -#include -#include - -// stl -#include -#include -#include - -#include "kismet_types.hpp" - -class kismet_datasource : public mapnik::datasource -{ -public: - kismet_datasource(mapnik::parameters const& params, bool bind = true); - virtual ~kismet_datasource (); - datasource::datasource_t type() const; - static const char * name(); - mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; - mapnik::box2d envelope() const; - boost::optional get_geometry_type() const; - mapnik::layer_descriptor get_descriptor() const; - void bind() const; - -private: - void run (const std::string& host, const unsigned int port); - - mapnik::box2d extent_; - bool extent_initialized_; - std::string host_; - unsigned int port_; - mapnik::datasource::datasource_t type_; - std::string srs_; - mutable mapnik::layer_descriptor desc_; - boost::shared_ptr kismet_thread; -}; - -#endif // KISMET_DATASOURCE_HPP diff -Nru mapnik-2.1.0/plugins/input/kismet/kismet_featureset.cpp mapnik-2.2.0/plugins/input/kismet/kismet_featureset.cpp --- mapnik-2.1.0/plugins/input/kismet/kismet_featureset.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/kismet/kismet_featureset.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "kismet_featureset.hpp" - -using mapnik::Feature; -using mapnik::feature_ptr; -using mapnik::geometry_type; -using mapnik::geometry_utils; -using mapnik::transcoder; -using mapnik::feature_factory; - -kismet_featureset::kismet_featureset(std::list const& knd_list, - std::string const& srs, - std::string const& encoding) - : knd_list_(knd_list), - tr_(new transcoder(encoding)), - feature_id_(1), - knd_list_it(knd_list_.begin()), - source_(srs), - ctx_(boost::make_shared()) -{ - ctx_->push("internet_access"); -} - -kismet_featureset::~kismet_featureset() -{ -} - -feature_ptr kismet_featureset::next() -{ - if (knd_list_it != knd_list_.end ()) - { - const kismet_network_data& knd = *knd_list_it; - const std::string key = "internet_access"; - - std::string value; - if (knd.crypt() == crypt_none) - { - value = "wlan_uncrypted"; - } - else if (knd.crypt() == crypt_wep) - { - value = "wlan_wep"; - } - else - { - value = "wlan_crypted"; - } - - feature_ptr feature(feature_factory::create(ctx_,feature_id_)); - ++feature_id_; - - geometry_type* pt = new geometry_type(mapnik::Point); - pt->move_to(knd.bestlon(), knd.bestlat()); - feature->add_geometry(pt); - - feature->put(key, tr_->transcode(value.c_str())); - - ++knd_list_it; - - return feature; - } - - return feature_ptr(); -} diff -Nru mapnik-2.1.0/plugins/input/kismet/kismet_featureset.hpp mapnik-2.2.0/plugins/input/kismet/kismet_featureset.hpp --- mapnik-2.1.0/plugins/input/kismet/kismet_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/kismet/kismet_featureset.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef KISMET_FEATURESET_HPP -#define KISMET_FEATURESET_HPP - -// mapnik -#include -#include -#include -#include -#include - -// boost -#include -#include - -//STL -#include - -#include "kismet_types.hpp" - -class kismet_featureset : public mapnik::Featureset -{ -public: - kismet_featureset(std::list const& knd_list, - std::string const& srs, - std::string const& encoding); - virtual ~kismet_featureset(); - mapnik::feature_ptr next(); - -private: - std::list const& knd_list_; - boost::scoped_ptr tr_; - int feature_id_; - std::list::const_iterator knd_list_it; - mapnik::projection source_; - mapnik::context_ptr ctx_; -}; - -#endif // KISMET_FEATURESET_HPP diff -Nru mapnik-2.1.0/plugins/input/kismet/kismet_types.hpp mapnik-2.2.0/plugins/input/kismet/kismet_types.hpp --- mapnik-2.1.0/plugins/input/kismet/kismet_types.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/kismet/kismet_types.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,112 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef KISMET_TYPES_HPP -#define KISMET_TYPES_HPP - -// mapnik -#include -#include - -// boost -#include - -// this is a copy from packet.h from kismet 2007.10.R1 -enum crypt_type -{ - crypt_none = 0, - crypt_unknown = 1, - crypt_wep = 2, - crypt_layer3 = 4, - // Derived from WPA headers - crypt_wep40 = 8, - crypt_wep104 = 16, - crypt_tkip = 32, - crypt_wpa = 64, - crypt_psk = 128, - crypt_aes_ocb = 256, - crypt_aes_ccm = 512, - // Derived from data traffic - crypt_leap = 1024, - crypt_ttls = 2048, - crypt_tls = 4096, - crypt_peap = 8192, - crypt_isakmp = 16384, - crypt_pptp = 32768, - crypt_ccmp = 65536 -}; - -class kismet_network_data -{ -public: - kismet_network_data() - : bestlat_(0), bestlon_(0), crypt_(crypt_none) - { - } - - kismet_network_data(std::string ssid, - std::string bssid, - double bestlat, - double bestlon, - int crypt) - : ssid_(ssid), - bssid_(bssid), - bestlat_(bestlat), - bestlon_(bestlon), - crypt_(crypt) - { - } - - const std::string& ssid() const - { - return ssid_; - } - - const std::string& bssid() const - { - return bssid_; - } - - double bestlat() const - { - return bestlat_; - } - - double bestlon() const - { - return bestlon_; - } - - int crypt() const - { - return crypt_; - } - -protected: - std::string ssid_; - std::string bssid_; - double bestlat_; - double bestlon_; - int crypt_; -}; - -#endif // KISMET_TYPES_HPP diff -Nru mapnik-2.1.0/plugins/input/occi/build.py mapnik-2.2.0/plugins/input/occi/build.py --- mapnik-2.1.0/plugins/input/occi/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/occi/build.py 2013-06-04 01:35:27.000000000 +0000 @@ -1,7 +1,7 @@ # # This file is part of Mapnik (c++ mapping toolkit) # -# Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon +# Copyright (C) 2013 Artem Pavlenko # # Mapnik is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,35 +17,49 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# Import ('plugin_base') Import ('env') -prefix = env['PREFIX'] +PLUGIN_NAME = 'occi' plugin_env = plugin_base.Clone() -occi_src = Split( +plugin_sources = Split( """ - occi_types.cpp - occi_datasource.cpp - occi_featureset.cpp + %(PLUGIN_NAME)s_types.cpp + %(PLUGIN_NAME)s_datasource.cpp + %(PLUGIN_NAME)s_featureset.cpp spatial_classesm.cpp spatial_classeso.cpp - """ - ) + """ % locals() +) libraries = [ 'occi', 'ociei' ] -libraries.append('mapnik') libraries.append('boost_system%s' % env['BOOST_APPEND']) libraries.append(env['ICU_LIB_NAME']) -input_plugin = plugin_env.SharedLibrary('../occi', source=occi_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) +if env['PLUGIN_LINKING'] == 'shared': + libraries.append('mapnik') -# if the plugin links to libmapnik ensure it is built first -Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, + SHLIBPREFIX='', + SHLIBSUFFIX='.input', + source=plugin_sources, + LIBS=libraries, + LINKFLAGS=env['CUSTOM_LDFLAGS']) + + # if the plugin links to libmapnik ensure it is built first + Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + + if 'uninstall' not in COMMAND_LINE_TARGETS: + env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET) + env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) + +plugin_obj = { + 'LIBS': libraries, + 'SOURCES': plugin_sources, +} -if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin) - env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) +Return('plugin_obj') diff -Nru mapnik-2.1.0/plugins/input/occi/occi_datasource.cpp mapnik-2.2.0/plugins/input/occi/occi_datasource.cpp --- mapnik-2.1.0/plugins/input/occi/occi_datasource.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/occi/occi_datasource.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -28,10 +28,10 @@ #include #include #include +#include // boost #include -#include #include #include @@ -42,9 +42,6 @@ #include #include -using boost::lexical_cast; -using boost::bad_lexical_cast; - using mapnik::datasource; using mapnik::parameters; using mapnik::query; @@ -64,29 +61,38 @@ using oracle::occi::Type; using oracle::occi::StatelessConnectionPool; +const double occi_datasource::FMAX = std::numeric_limits::max(); const std::string occi_datasource::METADATA_TABLE = "USER_SDO_GEOM_METADATA"; DATASOURCE_PLUGIN(occi_datasource) -occi_datasource::occi_datasource(parameters const& params, bool bind) +occi_datasource::occi_datasource(parameters const& params) : datasource (params), type_(datasource::Vector), - fields_(*params_.get("fields", "*")), - geometry_field_(*params_.get("geometry_field", "")), + fields_(*params.get("fields", "*")), + geometry_field_(*params.get("geometry_field", "")), srid_initialized_(false), extent_initialized_(false), - desc_(*params_.get("type"), *params_.get("encoding", "utf-8")), - use_wkb_(*params_.get("use_wkb", false)), - row_limit_(*params_.get("row_limit", 0)), - row_prefetch_(*params_.get("row_prefetch", 100)), + bbox_token_("!bbox!"), + scale_denom_token_("!scale_denominator!"), + pixel_width_token_("!pixel_width!"), + pixel_height_token_("!pixel_height!"), + desc_(*params.get("type"), *params.get("encoding", "utf-8")), + use_wkb_(*params.get("use_wkb", false)), + row_limit_(*params.get("row_limit", 0)), + row_prefetch_(*params.get("row_prefetch", 100)), pool_(0), conn_(0) { - if (! params_.get("user")) throw datasource_exception("OCCI Plugin: no specified"); - if (! params_.get("password")) throw datasource_exception("OCCI Plugin: no specified"); - if (! params_.get("host")) throw datasource_exception("OCCI Plugin: no string specified"); +#ifdef MAPNIK_STATS + mapnik::progress_timer __stats__(std::clog, "occi_datasource::init"); +#endif + + if (! params.get("user")) throw datasource_exception("OCCI Plugin: no specified"); + if (! params.get("password")) throw datasource_exception("OCCI Plugin: no specified"); + if (! params.get("host")) throw datasource_exception("OCCI Plugin: no string specified"); - boost::optional table = params_.get("table"); + boost::optional table = params.get("table"); if (! table) { throw datasource_exception("OCCI Plugin: no parameter specified"); @@ -95,72 +101,32 @@ { table_ = *table; } + estimate_extent_ = *params.get("estimate_extent",false); + use_spatial_index_ = *params.get("use_spatial_index",true); + use_connection_pool_ = *params.get("use_connection_pool",true); - use_spatial_index_ = *params_.get("use_spatial_index",true); - use_connection_pool_ = *params_.get("use_connection_pool",true); - - boost::optional ext = params_.get("extent"); + boost::optional ext = params.get("extent"); if (ext) extent_initialized_ = extent_.from_string(*ext); - boost::optional srid = params_.get("srid"); + boost::optional srid = params.get("srid"); if (srid) { srid_ = *srid; srid_initialized_ = true; } - if (bind) - { - this->bind(); - } -} - -occi_datasource::~occi_datasource() -{ - if (is_bound_) - { - Environment* env = occi_environment::get_environment(); - - if (use_connection_pool_) - { - if (pool_ != 0) - { - env->terminateStatelessConnectionPool(pool_, StatelessConnectionPool::SPD_FORCE); - } - } - else - { - if (conn_ != 0) - { - env->terminateConnection(conn_); - } - } - } -} - -void occi_datasource::bind() const -{ - if (is_bound_) return; - -#ifdef MAPNIK_STATS - mapnik::progress_timer __stats__(std::clog, "occi_datasource::bind"); -#endif - // connect to environment if (use_connection_pool_) { try { - Environment* env = occi_environment::get_environment(); - - pool_ = env->createStatelessConnectionPool( - *params_.get("user"), - *params_.get("password"), - *params_.get("host"), - *params_.get("max_size", 5), - *params_.get("initial_size", 1), - 1, - StatelessConnectionPool::HOMOGENEOUS); + pool_ = occi_environment::instance().create_pool( + *params.get("user"), + *params.get("password"), + *params.get("host"), + *params.get("max_size", 5), + *params.get("initial_size", 1), + 1); } catch (SQLException& ex) { @@ -171,12 +137,10 @@ { try { - Environment* env = occi_environment::get_environment(); - - conn_ = env->createConnection( - *params_.get("user"), - *params_.get("password"), - *params_.get("host")); + conn_ = occi_environment::instance().create_connection( + *params.get("user"), + *params.get("password"), + *params.get("host")); } catch (SQLException& ex) { @@ -239,7 +203,7 @@ #endif std::ostringstream s; - s << "SELECT " << fields_ << " FROM (" << table_name_ << ") WHERE rownum < 1"; + s << "SELECT " << fields_ << " FROM (" << table_name_ << ") WHERE ROWNUM < 1"; MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str(); @@ -273,9 +237,10 @@ switch (type_oid) { case oracle::occi::OCCIBOOL: + desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Boolean)); + break; case oracle::occi::OCCIINT: case oracle::occi::OCCIUNSIGNED_INT: - case oracle::occi::OCCIROWID: desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Integer)); break; case oracle::occi::OCCIFLOAT: @@ -291,26 +256,29 @@ case oracle::occi::OCCI_SQLT_AFC: case oracle::occi::OCCI_SQLT_AVC: case oracle::occi::OCCI_SQLT_CHR: + case oracle::occi::OCCI_SQLT_LNG: case oracle::occi::OCCI_SQLT_LVC: - case oracle::occi::OCCI_SQLT_RDD: case oracle::occi::OCCI_SQLT_STR: case oracle::occi::OCCI_SQLT_VCS: case oracle::occi::OCCI_SQLT_VNU: case oracle::occi::OCCI_SQLT_VBI: case oracle::occi::OCCI_SQLT_VST: - desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::String)); - break; + case oracle::occi::OCCIROWID: + case oracle::occi::OCCI_SQLT_RDD: + case oracle::occi::OCCI_SQLT_RID: case oracle::occi::OCCIDATE: - case oracle::occi::OCCITIMESTAMP: - case oracle::occi::OCCIINTERVALDS: - case oracle::occi::OCCIINTERVALYM: case oracle::occi::OCCI_SQLT_DAT: case oracle::occi::OCCI_SQLT_DATE: case oracle::occi::OCCI_SQLT_TIME: case oracle::occi::OCCI_SQLT_TIME_TZ: + case oracle::occi::OCCITIMESTAMP: case oracle::occi::OCCI_SQLT_TIMESTAMP: case oracle::occi::OCCI_SQLT_TIMESTAMP_LTZ: case oracle::occi::OCCI_SQLT_TIMESTAMP_TZ: + desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::String)); + break; + case oracle::occi::OCCIINTERVALDS: + case oracle::occi::OCCIINTERVALYM: case oracle::occi::OCCI_SQLT_INTERVAL_YM: case oracle::occi::OCCI_SQLT_INTERVAL_DS: case oracle::occi::OCCIANYDATA: @@ -348,8 +316,24 @@ throw datasource_exception(ex.getMessage()); } } +} - is_bound_ = true; +occi_datasource::~occi_datasource() +{ + if (use_connection_pool_) + { + if (pool_ != 0) + { + occi_environment::instance().destroy_pool(pool_); + } + } + else + { + if (conn_ != 0) + { + occi_environment::instance().destroy_connection(conn_); + } + } } const char * occi_datasource::name() @@ -365,14 +349,11 @@ box2d occi_datasource::envelope() const { if (extent_initialized_) return extent_; - if (! is_bound_) bind(); double lox = 0.0, loy = 0.0, hix = 0.0, hiy = 0.0; - boost::optional estimate_extent = - params_.get("estimate_extent",false); - if (estimate_extent && *estimate_extent) + if (estimate_extent_) { #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "occi_datasource::envelope(estimate_extent)"); @@ -394,19 +375,12 @@ ResultSet* rs = conn.execute_query(s.str()); if (rs && rs->next()) { - try - { - lox = lexical_cast(rs->getDouble(1)); - loy = lexical_cast(rs->getDouble(2)); - hix = lexical_cast(rs->getDouble(3)); - hiy = lexical_cast(rs->getDouble(4)); - extent_.init(lox, loy, hix, hiy); - extent_initialized_ = true; - } - catch (bad_lexical_cast& ex) - { - MAPNIK_LOG_WARN(occi) << "OCCI Plugin: " << ex.what(); - } + lox = rs->getDouble(1); + loy = rs->getDouble(2); + hix = rs->getDouble(3); + hiy = rs->getDouble(4); + extent_.init(lox, loy, hix, hiy); + extent_initialized_ = true; } } catch (SQLException& ex) @@ -442,30 +416,15 @@ { if (rs->next()) { - try - { - lox = lexical_cast(rs->getDouble(1)); - hix = lexical_cast(rs->getDouble(2)); - } - catch (bad_lexical_cast& ex) - { - MAPNIK_LOG_WARN(occi) << "OCCI Plugin: " << ex.what(); - } + lox = rs->getDouble(1); + hix = rs->getDouble(2); } if (rs->next()) { - try - { - loy = lexical_cast(rs->getDouble(1)); - hiy = lexical_cast(rs->getDouble(2)); - } - catch (bad_lexical_cast& ex) - { - MAPNIK_LOG_WARN(occi) << "OCCI Plugin: " << ex.what(); - } + loy = rs->getDouble(1); + hiy = rs->getDouble(2); } - extent_.init(lox, loy, hix, hiy); extent_initialized_ = true; } @@ -487,27 +446,69 @@ boost::optional occi_datasource::get_geometry_type() const { - // FIXME - //if (! is_bound_) bind(); return boost::optional(); } layer_descriptor occi_datasource::get_descriptor() const { - if (! is_bound_) bind(); - return desc_; } -featureset_ptr occi_datasource::features(query const& q) const +std::string occi_datasource::sql_bbox(box2d const& env) const +{ + std::ostringstream b; + b << std::setprecision(16); + b << "MDSYS.SDO_GEOMETRY(" << SDO_GTYPE_2DPOLYGON << "," << srid_ << ",NULL,"; + b << " MDSYS.SDO_ELEM_INFO_ARRAY(1," << SDO_ETYPE_POLYGON << "," << SDO_INTERPRETATION_RECTANGLE << "),"; + b << " MDSYS.SDO_ORDINATE_ARRAY("; + b << env.minx() << "," << env.miny() << ", "; + b << env.maxx() << "," << env.maxy() << "))"; + return b.str(); +} + +std::string occi_datasource::populate_tokens(std::string const& sql, double scale_denom, box2d const& env, double pixel_width, double pixel_height) const { - if (! is_bound_) bind(); + std::string populated_sql = sql; + + if (boost::algorithm::icontains(populated_sql, scale_denom_token_)) + { + std::ostringstream ss; + ss << scale_denom; + boost::algorithm::replace_all(populated_sql, scale_denom_token_, ss.str()); + } + + if (boost::algorithm::icontains(sql, pixel_width_token_)) + { + std::ostringstream ss; + ss << pixel_width; + boost::algorithm::replace_all(populated_sql, pixel_width_token_, ss.str()); + } + + if (boost::algorithm::icontains(sql, pixel_height_token_)) + { + std::ostringstream ss; + ss << pixel_height; + boost::algorithm::replace_all(populated_sql, pixel_height_token_, ss.str()); + } + + if (boost::algorithm::icontains(populated_sql, bbox_token_)) + { + boost::algorithm::replace_all(populated_sql, bbox_token_, sql_bbox(env)); + } + + return populated_sql; +} +featureset_ptr occi_datasource::features(query const& q) const +{ #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "occi_datasource::features"); #endif box2d const& box = q.get_bbox(); + const double px_gw = 1.0 / boost::get<0>(q.resolution()); + const double px_gh = 1.0 / boost::get<1>(q.resolution()); + const double scale_denom = q.scale_denominator(); std::ostringstream s; s << "SELECT "; @@ -529,20 +530,14 @@ ctx->push(*pos); } - s << " FROM "; - - std::string query(table_); + std::string query = populate_tokens(table_, scale_denom, box, px_gw, px_gh); if (use_spatial_index_) { std::ostringstream spatial_sql; - spatial_sql << std::setprecision(16); - spatial_sql << " WHERE SDO_FILTER(" << geometry_field_ << ","; - spatial_sql << " MDSYS.SDO_GEOMETRY(" << SDO_GTYPE_2DPOLYGON << "," << srid_ << ",NULL,"; - spatial_sql << " MDSYS.SDO_ELEM_INFO_ARRAY(1," << SDO_ETYPE_POLYGON << "," << SDO_INTERPRETATION_RECTANGLE << "),"; - spatial_sql << " MDSYS.SDO_ORDINATE_ARRAY("; - spatial_sql << box.minx() << "," << box.miny() << ", "; - spatial_sql << box.maxx() << "," << box.maxy() << ")), 'querytype=WINDOW') = 'TRUE'"; + spatial_sql << " WHERE SDO_FILTER("; + spatial_sql << geometry_field_ << "," << sql_bbox(box); + spatial_sql << ", 'querytype = WINDOW') = 'TRUE'"; if (boost::algorithm::ifind_first(query, "WHERE")) { @@ -558,42 +553,27 @@ } } + s << " FROM " << query; + if (row_limit_ > 0) { - std::ostringstream row_limit_string; - row_limit_string << "rownum < " << row_limit_; - if (boost::algorithm::ifind_first(query, "WHERE")) - { - boost::algorithm::ireplace_first(query, "WHERE", row_limit_string.str() + " AND "); - } - else if (boost::algorithm::ifind_first(query, table_name_)) - { - boost::algorithm::ireplace_first(query, table_name_, table_name_ + " " + row_limit_string.str()); - } - else - { - MAPNIK_LOG_WARN(occi) << "occi_datasource: Cannot determine where to add the row limit declaration"; - } + s << " WHERE ROWNUM < " << row_limit_; } - s << query; - MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str(); return boost::make_shared(pool_, - conn_, - ctx, - s.str(), - desc_.get_encoding(), - use_connection_pool_, - use_wkb_, - row_prefetch_); + conn_, + ctx, + s.str(), + desc_.get_encoding(), + use_connection_pool_, + use_wkb_, + row_prefetch_); } -featureset_ptr occi_datasource::features_at_point(coord2d const& pt) const +featureset_ptr occi_datasource::features_at_point(coord2d const& pt, double tol) const { - if (! is_bound_) bind(); - #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "occi_datasource::features_at_point"); #endif @@ -618,19 +598,15 @@ ++itr; } - s << " FROM "; - - std::string query(table_); + box2d box(pt.x - tol, pt.y - tol, pt.x + tol, pt.y + tol); + std::string query = populate_tokens(table_, FMAX, box, 0, 0); if (use_spatial_index_) { std::ostringstream spatial_sql; - spatial_sql << std::setprecision(16); - spatial_sql << " WHERE SDO_FILTER(" << geometry_field_ << ","; - spatial_sql << " MDSYS.SDO_GEOMETRY(" << SDO_GTYPE_2DPOINT << "," << srid_ << ",NULL,"; - spatial_sql << " MDSYS.SDO_ELEM_INFO_ARRAY(1," << SDO_ETYPE_POINT << "," << SDO_INTERPRETATION_POINT << "),"; - spatial_sql << " MDSYS.SDO_ORDINATE_ARRAY("; - spatial_sql << pt.x << "," << pt.y << ")), 'querytype=WINDOW') = 'TRUE'"; + spatial_sql << " WHERE SDO_FILTER("; + spatial_sql << geometry_field_ << "," << sql_bbox(box); + spatial_sql << ", 'querytype = WINDOW') = 'TRUE'"; if (boost::algorithm::ifind_first(query, "WHERE")) { @@ -646,34 +622,21 @@ } } + s << " FROM " << query; + if (row_limit_ > 0) { - std::ostringstream row_limit_string; - row_limit_string << "rownum < " << row_limit_; - if (boost::algorithm::ifind_first(query, "WHERE")) - { - boost::algorithm::ireplace_first(query, "WHERE", row_limit_string.str() + " AND "); - } - else if (boost::algorithm::ifind_first(query, table_name_)) - { - boost::algorithm::ireplace_first(query, table_name_, table_name_ + " " + row_limit_string.str()); - } - else - { - MAPNIK_LOG_WARN(occi) << "occi_datasource: Cannot determine where to add the row limit declaration"; - } + s << " WHERE ROWNUM < " << row_limit_; } - s << query; - MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str(); return boost::make_shared(pool_, - conn_, - ctx, - s.str(), - desc_.get_encoding(), - use_connection_pool_, - use_wkb_, - row_prefetch_); + conn_, + ctx, + s.str(), + desc_.get_encoding(), + use_connection_pool_, + use_wkb_, + row_prefetch_); } diff -Nru mapnik-2.1.0/plugins/input/occi/occi_datasource.hpp mapnik-2.2.0/plugins/input/occi/occi_datasource.hpp --- mapnik-2.1.0/plugins/input/occi/occi_datasource.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/occi/occi_datasource.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -31,6 +31,7 @@ #include #include #include +#include // boost #include @@ -46,37 +47,49 @@ class occi_datasource : public mapnik::datasource { public: - occi_datasource(mapnik::parameters const& params, bool bind = true); + occi_datasource(mapnik::parameters const& params); virtual ~occi_datasource (); mapnik::datasource::datasource_t type() const; static const char * name(); mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; + mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; mapnik::box2d envelope() const; boost::optional get_geometry_type() const; mapnik::layer_descriptor get_descriptor() const; - void bind() const; private: + std::string sql_bbox(mapnik::box2d const& env) const; + std::string populate_tokens(std::string const& sql, + double scale_denom, + mapnik::box2d const& env, + double pixel_width, + double pixel_height) const; + static const std::string METADATA_TABLE; + static const double FMAX; mapnik::datasource::datasource_t type_; - mutable std::string table_; - mutable std::string table_name_; - mutable std::string fields_; - mutable std::string geometry_field_; - mutable int srid_; - mutable bool srid_initialized_; + std::string table_; + std::string table_name_; + std::string fields_; + std::string geometry_field_; + int srid_; + bool srid_initialized_; mutable bool extent_initialized_; mutable mapnik::box2d extent_; - mutable mapnik::layer_descriptor desc_; - mutable bool use_wkb_; - int row_limit_; + const std::string bbox_token_; + const std::string scale_denom_token_; + const std::string pixel_width_token_; + const std::string pixel_height_token_; + mapnik::layer_descriptor desc_; + bool use_wkb_; + mapnik::value_integer row_limit_; int row_prefetch_; - mutable oracle::occi::StatelessConnectionPool* pool_; - mutable oracle::occi::Connection* conn_; + oracle::occi::StatelessConnectionPool* pool_; + oracle::occi::Connection* conn_; bool use_connection_pool_; bool use_spatial_index_; + bool estimate_extent_; }; #endif // OCCI_DATASOURCE_HPP diff -Nru mapnik-2.1.0/plugins/input/occi/occi_featureset.cpp mapnik-2.2.0/plugins/input/occi/occi_featureset.cpp --- mapnik-2.1.0/plugins/input/occi/occi_featureset.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/occi/occi_featureset.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,7 +23,6 @@ // mapnik #include #include -#include #include #include #include @@ -37,7 +36,6 @@ using mapnik::query; using mapnik::box2d; -using mapnik::Feature; using mapnik::feature_ptr; using mapnik::geometry_type; using mapnik::geometry_utils; @@ -63,7 +61,8 @@ bool use_connection_pool, bool use_wkb, unsigned prefetch_rows) - : tr_(new transcoder(encoding)), + : rs_(NULL), + tr_(new transcoder(encoding)), feature_id_(1), ctx_(ctx), use_wkb_(use_wkb) @@ -84,6 +83,8 @@ catch (SQLException &ex) { MAPNIK_LOG_ERROR(occi) << "OCCI Plugin: error processing " << sqlstring << " : " << ex.getMessage(); + + rs_ = NULL; } } @@ -93,28 +94,30 @@ feature_ptr occi_featureset::next() { - if (rs_ && rs_->next()) + while (rs_ != NULL && rs_->next() == oracle::occi::ResultSet::DATA_AVAILABLE) { - feature_ptr feature(feature_factory::create(ctx_,feature_id_)); - ++feature_id_; + feature_ptr feature(feature_factory::create(ctx_, feature_id_)); if (use_wkb_) { - Blob blob = rs_->getBlob (1); + Blob blob = rs_->getBlob(1); blob.open(oracle::occi::OCCI_LOB_READONLY); - int size = blob.length(); + unsigned int size = blob.length(); if (buffer_.size() < size) { buffer_.resize(size); } - oracle::occi::Stream* instream = blob.getStream(1,0); + oracle::occi::Stream* instream = blob.getStream(1, 0); instream->readBuffer(buffer_.data(), size); blob.closeStream(instream); blob.close(); - geometry_utils::from_wkb(feature->paths(), buffer_.data(), size); + if (! geometry_utils::from_wkb(feature->paths(), buffer_.data(), size)) + { + continue; + } } else { @@ -123,6 +126,10 @@ { convert_geometry(geom.get(), feature); } + else + { + continue; + } } std::vector listOfColumns = rs_->getColumnListMetaData(); @@ -145,44 +152,50 @@ switch (type_oid) { case oracle::occi::OCCIBOOL: + feature->put(fld_name, (rs_->getInt(i + 1) != 0)); + break; case oracle::occi::OCCIINT: case oracle::occi::OCCIUNSIGNED_INT: - case oracle::occi::OCCIROWID: - feature->put(fld_name,rs_->getInt (i + 1)); + feature->put(fld_name, static_cast(rs_->getInt(i + 1))); break; case oracle::occi::OCCIFLOAT: case oracle::occi::OCCIBFLOAT: + feature->put(fld_name, (double)rs_->getFloat(i + 1)); + break; case oracle::occi::OCCIDOUBLE: case oracle::occi::OCCIBDOUBLE: case oracle::occi::OCCINUMBER: case oracle::occi::OCCI_SQLT_NUM: - feature->put(fld_name,rs_->getDouble (i + 1)); + feature->put(fld_name, rs_->getDouble(i + 1)); break; case oracle::occi::OCCICHAR: case oracle::occi::OCCISTRING: case oracle::occi::OCCI_SQLT_AFC: case oracle::occi::OCCI_SQLT_AVC: case oracle::occi::OCCI_SQLT_CHR: + case oracle::occi::OCCI_SQLT_LNG: case oracle::occi::OCCI_SQLT_LVC: - case oracle::occi::OCCI_SQLT_RDD: case oracle::occi::OCCI_SQLT_STR: case oracle::occi::OCCI_SQLT_VCS: case oracle::occi::OCCI_SQLT_VNU: case oracle::occi::OCCI_SQLT_VBI: case oracle::occi::OCCI_SQLT_VST: - feature->put(fld_name,(UnicodeString) tr_->transcode (rs_->getString (i + 1).c_str())); - break; + case oracle::occi::OCCIROWID: + case oracle::occi::OCCI_SQLT_RDD: + case oracle::occi::OCCI_SQLT_RID: case oracle::occi::OCCIDATE: - case oracle::occi::OCCITIMESTAMP: - case oracle::occi::OCCIINTERVALDS: - case oracle::occi::OCCIINTERVALYM: case oracle::occi::OCCI_SQLT_DAT: case oracle::occi::OCCI_SQLT_DATE: case oracle::occi::OCCI_SQLT_TIME: case oracle::occi::OCCI_SQLT_TIME_TZ: + case oracle::occi::OCCITIMESTAMP: case oracle::occi::OCCI_SQLT_TIMESTAMP: case oracle::occi::OCCI_SQLT_TIMESTAMP_LTZ: case oracle::occi::OCCI_SQLT_TIMESTAMP_TZ: + feature->put(fld_name, (UnicodeString)tr_->transcode(rs_->getString(i + 1).c_str())); + break; + case oracle::occi::OCCIINTERVALDS: + case oracle::occi::OCCIINTERVALYM: case oracle::occi::OCCI_SQLT_INTERVAL_YM: case oracle::occi::OCCI_SQLT_INTERVAL_DS: case oracle::occi::OCCIANYDATA: @@ -218,6 +231,8 @@ } } + ++feature_id_; + return feature; } diff -Nru mapnik-2.1.0/plugins/input/occi/occi_featureset.hpp mapnik-2.2.0/plugins/input/occi/occi_featureset.hpp --- mapnik-2.1.0/plugins/input/occi/occi_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/occi/occi_featureset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,6 +24,7 @@ #define OCCI_FEATURESET_HPP // mapnik +#include #include #include #include @@ -70,7 +71,7 @@ occi_connection_ptr conn_; oracle::occi::ResultSet* rs_; boost::scoped_ptr tr_; - mutable int feature_id_; + mapnik::value_integer feature_id_; mapnik::context_ptr ctx_; bool use_wkb_; std::vector buffer_; diff -Nru mapnik-2.1.0/plugins/input/occi/occi_types.cpp mapnik-2.2.0/plugins/input/occi/occi_types.cpp --- mapnik-2.1.0/plugins/input/occi/occi_types.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/occi/occi_types.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,8 +22,6 @@ #include "occi_types.hpp" -oracle::occi::Environment* occi_environment::env_ = 0; - std::string occi_enums::resolve_gtype(int gtype) { switch (gtype) @@ -74,6 +72,7 @@ case oracle::occi::OCCI_SQLT_AVC: return "OCCI_SQLT_AVC"; case oracle::occi::OCCI_SQLT_CHR: return "OCCI_SQLT_CHR"; case oracle::occi::OCCI_SQLT_LVC: return "OCCI_SQLT_LVC"; + case oracle::occi::OCCI_SQLT_LNG: return "OCCI_SQLT_LNG"; case oracle::occi::OCCI_SQLT_STR: return "OCCI_SQLT_STR"; case oracle::occi::OCCI_SQLT_VCS: return "OCCI_SQLT_VCS"; case oracle::occi::OCCI_SQLT_VNU: return "OCCI_SQLT_VNU"; diff -Nru mapnik-2.1.0/plugins/input/occi/occi_types.hpp mapnik-2.2.0/plugins/input/occi/occi_types.hpp --- mapnik-2.1.0/plugins/input/occi/occi_types.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/occi/occi_types.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -27,6 +27,11 @@ #include #include +// boost +#ifdef MAPNIK_THREADSAFE +#include +#endif + // occi #include @@ -84,48 +89,83 @@ public: - static oracle::occi::Environment* get_environment() + oracle::occi::Environment* get_environment() { - if (env_ == 0) - { - MAPNIK_LOG_DEBUG(occi) << "occi_environment: constructor"; + return env_; + } - const int mode = oracle::occi::Environment::OBJECT - | oracle::occi::Environment::THREADED_MUTEXED; + oracle::occi::Connection* create_connection( + const std::string& user, + const std::string& password, + const std::string& host) + { + MAPNIK_LOG_DEBUG(occi) << "occi_environment: create_connection"; - env_ = oracle::occi::Environment::createEnvironment((oracle::occi::Environment::Mode) mode); - RegisterClasses(env_); - } + return env_->createConnection(user, password, host); + } - return env_; + void destroy_connection(oracle::occi::Connection* conn) + { + env_->terminateConnection(conn); + } + + oracle::occi::StatelessConnectionPool* create_pool( + const std::string& user, + const std::string& password, + const std::string& host, + int max_size, + int initial_size, + int incr_size) + { + MAPNIK_LOG_DEBUG(occi) << "occi_environment: create_pool"; + + return env_->createStatelessConnectionPool( + user, + password, + host, + max_size, + initial_size, + incr_size, + oracle::occi::StatelessConnectionPool::HOMOGENEOUS); + } + + void destroy_pool(oracle::occi::StatelessConnectionPool* pool) + { + env_->terminateStatelessConnectionPool( + pool, + oracle::occi::StatelessConnectionPool::SPD_FORCE); } private: occi_environment() + : env_(0) { + MAPNIK_LOG_DEBUG(occi) << "occi_environment: constructor"; + + env_ = oracle::occi::Environment::createEnvironment( + (oracle::occi::Environment::Mode)(oracle::occi::Environment::OBJECT + | oracle::occi::Environment::THREADED_MUTEXED)); + RegisterClasses(env_); } ~occi_environment() { - if (env_) - { - MAPNIK_LOG_DEBUG(occi) << "occi_environment: destructor"; + MAPNIK_LOG_DEBUG(occi) << "occi_environment: destructor"; - oracle::occi::Environment::terminateEnvironment(env_); - env_ = 0; - } + oracle::occi::Environment::terminateEnvironment(env_); + env_ = 0; } - static oracle::occi::Environment* env_; + oracle::occi::Environment* env_; }; + class occi_connection_ptr { public: explicit occi_connection_ptr() - : env_(occi_environment::get_environment()), - pool_(0), + : pool_(0), conn_(0), stmt_(0), rs_(0), @@ -156,7 +196,7 @@ owns_connection_ = owns_connection; } - oracle::occi::ResultSet* execute_query(const std::string& s, const unsigned prefetch = 0) + oracle::occi::ResultSet* execute_query(std::string const& s, const unsigned prefetch = 0) { close_query(false); @@ -175,11 +215,6 @@ return rs_; } - oracle::occi::Connection* operator*() - { - return conn_; - } - private: void close_query(const bool release_connection) { @@ -207,7 +242,7 @@ { if (owns_connection_) { - env_->terminateConnection(conn_); + occi_environment::instance().destroy_connection(conn_); } } @@ -216,7 +251,6 @@ } } - oracle::occi::Environment* env_; oracle::occi::StatelessConnectionPool* pool_; oracle::occi::Connection* conn_; oracle::occi::Statement* stmt_; diff -Nru mapnik-2.1.0/plugins/input/occi/spatial_classesh.h mapnik-2.2.0/plugins/input/occi/spatial_classesh.h --- mapnik-2.1.0/plugins/input/occi/spatial_classesh.h 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/occi/spatial_classesh.h 2013-06-04 01:35:27.000000000 +0000 @@ -55,7 +55,7 @@ SDOPointType(); - SDOPointType(void *ctxOCCI_) : oracle::occi::PObject (ctxOCCI_) { }; + SDOPointType(void *ctxOCCI_) : oracle::occi::PObject (ctxOCCI_) { } static void *readSQL(void *ctxOCCI_); @@ -130,7 +130,7 @@ SDOGeometry(); - SDOGeometry(void *ctxOCCI_) : oracle::occi::PObject (ctxOCCI_) { }; + SDOGeometry(void *ctxOCCI_) : oracle::occi::PObject (ctxOCCI_) { } static void *readSQL(void *ctxOCCI_); diff -Nru mapnik-2.1.0/plugins/input/ogr/build.py mapnik-2.2.0/plugins/input/ogr/build.py --- mapnik-2.1.0/plugins/input/ogr/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/ogr/build.py 2013-06-04 01:35:27.000000000 +0000 @@ -1,7 +1,7 @@ # # This file is part of Mapnik (c++ mapping toolkit) # -# Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon +# Copyright (C) 2013 Artem Pavlenko # # Mapnik is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,50 +17,69 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ - +# Import ('plugin_base') Import ('env') +from copy import copy -prefix = env['PREFIX'] +PLUGIN_NAME = 'ogr' plugin_env = plugin_base.Clone() -ogr_src = Split( - """ - ogr_converter.cpp - ogr_datasource.cpp - ogr_featureset.cpp - ogr_index_featureset.cpp +plugin_sources = Split( """ - ) + %(PLUGIN_NAME)s_converter.cpp + %(PLUGIN_NAME)s_datasource.cpp + %(PLUGIN_NAME)s_featureset.cpp + %(PLUGIN_NAME)s_index_featureset.cpp + """ % locals() +) -plugin_env['LIBS'] = [env['PLUGINS']['ogr']['lib']] -# Link Library to Dependencies -plugin_env['LIBS'].append('mapnik') -plugin_env['LIBS'].append(env['ICU_LIB_NAME']) -plugin_env['LIBS'].append('boost_system%s' % env['BOOST_APPEND']) -plugin_env['LIBS'].append('boost_filesystem%s' % env['BOOST_APPEND']) +cxxflags = [] +plugin_env['LIBS'] = [] if env['RUNTIME_LINK'] == 'static': cmd = 'gdal-config --dep-libs' plugin_env.ParseConfig(cmd) - plugin_env['LIBS'].append('proj') + +# Link Library to Dependencies +plugin_env.Append(LIBS=env['PLUGINS']['ogr']['lib']) +libraries = copy(plugin_env['LIBS']) if env.get('BOOST_LIB_VERSION_FROM_HEADER'): boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1]) if boost_version_from_header < 46: # avoid ubuntu issue with boost interprocess: # https://github.com/mapnik/mapnik/issues/1082 - plugin_env.Append(CXXFLAGS = '-fpermissive') + cxxflags.append('-fpermissive') -input_plugin = plugin_env.SharedLibrary('../ogr', source=ogr_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LINKFLAGS=env['CUSTOM_LDFLAGS']) +plugin_env.Append(CXXFLAGS=cxxflags) -# if the plugin links to libmapnik ensure it is built first -Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) +if env['PLUGIN_LINKING'] == 'shared': + libraries.append('mapnik') + libraries.append(env['ICU_LIB_NAME']) + libraries.append('boost_system%s' % env['BOOST_APPEND']) + + TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, + SHLIBPREFIX='', + SHLIBSUFFIX='.input', + source=plugin_sources, + LIBS=libraries, + LINKFLAGS=env['CUSTOM_LDFLAGS']) + + # if the plugin links to libmapnik ensure it is built first + Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + + if 'uninstall' not in COMMAND_LINE_TARGETS: + env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET) + env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) + +plugin_obj = { + 'CXXFLAGS': cxxflags, + 'LIBS': libraries, + 'SOURCES': plugin_sources, +} -if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin) - env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) +Return('plugin_obj') diff -Nru mapnik-2.1.0/plugins/input/ogr/ogr_converter.cpp mapnik-2.2.0/plugins/input/ogr/ogr_converter.cpp --- mapnik-2.1.0/plugins/input/ogr/ogr_converter.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/ogr/ogr_converter.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -111,21 +111,21 @@ std::auto_ptr poly(new geometry_type(mapnik::Polygon)); poly->move_to(exterior->getX(0), exterior->getY(0)); - for (int i = 1; i < num_points - 1; ++i) + for (int i = 1; i < num_points; ++i) { poly->line_to(exterior->getX(i), exterior->getY(i)); } - poly->close(exterior->getX(num_points-1), exterior->getY(num_points-1)); + poly->close_path(); for (int r = 0; r < num_interior; ++r) { OGRLinearRing* interior = geom->getInteriorRing(r); num_points = interior->getNumPoints(); poly->move_to(interior->getX(0), interior->getY(0)); - for (int i = 1; i < num_points - 1; ++i) + for (int i = 1; i < num_points; ++i) { poly->line_to(interior->getX(i), interior->getY(i)); } - poly->close(interior->getX(num_points-1), interior->getY(num_points-1)); + poly->close_path(); } feature->paths().push_back(poly); } diff -Nru mapnik-2.1.0/plugins/input/ogr/ogr_datasource.cpp mapnik-2.2.0/plugins/input/ogr/ogr_datasource.cpp --- mapnik-2.1.0/plugins/input/ogr/ogr_datasource.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/ogr/ogr_datasource.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,7 +23,6 @@ #include "ogr_datasource.hpp" #include "ogr_featureset.hpp" #include "ogr_index_featureset.hpp" -#include "ogr_feature_ptr.hpp" #include @@ -32,14 +31,15 @@ #include #include #include +#include // boost #include #include // stl -#include #include +#include #include using mapnik::datasource; @@ -58,13 +58,32 @@ using mapnik::filter_at_point; -ogr_datasource::ogr_datasource(parameters const& params, bool bind) +ogr_datasource::ogr_datasource(parameters const& params) : datasource(params), extent_(), type_(datasource::Vector), - desc_(*params_.get("type"), *params_.get("encoding", "utf-8")), + desc_(*params.get("type"), *params.get("encoding", "utf-8")), indexed_(false) { + init(params); +} + +ogr_datasource::~ogr_datasource() +{ + // free layer before destroying the datasource + layer_.free_layer(); + OGRDataSource::DestroyDataSource (dataset_); +} + +void ogr_datasource::init(mapnik::parameters const& params) +{ +#ifdef MAPNIK_STATS + mapnik::progress_timer __stats__(std::clog, "ogr_datasource::init"); +#endif + + // initialize ogr formats + OGRRegisterAll(); + boost::optional file = params.get("file"); boost::optional string = params.get("string"); if (! file && ! string) @@ -89,35 +108,7 @@ } } - if (bind) - { - this->bind(); - } -} - -ogr_datasource::~ogr_datasource() -{ - if (is_bound_) - { - // free layer before destroying the datasource - layer_.free_layer(); - - OGRDataSource::DestroyDataSource (dataset_); - } -} - -void ogr_datasource::bind() const -{ - if (is_bound_) return; - -#ifdef MAPNIK_STATS - mapnik::progress_timer __stats__(std::clog, "ogr_datasource::bind"); -#endif - - // initialize ogr formats - OGRRegisterAll(); - - std::string driver = *params_.get("driver",""); + std::string driver = *params.get("driver",""); if (! driver.empty()) { @@ -148,9 +139,9 @@ } // initialize layer - boost::optional layer_by_name = params_.get("layer"); - boost::optional layer_by_index = params_.get("layer_by_index"); - boost::optional layer_by_sql = params_.get("layer_by_sql"); + boost::optional layer_by_name = params.get("layer"); + boost::optional layer_by_index = params.get("layer_by_index"); + boost::optional layer_by_sql = params.get("layer_by_sql"); int passed_parameters = 0; passed_parameters += layer_by_name ? 1 : 0; @@ -172,14 +163,11 @@ } else if (layer_by_index) { - const unsigned num_layers = dataset_->GetLayerCount(); + int num_layers = dataset_->GetLayerCount(); if (*layer_by_index >= num_layers) { - std::ostringstream s; - s << "OGR Plugin: only "; - s << num_layers; - s << " layer(s) exist, cannot find layer by index '" << *layer_by_index << "'"; - + std::ostringstream s("OGR Plugin: only "); + s << num_layers << " layer(s) exist, cannot find layer by index '" << *layer_by_index << "'"; throw datasource_exception(s.str()); } @@ -189,7 +177,7 @@ else if (layer_by_sql) { #ifdef MAPNIK_STATS - mapnik::progress_timer __stats_sql__(std::clog, "ogr_datasource::bind(layer_by_sql)"); + mapnik::progress_timer __stats_sql__(std::clog, "ogr_datasource::init(layer_by_sql)"); #endif layer_.layer_by_sql(dataset_, *layer_by_sql); @@ -197,12 +185,11 @@ } else { - std::ostringstream s; - s << "OGR Plugin: missing or or " - << "parameter, available layers are: "; + std::string s("OGR Plugin: missing or or parameter, available layers are: "); unsigned num_layers = dataset_->GetLayerCount(); bool layer_found = false; + std::vector layer_names; for (unsigned i = 0; i < num_layers; ++i ) { OGRLayer* ogr_layer = dataset_->GetLayer(i); @@ -210,16 +197,20 @@ if (ogr_layer_def != 0) { layer_found = true; - s << " '" << ogr_layer_def->GetName() << "' "; + layer_names.push_back(std::string("'") + ogr_layer_def->GetName() + std::string("'")); } } if (! layer_found) { - s << "None (no layers were found in dataset)"; + s += "None (no layers were found in dataset)"; + } + else + { + s += boost::algorithm::join(layer_names,", "); } - throw datasource_exception(s.str()); + throw datasource_exception(s); } if (! layer_.is_valid()) @@ -263,7 +254,12 @@ } index_name_ = dataset_name_.substr(0, breakpoint) + ".ogrindex"; +#if defined (_WINDOWS) + std::ifstream index_file(mapnik::utf8_to_utf16(index_name_), std::ios::in | std::ios::binary); +#else std::ifstream index_file(index_name_.c_str(), std::ios::in | std::ios::binary); +#endif + if (index_file) { indexed_ = true; @@ -279,7 +275,7 @@ #endif #ifdef MAPNIK_STATS - mapnik::progress_timer __stats2__(std::clog, "ogr_datasource::bind(get_column_description)"); + mapnik::progress_timer __stats2__(std::clog, "ogr_datasource::init(get_column_description)"); #endif // deal with attributes descriptions @@ -329,8 +325,6 @@ } } } - - is_bound_ = true; } const char * ogr_datasource::name() @@ -345,7 +339,6 @@ box2d ogr_datasource::envelope() const { - if (! is_bound_) bind(); return extent_; } @@ -385,14 +378,14 @@ // TODO - csv and shapefile inspect first 4 features if (dataset_ && layer_.is_valid()) { - OGRLayer* layer = layer_.layer(); + layer = layer_.layer(); // only new either reset of setNext //layer->ResetReading(); layer->SetNextByIndex(0); - ogr_feature_ptr feat(layer->GetNextFeature()); - if ((*feat) != NULL) + OGRFeature *poFeature; + while ((poFeature = layer->GetNextFeature()) != NULL) { - OGRGeometry* geom = (*feat)->GetGeometryRef(); + OGRGeometry* geom = poFeature->GetGeometryRef(); if (geom && ! geom->IsEmpty()) { switch (wkbFlatten(geom->getGeometryType())) @@ -417,6 +410,8 @@ break; } } + OGRFeature::DestroyFeature( poFeature ); + break; } } break; @@ -431,7 +426,6 @@ layer_descriptor ogr_datasource::get_descriptor() const { - if (! is_bound_) bind(); return desc_; } @@ -459,13 +453,13 @@ if (! found_name) { - std::ostringstream s; - std::vector::const_iterator itr = names.begin(); - std::vector::const_iterator end = names.end(); - s << "OGR Plugin: no attribute '" << *pos << "'. Valid attributes are: "; - for ( ;itr!=end;++itr) + std::ostringstream s("OGR Plugin: no attribute '"); + s << *pos << "'. Valid attributes are: "; + std::vector::const_iterator e_itr = names.begin(); + std::vector::const_iterator e_end = names.end(); + for ( ;e_itr!=e_end;++e_itr) { - s << itr->get_name() << std::endl; + s << e_itr->get_name() << std::endl; } throw mapnik::datasource_exception(s.str()); } @@ -474,8 +468,6 @@ featureset_ptr ogr_datasource::features(query const& q) const { - if (! is_bound_) bind(); - #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "ogr_datasource::features"); #endif @@ -519,10 +511,8 @@ return featureset_ptr(); } -featureset_ptr ogr_datasource::features_at_point(coord2d const& pt) const +featureset_ptr ogr_datasource::features_at_point(coord2d const& pt, double tol) const { - if (!is_bound_) bind(); - #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "ogr_datasource::features_at_point"); #endif @@ -541,7 +531,7 @@ if (indexed_) { - filter_at_point filter(pt); + filter_at_point filter(pt, tol); return featureset_ptr(new ogr_index_featureset (ctx, *layer, @@ -551,13 +541,11 @@ } else { - OGRPoint point; - point.setX (pt.x); - point.setY (pt.y); - + mapnik::box2d bbox(pt, pt); + bbox.pad(tol); return featureset_ptr(new ogr_featureset (ctx, *layer, - point, + bbox, desc_.get_encoding())); } } diff -Nru mapnik-2.1.0/plugins/input/ogr/ogr_datasource.hpp mapnik-2.2.0/plugins/input/ogr/ogr_datasource.hpp --- mapnik-2.1.0/plugins/input/ogr/ogr_datasource.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/ogr/ogr_datasource.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -47,27 +47,27 @@ class ogr_datasource : public mapnik::datasource { public: - ogr_datasource(mapnik::parameters const& params, bool bind=true); + ogr_datasource(mapnik::parameters const& params); virtual ~ogr_datasource (); mapnik::datasource::datasource_t type() const; static const char * name(); mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; + mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; mapnik::box2d envelope() const; boost::optional get_geometry_type() const; mapnik::layer_descriptor get_descriptor() const; - void bind() const; - + private: - mutable mapnik::box2d extent_; + void init(mapnik::parameters const& params); + mapnik::box2d extent_; mapnik::datasource::datasource_t type_; std::string dataset_name_; - mutable std::string index_name_; - mutable OGRDataSource* dataset_; - mutable ogr_layer_ptr layer_; - mutable std::string layer_name_; - mutable mapnik::layer_descriptor desc_; - mutable bool indexed_; + std::string index_name_; + OGRDataSource* dataset_; + ogr_layer_ptr layer_; + std::string layer_name_; + mapnik::layer_descriptor desc_; + bool indexed_; }; #endif // OGR_DATASOURCE_HPP diff -Nru mapnik-2.1.0/plugins/input/ogr/ogr_feature_ptr.hpp mapnik-2.2.0/plugins/input/ogr/ogr_feature_ptr.hpp --- mapnik-2.1.0/plugins/input/ogr/ogr_feature_ptr.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/ogr/ogr_feature_ptr.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef OGR_FEATURE_PTR_HPP -#define OGR_FEATURE_PTR_HPP - -// ogr -#include - -class ogr_feature_ptr -{ -public: - ogr_feature_ptr(OGRFeature* const feat) - : feat_(feat) - { - } - - ~ogr_feature_ptr() - { - if (feat_ != NULL) - { - OGRFeature::DestroyFeature(feat_); - } - } - - OGRFeature* operator*() - { - return feat_; - } - -private: - OGRFeature* feat_; -}; - -#endif // OGR_FEATURE_PTR_HPP diff -Nru mapnik-2.1.0/plugins/input/ogr/ogr_featureset.cpp mapnik-2.2.0/plugins/input/ogr/ogr_featureset.cpp --- mapnik-2.1.0/plugins/input/ogr/ogr_featureset.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/ogr/ogr_featureset.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,8 +22,8 @@ // mapnik #include +#include #include -#include #include #include #include @@ -35,11 +35,9 @@ // ogr #include "ogr_featureset.hpp" #include "ogr_converter.hpp" -#include "ogr_feature_ptr.hpp" using mapnik::query; using mapnik::box2d; -using mapnik::Feature; using mapnik::feature_ptr; using mapnik::geometry_utils; using mapnik::transcoder; @@ -84,23 +82,25 @@ feature_ptr ogr_featureset::next() { - ogr_feature_ptr feat (layer_.GetNextFeature()); - - if ((*feat) != NULL) + OGRFeature *poFeature; + while ((poFeature = layer_.GetNextFeature()) != NULL) { // ogr feature ids start at 0, so add one to stay // consistent with other mapnik datasources that start at 1 - const int feature_id = ((*feat)->GetFID() + 1); + mapnik::value_integer feature_id = (poFeature->GetFID() + 1); feature_ptr feature(feature_factory::create(ctx_,feature_id)); - OGRGeometry* geom = (*feat)->GetGeometryRef(); + OGRGeometry* geom = poFeature->GetGeometryRef(); if (geom && ! geom->IsEmpty()) { ogr_converter::convert_geometry(geom, feature); } else { - MAPNIK_LOG_DEBUG(ogr) << "ogr_featureset: Feature with null geometry=" << (*feat)->GetFID(); + MAPNIK_LOG_DEBUG(ogr) << "ogr_featureset: Feature with null geometry=" + << poFeature->GetFID(); + OGRFeature::DestroyFeature( poFeature ); + continue; } ++count_; @@ -116,20 +116,20 @@ { case OFTInteger: { - feature->put( fld_name, (*feat)->GetFieldAsInteger(i)); + feature->put( fld_name, poFeature->GetFieldAsInteger(i)); break; } case OFTReal: { - feature->put( fld_name, (*feat)->GetFieldAsDouble(i)); + feature->put( fld_name, poFeature->GetFieldAsDouble(i)); break; } case OFTString: case OFTWideString: // deprecated ! { - UnicodeString ustr = tr_->transcode((*feat)->GetFieldAsString(i)); + UnicodeString ustr = tr_->transcode(poFeature->GetFieldAsString(i)); feature->put( fld_name, ustr); break; } @@ -165,6 +165,7 @@ } } } + OGRFeature::DestroyFeature( poFeature ); return feature; } diff -Nru mapnik-2.1.0/plugins/input/ogr/ogr_featureset.hpp mapnik-2.2.0/plugins/input/ogr/ogr_featureset.hpp --- mapnik-2.1.0/plugins/input/ogr/ogr_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/ogr/ogr_featureset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,6 +24,7 @@ #define OGR_FEATURESET_HPP // mapnik +#include #include #include #include diff -Nru mapnik-2.1.0/plugins/input/ogr/ogr_index_featureset.cpp mapnik-2.2.0/plugins/input/ogr/ogr_index_featureset.cpp --- mapnik-2.1.0/plugins/input/ogr/ogr_index_featureset.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/ogr/ogr_index_featureset.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,9 +21,9 @@ *****************************************************************************/ // mapnik +#include #include #include -#include #include #include #include @@ -40,11 +40,9 @@ #include "ogr_index_featureset.hpp" #include "ogr_converter.hpp" #include "ogr_index.hpp" -#include "ogr_feature_ptr.hpp" using mapnik::query; using mapnik::box2d; -using mapnik::Feature; using mapnik::feature_ptr; using mapnik::geometry_utils; using mapnik::transcoder; @@ -61,10 +59,11 @@ layerdef_(layer.GetLayerDefn()), filter_(filter), tr_(new transcoder(encoding)), - fidcolumn_(layer_.GetFIDColumn()) + fidcolumn_(layer_.GetFIDColumn()), + feature_envelope_() { - boost::optional memory = mapnik::mapped_memory_cache::find(index_file.c_str(),true); + boost::optional memory = mapnik::mapped_memory_cache::instance().find(index_file, true); if (memory) { boost::interprocess::ibufferstream file(static_cast((*memory)->get_address()),(*memory)->get_size()); @@ -87,85 +86,94 @@ template feature_ptr ogr_index_featureset::next() { - if (itr_ != ids_.end()) + while (itr_ != ids_.end()) { int pos = *itr_++; layer_.SetNextByIndex (pos); - ogr_feature_ptr feat (layer_.GetNextFeature()); - if ((*feat) != NULL) + OGRFeature *poFeature = layer_.GetNextFeature(); + if (poFeature == NULL) { - // ogr feature ids start at 0, so add one to stay - // consistent with other mapnik datasources that start at 1 - int feature_id = ((*feat)->GetFID() + 1); - feature_ptr feature(feature_factory::create(ctx_,feature_id)); - - OGRGeometry* geom=(*feat)->GetGeometryRef(); - if (geom && !geom->IsEmpty()) - { - ogr_converter::convert_geometry (geom, feature); - } - else - { - MAPNIK_LOG_DEBUG(ogr) << "ogr_index_featureset: Feature with null geometry=" << (*feat)->GetFID(); - } - - int fld_count = layerdef_->GetFieldCount(); - for (int i = 0; i < fld_count; i++) - { - OGRFieldDefn* fld = layerdef_->GetFieldDefn (i); - OGRFieldType type_oid = fld->GetType (); - std::string fld_name = fld->GetNameRef (); - - switch (type_oid) - { - case OFTInteger: - { - feature->put(fld_name,(*feat)->GetFieldAsInteger (i)); - break; - } - - case OFTReal: - { - feature->put(fld_name,(*feat)->GetFieldAsDouble (i)); - break; - } - - case OFTString: - case OFTWideString: // deprecated ! - { - UnicodeString ustr = tr_->transcode((*feat)->GetFieldAsString (i)); - feature->put(fld_name,ustr); - break; - } - - case OFTIntegerList: - case OFTRealList: - case OFTStringList: - case OFTWideStringList: // deprecated ! - { - MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid; - break; - } - - case OFTBinary: - { - MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid; - //feature->put(name,feat->GetFieldAsBinary (i, size)); - break; - } - - case OFTDate: - case OFTTime: - case OFTDateTime: // unhandled ! - { - MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid; - break; - } - } + return feature_ptr(); + } + + // ogr feature ids start at 0, so add one to stay + // consistent with other mapnik datasources that start at 1 + mapnik::value_integer feature_id = (poFeature->GetFID() + 1); + feature_ptr feature(feature_factory::create(ctx_,feature_id)); + + OGRGeometry* geom=poFeature->GetGeometryRef(); + if (geom && !geom->IsEmpty()) + { + geom->getEnvelope(&feature_envelope_); + if (!filter_.pass(mapnik::box2d(feature_envelope_.MinX,feature_envelope_.MinY, + feature_envelope_.MaxX,feature_envelope_.MaxY))) continue; + ogr_converter::convert_geometry (geom, feature); + } + else + { + MAPNIK_LOG_DEBUG(ogr) << "ogr_index_featureset: Feature with null geometry=" + << poFeature->GetFID(); + OGRFeature::DestroyFeature( poFeature ); + continue; + } + + int fld_count = layerdef_->GetFieldCount(); + for (int i = 0; i < fld_count; i++) + { + OGRFieldDefn* fld = layerdef_->GetFieldDefn (i); + OGRFieldType type_oid = fld->GetType (); + std::string fld_name = fld->GetNameRef (); + + switch (type_oid) + { + case OFTInteger: + { + feature->put(fld_name,poFeature->GetFieldAsInteger (i)); + break; + } + + case OFTReal: + { + feature->put(fld_name,poFeature->GetFieldAsDouble (i)); + break; + } + + case OFTString: + case OFTWideString: // deprecated ! + { + UnicodeString ustr = tr_->transcode(poFeature->GetFieldAsString (i)); + feature->put(fld_name,ustr); + break; + } + + case OFTIntegerList: + case OFTRealList: + case OFTStringList: + case OFTWideStringList: // deprecated ! + { + MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid; + break; + } + + case OFTBinary: + { + MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid; + //feature->put(name,feat->GetFieldAsBinary (i, size)); + break; + } + + case OFTDate: + case OFTTime: + case OFTDateTime: // unhandled ! + { + MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid; + break; + } } - return feature; } + OGRFeature::DestroyFeature( poFeature ); + return feature; } return feature_ptr(); diff -Nru mapnik-2.1.0/plugins/input/ogr/ogr_index_featureset.hpp mapnik-2.2.0/plugins/input/ogr/ogr_index_featureset.hpp --- mapnik-2.1.0/plugins/input/ogr/ogr_index_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/ogr/ogr_index_featureset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,6 +26,7 @@ #include #include #include +#include #include "ogr_featureset.hpp" template @@ -49,6 +50,7 @@ std::vector::iterator itr_; boost::scoped_ptr tr_; const char* fidcolumn_; + OGREnvelope feature_envelope_; }; #endif // OGR_INDEX_FEATURESET_HPP diff -Nru mapnik-2.1.0/plugins/input/ogr/ogr_layer_ptr.hpp mapnik-2.2.0/plugins/input/ogr/ogr_layer_ptr.hpp --- mapnik-2.1.0/plugins/input/ogr/ogr_layer_ptr.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/ogr/ogr_layer_ptr.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -27,8 +27,6 @@ #include // stl -#include -#include #include // ogr @@ -65,7 +63,7 @@ } void layer_by_name(OGRDataSource* const datasource, - const std::string& layer_name) + std::string const& layer_name) { free_layer(); @@ -113,7 +111,7 @@ } void layer_by_sql(OGRDataSource* const datasource, - const std::string& layer_sql) + std::string const& layer_sql) { free_layer(); @@ -146,7 +144,7 @@ #endif } - const std::string& layer_name() const + std::string const& layer_name() const { return layer_name_; } diff -Nru mapnik-2.1.0/plugins/input/osm/build.py mapnik-2.2.0/plugins/input/osm/build.py --- mapnik-2.1.0/plugins/input/osm/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/osm/build.py 2013-06-04 01:35:27.000000000 +0000 @@ -1,7 +1,7 @@ # # This file is part of Mapnik (c++ mapping toolkit) # -# Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon +# Copyright (C) 2013 Artem Pavlenko # # Mapnik is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,38 +17,52 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# Import ('plugin_base') Import ('env') -prefix = env['PREFIX'] +PLUGIN_NAME = 'osm' plugin_env = plugin_base.Clone() -osm_src = Split( +plugin_sources = Split( """ + %(PLUGIN_NAME)s.cpp + %(PLUGIN_NAME)s_datasource.cpp + %(PLUGIN_NAME)s_featureset.cpp osmparser.cpp - osm.cpp - osm_datasource.cpp - osm_featureset.cpp dataset_deliverer.cpp basiccurl.cpp - """ - ) + """ % locals() +) +# Link Library to Dependencies libraries = [ 'xml2' ] libraries.append('curl') -libraries.append('mapnik') libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) -libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) -input_plugin = plugin_env.SharedLibrary('../osm', source=osm_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) +if env['PLUGIN_LINKING'] == 'shared': + libraries.append('mapnik') -# if the plugin links to libmapnik ensure it is built first -Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, + SHLIBPREFIX='', + SHLIBSUFFIX='.input', + source=plugin_sources, + LIBS=libraries, + LINKFLAGS=env['CUSTOM_LDFLAGS']) + + # if the plugin links to libmapnik ensure it is built first + Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + + if 'uninstall' not in COMMAND_LINE_TARGETS: + env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET) + env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) + +plugin_obj = { + 'LIBS': libraries, + 'SOURCES': plugin_sources, +} -if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin) - env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) +Return('plugin_obj') diff -Nru mapnik-2.1.0/plugins/input/osm/dataset_deliverer.cpp mapnik-2.2.0/plugins/input/osm/dataset_deliverer.cpp --- mapnik-2.1.0/plugins/input/osm/dataset_deliverer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/osm/dataset_deliverer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,9 +23,7 @@ // mapnik #include #include - -// boost -#include +#include // std #include @@ -42,7 +40,7 @@ // Only actually load from file if we haven't done so already if (dataset == NULL) { - if (!boost::filesystem::exists(file)) + if (!mapnik::util::exists(file)) { throw mapnik::datasource_exception("OSM Plugin: '" + file + "' does not exist"); } diff -Nru mapnik-2.1.0/plugins/input/osm/dataset_deliverer.h mapnik-2.2.0/plugins/input/osm/dataset_deliverer.h --- mapnik-2.1.0/plugins/input/osm/dataset_deliverer.h 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/osm/dataset_deliverer.h 2013-06-04 01:35:27.000000000 +0000 @@ -25,7 +25,6 @@ #include "osm.h" #include -#include using namespace std; diff -Nru mapnik-2.1.0/plugins/input/osm/demo/GoogleProjection.h mapnik-2.2.0/plugins/input/osm/demo/GoogleProjection.h --- mapnik-2.1.0/plugins/input/osm/demo/GoogleProjection.h 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/osm/demo/GoogleProjection.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,97 +0,0 @@ -#ifndef GOOGLEPROJECTION_H -#define GOOGLEPROJECTION_H - -#include -using std::vector; -#include - -#define max(a,b) (((a)>(b))?(a):(b)) -#define min(a,b) (((a)<(b))?(a):(b)) - -struct ScreenPos -{ - int x,y; - ScreenPos() { x=y=0; } - ScreenPos(int x,int y) { this->x=x; this->y=y; } -}; - -struct EarthPoint -{ - double x,y; - EarthPoint() { x=y=0.0; } - EarthPoint(double x,double y) { this->x=x; this->y=y; } -}; - -class GoogleProjection -{ - private: - - vector Bc,Cc,zc,Ac; - int levels; - - double minmax (double a,double b, double c) - { - a = max(a,b); - a = min(a,c); - return a; - } - - public: - GoogleProjection(int levels=18) - { - this->levels=levels; - double c = 256; - double e; - for (int d=0; d - - -void MapSource::process_cmd_line_args(int argc,char *argv[]) -{ - std::string bbox=""; - - - argc--; - argv++; - - width=800; - height=600; - - while(argc>0) - { - if(argv[0][0]=='-' && strlen(argv[0])>1) - { - switch(argv[0][1]) - { - case 's': setSource(argv[1]); - argv+=2; - argc-=2; - break; - - case 'w': width=atoi(argv[1]); - argv+=2; - argc-=2; - break; - - case 'h': height=atoi(argv[1]); - argv+=2; - argc-=2; - break; - - case 'x': xmlfile=argv[1]; - argv+=2; - argc-=2; - break; - - case 'i': osmfile=argv[1]; - argv+=2; - argc-=2; - break; - - case 'b': bbox=argv[1]; - argv+=2; - argc-=2; - break; - - case 'z': zoom_start=atoi(argv[1]); - argv+=2; - argc-=2; - break; - - case 'Z': zoom_end=atoi(argv[1]); - argv+=2; - argc-=2; - break; - - case 't': tiled=true; - argv+=1; - argc-=1; - break; - - case 'm': multirqst=true; - argv+=1; - argc-=1; - break; - - case 'u': url=argv[1]; - argv+=2; - argc-=2; - break; - - case 'o': outfile=argv[1]; - argv+=2; - argc-=2; - break; - - case 'r': srtm=true; - argv++; - argc--; - break; - } - } - else - { - argv++; - argc--; - } - } - - - if(bbox!="") - { - typedef boost::tokenizer > tokenizer; - boost::char_separator comma(","); - tokenizer t (bbox,comma); - int count=0; - for(tokenizer::iterator i=t.begin(); i!=t.end(); i++) - { - if(count==0) - w=atof(i->c_str()); - else if (count==1) - s=atof(i->c_str()); - else if (count==2) - e=atof(i->c_str()); - else if (count==3) - n=atof(i->c_str()); - count++; - } - } - - if(zoom_end == -1) - zoom_end = zoom_start; - if(tiled) - width=height=256+(32*2); -} - -void MapSource::generateMaps() -{ - GoogleProjection proj; - if(tiled) - { - ScreenPos topLeft = (proj.fromLLToPixel(w,n,zoom_start)) , - bottomRight = (proj.fromLLToPixel(e,s,zoom_start)) ; - - topLeft.x /= 256; - topLeft.y /= 256; - bottomRight.x /= 256; - bottomRight.y /= 256; - - int x_fetch_freq, y_fetch_freq, x_fetches, y_fetches; - - if(multirqst) - { - // Gives a value approx equal to 0.1 lat/lon in southern UK - x_fetch_freq = (int)(pow(2.0,zoom_start-11)); - y_fetch_freq = (int)(pow(2.0,zoom_start-11)); - x_fetches = ((bottomRight.x-topLeft.x) / x_fetch_freq)+1, - y_fetches = ((bottomRight.y-topLeft.y) / y_fetch_freq)+1; - } - else - { - x_fetch_freq = bottomRight.x - topLeft.x; - y_fetch_freq = bottomRight.y - topLeft.y; - x_fetches = 1; - y_fetches = 1; - } - - fprintf(stderr,"topLeft: %d %d\n",topLeft.x,topLeft.y); - fprintf(stderr,"bottomRight: %d %d\n",bottomRight.x,bottomRight.y); - fprintf(stderr,"xfetches yfetches: %d %d\n",x_fetches, y_fetches); - - for(int xfetch=0; xfetch bb - (metres_w-32*metres_per_pixel, - metres_s-32*metres_per_pixel, - metres_e+32*metres_per_pixel, - metres_n+32*metres_per_pixel); - - m.zoom_to_box(bb); - agg_renderer r(m,buf); - r.apply(); - - string filename=""; - std::ostringstream str; - str<< z<< "."<(buf.data(), - "tmp.png","png"); - FILE *in=fopen("tmp.png","r"); - FILE *out=fopen(str.str().c_str(),"w"); - - gdImagePtr image, image2; - image=gdImageCreateTrueColor(256,256); - image2=gdImageCreateFromPng(in); - gdImageCopy(image,image2,0,0,32,32,256,256); - gdImagePng(image,out); - gdImageDestroy(image2); - gdImageDestroy(image); - fclose(out); - fclose(in); - } - } - metres_per_pixel /= 2; - } - } - } - } - else - { - // standard rendering - Map m(width,height); - parameters p; - p["type"] = "osm"; - p["file"] = osmfile; - load_map(m,xmlfile); - setOSMLayers(m,p); - - box2d latlon= - (hasBbox()) ? - box2d(w,s,e,n): - m.getLayer(0).envelope(); - - EarthPoint bottomL_LL = - GoogleProjection::fromLLToGoog(latlon.minx(),latlon.miny()), - topR_LL = - GoogleProjection::fromLLToGoog(latlon.maxx(),latlon.maxy()); - box2d bb = - box2d(bottomL_LL.x,bottomL_LL.y, - topR_LL.x,topR_LL.y); - m.zoom_to_box(bb); - image_32 buf (m.width(), m.height()); - agg_renderer r(m,buf); - r.apply(); - - save_to_file(buf.data(),outfile,"png"); - } -} - -void MapSource::setOSMLayers(Map& m, const parameters &p) -{ - parameters q; - for(int count=0; countparams(); - if(boost::get(q["type"])=="osm") - { - m.getLayer(count).set_datasource - (datasource_cache::instance()->create(p)); - } - } -} - -void MapSource::addSRTMLayers(Map& m,double w,double s,double e,double n) -{ - // Get the layers from the map - vector layers=m.layers(); - cerr<<"***addSRTMLayers():w s e n="<=0 ? "E":"W") << setw(3)<=0 ? lon:-lon)<<"c10"; - p["file"] = str.str(); - cerr<<"ADDING SRTM LAYER: " << p["file"] << endl; - m.getLayer(i).set_datasource(datasource_cache::instance()->create(p)); - - // do we have more than one srtm layer? - if(floor(w) != floor(e) || floor(s) != floor(n)) - { - // remove all layers after the SRTM layer. This is because there - // are multiple SRTM layers (if the current tile spans a lat/lon square - // boundary) - for(int j=i+1; j=0 ? "E":"W") << setw(3)<=0 ? lon:-lon)<<"c10"; - p["file"] = str.str(); - cerr<<"ADDING SRTM LAYER: " << p["file"] << endl; - layer lyr("srtm_" + str.str()); - lyr.add_style("contours"); - lyr.add_style("contours-text"); - lyr.set_datasource - (datasource_cache::instance()->create(p)); - m.addLayer(lyr); - } - } - } - // Add the other layers back - for(int j=i+1; j -#include -#include -using namespace std; - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "MapSource.h" -#include "GoogleProjection.h" - - -using namespace mapnik; - - -class MapSource -{ -private: - std::string source; // osm. postgis or api - std::string osmfile; - std::string xmlfile; - std::string url; - std::string outfile; - int width, height; - double w,s,e,n; - bool useBbox, tiled, multirqst; - int zoom_start,zoom_end; - bool srtm; - - static void setOSMLayers(Map& m, const parameters &p); - static void addSRTMLayers(Map& m,double w,double s,double e,double n); - -public: - MapSource() - { - osmfile=""; - source=""; - xmlfile=""; - outfile=""; - width=height=-1; - w=-181; - e=181; - n=91; - s=-91; - zoom_start=zoom_end=-1; - tiled=false; - multirqst=false; - url="http://xapi.openstreetmap.org/api/0.5/map"; - //url="http://osmxapi.hypercube.telascience.org/api/0.5/map"; - srtm=false; - } - - - bool isValid() - { - return xmlfile!="" && ((tiled==false&&outfile!="" && - width>0 && height>0) || - (tiled==true&&zoom_start>=0)) && - ((source=="osm" && osmfile!="" && width>0 && height>0) || - (source=="api" && hasBbox() && zoom_start>=0 && tiled==true)); - } - - void setSource(std::string const& src) - { - if(src=="api" || src=="osm") - { - source=src; - } - } - - std::string getSource() - { - return source; - } - - bool hasBbox() - { - return w>=-180 && w<=180 && s>=-90 && s<=90 - && e>=-180 && e<=180 && n>=-90 && n<=90 && w=2 && !strcmp(argv[1],"-h"))) - { - usage(); - help(); - exit(0); - } - - - MapSource s ; - s.process_cmd_line_args(argc,argv); - - if(!s.isValid()) - { - cerr << "Invalid combination of command-line parameters!" << endl<register_datasources - ("/usr/local/lib/mapnik/input"); - freetype_engine::register_font - ("/usr/local/lib/mapnik/fonts/DejaVuSans.ttf"); - - s.generateMaps(); - - - return 0; -} - - - -void usage() -{ - cerr << "Usage: easymapnik -s source [-w width] [-h height] -x xmlfile " - << endl << - "[-i InOSMFile] [-o OutPNGFile] [-t] [-z startzoom] [-Z endzoom] " - << endl << - "[-b bbox] [-u serverURL] [-m]" << endl << endl; -} - - -void help() -{ - cerr << "Source should be 'osm' or 'api', indicating OSM files and " - << endl << "retrieval direct from a server (e.g. OSMXAPI) respectively." - << endl << - "-t indicates tiled mode (generate 'Google' style tiles); you must " - << endl << - "supply at least a start zoom, and a bounding box, for this." - << endl << - "-m means 'multirequest'; if you're requesting a relatively large " - << endl << - "area from the server (e.g. OSMXAPI), it will fetch it in " - << "0.1x0.1 degree tiles. " - << endl << "This speeds up processing considerably." << endl; - exit(1); -} diff -Nru mapnik-2.1.0/plugins/input/osm/osm.cpp mapnik-2.2.0/plugins/input/osm/osm.cpp --- mapnik-2.1.0/plugins/input/osm/osm.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/osm/osm.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -34,7 +34,7 @@ polygon_types osm_way::ptypes; -bool osm_dataset::load(const char* filename,const std::string& parser) +bool osm_dataset::load(const char* filename,std::string const& parser) { if (parser == "libxml2") { @@ -43,9 +43,9 @@ return false; } -bool osm_dataset::load_from_url(const std::string& url, - const std::string& bbox, - const std::string& parser) +bool osm_dataset::load_from_url(std::string const& url, + std::string const& bbox, + std::string const& parser) { if (parser == "libxml2") { @@ -254,7 +254,7 @@ for (unsigned int count = 0; count < ptypes.ptypes.size(); ++count) { if (keyvals.find(ptypes.ptypes[count].first) != keyvals.end() && - keyvals[ptypes.ptypes[count].first] == ptypes.ptypes[count].second) + (ptypes.ptypes[count].second.empty() || keyvals[ptypes.ptypes[count].first] == ptypes.ptypes[count].second)) { return true; } diff -Nru mapnik-2.1.0/plugins/input/osm/osm.h mapnik-2.2.0/plugins/input/osm/osm.h --- mapnik-2.1.0/plugins/input/osm/osm.h 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/osm/osm.h 2013-06-04 01:35:27.000000000 +0000 @@ -23,6 +23,7 @@ #ifndef OSM_H #define OSM_H +#include #include #include #include @@ -33,12 +34,12 @@ { double w, s, e, n; bounds() { w = -180; s = -90; e = 180; n = 90; } - bounds(double w, double s, double e, double n) + bounds(double w_, double s_, double e_, double n_) { - this->w = w; - this->s = s; - this->e = e; - this->n = n; + this->w = w_; + this->s = s_; + this->e = e_; + this->n = n_; } }; @@ -49,19 +50,23 @@ polygon_types() { + ptypes.push_back(std::pair("water", "")); + ptypes.push_back(std::pair("aeroway", "")); + ptypes.push_back(std::pair("building", "")); ptypes.push_back(std::pair("natural", "wood")); ptypes.push_back(std::pair("natural", "water")); ptypes.push_back(std::pair("natural", "heath")); ptypes.push_back(std::pair("natural", "marsh")); ptypes.push_back(std::pair("military", "danger_area")); - ptypes.push_back(std::pair("landuse","forest")); - ptypes.push_back(std::pair("landuse","industrial")); + ptypes.push_back(std::pair("landuse", "forest")); + ptypes.push_back(std::pair("landuse", "industrial")); + ptypes.push_back(std::pair("leisure", "park")); } }; struct osm_item { - long id; + mapnik::value_integer id; std::map keyvals; virtual std::string to_string(); virtual ~osm_item() {} @@ -102,10 +107,10 @@ ~osm_dataset(); - bool load(const char* name, const std::string& parser = "libxml2"); - bool load_from_url(const std::string&, - const std::string&, - const std::string& parser = "libxml2"); + bool load(const char* name, std::string const& parser = "libxml2"); + bool load_from_url(std::string const&, + std::string const&, + std::string const& parser = "libxml2"); void clear(); void add_node(osm_node* n) { nodes.push_back(n); } void add_way(osm_way* w) { ways.push_back(w); } diff -Nru mapnik-2.1.0/plugins/input/osm/osm_datasource.cpp mapnik-2.2.0/plugins/input/osm/osm_datasource.cpp --- mapnik-2.1.0/plugins/input/osm/osm_datasource.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/osm/osm_datasource.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,9 +21,6 @@ *****************************************************************************/ // stl -#include -#include -#include #include #include @@ -52,28 +49,17 @@ DATASOURCE_PLUGIN(osm_datasource) -osm_datasource::osm_datasource(const parameters& params, bool bind) +osm_datasource::osm_datasource(const parameters& params) : datasource (params), extent_(), type_(datasource::Vector), - desc_(*params_.get("type"), *params_.get("encoding", "utf-8")) + desc_(*params.get("type"), *params.get("encoding", "utf-8")) { - if (bind) - { - this->bind(); - } -} - -void osm_datasource::bind() const -{ - if (is_bound_) return; - osm_data_ = NULL; - std::string osm_filename = *params_.get("file", ""); - std::string parser = *params_.get("parser", "libxml2"); - std::string url = *params_.get("url", ""); - std::string bbox = *params_.get("bbox", ""); - + std::string osm_filename = *params.get("file", ""); + std::string parser = *params.get("parser", "libxml2"); + std::string url = *params.get("url", ""); + std::string bbox = *params.get("bbox", ""); // load the data if (url != "" && bbox != "") @@ -91,9 +77,9 @@ // if we supplied a filename, load from file if ((osm_data_ = dataset_deliverer::load_from_file(osm_filename, parser)) == NULL) { - std::ostringstream s; - s << "OSM Plugin: Error loading from file '" << osm_filename << "'"; - throw datasource_exception(s.str()); + std::string s("OSM Plugin: Error loading from file '"); + s += osm_filename + "'"; + throw datasource_exception(s); } } else @@ -121,7 +107,6 @@ // Get the bounds of the data and set extent_ accordingly bounds b = osm_data_->get_bounds(); extent_ = box2d(b.w, b.s, b.e, b.n); - is_bound_ = true; } osm_datasource::~osm_datasource() @@ -147,8 +132,6 @@ featureset_ptr osm_datasource::features(const query& q) const { - if (!is_bound_) bind(); - filter_in_box filter(q.get_bbox()); // so we need to filter osm features by bbox here... @@ -158,10 +141,8 @@ desc_.get_encoding()); } -featureset_ptr osm_datasource::features_at_point(coord2d const& pt) const +featureset_ptr osm_datasource::features_at_point(coord2d const& pt, double tol) const { - if (!is_bound_) bind(); - filter_at_point filter(pt); // collect all attribute names std::vector const& desc_vector = desc_.get_descriptors(); @@ -183,12 +164,10 @@ box2d osm_datasource::envelope() const { - if (!is_bound_) bind(); return extent_; } boost::optional osm_datasource::get_geometry_type() const { - if (! is_bound_) bind(); return boost::optional(mapnik::datasource::Collection); } diff -Nru mapnik-2.1.0/plugins/input/osm/osm_datasource.hpp mapnik-2.2.0/plugins/input/osm/osm_datasource.hpp --- mapnik-2.1.0/plugins/input/osm/osm_datasource.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/osm/osm_datasource.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -53,22 +53,21 @@ class osm_datasource : public datasource { public: - osm_datasource(const parameters& params, bool bind = true); + osm_datasource(const parameters& params); virtual ~osm_datasource(); mapnik::datasource::datasource_t type() const; static const char * name(); featureset_ptr features(const query& q) const; - featureset_ptr features_at_point(coord2d const& pt) const; + featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const; box2d envelope() const; boost::optional get_geometry_type() const; layer_descriptor get_descriptor() const; - void bind() const; private: - mutable box2d extent_; - mutable osm_dataset* osm_data_; + box2d extent_; + osm_dataset* osm_data_; mapnik::datasource::datasource_t type_; - mutable layer_descriptor desc_; + layer_descriptor desc_; }; #endif // OSM_DATASOURCE_HPP diff -Nru mapnik-2.1.0/plugins/input/osm/osm_featureset.cpp mapnik-2.2.0/plugins/input/osm/osm_featureset.cpp --- mapnik-2.1.0/plugins/input/osm/osm_featureset.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/osm/osm_featureset.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,17 +21,18 @@ * *****************************************************************************/ -// stl -#include - // mapnik #include +#include #include #include +#include + +// boost +#include #include "osm_featureset.hpp" -using mapnik::Feature; using mapnik::feature_ptr; using mapnik::geometry_type; using mapnik::feature_factory; @@ -45,7 +46,6 @@ : filter_(filter), query_ext_(), tr_(new transcoder(encoding)), - feature_id_(1), dataset_ (dataset), attribute_names_ (attribute_names), ctx_(boost::make_shared()) @@ -62,8 +62,7 @@ if (!cur_item) return feature_ptr(); if (dataset_->current_item_is_node()) { - feature = feature_factory::create(ctx_, feature_id_); - ++feature_id_; + feature = feature_factory::create(ctx_, cur_item->id); double lat = static_cast(cur_item)->lat; double lon = static_cast(cur_item)->lon; geometry_type* point = new geometry_type(mapnik::Point); @@ -83,8 +82,7 @@ } if (!cur_item) return feature_ptr(); - feature = feature_factory::create(ctx_, feature_id_); - ++feature_id_; + feature = feature_factory::create(ctx_, cur_item->id); geometry_type* geom; if (static_cast(cur_item)->is_polygon()) { @@ -121,9 +119,6 @@ if (i != end_keyvals) { feature->put_new(i->first, tr_->transcode(i->second.c_str())); - } else - { - feature->put_new(*itr, ""); } } return feature; diff -Nru mapnik-2.1.0/plugins/input/osm/osm_featureset.hpp mapnik-2.2.0/plugins/input/osm/osm_featureset.hpp --- mapnik-2.1.0/plugins/input/osm/osm_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/osm/osm_featureset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -61,7 +61,6 @@ std::vector attr_ids_; mutable box2d feature_ext_; mutable int total_geom_size; - mutable int feature_id_; osm_dataset *dataset_; std::set attribute_names_; mapnik::context_ptr ctx_; diff -Nru mapnik-2.1.0/plugins/input/osm/osmparser.cpp mapnik-2.2.0/plugins/input/osm/osmparser.cpp --- mapnik-2.1.0/plugins/input/osm/osmparser.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/osm/osmparser.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -5,10 +5,8 @@ #include #include -using std::endl; - osm_item* osmparser::cur_item=NULL; -long osmparser::curID=0; +mapnik::value_integer osmparser::curID=0; bool osmparser::in_node=false, osmparser::in_way=false; osm_dataset* osmparser::components=NULL; std::string osmparser::error=""; @@ -66,16 +64,6 @@ assert(xid); way->id = atol((char*)xid); cur_item = way; - // Prevent ways with no name being assigned a name of "0" - cur_item->keyvals["name"] = ""; - - // HACK: allows comparison with "" in the XML file. Otherwise it - // doesn't work. Only do for the most crucial tags for Freemap's - // purposes. TODO investigate why this is - cur_item->keyvals["width"] = ""; - cur_item->keyvals["horse"] = ""; - cur_item->keyvals["foot"] = ""; - cur_item->keyvals["bicycle"] = ""; xmlFree(xid); } else if (xmlStrEqual(name,BAD_CAST "nd")) diff -Nru mapnik-2.1.0/plugins/input/osm/osmparser.h mapnik-2.2.0/plugins/input/osm/osmparser.h --- mapnik-2.1.0/plugins/input/osm/osmparser.h 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/osm/osmparser.h 2013-06-04 01:35:27.000000000 +0000 @@ -23,10 +23,10 @@ #ifndef OSMPARSER_H #define OSMPARSER_H +#include #include #include #include -#include #include #include "osm.h" #include @@ -42,7 +42,7 @@ private: static osm_item *cur_item; - static long curID; + static mapnik::value_integer curID; static bool in_node, in_way; static osm_dataset* components; static std::string error; diff -Nru mapnik-2.1.0/plugins/input/osm/render.cpp mapnik-2.2.0/plugins/input/osm/render.cpp --- mapnik-2.1.0/plugins/input/osm/render.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/osm/render.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -43,7 +43,7 @@ exit(0); } - mapnik::datasource_cache::instance()->register_datasources("/usr/local/lib/mapnik/input"); + mapnik::datasource_cache::instance().register_datasources("/usr/local/lib/mapnik/input"); mapnik::freetype_engine::register_font("/usr/local/lib/mapnik/fonts/DejaVuSans.ttf"); mapnik::Map m(800, 800); @@ -57,7 +57,7 @@ for (int count = 0; count < m.layer_count(); count++) { mapnik::parameters q = m.getLayer(count).datasource()->params(); - m.getLayer(count).set_datasource(mapnik::datasource_cache::instance()->create(p)); + m.getLayer(count).set_datasource(mapnik::datasource_cache::instance().create(p)); } } diff -Nru mapnik-2.1.0/plugins/input/postgis/build.py mapnik-2.2.0/plugins/input/postgis/build.py --- mapnik-2.1.0/plugins/input/postgis/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/postgis/build.py 2013-06-04 01:35:27.000000000 +0000 @@ -1,7 +1,7 @@ # # This file is part of Mapnik (c++ mapping toolkit) # -# Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon +# Copyright (C) 2013 Artem Pavlenko # # Mapnik is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,44 +17,57 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# Import ('plugin_base') Import ('env') -prefix = env['PREFIX'] +PLUGIN_NAME = 'postgis' plugin_env = plugin_base.Clone() -postgis_src = Split( - """ - postgis_datasource.cpp - postgis_featureset.cpp +plugin_sources = Split( """ - ) - -# clear out and rebuild libs -plugin_env['LIBS'] = ['pq'] + %(PLUGIN_NAME)s_datasource.cpp + %(PLUGIN_NAME)s_featureset.cpp + """ % locals() +) # Link Library to Dependencies -plugin_env['LIBS'].append('mapnik') -plugin_env['LIBS'].append('boost_system%s' % env['BOOST_APPEND']) -plugin_env['LIBS'].append(env['ICU_LIB_NAME']) +libraries = ['pq'] +libraries.append('boost_system%s' % env['BOOST_APPEND']) +libraries.append(env['ICU_LIB_NAME']) + if env['THREADING'] == 'multi': - plugin_env['LIBS'].append('boost_thread%s' % env['BOOST_APPEND']) + libraries.append('boost_thread%s' % env['BOOST_APPEND']) if env['RUNTIME_LINK'] == 'static': #cmd = 'pg_config --libs' #plugin_env.ParseConfig(cmd) # pg_config does not seem to report correct deps of libpq # so resort to hardcoding for now - plugin_env['LIBS'].extend(['ldap','pam','ssl','crypto','krb5']) + libraries.extend(['ldap', 'pam', 'ssl', 'crypto', 'krb5']) -input_plugin = plugin_env.SharedLibrary('../postgis', source=postgis_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LINKFLAGS=env['CUSTOM_LDFLAGS']) +if env['PLUGIN_LINKING'] == 'shared': + libraries.append('mapnik') -# if the plugin links to libmapnik ensure it is built first -Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, + SHLIBPREFIX='', + SHLIBSUFFIX='.input', + source=plugin_sources, + LIBS=libraries, + LINKFLAGS=env['CUSTOM_LDFLAGS']) + + # if the plugin links to libmapnik ensure it is built first + Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + + if 'uninstall' not in COMMAND_LINE_TARGETS: + env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET) + env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) + +plugin_obj = { + 'LIBS': libraries, + 'SOURCES': plugin_sources, +} -if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin) - env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) +Return('plugin_obj') diff -Nru mapnik-2.1.0/plugins/input/postgis/connection.hpp mapnik-2.2.0/plugins/input/postgis/connection.hpp --- mapnik-2.1.0/plugins/input/postgis/connection.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/postgis/connection.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -44,34 +44,24 @@ class Connection { public: - Connection(std::string const& connection_str) + Connection(std::string const& connection_str,boost::optional const& password) : cursorId(0), closed_(false) { - conn_ = PQconnectdb(connection_str.c_str()); + std::string connect_with_pass = connection_str; + if (password && !password->empty()) + { + connect_with_pass += " password=" + *password; + } + conn_ = PQconnectdb(connect_with_pass.c_str()); if (PQstatus(conn_) != CONNECTION_OK) { - std::ostringstream s; - s << "Postgis Plugin: "; - if (conn_ ) - { - std::string msg = PQerrorMessage(conn_); - if (! msg.empty()) - { - s << msg.substr(0, msg.size() - 1); - } - else - { - s << "unable to connect to postgres server"; - } - } - else - { - s << "unable to connect to postgres server"; - } - s << "\n" << connection_str; - - throw mapnik::datasource_exception(s.str()); + std::string err_msg = "Postgis Plugin: "; + err_msg += status(); + err_msg += "\nConnection string: '"; + err_msg += connection_str; + err_msg += "'\n"; + throw mapnik::datasource_exception(err_msg); } } @@ -87,7 +77,7 @@ } } - bool execute(const std::string& sql) const + bool execute(std::string const& sql) const { #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, std::string("postgis_connection::execute ") + sql); @@ -99,7 +89,7 @@ return ok; } - boost::shared_ptr executeQuery(const std::string& sql, int type = 0) const + boost::shared_ptr executeQuery(std::string const& sql, int type = 0) const { #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, std::string("postgis_connection::execute_query ") + sql); @@ -117,34 +107,35 @@ if (! result || (PQresultStatus(result) != PGRES_TUPLES_OK)) { - std::ostringstream s; - s << "Postgis Plugin: PSQL error"; - if (conn_) - { - std::string msg = PQerrorMessage(conn_); - if (! msg.empty()) - { - s << ":\n" << msg.substr(0, msg.size() - 1); - } - - s << "\nFull sql was: '" << sql << "'\n"; - } - else - { - s << "unable to connect to database"; - } - + std::string err_msg = status(); + err_msg += "\nFull sql was: '"; + err_msg += sql; + err_msg += "'\n"; if (result) { PQclear(result); } - throw mapnik::datasource_exception(s.str()); + throw mapnik::datasource_exception(err_msg); } return boost::make_shared(result); } + std::string status() const + { + std::string status; + if (conn_) + { + status = PQerrorMessage(conn_); + } + else + { + status = "Uninitialized connection"; + } + return status; + } + std::string client_encoding() const { return PQparameterStatus(conn_, "client_encoding"); @@ -152,7 +143,7 @@ bool isOK() const { - return (PQstatus(conn_) != CONNECTION_BAD); + return (!closed_) && (PQstatus(conn_) != CONNECTION_BAD); } void close() diff -Nru mapnik-2.1.0/plugins/input/postgis/connection_manager.hpp mapnik-2.2.0/plugins/input/postgis/connection_manager.hpp --- mapnik-2.1.0/plugins/input/postgis/connection_manager.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/postgis/connection_manager.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -33,10 +33,6 @@ #include #include #include -#ifdef MAPNIK_THREADSAFE -#include -//using boost::mutex; -#endif // stl #include @@ -66,7 +62,7 @@ T* operator()() const { - return new T(connection_string()); + return new T(connection_string_safe(),pass_); } inline std::string id() const @@ -76,13 +72,19 @@ inline std::string connection_string() const { + std::string connect_str = connection_string_safe(); + if (pass_ && !pass_->empty()) connect_str += " password=" + *pass_; + return connect_str; + } + + inline std::string connection_string_safe() const + { std::string connect_str; - if (host_ && (*host_).size()) connect_str += "host=" + *host_; - if (port_ && (*port_).size()) connect_str += " port=" + *port_; - if (dbname_ && (*dbname_).size()) connect_str += " dbname=" + *dbname_; - if (user_ && (*user_).size()) connect_str += " user=" + *user_; - if (pass_ && (*pass_).size()) connect_str += " password=" + *pass_; - if (connect_timeout_ && (*connect_timeout_).size()) + if (host_ && !host_->empty()) connect_str += "host=" + *host_; + if (port_ && !port_->empty()) connect_str += " port=" + *port_; + if (dbname_ && !dbname_->empty()) connect_str += " dbname=" + *dbname_; + if (user_ && !user_->empty()) connect_str += " user=" + *user_; + if (connect_timeout_ && !connect_timeout_->empty()) connect_str +=" connect_timeout=" + *connect_timeout_; return connect_str; } @@ -109,24 +111,25 @@ bool registerPool(const ConnectionCreator& creator,unsigned initialSize,unsigned maxSize) { -#ifdef MAPNIK_THREADSAFE - //mutex::scoped_lock lock(mutex_); -#endif - if (pools_.find(creator.id())==pools_.end()) + ContType::const_iterator itr = pools_.find(creator.id()); + + if (itr != pools_.end()) { - return pools_.insert(std::make_pair(creator.id(), - boost::make_shared(creator,initialSize,maxSize))).second; + itr->second->set_initial_size(initialSize); + itr->second->set_max_size(maxSize); + } + else + { + return pools_.insert( + std::make_pair(creator.id(), + boost::make_shared(creator,initialSize,maxSize))).second; } - return false; } boost::shared_ptr getPool(std::string const& key) { -#ifdef MAPNIK_THREADSAFE - //mutex::scoped_lock lock(mutex_); -#endif ContType::const_iterator itr=pools_.find(key); if (itr!=pools_.end()) { @@ -136,19 +139,6 @@ return emptyPool; } - HolderType get(std::string const& key) - { -#ifdef MAPNIK_THREADSAFE - //mutex::scoped_lock lock(mutex_); -#endif - ContType::const_iterator itr=pools_.find(key); - if (itr!=pools_.end()) - { - boost::shared_ptr pool=itr->second; - return pool->borrowObject(); - } - return HolderType(); - } ConnectionManager() {} private: ConnectionManager(const ConnectionManager&); diff -Nru mapnik-2.1.0/plugins/input/postgis/postgis_datasource.cpp mapnik-2.2.0/plugins/input/postgis/postgis_datasource.cpp --- mapnik-2.1.0/plugins/input/postgis/postgis_datasource.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/postgis/postgis_datasource.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -31,6 +31,7 @@ #include #include #include +#include // boost #include @@ -52,85 +53,69 @@ const std::string postgis_datasource::SPATIAL_REF_SYS = "spatial_ref_system"; using boost::shared_ptr; -using mapnik::PoolGuard; using mapnik::attribute_descriptor; -postgis_datasource::postgis_datasource(parameters const& params, bool bind) +postgis_datasource::postgis_datasource(parameters const& params) : datasource(params), - table_(*params_.get("table", "")), + table_(*params.get("table", "")), schema_(""), - geometry_table_(*params_.get("geometry_table", "")), - geometry_field_(*params_.get("geometry_field", "")), - key_field_(*params_.get("key_field", "")), - cursor_fetch_size_(*params_.get("cursor_size", 0)), - row_limit_(*params_.get("row_limit", 0)), + geometry_table_(*params.get("geometry_table", "")), + geometry_field_(*params.get("geometry_field", "")), + key_field_(*params.get("key_field", "")), + cursor_fetch_size_(*params.get("cursor_size", 0)), + row_limit_(*params.get("row_limit", 0)), type_(datasource::Vector), - srid_(*params_.get("srid", 0)), + srid_(*params.get("srid", 0)), extent_initialized_(false), simplify_geometries_(false), - desc_(*params_.get("type"), "utf-8"), - creator_(params.get("host"), - params.get("port"), - params.get("dbname"), - params.get("user"), - params.get("password"), - params.get("connect_timeout", "4")), - bbox_token_("!bbox!"), - scale_denom_token_("!scale_denominator!"), - pixel_width_token_("!pixel_width!"), - pixel_height_token_("!pixel_height!"), - persist_connection_(*params_.get("persist_connection", true)), - extent_from_subquery_(*params_.get("extent_from_subquery", false)), - // params below are for testing purposes only (will likely be removed at any time) - intersect_min_scale_(*params_.get("intersect_min_scale", 0)), - intersect_max_scale_(*params_.get("intersect_max_scale", 0)) + desc_(*params.get("type"), "utf-8"), + creator_(params.get("host"), + params.get("port"), + params.get("dbname"), + params.get("user"), + params.get("password"), + params.get("connect_timeout", "4")), + bbox_token_("!bbox!"), + scale_denom_token_("!scale_denominator!"), + pixel_width_token_("!pixel_width!"), + pixel_height_token_("!pixel_height!"), + persist_connection_(*params.get("persist_connection", true)), + extent_from_subquery_(*params.get("extent_from_subquery", false)), +// params below are for testing purposes only (will likely be removed at any time) + intersect_min_scale_(*params.get("intersect_min_scale", 0)), + intersect_max_scale_(*params.get("intersect_max_scale", 0)) { +#ifdef MAPNIK_STATS + mapnik::progress_timer __stats__(std::clog, "postgis_datasource::init"); +#endif if (table_.empty()) { throw mapnik::datasource_exception("Postgis Plugin: missing
parameter"); } - boost::optional ext = params_.get("extent"); - if (ext) + boost::optional ext = params.get("extent"); + if (ext && !ext->empty()) { extent_initialized_ = extent_.from_string(*ext); } - if (bind) - { - this->bind(); - } -} - -void postgis_datasource::bind() const -{ - if (is_bound_) - { - return; - } - -#ifdef MAPNIK_STATS - mapnik::progress_timer __stats__(std::clog, "postgis_datasource::bind"); -#endif - - boost::optional initial_size = params_.get("initial_size", 1); - boost::optional max_size = params_.get("max_size", 10); - boost::optional autodetect_key_field = params_.get("autodetect_key_field", false); - - boost::optional simplify_opt = params_.get("simplify_geometries", false); + boost::optional initial_size = params.get("initial_size", 1); + boost::optional max_size = params.get("max_size", 10); + boost::optional autodetect_key_field = params.get("autodetect_key_field", false); + boost::optional estimate_extent = params.get("estimate_extent", false); + estimate_extent_ = estimate_extent && *estimate_extent; + boost::optional simplify_opt = params.get("simplify_geometries", false); simplify_geometries_ = simplify_opt && *simplify_opt; - ConnectionManager* mgr = ConnectionManager::instance(); - mgr->registerPool(creator_, *initial_size, *max_size); - - shared_ptr< Pool > pool = mgr->getPool(creator_.id()); + ConnectionManager::instance().registerPool(creator_, *initial_size, *max_size); + shared_ptr< Pool > pool = ConnectionManager::instance().getPool(creator_.id()); if (pool) { shared_ptr conn = pool->borrowObject(); - if (conn && conn->isOK()) + if (!conn) return; + + if (conn->isOK()) { - PoolGuard, - shared_ptr< Pool > > guard(conn, pool); desc_.set_encoding(conn->client_encoding()); @@ -160,48 +145,52 @@ if (geometryColumn_.empty() || srid_ == 0) { #ifdef MAPNIK_STATS - mapnik::progress_timer __stats2__(std::clog, "postgis_datasource::bind(get_srid_and_geometry_column)"); + mapnik::progress_timer __stats2__(std::clog, "postgis_datasource::init(get_srid_and_geometry_column)"); #endif - std::ostringstream s; - s << "SELECT f_geometry_column, srid FROM " - << GEOMETRY_COLUMNS <<" WHERE f_table_name='" - << mapnik::sql_utils::unquote_double(geometry_table_) - << "'"; - if (! schema_.empty()) + try { - s << " AND f_table_schema='" - << mapnik::sql_utils::unquote_double(schema_) - << "'"; - } - - if (! geometry_field_.empty()) - { - s << " AND f_geometry_column='" - << mapnik::sql_utils::unquote_double(geometry_field_) + s << "SELECT f_geometry_column, srid FROM " + << GEOMETRY_COLUMNS <<" WHERE f_table_name='" + << mapnik::sql_utils::unquote_double(geometry_table_) << "'"; - } - - shared_ptr rs = conn->executeQuery(s.str()); - if (rs->next()) - { - geometryColumn_ = rs->getValue("f_geometry_column"); - - if (srid_ == 0) + if (! schema_.empty()) { - const char* srid_c = rs->getValue("srid"); - if (srid_c != NULL) + s << " AND f_table_schema='" + << mapnik::sql_utils::unquote_double(schema_) + << "'"; + } + if (! geometry_field_.empty()) + { + s << " AND f_geometry_column='" + << mapnik::sql_utils::unquote_double(geometry_field_) + << "'"; + } + shared_ptr rs = conn->executeQuery(s.str()); + if (rs->next()) + { + geometryColumn_ = rs->getValue("f_geometry_column"); + if (srid_ == 0) { - int result = 0; - if (mapnik::util::string2int(srid_c, result)) + const char* srid_c = rs->getValue("srid"); + if (srid_c != NULL) { - srid_ = result; + int result = 0; + const char * end = srid_c + std::strlen(srid_c); + if (mapnik::util::string2int(srid_c, end, result)) + { + srid_ = result; + } } } } + rs->close(); + } + catch (mapnik::datasource_exception const& ex) { + // let this pass on query error and use the fallback below + MAPNIK_LOG_WARN(postgis) << "postgis_datasource: metadata query failed: " << ex.what(); } - rs->close(); // If we still do not know the srid then we can try to fetch // it from the 'table_' parameter, which should work even if it is @@ -220,7 +209,8 @@ if (srid_c != NULL) { int result = 0; - if (mapnik::util::string2int(srid_c, result)) + const char * end = srid_c + std::strlen(srid_c); + if (mapnik::util::string2int(srid_c, end, result)) { srid_ = result; } @@ -388,9 +378,11 @@ case 701: // float8 case 1700: // numeric desc_.add_descriptor(attribute_descriptor(fld_name, mapnik::Double)); + break; case 1042: // bpchar case 1043: // varchar case 25: // text + case 705: // literal desc_.add_descriptor(attribute_descriptor(fld_name, mapnik::String)); break; default: // should not get here @@ -401,8 +393,12 @@ shared_ptr rs_oid = conn->executeQuery(s.str()); if (rs_oid->next()) { - MAPNIK_LOG_WARN(postgis) << "postgis_datasource: Unknown type=" << rs_oid->getValue("typname") - << " (oid:" << rs_oid->getValue("oid") << ")"; + std::string typname(rs_oid->getValue("typname")); + if (typname != "geometry") + { + MAPNIK_LOG_WARN(postgis) << "postgis_datasource: Unknown type=" << typname + << " (oid:" << rs_oid->getValue("oid") << ")"; + } } else { @@ -417,17 +413,15 @@ rs->close(); - is_bound_ = true; } } } postgis_datasource::~postgis_datasource() { - if (is_bound_ && ! persist_connection_) + if (! persist_connection_) { - ConnectionManager* mgr = ConnectionManager::instance(); - shared_ptr< Pool > pool = mgr->getPool(creator_.id()); + shared_ptr< Pool > pool = ConnectionManager::instance().getPool(creator_.id()); if (pool) { shared_ptr conn = pool->borrowObject(); @@ -451,11 +445,6 @@ layer_descriptor postgis_datasource::get_descriptor() const { - if (! is_bound_) - { - bind(); - } - return desc_; } @@ -481,7 +470,7 @@ return b.str(); } -std::string postgis_datasource::populate_tokens(const std::string& sql) const +std::string postgis_datasource::populate_tokens(std::string const& sql) const { std::string populated_sql = sql; @@ -516,7 +505,7 @@ return populated_sql; } -std::string postgis_datasource::populate_tokens(const std::string& sql, double scale_denom, box2d const& env, double pixel_width, double pixel_height) const +std::string postgis_datasource::populate_tokens(std::string const& sql, double scale_denom, box2d const& env, double pixel_width, double pixel_height) const { std::string populated_sql = sql; std::string box = sql_bbox(env); @@ -597,11 +586,6 @@ featureset_ptr postgis_datasource::features(const query& q) const { - if (! is_bound_) - { - bind(); - } - #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "postgis_datasource::features"); #endif @@ -609,15 +593,12 @@ box2d const& box = q.get_bbox(); double scale_denom = q.scale_denominator(); - ConnectionManager* mgr = ConnectionManager::instance(); - shared_ptr< Pool > pool = mgr->getPool(creator_.id()); + shared_ptr< Pool > pool = ConnectionManager::instance().getPool(creator_.id()); if (pool) { shared_ptr conn = pool->borrowObject(); if (conn && conn->isOK()) { - PoolGuard, shared_ptr< Pool > > guard(conn ,pool); - if (geometryColumn_.empty()) { std::ostringstream s_error; @@ -648,14 +629,17 @@ s << "SELECT ST_AsBinary("; if (simplify_geometries_) { - s << "ST_Simplify("; + s << "ST_Simplify("; } s << "\"" << geometryColumn_ << "\""; if (simplify_geometries_) { - const double tolerance = std::min(px_gw, px_gh) / 2.0; - s << ", " << tolerance << ")"; + // 1/20 of pixel seems to be a good compromise to avoid + // drop of collapsed polygons. + // See https://github.com/mapnik/mapnik/issues/1639 + const double tolerance = std::min(px_gw, px_gh) / 20.0; + s << ", " << tolerance << ")"; } s << ") AS geom"; @@ -702,33 +686,35 @@ } else { - throw mapnik::datasource_exception("Postgis Plugin: bad connection"); + std::string err_msg = "Postgis Plugin:"; + if (conn) + { + err_msg += conn->status(); + } + else + { + err_msg += " Null connection"; + } + throw mapnik::datasource_exception(err_msg); } } return featureset_ptr(); } -featureset_ptr postgis_datasource::features_at_point(coord2d const& pt) const +featureset_ptr postgis_datasource::features_at_point(coord2d const& pt, double tol) const { - if (! is_bound_) - { - bind(); - } - #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "postgis_datasource::features_at_point"); #endif - - ConnectionManager* mgr = ConnectionManager::instance(); - shared_ptr< Pool > pool = mgr->getPool(creator_.id()); + shared_ptr< Pool > pool = ConnectionManager::instance().getPool(creator_.id()); if (pool) { shared_ptr conn = pool->borrowObject(); - if (conn && conn->isOK()) - { - PoolGuard, shared_ptr< Pool > > guard(conn, pool); + if (!conn) return featureset_ptr(); + if (conn->isOK()) + { if (geometryColumn_.empty()) { std::ostringstream s_error; @@ -780,7 +766,7 @@ } } - box2d box(pt.x, pt.y, pt.x, pt.y); + box2d box(pt.x - tol, pt.y - tol, pt.x + tol, pt.y + tol); std::string table_with_bbox = populate_tokens(table_, FMAX, box, 0, 0); s << " FROM " << table_with_bbox; @@ -805,25 +791,15 @@ return extent_; } - if (! is_bound_) - { - bind(); - } - - ConnectionManager* mgr = ConnectionManager::instance(); - shared_ptr< Pool > pool = mgr->getPool(creator_.id()); + shared_ptr< Pool > pool = ConnectionManager::instance().getPool(creator_.id()); if (pool) { shared_ptr conn = pool->borrowObject(); - if (conn && conn->isOK()) + if (!conn) return extent_; + if (conn->isOK()) { - PoolGuard, shared_ptr< Pool > > guard(conn, pool); - std::ostringstream s; - boost::optional estimate_extent = - params_.get("estimate_extent", false); - if (geometryColumn_.empty()) { std::ostringstream s_error; @@ -841,7 +817,7 @@ throw mapnik::datasource_exception("Postgis Plugin: " + s_error.str()); } - if (estimate_extent && *estimate_extent) + if (estimate_extent_) { s << "SELECT ST_XMin(ext),ST_YMin(ext),ST_XMax(ext),ST_YMax(ext)" << " FROM (SELECT ST_Estimated_Extent('"; @@ -904,69 +880,65 @@ boost::optional postgis_datasource::get_geometry_type() const { - if (! is_bound_) - { - bind(); - } - boost::optional result; - ConnectionManager* mgr = ConnectionManager::instance(); - shared_ptr< Pool > pool = mgr->getPool(creator_.id()); + shared_ptr< Pool > pool = ConnectionManager::instance().getPool(creator_.id()); if (pool) { shared_ptr conn = pool->borrowObject(); - if (conn && conn->isOK()) + if (!conn) return result; + if (conn->isOK()) { - PoolGuard, shared_ptr< Pool > > guard(conn, pool); - std::ostringstream s; std::string g_type; - - s << "SELECT lower(type) as type FROM " - << GEOMETRY_COLUMNS <<" WHERE f_table_name='" - << mapnik::sql_utils::unquote_double(geometry_table_) - << "'"; - - if (! schema_.empty()) + try { - s << " AND f_table_schema='" - << mapnik::sql_utils::unquote_double(schema_) - << "'"; - } - - if (! geometry_field_.empty()) - { - s << " AND f_geometry_column='" - << mapnik::sql_utils::unquote_double(geometry_field_) + s << "SELECT lower(type) as type FROM " + << GEOMETRY_COLUMNS <<" WHERE f_table_name='" + << mapnik::sql_utils::unquote_double(geometry_table_) << "'"; - } - - shared_ptr rs = conn->executeQuery(s.str()); - if (rs->next()) - { - g_type = rs->getValue("type"); - if (boost::algorithm::contains(g_type, "line")) - { - result.reset(mapnik::datasource::LineString); - return result; - } - else if (boost::algorithm::contains(g_type, "point")) + if (! schema_.empty()) { - result.reset(mapnik::datasource::Point); - return result; + s << " AND f_table_schema='" + << mapnik::sql_utils::unquote_double(schema_) + << "'"; } - else if (boost::algorithm::contains(g_type, "polygon")) + if (! geometry_field_.empty()) { - result.reset(mapnik::datasource::Polygon); - return result; + s << " AND f_geometry_column='" + << mapnik::sql_utils::unquote_double(geometry_field_) + << "'"; } - else // geometry + shared_ptr rs = conn->executeQuery(s.str()); + if (rs->next()) { - result.reset(mapnik::datasource::Collection); - return result; + g_type = rs->getValue("type"); + if (boost::algorithm::contains(g_type, "line")) + { + result.reset(mapnik::datasource::LineString); + return result; + } + else if (boost::algorithm::contains(g_type, "point")) + { + result.reset(mapnik::datasource::Point); + return result; + } + else if (boost::algorithm::contains(g_type, "polygon")) + { + result.reset(mapnik::datasource::Polygon); + return result; + } + else // geometry + { + result.reset(mapnik::datasource::Collection); + return result; + } } } + catch (mapnik::datasource_exception const& ex) { + // let this pass on query error and use the fallback below + MAPNIK_LOG_WARN(postgis) << "postgis_datasource: metadata query failed: " << ex.what(); + } // fallback to querying first several features if (g_type.empty() && ! geometryColumn_.empty()) diff -Nru mapnik-2.1.0/plugins/input/postgis/postgis_datasource.hpp mapnik-2.2.0/plugins/input/postgis/postgis_datasource.hpp --- mapnik-2.1.0/plugins/input/postgis/postgis_datasource.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/postgis/postgis_datasource.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -31,6 +31,8 @@ #include #include #include +#include +#include // boost #include @@ -58,22 +60,20 @@ class postgis_datasource : public datasource { public: - postgis_datasource(const parameters ¶ms, bool bind=true); + postgis_datasource(const parameters ¶ms); ~postgis_datasource(); mapnik::datasource::datasource_t type() const; static const char * name(); featureset_ptr features(const query& q) const; - featureset_ptr features_at_point(coord2d const& pt) const; + featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const; mapnik::box2d envelope() const; boost::optional get_geometry_type() const; layer_descriptor get_descriptor() const; - void bind() const; private: std::string sql_bbox(box2d const& env) const; - std::string populate_tokens(const std::string& sql, double scale_denom, box2d const& env, double pixel_width, double pixel_height) const; - std::string populate_tokens(const std::string& sql) const; - static std::string unquote(const std::string& sql); + std::string populate_tokens(std::string const& sql, double scale_denom, box2d const& env, double pixel_width, double pixel_height) const; + std::string populate_tokens(std::string const& sql) const; boost::shared_ptr get_resultset(boost::shared_ptr const &conn, std::string const& sql) const; static const std::string GEOMETRY_COLUMNS; @@ -84,19 +84,19 @@ const std::string username_; const std::string password_; const std::string table_; - mutable std::string schema_; - mutable std::string geometry_table_; + std::string schema_; + std::string geometry_table_; const std::string geometry_field_; - mutable std::string key_field_; - const int cursor_fetch_size_; - const int row_limit_; - mutable std::string geometryColumn_; + std::string key_field_; + mapnik::value_integer cursor_fetch_size_; + mapnik::value_integer row_limit_; + std::string geometryColumn_; mapnik::datasource::datasource_t type_; - mutable int srid_; + int srid_; mutable bool extent_initialized_; mutable mapnik::box2d extent_; - mutable bool simplify_geometries_; - mutable layer_descriptor desc_; + bool simplify_geometries_; + layer_descriptor desc_; ConnectionCreator creator_; const std::string bbox_token_; const std::string scale_denom_token_; @@ -104,6 +104,7 @@ const std::string pixel_height_token_; bool persist_connection_; bool extent_from_subquery_; + bool estimate_extent_; // params below are for testing purposes only (will likely be removed at any time) int intersect_min_scale_; int intersect_max_scale_; diff -Nru mapnik-2.1.0/plugins/input/postgis/postgis_featureset.cpp mapnik-2.2.0/plugins/input/postgis/postgis_featureset.cpp --- mapnik-2.1.0/plugins/input/postgis/postgis_featureset.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/postgis/postgis_featureset.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -29,13 +29,16 @@ #include #include #include -#include +#include #include #include +#include +#include // for int2net +#include + // boost -#include -#include +#include // for boost::int16_t // stl #include @@ -60,6 +63,8 @@ { } +std::string numeric2string(const char* buf); + feature_ptr postgis_featureset::next() { while (rs_->next()) @@ -70,13 +75,21 @@ if (key_field_) { + std::string name = rs_->getFieldName(pos); + + // null feature id is not acceptable + if (rs_->isNull(pos)) + { + MAPNIK_LOG_WARN(postgis) << "postgis_featureset: null value encountered for key_field: " << name; + continue; + } // create feature with user driven id from attribute int oid = rs_->getTypeOID(pos); const char* buf = rs_->getValue(pos); - std::string name = rs_->getFieldName(pos); - // validation happens of this type at bind() - int val; + // validation happens of this type at initialization + mapnik::value_integer val; + if (oid == 20) { val = int8net(buf); @@ -94,7 +107,7 @@ // TODO - extend feature class to know // that its id is also an attribute to avoid // this duplication - feature->put(name,val); + feature->put(name,val); ++pos; } else @@ -104,24 +117,29 @@ ++feature_id_; } + // null geometry is not acceptable + if (rs_->isNull(0)) + { + MAPNIK_LOG_WARN(postgis) << "postgis_featureset: null value encountered for geometry"; + continue; + } + // parse geometry int size = rs_->getFieldLength(0); const char *data = rs_->getValue(0); + if (!geometry_utils::from_wkb(feature->paths(), data, size)) continue; totalGeomSize_ += size; - unsigned num_attrs = ctx_->size() + 1; for (; pos < num_attrs; ++pos) { std::string name = rs_->getFieldName(pos); - if (rs_->isNull(pos)) - { - feature->put(name, mapnik::value_null()); - } - else + // NOTE: we intentionally do not store null here + // since it is equivalent to the attribute not existing + if (!rs_->isNull(pos)) { const char* buf = rs_->getValue(pos); const int oid = rs_->getTypeOID(pos); @@ -135,24 +153,19 @@ case 23: //int4 { - int val = int4net(buf); - feature->put(name, val); + feature->put(name, int4net(buf)); break; } case 21: //int2 { - int val = int2net(buf); - feature->put(name, val); + feature->put(name, int2net(buf)); break; } case 20: //int8/BigInt { - // TODO - need to support boost::uint64_t in mapnik::value - // https://github.com/mapnik/mapnik/issues/895 - int val = int8net(buf); - feature->put(name, val); + feature->put(name, int8net(buf)); break; } @@ -160,7 +173,7 @@ { float val; float4net(val, buf); - feature->put(name, val); + feature->put(name, static_cast(val)); break; } @@ -174,6 +187,7 @@ case 25: //text case 1043: //varchar + case 705: //literal { feature->put(name, tr_->transcode(buf)); break; @@ -181,8 +195,7 @@ case 1042: //bpchar { - std::string str(buf); - boost::trim(str); + std::string str = mapnik::util::trim_copy(buf); feature->put(name, tr_->transcode(str.c_str())); break; } @@ -190,7 +203,7 @@ case 1700: //numeric { double val; - std::string str = mapnik::sql_utils::numeric2string(buf); + std::string str = numeric2string(buf); if (mapnik::util::string2double(str, val)) { feature->put(name, val); @@ -200,7 +213,7 @@ default: { - MAPNIK_LOG_WARN(postgis) << "postgis_featureset: Uknown type_oid=" << oid; + MAPNIK_LOG_WARN(postgis) << "postgis_featureset: Unknown type_oid=" << oid; break; } @@ -217,3 +230,115 @@ { rs_->close(); } + +std::string numeric2string(const char* buf) +{ + boost::int16_t ndigits = int2net(buf); + boost::int16_t weight = int2net(buf+2); + boost::int16_t sign = int2net(buf+4); + boost::int16_t dscale = int2net(buf+6); + + boost::scoped_array digits(new boost::int16_t[ndigits]); + for (int n=0; n < ndigits ;++n) + { + digits[n] = int2net(buf+8+n*2); + } + + std::ostringstream ss; + + if (sign == 0x4000) ss << "-"; + + int i = std::max(weight,boost::int16_t(0)); + int d = 0; + + // Each numeric "digit" is actually a value between 0000 and 9999 stored in a 16 bit field. + // For example, the number 1234567809990001 is stored as four digits: [1234] [5678] [999] [1]. + // Note that the last two digits show that the leading 0's are lost when the number is split. + // We must be careful to re-insert these 0's when building the string. + + while ( i >= 0) + { + if (i <= weight && d < ndigits) + { + // All digits after the first must be padded to make the field 4 characters long + if (d != 0) + { +#ifdef _WINDOWS + int dig = digits[d]; + if (dig < 10) + { + ss << "000"; // 0000 - 0009 + } + else if (dig < 100) + { + ss << "00"; // 0010 - 0099 + } + else + { + ss << "0"; // 0100 - 0999; + } +#else + switch(digits[d]) + { + case 0 ... 9: + ss << "000"; // 0000 - 0009 + break; + case 10 ... 99: + ss << "00"; // 0010 - 0099 + break; + case 100 ... 999: + ss << "0"; // 0100 - 0999 + break; + } +#endif + } + ss << digits[d++]; + } + else + { + if (d == 0) + ss << "0"; + else + ss << "0000"; + } + + i--; + } + if (dscale > 0) + { + ss << '.'; + // dscale counts the number of decimal digits following the point, not the numeric digits + while (dscale > 0) + { + int value; + if (i <= weight && d < ndigits) + value = digits[d++]; + else + value = 0; + + // Output up to 4 decimal digits for this value + if (dscale > 0) { + ss << (value / 1000); + value %= 1000; + dscale--; + } + if (dscale > 0) { + ss << (value / 100); + value %= 100; + dscale--; + } + if (dscale > 0) { + ss << (value / 10); + value %= 10; + dscale--; + } + if (dscale > 0) { + ss << value; + dscale--; + } + + i--; + } + } + return ss.str(); +} diff -Nru mapnik-2.1.0/plugins/input/postgis/postgis_featureset.hpp mapnik-2.2.0/plugins/input/postgis/postgis_featureset.hpp --- mapnik-2.1.0/plugins/input/postgis/postgis_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/postgis/postgis_featureset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -28,9 +28,9 @@ #include #include #include +#include // boost - #include using mapnik::Featureset; @@ -56,7 +56,7 @@ context_ptr ctx_; boost::scoped_ptr tr_; unsigned totalGeomSize_; - int feature_id_; + mapnik::value_integer feature_id_; bool key_field_; }; diff -Nru mapnik-2.1.0/plugins/input/python/README.md mapnik-2.2.0/plugins/input/python/README.md --- mapnik-2.1.0/plugins/input/python/README.md 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/python/README.md 2013-06-04 01:35:27.000000000 +0000 @@ -97,14 +97,14 @@ ```xml - + - + style python diff -Nru mapnik-2.1.0/plugins/input/python/build.py mapnik-2.2.0/plugins/input/python/build.py --- mapnik-2.1.0/plugins/input/python/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/python/build.py 2013-06-04 01:35:27.000000000 +0000 @@ -1,76 +1,100 @@ -#!/usr/bin/env python +# +# This file is part of Mapnik (c++ mapping toolkit) +# +# Copyright (C) 2013 Artem Pavlenko +# +# Mapnik is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# import os - -PLUGIN_NAME = 'python' - Import ('plugin_base') Import ('env') -install_dest = env['MAPNIK_INPUT_PLUGINS_DEST'] +PLUGIN_NAME = 'python' plugin_env = plugin_base.Clone() plugin_sources = Split( """ %(PLUGIN_NAME)s_datasource.cpp - %(PLUGIN_NAME)s_featureset.cpp + %(PLUGIN_NAME)s_featureset.cpp + %(PLUGIN_NAME)s_utils.cpp """ % locals() - ) - -boost_system = 'boost_system%s' % env['BOOST_APPEND'] -libraries = ['mapnik',env['BOOST_PYTHON_LIB'],boost_system,env['ICU_LIB_NAME']] +) +# Link Library to Dependencies +libraries = [] +libraries.append('boost_system%s' % env['BOOST_APPEND']) +libraries.append(env['BOOST_PYTHON_LIB']) +libraries.append(env['ICU_LIB_NAME']) + +python_cpppath = env['PYTHON_INCLUDES'] +allcpp_paths = env['CPPPATH'] +allcpp_paths.extend(python_cpppath) # NOTE: explicit linking to libpython is uneeded on most linux version if the # python plugin is used by a app in python using mapnik's python bindings # we explicitly link to libpython here so that this plugin # can be used from a pure C++ calling application or a different binding language -python_link_flag = '-lpython%s' % env['PYTHON_VERSION'] - -if env['PLATFORM'] == 'Darwin': - if env['PYTHON_DYNAMIC_LOOKUP']: - python_link_flag = '-undefined dynamic_lookup' - elif env['FRAMEWORK_PYTHON']: - if env['FRAMEWORK_SEARCH_PATH']: - python_link_flag = '-F%s -framework Python -Z' % env['FRAMEWORK_SEARCH_PATH'] +if env['PLATFORM'] == 'Darwin' and env['FRAMEWORK_PYTHON']: + if env['FRAMEWORK_SEARCH_PATH']: + python_link_flag = '-F%s -framework Python -Z' % env['FRAMEWORK_SEARCH_PATH'] + else: + link_prefix = env['PYTHON_SYS_PREFIX'] + if '.framework' in link_prefix: + python_link_flag = '-F%s -framework Python -Z' % os.path.dirname(link_prefix.split('.')[0]) + elif '/System' in link_prefix: + python_link_flag = '-F/System/Library/Frameworks/ -framework Python -Z' else: - link_prefix = env['PYTHON_SYS_PREFIX'] - if '.framework' in link_prefix: - python_link_flag = '-F%s -framework Python -Z' % os.path.dirname(link_prefix.split('.')[0]) - elif '/System' in link_prefix: - python_link_flag = '-F/System/Library/Frameworks/ -framework Python -Z' - else: - python_link_flag = '-F/ -framework Python' + python_link_flag = '-F/ -framework Python' +else: + # on linux the linkflags end up to early in the compile flags to work correctly + python_link_flag = '-L%s' % env['PYTHON_SYS_PREFIX'] + os.path.sep + env['LIBDIR_SCHEMA'] + # so instead add to libraries + libraries.append('python%s' % env['PYTHON_VERSION']) if env['CUSTOM_LDFLAGS']: linkflags = '%s %s' % (env['CUSTOM_LDFLAGS'], python_link_flag) else: linkflags = python_link_flag -plugin_env.Append(CPPPATH = env['PYTHON_INCLUDES']) - -TARGET = plugin_env.SharedLibrary( - # the name of the target to build, eg 'sqlite.input' - '../%s' % PLUGIN_NAME, - # prefix - normally none used - SHLIBPREFIX='', - # extension, mapnik expects '.input' - SHLIBSUFFIX='.input', - # list of source files to compile - source=plugin_sources, - # libraries to link to - LIBS=libraries, - # any custom linkflags, eg. LDFLAGS - # in this case CUSTOM_LDFLAGS comes - # from Mapnik's main SConstruct file - # and can be removed here if you do - # not need it - LINKFLAGS=linkflags - ) - -# if 'uninstall' is not passed on the command line -# then we actually create the install targets that -# scons will install if 'install' is passed as an arg -if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Install(install_dest, TARGET) - env.Alias('install', install_dest) +if env['PLUGIN_LINKING'] == 'shared': + libraries.append('mapnik') + TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, + SHLIBPREFIX='', + SHLIBSUFFIX='.input', + source=plugin_sources, + CPPPATH=allcpp_paths, + LIBS=libraries, + LINKFLAGS=linkflags) + + # if the plugin links to libmapnik ensure it is built first + Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + + # if 'uninstall' is not passed on the command line + # then we actually create the install targets that + # scons will install if 'install' is passed as an arg + if 'uninstall' not in COMMAND_LINE_TARGETS: + env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET) + env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) + +plugin_obj = { + 'LIBS': libraries, + 'SOURCES': plugin_sources, + 'CPPPATH': python_cpppath, + 'LINKFLAGS': linkflags.replace('-Z','').split(' '), +} + +Return('plugin_obj') diff -Nru mapnik-2.1.0/plugins/input/python/examples/simple_xml.xml mapnik-2.2.0/plugins/input/python/examples/simple_xml.xml --- mapnik-2.1.0/plugins/input/python/examples/simple_xml.xml 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/python/examples/simple_xml.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,12 +1,12 @@ - + - + style python diff -Nru mapnik-2.1.0/plugins/input/python/python_datasource.cpp mapnik-2.2.0/plugins/input/python/python_datasource.cpp --- mapnik-2.1.0/plugins/input/python/python_datasource.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/python/python_datasource.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -20,23 +20,70 @@ DATASOURCE_PLUGIN(python_datasource) -python_datasource::python_datasource(parameters const& params, bool bind) +python_datasource::python_datasource(parameters const& params) : datasource(params), - desc_(*params_.get("type"), *params_.get("encoding","utf-8")), - factory_(*params_.get("factory", "")) + desc_(*params.get("type"), *params.get("encoding","utf-8")), + factory_(*params.get("factory", "")) { // extract any remaining parameters as keyword args for the factory - BOOST_FOREACH(const mapnik::parameters::value_type& kv, params_) + BOOST_FOREACH(const mapnik::parameters::value_type& kv, params) { if((kv.first != "type") && (kv.first != "factory")) { - kwargs_.insert(std::make_pair(kv.first, *params_.get(kv.first))); + kwargs_.insert(std::make_pair(kv.first, *params.get(kv.first))); } } - if (bind) + // The following methods call into the Python interpreter and hence require, unfortunately, that the GIL be held. + using namespace boost; + + if (factory_.empty()) + { + throw mapnik::datasource_exception("Python: 'factory' option must be defined"); + } + + try + { + // split factory at ':' to parse out module and callable + std::vector factory_split; + split(factory_split, factory_, is_any_of(":")); + if ((factory_split.size() < 1) || (factory_split.size() > 2)) + { + throw mapnik::datasource_exception( + std::string("python: factory string must be of the form '[module:]callable' when parsing \"") + + factory_ + '"'); + } + // extract the module and the callable + boost::python::str module_name("__main__"), callable_name; + if (factory_split.size() == 1) + { + callable_name = boost::python::str(factory_split[0]); + } + else + { + module_name = boost::python::str(factory_split[0]); + callable_name = boost::python::str(factory_split[1]); + } + ensure_gil lock; + // import the main module from Python (in case we're embedding the + // interpreter directly) and also import the callable. + boost::python::object main_module = boost::python::import("__main__"); + boost::python::object callable_module = boost::python::import(module_name); + boost::python::object callable = callable_module.attr(callable_name); + // prepare the arguments + boost::python::dict kwargs; + typedef std::map::value_type kv_type; + BOOST_FOREACH(const kv_type& kv, kwargs_) + { + kwargs[boost::python::str(kv.first)] = boost::python::str(kv.second); + } + + // get our wrapped data source + datasource_ = callable(*boost::python::make_tuple(), **kwargs); + } + catch ( boost::python::error_already_set ) { - this->bind(); + throw mapnik::datasource_exception(extractException()); } } @@ -52,157 +99,138 @@ mapnik::layer_descriptor python_datasource::get_descriptor() const { - if (!is_bound_) bind(); - return desc_; } -// The following methods call into the Python interpreter and hence require, unfortunately, that the GIL be held. - -void python_datasource::bind() const +mapnik::datasource::datasource_t python_datasource::type() const { - using namespace boost; - using namespace boost::python; - - if (is_bound_) return; - - // if no factory callable is defined, bind is a nop - if (factory_.empty()) return; - - // split factory at ':' to parse out module and callable - std::vector factory_split; - split(factory_split, factory_, is_any_of(":")); - if ((factory_split.size() < 1) || (factory_split.size() > 2)) - { - // FIMXE: is this appropriate error reporting? - std::cerr << "python: factory string must be of the form '[module:]callable' when parsing \"" - << factory_ << '"' << std::endl; - return; - } + typedef boost::optional return_type; - // extract the module and the callable - str module_name("__main__"), callable_name; - if (factory_split.size() == 1) + try { - callable_name = str(factory_split[0]); + ensure_gil lock; + boost::python::object data_type = datasource_.attr("data_type"); + long data_type_integer = boost::python::extract(data_type); + return mapnik::datasource::datasource_t(data_type_integer); } - else + catch ( boost::python::error_already_set ) { - module_name = str(factory_split[0]); - callable_name = str(factory_split[1]); + throw mapnik::datasource_exception(extractException()); } +} + +mapnik::box2d python_datasource::envelope() const +{ + mapnik::box2d box; + try { ensure_gil lock; - - // import the main module from Python (in case we're embedding the - // interpreter directly) and also import the callable. - object main_module = import("__main__"); - object callable_module = import(module_name); - object callable = callable_module.attr(callable_name); - - // prepare the arguments - dict kwargs; - typedef std::map::value_type kv_type; - BOOST_FOREACH(const kv_type& kv, kwargs_) + if (!PyObject_HasAttrString(datasource_.ptr(), "envelope")) { - kwargs[str(kv.first)] = str(kv.second); + throw mapnik::datasource_exception("Python: could not access envelope property"); + } + else + { + boost::python::object py_envelope = datasource_.attr("envelope"); + if (py_envelope.ptr() == boost::python::object().ptr()) + { + throw mapnik::datasource_exception("Python: could not access envelope property"); + } + else + { + boost::python::extract ex(py_envelope.attr("minx")); + if (!ex.check()) throw mapnik::datasource_exception("Python: could not convert envelope.minx"); + box.set_minx(ex()); + boost::python::extract ex1(py_envelope.attr("miny")); + if (!ex1.check()) throw mapnik::datasource_exception("Python: could not convert envelope.miny"); + box.set_miny(ex1()); + boost::python::extract ex2(py_envelope.attr("maxx")); + if (!ex2.check()) throw mapnik::datasource_exception("Python: could not convert envelope.maxx"); + box.set_maxx(ex2()); + boost::python::extract ex3(py_envelope.attr("maxy")); + if (!ex3.check()) throw mapnik::datasource_exception("Python: could not convert envelope.maxy"); + box.set_maxy(ex3()); + } } - - // get our wrapped data source - datasource_ = callable(*boost::python::make_tuple(), **kwargs); } - - is_bound_ = true; -} - -mapnik::datasource::datasource_t python_datasource::type() const -{ - using namespace boost::python; - - typedef boost::optional return_type; - - if (!is_bound_) bind(); - - ensure_gil lock; - - object data_type = datasource_.attr("data_type"); - long data_type_integer = extract(data_type); - return mapnik::datasource::datasource_t(data_type_integer); -} - -mapnik::box2d python_datasource::envelope() const -{ - using namespace boost::python; - - if (!is_bound_) bind(); - - ensure_gil lock; - return extract >(datasource_.attr("envelope")); + catch ( boost::python::error_already_set ) + { + throw mapnik::datasource_exception(extractException()); + } + return box; } boost::optional python_datasource::get_geometry_type() const { - using namespace boost::python; - typedef boost::optional return_type; - if (!is_bound_) bind(); - - ensure_gil lock; - - // if the datasource object has no geometry_type attribute, return a 'none' value - if (!PyObject_HasAttrString(datasource_.ptr(), "geometry_type")) - return return_type(); - - object py_geometry_type = datasource_.attr("geometry_type"); - - // if the attribute value is 'None', return a 'none' value - if (py_geometry_type.ptr() == object().ptr()) - return return_type(); - - long geom_type_integer = extract(py_geometry_type); - return mapnik::datasource::geometry_t(geom_type_integer); + try + { + ensure_gil lock; + // if the datasource object has no geometry_type attribute, return a 'none' value + if (!PyObject_HasAttrString(datasource_.ptr(), "geometry_type")) + { + return return_type(); + } + boost::python::object py_geometry_type = datasource_.attr("geometry_type"); + // if the attribute value is 'None', return a 'none' value + if (py_geometry_type.ptr() == boost::python::object().ptr()) + { + return return_type(); + } + long geom_type_integer = boost::python::extract(py_geometry_type); + return mapnik::datasource::geometry_t(geom_type_integer); + } + catch ( boost::python::error_already_set ) + { + throw mapnik::datasource_exception(extractException()); + } } mapnik::featureset_ptr python_datasource::features(mapnik::query const& q) const { - using namespace boost::python; + try + { + // if the query box intersects our world extent then query for features + if (envelope().intersects(q.get_bbox())) + { + ensure_gil lock; + boost::python::object features(datasource_.attr("features")(q)); + // if 'None' was returned, return an empty feature set + if(features.ptr() == boost::python::object().ptr()) + { + return mapnik::featureset_ptr(); + } + return boost::make_shared(features); + } + // otherwise return an empty featureset pointer + return mapnik::featureset_ptr(); + } + catch ( boost::python::error_already_set ) + { + throw mapnik::datasource_exception(extractException()); + } +} - if (!is_bound_) bind(); +mapnik::featureset_ptr python_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const +{ - // if the query box intersects our world extent then query for features - if (envelope().intersects(q.get_bbox())) + try { ensure_gil lock; - - object features(datasource_.attr("features")(q)); - - // if 'None' was returned, return an empty feature set - if(features.ptr() == object().ptr()) + boost::python::object features(datasource_.attr("features_at_point")(pt)); + // if we returned none, return an empty set + if(features.ptr() == boost::python::object().ptr()) + { return mapnik::featureset_ptr(); - + } + // otherwise, return a feature set which can iterate over the iterator return boost::make_shared(features); } + catch ( boost::python::error_already_set ) + { + throw mapnik::datasource_exception(extractException()); + } - // otherwise return an empty featureset pointer - return mapnik::featureset_ptr(); -} - -mapnik::featureset_ptr python_datasource::features_at_point(mapnik::coord2d const& pt) const -{ - using namespace boost::python; - - if (!is_bound_) bind(); - - ensure_gil lock; - - object features(datasource_.attr("features_at_point")(pt)); - - // if we returned none, return an empty set - if(features.ptr() == object().ptr()) - return mapnik::featureset_ptr(); - - // otherwise, return a feature set which can iterate over the iterator - return boost::make_shared(features); } diff -Nru mapnik-2.1.0/plugins/input/python/python_datasource.hpp mapnik-2.2.0/plugins/input/python/python_datasource.hpp --- mapnik-2.1.0/plugins/input/python/python_datasource.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/python/python_datasource.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -12,7 +12,7 @@ public: // constructor // arguments must not change - python_datasource(mapnik::parameters const& params, bool bind=true); + python_datasource(mapnik::parameters const& params); // destructor virtual ~python_datasource (); @@ -29,7 +29,7 @@ // mandatory: function to query features by point (coord2d) // not used by rendering, but available to calling applications - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; + mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; // mandatory: return the box2d of the datasource // called during rendering to determine if the layer should be processed @@ -41,15 +41,12 @@ // mandatory: return the layer descriptor mapnik::layer_descriptor get_descriptor() const; - // mandatory: will bind the datasource given params - void bind() const; - private: static const char* name_; - mutable mapnik::layer_descriptor desc_; + mapnik::layer_descriptor desc_; const std::string factory_; std::map kwargs_; - mutable boost::python::object datasource_; + boost::python::object datasource_; }; diff -Nru mapnik-2.1.0/plugins/input/python/python_featureset.hpp mapnik-2.2.0/plugins/input/python/python_featureset.hpp --- mapnik-2.1.0/plugins/input/python/python_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/python/python_featureset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -1,6 +1,9 @@ #ifndef PYTHON_FEATURESET_HPP #define PYTHON_FEATURESET_HPP +// mapnik +#include + // boost #include #include @@ -8,7 +11,6 @@ // mapnik #include -// extend the mapnik::Featureset defined in include/mapnik/datasource.hpp class python_featureset : public mapnik::Featureset { public: diff -Nru mapnik-2.1.0/plugins/input/python/python_utils.cpp mapnik-2.2.0/plugins/input/python/python_utils.cpp --- mapnik-2.1.0/plugins/input/python/python_utils.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/plugins/input/python/python_utils.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,23 @@ +#include "python_utils.hpp" + +std::string extractException() +{ + using namespace boost::python; + + PyObject *exc,*val,*tb; + PyErr_Fetch(&exc,&val,&tb); + PyErr_NormalizeException(&exc,&val,&tb); + handle<> hexc(exc),hval(allow_null(val)),htb(allow_null(tb)); + if(!hval) + { + return extract(str(hexc)); + } + else + { + object traceback(import("traceback")); + object format_exception(traceback.attr("format_exception")); + object formatted_list(format_exception(hexc,hval,htb)); + object formatted(str("").join(formatted_list)); + return extract(formatted); + } +} diff -Nru mapnik-2.1.0/plugins/input/python/python_utils.hpp mapnik-2.2.0/plugins/input/python/python_utils.hpp --- mapnik-2.1.0/plugins/input/python/python_utils.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/python/python_utils.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -13,4 +13,6 @@ PyGILState_STATE gil_state_; }; +std::string extractException(); + #endif // PYTHON_UTILS_HPP diff -Nru mapnik-2.1.0/plugins/input/raster/build.py mapnik-2.2.0/plugins/input/raster/build.py --- mapnik-2.1.0/plugins/input/raster/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/raster/build.py 2013-06-04 01:35:27.000000000 +0000 @@ -1,7 +1,7 @@ # # This file is part of Mapnik (c++ mapping toolkit) # -# Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon +# Copyright (C) 2013 Artem Pavlenko # # Mapnik is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,35 +17,48 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# Import ('plugin_base') Import ('env') -prefix = env['PREFIX'] +PLUGIN_NAME = 'raster' plugin_env = plugin_base.Clone() -raster_src = Split( - """ - raster_datasource.cpp - raster_featureset.cpp - raster_info.cpp +plugin_sources = Split( """ - ) + %(PLUGIN_NAME)s_datasource.cpp + %(PLUGIN_NAME)s_featureset.cpp + %(PLUGIN_NAME)s_info.cpp + """ % locals() +) -libraries = [] # Link Library to Dependencies -libraries.append('mapnik') +libraries = [] libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) -libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) -input_plugin = plugin_env.SharedLibrary('../raster', source=raster_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) +if env['PLUGIN_LINKING'] == 'shared': + libraries.append('mapnik') -# if the plugin links to libmapnik ensure it is built first -Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, + SHLIBPREFIX='', + SHLIBSUFFIX='.input', + source=plugin_sources, + LIBS=libraries, + LINKFLAGS=env['CUSTOM_LDFLAGS']) + + # if the plugin links to libmapnik ensure it is built first + Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + + if 'uninstall' not in COMMAND_LINE_TARGETS: + env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET) + env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) + +plugin_obj = { + 'LIBS': libraries, + 'SOURCES': plugin_sources, +} -if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin) - env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) +Return('plugin_obj') diff -Nru mapnik-2.1.0/plugins/input/raster/raster_datasource.cpp mapnik-2.2.0/plugins/input/raster/raster_datasource.cpp --- mapnik-2.1.0/plugins/input/raster/raster_datasource.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/raster/raster_datasource.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,12 +21,13 @@ *****************************************************************************/ // boost -#include #include // mapnik +#include #include #include +#include #include #include @@ -45,10 +46,10 @@ DATASOURCE_PLUGIN(raster_datasource) -raster_datasource::raster_datasource(const parameters& params, bool bind) - : datasource(params), - desc_(*params.get("type"), "utf-8"), - extent_initialized_(false) +raster_datasource::raster_datasource(parameters const& params) +: datasource(params), + desc_(*params.get("type"), "utf-8"), + extent_initialized_(false) { MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Initializing..."; @@ -61,17 +62,19 @@ else filename_ = *file; - multi_tiles_ = *params_.get("multi", false); - tile_size_ = *params_.get("tile_size", 256); - tile_stride_ = *params_.get("tile_stride", 1); - - format_ = *params_.get("format","tiff"); - - boost::optional lox = params_.get("lox"); - boost::optional loy = params_.get("loy"); - boost::optional hix = params_.get("hix"); - boost::optional hiy = params_.get("hiy"); - boost::optional ext = params_.get("extent"); + multi_tiles_ = *params.get("multi", false); + tile_size_ = *params.get("tile_size", 256); + tile_stride_ = *params.get("tile_stride", 1); + + boost::optional format_from_filename = mapnik::type_from_filename(*file); + format_ = *params.get("format",format_from_filename?(*format_from_filename) : "tiff"); + + boost::optional lox = params.get("lox"); + boost::optional loy = params.get("loy"); + boost::optional hix = params.get("hix"); + boost::optional hiy = params.get("hiy"); + + boost::optional ext = params.get("extent"); if (lox && loy && hix && hiy) { @@ -88,20 +91,10 @@ throw datasource_exception("Raster Plugin: valid or are required"); } - if (bind) - { - this->bind(); - } -} - -void raster_datasource::bind() const -{ - if (is_bound_) return; - if (multi_tiles_) { - boost::optional x_width = params_.get("x_width"); - boost::optional y_width = params_.get("y_width"); + boost::optional x_width = params.get("x_width"); + boost::optional y_width = params.get("y_width"); if (! x_width) { @@ -118,7 +111,7 @@ } else { - if (! boost::filesystem::exists(filename_)) + if (!mapnik::util::exists(filename_)) { throw datasource_exception("Raster Plugin: " + filename_ + " does not exist"); } @@ -148,7 +141,6 @@ MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Raster size=" << width_ << "," << height_; - is_bound_ = true; } raster_datasource::~raster_datasource() @@ -182,8 +174,6 @@ featureset_ptr raster_datasource::features(query const& q) const { - if (! is_bound_) bind(); - mapnik::CoordTransform t(width_, height_, extent_, 0, 0); mapnik::box2d intersect = extent_.intersect(q.get_bbox()); mapnik::box2d ext = t.forward(intersect); @@ -201,11 +191,11 @@ return boost::make_shared >(policy, extent_, q); } - else if (width * height > 512*512) + else if (width * height > static_cast(tile_size_ * tile_size_ << 2)) { MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Tiled policy"; - tiled_file_policy policy(filename_, format_, 256, extent_, q.get_bbox(), width_, height_); + tiled_file_policy policy(filename_, format_, tile_size_, extent_, q.get_bbox(), width_, height_); return boost::make_shared >(policy, extent_, q); } @@ -220,7 +210,7 @@ } } -featureset_ptr raster_datasource::features_at_point(coord2d const&) const +featureset_ptr raster_datasource::features_at_point(coord2d const&, double tol) const { MAPNIK_LOG_WARN(raster) << "raster_datasource: feature_at_point not supported"; diff -Nru mapnik-2.1.0/plugins/input/raster/raster_datasource.hpp mapnik-2.2.0/plugins/input/raster/raster_datasource.hpp --- mapnik-2.1.0/plugins/input/raster/raster_datasource.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/raster/raster_datasource.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -44,17 +44,16 @@ class raster_datasource : public mapnik::datasource { public: - raster_datasource(const mapnik::parameters& params, bool bind=true); + raster_datasource(const mapnik::parameters& params); virtual ~raster_datasource(); datasource::datasource_t type() const; static const char * name(); mapnik::featureset_ptr features(const mapnik::query& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; + mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; mapnik::box2d envelope() const; boost::optional get_geometry_type() const; mapnik::layer_descriptor get_descriptor() const; bool log_enabled() const; - void bind() const; private: mapnik::layer_descriptor desc_; @@ -65,8 +64,8 @@ bool multi_tiles_; unsigned tile_size_; unsigned tile_stride_; - mutable unsigned width_; - mutable unsigned height_; + unsigned width_; + unsigned height_; }; #endif // RASTER_DATASOURCE_HPP diff -Nru mapnik-2.1.0/plugins/input/raster/raster_featureset.cpp mapnik-2.2.0/plugins/input/raster/raster_featureset.cpp --- mapnik-2.1.0/plugins/input/raster/raster_featureset.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/raster/raster_featureset.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,6 +22,8 @@ // mapnik #include +#include +#include #include #include #include @@ -29,12 +31,12 @@ // boost #include +#include #include "raster_featureset.hpp" using mapnik::query; using mapnik::image_reader; -using mapnik::Feature; using mapnik::feature_ptr; using mapnik::image_data_32; using mapnik::raster; @@ -87,10 +89,10 @@ if (ext.width() > 0.5 && ext.height() > 0.5 ) { // select minimum raster containing whole ext - int x_off = static_cast(floor(ext.minx())); - int y_off = static_cast(floor(ext.miny())); - int end_x = static_cast(ceil(ext.maxx())); - int end_y = static_cast(ceil(ext.maxy())); + int x_off = static_cast(std::floor(ext.minx())); + int y_off = static_cast(std::floor(ext.miny())); + int end_x = static_cast(std::ceil(ext.maxx())); + int end_y = static_cast(std::ceil(ext.maxy())); // clip to available data if (x_off < 0) @@ -111,9 +113,10 @@ rem.maxy() + y_off + height); intersect = t.backward(feature_raster_extent); - image_data_32 image(width,height); - reader->read(x_off, y_off, image); - feature->set_raster(boost::make_shared(intersect, image)); + mapnik::raster_ptr raster = boost::make_shared(intersect, width, height); + reader->read(x_off, y_off, raster->data_); + raster->premultiplied_alpha_ = reader->premultiplied_alpha(); + feature->set_raster(raster); } } } diff -Nru mapnik-2.1.0/plugins/input/raster/raster_featureset.hpp mapnik-2.2.0/plugins/input/raster/raster_featureset.hpp --- mapnik-2.1.0/plugins/input/raster/raster_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/raster/raster_featureset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -27,6 +27,7 @@ #include "raster_info.hpp" // mapnik +#include #include // stl @@ -126,8 +127,8 @@ tiled_file_policy(std::string const& file, std::string const& format, unsigned tile_size, - box2d extent, - box2d bbox, + box2d const& extent, + box2d const& bbox, unsigned width, unsigned height) { @@ -315,7 +316,7 @@ private: LookupPolicy policy_; - int feature_id_; + mapnik::value_integer feature_id_; mapnik::context_ptr ctx_; mapnik::box2d extent_; mapnik::box2d bbox_; diff -Nru mapnik-2.1.0/plugins/input/raster/raster_info.cpp mapnik-2.2.0/plugins/input/raster/raster_info.cpp --- mapnik-2.1.0/plugins/input/raster/raster_info.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/raster/raster_info.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -44,13 +44,13 @@ { } -void raster_info::swap(raster_info& other) throw() +void raster_info::swap(raster_info& other) //throw() { - file_ = other.file_; - format_ = other.format_; - extent_ = other.extent_; - width_ = other.width_; - height_ = other.height_; + std::swap(file_,other.file_); + std::swap(format_,other.format_); + std::swap(extent_ ,other.extent_); + std::swap(width_,other.width_); + std::swap(height_, other.height_); } diff -Nru mapnik-2.1.0/plugins/input/raster/raster_info.hpp mapnik-2.2.0/plugins/input/raster/raster_info.hpp --- mapnik-2.1.0/plugins/input/raster/raster_info.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/raster/raster_info.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -33,8 +33,8 @@ class raster_info { public: - raster_info(const std::string& file, - const std::string& format, + raster_info(std::string const& file, + std::string const& format, const box2d& extent, unsigned width, unsigned height); @@ -47,7 +47,7 @@ inline unsigned height() const { return height_;} private: - void swap(raster_info& other) throw(); + void swap(raster_info& other); std::string file_; std::string format_; diff -Nru mapnik-2.1.0/plugins/input/rasterlite/build.py mapnik-2.2.0/plugins/input/rasterlite/build.py --- mapnik-2.1.0/plugins/input/rasterlite/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/rasterlite/build.py 2013-06-04 01:35:27.000000000 +0000 @@ -1,7 +1,7 @@ # # This file is part of Mapnik (c++ mapping toolkit) # -# Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon +# Copyright (C) 2013 Artem Pavlenko # # Mapnik is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,35 +17,47 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# Import ('plugin_base') Import ('env') -prefix = env['PREFIX'] +PLUGIN_NAME = 'rasterlite' plugin_env = plugin_base.Clone() -rasterlite_src = Split( - """ - rasterlite_datasource.cpp - rasterlite_featureset.cpp +plugin_sources = Split( """ - ) - -libraries = [env['PLUGINS']['rasterlite']['lib']] + %(PLUGIN_NAME)s_datasource.cpp + %(PLUGIN_NAME)s_featureset.cpp + """ % locals() +) # Link Library to Dependencies -libraries.append('mapnik') +libraries = [env['PLUGINS']['rasterlite']['lib']] libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) -libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) -input_plugin = plugin_env.SharedLibrary('../rasterlite', source=rasterlite_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) +if env['PLUGIN_LINKING'] == 'shared': + libraries.append('mapnik') -# if the plugin links to libmapnik ensure it is built first -Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, + SHLIBPREFIX='', + SHLIBSUFFIX='.input', + source=plugin_sources, + LIBS=libraries, + LINKFLAGS=env['CUSTOM_LDFLAGS']) + + # if the plugin links to libmapnik ensure it is built first + Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + + if 'uninstall' not in COMMAND_LINE_TARGETS: + env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET) + env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) + +plugin_obj = { + 'LIBS': libraries, + 'SOURCES': plugin_sources, +} -if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin) - env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) +Return('plugin_obj') diff -Nru mapnik-2.1.0/plugins/input/rasterlite/rasterlite_datasource.cpp mapnik-2.2.0/plugins/input/rasterlite/rasterlite_datasource.cpp --- mapnik-2.1.0/plugins/input/rasterlite/rasterlite_datasource.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/rasterlite/rasterlite_datasource.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,10 +24,10 @@ #include "rasterlite_featureset.hpp" // boost -#include #include // mapnik +#include #include #include #include @@ -71,7 +71,7 @@ } -rasterlite_datasource::rasterlite_datasource(parameters const& params, bool bind) +rasterlite_datasource::rasterlite_datasource(parameters const& params) : datasource(params), desc_(*params.get("type"),"utf-8") { @@ -91,17 +91,7 @@ else dataset_name_ = *file; - if (bind) - { - this->bind(); - } -} - -void rasterlite_datasource::bind() const -{ - if (is_bound_) return; - - if (!boost::filesystem::exists(dataset_name_)) throw datasource_exception(dataset_name_ + " does not exist"); + if (!mapnik::util::exists(dataset_name_)) throw datasource_exception(dataset_name_ + " does not exist"); void *dataset = open_dataset(); @@ -158,8 +148,6 @@ #endif rasterliteClose(dataset); - - is_bound_ = true; } rasterlite_datasource::~rasterlite_datasource() @@ -178,8 +166,6 @@ box2d rasterlite_datasource::envelope() const { - if (!is_bound_) bind(); - return extent_; } @@ -195,16 +181,12 @@ featureset_ptr rasterlite_datasource::features(query const& q) const { - if (!is_bound_) bind(); - rasterlite_query gq = q; return boost::make_shared(open_dataset(), gq); } -featureset_ptr rasterlite_datasource::features_at_point(coord2d const& pt) const +featureset_ptr rasterlite_datasource::features_at_point(coord2d const& pt, double tol) const { - if (!is_bound_) bind(); - rasterlite_query gq = pt; return boost::make_shared(open_dataset(), gq); } diff -Nru mapnik-2.1.0/plugins/input/rasterlite/rasterlite_datasource.hpp mapnik-2.2.0/plugins/input/rasterlite/rasterlite_datasource.hpp --- mapnik-2.1.0/plugins/input/rasterlite/rasterlite_datasource.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/rasterlite/rasterlite_datasource.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -45,20 +45,19 @@ class rasterlite_datasource : public mapnik::datasource { public: - rasterlite_datasource(mapnik::parameters const& params, bool bind = true); + rasterlite_datasource(mapnik::parameters const& params); virtual ~rasterlite_datasource (); mapnik::datasource::datasource_t type() const; static const char * name(); mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; + mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; mapnik::box2d envelope() const; boost::optional get_geometry_type() const; mapnik::layer_descriptor get_descriptor() const; - void bind() const; private: void* open_dataset() const; - mutable mapnik::box2d extent_; + mapnik::box2d extent_; std::string dataset_name_; std::string table_name_; mapnik::layer_descriptor desc_; diff -Nru mapnik-2.1.0/plugins/input/rasterlite/rasterlite_featureset.cpp mapnik-2.2.0/plugins/input/rasterlite/rasterlite_featureset.cpp --- mapnik-2.1.0/plugins/input/rasterlite/rasterlite_featureset.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/rasterlite/rasterlite_featureset.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,17 +24,19 @@ // mapnik #include +#include #include +#include +#include +#include #include // boost #include -using mapnik::query; using mapnik::coord2d; using mapnik::box2d; -using mapnik::Feature; using mapnik::feature_ptr; using mapnik::geometry_type; using mapnik::query; @@ -127,7 +129,8 @@ { if (size > 0) { - mapnik::image_data_32 image(width, height); + mapnik::raster_ptr rasterp = boost::make_shared(intersect, width, height); + mapnik::image_data_32 & image = rasterp->data_; image.set(0xffffffff); unsigned char* raster_data = static_cast(raster); @@ -135,7 +138,7 @@ memcpy (image_data, raster_data, size); - feature->set_raster(boost::make_shared(intersect,image)); + feature->set_raster(rasterp); free (raster); diff -Nru mapnik-2.1.0/plugins/input/rasterlite/rasterlite_featureset.hpp mapnik-2.2.0/plugins/input/rasterlite/rasterlite_featureset.hpp --- mapnik-2.1.0/plugins/input/rasterlite/rasterlite_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/rasterlite/rasterlite_featureset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,6 +24,8 @@ #define RASTERLITE_FEATURESET_HPP // mapnik +#include +#include #include // boost diff -Nru mapnik-2.1.0/plugins/input/shape/build.py mapnik-2.2.0/plugins/input/shape/build.py --- mapnik-2.1.0/plugins/input/shape/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/shape/build.py 2013-06-04 01:35:27.000000000 +0000 @@ -1,7 +1,7 @@ - +# # This file is part of Mapnik (c++ mapping toolkit) # -# Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon +# Copyright (C) 2013 Artem Pavlenko # # Mapnik is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,50 +17,69 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ - +# Import ('plugin_base') Import ('env') -prefix = env['PREFIX'] +PLUGIN_NAME = 'shape' plugin_env = plugin_base.Clone() -shape_src = Split( +plugin_sources = Split( """ - dbfile.cpp - shape_datasource.cpp - shape_featureset.cpp - shape_index_featureset.cpp - shape_io.cpp - shape_utils.cpp - """ - ) - -libraries = [] + %(PLUGIN_NAME)s_datasource.cpp + %(PLUGIN_NAME)s_featureset.cpp + %(PLUGIN_NAME)s_index_featureset.cpp + %(PLUGIN_NAME)s_io.cpp + %(PLUGIN_NAME)s_utils.cpp + dbfile.cpp + """ % locals() +) # Link Library to Dependencies -libraries.append('mapnik') +libraries = [] libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) -libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) + +cppdefines = [] +cxxflags = [] if env['SHAPE_MEMORY_MAPPED_FILE']: - plugin_env.Append(CXXFLAGS = '-DSHAPE_MEMORY_MAPPED_FILE') + cppdefines.append('-DSHAPE_MEMORY_MAPPED_FILE') if env.get('BOOST_LIB_VERSION_FROM_HEADER'): boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1]) if boost_version_from_header < 46: # avoid ubuntu issue with boost interprocess: # https://github.com/mapnik/mapnik/issues/1082 - plugin_env.Append(CXXFLAGS = '-fpermissive') + cxxflags.append('-fpermissive') + +plugin_env.Append(CXXFLAGS=cxxflags) +plugin_env.Append(CPPDEFINES=cppdefines) -input_plugin = plugin_env.SharedLibrary('../shape', SHLIBSUFFIX='.input', source=shape_src, SHLIBPREFIX='', LIBS = libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) +if env['PLUGIN_LINKING'] == 'shared': + libraries.append('mapnik') -# if the plugin links to libmapnik ensure it is built first -Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + TARGET = plugin_env.SharedLibrary('../shape', + SHLIBSUFFIX='.input', + SHLIBPREFIX='', + source=plugin_sources, + LIBS=libraries, + LINKFLAGS=env['CUSTOM_LDFLAGS']) + + # if the plugin links to libmapnik ensure it is built first + Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + + if 'uninstall' not in COMMAND_LINE_TARGETS: + env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET) + env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) + +plugin_obj = { + 'LIBS': libraries, + 'SOURCES': plugin_sources, + 'CXXFLAGS': cxxflags, + 'CPPDEFINES': cppdefines, +} -if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin) - env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) +Return('plugin_obj') diff -Nru mapnik-2.1.0/plugins/input/shape/dbf_test.cpp mapnik-2.2.0/plugins/input/shape/dbf_test.cpp --- mapnik-2.1.0/plugins/input/shape/dbf_test.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/shape/dbf_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -41,22 +41,21 @@ for (int i=0;i 0) + { + cout << name << "(" << width <<"," << dec << "):" << val << endl; + } + else + { + cout << name << "(" << width << "):" << val << endl; + } } cout< #include #include #include +#include #include "dbfile.hpp" // boost -#include #include +#include // for int16_t and int32_t #include + // stl #include +#include +using mapnik::mapped_memory_cache; dbf_file::dbf_file() : num_records_(0), @@ -46,6 +51,8 @@ record_length_(0), #ifdef SHAPE_MEMORY_MAPPED_FILE file_(), +#elif defined(_WINDOWS) + file_(mapnik::utf8_to_utf16(file_name), std::ios::in | std::ios::binary), #else file_(file_name.c_str() ,std::ios::in | std::ios::binary), #endif @@ -53,11 +60,16 @@ { #ifdef SHAPE_MEMORY_MAPPED_FILE - boost::optional memory = mapnik::mapped_memory_cache::find(file_name.c_str(),true); + boost::optional memory = mapped_memory_cache::instance().find(file_name,true); if (memory) { + mapped_region_ = *memory; file_.buffer(static_cast((*memory)->get_address()),(*memory)->get_size()); } + else + { + throw std::runtime_error("could not create file mapping for "+file_name); + } #endif if (file_) { @@ -121,7 +133,7 @@ } -void dbf_file::add_attribute(int col, mapnik::transcoder const& tr, Feature & f) const throw() +void dbf_file::add_attribute(int col, mapnik::transcoder const& tr, mapnik::feature_impl & f) const throw() { using namespace boost::spirit; @@ -132,23 +144,34 @@ switch (fields_[col].type_) { case 'C': - case 'D'://todo handle date? - case 'M': - case 'L': + case 'D': { // FIXME - avoid constructing std::string on stack std::string str(record_+fields_[col].offset_,fields_[col].length_); - boost::trim(str); + mapnik::util::trim(str); f.put(name,tr.transcode(str.c_str())); break; } + case 'L': + { + char ch = record_[fields_[col].offset_]; + if ( ch == '1' || ch == 't' || ch == 'T' || ch == 'y' || ch == 'Y') + { + f.put(name,true); + } + else + { + // NOTE: null logical fields use '?' + f.put(name,false); + } + break; + } case 'N': - case 'F': { - if (record_[fields_[col].offset_] == '*') { - f.put(name,0); + // NOTE: we intentionally do not store null here + // since it is equivalent to the attribute not existing break; } if ( fields_[col].dec_>0 ) @@ -156,17 +179,15 @@ double val = 0.0; const char *itr = record_+fields_[col].offset_; const char *end = itr + fields_[col].length_; - bool r = qi::phrase_parse(itr,end,double_,ascii::space,val); - if (r && (itr == end)) + if (qi::phrase_parse(itr,end,double_,ascii::space,val)) f.put(name,val); } else { - int val = 0; + mapnik::value_integer val = 0; const char *itr = record_+fields_[col].offset_; const char *end = itr + fields_[col].length_; - bool r = qi::phrase_parse(itr,end,int_,ascii::space,val); - if (r && (itr == end)) + if (qi::phrase_parse(itr,end,int_,ascii::space,val)) f.put(name,val); } break; @@ -196,7 +217,9 @@ field_descriptor desc; desc.index_=i; file_.read(name,10); - desc.name_=boost::trim_left_copy(std::string(name)); + desc.name_=name; + // TODO - when is this trim needed? + mapnik::util::trim(desc.name_); skip(1); desc.type_=file_.get(); skip(4); diff -Nru mapnik-2.1.0/plugins/input/shape/dbfile.hpp mapnik-2.2.0/plugins/input/shape/dbfile.hpp --- mapnik-2.1.0/plugins/input/shape/dbfile.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/shape/dbfile.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,9 +23,13 @@ #ifndef DBFFILE_HPP #define DBFFILE_HPP +// mapnik #include +#include +#include +#include + // boost -#include #include // stl @@ -34,9 +38,6 @@ #include #include -using mapnik::transcoder; -using mapnik::Feature; - struct field_descriptor { int index_; @@ -48,7 +49,7 @@ }; -class dbf_file : private boost::noncopyable +class dbf_file : private mapnik::noncopyable { private: int num_records_; @@ -57,13 +58,14 @@ std::vector fields_; #ifdef SHAPE_MEMORY_MAPPED_FILE boost::interprocess::ibufferstream file_; + mapnik::mapped_region_ptr mapped_region_; #else std::ifstream file_; #endif char* record_; public: dbf_file(); - dbf_file(const std::string& file_name); + dbf_file(std::string const& file_name); ~dbf_file(); bool is_open(); int num_records() const; @@ -71,7 +73,7 @@ field_descriptor const& descriptor(int col) const; void move_to(int index); std::string string_value(int col) const; - void add_attribute(int col, transcoder const& tr, Feature & f) const throw(); + void add_attribute(int col, mapnik::transcoder const& tr, mapnik::feature_impl & f) const throw(); private: void read_header(); int read_short(); diff -Nru mapnik-2.1.0/plugins/input/shape/shape_datasource.cpp mapnik-2.2.0/plugins/input/shape/shape_datasource.cpp --- mapnik-2.1.0/plugins/input/shape/shape_datasource.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/shape/shape_datasource.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2011 Artem Pavlenko + * Copyright (C) 2013 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -28,20 +28,20 @@ #include #include #include -#include #include // mapnik #include +#include #include +#include #include -#include #include #include #include +#include // stl -#include #include #include @@ -50,19 +50,23 @@ using mapnik::String; using mapnik::Double; using mapnik::Integer; +using mapnik::Boolean; using mapnik::datasource_exception; using mapnik::filter_in_box; using mapnik::filter_at_point; using mapnik::attribute_descriptor; -shape_datasource::shape_datasource(const parameters ¶ms, bool bind) +shape_datasource::shape_datasource(const parameters ¶ms) : datasource (params), type_(datasource::Vector), file_length_(0), indexed_(false), - row_limit_(*params_.get("row_limit",0)), + row_limit_(*params.get("row_limit",0)), desc_(*params.get("type"), *params.get("encoding","utf-8")) { +#ifdef MAPNIK_STATS + mapnik::progress_timer __stats__(std::clog, "shape_datasource::init"); +#endif boost::optional file = params.get("file"); if (!file) throw datasource_exception("Shape Plugin: missing parameter"); @@ -73,41 +77,23 @@ shape_name_ = *file; boost::algorithm::ireplace_last(shape_name_,".shp",""); - - if (bind) - { - this->bind(); - } -} - -void shape_datasource::bind() const -{ - if (is_bound_) return; - -#ifdef MAPNIK_STATS - mapnik::progress_timer __stats__(std::clog, "shape_datasource::bind"); -#endif - - if (!boost::filesystem::exists(shape_name_ + ".shp")) + if (!mapnik::util::exists(shape_name_ + ".shp")) { throw datasource_exception("Shape Plugin: shapefile '" + shape_name_ + ".shp' does not exist"); } - - if (boost::filesystem::is_directory(shape_name_ + ".shp")) + if (mapnik::util::is_directory(shape_name_ + ".shp")) { throw datasource_exception("Shape Plugin: shapefile '" + shape_name_ + ".shp' appears to be a directory not a file"); } - - if (!boost::filesystem::exists(shape_name_ + ".dbf")) + if (!mapnik::util::exists(shape_name_ + ".dbf")) { throw datasource_exception("Shape Plugin: shapefile '" + shape_name_ + ".dbf' does not exist"); } - try { #ifdef MAPNIK_STATS - mapnik::progress_timer __stats2__(std::clog, "shape_datasource::bind(get_column_description)"); + mapnik::progress_timer __stats2__(std::clog, "shape_datasource::init(get_column_description)"); #endif boost::shared_ptr shape_ref = boost::make_shared(shape_name_); @@ -121,10 +107,12 @@ case 'C': // character case 'D': // Date case 'M': // Memo, a string - case 'L': // logical case '@': // timestamp desc_.add_descriptor(attribute_descriptor(fld_name, String)); break; + case 'L': // logical + desc_.add_descriptor(attribute_descriptor(fld_name, Boolean)); + break; case 'N': case 'O': // double case 'F': // float @@ -153,7 +141,7 @@ } } - catch (const datasource_exception& ex) + catch (datasource_exception const& ex) { MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing field attributes, " << ex.what(); throw; @@ -169,12 +157,9 @@ throw; } - is_bound_ = true; } -shape_datasource::~shape_datasource() {} - -void shape_datasource::init(shape_io& shape) const +void shape_datasource::init(shape_io& shape) { #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "shape_datasource::init"); @@ -217,27 +202,14 @@ #endif // check if we have an index file around - indexed_ = shape.has_index(); - - //std::string index_name(shape_name_+".index"); - //std::ifstream file(index_name.c_str(),std::ios::in | std::ios::binary); - //if (file) - //{ - // indexed_=true; - // file.close(); - //} - //else - //{ - // MAPNIK_LOG_DEBUG(shape) << "shape_datasource: No .index file found for " - // << shape_name_ << ".shp, use the 'shapeindex' program to build an index for faster rendering"; - //} - MAPNIK_LOG_DEBUG(shape) << "shape_datasource: Extent=" << extent_; MAPNIK_LOG_DEBUG(shape) << "shape_datasource: File length=" << file_length_; MAPNIK_LOG_DEBUG(shape) << "shape_datasource: Shape type=" << shape_type_; } +shape_datasource::~shape_datasource() {} + const char * shape_datasource::name() { return "shape"; @@ -250,14 +222,11 @@ layer_descriptor shape_datasource::get_descriptor() const { - if (!is_bound_) bind(); return desc_; } featureset_ptr shape_datasource::features(const query& q) const { - if (!is_bound_) bind(); - #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "shape_datasource::features"); #endif @@ -286,15 +255,13 @@ } } -featureset_ptr shape_datasource::features_at_point(coord2d const& pt) const +featureset_ptr shape_datasource::features_at_point(coord2d const& pt, double tol) const { - if (!is_bound_) bind(); - #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "shape_datasource::features_at_point"); #endif - filter_at_point filter(pt); + filter_at_point filter(pt,tol); // collect all attribute names std::vector const& desc_vector = desc_.get_descriptors(); std::vector::const_iterator itr = desc_vector.begin(); @@ -332,8 +299,6 @@ box2d shape_datasource::envelope() const { - if (!is_bound_) bind(); - return extent_; } diff -Nru mapnik-2.1.0/plugins/input/shape/shape_datasource.hpp mapnik-2.2.0/plugins/input/shape/shape_datasource.hpp --- mapnik-2.1.0/plugins/input/shape/shape_datasource.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/shape/shape_datasource.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -31,6 +31,7 @@ #include #include #include +#include // boost #include @@ -52,29 +53,28 @@ class shape_datasource : public datasource { public: - shape_datasource(const parameters ¶ms, bool bind=true); + shape_datasource(const parameters ¶ms); virtual ~shape_datasource(); datasource::datasource_t type() const; static const char * name(); featureset_ptr features(const query& q) const; - featureset_ptr features_at_point(coord2d const& pt) const; + featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const; box2d envelope() const; boost::optional get_geometry_type() const; layer_descriptor get_descriptor() const; - void bind() const; private: - void init(shape_io& shape) const; + void init(shape_io& shape); datasource::datasource_t type_; std::string shape_name_; - mutable boost::shared_ptr shape_; - mutable shape_io::shapeType shape_type_; - mutable long file_length_; - mutable box2d extent_; - mutable bool indexed_; + boost::shared_ptr shape_; + shape_io::shapeType shape_type_; + long file_length_; + box2d extent_; + bool indexed_; const int row_limit_; - mutable layer_descriptor desc_; + layer_descriptor desc_; }; #endif //SHAPE_HPP diff -Nru mapnik-2.1.0/plugins/input/shape/shape_featureset.cpp mapnik-2.2.0/plugins/input/shape/shape_featureset.cpp --- mapnik-2.1.0/plugins/input/shape/shape_featureset.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/shape/shape_featureset.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,6 +26,10 @@ // mapnik #include #include +#include + +// boost +#include #include "shape_featureset.hpp" #include "shape_utils.hpp" @@ -44,6 +48,7 @@ : filter_(filter), shape_(shape_name, false), query_ext_(), + feature_bbox_(), tr_(new transcoder(encoding)), file_length_(file_length), row_limit_(row_limit), @@ -57,181 +62,79 @@ template feature_ptr shape_featureset::next() { - if (row_limit_ && count_ > row_limit_) + if (row_limit_ && count_ >= row_limit_) { return feature_ptr(); } - std::streampos pos = shape_.shp().pos(); - // skip null shapes - while (pos > 0 && pos < std::streampos(file_length_ * 2)) + while (shape_.shp().pos() < std::streampos(file_length_ * 2)) { - shape_.move_to(pos); - if (shape_.type() == shape_io::shape_null) - { - pos += std::streampos(12); - } - else - { - break; - } - } + shape_.move_to(shape_.shp().pos()); + shape_file::record_type record(shape_.reclength_ * 2); + shape_.shp().read_record(record); + int type = record.read_ndr_integer(); - if (pos < std::streampos(file_length_ * 2)) - { - int type = shape_.type(); - feature_ptr feature(feature_factory::create(ctx_, shape_.id_)); + // skip null shapes + if (type == shape_io::shape_null) continue; - if (type == shape_io::shape_point) - { - double x = shape_.shp().read_double(); - double y = shape_.shp().read_double(); - geometry_type* point = new geometry_type(mapnik::Point); - point->move_to(x, y); - feature->add_geometry(point); - ++count_; - } - else if (type == shape_io::shape_pointm) + feature_ptr feature(feature_factory::create(ctx_, shape_.id_)); + switch (type) { - double x = shape_.shp().read_double(); - double y = shape_.shp().read_double(); - // skip m - shape_.shp().skip(8); - geometry_type* point = new geometry_type(mapnik::Point); + case shape_io::shape_point: + case shape_io::shape_pointm: + case shape_io::shape_pointz: + { + double x = record.read_double(); + double y = record.read_double(); + if (!filter_.pass(mapnik::box2d(x,y,x,y))) + continue; + std::auto_ptr point(new geometry_type(mapnik::Point)); point->move_to(x, y); - feature->add_geometry(point); - ++count_; + feature->paths().push_back(point); + break; } - else if (type == shape_io::shape_pointz) - { - double x = shape_.shp().read_double(); - double y = shape_.shp().read_double(); - // skip z - shape_.shp().skip(8); - // skip m if exists - if (shape_.reclength_ == 8 + 36) - { - shape_.shp().skip(8); + case shape_io::shape_multipoint: + case shape_io::shape_multipointm: + case shape_io::shape_multipointz: + { + shape_io::read_bbox(record, feature_bbox_); + if (!filter_.pass(feature_bbox_)) continue; + int num_points = record.read_ndr_integer(); + for (int i = 0; i < num_points; ++i) + { + double x = record.read_double(); + double y = record.read_double(); + std::auto_ptr point(new geometry_type(mapnik::Point)); + point->move_to(x, y); + feature->paths().push_back(point); } - geometry_type* point = new geometry_type(mapnik::Point); - point->move_to(x, y); - feature->add_geometry(point); - ++count_; + break; } - else - { - // skip shapes - for (;;) - { - std::streampos pos = shape_.shp().pos(); - if (shape_.type() == shape_io::shape_null) - { - pos += std::streampos(12); - - // TODO handle the shapes - MAPNIK_LOG_WARN(shape) << "shape_featureset: NULL SHAPE len=" << shape_.reclength_; - } - else if (filter_.pass(shape_.current_extent())) - { - break; - } - else - { - pos += std::streampos(2 * shape_.reclength_ - 36); - } - - if (pos > 0 && pos < std::streampos(file_length_ * 2)) - { - shape_.move_to(pos); - } - else - { - MAPNIK_LOG_DEBUG(shape) << "shape_featureset: Total shapes read=" << count_; - - return feature_ptr(); - } - } - - switch (type) - { - case shape_io::shape_multipoint: - { - int num_points = shape_.shp().read_ndr_integer(); - for (int i = 0; i < num_points; ++i) - { - double x = shape_.shp().read_double(); - double y = shape_.shp().read_double(); - geometry_type* point = new geometry_type(mapnik::Point); - point->move_to(x, y); - feature->add_geometry(point); - } - ++count_; - break; - } - - case shape_io::shape_multipointm: - { - int num_points = shape_.shp().read_ndr_integer(); - for (int i = 0; i < num_points; ++i) - { - double x = shape_.shp().read_double(); - double y = shape_.shp().read_double(); - geometry_type* point = new geometry_type(mapnik::Point); - point->move_to(x, y); - feature->add_geometry(point); - } - // skip m - shape_.shp().skip(2 * 8 + 8 * num_points); - ++count_; - break; - } - - case shape_io::shape_multipointz: - { - int num_points = shape_.shp().read_ndr_integer(); - for (int i = 0; i < num_points; ++i) - { - double x = shape_.shp().read_double(); - double y = shape_.shp().read_double(); - geometry_type* point = new geometry_type(mapnik::Point); - point->move_to(x, y); - feature->add_geometry(point); - } - - // skip z - shape_.shp().skip(2 * 8 + 8 * num_points); - - // check if we have measure data - if (shape_.reclength_ == (unsigned)(num_points * 16 + 36)) - { - // skip m - shape_.shp().skip(2 * 8 + 8 * num_points); - } - ++count_; - break; - } - - case shape_io::shape_polyline: - case shape_io::shape_polylinem: - case shape_io::shape_polylinez: - { - shape_.read_polyline(feature->paths()); - ++count_; - break; - } - - case shape_io::shape_polygon: - case shape_io::shape_polygonm: - case shape_io::shape_polygonz: - { - shape_.read_polygon(feature->paths()); - ++count_; - break; - } - } + case shape_io::shape_polyline: + case shape_io::shape_polylinem: + case shape_io::shape_polylinez: + { + shape_io::read_bbox(record, feature_bbox_); + if (!filter_.pass(feature_bbox_)) continue; + shape_io::read_polyline(record, feature->paths()); + break; } + case shape_io::shape_polygon: + case shape_io::shape_polygonm: + case shape_io::shape_polygonz: + { + shape_io::read_bbox(record, feature_bbox_); + if (!filter_.pass(feature_bbox_)) continue; + shape_io::read_polygon(record, feature->paths()); + break; + } + default : + MAPNIK_LOG_DEBUG(shape) << "shape_featureset: Unsupported type" << type; + return feature_ptr(); + } + // FIXME: https://github.com/mapnik/mapnik/issues/1020 feature->set_id(shape_.id_); if (attr_ids_.size()) @@ -251,15 +154,12 @@ MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing attributes"; } } - + ++count_; return feature; } - else - { - MAPNIK_LOG_DEBUG(shape) << "shape_featureset: Total shapes read=" << count_; - return feature_ptr(); - } + MAPNIK_LOG_DEBUG(shape) << "shape_featureset: Total shapes read=" << count_; + return feature_ptr(); } template diff -Nru mapnik-2.1.0/plugins/input/shape/shape_featureset.hpp mapnik-2.2.0/plugins/input/shape/shape_featureset.hpp --- mapnik-2.1.0/plugins/input/shape/shape_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/shape/shape_featureset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,8 +24,11 @@ #define SHAPE_FEATURESET_HPP //mapnik -#include #include +#include +#include +#include +#include #include "shape_io.hpp" @@ -56,10 +59,11 @@ filterT filter_; shape_io shape_; box2d query_ext_; + mutable box2d feature_bbox_; boost::scoped_ptr tr_; long file_length_; std::vector attr_ids_; - const int row_limit_; + mapnik::value_integer row_limit_; mutable int count_; context_ptr ctx_; }; diff -Nru mapnik-2.1.0/plugins/input/shape/shape_index_featureset.cpp mapnik-2.2.0/plugins/input/shape/shape_index_featureset.cpp --- mapnik-2.1.0/plugins/input/shape/shape_index_featureset.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/shape/shape_index_featureset.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -30,9 +30,11 @@ // boost #include #include +#include #include "shape_index_featureset.hpp" #include "shape_utils.hpp" +#include "shp_index.hpp" using mapnik::feature_factory; using mapnik::geometry_type; @@ -47,9 +49,10 @@ : filter_(filter), ctx_(boost::make_shared()), shape_(shape), - tr_(new transcoder(encoding)), + tr_(new mapnik::transcoder(encoding)), row_limit_(row_limit), - count_(0) + count_(0), + feature_bbox_() { shape_.shp().skip(100); setup_attributes(ctx_, attribute_names, shape_name, shape_,attr_ids_); @@ -58,125 +61,89 @@ if (index) { #ifdef SHAPE_MEMORY_MAPPED_FILE - //shp_index >::query(filter, index->file(), ids_); - shp_index::query(filter, index->file(), ids_); + //shp_index >::query(filter, index->file(), offsets_); + shp_index::query(filter, index->file(), offsets_); #else - shp_index::query(filter, index->file(), ids_); + shp_index::query(filter, index->file(), offsets_); #endif } - std::sort(ids_.begin(), ids_.end()); + std::sort(offsets_.begin(), offsets_.end()); - MAPNIK_LOG_DEBUG(shape) << "shape_index_featureset: Query size=" << ids_.size(); + MAPNIK_LOG_DEBUG(shape) << "shape_index_featureset: Query size=" << offsets_.size(); - itr_ = ids_.begin(); + itr_ = offsets_.begin(); } template feature_ptr shape_index_featureset::next() { - if (row_limit_ && count_ > row_limit_) + if (row_limit_ && count_ >= row_limit_) { return feature_ptr(); } - if (itr_ != ids_.end()) + while ( itr_ != offsets_.end()) { - int pos = *itr_++; - shape_.move_to(pos); - - int type = shape_.type(); + shape_.move_to(*itr_++); + shape_file::record_type record(shape_.reclength_ * 2); + shape_.shp().read_record(record); + int type = record.read_ndr_integer(); feature_ptr feature(feature_factory::create(ctx_,shape_.id_)); - if (type == shape_io::shape_point) + + switch (type) { - double x = shape_.shp().read_double(); - double y = shape_.shp().read_double(); - geometry_type* point = new geometry_type(mapnik::Point); - point->move_to(x, y); - feature->add_geometry(point); - ++count_; - } - else if (type == shape_io::shape_pointm) + case shape_io::shape_point: + case shape_io::shape_pointm: + case shape_io::shape_pointz: { - double x = shape_.shp().read_double(); - double y = shape_.shp().read_double(); - // skip m - shape_.shp().skip(8); - geometry_type* point = new geometry_type(mapnik::Point); + double x = record.read_double(); + double y = record.read_double(); + std::auto_ptr point(new geometry_type(mapnik::Point)); point->move_to(x, y); - feature->add_geometry(point); - ++count_; + feature->paths().push_back(point); + break; } - else if (type == shape_io::shape_pointz) + case shape_io::shape_multipoint: + case shape_io::shape_multipointm: + case shape_io::shape_multipointz: { - double x = shape_.shp().read_double(); - double y = shape_.shp().read_double(); - // skip z - shape_.shp().skip(8); - // skip m if exists - if (shape_.reclength_ == 8 + 36) - { - shape_.shp().skip(8); + shape_io::read_bbox(record, feature_bbox_); + if (!filter_.pass(feature_bbox_)) continue; + int num_points = record.read_ndr_integer(); + for (int i = 0; i < num_points; ++i) + { + double x = record.read_double(); + double y = record.read_double(); + std::auto_ptr point(new geometry_type(mapnik::Point)); + point->move_to(x, y); + feature->paths().push_back(point); } - geometry_type* point = new geometry_type(mapnik::Point); - point->move_to(x, y); - feature->add_geometry(point); - ++count_; + break; } - else + case shape_io::shape_polyline: + case shape_io::shape_polylinem: + case shape_io::shape_polylinez: { - while(! filter_.pass(shape_.current_extent()) && - itr_ != ids_.end()) - { - if (shape_.type() != shape_io::shape_null) - { - pos = *itr_++; - shape_.move_to(pos); - } - else - { - return feature_ptr(); - } - } - - switch (type) - { - case shape_io::shape_multipoint: - case shape_io::shape_multipointm: - case shape_io::shape_multipointz: - { - int num_points = shape_.shp().read_ndr_integer(); - for (int i = 0; i < num_points; ++i) - { - double x = shape_.shp().read_double(); - double y = shape_.shp().read_double(); - geometry_type* point = new geometry_type(mapnik::Point); - point->move_to(x, y); - feature->add_geometry(point); - } - // ignore m and z for now - ++count_; - break; - } - - case shape_io::shape_polyline: - case shape_io::shape_polylinem: - case shape_io::shape_polylinez: - { - shape_.read_polyline(feature->paths()); - ++count_; - break; - } - case shape_io::shape_polygon: - case shape_io::shape_polygonm: - case shape_io::shape_polygonz: - { - shape_.read_polygon(feature->paths()); - ++count_; - break; - } - } + shape_io::read_bbox(record, feature_bbox_); + if (!filter_.pass(feature_bbox_)) continue; + shape_io::read_polyline(record,feature->paths()); + break; } + case shape_io::shape_polygon: + case shape_io::shape_polygonm: + case shape_io::shape_polygonz: + { + shape_io::read_bbox(record, feature_bbox_); + if (!filter_.pass(feature_bbox_)) continue; + shape_io::read_polygon(record,feature->paths()); + break; + } + default : + MAPNIK_LOG_DEBUG(shape) << "shape_index_featureset: Unsupported type" << type; + return feature_ptr(); + } + // FIXME feature->set_id(shape_.id_); if (attr_ids_.size()) @@ -196,14 +163,12 @@ MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing attributes"; } } + ++count_; return feature; } - else - { - MAPNIK_LOG_DEBUG(shape) << "shape_index_featureset: " << count_ << " features"; - return feature_ptr(); - } + MAPNIK_LOG_DEBUG(shape) << "shape_index_featureset: " << count_ << " features"; + return feature_ptr(); } diff -Nru mapnik-2.1.0/plugins/input/shape/shape_index_featureset.hpp mapnik-2.2.0/plugins/input/shape/shape_index_featureset.hpp --- mapnik-2.1.0/plugins/input/shape/shape_index_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/shape/shape_index_featureset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -29,6 +29,9 @@ // mapnik #include +#include +#include +#include // boost #include @@ -59,12 +62,13 @@ filterT filter_; context_ptr ctx_; shape_io & shape_; - boost::scoped_ptr tr_; - std::vector ids_; - std::vector::iterator itr_; + boost::scoped_ptr tr_; + std::vector offsets_; + std::vector::iterator itr_; std::vector attr_ids_; - const int row_limit_; + mapnik::value_integer row_limit_; mutable int count_; + mutable box2d feature_bbox_; }; #endif // SHAPE_INDEX_FEATURESET_HPP diff -Nru mapnik-2.1.0/plugins/input/shape/shape_io.cpp mapnik-2.2.0/plugins/input/shape/shape_io.cpp --- mapnik-2.1.0/plugins/input/shape/shape_io.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/shape/shape_io.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -27,7 +27,6 @@ #include // boost -#include #include using mapnik::datasource_exception; @@ -37,7 +36,7 @@ const std::string shape_io::DBF = ".dbf"; const std::string shape_io::INDEX = ".index"; -shape_io::shape_io(const std::string& shape_name, bool open_index) +shape_io::shape_io(std::string const& shape_name, bool open_index) : type_(shape_null), shp_(shape_name + SHP), dbf_(shape_name + DBF), @@ -65,27 +64,11 @@ shape_io::~shape_io() {} -void shape_io::move_to(int pos) +void shape_io::move_to(std::streampos pos) { shp_.seek(pos); id_ = shp_.read_xdr_integer(); reclength_ = shp_.read_xdr_integer(); - type_ = static_cast(shp_.read_ndr_integer()); - - if (type_ != shape_null && type_ != shape_point && type_ != shape_pointm && type_ != shape_pointz) - { - shp_.read_envelope(cur_extent_); - } -} - -shape_io::shapeType shape_io::type() const -{ - return type_; -} - -const box2d& shape_io::current_extent() const -{ - return cur_extent_; } shape_file& shape_io::shp() @@ -98,11 +81,17 @@ return dbf_; } -void shape_io::read_polyline(mapnik::geometry_container & geom) +void shape_io::read_bbox(shape_file::record_type & record, mapnik::box2d & bbox) { - shape_file::record_type record(reclength_ * 2 - 36); - shp_.read_record(record); + double lox = record.read_double(); + double loy = record.read_double(); + double hix = record.read_double(); + double hiy = record.read_double(); + bbox.init(lox, loy, hix, hiy); +} +void shape_io::read_polyline( shape_file::record_type & record, mapnik::geometry_container & geom) +{ int num_parts = record.read_ndr_integer(); int num_points = record.read_ndr_integer(); if (num_parts == 1) @@ -155,30 +144,10 @@ geom.push_back(line); } } - // z-range - //double z0=record.read_double(); - //double z1=record.read_double(); - //for (int i=0;i parts(num_parts); @@ -205,33 +174,13 @@ double x = record.read_double(); double y = record.read_double(); poly->move_to(x, y); - - for (int j=start+1;jline_to(x, y); } - x = record.read_double(); - y = record.read_double(); - poly->close(x, y); - + poly->close_path(); geom.push_back(poly); } - // z-range - //double z0=record.read_double(); - //double z1=record.read_double(); - //for (int i=0;i -#include +#include +#include // boost -#include #include #include "dbfile.hpp" #include "shapefile.hpp" -#include "shp_index.hpp" -struct shape_io : boost::noncopyable +struct shape_io : mapnik::noncopyable { public: enum shapeType @@ -56,7 +55,7 @@ shape_multipatch = 31 }; - shape_io(const std::string& shape_name, bool open_index=true); + shape_io(std::string const& shape_name, bool open_index=true); ~shape_io(); shape_file& shp(); @@ -72,11 +71,11 @@ return (index_ && index_->is_open()); } - void move_to(int id); - shapeType type() const; - const box2d& current_extent() const; - void read_polyline(mapnik::geometry_container & geom); - void read_polygon(mapnik::geometry_container & geom); + void move_to(std::streampos pos); + static void read_bbox(shape_file::record_type & record, mapnik::box2d & bbox); + static void read_polyline(shape_file::record_type & record,mapnik::geometry_container & geom); + static void read_polygon(shape_file::record_type & record,mapnik::geometry_container & geom); + shapeType type_; shape_file shp_; dbf_file dbf_; diff -Nru mapnik-2.1.0/plugins/input/shape/shape_utils.cpp mapnik-2.2.0/plugins/input/shape/shape_utils.cpp --- mapnik-2.1.0/plugins/input/shape/shape_utils.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/shape/shape_utils.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,14 +23,11 @@ // mapnik #include #include +#include #include "shape_utils.hpp" // boost #include -// stl -#include -#include - void setup_attributes(mapnik::context_ptr const& ctx, std::set const& names, @@ -56,19 +53,17 @@ if (! found_name) { - std::ostringstream s; - - s << "no attribute '" << *pos << "' in '" - << shape_name << "'. Valid attributes are: "; - + std::string s("no attribute '"); + std::string pos_string; + s += *pos + "' in '" + shape_name + "'. Valid attributes are: "; std::vector list; for (int i = 0; i < shape.dbf().num_fields(); ++i) { list.push_back(shape.dbf().descriptor(i).name_); } - s << boost::algorithm::join(list, ",") << "."; + s += boost::algorithm::join(list, ",") + "."; - throw mapnik::datasource_exception("Shape Plugin: " + s.str()); + throw mapnik::datasource_exception("Shape Plugin: " + s); } } } diff -Nru mapnik-2.1.0/plugins/input/shape/shapefile.hpp mapnik-2.2.0/plugins/input/shape/shapefile.hpp --- mapnik-2.1.0/plugins/input/shape/shapefile.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/shape/shapefile.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,14 +26,17 @@ // stl #include #include +#include + // mapnik #include +#include #include #include +#include // boost -#include #include #include @@ -72,9 +75,9 @@ size_t size; mutable size_t pos; - explicit shape_record(size_t size) - : data(Tag::alloc(size)), - size(size), + explicit shape_record(size_t size_) + : data(Tag::alloc(size_)), + size(size_), pos(0) {} @@ -130,13 +133,14 @@ using namespace boost::interprocess; -class shape_file : boost::noncopyable +class shape_file : mapnik::noncopyable { public: #ifdef SHAPE_MEMORY_MAPPED_FILE typedef ibufferstream file_source_type; typedef shape_record record_type; + mapnik::mapped_region_ptr mapped_region_; #else typedef std::ifstream file_source_type; typedef shape_record record_type; @@ -149,17 +153,24 @@ shape_file(std::string const& file_name) : #ifdef SHAPE_MEMORY_MAPPED_FILE file_() +#elif defined (_WINDOWS) + file_(mapnik::utf8_to_utf16(file_name), std::ios::in | std::ios::binary) #else file_(file_name.c_str(), std::ios::in | std::ios::binary) #endif { #ifdef SHAPE_MEMORY_MAPPED_FILE boost::optional memory = - mapnik::mapped_memory_cache::find(file_name.c_str(),true); + mapnik::mapped_memory_cache::instance().find(file_name,true); if (memory) { - file_.buffer(static_cast((*memory)->get_address()), (*memory)->get_size()); + mapped_region_ = *memory; + file_.buffer(static_cast((*memory)->get_address()),(*memory)->get_size()); + } + else + { + throw std::runtime_error("could not create file mapping for "+file_name); } #endif } diff -Nru mapnik-2.1.0/plugins/input/shape/shp_index.hpp mapnik-2.2.0/plugins/input/shape/shp_index.hpp --- mapnik-2.1.0/plugins/input/shape/shp_index.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/shape/shp_index.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef SHP_INDEX_HH -#define SHP_INDEX_HH +#ifndef SHP_INDEX_HPP +#define SHP_INDEX_HPP // stl #include @@ -38,7 +38,7 @@ class shp_index { public: - static void query(const filterT& filter, IStream& file,std::vector& pos); + static void query(filterT const& filter, IStream& file,std::vector& pos); private: shp_index(); ~shp_index(); @@ -46,18 +46,18 @@ shp_index& operator=(const shp_index&); static int read_ndr_integer(IStream& in); static void read_envelope(IStream& in, box2d& envelope); - static void query_node(const filterT& filter, IStream& in, std::vector& pos); + static void query_node(const filterT& filter, IStream& in, std::vector& pos); }; template -void shp_index::query(const filterT& filter, IStream& file, std::vector& pos) +void shp_index::query(const filterT& filter, IStream& file, std::vector& pos) { file.seekg(16, std::ios::beg); query_node(filter, file, pos); } template -void shp_index::query_node(const filterT& filter, IStream& file, std::vector& ids) +void shp_index::query_node(const filterT& filter, IStream& file, std::vector& ids) { int offset = read_ndr_integer(file); @@ -100,4 +100,4 @@ file.read(reinterpret_cast(&envelope), sizeof(envelope)); } -#endif // SHP_INDEX_HH +#endif // SHP_INDEX_HPP diff -Nru mapnik-2.1.0/plugins/input/sqlite/build.py mapnik-2.2.0/plugins/input/sqlite/build.py --- mapnik-2.1.0/plugins/input/sqlite/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/sqlite/build.py 2013-06-04 01:35:27.000000000 +0000 @@ -1,7 +1,7 @@ # # This file is part of Mapnik (c++ mapping toolkit) # -# Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon +# Copyright (C) 2013 Artem Pavlenko # # Mapnik is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,39 +17,53 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# Import ('plugin_base') Import ('env') -prefix = env['PREFIX'] +PLUGIN_NAME = 'sqlite' plugin_env = plugin_base.Clone() -sqlite_src = Split( - """ - sqlite_datasource.cpp - sqlite_featureset.cpp +plugin_sources = Split( """ - ) - -libraries = [ 'sqlite3' ] + %(PLUGIN_NAME)s_datasource.cpp + %(PLUGIN_NAME)s_featureset.cpp + """ % locals() +) # Link Library to Dependencies -libraries.append('mapnik') +libraries = [ 'sqlite3' ] libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) -libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) -linkflags = env['CUSTOM_LDFLAGS'] +linkflags = [] if env['SQLITE_LINKFLAGS']: linkflags.append(env['SQLITE_LINKFLAGS']) -input_plugin = plugin_env.SharedLibrary('../sqlite', source=sqlite_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=linkflags) - -# if the plugin links to libmapnik ensure it is built first -Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) +if env['PLUGIN_LINKING'] == 'shared': + libraries.append('mapnik') + linkflags.append(env['CUSTOM_LDFLAGS']) + + TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, + SHLIBPREFIX='', + SHLIBSUFFIX='.input', + source=plugin_sources, + LIBS=libraries, + LINKFLAGS=(' ').join(linkflags)) + + # if the plugin links to libmapnik ensure it is built first + Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + + if 'uninstall' not in COMMAND_LINE_TARGETS: + env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET) + env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) + +plugin_obj = { + 'LIBS': libraries, + 'SOURCES': plugin_sources, + 'LINKFLAGS': linkflags, +} -if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], input_plugin) - env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST']) +Return('plugin_obj') diff -Nru mapnik-2.1.0/plugins/input/sqlite/sqlite_connection.hpp mapnik-2.2.0/plugins/input/sqlite/sqlite_connection.hpp --- mapnik-2.1.0/plugins/input/sqlite/sqlite_connection.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/sqlite/sqlite_connection.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -29,7 +29,6 @@ // mapnik #include #include -#include #include // boost @@ -51,7 +50,7 @@ { public: - sqlite_connection (const std::string& file) + sqlite_connection (std::string const& file) : db_(0), file_(file) { @@ -63,7 +62,6 @@ #endif const int rc = sqlite3_open_v2 (file_.c_str(), &db_, mode, 0); #else -#warning "Mapnik's sqlite plugin is compiling against a version of sqlite older than 3.5.x which may make rendering slow..." const int rc = sqlite3_open (file_.c_str(), &db_); #endif if (rc != SQLITE_OK) @@ -77,14 +75,13 @@ sqlite3_busy_timeout(db_,5000); } - sqlite_connection (const std::string& file, int flags) + sqlite_connection (std::string const& file, int flags) : db_(0), file_(file) { #if SQLITE_VERSION_NUMBER >= 3005000 const int rc = sqlite3_open_v2 (file_.c_str(), &db_, flags, 0); #else -#warning "Mapnik's sqlite plugin is compiling against a version of sqlite older than 3.5.x which may make rendering slow..." const int rc = sqlite3_open (file_.c_str(), &db_); #endif if (rc != SQLITE_OK) @@ -104,7 +101,7 @@ } } - void throw_sqlite_error(const std::string& sql) + void throw_sqlite_error(std::string const& sql) { std::ostringstream s; s << "Sqlite Plugin: "; @@ -119,7 +116,7 @@ throw mapnik::datasource_exception (s.str()); } - boost::shared_ptr execute_query(const std::string& sql) + boost::shared_ptr execute_query(std::string const& sql) { #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, std::string("sqlite_resultset::execute_query ") + sql); @@ -135,7 +132,7 @@ return boost::make_shared(stmt); } - void execute(const std::string& sql) + void execute(std::string const& sql) { #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, std::string("sqlite_resultset::execute ") + sql); @@ -148,7 +145,7 @@ } } - int execute_with_code(const std::string& sql) + int execute_with_code(std::string const& sql) { #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, std::string("sqlite_resultset::execute_with_code ") + sql); @@ -163,6 +160,12 @@ return db_; } + bool load_extension(std::string const& ext_path) + { + sqlite3_enable_load_extension(db_, 1); + int result = sqlite3_load_extension(db_, ext_path.c_str(), 0 , 0); + return (result == SQLITE_OK)? true : false; + } private: diff -Nru mapnik-2.1.0/plugins/input/sqlite/sqlite_datasource.cpp mapnik-2.2.0/plugins/input/sqlite/sqlite_datasource.cpp --- mapnik-2.1.0/plugins/input/sqlite/sqlite_datasource.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/sqlite/sqlite_datasource.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -32,13 +32,13 @@ #include #include #include +#include +#include // boost #include #include -#include #include -#include using mapnik::box2d; using mapnik::coord2d; @@ -52,22 +52,22 @@ DATASOURCE_PLUGIN(sqlite_datasource) -sqlite_datasource::sqlite_datasource(parameters const& params, bool bind) +sqlite_datasource::sqlite_datasource(parameters const& params) : datasource(params), extent_(), extent_initialized_(false), type_(datasource::Vector), - table_(*params_.get("table", "")), - fields_(*params_.get("fields", "*")), - metadata_(*params_.get("metadata", "")), - geometry_table_(*params_.get("geometry_table", "")), - geometry_field_(*params_.get("geometry_field", "")), - index_table_(*params_.get("index_table", "")), - key_field_(*params_.get("key_field", "")), - row_offset_(*params_.get("row_offset", 0)), - row_limit_(*params_.get("row_limit", 0)), + table_(*params.get("table", "")), + fields_(*params.get("fields", "*")), + metadata_(*params.get("metadata", "")), + geometry_table_(*params.get("geometry_table", "")), + geometry_field_(*params.get("geometry_field", "")), + index_table_(*params.get("index_table", "")), + key_field_(*params.get("key_field", "")), + row_offset_(*params.get("row_offset", 0)), + row_limit_(*params.get("row_limit", 0)), intersects_token_("!intersects!"), - desc_(*params_.get("type"), *params_.get("encoding", "utf-8")), + desc_(*params.get("type"), *params.get("encoding", "utf-8")), format_(mapnik::wkbAuto) { /* TODO @@ -76,46 +76,33 @@ - if spatialite - leverage more of the metadata for geometry type detection */ - boost::optional file = params_.get("file"); - if (! file) throw datasource_exception("Sqlite Plugin: missing parameter"); - - if (bind) - { - this->bind(); - } -} - -void sqlite_datasource::bind() const -{ - if (is_bound_) return; - #ifdef MAPNIK_STATS - mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::bind"); + mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::init"); #endif - boost::optional file = params_.get("file"); + boost::optional file = params.get("file"); if (! file) throw datasource_exception("Sqlite Plugin: missing parameter"); - boost::optional base = params_.get("base"); + boost::optional base = params.get("base"); if (base) dataset_name_ = *base + "/" + *file; else dataset_name_ = *file; - if ((dataset_name_.compare(":memory:") != 0) && (!boost::filesystem::exists(dataset_name_))) + if ((dataset_name_.compare(":memory:") != 0) && (!mapnik::util::exists(dataset_name_))) { throw datasource_exception("Sqlite Plugin: " + dataset_name_ + " does not exist"); } - use_spatial_index_ = *params_.get("use_spatial_index", true); + use_spatial_index_ = *params.get("use_spatial_index", true); // TODO - remove this option once all datasources have an indexing api - bool auto_index = *params_.get("auto_index", true); + bool auto_index = *params.get("auto_index", true); - boost::optional ext = params_.get("extent"); + boost::optional ext = params.get("extent"); if (ext) extent_initialized_ = extent_.from_string(*ext); - boost::optional wkb = params_.get("wkb_format"); + boost::optional wkb = params.get("wkb_format"); if (wkb) { if (*wkb == "spatialite") @@ -139,13 +126,13 @@ // databases are relative to directory containing dataset_name_. Sqlite // will default to attaching from cwd. Typicaly usage means that the // map loader will produce full paths here. - boost::optional attachdb = params_.get("attachdb"); + boost::optional attachdb = params.get("attachdb"); if (attachdb) { parse_attachdb(*attachdb); } - boost::optional initdb = params_.get("initdb"); + boost::optional initdb = params.get("initdb"); if (initdb) { init_statements_.push_back(*initdb); @@ -154,10 +141,10 @@ // now actually create the connection and start executing setup sql dataset_ = boost::make_shared(dataset_name_); - boost::optional table_by_index = params_.get("table_by_index"); + boost::optional table_by_index = params.get("table_by_index"); int passed_parameters = 0; - passed_parameters += params_.get("table") ? 1 : 0; + passed_parameters += params.get("table") ? 1 : 0; passed_parameters += table_by_index ? 1 : 0; if (passed_parameters > 1) @@ -171,7 +158,7 @@ { std::vector tables; sqlite_utils::get_tables(dataset_,tables); - if (*table_by_index >= tables.size()) + if (*table_by_index < 0 || *table_by_index >= static_cast(tables.size())) { std::ostringstream s; s << "SQLite Plugin: only " @@ -289,10 +276,10 @@ if (use_spatial_index_) { #ifdef MAPNIK_STATS - mapnik::progress_timer __stats2__(std::clog, "sqlite_datasource::bind(use_spatial_index)"); + mapnik::progress_timer __stats2__(std::clog, "sqlite_datasource::init(use_spatial_index)"); #endif - if (boost::filesystem::exists(index_db)) + if (mapnik::util::exists(index_db)) { dataset_->execute("attach database '" + index_db + "' as " + index_table_); } @@ -309,28 +296,12 @@ << " FROM (" << geometry_table_ << ")"; - /* - std::vector rtree_list; - { - boost::shared_ptr rs = dataset_->execute_query(query.str()); - sqlite_utils::build_tree(rs,rtree_list); - } - if (sqlite_utils::create_spatial_index2(index_db,index_table_,rtree_list)) - { - //extent_initialized_ = true; - has_spatial_index_ = true; - if (boost::filesystem::exists(index_db)) - { - dataset_->execute("attach database '" + index_db + "' as " + index_table_); - } - } - */ boost::shared_ptr rs = dataset_->execute_query(query.str()); if (sqlite_utils::create_spatial_index(index_db,index_table_,rs)) { //extent_initialized_ = true; has_spatial_index_ = true; - if (boost::filesystem::exists(index_db)) + if (mapnik::util::exists(index_db)) { dataset_->execute("attach database '" + index_db + "' as " + index_table_); } @@ -339,10 +310,12 @@ else { std::ostringstream s; - s << "Sqlite Plugin: key_field is empty for " - << geometry_field_ - << " and " - << geometry_table_; + s << "Sqlite Plugin: could not generate spatial index" + << " for table '" << geometry_table_ << "'" + << " as no primary key can be detected." + << " You should either declare an INTEGER PRIMARY KEY" + << " or set the 'key_field' option to force a" + << " given field to be used as the primary key"; throw datasource_exception(s.str()); } } @@ -372,10 +345,9 @@ } } - is_bound_ = true; } -std::string sqlite_datasource::populate_tokens(const std::string& sql) const +std::string sqlite_datasource::populate_tokens(std::string const& sql) const { std::string populated_sql = sql; if (boost::algorithm::ifind_first(populated_sql, intersects_token_)) @@ -390,38 +362,6 @@ { } -#if (BOOST_FILESYSTEM_VERSION <= 2) -namespace boost { -namespace filesystem { -path read_symlink(const path& p) -{ - path symlink_path; - -#ifdef BOOST_POSIX_API - for (std::size_t path_max = 64;; path_max *= 2)// loop 'til buffer is large enough - { - boost::scoped_array buf(new char[path_max]); - ssize_t result; - if ((result=::readlink(p.string().c_str(), buf.get(), path_max))== -1) - { - throw std::runtime_error("could not read symlink"); - } - else - { - if(result != static_cast(path_max)) - { - symlink_path.assign(buf.get(), buf.get() + result); - break; - } - } - } -#endif - return symlink_path; -} -} -} -#endif - void sqlite_datasource::parse_attachdb(std::string const& attachdb) const { boost::char_separator sep(","); @@ -441,31 +381,12 @@ } // Break out the dbname and the filename - std::string dbname = boost::trim_copy(spec.substr(0, atpos)); - std::string filename = boost::trim_copy(spec.substr(atpos + 1)); - + std::string dbname = mapnik::util::trim_copy(spec.substr(0, atpos)); + std::string filename = mapnik::util::trim_copy(spec.substr(atpos + 1)); // Normalize the filename and make it relative to dataset_name_ - if (filename.compare(":memory:") != 0) + if (filename.compare(":memory:") != 0 && mapnik::util::is_relative(filename)) { - boost::filesystem::path child_path(filename); - - // It is a relative path. Fix it. - if (! child_path.has_root_directory() && ! child_path.has_root_name()) - { - boost::filesystem::path absolute_path(dataset_name_); - - // support symlinks - if (boost::filesystem::is_symlink(absolute_path)) - { - absolute_path = boost::filesystem::read_symlink(absolute_path); - } - -#if (BOOST_FILESYSTEM_VERSION == 3) - filename = boost::filesystem::absolute(absolute_path.parent_path() / filename).string(); -#else - filename = boost::filesystem::complete(absolute_path.branch_path() / filename).normalize().string(); -#endif - } + filename = mapnik::util::make_relative(filename,dataset_name_); } // And add an init_statement_ @@ -485,15 +406,11 @@ box2d sqlite_datasource::envelope() const { - if (! is_bound_) bind(); - return extent_; } boost::optional sqlite_datasource::get_geometry_type() const { - if (! is_bound_) bind(); - #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::get_geometry_type"); #endif @@ -522,7 +439,7 @@ if (data) { boost::ptr_vector paths; - if (mapnik::geometry_utils::from_wkb(paths, data, size, mapnik::wkbAuto)) + if (mapnik::geometry_utils::from_wkb(paths, data, size, format_)) { mapnik::util::to_ds_type(paths,result); if (result) @@ -545,15 +462,11 @@ layer_descriptor sqlite_datasource::get_descriptor() const { - if (! is_bound_) bind(); - return desc_; } featureset_ptr sqlite_datasource::features(query const& q) const { - if (! is_bound_) bind(); - #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::features"); #endif @@ -630,19 +543,16 @@ return featureset_ptr(); } -featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt) const +featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt, double tol) const { - if (! is_bound_) bind(); - #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::features_at_point"); #endif if (dataset_) { - // TODO - need tolerance - mapnik::box2d const e(pt.x, pt.y, pt.x, pt.y); - + mapnik::box2d e(pt.x, pt.y, pt.x, pt.y); + e.pad(tol); std::ostringstream s; mapnik::context_ptr ctx = boost::make_shared(); diff -Nru mapnik-2.1.0/plugins/input/sqlite/sqlite_datasource.hpp mapnik-2.2.0/plugins/input/sqlite/sqlite_datasource.hpp --- mapnik-2.1.0/plugins/input/sqlite/sqlite_datasource.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/sqlite/sqlite_datasource.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -32,11 +32,11 @@ #include #include #include +#include // boost #include #include -#include // stl #include @@ -48,47 +48,43 @@ class sqlite_datasource : public mapnik::datasource { public: - sqlite_datasource(mapnik::parameters const& params, bool bind = true); + sqlite_datasource(mapnik::parameters const& params); virtual ~sqlite_datasource (); datasource::datasource_t type() const; static const char * name(); mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; + mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; mapnik::box2d envelope() const; boost::optional get_geometry_type() const; mapnik::layer_descriptor get_descriptor() const; - void bind() const; private: // Fill init_statements with any statements // needed to attach auxillary databases void parse_attachdb(std::string const& attachdb) const; - std::string populate_tokens(const std::string& sql) const; + std::string populate_tokens(std::string const& sql) const; - // FIXME: remove mutable qualifier from data members - // by factoring out bind() logic out from - // datasource impl !!! - mutable mapnik::box2d extent_; - mutable bool extent_initialized_; + mapnik::box2d extent_; + bool extent_initialized_; mapnik::datasource::datasource_t type_; - mutable std::string dataset_name_; - mutable boost::shared_ptr dataset_; - mutable std::string table_; + std::string dataset_name_; + boost::shared_ptr dataset_; + std::string table_; std::string fields_; std::string metadata_; - mutable std::string geometry_table_; - mutable std::string geometry_field_; - mutable std::string index_table_; - mutable std::string key_field_; - mutable int row_offset_; - mutable int row_limit_; + std::string geometry_table_; + std::string geometry_field_; + std::string index_table_; + std::string key_field_; + int row_offset_; + mapnik::value_integer row_limit_; // TODO - also add to postgis.input const std::string intersects_token_; - mutable mapnik::layer_descriptor desc_; - mutable mapnik::wkbFormat format_; - mutable bool use_spatial_index_; - mutable bool has_spatial_index_; - mutable bool using_subquery_; + mapnik::layer_descriptor desc_; + mapnik::wkbFormat format_; + bool use_spatial_index_; + bool has_spatial_index_; + bool using_subquery_; mutable std::vector init_statements_; }; diff -Nru mapnik-2.1.0/plugins/input/sqlite/sqlite_featureset.cpp mapnik-2.2.0/plugins/input/sqlite/sqlite_featureset.cpp --- mapnik-2.1.0/plugins/input/sqlite/sqlite_featureset.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/sqlite/sqlite_featureset.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,7 +23,6 @@ // mapnik #include #include -#include #include #include #include @@ -38,7 +37,6 @@ using mapnik::query; using mapnik::box2d; -using mapnik::Feature; using mapnik::feature_ptr; using mapnik::geometry_utils; using mapnik::transcoder; @@ -73,7 +71,14 @@ return feature_ptr(); } - feature_ptr feature = feature_factory::create(ctx_,rs_->column_integer(1)); + // null feature id is not acceptable + if (rs_->column_type(1) == SQLITE_NULL) + { + MAPNIK_LOG_ERROR(postgis) << "sqlite_featureset: null value encountered for key_field"; + continue; + } + + feature_ptr feature = feature_factory::create(ctx_,rs_->column_integer64(1)); if (!geometry_utils::from_wkb(feature->paths(), data, size, format_)) continue; @@ -104,7 +109,7 @@ { case SQLITE_INTEGER: { - feature->put(fld_name_str, rs_->column_integer(i)); + feature->put(fld_name_str, rs_->column_integer64(i)); break; } @@ -116,16 +121,17 @@ case SQLITE_TEXT: { - int text_size; - const char * data = rs_->column_text(i, text_size); - UnicodeString ustr = tr_->transcode(data, text_size); + int text_col_size; + const char * text_data = rs_->column_text(i, text_col_size); + UnicodeString ustr = tr_->transcode(text_data, text_col_size); feature->put(fld_name_str, ustr); break; } case SQLITE_NULL: { - feature->put(fld_name_str, mapnik::value_null()); + // NOTE: we intentionally do not store null here + // since it is equivalent to the attribute not existing break; } diff -Nru mapnik-2.1.0/plugins/input/sqlite/sqlite_featureset.hpp mapnik-2.2.0/plugins/input/sqlite/sqlite_featureset.hpp --- mapnik-2.1.0/plugins/input/sqlite/sqlite_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/sqlite/sqlite_featureset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,7 +24,7 @@ #define MAPNIK_SQLITE_FEATURESET_HPP // mapnik -#include +#include #include #include @@ -53,7 +53,7 @@ boost::shared_ptr rs_; mapnik::context_ptr ctx_; boost::scoped_ptr tr_; - mapnik::box2d const& bbox_; + mapnik::box2d bbox_; mapnik::wkbFormat format_; bool spatial_index_; bool using_subquery_; diff -Nru mapnik-2.1.0/plugins/input/sqlite/sqlite_prepared.hpp mapnik-2.2.0/plugins/input/sqlite/sqlite_prepared.hpp --- mapnik-2.1.0/plugins/input/sqlite/sqlite_prepared.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/sqlite/sqlite_prepared.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,13 +24,14 @@ #define MAPNIK_SQLITE_PREPARED_HPP // mapnik +#include #include #include #include +#include // boost #include -#include // stl #include @@ -42,7 +43,7 @@ #include } -class prepared_index_statement : boost::noncopyable +class prepared_index_statement : mapnik::noncopyable { public: @@ -77,11 +78,13 @@ { if (*(*ds_)) { - std::cerr << "ERR:" << sqlite3_errmsg(*(*ds_)) << "\n"; + MAPNIK_LOG_ERROR(sqlite) << "~prepared_index_statement:" + << sqlite3_errmsg(*(*ds_)); } else { - std::cerr << "SQLite Plugin: " << res << "\n"; + MAPNIK_LOG_ERROR(sqlite) << "~prepared_index_statement:" + << res; } } } diff -Nru mapnik-2.1.0/plugins/input/sqlite/sqlite_resultset.hpp mapnik-2.2.0/plugins/input/sqlite/sqlite_resultset.hpp --- mapnik-2.1.0/plugins/input/sqlite/sqlite_resultset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/sqlite/sqlite_resultset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,6 +24,7 @@ #define MAPNIK_SQLITE_RESULTSET_HPP // mapnik +#include #include #include diff -Nru mapnik-2.1.0/plugins/input/sqlite/sqlite_utils.hpp mapnik-2.2.0/plugins/input/sqlite/sqlite_utils.hpp --- mapnik-2.1.0/plugins/input/sqlite/sqlite_utils.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/sqlite/sqlite_utils.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,19 +26,21 @@ // stl #include #include +#include // mapnik +#include +#include #include #include #include #include - +#include // boost #include #include #include -#include // sqlite extern "C" { @@ -233,7 +235,7 @@ int flags; #endif - bool existed = boost::filesystem::exists(index_db); + bool existed = mapnik::util::exists(index_db); boost::shared_ptr ds = boost::make_shared(index_db,flags); bool one_success = false; @@ -326,8 +328,8 @@ { try { - boost::filesystem::remove(index_db); - } + mapnik::util::remove(index_db); + } catch (...) {}; } throw mapnik::datasource_exception(ex.what()); @@ -342,7 +344,7 @@ { try { - boost::filesystem::remove(index_db); + mapnik::util::remove(index_db); } catch (...) {}; } @@ -411,7 +413,8 @@ int flags; #endif - bool existed = boost::filesystem::exists(index_db); + bool existed = mapnik::util::exists(index_db);; + boost::shared_ptr ds = boost::make_shared(index_db,flags); bool one_success = false; @@ -458,7 +461,7 @@ { try { - boost::filesystem::remove(index_db); + mapnik::util::remove(index_db); } catch (...) {}; } @@ -474,7 +477,7 @@ { try { - boost::filesystem::remove(index_db); + mapnik::util::remove(index_db); } catch (...) {}; } @@ -492,7 +495,23 @@ std::string const& table ) { - if (has_spatial_index) + if (! metadata.empty()) + { + std::ostringstream s; + s << "SELECT xmin, ymin, xmax, ymax FROM " << metadata; + s << " WHERE LOWER(f_table_name) = LOWER('" << geometry_table << "')"; + boost::shared_ptr rs(ds->execute_query(s.str())); + if (rs->is_valid() && rs->step_next()) + { + double xmin = rs->column_double(0); + double ymin = rs->column_double(1); + double xmax = rs->column_double(2); + double ymax = rs->column_double(3); + extent.init (xmin, ymin, xmax, ymax); + return true; + } + } + else if (has_spatial_index) { std::ostringstream s; s << "SELECT MIN(xmin), MIN(ymin), MAX(xmax), MAX(ymax) FROM " @@ -512,22 +531,7 @@ } } } - else if (! metadata.empty()) - { - std::ostringstream s; - s << "SELECT xmin, ymin, xmax, ymax FROM " << metadata; - s << " WHERE LOWER(f_table_name) = LOWER('" << geometry_table << "')"; - boost::shared_ptr rs(ds->execute_query(s.str())); - if (rs->is_valid() && rs->step_next()) - { - double xmin = rs->column_double(0); - double ymin = rs->column_double(1); - double xmax = rs->column_double(2); - double ymax = rs->column_double(3); - extent.init (xmin, ymin, xmax, ymax); - return true; - } - } + else if (! key_field.empty()) { std::ostringstream s; @@ -554,7 +558,7 @@ } catch (std::exception const& ex) { - //std::clog << "no: " << ex.what() << "\n"; + MAPNIK_LOG_DEBUG(sqlite) << "has_rtree returned:" << ex.what(); return false; } return false; @@ -607,9 +611,7 @@ break; default: -#ifdef MAPNIK_DEBUG - std::clog << "Sqlite Plugin: unknown type_oid=" << type_oid << std::endl; -#endif + MAPNIK_LOG_DEBUG(sqlite) << "detect_types_from_subquery: unknown type_oid=" << type_oid; break; } } @@ -640,9 +642,8 @@ found_table = true; const char* fld_name = rs->column_text(1); std::string fld_type(rs->column_text(2)); - int fld_pk = rs->column_integer(5); - boost::algorithm::to_lower(fld_type); - + sqlite_int64 fld_pk = rs->column_integer64(5); + std::transform(fld_type.begin(), fld_type.end(), fld_type.begin(), ::tolower); // TODO - how to handle primary keys on multiple columns ? if (key_field.empty() && ! found_pk && fld_pk != 0) { @@ -690,20 +691,22 @@ desc.add_descriptor(mapnik::attribute_descriptor(fld_name, mapnik::String)); } } -#ifdef MAPNIK_DEBUG else { // "Column Affinity" says default to "Numeric" but for now we pass.. //desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Double)); - // TODO - this should not fail when we specify geometry_field in XML file - - std::clog << "Sqlite Plugin: column '" - << std::string(fld_name) - << "' unhandled due to unknown type: " - << fld_type << std::endl; - } +#ifdef MAPNIK_LOG + // Do not fail when we specify geometry_field in XML file + if (field.empty()) + { + MAPNIK_LOG_DEBUG(sqlite) << "Column '" + << std::string(fld_name) + << "' unhandled due to unknown type: " + << fld_type; + } #endif + } } } diff -Nru mapnik-2.1.0/plugins/input/templates/helloworld/README.md mapnik-2.2.0/plugins/input/templates/helloworld/README.md --- mapnik-2.1.0/plugins/input/templates/helloworld/README.md 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/templates/helloworld/README.md 2013-06-04 01:35:27.000000000 +0000 @@ -15,14 +15,14 @@ the middle of any map tile and display a "hello world!" label if used like: - + - + style hello diff -Nru mapnik-2.1.0/plugins/input/templates/helloworld/build.py mapnik-2.2.0/plugins/input/templates/helloworld/build.py --- mapnik-2.1.0/plugins/input/templates/helloworld/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/templates/helloworld/build.py 2013-06-04 01:35:27.000000000 +0000 @@ -11,21 +11,17 @@ import os -# Give this plugin a name -# here this happens to be the same as the directory -PLUGIN_NAME = 'hello' - # Here we pull from the SCons environment exported from the main instance Import ('plugin_base') Import ('env') +# Give this plugin a name +# here this happens to be the same as the directory +PLUGIN_NAME = 'hello' + # the below install details are also pulled from the # main SConstruct file where configuration happens -# plugins can go anywhere, and be registered in custom locations by Mapnik -# but the standard location is '/usr/local/lib/mapnik/input' -install_dest = env['MAPNIK_INPUT_PLUGINS_DEST'] - # clone the environment here # so that if we modify the env it in this file # those changes to not pollute other builds later on... @@ -35,7 +31,7 @@ plugin_sources = Split( """ %(PLUGIN_NAME)s_datasource.cpp - %(PLUGIN_NAME)s_featureset.cpp + %(PLUGIN_NAME)s_featureset.cpp """ % locals() ) @@ -43,34 +39,54 @@ # directly link to libraries = [ '' ] # eg 'libfoo' -libraries.append('mapnik') libraries.append('boost_system%s' % env['BOOST_APPEND']) # link libicuuc, but ICU_LIB_NAME is used custom builds of icu can # have different library names like osx which offers /usr/lib/libicucore.dylib libraries.append(env['ICU_LIB_NAME']) - -TARGET = plugin_env.SharedLibrary( - # the name of the target to build, eg 'sqlite.input' - '../%s' % PLUGIN_NAME, - # prefix - normally none used - SHLIBPREFIX='', - # extension, mapnik expects '.input' - SHLIBSUFFIX='.input', - # list of source files to compile - source=plugin_sources, - # libraries to link to - LIBS=libraries, - # any custom linkflags, eg. LDFLAGS - # in this case CUSTOM_LDFLAGS comes - # from Mapnik's main SConstruct file - # and can be removed here if you do - # not need it - LINKFLAGS=env.get('CUSTOM_LDFLAGS') - ) - -# if 'uninstall' is not passed on the command line -# then we actually create the install targets that -# scons will install if 'install' is passed as an arg -if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Install(install_dest, TARGET) - env.Alias('install', install_dest) + +# this is valid if we are building an external plugin as shared library +if env['PLUGIN_LINKING'] == 'shared': + # plugins can go anywhere, and be registered in custom locations by Mapnik + # but the standard location is '/usr/local/lib/mapnik/input' + install_dest = env['MAPNIK_INPUT_PLUGINS_DEST'] + + # only link mapnik if we are build an external shared object + libraries.append('mapnik') + + TARGET = plugin_env.SharedLibrary( + # the name of the target to build, eg 'sqlite.input' + '../%s' % PLUGIN_NAME, + # prefix - normally none used + SHLIBPREFIX='', + # extension, mapnik expects '.input' + SHLIBSUFFIX='.input', + # list of source files to compile + source=plugin_sources, + # libraries to link to + LIBS=libraries, + # any custom linkflags, eg. LDFLAGS + # in this case CUSTOM_LDFLAGS comes + # from Mapnik's main SConstruct file + # and can be removed here if you do + # not need it + LINKFLAGS=env.get('CUSTOM_LDFLAGS') + ) + + # if the plugin links to libmapnik ensure it is built first + Depends(TARGET, env.subst('../../../../src/%s' % env['MAPNIK_LIB_NAME'])) + + # if 'uninstall' is not passed on the command line + # then we actually create the install targets that + # scons will install if 'install' is passed as an arg + if 'uninstall' not in COMMAND_LINE_TARGETS: + env.Install(install_dest, TARGET) + env.Alias('install', install_dest) + +# Return the plugin building options to scons +# This is used when statically linking the plugin with mapnik) +plugin_obj = { + 'LIBS': libraries, + 'SOURCES': plugin_sources, +} + +Return('plugin_obj') diff -Nru mapnik-2.1.0/plugins/input/templates/helloworld/hello_datasource.cpp mapnik-2.2.0/plugins/input/templates/helloworld/hello_datasource.cpp --- mapnik-2.1.0/plugins/input/templates/helloworld/hello_datasource.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/templates/helloworld/hello_datasource.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -11,29 +11,22 @@ DATASOURCE_PLUGIN(hello_datasource) -hello_datasource::hello_datasource(parameters const& params, bool bind) +hello_datasource::hello_datasource(parameters const& params) : datasource(params), - desc_(*params_.get("type"), *params_.get("encoding","utf-8")), + desc_(*params.get("type"), *params.get("encoding","utf-8")), extent_() { - if (bind) - { - this->bind(); - } + this->init(params); } -void hello_datasource::bind() const +void hello_datasource::init(mapnik::parameters const& params) { - if (is_bound_) return; - // every datasource must have some way of reporting its extent // in this case we are not actually reading from any data so for fun // let's just create a world extent in Mapnik's default srs: // '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' (equivalent to +init=epsg:4326) // see http://spatialreference.org/ref/epsg/4326/ for more details extent_.init(-180,-90,180,90); - - is_bound_ = true; } hello_datasource::~hello_datasource() { } @@ -51,8 +44,6 @@ mapnik::box2d hello_datasource::envelope() const { - if (!is_bound_) bind(); - return extent_; } @@ -63,15 +54,11 @@ mapnik::layer_descriptor hello_datasource::get_descriptor() const { - if (!is_bound_) bind(); - return desc_; } mapnik::featureset_ptr hello_datasource::features(mapnik::query const& q) const { - if (!is_bound_) bind(); - // if the query box intersects our world extent then query for features if (extent_.intersects(q.get_bbox())) { @@ -82,10 +69,8 @@ return mapnik::featureset_ptr(); } -mapnik::featureset_ptr hello_datasource::features_at_point(mapnik::coord2d const& pt) const +mapnik::featureset_ptr hello_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const { - if (!is_bound_) bind(); - // features_at_point is rarely used - only by custom applications, // so for this sample plugin let's do nothing... return mapnik::featureset_ptr(); diff -Nru mapnik-2.1.0/plugins/input/templates/helloworld/hello_datasource.hpp mapnik-2.2.0/plugins/input/templates/helloworld/hello_datasource.hpp --- mapnik-2.1.0/plugins/input/templates/helloworld/hello_datasource.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/templates/helloworld/hello_datasource.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,7 +22,7 @@ public: // constructor // arguments must not change - hello_datasource(mapnik::parameters const& params, bool bind=true); + hello_datasource(mapnik::parameters const& params); // destructor virtual ~hello_datasource (); @@ -39,7 +39,7 @@ // mandatory: function to query features by point (coord2d) // not used by rendering, but available to calling applications - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; + mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; // mandatory: return the box2d of the datasource // called during rendering to determine if the layer should be processed @@ -51,15 +51,15 @@ // mandatory: return the layer descriptor mapnik::layer_descriptor get_descriptor() const; - // mandatory: will bind the datasource given params - void bind() const; - private: + // recommended - do intialization in a so-named init function + // to reduce code in constructor + void init(mapnik::parameters const& params); // recommended naming convention of datasource members: // name_, type_, extent_, and desc_ static const std::string name_; - mutable mapnik::layer_descriptor desc_; - mutable mapnik::box2d extent_; + mapnik::layer_descriptor desc_; + mapnik::box2d extent_; }; diff -Nru mapnik-2.1.0/plugins/input/templates/helloworld/hello_featureset.cpp mapnik-2.2.0/plugins/input/templates/helloworld/hello_featureset.cpp --- mapnik-2.1.0/plugins/input/templates/helloworld/hello_featureset.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/templates/helloworld/hello_featureset.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -2,6 +2,9 @@ #include #include +// boost +#include + #include "hello_featureset.hpp" hello_featureset::hello_featureset(mapnik::box2d const& box, std::string const& encoding) diff -Nru mapnik-2.1.0/plugins/input/templates/helloworld/hello_featureset.hpp mapnik-2.2.0/plugins/input/templates/helloworld/hello_featureset.hpp --- mapnik-2.1.0/plugins/input/templates/helloworld/hello_featureset.hpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/templates/helloworld/hello_featureset.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -3,11 +3,12 @@ // mapnik #include +#include +#include // boost #include // needed for wrapping the transcoder -// extend the mapnik::Featureset defined in include/mapnik/datasource.hpp class hello_featureset : public mapnik::Featureset { public: @@ -22,8 +23,8 @@ private: // members are up to you, but these are recommended - mapnik::box2d const& box_; - mutable int feature_id_; + mapnik::box2d box_; + mapnik::value_integer feature_id_; boost::scoped_ptr tr_; mapnik::context_ptr ctx_; }; diff -Nru mapnik-2.1.0/plugins/input/templates/helloworld/test.xml mapnik-2.2.0/plugins/input/templates/helloworld/test.xml --- mapnik-2.1.0/plugins/input/templates/helloworld/test.xml 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/plugins/input/templates/helloworld/test.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,4 +1,4 @@ - + - + style Node B(Pending) --> Node C (NoState) - ^ | - | | - +-------------------------------------+ - - Now, when the Taskmaster examines the Node C's child Node A, - it finds that Node A is in the "pending" state. Therefore, - Node A is a pending child of node C. - - Pending children indicate that the Taskmaster has potentially - loop back through a cycle. We say potentially because it could - also occur when a DAG is evaluated in parallel. For example, - consider the following graph: - - - Node A (Pending) --> Node B(Pending) --> Node C (Pending) --> ... - | ^ - | | - +----------> Node D (NoState) --------+ - / - Next candidate / - - The Taskmaster first evaluates the nodes A, B, and C and - starts building some children of node C. Assuming, that the - maximum parallel level has not been reached, the Taskmaster - will examine Node D. It will find that Node C is a pending - child of Node D. - - In summary, evaluating a graph with a cycle will always - involve a pending child at one point. A pending child might - indicate either a cycle or a diamond-shaped DAG. Only a - fraction of the nodes ends-up being a "pending child" of - another node. This keeps the pending_children set small in - practice. - - We can differentiate between the two cases if we wait until - the end of the build. At this point, all the pending children - nodes due to a diamond-shaped DAG will have been properly - built (or will have failed to build). But, the pending - children involved in a cycle will still be in the pending - state. - - The taskmaster removes nodes from the pending_children set as - soon as a pending_children node moves out of the pending - state. This also helps to keep the pending_children set small. - """ - - for n in self.pending_children: - assert n.state in (NODE_PENDING, NODE_EXECUTING), \ - (str(n), StateString[n.state]) - assert len(n.waiting_parents) != 0, (str(n), len(n.waiting_parents)) - for p in n.waiting_parents: - assert p.ref_count > 0, (str(n), str(p), p.ref_count) - - - def trace_message(self, message): - return 'Taskmaster: %s\n' % message - - def trace_node(self, node): - return '<%-10s %-3s %s>' % (StateString[node.get_state()], - node.ref_count, - repr(str(node))) - - def _find_next_ready_node(self): - """ - Finds the next node that is ready to be built. - - This is *the* main guts of the DAG walk. We loop through the - list of candidates, looking for something that has no un-built - children (i.e., that is a leaf Node or has dependencies that are - all leaf Nodes or up-to-date). Candidate Nodes are re-scanned - (both the target Node itself and its sources, which are always - scanned in the context of a given target) to discover implicit - dependencies. A Node that must wait for some children to be - built will be put back on the candidates list after the children - have finished building. A Node that has been put back on the - candidates list in this way may have itself (or its sources) - re-scanned, in order to handle generated header files (e.g.) and - the implicit dependencies therein. - - Note that this method does not do any signature calculation or - up-to-date check itself. All of that is handled by the Task - class. This is purely concerned with the dependency graph walk. - """ - - self.ready_exc = None - - T = self.trace - if T: T.write(u'\n' + self.trace_message('Looking for a node to evaluate')) - - while True: - node = self.next_candidate() - if node is None: - if T: T.write(self.trace_message('No candidate anymore.') + u'\n') - return None - - node = node.disambiguate() - state = node.get_state() - - # For debugging only: - # - # try: - # self._validate_pending_children() - # except: - # self.ready_exc = sys.exc_info() - # return node - - if CollectStats: - if not hasattr(node, 'stats'): - node.stats = Stats() - StatsNodes.append(node) - S = node.stats - S.considered = S.considered + 1 - else: - S = None - - if T: T.write(self.trace_message(u' Considering node %s and its children:' % self.trace_node(node))) - - if state == NODE_NO_STATE: - # Mark this node as being on the execution stack: - node.set_state(NODE_PENDING) - elif state > NODE_PENDING: - # Skip this node if it has already been evaluated: - if S: S.already_handled = S.already_handled + 1 - if T: T.write(self.trace_message(u' already handled (executed)')) - continue - - executor = node.get_executor() - - try: - children = executor.get_all_children() - except SystemExit: - exc_value = sys.exc_info()[1] - e = SCons.Errors.ExplicitExit(node, exc_value.code) - self.ready_exc = (SCons.Errors.ExplicitExit, e) - if T: T.write(self.trace_message(' SystemExit')) - return node - except Exception, e: - # We had a problem just trying to figure out the - # children (like a child couldn't be linked in to a - # VariantDir, or a Scanner threw something). Arrange to - # raise the exception when the Task is "executed." - self.ready_exc = sys.exc_info() - if S: S.problem = S.problem + 1 - if T: T.write(self.trace_message(' exception %s while scanning children.\n' % e)) - return node - - children_not_visited = [] - children_pending = set() - children_not_ready = [] - children_failed = False - - for child in chain(executor.get_all_prerequisites(), children): - childstate = child.get_state() - - if T: T.write(self.trace_message(u' ' + self.trace_node(child))) - - if childstate == NODE_NO_STATE: - children_not_visited.append(child) - elif childstate == NODE_PENDING: - children_pending.add(child) - elif childstate == NODE_FAILED: - children_failed = True - - if childstate <= NODE_EXECUTING: - children_not_ready.append(child) - - - # These nodes have not even been visited yet. Add - # them to the list so that on some next pass we can - # take a stab at evaluating them (or their children). - children_not_visited.reverse() - self.candidates.extend(self.order(children_not_visited)) - #if T and children_not_visited: - # T.write(self.trace_message(' adding to candidates: %s' % map(str, children_not_visited))) - # T.write(self.trace_message(' candidates now: %s\n' % map(str, self.candidates))) - - # Skip this node if any of its children have failed. - # - # This catches the case where we're descending a top-level - # target and one of our children failed while trying to be - # built by a *previous* descent of an earlier top-level - # target. - # - # It can also occur if a node is reused in multiple - # targets. One first descends though the one of the - # target, the next time occurs through the other target. - # - # Note that we can only have failed_children if the - # --keep-going flag was used, because without it the build - # will stop before diving in the other branch. - # - # Note that even if one of the children fails, we still - # added the other children to the list of candidate nodes - # to keep on building (--keep-going). - if children_failed: - for n in executor.get_action_targets(): - n.set_state(NODE_FAILED) - - if S: S.child_failed = S.child_failed + 1 - if T: T.write(self.trace_message('****** %s\n' % self.trace_node(node))) - continue - - if children_not_ready: - for child in children_not_ready: - # We're waiting on one or more derived targets - # that have not yet finished building. - if S: S.not_built = S.not_built + 1 - - # Add this node to the waiting parents lists of - # anything we're waiting on, with a reference - # count so we can be put back on the list for - # re-evaluation when they've all finished. - node.ref_count = node.ref_count + child.add_to_waiting_parents(node) - if T: T.write(self.trace_message(u' adjusted ref count: %s, child %s' % - (self.trace_node(node), repr(str(child))))) - - if T: - for pc in children_pending: - T.write(self.trace_message(' adding %s to the pending children set\n' % - self.trace_node(pc))) - self.pending_children = self.pending_children | children_pending - - continue - - # Skip this node if it has side-effects that are - # currently being built: - wait_side_effects = False - for se in executor.get_action_side_effects(): - if se.get_state() == NODE_EXECUTING: - se.add_to_waiting_s_e(node) - wait_side_effects = True - - if wait_side_effects: - if S: S.side_effects = S.side_effects + 1 - continue - - # The default when we've gotten through all of the checks above: - # this node is ready to be built. - if S: S.build = S.build + 1 - if T: T.write(self.trace_message(u'Evaluating %s\n' % - self.trace_node(node))) - - # For debugging only: - # - # try: - # self._validate_pending_children() - # except: - # self.ready_exc = sys.exc_info() - # return node - - return node - - return None - - def next_task(self): - """ - Returns the next task to be executed. - - This simply asks for the next Node to be evaluated, and then wraps - it in the specific Task subclass with which we were initialized. - """ - node = self._find_next_ready_node() - - if node is None: - return None - - tlist = node.get_executor().get_all_targets() - - task = self.tasker(self, tlist, node in self.original_top, node) - try: - task.make_ready() - except: - # We had a problem just trying to get this task ready (like - # a child couldn't be linked in to a VariantDir when deciding - # whether this node is current). Arrange to raise the - # exception when the Task is "executed." - self.ready_exc = sys.exc_info() - - if self.ready_exc: - task.exception_set(self.ready_exc) - - self.ready_exc = None - - return task - - def will_not_build(self, nodes, node_func=lambda n: None): - """ - Perform clean-up about nodes that will never be built. Invokes - a user defined function on all of these nodes (including all - of their parents). - """ - - T = self.trace - - pending_children = self.pending_children - - to_visit = set(nodes) - pending_children = pending_children - to_visit - - if T: - for n in nodes: - T.write(self.trace_message(' removing node %s from the pending children set\n' % - self.trace_node(n))) - try: - while len(to_visit): - node = to_visit.pop() - node_func(node) - - # Prune recursion by flushing the waiting children - # list immediately. - parents = node.waiting_parents - node.waiting_parents = set() - - to_visit = to_visit | parents - pending_children = pending_children - parents - - for p in parents: - p.ref_count = p.ref_count - 1 - if T: T.write(self.trace_message(' removing parent %s from the pending children set\n' % - self.trace_node(p))) - except KeyError: - # The container to_visit has been emptied. - pass - - # We have the stick back the pending_children list into the - # taskmaster because the python 1.5.2 compatibility does not - # allow us to use in-place updates - self.pending_children = pending_children - - def stop(self): - """ - Stops the current build completely. - """ - self.next_candidate = self.no_next_candidate - - def cleanup(self): - """ - Check for dependency cycles. - """ - if not self.pending_children: - return - - nclist = [(n, find_cycle([n], set())) for n in self.pending_children] - - genuine_cycles = [ - node for node,cycle in nclist - if cycle or node.get_state() != NODE_EXECUTED - ] - if not genuine_cycles: - # All of the "cycles" found were single nodes in EXECUTED state, - # which is to say, they really weren't cycles. Just return. - return - - desc = 'Found dependency cycle(s):\n' - for node, cycle in nclist: - if cycle: - desc = desc + " " + " -> ".join(map(str, cycle)) + "\n" - else: - desc = desc + \ - " Internal Error: no cycle found for node %s (%s) in state %s\n" % \ - (node, repr(node), StateString[node.get_state()]) - - raise SCons.Errors.UserError(desc) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/386asm.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/386asm.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/386asm.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/386asm.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -"""SCons.Tool.386asm - -Tool specification for the 386ASM assembler for the Phar Lap ETS embedded -operating system. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/386asm.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -from SCons.Tool.PharLapCommon import addPharLapPaths -import SCons.Util - -as_module = __import__('as', globals(), locals(), []) - -def generate(env): - """Add Builders and construction variables for ar to an Environment.""" - as_module.generate(env) - - env['AS'] = '386asm' - env['ASFLAGS'] = SCons.Util.CLVar('') - env['ASPPFLAGS'] = '$ASFLAGS' - env['ASCOM'] = '$AS $ASFLAGS $SOURCES -o $TARGET' - env['ASPPCOM'] = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $SOURCES -o $TARGET' - - addPharLapPaths(env) - -def exists(env): - return env.Detect('386asm') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/BitKeeper.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/BitKeeper.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/BitKeeper.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/BitKeeper.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -"""SCons.Tool.BitKeeper.py - -Tool-specific initialization for the BitKeeper source code control -system. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/BitKeeper.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Action -import SCons.Builder -import SCons.Util - -def generate(env): - """Add a Builder factory function and construction variables for - BitKeeper to an Environment.""" - - def BitKeeperFactory(env=env): - """ """ - import SCons.Warnings as W - W.warn(W.DeprecatedSourceCodeWarning, """The BitKeeper() factory is deprecated and there is no replacement.""") - act = SCons.Action.Action("$BITKEEPERCOM", "$BITKEEPERCOMSTR") - return SCons.Builder.Builder(action = act, env = env) - - #setattr(env, 'BitKeeper', BitKeeperFactory) - env.BitKeeper = BitKeeperFactory - - env['BITKEEPER'] = 'bk' - env['BITKEEPERGET'] = '$BITKEEPER get' - env['BITKEEPERGETFLAGS'] = SCons.Util.CLVar('') - env['BITKEEPERCOM'] = '$BITKEEPERGET $BITKEEPERGETFLAGS $TARGET' - -def exists(env): - return env.Detect('bk') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/CVS.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/CVS.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/CVS.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/CVS.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -"""SCons.Tool.CVS.py - -Tool-specific initialization for CVS. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/CVS.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Action -import SCons.Builder -import SCons.Util - -def generate(env): - """Add a Builder factory function and construction variables for - CVS to an Environment.""" - - def CVSFactory(repos, module='', env=env): - """ """ - import SCons.Warnings as W - W.warn(W.DeprecatedSourceCodeWarning, """The CVS() factory is deprecated and there is no replacement.""") - # fail if repos is not an absolute path name? - if module != '': - # Don't use os.path.join() because the name we fetch might - # be across a network and must use POSIX slashes as separators. - module = module + '/' - env['CVSCOM'] = '$CVS $CVSFLAGS co $CVSCOFLAGS -d ${TARGET.dir} $CVSMODULE${TARGET.posix}' - act = SCons.Action.Action('$CVSCOM', '$CVSCOMSTR') - return SCons.Builder.Builder(action = act, - env = env, - CVSREPOSITORY = repos, - CVSMODULE = module) - - #setattr(env, 'CVS', CVSFactory) - env.CVS = CVSFactory - - env['CVS'] = 'cvs' - env['CVSFLAGS'] = SCons.Util.CLVar('-d $CVSREPOSITORY') - env['CVSCOFLAGS'] = SCons.Util.CLVar('') - env['CVSCOM'] = '$CVS $CVSFLAGS co $CVSCOFLAGS ${TARGET.posix}' - -def exists(env): - return env.Detect('cvs') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/FortranCommon.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/FortranCommon.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/FortranCommon.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/FortranCommon.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,263 +0,0 @@ -"""SCons.Tool.FortranCommon - -Stuff for processing Fortran, common to all fortran dialects. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/FortranCommon.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import re -import os.path - -import SCons.Action -import SCons.Defaults -import SCons.Scanner.Fortran -import SCons.Tool -import SCons.Util - -def isfortran(env, source): - """Return 1 if any of code in source has fortran files in it, 0 - otherwise.""" - try: - fsuffixes = env['FORTRANSUFFIXES'] - except KeyError: - # If no FORTRANSUFFIXES, no fortran tool, so there is no need to look - # for fortran sources. - return 0 - - if not source: - # Source might be None for unusual cases like SConf. - return 0 - for s in source: - if s.sources: - ext = os.path.splitext(str(s.sources[0]))[1] - if ext in fsuffixes: - return 1 - return 0 - -def _fortranEmitter(target, source, env): - node = source[0].rfile() - if not node.exists() and not node.is_derived(): - print "Could not locate " + str(node.name) - return ([], []) - mod_regex = """(?i)^\s*MODULE\s+(?!PROCEDURE)(\w+)""" - cre = re.compile(mod_regex,re.M) - # Retrieve all USE'd module names - modules = cre.findall(node.get_text_contents()) - # Remove unique items from the list - modules = SCons.Util.unique(modules) - # Convert module name to a .mod filename - suffix = env.subst('$FORTRANMODSUFFIX', target=target, source=source) - moddir = env.subst('$FORTRANMODDIR', target=target, source=source) - modules = [x.lower() + suffix for x in modules] - for m in modules: - target.append(env.fs.File(m, moddir)) - return (target, source) - -def FortranEmitter(target, source, env): - target, source = _fortranEmitter(target, source, env) - return SCons.Defaults.StaticObjectEmitter(target, source, env) - -def ShFortranEmitter(target, source, env): - target, source = _fortranEmitter(target, source, env) - return SCons.Defaults.SharedObjectEmitter(target, source, env) - -def ComputeFortranSuffixes(suffixes, ppsuffixes): - """suffixes are fortran source files, and ppsuffixes the ones to be - pre-processed. Both should be sequences, not strings.""" - assert len(suffixes) > 0 - s = suffixes[0] - sup = s.upper() - upper_suffixes = [_.upper() for _ in suffixes] - if SCons.Util.case_sensitive_suffixes(s, sup): - ppsuffixes.extend(upper_suffixes) - else: - suffixes.extend(upper_suffixes) - -def CreateDialectActions(dialect): - """Create dialect specific actions.""" - CompAction = SCons.Action.Action('$%sCOM ' % dialect, '$%sCOMSTR' % dialect) - CompPPAction = SCons.Action.Action('$%sPPCOM ' % dialect, '$%sPPCOMSTR' % dialect) - ShCompAction = SCons.Action.Action('$SH%sCOM ' % dialect, '$SH%sCOMSTR' % dialect) - ShCompPPAction = SCons.Action.Action('$SH%sPPCOM ' % dialect, '$SH%sPPCOMSTR' % dialect) - - return CompAction, CompPPAction, ShCompAction, ShCompPPAction - -def DialectAddToEnv(env, dialect, suffixes, ppsuffixes, support_module = 0): - """Add dialect specific construction variables.""" - ComputeFortranSuffixes(suffixes, ppsuffixes) - - fscan = SCons.Scanner.Fortran.FortranScan("%sPATH" % dialect) - - for suffix in suffixes + ppsuffixes: - SCons.Tool.SourceFileScanner.add_scanner(suffix, fscan) - - env.AppendUnique(FORTRANSUFFIXES = suffixes + ppsuffixes) - - compaction, compppaction, shcompaction, shcompppaction = \ - CreateDialectActions(dialect) - - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - - for suffix in suffixes: - static_obj.add_action(suffix, compaction) - shared_obj.add_action(suffix, shcompaction) - static_obj.add_emitter(suffix, FortranEmitter) - shared_obj.add_emitter(suffix, ShFortranEmitter) - - for suffix in ppsuffixes: - static_obj.add_action(suffix, compppaction) - shared_obj.add_action(suffix, shcompppaction) - static_obj.add_emitter(suffix, FortranEmitter) - shared_obj.add_emitter(suffix, ShFortranEmitter) - - if '%sFLAGS' % dialect not in env: - env['%sFLAGS' % dialect] = SCons.Util.CLVar('') - - if 'SH%sFLAGS' % dialect not in env: - env['SH%sFLAGS' % dialect] = SCons.Util.CLVar('$%sFLAGS' % dialect) - - # If a tool does not define fortran prefix/suffix for include path, use C ones - if 'INC%sPREFIX' % dialect not in env: - env['INC%sPREFIX' % dialect] = '$INCPREFIX' - - if 'INC%sSUFFIX' % dialect not in env: - env['INC%sSUFFIX' % dialect] = '$INCSUFFIX' - - env['_%sINCFLAGS' % dialect] = '$( ${_concat(INC%sPREFIX, %sPATH, INC%sSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' % (dialect, dialect, dialect) - - if support_module == 1: - env['%sCOM' % dialect] = '$%s -o $TARGET -c $%sFLAGS $_%sINCFLAGS $_FORTRANMODFLAG $SOURCES' % (dialect, dialect, dialect) - env['%sPPCOM' % dialect] = '$%s -o $TARGET -c $%sFLAGS $CPPFLAGS $_CPPDEFFLAGS $_%sINCFLAGS $_FORTRANMODFLAG $SOURCES' % (dialect, dialect, dialect) - env['SH%sCOM' % dialect] = '$SH%s -o $TARGET -c $SH%sFLAGS $_%sINCFLAGS $_FORTRANMODFLAG $SOURCES' % (dialect, dialect, dialect) - env['SH%sPPCOM' % dialect] = '$SH%s -o $TARGET -c $SH%sFLAGS $CPPFLAGS $_CPPDEFFLAGS $_%sINCFLAGS $_FORTRANMODFLAG $SOURCES' % (dialect, dialect, dialect) - else: - env['%sCOM' % dialect] = '$%s -o $TARGET -c $%sFLAGS $_%sINCFLAGS $SOURCES' % (dialect, dialect, dialect) - env['%sPPCOM' % dialect] = '$%s -o $TARGET -c $%sFLAGS $CPPFLAGS $_CPPDEFFLAGS $_%sINCFLAGS $SOURCES' % (dialect, dialect, dialect) - env['SH%sCOM' % dialect] = '$SH%s -o $TARGET -c $SH%sFLAGS $_%sINCFLAGS $SOURCES' % (dialect, dialect, dialect) - env['SH%sPPCOM' % dialect] = '$SH%s -o $TARGET -c $SH%sFLAGS $CPPFLAGS $_CPPDEFFLAGS $_%sINCFLAGS $SOURCES' % (dialect, dialect, dialect) - -def add_fortran_to_env(env): - """Add Builders and construction variables for Fortran to an Environment.""" - try: - FortranSuffixes = env['FORTRANFILESUFFIXES'] - except KeyError: - FortranSuffixes = ['.f', '.for', '.ftn'] - - #print "Adding %s to fortran suffixes" % FortranSuffixes - try: - FortranPPSuffixes = env['FORTRANPPFILESUFFIXES'] - except KeyError: - FortranPPSuffixes = ['.fpp', '.FPP'] - - DialectAddToEnv(env, "FORTRAN", FortranSuffixes, - FortranPPSuffixes, support_module = 1) - - env['FORTRANMODPREFIX'] = '' # like $LIBPREFIX - env['FORTRANMODSUFFIX'] = '.mod' # like $LIBSUFFIX - - env['FORTRANMODDIR'] = '' # where the compiler should place .mod files - env['FORTRANMODDIRPREFIX'] = '' # some prefix to $FORTRANMODDIR - similar to $INCPREFIX - env['FORTRANMODDIRSUFFIX'] = '' # some suffix to $FORTRANMODDIR - similar to $INCSUFFIX - env['_FORTRANMODFLAG'] = '$( ${_concat(FORTRANMODDIRPREFIX, FORTRANMODDIR, FORTRANMODDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' - -def add_f77_to_env(env): - """Add Builders and construction variables for f77 to an Environment.""" - try: - F77Suffixes = env['F77FILESUFFIXES'] - except KeyError: - F77Suffixes = ['.f77'] - - #print "Adding %s to f77 suffixes" % F77Suffixes - try: - F77PPSuffixes = env['F77PPFILESUFFIXES'] - except KeyError: - F77PPSuffixes = [] - - DialectAddToEnv(env, "F77", F77Suffixes, F77PPSuffixes) - -def add_f90_to_env(env): - """Add Builders and construction variables for f90 to an Environment.""" - try: - F90Suffixes = env['F90FILESUFFIXES'] - except KeyError: - F90Suffixes = ['.f90'] - - #print "Adding %s to f90 suffixes" % F90Suffixes - try: - F90PPSuffixes = env['F90PPFILESUFFIXES'] - except KeyError: - F90PPSuffixes = [] - - DialectAddToEnv(env, "F90", F90Suffixes, F90PPSuffixes, - support_module = 1) - -def add_f95_to_env(env): - """Add Builders and construction variables for f95 to an Environment.""" - try: - F95Suffixes = env['F95FILESUFFIXES'] - except KeyError: - F95Suffixes = ['.f95'] - - #print "Adding %s to f95 suffixes" % F95Suffixes - try: - F95PPSuffixes = env['F95PPFILESUFFIXES'] - except KeyError: - F95PPSuffixes = [] - - DialectAddToEnv(env, "F95", F95Suffixes, F95PPSuffixes, - support_module = 1) - -def add_f03_to_env(env): - """Add Builders and construction variables for f03 to an Environment.""" - try: - F03Suffixes = env['F03FILESUFFIXES'] - except KeyError: - F03Suffixes = ['.f03'] - - #print "Adding %s to f95 suffixes" % F95Suffixes - try: - F03PPSuffixes = env['F03PPFILESUFFIXES'] - except KeyError: - F03PPSuffixes = [] - - DialectAddToEnv(env, "F03", F03Suffixes, F03PPSuffixes, - support_module = 1) - -def add_all_to_env(env): - """Add builders and construction variables for all supported fortran - dialects.""" - add_fortran_to_env(env) - add_f77_to_env(env) - add_f90_to_env(env) - add_f95_to_env(env) - add_f03_to_env(env) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/GettextCommon.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/GettextCommon.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/GettextCommon.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/GettextCommon.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,429 +0,0 @@ -"""SCons.Tool.GettextCommon module - -Used by several tools of `gettext` toolset. -""" - -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/GettextCommon.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Warnings -import re - -############################################################################# -class XgettextToolWarning(SCons.Warnings.Warning): pass -class XgettextNotFound(XgettextToolWarning): pass -class MsginitToolWarning(SCons.Warnings.Warning): pass -class MsginitNotFound(MsginitToolWarning): pass -class MsgmergeToolWarning(SCons.Warnings.Warning): pass -class MsgmergeNotFound(MsgmergeToolWarning): pass -class MsgfmtToolWarning(SCons.Warnings.Warning): pass -class MsgfmtNotFound(MsgfmtToolWarning): pass -############################################################################# -SCons.Warnings.enableWarningClass(XgettextToolWarning) -SCons.Warnings.enableWarningClass(XgettextNotFound) -SCons.Warnings.enableWarningClass(MsginitToolWarning) -SCons.Warnings.enableWarningClass(MsginitNotFound) -SCons.Warnings.enableWarningClass(MsgmergeToolWarning) -SCons.Warnings.enableWarningClass(MsgmergeNotFound) -SCons.Warnings.enableWarningClass(MsgfmtToolWarning) -SCons.Warnings.enableWarningClass(MsgfmtNotFound) -############################################################################# - -############################################################################# -class _POTargetFactory(object): - """ A factory of `PO` target files. - - Factory defaults differ from these of `SCons.Node.FS.FS`. We set `precious` - (this is required by builders and actions gettext) and `noclean` flags by - default for all produced nodes. - """ - def __init__( self, env, nodefault = True, alias = None, precious = True - , noclean = True ): - """ Object constructor. - - **Arguments** - - - *env* (`SCons.Environment.Environment`) - - *nodefault* (`boolean`) - if `True`, produced nodes will be ignored - from default target `'.'` - - *alias* (`string`) - if provided, produced nodes will be automatically - added to this alias, and alias will be set as `AlwaysBuild` - - *precious* (`boolean`) - if `True`, the produced nodes will be set as - `Precious`. - - *noclen* (`boolean`) - if `True`, the produced nodes will be excluded - from `Clean`. - """ - self.env = env - self.alias = alias - self.precious = precious - self.noclean = noclean - self.nodefault = nodefault - - def _create_node(self, name, factory, directory = None, create = 1): - """ Create node, and set it up to factory settings. """ - import SCons.Util - node = factory(name, directory, create) - node.set_noclean(self.noclean) - node.set_precious(self.precious) - if self.nodefault: - self.env.Ignore('.', node) - if self.alias: - self.env.AlwaysBuild(self.env.Alias(self.alias, node)) - return node - - def Entry(self, name, directory = None, create = 1): - """ Create `SCons.Node.FS.Entry` """ - return self._create_node(name, self.env.fs.Entry, directory, create) - - def File(self, name, directory = None, create = 1): - """ Create `SCons.Node.FS.File` """ - return self._create_node(name, self.env.fs.File, directory, create) -############################################################################# - -############################################################################# -_re_comment = re.compile(r'(#[^\n\r]+)$', re.M) -_re_lang = re.compile(r'([a-zA-Z0-9_]+)', re.M) -############################################################################# -def _read_linguas_from_files(env, linguas_files = None): - """ Parse `LINGUAS` file and return list of extracted languages """ - import SCons.Util - import SCons.Environment - global _re_comment - global _re_lang - if not SCons.Util.is_List(linguas_files) \ - and not SCons.Util.is_String(linguas_files) \ - and not isinstance(linguas_files, SCons.Node.FS.Base) \ - and linguas_files: - # If, linguas_files==True or such, then read 'LINGUAS' file. - linguas_files = [ 'LINGUAS' ] - if linguas_files is None: - return [] - fnodes = env.arg2nodes(linguas_files) - linguas = [] - for fnode in fnodes: - contents = _re_comment.sub("", fnode.get_text_contents()) - ls = [ l for l in _re_lang.findall(contents) if l ] - linguas.extend(ls) - return linguas -############################################################################# - -############################################################################# -from SCons.Builder import BuilderBase -############################################################################# -class _POFileBuilder(BuilderBase): - """ `PO` file builder. - - This is multi-target single-source builder. In typical situation the source - is single `POT` file, e.g. `messages.pot`, and there are multiple `PO` - targets to be updated from this `POT`. We must run - `SCons.Builder.BuilderBase._execute()` separatelly for each target to track - dependencies separatelly for each target file. - - **NOTE**: if we call `SCons.Builder.BuilderBase._execute(.., target, ...)` - with target being list of all targets, all targets would be rebuilt each time - one of the targets from this list is missing. This would happen, for example, - when new language `ll` enters `LINGUAS_FILE` (at this moment there is no - `ll.po` file yet). To avoid this, we override - `SCons.Builder.BuilerBase._execute()` and call it separatelly for each - target. Here we also append to the target list the languages read from - `LINGUAS_FILE`. - """ - # - #* The argument for overriding _execute(): We must use environment with - # builder overrides applied (see BuilderBase.__init__(). Here it comes for - # free. - #* The argument against using 'emitter': The emitter is called too late - # by BuilderBase._execute(). If user calls, for example: - # - # env.POUpdate(LINGUAS_FILE = 'LINGUAS') - # - # the builder throws error, because it is called with target=None, - # source=None and is trying to "generate" sources or target list first. - # If user calls - # - # env.POUpdate(['foo', 'baz'], LINGUAS_FILE = 'LINGUAS') - # - # the env.BuilderWrapper() calls our builder with target=None, - # source=['foo', 'baz']. The BuilderBase._execute() then splits execution - # and execute iterativelly (recursion) self._execute(None, source[i]). - # After that it calls emitter (which is quite too late). The emitter is - # also called in each iteration, what makes things yet worse. - def __init__(self, env, **kw): - if not 'suffix' in kw: - kw['suffix'] = '$POSUFFIX' - if not 'src_suffix' in kw: - kw['src_suffix'] = '$POTSUFFIX' - if not 'src_builder' in kw: - kw['src_builder'] = '_POTUpdateBuilder' - if not 'single_source' in kw: - kw['single_source'] = True - alias = None - if 'target_alias' in kw: - alias = kw['target_alias'] - del kw['target_alias'] - if not 'target_factory' in kw: - kw['target_factory'] = _POTargetFactory(env, alias=alias).File - BuilderBase.__init__(self, **kw) - - def _execute(self, env, target, source, *args, **kw): - """ Execute builder's actions. - - Here we append to `target` the languages read from `$LINGUAS_FILE` and - apply `SCons.Builder.BuilderBase._execute()` separatelly to each target. - The arguments and return value are same as for - `SCons.Builder.BuilderBase._execute()`. - """ - import SCons.Util - import SCons.Node - linguas_files = None - if env.has_key('LINGUAS_FILE') and env['LINGUAS_FILE']: - linguas_files = env['LINGUAS_FILE'] - # This prevents endless recursion loop (we'll be invoked once for - # each target appended here, we must not extend the list again). - env['LINGUAS_FILE'] = None - linguas = _read_linguas_from_files(env,linguas_files) - if SCons.Util.is_List(target): - target.extend(linguas) - elif target is not None: - target = [target] + linguas - else: - target = linguas - if not target: - # Let the SCons.BuilderBase to handle this patologic situation - return BuilderBase._execute( self, env, target, source, *args, **kw) - # The rest is ours - if not SCons.Util.is_List(target): - target = [ target ] - result = [] - for tgt in target: - r = BuilderBase._execute( self, env, [tgt], source, *args, **kw) - result.extend(r) - if linguas_files is not None: - env['LINGUAS_FILE'] = linguas_files - return SCons.Node.NodeList(result) -############################################################################# - -import SCons.Environment -############################################################################# -def _translate(env, target=[], source=SCons.Environment._null, *args, **kw): - """ Function for `Translate()` pseudo-builder """ - pot = env.POTUpdate(None, source, *args, **kw) - po = env.POUpdate(target, pot, *args, **kw) - return po -############################################################################# - -############################################################################# -class RPaths(object): - """ Callable object, which returns pathnames relative to SCons current - working directory. - - It seems like `SCons.Node.FS.Base.get_path()` returns absolute paths - for nodes that are outside of current working directory (`env.fs.getcwd()`). - Here, we often have `SConscript`, `POT` and `PO` files within `po/` - directory and source files (e.g. `*.c`) outside of it. When generating `POT` - template file, references to source files are written to `POT` template, so - a translator may later quickly jump to appropriate source file and line from - its `PO` editor (e.g. `poedit`). Relative paths in `PO` file are usually - interpreted by `PO` editor as paths relative to the place, where `PO` file - lives. The absolute paths would make resultant `POT` file nonportable, as - the references would be correct only on the machine, where `POT` file was - recently re-created. For such reason, we need a function, which always - returns relative paths. This is the purpose of `RPaths` callable object. - - The `__call__` method returns paths relative to current woking directory, but - we assume, that *xgettext(1)* is run from the directory, where target file is - going to be created. - - Note, that this may not work for files distributed over several hosts or - across different drives on windows. We assume here, that single local - filesystem holds both source files and target `POT` templates. - - Intended use of `RPaths` - in `xgettext.py`:: - - def generate(env): - from GettextCommon import RPaths - ... - sources = '$( ${_concat( "", SOURCES, "", __env__, XgettextRPaths, TARGET, SOURCES)} $)' - env.Append( - ... - XGETTEXTCOM = 'XGETTEXT ... ' + sources, - ... - XgettextRPaths = RPaths(env) - ) - """ - # NOTE: This callable object returns pathnames of dirs/files relative to - # current working directory. The pathname remains relative also for entries - # that are outside of current working directory (node, that - # SCons.Node.FS.File and siblings return absolute path in such case). For - # simplicity we compute path relative to current working directory, this - # seems be enough for our purposes (don't need TARGET variable and - # SCons.Defaults.Variable_Caller stuff). - - def __init__(self, env): - """ Initialize `RPaths` callable object. - - **Arguments**: - - - *env* - a `SCons.Environment.Environment` object, defines *current - working dir*. - """ - self.env = env - - # FIXME: I'm not sure, how it should be implemented (what the *args are in - # general, what is **kw). - def __call__(self, nodes, *args, **kw): - """ Return nodes' paths (strings) relative to current working directory. - - **Arguments**: - - - *nodes* ([`SCons.Node.FS.Base`]) - list of nodes. - - *args* - currently unused. - - *kw* - currently unused. - - **Returns**: - - - Tuple of strings, which represent paths relative to current working - directory (for given environment). - """ - # os.path.relpath is available only on python >= 2.6. We use our own - # implementation. It's taken from BareNecessities package: - # http://jimmyg.org/work/code/barenecessities/index.html - from posixpath import curdir - def relpath(path, start=curdir): - import posixpath - """Return a relative version of a path""" - if not path: - raise ValueError("no path specified") - start_list = posixpath.abspath(start).split(posixpath.sep) - path_list = posixpath.abspath(path).split(posixpath.sep) - # Work out how much of the filepath is shared by start and path. - i = len(posixpath.commonprefix([start_list, path_list])) - rel_list = [posixpath.pardir] * (len(start_list)-i) + path_list[i:] - if not rel_list: - return posixpath.curdir - return posixpath.join(*rel_list) - import os - import SCons.Node.FS - rpaths = () - cwd = self.env.fs.getcwd().get_abspath() - for node in nodes: - rpath = None - if isinstance(node, SCons.Node.FS.Base): - rpath = relpath(node.get_abspath(), cwd) - # FIXME: Other types possible here? - if rpath is not None: - rpaths += (rpath,) - return rpaths -############################################################################# - -############################################################################# -def _init_po_files(target, source, env): - """ Action function for `POInit` builder. """ - nop = lambda target, source, env : 0 - if env.has_key('POAUTOINIT'): - autoinit = env['POAUTOINIT'] - else: - autoinit = False - # Well, if everything outside works well, this loop should do single - # iteration. Otherwise we are rebuilding all the targets even, if just - # one has changed (but is this out fault?). - for tgt in target: - if not tgt.exists(): - if autoinit: - action = SCons.Action.Action('$MSGINITCOM', '$MSGINITCOMSTR') - else: - msg = 'File ' + repr(str(tgt)) + ' does not exist. ' \ - + 'If you are a translator, you can create it through: \n' \ - + '$MSGINITCOM' - action = SCons.Action.Action(nop, msg) - status = action([tgt], source, env) - if status: return status - return 0 -############################################################################# - -############################################################################# -def _detect_xgettext(env): - """ Detects *xgettext(1)* binary """ - if env.has_key('XGETTEXT'): - return env['XGETTEXT'] - xgettext = env.Detect('xgettext'); - if xgettext: - return xgettext - raise SCons.Errors.StopError(XgettextNotFound,"Could not detect xgettext") - return None -############################################################################# -def _xgettext_exists(env): - return _detect_xgettext(env) -############################################################################# - -############################################################################# -def _detect_msginit(env): - """ Detects *msginit(1)* program. """ - if env.has_key('MSGINIT'): - return env['MSGINIT'] - msginit = env.Detect('msginit'); - if msginit: - return msginit - raise SCons.Errors.StopError(MsginitNotFound, "Could not detect msginit") - return None -############################################################################# -def _msginit_exists(env): - return _detect_msginit(env) -############################################################################# - -############################################################################# -def _detect_msgmerge(env): - """ Detects *msgmerge(1)* program. """ - if env.has_key('MSGMERGE'): - return env['MSGMERGE'] - msgmerge = env.Detect('msgmerge'); - if msgmerge: - return msgmerge - raise SCons.Errors.StopError(MsgmergeNotFound, "Could not detect msgmerge") - return None -############################################################################# -def _msgmerge_exists(env): - return _detect_msgmerge(env) -############################################################################# - -############################################################################# -def _detect_msgfmt(env): - """ Detects *msgmfmt(1)* program. """ - if env.has_key('MSGFMT'): - return env['MSGFMT'] - msgfmt = env.Detect('msgfmt'); - if msgfmt: - return msgfmt - raise SCons.Errors.StopError(MsgfmtNotFound, "Could not detect msgfmt") - return None -############################################################################# -def _msgfmt_exists(env): - return _detect_msgfmt(env) -############################################################################# - -############################################################################# -def tool_list(platform, env): - """ List tools that shall be generated by top-level `gettext` tool """ - return [ 'xgettext', 'msginit', 'msgmerge', 'msgfmt' ] -############################################################################# - diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/JavaCommon.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/JavaCommon.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/JavaCommon.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/JavaCommon.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,323 +0,0 @@ -"""SCons.Tool.JavaCommon - -Stuff for processing Java. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/JavaCommon.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os -import os.path -import re - -java_parsing = 1 - -default_java_version = '1.4' - -if java_parsing: - # Parse Java files for class names. - # - # This is a really cool parser from Charles Crain - # that finds appropriate class names in Java source. - - # A regular expression that will find, in a java file: - # newlines; - # double-backslashes; - # a single-line comment "//"; - # single or double quotes preceeded by a backslash; - # single quotes, double quotes, open or close braces, semi-colons, - # periods, open or close parentheses; - # floating-point numbers; - # any alphanumeric token (keyword, class name, specifier); - # any alphanumeric token surrounded by angle brackets (generics); - # the multi-line comment begin and end tokens /* and */; - # array declarations "[]". - _reToken = re.compile(r'(\n|\\\\|//|\\[\'"]|[\'"\{\}\;\.\(\)]|' + - r'\d*\.\d*|[A-Za-z_][\w\$\.]*|<[A-Za-z_]\w+>|' + - r'/\*|\*/|\[\])') - - class OuterState(object): - """The initial state for parsing a Java file for classes, - interfaces, and anonymous inner classes.""" - def __init__(self, version=default_java_version): - - if not version in ('1.1', '1.2', '1.3','1.4', '1.5', '1.6', - '5', '6'): - msg = "Java version %s not supported" % version - raise NotImplementedError(msg) - - self.version = version - self.listClasses = [] - self.listOutputs = [] - self.stackBrackets = [] - self.brackets = 0 - self.nextAnon = 1 - self.localClasses = [] - self.stackAnonClassBrackets = [] - self.anonStacksStack = [[0]] - self.package = None - - def trace(self): - pass - - def __getClassState(self): - try: - return self.classState - except AttributeError: - ret = ClassState(self) - self.classState = ret - return ret - - def __getPackageState(self): - try: - return self.packageState - except AttributeError: - ret = PackageState(self) - self.packageState = ret - return ret - - def __getAnonClassState(self): - try: - return self.anonState - except AttributeError: - self.outer_state = self - ret = SkipState(1, AnonClassState(self)) - self.anonState = ret - return ret - - def __getSkipState(self): - try: - return self.skipState - except AttributeError: - ret = SkipState(1, self) - self.skipState = ret - return ret - - def __getAnonStack(self): - return self.anonStacksStack[-1] - - def openBracket(self): - self.brackets = self.brackets + 1 - - def closeBracket(self): - self.brackets = self.brackets - 1 - if len(self.stackBrackets) and \ - self.brackets == self.stackBrackets[-1]: - self.listOutputs.append('$'.join(self.listClasses)) - self.localClasses.pop() - self.listClasses.pop() - self.anonStacksStack.pop() - self.stackBrackets.pop() - if len(self.stackAnonClassBrackets) and \ - self.brackets == self.stackAnonClassBrackets[-1]: - self.__getAnonStack().pop() - self.stackAnonClassBrackets.pop() - - def parseToken(self, token): - if token[:2] == '//': - return IgnoreState('\n', self) - elif token == '/*': - return IgnoreState('*/', self) - elif token == '{': - self.openBracket() - elif token == '}': - self.closeBracket() - elif token in [ '"', "'" ]: - return IgnoreState(token, self) - elif token == "new": - # anonymous inner class - if len(self.listClasses) > 0: - return self.__getAnonClassState() - return self.__getSkipState() # Skip the class name - elif token in ['class', 'interface', 'enum']: - if len(self.listClasses) == 0: - self.nextAnon = 1 - self.stackBrackets.append(self.brackets) - return self.__getClassState() - elif token == 'package': - return self.__getPackageState() - elif token == '.': - # Skip the attribute, it might be named "class", in which - # case we don't want to treat the following token as - # an inner class name... - return self.__getSkipState() - return self - - def addAnonClass(self): - """Add an anonymous inner class""" - if self.version in ('1.1', '1.2', '1.3', '1.4'): - clazz = self.listClasses[0] - self.listOutputs.append('%s$%d' % (clazz, self.nextAnon)) - elif self.version in ('1.5', '1.6', '5', '6'): - self.stackAnonClassBrackets.append(self.brackets) - className = [] - className.extend(self.listClasses) - self.__getAnonStack()[-1] = self.__getAnonStack()[-1] + 1 - for anon in self.__getAnonStack(): - className.append(str(anon)) - self.listOutputs.append('$'.join(className)) - - self.nextAnon = self.nextAnon + 1 - self.__getAnonStack().append(0) - - def setPackage(self, package): - self.package = package - - class AnonClassState(object): - """A state that looks for anonymous inner classes.""" - def __init__(self, old_state): - # outer_state is always an instance of OuterState - self.outer_state = old_state.outer_state - self.old_state = old_state - self.brace_level = 0 - def parseToken(self, token): - # This is an anonymous class if and only if the next - # non-whitespace token is a bracket. Everything between - # braces should be parsed as normal java code. - if token[:2] == '//': - return IgnoreState('\n', self) - elif token == '/*': - return IgnoreState('*/', self) - elif token == '\n': - return self - elif token[0] == '<' and token[-1] == '>': - return self - elif token == '(': - self.brace_level = self.brace_level + 1 - return self - if self.brace_level > 0: - if token == 'new': - # look further for anonymous inner class - return SkipState(1, AnonClassState(self)) - elif token in [ '"', "'" ]: - return IgnoreState(token, self) - elif token == ')': - self.brace_level = self.brace_level - 1 - return self - if token == '{': - self.outer_state.addAnonClass() - return self.old_state.parseToken(token) - - class SkipState(object): - """A state that will skip a specified number of tokens before - reverting to the previous state.""" - def __init__(self, tokens_to_skip, old_state): - self.tokens_to_skip = tokens_to_skip - self.old_state = old_state - def parseToken(self, token): - self.tokens_to_skip = self.tokens_to_skip - 1 - if self.tokens_to_skip < 1: - return self.old_state - return self - - class ClassState(object): - """A state we go into when we hit a class or interface keyword.""" - def __init__(self, outer_state): - # outer_state is always an instance of OuterState - self.outer_state = outer_state - def parseToken(self, token): - # the next non-whitespace token should be the name of the class - if token == '\n': - return self - # If that's an inner class which is declared in a method, it - # requires an index prepended to the class-name, e.g. - # 'Foo$1Inner' (Tigris Issue 2087) - if self.outer_state.localClasses and \ - self.outer_state.stackBrackets[-1] > \ - self.outer_state.stackBrackets[-2]+1: - locals = self.outer_state.localClasses[-1] - try: - idx = locals[token] - locals[token] = locals[token]+1 - except KeyError: - locals[token] = 1 - token = str(locals[token]) + token - self.outer_state.localClasses.append({}) - self.outer_state.listClasses.append(token) - self.outer_state.anonStacksStack.append([0]) - return self.outer_state - - class IgnoreState(object): - """A state that will ignore all tokens until it gets to a - specified token.""" - def __init__(self, ignore_until, old_state): - self.ignore_until = ignore_until - self.old_state = old_state - def parseToken(self, token): - if self.ignore_until == token: - return self.old_state - return self - - class PackageState(object): - """The state we enter when we encounter the package keyword. - We assume the next token will be the package name.""" - def __init__(self, outer_state): - # outer_state is always an instance of OuterState - self.outer_state = outer_state - def parseToken(self, token): - self.outer_state.setPackage(token) - return self.outer_state - - def parse_java_file(fn, version=default_java_version): - return parse_java(open(fn, 'r').read(), version) - - def parse_java(contents, version=default_java_version, trace=None): - """Parse a .java file and return a double of package directory, - plus a list of .class files that compiling that .java file will - produce""" - package = None - initial = OuterState(version) - currstate = initial - for token in _reToken.findall(contents): - # The regex produces a bunch of groups, but only one will - # have anything in it. - currstate = currstate.parseToken(token) - if trace: trace(token, currstate) - if initial.package: - package = initial.package.replace('.', os.sep) - return (package, initial.listOutputs) - -else: - # Don't actually parse Java files for class names. - # - # We might make this a configurable option in the future if - # Java-file parsing takes too long (although it shouldn't relative - # to how long the Java compiler itself seems to take...). - - def parse_java_file(fn): - """ "Parse" a .java file. - - This actually just splits the file name, so the assumption here - is that the file name matches the public class name, and that - the path to the file is the same as the package name. - """ - return os.path.split(file) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/__init__.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/__init__.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/__init__.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/MSCommon/__init__.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -__doc__ = """ -Common functions for Microsoft Visual Studio and Visual C/C++. -""" - -import copy -import os -import re -import subprocess - -import SCons.Errors -import SCons.Platform.win32 -import SCons.Util - -from SCons.Tool.MSCommon.sdk import mssdk_exists, \ - mssdk_setup_env - -from SCons.Tool.MSCommon.vc import msvc_exists, \ - msvc_setup_env, \ - msvc_setup_env_once - -from SCons.Tool.MSCommon.vs import get_default_version, \ - get_vs_by_version, \ - merge_default_version, \ - msvs_exists, \ - query_versions - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/arch.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/arch.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/arch.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/arch.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/MSCommon/arch.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -__doc__ = """Module to define supported Windows chip architectures. -""" - -import os - -class ArchDefinition(object): - """ - A class for defining architecture-specific settings and logic. - """ - def __init__(self, arch, synonyms=[]): - self.arch = arch - self.synonyms = synonyms - -SupportedArchitectureList = [ - ArchitectureDefinition( - 'x86', - ['i386', 'i486', 'i586', 'i686'], - ), - - ArchitectureDefinition( - 'x86_64', - ['AMD64', 'amd64', 'em64t', 'EM64T', 'x86_64'], - ), - - ArchitectureDefinition( - 'ia64', - ['IA64'], - ), -] - -SupportedArchitectureMap = {} -for a in SupportedArchitectureList: - SupportedArchitectureMap[a.arch] = a - for s in a.synonyms: - SupportedArchitectureMap[s] = a - diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/common.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/common.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/common.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/common.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,240 +0,0 @@ -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/MSCommon/common.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -__doc__ = """ -Common helper functions for working with the Microsoft tool chain. -""" - -import copy -import os -import subprocess -import re - -import SCons.Util - - -logfile = os.environ.get('SCONS_MSCOMMON_DEBUG') -if logfile == '-': - def debug(x): - print x -elif logfile: - try: - import logging - except ImportError: - debug = lambda x: open(logfile, 'a').write(x + '\n') - else: - logging.basicConfig(filename=logfile, level=logging.DEBUG) - debug = logging.debug -else: - debug = lambda x: None - - -_is_win64 = None - -def is_win64(): - """Return true if running on windows 64 bits. - - Works whether python itself runs in 64 bits or 32 bits.""" - # Unfortunately, python does not provide a useful way to determine - # if the underlying Windows OS is 32-bit or 64-bit. Worse, whether - # the Python itself is 32-bit or 64-bit affects what it returns, - # so nothing in sys.* or os.* help. - - # Apparently the best solution is to use env vars that Windows - # sets. If PROCESSOR_ARCHITECTURE is not x86, then the python - # process is running in 64 bit mode (on a 64-bit OS, 64-bit - # hardware, obviously). - # If this python is 32-bit but the OS is 64, Windows will set - # ProgramW6432 and PROCESSOR_ARCHITEW6432 to non-null. - # (Checking for HKLM\Software\Wow6432Node in the registry doesn't - # work, because some 32-bit installers create it.) - global _is_win64 - if _is_win64 is None: - # I structured these tests to make it easy to add new ones or - # add exceptions in the future, because this is a bit fragile. - _is_win64 = False - if os.environ.get('PROCESSOR_ARCHITECTURE','x86') != 'x86': - _is_win64 = True - if os.environ.get('PROCESSOR_ARCHITEW6432'): - _is_win64 = True - if os.environ.get('ProgramW6432'): - _is_win64 = True - return _is_win64 - - -def read_reg(value): - return SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, value)[0] - -def has_reg(value): - """Return True if the given key exists in HKEY_LOCAL_MACHINE, False - otherwise.""" - try: - SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, value) - ret = True - except WindowsError: - ret = False - return ret - -# Functions for fetching environment variable settings from batch files. - -def normalize_env(env, keys, force=False): - """Given a dictionary representing a shell environment, add the variables - from os.environ needed for the processing of .bat files; the keys are - controlled by the keys argument. - - It also makes sure the environment values are correctly encoded. - - If force=True, then all of the key values that exist are copied - into the returned dictionary. If force=false, values are only - copied if the key does not already exist in the copied dictionary. - - Note: the environment is copied.""" - normenv = {} - if env: - for k in env.keys(): - normenv[k] = copy.deepcopy(env[k]).encode('mbcs') - - for k in keys: - if k in os.environ and (force or not k in normenv): - normenv[k] = os.environ[k].encode('mbcs') - - return normenv - -def get_output(vcbat, args = None, env = None): - """Parse the output of given bat file, with given args.""" - - if env is None: - # Create a blank environment, for use in launching the tools - env = SCons.Environment.Environment(tools=[]) - - # TODO: This is a hard-coded list of the variables that (may) need - # to be imported from os.environ[] for v[sc]*vars*.bat file - # execution to work. This list should really be either directly - # controlled by vc.py, or else derived from the common_tools_var - # settings in vs.py. - vars = [ - 'COMSPEC', - 'VS90COMNTOOLS', - 'VS80COMNTOOLS', - 'VS71COMNTOOLS', - 'VS70COMNTOOLS', - 'VS60COMNTOOLS', - ] - env['ENV'] = normalize_env(env['ENV'], vars, force=False) - - if args: - debug("Calling '%s %s'" % (vcbat, args)) - popen = SCons.Action._subproc(env, - '"%s" %s & set' % (vcbat, args), - stdin = 'devnull', - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - else: - debug("Calling '%s'" % vcbat) - popen = SCons.Action._subproc(env, - '"%s" & set' % vcbat, - stdin = 'devnull', - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - - # Use the .stdout and .stderr attributes directly because the - # .communicate() method uses the threading module on Windows - # and won't work under Pythons not built with threading. - stdout = popen.stdout.read() - stderr = popen.stderr.read() - if stderr: - # TODO: find something better to do with stderr; - # this at least prevents errors from getting swallowed. - import sys - sys.stderr.write(stderr) - if popen.wait() != 0: - raise IOError(stderr.decode("mbcs")) - - output = stdout.decode("mbcs") - return output - -def parse_output(output, keep = ("INCLUDE", "LIB", "LIBPATH", "PATH")): - # dkeep is a dict associating key: path_list, where key is one item from - # keep, and pat_list the associated list of paths - - dkeep = dict([(i, []) for i in keep]) - - # rdk will keep the regex to match the .bat file output line starts - rdk = {} - for i in keep: - rdk[i] = re.compile('%s=(.*)' % i, re.I) - - def add_env(rmatch, key, dkeep=dkeep): - plist = rmatch.group(1).split(os.pathsep) - for p in plist: - # Do not add empty paths (when a var ends with ;) - if p: - p = p.encode('mbcs') - # XXX: For some reason, VC98 .bat file adds "" around the PATH - # values, and it screws up the environment later, so we strip - # it. - p = p.strip('"') - dkeep[key].append(p) - - for line in output.splitlines(): - for k,v in rdk.items(): - m = v.match(line) - if m: - add_env(m, k) - - return dkeep - -# TODO(sgk): unused -def output_to_dict(output): - """Given an output string, parse it to find env variables. - - Return a dict where keys are variables names, and values their content""" - envlinem = re.compile(r'^([a-zA-z0-9]+)=([\S\s]*)$') - parsedenv = {} - for line in output.splitlines(): - m = envlinem.match(line) - if m: - parsedenv[m.group(1)] = m.group(2) - return parsedenv - -# TODO(sgk): unused -def get_new(l1, l2): - """Given two list l1 and l2, return the items in l2 which are not in l1. - Order is maintained.""" - - # We don't try to be smart: lists are small, and this is not the bottleneck - # is any case - new = [] - for i in l2: - if i not in l1: - new.append(i) - - return new - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/netframework.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/netframework.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/netframework.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/netframework.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/MSCommon/netframework.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -__doc__ = """ -""" - -import os -import re - -from common import read_reg, debug - -# Original value recorded by dcournapeau -_FRAMEWORKDIR_HKEY_ROOT = r'Software\Microsoft\.NETFramework\InstallRoot' -# On SGK's system -_FRAMEWORKDIR_HKEY_ROOT = r'Software\Microsoft\Microsoft SDKs\.NETFramework\v2.0\InstallationFolder' - -def find_framework_root(): - # XXX: find it from environment (FrameworkDir) - try: - froot = read_reg(_FRAMEWORKDIR_HKEY_ROOT) - debug("Found framework install root in registry: %s" % froot) - except WindowsError, e: - debug("Could not read reg key %s" % _FRAMEWORKDIR_HKEY_ROOT) - return None - - if not os.path.exists(froot): - debug("%s not found on fs" % froot) - return None - - return froot - -def query_versions(): - froot = find_framework_root() - if froot: - contents = os.listdir(froot) - - l = re.compile('v[0-9]+.*') - versions = [e for e in contents if l.match(e)] - - def versrt(a,b): - # since version numbers aren't really floats... - aa = a[1:] - bb = b[1:] - aal = aa.split('.') - bbl = bb.split('.') - # sequence comparison in python is lexicographical - # which is exactly what we want. - # Note we sort backwards so the highest version is first. - return cmp(bbl,aal) - - versions.sort(versrt) - else: - versions = [] - - return versions - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/sdk.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/sdk.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/sdk.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/sdk.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,391 +0,0 @@ -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/MSCommon/sdk.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -__doc__ = """Module to detect the Platform/Windows SDK - -PSDK 2003 R1 is the earliest version detected. -""" - -import os - -import SCons.Errors -import SCons.Util - -import common - -debug = common.debug - -# SDK Checks. This is of course a mess as everything else on MS platforms. Here -# is what we do to detect the SDK: -# -# For Windows SDK >= 6.0: just look into the registry entries: -# HKLM\Software\Microsoft\Microsoft SDKs\Windows -# All the keys in there are the available versions. -# -# For Platform SDK before 6.0 (2003 server R1 and R2, etc...), there does not -# seem to be any sane registry key, so the precise location is hardcoded. -# -# For versions below 2003R1, it seems the PSDK is included with Visual Studio? -# -# Also, per the following: -# http://benjamin.smedbergs.us/blog/tag/atl/ -# VC++ Professional comes with the SDK, VC++ Express does not. - -# Location of the SDK (checked for 6.1 only) -_CURINSTALLED_SDK_HKEY_ROOT = \ - r"Software\Microsoft\Microsoft SDKs\Windows\CurrentInstallFolder" - - -class SDKDefinition(object): - """ - An abstract base class for trying to find installed SDK directories. - """ - def __init__(self, version, **kw): - self.version = version - self.__dict__.update(kw) - - def find_sdk_dir(self): - """Try to find the MS SDK from the registry. - - Return None if failed or the directory does not exist. - """ - if not SCons.Util.can_read_reg: - debug('find_sdk_dir(): can not read registry') - return None - - hkey = self.HKEY_FMT % self.hkey_data - debug('find_sdk_dir(): checking registry:%s'%hkey) - - try: - sdk_dir = common.read_reg(hkey) - except WindowsError, e: - debug('find_sdk_dir(): no SDK registry key %s' % repr(hkey)) - return None - - debug('find_sdk_dir(): Trying SDK Dir: %s'%sdk_dir) - - if not os.path.exists(sdk_dir): - debug('find_sdk_dir(): %s not on file system' % sdk_dir) - return None - - ftc = os.path.join(sdk_dir, self.sanity_check_file) - if not os.path.exists(ftc): - debug("find_sdk_dir(): sanity check %s not found" % ftc) - return None - - return sdk_dir - - def get_sdk_dir(self): - """Return the MSSSDK given the version string.""" - try: - return self._sdk_dir - except AttributeError: - sdk_dir = self.find_sdk_dir() - self._sdk_dir = sdk_dir - return sdk_dir - - def get_sdk_vc_script(self,host_arch, target_arch): - """ Return the script to initialize the VC compiler installed by SDK - """ - - if (host_arch == 'amd64' and target_arch == 'x86'): - # No cross tools needed compiling 32 bits on 64 bit machine - host_arch=target_arch - - arch_string=target_arch - if (host_arch != target_arch): - arch_string='%s_%s'%(host_arch,target_arch) - - debug("sdk.py: get_sdk_vc_script():arch_string:%s host_arch:%s target_arch:%s"%(arch_string, - host_arch, - target_arch)) - file=self.vc_setup_scripts.get(arch_string,None) - debug("sdk.py: get_sdk_vc_script():file:%s"%file) - return file - -class WindowsSDK(SDKDefinition): - """ - A subclass for trying to find installed Windows SDK directories. - """ - HKEY_FMT = r'Software\Microsoft\Microsoft SDKs\Windows\v%s\InstallationFolder' - def __init__(self, *args, **kw): - SDKDefinition.__init__(self, *args, **kw) - self.hkey_data = self.version - -class PlatformSDK(SDKDefinition): - """ - A subclass for trying to find installed Platform SDK directories. - """ - HKEY_FMT = r'Software\Microsoft\MicrosoftSDK\InstalledSDKS\%s\Install Dir' - def __init__(self, *args, **kw): - SDKDefinition.__init__(self, *args, **kw) - self.hkey_data = self.uuid - -# -# The list of VC initialization scripts installed by the SDK -# These should be tried if the vcvarsall.bat TARGET_ARCH fails -preSDK61VCSetupScripts = { 'x86' : r'bin\vcvars32.bat', - 'amd64' : r'bin\vcvarsamd64.bat', - 'x86_amd64': r'bin\vcvarsx86_amd64.bat', - 'x86_ia64' : r'bin\vcvarsx86_ia64.bat', - 'ia64' : r'bin\vcvarsia64.bat'} - -SDK61VCSetupScripts = {'x86' : r'bin\vcvars32.bat', - 'amd64' : r'bin\amd64\vcvarsamd64.bat', - 'x86_amd64': r'bin\x86_amd64\vcvarsx86_amd64.bat', - 'x86_ia64' : r'bin\x86_ia64\vcvarsx86_ia64.bat', - 'ia64' : r'bin\ia64\vcvarsia64.bat'} - -SDK70VCSetupScripts = { 'x86' : r'bin\vcvars32.bat', - 'amd64' : r'bin\vcvars64.bat', - 'x86_amd64': r'bin\vcvarsx86_amd64.bat', - 'x86_ia64' : r'bin\vcvarsx86_ia64.bat', - 'ia64' : r'bin\vcvarsia64.bat'} - -# The list of support SDKs which we know how to detect. -# -# The first SDK found in the list is the one used by default if there -# are multiple SDKs installed. Barring good reasons to the contrary, -# this means we should list SDKs with from most recent to oldest. -# -# If you update this list, update the documentation in Tool/mssdk.xml. -SupportedSDKList = [ - WindowsSDK('7.0', - sanity_check_file=r'bin\SetEnv.Cmd', - include_subdir='include', - lib_subdir={ - 'x86' : ['lib'], - 'x86_64' : [r'lib\x64'], - 'ia64' : [r'lib\ia64'], - }, - vc_setup_scripts = SDK70VCSetupScripts, - ), - WindowsSDK('6.1', - sanity_check_file=r'bin\SetEnv.Cmd', - include_subdir='include', - lib_subdir={ - 'x86' : ['lib'], - 'x86_64' : [r'lib\x64'], - 'ia64' : [r'lib\ia64'], - }, - vc_setup_scripts = SDK61VCSetupScripts, - ), - - WindowsSDK('6.0A', - sanity_check_file=r'include\windows.h', - include_subdir='include', - lib_subdir={ - 'x86' : ['lib'], - 'x86_64' : [r'lib\x64'], - 'ia64' : [r'lib\ia64'], - }, - vc_setup_scripts = preSDK61VCSetupScripts, - ), - - WindowsSDK('6.0', - sanity_check_file=r'bin\gacutil.exe', - include_subdir='include', - lib_subdir='lib', - vc_setup_scripts = preSDK61VCSetupScripts, - ), - - PlatformSDK('2003R2', - sanity_check_file=r'SetEnv.Cmd', - uuid="D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1", - vc_setup_scripts = preSDK61VCSetupScripts, - ), - - PlatformSDK('2003R1', - sanity_check_file=r'SetEnv.Cmd', - uuid="8F9E5EF3-A9A5-491B-A889-C58EFFECE8B3", - vc_setup_scripts = preSDK61VCSetupScripts, - ), -] - -SupportedSDKMap = {} -for sdk in SupportedSDKList: - SupportedSDKMap[sdk.version] = sdk - - -# Finding installed SDKs isn't cheap, because it goes not only to the -# registry but also to the disk to sanity-check that there is, in fact, -# an SDK installed there and that the registry entry isn't just stale. -# Find this information once, when requested, and cache it. - -InstalledSDKList = None -InstalledSDKMap = None - -def get_installed_sdks(): - global InstalledSDKList - global InstalledSDKMap - debug('sdk.py:get_installed_sdks()') - if InstalledSDKList is None: - InstalledSDKList = [] - InstalledSDKMap = {} - for sdk in SupportedSDKList: - debug('MSCommon/sdk.py: trying to find SDK %s' % sdk.version) - if sdk.get_sdk_dir(): - debug('MSCommon/sdk.py:found SDK %s' % sdk.version) - InstalledSDKList.append(sdk) - InstalledSDKMap[sdk.version] = sdk - return InstalledSDKList - - -# We may be asked to update multiple construction environments with -# SDK information. When doing this, we check on-disk for whether -# the SDK has 'mfc' and 'atl' subdirectories. Since going to disk -# is expensive, cache results by directory. - -SDKEnvironmentUpdates = {} - -def set_sdk_by_directory(env, sdk_dir): - global SDKEnvironmentUpdates - debug('set_sdk_by_directory: Using dir:%s'%sdk_dir) - try: - env_tuple_list = SDKEnvironmentUpdates[sdk_dir] - except KeyError: - env_tuple_list = [] - SDKEnvironmentUpdates[sdk_dir] = env_tuple_list - - include_path = os.path.join(sdk_dir, 'include') - mfc_path = os.path.join(include_path, 'mfc') - atl_path = os.path.join(include_path, 'atl') - - if os.path.exists(mfc_path): - env_tuple_list.append(('INCLUDE', mfc_path)) - if os.path.exists(atl_path): - env_tuple_list.append(('INCLUDE', atl_path)) - env_tuple_list.append(('INCLUDE', include_path)) - - env_tuple_list.append(('LIB', os.path.join(sdk_dir, 'lib'))) - env_tuple_list.append(('LIBPATH', os.path.join(sdk_dir, 'lib'))) - env_tuple_list.append(('PATH', os.path.join(sdk_dir, 'bin'))) - - for variable, directory in env_tuple_list: - env.PrependENVPath(variable, directory) - - -# TODO(sgk): currently unused; remove? -def get_cur_sdk_dir_from_reg(): - """Try to find the platform sdk directory from the registry. - - Return None if failed or the directory does not exist""" - if not SCons.Util.can_read_reg: - debug('SCons cannot read registry') - return None - - try: - val = common.read_reg(_CURINSTALLED_SDK_HKEY_ROOT) - debug("Found current sdk dir in registry: %s" % val) - except WindowsError, e: - debug("Did not find current sdk in registry") - return None - - if not os.path.exists(val): - debug("Current sdk dir %s not on fs" % val) - return None - - return val - -def get_sdk_by_version(mssdk): - if mssdk not in SupportedSDKMap: - msg = "SDK version %s is not supported" % repr(mssdk) - raise SCons.Errors.UserError(msg) - get_installed_sdks() - return InstalledSDKMap.get(mssdk) - -def get_default_sdk(): - """Set up the default Platform/Windows SDK.""" - get_installed_sdks() - if not InstalledSDKList: - return None - return InstalledSDKList[0] - - - - -def mssdk_setup_env(env): - debug('sdk.py:mssdk_setup_env()') - if 'MSSDK_DIR' in env: - sdk_dir = env['MSSDK_DIR'] - if sdk_dir is None: - return - sdk_dir = env.subst(sdk_dir) - debug('sdk.py:mssdk_setup_env: Using MSSDK_DIR:%s'%sdk_dir) - elif 'MSSDK_VERSION' in env: - sdk_version = env['MSSDK_VERSION'] - if sdk_version is None: - msg = "SDK version %s is not installed" % repr(mssdk) - raise SCons.Errors.UserError(msg) - sdk_version = env.subst(sdk_version) - mssdk = get_sdk_by_version(sdk_version) - sdk_dir = mssdk.get_sdk_dir() - debug('sdk.py:mssdk_setup_env: Using MSSDK_VERSION:%s'%sdk_dir) - elif 'MSVS_VERSION' in env: - msvs_version = env['MSVS_VERSION'] - debug('sdk.py:mssdk_setup_env:Getting MSVS_VERSION from env:%s'%msvs_version) - if msvs_version is None: - debug('sdk.py:mssdk_setup_env thinks msvs_version is None') - return - msvs_version = env.subst(msvs_version) - import vs - msvs = vs.get_vs_by_version(msvs_version) - debug('sdk.py:mssdk_setup_env:msvs is :%s'%msvs) - if not msvs: - debug('sdk.py:mssdk_setup_env: no VS version detected, bailingout:%s'%msvs) - return - sdk_version = msvs.sdk_version - debug('sdk.py:msvs.sdk_version is %s'%sdk_version) - if not sdk_version: - return - mssdk = get_sdk_by_version(sdk_version) - if not mssdk: - mssdk = get_default_sdk() - if not mssdk: - return - sdk_dir = mssdk.get_sdk_dir() - debug('sdk.py:mssdk_setup_env: Using MSVS_VERSION:%s'%sdk_dir) - else: - mssdk = get_default_sdk() - if not mssdk: - return - sdk_dir = mssdk.get_sdk_dir() - debug('sdk.py:mssdk_setup_env: not using any env values. sdk_dir:%s'%sdk_dir) - - set_sdk_by_directory(env, sdk_dir) - - #print "No MSVS_VERSION: this is likely to be a bug" - -def mssdk_exists(version=None): - sdks = get_installed_sdks() - if version is None: - return len(sdks) > 0 - return version in sdks - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/vc.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/vc.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/vc.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/vc.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,464 +0,0 @@ -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -# TODO: -# * supported arch for versions: for old versions of batch file without -# argument, giving bogus argument cannot be detected, so we have to hardcode -# this here -# * print warning when msvc version specified but not found -# * find out why warning do not print -# * test on 64 bits XP + VS 2005 (and VS 6 if possible) -# * SDK -# * Assembly -__revision__ = "src/engine/SCons/Tool/MSCommon/vc.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -__doc__ = """Module for Visual C/C++ detection and configuration. -""" -import SCons.compat - -import os -import platform -from string import digits as string_digits - -import SCons.Warnings - -import common - -debug = common.debug - -import sdk - -get_installed_sdks = sdk.get_installed_sdks - - -class VisualCException(Exception): - pass - -class UnsupportedVersion(VisualCException): - pass - -class UnsupportedArch(VisualCException): - pass - -class MissingConfiguration(VisualCException): - pass - -class NoVersionFound(VisualCException): - pass - -class BatchFileExecutionError(VisualCException): - pass - -# Dict to 'canonalize' the arch -_ARCH_TO_CANONICAL = { - "amd64" : "amd64", - "emt64" : "amd64", - "i386" : "x86", - "i486" : "x86", - "i586" : "x86", - "i686" : "x86", - "ia64" : "ia64", - "itanium" : "ia64", - "x86" : "x86", - "x86_64" : "amd64", -} - -# Given a (host, target) tuple, return the argument for the bat file. Both host -# and targets should be canonalized. -_HOST_TARGET_ARCH_TO_BAT_ARCH = { - ("x86", "x86"): "x86", - ("x86", "amd64"): "x86_amd64", - ("amd64", "amd64"): "amd64", - ("amd64", "x86"): "x86", - ("x86", "ia64"): "x86_ia64" -} - -def get_host_target(env): - debug('vc.py:get_host_target()') - - host_platform = env.get('HOST_ARCH') - if not host_platform: - host_platform = platform.machine() - # TODO(2.5): the native Python platform.machine() function returns - # '' on all Python versions before 2.6, after which it also uses - # PROCESSOR_ARCHITECTURE. - if not host_platform: - host_platform = os.environ.get('PROCESSOR_ARCHITECTURE', '') - - # Retain user requested TARGET_ARCH - req_target_platform = env.get('TARGET_ARCH') - debug('vc.py:get_host_target() req_target_platform:%s'%req_target_platform) - - if req_target_platform: - # If user requested a specific platform then only try that one. - target_platform = req_target_platform - else: - target_platform = host_platform - - try: - host = _ARCH_TO_CANONICAL[host_platform.lower()] - except KeyError, e: - msg = "Unrecognized host architecture %s" - raise ValueError(msg % repr(host_platform)) - - try: - target = _ARCH_TO_CANONICAL[target_platform.lower()] - except KeyError, e: - all_archs = str(_ARCH_TO_CANONICAL.keys()) - raise ValueError("Unrecognized target architecture %s\n\tValid architectures: %s" % (target_platform, all_archs)) - - return (host, target,req_target_platform) - -_VCVER = ["11.0", "11.0Exp", "10.0", "10.0Exp", "9.0", "9.0Exp","8.0", "8.0Exp","7.1", "7.0", "6.0"] - -_VCVER_TO_PRODUCT_DIR = { - '11.0': [ - r'Microsoft\VisualStudio\11.0\Setup\VC\ProductDir'], - '11.0Exp' : [ - r'Microsoft\VCExpress\11.0\Setup\VC\ProductDir'], - '10.0': [ - r'Microsoft\VisualStudio\10.0\Setup\VC\ProductDir'], - '10.0Exp' : [ - r'Microsoft\VCExpress\10.0\Setup\VC\ProductDir'], - '9.0': [ - r'Microsoft\VisualStudio\9.0\Setup\VC\ProductDir'], - '9.0Exp' : [ - r'Microsoft\VCExpress\9.0\Setup\VC\ProductDir'], - '8.0': [ - r'Microsoft\VisualStudio\8.0\Setup\VC\ProductDir'], - '8.0Exp': [ - r'Microsoft\VCExpress\8.0\Setup\VC\ProductDir'], - '7.1': [ - r'Microsoft\VisualStudio\7.1\Setup\VC\ProductDir'], - '7.0': [ - r'Microsoft\VisualStudio\7.0\Setup\VC\ProductDir'], - '6.0': [ - r'Microsoft\VisualStudio\6.0\Setup\Microsoft Visual C++\ProductDir'] -} - -def msvc_version_to_maj_min(msvc_version): - msvc_version_numeric = ''.join([x for x in msvc_version if x in string_digits + '.']) - - t = msvc_version_numeric.split(".") - if not len(t) == 2: - raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric)) - try: - maj = int(t[0]) - min = int(t[1]) - return maj, min - except ValueError, e: - raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric)) - -def is_host_target_supported(host_target, msvc_version): - """Return True if the given (host, target) tuple is supported given the - msvc version. - - Parameters - ---------- - host_target: tuple - tuple of (canonalized) host-target, e.g. ("x86", "amd64") for cross - compilation from 32 bits windows to 64 bits. - msvc_version: str - msvc version (major.minor, e.g. 10.0) - - Note - ---- - This only check whether a given version *may* support the given (host, - target), not that the toolchain is actually present on the machine. - """ - # We assume that any Visual Studio version supports x86 as a target - if host_target[1] != "x86": - maj, min = msvc_version_to_maj_min(msvc_version) - if maj < 8: - return False - - return True - -def find_vc_pdir(msvc_version): - """Try to find the product directory for the given - version. - - Note - ---- - If for some reason the requested version could not be found, an - exception which inherits from VisualCException will be raised.""" - root = 'Software\\' - if common.is_win64(): - root = root + 'Wow6432Node\\' - try: - hkeys = _VCVER_TO_PRODUCT_DIR[msvc_version] - except KeyError: - debug("Unknown version of MSVC: %s" % msvc_version) - raise UnsupportedVersion("Unknown version %s" % msvc_version) - - for key in hkeys: - key = root + key - try: - comps = common.read_reg(key) - except WindowsError, e: - debug('find_vc_dir(): no VC registry key %s' % repr(key)) - else: - debug('find_vc_dir(): found VC in registry: %s' % comps) - if os.path.exists(comps): - return comps - else: - debug('find_vc_dir(): reg says dir is %s, but it does not exist. (ignoring)'\ - % comps) - raise MissingConfiguration("registry dir %s not found on the filesystem" % comps) - return None - -def find_batch_file(env,msvc_version,host_arch,target_arch): - """ - Find the location of the batch script which should set up the compiler - for any TARGET_ARCH whose compilers were installed by Visual Studio/VCExpress - """ - pdir = find_vc_pdir(msvc_version) - if pdir is None: - raise NoVersionFound("No version of Visual Studio found") - - debug('vc.py: find_batch_file() pdir:%s'%pdir) - - # filter out e.g. "Exp" from the version name - msvc_ver_numeric = ''.join([x for x in msvc_version if x in string_digits + "."]) - vernum = float(msvc_ver_numeric) - if 7 <= vernum < 8: - pdir = os.path.join(pdir, os.pardir, "Common7", "Tools") - batfilename = os.path.join(pdir, "vsvars32.bat") - elif vernum < 7: - pdir = os.path.join(pdir, "Bin") - batfilename = os.path.join(pdir, "vcvars32.bat") - else: # >= 8 - batfilename = os.path.join(pdir, "vcvarsall.bat") - - if not os.path.exists(batfilename): - debug("Not found: %s" % batfilename) - batfilename = None - - installed_sdks=get_installed_sdks() - for _sdk in installed_sdks: - sdk_bat_file=_sdk.get_sdk_vc_script(host_arch,target_arch) - sdk_bat_file_path=os.path.join(pdir,sdk_bat_file) - debug('vc.py:find_batch_file() sdk_bat_file_path:%s'%sdk_bat_file_path) - if os.path.exists(sdk_bat_file_path): - return (batfilename,sdk_bat_file_path) - else: - debug("vc.py:find_batch_file() not found:%s"%sdk_bat_file_path) - else: - return (batfilename,None) - -__INSTALLED_VCS_RUN = None - -def cached_get_installed_vcs(): - global __INSTALLED_VCS_RUN - - if __INSTALLED_VCS_RUN is None: - ret = get_installed_vcs() - __INSTALLED_VCS_RUN = ret - - return __INSTALLED_VCS_RUN - -def get_installed_vcs(): - installed_versions = [] - for ver in _VCVER: - debug('trying to find VC %s' % ver) - try: - if find_vc_pdir(ver): - debug('found VC %s' % ver) - installed_versions.append(ver) - else: - debug('find_vc_pdir return None for ver %s' % ver) - except VisualCException, e: - debug('did not find VC %s: caught exception %s' % (ver, str(e))) - return installed_versions - -def reset_installed_vcs(): - """Make it try again to find VC. This is just for the tests.""" - __INSTALLED_VCS_RUN = None - -def script_env(script, args=None): - stdout = common.get_output(script, args) - # Stupid batch files do not set return code: we take a look at the - # beginning of the output for an error message instead - olines = stdout.splitlines() - if olines[0].startswith("The specified configuration type is missing"): - raise BatchFileExecutionError("\n".join(olines[:2])) - - return common.parse_output(stdout) - -def get_default_version(env): - debug('get_default_version()') - - msvc_version = env.get('MSVC_VERSION') - msvs_version = env.get('MSVS_VERSION') - - debug('get_default_version(): msvc_version:%s msvs_version:%s'%(msvc_version,msvs_version)) - - if msvs_version and not msvc_version: - SCons.Warnings.warn( - SCons.Warnings.DeprecatedWarning, - "MSVS_VERSION is deprecated: please use MSVC_VERSION instead ") - return msvs_version - elif msvc_version and msvs_version: - if not msvc_version == msvs_version: - SCons.Warnings.warn( - SCons.Warnings.VisualVersionMismatch, - "Requested msvc version (%s) and msvs version (%s) do " \ - "not match: please use MSVC_VERSION only to request a " \ - "visual studio version, MSVS_VERSION is deprecated" \ - % (msvc_version, msvs_version)) - return msvs_version - if not msvc_version: - installed_vcs = cached_get_installed_vcs() - debug('installed_vcs:%s' % installed_vcs) - if not installed_vcs: - #msg = 'No installed VCs' - #debug('msv %s\n' % repr(msg)) - #SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, msg) - debug('msvc_setup_env: No installed VCs') - return None - msvc_version = installed_vcs[0] - debug('msvc_setup_env: using default installed MSVC version %s\n' % repr(msvc_version)) - - return msvc_version - -def msvc_setup_env_once(env): - try: - has_run = env["MSVC_SETUP_RUN"] - except KeyError: - has_run = False - - if not has_run: - msvc_setup_env(env) - env["MSVC_SETUP_RUN"] = True - -def msvc_find_valid_batch_script(env,version): - debug('vc.py:msvc_find_valid_batch_script()') - # Find the host platform, target platform, and if present the requested - # target platform - (host_platform, target_platform,req_target_platform) = get_host_target(env) - - # If the user hasn't specifically requested a TARGET_ARCH, and - # The TARGET_ARCH is amd64 then also try 32 bits if there are no viable - # 64 bit tools installed - try_target_archs = [target_platform] - if not req_target_platform and target_platform in ('amd64','x86_64'): - try_target_archs.append('x86') - - d = None - for tp in try_target_archs: - # Set to current arch. - env['TARGET_ARCH']=tp - - debug("vc.py:msvc_find_valid_batch_script() trying target_platform:%s"%tp) - host_target = (host_platform, tp) - if not is_host_target_supported(host_target, version): - warn_msg = "host, target = %s not supported for MSVC version %s" % \ - (host_target, version) - SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg) - arg = _HOST_TARGET_ARCH_TO_BAT_ARCH[host_target] - - # Try to locate a batch file for this host/target platform combo - try: - (vc_script,sdk_script) = find_batch_file(env,version,host_platform,tp) - debug('vc.py:msvc_find_valid_batch_script() vc_script:%s sdk_script:%s'%(vc_script,sdk_script)) - except VisualCException, e: - msg = str(e) - debug('Caught exception while looking for batch file (%s)' % msg) - warn_msg = "VC version %s not installed. " + \ - "C/C++ compilers are most likely not set correctly.\n" + \ - " Installed versions are: %s" - warn_msg = warn_msg % (version, cached_get_installed_vcs()) - SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg) - continue - - # Try to use the located batch file for this host/target platform combo - debug('vc.py:msvc_find_valid_batch_script() use_script 2 %s, args:%s\n' % (repr(vc_script), arg)) - if vc_script: - try: - d = script_env(vc_script, args=arg) - except BatchFileExecutionError, e: - debug('vc.py:msvc_find_valid_batch_script() use_script 3: failed running VC script %s: %s: Error:%s'%(repr(vc_script),arg,e)) - vc_script=None - if not vc_script and sdk_script: - debug('vc.py:msvc_find_valid_batch_script() use_script 4: trying sdk script: %s'%(sdk_script)) - try: - d = script_env(sdk_script,args=[]) - except BatchFileExecutionError,e: - debug('vc.py:msvc_find_valid_batch_script() use_script 5: failed running SDK script %s: Error:%s'%(repr(sdk_script),e)) - continue - elif not vc_script and not sdk_script: - debug('vc.py:msvc_find_valid_batch_script() use_script 6: Neither VC script nor SDK script found') - continue - - # If we cannot find a viable installed compiler, reset the TARGET_ARCH - # To it's initial value - if not d: - env['TARGET_ARCH']=req_target_platform - - return d - - -def msvc_setup_env(env): - debug('msvc_setup_env()') - - version = get_default_version(env) - if version is None: - warn_msg = "No version of Visual Studio compiler found - C/C++ " \ - "compilers most likely not set correctly" - SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg) - return None - debug('msvc_setup_env: using specified MSVC version %s\n' % repr(version)) - - # XXX: we set-up both MSVS version for backward - # compatibility with the msvs tool - env['MSVC_VERSION'] = version - env['MSVS_VERSION'] = version - env['MSVS'] = {} - - - use_script = env.get('MSVC_USE_SCRIPT', True) - if SCons.Util.is_String(use_script): - debug('vc.py:msvc_setup_env() use_script 1 %s\n' % repr(use_script)) - d = script_env(use_script) - elif use_script: - d = msvc_find_valid_batch_script(env,version) - debug('vc.py:msvc_setup_env() use_script 2 %s\n' % d) - if not d: - return d - else: - debug('MSVC_USE_SCRIPT set to False') - warn_msg = "MSVC_USE_SCRIPT set to False, assuming environment " \ - "set correctly." - SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg) - return None - - for k, v in d.items(): - debug('vc.py:msvc_setup_env() env:%s -> %s'%(k,v)) - env.PrependENVPath(k, v, delete_existing=True) - -def msvc_exists(version=None): - vcs = cached_get_installed_vcs() - if version is None: - return len(vcs) > 0 - return version in vcs - diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/vs.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/vs.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/vs.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/MSCommon/vs.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,553 +0,0 @@ -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/MSCommon/vs.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -__doc__ = """Module to detect Visual Studio and/or Visual C/C++ -""" - -import os - -import SCons.Errors -import SCons.Util - -from common import debug, \ - get_output, \ - is_win64, \ - normalize_env, \ - parse_output, \ - read_reg - -import SCons.Tool.MSCommon.vc - -class VisualStudio(object): - """ - An abstract base class for trying to find installed versions of - Visual Studio. - """ - def __init__(self, version, **kw): - self.version = version - kw['vc_version'] = kw.get('vc_version', version) - kw['sdk_version'] = kw.get('sdk_version', version) - self.__dict__.update(kw) - self._cache = {} - - # - - def find_batch_file(self): - vs_dir = self.get_vs_dir() - if not vs_dir: - debug('find_executable(): no vs_dir') - return None - batch_file = os.path.join(vs_dir, self.batch_file_path) - batch_file = os.path.normpath(batch_file) - if not os.path.isfile(batch_file): - debug('find_batch_file(): %s not on file system' % batch_file) - return None - return batch_file - - def find_vs_dir_by_vc(self): - SCons.Tool.MSCommon.vc.get_installed_vcs() - dir = SCons.Tool.MSCommon.vc.find_vc_pdir(self.vc_version) - if not dir: - debug('find_vs_dir(): no installed VC %s' % self.vc_version) - return None - return dir - - def find_vs_dir_by_reg(self): - root = 'Software\\' - - if is_win64(): - root = root + 'Wow6432Node\\' - for key in self.hkeys: - if key=='use_dir': - return self.find_vs_dir_by_vc() - key = root + key - try: - comps = read_reg(key) - except WindowsError, e: - debug('find_vs_dir_by_reg(): no VS registry key %s' % repr(key)) - else: - debug('find_vs_dir_by_reg(): found VS in registry: %s' % comps) - return comps - return None - - def find_vs_dir(self): - """ Can use registry or location of VC to find vs dir - First try to find by registry, and if that fails find via VC dir - """ - - - if True: - vs_dir=self.find_vs_dir_by_reg() - return vs_dir - else: - return self.find_vs_dir_by_vc() - - def find_executable(self): - vs_dir = self.get_vs_dir() - if not vs_dir: - debug('find_executable(): no vs_dir (%s)'%vs_dir) - return None - executable = os.path.join(vs_dir, self.executable_path) - executable = os.path.normpath(executable) - if not os.path.isfile(executable): - debug('find_executable(): %s not on file system' % executable) - return None - return executable - - # - - def get_batch_file(self): - try: - return self._cache['batch_file'] - except KeyError: - batch_file = self.find_batch_file() - self._cache['batch_file'] = batch_file - return batch_file - - def get_executable(self): - try: - debug('get_executable using cache:%s'%self._cache['executable']) - return self._cache['executable'] - except KeyError: - executable = self.find_executable() - self._cache['executable'] = executable - debug('get_executable not in cache:%s'%executable) - return executable - - def get_vs_dir(self): - try: - return self._cache['vs_dir'] - except KeyError: - vs_dir = self.find_vs_dir() - self._cache['vs_dir'] = vs_dir - return vs_dir - - def get_supported_arch(self): - try: - return self._cache['supported_arch'] - except KeyError: - # RDEVE: for the time being use hardcoded lists - # supported_arch = self.find_supported_arch() - self._cache['supported_arch'] = self.supported_arch - return self.supported_arch - - def reset(self): - self._cache = {} - -# The list of supported Visual Studio versions we know how to detect. -# -# How to look for .bat file ? -# - VS 2008 Express (x86): -# * from registry key productdir, gives the full path to vsvarsall.bat. In -# HKEY_LOCAL_MACHINE): -# Software\Microsoft\VCEpress\9.0\Setup\VC\productdir -# * from environmnent variable VS90COMNTOOLS: the path is then ..\..\VC -# relatively to the path given by the variable. -# -# - VS 2008 Express (WoW6432: 32 bits on windows x64): -# Software\Wow6432Node\Microsoft\VCEpress\9.0\Setup\VC\productdir -# -# - VS 2005 Express (x86): -# * from registry key productdir, gives the full path to vsvarsall.bat. In -# HKEY_LOCAL_MACHINE): -# Software\Microsoft\VCEpress\8.0\Setup\VC\productdir -# * from environmnent variable VS80COMNTOOLS: the path is then ..\..\VC -# relatively to the path given by the variable. -# -# - VS 2005 Express (WoW6432: 32 bits on windows x64): does not seem to have a -# productdir ? -# -# - VS 2003 .Net (pro edition ? x86): -# * from registry key productdir. The path is then ..\Common7\Tools\ -# relatively to the key. The key is in HKEY_LOCAL_MACHINE): -# Software\Microsoft\VisualStudio\7.1\Setup\VC\productdir -# * from environmnent variable VS71COMNTOOLS: the path is the full path to -# vsvars32.bat -# -# - VS 98 (VS 6): -# * from registry key productdir. The path is then Bin -# relatively to the key. The key is in HKEY_LOCAL_MACHINE): -# Software\Microsoft\VisualStudio\6.0\Setup\VC98\productdir -# -# The first version found in the list is the one used by default if -# there are multiple versions installed. Barring good reasons to -# the contrary, this means we should list versions from most recent -# to oldest. Pro versions get listed before Express versions on the -# assumption that, by default, you'd rather use the version you paid -# good money for in preference to whatever Microsoft makes available -# for free. -# -# If you update this list, update the documentation in Tool/msvs.xml. - -SupportedVSList = [ - # Visual Studio 2010 - # TODO: find the settings, perhaps from someone with a CTP copy? - #VisualStudio('TBD', - # hkey_root=r'TBD', - # common_tools_var='TBD', - # executable_path=r'TBD', - # default_dirname='TBD', - #), - - # Visual Studio 11 - # The batch file we look for is in the VC directory, - # so the devenv.com executable is up in ..\..\Common7\IDE. - VisualStudio('11.0', - sdk_version='6.1', - hkeys=[r'Microsoft\VisualStudio\11.0\Setup\VS\ProductDir'], - common_tools_var='VS110COMNTOOLS', - executable_path=r'Common7\IDE\devenv.com', - batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 11', - supported_arch=['x86', 'amd64'], - ), - - # Visual C++ 11 Express Edition - # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. - VisualStudio('11.0Exp', - vc_version='11.0', - sdk_version='6.1', - hkeys=[r'Microsoft\VCExpress\11.0\Setup\VS\ProductDir'], - common_tools_var='VS110COMNTOOLS', - executable_path=r'Common7\IDE\VCExpress.exe', - batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 11', - supported_arch=['x86'], - ), - - # Visual Studio 2010 - # The batch file we look for is in the VC directory, - # so the devenv.com executable is up in ..\..\Common7\IDE. - VisualStudio('10.0', - sdk_version='6.1', - hkeys=[r'Microsoft\VisualStudio\10.0\Setup\VS\ProductDir'], - common_tools_var='VS100COMNTOOLS', - executable_path=r'Common7\IDE\devenv.com', - batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 10', - supported_arch=['x86', 'amd64'], - ), - - # Visual C++ 2010 Express Edition - # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. - VisualStudio('10.0Exp', - vc_version='10.0', - sdk_version='6.1', - hkeys=[r'Microsoft\VCExpress\10.0\Setup\VS\ProductDir'], - common_tools_var='VS100COMNTOOLS', - executable_path=r'Common7\IDE\VCExpress.exe', - batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 10', - supported_arch=['x86'], - ), - - # Visual Studio 2008 - # The batch file we look for is in the VC directory, - # so the devenv.com executable is up in ..\..\Common7\IDE. - VisualStudio('9.0', - sdk_version='6.1', - hkeys=[r'Microsoft\VisualStudio\9.0\Setup\VS\ProductDir'], - common_tools_var='VS90COMNTOOLS', - executable_path=r'Common7\IDE\devenv.com', - batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 9', - supported_arch=['x86', 'amd64'], - ), - - # Visual C++ 2008 Express Edition - # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. - VisualStudio('9.0Exp', - vc_version='9.0', - sdk_version='6.1', - hkeys=[r'Microsoft\VCExpress\9.0\Setup\VS\ProductDir'], - common_tools_var='VS90COMNTOOLS', - executable_path=r'Common7\IDE\VCExpress.exe', - batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 9', - supported_arch=['x86'], - ), - - # Visual Studio 2005 - # The batch file we look for is in the VC directory, - # so the devenv.com executable is up in ..\..\Common7\IDE. - VisualStudio('8.0', - sdk_version='6.0A', - hkeys=[r'Microsoft\VisualStudio\8.0\Setup\VS\ProductDir'], - common_tools_var='VS80COMNTOOLS', - executable_path=r'Common7\IDE\devenv.com', - batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 8', - supported_arch=['x86', 'amd64'], - ), - - # Visual C++ 2005 Express Edition - # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. - VisualStudio('8.0Exp', - vc_version='8.0Exp', - sdk_version='6.0A', - hkeys=[r'Microsoft\VCExpress\8.0\Setup\VS\ProductDir'], - common_tools_var='VS80COMNTOOLS', - executable_path=r'Common7\IDE\VCExpress.exe', - batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 8', - supported_arch=['x86'], - ), - - # Visual Studio .NET 2003 - # The batch file we look for is in the Common7\Tools directory, - # so the devenv.com executable is next door in ..\IDE. - VisualStudio('7.1', - sdk_version='6.0', - hkeys=[r'Microsoft\VisualStudio\7.1\Setup\VS\ProductDir'], - common_tools_var='VS71COMNTOOLS', - executable_path=r'Common7\IDE\devenv.com', - batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio .NET 2003', - supported_arch=['x86'], - ), - - # Visual Studio .NET - # The batch file we look for is in the Common7\Tools directory, - # so the devenv.com executable is next door in ..\IDE. - VisualStudio('7.0', - sdk_version='2003R2', - hkeys=[r'Microsoft\VisualStudio\7.0\Setup\VS\ProductDir'], - common_tools_var='VS70COMNTOOLS', - executable_path=r'IDE\devenv.com', - batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio .NET', - supported_arch=['x86'], - ), - - # Visual Studio 6.0 - VisualStudio('6.0', - sdk_version='2003R1', - hkeys=[r'Microsoft\VisualStudio\6.0\Setup\Microsoft Visual Studio\ProductDir', - 'use_dir'], - common_tools_var='VS60COMNTOOLS', - executable_path=r'Common\MSDev98\Bin\MSDEV.COM', - batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio', - supported_arch=['x86'], - ), -] - -SupportedVSMap = {} -for vs in SupportedVSList: - SupportedVSMap[vs.version] = vs - - -# Finding installed versions of Visual Studio isn't cheap, because it -# goes not only to the registry but also to the disk to sanity-check -# that there is, in fact, a Visual Studio directory there and that the -# registry entry isn't just stale. Find this information once, when -# requested, and cache it. - -InstalledVSList = None -InstalledVSMap = None - -def get_installed_visual_studios(): - global InstalledVSList - global InstalledVSMap - if InstalledVSList is None: - InstalledVSList = [] - InstalledVSMap = {} - for vs in SupportedVSList: - debug('trying to find VS %s' % vs.version) - if vs.get_executable(): - debug('found VS %s' % vs.version) - InstalledVSList.append(vs) - InstalledVSMap[vs.version] = vs - return InstalledVSList - -def reset_installed_visual_studios(): - global InstalledVSList - global InstalledVSMap - InstalledVSList = None - InstalledVSMap = None - for vs in SupportedVSList: - vs.reset() - - # Need to clear installed VC's as well as they are used in finding - # installed VS's - SCons.Tool.MSCommon.vc.reset_installed_vcs() - - -# We may be asked to update multiple construction environments with -# SDK information. When doing this, we check on-disk for whether -# the SDK has 'mfc' and 'atl' subdirectories. Since going to disk -# is expensive, cache results by directory. - -#SDKEnvironmentUpdates = {} -# -#def set_sdk_by_directory(env, sdk_dir): -# global SDKEnvironmentUpdates -# try: -# env_tuple_list = SDKEnvironmentUpdates[sdk_dir] -# except KeyError: -# env_tuple_list = [] -# SDKEnvironmentUpdates[sdk_dir] = env_tuple_list -# -# include_path = os.path.join(sdk_dir, 'include') -# mfc_path = os.path.join(include_path, 'mfc') -# atl_path = os.path.join(include_path, 'atl') -# -# if os.path.exists(mfc_path): -# env_tuple_list.append(('INCLUDE', mfc_path)) -# if os.path.exists(atl_path): -# env_tuple_list.append(('INCLUDE', atl_path)) -# env_tuple_list.append(('INCLUDE', include_path)) -# -# env_tuple_list.append(('LIB', os.path.join(sdk_dir, 'lib'))) -# env_tuple_list.append(('LIBPATH', os.path.join(sdk_dir, 'lib'))) -# env_tuple_list.append(('PATH', os.path.join(sdk_dir, 'bin'))) -# -# for variable, directory in env_tuple_list: -# env.PrependENVPath(variable, directory) - -def msvs_exists(): - return (len(get_installed_visual_studios()) > 0) - -def get_vs_by_version(msvs): - global InstalledVSMap - global SupportedVSMap - - debug('vs.py:get_vs_by_version()') - if msvs not in SupportedVSMap: - msg = "Visual Studio version %s is not supported" % repr(msvs) - raise SCons.Errors.UserError(msg) - get_installed_visual_studios() - vs = InstalledVSMap.get(msvs) - debug('InstalledVSMap:%s'%InstalledVSMap) - debug('vs.py:get_vs_by_version: found vs:%s'%vs) - # Some check like this would let us provide a useful error message - # if they try to set a Visual Studio version that's not installed. - # However, we also want to be able to run tests (like the unit - # tests) on systems that don't, or won't ever, have it installed. - # It might be worth resurrecting this, with some configurable - # setting that the tests can use to bypass the check. - #if not vs: - # msg = "Visual Studio version %s is not installed" % repr(msvs) - # raise SCons.Errors.UserError, msg - return vs - -def get_default_version(env): - """Returns the default version string to use for MSVS. - - If no version was requested by the user through the MSVS environment - variable, query all the available the visual studios through - query_versions, and take the highest one. - - Return - ------ - version: str - the default version. - """ - if 'MSVS' not in env or not SCons.Util.is_Dict(env['MSVS']): - versions = [vs.version for vs in get_installed_visual_studios()] - env['MSVS'] = {'VERSIONS' : versions} - else: - versions = env['MSVS'].get('VERSIONS', []) - - if 'MSVS_VERSION' not in env: - if versions: - env['MSVS_VERSION'] = versions[0] #use highest version by default - else: - env['MSVS_VERSION'] = SupportedVSList[0].version - - env['MSVS']['VERSION'] = env['MSVS_VERSION'] - - return env['MSVS_VERSION'] - -def get_default_arch(env): - """Return the default arch to use for MSVS - - if no version was requested by the user through the MSVS_ARCH environment - variable, select x86 - - Return - ------ - arch: str - """ - arch = env.get('MSVS_ARCH', 'x86') - - msvs = InstalledVSMap.get(env['MSVS_VERSION']) - - if not msvs: - arch = 'x86' - elif not arch in msvs.get_supported_arch(): - fmt = "Visual Studio version %s does not support architecture %s" - raise SCons.Errors.UserError(fmt % (env['MSVS_VERSION'], arch)) - - return arch - -def merge_default_version(env): - version = get_default_version(env) - arch = get_default_arch(env) - -def msvs_setup_env(env): - batfilename = msvs.get_batch_file() - msvs = get_vs_by_version(version) - if msvs is None: - return - - # XXX: I think this is broken. This will silently set a bogus tool instead - # of failing, but there is no other way with the current scons tool - # framework - if batfilename is not None: - - vars = ('LIB', 'LIBPATH', 'PATH', 'INCLUDE') - - msvs_list = get_installed_visual_studios() - vscommonvarnames = [vs.common_tools_var for vs in msvs_list] - save_ENV = env['ENV'] - nenv = normalize_env(env['ENV'], - ['COMSPEC'] + vscommonvarnames, - force=True) - try: - output = get_output(batfilename, arch, env=nenv) - finally: - env['ENV'] = save_ENV - vars = parse_output(output, vars) - - for k, v in vars.items(): - env.PrependENVPath(k, v, delete_existing=1) - -def query_versions(): - """Query the system to get available versions of VS. A version is - considered when a batfile is found.""" - msvs_list = get_installed_visual_studios() - versions = [msvs.version for msvs in msvs_list] - return versions - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/Perforce.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/Perforce.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/Perforce.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/Perforce.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -"""SCons.Tool.Perforce.py - -Tool-specific initialization for Perforce Source Code Management system. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/Perforce.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os - -import SCons.Action -import SCons.Builder -import SCons.Node.FS -import SCons.Util - -# This function should maybe be moved to SCons.Util? -from SCons.Tool.PharLapCommon import addPathIfNotExists - - -# Variables that we want to import from the base OS environment. -_import_env = [ 'P4PORT', 'P4CLIENT', 'P4USER', 'USER', 'USERNAME', 'P4PASSWD', - 'P4CHARSET', 'P4LANGUAGE', 'SystemRoot' ] - -PerforceAction = SCons.Action.Action('$P4COM', '$P4COMSTR') - -def generate(env): - """Add a Builder factory function and construction variables for - Perforce to an Environment.""" - - def PerforceFactory(env=env): - """ """ - import SCons.Warnings as W - W.warn(W.DeprecatedSourceCodeWarning, """The Perforce() factory is deprecated and there is no replacement.""") - return SCons.Builder.Builder(action = PerforceAction, env = env) - - #setattr(env, 'Perforce', PerforceFactory) - env.Perforce = PerforceFactory - - env['P4'] = 'p4' - env['P4FLAGS'] = SCons.Util.CLVar('') - env['P4COM'] = '$P4 $P4FLAGS sync $TARGET' - try: - environ = env['ENV'] - except KeyError: - environ = {} - env['ENV'] = environ - - # Perforce seems to use the PWD environment variable rather than - # calling getcwd() for itself, which is odd. If no PWD variable - # is present, p4 WILL call getcwd, but this seems to cause problems - # with good ol' Windows's tilde-mangling for long file names. - environ['PWD'] = env.Dir('#').get_abspath() - - for var in _import_env: - v = os.environ.get(var) - if v: - environ[var] = v - - if SCons.Util.can_read_reg: - # If we can read the registry, add the path to Perforce to our environment. - try: - k=SCons.Util.RegOpenKeyEx(SCons.Util.hkey_mod.HKEY_LOCAL_MACHINE, - 'Software\\Perforce\\environment') - val, tok = SCons.Util.RegQueryValueEx(k, 'P4INSTROOT') - addPathIfNotExists(environ, 'PATH', val) - except SCons.Util.RegError: - # Can't detect where Perforce is, hope the user has it set in the - # PATH. - pass - -def exists(env): - return env.Detect('p4') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/PharLapCommon.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/PharLapCommon.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/PharLapCommon.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/PharLapCommon.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,137 +0,0 @@ -"""SCons.Tool.PharLapCommon - -This module contains common code used by all Tools for the -Phar Lap ETS tool chain. Right now, this is linkloc and -386asm. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/PharLapCommon.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os -import os.path -import SCons.Errors -import SCons.Util -import re - -def getPharLapPath(): - """Reads the registry to find the installed path of the Phar Lap ETS - development kit. - - Raises UserError if no installed version of Phar Lap can - be found.""" - - if not SCons.Util.can_read_reg: - raise SCons.Errors.InternalError("No Windows registry module was found") - try: - k=SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, - 'SOFTWARE\\Pharlap\\ETS') - val, type = SCons.Util.RegQueryValueEx(k, 'BaseDir') - - # The following is a hack...there is (not surprisingly) - # an odd issue in the Phar Lap plug in that inserts - # a bunch of junk data after the phar lap path in the - # registry. We must trim it. - idx=val.find('\0') - if idx >= 0: - val = val[:idx] - - return os.path.normpath(val) - except SCons.Util.RegError: - raise SCons.Errors.UserError("Cannot find Phar Lap ETS path in the registry. Is it installed properly?") - -REGEX_ETS_VER = re.compile(r'#define\s+ETS_VER\s+([0-9]+)') - -def getPharLapVersion(): - """Returns the version of the installed ETS Tool Suite as a - decimal number. This version comes from the ETS_VER #define in - the embkern.h header. For example, '#define ETS_VER 1010' (which - is what Phar Lap 10.1 defines) would cause this method to return - 1010. Phar Lap 9.1 does not have such a #define, but this method - will return 910 as a default. - - Raises UserError if no installed version of Phar Lap can - be found.""" - - include_path = os.path.join(getPharLapPath(), os.path.normpath("include/embkern.h")) - if not os.path.exists(include_path): - raise SCons.Errors.UserError("Cannot find embkern.h in ETS include directory.\nIs Phar Lap ETS installed properly?") - mo = REGEX_ETS_VER.search(open(include_path, 'r').read()) - if mo: - return int(mo.group(1)) - # Default return for Phar Lap 9.1 - return 910 - -def addPathIfNotExists(env_dict, key, path, sep=os.pathsep): - """This function will take 'key' out of the dictionary - 'env_dict', then add the path 'path' to that key if it is not - already there. This treats the value of env_dict[key] as if it - has a similar format to the PATH variable...a list of paths - separated by tokens. The 'path' will get added to the list if it - is not already there.""" - try: - is_list = 1 - paths = env_dict[key] - if not SCons.Util.is_List(env_dict[key]): - paths = paths.split(sep) - is_list = 0 - if os.path.normcase(path) not in list(map(os.path.normcase, paths)): - paths = [ path ] + paths - if is_list: - env_dict[key] = paths - else: - env_dict[key] = sep.join(paths) - except KeyError: - env_dict[key] = path - -def addPharLapPaths(env): - """This function adds the path to the Phar Lap binaries, includes, - and libraries, if they are not already there.""" - ph_path = getPharLapPath() - - try: - env_dict = env['ENV'] - except KeyError: - env_dict = {} - env['ENV'] = env_dict - addPathIfNotExists(env_dict, 'PATH', - os.path.join(ph_path, 'bin')) - addPathIfNotExists(env_dict, 'INCLUDE', - os.path.join(ph_path, 'include')) - addPathIfNotExists(env_dict, 'LIB', - os.path.join(ph_path, 'lib')) - addPathIfNotExists(env_dict, 'LIB', - os.path.join(ph_path, os.path.normpath('lib/vclib'))) - - env['PHARLAP_PATH'] = getPharLapPath() - env['PHARLAP_VERSION'] = str(getPharLapVersion()) - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/RCS.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/RCS.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/RCS.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/RCS.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -"""SCons.Tool.RCS.py - -Tool-specific initialization for RCS. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/RCS.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Action -import SCons.Builder -import SCons.Util - -def generate(env): - """Add a Builder factory function and construction variables for - RCS to an Environment.""" - - def RCSFactory(env=env): - """ """ - import SCons.Warnings as W - W.warn(W.DeprecatedSourceCodeWarning, """The RCS() factory is deprecated and there is no replacement.""") - act = SCons.Action.Action('$RCS_COCOM', '$RCS_COCOMSTR') - return SCons.Builder.Builder(action = act, env = env) - - #setattr(env, 'RCS', RCSFactory) - env.RCS = RCSFactory - - env['RCS'] = 'rcs' - env['RCS_CO'] = 'co' - env['RCS_COFLAGS'] = SCons.Util.CLVar('') - env['RCS_COCOM'] = '$RCS_CO $RCS_COFLAGS $TARGET' - -def exists(env): - return env.Detect('rcs') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/SCCS.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/SCCS.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/SCCS.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/SCCS.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -"""SCons.Tool.SCCS.py - -Tool-specific initialization for SCCS. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/SCCS.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Action -import SCons.Builder -import SCons.Util - -def generate(env): - """Add a Builder factory function and construction variables for - SCCS to an Environment.""" - - def SCCSFactory(env=env): - """ """ - import SCons.Warnings as W - W.warn(W.DeprecatedSourceCodeWarning, """The SCCS() factory is deprecated and there is no replacement.""") - act = SCons.Action.Action('$SCCSCOM', '$SCCSCOMSTR') - return SCons.Builder.Builder(action = act, env = env) - - #setattr(env, 'SCCS', SCCSFactory) - env.SCCS = SCCSFactory - - env['SCCS'] = 'sccs' - env['SCCSFLAGS'] = SCons.Util.CLVar('') - env['SCCSGETFLAGS'] = SCons.Util.CLVar('') - env['SCCSCOM'] = '$SCCS $SCCSFLAGS get $SCCSGETFLAGS $TARGET' - -def exists(env): - return env.Detect('sccs') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/Subversion.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/Subversion.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/Subversion.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/Subversion.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -"""SCons.Tool.Subversion.py - -Tool-specific initialization for Subversion. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/Subversion.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path - -import SCons.Action -import SCons.Builder -import SCons.Util - -def generate(env): - """Add a Builder factory function and construction variables for - Subversion to an Environment.""" - - def SubversionFactory(repos, module='', env=env): - """ """ - # fail if repos is not an absolute path name? - import SCons.Warnings as W - W.warn(W.DeprecatedSourceCodeWarning, """The Subversion() factory is deprecated and there is no replacement.""") - if module != '': - module = os.path.join(module, '') - act = SCons.Action.Action('$SVNCOM', '$SVNCOMSTR') - return SCons.Builder.Builder(action = act, - env = env, - SVNREPOSITORY = repos, - SVNMODULE = module) - - #setattr(env, 'Subversion', SubversionFactory) - env.Subversion = SubversionFactory - - env['SVN'] = 'svn' - env['SVNFLAGS'] = SCons.Util.CLVar('') - env['SVNCOM'] = '$SVN $SVNFLAGS cat $SVNREPOSITORY/$SVNMODULE$TARGET > $TARGET' - -def exists(env): - return env.Detect('svn') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/__init__.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/__init__.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/__init__.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,681 +0,0 @@ -"""SCons.Tool - -SCons tool selection. - -This looks for modules that define a callable object that can modify -a construction environment as appropriate for a given tool (or tool -chain). - -Note that because this subsystem just *selects* a callable that can -modify a construction environment, it's possible for people to define -their own "tool specification" in an arbitrary callable function. No -one needs to use or tie in to this subsystem in order to roll their own -tool definition. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/__init__.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import imp -import sys - -import SCons.Builder -import SCons.Errors -import SCons.Node.FS -import SCons.Scanner -import SCons.Scanner.C -import SCons.Scanner.D -import SCons.Scanner.LaTeX -import SCons.Scanner.Prog - -DefaultToolpath=[] - -CScanner = SCons.Scanner.C.CScanner() -DScanner = SCons.Scanner.D.DScanner() -LaTeXScanner = SCons.Scanner.LaTeX.LaTeXScanner() -PDFLaTeXScanner = SCons.Scanner.LaTeX.PDFLaTeXScanner() -ProgramScanner = SCons.Scanner.Prog.ProgramScanner() -SourceFileScanner = SCons.Scanner.Base({}, name='SourceFileScanner') - -CSuffixes = [".c", ".C", ".cxx", ".cpp", ".c++", ".cc", - ".h", ".H", ".hxx", ".hpp", ".hh", - ".F", ".fpp", ".FPP", - ".m", ".mm", - ".S", ".spp", ".SPP", ".sx"] - -DSuffixes = ['.d'] - -IDLSuffixes = [".idl", ".IDL"] - -LaTeXSuffixes = [".tex", ".ltx", ".latex"] - -for suffix in CSuffixes: - SourceFileScanner.add_scanner(suffix, CScanner) - -for suffix in DSuffixes: - SourceFileScanner.add_scanner(suffix, DScanner) - -# FIXME: what should be done here? Two scanners scan the same extensions, -# but look for different files, e.g., "picture.eps" vs. "picture.pdf". -# The builders for DVI and PDF explicitly reference their scanners -# I think that means this is not needed??? -for suffix in LaTeXSuffixes: - SourceFileScanner.add_scanner(suffix, LaTeXScanner) - SourceFileScanner.add_scanner(suffix, PDFLaTeXScanner) - -class Tool(object): - def __init__(self, name, toolpath=[], **kw): - self.name = name - self.toolpath = toolpath + DefaultToolpath - # remember these so we can merge them into the call - self.init_kw = kw - - module = self._tool_module() - self.generate = module.generate - self.exists = module.exists - if hasattr(module, 'options'): - self.options = module.options - - def _tool_module(self): - # TODO: Interchange zipimport with normal initilization for better error reporting - oldpythonpath = sys.path - sys.path = self.toolpath + sys.path - - try: - try: - file, path, desc = imp.find_module(self.name, self.toolpath) - try: - return imp.load_module(self.name, file, path, desc) - finally: - if file: - file.close() - except ImportError, e: - if str(e)!="No module named %s"%self.name: - raise SCons.Errors.EnvironmentError(e) - try: - import zipimport - except ImportError: - pass - else: - for aPath in self.toolpath: - try: - importer = zipimport.zipimporter(aPath) - return importer.load_module(self.name) - except ImportError, e: - pass - finally: - sys.path = oldpythonpath - - full_name = 'SCons.Tool.' + self.name - try: - return sys.modules[full_name] - except KeyError: - try: - smpath = sys.modules['SCons.Tool'].__path__ - try: - file, path, desc = imp.find_module(self.name, smpath) - module = imp.load_module(full_name, file, path, desc) - setattr(SCons.Tool, self.name, module) - if file: - file.close() - return module - except ImportError, e: - if str(e)!="No module named %s"%self.name: - raise SCons.Errors.EnvironmentError(e) - try: - import zipimport - importer = zipimport.zipimporter( sys.modules['SCons.Tool'].__path__[0] ) - module = importer.load_module(full_name) - setattr(SCons.Tool, self.name, module) - return module - except ImportError, e: - m = "No tool named '%s': %s" % (self.name, e) - raise SCons.Errors.EnvironmentError(m) - except ImportError, e: - m = "No tool named '%s': %s" % (self.name, e) - raise SCons.Errors.EnvironmentError(m) - - def __call__(self, env, *args, **kw): - if self.init_kw is not None: - # Merge call kws into init kws; - # but don't bash self.init_kw. - if kw is not None: - call_kw = kw - kw = self.init_kw.copy() - kw.update(call_kw) - else: - kw = self.init_kw - env.Append(TOOLS = [ self.name ]) - if hasattr(self, 'options'): - import SCons.Variables - if 'options' not in env: - from SCons.Script import ARGUMENTS - env['options']=SCons.Variables.Variables(args=ARGUMENTS) - opts=env['options'] - - self.options(opts) - opts.Update(env) - - self.generate(env, *args, **kw) - - def __str__(self): - return self.name - -########################################################################## -# Create common executable program / library / object builders - -def createProgBuilder(env): - """This is a utility function that creates the Program - Builder in an Environment if it is not there already. - - If it is already there, we return the existing one. - """ - - try: - program = env['BUILDERS']['Program'] - except KeyError: - import SCons.Defaults - program = SCons.Builder.Builder(action = SCons.Defaults.LinkAction, - emitter = '$PROGEMITTER', - prefix = '$PROGPREFIX', - suffix = '$PROGSUFFIX', - src_suffix = '$OBJSUFFIX', - src_builder = 'Object', - target_scanner = ProgramScanner) - env['BUILDERS']['Program'] = program - - return program - -def createStaticLibBuilder(env): - """This is a utility function that creates the StaticLibrary - Builder in an Environment if it is not there already. - - If it is already there, we return the existing one. - """ - - try: - static_lib = env['BUILDERS']['StaticLibrary'] - except KeyError: - action_list = [ SCons.Action.Action("$ARCOM", "$ARCOMSTR") ] - if env.Detect('ranlib'): - ranlib_action = SCons.Action.Action("$RANLIBCOM", "$RANLIBCOMSTR") - action_list.append(ranlib_action) - - static_lib = SCons.Builder.Builder(action = action_list, - emitter = '$LIBEMITTER', - prefix = '$LIBPREFIX', - suffix = '$LIBSUFFIX', - src_suffix = '$OBJSUFFIX', - src_builder = 'StaticObject') - env['BUILDERS']['StaticLibrary'] = static_lib - env['BUILDERS']['Library'] = static_lib - - return static_lib - -def createSharedLibBuilder(env): - """This is a utility function that creates the SharedLibrary - Builder in an Environment if it is not there already. - - If it is already there, we return the existing one. - """ - - try: - shared_lib = env['BUILDERS']['SharedLibrary'] - except KeyError: - import SCons.Defaults - action_list = [ SCons.Defaults.SharedCheck, - SCons.Defaults.ShLinkAction ] - shared_lib = SCons.Builder.Builder(action = action_list, - emitter = "$SHLIBEMITTER", - prefix = '$SHLIBPREFIX', - suffix = '$SHLIBSUFFIX', - target_scanner = ProgramScanner, - src_suffix = '$SHOBJSUFFIX', - src_builder = 'SharedObject') - env['BUILDERS']['SharedLibrary'] = shared_lib - - return shared_lib - -def createLoadableModuleBuilder(env): - """This is a utility function that creates the LoadableModule - Builder in an Environment if it is not there already. - - If it is already there, we return the existing one. - """ - - try: - ld_module = env['BUILDERS']['LoadableModule'] - except KeyError: - import SCons.Defaults - action_list = [ SCons.Defaults.SharedCheck, - SCons.Defaults.LdModuleLinkAction ] - ld_module = SCons.Builder.Builder(action = action_list, - emitter = "$LDMODULEEMITTER", - prefix = '$LDMODULEPREFIX', - suffix = '$LDMODULESUFFIX', - target_scanner = ProgramScanner, - src_suffix = '$SHOBJSUFFIX', - src_builder = 'SharedObject') - env['BUILDERS']['LoadableModule'] = ld_module - - return ld_module - -def createObjBuilders(env): - """This is a utility function that creates the StaticObject - and SharedObject Builders in an Environment if they - are not there already. - - If they are there already, we return the existing ones. - - This is a separate function because soooo many Tools - use this functionality. - - The return is a 2-tuple of (StaticObject, SharedObject) - """ - - - try: - static_obj = env['BUILDERS']['StaticObject'] - except KeyError: - static_obj = SCons.Builder.Builder(action = {}, - emitter = {}, - prefix = '$OBJPREFIX', - suffix = '$OBJSUFFIX', - src_builder = ['CFile', 'CXXFile'], - source_scanner = SourceFileScanner, - single_source = 1) - env['BUILDERS']['StaticObject'] = static_obj - env['BUILDERS']['Object'] = static_obj - - try: - shared_obj = env['BUILDERS']['SharedObject'] - except KeyError: - shared_obj = SCons.Builder.Builder(action = {}, - emitter = {}, - prefix = '$SHOBJPREFIX', - suffix = '$SHOBJSUFFIX', - src_builder = ['CFile', 'CXXFile'], - source_scanner = SourceFileScanner, - single_source = 1) - env['BUILDERS']['SharedObject'] = shared_obj - - return (static_obj, shared_obj) - -def createCFileBuilders(env): - """This is a utility function that creates the CFile/CXXFile - Builders in an Environment if they - are not there already. - - If they are there already, we return the existing ones. - - This is a separate function because soooo many Tools - use this functionality. - - The return is a 2-tuple of (CFile, CXXFile) - """ - - try: - c_file = env['BUILDERS']['CFile'] - except KeyError: - c_file = SCons.Builder.Builder(action = {}, - emitter = {}, - suffix = {None:'$CFILESUFFIX'}) - env['BUILDERS']['CFile'] = c_file - - env.SetDefault(CFILESUFFIX = '.c') - - try: - cxx_file = env['BUILDERS']['CXXFile'] - except KeyError: - cxx_file = SCons.Builder.Builder(action = {}, - emitter = {}, - suffix = {None:'$CXXFILESUFFIX'}) - env['BUILDERS']['CXXFile'] = cxx_file - env.SetDefault(CXXFILESUFFIX = '.cc') - - return (c_file, cxx_file) - -########################################################################## -# Create common Java builders - -def CreateJarBuilder(env): - try: - java_jar = env['BUILDERS']['Jar'] - except KeyError: - fs = SCons.Node.FS.get_default_fs() - jar_com = SCons.Action.Action('$JARCOM', '$JARCOMSTR') - java_jar = SCons.Builder.Builder(action = jar_com, - suffix = '$JARSUFFIX', - src_suffix = '$JAVACLASSSUFIX', - src_builder = 'JavaClassFile', - source_factory = fs.Entry) - env['BUILDERS']['Jar'] = java_jar - return java_jar - -def CreateJavaHBuilder(env): - try: - java_javah = env['BUILDERS']['JavaH'] - except KeyError: - fs = SCons.Node.FS.get_default_fs() - java_javah_com = SCons.Action.Action('$JAVAHCOM', '$JAVAHCOMSTR') - java_javah = SCons.Builder.Builder(action = java_javah_com, - src_suffix = '$JAVACLASSSUFFIX', - target_factory = fs.Entry, - source_factory = fs.File, - src_builder = 'JavaClassFile') - env['BUILDERS']['JavaH'] = java_javah - return java_javah - -def CreateJavaClassFileBuilder(env): - try: - java_class_file = env['BUILDERS']['JavaClassFile'] - except KeyError: - fs = SCons.Node.FS.get_default_fs() - javac_com = SCons.Action.Action('$JAVACCOM', '$JAVACCOMSTR') - java_class_file = SCons.Builder.Builder(action = javac_com, - emitter = {}, - #suffix = '$JAVACLASSSUFFIX', - src_suffix = '$JAVASUFFIX', - src_builder = ['JavaFile'], - target_factory = fs.Entry, - source_factory = fs.File) - env['BUILDERS']['JavaClassFile'] = java_class_file - return java_class_file - -def CreateJavaClassDirBuilder(env): - try: - java_class_dir = env['BUILDERS']['JavaClassDir'] - except KeyError: - fs = SCons.Node.FS.get_default_fs() - javac_com = SCons.Action.Action('$JAVACCOM', '$JAVACCOMSTR') - java_class_dir = SCons.Builder.Builder(action = javac_com, - emitter = {}, - target_factory = fs.Dir, - source_factory = fs.Dir) - env['BUILDERS']['JavaClassDir'] = java_class_dir - return java_class_dir - -def CreateJavaFileBuilder(env): - try: - java_file = env['BUILDERS']['JavaFile'] - except KeyError: - java_file = SCons.Builder.Builder(action = {}, - emitter = {}, - suffix = {None:'$JAVASUFFIX'}) - env['BUILDERS']['JavaFile'] = java_file - env['JAVASUFFIX'] = '.java' - return java_file - -class ToolInitializerMethod(object): - """ - This is added to a construction environment in place of a - method(s) normally called for a Builder (env.Object, env.StaticObject, - etc.). When called, it has its associated ToolInitializer - object search the specified list of tools and apply the first - one that exists to the construction environment. It then calls - whatever builder was (presumably) added to the construction - environment in place of this particular instance. - """ - def __init__(self, name, initializer): - """ - Note: we store the tool name as __name__ so it can be used by - the class that attaches this to a construction environment. - """ - self.__name__ = name - self.initializer = initializer - - def get_builder(self, env): - """ - Returns the appropriate real Builder for this method name - after having the associated ToolInitializer object apply - the appropriate Tool module. - """ - builder = getattr(env, self.__name__) - - self.initializer.apply_tools(env) - - builder = getattr(env, self.__name__) - if builder is self: - # There was no Builder added, which means no valid Tool - # for this name was found (or possibly there's a mismatch - # between the name we were called by and the Builder name - # added by the Tool module). - return None - - self.initializer.remove_methods(env) - - return builder - - def __call__(self, env, *args, **kw): - """ - """ - builder = self.get_builder(env) - if builder is None: - return [], [] - return builder(*args, **kw) - -class ToolInitializer(object): - """ - A class for delayed initialization of Tools modules. - - Instances of this class associate a list of Tool modules with - a list of Builder method names that will be added by those Tool - modules. As part of instantiating this object for a particular - construction environment, we also add the appropriate - ToolInitializerMethod objects for the various Builder methods - that we want to use to delay Tool searches until necessary. - """ - def __init__(self, env, tools, names): - if not SCons.Util.is_List(tools): - tools = [tools] - if not SCons.Util.is_List(names): - names = [names] - self.env = env - self.tools = tools - self.names = names - self.methods = {} - for name in names: - method = ToolInitializerMethod(name, self) - self.methods[name] = method - env.AddMethod(method) - - def remove_methods(self, env): - """ - Removes the methods that were added by the tool initialization - so we no longer copy and re-bind them when the construction - environment gets cloned. - """ - for method in self.methods.values(): - env.RemoveMethod(method) - - def apply_tools(self, env): - """ - Searches the list of associated Tool modules for one that - exists, and applies that to the construction environment. - """ - for t in self.tools: - tool = SCons.Tool.Tool(t) - if tool.exists(env): - env.Tool(tool) - return - - # If we fall through here, there was no tool module found. - # This is where we can put an informative error message - # about the inability to find the tool. We'll start doing - # this as we cut over more pre-defined Builder+Tools to use - # the ToolInitializer class. - -def Initializers(env): - ToolInitializer(env, ['install'], ['_InternalInstall', '_InternalInstallAs']) - def Install(self, *args, **kw): - return self._InternalInstall(*args, **kw) - def InstallAs(self, *args, **kw): - return self._InternalInstallAs(*args, **kw) - env.AddMethod(Install) - env.AddMethod(InstallAs) - -def FindTool(tools, env): - for tool in tools: - t = Tool(tool) - if t.exists(env): - return tool - return None - -def FindAllTools(tools, env): - def ToolExists(tool, env=env): - return Tool(tool).exists(env) - return list(filter (ToolExists, tools)) - -def tool_list(platform, env): - - other_plat_tools=[] - # XXX this logic about what tool to prefer on which platform - # should be moved into either the platform files or - # the tool files themselves. - # The search orders here are described in the man page. If you - # change these search orders, update the man page as well. - if str(platform) == 'win32': - "prefer Microsoft tools on Windows" - linkers = ['mslink', 'gnulink', 'ilink', 'linkloc', 'ilink32' ] - c_compilers = ['msvc', 'mingw', 'gcc', 'intelc', 'icl', 'icc', 'cc', 'bcc32' ] - cxx_compilers = ['msvc', 'intelc', 'icc', 'g++', 'c++', 'bcc32' ] - assemblers = ['masm', 'nasm', 'gas', '386asm' ] - fortran_compilers = ['gfortran', 'g77', 'ifl', 'cvf', 'f95', 'f90', 'fortran'] - ars = ['mslib', 'ar', 'tlib'] - other_plat_tools=['msvs','midl'] - elif str(platform) == 'os2': - "prefer IBM tools on OS/2" - linkers = ['ilink', 'gnulink', ]#'mslink'] - c_compilers = ['icc', 'gcc',]# 'msvc', 'cc'] - cxx_compilers = ['icc', 'g++',]# 'msvc', 'c++'] - assemblers = ['nasm',]# 'masm', 'gas'] - fortran_compilers = ['ifl', 'g77'] - ars = ['ar',]# 'mslib'] - elif str(platform) == 'irix': - "prefer MIPSPro on IRIX" - linkers = ['sgilink', 'gnulink'] - c_compilers = ['sgicc', 'gcc', 'cc'] - cxx_compilers = ['sgic++', 'g++', 'c++'] - assemblers = ['as', 'gas'] - fortran_compilers = ['f95', 'f90', 'f77', 'g77', 'fortran'] - ars = ['sgiar'] - elif str(platform) == 'sunos': - "prefer Forte tools on SunOS" - linkers = ['sunlink', 'gnulink'] - c_compilers = ['suncc', 'gcc', 'cc'] - cxx_compilers = ['sunc++', 'g++', 'c++'] - assemblers = ['as', 'gas'] - fortran_compilers = ['sunf95', 'sunf90', 'sunf77', 'f95', 'f90', 'f77', - 'gfortran', 'g77', 'fortran'] - ars = ['sunar'] - elif str(platform) == 'hpux': - "prefer aCC tools on HP-UX" - linkers = ['hplink', 'gnulink'] - c_compilers = ['hpcc', 'gcc', 'cc'] - cxx_compilers = ['hpc++', 'g++', 'c++'] - assemblers = ['as', 'gas'] - fortran_compilers = ['f95', 'f90', 'f77', 'g77', 'fortran'] - ars = ['ar'] - elif str(platform) == 'aix': - "prefer AIX Visual Age tools on AIX" - linkers = ['aixlink', 'gnulink'] - c_compilers = ['aixcc', 'gcc', 'cc'] - cxx_compilers = ['aixc++', 'g++', 'c++'] - assemblers = ['as', 'gas'] - fortran_compilers = ['f95', 'f90', 'aixf77', 'g77', 'fortran'] - ars = ['ar'] - elif str(platform) == 'darwin': - "prefer GNU tools on Mac OS X, except for some linkers and IBM tools" - linkers = ['applelink', 'gnulink'] - c_compilers = ['gcc', 'cc'] - cxx_compilers = ['g++', 'c++'] - assemblers = ['as'] - fortran_compilers = ['gfortran', 'f95', 'f90', 'g77'] - ars = ['ar'] - else: - "prefer GNU tools on all other platforms" - linkers = ['gnulink', 'mslink', 'ilink'] - c_compilers = ['gcc', 'msvc', 'intelc', 'icc', 'cc'] - cxx_compilers = ['g++', 'msvc', 'intelc', 'icc', 'c++'] - assemblers = ['gas', 'nasm', 'masm'] - fortran_compilers = ['gfortran', 'g77', 'ifort', 'ifl', 'f95', 'f90', 'f77'] - ars = ['ar', 'mslib'] - - c_compiler = FindTool(c_compilers, env) or c_compilers[0] - - # XXX this logic about what tool provides what should somehow be - # moved into the tool files themselves. - if c_compiler and c_compiler == 'mingw': - # MinGW contains a linker, C compiler, C++ compiler, - # Fortran compiler, archiver and assembler: - cxx_compiler = None - linker = None - assembler = None - fortran_compiler = None - ar = None - else: - # Don't use g++ if the C compiler has built-in C++ support: - if c_compiler in ('msvc', 'intelc', 'icc'): - cxx_compiler = None - else: - cxx_compiler = FindTool(cxx_compilers, env) or cxx_compilers[0] - linker = FindTool(linkers, env) or linkers[0] - assembler = FindTool(assemblers, env) or assemblers[0] - fortran_compiler = FindTool(fortran_compilers, env) or fortran_compilers[0] - ar = FindTool(ars, env) or ars[0] - - other_tools = FindAllTools(other_plat_tools + [ - 'dmd', - #TODO: merge 'install' into 'filesystem' and - # make 'filesystem' the default - 'filesystem', - 'm4', - 'wix', #'midl', 'msvs', - # Parser generators - 'lex', 'yacc', - # Foreign function interface - 'rpcgen', 'swig', - # Java - 'jar', 'javac', 'javah', 'rmic', - # TeX - 'dvipdf', 'dvips', 'gs', - 'tex', 'latex', 'pdflatex', 'pdftex', - # Archivers - 'tar', 'zip', 'rpm', - # SourceCode factories - 'BitKeeper', 'CVS', 'Perforce', - 'RCS', 'SCCS', # 'Subversion', - ], env) - - tools = ([linker, c_compiler, cxx_compiler, - fortran_compiler, assembler, ar] - + other_tools) - - return [x for x in tools if x] - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/aixc++.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/aixc++.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/aixc++.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/aixc++.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -"""SCons.Tool.aixc++ - -Tool-specific initialization for IBM xlC / Visual Age C++ compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/aixc++.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path - -import SCons.Platform.aix - -cplusplus = __import__('c++', globals(), locals(), []) - -packages = ['vacpp.cmp.core', 'vacpp.cmp.batch', 'vacpp.cmp.C', 'ibmcxx.cmp'] - -def get_xlc(env): - xlc = env.get('CXX', 'xlC') - xlc_r = env.get('SHCXX', 'xlC_r') - return SCons.Platform.aix.get_xlc(env, xlc, xlc_r, packages) - -def smart_cxxflags(source, target, env, for_signature): - build_dir = env.GetBuildPath() - if build_dir: - return '-qtempinc=' + os.path.join(build_dir, 'tempinc') - return '' - -def generate(env): - """Add Builders and construction variables for xlC / Visual Age - suite to an Environment.""" - path, _cxx, _shcxx, version = get_xlc(env) - if path: - _cxx = os.path.join(path, _cxx) - _shcxx = os.path.join(path, _shcxx) - - cplusplus.generate(env) - - env['CXX'] = _cxx - env['SHCXX'] = _shcxx - env['CXXVERSION'] = version - env['SHOBJSUFFIX'] = '.pic.o' - -def exists(env): - path, _cxx, _shcxx, version = get_xlc(env) - if path and _cxx: - xlc = os.path.join(path, _cxx) - if os.path.exists(xlc): - return xlc - return None - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/aixcc.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/aixcc.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/aixcc.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/aixcc.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -"""SCons.Tool.aixcc - -Tool-specific initialization for IBM xlc / Visual Age C compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/aixcc.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path - -import SCons.Platform.aix - -import cc - -packages = ['vac.C', 'ibmcxx.cmp'] - -def get_xlc(env): - xlc = env.get('CC', 'xlc') - xlc_r = env.get('SHCC', 'xlc_r') - return SCons.Platform.aix.get_xlc(env, xlc, xlc_r, packages) - -def generate(env): - """Add Builders and construction variables for xlc / Visual Age - suite to an Environment.""" - path, _cc, _shcc, version = get_xlc(env) - if path: - _cc = os.path.join(path, _cc) - _shcc = os.path.join(path, _shcc) - - cc.generate(env) - - env['CC'] = _cc - env['SHCC'] = _shcc - env['CCVERSION'] = version - -def exists(env): - path, _cc, _shcc, version = get_xlc(env) - if path and _cc: - xlc = os.path.join(path, _cc) - if os.path.exists(xlc): - return xlc - return None - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/aixf77.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/aixf77.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/aixf77.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/aixf77.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -"""engine.SCons.Tool.aixf77 - -Tool-specific initialization for IBM Visual Age f77 Fortran compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/aixf77.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path - -#import SCons.Platform.aix - -import f77 - -# It would be good to look for the AIX F77 package the same way we're now -# looking for the C and C++ packages. This should be as easy as supplying -# the correct package names in the following list and uncommenting the -# SCons.Platform.aix_get_xlc() call the in the function below. -packages = [] - -def get_xlf77(env): - xlf77 = env.get('F77', 'xlf77') - xlf77_r = env.get('SHF77', 'xlf77_r') - #return SCons.Platform.aix.get_xlc(env, xlf77, xlf77_r, packages) - return (None, xlf77, xlf77_r, None) - -def generate(env): - """ - Add Builders and construction variables for the Visual Age FORTRAN - compiler to an Environment. - """ - path, _f77, _shf77, version = get_xlf77(env) - if path: - _f77 = os.path.join(path, _f77) - _shf77 = os.path.join(path, _shf77) - - f77.generate(env) - - env['F77'] = _f77 - env['SHF77'] = _shf77 - -def exists(env): - path, _f77, _shf77, version = get_xlf77(env) - if path and _f77: - xlf77 = os.path.join(path, _f77) - if os.path.exists(xlf77): - return xlf77 - return None - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/aixlink.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/aixlink.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/aixlink.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/aixlink.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -"""SCons.Tool.aixlink - -Tool-specific initialization for the IBM Visual Age linker. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/aixlink.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os -import os.path - -import SCons.Util - -import aixcc -import link - -cplusplus = __import__('c++', globals(), locals(), []) - -def smart_linkflags(source, target, env, for_signature): - if cplusplus.iscplusplus(source): - build_dir = env.subst('$BUILDDIR', target=target, source=source) - if build_dir: - return '-qtempinc=' + os.path.join(build_dir, 'tempinc') - return '' - -def generate(env): - """ - Add Builders and construction variables for Visual Age linker to - an Environment. - """ - link.generate(env) - - env['SMARTLINKFLAGS'] = smart_linkflags - env['LINKFLAGS'] = SCons.Util.CLVar('$SMARTLINKFLAGS') - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -qmkshrobj -qsuppress=1501-218') - env['SHLIBSUFFIX'] = '.a' - -def exists(env): - path, _cc, _shcc, version = aixcc.get_xlc(env) - if path and _cc: - xlc = os.path.join(path, _cc) - if os.path.exists(xlc): - return xlc - return None - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/applelink.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/applelink.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/applelink.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/applelink.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -"""SCons.Tool.applelink - -Tool-specific initialization for the Apple gnu-like linker. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/applelink.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Util - -# Even though the Mac is based on the GNU toolchain, it doesn't understand -# the -rpath option, so we use the "link" tool instead of "gnulink". -import link - -def generate(env): - """Add Builders and construction variables for applelink to an - Environment.""" - link.generate(env) - - env['FRAMEWORKPATHPREFIX'] = '-F' - env['_FRAMEWORKPATH'] = '${_concat(FRAMEWORKPATHPREFIX, FRAMEWORKPATH, "", __env__)}' - env['_FRAMEWORKS'] = '${_concat("-framework ", FRAMEWORKS, "", __env__)}' - env['LINKCOM'] = env['LINKCOM'] + ' $_FRAMEWORKPATH $_FRAMEWORKS $FRAMEWORKSFLAGS' - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -dynamiclib') - env['SHLINKCOM'] = env['SHLINKCOM'] + ' $_FRAMEWORKPATH $_FRAMEWORKS $FRAMEWORKSFLAGS' - - # override the default for loadable modules, which are different - # on OS X than dynamic shared libs. echoing what XCode does for - # pre/suffixes: - env['LDMODULEPREFIX'] = '' - env['LDMODULESUFFIX'] = '' - env['LDMODULEFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -bundle') - env['LDMODULECOM'] = '$LDMODULE -o ${TARGET} $LDMODULEFLAGS $SOURCES $_LIBDIRFLAGS $_LIBFLAGS $_FRAMEWORKPATH $_FRAMEWORKS $FRAMEWORKSFLAGS' - - - -def exists(env): - return env['PLATFORM'] == 'darwin' - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/ar.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/ar.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/ar.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/ar.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -"""SCons.Tool.ar - -Tool-specific initialization for ar (library archive). - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/ar.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Defaults -import SCons.Tool -import SCons.Util - - -def generate(env): - """Add Builders and construction variables for ar to an Environment.""" - SCons.Tool.createStaticLibBuilder(env) - - env['AR'] = 'ar' - env['ARFLAGS'] = SCons.Util.CLVar('rc') - env['ARCOM'] = '$AR $ARFLAGS $TARGET $SOURCES' - env['LIBPREFIX'] = 'lib' - env['LIBSUFFIX'] = '.a' - - if env.Detect('ranlib'): - env['RANLIB'] = 'ranlib' - env['RANLIBFLAGS'] = SCons.Util.CLVar('') - env['RANLIBCOM'] = '$RANLIB $RANLIBFLAGS $TARGET' - -def exists(env): - return env.Detect('ar') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/as.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/as.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/as.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/as.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -"""SCons.Tool.as - -Tool-specific initialization for as, the generic Posix assembler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/as.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Defaults -import SCons.Tool -import SCons.Util - -assemblers = ['as'] - -ASSuffixes = ['.s', '.asm', '.ASM'] -ASPPSuffixes = ['.spp', '.SPP', '.sx'] -if SCons.Util.case_sensitive_suffixes('.s', '.S'): - ASPPSuffixes.extend(['.S']) -else: - ASSuffixes.extend(['.S']) - -def generate(env): - """Add Builders and construction variables for as to an Environment.""" - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - - for suffix in ASSuffixes: - static_obj.add_action(suffix, SCons.Defaults.ASAction) - shared_obj.add_action(suffix, SCons.Defaults.ASAction) - static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) - shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter) - - for suffix in ASPPSuffixes: - static_obj.add_action(suffix, SCons.Defaults.ASPPAction) - shared_obj.add_action(suffix, SCons.Defaults.ASPPAction) - static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) - shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter) - - env['AS'] = env.Detect(assemblers) or 'as' - env['ASFLAGS'] = SCons.Util.CLVar('') - env['ASCOM'] = '$AS $ASFLAGS -o $TARGET $SOURCES' - env['ASPPFLAGS'] = '$ASFLAGS' - env['ASPPCOM'] = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' - -def exists(env): - return env.Detect(assemblers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/bcc32.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/bcc32.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/bcc32.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/bcc32.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -"""SCons.Tool.bcc32 - -XXX - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/bcc32.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os -import os.path - -import SCons.Defaults -import SCons.Tool -import SCons.Util - -def findIt(program, env): - # First search in the SCons path and then the OS path: - borwin = env.WhereIs(program) or SCons.Util.WhereIs(program) - if borwin: - dir = os.path.dirname(borwin) - env.PrependENVPath('PATH', dir) - return borwin - -def generate(env): - findIt('bcc32', env) - """Add Builders and construction variables for bcc to an - Environment.""" - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - for suffix in ['.c', '.cpp']: - static_obj.add_action(suffix, SCons.Defaults.CAction) - shared_obj.add_action(suffix, SCons.Defaults.ShCAction) - static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) - shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter) - - env['CC'] = 'bcc32' - env['CCFLAGS'] = SCons.Util.CLVar('') - env['CFLAGS'] = SCons.Util.CLVar('') - env['CCCOM'] = '$CC -q $CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o$TARGET $SOURCES' - env['SHCC'] = '$CC' - env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') - env['SHCFLAGS'] = SCons.Util.CLVar('$CFLAGS') - env['SHCCCOM'] = '$SHCC -WD $SHCFLAGS $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o$TARGET $SOURCES' - env['CPPDEFPREFIX'] = '-D' - env['CPPDEFSUFFIX'] = '' - env['INCPREFIX'] = '-I' - env['INCSUFFIX'] = '' - env['SHOBJSUFFIX'] = '.dll' - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 0 - env['CFILESUFFIX'] = '.cpp' - -def exists(env): - return findIt('bcc32', env) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/c++.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/c++.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/c++.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/c++.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,99 +0,0 @@ -"""SCons.Tool.c++ - -Tool-specific initialization for generic Posix C++ compilers. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/c++.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path - -import SCons.Tool -import SCons.Defaults -import SCons.Util - -compilers = ['CC', 'c++'] - -CXXSuffixes = ['.cpp', '.cc', '.cxx', '.c++', '.C++', '.mm'] -if SCons.Util.case_sensitive_suffixes('.c', '.C'): - CXXSuffixes.append('.C') - -def iscplusplus(source): - if not source: - # Source might be None for unusual cases like SConf. - return 0 - for s in source: - if s.sources: - ext = os.path.splitext(str(s.sources[0]))[1] - if ext in CXXSuffixes: - return 1 - return 0 - -def generate(env): - """ - Add Builders and construction variables for Visual Age C++ compilers - to an Environment. - """ - import SCons.Tool - import SCons.Tool.cc - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - - for suffix in CXXSuffixes: - static_obj.add_action(suffix, SCons.Defaults.CXXAction) - shared_obj.add_action(suffix, SCons.Defaults.ShCXXAction) - static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) - shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter) - - SCons.Tool.cc.add_common_cc_variables(env) - - env['CXX'] = 'c++' - env['CXXFLAGS'] = SCons.Util.CLVar('') - env['CXXCOM'] = '$CXX -o $TARGET -c $CXXFLAGS $CCFLAGS $_CCCOMCOM $SOURCES' - env['SHCXX'] = '$CXX' - env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') - env['SHCXXCOM'] = '$SHCXX -o $TARGET -c $SHCXXFLAGS $SHCCFLAGS $_CCCOMCOM $SOURCES' - - env['CPPDEFPREFIX'] = '-D' - env['CPPDEFSUFFIX'] = '' - env['INCPREFIX'] = '-I' - env['INCSUFFIX'] = '' - env['SHOBJSUFFIX'] = '.os' - env['OBJSUFFIX'] = '.o' - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 0 - - env['CXXFILESUFFIX'] = '.cc' - -def exists(env): - return env.Detect(compilers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/cc.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/cc.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/cc.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/cc.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,102 +0,0 @@ -"""SCons.Tool.cc - -Tool-specific initialization for generic Posix C compilers. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/cc.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Tool -import SCons.Defaults -import SCons.Util - -CSuffixes = ['.c', '.m'] -if not SCons.Util.case_sensitive_suffixes('.c', '.C'): - CSuffixes.append('.C') - -def add_common_cc_variables(env): - """ - Add underlying common "C compiler" variables that - are used by multiple tools (specifically, c++). - """ - if '_CCCOMCOM' not in env: - env['_CCCOMCOM'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS' - # It's a hack to test for darwin here, but the alternative - # of creating an applecc.py to contain this seems overkill. - # Maybe someday the Apple platform will require more setup and - # this logic will be moved. - env['FRAMEWORKS'] = SCons.Util.CLVar('') - env['FRAMEWORKPATH'] = SCons.Util.CLVar('') - if env['PLATFORM'] == 'darwin': - env['_CCCOMCOM'] = env['_CCCOMCOM'] + ' $_FRAMEWORKPATH' - - if 'CCFLAGS' not in env: - env['CCFLAGS'] = SCons.Util.CLVar('') - - if 'SHCCFLAGS' not in env: - env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') - -def generate(env): - """ - Add Builders and construction variables for C compilers to an Environment. - """ - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - - for suffix in CSuffixes: - static_obj.add_action(suffix, SCons.Defaults.CAction) - shared_obj.add_action(suffix, SCons.Defaults.ShCAction) - static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) - shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter) - - add_common_cc_variables(env) - - env['CC'] = 'cc' - env['CFLAGS'] = SCons.Util.CLVar('') - env['CCCOM'] = '$CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES' - env['SHCC'] = '$CC' - env['SHCFLAGS'] = SCons.Util.CLVar('$CFLAGS') - env['SHCCCOM'] = '$SHCC -o $TARGET -c $SHCFLAGS $SHCCFLAGS $_CCCOMCOM $SOURCES' - - env['CPPDEFPREFIX'] = '-D' - env['CPPDEFSUFFIX'] = '' - env['INCPREFIX'] = '-I' - env['INCSUFFIX'] = '' - env['SHOBJSUFFIX'] = '.os' - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 0 - - env['CFILESUFFIX'] = '.c' - -def exists(env): - return env.Detect('cc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/cvf.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/cvf.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/cvf.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/cvf.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -"""engine.SCons.Tool.cvf - -Tool-specific initialization for the Compaq Visual Fortran compiler. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/cvf.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import fortran - -compilers = ['f90'] - -def generate(env): - """Add Builders and construction variables for compaq visual fortran to an Environment.""" - - fortran.generate(env) - - env['FORTRAN'] = 'f90' - env['FORTRANCOM'] = '$FORTRAN $FORTRANFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:${TARGET.windows}' - env['FORTRANPPCOM'] = '$FORTRAN $FORTRANFLAGS $CPPFLAGS $_CPPDEFFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:${TARGET.windows}' - env['SHFORTRANCOM'] = '$SHFORTRAN $SHFORTRANFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:${TARGET.windows}' - env['SHFORTRANPPCOM'] = '$SHFORTRAN $SHFORTRANFLAGS $CPPFLAGS $_CPPDEFFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:${TARGET.windows}' - env['OBJSUFFIX'] = '.obj' - env['FORTRANMODDIR'] = '${TARGET.dir}' - env['FORTRANMODDIRPREFIX'] = '/module:' - env['FORTRANMODDIRSUFFIX'] = '' - -def exists(env): - return env.Detect(compilers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/default.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/default.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/default.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/default.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -"""SCons.Tool.default - -Initialization with a default tool list. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/default.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Tool - -def generate(env): - """Add default tools.""" - for t in SCons.Tool.tool_list(env['PLATFORM'], env): - SCons.Tool.Tool(t)(env) - -def exists(env): - return 1 - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/dmd.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/dmd.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/dmd.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/dmd.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,240 +0,0 @@ -"""SCons.Tool.dmd - -Tool-specific initialization for the Digital Mars D compiler. -(http://digitalmars.com/d) - -Coded by Andy Friesen (andy@ikagames.com) -15 November 2003 - -Amended by Russel Winder (russel@russel.org.uk) -2010-02-07 - -There are a number of problems with this script at this point in time. -The one that irritates me the most is the Windows linker setup. The D -linker doesn't have a way to add lib paths on the commandline, as far -as I can see. You have to specify paths relative to the SConscript or -use absolute paths. To hack around it, add '#/blah'. This will link -blah.lib from the directory where SConstruct resides. - -Compiler variables: - DC - The name of the D compiler to use. Defaults to dmd or gdmd, - whichever is found. - DPATH - List of paths to search for import modules. - DVERSIONS - List of version tags to enable when compiling. - DDEBUG - List of debug tags to enable when compiling. - -Linker related variables: - LIBS - List of library files to link in. - DLINK - Name of the linker to use. Defaults to dmd or gdmd. - DLINKFLAGS - List of linker flags. - -Lib tool variables: - DLIB - Name of the lib tool to use. Defaults to lib. - DLIBFLAGS - List of flags to pass to the lib tool. - LIBS - Same as for the linker. (libraries to pull into the .lib) -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/dmd.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os - -import SCons.Action -import SCons.Builder -import SCons.Defaults -import SCons.Scanner.D -import SCons.Tool - -# Adapted from c++.py -def isD(source): - if not source: - return 0 - - for s in source: - if s.sources: - ext = os.path.splitext(str(s.sources[0]))[1] - if ext == '.d': - return 1 - return 0 - -smart_link = {} - -smart_lib = {} - -def generate(env): - global smart_link - global smart_lib - - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - - DAction = SCons.Action.Action('$DCOM', '$DCOMSTR') - - static_obj.add_action('.d', DAction) - shared_obj.add_action('.d', DAction) - static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter) - shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter) - - dc = env.Detect(['dmd', 'gdmd']) - env['DC'] = dc - env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -of$TARGET $SOURCES' - env['_DINCFLAGS'] = '$( ${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' - env['_DVERFLAGS'] = '$( ${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)} $)' - env['_DDEBUGFLAGS'] = '$( ${_concat(DDEBUGPREFIX, DDEBUG, DDEBUGSUFFIX, __env__)} $)' - env['_DFLAGS'] = '$( ${_concat(DFLAGPREFIX, DFLAGS, DFLAGSUFFIX, __env__)} $)' - - env['DPATH'] = ['#/'] - env['DFLAGS'] = [] - env['DVERSIONS'] = [] - env['DDEBUG'] = [] - - if dc: - # Add the path to the standard library. - # This is merely for the convenience of the dependency scanner. - dmd_path = env.WhereIs(dc) - if dmd_path: - x = dmd_path.rindex(dc) - phobosDir = dmd_path[:x] + '/../src/phobos' - if os.path.isdir(phobosDir): - env.Append(DPATH = [phobosDir]) - - env['DINCPREFIX'] = '-I' - env['DINCSUFFIX'] = '' - env['DVERPREFIX'] = '-version=' - env['DVERSUFFIX'] = '' - env['DDEBUGPREFIX'] = '-debug=' - env['DDEBUGSUFFIX'] = '' - env['DFLAGPREFIX'] = '-' - env['DFLAGSUFFIX'] = '' - env['DFILESUFFIX'] = '.d' - - # Need to use the Digital Mars linker/lib on windows. - # *nix can just use GNU link. - if env['PLATFORM'] == 'win32': - env['DLINK'] = '$DC' - env['DLINKCOM'] = '$DLINK -of$TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' - env['DLIB'] = 'lib' - env['DLIBCOM'] = '$DLIB $_DLIBFLAGS -c $TARGET $SOURCES $_DLINKLIBFLAGS' - - env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' - env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' - env['DLINKFLAGS'] = [] - env['DLIBLINKPREFIX'] = '' - env['DLIBLINKSUFFIX'] = '.lib' - env['DLIBFLAGPREFIX'] = '-' - env['DLIBFLAGSUFFIX'] = '' - env['DLINKFLAGPREFIX'] = '-' - env['DLINKFLAGSUFFIX'] = '' - - SCons.Tool.createStaticLibBuilder(env) - - # Basically, we hijack the link and ar builders with our own. - # these builders check for the presence of D source, and swap out - # the system's defaults for the Digital Mars tools. If there's no D - # source, then we silently return the previous settings. - linkcom = env.get('LINKCOM') - try: - env['SMART_LINKCOM'] = smart_link[linkcom] - except KeyError: - def _smartLink(source, target, env, for_signature, - defaultLinker=linkcom): - if isD(source): - # XXX I'm not sure how to add a $DLINKCOMSTR variable - # so that it works with this _smartLink() logic, - # and I don't have a D compiler/linker to try it out, - # so we'll leave it alone for now. - return '$DLINKCOM' - else: - return defaultLinker - env['SMART_LINKCOM'] = smart_link[linkcom] = _smartLink - - arcom = env.get('ARCOM') - try: - env['SMART_ARCOM'] = smart_lib[arcom] - except KeyError: - def _smartLib(source, target, env, for_signature, - defaultLib=arcom): - if isD(source): - # XXX I'm not sure how to add a $DLIBCOMSTR variable - # so that it works with this _smartLib() logic, and - # I don't have a D compiler/archiver to try it out, - # so we'll leave it alone for now. - return '$DLIBCOM' - else: - return defaultLib - env['SMART_ARCOM'] = smart_lib[arcom] = _smartLib - - # It is worth noting that the final space in these strings is - # absolutely pivotal. SCons sees these as actions and not generators - # if it is not there. (very bad) - env['ARCOM'] = '$SMART_ARCOM ' - env['LINKCOM'] = '$SMART_LINKCOM ' - else: # assuming linux - linkcom = env.get('LINKCOM') - try: - env['SMART_LINKCOM'] = smart_link[linkcom] - except KeyError: - def _smartLink(source, target, env, for_signature, - defaultLinker=linkcom, dc=dc): - if isD(source): - try: - libs = env['LIBS'] - except KeyError: - libs = [] - if dc == 'dmd': - # TODO: This assumes that the dmd executable is in the - # bin directory and that the libraries are in a peer - # directory lib. This true of the Digital Mars - # distribution but . . . - import glob - dHome = env.WhereIs(dc).replace('/dmd' , '/..') - if glob.glob(dHome + '/lib/*phobos2*'): - if 'phobos2' not in libs: - env.Append(LIBPATH = [dHome + '/lib']) - env.Append(LIBS = ['phobos2']) - # TODO: Find out when there will be a - # 64-bit version of D. - env.Append(LINKFLAGS = ['-m32']) - else: - if 'phobos' not in libs: - env.Append(LIBS = ['phobos']) - elif dc is 'gdmd': - env.Append(LIBS = ['gphobos']) - if 'pthread' not in libs: - env.Append(LIBS = ['pthread']) - if 'm' not in libs: - env.Append(LIBS = ['m']) - return defaultLinker - env['SMART_LINKCOM'] = smart_link[linkcom] = _smartLink - - env['LINKCOM'] = '$SMART_LINKCOM ' - -def exists(env): - return env.Detect(['dmd', 'gdmd']) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/dvi.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/dvi.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/dvi.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/dvi.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -"""SCons.Tool.dvi - -Common DVI Builder definition for various other Tool modules that use it. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/dvi.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Builder -import SCons.Tool - -DVIBuilder = None - -def generate(env): - try: - env['BUILDERS']['DVI'] - except KeyError: - global DVIBuilder - - if DVIBuilder is None: - # The suffix is hard-coded to '.dvi', not configurable via a - # construction variable like $DVISUFFIX, because the output - # file name is hard-coded within TeX. - DVIBuilder = SCons.Builder.Builder(action = {}, - source_scanner = SCons.Tool.LaTeXScanner, - suffix = '.dvi', - emitter = {}, - source_ext_match = None) - - env['BUILDERS']['DVI'] = DVIBuilder - -def exists(env): - # This only puts a skeleton Builder in place, so if someone - # references this Tool directly, it's always "available." - return 1 - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/dvipdf.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/dvipdf.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/dvipdf.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/dvipdf.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,125 +0,0 @@ -"""SCons.Tool.dvipdf - -Tool-specific initialization for dvipdf. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/dvipdf.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Action -import SCons.Defaults -import SCons.Tool.pdf -import SCons.Tool.tex -import SCons.Util - -_null = SCons.Scanner.LaTeX._null - -def DviPdfPsFunction(XXXDviAction, target = None, source= None, env=None): - """A builder for DVI files that sets the TEXPICTS environment - variable before running dvi2ps or dvipdf.""" - - try: - abspath = source[0].attributes.path - except AttributeError : - abspath = '' - - saved_env = SCons.Scanner.LaTeX.modify_env_var(env, 'TEXPICTS', abspath) - - result = XXXDviAction(target, source, env) - - if saved_env is _null: - try: - del env['ENV']['TEXPICTS'] - except KeyError: - pass # was never set - else: - env['ENV']['TEXPICTS'] = saved_env - - return result - -def DviPdfFunction(target = None, source= None, env=None): - result = DviPdfPsFunction(PDFAction,target,source,env) - return result - -def DviPdfStrFunction(target = None, source= None, env=None): - """A strfunction for dvipdf that returns the appropriate - command string for the no_exec options.""" - if env.GetOption("no_exec"): - result = env.subst('$DVIPDFCOM',0,target,source) - else: - result = '' - return result - -PDFAction = None -DVIPDFAction = None - -def PDFEmitter(target, source, env): - """Strips any .aux or .log files from the input source list. - These are created by the TeX Builder that in all likelihood was - used to generate the .dvi file we're using as input, and we only - care about the .dvi file. - """ - def strip_suffixes(n): - return not SCons.Util.splitext(str(n))[1] in ['.aux', '.log'] - source = list(filter(strip_suffixes, source)) - return (target, source) - -def generate(env): - """Add Builders and construction variables for dvipdf to an Environment.""" - global PDFAction - if PDFAction is None: - PDFAction = SCons.Action.Action('$DVIPDFCOM', '$DVIPDFCOMSTR') - - global DVIPDFAction - if DVIPDFAction is None: - DVIPDFAction = SCons.Action.Action(DviPdfFunction, strfunction = DviPdfStrFunction) - - import pdf - pdf.generate(env) - - bld = env['BUILDERS']['PDF'] - bld.add_action('.dvi', DVIPDFAction) - bld.add_emitter('.dvi', PDFEmitter) - - env['DVIPDF'] = 'dvipdf' - env['DVIPDFFLAGS'] = SCons.Util.CLVar('') - env['DVIPDFCOM'] = 'cd ${TARGET.dir} && $DVIPDF $DVIPDFFLAGS ${SOURCE.file} ${TARGET.file}' - - # Deprecated synonym. - env['PDFCOM'] = ['$DVIPDFCOM'] - -def exists(env): - SCons.Tool.tex.generate_darwin(env) - return env.Detect('dvipdf') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/dvips.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/dvips.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/dvips.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/dvips.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,95 +0,0 @@ -"""SCons.Tool.dvips - -Tool-specific initialization for dvips. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/dvips.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Action -import SCons.Builder -import SCons.Tool.dvipdf -import SCons.Util - -def DviPsFunction(target = None, source= None, env=None): - result = SCons.Tool.dvipdf.DviPdfPsFunction(PSAction,target,source,env) - return result - -def DviPsStrFunction(target = None, source= None, env=None): - """A strfunction for dvipdf that returns the appropriate - command string for the no_exec options.""" - if env.GetOption("no_exec"): - result = env.subst('$PSCOM',0,target,source) - else: - result = '' - return result - -PSAction = None -DVIPSAction = None -PSBuilder = None - -def generate(env): - """Add Builders and construction variables for dvips to an Environment.""" - global PSAction - if PSAction is None: - PSAction = SCons.Action.Action('$PSCOM', '$PSCOMSTR') - - global DVIPSAction - if DVIPSAction is None: - DVIPSAction = SCons.Action.Action(DviPsFunction, strfunction = DviPsStrFunction) - - global PSBuilder - if PSBuilder is None: - PSBuilder = SCons.Builder.Builder(action = PSAction, - prefix = '$PSPREFIX', - suffix = '$PSSUFFIX', - src_suffix = '.dvi', - src_builder = 'DVI', - single_source=True) - - env['BUILDERS']['PostScript'] = PSBuilder - - env['DVIPS'] = 'dvips' - env['DVIPSFLAGS'] = SCons.Util.CLVar('') - # I'm not quite sure I got the directories and filenames right for variant_dir - # We need to be in the correct directory for the sake of latex \includegraphics eps included files. - env['PSCOM'] = 'cd ${TARGET.dir} && $DVIPS $DVIPSFLAGS -o ${TARGET.file} ${SOURCE.file}' - env['PSPREFIX'] = '' - env['PSSUFFIX'] = '.ps' - -def exists(env): - SCons.Tool.tex.generate_darwin(env) - return env.Detect('dvips') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/f03.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/f03.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/f03.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/f03.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -"""engine.SCons.Tool.f03 - -Tool-specific initialization for the generic Posix f03 Fortran compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/f03.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Defaults -import SCons.Tool -import SCons.Util -import fortran -from SCons.Tool.FortranCommon import add_all_to_env, add_f03_to_env - -compilers = ['f03'] - -def generate(env): - add_all_to_env(env) - add_f03_to_env(env) - - fcomp = env.Detect(compilers) or 'f03' - env['F03'] = fcomp - env['SHF03'] = fcomp - - env['FORTRAN'] = fcomp - env['SHFORTRAN'] = fcomp - - -def exists(env): - return env.Detect(compilers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/f77.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/f77.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/f77.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/f77.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -"""engine.SCons.Tool.f77 - -Tool-specific initialization for the generic Posix f77 Fortran compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/f77.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Defaults -import SCons.Scanner.Fortran -import SCons.Tool -import SCons.Util -from SCons.Tool.FortranCommon import add_all_to_env, add_f77_to_env - -compilers = ['f77'] - -def generate(env): - add_all_to_env(env) - add_f77_to_env(env) - - fcomp = env.Detect(compilers) or 'f77' - env['F77'] = fcomp - env['SHF77'] = fcomp - - env['FORTRAN'] = fcomp - env['SHFORTRAN'] = fcomp - -def exists(env): - return env.Detect(compilers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/f90.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/f90.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/f90.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/f90.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -"""engine.SCons.Tool.f90 - -Tool-specific initialization for the generic Posix f90 Fortran compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/f90.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Defaults -import SCons.Scanner.Fortran -import SCons.Tool -import SCons.Util -from SCons.Tool.FortranCommon import add_all_to_env, add_f90_to_env - -compilers = ['f90'] - -def generate(env): - add_all_to_env(env) - add_f90_to_env(env) - - fc = env.Detect(compilers) or 'f90' - env['F90'] = fc - env['SHF90'] = fc - - env['FORTRAN'] = fc - env['SHFORTRAN'] = fc - -def exists(env): - return env.Detect(compilers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/f95.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/f95.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/f95.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/f95.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -"""engine.SCons.Tool.f95 - -Tool-specific initialization for the generic Posix f95 Fortran compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/f95.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Defaults -import SCons.Tool -import SCons.Util -import fortran -from SCons.Tool.FortranCommon import add_all_to_env, add_f95_to_env - -compilers = ['f95'] - -def generate(env): - add_all_to_env(env) - add_f95_to_env(env) - - fcomp = env.Detect(compilers) or 'f95' - env['F95'] = fcomp - env['SHF95'] = fcomp - - env['FORTRAN'] = fcomp - env['SHFORTRAN'] = fcomp - - -def exists(env): - return env.Detect(compilers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/filesystem.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/filesystem.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/filesystem.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/filesystem.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -"""SCons.Tool.filesystem - -Tool-specific initialization for the filesystem tools. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/filesystem.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons -from SCons.Tool.install import copyFunc - -copyToBuilder, copyAsBuilder = None, None - -def copyto_emitter(target, source, env): - """ changes the path of the source to be under the target (which - are assumed to be directories. - """ - n_target = [] - - for t in target: - n_target = n_target + [t.File( str( s ) ) for s in source] - - return (n_target, source) - -def copy_action_func(target, source, env): - assert( len(target) == len(source) ), "\ntarget: %s\nsource: %s" %(list(map(str, target)),list(map(str, source))) - - for t, s in zip(target, source): - if copyFunc(t.get_path(), s.get_path(), env): - return 1 - - return 0 - -def copy_action_str(target, source, env): - return env.subst_target_source(env['COPYSTR'], 0, target, source) - -copy_action = SCons.Action.Action( copy_action_func, copy_action_str ) - -def generate(env): - try: - env['BUILDERS']['CopyTo'] - env['BUILDERS']['CopyAs'] - except KeyError, e: - global copyToBuilder - if copyToBuilder is None: - copyToBuilder = SCons.Builder.Builder( - action = copy_action, - target_factory = env.fs.Dir, - source_factory = env.fs.Entry, - multi = 1, - emitter = [ copyto_emitter, ] ) - - global copyAsBuilder - if copyAsBuilder is None: - copyAsBuilder = SCons.Builder.Builder( - action = copy_action, - target_factory = env.fs.Entry, - source_factory = env.fs.Entry ) - - env['BUILDERS']['CopyTo'] = copyToBuilder - env['BUILDERS']['CopyAs'] = copyAsBuilder - - env['COPYSTR'] = 'Copy file(s): "$SOURCES" to "$TARGETS"' - -def exists(env): - return 1 - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/fortran.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/fortran.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/fortran.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/fortran.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -"""SCons.Tool.fortran - -Tool-specific initialization for a generic Posix f77/f90 Fortran compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/fortran.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import re - -import SCons.Action -import SCons.Defaults -import SCons.Scanner.Fortran -import SCons.Tool -import SCons.Util -from SCons.Tool.FortranCommon import add_all_to_env, add_fortran_to_env - -compilers = ['f95', 'f90', 'f77'] - -def generate(env): - add_all_to_env(env) - add_fortran_to_env(env) - - fc = env.Detect(compilers) or 'f77' - env['SHFORTRAN'] = fc - env['FORTRAN'] = fc - -def exists(env): - return env.Detect(compilers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/g++.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/g++.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/g++.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/g++.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -"""SCons.Tool.g++ - -Tool-specific initialization for g++. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/g++.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path -import re -import subprocess - -import SCons.Tool -import SCons.Util - -cplusplus = __import__('c++', globals(), locals(), []) - -compilers = ['g++'] - -def generate(env): - """Add Builders and construction variables for g++ to an Environment.""" - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - - cplusplus.generate(env) - - env['CXX'] = env.Detect(compilers) - - # platform specific settings - if env['PLATFORM'] == 'aix': - env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS -mminimal-toc') - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 - env['SHOBJSUFFIX'] = '$OBJSUFFIX' - elif env['PLATFORM'] == 'hpux': - env['SHOBJSUFFIX'] = '.pic.o' - elif env['PLATFORM'] == 'sunos': - env['SHOBJSUFFIX'] = '.pic.o' - # determine compiler version - if env['CXX']: - #pipe = SCons.Action._subproc(env, [env['CXX'], '-dumpversion'], - pipe = SCons.Action._subproc(env, [env['CXX'], '--version'], - stdin = 'devnull', - stderr = 'devnull', - stdout = subprocess.PIPE) - if pipe.wait() != 0: return - # -dumpversion was added in GCC 3.0. As long as we're supporting - # GCC versions older than that, we should use --version and a - # regular expression. - #line = pipe.stdout.read().strip() - #if line: - # env['CXXVERSION'] = line - line = pipe.stdout.readline() - match = re.search(r'[0-9]+(\.[0-9]+)+', line) - if match: - env['CXXVERSION'] = match.group(0) - -def exists(env): - return env.Detect(compilers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/g77.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/g77.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/g77.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/g77.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -"""engine.SCons.Tool.g77 - -Tool-specific initialization for g77. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/g77.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Util -from SCons.Tool.FortranCommon import add_all_to_env, add_f77_to_env - -compilers = ['g77', 'f77'] - -def generate(env): - """Add Builders and construction variables for g77 to an Environment.""" - add_all_to_env(env) - add_f77_to_env(env) - - fcomp = env.Detect(compilers) or 'g77' - if env['PLATFORM'] in ['cygwin', 'win32']: - env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS') - env['SHF77FLAGS'] = SCons.Util.CLVar('$F77FLAGS') - else: - env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS -fPIC') - env['SHF77FLAGS'] = SCons.Util.CLVar('$F77FLAGS -fPIC') - - env['FORTRAN'] = fcomp - env['SHFORTRAN'] = '$FORTRAN' - - env['F77'] = fcomp - env['SHF77'] = '$F77' - - env['INCFORTRANPREFIX'] = "-I" - env['INCFORTRANSUFFIX'] = "" - - env['INCF77PREFIX'] = "-I" - env['INCF77SUFFIX'] = "" - -def exists(env): - return env.Detect(compilers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/gas.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/gas.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/gas.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/gas.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -"""SCons.Tool.gas - -Tool-specific initialization for as, the Gnu assembler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/gas.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -as_module = __import__('as', globals(), locals(), []) - -assemblers = ['as', 'gas'] - -def generate(env): - """Add Builders and construction variables for as to an Environment.""" - as_module.generate(env) - - env['AS'] = env.Detect(assemblers) or 'as' - -def exists(env): - return env.Detect(assemblers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/gcc.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/gcc.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/gcc.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/gcc.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -"""SCons.Tool.gcc - -Tool-specific initialization for gcc. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/gcc.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import cc -import os -import re -import subprocess - -import SCons.Util - -compilers = ['gcc', 'cc'] - -def generate(env): - """Add Builders and construction variables for gcc to an Environment.""" - cc.generate(env) - - env['CC'] = env.Detect(compilers) or 'gcc' - if env['PLATFORM'] in ['cygwin', 'win32']: - env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') - else: - env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS -fPIC') - # determine compiler version - if env['CC']: - #pipe = SCons.Action._subproc(env, [env['CC'], '-dumpversion'], - pipe = SCons.Action._subproc(env, [env['CC'], '--version'], - stdin = 'devnull', - stderr = 'devnull', - stdout = subprocess.PIPE) - if pipe.wait() != 0: return - # -dumpversion was added in GCC 3.0. As long as we're supporting - # GCC versions older than that, we should use --version and a - # regular expression. - #line = pipe.stdout.read().strip() - #if line: - # env['CCVERSION'] = line - line = pipe.stdout.readline() - match = re.search(r'[0-9]+(\.[0-9]+)+', line) - if match: - env['CCVERSION'] = match.group(0) - -def exists(env): - return env.Detect(compilers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/gettext.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/gettext.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/gettext.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/gettext.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -"""gettext tool -""" - - -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/gettext.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -############################################################################# -def generate(env,**kw): - import SCons.Tool - from SCons.Tool.GettextCommon \ - import _translate, tool_list - for t in tool_list(env['PLATFORM'], env): - env.Tool(t) - env.AddMethod(_translate, 'Translate') -############################################################################# - -############################################################################# -def exists(env): - from SCons.Tool.GettextCommon \ - import _xgettext_exists, _msginit_exists, \ - _msgmerge_exists, _msgfmt_exists - return _xgettext_exists(env) and _msginit_exists(env) \ - and _msgmerge_exists(env) and _msgfmt_exists(env) -############################################################################# diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/gfortran.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/gfortran.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/gfortran.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/gfortran.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -"""SCons.Tool.gfortran - -Tool-specific initialization for gfortran, the GNU Fortran 95/Fortran -2003 compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/gfortran.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Util - -import fortran - -def generate(env): - """Add Builders and construction variables for gfortran to an - Environment.""" - fortran.generate(env) - - for dialect in ['F77', 'F90', 'FORTRAN', 'F95', 'F03']: - env['%s' % dialect] = 'gfortran' - env['SH%s' % dialect] = '$%s' % dialect - if env['PLATFORM'] in ['cygwin', 'win32']: - env['SH%sFLAGS' % dialect] = SCons.Util.CLVar('$%sFLAGS' % dialect) - else: - env['SH%sFLAGS' % dialect] = SCons.Util.CLVar('$%sFLAGS -fPIC' % dialect) - - env['INC%sPREFIX' % dialect] = "-I" - env['INC%sSUFFIX' % dialect] = "" - -def exists(env): - return env.Detect('gfortran') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/gnulink.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/gnulink.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/gnulink.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/gnulink.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -"""SCons.Tool.gnulink - -Tool-specific initialization for the gnu linker. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/gnulink.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Util - -import link - -linkers = ['g++', 'gcc'] - -def generate(env): - """Add Builders and construction variables for gnulink to an Environment.""" - link.generate(env) - - if env['PLATFORM'] == 'hpux': - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared -fPIC') - - # __RPATH is set to $_RPATH in the platform specification if that - # platform supports it. - env['RPATHPREFIX'] = '-Wl,-rpath=' - env['RPATHSUFFIX'] = '' - env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}' - -def exists(env): - return env.Detect(linkers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/gs.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/gs.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/gs.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/gs.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -"""SCons.Tool.gs - -Tool-specific initialization for Ghostscript. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/gs.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Action -import SCons.Platform -import SCons.Util - -# Ghostscript goes by different names on different platforms... -platform = SCons.Platform.platform_default() - -if platform == 'os2': - gs = 'gsos2' -elif platform == 'win32': - gs = 'gswin32c' -else: - gs = 'gs' - -GhostscriptAction = None - -def generate(env): - """Add Builders and construction variables for Ghostscript to an - Environment.""" - - global GhostscriptAction - if GhostscriptAction is None: - GhostscriptAction = SCons.Action.Action('$GSCOM', '$GSCOMSTR') - - import pdf - pdf.generate(env) - - bld = env['BUILDERS']['PDF'] - bld.add_action('.ps', GhostscriptAction) - - env['GS'] = gs - env['GSFLAGS'] = SCons.Util.CLVar('-dNOPAUSE -dBATCH -sDEVICE=pdfwrite') - env['GSCOM'] = '$GS $GSFLAGS -sOutputFile=$TARGET $SOURCES' - - -def exists(env): - if 'PS2PDF' in env: - return env.Detect(env['PS2PDF']) - else: - return env.Detect(gs) or SCons.Util.WhereIs(gs) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/hpc++.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/hpc++.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/hpc++.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/hpc++.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -"""SCons.Tool.hpc++ - -Tool-specific initialization for c++ on HP/UX. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/hpc++.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path - -import SCons.Util - -cplusplus = __import__('c++', globals(), locals(), []) - -acc = None - -# search for the acc compiler and linker front end - -try: - dirs = os.listdir('/opt') -except (IOError, OSError): - # Not being able to read the directory because it doesn't exist - # (IOError) or isn't readable (OSError) is okay. - dirs = [] - -for dir in dirs: - cc = '/opt/' + dir + '/bin/aCC' - if os.path.exists(cc): - acc = cc - break - - -def generate(env): - """Add Builders and construction variables for g++ to an Environment.""" - cplusplus.generate(env) - - if acc: - env['CXX'] = acc or 'aCC' - env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS +Z') - # determine version of aCC - line = os.popen(acc + ' -V 2>&1').readline().rstrip() - if line.find('aCC: HP ANSI C++') == 0: - env['CXXVERSION'] = line.split()[-1] - - if env['PLATFORM'] == 'cygwin': - env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') - else: - env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS +Z') - -def exists(env): - return acc - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/hpcc.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/hpcc.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/hpcc.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/hpcc.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -"""SCons.Tool.hpcc - -Tool-specific initialization for HP aCC and cc. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/hpcc.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Util - -import cc - -def generate(env): - """Add Builders and construction variables for aCC & cc to an Environment.""" - cc.generate(env) - - env['CXX'] = 'aCC' - env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS +Z') - -def exists(env): - return env.Detect('aCC') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/hplink.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/hplink.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/hplink.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/hplink.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -"""SCons.Tool.hplink - -Tool-specific initialization for the HP linker. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/hplink.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os -import os.path - -import SCons.Util - -import link - -ccLinker = None - -# search for the acc compiler and linker front end - -try: - dirs = os.listdir('/opt') -except (IOError, OSError): - # Not being able to read the directory because it doesn't exist - # (IOError) or isn't readable (OSError) is okay. - dirs = [] - -for dir in dirs: - linker = '/opt/' + dir + '/bin/aCC' - if os.path.exists(linker): - ccLinker = linker - break - -def generate(env): - """ - Add Builders and construction variables for Visual Age linker to - an Environment. - """ - link.generate(env) - - env['LINKFLAGS'] = SCons.Util.CLVar('-Wl,+s -Wl,+vnocompatwarnings') - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -b') - env['SHLIBSUFFIX'] = '.sl' - -def exists(env): - return ccLinker - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/icc.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/icc.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/icc.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/icc.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -"""engine.SCons.Tool.icc - -Tool-specific initialization for the OS/2 icc compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/icc.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import cc - -def generate(env): - """Add Builders and construction variables for the OS/2 to an Environment.""" - cc.generate(env) - - env['CC'] = 'icc' - env['CCCOM'] = '$CC $CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET' - env['CXXCOM'] = '$CXX $CXXFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET' - env['CPPDEFPREFIX'] = '/D' - env['CPPDEFSUFFIX'] = '' - env['INCPREFIX'] = '/I' - env['INCSUFFIX'] = '' - env['CFILESUFFIX'] = '.c' - env['CXXFILESUFFIX'] = '.cc' - -def exists(env): - return env.Detect('icc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/icl.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/icl.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/icl.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/icl.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -"""engine.SCons.Tool.icl - -Tool-specific initialization for the Intel C/C++ compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/icl.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Tool.intelc - -# This has been completely superceded by intelc.py, which can -# handle both Windows and Linux versions. - -def generate(*args, **kw): - """Add Builders and construction variables for icl to an Environment.""" - return SCons.Tool.intelc.generate(*args, **kw) - -def exists(*args, **kw): - return SCons.Tool.intelc.exists(*args, **kw) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/ifl.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/ifl.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/ifl.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/ifl.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -"""SCons.Tool.ifl - -Tool-specific initialization for the Intel Fortran compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/ifl.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Defaults -from SCons.Scanner.Fortran import FortranScan -from FortranCommon import add_all_to_env - -def generate(env): - """Add Builders and construction variables for ifl to an Environment.""" - fscan = FortranScan("FORTRANPATH") - SCons.Tool.SourceFileScanner.add_scanner('.i', fscan) - SCons.Tool.SourceFileScanner.add_scanner('.i90', fscan) - - if 'FORTRANFILESUFFIXES' not in env: - env['FORTRANFILESUFFIXES'] = ['.i'] - else: - env['FORTRANFILESUFFIXES'].append('.i') - - if 'F90FILESUFFIXES' not in env: - env['F90FILESUFFIXES'] = ['.i90'] - else: - env['F90FILESUFFIXES'].append('.i90') - - add_all_to_env(env) - - env['FORTRAN'] = 'ifl' - env['SHFORTRAN'] = '$FORTRAN' - env['FORTRANCOM'] = '$FORTRAN $FORTRANFLAGS $_FORTRANINCFLAGS /c $SOURCES /Fo$TARGET' - env['FORTRANPPCOM'] = '$FORTRAN $FORTRANFLAGS $CPPFLAGS $_CPPDEFFLAGS $_FORTRANINCFLAGS /c $SOURCES /Fo$TARGET' - env['SHFORTRANCOM'] = '$SHFORTRAN $SHFORTRANFLAGS $_FORTRANINCFLAGS /c $SOURCES /Fo$TARGET' - env['SHFORTRANPPCOM'] = '$SHFORTRAN $SHFORTRANFLAGS $CPPFLAGS $_CPPDEFFLAGS $_FORTRANINCFLAGS /c $SOURCES /Fo$TARGET' - -def exists(env): - return env.Detect('ifl') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/ifort.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/ifort.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/ifort.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/ifort.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,88 +0,0 @@ -"""SCons.Tool.ifort - -Tool-specific initialization for newer versions of the Intel Fortran Compiler -for Linux/Windows (and possibly Mac OS X). - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/ifort.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Defaults -from SCons.Scanner.Fortran import FortranScan -from FortranCommon import add_all_to_env - -def generate(env): - """Add Builders and construction variables for ifort to an Environment.""" - # ifort supports Fortran 90 and Fortran 95 - # Additionally, ifort recognizes more file extensions. - fscan = FortranScan("FORTRANPATH") - SCons.Tool.SourceFileScanner.add_scanner('.i', fscan) - SCons.Tool.SourceFileScanner.add_scanner('.i90', fscan) - - if 'FORTRANFILESUFFIXES' not in env: - env['FORTRANFILESUFFIXES'] = ['.i'] - else: - env['FORTRANFILESUFFIXES'].append('.i') - - if 'F90FILESUFFIXES' not in env: - env['F90FILESUFFIXES'] = ['.i90'] - else: - env['F90FILESUFFIXES'].append('.i90') - - add_all_to_env(env) - - fc = 'ifort' - - for dialect in ['F77', 'F90', 'FORTRAN', 'F95']: - env['%s' % dialect] = fc - env['SH%s' % dialect] = '$%s' % dialect - if env['PLATFORM'] == 'posix': - env['SH%sFLAGS' % dialect] = SCons.Util.CLVar('$%sFLAGS -fPIC' % dialect) - - if env['PLATFORM'] == 'win32': - # On Windows, the ifort compiler specifies the object on the - # command line with -object:, not -o. Massage the necessary - # command-line construction variables. - for dialect in ['F77', 'F90', 'FORTRAN', 'F95']: - for var in ['%sCOM' % dialect, '%sPPCOM' % dialect, - 'SH%sCOM' % dialect, 'SH%sPPCOM' % dialect]: - env[var] = env[var].replace('-o $TARGET', '-object:$TARGET') - env['FORTRANMODDIRPREFIX'] = "/module:" - else: - env['FORTRANMODDIRPREFIX'] = "-module " - -def exists(env): - return env.Detect('ifort') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/ilink.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/ilink.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/ilink.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/ilink.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -"""SCons.Tool.ilink - -Tool-specific initialization for the OS/2 ilink linker. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/ilink.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Defaults -import SCons.Tool -import SCons.Util - -def generate(env): - """Add Builders and construction variables for ilink to an Environment.""" - SCons.Tool.createProgBuilder(env) - - env['LINK'] = 'ilink' - env['LINKFLAGS'] = SCons.Util.CLVar('') - env['LINKCOM'] = '$LINK $LINKFLAGS /O:$TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' - env['LIBDIRPREFIX']='/LIBPATH:' - env['LIBDIRSUFFIX']='' - env['LIBLINKPREFIX']='' - env['LIBLINKSUFFIX']='$LIBSUFFIX' - -def exists(env): - return env.Detect('ilink') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/ilink32.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/ilink32.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/ilink32.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/ilink32.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -"""SCons.Tool.ilink32 - -XXX - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/ilink32.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Tool -import SCons.Tool.bcc32 -import SCons.Util - -def generate(env): - """Add Builders and construction variables for Borland ilink to an - Environment.""" - SCons.Tool.createSharedLibBuilder(env) - SCons.Tool.createProgBuilder(env) - - env['LINK'] = '$CC' - env['LINKFLAGS'] = SCons.Util.CLVar('') - env['LINKCOM'] = '$LINK -q $LINKFLAGS -e$TARGET $SOURCES $LIBS' - env['LIBDIRPREFIX']='' - env['LIBDIRSUFFIX']='' - env['LIBLINKPREFIX']='' - env['LIBLINKSUFFIX']='$LIBSUFFIX' - - -def exists(env): - # Uses bcc32 to do linking as it generally knows where the standard - # LIBS are and set up the linking correctly - return SCons.Tool.bcc32.findIt('bcc32', env) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/install.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/install.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/install.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/install.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,283 +0,0 @@ -"""SCons.Tool.install - -Tool-specific initialization for the install tool. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/install.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os -import shutil -import stat - -import SCons.Action -from SCons.Util import make_path_relative - -# -# We keep track of *all* installed files. -_INSTALLED_FILES = [] -_UNIQUE_INSTALLED_FILES = None - -class CopytreeError(EnvironmentError): - pass - -# This is a patched version of shutil.copytree from python 2.5. It -# doesn't fail if the dir exists, which regular copytree does -# (annoyingly). Note the XXX comment in the docstring. -def scons_copytree(src, dst, symlinks=False): - """Recursively copy a directory tree using copy2(). - - The destination directory must not already exist. - If exception(s) occur, an CopytreeError is raised with a list of reasons. - - If the optional symlinks flag is true, symbolic links in the - source tree result in symbolic links in the destination tree; if - it is false, the contents of the files pointed to by symbolic - links are copied. - - XXX Consider this example code rather than the ultimate tool. - - """ - names = os.listdir(src) - # garyo@genarts.com fix: check for dir before making dirs. - if not os.path.exists(dst): - os.makedirs(dst) - errors = [] - for name in names: - srcname = os.path.join(src, name) - dstname = os.path.join(dst, name) - try: - if symlinks and os.path.islink(srcname): - linkto = os.readlink(srcname) - os.symlink(linkto, dstname) - elif os.path.isdir(srcname): - scons_copytree(srcname, dstname, symlinks) - else: - shutil.copy2(srcname, dstname) - # XXX What about devices, sockets etc.? - except (IOError, os.error), why: - errors.append((srcname, dstname, str(why))) - # catch the CopytreeError from the recursive copytree so that we can - # continue with other files - except CopytreeError, err: - errors.extend(err.args[0]) - try: - shutil.copystat(src, dst) - except WindowsError: - # can't copy file access times on Windows - pass - except OSError, why: - errors.extend((src, dst, str(why))) - if errors: - raise CopytreeError, errors - - -# -# Functions doing the actual work of the Install Builder. -# -def copyFunc(dest, source, env): - """Install a source file or directory into a destination by copying, - (including copying permission/mode bits).""" - - if os.path.isdir(source): - if os.path.exists(dest): - if not os.path.isdir(dest): - raise SCons.Errors.UserError("cannot overwrite non-directory `%s' with a directory `%s'" % (str(dest), str(source))) - else: - parent = os.path.split(dest)[0] - if not os.path.exists(parent): - os.makedirs(parent) - scons_copytree(source, dest) - else: - shutil.copy2(source, dest) - st = os.stat(source) - os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE) - - return 0 - -def installFunc(target, source, env): - """Install a source file into a target using the function specified - as the INSTALL construction variable.""" - try: - install = env['INSTALL'] - except KeyError: - raise SCons.Errors.UserError('Missing INSTALL construction variable.') - - assert len(target)==len(source), \ - "Installing source %s into target %s: target and source lists must have same length."%(list(map(str, source)), list(map(str, target))) - for t,s in zip(target,source): - if install(t.get_path(),s.get_path(),env): - return 1 - - return 0 - -def stringFunc(target, source, env): - installstr = env.get('INSTALLSTR') - if installstr: - return env.subst_target_source(installstr, 0, target, source) - target = str(target[0]) - source = str(source[0]) - if os.path.isdir(source): - type = 'directory' - else: - type = 'file' - return 'Install %s: "%s" as "%s"' % (type, source, target) - -# -# Emitter functions -# -def add_targets_to_INSTALLED_FILES(target, source, env): - """ an emitter that adds all target files to the list stored in the - _INSTALLED_FILES global variable. This way all installed files of one - scons call will be collected. - """ - global _INSTALLED_FILES, _UNIQUE_INSTALLED_FILES - _INSTALLED_FILES.extend(target) - _UNIQUE_INSTALLED_FILES = None - return (target, source) - -class DESTDIR_factory(object): - """ a node factory, where all files will be relative to the dir supplied - in the constructor. - """ - def __init__(self, env, dir): - self.env = env - self.dir = env.arg2nodes( dir, env.fs.Dir )[0] - - def Entry(self, name): - name = make_path_relative(name) - return self.dir.Entry(name) - - def Dir(self, name): - name = make_path_relative(name) - return self.dir.Dir(name) - -# -# The Builder Definition -# -install_action = SCons.Action.Action(installFunc, stringFunc) -installas_action = SCons.Action.Action(installFunc, stringFunc) - -BaseInstallBuilder = None - -def InstallBuilderWrapper(env, target=None, source=None, dir=None, **kw): - if target and dir: - import SCons.Errors - raise SCons.Errors.UserError("Both target and dir defined for Install(), only one may be defined.") - if not dir: - dir=target - - import SCons.Script - install_sandbox = SCons.Script.GetOption('install_sandbox') - if install_sandbox: - target_factory = DESTDIR_factory(env, install_sandbox) - else: - target_factory = env.fs - - try: - dnodes = env.arg2nodes(dir, target_factory.Dir) - except TypeError: - raise SCons.Errors.UserError("Target `%s' of Install() is a file, but should be a directory. Perhaps you have the Install() arguments backwards?" % str(dir)) - sources = env.arg2nodes(source, env.fs.Entry) - tgt = [] - for dnode in dnodes: - for src in sources: - # Prepend './' so the lookup doesn't interpret an initial - # '#' on the file name portion as meaning the Node should - # be relative to the top-level SConstruct directory. - target = env.fs.Entry('.'+os.sep+src.name, dnode) - #tgt.extend(BaseInstallBuilder(env, target, src, **kw)) - tgt.extend(BaseInstallBuilder(env, target, src, **kw)) - return tgt - -def InstallAsBuilderWrapper(env, target=None, source=None, **kw): - result = [] - for src, tgt in map(lambda x, y: (x, y), source, target): - #result.extend(BaseInstallBuilder(env, tgt, src, **kw)) - result.extend(BaseInstallBuilder(env, tgt, src, **kw)) - return result - -added = None - -def generate(env): - - from SCons.Script import AddOption, GetOption - global added - if not added: - added = 1 - AddOption('--install-sandbox', - dest='install_sandbox', - type="string", - action="store", - help='A directory under which all installed files will be placed.') - - global BaseInstallBuilder - if BaseInstallBuilder is None: - install_sandbox = GetOption('install_sandbox') - if install_sandbox: - target_factory = DESTDIR_factory(env, install_sandbox) - else: - target_factory = env.fs - - BaseInstallBuilder = SCons.Builder.Builder( - action = install_action, - target_factory = target_factory.Entry, - source_factory = env.fs.Entry, - multi = 1, - emitter = [ add_targets_to_INSTALLED_FILES, ], - name = 'InstallBuilder') - - env['BUILDERS']['_InternalInstall'] = InstallBuilderWrapper - env['BUILDERS']['_InternalInstallAs'] = InstallAsBuilderWrapper - - # We'd like to initialize this doing something like the following, - # but there isn't yet support for a ${SOURCE.type} expansion that - # will print "file" or "directory" depending on what's being - # installed. For now we punt by not initializing it, and letting - # the stringFunc() that we put in the action fall back to the - # hand-crafted default string if it's not set. - # - #try: - # env['INSTALLSTR'] - #except KeyError: - # env['INSTALLSTR'] = 'Install ${SOURCE.type}: "$SOURCES" as "$TARGETS"' - - try: - env['INSTALL'] - except KeyError: - env['INSTALL'] = copyFunc - -def exists(env): - return 1 - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/intelc.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/intelc.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/intelc.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/intelc.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,522 +0,0 @@ -"""SCons.Tool.icl - -Tool-specific initialization for the Intel C/C++ compiler. -Supports Linux and Windows compilers, v7 and up. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -from __future__ import division - -__revision__ = "src/engine/SCons/Tool/intelc.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import math, sys, os.path, glob, string, re - -is_windows = sys.platform == 'win32' -is_win64 = is_windows and (os.environ['PROCESSOR_ARCHITECTURE'] == 'AMD64' or - ('PROCESSOR_ARCHITEW6432' in os.environ and - os.environ['PROCESSOR_ARCHITEW6432'] == 'AMD64')) -is_linux = sys.platform.startswith('linux') -is_mac = sys.platform == 'darwin' - -if is_windows: - import SCons.Tool.msvc -elif is_linux: - import SCons.Tool.gcc -elif is_mac: - import SCons.Tool.gcc -import SCons.Util -import SCons.Warnings - -# Exceptions for this tool -class IntelCError(SCons.Errors.InternalError): - pass -class MissingRegistryError(IntelCError): # missing registry entry - pass -class MissingDirError(IntelCError): # dir not found - pass -class NoRegistryModuleError(IntelCError): # can't read registry at all - pass - -def uniquify(s): - """Return a sequence containing only one copy of each unique element from input sequence s. - Does not preserve order. - Input sequence must be hashable (i.e. must be usable as a dictionary key).""" - u = {} - for x in s: - u[x] = 1 - return list(u.keys()) - -def linux_ver_normalize(vstr): - """Normalize a Linux compiler version number. - Intel changed from "80" to "9.0" in 2005, so we assume if the number - is greater than 60 it's an old-style number and otherwise new-style. - Always returns an old-style float like 80 or 90 for compatibility with Windows. - Shades of Y2K!""" - # Check for version number like 9.1.026: return 91.026 - m = re.match(r'([0-9]+)\.([0-9]+)\.([0-9]+)', vstr) - if m: - vmaj,vmin,build = m.groups() - return float(vmaj) * 10. + float(vmin) + float(build) / 1000.; - else: - f = float(vstr) - if is_windows: - return f - else: - if f < 60: return f * 10.0 - else: return f - -def check_abi(abi): - """Check for valid ABI (application binary interface) name, - and map into canonical one""" - if not abi: - return None - abi = abi.lower() - # valid_abis maps input name to canonical name - if is_windows: - valid_abis = {'ia32' : 'ia32', - 'x86' : 'ia32', - 'ia64' : 'ia64', - 'em64t' : 'em64t', - 'amd64' : 'em64t'} - if is_linux: - valid_abis = {'ia32' : 'ia32', - 'x86' : 'ia32', - 'x86_64' : 'x86_64', - 'em64t' : 'x86_64', - 'amd64' : 'x86_64'} - if is_mac: - valid_abis = {'ia32' : 'ia32', - 'x86' : 'ia32', - 'x86_64' : 'x86_64', - 'em64t' : 'x86_64'} - try: - abi = valid_abis[abi] - except KeyError: - raise SCons.Errors.UserError("Intel compiler: Invalid ABI %s, valid values are %s"% \ - (abi, list(valid_abis.keys()))) - return abi - -def vercmp(a, b): - """Compare strings as floats, - but Intel changed Linux naming convention at 9.0""" - return cmp(linux_ver_normalize(b), linux_ver_normalize(a)) - -def get_version_from_list(v, vlist): - """See if we can match v (string) in vlist (list of strings) - Linux has to match in a fuzzy way.""" - if is_windows: - # Simple case, just find it in the list - if v in vlist: return v - else: return None - else: - # Fuzzy match: normalize version number first, but still return - # original non-normalized form. - fuzz = 0.001 - for vi in vlist: - if math.fabs(linux_ver_normalize(vi) - linux_ver_normalize(v)) < fuzz: - return vi - # Not found - return None - -def get_intel_registry_value(valuename, version=None, abi=None): - """ - Return a value from the Intel compiler registry tree. (Windows only) - """ - # Open the key: - if is_win64: - K = 'Software\\Wow6432Node\\Intel\\Compilers\\C++\\' + version + '\\'+abi.upper() - else: - K = 'Software\\Intel\\Compilers\\C++\\' + version + '\\'+abi.upper() - try: - k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, K) - except SCons.Util.RegError: - raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi)) - - # Get the value: - try: - v = SCons.Util.RegQueryValueEx(k, valuename)[0] - return v # or v.encode('iso-8859-1', 'replace') to remove unicode? - except SCons.Util.RegError: - raise MissingRegistryError("%s\\%s was not found in the registry."%(K, valuename)) - - -def get_all_compiler_versions(): - """Returns a sorted list of strings, like "70" or "80" or "9.0" - with most recent compiler version first. - """ - versions=[] - if is_windows: - if is_win64: - keyname = 'Software\\WoW6432Node\\Intel\\Compilers\\C++' - else: - keyname = 'Software\\Intel\\Compilers\\C++' - try: - k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, - keyname) - except WindowsError: - return [] - i = 0 - versions = [] - try: - while i < 100: - subkey = SCons.Util.RegEnumKey(k, i) # raises EnvironmentError - # Check that this refers to an existing dir. - # This is not 100% perfect but should catch common - # installation issues like when the compiler was installed - # and then the install directory deleted or moved (rather - # than uninstalling properly), so the registry values - # are still there. - ok = False - for try_abi in ('IA32', 'IA32e', 'IA64', 'EM64T'): - try: - d = get_intel_registry_value('ProductDir', subkey, try_abi) - except MissingRegistryError: - continue # not found in reg, keep going - if os.path.exists(d): ok = True - if ok: - versions.append(subkey) - else: - try: - # Registry points to nonexistent dir. Ignore this - # version. - value = get_intel_registry_value('ProductDir', subkey, 'IA32') - except MissingRegistryError, e: - - # Registry key is left dangling (potentially - # after uninstalling). - - print \ - "scons: *** Ignoring the registry key for the Intel compiler version %s.\n" \ - "scons: *** It seems that the compiler was uninstalled and that the registry\n" \ - "scons: *** was not cleaned up properly.\n" % subkey - else: - print "scons: *** Ignoring "+str(value) - - i = i + 1 - except EnvironmentError: - # no more subkeys - pass - elif is_linux: - for d in glob.glob('/opt/intel_cc_*'): - # Typical dir here is /opt/intel_cc_80. - m = re.search(r'cc_(.*)$', d) - if m: - versions.append(m.group(1)) - for d in glob.glob('/opt/intel/cc*/*'): - # Typical dir here is /opt/intel/cc/9.0 for IA32, - # /opt/intel/cce/9.0 for EMT64 (AMD64) - m = re.search(r'([0-9][0-9.]*)$', d) - if m: - versions.append(m.group(1)) - for d in glob.glob('/opt/intel/Compiler/*'): - # Typical dir here is /opt/intel/Compiler/11.1 - m = re.search(r'([0-9][0-9.]*)$', d) - if m: - versions.append(m.group(1)) - elif is_mac: - for d in glob.glob('/opt/intel/cc*/*'): - # Typical dir here is /opt/intel/cc/9.0 for IA32, - # /opt/intel/cce/9.0 for EMT64 (AMD64) - m = re.search(r'([0-9][0-9.]*)$', d) - if m: - versions.append(m.group(1)) - def keyfunc(str): - """Given a dot-separated version string, return a tuple of ints representing it.""" - return [int(x) for x in str.split('.')] - # split into ints, sort, then remove dups - return sorted(uniquify(versions), key=keyfunc, reverse=True) - -def get_intel_compiler_top(version, abi): - """ - Return the main path to the top-level dir of the Intel compiler, - using the given version. - The compiler will be in /bin/icl.exe (icc on linux), - the include dir is /include, etc. - """ - - if is_windows: - if not SCons.Util.can_read_reg: - raise NoRegistryModuleError("No Windows registry module was found") - top = get_intel_registry_value('ProductDir', version, abi) - # pre-11, icl was in Bin. 11 and later, it's in Bin/ apparently. - if not os.path.exists(os.path.join(top, "Bin", "icl.exe")) \ - and not os.path.exists(os.path.join(top, "Bin", abi, "icl.exe")): - raise MissingDirError("Can't find Intel compiler in %s"%(top)) - elif is_mac or is_linux: - def find_in_2008style_dir(version): - # first dir is new (>=9.0) style, second is old (8.0) style. - dirs=('/opt/intel/cc/%s', '/opt/intel_cc_%s') - if abi == 'x86_64': - dirs=('/opt/intel/cce/%s',) # 'e' stands for 'em64t', aka x86_64 aka amd64 - top=None - for d in dirs: - if os.path.exists(os.path.join(d%version, "bin", "icc")): - top = d%version - break - return top - def find_in_2010style_dir(version): - dirs=('/opt/intel/Compiler/%s/*'%version) - # typically /opt/intel/Compiler/11.1/064 (then bin/intel64/icc) - dirs=glob.glob(dirs) - # find highest sub-version number by reverse sorting and picking first existing one. - dirs.sort() - dirs.reverse() - top=None - for d in dirs: - if (os.path.exists(os.path.join(d, "bin", "ia32", "icc")) or - os.path.exists(os.path.join(d, "bin", "intel64", "icc"))): - top = d - break - return top - top = find_in_2010style_dir(version) or find_in_2008style_dir(version) - print "INTELC: top=",top - if not top: - raise MissingDirError("Can't find version %s Intel compiler in %s (abi='%s')"%(version,top, abi)) - return top - - -def generate(env, version=None, abi=None, topdir=None, verbose=0): - """Add Builders and construction variables for Intel C/C++ compiler - to an Environment. - args: - version: (string) compiler version to use, like "80" - abi: (string) 'win32' or whatever Itanium version wants - topdir: (string) compiler top dir, like - "c:\Program Files\Intel\Compiler70" - If topdir is used, version and abi are ignored. - verbose: (int) if >0, prints compiler version used. - """ - if not (is_mac or is_linux or is_windows): - # can't handle this platform - return - - if is_windows: - SCons.Tool.msvc.generate(env) - elif is_linux: - SCons.Tool.gcc.generate(env) - elif is_mac: - SCons.Tool.gcc.generate(env) - - # if version is unspecified, use latest - vlist = get_all_compiler_versions() - if not version: - if vlist: - version = vlist[0] - else: - # User may have specified '90' but we need to get actual dirname '9.0'. - # get_version_from_list does that mapping. - v = get_version_from_list(version, vlist) - if not v: - raise SCons.Errors.UserError("Invalid Intel compiler version %s: "%version + \ - "installed versions are %s"%(', '.join(vlist))) - version = v - - # if abi is unspecified, use ia32 - # alternatives are ia64 for Itanium, or amd64 or em64t or x86_64 (all synonyms here) - abi = check_abi(abi) - if abi is None: - if is_mac or is_linux: - # Check if we are on 64-bit linux, default to 64 then. - uname_m = os.uname()[4] - if uname_m == 'x86_64': - abi = 'x86_64' - else: - abi = 'ia32' - else: - if is_win64: - abi = 'em64t' - else: - abi = 'ia32' - - if version and not topdir: - try: - topdir = get_intel_compiler_top(version, abi) - except (SCons.Util.RegError, IntelCError): - topdir = None - - if not topdir: - # Normally this is an error, but it might not be if the compiler is - # on $PATH and the user is importing their env. - class ICLTopDirWarning(SCons.Warnings.Warning): - pass - if (is_mac or is_linux) and not env.Detect('icc') or \ - is_windows and not env.Detect('icl'): - - SCons.Warnings.enableWarningClass(ICLTopDirWarning) - SCons.Warnings.warn(ICLTopDirWarning, - "Failed to find Intel compiler for version='%s', abi='%s'"% - (str(version), str(abi))) - else: - # should be cleaned up to say what this other version is - # since in this case we have some other Intel compiler installed - SCons.Warnings.enableWarningClass(ICLTopDirWarning) - SCons.Warnings.warn(ICLTopDirWarning, - "Can't find Intel compiler top dir for version='%s', abi='%s'"% - (str(version), str(abi))) - - if topdir: - archdir={'x86_64': 'intel64', - 'amd64' : 'intel64', - 'em64t' : 'intel64', - 'x86' : 'ia32', - 'i386' : 'ia32', - 'ia32' : 'ia32' - }[abi] # for v11 and greater - if os.path.exists(os.path.join(topdir, 'bin', archdir)): - bindir="bin/%s"%archdir - libdir="lib/%s"%archdir - else: - bindir="bin" - libdir="lib" - if verbose: - print "Intel C compiler: using version %s (%g), abi %s, in '%s/%s'"%\ - (repr(version), linux_ver_normalize(version),abi,topdir,bindir) - if is_linux: - # Show the actual compiler version by running the compiler. - os.system('%s/%s/icc --version'%(topdir,bindir)) - if is_mac: - # Show the actual compiler version by running the compiler. - os.system('%s/%s/icc --version'%(topdir,bindir)) - - env['INTEL_C_COMPILER_TOP'] = topdir - if is_linux: - paths={'INCLUDE' : 'include', - 'LIB' : libdir, - 'PATH' : bindir, - 'LD_LIBRARY_PATH' : libdir} - for p in paths.keys(): - env.PrependENVPath(p, os.path.join(topdir, paths[p])) - if is_mac: - paths={'INCLUDE' : 'include', - 'LIB' : libdir, - 'PATH' : bindir, - 'LD_LIBRARY_PATH' : libdir} - for p in paths.keys(): - env.PrependENVPath(p, os.path.join(topdir, paths[p])) - if is_windows: - # env key reg valname default subdir of top - paths=(('INCLUDE', 'IncludeDir', 'Include'), - ('LIB' , 'LibDir', 'Lib'), - ('PATH' , 'BinDir', 'Bin')) - # We are supposed to ignore version if topdir is set, so set - # it to the emptry string if it's not already set. - if version is None: - version = '' - # Each path has a registry entry, use that or default to subdir - for p in paths: - try: - path=get_intel_registry_value(p[1], version, abi) - # These paths may have $(ICInstallDir) - # which needs to be substituted with the topdir. - path=path.replace('$(ICInstallDir)', topdir + os.sep) - except IntelCError: - # Couldn't get it from registry: use default subdir of topdir - env.PrependENVPath(p[0], os.path.join(topdir, p[2])) - else: - env.PrependENVPath(p[0], path.split(os.pathsep)) - # print "ICL %s: %s, final=%s"%(p[0], path, str(env['ENV'][p[0]])) - - if is_windows: - env['CC'] = 'icl' - env['CXX'] = 'icl' - env['LINK'] = 'xilink' - else: - env['CC'] = 'icc' - env['CXX'] = 'icpc' - # Don't reset LINK here; - # use smart_link which should already be here from link.py. - #env['LINK'] = '$CC' - env['AR'] = 'xiar' - env['LD'] = 'xild' # not used by default - - # This is not the exact (detailed) compiler version, - # just the major version as determined above or specified - # by the user. It is a float like 80 or 90, in normalized form for Linux - # (i.e. even for Linux 9.0 compiler, still returns 90 rather than 9.0) - if version: - env['INTEL_C_COMPILER_VERSION']=linux_ver_normalize(version) - - if is_windows: - # Look for license file dir - # in system environment, registry, and default location. - envlicdir = os.environ.get("INTEL_LICENSE_FILE", '') - K = ('SOFTWARE\Intel\Licenses') - try: - k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, K) - reglicdir = SCons.Util.RegQueryValueEx(k, "w_cpp")[0] - except (AttributeError, SCons.Util.RegError): - reglicdir = "" - defaultlicdir = r'C:\Program Files\Common Files\Intel\Licenses' - - licdir = None - for ld in [envlicdir, reglicdir]: - # If the string contains an '@', then assume it's a network - # license (port@system) and good by definition. - if ld and (ld.find('@') != -1 or os.path.exists(ld)): - licdir = ld - break - if not licdir: - licdir = defaultlicdir - if not os.path.exists(licdir): - class ICLLicenseDirWarning(SCons.Warnings.Warning): - pass - SCons.Warnings.enableWarningClass(ICLLicenseDirWarning) - SCons.Warnings.warn(ICLLicenseDirWarning, - "Intel license dir was not found." - " Tried using the INTEL_LICENSE_FILE environment variable (%s), the registry (%s) and the default path (%s)." - " Using the default path as a last resort." - % (envlicdir, reglicdir, defaultlicdir)) - env['ENV']['INTEL_LICENSE_FILE'] = licdir - -def exists(env): - if not (is_mac or is_linux or is_windows): - # can't handle this platform - return 0 - - try: - versions = get_all_compiler_versions() - except (SCons.Util.RegError, IntelCError): - versions = None - detected = versions is not None and len(versions) > 0 - if not detected: - # try env.Detect, maybe that will work - if is_windows: - return env.Detect('icl') - elif is_linux: - return env.Detect('icc') - elif is_mac: - return env.Detect('icc') - return detected - -# end of file - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/ipkg.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/ipkg.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/ipkg.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/ipkg.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -"""SCons.Tool.ipkg - -Tool-specific initialization for ipkg. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -The ipkg tool calls the ipkg-build. Its only argument should be the -packages fake_root. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/ipkg.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os - -import SCons.Builder - -def generate(env): - """Add Builders and construction variables for ipkg to an Environment.""" - try: - bld = env['BUILDERS']['Ipkg'] - except KeyError: - bld = SCons.Builder.Builder( action = '$IPKGCOM', - suffix = '$IPKGSUFFIX', - source_scanner = None, - target_scanner = None) - env['BUILDERS']['Ipkg'] = bld - - env['IPKG'] = 'ipkg-build' - env['IPKGCOM'] = '$IPKG $IPKGFLAGS ${SOURCE}' - env['IPKGUSER'] = os.popen('id -un').read().strip() - env['IPKGGROUP'] = os.popen('id -gn').read().strip() - env['IPKGFLAGS'] = SCons.Util.CLVar('-o $IPKGUSER -g $IPKGGROUP') - env['IPKGSUFFIX'] = '.ipk' - -def exists(env): - return env.Detect('ipkg-build') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/jar.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/jar.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/jar.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/jar.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,116 +0,0 @@ -"""SCons.Tool.jar - -Tool-specific initialization for jar. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/jar.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Subst -import SCons.Util - -def jarSources(target, source, env, for_signature): - """Only include sources that are not a manifest file.""" - try: - env['JARCHDIR'] - except KeyError: - jarchdir_set = False - else: - jarchdir_set = True - jarchdir = env.subst('$JARCHDIR', target=target, source=source) - if jarchdir: - jarchdir = env.fs.Dir(jarchdir) - result = [] - for src in source: - contents = src.get_text_contents() - if contents[:16] != "Manifest-Version": - if jarchdir_set: - _chdir = jarchdir - else: - try: - _chdir = src.attributes.java_classdir - except AttributeError: - _chdir = None - if _chdir: - # If we are changing the dir with -C, then sources should - # be relative to that directory. - src = SCons.Subst.Literal(src.get_path(_chdir)) - result.append('-C') - result.append(_chdir) - result.append(src) - return result - -def jarManifest(target, source, env, for_signature): - """Look in sources for a manifest file, if any.""" - for src in source: - contents = src.get_text_contents() - if contents[:16] == "Manifest-Version": - return src - return '' - -def jarFlags(target, source, env, for_signature): - """If we have a manifest, make sure that the 'm' - flag is specified.""" - jarflags = env.subst('$JARFLAGS', target=target, source=source) - for src in source: - contents = src.get_text_contents() - if contents[:16] == "Manifest-Version": - if not 'm' in jarflags: - return jarflags + 'm' - break - return jarflags - -def generate(env): - """Add Builders and construction variables for jar to an Environment.""" - SCons.Tool.CreateJarBuilder(env) - - env['JAR'] = 'jar' - env['JARFLAGS'] = SCons.Util.CLVar('cf') - env['_JARFLAGS'] = jarFlags - env['_JARMANIFEST'] = jarManifest - env['_JARSOURCES'] = jarSources - env['_JARCOM'] = '$JAR $_JARFLAGS $TARGET $_JARMANIFEST $_JARSOURCES' - env['JARCOM'] = "${TEMPFILE('$_JARCOM')}" - env['JARSUFFIX'] = '.jar' - -def exists(env): - # As reported by Jan Nijtmans in issue #2730, the simple - # return env.Detect('jar') - # doesn't always work during initialization. For now, we - # stop trying to detect an executable (analogous to the - # javac Builder). - # TODO: Come up with a proper detect() routine...and enable it. - return 1 - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/javac.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/javac.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/javac.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/javac.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,232 +0,0 @@ -"""SCons.Tool.javac - -Tool-specific initialization for javac. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/javac.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os -import os.path - -import SCons.Action -import SCons.Builder -from SCons.Node.FS import _my_normcase -from SCons.Tool.JavaCommon import parse_java_file -import SCons.Util - -def classname(path): - """Turn a string (path name) into a Java class name.""" - return os.path.normpath(path).replace(os.sep, '.') - -def emit_java_classes(target, source, env): - """Create and return lists of source java files - and their corresponding target class files. - """ - java_suffix = env.get('JAVASUFFIX', '.java') - class_suffix = env.get('JAVACLASSSUFFIX', '.class') - - target[0].must_be_same(SCons.Node.FS.Dir) - classdir = target[0] - - s = source[0].rentry().disambiguate() - if isinstance(s, SCons.Node.FS.File): - sourcedir = s.dir.rdir() - elif isinstance(s, SCons.Node.FS.Dir): - sourcedir = s.rdir() - else: - raise SCons.Errors.UserError("Java source must be File or Dir, not '%s'" % s.__class__) - - slist = [] - js = _my_normcase(java_suffix) - for entry in source: - entry = entry.rentry().disambiguate() - if isinstance(entry, SCons.Node.FS.File): - slist.append(entry) - elif isinstance(entry, SCons.Node.FS.Dir): - result = SCons.Util.OrderedDict() - dirnode = entry.rdir() - def find_java_files(arg, dirpath, filenames): - java_files = sorted([n for n in filenames - if _my_normcase(n).endswith(js)]) - mydir = dirnode.Dir(dirpath) - java_paths = [mydir.File(f) for f in java_files] - for jp in java_paths: - arg[jp] = True - for dirpath, dirnames, filenames in os.walk(dirnode.get_abspath()): - find_java_files(result, dirpath, filenames) - entry.walk(find_java_files, result) - - slist.extend(list(result.keys())) - else: - raise SCons.Errors.UserError("Java source must be File or Dir, not '%s'" % entry.__class__) - - version = env.get('JAVAVERSION', '1.4') - full_tlist = [] - for f in slist: - tlist = [] - source_file_based = True - pkg_dir = None - if not f.is_derived(): - pkg_dir, classes = parse_java_file(f.rfile().get_abspath(), version) - if classes: - source_file_based = False - if pkg_dir: - d = target[0].Dir(pkg_dir) - p = pkg_dir + os.sep - else: - d = target[0] - p = '' - for c in classes: - t = d.File(c + class_suffix) - t.attributes.java_classdir = classdir - t.attributes.java_sourcedir = sourcedir - t.attributes.java_classname = classname(p + c) - tlist.append(t) - - if source_file_based: - base = f.name[:-len(java_suffix)] - if pkg_dir: - t = target[0].Dir(pkg_dir).File(base + class_suffix) - else: - t = target[0].File(base + class_suffix) - t.attributes.java_classdir = classdir - t.attributes.java_sourcedir = f.dir - t.attributes.java_classname = classname(base) - tlist.append(t) - - for t in tlist: - t.set_specific_source([f]) - - full_tlist.extend(tlist) - - return full_tlist, slist - -JavaAction = SCons.Action.Action('$JAVACCOM', '$JAVACCOMSTR') - -JavaBuilder = SCons.Builder.Builder(action = JavaAction, - emitter = emit_java_classes, - target_factory = SCons.Node.FS.Entry, - source_factory = SCons.Node.FS.Entry) - -class pathopt(object): - """ - Callable object for generating javac-style path options from - a construction variable (e.g. -classpath, -sourcepath). - """ - def __init__(self, opt, var, default=None): - self.opt = opt - self.var = var - self.default = default - - def __call__(self, target, source, env, for_signature): - path = env[self.var] - if path and not SCons.Util.is_List(path): - path = [path] - if self.default: - default = env[self.default] - if default: - if not SCons.Util.is_List(default): - default = [default] - path = path + default - if path: - return [self.opt, os.pathsep.join(map(str, path))] - else: - return [] - -def Java(env, target, source, *args, **kw): - """ - A pseudo-Builder wrapper around the separate JavaClass{File,Dir} - Builders. - """ - if not SCons.Util.is_List(target): - target = [target] - if not SCons.Util.is_List(source): - source = [source] - - # Pad the target list with repetitions of the last element in the - # list so we have a target for every source element. - target = target + ([target[-1]] * (len(source) - len(target))) - - java_suffix = env.subst('$JAVASUFFIX') - result = [] - - for t, s in zip(target, source): - if isinstance(s, SCons.Node.FS.Base): - if isinstance(s, SCons.Node.FS.File): - b = env.JavaClassFile - else: - b = env.JavaClassDir - else: - if os.path.isfile(s): - b = env.JavaClassFile - elif os.path.isdir(s): - b = env.JavaClassDir - elif s[-len(java_suffix):] == java_suffix: - b = env.JavaClassFile - else: - b = env.JavaClassDir - result.extend(b(t, s, *args, **kw)) - - return result - -def generate(env): - """Add Builders and construction variables for javac to an Environment.""" - java_file = SCons.Tool.CreateJavaFileBuilder(env) - java_class = SCons.Tool.CreateJavaClassFileBuilder(env) - java_class_dir = SCons.Tool.CreateJavaClassDirBuilder(env) - java_class.add_emitter(None, emit_java_classes) - java_class.add_emitter(env.subst('$JAVASUFFIX'), emit_java_classes) - java_class_dir.emitter = emit_java_classes - - env.AddMethod(Java) - - env['JAVAC'] = 'javac' - env['JAVACFLAGS'] = SCons.Util.CLVar('') - env['JAVABOOTCLASSPATH'] = [] - env['JAVACLASSPATH'] = [] - env['JAVASOURCEPATH'] = [] - env['_javapathopt'] = pathopt - env['_JAVABOOTCLASSPATH'] = '${_javapathopt("-bootclasspath", "JAVABOOTCLASSPATH")} ' - env['_JAVACLASSPATH'] = '${_javapathopt("-classpath", "JAVACLASSPATH")} ' - env['_JAVASOURCEPATH'] = '${_javapathopt("-sourcepath", "JAVASOURCEPATH", "_JAVASOURCEPATHDEFAULT")} ' - env['_JAVASOURCEPATHDEFAULT'] = '${TARGET.attributes.java_sourcedir}' - env['_JAVACCOM'] = '$JAVAC $JAVACFLAGS $_JAVABOOTCLASSPATH $_JAVACLASSPATH -d ${TARGET.attributes.java_classdir} $_JAVASOURCEPATH $SOURCES' - env['JAVACCOM'] = "${TEMPFILE('$_JAVACCOM')}" - env['JAVACLASSSUFFIX'] = '.class' - env['JAVASUFFIX'] = '.java' - -def exists(env): - return 1 - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/javah.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/javah.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/javah.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/javah.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,137 +0,0 @@ -"""SCons.Tool.javah - -Tool-specific initialization for javah. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/javah.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path - -import SCons.Action -import SCons.Builder -import SCons.Node.FS -import SCons.Tool.javac -import SCons.Util - -def emit_java_headers(target, source, env): - """Create and return lists of Java stub header files that will - be created from a set of class files. - """ - class_suffix = env.get('JAVACLASSSUFFIX', '.class') - classdir = env.get('JAVACLASSDIR') - - if not classdir: - try: - s = source[0] - except IndexError: - classdir = '.' - else: - try: - classdir = s.attributes.java_classdir - except AttributeError: - classdir = '.' - classdir = env.Dir(classdir).rdir() - - if str(classdir) == '.': - c_ = None - else: - c_ = str(classdir) + os.sep - - slist = [] - for src in source: - try: - classname = src.attributes.java_classname - except AttributeError: - classname = str(src) - if c_ and classname[:len(c_)] == c_: - classname = classname[len(c_):] - if class_suffix and classname[-len(class_suffix):] == class_suffix: - classname = classname[:-len(class_suffix)] - classname = SCons.Tool.javac.classname(classname) - s = src.rfile() - s.attributes.java_classname = classname - slist.append(s) - - s = source[0].rfile() - if not hasattr(s.attributes, 'java_classdir'): - s.attributes.java_classdir = classdir - - if target[0].__class__ is SCons.Node.FS.File: - tlist = target - else: - if not isinstance(target[0], SCons.Node.FS.Dir): - target[0].__class__ = SCons.Node.FS.Dir - target[0]._morph() - tlist = [] - for s in source: - fname = s.attributes.java_classname.replace('.', '_') + '.h' - t = target[0].File(fname) - t.attributes.java_lookupdir = target[0] - tlist.append(t) - - return tlist, source - -def JavaHOutFlagGenerator(target, source, env, for_signature): - try: - t = target[0] - except (AttributeError, IndexError, TypeError): - t = target - try: - return '-d ' + str(t.attributes.java_lookupdir) - except AttributeError: - return '-o ' + str(t) - -def getJavaHClassPath(env,target, source, for_signature): - path = "${SOURCE.attributes.java_classdir}" - if 'JAVACLASSPATH' in env and env['JAVACLASSPATH']: - path = SCons.Util.AppendPath(path, env['JAVACLASSPATH']) - return "-classpath %s" % (path) - -def generate(env): - """Add Builders and construction variables for javah to an Environment.""" - java_javah = SCons.Tool.CreateJavaHBuilder(env) - java_javah.emitter = emit_java_headers - - env['_JAVAHOUTFLAG'] = JavaHOutFlagGenerator - env['JAVAH'] = 'javah' - env['JAVAHFLAGS'] = SCons.Util.CLVar('') - env['_JAVAHCLASSPATH'] = getJavaHClassPath - env['JAVAHCOM'] = '$JAVAH $JAVAHFLAGS $_JAVAHOUTFLAG $_JAVAHCLASSPATH ${SOURCES.attributes.java_classname}' - env['JAVACLASSSUFFIX'] = '.class' - -def exists(env): - return env.Detect('javah') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/latex.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/latex.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/latex.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/latex.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -"""SCons.Tool.latex - -Tool-specific initialization for LaTeX. -Generates .dvi files from .latex or .ltx files - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/latex.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Action -import SCons.Defaults -import SCons.Scanner.LaTeX -import SCons.Util -import SCons.Tool -import SCons.Tool.tex - -def LaTeXAuxFunction(target = None, source= None, env=None): - result = SCons.Tool.tex.InternalLaTeXAuxAction( SCons.Tool.tex.LaTeXAction, target, source, env ) - if result != 0: - SCons.Tool.tex.check_file_error_message(env['LATEX']) - return result - -LaTeXAuxAction = SCons.Action.Action(LaTeXAuxFunction, - strfunction=SCons.Tool.tex.TeXLaTeXStrFunction) - -def generate(env): - """Add Builders and construction variables for LaTeX to an Environment.""" - - env.AppendUnique(LATEXSUFFIXES=SCons.Tool.LaTeXSuffixes) - - import dvi - dvi.generate(env) - - import pdf - pdf.generate(env) - - bld = env['BUILDERS']['DVI'] - bld.add_action('.ltx', LaTeXAuxAction) - bld.add_action('.latex', LaTeXAuxAction) - bld.add_emitter('.ltx', SCons.Tool.tex.tex_eps_emitter) - bld.add_emitter('.latex', SCons.Tool.tex.tex_eps_emitter) - - SCons.Tool.tex.generate_common(env) - -def exists(env): - SCons.Tool.tex.generate_darwin(env) - return env.Detect('latex') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/lex.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/lex.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/lex.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/lex.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,97 +0,0 @@ -"""SCons.Tool.lex - -Tool-specific initialization for lex. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/lex.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path - -import SCons.Action -import SCons.Tool -import SCons.Util - -LexAction = SCons.Action.Action("$LEXCOM", "$LEXCOMSTR") - -def lexEmitter(target, source, env): - sourceBase, sourceExt = os.path.splitext(SCons.Util.to_String(source[0])) - - if sourceExt == ".lm": # If using Objective-C - target = [sourceBase + ".m"] # the extension is ".m". - - # This emitter essentially tries to add to the target all extra - # files generated by flex. - - # Different options that are used to trigger the creation of extra files. - fileGenOptions = ["--header-file=", "--tables-file="] - - lexflags = env.subst("$LEXFLAGS", target=target, source=source) - for option in SCons.Util.CLVar(lexflags): - for fileGenOption in fileGenOptions: - l = len(fileGenOption) - if option[:l] == fileGenOption: - # A file generating option is present, so add the - # file name to the target list. - fileName = option[l:].strip() - target.append(fileName) - return (target, source) - -def generate(env): - """Add Builders and construction variables for lex to an Environment.""" - c_file, cxx_file = SCons.Tool.createCFileBuilders(env) - - # C - c_file.add_action(".l", LexAction) - c_file.add_emitter(".l", lexEmitter) - - c_file.add_action(".lex", LexAction) - c_file.add_emitter(".lex", lexEmitter) - - # Objective-C - cxx_file.add_action(".lm", LexAction) - cxx_file.add_emitter(".lm", lexEmitter) - - # C++ - cxx_file.add_action(".ll", LexAction) - cxx_file.add_emitter(".ll", lexEmitter) - - env["LEX"] = env.Detect("flex") or "lex" - env["LEXFLAGS"] = SCons.Util.CLVar("") - env["LEXCOM"] = "$LEX $LEXFLAGS -t $SOURCES > $TARGET" - -def exists(env): - return env.Detect(["flex", "lex"]) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/link.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/link.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/link.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/link.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,122 +0,0 @@ -"""SCons.Tool.link - -Tool-specific initialization for the generic Posix linker. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/link.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Defaults -import SCons.Tool -import SCons.Util -import SCons.Warnings - -from SCons.Tool.FortranCommon import isfortran - -cplusplus = __import__('c++', globals(), locals(), []) - -issued_mixed_link_warning = False - -def smart_link(source, target, env, for_signature): - has_cplusplus = cplusplus.iscplusplus(source) - has_fortran = isfortran(env, source) - if has_cplusplus and has_fortran: - global issued_mixed_link_warning - if not issued_mixed_link_warning: - msg = "Using $CXX to link Fortran and C++ code together.\n\t" + \ - "This may generate a buggy executable if the '%s'\n\t" + \ - "compiler does not know how to deal with Fortran runtimes." - SCons.Warnings.warn(SCons.Warnings.FortranCxxMixWarning, - msg % env.subst('$CXX')) - issued_mixed_link_warning = True - return '$CXX' - elif has_fortran: - return '$FORTRAN' - elif has_cplusplus: - return '$CXX' - return '$CC' - -def shlib_emitter(target, source, env): - for tgt in target: - tgt.attributes.shared = 1 - return (target, source) - -def generate(env): - """Add Builders and construction variables for gnulink to an Environment.""" - SCons.Tool.createSharedLibBuilder(env) - SCons.Tool.createProgBuilder(env) - - env['SHLINK'] = '$LINK' - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') - env['SHLINKCOM'] = '$SHLINK -o $TARGET $SHLINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' - # don't set up the emitter, cause AppendUnique will generate a list - # starting with None :-( - env.Append(SHLIBEMITTER = [shlib_emitter]) - env['SMARTLINK'] = smart_link - env['LINK'] = "$SMARTLINK" - env['LINKFLAGS'] = SCons.Util.CLVar('') - # __RPATH is only set to something ($_RPATH typically) on platforms that support it. - env['LINKCOM'] = '$LINK -o $TARGET $LINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' - env['LIBDIRPREFIX']='-L' - env['LIBDIRSUFFIX']='' - env['_LIBFLAGS']='${_stripixes(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, LIBPREFIXES, LIBSUFFIXES, __env__)}' - env['LIBLINKPREFIX']='-l' - env['LIBLINKSUFFIX']='' - - if env['PLATFORM'] == 'hpux': - env['SHLIBSUFFIX'] = '.sl' - elif env['PLATFORM'] == 'aix': - env['SHLIBSUFFIX'] = '.a' - - # For most platforms, a loadable module is the same as a shared - # library. Platforms which are different can override these, but - # setting them the same means that LoadableModule works everywhere. - SCons.Tool.createLoadableModuleBuilder(env) - env['LDMODULE'] = '$SHLINK' - # don't set up the emitter, cause AppendUnique will generate a list - # starting with None :-( - env.Append(LDMODULEEMITTER='$SHLIBEMITTER') - env['LDMODULEPREFIX'] = '$SHLIBPREFIX' - env['LDMODULESUFFIX'] = '$SHLIBSUFFIX' - env['LDMODULEFLAGS'] = '$SHLINKFLAGS' - env['LDMODULECOM'] = '$LDMODULE -o $TARGET $LDMODULEFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' - - - -def exists(env): - # This module isn't really a Tool on its own, it's common logic for - # other linkers. - return None - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/linkloc.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/linkloc.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/linkloc.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/linkloc.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,112 +0,0 @@ -"""SCons.Tool.linkloc - -Tool specification for the LinkLoc linker for the Phar Lap ETS embedded -operating system. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/linkloc.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path -import re - -import SCons.Action -import SCons.Defaults -import SCons.Errors -import SCons.Tool -import SCons.Util - -from SCons.Tool.MSCommon import msvs_exists, merge_default_version -from SCons.Tool.PharLapCommon import addPharLapPaths - -_re_linker_command = re.compile(r'(\s)@\s*([^\s]+)') - -def repl_linker_command(m): - # Replaces any linker command file directives (e.g. "@foo.lnk") with - # the actual contents of the file. - try: - f=open(m.group(2), "r") - return m.group(1) + f.read() - except IOError: - # the linker should return an error if it can't - # find the linker command file so we will remain quiet. - # However, we will replace the @ with a # so we will not continue - # to find it with recursive substitution - return m.group(1) + '#' + m.group(2) - -class LinklocGenerator(object): - def __init__(self, cmdline): - self.cmdline = cmdline - - def __call__(self, env, target, source, for_signature): - if for_signature: - # Expand the contents of any linker command files recursively - subs = 1 - strsub = env.subst(self.cmdline, target=target, source=source) - while subs: - strsub, subs = _re_linker_command.subn(repl_linker_command, strsub) - return strsub - else: - return "${TEMPFILE('" + self.cmdline + "')}" - -def generate(env): - """Add Builders and construction variables for ar to an Environment.""" - SCons.Tool.createSharedLibBuilder(env) - SCons.Tool.createProgBuilder(env) - - env['SUBST_CMD_FILE'] = LinklocGenerator - env['SHLINK'] = '$LINK' - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS') - env['SHLINKCOM'] = '${SUBST_CMD_FILE("$SHLINK $SHLINKFLAGS $_LIBDIRFLAGS $_LIBFLAGS -dll $TARGET $SOURCES")}' - env['SHLIBEMITTER']= None - env['LINK'] = "linkloc" - env['LINKFLAGS'] = SCons.Util.CLVar('') - env['LINKCOM'] = '${SUBST_CMD_FILE("$LINK $LINKFLAGS $_LIBDIRFLAGS $_LIBFLAGS -exe $TARGET $SOURCES")}' - env['LIBDIRPREFIX']='-libpath ' - env['LIBDIRSUFFIX']='' - env['LIBLINKPREFIX']='-lib ' - env['LIBLINKSUFFIX']='$LIBSUFFIX' - - # Set-up ms tools paths for default version - merge_default_version(env) - - addPharLapPaths(env) - -def exists(env): - if msvs_exists(): - return env.Detect('linkloc') - else: - return 0 - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/m4.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/m4.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/m4.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/m4.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -"""SCons.Tool.m4 - -Tool-specific initialization for m4. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/m4.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Action -import SCons.Builder -import SCons.Util - -def generate(env): - """Add Builders and construction variables for m4 to an Environment.""" - M4Action = SCons.Action.Action('$M4COM', '$M4COMSTR') - bld = SCons.Builder.Builder(action = M4Action, src_suffix = '.m4') - - env['BUILDERS']['M4'] = bld - - # .m4 files might include other files, and it would be pretty hard - # to write a scanner for it, so let's just cd to the dir of the m4 - # file and run from there. - # The src_suffix setup is like so: file.c.m4 -> file.c, - # file.cpp.m4 -> file.cpp etc. - env['M4'] = 'm4' - env['M4FLAGS'] = SCons.Util.CLVar('-E') - env['M4COM'] = 'cd ${SOURCE.rsrcdir} && $M4 $M4FLAGS < ${SOURCE.file} > ${TARGET.abspath}' - -def exists(env): - return env.Detect('m4') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/masm.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/masm.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/masm.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/masm.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -"""SCons.Tool.masm - -Tool-specific initialization for the Microsoft Assembler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/masm.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Defaults -import SCons.Tool -import SCons.Util - -ASSuffixes = ['.s', '.asm', '.ASM'] -ASPPSuffixes = ['.spp', '.SPP', '.sx'] -if SCons.Util.case_sensitive_suffixes('.s', '.S'): - ASPPSuffixes.extend(['.S']) -else: - ASSuffixes.extend(['.S']) - -def generate(env): - """Add Builders and construction variables for masm to an Environment.""" - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - - for suffix in ASSuffixes: - static_obj.add_action(suffix, SCons.Defaults.ASAction) - shared_obj.add_action(suffix, SCons.Defaults.ASAction) - static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) - shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter) - - for suffix in ASPPSuffixes: - static_obj.add_action(suffix, SCons.Defaults.ASPPAction) - shared_obj.add_action(suffix, SCons.Defaults.ASPPAction) - static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) - shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter) - - env['AS'] = 'ml' - env['ASFLAGS'] = SCons.Util.CLVar('/nologo') - env['ASPPFLAGS'] = '$ASFLAGS' - env['ASCOM'] = '$AS $ASFLAGS /c /Fo$TARGET $SOURCES' - env['ASPPCOM'] = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c /Fo$TARGET $SOURCES' - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 - -def exists(env): - return env.Detect('ml') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/midl.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/midl.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/midl.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/midl.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,88 +0,0 @@ -"""SCons.Tool.midl - -Tool-specific initialization for midl (Microsoft IDL compiler). - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/midl.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Action -import SCons.Builder -import SCons.Defaults -import SCons.Scanner.IDL -import SCons.Util - -from MSCommon import msvc_exists - -def midl_emitter(target, source, env): - """Produces a list of outputs from the MIDL compiler""" - base, ext = SCons.Util.splitext(str(target[0])) - tlb = target[0] - incl = base + '.h' - interface = base + '_i.c' - t = [tlb, incl, interface] - - midlcom = env['MIDLCOM'] - - if midlcom.find('/proxy') != -1: - proxy = base + '_p.c' - t.append(proxy) - if midlcom.find('/dlldata') != -1: - dlldata = base + '_data.c' - t.append(dlldata) - - return (t,source) - -idl_scanner = SCons.Scanner.IDL.IDLScan() - -midl_action = SCons.Action.Action('$MIDLCOM', '$MIDLCOMSTR') - -midl_builder = SCons.Builder.Builder(action = midl_action, - src_suffix = '.idl', - suffix='.tlb', - emitter = midl_emitter, - source_scanner = idl_scanner) - -def generate(env): - """Add Builders and construction variables for midl to an Environment.""" - - env['MIDL'] = 'MIDL.EXE' - env['MIDLFLAGS'] = SCons.Util.CLVar('/nologo') - env['MIDLCOM'] = '$MIDL $MIDLFLAGS /tlb ${TARGETS[0]} /h ${TARGETS[1]} /iid ${TARGETS[2]} /proxy ${TARGETS[3]} /dlldata ${TARGETS[4]} $SOURCE 2> NUL' - env['BUILDERS']['TypeLibrary'] = midl_builder - -def exists(env): - return msvc_exists() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/mingw.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/mingw.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/mingw.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/mingw.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,179 +0,0 @@ -"""SCons.Tool.gcc - -Tool-specific initialization for MinGW (http://www.mingw.org/) - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/mingw.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os -import os.path - -import SCons.Action -import SCons.Builder -import SCons.Defaults -import SCons.Tool -import SCons.Util - -# This is what we search for to find mingw: -key_program = 'mingw32-gcc' - -def find(env): - # First search in the SCons path - path=env.WhereIs(key_program) - if (path): - return path - # then the OS path: - path=SCons.Util.WhereIs(key_program) - if (path): - return path - - # If that doesn't work try default location for mingw - save_path=env['ENV']['PATH'] - env.AppendENVPath('PATH',r'c:\MinGW\bin') - path =env.WhereIs(key_program) - if not path: - env['ENV']['PATH']=save_path - return path - -def shlib_generator(target, source, env, for_signature): - cmd = SCons.Util.CLVar(['$SHLINK', '$SHLINKFLAGS']) - - dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') - if dll: cmd.extend(['-o', dll]) - - cmd.extend(['$SOURCES', '$_LIBDIRFLAGS', '$_LIBFLAGS']) - - implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') - if implib: cmd.append('-Wl,--out-implib,'+implib.get_string(for_signature)) - - def_target = env.FindIxes(target, 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') - insert_def = env.subst("$WINDOWS_INSERT_DEF") - if not insert_def in ['', '0', 0] and def_target: \ - cmd.append('-Wl,--output-def,'+def_target.get_string(for_signature)) - - return [cmd] - -def shlib_emitter(target, source, env): - dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') - no_import_lib = env.get('no_import_lib', 0) - - if not dll: - raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX")) - - if not no_import_lib and \ - not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'): - - # Create list of target libraries as strings - targetStrings=env.ReplaceIxes(dll, - 'SHLIBPREFIX', 'SHLIBSUFFIX', - 'LIBPREFIX', 'LIBSUFFIX') - - # Now add file nodes to target list - target.append(env.fs.File(targetStrings)) - - # Append a def file target if there isn't already a def file target - # or a def file source or the user has explicitly asked for the target - # to be emitted. - def_source = env.FindIxes(source, 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') - def_target = env.FindIxes(target, 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') - skip_def_insert = env.subst("$WINDOWS_INSERT_DEF") in ['', '0', 0] - if not def_source and not def_target and not skip_def_insert: - # Create list of target libraries and def files as strings - targetStrings=env.ReplaceIxes(dll, - 'SHLIBPREFIX', 'SHLIBSUFFIX', - 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') - - # Now add file nodes to target list - target.append(env.fs.File(targetStrings)) - - return (target, source) - - -shlib_action = SCons.Action.Action(shlib_generator, generator=1) - -res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR') - -res_builder = SCons.Builder.Builder(action=res_action, suffix='.o', - source_scanner=SCons.Tool.SourceFileScanner) -SCons.Tool.SourceFileScanner.add_scanner('.rc', SCons.Defaults.CScan) - -def generate(env): - mingw = find(env) - if mingw: - dir = os.path.dirname(mingw) - env.PrependENVPath('PATH', dir ) - - - # Most of mingw is the same as gcc and friends... - gnu_tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas', 'm4'] - for tool in gnu_tools: - SCons.Tool.Tool(tool)(env) - - #... but a few things differ: - env['CC'] = 'gcc' - env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') - env['CXX'] = 'g++' - env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') - env['SHLINKCOM'] = shlib_action - env['LDMODULECOM'] = shlib_action - env.Append(SHLIBEMITTER = [shlib_emitter]) - env['AS'] = 'as' - - env['WIN32DEFPREFIX'] = '' - env['WIN32DEFSUFFIX'] = '.def' - env['WINDOWSDEFPREFIX'] = '${WIN32DEFPREFIX}' - env['WINDOWSDEFSUFFIX'] = '${WIN32DEFSUFFIX}' - - env['SHOBJSUFFIX'] = '.o' - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 - - env['RC'] = 'windres' - env['RCFLAGS'] = SCons.Util.CLVar('') - env['RCINCFLAGS'] = '$( ${_concat(RCINCPREFIX, CPPPATH, RCINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' - env['RCINCPREFIX'] = '--include-dir ' - env['RCINCSUFFIX'] = '' - env['RCCOM'] = '$RC $_CPPDEFFLAGS $RCINCFLAGS ${RCINCPREFIX} ${SOURCE.dir} $RCFLAGS -i $SOURCE -o $TARGET' - env['BUILDERS']['RES'] = res_builder - - # Some setting from the platform also have to be overridden: - env['OBJSUFFIX'] = '.o' - env['LIBPREFIX'] = 'lib' - env['LIBSUFFIX'] = '.a' - -def exists(env): - return find(env) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/msgfmt.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/msgfmt.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/msgfmt.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/msgfmt.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,102 +0,0 @@ -""" msgfmt tool """ - -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/msgfmt.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -from SCons.Builder import BuilderBase -############################################################################# -class _MOFileBuilder(BuilderBase): - """ The builder class for `MO` files. - - The reason for this builder to exists and its purpose is quite simillar - as for `_POFileBuilder`. This time, we extend list of sources, not targets, - and call `BuilderBase._execute()` only once (as we assume single-target - here). - """ - - def _execute(self, env, target, source, *args, **kw): - # Here we add support for 'LINGUAS_FILE' keyword. Emitter is not suitable - # in this case, as it is called too late (after multiple sources - # are handled single_source builder. - import SCons.Util - from SCons.Tool.GettextCommon import _read_linguas_from_files - linguas_files = None - if env.has_key('LINGUAS_FILE') and env['LINGUAS_FILE'] is not None: - linguas_files = env['LINGUAS_FILE'] - # This should prevent from endless recursion. - env['LINGUAS_FILE'] = None - # We read only languages. Suffixes shall be added automatically. - linguas = _read_linguas_from_files(env, linguas_files) - if SCons.Util.is_List(source): - source.extend(linguas) - elif source is not None: - source = [source] + linguas - else: - source = linguas - result = BuilderBase._execute(self,env,target,source,*args, **kw) - if linguas_files is not None: - env['LINGUAS_FILE'] = linguas_files - return result -############################################################################# - -############################################################################# -def _create_mo_file_builder(env, **kw): - """ Create builder object for `MOFiles` builder """ - import SCons.Action - # FIXME: What factory use for source? Ours or their? - kw['action'] = SCons.Action.Action('$MSGFMTCOM','$MSGFMTCOMSTR') - kw['suffix'] = '$MOSUFFIX' - kw['src_suffix'] = '$POSUFFIX' - kw['src_builder'] = '_POUpdateBuilder' - kw['single_source'] = True - return _MOFileBuilder(**kw) -############################################################################# - -############################################################################# -def generate(env,**kw): - """ Generate `msgfmt` tool """ - import SCons.Util - from SCons.Tool.GettextCommon import _detect_msgfmt - env['MSGFMT'] = _detect_msgfmt(env) - env.SetDefault( - MSGFMTFLAGS = [ SCons.Util.CLVar('-c') ], - MSGFMTCOM = '$MSGFMT $MSGFMTFLAGS -o $TARGET $SOURCE', - MSGFMTCOMSTR = '', - MOSUFFIX = ['.mo'], - POSUFFIX = ['.po'] - ) - env.Append( BUILDERS = { 'MOFiles' : _create_mo_file_builder(env) } ) -############################################################################# - -############################################################################# -def exists(env): - """ Check if the tool exists """ - from SCons.Tool.GettextCommon import _msgfmt_exists - return _msgfmt_exists(env) -############################################################################# - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/msginit.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/msginit.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/msginit.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/msginit.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,114 +0,0 @@ -""" msginit tool - -Tool specific initialization of msginit tool. -""" - -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/msginit.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Warnings -import SCons.Builder -import re - -############################################################################# -def _optional_no_translator_flag(env): - """ Return '--no-translator' flag if we run *msginit(1)* in non-interactive - mode.""" - import SCons.Util - if env.has_key('POAUTOINIT'): - autoinit = env['POAUTOINIT'] - else: - autoinit = False - if autoinit: - return [SCons.Util.CLVar('--no-translator')] - else: - return [SCons.Util.CLVar('')] -############################################################################# - -############################################################################# -def _POInitBuilder(env, **kw): - """ Create builder object for `POInit` builder. """ - import SCons.Action - from SCons.Tool.GettextCommon import _init_po_files, _POFileBuilder - action = SCons.Action.Action(_init_po_files, None) - return _POFileBuilder(env, action=action, target_alias='$POCREATE_ALIAS') -############################################################################# - -############################################################################# -from SCons.Environment import _null -############################################################################# -def _POInitBuilderWrapper(env, target=None, source=_null, **kw): - """ Wrapper for _POFileBuilder. We use it to make user's life easier. - - This wrapper checks for `$POTDOMAIN` construction variable (or override in - `**kw`) and treats it appropriatelly. - """ - if source is _null: - if 'POTDOMAIN' in kw: - domain = kw['POTDOMAIN'] - elif env.has_key('POTDOMAIN'): - domain = env['POTDOMAIN'] - else: - domain = 'messages' - source = [ domain ] # NOTE: Suffix shall be appended automatically - return env._POInitBuilder(target, source, **kw) -############################################################################# - -############################################################################# -def generate(env,**kw): - """ Generate the `msginit` tool """ - import SCons.Util - from SCons.Tool.GettextCommon import _detect_msginit - env['MSGINIT'] = _detect_msginit(env) - msginitcom = '$MSGINIT ${_MSGNoTranslator(__env__)} -l ${_MSGINITLOCALE}' \ - + ' $MSGINITFLAGS -i $SOURCE -o $TARGET' - # NOTE: We set POTSUFFIX here, in case the 'xgettext' is not loaded - # (sometimes we really don't need it) - env.SetDefault( - POSUFFIX = ['.po'], - POTSUFFIX = ['.pot'], - _MSGINITLOCALE = '${TARGET.filebase}', - _MSGNoTranslator = _optional_no_translator_flag, - MSGINITCOM = msginitcom, - MSGINITCOMSTR = '', - MSGINITFLAGS = [ ], - POAUTOINIT = False, - POCREATE_ALIAS = 'po-create' - ) - env.Append( BUILDERS = { '_POInitBuilder' : _POInitBuilder(env) } ) - env.AddMethod(_POInitBuilderWrapper, 'POInit') - env.AlwaysBuild(env.Alias('$POCREATE_ALIAS')) -############################################################################# - -############################################################################# -def exists(env): - """ Check if the tool exists """ - from SCons.Tool.GettextCommon import _msginit_exists - return _msginit_exists(env) -############################################################################# - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/msgmerge.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/msgmerge.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/msgmerge.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/msgmerge.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -""" msgmerget tool - -Tool specific initialization for `msgmerge` tool. -""" - -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/msgmerge.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -############################################################################# -def _update_or_init_po_files(target, source, env): - """ Action function for `POUpdate` builder """ - import SCons.Action - from SCons.Tool.GettextCommon import _init_po_files - for tgt in target: - if tgt.rexists(): - action = SCons.Action.Action('$MSGMERGECOM', '$MSGMERGECOMSTR') - else: - action = _init_po_files - status = action([tgt], source, env) - if status : return status - return 0 -############################################################################# - -############################################################################# -def _POUpdateBuilder(env, **kw): - """ Create an object of `POUpdate` builder """ - import SCons.Action - from SCons.Tool.GettextCommon import _POFileBuilder - action = SCons.Action.Action(_update_or_init_po_files, None) - return _POFileBuilder(env, action=action, target_alias='$POUPDATE_ALIAS') -############################################################################# - -############################################################################# -from SCons.Environment import _null -############################################################################# -def _POUpdateBuilderWrapper(env, target=None, source=_null, **kw): - """ Wrapper for `POUpdate` builder - make user's life easier """ - if source is _null: - if 'POTDOMAIN' in kw: - domain = kw['POTDOMAIN'] - elif env.has_key('POTDOMAIN') and env['POTDOMAIN']: - domain = env['POTDOMAIN'] - else: - domain = 'messages' - source = [ domain ] # NOTE: Suffix shall be appended automatically - return env._POUpdateBuilder(target, source, **kw) -############################################################################# - -############################################################################# -def generate(env,**kw): - """ Generate the `xgettext` tool """ - from SCons.Tool.GettextCommon import _detect_msgmerge - env['MSGMERGE'] = _detect_msgmerge(env) - env.SetDefault( - POTSUFFIX = ['.pot'], - POSUFFIX = ['.po'], - MSGMERGECOM = '$MSGMERGE $MSGMERGEFLAGS --update $TARGET $SOURCE', - MSGMERGECOMSTR = '', - MSGMERGEFLAGS = [ ], - POUPDATE_ALIAS = 'po-update' - ) - env.Append(BUILDERS = { '_POUpdateBuilder':_POUpdateBuilder(env) }) - env.AddMethod(_POUpdateBuilderWrapper, 'POUpdate') - env.AlwaysBuild(env.Alias('$POUPDATE_ALIAS')) -############################################################################# - -############################################################################# -def exists(env): - """ Check if the tool exists """ - from SCons.Tool.GettextCommon import _msgmerge_exists - return _msgmerge_exists(env) -############################################################################# - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/mslib.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/mslib.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/mslib.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/mslib.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -"""SCons.Tool.mslib - -Tool-specific initialization for lib (MicroSoft library archiver). - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/mslib.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Defaults -import SCons.Tool -import SCons.Tool.msvs -import SCons.Tool.msvc -import SCons.Util - -from MSCommon import msvc_exists, msvc_setup_env_once - -def generate(env): - """Add Builders and construction variables for lib to an Environment.""" - SCons.Tool.createStaticLibBuilder(env) - - # Set-up ms tools paths - msvc_setup_env_once(env) - - env['AR'] = 'lib' - env['ARFLAGS'] = SCons.Util.CLVar('/nologo') - env['ARCOM'] = "${TEMPFILE('$AR $ARFLAGS /OUT:$TARGET $SOURCES')}" - env['LIBPREFIX'] = '' - env['LIBSUFFIX'] = '.lib' - -def exists(env): - return msvc_exists() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/mslink.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/mslink.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/mslink.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/mslink.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,327 +0,0 @@ -"""SCons.Tool.mslink - -Tool-specific initialization for the Microsoft linker. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/mslink.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path - -import SCons.Action -import SCons.Defaults -import SCons.Errors -import SCons.Platform.win32 -import SCons.Tool -import SCons.Tool.msvc -import SCons.Tool.msvs -import SCons.Util - -from MSCommon import msvc_setup_env_once, msvc_exists - -def pdbGenerator(env, target, source, for_signature): - try: - return ['/PDB:%s' % target[0].attributes.pdb, '/DEBUG'] - except (AttributeError, IndexError): - return None - -def _dllTargets(target, source, env, for_signature, paramtp): - listCmd = [] - dll = env.FindIxes(target, '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp) - if dll: listCmd.append("/out:%s"%dll.get_string(for_signature)) - - implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') - if implib: listCmd.append("/implib:%s"%implib.get_string(for_signature)) - - return listCmd - -def _dllSources(target, source, env, for_signature, paramtp): - listCmd = [] - - deffile = env.FindIxes(source, "WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX") - for src in source: - # Check explicitly for a non-None deffile so that the __cmp__ - # method of the base SCons.Util.Proxy class used for some Node - # proxies doesn't try to use a non-existent __dict__ attribute. - if deffile and src == deffile: - # Treat this source as a .def file. - listCmd.append("/def:%s" % src.get_string(for_signature)) - else: - # Just treat it as a generic source file. - listCmd.append(src) - return listCmd - -def windowsShlinkTargets(target, source, env, for_signature): - return _dllTargets(target, source, env, for_signature, 'SHLIB') - -def windowsShlinkSources(target, source, env, for_signature): - return _dllSources(target, source, env, for_signature, 'SHLIB') - -def _windowsLdmodTargets(target, source, env, for_signature): - """Get targets for loadable modules.""" - return _dllTargets(target, source, env, for_signature, 'LDMODULE') - -def _windowsLdmodSources(target, source, env, for_signature): - """Get sources for loadable modules.""" - return _dllSources(target, source, env, for_signature, 'LDMODULE') - -def _dllEmitter(target, source, env, paramtp): - """Common implementation of dll emitter.""" - SCons.Tool.msvc.validate_vars(env) - - extratargets = [] - extrasources = [] - - dll = env.FindIxes(target, '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp) - no_import_lib = env.get('no_import_lib', 0) - - if not dll: - raise SCons.Errors.UserError('A shared library should have exactly one target with the suffix: %s' % env.subst('$%sSUFFIX' % paramtp)) - - insert_def = env.subst("$WINDOWS_INSERT_DEF") - if not insert_def in ['', '0', 0] and \ - not env.FindIxes(source, "WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX"): - - # append a def file to the list of sources - extrasources.append( - env.ReplaceIxes(dll, - '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp, - "WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX")) - - version_num, suite = SCons.Tool.msvs.msvs_parse_version(env.get('MSVS_VERSION', '6.0')) - if version_num >= 8.0 and \ - (env.get('WINDOWS_INSERT_MANIFEST', 0) or env.get('WINDOWS_EMBED_MANIFEST', 0)): - # MSVC 8 and above automatically generate .manifest files that must be installed - extratargets.append( - env.ReplaceIxes(dll, - '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp, - "WINDOWSSHLIBMANIFESTPREFIX", "WINDOWSSHLIBMANIFESTSUFFIX")) - - if 'PDB' in env and env['PDB']: - pdb = env.arg2nodes('$PDB', target=target, source=source)[0] - extratargets.append(pdb) - target[0].attributes.pdb = pdb - - if not no_import_lib and \ - not env.FindIxes(target, "LIBPREFIX", "LIBSUFFIX"): - # Append an import library to the list of targets. - extratargets.append( - env.ReplaceIxes(dll, - '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp, - "LIBPREFIX", "LIBSUFFIX")) - # and .exp file is created if there are exports from a DLL - extratargets.append( - env.ReplaceIxes(dll, - '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp, - "WINDOWSEXPPREFIX", "WINDOWSEXPSUFFIX")) - - return (target+extratargets, source+extrasources) - -def windowsLibEmitter(target, source, env): - return _dllEmitter(target, source, env, 'SHLIB') - -def ldmodEmitter(target, source, env): - """Emitter for loadable modules. - - Loadable modules are identical to shared libraries on Windows, but building - them is subject to different parameters (LDMODULE*). - """ - return _dllEmitter(target, source, env, 'LDMODULE') - -def prog_emitter(target, source, env): - SCons.Tool.msvc.validate_vars(env) - - extratargets = [] - extrasources = [] - - exe = env.FindIxes(target, "PROGPREFIX", "PROGSUFFIX") - if not exe: - raise SCons.Errors.UserError("An executable should have exactly one target with the suffix: %s" % env.subst("$PROGSUFFIX")) - - version_num, suite = SCons.Tool.msvs.msvs_parse_version(env.get('MSVS_VERSION', '6.0')) - if version_num >= 8.0 and \ - (env.get('WINDOWS_INSERT_MANIFEST', 0) or env.get('WINDOWS_EMBED_MANIFEST', 0)): - # MSVC 8 and above automatically generate .manifest files that have to be installed - extratargets.append( - env.ReplaceIxes(exe, - "PROGPREFIX", "PROGSUFFIX", - "WINDOWSPROGMANIFESTPREFIX", "WINDOWSPROGMANIFESTSUFFIX")) - - if 'PDB' in env and env['PDB']: - pdb = env.arg2nodes('$PDB', target=target, source=source)[0] - extratargets.append(pdb) - target[0].attributes.pdb = pdb - - if version_num >= 11.0 and env.get('PCH', 0): - # MSVC 11 and above need the PCH object file to be added to the link line, - # otherwise you get link error LNK2011. - pchobj = SCons.Util.splitext(str(env['PCH']))[0] + '.obj' - # print "prog_emitter, version %s, appending pchobj %s"%(version_num, pchobj) - if pchobj not in extrasources: - extrasources.append(pchobj) - - return (target+extratargets,source+extrasources) - -def RegServerFunc(target, source, env): - if 'register' in env and env['register']: - ret = regServerAction([target[0]], [source[0]], env) - if ret: - raise SCons.Errors.UserError("Unable to register %s" % target[0]) - else: - print "Registered %s sucessfully" % target[0] - return ret - return 0 - -# These are the actual actions run to embed the manifest. -# They are only called from the Check versions below. -embedManifestExeAction = SCons.Action.Action('$MTEXECOM') -embedManifestDllAction = SCons.Action.Action('$MTSHLIBCOM') - -def embedManifestDllCheck(target, source, env): - """Function run by embedManifestDllCheckAction to check for existence of manifest - and other conditions, and embed the manifest by calling embedManifestDllAction if so.""" - if env.get('WINDOWS_EMBED_MANIFEST', 0): - manifestSrc = target[0].abspath + '.manifest' - if os.path.exists(manifestSrc): - ret = (embedManifestDllAction) ([target[0]],None,env) - if ret: - raise SCons.Errors.UserError, "Unable to embed manifest into %s" % (target[0]) - return ret - else: - print '(embed: no %s.manifest found; not embedding.)'%str(target[0]) - return 0 - -def embedManifestExeCheck(target, source, env): - """Function run by embedManifestExeCheckAction to check for existence of manifest - and other conditions, and embed the manifest by calling embedManifestExeAction if so.""" - if env.get('WINDOWS_EMBED_MANIFEST', 0): - manifestSrc = target[0].abspath + '.manifest' - if os.path.exists(manifestSrc): - ret = (embedManifestExeAction) ([target[0]],None,env) - if ret: - raise SCons.Errors.UserError, "Unable to embed manifest into %s" % (target[0]) - return ret - else: - print '(embed: no %s.manifest found; not embedding.)'%str(target[0]) - return 0 - -embedManifestDllCheckAction = SCons.Action.Action(embedManifestDllCheck, None) -embedManifestExeCheckAction = SCons.Action.Action(embedManifestExeCheck, None) - -regServerAction = SCons.Action.Action("$REGSVRCOM", "$REGSVRCOMSTR") -regServerCheck = SCons.Action.Action(RegServerFunc, None) -shlibLinkAction = SCons.Action.Action('${TEMPFILE("$SHLINK $SHLINKFLAGS $_SHLINK_TARGETS $_LIBDIRFLAGS $_LIBFLAGS $_PDB $_SHLINK_SOURCES")}', '$SHLINKCOMSTR') -compositeShLinkAction = shlibLinkAction + regServerCheck + embedManifestDllCheckAction -ldmodLinkAction = SCons.Action.Action('${TEMPFILE("$LDMODULE $LDMODULEFLAGS $_LDMODULE_TARGETS $_LIBDIRFLAGS $_LIBFLAGS $_PDB $_LDMODULE_SOURCES")}', '$LDMODULECOMSTR') -compositeLdmodAction = ldmodLinkAction + regServerCheck + embedManifestDllCheckAction -exeLinkAction = SCons.Action.Action('${TEMPFILE("$LINK $LINKFLAGS /OUT:$TARGET.windows $_LIBDIRFLAGS $_LIBFLAGS $_PDB $SOURCES.windows")}', '$LINKCOMSTR') -compositeLinkAction = exeLinkAction + embedManifestExeCheckAction - -def generate(env): - """Add Builders and construction variables for ar to an Environment.""" - SCons.Tool.createSharedLibBuilder(env) - SCons.Tool.createProgBuilder(env) - - env['SHLINK'] = '$LINK' - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS /dll') - env['_SHLINK_TARGETS'] = windowsShlinkTargets - env['_SHLINK_SOURCES'] = windowsShlinkSources - env['SHLINKCOM'] = compositeShLinkAction - env.Append(SHLIBEMITTER = [windowsLibEmitter]) - env['LINK'] = 'link' - env['LINKFLAGS'] = SCons.Util.CLVar('/nologo') - env['_PDB'] = pdbGenerator - env['LINKCOM'] = compositeLinkAction - env.Append(PROGEMITTER = [prog_emitter]) - env['LIBDIRPREFIX']='/LIBPATH:' - env['LIBDIRSUFFIX']='' - env['LIBLINKPREFIX']='' - env['LIBLINKSUFFIX']='$LIBSUFFIX' - - env['WIN32DEFPREFIX'] = '' - env['WIN32DEFSUFFIX'] = '.def' - env['WIN32_INSERT_DEF'] = 0 - env['WINDOWSDEFPREFIX'] = '${WIN32DEFPREFIX}' - env['WINDOWSDEFSUFFIX'] = '${WIN32DEFSUFFIX}' - env['WINDOWS_INSERT_DEF'] = '${WIN32_INSERT_DEF}' - - env['WIN32EXPPREFIX'] = '' - env['WIN32EXPSUFFIX'] = '.exp' - env['WINDOWSEXPPREFIX'] = '${WIN32EXPPREFIX}' - env['WINDOWSEXPSUFFIX'] = '${WIN32EXPSUFFIX}' - - env['WINDOWSSHLIBMANIFESTPREFIX'] = '' - env['WINDOWSSHLIBMANIFESTSUFFIX'] = '${SHLIBSUFFIX}.manifest' - env['WINDOWSPROGMANIFESTPREFIX'] = '' - env['WINDOWSPROGMANIFESTSUFFIX'] = '${PROGSUFFIX}.manifest' - - env['REGSVRACTION'] = regServerCheck - env['REGSVR'] = os.path.join(SCons.Platform.win32.get_system_root(),'System32','regsvr32') - env['REGSVRFLAGS'] = '/s ' - env['REGSVRCOM'] = '$REGSVR $REGSVRFLAGS ${TARGET.windows}' - - env['WINDOWS_EMBED_MANIFEST'] = 0 - env['MT'] = 'mt' - #env['MTFLAGS'] = ['-hashupdate'] - env['MTFLAGS'] = SCons.Util.CLVar('/nologo') - # Note: use - here to prevent build failure if no manifest produced. - # This seems much simpler than a fancy system using a function action to see - # if the manifest actually exists before trying to run mt with it. - env['MTEXECOM'] = '-$MT $MTFLAGS -manifest ${TARGET}.manifest $_MANIFEST_SOURCES -outputresource:$TARGET;1' - env['MTSHLIBCOM'] = '-$MT $MTFLAGS -manifest ${TARGET}.manifest $_MANIFEST_SOURCES -outputresource:$TARGET;2' - # Future work garyo 27-Feb-11 - env['_MANIFEST_SOURCES'] = None # _windowsManifestSources - - # Set-up ms tools paths - msvc_setup_env_once(env) - - - # Loadable modules are on Windows the same as shared libraries, but they - # are subject to different build parameters (LDMODULE* variables). - # Therefore LDMODULE* variables correspond as much as possible to - # SHLINK*/SHLIB* ones. - SCons.Tool.createLoadableModuleBuilder(env) - env['LDMODULE'] = '$SHLINK' - env['LDMODULEPREFIX'] = '$SHLIBPREFIX' - env['LDMODULESUFFIX'] = '$SHLIBSUFFIX' - env['LDMODULEFLAGS'] = '$SHLINKFLAGS' - env['_LDMODULE_TARGETS'] = _windowsLdmodTargets - env['_LDMODULE_SOURCES'] = _windowsLdmodSources - env['LDMODULEEMITTER'] = [ldmodEmitter] - env['LDMODULECOM'] = compositeLdmodAction - -def exists(env): - return msvc_exists() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/mssdk.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/mssdk.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/mssdk.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/mssdk.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/mssdk.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -"""engine.SCons.Tool.mssdk - -Tool-specific initialization for Microsoft SDKs, both Platform -SDKs and Windows SDKs. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -from MSCommon import mssdk_exists, \ - mssdk_setup_env - -def generate(env): - """Add construction variables for an MS SDK to an Environment.""" - mssdk_setup_env(env) - -def exists(env): - return mssdk_exists() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/msvc.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/msvc.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/msvc.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/msvc.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,278 +0,0 @@ -"""engine.SCons.Tool.msvc - -Tool-specific initialization for Microsoft Visual C/C++. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/msvc.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path -import re -import sys - -import SCons.Action -import SCons.Builder -import SCons.Errors -import SCons.Platform.win32 -import SCons.Tool -import SCons.Tool.msvs -import SCons.Util -import SCons.Warnings -import SCons.Scanner.RC - -from MSCommon import msvc_exists, msvc_setup_env_once - -CSuffixes = ['.c', '.C'] -CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++'] - -def validate_vars(env): - """Validate the PCH and PCHSTOP construction variables.""" - if 'PCH' in env and env['PCH']: - if 'PCHSTOP' not in env: - raise SCons.Errors.UserError("The PCHSTOP construction must be defined if PCH is defined.") - if not SCons.Util.is_String(env['PCHSTOP']): - raise SCons.Errors.UserError("The PCHSTOP construction variable must be a string: %r"%env['PCHSTOP']) - -def pch_emitter(target, source, env): - """Adds the object file target.""" - - validate_vars(env) - - pch = None - obj = None - - for t in target: - if SCons.Util.splitext(str(t))[1] == '.pch': - pch = t - if SCons.Util.splitext(str(t))[1] == '.obj': - obj = t - - if not obj: - obj = SCons.Util.splitext(str(pch))[0]+'.obj' - - target = [pch, obj] # pch must be first, and obj second for the PCHCOM to work - - return (target, source) - -def object_emitter(target, source, env, parent_emitter): - """Sets up the PCH dependencies for an object file.""" - - validate_vars(env) - - parent_emitter(target, source, env) - - # Add a dependency, but only if the target (e.g. 'Source1.obj') - # doesn't correspond to the pre-compiled header ('Source1.pch'). - # If the basenames match, then this was most likely caused by - # someone adding the source file to both the env.PCH() and the - # env.Program() calls, and adding the explicit dependency would - # cause a cycle on the .pch file itself. - # - # See issue #2505 for a discussion of what to do if it turns - # out this assumption causes trouble in the wild: - # http://scons.tigris.org/issues/show_bug.cgi?id=2505 - if 'PCH' in env: - pch = env['PCH'] - if str(target[0]) != SCons.Util.splitext(str(pch))[0] + '.obj': - env.Depends(target, pch) - - return (target, source) - -def static_object_emitter(target, source, env): - return object_emitter(target, source, env, - SCons.Defaults.StaticObjectEmitter) - -def shared_object_emitter(target, source, env): - return object_emitter(target, source, env, - SCons.Defaults.SharedObjectEmitter) - -pch_action = SCons.Action.Action('$PCHCOM', '$PCHCOMSTR') -pch_builder = SCons.Builder.Builder(action=pch_action, suffix='.pch', - emitter=pch_emitter, - source_scanner=SCons.Tool.SourceFileScanner) - - -# Logic to build .rc files into .res files (resource files) -res_scanner = SCons.Scanner.RC.RCScan() -res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR') -res_builder = SCons.Builder.Builder(action=res_action, - src_suffix='.rc', - suffix='.res', - src_builder=[], - source_scanner=res_scanner) - -def msvc_batch_key(action, env, target, source): - """ - Returns a key to identify unique batches of sources for compilation. - - If batching is enabled (via the $MSVC_BATCH setting), then all - target+source pairs that use the same action, defined by the same - environment, and have the same target and source directories, will - be batched. - - Returning None specifies that the specified target+source should not - be batched with other compilations. - """ - - # Fixing MSVC_BATCH mode. Previous if did not work when MSVC_BATCH - # was set to False. This new version should work better. - # Note we need to do the env.subst so $MSVC_BATCH can be a reference to - # another construction variable, which is why we test for False and 0 - # as strings. - if not 'MSVC_BATCH' in env or env.subst('$MSVC_BATCH') in ('0', 'False', '', None): - # We're not using batching; return no key. - return None - t = target[0] - s = source[0] - if os.path.splitext(t.name)[0] != os.path.splitext(s.name)[0]: - # The base names are different, so this *must* be compiled - # separately; return no key. - return None - return (id(action), id(env), t.dir, s.dir) - -def msvc_output_flag(target, source, env, for_signature): - """ - Returns the correct /Fo flag for batching. - - If batching is disabled or there's only one source file, then we - return an /Fo string that specifies the target explicitly. Otherwise, - we return an /Fo string that just specifies the first target's - directory (where the Visual C/C++ compiler will put the .obj files). - """ - - # Fixing MSVC_BATCH mode. Previous if did not work when MSVC_BATCH - # was set to False. This new version should work better. Removed - # len(source)==1 as batch mode can compile only one file - # (and it also fixed problem with compiling only one changed file - # with batch mode enabled) - if not 'MSVC_BATCH' in env or env.subst('$MSVC_BATCH') in ('0', 'False', '', None): - return '/Fo$TARGET' - else: - # The Visual C/C++ compiler requires a \ at the end of the /Fo - # option to indicate an output directory. We use os.sep here so - # that the test(s) for this can be run on non-Windows systems - # without having a hard-coded backslash mess up command-line - # argument parsing. - return '/Fo${TARGET.dir}' + os.sep - -CAction = SCons.Action.Action("$CCCOM", "$CCCOMSTR", - batch_key=msvc_batch_key, - targets='$CHANGED_TARGETS') -ShCAction = SCons.Action.Action("$SHCCCOM", "$SHCCCOMSTR", - batch_key=msvc_batch_key, - targets='$CHANGED_TARGETS') -CXXAction = SCons.Action.Action("$CXXCOM", "$CXXCOMSTR", - batch_key=msvc_batch_key, - targets='$CHANGED_TARGETS') -ShCXXAction = SCons.Action.Action("$SHCXXCOM", "$SHCXXCOMSTR", - batch_key=msvc_batch_key, - targets='$CHANGED_TARGETS') - -def generate(env): - """Add Builders and construction variables for MSVC++ to an Environment.""" - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - - # TODO(batch): shouldn't reach in to cmdgen this way; necessary - # for now to bypass the checks in Builder.DictCmdGenerator.__call__() - # and allow .cc and .cpp to be compiled in the same command line. - static_obj.cmdgen.source_ext_match = False - shared_obj.cmdgen.source_ext_match = False - - for suffix in CSuffixes: - static_obj.add_action(suffix, CAction) - shared_obj.add_action(suffix, ShCAction) - static_obj.add_emitter(suffix, static_object_emitter) - shared_obj.add_emitter(suffix, shared_object_emitter) - - for suffix in CXXSuffixes: - static_obj.add_action(suffix, CXXAction) - shared_obj.add_action(suffix, ShCXXAction) - static_obj.add_emitter(suffix, static_object_emitter) - shared_obj.add_emitter(suffix, shared_object_emitter) - - env['CCPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Z7") or ""}']) - env['CCPCHFLAGS'] = SCons.Util.CLVar(['${(PCH and "/Yu%s \\\"/Fp%s\\\""%(PCHSTOP or "",File(PCH))) or ""}']) - env['_MSVC_OUTPUT_FLAG'] = msvc_output_flag - env['_CCCOMCOM'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $CCPCHFLAGS $CCPDBFLAGS' - env['CC'] = 'cl' - env['CCFLAGS'] = SCons.Util.CLVar('/nologo') - env['CFLAGS'] = SCons.Util.CLVar('') - env['CCCOM'] = '${TEMPFILE("$CC $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $CFLAGS $CCFLAGS $_CCCOMCOM")}' - env['SHCC'] = '$CC' - env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') - env['SHCFLAGS'] = SCons.Util.CLVar('$CFLAGS') - env['SHCCCOM'] = '${TEMPFILE("$SHCC $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $SHCFLAGS $SHCCFLAGS $_CCCOMCOM")}' - env['CXX'] = '$CC' - env['CXXFLAGS'] = SCons.Util.CLVar('$( /TP $)') - env['CXXCOM'] = '${TEMPFILE("$CXX $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $CXXFLAGS $CCFLAGS $_CCCOMCOM")}' - env['SHCXX'] = '$CXX' - env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') - env['SHCXXCOM'] = '${TEMPFILE("$SHCXX $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $SHCXXFLAGS $SHCCFLAGS $_CCCOMCOM")}' - env['CPPDEFPREFIX'] = '/D' - env['CPPDEFSUFFIX'] = '' - env['INCPREFIX'] = '/I' - env['INCSUFFIX'] = '' -# env.Append(OBJEMITTER = [static_object_emitter]) -# env.Append(SHOBJEMITTER = [shared_object_emitter]) - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 - - env['RC'] = 'rc' - env['RCFLAGS'] = SCons.Util.CLVar('') - env['RCSUFFIXES']=['.rc','.rc2'] - env['RCCOM'] = '$RC $_CPPDEFFLAGS $_CPPINCFLAGS $RCFLAGS /fo$TARGET $SOURCES' - env['BUILDERS']['RES'] = res_builder - env['OBJPREFIX'] = '' - env['OBJSUFFIX'] = '.obj' - env['SHOBJPREFIX'] = '$OBJPREFIX' - env['SHOBJSUFFIX'] = '$OBJSUFFIX' - - # Set-up ms tools paths - msvc_setup_env_once(env) - - env['CFILESUFFIX'] = '.c' - env['CXXFILESUFFIX'] = '.cc' - - env['PCHPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Yd") or ""}']) - env['PCHCOM'] = '$CXX /Fo${TARGETS[1]} $CXXFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS $PCHPDBFLAGS' - env['BUILDERS']['PCH'] = pch_builder - - if 'ENV' not in env: - env['ENV'] = {} - if 'SystemRoot' not in env['ENV']: # required for dlls in the winsxs folders - env['ENV']['SystemRoot'] = SCons.Platform.win32.get_system_root() - -def exists(env): - return msvc_exists() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/msvs.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/msvs.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/msvs.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/msvs.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,1799 +0,0 @@ -"""SCons.Tool.msvs - -Tool-specific initialization for Microsoft Visual Studio project files. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/msvs.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.compat - -import base64 -import hashlib -import ntpath -import os -# compat layer imports "cPickle" for us if it's available. -import pickle -import re -import sys - -import SCons.Builder -import SCons.Node.FS -import SCons.Platform.win32 -import SCons.Script.SConscript -import SCons.PathList -import SCons.Util -import SCons.Warnings - -from MSCommon import msvc_exists, msvc_setup_env_once -from SCons.Defaults import processDefines - -############################################################################## -# Below here are the classes and functions for generation of -# DSP/DSW/SLN/VCPROJ files. -############################################################################## - -def xmlify(s): - s = s.replace("&", "&") # do this first - s = s.replace("'", "'") - s = s.replace('"', """) - return s - -# Process a CPPPATH list in includes, given the env, target and source. -# Returns a tuple of nodes. -def processIncludes(includes, env, target, source): - return SCons.PathList.PathList(includes).subst_path(env, target, source) - - -external_makefile_guid = '{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}' - -def _generateGUID(slnfile, name): - """This generates a dummy GUID for the sln file to use. It is - based on the MD5 signatures of the sln filename plus the name of - the project. It basically just needs to be unique, and not - change with each invocation.""" - m = hashlib.md5() - # Normalize the slnfile path to a Windows path (\ separators) so - # the generated file has a consistent GUID even if we generate - # it on a non-Windows platform. - m.update(ntpath.normpath(str(slnfile)) + str(name)) - solution = m.hexdigest().upper() - # convert most of the signature to GUID form (discard the rest) - solution = "{" + solution[:8] + "-" + solution[8:12] + "-" + solution[12:16] + "-" + solution[16:20] + "-" + solution[20:32] + "}" - return solution - -version_re = re.compile(r'(\d+\.\d+)(.*)') - -def msvs_parse_version(s): - """ - Split a Visual Studio version, which may in fact be something like - '7.0Exp', into is version number (returned as a float) and trailing - "suite" portion. - """ - num, suite = version_re.match(s).groups() - return float(num), suite - -# os.path.relpath has been introduced in Python 2.6 -# We define it locally for earlier versions of Python -def relpath(path, start=os.path.curdir): - """Return a relative version of a path""" - import sys - if not path: - raise ValueError("no path specified") - start_list = os.path.abspath(start).split(os.sep) - path_list = os.path.abspath(path).split(os.sep) - if 'posix' in sys.builtin_module_names: - # Work out how much of the filepath is shared by start and path. - i = len(os.path.commonprefix([start_list, path_list])) - else: - if start_list[0].lower() != path_list[0].lower(): - unc_path, rest = os.path.splitunc(path) - unc_start, rest = os.path.splitunc(start) - if bool(unc_path) ^ bool(unc_start): - raise ValueError("Cannot mix UNC and non-UNC paths (%s and %s)" - % (path, start)) - else: - raise ValueError("path is on drive %s, start on drive %s" - % (path_list[0], start_list[0])) - # Work out how much of the filepath is shared by start and path. - for i in range(min(len(start_list), len(path_list))): - if start_list[i].lower() != path_list[i].lower(): - break - else: - i += 1 - rel_list = [os.pardir] * (len(start_list)-i) + path_list[i:] - if not rel_list: - return os.path.curdir - return os.path.join(*rel_list) - -if not "relpath" in os.path.__all__: - os.path.relpath = relpath - -# This is how we re-invoke SCons from inside MSVS Project files. -# The problem is that we might have been invoked as either scons.bat -# or scons.py. If we were invoked directly as scons.py, then we could -# use sys.argv[0] to find the SCons "executable," but that doesn't work -# if we were invoked as scons.bat, which uses "python -c" to execute -# things and ends up with "-c" as sys.argv[0]. Consequently, we have -# the MSVS Project file invoke SCons the same way that scons.bat does, -# which works regardless of how we were invoked. -def getExecScriptMain(env, xml=None): - scons_home = env.get('SCONS_HOME') - if not scons_home and 'SCONS_LIB_DIR' in os.environ: - scons_home = os.environ['SCONS_LIB_DIR'] - if scons_home: - exec_script_main = "from os.path import join; import sys; sys.path = [ r'%s' ] + sys.path; import SCons.Script; SCons.Script.main()" % scons_home - else: - version = SCons.__version__ - exec_script_main = "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-%(version)s'), join(sys.prefix, 'scons-%(version)s'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons') ] + sys.path; import SCons.Script; SCons.Script.main()" % locals() - if xml: - exec_script_main = xmlify(exec_script_main) - return exec_script_main - -# The string for the Python executable we tell the Project file to use -# is either sys.executable or, if an external PYTHON_ROOT environment -# variable exists, $(PYTHON)ROOT\\python.exe (generalized a little to -# pluck the actual executable name from sys.executable). -try: - python_root = os.environ['PYTHON_ROOT'] -except KeyError: - python_executable = sys.executable -else: - python_executable = os.path.join('$$(PYTHON_ROOT)', - os.path.split(sys.executable)[1]) - -class Config(object): - pass - -def splitFully(path): - dir, base = os.path.split(path) - if dir and dir != '' and dir != path: - return splitFully(dir)+[base] - if base == '': - return [] - return [base] - -def makeHierarchy(sources): - '''Break a list of files into a hierarchy; for each value, if it is a string, - then it is a file. If it is a dictionary, it is a folder. The string is - the original path of the file.''' - - hierarchy = {} - for file in sources: - path = splitFully(file) - if len(path): - dict = hierarchy - for part in path[:-1]: - if part not in dict: - dict[part] = {} - dict = dict[part] - dict[path[-1]] = file - #else: - # print 'Warning: failed to decompose path for '+str(file) - return hierarchy - -class _DSPGenerator(object): - """ Base class for DSP generators """ - - srcargs = [ - 'srcs', - 'incs', - 'localincs', - 'resources', - 'misc'] - - def __init__(self, dspfile, source, env): - self.dspfile = str(dspfile) - try: - get_abspath = dspfile.get_abspath - except AttributeError: - self.dspabs = os.path.abspath(dspfile) - else: - self.dspabs = get_abspath() - - if 'variant' not in env: - raise SCons.Errors.InternalError("You must specify a 'variant' argument (i.e. 'Debug' or " +\ - "'Release') to create an MSVSProject.") - elif SCons.Util.is_String(env['variant']): - variants = [env['variant']] - elif SCons.Util.is_List(env['variant']): - variants = env['variant'] - - if 'buildtarget' not in env or env['buildtarget'] == None: - buildtarget = [''] - elif SCons.Util.is_String(env['buildtarget']): - buildtarget = [env['buildtarget']] - elif SCons.Util.is_List(env['buildtarget']): - if len(env['buildtarget']) != len(variants): - raise SCons.Errors.InternalError("Sizes of 'buildtarget' and 'variant' lists must be the same.") - buildtarget = [] - for bt in env['buildtarget']: - if SCons.Util.is_String(bt): - buildtarget.append(bt) - else: - buildtarget.append(bt.get_abspath()) - else: - buildtarget = [env['buildtarget'].get_abspath()] - if len(buildtarget) == 1: - bt = buildtarget[0] - buildtarget = [] - for _ in variants: - buildtarget.append(bt) - - if 'outdir' not in env or env['outdir'] == None: - outdir = [''] - elif SCons.Util.is_String(env['outdir']): - outdir = [env['outdir']] - elif SCons.Util.is_List(env['outdir']): - if len(env['outdir']) != len(variants): - raise SCons.Errors.InternalError("Sizes of 'outdir' and 'variant' lists must be the same.") - outdir = [] - for s in env['outdir']: - if SCons.Util.is_String(s): - outdir.append(s) - else: - outdir.append(s.get_abspath()) - else: - outdir = [env['outdir'].get_abspath()] - if len(outdir) == 1: - s = outdir[0] - outdir = [] - for v in variants: - outdir.append(s) - - if 'runfile' not in env or env['runfile'] == None: - runfile = buildtarget[-1:] - elif SCons.Util.is_String(env['runfile']): - runfile = [env['runfile']] - elif SCons.Util.is_List(env['runfile']): - if len(env['runfile']) != len(variants): - raise SCons.Errors.InternalError("Sizes of 'runfile' and 'variant' lists must be the same.") - runfile = [] - for s in env['runfile']: - if SCons.Util.is_String(s): - runfile.append(s) - else: - runfile.append(s.get_abspath()) - else: - runfile = [env['runfile'].get_abspath()] - if len(runfile) == 1: - s = runfile[0] - runfile = [] - for v in variants: - runfile.append(s) - - self.sconscript = env['MSVSSCONSCRIPT'] - - cmdargs = env.get('cmdargs', '') - - self.env = env - - if 'name' in self.env: - self.name = self.env['name'] - else: - self.name = os.path.basename(SCons.Util.splitext(self.dspfile)[0]) - self.name = self.env.subst(self.name) - - sourcenames = [ - 'Source Files', - 'Header Files', - 'Local Headers', - 'Resource Files', - 'Other Files'] - - self.sources = {} - for n in sourcenames: - self.sources[n] = [] - - self.configs = {} - - self.nokeep = 0 - if 'nokeep' in env and env['variant'] != 0: - self.nokeep = 1 - - if self.nokeep == 0 and os.path.exists(self.dspabs): - self.Parse() - - for t in zip(sourcenames,self.srcargs): - if t[1] in self.env: - if SCons.Util.is_List(self.env[t[1]]): - for i in self.env[t[1]]: - if not i in self.sources[t[0]]: - self.sources[t[0]].append(i) - else: - if not self.env[t[1]] in self.sources[t[0]]: - self.sources[t[0]].append(self.env[t[1]]) - - for n in sourcenames: - #TODO 2.4: compat layer supports sorted(key=) but not sort(key=) - #TODO 2.4: self.sources[n].sort(key=lambda a: a.lower()) - self.sources[n] = sorted(self.sources[n], key=lambda a: a.lower()) - - def AddConfig(self, variant, buildtarget, outdir, runfile, cmdargs, dspfile=dspfile): - config = Config() - config.buildtarget = buildtarget - config.outdir = outdir - config.cmdargs = cmdargs - config.runfile = runfile - - match = re.match('(.*)\|(.*)', variant) - if match: - config.variant = match.group(1) - config.platform = match.group(2) - else: - config.variant = variant - config.platform = 'Win32' - - self.configs[variant] = config - print "Adding '" + self.name + ' - ' + config.variant + '|' + config.platform + "' to '" + str(dspfile) + "'" - - for i in range(len(variants)): - AddConfig(self, variants[i], buildtarget[i], outdir[i], runfile[i], cmdargs) - - self.platforms = [] - for key in self.configs.keys(): - platform = self.configs[key].platform - if not platform in self.platforms: - self.platforms.append(platform) - - def Build(self): - pass - -V6DSPHeader = """\ -# Microsoft Developer Studio Project File - Name="%(name)s" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) External Target" 0x0106 - -CFG=%(name)s - Win32 %(confkey)s -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "%(name)s.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "%(name)s.mak" CFG="%(name)s - Win32 %(confkey)s" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -""" - -class _GenerateV6DSP(_DSPGenerator): - """Generates a Project file for MSVS 6.0""" - - def PrintHeader(self): - # pick a default config - confkeys = sorted(self.configs.keys()) - - name = self.name - confkey = confkeys[0] - - self.file.write(V6DSPHeader % locals()) - - for kind in confkeys: - self.file.write('!MESSAGE "%s - Win32 %s" (based on "Win32 (x86) External Target")\n' % (name, kind)) - - self.file.write('!MESSAGE \n\n') - - def PrintProject(self): - name = self.name - self.file.write('# Begin Project\n' - '# PROP AllowPerConfigDependencies 0\n' - '# PROP Scc_ProjName ""\n' - '# PROP Scc_LocalPath ""\n\n') - - first = 1 - confkeys = sorted(self.configs.keys()) - for kind in confkeys: - outdir = self.configs[kind].outdir - buildtarget = self.configs[kind].buildtarget - if first == 1: - self.file.write('!IF "$(CFG)" == "%s - Win32 %s"\n\n' % (name, kind)) - first = 0 - else: - self.file.write('\n!ELSEIF "$(CFG)" == "%s - Win32 %s"\n\n' % (name, kind)) - - env_has_buildtarget = 'MSVSBUILDTARGET' in self.env - if not env_has_buildtarget: - self.env['MSVSBUILDTARGET'] = buildtarget - - # have to write this twice, once with the BASE settings, and once without - for base in ("BASE ",""): - self.file.write('# PROP %sUse_MFC 0\n' - '# PROP %sUse_Debug_Libraries ' % (base, base)) - if kind.lower().find('debug') < 0: - self.file.write('0\n') - else: - self.file.write('1\n') - self.file.write('# PROP %sOutput_Dir "%s"\n' - '# PROP %sIntermediate_Dir "%s"\n' % (base,outdir,base,outdir)) - cmd = 'echo Starting SCons && ' + self.env.subst('$MSVSBUILDCOM', 1) - self.file.write('# PROP %sCmd_Line "%s"\n' - '# PROP %sRebuild_Opt "-c && %s"\n' - '# PROP %sTarget_File "%s"\n' - '# PROP %sBsc_Name ""\n' - '# PROP %sTarget_Dir ""\n'\ - %(base,cmd,base,cmd,base,buildtarget,base,base)) - - if not env_has_buildtarget: - del self.env['MSVSBUILDTARGET'] - - self.file.write('\n!ENDIF\n\n' - '# Begin Target\n\n') - for kind in confkeys: - self.file.write('# Name "%s - Win32 %s"\n' % (name,kind)) - self.file.write('\n') - first = 0 - for kind in confkeys: - if first == 0: - self.file.write('!IF "$(CFG)" == "%s - Win32 %s"\n\n' % (name,kind)) - first = 1 - else: - self.file.write('!ELSEIF "$(CFG)" == "%s - Win32 %s"\n\n' % (name,kind)) - self.file.write('!ENDIF \n\n') - self.PrintSourceFiles() - self.file.write('# End Target\n' - '# End Project\n') - - if self.nokeep == 0: - # now we pickle some data and add it to the file -- MSDEV will ignore it. - pdata = pickle.dumps(self.configs,1) - pdata = base64.encodestring(pdata) - self.file.write(pdata + '\n') - pdata = pickle.dumps(self.sources,1) - pdata = base64.encodestring(pdata) - self.file.write(pdata + '\n') - - def PrintSourceFiles(self): - categories = {'Source Files': 'cpp|c|cxx|l|y|def|odl|idl|hpj|bat', - 'Header Files': 'h|hpp|hxx|hm|inl', - 'Local Headers': 'h|hpp|hxx|hm|inl', - 'Resource Files': 'r|rc|ico|cur|bmp|dlg|rc2|rct|bin|cnt|rtf|gif|jpg|jpeg|jpe', - 'Other Files': ''} - - for kind in sorted(categories.keys(), key=lambda a: a.lower()): - if not self.sources[kind]: - continue # skip empty groups - - self.file.write('# Begin Group "' + kind + '"\n\n') - typelist = categories[kind].replace('|', ';') - self.file.write('# PROP Default_Filter "' + typelist + '"\n') - - for file in self.sources[kind]: - file = os.path.normpath(file) - self.file.write('# Begin Source File\n\n' - 'SOURCE="' + file + '"\n' - '# End Source File\n') - self.file.write('# End Group\n') - - # add the SConscript file outside of the groups - self.file.write('# Begin Source File\n\n' - 'SOURCE="' + str(self.sconscript) + '"\n' - '# End Source File\n') - - def Parse(self): - try: - dspfile = open(self.dspabs,'r') - except IOError: - return # doesn't exist yet, so can't add anything to configs. - - line = dspfile.readline() - while line: - if line.find("# End Project") > -1: - break - line = dspfile.readline() - - line = dspfile.readline() - datas = line - while line and line != '\n': - line = dspfile.readline() - datas = datas + line - - # OK, we've found our little pickled cache of data. - try: - datas = base64.decodestring(datas) - data = pickle.loads(datas) - except KeyboardInterrupt: - raise - except: - return # unable to unpickle any data for some reason - - self.configs.update(data) - - data = None - line = dspfile.readline() - datas = line - while line and line != '\n': - line = dspfile.readline() - datas = datas + line - - # OK, we've found our little pickled cache of data. - # it has a "# " in front of it, so we strip that. - try: - datas = base64.decodestring(datas) - data = pickle.loads(datas) - except KeyboardInterrupt: - raise - except: - return # unable to unpickle any data for some reason - - self.sources.update(data) - - def Build(self): - try: - self.file = open(self.dspabs,'w') - except IOError, detail: - raise SCons.Errors.InternalError('Unable to open "' + self.dspabs + '" for writing:' + str(detail)) - else: - self.PrintHeader() - self.PrintProject() - self.file.close() - -V7DSPHeader = """\ - - -""" - -V7DSPConfiguration = """\ -\t\t -\t\t\t -\t\t -""" - -V8DSPHeader = """\ - - -""" - -V8DSPConfiguration = """\ -\t\t -\t\t\t -\t\t -""" -class _GenerateV7DSP(_DSPGenerator): - """Generates a Project file for MSVS .NET""" - - def __init__(self, dspfile, source, env): - _DSPGenerator.__init__(self, dspfile, source, env) - self.version = env['MSVS_VERSION'] - self.version_num, self.suite = msvs_parse_version(self.version) - if self.version_num >= 9.0: - self.versionstr = '9.00' - self.dspheader = V8DSPHeader - self.dspconfiguration = V8DSPConfiguration - elif self.version_num >= 8.0: - self.versionstr = '8.00' - self.dspheader = V8DSPHeader - self.dspconfiguration = V8DSPConfiguration - else: - if self.version_num >= 7.1: - self.versionstr = '7.10' - else: - self.versionstr = '7.00' - self.dspheader = V7DSPHeader - self.dspconfiguration = V7DSPConfiguration - self.file = None - - def PrintHeader(self): - env = self.env - versionstr = self.versionstr - name = self.name - encoding = self.env.subst('$MSVSENCODING') - scc_provider = env.get('MSVS_SCC_PROVIDER', '') - scc_project_name = env.get('MSVS_SCC_PROJECT_NAME', '') - scc_aux_path = env.get('MSVS_SCC_AUX_PATH', '') - # MSVS_SCC_LOCAL_PATH is kept for backwards compatibility purpose and should - # be deprecated as soon as possible. - scc_local_path_legacy = env.get('MSVS_SCC_LOCAL_PATH', '') - scc_connection_root = env.get('MSVS_SCC_CONNECTION_ROOT', os.curdir) - scc_local_path = os.path.relpath(scc_connection_root, os.path.dirname(self.dspabs)) - project_guid = env.get('MSVS_PROJECT_GUID', '') - if not project_guid: - project_guid = _generateGUID(self.dspfile, '') - if scc_provider != '': - scc_attrs = '\tSccProjectName="%s"\n' % scc_project_name - if scc_aux_path != '': - scc_attrs += '\tSccAuxPath="%s"\n' % scc_aux_path - scc_attrs += ('\tSccLocalPath="%s"\n' - '\tSccProvider="%s"' % (scc_local_path, scc_provider)) - elif scc_local_path_legacy != '': - # This case is kept for backwards compatibility purpose and should - # be deprecated as soon as possible. - scc_attrs = ('\tSccProjectName="%s"\n' - '\tSccLocalPath="%s"' % (scc_project_name, scc_local_path_legacy)) - else: - self.dspheader = self.dspheader.replace('%(scc_attrs)s\n', '') - - self.file.write(self.dspheader % locals()) - - self.file.write('\t\n') - for platform in self.platforms: - self.file.write( - '\t\t\n' % platform) - self.file.write('\t\n') - - if self.version_num >= 8.0: - self.file.write('\t\n' - '\t\n') - - def PrintProject(self): - self.file.write('\t\n') - - confkeys = sorted(self.configs.keys()) - for kind in confkeys: - variant = self.configs[kind].variant - platform = self.configs[kind].platform - outdir = self.configs[kind].outdir - buildtarget = self.configs[kind].buildtarget - runfile = self.configs[kind].runfile - cmdargs = self.configs[kind].cmdargs - - env_has_buildtarget = 'MSVSBUILDTARGET' in self.env - if not env_has_buildtarget: - self.env['MSVSBUILDTARGET'] = buildtarget - - starting = 'echo Starting SCons && ' - if cmdargs: - cmdargs = ' ' + cmdargs - else: - cmdargs = '' - buildcmd = xmlify(starting + self.env.subst('$MSVSBUILDCOM', 1) + cmdargs) - rebuildcmd = xmlify(starting + self.env.subst('$MSVSREBUILDCOM', 1) + cmdargs) - cleancmd = xmlify(starting + self.env.subst('$MSVSCLEANCOM', 1) + cmdargs) - - # This isn't perfect; CPPDEFINES and CPPPATH can contain $TARGET and $SOURCE, - # so they could vary depending on the command being generated. This code - # assumes they don't. - preprocdefs = xmlify(';'.join(processDefines(self.env.get('CPPDEFINES', [])))) - includepath_Dirs = processIncludes(self.env.get('CPPPATH', []), self.env, None, None) - includepath = xmlify(';'.join([str(x) for x in includepath_Dirs])) - - if not env_has_buildtarget: - del self.env['MSVSBUILDTARGET'] - - self.file.write(self.dspconfiguration % locals()) - - self.file.write('\t\n') - - if self.version_num >= 7.1: - self.file.write('\t\n' - '\t\n') - - self.PrintSourceFiles() - - self.file.write('\n') - - if self.nokeep == 0: - # now we pickle some data and add it to the file -- MSDEV will ignore it. - pdata = pickle.dumps(self.configs,1) - pdata = base64.encodestring(pdata) - self.file.write('\n') - - def printSources(self, hierarchy, commonprefix): - sorteditems = sorted(hierarchy.items(), key=lambda a: a[0].lower()) - - # First folders, then files - for key, value in sorteditems: - if SCons.Util.is_Dict(value): - self.file.write('\t\t\t\n' % (key)) - self.printSources(value, commonprefix) - self.file.write('\t\t\t\n') - - for key, value in sorteditems: - if SCons.Util.is_String(value): - file = value - if commonprefix: - file = os.path.join(commonprefix, value) - file = os.path.normpath(file) - self.file.write('\t\t\t\n' - '\t\t\t\n' % (file)) - - def PrintSourceFiles(self): - categories = {'Source Files': 'cpp;c;cxx;l;y;def;odl;idl;hpj;bat', - 'Header Files': 'h;hpp;hxx;hm;inl', - 'Local Headers': 'h;hpp;hxx;hm;inl', - 'Resource Files': 'r;rc;ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe', - 'Other Files': ''} - - self.file.write('\t\n') - - cats = sorted([k for k in categories.keys() if self.sources[k]], - key=lambda a: a.lower()) - for kind in cats: - if len(cats) > 1: - self.file.write('\t\t\n' % (kind, categories[kind])) - - sources = self.sources[kind] - - # First remove any common prefix - commonprefix = None - s = list(map(os.path.normpath, sources)) - # take the dirname because the prefix may include parts - # of the filenames (e.g. if you have 'dir\abcd' and - # 'dir\acde' then the cp will be 'dir\a' ) - cp = os.path.dirname( os.path.commonprefix(s) ) - if cp and s[0][len(cp)] == os.sep: - # +1 because the filename starts after the separator - sources = [s[len(cp)+1:] for s in sources] - commonprefix = cp - - hierarchy = makeHierarchy(sources) - self.printSources(hierarchy, commonprefix=commonprefix) - - if len(cats)>1: - self.file.write('\t\t\n') - - # add the SConscript file outside of the groups - self.file.write('\t\t\n' - '\t\t\n' % str(self.sconscript)) - - self.file.write('\t\n' - '\t\n' - '\t\n') - - def Parse(self): - try: - dspfile = open(self.dspabs,'r') - except IOError: - return # doesn't exist yet, so can't add anything to configs. - - line = dspfile.readline() - while line: - if line.find('\n') - - def printFilters(self, hierarchy, name): - sorteditems = sorted(hierarchy.items(), key = lambda a: a[0].lower()) - - for key, value in sorteditems: - if SCons.Util.is_Dict(value): - filter_name = name + '\\' + key - self.filters_file.write('\t\t\n' - '\t\t\t%s\n' - '\t\t\n' % (filter_name, _generateGUID(self.dspabs, filter_name))) - self.printFilters(value, filter_name) - - def printSources(self, hierarchy, kind, commonprefix, filter_name): - keywords = {'Source Files': 'ClCompile', - 'Header Files': 'ClInclude', - 'Local Headers': 'ClInclude', - 'Resource Files': 'None', - 'Other Files': 'None'} - - sorteditems = sorted(hierarchy.items(), key = lambda a: a[0].lower()) - - # First folders, then files - for key, value in sorteditems: - if SCons.Util.is_Dict(value): - self.printSources(value, kind, commonprefix, filter_name + '\\' + key) - - for key, value in sorteditems: - if SCons.Util.is_String(value): - file = value - if commonprefix: - file = os.path.join(commonprefix, value) - file = os.path.normpath(file) - - self.file.write('\t\t<%s Include="%s" />\n' % (keywords[kind], file)) - self.filters_file.write('\t\t<%s Include="%s">\n' - '\t\t\t%s\n' - '\t\t\n' % (keywords[kind], file, filter_name, keywords[kind])) - - def PrintSourceFiles(self): - categories = {'Source Files': 'cpp;c;cxx;l;y;def;odl;idl;hpj;bat', - 'Header Files': 'h;hpp;hxx;hm;inl', - 'Local Headers': 'h;hpp;hxx;hm;inl', - 'Resource Files': 'r;rc;ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe', - 'Other Files': ''} - - cats = sorted([k for k in categories.keys() if self.sources[k]], - key = lambda a: a.lower()) - - # print vcxproj.filters file first - self.filters_file.write('\t\n') - for kind in cats: - self.filters_file.write('\t\t\n' - '\t\t\t{7b42d31d-d53c-4868-8b92-ca2bc9fc052f}\n' - '\t\t\t%s\n' - '\t\t\n' % (kind, categories[kind])) - - # First remove any common prefix - sources = self.sources[kind] - commonprefix = None - s = list(map(os.path.normpath, sources)) - # take the dirname because the prefix may include parts - # of the filenames (e.g. if you have 'dir\abcd' and - # 'dir\acde' then the cp will be 'dir\a' ) - cp = os.path.dirname( os.path.commonprefix(s) ) - if cp and s[0][len(cp)] == os.sep: - # +1 because the filename starts after the separator - sources = [s[len(cp)+1:] for s in sources] - commonprefix = cp - - hierarchy = makeHierarchy(sources) - self.printFilters(hierarchy, kind) - - self.filters_file.write('\t\n') - - # then print files and filters - for kind in cats: - self.file.write('\t\n') - self.filters_file.write('\t\n') - - # First remove any common prefix - sources = self.sources[kind] - commonprefix = None - s = list(map(os.path.normpath, sources)) - # take the dirname because the prefix may include parts - # of the filenames (e.g. if you have 'dir\abcd' and - # 'dir\acde' then the cp will be 'dir\a' ) - cp = os.path.dirname( os.path.commonprefix(s) ) - if cp and s[0][len(cp)] == os.sep: - # +1 because the filename starts after the separator - sources = [s[len(cp)+1:] for s in sources] - commonprefix = cp - - hierarchy = makeHierarchy(sources) - self.printSources(hierarchy, kind, commonprefix, kind) - - self.file.write('\t\n') - self.filters_file.write('\t\n') - - # add the SConscript file outside of the groups - self.file.write('\t\n' - '\t\t\n' - #'\t\t\n' - '\t\n' % str(self.sconscript)) - - def Parse(self): - print "_GenerateV10DSP.Parse()" - - def Build(self): - try: - self.file = open(self.dspabs, 'w') - except IOError, detail: - raise SCons.Errors.InternalError('Unable to open "' + self.dspabs + '" for writing:' + str(detail)) - else: - self.PrintHeader() - self.PrintProject() - self.file.close() - -class _DSWGenerator(object): - """ Base class for DSW generators """ - def __init__(self, dswfile, source, env): - self.dswfile = os.path.normpath(str(dswfile)) - self.dsw_folder_path = os.path.dirname(os.path.abspath(self.dswfile)) - self.env = env - - if 'projects' not in env: - raise SCons.Errors.UserError("You must specify a 'projects' argument to create an MSVSSolution.") - projects = env['projects'] - if not SCons.Util.is_List(projects): - raise SCons.Errors.InternalError("The 'projects' argument must be a list of nodes.") - projects = SCons.Util.flatten(projects) - if len(projects) < 1: - raise SCons.Errors.UserError("You must specify at least one project to create an MSVSSolution.") - self.dspfiles = list(map(str, projects)) - - if 'name' in self.env: - self.name = self.env['name'] - else: - self.name = os.path.basename(SCons.Util.splitext(self.dswfile)[0]) - self.name = self.env.subst(self.name) - - def Build(self): - pass - -class _GenerateV7DSW(_DSWGenerator): - """Generates a Solution file for MSVS .NET""" - def __init__(self, dswfile, source, env): - _DSWGenerator.__init__(self, dswfile, source, env) - - self.file = None - self.version = self.env['MSVS_VERSION'] - self.version_num, self.suite = msvs_parse_version(self.version) - self.versionstr = '7.00' - if self.version_num >= 11.0: - self.versionstr = '12.0' - elif self.version_num >= 10.0: - self.versionstr = '11.00' - elif self.version_num >= 9.0: - self.versionstr = '10.00' - elif self.version_num >= 8.0: - self.versionstr = '9.00' - elif self.version_num >= 7.1: - self.versionstr = '8.00' - - if 'slnguid' in env and env['slnguid']: - self.slnguid = env['slnguid'] - else: - self.slnguid = _generateGUID(dswfile, self.name) - - self.configs = {} - - self.nokeep = 0 - if 'nokeep' in env and env['variant'] != 0: - self.nokeep = 1 - - if self.nokeep == 0 and os.path.exists(self.dswfile): - self.Parse() - - def AddConfig(self, variant, dswfile=dswfile): - config = Config() - - match = re.match('(.*)\|(.*)', variant) - if match: - config.variant = match.group(1) - config.platform = match.group(2) - else: - config.variant = variant - config.platform = 'Win32' - - self.configs[variant] = config - print "Adding '" + self.name + ' - ' + config.variant + '|' + config.platform + "' to '" + str(dswfile) + "'" - - if 'variant' not in env: - raise SCons.Errors.InternalError("You must specify a 'variant' argument (i.e. 'Debug' or " +\ - "'Release') to create an MSVS Solution File.") - elif SCons.Util.is_String(env['variant']): - AddConfig(self, env['variant']) - elif SCons.Util.is_List(env['variant']): - for variant in env['variant']: - AddConfig(self, variant) - - self.platforms = [] - for key in self.configs.keys(): - platform = self.configs[key].platform - if not platform in self.platforms: - self.platforms.append(platform) - - def GenerateProjectFilesInfo(self): - for dspfile in self.dspfiles: - dsp_folder_path, name = os.path.split(dspfile) - dsp_folder_path = os.path.abspath(dsp_folder_path) - dsp_relative_folder_path = os.path.relpath(dsp_folder_path, self.dsw_folder_path) - if dsp_relative_folder_path == os.curdir: - dsp_relative_file_path = name - else: - dsp_relative_file_path = os.path.join(dsp_relative_folder_path, name) - dspfile_info = {'NAME': name, - 'GUID': _generateGUID(dspfile, ''), - 'FOLDER_PATH': dsp_folder_path, - 'FILE_PATH': dspfile, - 'SLN_RELATIVE_FOLDER_PATH': dsp_relative_folder_path, - 'SLN_RELATIVE_FILE_PATH': dsp_relative_file_path} - self.dspfiles_info.append(dspfile_info) - - self.dspfiles_info = [] - GenerateProjectFilesInfo(self) - - def Parse(self): - try: - dswfile = open(self.dswfile,'r') - except IOError: - return # doesn't exist yet, so can't add anything to configs. - - line = dswfile.readline() - while line: - if line[:9] == "EndGlobal": - break - line = dswfile.readline() - - line = dswfile.readline() - datas = line - while line: - line = dswfile.readline() - datas = datas + line - - # OK, we've found our little pickled cache of data. - try: - datas = base64.decodestring(datas) - data = pickle.loads(datas) - except KeyboardInterrupt: - raise - except: - return # unable to unpickle any data for some reason - - self.configs.update(data) - - def PrintSolution(self): - """Writes a solution file""" - self.file.write('Microsoft Visual Studio Solution File, Format Version %s\n' % self.versionstr) - if self.versionstr >= 11.0: - self.file.write('# Visual Studio 11\n') - elif self.version_num >= 10.0: - self.file.write('# Visual Studio 2010\n') - elif self.version_num >= 9.0: - self.file.write('# Visual Studio 2008\n') - elif self.version_num >= 8.0: - self.file.write('# Visual Studio 2005\n') - - for dspinfo in self.dspfiles_info: - name = dspinfo['NAME'] - base, suffix = SCons.Util.splitext(name) - if suffix == '.vcproj': - name = base - self.file.write('Project("%s") = "%s", "%s", "%s"\n' - % (external_makefile_guid, name, dspinfo['SLN_RELATIVE_FILE_PATH'], dspinfo['GUID'])) - if self.version_num >= 7.1 and self.version_num < 8.0: - self.file.write('\tProjectSection(ProjectDependencies) = postProject\n' - '\tEndProjectSection\n') - self.file.write('EndProject\n') - - self.file.write('Global\n') - - env = self.env - if 'MSVS_SCC_PROVIDER' in env: - scc_number_of_projects = len(self.dspfiles) + 1 - slnguid = self.slnguid - scc_provider = env.get('MSVS_SCC_PROVIDER', '').replace(' ', r'\u0020') - scc_project_name = env.get('MSVS_SCC_PROJECT_NAME', '').replace(' ', r'\u0020') - scc_connection_root = env.get('MSVS_SCC_CONNECTION_ROOT', os.curdir) - scc_local_path = os.path.relpath(scc_connection_root, self.dsw_folder_path).replace('\\', '\\\\') - self.file.write('\tGlobalSection(SourceCodeControl) = preSolution\n' - '\t\tSccNumberOfProjects = %(scc_number_of_projects)d\n' - '\t\tSccProjectName0 = %(scc_project_name)s\n' - '\t\tSccLocalPath0 = %(scc_local_path)s\n' - '\t\tSccProvider0 = %(scc_provider)s\n' - '\t\tCanCheckoutShared = true\n' % locals()) - sln_relative_path_from_scc = os.path.relpath(self.dsw_folder_path, scc_connection_root) - if sln_relative_path_from_scc != os.curdir: - self.file.write('\t\tSccProjectFilePathRelativizedFromConnection0 = %s\\\\\n' - % sln_relative_path_from_scc.replace('\\', '\\\\')) - if self.version_num < 8.0: - # When present, SolutionUniqueID is automatically removed by VS 2005 - # TODO: check for Visual Studio versions newer than 2005 - self.file.write('\t\tSolutionUniqueID = %s\n' % slnguid) - for dspinfo in self.dspfiles_info: - i = self.dspfiles_info.index(dspinfo) + 1 - dsp_relative_file_path = dspinfo['SLN_RELATIVE_FILE_PATH'].replace('\\', '\\\\') - dsp_scc_relative_folder_path = os.path.relpath(dspinfo['FOLDER_PATH'], scc_connection_root).replace('\\', '\\\\') - self.file.write('\t\tSccProjectUniqueName%(i)s = %(dsp_relative_file_path)s\n' - '\t\tSccLocalPath%(i)d = %(scc_local_path)s\n' - '\t\tCanCheckoutShared = true\n' - '\t\tSccProjectFilePathRelativizedFromConnection%(i)s = %(dsp_scc_relative_folder_path)s\\\\\n' - % locals()) - self.file.write('\tEndGlobalSection\n') - if self.version_num >= 8.0: - self.file.write('\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n') - else: - self.file.write('\tGlobalSection(SolutionConfiguration) = preSolution\n') - - confkeys = sorted(self.configs.keys()) - cnt = 0 - for name in confkeys: - variant = self.configs[name].variant - platform = self.configs[name].platform - if self.version_num >= 8.0: - self.file.write('\t\t%s|%s = %s|%s\n' % (variant, platform, variant, platform)) - else: - self.file.write('\t\tConfigName.%d = %s\n' % (cnt, variant)) - cnt = cnt + 1 - self.file.write('\tEndGlobalSection\n') - if self.version_num <= 7.1: - self.file.write('\tGlobalSection(ProjectDependencies) = postSolution\n' - '\tEndGlobalSection\n') - if self.version_num >= 8.0: - self.file.write('\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n') - else: - self.file.write('\tGlobalSection(ProjectConfiguration) = postSolution\n') - - for name in confkeys: - variant = self.configs[name].variant - platform = self.configs[name].platform - if self.version_num >= 8.0: - for dspinfo in self.dspfiles_info: - guid = dspinfo['GUID'] - self.file.write('\t\t%s.%s|%s.ActiveCfg = %s|%s\n' - '\t\t%s.%s|%s.Build.0 = %s|%s\n' % (guid,variant,platform,variant,platform,guid,variant,platform,variant,platform)) - else: - for dspinfo in self.dspfiles_info: - guid = dspinfo['GUID'] - self.file.write('\t\t%s.%s.ActiveCfg = %s|%s\n' - '\t\t%s.%s.Build.0 = %s|%s\n' %(guid,variant,variant,platform,guid,variant,variant,platform)) - - self.file.write('\tEndGlobalSection\n') - - if self.version_num >= 8.0: - self.file.write('\tGlobalSection(SolutionProperties) = preSolution\n' - '\t\tHideSolutionNode = FALSE\n' - '\tEndGlobalSection\n') - else: - self.file.write('\tGlobalSection(ExtensibilityGlobals) = postSolution\n' - '\tEndGlobalSection\n' - '\tGlobalSection(ExtensibilityAddIns) = postSolution\n' - '\tEndGlobalSection\n') - self.file.write('EndGlobal\n') - if self.nokeep == 0: - pdata = pickle.dumps(self.configs,1) - pdata = base64.encodestring(pdata) - self.file.write(pdata + '\n') - - def Build(self): - try: - self.file = open(self.dswfile,'w') - except IOError, detail: - raise SCons.Errors.InternalError('Unable to open "' + self.dswfile + '" for writing:' + str(detail)) - else: - self.PrintSolution() - self.file.close() - -V6DSWHeader = """\ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "%(name)s"="%(dspfile)s" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### -""" - -class _GenerateV6DSW(_DSWGenerator): - """Generates a Workspace file for MSVS 6.0""" - - def PrintWorkspace(self): - """ writes a DSW file """ - name = self.name - dspfile = os.path.relpath(self.dspfiles[0], self.dsw_folder_path) - self.file.write(V6DSWHeader % locals()) - - def Build(self): - try: - self.file = open(self.dswfile,'w') - except IOError, detail: - raise SCons.Errors.InternalError('Unable to open "' + self.dswfile + '" for writing:' + str(detail)) - else: - self.PrintWorkspace() - self.file.close() - - -def GenerateDSP(dspfile, source, env): - """Generates a Project file based on the version of MSVS that is being used""" - - version_num = 6.0 - if 'MSVS_VERSION' in env: - version_num, suite = msvs_parse_version(env['MSVS_VERSION']) - if version_num >= 10.0: - g = _GenerateV10DSP(dspfile, source, env) - g.Build() - elif version_num >= 7.0: - g = _GenerateV7DSP(dspfile, source, env) - g.Build() - else: - g = _GenerateV6DSP(dspfile, source, env) - g.Build() - -def GenerateDSW(dswfile, source, env): - """Generates a Solution/Workspace file based on the version of MSVS that is being used""" - - version_num = 6.0 - if 'MSVS_VERSION' in env: - version_num, suite = msvs_parse_version(env['MSVS_VERSION']) - if version_num >= 7.0: - g = _GenerateV7DSW(dswfile, source, env) - g.Build() - else: - g = _GenerateV6DSW(dswfile, source, env) - g.Build() - - -############################################################################## -# Above here are the classes and functions for generation of -# DSP/DSW/SLN/VCPROJ files. -############################################################################## - -def GetMSVSProjectSuffix(target, source, env, for_signature): - return env['MSVS']['PROJECTSUFFIX'] - -def GetMSVSSolutionSuffix(target, source, env, for_signature): - return env['MSVS']['SOLUTIONSUFFIX'] - -def GenerateProject(target, source, env): - # generate the dsp file, according to the version of MSVS. - builddspfile = target[0] - dspfile = builddspfile.srcnode() - - # this detects whether or not we're using a VariantDir - if not dspfile is builddspfile: - try: - bdsp = open(str(builddspfile), "w+") - except IOError, detail: - print 'Unable to open "' + str(dspfile) + '" for writing:',detail,'\n' - raise - - bdsp.write("This is just a placeholder file.\nThe real project file is here:\n%s\n" % dspfile.get_abspath()) - - GenerateDSP(dspfile, source, env) - - if env.get('auto_build_solution', 1): - builddswfile = target[1] - dswfile = builddswfile.srcnode() - - if not dswfile is builddswfile: - - try: - bdsw = open(str(builddswfile), "w+") - except IOError, detail: - print 'Unable to open "' + str(dspfile) + '" for writing:',detail,'\n' - raise - - bdsw.write("This is just a placeholder file.\nThe real workspace file is here:\n%s\n" % dswfile.get_abspath()) - - GenerateDSW(dswfile, source, env) - -def GenerateSolution(target, source, env): - GenerateDSW(target[0], source, env) - -def projectEmitter(target, source, env): - """Sets up the DSP dependencies.""" - - # todo: Not sure what sets source to what user has passed as target, - # but this is what happens. When that is fixed, we also won't have - # to make the user always append env['MSVSPROJECTSUFFIX'] to target. - if source[0] == target[0]: - source = [] - - # make sure the suffix is correct for the version of MSVS we're running. - (base, suff) = SCons.Util.splitext(str(target[0])) - suff = env.subst('$MSVSPROJECTSUFFIX') - target[0] = base + suff - - if not source: - source = 'prj_inputs:' - source = source + env.subst('$MSVSSCONSCOM', 1) - source = source + env.subst('$MSVSENCODING', 1) - - # Project file depends on CPPDEFINES and CPPPATH - preprocdefs = xmlify(';'.join(processDefines(env.get('CPPDEFINES', [])))) - includepath_Dirs = processIncludes(env.get('CPPPATH', []), env, None, None) - includepath = xmlify(';'.join([str(x) for x in includepath_Dirs])) - source = source + "; ppdefs:%s incpath:%s"%(preprocdefs, includepath) - - if 'buildtarget' in env and env['buildtarget'] != None: - if SCons.Util.is_String(env['buildtarget']): - source = source + ' "%s"' % env['buildtarget'] - elif SCons.Util.is_List(env['buildtarget']): - for bt in env['buildtarget']: - if SCons.Util.is_String(bt): - source = source + ' "%s"' % bt - else: - try: source = source + ' "%s"' % bt.get_abspath() - except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None") - else: - try: source = source + ' "%s"' % env['buildtarget'].get_abspath() - except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None") - - if 'outdir' in env and env['outdir'] != None: - if SCons.Util.is_String(env['outdir']): - source = source + ' "%s"' % env['outdir'] - elif SCons.Util.is_List(env['outdir']): - for s in env['outdir']: - if SCons.Util.is_String(s): - source = source + ' "%s"' % s - else: - try: source = source + ' "%s"' % s.get_abspath() - except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None") - else: - try: source = source + ' "%s"' % env['outdir'].get_abspath() - except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None") - - if 'name' in env: - if SCons.Util.is_String(env['name']): - source = source + ' "%s"' % env['name'] - else: - raise SCons.Errors.InternalError("name must be a string") - - if 'variant' in env: - if SCons.Util.is_String(env['variant']): - source = source + ' "%s"' % env['variant'] - elif SCons.Util.is_List(env['variant']): - for variant in env['variant']: - if SCons.Util.is_String(variant): - source = source + ' "%s"' % variant - else: - raise SCons.Errors.InternalError("name must be a string or a list of strings") - else: - raise SCons.Errors.InternalError("variant must be a string or a list of strings") - else: - raise SCons.Errors.InternalError("variant must be specified") - - for s in _DSPGenerator.srcargs: - if s in env: - if SCons.Util.is_String(env[s]): - source = source + ' "%s' % env[s] - elif SCons.Util.is_List(env[s]): - for t in env[s]: - if SCons.Util.is_String(t): - source = source + ' "%s"' % t - else: - raise SCons.Errors.InternalError(s + " must be a string or a list of strings") - else: - raise SCons.Errors.InternalError(s + " must be a string or a list of strings") - - source = source + ' "%s"' % str(target[0]) - source = [SCons.Node.Python.Value(source)] - - targetlist = [target[0]] - sourcelist = source - - if env.get('auto_build_solution', 1): - env['projects'] = [env.File(t).srcnode() for t in targetlist] - t, s = solutionEmitter(target, target, env) - targetlist = targetlist + t - - return (targetlist, sourcelist) - -def solutionEmitter(target, source, env): - """Sets up the DSW dependencies.""" - - # todo: Not sure what sets source to what user has passed as target, - # but this is what happens. When that is fixed, we also won't have - # to make the user always append env['MSVSSOLUTIONSUFFIX'] to target. - if source[0] == target[0]: - source = [] - - # make sure the suffix is correct for the version of MSVS we're running. - (base, suff) = SCons.Util.splitext(str(target[0])) - suff = env.subst('$MSVSSOLUTIONSUFFIX') - target[0] = base + suff - - if not source: - source = 'sln_inputs:' - - if 'name' in env: - if SCons.Util.is_String(env['name']): - source = source + ' "%s"' % env['name'] - else: - raise SCons.Errors.InternalError("name must be a string") - - if 'variant' in env: - if SCons.Util.is_String(env['variant']): - source = source + ' "%s"' % env['variant'] - elif SCons.Util.is_List(env['variant']): - for variant in env['variant']: - if SCons.Util.is_String(variant): - source = source + ' "%s"' % variant - else: - raise SCons.Errors.InternalError("name must be a string or a list of strings") - else: - raise SCons.Errors.InternalError("variant must be a string or a list of strings") - else: - raise SCons.Errors.InternalError("variant must be specified") - - if 'slnguid' in env: - if SCons.Util.is_String(env['slnguid']): - source = source + ' "%s"' % env['slnguid'] - else: - raise SCons.Errors.InternalError("slnguid must be a string") - - if 'projects' in env: - if SCons.Util.is_String(env['projects']): - source = source + ' "%s"' % env['projects'] - elif SCons.Util.is_List(env['projects']): - for t in env['projects']: - if SCons.Util.is_String(t): - source = source + ' "%s"' % t - - source = source + ' "%s"' % str(target[0]) - source = [SCons.Node.Python.Value(source)] - - return ([target[0]], source) - -projectAction = SCons.Action.Action(GenerateProject, None) - -solutionAction = SCons.Action.Action(GenerateSolution, None) - -projectBuilder = SCons.Builder.Builder(action = '$MSVSPROJECTCOM', - suffix = '$MSVSPROJECTSUFFIX', - emitter = projectEmitter) - -solutionBuilder = SCons.Builder.Builder(action = '$MSVSSOLUTIONCOM', - suffix = '$MSVSSOLUTIONSUFFIX', - emitter = solutionEmitter) - -default_MSVS_SConscript = None - -def generate(env): - """Add Builders and construction variables for Microsoft Visual - Studio project files to an Environment.""" - try: - env['BUILDERS']['MSVSProject'] - except KeyError: - env['BUILDERS']['MSVSProject'] = projectBuilder - - try: - env['BUILDERS']['MSVSSolution'] - except KeyError: - env['BUILDERS']['MSVSSolution'] = solutionBuilder - - env['MSVSPROJECTCOM'] = projectAction - env['MSVSSOLUTIONCOM'] = solutionAction - - if SCons.Script.call_stack: - # XXX Need to find a way to abstract this; the build engine - # shouldn't depend on anything in SCons.Script. - env['MSVSSCONSCRIPT'] = SCons.Script.call_stack[0].sconscript - else: - global default_MSVS_SConscript - if default_MSVS_SConscript is None: - default_MSVS_SConscript = env.File('SConstruct') - env['MSVSSCONSCRIPT'] = default_MSVS_SConscript - - env['MSVSSCONS'] = '"%s" -c "%s"' % (python_executable, getExecScriptMain(env)) - env['MSVSSCONSFLAGS'] = '-C "${MSVSSCONSCRIPT.dir.abspath}" -f ${MSVSSCONSCRIPT.name}' - env['MSVSSCONSCOM'] = '$MSVSSCONS $MSVSSCONSFLAGS' - env['MSVSBUILDCOM'] = '$MSVSSCONSCOM "$MSVSBUILDTARGET"' - env['MSVSREBUILDCOM'] = '$MSVSSCONSCOM "$MSVSBUILDTARGET"' - env['MSVSCLEANCOM'] = '$MSVSSCONSCOM -c "$MSVSBUILDTARGET"' - - # Set-up ms tools paths for default version - msvc_setup_env_once(env) - - if 'MSVS_VERSION' in env: - version_num, suite = msvs_parse_version(env['MSVS_VERSION']) - else: - (version_num, suite) = (7.0, None) # guess at a default - if 'MSVS' not in env: - env['MSVS'] = {} - if (version_num < 7.0): - env['MSVS']['PROJECTSUFFIX'] = '.dsp' - env['MSVS']['SOLUTIONSUFFIX'] = '.dsw' - elif (version_num < 10.0): - env['MSVS']['PROJECTSUFFIX'] = '.vcproj' - env['MSVS']['SOLUTIONSUFFIX'] = '.sln' - else: - env['MSVS']['PROJECTSUFFIX'] = '.vcxproj' - env['MSVS']['SOLUTIONSUFFIX'] = '.sln' - - if (version_num >= 10.0): - env['MSVSENCODING'] = 'utf-8' - else: - env['MSVSENCODING'] = 'Windows-1252' - - env['GET_MSVSPROJECTSUFFIX'] = GetMSVSProjectSuffix - env['GET_MSVSSOLUTIONSUFFIX'] = GetMSVSSolutionSuffix - env['MSVSPROJECTSUFFIX'] = '${GET_MSVSPROJECTSUFFIX}' - env['MSVSSOLUTIONSUFFIX'] = '${GET_MSVSSOLUTIONSUFFIX}' - env['SCONS_HOME'] = os.environ.get('SCONS_HOME') - -def exists(env): - return msvc_exists() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/mwcc.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/mwcc.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/mwcc.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/mwcc.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,207 +0,0 @@ -"""SCons.Tool.mwcc - -Tool-specific initialization for the Metrowerks CodeWarrior compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/mwcc.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os -import os.path - -import SCons.Util - -def set_vars(env): - """Set MWCW_VERSION, MWCW_VERSIONS, and some codewarrior environment vars - - MWCW_VERSIONS is set to a list of objects representing installed versions - - MWCW_VERSION is set to the version object that will be used for building. - MWCW_VERSION can be set to a string during Environment - construction to influence which version is chosen, otherwise - the latest one from MWCW_VERSIONS is used. - - Returns true if at least one version is found, false otherwise - """ - desired = env.get('MWCW_VERSION', '') - - # return right away if the variables are already set - if isinstance(desired, MWVersion): - return 1 - elif desired is None: - return 0 - - versions = find_versions() - version = None - - if desired: - for v in versions: - if str(v) == desired: - version = v - elif versions: - version = versions[-1] - - env['MWCW_VERSIONS'] = versions - env['MWCW_VERSION'] = version - - if version is None: - return 0 - - env.PrependENVPath('PATH', version.clpath) - env.PrependENVPath('PATH', version.dllpath) - ENV = env['ENV'] - ENV['CWFolder'] = version.path - ENV['LM_LICENSE_FILE'] = version.license - plus = lambda x: '+%s' % x - ENV['MWCIncludes'] = os.pathsep.join(map(plus, version.includes)) - ENV['MWLibraries'] = os.pathsep.join(map(plus, version.libs)) - return 1 - - -def find_versions(): - """Return a list of MWVersion objects representing installed versions""" - versions = [] - - ### This function finds CodeWarrior by reading from the registry on - ### Windows. Some other method needs to be implemented for other - ### platforms, maybe something that calls env.WhereIs('mwcc') - - if SCons.Util.can_read_reg: - try: - HLM = SCons.Util.HKEY_LOCAL_MACHINE - product = 'SOFTWARE\\Metrowerks\\CodeWarrior\\Product Versions' - product_key = SCons.Util.RegOpenKeyEx(HLM, product) - - i = 0 - while True: - name = product + '\\' + SCons.Util.RegEnumKey(product_key, i) - name_key = SCons.Util.RegOpenKeyEx(HLM, name) - - try: - version = SCons.Util.RegQueryValueEx(name_key, 'VERSION') - path = SCons.Util.RegQueryValueEx(name_key, 'PATH') - mwv = MWVersion(version[0], path[0], 'Win32-X86') - versions.append(mwv) - except SCons.Util.RegError: - pass - - i = i + 1 - - except SCons.Util.RegError: - pass - - return versions - - -class MWVersion(object): - def __init__(self, version, path, platform): - self.version = version - self.path = path - self.platform = platform - self.clpath = os.path.join(path, 'Other Metrowerks Tools', - 'Command Line Tools') - self.dllpath = os.path.join(path, 'Bin') - - # The Metrowerks tools don't store any configuration data so they - # are totally dumb when it comes to locating standard headers, - # libraries, and other files, expecting all the information - # to be handed to them in environment variables. The members set - # below control what information scons injects into the environment - - ### The paths below give a normal build environment in CodeWarrior for - ### Windows, other versions of CodeWarrior might need different paths. - - msl = os.path.join(path, 'MSL') - support = os.path.join(path, '%s Support' % platform) - - self.license = os.path.join(path, 'license.dat') - self.includes = [msl, support] - self.libs = [msl, support] - - def __str__(self): - return self.version - - -CSuffixes = ['.c', '.C'] -CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++'] - - -def generate(env): - """Add Builders and construction variables for the mwcc to an Environment.""" - import SCons.Defaults - import SCons.Tool - - set_vars(env) - - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - - for suffix in CSuffixes: - static_obj.add_action(suffix, SCons.Defaults.CAction) - shared_obj.add_action(suffix, SCons.Defaults.ShCAction) - - for suffix in CXXSuffixes: - static_obj.add_action(suffix, SCons.Defaults.CXXAction) - shared_obj.add_action(suffix, SCons.Defaults.ShCXXAction) - - env['CCCOMFLAGS'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -nolink -o $TARGET $SOURCES' - - env['CC'] = 'mwcc' - env['CCCOM'] = '$CC $CFLAGS $CCFLAGS $CCCOMFLAGS' - - env['CXX'] = 'mwcc' - env['CXXCOM'] = '$CXX $CXXFLAGS $CCCOMFLAGS' - - env['SHCC'] = '$CC' - env['SHCCFLAGS'] = '$CCFLAGS' - env['SHCFLAGS'] = '$CFLAGS' - env['SHCCCOM'] = '$SHCC $SHCFLAGS $SHCCFLAGS $CCCOMFLAGS' - - env['SHCXX'] = '$CXX' - env['SHCXXFLAGS'] = '$CXXFLAGS' - env['SHCXXCOM'] = '$SHCXX $SHCXXFLAGS $CCCOMFLAGS' - - env['CFILESUFFIX'] = '.c' - env['CXXFILESUFFIX'] = '.cpp' - env['CPPDEFPREFIX'] = '-D' - env['CPPDEFSUFFIX'] = '' - env['INCPREFIX'] = '-I' - env['INCSUFFIX'] = '' - - #env['PCH'] = ? - #env['PCHSTOP'] = ? - - -def exists(env): - return set_vars(env) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/mwld.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/mwld.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/mwld.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/mwld.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,107 +0,0 @@ -"""SCons.Tool.mwld - -Tool-specific initialization for the Metrowerks CodeWarrior linker. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/mwld.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Tool - - -def generate(env): - """Add Builders and construction variables for lib to an Environment.""" - SCons.Tool.createStaticLibBuilder(env) - SCons.Tool.createSharedLibBuilder(env) - SCons.Tool.createProgBuilder(env) - - env['AR'] = 'mwld' - env['ARCOM'] = '$AR $ARFLAGS -library -o $TARGET $SOURCES' - - env['LIBDIRPREFIX'] = '-L' - env['LIBDIRSUFFIX'] = '' - env['LIBLINKPREFIX'] = '-l' - env['LIBLINKSUFFIX'] = '.lib' - - env['LINK'] = 'mwld' - env['LINKCOM'] = '$LINK $LINKFLAGS -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' - - env['SHLINK'] = '$LINK' - env['SHLINKFLAGS'] = '$LINKFLAGS' - env['SHLINKCOM'] = shlib_action - env['SHLIBEMITTER']= shlib_emitter - - -def exists(env): - import SCons.Tool.mwcc - return SCons.Tool.mwcc.set_vars(env) - - -def shlib_generator(target, source, env, for_signature): - cmd = ['$SHLINK', '$SHLINKFLAGS', '-shared'] - - no_import_lib = env.get('no_import_lib', 0) - if no_import_lib: cmd.extend('-noimplib') - - dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') - if dll: cmd.extend(['-o', dll]) - - implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') - if implib: cmd.extend(['-implib', implib.get_string(for_signature)]) - - cmd.extend(['$SOURCES', '$_LIBDIRFLAGS', '$_LIBFLAGS']) - - return [cmd] - - -def shlib_emitter(target, source, env): - dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') - no_import_lib = env.get('no_import_lib', 0) - - if not dll: - raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX")) - - if not no_import_lib and \ - not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'): - - # Append an import library to the list of targets. - target.append(env.ReplaceIxes(dll, - 'SHLIBPREFIX', 'SHLIBSUFFIX', - 'LIBPREFIX', 'LIBSUFFIX')) - - return target, source - - -shlib_action = SCons.Action.Action(shlib_generator, generator=1) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/nasm.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/nasm.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/nasm.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/nasm.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -"""SCons.Tool.nasm - -Tool-specific initialization for nasm, the famous Netwide Assembler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/nasm.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Defaults -import SCons.Tool -import SCons.Util - -ASSuffixes = ['.s', '.asm', '.ASM'] -ASPPSuffixes = ['.spp', '.SPP', '.sx'] -if SCons.Util.case_sensitive_suffixes('.s', '.S'): - ASPPSuffixes.extend(['.S']) -else: - ASSuffixes.extend(['.S']) - -def generate(env): - """Add Builders and construction variables for nasm to an Environment.""" - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - - for suffix in ASSuffixes: - static_obj.add_action(suffix, SCons.Defaults.ASAction) - static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) - - for suffix in ASPPSuffixes: - static_obj.add_action(suffix, SCons.Defaults.ASPPAction) - static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) - - env['AS'] = 'nasm' - env['ASFLAGS'] = SCons.Util.CLVar('') - env['ASPPFLAGS'] = '$ASFLAGS' - env['ASCOM'] = '$AS $ASFLAGS -o $TARGET $SOURCES' - env['ASPPCOM'] = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' - -def exists(env): - return env.Detect('nasm') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/__init__.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/__init__.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/__init__.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,312 +0,0 @@ -"""SCons.Tool.Packaging - -SCons Packaging Tool. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/packaging/__init__.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Environment -from SCons.Variables import * -from SCons.Errors import * -from SCons.Util import is_List, make_path_relative -from SCons.Warnings import warn, Warning - -import os, imp -import SCons.Defaults - -__all__ = [ 'src_targz', 'src_tarbz2', 'src_zip', 'tarbz2', 'targz', 'zip', 'rpm', 'msi', 'ipk' ] - -# -# Utility and Builder function -# -def Tag(env, target, source, *more_tags, **kw_tags): - """ Tag a file with the given arguments, just sets the accordingly named - attribute on the file object. - - TODO: FIXME - """ - if not target: - target=source - first_tag=None - else: - first_tag=source - - if first_tag: - kw_tags[first_tag[0]] = '' - - if len(kw_tags) == 0 and len(more_tags) == 0: - raise UserError("No tags given.") - - # XXX: sanity checks - for x in more_tags: - kw_tags[x] = '' - - if not SCons.Util.is_List(target): - target=[target] - else: - # hmm, sometimes the target list, is a list of a list - # make sure it is flattened prior to processing. - # TODO: perhaps some bug ?!? - target=env.Flatten(target) - - for t in target: - for (k,v) in kw_tags.items(): - # all file tags have to start with PACKAGING_, so we can later - # differentiate between "normal" object attributes and the - # packaging attributes. As the user should not be bothered with - # that, the prefix will be added here if missing. - #if not k.startswith('PACKAGING_'): - if k[:10] != 'PACKAGING_': - k='PACKAGING_'+k - setattr(t, k, v) - -def Package(env, target=None, source=None, **kw): - """ Entry point for the package tool. - """ - # check if we need to find the source files ourself - if not source: - source = env.FindInstalledFiles() - - if len(source)==0: - raise UserError("No source for Package() given") - - # decide which types of packages shall be built. Can be defined through - # four mechanisms: command line argument, keyword argument, - # environment argument and default selection( zip or tar.gz ) in that - # order. - try: kw['PACKAGETYPE']=env['PACKAGETYPE'] - except KeyError: pass - - if not kw.get('PACKAGETYPE'): - from SCons.Script import GetOption - kw['PACKAGETYPE'] = GetOption('package_type') - - if kw['PACKAGETYPE'] == None: - if 'Tar' in env['BUILDERS']: - kw['PACKAGETYPE']='targz' - elif 'Zip' in env['BUILDERS']: - kw['PACKAGETYPE']='zip' - else: - raise UserError("No type for Package() given") - - PACKAGETYPE=kw['PACKAGETYPE'] - if not is_List(PACKAGETYPE): - PACKAGETYPE=PACKAGETYPE.split(',') - - # load the needed packagers. - def load_packager(type): - try: - file,path,desc=imp.find_module(type, __path__) - return imp.load_module(type, file, path, desc) - except ImportError, e: - raise EnvironmentError("packager %s not available: %s"%(type,str(e))) - - packagers=list(map(load_packager, PACKAGETYPE)) - - # set up targets and the PACKAGEROOT - try: - # fill up the target list with a default target name until the PACKAGETYPE - # list is of the same size as the target list. - if not target: target = [] - - size_diff = len(PACKAGETYPE)-len(target) - default_name = "%(NAME)s-%(VERSION)s" - - if size_diff>0: - default_target = default_name%kw - target.extend( [default_target]*size_diff ) - - if 'PACKAGEROOT' not in kw: - kw['PACKAGEROOT'] = default_name%kw - - except KeyError, e: - raise SCons.Errors.UserError( "Missing Packagetag '%s'"%e.args[0] ) - - # setup the source files - source=env.arg2nodes(source, env.fs.Entry) - - # call the packager to setup the dependencies. - targets=[] - try: - for packager in packagers: - t=[target.pop(0)] - t=packager.package(env,t,source, **kw) - targets.extend(t) - - assert( len(target) == 0 ) - - except KeyError, e: - raise SCons.Errors.UserError( "Missing Packagetag '%s' for %s packager"\ - % (e.args[0],packager.__name__) ) - except TypeError, e: - # this exception means that a needed argument for the packager is - # missing. As our packagers get their "tags" as named function - # arguments we need to find out which one is missing. - from inspect import getargspec - args,varargs,varkw,defaults=getargspec(packager.package) - if defaults!=None: - args=args[:-len(defaults)] # throw away arguments with default values - args.remove('env') - args.remove('target') - args.remove('source') - # now remove any args for which we have a value in kw. - args=[x for x in args if x not in kw] - - if len(args)==0: - raise # must be a different error, so reraise - elif len(args)==1: - raise SCons.Errors.UserError( "Missing Packagetag '%s' for %s packager"\ - % (args[0],packager.__name__) ) - else: - raise SCons.Errors.UserError( "Missing Packagetags '%s' for %s packager"\ - % (", ".join(args),packager.__name__) ) - - target=env.arg2nodes(target, env.fs.Entry) - targets.extend(env.Alias( 'package', targets )) - return targets - -# -# SCons tool initialization functions -# - -added = None - -def generate(env): - from SCons.Script import AddOption - global added - if not added: - added = 1 - AddOption('--package-type', - dest='package_type', - default=None, - type="string", - action="store", - help='The type of package to create.') - - try: - env['BUILDERS']['Package'] - env['BUILDERS']['Tag'] - except KeyError: - env['BUILDERS']['Package'] = Package - env['BUILDERS']['Tag'] = Tag - -def exists(env): - return 1 - -# XXX -def options(opts): - opts.AddVariables( - EnumVariable( 'PACKAGETYPE', - 'the type of package to create.', - None, allowed_values=list(map( str, __all__ )), - ignorecase=2 - ) - ) - -# -# Internal utility functions -# - -def copy_attr(f1, f2): - """ copies the special packaging file attributes from f1 to f2. - """ - #pattrs = [x for x in dir(f1) if not hasattr(f2, x) and\ - # x.startswith('PACKAGING_')] - copyit = lambda x: not hasattr(f2, x) and x[:10] == 'PACKAGING_' - pattrs = list(filter(copyit, dir(f1))) - for attr in pattrs: - setattr(f2, attr, getattr(f1, attr)) -def putintopackageroot(target, source, env, pkgroot, honor_install_location=1): - """ Uses the CopyAs builder to copy all source files to the directory given - in pkgroot. - - If honor_install_location is set and the copied source file has an - PACKAGING_INSTALL_LOCATION attribute, the PACKAGING_INSTALL_LOCATION is - used as the new name of the source file under pkgroot. - - The source file will not be copied if it is already under the the pkgroot - directory. - - All attributes of the source file will be copied to the new file. - """ - # make sure the packageroot is a Dir object. - if SCons.Util.is_String(pkgroot): pkgroot=env.Dir(pkgroot) - if not SCons.Util.is_List(source): source=[source] - - new_source = [] - for file in source: - if SCons.Util.is_String(file): file = env.File(file) - - if file.is_under(pkgroot): - new_source.append(file) - else: - if hasattr(file, 'PACKAGING_INSTALL_LOCATION') and\ - honor_install_location: - new_name=make_path_relative(file.PACKAGING_INSTALL_LOCATION) - else: - new_name=make_path_relative(file.get_path()) - - new_file=pkgroot.File(new_name) - new_file=env.CopyAs(new_file, file)[0] - copy_attr(file, new_file) - new_source.append(new_file) - - return (target, new_source) - -def stripinstallbuilder(target, source, env): - """ strips the install builder action from the source list and stores - the final installation location as the "PACKAGING_INSTALL_LOCATION" of - the source of the source file. This effectively removes the final installed - files from the source list while remembering the installation location. - - It also warns about files which have no install builder attached. - """ - def has_no_install_location(file): - return not (file.has_builder() and\ - hasattr(file.builder, 'name') and\ - (file.builder.name=="InstallBuilder" or\ - file.builder.name=="InstallAsBuilder")) - - if len(list(filter(has_no_install_location, source))): - warn(Warning, "there are files to package which have no\ - InstallBuilder attached, this might lead to irreproducible packages") - - n_source=[] - for s in source: - if has_no_install_location(s): - n_source.append(s) - else: - for ss in s.sources: - n_source.append(ss) - copy_attr(s, ss) - setattr(ss, 'PACKAGING_INSTALL_LOCATION', s.get_path()) - - return (target, n_source) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/ipk.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/ipk.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/ipk.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/ipk.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,185 +0,0 @@ -"""SCons.Tool.Packaging.ipk -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/packaging/ipk.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Builder -import SCons.Node.FS -import os - -from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot - -def package(env, target, source, PACKAGEROOT, NAME, VERSION, DESCRIPTION, - SUMMARY, X_IPK_PRIORITY, X_IPK_SECTION, SOURCE_URL, - X_IPK_MAINTAINER, X_IPK_DEPENDS, **kw): - """ this function prepares the packageroot directory for packaging with the - ipkg builder. - """ - SCons.Tool.Tool('ipkg').generate(env) - - # setup the Ipkg builder - bld = env['BUILDERS']['Ipkg'] - target, source = stripinstallbuilder(target, source, env) - target, source = putintopackageroot(target, source, env, PACKAGEROOT) - - # This should be overridable from the construction environment, - # which it is by using ARCHITECTURE=. - # Guessing based on what os.uname() returns at least allows it - # to work for both i386 and x86_64 Linux systems. - archmap = { - 'i686' : 'i386', - 'i586' : 'i386', - 'i486' : 'i386', - } - - buildarchitecture = os.uname()[4] - buildarchitecture = archmap.get(buildarchitecture, buildarchitecture) - - if 'ARCHITECTURE' in kw: - buildarchitecture = kw['ARCHITECTURE'] - - # setup the kw to contain the mandatory arguments to this fucntion. - # do this before calling any builder or setup function - loc=locals() - del loc['kw'] - kw.update(loc) - del kw['source'], kw['target'], kw['env'] - - # generate the specfile - specfile = gen_ipk_dir(PACKAGEROOT, source, env, kw) - - # override the default target. - if str(target[0])=="%s-%s"%(NAME, VERSION): - target=[ "%s_%s_%s.ipk"%(NAME, VERSION, buildarchitecture) ] - - # now apply the Ipkg builder - return bld(env, target, specfile, **kw) - -def gen_ipk_dir(proot, source, env, kw): - # make sure the packageroot is a Dir object. - if SCons.Util.is_String(proot): proot=env.Dir(proot) - - # create the specfile builder - s_bld=SCons.Builder.Builder( - action = build_specfiles, - ) - - # create the specfile targets - spec_target=[] - control=proot.Dir('CONTROL') - spec_target.append(control.File('control')) - spec_target.append(control.File('conffiles')) - spec_target.append(control.File('postrm')) - spec_target.append(control.File('prerm')) - spec_target.append(control.File('postinst')) - spec_target.append(control.File('preinst')) - - # apply the builder to the specfile targets - s_bld(env, spec_target, source, **kw) - - # the packageroot directory does now contain the specfiles. - return proot - -def build_specfiles(source, target, env): - """ filter the targets for the needed files and use the variables in env - to create the specfile. - """ - # - # At first we care for the CONTROL/control file, which is the main file for ipk. - # - # For this we need to open multiple files in random order, so we store into - # a dict so they can be easily accessed. - # - # - opened_files={} - def open_file(needle, haystack): - try: - return opened_files[needle] - except KeyError: - file=filter(lambda x: x.get_path().rfind(needle)!=-1, haystack)[0] - opened_files[needle]=open(file.abspath, 'w') - return opened_files[needle] - - control_file=open_file('control', target) - - if 'X_IPK_DESCRIPTION' not in env: - env['X_IPK_DESCRIPTION']="%s\n %s"%(env['SUMMARY'], - env['DESCRIPTION'].replace('\n', '\n ')) - - - content = """ -Package: $NAME -Version: $VERSION -Priority: $X_IPK_PRIORITY -Section: $X_IPK_SECTION -Source: $SOURCE_URL -Architecture: $ARCHITECTURE -Maintainer: $X_IPK_MAINTAINER -Depends: $X_IPK_DEPENDS -Description: $X_IPK_DESCRIPTION -""" - - control_file.write(env.subst(content)) - - # - # now handle the various other files, which purpose it is to set post-, - # pre-scripts and mark files as config files. - # - # We do so by filtering the source files for files which are marked with - # the "config" tag and afterwards we do the same for x_ipk_postrm, - # x_ipk_prerm, x_ipk_postinst and x_ipk_preinst tags. - # - # The first one will write the name of the file into the file - # CONTROL/configfiles, the latter add the content of the x_ipk_* variable - # into the same named file. - # - for f in [x for x in source if 'PACKAGING_CONFIG' in dir(x)]: - config=open_file('conffiles') - config.write(f.PACKAGING_INSTALL_LOCATION) - config.write('\n') - - for str in 'POSTRM PRERM POSTINST PREINST'.split(): - name="PACKAGING_X_IPK_%s"%str - for f in [x for x in source if name in dir(x)]: - file=open_file(name) - file.write(env[str]) - - # - # close all opened files - for f in opened_files.values(): - f.close() - - # call a user specified function - if 'CHANGE_SPECFILE' in env: - content += env['CHANGE_SPECFILE'](target) - - return 0 - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/msi.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/msi.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/msi.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/msi.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,527 +0,0 @@ -"""SCons.Tool.packaging.msi - -The msi packager. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/packaging/msi.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os -import SCons -from SCons.Action import Action -from SCons.Builder import Builder - -from xml.dom.minidom import * -from xml.sax.saxutils import escape - -from SCons.Tool.packaging import stripinstallbuilder - -# -# Utility functions -# -def convert_to_id(s, id_set): - """ Some parts of .wxs need an Id attribute (for example: The File and - Directory directives. The charset is limited to A-Z, a-z, digits, - underscores, periods. Each Id must begin with a letter or with a - underscore. Google for "CNDL0015" for information about this. - - Requirements: - * the string created must only contain chars from the target charset. - * the string created must have a minimal editing distance from the - original string. - * the string created must be unique for the whole .wxs file. - - Observation: - * There are 62 chars in the charset. - - Idea: - * filter out forbidden characters. Check for a collision with the help - of the id_set. Add the number of the number of the collision at the - end of the created string. Furthermore care for a correct start of - the string. - """ - charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxyz0123456789_.' - if s[0] in '0123456789.': - s += '_'+s - id = [c for c in s if c in charset] - - # did we already generate an id for this file? - try: - return id_set[id][s] - except KeyError: - # no we did not so initialize with the id - if id not in id_set: id_set[id] = { s : id } - # there is a collision, generate an id which is unique by appending - # the collision number - else: id_set[id][s] = id + str(len(id_set[id])) - - return id_set[id][s] - -def is_dos_short_file_name(file): - """ examine if the given file is in the 8.3 form. - """ - fname, ext = os.path.splitext(file) - proper_ext = len(ext) == 0 or (2 <= len(ext) <= 4) # the ext contains the dot - proper_fname = file.isupper() and len(fname) <= 8 - - return proper_ext and proper_fname - -def gen_dos_short_file_name(file, filename_set): - """ see http://support.microsoft.com/default.aspx?scid=kb;en-us;Q142982 - - These are no complete 8.3 dos short names. The ~ char is missing and - replaced with one character from the filename. WiX warns about such - filenames, since a collision might occur. Google for "CNDL1014" for - more information. - """ - # guard this to not confuse the generation - if is_dos_short_file_name(file): - return file - - fname, ext = os.path.splitext(file) # ext contains the dot - - # first try if it suffices to convert to upper - file = file.upper() - if is_dos_short_file_name(file): - return file - - # strip forbidden characters. - forbidden = '."/[]:;=, ' - fname = [c for c in fname if c not in forbidden] - - # check if we already generated a filename with the same number: - # thisis1.txt, thisis2.txt etc. - duplicate, num = not None, 1 - while duplicate: - shortname = "%s%s" % (fname[:8-len(str(num))].upper(),\ - str(num)) - if len(ext) >= 2: - shortname = "%s%s" % (shortname, ext[:4].upper()) - - duplicate, num = shortname in filename_set, num+1 - - assert( is_dos_short_file_name(shortname) ), 'shortname is %s, longname is %s' % (shortname, file) - filename_set.append(shortname) - return shortname - -def create_feature_dict(files): - """ X_MSI_FEATURE and doc FileTag's can be used to collect files in a - hierarchy. This function collects the files into this hierarchy. - """ - dict = {} - - def add_to_dict( feature, file ): - if not SCons.Util.is_List( feature ): - feature = [ feature ] - - for f in feature: - if f not in dict: - dict[ f ] = [ file ] - else: - dict[ f ].append( file ) - - for file in files: - if hasattr( file, 'PACKAGING_X_MSI_FEATURE' ): - add_to_dict(file.PACKAGING_X_MSI_FEATURE, file) - elif hasattr( file, 'PACKAGING_DOC' ): - add_to_dict( 'PACKAGING_DOC', file ) - else: - add_to_dict( 'default', file ) - - return dict - -def generate_guids(root): - """ generates globally unique identifiers for parts of the xml which need - them. - - Component tags have a special requirement. Their UUID is only allowed to - change if the list of their contained resources has changed. This allows - for clean removal and proper updates. - - To handle this requirement, the uuid is generated with an md5 hashing the - whole subtree of a xml node. - """ - from hashlib import md5 - - # specify which tags need a guid and in which attribute this should be stored. - needs_id = { 'Product' : 'Id', - 'Package' : 'Id', - 'Component' : 'Guid', - } - - # find all XMl nodes matching the key, retrieve their attribute, hash their - # subtree, convert hash to string and add as a attribute to the xml node. - for (key,value) in needs_id.items(): - node_list = root.getElementsByTagName(key) - attribute = value - for node in node_list: - hash = md5(node.toxml()).hexdigest() - hash_str = '%s-%s-%s-%s-%s' % ( hash[:8], hash[8:12], hash[12:16], hash[16:20], hash[20:] ) - node.attributes[attribute] = hash_str - - - -def string_wxsfile(target, source, env): - return "building WiX file %s"%( target[0].path ) - -def build_wxsfile(target, source, env): - """ compiles a .wxs file from the keywords given in env['msi_spec'] and - by analyzing the tree of source nodes and their tags. - """ - file = open(target[0].abspath, 'w') - - try: - # Create a document with the Wix root tag - doc = Document() - root = doc.createElement( 'Wix' ) - root.attributes['xmlns']='http://schemas.microsoft.com/wix/2003/01/wi' - doc.appendChild( root ) - - filename_set = [] # this is to circumvent duplicates in the shortnames - id_set = {} # this is to circumvent duplicates in the ids - - # Create the content - build_wxsfile_header_section(root, env) - build_wxsfile_file_section(root, source, env['NAME'], env['VERSION'], env['VENDOR'], filename_set, id_set) - generate_guids(root) - build_wxsfile_features_section(root, source, env['NAME'], env['VERSION'], env['SUMMARY'], id_set) - build_wxsfile_default_gui(root) - build_license_file(target[0].get_dir(), env) - - # write the xml to a file - file.write( doc.toprettyxml() ) - - # call a user specified function - if 'CHANGE_SPECFILE' in env: - env['CHANGE_SPECFILE'](target, source) - - except KeyError, e: - raise SCons.Errors.UserError( '"%s" package field for MSI is missing.' % e.args[0] ) - -# -# setup function -# -def create_default_directory_layout(root, NAME, VERSION, VENDOR, filename_set): - """ Create the wix default target directory layout and return the innermost - directory. - - We assume that the XML tree delivered in the root argument already contains - the Product tag. - - Everything is put under the PFiles directory property defined by WiX. - After that a directory with the 'VENDOR' tag is placed and then a - directory with the name of the project and its VERSION. This leads to the - following TARGET Directory Layout: - C:\\\\ - Example: C:\Programme\Company\Product-1.2\ - """ - doc = Document() - d1 = doc.createElement( 'Directory' ) - d1.attributes['Id'] = 'TARGETDIR' - d1.attributes['Name'] = 'SourceDir' - - d2 = doc.createElement( 'Directory' ) - d2.attributes['Id'] = 'ProgramFilesFolder' - d2.attributes['Name'] = 'PFiles' - - d3 = doc.createElement( 'Directory' ) - d3.attributes['Id'] = 'VENDOR_folder' - d3.attributes['Name'] = escape( gen_dos_short_file_name( VENDOR, filename_set ) ) - d3.attributes['LongName'] = escape( VENDOR ) - - d4 = doc.createElement( 'Directory' ) - project_folder = "%s-%s" % ( NAME, VERSION ) - d4.attributes['Id'] = 'MY_DEFAULT_FOLDER' - d4.attributes['Name'] = escape( gen_dos_short_file_name( project_folder, filename_set ) ) - d4.attributes['LongName'] = escape( project_folder ) - - d1.childNodes.append( d2 ) - d2.childNodes.append( d3 ) - d3.childNodes.append( d4 ) - - root.getElementsByTagName('Product')[0].childNodes.append( d1 ) - - return d4 - -# -# mandatory and optional file tags -# -def build_wxsfile_file_section(root, files, NAME, VERSION, VENDOR, filename_set, id_set): - """ builds the Component sections of the wxs file with their included files. - - Files need to be specified in 8.3 format and in the long name format, long - filenames will be converted automatically. - - Features are specficied with the 'X_MSI_FEATURE' or 'DOC' FileTag. - """ - root = create_default_directory_layout( root, NAME, VERSION, VENDOR, filename_set ) - components = create_feature_dict( files ) - factory = Document() - - def get_directory( node, dir ): - """ returns the node under the given node representing the directory. - - Returns the component node if dir is None or empty. - """ - if dir == '' or not dir: - return node - - Directory = node - dir_parts = dir.split(os.path.sep) - - # to make sure that our directory ids are unique, the parent folders are - # consecutively added to upper_dir - upper_dir = '' - - # walk down the xml tree finding parts of the directory - dir_parts = [d for d in dir_parts if d != ''] - for d in dir_parts[:]: - already_created = [c for c in Directory.childNodes - if c.nodeName == 'Directory' - and c.attributes['LongName'].value == escape(d)] - - if already_created != []: - Directory = already_created[0] - dir_parts.remove(d) - upper_dir += d - else: - break - - for d in dir_parts: - nDirectory = factory.createElement( 'Directory' ) - nDirectory.attributes['LongName'] = escape( d ) - nDirectory.attributes['Name'] = escape( gen_dos_short_file_name( d, filename_set ) ) - upper_dir += d - nDirectory.attributes['Id'] = convert_to_id( upper_dir, id_set ) - - Directory.childNodes.append( nDirectory ) - Directory = nDirectory - - return Directory - - for file in files: - drive, path = os.path.splitdrive( file.PACKAGING_INSTALL_LOCATION ) - filename = os.path.basename( path ) - dirname = os.path.dirname( path ) - - h = { - # tagname : default value - 'PACKAGING_X_MSI_VITAL' : 'yes', - 'PACKAGING_X_MSI_FILEID' : convert_to_id(filename, id_set), - 'PACKAGING_X_MSI_LONGNAME' : filename, - 'PACKAGING_X_MSI_SHORTNAME' : gen_dos_short_file_name(filename, filename_set), - 'PACKAGING_X_MSI_SOURCE' : file.get_path(), - } - - # fill in the default tags given above. - for k,v in [ (k, v) for (k,v) in h.items() if not hasattr(file, k) ]: - setattr( file, k, v ) - - File = factory.createElement( 'File' ) - File.attributes['LongName'] = escape( file.PACKAGING_X_MSI_LONGNAME ) - File.attributes['Name'] = escape( file.PACKAGING_X_MSI_SHORTNAME ) - File.attributes['Source'] = escape( file.PACKAGING_X_MSI_SOURCE ) - File.attributes['Id'] = escape( file.PACKAGING_X_MSI_FILEID ) - File.attributes['Vital'] = escape( file.PACKAGING_X_MSI_VITAL ) - - # create the Tag under which this file should appear - Component = factory.createElement('Component') - Component.attributes['DiskId'] = '1' - Component.attributes['Id'] = convert_to_id( filename, id_set ) - - # hang the component node under the root node and the file node - # under the component node. - Directory = get_directory( root, dirname ) - Directory.childNodes.append( Component ) - Component.childNodes.append( File ) - -# -# additional functions -# -def build_wxsfile_features_section(root, files, NAME, VERSION, SUMMARY, id_set): - """ This function creates the tag based on the supplied xml tree. - - This is achieved by finding all s and adding them to a default target. - - It should be called after the tree has been built completly. We assume - that a MY_DEFAULT_FOLDER Property is defined in the wxs file tree. - - Furthermore a top-level with the name and VERSION of the software will be created. - - An PACKAGING_X_MSI_FEATURE can either be a string, where the feature - DESCRIPTION will be the same as its title or a Tuple, where the first - part will be its title and the second its DESCRIPTION. - """ - factory = Document() - Feature = factory.createElement('Feature') - Feature.attributes['Id'] = 'complete' - Feature.attributes['ConfigurableDirectory'] = 'MY_DEFAULT_FOLDER' - Feature.attributes['Level'] = '1' - Feature.attributes['Title'] = escape( '%s %s' % (NAME, VERSION) ) - Feature.attributes['Description'] = escape( SUMMARY ) - Feature.attributes['Display'] = 'expand' - - for (feature, files) in create_feature_dict(files).items(): - SubFeature = factory.createElement('Feature') - SubFeature.attributes['Level'] = '1' - - if SCons.Util.is_Tuple(feature): - SubFeature.attributes['Id'] = convert_to_id( feature[0], id_set ) - SubFeature.attributes['Title'] = escape(feature[0]) - SubFeature.attributes['Description'] = escape(feature[1]) - else: - SubFeature.attributes['Id'] = convert_to_id( feature, id_set ) - if feature=='default': - SubFeature.attributes['Description'] = 'Main Part' - SubFeature.attributes['Title'] = 'Main Part' - elif feature=='PACKAGING_DOC': - SubFeature.attributes['Description'] = 'Documentation' - SubFeature.attributes['Title'] = 'Documentation' - else: - SubFeature.attributes['Description'] = escape(feature) - SubFeature.attributes['Title'] = escape(feature) - - # build the componentrefs. As one of the design decision is that every - # file is also a component we walk the list of files and create a - # reference. - for f in files: - ComponentRef = factory.createElement('ComponentRef') - ComponentRef.attributes['Id'] = convert_to_id( os.path.basename(f.get_path()), id_set ) - SubFeature.childNodes.append(ComponentRef) - - Feature.childNodes.append(SubFeature) - - root.getElementsByTagName('Product')[0].childNodes.append(Feature) - -def build_wxsfile_default_gui(root): - """ this function adds a default GUI to the wxs file - """ - factory = Document() - Product = root.getElementsByTagName('Product')[0] - - UIRef = factory.createElement('UIRef') - UIRef.attributes['Id'] = 'WixUI_Mondo' - Product.childNodes.append(UIRef) - - UIRef = factory.createElement('UIRef') - UIRef.attributes['Id'] = 'WixUI_ErrorProgressText' - Product.childNodes.append(UIRef) - -def build_license_file(directory, spec): - """ creates a License.rtf file with the content of "X_MSI_LICENSE_TEXT" - in the given directory - """ - name, text = '', '' - - try: - name = spec['LICENSE'] - text = spec['X_MSI_LICENSE_TEXT'] - except KeyError: - pass # ignore this as X_MSI_LICENSE_TEXT is optional - - if name!='' or text!='': - file = open( os.path.join(directory.get_path(), 'License.rtf'), 'w' ) - file.write('{\\rtf') - if text!='': - file.write(text.replace('\n', '\\par ')) - else: - file.write(name+'\\par\\par') - file.write('}') - file.close() - -# -# mandatory and optional package tags -# -def build_wxsfile_header_section(root, spec): - """ Adds the xml file node which define the package meta-data. - """ - # Create the needed DOM nodes and add them at the correct position in the tree. - factory = Document() - Product = factory.createElement( 'Product' ) - Package = factory.createElement( 'Package' ) - - root.childNodes.append( Product ) - Product.childNodes.append( Package ) - - # set "mandatory" default values - if 'X_MSI_LANGUAGE' not in spec: - spec['X_MSI_LANGUAGE'] = '1033' # select english - - # mandatory sections, will throw a KeyError if the tag is not available - Product.attributes['Name'] = escape( spec['NAME'] ) - Product.attributes['Version'] = escape( spec['VERSION'] ) - Product.attributes['Manufacturer'] = escape( spec['VENDOR'] ) - Product.attributes['Language'] = escape( spec['X_MSI_LANGUAGE'] ) - Package.attributes['Description'] = escape( spec['SUMMARY'] ) - - # now the optional tags, for which we avoid the KeyErrror exception - if 'DESCRIPTION' in spec: - Package.attributes['Comments'] = escape( spec['DESCRIPTION'] ) - - if 'X_MSI_UPGRADE_CODE' in spec: - Package.attributes['X_MSI_UPGRADE_CODE'] = escape( spec['X_MSI_UPGRADE_CODE'] ) - - # We hardcode the media tag as our current model cannot handle it. - Media = factory.createElement('Media') - Media.attributes['Id'] = '1' - Media.attributes['Cabinet'] = 'default.cab' - Media.attributes['EmbedCab'] = 'yes' - root.getElementsByTagName('Product')[0].childNodes.append(Media) - -# this builder is the entry-point for .wxs file compiler. -wxs_builder = Builder( - action = Action( build_wxsfile, string_wxsfile ), - ensure_suffix = '.wxs' ) - -def package(env, target, source, PACKAGEROOT, NAME, VERSION, - DESCRIPTION, SUMMARY, VENDOR, X_MSI_LANGUAGE, **kw): - # make sure that the Wix Builder is in the environment - SCons.Tool.Tool('wix').generate(env) - - # get put the keywords for the specfile compiler. These are the arguments - # given to the package function and all optional ones stored in kw, minus - # the the source, target and env one. - loc = locals() - del loc['kw'] - kw.update(loc) - del kw['source'], kw['target'], kw['env'] - - # strip the install builder from the source files - target, source = stripinstallbuilder(target, source, env) - - # put the arguments into the env and call the specfile builder. - env['msi_spec'] = kw - specfile = wxs_builder(* [env, target, source], **kw) - - # now call the WiX Tool with the built specfile added as a source. - msifile = env.WiX(target, specfile) - - # return the target and source tuple. - return (msifile, source+[specfile]) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/rpm.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/rpm.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/rpm.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/rpm.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,365 +0,0 @@ -"""SCons.Tool.Packaging.rpm - -The rpm packager. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/packaging/rpm.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os - -import SCons.Builder - -from SCons.Environment import OverrideEnvironment -from SCons.Tool.packaging import stripinstallbuilder, src_targz -from SCons.Errors import UserError - -def package(env, target, source, PACKAGEROOT, NAME, VERSION, - PACKAGEVERSION, DESCRIPTION, SUMMARY, X_RPM_GROUP, LICENSE, - **kw): - # initialize the rpm tool - SCons.Tool.Tool('rpm').generate(env) - - bld = env['BUILDERS']['Rpm'] - - # Generate a UserError whenever the target name has been set explicitly, - # since rpm does not allow for controlling it. This is detected by - # checking if the target has been set to the default by the Package() - # Environment function. - if str(target[0])!="%s-%s"%(NAME, VERSION): - raise UserError( "Setting target is not supported for rpm." ) - else: - # This should be overridable from the construction environment, - # which it is by using ARCHITECTURE=. - # Guessing based on what os.uname() returns at least allows it - # to work for both i386 and x86_64 Linux systems. - archmap = { - 'i686' : 'i386', - 'i586' : 'i386', - 'i486' : 'i386', - } - - buildarchitecture = os.uname()[4] - buildarchitecture = archmap.get(buildarchitecture, buildarchitecture) - - if 'ARCHITECTURE' in kw: - buildarchitecture = kw['ARCHITECTURE'] - - fmt = '%s-%s-%s.%s.rpm' - srcrpm = fmt % (NAME, VERSION, PACKAGEVERSION, 'src') - binrpm = fmt % (NAME, VERSION, PACKAGEVERSION, buildarchitecture) - - target = [ srcrpm, binrpm ] - - # get the correct arguments into the kw hash - loc=locals() - del loc['kw'] - kw.update(loc) - del kw['source'], kw['target'], kw['env'] - - # if no "SOURCE_URL" tag is given add a default one. - if 'SOURCE_URL' not in kw: - #kw['SOURCE_URL']=(str(target[0])+".tar.gz").replace('.rpm', '') - kw['SOURCE_URL']=(str(target[0])+".tar.gz").replace('.rpm', '') - - # mangle the source and target list for the rpmbuild - env = OverrideEnvironment(env, kw) - target, source = stripinstallbuilder(target, source, env) - target, source = addspecfile(target, source, env) - target, source = collectintargz(target, source, env) - - # now call the rpm builder to actually build the packet. - return bld(env, target, source, **kw) - -def collectintargz(target, source, env): - """ Puts all source files into a tar.gz file. """ - # the rpm tool depends on a source package, until this is chagned - # this hack needs to be here that tries to pack all sources in. - sources = env.FindSourceFiles() - - # filter out the target we are building the source list for. - #sources = [s for s in sources if not (s in target)] - sources = [s for s in sources if s not in target] - - # find the .spec file for rpm and add it since it is not necessarily found - # by the FindSourceFiles function. - #sources.extend( [s for s in source if str(s).rfind('.spec')!=-1] ) - spec_file = lambda s: str(s).rfind('.spec') != -1 - sources.extend( list(filter(spec_file, source)) ) - - # as the source contains the url of the source package this rpm package - # is built from, we extract the target name - #tarball = (str(target[0])+".tar.gz").replace('.rpm', '') - tarball = (str(target[0])+".tar.gz").replace('.rpm', '') - try: - #tarball = env['SOURCE_URL'].split('/')[-1] - tarball = env['SOURCE_URL'].split('/')[-1] - except KeyError, e: - raise SCons.Errors.UserError( "Missing PackageTag '%s' for RPM packager" % e.args[0] ) - - tarball = src_targz.package(env, source=sources, target=tarball, - PACKAGEROOT=env['PACKAGEROOT'], ) - - return (target, tarball) - -def addspecfile(target, source, env): - specfile = "%s-%s" % (env['NAME'], env['VERSION']) - - bld = SCons.Builder.Builder(action = build_specfile, - suffix = '.spec', - target_factory = SCons.Node.FS.File) - - source.extend(bld(env, specfile, source)) - - return (target,source) - -def build_specfile(target, source, env): - """ Builds a RPM specfile from a dictionary with string metadata and - by analyzing a tree of nodes. - """ - file = open(target[0].abspath, 'w') - str = "" - - try: - file.write( build_specfile_header(env) ) - file.write( build_specfile_sections(env) ) - file.write( build_specfile_filesection(env, source) ) - file.close() - - # call a user specified function - if 'CHANGE_SPECFILE' in env: - env['CHANGE_SPECFILE'](target, source) - - except KeyError, e: - raise SCons.Errors.UserError( '"%s" package field for RPM is missing.' % e.args[0] ) - - -# -# mandatory and optional package tag section -# -def build_specfile_sections(spec): - """ Builds the sections of a rpm specfile. - """ - str = "" - - mandatory_sections = { - 'DESCRIPTION' : '\n%%description\n%s\n\n', } - - str = str + SimpleTagCompiler(mandatory_sections).compile( spec ) - - optional_sections = { - 'DESCRIPTION_' : '%%description -l %s\n%s\n\n', - 'CHANGELOG' : '%%changelog\n%s\n\n', - 'X_RPM_PREINSTALL' : '%%pre\n%s\n\n', - 'X_RPM_POSTINSTALL' : '%%post\n%s\n\n', - 'X_RPM_PREUNINSTALL' : '%%preun\n%s\n\n', - 'X_RPM_POSTUNINSTALL' : '%%postun\n%s\n\n', - 'X_RPM_VERIFY' : '%%verify\n%s\n\n', - - # These are for internal use but could possibly be overriden - 'X_RPM_PREP' : '%%prep\n%s\n\n', - 'X_RPM_BUILD' : '%%build\n%s\n\n', - 'X_RPM_INSTALL' : '%%install\n%s\n\n', - 'X_RPM_CLEAN' : '%%clean\n%s\n\n', - } - - # Default prep, build, install and clean rules - # TODO: optimize those build steps, to not compile the project a second time - if 'X_RPM_PREP' not in spec: - spec['X_RPM_PREP'] = '[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"' + '\n%setup -q' - - if 'X_RPM_BUILD' not in spec: - spec['X_RPM_BUILD'] = 'mkdir "$RPM_BUILD_ROOT"' - - if 'X_RPM_INSTALL' not in spec: - spec['X_RPM_INSTALL'] = 'scons --install-sandbox="$RPM_BUILD_ROOT" "$RPM_BUILD_ROOT"' - - if 'X_RPM_CLEAN' not in spec: - spec['X_RPM_CLEAN'] = '[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"' - - str = str + SimpleTagCompiler(optional_sections, mandatory=0).compile( spec ) - - return str - -def build_specfile_header(spec): - """ Builds all section but the %file of a rpm specfile - """ - str = "" - - # first the mandatory sections - mandatory_header_fields = { - 'NAME' : '%%define name %s\nName: %%{name}\n', - 'VERSION' : '%%define version %s\nVersion: %%{version}\n', - 'PACKAGEVERSION' : '%%define release %s\nRelease: %%{release}\n', - 'X_RPM_GROUP' : 'Group: %s\n', - 'SUMMARY' : 'Summary: %s\n', - 'LICENSE' : 'License: %s\n', } - - str = str + SimpleTagCompiler(mandatory_header_fields).compile( spec ) - - # now the optional tags - optional_header_fields = { - 'VENDOR' : 'Vendor: %s\n', - 'X_RPM_URL' : 'Url: %s\n', - 'SOURCE_URL' : 'Source: %s\n', - 'SUMMARY_' : 'Summary(%s): %s\n', - 'X_RPM_DISTRIBUTION' : 'Distribution: %s\n', - 'X_RPM_ICON' : 'Icon: %s\n', - 'X_RPM_PACKAGER' : 'Packager: %s\n', - 'X_RPM_GROUP_' : 'Group(%s): %s\n', - - 'X_RPM_REQUIRES' : 'Requires: %s\n', - 'X_RPM_PROVIDES' : 'Provides: %s\n', - 'X_RPM_CONFLICTS' : 'Conflicts: %s\n', - 'X_RPM_BUILDREQUIRES' : 'BuildRequires: %s\n', - - 'X_RPM_SERIAL' : 'Serial: %s\n', - 'X_RPM_EPOCH' : 'Epoch: %s\n', - 'X_RPM_AUTOREQPROV' : 'AutoReqProv: %s\n', - 'X_RPM_EXCLUDEARCH' : 'ExcludeArch: %s\n', - 'X_RPM_EXCLUSIVEARCH' : 'ExclusiveArch: %s\n', - 'X_RPM_PREFIX' : 'Prefix: %s\n', - 'X_RPM_CONFLICTS' : 'Conflicts: %s\n', - - # internal use - 'X_RPM_BUILDROOT' : 'BuildRoot: %s\n', } - - # fill in default values: - # Adding a BuildRequires renders the .rpm unbuildable under System, which - # are not managed by rpm, since the database to resolve this dependency is - # missing (take Gentoo as an example) -# if not s.has_key('x_rpm_BuildRequires'): -# s['x_rpm_BuildRequires'] = 'scons' - - if 'X_RPM_BUILDROOT' not in spec: - spec['X_RPM_BUILDROOT'] = '%{_tmppath}/%{name}-%{version}-%{release}' - - str = str + SimpleTagCompiler(optional_header_fields, mandatory=0).compile( spec ) - return str - -# -# mandatory and optional file tags -# -def build_specfile_filesection(spec, files): - """ builds the %file section of the specfile - """ - str = '%files\n' - - if 'X_RPM_DEFATTR' not in spec: - spec['X_RPM_DEFATTR'] = '(-,root,root)' - - str = str + '%%defattr %s\n' % spec['X_RPM_DEFATTR'] - - supported_tags = { - 'PACKAGING_CONFIG' : '%%config %s', - 'PACKAGING_CONFIG_NOREPLACE' : '%%config(noreplace) %s', - 'PACKAGING_DOC' : '%%doc %s', - 'PACKAGING_UNIX_ATTR' : '%%attr %s', - 'PACKAGING_LANG_' : '%%lang(%s) %s', - 'PACKAGING_X_RPM_VERIFY' : '%%verify %s', - 'PACKAGING_X_RPM_DIR' : '%%dir %s', - 'PACKAGING_X_RPM_DOCDIR' : '%%docdir %s', - 'PACKAGING_X_RPM_GHOST' : '%%ghost %s', } - - for file in files: - # build the tagset - tags = {} - for k in supported_tags.keys(): - try: - tags[k]=getattr(file, k) - except AttributeError: - pass - - # compile the tagset - str = str + SimpleTagCompiler(supported_tags, mandatory=0).compile( tags ) - - str = str + ' ' - str = str + file.PACKAGING_INSTALL_LOCATION - str = str + '\n\n' - - return str - -class SimpleTagCompiler(object): - """ This class is a simple string substition utility: - the replacement specfication is stored in the tagset dictionary, something - like: - { "abc" : "cdef %s ", - "abc_" : "cdef %s %s" } - - the compile function gets a value dictionary, which may look like: - { "abc" : "ghij", - "abc_gh" : "ij" } - - The resulting string will be: - "cdef ghij cdef gh ij" - """ - def __init__(self, tagset, mandatory=1): - self.tagset = tagset - self.mandatory = mandatory - - def compile(self, values): - """ compiles the tagset and returns a str containing the result - """ - def is_international(tag): - #return tag.endswith('_') - return tag[-1:] == '_' - - def get_country_code(tag): - return tag[-2:] - - def strip_country_code(tag): - return tag[:-2] - - replacements = list(self.tagset.items()) - - str = "" - #domestic = [ (k,v) for k,v in replacements if not is_international(k) ] - domestic = [t for t in replacements if not is_international(t[0])] - for key, replacement in domestic: - try: - str = str + replacement % values[key] - except KeyError, e: - if self.mandatory: - raise e - - #international = [ (k,v) for k,v in replacements if is_international(k) ] - international = [t for t in replacements if is_international(t[0])] - for key, replacement in international: - try: - #int_values_for_key = [ (get_country_code(k),v) for k,v in values.items() if strip_country_code(k) == key ] - x = [t for t in values.items() if strip_country_code(t[0]) == key] - int_values_for_key = [(get_country_code(t[0]),t[1]) for t in x] - for v in int_values_for_key: - str = str + replacement % v - except KeyError, e: - if self.mandatory: - raise e - - return str - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/src_tarbz2.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/src_tarbz2.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/src_tarbz2.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/src_tarbz2.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -"""SCons.Tool.Packaging.tarbz2 - -The tarbz2 SRC packager. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/packaging/src_tarbz2.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -from SCons.Tool.packaging import putintopackageroot - -def package(env, target, source, PACKAGEROOT, **kw): - bld = env['BUILDERS']['Tar'] - bld.set_suffix('.tar.bz2') - target, source = putintopackageroot(target, source, env, PACKAGEROOT, honor_install_location=0) - return bld(env, target, source, TARFLAGS='-jc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/src_targz.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/src_targz.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/src_targz.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/src_targz.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -"""SCons.Tool.Packaging.targz - -The targz SRC packager. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/packaging/src_targz.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -from SCons.Tool.packaging import putintopackageroot - -def package(env, target, source, PACKAGEROOT, **kw): - bld = env['BUILDERS']['Tar'] - bld.set_suffix('.tar.gz') - target, source = putintopackageroot(target, source, env, PACKAGEROOT, honor_install_location=0) - return bld(env, target, source, TARFLAGS='-zc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/src_zip.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/src_zip.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/src_zip.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/src_zip.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -"""SCons.Tool.Packaging.zip - -The zip SRC packager. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/packaging/src_zip.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -from SCons.Tool.packaging import putintopackageroot - -def package(env, target, source, PACKAGEROOT, **kw): - bld = env['BUILDERS']['Zip'] - bld.set_suffix('.zip') - target, source = putintopackageroot(target, source, env, PACKAGEROOT, honor_install_location=0) - return bld(env, target, source) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/tarbz2.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/tarbz2.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/tarbz2.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/tarbz2.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -"""SCons.Tool.Packaging.tarbz2 - -The tarbz2 SRC packager. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/packaging/tarbz2.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot - -def package(env, target, source, PACKAGEROOT, **kw): - bld = env['BUILDERS']['Tar'] - bld.set_suffix('.tar.gz') - target, source = putintopackageroot(target, source, env, PACKAGEROOT) - target, source = stripinstallbuilder(target, source, env) - return bld(env, target, source, TARFLAGS='-jc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/targz.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/targz.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/targz.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/targz.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -"""SCons.Tool.Packaging.targz - -The targz SRC packager. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/packaging/targz.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot - -def package(env, target, source, PACKAGEROOT, **kw): - bld = env['BUILDERS']['Tar'] - bld.set_suffix('.tar.gz') - target, source = stripinstallbuilder(target, source, env) - target, source = putintopackageroot(target, source, env, PACKAGEROOT) - return bld(env, target, source, TARFLAGS='-zc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/zip.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/zip.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/packaging/zip.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/packaging/zip.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -"""SCons.Tool.Packaging.zip - -The zip SRC packager. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/packaging/zip.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot - -def package(env, target, source, PACKAGEROOT, **kw): - bld = env['BUILDERS']['Zip'] - bld.set_suffix('.zip') - target, source = stripinstallbuilder(target, source, env) - target, source = putintopackageroot(target, source, env, PACKAGEROOT) - return bld(env, target, source) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/pdf.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/pdf.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/pdf.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/pdf.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -"""SCons.Tool.pdf - -Common PDF Builder definition for various other Tool modules that use it. -Add an explicit action to run epstopdf to convert .eps files to .pdf - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/pdf.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Builder -import SCons.Tool - -PDFBuilder = None - -EpsPdfAction = SCons.Action.Action('$EPSTOPDFCOM', '$EPSTOPDFCOMSTR') - -def generate(env): - try: - env['BUILDERS']['PDF'] - except KeyError: - global PDFBuilder - if PDFBuilder is None: - PDFBuilder = SCons.Builder.Builder(action = {}, - source_scanner = SCons.Tool.PDFLaTeXScanner, - prefix = '$PDFPREFIX', - suffix = '$PDFSUFFIX', - emitter = {}, - source_ext_match = None, - single_source=True) - env['BUILDERS']['PDF'] = PDFBuilder - - env['PDFPREFIX'] = '' - env['PDFSUFFIX'] = '.pdf' - -# put the epstopdf builder in this routine so we can add it after -# the pdftex builder so that one is the default for no source suffix -def generate2(env): - bld = env['BUILDERS']['PDF'] - #bld.add_action('.ps', EpsPdfAction) # this is covered by direct Ghostcript action in gs.py - bld.add_action('.eps', EpsPdfAction) - - env['EPSTOPDF'] = 'epstopdf' - env['EPSTOPDFFLAGS'] = SCons.Util.CLVar('') - env['EPSTOPDFCOM'] = '$EPSTOPDF $EPSTOPDFFLAGS ${SOURCE} --outfile=${TARGET}' - -def exists(env): - # This only puts a skeleton Builder in place, so if someone - # references this Tool directly, it's always "available." - return 1 - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/pdflatex.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/pdflatex.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/pdflatex.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/pdflatex.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -"""SCons.Tool.pdflatex - -Tool-specific initialization for pdflatex. -Generates .pdf files from .latex or .ltx files - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/pdflatex.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Action -import SCons.Util -import SCons.Tool.pdf -import SCons.Tool.tex - -PDFLaTeXAction = None - -def PDFLaTeXAuxFunction(target = None, source= None, env=None): - result = SCons.Tool.tex.InternalLaTeXAuxAction( PDFLaTeXAction, target, source, env ) - if result != 0: - SCons.Tool.tex.check_file_error_message(env['PDFLATEX']) - return result - -PDFLaTeXAuxAction = None - -def generate(env): - """Add Builders and construction variables for pdflatex to an Environment.""" - global PDFLaTeXAction - if PDFLaTeXAction is None: - PDFLaTeXAction = SCons.Action.Action('$PDFLATEXCOM', '$PDFLATEXCOMSTR') - - global PDFLaTeXAuxAction - if PDFLaTeXAuxAction is None: - PDFLaTeXAuxAction = SCons.Action.Action(PDFLaTeXAuxFunction, - strfunction=SCons.Tool.tex.TeXLaTeXStrFunction) - - env.AppendUnique(LATEXSUFFIXES=SCons.Tool.LaTeXSuffixes) - - import pdf - pdf.generate(env) - - bld = env['BUILDERS']['PDF'] - bld.add_action('.ltx', PDFLaTeXAuxAction) - bld.add_action('.latex', PDFLaTeXAuxAction) - bld.add_emitter('.ltx', SCons.Tool.tex.tex_pdf_emitter) - bld.add_emitter('.latex', SCons.Tool.tex.tex_pdf_emitter) - - SCons.Tool.tex.generate_common(env) - -def exists(env): - SCons.Tool.tex.generate_darwin(env) - return env.Detect('pdflatex') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/pdftex.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/pdftex.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/pdftex.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/pdftex.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,109 +0,0 @@ -"""SCons.Tool.pdftex - -Tool-specific initialization for pdftex. -Generates .pdf files from .tex files - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/pdftex.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os -import SCons.Action -import SCons.Util -import SCons.Tool.tex - -PDFTeXAction = None - -# This action might be needed more than once if we are dealing with -# labels and bibtex. -PDFLaTeXAction = None - -def PDFLaTeXAuxAction(target = None, source= None, env=None): - result = SCons.Tool.tex.InternalLaTeXAuxAction( PDFLaTeXAction, target, source, env ) - return result - -def PDFTeXLaTeXFunction(target = None, source= None, env=None): - """A builder for TeX and LaTeX that scans the source file to - decide the "flavor" of the source and then executes the appropriate - program.""" - basedir = os.path.split(str(source[0]))[0] - abspath = os.path.abspath(basedir) - - if SCons.Tool.tex.is_LaTeX(source,env,abspath): - result = PDFLaTeXAuxAction(target,source,env) - if result != 0: - SCons.Tool.tex.check_file_error_message(env['PDFLATEX']) - else: - result = PDFTeXAction(target,source,env) - if result != 0: - SCons.Tool.tex.check_file_error_message(env['PDFTEX']) - return result - -PDFTeXLaTeXAction = None - -def generate(env): - """Add Builders and construction variables for pdftex to an Environment.""" - global PDFTeXAction - if PDFTeXAction is None: - PDFTeXAction = SCons.Action.Action('$PDFTEXCOM', '$PDFTEXCOMSTR') - - global PDFLaTeXAction - if PDFLaTeXAction is None: - PDFLaTeXAction = SCons.Action.Action("$PDFLATEXCOM", "$PDFLATEXCOMSTR") - - global PDFTeXLaTeXAction - if PDFTeXLaTeXAction is None: - PDFTeXLaTeXAction = SCons.Action.Action(PDFTeXLaTeXFunction, - strfunction=SCons.Tool.tex.TeXLaTeXStrFunction) - - env.AppendUnique(LATEXSUFFIXES=SCons.Tool.LaTeXSuffixes) - - import pdf - pdf.generate(env) - - bld = env['BUILDERS']['PDF'] - bld.add_action('.tex', PDFTeXLaTeXAction) - bld.add_emitter('.tex', SCons.Tool.tex.tex_pdf_emitter) - - # Add the epstopdf builder after the pdftex builder - # so pdftex is the default for no source suffix - pdf.generate2(env) - - SCons.Tool.tex.generate_common(env) - -def exists(env): - SCons.Tool.tex.generate_darwin(env) - return env.Detect('pdftex') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/qt.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/qt.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/qt.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/qt.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,336 +0,0 @@ - -"""SCons.Tool.qt - -Tool-specific initialization for Qt. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/qt.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path -import re - -import SCons.Action -import SCons.Builder -import SCons.Defaults -import SCons.Scanner -import SCons.Tool -import SCons.Util - -class ToolQtWarning(SCons.Warnings.Warning): - pass - -class GeneratedMocFileNotIncluded(ToolQtWarning): - pass - -class QtdirNotFound(ToolQtWarning): - pass - -SCons.Warnings.enableWarningClass(ToolQtWarning) - -header_extensions = [".h", ".hxx", ".hpp", ".hh"] -if SCons.Util.case_sensitive_suffixes('.h', '.H'): - header_extensions.append('.H') -cplusplus = __import__('c++', globals(), locals(), []) -cxx_suffixes = cplusplus.CXXSuffixes - -def checkMocIncluded(target, source, env): - moc = target[0] - cpp = source[0] - # looks like cpp.includes is cleared before the build stage :-( - # not really sure about the path transformations (moc.cwd? cpp.cwd?) :-/ - path = SCons.Defaults.CScan.path(env, moc.cwd) - includes = SCons.Defaults.CScan(cpp, env, path) - if not moc in includes: - SCons.Warnings.warn( - GeneratedMocFileNotIncluded, - "Generated moc file '%s' is not included by '%s'" % - (str(moc), str(cpp))) - -def find_file(filename, paths, node_factory): - for dir in paths: - node = node_factory(filename, dir) - if node.rexists(): - return node - return None - -class _Automoc(object): - """ - Callable class, which works as an emitter for Programs, SharedLibraries and - StaticLibraries. - """ - - def __init__(self, objBuilderName): - self.objBuilderName = objBuilderName - - def __call__(self, target, source, env): - """ - Smart autoscan function. Gets the list of objects for the Program - or Lib. Adds objects and builders for the special qt files. - """ - try: - if int(env.subst('$QT_AUTOSCAN')) == 0: - return target, source - except ValueError: - pass - try: - debug = int(env.subst('$QT_DEBUG')) - except ValueError: - debug = 0 - - # some shortcuts used in the scanner - splitext = SCons.Util.splitext - objBuilder = getattr(env, self.objBuilderName) - - # some regular expressions: - # Q_OBJECT detection - q_object_search = re.compile(r'[^A-Za-z0-9]Q_OBJECT[^A-Za-z0-9]') - # cxx and c comment 'eater' - #comment = re.compile(r'(//.*)|(/\*(([^*])|(\*[^/]))*\*/)') - # CW: something must be wrong with the regexp. See also bug #998222 - # CURRENTLY THERE IS NO TEST CASE FOR THAT - - # The following is kind of hacky to get builders working properly (FIXME) - objBuilderEnv = objBuilder.env - objBuilder.env = env - mocBuilderEnv = env.Moc.env - env.Moc.env = env - - # make a deep copy for the result; MocH objects will be appended - out_sources = source[:] - - for obj in source: - if not obj.has_builder(): - # binary obj file provided - if debug: - print "scons: qt: '%s' seems to be a binary. Discarded." % str(obj) - continue - cpp = obj.sources[0] - if not splitext(str(cpp))[1] in cxx_suffixes: - if debug: - print "scons: qt: '%s' is no cxx file. Discarded." % str(cpp) - # c or fortran source - continue - #cpp_contents = comment.sub('', cpp.get_text_contents()) - cpp_contents = cpp.get_text_contents() - h=None - for h_ext in header_extensions: - # try to find the header file in the corresponding source - # directory - hname = splitext(cpp.name)[0] + h_ext - h = find_file(hname, (cpp.get_dir(),), env.File) - if h: - if debug: - print "scons: qt: Scanning '%s' (header of '%s')" % (str(h), str(cpp)) - #h_contents = comment.sub('', h.get_text_contents()) - h_contents = h.get_text_contents() - break - if not h and debug: - print "scons: qt: no header for '%s'." % (str(cpp)) - if h and q_object_search.search(h_contents): - # h file with the Q_OBJECT macro found -> add moc_cpp - moc_cpp = env.Moc(h) - moc_o = objBuilder(moc_cpp) - out_sources.append(moc_o) - #moc_cpp.target_scanner = SCons.Defaults.CScan - if debug: - print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp)) - if cpp and q_object_search.search(cpp_contents): - # cpp file with Q_OBJECT macro found -> add moc - # (to be included in cpp) - moc = env.Moc(cpp) - env.Ignore(moc, moc) - if debug: - print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(cpp), str(moc)) - #moc.source_scanner = SCons.Defaults.CScan - # restore the original env attributes (FIXME) - objBuilder.env = objBuilderEnv - env.Moc.env = mocBuilderEnv - - return (target, out_sources) - -AutomocShared = _Automoc('SharedObject') -AutomocStatic = _Automoc('StaticObject') - -def _detect(env): - """Not really safe, but fast method to detect the QT library""" - QTDIR = None - if not QTDIR: - QTDIR = env.get('QTDIR',None) - if not QTDIR: - QTDIR = os.environ.get('QTDIR',None) - if not QTDIR: - moc = env.WhereIs('moc') - if moc: - QTDIR = os.path.dirname(os.path.dirname(moc)) - SCons.Warnings.warn( - QtdirNotFound, - "Could not detect qt, using moc executable as a hint (QTDIR=%s)" % QTDIR) - else: - QTDIR = None - SCons.Warnings.warn( - QtdirNotFound, - "Could not detect qt, using empty QTDIR") - return QTDIR - -def uicEmitter(target, source, env): - adjustixes = SCons.Util.adjustixes - bs = SCons.Util.splitext(str(source[0].name))[0] - bs = os.path.join(str(target[0].get_dir()),bs) - # first target (header) is automatically added by builder - if len(target) < 2: - # second target is implementation - target.append(adjustixes(bs, - env.subst('$QT_UICIMPLPREFIX'), - env.subst('$QT_UICIMPLSUFFIX'))) - if len(target) < 3: - # third target is moc file - target.append(adjustixes(bs, - env.subst('$QT_MOCHPREFIX'), - env.subst('$QT_MOCHSUFFIX'))) - return target, source - -def uicScannerFunc(node, env, path): - lookout = [] - lookout.extend(env['CPPPATH']) - lookout.append(str(node.rfile().dir)) - includes = re.findall("(.*?)", node.get_text_contents()) - result = [] - for incFile in includes: - dep = env.FindFile(incFile,lookout) - if dep: - result.append(dep) - return result - -uicScanner = SCons.Scanner.Base(uicScannerFunc, - name = "UicScanner", - node_class = SCons.Node.FS.File, - node_factory = SCons.Node.FS.File, - recursive = 0) - -def generate(env): - """Add Builders and construction variables for qt to an Environment.""" - CLVar = SCons.Util.CLVar - Action = SCons.Action.Action - Builder = SCons.Builder.Builder - - env.SetDefault(QTDIR = _detect(env), - QT_BINPATH = os.path.join('$QTDIR', 'bin'), - QT_CPPPATH = os.path.join('$QTDIR', 'include'), - QT_LIBPATH = os.path.join('$QTDIR', 'lib'), - QT_MOC = os.path.join('$QT_BINPATH','moc'), - QT_UIC = os.path.join('$QT_BINPATH','uic'), - QT_LIB = 'qt', # may be set to qt-mt - - QT_AUTOSCAN = 1, # scan for moc'able sources - - # Some QT specific flags. I don't expect someone wants to - # manipulate those ... - QT_UICIMPLFLAGS = CLVar(''), - QT_UICDECLFLAGS = CLVar(''), - QT_MOCFROMHFLAGS = CLVar(''), - QT_MOCFROMCXXFLAGS = CLVar('-i'), - - # suffixes/prefixes for the headers / sources to generate - QT_UICDECLPREFIX = '', - QT_UICDECLSUFFIX = '.h', - QT_UICIMPLPREFIX = 'uic_', - QT_UICIMPLSUFFIX = '$CXXFILESUFFIX', - QT_MOCHPREFIX = 'moc_', - QT_MOCHSUFFIX = '$CXXFILESUFFIX', - QT_MOCCXXPREFIX = '', - QT_MOCCXXSUFFIX = '.moc', - QT_UISUFFIX = '.ui', - - # Commands for the qt support ... - # command to generate header, implementation and moc-file - # from a .ui file - QT_UICCOM = [ - CLVar('$QT_UIC $QT_UICDECLFLAGS -o ${TARGETS[0]} $SOURCE'), - CLVar('$QT_UIC $QT_UICIMPLFLAGS -impl ${TARGETS[0].file} ' - '-o ${TARGETS[1]} $SOURCE'), - CLVar('$QT_MOC $QT_MOCFROMHFLAGS -o ${TARGETS[2]} ${TARGETS[0]}')], - # command to generate meta object information for a class - # declarated in a header - QT_MOCFROMHCOM = ( - '$QT_MOC $QT_MOCFROMHFLAGS -o ${TARGETS[0]} $SOURCE'), - # command to generate meta object information for a class - # declarated in a cpp file - QT_MOCFROMCXXCOM = [ - CLVar('$QT_MOC $QT_MOCFROMCXXFLAGS -o ${TARGETS[0]} $SOURCE'), - Action(checkMocIncluded,None)]) - - # ... and the corresponding builders - uicBld = Builder(action=SCons.Action.Action('$QT_UICCOM', '$QT_UICCOMSTR'), - emitter=uicEmitter, - src_suffix='$QT_UISUFFIX', - suffix='$QT_UICDECLSUFFIX', - prefix='$QT_UICDECLPREFIX', - source_scanner=uicScanner) - mocBld = Builder(action={}, prefix={}, suffix={}) - for h in header_extensions: - act = SCons.Action.Action('$QT_MOCFROMHCOM', '$QT_MOCFROMHCOMSTR') - mocBld.add_action(h, act) - mocBld.prefix[h] = '$QT_MOCHPREFIX' - mocBld.suffix[h] = '$QT_MOCHSUFFIX' - for cxx in cxx_suffixes: - act = SCons.Action.Action('$QT_MOCFROMCXXCOM', '$QT_MOCFROMCXXCOMSTR') - mocBld.add_action(cxx, act) - mocBld.prefix[cxx] = '$QT_MOCCXXPREFIX' - mocBld.suffix[cxx] = '$QT_MOCCXXSUFFIX' - - # register the builders - env['BUILDERS']['Uic'] = uicBld - env['BUILDERS']['Moc'] = mocBld - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - static_obj.add_src_builder('Uic') - shared_obj.add_src_builder('Uic') - - # We use the emitters of Program / StaticLibrary / SharedLibrary - # to scan for moc'able files - # We can't refer to the builders directly, we have to fetch them - # as Environment attributes because that sets them up to be called - # correctly later by our emitter. - env.AppendUnique(PROGEMITTER =[AutomocStatic], - SHLIBEMITTER=[AutomocShared], - LIBEMITTER =[AutomocStatic], - # Of course, we need to link against the qt libraries - CPPPATH=["$QT_CPPPATH"], - LIBPATH=["$QT_LIBPATH"], - LIBS=['$QT_LIB']) - -def exists(env): - return _detect(env) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/rmic.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/rmic.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/rmic.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/rmic.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,126 +0,0 @@ -"""SCons.Tool.rmic - -Tool-specific initialization for rmic. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/rmic.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path - -import SCons.Action -import SCons.Builder -import SCons.Node.FS -import SCons.Util - -def emit_rmic_classes(target, source, env): - """Create and return lists of Java RMI stub and skeleton - class files to be created from a set of class files. - """ - class_suffix = env.get('JAVACLASSSUFFIX', '.class') - classdir = env.get('JAVACLASSDIR') - - if not classdir: - try: - s = source[0] - except IndexError: - classdir = '.' - else: - try: - classdir = s.attributes.java_classdir - except AttributeError: - classdir = '.' - classdir = env.Dir(classdir).rdir() - if str(classdir) == '.': - c_ = None - else: - c_ = str(classdir) + os.sep - - slist = [] - for src in source: - try: - classname = src.attributes.java_classname - except AttributeError: - classname = str(src) - if c_ and classname[:len(c_)] == c_: - classname = classname[len(c_):] - if class_suffix and classname[:-len(class_suffix)] == class_suffix: - classname = classname[-len(class_suffix):] - s = src.rfile() - s.attributes.java_classdir = classdir - s.attributes.java_classname = classname - slist.append(s) - - stub_suffixes = ['_Stub'] - if env.get('JAVAVERSION') == '1.4': - stub_suffixes.append('_Skel') - - tlist = [] - for s in source: - for suff in stub_suffixes: - fname = s.attributes.java_classname.replace('.', os.sep) + \ - suff + class_suffix - t = target[0].File(fname) - t.attributes.java_lookupdir = target[0] - tlist.append(t) - - return tlist, source - -RMICAction = SCons.Action.Action('$RMICCOM', '$RMICCOMSTR') - -RMICBuilder = SCons.Builder.Builder(action = RMICAction, - emitter = emit_rmic_classes, - src_suffix = '$JAVACLASSSUFFIX', - target_factory = SCons.Node.FS.Dir, - source_factory = SCons.Node.FS.File) - -def generate(env): - """Add Builders and construction variables for rmic to an Environment.""" - env['BUILDERS']['RMIC'] = RMICBuilder - - env['RMIC'] = 'rmic' - env['RMICFLAGS'] = SCons.Util.CLVar('') - env['RMICCOM'] = '$RMIC $RMICFLAGS -d ${TARGET.attributes.java_lookupdir} -classpath ${SOURCE.attributes.java_classdir} ${SOURCES.attributes.java_classname}' - env['JAVACLASSSUFFIX'] = '.class' - -def exists(env): - # As reported by Jan Nijtmans in issue #2730, the simple - # return env.Detect('rmic') - # doesn't always work during initialization. For now, we - # stop trying to detect an executable (analogous to the - # javac Builder). - # TODO: Come up with a proper detect() routine...and enable it. - return 1 - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/rpcgen.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/rpcgen.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/rpcgen.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/rpcgen.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -"""SCons.Tool.rpcgen - -Tool-specific initialization for RPCGEN tools. - -Three normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/rpcgen.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -from SCons.Builder import Builder -import SCons.Util - -cmd = "cd ${SOURCE.dir} && $RPCGEN -%s $RPCGENFLAGS %s -o ${TARGET.abspath} ${SOURCE.file}" - -rpcgen_client = cmd % ('l', '$RPCGENCLIENTFLAGS') -rpcgen_header = cmd % ('h', '$RPCGENHEADERFLAGS') -rpcgen_service = cmd % ('m', '$RPCGENSERVICEFLAGS') -rpcgen_xdr = cmd % ('c', '$RPCGENXDRFLAGS') - -def generate(env): - "Add RPCGEN Builders and construction variables for an Environment." - - client = Builder(action=rpcgen_client, suffix='_clnt.c', src_suffix='.x') - header = Builder(action=rpcgen_header, suffix='.h', src_suffix='.x') - service = Builder(action=rpcgen_service, suffix='_svc.c', src_suffix='.x') - xdr = Builder(action=rpcgen_xdr, suffix='_xdr.c', src_suffix='.x') - env.Append(BUILDERS={'RPCGenClient' : client, - 'RPCGenHeader' : header, - 'RPCGenService' : service, - 'RPCGenXDR' : xdr}) - env['RPCGEN'] = 'rpcgen' - env['RPCGENFLAGS'] = SCons.Util.CLVar('') - env['RPCGENCLIENTFLAGS'] = SCons.Util.CLVar('') - env['RPCGENHEADERFLAGS'] = SCons.Util.CLVar('') - env['RPCGENSERVICEFLAGS'] = SCons.Util.CLVar('') - env['RPCGENXDRFLAGS'] = SCons.Util.CLVar('') - -def exists(env): - return env.Detect('rpcgen') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/rpm.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/rpm.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/rpm.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/rpm.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,132 +0,0 @@ -"""SCons.Tool.rpm - -Tool-specific initialization for rpm. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -The rpm tool calls the rpmbuild command. The first and only argument should a -tar.gz consisting of the source file and a specfile. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/rpm.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os -import re -import shutil -import subprocess - -import SCons.Builder -import SCons.Node.FS -import SCons.Util -import SCons.Action -import SCons.Defaults - -def get_cmd(source, env): - tar_file_with_included_specfile = source - if SCons.Util.is_List(source): - tar_file_with_included_specfile = source[0] - return "%s %s %s"%(env['RPM'], env['RPMFLAGS'], - tar_file_with_included_specfile.abspath ) - -def build_rpm(target, source, env): - # create a temporary rpm build root. - tmpdir = os.path.join( os.path.dirname( target[0].abspath ), 'rpmtemp' ) - if os.path.exists(tmpdir): - shutil.rmtree(tmpdir) - - # now create the mandatory rpm directory structure. - for d in ['RPMS', 'SRPMS', 'SPECS', 'BUILD']: - os.makedirs( os.path.join( tmpdir, d ) ) - - # set the topdir as an rpmflag. - env.Prepend( RPMFLAGS = '--define \'_topdir %s\'' % tmpdir ) - - # now call rpmbuild to create the rpm package. - handle = subprocess.Popen(get_cmd(source, env), - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - shell=True) - output = handle.stdout.read() - status = handle.wait() - - if status: - raise SCons.Errors.BuildError( node=target[0], - errstr=output, - filename=str(target[0]) ) - else: - # XXX: assume that LC_ALL=c is set while running rpmbuild - output_files = re.compile( 'Wrote: (.*)' ).findall( output ) - - for output, input in zip( output_files, target ): - rpm_output = os.path.basename(output) - expected = os.path.basename(input.get_path()) - - assert expected == rpm_output, "got %s but expected %s" % (rpm_output, expected) - shutil.copy( output, input.abspath ) - - - # cleanup before leaving. - shutil.rmtree(tmpdir) - - return status - -def string_rpm(target, source, env): - try: - return env['RPMCOMSTR'] - except KeyError: - return get_cmd(source, env) - -rpmAction = SCons.Action.Action(build_rpm, string_rpm) - -RpmBuilder = SCons.Builder.Builder(action = SCons.Action.Action('$RPMCOM', '$RPMCOMSTR'), - source_scanner = SCons.Defaults.DirScanner, - suffix = '$RPMSUFFIX') - - - -def generate(env): - """Add Builders and construction variables for rpm to an Environment.""" - try: - bld = env['BUILDERS']['Rpm'] - except KeyError: - bld = RpmBuilder - env['BUILDERS']['Rpm'] = bld - - env.SetDefault(RPM = 'LC_ALL=c rpmbuild') - env.SetDefault(RPMFLAGS = SCons.Util.CLVar('-ta')) - env.SetDefault(RPMCOM = rpmAction) - env.SetDefault(RPMSUFFIX = '.rpm') - -def exists(env): - return env.Detect('rpmbuild') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sgiar.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sgiar.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sgiar.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sgiar.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -"""SCons.Tool.sgiar - -Tool-specific initialization for SGI ar (library archive). If CC -exists, static libraries should be built with it, so the prelinker has -a chance to resolve C++ template instantiations. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/sgiar.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Defaults -import SCons.Tool -import SCons.Util - -def generate(env): - """Add Builders and construction variables for ar to an Environment.""" - SCons.Tool.createStaticLibBuilder(env) - - if env.Detect('CC'): - env['AR'] = 'CC' - env['ARFLAGS'] = SCons.Util.CLVar('-ar') - env['ARCOM'] = '$AR $ARFLAGS -o $TARGET $SOURCES' - else: - env['AR'] = 'ar' - env['ARFLAGS'] = SCons.Util.CLVar('r') - env['ARCOM'] = '$AR $ARFLAGS $TARGET $SOURCES' - - env['SHLINK'] = '$LINK' - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') - env['SHLINKCOM'] = '$SHLINK $SHLINKFLAGS -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' - env['LIBPREFIX'] = 'lib' - env['LIBSUFFIX'] = '.a' - -def exists(env): - return env.Detect('CC') or env.Detect('ar') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sgic++.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sgic++.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sgic++.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sgic++.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -"""SCons.Tool.sgic++ - -Tool-specific initialization for MIPSpro C++ on SGI. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/sgic++.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Util - -cplusplus = __import__('c++', globals(), locals(), []) - -def generate(env): - """Add Builders and construction variables for SGI MIPS C++ to an Environment.""" - - cplusplus.generate(env) - - env['CXX'] = 'CC' - env['CXXFLAGS'] = SCons.Util.CLVar('-LANG:std') - env['SHCXX'] = '$CXX' - env['SHOBJSUFFIX'] = '.o' - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 - -def exists(env): - return env.Detect('CC') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sgicc.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sgicc.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sgicc.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sgicc.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -"""SCons.Tool.sgicc - -Tool-specific initialization for MIPSPro cc on SGI. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/sgicc.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import cc - -def generate(env): - """Add Builders and construction variables for gcc to an Environment.""" - cc.generate(env) - - env['CXX'] = 'CC' - env['SHOBJSUFFIX'] = '.o' - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 - -def exists(env): - return env.Detect('cc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sgilink.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sgilink.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sgilink.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sgilink.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -"""SCons.Tool.sgilink - -Tool-specific initialization for the SGI MIPSPro linker on SGI. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/sgilink.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Util - -import link - -linkers = ['CC', 'cc'] - -def generate(env): - """Add Builders and construction variables for MIPSPro to an Environment.""" - link.generate(env) - - env['LINK'] = env.Detect(linkers) or 'cc' - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') - - # __RPATH is set to $_RPATH in the platform specification if that - # platform supports it. - env['RPATHPREFIX'] = '-rpath ' - env['RPATHSUFFIX'] = '' - env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}' - -def exists(env): - return env.Detect(linkers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sunar.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sunar.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sunar.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sunar.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -"""engine.SCons.Tool.sunar - -Tool-specific initialization for Solaris (Forte) ar (library archive). If CC -exists, static libraries should be built with it, so that template -instantians can be resolved. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/sunar.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Defaults -import SCons.Tool -import SCons.Util - -def generate(env): - """Add Builders and construction variables for ar to an Environment.""" - SCons.Tool.createStaticLibBuilder(env) - - if env.Detect('CC'): - env['AR'] = 'CC' - env['ARFLAGS'] = SCons.Util.CLVar('-xar') - env['ARCOM'] = '$AR $ARFLAGS -o $TARGET $SOURCES' - else: - env['AR'] = 'ar' - env['ARFLAGS'] = SCons.Util.CLVar('r') - env['ARCOM'] = '$AR $ARFLAGS $TARGET $SOURCES' - - env['SHLINK'] = '$LINK' - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -G') - env['SHLINKCOM'] = '$SHLINK $SHLINKFLAGS -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' - env['LIBPREFIX'] = 'lib' - env['LIBSUFFIX'] = '.a' - -def exists(env): - return env.Detect('CC') or env.Detect('ar') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sunc++.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sunc++.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sunc++.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sunc++.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,142 +0,0 @@ -"""SCons.Tool.sunc++ - -Tool-specific initialization for C++ on SunOS / Solaris. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/sunc++.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons - -import os -import re -import subprocess - -cplusplus = __import__('c++', globals(), locals(), []) - -package_info = {} - -def get_package_info(package_name, pkginfo, pkgchk): - try: - return package_info[package_name] - except KeyError: - version = None - pathname = None - try: - sadm_contents = open('/var/sadm/install/contents', 'r').read() - except EnvironmentError: - pass - else: - sadm_re = re.compile('^(\S*/bin/CC)(=\S*)? %s$' % package_name, re.M) - sadm_match = sadm_re.search(sadm_contents) - if sadm_match: - pathname = os.path.dirname(sadm_match.group(1)) - - try: - p = subprocess.Popen([pkginfo, '-l', package_name], - stdout=subprocess.PIPE, - stderr=open('/dev/null', 'w')) - except EnvironmentError: - pass - else: - pkginfo_contents = p.communicate()[0] - version_re = re.compile('^ *VERSION:\s*(.*)$', re.M) - version_match = version_re.search(pkginfo_contents) - if version_match: - version = version_match.group(1) - - if pathname is None: - try: - p = subprocess.Popen([pkgchk, '-l', package_name], - stdout=subprocess.PIPE, - stderr=open('/dev/null', 'w')) - except EnvironmentError: - pass - else: - pkgchk_contents = p.communicate()[0] - pathname_re = re.compile(r'^Pathname:\s*(.*/bin/CC)$', re.M) - pathname_match = pathname_re.search(pkgchk_contents) - if pathname_match: - pathname = os.path.dirname(pathname_match.group(1)) - - package_info[package_name] = (pathname, version) - return package_info[package_name] - -# use the package installer tool lslpp to figure out where cppc and what -# version of it is installed -def get_cppc(env): - cxx = env.subst('$CXX') - if cxx: - cppcPath = os.path.dirname(cxx) - else: - cppcPath = None - - cppcVersion = None - - pkginfo = env.subst('$PKGINFO') - pkgchk = env.subst('$PKGCHK') - - for package in ['SPROcpl']: - path, version = get_package_info(package, pkginfo, pkgchk) - if path and version: - cppcPath, cppcVersion = path, version - break - - return (cppcPath, 'CC', 'CC', cppcVersion) - -def generate(env): - """Add Builders and construction variables for SunPRO C++.""" - path, cxx, shcxx, version = get_cppc(env) - if path: - cxx = os.path.join(path, cxx) - shcxx = os.path.join(path, shcxx) - - cplusplus.generate(env) - - env['CXX'] = cxx - env['SHCXX'] = shcxx - env['CXXVERSION'] = version - env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS -KPIC') - env['SHOBJPREFIX'] = 'so_' - env['SHOBJSUFFIX'] = '.o' - -def exists(env): - path, cxx, shcxx, version = get_cppc(env) - if path and cxx: - cppc = os.path.join(path, cxx) - if os.path.exists(cppc): - return cppc - return None - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/suncc.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/suncc.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/suncc.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/suncc.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -"""SCons.Tool.suncc - -Tool-specific initialization for Sun Solaris (Forte) CC and cc. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/suncc.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Util - -import cc - -def generate(env): - """ - Add Builders and construction variables for Forte C and C++ compilers - to an Environment. - """ - cc.generate(env) - - env['CXX'] = 'CC' - env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS -KPIC') - env['SHOBJPREFIX'] = 'so_' - env['SHOBJSUFFIX'] = '.o' - -def exists(env): - return env.Detect('CC') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sunf77.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sunf77.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sunf77.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sunf77.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -"""SCons.Tool.sunf77 - -Tool-specific initialization for sunf77, the Sun Studio F77 compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/sunf77.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Util - -from FortranCommon import add_all_to_env - -compilers = ['sunf77', 'f77'] - -def generate(env): - """Add Builders and construction variables for sunf77 to an Environment.""" - add_all_to_env(env) - - fcomp = env.Detect(compilers) or 'f77' - env['FORTRAN'] = fcomp - env['F77'] = fcomp - - env['SHFORTRAN'] = '$FORTRAN' - env['SHF77'] = '$F77' - - env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS -KPIC') - env['SHF77FLAGS'] = SCons.Util.CLVar('$F77FLAGS -KPIC') - -def exists(env): - return env.Detect(compilers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sunf90.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sunf90.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sunf90.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sunf90.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -"""SCons.Tool.sunf90 - -Tool-specific initialization for sunf90, the Sun Studio F90 compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/sunf90.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Util - -from FortranCommon import add_all_to_env - -compilers = ['sunf90', 'f90'] - -def generate(env): - """Add Builders and construction variables for sun f90 compiler to an - Environment.""" - add_all_to_env(env) - - fcomp = env.Detect(compilers) or 'f90' - env['FORTRAN'] = fcomp - env['F90'] = fcomp - - env['SHFORTRAN'] = '$FORTRAN' - env['SHF90'] = '$F90' - - env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS -KPIC') - env['SHF90FLAGS'] = SCons.Util.CLVar('$F90FLAGS -KPIC') - -def exists(env): - return env.Detect(compilers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sunf95.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sunf95.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sunf95.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sunf95.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -"""SCons.Tool.sunf95 - -Tool-specific initialization for sunf95, the Sun Studio F95 compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/sunf95.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Util - -from FortranCommon import add_all_to_env - -compilers = ['sunf95', 'f95'] - -def generate(env): - """Add Builders and construction variables for sunf95 to an - Environment.""" - add_all_to_env(env) - - fcomp = env.Detect(compilers) or 'f95' - env['FORTRAN'] = fcomp - env['F95'] = fcomp - - env['SHFORTRAN'] = '$FORTRAN' - env['SHF95'] = '$F95' - - env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS -KPIC') - env['SHF95FLAGS'] = SCons.Util.CLVar('$F95FLAGS -KPIC') - -def exists(env): - return env.Detect(compilers) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sunlink.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sunlink.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/sunlink.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/sunlink.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -"""SCons.Tool.sunlink - -Tool-specific initialization for the Sun Solaris (Forte) linker. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/sunlink.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os -import os.path - -import SCons.Util - -import link - -ccLinker = None - -# search for the acc compiler and linker front end - -try: - dirs = os.listdir('/opt') -except (IOError, OSError): - # Not being able to read the directory because it doesn't exist - # (IOError) or isn't readable (OSError) is okay. - dirs = [] - -for d in dirs: - linker = '/opt/' + d + '/bin/CC' - if os.path.exists(linker): - ccLinker = linker - break - -def generate(env): - """Add Builders and construction variables for Forte to an Environment.""" - link.generate(env) - - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -G') - - env['RPATHPREFIX'] = '-R' - env['RPATHSUFFIX'] = '' - env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}' - -def exists(env): - return ccLinker - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/swig.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/swig.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/swig.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/swig.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,183 +0,0 @@ -"""SCons.Tool.swig - -Tool-specific initialization for swig. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/swig.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path -import re -import subprocess - -import SCons.Action -import SCons.Defaults -import SCons.Scanner -import SCons.Tool -import SCons.Util - -SwigAction = SCons.Action.Action('$SWIGCOM', '$SWIGCOMSTR') - -def swigSuffixEmitter(env, source): - if '-c++' in SCons.Util.CLVar(env.subst("$SWIGFLAGS", source=source)): - return '$SWIGCXXFILESUFFIX' - else: - return '$SWIGCFILESUFFIX' - -# Match '%module test', as well as '%module(directors="1") test' -# Also allow for test to be quoted (SWIG permits double quotes, but not single) -# Also allow for the line to have spaces after test if not quoted -_reModule = re.compile(r'%module(\s*\(.*\))?\s+("?)(\S+)\2') - -def _find_modules(src): - """Find all modules referenced by %module lines in `src`, a SWIG .i file. - Returns a list of all modules, and a flag set if SWIG directors have - been requested (SWIG will generate an additional header file in this - case.)""" - directors = 0 - mnames = [] - try: - matches = _reModule.findall(open(src).read()) - except IOError: - # If the file's not yet generated, guess the module name from the file stem - matches = [] - mnames.append(os.path.splitext(os.path.basename(src))[0]) - - for m in matches: - mnames.append(m[2]) - directors = directors or m[0].find('directors') >= 0 - return mnames, directors - -def _add_director_header_targets(target, env): - # Directors only work with C++ code, not C - suffix = env.subst(env['SWIGCXXFILESUFFIX']) - # For each file ending in SWIGCXXFILESUFFIX, add a new target director - # header by replacing the ending with SWIGDIRECTORSUFFIX. - for x in target[:]: - n = x.name - d = x.dir - if n[-len(suffix):] == suffix: - target.append(d.File(n[:-len(suffix)] + env['SWIGDIRECTORSUFFIX'])) - -def _swigEmitter(target, source, env): - swigflags = env.subst("$SWIGFLAGS", target=target, source=source) - flags = SCons.Util.CLVar(swigflags) - for src in source: - src = str(src.rfile()) - mnames = None - if "-python" in flags and "-noproxy" not in flags: - if mnames is None: - mnames, directors = _find_modules(src) - if directors: - _add_director_header_targets(target, env) - python_files = [m + ".py" for m in mnames] - outdir = env.subst('$SWIGOUTDIR', target=target, source=source) - # .py files should be generated in SWIGOUTDIR if specified, - # otherwise in the same directory as the target - if outdir: - python_files = [env.fs.File(os.path.join(outdir, j)) for j in python_files] - else: - python_files = [target[0].dir.File(m) for m in python_files] - target.extend(python_files) - if "-java" in flags: - if mnames is None: - mnames, directors = _find_modules(src) - if directors: - _add_director_header_targets(target, env) - java_files = [[m + ".java", m + "JNI.java"] for m in mnames] - java_files = SCons.Util.flatten(java_files) - outdir = env.subst('$SWIGOUTDIR', target=target, source=source) - if outdir: - java_files = [os.path.join(outdir, j) for j in java_files] - java_files = list(map(env.fs.File, java_files)) - for jf in java_files: - t_from_s = lambda t, p, s, x: t.dir - SCons.Util.AddMethod(jf, t_from_s, 'target_from_source') - target.extend(java_files) - return (target, source) - -def _get_swig_version(env): - """Run the SWIG command line tool to get and return the version number""" - pipe = SCons.Action._subproc(env, [env['SWIG'], '-version'], - stdin = 'devnull', - stderr = 'devnull', - stdout = subprocess.PIPE) - if pipe.wait() != 0: return - - out = pipe.stdout.read() - match = re.search(r'SWIG Version\s+(\S+)$', out, re.MULTILINE) - if match: - return match.group(1) - -def generate(env): - """Add Builders and construction variables for swig to an Environment.""" - c_file, cxx_file = SCons.Tool.createCFileBuilders(env) - - c_file.suffix['.i'] = swigSuffixEmitter - cxx_file.suffix['.i'] = swigSuffixEmitter - - c_file.add_action('.i', SwigAction) - c_file.add_emitter('.i', _swigEmitter) - cxx_file.add_action('.i', SwigAction) - cxx_file.add_emitter('.i', _swigEmitter) - - java_file = SCons.Tool.CreateJavaFileBuilder(env) - - java_file.suffix['.i'] = swigSuffixEmitter - - java_file.add_action('.i', SwigAction) - java_file.add_emitter('.i', _swigEmitter) - - env['SWIG'] = 'swig' - env['SWIGVERSION'] = _get_swig_version(env) - env['SWIGFLAGS'] = SCons.Util.CLVar('') - env['SWIGDIRECTORSUFFIX'] = '_wrap.h' - env['SWIGCFILESUFFIX'] = '_wrap$CFILESUFFIX' - env['SWIGCXXFILESUFFIX'] = '_wrap$CXXFILESUFFIX' - env['_SWIGOUTDIR'] = r'${"-outdir \"%s\"" % SWIGOUTDIR}' - env['SWIGPATH'] = [] - env['SWIGINCPREFIX'] = '-I' - env['SWIGINCSUFFIX'] = '' - env['_SWIGINCFLAGS'] = '$( ${_concat(SWIGINCPREFIX, SWIGPATH, SWIGINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' - env['SWIGCOM'] = '$SWIG -o $TARGET ${_SWIGOUTDIR} ${_SWIGINCFLAGS} $SWIGFLAGS $SOURCES' - - expr = '^[ \t]*%[ \t]*(?:include|import|extern)[ \t]*(<|"?)([^>\s"]+)(?:>|"?)' - scanner = SCons.Scanner.ClassicCPP("SWIGScan", ".i", "SWIGPATH", expr) - - env.Append(SCANNERS = scanner) - -def exists(env): - return env.Detect(['swig']) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/tar.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/tar.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/tar.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/tar.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -"""SCons.Tool.tar - -Tool-specific initialization for tar. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/tar.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Action -import SCons.Builder -import SCons.Defaults -import SCons.Node.FS -import SCons.Util - -tars = ['tar', 'gtar'] - -TarAction = SCons.Action.Action('$TARCOM', '$TARCOMSTR') - -TarBuilder = SCons.Builder.Builder(action = TarAction, - source_factory = SCons.Node.FS.Entry, - source_scanner = SCons.Defaults.DirScanner, - suffix = '$TARSUFFIX', - multi = 1) - - -def generate(env): - """Add Builders and construction variables for tar to an Environment.""" - try: - bld = env['BUILDERS']['Tar'] - except KeyError: - bld = TarBuilder - env['BUILDERS']['Tar'] = bld - - env['TAR'] = env.Detect(tars) or 'gtar' - env['TARFLAGS'] = SCons.Util.CLVar('-c') - env['TARCOM'] = '$TAR $TARFLAGS -f $TARGET $SOURCES' - env['TARSUFFIX'] = '.tar' - -def exists(env): - return env.Detect(tars) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/tex.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/tex.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/tex.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/tex.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,928 +0,0 @@ -"""SCons.Tool.tex - -Tool-specific initialization for TeX. -Generates .dvi files from .tex files - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/tex.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path -import re -import shutil -import sys -import platform -import glob - -import SCons.Action -import SCons.Node -import SCons.Node.FS -import SCons.Util -import SCons.Scanner.LaTeX - -Verbose = False - -must_rerun_latex = True - -# these are files that just need to be checked for changes and then rerun latex -check_suffixes = ['.toc', '.lof', '.lot', '.out', '.nav', '.snm'] - -# these are files that require bibtex or makeindex to be run when they change -all_suffixes = check_suffixes + ['.bbl', '.idx', '.nlo', '.glo', '.acn', '.bcf'] - -# -# regular expressions used to search for Latex features -# or outputs that require rerunning latex -# -# search for all .aux files opened by latex (recorded in the .fls file) -openout_aux_re = re.compile(r"OUTPUT *(.*\.aux)") - -# search for all .bcf files opened by latex (recorded in the .fls file) -# for use by biber -openout_bcf_re = re.compile(r"OUTPUT *(.*\.bcf)") - -#printindex_re = re.compile(r"^[^%]*\\printindex", re.MULTILINE) -#printnomenclature_re = re.compile(r"^[^%]*\\printnomenclature", re.MULTILINE) -#printglossary_re = re.compile(r"^[^%]*\\printglossary", re.MULTILINE) - -# search to find rerun warnings -warning_rerun_str = '(^LaTeX Warning:.*Rerun)|(^Package \w+ Warning:.*Rerun)' -warning_rerun_re = re.compile(warning_rerun_str, re.MULTILINE) - -# search to find citation rerun warnings -rerun_citations_str = "^LaTeX Warning:.*\n.*Rerun to get citations correct" -rerun_citations_re = re.compile(rerun_citations_str, re.MULTILINE) - -# search to find undefined references or citations warnings -undefined_references_str = '(^LaTeX Warning:.*undefined references)|(^Package \w+ Warning:.*undefined citations)' -undefined_references_re = re.compile(undefined_references_str, re.MULTILINE) - -# used by the emitter -auxfile_re = re.compile(r".", re.MULTILINE) -tableofcontents_re = re.compile(r"^[^%\n]*\\tableofcontents", re.MULTILINE) -makeindex_re = re.compile(r"^[^%\n]*\\makeindex", re.MULTILINE) -bibliography_re = re.compile(r"^[^%\n]*\\bibliography", re.MULTILINE) -bibunit_re = re.compile(r"^[^%\n]*\\begin\{bibunit\}", re.MULTILINE) -multibib_re = re.compile(r"^[^%\n]*\\newcites\{([^\}]*)\}", re.MULTILINE) -addbibresource_re = re.compile(r"^[^%\n]*\\(addbibresource|addglobalbib|addsectionbib)", re.MULTILINE) -listoffigures_re = re.compile(r"^[^%\n]*\\listoffigures", re.MULTILINE) -listoftables_re = re.compile(r"^[^%\n]*\\listoftables", re.MULTILINE) -hyperref_re = re.compile(r"^[^%\n]*\\usepackage.*\{hyperref\}", re.MULTILINE) -makenomenclature_re = re.compile(r"^[^%\n]*\\makenomenclature", re.MULTILINE) -makeglossary_re = re.compile(r"^[^%\n]*\\makeglossary", re.MULTILINE) -makeglossaries_re = re.compile(r"^[^%\n]*\\makeglossaries", re.MULTILINE) -makeacronyms_re = re.compile(r"^[^%\n]*\\makeglossaries", re.MULTILINE) -beamer_re = re.compile(r"^[^%\n]*\\documentclass\{beamer\}", re.MULTILINE) - -# search to find all files included by Latex -include_re = re.compile(r'^[^%\n]*\\(?:include|input){([^}]*)}', re.MULTILINE) -includeOnly_re = re.compile(r'^[^%\n]*\\(?:include){([^}]*)}', re.MULTILINE) - -# search to find all graphics files included by Latex -includegraphics_re = re.compile(r'^[^%\n]*\\(?:includegraphics(?:\[[^\]]+\])?){([^}]*)}', re.MULTILINE) - -# search to find all files opened by Latex (recorded in .log file) -openout_re = re.compile(r"OUTPUT *(.*)") - -# list of graphics file extensions for TeX and LaTeX -TexGraphics = SCons.Scanner.LaTeX.TexGraphics -LatexGraphics = SCons.Scanner.LaTeX.LatexGraphics - -# An Action sufficient to build any generic tex file. -TeXAction = None - -# An action to build a latex file. This action might be needed more -# than once if we are dealing with labels and bibtex. -LaTeXAction = None - -# An action to run BibTeX on a file. -BibTeXAction = None - -# An action to run MakeIndex on a file. -MakeIndexAction = None - -# An action to run MakeIndex (for nomencl) on a file. -MakeNclAction = None - -# An action to run MakeIndex (for glossary) on a file. -MakeGlossaryAction = None - -# An action to run MakeIndex (for acronyms) on a file. -MakeAcronymsAction = None - -# Used as a return value of modify_env_var if the variable is not set. -_null = SCons.Scanner.LaTeX._null - -modify_env_var = SCons.Scanner.LaTeX.modify_env_var - -def check_file_error_message(utility, filename='log'): - msg = '%s returned an error, check the %s file\n' % (utility, filename) - sys.stdout.write(msg) - -def FindFile(name,suffixes,paths,env,requireExt=False): - if requireExt: - name,ext = SCons.Util.splitext(name) - # if the user gave an extension use it. - if ext: - name = name + ext - if Verbose: - print " searching for '%s' with extensions: " % name,suffixes - - for path in paths: - testName = os.path.join(path,name) - if Verbose: - print " look for '%s'" % testName - if os.path.isfile(testName): - if Verbose: - print " found '%s'" % testName - return env.fs.File(testName) - else: - name_ext = SCons.Util.splitext(testName)[1] - if name_ext: - continue - - # if no suffix try adding those passed in - for suffix in suffixes: - testNameExt = testName + suffix - if Verbose: - print " look for '%s'" % testNameExt - - if os.path.isfile(testNameExt): - if Verbose: - print " found '%s'" % testNameExt - return env.fs.File(testNameExt) - if Verbose: - print " did not find '%s'" % name - return None - -def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None): - """A builder for LaTeX files that checks the output in the aux file - and decides how many times to use LaTeXAction, and BibTeXAction.""" - - global must_rerun_latex - - # This routine is called with two actions. In this file for DVI builds - # with LaTeXAction and from the pdflatex.py with PDFLaTeXAction - # set this up now for the case where the user requests a different extension - # for the target filename - if (XXXLaTeXAction == LaTeXAction): - callerSuffix = ".dvi" - else: - callerSuffix = env['PDFSUFFIX'] - - basename = SCons.Util.splitext(str(source[0]))[0] - basedir = os.path.split(str(source[0]))[0] - basefile = os.path.split(str(basename))[1] - abspath = os.path.abspath(basedir) - - targetext = os.path.splitext(str(target[0]))[1] - targetdir = os.path.split(str(target[0]))[0] - - saved_env = {} - for var in SCons.Scanner.LaTeX.LaTeX.env_variables: - saved_env[var] = modify_env_var(env, var, abspath) - - # Create base file names with the target directory since the auxiliary files - # will be made there. That's because the *COM variables have the cd - # command in the prolog. We check - # for the existence of files before opening them--even ones like the - # aux file that TeX always creates--to make it possible to write tests - # with stubs that don't necessarily generate all of the same files. - - targetbase = os.path.join(targetdir, basefile) - - # if there is a \makeindex there will be a .idx and thus - # we have to run makeindex at least once to keep the build - # happy even if there is no index. - # Same for glossaries, nomenclature, and acronyms - src_content = source[0].get_text_contents() - run_makeindex = makeindex_re.search(src_content) and not os.path.isfile(targetbase + '.idx') - run_nomenclature = makenomenclature_re.search(src_content) and not os.path.isfile(targetbase + '.nlo') - run_glossary = makeglossary_re.search(src_content) and not os.path.isfile(targetbase + '.glo') - run_glossaries = makeglossaries_re.search(src_content) and not os.path.isfile(targetbase + '.glo') - run_acronyms = makeacronyms_re.search(src_content) and not os.path.isfile(targetbase + '.acn') - - saved_hashes = {} - suffix_nodes = {} - - for suffix in all_suffixes: - theNode = env.fs.File(targetbase + suffix) - suffix_nodes[suffix] = theNode - saved_hashes[suffix] = theNode.get_csig() - - if Verbose: - print "hashes: ",saved_hashes - - must_rerun_latex = True - - # .aux files already processed by BibTex - already_bibtexed = [] - - # - # routine to update MD5 hash and compare - # - def check_MD5(filenode, suffix): - global must_rerun_latex - # two calls to clear old csig - filenode.clear_memoized_values() - filenode.ninfo = filenode.new_ninfo() - new_md5 = filenode.get_csig() - - if saved_hashes[suffix] == new_md5: - if Verbose: - print "file %s not changed" % (targetbase+suffix) - return False # unchanged - saved_hashes[suffix] = new_md5 - must_rerun_latex = True - if Verbose: - print "file %s changed, rerunning Latex, new hash = " % (targetbase+suffix), new_md5 - return True # changed - - # generate the file name that latex will generate - resultfilename = targetbase + callerSuffix - - count = 0 - - while (must_rerun_latex and count < int(env.subst('$LATEXRETRIES'))) : - result = XXXLaTeXAction(target, source, env) - if result != 0: - return result - - count = count + 1 - - must_rerun_latex = False - # Decide if various things need to be run, or run again. - - # Read the log file to find warnings/errors - logfilename = targetbase + '.log' - logContent = '' - if os.path.isfile(logfilename): - logContent = open(logfilename, "rb").read() - - - # Read the fls file to find all .aux files - flsfilename = targetbase + '.fls' - flsContent = '' - auxfiles = [] - if os.path.isfile(flsfilename): - flsContent = open(flsfilename, "rb").read() - auxfiles = openout_aux_re.findall(flsContent) - # remove duplicates - dups = {} - for x in auxfiles: - dups[x] = 1 - auxfiles = list(dups.keys()) - - bcffiles = [] - if os.path.isfile(flsfilename): - flsContent = open(flsfilename, "rb").read() - bcffiles = openout_bcf_re.findall(flsContent) - # remove duplicates - dups = {} - for x in bcffiles: - dups[x] = 1 - bcffiles = list(dups.keys()) - - if Verbose: - print "auxfiles ",auxfiles - print "bcffiles ",bcffiles - - # Now decide if bibtex will need to be run. - # The information that bibtex reads from the .aux file is - # pass-independent. If we find (below) that the .bbl file is unchanged, - # then the last latex saw a correct bibliography. - # Therefore only do this once - # Go through all .aux files and remember the files already done. - for auxfilename in auxfiles: - if auxfilename not in already_bibtexed: - already_bibtexed.append(auxfilename) - target_aux = os.path.join(targetdir, auxfilename) - if os.path.isfile(target_aux): - content = open(target_aux, "rb").read() - if content.find("bibdata") != -1: - if Verbose: - print "Need to run bibtex on ",auxfilename - bibfile = env.fs.File(SCons.Util.splitext(target_aux)[0]) - result = BibTeXAction(bibfile, bibfile, env) - if result != 0: - check_file_error_message(env['BIBTEX'], 'blg') - must_rerun_latex = True - - # Now decide if biber will need to be run. - # The information that bibtex reads from the .bcf file is - # pass-independent. If we find (below) that the .bbl file is unchanged, - # then the last latex saw a correct bibliography. - # Therefore only do this once - # Go through all .bcf files and remember the files already done. - for bcffilename in bcffiles: - if bcffilename not in already_bibtexed: - already_bibtexed.append(bcffilename) - target_bcf = os.path.join(targetdir, bcffilename) - if os.path.isfile(target_bcf): - content = open(target_bcf, "rb").read() - if content.find("bibdata") != -1: - if Verbose: - print "Need to run bibtex on ",bcffilename - bibfile = env.fs.File(SCons.Util.splitext(target_bcf)[0]) - result = BibTeXAction(bibfile, bibfile, env) - if result != 0: - check_file_error_message(env['BIBTEX'], 'blg') - must_rerun_latex = True - - # Now decide if latex will need to be run again due to index. - if check_MD5(suffix_nodes['.idx'],'.idx') or (count == 1 and run_makeindex): - # We must run makeindex - if Verbose: - print "Need to run makeindex" - idxfile = suffix_nodes['.idx'] - result = MakeIndexAction(idxfile, idxfile, env) - if result != 0: - check_file_error_message(env['MAKEINDEX'], 'ilg') - return result - - # TO-DO: need to add a way for the user to extend this list for whatever - # auxiliary files they create in other (or their own) packages - # Harder is case is where an action needs to be called -- that should be rare (I hope?) - - for index in check_suffixes: - check_MD5(suffix_nodes[index],index) - - # Now decide if latex will need to be run again due to nomenclature. - if check_MD5(suffix_nodes['.nlo'],'.nlo') or (count == 1 and run_nomenclature): - # We must run makeindex - if Verbose: - print "Need to run makeindex for nomenclature" - nclfile = suffix_nodes['.nlo'] - result = MakeNclAction(nclfile, nclfile, env) - if result != 0: - check_file_error_message('%s (nomenclature)' % env['MAKENCL'], - 'nlg') - #return result - - # Now decide if latex will need to be run again due to glossary. - if check_MD5(suffix_nodes['.glo'],'.glo') or (count == 1 and run_glossaries) or (count == 1 and run_glossary): - # We must run makeindex - if Verbose: - print "Need to run makeindex for glossary" - glofile = suffix_nodes['.glo'] - result = MakeGlossaryAction(glofile, glofile, env) - if result != 0: - check_file_error_message('%s (glossary)' % env['MAKEGLOSSARY'], - 'glg') - #return result - - # Now decide if latex will need to be run again due to acronyms. - if check_MD5(suffix_nodes['.acn'],'.acn') or (count == 1 and run_acronyms): - # We must run makeindex - if Verbose: - print "Need to run makeindex for acronyms" - acrfile = suffix_nodes['.acn'] - result = MakeAcronymsAction(acrfile, acrfile, env) - if result != 0: - check_file_error_message('%s (acronyms)' % env['MAKEACRONYMS'], - 'alg') - return result - - # Now decide if latex needs to be run yet again to resolve warnings. - if warning_rerun_re.search(logContent): - must_rerun_latex = True - if Verbose: - print "rerun Latex due to latex or package rerun warning" - - if rerun_citations_re.search(logContent): - must_rerun_latex = True - if Verbose: - print "rerun Latex due to 'Rerun to get citations correct' warning" - - if undefined_references_re.search(logContent): - must_rerun_latex = True - if Verbose: - print "rerun Latex due to undefined references or citations" - - if (count >= int(env.subst('$LATEXRETRIES')) and must_rerun_latex): - print "reached max number of retries on Latex ,",int(env.subst('$LATEXRETRIES')) -# end of while loop - - # rename Latex's output to what the target name is - if not (str(target[0]) == resultfilename and os.path.isfile(resultfilename)): - if os.path.isfile(resultfilename): - print "move %s to %s" % (resultfilename, str(target[0]), ) - shutil.move(resultfilename,str(target[0])) - - # Original comment (when TEXPICTS was not restored): - # The TEXPICTS enviroment variable is needed by a dvi -> pdf step - # later on Mac OSX so leave it - # - # It is also used when searching for pictures (implicit dependencies). - # Why not set the variable again in the respective builder instead - # of leaving local modifications in the environment? What if multiple - # latex builds in different directories need different TEXPICTS? - for var in SCons.Scanner.LaTeX.LaTeX.env_variables: - if var == 'TEXPICTS': - continue - if saved_env[var] is _null: - try: - del env['ENV'][var] - except KeyError: - pass # was never set - else: - env['ENV'][var] = saved_env[var] - - return result - -def LaTeXAuxAction(target = None, source= None, env=None): - result = InternalLaTeXAuxAction( LaTeXAction, target, source, env ) - return result - -LaTeX_re = re.compile("\\\\document(style|class)") - -def is_LaTeX(flist,env,abspath): - """Scan a file list to decide if it's TeX- or LaTeX-flavored.""" - - # We need to scan files that are included in case the - # \documentclass command is in them. - - # get path list from both env['TEXINPUTS'] and env['ENV']['TEXINPUTS'] - savedpath = modify_env_var(env, 'TEXINPUTS', abspath) - paths = env['ENV']['TEXINPUTS'] - if SCons.Util.is_List(paths): - pass - else: - # Split at os.pathsep to convert into absolute path - paths = paths.split(os.pathsep) - - # now that we have the path list restore the env - if savedpath is _null: - try: - del env['ENV']['TEXINPUTS'] - except KeyError: - pass # was never set - else: - env['ENV']['TEXINPUTS'] = savedpath - if Verbose: - print "is_LaTeX search path ",paths - print "files to search :",flist - - # Now that we have the search path and file list, check each one - for f in flist: - if Verbose: - print " checking for Latex source ",str(f) - - content = f.get_text_contents() - if LaTeX_re.search(content): - if Verbose: - print "file %s is a LaTeX file" % str(f) - return 1 - if Verbose: - print "file %s is not a LaTeX file" % str(f) - - # now find included files - inc_files = [ ] - inc_files.extend( include_re.findall(content) ) - if Verbose: - print "files included by '%s': "%str(f),inc_files - # inc_files is list of file names as given. need to find them - # using TEXINPUTS paths. - - # search the included files - for src in inc_files: - srcNode = FindFile(src,['.tex','.ltx','.latex'],paths,env,requireExt=False) - # make this a list since is_LaTeX takes a list. - fileList = [srcNode,] - if Verbose: - print "FindFile found ",srcNode - if srcNode is not None: - file_test = is_LaTeX(fileList, env, abspath) - - # return on first file that finds latex is needed. - if file_test: - return file_test - - if Verbose: - print " done scanning ",str(f) - - return 0 - -def TeXLaTeXFunction(target = None, source= None, env=None): - """A builder for TeX and LaTeX that scans the source file to - decide the "flavor" of the source and then executes the appropriate - program.""" - - # find these paths for use in is_LaTeX to search for included files - basedir = os.path.split(str(source[0]))[0] - abspath = os.path.abspath(basedir) - - if is_LaTeX(source,env,abspath): - result = LaTeXAuxAction(target,source,env) - if result != 0: - check_file_error_message(env['LATEX']) - else: - result = TeXAction(target,source,env) - if result != 0: - check_file_error_message(env['TEX']) - return result - -def TeXLaTeXStrFunction(target = None, source= None, env=None): - """A strfunction for TeX and LaTeX that scans the source file to - decide the "flavor" of the source and then returns the appropriate - command string.""" - if env.GetOption("no_exec"): - - # find these paths for use in is_LaTeX to search for included files - basedir = os.path.split(str(source[0]))[0] - abspath = os.path.abspath(basedir) - - if is_LaTeX(source,env,abspath): - result = env.subst('$LATEXCOM',0,target,source)+" ..." - else: - result = env.subst("$TEXCOM",0,target,source)+" ..." - else: - result = '' - return result - -def tex_eps_emitter(target, source, env): - """An emitter for TeX and LaTeX sources when - executing tex or latex. It will accept .ps and .eps - graphics files - """ - (target, source) = tex_emitter_core(target, source, env, TexGraphics) - - return (target, source) - -def tex_pdf_emitter(target, source, env): - """An emitter for TeX and LaTeX sources when - executing pdftex or pdflatex. It will accept graphics - files of types .pdf, .jpg, .png, .gif, and .tif - """ - (target, source) = tex_emitter_core(target, source, env, LatexGraphics) - - return (target, source) - -def ScanFiles(theFile, target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir, aux_files): - """ For theFile (a Node) update any file_tests and search for graphics files - then find all included files and call ScanFiles recursively for each of them""" - - content = theFile.get_text_contents() - if Verbose: - print " scanning ",str(theFile) - - for i in range(len(file_tests_search)): - if file_tests[i][0] is None: - file_tests[i][0] = file_tests_search[i].search(content) - if Verbose and file_tests[i][0]: - print " found match for ",file_tests[i][-1][-1] - - incResult = includeOnly_re.search(content) - if incResult: - aux_files.append(os.path.join(targetdir, incResult.group(1))) - if Verbose: - print "\include file names : ", aux_files - # recursively call this on each of the included files - inc_files = [ ] - inc_files.extend( include_re.findall(content) ) - if Verbose: - print "files included by '%s': "%str(theFile),inc_files - # inc_files is list of file names as given. need to find them - # using TEXINPUTS paths. - - for src in inc_files: - srcNode = FindFile(src,['.tex','.ltx','.latex'],paths,env,requireExt=False) - if srcNode is not None: - file_tests = ScanFiles(srcNode, target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir, aux_files) - if Verbose: - print " done scanning ",str(theFile) - return file_tests - -def tex_emitter_core(target, source, env, graphics_extensions): - """An emitter for TeX and LaTeX sources. - For LaTeX sources we try and find the common created files that - are needed on subsequent runs of latex to finish tables of contents, - bibliographies, indices, lists of figures, and hyperlink references. - """ - basename = SCons.Util.splitext(str(source[0]))[0] - basefile = os.path.split(str(basename))[1] - targetdir = os.path.split(str(target[0]))[0] - targetbase = os.path.join(targetdir, basefile) - - basedir = os.path.split(str(source[0]))[0] - abspath = os.path.abspath(basedir) - target[0].attributes.path = abspath - - # - # file names we will make use of in searching the sources and log file - # - emit_suffixes = ['.aux', '.log', '.ilg', '.blg', '.nls', '.nlg', '.gls', '.glg', '.alg'] + all_suffixes - auxfilename = targetbase + '.aux' - logfilename = targetbase + '.log' - flsfilename = targetbase + '.fls' - - env.SideEffect(auxfilename,target[0]) - env.SideEffect(logfilename,target[0]) - env.SideEffect(flsfilename,target[0]) - if Verbose: - print "side effect :",auxfilename,logfilename,flsfilename - env.Clean(target[0],auxfilename) - env.Clean(target[0],logfilename) - env.Clean(target[0],flsfilename) - - content = source[0].get_text_contents() - - # These variables are no longer used. - #idx_exists = os.path.isfile(targetbase + '.idx') - #nlo_exists = os.path.isfile(targetbase + '.nlo') - #glo_exists = os.path.isfile(targetbase + '.glo') - #acr_exists = os.path.isfile(targetbase + '.acn') - - # set up list with the regular expressions - # we use to find features used - file_tests_search = [auxfile_re, - makeindex_re, - bibliography_re, - bibunit_re, - multibib_re, - addbibresource_re, - tableofcontents_re, - listoffigures_re, - listoftables_re, - hyperref_re, - makenomenclature_re, - makeglossary_re, - makeglossaries_re, - makeacronyms_re, - beamer_re ] - # set up list with the file suffixes that need emitting - # when a feature is found - file_tests_suff = [['.aux','aux_file'], - ['.idx', '.ind', '.ilg','makeindex'], - ['.bbl', '.blg','bibliography'], - ['.bbl', '.blg','bibunit'], - ['.bbl', '.blg','multibib'], - ['.bbl', '.blg','.bcf','addbibresource'], - ['.toc','contents'], - ['.lof','figures'], - ['.lot','tables'], - ['.out','hyperref'], - ['.nlo', '.nls', '.nlg','nomenclature'], - ['.glo', '.gls', '.glg','glossary'], - ['.glo', '.gls', '.glg','glossaries'], - ['.acn', '.acr', '.alg','acronyms'], - ['.nav', '.snm', '.out', '.toc','beamer'] ] - # build the list of lists - file_tests = [] - for i in range(len(file_tests_search)): - file_tests.append( [None, file_tests_suff[i]] ) - - # TO-DO: need to add a way for the user to extend this list for whatever - # auxiliary files they create in other (or their own) packages - - # get path list from both env['TEXINPUTS'] and env['ENV']['TEXINPUTS'] - savedpath = modify_env_var(env, 'TEXINPUTS', abspath) - paths = env['ENV']['TEXINPUTS'] - if SCons.Util.is_List(paths): - pass - else: - # Split at os.pathsep to convert into absolute path - paths = paths.split(os.pathsep) - - # now that we have the path list restore the env - if savedpath is _null: - try: - del env['ENV']['TEXINPUTS'] - except KeyError: - pass # was never set - else: - env['ENV']['TEXINPUTS'] = savedpath - if Verbose: - print "search path ",paths - - aux_files = [] - file_tests = ScanFiles(source[0], target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir, aux_files) - - for (theSearch,suffix_list) in file_tests: - # add side effects if feature is present.If file is to be generated,add all side effects - if Verbose and theSearch: - print "check side effects for ",suffix_list[-1] - if (theSearch != None) or (not source[0].exists() ): - file_list = [targetbase,] - # for bibunit we need a list of files - if suffix_list[-1] == 'bibunit': - file_basename = os.path.join(targetdir, 'bu*.aux') - file_list = glob.glob(file_basename) - # remove the suffix '.aux' - for i in range(len(file_list)): - file_list.append(SCons.Util.splitext(file_list[i])[0]) - # for multibib we need a list of files - if suffix_list[-1] == 'multibib': - for multibibmatch in multibib_re.finditer(content): - if Verbose: - print "multibib match ",multibibmatch.group(1) - if multibibmatch != None: - baselist = multibibmatch.group(1).split(',') - if Verbose: - print "multibib list ", baselist - for i in range(len(baselist)): - file_list.append(os.path.join(targetdir, baselist[i])) - # now define the side effects - for file_name in file_list: - for suffix in suffix_list[:-1]: - env.SideEffect(file_name + suffix,target[0]) - if Verbose: - print "side effect tst :",file_name + suffix, " target is ",str(target[0]) - env.Clean(target[0],file_name + suffix) - - for aFile in aux_files: - aFile_base = SCons.Util.splitext(aFile)[0] - env.SideEffect(aFile_base + '.aux',target[0]) - if Verbose: - print "side effect aux :",aFile_base + '.aux' - env.Clean(target[0],aFile_base + '.aux') - # read fls file to get all other files that latex creates and will read on the next pass - # remove files from list that we explicitly dealt with above - if os.path.isfile(flsfilename): - content = open(flsfilename, "rb").read() - out_files = openout_re.findall(content) - myfiles = [auxfilename, logfilename, flsfilename, targetbase+'.dvi',targetbase+'.pdf'] - for filename in out_files[:]: - if filename in myfiles: - out_files.remove(filename) - env.SideEffect(out_files,target[0]) - if Verbose: - print "side effect fls :",out_files - env.Clean(target[0],out_files) - - return (target, source) - - -TeXLaTeXAction = None - -def generate(env): - """Add Builders and construction variables for TeX to an Environment.""" - - global TeXLaTeXAction - if TeXLaTeXAction is None: - TeXLaTeXAction = SCons.Action.Action(TeXLaTeXFunction, - strfunction=TeXLaTeXStrFunction) - - env.AppendUnique(LATEXSUFFIXES=SCons.Tool.LaTeXSuffixes) - - generate_common(env) - - import dvi - dvi.generate(env) - - bld = env['BUILDERS']['DVI'] - bld.add_action('.tex', TeXLaTeXAction) - bld.add_emitter('.tex', tex_eps_emitter) - -def generate_darwin(env): - try: - environ = env['ENV'] - except KeyError: - environ = {} - env['ENV'] = environ - - if (platform.system() == 'Darwin'): - try: - ospath = env['ENV']['PATHOSX'] - except: - ospath = None - if ospath: - env.AppendENVPath('PATH', ospath) - -def generate_common(env): - """Add internal Builders and construction variables for LaTeX to an Environment.""" - - # Add OSX system paths so TeX tools can be found - # when a list of tools is given the exists() method is not called - generate_darwin(env) - - # A generic tex file Action, sufficient for all tex files. - global TeXAction - if TeXAction is None: - TeXAction = SCons.Action.Action("$TEXCOM", "$TEXCOMSTR") - - # An Action to build a latex file. This might be needed more - # than once if we are dealing with labels and bibtex. - global LaTeXAction - if LaTeXAction is None: - LaTeXAction = SCons.Action.Action("$LATEXCOM", "$LATEXCOMSTR") - - # Define an action to run BibTeX on a file. - global BibTeXAction - if BibTeXAction is None: - BibTeXAction = SCons.Action.Action("$BIBTEXCOM", "$BIBTEXCOMSTR") - - # Define an action to run MakeIndex on a file. - global MakeIndexAction - if MakeIndexAction is None: - MakeIndexAction = SCons.Action.Action("$MAKEINDEXCOM", "$MAKEINDEXCOMSTR") - - # Define an action to run MakeIndex on a file for nomenclatures. - global MakeNclAction - if MakeNclAction is None: - MakeNclAction = SCons.Action.Action("$MAKENCLCOM", "$MAKENCLCOMSTR") - - # Define an action to run MakeIndex on a file for glossaries. - global MakeGlossaryAction - if MakeGlossaryAction is None: - MakeGlossaryAction = SCons.Action.Action("$MAKEGLOSSARYCOM", "$MAKEGLOSSARYCOMSTR") - - # Define an action to run MakeIndex on a file for acronyms. - global MakeAcronymsAction - if MakeAcronymsAction is None: - MakeAcronymsAction = SCons.Action.Action("$MAKEACRONYMSCOM", "$MAKEACRONYMSCOMSTR") - - try: - environ = env['ENV'] - except KeyError: - environ = {} - env['ENV'] = environ - - # Some Linux platforms have pdflatex set up in a way - # that requires that the HOME environment variable be set. - # Add it here if defined. - v = os.environ.get('HOME') - if v: - environ['HOME'] = v - - CDCOM = 'cd ' - if platform.system() == 'Windows': - # allow cd command to change drives on Windows - CDCOM = 'cd /D ' - - env['TEX'] = 'tex' - env['TEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') - env['TEXCOM'] = CDCOM + '${TARGET.dir} && $TEX $TEXFLAGS ${SOURCE.file}' - - env['PDFTEX'] = 'pdftex' - env['PDFTEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') - env['PDFTEXCOM'] = CDCOM + '${TARGET.dir} && $PDFTEX $PDFTEXFLAGS ${SOURCE.file}' - - env['LATEX'] = 'latex' - env['LATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') - env['LATEXCOM'] = CDCOM + '${TARGET.dir} && $LATEX $LATEXFLAGS ${SOURCE.file}' - env['LATEXRETRIES'] = 4 - - env['PDFLATEX'] = 'pdflatex' - env['PDFLATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') - env['PDFLATEXCOM'] = CDCOM + '${TARGET.dir} && $PDFLATEX $PDFLATEXFLAGS ${SOURCE.file}' - - env['BIBTEX'] = 'bibtex' - env['BIBTEXFLAGS'] = SCons.Util.CLVar('') - env['BIBTEXCOM'] = CDCOM + '${TARGET.dir} && $BIBTEX $BIBTEXFLAGS ${SOURCE.filebase}' - - env['MAKEINDEX'] = 'makeindex' - env['MAKEINDEXFLAGS'] = SCons.Util.CLVar('') - env['MAKEINDEXCOM'] = CDCOM + '${TARGET.dir} && $MAKEINDEX $MAKEINDEXFLAGS ${SOURCE.file}' - - env['MAKEGLOSSARY'] = 'makeindex' - env['MAKEGLOSSARYSTYLE'] = '${SOURCE.filebase}.ist' - env['MAKEGLOSSARYFLAGS'] = SCons.Util.CLVar('-s ${MAKEGLOSSARYSTYLE} -t ${SOURCE.filebase}.glg') - env['MAKEGLOSSARYCOM'] = CDCOM + '${TARGET.dir} && $MAKEGLOSSARY ${SOURCE.filebase}.glo $MAKEGLOSSARYFLAGS -o ${SOURCE.filebase}.gls' - - env['MAKEACRONYMS'] = 'makeindex' - env['MAKEACRONYMSSTYLE'] = '${SOURCE.filebase}.ist' - env['MAKEACRONYMSFLAGS'] = SCons.Util.CLVar('-s ${MAKEACRONYMSSTYLE} -t ${SOURCE.filebase}.alg') - env['MAKEACRONYMSCOM'] = CDCOM + '${TARGET.dir} && $MAKEACRONYMS ${SOURCE.filebase}.acn $MAKEACRONYMSFLAGS -o ${SOURCE.filebase}.acr' - - env['MAKENCL'] = 'makeindex' - env['MAKENCLSTYLE'] = 'nomencl.ist' - env['MAKENCLFLAGS'] = '-s ${MAKENCLSTYLE} -t ${SOURCE.filebase}.nlg' - env['MAKENCLCOM'] = CDCOM + '${TARGET.dir} && $MAKENCL ${SOURCE.filebase}.nlo $MAKENCLFLAGS -o ${SOURCE.filebase}.nls' - -def exists(env): - generate_darwin(env) - return env.Detect('tex') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/textfile.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/textfile.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/textfile.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/textfile.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,175 +0,0 @@ -# -*- python -*- -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__doc__ = """ -Textfile/Substfile builder for SCons. - - Create file 'target' which typically is a textfile. The 'source' - may be any combination of strings, Nodes, or lists of same. A - 'linesep' will be put between any part written and defaults to - os.linesep. - - The only difference between the Textfile builder and the Substfile - builder is that strings are converted to Value() nodes for the - former and File() nodes for the latter. To insert files in the - former or strings in the latter, wrap them in a File() or Value(), - respectively. - - The values of SUBST_DICT first have any construction variables - expanded (its keys are not expanded). If a value of SUBST_DICT is - a python callable function, it is called and the result is expanded - as the value. Values are substituted in a "random" order; if any - substitution could be further expanded by another subsitition, it - is unpredictible whether the expansion will occur. -""" - -__revision__ = "src/engine/SCons/Tool/textfile.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons - -import os -import re - -from SCons.Node import Node -from SCons.Node.Python import Value -from SCons.Util import is_String, is_Sequence, is_Dict - -def _do_subst(node, subs): - """ - Fetch the node contents and replace all instances of the keys with - their values. For example, if subs is - {'%VERSION%': '1.2345', '%BASE%': 'MyProg', '%prefix%': '/bin'}, - then all instances of %VERSION% in the file will be replaced with - 1.2345 and so forth. - """ - contents = node.get_text_contents() - if not subs: return contents - for (k,v) in subs: - contents = re.sub(k, v, contents) - return contents - -def _action(target, source, env): - # prepare the line separator - linesep = env['LINESEPARATOR'] - if linesep is None: - linesep = os.linesep - elif is_String(linesep): - pass - elif isinstance(linesep, Value): - linesep = linesep.get_text_contents() - else: - raise SCons.Errors.UserError( - 'unexpected type/class for LINESEPARATOR: %s' - % repr(linesep), None) - - # create a dictionary to use for the substitutions - if 'SUBST_DICT' not in env: - subs = None # no substitutions - else: - d = env['SUBST_DICT'] - if is_Dict(d): - d = list(d.items()) - elif is_Sequence(d): - pass - else: - raise SCons.Errors.UserError('SUBST_DICT must be dict or sequence') - subs = [] - for (k,v) in d: - if callable(v): - v = v() - if is_String(v): - v = env.subst(v) - else: - v = str(v) - subs.append((k,v)) - - # write the file - try: - fd = open(target[0].get_path(), "wb") - except (OSError,IOError), e: - raise SCons.Errors.UserError("Can't write target file %s" % target[0]) - # separate lines by 'linesep' only if linesep is not empty - lsep = None - for s in source: - if lsep: fd.write(lsep) - fd.write(_do_subst(s, subs)) - lsep = linesep - fd.close() - -def _strfunc(target, source, env): - return "Creating '%s'" % target[0] - -def _convert_list_R(newlist, sources): - for elem in sources: - if is_Sequence(elem): - _convert_list_R(newlist, elem) - elif isinstance(elem, Node): - newlist.append(elem) - else: - newlist.append(Value(elem)) -def _convert_list(target, source, env): - if len(target) != 1: - raise SCons.Errors.UserError("Only one target file allowed") - newlist = [] - _convert_list_R(newlist, source) - return target, newlist - -_common_varlist = ['SUBST_DICT', 'LINESEPARATOR'] - -_text_varlist = _common_varlist + ['TEXTFILEPREFIX', 'TEXTFILESUFFIX'] -_text_builder = SCons.Builder.Builder( - action = SCons.Action.Action(_action, _strfunc, varlist = _text_varlist), - source_factory = Value, - emitter = _convert_list, - prefix = '$TEXTFILEPREFIX', - suffix = '$TEXTFILESUFFIX', - ) - -_subst_varlist = _common_varlist + ['SUBSTFILEPREFIX', 'TEXTFILESUFFIX'] -_subst_builder = SCons.Builder.Builder( - action = SCons.Action.Action(_action, _strfunc, varlist = _subst_varlist), - source_factory = SCons.Node.FS.File, - emitter = _convert_list, - prefix = '$SUBSTFILEPREFIX', - suffix = '$SUBSTFILESUFFIX', - src_suffix = ['.in'], - ) - -def generate(env): - env['LINESEPARATOR'] = os.linesep - env['BUILDERS']['Textfile'] = _text_builder - env['TEXTFILEPREFIX'] = '' - env['TEXTFILESUFFIX'] = '.txt' - env['BUILDERS']['Substfile'] = _subst_builder - env['SUBSTFILEPREFIX'] = '' - env['SUBSTFILESUFFIX'] = '' - -def exists(env): - return 1 - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/tlib.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/tlib.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/tlib.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/tlib.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -"""SCons.Tool.tlib - -XXX - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/tlib.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Tool -import SCons.Tool.bcc32 -import SCons.Util - -def generate(env): - SCons.Tool.bcc32.findIt('tlib', env) - """Add Builders and construction variables for ar to an Environment.""" - SCons.Tool.createStaticLibBuilder(env) - env['AR'] = 'tlib' - env['ARFLAGS'] = SCons.Util.CLVar('') - env['ARCOM'] = '$AR $TARGET $ARFLAGS /a $SOURCES' - env['LIBPREFIX'] = '' - env['LIBSUFFIX'] = '.lib' - -def exists(env): - return SCons.Tool.bcc32.findIt('tlib', env) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/wix.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/wix.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/wix.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/wix.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,99 +0,0 @@ -"""SCons.Tool.wix - -Tool-specific initialization for wix, the Windows Installer XML Tool. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/wix.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import SCons.Builder -import SCons.Action -import os - -def generate(env): - """Add Builders and construction variables for WiX to an Environment.""" - if not exists(env): - return - - env['WIXCANDLEFLAGS'] = ['-nologo'] - env['WIXCANDLEINCLUDE'] = [] - env['WIXCANDLECOM'] = '$WIXCANDLE $WIXCANDLEFLAGS -I $WIXCANDLEINCLUDE -o ${TARGET} ${SOURCE}' - - env['WIXLIGHTFLAGS'].append( '-nologo' ) - env['WIXLIGHTCOM'] = "$WIXLIGHT $WIXLIGHTFLAGS -out ${TARGET} ${SOURCES}" - - object_builder = SCons.Builder.Builder( - action = '$WIXCANDLECOM', - suffix = '.wxiobj', - src_suffix = '.wxs') - - linker_builder = SCons.Builder.Builder( - action = '$WIXLIGHTCOM', - src_suffix = '.wxiobj', - src_builder = object_builder) - - env['BUILDERS']['WiX'] = linker_builder - -def exists(env): - env['WIXCANDLE'] = 'candle.exe' - env['WIXLIGHT'] = 'light.exe' - - # try to find the candle.exe and light.exe tools and - # add the install directory to light libpath. - #for path in os.environ['PATH'].split(os.pathsep): - for path in os.environ['PATH'].split(os.pathsep): - if not path: - continue - - # workaround for some weird python win32 bug. - if path[0] == '"' and path[-1:]=='"': - path = path[1:-1] - - # normalize the path - path = os.path.normpath(path) - - # search for the tools in the PATH environment variable - try: - if env['WIXCANDLE'] in os.listdir(path) and\ - env['WIXLIGHT'] in os.listdir(path): - env.PrependENVPath('PATH', path) - env['WIXLIGHTFLAGS'] = [ os.path.join( path, 'wixui.wixlib' ), - '-loc', - os.path.join( path, 'WixUI_en-us.wxl' ) ] - return 1 - except OSError: - pass # ignore this, could be a stale PATH entry. - - return None - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/xgettext.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/xgettext.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/xgettext.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/xgettext.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,333 +0,0 @@ -""" xgettext tool - -Tool specific initialization of `xgettext` tool. -""" - -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Tool/xgettext.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -############################################################################# -class _CmdRunner(object): - """ Callabe object, which runs shell command storing its stdout and stderr to - variables. It also provides `strfunction()` method, which shall be used by - scons Action objects to print command string. """ - - def __init__( self, command, commandstr = None): - self.out = None - self.err = None - self.status = None - self.command = command - self.commandstr = commandstr - - def __call__(self, target, source, env): - import SCons.Action - import subprocess - import os - import sys - kw = { - 'stdin' : 'devnull', - 'stdout' : subprocess.PIPE, - 'stderr' : subprocess.PIPE, - 'universal_newlines' : True, - 'shell' : True - } - command = env.subst(self.command, target = target, source = source) - proc = SCons.Action._subproc(env, command, **kw) - self.out, self.err = proc.communicate() - self.status = proc.wait() - if self.err: sys.stderr.write(unicode(self.err)) - return self.status - - def strfunction(self, target, source, env): - import os - comstr = self.commandstr - if env.subst(comstr, target = target, source = source) == "": - comstr = self.command - s = env.subst(comstr, target = target, source = source) - return s -############################################################################# - -############################################################################# -def _update_pot_file(target, source, env): - """ Action function for `POTUpdate` builder """ - import re - import os - import SCons.Action - nop = lambda target, source, env : 0 - - # Save scons cwd and os cwd (NOTE: they may be different. After the job, we - # revert ech one to its original state). - save_cwd = env.fs.getcwd() - save_os_cwd = os.getcwd() - chdir = target[0].dir - chdir_str = repr(chdir.get_abspath()) - # Print chdir message (employ SCons.Action.Action for that. It knows better - # than me how to to this correctly). - env.Execute(SCons.Action.Action(nop, "Entering " + chdir_str)) - # Go to target's directory and do our job - env.fs.chdir(chdir, 1) # Go into target's directory - try: - cmd = _CmdRunner('$XGETTEXTCOM', '$XGETTEXTCOMSTR') - action = SCons.Action.Action(cmd, strfunction=cmd.strfunction) - status = action([ target[0] ], source, env) - except: - # Something went wrong. - env.Execute(SCons.Action.Action(nop, "Leaving " + chdir_str)) - # Revert working dirs to previous state and re-throw exception. - env.fs.chdir(save_cwd, 0) - os.chdir(save_os_cwd) - raise - # Print chdir message. - env.Execute(SCons.Action.Action(nop, "Leaving " + chdir_str)) - # Revert working dirs to previous state. - env.fs.chdir(save_cwd, 0) - os.chdir(save_os_cwd) - # If the command was not successfull, return error code. - if status: return status - - new_content = cmd.out - - if not new_content: - # When xgettext finds no internationalized messages, no *.pot is created - # (because we don't want to bother translators with empty POT files). - needs_update = False - explain = "no internationalized messages encountered" - else: - if target[0].exists(): - # If the file already exists, it's left unaltered unless its messages - # are outdated (w.r.t. to these recovered by xgettext from sources). - old_content = target[0].get_text_contents() - re_cdate = re.compile(r'^"POT-Creation-Date: .*"$[\r\n]?', re.M) - old_content_nocdate = re.sub(re_cdate,"",old_content) - new_content_nocdate = re.sub(re_cdate,"",new_content) - if(old_content_nocdate == new_content_nocdate): - # Messages are up-to-date - needs_update = False - explain = "messages in file found to be up-to-date" - else: - # Messages are outdated - needs_update = True - explain = "messages in file were outdated" - else: - # No POT file found, create new one - needs_update = True - explain = "new file" - if needs_update: - # Print message employing SCons.Action.Action for that. - msg = "Writting " + repr(str(target[0])) + " (" + explain + ")" - env.Execute(SCons.Action.Action(nop, msg)) - f = open(str(target[0]),"w") - f.write(new_content) - f.close() - return 0 - else: - # Print message employing SCons.Action.Action for that. - msg = "Not writting " + repr(str(target[0])) + " (" + explain + ")" - env.Execute(SCons.Action.Action(nop, msg)) - return 0 -############################################################################# - -############################################################################# -from SCons.Builder import BuilderBase -############################################################################# -class _POTBuilder(BuilderBase): - def _execute(self, env, target, source, *args): - if not target: - if env.has_key('POTDOMAIN') and env['POTDOMAIN']: - domain = env['POTDOMAIN'] - else: - domain = 'messages' - target = [ domain ] - return BuilderBase._execute(self, env, target, source, *args) -############################################################################# - -############################################################################# -def _scan_xgettext_from_files(target, source, env, files = None, path = None): - """ Parses `POTFILES.in`-like file and returns list of extracted file names. - """ - import re - import SCons.Util - import SCons.Node.FS - - if files is None: - return 0 - if not SCons.Util.is_List(files): - files = [ files ] - - if path is None: - if env.has_key('XGETTEXTPATH'): - path = env['XGETTEXTPATH'] - else: - path = [] - if not SCons.Util.is_List(path): - path = [ path ] - - path = SCons.Util.flatten(path) - - dirs = () - for p in path: - if not isinstance(p, SCons.Node.FS.Base): - if SCons.Util.is_String(p): - p = env.subst(p, source = source, target = target) - p = env.arg2nodes(p, env.fs.Dir) - dirs += tuple(p) - # cwd is the default search path (when no path is defined by user) - if not dirs: - dirs = (env.fs.getcwd(),) - - # Parse 'POTFILE.in' files. - re_comment = re.compile(r'^#[^\n\r]*$\r?\n?', re.M) - re_emptyln = re.compile(r'^[ \t\r]*$\r?\n?', re.M) - re_trailws = re.compile(r'[ \t\r]+$') - for f in files: - # Find files in search path $XGETTEXTPATH - if isinstance(f, SCons.Node.FS.Base) and f.rexists(): - contents = f.get_text_contents() - contents = re_comment.sub("", contents) - contents = re_emptyln.sub("", contents) - contents = re_trailws.sub("", contents) - depnames = contents.splitlines() - for depname in depnames: - depfile = SCons.Node.FS.find_file(depname, dirs) - if not depfile: - depfile = env.arg2nodes(depname, dirs[0].File) - env.Depends(target, depfile) - return 0 -############################################################################# - -############################################################################# -def _pot_update_emitter(target, source, env): - """ Emitter function for `POTUpdate` builder """ - from SCons.Tool.GettextCommon import _POTargetFactory - import SCons.Util - import SCons.Node.FS - - if env.has_key('XGETTEXTFROM'): - xfrom = env['XGETTEXTFROM'] - else: - return target, source - if not SCons.Util.is_List(xfrom): - xfrom = [ xfrom ] - - xfrom = SCons.Util.flatten(xfrom) - - # Prepare list of 'POTFILE.in' files. - files = [] - for xf in xfrom: - if not isinstance(xf, SCons.Node.FS.Base): - if SCons.Util.is_String(xf): - # Interpolate variables in strings - xf = env.subst(xf, source = source, target = target) - xf = env.arg2nodes(xf) - files.extend(xf) - if files: - env.Depends(target, files) - _scan_xgettext_from_files(target, source, env, files) - return target, source -############################################################################# - -############################################################################# -from SCons.Environment import _null -############################################################################# -def _POTUpdateBuilderWrapper(env, target=None, source=_null, **kw): - return env._POTUpdateBuilder(target, source, **kw) -############################################################################# - -############################################################################# -def _POTUpdateBuilder(env, **kw): - """ Creates `POTUpdate` builder object """ - import SCons.Action - from SCons.Tool.GettextCommon import _POTargetFactory - kw['action'] = SCons.Action.Action(_update_pot_file, None) - kw['suffix'] = '$POTSUFFIX' - kw['target_factory'] = _POTargetFactory(env, alias='$POTUPDATE_ALIAS').File - kw['emitter'] = _pot_update_emitter - return _POTBuilder(**kw) -############################################################################# - -############################################################################# -def generate(env,**kw): - """ Generate `xgettext` tool """ - import SCons.Util - from SCons.Tool.GettextCommon import RPaths, _detect_xgettext - - env['XGETTEXT'] = _detect_xgettext(env) - # NOTE: sources="$SOURCES" would work as well. However, we use following - # construction to convert absolute paths provided by scons onto paths - # relative to current working dir. Note, that scons expands $SOURCE(S) to - # absolute paths for sources $SOURCE(s) outside of current subtree (e.g. in - # "../"). With source=$SOURCE these absolute paths would be written to the - # resultant *.pot file (and its derived *.po files) as references to lines in - # source code (e.g. referring lines in *.c files). Such references would be - # correct (e.g. in poedit) only on machine on which *.pot was generated and - # would be of no use on other hosts (having a copy of source code located - # in different place in filesystem). - sources = '$( ${_concat( "", SOURCES, "", __env__, XgettextRPaths, TARGET' \ - + ', SOURCES)} $)' - - # NOTE: the output from $XGETTEXTCOM command must go to stdout, not to a file. - # This is required by the POTUpdate builder's action. - xgettextcom = '$XGETTEXT $XGETTEXTFLAGS $_XGETTEXTPATHFLAGS' \ - + ' $_XGETTEXTFROMFLAGS -o - ' + sources - - xgettextpathflags = '$( ${_concat( XGETTEXTPATHPREFIX, XGETTEXTPATH' \ - + ', XGETTEXTPATHSUFFIX, __env__, RDirs, TARGET, SOURCES)} $)' - xgettextfromflags = '$( ${_concat( XGETTEXTFROMPREFIX, XGETTEXTFROM' \ - + ', XGETTEXTFROMSUFFIX, __env__, target=TARGET, source=SOURCES)} $)' - - env.SetDefault( - _XGETTEXTDOMAIN = '${TARGET.filebase}', - XGETTEXTFLAGS = [ ], - XGETTEXTCOM = xgettextcom, - XGETTEXTCOMSTR = '', - XGETTEXTPATH = [ ], - XGETTEXTPATHPREFIX = '-D', - XGETTEXTPATHSUFFIX = '', - XGETTEXTFROM = None, - XGETTEXTFROMPREFIX = '-f', - XGETTEXTFROMSUFFIX = '', - _XGETTEXTPATHFLAGS = xgettextpathflags, - _XGETTEXTFROMFLAGS = xgettextfromflags, - POTSUFFIX = ['.pot'], - POTUPDATE_ALIAS = 'pot-update', - XgettextRPaths = RPaths(env) - ) - env.Append( BUILDERS = { - '_POTUpdateBuilder' : _POTUpdateBuilder(env) - } ) - env.AddMethod(_POTUpdateBuilderWrapper, 'POTUpdate') - env.AlwaysBuild(env.Alias('$POTUPDATE_ALIAS')) -############################################################################# - -############################################################################# -def exists(env): - """ Check, whether the tool exists """ - from SCons.Tool.GettextCommon import _xgettext_exists - return _xgettext_exists(env) -############################################################################# - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/yacc.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/yacc.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/yacc.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/yacc.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,140 +0,0 @@ -"""SCons.Tool.yacc - -Tool-specific initialization for yacc. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/yacc.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path - -import SCons.Defaults -import SCons.Tool -import SCons.Util - -YaccAction = SCons.Action.Action("$YACCCOM", "$YACCCOMSTR") - -def _yaccEmitter(target, source, env, ysuf, hsuf): - yaccflags = env.subst("$YACCFLAGS", target=target, source=source) - flags = SCons.Util.CLVar(yaccflags) - targetBase, targetExt = os.path.splitext(SCons.Util.to_String(target[0])) - - if '.ym' in ysuf: # If using Objective-C - target = [targetBase + ".m"] # the extension is ".m". - - - # If -d is specified on the command line, yacc will emit a .h - # or .hpp file with the same name as the .c or .cpp output file. - if '-d' in flags: - target.append(targetBase + env.subst(hsuf, target=target, source=source)) - - # If -g is specified on the command line, yacc will emit a .vcg - # file with the same base name as the .y, .yacc, .ym or .yy file. - if "-g" in flags: - base, ext = os.path.splitext(SCons.Util.to_String(source[0])) - target.append(base + env.subst("$YACCVCGFILESUFFIX")) - - # If -v is specirfied yacc will create the output debug file - # which is not really source for any process, but should - # be noted and also be cleaned - # Bug #2558 - if "-v" in flags: - env.SideEffect(targetBase+'.output',target[0]) - env.Clean(target[0],targetBase+'.output') - - - - # With --defines and --graph, the name of the file is totally defined - # in the options. - fileGenOptions = ["--defines=", "--graph="] - for option in flags: - for fileGenOption in fileGenOptions: - l = len(fileGenOption) - if option[:l] == fileGenOption: - # A file generating option is present, so add the file - # name to the list of targets. - fileName = option[l:].strip() - target.append(fileName) - - return (target, source) - -def yEmitter(target, source, env): - return _yaccEmitter(target, source, env, ['.y', '.yacc'], '$YACCHFILESUFFIX') - -def ymEmitter(target, source, env): - return _yaccEmitter(target, source, env, ['.ym'], '$YACCHFILESUFFIX') - -def yyEmitter(target, source, env): - return _yaccEmitter(target, source, env, ['.yy'], '$YACCHXXFILESUFFIX') - -def generate(env): - """Add Builders and construction variables for yacc to an Environment.""" - c_file, cxx_file = SCons.Tool.createCFileBuilders(env) - - # C - c_file.add_action('.y', YaccAction) - c_file.add_emitter('.y', yEmitter) - - c_file.add_action('.yacc', YaccAction) - c_file.add_emitter('.yacc', yEmitter) - - # Objective-C - c_file.add_action('.ym', YaccAction) - c_file.add_emitter('.ym', ymEmitter) - - # C++ - cxx_file.add_action('.yy', YaccAction) - cxx_file.add_emitter('.yy', yyEmitter) - - env['YACC'] = env.Detect('bison') or 'yacc' - env['YACCFLAGS'] = SCons.Util.CLVar('') - env['YACCCOM'] = '$YACC $YACCFLAGS -o $TARGET $SOURCES' - env['YACCHFILESUFFIX'] = '.h' - - # Apparently, OS X now creates file.hpp like everybody else - # I have no idea when it changed; it was fixed in 10.4 - #if env['PLATFORM'] == 'darwin': - # # Bison on Mac OS X just appends ".h" to the generated target .cc - # # or .cpp file name. Hooray for delayed expansion of variables. - # env['YACCHXXFILESUFFIX'] = '${TARGET.suffix}.h' - #else: - # env['YACCHXXFILESUFFIX'] = '.hpp' - env['YACCHXXFILESUFFIX'] = '.hpp' - - env['YACCVCGFILESUFFIX'] = '.vcg' - -def exists(env): - return env.Detect(['bison', 'yacc']) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/zip.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/zip.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Tool/zip.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Tool/zip.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,99 +0,0 @@ -"""SCons.Tool.zip - -Tool-specific initialization for zip. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Tool/zip.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path - -import SCons.Builder -import SCons.Defaults -import SCons.Node.FS -import SCons.Util - -try: - import zipfile - internal_zip = 1 -except ImportError: - internal_zip = 0 - -if internal_zip: - zipcompression = zipfile.ZIP_DEFLATED - def zip(target, source, env): - compression = env.get('ZIPCOMPRESSION', 0) - zf = zipfile.ZipFile(str(target[0]), 'w', compression) - for s in source: - if s.isdir(): - for dirpath, dirnames, filenames in os.walk(str(s)): - for fname in filenames: - path = os.path.join(dirpath, fname) - if os.path.isfile(path): - zf.write(path) - else: - zf.write(str(s)) - zf.close() -else: - zipcompression = 0 - zip = "$ZIP $ZIPFLAGS ${TARGET.abspath} $SOURCES" - - -zipAction = SCons.Action.Action(zip, varlist=['ZIPCOMPRESSION']) - -ZipBuilder = SCons.Builder.Builder(action = SCons.Action.Action('$ZIPCOM', '$ZIPCOMSTR'), - source_factory = SCons.Node.FS.Entry, - source_scanner = SCons.Defaults.DirScanner, - suffix = '$ZIPSUFFIX', - multi = 1) - - -def generate(env): - """Add Builders and construction variables for zip to an Environment.""" - try: - bld = env['BUILDERS']['Zip'] - except KeyError: - bld = ZipBuilder - env['BUILDERS']['Zip'] = bld - - env['ZIP'] = 'zip' - env['ZIPFLAGS'] = SCons.Util.CLVar('') - env['ZIPCOM'] = zipAction - env['ZIPCOMPRESSION'] = zipcompression - env['ZIPSUFFIX'] = '.zip' - -def exists(env): - return internal_zip or env.Detect('zip') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Util.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Util.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Util.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Util.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,1492 +0,0 @@ -"""SCons.Util - -Various utility functions go here. -""" -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Util.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os -import sys -import copy -import re -import types - -from collections import UserDict, UserList, UserString - -# Don't "from types import ..." these because we need to get at the -# types module later to look for UnicodeType. -InstanceType = types.InstanceType -MethodType = types.MethodType -FunctionType = types.FunctionType -try: unicode -except NameError: UnicodeType = None -else: UnicodeType = unicode - -def dictify(keys, values, result={}): - for k, v in zip(keys, values): - result[k] = v - return result - -_altsep = os.altsep -if _altsep is None and sys.platform == 'win32': - # My ActivePython 2.0.1 doesn't set os.altsep! What gives? - _altsep = '/' -if _altsep: - def rightmost_separator(path, sep): - return max(path.rfind(sep), path.rfind(_altsep)) -else: - def rightmost_separator(path, sep): - return path.rfind(sep) - -# First two from the Python Cookbook, just for completeness. -# (Yeah, yeah, YAGNI...) -def containsAny(str, set): - """Check whether sequence str contains ANY of the items in set.""" - for c in set: - if c in str: return 1 - return 0 - -def containsAll(str, set): - """Check whether sequence str contains ALL of the items in set.""" - for c in set: - if c not in str: return 0 - return 1 - -def containsOnly(str, set): - """Check whether sequence str contains ONLY items in set.""" - for c in str: - if c not in set: return 0 - return 1 - -def splitext(path): - "Same as os.path.splitext() but faster." - sep = rightmost_separator(path, os.sep) - dot = path.rfind('.') - # An ext is only real if it has at least one non-digit char - if dot > sep and not containsOnly(path[dot:], "0123456789."): - return path[:dot],path[dot:] - else: - return path,"" - -def updrive(path): - """ - Make the drive letter (if any) upper case. - This is useful because Windows is inconsitent on the case - of the drive letter, which can cause inconsistencies when - calculating command signatures. - """ - drive, rest = os.path.splitdrive(path) - if drive: - path = drive.upper() + rest - return path - -class NodeList(UserList): - """This class is almost exactly like a regular list of Nodes - (actually it can hold any object), with one important difference. - If you try to get an attribute from this list, it will return that - attribute from every item in the list. For example: - - >>> someList = NodeList([ ' foo ', ' bar ' ]) - >>> someList.strip() - [ 'foo', 'bar' ] - """ - def __nonzero__(self): - return len(self.data) != 0 - - def __str__(self): - return ' '.join(map(str, self.data)) - - def __iter__(self): - return iter(self.data) - - def __call__(self, *args, **kwargs): - result = [x(*args, **kwargs) for x in self.data] - return self.__class__(result) - - def __getattr__(self, name): - result = [getattr(x, name) for x in self.data] - return self.__class__(result) - - -_get_env_var = re.compile(r'^\$([_a-zA-Z]\w*|{[_a-zA-Z]\w*})$') - -def get_environment_var(varstr): - """Given a string, first determine if it looks like a reference - to a single environment variable, like "$FOO" or "${FOO}". - If so, return that variable with no decorations ("FOO"). - If not, return None.""" - mo=_get_env_var.match(to_String(varstr)) - if mo: - var = mo.group(1) - if var[0] == '{': - return var[1:-1] - else: - return var - else: - return None - -class DisplayEngine(object): - print_it = True - def __call__(self, text, append_newline=1): - if not self.print_it: - return - if append_newline: text = text + '\n' - try: - sys.stdout.write(unicode(text)) - except IOError: - # Stdout might be connected to a pipe that has been closed - # by now. The most likely reason for the pipe being closed - # is that the user has press ctrl-c. It this is the case, - # then SCons is currently shutdown. We therefore ignore - # IOError's here so that SCons can continue and shutdown - # properly so that the .sconsign is correctly written - # before SCons exits. - pass - - def set_mode(self, mode): - self.print_it = mode - -def render_tree(root, child_func, prune=0, margin=[0], visited={}): - """ - Render a tree of nodes into an ASCII tree view. - root - the root node of the tree - child_func - the function called to get the children of a node - prune - don't visit the same node twice - margin - the format of the left margin to use for children of root. - 1 results in a pipe, and 0 results in no pipe. - visited - a dictionary of visited nodes in the current branch if not prune, - or in the whole tree if prune. - """ - - rname = str(root) - - children = child_func(root) - retval = "" - for pipe in margin[:-1]: - if pipe: - retval = retval + "| " - else: - retval = retval + " " - - if rname in visited: - return retval + "+-[" + rname + "]\n" - - retval = retval + "+-" + rname + "\n" - if not prune: - visited = copy.copy(visited) - visited[rname] = 1 - - for i in range(len(children)): - margin.append(i 0 - last = t[0] - lasti = i = 1 - while i < n: - if t[i] != last: - t[lasti] = last = t[i] - lasti = lasti + 1 - i = i + 1 - return t[:lasti] - del t - - # Brute force is all that's left. - u = [] - for x in s: - if x not in u: - u.append(x) - return u - - - -# From Alex Martelli, -# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560 -# ASPN: Python Cookbook: Remove duplicates from a sequence -# First comment, dated 2001/10/13. -# (Also in the printed Python Cookbook.) - -def uniquer(seq, idfun=None): - if idfun is None: - def idfun(x): return x - seen = {} - result = [] - for item in seq: - marker = idfun(item) - # in old Python versions: - # if seen.has_key(marker) - # but in new ones: - if marker in seen: continue - seen[marker] = 1 - result.append(item) - return result - -# A more efficient implementation of Alex's uniquer(), this avoids the -# idfun() argument and function-call overhead by assuming that all -# items in the sequence are hashable. - -def uniquer_hashables(seq): - seen = {} - result = [] - for item in seq: - #if not item in seen: - if item not in seen: - seen[item] = 1 - result.append(item) - return result - - - -# Much of the logic here was originally based on recipe 4.9 from the -# Python CookBook, but we had to dumb it way down for Python 1.5.2. -class LogicalLines(object): - - def __init__(self, fileobj): - self.fileobj = fileobj - - def readline(self): - result = [] - while True: - line = self.fileobj.readline() - if not line: - break - if line[-2:] == '\\\n': - result.append(line[:-2]) - else: - result.append(line) - break - return ''.join(result) - - def readlines(self): - result = [] - while True: - line = self.readline() - if not line: - break - result.append(line) - return result - - - -class UniqueList(UserList): - def __init__(self, seq = []): - UserList.__init__(self, seq) - self.unique = True - def __make_unique(self): - if not self.unique: - self.data = uniquer_hashables(self.data) - self.unique = True - def __lt__(self, other): - self.__make_unique() - return UserList.__lt__(self, other) - def __le__(self, other): - self.__make_unique() - return UserList.__le__(self, other) - def __eq__(self, other): - self.__make_unique() - return UserList.__eq__(self, other) - def __ne__(self, other): - self.__make_unique() - return UserList.__ne__(self, other) - def __gt__(self, other): - self.__make_unique() - return UserList.__gt__(self, other) - def __ge__(self, other): - self.__make_unique() - return UserList.__ge__(self, other) - def __cmp__(self, other): - self.__make_unique() - return UserList.__cmp__(self, other) - def __len__(self): - self.__make_unique() - return UserList.__len__(self) - def __getitem__(self, i): - self.__make_unique() - return UserList.__getitem__(self, i) - def __setitem__(self, i, item): - UserList.__setitem__(self, i, item) - self.unique = False - def __getslice__(self, i, j): - self.__make_unique() - return UserList.__getslice__(self, i, j) - def __setslice__(self, i, j, other): - UserList.__setslice__(self, i, j, other) - self.unique = False - def __add__(self, other): - result = UserList.__add__(self, other) - result.unique = False - return result - def __radd__(self, other): - result = UserList.__radd__(self, other) - result.unique = False - return result - def __iadd__(self, other): - result = UserList.__iadd__(self, other) - result.unique = False - return result - def __mul__(self, other): - result = UserList.__mul__(self, other) - result.unique = False - return result - def __rmul__(self, other): - result = UserList.__rmul__(self, other) - result.unique = False - return result - def __imul__(self, other): - result = UserList.__imul__(self, other) - result.unique = False - return result - def append(self, item): - UserList.append(self, item) - self.unique = False - def insert(self, i): - UserList.insert(self, i) - self.unique = False - def count(self, item): - self.__make_unique() - return UserList.count(self, item) - def index(self, item): - self.__make_unique() - return UserList.index(self, item) - def reverse(self): - self.__make_unique() - UserList.reverse(self) - def sort(self, *args, **kwds): - self.__make_unique() - return UserList.sort(self, *args, **kwds) - def extend(self, other): - UserList.extend(self, other) - self.unique = False - - -class Unbuffered(object): - """ - A proxy class that wraps a file object, flushing after every write, - and delegating everything else to the wrapped object. - """ - def __init__(self, file): - self.file = file - self.softspace = 0 ## backward compatibility; not supported in Py3k - def write(self, arg): - try: - self.file.write(arg) - self.file.flush() - except IOError: - # Stdout might be connected to a pipe that has been closed - # by now. The most likely reason for the pipe being closed - # is that the user has press ctrl-c. It this is the case, - # then SCons is currently shutdown. We therefore ignore - # IOError's here so that SCons can continue and shutdown - # properly so that the .sconsign is correctly written - # before SCons exits. - pass - def __getattr__(self, attr): - return getattr(self.file, attr) - -def make_path_relative(path): - """ makes an absolute path name to a relative pathname. - """ - if os.path.isabs(path): - drive_s,path = os.path.splitdrive(path) - - import re - if not drive_s: - path=re.compile("/*(.*)").findall(path)[0] - else: - path=path[1:] - - assert( not os.path.isabs( path ) ), path - return path - - - -# The original idea for AddMethod() and RenameFunction() come from the -# following post to the ActiveState Python Cookbook: -# -# ASPN: Python Cookbook : Install bound methods in an instance -# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/223613 -# -# That code was a little fragile, though, so the following changes -# have been wrung on it: -# -# * Switched the installmethod() "object" and "function" arguments, -# so the order reflects that the left-hand side is the thing being -# "assigned to" and the right-hand side is the value being assigned. -# -# * Changed explicit type-checking to the "try: klass = object.__class__" -# block in installmethod() below so that it still works with the -# old-style classes that SCons uses. -# -# * Replaced the by-hand creation of methods and functions with use of -# the "new" module, as alluded to in Alex Martelli's response to the -# following Cookbook post: -# -# ASPN: Python Cookbook : Dynamically added methods to a class -# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81732 - -def AddMethod(obj, function, name=None): - """ - Adds either a bound method to an instance or an unbound method to - a class. If name is ommited the name of the specified function - is used by default. - Example: - a = A() - def f(self, x, y): - self.z = x + y - AddMethod(f, A, "add") - a.add(2, 4) - print a.z - AddMethod(lambda self, i: self.l[i], a, "listIndex") - print a.listIndex(5) - """ - if name is None: - name = function.func_name - else: - function = RenameFunction(function, name) - - if hasattr(obj, '__class__') and obj.__class__ is not type: - # "obj" is an instance, so it gets a bound method. - setattr(obj, name, MethodType(function, obj, obj.__class__)) - else: - # "obj" is a class, so it gets an unbound method. - setattr(obj, name, MethodType(function, None, obj)) - -def RenameFunction(function, name): - """ - Returns a function identical to the specified function, but with - the specified name. - """ - return FunctionType(function.func_code, - function.func_globals, - name, - function.func_defaults) - - -md5 = False -def MD5signature(s): - return str(s) - -def MD5filesignature(fname, chunksize=65536): - f = open(fname, "rb") - result = f.read() - f.close() - return result - -try: - import hashlib -except ImportError: - pass -else: - if hasattr(hashlib, 'md5'): - md5 = True - def MD5signature(s): - m = hashlib.md5() - m.update(str(s)) - return m.hexdigest() - - def MD5filesignature(fname, chunksize=65536): - m = hashlib.md5() - f = open(fname, "rb") - while True: - blck = f.read(chunksize) - if not blck: - break - m.update(str(blck)) - f.close() - return m.hexdigest() - -def MD5collect(signatures): - """ - Collects a list of signatures into an aggregate signature. - - signatures - a list of signatures - returns - the aggregate signature - """ - if len(signatures) == 1: - return signatures[0] - else: - return MD5signature(', '.join(signatures)) - - - -def silent_intern(x): - """ - Perform sys.intern() on the passed argument and return the result. - If the input is ineligible (e.g. a unicode string) the original argument is - returned and no exception is thrown. - """ - try: - return sys.intern(x) - except TypeError: - return x - - - -# From Dinu C. Gherman, -# Python Cookbook, second edition, recipe 6.17, p. 277. -# Also: -# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/68205 -# ASPN: Python Cookbook: Null Object Design Pattern - -#TODO??? class Null(object): -class Null(object): - """ Null objects always and reliably "do nothing." """ - def __new__(cls, *args, **kwargs): - if not '_instance' in vars(cls): - cls._instance = super(Null, cls).__new__(cls, *args, **kwargs) - return cls._instance - def __init__(self, *args, **kwargs): - pass - def __call__(self, *args, **kwargs): - return self - def __repr__(self): - return "Null(0x%08X)" % id(self) - def __nonzero__(self): - return False - def __getattr__(self, name): - return self - def __setattr__(self, name, value): - return self - def __delattr__(self, name): - return self - -class NullSeq(Null): - def __len__(self): - return 0 - def __iter__(self): - return iter(()) - def __getitem__(self, i): - return self - def __delitem__(self, i): - return self - def __setitem__(self, i, v): - return self - - -del __revision__ - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Variables/BoolVariable.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Variables/BoolVariable.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Variables/BoolVariable.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Variables/BoolVariable.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -"""engine.SCons.Variables.BoolVariable - -This file defines the option type for SCons implementing true/false values. - -Usage example: - - opts = Variables() - opts.Add(BoolVariable('embedded', 'build for an embedded system', 0)) - ... - if env['embedded'] == 1: - ... -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Variables/BoolVariable.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -__all__ = ['BoolVariable',] - -import SCons.Errors - -__true_strings = ('y', 'yes', 'true', 't', '1', 'on' , 'all' ) -__false_strings = ('n', 'no', 'false', 'f', '0', 'off', 'none') - - -def _text2bool(val): - """ - Converts strings to True/False depending on the 'truth' expressed by - the string. If the string can't be converted, the original value - will be returned. - - See '__true_strings' and '__false_strings' for values considered - 'true' or 'false respectivly. - - This is usable as 'converter' for SCons' Variables. - """ - lval = val.lower() - if lval in __true_strings: return True - if lval in __false_strings: return False - raise ValueError("Invalid value for boolean option: %s" % val) - - -def _validator(key, val, env): - """ - Validates the given value to be either '0' or '1'. - - This is usable as 'validator' for SCons' Variables. - """ - if not env[key] in (True, False): - raise SCons.Errors.UserError( - 'Invalid value for boolean option %s: %s' % (key, env[key])) - - -def BoolVariable(key, help, default): - """ - The input parameters describe a boolen option, thus they are - returned with the correct converter and validator appended. The - 'help' text will by appended by '(yes|no) to show the valid - valued. The result is usable for input to opts.Add(). - """ - return (key, '%s (yes|no)' % help, default, - _validator, _text2bool) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Variables/EnumVariable.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Variables/EnumVariable.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Variables/EnumVariable.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Variables/EnumVariable.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -"""engine.SCons.Variables.EnumVariable - -This file defines the option type for SCons allowing only specified -input-values. - -Usage example: - - opts = Variables() - opts.Add(EnumVariable('debug', 'debug output and symbols', 'no', - allowed_values=('yes', 'no', 'full'), - map={}, ignorecase=2)) - ... - if env['debug'] == 'full': - ... -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Variables/EnumVariable.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -__all__ = ['EnumVariable',] - - -import SCons.Errors - -def _validator(key, val, env, vals): - if not val in vals: - raise SCons.Errors.UserError( - 'Invalid value for option %s: %s. Valid values are: %s' % (key, val, vals)) - - -def EnumVariable(key, help, default, allowed_values, map={}, ignorecase=0): - """ - The input parameters describe a option with only certain values - allowed. They are returned with an appropriate converter and - validator appended. The result is usable for input to - Variables.Add(). - - 'key' and 'default' are the values to be passed on to Variables.Add(). - - 'help' will be appended by the allowed values automatically - - 'allowed_values' is a list of strings, which are allowed as values - for this option. - - The 'map'-dictionary may be used for converting the input value - into canonical values (eg. for aliases). - - 'ignorecase' defines the behaviour of the validator: - - If ignorecase == 0, the validator/converter are case-sensitive. - If ignorecase == 1, the validator/converter are case-insensitive. - If ignorecase == 2, the validator/converter is case-insensitive and - the converted value will always be lower-case. - - The 'validator' tests whether the value is in the list of allowed - values. The 'converter' converts input values according to the - given 'map'-dictionary (unmapped input values are returned - unchanged). - """ - help = '%s (%s)' % (help, '|'.join(allowed_values)) - # define validator - if ignorecase >= 1: - validator = lambda key, val, env: \ - _validator(key, val.lower(), env, allowed_values) - else: - validator = lambda key, val, env: \ - _validator(key, val, env, allowed_values) - # define converter - if ignorecase == 2: - converter = lambda val: map.get(val.lower(), val).lower() - elif ignorecase == 1: - converter = lambda val: map.get(val.lower(), val) - else: - converter = lambda val: map.get(val, val) - return (key, help, default, validator, converter) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Variables/ListVariable.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Variables/ListVariable.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Variables/ListVariable.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Variables/ListVariable.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,135 +0,0 @@ -"""engine.SCons.Variables.ListVariable - -This file defines the option type for SCons implementing 'lists'. - -A 'list' option may either be 'all', 'none' or a list of names -separated by comma. After the option has been processed, the option -value holds either the named list elements, all list elemens or no -list elements at all. - -Usage example: - - list_of_libs = Split('x11 gl qt ical') - - opts = Variables() - opts.Add(ListVariable('shared', - 'libraries to build as shared libraries', - 'all', - elems = list_of_libs)) - ... - for lib in list_of_libs: - if lib in env['shared']: - env.SharedObject(...) - else: - env.Object(...) -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Variables/ListVariable.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -# Know Bug: This should behave like a Set-Type, but does not really, -# since elements can occur twice. - -__all__ = ['ListVariable',] - -import collections - -import SCons.Util - - -class _ListVariable(collections.UserList): - def __init__(self, initlist=[], allowedElems=[]): - collections.UserList.__init__(self, [_f for _f in initlist if _f]) - self.allowedElems = sorted(allowedElems) - - def __cmp__(self, other): - raise NotImplementedError - def __eq__(self, other): - raise NotImplementedError - def __ge__(self, other): - raise NotImplementedError - def __gt__(self, other): - raise NotImplementedError - def __le__(self, other): - raise NotImplementedError - def __lt__(self, other): - raise NotImplementedError - def __str__(self): - if len(self) == 0: - return 'none' - self.data.sort() - if self.data == self.allowedElems: - return 'all' - else: - return ','.join(self) - def prepare_to_store(self): - return self.__str__() - -def _converter(val, allowedElems, mapdict): - """ - """ - if val == 'none': - val = [] - elif val == 'all': - val = allowedElems - else: - val = [_f for _f in val.split(',') if _f] - val = [mapdict.get(v, v) for v in val] - notAllowed = [v for v in val if not v in allowedElems] - if notAllowed: - raise ValueError("Invalid value(s) for option: %s" % - ','.join(notAllowed)) - return _ListVariable(val, allowedElems) - - -## def _validator(key, val, env): -## """ -## """ -## # todo: write validater for pgk list -## return 1 - - -def ListVariable(key, help, default, names, map={}): - """ - The input parameters describe a 'package list' option, thus they - are returned with the correct converter and validater appended. The - result is usable for input to opts.Add() . - - A 'package list' option may either be 'all', 'none' or a list of - package names (separated by space). - """ - names_str = 'allowed names: %s' % ' '.join(names) - if SCons.Util.is_List(default): - default = ','.join(default) - help = '\n '.join( - (help, '(all|none|comma-separated list of names)', names_str)) - return (key, help, default, - None, #_validator, - lambda val: _converter(val, names, map)) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Variables/PackageVariable.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Variables/PackageVariable.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Variables/PackageVariable.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Variables/PackageVariable.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,106 +0,0 @@ -"""engine.SCons.Variables.PackageVariable - -This file defines the option type for SCons implementing 'package -activation'. - -To be used whenever a 'package' may be enabled/disabled and the -package path may be specified. - -Usage example: - - Examples: - x11=no (disables X11 support) - x11=yes (will search for the package installation dir) - x11=/usr/local/X11 (will check this path for existance) - - To replace autoconf's --with-xxx=yyy - - opts = Variables() - opts.Add(PackageVariable('x11', - 'use X11 installed here (yes = search some places', - 'yes')) - ... - if env['x11'] == True: - dir = ... search X11 in some standard places ... - env['x11'] = dir - if env['x11']: - ... build with x11 ... -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Variables/PackageVariable.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -__all__ = ['PackageVariable',] - -import SCons.Errors - -__enable_strings = ('1', 'yes', 'true', 'on', 'enable', 'search') -__disable_strings = ('0', 'no', 'false', 'off', 'disable') - -def _converter(val): - """ - """ - lval = val.lower() - if lval in __enable_strings: return True - if lval in __disable_strings: return False - #raise ValueError("Invalid value for boolean option: %s" % val) - return val - - -def _validator(key, val, env, searchfunc): - # NB: searchfunc is currenty undocumented and unsupported - """ - """ - # todo: write validator, check for path - import os - if env[key] is True: - if searchfunc: - env[key] = searchfunc(key, val) - elif env[key] and not os.path.exists(val): - raise SCons.Errors.UserError( - 'Path does not exist for option %s: %s' % (key, val)) - - -def PackageVariable(key, help, default, searchfunc=None): - # NB: searchfunc is currenty undocumented and unsupported - """ - The input parameters describe a 'package list' option, thus they - are returned with the correct converter and validator appended. The - result is usable for input to opts.Add() . - - A 'package list' option may either be 'all', 'none' or a list of - package names (seperated by space). - """ - help = '\n '.join( - (help, '( yes | no | /path/to/%s )' % key)) - return (key, help, default, - lambda k, v, e: _validator(k,v,e,searchfunc), - _converter) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Variables/PathVariable.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Variables/PathVariable.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Variables/PathVariable.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Variables/PathVariable.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,147 +0,0 @@ -"""SCons.Variables.PathVariable - -This file defines an option type for SCons implementing path settings. - -To be used whenever a a user-specified path override should be allowed. - -Arguments to PathVariable are: - option-name = name of this option on the command line (e.g. "prefix") - option-help = help string for option - option-dflt = default value for this option - validator = [optional] validator for option value. Predefined - validators are: - - PathAccept -- accepts any path setting; no validation - PathIsDir -- path must be an existing directory - PathIsDirCreate -- path must be a dir; will create - PathIsFile -- path must be a file - PathExists -- path must exist (any type) [default] - - The validator is a function that is called and which - should return True or False to indicate if the path - is valid. The arguments to the validator function - are: (key, val, env). The key is the name of the - option, the val is the path specified for the option, - and the env is the env to which the Otions have been - added. - -Usage example: - - Examples: - prefix=/usr/local - - opts = Variables() - - opts = Variables() - opts.Add(PathVariable('qtdir', - 'where the root of Qt is installed', - qtdir, PathIsDir)) - opts.Add(PathVariable('qt_includes', - 'where the Qt includes are installed', - '$qtdir/includes', PathIsDirCreate)) - opts.Add(PathVariable('qt_libraries', - 'where the Qt library is installed', - '$qtdir/lib')) - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/Variables/PathVariable.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -__all__ = ['PathVariable',] - -import os -import os.path - -import SCons.Errors - -class _PathVariableClass(object): - - def PathAccept(self, key, val, env): - """Accepts any path, no checking done.""" - pass - - def PathIsDir(self, key, val, env): - """Validator to check if Path is a directory.""" - if not os.path.isdir(val): - if os.path.isfile(val): - m = 'Directory path for option %s is a file: %s' - else: - m = 'Directory path for option %s does not exist: %s' - raise SCons.Errors.UserError(m % (key, val)) - - def PathIsDirCreate(self, key, val, env): - """Validator to check if Path is a directory, - creating it if it does not exist.""" - if os.path.isfile(val): - m = 'Path for option %s is a file, not a directory: %s' - raise SCons.Errors.UserError(m % (key, val)) - if not os.path.isdir(val): - os.makedirs(val) - - def PathIsFile(self, key, val, env): - """validator to check if Path is a file""" - if not os.path.isfile(val): - if os.path.isdir(val): - m = 'File path for option %s is a directory: %s' - else: - m = 'File path for option %s does not exist: %s' - raise SCons.Errors.UserError(m % (key, val)) - - def PathExists(self, key, val, env): - """validator to check if Path exists""" - if not os.path.exists(val): - m = 'Path for option %s does not exist: %s' - raise SCons.Errors.UserError(m % (key, val)) - - def __call__(self, key, help, default, validator=None): - # NB: searchfunc is currenty undocumented and unsupported - """ - The input parameters describe a 'path list' option, thus they - are returned with the correct converter and validator appended. The - result is usable for input to opts.Add() . - - The 'default' option specifies the default path to use if the - user does not specify an override with this option. - - validator is a validator, see this file for examples - """ - if validator is None: - validator = self.PathExists - - if SCons.Util.is_List(key) or SCons.Util.is_Tuple(key): - return (key, '%s ( /path/to/%s )' % (help, key[0]), default, - validator, None) - else: - return (key, '%s ( /path/to/%s )' % (help, key), default, - validator, None) - -PathVariable = _PathVariableClass() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Variables/__init__.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Variables/__init__.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Variables/__init__.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Variables/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,312 +0,0 @@ -"""engine.SCons.Variables - -This file defines the Variables class that is used to add user-friendly -customizable variables to an SCons build. -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. - -__revision__ = "src/engine/SCons/Variables/__init__.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os.path -import sys - -import SCons.Environment -import SCons.Errors -import SCons.Util -import SCons.Warnings - -from BoolVariable import BoolVariable # okay -from EnumVariable import EnumVariable # okay -from ListVariable import ListVariable # naja -from PackageVariable import PackageVariable # naja -from PathVariable import PathVariable # okay - - -class Variables(object): - instance=None - - """ - Holds all the options, updates the environment with the variables, - and renders the help text. - """ - def __init__(self, files=[], args={}, is_global=1): - """ - files - [optional] List of option configuration files to load - (backward compatibility) If a single string is passed it is - automatically placed in a file list - """ - self.options = [] - self.args = args - if not SCons.Util.is_List(files): - if files: - files = [ files ] - else: - files = [] - self.files = files - self.unknown = {} - - # create the singleton instance - if is_global: - self=Variables.instance - - if not Variables.instance: - Variables.instance=self - - def _do_add(self, key, help="", default=None, validator=None, converter=None): - class Variable(object): - pass - - option = Variable() - - # if we get a list or a tuple, we take the first element as the - # option key and store the remaining in aliases. - if SCons.Util.is_List(key) or SCons.Util.is_Tuple(key): - option.key = key[0] - option.aliases = key[1:] - else: - option.key = key - option.aliases = [ key ] - option.help = help - option.default = default - option.validator = validator - option.converter = converter - - self.options.append(option) - - # options might be added after the 'unknown' dict has been set up, - # so we remove the key and all its aliases from that dict - for alias in list(option.aliases) + [ option.key ]: - if alias in self.unknown: - del self.unknown[alias] - - def keys(self): - """ - Returns the keywords for the options - """ - return [o.key for o in self.options] - - def Add(self, key, help="", default=None, validator=None, converter=None, **kw): - """ - Add an option. - - key - the name of the variable, or a list or tuple of arguments - help - optional help text for the options - default - optional default value - validator - optional function that is called to validate the option's value - Called with (key, value, environment) - converter - optional function that is called to convert the option's value before - putting it in the environment. - """ - - if SCons.Util.is_List(key) or isinstance(key, tuple): - self._do_add(*key) - return - - if not SCons.Util.is_String(key) or \ - not SCons.Environment.is_valid_construction_var(key): - raise SCons.Errors.UserError("Illegal Variables.Add() key `%s'" % str(key)) - - self._do_add(key, help, default, validator, converter) - - def AddVariables(self, *optlist): - """ - Add a list of options. - - Each list element is a tuple/list of arguments to be passed on - to the underlying method for adding options. - - Example: - opt.AddVariables( - ('debug', '', 0), - ('CC', 'The C compiler'), - ('VALIDATE', 'An option for testing validation', 'notset', - validator, None), - ) - """ - for o in optlist: - self._do_add(*o) - - - def Update(self, env, args=None): - """ - Update an environment with the option variables. - - env - the environment to update. - """ - - values = {} - - # first set the defaults: - for option in self.options: - if not option.default is None: - values[option.key] = option.default - - # next set the value specified in the options file - for filename in self.files: - if os.path.exists(filename): - dir = os.path.split(os.path.abspath(filename))[0] - if dir: - sys.path.insert(0, dir) - try: - values['__name__'] = filename - exec open(filename, 'rU').read() in {}, values - finally: - if dir: - del sys.path[0] - del values['__name__'] - - # set the values specified on the command line - if args is None: - args = self.args - - for arg, value in args.items(): - added = False - for option in self.options: - if arg in list(option.aliases) + [ option.key ]: - values[option.key] = value - added = True - if not added: - self.unknown[arg] = value - - # put the variables in the environment: - # (don't copy over variables that are not declared as options) - for option in self.options: - try: - env[option.key] = values[option.key] - except KeyError: - pass - - # Call the convert functions: - for option in self.options: - if option.converter and option.key in values: - value = env.subst('${%s}'%option.key) - try: - try: - env[option.key] = option.converter(value) - except TypeError: - env[option.key] = option.converter(value, env) - except ValueError, x: - raise SCons.Errors.UserError('Error converting option: %s\n%s'%(option.key, x)) - - - # Finally validate the values: - for option in self.options: - if option.validator and option.key in values: - option.validator(option.key, env.subst('${%s}'%option.key), env) - - def UnknownVariables(self): - """ - Returns any options in the specified arguments lists that - were not known, declared options in this object. - """ - return self.unknown - - def Save(self, filename, env): - """ - Saves all the options in the given file. This file can - then be used to load the options next run. This can be used - to create an option cache file. - - filename - Name of the file to save into - env - the environment get the option values from - """ - - # Create the file and write out the header - try: - fh = open(filename, 'w') - - try: - # Make an assignment in the file for each option - # within the environment that was assigned a value - # other than the default. - for option in self.options: - try: - value = env[option.key] - try: - prepare = value.prepare_to_store - except AttributeError: - try: - eval(repr(value)) - except KeyboardInterrupt: - raise - except: - # Convert stuff that has a repr() that - # cannot be evaluated into a string - value = SCons.Util.to_String(value) - else: - value = prepare() - - defaultVal = env.subst(SCons.Util.to_String(option.default)) - if option.converter: - defaultVal = option.converter(defaultVal) - - if str(env.subst('${%s}' % option.key)) != str(defaultVal): - fh.write('%s = %s\n' % (option.key, repr(value))) - except KeyError: - pass - finally: - fh.close() - - except IOError, x: - raise SCons.Errors.UserError('Error writing options to file: %s\n%s' % (filename, x)) - - def GenerateHelpText(self, env, sort=None): - """ - Generate the help text for the options. - - env - an environment that is used to get the current values - of the options. - """ - - if sort: - options = sorted(self.options, key=lambda x: x.key) - else: - options = self.options - - def format(opt, self=self, env=env): - if opt.key in env: - actual = env.subst('${%s}' % opt.key) - else: - actual = None - return self.FormatVariableHelpText(env, opt.key, opt.help, opt.default, actual, opt.aliases) - lines = [_f for _f in map(format, options) if _f] - - return ''.join(lines) - - format = '\n%s: %s\n default: %s\n actual: %s\n' - format_ = '\n%s: %s\n default: %s\n actual: %s\n aliases: %s\n' - - def FormatVariableHelpText(self, env, key, help, default, actual, aliases=[]): - # Don't display the key name itself as an alias. - aliases = [a for a in aliases if a != key] - if len(aliases)==0: - return self.format % (key, help, default, actual) - else: - return self.format_ % (key, help, default, actual, aliases) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Warnings.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Warnings.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/Warnings.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/Warnings.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,246 +0,0 @@ -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -"""SCons.Warnings - -This file implements the warnings framework for SCons. - -""" - -__revision__ = "src/engine/SCons/Warnings.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import sys - -import SCons.Errors - -class Warning(SCons.Errors.UserError): - pass - -class WarningOnByDefault(Warning): - pass - - -# NOTE: If you add a new warning class, add it to the man page, too! - -class CacheWriteErrorWarning(Warning): - pass - -class CorruptSConsignWarning(WarningOnByDefault): - pass - -class DependencyWarning(Warning): - pass - -class DuplicateEnvironmentWarning(WarningOnByDefault): - pass - -class FutureReservedVariableWarning(WarningOnByDefault): - pass - -class LinkWarning(WarningOnByDefault): - pass - -class MisleadingKeywordsWarning(WarningOnByDefault): - pass - -class MissingSConscriptWarning(WarningOnByDefault): - pass - -class NoMD5ModuleWarning(WarningOnByDefault): - pass - -class NoMetaclassSupportWarning(WarningOnByDefault): - pass - -class NoObjectCountWarning(WarningOnByDefault): - pass - -class NoParallelSupportWarning(WarningOnByDefault): - pass - -class ReservedVariableWarning(WarningOnByDefault): - pass - -class StackSizeWarning(WarningOnByDefault): - pass - -class VisualCMissingWarning(WarningOnByDefault): - pass - -# Used when MSVC_VERSION and MSVS_VERSION do not point to the -# same version (MSVS_VERSION is deprecated) -class VisualVersionMismatch(WarningOnByDefault): - pass - -class VisualStudioMissingWarning(Warning): - pass - -class FortranCxxMixWarning(LinkWarning): - pass - - -# Deprecation warnings - -class FutureDeprecatedWarning(Warning): - pass - -class DeprecatedWarning(Warning): - pass - -class MandatoryDeprecatedWarning(DeprecatedWarning): - pass - - -# Special case; base always stays DeprecatedWarning -class PythonVersionWarning(DeprecatedWarning): - pass - -class DeprecatedSourceCodeWarning(FutureDeprecatedWarning): - pass - -class DeprecatedBuildDirWarning(DeprecatedWarning): - pass - -class TaskmasterNeedsExecuteWarning(DeprecatedWarning): - pass - -class DeprecatedCopyWarning(MandatoryDeprecatedWarning): - pass - -class DeprecatedOptionsWarning(MandatoryDeprecatedWarning): - pass - -class DeprecatedSourceSignaturesWarning(MandatoryDeprecatedWarning): - pass - -class DeprecatedTargetSignaturesWarning(MandatoryDeprecatedWarning): - pass - -class DeprecatedDebugOptionsWarning(MandatoryDeprecatedWarning): - pass - -class DeprecatedSigModuleWarning(MandatoryDeprecatedWarning): - pass - -class DeprecatedBuilderKeywordsWarning(MandatoryDeprecatedWarning): - pass - - -# The below is a list of 2-tuples. The first element is a class object. -# The second element is true if that class is enabled, false if it is disabled. -_enabled = [] - -# If set, raise the warning as an exception -_warningAsException = 0 - -# If not None, a function to call with the warning -_warningOut = None - -def suppressWarningClass(clazz): - """Suppresses all warnings that are of type clazz or - derived from clazz.""" - _enabled.insert(0, (clazz, 0)) - -def enableWarningClass(clazz): - """Enables all warnings that are of type clazz or - derived from clazz.""" - _enabled.insert(0, (clazz, 1)) - -def warningAsException(flag=1): - """Turn warnings into exceptions. Returns the old value of the flag.""" - global _warningAsException - old = _warningAsException - _warningAsException = flag - return old - -def warn(clazz, *args): - global _enabled, _warningAsException, _warningOut - - warning = clazz(args) - for clazz, flag in _enabled: - if isinstance(warning, clazz): - if flag: - if _warningAsException: - raise warning - - if _warningOut: - _warningOut(warning) - break - -def process_warn_strings(arguments): - """Process string specifications of enabling/disabling warnings, - as passed to the --warn option or the SetOption('warn') function. - - - An argument to this option should be of the form - or no-. The warning class is munged in order - to get an actual class name from the classes above, which we - need to pass to the {enable,disable}WarningClass() functions. - The supplied is split on hyphens, each element - is capitalized, then smushed back together. Then the string - "Warning" is appended to get the class name. - - For example, 'deprecated' will enable the DeprecatedWarning - class. 'no-dependency' will disable the DependencyWarning class. - - As a special case, --warn=all and --warn=no-all will enable or - disable (respectively) the base Warning class of all warnings. - - """ - - def _capitalize(s): - if s[:5] == "scons": - return "SCons" + s[5:] - else: - return s.capitalize() - - for arg in arguments: - - elems = arg.lower().split('-') - enable = 1 - if elems[0] == 'no': - enable = 0 - del elems[0] - - if len(elems) == 1 and elems[0] == 'all': - class_name = "Warning" - else: - class_name = ''.join(map(_capitalize, elems)) + "Warning" - try: - clazz = globals()[class_name] - except KeyError: - sys.stderr.write("No warning type: '%s'\n" % arg) - else: - if enable: - enableWarningClass(clazz) - elif issubclass(clazz, MandatoryDeprecatedWarning): - fmt = "Can not disable mandataory warning: '%s'\n" - sys.stderr.write(fmt % arg) - else: - suppressWarningClass(clazz) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/__init__.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/__init__.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/__init__.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -"""SCons - -The main package for the SCons software construction utility. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/__init__.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -__version__ = "2.2.0" - -__build__ = "issue-2856:2676:d23b7a2f45e8[MODIFIED]" - -__buildsys__ = "oberbrunner-dev" - -__date__ = "2012/08/05 15:38:28" - -__developer__ = "garyo" - -# make sure compatibility is always in place -import SCons.compat - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/compat/__init__.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/compat/__init__.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/compat/__init__.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/compat/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,237 +0,0 @@ -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__doc__ = """ -SCons compatibility package for old Python versions - -This subpackage holds modules that provide backwards-compatible -implementations of various things that we'd like to use in SCons but which -only show up in later versions of Python than the early, old version(s) -we still support. - -Other code will not generally reference things in this package through -the SCons.compat namespace. The modules included here add things to -the builtins namespace or the global module list so that the rest -of our code can use the objects and names imported here regardless of -Python version. - -Simply enough, things that go in the builtins name space come from -our _scons_builtins module. - -The rest of the things here will be in individual compatibility modules -that are either: 1) suitably modified copies of the future modules that -we want to use; or 2) backwards compatible re-implementations of the -specific portions of a future module's API that we want to use. - -GENERAL WARNINGS: Implementations of functions in the SCons.compat -modules are *NOT* guaranteed to be fully compliant with these functions in -later versions of Python. We are only concerned with adding functionality -that we actually use in SCons, so be wary if you lift this code for -other uses. (That said, making these more nearly the same as later, -official versions is still a desirable goal, we just don't need to be -obsessive about it.) - -We name the compatibility modules with an initial '_scons_' (for example, -_scons_subprocess.py is our compatibility module for subprocess) so -that we can still try to import the real module name and fall back to -our compatibility module if we get an ImportError. The import_as() -function defined below loads the module as the "real" name (without the -'_scons'), after which all of the "import {module}" statements in the -rest of our code will find our pre-loaded compatibility module. -""" - -__revision__ = "src/engine/SCons/compat/__init__.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import os -import sys -import imp # Use the "imp" module to protect imports from fixers. - -def import_as(module, name): - """ - Imports the specified module (from our local directory) as the - specified name, returning the loaded module object. - """ - dir = os.path.split(__file__)[0] - return imp.load_module(name, *imp.find_module(module, [dir])) - -def rename_module(new, old): - """ - Attempts to import the old module and load it under the new name. - Used for purely cosmetic name changes in Python 3.x. - """ - try: - sys.modules[new] = imp.load_module(old, *imp.find_module(old)) - return True - except ImportError: - return False - - -rename_module('builtins', '__builtin__') -import _scons_builtins - - -try: - import hashlib -except ImportError: - # Pre-2.5 Python has no hashlib module. - try: - import_as('_scons_hashlib', 'hashlib') - except ImportError: - # If we failed importing our compatibility module, it probably - # means this version of Python has no md5 module. Don't do - # anything and let the higher layer discover this fact, so it - # can fall back to using timestamp. - pass - -try: - set -except NameError: - # Pre-2.4 Python has no native set type - import_as('_scons_sets', 'sets') - import builtins, sets - builtins.set = sets.Set - - -try: - import collections -except ImportError: - # Pre-2.4 Python has no collections module. - import_as('_scons_collections', 'collections') -else: - try: - collections.UserDict - except AttributeError: - exec('from UserDict import UserDict as _UserDict') - collections.UserDict = _UserDict - del _UserDict - try: - collections.UserList - except AttributeError: - exec('from UserList import UserList as _UserList') - collections.UserList = _UserList - del _UserList - try: - collections.UserString - except AttributeError: - exec('from UserString import UserString as _UserString') - collections.UserString = _UserString - del _UserString - - -try: - import io -except ImportError: - # Pre-2.6 Python has no io module. - import_as('_scons_io', 'io') - - -try: - os.devnull -except AttributeError: - # Pre-2.4 Python has no os.devnull attribute - _names = sys.builtin_module_names - if 'posix' in _names: - os.devnull = '/dev/null' - elif 'nt' in _names: - os.devnull = 'nul' - os.path.devnull = os.devnull -try: - os.path.lexists -except AttributeError: - # Pre-2.4 Python has no os.path.lexists function - def lexists(path): - return os.path.exists(path) or os.path.islink(path) - os.path.lexists = lexists - - -# When we're using the '-3' option during regression tests, importing -# cPickle gives a warning no matter how it's done, so always use the -# real profile module, whether it's fast or not. -if os.environ.get('SCONS_HORRIBLE_REGRESSION_TEST_HACK') is None: - # Not a regression test with '-3', so try to use faster version. - # In 3.x, 'pickle' automatically loads the fast version if available. - rename_module('pickle', 'cPickle') - - -# In 3.x, 'profile' automatically loads the fast version if available. -rename_module('profile', 'cProfile') - - -# Before Python 3.0, the 'queue' module was named 'Queue'. -rename_module('queue', 'Queue') - - -# Before Python 3.0, the 'winreg' module was named '_winreg' -rename_module('winreg', '_winreg') - - -try: - import subprocess -except ImportError: - # Pre-2.4 Python has no subprocess module. - import_as('_scons_subprocess', 'subprocess') - -try: - sys.intern -except AttributeError: - # Pre-2.6 Python has no sys.intern() function. - import builtins - try: - sys.intern = builtins.intern - except AttributeError: - # Pre-2.x Python has no builtin intern() function. - def intern(x): - return x - sys.intern = intern - del intern -try: - sys.maxsize -except AttributeError: - # Pre-2.6 Python has no sys.maxsize attribute - # Wrapping sys in () is silly, but protects it from 2to3 renames fixer - sys.maxsize = (sys).maxint - - -if os.environ.get('SCONS_HORRIBLE_REGRESSION_TEST_HACK') is not None: - # We can't apply the 'callable' fixer until the floor is 2.6, but the - # '-3' option to Python 2.6 and 2.7 generates almost ten thousand - # warnings. This hack allows us to run regression tests with the '-3' - # option by replacing the callable() built-in function with a hack - # that performs the same function but doesn't generate the warning. - # Note that this hack is ONLY intended to be used for regression - # testing, and should NEVER be used for real runs. - from types import ClassType - def callable(obj): - if hasattr(obj, '__call__'): return True - if isinstance(obj, (ClassType, type)): return True - return False - import builtins - builtins.callable = callable - del callable - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/compat/_scons_builtins.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/compat/_scons_builtins.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/compat/_scons_builtins.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/compat/_scons_builtins.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,150 +0,0 @@ -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -# Portions of the following are derived from the compat.py file in -# Twisted, under the following copyright: -# -# Copyright (c) 2001-2004 Twisted Matrix Laboratories - -__doc__ = """ -Compatibility idioms for builtins names - -This module adds names to the builtins module for things that we want -to use in SCons but which don't show up until later Python versions than -the earliest ones we support. - -This module checks for the following builtins names: - - all() - any() - sorted() - memoryview() - -Implementations of functions are *NOT* guaranteed to be fully compliant -with these functions in later versions of Python. We are only concerned -with adding functionality that we actually use in SCons, so be wary -if you lift this code for other uses. (That said, making these more -nearly the same as later, official versions is still a desirable goal, -we just don't need to be obsessive about it.) - -If you're looking at this with pydoc and various names don't show up in -the FUNCTIONS or DATA output, that means those names are already built in -to this version of Python and we don't need to add them from this module. -""" - -__revision__ = "src/engine/SCons/compat/_scons_builtins.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import builtins - -try: - all -except NameError: - # Pre-2.5 Python has no all() function. - def all(iterable): - """ - Returns True if all elements of the iterable are true. - """ - for element in iterable: - if not element: - return False - return True - builtins.all = all - all = all - -try: - any -except NameError: - # Pre-2.5 Python has no any() function. - def any(iterable): - """ - Returns True if any element of the iterable is true. - """ - for element in iterable: - if element: - return True - return False - builtins.any = any - any = any - -try: - memoryview -except NameError: - # Pre-2.7 doesn't have the memoryview() built-in. - class memoryview(object): - def __init__(self, obj): - # wrapping buffer in () keeps the fixer from changing it - self.obj = (buffer)(obj) - def __getitem__(self, indx): - if isinstance(indx, slice): - return self.obj[indx.start:indx.stop] - else: - return self.obj[indx] - builtins.memoryview = memoryview - -try: - sorted -except NameError: - # Pre-2.4 Python has no sorted() function. - # - # The pre-2.4 Python list.sort() method does not support - # list.sort(key=) nor list.sort(reverse=) keyword arguments, so - # we must implement the functionality of those keyword arguments - # by hand instead of passing them to list.sort(). - def sorted(iterable, cmp=None, key=None, reverse=False): - if key is not None: - result = [(key(x), x) for x in iterable] - else: - result = iterable[:] - if cmp is None: - # Pre-2.3 Python does not support list.sort(None). - result.sort() - else: - result.sort(cmp) - if key is not None: - result = [t1 for t0,t1 in result] - if reverse: - result.reverse() - return result - builtins.sorted = sorted - -#if sys.version_info[:3] in ((2, 2, 0), (2, 2, 1)): -# def lstrip(s, c=string.whitespace): -# while s and s[0] in c: -# s = s[1:] -# return s -# def rstrip(s, c=string.whitespace): -# while s and s[-1] in c: -# s = s[:-1] -# return s -# def strip(s, c=string.whitespace, l=lstrip, r=rstrip): -# return l(r(s, c), c) -# -# object.__setattr__(str, 'lstrip', lstrip) -# object.__setattr__(str, 'rstrip', rstrip) -# object.__setattr__(str, 'strip', strip) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/compat/_scons_collections.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/compat/_scons_collections.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/compat/_scons_collections.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/compat/_scons_collections.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__doc__ = """ -collections compatibility module for older (pre-2.4) Python versions - -This does not not NOT (repeat, *NOT*) provide complete collections -functionality. It only wraps the portions of collections functionality -used by SCons, in an interface that looks enough like collections for -our purposes. -""" - -__revision__ = "src/engine/SCons/compat/_scons_collections.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -# Use exec to hide old names from fixers. -exec("""if True: - from UserDict import UserDict - from UserList import UserList - from UserString import UserString""") - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/compat/_scons_dbm.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/compat/_scons_dbm.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/compat/_scons_dbm.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/compat/_scons_dbm.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__doc__ = """ -dbm compatibility module for Python versions that don't have dbm. - -This does not not NOT (repeat, *NOT*) provide complete dbm functionality. -It's just a stub on which to hang just enough pieces of dbm functionality -that the whichdb.whichdb() implementstation in the various 2.X versions of -Python won't blow up even if dbm wasn't compiled in. -""" - -__revision__ = "src/engine/SCons/compat/_scons_dbm.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -class error(Exception): - pass - -def open(*args, **kw): - raise error() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/compat/_scons_hashlib.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/compat/_scons_hashlib.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/compat/_scons_hashlib.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/compat/_scons_hashlib.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__doc__ = """ -hashlib backwards-compatibility module for older (pre-2.5) Python versions - -This does not not NOT (repeat, *NOT*) provide complete hashlib -functionality. It only wraps the portions of MD5 functionality used -by SCons, in an interface that looks like hashlib (or enough for our -purposes, anyway). In fact, this module will raise an ImportError if -the underlying md5 module isn't available. -""" - -__revision__ = "src/engine/SCons/compat/_scons_hashlib.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -import md5 -from string import hexdigits - -class md5obj(object): - - md5_module = md5 - - def __init__(self, name, string=''): - if not name in ('MD5', 'md5'): - raise ValueError("unsupported hash type") - self.name = 'md5' - self.m = self.md5_module.md5() - - def __repr__(self): - return '<%s HASH object @ %#x>' % (self.name, id(self)) - - def copy(self): - import copy - result = copy.copy(self) - result.m = self.m.copy() - return result - - def digest(self): - return self.m.digest() - - def update(self, arg): - return self.m.update(arg) - - def hexdigest(self): - return self.m.hexdigest() - -new = md5obj - -def md5(string=''): - return md5obj('md5', string) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/compat/_scons_io.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/compat/_scons_io.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/compat/_scons_io.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/compat/_scons_io.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__doc__ = """ -io compatibility module for older (pre-2.6) Python versions - -This does not not NOT (repeat, *NOT*) provide complete io -functionality. It only wraps the portions of io functionality used -by SCons, in an interface that looks enough like io for our purposes. -""" - -__revision__ = "src/engine/SCons/compat/_scons_io.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -# Use the "imp" module to protect the imports below from fixers. -import imp - -_cStringIO = imp.load_module('cStringIO', *imp.find_module('cStringIO')) -StringIO = _cStringIO.StringIO -del _cStringIO - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/compat/_scons_sets.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/compat/_scons_sets.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/compat/_scons_sets.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/compat/_scons_sets.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,563 +0,0 @@ -"""Classes to represent arbitrary sets (including sets of sets). - -This module implements sets using dictionaries whose values are -ignored. The usual operations (union, intersection, deletion, etc.) -are provided as both methods and operators. - -Important: sets are not sequences! While they support 'x in s', -'len(s)', and 'for x in s', none of those operations are unique for -sequences; for example, mappings support all three as well. The -characteristic operation for sequences is subscripting with small -integers: s[i], for i in range(len(s)). Sets don't support -subscripting at all. Also, sequences allow multiple occurrences and -their elements have a definite order; sets on the other hand don't -record multiple occurrences and don't remember the order of element -insertion (which is why they don't support s[i]). - -The following classes are provided: - -BaseSet -- All the operations common to both mutable and immutable - sets. This is an abstract class, not meant to be directly - instantiated. - -Set -- Mutable sets, subclass of BaseSet; not hashable. - -ImmutableSet -- Immutable sets, subclass of BaseSet; hashable. - An iterable argument is mandatory to create an ImmutableSet. - -_TemporarilyImmutableSet -- A wrapper around a Set, hashable, - giving the same hash value as the immutable set equivalent - would have. Do not use this class directly. - -Only hashable objects can be added to a Set. In particular, you cannot -really add a Set as an element to another Set; if you try, what is -actually added is an ImmutableSet built from it (it compares equal to -the one you tried adding). - -When you ask if `x in y' where x is a Set and y is a Set or -ImmutableSet, x is wrapped into a _TemporarilyImmutableSet z, and -what's tested is actually `z in y'. - -""" - -# Code history: -# -# - Greg V. Wilson wrote the first version, using a different approach -# to the mutable/immutable problem, and inheriting from dict. -# -# - Alex Martelli modified Greg's version to implement the current -# Set/ImmutableSet approach, and make the data an attribute. -# -# - Guido van Rossum rewrote much of the code, made some API changes, -# and cleaned up the docstrings. -# -# - Raymond Hettinger added a number of speedups and other -# improvements. - -# protect this import from the fixers... -exec('from itertools import ifilterfalse as filterfalse') - -__all__ = ['BaseSet', 'Set', 'ImmutableSet'] - -class BaseSet(object): - """Common base class for mutable and immutable sets.""" - - __slots__ = ['_data'] - - # Constructor - - def __init__(self): - """This is an abstract class.""" - # Don't call this from a concrete subclass! - if self.__class__ is BaseSet: - raise TypeError("BaseSet is an abstract class. " - "Use Set or ImmutableSet.") - - # Standard protocols: __len__, __repr__, __str__, __iter__ - - def __len__(self): - """Return the number of elements of a set.""" - return len(self._data) - - def __repr__(self): - """Return string representation of a set. - - This looks like 'Set([])'. - """ - return self._repr() - - # __str__ is the same as __repr__ - __str__ = __repr__ - - def _repr(self, sort_them=False): - elements = list(self._data.keys()) - if sort_them: - elements.sort() - return '%s(%r)' % (self.__class__.__name__, elements) - - def __iter__(self): - """Return an iterator over the elements or a set. - - This is the keys iterator for the underlying dict. - """ - # Wrapping name in () prevents fixer from "fixing" this - return (self._data.iterkeys)() - - # Three-way comparison is not supported. However, because __eq__ is - # tried before __cmp__, if Set x == Set y, x.__eq__(y) returns True and - # then cmp(x, y) returns 0 (Python doesn't actually call __cmp__ in this - # case). - - def __cmp__(self, other): - raise TypeError("can't compare sets using cmp()") - - # Equality comparisons using the underlying dicts. Mixed-type comparisons - # are allowed here, where Set == z for non-Set z always returns False, - # and Set != z always True. This allows expressions like "x in y" to - # give the expected result when y is a sequence of mixed types, not - # raising a pointless TypeError just because y contains a Set, or x is - # a Set and y contain's a non-set ("in" invokes only __eq__). - # Subtle: it would be nicer if __eq__ and __ne__ could return - # NotImplemented instead of True or False. Then the other comparand - # would get a chance to determine the result, and if the other comparand - # also returned NotImplemented then it would fall back to object address - # comparison (which would always return False for __eq__ and always - # True for __ne__). However, that doesn't work, because this type - # *also* implements __cmp__: if, e.g., __eq__ returns NotImplemented, - # Python tries __cmp__ next, and the __cmp__ here then raises TypeError. - - def __eq__(self, other): - if isinstance(other, BaseSet): - return self._data == other._data - else: - return False - - def __ne__(self, other): - if isinstance(other, BaseSet): - return self._data != other._data - else: - return True - - # Copying operations - - def copy(self): - """Return a shallow copy of a set.""" - result = self.__class__() - result._data.update(self._data) - return result - - __copy__ = copy # For the copy module - - def __deepcopy__(self, memo): - """Return a deep copy of a set; used by copy module.""" - # This pre-creates the result and inserts it in the memo - # early, in case the deep copy recurses into another reference - # to this same set. A set can't be an element of itself, but - # it can certainly contain an object that has a reference to - # itself. - from copy import deepcopy - result = self.__class__() - memo[id(self)] = result - data = result._data - value = True - for elt in self: - data[deepcopy(elt, memo)] = value - return result - - # Standard set operations: union, intersection, both differences. - # Each has an operator version (e.g. __or__, invoked with |) and a - # method version (e.g. union). - # Subtle: Each pair requires distinct code so that the outcome is - # correct when the type of other isn't suitable. For example, if - # we did "union = __or__" instead, then Set().union(3) would return - # NotImplemented instead of raising TypeError (albeit that *why* it - # raises TypeError as-is is also a bit subtle). - - def __or__(self, other): - """Return the union of two sets as a new set. - - (I.e. all elements that are in either set.) - """ - if not isinstance(other, BaseSet): - return NotImplemented - return self.union(other) - - def union(self, other): - """Return the union of two sets as a new set. - - (I.e. all elements that are in either set.) - """ - result = self.__class__(self) - result._update(other) - return result - - def __and__(self, other): - """Return the intersection of two sets as a new set. - - (I.e. all elements that are in both sets.) - """ - if not isinstance(other, BaseSet): - return NotImplemented - return self.intersection(other) - - def intersection(self, other): - """Return the intersection of two sets as a new set. - - (I.e. all elements that are in both sets.) - """ - if not isinstance(other, BaseSet): - other = Set(other) - if len(self) <= len(other): - little, big = self, other - else: - little, big = other, self - common = iter(filter(big._data.has_key, little)) - return self.__class__(common) - - def __xor__(self, other): - """Return the symmetric difference of two sets as a new set. - - (I.e. all elements that are in exactly one of the sets.) - """ - if not isinstance(other, BaseSet): - return NotImplemented - return self.symmetric_difference(other) - - def symmetric_difference(self, other): - """Return the symmetric difference of two sets as a new set. - - (I.e. all elements that are in exactly one of the sets.) - """ - result = self.__class__() - data = result._data - value = True - selfdata = self._data - try: - otherdata = other._data - except AttributeError: - otherdata = Set(other)._data - for elt in filterfalse(otherdata.has_key, selfdata): - data[elt] = value - for elt in filterfalse(selfdata.has_key, otherdata): - data[elt] = value - return result - - def __sub__(self, other): - """Return the difference of two sets as a new Set. - - (I.e. all elements that are in this set and not in the other.) - """ - if not isinstance(other, BaseSet): - return NotImplemented - return self.difference(other) - - def difference(self, other): - """Return the difference of two sets as a new Set. - - (I.e. all elements that are in this set and not in the other.) - """ - result = self.__class__() - data = result._data - try: - otherdata = other._data - except AttributeError: - otherdata = Set(other)._data - value = True - for elt in filterfalse(otherdata.has_key, self): - data[elt] = value - return result - - # Membership test - - def __contains__(self, element): - """Report whether an element is a member of a set. - - (Called in response to the expression `element in self'.) - """ - try: - return element in self._data - except TypeError: - transform = getattr(element, "__as_temporarily_immutable__", None) - if transform is None: - raise # re-raise the TypeError exception we caught - return transform() in self._data - - # Subset and superset test - - def issubset(self, other): - """Report whether another set contains this set.""" - self._binary_sanity_check(other) - if len(self) > len(other): # Fast check for obvious cases - return False - for elt in filterfalse(other._data.has_key, self): - return False - return True - - def issuperset(self, other): - """Report whether this set contains another set.""" - self._binary_sanity_check(other) - if len(self) < len(other): # Fast check for obvious cases - return False - for elt in filterfalse(self._data.has_key, other): - return False - return True - - # Inequality comparisons using the is-subset relation. - __le__ = issubset - __ge__ = issuperset - - def __lt__(self, other): - self._binary_sanity_check(other) - return len(self) < len(other) and self.issubset(other) - - def __gt__(self, other): - self._binary_sanity_check(other) - return len(self) > len(other) and self.issuperset(other) - - # Assorted helpers - - def _binary_sanity_check(self, other): - # Check that the other argument to a binary operation is also - # a set, raising a TypeError otherwise. - if not isinstance(other, BaseSet): - raise TypeError("Binary operation only permitted between sets") - - def _compute_hash(self): - # Calculate hash code for a set by xor'ing the hash codes of - # the elements. This ensures that the hash code does not depend - # on the order in which elements are added to the set. This is - # not called __hash__ because a BaseSet should not be hashable; - # only an ImmutableSet is hashable. - result = 0 - for elt in self: - result ^= hash(elt) - return result - - def _update(self, iterable): - # The main loop for update() and the subclass __init__() methods. - data = self._data - - # Use the fast update() method when a dictionary is available. - if isinstance(iterable, BaseSet): - data.update(iterable._data) - return - - value = True - - if type(iterable) in (list, tuple, xrange): - # Optimized: we know that __iter__() and next() can't - # raise TypeError, so we can move 'try:' out of the loop. - it = iter(iterable) - while True: - try: - for element in it: - data[element] = value - return - except TypeError: - transform = getattr(element, "__as_immutable__", None) - if transform is None: - raise # re-raise the TypeError exception we caught - data[transform()] = value - else: - # Safe: only catch TypeError where intended - for element in iterable: - try: - data[element] = value - except TypeError: - transform = getattr(element, "__as_immutable__", None) - if transform is None: - raise # re-raise the TypeError exception we caught - data[transform()] = value - - -class ImmutableSet(BaseSet): - """Immutable set class.""" - - __slots__ = ['_hashcode'] - - # BaseSet + hashing - - def __init__(self, iterable=None): - """Construct an immutable set from an optional iterable.""" - self._hashcode = None - self._data = {} - if iterable is not None: - self._update(iterable) - - def __hash__(self): - if self._hashcode is None: - self._hashcode = self._compute_hash() - return self._hashcode - - def __getstate__(self): - return self._data, self._hashcode - - def __setstate__(self, state): - self._data, self._hashcode = state - -class Set(BaseSet): - """ Mutable set class.""" - - __slots__ = [] - - # BaseSet + operations requiring mutability; no hashing - - def __init__(self, iterable=None): - """Construct a set from an optional iterable.""" - self._data = {} - if iterable is not None: - self._update(iterable) - - def __getstate__(self): - # getstate's results are ignored if it is not - return self._data, - - def __setstate__(self, data): - self._data, = data - - def __hash__(self): - """A Set cannot be hashed.""" - # We inherit object.__hash__, so we must deny this explicitly - raise TypeError("Can't hash a Set, only an ImmutableSet.") - - # In-place union, intersection, differences. - # Subtle: The xyz_update() functions deliberately return None, - # as do all mutating operations on built-in container types. - # The __xyz__ spellings have to return self, though. - - def __ior__(self, other): - """Update a set with the union of itself and another.""" - self._binary_sanity_check(other) - self._data.update(other._data) - return self - - def union_update(self, other): - """Update a set with the union of itself and another.""" - self._update(other) - - def __iand__(self, other): - """Update a set with the intersection of itself and another.""" - self._binary_sanity_check(other) - self._data = (self & other)._data - return self - - def intersection_update(self, other): - """Update a set with the intersection of itself and another.""" - if isinstance(other, BaseSet): - self &= other - else: - self._data = (self.intersection(other))._data - - def __ixor__(self, other): - """Update a set with the symmetric difference of itself and another.""" - self._binary_sanity_check(other) - self.symmetric_difference_update(other) - return self - - def symmetric_difference_update(self, other): - """Update a set with the symmetric difference of itself and another.""" - data = self._data - value = True - if not isinstance(other, BaseSet): - other = Set(other) - if self is other: - self.clear() - for elt in other: - if elt in data: - del data[elt] - else: - data[elt] = value - - def __isub__(self, other): - """Remove all elements of another set from this set.""" - self._binary_sanity_check(other) - self.difference_update(other) - return self - - def difference_update(self, other): - """Remove all elements of another set from this set.""" - data = self._data - if not isinstance(other, BaseSet): - other = Set(other) - if self is other: - self.clear() - for elt in filter(data.has_key, other): - del data[elt] - - # Python dict-like mass mutations: update, clear - - def update(self, iterable): - """Add all values from an iterable (such as a list or file).""" - self._update(iterable) - - def clear(self): - """Remove all elements from this set.""" - self._data.clear() - - # Single-element mutations: add, remove, discard - - def add(self, element): - """Add an element to a set. - - This has no effect if the element is already present. - """ - try: - self._data[element] = True - except TypeError: - transform = getattr(element, "__as_immutable__", None) - if transform is None: - raise # re-raise the TypeError exception we caught - self._data[transform()] = True - - def remove(self, element): - """Remove an element from a set; it must be a member. - - If the element is not a member, raise a KeyError. - """ - try: - del self._data[element] - except TypeError: - transform = getattr(element, "__as_temporarily_immutable__", None) - if transform is None: - raise # re-raise the TypeError exception we caught - del self._data[transform()] - - def discard(self, element): - """Remove an element from a set if it is a member. - - If the element is not a member, do nothing. - """ - try: - self.remove(element) - except KeyError: - pass - - def pop(self): - """Remove and return an arbitrary set element.""" - return self._data.popitem()[0] - - def __as_immutable__(self): - # Return a copy of self as an immutable set - return ImmutableSet(self) - - def __as_temporarily_immutable__(self): - # Return self wrapped in a temporarily immutable set - return _TemporarilyImmutableSet(self) - - -class _TemporarilyImmutableSet(BaseSet): - # Wrap a mutable set as if it was temporarily immutable. - # This only supplies hashing and equality comparisons. - - def __init__(self, set): - self._set = set - self._data = set._data # Needed by ImmutableSet.__eq__() - - def __hash__(self): - return self._set._compute_hash() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/compat/_scons_subprocess.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/compat/_scons_subprocess.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/compat/_scons_subprocess.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/compat/_scons_subprocess.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,1281 +0,0 @@ -# subprocess - Subprocesses with accessible I/O streams -# -# For more information about this module, see PEP 324. -# -# This module should remain compatible with Python 2.2, see PEP 291. -# -# Copyright (c) 2003-2005 by Peter Astrand -# -# Licensed to PSF under a Contributor Agreement. -# See http://www.python.org/2.4/license for licensing details. - -r"""subprocess - Subprocesses with accessible I/O streams - -This module allows you to spawn processes, connect to their -input/output/error pipes, and obtain their return codes. This module -intends to replace several other, older modules and functions, like: - -os.system -os.spawn* -os.popen* -popen2.* -commands.* - -Information about how the subprocess module can be used to replace these -modules and functions can be found below. - - - -Using the subprocess module -=========================== -This module defines one class called Popen: - -class Popen(args, bufsize=0, executable=None, - stdin=None, stdout=None, stderr=None, - preexec_fn=None, close_fds=False, shell=False, - cwd=None, env=None, universal_newlines=False, - startupinfo=None, creationflags=0): - - -Arguments are: - -args should be a string, or a sequence of program arguments. The -program to execute is normally the first item in the args sequence or -string, but can be explicitly set by using the executable argument. - -On UNIX, with shell=False (default): In this case, the Popen class -uses os.execvp() to execute the child program. args should normally -be a sequence. A string will be treated as a sequence with the string -as the only item (the program to execute). - -On UNIX, with shell=True: If args is a string, it specifies the -command string to execute through the shell. If args is a sequence, -the first item specifies the command string, and any additional items -will be treated as additional shell arguments. - -On Windows: the Popen class uses CreateProcess() to execute the child -program, which operates on strings. If args is a sequence, it will be -converted to a string using the list2cmdline method. Please note that -not all MS Windows applications interpret the command line the same -way: The list2cmdline is designed for applications using the same -rules as the MS C runtime. - -bufsize, if given, has the same meaning as the corresponding argument -to the built-in open() function: 0 means unbuffered, 1 means line -buffered, any other positive value means use a buffer of -(approximately) that size. A negative bufsize means to use the system -default, which usually means fully buffered. The default value for -bufsize is 0 (unbuffered). - -stdin, stdout and stderr specify the executed programs' standard -input, standard output and standard error file handles, respectively. -Valid values are PIPE, an existing file descriptor (a positive -integer), an existing file object, and None. PIPE indicates that a -new pipe to the child should be created. With None, no redirection -will occur; the child's file handles will be inherited from the -parent. Additionally, stderr can be STDOUT, which indicates that the -stderr data from the applications should be captured into the same -file handle as for stdout. - -If preexec_fn is set to a callable object, this object will be called -in the child process just before the child is executed. - -If close_fds is true, all file descriptors except 0, 1 and 2 will be -closed before the child process is executed. - -if shell is true, the specified command will be executed through the -shell. - -If cwd is not None, the current directory will be changed to cwd -before the child is executed. - -If env is not None, it defines the environment variables for the new -process. - -If universal_newlines is true, the file objects stdout and stderr are -opened as a text files, but lines may be terminated by any of '\n', -the Unix end-of-line convention, '\r', the Macintosh convention or -'\r\n', the Windows convention. All of these external representations -are seen as '\n' by the Python program. Note: This feature is only -available if Python is built with universal newline support (the -default). Also, the newlines attribute of the file objects stdout, -stdin and stderr are not updated by the communicate() method. - -The startupinfo and creationflags, if given, will be passed to the -underlying CreateProcess() function. They can specify things such as -appearance of the main window and priority for the new process. -(Windows only) - - -This module also defines two shortcut functions: - -call(*popenargs, **kwargs): - Run command with arguments. Wait for command to complete, then - return the returncode attribute. - - The arguments are the same as for the Popen constructor. Example: - - retcode = call(["ls", "-l"]) - -check_call(*popenargs, **kwargs): - Run command with arguments. Wait for command to complete. If the - exit code was zero then return, otherwise raise - CalledProcessError. The CalledProcessError object will have the - return code in the returncode attribute. - - The arguments are the same as for the Popen constructor. Example: - - check_call(["ls", "-l"]) - -Exceptions ----------- -Exceptions raised in the child process, before the new program has -started to execute, will be re-raised in the parent. Additionally, -the exception object will have one extra attribute called -'child_traceback', which is a string containing traceback information -from the childs point of view. - -The most common exception raised is OSError. This occurs, for -example, when trying to execute a non-existent file. Applications -should prepare for OSErrors. - -A ValueError will be raised if Popen is called with invalid arguments. - -check_call() will raise CalledProcessError, if the called process -returns a non-zero return code. - - -Security --------- -Unlike some other popen functions, this implementation will never call -/bin/sh implicitly. This means that all characters, including shell -metacharacters, can safely be passed to child processes. - - -Popen objects -============= -Instances of the Popen class have the following methods: - -poll() - Check if child process has terminated. Returns returncode - attribute. - -wait() - Wait for child process to terminate. Returns returncode attribute. - -communicate(input=None) - Interact with process: Send data to stdin. Read data from stdout - and stderr, until end-of-file is reached. Wait for process to - terminate. The optional stdin argument should be a string to be - sent to the child process, or None, if no data should be sent to - the child. - - communicate() returns a tuple (stdout, stderr). - - Note: The data read is buffered in memory, so do not use this - method if the data size is large or unlimited. - -The following attributes are also available: - -stdin - If the stdin argument is PIPE, this attribute is a file object - that provides input to the child process. Otherwise, it is None. - -stdout - If the stdout argument is PIPE, this attribute is a file object - that provides output from the child process. Otherwise, it is - None. - -stderr - If the stderr argument is PIPE, this attribute is file object that - provides error output from the child process. Otherwise, it is - None. - -pid - The process ID of the child process. - -returncode - The child return code. A None value indicates that the process - hasn't terminated yet. A negative value -N indicates that the - child was terminated by signal N (UNIX only). - - -Replacing older functions with the subprocess module -==================================================== -In this section, "a ==> b" means that b can be used as a replacement -for a. - -Note: All functions in this section fail (more or less) silently if -the executed program cannot be found; this module raises an OSError -exception. - -In the following examples, we assume that the subprocess module is -imported with "from subprocess import *". - - -Replacing /bin/sh shell backquote ---------------------------------- -output=`mycmd myarg` -==> -output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0] - - -Replacing shell pipe line -------------------------- -output=`dmesg | grep hda` -==> -p1 = Popen(["dmesg"], stdout=PIPE) -p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE) -output = p2.communicate()[0] - - -Replacing os.system() ---------------------- -sts = os.system("mycmd" + " myarg") -==> -p = Popen("mycmd" + " myarg", shell=True) -pid, sts = os.waitpid(p.pid, 0) - -Note: - -* Calling the program through the shell is usually not required. - -* It's easier to look at the returncode attribute than the - exitstatus. - -A more real-world example would look like this: - -try: - retcode = call("mycmd" + " myarg", shell=True) - if retcode < 0: - print >>sys.stderr, "Child was terminated by signal", -retcode - else: - print >>sys.stderr, "Child returned", retcode -except OSError, e: - print >>sys.stderr, "Execution failed:", e - - -Replacing os.spawn* -------------------- -P_NOWAIT example: - -pid = os.spawnlp(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg") -==> -pid = Popen(["/bin/mycmd", "myarg"]).pid - - -P_WAIT example: - -retcode = os.spawnlp(os.P_WAIT, "/bin/mycmd", "mycmd", "myarg") -==> -retcode = call(["/bin/mycmd", "myarg"]) - - -Vector example: - -os.spawnvp(os.P_NOWAIT, path, args) -==> -Popen([path] + args[1:]) - - -Environment example: - -os.spawnlpe(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg", env) -==> -Popen(["/bin/mycmd", "myarg"], env={"PATH": "/usr/bin"}) - - -Replacing os.popen* -------------------- -pipe = os.popen(cmd, mode='r', bufsize) -==> -pipe = Popen(cmd, shell=True, bufsize=bufsize, stdout=PIPE).stdout - -pipe = os.popen(cmd, mode='w', bufsize) -==> -pipe = Popen(cmd, shell=True, bufsize=bufsize, stdin=PIPE).stdin - - -(child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize) -==> -p = Popen(cmd, shell=True, bufsize=bufsize, - stdin=PIPE, stdout=PIPE, close_fds=True) -(child_stdin, child_stdout) = (p.stdin, p.stdout) - - -(child_stdin, - child_stdout, - child_stderr) = os.popen3(cmd, mode, bufsize) -==> -p = Popen(cmd, shell=True, bufsize=bufsize, - stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) -(child_stdin, - child_stdout, - child_stderr) = (p.stdin, p.stdout, p.stderr) - - -(child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize) -==> -p = Popen(cmd, shell=True, bufsize=bufsize, - stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) -(child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout) - - -Replacing popen2.* ------------------- -Note: If the cmd argument to popen2 functions is a string, the command -is executed through /bin/sh. If it is a list, the command is directly -executed. - -(child_stdout, child_stdin) = popen2.popen2("somestring", bufsize, mode) -==> -p = Popen(["somestring"], shell=True, bufsize=bufsize - stdin=PIPE, stdout=PIPE, close_fds=True) -(child_stdout, child_stdin) = (p.stdout, p.stdin) - - -(child_stdout, child_stdin) = popen2.popen2(["mycmd", "myarg"], bufsize, mode) -==> -p = Popen(["mycmd", "myarg"], bufsize=bufsize, - stdin=PIPE, stdout=PIPE, close_fds=True) -(child_stdout, child_stdin) = (p.stdout, p.stdin) - -The popen2.Popen3 and popen3.Popen4 basically works as subprocess.Popen, -except that: - -* subprocess.Popen raises an exception if the execution fails -* the capturestderr argument is replaced with the stderr argument. -* stdin=PIPE and stdout=PIPE must be specified. -* popen2 closes all filedescriptors by default, but you have to specify - close_fds=True with subprocess.Popen. - - -""" - -import sys -mswindows = (sys.platform == "win32") - -import os -import types -import traceback - -# Exception classes used by this module. -class CalledProcessError(Exception): - """This exception is raised when a process run by check_call() returns - a non-zero exit status. The exit status will be stored in the - returncode attribute.""" - def __init__(self, returncode, cmd): - self.returncode = returncode - self.cmd = cmd - def __str__(self): - return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode) - - -if mswindows: - try: - import threading - except ImportError: - # SCons: the threading module is only used by the communicate() - # method, which we don't actually use, so don't worry if we - # can't import it. - pass - import msvcrt - try: - # Try to get _subprocess - from _subprocess import * - class STARTUPINFO(object): - dwFlags = 0 - hStdInput = None - hStdOutput = None - hStdError = None - wShowWindow = 0 - class pywintypes(object): - error = IOError - except ImportError: - # If not there, then drop back to requiring pywin32 - # TODO: Should this be wrapped in try as well? To notify user to install - # pywin32 ? With URL to it? - import pywintypes - from win32api import GetStdHandle, STD_INPUT_HANDLE, \ - STD_OUTPUT_HANDLE, STD_ERROR_HANDLE - from win32api import GetCurrentProcess, DuplicateHandle, \ - GetModuleFileName, GetVersion - from win32con import DUPLICATE_SAME_ACCESS, SW_HIDE - from win32pipe import CreatePipe - from win32process import CreateProcess, STARTUPINFO, \ - GetExitCodeProcess, STARTF_USESTDHANDLES, \ - STARTF_USESHOWWINDOW, CREATE_NEW_CONSOLE - from win32event import WaitForSingleObject, INFINITE, WAIT_OBJECT_0 - - -else: - import select - import errno - import fcntl - import pickle - - try: - fcntl.F_GETFD - except AttributeError: - fcntl.F_GETFD = 1 - - try: - fcntl.F_SETFD - except AttributeError: - fcntl.F_SETFD = 2 - -__all__ = ["Popen", "PIPE", "STDOUT", "call", "check_call", "CalledProcessError"] - -try: - MAXFD = os.sysconf("SC_OPEN_MAX") -except KeyboardInterrupt: - raise # SCons: don't swallow keyboard interrupts -except: - MAXFD = 256 - -try: - isinstance(1, int) -except TypeError: - def is_int(obj): - return isinstance(obj, type(1)) - def is_int_or_long(obj): - return type(obj) in (type(1), type(1L)) -else: - def is_int(obj): - return isinstance(obj, int) - def is_int_or_long(obj): - return isinstance(obj, (int, long)) - -try: - types.StringTypes -except AttributeError: - try: - types.StringTypes = (str, unicode) - except NameError: - types.StringTypes = (str,) -def is_string(obj): - return isinstance(obj, types.StringTypes) - -_active = [] - -def _cleanup(): - for inst in _active[:]: - if inst.poll(_deadstate=sys.maxsize) >= 0: - try: - _active.remove(inst) - except ValueError: - # This can happen if two threads create a new Popen instance. - # It's harmless that it was already removed, so ignore. - pass - -PIPE = -1 -STDOUT = -2 - - -def call(*popenargs, **kwargs): - """Run command with arguments. Wait for command to complete, then - return the returncode attribute. - - The arguments are the same as for the Popen constructor. Example: - - retcode = call(["ls", "-l"]) - """ - return apply(Popen, popenargs, kwargs).wait() - - -def check_call(*popenargs, **kwargs): - """Run command with arguments. Wait for command to complete. If - the exit code was zero then return, otherwise raise - CalledProcessError. The CalledProcessError object will have the - return code in the returncode attribute. - - The arguments are the same as for the Popen constructor. Example: - - check_call(["ls", "-l"]) - """ - retcode = call(*popenargs, **kwargs) - cmd = kwargs.get("args") - if cmd is None: - cmd = popenargs[0] - if retcode: - raise CalledProcessError(retcode, cmd) - return retcode - - -def list2cmdline(seq): - """ - Translate a sequence of arguments into a command line - string, using the same rules as the MS C runtime: - - 1) Arguments are delimited by white space, which is either a - space or a tab. - - 2) A string surrounded by double quotation marks is - interpreted as a single argument, regardless of white space - contained within. A quoted string can be embedded in an - argument. - - 3) A double quotation mark preceded by a backslash is - interpreted as a literal double quotation mark. - - 4) Backslashes are interpreted literally, unless they - immediately precede a double quotation mark. - - 5) If backslashes immediately precede a double quotation mark, - every pair of backslashes is interpreted as a literal - backslash. If the number of backslashes is odd, the last - backslash escapes the next double quotation mark as - described in rule 3. - """ - - # See - # http://msdn.microsoft.com/library/en-us/vccelng/htm/progs_12.asp - result = [] - needquote = False - for arg in seq: - bs_buf = [] - - # Add a space to separate this argument from the others - if result: - result.append(' ') - - needquote = (" " in arg) or ("\t" in arg) - if needquote: - result.append('"') - - for c in arg: - if c == '\\': - # Don't know if we need to double yet. - bs_buf.append(c) - elif c == '"': - # Double backspaces. - result.append('\\' * len(bs_buf)*2) - bs_buf = [] - result.append('\\"') - else: - # Normal char - if bs_buf: - result.extend(bs_buf) - bs_buf = [] - result.append(c) - - # Add remaining backspaces, if any. - if bs_buf: - result.extend(bs_buf) - - if needquote: - result.extend(bs_buf) - result.append('"') - - return ''.join(result) - -class Popen(object): - def __init__(self, args, bufsize=0, executable=None, - stdin=None, stdout=None, stderr=None, - preexec_fn=None, close_fds=False, shell=False, - cwd=None, env=None, universal_newlines=False, - startupinfo=None, creationflags=0): - """Create new Popen instance.""" - _cleanup() - - self._child_created = False - if not is_int_or_long(bufsize): - raise TypeError("bufsize must be an integer") - - if mswindows: - if preexec_fn is not None: - raise ValueError("preexec_fn is not supported on Windows " - "platforms") - if close_fds: - raise ValueError("close_fds is not supported on Windows " - "platforms") - else: - # POSIX - if startupinfo is not None: - raise ValueError("startupinfo is only supported on Windows " - "platforms") - if creationflags != 0: - raise ValueError("creationflags is only supported on Windows " - "platforms") - - self.stdin = None - self.stdout = None - self.stderr = None - self.pid = None - self.returncode = None - self.universal_newlines = universal_newlines - - # Input and output objects. The general principle is like - # this: - # - # Parent Child - # ------ ----- - # p2cwrite ---stdin---> p2cread - # c2pread <--stdout--- c2pwrite - # errread <--stderr--- errwrite - # - # On POSIX, the child objects are file descriptors. On - # Windows, these are Windows file handles. The parent objects - # are file descriptors on both platforms. The parent objects - # are None when not using PIPEs. The child objects are None - # when not redirecting. - - (p2cread, p2cwrite, - c2pread, c2pwrite, - errread, errwrite) = self._get_handles(stdin, stdout, stderr) - - self._execute_child(args, executable, preexec_fn, close_fds, - cwd, env, universal_newlines, - startupinfo, creationflags, shell, - p2cread, p2cwrite, - c2pread, c2pwrite, - errread, errwrite) - - if p2cwrite: - self.stdin = os.fdopen(p2cwrite, 'wb', bufsize) - if c2pread: - if universal_newlines: - self.stdout = os.fdopen(c2pread, 'rU', bufsize) - else: - self.stdout = os.fdopen(c2pread, 'rb', bufsize) - if errread: - if universal_newlines: - self.stderr = os.fdopen(errread, 'rU', bufsize) - else: - self.stderr = os.fdopen(errread, 'rb', bufsize) - - - def _translate_newlines(self, data): - data = data.replace("\r\n", "\n") - data = data.replace("\r", "\n") - return data - - - def __del__(self): - if not self._child_created: - # We didn't get to successfully create a child process. - return - # In case the child hasn't been waited on, check if it's done. - self.poll(_deadstate=sys.maxsize) - if self.returncode is None and _active is not None: - # Child is still running, keep us alive until we can wait on it. - _active.append(self) - - - def communicate(self, input=None): - """Interact with process: Send data to stdin. Read data from - stdout and stderr, until end-of-file is reached. Wait for - process to terminate. The optional input argument should be a - string to be sent to the child process, or None, if no data - should be sent to the child. - - communicate() returns a tuple (stdout, stderr).""" - - # Optimization: If we are only using one pipe, or no pipe at - # all, using select() or threads is unnecessary. - if [self.stdin, self.stdout, self.stderr].count(None) >= 2: - stdout = None - stderr = None - if self.stdin: - if input: - self.stdin.write(input) - self.stdin.close() - elif self.stdout: - stdout = self.stdout.read() - elif self.stderr: - stderr = self.stderr.read() - self.wait() - return (stdout, stderr) - - return self._communicate(input) - - - if mswindows: - # - # Windows methods - # - def _get_handles(self, stdin, stdout, stderr): - """Construct and return tupel with IO objects: - p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite - """ - if stdin is None and stdout is None and stderr is None: - return (None, None, None, None, None, None) - - p2cread, p2cwrite = None, None - c2pread, c2pwrite = None, None - errread, errwrite = None, None - - if stdin is None: - p2cread = GetStdHandle(STD_INPUT_HANDLE) - elif stdin == PIPE: - p2cread, p2cwrite = CreatePipe(None, 0) - # Detach and turn into fd - p2cwrite = p2cwrite.Detach() - p2cwrite = msvcrt.open_osfhandle(p2cwrite, 0) - elif is_int(stdin): - p2cread = msvcrt.get_osfhandle(stdin) - else: - # Assuming file-like object - p2cread = msvcrt.get_osfhandle(stdin.fileno()) - p2cread = self._make_inheritable(p2cread) - - if stdout is None: - c2pwrite = GetStdHandle(STD_OUTPUT_HANDLE) - elif stdout == PIPE: - c2pread, c2pwrite = CreatePipe(None, 0) - # Detach and turn into fd - c2pread = c2pread.Detach() - c2pread = msvcrt.open_osfhandle(c2pread, 0) - elif is_int(stdout): - c2pwrite = msvcrt.get_osfhandle(stdout) - else: - # Assuming file-like object - c2pwrite = msvcrt.get_osfhandle(stdout.fileno()) - c2pwrite = self._make_inheritable(c2pwrite) - - if stderr is None: - errwrite = GetStdHandle(STD_ERROR_HANDLE) - elif stderr == PIPE: - errread, errwrite = CreatePipe(None, 0) - # Detach and turn into fd - errread = errread.Detach() - errread = msvcrt.open_osfhandle(errread, 0) - elif stderr == STDOUT: - errwrite = c2pwrite - elif is_int(stderr): - errwrite = msvcrt.get_osfhandle(stderr) - else: - # Assuming file-like object - errwrite = msvcrt.get_osfhandle(stderr.fileno()) - errwrite = self._make_inheritable(errwrite) - - return (p2cread, p2cwrite, - c2pread, c2pwrite, - errread, errwrite) - - - def _make_inheritable(self, handle): - """Return a duplicate of handle, which is inheritable""" - return DuplicateHandle(GetCurrentProcess(), handle, - GetCurrentProcess(), 0, 1, - DUPLICATE_SAME_ACCESS) - - - def _find_w9xpopen(self): - """Find and return absolut path to w9xpopen.exe""" - w9xpopen = os.path.join(os.path.dirname(GetModuleFileName(0)), - "w9xpopen.exe") - if not os.path.exists(w9xpopen): - # Eeek - file-not-found - possibly an embedding - # situation - see if we can locate it in sys.exec_prefix - w9xpopen = os.path.join(os.path.dirname(sys.exec_prefix), - "w9xpopen.exe") - if not os.path.exists(w9xpopen): - raise RuntimeError("Cannot locate w9xpopen.exe, which is " - "needed for Popen to work with your " - "shell or platform.") - return w9xpopen - - - def _execute_child(self, args, executable, preexec_fn, close_fds, - cwd, env, universal_newlines, - startupinfo, creationflags, shell, - p2cread, p2cwrite, - c2pread, c2pwrite, - errread, errwrite): - """Execute program (MS Windows version)""" - - if not isinstance(args, types.StringTypes): - args = list2cmdline(args) - - # Process startup details - if startupinfo is None: - startupinfo = STARTUPINFO() - if None not in (p2cread, c2pwrite, errwrite): - startupinfo.dwFlags = startupinfo.dwFlags | STARTF_USESTDHANDLES - startupinfo.hStdInput = p2cread - startupinfo.hStdOutput = c2pwrite - startupinfo.hStdError = errwrite - - if shell: - startupinfo.dwFlags = startupinfo.dwFlags | STARTF_USESHOWWINDOW - startupinfo.wShowWindow = SW_HIDE - comspec = os.environ.get("COMSPEC", "cmd.exe") - args = comspec + " /c " + args - if (GetVersion() >= 0x80000000L or - os.path.basename(comspec).lower() == "command.com"): - # Win9x, or using command.com on NT. We need to - # use the w9xpopen intermediate program. For more - # information, see KB Q150956 - # (http://web.archive.org/web/20011105084002/http://support.microsoft.com/support/kb/articles/Q150/9/56.asp) - w9xpopen = self._find_w9xpopen() - args = '"%s" %s' % (w9xpopen, args) - # Not passing CREATE_NEW_CONSOLE has been known to - # cause random failures on win9x. Specifically a - # dialog: "Your program accessed mem currently in - # use at xxx" and a hopeful warning about the - # stability of your system. Cost is Ctrl+C wont - # kill children. - creationflags = creationflags | CREATE_NEW_CONSOLE - - # Start the process - try: - hp, ht, pid, tid = CreateProcess(executable, args, - # no special security - None, None, - # must inherit handles to pass std - # handles - 1, - creationflags, - env, - cwd, - startupinfo) - except pywintypes.error, e: - # Translate pywintypes.error to WindowsError, which is - # a subclass of OSError. FIXME: We should really - # translate errno using _sys_errlist (or simliar), but - # how can this be done from Python? - raise WindowsError(*e.args) - - # Retain the process handle, but close the thread handle - self._child_created = True - self._handle = hp - self.pid = pid - ht.Close() - - # Child is launched. Close the parent's copy of those pipe - # handles that only the child should have open. You need - # to make sure that no handles to the write end of the - # output pipe are maintained in this process or else the - # pipe will not close when the child process exits and the - # ReadFile will hang. - if p2cread is not None: - p2cread.Close() - if c2pwrite is not None: - c2pwrite.Close() - if errwrite is not None: - errwrite.Close() - - - def poll(self, _deadstate=None): - """Check if child process has terminated. Returns returncode - attribute.""" - if self.returncode is None: - if WaitForSingleObject(self._handle, 0) == WAIT_OBJECT_0: - self.returncode = GetExitCodeProcess(self._handle) - return self.returncode - - - def wait(self): - """Wait for child process to terminate. Returns returncode - attribute.""" - if self.returncode is None: - obj = WaitForSingleObject(self._handle, INFINITE) - self.returncode = GetExitCodeProcess(self._handle) - return self.returncode - - - def _readerthread(self, fh, buffer): - buffer.append(fh.read()) - - - def _communicate(self, input): - stdout = None # Return - stderr = None # Return - - if self.stdout: - stdout = [] - stdout_thread = threading.Thread(target=self._readerthread, - args=(self.stdout, stdout)) - stdout_thread.setDaemon(True) - stdout_thread.start() - if self.stderr: - stderr = [] - stderr_thread = threading.Thread(target=self._readerthread, - args=(self.stderr, stderr)) - stderr_thread.setDaemon(True) - stderr_thread.start() - - if self.stdin: - if input is not None: - self.stdin.write(input) - self.stdin.close() - - if self.stdout: - stdout_thread.join() - if self.stderr: - stderr_thread.join() - - # All data exchanged. Translate lists into strings. - if stdout is not None: - stdout = stdout[0] - if stderr is not None: - stderr = stderr[0] - - # Translate newlines, if requested. We cannot let the file - # object do the translation: It is based on stdio, which is - # impossible to combine with select (unless forcing no - # buffering). - if self.universal_newlines and hasattr(file, 'newlines'): - if stdout: - stdout = self._translate_newlines(stdout) - if stderr: - stderr = self._translate_newlines(stderr) - - self.wait() - return (stdout, stderr) - - else: - # - # POSIX methods - # - def _get_handles(self, stdin, stdout, stderr): - """Construct and return tupel with IO objects: - p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite - """ - p2cread, p2cwrite = None, None - c2pread, c2pwrite = None, None - errread, errwrite = None, None - - if stdin is None: - pass - elif stdin == PIPE: - p2cread, p2cwrite = os.pipe() - elif is_int(stdin): - p2cread = stdin - else: - # Assuming file-like object - p2cread = stdin.fileno() - - if stdout is None: - pass - elif stdout == PIPE: - c2pread, c2pwrite = os.pipe() - elif is_int(stdout): - c2pwrite = stdout - else: - # Assuming file-like object - c2pwrite = stdout.fileno() - - if stderr is None: - pass - elif stderr == PIPE: - errread, errwrite = os.pipe() - elif stderr == STDOUT: - errwrite = c2pwrite - elif is_int(stderr): - errwrite = stderr - else: - # Assuming file-like object - errwrite = stderr.fileno() - - return (p2cread, p2cwrite, - c2pread, c2pwrite, - errread, errwrite) - - - def _set_cloexec_flag(self, fd): - try: - cloexec_flag = fcntl.FD_CLOEXEC - except AttributeError: - cloexec_flag = 1 - - old = fcntl.fcntl(fd, fcntl.F_GETFD) - fcntl.fcntl(fd, fcntl.F_SETFD, old | cloexec_flag) - - - def _close_fds(self, but): - for i in range(3, MAXFD): - if i == but: - continue - try: - os.close(i) - except KeyboardInterrupt: - raise # SCons: don't swallow keyboard interrupts - except: - pass - - - def _execute_child(self, args, executable, preexec_fn, close_fds, - cwd, env, universal_newlines, - startupinfo, creationflags, shell, - p2cread, p2cwrite, - c2pread, c2pwrite, - errread, errwrite): - """Execute program (POSIX version)""" - - if is_string(args): - args = [args] - - if shell: - args = ["/bin/sh", "-c"] + args - - if executable is None: - executable = args[0] - - # For transferring possible exec failure from child to parent - # The first char specifies the exception type: 0 means - # OSError, 1 means some other error. - errpipe_read, errpipe_write = os.pipe() - self._set_cloexec_flag(errpipe_write) - - self.pid = os.fork() - self._child_created = True - if self.pid == 0: - # Child - try: - # Close parent's pipe ends - if p2cwrite: - os.close(p2cwrite) - if c2pread: - os.close(c2pread) - if errread: - os.close(errread) - os.close(errpipe_read) - - # Dup fds for child - if p2cread: - os.dup2(p2cread, 0) - if c2pwrite: - os.dup2(c2pwrite, 1) - if errwrite: - os.dup2(errwrite, 2) - - # Close pipe fds. Make sure we don't close the same - # fd more than once, or standard fds. - try: - set - except NameError: - # Fall-back for earlier Python versions, so epydoc - # can use this module directly to execute things. - if p2cread: - os.close(p2cread) - if c2pwrite and c2pwrite not in (p2cread,): - os.close(c2pwrite) - if errwrite and errwrite not in (p2cread, c2pwrite): - os.close(errwrite) - else: - for fd in set((p2cread, c2pwrite, errwrite))-set((0,1,2)): - if fd: os.close(fd) - - # Close all other fds, if asked for - if close_fds: - self._close_fds(but=errpipe_write) - - if cwd is not None: - os.chdir(cwd) - - if preexec_fn: - apply(preexec_fn) - - if env is None: - os.execvp(executable, args) - else: - os.execvpe(executable, args, env) - - except KeyboardInterrupt: - raise # SCons: don't swallow keyboard interrupts - - except: - exc_type, exc_value, tb = sys.exc_info() - # Save the traceback and attach it to the exception object - exc_lines = traceback.format_exception(exc_type, - exc_value, - tb) - exc_value.child_traceback = ''.join(exc_lines) - os.write(errpipe_write, pickle.dumps(exc_value)) - - # This exitcode won't be reported to applications, so it - # really doesn't matter what we return. - os._exit(255) - - # Parent - os.close(errpipe_write) - if p2cread and p2cwrite: - os.close(p2cread) - if c2pwrite and c2pread: - os.close(c2pwrite) - if errwrite and errread: - os.close(errwrite) - - # Wait for exec to fail or succeed; possibly raising exception - data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB - os.close(errpipe_read) - if data != "": - os.waitpid(self.pid, 0) - child_exception = pickle.loads(data) - raise child_exception - - - def _handle_exitstatus(self, sts): - if os.WIFSIGNALED(sts): - self.returncode = -os.WTERMSIG(sts) - elif os.WIFEXITED(sts): - self.returncode = os.WEXITSTATUS(sts) - else: - # Should never happen - raise RuntimeError("Unknown child exit status!") - - - def poll(self, _deadstate=None): - """Check if child process has terminated. Returns returncode - attribute.""" - if self.returncode is None: - try: - pid, sts = os.waitpid(self.pid, os.WNOHANG) - if pid == self.pid: - self._handle_exitstatus(sts) - except os.error: - if _deadstate is not None: - self.returncode = _deadstate - return self.returncode - - - def wait(self): - """Wait for child process to terminate. Returns returncode - attribute.""" - if self.returncode is None: - pid, sts = os.waitpid(self.pid, 0) - self._handle_exitstatus(sts) - return self.returncode - - - def _communicate(self, input): - read_set = [] - write_set = [] - stdout = None # Return - stderr = None # Return - - if self.stdin: - # Flush stdio buffer. This might block, if the user has - # been writing to .stdin in an uncontrolled fashion. - self.stdin.flush() - if input: - write_set.append(self.stdin) - else: - self.stdin.close() - if self.stdout: - read_set.append(self.stdout) - stdout = [] - if self.stderr: - read_set.append(self.stderr) - stderr = [] - - input_offset = 0 - while read_set or write_set: - rlist, wlist, xlist = select.select(read_set, write_set, []) - - if self.stdin in wlist: - # When select has indicated that the file is writable, - # we can write up to PIPE_BUF bytes without risk - # blocking. POSIX defines PIPE_BUF >= 512 - m = memoryview(input)[input_offset:input_offset+512] - bytes_written = os.write(self.stdin.fileno(), m) - input_offset = input_offset + bytes_written - if input_offset >= len(input): - self.stdin.close() - write_set.remove(self.stdin) - - if self.stdout in rlist: - data = os.read(self.stdout.fileno(), 1024) - if data == "": - self.stdout.close() - read_set.remove(self.stdout) - stdout.append(data) - - if self.stderr in rlist: - data = os.read(self.stderr.fileno(), 1024) - if data == "": - self.stderr.close() - read_set.remove(self.stderr) - stderr.append(data) - - # All data exchanged. Translate lists into strings. - if stdout is not None: - stdout = ''.join(stdout) - if stderr is not None: - stderr = ''.join(stderr) - - # Translate newlines, if requested. We cannot let the file - # object do the translation: It is based on stdio, which is - # impossible to combine with select (unless forcing no - # buffering). - if self.universal_newlines and hasattr(file, 'newlines'): - if stdout: - stdout = self._translate_newlines(stdout) - if stderr: - stderr = self._translate_newlines(stderr) - - self.wait() - return (stdout, stderr) - - -def _demo_posix(): - # - # Example 1: Simple redirection: Get process list - # - plist = Popen(["ps"], stdout=PIPE).communicate()[0] - print "Process list:" - print plist - - # - # Example 2: Change uid before executing child - # - if os.getuid() == 0: - p = Popen(["id"], preexec_fn=lambda: os.setuid(100)) - p.wait() - - # - # Example 3: Connecting several subprocesses - # - print "Looking for 'hda'..." - p1 = Popen(["dmesg"], stdout=PIPE) - p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE) - print repr(p2.communicate()[0]) - - # - # Example 4: Catch execution error - # - print - print "Trying a weird file..." - try: - print Popen(["/this/path/does/not/exist"]).communicate() - except OSError, e: - if e.errno == errno.ENOENT: - print "The file didn't exist. I thought so..." - print "Child traceback:" - print e.child_traceback - else: - print "Error", e.errno - else: - sys.stderr.write( "Gosh. No error.\n" ) - - -def _demo_windows(): - # - # Example 1: Connecting several subprocesses - # - print "Looking for 'PROMPT' in set output..." - p1 = Popen("set", stdout=PIPE, shell=True) - p2 = Popen('find "PROMPT"', stdin=p1.stdout, stdout=PIPE) - print repr(p2.communicate()[0]) - - # - # Example 2: Simple execution of program - # - print "Executing calc..." - p = Popen("calc") - p.wait() - - -if __name__ == "__main__": - if mswindows: - _demo_windows() - else: - _demo_posix() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/cpp.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/cpp.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/cpp.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/cpp.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,589 +0,0 @@ -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/cpp.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - -__doc__ = """ -SCons C Pre-Processor module -""" -#TODO 2.3 and before has no sorted() -import SCons.compat - -import os -import re - -# -# First "subsystem" of regular expressions that we set up: -# -# Stuff to turn the C preprocessor directives in a file's contents into -# a list of tuples that we can process easily. -# - -# A table of regular expressions that fetch the arguments from the rest of -# a C preprocessor line. Different directives have different arguments -# that we want to fetch, using the regular expressions to which the lists -# of preprocessor directives map. -cpp_lines_dict = { - # Fetch the rest of a #if/#elif/#ifdef/#ifndef as one argument, - # separated from the keyword by white space. - ('if', 'elif', 'ifdef', 'ifndef',) - : '\s+(.+)', - - # Fetch the rest of a #import/#include/#include_next line as one - # argument, with white space optional. - ('import', 'include', 'include_next',) - : '\s*(.+)', - - # We don't care what comes after a #else or #endif line. - ('else', 'endif',) : '', - - # Fetch three arguments from a #define line: - # 1) The #defined keyword. - # 2) The optional parentheses and arguments (if it's a function-like - # macro, '' if it's not). - # 3) The expansion value. - ('define',) : '\s+([_A-Za-z][_A-Za-z0-9_]*)(\([^)]*\))?\s*(.*)', - - # Fetch the #undefed keyword from a #undef line. - ('undef',) : '\s+([_A-Za-z][A-Za-z0-9_]*)', -} - -# Create a table that maps each individual C preprocessor directive to -# the corresponding compiled regular expression that fetches the arguments -# we care about. -Table = {} -for op_list, expr in cpp_lines_dict.items(): - e = re.compile(expr) - for op in op_list: - Table[op] = e -del e -del op -del op_list - -# Create a list of the expressions we'll use to match all of the -# preprocessor directives. These are the same as the directives -# themselves *except* that we must use a negative lookahead assertion -# when matching "if" so it doesn't match the "if" in "ifdef." -override = { - 'if' : 'if(?!def)', -} -l = [override.get(x, x) for x in Table.keys()] - - -# Turn the list of expressions into one big honkin' regular expression -# that will match all the preprocessor lines at once. This will return -# a list of tuples, one for each preprocessor line. The preprocessor -# directive will be the first element in each tuple, and the rest of -# the line will be the second element. -e = '^\s*#\s*(' + '|'.join(l) + ')(.*)$' - -# And last but not least, compile the expression. -CPP_Expression = re.compile(e, re.M) - - - - -# -# Second "subsystem" of regular expressions that we set up: -# -# Stuff to translate a C preprocessor expression (as found on a #if or -# #elif line) into an equivalent Python expression that we can eval(). -# - -# A dictionary that maps the C representation of Boolean operators -# to their Python equivalents. -CPP_to_Python_Ops_Dict = { - '!' : ' not ', - '!=' : ' != ', - '&&' : ' and ', - '||' : ' or ', - '?' : ' and ', - ':' : ' or ', - '\r' : '', -} - -CPP_to_Python_Ops_Sub = lambda m: CPP_to_Python_Ops_Dict[m.group(0)] - -# We have to sort the keys by length so that longer expressions -# come *before* shorter expressions--in particular, "!=" must -# come before "!" in the alternation. Without this, the Python -# re module, as late as version 2.2.2, empirically matches the -# "!" in "!=" first, instead of finding the longest match. -# What's up with that? -l = sorted(CPP_to_Python_Ops_Dict.keys(), key=lambda a: len(a), reverse=True) - -# Turn the list of keys into one regular expression that will allow us -# to substitute all of the operators at once. -expr = '|'.join(map(re.escape, l)) - -# ...and compile the expression. -CPP_to_Python_Ops_Expression = re.compile(expr) - -# A separate list of expressions to be evaluated and substituted -# sequentially, not all at once. -CPP_to_Python_Eval_List = [ - ['defined\s+(\w+)', '"\\1" in __dict__'], - ['defined\s*\((\w+)\)', '"\\1" in __dict__'], - ['/\*.*\*/', ''], - ['/\*.*', ''], - ['//.*', ''], - ['(0x[0-9A-Fa-f]*)[UL]+', '\\1'], -] - -# Replace the string representations of the regular expressions in the -# list with compiled versions. -for l in CPP_to_Python_Eval_List: - l[0] = re.compile(l[0]) - -# Wrap up all of the above into a handy function. -def CPP_to_Python(s): - """ - Converts a C pre-processor expression into an equivalent - Python expression that can be evaluated. - """ - s = CPP_to_Python_Ops_Expression.sub(CPP_to_Python_Ops_Sub, s) - for expr, repl in CPP_to_Python_Eval_List: - s = expr.sub(repl, s) - return s - - - -del expr -del l -del override - - - -class FunctionEvaluator(object): - """ - Handles delayed evaluation of a #define function call. - """ - def __init__(self, name, args, expansion): - """ - Squirrels away the arguments and expansion value of a #define - macro function for later evaluation when we must actually expand - a value that uses it. - """ - self.name = name - self.args = function_arg_separator.split(args) - try: - expansion = expansion.split('##') - except AttributeError: - pass - self.expansion = expansion - def __call__(self, *values): - """ - Evaluates the expansion of a #define macro function called - with the specified values. - """ - if len(self.args) != len(values): - raise ValueError("Incorrect number of arguments to `%s'" % self.name) - # Create a dictionary that maps the macro arguments to the - # corresponding values in this "call." We'll use this when we - # eval() the expansion so that arguments will get expanded to - # the right values. - locals = {} - for k, v in zip(self.args, values): - locals[k] = v - - parts = [] - for s in self.expansion: - if not s in self.args: - s = repr(s) - parts.append(s) - statement = ' + '.join(parts) - - return eval(statement, globals(), locals) - - - -# Find line continuations. -line_continuations = re.compile('\\\\\r?\n') - -# Search for a "function call" macro on an expansion. Returns the -# two-tuple of the "function" name itself, and a string containing the -# arguments within the call parentheses. -function_name = re.compile('(\S+)\(([^)]*)\)') - -# Split a string containing comma-separated function call arguments into -# the separate arguments. -function_arg_separator = re.compile(',\s*') - - - -class PreProcessor(object): - """ - The main workhorse class for handling C pre-processing. - """ - def __init__(self, current=os.curdir, cpppath=(), dict={}, all=0): - global Table - - cpppath = tuple(cpppath) - - self.searchpath = { - '"' : (current,) + cpppath, - '<' : cpppath + (current,), - } - - # Initialize our C preprocessor namespace for tracking the - # values of #defined keywords. We use this namespace to look - # for keywords on #ifdef/#ifndef lines, and to eval() the - # expressions on #if/#elif lines (after massaging them from C to - # Python). - self.cpp_namespace = dict.copy() - self.cpp_namespace['__dict__'] = self.cpp_namespace - - if all: - self.do_include = self.all_include - - # For efficiency, a dispatch table maps each C preprocessor - # directive (#if, #define, etc.) to the method that should be - # called when we see it. We accomodate state changes (#if, - # #ifdef, #ifndef) by pushing the current dispatch table on a - # stack and changing what method gets called for each relevant - # directive we might see next at this level (#else, #elif). - # #endif will simply pop the stack. - d = { - 'scons_current_file' : self.scons_current_file - } - for op in Table.keys(): - d[op] = getattr(self, 'do_' + op) - self.default_table = d - - # Controlling methods. - - def tupleize(self, contents): - """ - Turns the contents of a file into a list of easily-processed - tuples describing the CPP lines in the file. - - The first element of each tuple is the line's preprocessor - directive (#if, #include, #define, etc., minus the initial '#'). - The remaining elements are specific to the type of directive, as - pulled apart by the regular expression. - """ - global CPP_Expression, Table - contents = line_continuations.sub('', contents) - cpp_tuples = CPP_Expression.findall(contents) - return [(m[0],) + Table[m[0]].match(m[1]).groups() for m in cpp_tuples] - - def __call__(self, file): - """ - Pre-processes a file. - - This is the main public entry point. - """ - self.current_file = file - return self.process_contents(self.read_file(file), file) - - def process_contents(self, contents, fname=None): - """ - Pre-processes a file contents. - - This is the main internal entry point. - """ - self.stack = [] - self.dispatch_table = self.default_table.copy() - self.current_file = fname - self.tuples = self.tupleize(contents) - - self.initialize_result(fname) - while self.tuples: - t = self.tuples.pop(0) - # Uncomment to see the list of tuples being processed (e.g., - # to validate the CPP lines are being translated correctly). - #print t - self.dispatch_table[t[0]](t) - return self.finalize_result(fname) - - # Dispatch table stack manipulation methods. - - def save(self): - """ - Pushes the current dispatch table on the stack and re-initializes - the current dispatch table to the default. - """ - self.stack.append(self.dispatch_table) - self.dispatch_table = self.default_table.copy() - - def restore(self): - """ - Pops the previous dispatch table off the stack and makes it the - current one. - """ - try: self.dispatch_table = self.stack.pop() - except IndexError: pass - - # Utility methods. - - def do_nothing(self, t): - """ - Null method for when we explicitly want the action for a - specific preprocessor directive to do nothing. - """ - pass - - def scons_current_file(self, t): - self.current_file = t[1] - - def eval_expression(self, t): - """ - Evaluates a C preprocessor expression. - - This is done by converting it to a Python equivalent and - eval()ing it in the C preprocessor namespace we use to - track #define values. - """ - t = CPP_to_Python(' '.join(t[1:])) - try: return eval(t, self.cpp_namespace) - except (NameError, TypeError): return 0 - - def initialize_result(self, fname): - self.result = [fname] - - def finalize_result(self, fname): - return self.result[1:] - - def find_include_file(self, t): - """ - Finds the #include file for a given preprocessor tuple. - """ - fname = t[2] - for d in self.searchpath[t[1]]: - if d == os.curdir: - f = fname - else: - f = os.path.join(d, fname) - if os.path.isfile(f): - return f - return None - - def read_file(self, file): - return open(file).read() - - # Start and stop processing include lines. - - def start_handling_includes(self, t=None): - """ - Causes the PreProcessor object to start processing #import, - #include and #include_next lines. - - This method will be called when a #if, #ifdef, #ifndef or #elif - evaluates True, or when we reach the #else in a #if, #ifdef, - #ifndef or #elif block where a condition already evaluated - False. - - """ - d = self.dispatch_table - d['import'] = self.do_import - d['include'] = self.do_include - d['include_next'] = self.do_include - - def stop_handling_includes(self, t=None): - """ - Causes the PreProcessor object to stop processing #import, - #include and #include_next lines. - - This method will be called when a #if, #ifdef, #ifndef or #elif - evaluates False, or when we reach the #else in a #if, #ifdef, - #ifndef or #elif block where a condition already evaluated True. - """ - d = self.dispatch_table - d['import'] = self.do_nothing - d['include'] = self.do_nothing - d['include_next'] = self.do_nothing - - # Default methods for handling all of the preprocessor directives. - # (Note that what actually gets called for a given directive at any - # point in time is really controlled by the dispatch_table.) - - def _do_if_else_condition(self, condition): - """ - Common logic for evaluating the conditions on #if, #ifdef and - #ifndef lines. - """ - self.save() - d = self.dispatch_table - if condition: - self.start_handling_includes() - d['elif'] = self.stop_handling_includes - d['else'] = self.stop_handling_includes - else: - self.stop_handling_includes() - d['elif'] = self.do_elif - d['else'] = self.start_handling_includes - - def do_ifdef(self, t): - """ - Default handling of a #ifdef line. - """ - self._do_if_else_condition(t[1] in self.cpp_namespace) - - def do_ifndef(self, t): - """ - Default handling of a #ifndef line. - """ - self._do_if_else_condition(t[1] not in self.cpp_namespace) - - def do_if(self, t): - """ - Default handling of a #if line. - """ - self._do_if_else_condition(self.eval_expression(t)) - - def do_elif(self, t): - """ - Default handling of a #elif line. - """ - d = self.dispatch_table - if self.eval_expression(t): - self.start_handling_includes() - d['elif'] = self.stop_handling_includes - d['else'] = self.stop_handling_includes - - def do_else(self, t): - """ - Default handling of a #else line. - """ - pass - - def do_endif(self, t): - """ - Default handling of a #endif line. - """ - self.restore() - - def do_define(self, t): - """ - Default handling of a #define line. - """ - _, name, args, expansion = t - try: - expansion = int(expansion) - except (TypeError, ValueError): - pass - if args: - evaluator = FunctionEvaluator(name, args[1:-1], expansion) - self.cpp_namespace[name] = evaluator - else: - self.cpp_namespace[name] = expansion - - def do_undef(self, t): - """ - Default handling of a #undef line. - """ - try: del self.cpp_namespace[t[1]] - except KeyError: pass - - def do_import(self, t): - """ - Default handling of a #import line. - """ - # XXX finish this -- maybe borrow/share logic from do_include()...? - pass - - def do_include(self, t): - """ - Default handling of a #include line. - """ - t = self.resolve_include(t) - include_file = self.find_include_file(t) - if include_file: - #print "include_file =", include_file - self.result.append(include_file) - contents = self.read_file(include_file) - new_tuples = [('scons_current_file', include_file)] + \ - self.tupleize(contents) + \ - [('scons_current_file', self.current_file)] - self.tuples[:] = new_tuples + self.tuples - - # Date: Tue, 22 Nov 2005 20:26:09 -0500 - # From: Stefan Seefeld - # - # By the way, #include_next is not the same as #include. The difference - # being that #include_next starts its search in the path following the - # path that let to the including file. In other words, if your system - # include paths are ['/foo', '/bar'], and you are looking at a header - # '/foo/baz.h', it might issue an '#include_next ' which would - # correctly resolve to '/bar/baz.h' (if that exists), but *not* see - # '/foo/baz.h' again. See http://www.delorie.com/gnu/docs/gcc/cpp_11.html - # for more reasoning. - # - # I have no idea in what context 'import' might be used. - - # XXX is #include_next really the same as #include ? - do_include_next = do_include - - # Utility methods for handling resolution of include files. - - def resolve_include(self, t): - """Resolve a tuple-ized #include line. - - This handles recursive expansion of values without "" or <> - surrounding the name until an initial " or < is found, to handle - #include FILE - where FILE is a #define somewhere else. - """ - s = t[1] - while not s[0] in '<"': - #print "s =", s - try: - s = self.cpp_namespace[s] - except KeyError: - m = function_name.search(s) - s = self.cpp_namespace[m.group(1)] - if callable(s): - args = function_arg_separator.split(m.group(2)) - s = s(*args) - if not s: - return None - return (t[0], s[0], s[1:-1]) - - def all_include(self, t): - """ - """ - self.result.append(self.resolve_include(t)) - -class DumbPreProcessor(PreProcessor): - """A preprocessor that ignores all #if/#elif/#else/#endif directives - and just reports back *all* of the #include files (like the classic - SCons scanner did). - - This is functionally equivalent to using a regular expression to - find all of the #include lines, only slower. It exists mainly as - an example of how the main PreProcessor class can be sub-classed - to tailor its behavior. - """ - def __init__(self, *args, **kw): - PreProcessor.__init__(self, *args, **kw) - d = self.default_table - for func in ['if', 'elif', 'else', 'endif', 'ifdef', 'ifndef']: - d[func] = d[func] = self.do_nothing - -del __revision__ - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/dblite.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/dblite.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/dblite.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/dblite.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,254 +0,0 @@ -# dblite.py module contributed by Ralf W. Grosse-Kunstleve. -# Extended for Unicode by Steven Knight. - -import SCons.compat - -import builtins -import os -# compat layer imports "cPickle" for us if it's available. -import pickle -import shutil -import time - -keep_all_files = 00000 -ignore_corrupt_dbfiles = 0 - -def corruption_warning(filename): - print "Warning: Discarding corrupt database:", filename - -try: unicode -except NameError: - def is_string(s): - return isinstance(s, str) -else: - def is_string(s): - return type(s) in (str, unicode) - -try: - unicode('a') -except NameError: - def unicode(s): return s - -dblite_suffix = '.dblite' -tmp_suffix = '.tmp' - -class dblite(object): - - # Squirrel away references to the functions in various modules - # that we'll use when our __del__() method calls our sync() method - # during shutdown. We might get destroyed when Python is in the midst - # of tearing down the different modules we import in an essentially - # arbitrary order, and some of the various modules's global attributes - # may already be wiped out from under us. - # - # See the discussion at: - # http://mail.python.org/pipermail/python-bugs-list/2003-March/016877.html - - _open = builtins.open - _pickle_dump = staticmethod(pickle.dump) - _os_chmod = os.chmod - try: - _os_chown = os.chown - except AttributeError: - _os_chown = None - _os_rename = os.rename - _os_unlink = os.unlink - _shutil_copyfile = shutil.copyfile - _time_time = time.time - - def __init__(self, file_base_name, flag, mode): - assert flag in (None, "r", "w", "c", "n") - if (flag is None): flag = "r" - base, ext = os.path.splitext(file_base_name) - if ext == dblite_suffix: - # There's already a suffix on the file name, don't add one. - self._file_name = file_base_name - self._tmp_name = base + tmp_suffix - else: - self._file_name = file_base_name + dblite_suffix - self._tmp_name = file_base_name + tmp_suffix - self._flag = flag - self._mode = mode - self._dict = {} - self._needs_sync = 00000 - if self._os_chown is not None and (os.geteuid()==0 or os.getuid()==0): - # running as root; chown back to current owner/group when done - try: - statinfo = os.stat(self._file_name) - self._chown_to = statinfo.st_uid - self._chgrp_to = statinfo.st_gid - except OSError, e: - # db file doesn't exist yet. - # Check os.environ for SUDO_UID, use if set - self._chown_to = int(os.environ.get('SUDO_UID', -1)) - self._chgrp_to = int(os.environ.get('SUDO_GID', -1)) - else: - self._chown_to = -1 # don't chown - self._chgrp_to = -1 # don't chgrp - if (self._flag == "n"): - self._open(self._file_name, "wb", self._mode) - else: - try: - f = self._open(self._file_name, "rb") - except IOError, e: - if (self._flag != "c"): - raise e - self._open(self._file_name, "wb", self._mode) - else: - p = f.read() - if (len(p) > 0): - try: - self._dict = pickle.loads(p) - except (pickle.UnpicklingError, EOFError): - if (ignore_corrupt_dbfiles == 0): raise - if (ignore_corrupt_dbfiles == 1): - corruption_warning(self._file_name) - - def close(self): - if (self._needs_sync): - self.sync() - - def __del__(self): - self.close() - - def sync(self): - self._check_writable() - f = self._open(self._tmp_name, "wb", self._mode) - self._pickle_dump(self._dict, f, 1) - f.close() - # Windows doesn't allow renaming if the file exists, so unlink - # it first, chmod'ing it to make sure we can do so. On UNIX, we - # may not be able to chmod the file if it's owned by someone else - # (e.g. from a previous run as root). We should still be able to - # unlink() the file if the directory's writable, though, so ignore - # any OSError exception thrown by the chmod() call. - try: self._os_chmod(self._file_name, 0777) - except OSError: pass - self._os_unlink(self._file_name) - self._os_rename(self._tmp_name, self._file_name) - if self._os_chown is not None and self._chown_to > 0: # don't chown to root or -1 - try: - self._os_chown(self._file_name, self._chown_to, self._chgrp_to) - except OSError: - pass - self._needs_sync = 00000 - if (keep_all_files): - self._shutil_copyfile( - self._file_name, - self._file_name + "_" + str(int(self._time_time()))) - - def _check_writable(self): - if (self._flag == "r"): - raise IOError("Read-only database: %s" % self._file_name) - - def __getitem__(self, key): - return self._dict[key] - - def __setitem__(self, key, value): - self._check_writable() - if (not is_string(key)): - raise TypeError("key `%s' must be a string but is %s" % (key, type(key))) - if (not is_string(value)): - raise TypeError("value `%s' must be a string but is %s" % (value, type(value))) - self._dict[key] = value - self._needs_sync = 0001 - - def keys(self): - return list(self._dict.keys()) - - def has_key(self, key): - return key in self._dict - - def __contains__(self, key): - return key in self._dict - - def iterkeys(self): - # Wrapping name in () prevents fixer from "fixing" this - return (self._dict.iterkeys)() - - __iter__ = iterkeys - - def __len__(self): - return len(self._dict) - -def open(file, flag=None, mode=0666): - return dblite(file, flag, mode) - -def _exercise(): - db = open("tmp", "n") - assert len(db) == 0 - db["foo"] = "bar" - assert db["foo"] == "bar" - db[unicode("ufoo")] = unicode("ubar") - assert db[unicode("ufoo")] == unicode("ubar") - db.sync() - db = open("tmp", "c") - assert len(db) == 2, len(db) - assert db["foo"] == "bar" - db["bar"] = "foo" - assert db["bar"] == "foo" - db[unicode("ubar")] = unicode("ufoo") - assert db[unicode("ubar")] == unicode("ufoo") - db.sync() - db = open("tmp", "r") - assert len(db) == 4, len(db) - assert db["foo"] == "bar" - assert db["bar"] == "foo" - assert db[unicode("ufoo")] == unicode("ubar") - assert db[unicode("ubar")] == unicode("ufoo") - try: - db.sync() - except IOError, e: - assert str(e) == "Read-only database: tmp.dblite" - else: - raise RuntimeError("IOError expected.") - db = open("tmp", "w") - assert len(db) == 4 - db["ping"] = "pong" - db.sync() - try: - db[(1,2)] = "tuple" - except TypeError, e: - assert str(e) == "key `(1, 2)' must be a string but is ", str(e) - else: - raise RuntimeError("TypeError exception expected") - try: - db["list"] = [1,2] - except TypeError, e: - assert str(e) == "value `[1, 2]' must be a string but is ", str(e) - else: - raise RuntimeError("TypeError exception expected") - db = open("tmp", "r") - assert len(db) == 5 - db = open("tmp", "n") - assert len(db) == 0 - dblite._open("tmp.dblite", "w") - db = open("tmp", "r") - dblite._open("tmp.dblite", "w").write("x") - try: - db = open("tmp", "r") - except pickle.UnpicklingError: - pass - else: - raise RuntimeError("pickle exception expected.") - global ignore_corrupt_dbfiles - ignore_corrupt_dbfiles = 2 - db = open("tmp", "r") - assert len(db) == 0 - os.unlink("tmp.dblite") - try: - db = open("tmp", "w") - except IOError, e: - assert str(e) == "[Errno 2] No such file or directory: 'tmp.dblite'", str(e) - else: - raise RuntimeError("IOError expected.") - print "OK" - -if (__name__ == "__main__"): - _exercise() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/SCons/exitfuncs.py mapnik-2.2.0/scons/scons-local-2.2.0/SCons/exitfuncs.py --- mapnik-2.1.0/scons/scons-local-2.2.0/SCons/exitfuncs.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/SCons/exitfuncs.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -"""SCons.exitfuncs - -Register functions which are executed when SCons exits for any reason. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation -# -# 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. -# - -__revision__ = "src/engine/SCons/exitfuncs.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" - - - -_exithandlers = [] -def _run_exitfuncs(): - """run any registered exit functions - - _exithandlers is traversed in reverse order so functions are executed - last in, first out. - """ - - while _exithandlers: - func, targs, kargs = _exithandlers.pop() - func(*targs, **kargs) - -def register(func, *targs, **kargs): - """register a function to be executed upon normal program termination - - func - function to be called at exit - targs - optional arguments to pass to func - kargs - optional keyword arguments to pass to func - """ - _exithandlers.append((func, targs, kargs)) - -import sys - -try: - x = sys.exitfunc - - # if x isn't our own exit func executive, assume it's another - # registered exit function - append it to our list... - if x != _run_exitfuncs: - register(x) - -except AttributeError: - pass - -# make our exit function get run by python when it exits: -sys.exitfunc = _run_exitfuncs - -del sys - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.2.0/scons-2.2.0.egg-info mapnik-2.2.0/scons/scons-local-2.2.0/scons-2.2.0.egg-info --- mapnik-2.1.0/scons/scons-local-2.2.0/scons-2.2.0.egg-info 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.2.0/scons-2.2.0.egg-info 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -Metadata-Version: 1.0 -Name: scons -Version: 2.2.0 -Summary: Open Source next-generation build tool. -Home-page: http://www.scons.org/ -Author: Steven Knight -Author-email: knight@baldmt.com -License: UNKNOWN -Description: Open Source next-generation build tool. - Improved, cross-platform substitute for the classic Make - utility. In short, SCons is an easier, more reliable - and faster way to build software. -Platform: UNKNOWN diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Action.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Action.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Action.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Action.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,1257 @@ +"""SCons.Action + +This encapsulates information about executing any sort of action that +can build one or more target Nodes (typically files) from one or more +source Nodes (also typically files) given a specific Environment. + +The base class here is ActionBase. The base class supplies just a few +OO utility methods and some generic methods for displaying information +about an Action in response to the various commands that control printing. + +A second-level base class is _ActionAction. This extends ActionBase +by providing the methods that can be used to show and perform an +action. True Action objects will subclass _ActionAction; Action +factory class objects will subclass ActionBase. + +The heavy lifting is handled by subclasses for the different types of +actions we might execute: + + CommandAction + CommandGeneratorAction + FunctionAction + ListAction + +The subclasses supply the following public interface methods used by +other modules: + + __call__() + THE public interface, "calling" an Action object executes the + command or Python function. This also takes care of printing + a pre-substitution command for debugging purposes. + + get_contents() + Fetches the "contents" of an Action for signature calculation + plus the varlist. This is what gets MD5 checksummed to decide + if a target needs to be rebuilt because its action changed. + + genstring() + Returns a string representation of the Action *without* + command substitution, but allows a CommandGeneratorAction to + generate the right action based on the specified target, + source and env. This is used by the Signature subsystem + (through the Executor) to obtain an (imprecise) representation + of the Action operation for informative purposes. + + +Subclasses also supply the following methods for internal use within +this module: + + __str__() + Returns a string approximation of the Action; no variable + substitution is performed. + + execute() + The internal method that really, truly, actually handles the + execution of a command or Python function. This is used so + that the __call__() methods can take care of displaying any + pre-substitution representations, and *then* execute an action + without worrying about the specific Actions involved. + + get_presig() + Fetches the "contents" of a subclass for signature calculation. + The varlist is added to this to produce the Action's contents. + + strfunction() + Returns a substituted string representation of the Action. + This is used by the _ActionAction.show() command to display the + command/function that will be executed to generate the target(s). + +There is a related independent ActionCaller class that looks like a +regular Action, and which serves as a wrapper for arbitrary functions +that we want to let the user specify the arguments to now, but actually +execute later (when an out-of-date check determines that it's needed to +be executed, for example). Objects of this class are returned by an +ActionFactory class that provides a __call__() method as a convenient +way for wrapping up the functions. + +""" + +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Action.py 2013/03/03 09:48:35 garyo" + +import SCons.compat + +import dis +import os +# compat layer imports "cPickle" for us if it's available. +import pickle +import re +import sys +import subprocess + +from SCons.Debug import logInstanceCreation +import SCons.Errors +import SCons.Executor +import SCons.Util +import SCons.Subst + +# we use these a lot, so try to optimize them +is_String = SCons.Util.is_String +is_List = SCons.Util.is_List + +class _null(object): + pass + +print_actions = 1 +execute_actions = 1 +print_actions_presub = 0 + +def rfile(n): + try: + return n.rfile() + except AttributeError: + return n + +def default_exitstatfunc(s): + return s + +try: + SET_LINENO = dis.SET_LINENO + HAVE_ARGUMENT = dis.HAVE_ARGUMENT +except AttributeError: + remove_set_lineno_codes = lambda x: x +else: + def remove_set_lineno_codes(code): + result = [] + n = len(code) + i = 0 + while i < n: + c = code[i] + op = ord(c) + if op >= HAVE_ARGUMENT: + if op != SET_LINENO: + result.append(code[i:i+3]) + i = i+3 + else: + result.append(c) + i = i+1 + return ''.join(result) + +strip_quotes = re.compile('^[\'"](.*)[\'"]$') + + +def _callable_contents(obj): + """Return the signature contents of a callable Python object. + """ + try: + # Test if obj is a method. + return _function_contents(obj.im_func) + + except AttributeError: + try: + # Test if obj is a callable object. + return _function_contents(obj.__call__.im_func) + + except AttributeError: + try: + # Test if obj is a code object. + return _code_contents(obj) + + except AttributeError: + # Test if obj is a function object. + return _function_contents(obj) + + +def _object_contents(obj): + """Return the signature contents of any Python object. + + We have to handle the case where object contains a code object + since it can be pickled directly. + """ + try: + # Test if obj is a method. + return _function_contents(obj.im_func) + + except AttributeError: + try: + # Test if obj is a callable object. + return _function_contents(obj.__call__.im_func) + + except AttributeError: + try: + # Test if obj is a code object. + return _code_contents(obj) + + except AttributeError: + try: + # Test if obj is a function object. + return _function_contents(obj) + + except AttributeError: + # Should be a pickable Python object. + try: + return pickle.dumps(obj) + except (pickle.PicklingError, TypeError): + # This is weird, but it seems that nested classes + # are unpickable. The Python docs say it should + # always be a PicklingError, but some Python + # versions seem to return TypeError. Just do + # the best we can. + return str(obj) + + +def _code_contents(code): + """Return the signature contents of a code object. + + By providing direct access to the code object of the + function, Python makes this extremely easy. Hooray! + + Unfortunately, older versions of Python include line + number indications in the compiled byte code. Boo! + So we remove the line number byte codes to prevent + recompilations from moving a Python function. + """ + + contents = [] + + # The code contents depends on the number of local variables + # but not their actual names. + contents.append("%s,%s" % (code.co_argcount, len(code.co_varnames))) + try: + contents.append(",%s,%s" % (len(code.co_cellvars), len(code.co_freevars))) + except AttributeError: + # Older versions of Python do not support closures. + contents.append(",0,0") + + # The code contents depends on any constants accessed by the + # function. Note that we have to call _object_contents on each + # constants because the code object of nested functions can + # show-up among the constants. + # + # Note that we also always ignore the first entry of co_consts + # which contains the function doc string. We assume that the + # function does not access its doc string. + contents.append(',(' + ','.join(map(_object_contents,code.co_consts[1:])) + ')') + + # The code contents depends on the variable names used to + # accessed global variable, as changing the variable name changes + # the variable actually accessed and therefore changes the + # function result. + contents.append(',(' + ','.join(map(_object_contents,code.co_names)) + ')') + + + # The code contents depends on its actual code!!! + contents.append(',(' + str(remove_set_lineno_codes(code.co_code)) + ')') + + return ''.join(contents) + + +def _function_contents(func): + """Return the signature contents of a function.""" + + contents = [_code_contents(func.func_code)] + + # The function contents depends on the value of defaults arguments + if func.func_defaults: + contents.append(',(' + ','.join(map(_object_contents,func.func_defaults)) + ')') + else: + contents.append(',()') + + # The function contents depends on the closure captured cell values. + try: + closure = func.func_closure or [] + except AttributeError: + # Older versions of Python do not support closures. + closure = [] + + #xxx = [_object_contents(x.cell_contents) for x in closure] + try: + xxx = [_object_contents(x.cell_contents) for x in closure] + except AttributeError: + xxx = [] + contents.append(',(' + ','.join(xxx) + ')') + + return ''.join(contents) + + +def _actionAppend(act1, act2): + # This function knows how to slap two actions together. + # Mainly, it handles ListActions by concatenating into + # a single ListAction. + a1 = Action(act1) + a2 = Action(act2) + if a1 is None: + return a2 + if a2 is None: + return a1 + if isinstance(a1, ListAction): + if isinstance(a2, ListAction): + return ListAction(a1.list + a2.list) + else: + return ListAction(a1.list + [ a2 ]) + else: + if isinstance(a2, ListAction): + return ListAction([ a1 ] + a2.list) + else: + return ListAction([ a1, a2 ]) + +def _do_create_keywords(args, kw): + """This converts any arguments after the action argument into + their equivalent keywords and adds them to the kw argument. + """ + v = kw.get('varlist', ()) + # prevent varlist="FOO" from being interpreted as ['F', 'O', 'O'] + if is_String(v): v = (v,) + kw['varlist'] = tuple(v) + if args: + # turn positional args into equivalent keywords + cmdstrfunc = args[0] + if cmdstrfunc is None or is_String(cmdstrfunc): + kw['cmdstr'] = cmdstrfunc + elif callable(cmdstrfunc): + kw['strfunction'] = cmdstrfunc + else: + raise SCons.Errors.UserError( + 'Invalid command display variable type. ' + 'You must either pass a string or a callback which ' + 'accepts (target, source, env) as parameters.') + if len(args) > 1: + kw['varlist'] = args[1:] + kw['varlist'] + if kw.get('strfunction', _null) is not _null \ + and kw.get('cmdstr', _null) is not _null: + raise SCons.Errors.UserError( + 'Cannot have both strfunction and cmdstr args to Action()') + +def _do_create_action(act, kw): + """This is the actual "implementation" for the + Action factory method, below. This handles the + fact that passing lists to Action() itself has + different semantics than passing lists as elements + of lists. + + The former will create a ListAction, the latter + will create a CommandAction by converting the inner + list elements to strings.""" + + if isinstance(act, ActionBase): + return act + + if is_List(act): + return CommandAction(act, **kw) + + if callable(act): + try: + gen = kw['generator'] + del kw['generator'] + except KeyError: + gen = 0 + if gen: + action_type = CommandGeneratorAction + else: + action_type = FunctionAction + return action_type(act, kw) + + if is_String(act): + var=SCons.Util.get_environment_var(act) + if var: + # This looks like a string that is purely an Environment + # variable reference, like "$FOO" or "${FOO}". We do + # something special here...we lazily evaluate the contents + # of that Environment variable, so a user could put something + # like a function or a CommandGenerator in that variable + # instead of a string. + return LazyAction(var, kw) + commands = str(act).split('\n') + if len(commands) == 1: + return CommandAction(commands[0], **kw) + # The list of string commands may include a LazyAction, so we + # reprocess them via _do_create_list_action. + return _do_create_list_action(commands, kw) + # Catch a common error case with a nice message: + if isinstance(act, int) or isinstance(act, float): + raise TypeError("Don't know how to create an Action from a number (%s)"%act) + # Else fail silently (???) + return None + +def _do_create_list_action(act, kw): + """A factory for list actions. Convert the input list into Actions + and then wrap them in a ListAction.""" + acts = [] + for a in act: + aa = _do_create_action(a, kw) + if aa is not None: acts.append(aa) + if not acts: + return ListAction([]) + elif len(acts) == 1: + return acts[0] + else: + return ListAction(acts) + +def Action(act, *args, **kw): + """A factory for action objects.""" + # Really simple: the _do_create_* routines do the heavy lifting. + _do_create_keywords(args, kw) + if is_List(act): + return _do_create_list_action(act, kw) + return _do_create_action(act, kw) + +class ActionBase(object): + """Base class for all types of action objects that can be held by + other objects (Builders, Executors, etc.) This provides the + common methods for manipulating and combining those actions.""" + + def __cmp__(self, other): + return cmp(self.__dict__, other) + + def no_batch_key(self, env, target, source): + return None + + batch_key = no_batch_key + + def genstring(self, target, source, env): + return str(self) + + def get_contents(self, target, source, env): + result = [ self.get_presig(target, source, env) ] + # This should never happen, as the Action() factory should wrap + # the varlist, but just in case an action is created directly, + # we duplicate this check here. + vl = self.get_varlist(target, source, env) + if is_String(vl): vl = (vl,) + for v in vl: + result.append(env.subst('${'+v+'}')) + return ''.join(result) + + def __add__(self, other): + return _actionAppend(self, other) + + def __radd__(self, other): + return _actionAppend(other, self) + + def presub_lines(self, env): + # CommandGeneratorAction needs a real environment + # in order to return the proper string here, since + # it may call LazyAction, which looks up a key + # in that env. So we temporarily remember the env here, + # and CommandGeneratorAction will use this env + # when it calls its _generate method. + self.presub_env = env + lines = str(self).split('\n') + self.presub_env = None # don't need this any more + return lines + + def get_varlist(self, target, source, env, executor=None): + return self.varlist + + def get_targets(self, env, executor): + """ + Returns the type of targets ($TARGETS, $CHANGED_TARGETS) used + by this action. + """ + return self.targets + +class _ActionAction(ActionBase): + """Base class for actions that create output objects.""" + def __init__(self, cmdstr=_null, strfunction=_null, varlist=(), + presub=_null, chdir=None, exitstatfunc=None, + batch_key=None, targets='$TARGETS', + **kw): + self.cmdstr = cmdstr + if strfunction is not _null: + if strfunction is None: + self.cmdstr = None + else: + self.strfunction = strfunction + self.varlist = varlist + self.presub = presub + self.chdir = chdir + if not exitstatfunc: + exitstatfunc = default_exitstatfunc + self.exitstatfunc = exitstatfunc + + self.targets = targets + + if batch_key: + if not callable(batch_key): + # They have set batch_key, but not to their own + # callable. The default behavior here will batch + # *all* targets+sources using this action, separated + # for each construction environment. + def default_batch_key(self, env, target, source): + return (id(self), id(env)) + batch_key = default_batch_key + SCons.Util.AddMethod(self, batch_key, 'batch_key') + + def print_cmd_line(self, s, target, source, env): + # In python 3, and in some of our tests, sys.stdout is + # a String io object, and it takes unicode strings only + # In other cases it's a regular Python 2.x file object + # which takes strings (bytes), and if you pass those a + # unicode object they try to decode with 'ascii' codec + # which fails if the cmd line has any hi-bit-set chars. + # This code assumes s is a regular string, but should + # work if it's unicode too. + try: + sys.stdout.write(unicode(s + "\n")) + except UnicodeDecodeError: + sys.stdout.write(s + "\n") + + def __call__(self, target, source, env, + exitstatfunc=_null, + presub=_null, + show=_null, + execute=_null, + chdir=_null, + executor=None): + if not is_List(target): + target = [target] + if not is_List(source): + source = [source] + + if presub is _null: + presub = self.presub + if presub is _null: + presub = print_actions_presub + if exitstatfunc is _null: exitstatfunc = self.exitstatfunc + if show is _null: show = print_actions + if execute is _null: execute = execute_actions + if chdir is _null: chdir = self.chdir + save_cwd = None + if chdir: + save_cwd = os.getcwd() + try: + chdir = str(chdir.abspath) + except AttributeError: + if not is_String(chdir): + if executor: + chdir = str(executor.batches[0].targets[0].dir) + else: + chdir = str(target[0].dir) + if presub: + if executor: + target = executor.get_all_targets() + source = executor.get_all_sources() + t = ' and '.join(map(str, target)) + l = '\n '.join(self.presub_lines(env)) + out = u"Building %s with action:\n %s\n" % (t, l) + sys.stdout.write(out) + cmd = None + if show and self.strfunction: + if executor: + target = executor.get_all_targets() + source = executor.get_all_sources() + try: + cmd = self.strfunction(target, source, env, executor) + except TypeError: + cmd = self.strfunction(target, source, env) + if cmd: + if chdir: + cmd = ('os.chdir(%s)\n' % repr(chdir)) + cmd + try: + get = env.get + except AttributeError: + print_func = self.print_cmd_line + else: + print_func = get('PRINT_CMD_LINE_FUNC') + if not print_func: + print_func = self.print_cmd_line + print_func(cmd, target, source, env) + stat = 0 + if execute: + if chdir: + os.chdir(chdir) + try: + stat = self.execute(target, source, env, executor=executor) + if isinstance(stat, SCons.Errors.BuildError): + s = exitstatfunc(stat.status) + if s: + stat.status = s + else: + stat = s + else: + stat = exitstatfunc(stat) + finally: + if save_cwd: + os.chdir(save_cwd) + if cmd and save_cwd: + print_func('os.chdir(%s)' % repr(save_cwd), target, source, env) + + return stat + + +def _string_from_cmd_list(cmd_list): + """Takes a list of command line arguments and returns a pretty + representation for printing.""" + cl = [] + for arg in map(str, cmd_list): + if ' ' in arg or '\t' in arg: + arg = '"' + arg + '"' + cl.append(arg) + return ' '.join(cl) + +# A fiddlin' little function that has an 'import SCons.Environment' which +# can't be moved to the top level without creating an import loop. Since +# this import creates a local variable named 'SCons', it blocks access to +# the global variable, so we move it here to prevent complaints about local +# variables being used uninitialized. +default_ENV = None +def get_default_ENV(env): + global default_ENV + try: + return env['ENV'] + except KeyError: + if not default_ENV: + import SCons.Environment + # This is a hideously expensive way to get a default shell + # environment. What it really should do is run the platform + # setup to get the default ENV. Fortunately, it's incredibly + # rare for an Environment not to have a shell environment, so + # we're not going to worry about it overmuch. + default_ENV = SCons.Environment.Environment()['ENV'] + return default_ENV + +# This function is still in draft mode. We're going to need something like +# it in the long run as more and more places use subprocess, but I'm sure +# it'll have to be tweaked to get the full desired functionality. +# one special arg (so far?), 'error', to tell what to do with exceptions. +def _subproc(scons_env, cmd, error = 'ignore', **kw): + """Do common setup for a subprocess.Popen() call""" + # allow std{in,out,err} to be "'devnull'" + io = kw.get('stdin') + if is_String(io) and io == 'devnull': + kw['stdin'] = open(os.devnull) + io = kw.get('stdout') + if is_String(io) and io == 'devnull': + kw['stdout'] = open(os.devnull, 'w') + io = kw.get('stderr') + if is_String(io) and io == 'devnull': + kw['stderr'] = open(os.devnull, 'w') + + # Figure out what shell environment to use + ENV = kw.get('env', None) + if ENV is None: ENV = get_default_ENV(scons_env) + + # Ensure that the ENV values are all strings: + new_env = {} + for key, value in ENV.items(): + if is_List(value): + # If the value is a list, then we assume it is a path list, + # because that's a pretty common list-like value to stick + # in an environment variable: + value = SCons.Util.flatten_sequence(value) + new_env[key] = os.pathsep.join(map(str, value)) + else: + # It's either a string or something else. If it's a string, + # we still want to call str() because it might be a *Unicode* + # string, which makes subprocess.Popen() gag. If it isn't a + # string or a list, then we just coerce it to a string, which + # is the proper way to handle Dir and File instances and will + # produce something reasonable for just about everything else: + new_env[key] = str(value) + kw['env'] = new_env + + try: + return subprocess.Popen(cmd, **kw) + except EnvironmentError, e: + if error == 'raise': raise + # return a dummy Popen instance that only returns error + class dummyPopen(object): + def __init__(self, e): self.exception = e + def communicate(self): return ('','') + def wait(self): return -self.exception.errno + stdin = None + class f(object): + def read(self): return '' + def readline(self): return '' + stdout = stderr = f() + return dummyPopen(e) + +class CommandAction(_ActionAction): + """Class for command-execution actions.""" + def __init__(self, cmd, **kw): + # Cmd can actually be a list or a single item; if it's a + # single item it should be the command string to execute; if a + # list then it should be the words of the command string to + # execute. Only a single command should be executed by this + # object; lists of commands should be handled by embedding + # these objects in a ListAction object (which the Action() + # factory above does). cmd will be passed to + # Environment.subst_list() for substituting environment + # variables. + if __debug__: logInstanceCreation(self, 'Action.CommandAction') + + _ActionAction.__init__(self, **kw) + if is_List(cmd): + if list(filter(is_List, cmd)): + raise TypeError("CommandAction should be given only " \ + "a single command") + self.cmd_list = cmd + + def __str__(self): + if is_List(self.cmd_list): + return ' '.join(map(str, self.cmd_list)) + return str(self.cmd_list) + + def process(self, target, source, env, executor=None): + if executor: + result = env.subst_list(self.cmd_list, 0, executor=executor) + else: + result = env.subst_list(self.cmd_list, 0, target, source) + silent = None + ignore = None + while True: + try: c = result[0][0][0] + except IndexError: c = None + if c == '@': silent = 1 + elif c == '-': ignore = 1 + else: break + result[0][0] = result[0][0][1:] + try: + if not result[0][0]: + result[0] = result[0][1:] + except IndexError: + pass + return result, ignore, silent + + def strfunction(self, target, source, env, executor=None): + if self.cmdstr is None: + return None + if self.cmdstr is not _null: + from SCons.Subst import SUBST_RAW + if executor: + c = env.subst(self.cmdstr, SUBST_RAW, executor=executor) + else: + c = env.subst(self.cmdstr, SUBST_RAW, target, source) + if c: + return c + cmd_list, ignore, silent = self.process(target, source, env, executor) + if silent: + return '' + return _string_from_cmd_list(cmd_list[0]) + + def execute(self, target, source, env, executor=None): + """Execute a command action. + + This will handle lists of commands as well as individual commands, + because construction variable substitution may turn a single + "command" into a list. This means that this class can actually + handle lists of commands, even though that's not how we use it + externally. + """ + escape_list = SCons.Subst.escape_list + flatten_sequence = SCons.Util.flatten_sequence + + try: + shell = env['SHELL'] + except KeyError: + raise SCons.Errors.UserError('Missing SHELL construction variable.') + + try: + spawn = env['SPAWN'] + except KeyError: + raise SCons.Errors.UserError('Missing SPAWN construction variable.') + else: + if is_String(spawn): + spawn = env.subst(spawn, raw=1, conv=lambda x: x) + + escape = env.get('ESCAPE', lambda x: x) + + ENV = get_default_ENV(env) + + # Ensure that the ENV values are all strings: + for key, value in ENV.items(): + if not is_String(value): + if is_List(value): + # If the value is a list, then we assume it is a + # path list, because that's a pretty common list-like + # value to stick in an environment variable: + value = flatten_sequence(value) + ENV[key] = os.pathsep.join(map(str, value)) + else: + # If it isn't a string or a list, then we just coerce + # it to a string, which is the proper way to handle + # Dir and File instances and will produce something + # reasonable for just about everything else: + ENV[key] = str(value) + + if executor: + target = executor.get_all_targets() + source = executor.get_all_sources() + cmd_list, ignore, silent = self.process(target, list(map(rfile, source)), env, executor) + + # Use len() to filter out any "command" that's zero-length. + for cmd_line in filter(len, cmd_list): + # Escape the command line for the interpreter we are using. + cmd_line = escape_list(cmd_line, escape) + result = spawn(shell, escape, cmd_line[0], cmd_line, ENV) + if not ignore and result: + msg = "Error %s" % result + return SCons.Errors.BuildError(errstr=msg, + status=result, + action=self, + command=cmd_line) + return 0 + + def get_presig(self, target, source, env, executor=None): + """Return the signature contents of this action's command line. + + This strips $(-$) and everything in between the string, + since those parts don't affect signatures. + """ + from SCons.Subst import SUBST_SIG + cmd = self.cmd_list + if is_List(cmd): + cmd = ' '.join(map(str, cmd)) + else: + cmd = str(cmd) + if executor: + return env.subst_target_source(cmd, SUBST_SIG, executor=executor) + else: + return env.subst_target_source(cmd, SUBST_SIG, target, source) + + def get_implicit_deps(self, target, source, env, executor=None): + icd = env.get('IMPLICIT_COMMAND_DEPENDENCIES', True) + if is_String(icd) and icd[:1] == '$': + icd = env.subst(icd) + if not icd or icd in ('0', 'None'): + return [] + from SCons.Subst import SUBST_SIG + if executor: + cmd_list = env.subst_list(self.cmd_list, SUBST_SIG, executor=executor) + else: + cmd_list = env.subst_list(self.cmd_list, SUBST_SIG, target, source) + res = [] + for cmd_line in cmd_list: + if cmd_line: + d = str(cmd_line[0]) + m = strip_quotes.match(d) + if m: + d = m.group(1) + d = env.WhereIs(d) + if d: + res.append(env.fs.File(d)) + return res + +class CommandGeneratorAction(ActionBase): + """Class for command-generator actions.""" + def __init__(self, generator, kw): + if __debug__: logInstanceCreation(self, 'Action.CommandGeneratorAction') + self.generator = generator + self.gen_kw = kw + self.varlist = kw.get('varlist', ()) + self.targets = kw.get('targets', '$TARGETS') + + def _generate(self, target, source, env, for_signature, executor=None): + # ensure that target is a list, to make it easier to write + # generator functions: + if not is_List(target): + target = [target] + + if executor: + target = executor.get_all_targets() + source = executor.get_all_sources() + ret = self.generator(target=target, + source=source, + env=env, + for_signature=for_signature) + gen_cmd = Action(ret, **self.gen_kw) + if not gen_cmd: + raise SCons.Errors.UserError("Object returned from command generator: %s cannot be used to create an Action." % repr(ret)) + return gen_cmd + + def __str__(self): + try: + env = self.presub_env + except AttributeError: + env = None + if env is None: + env = SCons.Defaults.DefaultEnvironment() + act = self._generate([], [], env, 1) + return str(act) + + def batch_key(self, env, target, source): + return self._generate(target, source, env, 1).batch_key(env, target, source) + + def genstring(self, target, source, env, executor=None): + return self._generate(target, source, env, 1, executor).genstring(target, source, env) + + def __call__(self, target, source, env, exitstatfunc=_null, presub=_null, + show=_null, execute=_null, chdir=_null, executor=None): + act = self._generate(target, source, env, 0, executor) + if act is None: + raise SCons.Errors.UserError("While building `%s': " + "Cannot deduce file extension from source files: %s" + % (repr(list(map(str, target))), repr(list(map(str, source))))) + return act(target, source, env, exitstatfunc, presub, + show, execute, chdir, executor) + + def get_presig(self, target, source, env, executor=None): + """Return the signature contents of this action's command line. + + This strips $(-$) and everything in between the string, + since those parts don't affect signatures. + """ + return self._generate(target, source, env, 1, executor).get_presig(target, source, env) + + def get_implicit_deps(self, target, source, env, executor=None): + return self._generate(target, source, env, 1, executor).get_implicit_deps(target, source, env) + + def get_varlist(self, target, source, env, executor=None): + return self._generate(target, source, env, 1, executor).get_varlist(target, source, env, executor) + + def get_targets(self, env, executor): + return self._generate(None, None, env, 1, executor).get_targets(env, executor) + + + +# A LazyAction is a kind of hybrid generator and command action for +# strings of the form "$VAR". These strings normally expand to other +# strings (think "$CCCOM" to "$CC -c -o $TARGET $SOURCE"), but we also +# want to be able to replace them with functions in the construction +# environment. Consequently, we want lazy evaluation and creation of +# an Action in the case of the function, but that's overkill in the more +# normal case of expansion to other strings. +# +# So we do this with a subclass that's both a generator *and* +# a command action. The overridden methods all do a quick check +# of the construction variable, and if it's a string we just call +# the corresponding CommandAction method to do the heavy lifting. +# If not, then we call the same-named CommandGeneratorAction method. +# The CommandGeneratorAction methods work by using the overridden +# _generate() method, that is, our own way of handling "generation" of +# an action based on what's in the construction variable. + +class LazyAction(CommandGeneratorAction, CommandAction): + + def __init__(self, var, kw): + if __debug__: logInstanceCreation(self, 'Action.LazyAction') + #FUTURE CommandAction.__init__(self, '${'+var+'}', **kw) + CommandAction.__init__(self, '${'+var+'}', **kw) + self.var = SCons.Util.to_String(var) + self.gen_kw = kw + + def get_parent_class(self, env): + c = env.get(self.var) + if is_String(c) and not '\n' in c: + return CommandAction + return CommandGeneratorAction + + def _generate_cache(self, env): + if env: + c = env.get(self.var, '') + else: + c = '' + gen_cmd = Action(c, **self.gen_kw) + if not gen_cmd: + raise SCons.Errors.UserError("$%s value %s cannot be used to create an Action." % (self.var, repr(c))) + return gen_cmd + + def _generate(self, target, source, env, for_signature, executor=None): + return self._generate_cache(env) + + def __call__(self, target, source, env, *args, **kw): + c = self.get_parent_class(env) + return c.__call__(self, target, source, env, *args, **kw) + + def get_presig(self, target, source, env): + c = self.get_parent_class(env) + return c.get_presig(self, target, source, env) + + def get_varlist(self, target, source, env, executor=None): + c = self.get_parent_class(env) + return c.get_varlist(self, target, source, env, executor) + + +class FunctionAction(_ActionAction): + """Class for Python function actions.""" + + def __init__(self, execfunction, kw): + if __debug__: logInstanceCreation(self, 'Action.FunctionAction') + + self.execfunction = execfunction + try: + self.funccontents = _callable_contents(execfunction) + except AttributeError: + try: + # See if execfunction will do the heavy lifting for us. + self.gc = execfunction.get_contents + except AttributeError: + # This is weird, just do the best we can. + self.funccontents = _object_contents(execfunction) + + _ActionAction.__init__(self, **kw) + + def function_name(self): + try: + return self.execfunction.__name__ + except AttributeError: + try: + return self.execfunction.__class__.__name__ + except AttributeError: + return "unknown_python_function" + + def strfunction(self, target, source, env, executor=None): + if self.cmdstr is None: + return None + if self.cmdstr is not _null: + from SCons.Subst import SUBST_RAW + if executor: + c = env.subst(self.cmdstr, SUBST_RAW, executor=executor) + else: + c = env.subst(self.cmdstr, SUBST_RAW, target, source) + if c: + return c + def array(a): + def quote(s): + try: + str_for_display = s.str_for_display + except AttributeError: + s = repr(s) + else: + s = str_for_display() + return s + return '[' + ", ".join(map(quote, a)) + ']' + try: + strfunc = self.execfunction.strfunction + except AttributeError: + pass + else: + if strfunc is None: + return None + if callable(strfunc): + return strfunc(target, source, env) + name = self.function_name() + tstr = array(target) + sstr = array(source) + return "%s(%s, %s)" % (name, tstr, sstr) + + def __str__(self): + name = self.function_name() + if name == 'ActionCaller': + return str(self.execfunction) + return "%s(target, source, env)" % name + + def execute(self, target, source, env, executor=None): + exc_info = (None,None,None) + try: + if executor: + target = executor.get_all_targets() + source = executor.get_all_sources() + rsources = list(map(rfile, source)) + try: + result = self.execfunction(target=target, source=rsources, env=env) + except KeyboardInterrupt, e: + raise + except SystemExit, e: + raise + except Exception, e: + result = e + exc_info = sys.exc_info() + + if result: + result = SCons.Errors.convert_to_BuildError(result, exc_info) + result.node=target + result.action=self + try: + result.command=self.strfunction(target, source, env, executor) + except TypeError: + result.command=self.strfunction(target, source, env) + + # FIXME: This maintains backward compatibility with respect to + # which type of exceptions were returned by raising an + # exception and which ones were returned by value. It would + # probably be best to always return them by value here, but + # some codes do not check the return value of Actions and I do + # not have the time to modify them at this point. + if (exc_info[1] and + not isinstance(exc_info[1],EnvironmentError)): + raise result + + return result + finally: + # Break the cycle between the traceback object and this + # function stack frame. See the sys.exc_info() doc info for + # more information about this issue. + del exc_info + + + def get_presig(self, target, source, env): + """Return the signature contents of this callable action.""" + try: + return self.gc(target, source, env) + except AttributeError: + return self.funccontents + + def get_implicit_deps(self, target, source, env): + return [] + +class ListAction(ActionBase): + """Class for lists of other actions.""" + def __init__(self, actionlist): + if __debug__: logInstanceCreation(self, 'Action.ListAction') + def list_of_actions(x): + if isinstance(x, ActionBase): + return x + return Action(x) + self.list = list(map(list_of_actions, actionlist)) + # our children will have had any varlist + # applied; we don't need to do it again + self.varlist = () + self.targets = '$TARGETS' + + def genstring(self, target, source, env): + return '\n'.join([a.genstring(target, source, env) for a in self.list]) + + def __str__(self): + return '\n'.join(map(str, self.list)) + + def presub_lines(self, env): + return SCons.Util.flatten_sequence( + [a.presub_lines(env) for a in self.list]) + + def get_presig(self, target, source, env): + """Return the signature contents of this action list. + + Simple concatenation of the signatures of the elements. + """ + return "".join([x.get_contents(target, source, env) for x in self.list]) + + def __call__(self, target, source, env, exitstatfunc=_null, presub=_null, + show=_null, execute=_null, chdir=_null, executor=None): + if executor: + target = executor.get_all_targets() + source = executor.get_all_sources() + for act in self.list: + stat = act(target, source, env, exitstatfunc, presub, + show, execute, chdir, executor) + if stat: + return stat + return 0 + + def get_implicit_deps(self, target, source, env): + result = [] + for act in self.list: + result.extend(act.get_implicit_deps(target, source, env)) + return result + + def get_varlist(self, target, source, env, executor=None): + result = SCons.Util.OrderedDict() + for act in self.list: + for var in act.get_varlist(target, source, env, executor): + result[var] = True + return list(result.keys()) + +class ActionCaller(object): + """A class for delaying calling an Action function with specific + (positional and keyword) arguments until the Action is actually + executed. + + This class looks to the rest of the world like a normal Action object, + but what it's really doing is hanging on to the arguments until we + have a target, source and env to use for the expansion. + """ + def __init__(self, parent, args, kw): + self.parent = parent + self.args = args + self.kw = kw + + def get_contents(self, target, source, env): + actfunc = self.parent.actfunc + try: + # "self.actfunc" is a function. + contents = str(actfunc.func_code.co_code) + except AttributeError: + # "self.actfunc" is a callable object. + try: + contents = str(actfunc.__call__.im_func.func_code.co_code) + except AttributeError: + # No __call__() method, so it might be a builtin + # or something like that. Do the best we can. + contents = str(actfunc) + contents = remove_set_lineno_codes(contents) + return contents + + def subst(self, s, target, source, env): + # If s is a list, recursively apply subst() + # to every element in the list + if is_List(s): + result = [] + for elem in s: + result.append(self.subst(elem, target, source, env)) + return self.parent.convert(result) + + # Special-case hack: Let a custom function wrapped in an + # ActionCaller get at the environment through which the action + # was called by using this hard-coded value as a special return. + if s == '$__env__': + return env + elif is_String(s): + return env.subst(s, 1, target, source) + return self.parent.convert(s) + + def subst_args(self, target, source, env): + return [self.subst(x, target, source, env) for x in self.args] + + def subst_kw(self, target, source, env): + kw = {} + for key in self.kw.keys(): + kw[key] = self.subst(self.kw[key], target, source, env) + return kw + + def __call__(self, target, source, env, executor=None): + args = self.subst_args(target, source, env) + kw = self.subst_kw(target, source, env) + return self.parent.actfunc(*args, **kw) + + def strfunction(self, target, source, env): + args = self.subst_args(target, source, env) + kw = self.subst_kw(target, source, env) + return self.parent.strfunc(*args, **kw) + + def __str__(self): + return self.parent.strfunc(*self.args, **self.kw) + +class ActionFactory(object): + """A factory class that will wrap up an arbitrary function + as an SCons-executable Action object. + + The real heavy lifting here is done by the ActionCaller class. + We just collect the (positional and keyword) arguments that we're + called with and give them to the ActionCaller object we create, + so it can hang onto them until it needs them. + """ + def __init__(self, actfunc, strfunc, convert=lambda x: x): + self.actfunc = actfunc + self.strfunc = strfunc + self.convert = convert + + def __call__(self, *args, **kw): + ac = ActionCaller(self, args, kw) + action = Action(ac, strfunction=ac.strfunction) + return action + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Builder.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Builder.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Builder.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Builder.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,877 @@ +"""SCons.Builder + +Builder object subsystem. + +A Builder object is a callable that encapsulates information about how +to execute actions to create a target Node (file) from source Nodes +(files), and how to create those dependencies for tracking. + +The main entry point here is the Builder() factory method. This provides +a procedural interface that creates the right underlying Builder object +based on the keyword arguments supplied and the types of the arguments. + +The goal is for this external interface to be simple enough that the +vast majority of users can create new Builders as necessary to support +building new types of files in their configurations, without having to +dive any deeper into this subsystem. + +The base class here is BuilderBase. This is a concrete base class which +does, in fact, represent the Builder objects that we (or users) create. + +There is also a proxy that looks like a Builder: + + CompositeBuilder + + This proxies for a Builder with an action that is actually a + dictionary that knows how to map file suffixes to a specific + action. This is so that we can invoke different actions + (compilers, compile options) for different flavors of source + files. + +Builders and their proxies have the following public interface methods +used by other modules: + + __call__() + THE public interface. Calling a Builder object (with the + use of internal helper methods) sets up the target and source + dependencies, appropriate mapping to a specific action, and the + environment manipulation necessary for overridden construction + variable. This also takes care of warning about possible mistakes + in keyword arguments. + + add_emitter() + Adds an emitter for a specific file suffix, used by some Tool + modules to specify that (for example) a yacc invocation on a .y + can create a .h *and* a .c file. + + add_action() + Adds an action for a specific file suffix, heavily used by + Tool modules to add their specific action(s) for turning + a source file into an object file to the global static + and shared object file Builders. + +There are the following methods for internal use within this module: + + _execute() + The internal method that handles the heavily lifting when a + Builder is called. This is used so that the __call__() methods + can set up warning about possible mistakes in keyword-argument + overrides, and *then* execute all of the steps necessary so that + the warnings only occur once. + + get_name() + Returns the Builder's name within a specific Environment, + primarily used to try to return helpful information in error + messages. + + adjust_suffix() + get_prefix() + get_suffix() + get_src_suffix() + set_src_suffix() + Miscellaneous stuff for handling the prefix and suffix + manipulation we use in turning source file names into target + file names. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Builder.py 2013/03/03 09:48:35 garyo" + +import collections + +import SCons.Action +from SCons.Debug import logInstanceCreation +from SCons.Errors import InternalError, UserError +import SCons.Executor +import SCons.Memoize +import SCons.Node +import SCons.Node.FS +import SCons.Util +import SCons.Warnings + +class _Null(object): + pass + +_null = _Null + +def match_splitext(path, suffixes = []): + if suffixes: + matchsuf = [S for S in suffixes if path[-len(S):] == S] + if matchsuf: + suf = max([(len(_f),_f) for _f in matchsuf])[1] + return [path[:-len(suf)], path[-len(suf):]] + return SCons.Util.splitext(path) + +class DictCmdGenerator(SCons.Util.Selector): + """This is a callable class that can be used as a + command generator function. It holds on to a dictionary + mapping file suffixes to Actions. It uses that dictionary + to return the proper action based on the file suffix of + the source file.""" + + def __init__(self, dict=None, source_ext_match=1): + SCons.Util.Selector.__init__(self, dict) + self.source_ext_match = source_ext_match + + def src_suffixes(self): + return list(self.keys()) + + def add_action(self, suffix, action): + """Add a suffix-action pair to the mapping. + """ + self[suffix] = action + + def __call__(self, target, source, env, for_signature): + if not source: + return [] + + if self.source_ext_match: + suffixes = self.src_suffixes() + ext = None + for src in map(str, source): + my_ext = match_splitext(src, suffixes)[1] + if ext and my_ext != ext: + raise UserError("While building `%s' from `%s': Cannot build multiple sources with different extensions: %s, %s" + % (repr(list(map(str, target))), src, ext, my_ext)) + ext = my_ext + else: + ext = match_splitext(str(source[0]), self.src_suffixes())[1] + + if not ext: + #return ext + raise UserError("While building `%s': " + "Cannot deduce file extension from source files: %s" + % (repr(list(map(str, target))), repr(list(map(str, source))))) + + try: + ret = SCons.Util.Selector.__call__(self, env, source, ext) + except KeyError, e: + raise UserError("Ambiguous suffixes after environment substitution: %s == %s == %s" % (e.args[0], e.args[1], e.args[2])) + if ret is None: + raise UserError("While building `%s' from `%s': Don't know how to build from a source file with suffix `%s'. Expected a suffix in this list: %s." % \ + (repr(list(map(str, target))), repr(list(map(str, source))), ext, repr(list(self.keys())))) + return ret + +class CallableSelector(SCons.Util.Selector): + """A callable dictionary that will, in turn, call the value it + finds if it can.""" + def __call__(self, env, source): + value = SCons.Util.Selector.__call__(self, env, source) + if callable(value): + value = value(env, source) + return value + +class DictEmitter(SCons.Util.Selector): + """A callable dictionary that maps file suffixes to emitters. + When called, it finds the right emitter in its dictionary for the + suffix of the first source file, and calls that emitter to get the + right lists of targets and sources to return. If there's no emitter + for the suffix in its dictionary, the original target and source are + returned. + """ + def __call__(self, target, source, env): + emitter = SCons.Util.Selector.__call__(self, env, source) + if emitter: + target, source = emitter(target, source, env) + return (target, source) + +class ListEmitter(collections.UserList): + """A callable list of emitters that calls each in sequence, + returning the result. + """ + def __call__(self, target, source, env): + for e in self.data: + target, source = e(target, source, env) + return (target, source) + +# These are a common errors when calling a Builder; +# they are similar to the 'target' and 'source' keyword args to builders, +# so we issue warnings when we see them. The warnings can, of course, +# be disabled. +misleading_keywords = { + 'targets' : 'target', + 'sources' : 'source', +} + +class OverrideWarner(collections.UserDict): + """A class for warning about keyword arguments that we use as + overrides in a Builder call. + + This class exists to handle the fact that a single Builder call + can actually invoke multiple builders. This class only emits the + warnings once, no matter how many Builders are invoked. + """ + def __init__(self, dict): + collections.UserDict.__init__(self, dict) + if __debug__: logInstanceCreation(self, 'Builder.OverrideWarner') + self.already_warned = None + def warn(self): + if self.already_warned: + return + for k in self.keys(): + if k in misleading_keywords: + alt = misleading_keywords[k] + msg = "Did you mean to use `%s' instead of `%s'?" % (alt, k) + SCons.Warnings.warn(SCons.Warnings.MisleadingKeywordsWarning, msg) + self.already_warned = 1 + +def Builder(**kw): + """A factory for builder objects.""" + composite = None + if 'generator' in kw: + if 'action' in kw: + raise UserError("You must not specify both an action and a generator.") + kw['action'] = SCons.Action.CommandGeneratorAction(kw['generator'], {}) + del kw['generator'] + elif 'action' in kw: + source_ext_match = kw.get('source_ext_match', 1) + if 'source_ext_match' in kw: + del kw['source_ext_match'] + if SCons.Util.is_Dict(kw['action']): + composite = DictCmdGenerator(kw['action'], source_ext_match) + kw['action'] = SCons.Action.CommandGeneratorAction(composite, {}) + kw['src_suffix'] = composite.src_suffixes() + else: + kw['action'] = SCons.Action.Action(kw['action']) + + if 'emitter' in kw: + emitter = kw['emitter'] + if SCons.Util.is_String(emitter): + # This allows users to pass in an Environment + # variable reference (like "$FOO") as an emitter. + # We will look in that Environment variable for + # a callable to use as the actual emitter. + var = SCons.Util.get_environment_var(emitter) + if not var: + raise UserError("Supplied emitter '%s' does not appear to refer to an Environment variable" % emitter) + kw['emitter'] = EmitterProxy(var) + elif SCons.Util.is_Dict(emitter): + kw['emitter'] = DictEmitter(emitter) + elif SCons.Util.is_List(emitter): + kw['emitter'] = ListEmitter(emitter) + + result = BuilderBase(**kw) + + if not composite is None: + result = CompositeBuilder(result, composite) + + return result + +def _node_errors(builder, env, tlist, slist): + """Validate that the lists of target and source nodes are + legal for this builder and environment. Raise errors or + issue warnings as appropriate. + """ + + # First, figure out if there are any errors in the way the targets + # were specified. + for t in tlist: + if t.side_effect: + raise UserError("Multiple ways to build the same target were specified for: %s" % t) + if t.has_explicit_builder(): + if not t.env is None and not t.env is env: + action = t.builder.action + t_contents = action.get_contents(tlist, slist, t.env) + contents = action.get_contents(tlist, slist, env) + + if t_contents == contents: + msg = "Two different environments were specified for target %s,\n\tbut they appear to have the same action: %s" % (t, action.genstring(tlist, slist, t.env)) + SCons.Warnings.warn(SCons.Warnings.DuplicateEnvironmentWarning, msg) + else: + msg = "Two environments with different actions were specified for the same target: %s" % t + raise UserError(msg) + if builder.multi: + if t.builder != builder: + msg = "Two different builders (%s and %s) were specified for the same target: %s" % (t.builder.get_name(env), builder.get_name(env), t) + raise UserError(msg) + # TODO(batch): list constructed each time! + if t.get_executor().get_all_targets() != tlist: + msg = "Two different target lists have a target in common: %s (from %s and from %s)" % (t, list(map(str, t.get_executor().get_all_targets())), list(map(str, tlist))) + raise UserError(msg) + elif t.sources != slist: + msg = "Multiple ways to build the same target were specified for: %s (from %s and from %s)" % (t, list(map(str, t.sources)), list(map(str, slist))) + raise UserError(msg) + + if builder.single_source: + if len(slist) > 1: + raise UserError("More than one source given for single-source builder: targets=%s sources=%s" % (list(map(str,tlist)), list(map(str,slist)))) + +class EmitterProxy(object): + """This is a callable class that can act as a + Builder emitter. It holds on to a string that + is a key into an Environment dictionary, and will + look there at actual build time to see if it holds + a callable. If so, we will call that as the actual + emitter.""" + def __init__(self, var): + self.var = SCons.Util.to_String(var) + + def __call__(self, target, source, env): + emitter = self.var + + # Recursively substitute the variable. + # We can't use env.subst() because it deals only + # in strings. Maybe we should change that? + while SCons.Util.is_String(emitter) and emitter in env: + emitter = env[emitter] + if callable(emitter): + target, source = emitter(target, source, env) + elif SCons.Util.is_List(emitter): + for e in emitter: + target, source = e(target, source, env) + + return (target, source) + + + def __cmp__(self, other): + return cmp(self.var, other.var) + +class BuilderBase(object): + """Base class for Builders, objects that create output + nodes (files) from input nodes (files). + """ + + if SCons.Memoize.use_memoizer: + __metaclass__ = SCons.Memoize.Memoized_Metaclass + + memoizer_counters = [] + + def __init__(self, action = None, + prefix = '', + suffix = '', + src_suffix = '', + target_factory = None, + source_factory = None, + target_scanner = None, + source_scanner = None, + emitter = None, + multi = 0, + env = None, + single_source = 0, + name = None, + chdir = _null, + is_explicit = 1, + src_builder = None, + ensure_suffix = False, + **overrides): + if __debug__: logInstanceCreation(self, 'Builder.BuilderBase') + self._memo = {} + self.action = action + self.multi = multi + if SCons.Util.is_Dict(prefix): + prefix = CallableSelector(prefix) + self.prefix = prefix + if SCons.Util.is_Dict(suffix): + suffix = CallableSelector(suffix) + self.env = env + self.single_source = single_source + if 'overrides' in overrides: + SCons.Warnings.warn(SCons.Warnings.DeprecatedBuilderKeywordsWarning, + "The \"overrides\" keyword to Builder() creation has been deprecated;\n" +\ + "\tspecify the items as keyword arguments to the Builder() call instead.") + overrides.update(overrides['overrides']) + del overrides['overrides'] + if 'scanner' in overrides: + SCons.Warnings.warn(SCons.Warnings.DeprecatedBuilderKeywordsWarning, + "The \"scanner\" keyword to Builder() creation has been deprecated;\n" + "\tuse: source_scanner or target_scanner as appropriate.") + del overrides['scanner'] + self.overrides = overrides + + self.set_suffix(suffix) + self.set_src_suffix(src_suffix) + self.ensure_suffix = ensure_suffix + + self.target_factory = target_factory + self.source_factory = source_factory + self.target_scanner = target_scanner + self.source_scanner = source_scanner + + self.emitter = emitter + + # Optional Builder name should only be used for Builders + # that don't get attached to construction environments. + if name: + self.name = name + self.executor_kw = {} + if not chdir is _null: + self.executor_kw['chdir'] = chdir + self.is_explicit = is_explicit + + if src_builder is None: + src_builder = [] + elif not SCons.Util.is_List(src_builder): + src_builder = [ src_builder ] + self.src_builder = src_builder + + def __nonzero__(self): + raise InternalError("Do not test for the Node.builder attribute directly; use Node.has_builder() instead") + + def get_name(self, env): + """Attempts to get the name of the Builder. + + Look at the BUILDERS variable of env, expecting it to be a + dictionary containing this Builder, and return the key of the + dictionary. If there's no key, then return a directly-configured + name (if there is one) or the name of the class (by default).""" + + try: + index = list(env['BUILDERS'].values()).index(self) + return list(env['BUILDERS'].keys())[index] + except (AttributeError, KeyError, TypeError, ValueError): + try: + return self.name + except AttributeError: + return str(self.__class__) + + def __cmp__(self, other): + return cmp(self.__dict__, other.__dict__) + + def splitext(self, path, env=None): + if not env: + env = self.env + if env: + suffixes = self.src_suffixes(env) + else: + suffixes = [] + return match_splitext(path, suffixes) + + def _adjustixes(self, files, pre, suf, ensure_suffix=False): + if not files: + return [] + result = [] + if not SCons.Util.is_List(files): + files = [files] + + for f in files: + if SCons.Util.is_String(f): + f = SCons.Util.adjustixes(f, pre, suf, ensure_suffix) + result.append(f) + return result + + def _create_nodes(self, env, target = None, source = None): + """Create and return lists of target and source nodes. + """ + src_suf = self.get_src_suffix(env) + + target_factory = env.get_factory(self.target_factory) + source_factory = env.get_factory(self.source_factory) + + source = self._adjustixes(source, None, src_suf) + slist = env.arg2nodes(source, source_factory) + + pre = self.get_prefix(env, slist) + suf = self.get_suffix(env, slist) + + if target is None: + try: + t_from_s = slist[0].target_from_source + except AttributeError: + raise UserError("Do not know how to create a target from source `%s'" % slist[0]) + except IndexError: + tlist = [] + else: + splitext = lambda S: self.splitext(S,env) + tlist = [ t_from_s(pre, suf, splitext) ] + else: + target = self._adjustixes(target, pre, suf, self.ensure_suffix) + tlist = env.arg2nodes(target, target_factory, target=target, source=source) + + if self.emitter: + # The emitter is going to do str(node), but because we're + # being called *from* a builder invocation, the new targets + # don't yet have a builder set on them and will look like + # source files. Fool the emitter's str() calls by setting + # up a temporary builder on the new targets. + new_targets = [] + for t in tlist: + if not t.is_derived(): + t.builder_set(self) + new_targets.append(t) + + orig_tlist = tlist[:] + orig_slist = slist[:] + + target, source = self.emitter(target=tlist, source=slist, env=env) + + # Now delete the temporary builders that we attached to any + # new targets, so that _node_errors() doesn't do weird stuff + # to them because it thinks they already have builders. + for t in new_targets: + if t.builder is self: + # Only delete the temporary builder if the emitter + # didn't change it on us. + t.builder_set(None) + + # Have to call arg2nodes yet again, since it is legal for + # emitters to spit out strings as well as Node instances. + tlist = env.arg2nodes(target, target_factory, + target=orig_tlist, source=orig_slist) + slist = env.arg2nodes(source, source_factory, + target=orig_tlist, source=orig_slist) + + return tlist, slist + + def _execute(self, env, target, source, overwarn={}, executor_kw={}): + # We now assume that target and source are lists or None. + if self.src_builder: + source = self.src_builder_sources(env, source, overwarn) + + if self.single_source and len(source) > 1 and target is None: + result = [] + if target is None: target = [None]*len(source) + for tgt, src in zip(target, source): + if not tgt is None: tgt = [tgt] + if not src is None: src = [src] + result.extend(self._execute(env, tgt, src, overwarn)) + return SCons.Node.NodeList(result) + + overwarn.warn() + + tlist, slist = self._create_nodes(env, target, source) + + # Check for errors with the specified target/source lists. + _node_errors(self, env, tlist, slist) + + # The targets are fine, so find or make the appropriate Executor to + # build this particular list of targets from this particular list of + # sources. + + executor = None + key = None + + if self.multi: + try: + executor = tlist[0].get_executor(create = 0) + except (AttributeError, IndexError): + pass + else: + executor.add_sources(slist) + + if executor is None: + if not self.action: + fmt = "Builder %s must have an action to build %s." + raise UserError(fmt % (self.get_name(env or self.env), + list(map(str,tlist)))) + key = self.action.batch_key(env or self.env, tlist, slist) + if key: + try: + executor = SCons.Executor.GetBatchExecutor(key) + except KeyError: + pass + else: + executor.add_batch(tlist, slist) + + if executor is None: + executor = SCons.Executor.Executor(self.action, env, [], + tlist, slist, executor_kw) + if key: + SCons.Executor.AddBatchExecutor(key, executor) + + # Now set up the relevant information in the target Nodes themselves. + for t in tlist: + t.cwd = env.fs.getcwd() + t.builder_set(self) + t.env_set(env) + t.add_source(slist) + t.set_executor(executor) + t.set_explicit(self.is_explicit) + + return SCons.Node.NodeList(tlist) + + def __call__(self, env, target=None, source=None, chdir=_null, **kw): + # We now assume that target and source are lists or None. + # The caller (typically Environment.BuilderWrapper) is + # responsible for converting any scalar values to lists. + if chdir is _null: + ekw = self.executor_kw + else: + ekw = self.executor_kw.copy() + ekw['chdir'] = chdir + if kw: + if 'srcdir' in kw: + def prependDirIfRelative(f, srcdir=kw['srcdir']): + import os.path + if SCons.Util.is_String(f) and not os.path.isabs(f): + f = os.path.join(srcdir, f) + return f + if not SCons.Util.is_List(source): + source = [source] + source = list(map(prependDirIfRelative, source)) + del kw['srcdir'] + if self.overrides: + env_kw = self.overrides.copy() + env_kw.update(kw) + else: + env_kw = kw + else: + env_kw = self.overrides + env = env.Override(env_kw) + return self._execute(env, target, source, OverrideWarner(kw), ekw) + + def adjust_suffix(self, suff): + if suff and not suff[0] in [ '.', '_', '$' ]: + return '.' + suff + return suff + + def get_prefix(self, env, sources=[]): + prefix = self.prefix + if callable(prefix): + prefix = prefix(env, sources) + return env.subst(prefix) + + def set_suffix(self, suffix): + if not callable(suffix): + suffix = self.adjust_suffix(suffix) + self.suffix = suffix + + def get_suffix(self, env, sources=[]): + suffix = self.suffix + if callable(suffix): + suffix = suffix(env, sources) + return env.subst(suffix) + + def set_src_suffix(self, src_suffix): + if not src_suffix: + src_suffix = [] + elif not SCons.Util.is_List(src_suffix): + src_suffix = [ src_suffix ] + self.src_suffix = [callable(suf) and suf or self.adjust_suffix(suf) for suf in src_suffix] + + def get_src_suffix(self, env): + """Get the first src_suffix in the list of src_suffixes.""" + ret = self.src_suffixes(env) + if not ret: + return '' + return ret[0] + + def add_emitter(self, suffix, emitter): + """Add a suffix-emitter mapping to this Builder. + + This assumes that emitter has been initialized with an + appropriate dictionary type, and will throw a TypeError if + not, so the caller is responsible for knowing that this is an + appropriate method to call for the Builder in question. + """ + self.emitter[suffix] = emitter + + def add_src_builder(self, builder): + """ + Add a new Builder to the list of src_builders. + + This requires wiping out cached values so that the computed + lists of source suffixes get re-calculated. + """ + self._memo = {} + self.src_builder.append(builder) + + def _get_sdict(self, env): + """ + Returns a dictionary mapping all of the source suffixes of all + src_builders of this Builder to the underlying Builder that + should be called first. + + This dictionary is used for each target specified, so we save a + lot of extra computation by memoizing it for each construction + environment. + + Note that this is re-computed each time, not cached, because there + might be changes to one of our source Builders (or one of their + source Builders, and so on, and so on...) that we can't "see." + + The underlying methods we call cache their computed values, + though, so we hope repeatedly aggregating them into a dictionary + like this won't be too big a hit. We may need to look for a + better way to do this if performance data show this has turned + into a significant bottleneck. + """ + sdict = {} + for bld in self.get_src_builders(env): + for suf in bld.src_suffixes(env): + sdict[suf] = bld + return sdict + + def src_builder_sources(self, env, source, overwarn={}): + sdict = self._get_sdict(env) + + src_suffixes = self.src_suffixes(env) + + lengths = list(set(map(len, src_suffixes))) + + def match_src_suffix(name, src_suffixes=src_suffixes, lengths=lengths): + node_suffixes = [name[-l:] for l in lengths] + for suf in src_suffixes: + if suf in node_suffixes: + return suf + return None + + result = [] + for s in SCons.Util.flatten(source): + if SCons.Util.is_String(s): + match_suffix = match_src_suffix(env.subst(s)) + if not match_suffix and not '.' in s: + src_suf = self.get_src_suffix(env) + s = self._adjustixes(s, None, src_suf)[0] + else: + match_suffix = match_src_suffix(s.name) + if match_suffix: + try: + bld = sdict[match_suffix] + except KeyError: + result.append(s) + else: + tlist = bld._execute(env, None, [s], overwarn) + # If the subsidiary Builder returned more than one + # target, then filter out any sources that this + # Builder isn't capable of building. + if len(tlist) > 1: + tlist = [t for t in tlist if match_src_suffix(t.name)] + result.extend(tlist) + else: + result.append(s) + + source_factory = env.get_factory(self.source_factory) + + return env.arg2nodes(result, source_factory) + + def _get_src_builders_key(self, env): + return id(env) + + memoizer_counters.append(SCons.Memoize.CountDict('get_src_builders', _get_src_builders_key)) + + def get_src_builders(self, env): + """ + Returns the list of source Builders for this Builder. + + This exists mainly to look up Builders referenced as + strings in the 'BUILDER' variable of the construction + environment and cache the result. + """ + memo_key = id(env) + try: + memo_dict = self._memo['get_src_builders'] + except KeyError: + memo_dict = {} + self._memo['get_src_builders'] = memo_dict + else: + try: + return memo_dict[memo_key] + except KeyError: + pass + + builders = [] + for bld in self.src_builder: + if SCons.Util.is_String(bld): + try: + bld = env['BUILDERS'][bld] + except KeyError: + continue + builders.append(bld) + + memo_dict[memo_key] = builders + return builders + + def _subst_src_suffixes_key(self, env): + return id(env) + + memoizer_counters.append(SCons.Memoize.CountDict('subst_src_suffixes', _subst_src_suffixes_key)) + + def subst_src_suffixes(self, env): + """ + The suffix list may contain construction variable expansions, + so we have to evaluate the individual strings. To avoid doing + this over and over, we memoize the results for each construction + environment. + """ + memo_key = id(env) + try: + memo_dict = self._memo['subst_src_suffixes'] + except KeyError: + memo_dict = {} + self._memo['subst_src_suffixes'] = memo_dict + else: + try: + return memo_dict[memo_key] + except KeyError: + pass + suffixes = [env.subst(x) for x in self.src_suffix] + memo_dict[memo_key] = suffixes + return suffixes + + def src_suffixes(self, env): + """ + Returns the list of source suffixes for all src_builders of this + Builder. + + This is essentially a recursive descent of the src_builder "tree." + (This value isn't cached because there may be changes in a + src_builder many levels deep that we can't see.) + """ + sdict = {} + suffixes = self.subst_src_suffixes(env) + for s in suffixes: + sdict[s] = 1 + for builder in self.get_src_builders(env): + for s in builder.src_suffixes(env): + if s not in sdict: + sdict[s] = 1 + suffixes.append(s) + return suffixes + +class CompositeBuilder(SCons.Util.Proxy): + """A Builder Proxy whose main purpose is to always have + a DictCmdGenerator as its action, and to provide access + to the DictCmdGenerator's add_action() method. + """ + + def __init__(self, builder, cmdgen): + if __debug__: logInstanceCreation(self, 'Builder.CompositeBuilder') + SCons.Util.Proxy.__init__(self, builder) + + # cmdgen should always be an instance of DictCmdGenerator. + self.cmdgen = cmdgen + self.builder = builder + + __call__ = SCons.Util.Delegate('__call__') + + def add_action(self, suffix, action): + self.cmdgen.add_action(suffix, action) + self.set_src_suffix(self.cmdgen.src_suffixes()) + +def is_a_Builder(obj): + """"Returns True iff the specified obj is one of our Builder classes. + + The test is complicated a bit by the fact that CompositeBuilder + is a proxy, not a subclass of BuilderBase. + """ + return (isinstance(obj, BuilderBase) + or isinstance(obj, CompositeBuilder) + or callable(obj)) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/CacheDir.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/CacheDir.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/CacheDir.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/CacheDir.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,216 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/CacheDir.py 2013/03/03 09:48:35 garyo" + +__doc__ = """ +CacheDir support +""" + +import os.path +import stat +import sys + +import SCons.Action + +cache_enabled = True +cache_debug = False +cache_force = False +cache_show = False + +def CacheRetrieveFunc(target, source, env): + t = target[0] + fs = t.fs + cd = env.get_CacheDir() + cachedir, cachefile = cd.cachepath(t) + if not fs.exists(cachefile): + cd.CacheDebug('CacheRetrieve(%s): %s not in cache\n', t, cachefile) + return 1 + cd.CacheDebug('CacheRetrieve(%s): retrieving from %s\n', t, cachefile) + if SCons.Action.execute_actions: + if fs.islink(cachefile): + fs.symlink(fs.readlink(cachefile), t.path) + else: + env.copy_from_cache(cachefile, t.path) + st = fs.stat(cachefile) + fs.chmod(t.path, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE) + return 0 + +def CacheRetrieveString(target, source, env): + t = target[0] + fs = t.fs + cd = env.get_CacheDir() + cachedir, cachefile = cd.cachepath(t) + if t.fs.exists(cachefile): + return "Retrieved `%s' from cache" % t.path + return None + +CacheRetrieve = SCons.Action.Action(CacheRetrieveFunc, CacheRetrieveString) + +CacheRetrieveSilent = SCons.Action.Action(CacheRetrieveFunc, None) + +def CachePushFunc(target, source, env): + t = target[0] + if t.nocache: + return + fs = t.fs + cd = env.get_CacheDir() + cachedir, cachefile = cd.cachepath(t) + if fs.exists(cachefile): + # Don't bother copying it if it's already there. Note that + # usually this "shouldn't happen" because if the file already + # existed in cache, we'd have retrieved the file from there, + # not built it. This can happen, though, in a race, if some + # other person running the same build pushes their copy to + # the cache after we decide we need to build it but before our + # build completes. + cd.CacheDebug('CachePush(%s): %s already exists in cache\n', t, cachefile) + return + + cd.CacheDebug('CachePush(%s): pushing to %s\n', t, cachefile) + + tempfile = cachefile+'.tmp'+str(os.getpid()) + errfmt = "Unable to copy %s to cache. Cache file is %s" + + if not fs.isdir(cachedir): + try: + fs.makedirs(cachedir) + except EnvironmentError: + # We may have received an exception because another process + # has beaten us creating the directory. + if not fs.isdir(cachedir): + msg = errfmt % (str(target), cachefile) + raise SCons.Errors.EnvironmentError(msg) + + try: + if fs.islink(t.path): + fs.symlink(fs.readlink(t.path), tempfile) + else: + fs.copy2(t.path, tempfile) + fs.rename(tempfile, cachefile) + st = fs.stat(t.path) + fs.chmod(cachefile, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE) + except EnvironmentError: + # It's possible someone else tried writing the file at the + # same time we did, or else that there was some problem like + # the CacheDir being on a separate file system that's full. + # In any case, inability to push a file to cache doesn't affect + # the correctness of the build, so just print a warning. + msg = errfmt % (str(target), cachefile) + SCons.Warnings.warn(SCons.Warnings.CacheWriteErrorWarning, msg) + +CachePush = SCons.Action.Action(CachePushFunc, None) + +class CacheDir(object): + + def __init__(self, path): + try: + import hashlib + except ImportError: + msg = "No hashlib or MD5 module available, CacheDir() not supported" + SCons.Warnings.warn(SCons.Warnings.NoMD5ModuleWarning, msg) + self.path = None + else: + self.path = path + self.current_cache_debug = None + self.debugFP = None + + def CacheDebug(self, fmt, target, cachefile): + if cache_debug != self.current_cache_debug: + if cache_debug == '-': + self.debugFP = sys.stdout + elif cache_debug: + self.debugFP = open(cache_debug, 'w') + else: + self.debugFP = None + self.current_cache_debug = cache_debug + if self.debugFP: + self.debugFP.write(fmt % (target, os.path.split(cachefile)[1])) + + def is_enabled(self): + return (cache_enabled and not self.path is None) + + def cachepath(self, node): + """ + """ + if not self.is_enabled(): + return None, None + + sig = node.get_cachedir_bsig() + subdir = sig[0].upper() + dir = os.path.join(self.path, subdir) + return dir, os.path.join(dir, sig) + + def retrieve(self, node): + """ + This method is called from multiple threads in a parallel build, + so only do thread safe stuff here. Do thread unsafe stuff in + built(). + + Note that there's a special trick here with the execute flag + (one that's not normally done for other actions). Basically + if the user requested a no_exec (-n) build, then + SCons.Action.execute_actions is set to 0 and when any action + is called, it does its showing but then just returns zero + instead of actually calling the action execution operation. + The problem for caching is that if the file does NOT exist in + cache then the CacheRetrieveString won't return anything to + show for the task, but the Action.__call__ won't call + CacheRetrieveFunc; instead it just returns zero, which makes + the code below think that the file *was* successfully + retrieved from the cache, therefore it doesn't do any + subsequent building. However, the CacheRetrieveString didn't + print anything because it didn't actually exist in the cache, + and no more build actions will be performed, so the user just + sees nothing. The fix is to tell Action.__call__ to always + execute the CacheRetrieveFunc and then have the latter + explicitly check SCons.Action.execute_actions itself. + """ + if not self.is_enabled(): + return False + + env = node.get_build_env() + if cache_show: + if CacheRetrieveSilent(node, [], env, execute=1) == 0: + node.build(presub=0, execute=0) + return True + else: + if CacheRetrieve(node, [], env, execute=1) == 0: + return True + + return False + + def push(self, node): + if not self.is_enabled(): + return + return CachePush(node, [], node.get_build_env()) + + def push_if_forced(self, node): + if cache_force: + return self.push(node) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Conftest.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Conftest.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Conftest.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Conftest.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,793 @@ +"""SCons.Conftest + +Autoconf-like configuration support; low level implementation of tests. +""" + +# +# Copyright (c) 2003 Stichting NLnet Labs +# Copyright (c) 2001, 2002, 2003 Steven Knight +# +# 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. +# + +# +# The purpose of this module is to define how a check is to be performed. +# Use one of the Check...() functions below. +# + +# +# A context class is used that defines functions for carrying out the tests, +# logging and messages. The following methods and members must be present: +# +# context.Display(msg) Function called to print messages that are normally +# displayed for the user. Newlines are explicitly used. +# The text should also be written to the logfile! +# +# context.Log(msg) Function called to write to a log file. +# +# context.BuildProg(text, ext) +# Function called to build a program, using "ext" for the +# file extention. Must return an empty string for +# success, an error message for failure. +# For reliable test results building should be done just +# like an actual program would be build, using the same +# command and arguments (including configure results so +# far). +# +# context.CompileProg(text, ext) +# Function called to compile a program, using "ext" for +# the file extention. Must return an empty string for +# success, an error message for failure. +# For reliable test results compiling should be done just +# like an actual source file would be compiled, using the +# same command and arguments (including configure results +# so far). +# +# context.AppendLIBS(lib_name_list) +# Append "lib_name_list" to the value of LIBS. +# "lib_namelist" is a list of strings. +# Return the value of LIBS before changing it (any type +# can be used, it is passed to SetLIBS() later.) +# +# context.PrependLIBS(lib_name_list) +# Prepend "lib_name_list" to the value of LIBS. +# "lib_namelist" is a list of strings. +# Return the value of LIBS before changing it (any type +# can be used, it is passed to SetLIBS() later.) +# +# context.SetLIBS(value) +# Set LIBS to "value". The type of "value" is what +# AppendLIBS() returned. +# Return the value of LIBS before changing it (any type +# can be used, it is passed to SetLIBS() later.) +# +# context.headerfilename +# Name of file to append configure results to, usually +# "confdefs.h". +# The file must not exist or be empty when starting. +# Empty or None to skip this (some tests will not work!). +# +# context.config_h (may be missing). If present, must be a string, which +# will be filled with the contents of a config_h file. +# +# context.vardict Dictionary holding variables used for the tests and +# stores results from the tests, used for the build +# commands. +# Normally contains "CC", "LIBS", "CPPFLAGS", etc. +# +# context.havedict Dictionary holding results from the tests that are to +# be used inside a program. +# Names often start with "HAVE_". These are zero +# (feature not present) or one (feature present). Other +# variables may have any value, e.g., "PERLVERSION" can +# be a number and "SYSTEMNAME" a string. +# + +import re +from types import IntType + +# +# PUBLIC VARIABLES +# + +LogInputFiles = 1 # Set that to log the input files in case of a failed test +LogErrorMessages = 1 # Set that to log Conftest-generated error messages + +# +# PUBLIC FUNCTIONS +# + +# Generic remarks: +# - When a language is specified which is not supported the test fails. The +# message is a bit different, because not all the arguments for the normal +# message are available yet (chicken-egg problem). + + +def CheckBuilder(context, text = None, language = None): + """ + Configure check to see if the compiler works. + Note that this uses the current value of compiler and linker flags, make + sure $CFLAGS, $CPPFLAGS and $LIBS are set correctly. + "language" should be "C" or "C++" and is used to select the compiler. + Default is "C". + "text" may be used to specify the code to be build. + Returns an empty string for success, an error message for failure. + """ + lang, suffix, msg = _lang2suffix(language) + if msg: + context.Display("%s\n" % msg) + return msg + + if not text: + text = """ +int main() { + return 0; +} +""" + + context.Display("Checking if building a %s file works... " % lang) + ret = context.BuildProg(text, suffix) + _YesNoResult(context, ret, None, text) + return ret + +def CheckCC(context): + """ + Configure check for a working C compiler. + + This checks whether the C compiler, as defined in the $CC construction + variable, can compile a C source file. It uses the current $CCCOM value + too, so that it can test against non working flags. + + """ + context.Display("Checking whether the C compiler works") + text = """ +int main() +{ + return 0; +} +""" + ret = _check_empty_program(context, 'CC', text, 'C') + _YesNoResult(context, ret, None, text) + return ret + +def CheckSHCC(context): + """ + Configure check for a working shared C compiler. + + This checks whether the C compiler, as defined in the $SHCC construction + variable, can compile a C source file. It uses the current $SHCCCOM value + too, so that it can test against non working flags. + + """ + context.Display("Checking whether the (shared) C compiler works") + text = """ +int foo() +{ + return 0; +} +""" + ret = _check_empty_program(context, 'SHCC', text, 'C', use_shared = True) + _YesNoResult(context, ret, None, text) + return ret + +def CheckCXX(context): + """ + Configure check for a working CXX compiler. + + This checks whether the CXX compiler, as defined in the $CXX construction + variable, can compile a CXX source file. It uses the current $CXXCOM value + too, so that it can test against non working flags. + + """ + context.Display("Checking whether the C++ compiler works") + text = """ +int main() +{ + return 0; +} +""" + ret = _check_empty_program(context, 'CXX', text, 'C++') + _YesNoResult(context, ret, None, text) + return ret + +def CheckSHCXX(context): + """ + Configure check for a working shared CXX compiler. + + This checks whether the CXX compiler, as defined in the $SHCXX construction + variable, can compile a CXX source file. It uses the current $SHCXXCOM value + too, so that it can test against non working flags. + + """ + context.Display("Checking whether the (shared) C++ compiler works") + text = """ +int main() +{ + return 0; +} +""" + ret = _check_empty_program(context, 'SHCXX', text, 'C++', use_shared = True) + _YesNoResult(context, ret, None, text) + return ret + +def _check_empty_program(context, comp, text, language, use_shared = False): + """Return 0 on success, 1 otherwise.""" + if comp not in context.env or not context.env[comp]: + # The compiler construction variable is not set or empty + return 1 + + lang, suffix, msg = _lang2suffix(language) + if msg: + return 1 + + if use_shared: + return context.CompileSharedObject(text, suffix) + else: + return context.CompileProg(text, suffix) + + +def CheckFunc(context, function_name, header = None, language = None): + """ + Configure check for a function "function_name". + "language" should be "C" or "C++" and is used to select the compiler. + Default is "C". + Optional "header" can be defined to define a function prototype, include a + header file or anything else that comes before main(). + Sets HAVE_function_name in context.havedict according to the result. + Note that this uses the current value of compiler and linker flags, make + sure $CFLAGS, $CPPFLAGS and $LIBS are set correctly. + Returns an empty string for success, an error message for failure. + """ + + # Remarks from autoconf: + # - Don't include because on OSF/1 3.0 it includes + # which includes which contains a prototype for select. + # Similarly for bzero. + # - assert.h is included to define __stub macros and hopefully few + # prototypes, which can conflict with char $1(); below. + # - Override any gcc2 internal prototype to avoid an error. + # - We use char for the function declaration because int might match the + # return type of a gcc2 builtin and then its argument prototype would + # still apply. + # - 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 context.headerfilename: + includetext = '#include "%s"' % context.headerfilename + else: + includetext = '' + if not header: + header = """ +#ifdef __cplusplus +extern "C" +#endif +char %s();""" % function_name + + lang, suffix, msg = _lang2suffix(language) + if msg: + context.Display("Cannot check for %s(): %s\n" % (function_name, msg)) + return msg + + text = """ +%(include)s +#include +%(hdr)s + +int main() { +#if defined (__stub_%(name)s) || defined (__stub___%(name)s) + fail fail fail +#else + %(name)s(); +#endif + + return 0; +} +""" % { 'name': function_name, + 'include': includetext, + 'hdr': header } + + context.Display("Checking for %s function %s()... " % (lang, function_name)) + ret = context.BuildProg(text, suffix) + _YesNoResult(context, ret, "HAVE_" + function_name, text, + "Define to 1 if the system has the function `%s'." %\ + function_name) + return ret + + +def CheckHeader(context, header_name, header = None, language = None, + include_quotes = None): + """ + Configure check for a C or C++ header file "header_name". + Optional "header" can be defined to do something before including the + header file (unusual, supported for consistency). + "language" should be "C" or "C++" and is used to select the compiler. + Default is "C". + Sets HAVE_header_name in context.havedict according to the result. + Note that this uses the current value of compiler and linker flags, make + sure $CFLAGS and $CPPFLAGS are set correctly. + Returns an empty string for success, an error message for failure. + """ + # Why compile the program instead of just running the preprocessor? + # It is possible that the header file exists, but actually using it may + # fail (e.g., because it depends on other header files). Thus this test is + # more strict. It may require using the "header" argument. + # + # Use <> by default, because the check is normally used for system header + # files. SCons passes '""' to overrule this. + + # Include "confdefs.h" first, so that the header can use HAVE_HEADER_H. + if context.headerfilename: + includetext = '#include "%s"\n' % context.headerfilename + else: + includetext = '' + if not header: + header = "" + + lang, suffix, msg = _lang2suffix(language) + if msg: + context.Display("Cannot check for header file %s: %s\n" + % (header_name, msg)) + return msg + + if not include_quotes: + include_quotes = "<>" + + text = "%s%s\n#include %s%s%s\n\n" % (includetext, header, + include_quotes[0], header_name, include_quotes[1]) + + context.Display("Checking for %s header file %s... " % (lang, header_name)) + ret = context.CompileProg(text, suffix) + _YesNoResult(context, ret, "HAVE_" + header_name, text, + "Define to 1 if you have the <%s> header file." % header_name) + return ret + + +def CheckType(context, type_name, fallback = None, + header = None, language = None): + """ + Configure check for a C or C++ type "type_name". + Optional "header" can be defined to include a header file. + "language" should be "C" or "C++" and is used to select the compiler. + Default is "C". + Sets HAVE_type_name in context.havedict according to the result. + Note that this uses the current value of compiler and linker flags, make + sure $CFLAGS, $CPPFLAGS and $LIBS are set correctly. + Returns an empty string for success, an error message for failure. + """ + + # Include "confdefs.h" first, so that the header can use HAVE_HEADER_H. + if context.headerfilename: + includetext = '#include "%s"' % context.headerfilename + else: + includetext = '' + if not header: + header = "" + + lang, suffix, msg = _lang2suffix(language) + if msg: + context.Display("Cannot check for %s type: %s\n" % (type_name, msg)) + return msg + + # Remarks from autoconf about this test: + # - Grepping for the type in include files is not reliable (grep isn't + # portable anyway). + # - Using "TYPE my_var;" doesn't work for const qualified types in C++. + # Adding an initializer is not valid for some C++ classes. + # - Using the type as parameter to a function either fails for K&$ C or for + # C++. + # - Using "TYPE *my_var;" is valid in C for some types that are not + # declared (struct something). + # - Using "sizeof(TYPE)" is valid when TYPE is actually a variable. + # - Using the previous two together works reliably. + text = """ +%(include)s +%(header)s + +int main() { + if ((%(name)s *) 0) + return 0; + if (sizeof (%(name)s)) + return 0; +} +""" % { 'include': includetext, + 'header': header, + 'name': type_name } + + context.Display("Checking for %s type %s... " % (lang, type_name)) + ret = context.BuildProg(text, suffix) + _YesNoResult(context, ret, "HAVE_" + type_name, text, + "Define to 1 if the system has the type `%s'." % type_name) + if ret and fallback and context.headerfilename: + f = open(context.headerfilename, "a") + f.write("typedef %s %s;\n" % (fallback, type_name)) + f.close() + + return ret + +def CheckTypeSize(context, type_name, header = None, language = None, expect = None): + """This check can be used to get the size of a given type, or to check whether + the type is of expected size. + + Arguments: + - type : str + the type to check + - includes : sequence + list of headers to include in the test code before testing the type + - language : str + 'C' or 'C++' + - expect : int + if given, will test wether the type has the given number of bytes. + If not given, will automatically find the size. + + Returns: + status : int + 0 if the check failed, or the found size of the type if the check succeeded.""" + + # Include "confdefs.h" first, so that the header can use HAVE_HEADER_H. + if context.headerfilename: + includetext = '#include "%s"' % context.headerfilename + else: + includetext = '' + + if not header: + header = "" + + lang, suffix, msg = _lang2suffix(language) + if msg: + context.Display("Cannot check for %s type: %s\n" % (type_name, msg)) + return msg + + src = includetext + header + if not expect is None: + # Only check if the given size is the right one + context.Display('Checking %s is %d bytes... ' % (type_name, expect)) + + # test code taken from autoconf: this is a pretty clever hack to find that + # a type is of a given size using only compilation. This speeds things up + # quite a bit compared to straightforward code using TryRun + src = src + r""" +typedef %s scons_check_type; + +int main() +{ + static int test_array[1 - 2 * !(((long int) (sizeof(scons_check_type))) == %d)]; + test_array[0] = 0; + + return 0; +} +""" + + st = context.CompileProg(src % (type_name, expect), suffix) + if not st: + context.Display("yes\n") + _Have(context, "SIZEOF_%s" % type_name, expect, + "The size of `%s', as computed by sizeof." % type_name) + return expect + else: + context.Display("no\n") + _LogFailed(context, src, st) + return 0 + else: + # Only check if the given size is the right one + context.Message('Checking size of %s ... ' % type_name) + + # We have to be careful with the program we wish to test here since + # compilation will be attempted using the current environment's flags. + # So make sure that the program will compile without any warning. For + # example using: 'int main(int argc, char** argv)' will fail with the + # '-Wall -Werror' flags since the variables argc and argv would not be + # used in the program... + # + src = src + """ +#include +#include +int main() { + printf("%d", (int)sizeof(""" + type_name + """)); + return 0; +} + """ + st, out = context.RunProg(src, suffix) + try: + size = int(out) + except ValueError: + # If cannot convert output of test prog to an integer (the size), + # something went wront, so just fail + st = 1 + size = 0 + + if not st: + context.Display("yes\n") + _Have(context, "SIZEOF_%s" % type_name, size, + "The size of `%s', as computed by sizeof." % type_name) + return size + else: + context.Display("no\n") + _LogFailed(context, src, st) + return 0 + + return 0 + +def CheckDeclaration(context, symbol, includes = None, language = None): + """Checks whether symbol is declared. + + Use the same test as autoconf, that is test whether the symbol is defined + as a macro or can be used as an r-value. + + Arguments: + symbol : str + the symbol to check + includes : str + Optional "header" can be defined to include a header file. + language : str + only C and C++ supported. + + Returns: + status : bool + True if the check failed, False if succeeded.""" + + # Include "confdefs.h" first, so that the header can use HAVE_HEADER_H. + if context.headerfilename: + includetext = '#include "%s"' % context.headerfilename + else: + includetext = '' + + if not includes: + includes = "" + + lang, suffix, msg = _lang2suffix(language) + if msg: + context.Display("Cannot check for declaration %s: %s\n" % (symbol, msg)) + return msg + + src = includetext + includes + context.Display('Checking whether %s is declared... ' % symbol) + + src = src + r""" +int main() +{ +#ifndef %s + (void) %s; +#endif + ; + return 0; +} +""" % (symbol, symbol) + + st = context.CompileProg(src, suffix) + _YesNoResult(context, st, "HAVE_DECL_" + symbol, src, + "Set to 1 if %s is defined." % symbol) + return st + +def CheckLib(context, libs, func_name = None, header = None, + extra_libs = None, call = None, language = None, autoadd = 1, + append = True): + """ + Configure check for a C or C++ libraries "libs". Searches through + the list of libraries, until one is found where the test succeeds. + Tests if "func_name" or "call" exists in the library. Note: if it exists + in another library the test succeeds anyway! + Optional "header" can be defined to include a header file. If not given a + default prototype for "func_name" is added. + Optional "extra_libs" is a list of library names to be added after + "lib_name" in the build command. To be used for libraries that "lib_name" + depends on. + Optional "call" replaces the call to "func_name" in the test code. It must + consist of complete C statements, including a trailing ";". + Both "func_name" and "call" arguments are optional, and in that case, just + linking against the libs is tested. + "language" should be "C" or "C++" and is used to select the compiler. + Default is "C". + Note that this uses the current value of compiler and linker flags, make + sure $CFLAGS, $CPPFLAGS and $LIBS are set correctly. + Returns an empty string for success, an error message for failure. + """ + # Include "confdefs.h" first, so that the header can use HAVE_HEADER_H. + if context.headerfilename: + includetext = '#include "%s"' % context.headerfilename + else: + includetext = '' + if not header: + header = "" + + text = """ +%s +%s""" % (includetext, header) + + # Add a function declaration if needed. + if func_name and func_name != "main": + if not header: + text = text + """ +#ifdef __cplusplus +extern "C" +#endif +char %s(); +""" % func_name + + # The actual test code. + if not call: + call = "%s();" % func_name + + # if no function to test, leave main() blank + text = text + """ +int +main() { + %s +return 0; +} +""" % (call or "") + + if call: + i = call.find("\n") + if i > 0: + calltext = call[:i] + ".." + elif call[-1] == ';': + calltext = call[:-1] + else: + calltext = call + + for lib_name in libs: + + lang, suffix, msg = _lang2suffix(language) + if msg: + context.Display("Cannot check for library %s: %s\n" % (lib_name, msg)) + return msg + + # if a function was specified to run in main(), say it + if call: + context.Display("Checking for %s in %s library %s... " + % (calltext, lang, lib_name)) + # otherwise, just say the name of library and language + else: + context.Display("Checking for %s library %s... " + % (lang, lib_name)) + + if lib_name: + l = [ lib_name ] + if extra_libs: + l.extend(extra_libs) + if append: + oldLIBS = context.AppendLIBS(l) + else: + oldLIBS = context.PrependLIBS(l) + sym = "HAVE_LIB" + lib_name + else: + oldLIBS = -1 + sym = None + + ret = context.BuildProg(text, suffix) + + _YesNoResult(context, ret, sym, text, + "Define to 1 if you have the `%s' library." % lib_name) + if oldLIBS != -1 and (ret or not autoadd): + context.SetLIBS(oldLIBS) + + if not ret: + return ret + + return ret + +# +# END OF PUBLIC FUNCTIONS +# + +def _YesNoResult(context, ret, key, text, comment = None): + """ + Handle the result of a test with a "yes" or "no" result. + "ret" is the return value: empty if OK, error message when not. + "key" is the name of the symbol to be defined (HAVE_foo). + "text" is the source code of the program used for testing. + "comment" is the C comment to add above the line defining the symbol (the + comment is automatically put inside a /* */). If None, no comment is added. + """ + if key: + _Have(context, key, not ret, comment) + if ret: + context.Display("no\n") + _LogFailed(context, text, ret) + else: + context.Display("yes\n") + + +def _Have(context, key, have, comment = None): + """ + Store result of a test in context.havedict and context.headerfilename. + "key" is a "HAVE_abc" name. It is turned into all CAPITALS and non- + alphanumerics are replaced by an underscore. + The value of "have" can be: + 1 - Feature is defined, add "#define key". + 0 - Feature is not defined, add "/* #undef key */". + Adding "undef" is what autoconf does. Not useful for the + compiler, but it shows that the test was done. + number - Feature is defined to this number "#define key have". + Doesn't work for 0 or 1, use a string then. + string - Feature is defined to this string "#define key have". + Give "have" as is should appear in the header file, include quotes + when desired and escape special characters! + """ + key_up = key.upper() + key_up = re.sub('[^A-Z0-9_]', '_', key_up) + context.havedict[key_up] = have + if have == 1: + line = "#define %s 1\n" % key_up + elif have == 0: + line = "/* #undef %s */\n" % key_up + elif isinstance(have, IntType): + line = "#define %s %d\n" % (key_up, have) + else: + line = "#define %s %s\n" % (key_up, str(have)) + + if comment is not None: + lines = "\n/* %s */\n" % comment + line + else: + lines = "\n" + line + + if context.headerfilename: + f = open(context.headerfilename, "a") + f.write(lines) + f.close() + elif hasattr(context,'config_h'): + context.config_h = context.config_h + lines + + +def _LogFailed(context, text, msg): + """ + Write to the log about a failed program. + Add line numbers, so that error messages can be understood. + """ + if LogInputFiles: + context.Log("Failed program was:\n") + lines = text.split('\n') + if len(lines) and lines[-1] == '': + lines = lines[:-1] # remove trailing empty line + n = 1 + for line in lines: + context.Log("%d: %s\n" % (n, line)) + n = n + 1 + if LogErrorMessages: + context.Log("Error message: %s\n" % msg) + + +def _lang2suffix(lang): + """ + Convert a language name to a suffix. + When "lang" is empty or None C is assumed. + Returns a tuple (lang, suffix, None) when it works. + For an unrecognized language returns (None, None, msg). + Where: + lang = the unified language name + suffix = the suffix, including the leading dot + msg = an error message + """ + if not lang or lang in ["C", "c"]: + return ("C", ".c", None) + if lang in ["c++", "C++", "cpp", "CXX", "cxx"]: + return ("C++", ".cpp", None) + + return None, None, "Unsupported language: %s" % lang + + +# vim: set sw=4 et sts=4 tw=79 fo+=l: + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Debug.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Debug.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Debug.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Debug.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,220 @@ +"""SCons.Debug + +Code for debugging SCons internal things. Shouldn't be +needed by most users. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Debug.py 2013/03/03 09:48:35 garyo" + +import os +import sys +import time +import weakref + +tracked_classes = {} + +def logInstanceCreation(instance, name=None): + if name is None: + name = instance.__class__.__name__ + if name not in tracked_classes: + tracked_classes[name] = [] + tracked_classes[name].append(weakref.ref(instance)) + +def string_to_classes(s): + if s == '*': + return sorted(tracked_classes.keys()) + else: + return s.split() + +def fetchLoggedInstances(classes="*"): + classnames = string_to_classes(classes) + return [(cn, len(tracked_classes[cn])) for cn in classnames] + +def countLoggedInstances(classes, file=sys.stdout): + for classname in string_to_classes(classes): + file.write("%s: %d\n" % (classname, len(tracked_classes[classname]))) + +def listLoggedInstances(classes, file=sys.stdout): + for classname in string_to_classes(classes): + file.write('\n%s:\n' % classname) + for ref in tracked_classes[classname]: + obj = ref() + if obj is not None: + file.write(' %s\n' % repr(obj)) + +def dumpLoggedInstances(classes, file=sys.stdout): + for classname in string_to_classes(classes): + file.write('\n%s:\n' % classname) + for ref in tracked_classes[classname]: + obj = ref() + if obj is not None: + file.write(' %s:\n' % obj) + for key, value in obj.__dict__.items(): + file.write(' %20s : %s\n' % (key, value)) + + + +if sys.platform[:5] == "linux": + # Linux doesn't actually support memory usage stats from getrusage(). + def memory(): + mstr = open('/proc/self/stat').read() + mstr = mstr.split()[22] + return int(mstr) +elif sys.platform[:6] == 'darwin': + #TODO really get memory stats for OS X + def memory(): + return 0 +else: + try: + import resource + except ImportError: + try: + import win32process + import win32api + except ImportError: + def memory(): + return 0 + else: + def memory(): + process_handle = win32api.GetCurrentProcess() + memory_info = win32process.GetProcessMemoryInfo( process_handle ) + return memory_info['PeakWorkingSetSize'] + else: + def memory(): + res = resource.getrusage(resource.RUSAGE_SELF) + return res[4] + +# returns caller's stack +def caller_stack(*backlist): + import traceback + if not backlist: + backlist = [0] + result = [] + for back in backlist: + tb = traceback.extract_stack(limit=3+back) + key = tb[0][:3] + result.append('%s:%d(%s)' % func_shorten(key)) + return result + +caller_bases = {} +caller_dicts = {} + +# trace a caller's stack +def caller_trace(back=0): + import traceback + tb = traceback.extract_stack(limit=3+back) + tb.reverse() + callee = tb[1][:3] + caller_bases[callee] = caller_bases.get(callee, 0) + 1 + for caller in tb[2:]: + caller = callee + caller[:3] + try: + entry = caller_dicts[callee] + except KeyError: + caller_dicts[callee] = entry = {} + entry[caller] = entry.get(caller, 0) + 1 + callee = caller + +# print a single caller and its callers, if any +def _dump_one_caller(key, file, level=0): + leader = ' '*level + for v,c in sorted([(-v,c) for c,v in caller_dicts[key].items()]): + file.write("%s %6d %s:%d(%s)\n" % ((leader,-v) + func_shorten(c[-3:]))) + if c in caller_dicts: + _dump_one_caller(c, file, level+1) + +# print each call tree +def dump_caller_counts(file=sys.stdout): + for k in sorted(caller_bases.keys()): + file.write("Callers of %s:%d(%s), %d calls:\n" + % (func_shorten(k) + (caller_bases[k],))) + _dump_one_caller(k, file) + +shorten_list = [ + ( '/scons/SCons/', 1), + ( '/src/engine/SCons/', 1), + ( '/usr/lib/python', 0), +] + +if os.sep != '/': + shorten_list = [(t[0].replace('/', os.sep), t[1]) for t in shorten_list] + +def func_shorten(func_tuple): + f = func_tuple[0] + for t in shorten_list: + i = f.find(t[0]) + if i >= 0: + if t[1]: + i = i + len(t[0]) + return (f[i:],)+func_tuple[1:] + return func_tuple + + +TraceFP = {} +if sys.platform == 'win32': + TraceDefault = 'con' +else: + TraceDefault = '/dev/tty' + +TimeStampDefault = None +StartTime = time.time() +PreviousTime = StartTime + +def Trace(msg, file=None, mode='w', tstamp=None): + """Write a trace message to a file. Whenever a file is specified, + it becomes the default for the next call to Trace().""" + global TraceDefault + global TimeStampDefault + global PreviousTime + if file is None: + file = TraceDefault + else: + TraceDefault = file + if tstamp is None: + tstamp = TimeStampDefault + else: + TimeStampDefault = tstamp + try: + fp = TraceFP[file] + except KeyError: + try: + fp = TraceFP[file] = open(file, mode) + except TypeError: + # Assume we were passed an open file pointer. + fp = file + if tstamp: + now = time.time() + fp.write('%8.4f %8.4f: ' % (now - StartTime, now - PreviousTime)) + PreviousTime = now + fp.write(msg) + fp.flush() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Defaults.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Defaults.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Defaults.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Defaults.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,494 @@ +"""SCons.Defaults + +Builders and other things for the local site. Here's where we'll +duplicate the functionality of autoconf until we move it into the +installation procedure or use something like qmconf. + +The code that reads the registry to find MSVC components was borrowed +from distutils.msvccompiler. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# +from __future__ import division + +__revision__ = "src/engine/SCons/Defaults.py 2013/03/03 09:48:35 garyo" + + +import os +import errno +import shutil +import stat +import time +import sys + +import SCons.Action +import SCons.Builder +import SCons.CacheDir +import SCons.Environment +import SCons.PathList +import SCons.Subst +import SCons.Tool + +# A placeholder for a default Environment (for fetching source files +# from source code management systems and the like). This must be +# initialized later, after the top-level directory is set by the calling +# interface. +_default_env = None + +# Lazily instantiate the default environment so the overhead of creating +# it doesn't apply when it's not needed. +def _fetch_DefaultEnvironment(*args, **kw): + """ + Returns the already-created default construction environment. + """ + global _default_env + return _default_env + +def DefaultEnvironment(*args, **kw): + """ + Initial public entry point for creating the default construction + Environment. + + After creating the environment, we overwrite our name + (DefaultEnvironment) with the _fetch_DefaultEnvironment() function, + which more efficiently returns the initialized default construction + environment without checking for its existence. + + (This function still exists with its _default_check because someone + else (*cough* Script/__init__.py *cough*) may keep a reference + to this function. So we can't use the fully functional idiom of + having the name originally be a something that *only* creates the + construction environment and then overwrites the name.) + """ + global _default_env + if not _default_env: + import SCons.Util + _default_env = SCons.Environment.Environment(*args, **kw) + if SCons.Util.md5: + _default_env.Decider('MD5') + else: + _default_env.Decider('timestamp-match') + global DefaultEnvironment + DefaultEnvironment = _fetch_DefaultEnvironment + _default_env._CacheDir_path = None + return _default_env + +# Emitters for setting the shared attribute on object files, +# and an action for checking that all of the source files +# going into a shared library are, in fact, shared. +def StaticObjectEmitter(target, source, env): + for tgt in target: + tgt.attributes.shared = None + return (target, source) + +def SharedObjectEmitter(target, source, env): + for tgt in target: + tgt.attributes.shared = 1 + return (target, source) + +def SharedFlagChecker(source, target, env): + same = env.subst('$STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME') + if same == '0' or same == '' or same == 'False': + for src in source: + try: + shared = src.attributes.shared + except AttributeError: + shared = None + if not shared: + raise SCons.Errors.UserError("Source file: %s is static and is not compatible with shared target: %s" % (src, target[0])) + +SharedCheck = SCons.Action.Action(SharedFlagChecker, None) + +# Some people were using these variable name before we made +# SourceFileScanner part of the public interface. Don't break their +# SConscript files until we've given them some fair warning and a +# transition period. +CScan = SCons.Tool.CScanner +DScan = SCons.Tool.DScanner +LaTeXScan = SCons.Tool.LaTeXScanner +ObjSourceScan = SCons.Tool.SourceFileScanner +ProgScan = SCons.Tool.ProgramScanner + +# These aren't really tool scanners, so they don't quite belong with +# the rest of those in Tool/__init__.py, but I'm not sure where else +# they should go. Leave them here for now. +import SCons.Scanner.Dir +DirScanner = SCons.Scanner.Dir.DirScanner() +DirEntryScanner = SCons.Scanner.Dir.DirEntryScanner() + +# Actions for common languages. +CAction = SCons.Action.Action("$CCCOM", "$CCCOMSTR") +ShCAction = SCons.Action.Action("$SHCCCOM", "$SHCCCOMSTR") +CXXAction = SCons.Action.Action("$CXXCOM", "$CXXCOMSTR") +ShCXXAction = SCons.Action.Action("$SHCXXCOM", "$SHCXXCOMSTR") + +ASAction = SCons.Action.Action("$ASCOM", "$ASCOMSTR") +ASPPAction = SCons.Action.Action("$ASPPCOM", "$ASPPCOMSTR") + +LinkAction = SCons.Action.Action("$LINKCOM", "$LINKCOMSTR") +ShLinkAction = SCons.Action.Action("$SHLINKCOM", "$SHLINKCOMSTR") + +LdModuleLinkAction = SCons.Action.Action("$LDMODULECOM", "$LDMODULECOMSTR") + +# Common tasks that we allow users to perform in platform-independent +# ways by creating ActionFactory instances. +ActionFactory = SCons.Action.ActionFactory + +def get_paths_str(dest): + # If dest is a list, we need to manually call str() on each element + if SCons.Util.is_List(dest): + elem_strs = [] + for element in dest: + elem_strs.append('"' + str(element) + '"') + return '[' + ', '.join(elem_strs) + ']' + else: + return '"' + str(dest) + '"' + +def chmod_func(dest, mode): + SCons.Node.FS.invalidate_node_memos(dest) + if not SCons.Util.is_List(dest): + dest = [dest] + for element in dest: + os.chmod(str(element), mode) + +def chmod_strfunc(dest, mode): + return 'Chmod(%s, 0%o)' % (get_paths_str(dest), mode) + +Chmod = ActionFactory(chmod_func, chmod_strfunc) + +def copy_func(dest, src): + SCons.Node.FS.invalidate_node_memos(dest) + if SCons.Util.is_List(src) and os.path.isdir(dest): + for file in src: + shutil.copy2(file, dest) + return 0 + elif os.path.isfile(src): + return shutil.copy2(src, dest) + else: + return shutil.copytree(src, dest, 1) + +Copy = ActionFactory(copy_func, + lambda dest, src: 'Copy("%s", "%s")' % (dest, src), + convert=str) + +def delete_func(dest, must_exist=0): + SCons.Node.FS.invalidate_node_memos(dest) + if not SCons.Util.is_List(dest): + dest = [dest] + for entry in dest: + entry = str(entry) + # os.path.exists returns False with broken links that exist + entry_exists = os.path.exists(entry) or os.path.islink(entry) + if not entry_exists and not must_exist: + continue + # os.path.isdir returns True when entry is a link to a dir + if os.path.isdir(entry) and not os.path.islink(entry): + shutil.rmtree(entry, 1) + continue + os.unlink(entry) + +def delete_strfunc(dest, must_exist=0): + return 'Delete(%s)' % get_paths_str(dest) + +Delete = ActionFactory(delete_func, delete_strfunc) + +def mkdir_func(dest): + SCons.Node.FS.invalidate_node_memos(dest) + if not SCons.Util.is_List(dest): + dest = [dest] + for entry in dest: + try: + os.makedirs(str(entry)) + except os.error, e: + p = str(entry) + if (e.args[0] == errno.EEXIST or + (sys.platform=='win32' and e.args[0]==183)) \ + and os.path.isdir(str(entry)): + pass # not an error if already exists + else: + raise + +Mkdir = ActionFactory(mkdir_func, + lambda dir: 'Mkdir(%s)' % get_paths_str(dir)) + +def move_func(dest, src): + SCons.Node.FS.invalidate_node_memos(dest) + SCons.Node.FS.invalidate_node_memos(src) + shutil.move(src, dest) + +Move = ActionFactory(move_func, + lambda dest, src: 'Move("%s", "%s")' % (dest, src), + convert=str) + +def touch_func(dest): + SCons.Node.FS.invalidate_node_memos(dest) + if not SCons.Util.is_List(dest): + dest = [dest] + for file in dest: + file = str(file) + mtime = int(time.time()) + if os.path.exists(file): + atime = os.path.getatime(file) + else: + open(file, 'w') + atime = mtime + os.utime(file, (atime, mtime)) + +Touch = ActionFactory(touch_func, + lambda file: 'Touch(%s)' % get_paths_str(file)) + +# Internal utility functions + +def _concat(prefix, list, suffix, env, f=lambda x: x, target=None, source=None): + """ + Creates a new list from 'list' by first interpolating each element + in the list using the 'env' dictionary and then calling f on the + list, and finally calling _concat_ixes to concatenate 'prefix' and + 'suffix' onto each element of the list. + """ + if not list: + return list + + l = f(SCons.PathList.PathList(list).subst_path(env, target, source)) + if l is not None: + list = l + + return _concat_ixes(prefix, list, suffix, env) + +def _concat_ixes(prefix, list, suffix, env): + """ + Creates a new list from 'list' by concatenating the 'prefix' and + 'suffix' arguments onto each element of the list. A trailing space + on 'prefix' or leading space on 'suffix' will cause them to be put + into separate list elements rather than being concatenated. + """ + + result = [] + + # ensure that prefix and suffix are strings + prefix = str(env.subst(prefix, SCons.Subst.SUBST_RAW)) + suffix = str(env.subst(suffix, SCons.Subst.SUBST_RAW)) + + for x in list: + if isinstance(x, SCons.Node.FS.File): + result.append(x) + continue + x = str(x) + if x: + + if prefix: + if prefix[-1] == ' ': + result.append(prefix[:-1]) + elif x[:len(prefix)] != prefix: + x = prefix + x + + result.append(x) + + if suffix: + if suffix[0] == ' ': + result.append(suffix[1:]) + elif x[-len(suffix):] != suffix: + result[-1] = result[-1]+suffix + + return result + +def _stripixes(prefix, itms, suffix, stripprefixes, stripsuffixes, env, c=None): + """ + This is a wrapper around _concat()/_concat_ixes() that checks for + the existence of prefixes or suffixes on list items and strips them + where it finds them. This is used by tools (like the GNU linker) + that need to turn something like 'libfoo.a' into '-lfoo'. + """ + + if not itms: + return itms + + if not callable(c): + env_c = env['_concat'] + if env_c != _concat and callable(env_c): + # There's a custom _concat() method in the construction + # environment, and we've allowed people to set that in + # the past (see test/custom-concat.py), so preserve the + # backwards compatibility. + c = env_c + else: + c = _concat_ixes + + stripprefixes = list(map(env.subst, SCons.Util.flatten(stripprefixes))) + stripsuffixes = list(map(env.subst, SCons.Util.flatten(stripsuffixes))) + + stripped = [] + for l in SCons.PathList.PathList(itms).subst_path(env, None, None): + if isinstance(l, SCons.Node.FS.File): + stripped.append(l) + continue + + if not SCons.Util.is_String(l): + l = str(l) + + for stripprefix in stripprefixes: + lsp = len(stripprefix) + if l[:lsp] == stripprefix: + l = l[lsp:] + # Do not strip more than one prefix + break + + for stripsuffix in stripsuffixes: + lss = len(stripsuffix) + if l[-lss:] == stripsuffix: + l = l[:-lss] + # Do not strip more than one suffix + break + + stripped.append(l) + + return c(prefix, stripped, suffix, env) + +def processDefines(defs): + """process defines, resolving strings, lists, dictionaries, into a list of + strings + """ + if SCons.Util.is_List(defs): + l = [] + for d in defs: + if d is None: + continue + elif SCons.Util.is_List(d) or isinstance(d, tuple): + if len(d) >= 2: + l.append(str(d[0]) + '=' + str(d[1])) + else: + l.append(str(d[0])) + elif SCons.Util.is_Dict(d): + for macro,value in d.iteritems(): + if value is not None: + l.append(str(macro) + '=' + str(value)) + else: + l.append(str(macro)) + elif SCons.Util.is_String(d): + l.append(str(d)) + else: + raise SCons.Errors.UserError("DEFINE %s is not a list, dict, string or None."%repr(d)) + elif SCons.Util.is_Dict(defs): + # The items in a dictionary are stored in random order, but + # if the order of the command-line options changes from + # invocation to invocation, then the signature of the command + # line will change and we'll get random unnecessary rebuilds. + # Consequently, we have to sort the keys to ensure a + # consistent order... + l = [] + for k,v in sorted(defs.items()): + if v is None: + l.append(str(k)) + else: + l.append(str(k) + '=' + str(v)) + else: + l = [str(defs)] + return l + +def _defines(prefix, defs, suffix, env, c=_concat_ixes): + """A wrapper around _concat_ixes that turns a list or string + into a list of C preprocessor command-line definitions. + """ + + return c(prefix, env.subst_path(processDefines(defs)), suffix, env) + +class NullCmdGenerator(object): + """This is a callable class that can be used in place of other + command generators if you don't want them to do anything. + + The __call__ method for this class simply returns the thing + you instantiated it with. + + Example usage: + env["DO_NOTHING"] = NullCmdGenerator + env["LINKCOM"] = "${DO_NOTHING('$LINK $SOURCES $TARGET')}" + """ + + def __init__(self, cmd): + self.cmd = cmd + + def __call__(self, target, source, env, for_signature=None): + return self.cmd + +class Variable_Method_Caller(object): + """A class for finding a construction variable on the stack and + calling one of its methods. + + We use this to support "construction variables" in our string + eval()s that actually stand in for methods--specifically, use + of "RDirs" in call to _concat that should actually execute the + "TARGET.RDirs" method. (We used to support this by creating a little + "build dictionary" that mapped RDirs to the method, but this got in + the way of Memoizing construction environments, because we had to + create new environment objects to hold the variables.) + """ + def __init__(self, variable, method): + self.variable = variable + self.method = method + def __call__(self, *args, **kw): + try: 1//0 + except ZeroDivisionError: + # Don't start iterating with the current stack-frame to + # prevent creating reference cycles (f_back is safe). + frame = sys.exc_info()[2].tb_frame.f_back + variable = self.variable + while frame: + if variable in frame.f_locals: + v = frame.f_locals[variable] + if v: + method = getattr(v, self.method) + return method(*args, **kw) + frame = frame.f_back + return None + +ConstructionEnvironment = { + 'BUILDERS' : {}, + 'SCANNERS' : [], + 'CONFIGUREDIR' : '#/.sconf_temp', + 'CONFIGURELOG' : '#/config.log', + 'CPPSUFFIXES' : SCons.Tool.CSuffixes, + 'DSUFFIXES' : SCons.Tool.DSuffixes, + 'ENV' : {}, + 'IDLSUFFIXES' : SCons.Tool.IDLSuffixes, +# 'LATEXSUFFIXES' : SCons.Tool.LaTeXSuffixes, # moved to the TeX tools generate functions + '_concat' : _concat, + '_defines' : _defines, + '_stripixes' : _stripixes, + '_LIBFLAGS' : '${_concat(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, __env__)}', + '_LIBDIRFLAGS' : '$( ${_concat(LIBDIRPREFIX, LIBPATH, LIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)', + '_CPPINCFLAGS' : '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)', + '_CPPDEFFLAGS' : '${_defines(CPPDEFPREFIX, CPPDEFINES, CPPDEFSUFFIX, __env__)}', + 'TEMPFILE' : NullCmdGenerator, + 'Dir' : Variable_Method_Caller('TARGET', 'Dir'), + 'Dirs' : Variable_Method_Caller('TARGET', 'Dirs'), + 'File' : Variable_Method_Caller('TARGET', 'File'), + 'RDirs' : Variable_Method_Caller('TARGET', 'RDirs'), +} + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Environment.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Environment.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Environment.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Environment.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,2418 @@ +"""SCons.Environment + +Base class for construction Environments. These are +the primary objects used to communicate dependency and +construction information to the build engine. + +Keyword arguments supplied when the construction Environment +is created are construction variables used to initialize the +Environment +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Environment.py 2013/03/03 09:48:35 garyo" + + +import copy +import os +import sys +import re +import shlex +from collections import UserDict + +import SCons.Action +import SCons.Builder +from SCons.Debug import logInstanceCreation +import SCons.Defaults +import SCons.Errors +import SCons.Memoize +import SCons.Node +import SCons.Node.Alias +import SCons.Node.FS +import SCons.Node.Python +import SCons.Platform +import SCons.SConf +import SCons.SConsign +import SCons.Subst +import SCons.Tool +import SCons.Util +import SCons.Warnings + +class _Null(object): + pass + +_null = _Null + +_warn_copy_deprecated = True +_warn_source_signatures_deprecated = True +_warn_target_signatures_deprecated = True + +CleanTargets = {} +CalculatorArgs = {} + +semi_deepcopy = SCons.Util.semi_deepcopy +semi_deepcopy_dict = SCons.Util.semi_deepcopy_dict + +# Pull UserError into the global name space for the benefit of +# Environment().SourceSignatures(), which has some import statements +# which seem to mess up its ability to reference SCons directly. +UserError = SCons.Errors.UserError + +def alias_builder(env, target, source): + pass + +AliasBuilder = SCons.Builder.Builder(action = alias_builder, + target_factory = SCons.Node.Alias.default_ans.Alias, + source_factory = SCons.Node.FS.Entry, + multi = 1, + is_explicit = None, + name='AliasBuilder') + +def apply_tools(env, tools, toolpath): + # Store the toolpath in the Environment. + if toolpath is not None: + env['toolpath'] = toolpath + + if not tools: + return + # Filter out null tools from the list. + for tool in [_f for _f in tools if _f]: + if SCons.Util.is_List(tool) or isinstance(tool, tuple): + toolname = tool[0] + toolargs = tool[1] # should be a dict of kw args + tool = env.Tool(toolname, **toolargs) + else: + env.Tool(tool) + +# These names are (or will be) controlled by SCons; users should never +# set or override them. This warning can optionally be turned off, +# but scons will still ignore the illegal variable names even if it's off. +reserved_construction_var_names = [ + 'CHANGED_SOURCES', + 'CHANGED_TARGETS', + 'SOURCE', + 'SOURCES', + 'TARGET', + 'TARGETS', + 'UNCHANGED_SOURCES', + 'UNCHANGED_TARGETS', +] + +future_reserved_construction_var_names = [ + #'HOST_OS', + #'HOST_ARCH', + #'HOST_CPU', + ] + +def copy_non_reserved_keywords(dict): + result = semi_deepcopy(dict) + for k in result.keys(): + if k in reserved_construction_var_names: + msg = "Ignoring attempt to set reserved variable `$%s'" + SCons.Warnings.warn(SCons.Warnings.ReservedVariableWarning, msg % k) + del result[k] + return result + +def _set_reserved(env, key, value): + msg = "Ignoring attempt to set reserved variable `$%s'" + SCons.Warnings.warn(SCons.Warnings.ReservedVariableWarning, msg % key) + +def _set_future_reserved(env, key, value): + env._dict[key] = value + msg = "`$%s' will be reserved in a future release and setting it will become ignored" + SCons.Warnings.warn(SCons.Warnings.FutureReservedVariableWarning, msg % key) + +def _set_BUILDERS(env, key, value): + try: + bd = env._dict[key] + for k in bd.keys(): + del bd[k] + except KeyError: + bd = BuilderDict(kwbd, env) + env._dict[key] = bd + for k, v in value.items(): + if not SCons.Builder.is_a_Builder(v): + raise SCons.Errors.UserError('%s is not a Builder.' % repr(v)) + bd.update(value) + +def _del_SCANNERS(env, key): + del env._dict[key] + env.scanner_map_delete() + +def _set_SCANNERS(env, key, value): + env._dict[key] = value + env.scanner_map_delete() + +def _delete_duplicates(l, keep_last): + """Delete duplicates from a sequence, keeping the first or last.""" + seen={} + result=[] + if keep_last: # reverse in & out, then keep first + l.reverse() + for i in l: + try: + if i not in seen: + result.append(i) + seen[i]=1 + except TypeError: + # probably unhashable. Just keep it. + result.append(i) + if keep_last: + result.reverse() + return result + + + +# The following is partly based on code in a comment added by Peter +# Shannon at the following page (there called the "transplant" class): +# +# ASPN : Python Cookbook : Dynamically added methods to a class +# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81732 +# +# We had independently been using the idiom as BuilderWrapper, but +# factoring out the common parts into this base class, and making +# BuilderWrapper a subclass that overrides __call__() to enforce specific +# Builder calling conventions, simplified some of our higher-layer code. + +class MethodWrapper(object): + """ + A generic Wrapper class that associates a method (which can + actually be any callable) with an object. As part of creating this + MethodWrapper object an attribute with the specified (by default, + the name of the supplied method) is added to the underlying object. + When that new "method" is called, our __call__() method adds the + object as the first argument, simulating the Python behavior of + supplying "self" on method calls. + + We hang on to the name by which the method was added to the underlying + base class so that we can provide a method to "clone" ourselves onto + a new underlying object being copied (without which we wouldn't need + to save that info). + """ + def __init__(self, object, method, name=None): + if name is None: + name = method.__name__ + self.object = object + self.method = method + self.name = name + setattr(self.object, name, self) + + def __call__(self, *args, **kwargs): + nargs = (self.object,) + args + return self.method(*nargs, **kwargs) + + def clone(self, new_object): + """ + Returns an object that re-binds the underlying "method" to + the specified new object. + """ + return self.__class__(new_object, self.method, self.name) + +class BuilderWrapper(MethodWrapper): + """ + A MethodWrapper subclass that that associates an environment with + a Builder. + + This mainly exists to wrap the __call__() function so that all calls + to Builders can have their argument lists massaged in the same way + (treat a lone argument as the source, treat two arguments as target + then source, make sure both target and source are lists) without + having to have cut-and-paste code to do it. + + As a bit of obsessive backwards compatibility, we also intercept + attempts to get or set the "env" or "builder" attributes, which were + the names we used before we put the common functionality into the + MethodWrapper base class. We'll keep this around for a while in case + people shipped Tool modules that reached into the wrapper (like the + Tool/qt.py module does, or did). There shouldn't be a lot attribute + fetching or setting on these, so a little extra work shouldn't hurt. + """ + def __call__(self, target=None, source=_null, *args, **kw): + if source is _null: + source = target + target = None + if target is not None and not SCons.Util.is_List(target): + target = [target] + if source is not None and not SCons.Util.is_List(source): + source = [source] + return MethodWrapper.__call__(self, target, source, *args, **kw) + + def __repr__(self): + return '' % repr(self.name) + + def __str__(self): + return self.__repr__() + + def __getattr__(self, name): + if name == 'env': + return self.object + elif name == 'builder': + return self.method + else: + raise AttributeError(name) + + def __setattr__(self, name, value): + if name == 'env': + self.object = value + elif name == 'builder': + self.method = value + else: + self.__dict__[name] = value + + # This allows a Builder to be executed directly + # through the Environment to which it's attached. + # In practice, we shouldn't need this, because + # builders actually get executed through a Node. + # But we do have a unit test for this, and can't + # yet rule out that it would be useful in the + # future, so leave it for now. + #def execute(self, **kw): + # kw['env'] = self.env + # self.builder.execute(**kw) + +class BuilderDict(UserDict): + """This is a dictionary-like class used by an Environment to hold + the Builders. We need to do this because every time someone changes + the Builders in the Environment's BUILDERS dictionary, we must + update the Environment's attributes.""" + def __init__(self, dict, env): + # Set self.env before calling the superclass initialization, + # because it will end up calling our other methods, which will + # need to point the values in this dictionary to self.env. + self.env = env + UserDict.__init__(self, dict) + + def __semi_deepcopy__(self): + # These cannot be copied since they would both modify the same builder object, and indeed + # just copying would modify the original builder + raise TypeError( 'cannot semi_deepcopy a BuilderDict' ) + + def __setitem__(self, item, val): + try: + method = getattr(self.env, item).method + except AttributeError: + pass + else: + self.env.RemoveMethod(method) + UserDict.__setitem__(self, item, val) + BuilderWrapper(self.env, val, item) + + def __delitem__(self, item): + UserDict.__delitem__(self, item) + delattr(self.env, item) + + def update(self, dict): + for i, v in dict.items(): + self.__setitem__(i, v) + + + +_is_valid_var = re.compile(r'[_a-zA-Z]\w*$') + +def is_valid_construction_var(varstr): + """Return if the specified string is a legitimate construction + variable. + """ + return _is_valid_var.match(varstr) + + + +class SubstitutionEnvironment(object): + """Base class for different flavors of construction environments. + + This class contains a minimal set of methods that handle contruction + variable expansion and conversion of strings to Nodes, which may or + may not be actually useful as a stand-alone class. Which methods + ended up in this class is pretty arbitrary right now. They're + basically the ones which we've empirically determined are common to + the different construction environment subclasses, and most of the + others that use or touch the underlying dictionary of construction + variables. + + Eventually, this class should contain all the methods that we + determine are necessary for a "minimal" interface to the build engine. + A full "native Python" SCons environment has gotten pretty heavyweight + with all of the methods and Tools and construction variables we've + jammed in there, so it would be nice to have a lighter weight + alternative for interfaces that don't need all of the bells and + whistles. (At some point, we'll also probably rename this class + "Base," since that more reflects what we want this class to become, + but because we've released comments that tell people to subclass + Environment.Base to create their own flavors of construction + environment, we'll save that for a future refactoring when this + class actually becomes useful.) + """ + + if SCons.Memoize.use_memoizer: + __metaclass__ = SCons.Memoize.Memoized_Metaclass + + def __init__(self, **kw): + """Initialization of an underlying SubstitutionEnvironment class. + """ + if __debug__: logInstanceCreation(self, 'Environment.SubstitutionEnvironment') + self.fs = SCons.Node.FS.get_default_fs() + self.ans = SCons.Node.Alias.default_ans + self.lookup_list = SCons.Node.arg2nodes_lookups + self._dict = kw.copy() + self._init_special() + self.added_methods = [] + #self._memo = {} + + def _init_special(self): + """Initial the dispatch tables for special handling of + special construction variables.""" + self._special_del = {} + self._special_del['SCANNERS'] = _del_SCANNERS + + self._special_set = {} + for key in reserved_construction_var_names: + self._special_set[key] = _set_reserved + for key in future_reserved_construction_var_names: + self._special_set[key] = _set_future_reserved + self._special_set['BUILDERS'] = _set_BUILDERS + self._special_set['SCANNERS'] = _set_SCANNERS + + # Freeze the keys of self._special_set in a list for use by + # methods that need to check. (Empirically, list scanning has + # gotten better than dict.has_key() in Python 2.5.) + self._special_set_keys = list(self._special_set.keys()) + + def __cmp__(self, other): + return cmp(self._dict, other._dict) + + def __delitem__(self, key): + special = self._special_del.get(key) + if special: + special(self, key) + else: + del self._dict[key] + + def __getitem__(self, key): + return self._dict[key] + + def __setitem__(self, key, value): + # This is heavily used. This implementation is the best we have + # according to the timings in bench/env.__setitem__.py. + # + # The "key in self._special_set_keys" test here seems to perform + # pretty well for the number of keys we have. A hard-coded + # list works a little better in Python 2.5, but that has the + # disadvantage of maybe getting out of sync if we ever add more + # variable names. Using self._special_set.has_key() works a + # little better in Python 2.4, but is worse than this test. + # So right now it seems like a good trade-off, but feel free to + # revisit this with bench/env.__setitem__.py as needed (and + # as newer versions of Python come out). + if key in self._special_set_keys: + self._special_set[key](self, key, value) + else: + # If we already have the entry, then it's obviously a valid + # key and we don't need to check. If we do check, using a + # global, pre-compiled regular expression directly is more + # efficient than calling another function or a method. + if key not in self._dict \ + and not _is_valid_var.match(key): + raise SCons.Errors.UserError("Illegal construction variable `%s'" % key) + self._dict[key] = value + + def get(self, key, default=None): + """Emulates the get() method of dictionaries.""" + return self._dict.get(key, default) + + def has_key(self, key): + return key in self._dict + + def __contains__(self, key): + return self._dict.__contains__(key) + + def items(self): + return list(self._dict.items()) + + def arg2nodes(self, args, node_factory=_null, lookup_list=_null, **kw): + if node_factory is _null: + node_factory = self.fs.File + if lookup_list is _null: + lookup_list = self.lookup_list + + if not args: + return [] + + args = SCons.Util.flatten(args) + + nodes = [] + for v in args: + if SCons.Util.is_String(v): + n = None + for l in lookup_list: + n = l(v) + if n is not None: + break + if n is not None: + if SCons.Util.is_String(n): + # n = self.subst(n, raw=1, **kw) + kw['raw'] = 1 + n = self.subst(n, **kw) + if node_factory: + n = node_factory(n) + if SCons.Util.is_List(n): + nodes.extend(n) + else: + nodes.append(n) + elif node_factory: + # v = node_factory(self.subst(v, raw=1, **kw)) + kw['raw'] = 1 + v = node_factory(self.subst(v, **kw)) + if SCons.Util.is_List(v): + nodes.extend(v) + else: + nodes.append(v) + else: + nodes.append(v) + + return nodes + + def gvars(self): + return self._dict + + def lvars(self): + return {} + + def subst(self, string, raw=0, target=None, source=None, conv=None, executor=None): + """Recursively interpolates construction variables from the + Environment into the specified string, returning the expanded + result. Construction variables are specified by a $ prefix + in the string and begin with an initial underscore or + alphabetic character followed by any number of underscores + or alphanumeric characters. The construction variable names + may be surrounded by curly braces to separate the name from + trailing characters. + """ + gvars = self.gvars() + lvars = self.lvars() + lvars['__env__'] = self + if executor: + lvars.update(executor.get_lvars()) + return SCons.Subst.scons_subst(string, self, raw, target, source, gvars, lvars, conv) + + def subst_kw(self, kw, raw=0, target=None, source=None): + nkw = {} + for k, v in kw.items(): + k = self.subst(k, raw, target, source) + if SCons.Util.is_String(v): + v = self.subst(v, raw, target, source) + nkw[k] = v + return nkw + + def subst_list(self, string, raw=0, target=None, source=None, conv=None, executor=None): + """Calls through to SCons.Subst.scons_subst_list(). See + the documentation for that function.""" + gvars = self.gvars() + lvars = self.lvars() + lvars['__env__'] = self + if executor: + lvars.update(executor.get_lvars()) + return SCons.Subst.scons_subst_list(string, self, raw, target, source, gvars, lvars, conv) + + def subst_path(self, path, target=None, source=None): + """Substitute a path list, turning EntryProxies into Nodes + and leaving Nodes (and other objects) as-is.""" + + if not SCons.Util.is_List(path): + path = [path] + + def s(obj): + """This is the "string conversion" routine that we have our + substitutions use to return Nodes, not strings. This relies + on the fact that an EntryProxy object has a get() method that + returns the underlying Node that it wraps, which is a bit of + architectural dependence that we might need to break or modify + in the future in response to additional requirements.""" + try: + get = obj.get + except AttributeError: + obj = SCons.Util.to_String_for_subst(obj) + else: + obj = get() + return obj + + r = [] + for p in path: + if SCons.Util.is_String(p): + p = self.subst(p, target=target, source=source, conv=s) + if SCons.Util.is_List(p): + if len(p) == 1: + p = p[0] + else: + # We have an object plus a string, or multiple + # objects that we need to smush together. No choice + # but to make them into a string. + p = ''.join(map(SCons.Util.to_String_for_subst, p)) + else: + p = s(p) + r.append(p) + return r + + subst_target_source = subst + + def backtick(self, command): + import subprocess + # common arguments + kw = { 'stdin' : 'devnull', + 'stdout' : subprocess.PIPE, + 'stderr' : subprocess.PIPE, + 'universal_newlines' : True, + } + # if the command is a list, assume it's been quoted + # othewise force a shell + if not SCons.Util.is_List(command): kw['shell'] = True + # run constructed command + p = SCons.Action._subproc(self, command, **kw) + out,err = p.communicate() + status = p.wait() + if err: + sys.stderr.write(unicode(err)) + if status: + raise OSError("'%s' exited %d" % (command, status)) + return out + + def AddMethod(self, function, name=None): + """ + Adds the specified function as a method of this construction + environment with the specified name. If the name is omitted, + the default name is the name of the function itself. + """ + method = MethodWrapper(self, function, name) + self.added_methods.append(method) + + def RemoveMethod(self, function): + """ + Removes the specified function's MethodWrapper from the + added_methods list, so we don't re-bind it when making a clone. + """ + self.added_methods = [dm for dm in self.added_methods if not dm.method is function] + + def Override(self, overrides): + """ + Produce a modified environment whose variables are overriden by + the overrides dictionaries. "overrides" is a dictionary that + will override the variables of this environment. + + This function is much more efficient than Clone() or creating + a new Environment because it doesn't copy the construction + environment dictionary, it just wraps the underlying construction + environment, and doesn't even create a wrapper object if there + are no overrides. + """ + if not overrides: return self + o = copy_non_reserved_keywords(overrides) + if not o: return self + overrides = {} + merges = None + for key, value in o.items(): + if key == 'parse_flags': + merges = value + else: + overrides[key] = SCons.Subst.scons_subst_once(value, self, key) + env = OverrideEnvironment(self, overrides) + if merges: env.MergeFlags(merges) + return env + + def ParseFlags(self, *flags): + """ + Parse the set of flags and return a dict with the flags placed + in the appropriate entry. The flags are treated as a typical + set of command-line flags for a GNU-like toolchain and used to + populate the entries in the dict immediately below. If one of + the flag strings begins with a bang (exclamation mark), it is + assumed to be a command and the rest of the string is executed; + the result of that evaluation is then added to the dict. + """ + dict = { + 'ASFLAGS' : SCons.Util.CLVar(''), + 'CFLAGS' : SCons.Util.CLVar(''), + 'CCFLAGS' : SCons.Util.CLVar(''), + 'CXXFLAGS' : SCons.Util.CLVar(''), + 'CPPDEFINES' : [], + 'CPPFLAGS' : SCons.Util.CLVar(''), + 'CPPPATH' : [], + 'FRAMEWORKPATH' : SCons.Util.CLVar(''), + 'FRAMEWORKS' : SCons.Util.CLVar(''), + 'LIBPATH' : [], + 'LIBS' : [], + 'LINKFLAGS' : SCons.Util.CLVar(''), + 'RPATH' : [], + } + + def do_parse(arg): + # if arg is a sequence, recurse with each element + if not arg: + return + + if not SCons.Util.is_String(arg): + for t in arg: do_parse(t) + return + + # if arg is a command, execute it + if arg[0] == '!': + arg = self.backtick(arg[1:]) + + # utility function to deal with -D option + def append_define(name, dict = dict): + t = name.split('=') + if len(t) == 1: + dict['CPPDEFINES'].append(name) + else: + dict['CPPDEFINES'].append([t[0], '='.join(t[1:])]) + + # Loop through the flags and add them to the appropriate option. + # This tries to strike a balance between checking for all possible + # flags and keeping the logic to a finite size, so it doesn't + # check for some that don't occur often. It particular, if the + # flag is not known to occur in a config script and there's a way + # of passing the flag to the right place (by wrapping it in a -W + # flag, for example) we don't check for it. Note that most + # preprocessor options are not handled, since unhandled options + # are placed in CCFLAGS, so unless the preprocessor is invoked + # separately, these flags will still get to the preprocessor. + # Other options not currently handled: + # -iqoutedir (preprocessor search path) + # -u symbol (linker undefined symbol) + # -s (linker strip files) + # -static* (linker static binding) + # -shared* (linker dynamic binding) + # -symbolic (linker global binding) + # -R dir (deprecated linker rpath) + # IBM compilers may also accept -qframeworkdir=foo + + params = shlex.split(arg) + append_next_arg_to = None # for multi-word args + for arg in params: + if append_next_arg_to: + if append_next_arg_to == 'CPPDEFINES': + append_define(arg) + elif append_next_arg_to == '-include': + t = ('-include', self.fs.File(arg)) + dict['CCFLAGS'].append(t) + elif append_next_arg_to == '-isysroot': + t = ('-isysroot', arg) + dict['CCFLAGS'].append(t) + dict['LINKFLAGS'].append(t) + elif append_next_arg_to == '-arch': + t = ('-arch', arg) + dict['CCFLAGS'].append(t) + dict['LINKFLAGS'].append(t) + else: + dict[append_next_arg_to].append(arg) + append_next_arg_to = None + elif not arg[0] in ['-', '+']: + dict['LIBS'].append(self.fs.File(arg)) + elif arg == '-dylib_file': + dict['LINKFLAGS'].append(arg) + append_next_arg_to = 'LINKFLAGS' + elif arg[:2] == '-L': + if arg[2:]: + dict['LIBPATH'].append(arg[2:]) + else: + append_next_arg_to = 'LIBPATH' + elif arg[:2] == '-l': + if arg[2:]: + dict['LIBS'].append(arg[2:]) + else: + append_next_arg_to = 'LIBS' + elif arg[:2] == '-I': + if arg[2:]: + dict['CPPPATH'].append(arg[2:]) + else: + append_next_arg_to = 'CPPPATH' + elif arg[:4] == '-Wa,': + dict['ASFLAGS'].append(arg[4:]) + dict['CCFLAGS'].append(arg) + elif arg[:4] == '-Wl,': + if arg[:11] == '-Wl,-rpath=': + dict['RPATH'].append(arg[11:]) + elif arg[:7] == '-Wl,-R,': + dict['RPATH'].append(arg[7:]) + elif arg[:6] == '-Wl,-R': + dict['RPATH'].append(arg[6:]) + else: + dict['LINKFLAGS'].append(arg) + elif arg[:4] == '-Wp,': + dict['CPPFLAGS'].append(arg) + elif arg[:2] == '-D': + if arg[2:]: + append_define(arg[2:]) + else: + append_next_arg_to = 'CPPDEFINES' + elif arg == '-framework': + append_next_arg_to = 'FRAMEWORKS' + elif arg[:14] == '-frameworkdir=': + dict['FRAMEWORKPATH'].append(arg[14:]) + elif arg[:2] == '-F': + if arg[2:]: + dict['FRAMEWORKPATH'].append(arg[2:]) + else: + append_next_arg_to = 'FRAMEWORKPATH' + elif arg in ['-mno-cygwin', + '-pthread', + '-openmp', + '-fopenmp']: + dict['CCFLAGS'].append(arg) + dict['LINKFLAGS'].append(arg) + elif arg == '-mwindows': + dict['LINKFLAGS'].append(arg) + elif arg[:5] == '-std=': + if arg[5:].find('++')!=-1: + key='CXXFLAGS' + else: + key='CFLAGS' + dict[key].append(arg) + elif arg[0] == '+': + dict['CCFLAGS'].append(arg) + dict['LINKFLAGS'].append(arg) + elif arg in ['-include', '-isysroot', '-arch']: + append_next_arg_to = arg + else: + dict['CCFLAGS'].append(arg) + + for arg in flags: + do_parse(arg) + return dict + + def MergeFlags(self, args, unique=1, dict=None): + """ + Merge the dict in args into the construction variables of this + env, or the passed-in dict. If args is not a dict, it is + converted into a dict using ParseFlags. If unique is not set, + the flags are appended rather than merged. + """ + + if dict is None: + dict = self + if not SCons.Util.is_Dict(args): + args = self.ParseFlags(args) + if not unique: + self.Append(**args) + return self + for key, value in args.items(): + if not value: + continue + try: + orig = self[key] + except KeyError: + orig = value + else: + if not orig: + orig = value + elif value: + # Add orig and value. The logic here was lifted from + # part of env.Append() (see there for a lot of comments + # about the order in which things are tried) and is + # used mainly to handle coercion of strings to CLVar to + # "do the right thing" given (e.g.) an original CCFLAGS + # string variable like '-pipe -Wall'. + try: + orig = orig + value + except (KeyError, TypeError): + try: + add_to_orig = orig.append + except AttributeError: + value.insert(0, orig) + orig = value + else: + add_to_orig(value) + t = [] + if key[-4:] == 'PATH': + ### keep left-most occurence + for v in orig: + if v not in t: + t.append(v) + else: + ### keep right-most occurence + orig.reverse() + for v in orig: + if v not in t: + t.insert(0, v) + self[key] = t + return self + +# def MergeShellPaths(self, args, prepend=1): +# """ +# Merge the dict in args into the shell environment in env['ENV']. +# Shell path elements are appended or prepended according to prepend. + +# Uses Pre/AppendENVPath, so it always appends or prepends uniquely. + +# Example: env.MergeShellPaths({'LIBPATH': '/usr/local/lib'}) +# prepends /usr/local/lib to env['ENV']['LIBPATH']. +# """ + +# for pathname, pathval in args.items(): +# if not pathval: +# continue +# if prepend: +# self.PrependENVPath(pathname, pathval) +# else: +# self.AppendENVPath(pathname, pathval) + + +def default_decide_source(dependency, target, prev_ni): + f = SCons.Defaults.DefaultEnvironment().decide_source + return f(dependency, target, prev_ni) + +def default_decide_target(dependency, target, prev_ni): + f = SCons.Defaults.DefaultEnvironment().decide_target + return f(dependency, target, prev_ni) + +def default_copy_from_cache(src, dst): + f = SCons.Defaults.DefaultEnvironment().copy_from_cache + return f(src, dst) + +class Base(SubstitutionEnvironment): + """Base class for "real" construction Environments. These are the + primary objects used to communicate dependency and construction + information to the build engine. + + Keyword arguments supplied when the construction Environment + is created are construction variables used to initialize the + Environment. + """ + + memoizer_counters = [] + + ####################################################################### + # This is THE class for interacting with the SCons build engine, + # and it contains a lot of stuff, so we're going to try to keep this + # a little organized by grouping the methods. + ####################################################################### + + ####################################################################### + # Methods that make an Environment act like a dictionary. These have + # the expected standard names for Python mapping objects. Note that + # we don't actually make an Environment a subclass of UserDict for + # performance reasons. Note also that we only supply methods for + # dictionary functionality that we actually need and use. + ####################################################################### + + def __init__(self, + platform=None, + tools=None, + toolpath=None, + variables=None, + parse_flags = None, + **kw): + """ + Initialization of a basic SCons construction environment, + including setting up special construction variables like BUILDER, + PLATFORM, etc., and searching for and applying available Tools. + + Note that we do *not* call the underlying base class + (SubsitutionEnvironment) initialization, because we need to + initialize things in a very specific order that doesn't work + with the much simpler base class initialization. + """ + if __debug__: logInstanceCreation(self, 'Environment.Base') + self._memo = {} + self.fs = SCons.Node.FS.get_default_fs() + self.ans = SCons.Node.Alias.default_ans + self.lookup_list = SCons.Node.arg2nodes_lookups + self._dict = semi_deepcopy(SCons.Defaults.ConstructionEnvironment) + self._init_special() + self.added_methods = [] + + # We don't use AddMethod, or define these as methods in this + # class, because we *don't* want these functions to be bound + # methods. They need to operate independently so that the + # settings will work properly regardless of whether a given + # target ends up being built with a Base environment or an + # OverrideEnvironment or what have you. + self.decide_target = default_decide_target + self.decide_source = default_decide_source + + self.copy_from_cache = default_copy_from_cache + + self._dict['BUILDERS'] = BuilderDict(self._dict['BUILDERS'], self) + + if platform is None: + platform = self._dict.get('PLATFORM', None) + if platform is None: + platform = SCons.Platform.Platform() + if SCons.Util.is_String(platform): + platform = SCons.Platform.Platform(platform) + self._dict['PLATFORM'] = str(platform) + platform(self) + + self._dict['HOST_OS'] = self._dict.get('HOST_OS',None) + self._dict['HOST_ARCH'] = self._dict.get('HOST_ARCH',None) + + # Now set defaults for TARGET_{OS|ARCH} + self._dict['TARGET_OS'] = self._dict.get('HOST_OS',None) + self._dict['TARGET_ARCH'] = self._dict.get('HOST_ARCH',None) + + + # Apply the passed-in and customizable variables to the + # environment before calling the tools, because they may use + # some of them during initialization. + if 'options' in kw: + # Backwards compatibility: they may stll be using the + # old "options" keyword. + variables = kw['options'] + del kw['options'] + self.Replace(**kw) + keys = list(kw.keys()) + if variables: + keys = keys + list(variables.keys()) + variables.Update(self) + + save = {} + for k in keys: + try: + save[k] = self._dict[k] + except KeyError: + # No value may have been set if they tried to pass in a + # reserved variable name like TARGETS. + pass + + SCons.Tool.Initializers(self) + + if tools is None: + tools = self._dict.get('TOOLS', None) + if tools is None: + tools = ['default'] + apply_tools(self, tools, toolpath) + + # Now restore the passed-in and customized variables + # to the environment, since the values the user set explicitly + # should override any values set by the tools. + for key, val in save.items(): + self._dict[key] = val + + # Finally, apply any flags to be merged in + if parse_flags: self.MergeFlags(parse_flags) + + ####################################################################### + # Utility methods that are primarily for internal use by SCons. + # These begin with lower-case letters. + ####################################################################### + + def get_builder(self, name): + """Fetch the builder with the specified name from the environment. + """ + try: + return self._dict['BUILDERS'][name] + except KeyError: + return None + + def get_CacheDir(self): + try: + path = self._CacheDir_path + except AttributeError: + path = SCons.Defaults.DefaultEnvironment()._CacheDir_path + try: + if path == self._last_CacheDir_path: + return self._last_CacheDir + except AttributeError: + pass + cd = SCons.CacheDir.CacheDir(path) + self._last_CacheDir_path = path + self._last_CacheDir = cd + return cd + + def get_factory(self, factory, default='File'): + """Return a factory function for creating Nodes for this + construction environment. + """ + name = default + try: + is_node = issubclass(factory, SCons.Node.FS.Base) + except TypeError: + # The specified factory isn't a Node itself--it's + # most likely None, or possibly a callable. + pass + else: + if is_node: + # The specified factory is a Node (sub)class. Try to + # return the FS method that corresponds to the Node's + # name--that is, we return self.fs.Dir if they want a Dir, + # self.fs.File for a File, etc. + try: name = factory.__name__ + except AttributeError: pass + else: factory = None + if not factory: + # They passed us None, or we picked up a name from a specified + # class, so return the FS method. (Note that we *don't* + # use our own self.{Dir,File} methods because that would + # cause env.subst() to be called twice on the file name, + # interfering with files that have $$ in them.) + factory = getattr(self.fs, name) + return factory + + memoizer_counters.append(SCons.Memoize.CountValue('_gsm')) + + def _gsm(self): + try: + return self._memo['_gsm'] + except KeyError: + pass + + result = {} + + try: + scanners = self._dict['SCANNERS'] + except KeyError: + pass + else: + # Reverse the scanner list so that, if multiple scanners + # claim they can scan the same suffix, earlier scanners + # in the list will overwrite later scanners, so that + # the result looks like a "first match" to the user. + if not SCons.Util.is_List(scanners): + scanners = [scanners] + else: + scanners = scanners[:] # copy so reverse() doesn't mod original + scanners.reverse() + for scanner in scanners: + for k in scanner.get_skeys(self): + if k and self['PLATFORM'] == 'win32': + k = k.lower() + result[k] = scanner + + self._memo['_gsm'] = result + + return result + + def get_scanner(self, skey): + """Find the appropriate scanner given a key (usually a file suffix). + """ + if skey and self['PLATFORM'] == 'win32': + skey = skey.lower() + return self._gsm().get(skey) + + def scanner_map_delete(self, kw=None): + """Delete the cached scanner map (if we need to). + """ + try: + del self._memo['_gsm'] + except KeyError: + pass + + def _update(self, dict): + """Update an environment's values directly, bypassing the normal + checks that occur when users try to set items. + """ + self._dict.update(dict) + + def get_src_sig_type(self): + try: + return self.src_sig_type + except AttributeError: + t = SCons.Defaults.DefaultEnvironment().src_sig_type + self.src_sig_type = t + return t + + def get_tgt_sig_type(self): + try: + return self.tgt_sig_type + except AttributeError: + t = SCons.Defaults.DefaultEnvironment().tgt_sig_type + self.tgt_sig_type = t + return t + + ####################################################################### + # Public methods for manipulating an Environment. These begin with + # upper-case letters. The essential characteristic of methods in + # this section is that they do *not* have corresponding same-named + # global functions. For example, a stand-alone Append() function + # makes no sense, because Append() is all about appending values to + # an Environment's construction variables. + ####################################################################### + + def Append(self, **kw): + """Append values to existing construction variables + in an Environment. + """ + kw = copy_non_reserved_keywords(kw) + for key, val in kw.items(): + # It would be easier on the eyes to write this using + # "continue" statements whenever we finish processing an item, + # but Python 1.5.2 apparently doesn't let you use "continue" + # within try:-except: blocks, so we have to nest our code. + try: + if key == 'CPPDEFINES' and SCons.Util.is_String(self._dict[key]): + self._dict[key] = [self._dict[key]] + orig = self._dict[key] + except KeyError: + # No existing variable in the environment, so just set + # it to the new value. + if key == 'CPPDEFINES' and SCons.Util.is_String(val): + self._dict[key] = [val] + else: + self._dict[key] = val + else: + try: + # Check if the original looks like a dictionary. + # If it is, we can't just try adding the value because + # dictionaries don't have __add__() methods, and + # things like UserList will incorrectly coerce the + # original dict to a list (which we don't want). + update_dict = orig.update + except AttributeError: + try: + # Most straightforward: just try to add them + # together. This will work in most cases, when the + # original and new values are of compatible types. + self._dict[key] = orig + val + except (KeyError, TypeError): + try: + # Check if the original is a list. + add_to_orig = orig.append + except AttributeError: + # The original isn't a list, but the new + # value is (by process of elimination), + # so insert the original in the new value + # (if there's one to insert) and replace + # the variable with it. + if orig: + val.insert(0, orig) + self._dict[key] = val + else: + # The original is a list, so append the new + # value to it (if there's a value to append). + if val: + add_to_orig(val) + else: + # The original looks like a dictionary, so update it + # based on what we think the value looks like. + if SCons.Util.is_List(val): + if key == 'CPPDEFINES': + orig = orig.items() + orig += val + self._dict[key] = orig + else: + for v in val: + orig[v] = None + else: + try: + update_dict(val) + except (AttributeError, TypeError, ValueError): + if SCons.Util.is_Dict(val): + for k, v in val.items(): + orig[k] = v + else: + orig[val] = None + self.scanner_map_delete(kw) + + # allow Dirs and strings beginning with # for top-relative + # Note this uses the current env's fs (in self). + def _canonicalize(self, path): + if not SCons.Util.is_String(path): # typically a Dir + path = str(path) + if path and path[0] == '#': + path = str(self.fs.Dir(path)) + return path + + def AppendENVPath(self, name, newpath, envname = 'ENV', + sep = os.pathsep, delete_existing=1): + """Append path elements to the path 'name' in the 'ENV' + dictionary for this environment. Will only add any particular + path once, and will normpath and normcase all paths to help + assure this. This can also handle the case where the env + variable is a list instead of a string. + + If delete_existing is 0, a newpath which is already in the path + will not be moved to the end (it will be left where it is). + """ + + orig = '' + if envname in self._dict and name in self._dict[envname]: + orig = self._dict[envname][name] + + nv = SCons.Util.AppendPath(orig, newpath, sep, delete_existing, + canonicalize=self._canonicalize) + + if envname not in self._dict: + self._dict[envname] = {} + + self._dict[envname][name] = nv + + def AppendUnique(self, delete_existing=0, **kw): + """Append values to existing construction variables + in an Environment, if they're not already there. + If delete_existing is 1, removes existing values first, so + values move to end. + """ + kw = copy_non_reserved_keywords(kw) + for key, val in kw.items(): + if SCons.Util.is_List(val): + val = _delete_duplicates(val, delete_existing) + if key not in self._dict or self._dict[key] in ('', None): + self._dict[key] = val + elif SCons.Util.is_Dict(self._dict[key]) and \ + SCons.Util.is_Dict(val): + self._dict[key].update(val) + elif SCons.Util.is_List(val): + dk = self._dict[key] + if key == 'CPPDEFINES': + tmp = [] + for i in val: + if SCons.Util.is_List(i): + if len(i) >= 2: + tmp.append((i[0], i[1])) + else: + tmp.append((i[0],)) + elif SCons.Util.is_Tuple(i): + tmp.append(i) + else: + tmp.append((i,)) + val = tmp + if SCons.Util.is_Dict(dk): + dk = dk.items() + elif SCons.Util.is_String(dk): + dk = [(dk,)] + else: + tmp = [] + for i in dk: + if SCons.Util.is_List(i): + if len(i) >= 2: + tmp.append((i[0], i[1])) + else: + tmp.append((i[0],)) + elif SCons.Util.is_Tuple(i): + tmp.append(i) + else: + tmp.append((i,)) + dk = tmp + else: + if not SCons.Util.is_List(dk): + dk = [dk] + if delete_existing: + dk = [x for x in dk if x not in val] + else: + val = [x for x in val if x not in dk] + self._dict[key] = dk + val + else: + dk = self._dict[key] + if SCons.Util.is_List(dk): + if key == 'CPPDEFINES': + tmp = [] + for i in dk: + if SCons.Util.is_List(i): + if len(i) >= 2: + tmp.append((i[0], i[1])) + else: + tmp.append((i[0],)) + elif SCons.Util.is_Tuple(i): + tmp.append(i) + else: + tmp.append((i,)) + dk = tmp + if SCons.Util.is_Dict(val): + val = val.items() + elif SCons.Util.is_String(val): + val = [(val,)] + if delete_existing: + dk = filter(lambda x, val=val: x not in val, dk) + self._dict[key] = dk + val + else: + dk = [x for x in dk if x not in val] + self._dict[key] = dk + val + else: + # By elimination, val is not a list. Since dk is a + # list, wrap val in a list first. + if delete_existing: + dk = filter(lambda x, val=val: x not in val, dk) + self._dict[key] = dk + [val] + else: + if not val in dk: + self._dict[key] = dk + [val] + else: + if key == 'CPPDEFINES': + if SCons.Util.is_String(dk): + dk = [dk] + elif SCons.Util.is_Dict(dk): + dk = dk.items() + if SCons.Util.is_String(val): + if val in dk: + val = [] + else: + val = [val] + elif SCons.Util.is_Dict(val): + tmp = [] + for i,j in val.iteritems(): + if j is not None: + tmp.append((i,j)) + else: + tmp.append(i) + val = tmp + if delete_existing: + dk = [x for x in dk if x not in val] + self._dict[key] = dk + val + self.scanner_map_delete(kw) + + def Clone(self, tools=[], toolpath=None, parse_flags = None, **kw): + """Return a copy of a construction Environment. The + copy is like a Python "deep copy"--that is, independent + copies are made recursively of each objects--except that + a reference is copied when an object is not deep-copyable + (like a function). There are no references to any mutable + objects in the original Environment. + """ + try: + builders = self._dict['BUILDERS'] + except KeyError: + pass + + clone = copy.copy(self) + # BUILDERS is not safe to do a simple copy + clone._dict = semi_deepcopy_dict(self._dict, ['BUILDERS']) + clone._dict['BUILDERS'] = BuilderDict(builders, clone) + + # Check the methods added via AddMethod() and re-bind them to + # the cloned environment. Only do this if the attribute hasn't + # been overwritten by the user explicitly and still points to + # the added method. + clone.added_methods = [] + for mw in self.added_methods: + if mw == getattr(self, mw.name): + clone.added_methods.append(mw.clone(clone)) + + clone._memo = {} + + # Apply passed-in variables before the tools + # so the tools can use the new variables + kw = copy_non_reserved_keywords(kw) + new = {} + for key, value in kw.items(): + new[key] = SCons.Subst.scons_subst_once(value, self, key) + clone.Replace(**new) + + apply_tools(clone, tools, toolpath) + + # apply them again in case the tools overwrote them + clone.Replace(**new) + + # Finally, apply any flags to be merged in + if parse_flags: clone.MergeFlags(parse_flags) + + if __debug__: logInstanceCreation(self, 'Environment.EnvironmentClone') + return clone + + def Copy(self, *args, **kw): + global _warn_copy_deprecated + if _warn_copy_deprecated: + msg = "The env.Copy() method is deprecated; use the env.Clone() method instead." + SCons.Warnings.warn(SCons.Warnings.DeprecatedCopyWarning, msg) + _warn_copy_deprecated = False + return self.Clone(*args, **kw) + + def _changed_build(self, dependency, target, prev_ni): + if dependency.changed_state(target, prev_ni): + return 1 + return self.decide_source(dependency, target, prev_ni) + + def _changed_content(self, dependency, target, prev_ni): + return dependency.changed_content(target, prev_ni) + + def _changed_source(self, dependency, target, prev_ni): + target_env = dependency.get_build_env() + type = target_env.get_tgt_sig_type() + if type == 'source': + return target_env.decide_source(dependency, target, prev_ni) + else: + return target_env.decide_target(dependency, target, prev_ni) + + def _changed_timestamp_then_content(self, dependency, target, prev_ni): + return dependency.changed_timestamp_then_content(target, prev_ni) + + def _changed_timestamp_newer(self, dependency, target, prev_ni): + return dependency.changed_timestamp_newer(target, prev_ni) + + def _changed_timestamp_match(self, dependency, target, prev_ni): + return dependency.changed_timestamp_match(target, prev_ni) + + def _copy_from_cache(self, src, dst): + return self.fs.copy(src, dst) + + def _copy2_from_cache(self, src, dst): + return self.fs.copy2(src, dst) + + def Decider(self, function): + copy_function = self._copy2_from_cache + if function in ('MD5', 'content'): + if not SCons.Util.md5: + raise UserError("MD5 signatures are not available in this version of Python.") + function = self._changed_content + elif function == 'MD5-timestamp': + function = self._changed_timestamp_then_content + elif function in ('timestamp-newer', 'make'): + function = self._changed_timestamp_newer + copy_function = self._copy_from_cache + elif function == 'timestamp-match': + function = self._changed_timestamp_match + elif not callable(function): + raise UserError("Unknown Decider value %s" % repr(function)) + + # We don't use AddMethod because we don't want to turn the + # function, which only expects three arguments, into a bound + # method, which would add self as an initial, fourth argument. + self.decide_target = function + self.decide_source = function + + self.copy_from_cache = copy_function + + def Detect(self, progs): + """Return the first available program in progs. + """ + if not SCons.Util.is_List(progs): + progs = [ progs ] + for prog in progs: + path = self.WhereIs(prog) + if path: return prog + return None + + def Dictionary(self, *args): + if not args: + return self._dict + dlist = [self._dict[x] for x in args] + if len(dlist) == 1: + dlist = dlist[0] + return dlist + + def Dump(self, key = None): + """ + Using the standard Python pretty printer, dump the contents of the + scons build environment to stdout. + + If the key passed in is anything other than None, then that will + be used as an index into the build environment dictionary and + whatever is found there will be fed into the pretty printer. Note + that this key is case sensitive. + """ + import pprint + pp = pprint.PrettyPrinter(indent=2) + if key: + dict = self.Dictionary(key) + else: + dict = self.Dictionary() + return pp.pformat(dict) + + def FindIxes(self, paths, prefix, suffix): + """ + Search a list of paths for something that matches the prefix and suffix. + + paths - the list of paths or nodes. + prefix - construction variable for the prefix. + suffix - construction variable for the suffix. + """ + + suffix = self.subst('$'+suffix) + prefix = self.subst('$'+prefix) + + for path in paths: + dir,name = os.path.split(str(path)) + if name[:len(prefix)] == prefix and name[-len(suffix):] == suffix: + return path + + def ParseConfig(self, command, function=None, unique=1): + """ + Use the specified function to parse the output of the command + in order to modify the current environment. The 'command' can + be a string or a list of strings representing a command and + its arguments. 'Function' is an optional argument that takes + the environment, the output of the command, and the unique flag. + If no function is specified, MergeFlags, which treats the output + as the result of a typical 'X-config' command (i.e. gtk-config), + will merge the output into the appropriate variables. + """ + if function is None: + def parse_conf(env, cmd, unique=unique): + return env.MergeFlags(cmd, unique) + function = parse_conf + if SCons.Util.is_List(command): + command = ' '.join(command) + command = self.subst(command) + return function(self, self.backtick(command)) + + def ParseDepends(self, filename, must_exist=None, only_one=0): + """ + Parse a mkdep-style file for explicit dependencies. This is + completely abusable, and should be unnecessary in the "normal" + case of proper SCons configuration, but it may help make + the transition from a Make hierarchy easier for some people + to swallow. It can also be genuinely useful when using a tool + that can write a .d file, but for which writing a scanner would + be too complicated. + """ + filename = self.subst(filename) + try: + fp = open(filename, 'r') + except IOError: + if must_exist: + raise + return + lines = SCons.Util.LogicalLines(fp).readlines() + lines = [l for l in lines if l[0] != '#'] + tdlist = [] + for line in lines: + try: + target, depends = line.split(':', 1) + except (AttributeError, ValueError): + # Throws AttributeError if line isn't a string. Can throw + # ValueError if line doesn't split into two or more elements. + pass + else: + tdlist.append((target.split(), depends.split())) + if only_one: + targets = [] + for td in tdlist: + targets.extend(td[0]) + if len(targets) > 1: + raise SCons.Errors.UserError( + "More than one dependency target found in `%s': %s" + % (filename, targets)) + for target, depends in tdlist: + self.Depends(target, depends) + + def Platform(self, platform): + platform = self.subst(platform) + return SCons.Platform.Platform(platform)(self) + + def Prepend(self, **kw): + """Prepend values to existing construction variables + in an Environment. + """ + kw = copy_non_reserved_keywords(kw) + for key, val in kw.items(): + # It would be easier on the eyes to write this using + # "continue" statements whenever we finish processing an item, + # but Python 1.5.2 apparently doesn't let you use "continue" + # within try:-except: blocks, so we have to nest our code. + try: + orig = self._dict[key] + except KeyError: + # No existing variable in the environment, so just set + # it to the new value. + self._dict[key] = val + else: + try: + # Check if the original looks like a dictionary. + # If it is, we can't just try adding the value because + # dictionaries don't have __add__() methods, and + # things like UserList will incorrectly coerce the + # original dict to a list (which we don't want). + update_dict = orig.update + except AttributeError: + try: + # Most straightforward: just try to add them + # together. This will work in most cases, when the + # original and new values are of compatible types. + self._dict[key] = val + orig + except (KeyError, TypeError): + try: + # Check if the added value is a list. + add_to_val = val.append + except AttributeError: + # The added value isn't a list, but the + # original is (by process of elimination), + # so insert the the new value in the original + # (if there's one to insert). + if val: + orig.insert(0, val) + else: + # The added value is a list, so append + # the original to it (if there's a value + # to append). + if orig: + add_to_val(orig) + self._dict[key] = val + else: + # The original looks like a dictionary, so update it + # based on what we think the value looks like. + if SCons.Util.is_List(val): + for v in val: + orig[v] = None + else: + try: + update_dict(val) + except (AttributeError, TypeError, ValueError): + if SCons.Util.is_Dict(val): + for k, v in val.items(): + orig[k] = v + else: + orig[val] = None + self.scanner_map_delete(kw) + + def PrependENVPath(self, name, newpath, envname = 'ENV', sep = os.pathsep, + delete_existing=1): + """Prepend path elements to the path 'name' in the 'ENV' + dictionary for this environment. Will only add any particular + path once, and will normpath and normcase all paths to help + assure this. This can also handle the case where the env + variable is a list instead of a string. + + If delete_existing is 0, a newpath which is already in the path + will not be moved to the front (it will be left where it is). + """ + + orig = '' + if envname in self._dict and name in self._dict[envname]: + orig = self._dict[envname][name] + + nv = SCons.Util.PrependPath(orig, newpath, sep, delete_existing, + canonicalize=self._canonicalize) + + if envname not in self._dict: + self._dict[envname] = {} + + self._dict[envname][name] = nv + + def PrependUnique(self, delete_existing=0, **kw): + """Prepend values to existing construction variables + in an Environment, if they're not already there. + If delete_existing is 1, removes existing values first, so + values move to front. + """ + kw = copy_non_reserved_keywords(kw) + for key, val in kw.items(): + if SCons.Util.is_List(val): + val = _delete_duplicates(val, not delete_existing) + if key not in self._dict or self._dict[key] in ('', None): + self._dict[key] = val + elif SCons.Util.is_Dict(self._dict[key]) and \ + SCons.Util.is_Dict(val): + self._dict[key].update(val) + elif SCons.Util.is_List(val): + dk = self._dict[key] + if not SCons.Util.is_List(dk): + dk = [dk] + if delete_existing: + dk = [x for x in dk if x not in val] + else: + val = [x for x in val if x not in dk] + self._dict[key] = val + dk + else: + dk = self._dict[key] + if SCons.Util.is_List(dk): + # By elimination, val is not a list. Since dk is a + # list, wrap val in a list first. + if delete_existing: + dk = [x for x in dk if x not in val] + self._dict[key] = [val] + dk + else: + if not val in dk: + self._dict[key] = [val] + dk + else: + if delete_existing: + dk = [x for x in dk if x not in val] + self._dict[key] = val + dk + self.scanner_map_delete(kw) + + def Replace(self, **kw): + """Replace existing construction variables in an Environment + with new construction variables and/or values. + """ + try: + kwbd = kw['BUILDERS'] + except KeyError: + pass + else: + kwbd = BuilderDict(kwbd,self) + del kw['BUILDERS'] + self.__setitem__('BUILDERS', kwbd) + kw = copy_non_reserved_keywords(kw) + self._update(semi_deepcopy(kw)) + self.scanner_map_delete(kw) + + def ReplaceIxes(self, path, old_prefix, old_suffix, new_prefix, new_suffix): + """ + Replace old_prefix with new_prefix and old_suffix with new_suffix. + + env - Environment used to interpolate variables. + path - the path that will be modified. + old_prefix - construction variable for the old prefix. + old_suffix - construction variable for the old suffix. + new_prefix - construction variable for the new prefix. + new_suffix - construction variable for the new suffix. + """ + old_prefix = self.subst('$'+old_prefix) + old_suffix = self.subst('$'+old_suffix) + + new_prefix = self.subst('$'+new_prefix) + new_suffix = self.subst('$'+new_suffix) + + dir,name = os.path.split(str(path)) + if name[:len(old_prefix)] == old_prefix: + name = name[len(old_prefix):] + if name[-len(old_suffix):] == old_suffix: + name = name[:-len(old_suffix)] + return os.path.join(dir, new_prefix+name+new_suffix) + + def SetDefault(self, **kw): + for k in kw.keys(): + if k in self._dict: + del kw[k] + self.Replace(**kw) + + def _find_toolpath_dir(self, tp): + return self.fs.Dir(self.subst(tp)).srcnode().abspath + + def Tool(self, tool, toolpath=None, **kw): + if SCons.Util.is_String(tool): + tool = self.subst(tool) + if toolpath is None: + toolpath = self.get('toolpath', []) + toolpath = list(map(self._find_toolpath_dir, toolpath)) + tool = SCons.Tool.Tool(tool, toolpath, **kw) + tool(self) + + def WhereIs(self, prog, path=None, pathext=None, reject=[]): + """Find prog in the path. + """ + if path is None: + try: + path = self['ENV']['PATH'] + except KeyError: + pass + elif SCons.Util.is_String(path): + path = self.subst(path) + if pathext is None: + try: + pathext = self['ENV']['PATHEXT'] + except KeyError: + pass + elif SCons.Util.is_String(pathext): + pathext = self.subst(pathext) + prog = self.subst(prog) + path = SCons.Util.WhereIs(prog, path, pathext, reject) + if path: return path + return None + + ####################################################################### + # Public methods for doing real "SCons stuff" (manipulating + # dependencies, setting attributes on targets, etc.). These begin + # with upper-case letters. The essential characteristic of methods + # in this section is that they all *should* have corresponding + # same-named global functions. + ####################################################################### + + def Action(self, *args, **kw): + def subst_string(a, self=self): + if SCons.Util.is_String(a): + a = self.subst(a) + return a + nargs = list(map(subst_string, args)) + nkw = self.subst_kw(kw) + return SCons.Action.Action(*nargs, **nkw) + + def AddPreAction(self, files, action): + nodes = self.arg2nodes(files, self.fs.Entry) + action = SCons.Action.Action(action) + uniq = {} + for executor in [n.get_executor() for n in nodes]: + uniq[executor] = 1 + for executor in uniq.keys(): + executor.add_pre_action(action) + return nodes + + def AddPostAction(self, files, action): + nodes = self.arg2nodes(files, self.fs.Entry) + action = SCons.Action.Action(action) + uniq = {} + for executor in [n.get_executor() for n in nodes]: + uniq[executor] = 1 + for executor in uniq.keys(): + executor.add_post_action(action) + return nodes + + def Alias(self, target, source=[], action=None, **kw): + tlist = self.arg2nodes(target, self.ans.Alias) + if not SCons.Util.is_List(source): + source = [source] + source = [_f for _f in source if _f] + + if not action: + if not source: + # There are no source files and no action, so just + # return a target list of classic Alias Nodes, without + # any builder. The externally visible effect is that + # this will make the wrapping Script.BuildTask class + # say that there's "Nothing to be done" for this Alias, + # instead of that it's "up to date." + return tlist + + # No action, but there are sources. Re-call all the target + # builders to add the sources to each target. + result = [] + for t in tlist: + bld = t.get_builder(AliasBuilder) + result.extend(bld(self, t, source)) + return result + + nkw = self.subst_kw(kw) + nkw.update({ + 'action' : SCons.Action.Action(action), + 'source_factory' : self.fs.Entry, + 'multi' : 1, + 'is_explicit' : None, + }) + bld = SCons.Builder.Builder(**nkw) + + # Apply the Builder separately to each target so that the Aliases + # stay separate. If we did one "normal" Builder call with the + # whole target list, then all of the target Aliases would be + # associated under a single Executor. + result = [] + for t in tlist: + # Calling the convert() method will cause a new Executor to be + # created from scratch, so we have to explicitly initialize + # it with the target's existing sources, plus our new ones, + # so nothing gets lost. + b = t.get_builder() + if b is None or b is AliasBuilder: + b = bld + else: + nkw['action'] = b.action + action + b = SCons.Builder.Builder(**nkw) + t.convert() + result.extend(b(self, t, t.sources + source)) + return result + + def AlwaysBuild(self, *targets): + tlist = [] + for t in targets: + tlist.extend(self.arg2nodes(t, self.fs.Entry)) + for t in tlist: + t.set_always_build() + return tlist + + def BuildDir(self, *args, **kw): + msg = """BuildDir() and the build_dir keyword have been deprecated;\n\tuse VariantDir() and the variant_dir keyword instead.""" + SCons.Warnings.warn(SCons.Warnings.DeprecatedBuildDirWarning, msg) + if 'build_dir' in kw: + kw['variant_dir'] = kw['build_dir'] + del kw['build_dir'] + return self.VariantDir(*args, **kw) + + def Builder(self, **kw): + nkw = self.subst_kw(kw) + return SCons.Builder.Builder(**nkw) + + def CacheDir(self, path): + import SCons.CacheDir + if path is not None: + path = self.subst(path) + self._CacheDir_path = path + + def Clean(self, targets, files): + global CleanTargets + tlist = self.arg2nodes(targets, self.fs.Entry) + flist = self.arg2nodes(files, self.fs.Entry) + for t in tlist: + try: + CleanTargets[t].extend(flist) + except KeyError: + CleanTargets[t] = flist + + def Configure(self, *args, **kw): + nargs = [self] + if args: + nargs = nargs + self.subst_list(args)[0] + nkw = self.subst_kw(kw) + nkw['_depth'] = kw.get('_depth', 0) + 1 + try: + nkw['custom_tests'] = self.subst_kw(nkw['custom_tests']) + except KeyError: + pass + return SCons.SConf.SConf(*nargs, **nkw) + + def Command(self, target, source, action, **kw): + """Builds the supplied target files from the supplied + source files using the supplied action. Action may + be any type that the Builder constructor will accept + for an action.""" + bkw = { + 'action' : action, + 'target_factory' : self.fs.Entry, + 'source_factory' : self.fs.Entry, + } + try: bkw['source_scanner'] = kw['source_scanner'] + except KeyError: pass + else: del kw['source_scanner'] + bld = SCons.Builder.Builder(**bkw) + return bld(self, target, source, **kw) + + def Depends(self, target, dependency): + """Explicity specify that 'target's depend on 'dependency'.""" + tlist = self.arg2nodes(target, self.fs.Entry) + dlist = self.arg2nodes(dependency, self.fs.Entry) + for t in tlist: + t.add_dependency(dlist) + return tlist + + def Dir(self, name, *args, **kw): + """ + """ + s = self.subst(name) + if SCons.Util.is_Sequence(s): + result=[] + for e in s: + result.append(self.fs.Dir(e, *args, **kw)) + return result + return self.fs.Dir(s, *args, **kw) + + def NoClean(self, *targets): + """Tags a target so that it will not be cleaned by -c""" + tlist = [] + for t in targets: + tlist.extend(self.arg2nodes(t, self.fs.Entry)) + for t in tlist: + t.set_noclean() + return tlist + + def NoCache(self, *targets): + """Tags a target so that it will not be cached""" + tlist = [] + for t in targets: + tlist.extend(self.arg2nodes(t, self.fs.Entry)) + for t in tlist: + t.set_nocache() + return tlist + + def Entry(self, name, *args, **kw): + """ + """ + s = self.subst(name) + if SCons.Util.is_Sequence(s): + result=[] + for e in s: + result.append(self.fs.Entry(e, *args, **kw)) + return result + return self.fs.Entry(s, *args, **kw) + + def Environment(self, **kw): + return SCons.Environment.Environment(**self.subst_kw(kw)) + + def Execute(self, action, *args, **kw): + """Directly execute an action through an Environment + """ + action = self.Action(action, *args, **kw) + result = action([], [], self) + if isinstance(result, SCons.Errors.BuildError): + errstr = result.errstr + if result.filename: + errstr = result.filename + ': ' + errstr + sys.stderr.write("scons: *** %s\n" % errstr) + return result.status + else: + return result + + def File(self, name, *args, **kw): + """ + """ + s = self.subst(name) + if SCons.Util.is_Sequence(s): + result=[] + for e in s: + result.append(self.fs.File(e, *args, **kw)) + return result + return self.fs.File(s, *args, **kw) + + def FindFile(self, file, dirs): + file = self.subst(file) + nodes = self.arg2nodes(dirs, self.fs.Dir) + return SCons.Node.FS.find_file(file, tuple(nodes)) + + def Flatten(self, sequence): + return SCons.Util.flatten(sequence) + + def GetBuildPath(self, files): + result = list(map(str, self.arg2nodes(files, self.fs.Entry))) + if SCons.Util.is_List(files): + return result + else: + return result[0] + + def Glob(self, pattern, ondisk=True, source=False, strings=False): + return self.fs.Glob(self.subst(pattern), ondisk, source, strings) + + def Ignore(self, target, dependency): + """Ignore a dependency.""" + tlist = self.arg2nodes(target, self.fs.Entry) + dlist = self.arg2nodes(dependency, self.fs.Entry) + for t in tlist: + t.add_ignore(dlist) + return tlist + + def Literal(self, string): + return SCons.Subst.Literal(string) + + def Local(self, *targets): + ret = [] + for targ in targets: + if isinstance(targ, SCons.Node.Node): + targ.set_local() + ret.append(targ) + else: + for t in self.arg2nodes(targ, self.fs.Entry): + t.set_local() + ret.append(t) + return ret + + def Precious(self, *targets): + tlist = [] + for t in targets: + tlist.extend(self.arg2nodes(t, self.fs.Entry)) + for t in tlist: + t.set_precious() + return tlist + + def Repository(self, *dirs, **kw): + dirs = self.arg2nodes(list(dirs), self.fs.Dir) + self.fs.Repository(*dirs, **kw) + + def Requires(self, target, prerequisite): + """Specify that 'prerequisite' must be built before 'target', + (but 'target' does not actually depend on 'prerequisite' + and need not be rebuilt if it changes).""" + tlist = self.arg2nodes(target, self.fs.Entry) + plist = self.arg2nodes(prerequisite, self.fs.Entry) + for t in tlist: + t.add_prerequisite(plist) + return tlist + + def Scanner(self, *args, **kw): + nargs = [] + for arg in args: + if SCons.Util.is_String(arg): + arg = self.subst(arg) + nargs.append(arg) + nkw = self.subst_kw(kw) + return SCons.Scanner.Base(*nargs, **nkw) + + def SConsignFile(self, name=".sconsign", dbm_module=None): + if name is not None: + name = self.subst(name) + if not os.path.isabs(name): + name = os.path.join(str(self.fs.SConstruct_dir), name) + if name: + name = os.path.normpath(name) + sconsign_dir = os.path.dirname(name) + if sconsign_dir and not os.path.exists(sconsign_dir): + self.Execute(SCons.Defaults.Mkdir(sconsign_dir)) + SCons.SConsign.File(name, dbm_module) + + def SideEffect(self, side_effect, target): + """Tell scons that side_effects are built as side + effects of building targets.""" + side_effects = self.arg2nodes(side_effect, self.fs.Entry) + targets = self.arg2nodes(target, self.fs.Entry) + + for side_effect in side_effects: + if side_effect.multiple_side_effect_has_builder(): + raise SCons.Errors.UserError("Multiple ways to build the same target were specified for: %s" % str(side_effect)) + side_effect.add_source(targets) + side_effect.side_effect = 1 + self.Precious(side_effect) + for target in targets: + target.side_effects.append(side_effect) + return side_effects + + def SourceCode(self, entry, builder): + """Arrange for a source code builder for (part of) a tree.""" + msg = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" + SCons.Warnings.warn(SCons.Warnings.DeprecatedSourceCodeWarning, msg) + entries = self.arg2nodes(entry, self.fs.Entry) + for entry in entries: + entry.set_src_builder(builder) + return entries + + def SourceSignatures(self, type): + global _warn_source_signatures_deprecated + if _warn_source_signatures_deprecated: + msg = "The env.SourceSignatures() method is deprecated;\n" + \ + "\tconvert your build to use the env.Decider() method instead." + SCons.Warnings.warn(SCons.Warnings.DeprecatedSourceSignaturesWarning, msg) + _warn_source_signatures_deprecated = False + type = self.subst(type) + self.src_sig_type = type + if type == 'MD5': + if not SCons.Util.md5: + raise UserError("MD5 signatures are not available in this version of Python.") + self.decide_source = self._changed_content + elif type == 'timestamp': + self.decide_source = self._changed_timestamp_match + else: + raise UserError("Unknown source signature type '%s'" % type) + + def Split(self, arg): + """This function converts a string or list into a list of strings + or Nodes. This makes things easier for users by allowing files to + be specified as a white-space separated list to be split. + The input rules are: + - A single string containing names separated by spaces. These will be + split apart at the spaces. + - A single Node instance + - A list containing either strings or Node instances. Any strings + in the list are not split at spaces. + In all cases, the function returns a list of Nodes and strings.""" + if SCons.Util.is_List(arg): + return list(map(self.subst, arg)) + elif SCons.Util.is_String(arg): + return self.subst(arg).split() + else: + return [self.subst(arg)] + + def TargetSignatures(self, type): + global _warn_target_signatures_deprecated + if _warn_target_signatures_deprecated: + msg = "The env.TargetSignatures() method is deprecated;\n" + \ + "\tconvert your build to use the env.Decider() method instead." + SCons.Warnings.warn(SCons.Warnings.DeprecatedTargetSignaturesWarning, msg) + _warn_target_signatures_deprecated = False + type = self.subst(type) + self.tgt_sig_type = type + if type in ('MD5', 'content'): + if not SCons.Util.md5: + raise UserError("MD5 signatures are not available in this version of Python.") + self.decide_target = self._changed_content + elif type == 'timestamp': + self.decide_target = self._changed_timestamp_match + elif type == 'build': + self.decide_target = self._changed_build + elif type == 'source': + self.decide_target = self._changed_source + else: + raise UserError("Unknown target signature type '%s'"%type) + + def Value(self, value, built_value=None): + """ + """ + return SCons.Node.Python.Value(value, built_value) + + def VariantDir(self, variant_dir, src_dir, duplicate=1): + variant_dir = self.arg2nodes(variant_dir, self.fs.Dir)[0] + src_dir = self.arg2nodes(src_dir, self.fs.Dir)[0] + self.fs.VariantDir(variant_dir, src_dir, duplicate) + + def FindSourceFiles(self, node='.'): + """ returns a list of all source files. + """ + node = self.arg2nodes(node, self.fs.Entry)[0] + + sources = [] + def build_source(ss): + for s in ss: + if isinstance(s, SCons.Node.FS.Dir): + build_source(s.all_children()) + elif s.has_builder(): + build_source(s.sources) + elif isinstance(s.disambiguate(), SCons.Node.FS.File): + sources.append(s) + build_source(node.all_children()) + + def final_source(node): + while (node != node.srcnode()): + node = node.srcnode() + return node + sources = map( final_source, sources ); + # remove duplicates + return list(set(sources)) + + def FindInstalledFiles(self): + """ returns the list of all targets of the Install and InstallAs Builder. + """ + from SCons.Tool import install + if install._UNIQUE_INSTALLED_FILES is None: + install._UNIQUE_INSTALLED_FILES = SCons.Util.uniquer_hashables(install._INSTALLED_FILES) + return install._UNIQUE_INSTALLED_FILES + + +class OverrideEnvironment(Base): + """A proxy that overrides variables in a wrapped construction + environment by returning values from an overrides dictionary in + preference to values from the underlying subject environment. + + This is a lightweight (I hope) proxy that passes through most use of + attributes to the underlying Environment.Base class, but has just + enough additional methods defined to act like a real construction + environment with overridden values. It can wrap either a Base + construction environment, or another OverrideEnvironment, which + can in turn nest arbitrary OverrideEnvironments... + + Note that we do *not* call the underlying base class + (SubsitutionEnvironment) initialization, because we get most of those + from proxying the attributes of the subject construction environment. + But because we subclass SubstitutionEnvironment, this class also + has inherited arg2nodes() and subst*() methods; those methods can't + be proxied because they need *this* object's methods to fetch the + values from the overrides dictionary. + """ + + def __init__(self, subject, overrides={}): + if __debug__: logInstanceCreation(self, 'Environment.OverrideEnvironment') + self.__dict__['__subject'] = subject + self.__dict__['overrides'] = overrides + + # Methods that make this class act like a proxy. + def __getattr__(self, name): + return getattr(self.__dict__['__subject'], name) + def __setattr__(self, name, value): + setattr(self.__dict__['__subject'], name, value) + + # Methods that make this class act like a dictionary. + def __getitem__(self, key): + try: + return self.__dict__['overrides'][key] + except KeyError: + return self.__dict__['__subject'].__getitem__(key) + def __setitem__(self, key, value): + if not is_valid_construction_var(key): + raise SCons.Errors.UserError("Illegal construction variable `%s'" % key) + self.__dict__['overrides'][key] = value + def __delitem__(self, key): + try: + del self.__dict__['overrides'][key] + except KeyError: + deleted = 0 + else: + deleted = 1 + try: + result = self.__dict__['__subject'].__delitem__(key) + except KeyError: + if not deleted: + raise + result = None + return result + def get(self, key, default=None): + """Emulates the get() method of dictionaries.""" + try: + return self.__dict__['overrides'][key] + except KeyError: + return self.__dict__['__subject'].get(key, default) + def has_key(self, key): + try: + self.__dict__['overrides'][key] + return 1 + except KeyError: + return key in self.__dict__['__subject'] + def __contains__(self, key): + if self.__dict__['overrides'].__contains__(key): + return 1 + return self.__dict__['__subject'].__contains__(key) + def Dictionary(self): + """Emulates the items() method of dictionaries.""" + d = self.__dict__['__subject'].Dictionary().copy() + d.update(self.__dict__['overrides']) + return d + def items(self): + """Emulates the items() method of dictionaries.""" + return list(self.Dictionary().items()) + + # Overridden private construction environment methods. + def _update(self, dict): + """Update an environment's values directly, bypassing the normal + checks that occur when users try to set items. + """ + self.__dict__['overrides'].update(dict) + + def gvars(self): + return self.__dict__['__subject'].gvars() + + def lvars(self): + lvars = self.__dict__['__subject'].lvars() + lvars.update(self.__dict__['overrides']) + return lvars + + # Overridden public construction environment methods. + def Replace(self, **kw): + kw = copy_non_reserved_keywords(kw) + self.__dict__['overrides'].update(semi_deepcopy(kw)) + +# The entry point that will be used by the external world +# to refer to a construction environment. This allows the wrapper +# interface to extend a construction environment for its own purposes +# by subclassing SCons.Environment.Base and then assigning the +# class to SCons.Environment.Environment. + +Environment = Base + +# An entry point for returning a proxy subclass instance that overrides +# the subst*() methods so they don't actually perform construction +# variable substitution. This is specifically intended to be the shim +# layer in between global function calls (which don't want construction +# variable substitution) and the DefaultEnvironment() (which would +# substitute variables if left to its own devices).""" +# +# We have to wrap this in a function that allows us to delay definition of +# the class until it's necessary, so that when it subclasses Environment +# it will pick up whatever Environment subclass the wrapper interface +# might have assigned to SCons.Environment.Environment. + +def NoSubstitutionProxy(subject): + class _NoSubstitutionProxy(Environment): + def __init__(self, subject): + self.__dict__['__subject'] = subject + def __getattr__(self, name): + return getattr(self.__dict__['__subject'], name) + def __setattr__(self, name, value): + return setattr(self.__dict__['__subject'], name, value) + def executor_to_lvars(self, kwdict): + if kwdict.has_key('executor'): + kwdict['lvars'] = kwdict['executor'].get_lvars() + del kwdict['executor'] + else: + kwdict['lvars'] = {} + def raw_to_mode(self, dict): + try: + raw = dict['raw'] + except KeyError: + pass + else: + del dict['raw'] + dict['mode'] = raw + def subst(self, string, *args, **kwargs): + return string + def subst_kw(self, kw, *args, **kwargs): + return kw + def subst_list(self, string, *args, **kwargs): + nargs = (string, self,) + args + nkw = kwargs.copy() + nkw['gvars'] = {} + self.executor_to_lvars(nkw) + self.raw_to_mode(nkw) + return SCons.Subst.scons_subst_list(*nargs, **nkw) + def subst_target_source(self, string, *args, **kwargs): + nargs = (string, self,) + args + nkw = kwargs.copy() + nkw['gvars'] = {} + self.executor_to_lvars(nkw) + self.raw_to_mode(nkw) + return SCons.Subst.scons_subst(*nargs, **nkw) + return _NoSubstitutionProxy(subject) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Errors.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Errors.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Errors.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Errors.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,205 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +"""SCons.Errors + +This file contains the exception classes used to handle internal +and user errors in SCons. + +""" + +__revision__ = "src/engine/SCons/Errors.py 2013/03/03 09:48:35 garyo" + +import SCons.Util + +import exceptions + +class BuildError(Exception): + """ Errors occuring while building. + + BuildError have the following attributes: + + Information about the cause of the build error: + ----------------------------------------------- + + errstr : a description of the error message + + status : the return code of the action that caused the build + error. Must be set to a non-zero value even if the + build error is not due to an action returning a + non-zero returned code. + + exitstatus : SCons exit status due to this build error. + Must be nonzero unless due to an explicit Exit() + call. Not always the same as status, since + actions return a status code that should be + respected, but SCons typically exits with 2 + irrespective of the return value of the failed + action. + + filename : The name of the file or directory that caused the + build error. Set to None if no files are associated with + this error. This might be different from the target + being built. For example, failure to create the + directory in which the target file will appear. It + can be None if the error is not due to a particular + filename. + + exc_info : Info about exception that caused the build + error. Set to (None, None, None) if this build + error is not due to an exception. + + + Information about the cause of the location of the error: + --------------------------------------------------------- + + node : the error occured while building this target node(s) + + executor : the executor that caused the build to fail (might + be None if the build failures is not due to the + executor failing) + + action : the action that caused the build to fail (might be + None if the build failures is not due to the an + action failure) + + command : the command line for the action that caused the + build to fail (might be None if the build failures + is not due to the an action failure) + """ + + def __init__(self, + node=None, errstr="Unknown error", status=2, exitstatus=2, + filename=None, executor=None, action=None, command=None, + exc_info=(None, None, None)): + + self.errstr = errstr + self.status = status + self.exitstatus = exitstatus + self.filename = filename + self.exc_info = exc_info + + self.node = node + self.executor = executor + self.action = action + self.command = command + + Exception.__init__(self, node, errstr, status, exitstatus, filename, + executor, action, command, exc_info) + + def __str__(self): + if self.filename: + return self.filename + ': ' + self.errstr + else: + return self.errstr + +class InternalError(Exception): + pass + +class UserError(Exception): + pass + +class StopError(Exception): + pass + +class EnvironmentError(Exception): + pass + +class MSVCError(IOError): + pass + +class ExplicitExit(Exception): + def __init__(self, node=None, status=None, *args): + self.node = node + self.status = status + self.exitstatus = status + Exception.__init__(self, *args) + +def convert_to_BuildError(status, exc_info=None): + """ + Convert any return code a BuildError Exception. + + `status' can either be a return code or an Exception. + The buildError.status we set here will normally be + used as the exit status of the "scons" process. + """ + if not exc_info and isinstance(status, Exception): + exc_info = (status.__class__, status, None) + + if isinstance(status, BuildError): + buildError = status + buildError.exitstatus = 2 # always exit with 2 on build errors + elif isinstance(status, ExplicitExit): + status = status.status + errstr = 'Explicit exit, status %s' % status + buildError = BuildError( + errstr=errstr, + status=status, # might be 0, OK here + exitstatus=status, # might be 0, OK here + exc_info=exc_info) + elif isinstance(status, (StopError, UserError)): + buildError = BuildError( + errstr=str(status), + status=2, + exitstatus=2, + exc_info=exc_info) + elif isinstance(status, exceptions.EnvironmentError): + # If an IOError/OSError happens, raise a BuildError. + # Report the name of the file or directory that caused the + # error, which might be different from the target being built + # (for example, failure to create the directory in which the + # target file will appear). + try: filename = status.filename + except AttributeError: filename = None + buildError = BuildError( + errstr=status.strerror, + status=status.errno, + exitstatus=2, + filename=filename, + exc_info=exc_info) + elif isinstance(status, Exception): + buildError = BuildError( + errstr='%s : %s' % (status.__class__.__name__, status), + status=2, + exitstatus=2, + exc_info=exc_info) + elif SCons.Util.is_String(status): + buildError = BuildError( + errstr=status, + status=2, + exitstatus=2) + else: + buildError = BuildError( + errstr="Error %s" % status, + status=status, + exitstatus=2) + + #import sys + #sys.stderr.write("convert_to_BuildError: status %s => (errstr %s, status %s)"%(status,buildError.errstr, buildError.status)) + return buildError + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Executor.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Executor.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Executor.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Executor.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,633 @@ +"""SCons.Executor + +A module for executing actions with specific lists of target and source +Nodes. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Executor.py 2013/03/03 09:48:35 garyo" + +import collections + +from SCons.Debug import logInstanceCreation +import SCons.Errors +import SCons.Memoize + + +class Batch(object): + """Remembers exact association between targets + and sources of executor.""" + def __init__(self, targets=[], sources=[]): + self.targets = targets + self.sources = sources + + + +class TSList(collections.UserList): + """A class that implements $TARGETS or $SOURCES expansions by wrapping + an executor Method. This class is used in the Executor.lvars() + to delay creation of NodeList objects until they're needed. + + Note that we subclass collections.UserList purely so that the + is_Sequence() function will identify an object of this class as + a list during variable expansion. We're not really using any + collections.UserList methods in practice. + """ + def __init__(self, func): + self.func = func + def __getattr__(self, attr): + nl = self.func() + return getattr(nl, attr) + def __getitem__(self, i): + nl = self.func() + return nl[i] + def __getslice__(self, i, j): + nl = self.func() + i = max(i, 0); j = max(j, 0) + return nl[i:j] + def __str__(self): + nl = self.func() + return str(nl) + def __repr__(self): + nl = self.func() + return repr(nl) + +class TSObject(object): + """A class that implements $TARGET or $SOURCE expansions by wrapping + an Executor method. + """ + def __init__(self, func): + self.func = func + def __getattr__(self, attr): + n = self.func() + return getattr(n, attr) + def __str__(self): + n = self.func() + if n: + return str(n) + return '' + def __repr__(self): + n = self.func() + if n: + return repr(n) + return '' + +def rfile(node): + """ + A function to return the results of a Node's rfile() method, + if it exists, and the Node itself otherwise (if it's a Value + Node, e.g.). + """ + try: + rfile = node.rfile + except AttributeError: + return node + else: + return rfile() + + +class Executor(object): + """A class for controlling instances of executing an action. + + This largely exists to hold a single association of an action, + environment, list of environment override dictionaries, targets + and sources for later processing as needed. + """ + + if SCons.Memoize.use_memoizer: + __metaclass__ = SCons.Memoize.Memoized_Metaclass + + memoizer_counters = [] + + def __init__(self, action, env=None, overridelist=[{}], + targets=[], sources=[], builder_kw={}): + if __debug__: logInstanceCreation(self, 'Executor.Executor') + self.set_action_list(action) + self.pre_actions = [] + self.post_actions = [] + self.env = env + self.overridelist = overridelist + if targets or sources: + self.batches = [Batch(targets[:], sources[:])] + else: + self.batches = [] + self.builder_kw = builder_kw + self._memo = {} + + def get_lvars(self): + try: + return self.lvars + except AttributeError: + self.lvars = { + 'CHANGED_SOURCES' : TSList(self._get_changed_sources), + 'CHANGED_TARGETS' : TSList(self._get_changed_targets), + 'SOURCE' : TSObject(self._get_source), + 'SOURCES' : TSList(self._get_sources), + 'TARGET' : TSObject(self._get_target), + 'TARGETS' : TSList(self._get_targets), + 'UNCHANGED_SOURCES' : TSList(self._get_unchanged_sources), + 'UNCHANGED_TARGETS' : TSList(self._get_unchanged_targets), + } + return self.lvars + + def _get_changes(self): + cs = [] + ct = [] + us = [] + ut = [] + for b in self.batches: + if b.targets[0].is_up_to_date(): + us.extend(list(map(rfile, b.sources))) + ut.extend(b.targets) + else: + cs.extend(list(map(rfile, b.sources))) + ct.extend(b.targets) + self._changed_sources_list = SCons.Util.NodeList(cs) + self._changed_targets_list = SCons.Util.NodeList(ct) + self._unchanged_sources_list = SCons.Util.NodeList(us) + self._unchanged_targets_list = SCons.Util.NodeList(ut) + + def _get_changed_sources(self, *args, **kw): + try: + return self._changed_sources_list + except AttributeError: + self._get_changes() + return self._changed_sources_list + + def _get_changed_targets(self, *args, **kw): + try: + return self._changed_targets_list + except AttributeError: + self._get_changes() + return self._changed_targets_list + + def _get_source(self, *args, **kw): + #return SCons.Util.NodeList([rfile(self.batches[0].sources[0]).get_subst_proxy()]) + return rfile(self.batches[0].sources[0]).get_subst_proxy() + + def _get_sources(self, *args, **kw): + return SCons.Util.NodeList([rfile(n).get_subst_proxy() for n in self.get_all_sources()]) + + def _get_target(self, *args, **kw): + #return SCons.Util.NodeList([self.batches[0].targets[0].get_subst_proxy()]) + return self.batches[0].targets[0].get_subst_proxy() + + def _get_targets(self, *args, **kw): + return SCons.Util.NodeList([n.get_subst_proxy() for n in self.get_all_targets()]) + + def _get_unchanged_sources(self, *args, **kw): + try: + return self._unchanged_sources_list + except AttributeError: + self._get_changes() + return self._unchanged_sources_list + + def _get_unchanged_targets(self, *args, **kw): + try: + return self._unchanged_targets_list + except AttributeError: + self._get_changes() + return self._unchanged_targets_list + + def get_action_targets(self): + if not self.action_list: + return [] + targets_string = self.action_list[0].get_targets(self.env, self) + if targets_string[0] == '$': + targets_string = targets_string[1:] + return self.get_lvars()[targets_string] + + def set_action_list(self, action): + import SCons.Util + if not SCons.Util.is_List(action): + if not action: + import SCons.Errors + raise SCons.Errors.UserError("Executor must have an action.") + action = [action] + self.action_list = action + + def get_action_list(self): + return self.pre_actions + self.action_list + self.post_actions + + def get_all_targets(self): + """Returns all targets for all batches of this Executor.""" + result = [] + for batch in self.batches: + result.extend(batch.targets) + return result + + def get_all_sources(self): + """Returns all sources for all batches of this Executor.""" + result = [] + for batch in self.batches: + result.extend(batch.sources) + return result + + def get_all_children(self): + """Returns all unique children (dependencies) for all batches + of this Executor. + + The Taskmaster can recognize when it's already evaluated a + Node, so we don't have to make this list unique for its intended + canonical use case, but we expect there to be a lot of redundancy + (long lists of batched .cc files #including the same .h files + over and over), so removing the duplicates once up front should + save the Taskmaster a lot of work. + """ + result = SCons.Util.UniqueList([]) + for target in self.get_all_targets(): + result.extend(target.children()) + return result + + def get_all_prerequisites(self): + """Returns all unique (order-only) prerequisites for all batches + of this Executor. + """ + result = SCons.Util.UniqueList([]) + for target in self.get_all_targets(): + result.extend(target.prerequisites) + return result + + def get_action_side_effects(self): + + """Returns all side effects for all batches of this + Executor used by the underlying Action. + """ + result = SCons.Util.UniqueList([]) + for target in self.get_action_targets(): + result.extend(target.side_effects) + return result + + memoizer_counters.append(SCons.Memoize.CountValue('get_build_env')) + + def get_build_env(self): + """Fetch or create the appropriate build Environment + for this Executor. + """ + try: + return self._memo['get_build_env'] + except KeyError: + pass + + # Create the build environment instance with appropriate + # overrides. These get evaluated against the current + # environment's construction variables so that users can + # add to existing values by referencing the variable in + # the expansion. + overrides = {} + for odict in self.overridelist: + overrides.update(odict) + + import SCons.Defaults + env = self.env or SCons.Defaults.DefaultEnvironment() + build_env = env.Override(overrides) + + self._memo['get_build_env'] = build_env + + return build_env + + def get_build_scanner_path(self, scanner): + """Fetch the scanner path for this executor's targets and sources. + """ + env = self.get_build_env() + try: + cwd = self.batches[0].targets[0].cwd + except (IndexError, AttributeError): + cwd = None + return scanner.path(env, cwd, + self.get_all_targets(), + self.get_all_sources()) + + def get_kw(self, kw={}): + result = self.builder_kw.copy() + result.update(kw) + result['executor'] = self + return result + + def do_nothing(self, target, kw): + return 0 + + def do_execute(self, target, kw): + """Actually execute the action list.""" + env = self.get_build_env() + kw = self.get_kw(kw) + status = 0 + for act in self.get_action_list(): + #args = (self.get_all_targets(), self.get_all_sources(), env) + args = ([], [], env) + status = act(*args, **kw) + if isinstance(status, SCons.Errors.BuildError): + status.executor = self + raise status + elif status: + msg = "Error %s" % status + raise SCons.Errors.BuildError( + errstr=msg, + node=self.batches[0].targets, + executor=self, + action=act) + return status + + # use extra indirection because with new-style objects (Python 2.2 + # and above) we can't override special methods, and nullify() needs + # to be able to do this. + + def __call__(self, target, **kw): + return self.do_execute(target, kw) + + def cleanup(self): + self._memo = {} + + def add_sources(self, sources): + """Add source files to this Executor's list. This is necessary + for "multi" Builders that can be called repeatedly to build up + a source file list for a given target.""" + # TODO(batch): extend to multiple batches + assert (len(self.batches) == 1) + # TODO(batch): remove duplicates? + sources = [x for x in sources if x not in self.batches[0].sources] + self.batches[0].sources.extend(sources) + + def get_sources(self): + return self.batches[0].sources + + def add_batch(self, targets, sources): + """Add pair of associated target and source to this Executor's list. + This is necessary for "batch" Builders that can be called repeatedly + to build up a list of matching target and source files that will be + used in order to update multiple target files at once from multiple + corresponding source files, for tools like MSVC that support it.""" + self.batches.append(Batch(targets, sources)) + + def prepare(self): + """ + Preparatory checks for whether this Executor can go ahead + and (try to) build its targets. + """ + for s in self.get_all_sources(): + if s.missing(): + msg = "Source `%s' not found, needed by target `%s'." + raise SCons.Errors.StopError(msg % (s, self.batches[0].targets[0])) + + def add_pre_action(self, action): + self.pre_actions.append(action) + + def add_post_action(self, action): + self.post_actions.append(action) + + # another extra indirection for new-style objects and nullify... + + def my_str(self): + env = self.get_build_env() + return "\n".join([action.genstring(self.get_all_targets(), + self.get_all_sources(), + env) + for action in self.get_action_list()]) + + + def __str__(self): + return self.my_str() + + def nullify(self): + self.cleanup() + self.do_execute = self.do_nothing + self.my_str = lambda: '' + + memoizer_counters.append(SCons.Memoize.CountValue('get_contents')) + + def get_contents(self): + """Fetch the signature contents. This is the main reason this + class exists, so we can compute this once and cache it regardless + of how many target or source Nodes there are. + """ + try: + return self._memo['get_contents'] + except KeyError: + pass + env = self.get_build_env() + result = "".join([action.get_contents(self.get_all_targets(), + self.get_all_sources(), + env) + for action in self.get_action_list()]) + self._memo['get_contents'] = result + return result + + def get_timestamp(self): + """Fetch a time stamp for this Executor. We don't have one, of + course (only files do), but this is the interface used by the + timestamp module. + """ + return 0 + + def scan_targets(self, scanner): + # TODO(batch): scan by batches + self.scan(scanner, self.get_all_targets()) + + def scan_sources(self, scanner): + # TODO(batch): scan by batches + if self.batches[0].sources: + self.scan(scanner, self.get_all_sources()) + + def scan(self, scanner, node_list): + """Scan a list of this Executor's files (targets or sources) for + implicit dependencies and update all of the targets with them. + This essentially short-circuits an N*M scan of the sources for + each individual target, which is a hell of a lot more efficient. + """ + env = self.get_build_env() + + # TODO(batch): scan by batches) + deps = [] + if scanner: + for node in node_list: + node.disambiguate() + s = scanner.select(node) + if not s: + continue + path = self.get_build_scanner_path(s) + deps.extend(node.get_implicit_deps(env, s, path)) + else: + kw = self.get_kw() + for node in node_list: + node.disambiguate() + scanner = node.get_env_scanner(env, kw) + if not scanner: + continue + scanner = scanner.select(node) + if not scanner: + continue + path = self.get_build_scanner_path(scanner) + deps.extend(node.get_implicit_deps(env, scanner, path)) + + deps.extend(self.get_implicit_deps()) + + for tgt in self.get_all_targets(): + tgt.add_to_implicit(deps) + + def _get_unignored_sources_key(self, node, ignore=()): + return (node,) + tuple(ignore) + + memoizer_counters.append(SCons.Memoize.CountDict('get_unignored_sources', _get_unignored_sources_key)) + + def get_unignored_sources(self, node, ignore=()): + key = (node,) + tuple(ignore) + try: + memo_dict = self._memo['get_unignored_sources'] + except KeyError: + memo_dict = {} + self._memo['get_unignored_sources'] = memo_dict + else: + try: + return memo_dict[key] + except KeyError: + pass + + if node: + # TODO: better way to do this (it's a linear search, + # but it may not be critical path)? + sourcelist = [] + for b in self.batches: + if node in b.targets: + sourcelist = b.sources + break + else: + sourcelist = self.get_all_sources() + if ignore: + idict = {} + for i in ignore: + idict[i] = 1 + sourcelist = [s for s in sourcelist if s not in idict] + + memo_dict[key] = sourcelist + + return sourcelist + + def get_implicit_deps(self): + """Return the executor's implicit dependencies, i.e. the nodes of + the commands to be executed.""" + result = [] + build_env = self.get_build_env() + for act in self.get_action_list(): + deps = act.get_implicit_deps(self.get_all_targets(), + self.get_all_sources(), + build_env) + result.extend(deps) + return result + + + +_batch_executors = {} + +def GetBatchExecutor(key): + return _batch_executors[key] + +def AddBatchExecutor(key, executor): + assert key not in _batch_executors + _batch_executors[key] = executor + +nullenv = None + + +def get_NullEnvironment(): + """Use singleton pattern for Null Environments.""" + global nullenv + + import SCons.Util + class NullEnvironment(SCons.Util.Null): + import SCons.CacheDir + _CacheDir_path = None + _CacheDir = SCons.CacheDir.CacheDir(None) + def get_CacheDir(self): + return self._CacheDir + + if not nullenv: + nullenv = NullEnvironment() + return nullenv + +class Null(object): + """A null Executor, with a null build Environment, that does + nothing when the rest of the methods call it. + + This might be able to disapper when we refactor things to + disassociate Builders from Nodes entirely, so we're not + going to worry about unit tests for this--at least for now. + """ + def __init__(self, *args, **kw): + if __debug__: logInstanceCreation(self, 'Executor.Null') + self.batches = [Batch(kw['targets'][:], [])] + def get_build_env(self): + return get_NullEnvironment() + def get_build_scanner_path(self): + return None + def cleanup(self): + pass + def prepare(self): + pass + def get_unignored_sources(self, *args, **kw): + return tuple(()) + def get_action_targets(self): + return [] + def get_action_list(self): + return [] + def get_all_targets(self): + return self.batches[0].targets + def get_all_sources(self): + return self.batches[0].targets[0].sources + def get_all_children(self): + return self.batches[0].targets[0].children() + def get_all_prerequisites(self): + return [] + def get_action_side_effects(self): + return [] + def __call__(self, *args, **kw): + return 0 + def get_contents(self): + return '' + def _morph(self): + """Morph this Null executor to a real Executor object.""" + batches = self.batches + self.__class__ = Executor + self.__init__([]) + self.batches = batches + + # The following methods require morphing this Null Executor to a + # real Executor object. + + def add_pre_action(self, action): + self._morph() + self.add_pre_action(action) + def add_post_action(self, action): + self._morph() + self.add_post_action(action) + def set_action_list(self, action): + self._morph() + self.set_action_list(action) + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Job.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Job.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Job.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Job.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,435 @@ +"""SCons.Job + +This module defines the Serial and Parallel classes that execute tasks to +complete a build. The Jobs class provides a higher level interface to start, +stop, and wait on jobs. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Job.py 2013/03/03 09:48:35 garyo" + +import SCons.compat + +import os +import signal + +import SCons.Errors + +# The default stack size (in kilobytes) of the threads used to execute +# jobs in parallel. +# +# We use a stack size of 256 kilobytes. The default on some platforms +# is too large and prevents us from creating enough threads to fully +# parallelized the build. For example, the default stack size on linux +# is 8 MBytes. + +explicit_stack_size = None +default_stack_size = 256 + +interrupt_msg = 'Build interrupted.' + + +class InterruptState(object): + def __init__(self): + self.interrupted = False + + def set(self): + self.interrupted = True + + def __call__(self): + return self.interrupted + + +class Jobs(object): + """An instance of this class initializes N jobs, and provides + methods for starting, stopping, and waiting on all N jobs. + """ + + def __init__(self, num, taskmaster): + """ + create 'num' jobs using the given taskmaster. + + If 'num' is 1 or less, then a serial job will be used, + otherwise a parallel job with 'num' worker threads will + be used. + + The 'num_jobs' attribute will be set to the actual number of jobs + allocated. If more than one job is requested but the Parallel + class can't do it, it gets reset to 1. Wrapping interfaces that + care should check the value of 'num_jobs' after initialization. + """ + + self.job = None + if num > 1: + stack_size = explicit_stack_size + if stack_size is None: + stack_size = default_stack_size + + try: + self.job = Parallel(taskmaster, num, stack_size) + self.num_jobs = num + except NameError: + pass + if self.job is None: + self.job = Serial(taskmaster) + self.num_jobs = 1 + + def run(self, postfunc=lambda: None): + """Run the jobs. + + postfunc() will be invoked after the jobs has run. It will be + invoked even if the jobs are interrupted by a keyboard + interrupt (well, in fact by a signal such as either SIGINT, + SIGTERM or SIGHUP). The execution of postfunc() is protected + against keyboard interrupts and is guaranteed to run to + completion.""" + self._setup_sig_handler() + try: + self.job.start() + finally: + postfunc() + self._reset_sig_handler() + + def were_interrupted(self): + """Returns whether the jobs were interrupted by a signal.""" + return self.job.interrupted() + + def _setup_sig_handler(self): + """Setup an interrupt handler so that SCons can shutdown cleanly in + various conditions: + + a) SIGINT: Keyboard interrupt + b) SIGTERM: kill or system shutdown + c) SIGHUP: Controlling shell exiting + + We handle all of these cases by stopping the taskmaster. It + turns out that it very difficult to stop the build process + by throwing asynchronously an exception such as + KeyboardInterrupt. For example, the python Condition + variables (threading.Condition) and queue's do not seem to + asynchronous-exception-safe. It would require adding a whole + bunch of try/finally block and except KeyboardInterrupt all + over the place. + + Note also that we have to be careful to handle the case when + SCons forks before executing another process. In that case, we + want the child to exit immediately. + """ + def handler(signum, stack, self=self, parentpid=os.getpid()): + if os.getpid() == parentpid: + self.job.taskmaster.stop() + self.job.interrupted.set() + else: + os._exit(2) + + self.old_sigint = signal.signal(signal.SIGINT, handler) + self.old_sigterm = signal.signal(signal.SIGTERM, handler) + try: + self.old_sighup = signal.signal(signal.SIGHUP, handler) + except AttributeError: + pass + + def _reset_sig_handler(self): + """Restore the signal handlers to their previous state (before the + call to _setup_sig_handler().""" + + signal.signal(signal.SIGINT, self.old_sigint) + signal.signal(signal.SIGTERM, self.old_sigterm) + try: + signal.signal(signal.SIGHUP, self.old_sighup) + except AttributeError: + pass + +class Serial(object): + """This class is used to execute tasks in series, and is more efficient + than Parallel, but is only appropriate for non-parallel builds. Only + one instance of this class should be in existence at a time. + + This class is not thread safe. + """ + + def __init__(self, taskmaster): + """Create a new serial job given a taskmaster. + + The taskmaster's next_task() method should return the next task + that needs to be executed, or None if there are no more tasks. The + taskmaster's executed() method will be called for each task when it + is successfully executed or failed() will be called if it failed to + execute (e.g. execute() raised an exception).""" + + self.taskmaster = taskmaster + self.interrupted = InterruptState() + + def start(self): + """Start the job. This will begin pulling tasks from the taskmaster + and executing them, and return when there are no more tasks. If a task + fails to execute (i.e. execute() raises an exception), then the job will + stop.""" + + while True: + task = self.taskmaster.next_task() + + if task is None: + break + + try: + task.prepare() + if task.needs_execute(): + task.execute() + except: + if self.interrupted(): + try: + raise SCons.Errors.BuildError( + task.targets[0], errstr=interrupt_msg) + except: + task.exception_set() + else: + task.exception_set() + + # Let the failed() callback function arrange for the + # build to stop if that's appropriate. + task.failed() + else: + task.executed() + + task.postprocess() + self.taskmaster.cleanup() + + +# Trap import failure so that everything in the Job module but the +# Parallel class (and its dependent classes) will work if the interpreter +# doesn't support threads. +try: + import queue + import threading +except ImportError: + pass +else: + class Worker(threading.Thread): + """A worker thread waits on a task to be posted to its request queue, + dequeues the task, executes it, and posts a tuple including the task + and a boolean indicating whether the task executed successfully. """ + + def __init__(self, requestQueue, resultsQueue, interrupted): + threading.Thread.__init__(self) + self.setDaemon(1) + self.requestQueue = requestQueue + self.resultsQueue = resultsQueue + self.interrupted = interrupted + self.start() + + def run(self): + while True: + task = self.requestQueue.get() + + if task is None: + # The "None" value is used as a sentinel by + # ThreadPool.cleanup(). This indicates that there + # are no more tasks, so we should quit. + break + + try: + if self.interrupted(): + raise SCons.Errors.BuildError( + task.targets[0], errstr=interrupt_msg) + task.execute() + except: + task.exception_set() + ok = False + else: + ok = True + + self.resultsQueue.put((task, ok)) + + class ThreadPool(object): + """This class is responsible for spawning and managing worker threads.""" + + def __init__(self, num, stack_size, interrupted): + """Create the request and reply queues, and 'num' worker threads. + + One must specify the stack size of the worker threads. The + stack size is specified in kilobytes. + """ + self.requestQueue = queue.Queue(0) + self.resultsQueue = queue.Queue(0) + + try: + prev_size = threading.stack_size(stack_size*1024) + except AttributeError, e: + # Only print a warning if the stack size has been + # explicitly set. + if not explicit_stack_size is None: + msg = "Setting stack size is unsupported by this version of Python:\n " + \ + e.args[0] + SCons.Warnings.warn(SCons.Warnings.StackSizeWarning, msg) + except ValueError, e: + msg = "Setting stack size failed:\n " + str(e) + SCons.Warnings.warn(SCons.Warnings.StackSizeWarning, msg) + + # Create worker threads + self.workers = [] + for _ in range(num): + worker = Worker(self.requestQueue, self.resultsQueue, interrupted) + self.workers.append(worker) + + if 'prev_size' in locals(): + threading.stack_size(prev_size) + + def put(self, task): + """Put task into request queue.""" + self.requestQueue.put(task) + + def get(self): + """Remove and return a result tuple from the results queue.""" + return self.resultsQueue.get() + + def preparation_failed(self, task): + self.resultsQueue.put((task, False)) + + def cleanup(self): + """ + Shuts down the thread pool, giving each worker thread a + chance to shut down gracefully. + """ + # For each worker thread, put a sentinel "None" value + # on the requestQueue (indicating that there's no work + # to be done) so that each worker thread will get one and + # terminate gracefully. + for _ in self.workers: + self.requestQueue.put(None) + + # Wait for all of the workers to terminate. + # + # If we don't do this, later Python versions (2.4, 2.5) often + # seem to raise exceptions during shutdown. This happens + # in requestQueue.get(), as an assertion failure that + # requestQueue.not_full is notified while not acquired, + # seemingly because the main thread has shut down (or is + # in the process of doing so) while the workers are still + # trying to pull sentinels off the requestQueue. + # + # Normally these terminations should happen fairly quickly, + # but we'll stick a one-second timeout on here just in case + # someone gets hung. + for worker in self.workers: + worker.join(1.0) + self.workers = [] + + class Parallel(object): + """This class is used to execute tasks in parallel, and is somewhat + less efficient than Serial, but is appropriate for parallel builds. + + This class is thread safe. + """ + + def __init__(self, taskmaster, num, stack_size): + """Create a new parallel job given a taskmaster. + + The taskmaster's next_task() method should return the next + task that needs to be executed, or None if there are no more + tasks. The taskmaster's executed() method will be called + for each task when it is successfully executed or failed() + will be called if the task failed to execute (i.e. execute() + raised an exception). + + Note: calls to taskmaster are serialized, but calls to + execute() on distinct tasks are not serialized, because + that is the whole point of parallel jobs: they can execute + multiple tasks simultaneously. """ + + self.taskmaster = taskmaster + self.interrupted = InterruptState() + self.tp = ThreadPool(num, stack_size, self.interrupted) + + self.maxjobs = num + + def start(self): + """Start the job. This will begin pulling tasks from the + taskmaster and executing them, and return when there are no + more tasks. If a task fails to execute (i.e. execute() raises + an exception), then the job will stop.""" + + jobs = 0 + + while True: + # Start up as many available tasks as we're + # allowed to. + while jobs < self.maxjobs: + task = self.taskmaster.next_task() + if task is None: + break + + try: + # prepare task for execution + task.prepare() + except: + task.exception_set() + task.failed() + task.postprocess() + else: + if task.needs_execute(): + # dispatch task + self.tp.put(task) + jobs = jobs + 1 + else: + task.executed() + task.postprocess() + + if not task and not jobs: break + + # Let any/all completed tasks finish up before we go + # back and put the next batch of tasks on the queue. + while True: + task, ok = self.tp.get() + jobs = jobs - 1 + + if ok: + task.executed() + else: + if self.interrupted(): + try: + raise SCons.Errors.BuildError( + task.targets[0], errstr=interrupt_msg) + except: + task.exception_set() + + # Let the failed() callback function arrange + # for the build to stop if that's appropriate. + task.failed() + + task.postprocess() + + if self.tp.resultsQueue.empty(): + break + + self.tp.cleanup() + self.taskmaster.cleanup() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Memoize.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Memoize.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Memoize.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Memoize.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,244 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Memoize.py 2013/03/03 09:48:35 garyo" + +__doc__ = """Memoizer + +A metaclass implementation to count hits and misses of the computed +values that various methods cache in memory. + +Use of this modules assumes that wrapped methods be coded to cache their +values in a consistent way. Here is an example of wrapping a method +that returns a computed value, with no input parameters: + + memoizer_counters = [] # Memoization + + memoizer_counters.append(SCons.Memoize.CountValue('foo')) # Memoization + + def foo(self): + + try: # Memoization + return self._memo['foo'] # Memoization + except KeyError: # Memoization + pass # Memoization + + result = self.compute_foo_value() + + self._memo['foo'] = result # Memoization + + return result + +Here is an example of wrapping a method that will return different values +based on one or more input arguments: + + def _bar_key(self, argument): # Memoization + return argument # Memoization + + memoizer_counters.append(SCons.Memoize.CountDict('bar', _bar_key)) # Memoization + + def bar(self, argument): + + memo_key = argument # Memoization + try: # Memoization + memo_dict = self._memo['bar'] # Memoization + except KeyError: # Memoization + memo_dict = {} # Memoization + self._memo['dict'] = memo_dict # Memoization + else: # Memoization + try: # Memoization + return memo_dict[memo_key] # Memoization + except KeyError: # Memoization + pass # Memoization + + result = self.compute_bar_value(argument) + + memo_dict[memo_key] = result # Memoization + + return result + +At one point we avoided replicating this sort of logic in all the methods +by putting it right into this module, but we've moved away from that at +present (see the "Historical Note," below.). + +Deciding what to cache is tricky, because different configurations +can have radically different performance tradeoffs, and because the +tradeoffs involved are often so non-obvious. Consequently, deciding +whether or not to cache a given method will likely be more of an art than +a science, but should still be based on available data from this module. +Here are some VERY GENERAL guidelines about deciding whether or not to +cache return values from a method that's being called a lot: + + -- The first question to ask is, "Can we change the calling code + so this method isn't called so often?" Sometimes this can be + done by changing the algorithm. Sometimes the *caller* should + be memoized, not the method you're looking at. + + -- The memoized function should be timed with multiple configurations + to make sure it doesn't inadvertently slow down some other + configuration. + + -- When memoizing values based on a dictionary key composed of + input arguments, you don't need to use all of the arguments + if some of them don't affect the return values. + +Historical Note: The initial Memoizer implementation actually handled +the caching of values for the wrapped methods, based on a set of generic +algorithms for computing hashable values based on the method's arguments. +This collected caching logic nicely, but had two drawbacks: + + Running arguments through a generic key-conversion mechanism is slower + (and less flexible) than just coding these things directly. Since the + methods that need memoized values are generally performance-critical, + slowing them down in order to collect the logic isn't the right + tradeoff. + + Use of the memoizer really obscured what was being called, because + all the memoized methods were wrapped with re-used generic methods. + This made it more difficult, for example, to use the Python profiler + to figure out how to optimize the underlying methods. +""" + +import types + +# A flag controlling whether or not we actually use memoization. +use_memoizer = None + +CounterList = [] + +class Counter(object): + """ + Base class for counting memoization hits and misses. + + We expect that the metaclass initialization will have filled in + the .name attribute that represents the name of the function + being counted. + """ + def __init__(self, method_name): + """ + """ + self.method_name = method_name + self.hit = 0 + self.miss = 0 + CounterList.append(self) + def display(self): + fmt = " %7d hits %7d misses %s()" + print fmt % (self.hit, self.miss, self.name) + def __cmp__(self, other): + try: + return cmp(self.name, other.name) + except AttributeError: + return 0 + +class CountValue(Counter): + """ + A counter class for simple, atomic memoized values. + + A CountValue object should be instantiated in a class for each of + the class's methods that memoizes its return value by simply storing + the return value in its _memo dictionary. + + We expect that the metaclass initialization will fill in the + .underlying_method attribute with the method that we're wrapping. + We then call the underlying_method method after counting whether + its memoized value has already been set (a hit) or not (a miss). + """ + def __call__(self, *args, **kw): + obj = args[0] + if self.method_name in obj._memo: + self.hit = self.hit + 1 + else: + self.miss = self.miss + 1 + return self.underlying_method(*args, **kw) + +class CountDict(Counter): + """ + A counter class for memoized values stored in a dictionary, with + keys based on the method's input arguments. + + A CountDict object is instantiated in a class for each of the + class's methods that memoizes its return value in a dictionary, + indexed by some key that can be computed from one or more of + its input arguments. + + We expect that the metaclass initialization will fill in the + .underlying_method attribute with the method that we're wrapping. + We then call the underlying_method method after counting whether the + computed key value is already present in the memoization dictionary + (a hit) or not (a miss). + """ + def __init__(self, method_name, keymaker): + """ + """ + Counter.__init__(self, method_name) + self.keymaker = keymaker + def __call__(self, *args, **kw): + obj = args[0] + try: + memo_dict = obj._memo[self.method_name] + except KeyError: + self.miss = self.miss + 1 + else: + key = self.keymaker(*args, **kw) + if key in memo_dict: + self.hit = self.hit + 1 + else: + self.miss = self.miss + 1 + return self.underlying_method(*args, **kw) + +class Memoizer(object): + """Object which performs caching of method calls for its 'primary' + instance.""" + + def __init__(self): + pass + +def Dump(title=None): + if title: + print title + CounterList.sort() + for counter in CounterList: + counter.display() + +class Memoized_Metaclass(type): + def __init__(cls, name, bases, cls_dict): + super(Memoized_Metaclass, cls).__init__(name, bases, cls_dict) + + for counter in cls_dict.get('memoizer_counters', []): + method_name = counter.method_name + + counter.name = cls.__name__ + '.' + method_name + counter.underlying_method = cls_dict[method_name] + + replacement_method = types.MethodType(counter, None, cls) + setattr(cls, method_name, replacement_method) + +def EnableMemoization(): + global use_memoizer + use_memoizer = 1 + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Node/Alias.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Node/Alias.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Node/Alias.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Node/Alias.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,152 @@ + +"""scons.Node.Alias + +Alias nodes. + +This creates a hash of global Aliases (dummy targets). + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Node/Alias.py 2013/03/03 09:48:35 garyo" + +import collections + +import SCons.Errors +import SCons.Node +import SCons.Util + +class AliasNameSpace(collections.UserDict): + def Alias(self, name, **kw): + if isinstance(name, SCons.Node.Alias.Alias): + return name + try: + a = self[name] + except KeyError: + a = SCons.Node.Alias.Alias(name, **kw) + self[name] = a + return a + + def lookup(self, name, **kw): + try: + return self[name] + except KeyError: + return None + +class AliasNodeInfo(SCons.Node.NodeInfoBase): + current_version_id = 1 + field_list = ['csig'] + def str_to_node(self, s): + return default_ans.Alias(s) + +class AliasBuildInfo(SCons.Node.BuildInfoBase): + current_version_id = 1 + +class Alias(SCons.Node.Node): + + NodeInfo = AliasNodeInfo + BuildInfo = AliasBuildInfo + + def __init__(self, name): + SCons.Node.Node.__init__(self) + self.name = name + + def str_for_display(self): + return '"' + self.__str__() + '"' + + def __str__(self): + return self.name + + def make_ready(self): + self.get_csig() + + really_build = SCons.Node.Node.build + is_up_to_date = SCons.Node.Node.children_are_up_to_date + + def is_under(self, dir): + # Make Alias nodes get built regardless of + # what directory scons was run from. Alias nodes + # are outside the filesystem: + return 1 + + def get_contents(self): + """The contents of an alias is the concatenation + of the content signatures of all its sources.""" + childsigs = [n.get_csig() for n in self.children()] + return ''.join(childsigs) + + def sconsign(self): + """An Alias is not recorded in .sconsign files""" + pass + + # + # + # + + def changed_since_last_build(self, target, prev_ni): + cur_csig = self.get_csig() + try: + return cur_csig != prev_ni.csig + except AttributeError: + return 1 + + def build(self): + """A "builder" for aliases.""" + pass + + def convert(self): + try: del self.builder + except AttributeError: pass + self.reset_executor() + self.build = self.really_build + + def get_csig(self): + """ + Generate a node's content signature, the digested signature + of its content. + + node - the node + cache - alternate node to use for the signature cache + returns - the content signature + """ + try: + return self.ninfo.csig + except AttributeError: + pass + + contents = self.get_contents() + csig = SCons.Util.MD5signature(contents) + self.get_ninfo().csig = csig + return csig + +default_ans = AliasNameSpace() + +SCons.Node.arg2nodes_lookups.append(default_ans.lookup) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Node/FS.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Node/FS.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Node/FS.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Node/FS.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,3302 @@ +"""scons.Node.FS + +File system nodes. + +These Nodes represent the canonical external objects that people think +of when they think of building software: files and directories. + +This holds a "default_fs" variable that should be initialized with an FS +that can be used by scripts or modules looking for the canonical default. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Node/FS.py 2013/03/03 09:48:35 garyo" + +import fnmatch +import os +import re +import shutil +import stat +import sys +import time +import codecs + +import SCons.Action +from SCons.Debug import logInstanceCreation +import SCons.Errors +import SCons.Memoize +import SCons.Node +import SCons.Node.Alias +import SCons.Subst +import SCons.Util +import SCons.Warnings + +from SCons.Debug import Trace + +do_store_info = True +print_duplicate = 0 + + +class EntryProxyAttributeError(AttributeError): + """ + An AttributeError subclass for recording and displaying the name + of the underlying Entry involved in an AttributeError exception. + """ + def __init__(self, entry_proxy, attribute): + AttributeError.__init__(self) + self.entry_proxy = entry_proxy + self.attribute = attribute + def __str__(self): + entry = self.entry_proxy.get() + fmt = "%s instance %s has no attribute %s" + return fmt % (entry.__class__.__name__, + repr(entry.name), + repr(self.attribute)) + +# The max_drift value: by default, use a cached signature value for +# any file that's been untouched for more than two days. +default_max_drift = 2*24*60*60 + +# +# We stringify these file system Nodes a lot. Turning a file system Node +# into a string is non-trivial, because the final string representation +# can depend on a lot of factors: whether it's a derived target or not, +# whether it's linked to a repository or source directory, and whether +# there's duplication going on. The normal technique for optimizing +# calculations like this is to memoize (cache) the string value, so you +# only have to do the calculation once. +# +# A number of the above factors, however, can be set after we've already +# been asked to return a string for a Node, because a Repository() or +# VariantDir() call or the like may not occur until later in SConscript +# files. So this variable controls whether we bother trying to save +# string values for Nodes. The wrapper interface can set this whenever +# they're done mucking with Repository and VariantDir and the other stuff, +# to let this module know it can start returning saved string values +# for Nodes. +# +Save_Strings = None + +def save_strings(val): + global Save_Strings + Save_Strings = val + +# +# Avoid unnecessary function calls by recording a Boolean value that +# tells us whether or not os.path.splitdrive() actually does anything +# on this system, and therefore whether we need to bother calling it +# when looking up path names in various methods below. +# + +do_splitdrive = None +_my_splitdrive =None + +def initialize_do_splitdrive(): + global do_splitdrive + global has_unc + drive, path = os.path.splitdrive('X:/foo') + has_unc = hasattr(os.path, 'splitunc') + + do_splitdrive = not not drive or has_unc + + global _my_splitdrive + if has_unc: + def splitdrive(p): + if p[1:2] == ':': + return p[:2], p[2:] + if p[0:2] == '//': + # Note that we leave a leading slash in the path + # because UNC paths are always absolute. + return '//', p[1:] + return '', p + else: + def splitdrive(p): + if p[1:2] == ':': + return p[:2], p[2:] + return '', p + _my_splitdrive = splitdrive + + # Keep some commonly used values in global variables to skip to + # module look-up costs. + global OS_SEP + global UNC_PREFIX + global os_sep_is_slash + + OS_SEP = os.sep + UNC_PREFIX = OS_SEP + OS_SEP + os_sep_is_slash = OS_SEP == '/' + +initialize_do_splitdrive() + +# Used to avoid invoking os.path.normpath if not necessary. +needs_normpath_check = re.compile( + r''' + # We need to renormalize the path if it contains any consecutive + # '/' characters. + .*// | + + # We need to renormalize the path if it contains a '..' directory. + # Note that we check for all the following cases: + # + # a) The path is a single '..' + # b) The path starts with '..'. E.g. '../' or '../moredirs' + # but we not match '..abc/'. + # c) The path ends with '..'. E.g. '/..' or 'dirs/..' + # d) The path contains a '..' in the middle. + # E.g. dirs/../moredirs + + (.*/)?\.\.(?:/|$) | + + # We need to renormalize the path if it contains a '.' + # directory, but NOT if it is a single '.' '/' characters. We + # do not want to match a single '.' because this case is checked + # for explicitely since this is common enough case. + # + # Note that we check for all the following cases: + # + # a) We don't match a single '.' + # b) We match if the path starts with '.'. E.g. './' or + # './moredirs' but we not match '.abc/'. + # c) We match if the path ends with '.'. E.g. '/.' or + # 'dirs/.' + # d) We match if the path contains a '.' in the middle. + # E.g. dirs/./moredirs + + \./|.*/\.(?:/|$) + + ''', + re.VERBOSE + ) +needs_normpath_match = needs_normpath_check.match + +# +# SCons.Action objects for interacting with the outside world. +# +# The Node.FS methods in this module should use these actions to +# create and/or remove files and directories; they should *not* use +# os.{link,symlink,unlink,mkdir}(), etc., directly. +# +# Using these SCons.Action objects ensures that descriptions of these +# external activities are properly displayed, that the displays are +# suppressed when the -s (silent) option is used, and (most importantly) +# the actions are disabled when the the -n option is used, in which case +# there should be *no* changes to the external file system(s)... +# + +if hasattr(os, 'link'): + def _hardlink_func(fs, src, dst): + # If the source is a symlink, we can't just hard-link to it + # because a relative symlink may point somewhere completely + # different. We must disambiguate the symlink and then + # hard-link the final destination file. + while fs.islink(src): + link = fs.readlink(src) + if not os.path.isabs(link): + src = link + else: + src = os.path.join(os.path.dirname(src), link) + fs.link(src, dst) +else: + _hardlink_func = None + +if hasattr(os, 'symlink'): + def _softlink_func(fs, src, dst): + fs.symlink(src, dst) +else: + _softlink_func = None + +def _copy_func(fs, src, dest): + shutil.copy2(src, dest) + st = fs.stat(src) + fs.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE) + + +Valid_Duplicates = ['hard-soft-copy', 'soft-hard-copy', + 'hard-copy', 'soft-copy', 'copy'] + +Link_Funcs = [] # contains the callables of the specified duplication style + +def set_duplicate(duplicate): + # Fill in the Link_Funcs list according to the argument + # (discarding those not available on the platform). + + # Set up the dictionary that maps the argument names to the + # underlying implementations. We do this inside this function, + # not in the top-level module code, so that we can remap os.link + # and os.symlink for testing purposes. + link_dict = { + 'hard' : _hardlink_func, + 'soft' : _softlink_func, + 'copy' : _copy_func + } + + if not duplicate in Valid_Duplicates: + raise SCons.Errors.InternalError("The argument of set_duplicate " + "should be in Valid_Duplicates") + global Link_Funcs + Link_Funcs = [] + for func in duplicate.split('-'): + if link_dict[func]: + Link_Funcs.append(link_dict[func]) + +def LinkFunc(target, source, env): + # Relative paths cause problems with symbolic links, so + # we use absolute paths, which may be a problem for people + # who want to move their soft-linked src-trees around. Those + # people should use the 'hard-copy' mode, softlinks cannot be + # used for that; at least I have no idea how ... + src = source[0].abspath + dest = target[0].abspath + dir, file = os.path.split(dest) + if dir and not target[0].fs.isdir(dir): + os.makedirs(dir) + if not Link_Funcs: + # Set a default order of link functions. + set_duplicate('hard-soft-copy') + fs = source[0].fs + # Now link the files with the previously specified order. + for func in Link_Funcs: + try: + func(fs, src, dest) + break + except (IOError, OSError): + # An OSError indicates something happened like a permissions + # problem or an attempt to symlink across file-system + # boundaries. An IOError indicates something like the file + # not existing. In either case, keeping trying additional + # functions in the list and only raise an error if the last + # one failed. + if func == Link_Funcs[-1]: + # exception of the last link method (copy) are fatal + raise + return 0 + +Link = SCons.Action.Action(LinkFunc, None) +def LocalString(target, source, env): + return 'Local copy of %s from %s' % (target[0], source[0]) + +LocalCopy = SCons.Action.Action(LinkFunc, LocalString) + +def UnlinkFunc(target, source, env): + t = target[0] + t.fs.unlink(t.abspath) + return 0 + +Unlink = SCons.Action.Action(UnlinkFunc, None) + +def MkdirFunc(target, source, env): + t = target[0] + if not t.exists(): + t.fs.mkdir(t.abspath) + return 0 + +Mkdir = SCons.Action.Action(MkdirFunc, None, presub=None) + +MkdirBuilder = None + +def get_MkdirBuilder(): + global MkdirBuilder + if MkdirBuilder is None: + import SCons.Builder + import SCons.Defaults + # "env" will get filled in by Executor.get_build_env() + # calling SCons.Defaults.DefaultEnvironment() when necessary. + MkdirBuilder = SCons.Builder.Builder(action = Mkdir, + env = None, + explain = None, + is_explicit = None, + target_scanner = SCons.Defaults.DirEntryScanner, + name = "MkdirBuilder") + return MkdirBuilder + +class _Null(object): + pass + +_null = _Null() + +DefaultSCCSBuilder = None +DefaultRCSBuilder = None + +def get_DefaultSCCSBuilder(): + global DefaultSCCSBuilder + if DefaultSCCSBuilder is None: + import SCons.Builder + # "env" will get filled in by Executor.get_build_env() + # calling SCons.Defaults.DefaultEnvironment() when necessary. + act = SCons.Action.Action('$SCCSCOM', '$SCCSCOMSTR') + DefaultSCCSBuilder = SCons.Builder.Builder(action = act, + env = None, + name = "DefaultSCCSBuilder") + return DefaultSCCSBuilder + +def get_DefaultRCSBuilder(): + global DefaultRCSBuilder + if DefaultRCSBuilder is None: + import SCons.Builder + # "env" will get filled in by Executor.get_build_env() + # calling SCons.Defaults.DefaultEnvironment() when necessary. + act = SCons.Action.Action('$RCS_COCOM', '$RCS_COCOMSTR') + DefaultRCSBuilder = SCons.Builder.Builder(action = act, + env = None, + name = "DefaultRCSBuilder") + return DefaultRCSBuilder + +# Cygwin's os.path.normcase pretends it's on a case-sensitive filesystem. +_is_cygwin = sys.platform == "cygwin" +if os.path.normcase("TeSt") == os.path.normpath("TeSt") and not _is_cygwin: + def _my_normcase(x): + return x +else: + def _my_normcase(x): + return x.upper() + + + +class DiskChecker(object): + def __init__(self, type, do, ignore): + self.type = type + self.do = do + self.ignore = ignore + self.func = do + def __call__(self, *args, **kw): + return self.func(*args, **kw) + def set(self, list): + if self.type in list: + self.func = self.do + else: + self.func = self.ignore + +def do_diskcheck_match(node, predicate, errorfmt): + result = predicate() + try: + # If calling the predicate() cached a None value from stat(), + # remove it so it doesn't interfere with later attempts to + # build this Node as we walk the DAG. (This isn't a great way + # to do this, we're reaching into an interface that doesn't + # really belong to us, but it's all about performance, so + # for now we'll just document the dependency...) + if node._memo['stat'] is None: + del node._memo['stat'] + except (AttributeError, KeyError): + pass + if result: + raise TypeError(errorfmt % node.abspath) + +def ignore_diskcheck_match(node, predicate, errorfmt): + pass + +def do_diskcheck_rcs(node, name): + try: + rcs_dir = node.rcs_dir + except AttributeError: + if node.entry_exists_on_disk('RCS'): + rcs_dir = node.Dir('RCS') + else: + rcs_dir = None + node.rcs_dir = rcs_dir + if rcs_dir: + return rcs_dir.entry_exists_on_disk(name+',v') + return None + +def ignore_diskcheck_rcs(node, name): + return None + +def do_diskcheck_sccs(node, name): + try: + sccs_dir = node.sccs_dir + except AttributeError: + if node.entry_exists_on_disk('SCCS'): + sccs_dir = node.Dir('SCCS') + else: + sccs_dir = None + node.sccs_dir = sccs_dir + if sccs_dir: + return sccs_dir.entry_exists_on_disk('s.'+name) + return None + +def ignore_diskcheck_sccs(node, name): + return None + +diskcheck_match = DiskChecker('match', do_diskcheck_match, ignore_diskcheck_match) +diskcheck_rcs = DiskChecker('rcs', do_diskcheck_rcs, ignore_diskcheck_rcs) +diskcheck_sccs = DiskChecker('sccs', do_diskcheck_sccs, ignore_diskcheck_sccs) + +diskcheckers = [ + diskcheck_match, + diskcheck_rcs, + diskcheck_sccs, +] + +def set_diskcheck(list): + for dc in diskcheckers: + dc.set(list) + +def diskcheck_types(): + return [dc.type for dc in diskcheckers] + + + +class EntryProxy(SCons.Util.Proxy): + + __str__ = SCons.Util.Delegate('__str__') + + def __get_abspath(self): + entry = self.get() + return SCons.Subst.SpecialAttrWrapper(entry.get_abspath(), + entry.name + "_abspath") + + def __get_filebase(self): + name = self.get().name + return SCons.Subst.SpecialAttrWrapper(SCons.Util.splitext(name)[0], + name + "_filebase") + + def __get_suffix(self): + name = self.get().name + return SCons.Subst.SpecialAttrWrapper(SCons.Util.splitext(name)[1], + name + "_suffix") + + def __get_file(self): + name = self.get().name + return SCons.Subst.SpecialAttrWrapper(name, name + "_file") + + def __get_base_path(self): + """Return the file's directory and file name, with the + suffix stripped.""" + entry = self.get() + return SCons.Subst.SpecialAttrWrapper(SCons.Util.splitext(entry.get_path())[0], + entry.name + "_base") + + def __get_posix_path(self): + """Return the path with / as the path separator, + regardless of platform.""" + if os_sep_is_slash: + return self + else: + entry = self.get() + r = entry.get_path().replace(OS_SEP, '/') + return SCons.Subst.SpecialAttrWrapper(r, entry.name + "_posix") + + def __get_windows_path(self): + """Return the path with \ as the path separator, + regardless of platform.""" + if OS_SEP == '\\': + return self + else: + entry = self.get() + r = entry.get_path().replace(OS_SEP, '\\') + return SCons.Subst.SpecialAttrWrapper(r, entry.name + "_windows") + + def __get_srcnode(self): + return EntryProxy(self.get().srcnode()) + + def __get_srcdir(self): + """Returns the directory containing the source node linked to this + node via VariantDir(), or the directory of this node if not linked.""" + return EntryProxy(self.get().srcnode().dir) + + def __get_rsrcnode(self): + return EntryProxy(self.get().srcnode().rfile()) + + def __get_rsrcdir(self): + """Returns the directory containing the source node linked to this + node via VariantDir(), or the directory of this node if not linked.""" + return EntryProxy(self.get().srcnode().rfile().dir) + + def __get_dir(self): + return EntryProxy(self.get().dir) + + dictSpecialAttrs = { "base" : __get_base_path, + "posix" : __get_posix_path, + "windows" : __get_windows_path, + "win32" : __get_windows_path, + "srcpath" : __get_srcnode, + "srcdir" : __get_srcdir, + "dir" : __get_dir, + "abspath" : __get_abspath, + "filebase" : __get_filebase, + "suffix" : __get_suffix, + "file" : __get_file, + "rsrcpath" : __get_rsrcnode, + "rsrcdir" : __get_rsrcdir, + } + + def __getattr__(self, name): + # This is how we implement the "special" attributes + # such as base, posix, srcdir, etc. + try: + attr_function = self.dictSpecialAttrs[name] + except KeyError: + try: + attr = SCons.Util.Proxy.__getattr__(self, name) + except AttributeError, e: + # Raise our own AttributeError subclass with an + # overridden __str__() method that identifies the + # name of the entry that caused the exception. + raise EntryProxyAttributeError(self, name) + return attr + else: + return attr_function(self) + +class Base(SCons.Node.Node): + """A generic class for file system entries. This class is for + when we don't know yet whether the entry being looked up is a file + or a directory. Instances of this class can morph into either + Dir or File objects by a later, more precise lookup. + + Note: this class does not define __cmp__ and __hash__ for + efficiency reasons. SCons does a lot of comparing of + Node.FS.{Base,Entry,File,Dir} objects, so those operations must be + as fast as possible, which means we want to use Python's built-in + object identity comparisons. + """ + + memoizer_counters = [] + + def __init__(self, name, directory, fs): + """Initialize a generic Node.FS.Base object. + + Call the superclass initialization, take care of setting up + our relative and absolute paths, identify our parent + directory, and indicate that this node should use + signatures.""" + if __debug__: logInstanceCreation(self, 'Node.FS.Base') + SCons.Node.Node.__init__(self) + + # Filenames and paths are probably reused and are intern'ed to + # save some memory. + + #: Filename with extension as it was specified when the object was + #: created; to obtain filesystem path, use Python str() function + self.name = SCons.Util.silent_intern(name) + #: Cached filename extension + self.suffix = SCons.Util.silent_intern(SCons.Util.splitext(name)[1]) + self.fs = fs #: Reference to parent Node.FS object + + assert directory, "A directory must be provided" + + self.abspath = SCons.Util.silent_intern(directory.entry_abspath(name)) + self.labspath = SCons.Util.silent_intern(directory.entry_labspath(name)) + if directory.path == '.': + self.path = SCons.Util.silent_intern(name) + else: + self.path = SCons.Util.silent_intern(directory.entry_path(name)) + if directory.tpath == '.': + self.tpath = SCons.Util.silent_intern(name) + else: + self.tpath = SCons.Util.silent_intern(directory.entry_tpath(name)) + self.path_elements = directory.path_elements + [self] + + self.dir = directory + self.cwd = None # will hold the SConscript directory for target nodes + self.duplicate = directory.duplicate + + def str_for_display(self): + return '"' + self.__str__() + '"' + + def must_be_same(self, klass): + """ + This node, which already existed, is being looked up as the + specified klass. Raise an exception if it isn't. + """ + if isinstance(self, klass) or klass is Entry: + return + raise TypeError("Tried to lookup %s '%s' as a %s." %\ + (self.__class__.__name__, self.path, klass.__name__)) + + def get_dir(self): + return self.dir + + def get_suffix(self): + return self.suffix + + def rfile(self): + return self + + def __str__(self): + """A Node.FS.Base object's string representation is its path + name.""" + global Save_Strings + if Save_Strings: + return self._save_str() + return self._get_str() + + memoizer_counters.append(SCons.Memoize.CountValue('_save_str')) + + def _save_str(self): + try: + return self._memo['_save_str'] + except KeyError: + pass + result = sys.intern(self._get_str()) + self._memo['_save_str'] = result + return result + + def _get_str(self): + global Save_Strings + if self.duplicate or self.is_derived(): + return self.get_path() + srcnode = self.srcnode() + if srcnode.stat() is None and self.stat() is not None: + result = self.get_path() + else: + result = srcnode.get_path() + if not Save_Strings: + # We're not at the point where we're saving the string + # representations of FS Nodes (because we haven't finished + # reading the SConscript files and need to have str() return + # things relative to them). That also means we can't yet + # cache values returned (or not returned) by stat(), since + # Python code in the SConscript files might still create + # or otherwise affect the on-disk file. So get rid of the + # values that the underlying stat() method saved. + try: del self._memo['stat'] + except KeyError: pass + if self is not srcnode: + try: del srcnode._memo['stat'] + except KeyError: pass + return result + + rstr = __str__ + + memoizer_counters.append(SCons.Memoize.CountValue('stat')) + + def stat(self): + try: return self._memo['stat'] + except KeyError: pass + try: result = self.fs.stat(self.abspath) + except os.error: result = None + self._memo['stat'] = result + return result + + def exists(self): + return self.stat() is not None + + def rexists(self): + return self.rfile().exists() + + def getmtime(self): + st = self.stat() + if st: return st[stat.ST_MTIME] + else: return None + + def getsize(self): + st = self.stat() + if st: return st[stat.ST_SIZE] + else: return None + + def isdir(self): + st = self.stat() + return st is not None and stat.S_ISDIR(st[stat.ST_MODE]) + + def isfile(self): + st = self.stat() + return st is not None and stat.S_ISREG(st[stat.ST_MODE]) + + if hasattr(os, 'symlink'): + def islink(self): + try: st = self.fs.lstat(self.abspath) + except os.error: return 0 + return stat.S_ISLNK(st[stat.ST_MODE]) + else: + def islink(self): + return 0 # no symlinks + + def is_under(self, dir): + if self is dir: + return 1 + else: + return self.dir.is_under(dir) + + def set_local(self): + self._local = 1 + + def srcnode(self): + """If this node is in a build path, return the node + corresponding to its source file. Otherwise, return + ourself. + """ + srcdir_list = self.dir.srcdir_list() + if srcdir_list: + srcnode = srcdir_list[0].Entry(self.name) + srcnode.must_be_same(self.__class__) + return srcnode + return self + + def get_path(self, dir=None): + """Return path relative to the current working directory of the + Node.FS.Base object that owns us.""" + if not dir: + dir = self.fs.getcwd() + if self == dir: + return '.' + path_elems = self.path_elements + pathname = '' + try: i = path_elems.index(dir) + except ValueError: + for p in path_elems[:-1]: + pathname += p.dirname + else: + for p in path_elems[i+1:-1]: + pathname += p.dirname + return pathname + path_elems[-1].name + + def set_src_builder(self, builder): + """Set the source code builder for this node.""" + self.sbuilder = builder + if not self.has_builder(): + self.builder_set(builder) + + def src_builder(self): + """Fetch the source code builder for this node. + + If there isn't one, we cache the source code builder specified + for the directory (which in turn will cache the value from its + parent directory, and so on up to the file system root). + """ + try: + scb = self.sbuilder + except AttributeError: + scb = self.dir.src_builder() + self.sbuilder = scb + return scb + + def get_abspath(self): + """Get the absolute path of the file.""" + return self.abspath + + def for_signature(self): + # Return just our name. Even an absolute path would not work, + # because that can change thanks to symlinks or remapped network + # paths. + return self.name + + def get_subst_proxy(self): + try: + return self._proxy + except AttributeError: + ret = EntryProxy(self) + self._proxy = ret + return ret + + def target_from_source(self, prefix, suffix, splitext=SCons.Util.splitext): + """ + + Generates a target entry that corresponds to this entry (usually + a source file) with the specified prefix and suffix. + + Note that this method can be overridden dynamically for generated + files that need different behavior. See Tool/swig.py for + an example. + """ + return self.dir.Entry(prefix + splitext(self.name)[0] + suffix) + + def _Rfindalldirs_key(self, pathlist): + return pathlist + + memoizer_counters.append(SCons.Memoize.CountDict('Rfindalldirs', _Rfindalldirs_key)) + + def Rfindalldirs(self, pathlist): + """ + Return all of the directories for a given path list, including + corresponding "backing" directories in any repositories. + + The Node lookups are relative to this Node (typically a + directory), so memoizing result saves cycles from looking + up the same path for each target in a given directory. + """ + try: + memo_dict = self._memo['Rfindalldirs'] + except KeyError: + memo_dict = {} + self._memo['Rfindalldirs'] = memo_dict + else: + try: + return memo_dict[pathlist] + except KeyError: + pass + + create_dir_relative_to_self = self.Dir + result = [] + for path in pathlist: + if isinstance(path, SCons.Node.Node): + result.append(path) + else: + dir = create_dir_relative_to_self(path) + result.extend(dir.get_all_rdirs()) + + memo_dict[pathlist] = result + + return result + + def RDirs(self, pathlist): + """Search for a list of directories in the Repository list.""" + cwd = self.cwd or self.fs._cwd + return cwd.Rfindalldirs(pathlist) + + memoizer_counters.append(SCons.Memoize.CountValue('rentry')) + + def rentry(self): + try: + return self._memo['rentry'] + except KeyError: + pass + result = self + if not self.exists(): + norm_name = _my_normcase(self.name) + for dir in self.dir.get_all_rdirs(): + try: + node = dir.entries[norm_name] + except KeyError: + if dir.entry_exists_on_disk(self.name): + result = dir.Entry(self.name) + break + self._memo['rentry'] = result + return result + + def _glob1(self, pattern, ondisk=True, source=False, strings=False): + return [] + +class Entry(Base): + """This is the class for generic Node.FS entries--that is, things + that could be a File or a Dir, but we're just not sure yet. + Consequently, the methods in this class really exist just to + transform their associated object into the right class when the + time comes, and then call the same-named method in the transformed + class.""" + + def diskcheck_match(self): + pass + + def disambiguate(self, must_exist=None): + """ + """ + if self.isdir(): + self.__class__ = Dir + self._morph() + elif self.isfile(): + self.__class__ = File + self._morph() + self.clear() + else: + # There was nothing on-disk at this location, so look in + # the src directory. + # + # We can't just use self.srcnode() straight away because + # that would create an actual Node for this file in the src + # directory, and there might not be one. Instead, use the + # dir_on_disk() method to see if there's something on-disk + # with that name, in which case we can go ahead and call + # self.srcnode() to create the right type of entry. + srcdir = self.dir.srcnode() + if srcdir != self.dir and \ + srcdir.entry_exists_on_disk(self.name) and \ + self.srcnode().isdir(): + self.__class__ = Dir + self._morph() + elif must_exist: + msg = "No such file or directory: '%s'" % self.abspath + raise SCons.Errors.UserError(msg) + else: + self.__class__ = File + self._morph() + self.clear() + return self + + def rfile(self): + """We're a generic Entry, but the caller is actually looking for + a File at this point, so morph into one.""" + self.__class__ = File + self._morph() + self.clear() + return File.rfile(self) + + def scanner_key(self): + return self.get_suffix() + + def get_contents(self): + """Fetch the contents of the entry. Returns the exact binary + contents of the file.""" + try: + self = self.disambiguate(must_exist=1) + except SCons.Errors.UserError: + # There was nothing on disk with which to disambiguate + # this entry. Leave it as an Entry, but return a null + # string so calls to get_contents() in emitters and the + # like (e.g. in qt.py) don't have to disambiguate by hand + # or catch the exception. + return '' + else: + return self.get_contents() + + def get_text_contents(self): + """Fetch the decoded text contents of a Unicode encoded Entry. + + Since this should return the text contents from the file + system, we check to see into what sort of subclass we should + morph this Entry.""" + try: + self = self.disambiguate(must_exist=1) + except SCons.Errors.UserError: + # There was nothing on disk with which to disambiguate + # this entry. Leave it as an Entry, but return a null + # string so calls to get_text_contents() in emitters and + # the like (e.g. in qt.py) don't have to disambiguate by + # hand or catch the exception. + return '' + else: + return self.get_text_contents() + + def must_be_same(self, klass): + """Called to make sure a Node is a Dir. Since we're an + Entry, we can morph into one.""" + if self.__class__ is not klass: + self.__class__ = klass + self._morph() + self.clear() + + # The following methods can get called before the Taskmaster has + # had a chance to call disambiguate() directly to see if this Entry + # should really be a Dir or a File. We therefore use these to call + # disambiguate() transparently (from our caller's point of view). + # + # Right now, this minimal set of methods has been derived by just + # looking at some of the methods that will obviously be called early + # in any of the various Taskmasters' calling sequences, and then + # empirically figuring out which additional methods are necessary + # to make various tests pass. + + def exists(self): + """Return if the Entry exists. Check the file system to see + what we should turn into first. Assume a file if there's no + directory.""" + return self.disambiguate().exists() + + def rel_path(self, other): + d = self.disambiguate() + if d.__class__ is Entry: + raise Exception("rel_path() could not disambiguate File/Dir") + return d.rel_path(other) + + def new_ninfo(self): + return self.disambiguate().new_ninfo() + + def changed_since_last_build(self, target, prev_ni): + return self.disambiguate().changed_since_last_build(target, prev_ni) + + def _glob1(self, pattern, ondisk=True, source=False, strings=False): + return self.disambiguate()._glob1(pattern, ondisk, source, strings) + + def get_subst_proxy(self): + return self.disambiguate().get_subst_proxy() + +# This is for later so we can differentiate between Entry the class and Entry +# the method of the FS class. +_classEntry = Entry + + +class LocalFS(object): + + if SCons.Memoize.use_memoizer: + __metaclass__ = SCons.Memoize.Memoized_Metaclass + + # This class implements an abstraction layer for operations involving + # a local file system. Essentially, this wraps any function in + # the os, os.path or shutil modules that we use to actually go do + # anything with or to the local file system. + # + # Note that there's a very good chance we'll refactor this part of + # the architecture in some way as we really implement the interface(s) + # for remote file system Nodes. For example, the right architecture + # might be to have this be a subclass instead of a base class. + # Nevertheless, we're using this as a first step in that direction. + # + # We're not using chdir() yet because the calling subclass method + # needs to use os.chdir() directly to avoid recursion. Will we + # really need this one? + #def chdir(self, path): + # return os.chdir(path) + def chmod(self, path, mode): + return os.chmod(path, mode) + def copy(self, src, dst): + return shutil.copy(src, dst) + def copy2(self, src, dst): + return shutil.copy2(src, dst) + def exists(self, path): + return os.path.exists(path) + def getmtime(self, path): + return os.path.getmtime(path) + def getsize(self, path): + return os.path.getsize(path) + def isdir(self, path): + return os.path.isdir(path) + def isfile(self, path): + return os.path.isfile(path) + def link(self, src, dst): + return os.link(src, dst) + def lstat(self, path): + return os.lstat(path) + def listdir(self, path): + return os.listdir(path) + def makedirs(self, path): + return os.makedirs(path) + def mkdir(self, path): + return os.mkdir(path) + def rename(self, old, new): + return os.rename(old, new) + def stat(self, path): + return os.stat(path) + def symlink(self, src, dst): + return os.symlink(src, dst) + def open(self, path): + return open(path) + def unlink(self, path): + return os.unlink(path) + + if hasattr(os, 'symlink'): + def islink(self, path): + return os.path.islink(path) + else: + def islink(self, path): + return 0 # no symlinks + + if hasattr(os, 'readlink'): + def readlink(self, file): + return os.readlink(file) + else: + def readlink(self, file): + return '' + + +#class RemoteFS: +# # Skeleton for the obvious methods we might need from the +# # abstraction layer for a remote filesystem. +# def upload(self, local_src, remote_dst): +# pass +# def download(self, remote_src, local_dst): +# pass + + +class FS(LocalFS): + + memoizer_counters = [] + + def __init__(self, path = None): + """Initialize the Node.FS subsystem. + + The supplied path is the top of the source tree, where we + expect to find the top-level build file. If no path is + supplied, the current directory is the default. + + The path argument must be a valid absolute path. + """ + if __debug__: logInstanceCreation(self, 'Node.FS') + + self._memo = {} + + self.Root = {} + self.SConstruct_dir = None + self.max_drift = default_max_drift + + self.Top = None + if path is None: + self.pathTop = os.getcwd() + else: + self.pathTop = path + self.defaultDrive = _my_normcase(_my_splitdrive(self.pathTop)[0]) + + self.Top = self.Dir(self.pathTop) + self.Top.path = '.' + self.Top.tpath = '.' + self._cwd = self.Top + + DirNodeInfo.fs = self + FileNodeInfo.fs = self + + def set_SConstruct_dir(self, dir): + self.SConstruct_dir = dir + + def get_max_drift(self): + return self.max_drift + + def set_max_drift(self, max_drift): + self.max_drift = max_drift + + def getcwd(self): + if hasattr(self, "_cwd"): + return self._cwd + else: + return "" + + def chdir(self, dir, change_os_dir=0): + """Change the current working directory for lookups. + If change_os_dir is true, we will also change the "real" cwd + to match. + """ + curr=self._cwd + try: + if dir is not None: + self._cwd = dir + if change_os_dir: + os.chdir(dir.abspath) + except OSError: + self._cwd = curr + raise + + def get_root(self, drive): + """ + Returns the root directory for the specified drive, creating + it if necessary. + """ + drive = _my_normcase(drive) + try: + return self.Root[drive] + except KeyError: + root = RootDir(drive, self) + self.Root[drive] = root + if not drive: + self.Root[self.defaultDrive] = root + elif drive == self.defaultDrive: + self.Root[''] = root + return root + + def _lookup(self, p, directory, fsclass, create=1): + """ + The generic entry point for Node lookup with user-supplied data. + + This translates arbitrary input into a canonical Node.FS object + of the specified fsclass. The general approach for strings is + to turn it into a fully normalized absolute path and then call + the root directory's lookup_abs() method for the heavy lifting. + + If the path name begins with '#', it is unconditionally + interpreted relative to the top-level directory of this FS. '#' + is treated as a synonym for the top-level SConstruct directory, + much like '~' is treated as a synonym for the user's home + directory in a UNIX shell. So both '#foo' and '#/foo' refer + to the 'foo' subdirectory underneath the top-level SConstruct + directory. + + If the path name is relative, then the path is looked up relative + to the specified directory, or the current directory (self._cwd, + typically the SConscript directory) if the specified directory + is None. + """ + if isinstance(p, Base): + # It's already a Node.FS object. Make sure it's the right + # class and return. + p.must_be_same(fsclass) + return p + # str(p) in case it's something like a proxy object + p = str(p) + + if not os_sep_is_slash: + p = p.replace(OS_SEP, '/') + + if p[0:1] == '#': + # There was an initial '#', so we strip it and override + # whatever directory they may have specified with the + # top-level SConstruct directory. + p = p[1:] + directory = self.Top + + # There might be a drive letter following the + # '#'. Although it is not described in the SCons man page, + # the regression test suite explicitly tests for that + # syntax. It seems to mean the following thing: + # + # Assuming the the SCons top dir is in C:/xxx/yyy, + # '#X:/toto' means X:/xxx/yyy/toto. + # + # i.e. it assumes that the X: drive has a directory + # structure similar to the one found on drive C:. + if do_splitdrive: + drive, p = _my_splitdrive(p) + if drive: + root = self.get_root(drive) + else: + root = directory.root + else: + root = directory.root + + # We can only strip trailing after splitting the drive + # since the drive might the UNC '//' prefix. + p = p.strip('/') + + needs_normpath = needs_normpath_match(p) + + # The path is relative to the top-level SCons directory. + if p in ('', '.'): + p = directory.labspath + else: + p = directory.labspath + '/' + p + else: + if do_splitdrive: + drive, p = _my_splitdrive(p) + if drive and not p: + # This causes a naked drive letter to be treated + # as a synonym for the root directory on that + # drive. + p = '/' + else: + drive = '' + + # We can only strip trailing '/' since the drive might the + # UNC '//' prefix. + if p != '/': + p = p.rstrip('/') + + needs_normpath = needs_normpath_match(p) + + if p[0:1] == '/': + # Absolute path + root = self.get_root(drive) + else: + # This is a relative lookup or to the current directory + # (the path name is not absolute). Add the string to the + # appropriate directory lookup path, after which the whole + # thing gets normalized. + if directory: + if not isinstance(directory, Dir): + directory = self.Dir(directory) + else: + directory = self._cwd + + if p in ('', '.'): + p = directory.labspath + else: + p = directory.labspath + '/' + p + + if drive: + root = self.get_root(drive) + else: + root = directory.root + + if needs_normpath is not None: + # Normalize a pathname. Will return the same result for + # equivalent paths. + # + # We take advantage of the fact that we have an absolute + # path here for sure. In addition, we know that the + # components of lookup path are separated by slashes at + # this point. Because of this, this code is about 2X + # faster than calling os.path.normpath() followed by + # replacing os.sep with '/' again. + ins = p.split('/')[1:] + outs = [] + for d in ins: + if d == '..': + try: + outs.pop() + except IndexError: + pass + elif d not in ('', '.'): + outs.append(d) + p = '/' + '/'.join(outs) + + return root._lookup_abs(p, fsclass, create) + + def Entry(self, name, directory = None, create = 1): + """Look up or create a generic Entry node with the specified name. + If the name is a relative path (begins with ./, ../, or a file + name), then it is looked up relative to the supplied directory + node, or to the top level directory of the FS (supplied at + construction time) if no directory is supplied. + """ + return self._lookup(name, directory, Entry, create) + + def File(self, name, directory = None, create = 1): + """Look up or create a File node with the specified name. If + the name is a relative path (begins with ./, ../, or a file name), + then it is looked up relative to the supplied directory node, + or to the top level directory of the FS (supplied at construction + time) if no directory is supplied. + + This method will raise TypeError if a directory is found at the + specified path. + """ + return self._lookup(name, directory, File, create) + + def Dir(self, name, directory = None, create = True): + """Look up or create a Dir node with the specified name. If + the name is a relative path (begins with ./, ../, or a file name), + then it is looked up relative to the supplied directory node, + or to the top level directory of the FS (supplied at construction + time) if no directory is supplied. + + This method will raise TypeError if a normal file is found at the + specified path. + """ + return self._lookup(name, directory, Dir, create) + + def VariantDir(self, variant_dir, src_dir, duplicate=1): + """Link the supplied variant directory to the source directory + for purposes of building files.""" + + if not isinstance(src_dir, SCons.Node.Node): + src_dir = self.Dir(src_dir) + if not isinstance(variant_dir, SCons.Node.Node): + variant_dir = self.Dir(variant_dir) + if src_dir.is_under(variant_dir): + raise SCons.Errors.UserError("Source directory cannot be under variant directory.") + if variant_dir.srcdir: + if variant_dir.srcdir == src_dir: + return # We already did this. + raise SCons.Errors.UserError("'%s' already has a source directory: '%s'."%(variant_dir, variant_dir.srcdir)) + variant_dir.link(src_dir, duplicate) + + def Repository(self, *dirs): + """Specify Repository directories to search.""" + for d in dirs: + if not isinstance(d, SCons.Node.Node): + d = self.Dir(d) + self.Top.addRepository(d) + + def variant_dir_target_climb(self, orig, dir, tail): + """Create targets in corresponding variant directories + + Climb the directory tree, and look up path names + relative to any linked variant directories we find. + + Even though this loops and walks up the tree, we don't memoize + the return value because this is really only used to process + the command-line targets. + """ + targets = [] + message = None + fmt = "building associated VariantDir targets: %s" + start_dir = dir + while dir: + for bd in dir.variant_dirs: + if start_dir.is_under(bd): + # If already in the build-dir location, don't reflect + return [orig], fmt % str(orig) + p = os.path.join(bd.path, *tail) + targets.append(self.Entry(p)) + tail = [dir.name] + tail + dir = dir.up() + if targets: + message = fmt % ' '.join(map(str, targets)) + return targets, message + + def Glob(self, pathname, ondisk=True, source=True, strings=False, cwd=None): + """ + Globs + + This is mainly a shim layer + """ + if cwd is None: + cwd = self.getcwd() + return cwd.glob(pathname, ondisk, source, strings) + +class DirNodeInfo(SCons.Node.NodeInfoBase): + # This should get reset by the FS initialization. + current_version_id = 1 + + fs = None + + def str_to_node(self, s): + top = self.fs.Top + root = top.root + if do_splitdrive: + drive, s = _my_splitdrive(s) + if drive: + root = self.fs.get_root(drive) + if not os.path.isabs(s): + s = top.labspath + '/' + s + return root._lookup_abs(s, Entry) + +class DirBuildInfo(SCons.Node.BuildInfoBase): + current_version_id = 1 + +glob_magic_check = re.compile('[*?[]') + +def has_glob_magic(s): + return glob_magic_check.search(s) is not None + +class Dir(Base): + """A class for directories in a file system. + """ + + memoizer_counters = [] + + NodeInfo = DirNodeInfo + BuildInfo = DirBuildInfo + + def __init__(self, name, directory, fs): + if __debug__: logInstanceCreation(self, 'Node.FS.Dir') + Base.__init__(self, name, directory, fs) + self._morph() + + def _morph(self): + """Turn a file system Node (either a freshly initialized directory + object or a separate Entry object) into a proper directory object. + + Set up this directory's entries and hook it into the file + system tree. Specify that directories (this Node) don't use + signatures for calculating whether they're current. + """ + + self.repositories = [] + self.srcdir = None + + self.entries = {} + self.entries['.'] = self + self.entries['..'] = self.dir + self.cwd = self + self.searched = 0 + self._sconsign = None + self.variant_dirs = [] + self.root = self.dir.root + + # For directories, we make a difference between the directory + # 'name' and the directory 'dirname'. The 'name' attribute is + # used when we need to print the 'name' of the directory or + # when we it is used as the last part of a path. The 'dirname' + # is used when the directory is not the last element of the + # path. The main reason for making that distinction is that + # for RoorDir's the dirname can not be easily inferred from + # the name. For example, we have to add a '/' after a drive + # letter but not after a UNC path prefix ('//'). + self.dirname = self.name + OS_SEP + + # Don't just reset the executor, replace its action list, + # because it might have some pre-or post-actions that need to + # be preserved. + # + # But don't reset the executor if there is a non-null executor + # attached already. The existing executor might have other + # targets, in which case replacing the action list with a + # Mkdir action is a big mistake. + if not hasattr(self, 'executor'): + self.builder = get_MkdirBuilder() + self.get_executor().set_action_list(self.builder.action) + else: + # Prepend MkdirBuilder action to existing action list + l = self.get_executor().action_list + a = get_MkdirBuilder().action + l.insert(0, a) + self.get_executor().set_action_list(l) + + def diskcheck_match(self): + diskcheck_match(self, self.isfile, + "File %s found where directory expected.") + + def __clearRepositoryCache(self, duplicate=None): + """Called when we change the repository(ies) for a directory. + This clears any cached information that is invalidated by changing + the repository.""" + + for node in self.entries.values(): + if node != self.dir: + if node != self and isinstance(node, Dir): + node.__clearRepositoryCache(duplicate) + else: + node.clear() + try: + del node._srcreps + except AttributeError: + pass + if duplicate is not None: + node.duplicate=duplicate + + def __resetDuplicate(self, node): + if node != self: + node.duplicate = node.get_dir().duplicate + + def Entry(self, name): + """ + Looks up or creates an entry node named 'name' relative to + this directory. + """ + return self.fs.Entry(name, self) + + def Dir(self, name, create=True): + """ + Looks up or creates a directory node named 'name' relative to + this directory. + """ + return self.fs.Dir(name, self, create) + + def File(self, name): + """ + Looks up or creates a file node named 'name' relative to + this directory. + """ + return self.fs.File(name, self) + + def link(self, srcdir, duplicate): + """Set this directory as the variant directory for the + supplied source directory.""" + self.srcdir = srcdir + self.duplicate = duplicate + self.__clearRepositoryCache(duplicate) + srcdir.variant_dirs.append(self) + + def getRepositories(self): + """Returns a list of repositories for this directory. + """ + if self.srcdir and not self.duplicate: + return self.srcdir.get_all_rdirs() + self.repositories + return self.repositories + + memoizer_counters.append(SCons.Memoize.CountValue('get_all_rdirs')) + + def get_all_rdirs(self): + try: + return list(self._memo['get_all_rdirs']) + except KeyError: + pass + + result = [self] + fname = '.' + dir = self + while dir: + for rep in dir.getRepositories(): + result.append(rep.Dir(fname)) + if fname == '.': + fname = dir.name + else: + fname = dir.name + OS_SEP + fname + dir = dir.up() + + self._memo['get_all_rdirs'] = list(result) + + return result + + def addRepository(self, dir): + if dir != self and not dir in self.repositories: + self.repositories.append(dir) + dir.tpath = '.' + self.__clearRepositoryCache() + + def up(self): + return self.dir + + def _rel_path_key(self, other): + return str(other) + + memoizer_counters.append(SCons.Memoize.CountDict('rel_path', _rel_path_key)) + + def rel_path(self, other): + """Return a path to "other" relative to this directory. + """ + + # This complicated and expensive method, which constructs relative + # paths between arbitrary Node.FS objects, is no longer used + # by SCons itself. It was introduced to store dependency paths + # in .sconsign files relative to the target, but that ended up + # being significantly inefficient. + # + # We're continuing to support the method because some SConstruct + # files out there started using it when it was available, and + # we're all about backwards compatibility.. + + try: + memo_dict = self._memo['rel_path'] + except KeyError: + memo_dict = {} + self._memo['rel_path'] = memo_dict + else: + try: + return memo_dict[other] + except KeyError: + pass + + if self is other: + result = '.' + + elif not other in self.path_elements: + try: + other_dir = other.get_dir() + except AttributeError: + result = str(other) + else: + if other_dir is None: + result = other.name + else: + dir_rel_path = self.rel_path(other_dir) + if dir_rel_path == '.': + result = other.name + else: + result = dir_rel_path + OS_SEP + other.name + else: + i = self.path_elements.index(other) + 1 + + path_elems = ['..'] * (len(self.path_elements) - i) \ + + [n.name for n in other.path_elements[i:]] + + result = OS_SEP.join(path_elems) + + memo_dict[other] = result + + return result + + def get_env_scanner(self, env, kw={}): + import SCons.Defaults + return SCons.Defaults.DirEntryScanner + + def get_target_scanner(self): + import SCons.Defaults + return SCons.Defaults.DirEntryScanner + + def get_found_includes(self, env, scanner, path): + """Return this directory's implicit dependencies. + + We don't bother caching the results because the scan typically + shouldn't be requested more than once (as opposed to scanning + .h file contents, which can be requested as many times as the + files is #included by other files). + """ + if not scanner: + return [] + # Clear cached info for this Dir. If we already visited this + # directory on our walk down the tree (because we didn't know at + # that point it was being used as the source for another Node) + # then we may have calculated build signature before realizing + # we had to scan the disk. Now that we have to, though, we need + # to invalidate the old calculated signature so that any node + # dependent on our directory structure gets one that includes + # info about everything on disk. + self.clear() + return scanner(self, env, path) + + # + # Taskmaster interface subsystem + # + + def prepare(self): + pass + + def build(self, **kw): + """A null "builder" for directories.""" + global MkdirBuilder + if self.builder is not MkdirBuilder: + SCons.Node.Node.build(self, **kw) + + # + # + # + + def _create(self): + """Create this directory, silently and without worrying about + whether the builder is the default or not.""" + listDirs = [] + parent = self + while parent: + if parent.exists(): + break + listDirs.append(parent) + p = parent.up() + if p is None: + # Don't use while: - else: for this condition because + # if so, then parent is None and has no .path attribute. + raise SCons.Errors.StopError(parent.path) + parent = p + listDirs.reverse() + for dirnode in listDirs: + try: + # Don't call dirnode.build(), call the base Node method + # directly because we definitely *must* create this + # directory. The dirnode.build() method will suppress + # the build if it's the default builder. + SCons.Node.Node.build(dirnode) + dirnode.get_executor().nullify() + # The build() action may or may not have actually + # created the directory, depending on whether the -n + # option was used or not. Delete the _exists and + # _rexists attributes so they can be reevaluated. + dirnode.clear() + except OSError: + pass + + def multiple_side_effect_has_builder(self): + global MkdirBuilder + return self.builder is not MkdirBuilder and self.has_builder() + + def alter_targets(self): + """Return any corresponding targets in a variant directory. + """ + return self.fs.variant_dir_target_climb(self, self, []) + + def scanner_key(self): + """A directory does not get scanned.""" + return None + + def get_text_contents(self): + """We already emit things in text, so just return the binary + version.""" + return self.get_contents() + + def get_contents(self): + """Return content signatures and names of all our children + separated by new-lines. Ensure that the nodes are sorted.""" + contents = [] + for node in sorted(self.children(), key=lambda t: t.name): + contents.append('%s %s\n' % (node.get_csig(), node.name)) + return ''.join(contents) + + def get_csig(self): + """Compute the content signature for Directory nodes. In + general, this is not needed and the content signature is not + stored in the DirNodeInfo. However, if get_contents on a Dir + node is called which has a child directory, the child + directory should return the hash of its contents.""" + contents = self.get_contents() + return SCons.Util.MD5signature(contents) + + def do_duplicate(self, src): + pass + + changed_since_last_build = SCons.Node.Node.state_has_changed + + def is_up_to_date(self): + """If any child is not up-to-date, then this directory isn't, + either.""" + if self.builder is not MkdirBuilder and not self.exists(): + return 0 + up_to_date = SCons.Node.up_to_date + for kid in self.children(): + if kid.get_state() > up_to_date: + return 0 + return 1 + + def rdir(self): + if not self.exists(): + norm_name = _my_normcase(self.name) + for dir in self.dir.get_all_rdirs(): + try: node = dir.entries[norm_name] + except KeyError: node = dir.dir_on_disk(self.name) + if node and node.exists() and \ + (isinstance(dir, Dir) or isinstance(dir, Entry)): + return node + return self + + def sconsign(self): + """Return the .sconsign file info for this directory, + creating it first if necessary.""" + if not self._sconsign: + import SCons.SConsign + self._sconsign = SCons.SConsign.ForDirectory(self) + return self._sconsign + + def srcnode(self): + """Dir has a special need for srcnode()...if we + have a srcdir attribute set, then that *is* our srcnode.""" + if self.srcdir: + return self.srcdir + return Base.srcnode(self) + + def get_timestamp(self): + """Return the latest timestamp from among our children""" + stamp = 0 + for kid in self.children(): + if kid.get_timestamp() > stamp: + stamp = kid.get_timestamp() + return stamp + + def entry_abspath(self, name): + return self.abspath + OS_SEP + name + + def entry_labspath(self, name): + return self.labspath + '/' + name + + def entry_path(self, name): + return self.path + OS_SEP + name + + def entry_tpath(self, name): + return self.tpath + OS_SEP + name + + def entry_exists_on_disk(self, name): + try: + d = self.on_disk_entries + except AttributeError: + d = {} + try: + entries = os.listdir(self.abspath) + except OSError: + pass + else: + for entry in map(_my_normcase, entries): + d[entry] = True + self.on_disk_entries = d + if sys.platform == 'win32': + name = _my_normcase(name) + result = d.get(name) + if result is None: + # Belt-and-suspenders for Windows: check directly for + # 8.3 file names that don't show up in os.listdir(). + result = os.path.exists(self.abspath + OS_SEP + name) + d[name] = result + return result + else: + return name in d + + memoizer_counters.append(SCons.Memoize.CountValue('srcdir_list')) + + def srcdir_list(self): + try: + return self._memo['srcdir_list'] + except KeyError: + pass + + result = [] + + dirname = '.' + dir = self + while dir: + if dir.srcdir: + result.append(dir.srcdir.Dir(dirname)) + dirname = dir.name + OS_SEP + dirname + dir = dir.up() + + self._memo['srcdir_list'] = result + + return result + + def srcdir_duplicate(self, name): + for dir in self.srcdir_list(): + if self.is_under(dir): + # We shouldn't source from something in the build path; + # variant_dir is probably under src_dir, in which case + # we are reflecting. + break + if dir.entry_exists_on_disk(name): + srcnode = dir.Entry(name).disambiguate() + if self.duplicate: + node = self.Entry(name).disambiguate() + node.do_duplicate(srcnode) + return node + else: + return srcnode + return None + + def _srcdir_find_file_key(self, filename): + return filename + + memoizer_counters.append(SCons.Memoize.CountDict('srcdir_find_file', _srcdir_find_file_key)) + + def srcdir_find_file(self, filename): + try: + memo_dict = self._memo['srcdir_find_file'] + except KeyError: + memo_dict = {} + self._memo['srcdir_find_file'] = memo_dict + else: + try: + return memo_dict[filename] + except KeyError: + pass + + def func(node): + if (isinstance(node, File) or isinstance(node, Entry)) and \ + (node.is_derived() or node.exists()): + return node + return None + + norm_name = _my_normcase(filename) + + for rdir in self.get_all_rdirs(): + try: node = rdir.entries[norm_name] + except KeyError: node = rdir.file_on_disk(filename) + else: node = func(node) + if node: + result = (node, self) + memo_dict[filename] = result + return result + + for srcdir in self.srcdir_list(): + for rdir in srcdir.get_all_rdirs(): + try: node = rdir.entries[norm_name] + except KeyError: node = rdir.file_on_disk(filename) + else: node = func(node) + if node: + result = (File(filename, self, self.fs), srcdir) + memo_dict[filename] = result + return result + + result = (None, None) + memo_dict[filename] = result + return result + + def dir_on_disk(self, name): + if self.entry_exists_on_disk(name): + try: return self.Dir(name) + except TypeError: pass + node = self.srcdir_duplicate(name) + if isinstance(node, File): + return None + return node + + def file_on_disk(self, name): + if self.entry_exists_on_disk(name) or \ + diskcheck_rcs(self, name) or \ + diskcheck_sccs(self, name): + try: return self.File(name) + except TypeError: pass + node = self.srcdir_duplicate(name) + if isinstance(node, Dir): + return None + return node + + def walk(self, func, arg): + """ + Walk this directory tree by calling the specified function + for each directory in the tree. + + This behaves like the os.path.walk() function, but for in-memory + Node.FS.Dir objects. The function takes the same arguments as + the functions passed to os.path.walk(): + + func(arg, dirname, fnames) + + Except that "dirname" will actually be the directory *Node*, + not the string. The '.' and '..' entries are excluded from + fnames. The fnames list may be modified in-place to filter the + subdirectories visited or otherwise impose a specific order. + The "arg" argument is always passed to func() and may be used + in any way (or ignored, passing None is common). + """ + entries = self.entries + names = list(entries.keys()) + names.remove('.') + names.remove('..') + func(arg, self, names) + for dirname in [n for n in names if isinstance(entries[n], Dir)]: + entries[dirname].walk(func, arg) + + def glob(self, pathname, ondisk=True, source=False, strings=False): + """ + Returns a list of Nodes (or strings) matching a specified + pathname pattern. + + Pathname patterns follow UNIX shell semantics: * matches + any-length strings of any characters, ? matches any character, + and [] can enclose lists or ranges of characters. Matches do + not span directory separators. + + The matches take into account Repositories, returning local + Nodes if a corresponding entry exists in a Repository (either + an in-memory Node or something on disk). + + By defafult, the glob() function matches entries that exist + on-disk, in addition to in-memory Nodes. Setting the "ondisk" + argument to False (or some other non-true value) causes the glob() + function to only match in-memory Nodes. The default behavior is + to return both the on-disk and in-memory Nodes. + + The "source" argument, when true, specifies that corresponding + source Nodes must be returned if you're globbing in a build + directory (initialized with VariantDir()). The default behavior + is to return Nodes local to the VariantDir(). + + The "strings" argument, when true, returns the matches as strings, + not Nodes. The strings are path names relative to this directory. + + The underlying algorithm is adapted from the glob.glob() function + in the Python library (but heavily modified), and uses fnmatch() + under the covers. + """ + dirname, basename = os.path.split(pathname) + if not dirname: + return sorted(self._glob1(basename, ondisk, source, strings), + key=lambda t: str(t)) + if has_glob_magic(dirname): + list = self.glob(dirname, ondisk, source, strings=False) + else: + list = [self.Dir(dirname, create=True)] + result = [] + for dir in list: + r = dir._glob1(basename, ondisk, source, strings) + if strings: + r = [os.path.join(str(dir), x) for x in r] + result.extend(r) + return sorted(result, key=lambda a: str(a)) + + def _glob1(self, pattern, ondisk=True, source=False, strings=False): + """ + Globs for and returns a list of entry names matching a single + pattern in this directory. + + This searches any repositories and source directories for + corresponding entries and returns a Node (or string) relative + to the current directory if an entry is found anywhere. + + TODO: handle pattern with no wildcard + """ + search_dir_list = self.get_all_rdirs() + for srcdir in self.srcdir_list(): + search_dir_list.extend(srcdir.get_all_rdirs()) + + selfEntry = self.Entry + names = [] + for dir in search_dir_list: + # We use the .name attribute from the Node because the keys of + # the dir.entries dictionary are normalized (that is, all upper + # case) on case-insensitive systems like Windows. + node_names = [ v.name for k, v in dir.entries.items() + if k not in ('.', '..') ] + names.extend(node_names) + if not strings: + # Make sure the working directory (self) actually has + # entries for all Nodes in repositories or variant dirs. + for name in node_names: selfEntry(name) + if ondisk: + try: + disk_names = os.listdir(dir.abspath) + except os.error: + continue + names.extend(disk_names) + if not strings: + # We're going to return corresponding Nodes in + # the local directory, so we need to make sure + # those Nodes exist. We only want to create + # Nodes for the entries that will match the + # specified pattern, though, which means we + # need to filter the list here, even though + # the overall list will also be filtered later, + # after we exit this loop. + if pattern[0] != '.': + #disk_names = [ d for d in disk_names if d[0] != '.' ] + disk_names = [x for x in disk_names if x[0] != '.'] + disk_names = fnmatch.filter(disk_names, pattern) + dirEntry = dir.Entry + for name in disk_names: + # Add './' before disk filename so that '#' at + # beginning of filename isn't interpreted. + name = './' + name + node = dirEntry(name).disambiguate() + n = selfEntry(name) + if n.__class__ != node.__class__: + n.__class__ = node.__class__ + n._morph() + + names = set(names) + if pattern[0] != '.': + #names = [ n for n in names if n[0] != '.' ] + names = [x for x in names if x[0] != '.'] + names = fnmatch.filter(names, pattern) + + if strings: + return names + + #return [ self.entries[_my_normcase(n)] for n in names ] + return [self.entries[_my_normcase(n)] for n in names] + +class RootDir(Dir): + """A class for the root directory of a file system. + + This is the same as a Dir class, except that the path separator + ('/' or '\\') is actually part of the name, so we don't need to + add a separator when creating the path names of entries within + this directory. + """ + def __init__(self, drive, fs): + if __debug__: logInstanceCreation(self, 'Node.FS.RootDir') + # We're going to be our own parent directory (".." entry and .dir + # attribute) so we have to set up some values so Base.__init__() + # won't gag won't it calls some of our methods. + self.abspath = '' + self.labspath = '' + self.path = '' + self.tpath = '' + self.path_elements = [] + self.duplicate = 0 + self.root = self + + # Handle all the types of drives: + if drive == '': + # No drive, regular UNIX root or Windows default drive. + name = OS_SEP + dirname = OS_SEP + elif drive == '//': + # UNC path + name = UNC_PREFIX + dirname = UNC_PREFIX + else: + # Windows drive letter + name = drive + dirname = drive + OS_SEP + + Base.__init__(self, name, self, fs) + + # Now set our paths to what we really want them to be. The + # name should already contain any necessary separators, such + # as the initial drive letter (the name) plus the directory + # separator, except for the "lookup abspath," which does not + # have the drive letter. + self.abspath = dirname + self.labspath = '' + self.path = dirname + self.tpath = dirname + self._morph() + + # Must be reset after Dir._morph() is invoked... + self.dirname = dirname + + self._lookupDict = {} + + self._lookupDict[''] = self + self._lookupDict['/'] = self + + # The // entry is necessary because os.path.normpath() + # preserves double slashes at the beginning of a path on Posix + # platforms. + if not has_unc: + self._lookupDict['//'] = self + + def must_be_same(self, klass): + if klass is Dir: + return + Base.must_be_same(self, klass) + + def _lookup_abs(self, p, klass, create=1): + """ + Fast (?) lookup of a *normalized* absolute path. + + This method is intended for use by internal lookups with + already-normalized path data. For general-purpose lookups, + use the FS.Entry(), FS.Dir() or FS.File() methods. + + The caller is responsible for making sure we're passed a + normalized absolute path; we merely let Python's dictionary look + up and return the One True Node.FS object for the path. + + If a Node for the specified "p" doesn't already exist, and + "create" is specified, the Node may be created after recursive + invocation to find or create the parent directory or directories. + """ + k = _my_normcase(p) + try: + result = self._lookupDict[k] + except KeyError: + if not create: + msg = "No such file or directory: '%s' in '%s' (and create is False)" % (p, str(self)) + raise SCons.Errors.UserError(msg) + # There is no Node for this path name, and we're allowed + # to create it. + # (note: would like to use p.rsplit('/',1) here but + # that's not in python 2.3) + # e.g.: dir_name, file_name = p.rsplit('/',1) + last_slash = p.rindex('/') + if (last_slash >= 0): + dir_name = p[:last_slash] + file_name = p[last_slash+1:] + else: + dir_name = p # shouldn't happen, just in case + file_name = '' + + dir_node = self._lookup_abs(dir_name, Dir) + result = klass(file_name, dir_node, self.fs) + + # Double-check on disk (as configured) that the Node we + # created matches whatever is out there in the real world. + result.diskcheck_match() + + self._lookupDict[k] = result + dir_node.entries[_my_normcase(file_name)] = result + dir_node.implicit = None + else: + # There is already a Node for this path name. Allow it to + # complain if we were looking for an inappropriate type. + result.must_be_same(klass) + return result + + def __str__(self): + return self.abspath + + def entry_abspath(self, name): + return self.abspath + name + + def entry_labspath(self, name): + return '/' + name + + def entry_path(self, name): + return self.path + name + + def entry_tpath(self, name): + return self.tpath + name + + def is_under(self, dir): + if self is dir: + return 1 + else: + return 0 + + def up(self): + return None + + def get_dir(self): + return None + + def src_builder(self): + return _null + +class FileNodeInfo(SCons.Node.NodeInfoBase): + current_version_id = 1 + + field_list = ['csig', 'timestamp', 'size'] + + # This should get reset by the FS initialization. + fs = None + + def str_to_node(self, s): + top = self.fs.Top + root = top.root + if do_splitdrive: + drive, s = _my_splitdrive(s) + if drive: + root = self.fs.get_root(drive) + if not os.path.isabs(s): + s = top.labspath + '/' + s + return root._lookup_abs(s, Entry) + +class FileBuildInfo(SCons.Node.BuildInfoBase): + current_version_id = 1 + + def convert_to_sconsign(self): + """ + Converts this FileBuildInfo object for writing to a .sconsign file + + This replaces each Node in our various dependency lists with its + usual string representation: relative to the top-level SConstruct + directory, or an absolute path if it's outside. + """ + if os_sep_is_slash: + node_to_str = str + else: + def node_to_str(n): + try: + s = n.path + except AttributeError: + s = str(n) + else: + s = s.replace(OS_SEP, '/') + return s + for attr in ['bsources', 'bdepends', 'bimplicit']: + try: + val = getattr(self, attr) + except AttributeError: + pass + else: + setattr(self, attr, list(map(node_to_str, val))) + def convert_from_sconsign(self, dir, name): + """ + Converts a newly-read FileBuildInfo object for in-SCons use + + For normal up-to-date checking, we don't have any conversion to + perform--but we're leaving this method here to make that clear. + """ + pass + def prepare_dependencies(self): + """ + Prepares a FileBuildInfo object for explaining what changed + + The bsources, bdepends and bimplicit lists have all been + stored on disk as paths relative to the top-level SConstruct + directory. Convert the strings to actual Nodes (for use by the + --debug=explain code and --implicit-cache). + """ + attrs = [ + ('bsources', 'bsourcesigs'), + ('bdepends', 'bdependsigs'), + ('bimplicit', 'bimplicitsigs'), + ] + for (nattr, sattr) in attrs: + try: + strings = getattr(self, nattr) + nodeinfos = getattr(self, sattr) + except AttributeError: + continue + nodes = [] + for s, ni in zip(strings, nodeinfos): + if not isinstance(s, SCons.Node.Node): + s = ni.str_to_node(s) + nodes.append(s) + setattr(self, nattr, nodes) + def format(self, names=0): + result = [] + bkids = self.bsources + self.bdepends + self.bimplicit + bkidsigs = self.bsourcesigs + self.bdependsigs + self.bimplicitsigs + for bkid, bkidsig in zip(bkids, bkidsigs): + result.append(str(bkid) + ': ' + + ' '.join(bkidsig.format(names=names))) + result.append('%s [%s]' % (self.bactsig, self.bact)) + return '\n'.join(result) + +class File(Base): + """A class for files in a file system. + """ + + memoizer_counters = [] + + NodeInfo = FileNodeInfo + BuildInfo = FileBuildInfo + + md5_chunksize = 64 + + def diskcheck_match(self): + diskcheck_match(self, self.isdir, + "Directory %s found where file expected.") + + def __init__(self, name, directory, fs): + if __debug__: logInstanceCreation(self, 'Node.FS.File') + Base.__init__(self, name, directory, fs) + self._morph() + + def Entry(self, name): + """Create an entry node named 'name' relative to + the directory of this file.""" + return self.dir.Entry(name) + + def Dir(self, name, create=True): + """Create a directory node named 'name' relative to + the directory of this file.""" + return self.dir.Dir(name, create=create) + + def Dirs(self, pathlist): + """Create a list of directories relative to the SConscript + directory of this file.""" + return [self.Dir(p) for p in pathlist] + + def File(self, name): + """Create a file node named 'name' relative to + the directory of this file.""" + return self.dir.File(name) + + #def generate_build_dict(self): + # """Return an appropriate dictionary of values for building + # this File.""" + # return {'Dir' : self.Dir, + # 'File' : self.File, + # 'RDirs' : self.RDirs} + + def _morph(self): + """Turn a file system node into a File object.""" + self.scanner_paths = {} + if not hasattr(self, '_local'): + self._local = 0 + + # If there was already a Builder set on this entry, then + # we need to make sure we call the target-decider function, + # not the source-decider. Reaching in and doing this by hand + # is a little bogus. We'd prefer to handle this by adding + # an Entry.builder_set() method that disambiguates like the + # other methods, but that starts running into problems with the + # fragile way we initialize Dir Nodes with their Mkdir builders, + # yet still allow them to be overridden by the user. Since it's + # not clear right now how to fix that, stick with what works + # until it becomes clear... + if self.has_builder(): + self.changed_since_last_build = self.decide_target + + def scanner_key(self): + return self.get_suffix() + + def get_contents(self): + if not self.rexists(): + return '' + fname = self.rfile().abspath + try: + contents = open(fname, "rb").read() + except EnvironmentError, e: + if not e.filename: + e.filename = fname + raise + return contents + + # This attempts to figure out what the encoding of the text is + # based upon the BOM bytes, and then decodes the contents so that + # it's a valid python string. + def get_text_contents(self): + contents = self.get_contents() + # The behavior of various decode() methods and functions + # w.r.t. the initial BOM bytes is different for different + # encodings and/or Python versions. ('utf-8' does not strip + # them, but has a 'utf-8-sig' which does; 'utf-16' seems to + # strip them; etc.) Just sidestep all the complication by + # explicitly stripping the BOM before we decode(). + if contents.startswith(codecs.BOM_UTF8): + return contents[len(codecs.BOM_UTF8):].decode('utf-8') + if contents.startswith(codecs.BOM_UTF16_LE): + return contents[len(codecs.BOM_UTF16_LE):].decode('utf-16-le') + if contents.startswith(codecs.BOM_UTF16_BE): + return contents[len(codecs.BOM_UTF16_BE):].decode('utf-16-be') + return contents + + def get_content_hash(self): + """ + Compute and return the MD5 hash for this file. + """ + if not self.rexists(): + return SCons.Util.MD5signature('') + fname = self.rfile().abspath + try: + cs = SCons.Util.MD5filesignature(fname, + chunksize=SCons.Node.FS.File.md5_chunksize*1024) + except EnvironmentError, e: + if not e.filename: + e.filename = fname + raise + return cs + + + memoizer_counters.append(SCons.Memoize.CountValue('get_size')) + + def get_size(self): + try: + return self._memo['get_size'] + except KeyError: + pass + + if self.rexists(): + size = self.rfile().getsize() + else: + size = 0 + + self._memo['get_size'] = size + + return size + + memoizer_counters.append(SCons.Memoize.CountValue('get_timestamp')) + + def get_timestamp(self): + try: + return self._memo['get_timestamp'] + except KeyError: + pass + + if self.rexists(): + timestamp = self.rfile().getmtime() + else: + timestamp = 0 + + self._memo['get_timestamp'] = timestamp + + return timestamp + + def store_info(self): + # Merge our build information into the already-stored entry. + # This accomodates "chained builds" where a file that's a target + # in one build (SConstruct file) is a source in a different build. + # See test/chained-build.py for the use case. + if do_store_info: + self.dir.sconsign().store_info(self.name, self) + + convert_copy_attrs = [ + 'bsources', + 'bimplicit', + 'bdepends', + 'bact', + 'bactsig', + 'ninfo', + ] + + + convert_sig_attrs = [ + 'bsourcesigs', + 'bimplicitsigs', + 'bdependsigs', + ] + + def convert_old_entry(self, old_entry): + # Convert a .sconsign entry from before the Big Signature + # Refactoring, doing what we can to convert its information + # to the new .sconsign entry format. + # + # The old format looked essentially like this: + # + # BuildInfo + # .ninfo (NodeInfo) + # .bsig + # .csig + # .timestamp + # .size + # .bsources + # .bsourcesigs ("signature" list) + # .bdepends + # .bdependsigs ("signature" list) + # .bimplicit + # .bimplicitsigs ("signature" list) + # .bact + # .bactsig + # + # The new format looks like this: + # + # .ninfo (NodeInfo) + # .bsig + # .csig + # .timestamp + # .size + # .binfo (BuildInfo) + # .bsources + # .bsourcesigs (NodeInfo list) + # .bsig + # .csig + # .timestamp + # .size + # .bdepends + # .bdependsigs (NodeInfo list) + # .bsig + # .csig + # .timestamp + # .size + # .bimplicit + # .bimplicitsigs (NodeInfo list) + # .bsig + # .csig + # .timestamp + # .size + # .bact + # .bactsig + # + # The basic idea of the new structure is that a NodeInfo always + # holds all available information about the state of a given Node + # at a certain point in time. The various .b*sigs lists can just + # be a list of pointers to the .ninfo attributes of the different + # dependent nodes, without any copying of information until it's + # time to pickle it for writing out to a .sconsign file. + # + # The complicating issue is that the *old* format only stored one + # "signature" per dependency, based on however the *last* build + # was configured. We don't know from just looking at it whether + # it was a build signature, a content signature, or a timestamp + # "signature". Since we no longer use build signatures, the + # best we can do is look at the length and if it's thirty two, + # assume that it was (or might have been) a content signature. + # If it was actually a build signature, then it will cause a + # rebuild anyway when it doesn't match the new content signature, + # but that's probably the best we can do. + import SCons.SConsign + new_entry = SCons.SConsign.SConsignEntry() + new_entry.binfo = self.new_binfo() + binfo = new_entry.binfo + for attr in self.convert_copy_attrs: + try: + value = getattr(old_entry, attr) + except AttributeError: + continue + setattr(binfo, attr, value) + delattr(old_entry, attr) + for attr in self.convert_sig_attrs: + try: + sig_list = getattr(old_entry, attr) + except AttributeError: + continue + value = [] + for sig in sig_list: + ninfo = self.new_ninfo() + if len(sig) == 32: + ninfo.csig = sig + else: + ninfo.timestamp = sig + value.append(ninfo) + setattr(binfo, attr, value) + delattr(old_entry, attr) + return new_entry + + memoizer_counters.append(SCons.Memoize.CountValue('get_stored_info')) + + def get_stored_info(self): + try: + return self._memo['get_stored_info'] + except KeyError: + pass + + try: + sconsign_entry = self.dir.sconsign().get_entry(self.name) + except (KeyError, EnvironmentError): + import SCons.SConsign + sconsign_entry = SCons.SConsign.SConsignEntry() + sconsign_entry.binfo = self.new_binfo() + sconsign_entry.ninfo = self.new_ninfo() + else: + if isinstance(sconsign_entry, FileBuildInfo): + # This is a .sconsign file from before the Big Signature + # Refactoring; convert it as best we can. + sconsign_entry = self.convert_old_entry(sconsign_entry) + try: + delattr(sconsign_entry.ninfo, 'bsig') + except AttributeError: + pass + + self._memo['get_stored_info'] = sconsign_entry + + return sconsign_entry + + def get_stored_implicit(self): + binfo = self.get_stored_info().binfo + binfo.prepare_dependencies() + try: return binfo.bimplicit + except AttributeError: return None + + def rel_path(self, other): + return self.dir.rel_path(other) + + def _get_found_includes_key(self, env, scanner, path): + return (id(env), id(scanner), path) + + memoizer_counters.append(SCons.Memoize.CountDict('get_found_includes', _get_found_includes_key)) + + def get_found_includes(self, env, scanner, path): + """Return the included implicit dependencies in this file. + Cache results so we only scan the file once per path + regardless of how many times this information is requested. + """ + memo_key = (id(env), id(scanner), path) + try: + memo_dict = self._memo['get_found_includes'] + except KeyError: + memo_dict = {} + self._memo['get_found_includes'] = memo_dict + else: + try: + return memo_dict[memo_key] + except KeyError: + pass + + if scanner: + # result = [n.disambiguate() for n in scanner(self, env, path)] + result = scanner(self, env, path) + result = [N.disambiguate() for N in result] + else: + result = [] + + memo_dict[memo_key] = result + + return result + + def _createDir(self): + # ensure that the directories for this node are + # created. + self.dir._create() + + def push_to_cache(self): + """Try to push the node into a cache + """ + # This should get called before the Nodes' .built() method is + # called, which would clear the build signature if the file has + # a source scanner. + # + # We have to clear the local memoized values *before* we push + # the node to cache so that the memoization of the self.exists() + # return value doesn't interfere. + if self.nocache: + return + self.clear_memoized_values() + if self.exists(): + self.get_build_env().get_CacheDir().push(self) + + def retrieve_from_cache(self): + """Try to retrieve the node's content from a cache + + This method is called from multiple threads in a parallel build, + so only do thread safe stuff here. Do thread unsafe stuff in + built(). + + Returns true if the node was successfully retrieved. + """ + if self.nocache: + return None + if not self.is_derived(): + return None + return self.get_build_env().get_CacheDir().retrieve(self) + + def visited(self): + if self.exists(): + self.get_build_env().get_CacheDir().push_if_forced(self) + + ninfo = self.get_ninfo() + + csig = self.get_max_drift_csig() + if csig: + ninfo.csig = csig + + ninfo.timestamp = self.get_timestamp() + ninfo.size = self.get_size() + + if not self.has_builder(): + # This is a source file, but it might have been a target file + # in another build that included more of the DAG. Copy + # any build information that's stored in the .sconsign file + # into our binfo object so it doesn't get lost. + old = self.get_stored_info() + self.get_binfo().__dict__.update(old.binfo.__dict__) + + self.store_info() + + def find_src_builder(self): + if self.rexists(): + return None + scb = self.dir.src_builder() + if scb is _null: + if diskcheck_sccs(self.dir, self.name): + scb = get_DefaultSCCSBuilder() + elif diskcheck_rcs(self.dir, self.name): + scb = get_DefaultRCSBuilder() + else: + scb = None + if scb is not None: + try: + b = self.builder + except AttributeError: + b = None + if b is None: + self.builder_set(scb) + return scb + + def has_src_builder(self): + """Return whether this Node has a source builder or not. + + If this Node doesn't have an explicit source code builder, this + is where we figure out, on the fly, if there's a transparent + source code builder for it. + + Note that if we found a source builder, we also set the + self.builder attribute, so that all of the methods that actually + *build* this file don't have to do anything different. + """ + try: + scb = self.sbuilder + except AttributeError: + scb = self.sbuilder = self.find_src_builder() + return scb is not None + + def alter_targets(self): + """Return any corresponding targets in a variant directory. + """ + if self.is_derived(): + return [], None + return self.fs.variant_dir_target_climb(self, self.dir, [self.name]) + + def _rmv_existing(self): + self.clear_memoized_values() + if print_duplicate: + print "dup: removing existing target %s"%self + e = Unlink(self, [], None) + if isinstance(e, SCons.Errors.BuildError): + raise e + + # + # Taskmaster interface subsystem + # + + def make_ready(self): + self.has_src_builder() + self.get_binfo() + + def prepare(self): + """Prepare for this file to be created.""" + SCons.Node.Node.prepare(self) + + if self.get_state() != SCons.Node.up_to_date: + if self.exists(): + if self.is_derived() and not self.precious: + self._rmv_existing() + else: + try: + self._createDir() + except SCons.Errors.StopError, drive: + desc = "No drive `%s' for target `%s'." % (drive, self) + raise SCons.Errors.StopError(desc) + + # + # + # + + def remove(self): + """Remove this file.""" + if self.exists() or self.islink(): + self.fs.unlink(self.path) + return 1 + return None + + def do_duplicate(self, src): + self._createDir() + if print_duplicate: + print "dup: relinking variant '%s' from '%s'"%(self, src) + Unlink(self, None, None) + e = Link(self, src, None) + if isinstance(e, SCons.Errors.BuildError): + desc = "Cannot duplicate `%s' in `%s': %s." % (src.path, self.dir.path, e.errstr) + raise SCons.Errors.StopError(desc) + self.linked = 1 + # The Link() action may or may not have actually + # created the file, depending on whether the -n + # option was used or not. Delete the _exists and + # _rexists attributes so they can be reevaluated. + self.clear() + + memoizer_counters.append(SCons.Memoize.CountValue('exists')) + + def exists(self): + try: + return self._memo['exists'] + except KeyError: + pass + # Duplicate from source path if we are set up to do this. + if self.duplicate and not self.is_derived() and not self.linked: + src = self.srcnode() + if src is not self: + # At this point, src is meant to be copied in a variant directory. + src = src.rfile() + if src.abspath != self.abspath: + if src.exists(): + self.do_duplicate(src) + # Can't return 1 here because the duplication might + # not actually occur if the -n option is being used. + else: + # The source file does not exist. Make sure no old + # copy remains in the variant directory. + if print_duplicate: + print "dup: no src for %s, unlinking old variant copy"%self + if Base.exists(self) or self.islink(): + self.fs.unlink(self.path) + # Return None explicitly because the Base.exists() call + # above will have cached its value if the file existed. + self._memo['exists'] = None + return None + result = Base.exists(self) + self._memo['exists'] = result + return result + + # + # SIGNATURE SUBSYSTEM + # + + def get_max_drift_csig(self): + """ + Returns the content signature currently stored for this node + if it's been unmodified longer than the max_drift value, or the + max_drift value is 0. Returns None otherwise. + """ + old = self.get_stored_info() + mtime = self.get_timestamp() + + max_drift = self.fs.max_drift + if max_drift > 0: + if (time.time() - mtime) > max_drift: + try: + n = old.ninfo + if n.timestamp and n.csig and n.timestamp == mtime: + return n.csig + except AttributeError: + pass + elif max_drift == 0: + try: + return old.ninfo.csig + except AttributeError: + pass + + return None + + def get_csig(self): + """ + Generate a node's content signature, the digested signature + of its content. + + node - the node + cache - alternate node to use for the signature cache + returns - the content signature + """ + ninfo = self.get_ninfo() + try: + return ninfo.csig + except AttributeError: + pass + + csig = self.get_max_drift_csig() + if csig is None: + + try: + if self.get_size() < SCons.Node.FS.File.md5_chunksize: + contents = self.get_contents() + else: + csig = self.get_content_hash() + except IOError: + # This can happen if there's actually a directory on-disk, + # which can be the case if they've disabled disk checks, + # or if an action with a File target actually happens to + # create a same-named directory by mistake. + csig = '' + else: + if not csig: + csig = SCons.Util.MD5signature(contents) + + ninfo.csig = csig + + return csig + + # + # DECISION SUBSYSTEM + # + + def builder_set(self, builder): + SCons.Node.Node.builder_set(self, builder) + self.changed_since_last_build = self.decide_target + + def changed_content(self, target, prev_ni): + cur_csig = self.get_csig() + try: + return cur_csig != prev_ni.csig + except AttributeError: + return 1 + + def changed_state(self, target, prev_ni): + return self.state != SCons.Node.up_to_date + + def changed_timestamp_then_content(self, target, prev_ni): + if not self.changed_timestamp_match(target, prev_ni): + try: + self.get_ninfo().csig = prev_ni.csig + except AttributeError: + pass + return False + return self.changed_content(target, prev_ni) + + def changed_timestamp_newer(self, target, prev_ni): + try: + return self.get_timestamp() > target.get_timestamp() + except AttributeError: + return 1 + + def changed_timestamp_match(self, target, prev_ni): + try: + return self.get_timestamp() != prev_ni.timestamp + except AttributeError: + return 1 + + def decide_source(self, target, prev_ni): + return target.get_build_env().decide_source(self, target, prev_ni) + + def decide_target(self, target, prev_ni): + return target.get_build_env().decide_target(self, target, prev_ni) + + # Initialize this Node's decider function to decide_source() because + # every file is a source file until it has a Builder attached... + changed_since_last_build = decide_source + + def is_up_to_date(self): + T = 0 + if T: Trace('is_up_to_date(%s):' % self) + if not self.exists(): + if T: Trace(' not self.exists():') + # The file doesn't exist locally... + r = self.rfile() + if r != self: + # ...but there is one in a Repository... + if not self.changed(r): + if T: Trace(' changed(%s):' % r) + # ...and it's even up-to-date... + if self._local: + # ...and they'd like a local copy. + e = LocalCopy(self, r, None) + if isinstance(e, SCons.Errors.BuildError): + raise + self.store_info() + if T: Trace(' 1\n') + return 1 + self.changed() + if T: Trace(' None\n') + return None + else: + r = self.changed() + if T: Trace(' self.exists(): %s\n' % r) + return not r + + memoizer_counters.append(SCons.Memoize.CountValue('rfile')) + + def rfile(self): + try: + return self._memo['rfile'] + except KeyError: + pass + result = self + if not self.exists(): + norm_name = _my_normcase(self.name) + for dir in self.dir.get_all_rdirs(): + try: node = dir.entries[norm_name] + except KeyError: node = dir.file_on_disk(self.name) + if node and node.exists() and \ + (isinstance(node, File) or isinstance(node, Entry) \ + or not node.is_derived()): + result = node + # Copy over our local attributes to the repository + # Node so we identify shared object files in the + # repository and don't assume they're static. + # + # This isn't perfect; the attribute would ideally + # be attached to the object in the repository in + # case it was built statically in the repository + # and we changed it to shared locally, but that's + # rarely the case and would only occur if you + # intentionally used the same suffix for both + # shared and static objects anyway. So this + # should work well in practice. + result.attributes = self.attributes + break + self._memo['rfile'] = result + return result + + def rstr(self): + return str(self.rfile()) + + def get_cachedir_csig(self): + """ + Fetch a Node's content signature for purposes of computing + another Node's cachesig. + + This is a wrapper around the normal get_csig() method that handles + the somewhat obscure case of using CacheDir with the -n option. + Any files that don't exist would normally be "built" by fetching + them from the cache, but the normal get_csig() method will try + to open up the local file, which doesn't exist because the -n + option meant we didn't actually pull the file from cachedir. + But since the file *does* actually exist in the cachedir, we + can use its contents for the csig. + """ + try: + return self.cachedir_csig + except AttributeError: + pass + + cachedir, cachefile = self.get_build_env().get_CacheDir().cachepath(self) + if not self.exists() and cachefile and os.path.exists(cachefile): + self.cachedir_csig = SCons.Util.MD5filesignature(cachefile, \ + SCons.Node.FS.File.md5_chunksize * 1024) + else: + self.cachedir_csig = self.get_csig() + return self.cachedir_csig + + def get_cachedir_bsig(self): + try: + return self.cachesig + except AttributeError: + pass + + # Add the path to the cache signature, because multiple + # targets built by the same action will all have the same + # build signature, and we have to differentiate them somehow. + children = self.children() + executor = self.get_executor() + # sigs = [n.get_cachedir_csig() for n in children] + sigs = [n.get_cachedir_csig() for n in children] + sigs.append(SCons.Util.MD5signature(executor.get_contents())) + sigs.append(self.path) + result = self.cachesig = SCons.Util.MD5collect(sigs) + return result + + +default_fs = None + +def get_default_fs(): + global default_fs + if not default_fs: + default_fs = FS() + return default_fs + +class FileFinder(object): + """ + """ + if SCons.Memoize.use_memoizer: + __metaclass__ = SCons.Memoize.Memoized_Metaclass + + memoizer_counters = [] + + def __init__(self): + self._memo = {} + + def filedir_lookup(self, p, fd=None): + """ + A helper method for find_file() that looks up a directory for + a file we're trying to find. This only creates the Dir Node if + it exists on-disk, since if the directory doesn't exist we know + we won't find any files in it... :-) + + It would be more compact to just use this as a nested function + with a default keyword argument (see the commented-out version + below), but that doesn't work unless you have nested scopes, + so we define it here just so this work under Python 1.5.2. + """ + if fd is None: + fd = self.default_filedir + dir, name = os.path.split(fd) + drive, d = _my_splitdrive(dir) + if not name and d[:1] in ('/', OS_SEP): + #return p.fs.get_root(drive).dir_on_disk(name) + return p.fs.get_root(drive) + if dir: + p = self.filedir_lookup(p, dir) + if not p: + return None + norm_name = _my_normcase(name) + try: + node = p.entries[norm_name] + except KeyError: + return p.dir_on_disk(name) + if isinstance(node, Dir): + return node + if isinstance(node, Entry): + node.must_be_same(Dir) + return node + return None + + def _find_file_key(self, filename, paths, verbose=None): + return (filename, paths) + + memoizer_counters.append(SCons.Memoize.CountDict('find_file', _find_file_key)) + + def find_file(self, filename, paths, verbose=None): + """ + find_file(str, [Dir()]) -> [nodes] + + filename - a filename to find + paths - a list of directory path *nodes* to search in. Can be + represented as a list, a tuple, or a callable that is + called with no arguments and returns the list or tuple. + + returns - the node created from the found file. + + Find a node corresponding to either a derived file or a file + that exists already. + + Only the first file found is returned, and none is returned + if no file is found. + """ + memo_key = self._find_file_key(filename, paths) + try: + memo_dict = self._memo['find_file'] + except KeyError: + memo_dict = {} + self._memo['find_file'] = memo_dict + else: + try: + return memo_dict[memo_key] + except KeyError: + pass + + if verbose and not callable(verbose): + if not SCons.Util.is_String(verbose): + verbose = "find_file" + _verbose = u' %s: ' % verbose + verbose = lambda s: sys.stdout.write(_verbose + s) + + filedir, filename = os.path.split(filename) + if filedir: + # More compact code that we can't use until we drop + # support for Python 1.5.2: + # + #def filedir_lookup(p, fd=filedir): + # """ + # A helper function that looks up a directory for a file + # we're trying to find. This only creates the Dir Node + # if it exists on-disk, since if the directory doesn't + # exist we know we won't find any files in it... :-) + # """ + # dir, name = os.path.split(fd) + # if dir: + # p = filedir_lookup(p, dir) + # if not p: + # return None + # norm_name = _my_normcase(name) + # try: + # node = p.entries[norm_name] + # except KeyError: + # return p.dir_on_disk(name) + # if isinstance(node, Dir): + # return node + # if isinstance(node, Entry): + # node.must_be_same(Dir) + # return node + # if isinstance(node, Dir) or isinstance(node, Entry): + # return node + # return None + #paths = [_f for _f in map(filedir_lookup, paths) if _f] + + self.default_filedir = filedir + paths = [_f for _f in map(self.filedir_lookup, paths) if _f] + + result = None + for dir in paths: + if verbose: + verbose("looking for '%s' in '%s' ...\n" % (filename, dir)) + node, d = dir.srcdir_find_file(filename) + if node: + if verbose: + verbose("... FOUND '%s' in '%s'\n" % (filename, d)) + result = node + break + + memo_dict[memo_key] = result + + return result + +find_file = FileFinder().find_file + + +def invalidate_node_memos(targets): + """ + Invalidate the memoized values of all Nodes (files or directories) + that are associated with the given entries. Has been added to + clear the cache of nodes affected by a direct execution of an + action (e.g. Delete/Copy/Chmod). Existing Node caches become + inconsistent if the action is run through Execute(). The argument + `targets` can be a single Node object or filename, or a sequence + of Nodes/filenames. + """ + from traceback import extract_stack + + # First check if the cache really needs to be flushed. Only + # actions run in the SConscript with Execute() seem to be + # affected. XXX The way to check if Execute() is in the stacktrace + # is a very dirty hack and should be replaced by a more sensible + # solution. + for f in extract_stack(): + if f[2] == 'Execute' and f[0][-14:] == 'Environment.py': + break + else: + # Dont have to invalidate, so return + return + + if not SCons.Util.is_List(targets): + targets = [targets] + + for entry in targets: + # If the target is a Node object, clear the cache. If it is a + # filename, look up potentially existing Node object first. + try: + entry.clear_memoized_values() + except AttributeError: + # Not a Node object, try to look up Node by filename. XXX + # This creates Node objects even for those filenames which + # do not correspond to an existing Node object. + node = get_default_fs().Entry(entry) + if node: + node.clear_memoized_values() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Node/Python.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Node/Python.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Node/Python.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Node/Python.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,128 @@ +"""scons.Node.Python + +Python nodes. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Node/Python.py 2013/03/03 09:48:35 garyo" + +import SCons.Node + +class ValueNodeInfo(SCons.Node.NodeInfoBase): + current_version_id = 1 + + field_list = ['csig'] + + def str_to_node(self, s): + return Value(s) + +class ValueBuildInfo(SCons.Node.BuildInfoBase): + current_version_id = 1 + +class Value(SCons.Node.Node): + """A class for Python variables, typically passed on the command line + or generated by a script, but not from a file or some other source. + """ + + NodeInfo = ValueNodeInfo + BuildInfo = ValueBuildInfo + + def __init__(self, value, built_value=None): + SCons.Node.Node.__init__(self) + self.value = value + if built_value is not None: + self.built_value = built_value + + def str_for_display(self): + return repr(self.value) + + def __str__(self): + return str(self.value) + + def make_ready(self): + self.get_csig() + + def build(self, **kw): + if not hasattr(self, 'built_value'): + SCons.Node.Node.build(self, **kw) + + is_up_to_date = SCons.Node.Node.children_are_up_to_date + + def is_under(self, dir): + # Make Value nodes get built regardless of + # what directory scons was run from. Value nodes + # are outside the filesystem: + return 1 + + def write(self, built_value): + """Set the value of the node.""" + self.built_value = built_value + + def read(self): + """Return the value. If necessary, the value is built.""" + self.build() + if not hasattr(self, 'built_value'): + self.built_value = self.value + return self.built_value + + def get_text_contents(self): + """By the assumption that the node.built_value is a + deterministic product of the sources, the contents of a Value + are the concatenation of all the contents of its sources. As + the value need not be built when get_contents() is called, we + cannot use the actual node.built_value.""" + ###TODO: something reasonable about universal newlines + contents = str(self.value) + for kid in self.children(None): + contents = contents + kid.get_contents() + return contents + + get_contents = get_text_contents ###TODO should return 'bytes' value + + def changed_since_last_build(self, target, prev_ni): + cur_csig = self.get_csig() + try: + return cur_csig != prev_ni.csig + except AttributeError: + return 1 + + def get_csig(self, calc=None): + """Because we're a Python value node and don't have a real + timestamp, we get to ignore the calculator and just use the + value contents.""" + try: + return self.ninfo.csig + except AttributeError: + pass + contents = self.get_contents() + self.get_ninfo().csig = contents + return contents + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Node/__init__.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Node/__init__.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Node/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Node/__init__.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,1330 @@ +"""SCons.Node + +The Node package for the SCons software construction utility. + +This is, in many ways, the heart of SCons. + +A Node is where we encapsulate all of the dependency information about +any thing that SCons can build, or about any thing which SCons can use +to build some other thing. The canonical "thing," of course, is a file, +but a Node can also represent something remote (like a web page) or +something completely abstract (like an Alias). + +Each specific type of "thing" is specifically represented by a subclass +of the Node base class: Node.FS.File for files, Node.Alias for aliases, +etc. Dependency information is kept here in the base class, and +information specific to files/aliases/etc. is in the subclass. The +goal, if we've done this correctly, is that any type of "thing" should +be able to depend on any other type of "thing." + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Node/__init__.py 2013/03/03 09:48:35 garyo" + +import collections +import copy +from itertools import chain + +from SCons.Debug import logInstanceCreation +import SCons.Executor +import SCons.Memoize +import SCons.Util + +from SCons.Debug import Trace + +def classname(obj): + return str(obj.__class__).split('.')[-1] + +# Node states +# +# These are in "priority" order, so that the maximum value for any +# child/dependency of a node represents the state of that node if +# it has no builder of its own. The canonical example is a file +# system directory, which is only up to date if all of its children +# were up to date. +no_state = 0 +pending = 1 +executing = 2 +up_to_date = 3 +executed = 4 +failed = 5 + +StateString = { + 0 : "no_state", + 1 : "pending", + 2 : "executing", + 3 : "up_to_date", + 4 : "executed", + 5 : "failed", +} + +# controls whether implicit dependencies are cached: +implicit_cache = 0 + +# controls whether implicit dep changes are ignored: +implicit_deps_unchanged = 0 + +# controls whether the cached implicit deps are ignored: +implicit_deps_changed = 0 + +# A variable that can be set to an interface-specific function be called +# to annotate a Node with information about its creation. +def do_nothing(node): pass + +Annotate = do_nothing + +# Classes for signature info for Nodes. + +class NodeInfoBase(object): + """ + The generic base class for signature information for a Node. + + Node subclasses should subclass NodeInfoBase to provide their own + logic for dealing with their own Node-specific signature information. + """ + current_version_id = 1 + def __init__(self, node=None): + # Create an object attribute from the class attribute so it ends up + # in the pickled data in the .sconsign file. + self._version_id = self.current_version_id + def update(self, node): + try: + field_list = self.field_list + except AttributeError: + return + for f in field_list: + try: + delattr(self, f) + except AttributeError: + pass + try: + func = getattr(node, 'get_' + f) + except AttributeError: + pass + else: + setattr(self, f, func()) + def convert(self, node, val): + pass + def merge(self, other): + self.__dict__.update(other.__dict__) + def format(self, field_list=None, names=0): + if field_list is None: + try: + field_list = self.field_list + except AttributeError: + field_list = sorted(self.__dict__.keys()) + fields = [] + for field in field_list: + try: + f = getattr(self, field) + except AttributeError: + f = None + f = str(f) + if names: + f = field + ': ' + f + fields.append(f) + return fields + +class BuildInfoBase(object): + """ + The generic base class for build information for a Node. + + This is what gets stored in a .sconsign file for each target file. + It contains a NodeInfo instance for this node (signature information + that's specific to the type of Node) and direct attributes for the + generic build stuff we have to track: sources, explicit dependencies, + implicit dependencies, and action information. + """ + current_version_id = 1 + def __init__(self, node=None): + # Create an object attribute from the class attribute so it ends up + # in the pickled data in the .sconsign file. + self._version_id = self.current_version_id + self.bsourcesigs = [] + self.bdependsigs = [] + self.bimplicitsigs = [] + self.bactsig = None + def merge(self, other): + self.__dict__.update(other.__dict__) + +class Node(object): + """The base Node class, for entities that we know how to + build, or use to build other Nodes. + """ + + if SCons.Memoize.use_memoizer: + __metaclass__ = SCons.Memoize.Memoized_Metaclass + + memoizer_counters = [] + + class Attrs(object): + pass + + def __init__(self): + if __debug__: logInstanceCreation(self, 'Node.Node') + # Note that we no longer explicitly initialize a self.builder + # attribute to None here. That's because the self.builder + # attribute may be created on-the-fly later by a subclass (the + # canonical example being a builder to fetch a file from a + # source code system like CVS or Subversion). + + # Each list of children that we maintain is accompanied by a + # dictionary used to look up quickly whether a node is already + # present in the list. Empirical tests showed that it was + # fastest to maintain them as side-by-side Node attributes in + # this way, instead of wrapping up each list+dictionary pair in + # a class. (Of course, we could always still do that in the + # future if we had a good reason to...). + self.sources = [] # source files used to build node + self.sources_set = set() + self._specific_sources = False + self.depends = [] # explicit dependencies (from Depends) + self.depends_set = set() + self.ignore = [] # dependencies to ignore + self.ignore_set = set() + self.prerequisites = SCons.Util.UniqueList() + self.implicit = None # implicit (scanned) dependencies (None means not scanned yet) + self.waiting_parents = set() + self.waiting_s_e = set() + self.ref_count = 0 + self.wkids = None # Kids yet to walk, when it's an array + + self.env = None + self.state = no_state + self.precious = None + self.noclean = 0 + self.nocache = 0 + self.cached = 0 # is this node pulled from cache? + self.always_build = None + self.includes = None + self.attributes = self.Attrs() # Generic place to stick information about the Node. + self.side_effect = 0 # true iff this node is a side effect + self.side_effects = [] # the side effects of building this target + self.linked = 0 # is this node linked to the variant directory? + + self.clear_memoized_values() + + # Let the interface in which the build engine is embedded + # annotate this Node with its own info (like a description of + # what line in what file created the node, for example). + Annotate(self) + + def disambiguate(self, must_exist=None): + return self + + def get_suffix(self): + return '' + + memoizer_counters.append(SCons.Memoize.CountValue('get_build_env')) + + def get_build_env(self): + """Fetch the appropriate Environment to build this node. + """ + try: + return self._memo['get_build_env'] + except KeyError: + pass + result = self.get_executor().get_build_env() + self._memo['get_build_env'] = result + return result + + def get_build_scanner_path(self, scanner): + """Fetch the appropriate scanner path for this node.""" + return self.get_executor().get_build_scanner_path(scanner) + + def set_executor(self, executor): + """Set the action executor for this node.""" + self.executor = executor + + def get_executor(self, create=1): + """Fetch the action executor for this node. Create one if + there isn't already one, and requested to do so.""" + try: + executor = self.executor + except AttributeError: + if not create: + raise + try: + act = self.builder.action + except AttributeError: + executor = SCons.Executor.Null(targets=[self]) + else: + executor = SCons.Executor.Executor(act, + self.env or self.builder.env, + [self.builder.overrides], + [self], + self.sources) + self.executor = executor + return executor + + def executor_cleanup(self): + """Let the executor clean up any cached information.""" + try: + executor = self.get_executor(create=None) + except AttributeError: + pass + else: + executor.cleanup() + + def reset_executor(self): + "Remove cached executor; forces recompute when needed." + try: + delattr(self, 'executor') + except AttributeError: + pass + + def push_to_cache(self): + """Try to push a node into a cache + """ + pass + + def retrieve_from_cache(self): + """Try to retrieve the node's content from a cache + + This method is called from multiple threads in a parallel build, + so only do thread safe stuff here. Do thread unsafe stuff in + built(). + + Returns true if the node was successfully retrieved. + """ + return 0 + + # + # Taskmaster interface subsystem + # + + def make_ready(self): + """Get a Node ready for evaluation. + + This is called before the Taskmaster decides if the Node is + up-to-date or not. Overriding this method allows for a Node + subclass to be disambiguated if necessary, or for an implicit + source builder to be attached. + """ + pass + + def prepare(self): + """Prepare for this Node to be built. + + This is called after the Taskmaster has decided that the Node + is out-of-date and must be rebuilt, but before actually calling + the method to build the Node. + + This default implementation checks that explicit or implicit + dependencies either exist or are derived, and initializes the + BuildInfo structure that will hold the information about how + this node is, uh, built. + + (The existence of source files is checked separately by the + Executor, which aggregates checks for all of the targets built + by a specific action.) + + Overriding this method allows for for a Node subclass to remove + the underlying file from the file system. Note that subclass + methods should call this base class method to get the child + check and the BuildInfo structure. + """ + for d in self.depends: + if d.missing(): + msg = "Explicit dependency `%s' not found, needed by target `%s'." + raise SCons.Errors.StopError(msg % (d, self)) + if self.implicit is not None: + for i in self.implicit: + if i.missing(): + msg = "Implicit dependency `%s' not found, needed by target `%s'." + raise SCons.Errors.StopError(msg % (i, self)) + self.binfo = self.get_binfo() + + def build(self, **kw): + """Actually build the node. + + This is called by the Taskmaster after it's decided that the + Node is out-of-date and must be rebuilt, and after the prepare() + method has gotten everything, uh, prepared. + + This method is called from multiple threads in a parallel build, + so only do thread safe stuff here. Do thread unsafe stuff + in built(). + + """ + try: + self.get_executor()(self, **kw) + except SCons.Errors.BuildError, e: + e.node = self + raise + + def built(self): + """Called just after this node is successfully built.""" + + # Clear the implicit dependency caches of any Nodes + # waiting for this Node to be built. + for parent in self.waiting_parents: + parent.implicit = None + + self.clear() + + self.ninfo.update(self) + + def visited(self): + """Called just after this node has been visited (with or + without a build).""" + try: + binfo = self.binfo + except AttributeError: + # Apparently this node doesn't need build info, so + # don't bother calculating or storing it. + pass + else: + self.ninfo.update(self) + self.store_info() + + # + # + # + + def add_to_waiting_s_e(self, node): + self.waiting_s_e.add(node) + + def add_to_waiting_parents(self, node): + """ + Returns the number of nodes added to our waiting parents list: + 1 if we add a unique waiting parent, 0 if not. (Note that the + returned values are intended to be used to increment a reference + count, so don't think you can "clean up" this function by using + True and False instead...) + """ + wp = self.waiting_parents + if node in wp: + return 0 + wp.add(node) + return 1 + + def postprocess(self): + """Clean up anything we don't need to hang onto after we've + been built.""" + self.executor_cleanup() + self.waiting_parents = set() + + def clear(self): + """Completely clear a Node of all its cached state (so that it + can be re-evaluated by interfaces that do continuous integration + builds). + """ + # The del_binfo() call here isn't necessary for normal execution, + # but is for interactive mode, where we might rebuild the same + # target and need to start from scratch. + self.del_binfo() + self.clear_memoized_values() + self.ninfo = self.new_ninfo() + self.executor_cleanup() + try: + delattr(self, '_calculated_sig') + except AttributeError: + pass + self.includes = None + + def clear_memoized_values(self): + self._memo = {} + + def builder_set(self, builder): + self.builder = builder + try: + del self.executor + except AttributeError: + pass + + def has_builder(self): + """Return whether this Node has a builder or not. + + In Boolean tests, this turns out to be a *lot* more efficient + than simply examining the builder attribute directly ("if + node.builder: ..."). When the builder attribute is examined + directly, it ends up calling __getattr__ for both the __len__ + and __nonzero__ attributes on instances of our Builder Proxy + class(es), generating a bazillion extra calls and slowing + things down immensely. + """ + try: + b = self.builder + except AttributeError: + # There was no explicit builder for this Node, so initialize + # the self.builder attribute to None now. + b = self.builder = None + return b is not None + + def set_explicit(self, is_explicit): + self.is_explicit = is_explicit + + def has_explicit_builder(self): + """Return whether this Node has an explicit builder + + This allows an internal Builder created by SCons to be marked + non-explicit, so that it can be overridden by an explicit + builder that the user supplies (the canonical example being + directories).""" + try: + return self.is_explicit + except AttributeError: + self.is_explicit = None + return self.is_explicit + + def get_builder(self, default_builder=None): + """Return the set builder, or a specified default value""" + try: + return self.builder + except AttributeError: + return default_builder + + multiple_side_effect_has_builder = has_builder + + def is_derived(self): + """ + Returns true iff this node is derived (i.e. built). + + This should return true only for nodes whose path should be in + the variant directory when duplicate=0 and should contribute their build + signatures when they are used as source files to other derived files. For + example: source with source builders are not derived in this sense, + and hence should not return true. + """ + return self.has_builder() or self.side_effect + + def alter_targets(self): + """Return a list of alternate targets for this Node. + """ + return [], None + + def get_found_includes(self, env, scanner, path): + """Return the scanned include lines (implicit dependencies) + found in this node. + + The default is no implicit dependencies. We expect this method + to be overridden by any subclass that can be scanned for + implicit dependencies. + """ + return [] + + def get_implicit_deps(self, env, scanner, path): + """Return a list of implicit dependencies for this node. + + This method exists to handle recursive invocation of the scanner + on the implicit dependencies returned by the scanner, if the + scanner's recursive flag says that we should. + """ + if not scanner: + return [] + + # Give the scanner a chance to select a more specific scanner + # for this Node. + #scanner = scanner.select(self) + + nodes = [self] + seen = {} + seen[self] = 1 + deps = [] + while nodes: + n = nodes.pop(0) + d = [x for x in n.get_found_includes(env, scanner, path) if x not in seen] + if d: + deps.extend(d) + for n in d: + seen[n] = 1 + nodes.extend(scanner.recurse_nodes(d)) + + return deps + + def get_env_scanner(self, env, kw={}): + return env.get_scanner(self.scanner_key()) + + def get_target_scanner(self): + return self.builder.target_scanner + + def get_source_scanner(self, node): + """Fetch the source scanner for the specified node + + NOTE: "self" is the target being built, "node" is + the source file for which we want to fetch the scanner. + + Implies self.has_builder() is true; again, expect to only be + called from locations where this is already verified. + + This function may be called very often; it attempts to cache + the scanner found to improve performance. + """ + scanner = None + try: + scanner = self.builder.source_scanner + except AttributeError: + pass + if not scanner: + # The builder didn't have an explicit scanner, so go look up + # a scanner from env['SCANNERS'] based on the node's scanner + # key (usually the file extension). + scanner = self.get_env_scanner(self.get_build_env()) + if scanner: + scanner = scanner.select(node) + return scanner + + def add_to_implicit(self, deps): + if not hasattr(self, 'implicit') or self.implicit is None: + self.implicit = [] + self.implicit_set = set() + self._children_reset() + self._add_child(self.implicit, self.implicit_set, deps) + + def scan(self): + """Scan this node's dependents for implicit dependencies.""" + # Don't bother scanning non-derived files, because we don't + # care what their dependencies are. + # Don't scan again, if we already have scanned. + if self.implicit is not None: + return + self.implicit = [] + self.implicit_set = set() + self._children_reset() + if not self.has_builder(): + return + + build_env = self.get_build_env() + executor = self.get_executor() + + # Here's where we implement --implicit-cache. + if implicit_cache and not implicit_deps_changed: + implicit = self.get_stored_implicit() + if implicit is not None: + # We now add the implicit dependencies returned from the + # stored .sconsign entry to have already been converted + # to Nodes for us. (We used to run them through a + # source_factory function here.) + + # Update all of the targets with them. This + # essentially short-circuits an N*M scan of the + # sources for each individual target, which is a hell + # of a lot more efficient. + for tgt in executor.get_all_targets(): + tgt.add_to_implicit(implicit) + + if implicit_deps_unchanged or self.is_up_to_date(): + return + # one of this node's sources has changed, + # so we must recalculate the implicit deps for all targets + for tgt in executor.get_all_targets(): + tgt.implicit = [] + tgt.implicit_set = set() + + # Have the executor scan the sources. + executor.scan_sources(self.builder.source_scanner) + + # If there's a target scanner, have the executor scan the target + # node itself and associated targets that might be built. + scanner = self.get_target_scanner() + if scanner: + executor.scan_targets(scanner) + + def scanner_key(self): + return None + + def select_scanner(self, scanner): + """Selects a scanner for this Node. + + This is a separate method so it can be overridden by Node + subclasses (specifically, Node.FS.Dir) that *must* use their + own Scanner and don't select one the Scanner.Selector that's + configured for the target. + """ + return scanner.select(self) + + def env_set(self, env, safe=0): + if safe and self.env: + return + self.env = env + + # + # SIGNATURE SUBSYSTEM + # + + NodeInfo = NodeInfoBase + BuildInfo = BuildInfoBase + + def new_ninfo(self): + ninfo = self.NodeInfo(self) + return ninfo + + def get_ninfo(self): + try: + return self.ninfo + except AttributeError: + self.ninfo = self.new_ninfo() + return self.ninfo + + def new_binfo(self): + binfo = self.BuildInfo(self) + return binfo + + def get_binfo(self): + """ + Fetch a node's build information. + + node - the node whose sources will be collected + cache - alternate node to use for the signature cache + returns - the build signature + + This no longer handles the recursive descent of the + node's children's signatures. We expect that they're + already built and updated by someone else, if that's + what's wanted. + """ + try: + return self.binfo + except AttributeError: + pass + + binfo = self.new_binfo() + self.binfo = binfo + + executor = self.get_executor() + ignore_set = self.ignore_set + + if self.has_builder(): + binfo.bact = str(executor) + binfo.bactsig = SCons.Util.MD5signature(executor.get_contents()) + + if self._specific_sources: + sources = [] + for s in self.sources: + if s not in ignore_set: + sources.append(s) + else: + sources = executor.get_unignored_sources(self, self.ignore) + seen = set() + bsources = [] + bsourcesigs = [] + for s in sources: + if not s in seen: + seen.add(s) + bsources.append(s) + bsourcesigs.append(s.get_ninfo()) + binfo.bsources = bsources + binfo.bsourcesigs = bsourcesigs + + depends = self.depends + dependsigs = [] + for d in depends: + if d not in ignore_set: + dependsigs.append(d.get_ninfo()) + binfo.bdepends = depends + binfo.bdependsigs = dependsigs + + implicit = self.implicit or [] + implicitsigs = [] + for i in implicit: + if i not in ignore_set: + implicitsigs.append(i.get_ninfo()) + binfo.bimplicit = implicit + binfo.bimplicitsigs = implicitsigs + + return binfo + + def del_binfo(self): + """Delete the build info from this node.""" + try: + delattr(self, 'binfo') + except AttributeError: + pass + + def get_csig(self): + try: + return self.ninfo.csig + except AttributeError: + ninfo = self.get_ninfo() + ninfo.csig = SCons.Util.MD5signature(self.get_contents()) + return self.ninfo.csig + + def get_cachedir_csig(self): + return self.get_csig() + + def store_info(self): + """Make the build signature permanent (that is, store it in the + .sconsign file or equivalent).""" + pass + + def do_not_store_info(self): + pass + + def get_stored_info(self): + return None + + def get_stored_implicit(self): + """Fetch the stored implicit dependencies""" + return None + + # + # + # + + def set_precious(self, precious = 1): + """Set the Node's precious value.""" + self.precious = precious + + def set_noclean(self, noclean = 1): + """Set the Node's noclean value.""" + # Make sure noclean is an integer so the --debug=stree + # output in Util.py can use it as an index. + self.noclean = noclean and 1 or 0 + + def set_nocache(self, nocache = 1): + """Set the Node's nocache value.""" + # Make sure nocache is an integer so the --debug=stree + # output in Util.py can use it as an index. + self.nocache = nocache and 1 or 0 + + def set_always_build(self, always_build = 1): + """Set the Node's always_build value.""" + self.always_build = always_build + + def exists(self): + """Does this node exists?""" + # All node exist by default: + return 1 + + def rexists(self): + """Does this node exist locally or in a repositiory?""" + # There are no repositories by default: + return self.exists() + + def missing(self): + return not self.is_derived() and \ + not self.linked and \ + not self.rexists() + + def remove(self): + """Remove this Node: no-op by default.""" + return None + + def add_dependency(self, depend): + """Adds dependencies.""" + try: + self._add_child(self.depends, self.depends_set, depend) + except TypeError, e: + e = e.args[0] + if SCons.Util.is_List(e): + s = list(map(str, e)) + else: + s = str(e) + raise SCons.Errors.UserError("attempted to add a non-Node dependency to %s:\n\t%s is a %s, not a Node" % (str(self), s, type(e))) + + def add_prerequisite(self, prerequisite): + """Adds prerequisites""" + self.prerequisites.extend(prerequisite) + self._children_reset() + + def add_ignore(self, depend): + """Adds dependencies to ignore.""" + try: + self._add_child(self.ignore, self.ignore_set, depend) + except TypeError, e: + e = e.args[0] + if SCons.Util.is_List(e): + s = list(map(str, e)) + else: + s = str(e) + raise SCons.Errors.UserError("attempted to ignore a non-Node dependency of %s:\n\t%s is a %s, not a Node" % (str(self), s, type(e))) + + def add_source(self, source): + """Adds sources.""" + if self._specific_sources: + return + try: + self._add_child(self.sources, self.sources_set, source) + except TypeError, e: + e = e.args[0] + if SCons.Util.is_List(e): + s = list(map(str, e)) + else: + s = str(e) + raise SCons.Errors.UserError("attempted to add a non-Node as source of %s:\n\t%s is a %s, not a Node" % (str(self), s, type(e))) + + def _add_child(self, collection, set, child): + """Adds 'child' to 'collection', first checking 'set' to see if it's + already present.""" + #if type(child) is not type([]): + # child = [child] + #for c in child: + # if not isinstance(c, Node): + # raise TypeError, c + added = None + for c in child: + if c not in set: + set.add(c) + collection.append(c) + added = 1 + if added: + self._children_reset() + + def set_specific_source(self, source): + self.add_source(source) + self._specific_sources = True + + def add_wkid(self, wkid): + """Add a node to the list of kids waiting to be evaluated""" + if self.wkids is not None: + self.wkids.append(wkid) + + def _children_reset(self): + self.clear_memoized_values() + # We need to let the Executor clear out any calculated + # build info that it's cached so we can re-calculate it. + self.executor_cleanup() + + memoizer_counters.append(SCons.Memoize.CountValue('_children_get')) + + def _children_get(self): + try: + return self._memo['children_get'] + except KeyError: + pass + + # The return list may contain duplicate Nodes, especially in + # source trees where there are a lot of repeated #includes + # of a tangle of .h files. Profiling shows, however, that + # eliminating the duplicates with a brute-force approach that + # preserves the order (that is, something like: + # + # u = [] + # for n in list: + # if n not in u: + # u.append(n)" + # + # takes more cycles than just letting the underlying methods + # hand back cached values if a Node's information is requested + # multiple times. (Other methods of removing duplicates, like + # using dictionary keys, lose the order, and the only ordered + # dictionary patterns I found all ended up using "not in" + # internally anyway...) + if self.ignore_set: + if self.implicit is None: + iter = chain(self.sources,self.depends) + else: + iter = chain(self.sources, self.depends, self.implicit) + + children = [] + for i in iter: + if i not in self.ignore_set: + children.append(i) + else: + if self.implicit is None: + children = self.sources + self.depends + else: + children = self.sources + self.depends + self.implicit + + self._memo['children_get'] = children + return children + + def all_children(self, scan=1): + """Return a list of all the node's direct children.""" + if scan: + self.scan() + + # The return list may contain duplicate Nodes, especially in + # source trees where there are a lot of repeated #includes + # of a tangle of .h files. Profiling shows, however, that + # eliminating the duplicates with a brute-force approach that + # preserves the order (that is, something like: + # + # u = [] + # for n in list: + # if n not in u: + # u.append(n)" + # + # takes more cycles than just letting the underlying methods + # hand back cached values if a Node's information is requested + # multiple times. (Other methods of removing duplicates, like + # using dictionary keys, lose the order, and the only ordered + # dictionary patterns I found all ended up using "not in" + # internally anyway...) + if self.implicit is None: + return self.sources + self.depends + else: + return self.sources + self.depends + self.implicit + + def children(self, scan=1): + """Return a list of the node's direct children, minus those + that are ignored by this node.""" + if scan: + self.scan() + return self._children_get() + + def set_state(self, state): + self.state = state + + def get_state(self): + return self.state + + def state_has_changed(self, target, prev_ni): + return (self.state != SCons.Node.up_to_date) + + def get_env(self): + env = self.env + if not env: + import SCons.Defaults + env = SCons.Defaults.DefaultEnvironment() + return env + + def changed_since_last_build(self, target, prev_ni): + """ + + Must be overridden in a specific subclass to return True if this + Node (a dependency) has changed since the last time it was used + to build the specified target. prev_ni is this Node's state (for + example, its file timestamp, length, maybe content signature) + as of the last time the target was built. + + Note that this method is called through the dependency, not the + target, because a dependency Node must be able to use its own + logic to decide if it changed. For example, File Nodes need to + obey if we're configured to use timestamps, but Python Value Nodes + never use timestamps and always use the content. If this method + were called through the target, then each Node's implementation + of this method would have to have more complicated logic to + handle all the different Node types on which it might depend. + """ + raise NotImplementedError + + def Decider(self, function): + SCons.Util.AddMethod(self, function, 'changed_since_last_build') + + def changed(self, node=None): + """ + Returns if the node is up-to-date with respect to the BuildInfo + stored last time it was built. The default behavior is to compare + it against our own previously stored BuildInfo, but the stored + BuildInfo from another Node (typically one in a Repository) + can be used instead. + + Note that we now *always* check every dependency. We used to + short-circuit the check by returning as soon as we detected + any difference, but we now rely on checking every dependency + to make sure that any necessary Node information (for example, + the content signature of an #included .h file) is updated. + """ + t = 0 + if t: Trace('changed(%s [%s], %s)' % (self, classname(self), node)) + if node is None: + node = self + + result = False + + bi = node.get_stored_info().binfo + then = bi.bsourcesigs + bi.bdependsigs + bi.bimplicitsigs + children = self.children() + + diff = len(children) - len(then) + if diff: + # The old and new dependency lists are different lengths. + # This always indicates that the Node must be rebuilt. + # We also extend the old dependency list with enough None + # entries to equal the new dependency list, for the benefit + # of the loop below that updates node information. + then.extend([None] * diff) + if t: Trace(': old %s new %s' % (len(then), len(children))) + result = True + + for child, prev_ni in zip(children, then): + if child.changed_since_last_build(self, prev_ni): + if t: Trace(': %s changed' % child) + result = True + + contents = self.get_executor().get_contents() + if self.has_builder(): + import SCons.Util + newsig = SCons.Util.MD5signature(contents) + if bi.bactsig != newsig: + if t: Trace(': bactsig %s != newsig %s' % (bi.bactsig, newsig)) + result = True + + if not result: + if t: Trace(': up to date') + + if t: Trace('\n') + + return result + + def is_up_to_date(self): + """Default check for whether the Node is current: unknown Node + subtypes are always out of date, so they will always get built.""" + return None + + def children_are_up_to_date(self): + """Alternate check for whether the Node is current: If all of + our children were up-to-date, then this Node was up-to-date, too. + + The SCons.Node.Alias and SCons.Node.Python.Value subclasses + rebind their current() method to this method.""" + # Allow the children to calculate their signatures. + self.binfo = self.get_binfo() + if self.always_build: + return None + state = 0 + for kid in self.children(None): + s = kid.get_state() + if s and (not state or s > state): + state = s + return (state == 0 or state == SCons.Node.up_to_date) + + def is_literal(self): + """Always pass the string representation of a Node to + the command interpreter literally.""" + return 1 + + def render_include_tree(self): + """ + Return a text representation, suitable for displaying to the + user, of the include tree for the sources of this node. + """ + if self.is_derived() and self.env: + env = self.get_build_env() + for s in self.sources: + scanner = self.get_source_scanner(s) + if scanner: + path = self.get_build_scanner_path(scanner) + else: + path = None + def f(node, env=env, scanner=scanner, path=path): + return node.get_found_includes(env, scanner, path) + return SCons.Util.render_tree(s, f, 1) + else: + return None + + def get_abspath(self): + """ + Return an absolute path to the Node. This will return simply + str(Node) by default, but for Node types that have a concept of + relative path, this might return something different. + """ + return str(self) + + def for_signature(self): + """ + Return a string representation of the Node that will always + be the same for this particular Node, no matter what. This + is by contrast to the __str__() method, which might, for + instance, return a relative path for a file Node. The purpose + of this method is to generate a value to be used in signature + calculation for the command line used to build a target, and + we use this method instead of str() to avoid unnecessary + rebuilds. This method does not need to return something that + would actually work in a command line; it can return any kind of + nonsense, so long as it does not change. + """ + return str(self) + + def get_string(self, for_signature): + """This is a convenience function designed primarily to be + used in command generators (i.e., CommandGeneratorActions or + Environment variables that are callable), which are called + with a for_signature argument that is nonzero if the command + generator is being called to generate a signature for the + command line, which determines if we should rebuild or not. + + Such command generators should use this method in preference + to str(Node) when converting a Node to a string, passing + in the for_signature parameter, such that we will call + Node.for_signature() or str(Node) properly, depending on whether + we are calculating a signature or actually constructing a + command line.""" + if for_signature: + return self.for_signature() + return str(self) + + def get_subst_proxy(self): + """ + This method is expected to return an object that will function + exactly like this Node, except that it implements any additional + special features that we would like to be in effect for + Environment variable substitution. The principle use is that + some Nodes would like to implement a __getattr__() method, + but putting that in the Node type itself has a tendency to kill + performance. We instead put it in a proxy and return it from + this method. It is legal for this method to return self + if no new functionality is needed for Environment substitution. + """ + return self + + def explain(self): + if not self.exists(): + return "building `%s' because it doesn't exist\n" % self + + if self.always_build: + return "rebuilding `%s' because AlwaysBuild() is specified\n" % self + + old = self.get_stored_info() + if old is None: + return None + + old = old.binfo + old.prepare_dependencies() + + try: + old_bkids = old.bsources + old.bdepends + old.bimplicit + old_bkidsigs = old.bsourcesigs + old.bdependsigs + old.bimplicitsigs + except AttributeError: + return "Cannot explain why `%s' is being rebuilt: No previous build information found\n" % self + + new = self.get_binfo() + + new_bkids = new.bsources + new.bdepends + new.bimplicit + new_bkidsigs = new.bsourcesigs + new.bdependsigs + new.bimplicitsigs + + osig = dict(zip(old_bkids, old_bkidsigs)) + nsig = dict(zip(new_bkids, new_bkidsigs)) + + # The sources and dependencies we'll want to report are all stored + # as relative paths to this target's directory, but we want to + # report them relative to the top-level SConstruct directory, + # so we only print them after running them through this lambda + # to turn them into the right relative Node and then return + # its string. + def stringify( s, E=self.dir.Entry ) : + if hasattr( s, 'dir' ) : + return str(E(s)) + return str(s) + + lines = [] + + removed = [x for x in old_bkids if not x in new_bkids] + if removed: + removed = list(map(stringify, removed)) + fmt = "`%s' is no longer a dependency\n" + lines.extend([fmt % s for s in removed]) + + for k in new_bkids: + if not k in old_bkids: + lines.append("`%s' is a new dependency\n" % stringify(k)) + elif k.changed_since_last_build(self, osig[k]): + lines.append("`%s' changed\n" % stringify(k)) + + if len(lines) == 0 and old_bkids != new_bkids: + lines.append("the dependency order changed:\n" + + "%sold: %s\n" % (' '*15, list(map(stringify, old_bkids))) + + "%snew: %s\n" % (' '*15, list(map(stringify, new_bkids)))) + + if len(lines) == 0: + def fmt_with_title(title, strlines): + lines = strlines.split('\n') + sep = '\n' + ' '*(15 + len(title)) + return ' '*15 + title + sep.join(lines) + '\n' + if old.bactsig != new.bactsig: + if old.bact == new.bact: + lines.append("the contents of the build action changed\n" + + fmt_with_title('action: ', new.bact)) + else: + lines.append("the build action changed:\n" + + fmt_with_title('old: ', old.bact) + + fmt_with_title('new: ', new.bact)) + + if len(lines) == 0: + return "rebuilding `%s' for unknown reasons\n" % self + + preamble = "rebuilding `%s' because" % self + if len(lines) == 1: + return "%s %s" % (preamble, lines[0]) + else: + lines = ["%s:\n" % preamble] + lines + return ( ' '*11).join(lines) + +class NodeList(collections.UserList): + def __str__(self): + return str(list(map(str, self.data))) + +def get_children(node, parent): return node.children() +def ignore_cycle(node, stack): pass +def do_nothing(node, parent): pass + +class Walker(object): + """An iterator for walking a Node tree. + + This is depth-first, children are visited before the parent. + The Walker object can be initialized with any node, and + returns the next node on the descent with each get_next() call. + 'kids_func' is an optional function that will be called to + get the children of a node instead of calling 'children'. + 'cycle_func' is an optional function that will be called + when a cycle is detected. + + This class does not get caught in node cycles caused, for example, + by C header file include loops. + """ + def __init__(self, node, kids_func=get_children, + cycle_func=ignore_cycle, + eval_func=do_nothing): + self.kids_func = kids_func + self.cycle_func = cycle_func + self.eval_func = eval_func + node.wkids = copy.copy(kids_func(node, None)) + self.stack = [node] + self.history = {} # used to efficiently detect and avoid cycles + self.history[node] = None + + def get_next(self): + """Return the next node for this walk of the tree. + + This function is intentionally iterative, not recursive, + to sidestep any issues of stack size limitations. + """ + + while self.stack: + if self.stack[-1].wkids: + node = self.stack[-1].wkids.pop(0) + if not self.stack[-1].wkids: + self.stack[-1].wkids = None + if node in self.history: + self.cycle_func(node, self.stack) + else: + node.wkids = copy.copy(self.kids_func(node, self.stack[-1])) + self.stack.append(node) + self.history[node] = None + else: + node = self.stack.pop() + del self.history[node] + if node: + if self.stack: + parent = self.stack[-1] + else: + parent = None + self.eval_func(node, parent) + return node + return None + + def is_done(self): + return not self.stack + + +arg2nodes_lookups = [] + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Options/BoolOption.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Options/BoolOption.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Options/BoolOption.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Options/BoolOption.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,50 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Options/BoolOption.py 2013/03/03 09:48:35 garyo" + +__doc__ = """Place-holder for the old SCons.Options module hierarchy + +This is for backwards compatibility. The new equivalent is the Variables/ +class hierarchy. These will have deprecation warnings added (some day), +and will then be removed entirely (some day). +""" + +import SCons.Variables +import SCons.Warnings + +warned = False + +def BoolOption(*args, **kw): + global warned + if not warned: + msg = "The BoolOption() function is deprecated; use the BoolVariable() function instead." + SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) + warned = True + return SCons.Variables.BoolVariable(*args, **kw) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Options/EnumOption.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Options/EnumOption.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Options/EnumOption.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Options/EnumOption.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,50 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Options/EnumOption.py 2013/03/03 09:48:35 garyo" + +__doc__ = """Place-holder for the old SCons.Options module hierarchy + +This is for backwards compatibility. The new equivalent is the Variables/ +class hierarchy. These will have deprecation warnings added (some day), +and will then be removed entirely (some day). +""" + +import SCons.Variables +import SCons.Warnings + +warned = False + +def EnumOption(*args, **kw): + global warned + if not warned: + msg = "The EnumOption() function is deprecated; use the EnumVariable() function instead." + SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) + warned = True + return SCons.Variables.EnumVariable(*args, **kw) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Options/ListOption.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Options/ListOption.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Options/ListOption.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Options/ListOption.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,50 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Options/ListOption.py 2013/03/03 09:48:35 garyo" + +__doc__ = """Place-holder for the old SCons.Options module hierarchy + +This is for backwards compatibility. The new equivalent is the Variables/ +class hierarchy. These will have deprecation warnings added (some day), +and will then be removed entirely (some day). +""" + +import SCons.Variables +import SCons.Warnings + +warned = False + +def ListOption(*args, **kw): + global warned + if not warned: + msg = "The ListOption() function is deprecated; use the ListVariable() function instead." + SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) + warned = True + return SCons.Variables.ListVariable(*args, **kw) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Options/PackageOption.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Options/PackageOption.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Options/PackageOption.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Options/PackageOption.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,50 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Options/PackageOption.py 2013/03/03 09:48:35 garyo" + +__doc__ = """Place-holder for the old SCons.Options module hierarchy + +This is for backwards compatibility. The new equivalent is the Variables/ +class hierarchy. These will have deprecation warnings added (some day), +and will then be removed entirely (some day). +""" + +import SCons.Variables +import SCons.Warnings + +warned = False + +def PackageOption(*args, **kw): + global warned + if not warned: + msg = "The PackageOption() function is deprecated; use the PackageVariable() function instead." + SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) + warned = True + return SCons.Variables.PackageVariable(*args, **kw) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Options/PathOption.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Options/PathOption.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Options/PathOption.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Options/PathOption.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,76 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Options/PathOption.py 2013/03/03 09:48:35 garyo" + +__doc__ = """Place-holder for the old SCons.Options module hierarchy + +This is for backwards compatibility. The new equivalent is the Variables/ +class hierarchy. These will have deprecation warnings added (some day), +and will then be removed entirely (some day). +""" + +import SCons.Variables +import SCons.Warnings + +warned = False + +class _PathOptionClass(object): + def warn(self): + global warned + if not warned: + msg = "The PathOption() function is deprecated; use the PathVariable() function instead." + SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) + warned = True + + def __call__(self, *args, **kw): + self.warn() + return SCons.Variables.PathVariable(*args, **kw) + + def PathAccept(self, *args, **kw): + self.warn() + return SCons.Variables.PathVariable.PathAccept(*args, **kw) + + def PathIsDir(self, *args, **kw): + self.warn() + return SCons.Variables.PathVariable.PathIsDir(*args, **kw) + + def PathIsDirCreate(self, *args, **kw): + self.warn() + return SCons.Variables.PathVariable.PathIsDirCreate(*args, **kw) + + def PathIsFile(self, *args, **kw): + self.warn() + return SCons.Variables.PathVariable.PathIsFile(*args, **kw) + + def PathExists(self, *args, **kw): + self.warn() + return SCons.Variables.PathVariable.PathExists(*args, **kw) + +PathOption = _PathOptionClass() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Options/__init__.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Options/__init__.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Options/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Options/__init__.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,67 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Options/__init__.py 2013/03/03 09:48:35 garyo" + +__doc__ = """Place-holder for the old SCons.Options module hierarchy + +This is for backwards compatibility. The new equivalent is the Variables/ +class hierarchy. These will have deprecation warnings added (some day), +and will then be removed entirely (some day). +""" + +import SCons.Variables +import SCons.Warnings + +from BoolOption import BoolOption # okay +from EnumOption import EnumOption # okay +from ListOption import ListOption # naja +from PackageOption import PackageOption # naja +from PathOption import PathOption # okay + +warned = False + +class Options(SCons.Variables.Variables): + def __init__(self, *args, **kw): + global warned + if not warned: + msg = "The Options class is deprecated; use the Variables class instead." + SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) + warned = True + SCons.Variables.Variables.__init__(self, *args, **kw) + + def AddOptions(self, *args, **kw): + return SCons.Variables.Variables.AddVariables(self, *args, **kw) + + def UnknownOptions(self, *args, **kw): + return SCons.Variables.Variables.UnknownVariables(self, *args, **kw) + + def FormatOptionHelpText(self, *args, **kw): + return SCons.Variables.Variables.FormatVariableHelpText(self, *args, + **kw) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/PathList.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/PathList.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/PathList.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/PathList.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,233 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/PathList.py 2013/03/03 09:48:35 garyo" + +__doc__ = """SCons.PathList + +A module for handling lists of directory paths (the sort of things +that get set as CPPPATH, LIBPATH, etc.) with as much caching of data and +efficiency as we can while still keeping the evaluation delayed so that we +Do the Right Thing (almost) regardless of how the variable is specified. + +""" + +import os + +import SCons.Memoize +import SCons.Node +import SCons.Util + +# +# Variables to specify the different types of entries in a PathList object: +# + +TYPE_STRING_NO_SUBST = 0 # string with no '$' +TYPE_STRING_SUBST = 1 # string containing '$' +TYPE_OBJECT = 2 # other object + +def node_conv(obj): + """ + This is the "string conversion" routine that we have our substitutions + use to return Nodes, not strings. This relies on the fact that an + EntryProxy object has a get() method that returns the underlying + Node that it wraps, which is a bit of architectural dependence + that we might need to break or modify in the future in response to + additional requirements. + """ + try: + get = obj.get + except AttributeError: + if isinstance(obj, SCons.Node.Node) or SCons.Util.is_Sequence( obj ): + result = obj + else: + result = str(obj) + else: + result = get() + return result + +class _PathList(object): + """ + An actual PathList object. + """ + def __init__(self, pathlist): + """ + Initializes a PathList object, canonicalizing the input and + pre-processing it for quicker substitution later. + + The stored representation of the PathList is a list of tuples + containing (type, value), where the "type" is one of the TYPE_* + variables defined above. We distinguish between: + + strings that contain no '$' and therefore need no + delayed-evaluation string substitution (we expect that there + will be many of these and that we therefore get a pretty + big win from avoiding string substitution) + + strings that contain '$' and therefore need substitution + (the hard case is things like '${TARGET.dir}/include', + which require re-evaluation for every target + source) + + other objects (which may be something like an EntryProxy + that needs a method called to return a Node) + + Pre-identifying the type of each element in the PathList up-front + and storing the type in the list of tuples is intended to reduce + the amount of calculation when we actually do the substitution + over and over for each target. + """ + if SCons.Util.is_String(pathlist): + pathlist = pathlist.split(os.pathsep) + elif not SCons.Util.is_Sequence(pathlist): + pathlist = [pathlist] + + pl = [] + for p in pathlist: + try: + index = p.find('$') + except (AttributeError, TypeError): + type = TYPE_OBJECT + else: + if index == -1: + type = TYPE_STRING_NO_SUBST + else: + type = TYPE_STRING_SUBST + pl.append((type, p)) + + self.pathlist = tuple(pl) + + def __len__(self): return len(self.pathlist) + + def __getitem__(self, i): return self.pathlist[i] + + def subst_path(self, env, target, source): + """ + Performs construction variable substitution on a pre-digested + PathList for a specific target and source. + """ + result = [] + for type, value in self.pathlist: + if type == TYPE_STRING_SUBST: + value = env.subst(value, target=target, source=source, + conv=node_conv) + if SCons.Util.is_Sequence(value): + result.extend(SCons.Util.flatten(value)) + elif value: + result.append(value) + elif type == TYPE_OBJECT: + value = node_conv(value) + if value: + result.append(value) + elif value: + result.append(value) + return tuple(result) + + +class PathListCache(object): + """ + A class to handle caching of PathList lookups. + + This class gets instantiated once and then deleted from the namespace, + so it's used as a Singleton (although we don't enforce that in the + usual Pythonic ways). We could have just made the cache a dictionary + in the module namespace, but putting it in this class allows us to + use the same Memoizer pattern that we use elsewhere to count cache + hits and misses, which is very valuable. + + Lookup keys in the cache are computed by the _PathList_key() method. + Cache lookup should be quick, so we don't spend cycles canonicalizing + all forms of the same lookup key. For example, 'x:y' and ['x', + 'y'] logically represent the same list, but we don't bother to + split string representations and treat those two equivalently. + (Note, however, that we do, treat lists and tuples the same.) + + The main type of duplication we're trying to catch will come from + looking up the same path list from two different clones of the + same construction environment. That is, given + + env2 = env1.Clone() + + both env1 and env2 will have the same CPPPATH value, and we can + cheaply avoid re-parsing both values of CPPPATH by using the + common value from this cache. + """ + if SCons.Memoize.use_memoizer: + __metaclass__ = SCons.Memoize.Memoized_Metaclass + + memoizer_counters = [] + + def __init__(self): + self._memo = {} + + def _PathList_key(self, pathlist): + """ + Returns the key for memoization of PathLists. + + Note that we want this to be pretty quick, so we don't completely + canonicalize all forms of the same list. For example, + 'dir1:$ROOT/dir2' and ['$ROOT/dir1', 'dir'] may logically + represent the same list if you're executing from $ROOT, but + we're not going to bother splitting strings into path elements, + or massaging strings into Nodes, to identify that equivalence. + We just want to eliminate obvious redundancy from the normal + case of re-using exactly the same cloned value for a path. + """ + if SCons.Util.is_Sequence(pathlist): + pathlist = tuple(SCons.Util.flatten(pathlist)) + return pathlist + + memoizer_counters.append(SCons.Memoize.CountDict('PathList', _PathList_key)) + + def PathList(self, pathlist): + """ + Returns the cached _PathList object for the specified pathlist, + creating and caching a new object as necessary. + """ + pathlist = self._PathList_key(pathlist) + try: + memo_dict = self._memo['PathList'] + except KeyError: + memo_dict = {} + self._memo['PathList'] = memo_dict + else: + try: + return memo_dict[pathlist] + except KeyError: + pass + + result = _PathList(pathlist) + + memo_dict[pathlist] = result + + return result + +PathList = PathListCache().PathList + + +del PathListCache + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/__init__.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/__init__.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/__init__.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,241 @@ +"""SCons.Platform + +SCons platform selection. + +This looks for modules that define a callable object that can modify a +construction environment as appropriate for a given platform. + +Note that we take a more simplistic view of "platform" than Python does. +We're looking for a single string that determines a set of +tool-independent variables with which to initialize a construction +environment. Consequently, we'll examine both sys.platform and os.name +(and anything else that might come in to play) in order to return some +specification which is unique enough for our purposes. + +Note that because this subsysem just *selects* a callable that can +modify a construction environment, it's possible for people to define +their own "platform specification" in an arbitrary callable function. +No one needs to use or tie in to this subsystem in order to roll +their own platform definition. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Platform/__init__.py 2013/03/03 09:48:35 garyo" + +import SCons.compat + +import imp +import os +import sys +import tempfile + +import SCons.Errors +import SCons.Subst +import SCons.Tool + +def platform_default(): + """Return the platform string for our execution environment. + + The returned value should map to one of the SCons/Platform/*.py + files. Since we're architecture independent, though, we don't + care about the machine architecture. + """ + osname = os.name + if osname == 'java': + osname = os._osType + if osname == 'posix': + if sys.platform == 'cygwin': + return 'cygwin' + elif sys.platform.find('irix') != -1: + return 'irix' + elif sys.platform.find('sunos') != -1: + return 'sunos' + elif sys.platform.find('hp-ux') != -1: + return 'hpux' + elif sys.platform.find('aix') != -1: + return 'aix' + elif sys.platform.find('darwin') != -1: + return 'darwin' + else: + return 'posix' + elif os.name == 'os2': + return 'os2' + else: + return sys.platform + +def platform_module(name = platform_default()): + """Return the imported module for the platform. + + This looks for a module name that matches the specified argument. + If the name is unspecified, we fetch the appropriate default for + our execution environment. + """ + full_name = 'SCons.Platform.' + name + if full_name not in sys.modules: + if os.name == 'java': + eval(full_name) + else: + try: + file, path, desc = imp.find_module(name, + sys.modules['SCons.Platform'].__path__) + try: + mod = imp.load_module(full_name, file, path, desc) + finally: + if file: + file.close() + except ImportError: + try: + import zipimport + importer = zipimport.zipimporter( sys.modules['SCons.Platform'].__path__[0] ) + mod = importer.load_module(full_name) + except ImportError: + raise SCons.Errors.UserError("No platform named '%s'" % name) + setattr(SCons.Platform, name, mod) + return sys.modules[full_name] + +def DefaultToolList(platform, env): + """Select a default tool list for the specified platform. + """ + return SCons.Tool.tool_list(platform, env) + +class PlatformSpec(object): + def __init__(self, name, generate): + self.name = name + self.generate = generate + + def __call__(self, *args, **kw): + return self.generate(*args, **kw) + + def __str__(self): + return self.name + +class TempFileMunge(object): + """A callable class. You can set an Environment variable to this, + then call it with a string argument, then it will perform temporary + file substitution on it. This is used to circumvent the long command + line limitation. + + Example usage: + env["TEMPFILE"] = TempFileMunge + env["LINKCOM"] = "${TEMPFILE('$LINK $TARGET $SOURCES')}" + + By default, the name of the temporary file used begins with a + prefix of '@'. This may be configred for other tool chains by + setting '$TEMPFILEPREFIX'. + + env["TEMPFILEPREFIX"] = '-@' # diab compiler + env["TEMPFILEPREFIX"] = '-via' # arm tool chain + """ + def __init__(self, cmd): + self.cmd = cmd + + def __call__(self, target, source, env, for_signature): + if for_signature: + # If we're being called for signature calculation, it's + # because we're being called by the string expansion in + # Subst.py, which has the logic to strip any $( $) that + # may be in the command line we squirreled away. So we + # just return the raw command line and let the upper + # string substitution layers do their thing. + return self.cmd + + # Now we're actually being called because someone is actually + # going to try to execute the command, so we have to do our + # own expansion. + cmd = env.subst_list(self.cmd, SCons.Subst.SUBST_CMD, target, source)[0] + try: + maxline = int(env.subst('$MAXLINELENGTH')) + except ValueError: + maxline = 2048 + + length = 0 + for c in cmd: + length += len(c) + if length <= maxline: + return self.cmd + + # We do a normpath because mktemp() has what appears to be + # a bug in Windows that will use a forward slash as a path + # delimiter. Windows's link mistakes that for a command line + # switch and barfs. + # + # We use the .lnk suffix for the benefit of the Phar Lap + # linkloc linker, which likes to append an .lnk suffix if + # none is given. + (fd, tmp) = tempfile.mkstemp('.lnk', text=True) + native_tmp = SCons.Util.get_native_path(os.path.normpath(tmp)) + + if env['SHELL'] and env['SHELL'] == 'sh': + # The sh shell will try to escape the backslashes in the + # path, so unescape them. + native_tmp = native_tmp.replace('\\', r'\\\\') + # In Cygwin, we want to use rm to delete the temporary + # file, because del does not exist in the sh shell. + rm = env.Detect('rm') or 'del' + else: + # Don't use 'rm' if the shell is not sh, because rm won't + # work with the Windows shells (cmd.exe or command.com) or + # Windows path names. + rm = 'del' + + prefix = env.subst('$TEMPFILEPREFIX') + if not prefix: + prefix = '@' + + args = list(map(SCons.Subst.quote_spaces, cmd[1:])) + os.write(fd, " ".join(args) + "\n") + os.close(fd) + # XXX Using the SCons.Action.print_actions value directly + # like this is bogus, but expedient. This class should + # really be rewritten as an Action that defines the + # __call__() and strfunction() methods and lets the + # normal action-execution logic handle whether or not to + # print/execute the action. The problem, though, is all + # of that is decided before we execute this method as + # part of expanding the $TEMPFILE construction variable. + # Consequently, refactoring this will have to wait until + # we get more flexible with allowing Actions to exist + # independently and get strung together arbitrarily like + # Ant tasks. In the meantime, it's going to be more + # user-friendly to not let obsession with architectural + # purity get in the way of just being helpful, so we'll + # reach into SCons.Action directly. + if SCons.Action.print_actions: + print("Using tempfile "+native_tmp+" for command line:\n"+ + str(cmd[0]) + " " + " ".join(args)) + return [ cmd[0], prefix + native_tmp + '\n' + rm, native_tmp ] + +def Platform(name = platform_default()): + """Select a canned Platform specification. + """ + module = platform_module(name) + spec = PlatformSpec(name, module.generate) + return spec + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/aix.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/aix.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/aix.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/aix.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,69 @@ +"""engine.SCons.Platform.aix + +Platform-specific initialization for IBM AIX systems. + +There normally shouldn't be any need to import this module directly. It +will usually be imported through the generic SCons.Platform.Platform() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Platform/aix.py 2013/03/03 09:48:35 garyo" + +import os + +import posix + +def get_xlc(env, xlc=None, xlc_r=None, packages=[]): + # Use the AIX package installer tool lslpp to figure out where a + # given xl* compiler is installed and what version it is. + xlcPath = None + xlcVersion = None + + if xlc is None: + xlc = env.get('CC', 'xlc') + if xlc_r is None: + xlc_r = xlc + '_r' + for package in packages: + cmd = "lslpp -fc " + package + " 2>/dev/null | egrep '" + xlc + "([^-_a-zA-Z0-9].*)?$'" + line = os.popen(cmd).readline() + if line: + v, p = line.split(':')[1:3] + xlcVersion = v.split()[1] + xlcPath = p.split()[0] + xlcPath = xlcPath[:xlcPath.rindex('/')] + break + return (xlcPath, xlc, xlc_r, xlcVersion) + +def generate(env): + posix.generate(env) + #Based on AIX 5.2: ARG_MAX=24576 - 3000 for environment expansion + env['MAXLINELENGTH'] = 21576 + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/cygwin.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/cygwin.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/cygwin.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/cygwin.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,55 @@ +"""SCons.Platform.cygwin + +Platform-specific initialization for Cygwin systems. + +There normally shouldn't be any need to import this module directly. It +will usually be imported through the generic SCons.Platform.Platform() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Platform/cygwin.py 2013/03/03 09:48:35 garyo" + +import posix +from SCons.Platform import TempFileMunge + +def generate(env): + posix.generate(env) + + env['PROGPREFIX'] = '' + env['PROGSUFFIX'] = '.exe' + env['SHLIBPREFIX'] = '' + env['SHLIBSUFFIX'] = '.dll' + env['LIBPREFIXES'] = [ '$LIBPREFIX', '$SHLIBPREFIX' ] + env['LIBSUFFIXES'] = [ '$LIBSUFFIX', '$SHLIBSUFFIX' ] + env['TEMPFILE'] = TempFileMunge + env['TEMPFILEPREFIX'] = '@' + env['MAXLINELENGTH'] = 2048 + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/darwin.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/darwin.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/darwin.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/darwin.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,70 @@ +"""engine.SCons.Platform.darwin + +Platform-specific initialization for Mac OS X systems. + +There normally shouldn't be any need to import this module directly. It +will usually be imported through the generic SCons.Platform.Platform() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Platform/darwin.py 2013/03/03 09:48:35 garyo" + +import posix +import os + +def generate(env): + posix.generate(env) + env['SHLIBSUFFIX'] = '.dylib' + # put macports paths at front to override Apple's versions, fink path is after + # For now let people who want Macports or Fink tools specify it! + # env['ENV']['PATH'] = '/opt/local/bin:/opt/local/sbin:' + env['ENV']['PATH'] + ':/sw/bin' + + # Store extra system paths in env['ENV']['PATHOSX'] + + filelist = ['/etc/paths',] + # make sure this works on Macs with Tiger or earlier + try: + dirlist = os.listdir('/etc/paths.d') + except: + dirlist = [] + + for file in dirlist: + filelist.append('/etc/paths.d/'+file) + + for file in filelist: + if os.path.isfile(file): + f = open(file, 'r') + lines = f.readlines() + for line in lines: + if line: + env.AppendENVPath('PATHOSX', line.strip('\n')) + f.close() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/hpux.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/hpux.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/hpux.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/hpux.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,46 @@ +"""engine.SCons.Platform.hpux + +Platform-specific initialization for HP-UX systems. + +There normally shouldn't be any need to import this module directly. It +will usually be imported through the generic SCons.Platform.Platform() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Platform/hpux.py 2013/03/03 09:48:35 garyo" + +import posix + +def generate(env): + posix.generate(env) + #Based on HP-UX11i: ARG_MAX=2048000 - 3000 for environment expansion + env['MAXLINELENGTH'] = 2045000 + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/irix.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/irix.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/irix.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/irix.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,44 @@ +"""SCons.Platform.irix + +Platform-specific initialization for SGI IRIX systems. + +There normally shouldn't be any need to import this module directly. It +will usually be imported through the generic SCons.Platform.Platform() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Platform/irix.py 2013/03/03 09:48:35 garyo" + +import posix + +def generate(env): + posix.generate(env) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/os2.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/os2.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/os2.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/os2.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,58 @@ +"""SCons.Platform.os2 + +Platform-specific initialization for OS/2 systems. + +There normally shouldn't be any need to import this module directly. It +will usually be imported through the generic SCons.Platform.Platform() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Platform/os2.py 2013/03/03 09:48:35 garyo" +import win32 + +def generate(env): + if 'ENV' not in env: + env['ENV'] = {} + env['OBJPREFIX'] = '' + env['OBJSUFFIX'] = '.obj' + env['SHOBJPREFIX'] = '$OBJPREFIX' + env['SHOBJSUFFIX'] = '$OBJSUFFIX' + env['PROGPREFIX'] = '' + env['PROGSUFFIX'] = '.exe' + env['LIBPREFIX'] = '' + env['LIBSUFFIX'] = '.lib' + env['SHLIBPREFIX'] = '' + env['SHLIBSUFFIX'] = '.dll' + env['LIBPREFIXES'] = '$LIBPREFIX' + env['LIBSUFFIXES'] = [ '$LIBSUFFIX', '$SHLIBSUFFIX' ] + env['HOST_OS'] = 'os2' + env['HOST_ARCH'] = win32.get_architecture().arch + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/posix.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/posix.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/posix.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/posix.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,263 @@ +"""SCons.Platform.posix + +Platform-specific initialization for POSIX (Linux, UNIX, etc.) systems. + +There normally shouldn't be any need to import this module directly. It +will usually be imported through the generic SCons.Platform.Platform() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Platform/posix.py 2013/03/03 09:48:35 garyo" + +import errno +import os +import os.path +import subprocess +import sys +import select + +import SCons.Util +from SCons.Platform import TempFileMunge + +exitvalmap = { + 2 : 127, + 13 : 126, +} + +def escape(arg): + "escape shell special characters" + slash = '\\' + special = '"$()' + + arg = arg.replace(slash, slash+slash) + for c in special: + arg = arg.replace(c, slash+c) + + return '"' + arg + '"' + +def exec_system(l, env): + stat = os.system(' '.join(l)) + if stat & 0xff: + return stat | 0x80 + return stat >> 8 + +def exec_spawnvpe(l, env): + stat = os.spawnvpe(os.P_WAIT, l[0], l, env) + # os.spawnvpe() returns the actual exit code, not the encoding + # returned by os.waitpid() or os.system(). + return stat + +def exec_fork(l, env): + pid = os.fork() + if not pid: + # Child process. + exitval = 127 + try: + os.execvpe(l[0], l, env) + except OSError, e: + exitval = exitvalmap.get(e[0], e[0]) + sys.stderr.write("scons: %s: %s\n" % (l[0], e[1])) + os._exit(exitval) + else: + # Parent process. + pid, stat = os.waitpid(pid, 0) + if stat & 0xff: + return stat | 0x80 + return stat >> 8 + +def _get_env_command(sh, escape, cmd, args, env): + s = ' '.join(args) + if env: + l = ['env', '-'] + \ + [escape(t[0])+'='+escape(t[1]) for t in env.items()] + \ + [sh, '-c', escape(s)] + s = ' '.join(l) + return s + +def env_spawn(sh, escape, cmd, args, env): + return exec_system([_get_env_command( sh, escape, cmd, args, env)], env) + +def spawnvpe_spawn(sh, escape, cmd, args, env): + return exec_spawnvpe([sh, '-c', ' '.join(args)], env) + +def fork_spawn(sh, escape, cmd, args, env): + return exec_fork([sh, '-c', ' '.join(args)], env) + +def process_cmd_output(cmd_stdout, cmd_stderr, stdout, stderr): + stdout_eof = stderr_eof = 0 + while not (stdout_eof and stderr_eof): + try: + (i,o,e) = select.select([cmd_stdout, cmd_stderr], [], []) + if cmd_stdout in i: + str = cmd_stdout.read() + if len(str) == 0: + stdout_eof = 1 + elif stdout is not None: + stdout.write(str) + if cmd_stderr in i: + str = cmd_stderr.read() + if len(str) == 0: + #sys.__stderr__.write( "stderr_eof=1\n" ) + stderr_eof = 1 + else: + #sys.__stderr__.write( "str(stderr) = %s\n" % str ) + stderr.write(str) + except select.error, (_errno, _strerror): + if _errno != errno.EINTR: + raise + +def exec_popen3(l, env, stdout, stderr): + proc = subprocess.Popen(' '.join(l), + stdout=stdout, + stderr=stderr, + shell=True) + stat = proc.wait() + if stat & 0xff: + return stat | 0x80 + return stat >> 8 + +def exec_piped_fork(l, env, stdout, stderr): + # spawn using fork / exec and providing a pipe for the command's + # stdout / stderr stream + if stdout != stderr: + (rFdOut, wFdOut) = os.pipe() + (rFdErr, wFdErr) = os.pipe() + else: + (rFdOut, wFdOut) = os.pipe() + rFdErr = rFdOut + wFdErr = wFdOut + # do the fork + pid = os.fork() + if not pid: + # Child process + os.close( rFdOut ) + if rFdOut != rFdErr: + os.close( rFdErr ) + os.dup2( wFdOut, 1 ) # is there some symbolic way to do that ? + os.dup2( wFdErr, 2 ) + os.close( wFdOut ) + if stdout != stderr: + os.close( wFdErr ) + exitval = 127 + try: + os.execvpe(l[0], l, env) + except OSError, e: + exitval = exitvalmap.get(e[0], e[0]) + stderr.write("scons: %s: %s\n" % (l[0], e[1])) + os._exit(exitval) + else: + # Parent process + pid, stat = os.waitpid(pid, 0) + os.close( wFdOut ) + if stdout != stderr: + os.close( wFdErr ) + childOut = os.fdopen( rFdOut ) + if stdout != stderr: + childErr = os.fdopen( rFdErr ) + else: + childErr = childOut + process_cmd_output(childOut, childErr, stdout, stderr) + os.close( rFdOut ) + if stdout != stderr: + os.close( rFdErr ) + if stat & 0xff: + return stat | 0x80 + return stat >> 8 + +def piped_env_spawn(sh, escape, cmd, args, env, stdout, stderr): + # spawn using Popen3 combined with the env command + # the command name and the command's stdout is written to stdout + # the command's stderr is written to stderr + return exec_popen3([_get_env_command(sh, escape, cmd, args, env)], + env, stdout, stderr) + +def piped_fork_spawn(sh, escape, cmd, args, env, stdout, stderr): + # spawn using fork / exec and providing a pipe for the command's + # stdout / stderr stream + return exec_piped_fork([sh, '-c', ' '.join(args)], + env, stdout, stderr) + + + +def generate(env): + # If os.spawnvpe() exists, we use it to spawn commands. Otherwise + # if the env utility exists, we use os.system() to spawn commands, + # finally we fall back on os.fork()/os.exec(). + # + # os.spawnvpe() is prefered because it is the most efficient. But + # for Python versions without it, os.system() is prefered because it + # is claimed that it works better with threads (i.e. -j) and is more + # efficient than forking Python. + # + # NB: Other people on the scons-users mailing list have claimed that + # os.fork()/os.exec() works better than os.system(). There may just + # not be a default that works best for all users. + + if 'spawnvpe' in os.__dict__: + spawn = spawnvpe_spawn + elif env.Detect('env'): + spawn = env_spawn + else: + spawn = fork_spawn + + if env.Detect('env'): + pspawn = piped_env_spawn + else: + pspawn = piped_fork_spawn + + if 'ENV' not in env: + env['ENV'] = {} + env['ENV']['PATH'] = '/usr/local/bin:/opt/bin:/bin:/usr/bin' + env['OBJPREFIX'] = '' + env['OBJSUFFIX'] = '.o' + env['SHOBJPREFIX'] = '$OBJPREFIX' + env['SHOBJSUFFIX'] = '$OBJSUFFIX' + env['PROGPREFIX'] = '' + env['PROGSUFFIX'] = '' + env['LIBPREFIX'] = 'lib' + env['LIBSUFFIX'] = '.a' + env['SHLIBPREFIX'] = '$LIBPREFIX' + env['SHLIBSUFFIX'] = '.so' + env['LIBPREFIXES'] = [ '$LIBPREFIX' ] + env['LIBSUFFIXES'] = [ '$LIBSUFFIX', '$SHLIBSUFFIX' ] + env['PSPAWN'] = pspawn + env['SPAWN'] = spawn + env['SHELL'] = 'sh' + env['ESCAPE'] = escape + env['TEMPFILE'] = TempFileMunge + env['TEMPFILEPREFIX'] = '@' + #Based on LINUX: ARG_MAX=ARG_MAX=131072 - 3000 for environment expansion + #Note: specific platforms might rise or lower this value + env['MAXLINELENGTH'] = 128072 + + # This platform supports RPATH specifications. + env['__RPATH'] = '$_RPATH' + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/sunos.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/sunos.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/sunos.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/sunos.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,50 @@ +"""engine.SCons.Platform.sunos + +Platform-specific initialization for Sun systems. + +There normally shouldn't be any need to import this module directly. It +will usually be imported through the generic SCons.Platform.Platform() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Platform/sunos.py 2013/03/03 09:48:35 garyo" + +import posix + +def generate(env): + posix.generate(env) + # Based on sunSparc 8:32bit + # ARG_MAX=1048320 - 3000 for environment expansion + env['MAXLINELENGTH'] = 1045320 + env['PKGINFO'] = 'pkginfo' + env['PKGCHK'] = '/usr/sbin/pkgchk' + env['ENV']['PATH'] = env['ENV']['PATH'] + ':/opt/SUNWspro/bin:/usr/ccs/bin' + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/win32.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/win32.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Platform/win32.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Platform/win32.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,415 @@ +"""SCons.Platform.win32 + +Platform-specific initialization for Win32 systems. + +There normally shouldn't be any need to import this module directly. It +will usually be imported through the generic SCons.Platform.Platform() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Platform/win32.py 2013/03/03 09:48:35 garyo" + +import os +import os.path +import sys +import tempfile + +from SCons.Platform.posix import exitvalmap +from SCons.Platform import TempFileMunge +import SCons.Util + +try: + import msvcrt + import win32api + import win32con + + msvcrt.get_osfhandle + win32api.SetHandleInformation + win32con.HANDLE_FLAG_INHERIT +except ImportError: + parallel_msg = \ + "you do not seem to have the pywin32 extensions installed;\n" + \ + "\tparallel (-j) builds may not work reliably with open Python files." +except AttributeError: + parallel_msg = \ + "your pywin32 extensions do not support file handle operations;\n" + \ + "\tparallel (-j) builds may not work reliably with open Python files." +else: + parallel_msg = None + + import builtins + + _builtin_file = builtins.file + _builtin_open = builtins.open + + class _scons_file(_builtin_file): + def __init__(self, *args, **kw): + _builtin_file.__init__(self, *args, **kw) + win32api.SetHandleInformation(msvcrt.get_osfhandle(self.fileno()), + win32con.HANDLE_FLAG_INHERIT, 0) + + def _scons_open(*args, **kw): + fp = _builtin_open(*args, **kw) + win32api.SetHandleInformation(msvcrt.get_osfhandle(fp.fileno()), + win32con.HANDLE_FLAG_INHERIT, + 0) + return fp + + builtins.file = _scons_file + builtins.open = _scons_open + +try: + import threading + spawn_lock = threading.Lock() + + # This locked version of spawnve works around a Windows + # MSVCRT bug, because its spawnve is not thread-safe. + # Without this, python can randomly crash while using -jN. + # See the python bug at http://bugs.python.org/issue6476 + # and SCons issue at + # http://scons.tigris.org/issues/show_bug.cgi?id=2449 + def spawnve(mode, file, args, env): + spawn_lock.acquire() + try: + if mode == os.P_WAIT: + ret = os.spawnve(os.P_NOWAIT, file, args, env) + else: + ret = os.spawnve(mode, file, args, env) + finally: + spawn_lock.release() + if mode == os.P_WAIT: + pid, status = os.waitpid(ret, 0) + ret = status >> 8 + return ret +except ImportError: + # Use the unsafe method of spawnve. + # Please, don't try to optimize this try-except block + # away by assuming that the threading module is always present. + # In the test test/option-j.py we intentionally call SCons with + # a fake threading.py that raises an import exception right away, + # simulating a non-existent package. + def spawnve(mode, file, args, env): + return os.spawnve(mode, file, args, env) + +# The upshot of all this is that, if you are using Python 1.5.2, +# you had better have cmd or command.com in your PATH when you run +# scons. + +def piped_spawn(sh, escape, cmd, args, env, stdout, stderr): + # There is no direct way to do that in python. What we do + # here should work for most cases: + # In case stdout (stderr) is not redirected to a file, + # we redirect it into a temporary file tmpFileStdout + # (tmpFileStderr) and copy the contents of this file + # to stdout (stderr) given in the argument + if not sh: + sys.stderr.write("scons: Could not find command interpreter, is it in your PATH?\n") + return 127 + else: + # one temporary file for stdout and stderr + tmpFileStdout = os.path.normpath(tempfile.mktemp()) + tmpFileStderr = os.path.normpath(tempfile.mktemp()) + + # check if output is redirected + stdoutRedirected = 0 + stderrRedirected = 0 + for arg in args: + # are there more possibilities to redirect stdout ? + if (arg.find( ">", 0, 1 ) != -1 or + arg.find( "1>", 0, 2 ) != -1): + stdoutRedirected = 1 + # are there more possibilities to redirect stderr ? + if arg.find( "2>", 0, 2 ) != -1: + stderrRedirected = 1 + + # redirect output of non-redirected streams to our tempfiles + if stdoutRedirected == 0: + args.append(">" + str(tmpFileStdout)) + if stderrRedirected == 0: + args.append("2>" + str(tmpFileStderr)) + + # actually do the spawn + try: + args = [sh, '/C', escape(' '.join(args)) ] + ret = spawnve(os.P_WAIT, sh, args, env) + except OSError, e: + # catch any error + try: + ret = exitvalmap[e[0]] + except KeyError: + sys.stderr.write("scons: unknown OSError exception code %d - %s: %s\n" % (e[0], cmd, e[1])) + if stderr is not None: + stderr.write("scons: %s: %s\n" % (cmd, e[1])) + # copy child output from tempfiles to our streams + # and do clean up stuff + if stdout is not None and stdoutRedirected == 0: + try: + stdout.write(open( tmpFileStdout, "r" ).read()) + os.remove( tmpFileStdout ) + except (IOError, OSError): + pass + + if stderr is not None and stderrRedirected == 0: + try: + stderr.write(open( tmpFileStderr, "r" ).read()) + os.remove( tmpFileStderr ) + except (IOError, OSError): + pass + return ret + +def exec_spawn(l, env): + try: + result = spawnve(os.P_WAIT, l[0], l, env) + except OSError, e: + try: + result = exitvalmap[e[0]] + sys.stderr.write("scons: %s: %s\n" % (l[0], e[1])) + except KeyError: + result = 127 + if len(l) > 2: + if len(l[2]) < 1000: + command = ' '.join(l[0:3]) + else: + command = l[0] + else: + command = l[0] + sys.stderr.write("scons: unknown OSError exception code %d - '%s': %s\n" % (e[0], command, e[1])) + return result + +def spawn(sh, escape, cmd, args, env): + if not sh: + sys.stderr.write("scons: Could not find command interpreter, is it in your PATH?\n") + return 127 + return exec_spawn([sh, '/C', escape(' '.join(args))], env) + +# Windows does not allow special characters in file names anyway, so no +# need for a complex escape function, we will just quote the arg, except +# that "cmd /c" requires that if an argument ends with a backslash it +# needs to be escaped so as not to interfere with closing double quote +# that we add. +def escape(x): + if x[-1] == '\\': + x = x + '\\' + return '"' + x + '"' + +# Get the windows system directory name +_system_root = None + +def get_system_root(): + global _system_root + if _system_root is not None: + return _system_root + + # A resonable default if we can't read the registry + val = os.environ.get('SystemRoot', "C:\\WINDOWS") + + if SCons.Util.can_read_reg: + try: + # Look for Windows NT system root + k=SCons.Util.RegOpenKeyEx(SCons.Util.hkey_mod.HKEY_LOCAL_MACHINE, + 'Software\\Microsoft\\Windows NT\\CurrentVersion') + val, tok = SCons.Util.RegQueryValueEx(k, 'SystemRoot') + except SCons.Util.RegError: + try: + # Okay, try the Windows 9x system root + k=SCons.Util.RegOpenKeyEx(SCons.Util.hkey_mod.HKEY_LOCAL_MACHINE, + 'Software\\Microsoft\\Windows\\CurrentVersion') + val, tok = SCons.Util.RegQueryValueEx(k, 'SystemRoot') + except KeyboardInterrupt: + raise + except: + pass + _system_root = val + return val + +# Get the location of the program files directory +def get_program_files_dir(): + # Now see if we can look in the registry... + val = '' + if SCons.Util.can_read_reg: + try: + # Look for Windows Program Files directory + k=SCons.Util.RegOpenKeyEx(SCons.Util.hkey_mod.HKEY_LOCAL_MACHINE, + 'Software\\Microsoft\\Windows\\CurrentVersion') + val, tok = SCons.Util.RegQueryValueEx(k, 'ProgramFilesDir') + except SCons.Util.RegError: + val = '' + pass + + if val == '': + # A reasonable default if we can't read the registry + # (Actually, it's pretty reasonable even if we can :-) + val = os.path.join(os.path.dirname(get_system_root()),"Program Files") + + return val + + + +# Determine which windows CPU were running on. +class ArchDefinition(object): + """ + A class for defining architecture-specific settings and logic. + """ + def __init__(self, arch, synonyms=[]): + self.arch = arch + self.synonyms = synonyms + +SupportedArchitectureList = [ + ArchDefinition( + 'x86', + ['i386', 'i486', 'i586', 'i686'], + ), + + ArchDefinition( + 'x86_64', + ['AMD64', 'amd64', 'em64t', 'EM64T', 'x86_64'], + ), + + ArchDefinition( + 'ia64', + ['IA64'], + ), +] + +SupportedArchitectureMap = {} +for a in SupportedArchitectureList: + SupportedArchitectureMap[a.arch] = a + for s in a.synonyms: + SupportedArchitectureMap[s] = a + +def get_architecture(arch=None): + """Returns the definition for the specified architecture string. + + If no string is specified, the system default is returned (as defined + by the PROCESSOR_ARCHITEW6432 or PROCESSOR_ARCHITECTURE environment + variables). + """ + if arch is None: + arch = os.environ.get('PROCESSOR_ARCHITEW6432') + if not arch: + arch = os.environ.get('PROCESSOR_ARCHITECTURE') + return SupportedArchitectureMap.get(arch, ArchDefinition('', [''])) + +def generate(env): + # Attempt to find cmd.exe (for WinNT/2k/XP) or + # command.com for Win9x + cmd_interp = '' + # First see if we can look in the registry... + if SCons.Util.can_read_reg: + try: + # Look for Windows NT system root + k=SCons.Util.RegOpenKeyEx(SCons.Util.hkey_mod.HKEY_LOCAL_MACHINE, + 'Software\\Microsoft\\Windows NT\\CurrentVersion') + val, tok = SCons.Util.RegQueryValueEx(k, 'SystemRoot') + cmd_interp = os.path.join(val, 'System32\\cmd.exe') + except SCons.Util.RegError: + try: + # Okay, try the Windows 9x system root + k=SCons.Util.RegOpenKeyEx(SCons.Util.hkey_mod.HKEY_LOCAL_MACHINE, + 'Software\\Microsoft\\Windows\\CurrentVersion') + val, tok = SCons.Util.RegQueryValueEx(k, 'SystemRoot') + cmd_interp = os.path.join(val, 'command.com') + except KeyboardInterrupt: + raise + except: + pass + + # For the special case of not having access to the registry, we + # use a temporary path and pathext to attempt to find the command + # interpreter. If we fail, we try to find the interpreter through + # the env's PATH. The problem with that is that it might not + # contain an ENV and a PATH. + if not cmd_interp: + systemroot = get_system_root() + tmp_path = systemroot + os.pathsep + \ + os.path.join(systemroot,'System32') + tmp_pathext = '.com;.exe;.bat;.cmd' + if 'PATHEXT' in os.environ: + tmp_pathext = os.environ['PATHEXT'] + cmd_interp = SCons.Util.WhereIs('cmd', tmp_path, tmp_pathext) + if not cmd_interp: + cmd_interp = SCons.Util.WhereIs('command', tmp_path, tmp_pathext) + + if not cmd_interp: + cmd_interp = env.Detect('cmd') + if not cmd_interp: + cmd_interp = env.Detect('command') + + + if 'ENV' not in env: + env['ENV'] = {} + + # Import things from the external environment to the construction + # environment's ENV. This is a potential slippery slope, because we + # *don't* want to make builds dependent on the user's environment by + # default. We're doing this for SystemRoot, though, because it's + # needed for anything that uses sockets, and seldom changes, and + # for SystemDrive because it's related. + # + # Weigh the impact carefully before adding other variables to this list. + import_env = [ 'SystemDrive', 'SystemRoot', 'TEMP', 'TMP' ] + for var in import_env: + v = os.environ.get(var) + if v: + env['ENV'][var] = v + + if 'COMSPEC' not in env['ENV']: + v = os.environ.get("COMSPEC") + if v: + env['ENV']['COMSPEC'] = v + + env.AppendENVPath('PATH', get_system_root() + '\System32') + + env['ENV']['PATHEXT'] = '.COM;.EXE;.BAT;.CMD' + env['OBJPREFIX'] = '' + env['OBJSUFFIX'] = '.obj' + env['SHOBJPREFIX'] = '$OBJPREFIX' + env['SHOBJSUFFIX'] = '$OBJSUFFIX' + env['PROGPREFIX'] = '' + env['PROGSUFFIX'] = '.exe' + env['LIBPREFIX'] = '' + env['LIBSUFFIX'] = '.lib' + env['SHLIBPREFIX'] = '' + env['SHLIBSUFFIX'] = '.dll' + env['LIBPREFIXES'] = [ '$LIBPREFIX' ] + env['LIBSUFFIXES'] = [ '$LIBSUFFIX' ] + env['PSPAWN'] = piped_spawn + env['SPAWN'] = spawn + env['SHELL'] = cmd_interp + env['TEMPFILE'] = TempFileMunge + env['TEMPFILEPREFIX'] = '@' + env['MAXLINELENGTH'] = 2048 + env['ESCAPE'] = escape + + env['HOST_OS'] = 'win32' + env['HOST_ARCH'] = get_architecture().arch + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/SConf.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/SConf.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/SConf.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/SConf.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,1030 @@ +"""SCons.SConf + +Autoconf-like configuration support. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/SConf.py 2013/03/03 09:48:35 garyo" + +import SCons.compat + +import io +import os +import re +import sys +import traceback + +import SCons.Action +import SCons.Builder +import SCons.Errors +import SCons.Job +import SCons.Node.FS +import SCons.Taskmaster +import SCons.Util +import SCons.Warnings +import SCons.Conftest + +from SCons.Debug import Trace + +# Turn off the Conftest error logging +SCons.Conftest.LogInputFiles = 0 +SCons.Conftest.LogErrorMessages = 0 + +# Set +build_type = None +build_types = ['clean', 'help'] + +def SetBuildType(type): + global build_type + build_type = type + +# to be set, if we are in dry-run mode +dryrun = 0 + +AUTO=0 # use SCons dependency scanning for up-to-date checks +FORCE=1 # force all tests to be rebuilt +CACHE=2 # force all tests to be taken from cache (raise an error, if necessary) +cache_mode = AUTO + +def SetCacheMode(mode): + """Set the Configure cache mode. mode must be one of "auto", "force", + or "cache".""" + global cache_mode + if mode == "auto": + cache_mode = AUTO + elif mode == "force": + cache_mode = FORCE + elif mode == "cache": + cache_mode = CACHE + else: + raise ValueError("SCons.SConf.SetCacheMode: Unknown mode " + mode) + +progress_display = SCons.Util.display # will be overwritten by SCons.Script +def SetProgressDisplay(display): + """Set the progress display to use (called from SCons.Script)""" + global progress_display + progress_display = display + +SConfFS = None + +_ac_build_counter = 0 # incremented, whenever TryBuild is called +_ac_config_logs = {} # all config.log files created in this build +_ac_config_hs = {} # all config.h files created in this build +sconf_global = None # current sconf object + +def _createConfigH(target, source, env): + t = open(str(target[0]), "w") + defname = re.sub('[^A-Za-z0-9_]', '_', str(target[0]).upper()) + t.write("""#ifndef %(DEFNAME)s_SEEN +#define %(DEFNAME)s_SEEN + +""" % {'DEFNAME' : defname}) + t.write(source[0].get_contents()) + t.write(""" +#endif /* %(DEFNAME)s_SEEN */ +""" % {'DEFNAME' : defname}) + t.close() + +def _stringConfigH(target, source, env): + return "scons: Configure: creating " + str(target[0]) + +def CreateConfigHBuilder(env): + """Called just before the building targets phase begins.""" + if len(_ac_config_hs) == 0: + return + action = SCons.Action.Action(_createConfigH, + _stringConfigH) + sconfigHBld = SCons.Builder.Builder(action=action) + env.Append( BUILDERS={'SConfigHBuilder':sconfigHBld} ) + for k in _ac_config_hs.keys(): + env.SConfigHBuilder(k, env.Value(_ac_config_hs[k])) + +class SConfWarning(SCons.Warnings.Warning): + pass +SCons.Warnings.enableWarningClass(SConfWarning) + +# some error definitions +class SConfError(SCons.Errors.UserError): + def __init__(self,msg): + SCons.Errors.UserError.__init__(self,msg) + +class ConfigureDryRunError(SConfError): + """Raised when a file or directory needs to be updated during a Configure + process, but the user requested a dry-run""" + def __init__(self,target): + if not isinstance(target, SCons.Node.FS.File): + msg = 'Cannot create configure directory "%s" within a dry-run.' % str(target) + else: + msg = 'Cannot update configure test "%s" within a dry-run.' % str(target) + SConfError.__init__(self,msg) + +class ConfigureCacheError(SConfError): + """Raised when a use explicitely requested the cache feature, but the test + is run the first time.""" + def __init__(self,target): + SConfError.__init__(self, '"%s" is not yet built and cache is forced.' % str(target)) + +# define actions for building text files +def _createSource( target, source, env ): + fd = open(str(target[0]), "w") + fd.write(source[0].get_contents()) + fd.close() +def _stringSource( target, source, env ): + return (str(target[0]) + ' <-\n |' + + source[0].get_contents().replace( '\n', "\n |" ) ) + +class SConfBuildInfo(SCons.Node.FS.FileBuildInfo): + """ + Special build info for targets of configure tests. Additional members + are result (did the builder succeed last time?) and string, which + contains messages of the original build phase. + """ + result = None # -> 0/None -> no error, != 0 error + string = None # the stdout / stderr output when building the target + + def set_build_result(self, result, string): + self.result = result + self.string = string + + +class Streamer(object): + """ + 'Sniffer' for a file-like writable object. Similar to the unix tool tee. + """ + def __init__(self, orig): + self.orig = orig + self.s = io.StringIO() + + def write(self, str): + if self.orig: + self.orig.write(str) + self.s.write(str) + + def writelines(self, lines): + for l in lines: + self.write(l + '\n') + + def getvalue(self): + """ + Return everything written to orig since the Streamer was created. + """ + return self.s.getvalue() + + def flush(self): + if self.orig: + self.orig.flush() + self.s.flush() + + +class SConfBuildTask(SCons.Taskmaster.AlwaysTask): + """ + This is almost the same as SCons.Script.BuildTask. Handles SConfErrors + correctly and knows about the current cache_mode. + """ + def display(self, message): + if sconf_global.logstream: + sconf_global.logstream.write("scons: Configure: " + message + "\n") + + def display_cached_string(self, bi): + """ + Logs the original builder messages, given the SConfBuildInfo instance + bi. + """ + if not isinstance(bi, SConfBuildInfo): + SCons.Warnings.warn(SConfWarning, + "The stored build information has an unexpected class: %s" % bi.__class__) + else: + self.display("The original builder output was:\n" + + (" |" + str(bi.string)).replace("\n", "\n |")) + + def failed(self): + # check, if the reason was a ConfigureDryRunError or a + # ConfigureCacheError and if yes, reraise the exception + exc_type = self.exc_info()[0] + if issubclass(exc_type, SConfError): + raise + elif issubclass(exc_type, SCons.Errors.BuildError): + # we ignore Build Errors (occurs, when a test doesn't pass) + # Clear the exception to prevent the contained traceback + # to build a reference cycle. + self.exc_clear() + else: + self.display('Caught exception while building "%s":\n' % + self.targets[0]) + try: + excepthook = sys.excepthook + except AttributeError: + # Earlier versions of Python don't have sys.excepthook... + def excepthook(type, value, tb): + traceback.print_tb(tb) + print type, value + excepthook(*self.exc_info()) + return SCons.Taskmaster.Task.failed(self) + + def collect_node_states(self): + # returns (is_up_to_date, cached_error, cachable) + # where is_up_to_date is 1, if the node(s) are up_to_date + # cached_error is 1, if the node(s) are up_to_date, but the + # build will fail + # cachable is 0, if some nodes are not in our cache + T = 0 + changed = False + cached_error = False + cachable = True + for t in self.targets: + if T: Trace('%s' % (t)) + bi = t.get_stored_info().binfo + if isinstance(bi, SConfBuildInfo): + if T: Trace(': SConfBuildInfo') + if cache_mode == CACHE: + t.set_state(SCons.Node.up_to_date) + if T: Trace(': set_state(up_to-date)') + else: + if T: Trace(': get_state() %s' % t.get_state()) + if T: Trace(': changed() %s' % t.changed()) + if (t.get_state() != SCons.Node.up_to_date and t.changed()): + changed = True + if T: Trace(': changed %s' % changed) + cached_error = cached_error or bi.result + else: + if T: Trace(': else') + # the node hasn't been built in a SConf context or doesn't + # exist + cachable = False + changed = ( t.get_state() != SCons.Node.up_to_date ) + if T: Trace(': changed %s' % changed) + if T: Trace('\n') + return (not changed, cached_error, cachable) + + def execute(self): + if not self.targets[0].has_builder(): + return + + sconf = sconf_global + + is_up_to_date, cached_error, cachable = self.collect_node_states() + + if cache_mode == CACHE and not cachable: + raise ConfigureCacheError(self.targets[0]) + elif cache_mode == FORCE: + is_up_to_date = 0 + + if cached_error and is_up_to_date: + self.display("Building \"%s\" failed in a previous run and all " + "its sources are up to date." % str(self.targets[0])) + binfo = self.targets[0].get_stored_info().binfo + self.display_cached_string(binfo) + raise SCons.Errors.BuildError # will be 'caught' in self.failed + elif is_up_to_date: + self.display("\"%s\" is up to date." % str(self.targets[0])) + binfo = self.targets[0].get_stored_info().binfo + self.display_cached_string(binfo) + elif dryrun: + raise ConfigureDryRunError(self.targets[0]) + else: + # note stdout and stderr are the same here + s = sys.stdout = sys.stderr = Streamer(sys.stdout) + try: + env = self.targets[0].get_build_env() + if cache_mode == FORCE: + # Set up the Decider() to force rebuilds by saying + # that every source has changed. Note that we still + # call the environment's underlying source decider so + # that the correct .sconsign info will get calculated + # and keep the build state consistent. + def force_build(dependency, target, prev_ni, + env_decider=env.decide_source): + env_decider(dependency, target, prev_ni) + return True + if env.decide_source.func_code is not force_build.func_code: + env.Decider(force_build) + env['PSTDOUT'] = env['PSTDERR'] = s + try: + sconf.cached = 0 + self.targets[0].build() + finally: + sys.stdout = sys.stderr = env['PSTDOUT'] = \ + env['PSTDERR'] = sconf.logstream + except KeyboardInterrupt: + raise + except SystemExit: + exc_value = sys.exc_info()[1] + raise SCons.Errors.ExplicitExit(self.targets[0],exc_value.code) + except Exception, e: + for t in self.targets: + binfo = t.get_binfo() + binfo.__class__ = SConfBuildInfo + binfo.set_build_result(1, s.getvalue()) + sconsign_entry = SCons.SConsign.SConsignEntry() + sconsign_entry.binfo = binfo + #sconsign_entry.ninfo = self.get_ninfo() + # We'd like to do this as follows: + # t.store_info(binfo) + # However, we need to store it as an SConfBuildInfo + # object, and store_info() will turn it into a + # regular FileNodeInfo if the target is itself a + # regular File. + sconsign = t.dir.sconsign() + sconsign.set_entry(t.name, sconsign_entry) + sconsign.merge() + raise e + else: + for t in self.targets: + binfo = t.get_binfo() + binfo.__class__ = SConfBuildInfo + binfo.set_build_result(0, s.getvalue()) + sconsign_entry = SCons.SConsign.SConsignEntry() + sconsign_entry.binfo = binfo + #sconsign_entry.ninfo = self.get_ninfo() + # We'd like to do this as follows: + # t.store_info(binfo) + # However, we need to store it as an SConfBuildInfo + # object, and store_info() will turn it into a + # regular FileNodeInfo if the target is itself a + # regular File. + sconsign = t.dir.sconsign() + sconsign.set_entry(t.name, sconsign_entry) + sconsign.merge() + +class SConfBase(object): + """This is simply a class to represent a configure context. After + creating a SConf object, you can call any tests. After finished with your + tests, be sure to call the Finish() method, which returns the modified + environment. + Some words about caching: In most cases, it is not necessary to cache + Test results explicitely. Instead, we use the scons dependency checking + mechanism. For example, if one wants to compile a test program + (SConf.TryLink), the compiler is only called, if the program dependencies + have changed. However, if the program could not be compiled in a former + SConf run, we need to explicitely cache this error. + """ + + def __init__(self, env, custom_tests = {}, conf_dir='$CONFIGUREDIR', + log_file='$CONFIGURELOG', config_h = None, _depth = 0): + """Constructor. Pass additional tests in the custom_tests-dictinary, + e.g. custom_tests={'CheckPrivate':MyPrivateTest}, where MyPrivateTest + defines a custom test. + Note also the conf_dir and log_file arguments (you may want to + build tests in the VariantDir, not in the SourceDir) + """ + global SConfFS + if not SConfFS: + SConfFS = SCons.Node.FS.default_fs or \ + SCons.Node.FS.FS(env.fs.pathTop) + if sconf_global is not None: + raise SCons.Errors.UserError + self.env = env + if log_file is not None: + log_file = SConfFS.File(env.subst(log_file)) + self.logfile = log_file + self.logstream = None + self.lastTarget = None + self.depth = _depth + self.cached = 0 # will be set, if all test results are cached + + # add default tests + default_tests = { + 'CheckCC' : CheckCC, + 'CheckCXX' : CheckCXX, + 'CheckSHCC' : CheckSHCC, + 'CheckSHCXX' : CheckSHCXX, + 'CheckFunc' : CheckFunc, + 'CheckType' : CheckType, + 'CheckTypeSize' : CheckTypeSize, + 'CheckDeclaration' : CheckDeclaration, + 'CheckHeader' : CheckHeader, + 'CheckCHeader' : CheckCHeader, + 'CheckCXXHeader' : CheckCXXHeader, + 'CheckLib' : CheckLib, + 'CheckLibWithHeader' : CheckLibWithHeader, + } + self.AddTests(default_tests) + self.AddTests(custom_tests) + self.confdir = SConfFS.Dir(env.subst(conf_dir)) + if config_h is not None: + config_h = SConfFS.File(config_h) + self.config_h = config_h + self._startup() + + def Finish(self): + """Call this method after finished with your tests: + env = sconf.Finish() + """ + self._shutdown() + return self.env + + def Define(self, name, value = None, comment = None): + """ + Define a pre processor symbol name, with the optional given value in the + current config header. + + If value is None (default), then #define name is written. If value is not + none, then #define name value is written. + + comment is a string which will be put as a C comment in the + header, to explain the meaning of the value (appropriate C comments /* and + */ will be put automatically.""" + lines = [] + if comment: + comment_str = "/* %s */" % comment + lines.append(comment_str) + + if value is not None: + define_str = "#define %s %s" % (name, value) + else: + define_str = "#define %s" % name + lines.append(define_str) + lines.append('') + + self.config_h_text = self.config_h_text + '\n'.join(lines) + + def BuildNodes(self, nodes): + """ + Tries to build the given nodes immediately. Returns 1 on success, + 0 on error. + """ + if self.logstream is not None: + # override stdout / stderr to write in log file + oldStdout = sys.stdout + sys.stdout = self.logstream + oldStderr = sys.stderr + sys.stderr = self.logstream + + # the engine assumes the current path is the SConstruct directory ... + old_fs_dir = SConfFS.getcwd() + old_os_dir = os.getcwd() + SConfFS.chdir(SConfFS.Top, change_os_dir=1) + + # Because we take responsibility here for writing out our + # own .sconsign info (see SConfBuildTask.execute(), above), + # we override the store_info() method with a null place-holder + # so we really control how it gets written. + for n in nodes: + n.store_info = n.do_not_store_info + + ret = 1 + + try: + # ToDo: use user options for calc + save_max_drift = SConfFS.get_max_drift() + SConfFS.set_max_drift(0) + tm = SCons.Taskmaster.Taskmaster(nodes, SConfBuildTask) + # we don't want to build tests in parallel + jobs = SCons.Job.Jobs(1, tm ) + jobs.run() + for n in nodes: + state = n.get_state() + if (state != SCons.Node.executed and + state != SCons.Node.up_to_date): + # the node could not be built. we return 0 in this case + ret = 0 + finally: + SConfFS.set_max_drift(save_max_drift) + os.chdir(old_os_dir) + SConfFS.chdir(old_fs_dir, change_os_dir=0) + if self.logstream is not None: + # restore stdout / stderr + sys.stdout = oldStdout + sys.stderr = oldStderr + return ret + + def pspawn_wrapper(self, sh, escape, cmd, args, env): + """Wrapper function for handling piped spawns. + + This looks to the calling interface (in Action.py) like a "normal" + spawn, but associates the call with the PSPAWN variable from + the construction environment and with the streams to which we + want the output logged. This gets slid into the construction + environment as the SPAWN variable so Action.py doesn't have to + know or care whether it's spawning a piped command or not. + """ + return self.pspawn(sh, escape, cmd, args, env, self.logstream, self.logstream) + + + def TryBuild(self, builder, text = None, extension = ""): + """Low level TryBuild implementation. Normally you don't need to + call that - you can use TryCompile / TryLink / TryRun instead + """ + global _ac_build_counter + + # Make sure we have a PSPAWN value, and save the current + # SPAWN value. + try: + self.pspawn = self.env['PSPAWN'] + except KeyError: + raise SCons.Errors.UserError('Missing PSPAWN construction variable.') + try: + save_spawn = self.env['SPAWN'] + except KeyError: + raise SCons.Errors.UserError('Missing SPAWN construction variable.') + + nodesToBeBuilt = [] + + f = "conftest_" + str(_ac_build_counter) + pref = self.env.subst( builder.builder.prefix ) + suff = self.env.subst( builder.builder.suffix ) + target = self.confdir.File(pref + f + suff) + + try: + # Slide our wrapper into the construction environment as + # the SPAWN function. + self.env['SPAWN'] = self.pspawn_wrapper + sourcetext = self.env.Value(text) + + if text is not None: + textFile = self.confdir.File(f + extension) + textFileNode = self.env.SConfSourceBuilder(target=textFile, + source=sourcetext) + nodesToBeBuilt.extend(textFileNode) + source = textFileNode + else: + source = None + + nodes = builder(target = target, source = source) + if not SCons.Util.is_List(nodes): + nodes = [nodes] + nodesToBeBuilt.extend(nodes) + result = self.BuildNodes(nodesToBeBuilt) + + finally: + self.env['SPAWN'] = save_spawn + + _ac_build_counter = _ac_build_counter + 1 + if result: + self.lastTarget = nodes[0] + else: + self.lastTarget = None + + return result + + def TryAction(self, action, text = None, extension = ""): + """Tries to execute the given action with optional source file + contents and optional source file extension , + Returns the status (0 : failed, 1 : ok) and the contents of the + output file. + """ + builder = SCons.Builder.Builder(action=action) + self.env.Append( BUILDERS = {'SConfActionBuilder' : builder} ) + ok = self.TryBuild(self.env.SConfActionBuilder, text, extension) + del self.env['BUILDERS']['SConfActionBuilder'] + if ok: + outputStr = self.lastTarget.get_contents() + return (1, outputStr) + return (0, "") + + def TryCompile( self, text, extension): + """Compiles the program given in text to an env.Object, using extension + as file extension (e.g. '.c'). Returns 1, if compilation was + successful, 0 otherwise. The target is saved in self.lastTarget (for + further processing). + """ + return self.TryBuild(self.env.Object, text, extension) + + def TryLink( self, text, extension ): + """Compiles the program given in text to an executable env.Program, + using extension as file extension (e.g. '.c'). Returns 1, if + compilation was successful, 0 otherwise. The target is saved in + self.lastTarget (for further processing). + """ + return self.TryBuild(self.env.Program, text, extension ) + + def TryRun(self, text, extension ): + """Compiles and runs the program given in text, using extension + as file extension (e.g. '.c'). Returns (1, outputStr) on success, + (0, '') otherwise. The target (a file containing the program's stdout) + is saved in self.lastTarget (for further processing). + """ + ok = self.TryLink(text, extension) + if( ok ): + prog = self.lastTarget + pname = prog.path + output = self.confdir.File(os.path.basename(pname)+'.out') + node = self.env.Command(output, prog, [ [ pname, ">", "${TARGET}"] ]) + ok = self.BuildNodes(node) + if ok: + outputStr = output.get_contents() + return( 1, outputStr) + return (0, "") + + class TestWrapper(object): + """A wrapper around Tests (to ensure sanity)""" + def __init__(self, test, sconf): + self.test = test + self.sconf = sconf + def __call__(self, *args, **kw): + if not self.sconf.active: + raise SCons.Errors.UserError + context = CheckContext(self.sconf) + ret = self.test(context, *args, **kw) + if self.sconf.config_h is not None: + self.sconf.config_h_text = self.sconf.config_h_text + context.config_h + context.Result("error: no result") + return ret + + def AddTest(self, test_name, test_instance): + """Adds test_class to this SConf instance. It can be called with + self.test_name(...)""" + setattr(self, test_name, SConfBase.TestWrapper(test_instance, self)) + + def AddTests(self, tests): + """Adds all the tests given in the tests dictionary to this SConf + instance + """ + for name in tests.keys(): + self.AddTest(name, tests[name]) + + def _createDir( self, node ): + dirName = str(node) + if dryrun: + if not os.path.isdir( dirName ): + raise ConfigureDryRunError(dirName) + else: + if not os.path.isdir( dirName ): + os.makedirs( dirName ) + node._exists = 1 + + def _startup(self): + """Private method. Set up logstream, and set the environment + variables necessary for a piped build + """ + global _ac_config_logs + global sconf_global + global SConfFS + + self.lastEnvFs = self.env.fs + self.env.fs = SConfFS + self._createDir(self.confdir) + self.confdir.up().add_ignore( [self.confdir] ) + + if self.logfile is not None and not dryrun: + # truncate logfile, if SConf.Configure is called for the first time + # in a build + if self.logfile in _ac_config_logs: + log_mode = "a" + else: + _ac_config_logs[self.logfile] = None + log_mode = "w" + fp = open(str(self.logfile), log_mode) + self.logstream = SCons.Util.Unbuffered(fp) + # logfile may stay in a build directory, so we tell + # the build system not to override it with a eventually + # existing file with the same name in the source directory + self.logfile.dir.add_ignore( [self.logfile] ) + + tb = traceback.extract_stack()[-3-self.depth] + old_fs_dir = SConfFS.getcwd() + SConfFS.chdir(SConfFS.Top, change_os_dir=0) + self.logstream.write('file %s,line %d:\n\tConfigure(confdir = %s)\n' % + (tb[0], tb[1], str(self.confdir)) ) + SConfFS.chdir(old_fs_dir) + else: + self.logstream = None + # we use a special builder to create source files from TEXT + action = SCons.Action.Action(_createSource, + _stringSource) + sconfSrcBld = SCons.Builder.Builder(action=action) + self.env.Append( BUILDERS={'SConfSourceBuilder':sconfSrcBld} ) + self.config_h_text = _ac_config_hs.get(self.config_h, "") + self.active = 1 + # only one SConf instance should be active at a time ... + sconf_global = self + + def _shutdown(self): + """Private method. Reset to non-piped spawn""" + global sconf_global, _ac_config_hs + + if not self.active: + raise SCons.Errors.UserError("Finish may be called only once!") + if self.logstream is not None and not dryrun: + self.logstream.write("\n") + self.logstream.close() + self.logstream = None + # remove the SConfSourceBuilder from the environment + blds = self.env['BUILDERS'] + del blds['SConfSourceBuilder'] + self.env.Replace( BUILDERS=blds ) + self.active = 0 + sconf_global = None + if not self.config_h is None: + _ac_config_hs[self.config_h] = self.config_h_text + self.env.fs = self.lastEnvFs + +class CheckContext(object): + """Provides a context for configure tests. Defines how a test writes to the + screen and log file. + + A typical test is just a callable with an instance of CheckContext as + first argument: + + def CheckCustom(context, ...) + context.Message('Checking my weird test ... ') + ret = myWeirdTestFunction(...) + context.Result(ret) + + Often, myWeirdTestFunction will be one of + context.TryCompile/context.TryLink/context.TryRun. The results of + those are cached, for they are only rebuild, if the dependencies have + changed. + """ + + def __init__(self, sconf): + """Constructor. Pass the corresponding SConf instance.""" + self.sconf = sconf + self.did_show_result = 0 + + # for Conftest.py: + self.vardict = {} + self.havedict = {} + self.headerfilename = None + self.config_h = "" # config_h text will be stored here + # we don't regenerate the config.h file after each test. That means, + # that tests won't be able to include the config.h file, and so + # they can't do an #ifdef HAVE_XXX_H. This shouldn't be a major + # issue, though. If it turns out, that we need to include config.h + # in tests, we must ensure, that the dependencies are worked out + # correctly. Note that we can't use Conftest.py's support for config.h, + # cause we will need to specify a builder for the config.h file ... + + def Message(self, text): + """Inform about what we are doing right now, e.g. + 'Checking for SOMETHING ... ' + """ + self.Display(text) + self.sconf.cached = 1 + self.did_show_result = 0 + + def Result(self, res): + """Inform about the result of the test. res may be an integer or a + string. In case of an integer, the written text will be 'yes' or 'no'. + The result is only displayed when self.did_show_result is not set. + """ + if isinstance(res, (int, bool)): + if res: + text = "yes" + else: + text = "no" + elif isinstance(res, str): + text = res + else: + raise TypeError("Expected string, int or bool, got " + str(type(res))) + + if self.did_show_result == 0: + # Didn't show result yet, do it now. + self.Display(text + "\n") + self.did_show_result = 1 + + def TryBuild(self, *args, **kw): + return self.sconf.TryBuild(*args, **kw) + + def TryAction(self, *args, **kw): + return self.sconf.TryAction(*args, **kw) + + def TryCompile(self, *args, **kw): + return self.sconf.TryCompile(*args, **kw) + + def TryLink(self, *args, **kw): + return self.sconf.TryLink(*args, **kw) + + def TryRun(self, *args, **kw): + return self.sconf.TryRun(*args, **kw) + + def __getattr__( self, attr ): + if( attr == 'env' ): + return self.sconf.env + elif( attr == 'lastTarget' ): + return self.sconf.lastTarget + else: + raise AttributeError("CheckContext instance has no attribute '%s'" % attr) + + #### Stuff used by Conftest.py (look there for explanations). + + def BuildProg(self, text, ext): + self.sconf.cached = 1 + # TODO: should use self.vardict for $CC, $CPPFLAGS, etc. + return not self.TryBuild(self.env.Program, text, ext) + + def CompileProg(self, text, ext): + self.sconf.cached = 1 + # TODO: should use self.vardict for $CC, $CPPFLAGS, etc. + return not self.TryBuild(self.env.Object, text, ext) + + def CompileSharedObject(self, text, ext): + self.sconf.cached = 1 + # TODO: should use self.vardict for $SHCC, $CPPFLAGS, etc. + return not self.TryBuild(self.env.SharedObject, text, ext) + + def RunProg(self, text, ext): + self.sconf.cached = 1 + # TODO: should use self.vardict for $CC, $CPPFLAGS, etc. + st, out = self.TryRun(text, ext) + return not st, out + + def AppendLIBS(self, lib_name_list): + oldLIBS = self.env.get( 'LIBS', [] ) + self.env.Append(LIBS = lib_name_list) + return oldLIBS + + def PrependLIBS(self, lib_name_list): + oldLIBS = self.env.get( 'LIBS', [] ) + self.env.Prepend(LIBS = lib_name_list) + return oldLIBS + + def SetLIBS(self, val): + oldLIBS = self.env.get( 'LIBS', [] ) + self.env.Replace(LIBS = val) + return oldLIBS + + def Display(self, msg): + if self.sconf.cached: + # We assume that Display is called twice for each test here + # once for the Checking for ... message and once for the result. + # The self.sconf.cached flag can only be set between those calls + msg = "(cached) " + msg + self.sconf.cached = 0 + progress_display(msg, append_newline=0) + self.Log("scons: Configure: " + msg + "\n") + + def Log(self, msg): + if self.sconf.logstream is not None: + self.sconf.logstream.write(msg) + + #### End of stuff used by Conftest.py. + + +def SConf(*args, **kw): + if kw.get(build_type, True): + kw['_depth'] = kw.get('_depth', 0) + 1 + for bt in build_types: + try: + del kw[bt] + except KeyError: + pass + return SConfBase(*args, **kw) + else: + return SCons.Util.Null() + + +def CheckFunc(context, function_name, header = None, language = None): + res = SCons.Conftest.CheckFunc(context, function_name, header = header, language = language) + context.did_show_result = 1 + return not res + +def CheckType(context, type_name, includes = "", language = None): + res = SCons.Conftest.CheckType(context, type_name, + header = includes, language = language) + context.did_show_result = 1 + return not res + +def CheckTypeSize(context, type_name, includes = "", language = None, expect = None): + res = SCons.Conftest.CheckTypeSize(context, type_name, + header = includes, language = language, + expect = expect) + context.did_show_result = 1 + return res + +def CheckDeclaration(context, declaration, includes = "", language = None): + res = SCons.Conftest.CheckDeclaration(context, declaration, + includes = includes, + language = language) + context.did_show_result = 1 + return not res + +def createIncludesFromHeaders(headers, leaveLast, include_quotes = '""'): + # used by CheckHeader and CheckLibWithHeader to produce C - #include + # statements from the specified header (list) + if not SCons.Util.is_List(headers): + headers = [headers] + l = [] + if leaveLast: + lastHeader = headers[-1] + headers = headers[:-1] + else: + lastHeader = None + for s in headers: + l.append("#include %s%s%s\n" + % (include_quotes[0], s, include_quotes[1])) + return ''.join(l), lastHeader + +def CheckHeader(context, header, include_quotes = '<>', language = None): + """ + A test for a C or C++ header file. + """ + prog_prefix, hdr_to_check = \ + createIncludesFromHeaders(header, 1, include_quotes) + res = SCons.Conftest.CheckHeader(context, hdr_to_check, prog_prefix, + language = language, + include_quotes = include_quotes) + context.did_show_result = 1 + return not res + +def CheckCC(context): + res = SCons.Conftest.CheckCC(context) + context.did_show_result = 1 + return not res + +def CheckCXX(context): + res = SCons.Conftest.CheckCXX(context) + context.did_show_result = 1 + return not res + +def CheckSHCC(context): + res = SCons.Conftest.CheckSHCC(context) + context.did_show_result = 1 + return not res + +def CheckSHCXX(context): + res = SCons.Conftest.CheckSHCXX(context) + context.did_show_result = 1 + return not res + +# Bram: Make this function obsolete? CheckHeader() is more generic. + +def CheckCHeader(context, header, include_quotes = '""'): + """ + A test for a C header file. + """ + return CheckHeader(context, header, include_quotes, language = "C") + + +# Bram: Make this function obsolete? CheckHeader() is more generic. + +def CheckCXXHeader(context, header, include_quotes = '""'): + """ + A test for a C++ header file. + """ + return CheckHeader(context, header, include_quotes, language = "C++") + + +def CheckLib(context, library = None, symbol = "main", + header = None, language = None, autoadd = 1): + """ + A test for a library. See also CheckLibWithHeader. + Note that library may also be None to test whether the given symbol + compiles without flags. + """ + + if library == []: + library = [None] + + if not SCons.Util.is_List(library): + library = [library] + + # ToDo: accept path for the library + res = SCons.Conftest.CheckLib(context, library, symbol, header = header, + language = language, autoadd = autoadd) + context.did_show_result = 1 + return not res + +# XXX +# Bram: Can only include one header and can't use #ifdef HAVE_HEADER_H. + +def CheckLibWithHeader(context, libs, header, language, + call = None, autoadd = 1): + # ToDo: accept path for library. Support system header files. + """ + Another (more sophisticated) test for a library. + Checks, if library and header is available for language (may be 'C' + or 'CXX'). Call maybe be a valid expression _with_ a trailing ';'. + As in CheckLib, we support library=None, to test if the call compiles + without extra link flags. + """ + prog_prefix, dummy = \ + createIncludesFromHeaders(header, 0) + if libs == []: + libs = [None] + + if not SCons.Util.is_List(libs): + libs = [libs] + + res = SCons.Conftest.CheckLib(context, libs, None, prog_prefix, + call = call, language = language, autoadd = autoadd) + context.did_show_result = 1 + return not res + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/SConsign.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/SConsign.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/SConsign.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/SConsign.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,389 @@ +"""SCons.SConsign + +Writing and reading information to the .sconsign file or files. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/SConsign.py 2013/03/03 09:48:35 garyo" + +import SCons.compat + +import os +# compat layer imports "cPickle" for us if it's available. +import pickle + +import SCons.dblite +import SCons.Warnings + +def corrupt_dblite_warning(filename): + SCons.Warnings.warn(SCons.Warnings.CorruptSConsignWarning, + "Ignoring corrupt .sconsign file: %s"%filename) + +SCons.dblite.ignore_corrupt_dbfiles = 1 +SCons.dblite.corruption_warning = corrupt_dblite_warning + +#XXX Get rid of the global array so this becomes re-entrant. +sig_files = [] + +# Info for the database SConsign implementation (now the default): +# "DataBase" is a dictionary that maps top-level SConstruct directories +# to open database handles. +# "DB_Module" is the Python database module to create the handles. +# "DB_Name" is the base name of the database file (minus any +# extension the underlying DB module will add). +DataBase = {} +DB_Module = SCons.dblite +DB_Name = ".sconsign" +DB_sync_list = [] + +def Get_DataBase(dir): + global DataBase, DB_Module, DB_Name + top = dir.fs.Top + if not os.path.isabs(DB_Name) and top.repositories: + mode = "c" + for d in [top] + top.repositories: + if dir.is_under(d): + try: + return DataBase[d], mode + except KeyError: + path = d.entry_abspath(DB_Name) + try: db = DataBase[d] = DB_Module.open(path, mode) + except (IOError, OSError): pass + else: + if mode != "r": + DB_sync_list.append(db) + return db, mode + mode = "r" + try: + return DataBase[top], "c" + except KeyError: + db = DataBase[top] = DB_Module.open(DB_Name, "c") + DB_sync_list.append(db) + return db, "c" + except TypeError: + print "DataBase =", DataBase + raise + +def Reset(): + """Reset global state. Used by unit tests that end up using + SConsign multiple times to get a clean slate for each test.""" + global sig_files, DB_sync_list + sig_files = [] + DB_sync_list = [] + +normcase = os.path.normcase + +def write(): + global sig_files + for sig_file in sig_files: + sig_file.write(sync=0) + for db in DB_sync_list: + try: + syncmethod = db.sync + except AttributeError: + pass # Not all dbm modules have sync() methods. + else: + syncmethod() + try: + closemethod = db.close + except AttributeError: + pass # Not all dbm modules have close() methods. + else: + closemethod() + +class SConsignEntry(object): + """ + Wrapper class for the generic entry in a .sconsign file. + The Node subclass populates it with attributes as it pleases. + + XXX As coded below, we do expect a '.binfo' attribute to be added, + but we'll probably generalize this in the next refactorings. + """ + current_version_id = 1 + def __init__(self): + # Create an object attribute from the class attribute so it ends up + # in the pickled data in the .sconsign file. + _version_id = self.current_version_id + def convert_to_sconsign(self): + self.binfo.convert_to_sconsign() + def convert_from_sconsign(self, dir, name): + self.binfo.convert_from_sconsign(dir, name) + +class Base(object): + """ + This is the controlling class for the signatures for the collection of + entries associated with a specific directory. The actual directory + association will be maintained by a subclass that is specific to + the underlying storage method. This class provides a common set of + methods for fetching and storing the individual bits of information + that make up signature entry. + """ + def __init__(self): + self.entries = {} + self.dirty = False + self.to_be_merged = {} + + def get_entry(self, filename): + """ + Fetch the specified entry attribute. + """ + return self.entries[filename] + + def set_entry(self, filename, obj): + """ + Set the entry. + """ + self.entries[filename] = obj + self.dirty = True + + def do_not_set_entry(self, filename, obj): + pass + + def store_info(self, filename, node): + entry = node.get_stored_info() + entry.binfo.merge(node.get_binfo()) + self.to_be_merged[filename] = node + self.dirty = True + + def do_not_store_info(self, filename, node): + pass + + def merge(self): + for key, node in self.to_be_merged.items(): + entry = node.get_stored_info() + try: + ninfo = entry.ninfo + except AttributeError: + # This happens with SConf Nodes, because the configuration + # subsystem takes direct control over how the build decision + # is made and its information stored. + pass + else: + ninfo.merge(node.get_ninfo()) + self.entries[key] = entry + self.to_be_merged = {} + +class DB(Base): + """ + A Base subclass that reads and writes signature information + from a global .sconsign.db* file--the actual file suffix is + determined by the database module. + """ + def __init__(self, dir): + Base.__init__(self) + + self.dir = dir + + db, mode = Get_DataBase(dir) + + # Read using the path relative to the top of the Repository + # (self.dir.tpath) from which we're fetching the signature + # information. + path = normcase(dir.tpath) + try: + rawentries = db[path] + except KeyError: + pass + else: + try: + self.entries = pickle.loads(rawentries) + if not isinstance(self.entries, dict): + self.entries = {} + raise TypeError + except KeyboardInterrupt: + raise + except Exception, e: + SCons.Warnings.warn(SCons.Warnings.CorruptSConsignWarning, + "Ignoring corrupt sconsign entry : %s (%s)\n"%(self.dir.tpath, e)) + for key, entry in self.entries.items(): + entry.convert_from_sconsign(dir, key) + + if mode == "r": + # This directory is actually under a repository, which means + # likely they're reaching in directly for a dependency on + # a file there. Don't actually set any entry info, so we + # won't try to write to that .sconsign.dblite file. + self.set_entry = self.do_not_set_entry + self.store_info = self.do_not_store_info + + global sig_files + sig_files.append(self) + + def write(self, sync=1): + if not self.dirty: + return + + self.merge() + + db, mode = Get_DataBase(self.dir) + + # Write using the path relative to the top of the SConstruct + # directory (self.dir.path), not relative to the top of + # the Repository; we only write to our own .sconsign file, + # not to .sconsign files in Repositories. + path = normcase(self.dir.path) + for key, entry in self.entries.items(): + entry.convert_to_sconsign() + db[path] = pickle.dumps(self.entries, 1) + + if sync: + try: + syncmethod = db.sync + except AttributeError: + # Not all anydbm modules have sync() methods. + pass + else: + syncmethod() + +class Dir(Base): + def __init__(self, fp=None, dir=None): + """ + fp - file pointer to read entries from + """ + Base.__init__(self) + + if not fp: + return + + self.entries = pickle.load(fp) + if not isinstance(self.entries, dict): + self.entries = {} + raise TypeError + + if dir: + for key, entry in self.entries.items(): + entry.convert_from_sconsign(dir, key) + +class DirFile(Dir): + """ + Encapsulates reading and writing a per-directory .sconsign file. + """ + def __init__(self, dir): + """ + dir - the directory for the file + """ + + self.dir = dir + self.sconsign = os.path.join(dir.path, '.sconsign') + + try: + fp = open(self.sconsign, 'rb') + except IOError: + fp = None + + try: + Dir.__init__(self, fp, dir) + except KeyboardInterrupt: + raise + except: + SCons.Warnings.warn(SCons.Warnings.CorruptSConsignWarning, + "Ignoring corrupt .sconsign file: %s"%self.sconsign) + + global sig_files + sig_files.append(self) + + def write(self, sync=1): + """ + Write the .sconsign file to disk. + + Try to write to a temporary file first, and rename it if we + succeed. If we can't write to the temporary file, it's + probably because the directory isn't writable (and if so, + how did we build anything in this directory, anyway?), so + try to write directly to the .sconsign file as a backup. + If we can't rename, try to copy the temporary contents back + to the .sconsign file. Either way, always try to remove + the temporary file at the end. + """ + if not self.dirty: + return + + self.merge() + + temp = os.path.join(self.dir.path, '.scons%d' % os.getpid()) + try: + file = open(temp, 'wb') + fname = temp + except IOError: + try: + file = open(self.sconsign, 'wb') + fname = self.sconsign + except IOError: + return + for key, entry in self.entries.items(): + entry.convert_to_sconsign() + pickle.dump(self.entries, file, 1) + file.close() + if fname != self.sconsign: + try: + mode = os.stat(self.sconsign)[0] + os.chmod(self.sconsign, 0666) + os.unlink(self.sconsign) + except (IOError, OSError): + # Try to carry on in the face of either OSError + # (things like permission issues) or IOError (disk + # or network issues). If there's a really dangerous + # issue, it should get re-raised by the calls below. + pass + try: + os.rename(fname, self.sconsign) + except OSError: + # An OSError failure to rename may indicate something + # like the directory has no write permission, but + # the .sconsign file itself might still be writable, + # so try writing on top of it directly. An IOError + # here, or in any of the following calls, would get + # raised, indicating something like a potentially + # serious disk or network issue. + open(self.sconsign, 'wb').write(open(fname, 'rb').read()) + os.chmod(self.sconsign, mode) + try: + os.unlink(temp) + except (IOError, OSError): + pass + +ForDirectory = DB + +def File(name, dbm_module=None): + """ + Arrange for all signatures to be stored in a global .sconsign.db* + file. + """ + global ForDirectory, DB_Name, DB_Module + if name is None: + ForDirectory = DirFile + DB_Module = None + else: + ForDirectory = DB + DB_Name = name + if not dbm_module is None: + DB_Module = dbm_module + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/C.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/C.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/C.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/C.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,132 @@ +"""SCons.Scanner.C + +This module implements the depenency scanner for C/C++ code. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Scanner/C.py 2013/03/03 09:48:35 garyo" + +import SCons.Node.FS +import SCons.Scanner +import SCons.Util + +import SCons.cpp + +class SConsCPPScanner(SCons.cpp.PreProcessor): + """ + SCons-specific subclass of the cpp.py module's processing. + + We subclass this so that: 1) we can deal with files represented + by Nodes, not strings; 2) we can keep track of the files that are + missing. + """ + def __init__(self, *args, **kw): + SCons.cpp.PreProcessor.__init__(self, *args, **kw) + self.missing = [] + def initialize_result(self, fname): + self.result = SCons.Util.UniqueList([fname]) + def finalize_result(self, fname): + return self.result[1:] + def find_include_file(self, t): + keyword, quote, fname = t + result = SCons.Node.FS.find_file(fname, self.searchpath[quote]) + if not result: + self.missing.append((fname, self.current_file)) + return result + def read_file(self, file): + try: + fp = open(str(file.rfile())) + except EnvironmentError, e: + self.missing.append((file, self.current_file)) + return '' + else: + return fp.read() + +def dictify_CPPDEFINES(env): + cppdefines = env.get('CPPDEFINES', {}) + if cppdefines is None: + return {} + if SCons.Util.is_Sequence(cppdefines): + result = {} + for c in cppdefines: + if SCons.Util.is_Sequence(c): + result[c[0]] = c[1] + else: + result[c] = None + return result + if not SCons.Util.is_Dict(cppdefines): + return {cppdefines : None} + return cppdefines + +class SConsCPPScannerWrapper(object): + """ + The SCons wrapper around a cpp.py scanner. + + This is the actual glue between the calling conventions of generic + SCons scanners, and the (subclass of) cpp.py class that knows how + to look for #include lines with reasonably real C-preprocessor-like + evaluation of #if/#ifdef/#else/#elif lines. + """ + def __init__(self, name, variable): + self.name = name + self.path = SCons.Scanner.FindPathDirs(variable) + def __call__(self, node, env, path = ()): + cpp = SConsCPPScanner(current = node.get_dir(), + cpppath = path, + dict = dictify_CPPDEFINES(env)) + result = cpp(node) + for included, includer in cpp.missing: + fmt = "No dependency generated for file: %s (included from: %s) -- file not found" + SCons.Warnings.warn(SCons.Warnings.DependencyWarning, + fmt % (included, includer)) + return result + + def recurse_nodes(self, nodes): + return nodes + def select(self, node): + return self + +def CScanner(): + """Return a prototype Scanner instance for scanning source files + that use the C pre-processor""" + + # Here's how we would (or might) use the CPP scanner code above that + # knows how to evaluate #if/#ifdef/#else/#elif lines when searching + # for #includes. This is commented out for now until we add the + # right configurability to let users pick between the scanners. + #return SConsCPPScannerWrapper("CScanner", "CPPPATH") + + cs = SCons.Scanner.ClassicCPP("CScanner", + "$CPPSUFFIXES", + "CPPPATH", + '^[ \t]*#[ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")') + return cs + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/D.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/D.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/D.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/D.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,73 @@ +"""SCons.Scanner.D + +Scanner for the Digital Mars "D" programming language. + +Coded by Andy Friesen +17 Nov 2003 + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Scanner/D.py 2013/03/03 09:48:35 garyo" + +import re + +import SCons.Scanner + +def DScanner(): + """Return a prototype Scanner instance for scanning D source files""" + ds = D() + return ds + +class D(SCons.Scanner.Classic): + def __init__ (self): + SCons.Scanner.Classic.__init__ (self, + name = "DScanner", + suffixes = '$DSUFFIXES', + path_variable = 'DPATH', + regex = 'import\s+(?:[a-zA-Z0-9_.]+)\s*(?:,\s*(?:[a-zA-Z0-9_.]+)\s*)*;') + + self.cre2 = re.compile ('(?:import\s)?\s*([a-zA-Z0-9_.]+)\s*(?:,|;)', re.M) + + def find_include(self, include, source_dir, path): + # translate dots (package separators) to slashes + inc = include.replace('.', '/') + + i = SCons.Node.FS.find_file(inc + '.d', (source_dir,) + path) + if i is None: + i = SCons.Node.FS.find_file (inc + '.di', (source_dir,) + path) + return i, include + + def find_include_names(self, node): + includes = [] + for i in self.cre.findall(node.get_text_contents()): + includes = includes + self.cre2.findall(i) + return includes + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/Dir.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/Dir.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/Dir.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/Dir.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,109 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Scanner/Dir.py 2013/03/03 09:48:35 garyo" + +import SCons.Node.FS +import SCons.Scanner + +def only_dirs(nodes): + is_Dir = lambda n: isinstance(n.disambiguate(), SCons.Node.FS.Dir) + return list(filter(is_Dir, nodes)) + +def DirScanner(**kw): + """Return a prototype Scanner instance for scanning + directories for on-disk files""" + kw['node_factory'] = SCons.Node.FS.Entry + kw['recursive'] = only_dirs + return SCons.Scanner.Base(scan_on_disk, "DirScanner", **kw) + +def DirEntryScanner(**kw): + """Return a prototype Scanner instance for "scanning" + directory Nodes for their in-memory entries""" + kw['node_factory'] = SCons.Node.FS.Entry + kw['recursive'] = None + return SCons.Scanner.Base(scan_in_memory, "DirEntryScanner", **kw) + +skip_entry = {} + +skip_entry_list = [ + '.', + '..', + '.sconsign', + # Used by the native dblite.py module. + '.sconsign.dblite', + # Used by dbm and dumbdbm. + '.sconsign.dir', + # Used by dbm. + '.sconsign.pag', + # Used by dumbdbm. + '.sconsign.dat', + '.sconsign.bak', + # Used by some dbm emulations using Berkeley DB. + '.sconsign.db', +] + +for skip in skip_entry_list: + skip_entry[skip] = 1 + skip_entry[SCons.Node.FS._my_normcase(skip)] = 1 + +do_not_scan = lambda k: k not in skip_entry + +def scan_on_disk(node, env, path=()): + """ + Scans a directory for on-disk files and directories therein. + + Looking up the entries will add these to the in-memory Node tree + representation of the file system, so all we have to do is just + that and then call the in-memory scanning function. + """ + try: + flist = node.fs.listdir(node.abspath) + except (IOError, OSError): + return [] + e = node.Entry + for f in filter(do_not_scan, flist): + # Add ./ to the beginning of the file name so if it begins with a + # '#' we don't look it up relative to the top-level directory. + e('./' + f) + return scan_in_memory(node, env, path) + +def scan_in_memory(node, env, path=()): + """ + "Scans" a Node.FS.Dir for its in-memory entries. + """ + try: + entries = node.entries + except AttributeError: + # It's not a Node.FS.Dir (or doesn't look enough like one for + # our purposes), which can happen if a target list containing + # mixed Node types (Dirs and Files, for example) has a Dir as + # the first entry. + return [] + entry_list = sorted(filter(do_not_scan, list(entries.keys()))) + return [entries[n] for n in entry_list] + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/Fortran.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/Fortran.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/Fortran.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/Fortran.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,316 @@ +"""SCons.Scanner.Fortran + +This module implements the dependency scanner for Fortran code. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Scanner/Fortran.py 2013/03/03 09:48:35 garyo" + +import re + +import SCons.Node +import SCons.Node.FS +import SCons.Scanner +import SCons.Util +import SCons.Warnings + +class F90Scanner(SCons.Scanner.Classic): + """ + A Classic Scanner subclass for Fortran source files which takes + into account both USE and INCLUDE statements. This scanner will + work for both F77 and F90 (and beyond) compilers. + + Currently, this scanner assumes that the include files do not contain + USE statements. To enable the ability to deal with USE statements + in include files, add logic right after the module names are found + to loop over each include file, search for and locate each USE + statement, and append each module name to the list of dependencies. + Caching the search results in a common dictionary somewhere so that + the same include file is not searched multiple times would be a + smart thing to do. + """ + + def __init__(self, name, suffixes, path_variable, + use_regex, incl_regex, def_regex, *args, **kw): + + self.cre_use = re.compile(use_regex, re.M) + self.cre_incl = re.compile(incl_regex, re.M) + self.cre_def = re.compile(def_regex, re.M) + + def _scan(node, env, path, self=self): + node = node.rfile() + + if not node.exists(): + return [] + + return self.scan(node, env, path) + + kw['function'] = _scan + kw['path_function'] = SCons.Scanner.FindPathDirs(path_variable) + kw['recursive'] = 1 + kw['skeys'] = suffixes + kw['name'] = name + + SCons.Scanner.Current.__init__(self, *args, **kw) + + def scan(self, node, env, path=()): + + # cache the includes list in node so we only scan it once: + if node.includes != None: + mods_and_includes = node.includes + else: + # retrieve all included filenames + includes = self.cre_incl.findall(node.get_text_contents()) + # retrieve all USE'd module names + modules = self.cre_use.findall(node.get_text_contents()) + # retrieve all defined module names + defmodules = self.cre_def.findall(node.get_text_contents()) + + # Remove all USE'd module names that are defined in the same file + # (case-insensitively) + d = {} + for m in defmodules: + d[m.lower()] = 1 + modules = [m for m in modules if m.lower() not in d] + + # Convert module name to a .mod filename + suffix = env.subst('$FORTRANMODSUFFIX') + modules = [x.lower() + suffix for x in modules] + # Remove unique items from the list + mods_and_includes = SCons.Util.unique(includes+modules) + node.includes = mods_and_includes + + # This is a hand-coded DSU (decorate-sort-undecorate, or + # Schwartzian transform) pattern. The sort key is the raw name + # of the file as specifed on the USE or INCLUDE line, which lets + # us keep the sort order constant regardless of whether the file + # is actually found in a Repository or locally. + nodes = [] + source_dir = node.get_dir() + if callable(path): + path = path() + for dep in mods_and_includes: + n, i = self.find_include(dep, source_dir, path) + + if n is None: + SCons.Warnings.warn(SCons.Warnings.DependencyWarning, + "No dependency generated for file: %s (referenced by: %s) -- file not found" % (i, node)) + else: + sortkey = self.sort_key(dep) + nodes.append((sortkey, n)) + + return [pair[1] for pair in sorted(nodes)] + +def FortranScan(path_variable="FORTRANPATH"): + """Return a prototype Scanner instance for scanning source files + for Fortran USE & INCLUDE statements""" + +# The USE statement regex matches the following: +# +# USE module_name +# USE :: module_name +# USE, INTRINSIC :: module_name +# USE, NON_INTRINSIC :: module_name +# +# Limitations +# +# -- While the regex can handle multiple USE statements on one line, +# it cannot properly handle them if they are commented out. +# In either of the following cases: +# +# ! USE mod_a ; USE mod_b [entire line is commented out] +# USE mod_a ! ; USE mod_b [in-line comment of second USE statement] +# +# the second module name (mod_b) will be picked up as a dependency +# even though it should be ignored. The only way I can see +# to rectify this would be to modify the scanner to eliminate +# the call to re.findall, read in the contents of the file, +# treating the comment character as an end-of-line character +# in addition to the normal linefeed, loop over each line, +# weeding out the comments, and looking for the USE statements. +# One advantage to this is that the regex passed to the scanner +# would no longer need to match a semicolon. +# +# -- I question whether or not we need to detect dependencies to +# INTRINSIC modules because these are built-in to the compiler. +# If we consider them a dependency, will SCons look for them, not +# find them, and kill the build? Or will we there be standard +# compiler-specific directories we will need to point to so the +# compiler and SCons can locate the proper object and mod files? + +# Here is a breakdown of the regex: +# +# (?i) : regex is case insensitive +# ^ : start of line +# (?: : group a collection of regex symbols without saving the match as a "group" +# ^|; : matches either the start of the line or a semicolon - semicolon +# ) : end the unsaved grouping +# \s* : any amount of white space +# USE : match the string USE, case insensitive +# (?: : group a collection of regex symbols without saving the match as a "group" +# \s+| : match one or more whitespace OR .... (the next entire grouped set of regex symbols) +# (?: : group a collection of regex symbols without saving the match as a "group" +# (?: : establish another unsaved grouping of regex symbols +# \s* : any amount of white space +# , : match a comma +# \s* : any amount of white space +# (?:NON_)? : optionally match the prefix NON_, case insensitive +# INTRINSIC : match the string INTRINSIC, case insensitive +# )? : optionally match the ", INTRINSIC/NON_INTRINSIC" grouped expression +# \s* : any amount of white space +# :: : match a double colon that must appear after the INTRINSIC/NON_INTRINSIC attribute +# ) : end the unsaved grouping +# ) : end the unsaved grouping +# \s* : match any amount of white space +# (\w+) : match the module name that is being USE'd +# +# + use_regex = "(?i)(?:^|;)\s*USE(?:\s+|(?:(?:\s*,\s*(?:NON_)?INTRINSIC)?\s*::))\s*(\w+)" + + +# The INCLUDE statement regex matches the following: +# +# INCLUDE 'some_Text' +# INCLUDE "some_Text" +# INCLUDE "some_Text" ; INCLUDE "some_Text" +# INCLUDE kind_"some_Text" +# INCLUDE kind_'some_Text" +# +# where some_Text can include any alphanumeric and/or special character +# as defined by the Fortran 2003 standard. +# +# Limitations: +# +# -- The Fortran standard dictates that a " or ' in the INCLUDE'd +# string must be represented as a "" or '', if the quotes that wrap +# the entire string are either a ' or ", respectively. While the +# regular expression below can detect the ' or " characters just fine, +# the scanning logic, presently is unable to detect them and reduce +# them to a single instance. This probably isn't an issue since, +# in practice, ' or " are not generally used in filenames. +# +# -- This regex will not properly deal with multiple INCLUDE statements +# when the entire line has been commented out, ala +# +# ! INCLUDE 'some_file' ; INCLUDE 'some_file' +# +# In such cases, it will properly ignore the first INCLUDE file, +# but will actually still pick up the second. Interestingly enough, +# the regex will properly deal with these cases: +# +# INCLUDE 'some_file' +# INCLUDE 'some_file' !; INCLUDE 'some_file' +# +# To get around the above limitation, the FORTRAN programmer could +# simply comment each INCLUDE statement separately, like this +# +# ! INCLUDE 'some_file' !; INCLUDE 'some_file' +# +# The way I see it, the only way to get around this limitation would +# be to modify the scanning logic to replace the calls to re.findall +# with a custom loop that processes each line separately, throwing +# away fully commented out lines before attempting to match against +# the INCLUDE syntax. +# +# Here is a breakdown of the regex: +# +# (?i) : regex is case insensitive +# (?: : begin a non-saving group that matches the following: +# ^ : either the start of the line +# | : or +# ['">]\s*; : a semicolon that follows a single quote, +# double quote or greater than symbol (with any +# amount of whitespace in between). This will +# allow the regex to match multiple INCLUDE +# statements per line (although it also requires +# the positive lookahead assertion that is +# used below). It will even properly deal with +# (i.e. ignore) cases in which the additional +# INCLUDES are part of an in-line comment, ala +# " INCLUDE 'someFile' ! ; INCLUDE 'someFile2' " +# ) : end of non-saving group +# \s* : any amount of white space +# INCLUDE : match the string INCLUDE, case insensitive +# \s+ : match one or more white space characters +# (?\w+_)? : match the optional "kind-param _" prefix allowed by the standard +# [<"'] : match the include delimiter - an apostrophe, double quote, or less than symbol +# (.+?) : match one or more characters that make up +# the included path and file name and save it +# in a group. The Fortran standard allows for +# any non-control character to be used. The dot +# operator will pick up any character, including +# control codes, but I can't conceive of anyone +# putting control codes in their file names. +# The question mark indicates it is non-greedy so +# that regex will match only up to the next quote, +# double quote, or greater than symbol +# (?=["'>]) : positive lookahead assertion to match the include +# delimiter - an apostrophe, double quote, or +# greater than symbol. This level of complexity +# is required so that the include delimiter is +# not consumed by the match, thus allowing the +# sub-regex discussed above to uniquely match a +# set of semicolon-separated INCLUDE statements +# (as allowed by the F2003 standard) + + include_regex = """(?i)(?:^|['">]\s*;)\s*INCLUDE\s+(?:\w+_)?[<"'](.+?)(?=["'>])""" + +# The MODULE statement regex finds module definitions by matching +# the following: +# +# MODULE module_name +# +# but *not* the following: +# +# MODULE PROCEDURE procedure_name +# +# Here is a breakdown of the regex: +# +# (?i) : regex is case insensitive +# ^\s* : any amount of white space +# MODULE : match the string MODULE, case insensitive +# \s+ : match one or more white space characters +# (?!PROCEDURE) : but *don't* match if the next word matches +# PROCEDURE (negative lookahead assertion), +# case insensitive +# (\w+) : match one or more alphanumeric characters +# that make up the defined module name and +# save it in a group + + def_regex = """(?i)^\s*MODULE\s+(?!PROCEDURE)(\w+)""" + + scanner = F90Scanner("FortranScan", + "$FORTRANSUFFIXES", + path_variable, + use_regex, + include_regex, + def_regex) + return scanner + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/IDL.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/IDL.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/IDL.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/IDL.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,48 @@ +"""SCons.Scanner.IDL + +This module implements the depenency scanner for IDL (Interface +Definition Language) files. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Scanner/IDL.py 2013/03/03 09:48:35 garyo" + +import SCons.Node.FS +import SCons.Scanner + +def IDLScan(): + """Return a prototype Scanner instance for scanning IDL source files""" + cs = SCons.Scanner.ClassicCPP("IDLScan", + "$IDLSUFFIXES", + "CPPPATH", + '^[ \t]*(?:#[ \t]*include|[ \t]*import)[ \t]+(<|")([^>"]+)(>|")') + return cs + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/LaTeX.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/LaTeX.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/LaTeX.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/LaTeX.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,390 @@ +"""SCons.Scanner.LaTeX + +This module implements the dependency scanner for LaTeX code. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Scanner/LaTeX.py 2013/03/03 09:48:35 garyo" + +import os.path +import re + +import SCons.Scanner +import SCons.Util + +# list of graphics file extensions for TeX and LaTeX +TexGraphics = ['.eps', '.ps'] +LatexGraphics = ['.pdf', '.png', '.jpg', '.gif', '.tif'] + +# Used as a return value of modify_env_var if the variable is not set. +class _Null(object): + pass +_null = _Null + +# The user specifies the paths in env[variable], similar to other builders. +# They may be relative and must be converted to absolute, as expected +# by LaTeX and Co. The environment may already have some paths in +# env['ENV'][var]. These paths are honored, but the env[var] paths have +# higher precedence. All changes are un-done on exit. +def modify_env_var(env, var, abspath): + try: + save = env['ENV'][var] + except KeyError: + save = _null + env.PrependENVPath(var, abspath) + try: + if SCons.Util.is_List(env[var]): + env.PrependENVPath(var, [os.path.abspath(str(p)) for p in env[var]]) + else: + # Split at os.pathsep to convert into absolute path + env.PrependENVPath(var, [os.path.abspath(p) for p in str(env[var]).split(os.pathsep)]) + except KeyError: + pass + + # Convert into a string explicitly to append ":" (without which it won't search system + # paths as well). The problem is that env.AppendENVPath(var, ":") + # does not work, refuses to append ":" (os.pathsep). + + if SCons.Util.is_List(env['ENV'][var]): + env['ENV'][var] = os.pathsep.join(env['ENV'][var]) + # Append the trailing os.pathsep character here to catch the case with no env[var] + env['ENV'][var] = env['ENV'][var] + os.pathsep + + return save + +class FindENVPathDirs(object): + """A class to bind a specific *PATH variable name to a function that + will return all of the *path directories.""" + def __init__(self, variable): + self.variable = variable + def __call__(self, env, dir=None, target=None, source=None, argument=None): + import SCons.PathList + try: + path = env['ENV'][self.variable] + except KeyError: + return () + + dir = dir or env.fs._cwd + path = SCons.PathList.PathList(path).subst_path(env, target, source) + return tuple(dir.Rfindalldirs(path)) + + + +def LaTeXScanner(): + """Return a prototype Scanner instance for scanning LaTeX source files + when built with latex. + """ + ds = LaTeX(name = "LaTeXScanner", + suffixes = '$LATEXSUFFIXES', + # in the search order, see below in LaTeX class docstring + graphics_extensions = TexGraphics, + recursive = 0) + return ds + +def PDFLaTeXScanner(): + """Return a prototype Scanner instance for scanning LaTeX source files + when built with pdflatex. + """ + ds = LaTeX(name = "PDFLaTeXScanner", + suffixes = '$LATEXSUFFIXES', + # in the search order, see below in LaTeX class docstring + graphics_extensions = LatexGraphics, + recursive = 0) + return ds + +class LaTeX(SCons.Scanner.Base): + """Class for scanning LaTeX files for included files. + + Unlike most scanners, which use regular expressions that just + return the included file name, this returns a tuple consisting + of the keyword for the inclusion ("include", "includegraphics", + "input", or "bibliography"), and then the file name itself. + Based on a quick look at LaTeX documentation, it seems that we + should append .tex suffix for the "include" keywords, append .tex if + there is no extension for the "input" keyword, and need to add .bib + for the "bibliography" keyword that does not accept extensions by itself. + + Finally, if there is no extension for an "includegraphics" keyword + latex will append .ps or .eps to find the file, while pdftex may use .pdf, + .jpg, .tif, .mps, or .png. + + The actual subset and search order may be altered by + DeclareGraphicsExtensions command. This complication is ignored. + The default order corresponds to experimentation with teTeX + $ latex --version + pdfeTeX 3.141592-1.21a-2.2 (Web2C 7.5.4) + kpathsea version 3.5.4 + The order is: + ['.eps', '.ps'] for latex + ['.png', '.pdf', '.jpg', '.tif']. + + Another difference is that the search path is determined by the type + of the file being searched: + env['TEXINPUTS'] for "input" and "include" keywords + env['TEXINPUTS'] for "includegraphics" keyword + env['TEXINPUTS'] for "lstinputlisting" keyword + env['BIBINPUTS'] for "bibliography" keyword + env['BSTINPUTS'] for "bibliographystyle" keyword + env['INDEXSTYLE'] for "makeindex" keyword, no scanning support needed + just allows user to set it if needed. + + FIXME: also look for the class or style in document[class|style]{} + FIXME: also look for the argument of bibliographystyle{} + """ + keyword_paths = {'include': 'TEXINPUTS', + 'input': 'TEXINPUTS', + 'includegraphics': 'TEXINPUTS', + 'bibliography': 'BIBINPUTS', + 'bibliographystyle': 'BSTINPUTS', + 'addbibresource': 'BIBINPUTS', + 'addglobalbib': 'BIBINPUTS', + 'addsectionbib': 'BIBINPUTS', + 'makeindex': 'INDEXSTYLE', + 'usepackage': 'TEXINPUTS', + 'lstinputlisting': 'TEXINPUTS'} + env_variables = SCons.Util.unique(list(keyword_paths.values())) + + def __init__(self, name, suffixes, graphics_extensions, *args, **kw): + + # We have to include \n with the % we exclude from the first part + # part of the regex because the expression is compiled with re.M. + # Without the \n, the ^ could match the beginning of a *previous* + # line followed by one or more newline characters (i.e. blank + # lines), interfering with a match on the next line. + # add option for whitespace before the '[options]' or the '{filename}' + regex = r'^[^%\n]*\\(include|includegraphics(?:\s*\[[^\]]+\])?|lstinputlisting(?:\[[^\]]+\])?|input|bibliography|addbibresource|addglobalbib|addsectionbib|usepackage)\s*{([^}]*)}' + self.cre = re.compile(regex, re.M) + self.comment_re = re.compile(r'^((?:(?:\\%)|[^%\n])*)(.*)$', re.M) + + self.graphics_extensions = graphics_extensions + + def _scan(node, env, path=(), self=self): + node = node.rfile() + if not node.exists(): + return [] + return self.scan_recurse(node, path) + + class FindMultiPathDirs(object): + """The stock FindPathDirs function has the wrong granularity: + it is called once per target, while we need the path that depends + on what kind of included files is being searched. This wrapper + hides multiple instances of FindPathDirs, one per the LaTeX path + variable in the environment. When invoked, the function calculates + and returns all the required paths as a dictionary (converted into + a tuple to become hashable). Then the scan function converts it + back and uses a dictionary of tuples rather than a single tuple + of paths. + """ + def __init__(self, dictionary): + self.dictionary = {} + for k,n in dictionary.items(): + self.dictionary[k] = ( SCons.Scanner.FindPathDirs(n), + FindENVPathDirs(n) ) + + def __call__(self, env, dir=None, target=None, source=None, + argument=None): + di = {} + for k,(c,cENV) in self.dictionary.items(): + di[k] = ( c(env, dir=None, target=None, source=None, + argument=None) , + cENV(env, dir=None, target=None, source=None, + argument=None) ) + # To prevent "dict is not hashable error" + return tuple(di.items()) + + class LaTeXScanCheck(object): + """Skip all but LaTeX source files, i.e., do not scan *.eps, + *.pdf, *.jpg, etc. + """ + def __init__(self, suffixes): + self.suffixes = suffixes + def __call__(self, node, env): + current = not node.has_builder() or node.is_up_to_date() + scannable = node.get_suffix() in env.subst_list(self.suffixes)[0] + # Returning false means that the file is not scanned. + return scannable and current + + kw['function'] = _scan + kw['path_function'] = FindMultiPathDirs(LaTeX.keyword_paths) + kw['recursive'] = 0 + kw['skeys'] = suffixes + kw['scan_check'] = LaTeXScanCheck(suffixes) + kw['name'] = name + + SCons.Scanner.Base.__init__(self, *args, **kw) + + def _latex_names(self, include): + filename = include[1] + if include[0] == 'input': + base, ext = os.path.splitext( filename ) + if ext == "": + return [filename + '.tex'] + if (include[0] == 'include'): + return [filename + '.tex'] + if include[0] == 'bibliography': + base, ext = os.path.splitext( filename ) + if ext == "": + return [filename + '.bib'] + if include[0] == 'usepackage': + base, ext = os.path.splitext( filename ) + if ext == "": + return [filename + '.sty'] + if include[0] == 'includegraphics': + base, ext = os.path.splitext( filename ) + if ext == "": + #return [filename+e for e in self.graphics_extensions + TexGraphics] + # use the line above to find dependencies for the PDF builder + # when only an .eps figure is present. Since it will be found + # if the user tells scons how to make the pdf figure, leave + # it out for now. + return [filename+e for e in self.graphics_extensions] + return [filename] + + def sort_key(self, include): + return SCons.Node.FS._my_normcase(str(include)) + + def find_include(self, include, source_dir, path): + try: + sub_path = path[include[0]] + except (IndexError, KeyError): + sub_path = () + try_names = self._latex_names(include) + for n in try_names: + # see if we find it using the path in env[var] + i = SCons.Node.FS.find_file(n, (source_dir,) + sub_path[0]) + if i: + return i, include + # see if we find it using the path in env['ENV'][var] + i = SCons.Node.FS.find_file(n, (source_dir,) + sub_path[1]) + if i: + return i, include + return i, include + + def canonical_text(self, text): + """Standardize an input TeX-file contents. + + Currently: + * removes comments, unwrapping comment-wrapped lines. + """ + out = [] + line_continues_a_comment = False + for line in text.splitlines(): + line,comment = self.comment_re.findall(line)[0] + if line_continues_a_comment == True: + out[-1] = out[-1] + line.lstrip() + else: + out.append(line) + line_continues_a_comment = len(comment) > 0 + return '\n'.join(out).rstrip()+'\n' + + def scan(self, node): + # Modify the default scan function to allow for the regular + # expression to return a comma separated list of file names + # as can be the case with the bibliography keyword. + + # Cache the includes list in node so we only scan it once: + # path_dict = dict(list(path)) + # add option for whitespace (\s) before the '[' + noopt_cre = re.compile('\s*\[.*$') + if node.includes != None: + includes = node.includes + else: + text = self.canonical_text(node.get_text_contents()) + includes = self.cre.findall(text) + # 1. Split comma-separated lines, e.g. + # ('bibliography', 'phys,comp') + # should become two entries + # ('bibliography', 'phys') + # ('bibliography', 'comp') + # 2. Remove the options, e.g., such as + # ('includegraphics[clip,width=0.7\\linewidth]', 'picture.eps') + # should become + # ('includegraphics', 'picture.eps') + split_includes = [] + for include in includes: + inc_type = noopt_cre.sub('', include[0]) + inc_list = include[1].split(',') + for j in range(len(inc_list)): + split_includes.append( (inc_type, inc_list[j]) ) + # + includes = split_includes + node.includes = includes + + return includes + + def scan_recurse(self, node, path=()): + """ do a recursive scan of the top level target file + This lets us search for included files based on the + directory of the main file just as latex does""" + + path_dict = dict(list(path)) + + queue = [] + queue.extend( self.scan(node) ) + seen = {} + + # This is a hand-coded DSU (decorate-sort-undecorate, or + # Schwartzian transform) pattern. The sort key is the raw name + # of the file as specifed on the \include, \input, etc. line. + # TODO: what about the comment in the original Classic scanner: + # """which lets + # us keep the sort order constant regardless of whether the file + # is actually found in a Repository or locally.""" + nodes = [] + source_dir = node.get_dir() + #for include in includes: + while queue: + + include = queue.pop() + try: + if seen[include[1]] == 1: + continue + except KeyError: + seen[include[1]] = 1 + + # + # Handle multiple filenames in include[1] + # + n, i = self.find_include(include, source_dir, path_dict) + if n is None: + # Do not bother with 'usepackage' warnings, as they most + # likely refer to system-level files + if include[0] != 'usepackage': + SCons.Warnings.warn(SCons.Warnings.DependencyWarning, + "No dependency generated for file: %s (included from: %s) -- file not found" % (i, node)) + else: + sortkey = self.sort_key(n) + nodes.append((sortkey, n)) + # recurse down + queue.extend( self.scan(n) ) + + return [pair[1] for pair in sorted(nodes)] + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/Prog.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/Prog.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/Prog.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/Prog.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,101 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Scanner/Prog.py 2013/03/03 09:48:35 garyo" + +import SCons.Node +import SCons.Node.FS +import SCons.Scanner +import SCons.Util + +# global, set by --debug=findlibs +print_find_libs = None + +def ProgramScanner(**kw): + """Return a prototype Scanner instance for scanning executable + files for static-lib dependencies""" + kw['path_function'] = SCons.Scanner.FindPathDirs('LIBPATH') + ps = SCons.Scanner.Base(scan, "ProgramScanner", **kw) + return ps + +def scan(node, env, libpath = ()): + """ + This scanner scans program files for static-library + dependencies. It will search the LIBPATH environment variable + for libraries specified in the LIBS variable, returning any + files it finds as dependencies. + """ + try: + libs = env['LIBS'] + except KeyError: + # There are no LIBS in this environment, so just return a null list: + return [] + if SCons.Util.is_String(libs): + libs = libs.split() + else: + libs = SCons.Util.flatten(libs) + + try: + prefix = env['LIBPREFIXES'] + if not SCons.Util.is_List(prefix): + prefix = [ prefix ] + except KeyError: + prefix = [ '' ] + + try: + suffix = env['LIBSUFFIXES'] + if not SCons.Util.is_List(suffix): + suffix = [ suffix ] + except KeyError: + suffix = [ '' ] + + pairs = [] + for suf in map(env.subst, suffix): + for pref in map(env.subst, prefix): + pairs.append((pref, suf)) + + result = [] + + if callable(libpath): + libpath = libpath() + + find_file = SCons.Node.FS.find_file + adjustixes = SCons.Util.adjustixes + for lib in libs: + if SCons.Util.is_String(lib): + lib = env.subst(lib) + for pref, suf in pairs: + l = adjustixes(lib, pref, suf) + l = find_file(l, libpath, verbose=print_find_libs) + if l: + result.append(l) + else: + result.append(lib) + + return result + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/RC.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/RC.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/RC.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/RC.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,55 @@ +"""SCons.Scanner.RC + +This module implements the depenency scanner for RC (Interface +Definition Language) files. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Scanner/RC.py 2013/03/03 09:48:35 garyo" + +import SCons.Node.FS +import SCons.Scanner +import re + +def RCScan(): + """Return a prototype Scanner instance for scanning RC source files""" + + res_re= r'^(?:\s*#\s*(?:include)|' \ + '.*?\s+(?:ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)' \ + '\s*.*?)' \ + '\s*(<|"| )([^>"\s]+)(?:[>"\s])*$' + resScanner = SCons.Scanner.ClassicCPP( "ResourceScanner", + "$RCSUFFIXES", + "CPPPATH", + res_re ) + + return resScanner + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/__init__.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/__init__.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Scanner/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Scanner/__init__.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,413 @@ +"""SCons.Scanner + +The Scanner package for the SCons software construction utility. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Scanner/__init__.py 2013/03/03 09:48:35 garyo" + +import re + +import SCons.Node.FS +import SCons.Util + + +class _Null(object): + pass + +# This is used instead of None as a default argument value so None can be +# used as an actual argument value. +_null = _Null + +def Scanner(function, *args, **kw): + """ + Public interface factory function for creating different types + of Scanners based on the different types of "functions" that may + be supplied. + + TODO: Deprecate this some day. We've moved the functionality + inside the Base class and really don't need this factory function + any more. It was, however, used by some of our Tool modules, so + the call probably ended up in various people's custom modules + patterned on SCons code. + """ + if SCons.Util.is_Dict(function): + return Selector(function, *args, **kw) + else: + return Base(function, *args, **kw) + + + +class FindPathDirs(object): + """A class to bind a specific *PATH variable name to a function that + will return all of the *path directories.""" + def __init__(self, variable): + self.variable = variable + def __call__(self, env, dir=None, target=None, source=None, argument=None): + import SCons.PathList + try: + path = env[self.variable] + except KeyError: + return () + + dir = dir or env.fs._cwd + path = SCons.PathList.PathList(path).subst_path(env, target, source) + return tuple(dir.Rfindalldirs(path)) + + + +class Base(object): + """ + The base class for dependency scanners. This implements + straightforward, single-pass scanning of a single file. + """ + + def __init__(self, + function, + name = "NONE", + argument = _null, + skeys = _null, + path_function = None, + # Node.FS.Base so that, by default, it's okay for a + # scanner to return a Dir, File or Entry. + node_class = SCons.Node.FS.Base, + node_factory = None, + scan_check = None, + recursive = None): + """ + Construct a new scanner object given a scanner function. + + 'function' - a scanner function taking two or three + arguments and returning a list of strings. + + 'name' - a name for identifying this scanner object. + + 'argument' - an optional argument that, if specified, will be + passed to both the scanner function and the path_function. + + 'skeys' - an optional list argument that can be used to determine + which scanner should be used for a given Node. In the case of File + nodes, for example, the 'skeys' would be file suffixes. + + 'path_function' - a function that takes four or five arguments + (a construction environment, Node for the directory containing + the SConscript file that defined the primary target, list of + target nodes, list of source nodes, and optional argument for + this instance) and returns a tuple of the directories that can + be searched for implicit dependency files. May also return a + callable() which is called with no args and returns the tuple + (supporting Bindable class). + + 'node_class' - the class of Nodes which this scan will return. + If node_class is None, then this scanner will not enforce any + Node conversion and will return the raw results from the + underlying scanner function. + + 'node_factory' - the factory function to be called to translate + the raw results returned by the scanner function into the + expected node_class objects. + + 'scan_check' - a function to be called to first check whether + this node really needs to be scanned. + + 'recursive' - specifies that this scanner should be invoked + recursively on all of the implicit dependencies it returns + (the canonical example being #include lines in C source files). + May be a callable, which will be called to filter the list + of nodes found to select a subset for recursive scanning + (the canonical example being only recursively scanning + subdirectories within a directory). + + The scanner function's first argument will be a Node that should + be scanned for dependencies, the second argument will be an + Environment object, the third argument will be the tuple of paths + returned by the path_function, and the fourth argument will be + the value passed into 'argument', and the returned list should + contain the Nodes for all the direct dependencies of the file. + + Examples: + + s = Scanner(my_scanner_function) + + s = Scanner(function = my_scanner_function) + + s = Scanner(function = my_scanner_function, argument = 'foo') + + """ + + # Note: this class could easily work with scanner functions that take + # something other than a filename as an argument (e.g. a database + # node) and a dependencies list that aren't file names. All that + # would need to be changed is the documentation. + + self.function = function + self.path_function = path_function + self.name = name + self.argument = argument + + if skeys is _null: + if SCons.Util.is_Dict(function): + skeys = list(function.keys()) + else: + skeys = [] + self.skeys = skeys + + self.node_class = node_class + self.node_factory = node_factory + self.scan_check = scan_check + if callable(recursive): + self.recurse_nodes = recursive + elif recursive: + self.recurse_nodes = self._recurse_all_nodes + else: + self.recurse_nodes = self._recurse_no_nodes + + def path(self, env, dir=None, target=None, source=None): + if not self.path_function: + return () + if not self.argument is _null: + return self.path_function(env, dir, target, source, self.argument) + else: + return self.path_function(env, dir, target, source) + + def __call__(self, node, env, path = ()): + """ + This method scans a single object. 'node' is the node + that will be passed to the scanner function, and 'env' is the + environment that will be passed to the scanner function. A list of + direct dependency nodes for the specified node will be returned. + """ + if self.scan_check and not self.scan_check(node, env): + return [] + + self = self.select(node) + + if not self.argument is _null: + list = self.function(node, env, path, self.argument) + else: + list = self.function(node, env, path) + + kw = {} + if hasattr(node, 'dir'): + kw['directory'] = node.dir + node_factory = env.get_factory(self.node_factory) + nodes = [] + for l in list: + if self.node_class and not isinstance(l, self.node_class): + l = node_factory(l, **kw) + nodes.append(l) + return nodes + + def __cmp__(self, other): + try: + return cmp(self.__dict__, other.__dict__) + except AttributeError: + # other probably doesn't have a __dict__ + return cmp(self.__dict__, other) + + def __hash__(self): + return id(self) + + def __str__(self): + return self.name + + def add_skey(self, skey): + """Add a skey to the list of skeys""" + self.skeys.append(skey) + + def get_skeys(self, env=None): + if env and SCons.Util.is_String(self.skeys): + return env.subst_list(self.skeys)[0] + return self.skeys + + def select(self, node): + if SCons.Util.is_Dict(self.function): + key = node.scanner_key() + try: + return self.function[key] + except KeyError: + return None + else: + return self + + def _recurse_all_nodes(self, nodes): + return nodes + + def _recurse_no_nodes(self, nodes): + return [] + + recurse_nodes = _recurse_no_nodes + + def add_scanner(self, skey, scanner): + self.function[skey] = scanner + self.add_skey(skey) + + +class Selector(Base): + """ + A class for selecting a more specific scanner based on the + scanner_key() (suffix) for a specific Node. + + TODO: This functionality has been moved into the inner workings of + the Base class, and this class will be deprecated at some point. + (It was never exposed directly as part of the public interface, + although it is used by the Scanner() factory function that was + used by various Tool modules and therefore was likely a template + for custom modules that may be out there.) + """ + def __init__(self, dict, *args, **kw): + Base.__init__(self, None, *args, **kw) + self.dict = dict + self.skeys = list(dict.keys()) + + def __call__(self, node, env, path = ()): + return self.select(node)(node, env, path) + + def select(self, node): + try: + return self.dict[node.scanner_key()] + except KeyError: + return None + + def add_scanner(self, skey, scanner): + self.dict[skey] = scanner + self.add_skey(skey) + + +class Current(Base): + """ + A class for scanning files that are source files (have no builder) + or are derived files and are current (which implies that they exist, + either locally or in a repository). + """ + + def __init__(self, *args, **kw): + def current_check(node, env): + return not node.has_builder() or node.is_up_to_date() + kw['scan_check'] = current_check + Base.__init__(self, *args, **kw) + +class Classic(Current): + """ + A Scanner subclass to contain the common logic for classic CPP-style + include scanning, but which can be customized to use different + regular expressions to find the includes. + + Note that in order for this to work "out of the box" (without + overriding the find_include() and sort_key() methods), the regular + expression passed to the constructor must return the name of the + include file in group 0. + """ + + def __init__(self, name, suffixes, path_variable, regex, *args, **kw): + + self.cre = re.compile(regex, re.M) + + def _scan(node, env, path=(), self=self): + node = node.rfile() + if not node.exists(): + return [] + return self.scan(node, path) + + kw['function'] = _scan + kw['path_function'] = FindPathDirs(path_variable) + kw['recursive'] = 1 + kw['skeys'] = suffixes + kw['name'] = name + + Current.__init__(self, *args, **kw) + + def find_include(self, include, source_dir, path): + n = SCons.Node.FS.find_file(include, (source_dir,) + tuple(path)) + return n, include + + def sort_key(self, include): + return SCons.Node.FS._my_normcase(include) + + def find_include_names(self, node): + return self.cre.findall(node.get_text_contents()) + + def scan(self, node, path=()): + + # cache the includes list in node so we only scan it once: + if node.includes is not None: + includes = node.includes + else: + includes = self.find_include_names (node) + # Intern the names of the include files. Saves some memory + # if the same header is included many times. + node.includes = list(map(SCons.Util.silent_intern, includes)) + + # This is a hand-coded DSU (decorate-sort-undecorate, or + # Schwartzian transform) pattern. The sort key is the raw name + # of the file as specifed on the #include line (including the + # " or <, since that may affect what file is found), which lets + # us keep the sort order constant regardless of whether the file + # is actually found in a Repository or locally. + nodes = [] + source_dir = node.get_dir() + if callable(path): + path = path() + for include in includes: + n, i = self.find_include(include, source_dir, path) + + if n is None: + SCons.Warnings.warn(SCons.Warnings.DependencyWarning, + "No dependency generated for file: %s (included from: %s) -- file not found" % (i, node)) + else: + nodes.append((self.sort_key(include), n)) + + return [pair[1] for pair in sorted(nodes)] + +class ClassicCPP(Classic): + """ + A Classic Scanner subclass which takes into account the type of + bracketing used to include the file, and uses classic CPP rules + for searching for the files based on the bracketing. + + Note that in order for this to work, the regular expression passed + to the constructor must return the leading bracket in group 0, and + the contained filename in group 1. + """ + def find_include(self, include, source_dir, path): + if include[0] == '"': + paths = (source_dir,) + tuple(path) + else: + paths = tuple(path) + (source_dir,) + + n = SCons.Node.FS.find_file(include[1], paths) + + i = SCons.Util.silent_intern(include[1]) + return n, i + + def sort_key(self, include): + return SCons.Node.FS._my_normcase(' '.join(include)) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Script/Interactive.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Script/Interactive.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Script/Interactive.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Script/Interactive.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,384 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Script/Interactive.py 2013/03/03 09:48:35 garyo" + +__doc__ = """ +SCons interactive mode +""" + +# TODO: +# +# This has the potential to grow into something with a really big life +# of its own, which might or might not be a good thing. Nevertheless, +# here are some enhancements that will probably be requested some day +# and are worth keeping in mind (assuming this takes off): +# +# - A command to re-read / re-load the SConscript files. This may +# involve allowing people to specify command-line options (e.g. -f, +# -I, --no-site-dir) that affect how the SConscript files are read. +# +# - Additional command-line options on the "build" command. +# +# Of the supported options that seemed to make sense (after a quick +# pass through the list), the ones that seemed likely enough to be +# used are listed in the man page and have explicit test scripts. +# +# These had code changed in Script/Main.py to support them, but didn't +# seem likely to be used regularly, so had no test scripts added: +# +# build --diskcheck=* +# build --implicit-cache=* +# build --implicit-deps-changed=* +# build --implicit-deps-unchanged=* +# +# These look like they should "just work" with no changes to the +# existing code, but like those above, look unlikely to be used and +# therefore had no test scripts added: +# +# build --random +# +# These I'm not sure about. They might be useful for individual +# "build" commands, and may even work, but they seem unlikely enough +# that we'll wait until they're requested before spending any time on +# writing test scripts for them, or investigating whether they work. +# +# build -q [??? is there a useful analog to the exit status?] +# build --duplicate= +# build --profile= +# build --max-drift= +# build --warn=* +# build --Y +# +# - Most of the SCons command-line options that the "build" command +# supports should be settable as default options that apply to all +# subsequent "build" commands. Maybe a "set {option}" command that +# maps to "SetOption('{option}')". +# +# - Need something in the 'help' command that prints the -h output. +# +# - A command to run the configure subsystem separately (must see how +# this interacts with the new automake model). +# +# - Command-line completion of target names; maybe even of SCons options? +# Completion is something that's supported by the Python cmd module, +# so this should be doable without too much trouble. +# + +import cmd +import copy +import os +import re +import shlex +import sys + +try: + import readline +except ImportError: + pass + +class SConsInteractiveCmd(cmd.Cmd): + """\ + build [TARGETS] Build the specified TARGETS and their dependencies. + 'b' is a synonym. + clean [TARGETS] Clean (remove) the specified TARGETS and their + dependencies. 'c' is a synonym. + exit Exit SCons interactive mode. + help [COMMAND] Prints help for the specified COMMAND. 'h' and + '?' are synonyms. + shell [COMMANDLINE] Execute COMMANDLINE in a subshell. 'sh' and '!' + are synonyms. + version Prints SCons version information. + """ + + synonyms = { + 'b' : 'build', + 'c' : 'clean', + 'h' : 'help', + 'scons' : 'build', + 'sh' : 'shell', + } + + def __init__(self, **kw): + cmd.Cmd.__init__(self) + for key, val in kw.items(): + setattr(self, key, val) + + if sys.platform == 'win32': + self.shell_variable = 'COMSPEC' + else: + self.shell_variable = 'SHELL' + + def default(self, argv): + print "*** Unknown command: %s" % argv[0] + + def onecmd(self, line): + line = line.strip() + if not line: + print self.lastcmd + return self.emptyline() + self.lastcmd = line + if line[0] == '!': + line = 'shell ' + line[1:] + elif line[0] == '?': + line = 'help ' + line[1:] + if os.sep == '\\': + line = line.replace('\\', '\\\\') + argv = shlex.split(line) + argv[0] = self.synonyms.get(argv[0], argv[0]) + if not argv[0]: + return self.default(line) + else: + try: + func = getattr(self, 'do_' + argv[0]) + except AttributeError: + return self.default(argv) + return func(argv) + + def do_build(self, argv): + """\ + build [TARGETS] Build the specified TARGETS and their + dependencies. 'b' is a synonym. + """ + import SCons.Node + import SCons.SConsign + import SCons.Script.Main + + options = copy.deepcopy(self.options) + + options, targets = self.parser.parse_args(argv[1:], values=options) + + SCons.Script.COMMAND_LINE_TARGETS = targets + + if targets: + SCons.Script.BUILD_TARGETS = targets + else: + # If the user didn't specify any targets on the command line, + # use the list of default targets. + SCons.Script.BUILD_TARGETS = SCons.Script._build_plus_default + + nodes = SCons.Script.Main._build_targets(self.fs, + options, + targets, + self.target_top) + + if not nodes: + return + + # Call each of the Node's alter_targets() methods, which may + # provide additional targets that ended up as part of the build + # (the canonical example being a VariantDir() when we're building + # from a source directory) and which we therefore need their + # state cleared, too. + x = [] + for n in nodes: + x.extend(n.alter_targets()[0]) + nodes.extend(x) + + # Clean up so that we can perform the next build correctly. + # + # We do this by walking over all the children of the targets, + # and clearing their state. + # + # We currently have to re-scan each node to find their + # children, because built nodes have already been partially + # cleared and don't remember their children. (In scons + # 0.96.1 and earlier, this wasn't the case, and we didn't + # have to re-scan the nodes.) + # + # Because we have to re-scan each node, we can't clear the + # nodes as we walk over them, because we may end up rescanning + # a cleared node as we scan a later node. Therefore, only + # store the list of nodes that need to be cleared as we walk + # the tree, and clear them in a separate pass. + # + # XXX: Someone more familiar with the inner workings of scons + # may be able to point out a more efficient way to do this. + + SCons.Script.Main.progress_display("scons: Clearing cached node information ...") + + seen_nodes = {} + + def get_unseen_children(node, parent, seen_nodes=seen_nodes): + def is_unseen(node, seen_nodes=seen_nodes): + return node not in seen_nodes + return list(filter(is_unseen, node.children(scan=1))) + + def add_to_seen_nodes(node, parent, seen_nodes=seen_nodes): + seen_nodes[node] = 1 + + # If this file is in a VariantDir and has a + # corresponding source file in the source tree, remember the + # node in the source tree, too. This is needed in + # particular to clear cached implicit dependencies on the + # source file, since the scanner will scan it if the + # VariantDir was created with duplicate=0. + try: + rfile_method = node.rfile + except AttributeError: + return + else: + rfile = rfile_method() + if rfile != node: + seen_nodes[rfile] = 1 + + for node in nodes: + walker = SCons.Node.Walker(node, + kids_func=get_unseen_children, + eval_func=add_to_seen_nodes) + n = walker.get_next() + while n: + n = walker.get_next() + + for node in seen_nodes.keys(): + # Call node.clear() to clear most of the state + node.clear() + # node.clear() doesn't reset node.state, so call + # node.set_state() to reset it manually + node.set_state(SCons.Node.no_state) + node.implicit = None + + # Debug: Uncomment to verify that all Taskmaster reference + # counts have been reset to zero. + #if node.ref_count != 0: + # from SCons.Debug import Trace + # Trace('node %s, ref_count %s !!!\n' % (node, node.ref_count)) + + SCons.SConsign.Reset() + SCons.Script.Main.progress_display("scons: done clearing node information.") + + def do_clean(self, argv): + """\ + clean [TARGETS] Clean (remove) the specified TARGETS + and their dependencies. 'c' is a synonym. + """ + return self.do_build(['build', '--clean'] + argv[1:]) + + def do_EOF(self, argv): + print + self.do_exit(argv) + + def _do_one_help(self, arg): + try: + # If help_() exists, then call it. + func = getattr(self, 'help_' + arg) + except AttributeError: + try: + func = getattr(self, 'do_' + arg) + except AttributeError: + doc = None + else: + doc = self._doc_to_help(func) + if doc: + sys.stdout.write(doc + '\n') + sys.stdout.flush() + else: + doc = self.strip_initial_spaces(func()) + if doc: + sys.stdout.write(doc + '\n') + sys.stdout.flush() + + def _doc_to_help(self, obj): + doc = obj.__doc__ + if doc is None: + return '' + return self._strip_initial_spaces(doc) + + def _strip_initial_spaces(self, s): + #lines = s.split('\n') + lines = s.split('\n') + spaces = re.match(' *', lines[0]).group(0) + #def strip_spaces(l): + # if l.startswith(spaces): + # l = l[len(spaces):] + # return l + #return '\n'.join([ strip_spaces(l) for l in lines ]) + def strip_spaces(l, spaces=spaces): + if l[:len(spaces)] == spaces: + l = l[len(spaces):] + return l + lines = list(map(strip_spaces, lines)) + return '\n'.join(lines) + + def do_exit(self, argv): + """\ + exit Exit SCons interactive mode. + """ + sys.exit(0) + + def do_help(self, argv): + """\ + help [COMMAND] Prints help for the specified COMMAND. 'h' + and '?' are synonyms. + """ + if argv[1:]: + for arg in argv[1:]: + if self._do_one_help(arg): + break + else: + # If bare 'help' is called, print this class's doc + # string (if it has one). + doc = self._doc_to_help(self.__class__) + if doc: + sys.stdout.write(doc + '\n') + sys.stdout.flush() + + def do_shell(self, argv): + """\ + shell [COMMANDLINE] Execute COMMANDLINE in a subshell. 'sh' and + '!' are synonyms. + """ + import subprocess + argv = argv[1:] + if not argv: + argv = os.environ[self.shell_variable] + try: + # Per "[Python-Dev] subprocess insufficiently platform-independent?" + # http://mail.python.org/pipermail/python-dev/2008-August/081979.html "+ + # Doing the right thing with an argument list currently + # requires different shell= values on Windows and Linux. + p = subprocess.Popen(argv, shell=(sys.platform=='win32')) + except EnvironmentError, e: + sys.stderr.write('scons: %s: %s\n' % (argv[0], e.strerror)) + else: + p.wait() + + def do_version(self, argv): + """\ + version Prints SCons version information. + """ + sys.stdout.write(self.parser.version + '\n') + +def interact(fs, parser, options, targets, target_top): + c = SConsInteractiveCmd(prompt = 'scons>>> ', + fs = fs, + parser = parser, + options = options, + targets = targets, + target_top = target_top) + c.cmdloop() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Script/Main.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Script/Main.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Script/Main.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Script/Main.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,1407 @@ +"""SCons.Script + +This file implements the main() function used by the scons script. + +Architecturally, this *is* the scons script, and will likely only be +called from the external "scons" wrapper. Consequently, anything here +should not be, or be considered, part of the build engine. If it's +something that we expect other software to want to use, it should go in +some other module. If it's specific to the "scons" script invocation, +it goes here. +""" + +unsupported_python_version = (2, 3, 0) +deprecated_python_version = (2, 7, 0) + +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Script/Main.py 2013/03/03 09:48:35 garyo" + +import SCons.compat + +import os +import sys +import time +import traceback + +# Strip the script directory from sys.path() so on case-insensitive +# (Windows) systems Python doesn't think that the "scons" script is the +# "SCons" package. Replace it with our own version directory so, if +# if they're there, we pick up the right version of the build engine +# modules. +#sys.path = [os.path.join(sys.prefix, +# 'lib', +# 'scons-%d' % SCons.__version__)] + sys.path[1:] + +import SCons.CacheDir +import SCons.Debug +import SCons.Defaults +import SCons.Environment +import SCons.Errors +import SCons.Job +import SCons.Node +import SCons.Node.FS +import SCons.Platform +import SCons.SConf +import SCons.Script +import SCons.Taskmaster +import SCons.Util +import SCons.Warnings + +import SCons.Script.Interactive + +def fetch_win32_parallel_msg(): + # A subsidiary function that exists solely to isolate this import + # so we don't have to pull it in on all platforms, and so that an + # in-line "import" statement in the _main() function below doesn't + # cause warnings about local names shadowing use of the 'SCons' + # globl in nest scopes and UnboundLocalErrors and the like in some + # versions (2.1) of Python. + import SCons.Platform.win32 + return SCons.Platform.win32.parallel_msg + +# + +class SConsPrintHelpException(Exception): + pass + +display = SCons.Util.display +progress_display = SCons.Util.DisplayEngine() + +first_command_start = None +last_command_end = None + +class Progressor(object): + prev = '' + count = 0 + target_string = '$TARGET' + + def __init__(self, obj, interval=1, file=None, overwrite=False): + if file is None: + file = sys.stdout + + self.obj = obj + self.file = file + self.interval = interval + self.overwrite = overwrite + + if callable(obj): + self.func = obj + elif SCons.Util.is_List(obj): + self.func = self.spinner + elif obj.find(self.target_string) != -1: + self.func = self.replace_string + else: + self.func = self.string + + def write(self, s): + self.file.write(s) + self.file.flush() + self.prev = s + + def erase_previous(self): + if self.prev: + length = len(self.prev) + if self.prev[-1] in ('\n', '\r'): + length = length - 1 + self.write(' ' * length + '\r') + self.prev = '' + + def spinner(self, node): + self.write(self.obj[self.count % len(self.obj)]) + + def string(self, node): + self.write(self.obj) + + def replace_string(self, node): + self.write(self.obj.replace(self.target_string, str(node))) + + def __call__(self, node): + self.count = self.count + 1 + if (self.count % self.interval) == 0: + if self.overwrite: + self.erase_previous() + self.func(node) + +ProgressObject = SCons.Util.Null() + +def Progress(*args, **kw): + global ProgressObject + ProgressObject = Progressor(*args, **kw) + +# Task control. +# + +_BuildFailures = [] + +def GetBuildFailures(): + return _BuildFailures + +class BuildTask(SCons.Taskmaster.OutOfDateTask): + """An SCons build task.""" + progress = ProgressObject + + def display(self, message): + display('scons: ' + message) + + def prepare(self): + self.progress(self.targets[0]) + return SCons.Taskmaster.OutOfDateTask.prepare(self) + + def needs_execute(self): + if SCons.Taskmaster.OutOfDateTask.needs_execute(self): + return True + if self.top and self.targets[0].has_builder(): + display("scons: `%s' is up to date." % str(self.node)) + return False + + def execute(self): + if print_time: + start_time = time.time() + global first_command_start + if first_command_start is None: + first_command_start = start_time + SCons.Taskmaster.OutOfDateTask.execute(self) + if print_time: + global cumulative_command_time + global last_command_end + finish_time = time.time() + last_command_end = finish_time + cumulative_command_time = cumulative_command_time+finish_time-start_time + sys.stdout.write("Command execution time: %s: %f seconds\n"%(str(self.node), finish_time-start_time)) + + def do_failed(self, status=2): + _BuildFailures.append(self.exception[1]) + global exit_status + global this_build_status + if self.options.ignore_errors: + SCons.Taskmaster.OutOfDateTask.executed(self) + elif self.options.keep_going: + SCons.Taskmaster.OutOfDateTask.fail_continue(self) + exit_status = status + this_build_status = status + else: + SCons.Taskmaster.OutOfDateTask.fail_stop(self) + exit_status = status + this_build_status = status + + def executed(self): + t = self.targets[0] + if self.top and not t.has_builder() and not t.side_effect: + if not t.exists(): + if t.__class__.__name__ in ('File', 'Dir', 'Entry'): + errstr="Do not know how to make %s target `%s' (%s)." % (t.__class__.__name__, t, t.abspath) + else: # Alias or Python or ... + errstr="Do not know how to make %s target `%s'." % (t.__class__.__name__, t) + sys.stderr.write("scons: *** " + errstr) + if not self.options.keep_going: + sys.stderr.write(" Stop.") + sys.stderr.write("\n") + try: + raise SCons.Errors.BuildError(t, errstr) + except KeyboardInterrupt: + raise + except: + self.exception_set() + self.do_failed() + else: + print "scons: Nothing to be done for `%s'." % t + SCons.Taskmaster.OutOfDateTask.executed(self) + else: + SCons.Taskmaster.OutOfDateTask.executed(self) + + def failed(self): + # Handle the failure of a build task. The primary purpose here + # is to display the various types of Errors and Exceptions + # appropriately. + exc_info = self.exc_info() + try: + t, e, tb = exc_info + except ValueError: + t, e = exc_info + tb = None + + if t is None: + # The Taskmaster didn't record an exception for this Task; + # see if the sys module has one. + try: + t, e, tb = sys.exc_info()[:] + except ValueError: + t, e = exc_info + tb = None + + # Deprecated string exceptions will have their string stored + # in the first entry of the tuple. + if e is None: + e = t + + buildError = SCons.Errors.convert_to_BuildError(e) + if not buildError.node: + buildError.node = self.node + + node = buildError.node + if not SCons.Util.is_List(node): + node = [ node ] + nodename = ', '.join(map(str, node)) + + errfmt = "scons: *** [%s] %s\n" + sys.stderr.write(errfmt % (nodename, buildError)) + + if (buildError.exc_info[2] and buildError.exc_info[1] and + not isinstance( + buildError.exc_info[1], + (EnvironmentError, SCons.Errors.StopError, + SCons.Errors.UserError))): + type, value, trace = buildError.exc_info + traceback.print_exception(type, value, trace) + elif tb and print_stacktrace: + sys.stderr.write("scons: internal stack trace:\n") + traceback.print_tb(tb, file=sys.stderr) + + self.exception = (e, buildError, tb) # type, value, traceback + self.do_failed(buildError.exitstatus) + + self.exc_clear() + + def postprocess(self): + if self.top: + t = self.targets[0] + for tp in self.options.tree_printers: + tp.display(t) + if self.options.debug_includes: + tree = t.render_include_tree() + if tree: + print + print tree + SCons.Taskmaster.OutOfDateTask.postprocess(self) + + def make_ready(self): + """Make a task ready for execution""" + SCons.Taskmaster.OutOfDateTask.make_ready(self) + if self.out_of_date and self.options.debug_explain: + explanation = self.out_of_date[0].explain() + if explanation: + sys.stdout.write("scons: " + explanation) + +class CleanTask(SCons.Taskmaster.AlwaysTask): + """An SCons clean task.""" + def fs_delete(self, path, pathstr, remove=1): + try: + if os.path.lexists(path): + if os.path.isfile(path) or os.path.islink(path): + if remove: os.unlink(path) + display("Removed " + pathstr) + elif os.path.isdir(path) and not os.path.islink(path): + # delete everything in the dir + for e in sorted(os.listdir(path)): + p = os.path.join(path, e) + s = os.path.join(pathstr, e) + if os.path.isfile(p): + if remove: os.unlink(p) + display("Removed " + s) + else: + self.fs_delete(p, s, remove) + # then delete dir itself + if remove: os.rmdir(path) + display("Removed directory " + pathstr) + else: + errstr = "Path '%s' exists but isn't a file or directory." + raise SCons.Errors.UserError(errstr % (pathstr)) + except SCons.Errors.UserError, e: + print e + except (IOError, OSError), e: + print "scons: Could not remove '%s':" % pathstr, e.strerror + + def show(self): + target = self.targets[0] + if (target.has_builder() or target.side_effect) and not target.noclean: + for t in self.targets: + if not t.isdir(): + display("Removed " + str(t)) + if target in SCons.Environment.CleanTargets: + files = SCons.Environment.CleanTargets[target] + for f in files: + self.fs_delete(f.abspath, str(f), 0) + + def remove(self): + target = self.targets[0] + if (target.has_builder() or target.side_effect) and not target.noclean: + for t in self.targets: + try: + removed = t.remove() + except OSError, e: + # An OSError may indicate something like a permissions + # issue, an IOError would indicate something like + # the file not existing. In either case, print a + # message and keep going to try to remove as many + # targets aa possible. + print "scons: Could not remove '%s':" % str(t), e.strerror + else: + if removed: + display("Removed " + str(t)) + if target in SCons.Environment.CleanTargets: + files = SCons.Environment.CleanTargets[target] + for f in files: + self.fs_delete(f.abspath, str(f)) + + execute = remove + + # We want the Taskmaster to update the Node states (and therefore + # handle reference counts, etc.), but we don't want to call + # back to the Node's post-build methods, which would do things + # we don't want, like store .sconsign information. + executed = SCons.Taskmaster.Task.executed_without_callbacks + + # Have the taskmaster arrange to "execute" all of the targets, because + # we'll figure out ourselves (in remove() or show() above) whether + # anything really needs to be done. + make_ready = SCons.Taskmaster.Task.make_ready_all + + def prepare(self): + pass + +class QuestionTask(SCons.Taskmaster.AlwaysTask): + """An SCons task for the -q (question) option.""" + def prepare(self): + pass + + def execute(self): + if self.targets[0].get_state() != SCons.Node.up_to_date or \ + (self.top and not self.targets[0].exists()): + global exit_status + global this_build_status + exit_status = 1 + this_build_status = 1 + self.tm.stop() + + def executed(self): + pass + + +class TreePrinter(object): + def __init__(self, derived=False, prune=False, status=False): + self.derived = derived + self.prune = prune + self.status = status + def get_all_children(self, node): + return node.all_children() + def get_derived_children(self, node): + children = node.all_children(None) + return [x for x in children if x.has_builder()] + def display(self, t): + if self.derived: + func = self.get_derived_children + else: + func = self.get_all_children + s = self.status and 2 or 0 + SCons.Util.print_tree(t, func, prune=self.prune, showtags=s) + + +def python_version_string(): + return sys.version.split()[0] + +def python_version_unsupported(version=sys.version_info): + return version < unsupported_python_version + +def python_version_deprecated(version=sys.version_info): + return version < deprecated_python_version + + +# Global variables + +print_objects = 0 +print_memoizer = 0 +print_stacktrace = 0 +print_time = 0 +sconscript_time = 0 +cumulative_command_time = 0 +exit_status = 0 # final exit status, assume success by default +this_build_status = 0 # "exit status" of an individual build +num_jobs = None +delayed_warnings = [] + +class FakeOptionParser(object): + """ + A do-nothing option parser, used for the initial OptionsParser variable. + + During normal SCons operation, the OptionsParser is created right + away by the main() function. Certain tests scripts however, can + introspect on different Tool modules, the initialization of which + can try to add a new, local option to an otherwise uninitialized + OptionsParser object. This allows that introspection to happen + without blowing up. + + """ + class FakeOptionValues(object): + def __getattr__(self, attr): + return None + values = FakeOptionValues() + def add_local_option(self, *args, **kw): + pass + +OptionsParser = FakeOptionParser() + +def AddOption(*args, **kw): + if 'default' not in kw: + kw['default'] = None + result = OptionsParser.add_local_option(*args, **kw) + return result + +def GetOption(name): + return getattr(OptionsParser.values, name) + +def SetOption(name, value): + return OptionsParser.values.set_option(name, value) + +# +class Stats(object): + def __init__(self): + self.stats = [] + self.labels = [] + self.append = self.do_nothing + self.print_stats = self.do_nothing + def enable(self, outfp): + self.outfp = outfp + self.append = self.do_append + self.print_stats = self.do_print + def do_nothing(self, *args, **kw): + pass + +class CountStats(Stats): + def do_append(self, label): + self.labels.append(label) + self.stats.append(SCons.Debug.fetchLoggedInstances()) + def do_print(self): + stats_table = {} + for s in self.stats: + for n in [t[0] for t in s]: + stats_table[n] = [0, 0, 0, 0] + i = 0 + for s in self.stats: + for n, c in s: + stats_table[n][i] = c + i = i + 1 + self.outfp.write("Object counts:\n") + pre = [" "] + post = [" %s\n"] + l = len(self.stats) + fmt1 = ''.join(pre + [' %7s']*l + post) + fmt2 = ''.join(pre + [' %7d']*l + post) + labels = self.labels[:l] + labels.append(("", "Class")) + self.outfp.write(fmt1 % tuple([x[0] for x in labels])) + self.outfp.write(fmt1 % tuple([x[1] for x in labels])) + for k in sorted(stats_table.keys()): + r = stats_table[k][:l] + [k] + self.outfp.write(fmt2 % tuple(r)) + +count_stats = CountStats() + +class MemStats(Stats): + def do_append(self, label): + self.labels.append(label) + self.stats.append(SCons.Debug.memory()) + def do_print(self): + fmt = 'Memory %-32s %12d\n' + for label, stats in zip(self.labels, self.stats): + self.outfp.write(fmt % (label, stats)) + +memory_stats = MemStats() + +# utility functions + +def _scons_syntax_error(e): + """Handle syntax errors. Print out a message and show where the error + occurred. + """ + etype, value, tb = sys.exc_info() + lines = traceback.format_exception_only(etype, value) + for line in lines: + sys.stderr.write(line+'\n') + sys.exit(2) + +def find_deepest_user_frame(tb): + """ + Find the deepest stack frame that is not part of SCons. + + Input is a "pre-processed" stack trace in the form + returned by traceback.extract_tb() or traceback.extract_stack() + """ + + tb.reverse() + + # find the deepest traceback frame that is not part + # of SCons: + for frame in tb: + filename = frame[0] + if filename.find(os.sep+'SCons'+os.sep) == -1: + return frame + return tb[0] + +def _scons_user_error(e): + """Handle user errors. Print out a message and a description of the + error, along with the line number and routine where it occured. + The file and line number will be the deepest stack frame that is + not part of SCons itself. + """ + global print_stacktrace + etype, value, tb = sys.exc_info() + if print_stacktrace: + traceback.print_exception(etype, value, tb) + filename, lineno, routine, dummy = find_deepest_user_frame(traceback.extract_tb(tb)) + sys.stderr.write("\nscons: *** %s\n" % value) + sys.stderr.write('File "%s", line %d, in %s\n' % (filename, lineno, routine)) + sys.exit(2) + +def _scons_user_warning(e): + """Handle user warnings. Print out a message and a description of + the warning, along with the line number and routine where it occured. + The file and line number will be the deepest stack frame that is + not part of SCons itself. + """ + etype, value, tb = sys.exc_info() + filename, lineno, routine, dummy = find_deepest_user_frame(traceback.extract_tb(tb)) + sys.stderr.write("\nscons: warning: %s\n" % e) + sys.stderr.write('File "%s", line %d, in %s\n' % (filename, lineno, routine)) + +def _scons_internal_warning(e): + """Slightly different from _scons_user_warning in that we use the + *current call stack* rather than sys.exc_info() to get our stack trace. + This is used by the warnings framework to print warnings.""" + filename, lineno, routine, dummy = find_deepest_user_frame(traceback.extract_stack()) + sys.stderr.write("\nscons: warning: %s\n" % e.args[0]) + sys.stderr.write('File "%s", line %d, in %s\n' % (filename, lineno, routine)) + +def _scons_internal_error(): + """Handle all errors but user errors. Print out a message telling + the user what to do in this case and print a normal trace. + """ + print 'internal error' + traceback.print_exc() + sys.exit(2) + +def _SConstruct_exists(dirname='', repositories=[], filelist=None): + """This function checks that an SConstruct file exists in a directory. + If so, it returns the path of the file. By default, it checks the + current directory. + """ + if not filelist: + filelist = ['SConstruct', 'Sconstruct', 'sconstruct'] + for file in filelist: + sfile = os.path.join(dirname, file) + if os.path.isfile(sfile): + return sfile + if not os.path.isabs(sfile): + for rep in repositories: + if os.path.isfile(os.path.join(rep, sfile)): + return sfile + return None + +def _set_debug_values(options): + global print_memoizer, print_objects, print_stacktrace, print_time + + debug_values = options.debug + + if "count" in debug_values: + # All of the object counts are within "if __debug__:" blocks, + # which get stripped when running optimized (with python -O or + # from compiled *.pyo files). Provide a warning if __debug__ is + # stripped, so it doesn't just look like --debug=count is broken. + enable_count = False + if __debug__: enable_count = True + if enable_count: + count_stats.enable(sys.stdout) + else: + msg = "--debug=count is not supported when running SCons\n" + \ + "\twith the python -O option or optimized (.pyo) modules." + SCons.Warnings.warn(SCons.Warnings.NoObjectCountWarning, msg) + if "dtree" in debug_values: + options.tree_printers.append(TreePrinter(derived=True)) + options.debug_explain = ("explain" in debug_values) + if "findlibs" in debug_values: + SCons.Scanner.Prog.print_find_libs = "findlibs" + options.debug_includes = ("includes" in debug_values) + print_memoizer = ("memoizer" in debug_values) + if "memory" in debug_values: + memory_stats.enable(sys.stdout) + print_objects = ("objects" in debug_values) + if "presub" in debug_values: + SCons.Action.print_actions_presub = 1 + if "stacktrace" in debug_values: + print_stacktrace = 1 + if "stree" in debug_values: + options.tree_printers.append(TreePrinter(status=True)) + if "time" in debug_values: + print_time = 1 + if "tree" in debug_values: + options.tree_printers.append(TreePrinter()) + if "prepare" in debug_values: + SCons.Taskmaster.print_prepare = 1 + if "duplicate" in debug_values: + SCons.Node.FS.print_duplicate = 1 + +def _create_path(plist): + path = '.' + for d in plist: + if os.path.isabs(d): + path = d + else: + path = path + '/' + d + return path + +def _load_site_scons_dir(topdir, site_dir_name=None): + """Load the site_scons dir under topdir. + Prepends site_scons to sys.path, imports site_scons/site_init.py, + and prepends site_scons/site_tools to default toolpath.""" + if site_dir_name: + err_if_not_found = True # user specified: err if missing + else: + site_dir_name = "site_scons" + err_if_not_found = False + + site_dir = os.path.join(topdir, site_dir_name) + if not os.path.exists(site_dir): + if err_if_not_found: + raise SCons.Errors.UserError("site dir %s not found."%site_dir) + return + + site_init_filename = "site_init.py" + site_init_modname = "site_init" + site_tools_dirname = "site_tools" + # prepend to sys.path + sys.path = [os.path.abspath(site_dir)] + sys.path + site_init_file = os.path.join(site_dir, site_init_filename) + site_tools_dir = os.path.join(site_dir, site_tools_dirname) + if os.path.exists(site_init_file): + import imp, re + # TODO(2.4): turn this into try:-except:-finally: + try: + try: + fp, pathname, description = imp.find_module(site_init_modname, + [site_dir]) + # Load the file into SCons.Script namespace. This is + # opaque and clever; m is the module object for the + # SCons.Script module, and the exec ... in call executes a + # file (or string containing code) in the context of the + # module's dictionary, so anything that code defines ends + # up adding to that module. This is really short, but all + # the error checking makes it longer. + try: + m = sys.modules['SCons.Script'] + except Exception, e: + fmt = 'cannot import site_init.py: missing SCons.Script module %s' + raise SCons.Errors.InternalError(fmt % repr(e)) + try: + sfx = description[0] + modname = os.path.basename(pathname)[:-len(sfx)] + site_m = {"__file__": pathname, "__name__": modname, "__doc__": None} + re_special = re.compile("__[^_]+__") + for k in m.__dict__.keys(): + if not re_special.match(k): + site_m[k] = m.__dict__[k] + + # This is the magic. + exec fp in site_m + except KeyboardInterrupt: + raise + except Exception, e: + fmt = '*** Error loading site_init file %s:\n' + sys.stderr.write(fmt % repr(site_init_file)) + raise + else: + for k in site_m: + if not re_special.match(k): + m.__dict__[k] = site_m[k] + except KeyboardInterrupt: + raise + except ImportError, e: + fmt = '*** cannot import site init file %s:\n' + sys.stderr.write(fmt % repr(site_init_file)) + raise + finally: + if fp: + fp.close() + if os.path.exists(site_tools_dir): + # prepend to DefaultToolpath + SCons.Tool.DefaultToolpath.insert(0, os.path.abspath(site_tools_dir)) + +def _load_all_site_scons_dirs(topdir, verbose=None): + """Load all of the predefined site_scons dir. + Order is significant; we load them in order from most generic + (machine-wide) to most specific (topdir). + The verbose argument is only for testing. + """ + platform = SCons.Platform.platform_default() + + def homedir(d): + return os.path.expanduser('~/'+d) + + if platform == 'win32' or platform == 'cygwin': + # Note we use $ here instead of %...% because older + # pythons (prior to 2.6?) didn't expand %...% on Windows. + # This set of dirs should work on XP, Vista, 7 and later. + sysdirs=[ + os.path.expandvars('$ALLUSERSPROFILE\\Application Data\\scons'), + os.path.expandvars('$USERPROFILE\\Local Settings\\Application Data\\scons')] + appdatadir = os.path.expandvars('$APPDATA\\scons') + if appdatadir not in sysdirs: + sysdirs.append(appdatadir) + sysdirs.append(homedir('.scons')) + + elif platform == 'darwin': # MacOS X + sysdirs=['/Library/Application Support/SCons', + '/opt/local/share/scons', # (for MacPorts) + '/sw/share/scons', # (for Fink) + homedir('Library/Application Support/SCons'), + homedir('.scons')] + elif platform == 'sunos': # Solaris + sysdirs=['/opt/sfw/scons', + '/usr/share/scons', + homedir('.scons')] + else: # Linux, HPUX, etc. + # assume posix-like, i.e. platform == 'posix' + sysdirs=['/usr/share/scons', + homedir('.scons')] + + dirs=sysdirs + [topdir] + for d in dirs: + if verbose: # this is used by unit tests. + print "Loading site dir ", d + _load_site_scons_dir(d) + +def test_load_all_site_scons_dirs(d): + _load_all_site_scons_dirs(d, True) + +def version_string(label, module): + version = module.__version__ + build = module.__build__ + if build: + if build[0] != '.': + build = '.' + build + version = version + build + fmt = "\t%s: v%s, %s, by %s on %s\n" + return fmt % (label, + version, + module.__date__, + module.__developer__, + module.__buildsys__) + +def path_string(label, module): + path = module.__path__ + return "\t%s path: %s\n"%(label,path) + +def _main(parser): + global exit_status + global this_build_status + + options = parser.values + + # Here's where everything really happens. + + # First order of business: set up default warnings and then + # handle the user's warning options, so that we can issue (or + # suppress) appropriate warnings about anything that might happen, + # as configured by the user. + + default_warnings = [ SCons.Warnings.WarningOnByDefault, + SCons.Warnings.DeprecatedWarning, + ] + + for warning in default_warnings: + SCons.Warnings.enableWarningClass(warning) + SCons.Warnings._warningOut = _scons_internal_warning + SCons.Warnings.process_warn_strings(options.warn) + + # Now that we have the warnings configuration set up, we can actually + # issue (or suppress) any warnings about warning-worthy things that + # occurred while the command-line options were getting parsed. + try: + dw = options.delayed_warnings + except AttributeError: + pass + else: + delayed_warnings.extend(dw) + for warning_type, message in delayed_warnings: + SCons.Warnings.warn(warning_type, message) + + if options.diskcheck: + SCons.Node.FS.set_diskcheck(options.diskcheck) + + # Next, we want to create the FS object that represents the outside + # world's file system, as that's central to a lot of initialization. + # To do this, however, we need to be in the directory from which we + # want to start everything, which means first handling any relevant + # options that might cause us to chdir somewhere (-C, -D, -U, -u). + if options.directory: + script_dir = os.path.abspath(_create_path(options.directory)) + else: + script_dir = os.getcwd() + + target_top = None + if options.climb_up: + target_top = '.' # directory to prepend to targets + while script_dir and not _SConstruct_exists(script_dir, + options.repository, + options.file): + script_dir, last_part = os.path.split(script_dir) + if last_part: + target_top = os.path.join(last_part, target_top) + else: + script_dir = '' + + if script_dir and script_dir != os.getcwd(): + if not options.silent: + display("scons: Entering directory `%s'" % script_dir) + try: + os.chdir(script_dir) + except OSError: + sys.stderr.write("Could not change directory to %s\n" % script_dir) + + # Now that we're in the top-level SConstruct directory, go ahead + # and initialize the FS object that represents the file system, + # and make it the build engine default. + fs = SCons.Node.FS.get_default_fs() + + for rep in options.repository: + fs.Repository(rep) + + # Now that we have the FS object, the next order of business is to + # check for an SConstruct file (or other specified config file). + # If there isn't one, we can bail before doing any more work. + scripts = [] + if options.file: + scripts.extend(options.file) + if not scripts: + sfile = _SConstruct_exists(repositories=options.repository, + filelist=options.file) + if sfile: + scripts.append(sfile) + + if not scripts: + if options.help: + # There's no SConstruct, but they specified -h. + # Give them the options usage now, before we fail + # trying to read a non-existent SConstruct file. + raise SConsPrintHelpException + raise SCons.Errors.UserError("No SConstruct file found.") + + if scripts[0] == "-": + d = fs.getcwd() + else: + d = fs.File(scripts[0]).dir + fs.set_SConstruct_dir(d) + + _set_debug_values(options) + SCons.Node.implicit_cache = options.implicit_cache + SCons.Node.implicit_deps_changed = options.implicit_deps_changed + SCons.Node.implicit_deps_unchanged = options.implicit_deps_unchanged + + if options.no_exec: + SCons.SConf.dryrun = 1 + SCons.Action.execute_actions = None + if options.question: + SCons.SConf.dryrun = 1 + if options.clean: + SCons.SConf.SetBuildType('clean') + if options.help: + SCons.SConf.SetBuildType('help') + SCons.SConf.SetCacheMode(options.config) + SCons.SConf.SetProgressDisplay(progress_display) + + if options.no_progress or options.silent: + progress_display.set_mode(0) + + if options.site_dir: + _load_site_scons_dir(d.path, options.site_dir) + elif not options.no_site_dir: + _load_all_site_scons_dirs(d.path) + + if options.include_dir: + sys.path = options.include_dir + sys.path + + # That should cover (most of) the options. Next, set up the variables + # that hold command-line arguments, so the SConscript files that we + # read and execute have access to them. + targets = [] + xmit_args = [] + for a in parser.largs: + if a[:1] == '-': + continue + if '=' in a: + xmit_args.append(a) + else: + targets.append(a) + SCons.Script._Add_Targets(targets + parser.rargs) + SCons.Script._Add_Arguments(xmit_args) + + # If stdout is not a tty, replace it with a wrapper object to call flush + # after every write. + # + # Tty devices automatically flush after every newline, so the replacement + # isn't necessary. Furthermore, if we replace sys.stdout, the readline + # module will no longer work. This affects the behavior during + # --interactive mode. --interactive should only be used when stdin and + # stdout refer to a tty. + if not hasattr(sys.stdout, 'isatty') or not sys.stdout.isatty(): + sys.stdout = SCons.Util.Unbuffered(sys.stdout) + if not hasattr(sys.stderr, 'isatty') or not sys.stderr.isatty(): + sys.stderr = SCons.Util.Unbuffered(sys.stderr) + + memory_stats.append('before reading SConscript files:') + count_stats.append(('pre-', 'read')) + + # And here's where we (finally) read the SConscript files. + + progress_display("scons: Reading SConscript files ...") + + start_time = time.time() + try: + for script in scripts: + SCons.Script._SConscript._SConscript(fs, script) + except SCons.Errors.StopError, e: + # We had problems reading an SConscript file, such as it + # couldn't be copied in to the VariantDir. Since we're just + # reading SConscript files and haven't started building + # things yet, stop regardless of whether they used -i or -k + # or anything else. + sys.stderr.write("scons: *** %s Stop.\n" % e) + exit_status = 2 + sys.exit(exit_status) + global sconscript_time + sconscript_time = time.time() - start_time + + progress_display("scons: done reading SConscript files.") + + memory_stats.append('after reading SConscript files:') + count_stats.append(('post-', 'read')) + + # Re-{enable,disable} warnings in case they disabled some in + # the SConscript file. + # + # We delay enabling the PythonVersionWarning class until here so that, + # if they explicity disabled it in either in the command line or in + # $SCONSFLAGS, or in the SConscript file, then the search through + # the list of deprecated warning classes will find that disabling + # first and not issue the warning. + #SCons.Warnings.enableWarningClass(SCons.Warnings.PythonVersionWarning) + SCons.Warnings.process_warn_strings(options.warn) + + # Now that we've read the SConscript files, we can check for the + # warning about deprecated Python versions--delayed until here + # in case they disabled the warning in the SConscript files. + if python_version_deprecated(): + msg = "Support for pre-%s Python version (%s) is deprecated.\n" + \ + " If this will cause hardship, contact dev@scons.tigris.org." + deprecated_version_string = ".".join(map(str, deprecated_python_version)) + SCons.Warnings.warn(SCons.Warnings.PythonVersionWarning, + msg % (deprecated_version_string, python_version_string())) + + if not options.help: + SCons.SConf.CreateConfigHBuilder(SCons.Defaults.DefaultEnvironment()) + + # Now re-parse the command-line options (any to the left of a '--' + # argument, that is) with any user-defined command-line options that + # the SConscript files may have added to the parser object. This will + # emit the appropriate error message and exit if any unknown option + # was specified on the command line. + + parser.preserve_unknown_options = False + parser.parse_args(parser.largs, options) + + if options.help: + help_text = SCons.Script.help_text + if help_text is None: + # They specified -h, but there was no Help() inside the + # SConscript files. Give them the options usage. + raise SConsPrintHelpException + else: + print help_text + print "Use scons -H for help about command-line options." + exit_status = 0 + return + + # Change directory to the top-level SConstruct directory, then tell + # the Node.FS subsystem that we're all done reading the SConscript + # files and calling Repository() and VariantDir() and changing + # directories and the like, so it can go ahead and start memoizing + # the string values of file system nodes. + + fs.chdir(fs.Top) + + SCons.Node.FS.save_strings(1) + + # Now that we've read the SConscripts we can set the options + # that are SConscript settable: + SCons.Node.implicit_cache = options.implicit_cache + SCons.Node.FS.set_duplicate(options.duplicate) + fs.set_max_drift(options.max_drift) + + SCons.Job.explicit_stack_size = options.stack_size + + if options.md5_chunksize: + SCons.Node.FS.File.md5_chunksize = options.md5_chunksize + + platform = SCons.Platform.platform_module() + + if options.interactive: + SCons.Script.Interactive.interact(fs, OptionsParser, options, + targets, target_top) + + else: + + # Build the targets + nodes = _build_targets(fs, options, targets, target_top) + if not nodes: + exit_status = 2 + +def _build_targets(fs, options, targets, target_top): + + global this_build_status + this_build_status = 0 + + progress_display.set_mode(not (options.no_progress or options.silent)) + display.set_mode(not options.silent) + SCons.Action.print_actions = not options.silent + SCons.Action.execute_actions = not options.no_exec + SCons.Node.FS.do_store_info = not options.no_exec + SCons.SConf.dryrun = options.no_exec + + if options.diskcheck: + SCons.Node.FS.set_diskcheck(options.diskcheck) + + SCons.CacheDir.cache_enabled = not options.cache_disable + SCons.CacheDir.cache_debug = options.cache_debug + SCons.CacheDir.cache_force = options.cache_force + SCons.CacheDir.cache_show = options.cache_show + + if options.no_exec: + CleanTask.execute = CleanTask.show + else: + CleanTask.execute = CleanTask.remove + + lookup_top = None + if targets or SCons.Script.BUILD_TARGETS != SCons.Script._build_plus_default: + # They specified targets on the command line or modified + # BUILD_TARGETS in the SConscript file(s), so if they used -u, + # -U or -D, we have to look up targets relative to the top, + # but we build whatever they specified. + if target_top: + lookup_top = fs.Dir(target_top) + target_top = None + + targets = SCons.Script.BUILD_TARGETS + else: + # There are no targets specified on the command line, + # so if they used -u, -U or -D, we may have to restrict + # what actually gets built. + d = None + if target_top: + if options.climb_up == 1: + # -u, local directory and below + target_top = fs.Dir(target_top) + lookup_top = target_top + elif options.climb_up == 2: + # -D, all Default() targets + target_top = None + lookup_top = None + elif options.climb_up == 3: + # -U, local SConscript Default() targets + target_top = fs.Dir(target_top) + def check_dir(x, target_top=target_top): + if hasattr(x, 'cwd') and not x.cwd is None: + cwd = x.cwd.srcnode() + return cwd == target_top + else: + # x doesn't have a cwd, so it's either not a target, + # or not a file, so go ahead and keep it as a default + # target and let the engine sort it out: + return 1 + d = list(filter(check_dir, SCons.Script.DEFAULT_TARGETS)) + SCons.Script.DEFAULT_TARGETS[:] = d + target_top = None + lookup_top = None + + targets = SCons.Script._Get_Default_Targets(d, fs) + + if not targets: + sys.stderr.write("scons: *** No targets specified and no Default() targets found. Stop.\n") + return None + + def Entry(x, ltop=lookup_top, ttop=target_top, fs=fs): + if isinstance(x, SCons.Node.Node): + node = x + else: + node = None + # Why would ltop be None? Unfortunately this happens. + if ltop is None: ltop = '' + # Curdir becomes important when SCons is called with -u, -C, + # or similar option that changes directory, and so the paths + # of targets given on the command line need to be adjusted. + curdir = os.path.join(os.getcwd(), str(ltop)) + for lookup in SCons.Node.arg2nodes_lookups: + node = lookup(x, curdir=curdir) + if node is not None: + break + if node is None: + node = fs.Entry(x, directory=ltop, create=1) + if ttop and not node.is_under(ttop): + if isinstance(node, SCons.Node.FS.Dir) and ttop.is_under(node): + node = ttop + else: + node = None + return node + + nodes = [_f for _f in map(Entry, targets) if _f] + + task_class = BuildTask # default action is to build targets + opening_message = "Building targets ..." + closing_message = "done building targets." + if options.keep_going: + failure_message = "done building targets (errors occurred during build)." + else: + failure_message = "building terminated because of errors." + if options.question: + task_class = QuestionTask + try: + if options.clean: + task_class = CleanTask + opening_message = "Cleaning targets ..." + closing_message = "done cleaning targets." + if options.keep_going: + failure_message = "done cleaning targets (errors occurred during clean)." + else: + failure_message = "cleaning terminated because of errors." + except AttributeError: + pass + + task_class.progress = ProgressObject + + if options.random: + def order(dependencies): + """Randomize the dependencies.""" + import random + # This is cribbed from the implementation of + # random.shuffle() in Python 2.X. + d = dependencies + for i in range(len(d)-1, 0, -1): + j = int(random.random() * (i+1)) + d[i], d[j] = d[j], d[i] + return d + else: + def order(dependencies): + """Leave the order of dependencies alone.""" + return dependencies + + if options.taskmastertrace_file == '-': + tmtrace = sys.stdout + elif options.taskmastertrace_file: + tmtrace = open(options.taskmastertrace_file, 'wb') + else: + tmtrace = None + taskmaster = SCons.Taskmaster.Taskmaster(nodes, task_class, order, tmtrace) + + # Let the BuildTask objects get at the options to respond to the + # various print_* settings, tree_printer list, etc. + BuildTask.options = options + + global num_jobs + num_jobs = options.num_jobs + jobs = SCons.Job.Jobs(num_jobs, taskmaster) + if num_jobs > 1: + msg = None + if jobs.num_jobs == 1: + msg = "parallel builds are unsupported by this version of Python;\n" + \ + "\tignoring -j or num_jobs option.\n" + elif sys.platform == 'win32': + msg = fetch_win32_parallel_msg() + if msg: + SCons.Warnings.warn(SCons.Warnings.NoParallelSupportWarning, msg) + + memory_stats.append('before building targets:') + count_stats.append(('pre-', 'build')) + + def jobs_postfunc( + jobs=jobs, + options=options, + closing_message=closing_message, + failure_message=failure_message + ): + if jobs.were_interrupted(): + if not options.no_progress and not options.silent: + sys.stderr.write("scons: Build interrupted.\n") + global exit_status + global this_build_status + exit_status = 2 + this_build_status = 2 + + if this_build_status: + progress_display("scons: " + failure_message) + else: + progress_display("scons: " + closing_message) + if not options.no_exec: + if jobs.were_interrupted(): + progress_display("scons: writing .sconsign file.") + SCons.SConsign.write() + + progress_display("scons: " + opening_message) + jobs.run(postfunc = jobs_postfunc) + + memory_stats.append('after building targets:') + count_stats.append(('post-', 'build')) + + return nodes + +def _exec_main(parser, values): + sconsflags = os.environ.get('SCONSFLAGS', '') + all_args = sconsflags.split() + sys.argv[1:] + + options, args = parser.parse_args(all_args, values) + + if isinstance(options.debug, list) and "pdb" in options.debug: + import pdb + pdb.Pdb().runcall(_main, parser) + elif options.profile_file: + # compat layer imports "cProfile" for us if it's available. + from profile import Profile + + # Some versions of Python 2.4 shipped a profiler that had the + # wrong 'c_exception' entry in its dispatch table. Make sure + # we have the right one. (This may put an unnecessary entry + # in the table in earlier versions of Python, but its presence + # shouldn't hurt anything). + try: + dispatch = Profile.dispatch + except AttributeError: + pass + else: + dispatch['c_exception'] = Profile.trace_dispatch_return + + prof = Profile() + try: + prof.runcall(_main, parser) + except SConsPrintHelpException, e: + prof.dump_stats(options.profile_file) + raise e + except SystemExit: + pass + prof.dump_stats(options.profile_file) + else: + _main(parser) + +def main(): + global OptionsParser + global exit_status + global first_command_start + + # Check up front for a Python version we do not support. We + # delay the check for deprecated Python versions until later, + # after the SConscript files have been read, in case they + # disable that warning. + if python_version_unsupported(): + msg = "scons: *** SCons version %s does not run under Python version %s.\n" + sys.stderr.write(msg % (SCons.__version__, python_version_string())) + sys.exit(1) + + parts = ["SCons by Steven Knight et al.:\n"] + try: + import __main__ + parts.append(version_string("script", __main__)) + except (ImportError, AttributeError): + # On Windows there is no scons.py, so there is no + # __main__.__version__, hence there is no script version. + pass + parts.append(version_string("engine", SCons)) + parts.append(path_string("engine", SCons)) + parts.append("Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation") + version = ''.join(parts) + + import SConsOptions + parser = SConsOptions.Parser(version) + values = SConsOptions.SConsValues(parser.get_default_values()) + + OptionsParser = parser + + try: + _exec_main(parser, values) + except SystemExit, s: + if s: + exit_status = s + except KeyboardInterrupt: + print("scons: Build interrupted.") + sys.exit(2) + except SyntaxError, e: + _scons_syntax_error(e) + except SCons.Errors.InternalError: + _scons_internal_error() + except SCons.Errors.UserError, e: + _scons_user_error(e) + except SConsPrintHelpException: + parser.print_help() + exit_status = 0 + except SCons.Errors.BuildError, e: + exit_status = e.exitstatus + except: + # An exception here is likely a builtin Python exception Python + # code in an SConscript file. Show them precisely what the + # problem was and where it happened. + SCons.Script._SConscript.SConscript_exception() + sys.exit(2) + + memory_stats.print_stats() + count_stats.print_stats() + + if print_objects: + SCons.Debug.listLoggedInstances('*') + #SCons.Debug.dumpLoggedInstances('*') + + if print_memoizer: + SCons.Memoize.Dump("Memoizer (memory cache) hits and misses:") + + # Dump any development debug info that may have been enabled. + # These are purely for internal debugging during development, so + # there's no need to control them with --debug= options; they're + # controlled by changing the source code. + SCons.Debug.dump_caller_counts() + SCons.Taskmaster.dump_stats() + + if print_time: + total_time = time.time() - SCons.Script.start_time + if num_jobs == 1: + ct = cumulative_command_time + else: + if last_command_end is None or first_command_start is None: + ct = 0.0 + else: + ct = last_command_end - first_command_start + scons_time = total_time - sconscript_time - ct + print "Total build time: %f seconds"%total_time + print "Total SConscript file execution time: %f seconds"%sconscript_time + print "Total SCons execution time: %f seconds"%scons_time + print "Total command execution time: %f seconds"%ct + + sys.exit(exit_status) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Script/SConsOptions.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Script/SConsOptions.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Script/SConsOptions.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Script/SConsOptions.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,946 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Script/SConsOptions.py 2013/03/03 09:48:35 garyo" + +import optparse +import re +import sys +import textwrap + +no_hyphen_re = re.compile(r'(\s+|(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') + +try: + from gettext import gettext +except ImportError: + def gettext(message): + return message +_ = gettext + +import SCons.Node.FS +import SCons.Warnings + +OptionValueError = optparse.OptionValueError +SUPPRESS_HELP = optparse.SUPPRESS_HELP + +diskcheck_all = SCons.Node.FS.diskcheck_types() + +def diskcheck_convert(value): + if value is None: + return [] + if not SCons.Util.is_List(value): + value = value.split(',') + result = [] + for v in value: + v = v.lower() + if v == 'all': + result = diskcheck_all + elif v == 'none': + result = [] + elif v in diskcheck_all: + result.append(v) + else: + raise ValueError(v) + return result + +class SConsValues(optparse.Values): + """ + Holder class for uniform access to SCons options, regardless + of whether or not they can be set on the command line or in the + SConscript files (using the SetOption() function). + + A SCons option value can originate three different ways: + + 1) set on the command line; + 2) set in an SConscript file; + 3) the default setting (from the the op.add_option() + calls in the Parser() function, below). + + The command line always overrides a value set in a SConscript file, + which in turn always overrides default settings. Because we want + to support user-specified options in the SConscript file itself, + though, we may not know about all of the options when the command + line is first parsed, so we can't make all the necessary precedence + decisions at the time the option is configured. + + The solution implemented in this class is to keep these different sets + of settings separate (command line, SConscript file, and default) + and to override the __getattr__() method to check them in turn. + This should allow the rest of the code to just fetch values as + attributes of an instance of this class, without having to worry + about where they came from. + + Note that not all command line options are settable from SConscript + files, and the ones that are must be explicitly added to the + "settable" list in this class, and optionally validated and coerced + in the set_option() method. + """ + + def __init__(self, defaults): + self.__dict__['__defaults__'] = defaults + self.__dict__['__SConscript_settings__'] = {} + + def __getattr__(self, attr): + """ + Fetches an options value, checking first for explicit settings + from the command line (which are direct attributes), then the + SConscript file settings, then the default values. + """ + try: + return self.__dict__[attr] + except KeyError: + try: + return self.__dict__['__SConscript_settings__'][attr] + except KeyError: + return getattr(self.__dict__['__defaults__'], attr) + + settable = [ + 'clean', + 'diskcheck', + 'duplicate', + 'help', + 'implicit_cache', + 'max_drift', + 'md5_chunksize', + 'no_exec', + 'num_jobs', + 'random', + 'stack_size', + 'warn', + ] + + def set_option(self, name, value): + """ + Sets an option from an SConscript file. + """ + if not name in self.settable: + raise SCons.Errors.UserError("This option is not settable from a SConscript file: %s"%name) + + if name == 'num_jobs': + try: + value = int(value) + if value < 1: + raise ValueError + except ValueError: + raise SCons.Errors.UserError("A positive integer is required: %s"%repr(value)) + elif name == 'max_drift': + try: + value = int(value) + except ValueError: + raise SCons.Errors.UserError("An integer is required: %s"%repr(value)) + elif name == 'duplicate': + try: + value = str(value) + except ValueError: + raise SCons.Errors.UserError("A string is required: %s"%repr(value)) + if not value in SCons.Node.FS.Valid_Duplicates: + raise SCons.Errors.UserError("Not a valid duplication style: %s" % value) + # Set the duplicate style right away so it can affect linking + # of SConscript files. + SCons.Node.FS.set_duplicate(value) + elif name == 'diskcheck': + try: + value = diskcheck_convert(value) + except ValueError, v: + raise SCons.Errors.UserError("Not a valid diskcheck value: %s"%v) + if 'diskcheck' not in self.__dict__: + # No --diskcheck= option was specified on the command line. + # Set this right away so it can affect the rest of the + # file/Node lookups while processing the SConscript files. + SCons.Node.FS.set_diskcheck(value) + elif name == 'stack_size': + try: + value = int(value) + except ValueError: + raise SCons.Errors.UserError("An integer is required: %s"%repr(value)) + elif name == 'md5_chunksize': + try: + value = int(value) + except ValueError: + raise SCons.Errors.UserError("An integer is required: %s"%repr(value)) + elif name == 'warn': + if SCons.Util.is_String(value): + value = [value] + value = self.__SConscript_settings__.get(name, []) + value + SCons.Warnings.process_warn_strings(value) + + self.__SConscript_settings__[name] = value + +class SConsOption(optparse.Option): + def convert_value(self, opt, value): + if value is not None: + if self.nargs in (1, '?'): + return self.check_value(opt, value) + else: + return tuple([self.check_value(opt, v) for v in value]) + + def process(self, opt, value, values, parser): + + # First, convert the value(s) to the right type. Howl if any + # value(s) are bogus. + value = self.convert_value(opt, value) + + # And then take whatever action is expected of us. + # This is a separate method to make life easier for + # subclasses to add new actions. + return self.take_action( + self.action, self.dest, opt, value, values, parser) + + def _check_nargs_optional(self): + if self.nargs == '?' and self._short_opts: + fmt = "option %s: nargs='?' is incompatible with short options" + raise SCons.Errors.UserError(fmt % self._short_opts[0]) + + try: + _orig_CONST_ACTIONS = optparse.Option.CONST_ACTIONS + + _orig_CHECK_METHODS = optparse.Option.CHECK_METHODS + + except AttributeError: + # optparse.Option had no CONST_ACTIONS before Python 2.5. + + _orig_CONST_ACTIONS = ("store_const",) + + def _check_const(self): + if self.action not in self.CONST_ACTIONS and self.const is not None: + raise OptionError( + "'const' must not be supplied for action %r" % self.action, + self) + + # optparse.Option collects its list of unbound check functions + # up front. This sucks because it means we can't just override + # the _check_const() function like a normal method, we have to + # actually replace it in the list. This seems to be the most + # straightforward way to do that. + + _orig_CHECK_METHODS = [optparse.Option._check_action, + optparse.Option._check_type, + optparse.Option._check_choice, + optparse.Option._check_dest, + _check_const, + optparse.Option._check_nargs, + optparse.Option._check_callback] + + CHECK_METHODS = _orig_CHECK_METHODS + [_check_nargs_optional] + + CONST_ACTIONS = _orig_CONST_ACTIONS + optparse.Option.TYPED_ACTIONS + +class SConsOptionGroup(optparse.OptionGroup): + """ + A subclass for SCons-specific option groups. + + The only difference between this and the base class is that we print + the group's help text flush left, underneath their own title but + lined up with the normal "SCons Options". + """ + def format_help(self, formatter): + """ + Format an option group's help text, outdenting the title so it's + flush with the "SCons Options" title we print at the top. + """ + formatter.dedent() + result = formatter.format_heading(self.title) + formatter.indent() + result = result + optparse.OptionContainer.format_help(self, formatter) + return result + +class SConsOptionParser(optparse.OptionParser): + preserve_unknown_options = False + + def error(self, msg): + # overriden OptionValueError exception handler + self.print_usage(sys.stderr) + sys.stderr.write("SCons Error: %s\n" % msg) + sys.exit(2) + + def _process_long_opt(self, rargs, values): + """ + SCons-specific processing of long options. + + This is copied directly from the normal + optparse._process_long_opt() method, except that, if configured + to do so, we catch the exception thrown when an unknown option + is encountered and just stick it back on the "leftover" arguments + for later (re-)processing. + """ + arg = rargs.pop(0) + + # Value explicitly attached to arg? Pretend it's the next + # argument. + if "=" in arg: + (opt, next_arg) = arg.split("=", 1) + rargs.insert(0, next_arg) + had_explicit_value = True + else: + opt = arg + had_explicit_value = False + + try: + opt = self._match_long_opt(opt) + except optparse.BadOptionError: + if self.preserve_unknown_options: + # SCons-specific: if requested, add unknown options to + # the "leftover arguments" list for later processing. + self.largs.append(arg) + if had_explicit_value: + # The unknown option will be re-processed later, + # so undo the insertion of the explicit value. + rargs.pop(0) + return + raise + + option = self._long_opt[opt] + if option.takes_value(): + nargs = option.nargs + if nargs == '?': + if had_explicit_value: + value = rargs.pop(0) + else: + value = option.const + elif len(rargs) < nargs: + if nargs == 1: + self.error(_("%s option requires an argument") % opt) + else: + self.error(_("%s option requires %d arguments") + % (opt, nargs)) + elif nargs == 1: + value = rargs.pop(0) + else: + value = tuple(rargs[0:nargs]) + del rargs[0:nargs] + + elif had_explicit_value: + self.error(_("%s option does not take a value") % opt) + + else: + value = None + + option.process(opt, value, values, self) + + def add_local_option(self, *args, **kw): + """ + Adds a local option to the parser. + + This is initiated by a SetOption() call to add a user-defined + command-line option. We add the option to a separate option + group for the local options, creating the group if necessary. + """ + try: + group = self.local_option_group + except AttributeError: + group = SConsOptionGroup(self, 'Local Options') + group = self.add_option_group(group) + self.local_option_group = group + + result = group.add_option(*args, **kw) + + if result: + # The option was added succesfully. We now have to add the + # default value to our object that holds the default values + # (so that an attempt to fetch the option's attribute will + # yield the default value when not overridden) and then + # we re-parse the leftover command-line options, so that + # any value overridden on the command line is immediately + # available if the user turns around and does a GetOption() + # right away. + setattr(self.values.__defaults__, result.dest, result.default) + self.parse_args(self.largs, self.values) + + return result + +class SConsIndentedHelpFormatter(optparse.IndentedHelpFormatter): + def format_usage(self, usage): + return "usage: %s\n" % usage + + def format_heading(self, heading): + """ + This translates any heading of "options" or "Options" into + "SCons Options." Unfortunately, we have to do this here, + because those titles are hard-coded in the optparse calls. + """ + if heading == 'options': + # The versions of optparse.py shipped with Pythons 2.3 and + # 2.4 pass this in uncapitalized; override that so we get + # consistent output on all versions. + heading = "Options" + if heading == 'Options': + heading = "SCons Options" + return optparse.IndentedHelpFormatter.format_heading(self, heading) + + def format_option(self, option): + """ + A copy of the normal optparse.IndentedHelpFormatter.format_option() + method. This has been snarfed so we can modify text wrapping to + out liking: + + -- add our own regular expression that doesn't break on hyphens + (so things like --no-print-directory don't get broken); + + -- wrap the list of options themselves when it's too long + (the wrapper.fill(opts) call below); + + -- set the subsequent_indent when wrapping the help_text. + """ + # The help for each option consists of two parts: + # * the opt strings and metavars + # eg. ("-x", or "-fFILENAME, --file=FILENAME") + # * the user-supplied help string + # eg. ("turn on expert mode", "read data from FILENAME") + # + # If possible, we write both of these on the same line: + # -x turn on expert mode + # + # But if the opt string list is too long, we put the help + # string on a second line, indented to the same column it would + # start in if it fit on the first line. + # -fFILENAME, --file=FILENAME + # read data from FILENAME + result = [] + + try: + opts = self.option_strings[option] + except AttributeError: + # The Python 2.3 version of optparse attaches this to + # to the option argument, not to this object. + opts = option.option_strings + + opt_width = self.help_position - self.current_indent - 2 + if len(opts) > opt_width: + wrapper = textwrap.TextWrapper(width=self.width, + initial_indent = ' ', + subsequent_indent = ' ') + wrapper.wordsep_re = no_hyphen_re + opts = wrapper.fill(opts) + '\n' + indent_first = self.help_position + else: # start help on same line as opts + opts = "%*s%-*s " % (self.current_indent, "", opt_width, opts) + indent_first = 0 + result.append(opts) + if option.help: + + try: + expand_default = self.expand_default + except AttributeError: + # The HelpFormatter base class in the Python 2.3 version + # of optparse has no expand_default() method. + help_text = option.help + else: + help_text = expand_default(option) + + # SCons: indent every line of the help text but the first. + wrapper = textwrap.TextWrapper(width=self.help_width, + subsequent_indent = ' ') + wrapper.wordsep_re = no_hyphen_re + help_lines = wrapper.wrap(help_text) + result.append("%*s%s\n" % (indent_first, "", help_lines[0])) + for line in help_lines[1:]: + result.append("%*s%s\n" % (self.help_position, "", line)) + elif opts[-1] != "\n": + result.append("\n") + return "".join(result) + + # For consistent help output across Python versions, we provide a + # subclass copy of format_option_strings() and these two variables. + # This is necessary (?) for Python2.3, which otherwise concatenates + # a short option with its metavar. + _short_opt_fmt = "%s %s" + _long_opt_fmt = "%s=%s" + + def format_option_strings(self, option): + """Return a comma-separated list of option strings & metavariables.""" + if option.takes_value(): + metavar = option.metavar or option.dest.upper() + short_opts = [] + for sopt in option._short_opts: + short_opts.append(self._short_opt_fmt % (sopt, metavar)) + long_opts = [] + for lopt in option._long_opts: + long_opts.append(self._long_opt_fmt % (lopt, metavar)) + else: + short_opts = option._short_opts + long_opts = option._long_opts + + if self.short_first: + opts = short_opts + long_opts + else: + opts = long_opts + short_opts + + return ", ".join(opts) + +def Parser(version): + """ + Returns an options parser object initialized with the standard + SCons options. + """ + + formatter = SConsIndentedHelpFormatter(max_help_position=30) + + op = SConsOptionParser(option_class=SConsOption, + add_help_option=False, + formatter=formatter, + usage="usage: scons [OPTION] [TARGET] ...",) + + op.preserve_unknown_options = True + op.version = version + + # Add the options to the parser we just created. + # + # These are in the order we want them to show up in the -H help + # text, basically alphabetical. Each op.add_option() call below + # should have a consistent format: + # + # op.add_option("-L", "--long-option-name", + # nargs=1, type="string", + # dest="long_option_name", default='foo', + # action="callback", callback=opt_long_option, + # help="help text goes here", + # metavar="VAR") + # + # Even though the optparse module constructs reasonable default + # destination names from the long option names, we're going to be + # explicit about each one for easier readability and so this code + # will at least show up when grepping the source for option attribute + # names, or otherwise browsing the source code. + + # options ignored for compatibility + def opt_ignore(option, opt, value, parser): + sys.stderr.write("Warning: ignoring %s option\n" % opt) + op.add_option("-b", "-d", "-e", "-m", "-S", "-t", "-w", + "--environment-overrides", + "--no-keep-going", + "--no-print-directory", + "--print-directory", + "--stop", + "--touch", + action="callback", callback=opt_ignore, + help="Ignored for compatibility.") + + op.add_option('-c', '--clean', '--remove', + dest="clean", default=False, + action="store_true", + help="Remove specified targets and dependencies.") + + op.add_option('-C', '--directory', + nargs=1, type="string", + dest="directory", default=[], + action="append", + help="Change to DIR before doing anything.", + metavar="DIR") + + op.add_option('--cache-debug', + nargs=1, + dest="cache_debug", default=None, + action="store", + help="Print CacheDir debug info to FILE.", + metavar="FILE") + + op.add_option('--cache-disable', '--no-cache', + dest='cache_disable', default=False, + action="store_true", + help="Do not retrieve built targets from CacheDir.") + + op.add_option('--cache-force', '--cache-populate', + dest='cache_force', default=False, + action="store_true", + help="Copy already-built targets into the CacheDir.") + + op.add_option('--cache-show', + dest='cache_show', default=False, + action="store_true", + help="Print build actions for files from CacheDir.") + + def opt_invalid(group, value, options): + errmsg = "`%s' is not a valid %s option type, try:\n" % (value, group) + return errmsg + " %s" % ", ".join(options) + + config_options = ["auto", "force" ,"cache"] + + def opt_config(option, opt, value, parser, c_options=config_options): + if not value in c_options: + raise OptionValueError(opt_invalid('config', value, c_options)) + setattr(parser.values, option.dest, value) + opt_config_help = "Controls Configure subsystem: %s." \ + % ", ".join(config_options) + op.add_option('--config', + nargs=1, type="string", + dest="config", default="auto", + action="callback", callback=opt_config, + help = opt_config_help, + metavar="MODE") + + op.add_option('-D', + dest="climb_up", default=None, + action="store_const", const=2, + help="Search up directory tree for SConstruct, " + "build all Default() targets.") + + deprecated_debug_options = { + "dtree" : '; please use --tree=derived instead', + "nomemoizer" : ' and has no effect', + "stree" : '; please use --tree=all,status instead', + "tree" : '; please use --tree=all instead', + } + + debug_options = ["count", "duplicate", "explain", "findlibs", + "includes", "memoizer", "memory", "objects", + "pdb", "prepare", "presub", "stacktrace", + "time"] + + def opt_debug(option, opt, value, parser, + debug_options=debug_options, + deprecated_debug_options=deprecated_debug_options): + if value in debug_options: + parser.values.debug.append(value) + elif value in deprecated_debug_options.keys(): + parser.values.debug.append(value) + try: + parser.values.delayed_warnings + except AttributeError: + parser.values.delayed_warnings = [] + msg = deprecated_debug_options[value] + w = "The --debug=%s option is deprecated%s." % (value, msg) + t = (SCons.Warnings.DeprecatedDebugOptionsWarning, w) + parser.values.delayed_warnings.append(t) + else: + raise OptionValueError(opt_invalid('debug', value, debug_options)) + opt_debug_help = "Print various types of debugging information: %s." \ + % ", ".join(debug_options) + op.add_option('--debug', + nargs=1, type="string", + dest="debug", default=[], + action="callback", callback=opt_debug, + help=opt_debug_help, + metavar="TYPE") + + def opt_diskcheck(option, opt, value, parser): + try: + diskcheck_value = diskcheck_convert(value) + except ValueError, e: + raise OptionValueError("`%s' is not a valid diskcheck type" % e) + setattr(parser.values, option.dest, diskcheck_value) + + op.add_option('--diskcheck', + nargs=1, type="string", + dest='diskcheck', default=None, + action="callback", callback=opt_diskcheck, + help="Enable specific on-disk checks.", + metavar="TYPE") + + def opt_duplicate(option, opt, value, parser): + if not value in SCons.Node.FS.Valid_Duplicates: + raise OptionValueError(opt_invalid('duplication', value, + SCons.Node.FS.Valid_Duplicates)) + setattr(parser.values, option.dest, value) + # Set the duplicate style right away so it can affect linking + # of SConscript files. + SCons.Node.FS.set_duplicate(value) + + opt_duplicate_help = "Set the preferred duplication methods. Must be one of " \ + + ", ".join(SCons.Node.FS.Valid_Duplicates) + + op.add_option('--duplicate', + nargs=1, type="string", + dest="duplicate", default='hard-soft-copy', + action="callback", callback=opt_duplicate, + help=opt_duplicate_help) + + op.add_option('-f', '--file', '--makefile', '--sconstruct', + nargs=1, type="string", + dest="file", default=[], + action="append", + help="Read FILE as the top-level SConstruct file.") + + op.add_option('-h', '--help', + dest="help", default=False, + action="store_true", + help="Print defined help message, or this one.") + + op.add_option("-H", "--help-options", + action="help", + help="Print this message and exit.") + + op.add_option('-i', '--ignore-errors', + dest='ignore_errors', default=False, + action="store_true", + help="Ignore errors from build actions.") + + op.add_option('-I', '--include-dir', + nargs=1, + dest='include_dir', default=[], + action="append", + help="Search DIR for imported Python modules.", + metavar="DIR") + + op.add_option('--implicit-cache', + dest='implicit_cache', default=False, + action="store_true", + help="Cache implicit dependencies") + + def opt_implicit_deps(option, opt, value, parser): + setattr(parser.values, 'implicit_cache', True) + setattr(parser.values, option.dest, True) + + op.add_option('--implicit-deps-changed', + dest="implicit_deps_changed", default=False, + action="callback", callback=opt_implicit_deps, + help="Ignore cached implicit dependencies.") + + op.add_option('--implicit-deps-unchanged', + dest="implicit_deps_unchanged", default=False, + action="callback", callback=opt_implicit_deps, + help="Ignore changes in implicit dependencies.") + + op.add_option('--interact', '--interactive', + dest='interactive', default=False, + action="store_true", + help="Run in interactive mode.") + + op.add_option('-j', '--jobs', + nargs=1, type="int", + dest="num_jobs", default=1, + action="store", + help="Allow N jobs at once.", + metavar="N") + + op.add_option('-k', '--keep-going', + dest='keep_going', default=False, + action="store_true", + help="Keep going when a target can't be made.") + + op.add_option('--max-drift', + nargs=1, type="int", + dest='max_drift', default=SCons.Node.FS.default_max_drift, + action="store", + help="Set maximum system clock drift to N seconds.", + metavar="N") + + op.add_option('--md5-chunksize', + nargs=1, type="int", + dest='md5_chunksize', default=SCons.Node.FS.File.md5_chunksize, + action="store", + help="Set chunk-size for MD5 signature computation to N kilobytes.", + metavar="N") + + op.add_option('-n', '--no-exec', '--just-print', '--dry-run', '--recon', + dest='no_exec', default=False, + action="store_true", + help="Don't build; just print commands.") + + op.add_option('--no-site-dir', + dest='no_site_dir', default=False, + action="store_true", + help="Don't search or use the usual site_scons dir.") + + op.add_option('--profile', + nargs=1, + dest="profile_file", default=None, + action="store", + help="Profile SCons and put results in FILE.", + metavar="FILE") + + op.add_option('-q', '--question', + dest="question", default=False, + action="store_true", + help="Don't build; exit status says if up to date.") + + op.add_option('-Q', + dest='no_progress', default=False, + action="store_true", + help="Suppress \"Reading/Building\" progress messages.") + + op.add_option('--random', + dest="random", default=False, + action="store_true", + help="Build dependencies in random order.") + + op.add_option('-s', '--silent', '--quiet', + dest="silent", default=False, + action="store_true", + help="Don't print commands.") + + op.add_option('--site-dir', + nargs=1, + dest='site_dir', default=None, + action="store", + help="Use DIR instead of the usual site_scons dir.", + metavar="DIR") + + op.add_option('--stack-size', + nargs=1, type="int", + dest='stack_size', + action="store", + help="Set the stack size of the threads used to run jobs to N kilobytes.", + metavar="N") + + op.add_option('--taskmastertrace', + nargs=1, + dest="taskmastertrace_file", default=None, + action="store", + help="Trace Node evaluation to FILE.", + metavar="FILE") + + tree_options = ["all", "derived", "prune", "status"] + + def opt_tree(option, opt, value, parser, tree_options=tree_options): + import Main + tp = Main.TreePrinter() + for o in value.split(','): + if o == 'all': + tp.derived = False + elif o == 'derived': + tp.derived = True + elif o == 'prune': + tp.prune = True + elif o == 'status': + tp.status = True + else: + raise OptionValueError(opt_invalid('--tree', o, tree_options)) + parser.values.tree_printers.append(tp) + + opt_tree_help = "Print a dependency tree in various formats: %s." \ + % ", ".join(tree_options) + + op.add_option('--tree', + nargs=1, type="string", + dest="tree_printers", default=[], + action="callback", callback=opt_tree, + help=opt_tree_help, + metavar="OPTIONS") + + op.add_option('-u', '--up', '--search-up', + dest="climb_up", default=0, + action="store_const", const=1, + help="Search up directory tree for SConstruct, " + "build targets at or below current directory.") + + op.add_option('-U', + dest="climb_up", default=0, + action="store_const", const=3, + help="Search up directory tree for SConstruct, " + "build Default() targets from local SConscript.") + + def opt_version(option, opt, value, parser): + sys.stdout.write(parser.version + '\n') + sys.exit(0) + op.add_option("-v", "--version", + action="callback", callback=opt_version, + help="Print the SCons version number and exit.") + + def opt_warn(option, opt, value, parser, tree_options=tree_options): + if SCons.Util.is_String(value): + value = value.split(',') + parser.values.warn.extend(value) + + op.add_option('--warn', '--warning', + nargs=1, type="string", + dest="warn", default=[], + action="callback", callback=opt_warn, + help="Enable or disable warnings.", + metavar="WARNING-SPEC") + + op.add_option('-Y', '--repository', '--srcdir', + nargs=1, + dest="repository", default=[], + action="append", + help="Search REPOSITORY for source and target files.") + + # Options from Make and Cons classic that we do not yet support, + # but which we may support someday and whose (potential) meanings + # we don't want to change. These all get a "the -X option is not + # yet implemented" message and don't show up in the help output. + + def opt_not_yet(option, opt, value, parser): + msg = "Warning: the %s option is not yet implemented\n" % opt + sys.stderr.write(msg) + + op.add_option('-l', '--load-average', '--max-load', + nargs=1, type="float", + dest="load_average", default=0, + action="callback", callback=opt_not_yet, + # action="store", + # help="Don't start multiple jobs unless load is below " + # "LOAD-AVERAGE." + help=SUPPRESS_HELP) + op.add_option('--list-actions', + dest="list_actions", + action="callback", callback=opt_not_yet, + # help="Don't build; list files and build actions." + help=SUPPRESS_HELP) + op.add_option('--list-derived', + dest="list_derived", + action="callback", callback=opt_not_yet, + # help="Don't build; list files that would be built." + help=SUPPRESS_HELP) + op.add_option('--list-where', + dest="list_where", + action="callback", callback=opt_not_yet, + # help="Don't build; list files and where defined." + help=SUPPRESS_HELP) + op.add_option('-o', '--old-file', '--assume-old', + nargs=1, type="string", + dest="old_file", default=[], + action="callback", callback=opt_not_yet, + # action="append", + # help = "Consider FILE to be old; don't rebuild it." + help=SUPPRESS_HELP) + op.add_option('--override', + nargs=1, type="string", + action="callback", callback=opt_not_yet, + dest="override", + # help="Override variables as specified in FILE." + help=SUPPRESS_HELP) + op.add_option('-p', + action="callback", callback=opt_not_yet, + dest="p", + # help="Print internal environments/objects." + help=SUPPRESS_HELP) + op.add_option('-r', '-R', '--no-builtin-rules', '--no-builtin-variables', + action="callback", callback=opt_not_yet, + dest="no_builtin_rules", + # help="Clear default environments and variables." + help=SUPPRESS_HELP) + op.add_option('--write-filenames', + nargs=1, type="string", + dest="write_filenames", + action="callback", callback=opt_not_yet, + # help="Write all filenames examined into FILE." + help=SUPPRESS_HELP) + op.add_option('-W', '--new-file', '--assume-new', '--what-if', + nargs=1, type="string", + dest="new_file", + action="callback", callback=opt_not_yet, + # help="Consider FILE to be changed." + help=SUPPRESS_HELP) + op.add_option('--warn-undefined-variables', + dest="warn_undefined_variables", + action="callback", callback=opt_not_yet, + # help="Warn when an undefined variable is referenced." + help=SUPPRESS_HELP) + + return op + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Script/SConscript.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Script/SConscript.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Script/SConscript.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Script/SConscript.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,635 @@ +"""SCons.Script.SConscript + +This module defines the Python API provided to SConscript and SConstruct +files. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +from __future__ import division + +__revision__ = "src/engine/SCons/Script/SConscript.py 2013/03/03 09:48:35 garyo" + +import SCons +import SCons.Action +import SCons.Builder +import SCons.Defaults +import SCons.Environment +import SCons.Errors +import SCons.Node +import SCons.Node.Alias +import SCons.Node.FS +import SCons.Platform +import SCons.SConf +import SCons.Script.Main +import SCons.Tool +import SCons.Util + +import collections +import os +import os.path +import re +import sys +import traceback + +# The following variables used to live in this module. Some +# SConscript files out there may have referred to them directly as +# SCons.Script.SConscript.*. This is now supported by some special +# handling towards the bottom of the SConscript.__init__.py module. +#Arguments = {} +#ArgList = [] +#BuildTargets = TargetList() +#CommandLineTargets = [] +#DefaultTargets = [] + +class SConscriptReturn(Exception): + pass + +launch_dir = os.path.abspath(os.curdir) + +GlobalDict = None + +# global exports set by Export(): +global_exports = {} + +# chdir flag +sconscript_chdir = 1 + +def get_calling_namespaces(): + """Return the locals and globals for the function that called + into this module in the current call stack.""" + try: 1//0 + except ZeroDivisionError: + # Don't start iterating with the current stack-frame to + # prevent creating reference cycles (f_back is safe). + frame = sys.exc_info()[2].tb_frame.f_back + + # Find the first frame that *isn't* from this file. This means + # that we expect all of the SCons frames that implement an Export() + # or SConscript() call to be in this file, so that we can identify + # the first non-Script.SConscript frame as the user's local calling + # environment, and the locals and globals dictionaries from that + # frame as the calling namespaces. See the comment below preceding + # the DefaultEnvironmentCall block for even more explanation. + while frame.f_globals.get("__name__") == __name__: + frame = frame.f_back + + return frame.f_locals, frame.f_globals + + +def compute_exports(exports): + """Compute a dictionary of exports given one of the parameters + to the Export() function or the exports argument to SConscript().""" + + loc, glob = get_calling_namespaces() + + retval = {} + try: + for export in exports: + if SCons.Util.is_Dict(export): + retval.update(export) + else: + try: + retval[export] = loc[export] + except KeyError: + retval[export] = glob[export] + except KeyError, x: + raise SCons.Errors.UserError("Export of non-existent variable '%s'"%x) + + return retval + +class Frame(object): + """A frame on the SConstruct/SConscript call stack""" + def __init__(self, fs, exports, sconscript): + self.globals = BuildDefaultGlobals() + self.retval = None + self.prev_dir = fs.getcwd() + self.exports = compute_exports(exports) # exports from the calling SConscript + # make sure the sconscript attr is a Node. + if isinstance(sconscript, SCons.Node.Node): + self.sconscript = sconscript + elif sconscript == '-': + self.sconscript = None + else: + self.sconscript = fs.File(str(sconscript)) + +# the SConstruct/SConscript call stack: +call_stack = [] + +# For documentation on the methods in this file, see the scons man-page + +def Return(*vars, **kw): + retval = [] + try: + fvars = SCons.Util.flatten(vars) + for var in fvars: + for v in var.split(): + retval.append(call_stack[-1].globals[v]) + except KeyError, x: + raise SCons.Errors.UserError("Return of non-existent variable '%s'"%x) + + if len(retval) == 1: + call_stack[-1].retval = retval[0] + else: + call_stack[-1].retval = tuple(retval) + + stop = kw.get('stop', True) + + if stop: + raise SConscriptReturn + + +stack_bottom = '% Stack boTTom %' # hard to define a variable w/this name :) + +def _SConscript(fs, *files, **kw): + top = fs.Top + sd = fs.SConstruct_dir.rdir() + exports = kw.get('exports', []) + + # evaluate each SConscript file + results = [] + for fn in files: + call_stack.append(Frame(fs, exports, fn)) + old_sys_path = sys.path + try: + SCons.Script.sconscript_reading = SCons.Script.sconscript_reading + 1 + if fn == "-": + exec sys.stdin in call_stack[-1].globals + else: + if isinstance(fn, SCons.Node.Node): + f = fn + else: + f = fs.File(str(fn)) + _file_ = None + + # Change directory to the top of the source + # tree to make sure the os's cwd and the cwd of + # fs match so we can open the SConscript. + fs.chdir(top, change_os_dir=1) + if f.rexists(): + actual = f.rfile() + _file_ = open(actual.get_abspath(), "r") + elif f.srcnode().rexists(): + actual = f.srcnode().rfile() + _file_ = open(actual.get_abspath(), "r") + elif f.has_src_builder(): + # The SConscript file apparently exists in a source + # code management system. Build it, but then clear + # the builder so that it doesn't get built *again* + # during the actual build phase. + f.build() + f.built() + f.builder_set(None) + if f.exists(): + _file_ = open(f.get_abspath(), "r") + if _file_: + # Chdir to the SConscript directory. Use a path + # name relative to the SConstruct file so that if + # we're using the -f option, we're essentially + # creating a parallel SConscript directory structure + # in our local directory tree. + # + # XXX This is broken for multiple-repository cases + # where the SConstruct and SConscript files might be + # in different Repositories. For now, cross that + # bridge when someone comes to it. + try: + src_dir = kw['src_dir'] + except KeyError: + ldir = fs.Dir(f.dir.get_path(sd)) + else: + ldir = fs.Dir(src_dir) + if not ldir.is_under(f.dir): + # They specified a source directory, but + # it's above the SConscript directory. + # Do the sensible thing and just use the + # SConcript directory. + ldir = fs.Dir(f.dir.get_path(sd)) + try: + fs.chdir(ldir, change_os_dir=sconscript_chdir) + except OSError: + # There was no local directory, so we should be + # able to chdir to the Repository directory. + # Note that we do this directly, not through + # fs.chdir(), because we still need to + # interpret the stuff within the SConscript file + # relative to where we are logically. + fs.chdir(ldir, change_os_dir=0) + os.chdir(actual.dir.get_abspath()) + + # Append the SConscript directory to the beginning + # of sys.path so Python modules in the SConscript + # directory can be easily imported. + sys.path = [ f.dir.get_abspath() ] + sys.path + + # This is the magic line that actually reads up + # and executes the stuff in the SConscript file. + # The locals for this frame contain the special + # bottom-of-the-stack marker so that any + # exceptions that occur when processing this + # SConscript can base the printed frames at this + # level and not show SCons internals as well. + call_stack[-1].globals.update({stack_bottom:1}) + old_file = call_stack[-1].globals.get('__file__') + try: + del call_stack[-1].globals['__file__'] + except KeyError: + pass + try: + try: + exec _file_ in call_stack[-1].globals + except SConscriptReturn: + pass + finally: + if old_file is not None: + call_stack[-1].globals.update({__file__:old_file}) + else: + SCons.Warnings.warn(SCons.Warnings.MissingSConscriptWarning, + "Ignoring missing SConscript '%s'" % f.path) + + finally: + SCons.Script.sconscript_reading = SCons.Script.sconscript_reading - 1 + sys.path = old_sys_path + frame = call_stack.pop() + try: + fs.chdir(frame.prev_dir, change_os_dir=sconscript_chdir) + except OSError: + # There was no local directory, so chdir to the + # Repository directory. Like above, we do this + # directly. + fs.chdir(frame.prev_dir, change_os_dir=0) + rdir = frame.prev_dir.rdir() + rdir._create() # Make sure there's a directory there. + try: + os.chdir(rdir.get_abspath()) + except OSError, e: + # We still couldn't chdir there, so raise the error, + # but only if actions are being executed. + # + # If the -n option was used, the directory would *not* + # have been created and we should just carry on and + # let things muddle through. This isn't guaranteed + # to work if the SConscript files are reading things + # from disk (for example), but it should work well + # enough for most configurations. + if SCons.Action.execute_actions: + raise e + + results.append(frame.retval) + + # if we only have one script, don't return a tuple + if len(results) == 1: + return results[0] + else: + return tuple(results) + +def SConscript_exception(file=sys.stderr): + """Print an exception stack trace just for the SConscript file(s). + This will show users who have Python errors where the problem is, + without cluttering the output with all of the internal calls leading + up to where we exec the SConscript.""" + exc_type, exc_value, exc_tb = sys.exc_info() + tb = exc_tb + while tb and stack_bottom not in tb.tb_frame.f_locals: + tb = tb.tb_next + if not tb: + # We did not find our exec statement, so this was actually a bug + # in SCons itself. Show the whole stack. + tb = exc_tb + stack = traceback.extract_tb(tb) + try: + type = exc_type.__name__ + except AttributeError: + type = str(exc_type) + if type[:11] == "exceptions.": + type = type[11:] + file.write('%s: %s:\n' % (type, exc_value)) + for fname, line, func, text in stack: + file.write(' File "%s", line %d:\n' % (fname, line)) + file.write(' %s\n' % text) + +def annotate(node): + """Annotate a node with the stack frame describing the + SConscript file and line number that created it.""" + tb = sys.exc_info()[2] + while tb and stack_bottom not in tb.tb_frame.f_locals: + tb = tb.tb_next + if not tb: + # We did not find any exec of an SConscript file: what?! + raise SCons.Errors.InternalError("could not find SConscript stack frame") + node.creator = traceback.extract_stack(tb)[0] + +# The following line would cause each Node to be annotated using the +# above function. Unfortunately, this is a *huge* performance hit, so +# leave this disabled until we find a more efficient mechanism. +#SCons.Node.Annotate = annotate + +class SConsEnvironment(SCons.Environment.Base): + """An Environment subclass that contains all of the methods that + are particular to the wrapper SCons interface and which aren't + (or shouldn't be) part of the build engine itself. + + Note that not all of the methods of this class have corresponding + global functions, there are some private methods. + """ + + # + # Private methods of an SConsEnvironment. + # + def _exceeds_version(self, major, minor, v_major, v_minor): + """Return 1 if 'major' and 'minor' are greater than the version + in 'v_major' and 'v_minor', and 0 otherwise.""" + return (major > v_major or (major == v_major and minor > v_minor)) + + def _get_major_minor_revision(self, version_string): + """Split a version string into major, minor and (optionally) + revision parts. + + This is complicated by the fact that a version string can be + something like 3.2b1.""" + version = version_string.split(' ')[0].split('.') + v_major = int(version[0]) + v_minor = int(re.match('\d+', version[1]).group()) + if len(version) >= 3: + v_revision = int(re.match('\d+', version[2]).group()) + else: + v_revision = 0 + return v_major, v_minor, v_revision + + def _get_SConscript_filenames(self, ls, kw): + """ + Convert the parameters passed to SConscript() calls into a list + of files and export variables. If the parameters are invalid, + throws SCons.Errors.UserError. Returns a tuple (l, e) where l + is a list of SConscript filenames and e is a list of exports. + """ + exports = [] + + if len(ls) == 0: + try: + dirs = kw["dirs"] + except KeyError: + raise SCons.Errors.UserError("Invalid SConscript usage - no parameters") + + if not SCons.Util.is_List(dirs): + dirs = [ dirs ] + dirs = list(map(str, dirs)) + + name = kw.get('name', 'SConscript') + + files = [os.path.join(n, name) for n in dirs] + + elif len(ls) == 1: + + files = ls[0] + + elif len(ls) == 2: + + files = ls[0] + exports = self.Split(ls[1]) + + else: + + raise SCons.Errors.UserError("Invalid SConscript() usage - too many arguments") + + if not SCons.Util.is_List(files): + files = [ files ] + + if kw.get('exports'): + exports.extend(self.Split(kw['exports'])) + + variant_dir = kw.get('variant_dir') or kw.get('build_dir') + if variant_dir: + if len(files) != 1: + raise SCons.Errors.UserError("Invalid SConscript() usage - can only specify one SConscript with a variant_dir") + duplicate = kw.get('duplicate', 1) + src_dir = kw.get('src_dir') + if not src_dir: + src_dir, fname = os.path.split(str(files[0])) + files = [os.path.join(str(variant_dir), fname)] + else: + if not isinstance(src_dir, SCons.Node.Node): + src_dir = self.fs.Dir(src_dir) + fn = files[0] + if not isinstance(fn, SCons.Node.Node): + fn = self.fs.File(fn) + if fn.is_under(src_dir): + # Get path relative to the source directory. + fname = fn.get_path(src_dir) + files = [os.path.join(str(variant_dir), fname)] + else: + files = [fn.abspath] + kw['src_dir'] = variant_dir + self.fs.VariantDir(variant_dir, src_dir, duplicate) + + return (files, exports) + + # + # Public methods of an SConsEnvironment. These get + # entry points in the global name space so they can be called + # as global functions. + # + + def Configure(self, *args, **kw): + if not SCons.Script.sconscript_reading: + raise SCons.Errors.UserError("Calling Configure from Builders is not supported.") + kw['_depth'] = kw.get('_depth', 0) + 1 + return SCons.Environment.Base.Configure(self, *args, **kw) + + def Default(self, *targets): + SCons.Script._Set_Default_Targets(self, targets) + + def EnsureSConsVersion(self, major, minor, revision=0): + """Exit abnormally if the SCons version is not late enough.""" + scons_ver = self._get_major_minor_revision(SCons.__version__) + if scons_ver < (major, minor, revision): + if revision: + scons_ver_string = '%d.%d.%d' % (major, minor, revision) + else: + scons_ver_string = '%d.%d' % (major, minor) + print "SCons %s or greater required, but you have SCons %s" % \ + (scons_ver_string, SCons.__version__) + sys.exit(2) + + def EnsurePythonVersion(self, major, minor): + """Exit abnormally if the Python version is not late enough.""" + if sys.version_info < (major, minor): + v = sys.version.split()[0] + print "Python %d.%d or greater required, but you have Python %s" %(major,minor,v) + sys.exit(2) + + def Exit(self, value=0): + sys.exit(value) + + def Export(self, *vars, **kw): + for var in vars: + global_exports.update(compute_exports(self.Split(var))) + global_exports.update(kw) + + def GetLaunchDir(self): + global launch_dir + return launch_dir + + def GetOption(self, name): + name = self.subst(name) + return SCons.Script.Main.GetOption(name) + + def Help(self, text): + text = self.subst(text, raw=1) + SCons.Script.HelpFunction(text) + + def Import(self, *vars): + try: + frame = call_stack[-1] + globals = frame.globals + exports = frame.exports + for var in vars: + var = self.Split(var) + for v in var: + if v == '*': + globals.update(global_exports) + globals.update(exports) + else: + if v in exports: + globals[v] = exports[v] + else: + globals[v] = global_exports[v] + except KeyError,x: + raise SCons.Errors.UserError("Import of non-existent variable '%s'"%x) + + def SConscript(self, *ls, **kw): + if 'build_dir' in kw: + msg = """The build_dir keyword has been deprecated; use the variant_dir keyword instead.""" + SCons.Warnings.warn(SCons.Warnings.DeprecatedBuildDirWarning, msg) + def subst_element(x, subst=self.subst): + if SCons.Util.is_List(x): + x = list(map(subst, x)) + else: + x = subst(x) + return x + ls = list(map(subst_element, ls)) + subst_kw = {} + for key, val in kw.items(): + if SCons.Util.is_String(val): + val = self.subst(val) + elif SCons.Util.is_List(val): + result = [] + for v in val: + if SCons.Util.is_String(v): + v = self.subst(v) + result.append(v) + val = result + subst_kw[key] = val + + files, exports = self._get_SConscript_filenames(ls, subst_kw) + subst_kw['exports'] = exports + return _SConscript(self.fs, *files, **subst_kw) + + def SConscriptChdir(self, flag): + global sconscript_chdir + sconscript_chdir = flag + + def SetOption(self, name, value): + name = self.subst(name) + SCons.Script.Main.SetOption(name, value) + +# +# +# +SCons.Environment.Environment = SConsEnvironment + +def Configure(*args, **kw): + if not SCons.Script.sconscript_reading: + raise SCons.Errors.UserError("Calling Configure from Builders is not supported.") + kw['_depth'] = 1 + return SCons.SConf.SConf(*args, **kw) + +# It's very important that the DefaultEnvironmentCall() class stay in this +# file, with the get_calling_namespaces() function, the compute_exports() +# function, the Frame class and the SConsEnvironment.Export() method. +# These things make up the calling stack leading up to the actual global +# Export() or SConscript() call that the user issued. We want to allow +# users to export local variables that they define, like so: +# +# def func(): +# x = 1 +# Export('x') +# +# To support this, the get_calling_namespaces() function assumes that +# the *first* stack frame that's not from this file is the local frame +# for the Export() or SConscript() call. + +_DefaultEnvironmentProxy = None + +def get_DefaultEnvironmentProxy(): + global _DefaultEnvironmentProxy + if not _DefaultEnvironmentProxy: + default_env = SCons.Defaults.DefaultEnvironment() + _DefaultEnvironmentProxy = SCons.Environment.NoSubstitutionProxy(default_env) + return _DefaultEnvironmentProxy + +class DefaultEnvironmentCall(object): + """A class that implements "global function" calls of + Environment methods by fetching the specified method from the + DefaultEnvironment's class. Note that this uses an intermediate + proxy class instead of calling the DefaultEnvironment method + directly so that the proxy can override the subst() method and + thereby prevent expansion of construction variables (since from + the user's point of view this was called as a global function, + with no associated construction environment).""" + def __init__(self, method_name, subst=0): + self.method_name = method_name + if subst: + self.factory = SCons.Defaults.DefaultEnvironment + else: + self.factory = get_DefaultEnvironmentProxy + def __call__(self, *args, **kw): + env = self.factory() + method = getattr(env, self.method_name) + return method(*args, **kw) + + +def BuildDefaultGlobals(): + """ + Create a dictionary containing all the default globals for + SConstruct and SConscript files. + """ + + global GlobalDict + if GlobalDict is None: + GlobalDict = {} + + import SCons.Script + d = SCons.Script.__dict__ + def not_a_module(m, d=d, mtype=type(SCons.Script)): + return not isinstance(d[m], mtype) + for m in filter(not_a_module, dir(SCons.Script)): + GlobalDict[m] = d[m] + + return GlobalDict.copy() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Script/__init__.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Script/__init__.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Script/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Script/__init__.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,412 @@ +"""SCons.Script + +This file implements the main() function used by the scons script. + +Architecturally, this *is* the scons script, and will likely only be +called from the external "scons" wrapper. Consequently, anything here +should not be, or be considered, part of the build engine. If it's +something that we expect other software to want to use, it should go in +some other module. If it's specific to the "scons" script invocation, +it goes here. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Script/__init__.py 2013/03/03 09:48:35 garyo" + +import time +start_time = time.time() + +import collections +import os +import sys + +# Special chicken-and-egg handling of the "--debug=memoizer" flag: +# +# SCons.Memoize contains a metaclass implementation that affects how +# the other classes are instantiated. The Memoizer may add shim methods +# to classes that have methods that cache computed values in order to +# count and report the hits and misses. +# +# If we wait to enable the Memoization until after we've parsed the +# command line options normally, it will be too late, because the Memoizer +# will have already analyzed the classes that it's Memoizing and decided +# to not add the shims. So we use a special-case, up-front check for +# the "--debug=memoizer" flag and enable Memoizer before we import any +# of the other modules that use it. + +_args = sys.argv + os.environ.get('SCONSFLAGS', '').split() +if "--debug=memoizer" in _args: + import SCons.Memoize + import SCons.Warnings + try: + SCons.Memoize.EnableMemoization() + except SCons.Warnings.Warning: + # Some warning was thrown. Arrange for it to be displayed + # or not after warnings are configured. + import Main + exc_type, exc_value, tb = sys.exc_info() + Main.delayed_warnings.append((exc_type, exc_value)) +del _args + +import SCons.Action +import SCons.Builder +import SCons.Environment +import SCons.Node.FS +import SCons.Options +import SCons.Platform +import SCons.Scanner +import SCons.SConf +import SCons.Subst +import SCons.Tool +import SCons.Util +import SCons.Variables +import SCons.Defaults + +import Main + +main = Main.main + +# The following are global class definitions and variables that used to +# live directly in this module back before 0.96.90, when it contained +# a lot of code. Some SConscript files in widely-distributed packages +# (Blender is the specific example) actually reached into SCons.Script +# directly to use some of these. Rather than break those SConscript +# files, we're going to propagate these names into the SCons.Script +# namespace here. +# +# Some of these are commented out because it's *really* unlikely anyone +# used them, but we're going to leave the comment here to try to make +# it obvious what to do if the situation arises. +BuildTask = Main.BuildTask +CleanTask = Main.CleanTask +QuestionTask = Main.QuestionTask +#PrintHelp = Main.PrintHelp +#SConscriptSettableOptions = Main.SConscriptSettableOptions + +AddOption = Main.AddOption +GetOption = Main.GetOption +SetOption = Main.SetOption +Progress = Main.Progress +GetBuildFailures = Main.GetBuildFailures + +#keep_going_on_error = Main.keep_going_on_error +#print_dtree = Main.print_dtree +#print_explanations = Main.print_explanations +#print_includes = Main.print_includes +#print_objects = Main.print_objects +#print_time = Main.print_time +#print_tree = Main.print_tree +#memory_stats = Main.memory_stats +#ignore_errors = Main.ignore_errors +#sconscript_time = Main.sconscript_time +#command_time = Main.command_time +#exit_status = Main.exit_status +#profiling = Main.profiling +#repositories = Main.repositories + +# +import SConscript +_SConscript = SConscript + +call_stack = _SConscript.call_stack + +# +Action = SCons.Action.Action +AddMethod = SCons.Util.AddMethod +AllowSubstExceptions = SCons.Subst.SetAllowableExceptions +Builder = SCons.Builder.Builder +Configure = _SConscript.Configure +Environment = SCons.Environment.Environment +#OptParser = SCons.SConsOptions.OptParser +FindPathDirs = SCons.Scanner.FindPathDirs +Platform = SCons.Platform.Platform +Return = _SConscript.Return +Scanner = SCons.Scanner.Base +Tool = SCons.Tool.Tool +WhereIs = SCons.Util.WhereIs + +# +BoolVariable = SCons.Variables.BoolVariable +EnumVariable = SCons.Variables.EnumVariable +ListVariable = SCons.Variables.ListVariable +PackageVariable = SCons.Variables.PackageVariable +PathVariable = SCons.Variables.PathVariable + +# Deprecated names that will go away some day. +BoolOption = SCons.Options.BoolOption +EnumOption = SCons.Options.EnumOption +ListOption = SCons.Options.ListOption +PackageOption = SCons.Options.PackageOption +PathOption = SCons.Options.PathOption + +# Action factories. +Chmod = SCons.Defaults.Chmod +Copy = SCons.Defaults.Copy +Delete = SCons.Defaults.Delete +Mkdir = SCons.Defaults.Mkdir +Move = SCons.Defaults.Move +Touch = SCons.Defaults.Touch + +# Pre-made, public scanners. +CScanner = SCons.Tool.CScanner +DScanner = SCons.Tool.DScanner +DirScanner = SCons.Defaults.DirScanner +ProgramScanner = SCons.Tool.ProgramScanner +SourceFileScanner = SCons.Tool.SourceFileScanner + +# Functions we might still convert to Environment methods. +CScan = SCons.Defaults.CScan +DefaultEnvironment = SCons.Defaults.DefaultEnvironment + +# Other variables we provide. +class TargetList(collections.UserList): + def _do_nothing(self, *args, **kw): + pass + def _add_Default(self, list): + self.extend(list) + def _clear(self): + del self[:] + +ARGUMENTS = {} +ARGLIST = [] +BUILD_TARGETS = TargetList() +COMMAND_LINE_TARGETS = [] +DEFAULT_TARGETS = [] + +# BUILD_TARGETS can be modified in the SConscript files. If so, we +# want to treat the modified BUILD_TARGETS list as if they specified +# targets on the command line. To do that, though, we need to know if +# BUILD_TARGETS was modified through "official" APIs or by hand. We do +# this by updating two lists in parallel, the documented BUILD_TARGETS +# list, above, and this internal _build_plus_default targets list which +# should only have "official" API changes. Then Script/Main.py can +# compare these two afterwards to figure out if the user added their +# own targets to BUILD_TARGETS. +_build_plus_default = TargetList() + +def _Add_Arguments(alist): + for arg in alist: + a, b = arg.split('=', 1) + ARGUMENTS[a] = b + ARGLIST.append((a, b)) + +def _Add_Targets(tlist): + if tlist: + COMMAND_LINE_TARGETS.extend(tlist) + BUILD_TARGETS.extend(tlist) + BUILD_TARGETS._add_Default = BUILD_TARGETS._do_nothing + BUILD_TARGETS._clear = BUILD_TARGETS._do_nothing + _build_plus_default.extend(tlist) + _build_plus_default._add_Default = _build_plus_default._do_nothing + _build_plus_default._clear = _build_plus_default._do_nothing + +def _Set_Default_Targets_Has_Been_Called(d, fs): + return DEFAULT_TARGETS + +def _Set_Default_Targets_Has_Not_Been_Called(d, fs): + if d is None: + d = [fs.Dir('.')] + return d + +_Get_Default_Targets = _Set_Default_Targets_Has_Not_Been_Called + +def _Set_Default_Targets(env, tlist): + global DEFAULT_TARGETS + global _Get_Default_Targets + _Get_Default_Targets = _Set_Default_Targets_Has_Been_Called + for t in tlist: + if t is None: + # Delete the elements from the list in-place, don't + # reassign an empty list to DEFAULT_TARGETS, so that the + # variables will still point to the same object we point to. + del DEFAULT_TARGETS[:] + BUILD_TARGETS._clear() + _build_plus_default._clear() + elif isinstance(t, SCons.Node.Node): + DEFAULT_TARGETS.append(t) + BUILD_TARGETS._add_Default([t]) + _build_plus_default._add_Default([t]) + else: + nodes = env.arg2nodes(t, env.fs.Entry) + DEFAULT_TARGETS.extend(nodes) + BUILD_TARGETS._add_Default(nodes) + _build_plus_default._add_Default(nodes) + +# +help_text = None + +def HelpFunction(text): + global help_text + if SCons.Script.help_text is None: + SCons.Script.help_text = text + else: + help_text = help_text + text + +# +# Will be non-zero if we are reading an SConscript file. +sconscript_reading = 0 + +# +def Variables(files=[], args=ARGUMENTS): + return SCons.Variables.Variables(files, args) + +def Options(files=[], args=ARGUMENTS): + return SCons.Options.Options(files, args) + +# The list of global functions to add to the SConscript name space +# that end up calling corresponding methods or Builders in the +# DefaultEnvironment(). +GlobalDefaultEnvironmentFunctions = [ + # Methods from the SConsEnvironment class, above. + 'Default', + 'EnsurePythonVersion', + 'EnsureSConsVersion', + 'Exit', + 'Export', + 'GetLaunchDir', + 'Help', + 'Import', + #'SConscript', is handled separately, below. + 'SConscriptChdir', + + # Methods from the Environment.Base class. + 'AddPostAction', + 'AddPreAction', + 'Alias', + 'AlwaysBuild', + 'BuildDir', + 'CacheDir', + 'Clean', + #The Command() method is handled separately, below. + 'Decider', + 'Depends', + 'Dir', + 'NoClean', + 'NoCache', + 'Entry', + 'Execute', + 'File', + 'FindFile', + 'FindInstalledFiles', + 'FindSourceFiles', + 'Flatten', + 'GetBuildPath', + 'Glob', + 'Ignore', + 'Install', + 'InstallAs', + 'Literal', + 'Local', + 'ParseDepends', + 'Precious', + 'Repository', + 'Requires', + 'SConsignFile', + 'SideEffect', + 'SourceCode', + 'SourceSignatures', + 'Split', + 'Tag', + 'TargetSignatures', + 'Value', + 'VariantDir', +] + +GlobalDefaultBuilders = [ + # Supported builders. + 'CFile', + 'CXXFile', + 'DVI', + 'Jar', + 'Java', + 'JavaH', + 'Library', + 'M4', + 'MSVSProject', + 'Object', + 'PCH', + 'PDF', + 'PostScript', + 'Program', + 'RES', + 'RMIC', + 'SharedLibrary', + 'SharedObject', + 'StaticLibrary', + 'StaticObject', + 'Tar', + 'TypeLibrary', + 'Zip', + 'Package', +] + +for name in GlobalDefaultEnvironmentFunctions + GlobalDefaultBuilders: + exec "%s = _SConscript.DefaultEnvironmentCall(%s)" % (name, repr(name)) +del name + +# There are a handful of variables that used to live in the +# Script/SConscript.py module that some SConscript files out there were +# accessing directly as SCons.Script.SConscript.*. The problem is that +# "SConscript" in this namespace is no longer a module, it's a global +# function call--or more precisely, an object that implements a global +# function call through the default Environment. Nevertheless, we can +# maintain backwards compatibility for SConscripts that were reaching in +# this way by hanging some attributes off the "SConscript" object here. +SConscript = _SConscript.DefaultEnvironmentCall('SConscript') + +# Make SConscript look enough like the module it used to be so +# that pychecker doesn't barf. +SConscript.__name__ = 'SConscript' + +SConscript.Arguments = ARGUMENTS +SConscript.ArgList = ARGLIST +SConscript.BuildTargets = BUILD_TARGETS +SConscript.CommandLineTargets = COMMAND_LINE_TARGETS +SConscript.DefaultTargets = DEFAULT_TARGETS + +# The global Command() function must be handled differently than the +# global functions for other construction environment methods because +# we want people to be able to use Actions that must expand $TARGET +# and $SOURCE later, when (and if) the Action is invoked to build +# the target(s). We do this with the subst=1 argument, which creates +# a DefaultEnvironmentCall instance that wraps up a normal default +# construction environment that performs variable substitution, not a +# proxy that doesn't. +# +# There's a flaw here, though, because any other $-variables on a command +# line will *also* be expanded, each to a null string, but that should +# only be a problem in the unusual case where someone was passing a '$' +# on a command line and *expected* the $ to get through to the shell +# because they were calling Command() and not env.Command()... This is +# unlikely enough that we're going to leave this as is and cross that +# bridge if someone actually comes to it. +Command = _SConscript.DefaultEnvironmentCall('Command', subst=1) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Sig.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Sig.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Sig.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Sig.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,63 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Sig.py 2013/03/03 09:48:35 garyo" + +__doc__ = """Place-holder for the old SCons.Sig module hierarchy + +This is no longer used, but code out there (such as the NSIS module on +the SCons wiki) may try to import SCons.Sig. If so, we generate a warning +that points them to the line that caused the import, and don't die. + +If someone actually tried to use the sub-modules or functions within +the package (for example, SCons.Sig.MD5.signature()), then they'll still +get an AttributeError, but at least they'll know where to start looking. +""" + +import SCons.Util +import SCons.Warnings + +msg = 'The SCons.Sig module no longer exists.\n' \ + ' Remove the following "import SCons.Sig" line to eliminate this warning:' + +SCons.Warnings.warn(SCons.Warnings.DeprecatedSigModuleWarning, msg) + +default_calc = None +default_module = None + +class MD5Null(SCons.Util.Null): + def __repr__(self): + return "MD5Null()" + +class TimeStampNull(SCons.Util.Null): + def __repr__(self): + return "TimeStampNull()" + +MD5 = MD5Null() +TimeStamp = TimeStampNull() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Subst.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Subst.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Subst.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Subst.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,904 @@ +"""SCons.Subst + +SCons string substitution. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Subst.py 2013/03/03 09:48:35 garyo" + +import collections +import re + +import SCons.Errors + +from SCons.Util import is_String, is_Sequence + +# Indexed by the SUBST_* constants below. +_strconv = [SCons.Util.to_String_for_subst, + SCons.Util.to_String_for_subst, + SCons.Util.to_String_for_signature] + + + +AllowableExceptions = (IndexError, NameError) + +def SetAllowableExceptions(*excepts): + global AllowableExceptions + AllowableExceptions = [_f for _f in excepts if _f] + +def raise_exception(exception, target, s): + name = exception.__class__.__name__ + msg = "%s `%s' trying to evaluate `%s'" % (name, exception, s) + if target: + raise SCons.Errors.BuildError(target[0], msg) + else: + raise SCons.Errors.UserError(msg) + + + +class Literal(object): + """A wrapper for a string. If you use this object wrapped + around a string, then it will be interpreted as literal. + When passed to the command interpreter, all special + characters will be escaped.""" + def __init__(self, lstr): + self.lstr = lstr + + def __str__(self): + return self.lstr + + def escape(self, escape_func): + return escape_func(self.lstr) + + def for_signature(self): + return self.lstr + + def is_literal(self): + return 1 + +class SpecialAttrWrapper(object): + """This is a wrapper for what we call a 'Node special attribute.' + This is any of the attributes of a Node that we can reference from + Environment variable substitution, such as $TARGET.abspath or + $SOURCES[1].filebase. We implement the same methods as Literal + so we can handle special characters, plus a for_signature method, + such that we can return some canonical string during signature + calculation to avoid unnecessary rebuilds.""" + + def __init__(self, lstr, for_signature=None): + """The for_signature parameter, if supplied, will be the + canonical string we return from for_signature(). Else + we will simply return lstr.""" + self.lstr = lstr + if for_signature: + self.forsig = for_signature + else: + self.forsig = lstr + + def __str__(self): + return self.lstr + + def escape(self, escape_func): + return escape_func(self.lstr) + + def for_signature(self): + return self.forsig + + def is_literal(self): + return 1 + +def quote_spaces(arg): + """Generic function for putting double quotes around any string that + has white space in it.""" + if ' ' in arg or '\t' in arg: + return '"%s"' % arg + else: + return str(arg) + +class CmdStringHolder(collections.UserString): + """This is a special class used to hold strings generated by + scons_subst() and scons_subst_list(). It defines a special method + escape(). When passed a function with an escape algorithm for a + particular platform, it will return the contained string with the + proper escape sequences inserted. + """ + def __init__(self, cmd, literal=None): + collections.UserString.__init__(self, cmd) + self.literal = literal + + def is_literal(self): + return self.literal + + def escape(self, escape_func, quote_func=quote_spaces): + """Escape the string with the supplied function. The + function is expected to take an arbitrary string, then + return it with all special characters escaped and ready + for passing to the command interpreter. + + After calling this function, the next call to str() will + return the escaped string. + """ + + if self.is_literal(): + return escape_func(self.data) + elif ' ' in self.data or '\t' in self.data: + return quote_func(self.data) + else: + return self.data + +def escape_list(mylist, escape_func): + """Escape a list of arguments by running the specified escape_func + on every object in the list that has an escape() method.""" + def escape(obj, escape_func=escape_func): + try: + e = obj.escape + except AttributeError: + return obj + else: + return e(escape_func) + return list(map(escape, mylist)) + +class NLWrapper(object): + """A wrapper class that delays turning a list of sources or targets + into a NodeList until it's needed. The specified function supplied + when the object is initialized is responsible for turning raw nodes + into proxies that implement the special attributes like .abspath, + .source, etc. This way, we avoid creating those proxies just + "in case" someone is going to use $TARGET or the like, and only + go through the trouble if we really have to. + + In practice, this might be a wash performance-wise, but it's a little + cleaner conceptually... + """ + + def __init__(self, list, func): + self.list = list + self.func = func + def _return_nodelist(self): + return self.nodelist + def _gen_nodelist(self): + mylist = self.list + if mylist is None: + mylist = [] + elif not is_Sequence(mylist): + mylist = [mylist] + # The map(self.func) call is what actually turns + # a list into appropriate proxies. + self.nodelist = SCons.Util.NodeList(list(map(self.func, mylist))) + self._create_nodelist = self._return_nodelist + return self.nodelist + _create_nodelist = _gen_nodelist + + +class Targets_or_Sources(collections.UserList): + """A class that implements $TARGETS or $SOURCES expansions by in turn + wrapping a NLWrapper. This class handles the different methods used + to access the list, calling the NLWrapper to create proxies on demand. + + Note that we subclass collections.UserList purely so that the + is_Sequence() function will identify an object of this class as + a list during variable expansion. We're not really using any + collections.UserList methods in practice. + """ + def __init__(self, nl): + self.nl = nl + def __getattr__(self, attr): + nl = self.nl._create_nodelist() + return getattr(nl, attr) + def __getitem__(self, i): + nl = self.nl._create_nodelist() + return nl[i] + def __getslice__(self, i, j): + nl = self.nl._create_nodelist() + i = max(i, 0); j = max(j, 0) + return nl[i:j] + def __str__(self): + nl = self.nl._create_nodelist() + return str(nl) + def __repr__(self): + nl = self.nl._create_nodelist() + return repr(nl) + +class Target_or_Source(object): + """A class that implements $TARGET or $SOURCE expansions by in turn + wrapping a NLWrapper. This class handles the different methods used + to access an individual proxy Node, calling the NLWrapper to create + a proxy on demand. + """ + def __init__(self, nl): + self.nl = nl + def __getattr__(self, attr): + nl = self.nl._create_nodelist() + try: + nl0 = nl[0] + except IndexError: + # If there is nothing in the list, then we have no attributes to + # pass through, so raise AttributeError for everything. + raise AttributeError("NodeList has no attribute: %s" % attr) + return getattr(nl0, attr) + def __str__(self): + nl = self.nl._create_nodelist() + if nl: + return str(nl[0]) + return '' + def __repr__(self): + nl = self.nl._create_nodelist() + if nl: + return repr(nl[0]) + return '' + +class NullNodeList(SCons.Util.NullSeq): + def __call__(self, *args, **kwargs): return '' + def __str__(self): return '' + +NullNodesList = NullNodeList() + +def subst_dict(target, source): + """Create a dictionary for substitution of special + construction variables. + + This translates the following special arguments: + + target - the target (object or array of objects), + used to generate the TARGET and TARGETS + construction variables + + source - the source (object or array of objects), + used to generate the SOURCES and SOURCE + construction variables + """ + dict = {} + + if target: + def get_tgt_subst_proxy(thing): + try: + subst_proxy = thing.get_subst_proxy() + except AttributeError: + subst_proxy = thing # probably a string, just return it + return subst_proxy + tnl = NLWrapper(target, get_tgt_subst_proxy) + dict['TARGETS'] = Targets_or_Sources(tnl) + dict['TARGET'] = Target_or_Source(tnl) + + # This is a total cheat, but hopefully this dictionary goes + # away soon anyway. We just let these expand to $TARGETS + # because that's "good enough" for the use of ToolSurrogates + # (see test/ToolSurrogate.py) to generate documentation. + dict['CHANGED_TARGETS'] = '$TARGETS' + dict['UNCHANGED_TARGETS'] = '$TARGETS' + else: + dict['TARGETS'] = NullNodesList + dict['TARGET'] = NullNodesList + + if source: + def get_src_subst_proxy(node): + try: + rfile = node.rfile + except AttributeError: + pass + else: + node = rfile() + try: + return node.get_subst_proxy() + except AttributeError: + return node # probably a String, just return it + snl = NLWrapper(source, get_src_subst_proxy) + dict['SOURCES'] = Targets_or_Sources(snl) + dict['SOURCE'] = Target_or_Source(snl) + + # This is a total cheat, but hopefully this dictionary goes + # away soon anyway. We just let these expand to $TARGETS + # because that's "good enough" for the use of ToolSurrogates + # (see test/ToolSurrogate.py) to generate documentation. + dict['CHANGED_SOURCES'] = '$SOURCES' + dict['UNCHANGED_SOURCES'] = '$SOURCES' + else: + dict['SOURCES'] = NullNodesList + dict['SOURCE'] = NullNodesList + + return dict + +# Constants for the "mode" parameter to scons_subst_list() and +# scons_subst(). SUBST_RAW gives the raw command line. SUBST_CMD +# gives a command line suitable for passing to a shell. SUBST_SIG +# gives a command line appropriate for calculating the signature +# of a command line...if this changes, we should rebuild. +SUBST_CMD = 0 +SUBST_RAW = 1 +SUBST_SIG = 2 + +_rm = re.compile(r'\$[()]') +_remove = re.compile(r'\$\([^\$]*(\$[^\)][^\$]*)*\$\)') + +# Indexed by the SUBST_* constants above. +_regex_remove = [ _rm, None, _remove ] + +def _rm_list(list): + #return [ l for l in list if not l in ('$(', '$)') ] + return [l for l in list if not l in ('$(', '$)')] + +def _remove_list(list): + result = [] + do_append = result.append + for l in list: + if l == '$(': + do_append = lambda x: None + elif l == '$)': + do_append = result.append + else: + do_append(l) + return result + +# Indexed by the SUBST_* constants above. +_list_remove = [ _rm_list, None, _remove_list ] + +# Regular expressions for splitting strings and handling substitutions, +# for use by the scons_subst() and scons_subst_list() functions: +# +# The first expression compiled matches all of the $-introduced tokens +# that we need to process in some way, and is used for substitutions. +# The expressions it matches are: +# +# "$$" +# "$(" +# "$)" +# "$variable" [must begin with alphabetic or underscore] +# "${any stuff}" +# +# The second expression compiled is used for splitting strings into tokens +# to be processed, and it matches all of the tokens listed above, plus +# the following that affect how arguments do or don't get joined together: +# +# " " [white space] +# "non-white-space" [without any dollar signs] +# "$" [single dollar sign] +# +_dollar_exps_str = r'\$[\$\(\)]|\$[_a-zA-Z][\.\w]*|\${[^}]*}' +_dollar_exps = re.compile(r'(%s)' % _dollar_exps_str) +_separate_args = re.compile(r'(%s|\s+|[^\s\$]+|\$)' % _dollar_exps_str) + +# This regular expression is used to replace strings of multiple white +# space characters in the string result from the scons_subst() function. +_space_sep = re.compile(r'[\t ]+(?![^{]*})') + +def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, gvars={}, lvars={}, conv=None): + """Expand a string or list containing construction variable + substitutions. + + This is the work-horse function for substitutions in file names + and the like. The companion scons_subst_list() function (below) + handles separating command lines into lists of arguments, so see + that function if that's what you're looking for. + """ + if isinstance(strSubst, str) and strSubst.find('$') < 0: + return strSubst + + class StringSubber(object): + """A class to construct the results of a scons_subst() call. + + This binds a specific construction environment, mode, target and + source with two methods (substitute() and expand()) that handle + the expansion. + """ + def __init__(self, env, mode, conv, gvars): + self.env = env + self.mode = mode + self.conv = conv + self.gvars = gvars + + def expand(self, s, lvars): + """Expand a single "token" as necessary, returning an + appropriate string containing the expansion. + + This handles expanding different types of things (strings, + lists, callables) appropriately. It calls the wrapper + substitute() method to re-expand things as necessary, so that + the results of expansions of side-by-side strings still get + re-evaluated separately, not smushed together. + """ + if is_String(s): + try: + s0, s1 = s[:2] + except (IndexError, ValueError): + return s + if s0 != '$': + return s + if s1 == '$': + return '$' + elif s1 in '()': + return s + else: + key = s[1:] + if key[0] == '{' or key.find('.') >= 0: + if key[0] == '{': + key = key[1:-1] + try: + s = eval(key, self.gvars, lvars) + except KeyboardInterrupt: + raise + except Exception, e: + if e.__class__ in AllowableExceptions: + return '' + raise_exception(e, lvars['TARGETS'], s) + else: + if key in lvars: + s = lvars[key] + elif key in self.gvars: + s = self.gvars[key] + elif not NameError in AllowableExceptions: + raise_exception(NameError(key), lvars['TARGETS'], s) + else: + return '' + + # Before re-expanding the result, handle + # recursive expansion by copying the local + # variable dictionary and overwriting a null + # string for the value of the variable name + # we just expanded. + # + # This could potentially be optimized by only + # copying lvars when s contains more expansions, + # but lvars is usually supposed to be pretty + # small, and deeply nested variable expansions + # are probably more the exception than the norm, + # so it should be tolerable for now. + lv = lvars.copy() + var = key.split('.')[0] + lv[var] = '' + return self.substitute(s, lv) + elif is_Sequence(s): + def func(l, conv=self.conv, substitute=self.substitute, lvars=lvars): + return conv(substitute(l, lvars)) + return list(map(func, s)) + elif callable(s): + try: + s = s(target=lvars['TARGETS'], + source=lvars['SOURCES'], + env=self.env, + for_signature=(self.mode != SUBST_CMD)) + except TypeError: + # This probably indicates that it's a callable + # object that doesn't match our calling arguments + # (like an Action). + if self.mode == SUBST_RAW: + return s + s = self.conv(s) + return self.substitute(s, lvars) + elif s is None: + return '' + else: + return s + + def substitute(self, args, lvars): + """Substitute expansions in an argument or list of arguments. + + This serves as a wrapper for splitting up a string into + separate tokens. + """ + if is_String(args) and not isinstance(args, CmdStringHolder): + args = str(args) # In case it's a UserString. + try: + def sub_match(match): + return self.conv(self.expand(match.group(1), lvars)) + result = _dollar_exps.sub(sub_match, args) + except TypeError: + # If the internal conversion routine doesn't return + # strings (it could be overridden to return Nodes, for + # example), then the 1.5.2 re module will throw this + # exception. Back off to a slower, general-purpose + # algorithm that works for all data types. + args = _separate_args.findall(args) + result = [] + for a in args: + result.append(self.conv(self.expand(a, lvars))) + if len(result) == 1: + result = result[0] + else: + result = ''.join(map(str, result)) + return result + else: + return self.expand(args, lvars) + + if conv is None: + conv = _strconv[mode] + + # Doing this every time is a bit of a waste, since the Executor + # has typically already populated the OverrideEnvironment with + # $TARGET/$SOURCE variables. We're keeping this (for now), though, + # because it supports existing behavior that allows us to call + # an Action directly with an arbitrary target+source pair, which + # we use in Tool/tex.py to handle calling $BIBTEX when necessary. + # If we dropped that behavior (or found another way to cover it), + # we could get rid of this call completely and just rely on the + # Executor setting the variables. + if 'TARGET' not in lvars: + d = subst_dict(target, source) + if d: + lvars = lvars.copy() + lvars.update(d) + + # We're (most likely) going to eval() things. If Python doesn't + # find a __builtins__ value in the global dictionary used for eval(), + # it copies the current global values for you. Avoid this by + # setting it explicitly and then deleting, so we don't pollute the + # construction environment Dictionary(ies) that are typically used + # for expansion. + gvars['__builtins__'] = __builtins__ + + ss = StringSubber(env, mode, conv, gvars) + result = ss.substitute(strSubst, lvars) + + try: + del gvars['__builtins__'] + except KeyError: + pass + + if is_String(result): + # Remove $(-$) pairs and any stuff in between, + # if that's appropriate. + remove = _regex_remove[mode] + if remove: + result = remove.sub('', result) + if mode != SUBST_RAW: + # Compress strings of white space characters into + # a single space. + result = _space_sep.sub(' ', result).strip() + elif is_Sequence(result): + remove = _list_remove[mode] + if remove: + result = remove(result) + + return result + +#Subst_List_Strings = {} + +def scons_subst_list(strSubst, env, mode=SUBST_RAW, target=None, source=None, gvars={}, lvars={}, conv=None): + """Substitute construction variables in a string (or list or other + object) and separate the arguments into a command list. + + The companion scons_subst() function (above) handles basic + substitutions within strings, so see that function instead + if that's what you're looking for. + """ +# try: +# Subst_List_Strings[strSubst] = Subst_List_Strings[strSubst] + 1 +# except KeyError: +# Subst_List_Strings[strSubst] = 1 +# import SCons.Debug +# SCons.Debug.caller_trace(1) + class ListSubber(collections.UserList): + """A class to construct the results of a scons_subst_list() call. + + Like StringSubber, this class binds a specific construction + environment, mode, target and source with two methods + (substitute() and expand()) that handle the expansion. + + In addition, however, this class is used to track the state of + the result(s) we're gathering so we can do the appropriate thing + whenever we have to append another word to the result--start a new + line, start a new word, append to the current word, etc. We do + this by setting the "append" attribute to the right method so + that our wrapper methods only need ever call ListSubber.append(), + and the rest of the object takes care of doing the right thing + internally. + """ + def __init__(self, env, mode, conv, gvars): + collections.UserList.__init__(self, []) + self.env = env + self.mode = mode + self.conv = conv + self.gvars = gvars + + if self.mode == SUBST_RAW: + self.add_strip = lambda x: self.append(x) + else: + self.add_strip = lambda x: None + self.in_strip = None + self.next_line() + + def expand(self, s, lvars, within_list): + """Expand a single "token" as necessary, appending the + expansion to the current result. + + This handles expanding different types of things (strings, + lists, callables) appropriately. It calls the wrapper + substitute() method to re-expand things as necessary, so that + the results of expansions of side-by-side strings still get + re-evaluated separately, not smushed together. + """ + + if is_String(s): + try: + s0, s1 = s[:2] + except (IndexError, ValueError): + self.append(s) + return + if s0 != '$': + self.append(s) + return + if s1 == '$': + self.append('$') + elif s1 == '(': + self.open_strip('$(') + elif s1 == ')': + self.close_strip('$)') + else: + key = s[1:] + if key[0] == '{' or key.find('.') >= 0: + if key[0] == '{': + key = key[1:-1] + try: + s = eval(key, self.gvars, lvars) + except KeyboardInterrupt: + raise + except Exception, e: + if e.__class__ in AllowableExceptions: + return + raise_exception(e, lvars['TARGETS'], s) + else: + if key in lvars: + s = lvars[key] + elif key in self.gvars: + s = self.gvars[key] + elif not NameError in AllowableExceptions: + raise_exception(NameError(), lvars['TARGETS'], s) + else: + return + + # Before re-expanding the result, handle + # recursive expansion by copying the local + # variable dictionary and overwriting a null + # string for the value of the variable name + # we just expanded. + lv = lvars.copy() + var = key.split('.')[0] + lv[var] = '' + self.substitute(s, lv, 0) + self.this_word() + elif is_Sequence(s): + for a in s: + self.substitute(a, lvars, 1) + self.next_word() + elif callable(s): + try: + s = s(target=lvars['TARGETS'], + source=lvars['SOURCES'], + env=self.env, + for_signature=(self.mode != SUBST_CMD)) + except TypeError: + # This probably indicates that it's a callable + # object that doesn't match our calling arguments + # (like an Action). + if self.mode == SUBST_RAW: + self.append(s) + return + s = self.conv(s) + self.substitute(s, lvars, within_list) + elif s is None: + self.this_word() + else: + self.append(s) + + def substitute(self, args, lvars, within_list): + """Substitute expansions in an argument or list of arguments. + + This serves as a wrapper for splitting up a string into + separate tokens. + """ + + if is_String(args) and not isinstance(args, CmdStringHolder): + args = str(args) # In case it's a UserString. + args = _separate_args.findall(args) + for a in args: + if a[0] in ' \t\n\r\f\v': + if '\n' in a: + self.next_line() + elif within_list: + self.append(a) + else: + self.next_word() + else: + self.expand(a, lvars, within_list) + else: + self.expand(args, lvars, within_list) + + def next_line(self): + """Arrange for the next word to start a new line. This + is like starting a new word, except that we have to append + another line to the result.""" + collections.UserList.append(self, []) + self.next_word() + + def this_word(self): + """Arrange for the next word to append to the end of the + current last word in the result.""" + self.append = self.add_to_current_word + + def next_word(self): + """Arrange for the next word to start a new word.""" + self.append = self.add_new_word + + def add_to_current_word(self, x): + """Append the string x to the end of the current last word + in the result. If that is not possible, then just add + it as a new word. Make sure the entire concatenated string + inherits the object attributes of x (in particular, the + escape function) by wrapping it as CmdStringHolder.""" + + if not self.in_strip or self.mode != SUBST_SIG: + try: + current_word = self[-1][-1] + except IndexError: + self.add_new_word(x) + else: + # All right, this is a hack and it should probably + # be refactored out of existence in the future. + # The issue is that we want to smoosh words together + # and make one file name that gets escaped if + # we're expanding something like foo$EXTENSION, + # but we don't want to smoosh them together if + # it's something like >$TARGET, because then we'll + # treat the '>' like it's part of the file name. + # So for now, just hard-code looking for the special + # command-line redirection characters... + try: + last_char = str(current_word)[-1] + except IndexError: + last_char = '\0' + if last_char in '<>|': + self.add_new_word(x) + else: + y = current_word + x + + # We used to treat a word appended to a literal + # as a literal itself, but this caused problems + # with interpreting quotes around space-separated + # targets on command lines. Removing this makes + # none of the "substantive" end-to-end tests fail, + # so we'll take this out but leave it commented + # for now in case there's a problem not covered + # by the test cases and we need to resurrect this. + #literal1 = self.literal(self[-1][-1]) + #literal2 = self.literal(x) + y = self.conv(y) + if is_String(y): + #y = CmdStringHolder(y, literal1 or literal2) + y = CmdStringHolder(y, None) + self[-1][-1] = y + + def add_new_word(self, x): + if not self.in_strip or self.mode != SUBST_SIG: + literal = self.literal(x) + x = self.conv(x) + if is_String(x): + x = CmdStringHolder(x, literal) + self[-1].append(x) + self.append = self.add_to_current_word + + def literal(self, x): + try: + l = x.is_literal + except AttributeError: + return None + else: + return l() + + def open_strip(self, x): + """Handle the "open strip" $( token.""" + self.add_strip(x) + self.in_strip = 1 + + def close_strip(self, x): + """Handle the "close strip" $) token.""" + self.add_strip(x) + self.in_strip = None + + if conv is None: + conv = _strconv[mode] + + # Doing this every time is a bit of a waste, since the Executor + # has typically already populated the OverrideEnvironment with + # $TARGET/$SOURCE variables. We're keeping this (for now), though, + # because it supports existing behavior that allows us to call + # an Action directly with an arbitrary target+source pair, which + # we use in Tool/tex.py to handle calling $BIBTEX when necessary. + # If we dropped that behavior (or found another way to cover it), + # we could get rid of this call completely and just rely on the + # Executor setting the variables. + if 'TARGET' not in lvars: + d = subst_dict(target, source) + if d: + lvars = lvars.copy() + lvars.update(d) + + # We're (most likely) going to eval() things. If Python doesn't + # find a __builtins__ value in the global dictionary used for eval(), + # it copies the current global values for you. Avoid this by + # setting it explicitly and then deleting, so we don't pollute the + # construction environment Dictionary(ies) that are typically used + # for expansion. + gvars['__builtins__'] = __builtins__ + + ls = ListSubber(env, mode, conv, gvars) + ls.substitute(strSubst, lvars, 0) + + try: + del gvars['__builtins__'] + except KeyError: + pass + + return ls.data + +def scons_subst_once(strSubst, env, key): + """Perform single (non-recursive) substitution of a single + construction variable keyword. + + This is used when setting a variable when copying or overriding values + in an Environment. We want to capture (expand) the old value before + we override it, so people can do things like: + + env2 = env.Clone(CCFLAGS = '$CCFLAGS -g') + + We do this with some straightforward, brute-force code here... + """ + if isinstance(strSubst, str) and strSubst.find('$') < 0: + return strSubst + + matchlist = ['$' + key, '${' + key + '}'] + val = env.get(key, '') + def sub_match(match, val=val, matchlist=matchlist): + a = match.group(1) + if a in matchlist: + a = val + if is_Sequence(a): + return ' '.join(map(str, a)) + else: + return str(a) + + if is_Sequence(strSubst): + result = [] + for arg in strSubst: + if is_String(arg): + if arg in matchlist: + arg = val + if is_Sequence(arg): + result.extend(arg) + else: + result.append(arg) + else: + result.append(_dollar_exps.sub(sub_match, arg)) + else: + result.append(arg) + return result + elif is_String(strSubst): + return _dollar_exps.sub(sub_match, strSubst) + else: + return strSubst + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Taskmaster.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Taskmaster.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Taskmaster.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Taskmaster.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,1032 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__doc__ = """ +Generic Taskmaster module for the SCons build engine. + +This module contains the primary interface(s) between a wrapping user +interface and the SCons build engine. There are two key classes here: + + Taskmaster + This is the main engine for walking the dependency graph and + calling things to decide what does or doesn't need to be built. + + Task + This is the base class for allowing a wrapping interface to + decide what does or doesn't actually need to be done. The + intention is for a wrapping interface to subclass this as + appropriate for different types of behavior it may need. + + The canonical example is the SCons native Python interface, + which has Task subclasses that handle its specific behavior, + like printing "`foo' is up to date" when a top-level target + doesn't need to be built, and handling the -c option by removing + targets as its "build" action. There is also a separate subclass + for suppressing this output when the -q option is used. + + The Taskmaster instantiates a Task object for each (set of) + target(s) that it decides need to be evaluated and/or built. +""" + +__revision__ = "src/engine/SCons/Taskmaster.py 2013/03/03 09:48:35 garyo" + +from itertools import chain +import operator +import sys +import traceback + +import SCons.Errors +import SCons.Node +import SCons.Warnings + +StateString = SCons.Node.StateString +NODE_NO_STATE = SCons.Node.no_state +NODE_PENDING = SCons.Node.pending +NODE_EXECUTING = SCons.Node.executing +NODE_UP_TO_DATE = SCons.Node.up_to_date +NODE_EXECUTED = SCons.Node.executed +NODE_FAILED = SCons.Node.failed + +print_prepare = 0 # set by option --debug=prepare + +# A subsystem for recording stats about how different Nodes are handled by +# the main Taskmaster loop. There's no external control here (no need for +# a --debug= option); enable it by changing the value of CollectStats. + +CollectStats = None + +class Stats(object): + """ + A simple class for holding statistics about the disposition of a + Node by the Taskmaster. If we're collecting statistics, each Node + processed by the Taskmaster gets one of these attached, in which case + the Taskmaster records its decision each time it processes the Node. + (Ideally, that's just once per Node.) + """ + def __init__(self): + """ + Instantiates a Taskmaster.Stats object, initializing all + appropriate counters to zero. + """ + self.considered = 0 + self.already_handled = 0 + self.problem = 0 + self.child_failed = 0 + self.not_built = 0 + self.side_effects = 0 + self.build = 0 + +StatsNodes = [] + +fmt = "%(considered)3d "\ + "%(already_handled)3d " \ + "%(problem)3d " \ + "%(child_failed)3d " \ + "%(not_built)3d " \ + "%(side_effects)3d " \ + "%(build)3d " + +def dump_stats(): + for n in sorted(StatsNodes, key=lambda a: str(a)): + print (fmt % n.stats.__dict__) + str(n) + + + +class Task(object): + """ + Default SCons build engine task. + + This controls the interaction of the actual building of node + and the rest of the engine. + + This is expected to handle all of the normally-customizable + aspects of controlling a build, so any given application + *should* be able to do what it wants by sub-classing this + class and overriding methods as appropriate. If an application + needs to customze something by sub-classing Taskmaster (or + some other build engine class), we should first try to migrate + that functionality into this class. + + Note that it's generally a good idea for sub-classes to call + these methods explicitly to update state, etc., rather than + roll their own interaction with Taskmaster from scratch. + """ + def __init__(self, tm, targets, top, node): + self.tm = tm + self.targets = targets + self.top = top + self.node = node + self.exc_clear() + + def trace_message(self, method, node, description='node'): + fmt = '%-20s %s %s\n' + return fmt % (method + ':', description, self.tm.trace_node(node)) + + def display(self, message): + """ + Hook to allow the calling interface to display a message. + + This hook gets called as part of preparing a task for execution + (that is, a Node to be built). As part of figuring out what Node + should be built next, the actually target list may be altered, + along with a message describing the alteration. The calling + interface can subclass Task and provide a concrete implementation + of this method to see those messages. + """ + pass + + def prepare(self): + """ + Called just before the task is executed. + + This is mainly intended to give the target Nodes a chance to + unlink underlying files and make all necessary directories before + the Action is actually called to build the targets. + """ + global print_prepare + T = self.tm.trace + if T: T.write(self.trace_message(u'Task.prepare()', self.node)) + + # Now that it's the appropriate time, give the TaskMaster a + # chance to raise any exceptions it encountered while preparing + # this task. + self.exception_raise() + + if self.tm.message: + self.display(self.tm.message) + self.tm.message = None + + # Let the targets take care of any necessary preparations. + # This includes verifying that all of the necessary sources + # and dependencies exist, removing the target file(s), etc. + # + # As of April 2008, the get_executor().prepare() method makes + # sure that all of the aggregate sources necessary to build this + # Task's target(s) exist in one up-front check. The individual + # target t.prepare() methods check that each target's explicit + # or implicit dependencies exists, and also initialize the + # .sconsign info. + executor = self.targets[0].get_executor() + executor.prepare() + for t in executor.get_action_targets(): + if print_prepare: + print "Preparing target %s..."%t + for s in t.side_effects: + print "...with side-effect %s..."%s + t.prepare() + for s in t.side_effects: + if print_prepare: + print "...Preparing side-effect %s..."%s + s.prepare() + + def get_target(self): + """Fetch the target being built or updated by this task. + """ + return self.node + + def needs_execute(self): + # TODO(deprecate): "return True" is the old default behavior; + # change it to NotImplementedError (after running through the + # Deprecation Cycle) so the desired behavior is explicitly + # determined by which concrete subclass is used. + #raise NotImplementedError + msg = ('Taskmaster.Task is an abstract base class; instead of\n' + '\tusing it directly, ' + 'derive from it and override the abstract methods.') + SCons.Warnings.warn(SCons.Warnings.TaskmasterNeedsExecuteWarning, msg) + return True + + def execute(self): + """ + Called to execute the task. + + This method is called from multiple threads in a parallel build, + so only do thread safe stuff here. Do thread unsafe stuff in + prepare(), executed() or failed(). + """ + T = self.tm.trace + if T: T.write(self.trace_message(u'Task.execute()', self.node)) + + try: + cached_targets = [] + for t in self.targets: + if not t.retrieve_from_cache(): + break + cached_targets.append(t) + if len(cached_targets) < len(self.targets): + # Remove targets before building. It's possible that we + # partially retrieved targets from the cache, leaving + # them in read-only mode. That might cause the command + # to fail. + # + for t in cached_targets: + try: + t.fs.unlink(t.path) + except (IOError, OSError): + pass + self.targets[0].build() + else: + for t in cached_targets: + t.cached = 1 + except SystemExit: + exc_value = sys.exc_info()[1] + raise SCons.Errors.ExplicitExit(self.targets[0], exc_value.code) + except SCons.Errors.UserError: + raise + except SCons.Errors.BuildError: + raise + except Exception, e: + buildError = SCons.Errors.convert_to_BuildError(e) + buildError.node = self.targets[0] + buildError.exc_info = sys.exc_info() + raise buildError + + def executed_without_callbacks(self): + """ + Called when the task has been successfully executed + and the Taskmaster instance doesn't want to call + the Node's callback methods. + """ + T = self.tm.trace + if T: T.write(self.trace_message('Task.executed_without_callbacks()', + self.node)) + + for t in self.targets: + if t.get_state() == NODE_EXECUTING: + for side_effect in t.side_effects: + side_effect.set_state(NODE_NO_STATE) + t.set_state(NODE_EXECUTED) + + def executed_with_callbacks(self): + """ + Called when the task has been successfully executed and + the Taskmaster instance wants to call the Node's callback + methods. + + This may have been a do-nothing operation (to preserve build + order), so we must check the node's state before deciding whether + it was "built", in which case we call the appropriate Node method. + In any event, we always call "visited()", which will handle any + post-visit actions that must take place regardless of whether + or not the target was an actual built target or a source Node. + """ + T = self.tm.trace + if T: T.write(self.trace_message('Task.executed_with_callbacks()', + self.node)) + + for t in self.targets: + if t.get_state() == NODE_EXECUTING: + for side_effect in t.side_effects: + side_effect.set_state(NODE_NO_STATE) + t.set_state(NODE_EXECUTED) + if not t.cached: + t.push_to_cache() + t.built() + t.visited() + + executed = executed_with_callbacks + + def failed(self): + """ + Default action when a task fails: stop the build. + + Note: Although this function is normally invoked on nodes in + the executing state, it might also be invoked on up-to-date + nodes when using Configure(). + """ + self.fail_stop() + + def fail_stop(self): + """ + Explicit stop-the-build failure. + + This sets failure status on the target nodes and all of + their dependent parent nodes. + + Note: Although this function is normally invoked on nodes in + the executing state, it might also be invoked on up-to-date + nodes when using Configure(). + """ + T = self.tm.trace + if T: T.write(self.trace_message('Task.failed_stop()', self.node)) + + # Invoke will_not_build() to clean-up the pending children + # list. + self.tm.will_not_build(self.targets, lambda n: n.set_state(NODE_FAILED)) + + # Tell the taskmaster to not start any new tasks + self.tm.stop() + + # We're stopping because of a build failure, but give the + # calling Task class a chance to postprocess() the top-level + # target under which the build failure occurred. + self.targets = [self.tm.current_top] + self.top = 1 + + def fail_continue(self): + """ + Explicit continue-the-build failure. + + This sets failure status on the target nodes and all of + their dependent parent nodes. + + Note: Although this function is normally invoked on nodes in + the executing state, it might also be invoked on up-to-date + nodes when using Configure(). + """ + T = self.tm.trace + if T: T.write(self.trace_message('Task.failed_continue()', self.node)) + + self.tm.will_not_build(self.targets, lambda n: n.set_state(NODE_FAILED)) + + def make_ready_all(self): + """ + Marks all targets in a task ready for execution. + + This is used when the interface needs every target Node to be + visited--the canonical example being the "scons -c" option. + """ + T = self.tm.trace + if T: T.write(self.trace_message('Task.make_ready_all()', self.node)) + + self.out_of_date = self.targets[:] + for t in self.targets: + t.disambiguate().set_state(NODE_EXECUTING) + for s in t.side_effects: + # add disambiguate here to mirror the call on targets above + s.disambiguate().set_state(NODE_EXECUTING) + + def make_ready_current(self): + """ + Marks all targets in a task ready for execution if any target + is not current. + + This is the default behavior for building only what's necessary. + """ + T = self.tm.trace + if T: T.write(self.trace_message(u'Task.make_ready_current()', + self.node)) + + self.out_of_date = [] + needs_executing = False + for t in self.targets: + try: + t.disambiguate().make_ready() + is_up_to_date = not t.has_builder() or \ + (not t.always_build and t.is_up_to_date()) + except EnvironmentError, e: + raise SCons.Errors.BuildError(node=t, errstr=e.strerror, filename=e.filename) + + if not is_up_to_date: + self.out_of_date.append(t) + needs_executing = True + + if needs_executing: + for t in self.targets: + t.set_state(NODE_EXECUTING) + for s in t.side_effects: + # add disambiguate here to mirror the call on targets in first loop above + s.disambiguate().set_state(NODE_EXECUTING) + else: + for t in self.targets: + # We must invoke visited() to ensure that the node + # information has been computed before allowing the + # parent nodes to execute. (That could occur in a + # parallel build...) + t.visited() + t.set_state(NODE_UP_TO_DATE) + + make_ready = make_ready_current + + def postprocess(self): + """ + Post-processes a task after it's been executed. + + This examines all the targets just built (or not, we don't care + if the build was successful, or even if there was no build + because everything was up-to-date) to see if they have any + waiting parent Nodes, or Nodes waiting on a common side effect, + that can be put back on the candidates list. + """ + T = self.tm.trace + if T: T.write(self.trace_message(u'Task.postprocess()', self.node)) + + # We may have built multiple targets, some of which may have + # common parents waiting for this build. Count up how many + # targets each parent was waiting for so we can subtract the + # values later, and so we *don't* put waiting side-effect Nodes + # back on the candidates list if the Node is also a waiting + # parent. + + targets = set(self.targets) + + pending_children = self.tm.pending_children + parents = {} + for t in targets: + # A node can only be in the pending_children set if it has + # some waiting_parents. + if t.waiting_parents: + if T: T.write(self.trace_message(u'Task.postprocess()', + t, + 'removing')) + pending_children.discard(t) + for p in t.waiting_parents: + parents[p] = parents.get(p, 0) + 1 + + for t in targets: + for s in t.side_effects: + if s.get_state() == NODE_EXECUTING: + s.set_state(NODE_NO_STATE) + for p in s.waiting_parents: + parents[p] = parents.get(p, 0) + 1 + for p in s.waiting_s_e: + if p.ref_count == 0: + self.tm.candidates.append(p) + + for p, subtract in parents.items(): + p.ref_count = p.ref_count - subtract + if T: T.write(self.trace_message(u'Task.postprocess()', + p, + 'adjusted parent ref count')) + if p.ref_count == 0: + self.tm.candidates.append(p) + + for t in targets: + t.postprocess() + + # Exception handling subsystem. + # + # Exceptions that occur while walking the DAG or examining Nodes + # must be raised, but must be raised at an appropriate time and in + # a controlled manner so we can, if necessary, recover gracefully, + # possibly write out signature information for Nodes we've updated, + # etc. This is done by having the Taskmaster tell us about the + # exception, and letting + + def exc_info(self): + """ + Returns info about a recorded exception. + """ + return self.exception + + def exc_clear(self): + """ + Clears any recorded exception. + + This also changes the "exception_raise" attribute to point + to the appropriate do-nothing method. + """ + self.exception = (None, None, None) + self.exception_raise = self._no_exception_to_raise + + def exception_set(self, exception=None): + """ + Records an exception to be raised at the appropriate time. + + This also changes the "exception_raise" attribute to point + to the method that will, in fact + """ + if not exception: + exception = sys.exc_info() + self.exception = exception + self.exception_raise = self._exception_raise + + def _no_exception_to_raise(self): + pass + + def _exception_raise(self): + """ + Raises a pending exception that was recorded while getting a + Task ready for execution. + """ + exc = self.exc_info()[:] + try: + exc_type, exc_value, exc_traceback = exc + except ValueError: + exc_type, exc_value = exc + exc_traceback = None + raise exc_type, exc_value, exc_traceback + +class AlwaysTask(Task): + def needs_execute(self): + """ + Always returns True (indicating this Task should always + be executed). + + Subclasses that need this behavior (as opposed to the default + of only executing Nodes that are out of date w.r.t. their + dependencies) can use this as follows: + + class MyTaskSubclass(SCons.Taskmaster.Task): + needs_execute = SCons.Taskmaster.Task.execute_always + """ + return True + +class OutOfDateTask(Task): + def needs_execute(self): + """ + Returns True (indicating this Task should be executed) if this + Task's target state indicates it needs executing, which has + already been determined by an earlier up-to-date check. + """ + return self.targets[0].get_state() == SCons.Node.executing + + +def find_cycle(stack, visited): + if stack[-1] in visited: + return None + visited.add(stack[-1]) + for n in stack[-1].waiting_parents: + stack.append(n) + if stack[0] == stack[-1]: + return stack + if find_cycle(stack, visited): + return stack + stack.pop() + return None + + +class Taskmaster(object): + """ + The Taskmaster for walking the dependency DAG. + """ + + def __init__(self, targets=[], tasker=None, order=None, trace=None): + self.original_top = targets + self.top_targets_left = targets[:] + self.top_targets_left.reverse() + self.candidates = [] + if tasker is None: + tasker = OutOfDateTask + self.tasker = tasker + if not order: + order = lambda l: l + self.order = order + self.message = None + self.trace = trace + self.next_candidate = self.find_next_candidate + self.pending_children = set() + + def find_next_candidate(self): + """ + Returns the next candidate Node for (potential) evaluation. + + The candidate list (really a stack) initially consists of all of + the top-level (command line) targets provided when the Taskmaster + was initialized. While we walk the DAG, visiting Nodes, all the + children that haven't finished processing get pushed on to the + candidate list. Each child can then be popped and examined in + turn for whether *their* children are all up-to-date, in which + case a Task will be created for their actual evaluation and + potential building. + + Here is where we also allow candidate Nodes to alter the list of + Nodes that should be examined. This is used, for example, when + invoking SCons in a source directory. A source directory Node can + return its corresponding build directory Node, essentially saying, + "Hey, you really need to build this thing over here instead." + """ + try: + return self.candidates.pop() + except IndexError: + pass + try: + node = self.top_targets_left.pop() + except IndexError: + return None + self.current_top = node + alt, message = node.alter_targets() + if alt: + self.message = message + self.candidates.append(node) + self.candidates.extend(self.order(alt)) + node = self.candidates.pop() + return node + + def no_next_candidate(self): + """ + Stops Taskmaster processing by not returning a next candidate. + + Note that we have to clean-up the Taskmaster candidate list + because the cycle detection depends on the fact all nodes have + been processed somehow. + """ + while self.candidates: + candidates = self.candidates + self.candidates = [] + self.will_not_build(candidates) + return None + + def _validate_pending_children(self): + """ + Validate the content of the pending_children set. Assert if an + internal error is found. + + This function is used strictly for debugging the taskmaster by + checking that no invariants are violated. It is not used in + normal operation. + + The pending_children set is used to detect cycles in the + dependency graph. We call a "pending child" a child that is + found in the "pending" state when checking the dependencies of + its parent node. + + A pending child can occur when the Taskmaster completes a loop + through a cycle. For example, lets imagine a graph made of + three node (A, B and C) making a cycle. The evaluation starts + at node A. The taskmaster first consider whether node A's + child B is up-to-date. Then, recursively, node B needs to + check whether node C is up-to-date. This leaves us with a + dependency graph looking like: + + Next candidate \ + \ + Node A (Pending) --> Node B(Pending) --> Node C (NoState) + ^ | + | | + +-------------------------------------+ + + Now, when the Taskmaster examines the Node C's child Node A, + it finds that Node A is in the "pending" state. Therefore, + Node A is a pending child of node C. + + Pending children indicate that the Taskmaster has potentially + loop back through a cycle. We say potentially because it could + also occur when a DAG is evaluated in parallel. For example, + consider the following graph: + + + Node A (Pending) --> Node B(Pending) --> Node C (Pending) --> ... + | ^ + | | + +----------> Node D (NoState) --------+ + / + Next candidate / + + The Taskmaster first evaluates the nodes A, B, and C and + starts building some children of node C. Assuming, that the + maximum parallel level has not been reached, the Taskmaster + will examine Node D. It will find that Node C is a pending + child of Node D. + + In summary, evaluating a graph with a cycle will always + involve a pending child at one point. A pending child might + indicate either a cycle or a diamond-shaped DAG. Only a + fraction of the nodes ends-up being a "pending child" of + another node. This keeps the pending_children set small in + practice. + + We can differentiate between the two cases if we wait until + the end of the build. At this point, all the pending children + nodes due to a diamond-shaped DAG will have been properly + built (or will have failed to build). But, the pending + children involved in a cycle will still be in the pending + state. + + The taskmaster removes nodes from the pending_children set as + soon as a pending_children node moves out of the pending + state. This also helps to keep the pending_children set small. + """ + + for n in self.pending_children: + assert n.state in (NODE_PENDING, NODE_EXECUTING), \ + (str(n), StateString[n.state]) + assert len(n.waiting_parents) != 0, (str(n), len(n.waiting_parents)) + for p in n.waiting_parents: + assert p.ref_count > 0, (str(n), str(p), p.ref_count) + + + def trace_message(self, message): + return 'Taskmaster: %s\n' % message + + def trace_node(self, node): + return '<%-10s %-3s %s>' % (StateString[node.get_state()], + node.ref_count, + repr(str(node))) + + def _find_next_ready_node(self): + """ + Finds the next node that is ready to be built. + + This is *the* main guts of the DAG walk. We loop through the + list of candidates, looking for something that has no un-built + children (i.e., that is a leaf Node or has dependencies that are + all leaf Nodes or up-to-date). Candidate Nodes are re-scanned + (both the target Node itself and its sources, which are always + scanned in the context of a given target) to discover implicit + dependencies. A Node that must wait for some children to be + built will be put back on the candidates list after the children + have finished building. A Node that has been put back on the + candidates list in this way may have itself (or its sources) + re-scanned, in order to handle generated header files (e.g.) and + the implicit dependencies therein. + + Note that this method does not do any signature calculation or + up-to-date check itself. All of that is handled by the Task + class. This is purely concerned with the dependency graph walk. + """ + + self.ready_exc = None + + T = self.trace + if T: T.write(u'\n' + self.trace_message('Looking for a node to evaluate')) + + while True: + node = self.next_candidate() + if node is None: + if T: T.write(self.trace_message('No candidate anymore.') + u'\n') + return None + + node = node.disambiguate() + state = node.get_state() + + # For debugging only: + # + # try: + # self._validate_pending_children() + # except: + # self.ready_exc = sys.exc_info() + # return node + + if CollectStats: + if not hasattr(node, 'stats'): + node.stats = Stats() + StatsNodes.append(node) + S = node.stats + S.considered = S.considered + 1 + else: + S = None + + if T: T.write(self.trace_message(u' Considering node %s and its children:' % self.trace_node(node))) + + if state == NODE_NO_STATE: + # Mark this node as being on the execution stack: + node.set_state(NODE_PENDING) + elif state > NODE_PENDING: + # Skip this node if it has already been evaluated: + if S: S.already_handled = S.already_handled + 1 + if T: T.write(self.trace_message(u' already handled (executed)')) + continue + + executor = node.get_executor() + + try: + children = executor.get_all_children() + except SystemExit: + exc_value = sys.exc_info()[1] + e = SCons.Errors.ExplicitExit(node, exc_value.code) + self.ready_exc = (SCons.Errors.ExplicitExit, e) + if T: T.write(self.trace_message(' SystemExit')) + return node + except Exception, e: + # We had a problem just trying to figure out the + # children (like a child couldn't be linked in to a + # VariantDir, or a Scanner threw something). Arrange to + # raise the exception when the Task is "executed." + self.ready_exc = sys.exc_info() + if S: S.problem = S.problem + 1 + if T: T.write(self.trace_message(' exception %s while scanning children.\n' % e)) + return node + + children_not_visited = [] + children_pending = set() + children_not_ready = [] + children_failed = False + + for child in chain(executor.get_all_prerequisites(), children): + childstate = child.get_state() + + if T: T.write(self.trace_message(u' ' + self.trace_node(child))) + + if childstate == NODE_NO_STATE: + children_not_visited.append(child) + elif childstate == NODE_PENDING: + children_pending.add(child) + elif childstate == NODE_FAILED: + children_failed = True + + if childstate <= NODE_EXECUTING: + children_not_ready.append(child) + + + # These nodes have not even been visited yet. Add + # them to the list so that on some next pass we can + # take a stab at evaluating them (or their children). + children_not_visited.reverse() + self.candidates.extend(self.order(children_not_visited)) + #if T and children_not_visited: + # T.write(self.trace_message(' adding to candidates: %s' % map(str, children_not_visited))) + # T.write(self.trace_message(' candidates now: %s\n' % map(str, self.candidates))) + + # Skip this node if any of its children have failed. + # + # This catches the case where we're descending a top-level + # target and one of our children failed while trying to be + # built by a *previous* descent of an earlier top-level + # target. + # + # It can also occur if a node is reused in multiple + # targets. One first descends though the one of the + # target, the next time occurs through the other target. + # + # Note that we can only have failed_children if the + # --keep-going flag was used, because without it the build + # will stop before diving in the other branch. + # + # Note that even if one of the children fails, we still + # added the other children to the list of candidate nodes + # to keep on building (--keep-going). + if children_failed: + for n in executor.get_action_targets(): + n.set_state(NODE_FAILED) + + if S: S.child_failed = S.child_failed + 1 + if T: T.write(self.trace_message('****** %s\n' % self.trace_node(node))) + continue + + if children_not_ready: + for child in children_not_ready: + # We're waiting on one or more derived targets + # that have not yet finished building. + if S: S.not_built = S.not_built + 1 + + # Add this node to the waiting parents lists of + # anything we're waiting on, with a reference + # count so we can be put back on the list for + # re-evaluation when they've all finished. + node.ref_count = node.ref_count + child.add_to_waiting_parents(node) + if T: T.write(self.trace_message(u' adjusted ref count: %s, child %s' % + (self.trace_node(node), repr(str(child))))) + + if T: + for pc in children_pending: + T.write(self.trace_message(' adding %s to the pending children set\n' % + self.trace_node(pc))) + self.pending_children = self.pending_children | children_pending + + continue + + # Skip this node if it has side-effects that are + # currently being built: + wait_side_effects = False + for se in executor.get_action_side_effects(): + if se.get_state() == NODE_EXECUTING: + se.add_to_waiting_s_e(node) + wait_side_effects = True + + if wait_side_effects: + if S: S.side_effects = S.side_effects + 1 + continue + + # The default when we've gotten through all of the checks above: + # this node is ready to be built. + if S: S.build = S.build + 1 + if T: T.write(self.trace_message(u'Evaluating %s\n' % + self.trace_node(node))) + + # For debugging only: + # + # try: + # self._validate_pending_children() + # except: + # self.ready_exc = sys.exc_info() + # return node + + return node + + return None + + def next_task(self): + """ + Returns the next task to be executed. + + This simply asks for the next Node to be evaluated, and then wraps + it in the specific Task subclass with which we were initialized. + """ + node = self._find_next_ready_node() + + if node is None: + return None + + tlist = node.get_executor().get_all_targets() + + task = self.tasker(self, tlist, node in self.original_top, node) + try: + task.make_ready() + except: + # We had a problem just trying to get this task ready (like + # a child couldn't be linked in to a VariantDir when deciding + # whether this node is current). Arrange to raise the + # exception when the Task is "executed." + self.ready_exc = sys.exc_info() + + if self.ready_exc: + task.exception_set(self.ready_exc) + + self.ready_exc = None + + return task + + def will_not_build(self, nodes, node_func=lambda n: None): + """ + Perform clean-up about nodes that will never be built. Invokes + a user defined function on all of these nodes (including all + of their parents). + """ + + T = self.trace + + pending_children = self.pending_children + + to_visit = set(nodes) + pending_children = pending_children - to_visit + + if T: + for n in nodes: + T.write(self.trace_message(' removing node %s from the pending children set\n' % + self.trace_node(n))) + try: + while len(to_visit): + node = to_visit.pop() + node_func(node) + + # Prune recursion by flushing the waiting children + # list immediately. + parents = node.waiting_parents + node.waiting_parents = set() + + to_visit = to_visit | parents + pending_children = pending_children - parents + + for p in parents: + p.ref_count = p.ref_count - 1 + if T: T.write(self.trace_message(' removing parent %s from the pending children set\n' % + self.trace_node(p))) + except KeyError: + # The container to_visit has been emptied. + pass + + # We have the stick back the pending_children list into the + # taskmaster because the python 1.5.2 compatibility does not + # allow us to use in-place updates + self.pending_children = pending_children + + def stop(self): + """ + Stops the current build completely. + """ + self.next_candidate = self.no_next_candidate + + def cleanup(self): + """ + Check for dependency cycles. + """ + if not self.pending_children: + return + + nclist = [(n, find_cycle([n], set())) for n in self.pending_children] + + genuine_cycles = [ + node for node,cycle in nclist + if cycle or node.get_state() != NODE_EXECUTED + ] + if not genuine_cycles: + # All of the "cycles" found were single nodes in EXECUTED state, + # which is to say, they really weren't cycles. Just return. + return + + desc = 'Found dependency cycle(s):\n' + for node, cycle in nclist: + if cycle: + desc = desc + " " + " -> ".join(map(str, cycle)) + "\n" + else: + desc = desc + \ + " Internal Error: no cycle found for node %s (%s) in state %s\n" % \ + (node, repr(node), StateString[node.get_state()]) + + raise SCons.Errors.UserError(desc) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/386asm.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/386asm.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/386asm.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/386asm.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,61 @@ +"""SCons.Tool.386asm + +Tool specification for the 386ASM assembler for the Phar Lap ETS embedded +operating system. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/386asm.py 2013/03/03 09:48:35 garyo" + +from SCons.Tool.PharLapCommon import addPharLapPaths +import SCons.Util + +as_module = __import__('as', globals(), locals(), []) + +def generate(env): + """Add Builders and construction variables for ar to an Environment.""" + as_module.generate(env) + + env['AS'] = '386asm' + env['ASFLAGS'] = SCons.Util.CLVar('') + env['ASPPFLAGS'] = '$ASFLAGS' + env['ASCOM'] = '$AS $ASFLAGS $SOURCES -o $TARGET' + env['ASPPCOM'] = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $SOURCES -o $TARGET' + + addPharLapPaths(env) + +def exists(env): + return env.Detect('386asm') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/BitKeeper.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/BitKeeper.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/BitKeeper.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/BitKeeper.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,67 @@ +"""SCons.Tool.BitKeeper.py + +Tool-specific initialization for the BitKeeper source code control +system. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/BitKeeper.py 2013/03/03 09:48:35 garyo" + +import SCons.Action +import SCons.Builder +import SCons.Util + +def generate(env): + """Add a Builder factory function and construction variables for + BitKeeper to an Environment.""" + + def BitKeeperFactory(env=env): + """ """ + import SCons.Warnings as W + W.warn(W.DeprecatedSourceCodeWarning, """The BitKeeper() factory is deprecated and there is no replacement.""") + act = SCons.Action.Action("$BITKEEPERCOM", "$BITKEEPERCOMSTR") + return SCons.Builder.Builder(action = act, env = env) + + #setattr(env, 'BitKeeper', BitKeeperFactory) + env.BitKeeper = BitKeeperFactory + + env['BITKEEPER'] = 'bk' + env['BITKEEPERGET'] = '$BITKEEPER get' + env['BITKEEPERGETFLAGS'] = SCons.Util.CLVar('') + env['BITKEEPERCOM'] = '$BITKEEPERGET $BITKEEPERGETFLAGS $TARGET' + +def exists(env): + return env.Detect('bk') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/CVS.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/CVS.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/CVS.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/CVS.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,73 @@ +"""SCons.Tool.CVS.py + +Tool-specific initialization for CVS. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/CVS.py 2013/03/03 09:48:35 garyo" + +import SCons.Action +import SCons.Builder +import SCons.Util + +def generate(env): + """Add a Builder factory function and construction variables for + CVS to an Environment.""" + + def CVSFactory(repos, module='', env=env): + """ """ + import SCons.Warnings as W + W.warn(W.DeprecatedSourceCodeWarning, """The CVS() factory is deprecated and there is no replacement.""") + # fail if repos is not an absolute path name? + if module != '': + # Don't use os.path.join() because the name we fetch might + # be across a network and must use POSIX slashes as separators. + module = module + '/' + env['CVSCOM'] = '$CVS $CVSFLAGS co $CVSCOFLAGS -d ${TARGET.dir} $CVSMODULE${TARGET.posix}' + act = SCons.Action.Action('$CVSCOM', '$CVSCOMSTR') + return SCons.Builder.Builder(action = act, + env = env, + CVSREPOSITORY = repos, + CVSMODULE = module) + + #setattr(env, 'CVS', CVSFactory) + env.CVS = CVSFactory + + env['CVS'] = 'cvs' + env['CVSFLAGS'] = SCons.Util.CLVar('-d $CVSREPOSITORY') + env['CVSCOFLAGS'] = SCons.Util.CLVar('') + env['CVSCOM'] = '$CVS $CVSFLAGS co $CVSCOFLAGS ${TARGET.posix}' + +def exists(env): + return env.Detect('cvs') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/FortranCommon.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/FortranCommon.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/FortranCommon.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/FortranCommon.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,263 @@ +"""SCons.Tool.FortranCommon + +Stuff for processing Fortran, common to all fortran dialects. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/FortranCommon.py 2013/03/03 09:48:35 garyo" + +import re +import os.path + +import SCons.Action +import SCons.Defaults +import SCons.Scanner.Fortran +import SCons.Tool +import SCons.Util + +def isfortran(env, source): + """Return 1 if any of code in source has fortran files in it, 0 + otherwise.""" + try: + fsuffixes = env['FORTRANSUFFIXES'] + except KeyError: + # If no FORTRANSUFFIXES, no fortran tool, so there is no need to look + # for fortran sources. + return 0 + + if not source: + # Source might be None for unusual cases like SConf. + return 0 + for s in source: + if s.sources: + ext = os.path.splitext(str(s.sources[0]))[1] + if ext in fsuffixes: + return 1 + return 0 + +def _fortranEmitter(target, source, env): + node = source[0].rfile() + if not node.exists() and not node.is_derived(): + print "Could not locate " + str(node.name) + return ([], []) + mod_regex = """(?i)^\s*MODULE\s+(?!PROCEDURE)(\w+)""" + cre = re.compile(mod_regex,re.M) + # Retrieve all USE'd module names + modules = cre.findall(node.get_text_contents()) + # Remove unique items from the list + modules = SCons.Util.unique(modules) + # Convert module name to a .mod filename + suffix = env.subst('$FORTRANMODSUFFIX', target=target, source=source) + moddir = env.subst('$FORTRANMODDIR', target=target, source=source) + modules = [x.lower() + suffix for x in modules] + for m in modules: + target.append(env.fs.File(m, moddir)) + return (target, source) + +def FortranEmitter(target, source, env): + target, source = _fortranEmitter(target, source, env) + return SCons.Defaults.StaticObjectEmitter(target, source, env) + +def ShFortranEmitter(target, source, env): + target, source = _fortranEmitter(target, source, env) + return SCons.Defaults.SharedObjectEmitter(target, source, env) + +def ComputeFortranSuffixes(suffixes, ppsuffixes): + """suffixes are fortran source files, and ppsuffixes the ones to be + pre-processed. Both should be sequences, not strings.""" + assert len(suffixes) > 0 + s = suffixes[0] + sup = s.upper() + upper_suffixes = [_.upper() for _ in suffixes] + if SCons.Util.case_sensitive_suffixes(s, sup): + ppsuffixes.extend(upper_suffixes) + else: + suffixes.extend(upper_suffixes) + +def CreateDialectActions(dialect): + """Create dialect specific actions.""" + CompAction = SCons.Action.Action('$%sCOM ' % dialect, '$%sCOMSTR' % dialect) + CompPPAction = SCons.Action.Action('$%sPPCOM ' % dialect, '$%sPPCOMSTR' % dialect) + ShCompAction = SCons.Action.Action('$SH%sCOM ' % dialect, '$SH%sCOMSTR' % dialect) + ShCompPPAction = SCons.Action.Action('$SH%sPPCOM ' % dialect, '$SH%sPPCOMSTR' % dialect) + + return CompAction, CompPPAction, ShCompAction, ShCompPPAction + +def DialectAddToEnv(env, dialect, suffixes, ppsuffixes, support_module = 0): + """Add dialect specific construction variables.""" + ComputeFortranSuffixes(suffixes, ppsuffixes) + + fscan = SCons.Scanner.Fortran.FortranScan("%sPATH" % dialect) + + for suffix in suffixes + ppsuffixes: + SCons.Tool.SourceFileScanner.add_scanner(suffix, fscan) + + env.AppendUnique(FORTRANSUFFIXES = suffixes + ppsuffixes) + + compaction, compppaction, shcompaction, shcompppaction = \ + CreateDialectActions(dialect) + + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in suffixes: + static_obj.add_action(suffix, compaction) + shared_obj.add_action(suffix, shcompaction) + static_obj.add_emitter(suffix, FortranEmitter) + shared_obj.add_emitter(suffix, ShFortranEmitter) + + for suffix in ppsuffixes: + static_obj.add_action(suffix, compppaction) + shared_obj.add_action(suffix, shcompppaction) + static_obj.add_emitter(suffix, FortranEmitter) + shared_obj.add_emitter(suffix, ShFortranEmitter) + + if '%sFLAGS' % dialect not in env: + env['%sFLAGS' % dialect] = SCons.Util.CLVar('') + + if 'SH%sFLAGS' % dialect not in env: + env['SH%sFLAGS' % dialect] = SCons.Util.CLVar('$%sFLAGS' % dialect) + + # If a tool does not define fortran prefix/suffix for include path, use C ones + if 'INC%sPREFIX' % dialect not in env: + env['INC%sPREFIX' % dialect] = '$INCPREFIX' + + if 'INC%sSUFFIX' % dialect not in env: + env['INC%sSUFFIX' % dialect] = '$INCSUFFIX' + + env['_%sINCFLAGS' % dialect] = '$( ${_concat(INC%sPREFIX, %sPATH, INC%sSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' % (dialect, dialect, dialect) + + if support_module == 1: + env['%sCOM' % dialect] = '$%s -o $TARGET -c $%sFLAGS $_%sINCFLAGS $_FORTRANMODFLAG $SOURCES' % (dialect, dialect, dialect) + env['%sPPCOM' % dialect] = '$%s -o $TARGET -c $%sFLAGS $CPPFLAGS $_CPPDEFFLAGS $_%sINCFLAGS $_FORTRANMODFLAG $SOURCES' % (dialect, dialect, dialect) + env['SH%sCOM' % dialect] = '$SH%s -o $TARGET -c $SH%sFLAGS $_%sINCFLAGS $_FORTRANMODFLAG $SOURCES' % (dialect, dialect, dialect) + env['SH%sPPCOM' % dialect] = '$SH%s -o $TARGET -c $SH%sFLAGS $CPPFLAGS $_CPPDEFFLAGS $_%sINCFLAGS $_FORTRANMODFLAG $SOURCES' % (dialect, dialect, dialect) + else: + env['%sCOM' % dialect] = '$%s -o $TARGET -c $%sFLAGS $_%sINCFLAGS $SOURCES' % (dialect, dialect, dialect) + env['%sPPCOM' % dialect] = '$%s -o $TARGET -c $%sFLAGS $CPPFLAGS $_CPPDEFFLAGS $_%sINCFLAGS $SOURCES' % (dialect, dialect, dialect) + env['SH%sCOM' % dialect] = '$SH%s -o $TARGET -c $SH%sFLAGS $_%sINCFLAGS $SOURCES' % (dialect, dialect, dialect) + env['SH%sPPCOM' % dialect] = '$SH%s -o $TARGET -c $SH%sFLAGS $CPPFLAGS $_CPPDEFFLAGS $_%sINCFLAGS $SOURCES' % (dialect, dialect, dialect) + +def add_fortran_to_env(env): + """Add Builders and construction variables for Fortran to an Environment.""" + try: + FortranSuffixes = env['FORTRANFILESUFFIXES'] + except KeyError: + FortranSuffixes = ['.f', '.for', '.ftn'] + + #print "Adding %s to fortran suffixes" % FortranSuffixes + try: + FortranPPSuffixes = env['FORTRANPPFILESUFFIXES'] + except KeyError: + FortranPPSuffixes = ['.fpp', '.FPP'] + + DialectAddToEnv(env, "FORTRAN", FortranSuffixes, + FortranPPSuffixes, support_module = 1) + + env['FORTRANMODPREFIX'] = '' # like $LIBPREFIX + env['FORTRANMODSUFFIX'] = '.mod' # like $LIBSUFFIX + + env['FORTRANMODDIR'] = '' # where the compiler should place .mod files + env['FORTRANMODDIRPREFIX'] = '' # some prefix to $FORTRANMODDIR - similar to $INCPREFIX + env['FORTRANMODDIRSUFFIX'] = '' # some suffix to $FORTRANMODDIR - similar to $INCSUFFIX + env['_FORTRANMODFLAG'] = '$( ${_concat(FORTRANMODDIRPREFIX, FORTRANMODDIR, FORTRANMODDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + +def add_f77_to_env(env): + """Add Builders and construction variables for f77 to an Environment.""" + try: + F77Suffixes = env['F77FILESUFFIXES'] + except KeyError: + F77Suffixes = ['.f77'] + + #print "Adding %s to f77 suffixes" % F77Suffixes + try: + F77PPSuffixes = env['F77PPFILESUFFIXES'] + except KeyError: + F77PPSuffixes = [] + + DialectAddToEnv(env, "F77", F77Suffixes, F77PPSuffixes) + +def add_f90_to_env(env): + """Add Builders and construction variables for f90 to an Environment.""" + try: + F90Suffixes = env['F90FILESUFFIXES'] + except KeyError: + F90Suffixes = ['.f90'] + + #print "Adding %s to f90 suffixes" % F90Suffixes + try: + F90PPSuffixes = env['F90PPFILESUFFIXES'] + except KeyError: + F90PPSuffixes = [] + + DialectAddToEnv(env, "F90", F90Suffixes, F90PPSuffixes, + support_module = 1) + +def add_f95_to_env(env): + """Add Builders and construction variables for f95 to an Environment.""" + try: + F95Suffixes = env['F95FILESUFFIXES'] + except KeyError: + F95Suffixes = ['.f95'] + + #print "Adding %s to f95 suffixes" % F95Suffixes + try: + F95PPSuffixes = env['F95PPFILESUFFIXES'] + except KeyError: + F95PPSuffixes = [] + + DialectAddToEnv(env, "F95", F95Suffixes, F95PPSuffixes, + support_module = 1) + +def add_f03_to_env(env): + """Add Builders and construction variables for f03 to an Environment.""" + try: + F03Suffixes = env['F03FILESUFFIXES'] + except KeyError: + F03Suffixes = ['.f03'] + + #print "Adding %s to f95 suffixes" % F95Suffixes + try: + F03PPSuffixes = env['F03PPFILESUFFIXES'] + except KeyError: + F03PPSuffixes = [] + + DialectAddToEnv(env, "F03", F03Suffixes, F03PPSuffixes, + support_module = 1) + +def add_all_to_env(env): + """Add builders and construction variables for all supported fortran + dialects.""" + add_fortran_to_env(env) + add_f77_to_env(env) + add_f90_to_env(env) + add_f95_to_env(env) + add_f03_to_env(env) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/GettextCommon.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/GettextCommon.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/GettextCommon.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/GettextCommon.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,430 @@ +"""SCons.Tool.GettextCommon module + +Used by several tools of `gettext` toolset. +""" + +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/GettextCommon.py 2013/03/03 09:48:35 garyo" + +import SCons.Warnings +import re + +############################################################################# +class XgettextToolWarning(SCons.Warnings.Warning): pass +class XgettextNotFound(XgettextToolWarning): pass +class MsginitToolWarning(SCons.Warnings.Warning): pass +class MsginitNotFound(MsginitToolWarning): pass +class MsgmergeToolWarning(SCons.Warnings.Warning): pass +class MsgmergeNotFound(MsgmergeToolWarning): pass +class MsgfmtToolWarning(SCons.Warnings.Warning): pass +class MsgfmtNotFound(MsgfmtToolWarning): pass +############################################################################# +SCons.Warnings.enableWarningClass(XgettextToolWarning) +SCons.Warnings.enableWarningClass(XgettextNotFound) +SCons.Warnings.enableWarningClass(MsginitToolWarning) +SCons.Warnings.enableWarningClass(MsginitNotFound) +SCons.Warnings.enableWarningClass(MsgmergeToolWarning) +SCons.Warnings.enableWarningClass(MsgmergeNotFound) +SCons.Warnings.enableWarningClass(MsgfmtToolWarning) +SCons.Warnings.enableWarningClass(MsgfmtNotFound) +############################################################################# + +############################################################################# +class _POTargetFactory(object): + """ A factory of `PO` target files. + + Factory defaults differ from these of `SCons.Node.FS.FS`. We set `precious` + (this is required by builders and actions gettext) and `noclean` flags by + default for all produced nodes. + """ + def __init__( self, env, nodefault = True, alias = None, precious = True + , noclean = True ): + """ Object constructor. + + **Arguments** + + - *env* (`SCons.Environment.Environment`) + - *nodefault* (`boolean`) - if `True`, produced nodes will be ignored + from default target `'.'` + - *alias* (`string`) - if provided, produced nodes will be automatically + added to this alias, and alias will be set as `AlwaysBuild` + - *precious* (`boolean`) - if `True`, the produced nodes will be set as + `Precious`. + - *noclen* (`boolean`) - if `True`, the produced nodes will be excluded + from `Clean`. + """ + self.env = env + self.alias = alias + self.precious = precious + self.noclean = noclean + self.nodefault = nodefault + + def _create_node(self, name, factory, directory = None, create = 1): + """ Create node, and set it up to factory settings. """ + import SCons.Util + node = factory(name, directory, create) + node.set_noclean(self.noclean) + node.set_precious(self.precious) + if self.nodefault: + self.env.Ignore('.', node) + if self.alias: + self.env.AlwaysBuild(self.env.Alias(self.alias, node)) + return node + + def Entry(self, name, directory = None, create = 1): + """ Create `SCons.Node.FS.Entry` """ + return self._create_node(name, self.env.fs.Entry, directory, create) + + def File(self, name, directory = None, create = 1): + """ Create `SCons.Node.FS.File` """ + return self._create_node(name, self.env.fs.File, directory, create) +############################################################################# + +############################################################################# +_re_comment = re.compile(r'(#[^\n\r]+)$', re.M) +_re_lang = re.compile(r'([a-zA-Z0-9_]+)', re.M) +############################################################################# +def _read_linguas_from_files(env, linguas_files = None): + """ Parse `LINGUAS` file and return list of extracted languages """ + import SCons.Util + import SCons.Environment + global _re_comment + global _re_lang + if not SCons.Util.is_List(linguas_files) \ + and not SCons.Util.is_String(linguas_files) \ + and not isinstance(linguas_files, SCons.Node.FS.Base) \ + and linguas_files: + # If, linguas_files==True or such, then read 'LINGUAS' file. + linguas_files = [ 'LINGUAS' ] + if linguas_files is None: + return [] + fnodes = env.arg2nodes(linguas_files) + linguas = [] + for fnode in fnodes: + contents = _re_comment.sub("", fnode.get_text_contents()) + ls = [ l for l in _re_lang.findall(contents) if l ] + linguas.extend(ls) + return linguas +############################################################################# + +############################################################################# +from SCons.Builder import BuilderBase +############################################################################# +class _POFileBuilder(BuilderBase): + """ `PO` file builder. + + This is multi-target single-source builder. In typical situation the source + is single `POT` file, e.g. `messages.pot`, and there are multiple `PO` + targets to be updated from this `POT`. We must run + `SCons.Builder.BuilderBase._execute()` separatelly for each target to track + dependencies separatelly for each target file. + + **NOTE**: if we call `SCons.Builder.BuilderBase._execute(.., target, ...)` + with target being list of all targets, all targets would be rebuilt each time + one of the targets from this list is missing. This would happen, for example, + when new language `ll` enters `LINGUAS_FILE` (at this moment there is no + `ll.po` file yet). To avoid this, we override + `SCons.Builder.BuilerBase._execute()` and call it separatelly for each + target. Here we also append to the target list the languages read from + `LINGUAS_FILE`. + """ + # + #* The argument for overriding _execute(): We must use environment with + # builder overrides applied (see BuilderBase.__init__(). Here it comes for + # free. + #* The argument against using 'emitter': The emitter is called too late + # by BuilderBase._execute(). If user calls, for example: + # + # env.POUpdate(LINGUAS_FILE = 'LINGUAS') + # + # the builder throws error, because it is called with target=None, + # source=None and is trying to "generate" sources or target list first. + # If user calls + # + # env.POUpdate(['foo', 'baz'], LINGUAS_FILE = 'LINGUAS') + # + # the env.BuilderWrapper() calls our builder with target=None, + # source=['foo', 'baz']. The BuilderBase._execute() then splits execution + # and execute iterativelly (recursion) self._execute(None, source[i]). + # After that it calls emitter (which is quite too late). The emitter is + # also called in each iteration, what makes things yet worse. + def __init__(self, env, **kw): + if not 'suffix' in kw: + kw['suffix'] = '$POSUFFIX' + if not 'src_suffix' in kw: + kw['src_suffix'] = '$POTSUFFIX' + if not 'src_builder' in kw: + kw['src_builder'] = '_POTUpdateBuilder' + if not 'single_source' in kw: + kw['single_source'] = True + alias = None + if 'target_alias' in kw: + alias = kw['target_alias'] + del kw['target_alias'] + if not 'target_factory' in kw: + kw['target_factory'] = _POTargetFactory(env, alias=alias).File + BuilderBase.__init__(self, **kw) + + def _execute(self, env, target, source, *args, **kw): + """ Execute builder's actions. + + Here we append to `target` the languages read from `$LINGUAS_FILE` and + apply `SCons.Builder.BuilderBase._execute()` separatelly to each target. + The arguments and return value are same as for + `SCons.Builder.BuilderBase._execute()`. + """ + import SCons.Util + import SCons.Node + linguas_files = None + if env.has_key('LINGUAS_FILE') and env['LINGUAS_FILE']: + linguas_files = env['LINGUAS_FILE'] + # This prevents endless recursion loop (we'll be invoked once for + # each target appended here, we must not extend the list again). + env['LINGUAS_FILE'] = None + linguas = _read_linguas_from_files(env,linguas_files) + if SCons.Util.is_List(target): + target.extend(linguas) + elif target is not None: + target = [target] + linguas + else: + target = linguas + if not target: + # Let the SCons.BuilderBase to handle this patologic situation + return BuilderBase._execute( self, env, target, source, *args, **kw) + # The rest is ours + if not SCons.Util.is_List(target): + target = [ target ] + result = [] + for tgt in target: + r = BuilderBase._execute( self, env, [tgt], source, *args, **kw) + result.extend(r) + if linguas_files is not None: + env['LINGUAS_FILE'] = linguas_files + return SCons.Node.NodeList(result) +############################################################################# + +import SCons.Environment +############################################################################# +def _translate(env, target=None, source=SCons.Environment._null, *args, **kw): + """ Function for `Translate()` pseudo-builder """ + if target is None: target = [] + pot = env.POTUpdate(None, source, *args, **kw) + po = env.POUpdate(target, pot, *args, **kw) + return po +############################################################################# + +############################################################################# +class RPaths(object): + """ Callable object, which returns pathnames relative to SCons current + working directory. + + It seems like `SCons.Node.FS.Base.get_path()` returns absolute paths + for nodes that are outside of current working directory (`env.fs.getcwd()`). + Here, we often have `SConscript`, `POT` and `PO` files within `po/` + directory and source files (e.g. `*.c`) outside of it. When generating `POT` + template file, references to source files are written to `POT` template, so + a translator may later quickly jump to appropriate source file and line from + its `PO` editor (e.g. `poedit`). Relative paths in `PO` file are usually + interpreted by `PO` editor as paths relative to the place, where `PO` file + lives. The absolute paths would make resultant `POT` file nonportable, as + the references would be correct only on the machine, where `POT` file was + recently re-created. For such reason, we need a function, which always + returns relative paths. This is the purpose of `RPaths` callable object. + + The `__call__` method returns paths relative to current woking directory, but + we assume, that *xgettext(1)* is run from the directory, where target file is + going to be created. + + Note, that this may not work for files distributed over several hosts or + across different drives on windows. We assume here, that single local + filesystem holds both source files and target `POT` templates. + + Intended use of `RPaths` - in `xgettext.py`:: + + def generate(env): + from GettextCommon import RPaths + ... + sources = '$( ${_concat( "", SOURCES, "", __env__, XgettextRPaths, TARGET, SOURCES)} $)' + env.Append( + ... + XGETTEXTCOM = 'XGETTEXT ... ' + sources, + ... + XgettextRPaths = RPaths(env) + ) + """ + # NOTE: This callable object returns pathnames of dirs/files relative to + # current working directory. The pathname remains relative also for entries + # that are outside of current working directory (node, that + # SCons.Node.FS.File and siblings return absolute path in such case). For + # simplicity we compute path relative to current working directory, this + # seems be enough for our purposes (don't need TARGET variable and + # SCons.Defaults.Variable_Caller stuff). + + def __init__(self, env): + """ Initialize `RPaths` callable object. + + **Arguments**: + + - *env* - a `SCons.Environment.Environment` object, defines *current + working dir*. + """ + self.env = env + + # FIXME: I'm not sure, how it should be implemented (what the *args are in + # general, what is **kw). + def __call__(self, nodes, *args, **kw): + """ Return nodes' paths (strings) relative to current working directory. + + **Arguments**: + + - *nodes* ([`SCons.Node.FS.Base`]) - list of nodes. + - *args* - currently unused. + - *kw* - currently unused. + + **Returns**: + + - Tuple of strings, which represent paths relative to current working + directory (for given environment). + """ + # os.path.relpath is available only on python >= 2.6. We use our own + # implementation. It's taken from BareNecessities package: + # http://jimmyg.org/work/code/barenecessities/index.html + from posixpath import curdir + def relpath(path, start=curdir): + import posixpath + """Return a relative version of a path""" + if not path: + raise ValueError("no path specified") + start_list = posixpath.abspath(start).split(posixpath.sep) + path_list = posixpath.abspath(path).split(posixpath.sep) + # Work out how much of the filepath is shared by start and path. + i = len(posixpath.commonprefix([start_list, path_list])) + rel_list = [posixpath.pardir] * (len(start_list)-i) + path_list[i:] + if not rel_list: + return posixpath.curdir + return posixpath.join(*rel_list) + import os + import SCons.Node.FS + rpaths = () + cwd = self.env.fs.getcwd().get_abspath() + for node in nodes: + rpath = None + if isinstance(node, SCons.Node.FS.Base): + rpath = relpath(node.get_abspath(), cwd) + # FIXME: Other types possible here? + if rpath is not None: + rpaths += (rpath,) + return rpaths +############################################################################# + +############################################################################# +def _init_po_files(target, source, env): + """ Action function for `POInit` builder. """ + nop = lambda target, source, env : 0 + if env.has_key('POAUTOINIT'): + autoinit = env['POAUTOINIT'] + else: + autoinit = False + # Well, if everything outside works well, this loop should do single + # iteration. Otherwise we are rebuilding all the targets even, if just + # one has changed (but is this out fault?). + for tgt in target: + if not tgt.exists(): + if autoinit: + action = SCons.Action.Action('$MSGINITCOM', '$MSGINITCOMSTR') + else: + msg = 'File ' + repr(str(tgt)) + ' does not exist. ' \ + + 'If you are a translator, you can create it through: \n' \ + + '$MSGINITCOM' + action = SCons.Action.Action(nop, msg) + status = action([tgt], source, env) + if status: return status + return 0 +############################################################################# + +############################################################################# +def _detect_xgettext(env): + """ Detects *xgettext(1)* binary """ + if env.has_key('XGETTEXT'): + return env['XGETTEXT'] + xgettext = env.Detect('xgettext'); + if xgettext: + return xgettext + raise SCons.Errors.StopError(XgettextNotFound,"Could not detect xgettext") + return None +############################################################################# +def _xgettext_exists(env): + return _detect_xgettext(env) +############################################################################# + +############################################################################# +def _detect_msginit(env): + """ Detects *msginit(1)* program. """ + if env.has_key('MSGINIT'): + return env['MSGINIT'] + msginit = env.Detect('msginit'); + if msginit: + return msginit + raise SCons.Errors.StopError(MsginitNotFound, "Could not detect msginit") + return None +############################################################################# +def _msginit_exists(env): + return _detect_msginit(env) +############################################################################# + +############################################################################# +def _detect_msgmerge(env): + """ Detects *msgmerge(1)* program. """ + if env.has_key('MSGMERGE'): + return env['MSGMERGE'] + msgmerge = env.Detect('msgmerge'); + if msgmerge: + return msgmerge + raise SCons.Errors.StopError(MsgmergeNotFound, "Could not detect msgmerge") + return None +############################################################################# +def _msgmerge_exists(env): + return _detect_msgmerge(env) +############################################################################# + +############################################################################# +def _detect_msgfmt(env): + """ Detects *msgmfmt(1)* program. """ + if env.has_key('MSGFMT'): + return env['MSGFMT'] + msgfmt = env.Detect('msgfmt'); + if msgfmt: + return msgfmt + raise SCons.Errors.StopError(MsgfmtNotFound, "Could not detect msgfmt") + return None +############################################################################# +def _msgfmt_exists(env): + return _detect_msgfmt(env) +############################################################################# + +############################################################################# +def tool_list(platform, env): + """ List tools that shall be generated by top-level `gettext` tool """ + return [ 'xgettext', 'msginit', 'msgmerge', 'msgfmt' ] +############################################################################# + diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/JavaCommon.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/JavaCommon.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/JavaCommon.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/JavaCommon.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,323 @@ +"""SCons.Tool.JavaCommon + +Stuff for processing Java. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/JavaCommon.py 2013/03/03 09:48:35 garyo" + +import os +import os.path +import re + +java_parsing = 1 + +default_java_version = '1.4' + +if java_parsing: + # Parse Java files for class names. + # + # This is a really cool parser from Charles Crain + # that finds appropriate class names in Java source. + + # A regular expression that will find, in a java file: + # newlines; + # double-backslashes; + # a single-line comment "//"; + # single or double quotes preceeded by a backslash; + # single quotes, double quotes, open or close braces, semi-colons, + # periods, open or close parentheses; + # floating-point numbers; + # any alphanumeric token (keyword, class name, specifier); + # any alphanumeric token surrounded by angle brackets (generics); + # the multi-line comment begin and end tokens /* and */; + # array declarations "[]". + _reToken = re.compile(r'(\n|\\\\|//|\\[\'"]|[\'"\{\}\;\.\(\)]|' + + r'\d*\.\d*|[A-Za-z_][\w\$\.]*|<[A-Za-z_]\w+>|' + + r'/\*|\*/|\[\])') + + class OuterState(object): + """The initial state for parsing a Java file for classes, + interfaces, and anonymous inner classes.""" + def __init__(self, version=default_java_version): + + if not version in ('1.1', '1.2', '1.3','1.4', '1.5', '1.6', '1.7', + '5', '6'): + msg = "Java version %s not supported" % version + raise NotImplementedError(msg) + + self.version = version + self.listClasses = [] + self.listOutputs = [] + self.stackBrackets = [] + self.brackets = 0 + self.nextAnon = 1 + self.localClasses = [] + self.stackAnonClassBrackets = [] + self.anonStacksStack = [[0]] + self.package = None + + def trace(self): + pass + + def __getClassState(self): + try: + return self.classState + except AttributeError: + ret = ClassState(self) + self.classState = ret + return ret + + def __getPackageState(self): + try: + return self.packageState + except AttributeError: + ret = PackageState(self) + self.packageState = ret + return ret + + def __getAnonClassState(self): + try: + return self.anonState + except AttributeError: + self.outer_state = self + ret = SkipState(1, AnonClassState(self)) + self.anonState = ret + return ret + + def __getSkipState(self): + try: + return self.skipState + except AttributeError: + ret = SkipState(1, self) + self.skipState = ret + return ret + + def __getAnonStack(self): + return self.anonStacksStack[-1] + + def openBracket(self): + self.brackets = self.brackets + 1 + + def closeBracket(self): + self.brackets = self.brackets - 1 + if len(self.stackBrackets) and \ + self.brackets == self.stackBrackets[-1]: + self.listOutputs.append('$'.join(self.listClasses)) + self.localClasses.pop() + self.listClasses.pop() + self.anonStacksStack.pop() + self.stackBrackets.pop() + if len(self.stackAnonClassBrackets) and \ + self.brackets == self.stackAnonClassBrackets[-1]: + self.__getAnonStack().pop() + self.stackAnonClassBrackets.pop() + + def parseToken(self, token): + if token[:2] == '//': + return IgnoreState('\n', self) + elif token == '/*': + return IgnoreState('*/', self) + elif token == '{': + self.openBracket() + elif token == '}': + self.closeBracket() + elif token in [ '"', "'" ]: + return IgnoreState(token, self) + elif token == "new": + # anonymous inner class + if len(self.listClasses) > 0: + return self.__getAnonClassState() + return self.__getSkipState() # Skip the class name + elif token in ['class', 'interface', 'enum']: + if len(self.listClasses) == 0: + self.nextAnon = 1 + self.stackBrackets.append(self.brackets) + return self.__getClassState() + elif token == 'package': + return self.__getPackageState() + elif token == '.': + # Skip the attribute, it might be named "class", in which + # case we don't want to treat the following token as + # an inner class name... + return self.__getSkipState() + return self + + def addAnonClass(self): + """Add an anonymous inner class""" + if self.version in ('1.1', '1.2', '1.3', '1.4'): + clazz = self.listClasses[0] + self.listOutputs.append('%s$%d' % (clazz, self.nextAnon)) + elif self.version in ('1.5', '1.6', '1.7', '5', '6'): + self.stackAnonClassBrackets.append(self.brackets) + className = [] + className.extend(self.listClasses) + self.__getAnonStack()[-1] = self.__getAnonStack()[-1] + 1 + for anon in self.__getAnonStack(): + className.append(str(anon)) + self.listOutputs.append('$'.join(className)) + + self.nextAnon = self.nextAnon + 1 + self.__getAnonStack().append(0) + + def setPackage(self, package): + self.package = package + + class AnonClassState(object): + """A state that looks for anonymous inner classes.""" + def __init__(self, old_state): + # outer_state is always an instance of OuterState + self.outer_state = old_state.outer_state + self.old_state = old_state + self.brace_level = 0 + def parseToken(self, token): + # This is an anonymous class if and only if the next + # non-whitespace token is a bracket. Everything between + # braces should be parsed as normal java code. + if token[:2] == '//': + return IgnoreState('\n', self) + elif token == '/*': + return IgnoreState('*/', self) + elif token == '\n': + return self + elif token[0] == '<' and token[-1] == '>': + return self + elif token == '(': + self.brace_level = self.brace_level + 1 + return self + if self.brace_level > 0: + if token == 'new': + # look further for anonymous inner class + return SkipState(1, AnonClassState(self)) + elif token in [ '"', "'" ]: + return IgnoreState(token, self) + elif token == ')': + self.brace_level = self.brace_level - 1 + return self + if token == '{': + self.outer_state.addAnonClass() + return self.old_state.parseToken(token) + + class SkipState(object): + """A state that will skip a specified number of tokens before + reverting to the previous state.""" + def __init__(self, tokens_to_skip, old_state): + self.tokens_to_skip = tokens_to_skip + self.old_state = old_state + def parseToken(self, token): + self.tokens_to_skip = self.tokens_to_skip - 1 + if self.tokens_to_skip < 1: + return self.old_state + return self + + class ClassState(object): + """A state we go into when we hit a class or interface keyword.""" + def __init__(self, outer_state): + # outer_state is always an instance of OuterState + self.outer_state = outer_state + def parseToken(self, token): + # the next non-whitespace token should be the name of the class + if token == '\n': + return self + # If that's an inner class which is declared in a method, it + # requires an index prepended to the class-name, e.g. + # 'Foo$1Inner' (Tigris Issue 2087) + if self.outer_state.localClasses and \ + self.outer_state.stackBrackets[-1] > \ + self.outer_state.stackBrackets[-2]+1: + locals = self.outer_state.localClasses[-1] + try: + idx = locals[token] + locals[token] = locals[token]+1 + except KeyError: + locals[token] = 1 + token = str(locals[token]) + token + self.outer_state.localClasses.append({}) + self.outer_state.listClasses.append(token) + self.outer_state.anonStacksStack.append([0]) + return self.outer_state + + class IgnoreState(object): + """A state that will ignore all tokens until it gets to a + specified token.""" + def __init__(self, ignore_until, old_state): + self.ignore_until = ignore_until + self.old_state = old_state + def parseToken(self, token): + if self.ignore_until == token: + return self.old_state + return self + + class PackageState(object): + """The state we enter when we encounter the package keyword. + We assume the next token will be the package name.""" + def __init__(self, outer_state): + # outer_state is always an instance of OuterState + self.outer_state = outer_state + def parseToken(self, token): + self.outer_state.setPackage(token) + return self.outer_state + + def parse_java_file(fn, version=default_java_version): + return parse_java(open(fn, 'r').read(), version) + + def parse_java(contents, version=default_java_version, trace=None): + """Parse a .java file and return a double of package directory, + plus a list of .class files that compiling that .java file will + produce""" + package = None + initial = OuterState(version) + currstate = initial + for token in _reToken.findall(contents): + # The regex produces a bunch of groups, but only one will + # have anything in it. + currstate = currstate.parseToken(token) + if trace: trace(token, currstate) + if initial.package: + package = initial.package.replace('.', os.sep) + return (package, initial.listOutputs) + +else: + # Don't actually parse Java files for class names. + # + # We might make this a configurable option in the future if + # Java-file parsing takes too long (although it shouldn't relative + # to how long the Java compiler itself seems to take...). + + def parse_java_file(fn): + """ "Parse" a .java file. + + This actually just splits the file name, so the assumption here + is that the file name matches the public class name, and that + the path to the file is the same as the package name. + """ + return os.path.split(file) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/__init__.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/__init__.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/__init__.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,56 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/MSCommon/__init__.py 2013/03/03 09:48:35 garyo" + +__doc__ = """ +Common functions for Microsoft Visual Studio and Visual C/C++. +""" + +import copy +import os +import re +import subprocess + +import SCons.Errors +import SCons.Platform.win32 +import SCons.Util + +from SCons.Tool.MSCommon.sdk import mssdk_exists, \ + mssdk_setup_env + +from SCons.Tool.MSCommon.vc import msvc_exists, \ + msvc_setup_env, \ + msvc_setup_env_once + +from SCons.Tool.MSCommon.vs import get_default_version, \ + get_vs_by_version, \ + merge_default_version, \ + msvs_exists, \ + query_versions + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/arch.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/arch.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/arch.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/arch.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,61 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/MSCommon/arch.py 2013/03/03 09:48:35 garyo" + +__doc__ = """Module to define supported Windows chip architectures. +""" + +import os + +class ArchDefinition(object): + """ + A class for defining architecture-specific settings and logic. + """ + def __init__(self, arch, synonyms=[]): + self.arch = arch + self.synonyms = synonyms + +SupportedArchitectureList = [ + ArchitectureDefinition( + 'x86', + ['i386', 'i486', 'i586', 'i686'], + ), + + ArchitectureDefinition( + 'x86_64', + ['AMD64', 'amd64', 'em64t', 'EM64T', 'x86_64'], + ), + + ArchitectureDefinition( + 'ia64', + ['IA64'], + ), +] + +SupportedArchitectureMap = {} +for a in SupportedArchitectureList: + SupportedArchitectureMap[a.arch] = a + for s in a.synonyms: + SupportedArchitectureMap[s] = a + diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/common.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/common.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/common.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/common.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,242 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/MSCommon/common.py 2013/03/03 09:48:35 garyo" + +__doc__ = """ +Common helper functions for working with the Microsoft tool chain. +""" + +import copy +import os +import subprocess +import re + +import SCons.Util + + +logfile = os.environ.get('SCONS_MSCOMMON_DEBUG') +if logfile == '-': + def debug(x): + print x +elif logfile: + try: + import logging + except ImportError: + debug = lambda x: open(logfile, 'a').write(x + '\n') + else: + logging.basicConfig(filename=logfile, level=logging.DEBUG) + debug = logging.debug +else: + debug = lambda x: None + + +_is_win64 = None + +def is_win64(): + """Return true if running on windows 64 bits. + + Works whether python itself runs in 64 bits or 32 bits.""" + # Unfortunately, python does not provide a useful way to determine + # if the underlying Windows OS is 32-bit or 64-bit. Worse, whether + # the Python itself is 32-bit or 64-bit affects what it returns, + # so nothing in sys.* or os.* help. + + # Apparently the best solution is to use env vars that Windows + # sets. If PROCESSOR_ARCHITECTURE is not x86, then the python + # process is running in 64 bit mode (on a 64-bit OS, 64-bit + # hardware, obviously). + # If this python is 32-bit but the OS is 64, Windows will set + # ProgramW6432 and PROCESSOR_ARCHITEW6432 to non-null. + # (Checking for HKLM\Software\Wow6432Node in the registry doesn't + # work, because some 32-bit installers create it.) + global _is_win64 + if _is_win64 is None: + # I structured these tests to make it easy to add new ones or + # add exceptions in the future, because this is a bit fragile. + _is_win64 = False + if os.environ.get('PROCESSOR_ARCHITECTURE','x86') != 'x86': + _is_win64 = True + if os.environ.get('PROCESSOR_ARCHITEW6432'): + _is_win64 = True + if os.environ.get('ProgramW6432'): + _is_win64 = True + return _is_win64 + + +def read_reg(value): + return SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, value)[0] + +def has_reg(value): + """Return True if the given key exists in HKEY_LOCAL_MACHINE, False + otherwise.""" + try: + SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, value) + ret = True + except WindowsError: + ret = False + return ret + +# Functions for fetching environment variable settings from batch files. + +def normalize_env(env, keys, force=False): + """Given a dictionary representing a shell environment, add the variables + from os.environ needed for the processing of .bat files; the keys are + controlled by the keys argument. + + It also makes sure the environment values are correctly encoded. + + If force=True, then all of the key values that exist are copied + into the returned dictionary. If force=false, values are only + copied if the key does not already exist in the copied dictionary. + + Note: the environment is copied.""" + normenv = {} + if env: + for k in env.keys(): + normenv[k] = copy.deepcopy(env[k]).encode('mbcs') + + for k in keys: + if k in os.environ and (force or not k in normenv): + normenv[k] = os.environ[k].encode('mbcs') + + return normenv + +def get_output(vcbat, args = None, env = None): + """Parse the output of given bat file, with given args.""" + + if env is None: + # Create a blank environment, for use in launching the tools + env = SCons.Environment.Environment(tools=[]) + + # TODO: This is a hard-coded list of the variables that (may) need + # to be imported from os.environ[] for v[sc]*vars*.bat file + # execution to work. This list should really be either directly + # controlled by vc.py, or else derived from the common_tools_var + # settings in vs.py. + vars = [ + 'COMSPEC', + 'VS110COMNTOOLS', + 'VS100COMNTOOLS', + 'VS90COMNTOOLS', + 'VS80COMNTOOLS', + 'VS71COMNTOOLS', + 'VS70COMNTOOLS', + 'VS60COMNTOOLS', + ] + env['ENV'] = normalize_env(env['ENV'], vars, force=False) + + if args: + debug("Calling '%s %s'" % (vcbat, args)) + popen = SCons.Action._subproc(env, + '"%s" %s & set' % (vcbat, args), + stdin = 'devnull', + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + else: + debug("Calling '%s'" % vcbat) + popen = SCons.Action._subproc(env, + '"%s" & set' % vcbat, + stdin = 'devnull', + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + + # Use the .stdout and .stderr attributes directly because the + # .communicate() method uses the threading module on Windows + # and won't work under Pythons not built with threading. + stdout = popen.stdout.read() + stderr = popen.stderr.read() + if stderr: + # TODO: find something better to do with stderr; + # this at least prevents errors from getting swallowed. + import sys + sys.stderr.write(stderr) + if popen.wait() != 0: + raise IOError(stderr.decode("mbcs")) + + output = stdout.decode("mbcs") + return output + +def parse_output(output, keep = ("INCLUDE", "LIB", "LIBPATH", "PATH")): + # dkeep is a dict associating key: path_list, where key is one item from + # keep, and pat_list the associated list of paths + + dkeep = dict([(i, []) for i in keep]) + + # rdk will keep the regex to match the .bat file output line starts + rdk = {} + for i in keep: + rdk[i] = re.compile('%s=(.*)' % i, re.I) + + def add_env(rmatch, key, dkeep=dkeep): + plist = rmatch.group(1).split(os.pathsep) + for p in plist: + # Do not add empty paths (when a var ends with ;) + if p: + p = p.encode('mbcs') + # XXX: For some reason, VC98 .bat file adds "" around the PATH + # values, and it screws up the environment later, so we strip + # it. + p = p.strip('"') + dkeep[key].append(p) + + for line in output.splitlines(): + for k,v in rdk.items(): + m = v.match(line) + if m: + add_env(m, k) + + return dkeep + +# TODO(sgk): unused +def output_to_dict(output): + """Given an output string, parse it to find env variables. + + Return a dict where keys are variables names, and values their content""" + envlinem = re.compile(r'^([a-zA-z0-9]+)=([\S\s]*)$') + parsedenv = {} + for line in output.splitlines(): + m = envlinem.match(line) + if m: + parsedenv[m.group(1)] = m.group(2) + return parsedenv + +# TODO(sgk): unused +def get_new(l1, l2): + """Given two list l1 and l2, return the items in l2 which are not in l1. + Order is maintained.""" + + # We don't try to be smart: lists are small, and this is not the bottleneck + # is any case + new = [] + for i in l2: + if i not in l1: + new.append(i) + + return new + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/netframework.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/netframework.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/netframework.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/netframework.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,82 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/MSCommon/netframework.py 2013/03/03 09:48:35 garyo" + +__doc__ = """ +""" + +import os +import re + +from common import read_reg, debug + +# Original value recorded by dcournapeau +_FRAMEWORKDIR_HKEY_ROOT = r'Software\Microsoft\.NETFramework\InstallRoot' +# On SGK's system +_FRAMEWORKDIR_HKEY_ROOT = r'Software\Microsoft\Microsoft SDKs\.NETFramework\v2.0\InstallationFolder' + +def find_framework_root(): + # XXX: find it from environment (FrameworkDir) + try: + froot = read_reg(_FRAMEWORKDIR_HKEY_ROOT) + debug("Found framework install root in registry: %s" % froot) + except WindowsError, e: + debug("Could not read reg key %s" % _FRAMEWORKDIR_HKEY_ROOT) + return None + + if not os.path.exists(froot): + debug("%s not found on fs" % froot) + return None + + return froot + +def query_versions(): + froot = find_framework_root() + if froot: + contents = os.listdir(froot) + + l = re.compile('v[0-9]+.*') + versions = [e for e in contents if l.match(e)] + + def versrt(a,b): + # since version numbers aren't really floats... + aa = a[1:] + bb = b[1:] + aal = aa.split('.') + bbl = bb.split('.') + # sequence comparison in python is lexicographical + # which is exactly what we want. + # Note we sort backwards so the highest version is first. + return cmp(bbl,aal) + + versions.sort(versrt) + else: + versions = [] + + return versions + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/sdk.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/sdk.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/sdk.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/sdk.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,391 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/MSCommon/sdk.py 2013/03/03 09:48:35 garyo" + +__doc__ = """Module to detect the Platform/Windows SDK + +PSDK 2003 R1 is the earliest version detected. +""" + +import os + +import SCons.Errors +import SCons.Util + +import common + +debug = common.debug + +# SDK Checks. This is of course a mess as everything else on MS platforms. Here +# is what we do to detect the SDK: +# +# For Windows SDK >= 6.0: just look into the registry entries: +# HKLM\Software\Microsoft\Microsoft SDKs\Windows +# All the keys in there are the available versions. +# +# For Platform SDK before 6.0 (2003 server R1 and R2, etc...), there does not +# seem to be any sane registry key, so the precise location is hardcoded. +# +# For versions below 2003R1, it seems the PSDK is included with Visual Studio? +# +# Also, per the following: +# http://benjamin.smedbergs.us/blog/tag/atl/ +# VC++ Professional comes with the SDK, VC++ Express does not. + +# Location of the SDK (checked for 6.1 only) +_CURINSTALLED_SDK_HKEY_ROOT = \ + r"Software\Microsoft\Microsoft SDKs\Windows\CurrentInstallFolder" + + +class SDKDefinition(object): + """ + An abstract base class for trying to find installed SDK directories. + """ + def __init__(self, version, **kw): + self.version = version + self.__dict__.update(kw) + + def find_sdk_dir(self): + """Try to find the MS SDK from the registry. + + Return None if failed or the directory does not exist. + """ + if not SCons.Util.can_read_reg: + debug('find_sdk_dir(): can not read registry') + return None + + hkey = self.HKEY_FMT % self.hkey_data + debug('find_sdk_dir(): checking registry:%s'%hkey) + + try: + sdk_dir = common.read_reg(hkey) + except WindowsError, e: + debug('find_sdk_dir(): no SDK registry key %s' % repr(hkey)) + return None + + debug('find_sdk_dir(): Trying SDK Dir: %s'%sdk_dir) + + if not os.path.exists(sdk_dir): + debug('find_sdk_dir(): %s not on file system' % sdk_dir) + return None + + ftc = os.path.join(sdk_dir, self.sanity_check_file) + if not os.path.exists(ftc): + debug("find_sdk_dir(): sanity check %s not found" % ftc) + return None + + return sdk_dir + + def get_sdk_dir(self): + """Return the MSSSDK given the version string.""" + try: + return self._sdk_dir + except AttributeError: + sdk_dir = self.find_sdk_dir() + self._sdk_dir = sdk_dir + return sdk_dir + + def get_sdk_vc_script(self,host_arch, target_arch): + """ Return the script to initialize the VC compiler installed by SDK + """ + + if (host_arch == 'amd64' and target_arch == 'x86'): + # No cross tools needed compiling 32 bits on 64 bit machine + host_arch=target_arch + + arch_string=target_arch + if (host_arch != target_arch): + arch_string='%s_%s'%(host_arch,target_arch) + + debug("sdk.py: get_sdk_vc_script():arch_string:%s host_arch:%s target_arch:%s"%(arch_string, + host_arch, + target_arch)) + file=self.vc_setup_scripts.get(arch_string,None) + debug("sdk.py: get_sdk_vc_script():file:%s"%file) + return file + +class WindowsSDK(SDKDefinition): + """ + A subclass for trying to find installed Windows SDK directories. + """ + HKEY_FMT = r'Software\Microsoft\Microsoft SDKs\Windows\v%s\InstallationFolder' + def __init__(self, *args, **kw): + SDKDefinition.__init__(self, *args, **kw) + self.hkey_data = self.version + +class PlatformSDK(SDKDefinition): + """ + A subclass for trying to find installed Platform SDK directories. + """ + HKEY_FMT = r'Software\Microsoft\MicrosoftSDK\InstalledSDKS\%s\Install Dir' + def __init__(self, *args, **kw): + SDKDefinition.__init__(self, *args, **kw) + self.hkey_data = self.uuid + +# +# The list of VC initialization scripts installed by the SDK +# These should be tried if the vcvarsall.bat TARGET_ARCH fails +preSDK61VCSetupScripts = { 'x86' : r'bin\vcvars32.bat', + 'amd64' : r'bin\vcvarsamd64.bat', + 'x86_amd64': r'bin\vcvarsx86_amd64.bat', + 'x86_ia64' : r'bin\vcvarsx86_ia64.bat', + 'ia64' : r'bin\vcvarsia64.bat'} + +SDK61VCSetupScripts = {'x86' : r'bin\vcvars32.bat', + 'amd64' : r'bin\amd64\vcvarsamd64.bat', + 'x86_amd64': r'bin\x86_amd64\vcvarsx86_amd64.bat', + 'x86_ia64' : r'bin\x86_ia64\vcvarsx86_ia64.bat', + 'ia64' : r'bin\ia64\vcvarsia64.bat'} + +SDK70VCSetupScripts = { 'x86' : r'bin\vcvars32.bat', + 'amd64' : r'bin\vcvars64.bat', + 'x86_amd64': r'bin\vcvarsx86_amd64.bat', + 'x86_ia64' : r'bin\vcvarsx86_ia64.bat', + 'ia64' : r'bin\vcvarsia64.bat'} + +# The list of support SDKs which we know how to detect. +# +# The first SDK found in the list is the one used by default if there +# are multiple SDKs installed. Barring good reasons to the contrary, +# this means we should list SDKs with from most recent to oldest. +# +# If you update this list, update the documentation in Tool/mssdk.xml. +SupportedSDKList = [ + WindowsSDK('7.0', + sanity_check_file=r'bin\SetEnv.Cmd', + include_subdir='include', + lib_subdir={ + 'x86' : ['lib'], + 'x86_64' : [r'lib\x64'], + 'ia64' : [r'lib\ia64'], + }, + vc_setup_scripts = SDK70VCSetupScripts, + ), + WindowsSDK('6.1', + sanity_check_file=r'bin\SetEnv.Cmd', + include_subdir='include', + lib_subdir={ + 'x86' : ['lib'], + 'x86_64' : [r'lib\x64'], + 'ia64' : [r'lib\ia64'], + }, + vc_setup_scripts = SDK61VCSetupScripts, + ), + + WindowsSDK('6.0A', + sanity_check_file=r'include\windows.h', + include_subdir='include', + lib_subdir={ + 'x86' : ['lib'], + 'x86_64' : [r'lib\x64'], + 'ia64' : [r'lib\ia64'], + }, + vc_setup_scripts = preSDK61VCSetupScripts, + ), + + WindowsSDK('6.0', + sanity_check_file=r'bin\gacutil.exe', + include_subdir='include', + lib_subdir='lib', + vc_setup_scripts = preSDK61VCSetupScripts, + ), + + PlatformSDK('2003R2', + sanity_check_file=r'SetEnv.Cmd', + uuid="D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1", + vc_setup_scripts = preSDK61VCSetupScripts, + ), + + PlatformSDK('2003R1', + sanity_check_file=r'SetEnv.Cmd', + uuid="8F9E5EF3-A9A5-491B-A889-C58EFFECE8B3", + vc_setup_scripts = preSDK61VCSetupScripts, + ), +] + +SupportedSDKMap = {} +for sdk in SupportedSDKList: + SupportedSDKMap[sdk.version] = sdk + + +# Finding installed SDKs isn't cheap, because it goes not only to the +# registry but also to the disk to sanity-check that there is, in fact, +# an SDK installed there and that the registry entry isn't just stale. +# Find this information once, when requested, and cache it. + +InstalledSDKList = None +InstalledSDKMap = None + +def get_installed_sdks(): + global InstalledSDKList + global InstalledSDKMap + debug('sdk.py:get_installed_sdks()') + if InstalledSDKList is None: + InstalledSDKList = [] + InstalledSDKMap = {} + for sdk in SupportedSDKList: + debug('MSCommon/sdk.py: trying to find SDK %s' % sdk.version) + if sdk.get_sdk_dir(): + debug('MSCommon/sdk.py:found SDK %s' % sdk.version) + InstalledSDKList.append(sdk) + InstalledSDKMap[sdk.version] = sdk + return InstalledSDKList + + +# We may be asked to update multiple construction environments with +# SDK information. When doing this, we check on-disk for whether +# the SDK has 'mfc' and 'atl' subdirectories. Since going to disk +# is expensive, cache results by directory. + +SDKEnvironmentUpdates = {} + +def set_sdk_by_directory(env, sdk_dir): + global SDKEnvironmentUpdates + debug('set_sdk_by_directory: Using dir:%s'%sdk_dir) + try: + env_tuple_list = SDKEnvironmentUpdates[sdk_dir] + except KeyError: + env_tuple_list = [] + SDKEnvironmentUpdates[sdk_dir] = env_tuple_list + + include_path = os.path.join(sdk_dir, 'include') + mfc_path = os.path.join(include_path, 'mfc') + atl_path = os.path.join(include_path, 'atl') + + if os.path.exists(mfc_path): + env_tuple_list.append(('INCLUDE', mfc_path)) + if os.path.exists(atl_path): + env_tuple_list.append(('INCLUDE', atl_path)) + env_tuple_list.append(('INCLUDE', include_path)) + + env_tuple_list.append(('LIB', os.path.join(sdk_dir, 'lib'))) + env_tuple_list.append(('LIBPATH', os.path.join(sdk_dir, 'lib'))) + env_tuple_list.append(('PATH', os.path.join(sdk_dir, 'bin'))) + + for variable, directory in env_tuple_list: + env.PrependENVPath(variable, directory) + + +# TODO(sgk): currently unused; remove? +def get_cur_sdk_dir_from_reg(): + """Try to find the platform sdk directory from the registry. + + Return None if failed or the directory does not exist""" + if not SCons.Util.can_read_reg: + debug('SCons cannot read registry') + return None + + try: + val = common.read_reg(_CURINSTALLED_SDK_HKEY_ROOT) + debug("Found current sdk dir in registry: %s" % val) + except WindowsError, e: + debug("Did not find current sdk in registry") + return None + + if not os.path.exists(val): + debug("Current sdk dir %s not on fs" % val) + return None + + return val + +def get_sdk_by_version(mssdk): + if mssdk not in SupportedSDKMap: + msg = "SDK version %s is not supported" % repr(mssdk) + raise SCons.Errors.UserError(msg) + get_installed_sdks() + return InstalledSDKMap.get(mssdk) + +def get_default_sdk(): + """Set up the default Platform/Windows SDK.""" + get_installed_sdks() + if not InstalledSDKList: + return None + return InstalledSDKList[0] + + + + +def mssdk_setup_env(env): + debug('sdk.py:mssdk_setup_env()') + if 'MSSDK_DIR' in env: + sdk_dir = env['MSSDK_DIR'] + if sdk_dir is None: + return + sdk_dir = env.subst(sdk_dir) + debug('sdk.py:mssdk_setup_env: Using MSSDK_DIR:%s'%sdk_dir) + elif 'MSSDK_VERSION' in env: + sdk_version = env['MSSDK_VERSION'] + if sdk_version is None: + msg = "SDK version %s is not installed" % repr(mssdk) + raise SCons.Errors.UserError(msg) + sdk_version = env.subst(sdk_version) + mssdk = get_sdk_by_version(sdk_version) + sdk_dir = mssdk.get_sdk_dir() + debug('sdk.py:mssdk_setup_env: Using MSSDK_VERSION:%s'%sdk_dir) + elif 'MSVS_VERSION' in env: + msvs_version = env['MSVS_VERSION'] + debug('sdk.py:mssdk_setup_env:Getting MSVS_VERSION from env:%s'%msvs_version) + if msvs_version is None: + debug('sdk.py:mssdk_setup_env thinks msvs_version is None') + return + msvs_version = env.subst(msvs_version) + import vs + msvs = vs.get_vs_by_version(msvs_version) + debug('sdk.py:mssdk_setup_env:msvs is :%s'%msvs) + if not msvs: + debug('sdk.py:mssdk_setup_env: no VS version detected, bailingout:%s'%msvs) + return + sdk_version = msvs.sdk_version + debug('sdk.py:msvs.sdk_version is %s'%sdk_version) + if not sdk_version: + return + mssdk = get_sdk_by_version(sdk_version) + if not mssdk: + mssdk = get_default_sdk() + if not mssdk: + return + sdk_dir = mssdk.get_sdk_dir() + debug('sdk.py:mssdk_setup_env: Using MSVS_VERSION:%s'%sdk_dir) + else: + mssdk = get_default_sdk() + if not mssdk: + return + sdk_dir = mssdk.get_sdk_dir() + debug('sdk.py:mssdk_setup_env: not using any env values. sdk_dir:%s'%sdk_dir) + + set_sdk_by_directory(env, sdk_dir) + + #print "No MSVS_VERSION: this is likely to be a bug" + +def mssdk_exists(version=None): + sdks = get_installed_sdks() + if version is None: + return len(sdks) > 0 + return version in sdks + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/vc.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/vc.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/vc.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/vc.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,464 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +# TODO: +# * supported arch for versions: for old versions of batch file without +# argument, giving bogus argument cannot be detected, so we have to hardcode +# this here +# * print warning when msvc version specified but not found +# * find out why warning do not print +# * test on 64 bits XP + VS 2005 (and VS 6 if possible) +# * SDK +# * Assembly +__revision__ = "src/engine/SCons/Tool/MSCommon/vc.py 2013/03/03 09:48:35 garyo" + +__doc__ = """Module for Visual C/C++ detection and configuration. +""" +import SCons.compat + +import os +import platform +from string import digits as string_digits + +import SCons.Warnings + +import common + +debug = common.debug + +import sdk + +get_installed_sdks = sdk.get_installed_sdks + + +class VisualCException(Exception): + pass + +class UnsupportedVersion(VisualCException): + pass + +class UnsupportedArch(VisualCException): + pass + +class MissingConfiguration(VisualCException): + pass + +class NoVersionFound(VisualCException): + pass + +class BatchFileExecutionError(VisualCException): + pass + +# Dict to 'canonalize' the arch +_ARCH_TO_CANONICAL = { + "amd64" : "amd64", + "emt64" : "amd64", + "i386" : "x86", + "i486" : "x86", + "i586" : "x86", + "i686" : "x86", + "ia64" : "ia64", + "itanium" : "ia64", + "x86" : "x86", + "x86_64" : "amd64", +} + +# Given a (host, target) tuple, return the argument for the bat file. Both host +# and targets should be canonalized. +_HOST_TARGET_ARCH_TO_BAT_ARCH = { + ("x86", "x86"): "x86", + ("x86", "amd64"): "x86_amd64", + ("amd64", "amd64"): "amd64", + ("amd64", "x86"): "x86", + ("x86", "ia64"): "x86_ia64" +} + +def get_host_target(env): + debug('vc.py:get_host_target()') + + host_platform = env.get('HOST_ARCH') + if not host_platform: + host_platform = platform.machine() + # TODO(2.5): the native Python platform.machine() function returns + # '' on all Python versions before 2.6, after which it also uses + # PROCESSOR_ARCHITECTURE. + if not host_platform: + host_platform = os.environ.get('PROCESSOR_ARCHITECTURE', '') + + # Retain user requested TARGET_ARCH + req_target_platform = env.get('TARGET_ARCH') + debug('vc.py:get_host_target() req_target_platform:%s'%req_target_platform) + + if req_target_platform: + # If user requested a specific platform then only try that one. + target_platform = req_target_platform + else: + target_platform = host_platform + + try: + host = _ARCH_TO_CANONICAL[host_platform.lower()] + except KeyError, e: + msg = "Unrecognized host architecture %s" + raise ValueError(msg % repr(host_platform)) + + try: + target = _ARCH_TO_CANONICAL[target_platform.lower()] + except KeyError, e: + all_archs = str(_ARCH_TO_CANONICAL.keys()) + raise ValueError("Unrecognized target architecture %s\n\tValid architectures: %s" % (target_platform, all_archs)) + + return (host, target,req_target_platform) + +_VCVER = ["11.0", "11.0Exp", "10.0", "10.0Exp", "9.0", "9.0Exp","8.0", "8.0Exp","7.1", "7.0", "6.0"] + +_VCVER_TO_PRODUCT_DIR = { + '11.0': [ + r'Microsoft\VisualStudio\11.0\Setup\VC\ProductDir'], + '11.0Exp' : [ + r'Microsoft\VCExpress\11.0\Setup\VC\ProductDir'], + '10.0': [ + r'Microsoft\VisualStudio\10.0\Setup\VC\ProductDir'], + '10.0Exp' : [ + r'Microsoft\VCExpress\10.0\Setup\VC\ProductDir'], + '9.0': [ + r'Microsoft\VisualStudio\9.0\Setup\VC\ProductDir'], + '9.0Exp' : [ + r'Microsoft\VCExpress\9.0\Setup\VC\ProductDir'], + '8.0': [ + r'Microsoft\VisualStudio\8.0\Setup\VC\ProductDir'], + '8.0Exp': [ + r'Microsoft\VCExpress\8.0\Setup\VC\ProductDir'], + '7.1': [ + r'Microsoft\VisualStudio\7.1\Setup\VC\ProductDir'], + '7.0': [ + r'Microsoft\VisualStudio\7.0\Setup\VC\ProductDir'], + '6.0': [ + r'Microsoft\VisualStudio\6.0\Setup\Microsoft Visual C++\ProductDir'] +} + +def msvc_version_to_maj_min(msvc_version): + msvc_version_numeric = ''.join([x for x in msvc_version if x in string_digits + '.']) + + t = msvc_version_numeric.split(".") + if not len(t) == 2: + raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric)) + try: + maj = int(t[0]) + min = int(t[1]) + return maj, min + except ValueError, e: + raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric)) + +def is_host_target_supported(host_target, msvc_version): + """Return True if the given (host, target) tuple is supported given the + msvc version. + + Parameters + ---------- + host_target: tuple + tuple of (canonalized) host-target, e.g. ("x86", "amd64") for cross + compilation from 32 bits windows to 64 bits. + msvc_version: str + msvc version (major.minor, e.g. 10.0) + + Note + ---- + This only check whether a given version *may* support the given (host, + target), not that the toolchain is actually present on the machine. + """ + # We assume that any Visual Studio version supports x86 as a target + if host_target[1] != "x86": + maj, min = msvc_version_to_maj_min(msvc_version) + if maj < 8: + return False + + return True + +def find_vc_pdir(msvc_version): + """Try to find the product directory for the given + version. + + Note + ---- + If for some reason the requested version could not be found, an + exception which inherits from VisualCException will be raised.""" + root = 'Software\\' + if common.is_win64(): + root = root + 'Wow6432Node\\' + try: + hkeys = _VCVER_TO_PRODUCT_DIR[msvc_version] + except KeyError: + debug("Unknown version of MSVC: %s" % msvc_version) + raise UnsupportedVersion("Unknown version %s" % msvc_version) + + for key in hkeys: + key = root + key + try: + comps = common.read_reg(key) + except WindowsError, e: + debug('find_vc_dir(): no VC registry key %s' % repr(key)) + else: + debug('find_vc_dir(): found VC in registry: %s' % comps) + if os.path.exists(comps): + return comps + else: + debug('find_vc_dir(): reg says dir is %s, but it does not exist. (ignoring)'\ + % comps) + raise MissingConfiguration("registry dir %s not found on the filesystem" % comps) + return None + +def find_batch_file(env,msvc_version,host_arch,target_arch): + """ + Find the location of the batch script which should set up the compiler + for any TARGET_ARCH whose compilers were installed by Visual Studio/VCExpress + """ + pdir = find_vc_pdir(msvc_version) + if pdir is None: + raise NoVersionFound("No version of Visual Studio found") + + debug('vc.py: find_batch_file() pdir:%s'%pdir) + + # filter out e.g. "Exp" from the version name + msvc_ver_numeric = ''.join([x for x in msvc_version if x in string_digits + "."]) + vernum = float(msvc_ver_numeric) + if 7 <= vernum < 8: + pdir = os.path.join(pdir, os.pardir, "Common7", "Tools") + batfilename = os.path.join(pdir, "vsvars32.bat") + elif vernum < 7: + pdir = os.path.join(pdir, "Bin") + batfilename = os.path.join(pdir, "vcvars32.bat") + else: # >= 8 + batfilename = os.path.join(pdir, "vcvarsall.bat") + + if not os.path.exists(batfilename): + debug("Not found: %s" % batfilename) + batfilename = None + + installed_sdks=get_installed_sdks() + for _sdk in installed_sdks: + sdk_bat_file=_sdk.get_sdk_vc_script(host_arch,target_arch) + sdk_bat_file_path=os.path.join(pdir,sdk_bat_file) + debug('vc.py:find_batch_file() sdk_bat_file_path:%s'%sdk_bat_file_path) + if os.path.exists(sdk_bat_file_path): + return (batfilename,sdk_bat_file_path) + else: + debug("vc.py:find_batch_file() not found:%s"%sdk_bat_file_path) + else: + return (batfilename,None) + +__INSTALLED_VCS_RUN = None + +def cached_get_installed_vcs(): + global __INSTALLED_VCS_RUN + + if __INSTALLED_VCS_RUN is None: + ret = get_installed_vcs() + __INSTALLED_VCS_RUN = ret + + return __INSTALLED_VCS_RUN + +def get_installed_vcs(): + installed_versions = [] + for ver in _VCVER: + debug('trying to find VC %s' % ver) + try: + if find_vc_pdir(ver): + debug('found VC %s' % ver) + installed_versions.append(ver) + else: + debug('find_vc_pdir return None for ver %s' % ver) + except VisualCException, e: + debug('did not find VC %s: caught exception %s' % (ver, str(e))) + return installed_versions + +def reset_installed_vcs(): + """Make it try again to find VC. This is just for the tests.""" + __INSTALLED_VCS_RUN = None + +def script_env(script, args=None): + stdout = common.get_output(script, args) + # Stupid batch files do not set return code: we take a look at the + # beginning of the output for an error message instead + olines = stdout.splitlines() + if olines[0].startswith("The specified configuration type is missing"): + raise BatchFileExecutionError("\n".join(olines[:2])) + + return common.parse_output(stdout) + +def get_default_version(env): + debug('get_default_version()') + + msvc_version = env.get('MSVC_VERSION') + msvs_version = env.get('MSVS_VERSION') + + debug('get_default_version(): msvc_version:%s msvs_version:%s'%(msvc_version,msvs_version)) + + if msvs_version and not msvc_version: + SCons.Warnings.warn( + SCons.Warnings.DeprecatedWarning, + "MSVS_VERSION is deprecated: please use MSVC_VERSION instead ") + return msvs_version + elif msvc_version and msvs_version: + if not msvc_version == msvs_version: + SCons.Warnings.warn( + SCons.Warnings.VisualVersionMismatch, + "Requested msvc version (%s) and msvs version (%s) do " \ + "not match: please use MSVC_VERSION only to request a " \ + "visual studio version, MSVS_VERSION is deprecated" \ + % (msvc_version, msvs_version)) + return msvs_version + if not msvc_version: + installed_vcs = cached_get_installed_vcs() + debug('installed_vcs:%s' % installed_vcs) + if not installed_vcs: + #msg = 'No installed VCs' + #debug('msv %s\n' % repr(msg)) + #SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, msg) + debug('msvc_setup_env: No installed VCs') + return None + msvc_version = installed_vcs[0] + debug('msvc_setup_env: using default installed MSVC version %s\n' % repr(msvc_version)) + + return msvc_version + +def msvc_setup_env_once(env): + try: + has_run = env["MSVC_SETUP_RUN"] + except KeyError: + has_run = False + + if not has_run: + msvc_setup_env(env) + env["MSVC_SETUP_RUN"] = True + +def msvc_find_valid_batch_script(env,version): + debug('vc.py:msvc_find_valid_batch_script()') + # Find the host platform, target platform, and if present the requested + # target platform + (host_platform, target_platform,req_target_platform) = get_host_target(env) + + # If the user hasn't specifically requested a TARGET_ARCH, and + # The TARGET_ARCH is amd64 then also try 32 bits if there are no viable + # 64 bit tools installed + try_target_archs = [target_platform] + if not req_target_platform and target_platform in ('amd64','x86_64'): + try_target_archs.append('x86') + + d = None + for tp in try_target_archs: + # Set to current arch. + env['TARGET_ARCH']=tp + + debug("vc.py:msvc_find_valid_batch_script() trying target_platform:%s"%tp) + host_target = (host_platform, tp) + if not is_host_target_supported(host_target, version): + warn_msg = "host, target = %s not supported for MSVC version %s" % \ + (host_target, version) + SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg) + arg = _HOST_TARGET_ARCH_TO_BAT_ARCH[host_target] + + # Try to locate a batch file for this host/target platform combo + try: + (vc_script,sdk_script) = find_batch_file(env,version,host_platform,tp) + debug('vc.py:msvc_find_valid_batch_script() vc_script:%s sdk_script:%s'%(vc_script,sdk_script)) + except VisualCException, e: + msg = str(e) + debug('Caught exception while looking for batch file (%s)' % msg) + warn_msg = "VC version %s not installed. " + \ + "C/C++ compilers are most likely not set correctly.\n" + \ + " Installed versions are: %s" + warn_msg = warn_msg % (version, cached_get_installed_vcs()) + SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg) + continue + + # Try to use the located batch file for this host/target platform combo + debug('vc.py:msvc_find_valid_batch_script() use_script 2 %s, args:%s\n' % (repr(vc_script), arg)) + if vc_script: + try: + d = script_env(vc_script, args=arg) + except BatchFileExecutionError, e: + debug('vc.py:msvc_find_valid_batch_script() use_script 3: failed running VC script %s: %s: Error:%s'%(repr(vc_script),arg,e)) + vc_script=None + if not vc_script and sdk_script: + debug('vc.py:msvc_find_valid_batch_script() use_script 4: trying sdk script: %s'%(sdk_script)) + try: + d = script_env(sdk_script,args=[]) + except BatchFileExecutionError,e: + debug('vc.py:msvc_find_valid_batch_script() use_script 5: failed running SDK script %s: Error:%s'%(repr(sdk_script),e)) + continue + elif not vc_script and not sdk_script: + debug('vc.py:msvc_find_valid_batch_script() use_script 6: Neither VC script nor SDK script found') + continue + + # If we cannot find a viable installed compiler, reset the TARGET_ARCH + # To it's initial value + if not d: + env['TARGET_ARCH']=req_target_platform + + return d + + +def msvc_setup_env(env): + debug('msvc_setup_env()') + + version = get_default_version(env) + if version is None: + warn_msg = "No version of Visual Studio compiler found - C/C++ " \ + "compilers most likely not set correctly" + SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg) + return None + debug('msvc_setup_env: using specified MSVC version %s\n' % repr(version)) + + # XXX: we set-up both MSVS version for backward + # compatibility with the msvs tool + env['MSVC_VERSION'] = version + env['MSVS_VERSION'] = version + env['MSVS'] = {} + + + use_script = env.get('MSVC_USE_SCRIPT', True) + if SCons.Util.is_String(use_script): + debug('vc.py:msvc_setup_env() use_script 1 %s\n' % repr(use_script)) + d = script_env(use_script) + elif use_script: + d = msvc_find_valid_batch_script(env,version) + debug('vc.py:msvc_setup_env() use_script 2 %s\n' % d) + if not d: + return d + else: + debug('MSVC_USE_SCRIPT set to False') + warn_msg = "MSVC_USE_SCRIPT set to False, assuming environment " \ + "set correctly." + SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg) + return None + + for k, v in d.items(): + debug('vc.py:msvc_setup_env() env:%s -> %s'%(k,v)) + env.PrependENVPath(k, v, delete_existing=True) + +def msvc_exists(version=None): + vcs = cached_get_installed_vcs() + if version is None: + return len(vcs) > 0 + return version in vcs + diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/vs.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/vs.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/vs.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/MSCommon/vs.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,553 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/MSCommon/vs.py 2013/03/03 09:48:35 garyo" + +__doc__ = """Module to detect Visual Studio and/or Visual C/C++ +""" + +import os + +import SCons.Errors +import SCons.Util + +from common import debug, \ + get_output, \ + is_win64, \ + normalize_env, \ + parse_output, \ + read_reg + +import SCons.Tool.MSCommon.vc + +class VisualStudio(object): + """ + An abstract base class for trying to find installed versions of + Visual Studio. + """ + def __init__(self, version, **kw): + self.version = version + kw['vc_version'] = kw.get('vc_version', version) + kw['sdk_version'] = kw.get('sdk_version', version) + self.__dict__.update(kw) + self._cache = {} + + # + + def find_batch_file(self): + vs_dir = self.get_vs_dir() + if not vs_dir: + debug('find_executable(): no vs_dir') + return None + batch_file = os.path.join(vs_dir, self.batch_file_path) + batch_file = os.path.normpath(batch_file) + if not os.path.isfile(batch_file): + debug('find_batch_file(): %s not on file system' % batch_file) + return None + return batch_file + + def find_vs_dir_by_vc(self): + SCons.Tool.MSCommon.vc.get_installed_vcs() + dir = SCons.Tool.MSCommon.vc.find_vc_pdir(self.vc_version) + if not dir: + debug('find_vs_dir(): no installed VC %s' % self.vc_version) + return None + return dir + + def find_vs_dir_by_reg(self): + root = 'Software\\' + + if is_win64(): + root = root + 'Wow6432Node\\' + for key in self.hkeys: + if key=='use_dir': + return self.find_vs_dir_by_vc() + key = root + key + try: + comps = read_reg(key) + except WindowsError, e: + debug('find_vs_dir_by_reg(): no VS registry key %s' % repr(key)) + else: + debug('find_vs_dir_by_reg(): found VS in registry: %s' % comps) + return comps + return None + + def find_vs_dir(self): + """ Can use registry or location of VC to find vs dir + First try to find by registry, and if that fails find via VC dir + """ + + + if True: + vs_dir=self.find_vs_dir_by_reg() + return vs_dir + else: + return self.find_vs_dir_by_vc() + + def find_executable(self): + vs_dir = self.get_vs_dir() + if not vs_dir: + debug('find_executable(): no vs_dir (%s)'%vs_dir) + return None + executable = os.path.join(vs_dir, self.executable_path) + executable = os.path.normpath(executable) + if not os.path.isfile(executable): + debug('find_executable(): %s not on file system' % executable) + return None + return executable + + # + + def get_batch_file(self): + try: + return self._cache['batch_file'] + except KeyError: + batch_file = self.find_batch_file() + self._cache['batch_file'] = batch_file + return batch_file + + def get_executable(self): + try: + debug('get_executable using cache:%s'%self._cache['executable']) + return self._cache['executable'] + except KeyError: + executable = self.find_executable() + self._cache['executable'] = executable + debug('get_executable not in cache:%s'%executable) + return executable + + def get_vs_dir(self): + try: + return self._cache['vs_dir'] + except KeyError: + vs_dir = self.find_vs_dir() + self._cache['vs_dir'] = vs_dir + return vs_dir + + def get_supported_arch(self): + try: + return self._cache['supported_arch'] + except KeyError: + # RDEVE: for the time being use hardcoded lists + # supported_arch = self.find_supported_arch() + self._cache['supported_arch'] = self.supported_arch + return self.supported_arch + + def reset(self): + self._cache = {} + +# The list of supported Visual Studio versions we know how to detect. +# +# How to look for .bat file ? +# - VS 2008 Express (x86): +# * from registry key productdir, gives the full path to vsvarsall.bat. In +# HKEY_LOCAL_MACHINE): +# Software\Microsoft\VCEpress\9.0\Setup\VC\productdir +# * from environmnent variable VS90COMNTOOLS: the path is then ..\..\VC +# relatively to the path given by the variable. +# +# - VS 2008 Express (WoW6432: 32 bits on windows x64): +# Software\Wow6432Node\Microsoft\VCEpress\9.0\Setup\VC\productdir +# +# - VS 2005 Express (x86): +# * from registry key productdir, gives the full path to vsvarsall.bat. In +# HKEY_LOCAL_MACHINE): +# Software\Microsoft\VCEpress\8.0\Setup\VC\productdir +# * from environmnent variable VS80COMNTOOLS: the path is then ..\..\VC +# relatively to the path given by the variable. +# +# - VS 2005 Express (WoW6432: 32 bits on windows x64): does not seem to have a +# productdir ? +# +# - VS 2003 .Net (pro edition ? x86): +# * from registry key productdir. The path is then ..\Common7\Tools\ +# relatively to the key. The key is in HKEY_LOCAL_MACHINE): +# Software\Microsoft\VisualStudio\7.1\Setup\VC\productdir +# * from environmnent variable VS71COMNTOOLS: the path is the full path to +# vsvars32.bat +# +# - VS 98 (VS 6): +# * from registry key productdir. The path is then Bin +# relatively to the key. The key is in HKEY_LOCAL_MACHINE): +# Software\Microsoft\VisualStudio\6.0\Setup\VC98\productdir +# +# The first version found in the list is the one used by default if +# there are multiple versions installed. Barring good reasons to +# the contrary, this means we should list versions from most recent +# to oldest. Pro versions get listed before Express versions on the +# assumption that, by default, you'd rather use the version you paid +# good money for in preference to whatever Microsoft makes available +# for free. +# +# If you update this list, update the documentation in Tool/msvs.xml. + +SupportedVSList = [ + # Visual Studio 2010 + # TODO: find the settings, perhaps from someone with a CTP copy? + #VisualStudio('TBD', + # hkey_root=r'TBD', + # common_tools_var='TBD', + # executable_path=r'TBD', + # default_dirname='TBD', + #), + + # Visual Studio 11 + # The batch file we look for is in the VC directory, + # so the devenv.com executable is up in ..\..\Common7\IDE. + VisualStudio('11.0', + sdk_version='6.1', + hkeys=[r'Microsoft\VisualStudio\11.0\Setup\VS\ProductDir'], + common_tools_var='VS110COMNTOOLS', + executable_path=r'Common7\IDE\devenv.com', + batch_file_path=r'Common7\Tools\vsvars32.bat', + default_dirname='Microsoft Visual Studio 11', + supported_arch=['x86', 'amd64'], + ), + + # Visual C++ 11 Express Edition + # The batch file we look for is in the VC directory, + # so the VCExpress.exe executable is up in ..\..\Common7\IDE. + VisualStudio('11.0Exp', + vc_version='11.0', + sdk_version='6.1', + hkeys=[r'Microsoft\VCExpress\11.0\Setup\VS\ProductDir'], + common_tools_var='VS110COMNTOOLS', + executable_path=r'Common7\IDE\VCExpress.exe', + batch_file_path=r'Common7\Tools\vsvars32.bat', + default_dirname='Microsoft Visual Studio 11', + supported_arch=['x86'], + ), + + # Visual Studio 2010 + # The batch file we look for is in the VC directory, + # so the devenv.com executable is up in ..\..\Common7\IDE. + VisualStudio('10.0', + sdk_version='6.1', + hkeys=[r'Microsoft\VisualStudio\10.0\Setup\VS\ProductDir'], + common_tools_var='VS100COMNTOOLS', + executable_path=r'Common7\IDE\devenv.com', + batch_file_path=r'Common7\Tools\vsvars32.bat', + default_dirname='Microsoft Visual Studio 10', + supported_arch=['x86', 'amd64'], + ), + + # Visual C++ 2010 Express Edition + # The batch file we look for is in the VC directory, + # so the VCExpress.exe executable is up in ..\..\Common7\IDE. + VisualStudio('10.0Exp', + vc_version='10.0', + sdk_version='6.1', + hkeys=[r'Microsoft\VCExpress\10.0\Setup\VS\ProductDir'], + common_tools_var='VS100COMNTOOLS', + executable_path=r'Common7\IDE\VCExpress.exe', + batch_file_path=r'Common7\Tools\vsvars32.bat', + default_dirname='Microsoft Visual Studio 10', + supported_arch=['x86'], + ), + + # Visual Studio 2008 + # The batch file we look for is in the VC directory, + # so the devenv.com executable is up in ..\..\Common7\IDE. + VisualStudio('9.0', + sdk_version='6.1', + hkeys=[r'Microsoft\VisualStudio\9.0\Setup\VS\ProductDir'], + common_tools_var='VS90COMNTOOLS', + executable_path=r'Common7\IDE\devenv.com', + batch_file_path=r'Common7\Tools\vsvars32.bat', + default_dirname='Microsoft Visual Studio 9', + supported_arch=['x86', 'amd64'], + ), + + # Visual C++ 2008 Express Edition + # The batch file we look for is in the VC directory, + # so the VCExpress.exe executable is up in ..\..\Common7\IDE. + VisualStudio('9.0Exp', + vc_version='9.0', + sdk_version='6.1', + hkeys=[r'Microsoft\VCExpress\9.0\Setup\VS\ProductDir'], + common_tools_var='VS90COMNTOOLS', + executable_path=r'Common7\IDE\VCExpress.exe', + batch_file_path=r'Common7\Tools\vsvars32.bat', + default_dirname='Microsoft Visual Studio 9', + supported_arch=['x86'], + ), + + # Visual Studio 2005 + # The batch file we look for is in the VC directory, + # so the devenv.com executable is up in ..\..\Common7\IDE. + VisualStudio('8.0', + sdk_version='6.0A', + hkeys=[r'Microsoft\VisualStudio\8.0\Setup\VS\ProductDir'], + common_tools_var='VS80COMNTOOLS', + executable_path=r'Common7\IDE\devenv.com', + batch_file_path=r'Common7\Tools\vsvars32.bat', + default_dirname='Microsoft Visual Studio 8', + supported_arch=['x86', 'amd64'], + ), + + # Visual C++ 2005 Express Edition + # The batch file we look for is in the VC directory, + # so the VCExpress.exe executable is up in ..\..\Common7\IDE. + VisualStudio('8.0Exp', + vc_version='8.0Exp', + sdk_version='6.0A', + hkeys=[r'Microsoft\VCExpress\8.0\Setup\VS\ProductDir'], + common_tools_var='VS80COMNTOOLS', + executable_path=r'Common7\IDE\VCExpress.exe', + batch_file_path=r'Common7\Tools\vsvars32.bat', + default_dirname='Microsoft Visual Studio 8', + supported_arch=['x86'], + ), + + # Visual Studio .NET 2003 + # The batch file we look for is in the Common7\Tools directory, + # so the devenv.com executable is next door in ..\IDE. + VisualStudio('7.1', + sdk_version='6.0', + hkeys=[r'Microsoft\VisualStudio\7.1\Setup\VS\ProductDir'], + common_tools_var='VS71COMNTOOLS', + executable_path=r'Common7\IDE\devenv.com', + batch_file_path=r'Common7\Tools\vsvars32.bat', + default_dirname='Microsoft Visual Studio .NET 2003', + supported_arch=['x86'], + ), + + # Visual Studio .NET + # The batch file we look for is in the Common7\Tools directory, + # so the devenv.com executable is next door in ..\IDE. + VisualStudio('7.0', + sdk_version='2003R2', + hkeys=[r'Microsoft\VisualStudio\7.0\Setup\VS\ProductDir'], + common_tools_var='VS70COMNTOOLS', + executable_path=r'IDE\devenv.com', + batch_file_path=r'Common7\Tools\vsvars32.bat', + default_dirname='Microsoft Visual Studio .NET', + supported_arch=['x86'], + ), + + # Visual Studio 6.0 + VisualStudio('6.0', + sdk_version='2003R1', + hkeys=[r'Microsoft\VisualStudio\6.0\Setup\Microsoft Visual Studio\ProductDir', + 'use_dir'], + common_tools_var='VS60COMNTOOLS', + executable_path=r'Common\MSDev98\Bin\MSDEV.COM', + batch_file_path=r'Common7\Tools\vsvars32.bat', + default_dirname='Microsoft Visual Studio', + supported_arch=['x86'], + ), +] + +SupportedVSMap = {} +for vs in SupportedVSList: + SupportedVSMap[vs.version] = vs + + +# Finding installed versions of Visual Studio isn't cheap, because it +# goes not only to the registry but also to the disk to sanity-check +# that there is, in fact, a Visual Studio directory there and that the +# registry entry isn't just stale. Find this information once, when +# requested, and cache it. + +InstalledVSList = None +InstalledVSMap = None + +def get_installed_visual_studios(): + global InstalledVSList + global InstalledVSMap + if InstalledVSList is None: + InstalledVSList = [] + InstalledVSMap = {} + for vs in SupportedVSList: + debug('trying to find VS %s' % vs.version) + if vs.get_executable(): + debug('found VS %s' % vs.version) + InstalledVSList.append(vs) + InstalledVSMap[vs.version] = vs + return InstalledVSList + +def reset_installed_visual_studios(): + global InstalledVSList + global InstalledVSMap + InstalledVSList = None + InstalledVSMap = None + for vs in SupportedVSList: + vs.reset() + + # Need to clear installed VC's as well as they are used in finding + # installed VS's + SCons.Tool.MSCommon.vc.reset_installed_vcs() + + +# We may be asked to update multiple construction environments with +# SDK information. When doing this, we check on-disk for whether +# the SDK has 'mfc' and 'atl' subdirectories. Since going to disk +# is expensive, cache results by directory. + +#SDKEnvironmentUpdates = {} +# +#def set_sdk_by_directory(env, sdk_dir): +# global SDKEnvironmentUpdates +# try: +# env_tuple_list = SDKEnvironmentUpdates[sdk_dir] +# except KeyError: +# env_tuple_list = [] +# SDKEnvironmentUpdates[sdk_dir] = env_tuple_list +# +# include_path = os.path.join(sdk_dir, 'include') +# mfc_path = os.path.join(include_path, 'mfc') +# atl_path = os.path.join(include_path, 'atl') +# +# if os.path.exists(mfc_path): +# env_tuple_list.append(('INCLUDE', mfc_path)) +# if os.path.exists(atl_path): +# env_tuple_list.append(('INCLUDE', atl_path)) +# env_tuple_list.append(('INCLUDE', include_path)) +# +# env_tuple_list.append(('LIB', os.path.join(sdk_dir, 'lib'))) +# env_tuple_list.append(('LIBPATH', os.path.join(sdk_dir, 'lib'))) +# env_tuple_list.append(('PATH', os.path.join(sdk_dir, 'bin'))) +# +# for variable, directory in env_tuple_list: +# env.PrependENVPath(variable, directory) + +def msvs_exists(): + return (len(get_installed_visual_studios()) > 0) + +def get_vs_by_version(msvs): + global InstalledVSMap + global SupportedVSMap + + debug('vs.py:get_vs_by_version()') + if msvs not in SupportedVSMap: + msg = "Visual Studio version %s is not supported" % repr(msvs) + raise SCons.Errors.UserError(msg) + get_installed_visual_studios() + vs = InstalledVSMap.get(msvs) + debug('InstalledVSMap:%s'%InstalledVSMap) + debug('vs.py:get_vs_by_version: found vs:%s'%vs) + # Some check like this would let us provide a useful error message + # if they try to set a Visual Studio version that's not installed. + # However, we also want to be able to run tests (like the unit + # tests) on systems that don't, or won't ever, have it installed. + # It might be worth resurrecting this, with some configurable + # setting that the tests can use to bypass the check. + #if not vs: + # msg = "Visual Studio version %s is not installed" % repr(msvs) + # raise SCons.Errors.UserError, msg + return vs + +def get_default_version(env): + """Returns the default version string to use for MSVS. + + If no version was requested by the user through the MSVS environment + variable, query all the available the visual studios through + query_versions, and take the highest one. + + Return + ------ + version: str + the default version. + """ + if 'MSVS' not in env or not SCons.Util.is_Dict(env['MSVS']): + versions = [vs.version for vs in get_installed_visual_studios()] + env['MSVS'] = {'VERSIONS' : versions} + else: + versions = env['MSVS'].get('VERSIONS', []) + + if 'MSVS_VERSION' not in env: + if versions: + env['MSVS_VERSION'] = versions[0] #use highest version by default + else: + env['MSVS_VERSION'] = SupportedVSList[0].version + + env['MSVS']['VERSION'] = env['MSVS_VERSION'] + + return env['MSVS_VERSION'] + +def get_default_arch(env): + """Return the default arch to use for MSVS + + if no version was requested by the user through the MSVS_ARCH environment + variable, select x86 + + Return + ------ + arch: str + """ + arch = env.get('MSVS_ARCH', 'x86') + + msvs = InstalledVSMap.get(env['MSVS_VERSION']) + + if not msvs: + arch = 'x86' + elif not arch in msvs.get_supported_arch(): + fmt = "Visual Studio version %s does not support architecture %s" + raise SCons.Errors.UserError(fmt % (env['MSVS_VERSION'], arch)) + + return arch + +def merge_default_version(env): + version = get_default_version(env) + arch = get_default_arch(env) + +def msvs_setup_env(env): + batfilename = msvs.get_batch_file() + msvs = get_vs_by_version(version) + if msvs is None: + return + + # XXX: I think this is broken. This will silently set a bogus tool instead + # of failing, but there is no other way with the current scons tool + # framework + if batfilename is not None: + + vars = ('LIB', 'LIBPATH', 'PATH', 'INCLUDE') + + msvs_list = get_installed_visual_studios() + vscommonvarnames = [vs.common_tools_var for vs in msvs_list] + save_ENV = env['ENV'] + nenv = normalize_env(env['ENV'], + ['COMSPEC'] + vscommonvarnames, + force=True) + try: + output = get_output(batfilename, arch, env=nenv) + finally: + env['ENV'] = save_ENV + vars = parse_output(output, vars) + + for k, v in vars.items(): + env.PrependENVPath(k, v, delete_existing=1) + +def query_versions(): + """Query the system to get available versions of VS. A version is + considered when a batfile is found.""" + msvs_list = get_installed_visual_studios() + versions = [msvs.version for msvs in msvs_list] + return versions + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/Perforce.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/Perforce.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/Perforce.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/Perforce.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,103 @@ +"""SCons.Tool.Perforce.py + +Tool-specific initialization for Perforce Source Code Management system. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/Perforce.py 2013/03/03 09:48:35 garyo" + +import os + +import SCons.Action +import SCons.Builder +import SCons.Node.FS +import SCons.Util + +# This function should maybe be moved to SCons.Util? +from SCons.Tool.PharLapCommon import addPathIfNotExists + + +# Variables that we want to import from the base OS environment. +_import_env = [ 'P4PORT', 'P4CLIENT', 'P4USER', 'USER', 'USERNAME', 'P4PASSWD', + 'P4CHARSET', 'P4LANGUAGE', 'SystemRoot' ] + +PerforceAction = SCons.Action.Action('$P4COM', '$P4COMSTR') + +def generate(env): + """Add a Builder factory function and construction variables for + Perforce to an Environment.""" + + def PerforceFactory(env=env): + """ """ + import SCons.Warnings as W + W.warn(W.DeprecatedSourceCodeWarning, """The Perforce() factory is deprecated and there is no replacement.""") + return SCons.Builder.Builder(action = PerforceAction, env = env) + + #setattr(env, 'Perforce', PerforceFactory) + env.Perforce = PerforceFactory + + env['P4'] = 'p4' + env['P4FLAGS'] = SCons.Util.CLVar('') + env['P4COM'] = '$P4 $P4FLAGS sync $TARGET' + try: + environ = env['ENV'] + except KeyError: + environ = {} + env['ENV'] = environ + + # Perforce seems to use the PWD environment variable rather than + # calling getcwd() for itself, which is odd. If no PWD variable + # is present, p4 WILL call getcwd, but this seems to cause problems + # with good ol' Windows's tilde-mangling for long file names. + environ['PWD'] = env.Dir('#').get_abspath() + + for var in _import_env: + v = os.environ.get(var) + if v: + environ[var] = v + + if SCons.Util.can_read_reg: + # If we can read the registry, add the path to Perforce to our environment. + try: + k=SCons.Util.RegOpenKeyEx(SCons.Util.hkey_mod.HKEY_LOCAL_MACHINE, + 'Software\\Perforce\\environment') + val, tok = SCons.Util.RegQueryValueEx(k, 'P4INSTROOT') + addPathIfNotExists(environ, 'PATH', val) + except SCons.Util.RegError: + # Can't detect where Perforce is, hope the user has it set in the + # PATH. + pass + +def exists(env): + return env.Detect('p4') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/PharLapCommon.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/PharLapCommon.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/PharLapCommon.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/PharLapCommon.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,137 @@ +"""SCons.Tool.PharLapCommon + +This module contains common code used by all Tools for the +Phar Lap ETS tool chain. Right now, this is linkloc and +386asm. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/PharLapCommon.py 2013/03/03 09:48:35 garyo" + +import os +import os.path +import SCons.Errors +import SCons.Util +import re + +def getPharLapPath(): + """Reads the registry to find the installed path of the Phar Lap ETS + development kit. + + Raises UserError if no installed version of Phar Lap can + be found.""" + + if not SCons.Util.can_read_reg: + raise SCons.Errors.InternalError("No Windows registry module was found") + try: + k=SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, + 'SOFTWARE\\Pharlap\\ETS') + val, type = SCons.Util.RegQueryValueEx(k, 'BaseDir') + + # The following is a hack...there is (not surprisingly) + # an odd issue in the Phar Lap plug in that inserts + # a bunch of junk data after the phar lap path in the + # registry. We must trim it. + idx=val.find('\0') + if idx >= 0: + val = val[:idx] + + return os.path.normpath(val) + except SCons.Util.RegError: + raise SCons.Errors.UserError("Cannot find Phar Lap ETS path in the registry. Is it installed properly?") + +REGEX_ETS_VER = re.compile(r'#define\s+ETS_VER\s+([0-9]+)') + +def getPharLapVersion(): + """Returns the version of the installed ETS Tool Suite as a + decimal number. This version comes from the ETS_VER #define in + the embkern.h header. For example, '#define ETS_VER 1010' (which + is what Phar Lap 10.1 defines) would cause this method to return + 1010. Phar Lap 9.1 does not have such a #define, but this method + will return 910 as a default. + + Raises UserError if no installed version of Phar Lap can + be found.""" + + include_path = os.path.join(getPharLapPath(), os.path.normpath("include/embkern.h")) + if not os.path.exists(include_path): + raise SCons.Errors.UserError("Cannot find embkern.h in ETS include directory.\nIs Phar Lap ETS installed properly?") + mo = REGEX_ETS_VER.search(open(include_path, 'r').read()) + if mo: + return int(mo.group(1)) + # Default return for Phar Lap 9.1 + return 910 + +def addPathIfNotExists(env_dict, key, path, sep=os.pathsep): + """This function will take 'key' out of the dictionary + 'env_dict', then add the path 'path' to that key if it is not + already there. This treats the value of env_dict[key] as if it + has a similar format to the PATH variable...a list of paths + separated by tokens. The 'path' will get added to the list if it + is not already there.""" + try: + is_list = 1 + paths = env_dict[key] + if not SCons.Util.is_List(env_dict[key]): + paths = paths.split(sep) + is_list = 0 + if os.path.normcase(path) not in list(map(os.path.normcase, paths)): + paths = [ path ] + paths + if is_list: + env_dict[key] = paths + else: + env_dict[key] = sep.join(paths) + except KeyError: + env_dict[key] = path + +def addPharLapPaths(env): + """This function adds the path to the Phar Lap binaries, includes, + and libraries, if they are not already there.""" + ph_path = getPharLapPath() + + try: + env_dict = env['ENV'] + except KeyError: + env_dict = {} + env['ENV'] = env_dict + addPathIfNotExists(env_dict, 'PATH', + os.path.join(ph_path, 'bin')) + addPathIfNotExists(env_dict, 'INCLUDE', + os.path.join(ph_path, 'include')) + addPathIfNotExists(env_dict, 'LIB', + os.path.join(ph_path, 'lib')) + addPathIfNotExists(env_dict, 'LIB', + os.path.join(ph_path, os.path.normpath('lib/vclib'))) + + env['PHARLAP_PATH'] = getPharLapPath() + env['PHARLAP_VERSION'] = str(getPharLapVersion()) + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/RCS.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/RCS.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/RCS.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/RCS.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,64 @@ +"""SCons.Tool.RCS.py + +Tool-specific initialization for RCS. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/RCS.py 2013/03/03 09:48:35 garyo" + +import SCons.Action +import SCons.Builder +import SCons.Util + +def generate(env): + """Add a Builder factory function and construction variables for + RCS to an Environment.""" + + def RCSFactory(env=env): + """ """ + import SCons.Warnings as W + W.warn(W.DeprecatedSourceCodeWarning, """The RCS() factory is deprecated and there is no replacement.""") + act = SCons.Action.Action('$RCS_COCOM', '$RCS_COCOMSTR') + return SCons.Builder.Builder(action = act, env = env) + + #setattr(env, 'RCS', RCSFactory) + env.RCS = RCSFactory + + env['RCS'] = 'rcs' + env['RCS_CO'] = 'co' + env['RCS_COFLAGS'] = SCons.Util.CLVar('') + env['RCS_COCOM'] = '$RCS_CO $RCS_COFLAGS $TARGET' + +def exists(env): + return env.Detect('rcs') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/SCCS.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/SCCS.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/SCCS.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/SCCS.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,64 @@ +"""SCons.Tool.SCCS.py + +Tool-specific initialization for SCCS. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/SCCS.py 2013/03/03 09:48:35 garyo" + +import SCons.Action +import SCons.Builder +import SCons.Util + +def generate(env): + """Add a Builder factory function and construction variables for + SCCS to an Environment.""" + + def SCCSFactory(env=env): + """ """ + import SCons.Warnings as W + W.warn(W.DeprecatedSourceCodeWarning, """The SCCS() factory is deprecated and there is no replacement.""") + act = SCons.Action.Action('$SCCSCOM', '$SCCSCOMSTR') + return SCons.Builder.Builder(action = act, env = env) + + #setattr(env, 'SCCS', SCCSFactory) + env.SCCS = SCCSFactory + + env['SCCS'] = 'sccs' + env['SCCSFLAGS'] = SCons.Util.CLVar('') + env['SCCSGETFLAGS'] = SCons.Util.CLVar('') + env['SCCSCOM'] = '$SCCS $SCCSFLAGS get $SCCSGETFLAGS $TARGET' + +def exists(env): + return env.Detect('sccs') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/Subversion.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/Subversion.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/Subversion.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/Subversion.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,71 @@ +"""SCons.Tool.Subversion.py + +Tool-specific initialization for Subversion. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/Subversion.py 2013/03/03 09:48:35 garyo" + +import os.path + +import SCons.Action +import SCons.Builder +import SCons.Util + +def generate(env): + """Add a Builder factory function and construction variables for + Subversion to an Environment.""" + + def SubversionFactory(repos, module='', env=env): + """ """ + # fail if repos is not an absolute path name? + import SCons.Warnings as W + W.warn(W.DeprecatedSourceCodeWarning, """The Subversion() factory is deprecated and there is no replacement.""") + if module != '': + module = os.path.join(module, '') + act = SCons.Action.Action('$SVNCOM', '$SVNCOMSTR') + return SCons.Builder.Builder(action = act, + env = env, + SVNREPOSITORY = repos, + SVNMODULE = module) + + #setattr(env, 'Subversion', SubversionFactory) + env.Subversion = SubversionFactory + + env['SVN'] = 'svn' + env['SVNFLAGS'] = SCons.Util.CLVar('') + env['SVNCOM'] = '$SVN $SVNFLAGS cat $SVNREPOSITORY/$SVNMODULE$TARGET > $TARGET' + +def exists(env): + return env.Detect('svn') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/__init__.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/__init__.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/__init__.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,802 @@ +"""SCons.Tool + +SCons tool selection. + +This looks for modules that define a callable object that can modify +a construction environment as appropriate for a given tool (or tool +chain). + +Note that because this subsystem just *selects* a callable that can +modify a construction environment, it's possible for people to define +their own "tool specification" in an arbitrary callable function. No +one needs to use or tie in to this subsystem in order to roll their own +tool definition. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/__init__.py 2013/03/03 09:48:35 garyo" + +import imp +import sys +import re +import os +import shutil + +import SCons.Builder +import SCons.Errors +import SCons.Node.FS +import SCons.Scanner +import SCons.Scanner.C +import SCons.Scanner.D +import SCons.Scanner.LaTeX +import SCons.Scanner.Prog + +DefaultToolpath=[] + +CScanner = SCons.Scanner.C.CScanner() +DScanner = SCons.Scanner.D.DScanner() +LaTeXScanner = SCons.Scanner.LaTeX.LaTeXScanner() +PDFLaTeXScanner = SCons.Scanner.LaTeX.PDFLaTeXScanner() +ProgramScanner = SCons.Scanner.Prog.ProgramScanner() +SourceFileScanner = SCons.Scanner.Base({}, name='SourceFileScanner') + +CSuffixes = [".c", ".C", ".cxx", ".cpp", ".c++", ".cc", + ".h", ".H", ".hxx", ".hpp", ".hh", + ".F", ".fpp", ".FPP", + ".m", ".mm", + ".S", ".spp", ".SPP", ".sx"] + +DSuffixes = ['.d'] + +IDLSuffixes = [".idl", ".IDL"] + +LaTeXSuffixes = [".tex", ".ltx", ".latex"] + +for suffix in CSuffixes: + SourceFileScanner.add_scanner(suffix, CScanner) + +for suffix in DSuffixes: + SourceFileScanner.add_scanner(suffix, DScanner) + +# FIXME: what should be done here? Two scanners scan the same extensions, +# but look for different files, e.g., "picture.eps" vs. "picture.pdf". +# The builders for DVI and PDF explicitly reference their scanners +# I think that means this is not needed??? +for suffix in LaTeXSuffixes: + SourceFileScanner.add_scanner(suffix, LaTeXScanner) + SourceFileScanner.add_scanner(suffix, PDFLaTeXScanner) + +class Tool(object): + def __init__(self, name, toolpath=[], **kw): + self.name = name + self.toolpath = toolpath + DefaultToolpath + # remember these so we can merge them into the call + self.init_kw = kw + + module = self._tool_module() + self.generate = module.generate + self.exists = module.exists + if hasattr(module, 'options'): + self.options = module.options + + def _tool_module(self): + # TODO: Interchange zipimport with normal initilization for better error reporting + oldpythonpath = sys.path + sys.path = self.toolpath + sys.path + + try: + try: + file, path, desc = imp.find_module(self.name, self.toolpath) + try: + return imp.load_module(self.name, file, path, desc) + finally: + if file: + file.close() + except ImportError, e: + if str(e)!="No module named %s"%self.name: + raise SCons.Errors.EnvironmentError(e) + try: + import zipimport + except ImportError: + pass + else: + for aPath in self.toolpath: + try: + importer = zipimport.zipimporter(aPath) + return importer.load_module(self.name) + except ImportError, e: + pass + finally: + sys.path = oldpythonpath + + full_name = 'SCons.Tool.' + self.name + try: + return sys.modules[full_name] + except KeyError: + try: + smpath = sys.modules['SCons.Tool'].__path__ + try: + file, path, desc = imp.find_module(self.name, smpath) + module = imp.load_module(full_name, file, path, desc) + setattr(SCons.Tool, self.name, module) + if file: + file.close() + return module + except ImportError, e: + if str(e)!="No module named %s"%self.name: + raise SCons.Errors.EnvironmentError(e) + try: + import zipimport + importer = zipimport.zipimporter( sys.modules['SCons.Tool'].__path__[0] ) + module = importer.load_module(full_name) + setattr(SCons.Tool, self.name, module) + return module + except ImportError, e: + m = "No tool named '%s': %s" % (self.name, e) + raise SCons.Errors.EnvironmentError(m) + except ImportError, e: + m = "No tool named '%s': %s" % (self.name, e) + raise SCons.Errors.EnvironmentError(m) + + def __call__(self, env, *args, **kw): + if self.init_kw is not None: + # Merge call kws into init kws; + # but don't bash self.init_kw. + if kw is not None: + call_kw = kw + kw = self.init_kw.copy() + kw.update(call_kw) + else: + kw = self.init_kw + env.Append(TOOLS = [ self.name ]) + if hasattr(self, 'options'): + import SCons.Variables + if 'options' not in env: + from SCons.Script import ARGUMENTS + env['options']=SCons.Variables.Variables(args=ARGUMENTS) + opts=env['options'] + + self.options(opts) + opts.Update(env) + + self.generate(env, *args, **kw) + + def __str__(self): + return self.name + +########################################################################## +# Create common executable program / library / object builders + +def createProgBuilder(env): + """This is a utility function that creates the Program + Builder in an Environment if it is not there already. + + If it is already there, we return the existing one. + """ + + try: + program = env['BUILDERS']['Program'] + except KeyError: + import SCons.Defaults + program = SCons.Builder.Builder(action = SCons.Defaults.LinkAction, + emitter = '$PROGEMITTER', + prefix = '$PROGPREFIX', + suffix = '$PROGSUFFIX', + src_suffix = '$OBJSUFFIX', + src_builder = 'Object', + target_scanner = ProgramScanner) + env['BUILDERS']['Program'] = program + + return program + +def createStaticLibBuilder(env): + """This is a utility function that creates the StaticLibrary + Builder in an Environment if it is not there already. + + If it is already there, we return the existing one. + """ + + try: + static_lib = env['BUILDERS']['StaticLibrary'] + except KeyError: + action_list = [ SCons.Action.Action("$ARCOM", "$ARCOMSTR") ] + if env.Detect('ranlib'): + ranlib_action = SCons.Action.Action("$RANLIBCOM", "$RANLIBCOMSTR") + action_list.append(ranlib_action) + + static_lib = SCons.Builder.Builder(action = action_list, + emitter = '$LIBEMITTER', + prefix = '$LIBPREFIX', + suffix = '$LIBSUFFIX', + src_suffix = '$OBJSUFFIX', + src_builder = 'StaticObject') + env['BUILDERS']['StaticLibrary'] = static_lib + env['BUILDERS']['Library'] = static_lib + + return static_lib + +def VersionShLibLinkNames(version, libname, env): + """Generate names of symlinks to the versioned shared library""" + Verbose = False + platform = env.subst('$PLATFORM') + shlib_suffix = env.subst('$SHLIBSUFFIX') + shlink_flags = SCons.Util.CLVar(env.subst('$SHLINKFLAGS')) + + linknames = [] + if version.count(".") != 2: + # We need a version string of the form x.y.z to proceed + # Several changes need to be made to support versions like x.y + raise ValueError + + if platform == 'darwin': + # For libfoo.x.y.z.dylib, linknames libfoo.so + suffix_re = re.escape('.' + version + shlib_suffix) + linkname = re.sub(suffix_re, shlib_suffix, libname) + if Verbose: + print "VersionShLibLinkNames: linkname = ",linkname + linknames.append(linkname) + elif platform == 'posix': + # For libfoo.so.x.y.z, linknames libfoo.so libfoo.so.x.y libfoo.so.x + suffix_re = re.escape(shlib_suffix + '.' + version) + # First linkname has no version number + linkname = re.sub(suffix_re, shlib_suffix, libname) + if Verbose: + print "VersionShLibLinkNames: linkname = ",linkname + linknames.append(linkname) + versionparts = version.split('.') + major_name = linkname + "." + versionparts[0] + minor_name = major_name + "." + versionparts[1] + #Only add link for major_name + #for linkname in [major_name, minor_name]: + for linkname in [major_name, ]: + if Verbose: + print "VersionShLibLinkNames: linkname ",linkname, ", target ",libname + linknames.append(linkname) + # note: no Windows case here (win32 or cygwin); + # MSVC doesn't support this type of versioned shared libs. + # (could probably do something for MinGW though) + return linknames + +def VersionedSharedLibrary(target = None, source= None, env=None): + """Build a shared library. If the environment has SHLIBVERSION +defined make a versioned shared library and create the appropriate +symlinks for the platform we are on""" + Verbose = False + try: + version = env.subst('$SHLIBVERSION') + except KeyError: + version = None + + # libname includes the version number if one was given + libname = target[0].name + platform = env.subst('$PLATFORM') + shlib_suffix = env.subst('$SHLIBSUFFIX') + shlink_flags = SCons.Util.CLVar(env.subst('$SHLINKFLAGS')) + if Verbose: + print "VersionShLib: libname = ",libname + print "VersionShLib: platform = ",platform + print "VersionShLib: shlib_suffix = ",shlib_suffix + print "VersionShLib: target = ",str(target[0]) + + if version: + # set the shared library link flags + if platform == 'posix': + suffix_re = re.escape(shlib_suffix + '.' + version) + (major, age, revision) = version.split(".") + # soname will have only the major version number in it + soname = re.sub(suffix_re, shlib_suffix, libname) + '.' + major + shlink_flags += [ '-Wl,-Bsymbolic', '-Wl,-soname=%s' % soname ] + if Verbose: + print " soname ",soname,", shlink_flags ",shlink_flags + elif platform == 'cygwin': + shlink_flags += [ '-Wl,-Bsymbolic', + '-Wl,--out-implib,${TARGET.base}.a' ] + elif platform == 'darwin': + shlink_flags += [ '-current_version', '%s' % version, + '-compatibility_version', '%s' % version, + '-undefined', 'dynamic_lookup' ] + if Verbose: + print "VersionShLib: shlink_flags = ",shlink_flags + envlink = env.Clone() + envlink['SHLINKFLAGS'] = shlink_flags + else: + envlink = env + + result = SCons.Defaults.ShLinkAction(target, source, envlink) + + if version: + # here we need the full pathname so the links end up in the right directory + libname = target[0].path + linknames = VersionShLibLinkNames(version, libname, env) + if Verbose: + print "VerShLib: linknames ",linknames + # Here we just need the file name w/o path as the target of the link + lib_ver = target[0].name + # make symlink of adjacent names in linknames + for count in range(len(linknames)): + linkname = linknames[count] + if count > 0: + os.symlink(os.path.basename(linkname),lastname) + if Verbose: + print "VerShLib: made sym link of %s -> %s" % (lastname,linkname) + lastname = linkname + # finish chain of sym links with link to the actual library + if len(linknames)>0: + os.symlink(lib_ver,lastname) + if Verbose: + print "VerShLib: made sym link of %s -> %s" % (lib_ver,linkname) + return result + +ShLibAction = SCons.Action.Action(VersionedSharedLibrary, None) + +def createSharedLibBuilder(env): + """This is a utility function that creates the SharedLibrary + Builder in an Environment if it is not there already. + + If it is already there, we return the existing one. + """ + + try: + shared_lib = env['BUILDERS']['SharedLibrary'] + except KeyError: + import SCons.Defaults + action_list = [ SCons.Defaults.SharedCheck, + ShLibAction ] + shared_lib = SCons.Builder.Builder(action = action_list, + emitter = "$SHLIBEMITTER", + prefix = '$SHLIBPREFIX', + suffix = '$SHLIBSUFFIX', + target_scanner = ProgramScanner, + src_suffix = '$SHOBJSUFFIX', + src_builder = 'SharedObject') + env['BUILDERS']['SharedLibrary'] = shared_lib + + return shared_lib + +def createLoadableModuleBuilder(env): + """This is a utility function that creates the LoadableModule + Builder in an Environment if it is not there already. + + If it is already there, we return the existing one. + """ + + try: + ld_module = env['BUILDERS']['LoadableModule'] + except KeyError: + import SCons.Defaults + action_list = [ SCons.Defaults.SharedCheck, + SCons.Defaults.LdModuleLinkAction ] + ld_module = SCons.Builder.Builder(action = action_list, + emitter = "$LDMODULEEMITTER", + prefix = '$LDMODULEPREFIX', + suffix = '$LDMODULESUFFIX', + target_scanner = ProgramScanner, + src_suffix = '$SHOBJSUFFIX', + src_builder = 'SharedObject') + env['BUILDERS']['LoadableModule'] = ld_module + + return ld_module + +def createObjBuilders(env): + """This is a utility function that creates the StaticObject + and SharedObject Builders in an Environment if they + are not there already. + + If they are there already, we return the existing ones. + + This is a separate function because soooo many Tools + use this functionality. + + The return is a 2-tuple of (StaticObject, SharedObject) + """ + + + try: + static_obj = env['BUILDERS']['StaticObject'] + except KeyError: + static_obj = SCons.Builder.Builder(action = {}, + emitter = {}, + prefix = '$OBJPREFIX', + suffix = '$OBJSUFFIX', + src_builder = ['CFile', 'CXXFile'], + source_scanner = SourceFileScanner, + single_source = 1) + env['BUILDERS']['StaticObject'] = static_obj + env['BUILDERS']['Object'] = static_obj + + try: + shared_obj = env['BUILDERS']['SharedObject'] + except KeyError: + shared_obj = SCons.Builder.Builder(action = {}, + emitter = {}, + prefix = '$SHOBJPREFIX', + suffix = '$SHOBJSUFFIX', + src_builder = ['CFile', 'CXXFile'], + source_scanner = SourceFileScanner, + single_source = 1) + env['BUILDERS']['SharedObject'] = shared_obj + + return (static_obj, shared_obj) + +def createCFileBuilders(env): + """This is a utility function that creates the CFile/CXXFile + Builders in an Environment if they + are not there already. + + If they are there already, we return the existing ones. + + This is a separate function because soooo many Tools + use this functionality. + + The return is a 2-tuple of (CFile, CXXFile) + """ + + try: + c_file = env['BUILDERS']['CFile'] + except KeyError: + c_file = SCons.Builder.Builder(action = {}, + emitter = {}, + suffix = {None:'$CFILESUFFIX'}) + env['BUILDERS']['CFile'] = c_file + + env.SetDefault(CFILESUFFIX = '.c') + + try: + cxx_file = env['BUILDERS']['CXXFile'] + except KeyError: + cxx_file = SCons.Builder.Builder(action = {}, + emitter = {}, + suffix = {None:'$CXXFILESUFFIX'}) + env['BUILDERS']['CXXFile'] = cxx_file + env.SetDefault(CXXFILESUFFIX = '.cc') + + return (c_file, cxx_file) + +########################################################################## +# Create common Java builders + +def CreateJarBuilder(env): + try: + java_jar = env['BUILDERS']['Jar'] + except KeyError: + fs = SCons.Node.FS.get_default_fs() + jar_com = SCons.Action.Action('$JARCOM', '$JARCOMSTR') + java_jar = SCons.Builder.Builder(action = jar_com, + suffix = '$JARSUFFIX', + src_suffix = '$JAVACLASSSUFIX', + src_builder = 'JavaClassFile', + source_factory = fs.Entry) + env['BUILDERS']['Jar'] = java_jar + return java_jar + +def CreateJavaHBuilder(env): + try: + java_javah = env['BUILDERS']['JavaH'] + except KeyError: + fs = SCons.Node.FS.get_default_fs() + java_javah_com = SCons.Action.Action('$JAVAHCOM', '$JAVAHCOMSTR') + java_javah = SCons.Builder.Builder(action = java_javah_com, + src_suffix = '$JAVACLASSSUFFIX', + target_factory = fs.Entry, + source_factory = fs.File, + src_builder = 'JavaClassFile') + env['BUILDERS']['JavaH'] = java_javah + return java_javah + +def CreateJavaClassFileBuilder(env): + try: + java_class_file = env['BUILDERS']['JavaClassFile'] + except KeyError: + fs = SCons.Node.FS.get_default_fs() + javac_com = SCons.Action.Action('$JAVACCOM', '$JAVACCOMSTR') + java_class_file = SCons.Builder.Builder(action = javac_com, + emitter = {}, + #suffix = '$JAVACLASSSUFFIX', + src_suffix = '$JAVASUFFIX', + src_builder = ['JavaFile'], + target_factory = fs.Entry, + source_factory = fs.File) + env['BUILDERS']['JavaClassFile'] = java_class_file + return java_class_file + +def CreateJavaClassDirBuilder(env): + try: + java_class_dir = env['BUILDERS']['JavaClassDir'] + except KeyError: + fs = SCons.Node.FS.get_default_fs() + javac_com = SCons.Action.Action('$JAVACCOM', '$JAVACCOMSTR') + java_class_dir = SCons.Builder.Builder(action = javac_com, + emitter = {}, + target_factory = fs.Dir, + source_factory = fs.Dir) + env['BUILDERS']['JavaClassDir'] = java_class_dir + return java_class_dir + +def CreateJavaFileBuilder(env): + try: + java_file = env['BUILDERS']['JavaFile'] + except KeyError: + java_file = SCons.Builder.Builder(action = {}, + emitter = {}, + suffix = {None:'$JAVASUFFIX'}) + env['BUILDERS']['JavaFile'] = java_file + env['JAVASUFFIX'] = '.java' + return java_file + +class ToolInitializerMethod(object): + """ + This is added to a construction environment in place of a + method(s) normally called for a Builder (env.Object, env.StaticObject, + etc.). When called, it has its associated ToolInitializer + object search the specified list of tools and apply the first + one that exists to the construction environment. It then calls + whatever builder was (presumably) added to the construction + environment in place of this particular instance. + """ + def __init__(self, name, initializer): + """ + Note: we store the tool name as __name__ so it can be used by + the class that attaches this to a construction environment. + """ + self.__name__ = name + self.initializer = initializer + + def get_builder(self, env): + """ + Returns the appropriate real Builder for this method name + after having the associated ToolInitializer object apply + the appropriate Tool module. + """ + builder = getattr(env, self.__name__) + + self.initializer.apply_tools(env) + + builder = getattr(env, self.__name__) + if builder is self: + # There was no Builder added, which means no valid Tool + # for this name was found (or possibly there's a mismatch + # between the name we were called by and the Builder name + # added by the Tool module). + return None + + self.initializer.remove_methods(env) + + return builder + + def __call__(self, env, *args, **kw): + """ + """ + builder = self.get_builder(env) + if builder is None: + return [], [] + return builder(*args, **kw) + +class ToolInitializer(object): + """ + A class for delayed initialization of Tools modules. + + Instances of this class associate a list of Tool modules with + a list of Builder method names that will be added by those Tool + modules. As part of instantiating this object for a particular + construction environment, we also add the appropriate + ToolInitializerMethod objects for the various Builder methods + that we want to use to delay Tool searches until necessary. + """ + def __init__(self, env, tools, names): + if not SCons.Util.is_List(tools): + tools = [tools] + if not SCons.Util.is_List(names): + names = [names] + self.env = env + self.tools = tools + self.names = names + self.methods = {} + for name in names: + method = ToolInitializerMethod(name, self) + self.methods[name] = method + env.AddMethod(method) + + def remove_methods(self, env): + """ + Removes the methods that were added by the tool initialization + so we no longer copy and re-bind them when the construction + environment gets cloned. + """ + for method in self.methods.values(): + env.RemoveMethod(method) + + def apply_tools(self, env): + """ + Searches the list of associated Tool modules for one that + exists, and applies that to the construction environment. + """ + for t in self.tools: + tool = SCons.Tool.Tool(t) + if tool.exists(env): + env.Tool(tool) + return + + # If we fall through here, there was no tool module found. + # This is where we can put an informative error message + # about the inability to find the tool. We'll start doing + # this as we cut over more pre-defined Builder+Tools to use + # the ToolInitializer class. + +def Initializers(env): + ToolInitializer(env, ['install'], ['_InternalInstall', '_InternalInstallAs', '_InternalInstallVersionedLib']) + def Install(self, *args, **kw): + return self._InternalInstall(*args, **kw) + def InstallAs(self, *args, **kw): + return self._InternalInstallAs(*args, **kw) + def InstallVersionedLib(self, *args, **kw): + return self._InternalInstallVersionedLib(*args, **kw) + env.AddMethod(Install) + env.AddMethod(InstallAs) + env.AddMethod(InstallVersionedLib) + +def FindTool(tools, env): + for tool in tools: + t = Tool(tool) + if t.exists(env): + return tool + return None + +def FindAllTools(tools, env): + def ToolExists(tool, env=env): + return Tool(tool).exists(env) + return list(filter (ToolExists, tools)) + +def tool_list(platform, env): + + other_plat_tools=[] + # XXX this logic about what tool to prefer on which platform + # should be moved into either the platform files or + # the tool files themselves. + # The search orders here are described in the man page. If you + # change these search orders, update the man page as well. + if str(platform) == 'win32': + "prefer Microsoft tools on Windows" + linkers = ['mslink', 'gnulink', 'ilink', 'linkloc', 'ilink32' ] + c_compilers = ['msvc', 'mingw', 'gcc', 'intelc', 'icl', 'icc', 'cc', 'bcc32' ] + cxx_compilers = ['msvc', 'intelc', 'icc', 'g++', 'c++', 'bcc32' ] + assemblers = ['masm', 'nasm', 'gas', '386asm' ] + fortran_compilers = ['gfortran', 'g77', 'ifl', 'cvf', 'f95', 'f90', 'fortran'] + ars = ['mslib', 'ar', 'tlib'] + other_plat_tools=['msvs','midl'] + elif str(platform) == 'os2': + "prefer IBM tools on OS/2" + linkers = ['ilink', 'gnulink', ]#'mslink'] + c_compilers = ['icc', 'gcc',]# 'msvc', 'cc'] + cxx_compilers = ['icc', 'g++',]# 'msvc', 'c++'] + assemblers = ['nasm',]# 'masm', 'gas'] + fortran_compilers = ['ifl', 'g77'] + ars = ['ar',]# 'mslib'] + elif str(platform) == 'irix': + "prefer MIPSPro on IRIX" + linkers = ['sgilink', 'gnulink'] + c_compilers = ['sgicc', 'gcc', 'cc'] + cxx_compilers = ['sgic++', 'g++', 'c++'] + assemblers = ['as', 'gas'] + fortran_compilers = ['f95', 'f90', 'f77', 'g77', 'fortran'] + ars = ['sgiar'] + elif str(platform) == 'sunos': + "prefer Forte tools on SunOS" + linkers = ['sunlink', 'gnulink'] + c_compilers = ['suncc', 'gcc', 'cc'] + cxx_compilers = ['sunc++', 'g++', 'c++'] + assemblers = ['as', 'gas'] + fortran_compilers = ['sunf95', 'sunf90', 'sunf77', 'f95', 'f90', 'f77', + 'gfortran', 'g77', 'fortran'] + ars = ['sunar'] + elif str(platform) == 'hpux': + "prefer aCC tools on HP-UX" + linkers = ['hplink', 'gnulink'] + c_compilers = ['hpcc', 'gcc', 'cc'] + cxx_compilers = ['hpc++', 'g++', 'c++'] + assemblers = ['as', 'gas'] + fortran_compilers = ['f95', 'f90', 'f77', 'g77', 'fortran'] + ars = ['ar'] + elif str(platform) == 'aix': + "prefer AIX Visual Age tools on AIX" + linkers = ['aixlink', 'gnulink'] + c_compilers = ['aixcc', 'gcc', 'cc'] + cxx_compilers = ['aixc++', 'g++', 'c++'] + assemblers = ['as', 'gas'] + fortran_compilers = ['f95', 'f90', 'aixf77', 'g77', 'fortran'] + ars = ['ar'] + elif str(platform) == 'darwin': + "prefer GNU tools on Mac OS X, except for some linkers and IBM tools" + linkers = ['applelink', 'gnulink'] + c_compilers = ['gcc', 'cc'] + cxx_compilers = ['g++', 'c++'] + assemblers = ['as'] + fortran_compilers = ['gfortran', 'f95', 'f90', 'g77'] + ars = ['ar'] + else: + "prefer GNU tools on all other platforms" + linkers = ['gnulink', 'mslink', 'ilink'] + c_compilers = ['gcc', 'msvc', 'intelc', 'icc', 'cc'] + cxx_compilers = ['g++', 'msvc', 'intelc', 'icc', 'c++'] + assemblers = ['gas', 'nasm', 'masm'] + fortran_compilers = ['gfortran', 'g77', 'ifort', 'ifl', 'f95', 'f90', 'f77'] + ars = ['ar', 'mslib'] + + c_compiler = FindTool(c_compilers, env) or c_compilers[0] + + # XXX this logic about what tool provides what should somehow be + # moved into the tool files themselves. + if c_compiler and c_compiler == 'mingw': + # MinGW contains a linker, C compiler, C++ compiler, + # Fortran compiler, archiver and assembler: + cxx_compiler = None + linker = None + assembler = None + fortran_compiler = None + ar = None + else: + # Don't use g++ if the C compiler has built-in C++ support: + if c_compiler in ('msvc', 'intelc', 'icc'): + cxx_compiler = None + else: + cxx_compiler = FindTool(cxx_compilers, env) or cxx_compilers[0] + linker = FindTool(linkers, env) or linkers[0] + assembler = FindTool(assemblers, env) or assemblers[0] + fortran_compiler = FindTool(fortran_compilers, env) or fortran_compilers[0] + ar = FindTool(ars, env) or ars[0] + + other_tools = FindAllTools(other_plat_tools + [ + 'dmd', + #TODO: merge 'install' into 'filesystem' and + # make 'filesystem' the default + 'filesystem', + 'm4', + 'wix', #'midl', 'msvs', + # Parser generators + 'lex', 'yacc', + # Foreign function interface + 'rpcgen', 'swig', + # Java + 'jar', 'javac', 'javah', 'rmic', + # TeX + 'dvipdf', 'dvips', 'gs', + 'tex', 'latex', 'pdflatex', 'pdftex', + # Archivers + 'tar', 'zip', 'rpm', + # SourceCode factories + 'BitKeeper', 'CVS', 'Perforce', + 'RCS', 'SCCS', # 'Subversion', + ], env) + + tools = ([linker, c_compiler, cxx_compiler, + fortran_compiler, assembler, ar] + + other_tools) + + return [x for x in tools if x] + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: + diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/aixc++.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/aixc++.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/aixc++.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/aixc++.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,82 @@ +"""SCons.Tool.aixc++ + +Tool-specific initialization for IBM xlC / Visual Age C++ compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/aixc++.py 2013/03/03 09:48:35 garyo" + +import os.path + +import SCons.Platform.aix + +cplusplus = __import__('c++', globals(), locals(), []) + +packages = ['vacpp.cmp.core', 'vacpp.cmp.batch', 'vacpp.cmp.C', 'ibmcxx.cmp'] + +def get_xlc(env): + xlc = env.get('CXX', 'xlC') + xlc_r = env.get('SHCXX', 'xlC_r') + return SCons.Platform.aix.get_xlc(env, xlc, xlc_r, packages) + +def smart_cxxflags(source, target, env, for_signature): + build_dir = env.GetBuildPath() + if build_dir: + return '-qtempinc=' + os.path.join(build_dir, 'tempinc') + return '' + +def generate(env): + """Add Builders and construction variables for xlC / Visual Age + suite to an Environment.""" + path, _cxx, _shcxx, version = get_xlc(env) + if path: + _cxx = os.path.join(path, _cxx) + _shcxx = os.path.join(path, _shcxx) + + cplusplus.generate(env) + + env['CXX'] = _cxx + env['SHCXX'] = _shcxx + env['CXXVERSION'] = version + env['SHOBJSUFFIX'] = '.pic.o' + +def exists(env): + path, _cxx, _shcxx, version = get_xlc(env) + if path and _cxx: + xlc = os.path.join(path, _cxx) + if os.path.exists(xlc): + return xlc + return None + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/aixcc.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/aixcc.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/aixcc.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/aixcc.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,74 @@ +"""SCons.Tool.aixcc + +Tool-specific initialization for IBM xlc / Visual Age C compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/aixcc.py 2013/03/03 09:48:35 garyo" + +import os.path + +import SCons.Platform.aix + +import cc + +packages = ['vac.C', 'ibmcxx.cmp'] + +def get_xlc(env): + xlc = env.get('CC', 'xlc') + xlc_r = env.get('SHCC', 'xlc_r') + return SCons.Platform.aix.get_xlc(env, xlc, xlc_r, packages) + +def generate(env): + """Add Builders and construction variables for xlc / Visual Age + suite to an Environment.""" + path, _cc, _shcc, version = get_xlc(env) + if path: + _cc = os.path.join(path, _cc) + _shcc = os.path.join(path, _shcc) + + cc.generate(env) + + env['CC'] = _cc + env['SHCC'] = _shcc + env['CCVERSION'] = version + +def exists(env): + path, _cc, _shcc, version = get_xlc(env) + if path and _cc: + xlc = os.path.join(path, _cc) + if os.path.exists(xlc): + return xlc + return None + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/aixf77.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/aixf77.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/aixf77.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/aixf77.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,80 @@ +"""engine.SCons.Tool.aixf77 + +Tool-specific initialization for IBM Visual Age f77 Fortran compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/aixf77.py 2013/03/03 09:48:35 garyo" + +import os.path + +#import SCons.Platform.aix + +import f77 + +# It would be good to look for the AIX F77 package the same way we're now +# looking for the C and C++ packages. This should be as easy as supplying +# the correct package names in the following list and uncommenting the +# SCons.Platform.aix_get_xlc() call the in the function below. +packages = [] + +def get_xlf77(env): + xlf77 = env.get('F77', 'xlf77') + xlf77_r = env.get('SHF77', 'xlf77_r') + #return SCons.Platform.aix.get_xlc(env, xlf77, xlf77_r, packages) + return (None, xlf77, xlf77_r, None) + +def generate(env): + """ + Add Builders and construction variables for the Visual Age FORTRAN + compiler to an Environment. + """ + path, _f77, _shf77, version = get_xlf77(env) + if path: + _f77 = os.path.join(path, _f77) + _shf77 = os.path.join(path, _shf77) + + f77.generate(env) + + env['F77'] = _f77 + env['SHF77'] = _shf77 + +def exists(env): + path, _f77, _shf77, version = get_xlf77(env) + if path and _f77: + xlf77 = os.path.join(path, _f77) + if os.path.exists(xlf77): + return xlf77 + return None + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/aixlink.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/aixlink.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/aixlink.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/aixlink.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,76 @@ +"""SCons.Tool.aixlink + +Tool-specific initialization for the IBM Visual Age linker. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/aixlink.py 2013/03/03 09:48:35 garyo" + +import os +import os.path + +import SCons.Util + +import aixcc +import link + +cplusplus = __import__('c++', globals(), locals(), []) + +def smart_linkflags(source, target, env, for_signature): + if cplusplus.iscplusplus(source): + build_dir = env.subst('$BUILDDIR', target=target, source=source) + if build_dir: + return '-qtempinc=' + os.path.join(build_dir, 'tempinc') + return '' + +def generate(env): + """ + Add Builders and construction variables for Visual Age linker to + an Environment. + """ + link.generate(env) + + env['SMARTLINKFLAGS'] = smart_linkflags + env['LINKFLAGS'] = SCons.Util.CLVar('$SMARTLINKFLAGS') + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -qmkshrobj -qsuppress=1501-218') + env['SHLIBSUFFIX'] = '.a' + +def exists(env): + path, _cc, _shcc, version = aixcc.get_xlc(env) + if path and _cc: + xlc = os.path.join(path, _cc) + if os.path.exists(xlc): + return xlc + return None + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/applelink.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/applelink.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/applelink.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/applelink.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,71 @@ +"""SCons.Tool.applelink + +Tool-specific initialization for the Apple gnu-like linker. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/applelink.py 2013/03/03 09:48:35 garyo" + +import SCons.Util + +# Even though the Mac is based on the GNU toolchain, it doesn't understand +# the -rpath option, so we use the "link" tool instead of "gnulink". +import link + +def generate(env): + """Add Builders and construction variables for applelink to an + Environment.""" + link.generate(env) + + env['FRAMEWORKPATHPREFIX'] = '-F' + env['_FRAMEWORKPATH'] = '${_concat(FRAMEWORKPATHPREFIX, FRAMEWORKPATH, "", __env__)}' + env['_FRAMEWORKS'] = '${_concat("-framework ", FRAMEWORKS, "", __env__)}' + env['LINKCOM'] = env['LINKCOM'] + ' $_FRAMEWORKPATH $_FRAMEWORKS $FRAMEWORKSFLAGS' + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -dynamiclib') + env['SHLINKCOM'] = env['SHLINKCOM'] + ' $_FRAMEWORKPATH $_FRAMEWORKS $FRAMEWORKSFLAGS' + + # override the default for loadable modules, which are different + # on OS X than dynamic shared libs. echoing what XCode does for + # pre/suffixes: + env['LDMODULEPREFIX'] = '' + env['LDMODULESUFFIX'] = '' + env['LDMODULEFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -bundle') + env['LDMODULECOM'] = '$LDMODULE -o ${TARGET} $LDMODULEFLAGS $SOURCES $_LIBDIRFLAGS $_LIBFLAGS $_FRAMEWORKPATH $_FRAMEWORKS $FRAMEWORKSFLAGS' + + + +def exists(env): + return env['PLATFORM'] == 'darwin' + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/ar.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/ar.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/ar.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/ar.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,63 @@ +"""SCons.Tool.ar + +Tool-specific initialization for ar (library archive). + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/ar.py 2013/03/03 09:48:35 garyo" + +import SCons.Defaults +import SCons.Tool +import SCons.Util + + +def generate(env): + """Add Builders and construction variables for ar to an Environment.""" + SCons.Tool.createStaticLibBuilder(env) + + env['AR'] = 'ar' + env['ARFLAGS'] = SCons.Util.CLVar('rc') + env['ARCOM'] = '$AR $ARFLAGS $TARGET $SOURCES' + env['LIBPREFIX'] = 'lib' + env['LIBSUFFIX'] = '.a' + + if env.Detect('ranlib'): + env['RANLIB'] = 'ranlib' + env['RANLIBFLAGS'] = SCons.Util.CLVar('') + env['RANLIBCOM'] = '$RANLIB $RANLIBFLAGS $TARGET' + +def exists(env): + return env.Detect('ar') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/as.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/as.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/as.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/as.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,78 @@ +"""SCons.Tool.as + +Tool-specific initialization for as, the generic Posix assembler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/as.py 2013/03/03 09:48:35 garyo" + +import SCons.Defaults +import SCons.Tool +import SCons.Util + +assemblers = ['as'] + +ASSuffixes = ['.s', '.asm', '.ASM'] +ASPPSuffixes = ['.spp', '.SPP', '.sx'] +if SCons.Util.case_sensitive_suffixes('.s', '.S'): + ASPPSuffixes.extend(['.S']) +else: + ASSuffixes.extend(['.S']) + +def generate(env): + """Add Builders and construction variables for as to an Environment.""" + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in ASSuffixes: + static_obj.add_action(suffix, SCons.Defaults.ASAction) + shared_obj.add_action(suffix, SCons.Defaults.ASAction) + static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) + shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter) + + for suffix in ASPPSuffixes: + static_obj.add_action(suffix, SCons.Defaults.ASPPAction) + shared_obj.add_action(suffix, SCons.Defaults.ASPPAction) + static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) + shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter) + + env['AS'] = env.Detect(assemblers) or 'as' + env['ASFLAGS'] = SCons.Util.CLVar('') + env['ASCOM'] = '$AS $ASFLAGS -o $TARGET $SOURCES' + env['ASPPFLAGS'] = '$ASFLAGS' + env['ASPPCOM'] = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' + +def exists(env): + return env.Detect(assemblers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/bcc32.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/bcc32.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/bcc32.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/bcc32.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,81 @@ +"""SCons.Tool.bcc32 + +XXX + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/bcc32.py 2013/03/03 09:48:35 garyo" + +import os +import os.path + +import SCons.Defaults +import SCons.Tool +import SCons.Util + +def findIt(program, env): + # First search in the SCons path and then the OS path: + borwin = env.WhereIs(program) or SCons.Util.WhereIs(program) + if borwin: + dir = os.path.dirname(borwin) + env.PrependENVPath('PATH', dir) + return borwin + +def generate(env): + findIt('bcc32', env) + """Add Builders and construction variables for bcc to an + Environment.""" + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + for suffix in ['.c', '.cpp']: + static_obj.add_action(suffix, SCons.Defaults.CAction) + shared_obj.add_action(suffix, SCons.Defaults.ShCAction) + static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) + shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter) + + env['CC'] = 'bcc32' + env['CCFLAGS'] = SCons.Util.CLVar('') + env['CFLAGS'] = SCons.Util.CLVar('') + env['CCCOM'] = '$CC -q $CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o$TARGET $SOURCES' + env['SHCC'] = '$CC' + env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') + env['SHCFLAGS'] = SCons.Util.CLVar('$CFLAGS') + env['SHCCCOM'] = '$SHCC -WD $SHCFLAGS $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o$TARGET $SOURCES' + env['CPPDEFPREFIX'] = '-D' + env['CPPDEFSUFFIX'] = '' + env['INCPREFIX'] = '-I' + env['INCSUFFIX'] = '' + env['SHOBJSUFFIX'] = '.dll' + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 0 + env['CFILESUFFIX'] = '.cpp' + +def exists(env): + return findIt('bcc32', env) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/c++.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/c++.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/c++.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/c++.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,99 @@ +"""SCons.Tool.c++ + +Tool-specific initialization for generic Posix C++ compilers. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/c++.py 2013/03/03 09:48:35 garyo" + +import os.path + +import SCons.Tool +import SCons.Defaults +import SCons.Util + +compilers = ['CC', 'c++'] + +CXXSuffixes = ['.cpp', '.cc', '.cxx', '.c++', '.C++', '.mm'] +if SCons.Util.case_sensitive_suffixes('.c', '.C'): + CXXSuffixes.append('.C') + +def iscplusplus(source): + if not source: + # Source might be None for unusual cases like SConf. + return 0 + for s in source: + if s.sources: + ext = os.path.splitext(str(s.sources[0]))[1] + if ext in CXXSuffixes: + return 1 + return 0 + +def generate(env): + """ + Add Builders and construction variables for Visual Age C++ compilers + to an Environment. + """ + import SCons.Tool + import SCons.Tool.cc + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in CXXSuffixes: + static_obj.add_action(suffix, SCons.Defaults.CXXAction) + shared_obj.add_action(suffix, SCons.Defaults.ShCXXAction) + static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) + shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter) + + SCons.Tool.cc.add_common_cc_variables(env) + + env['CXX'] = 'c++' + env['CXXFLAGS'] = SCons.Util.CLVar('') + env['CXXCOM'] = '$CXX -o $TARGET -c $CXXFLAGS $CCFLAGS $_CCCOMCOM $SOURCES' + env['SHCXX'] = '$CXX' + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') + env['SHCXXCOM'] = '$SHCXX -o $TARGET -c $SHCXXFLAGS $SHCCFLAGS $_CCCOMCOM $SOURCES' + + env['CPPDEFPREFIX'] = '-D' + env['CPPDEFSUFFIX'] = '' + env['INCPREFIX'] = '-I' + env['INCSUFFIX'] = '' + env['SHOBJSUFFIX'] = '.os' + env['OBJSUFFIX'] = '.o' + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 0 + + env['CXXFILESUFFIX'] = '.cc' + +def exists(env): + return env.Detect(compilers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/cc.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/cc.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/cc.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/cc.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,102 @@ +"""SCons.Tool.cc + +Tool-specific initialization for generic Posix C compilers. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/cc.py 2013/03/03 09:48:35 garyo" + +import SCons.Tool +import SCons.Defaults +import SCons.Util + +CSuffixes = ['.c', '.m'] +if not SCons.Util.case_sensitive_suffixes('.c', '.C'): + CSuffixes.append('.C') + +def add_common_cc_variables(env): + """ + Add underlying common "C compiler" variables that + are used by multiple tools (specifically, c++). + """ + if '_CCCOMCOM' not in env: + env['_CCCOMCOM'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS' + # It's a hack to test for darwin here, but the alternative + # of creating an applecc.py to contain this seems overkill. + # Maybe someday the Apple platform will require more setup and + # this logic will be moved. + env['FRAMEWORKS'] = SCons.Util.CLVar('') + env['FRAMEWORKPATH'] = SCons.Util.CLVar('') + if env['PLATFORM'] == 'darwin': + env['_CCCOMCOM'] = env['_CCCOMCOM'] + ' $_FRAMEWORKPATH' + + if 'CCFLAGS' not in env: + env['CCFLAGS'] = SCons.Util.CLVar('') + + if 'SHCCFLAGS' not in env: + env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') + +def generate(env): + """ + Add Builders and construction variables for C compilers to an Environment. + """ + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in CSuffixes: + static_obj.add_action(suffix, SCons.Defaults.CAction) + shared_obj.add_action(suffix, SCons.Defaults.ShCAction) + static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) + shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter) + + add_common_cc_variables(env) + + env['CC'] = 'cc' + env['CFLAGS'] = SCons.Util.CLVar('') + env['CCCOM'] = '$CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES' + env['SHCC'] = '$CC' + env['SHCFLAGS'] = SCons.Util.CLVar('$CFLAGS') + env['SHCCCOM'] = '$SHCC -o $TARGET -c $SHCFLAGS $SHCCFLAGS $_CCCOMCOM $SOURCES' + + env['CPPDEFPREFIX'] = '-D' + env['CPPDEFSUFFIX'] = '' + env['INCPREFIX'] = '-I' + env['INCSUFFIX'] = '' + env['SHOBJSUFFIX'] = '.os' + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 0 + + env['CFILESUFFIX'] = '.c' + +def exists(env): + return env.Detect('cc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/cvf.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/cvf.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/cvf.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/cvf.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,58 @@ +"""engine.SCons.Tool.cvf + +Tool-specific initialization for the Compaq Visual Fortran compiler. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/cvf.py 2013/03/03 09:48:35 garyo" + +import fortran + +compilers = ['f90'] + +def generate(env): + """Add Builders and construction variables for compaq visual fortran to an Environment.""" + + fortran.generate(env) + + env['FORTRAN'] = 'f90' + env['FORTRANCOM'] = '$FORTRAN $FORTRANFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:${TARGET.windows}' + env['FORTRANPPCOM'] = '$FORTRAN $FORTRANFLAGS $CPPFLAGS $_CPPDEFFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:${TARGET.windows}' + env['SHFORTRANCOM'] = '$SHFORTRAN $SHFORTRANFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:${TARGET.windows}' + env['SHFORTRANPPCOM'] = '$SHFORTRAN $SHFORTRANFLAGS $CPPFLAGS $_CPPDEFFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:${TARGET.windows}' + env['OBJSUFFIX'] = '.obj' + env['FORTRANMODDIR'] = '${TARGET.dir}' + env['FORTRANMODDIRPREFIX'] = '/module:' + env['FORTRANMODDIRSUFFIX'] = '' + +def exists(env): + return env.Detect(compilers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/default.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/default.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/default.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/default.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,50 @@ +"""SCons.Tool.default + +Initialization with a default tool list. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/default.py 2013/03/03 09:48:35 garyo" + +import SCons.Tool + +def generate(env): + """Add default tools.""" + for t in SCons.Tool.tool_list(env['PLATFORM'], env): + SCons.Tool.Tool(t)(env) + +def exists(env): + return 1 + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/dmd.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/dmd.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/dmd.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/dmd.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,240 @@ +"""SCons.Tool.dmd + +Tool-specific initialization for the Digital Mars D compiler. +(http://digitalmars.com/d) + +Coded by Andy Friesen (andy@ikagames.com) +15 November 2003 + +Amended by Russel Winder (russel@russel.org.uk) +2010-02-07 + +There are a number of problems with this script at this point in time. +The one that irritates me the most is the Windows linker setup. The D +linker doesn't have a way to add lib paths on the commandline, as far +as I can see. You have to specify paths relative to the SConscript or +use absolute paths. To hack around it, add '#/blah'. This will link +blah.lib from the directory where SConstruct resides. + +Compiler variables: + DC - The name of the D compiler to use. Defaults to dmd or gdmd, + whichever is found. + DPATH - List of paths to search for import modules. + DVERSIONS - List of version tags to enable when compiling. + DDEBUG - List of debug tags to enable when compiling. + +Linker related variables: + LIBS - List of library files to link in. + DLINK - Name of the linker to use. Defaults to dmd or gdmd. + DLINKFLAGS - List of linker flags. + +Lib tool variables: + DLIB - Name of the lib tool to use. Defaults to lib. + DLIBFLAGS - List of flags to pass to the lib tool. + LIBS - Same as for the linker. (libraries to pull into the .lib) +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/dmd.py 2013/03/03 09:48:35 garyo" + +import os + +import SCons.Action +import SCons.Builder +import SCons.Defaults +import SCons.Scanner.D +import SCons.Tool + +# Adapted from c++.py +def isD(source): + if not source: + return 0 + + for s in source: + if s.sources: + ext = os.path.splitext(str(s.sources[0]))[1] + if ext == '.d': + return 1 + return 0 + +smart_link = {} + +smart_lib = {} + +def generate(env): + global smart_link + global smart_lib + + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + DAction = SCons.Action.Action('$DCOM', '$DCOMSTR') + + static_obj.add_action('.d', DAction) + shared_obj.add_action('.d', DAction) + static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter) + shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter) + + dc = env.Detect(['dmd', 'gdmd']) + env['DC'] = dc + env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -of$TARGET $SOURCES' + env['_DINCFLAGS'] = '$( ${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['_DVERFLAGS'] = '$( ${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)} $)' + env['_DDEBUGFLAGS'] = '$( ${_concat(DDEBUGPREFIX, DDEBUG, DDEBUGSUFFIX, __env__)} $)' + env['_DFLAGS'] = '$( ${_concat(DFLAGPREFIX, DFLAGS, DFLAGSUFFIX, __env__)} $)' + + env['DPATH'] = ['#/'] + env['DFLAGS'] = [] + env['DVERSIONS'] = [] + env['DDEBUG'] = [] + + if dc: + # Add the path to the standard library. + # This is merely for the convenience of the dependency scanner. + dmd_path = env.WhereIs(dc) + if dmd_path: + x = dmd_path.rindex(dc) + phobosDir = dmd_path[:x] + '/../src/phobos' + if os.path.isdir(phobosDir): + env.Append(DPATH = [phobosDir]) + + env['DINCPREFIX'] = '-I' + env['DINCSUFFIX'] = '' + env['DVERPREFIX'] = '-version=' + env['DVERSUFFIX'] = '' + env['DDEBUGPREFIX'] = '-debug=' + env['DDEBUGSUFFIX'] = '' + env['DFLAGPREFIX'] = '-' + env['DFLAGSUFFIX'] = '' + env['DFILESUFFIX'] = '.d' + + # Need to use the Digital Mars linker/lib on windows. + # *nix can just use GNU link. + if env['PLATFORM'] == 'win32': + env['DLINK'] = '$DC' + env['DLINKCOM'] = '$DLINK -of$TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' + env['DLIB'] = 'lib' + env['DLIBCOM'] = '$DLIB $_DLIBFLAGS -c $TARGET $SOURCES $_DLINKLIBFLAGS' + + env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' + env['DLINKFLAGS'] = [] + env['DLIBLINKPREFIX'] = '' + env['DLIBLINKSUFFIX'] = '.lib' + env['DLIBFLAGPREFIX'] = '-' + env['DLIBFLAGSUFFIX'] = '' + env['DLINKFLAGPREFIX'] = '-' + env['DLINKFLAGSUFFIX'] = '' + + SCons.Tool.createStaticLibBuilder(env) + + # Basically, we hijack the link and ar builders with our own. + # these builders check for the presence of D source, and swap out + # the system's defaults for the Digital Mars tools. If there's no D + # source, then we silently return the previous settings. + linkcom = env.get('LINKCOM') + try: + env['SMART_LINKCOM'] = smart_link[linkcom] + except KeyError: + def _smartLink(source, target, env, for_signature, + defaultLinker=linkcom): + if isD(source): + # XXX I'm not sure how to add a $DLINKCOMSTR variable + # so that it works with this _smartLink() logic, + # and I don't have a D compiler/linker to try it out, + # so we'll leave it alone for now. + return '$DLINKCOM' + else: + return defaultLinker + env['SMART_LINKCOM'] = smart_link[linkcom] = _smartLink + + arcom = env.get('ARCOM') + try: + env['SMART_ARCOM'] = smart_lib[arcom] + except KeyError: + def _smartLib(source, target, env, for_signature, + defaultLib=arcom): + if isD(source): + # XXX I'm not sure how to add a $DLIBCOMSTR variable + # so that it works with this _smartLib() logic, and + # I don't have a D compiler/archiver to try it out, + # so we'll leave it alone for now. + return '$DLIBCOM' + else: + return defaultLib + env['SMART_ARCOM'] = smart_lib[arcom] = _smartLib + + # It is worth noting that the final space in these strings is + # absolutely pivotal. SCons sees these as actions and not generators + # if it is not there. (very bad) + env['ARCOM'] = '$SMART_ARCOM ' + env['LINKCOM'] = '$SMART_LINKCOM ' + else: # assuming linux + linkcom = env.get('LINKCOM') + try: + env['SMART_LINKCOM'] = smart_link[linkcom] + except KeyError: + def _smartLink(source, target, env, for_signature, + defaultLinker=linkcom, dc=dc): + if isD(source): + try: + libs = env['LIBS'] + except KeyError: + libs = [] + if dc == 'dmd': + # TODO: This assumes that the dmd executable is in the + # bin directory and that the libraries are in a peer + # directory lib. This true of the Digital Mars + # distribution but . . . + import glob + dHome = env.WhereIs(dc).replace('/dmd' , '/..') + if glob.glob(dHome + '/lib/*phobos2*'): + if 'phobos2' not in libs: + env.Append(LIBPATH = [dHome + '/lib']) + env.Append(LIBS = ['phobos2']) + # TODO: Find out when there will be a + # 64-bit version of D. + env.Append(LINKFLAGS = ['-m32']) + else: + if 'phobos' not in libs: + env.Append(LIBS = ['phobos']) + elif dc is 'gdmd': + env.Append(LIBS = ['gphobos']) + if 'pthread' not in libs: + env.Append(LIBS = ['pthread']) + if 'm' not in libs: + env.Append(LIBS = ['m']) + return defaultLinker + env['SMART_LINKCOM'] = smart_link[linkcom] = _smartLink + + env['LINKCOM'] = '$SMART_LINKCOM ' + +def exists(env): + return env.Detect(['dmd', 'gdmd']) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/dvi.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/dvi.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/dvi.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/dvi.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,64 @@ +"""SCons.Tool.dvi + +Common DVI Builder definition for various other Tool modules that use it. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/dvi.py 2013/03/03 09:48:35 garyo" + +import SCons.Builder +import SCons.Tool + +DVIBuilder = None + +def generate(env): + try: + env['BUILDERS']['DVI'] + except KeyError: + global DVIBuilder + + if DVIBuilder is None: + # The suffix is hard-coded to '.dvi', not configurable via a + # construction variable like $DVISUFFIX, because the output + # file name is hard-coded within TeX. + DVIBuilder = SCons.Builder.Builder(action = {}, + source_scanner = SCons.Tool.LaTeXScanner, + suffix = '.dvi', + emitter = {}, + source_ext_match = None) + + env['BUILDERS']['DVI'] = DVIBuilder + +def exists(env): + # This only puts a skeleton Builder in place, so if someone + # references this Tool directly, it's always "available." + return 1 + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/dvipdf.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/dvipdf.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/dvipdf.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/dvipdf.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,125 @@ +"""SCons.Tool.dvipdf + +Tool-specific initialization for dvipdf. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/dvipdf.py 2013/03/03 09:48:35 garyo" + +import SCons.Action +import SCons.Defaults +import SCons.Tool.pdf +import SCons.Tool.tex +import SCons.Util + +_null = SCons.Scanner.LaTeX._null + +def DviPdfPsFunction(XXXDviAction, target = None, source= None, env=None): + """A builder for DVI files that sets the TEXPICTS environment + variable before running dvi2ps or dvipdf.""" + + try: + abspath = source[0].attributes.path + except AttributeError : + abspath = '' + + saved_env = SCons.Scanner.LaTeX.modify_env_var(env, 'TEXPICTS', abspath) + + result = XXXDviAction(target, source, env) + + if saved_env is _null: + try: + del env['ENV']['TEXPICTS'] + except KeyError: + pass # was never set + else: + env['ENV']['TEXPICTS'] = saved_env + + return result + +def DviPdfFunction(target = None, source= None, env=None): + result = DviPdfPsFunction(PDFAction,target,source,env) + return result + +def DviPdfStrFunction(target = None, source= None, env=None): + """A strfunction for dvipdf that returns the appropriate + command string for the no_exec options.""" + if env.GetOption("no_exec"): + result = env.subst('$DVIPDFCOM',0,target,source) + else: + result = '' + return result + +PDFAction = None +DVIPDFAction = None + +def PDFEmitter(target, source, env): + """Strips any .aux or .log files from the input source list. + These are created by the TeX Builder that in all likelihood was + used to generate the .dvi file we're using as input, and we only + care about the .dvi file. + """ + def strip_suffixes(n): + return not SCons.Util.splitext(str(n))[1] in ['.aux', '.log'] + source = list(filter(strip_suffixes, source)) + return (target, source) + +def generate(env): + """Add Builders and construction variables for dvipdf to an Environment.""" + global PDFAction + if PDFAction is None: + PDFAction = SCons.Action.Action('$DVIPDFCOM', '$DVIPDFCOMSTR') + + global DVIPDFAction + if DVIPDFAction is None: + DVIPDFAction = SCons.Action.Action(DviPdfFunction, strfunction = DviPdfStrFunction) + + import pdf + pdf.generate(env) + + bld = env['BUILDERS']['PDF'] + bld.add_action('.dvi', DVIPDFAction) + bld.add_emitter('.dvi', PDFEmitter) + + env['DVIPDF'] = 'dvipdf' + env['DVIPDFFLAGS'] = SCons.Util.CLVar('') + env['DVIPDFCOM'] = 'cd ${TARGET.dir} && $DVIPDF $DVIPDFFLAGS ${SOURCE.file} ${TARGET.file}' + + # Deprecated synonym. + env['PDFCOM'] = ['$DVIPDFCOM'] + +def exists(env): + SCons.Tool.tex.generate_darwin(env) + return env.Detect('dvipdf') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/dvips.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/dvips.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/dvips.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/dvips.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,95 @@ +"""SCons.Tool.dvips + +Tool-specific initialization for dvips. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/dvips.py 2013/03/03 09:48:35 garyo" + +import SCons.Action +import SCons.Builder +import SCons.Tool.dvipdf +import SCons.Util + +def DviPsFunction(target = None, source= None, env=None): + result = SCons.Tool.dvipdf.DviPdfPsFunction(PSAction,target,source,env) + return result + +def DviPsStrFunction(target = None, source= None, env=None): + """A strfunction for dvipdf that returns the appropriate + command string for the no_exec options.""" + if env.GetOption("no_exec"): + result = env.subst('$PSCOM',0,target,source) + else: + result = '' + return result + +PSAction = None +DVIPSAction = None +PSBuilder = None + +def generate(env): + """Add Builders and construction variables for dvips to an Environment.""" + global PSAction + if PSAction is None: + PSAction = SCons.Action.Action('$PSCOM', '$PSCOMSTR') + + global DVIPSAction + if DVIPSAction is None: + DVIPSAction = SCons.Action.Action(DviPsFunction, strfunction = DviPsStrFunction) + + global PSBuilder + if PSBuilder is None: + PSBuilder = SCons.Builder.Builder(action = PSAction, + prefix = '$PSPREFIX', + suffix = '$PSSUFFIX', + src_suffix = '.dvi', + src_builder = 'DVI', + single_source=True) + + env['BUILDERS']['PostScript'] = PSBuilder + + env['DVIPS'] = 'dvips' + env['DVIPSFLAGS'] = SCons.Util.CLVar('') + # I'm not quite sure I got the directories and filenames right for variant_dir + # We need to be in the correct directory for the sake of latex \includegraphics eps included files. + env['PSCOM'] = 'cd ${TARGET.dir} && $DVIPS $DVIPSFLAGS -o ${TARGET.file} ${SOURCE.file}' + env['PSPREFIX'] = '' + env['PSSUFFIX'] = '.ps' + +def exists(env): + SCons.Tool.tex.generate_darwin(env) + return env.Detect('dvips') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/f03.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/f03.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/f03.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/f03.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,63 @@ +"""engine.SCons.Tool.f03 + +Tool-specific initialization for the generic Posix f03 Fortran compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/f03.py 2013/03/03 09:48:35 garyo" + +import SCons.Defaults +import SCons.Tool +import SCons.Util +import fortran +from SCons.Tool.FortranCommon import add_all_to_env, add_f03_to_env + +compilers = ['f03'] + +def generate(env): + add_all_to_env(env) + add_f03_to_env(env) + + fcomp = env.Detect(compilers) or 'f03' + env['F03'] = fcomp + env['SHF03'] = fcomp + + env['FORTRAN'] = fcomp + env['SHFORTRAN'] = fcomp + + +def exists(env): + return env.Detect(compilers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/f77.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/f77.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/f77.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/f77.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,62 @@ +"""engine.SCons.Tool.f77 + +Tool-specific initialization for the generic Posix f77 Fortran compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/f77.py 2013/03/03 09:48:35 garyo" + +import SCons.Defaults +import SCons.Scanner.Fortran +import SCons.Tool +import SCons.Util +from SCons.Tool.FortranCommon import add_all_to_env, add_f77_to_env + +compilers = ['f77'] + +def generate(env): + add_all_to_env(env) + add_f77_to_env(env) + + fcomp = env.Detect(compilers) or 'f77' + env['F77'] = fcomp + env['SHF77'] = fcomp + + env['FORTRAN'] = fcomp + env['SHFORTRAN'] = fcomp + +def exists(env): + return env.Detect(compilers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/f90.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/f90.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/f90.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/f90.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,62 @@ +"""engine.SCons.Tool.f90 + +Tool-specific initialization for the generic Posix f90 Fortran compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/f90.py 2013/03/03 09:48:35 garyo" + +import SCons.Defaults +import SCons.Scanner.Fortran +import SCons.Tool +import SCons.Util +from SCons.Tool.FortranCommon import add_all_to_env, add_f90_to_env + +compilers = ['f90'] + +def generate(env): + add_all_to_env(env) + add_f90_to_env(env) + + fc = env.Detect(compilers) or 'f90' + env['F90'] = fc + env['SHF90'] = fc + + env['FORTRAN'] = fc + env['SHFORTRAN'] = fc + +def exists(env): + return env.Detect(compilers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/f95.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/f95.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/f95.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/f95.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,63 @@ +"""engine.SCons.Tool.f95 + +Tool-specific initialization for the generic Posix f95 Fortran compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/f95.py 2013/03/03 09:48:35 garyo" + +import SCons.Defaults +import SCons.Tool +import SCons.Util +import fortran +from SCons.Tool.FortranCommon import add_all_to_env, add_f95_to_env + +compilers = ['f95'] + +def generate(env): + add_all_to_env(env) + add_f95_to_env(env) + + fcomp = env.Detect(compilers) or 'f95' + env['F95'] = fcomp + env['SHF95'] = fcomp + + env['FORTRAN'] = fcomp + env['SHFORTRAN'] = fcomp + + +def exists(env): + return env.Detect(compilers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/filesystem.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/filesystem.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/filesystem.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/filesystem.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,98 @@ +"""SCons.Tool.filesystem + +Tool-specific initialization for the filesystem tools. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/filesystem.py 2013/03/03 09:48:35 garyo" + +import SCons +from SCons.Tool.install import copyFunc + +copyToBuilder, copyAsBuilder = None, None + +def copyto_emitter(target, source, env): + """ changes the path of the source to be under the target (which + are assumed to be directories. + """ + n_target = [] + + for t in target: + n_target = n_target + [t.File( str( s ) ) for s in source] + + return (n_target, source) + +def copy_action_func(target, source, env): + assert( len(target) == len(source) ), "\ntarget: %s\nsource: %s" %(list(map(str, target)),list(map(str, source))) + + for t, s in zip(target, source): + if copyFunc(t.get_path(), s.get_path(), env): + return 1 + + return 0 + +def copy_action_str(target, source, env): + return env.subst_target_source(env['COPYSTR'], 0, target, source) + +copy_action = SCons.Action.Action( copy_action_func, copy_action_str ) + +def generate(env): + try: + env['BUILDERS']['CopyTo'] + env['BUILDERS']['CopyAs'] + except KeyError, e: + global copyToBuilder + if copyToBuilder is None: + copyToBuilder = SCons.Builder.Builder( + action = copy_action, + target_factory = env.fs.Dir, + source_factory = env.fs.Entry, + multi = 1, + emitter = [ copyto_emitter, ] ) + + global copyAsBuilder + if copyAsBuilder is None: + copyAsBuilder = SCons.Builder.Builder( + action = copy_action, + target_factory = env.fs.Entry, + source_factory = env.fs.Entry ) + + env['BUILDERS']['CopyTo'] = copyToBuilder + env['BUILDERS']['CopyAs'] = copyAsBuilder + + env['COPYSTR'] = 'Copy file(s): "$SOURCES" to "$TARGETS"' + +def exists(env): + return 1 + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/fortran.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/fortran.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/fortran.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/fortran.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,62 @@ +"""SCons.Tool.fortran + +Tool-specific initialization for a generic Posix f77/f90 Fortran compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/fortran.py 2013/03/03 09:48:35 garyo" + +import re + +import SCons.Action +import SCons.Defaults +import SCons.Scanner.Fortran +import SCons.Tool +import SCons.Util +from SCons.Tool.FortranCommon import add_all_to_env, add_fortran_to_env + +compilers = ['f95', 'f90', 'f77'] + +def generate(env): + add_all_to_env(env) + add_fortran_to_env(env) + + fc = env.Detect(compilers) or 'f77' + env['SHFORTRAN'] = fc + env['FORTRAN'] = fc + +def exists(env): + return env.Detect(compilers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/g++.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/g++.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/g++.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/g++.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,90 @@ +"""SCons.Tool.g++ + +Tool-specific initialization for g++. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/g++.py 2013/03/03 09:48:35 garyo" + +import os.path +import re +import subprocess + +import SCons.Tool +import SCons.Util + +cplusplus = __import__('c++', globals(), locals(), []) + +compilers = ['g++'] + +def generate(env): + """Add Builders and construction variables for g++ to an Environment.""" + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + cplusplus.generate(env) + + env['CXX'] = env.Detect(compilers) + + # platform specific settings + if env['PLATFORM'] == 'aix': + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS -mminimal-toc') + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 + env['SHOBJSUFFIX'] = '$OBJSUFFIX' + elif env['PLATFORM'] == 'hpux': + env['SHOBJSUFFIX'] = '.pic.o' + elif env['PLATFORM'] == 'sunos': + env['SHOBJSUFFIX'] = '.pic.o' + # determine compiler version + if env['CXX']: + #pipe = SCons.Action._subproc(env, [env['CXX'], '-dumpversion'], + pipe = SCons.Action._subproc(env, [env['CXX'], '--version'], + stdin = 'devnull', + stderr = 'devnull', + stdout = subprocess.PIPE) + if pipe.wait() != 0: return + # -dumpversion was added in GCC 3.0. As long as we're supporting + # GCC versions older than that, we should use --version and a + # regular expression. + #line = pipe.stdout.read().strip() + #if line: + # env['CXXVERSION'] = line + line = pipe.stdout.readline() + match = re.search(r'[0-9]+(\.[0-9]+)+', line) + if match: + env['CXXVERSION'] = match.group(0) + +def exists(env): + return env.Detect(compilers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/g77.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/g77.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/g77.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/g77.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,73 @@ +"""engine.SCons.Tool.g77 + +Tool-specific initialization for g77. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/g77.py 2013/03/03 09:48:35 garyo" + +import SCons.Util +from SCons.Tool.FortranCommon import add_all_to_env, add_f77_to_env + +compilers = ['g77', 'f77'] + +def generate(env): + """Add Builders and construction variables for g77 to an Environment.""" + add_all_to_env(env) + add_f77_to_env(env) + + fcomp = env.Detect(compilers) or 'g77' + if env['PLATFORM'] in ['cygwin', 'win32']: + env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS') + env['SHF77FLAGS'] = SCons.Util.CLVar('$F77FLAGS') + else: + env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS -fPIC') + env['SHF77FLAGS'] = SCons.Util.CLVar('$F77FLAGS -fPIC') + + env['FORTRAN'] = fcomp + env['SHFORTRAN'] = '$FORTRAN' + + env['F77'] = fcomp + env['SHF77'] = '$F77' + + env['INCFORTRANPREFIX'] = "-I" + env['INCFORTRANSUFFIX'] = "" + + env['INCF77PREFIX'] = "-I" + env['INCF77SUFFIX'] = "" + +def exists(env): + return env.Detect(compilers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/gas.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/gas.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/gas.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/gas.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,53 @@ +"""SCons.Tool.gas + +Tool-specific initialization for as, the Gnu assembler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/gas.py 2013/03/03 09:48:35 garyo" + +as_module = __import__('as', globals(), locals(), []) + +assemblers = ['as', 'gas'] + +def generate(env): + """Add Builders and construction variables for as to an Environment.""" + as_module.generate(env) + + env['AS'] = env.Detect(assemblers) or 'as' + +def exists(env): + return env.Detect(assemblers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/gcc.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/gcc.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/gcc.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/gcc.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,80 @@ +"""SCons.Tool.gcc + +Tool-specific initialization for gcc. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/gcc.py 2013/03/03 09:48:35 garyo" + +import cc +import os +import re +import subprocess + +import SCons.Util + +compilers = ['gcc', 'cc'] + +def generate(env): + """Add Builders and construction variables for gcc to an Environment.""" + cc.generate(env) + + env['CC'] = env.Detect(compilers) or 'gcc' + if env['PLATFORM'] in ['cygwin', 'win32']: + env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') + else: + env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS -fPIC') + # determine compiler version + if env['CC']: + #pipe = SCons.Action._subproc(env, [env['CC'], '-dumpversion'], + pipe = SCons.Action._subproc(env, [env['CC'], '--version'], + stdin = 'devnull', + stderr = 'devnull', + stdout = subprocess.PIPE) + if pipe.wait() != 0: return + # -dumpversion was added in GCC 3.0. As long as we're supporting + # GCC versions older than that, we should use --version and a + # regular expression. + #line = pipe.stdout.read().strip() + #if line: + # env['CCVERSION'] = line + line = pipe.stdout.readline() + match = re.search(r'[0-9]+(\.[0-9]+)+', line) + if match: + env['CCVERSION'] = match.group(0) + +def exists(env): + return env.Detect(compilers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/gettext.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/gettext.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/gettext.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/gettext.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,48 @@ +"""gettext tool +""" + + +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/gettext.py 2013/03/03 09:48:35 garyo" + +############################################################################# +def generate(env,**kw): + import SCons.Tool + from SCons.Tool.GettextCommon \ + import _translate, tool_list + for t in tool_list(env['PLATFORM'], env): + env.Tool(t) + env.AddMethod(_translate, 'Translate') +############################################################################# + +############################################################################# +def exists(env): + from SCons.Tool.GettextCommon \ + import _xgettext_exists, _msginit_exists, \ + _msgmerge_exists, _msgfmt_exists + try: + return _xgettext_exists(env) and _msginit_exists(env) \ + and _msgmerge_exists(env) and _msgfmt_exists(env) + except: + return False +############################################################################# diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/gfortran.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/gfortran.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/gfortran.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/gfortran.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,64 @@ +"""SCons.Tool.gfortran + +Tool-specific initialization for gfortran, the GNU Fortran 95/Fortran +2003 compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/gfortran.py 2013/03/03 09:48:35 garyo" + +import SCons.Util + +import fortran + +def generate(env): + """Add Builders and construction variables for gfortran to an + Environment.""" + fortran.generate(env) + + for dialect in ['F77', 'F90', 'FORTRAN', 'F95', 'F03']: + env['%s' % dialect] = 'gfortran' + env['SH%s' % dialect] = '$%s' % dialect + if env['PLATFORM'] in ['cygwin', 'win32']: + env['SH%sFLAGS' % dialect] = SCons.Util.CLVar('$%sFLAGS' % dialect) + else: + env['SH%sFLAGS' % dialect] = SCons.Util.CLVar('$%sFLAGS -fPIC' % dialect) + + env['INC%sPREFIX' % dialect] = "-I" + env['INC%sSUFFIX' % dialect] = "" + +def exists(env): + return env.Detect('gfortran') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/gnulink.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/gnulink.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/gnulink.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/gnulink.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,62 @@ +"""SCons.Tool.gnulink + +Tool-specific initialization for the gnu linker. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/gnulink.py 2013/03/03 09:48:35 garyo" + +import SCons.Util + +import link + +linkers = ['g++', 'gcc'] + +def generate(env): + """Add Builders and construction variables for gnulink to an Environment.""" + link.generate(env) + + if env['PLATFORM'] == 'hpux': + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared -fPIC') + + # __RPATH is set to $_RPATH in the platform specification if that + # platform supports it. + env['RPATHPREFIX'] = '-Wl,-rpath=' + env['RPATHSUFFIX'] = '' + env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}' + +def exists(env): + return env.Detect(linkers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/gs.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/gs.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/gs.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/gs.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,81 @@ +"""SCons.Tool.gs + +Tool-specific initialization for Ghostscript. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/gs.py 2013/03/03 09:48:35 garyo" + +import SCons.Action +import SCons.Platform +import SCons.Util + +# Ghostscript goes by different names on different platforms... +platform = SCons.Platform.platform_default() + +if platform == 'os2': + gs = 'gsos2' +elif platform == 'win32': + gs = 'gswin32c' +else: + gs = 'gs' + +GhostscriptAction = None + +def generate(env): + """Add Builders and construction variables for Ghostscript to an + Environment.""" + + global GhostscriptAction + if GhostscriptAction is None: + GhostscriptAction = SCons.Action.Action('$GSCOM', '$GSCOMSTR') + + import pdf + pdf.generate(env) + + bld = env['BUILDERS']['PDF'] + bld.add_action('.ps', GhostscriptAction) + + env['GS'] = gs + env['GSFLAGS'] = SCons.Util.CLVar('-dNOPAUSE -dBATCH -sDEVICE=pdfwrite') + env['GSCOM'] = '$GS $GSFLAGS -sOutputFile=$TARGET $SOURCES' + + +def exists(env): + if 'PS2PDF' in env: + return env.Detect(env['PS2PDF']) + else: + return env.Detect(gs) or SCons.Util.WhereIs(gs) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/hpc++.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/hpc++.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/hpc++.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/hpc++.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,84 @@ +"""SCons.Tool.hpc++ + +Tool-specific initialization for c++ on HP/UX. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/hpc++.py 2013/03/03 09:48:35 garyo" + +import os.path + +import SCons.Util + +cplusplus = __import__('c++', globals(), locals(), []) + +acc = None + +# search for the acc compiler and linker front end + +try: + dirs = os.listdir('/opt') +except (IOError, OSError): + # Not being able to read the directory because it doesn't exist + # (IOError) or isn't readable (OSError) is okay. + dirs = [] + +for dir in dirs: + cc = '/opt/' + dir + '/bin/aCC' + if os.path.exists(cc): + acc = cc + break + + +def generate(env): + """Add Builders and construction variables for g++ to an Environment.""" + cplusplus.generate(env) + + if acc: + env['CXX'] = acc or 'aCC' + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS +Z') + # determine version of aCC + line = os.popen(acc + ' -V 2>&1').readline().rstrip() + if line.find('aCC: HP ANSI C++') == 0: + env['CXXVERSION'] = line.split()[-1] + + if env['PLATFORM'] == 'cygwin': + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') + else: + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS +Z') + +def exists(env): + return acc + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/hpcc.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/hpcc.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/hpcc.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/hpcc.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,53 @@ +"""SCons.Tool.hpcc + +Tool-specific initialization for HP aCC and cc. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/hpcc.py 2013/03/03 09:48:35 garyo" + +import SCons.Util + +import cc + +def generate(env): + """Add Builders and construction variables for aCC & cc to an Environment.""" + cc.generate(env) + + env['CXX'] = 'aCC' + env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS +Z') + +def exists(env): + return env.Detect('aCC') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/hplink.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/hplink.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/hplink.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/hplink.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,77 @@ +"""SCons.Tool.hplink + +Tool-specific initialization for the HP linker. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/hplink.py 2013/03/03 09:48:35 garyo" + +import os +import os.path + +import SCons.Util + +import link + +ccLinker = None + +# search for the acc compiler and linker front end + +try: + dirs = os.listdir('/opt') +except (IOError, OSError): + # Not being able to read the directory because it doesn't exist + # (IOError) or isn't readable (OSError) is okay. + dirs = [] + +for dir in dirs: + linker = '/opt/' + dir + '/bin/aCC' + if os.path.exists(linker): + ccLinker = linker + break + +def generate(env): + """ + Add Builders and construction variables for Visual Age linker to + an Environment. + """ + link.generate(env) + + env['LINKFLAGS'] = SCons.Util.CLVar('-Wl,+s -Wl,+vnocompatwarnings') + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -b') + env['SHLIBSUFFIX'] = '.sl' + +def exists(env): + return ccLinker + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/icc.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/icc.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/icc.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/icc.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,59 @@ +"""engine.SCons.Tool.icc + +Tool-specific initialization for the OS/2 icc compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/icc.py 2013/03/03 09:48:35 garyo" + +import cc + +def generate(env): + """Add Builders and construction variables for the OS/2 to an Environment.""" + cc.generate(env) + + env['CC'] = 'icc' + env['CCCOM'] = '$CC $CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET' + env['CXXCOM'] = '$CXX $CXXFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET' + env['CPPDEFPREFIX'] = '/D' + env['CPPDEFSUFFIX'] = '' + env['INCPREFIX'] = '/I' + env['INCSUFFIX'] = '' + env['CFILESUFFIX'] = '.c' + env['CXXFILESUFFIX'] = '.cc' + +def exists(env): + return env.Detect('icc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/icl.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/icl.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/icl.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/icl.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,52 @@ +"""engine.SCons.Tool.icl + +Tool-specific initialization for the Intel C/C++ compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/icl.py 2013/03/03 09:48:35 garyo" + +import SCons.Tool.intelc + +# This has been completely superceded by intelc.py, which can +# handle both Windows and Linux versions. + +def generate(*args, **kw): + """Add Builders and construction variables for icl to an Environment.""" + return SCons.Tool.intelc.generate(*args, **kw) + +def exists(*args, **kw): + return SCons.Tool.intelc.exists(*args, **kw) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/ifl.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/ifl.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/ifl.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/ifl.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,72 @@ +"""SCons.Tool.ifl + +Tool-specific initialization for the Intel Fortran compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/ifl.py 2013/03/03 09:48:35 garyo" + +import SCons.Defaults +from SCons.Scanner.Fortran import FortranScan +from FortranCommon import add_all_to_env + +def generate(env): + """Add Builders and construction variables for ifl to an Environment.""" + fscan = FortranScan("FORTRANPATH") + SCons.Tool.SourceFileScanner.add_scanner('.i', fscan) + SCons.Tool.SourceFileScanner.add_scanner('.i90', fscan) + + if 'FORTRANFILESUFFIXES' not in env: + env['FORTRANFILESUFFIXES'] = ['.i'] + else: + env['FORTRANFILESUFFIXES'].append('.i') + + if 'F90FILESUFFIXES' not in env: + env['F90FILESUFFIXES'] = ['.i90'] + else: + env['F90FILESUFFIXES'].append('.i90') + + add_all_to_env(env) + + env['FORTRAN'] = 'ifl' + env['SHFORTRAN'] = '$FORTRAN' + env['FORTRANCOM'] = '$FORTRAN $FORTRANFLAGS $_FORTRANINCFLAGS /c $SOURCES /Fo$TARGET' + env['FORTRANPPCOM'] = '$FORTRAN $FORTRANFLAGS $CPPFLAGS $_CPPDEFFLAGS $_FORTRANINCFLAGS /c $SOURCES /Fo$TARGET' + env['SHFORTRANCOM'] = '$SHFORTRAN $SHFORTRANFLAGS $_FORTRANINCFLAGS /c $SOURCES /Fo$TARGET' + env['SHFORTRANPPCOM'] = '$SHFORTRAN $SHFORTRANFLAGS $CPPFLAGS $_CPPDEFFLAGS $_FORTRANINCFLAGS /c $SOURCES /Fo$TARGET' + +def exists(env): + return env.Detect('ifl') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/ifort.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/ifort.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/ifort.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/ifort.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,88 @@ +"""SCons.Tool.ifort + +Tool-specific initialization for newer versions of the Intel Fortran Compiler +for Linux/Windows (and possibly Mac OS X). + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/ifort.py 2013/03/03 09:48:35 garyo" + +import SCons.Defaults +from SCons.Scanner.Fortran import FortranScan +from FortranCommon import add_all_to_env + +def generate(env): + """Add Builders and construction variables for ifort to an Environment.""" + # ifort supports Fortran 90 and Fortran 95 + # Additionally, ifort recognizes more file extensions. + fscan = FortranScan("FORTRANPATH") + SCons.Tool.SourceFileScanner.add_scanner('.i', fscan) + SCons.Tool.SourceFileScanner.add_scanner('.i90', fscan) + + if 'FORTRANFILESUFFIXES' not in env: + env['FORTRANFILESUFFIXES'] = ['.i'] + else: + env['FORTRANFILESUFFIXES'].append('.i') + + if 'F90FILESUFFIXES' not in env: + env['F90FILESUFFIXES'] = ['.i90'] + else: + env['F90FILESUFFIXES'].append('.i90') + + add_all_to_env(env) + + fc = 'ifort' + + for dialect in ['F77', 'F90', 'FORTRAN', 'F95']: + env['%s' % dialect] = fc + env['SH%s' % dialect] = '$%s' % dialect + if env['PLATFORM'] == 'posix': + env['SH%sFLAGS' % dialect] = SCons.Util.CLVar('$%sFLAGS -fPIC' % dialect) + + if env['PLATFORM'] == 'win32': + # On Windows, the ifort compiler specifies the object on the + # command line with -object:, not -o. Massage the necessary + # command-line construction variables. + for dialect in ['F77', 'F90', 'FORTRAN', 'F95']: + for var in ['%sCOM' % dialect, '%sPPCOM' % dialect, + 'SH%sCOM' % dialect, 'SH%sPPCOM' % dialect]: + env[var] = env[var].replace('-o $TARGET', '-object:$TARGET') + env['FORTRANMODDIRPREFIX'] = "/module:" + else: + env['FORTRANMODDIRPREFIX'] = "-module " + +def exists(env): + return env.Detect('ifort') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/ilink.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/ilink.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/ilink.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/ilink.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,59 @@ +"""SCons.Tool.ilink + +Tool-specific initialization for the OS/2 ilink linker. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/ilink.py 2013/03/03 09:48:35 garyo" + +import SCons.Defaults +import SCons.Tool +import SCons.Util + +def generate(env): + """Add Builders and construction variables for ilink to an Environment.""" + SCons.Tool.createProgBuilder(env) + + env['LINK'] = 'ilink' + env['LINKFLAGS'] = SCons.Util.CLVar('') + env['LINKCOM'] = '$LINK $LINKFLAGS /O:$TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' + env['LIBDIRPREFIX']='/LIBPATH:' + env['LIBDIRSUFFIX']='' + env['LIBLINKPREFIX']='' + env['LIBLINKSUFFIX']='$LIBSUFFIX' + +def exists(env): + return env.Detect('ilink') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/ilink32.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/ilink32.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/ilink32.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/ilink32.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,60 @@ +"""SCons.Tool.ilink32 + +XXX + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/ilink32.py 2013/03/03 09:48:35 garyo" + +import SCons.Tool +import SCons.Tool.bcc32 +import SCons.Util + +def generate(env): + """Add Builders and construction variables for Borland ilink to an + Environment.""" + SCons.Tool.createSharedLibBuilder(env) + SCons.Tool.createProgBuilder(env) + + env['LINK'] = '$CC' + env['LINKFLAGS'] = SCons.Util.CLVar('') + env['LINKCOM'] = '$LINK -q $LINKFLAGS -e$TARGET $SOURCES $LIBS' + env['LIBDIRPREFIX']='' + env['LIBDIRSUFFIX']='' + env['LIBLINKPREFIX']='' + env['LIBLINKSUFFIX']='$LIBSUFFIX' + + +def exists(env): + # Uses bcc32 to do linking as it generally knows where the standard + # LIBS are and set up the linking correctly + return SCons.Tool.bcc32.findIt('bcc32', env) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/install.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/install.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/install.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/install.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,460 @@ +"""SCons.Tool.install + +Tool-specific initialization for the install tool. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/install.py 2013/03/03 09:48:35 garyo" + +import os +import re +import shutil +import stat + +import SCons.Action +from SCons.Util import make_path_relative + +# +# We keep track of *all* installed files. +_INSTALLED_FILES = [] +_UNIQUE_INSTALLED_FILES = None + +class CopytreeError(EnvironmentError): + pass + +# This is a patched version of shutil.copytree from python 2.5. It +# doesn't fail if the dir exists, which regular copytree does +# (annoyingly). Note the XXX comment in the docstring. +def scons_copytree(src, dst, symlinks=False): + """Recursively copy a directory tree using copy2(). + + The destination directory must not already exist. + If exception(s) occur, an CopytreeError is raised with a list of reasons. + + If the optional symlinks flag is true, symbolic links in the + source tree result in symbolic links in the destination tree; if + it is false, the contents of the files pointed to by symbolic + links are copied. + + XXX Consider this example code rather than the ultimate tool. + + """ + names = os.listdir(src) + # garyo@genarts.com fix: check for dir before making dirs. + if not os.path.exists(dst): + os.makedirs(dst) + errors = [] + for name in names: + srcname = os.path.join(src, name) + dstname = os.path.join(dst, name) + try: + if symlinks and os.path.islink(srcname): + linkto = os.readlink(srcname) + os.symlink(linkto, dstname) + elif os.path.isdir(srcname): + scons_copytree(srcname, dstname, symlinks) + else: + shutil.copy2(srcname, dstname) + # XXX What about devices, sockets etc.? + except (IOError, os.error), why: + errors.append((srcname, dstname, str(why))) + # catch the CopytreeError from the recursive copytree so that we can + # continue with other files + except CopytreeError, err: + errors.extend(err.args[0]) + try: + shutil.copystat(src, dst) + except WindowsError: + # can't copy file access times on Windows + pass + except OSError, why: + errors.extend((src, dst, str(why))) + if errors: + raise CopytreeError, errors + + +# +# Functions doing the actual work of the Install Builder. +# +def copyFunc(dest, source, env): + """Install a source file or directory into a destination by copying, + (including copying permission/mode bits).""" + + if os.path.isdir(source): + if os.path.exists(dest): + if not os.path.isdir(dest): + raise SCons.Errors.UserError("cannot overwrite non-directory `%s' with a directory `%s'" % (str(dest), str(source))) + else: + parent = os.path.split(dest)[0] + if not os.path.exists(parent): + os.makedirs(parent) + scons_copytree(source, dest) + else: + shutil.copy2(source, dest) + st = os.stat(source) + os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE) + + return 0 + +# +# Functions doing the actual work of the InstallVersionedLib Builder. +# +def copyFuncVersionedLib(dest, source, env): + """Install a versioned library into a destination by copying, + (including copying permission/mode bits) and then creating + required symlinks.""" + + if os.path.isdir(source): + raise SCons.Errors.UserError("cannot install directory `%s' as a version library" % str(source) ) + else: + shutil.copy2(source, dest) + st = os.stat(source) + os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE) + versionedLibLinks(dest, source, env) + + return 0 + +def versionedLibVersion(dest, env): + """Check if dest is a version shared library name. Return version, libname, & install_dir if it is.""" + Verbose = False + platform = env.subst('$PLATFORM') + if not (platform == 'posix' or platform == 'darwin'): + return (None, None, None) + + libname = os.path.basename(dest) + install_dir = os.path.dirname(dest) + shlib_suffix = env.subst('$SHLIBSUFFIX') + # See if the source name is a versioned shared library, get the version number + result = False + + version_re = re.compile("[0-9]+\\.[0-9]+\\.[0-9a-zA-Z]+") + version_File = None + if platform == 'posix': + # handle unix names + versioned_re = re.compile(re.escape(shlib_suffix + '.') + "[0-9]+\\.[0-9]+\\.[0-9a-zA-Z]+") + result = versioned_re.findall(libname) + if result: + version_File = version_re.findall(versioned_re.findall(libname)[-1])[-1] + elif platform == 'darwin': + # handle OSX names + versioned_re = re.compile("\\.[0-9]+\\.[0-9]+\\.[0-9a-zA-Z]+" + re.escape(shlib_suffix) ) + result = versioned_re.findall(libname) + if result: + version_File = version_re.findall(versioned_re.findall(libname)[-1])[-1] + + if Verbose: + print "install: version_File ", version_File + # result is False if we did not find a versioned shared library name, so return and empty list + if not result: + return (None, libname, install_dir) + + version = None + # get version number from the environment + try: + version = env.subst('$SHLIBVERSION') + except KeyError: + version = None + + if version != version_File: + #raise SCons.Errors.UserError("SHLIBVERSION '%s' does not match the version # '%s' in the filename" % (version, version_File) ) + print "SHLIBVERSION '%s' does not match the version # '%s' in the filename, proceeding based on file name" % (version, version_File) + version = version_File + return (version, libname, install_dir) + +def versionedLibLinks(dest, source, env): + """If we are installing a versioned shared library create the required links.""" + Verbose = False + linknames = [] + version, libname, install_dir = versionedLibVersion(dest, env) + + if version != None: + # libname includes the version number if one was given + linknames = SCons.Tool.VersionShLibLinkNames(version,libname,env) + for linkname in linknames: + if Verbose: + print "make link of %s to %s" %(libname, os.path.join(install_dir, linkname)) + fulllinkname = os.path.join(install_dir, linkname) + os.symlink(libname,fulllinkname) + return + +def installFunc(target, source, env): + """Install a source file into a target using the function specified + as the INSTALL construction variable.""" + try: + install = env['INSTALL'] + except KeyError: + raise SCons.Errors.UserError('Missing INSTALL construction variable.') + + assert len(target)==len(source), \ + "Installing source %s into target %s: target and source lists must have same length."%(list(map(str, source)), list(map(str, target))) + for t,s in zip(target,source): + if install(t.get_path(),s.get_path(),env): + return 1 + + return 0 + +def installFuncVersionedLib(target, source, env): + """Install a versioned library into a target using the function specified + as the INSTALLVERSIONEDLIB construction variable.""" + try: + install = env['INSTALLVERSIONEDLIB'] + except KeyError: + raise SCons.Errors.UserError('Missing INSTALLVERSIONEDLIB construction variable.') + + assert len(target)==len(source), \ + "Installing source %s into target %s: target and source lists must have same length."%(list(map(str, source)), list(map(str, target))) + for t,s in zip(target,source): + if install(t.get_path(),s.get_path(),env): + return 1 + + return 0 + +def stringFunc(target, source, env): + installstr = env.get('INSTALLSTR') + if installstr: + return env.subst_target_source(installstr, 0, target, source) + target = str(target[0]) + source = str(source[0]) + if os.path.isdir(source): + type = 'directory' + else: + type = 'file' + return 'Install %s: "%s" as "%s"' % (type, source, target) + +# +# Emitter functions +# +def add_targets_to_INSTALLED_FILES(target, source, env): + """ an emitter that adds all target files to the list stored in the + _INSTALLED_FILES global variable. This way all installed files of one + scons call will be collected. + """ + global _INSTALLED_FILES, _UNIQUE_INSTALLED_FILES + _INSTALLED_FILES.extend(target) + + _UNIQUE_INSTALLED_FILES = None + return (target, source) + +def add_versioned_targets_to_INSTALLED_FILES(target, source, env): + """ an emitter that adds all target files to the list stored in the + _INSTALLED_FILES global variable. This way all installed files of one + scons call will be collected. + """ + global _INSTALLED_FILES, _UNIQUE_INSTALLED_FILES + Verbose = False + _INSTALLED_FILES.extend(target) + + # see if we have a versioned shared library, if so generate side effects + version, libname, install_dir = versionedLibVersion(target[0].path, env) + if version != None: + # generate list of link names + linknames = SCons.Tool.VersionShLibLinkNames(version,libname,env) + for linkname in linknames: + if Verbose: + print "make side effect of %s" % os.path.join(install_dir, linkname) + fulllinkname = os.path.join(install_dir, linkname) + env.SideEffect(fulllinkname,target[0]) + env.Clean(target[0],fulllinkname) + + _UNIQUE_INSTALLED_FILES = None + return (target, source) + +class DESTDIR_factory(object): + """ a node factory, where all files will be relative to the dir supplied + in the constructor. + """ + def __init__(self, env, dir): + self.env = env + self.dir = env.arg2nodes( dir, env.fs.Dir )[0] + + def Entry(self, name): + name = make_path_relative(name) + return self.dir.Entry(name) + + def Dir(self, name): + name = make_path_relative(name) + return self.dir.Dir(name) + +# +# The Builder Definition +# +install_action = SCons.Action.Action(installFunc, stringFunc) +installas_action = SCons.Action.Action(installFunc, stringFunc) +installVerLib_action = SCons.Action.Action(installFuncVersionedLib, stringFunc) + +BaseInstallBuilder = None + +def InstallBuilderWrapper(env, target=None, source=None, dir=None, **kw): + if target and dir: + import SCons.Errors + raise SCons.Errors.UserError("Both target and dir defined for Install(), only one may be defined.") + if not dir: + dir=target + + import SCons.Script + install_sandbox = SCons.Script.GetOption('install_sandbox') + if install_sandbox: + target_factory = DESTDIR_factory(env, install_sandbox) + else: + target_factory = env.fs + + try: + dnodes = env.arg2nodes(dir, target_factory.Dir) + except TypeError: + raise SCons.Errors.UserError("Target `%s' of Install() is a file, but should be a directory. Perhaps you have the Install() arguments backwards?" % str(dir)) + sources = env.arg2nodes(source, env.fs.Entry) + tgt = [] + for dnode in dnodes: + for src in sources: + # Prepend './' so the lookup doesn't interpret an initial + # '#' on the file name portion as meaning the Node should + # be relative to the top-level SConstruct directory. + target = env.fs.Entry('.'+os.sep+src.name, dnode) + #tgt.extend(BaseInstallBuilder(env, target, src, **kw)) + tgt.extend(BaseInstallBuilder(env, target, src, **kw)) + return tgt + +def InstallAsBuilderWrapper(env, target=None, source=None, **kw): + result = [] + for src, tgt in map(lambda x, y: (x, y), source, target): + #result.extend(BaseInstallBuilder(env, tgt, src, **kw)) + result.extend(BaseInstallBuilder(env, tgt, src, **kw)) + return result + +BaseVersionedInstallBuilder = None + +def InstallVersionedBuilderWrapper(env, target=None, source=None, dir=None, **kw): + if target and dir: + import SCons.Errors + raise SCons.Errors.UserError("Both target and dir defined for Install(), only one may be defined.") + if not dir: + dir=target + + import SCons.Script + install_sandbox = SCons.Script.GetOption('install_sandbox') + if install_sandbox: + target_factory = DESTDIR_factory(env, install_sandbox) + else: + target_factory = env.fs + + try: + dnodes = env.arg2nodes(dir, target_factory.Dir) + except TypeError: + raise SCons.Errors.UserError("Target `%s' of Install() is a file, but should be a directory. Perhaps you have the Install() arguments backwards?" % str(dir)) + sources = env.arg2nodes(source, env.fs.Entry) + tgt = [] + for dnode in dnodes: + for src in sources: + # Prepend './' so the lookup doesn't interpret an initial + # '#' on the file name portion as meaning the Node should + # be relative to the top-level SConstruct directory. + target = env.fs.Entry('.'+os.sep+src.name, dnode) + tgt.extend(BaseVersionedInstallBuilder(env, target, src, **kw)) + return tgt + +added = None + +def generate(env): + + from SCons.Script import AddOption, GetOption + global added + if not added: + added = 1 + AddOption('--install-sandbox', + dest='install_sandbox', + type="string", + action="store", + help='A directory under which all installed files will be placed.') + + global BaseInstallBuilder + if BaseInstallBuilder is None: + install_sandbox = GetOption('install_sandbox') + if install_sandbox: + target_factory = DESTDIR_factory(env, install_sandbox) + else: + target_factory = env.fs + + BaseInstallBuilder = SCons.Builder.Builder( + action = install_action, + target_factory = target_factory.Entry, + source_factory = env.fs.Entry, + multi = 1, + emitter = [ add_targets_to_INSTALLED_FILES, ], + name = 'InstallBuilder') + + global BaseVersionedInstallBuilder + if BaseVersionedInstallBuilder is None: + install_sandbox = GetOption('install_sandbox') + if install_sandbox: + target_factory = DESTDIR_factory(env, install_sandbox) + else: + target_factory = env.fs + + BaseVersionedInstallBuilder = SCons.Builder.Builder( + action = installVerLib_action, + target_factory = target_factory.Entry, + source_factory = env.fs.Entry, + multi = 1, + emitter = [ add_versioned_targets_to_INSTALLED_FILES, ], + name = 'InstallVersionedBuilder') + + env['BUILDERS']['_InternalInstall'] = InstallBuilderWrapper + env['BUILDERS']['_InternalInstallAs'] = InstallAsBuilderWrapper + env['BUILDERS']['_InternalInstallVersionedLib'] = InstallVersionedBuilderWrapper + + # We'd like to initialize this doing something like the following, + # but there isn't yet support for a ${SOURCE.type} expansion that + # will print "file" or "directory" depending on what's being + # installed. For now we punt by not initializing it, and letting + # the stringFunc() that we put in the action fall back to the + # hand-crafted default string if it's not set. + # + #try: + # env['INSTALLSTR'] + #except KeyError: + # env['INSTALLSTR'] = 'Install ${SOURCE.type}: "$SOURCES" as "$TARGETS"' + + try: + env['INSTALL'] + except KeyError: + env['INSTALL'] = copyFunc + + try: + env['INSTALLVERSIONEDLIB'] + except KeyError: + env['INSTALLVERSIONEDLIB'] = copyFuncVersionedLib + +def exists(env): + return 1 + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/intelc.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/intelc.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/intelc.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/intelc.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,552 @@ +"""SCons.Tool.icl + +Tool-specific initialization for the Intel C/C++ compiler. +Supports Linux and Windows compilers, v7 and up. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +from __future__ import division + +__revision__ = "src/engine/SCons/Tool/intelc.py 2013/03/03 09:48:35 garyo" + +import math, sys, os.path, glob, string, re + +is_windows = sys.platform == 'win32' +is_win64 = is_windows and (os.environ['PROCESSOR_ARCHITECTURE'] == 'AMD64' or + ('PROCESSOR_ARCHITEW6432' in os.environ and + os.environ['PROCESSOR_ARCHITEW6432'] == 'AMD64')) +is_linux = sys.platform.startswith('linux') +is_mac = sys.platform == 'darwin' + +if is_windows: + import SCons.Tool.msvc +elif is_linux: + import SCons.Tool.gcc +elif is_mac: + import SCons.Tool.gcc +import SCons.Util +import SCons.Warnings + +# Exceptions for this tool +class IntelCError(SCons.Errors.InternalError): + pass +class MissingRegistryError(IntelCError): # missing registry entry + pass +class MissingDirError(IntelCError): # dir not found + pass +class NoRegistryModuleError(IntelCError): # can't read registry at all + pass + +def uniquify(s): + """Return a sequence containing only one copy of each unique element from input sequence s. + Does not preserve order. + Input sequence must be hashable (i.e. must be usable as a dictionary key).""" + u = {} + for x in s: + u[x] = 1 + return list(u.keys()) + +def linux_ver_normalize(vstr): + """Normalize a Linux compiler version number. + Intel changed from "80" to "9.0" in 2005, so we assume if the number + is greater than 60 it's an old-style number and otherwise new-style. + Always returns an old-style float like 80 or 90 for compatibility with Windows. + Shades of Y2K!""" + # Check for version number like 9.1.026: return 91.026 + # XXX needs to be updated for 2011+ versions (like 2011.11.344 which is compiler v12.1.5) + m = re.match(r'([0-9]+)\.([0-9]+)\.([0-9]+)', vstr) + if m: + vmaj,vmin,build = m.groups() + return float(vmaj) * 10. + float(vmin) + float(build) / 1000.; + else: + f = float(vstr) + if is_windows: + return f + else: + if f < 60: return f * 10.0 + else: return f + +def check_abi(abi): + """Check for valid ABI (application binary interface) name, + and map into canonical one""" + if not abi: + return None + abi = abi.lower() + # valid_abis maps input name to canonical name + if is_windows: + valid_abis = {'ia32' : 'ia32', + 'x86' : 'ia32', + 'ia64' : 'ia64', + 'em64t' : 'em64t', + 'amd64' : 'em64t'} + if is_linux: + valid_abis = {'ia32' : 'ia32', + 'x86' : 'ia32', + 'x86_64' : 'x86_64', + 'em64t' : 'x86_64', + 'amd64' : 'x86_64'} + if is_mac: + valid_abis = {'ia32' : 'ia32', + 'x86' : 'ia32', + 'x86_64' : 'x86_64', + 'em64t' : 'x86_64'} + try: + abi = valid_abis[abi] + except KeyError: + raise SCons.Errors.UserError("Intel compiler: Invalid ABI %s, valid values are %s"% \ + (abi, list(valid_abis.keys()))) + return abi + +def vercmp(a, b): + """Compare strings as floats, + but Intel changed Linux naming convention at 9.0""" + return cmp(linux_ver_normalize(b), linux_ver_normalize(a)) + +def get_version_from_list(v, vlist): + """See if we can match v (string) in vlist (list of strings) + Linux has to match in a fuzzy way.""" + if is_windows: + # Simple case, just find it in the list + if v in vlist: return v + else: return None + else: + # Fuzzy match: normalize version number first, but still return + # original non-normalized form. + fuzz = 0.001 + for vi in vlist: + if math.fabs(linux_ver_normalize(vi) - linux_ver_normalize(v)) < fuzz: + return vi + # Not found + return None + +def get_intel_registry_value(valuename, version=None, abi=None): + """ + Return a value from the Intel compiler registry tree. (Windows only) + """ + # Open the key: + if is_win64: + K = 'Software\\Wow6432Node\\Intel\\Compilers\\C++\\' + version + '\\'+abi.upper() + else: + K = 'Software\\Intel\\Compilers\\C++\\' + version + '\\'+abi.upper() + try: + k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, K) + except SCons.Util.RegError: + raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi)) + + # Get the value: + try: + v = SCons.Util.RegQueryValueEx(k, valuename)[0] + return v # or v.encode('iso-8859-1', 'replace') to remove unicode? + except SCons.Util.RegError: + raise MissingRegistryError("%s\\%s was not found in the registry."%(K, valuename)) + + +def get_all_compiler_versions(): + """Returns a sorted list of strings, like "70" or "80" or "9.0" + with most recent compiler version first. + """ + versions=[] + if is_windows: + if is_win64: + keyname = 'Software\\WoW6432Node\\Intel\\Compilers\\C++' + else: + keyname = 'Software\\Intel\\Compilers\\C++' + try: + k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, + keyname) + except WindowsError: + return [] + i = 0 + versions = [] + try: + while i < 100: + subkey = SCons.Util.RegEnumKey(k, i) # raises EnvironmentError + # Check that this refers to an existing dir. + # This is not 100% perfect but should catch common + # installation issues like when the compiler was installed + # and then the install directory deleted or moved (rather + # than uninstalling properly), so the registry values + # are still there. + ok = False + for try_abi in ('IA32', 'IA32e', 'IA64', 'EM64T'): + try: + d = get_intel_registry_value('ProductDir', subkey, try_abi) + except MissingRegistryError: + continue # not found in reg, keep going + if os.path.exists(d): ok = True + if ok: + versions.append(subkey) + else: + try: + # Registry points to nonexistent dir. Ignore this + # version. + value = get_intel_registry_value('ProductDir', subkey, 'IA32') + except MissingRegistryError, e: + + # Registry key is left dangling (potentially + # after uninstalling). + + print \ + "scons: *** Ignoring the registry key for the Intel compiler version %s.\n" \ + "scons: *** It seems that the compiler was uninstalled and that the registry\n" \ + "scons: *** was not cleaned up properly.\n" % subkey + else: + print "scons: *** Ignoring "+str(value) + + i = i + 1 + except EnvironmentError: + # no more subkeys + pass + elif is_linux or is_mac: + for d in glob.glob('/opt/intel_cc_*'): + # Typical dir here is /opt/intel_cc_80. + m = re.search(r'cc_(.*)$', d) + if m: + versions.append(m.group(1)) + for d in glob.glob('/opt/intel/cc*/*'): + # Typical dir here is /opt/intel/cc/9.0 for IA32, + # /opt/intel/cce/9.0 for EMT64 (AMD64) + m = re.search(r'([0-9][0-9.]*)$', d) + if m: + versions.append(m.group(1)) + for d in glob.glob('/opt/intel/Compiler/*'): + # Typical dir here is /opt/intel/Compiler/11.1 + m = re.search(r'([0-9][0-9.]*)$', d) + if m: + versions.append(m.group(1)) + for d in glob.glob('/opt/intel/composerxe-*'): + # Typical dir here is /opt/intel/composerxe-2011.4.184 + m = re.search(r'([0-9][0-9.]*)$', d) + if m: + versions.append(m.group(1)) + for d in glob.glob('/opt/intel/composer_xe_*'): + # Typical dir here is /opt/intel/composer_xe_2011_sp1.11.344 + # The _sp1 is useless, the installers are named 2011.9.x, 2011.10.x, 2011.11.x + m = re.search(r'([0-9]{0,4})(?:_sp\d*)?\.([0-9][0-9.]*)$', d) + if m: + versions.append("%s.%s"%(m.group(1), m.group(2))) + def keyfunc(str): + """Given a dot-separated version string, return a tuple of ints representing it.""" + return [int(x) for x in str.split('.')] + # split into ints, sort, then remove dups + return sorted(uniquify(versions), key=keyfunc, reverse=True) + +def get_intel_compiler_top(version, abi): + """ + Return the main path to the top-level dir of the Intel compiler, + using the given version. + The compiler will be in /bin/icl.exe (icc on linux), + the include dir is /include, etc. + """ + + if is_windows: + if not SCons.Util.can_read_reg: + raise NoRegistryModuleError("No Windows registry module was found") + top = get_intel_registry_value('ProductDir', version, abi) + # pre-11, icl was in Bin. 11 and later, it's in Bin/ apparently. + if not os.path.exists(os.path.join(top, "Bin", "icl.exe")) \ + and not os.path.exists(os.path.join(top, "Bin", abi, "icl.exe")): + raise MissingDirError("Can't find Intel compiler in %s"%(top)) + elif is_mac or is_linux: + def find_in_2008style_dir(version): + # first dir is new (>=9.0) style, second is old (8.0) style. + dirs=('/opt/intel/cc/%s', '/opt/intel_cc_%s') + if abi == 'x86_64': + dirs=('/opt/intel/cce/%s',) # 'e' stands for 'em64t', aka x86_64 aka amd64 + top=None + for d in dirs: + if os.path.exists(os.path.join(d%version, "bin", "icc")): + top = d%version + break + return top + def find_in_2010style_dir(version): + dirs=('/opt/intel/Compiler/%s/*'%version) + # typically /opt/intel/Compiler/11.1/064 (then bin/intel64/icc) + dirs=glob.glob(dirs) + # find highest sub-version number by reverse sorting and picking first existing one. + dirs.sort() + dirs.reverse() + top=None + for d in dirs: + if (os.path.exists(os.path.join(d, "bin", "ia32", "icc")) or + os.path.exists(os.path.join(d, "bin", "intel64", "icc"))): + top = d + break + return top + def find_in_2011style_dir(version): + # The 2011 (compiler v12) dirs are inconsistent, so just redo the search from + # get_all_compiler_versions and look for a match (search the newest form first) + top=None + for d in glob.glob('/opt/intel/composer_xe_*'): + # Typical dir here is /opt/intel/composer_xe_2011_sp1.11.344 + # The _sp1 is useless, the installers are named 2011.9.x, 2011.10.x, 2011.11.x + m = re.search(r'([0-9]{0,4})(?:_sp\d*)?\.([0-9][0-9.]*)$', d) + if m: + cur_ver = "%s.%s"%(m.group(1), m.group(2)) + if cur_ver == version and \ + (os.path.exists(os.path.join(d, "bin", "ia32", "icc")) or + os.path.exists(os.path.join(d, "bin", "intel64", "icc"))): + top = d + break + if not top: + for d in glob.glob('/opt/intel/composerxe-*'): + # Typical dir here is /opt/intel/composerxe-2011.4.184 + m = re.search(r'([0-9][0-9.]*)$', d) + if m and m.group(1) == verison and \ + (os.path.exists(os.path.join(d, "bin", "ia32", "icc")) or + os.path.exists(os.path.join(d, "bin", "intel64", "icc"))): + top = d + break + return top + top = find_in_2011style_dir(version) or find_in_2010style_dir(version) or find_in_2008style_dir(version) + # print "INTELC: top=",top + if not top: + raise MissingDirError("Can't find version %s Intel compiler in %s (abi='%s')"%(version,top, abi)) + return top + + +def generate(env, version=None, abi=None, topdir=None, verbose=0): + """Add Builders and construction variables for Intel C/C++ compiler + to an Environment. + args: + version: (string) compiler version to use, like "80" + abi: (string) 'win32' or whatever Itanium version wants + topdir: (string) compiler top dir, like + "c:\Program Files\Intel\Compiler70" + If topdir is used, version and abi are ignored. + verbose: (int) if >0, prints compiler version used. + """ + if not (is_mac or is_linux or is_windows): + # can't handle this platform + return + + if is_windows: + SCons.Tool.msvc.generate(env) + elif is_linux: + SCons.Tool.gcc.generate(env) + elif is_mac: + SCons.Tool.gcc.generate(env) + + # if version is unspecified, use latest + vlist = get_all_compiler_versions() + if not version: + if vlist: + version = vlist[0] + else: + # User may have specified '90' but we need to get actual dirname '9.0'. + # get_version_from_list does that mapping. + v = get_version_from_list(version, vlist) + if not v: + raise SCons.Errors.UserError("Invalid Intel compiler version %s: "%version + \ + "installed versions are %s"%(', '.join(vlist))) + version = v + + # if abi is unspecified, use ia32 + # alternatives are ia64 for Itanium, or amd64 or em64t or x86_64 (all synonyms here) + abi = check_abi(abi) + if abi is None: + if is_mac or is_linux: + # Check if we are on 64-bit linux, default to 64 then. + uname_m = os.uname()[4] + if uname_m == 'x86_64': + abi = 'x86_64' + else: + abi = 'ia32' + else: + if is_win64: + abi = 'em64t' + else: + abi = 'ia32' + + if version and not topdir: + try: + topdir = get_intel_compiler_top(version, abi) + except (SCons.Util.RegError, IntelCError): + topdir = None + + if not topdir: + # Normally this is an error, but it might not be if the compiler is + # on $PATH and the user is importing their env. + class ICLTopDirWarning(SCons.Warnings.Warning): + pass + if (is_mac or is_linux) and not env.Detect('icc') or \ + is_windows and not env.Detect('icl'): + + SCons.Warnings.enableWarningClass(ICLTopDirWarning) + SCons.Warnings.warn(ICLTopDirWarning, + "Failed to find Intel compiler for version='%s', abi='%s'"% + (str(version), str(abi))) + else: + # should be cleaned up to say what this other version is + # since in this case we have some other Intel compiler installed + SCons.Warnings.enableWarningClass(ICLTopDirWarning) + SCons.Warnings.warn(ICLTopDirWarning, + "Can't find Intel compiler top dir for version='%s', abi='%s'"% + (str(version), str(abi))) + + if topdir: + archdir={'x86_64': 'intel64', + 'amd64' : 'intel64', + 'em64t' : 'intel64', + 'x86' : 'ia32', + 'i386' : 'ia32', + 'ia32' : 'ia32' + }[abi] # for v11 and greater + if os.path.exists(os.path.join(topdir, 'bin', archdir)): + bindir="bin/%s"%archdir + libdir="lib/%s"%archdir + else: + bindir="bin" + libdir="lib" + if verbose: + print "Intel C compiler: using version %s (%g), abi %s, in '%s/%s'"%\ + (repr(version), linux_ver_normalize(version),abi,topdir,bindir) + if is_linux: + # Show the actual compiler version by running the compiler. + os.system('%s/%s/icc --version'%(topdir,bindir)) + if is_mac: + # Show the actual compiler version by running the compiler. + os.system('%s/%s/icc --version'%(topdir,bindir)) + + env['INTEL_C_COMPILER_TOP'] = topdir + if is_linux: + paths={'INCLUDE' : 'include', + 'LIB' : libdir, + 'PATH' : bindir, + 'LD_LIBRARY_PATH' : libdir} + for p in paths.keys(): + env.PrependENVPath(p, os.path.join(topdir, paths[p])) + if is_mac: + paths={'INCLUDE' : 'include', + 'LIB' : libdir, + 'PATH' : bindir, + 'LD_LIBRARY_PATH' : libdir} + for p in paths.keys(): + env.PrependENVPath(p, os.path.join(topdir, paths[p])) + if is_windows: + # env key reg valname default subdir of top + paths=(('INCLUDE', 'IncludeDir', 'Include'), + ('LIB' , 'LibDir', 'Lib'), + ('PATH' , 'BinDir', 'Bin')) + # We are supposed to ignore version if topdir is set, so set + # it to the emptry string if it's not already set. + if version is None: + version = '' + # Each path has a registry entry, use that or default to subdir + for p in paths: + try: + path=get_intel_registry_value(p[1], version, abi) + # These paths may have $(ICInstallDir) + # which needs to be substituted with the topdir. + path=path.replace('$(ICInstallDir)', topdir + os.sep) + except IntelCError: + # Couldn't get it from registry: use default subdir of topdir + env.PrependENVPath(p[0], os.path.join(topdir, p[2])) + else: + env.PrependENVPath(p[0], path.split(os.pathsep)) + # print "ICL %s: %s, final=%s"%(p[0], path, str(env['ENV'][p[0]])) + + if is_windows: + env['CC'] = 'icl' + env['CXX'] = 'icl' + env['LINK'] = 'xilink' + else: + env['CC'] = 'icc' + env['CXX'] = 'icpc' + # Don't reset LINK here; + # use smart_link which should already be here from link.py. + #env['LINK'] = '$CC' + env['AR'] = 'xiar' + env['LD'] = 'xild' # not used by default + + # This is not the exact (detailed) compiler version, + # just the major version as determined above or specified + # by the user. It is a float like 80 or 90, in normalized form for Linux + # (i.e. even for Linux 9.0 compiler, still returns 90 rather than 9.0) + if version: + env['INTEL_C_COMPILER_VERSION']=linux_ver_normalize(version) + + if is_windows: + # Look for license file dir + # in system environment, registry, and default location. + envlicdir = os.environ.get("INTEL_LICENSE_FILE", '') + K = ('SOFTWARE\Intel\Licenses') + try: + k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, K) + reglicdir = SCons.Util.RegQueryValueEx(k, "w_cpp")[0] + except (AttributeError, SCons.Util.RegError): + reglicdir = "" + defaultlicdir = r'C:\Program Files\Common Files\Intel\Licenses' + + licdir = None + for ld in [envlicdir, reglicdir]: + # If the string contains an '@', then assume it's a network + # license (port@system) and good by definition. + if ld and (ld.find('@') != -1 or os.path.exists(ld)): + licdir = ld + break + if not licdir: + licdir = defaultlicdir + if not os.path.exists(licdir): + class ICLLicenseDirWarning(SCons.Warnings.Warning): + pass + SCons.Warnings.enableWarningClass(ICLLicenseDirWarning) + SCons.Warnings.warn(ICLLicenseDirWarning, + "Intel license dir was not found." + " Tried using the INTEL_LICENSE_FILE environment variable (%s), the registry (%s) and the default path (%s)." + " Using the default path as a last resort." + % (envlicdir, reglicdir, defaultlicdir)) + env['ENV']['INTEL_LICENSE_FILE'] = licdir + +def exists(env): + if not (is_mac or is_linux or is_windows): + # can't handle this platform + return 0 + + try: + versions = get_all_compiler_versions() + except (SCons.Util.RegError, IntelCError): + versions = None + detected = versions is not None and len(versions) > 0 + if not detected: + # try env.Detect, maybe that will work + if is_windows: + return env.Detect('icl') + elif is_linux: + return env.Detect('icc') + elif is_mac: + return env.Detect('icc') + return detected + +# end of file + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/ipkg.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/ipkg.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/ipkg.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/ipkg.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,67 @@ +"""SCons.Tool.ipkg + +Tool-specific initialization for ipkg. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +The ipkg tool calls the ipkg-build. Its only argument should be the +packages fake_root. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/ipkg.py 2013/03/03 09:48:35 garyo" + +import os + +import SCons.Builder + +def generate(env): + """Add Builders and construction variables for ipkg to an Environment.""" + try: + bld = env['BUILDERS']['Ipkg'] + except KeyError: + bld = SCons.Builder.Builder( action = '$IPKGCOM', + suffix = '$IPKGSUFFIX', + source_scanner = None, + target_scanner = None) + env['BUILDERS']['Ipkg'] = bld + + env['IPKG'] = 'ipkg-build' + env['IPKGCOM'] = '$IPKG $IPKGFLAGS ${SOURCE}' + env['IPKGUSER'] = os.popen('id -un').read().strip() + env['IPKGGROUP'] = os.popen('id -gn').read().strip() + env['IPKGFLAGS'] = SCons.Util.CLVar('-o $IPKGUSER -g $IPKGGROUP') + env['IPKGSUFFIX'] = '.ipk' + +def exists(env): + return env.Detect('ipkg-build') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/jar.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/jar.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/jar.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/jar.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,116 @@ +"""SCons.Tool.jar + +Tool-specific initialization for jar. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/jar.py 2013/03/03 09:48:35 garyo" + +import SCons.Subst +import SCons.Util + +def jarSources(target, source, env, for_signature): + """Only include sources that are not a manifest file.""" + try: + env['JARCHDIR'] + except KeyError: + jarchdir_set = False + else: + jarchdir_set = True + jarchdir = env.subst('$JARCHDIR', target=target, source=source) + if jarchdir: + jarchdir = env.fs.Dir(jarchdir) + result = [] + for src in source: + contents = src.get_text_contents() + if contents[:16] != "Manifest-Version": + if jarchdir_set: + _chdir = jarchdir + else: + try: + _chdir = src.attributes.java_classdir + except AttributeError: + _chdir = None + if _chdir: + # If we are changing the dir with -C, then sources should + # be relative to that directory. + src = SCons.Subst.Literal(src.get_path(_chdir)) + result.append('-C') + result.append(_chdir) + result.append(src) + return result + +def jarManifest(target, source, env, for_signature): + """Look in sources for a manifest file, if any.""" + for src in source: + contents = src.get_text_contents() + if contents[:16] == "Manifest-Version": + return src + return '' + +def jarFlags(target, source, env, for_signature): + """If we have a manifest, make sure that the 'm' + flag is specified.""" + jarflags = env.subst('$JARFLAGS', target=target, source=source) + for src in source: + contents = src.get_text_contents() + if contents[:16] == "Manifest-Version": + if not 'm' in jarflags: + return jarflags + 'm' + break + return jarflags + +def generate(env): + """Add Builders and construction variables for jar to an Environment.""" + SCons.Tool.CreateJarBuilder(env) + + env['JAR'] = 'jar' + env['JARFLAGS'] = SCons.Util.CLVar('cf') + env['_JARFLAGS'] = jarFlags + env['_JARMANIFEST'] = jarManifest + env['_JARSOURCES'] = jarSources + env['_JARCOM'] = '$JAR $_JARFLAGS $TARGET $_JARMANIFEST $_JARSOURCES' + env['JARCOM'] = "${TEMPFILE('$_JARCOM')}" + env['JARSUFFIX'] = '.jar' + +def exists(env): + # As reported by Jan Nijtmans in issue #2730, the simple + # return env.Detect('jar') + # doesn't always work during initialization. For now, we + # stop trying to detect an executable (analogous to the + # javac Builder). + # TODO: Come up with a proper detect() routine...and enable it. + return 1 + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/javac.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/javac.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/javac.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/javac.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,232 @@ +"""SCons.Tool.javac + +Tool-specific initialization for javac. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/javac.py 2013/03/03 09:48:35 garyo" + +import os +import os.path + +import SCons.Action +import SCons.Builder +from SCons.Node.FS import _my_normcase +from SCons.Tool.JavaCommon import parse_java_file +import SCons.Util + +def classname(path): + """Turn a string (path name) into a Java class name.""" + return os.path.normpath(path).replace(os.sep, '.') + +def emit_java_classes(target, source, env): + """Create and return lists of source java files + and their corresponding target class files. + """ + java_suffix = env.get('JAVASUFFIX', '.java') + class_suffix = env.get('JAVACLASSSUFFIX', '.class') + + target[0].must_be_same(SCons.Node.FS.Dir) + classdir = target[0] + + s = source[0].rentry().disambiguate() + if isinstance(s, SCons.Node.FS.File): + sourcedir = s.dir.rdir() + elif isinstance(s, SCons.Node.FS.Dir): + sourcedir = s.rdir() + else: + raise SCons.Errors.UserError("Java source must be File or Dir, not '%s'" % s.__class__) + + slist = [] + js = _my_normcase(java_suffix) + for entry in source: + entry = entry.rentry().disambiguate() + if isinstance(entry, SCons.Node.FS.File): + slist.append(entry) + elif isinstance(entry, SCons.Node.FS.Dir): + result = SCons.Util.OrderedDict() + dirnode = entry.rdir() + def find_java_files(arg, dirpath, filenames): + java_files = sorted([n for n in filenames + if _my_normcase(n).endswith(js)]) + mydir = dirnode.Dir(dirpath) + java_paths = [mydir.File(f) for f in java_files] + for jp in java_paths: + arg[jp] = True + for dirpath, dirnames, filenames in os.walk(dirnode.get_abspath()): + find_java_files(result, dirpath, filenames) + entry.walk(find_java_files, result) + + slist.extend(list(result.keys())) + else: + raise SCons.Errors.UserError("Java source must be File or Dir, not '%s'" % entry.__class__) + + version = env.get('JAVAVERSION', '1.4') + full_tlist = [] + for f in slist: + tlist = [] + source_file_based = True + pkg_dir = None + if not f.is_derived(): + pkg_dir, classes = parse_java_file(f.rfile().get_abspath(), version) + if classes: + source_file_based = False + if pkg_dir: + d = target[0].Dir(pkg_dir) + p = pkg_dir + os.sep + else: + d = target[0] + p = '' + for c in classes: + t = d.File(c + class_suffix) + t.attributes.java_classdir = classdir + t.attributes.java_sourcedir = sourcedir + t.attributes.java_classname = classname(p + c) + tlist.append(t) + + if source_file_based: + base = f.name[:-len(java_suffix)] + if pkg_dir: + t = target[0].Dir(pkg_dir).File(base + class_suffix) + else: + t = target[0].File(base + class_suffix) + t.attributes.java_classdir = classdir + t.attributes.java_sourcedir = f.dir + t.attributes.java_classname = classname(base) + tlist.append(t) + + for t in tlist: + t.set_specific_source([f]) + + full_tlist.extend(tlist) + + return full_tlist, slist + +JavaAction = SCons.Action.Action('$JAVACCOM', '$JAVACCOMSTR') + +JavaBuilder = SCons.Builder.Builder(action = JavaAction, + emitter = emit_java_classes, + target_factory = SCons.Node.FS.Entry, + source_factory = SCons.Node.FS.Entry) + +class pathopt(object): + """ + Callable object for generating javac-style path options from + a construction variable (e.g. -classpath, -sourcepath). + """ + def __init__(self, opt, var, default=None): + self.opt = opt + self.var = var + self.default = default + + def __call__(self, target, source, env, for_signature): + path = env[self.var] + if path and not SCons.Util.is_List(path): + path = [path] + if self.default: + default = env[self.default] + if default: + if not SCons.Util.is_List(default): + default = [default] + path = path + default + if path: + return [self.opt, os.pathsep.join(map(str, path))] + else: + return [] + +def Java(env, target, source, *args, **kw): + """ + A pseudo-Builder wrapper around the separate JavaClass{File,Dir} + Builders. + """ + if not SCons.Util.is_List(target): + target = [target] + if not SCons.Util.is_List(source): + source = [source] + + # Pad the target list with repetitions of the last element in the + # list so we have a target for every source element. + target = target + ([target[-1]] * (len(source) - len(target))) + + java_suffix = env.subst('$JAVASUFFIX') + result = [] + + for t, s in zip(target, source): + if isinstance(s, SCons.Node.FS.Base): + if isinstance(s, SCons.Node.FS.File): + b = env.JavaClassFile + else: + b = env.JavaClassDir + else: + if os.path.isfile(s): + b = env.JavaClassFile + elif os.path.isdir(s): + b = env.JavaClassDir + elif s[-len(java_suffix):] == java_suffix: + b = env.JavaClassFile + else: + b = env.JavaClassDir + result.extend(b(t, s, *args, **kw)) + + return result + +def generate(env): + """Add Builders and construction variables for javac to an Environment.""" + java_file = SCons.Tool.CreateJavaFileBuilder(env) + java_class = SCons.Tool.CreateJavaClassFileBuilder(env) + java_class_dir = SCons.Tool.CreateJavaClassDirBuilder(env) + java_class.add_emitter(None, emit_java_classes) + java_class.add_emitter(env.subst('$JAVASUFFIX'), emit_java_classes) + java_class_dir.emitter = emit_java_classes + + env.AddMethod(Java) + + env['JAVAC'] = 'javac' + env['JAVACFLAGS'] = SCons.Util.CLVar('') + env['JAVABOOTCLASSPATH'] = [] + env['JAVACLASSPATH'] = [] + env['JAVASOURCEPATH'] = [] + env['_javapathopt'] = pathopt + env['_JAVABOOTCLASSPATH'] = '${_javapathopt("-bootclasspath", "JAVABOOTCLASSPATH")} ' + env['_JAVACLASSPATH'] = '${_javapathopt("-classpath", "JAVACLASSPATH")} ' + env['_JAVASOURCEPATH'] = '${_javapathopt("-sourcepath", "JAVASOURCEPATH", "_JAVASOURCEPATHDEFAULT")} ' + env['_JAVASOURCEPATHDEFAULT'] = '${TARGET.attributes.java_sourcedir}' + env['_JAVACCOM'] = '$JAVAC $JAVACFLAGS $_JAVABOOTCLASSPATH $_JAVACLASSPATH -d ${TARGET.attributes.java_classdir} $_JAVASOURCEPATH $SOURCES' + env['JAVACCOM'] = "${TEMPFILE('$_JAVACCOM')}" + env['JAVACLASSSUFFIX'] = '.class' + env['JAVASUFFIX'] = '.java' + +def exists(env): + return 1 + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/javah.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/javah.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/javah.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/javah.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,137 @@ +"""SCons.Tool.javah + +Tool-specific initialization for javah. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/javah.py 2013/03/03 09:48:35 garyo" + +import os.path + +import SCons.Action +import SCons.Builder +import SCons.Node.FS +import SCons.Tool.javac +import SCons.Util + +def emit_java_headers(target, source, env): + """Create and return lists of Java stub header files that will + be created from a set of class files. + """ + class_suffix = env.get('JAVACLASSSUFFIX', '.class') + classdir = env.get('JAVACLASSDIR') + + if not classdir: + try: + s = source[0] + except IndexError: + classdir = '.' + else: + try: + classdir = s.attributes.java_classdir + except AttributeError: + classdir = '.' + classdir = env.Dir(classdir).rdir() + + if str(classdir) == '.': + c_ = None + else: + c_ = str(classdir) + os.sep + + slist = [] + for src in source: + try: + classname = src.attributes.java_classname + except AttributeError: + classname = str(src) + if c_ and classname[:len(c_)] == c_: + classname = classname[len(c_):] + if class_suffix and classname[-len(class_suffix):] == class_suffix: + classname = classname[:-len(class_suffix)] + classname = SCons.Tool.javac.classname(classname) + s = src.rfile() + s.attributes.java_classname = classname + slist.append(s) + + s = source[0].rfile() + if not hasattr(s.attributes, 'java_classdir'): + s.attributes.java_classdir = classdir + + if target[0].__class__ is SCons.Node.FS.File: + tlist = target + else: + if not isinstance(target[0], SCons.Node.FS.Dir): + target[0].__class__ = SCons.Node.FS.Dir + target[0]._morph() + tlist = [] + for s in source: + fname = s.attributes.java_classname.replace('.', '_') + '.h' + t = target[0].File(fname) + t.attributes.java_lookupdir = target[0] + tlist.append(t) + + return tlist, source + +def JavaHOutFlagGenerator(target, source, env, for_signature): + try: + t = target[0] + except (AttributeError, IndexError, TypeError): + t = target + try: + return '-d ' + str(t.attributes.java_lookupdir) + except AttributeError: + return '-o ' + str(t) + +def getJavaHClassPath(env,target, source, for_signature): + path = "${SOURCE.attributes.java_classdir}" + if 'JAVACLASSPATH' in env and env['JAVACLASSPATH']: + path = SCons.Util.AppendPath(path, env['JAVACLASSPATH']) + return "-classpath %s" % (path) + +def generate(env): + """Add Builders and construction variables for javah to an Environment.""" + java_javah = SCons.Tool.CreateJavaHBuilder(env) + java_javah.emitter = emit_java_headers + + env['_JAVAHOUTFLAG'] = JavaHOutFlagGenerator + env['JAVAH'] = 'javah' + env['JAVAHFLAGS'] = SCons.Util.CLVar('') + env['_JAVAHCLASSPATH'] = getJavaHClassPath + env['JAVAHCOM'] = '$JAVAH $JAVAHFLAGS $_JAVAHOUTFLAG $_JAVAHCLASSPATH ${SOURCES.attributes.java_classname}' + env['JAVACLASSSUFFIX'] = '.class' + +def exists(env): + return env.Detect('javah') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/latex.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/latex.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/latex.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/latex.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,80 @@ +"""SCons.Tool.latex + +Tool-specific initialization for LaTeX. +Generates .dvi files from .latex or .ltx files + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/latex.py 2013/03/03 09:48:35 garyo" + +import SCons.Action +import SCons.Defaults +import SCons.Scanner.LaTeX +import SCons.Util +import SCons.Tool +import SCons.Tool.tex + +def LaTeXAuxFunction(target = None, source= None, env=None): + result = SCons.Tool.tex.InternalLaTeXAuxAction( SCons.Tool.tex.LaTeXAction, target, source, env ) + if result != 0: + SCons.Tool.tex.check_file_error_message(env['LATEX']) + return result + +LaTeXAuxAction = SCons.Action.Action(LaTeXAuxFunction, + strfunction=SCons.Tool.tex.TeXLaTeXStrFunction) + +def generate(env): + """Add Builders and construction variables for LaTeX to an Environment.""" + + env.AppendUnique(LATEXSUFFIXES=SCons.Tool.LaTeXSuffixes) + + import dvi + dvi.generate(env) + + import pdf + pdf.generate(env) + + bld = env['BUILDERS']['DVI'] + bld.add_action('.ltx', LaTeXAuxAction) + bld.add_action('.latex', LaTeXAuxAction) + bld.add_emitter('.ltx', SCons.Tool.tex.tex_eps_emitter) + bld.add_emitter('.latex', SCons.Tool.tex.tex_eps_emitter) + + SCons.Tool.tex.generate_common(env) + +def exists(env): + SCons.Tool.tex.generate_darwin(env) + return env.Detect('latex') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/lex.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/lex.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/lex.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/lex.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,97 @@ +"""SCons.Tool.lex + +Tool-specific initialization for lex. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/lex.py 2013/03/03 09:48:35 garyo" + +import os.path + +import SCons.Action +import SCons.Tool +import SCons.Util + +LexAction = SCons.Action.Action("$LEXCOM", "$LEXCOMSTR") + +def lexEmitter(target, source, env): + sourceBase, sourceExt = os.path.splitext(SCons.Util.to_String(source[0])) + + if sourceExt == ".lm": # If using Objective-C + target = [sourceBase + ".m"] # the extension is ".m". + + # This emitter essentially tries to add to the target all extra + # files generated by flex. + + # Different options that are used to trigger the creation of extra files. + fileGenOptions = ["--header-file=", "--tables-file="] + + lexflags = env.subst("$LEXFLAGS", target=target, source=source) + for option in SCons.Util.CLVar(lexflags): + for fileGenOption in fileGenOptions: + l = len(fileGenOption) + if option[:l] == fileGenOption: + # A file generating option is present, so add the + # file name to the target list. + fileName = option[l:].strip() + target.append(fileName) + return (target, source) + +def generate(env): + """Add Builders and construction variables for lex to an Environment.""" + c_file, cxx_file = SCons.Tool.createCFileBuilders(env) + + # C + c_file.add_action(".l", LexAction) + c_file.add_emitter(".l", lexEmitter) + + c_file.add_action(".lex", LexAction) + c_file.add_emitter(".lex", lexEmitter) + + # Objective-C + cxx_file.add_action(".lm", LexAction) + cxx_file.add_emitter(".lm", lexEmitter) + + # C++ + cxx_file.add_action(".ll", LexAction) + cxx_file.add_emitter(".ll", lexEmitter) + + env["LEX"] = env.Detect("flex") or "lex" + env["LEXFLAGS"] = SCons.Util.CLVar("") + env["LEXCOM"] = "$LEX $LEXFLAGS -t $SOURCES > $TARGET" + +def exists(env): + return env.Detect(["flex", "lex"]) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/link.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/link.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/link.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/link.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,185 @@ +"""SCons.Tool.link + +Tool-specific initialization for the generic Posix linker. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/link.py 2013/03/03 09:48:35 garyo" + +import re + +import SCons.Defaults +import SCons.Tool +import SCons.Util +import SCons.Warnings + +from SCons.Tool.FortranCommon import isfortran + +cplusplus = __import__('c++', globals(), locals(), []) + +issued_mixed_link_warning = False + +def smart_link(source, target, env, for_signature): + has_cplusplus = cplusplus.iscplusplus(source) + has_fortran = isfortran(env, source) + if has_cplusplus and has_fortran: + global issued_mixed_link_warning + if not issued_mixed_link_warning: + msg = "Using $CXX to link Fortran and C++ code together.\n\t" + \ + "This may generate a buggy executable if the '%s'\n\t" + \ + "compiler does not know how to deal with Fortran runtimes." + SCons.Warnings.warn(SCons.Warnings.FortranCxxMixWarning, + msg % env.subst('$CXX')) + issued_mixed_link_warning = True + return '$CXX' + elif has_fortran: + return '$FORTRAN' + elif has_cplusplus: + return '$CXX' + return '$CC' + +def shlib_emitter(target, source, env): + Verbose = False + platform = env.subst('$PLATFORM') + for tgt in target: + tgt.attributes.shared = 1 + try: + # target[0] comes in as libtest.so. Add the version extensions + version = env.subst('$SHLIBVERSION') + if version: + version_names = shlib_emitter_names(target, source, env) + # change the name of the target to include the version number + target[0].name = version_names[0] + for name in version_names: + env.SideEffect(name, target[0]) + env.Clean(target[0], name) + if Verbose: + print "shlib_emitter: add side effect - ",name + except KeyError: + version = None + return (target, source) + +def shlib_emitter_names(target, source, env): + """Return list of file names that are side effects for a versioned library build. The first name in the list is the new name for the target""" + Verbose = False + platform = env.subst('$PLATFORM') + version_names = [] + try: + # target[0] comes in as libtest.so. Add the version extensions + version = env.subst('$SHLIBVERSION') + if version.count(".") != 2: + # We need a version of the form x.y.z to proceed + raise ValueError + if version: + if platform == 'posix': + versionparts = version.split('.') + name = target[0].name + # generate library name with the version number + version_name = target[0].name + '.' + version + if Verbose: + print "shlib_emitter_names: target is ", version_name + print "shlib_emitter_names: side effect: ", name + # add version_name to list of names to be a Side effect + version_names.append(version_name) + if Verbose: + print "shlib_emitter_names: versionparts ",versionparts + for ver in versionparts[0:-1]: + name = name + '.' + ver + if Verbose: + print "shlib_emitter_names: side effect: ", name + # add name to list of names to be a Side effect + version_names.append(name) + elif platform == 'darwin': + shlib_suffix = env.subst('$SHLIBSUFFIX') + name = target[0].name + # generate library name with the version number + suffix_re = re.escape(shlib_suffix) + version_name = re.sub(suffix_re, '.' + version + shlib_suffix, name) + if Verbose: + print "shlib_emitter_names: target is ", version_name + print "shlib_emitter_names: side effect: ", name + # add version_name to list of names to be a Side effect + version_names.append(version_name) + except KeyError: + version = None + return version_names + +def generate(env): + """Add Builders and construction variables for gnulink to an Environment.""" + SCons.Tool.createSharedLibBuilder(env) + SCons.Tool.createProgBuilder(env) + + env['SHLINK'] = '$LINK' + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') + env['SHLINKCOM'] = '$SHLINK -o $TARGET $SHLINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' + # don't set up the emitter, cause AppendUnique will generate a list + # starting with None :-( + env.Append(SHLIBEMITTER = [shlib_emitter]) + env['SMARTLINK'] = smart_link + env['LINK'] = "$SMARTLINK" + env['LINKFLAGS'] = SCons.Util.CLVar('') + # __RPATH is only set to something ($_RPATH typically) on platforms that support it. + env['LINKCOM'] = '$LINK -o $TARGET $LINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' + env['LIBDIRPREFIX']='-L' + env['LIBDIRSUFFIX']='' + env['_LIBFLAGS']='${_stripixes(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, LIBPREFIXES, LIBSUFFIXES, __env__)}' + env['LIBLINKPREFIX']='-l' + env['LIBLINKSUFFIX']='' + + if env['PLATFORM'] == 'hpux': + env['SHLIBSUFFIX'] = '.sl' + elif env['PLATFORM'] == 'aix': + env['SHLIBSUFFIX'] = '.a' + + # For most platforms, a loadable module is the same as a shared + # library. Platforms which are different can override these, but + # setting them the same means that LoadableModule works everywhere. + SCons.Tool.createLoadableModuleBuilder(env) + env['LDMODULE'] = '$SHLINK' + # don't set up the emitter, cause AppendUnique will generate a list + # starting with None :-( + env.Append(LDMODULEEMITTER='$SHLIBEMITTER') + env['LDMODULEPREFIX'] = '$SHLIBPREFIX' + env['LDMODULESUFFIX'] = '$SHLIBSUFFIX' + env['LDMODULEFLAGS'] = '$SHLINKFLAGS' + env['LDMODULECOM'] = '$LDMODULE -o $TARGET $LDMODULEFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' + + + +def exists(env): + # This module isn't really a Tool on its own, it's common logic for + # other linkers. + return None + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/linkloc.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/linkloc.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/linkloc.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/linkloc.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,112 @@ +"""SCons.Tool.linkloc + +Tool specification for the LinkLoc linker for the Phar Lap ETS embedded +operating system. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/linkloc.py 2013/03/03 09:48:35 garyo" + +import os.path +import re + +import SCons.Action +import SCons.Defaults +import SCons.Errors +import SCons.Tool +import SCons.Util + +from SCons.Tool.MSCommon import msvs_exists, merge_default_version +from SCons.Tool.PharLapCommon import addPharLapPaths + +_re_linker_command = re.compile(r'(\s)@\s*([^\s]+)') + +def repl_linker_command(m): + # Replaces any linker command file directives (e.g. "@foo.lnk") with + # the actual contents of the file. + try: + f=open(m.group(2), "r") + return m.group(1) + f.read() + except IOError: + # the linker should return an error if it can't + # find the linker command file so we will remain quiet. + # However, we will replace the @ with a # so we will not continue + # to find it with recursive substitution + return m.group(1) + '#' + m.group(2) + +class LinklocGenerator(object): + def __init__(self, cmdline): + self.cmdline = cmdline + + def __call__(self, env, target, source, for_signature): + if for_signature: + # Expand the contents of any linker command files recursively + subs = 1 + strsub = env.subst(self.cmdline, target=target, source=source) + while subs: + strsub, subs = _re_linker_command.subn(repl_linker_command, strsub) + return strsub + else: + return "${TEMPFILE('" + self.cmdline + "')}" + +def generate(env): + """Add Builders and construction variables for ar to an Environment.""" + SCons.Tool.createSharedLibBuilder(env) + SCons.Tool.createProgBuilder(env) + + env['SUBST_CMD_FILE'] = LinklocGenerator + env['SHLINK'] = '$LINK' + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS') + env['SHLINKCOM'] = '${SUBST_CMD_FILE("$SHLINK $SHLINKFLAGS $_LIBDIRFLAGS $_LIBFLAGS -dll $TARGET $SOURCES")}' + env['SHLIBEMITTER']= None + env['LINK'] = "linkloc" + env['LINKFLAGS'] = SCons.Util.CLVar('') + env['LINKCOM'] = '${SUBST_CMD_FILE("$LINK $LINKFLAGS $_LIBDIRFLAGS $_LIBFLAGS -exe $TARGET $SOURCES")}' + env['LIBDIRPREFIX']='-libpath ' + env['LIBDIRSUFFIX']='' + env['LIBLINKPREFIX']='-lib ' + env['LIBLINKSUFFIX']='$LIBSUFFIX' + + # Set-up ms tools paths for default version + merge_default_version(env) + + addPharLapPaths(env) + +def exists(env): + if msvs_exists(): + return env.Detect('linkloc') + else: + return 0 + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/m4.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/m4.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/m4.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/m4.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,63 @@ +"""SCons.Tool.m4 + +Tool-specific initialization for m4. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/m4.py 2013/03/03 09:48:35 garyo" + +import SCons.Action +import SCons.Builder +import SCons.Util + +def generate(env): + """Add Builders and construction variables for m4 to an Environment.""" + M4Action = SCons.Action.Action('$M4COM', '$M4COMSTR') + bld = SCons.Builder.Builder(action = M4Action, src_suffix = '.m4') + + env['BUILDERS']['M4'] = bld + + # .m4 files might include other files, and it would be pretty hard + # to write a scanner for it, so let's just cd to the dir of the m4 + # file and run from there. + # The src_suffix setup is like so: file.c.m4 -> file.c, + # file.cpp.m4 -> file.cpp etc. + env['M4'] = 'm4' + env['M4FLAGS'] = SCons.Util.CLVar('-E') + env['M4COM'] = 'cd ${SOURCE.rsrcdir} && $M4 $M4FLAGS < ${SOURCE.file} > ${TARGET.abspath}' + +def exists(env): + return env.Detect('m4') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/masm.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/masm.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/masm.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/masm.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,77 @@ +"""SCons.Tool.masm + +Tool-specific initialization for the Microsoft Assembler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/masm.py 2013/03/03 09:48:35 garyo" + +import SCons.Defaults +import SCons.Tool +import SCons.Util + +ASSuffixes = ['.s', '.asm', '.ASM'] +ASPPSuffixes = ['.spp', '.SPP', '.sx'] +if SCons.Util.case_sensitive_suffixes('.s', '.S'): + ASPPSuffixes.extend(['.S']) +else: + ASSuffixes.extend(['.S']) + +def generate(env): + """Add Builders and construction variables for masm to an Environment.""" + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in ASSuffixes: + static_obj.add_action(suffix, SCons.Defaults.ASAction) + shared_obj.add_action(suffix, SCons.Defaults.ASAction) + static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) + shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter) + + for suffix in ASPPSuffixes: + static_obj.add_action(suffix, SCons.Defaults.ASPPAction) + shared_obj.add_action(suffix, SCons.Defaults.ASPPAction) + static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) + shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter) + + env['AS'] = 'ml' + env['ASFLAGS'] = SCons.Util.CLVar('/nologo') + env['ASPPFLAGS'] = '$ASFLAGS' + env['ASCOM'] = '$AS $ASFLAGS /c /Fo$TARGET $SOURCES' + env['ASPPCOM'] = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c /Fo$TARGET $SOURCES' + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 + +def exists(env): + return env.Detect('ml') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/midl.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/midl.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/midl.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/midl.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,88 @@ +"""SCons.Tool.midl + +Tool-specific initialization for midl (Microsoft IDL compiler). + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/midl.py 2013/03/03 09:48:35 garyo" + +import SCons.Action +import SCons.Builder +import SCons.Defaults +import SCons.Scanner.IDL +import SCons.Util + +from MSCommon import msvc_exists + +def midl_emitter(target, source, env): + """Produces a list of outputs from the MIDL compiler""" + base, ext = SCons.Util.splitext(str(target[0])) + tlb = target[0] + incl = base + '.h' + interface = base + '_i.c' + t = [tlb, incl, interface] + + midlcom = env['MIDLCOM'] + + if midlcom.find('/proxy') != -1: + proxy = base + '_p.c' + t.append(proxy) + if midlcom.find('/dlldata') != -1: + dlldata = base + '_data.c' + t.append(dlldata) + + return (t,source) + +idl_scanner = SCons.Scanner.IDL.IDLScan() + +midl_action = SCons.Action.Action('$MIDLCOM', '$MIDLCOMSTR') + +midl_builder = SCons.Builder.Builder(action = midl_action, + src_suffix = '.idl', + suffix='.tlb', + emitter = midl_emitter, + source_scanner = idl_scanner) + +def generate(env): + """Add Builders and construction variables for midl to an Environment.""" + + env['MIDL'] = 'MIDL.EXE' + env['MIDLFLAGS'] = SCons.Util.CLVar('/nologo') + env['MIDLCOM'] = '$MIDL $MIDLFLAGS /tlb ${TARGETS[0]} /h ${TARGETS[1]} /iid ${TARGETS[2]} /proxy ${TARGETS[3]} /dlldata ${TARGETS[4]} $SOURCE 2> NUL' + env['BUILDERS']['TypeLibrary'] = midl_builder + +def exists(env): + return msvc_exists() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/mingw.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/mingw.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/mingw.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/mingw.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,180 @@ +"""SCons.Tool.gcc + +Tool-specific initialization for MinGW (http://www.mingw.org/) + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/mingw.py 2013/03/03 09:48:35 garyo" + +import os +import os.path + +import SCons.Action +import SCons.Builder +import SCons.Defaults +import SCons.Tool +import SCons.Util + +# This is what we search for to find mingw: +key_program = 'mingw32-gcc' + +def find(env): + # First search in the SCons path + path=env.WhereIs(key_program) + if (path): + return path + # then the OS path: + path=SCons.Util.WhereIs(key_program) + if (path): + return path + + # If that doesn't work try default location for mingw + save_path=env['ENV']['PATH'] + env.AppendENVPath('PATH',r'c:\MinGW\bin') + path =env.WhereIs(key_program) + if not path: + env['ENV']['PATH']=save_path + return path + +def shlib_generator(target, source, env, for_signature): + cmd = SCons.Util.CLVar(['$SHLINK', '$SHLINKFLAGS']) + + dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') + if dll: cmd.extend(['-o', dll]) + + cmd.extend(['$SOURCES', '$_LIBDIRFLAGS', '$_LIBFLAGS']) + + implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') + if implib: cmd.append('-Wl,--out-implib,'+implib.get_string(for_signature)) + + def_target = env.FindIxes(target, 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') + insert_def = env.subst("$WINDOWS_INSERT_DEF") + if not insert_def in ['', '0', 0] and def_target: \ + cmd.append('-Wl,--output-def,'+def_target.get_string(for_signature)) + + return [cmd] + +def shlib_emitter(target, source, env): + dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') + no_import_lib = env.get('no_import_lib', 0) + + if not dll: + raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX")) + + if not no_import_lib and \ + not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'): + + # Create list of target libraries as strings + targetStrings=env.ReplaceIxes(dll, + 'SHLIBPREFIX', 'SHLIBSUFFIX', + 'LIBPREFIX', 'LIBSUFFIX') + + # Now add file nodes to target list + target.append(env.fs.File(targetStrings)) + + # Append a def file target if there isn't already a def file target + # or a def file source or the user has explicitly asked for the target + # to be emitted. + def_source = env.FindIxes(source, 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') + def_target = env.FindIxes(target, 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') + skip_def_insert = env.subst("$WINDOWS_INSERT_DEF") in ['', '0', 0] + if not def_source and not def_target and not skip_def_insert: + # Create list of target libraries and def files as strings + targetStrings=env.ReplaceIxes(dll, + 'SHLIBPREFIX', 'SHLIBSUFFIX', + 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') + + # Now add file nodes to target list + target.append(env.fs.File(targetStrings)) + + return (target, source) + + +shlib_action = SCons.Action.Action(shlib_generator, generator=1) + +res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR') + +res_builder = SCons.Builder.Builder(action=res_action, suffix='.o', + source_scanner=SCons.Tool.SourceFileScanner) +SCons.Tool.SourceFileScanner.add_scanner('.rc', SCons.Defaults.CScan) + +def generate(env): + mingw = find(env) + if mingw: + dir = os.path.dirname(mingw) + env.PrependENVPath('PATH', dir ) + + + # Most of mingw is the same as gcc and friends... + gnu_tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas', 'gfortran', 'm4'] + for tool in gnu_tools: + SCons.Tool.Tool(tool)(env) + + #... but a few things differ: + env['CC'] = 'gcc' + env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') + env['CXX'] = 'g++' + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') + env['SHLINKCOM'] = shlib_action + env['LDMODULECOM'] = shlib_action + env.Append(SHLIBEMITTER = [shlib_emitter]) + env['AS'] = 'as' + + env['WIN32DEFPREFIX'] = '' + env['WIN32DEFSUFFIX'] = '.def' + env['WINDOWSDEFPREFIX'] = '${WIN32DEFPREFIX}' + env['WINDOWSDEFSUFFIX'] = '${WIN32DEFSUFFIX}' + + env['SHOBJSUFFIX'] = '.o' + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 + + env['RC'] = 'windres' + env['RCFLAGS'] = SCons.Util.CLVar('') + env['RCINCFLAGS'] = '$( ${_concat(RCINCPREFIX, CPPPATH, RCINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['RCINCPREFIX'] = '--include-dir ' + env['RCINCSUFFIX'] = '' + env['RCCOM'] = '$RC $_CPPDEFFLAGS $RCINCFLAGS ${RCINCPREFIX} ${SOURCE.dir} $RCFLAGS -i $SOURCE -o $TARGET' + env['BUILDERS']['RES'] = res_builder + + # Some setting from the platform also have to be overridden: + env['OBJSUFFIX'] = '.o' + env['LIBPREFIX'] = 'lib' + env['LIBSUFFIX'] = '.a' + env['PROGSUFFIX'] = '.exe' + +def exists(env): + return find(env) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/msgfmt.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/msgfmt.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/msgfmt.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/msgfmt.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,108 @@ +""" msgfmt tool """ + +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/msgfmt.py 2013/03/03 09:48:35 garyo" + +from SCons.Builder import BuilderBase +############################################################################# +class _MOFileBuilder(BuilderBase): + """ The builder class for `MO` files. + + The reason for this builder to exists and its purpose is quite simillar + as for `_POFileBuilder`. This time, we extend list of sources, not targets, + and call `BuilderBase._execute()` only once (as we assume single-target + here). + """ + + def _execute(self, env, target, source, *args, **kw): + # Here we add support for 'LINGUAS_FILE' keyword. Emitter is not suitable + # in this case, as it is called too late (after multiple sources + # are handled single_source builder. + import SCons.Util + from SCons.Tool.GettextCommon import _read_linguas_from_files + linguas_files = None + if env.has_key('LINGUAS_FILE') and env['LINGUAS_FILE'] is not None: + linguas_files = env['LINGUAS_FILE'] + # This should prevent from endless recursion. + env['LINGUAS_FILE'] = None + # We read only languages. Suffixes shall be added automatically. + linguas = _read_linguas_from_files(env, linguas_files) + if SCons.Util.is_List(source): + source.extend(linguas) + elif source is not None: + source = [source] + linguas + else: + source = linguas + result = BuilderBase._execute(self,env,target,source,*args, **kw) + if linguas_files is not None: + env['LINGUAS_FILE'] = linguas_files + return result +############################################################################# + +############################################################################# +def _create_mo_file_builder(env, **kw): + """ Create builder object for `MOFiles` builder """ + import SCons.Action + # FIXME: What factory use for source? Ours or their? + kw['action'] = SCons.Action.Action('$MSGFMTCOM','$MSGFMTCOMSTR') + kw['suffix'] = '$MOSUFFIX' + kw['src_suffix'] = '$POSUFFIX' + kw['src_builder'] = '_POUpdateBuilder' + kw['single_source'] = True + return _MOFileBuilder(**kw) +############################################################################# + +############################################################################# +def generate(env,**kw): + """ Generate `msgfmt` tool """ + import SCons.Util + from SCons.Tool.GettextCommon import _detect_msgfmt + try: + env['MSGFMT'] = _detect_msgfmt(env) + except: + env['MSGFMT'] = 'msgfmt' + env.SetDefault( + MSGFMTFLAGS = [ SCons.Util.CLVar('-c') ], + MSGFMTCOM = '$MSGFMT $MSGFMTFLAGS -o $TARGET $SOURCE', + MSGFMTCOMSTR = '', + MOSUFFIX = ['.mo'], + POSUFFIX = ['.po'] + ) + env.Append( BUILDERS = { 'MOFiles' : _create_mo_file_builder(env) } ) +############################################################################# + +############################################################################# +def exists(env): + """ Check if the tool exists """ + from SCons.Tool.GettextCommon import _msgfmt_exists + try: + return _msgfmt_exists(env) + except: + return False +############################################################################# + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/msginit.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/msginit.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/msginit.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/msginit.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,120 @@ +""" msginit tool + +Tool specific initialization of msginit tool. +""" + +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/msginit.py 2013/03/03 09:48:35 garyo" + +import SCons.Warnings +import SCons.Builder +import re + +############################################################################# +def _optional_no_translator_flag(env): + """ Return '--no-translator' flag if we run *msginit(1)* in non-interactive + mode.""" + import SCons.Util + if env.has_key('POAUTOINIT'): + autoinit = env['POAUTOINIT'] + else: + autoinit = False + if autoinit: + return [SCons.Util.CLVar('--no-translator')] + else: + return [SCons.Util.CLVar('')] +############################################################################# + +############################################################################# +def _POInitBuilder(env, **kw): + """ Create builder object for `POInit` builder. """ + import SCons.Action + from SCons.Tool.GettextCommon import _init_po_files, _POFileBuilder + action = SCons.Action.Action(_init_po_files, None) + return _POFileBuilder(env, action=action, target_alias='$POCREATE_ALIAS') +############################################################################# + +############################################################################# +from SCons.Environment import _null +############################################################################# +def _POInitBuilderWrapper(env, target=None, source=_null, **kw): + """ Wrapper for _POFileBuilder. We use it to make user's life easier. + + This wrapper checks for `$POTDOMAIN` construction variable (or override in + `**kw`) and treats it appropriatelly. + """ + if source is _null: + if 'POTDOMAIN' in kw: + domain = kw['POTDOMAIN'] + elif env.has_key('POTDOMAIN'): + domain = env['POTDOMAIN'] + else: + domain = 'messages' + source = [ domain ] # NOTE: Suffix shall be appended automatically + return env._POInitBuilder(target, source, **kw) +############################################################################# + +############################################################################# +def generate(env,**kw): + """ Generate the `msginit` tool """ + import SCons.Util + from SCons.Tool.GettextCommon import _detect_msginit + try: + env['MSGINIT'] = _detect_msginit(env) + except: + env['MSGINIT'] = 'msginit' + msginitcom = '$MSGINIT ${_MSGNoTranslator(__env__)} -l ${_MSGINITLOCALE}' \ + + ' $MSGINITFLAGS -i $SOURCE -o $TARGET' + # NOTE: We set POTSUFFIX here, in case the 'xgettext' is not loaded + # (sometimes we really don't need it) + env.SetDefault( + POSUFFIX = ['.po'], + POTSUFFIX = ['.pot'], + _MSGINITLOCALE = '${TARGET.filebase}', + _MSGNoTranslator = _optional_no_translator_flag, + MSGINITCOM = msginitcom, + MSGINITCOMSTR = '', + MSGINITFLAGS = [ ], + POAUTOINIT = False, + POCREATE_ALIAS = 'po-create' + ) + env.Append( BUILDERS = { '_POInitBuilder' : _POInitBuilder(env) } ) + env.AddMethod(_POInitBuilderWrapper, 'POInit') + env.AlwaysBuild(env.Alias('$POCREATE_ALIAS')) +############################################################################# + +############################################################################# +def exists(env): + """ Check if the tool exists """ + from SCons.Tool.GettextCommon import _msginit_exists + try: + return _msginit_exists(env) + except: + return False +############################################################################# + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/msgmerge.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/msgmerge.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/msgmerge.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/msgmerge.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,104 @@ +""" msgmerget tool + +Tool specific initialization for `msgmerge` tool. +""" + +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/msgmerge.py 2013/03/03 09:48:35 garyo" + +############################################################################# +def _update_or_init_po_files(target, source, env): + """ Action function for `POUpdate` builder """ + import SCons.Action + from SCons.Tool.GettextCommon import _init_po_files + for tgt in target: + if tgt.rexists(): + action = SCons.Action.Action('$MSGMERGECOM', '$MSGMERGECOMSTR') + else: + action = _init_po_files + status = action([tgt], source, env) + if status : return status + return 0 +############################################################################# + +############################################################################# +def _POUpdateBuilder(env, **kw): + """ Create an object of `POUpdate` builder """ + import SCons.Action + from SCons.Tool.GettextCommon import _POFileBuilder + action = SCons.Action.Action(_update_or_init_po_files, None) + return _POFileBuilder(env, action=action, target_alias='$POUPDATE_ALIAS') +############################################################################# + +############################################################################# +from SCons.Environment import _null +############################################################################# +def _POUpdateBuilderWrapper(env, target=None, source=_null, **kw): + """ Wrapper for `POUpdate` builder - make user's life easier """ + if source is _null: + if 'POTDOMAIN' in kw: + domain = kw['POTDOMAIN'] + elif env.has_key('POTDOMAIN') and env['POTDOMAIN']: + domain = env['POTDOMAIN'] + else: + domain = 'messages' + source = [ domain ] # NOTE: Suffix shall be appended automatically + return env._POUpdateBuilder(target, source, **kw) +############################################################################# + +############################################################################# +def generate(env,**kw): + """ Generate the `xgettext` tool """ + from SCons.Tool.GettextCommon import _detect_msgmerge + try: + env['MSGMERGE'] = _detect_msgmerge(env) + except: + env['MSGMERGE'] = 'msgmerge' + env.SetDefault( + POTSUFFIX = ['.pot'], + POSUFFIX = ['.po'], + MSGMERGECOM = '$MSGMERGE $MSGMERGEFLAGS --update $TARGET $SOURCE', + MSGMERGECOMSTR = '', + MSGMERGEFLAGS = [ ], + POUPDATE_ALIAS = 'po-update' + ) + env.Append(BUILDERS = { '_POUpdateBuilder':_POUpdateBuilder(env) }) + env.AddMethod(_POUpdateBuilderWrapper, 'POUpdate') + env.AlwaysBuild(env.Alias('$POUPDATE_ALIAS')) +############################################################################# + +############################################################################# +def exists(env): + """ Check if the tool exists """ + from SCons.Tool.GettextCommon import _msgmerge_exists + try: + return _msgmerge_exists(env) + except: + return False +############################################################################# + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/mslib.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/mslib.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/mslib.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/mslib.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,64 @@ +"""SCons.Tool.mslib + +Tool-specific initialization for lib (MicroSoft library archiver). + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/mslib.py 2013/03/03 09:48:35 garyo" + +import SCons.Defaults +import SCons.Tool +import SCons.Tool.msvs +import SCons.Tool.msvc +import SCons.Util + +from MSCommon import msvc_exists, msvc_setup_env_once + +def generate(env): + """Add Builders and construction variables for lib to an Environment.""" + SCons.Tool.createStaticLibBuilder(env) + + # Set-up ms tools paths + msvc_setup_env_once(env) + + env['AR'] = 'lib' + env['ARFLAGS'] = SCons.Util.CLVar('/nologo') + env['ARCOM'] = "${TEMPFILE('$AR $ARFLAGS /OUT:$TARGET $SOURCES')}" + env['LIBPREFIX'] = '' + env['LIBSUFFIX'] = '.lib' + +def exists(env): + return msvc_exists() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/mslink.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/mslink.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/mslink.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/mslink.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,327 @@ +"""SCons.Tool.mslink + +Tool-specific initialization for the Microsoft linker. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/mslink.py 2013/03/03 09:48:35 garyo" + +import os.path + +import SCons.Action +import SCons.Defaults +import SCons.Errors +import SCons.Platform.win32 +import SCons.Tool +import SCons.Tool.msvc +import SCons.Tool.msvs +import SCons.Util + +from MSCommon import msvc_setup_env_once, msvc_exists + +def pdbGenerator(env, target, source, for_signature): + try: + return ['/PDB:%s' % target[0].attributes.pdb, '/DEBUG'] + except (AttributeError, IndexError): + return None + +def _dllTargets(target, source, env, for_signature, paramtp): + listCmd = [] + dll = env.FindIxes(target, '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp) + if dll: listCmd.append("/out:%s"%dll.get_string(for_signature)) + + implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') + if implib: listCmd.append("/implib:%s"%implib.get_string(for_signature)) + + return listCmd + +def _dllSources(target, source, env, for_signature, paramtp): + listCmd = [] + + deffile = env.FindIxes(source, "WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX") + for src in source: + # Check explicitly for a non-None deffile so that the __cmp__ + # method of the base SCons.Util.Proxy class used for some Node + # proxies doesn't try to use a non-existent __dict__ attribute. + if deffile and src == deffile: + # Treat this source as a .def file. + listCmd.append("/def:%s" % src.get_string(for_signature)) + else: + # Just treat it as a generic source file. + listCmd.append(src) + return listCmd + +def windowsShlinkTargets(target, source, env, for_signature): + return _dllTargets(target, source, env, for_signature, 'SHLIB') + +def windowsShlinkSources(target, source, env, for_signature): + return _dllSources(target, source, env, for_signature, 'SHLIB') + +def _windowsLdmodTargets(target, source, env, for_signature): + """Get targets for loadable modules.""" + return _dllTargets(target, source, env, for_signature, 'LDMODULE') + +def _windowsLdmodSources(target, source, env, for_signature): + """Get sources for loadable modules.""" + return _dllSources(target, source, env, for_signature, 'LDMODULE') + +def _dllEmitter(target, source, env, paramtp): + """Common implementation of dll emitter.""" + SCons.Tool.msvc.validate_vars(env) + + extratargets = [] + extrasources = [] + + dll = env.FindIxes(target, '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp) + no_import_lib = env.get('no_import_lib', 0) + + if not dll: + raise SCons.Errors.UserError('A shared library should have exactly one target with the suffix: %s' % env.subst('$%sSUFFIX' % paramtp)) + + insert_def = env.subst("$WINDOWS_INSERT_DEF") + if not insert_def in ['', '0', 0] and \ + not env.FindIxes(source, "WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX"): + + # append a def file to the list of sources + extrasources.append( + env.ReplaceIxes(dll, + '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp, + "WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX")) + + version_num, suite = SCons.Tool.msvs.msvs_parse_version(env.get('MSVS_VERSION', '6.0')) + if version_num >= 8.0 and \ + (env.get('WINDOWS_INSERT_MANIFEST', 0) or env.get('WINDOWS_EMBED_MANIFEST', 0)): + # MSVC 8 and above automatically generate .manifest files that must be installed + extratargets.append( + env.ReplaceIxes(dll, + '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp, + "WINDOWSSHLIBMANIFESTPREFIX", "WINDOWSSHLIBMANIFESTSUFFIX")) + + if 'PDB' in env and env['PDB']: + pdb = env.arg2nodes('$PDB', target=target, source=source)[0] + extratargets.append(pdb) + target[0].attributes.pdb = pdb + + if not no_import_lib and \ + not env.FindIxes(target, "LIBPREFIX", "LIBSUFFIX"): + # Append an import library to the list of targets. + extratargets.append( + env.ReplaceIxes(dll, + '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp, + "LIBPREFIX", "LIBSUFFIX")) + # and .exp file is created if there are exports from a DLL + extratargets.append( + env.ReplaceIxes(dll, + '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp, + "WINDOWSEXPPREFIX", "WINDOWSEXPSUFFIX")) + + return (target+extratargets, source+extrasources) + +def windowsLibEmitter(target, source, env): + return _dllEmitter(target, source, env, 'SHLIB') + +def ldmodEmitter(target, source, env): + """Emitter for loadable modules. + + Loadable modules are identical to shared libraries on Windows, but building + them is subject to different parameters (LDMODULE*). + """ + return _dllEmitter(target, source, env, 'LDMODULE') + +def prog_emitter(target, source, env): + SCons.Tool.msvc.validate_vars(env) + + extratargets = [] + extrasources = [] + + exe = env.FindIxes(target, "PROGPREFIX", "PROGSUFFIX") + if not exe: + raise SCons.Errors.UserError("An executable should have exactly one target with the suffix: %s" % env.subst("$PROGSUFFIX")) + + version_num, suite = SCons.Tool.msvs.msvs_parse_version(env.get('MSVS_VERSION', '6.0')) + if version_num >= 8.0 and \ + (env.get('WINDOWS_INSERT_MANIFEST', 0) or env.get('WINDOWS_EMBED_MANIFEST', 0)): + # MSVC 8 and above automatically generate .manifest files that have to be installed + extratargets.append( + env.ReplaceIxes(exe, + "PROGPREFIX", "PROGSUFFIX", + "WINDOWSPROGMANIFESTPREFIX", "WINDOWSPROGMANIFESTSUFFIX")) + + if 'PDB' in env and env['PDB']: + pdb = env.arg2nodes('$PDB', target=target, source=source)[0] + extratargets.append(pdb) + target[0].attributes.pdb = pdb + + if version_num >= 11.0 and env.get('PCH', 0): + # MSVC 11 and above need the PCH object file to be added to the link line, + # otherwise you get link error LNK2011. + pchobj = SCons.Util.splitext(str(env['PCH']))[0] + '.obj' + # print "prog_emitter, version %s, appending pchobj %s"%(version_num, pchobj) + if pchobj not in extrasources: + extrasources.append(pchobj) + + return (target+extratargets,source+extrasources) + +def RegServerFunc(target, source, env): + if 'register' in env and env['register']: + ret = regServerAction([target[0]], [source[0]], env) + if ret: + raise SCons.Errors.UserError("Unable to register %s" % target[0]) + else: + print "Registered %s sucessfully" % target[0] + return ret + return 0 + +# These are the actual actions run to embed the manifest. +# They are only called from the Check versions below. +embedManifestExeAction = SCons.Action.Action('$MTEXECOM') +embedManifestDllAction = SCons.Action.Action('$MTSHLIBCOM') + +def embedManifestDllCheck(target, source, env): + """Function run by embedManifestDllCheckAction to check for existence of manifest + and other conditions, and embed the manifest by calling embedManifestDllAction if so.""" + if env.get('WINDOWS_EMBED_MANIFEST', 0): + manifestSrc = target[0].abspath + '.manifest' + if os.path.exists(manifestSrc): + ret = (embedManifestDllAction) ([target[0]],None,env) + if ret: + raise SCons.Errors.UserError, "Unable to embed manifest into %s" % (target[0]) + return ret + else: + print '(embed: no %s.manifest found; not embedding.)'%str(target[0]) + return 0 + +def embedManifestExeCheck(target, source, env): + """Function run by embedManifestExeCheckAction to check for existence of manifest + and other conditions, and embed the manifest by calling embedManifestExeAction if so.""" + if env.get('WINDOWS_EMBED_MANIFEST', 0): + manifestSrc = target[0].abspath + '.manifest' + if os.path.exists(manifestSrc): + ret = (embedManifestExeAction) ([target[0]],None,env) + if ret: + raise SCons.Errors.UserError, "Unable to embed manifest into %s" % (target[0]) + return ret + else: + print '(embed: no %s.manifest found; not embedding.)'%str(target[0]) + return 0 + +embedManifestDllCheckAction = SCons.Action.Action(embedManifestDllCheck, None) +embedManifestExeCheckAction = SCons.Action.Action(embedManifestExeCheck, None) + +regServerAction = SCons.Action.Action("$REGSVRCOM", "$REGSVRCOMSTR") +regServerCheck = SCons.Action.Action(RegServerFunc, None) +shlibLinkAction = SCons.Action.Action('${TEMPFILE("$SHLINK $SHLINKFLAGS $_SHLINK_TARGETS $_LIBDIRFLAGS $_LIBFLAGS $_PDB $_SHLINK_SOURCES")}', '$SHLINKCOMSTR') +compositeShLinkAction = shlibLinkAction + regServerCheck + embedManifestDllCheckAction +ldmodLinkAction = SCons.Action.Action('${TEMPFILE("$LDMODULE $LDMODULEFLAGS $_LDMODULE_TARGETS $_LIBDIRFLAGS $_LIBFLAGS $_PDB $_LDMODULE_SOURCES")}', '$LDMODULECOMSTR') +compositeLdmodAction = ldmodLinkAction + regServerCheck + embedManifestDllCheckAction +exeLinkAction = SCons.Action.Action('${TEMPFILE("$LINK $LINKFLAGS /OUT:$TARGET.windows $_LIBDIRFLAGS $_LIBFLAGS $_PDB $SOURCES.windows")}', '$LINKCOMSTR') +compositeLinkAction = exeLinkAction + embedManifestExeCheckAction + +def generate(env): + """Add Builders and construction variables for ar to an Environment.""" + SCons.Tool.createSharedLibBuilder(env) + SCons.Tool.createProgBuilder(env) + + env['SHLINK'] = '$LINK' + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS /dll') + env['_SHLINK_TARGETS'] = windowsShlinkTargets + env['_SHLINK_SOURCES'] = windowsShlinkSources + env['SHLINKCOM'] = compositeShLinkAction + env.Append(SHLIBEMITTER = [windowsLibEmitter]) + env['LINK'] = 'link' + env['LINKFLAGS'] = SCons.Util.CLVar('/nologo') + env['_PDB'] = pdbGenerator + env['LINKCOM'] = compositeLinkAction + env.Append(PROGEMITTER = [prog_emitter]) + env['LIBDIRPREFIX']='/LIBPATH:' + env['LIBDIRSUFFIX']='' + env['LIBLINKPREFIX']='' + env['LIBLINKSUFFIX']='$LIBSUFFIX' + + env['WIN32DEFPREFIX'] = '' + env['WIN32DEFSUFFIX'] = '.def' + env['WIN32_INSERT_DEF'] = 0 + env['WINDOWSDEFPREFIX'] = '${WIN32DEFPREFIX}' + env['WINDOWSDEFSUFFIX'] = '${WIN32DEFSUFFIX}' + env['WINDOWS_INSERT_DEF'] = '${WIN32_INSERT_DEF}' + + env['WIN32EXPPREFIX'] = '' + env['WIN32EXPSUFFIX'] = '.exp' + env['WINDOWSEXPPREFIX'] = '${WIN32EXPPREFIX}' + env['WINDOWSEXPSUFFIX'] = '${WIN32EXPSUFFIX}' + + env['WINDOWSSHLIBMANIFESTPREFIX'] = '' + env['WINDOWSSHLIBMANIFESTSUFFIX'] = '${SHLIBSUFFIX}.manifest' + env['WINDOWSPROGMANIFESTPREFIX'] = '' + env['WINDOWSPROGMANIFESTSUFFIX'] = '${PROGSUFFIX}.manifest' + + env['REGSVRACTION'] = regServerCheck + env['REGSVR'] = os.path.join(SCons.Platform.win32.get_system_root(),'System32','regsvr32') + env['REGSVRFLAGS'] = '/s ' + env['REGSVRCOM'] = '$REGSVR $REGSVRFLAGS ${TARGET.windows}' + + env['WINDOWS_EMBED_MANIFEST'] = 0 + env['MT'] = 'mt' + #env['MTFLAGS'] = ['-hashupdate'] + env['MTFLAGS'] = SCons.Util.CLVar('/nologo') + # Note: use - here to prevent build failure if no manifest produced. + # This seems much simpler than a fancy system using a function action to see + # if the manifest actually exists before trying to run mt with it. + env['MTEXECOM'] = '-$MT $MTFLAGS -manifest ${TARGET}.manifest $_MANIFEST_SOURCES -outputresource:$TARGET;1' + env['MTSHLIBCOM'] = '-$MT $MTFLAGS -manifest ${TARGET}.manifest $_MANIFEST_SOURCES -outputresource:$TARGET;2' + # Future work garyo 27-Feb-11 + env['_MANIFEST_SOURCES'] = None # _windowsManifestSources + + # Set-up ms tools paths + msvc_setup_env_once(env) + + + # Loadable modules are on Windows the same as shared libraries, but they + # are subject to different build parameters (LDMODULE* variables). + # Therefore LDMODULE* variables correspond as much as possible to + # SHLINK*/SHLIB* ones. + SCons.Tool.createLoadableModuleBuilder(env) + env['LDMODULE'] = '$SHLINK' + env['LDMODULEPREFIX'] = '$SHLIBPREFIX' + env['LDMODULESUFFIX'] = '$SHLIBSUFFIX' + env['LDMODULEFLAGS'] = '$SHLINKFLAGS' + env['_LDMODULE_TARGETS'] = _windowsLdmodTargets + env['_LDMODULE_SOURCES'] = _windowsLdmodSources + env['LDMODULEEMITTER'] = [ldmodEmitter] + env['LDMODULECOM'] = compositeLdmodAction + +def exists(env): + return msvc_exists() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/mssdk.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/mssdk.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/mssdk.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/mssdk.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,50 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/mssdk.py 2013/03/03 09:48:35 garyo" + +"""engine.SCons.Tool.mssdk + +Tool-specific initialization for Microsoft SDKs, both Platform +SDKs and Windows SDKs. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +from MSCommon import mssdk_exists, \ + mssdk_setup_env + +def generate(env): + """Add construction variables for an MS SDK to an Environment.""" + mssdk_setup_env(env) + +def exists(env): + return mssdk_exists() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/msvc.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/msvc.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/msvc.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/msvc.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,278 @@ +"""engine.SCons.Tool.msvc + +Tool-specific initialization for Microsoft Visual C/C++. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/msvc.py 2013/03/03 09:48:35 garyo" + +import os.path +import re +import sys + +import SCons.Action +import SCons.Builder +import SCons.Errors +import SCons.Platform.win32 +import SCons.Tool +import SCons.Tool.msvs +import SCons.Util +import SCons.Warnings +import SCons.Scanner.RC + +from MSCommon import msvc_exists, msvc_setup_env_once + +CSuffixes = ['.c', '.C'] +CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++'] + +def validate_vars(env): + """Validate the PCH and PCHSTOP construction variables.""" + if 'PCH' in env and env['PCH']: + if 'PCHSTOP' not in env: + raise SCons.Errors.UserError("The PCHSTOP construction must be defined if PCH is defined.") + if not SCons.Util.is_String(env['PCHSTOP']): + raise SCons.Errors.UserError("The PCHSTOP construction variable must be a string: %r"%env['PCHSTOP']) + +def pch_emitter(target, source, env): + """Adds the object file target.""" + + validate_vars(env) + + pch = None + obj = None + + for t in target: + if SCons.Util.splitext(str(t))[1] == '.pch': + pch = t + if SCons.Util.splitext(str(t))[1] == '.obj': + obj = t + + if not obj: + obj = SCons.Util.splitext(str(pch))[0]+'.obj' + + target = [pch, obj] # pch must be first, and obj second for the PCHCOM to work + + return (target, source) + +def object_emitter(target, source, env, parent_emitter): + """Sets up the PCH dependencies for an object file.""" + + validate_vars(env) + + parent_emitter(target, source, env) + + # Add a dependency, but only if the target (e.g. 'Source1.obj') + # doesn't correspond to the pre-compiled header ('Source1.pch'). + # If the basenames match, then this was most likely caused by + # someone adding the source file to both the env.PCH() and the + # env.Program() calls, and adding the explicit dependency would + # cause a cycle on the .pch file itself. + # + # See issue #2505 for a discussion of what to do if it turns + # out this assumption causes trouble in the wild: + # http://scons.tigris.org/issues/show_bug.cgi?id=2505 + if 'PCH' in env: + pch = env['PCH'] + if str(target[0]) != SCons.Util.splitext(str(pch))[0] + '.obj': + env.Depends(target, pch) + + return (target, source) + +def static_object_emitter(target, source, env): + return object_emitter(target, source, env, + SCons.Defaults.StaticObjectEmitter) + +def shared_object_emitter(target, source, env): + return object_emitter(target, source, env, + SCons.Defaults.SharedObjectEmitter) + +pch_action = SCons.Action.Action('$PCHCOM', '$PCHCOMSTR') +pch_builder = SCons.Builder.Builder(action=pch_action, suffix='.pch', + emitter=pch_emitter, + source_scanner=SCons.Tool.SourceFileScanner) + + +# Logic to build .rc files into .res files (resource files) +res_scanner = SCons.Scanner.RC.RCScan() +res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR') +res_builder = SCons.Builder.Builder(action=res_action, + src_suffix='.rc', + suffix='.res', + src_builder=[], + source_scanner=res_scanner) + +def msvc_batch_key(action, env, target, source): + """ + Returns a key to identify unique batches of sources for compilation. + + If batching is enabled (via the $MSVC_BATCH setting), then all + target+source pairs that use the same action, defined by the same + environment, and have the same target and source directories, will + be batched. + + Returning None specifies that the specified target+source should not + be batched with other compilations. + """ + + # Fixing MSVC_BATCH mode. Previous if did not work when MSVC_BATCH + # was set to False. This new version should work better. + # Note we need to do the env.subst so $MSVC_BATCH can be a reference to + # another construction variable, which is why we test for False and 0 + # as strings. + if not 'MSVC_BATCH' in env or env.subst('$MSVC_BATCH') in ('0', 'False', '', None): + # We're not using batching; return no key. + return None + t = target[0] + s = source[0] + if os.path.splitext(t.name)[0] != os.path.splitext(s.name)[0]: + # The base names are different, so this *must* be compiled + # separately; return no key. + return None + return (id(action), id(env), t.dir, s.dir) + +def msvc_output_flag(target, source, env, for_signature): + """ + Returns the correct /Fo flag for batching. + + If batching is disabled or there's only one source file, then we + return an /Fo string that specifies the target explicitly. Otherwise, + we return an /Fo string that just specifies the first target's + directory (where the Visual C/C++ compiler will put the .obj files). + """ + + # Fixing MSVC_BATCH mode. Previous if did not work when MSVC_BATCH + # was set to False. This new version should work better. Removed + # len(source)==1 as batch mode can compile only one file + # (and it also fixed problem with compiling only one changed file + # with batch mode enabled) + if not 'MSVC_BATCH' in env or env.subst('$MSVC_BATCH') in ('0', 'False', '', None): + return '/Fo$TARGET' + else: + # The Visual C/C++ compiler requires a \ at the end of the /Fo + # option to indicate an output directory. We use os.sep here so + # that the test(s) for this can be run on non-Windows systems + # without having a hard-coded backslash mess up command-line + # argument parsing. + return '/Fo${TARGET.dir}' + os.sep + +CAction = SCons.Action.Action("$CCCOM", "$CCCOMSTR", + batch_key=msvc_batch_key, + targets='$CHANGED_TARGETS') +ShCAction = SCons.Action.Action("$SHCCCOM", "$SHCCCOMSTR", + batch_key=msvc_batch_key, + targets='$CHANGED_TARGETS') +CXXAction = SCons.Action.Action("$CXXCOM", "$CXXCOMSTR", + batch_key=msvc_batch_key, + targets='$CHANGED_TARGETS') +ShCXXAction = SCons.Action.Action("$SHCXXCOM", "$SHCXXCOMSTR", + batch_key=msvc_batch_key, + targets='$CHANGED_TARGETS') + +def generate(env): + """Add Builders and construction variables for MSVC++ to an Environment.""" + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + # TODO(batch): shouldn't reach in to cmdgen this way; necessary + # for now to bypass the checks in Builder.DictCmdGenerator.__call__() + # and allow .cc and .cpp to be compiled in the same command line. + static_obj.cmdgen.source_ext_match = False + shared_obj.cmdgen.source_ext_match = False + + for suffix in CSuffixes: + static_obj.add_action(suffix, CAction) + shared_obj.add_action(suffix, ShCAction) + static_obj.add_emitter(suffix, static_object_emitter) + shared_obj.add_emitter(suffix, shared_object_emitter) + + for suffix in CXXSuffixes: + static_obj.add_action(suffix, CXXAction) + shared_obj.add_action(suffix, ShCXXAction) + static_obj.add_emitter(suffix, static_object_emitter) + shared_obj.add_emitter(suffix, shared_object_emitter) + + env['CCPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Z7") or ""}']) + env['CCPCHFLAGS'] = SCons.Util.CLVar(['${(PCH and "/Yu%s \\\"/Fp%s\\\""%(PCHSTOP or "",File(PCH))) or ""}']) + env['_MSVC_OUTPUT_FLAG'] = msvc_output_flag + env['_CCCOMCOM'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $CCPCHFLAGS $CCPDBFLAGS' + env['CC'] = 'cl' + env['CCFLAGS'] = SCons.Util.CLVar('/nologo') + env['CFLAGS'] = SCons.Util.CLVar('') + env['CCCOM'] = '${TEMPFILE("$CC $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $CFLAGS $CCFLAGS $_CCCOMCOM")}' + env['SHCC'] = '$CC' + env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') + env['SHCFLAGS'] = SCons.Util.CLVar('$CFLAGS') + env['SHCCCOM'] = '${TEMPFILE("$SHCC $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $SHCFLAGS $SHCCFLAGS $_CCCOMCOM")}' + env['CXX'] = '$CC' + env['CXXFLAGS'] = SCons.Util.CLVar('$( /TP $)') + env['CXXCOM'] = '${TEMPFILE("$CXX $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $CXXFLAGS $CCFLAGS $_CCCOMCOM")}' + env['SHCXX'] = '$CXX' + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') + env['SHCXXCOM'] = '${TEMPFILE("$SHCXX $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $SHCXXFLAGS $SHCCFLAGS $_CCCOMCOM")}' + env['CPPDEFPREFIX'] = '/D' + env['CPPDEFSUFFIX'] = '' + env['INCPREFIX'] = '/I' + env['INCSUFFIX'] = '' +# env.Append(OBJEMITTER = [static_object_emitter]) +# env.Append(SHOBJEMITTER = [shared_object_emitter]) + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 + + env['RC'] = 'rc' + env['RCFLAGS'] = SCons.Util.CLVar('') + env['RCSUFFIXES']=['.rc','.rc2'] + env['RCCOM'] = '$RC $_CPPDEFFLAGS $_CPPINCFLAGS $RCFLAGS /fo$TARGET $SOURCES' + env['BUILDERS']['RES'] = res_builder + env['OBJPREFIX'] = '' + env['OBJSUFFIX'] = '.obj' + env['SHOBJPREFIX'] = '$OBJPREFIX' + env['SHOBJSUFFIX'] = '$OBJSUFFIX' + + # Set-up ms tools paths + msvc_setup_env_once(env) + + env['CFILESUFFIX'] = '.c' + env['CXXFILESUFFIX'] = '.cc' + + env['PCHPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Yd") or ""}']) + env['PCHCOM'] = '$CXX /Fo${TARGETS[1]} $CXXFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS $PCHPDBFLAGS' + env['BUILDERS']['PCH'] = pch_builder + + if 'ENV' not in env: + env['ENV'] = {} + if 'SystemRoot' not in env['ENV']: # required for dlls in the winsxs folders + env['ENV']['SystemRoot'] = SCons.Platform.win32.get_system_root() + +def exists(env): + return msvc_exists() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/msvs.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/msvs.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/msvs.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/msvs.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,1803 @@ +"""SCons.Tool.msvs + +Tool-specific initialization for Microsoft Visual Studio project files. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/msvs.py 2013/03/03 09:48:35 garyo" + +import SCons.compat + +import base64 +import hashlib +import ntpath +import os +# compat layer imports "cPickle" for us if it's available. +import pickle +import re +import sys + +import SCons.Builder +import SCons.Node.FS +import SCons.Platform.win32 +import SCons.Script.SConscript +import SCons.PathList +import SCons.Util +import SCons.Warnings + +from MSCommon import msvc_exists, msvc_setup_env_once +from SCons.Defaults import processDefines + +############################################################################## +# Below here are the classes and functions for generation of +# DSP/DSW/SLN/VCPROJ files. +############################################################################## + +def xmlify(s): + s = s.replace("&", "&") # do this first + s = s.replace("'", "'") + s = s.replace('"', """) + return s + +# Process a CPPPATH list in includes, given the env, target and source. +# Returns a tuple of nodes. +def processIncludes(includes, env, target, source): + return SCons.PathList.PathList(includes).subst_path(env, target, source) + + +external_makefile_guid = '{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}' + +def _generateGUID(slnfile, name): + """This generates a dummy GUID for the sln file to use. It is + based on the MD5 signatures of the sln filename plus the name of + the project. It basically just needs to be unique, and not + change with each invocation.""" + m = hashlib.md5() + # Normalize the slnfile path to a Windows path (\ separators) so + # the generated file has a consistent GUID even if we generate + # it on a non-Windows platform. + m.update(ntpath.normpath(str(slnfile)) + str(name)) + solution = m.hexdigest().upper() + # convert most of the signature to GUID form (discard the rest) + solution = "{" + solution[:8] + "-" + solution[8:12] + "-" + solution[12:16] + "-" + solution[16:20] + "-" + solution[20:32] + "}" + return solution + +version_re = re.compile(r'(\d+\.\d+)(.*)') + +def msvs_parse_version(s): + """ + Split a Visual Studio version, which may in fact be something like + '7.0Exp', into is version number (returned as a float) and trailing + "suite" portion. + """ + num, suite = version_re.match(s).groups() + return float(num), suite + +# os.path.relpath has been introduced in Python 2.6 +# We define it locally for earlier versions of Python +def relpath(path, start=os.path.curdir): + """Return a relative version of a path""" + import sys + if not path: + raise ValueError("no path specified") + start_list = os.path.abspath(start).split(os.sep) + path_list = os.path.abspath(path).split(os.sep) + if 'posix' in sys.builtin_module_names: + # Work out how much of the filepath is shared by start and path. + i = len(os.path.commonprefix([start_list, path_list])) + else: + if start_list[0].lower() != path_list[0].lower(): + unc_path, rest = os.path.splitunc(path) + unc_start, rest = os.path.splitunc(start) + if bool(unc_path) ^ bool(unc_start): + raise ValueError("Cannot mix UNC and non-UNC paths (%s and %s)" + % (path, start)) + else: + raise ValueError("path is on drive %s, start on drive %s" + % (path_list[0], start_list[0])) + # Work out how much of the filepath is shared by start and path. + for i in range(min(len(start_list), len(path_list))): + if start_list[i].lower() != path_list[i].lower(): + break + else: + i += 1 + rel_list = [os.pardir] * (len(start_list)-i) + path_list[i:] + if not rel_list: + return os.path.curdir + return os.path.join(*rel_list) + +if not "relpath" in os.path.__all__: + os.path.relpath = relpath + +# This is how we re-invoke SCons from inside MSVS Project files. +# The problem is that we might have been invoked as either scons.bat +# or scons.py. If we were invoked directly as scons.py, then we could +# use sys.argv[0] to find the SCons "executable," but that doesn't work +# if we were invoked as scons.bat, which uses "python -c" to execute +# things and ends up with "-c" as sys.argv[0]. Consequently, we have +# the MSVS Project file invoke SCons the same way that scons.bat does, +# which works regardless of how we were invoked. +def getExecScriptMain(env, xml=None): + scons_home = env.get('SCONS_HOME') + if not scons_home and 'SCONS_LIB_DIR' in os.environ: + scons_home = os.environ['SCONS_LIB_DIR'] + if scons_home: + exec_script_main = "from os.path import join; import sys; sys.path = [ r'%s' ] + sys.path; import SCons.Script; SCons.Script.main()" % scons_home + else: + version = SCons.__version__ + exec_script_main = "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-%(version)s'), join(sys.prefix, 'scons-%(version)s'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons') ] + sys.path; import SCons.Script; SCons.Script.main()" % locals() + if xml: + exec_script_main = xmlify(exec_script_main) + return exec_script_main + +# The string for the Python executable we tell the Project file to use +# is either sys.executable or, if an external PYTHON_ROOT environment +# variable exists, $(PYTHON)ROOT\\python.exe (generalized a little to +# pluck the actual executable name from sys.executable). +try: + python_root = os.environ['PYTHON_ROOT'] +except KeyError: + python_executable = sys.executable +else: + python_executable = os.path.join('$$(PYTHON_ROOT)', + os.path.split(sys.executable)[1]) + +class Config(object): + pass + +def splitFully(path): + dir, base = os.path.split(path) + if dir and dir != '' and dir != path: + return splitFully(dir)+[base] + if base == '': + return [] + return [base] + +def makeHierarchy(sources): + '''Break a list of files into a hierarchy; for each value, if it is a string, + then it is a file. If it is a dictionary, it is a folder. The string is + the original path of the file.''' + + hierarchy = {} + for file in sources: + path = splitFully(file) + if len(path): + dict = hierarchy + for part in path[:-1]: + if part not in dict: + dict[part] = {} + dict = dict[part] + dict[path[-1]] = file + #else: + # print 'Warning: failed to decompose path for '+str(file) + return hierarchy + +class _DSPGenerator(object): + """ Base class for DSP generators """ + + srcargs = [ + 'srcs', + 'incs', + 'localincs', + 'resources', + 'misc'] + + def __init__(self, dspfile, source, env): + self.dspfile = str(dspfile) + try: + get_abspath = dspfile.get_abspath + except AttributeError: + self.dspabs = os.path.abspath(dspfile) + else: + self.dspabs = get_abspath() + + if 'variant' not in env: + raise SCons.Errors.InternalError("You must specify a 'variant' argument (i.e. 'Debug' or " +\ + "'Release') to create an MSVSProject.") + elif SCons.Util.is_String(env['variant']): + variants = [env['variant']] + elif SCons.Util.is_List(env['variant']): + variants = env['variant'] + + if 'buildtarget' not in env or env['buildtarget'] == None: + buildtarget = [''] + elif SCons.Util.is_String(env['buildtarget']): + buildtarget = [env['buildtarget']] + elif SCons.Util.is_List(env['buildtarget']): + if len(env['buildtarget']) != len(variants): + raise SCons.Errors.InternalError("Sizes of 'buildtarget' and 'variant' lists must be the same.") + buildtarget = [] + for bt in env['buildtarget']: + if SCons.Util.is_String(bt): + buildtarget.append(bt) + else: + buildtarget.append(bt.get_abspath()) + else: + buildtarget = [env['buildtarget'].get_abspath()] + if len(buildtarget) == 1: + bt = buildtarget[0] + buildtarget = [] + for _ in variants: + buildtarget.append(bt) + + if 'outdir' not in env or env['outdir'] == None: + outdir = [''] + elif SCons.Util.is_String(env['outdir']): + outdir = [env['outdir']] + elif SCons.Util.is_List(env['outdir']): + if len(env['outdir']) != len(variants): + raise SCons.Errors.InternalError("Sizes of 'outdir' and 'variant' lists must be the same.") + outdir = [] + for s in env['outdir']: + if SCons.Util.is_String(s): + outdir.append(s) + else: + outdir.append(s.get_abspath()) + else: + outdir = [env['outdir'].get_abspath()] + if len(outdir) == 1: + s = outdir[0] + outdir = [] + for v in variants: + outdir.append(s) + + if 'runfile' not in env or env['runfile'] == None: + runfile = buildtarget[-1:] + elif SCons.Util.is_String(env['runfile']): + runfile = [env['runfile']] + elif SCons.Util.is_List(env['runfile']): + if len(env['runfile']) != len(variants): + raise SCons.Errors.InternalError("Sizes of 'runfile' and 'variant' lists must be the same.") + runfile = [] + for s in env['runfile']: + if SCons.Util.is_String(s): + runfile.append(s) + else: + runfile.append(s.get_abspath()) + else: + runfile = [env['runfile'].get_abspath()] + if len(runfile) == 1: + s = runfile[0] + runfile = [] + for v in variants: + runfile.append(s) + + self.sconscript = env['MSVSSCONSCRIPT'] + + cmdargs = env.get('cmdargs', '') + + self.env = env + + if 'name' in self.env: + self.name = self.env['name'] + else: + self.name = os.path.basename(SCons.Util.splitext(self.dspfile)[0]) + self.name = self.env.subst(self.name) + + sourcenames = [ + 'Source Files', + 'Header Files', + 'Local Headers', + 'Resource Files', + 'Other Files'] + + self.sources = {} + for n in sourcenames: + self.sources[n] = [] + + self.configs = {} + + self.nokeep = 0 + if 'nokeep' in env and env['variant'] != 0: + self.nokeep = 1 + + if self.nokeep == 0 and os.path.exists(self.dspabs): + self.Parse() + + for t in zip(sourcenames,self.srcargs): + if t[1] in self.env: + if SCons.Util.is_List(self.env[t[1]]): + for i in self.env[t[1]]: + if not i in self.sources[t[0]]: + self.sources[t[0]].append(i) + else: + if not self.env[t[1]] in self.sources[t[0]]: + self.sources[t[0]].append(self.env[t[1]]) + + for n in sourcenames: + #TODO 2.4: compat layer supports sorted(key=) but not sort(key=) + #TODO 2.4: self.sources[n].sort(key=lambda a: a.lower()) + self.sources[n] = sorted(self.sources[n], key=lambda a: a.lower()) + + def AddConfig(self, variant, buildtarget, outdir, runfile, cmdargs, dspfile=dspfile): + config = Config() + config.buildtarget = buildtarget + config.outdir = outdir + config.cmdargs = cmdargs + config.runfile = runfile + + match = re.match('(.*)\|(.*)', variant) + if match: + config.variant = match.group(1) + config.platform = match.group(2) + else: + config.variant = variant + config.platform = 'Win32' + + self.configs[variant] = config + print "Adding '" + self.name + ' - ' + config.variant + '|' + config.platform + "' to '" + str(dspfile) + "'" + + for i in range(len(variants)): + AddConfig(self, variants[i], buildtarget[i], outdir[i], runfile[i], cmdargs) + + self.platforms = [] + for key in self.configs.keys(): + platform = self.configs[key].platform + if not platform in self.platforms: + self.platforms.append(platform) + + def Build(self): + pass + +V6DSPHeader = """\ +# Microsoft Developer Studio Project File - Name="%(name)s" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) External Target" 0x0106 + +CFG=%(name)s - Win32 %(confkey)s +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "%(name)s.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "%(name)s.mak" CFG="%(name)s - Win32 %(confkey)s" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +""" + +class _GenerateV6DSP(_DSPGenerator): + """Generates a Project file for MSVS 6.0""" + + def PrintHeader(self): + # pick a default config + confkeys = sorted(self.configs.keys()) + + name = self.name + confkey = confkeys[0] + + self.file.write(V6DSPHeader % locals()) + + for kind in confkeys: + self.file.write('!MESSAGE "%s - Win32 %s" (based on "Win32 (x86) External Target")\n' % (name, kind)) + + self.file.write('!MESSAGE \n\n') + + def PrintProject(self): + name = self.name + self.file.write('# Begin Project\n' + '# PROP AllowPerConfigDependencies 0\n' + '# PROP Scc_ProjName ""\n' + '# PROP Scc_LocalPath ""\n\n') + + first = 1 + confkeys = sorted(self.configs.keys()) + for kind in confkeys: + outdir = self.configs[kind].outdir + buildtarget = self.configs[kind].buildtarget + if first == 1: + self.file.write('!IF "$(CFG)" == "%s - Win32 %s"\n\n' % (name, kind)) + first = 0 + else: + self.file.write('\n!ELSEIF "$(CFG)" == "%s - Win32 %s"\n\n' % (name, kind)) + + env_has_buildtarget = 'MSVSBUILDTARGET' in self.env + if not env_has_buildtarget: + self.env['MSVSBUILDTARGET'] = buildtarget + + # have to write this twice, once with the BASE settings, and once without + for base in ("BASE ",""): + self.file.write('# PROP %sUse_MFC 0\n' + '# PROP %sUse_Debug_Libraries ' % (base, base)) + if kind.lower().find('debug') < 0: + self.file.write('0\n') + else: + self.file.write('1\n') + self.file.write('# PROP %sOutput_Dir "%s"\n' + '# PROP %sIntermediate_Dir "%s"\n' % (base,outdir,base,outdir)) + cmd = 'echo Starting SCons && ' + self.env.subst('$MSVSBUILDCOM', 1) + self.file.write('# PROP %sCmd_Line "%s"\n' + '# PROP %sRebuild_Opt "-c && %s"\n' + '# PROP %sTarget_File "%s"\n' + '# PROP %sBsc_Name ""\n' + '# PROP %sTarget_Dir ""\n'\ + %(base,cmd,base,cmd,base,buildtarget,base,base)) + + if not env_has_buildtarget: + del self.env['MSVSBUILDTARGET'] + + self.file.write('\n!ENDIF\n\n' + '# Begin Target\n\n') + for kind in confkeys: + self.file.write('# Name "%s - Win32 %s"\n' % (name,kind)) + self.file.write('\n') + first = 0 + for kind in confkeys: + if first == 0: + self.file.write('!IF "$(CFG)" == "%s - Win32 %s"\n\n' % (name,kind)) + first = 1 + else: + self.file.write('!ELSEIF "$(CFG)" == "%s - Win32 %s"\n\n' % (name,kind)) + self.file.write('!ENDIF \n\n') + self.PrintSourceFiles() + self.file.write('# End Target\n' + '# End Project\n') + + if self.nokeep == 0: + # now we pickle some data and add it to the file -- MSDEV will ignore it. + pdata = pickle.dumps(self.configs,1) + pdata = base64.encodestring(pdata) + self.file.write(pdata + '\n') + pdata = pickle.dumps(self.sources,1) + pdata = base64.encodestring(pdata) + self.file.write(pdata + '\n') + + def PrintSourceFiles(self): + categories = {'Source Files': 'cpp|c|cxx|l|y|def|odl|idl|hpj|bat', + 'Header Files': 'h|hpp|hxx|hm|inl', + 'Local Headers': 'h|hpp|hxx|hm|inl', + 'Resource Files': 'r|rc|ico|cur|bmp|dlg|rc2|rct|bin|cnt|rtf|gif|jpg|jpeg|jpe', + 'Other Files': ''} + + for kind in sorted(categories.keys(), key=lambda a: a.lower()): + if not self.sources[kind]: + continue # skip empty groups + + self.file.write('# Begin Group "' + kind + '"\n\n') + typelist = categories[kind].replace('|', ';') + self.file.write('# PROP Default_Filter "' + typelist + '"\n') + + for file in self.sources[kind]: + file = os.path.normpath(file) + self.file.write('# Begin Source File\n\n' + 'SOURCE="' + file + '"\n' + '# End Source File\n') + self.file.write('# End Group\n') + + # add the SConscript file outside of the groups + self.file.write('# Begin Source File\n\n' + 'SOURCE="' + str(self.sconscript) + '"\n' + '# End Source File\n') + + def Parse(self): + try: + dspfile = open(self.dspabs,'r') + except IOError: + return # doesn't exist yet, so can't add anything to configs. + + line = dspfile.readline() + while line: + if line.find("# End Project") > -1: + break + line = dspfile.readline() + + line = dspfile.readline() + datas = line + while line and line != '\n': + line = dspfile.readline() + datas = datas + line + + # OK, we've found our little pickled cache of data. + try: + datas = base64.decodestring(datas) + data = pickle.loads(datas) + except KeyboardInterrupt: + raise + except: + return # unable to unpickle any data for some reason + + self.configs.update(data) + + data = None + line = dspfile.readline() + datas = line + while line and line != '\n': + line = dspfile.readline() + datas = datas + line + + # OK, we've found our little pickled cache of data. + # it has a "# " in front of it, so we strip that. + try: + datas = base64.decodestring(datas) + data = pickle.loads(datas) + except KeyboardInterrupt: + raise + except: + return # unable to unpickle any data for some reason + + self.sources.update(data) + + def Build(self): + try: + self.file = open(self.dspabs,'w') + except IOError, detail: + raise SCons.Errors.InternalError('Unable to open "' + self.dspabs + '" for writing:' + str(detail)) + else: + self.PrintHeader() + self.PrintProject() + self.file.close() + +V7DSPHeader = """\ + + +""" + +V7DSPConfiguration = """\ +\t\t +\t\t\t +\t\t +""" + +V8DSPHeader = """\ + + +""" + +V8DSPConfiguration = """\ +\t\t +\t\t\t +\t\t +""" +class _GenerateV7DSP(_DSPGenerator): + """Generates a Project file for MSVS .NET""" + + def __init__(self, dspfile, source, env): + _DSPGenerator.__init__(self, dspfile, source, env) + self.version = env['MSVS_VERSION'] + self.version_num, self.suite = msvs_parse_version(self.version) + if self.version_num >= 9.0: + self.versionstr = '9.00' + self.dspheader = V8DSPHeader + self.dspconfiguration = V8DSPConfiguration + elif self.version_num >= 8.0: + self.versionstr = '8.00' + self.dspheader = V8DSPHeader + self.dspconfiguration = V8DSPConfiguration + else: + if self.version_num >= 7.1: + self.versionstr = '7.10' + else: + self.versionstr = '7.00' + self.dspheader = V7DSPHeader + self.dspconfiguration = V7DSPConfiguration + self.file = None + + def PrintHeader(self): + env = self.env + versionstr = self.versionstr + name = self.name + encoding = self.env.subst('$MSVSENCODING') + scc_provider = env.get('MSVS_SCC_PROVIDER', '') + scc_project_name = env.get('MSVS_SCC_PROJECT_NAME', '') + scc_aux_path = env.get('MSVS_SCC_AUX_PATH', '') + # MSVS_SCC_LOCAL_PATH is kept for backwards compatibility purpose and should + # be deprecated as soon as possible. + scc_local_path_legacy = env.get('MSVS_SCC_LOCAL_PATH', '') + scc_connection_root = env.get('MSVS_SCC_CONNECTION_ROOT', os.curdir) + scc_local_path = os.path.relpath(scc_connection_root, os.path.dirname(self.dspabs)) + project_guid = env.get('MSVS_PROJECT_GUID', '') + if not project_guid: + project_guid = _generateGUID(self.dspfile, '') + if scc_provider != '': + scc_attrs = '\tSccProjectName="%s"\n' % scc_project_name + if scc_aux_path != '': + scc_attrs += '\tSccAuxPath="%s"\n' % scc_aux_path + scc_attrs += ('\tSccLocalPath="%s"\n' + '\tSccProvider="%s"' % (scc_local_path, scc_provider)) + elif scc_local_path_legacy != '': + # This case is kept for backwards compatibility purpose and should + # be deprecated as soon as possible. + scc_attrs = ('\tSccProjectName="%s"\n' + '\tSccLocalPath="%s"' % (scc_project_name, scc_local_path_legacy)) + else: + self.dspheader = self.dspheader.replace('%(scc_attrs)s\n', '') + + self.file.write(self.dspheader % locals()) + + self.file.write('\t\n') + for platform in self.platforms: + self.file.write( + '\t\t\n' % platform) + self.file.write('\t\n') + + if self.version_num >= 8.0: + self.file.write('\t\n' + '\t\n') + + def PrintProject(self): + self.file.write('\t\n') + + confkeys = sorted(self.configs.keys()) + for kind in confkeys: + variant = self.configs[kind].variant + platform = self.configs[kind].platform + outdir = self.configs[kind].outdir + buildtarget = self.configs[kind].buildtarget + runfile = self.configs[kind].runfile + cmdargs = self.configs[kind].cmdargs + + env_has_buildtarget = 'MSVSBUILDTARGET' in self.env + if not env_has_buildtarget: + self.env['MSVSBUILDTARGET'] = buildtarget + + starting = 'echo Starting SCons && ' + if cmdargs: + cmdargs = ' ' + cmdargs + else: + cmdargs = '' + buildcmd = xmlify(starting + self.env.subst('$MSVSBUILDCOM', 1) + cmdargs) + rebuildcmd = xmlify(starting + self.env.subst('$MSVSREBUILDCOM', 1) + cmdargs) + cleancmd = xmlify(starting + self.env.subst('$MSVSCLEANCOM', 1) + cmdargs) + + # This isn't perfect; CPPDEFINES and CPPPATH can contain $TARGET and $SOURCE, + # so they could vary depending on the command being generated. This code + # assumes they don't. + preprocdefs = xmlify(';'.join(processDefines(self.env.get('CPPDEFINES', [])))) + includepath_Dirs = processIncludes(self.env.get('CPPPATH', []), self.env, None, None) + includepath = xmlify(';'.join([str(x) for x in includepath_Dirs])) + + if not env_has_buildtarget: + del self.env['MSVSBUILDTARGET'] + + self.file.write(self.dspconfiguration % locals()) + + self.file.write('\t\n') + + if self.version_num >= 7.1: + self.file.write('\t\n' + '\t\n') + + self.PrintSourceFiles() + + self.file.write('\n') + + if self.nokeep == 0: + # now we pickle some data and add it to the file -- MSDEV will ignore it. + pdata = pickle.dumps(self.configs,1) + pdata = base64.encodestring(pdata) + self.file.write('\n') + + def printSources(self, hierarchy, commonprefix): + sorteditems = sorted(hierarchy.items(), key=lambda a: a[0].lower()) + + # First folders, then files + for key, value in sorteditems: + if SCons.Util.is_Dict(value): + self.file.write('\t\t\t\n' % (key)) + self.printSources(value, commonprefix) + self.file.write('\t\t\t\n') + + for key, value in sorteditems: + if SCons.Util.is_String(value): + file = value + if commonprefix: + file = os.path.join(commonprefix, value) + file = os.path.normpath(file) + self.file.write('\t\t\t\n' + '\t\t\t\n' % (file)) + + def PrintSourceFiles(self): + categories = {'Source Files': 'cpp;c;cxx;l;y;def;odl;idl;hpj;bat', + 'Header Files': 'h;hpp;hxx;hm;inl', + 'Local Headers': 'h;hpp;hxx;hm;inl', + 'Resource Files': 'r;rc;ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe', + 'Other Files': ''} + + self.file.write('\t\n') + + cats = sorted([k for k in categories.keys() if self.sources[k]], + key=lambda a: a.lower()) + for kind in cats: + if len(cats) > 1: + self.file.write('\t\t\n' % (kind, categories[kind])) + + sources = self.sources[kind] + + # First remove any common prefix + commonprefix = None + s = list(map(os.path.normpath, sources)) + # take the dirname because the prefix may include parts + # of the filenames (e.g. if you have 'dir\abcd' and + # 'dir\acde' then the cp will be 'dir\a' ) + cp = os.path.dirname( os.path.commonprefix(s) ) + if cp and s[0][len(cp)] == os.sep: + # +1 because the filename starts after the separator + sources = [s[len(cp)+1:] for s in sources] + commonprefix = cp + + hierarchy = makeHierarchy(sources) + self.printSources(hierarchy, commonprefix=commonprefix) + + if len(cats)>1: + self.file.write('\t\t\n') + + # add the SConscript file outside of the groups + self.file.write('\t\t\n' + '\t\t\n' % str(self.sconscript)) + + self.file.write('\t\n' + '\t\n' + '\t\n') + + def Parse(self): + try: + dspfile = open(self.dspabs,'r') + except IOError: + return # doesn't exist yet, so can't add anything to configs. + + line = dspfile.readline() + while line: + if line.find('\n') + + def printFilters(self, hierarchy, name): + sorteditems = sorted(hierarchy.items(), key = lambda a: a[0].lower()) + + for key, value in sorteditems: + if SCons.Util.is_Dict(value): + filter_name = name + '\\' + key + self.filters_file.write('\t\t\n' + '\t\t\t%s\n' + '\t\t\n' % (filter_name, _generateGUID(self.dspabs, filter_name))) + self.printFilters(value, filter_name) + + def printSources(self, hierarchy, kind, commonprefix, filter_name): + keywords = {'Source Files': 'ClCompile', + 'Header Files': 'ClInclude', + 'Local Headers': 'ClInclude', + 'Resource Files': 'None', + 'Other Files': 'None'} + + sorteditems = sorted(hierarchy.items(), key = lambda a: a[0].lower()) + + # First folders, then files + for key, value in sorteditems: + if SCons.Util.is_Dict(value): + self.printSources(value, kind, commonprefix, filter_name + '\\' + key) + + for key, value in sorteditems: + if SCons.Util.is_String(value): + file = value + if commonprefix: + file = os.path.join(commonprefix, value) + file = os.path.normpath(file) + + self.file.write('\t\t<%s Include="%s" />\n' % (keywords[kind], file)) + self.filters_file.write('\t\t<%s Include="%s">\n' + '\t\t\t%s\n' + '\t\t\n' % (keywords[kind], file, filter_name, keywords[kind])) + + def PrintSourceFiles(self): + categories = {'Source Files': 'cpp;c;cxx;l;y;def;odl;idl;hpj;bat', + 'Header Files': 'h;hpp;hxx;hm;inl', + 'Local Headers': 'h;hpp;hxx;hm;inl', + 'Resource Files': 'r;rc;ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe', + 'Other Files': ''} + + cats = sorted([k for k in categories.keys() if self.sources[k]], + key = lambda a: a.lower()) + + # print vcxproj.filters file first + self.filters_file.write('\t\n') + for kind in cats: + self.filters_file.write('\t\t\n' + '\t\t\t{7b42d31d-d53c-4868-8b92-ca2bc9fc052f}\n' + '\t\t\t%s\n' + '\t\t\n' % (kind, categories[kind])) + + # First remove any common prefix + sources = self.sources[kind] + commonprefix = None + s = list(map(os.path.normpath, sources)) + # take the dirname because the prefix may include parts + # of the filenames (e.g. if you have 'dir\abcd' and + # 'dir\acde' then the cp will be 'dir\a' ) + cp = os.path.dirname( os.path.commonprefix(s) ) + if cp and s[0][len(cp)] == os.sep: + # +1 because the filename starts after the separator + sources = [s[len(cp)+1:] for s in sources] + commonprefix = cp + + hierarchy = makeHierarchy(sources) + self.printFilters(hierarchy, kind) + + self.filters_file.write('\t\n') + + # then print files and filters + for kind in cats: + self.file.write('\t\n') + self.filters_file.write('\t\n') + + # First remove any common prefix + sources = self.sources[kind] + commonprefix = None + s = list(map(os.path.normpath, sources)) + # take the dirname because the prefix may include parts + # of the filenames (e.g. if you have 'dir\abcd' and + # 'dir\acde' then the cp will be 'dir\a' ) + cp = os.path.dirname( os.path.commonprefix(s) ) + if cp and s[0][len(cp)] == os.sep: + # +1 because the filename starts after the separator + sources = [s[len(cp)+1:] for s in sources] + commonprefix = cp + + hierarchy = makeHierarchy(sources) + self.printSources(hierarchy, kind, commonprefix, kind) + + self.file.write('\t\n') + self.filters_file.write('\t\n') + + # add the SConscript file outside of the groups + self.file.write('\t\n' + '\t\t\n' + #'\t\t\n' + '\t\n' % str(self.sconscript)) + + def Parse(self): + print "_GenerateV10DSP.Parse()" + + def Build(self): + try: + self.file = open(self.dspabs, 'w') + except IOError, detail: + raise SCons.Errors.InternalError('Unable to open "' + self.dspabs + '" for writing:' + str(detail)) + else: + self.PrintHeader() + self.PrintProject() + self.file.close() + +class _DSWGenerator(object): + """ Base class for DSW generators """ + def __init__(self, dswfile, source, env): + self.dswfile = os.path.normpath(str(dswfile)) + self.dsw_folder_path = os.path.dirname(os.path.abspath(self.dswfile)) + self.env = env + + if 'projects' not in env: + raise SCons.Errors.UserError("You must specify a 'projects' argument to create an MSVSSolution.") + projects = env['projects'] + if not SCons.Util.is_List(projects): + raise SCons.Errors.InternalError("The 'projects' argument must be a list of nodes.") + projects = SCons.Util.flatten(projects) + if len(projects) < 1: + raise SCons.Errors.UserError("You must specify at least one project to create an MSVSSolution.") + self.dspfiles = list(map(str, projects)) + + if 'name' in self.env: + self.name = self.env['name'] + else: + self.name = os.path.basename(SCons.Util.splitext(self.dswfile)[0]) + self.name = self.env.subst(self.name) + + def Build(self): + pass + +class _GenerateV7DSW(_DSWGenerator): + """Generates a Solution file for MSVS .NET""" + def __init__(self, dswfile, source, env): + _DSWGenerator.__init__(self, dswfile, source, env) + + self.file = None + self.version = self.env['MSVS_VERSION'] + self.version_num, self.suite = msvs_parse_version(self.version) + self.versionstr = '7.00' + if self.version_num >= 11.0: + self.versionstr = '12.00' + elif self.version_num >= 10.0: + self.versionstr = '11.00' + elif self.version_num >= 9.0: + self.versionstr = '10.00' + elif self.version_num >= 8.0: + self.versionstr = '9.00' + elif self.version_num >= 7.1: + self.versionstr = '8.00' + + if 'slnguid' in env and env['slnguid']: + self.slnguid = env['slnguid'] + else: + self.slnguid = _generateGUID(dswfile, self.name) + + self.configs = {} + + self.nokeep = 0 + if 'nokeep' in env and env['variant'] != 0: + self.nokeep = 1 + + if self.nokeep == 0 and os.path.exists(self.dswfile): + self.Parse() + + def AddConfig(self, variant, dswfile=dswfile): + config = Config() + + match = re.match('(.*)\|(.*)', variant) + if match: + config.variant = match.group(1) + config.platform = match.group(2) + else: + config.variant = variant + config.platform = 'Win32' + + self.configs[variant] = config + print "Adding '" + self.name + ' - ' + config.variant + '|' + config.platform + "' to '" + str(dswfile) + "'" + + if 'variant' not in env: + raise SCons.Errors.InternalError("You must specify a 'variant' argument (i.e. 'Debug' or " +\ + "'Release') to create an MSVS Solution File.") + elif SCons.Util.is_String(env['variant']): + AddConfig(self, env['variant']) + elif SCons.Util.is_List(env['variant']): + for variant in env['variant']: + AddConfig(self, variant) + + self.platforms = [] + for key in self.configs.keys(): + platform = self.configs[key].platform + if not platform in self.platforms: + self.platforms.append(platform) + + def GenerateProjectFilesInfo(self): + for dspfile in self.dspfiles: + dsp_folder_path, name = os.path.split(dspfile) + dsp_folder_path = os.path.abspath(dsp_folder_path) + dsp_relative_folder_path = os.path.relpath(dsp_folder_path, self.dsw_folder_path) + if dsp_relative_folder_path == os.curdir: + dsp_relative_file_path = name + else: + dsp_relative_file_path = os.path.join(dsp_relative_folder_path, name) + dspfile_info = {'NAME': name, + 'GUID': _generateGUID(dspfile, ''), + 'FOLDER_PATH': dsp_folder_path, + 'FILE_PATH': dspfile, + 'SLN_RELATIVE_FOLDER_PATH': dsp_relative_folder_path, + 'SLN_RELATIVE_FILE_PATH': dsp_relative_file_path} + self.dspfiles_info.append(dspfile_info) + + self.dspfiles_info = [] + GenerateProjectFilesInfo(self) + + def Parse(self): + try: + dswfile = open(self.dswfile,'r') + except IOError: + return # doesn't exist yet, so can't add anything to configs. + + line = dswfile.readline() + while line: + if line[:9] == "EndGlobal": + break + line = dswfile.readline() + + line = dswfile.readline() + datas = line + while line: + line = dswfile.readline() + datas = datas + line + + # OK, we've found our little pickled cache of data. + try: + datas = base64.decodestring(datas) + data = pickle.loads(datas) + except KeyboardInterrupt: + raise + except: + return # unable to unpickle any data for some reason + + self.configs.update(data) + + def PrintSolution(self): + """Writes a solution file""" + self.file.write('Microsoft Visual Studio Solution File, Format Version %s\n' % self.versionstr) + if self.version_num >= 11.0: + self.file.write('# Visual Studio 11\n') + elif self.version_num >= 10.0: + self.file.write('# Visual Studio 2010\n') + elif self.version_num >= 9.0: + self.file.write('# Visual Studio 2008\n') + elif self.version_num >= 8.0: + self.file.write('# Visual Studio 2005\n') + + for dspinfo in self.dspfiles_info: + name = dspinfo['NAME'] + base, suffix = SCons.Util.splitext(name) + if suffix == '.vcproj': + name = base + self.file.write('Project("%s") = "%s", "%s", "%s"\n' + % (external_makefile_guid, name, dspinfo['SLN_RELATIVE_FILE_PATH'], dspinfo['GUID'])) + if self.version_num >= 7.1 and self.version_num < 8.0: + self.file.write('\tProjectSection(ProjectDependencies) = postProject\n' + '\tEndProjectSection\n') + self.file.write('EndProject\n') + + self.file.write('Global\n') + + env = self.env + if 'MSVS_SCC_PROVIDER' in env: + scc_number_of_projects = len(self.dspfiles) + 1 + slnguid = self.slnguid + scc_provider = env.get('MSVS_SCC_PROVIDER', '').replace(' ', r'\u0020') + scc_project_name = env.get('MSVS_SCC_PROJECT_NAME', '').replace(' ', r'\u0020') + scc_connection_root = env.get('MSVS_SCC_CONNECTION_ROOT', os.curdir) + scc_local_path = os.path.relpath(scc_connection_root, self.dsw_folder_path).replace('\\', '\\\\') + self.file.write('\tGlobalSection(SourceCodeControl) = preSolution\n' + '\t\tSccNumberOfProjects = %(scc_number_of_projects)d\n' + '\t\tSccProjectName0 = %(scc_project_name)s\n' + '\t\tSccLocalPath0 = %(scc_local_path)s\n' + '\t\tSccProvider0 = %(scc_provider)s\n' + '\t\tCanCheckoutShared = true\n' % locals()) + sln_relative_path_from_scc = os.path.relpath(self.dsw_folder_path, scc_connection_root) + if sln_relative_path_from_scc != os.curdir: + self.file.write('\t\tSccProjectFilePathRelativizedFromConnection0 = %s\\\\\n' + % sln_relative_path_from_scc.replace('\\', '\\\\')) + if self.version_num < 8.0: + # When present, SolutionUniqueID is automatically removed by VS 2005 + # TODO: check for Visual Studio versions newer than 2005 + self.file.write('\t\tSolutionUniqueID = %s\n' % slnguid) + for dspinfo in self.dspfiles_info: + i = self.dspfiles_info.index(dspinfo) + 1 + dsp_relative_file_path = dspinfo['SLN_RELATIVE_FILE_PATH'].replace('\\', '\\\\') + dsp_scc_relative_folder_path = os.path.relpath(dspinfo['FOLDER_PATH'], scc_connection_root).replace('\\', '\\\\') + self.file.write('\t\tSccProjectUniqueName%(i)s = %(dsp_relative_file_path)s\n' + '\t\tSccLocalPath%(i)d = %(scc_local_path)s\n' + '\t\tCanCheckoutShared = true\n' + '\t\tSccProjectFilePathRelativizedFromConnection%(i)s = %(dsp_scc_relative_folder_path)s\\\\\n' + % locals()) + self.file.write('\tEndGlobalSection\n') + if self.version_num >= 8.0: + self.file.write('\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n') + else: + self.file.write('\tGlobalSection(SolutionConfiguration) = preSolution\n') + + confkeys = sorted(self.configs.keys()) + cnt = 0 + for name in confkeys: + variant = self.configs[name].variant + platform = self.configs[name].platform + if self.version_num >= 8.0: + self.file.write('\t\t%s|%s = %s|%s\n' % (variant, platform, variant, platform)) + else: + self.file.write('\t\tConfigName.%d = %s\n' % (cnt, variant)) + cnt = cnt + 1 + self.file.write('\tEndGlobalSection\n') + if self.version_num <= 7.1: + self.file.write('\tGlobalSection(ProjectDependencies) = postSolution\n' + '\tEndGlobalSection\n') + if self.version_num >= 8.0: + self.file.write('\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n') + else: + self.file.write('\tGlobalSection(ProjectConfiguration) = postSolution\n') + + for name in confkeys: + variant = self.configs[name].variant + platform = self.configs[name].platform + if self.version_num >= 8.0: + for dspinfo in self.dspfiles_info: + guid = dspinfo['GUID'] + self.file.write('\t\t%s.%s|%s.ActiveCfg = %s|%s\n' + '\t\t%s.%s|%s.Build.0 = %s|%s\n' % (guid,variant,platform,variant,platform,guid,variant,platform,variant,platform)) + else: + for dspinfo in self.dspfiles_info: + guid = dspinfo['GUID'] + self.file.write('\t\t%s.%s.ActiveCfg = %s|%s\n' + '\t\t%s.%s.Build.0 = %s|%s\n' %(guid,variant,variant,platform,guid,variant,variant,platform)) + + self.file.write('\tEndGlobalSection\n') + + if self.version_num >= 8.0: + self.file.write('\tGlobalSection(SolutionProperties) = preSolution\n' + '\t\tHideSolutionNode = FALSE\n' + '\tEndGlobalSection\n') + else: + self.file.write('\tGlobalSection(ExtensibilityGlobals) = postSolution\n' + '\tEndGlobalSection\n' + '\tGlobalSection(ExtensibilityAddIns) = postSolution\n' + '\tEndGlobalSection\n') + self.file.write('EndGlobal\n') + if self.nokeep == 0: + pdata = pickle.dumps(self.configs,1) + pdata = base64.encodestring(pdata) + self.file.write(pdata + '\n') + + def Build(self): + try: + self.file = open(self.dswfile,'w') + except IOError, detail: + raise SCons.Errors.InternalError('Unable to open "' + self.dswfile + '" for writing:' + str(detail)) + else: + self.PrintSolution() + self.file.close() + +V6DSWHeader = """\ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "%(name)s"="%(dspfile)s" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### +""" + +class _GenerateV6DSW(_DSWGenerator): + """Generates a Workspace file for MSVS 6.0""" + + def PrintWorkspace(self): + """ writes a DSW file """ + name = self.name + dspfile = os.path.relpath(self.dspfiles[0], self.dsw_folder_path) + self.file.write(V6DSWHeader % locals()) + + def Build(self): + try: + self.file = open(self.dswfile,'w') + except IOError, detail: + raise SCons.Errors.InternalError('Unable to open "' + self.dswfile + '" for writing:' + str(detail)) + else: + self.PrintWorkspace() + self.file.close() + + +def GenerateDSP(dspfile, source, env): + """Generates a Project file based on the version of MSVS that is being used""" + + version_num = 6.0 + if 'MSVS_VERSION' in env: + version_num, suite = msvs_parse_version(env['MSVS_VERSION']) + if version_num >= 10.0: + g = _GenerateV10DSP(dspfile, source, env) + g.Build() + elif version_num >= 7.0: + g = _GenerateV7DSP(dspfile, source, env) + g.Build() + else: + g = _GenerateV6DSP(dspfile, source, env) + g.Build() + +def GenerateDSW(dswfile, source, env): + """Generates a Solution/Workspace file based on the version of MSVS that is being used""" + + version_num = 6.0 + if 'MSVS_VERSION' in env: + version_num, suite = msvs_parse_version(env['MSVS_VERSION']) + if version_num >= 7.0: + g = _GenerateV7DSW(dswfile, source, env) + g.Build() + else: + g = _GenerateV6DSW(dswfile, source, env) + g.Build() + + +############################################################################## +# Above here are the classes and functions for generation of +# DSP/DSW/SLN/VCPROJ files. +############################################################################## + +def GetMSVSProjectSuffix(target, source, env, for_signature): + return env['MSVS']['PROJECTSUFFIX'] + +def GetMSVSSolutionSuffix(target, source, env, for_signature): + return env['MSVS']['SOLUTIONSUFFIX'] + +def GenerateProject(target, source, env): + # generate the dsp file, according to the version of MSVS. + builddspfile = target[0] + dspfile = builddspfile.srcnode() + + # this detects whether or not we're using a VariantDir + if not dspfile is builddspfile: + try: + bdsp = open(str(builddspfile), "w+") + except IOError, detail: + print 'Unable to open "' + str(dspfile) + '" for writing:',detail,'\n' + raise + + bdsp.write("This is just a placeholder file.\nThe real project file is here:\n%s\n" % dspfile.get_abspath()) + + GenerateDSP(dspfile, source, env) + + if env.get('auto_build_solution', 1): + builddswfile = target[1] + dswfile = builddswfile.srcnode() + + if not dswfile is builddswfile: + + try: + bdsw = open(str(builddswfile), "w+") + except IOError, detail: + print 'Unable to open "' + str(dspfile) + '" for writing:',detail,'\n' + raise + + bdsw.write("This is just a placeholder file.\nThe real workspace file is here:\n%s\n" % dswfile.get_abspath()) + + GenerateDSW(dswfile, source, env) + +def GenerateSolution(target, source, env): + GenerateDSW(target[0], source, env) + +def projectEmitter(target, source, env): + """Sets up the DSP dependencies.""" + + # todo: Not sure what sets source to what user has passed as target, + # but this is what happens. When that is fixed, we also won't have + # to make the user always append env['MSVSPROJECTSUFFIX'] to target. + if source[0] == target[0]: + source = [] + + # make sure the suffix is correct for the version of MSVS we're running. + (base, suff) = SCons.Util.splitext(str(target[0])) + suff = env.subst('$MSVSPROJECTSUFFIX') + target[0] = base + suff + + if not source: + source = 'prj_inputs:' + source = source + env.subst('$MSVSSCONSCOM', 1) + source = source + env.subst('$MSVSENCODING', 1) + + # Project file depends on CPPDEFINES and CPPPATH + preprocdefs = xmlify(';'.join(processDefines(env.get('CPPDEFINES', [])))) + includepath_Dirs = processIncludes(env.get('CPPPATH', []), env, None, None) + includepath = xmlify(';'.join([str(x) for x in includepath_Dirs])) + source = source + "; ppdefs:%s incpath:%s"%(preprocdefs, includepath) + + if 'buildtarget' in env and env['buildtarget'] != None: + if SCons.Util.is_String(env['buildtarget']): + source = source + ' "%s"' % env['buildtarget'] + elif SCons.Util.is_List(env['buildtarget']): + for bt in env['buildtarget']: + if SCons.Util.is_String(bt): + source = source + ' "%s"' % bt + else: + try: source = source + ' "%s"' % bt.get_abspath() + except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None") + else: + try: source = source + ' "%s"' % env['buildtarget'].get_abspath() + except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None") + + if 'outdir' in env and env['outdir'] != None: + if SCons.Util.is_String(env['outdir']): + source = source + ' "%s"' % env['outdir'] + elif SCons.Util.is_List(env['outdir']): + for s in env['outdir']: + if SCons.Util.is_String(s): + source = source + ' "%s"' % s + else: + try: source = source + ' "%s"' % s.get_abspath() + except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None") + else: + try: source = source + ' "%s"' % env['outdir'].get_abspath() + except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None") + + if 'name' in env: + if SCons.Util.is_String(env['name']): + source = source + ' "%s"' % env['name'] + else: + raise SCons.Errors.InternalError("name must be a string") + + if 'variant' in env: + if SCons.Util.is_String(env['variant']): + source = source + ' "%s"' % env['variant'] + elif SCons.Util.is_List(env['variant']): + for variant in env['variant']: + if SCons.Util.is_String(variant): + source = source + ' "%s"' % variant + else: + raise SCons.Errors.InternalError("name must be a string or a list of strings") + else: + raise SCons.Errors.InternalError("variant must be a string or a list of strings") + else: + raise SCons.Errors.InternalError("variant must be specified") + + for s in _DSPGenerator.srcargs: + if s in env: + if SCons.Util.is_String(env[s]): + source = source + ' "%s' % env[s] + elif SCons.Util.is_List(env[s]): + for t in env[s]: + if SCons.Util.is_String(t): + source = source + ' "%s"' % t + else: + raise SCons.Errors.InternalError(s + " must be a string or a list of strings") + else: + raise SCons.Errors.InternalError(s + " must be a string or a list of strings") + + source = source + ' "%s"' % str(target[0]) + source = [SCons.Node.Python.Value(source)] + + targetlist = [target[0]] + sourcelist = source + + if env.get('auto_build_solution', 1): + env['projects'] = [env.File(t).srcnode() for t in targetlist] + t, s = solutionEmitter(target, target, env) + targetlist = targetlist + t + + # Beginning with Visual Studio 2010 for each project file (.vcxproj) we have additional file (.vcxproj.filters) + if float(env['MSVS_VERSION']) >= 10.0: + targetlist.append(targetlist[0] + '.filters') + + return (targetlist, sourcelist) + +def solutionEmitter(target, source, env): + """Sets up the DSW dependencies.""" + + # todo: Not sure what sets source to what user has passed as target, + # but this is what happens. When that is fixed, we also won't have + # to make the user always append env['MSVSSOLUTIONSUFFIX'] to target. + if source[0] == target[0]: + source = [] + + # make sure the suffix is correct for the version of MSVS we're running. + (base, suff) = SCons.Util.splitext(str(target[0])) + suff = env.subst('$MSVSSOLUTIONSUFFIX') + target[0] = base + suff + + if not source: + source = 'sln_inputs:' + + if 'name' in env: + if SCons.Util.is_String(env['name']): + source = source + ' "%s"' % env['name'] + else: + raise SCons.Errors.InternalError("name must be a string") + + if 'variant' in env: + if SCons.Util.is_String(env['variant']): + source = source + ' "%s"' % env['variant'] + elif SCons.Util.is_List(env['variant']): + for variant in env['variant']: + if SCons.Util.is_String(variant): + source = source + ' "%s"' % variant + else: + raise SCons.Errors.InternalError("name must be a string or a list of strings") + else: + raise SCons.Errors.InternalError("variant must be a string or a list of strings") + else: + raise SCons.Errors.InternalError("variant must be specified") + + if 'slnguid' in env: + if SCons.Util.is_String(env['slnguid']): + source = source + ' "%s"' % env['slnguid'] + else: + raise SCons.Errors.InternalError("slnguid must be a string") + + if 'projects' in env: + if SCons.Util.is_String(env['projects']): + source = source + ' "%s"' % env['projects'] + elif SCons.Util.is_List(env['projects']): + for t in env['projects']: + if SCons.Util.is_String(t): + source = source + ' "%s"' % t + + source = source + ' "%s"' % str(target[0]) + source = [SCons.Node.Python.Value(source)] + + return ([target[0]], source) + +projectAction = SCons.Action.Action(GenerateProject, None) + +solutionAction = SCons.Action.Action(GenerateSolution, None) + +projectBuilder = SCons.Builder.Builder(action = '$MSVSPROJECTCOM', + suffix = '$MSVSPROJECTSUFFIX', + emitter = projectEmitter) + +solutionBuilder = SCons.Builder.Builder(action = '$MSVSSOLUTIONCOM', + suffix = '$MSVSSOLUTIONSUFFIX', + emitter = solutionEmitter) + +default_MSVS_SConscript = None + +def generate(env): + """Add Builders and construction variables for Microsoft Visual + Studio project files to an Environment.""" + try: + env['BUILDERS']['MSVSProject'] + except KeyError: + env['BUILDERS']['MSVSProject'] = projectBuilder + + try: + env['BUILDERS']['MSVSSolution'] + except KeyError: + env['BUILDERS']['MSVSSolution'] = solutionBuilder + + env['MSVSPROJECTCOM'] = projectAction + env['MSVSSOLUTIONCOM'] = solutionAction + + if SCons.Script.call_stack: + # XXX Need to find a way to abstract this; the build engine + # shouldn't depend on anything in SCons.Script. + env['MSVSSCONSCRIPT'] = SCons.Script.call_stack[0].sconscript + else: + global default_MSVS_SConscript + if default_MSVS_SConscript is None: + default_MSVS_SConscript = env.File('SConstruct') + env['MSVSSCONSCRIPT'] = default_MSVS_SConscript + + env['MSVSSCONS'] = '"%s" -c "%s"' % (python_executable, getExecScriptMain(env)) + env['MSVSSCONSFLAGS'] = '-C "${MSVSSCONSCRIPT.dir.abspath}" -f ${MSVSSCONSCRIPT.name}' + env['MSVSSCONSCOM'] = '$MSVSSCONS $MSVSSCONSFLAGS' + env['MSVSBUILDCOM'] = '$MSVSSCONSCOM "$MSVSBUILDTARGET"' + env['MSVSREBUILDCOM'] = '$MSVSSCONSCOM "$MSVSBUILDTARGET"' + env['MSVSCLEANCOM'] = '$MSVSSCONSCOM -c "$MSVSBUILDTARGET"' + + # Set-up ms tools paths for default version + msvc_setup_env_once(env) + + if 'MSVS_VERSION' in env: + version_num, suite = msvs_parse_version(env['MSVS_VERSION']) + else: + (version_num, suite) = (7.0, None) # guess at a default + if 'MSVS' not in env: + env['MSVS'] = {} + if (version_num < 7.0): + env['MSVS']['PROJECTSUFFIX'] = '.dsp' + env['MSVS']['SOLUTIONSUFFIX'] = '.dsw' + elif (version_num < 10.0): + env['MSVS']['PROJECTSUFFIX'] = '.vcproj' + env['MSVS']['SOLUTIONSUFFIX'] = '.sln' + else: + env['MSVS']['PROJECTSUFFIX'] = '.vcxproj' + env['MSVS']['SOLUTIONSUFFIX'] = '.sln' + + if (version_num >= 10.0): + env['MSVSENCODING'] = 'utf-8' + else: + env['MSVSENCODING'] = 'Windows-1252' + + env['GET_MSVSPROJECTSUFFIX'] = GetMSVSProjectSuffix + env['GET_MSVSSOLUTIONSUFFIX'] = GetMSVSSolutionSuffix + env['MSVSPROJECTSUFFIX'] = '${GET_MSVSPROJECTSUFFIX}' + env['MSVSSOLUTIONSUFFIX'] = '${GET_MSVSSOLUTIONSUFFIX}' + env['SCONS_HOME'] = os.environ.get('SCONS_HOME') + +def exists(env): + return msvc_exists() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/mwcc.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/mwcc.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/mwcc.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/mwcc.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,207 @@ +"""SCons.Tool.mwcc + +Tool-specific initialization for the Metrowerks CodeWarrior compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/mwcc.py 2013/03/03 09:48:35 garyo" + +import os +import os.path + +import SCons.Util + +def set_vars(env): + """Set MWCW_VERSION, MWCW_VERSIONS, and some codewarrior environment vars + + MWCW_VERSIONS is set to a list of objects representing installed versions + + MWCW_VERSION is set to the version object that will be used for building. + MWCW_VERSION can be set to a string during Environment + construction to influence which version is chosen, otherwise + the latest one from MWCW_VERSIONS is used. + + Returns true if at least one version is found, false otherwise + """ + desired = env.get('MWCW_VERSION', '') + + # return right away if the variables are already set + if isinstance(desired, MWVersion): + return 1 + elif desired is None: + return 0 + + versions = find_versions() + version = None + + if desired: + for v in versions: + if str(v) == desired: + version = v + elif versions: + version = versions[-1] + + env['MWCW_VERSIONS'] = versions + env['MWCW_VERSION'] = version + + if version is None: + return 0 + + env.PrependENVPath('PATH', version.clpath) + env.PrependENVPath('PATH', version.dllpath) + ENV = env['ENV'] + ENV['CWFolder'] = version.path + ENV['LM_LICENSE_FILE'] = version.license + plus = lambda x: '+%s' % x + ENV['MWCIncludes'] = os.pathsep.join(map(plus, version.includes)) + ENV['MWLibraries'] = os.pathsep.join(map(plus, version.libs)) + return 1 + + +def find_versions(): + """Return a list of MWVersion objects representing installed versions""" + versions = [] + + ### This function finds CodeWarrior by reading from the registry on + ### Windows. Some other method needs to be implemented for other + ### platforms, maybe something that calls env.WhereIs('mwcc') + + if SCons.Util.can_read_reg: + try: + HLM = SCons.Util.HKEY_LOCAL_MACHINE + product = 'SOFTWARE\\Metrowerks\\CodeWarrior\\Product Versions' + product_key = SCons.Util.RegOpenKeyEx(HLM, product) + + i = 0 + while True: + name = product + '\\' + SCons.Util.RegEnumKey(product_key, i) + name_key = SCons.Util.RegOpenKeyEx(HLM, name) + + try: + version = SCons.Util.RegQueryValueEx(name_key, 'VERSION') + path = SCons.Util.RegQueryValueEx(name_key, 'PATH') + mwv = MWVersion(version[0], path[0], 'Win32-X86') + versions.append(mwv) + except SCons.Util.RegError: + pass + + i = i + 1 + + except SCons.Util.RegError: + pass + + return versions + + +class MWVersion(object): + def __init__(self, version, path, platform): + self.version = version + self.path = path + self.platform = platform + self.clpath = os.path.join(path, 'Other Metrowerks Tools', + 'Command Line Tools') + self.dllpath = os.path.join(path, 'Bin') + + # The Metrowerks tools don't store any configuration data so they + # are totally dumb when it comes to locating standard headers, + # libraries, and other files, expecting all the information + # to be handed to them in environment variables. The members set + # below control what information scons injects into the environment + + ### The paths below give a normal build environment in CodeWarrior for + ### Windows, other versions of CodeWarrior might need different paths. + + msl = os.path.join(path, 'MSL') + support = os.path.join(path, '%s Support' % platform) + + self.license = os.path.join(path, 'license.dat') + self.includes = [msl, support] + self.libs = [msl, support] + + def __str__(self): + return self.version + + +CSuffixes = ['.c', '.C'] +CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++'] + + +def generate(env): + """Add Builders and construction variables for the mwcc to an Environment.""" + import SCons.Defaults + import SCons.Tool + + set_vars(env) + + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in CSuffixes: + static_obj.add_action(suffix, SCons.Defaults.CAction) + shared_obj.add_action(suffix, SCons.Defaults.ShCAction) + + for suffix in CXXSuffixes: + static_obj.add_action(suffix, SCons.Defaults.CXXAction) + shared_obj.add_action(suffix, SCons.Defaults.ShCXXAction) + + env['CCCOMFLAGS'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -nolink -o $TARGET $SOURCES' + + env['CC'] = 'mwcc' + env['CCCOM'] = '$CC $CFLAGS $CCFLAGS $CCCOMFLAGS' + + env['CXX'] = 'mwcc' + env['CXXCOM'] = '$CXX $CXXFLAGS $CCCOMFLAGS' + + env['SHCC'] = '$CC' + env['SHCCFLAGS'] = '$CCFLAGS' + env['SHCFLAGS'] = '$CFLAGS' + env['SHCCCOM'] = '$SHCC $SHCFLAGS $SHCCFLAGS $CCCOMFLAGS' + + env['SHCXX'] = '$CXX' + env['SHCXXFLAGS'] = '$CXXFLAGS' + env['SHCXXCOM'] = '$SHCXX $SHCXXFLAGS $CCCOMFLAGS' + + env['CFILESUFFIX'] = '.c' + env['CXXFILESUFFIX'] = '.cpp' + env['CPPDEFPREFIX'] = '-D' + env['CPPDEFSUFFIX'] = '' + env['INCPREFIX'] = '-I' + env['INCSUFFIX'] = '' + + #env['PCH'] = ? + #env['PCHSTOP'] = ? + + +def exists(env): + return set_vars(env) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/mwld.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/mwld.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/mwld.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/mwld.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,107 @@ +"""SCons.Tool.mwld + +Tool-specific initialization for the Metrowerks CodeWarrior linker. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/mwld.py 2013/03/03 09:48:35 garyo" + +import SCons.Tool + + +def generate(env): + """Add Builders and construction variables for lib to an Environment.""" + SCons.Tool.createStaticLibBuilder(env) + SCons.Tool.createSharedLibBuilder(env) + SCons.Tool.createProgBuilder(env) + + env['AR'] = 'mwld' + env['ARCOM'] = '$AR $ARFLAGS -library -o $TARGET $SOURCES' + + env['LIBDIRPREFIX'] = '-L' + env['LIBDIRSUFFIX'] = '' + env['LIBLINKPREFIX'] = '-l' + env['LIBLINKSUFFIX'] = '.lib' + + env['LINK'] = 'mwld' + env['LINKCOM'] = '$LINK $LINKFLAGS -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' + + env['SHLINK'] = '$LINK' + env['SHLINKFLAGS'] = '$LINKFLAGS' + env['SHLINKCOM'] = shlib_action + env['SHLIBEMITTER']= shlib_emitter + + +def exists(env): + import SCons.Tool.mwcc + return SCons.Tool.mwcc.set_vars(env) + + +def shlib_generator(target, source, env, for_signature): + cmd = ['$SHLINK', '$SHLINKFLAGS', '-shared'] + + no_import_lib = env.get('no_import_lib', 0) + if no_import_lib: cmd.extend('-noimplib') + + dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') + if dll: cmd.extend(['-o', dll]) + + implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') + if implib: cmd.extend(['-implib', implib.get_string(for_signature)]) + + cmd.extend(['$SOURCES', '$_LIBDIRFLAGS', '$_LIBFLAGS']) + + return [cmd] + + +def shlib_emitter(target, source, env): + dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') + no_import_lib = env.get('no_import_lib', 0) + + if not dll: + raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX")) + + if not no_import_lib and \ + not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'): + + # Append an import library to the list of targets. + target.append(env.ReplaceIxes(dll, + 'SHLIBPREFIX', 'SHLIBSUFFIX', + 'LIBPREFIX', 'LIBSUFFIX')) + + return target, source + + +shlib_action = SCons.Action.Action(shlib_generator, generator=1) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/nasm.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/nasm.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/nasm.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/nasm.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,72 @@ +"""SCons.Tool.nasm + +Tool-specific initialization for nasm, the famous Netwide Assembler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/nasm.py 2013/03/03 09:48:35 garyo" + +import SCons.Defaults +import SCons.Tool +import SCons.Util + +ASSuffixes = ['.s', '.asm', '.ASM'] +ASPPSuffixes = ['.spp', '.SPP', '.sx'] +if SCons.Util.case_sensitive_suffixes('.s', '.S'): + ASPPSuffixes.extend(['.S']) +else: + ASSuffixes.extend(['.S']) + +def generate(env): + """Add Builders and construction variables for nasm to an Environment.""" + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in ASSuffixes: + static_obj.add_action(suffix, SCons.Defaults.ASAction) + static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) + + for suffix in ASPPSuffixes: + static_obj.add_action(suffix, SCons.Defaults.ASPPAction) + static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) + + env['AS'] = 'nasm' + env['ASFLAGS'] = SCons.Util.CLVar('') + env['ASPPFLAGS'] = '$ASFLAGS' + env['ASCOM'] = '$AS $ASFLAGS -o $TARGET $SOURCES' + env['ASPPCOM'] = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' + +def exists(env): + return env.Detect('nasm') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/__init__.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/__init__.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/__init__.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,312 @@ +"""SCons.Tool.Packaging + +SCons Packaging Tool. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/packaging/__init__.py 2013/03/03 09:48:35 garyo" + +import SCons.Environment +from SCons.Variables import * +from SCons.Errors import * +from SCons.Util import is_List, make_path_relative +from SCons.Warnings import warn, Warning + +import os, imp +import SCons.Defaults + +__all__ = [ 'src_targz', 'src_tarbz2', 'src_zip', 'tarbz2', 'targz', 'zip', 'rpm', 'msi', 'ipk' ] + +# +# Utility and Builder function +# +def Tag(env, target, source, *more_tags, **kw_tags): + """ Tag a file with the given arguments, just sets the accordingly named + attribute on the file object. + + TODO: FIXME + """ + if not target: + target=source + first_tag=None + else: + first_tag=source + + if first_tag: + kw_tags[first_tag[0]] = '' + + if len(kw_tags) == 0 and len(more_tags) == 0: + raise UserError("No tags given.") + + # XXX: sanity checks + for x in more_tags: + kw_tags[x] = '' + + if not SCons.Util.is_List(target): + target=[target] + else: + # hmm, sometimes the target list, is a list of a list + # make sure it is flattened prior to processing. + # TODO: perhaps some bug ?!? + target=env.Flatten(target) + + for t in target: + for (k,v) in kw_tags.items(): + # all file tags have to start with PACKAGING_, so we can later + # differentiate between "normal" object attributes and the + # packaging attributes. As the user should not be bothered with + # that, the prefix will be added here if missing. + #if not k.startswith('PACKAGING_'): + if k[:10] != 'PACKAGING_': + k='PACKAGING_'+k + setattr(t, k, v) + +def Package(env, target=None, source=None, **kw): + """ Entry point for the package tool. + """ + # check if we need to find the source files ourself + if not source: + source = env.FindInstalledFiles() + + if len(source)==0: + raise UserError("No source for Package() given") + + # decide which types of packages shall be built. Can be defined through + # four mechanisms: command line argument, keyword argument, + # environment argument and default selection( zip or tar.gz ) in that + # order. + try: kw['PACKAGETYPE']=env['PACKAGETYPE'] + except KeyError: pass + + if not kw.get('PACKAGETYPE'): + from SCons.Script import GetOption + kw['PACKAGETYPE'] = GetOption('package_type') + + if kw['PACKAGETYPE'] == None: + if 'Tar' in env['BUILDERS']: + kw['PACKAGETYPE']='targz' + elif 'Zip' in env['BUILDERS']: + kw['PACKAGETYPE']='zip' + else: + raise UserError("No type for Package() given") + + PACKAGETYPE=kw['PACKAGETYPE'] + if not is_List(PACKAGETYPE): + PACKAGETYPE=PACKAGETYPE.split(',') + + # load the needed packagers. + def load_packager(type): + try: + file,path,desc=imp.find_module(type, __path__) + return imp.load_module(type, file, path, desc) + except ImportError, e: + raise EnvironmentError("packager %s not available: %s"%(type,str(e))) + + packagers=list(map(load_packager, PACKAGETYPE)) + + # set up targets and the PACKAGEROOT + try: + # fill up the target list with a default target name until the PACKAGETYPE + # list is of the same size as the target list. + if not target: target = [] + + size_diff = len(PACKAGETYPE)-len(target) + default_name = "%(NAME)s-%(VERSION)s" + + if size_diff>0: + default_target = default_name%kw + target.extend( [default_target]*size_diff ) + + if 'PACKAGEROOT' not in kw: + kw['PACKAGEROOT'] = default_name%kw + + except KeyError, e: + raise SCons.Errors.UserError( "Missing Packagetag '%s'"%e.args[0] ) + + # setup the source files + source=env.arg2nodes(source, env.fs.Entry) + + # call the packager to setup the dependencies. + targets=[] + try: + for packager in packagers: + t=[target.pop(0)] + t=packager.package(env,t,source, **kw) + targets.extend(t) + + assert( len(target) == 0 ) + + except KeyError, e: + raise SCons.Errors.UserError( "Missing Packagetag '%s' for %s packager"\ + % (e.args[0],packager.__name__) ) + except TypeError, e: + # this exception means that a needed argument for the packager is + # missing. As our packagers get their "tags" as named function + # arguments we need to find out which one is missing. + from inspect import getargspec + args,varargs,varkw,defaults=getargspec(packager.package) + if defaults!=None: + args=args[:-len(defaults)] # throw away arguments with default values + args.remove('env') + args.remove('target') + args.remove('source') + # now remove any args for which we have a value in kw. + args=[x for x in args if x not in kw] + + if len(args)==0: + raise # must be a different error, so reraise + elif len(args)==1: + raise SCons.Errors.UserError( "Missing Packagetag '%s' for %s packager"\ + % (args[0],packager.__name__) ) + else: + raise SCons.Errors.UserError( "Missing Packagetags '%s' for %s packager"\ + % (", ".join(args),packager.__name__) ) + + target=env.arg2nodes(target, env.fs.Entry) + targets.extend(env.Alias( 'package', targets )) + return targets + +# +# SCons tool initialization functions +# + +added = None + +def generate(env): + from SCons.Script import AddOption + global added + if not added: + added = 1 + AddOption('--package-type', + dest='package_type', + default=None, + type="string", + action="store", + help='The type of package to create.') + + try: + env['BUILDERS']['Package'] + env['BUILDERS']['Tag'] + except KeyError: + env['BUILDERS']['Package'] = Package + env['BUILDERS']['Tag'] = Tag + +def exists(env): + return 1 + +# XXX +def options(opts): + opts.AddVariables( + EnumVariable( 'PACKAGETYPE', + 'the type of package to create.', + None, allowed_values=list(map( str, __all__ )), + ignorecase=2 + ) + ) + +# +# Internal utility functions +# + +def copy_attr(f1, f2): + """ copies the special packaging file attributes from f1 to f2. + """ + #pattrs = [x for x in dir(f1) if not hasattr(f2, x) and\ + # x.startswith('PACKAGING_')] + copyit = lambda x: not hasattr(f2, x) and x[:10] == 'PACKAGING_' + pattrs = list(filter(copyit, dir(f1))) + for attr in pattrs: + setattr(f2, attr, getattr(f1, attr)) +def putintopackageroot(target, source, env, pkgroot, honor_install_location=1): + """ Uses the CopyAs builder to copy all source files to the directory given + in pkgroot. + + If honor_install_location is set and the copied source file has an + PACKAGING_INSTALL_LOCATION attribute, the PACKAGING_INSTALL_LOCATION is + used as the new name of the source file under pkgroot. + + The source file will not be copied if it is already under the the pkgroot + directory. + + All attributes of the source file will be copied to the new file. + """ + # make sure the packageroot is a Dir object. + if SCons.Util.is_String(pkgroot): pkgroot=env.Dir(pkgroot) + if not SCons.Util.is_List(source): source=[source] + + new_source = [] + for file in source: + if SCons.Util.is_String(file): file = env.File(file) + + if file.is_under(pkgroot): + new_source.append(file) + else: + if hasattr(file, 'PACKAGING_INSTALL_LOCATION') and\ + honor_install_location: + new_name=make_path_relative(file.PACKAGING_INSTALL_LOCATION) + else: + new_name=make_path_relative(file.get_path()) + + new_file=pkgroot.File(new_name) + new_file=env.CopyAs(new_file, file)[0] + copy_attr(file, new_file) + new_source.append(new_file) + + return (target, new_source) + +def stripinstallbuilder(target, source, env): + """ strips the install builder action from the source list and stores + the final installation location as the "PACKAGING_INSTALL_LOCATION" of + the source of the source file. This effectively removes the final installed + files from the source list while remembering the installation location. + + It also warns about files which have no install builder attached. + """ + def has_no_install_location(file): + return not (file.has_builder() and\ + hasattr(file.builder, 'name') and\ + (file.builder.name=="InstallBuilder" or\ + file.builder.name=="InstallAsBuilder")) + + if len(list(filter(has_no_install_location, source))): + warn(Warning, "there are files to package which have no\ + InstallBuilder attached, this might lead to irreproducible packages") + + n_source=[] + for s in source: + if has_no_install_location(s): + n_source.append(s) + else: + for ss in s.sources: + n_source.append(ss) + copy_attr(s, ss) + setattr(ss, 'PACKAGING_INSTALL_LOCATION', s.get_path()) + + return (target, n_source) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/ipk.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/ipk.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/ipk.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/ipk.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,185 @@ +"""SCons.Tool.Packaging.ipk +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/packaging/ipk.py 2013/03/03 09:48:35 garyo" + +import SCons.Builder +import SCons.Node.FS +import os + +from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot + +def package(env, target, source, PACKAGEROOT, NAME, VERSION, DESCRIPTION, + SUMMARY, X_IPK_PRIORITY, X_IPK_SECTION, SOURCE_URL, + X_IPK_MAINTAINER, X_IPK_DEPENDS, **kw): + """ this function prepares the packageroot directory for packaging with the + ipkg builder. + """ + SCons.Tool.Tool('ipkg').generate(env) + + # setup the Ipkg builder + bld = env['BUILDERS']['Ipkg'] + target, source = stripinstallbuilder(target, source, env) + target, source = putintopackageroot(target, source, env, PACKAGEROOT) + + # This should be overridable from the construction environment, + # which it is by using ARCHITECTURE=. + # Guessing based on what os.uname() returns at least allows it + # to work for both i386 and x86_64 Linux systems. + archmap = { + 'i686' : 'i386', + 'i586' : 'i386', + 'i486' : 'i386', + } + + buildarchitecture = os.uname()[4] + buildarchitecture = archmap.get(buildarchitecture, buildarchitecture) + + if 'ARCHITECTURE' in kw: + buildarchitecture = kw['ARCHITECTURE'] + + # setup the kw to contain the mandatory arguments to this fucntion. + # do this before calling any builder or setup function + loc=locals() + del loc['kw'] + kw.update(loc) + del kw['source'], kw['target'], kw['env'] + + # generate the specfile + specfile = gen_ipk_dir(PACKAGEROOT, source, env, kw) + + # override the default target. + if str(target[0])=="%s-%s"%(NAME, VERSION): + target=[ "%s_%s_%s.ipk"%(NAME, VERSION, buildarchitecture) ] + + # now apply the Ipkg builder + return bld(env, target, specfile, **kw) + +def gen_ipk_dir(proot, source, env, kw): + # make sure the packageroot is a Dir object. + if SCons.Util.is_String(proot): proot=env.Dir(proot) + + # create the specfile builder + s_bld=SCons.Builder.Builder( + action = build_specfiles, + ) + + # create the specfile targets + spec_target=[] + control=proot.Dir('CONTROL') + spec_target.append(control.File('control')) + spec_target.append(control.File('conffiles')) + spec_target.append(control.File('postrm')) + spec_target.append(control.File('prerm')) + spec_target.append(control.File('postinst')) + spec_target.append(control.File('preinst')) + + # apply the builder to the specfile targets + s_bld(env, spec_target, source, **kw) + + # the packageroot directory does now contain the specfiles. + return proot + +def build_specfiles(source, target, env): + """ filter the targets for the needed files and use the variables in env + to create the specfile. + """ + # + # At first we care for the CONTROL/control file, which is the main file for ipk. + # + # For this we need to open multiple files in random order, so we store into + # a dict so they can be easily accessed. + # + # + opened_files={} + def open_file(needle, haystack): + try: + return opened_files[needle] + except KeyError: + file=filter(lambda x: x.get_path().rfind(needle)!=-1, haystack)[0] + opened_files[needle]=open(file.abspath, 'w') + return opened_files[needle] + + control_file=open_file('control', target) + + if 'X_IPK_DESCRIPTION' not in env: + env['X_IPK_DESCRIPTION']="%s\n %s"%(env['SUMMARY'], + env['DESCRIPTION'].replace('\n', '\n ')) + + + content = """ +Package: $NAME +Version: $VERSION +Priority: $X_IPK_PRIORITY +Section: $X_IPK_SECTION +Source: $SOURCE_URL +Architecture: $ARCHITECTURE +Maintainer: $X_IPK_MAINTAINER +Depends: $X_IPK_DEPENDS +Description: $X_IPK_DESCRIPTION +""" + + control_file.write(env.subst(content)) + + # + # now handle the various other files, which purpose it is to set post-, + # pre-scripts and mark files as config files. + # + # We do so by filtering the source files for files which are marked with + # the "config" tag and afterwards we do the same for x_ipk_postrm, + # x_ipk_prerm, x_ipk_postinst and x_ipk_preinst tags. + # + # The first one will write the name of the file into the file + # CONTROL/configfiles, the latter add the content of the x_ipk_* variable + # into the same named file. + # + for f in [x for x in source if 'PACKAGING_CONFIG' in dir(x)]: + config=open_file('conffiles') + config.write(f.PACKAGING_INSTALL_LOCATION) + config.write('\n') + + for str in 'POSTRM PRERM POSTINST PREINST'.split(): + name="PACKAGING_X_IPK_%s"%str + for f in [x for x in source if name in dir(x)]: + file=open_file(name) + file.write(env[str]) + + # + # close all opened files + for f in opened_files.values(): + f.close() + + # call a user specified function + if 'CHANGE_SPECFILE' in env: + content += env['CHANGE_SPECFILE'](target) + + return 0 + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/msi.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/msi.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/msi.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/msi.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,527 @@ +"""SCons.Tool.packaging.msi + +The msi packager. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/packaging/msi.py 2013/03/03 09:48:35 garyo" + +import os +import SCons +from SCons.Action import Action +from SCons.Builder import Builder + +from xml.dom.minidom import * +from xml.sax.saxutils import escape + +from SCons.Tool.packaging import stripinstallbuilder + +# +# Utility functions +# +def convert_to_id(s, id_set): + """ Some parts of .wxs need an Id attribute (for example: The File and + Directory directives. The charset is limited to A-Z, a-z, digits, + underscores, periods. Each Id must begin with a letter or with a + underscore. Google for "CNDL0015" for information about this. + + Requirements: + * the string created must only contain chars from the target charset. + * the string created must have a minimal editing distance from the + original string. + * the string created must be unique for the whole .wxs file. + + Observation: + * There are 62 chars in the charset. + + Idea: + * filter out forbidden characters. Check for a collision with the help + of the id_set. Add the number of the number of the collision at the + end of the created string. Furthermore care for a correct start of + the string. + """ + charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxyz0123456789_.' + if s[0] in '0123456789.': + s += '_'+s + id = [c for c in s if c in charset] + + # did we already generate an id for this file? + try: + return id_set[id][s] + except KeyError: + # no we did not so initialize with the id + if id not in id_set: id_set[id] = { s : id } + # there is a collision, generate an id which is unique by appending + # the collision number + else: id_set[id][s] = id + str(len(id_set[id])) + + return id_set[id][s] + +def is_dos_short_file_name(file): + """ examine if the given file is in the 8.3 form. + """ + fname, ext = os.path.splitext(file) + proper_ext = len(ext) == 0 or (2 <= len(ext) <= 4) # the ext contains the dot + proper_fname = file.isupper() and len(fname) <= 8 + + return proper_ext and proper_fname + +def gen_dos_short_file_name(file, filename_set): + """ see http://support.microsoft.com/default.aspx?scid=kb;en-us;Q142982 + + These are no complete 8.3 dos short names. The ~ char is missing and + replaced with one character from the filename. WiX warns about such + filenames, since a collision might occur. Google for "CNDL1014" for + more information. + """ + # guard this to not confuse the generation + if is_dos_short_file_name(file): + return file + + fname, ext = os.path.splitext(file) # ext contains the dot + + # first try if it suffices to convert to upper + file = file.upper() + if is_dos_short_file_name(file): + return file + + # strip forbidden characters. + forbidden = '."/[]:;=, ' + fname = [c for c in fname if c not in forbidden] + + # check if we already generated a filename with the same number: + # thisis1.txt, thisis2.txt etc. + duplicate, num = not None, 1 + while duplicate: + shortname = "%s%s" % (fname[:8-len(str(num))].upper(),\ + str(num)) + if len(ext) >= 2: + shortname = "%s%s" % (shortname, ext[:4].upper()) + + duplicate, num = shortname in filename_set, num+1 + + assert( is_dos_short_file_name(shortname) ), 'shortname is %s, longname is %s' % (shortname, file) + filename_set.append(shortname) + return shortname + +def create_feature_dict(files): + """ X_MSI_FEATURE and doc FileTag's can be used to collect files in a + hierarchy. This function collects the files into this hierarchy. + """ + dict = {} + + def add_to_dict( feature, file ): + if not SCons.Util.is_List( feature ): + feature = [ feature ] + + for f in feature: + if f not in dict: + dict[ f ] = [ file ] + else: + dict[ f ].append( file ) + + for file in files: + if hasattr( file, 'PACKAGING_X_MSI_FEATURE' ): + add_to_dict(file.PACKAGING_X_MSI_FEATURE, file) + elif hasattr( file, 'PACKAGING_DOC' ): + add_to_dict( 'PACKAGING_DOC', file ) + else: + add_to_dict( 'default', file ) + + return dict + +def generate_guids(root): + """ generates globally unique identifiers for parts of the xml which need + them. + + Component tags have a special requirement. Their UUID is only allowed to + change if the list of their contained resources has changed. This allows + for clean removal and proper updates. + + To handle this requirement, the uuid is generated with an md5 hashing the + whole subtree of a xml node. + """ + from hashlib import md5 + + # specify which tags need a guid and in which attribute this should be stored. + needs_id = { 'Product' : 'Id', + 'Package' : 'Id', + 'Component' : 'Guid', + } + + # find all XMl nodes matching the key, retrieve their attribute, hash their + # subtree, convert hash to string and add as a attribute to the xml node. + for (key,value) in needs_id.items(): + node_list = root.getElementsByTagName(key) + attribute = value + for node in node_list: + hash = md5(node.toxml()).hexdigest() + hash_str = '%s-%s-%s-%s-%s' % ( hash[:8], hash[8:12], hash[12:16], hash[16:20], hash[20:] ) + node.attributes[attribute] = hash_str + + + +def string_wxsfile(target, source, env): + return "building WiX file %s"%( target[0].path ) + +def build_wxsfile(target, source, env): + """ compiles a .wxs file from the keywords given in env['msi_spec'] and + by analyzing the tree of source nodes and their tags. + """ + file = open(target[0].abspath, 'w') + + try: + # Create a document with the Wix root tag + doc = Document() + root = doc.createElement( 'Wix' ) + root.attributes['xmlns']='http://schemas.microsoft.com/wix/2003/01/wi' + doc.appendChild( root ) + + filename_set = [] # this is to circumvent duplicates in the shortnames + id_set = {} # this is to circumvent duplicates in the ids + + # Create the content + build_wxsfile_header_section(root, env) + build_wxsfile_file_section(root, source, env['NAME'], env['VERSION'], env['VENDOR'], filename_set, id_set) + generate_guids(root) + build_wxsfile_features_section(root, source, env['NAME'], env['VERSION'], env['SUMMARY'], id_set) + build_wxsfile_default_gui(root) + build_license_file(target[0].get_dir(), env) + + # write the xml to a file + file.write( doc.toprettyxml() ) + + # call a user specified function + if 'CHANGE_SPECFILE' in env: + env['CHANGE_SPECFILE'](target, source) + + except KeyError, e: + raise SCons.Errors.UserError( '"%s" package field for MSI is missing.' % e.args[0] ) + +# +# setup function +# +def create_default_directory_layout(root, NAME, VERSION, VENDOR, filename_set): + """ Create the wix default target directory layout and return the innermost + directory. + + We assume that the XML tree delivered in the root argument already contains + the Product tag. + + Everything is put under the PFiles directory property defined by WiX. + After that a directory with the 'VENDOR' tag is placed and then a + directory with the name of the project and its VERSION. This leads to the + following TARGET Directory Layout: + C:\\\\ + Example: C:\Programme\Company\Product-1.2\ + """ + doc = Document() + d1 = doc.createElement( 'Directory' ) + d1.attributes['Id'] = 'TARGETDIR' + d1.attributes['Name'] = 'SourceDir' + + d2 = doc.createElement( 'Directory' ) + d2.attributes['Id'] = 'ProgramFilesFolder' + d2.attributes['Name'] = 'PFiles' + + d3 = doc.createElement( 'Directory' ) + d3.attributes['Id'] = 'VENDOR_folder' + d3.attributes['Name'] = escape( gen_dos_short_file_name( VENDOR, filename_set ) ) + d3.attributes['LongName'] = escape( VENDOR ) + + d4 = doc.createElement( 'Directory' ) + project_folder = "%s-%s" % ( NAME, VERSION ) + d4.attributes['Id'] = 'MY_DEFAULT_FOLDER' + d4.attributes['Name'] = escape( gen_dos_short_file_name( project_folder, filename_set ) ) + d4.attributes['LongName'] = escape( project_folder ) + + d1.childNodes.append( d2 ) + d2.childNodes.append( d3 ) + d3.childNodes.append( d4 ) + + root.getElementsByTagName('Product')[0].childNodes.append( d1 ) + + return d4 + +# +# mandatory and optional file tags +# +def build_wxsfile_file_section(root, files, NAME, VERSION, VENDOR, filename_set, id_set): + """ builds the Component sections of the wxs file with their included files. + + Files need to be specified in 8.3 format and in the long name format, long + filenames will be converted automatically. + + Features are specficied with the 'X_MSI_FEATURE' or 'DOC' FileTag. + """ + root = create_default_directory_layout( root, NAME, VERSION, VENDOR, filename_set ) + components = create_feature_dict( files ) + factory = Document() + + def get_directory( node, dir ): + """ returns the node under the given node representing the directory. + + Returns the component node if dir is None or empty. + """ + if dir == '' or not dir: + return node + + Directory = node + dir_parts = dir.split(os.path.sep) + + # to make sure that our directory ids are unique, the parent folders are + # consecutively added to upper_dir + upper_dir = '' + + # walk down the xml tree finding parts of the directory + dir_parts = [d for d in dir_parts if d != ''] + for d in dir_parts[:]: + already_created = [c for c in Directory.childNodes + if c.nodeName == 'Directory' + and c.attributes['LongName'].value == escape(d)] + + if already_created != []: + Directory = already_created[0] + dir_parts.remove(d) + upper_dir += d + else: + break + + for d in dir_parts: + nDirectory = factory.createElement( 'Directory' ) + nDirectory.attributes['LongName'] = escape( d ) + nDirectory.attributes['Name'] = escape( gen_dos_short_file_name( d, filename_set ) ) + upper_dir += d + nDirectory.attributes['Id'] = convert_to_id( upper_dir, id_set ) + + Directory.childNodes.append( nDirectory ) + Directory = nDirectory + + return Directory + + for file in files: + drive, path = os.path.splitdrive( file.PACKAGING_INSTALL_LOCATION ) + filename = os.path.basename( path ) + dirname = os.path.dirname( path ) + + h = { + # tagname : default value + 'PACKAGING_X_MSI_VITAL' : 'yes', + 'PACKAGING_X_MSI_FILEID' : convert_to_id(filename, id_set), + 'PACKAGING_X_MSI_LONGNAME' : filename, + 'PACKAGING_X_MSI_SHORTNAME' : gen_dos_short_file_name(filename, filename_set), + 'PACKAGING_X_MSI_SOURCE' : file.get_path(), + } + + # fill in the default tags given above. + for k,v in [ (k, v) for (k,v) in h.items() if not hasattr(file, k) ]: + setattr( file, k, v ) + + File = factory.createElement( 'File' ) + File.attributes['LongName'] = escape( file.PACKAGING_X_MSI_LONGNAME ) + File.attributes['Name'] = escape( file.PACKAGING_X_MSI_SHORTNAME ) + File.attributes['Source'] = escape( file.PACKAGING_X_MSI_SOURCE ) + File.attributes['Id'] = escape( file.PACKAGING_X_MSI_FILEID ) + File.attributes['Vital'] = escape( file.PACKAGING_X_MSI_VITAL ) + + # create the Tag under which this file should appear + Component = factory.createElement('Component') + Component.attributes['DiskId'] = '1' + Component.attributes['Id'] = convert_to_id( filename, id_set ) + + # hang the component node under the root node and the file node + # under the component node. + Directory = get_directory( root, dirname ) + Directory.childNodes.append( Component ) + Component.childNodes.append( File ) + +# +# additional functions +# +def build_wxsfile_features_section(root, files, NAME, VERSION, SUMMARY, id_set): + """ This function creates the tag based on the supplied xml tree. + + This is achieved by finding all s and adding them to a default target. + + It should be called after the tree has been built completly. We assume + that a MY_DEFAULT_FOLDER Property is defined in the wxs file tree. + + Furthermore a top-level with the name and VERSION of the software will be created. + + An PACKAGING_X_MSI_FEATURE can either be a string, where the feature + DESCRIPTION will be the same as its title or a Tuple, where the first + part will be its title and the second its DESCRIPTION. + """ + factory = Document() + Feature = factory.createElement('Feature') + Feature.attributes['Id'] = 'complete' + Feature.attributes['ConfigurableDirectory'] = 'MY_DEFAULT_FOLDER' + Feature.attributes['Level'] = '1' + Feature.attributes['Title'] = escape( '%s %s' % (NAME, VERSION) ) + Feature.attributes['Description'] = escape( SUMMARY ) + Feature.attributes['Display'] = 'expand' + + for (feature, files) in create_feature_dict(files).items(): + SubFeature = factory.createElement('Feature') + SubFeature.attributes['Level'] = '1' + + if SCons.Util.is_Tuple(feature): + SubFeature.attributes['Id'] = convert_to_id( feature[0], id_set ) + SubFeature.attributes['Title'] = escape(feature[0]) + SubFeature.attributes['Description'] = escape(feature[1]) + else: + SubFeature.attributes['Id'] = convert_to_id( feature, id_set ) + if feature=='default': + SubFeature.attributes['Description'] = 'Main Part' + SubFeature.attributes['Title'] = 'Main Part' + elif feature=='PACKAGING_DOC': + SubFeature.attributes['Description'] = 'Documentation' + SubFeature.attributes['Title'] = 'Documentation' + else: + SubFeature.attributes['Description'] = escape(feature) + SubFeature.attributes['Title'] = escape(feature) + + # build the componentrefs. As one of the design decision is that every + # file is also a component we walk the list of files and create a + # reference. + for f in files: + ComponentRef = factory.createElement('ComponentRef') + ComponentRef.attributes['Id'] = convert_to_id( os.path.basename(f.get_path()), id_set ) + SubFeature.childNodes.append(ComponentRef) + + Feature.childNodes.append(SubFeature) + + root.getElementsByTagName('Product')[0].childNodes.append(Feature) + +def build_wxsfile_default_gui(root): + """ this function adds a default GUI to the wxs file + """ + factory = Document() + Product = root.getElementsByTagName('Product')[0] + + UIRef = factory.createElement('UIRef') + UIRef.attributes['Id'] = 'WixUI_Mondo' + Product.childNodes.append(UIRef) + + UIRef = factory.createElement('UIRef') + UIRef.attributes['Id'] = 'WixUI_ErrorProgressText' + Product.childNodes.append(UIRef) + +def build_license_file(directory, spec): + """ creates a License.rtf file with the content of "X_MSI_LICENSE_TEXT" + in the given directory + """ + name, text = '', '' + + try: + name = spec['LICENSE'] + text = spec['X_MSI_LICENSE_TEXT'] + except KeyError: + pass # ignore this as X_MSI_LICENSE_TEXT is optional + + if name!='' or text!='': + file = open( os.path.join(directory.get_path(), 'License.rtf'), 'w' ) + file.write('{\\rtf') + if text!='': + file.write(text.replace('\n', '\\par ')) + else: + file.write(name+'\\par\\par') + file.write('}') + file.close() + +# +# mandatory and optional package tags +# +def build_wxsfile_header_section(root, spec): + """ Adds the xml file node which define the package meta-data. + """ + # Create the needed DOM nodes and add them at the correct position in the tree. + factory = Document() + Product = factory.createElement( 'Product' ) + Package = factory.createElement( 'Package' ) + + root.childNodes.append( Product ) + Product.childNodes.append( Package ) + + # set "mandatory" default values + if 'X_MSI_LANGUAGE' not in spec: + spec['X_MSI_LANGUAGE'] = '1033' # select english + + # mandatory sections, will throw a KeyError if the tag is not available + Product.attributes['Name'] = escape( spec['NAME'] ) + Product.attributes['Version'] = escape( spec['VERSION'] ) + Product.attributes['Manufacturer'] = escape( spec['VENDOR'] ) + Product.attributes['Language'] = escape( spec['X_MSI_LANGUAGE'] ) + Package.attributes['Description'] = escape( spec['SUMMARY'] ) + + # now the optional tags, for which we avoid the KeyErrror exception + if 'DESCRIPTION' in spec: + Package.attributes['Comments'] = escape( spec['DESCRIPTION'] ) + + if 'X_MSI_UPGRADE_CODE' in spec: + Package.attributes['X_MSI_UPGRADE_CODE'] = escape( spec['X_MSI_UPGRADE_CODE'] ) + + # We hardcode the media tag as our current model cannot handle it. + Media = factory.createElement('Media') + Media.attributes['Id'] = '1' + Media.attributes['Cabinet'] = 'default.cab' + Media.attributes['EmbedCab'] = 'yes' + root.getElementsByTagName('Product')[0].childNodes.append(Media) + +# this builder is the entry-point for .wxs file compiler. +wxs_builder = Builder( + action = Action( build_wxsfile, string_wxsfile ), + ensure_suffix = '.wxs' ) + +def package(env, target, source, PACKAGEROOT, NAME, VERSION, + DESCRIPTION, SUMMARY, VENDOR, X_MSI_LANGUAGE, **kw): + # make sure that the Wix Builder is in the environment + SCons.Tool.Tool('wix').generate(env) + + # get put the keywords for the specfile compiler. These are the arguments + # given to the package function and all optional ones stored in kw, minus + # the the source, target and env one. + loc = locals() + del loc['kw'] + kw.update(loc) + del kw['source'], kw['target'], kw['env'] + + # strip the install builder from the source files + target, source = stripinstallbuilder(target, source, env) + + # put the arguments into the env and call the specfile builder. + env['msi_spec'] = kw + specfile = wxs_builder(* [env, target, source], **kw) + + # now call the WiX Tool with the built specfile added as a source. + msifile = env.WiX(target, specfile) + + # return the target and source tuple. + return (msifile, source+[specfile]) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/rpm.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/rpm.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/rpm.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/rpm.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,357 @@ +"""SCons.Tool.Packaging.rpm + +The rpm packager. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/packaging/rpm.py 2013/03/03 09:48:35 garyo" + +import os + +import SCons.Builder +import SCons.Tool.rpmutils + +from SCons.Environment import OverrideEnvironment +from SCons.Tool.packaging import stripinstallbuilder, src_targz +from SCons.Errors import UserError + +def package(env, target, source, PACKAGEROOT, NAME, VERSION, + PACKAGEVERSION, DESCRIPTION, SUMMARY, X_RPM_GROUP, LICENSE, + **kw): + # initialize the rpm tool + SCons.Tool.Tool('rpm').generate(env) + + bld = env['BUILDERS']['Rpm'] + + # Generate a UserError whenever the target name has been set explicitly, + # since rpm does not allow for controlling it. This is detected by + # checking if the target has been set to the default by the Package() + # Environment function. + if str(target[0])!="%s-%s"%(NAME, VERSION): + raise UserError( "Setting target is not supported for rpm." ) + else: + # This should be overridable from the construction environment, + # which it is by using ARCHITECTURE=. + buildarchitecture = SCons.Tool.rpmutils.defaultMachine() + + if 'ARCHITECTURE' in kw: + buildarchitecture = kw['ARCHITECTURE'] + + fmt = '%s-%s-%s.%s.rpm' + srcrpm = fmt % (NAME, VERSION, PACKAGEVERSION, 'src') + binrpm = fmt % (NAME, VERSION, PACKAGEVERSION, buildarchitecture) + + target = [ srcrpm, binrpm ] + + # get the correct arguments into the kw hash + loc=locals() + del loc['kw'] + kw.update(loc) + del kw['source'], kw['target'], kw['env'] + + # if no "SOURCE_URL" tag is given add a default one. + if 'SOURCE_URL' not in kw: + #kw['SOURCE_URL']=(str(target[0])+".tar.gz").replace('.rpm', '') + kw['SOURCE_URL']=(str(target[0])+".tar.gz").replace('.rpm', '') + + # mangle the source and target list for the rpmbuild + env = OverrideEnvironment(env, kw) + target, source = stripinstallbuilder(target, source, env) + target, source = addspecfile(target, source, env) + target, source = collectintargz(target, source, env) + + # now call the rpm builder to actually build the packet. + return bld(env, target, source, **kw) + +def collectintargz(target, source, env): + """ Puts all source files into a tar.gz file. """ + # the rpm tool depends on a source package, until this is chagned + # this hack needs to be here that tries to pack all sources in. + sources = env.FindSourceFiles() + + # filter out the target we are building the source list for. + #sources = [s for s in sources if not (s in target)] + sources = [s for s in sources if s not in target] + + # find the .spec file for rpm and add it since it is not necessarily found + # by the FindSourceFiles function. + #sources.extend( [s for s in source if str(s).rfind('.spec')!=-1] ) + spec_file = lambda s: str(s).rfind('.spec') != -1 + sources.extend( list(filter(spec_file, source)) ) + + # as the source contains the url of the source package this rpm package + # is built from, we extract the target name + #tarball = (str(target[0])+".tar.gz").replace('.rpm', '') + tarball = (str(target[0])+".tar.gz").replace('.rpm', '') + try: + #tarball = env['SOURCE_URL'].split('/')[-1] + tarball = env['SOURCE_URL'].split('/')[-1] + except KeyError, e: + raise SCons.Errors.UserError( "Missing PackageTag '%s' for RPM packager" % e.args[0] ) + + tarball = src_targz.package(env, source=sources, target=tarball, + PACKAGEROOT=env['PACKAGEROOT'], ) + + return (target, tarball) + +def addspecfile(target, source, env): + specfile = "%s-%s" % (env['NAME'], env['VERSION']) + + bld = SCons.Builder.Builder(action = build_specfile, + suffix = '.spec', + target_factory = SCons.Node.FS.File) + + source.extend(bld(env, specfile, source)) + + return (target,source) + +def build_specfile(target, source, env): + """ Builds a RPM specfile from a dictionary with string metadata and + by analyzing a tree of nodes. + """ + file = open(target[0].abspath, 'w') + str = "" + + try: + file.write( build_specfile_header(env) ) + file.write( build_specfile_sections(env) ) + file.write( build_specfile_filesection(env, source) ) + file.close() + + # call a user specified function + if 'CHANGE_SPECFILE' in env: + env['CHANGE_SPECFILE'](target, source) + + except KeyError, e: + raise SCons.Errors.UserError( '"%s" package field for RPM is missing.' % e.args[0] ) + + +# +# mandatory and optional package tag section +# +def build_specfile_sections(spec): + """ Builds the sections of a rpm specfile. + """ + str = "" + + mandatory_sections = { + 'DESCRIPTION' : '\n%%description\n%s\n\n', } + + str = str + SimpleTagCompiler(mandatory_sections).compile( spec ) + + optional_sections = { + 'DESCRIPTION_' : '%%description -l %s\n%s\n\n', + 'CHANGELOG' : '%%changelog\n%s\n\n', + 'X_RPM_PREINSTALL' : '%%pre\n%s\n\n', + 'X_RPM_POSTINSTALL' : '%%post\n%s\n\n', + 'X_RPM_PREUNINSTALL' : '%%preun\n%s\n\n', + 'X_RPM_POSTUNINSTALL' : '%%postun\n%s\n\n', + 'X_RPM_VERIFY' : '%%verify\n%s\n\n', + + # These are for internal use but could possibly be overriden + 'X_RPM_PREP' : '%%prep\n%s\n\n', + 'X_RPM_BUILD' : '%%build\n%s\n\n', + 'X_RPM_INSTALL' : '%%install\n%s\n\n', + 'X_RPM_CLEAN' : '%%clean\n%s\n\n', + } + + # Default prep, build, install and clean rules + # TODO: optimize those build steps, to not compile the project a second time + if 'X_RPM_PREP' not in spec: + spec['X_RPM_PREP'] = '[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"' + '\n%setup -q' + + if 'X_RPM_BUILD' not in spec: + spec['X_RPM_BUILD'] = 'mkdir "$RPM_BUILD_ROOT"' + + if 'X_RPM_INSTALL' not in spec: + spec['X_RPM_INSTALL'] = 'scons --install-sandbox="$RPM_BUILD_ROOT" "$RPM_BUILD_ROOT"' + + if 'X_RPM_CLEAN' not in spec: + spec['X_RPM_CLEAN'] = '[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"' + + str = str + SimpleTagCompiler(optional_sections, mandatory=0).compile( spec ) + + return str + +def build_specfile_header(spec): + """ Builds all section but the %file of a rpm specfile + """ + str = "" + + # first the mandatory sections + mandatory_header_fields = { + 'NAME' : '%%define name %s\nName: %%{name}\n', + 'VERSION' : '%%define version %s\nVersion: %%{version}\n', + 'PACKAGEVERSION' : '%%define release %s\nRelease: %%{release}\n', + 'X_RPM_GROUP' : 'Group: %s\n', + 'SUMMARY' : 'Summary: %s\n', + 'LICENSE' : 'License: %s\n', } + + str = str + SimpleTagCompiler(mandatory_header_fields).compile( spec ) + + # now the optional tags + optional_header_fields = { + 'VENDOR' : 'Vendor: %s\n', + 'X_RPM_URL' : 'Url: %s\n', + 'SOURCE_URL' : 'Source: %s\n', + 'SUMMARY_' : 'Summary(%s): %s\n', + 'X_RPM_DISTRIBUTION' : 'Distribution: %s\n', + 'X_RPM_ICON' : 'Icon: %s\n', + 'X_RPM_PACKAGER' : 'Packager: %s\n', + 'X_RPM_GROUP_' : 'Group(%s): %s\n', + + 'X_RPM_REQUIRES' : 'Requires: %s\n', + 'X_RPM_PROVIDES' : 'Provides: %s\n', + 'X_RPM_CONFLICTS' : 'Conflicts: %s\n', + 'X_RPM_BUILDREQUIRES' : 'BuildRequires: %s\n', + + 'X_RPM_SERIAL' : 'Serial: %s\n', + 'X_RPM_EPOCH' : 'Epoch: %s\n', + 'X_RPM_AUTOREQPROV' : 'AutoReqProv: %s\n', + 'X_RPM_EXCLUDEARCH' : 'ExcludeArch: %s\n', + 'X_RPM_EXCLUSIVEARCH' : 'ExclusiveArch: %s\n', + 'X_RPM_PREFIX' : 'Prefix: %s\n', + 'X_RPM_CONFLICTS' : 'Conflicts: %s\n', + + # internal use + 'X_RPM_BUILDROOT' : 'BuildRoot: %s\n', } + + # fill in default values: + # Adding a BuildRequires renders the .rpm unbuildable under System, which + # are not managed by rpm, since the database to resolve this dependency is + # missing (take Gentoo as an example) +# if not s.has_key('x_rpm_BuildRequires'): +# s['x_rpm_BuildRequires'] = 'scons' + + if 'X_RPM_BUILDROOT' not in spec: + spec['X_RPM_BUILDROOT'] = '%{_tmppath}/%{name}-%{version}-%{release}' + + str = str + SimpleTagCompiler(optional_header_fields, mandatory=0).compile( spec ) + return str + +# +# mandatory and optional file tags +# +def build_specfile_filesection(spec, files): + """ builds the %file section of the specfile + """ + str = '%files\n' + + if 'X_RPM_DEFATTR' not in spec: + spec['X_RPM_DEFATTR'] = '(-,root,root)' + + str = str + '%%defattr %s\n' % spec['X_RPM_DEFATTR'] + + supported_tags = { + 'PACKAGING_CONFIG' : '%%config %s', + 'PACKAGING_CONFIG_NOREPLACE' : '%%config(noreplace) %s', + 'PACKAGING_DOC' : '%%doc %s', + 'PACKAGING_UNIX_ATTR' : '%%attr %s', + 'PACKAGING_LANG_' : '%%lang(%s) %s', + 'PACKAGING_X_RPM_VERIFY' : '%%verify %s', + 'PACKAGING_X_RPM_DIR' : '%%dir %s', + 'PACKAGING_X_RPM_DOCDIR' : '%%docdir %s', + 'PACKAGING_X_RPM_GHOST' : '%%ghost %s', } + + for file in files: + # build the tagset + tags = {} + for k in supported_tags.keys(): + try: + tags[k]=getattr(file, k) + except AttributeError: + pass + + # compile the tagset + str = str + SimpleTagCompiler(supported_tags, mandatory=0).compile( tags ) + + str = str + ' ' + str = str + file.PACKAGING_INSTALL_LOCATION + str = str + '\n\n' + + return str + +class SimpleTagCompiler(object): + """ This class is a simple string substition utility: + the replacement specfication is stored in the tagset dictionary, something + like: + { "abc" : "cdef %s ", + "abc_" : "cdef %s %s" } + + the compile function gets a value dictionary, which may look like: + { "abc" : "ghij", + "abc_gh" : "ij" } + + The resulting string will be: + "cdef ghij cdef gh ij" + """ + def __init__(self, tagset, mandatory=1): + self.tagset = tagset + self.mandatory = mandatory + + def compile(self, values): + """ compiles the tagset and returns a str containing the result + """ + def is_international(tag): + #return tag.endswith('_') + return tag[-1:] == '_' + + def get_country_code(tag): + return tag[-2:] + + def strip_country_code(tag): + return tag[:-2] + + replacements = list(self.tagset.items()) + + str = "" + #domestic = [ (k,v) for k,v in replacements if not is_international(k) ] + domestic = [t for t in replacements if not is_international(t[0])] + for key, replacement in domestic: + try: + str = str + replacement % values[key] + except KeyError, e: + if self.mandatory: + raise e + + #international = [ (k,v) for k,v in replacements if is_international(k) ] + international = [t for t in replacements if is_international(t[0])] + for key, replacement in international: + try: + #int_values_for_key = [ (get_country_code(k),v) for k,v in values.items() if strip_country_code(k) == key ] + x = [t for t in values.items() if strip_country_code(t[0]) == key] + int_values_for_key = [(get_country_code(t[0]),t[1]) for t in x] + for v in int_values_for_key: + str = str + replacement % v + except KeyError, e: + if self.mandatory: + raise e + + return str + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/src_tarbz2.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/src_tarbz2.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/src_tarbz2.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/src_tarbz2.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,43 @@ +"""SCons.Tool.Packaging.tarbz2 + +The tarbz2 SRC packager. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/packaging/src_tarbz2.py 2013/03/03 09:48:35 garyo" + +from SCons.Tool.packaging import putintopackageroot + +def package(env, target, source, PACKAGEROOT, **kw): + bld = env['BUILDERS']['Tar'] + bld.set_suffix('.tar.bz2') + target, source = putintopackageroot(target, source, env, PACKAGEROOT, honor_install_location=0) + return bld(env, target, source, TARFLAGS='-jc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/src_targz.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/src_targz.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/src_targz.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/src_targz.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,43 @@ +"""SCons.Tool.Packaging.targz + +The targz SRC packager. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/packaging/src_targz.py 2013/03/03 09:48:35 garyo" + +from SCons.Tool.packaging import putintopackageroot + +def package(env, target, source, PACKAGEROOT, **kw): + bld = env['BUILDERS']['Tar'] + bld.set_suffix('.tar.gz') + target, source = putintopackageroot(target, source, env, PACKAGEROOT, honor_install_location=0) + return bld(env, target, source, TARFLAGS='-zc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/src_zip.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/src_zip.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/src_zip.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/src_zip.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,43 @@ +"""SCons.Tool.Packaging.zip + +The zip SRC packager. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/packaging/src_zip.py 2013/03/03 09:48:35 garyo" + +from SCons.Tool.packaging import putintopackageroot + +def package(env, target, source, PACKAGEROOT, **kw): + bld = env['BUILDERS']['Zip'] + bld.set_suffix('.zip') + target, source = putintopackageroot(target, source, env, PACKAGEROOT, honor_install_location=0) + return bld(env, target, source) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/tarbz2.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/tarbz2.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/tarbz2.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/tarbz2.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,44 @@ +"""SCons.Tool.Packaging.tarbz2 + +The tarbz2 SRC packager. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/packaging/tarbz2.py 2013/03/03 09:48:35 garyo" + +from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot + +def package(env, target, source, PACKAGEROOT, **kw): + bld = env['BUILDERS']['Tar'] + bld.set_suffix('.tar.gz') + target, source = putintopackageroot(target, source, env, PACKAGEROOT) + target, source = stripinstallbuilder(target, source, env) + return bld(env, target, source, TARFLAGS='-jc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/targz.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/targz.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/targz.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/targz.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,44 @@ +"""SCons.Tool.Packaging.targz + +The targz SRC packager. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/packaging/targz.py 2013/03/03 09:48:35 garyo" + +from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot + +def package(env, target, source, PACKAGEROOT, **kw): + bld = env['BUILDERS']['Tar'] + bld.set_suffix('.tar.gz') + target, source = stripinstallbuilder(target, source, env) + target, source = putintopackageroot(target, source, env, PACKAGEROOT) + return bld(env, target, source, TARFLAGS='-zc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/zip.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/zip.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/packaging/zip.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/packaging/zip.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,44 @@ +"""SCons.Tool.Packaging.zip + +The zip SRC packager. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/packaging/zip.py 2013/03/03 09:48:35 garyo" + +from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot + +def package(env, target, source, PACKAGEROOT, **kw): + bld = env['BUILDERS']['Zip'] + bld.set_suffix('.zip') + target, source = stripinstallbuilder(target, source, env) + target, source = putintopackageroot(target, source, env, PACKAGEROOT) + return bld(env, target, source) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/pdf.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/pdf.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/pdf.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/pdf.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,78 @@ +"""SCons.Tool.pdf + +Common PDF Builder definition for various other Tool modules that use it. +Add an explicit action to run epstopdf to convert .eps files to .pdf + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/pdf.py 2013/03/03 09:48:35 garyo" + +import SCons.Builder +import SCons.Tool + +PDFBuilder = None + +EpsPdfAction = SCons.Action.Action('$EPSTOPDFCOM', '$EPSTOPDFCOMSTR') + +def generate(env): + try: + env['BUILDERS']['PDF'] + except KeyError: + global PDFBuilder + if PDFBuilder is None: + PDFBuilder = SCons.Builder.Builder(action = {}, + source_scanner = SCons.Tool.PDFLaTeXScanner, + prefix = '$PDFPREFIX', + suffix = '$PDFSUFFIX', + emitter = {}, + source_ext_match = None, + single_source=True) + env['BUILDERS']['PDF'] = PDFBuilder + + env['PDFPREFIX'] = '' + env['PDFSUFFIX'] = '.pdf' + +# put the epstopdf builder in this routine so we can add it after +# the pdftex builder so that one is the default for no source suffix +def generate2(env): + bld = env['BUILDERS']['PDF'] + #bld.add_action('.ps', EpsPdfAction) # this is covered by direct Ghostcript action in gs.py + bld.add_action('.eps', EpsPdfAction) + + env['EPSTOPDF'] = 'epstopdf' + env['EPSTOPDFFLAGS'] = SCons.Util.CLVar('') + env['EPSTOPDFCOM'] = '$EPSTOPDF $EPSTOPDFFLAGS ${SOURCE} --outfile=${TARGET}' + +def exists(env): + # This only puts a skeleton Builder in place, so if someone + # references this Tool directly, it's always "available." + return 1 + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/pdflatex.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/pdflatex.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/pdflatex.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/pdflatex.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,84 @@ +"""SCons.Tool.pdflatex + +Tool-specific initialization for pdflatex. +Generates .pdf files from .latex or .ltx files + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/pdflatex.py 2013/03/03 09:48:35 garyo" + +import SCons.Action +import SCons.Util +import SCons.Tool.pdf +import SCons.Tool.tex + +PDFLaTeXAction = None + +def PDFLaTeXAuxFunction(target = None, source= None, env=None): + result = SCons.Tool.tex.InternalLaTeXAuxAction( PDFLaTeXAction, target, source, env ) + if result != 0: + SCons.Tool.tex.check_file_error_message(env['PDFLATEX']) + return result + +PDFLaTeXAuxAction = None + +def generate(env): + """Add Builders and construction variables for pdflatex to an Environment.""" + global PDFLaTeXAction + if PDFLaTeXAction is None: + PDFLaTeXAction = SCons.Action.Action('$PDFLATEXCOM', '$PDFLATEXCOMSTR') + + global PDFLaTeXAuxAction + if PDFLaTeXAuxAction is None: + PDFLaTeXAuxAction = SCons.Action.Action(PDFLaTeXAuxFunction, + strfunction=SCons.Tool.tex.TeXLaTeXStrFunction) + + env.AppendUnique(LATEXSUFFIXES=SCons.Tool.LaTeXSuffixes) + + import pdf + pdf.generate(env) + + bld = env['BUILDERS']['PDF'] + bld.add_action('.ltx', PDFLaTeXAuxAction) + bld.add_action('.latex', PDFLaTeXAuxAction) + bld.add_emitter('.ltx', SCons.Tool.tex.tex_pdf_emitter) + bld.add_emitter('.latex', SCons.Tool.tex.tex_pdf_emitter) + + SCons.Tool.tex.generate_common(env) + +def exists(env): + SCons.Tool.tex.generate_darwin(env) + return env.Detect('pdflatex') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/pdftex.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/pdftex.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/pdftex.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/pdftex.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,109 @@ +"""SCons.Tool.pdftex + +Tool-specific initialization for pdftex. +Generates .pdf files from .tex files + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/pdftex.py 2013/03/03 09:48:35 garyo" + +import os +import SCons.Action +import SCons.Util +import SCons.Tool.tex + +PDFTeXAction = None + +# This action might be needed more than once if we are dealing with +# labels and bibtex. +PDFLaTeXAction = None + +def PDFLaTeXAuxAction(target = None, source= None, env=None): + result = SCons.Tool.tex.InternalLaTeXAuxAction( PDFLaTeXAction, target, source, env ) + return result + +def PDFTeXLaTeXFunction(target = None, source= None, env=None): + """A builder for TeX and LaTeX that scans the source file to + decide the "flavor" of the source and then executes the appropriate + program.""" + basedir = os.path.split(str(source[0]))[0] + abspath = os.path.abspath(basedir) + + if SCons.Tool.tex.is_LaTeX(source,env,abspath): + result = PDFLaTeXAuxAction(target,source,env) + if result != 0: + SCons.Tool.tex.check_file_error_message(env['PDFLATEX']) + else: + result = PDFTeXAction(target,source,env) + if result != 0: + SCons.Tool.tex.check_file_error_message(env['PDFTEX']) + return result + +PDFTeXLaTeXAction = None + +def generate(env): + """Add Builders and construction variables for pdftex to an Environment.""" + global PDFTeXAction + if PDFTeXAction is None: + PDFTeXAction = SCons.Action.Action('$PDFTEXCOM', '$PDFTEXCOMSTR') + + global PDFLaTeXAction + if PDFLaTeXAction is None: + PDFLaTeXAction = SCons.Action.Action("$PDFLATEXCOM", "$PDFLATEXCOMSTR") + + global PDFTeXLaTeXAction + if PDFTeXLaTeXAction is None: + PDFTeXLaTeXAction = SCons.Action.Action(PDFTeXLaTeXFunction, + strfunction=SCons.Tool.tex.TeXLaTeXStrFunction) + + env.AppendUnique(LATEXSUFFIXES=SCons.Tool.LaTeXSuffixes) + + import pdf + pdf.generate(env) + + bld = env['BUILDERS']['PDF'] + bld.add_action('.tex', PDFTeXLaTeXAction) + bld.add_emitter('.tex', SCons.Tool.tex.tex_pdf_emitter) + + # Add the epstopdf builder after the pdftex builder + # so pdftex is the default for no source suffix + pdf.generate2(env) + + SCons.Tool.tex.generate_common(env) + +def exists(env): + SCons.Tool.tex.generate_darwin(env) + return env.Detect('pdftex') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/qt.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/qt.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/qt.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/qt.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,336 @@ + +"""SCons.Tool.qt + +Tool-specific initialization for Qt. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/qt.py 2013/03/03 09:48:35 garyo" + +import os.path +import re + +import SCons.Action +import SCons.Builder +import SCons.Defaults +import SCons.Scanner +import SCons.Tool +import SCons.Util + +class ToolQtWarning(SCons.Warnings.Warning): + pass + +class GeneratedMocFileNotIncluded(ToolQtWarning): + pass + +class QtdirNotFound(ToolQtWarning): + pass + +SCons.Warnings.enableWarningClass(ToolQtWarning) + +header_extensions = [".h", ".hxx", ".hpp", ".hh"] +if SCons.Util.case_sensitive_suffixes('.h', '.H'): + header_extensions.append('.H') +cplusplus = __import__('c++', globals(), locals(), []) +cxx_suffixes = cplusplus.CXXSuffixes + +def checkMocIncluded(target, source, env): + moc = target[0] + cpp = source[0] + # looks like cpp.includes is cleared before the build stage :-( + # not really sure about the path transformations (moc.cwd? cpp.cwd?) :-/ + path = SCons.Defaults.CScan.path(env, moc.cwd) + includes = SCons.Defaults.CScan(cpp, env, path) + if not moc in includes: + SCons.Warnings.warn( + GeneratedMocFileNotIncluded, + "Generated moc file '%s' is not included by '%s'" % + (str(moc), str(cpp))) + +def find_file(filename, paths, node_factory): + for dir in paths: + node = node_factory(filename, dir) + if node.rexists(): + return node + return None + +class _Automoc(object): + """ + Callable class, which works as an emitter for Programs, SharedLibraries and + StaticLibraries. + """ + + def __init__(self, objBuilderName): + self.objBuilderName = objBuilderName + + def __call__(self, target, source, env): + """ + Smart autoscan function. Gets the list of objects for the Program + or Lib. Adds objects and builders for the special qt files. + """ + try: + if int(env.subst('$QT_AUTOSCAN')) == 0: + return target, source + except ValueError: + pass + try: + debug = int(env.subst('$QT_DEBUG')) + except ValueError: + debug = 0 + + # some shortcuts used in the scanner + splitext = SCons.Util.splitext + objBuilder = getattr(env, self.objBuilderName) + + # some regular expressions: + # Q_OBJECT detection + q_object_search = re.compile(r'[^A-Za-z0-9]Q_OBJECT[^A-Za-z0-9]') + # cxx and c comment 'eater' + #comment = re.compile(r'(//.*)|(/\*(([^*])|(\*[^/]))*\*/)') + # CW: something must be wrong with the regexp. See also bug #998222 + # CURRENTLY THERE IS NO TEST CASE FOR THAT + + # The following is kind of hacky to get builders working properly (FIXME) + objBuilderEnv = objBuilder.env + objBuilder.env = env + mocBuilderEnv = env.Moc.env + env.Moc.env = env + + # make a deep copy for the result; MocH objects will be appended + out_sources = source[:] + + for obj in source: + if not obj.has_builder(): + # binary obj file provided + if debug: + print "scons: qt: '%s' seems to be a binary. Discarded." % str(obj) + continue + cpp = obj.sources[0] + if not splitext(str(cpp))[1] in cxx_suffixes: + if debug: + print "scons: qt: '%s' is no cxx file. Discarded." % str(cpp) + # c or fortran source + continue + #cpp_contents = comment.sub('', cpp.get_text_contents()) + cpp_contents = cpp.get_text_contents() + h=None + for h_ext in header_extensions: + # try to find the header file in the corresponding source + # directory + hname = splitext(cpp.name)[0] + h_ext + h = find_file(hname, (cpp.get_dir(),), env.File) + if h: + if debug: + print "scons: qt: Scanning '%s' (header of '%s')" % (str(h), str(cpp)) + #h_contents = comment.sub('', h.get_text_contents()) + h_contents = h.get_text_contents() + break + if not h and debug: + print "scons: qt: no header for '%s'." % (str(cpp)) + if h and q_object_search.search(h_contents): + # h file with the Q_OBJECT macro found -> add moc_cpp + moc_cpp = env.Moc(h) + moc_o = objBuilder(moc_cpp) + out_sources.append(moc_o) + #moc_cpp.target_scanner = SCons.Defaults.CScan + if debug: + print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp)) + if cpp and q_object_search.search(cpp_contents): + # cpp file with Q_OBJECT macro found -> add moc + # (to be included in cpp) + moc = env.Moc(cpp) + env.Ignore(moc, moc) + if debug: + print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(cpp), str(moc)) + #moc.source_scanner = SCons.Defaults.CScan + # restore the original env attributes (FIXME) + objBuilder.env = objBuilderEnv + env.Moc.env = mocBuilderEnv + + return (target, out_sources) + +AutomocShared = _Automoc('SharedObject') +AutomocStatic = _Automoc('StaticObject') + +def _detect(env): + """Not really safe, but fast method to detect the QT library""" + QTDIR = None + if not QTDIR: + QTDIR = env.get('QTDIR',None) + if not QTDIR: + QTDIR = os.environ.get('QTDIR',None) + if not QTDIR: + moc = env.WhereIs('moc') + if moc: + QTDIR = os.path.dirname(os.path.dirname(moc)) + SCons.Warnings.warn( + QtdirNotFound, + "Could not detect qt, using moc executable as a hint (QTDIR=%s)" % QTDIR) + else: + QTDIR = None + SCons.Warnings.warn( + QtdirNotFound, + "Could not detect qt, using empty QTDIR") + return QTDIR + +def uicEmitter(target, source, env): + adjustixes = SCons.Util.adjustixes + bs = SCons.Util.splitext(str(source[0].name))[0] + bs = os.path.join(str(target[0].get_dir()),bs) + # first target (header) is automatically added by builder + if len(target) < 2: + # second target is implementation + target.append(adjustixes(bs, + env.subst('$QT_UICIMPLPREFIX'), + env.subst('$QT_UICIMPLSUFFIX'))) + if len(target) < 3: + # third target is moc file + target.append(adjustixes(bs, + env.subst('$QT_MOCHPREFIX'), + env.subst('$QT_MOCHSUFFIX'))) + return target, source + +def uicScannerFunc(node, env, path): + lookout = [] + lookout.extend(env['CPPPATH']) + lookout.append(str(node.rfile().dir)) + includes = re.findall("(.*?)", node.get_text_contents()) + result = [] + for incFile in includes: + dep = env.FindFile(incFile,lookout) + if dep: + result.append(dep) + return result + +uicScanner = SCons.Scanner.Base(uicScannerFunc, + name = "UicScanner", + node_class = SCons.Node.FS.File, + node_factory = SCons.Node.FS.File, + recursive = 0) + +def generate(env): + """Add Builders and construction variables for qt to an Environment.""" + CLVar = SCons.Util.CLVar + Action = SCons.Action.Action + Builder = SCons.Builder.Builder + + env.SetDefault(QTDIR = _detect(env), + QT_BINPATH = os.path.join('$QTDIR', 'bin'), + QT_CPPPATH = os.path.join('$QTDIR', 'include'), + QT_LIBPATH = os.path.join('$QTDIR', 'lib'), + QT_MOC = os.path.join('$QT_BINPATH','moc'), + QT_UIC = os.path.join('$QT_BINPATH','uic'), + QT_LIB = 'qt', # may be set to qt-mt + + QT_AUTOSCAN = 1, # scan for moc'able sources + + # Some QT specific flags. I don't expect someone wants to + # manipulate those ... + QT_UICIMPLFLAGS = CLVar(''), + QT_UICDECLFLAGS = CLVar(''), + QT_MOCFROMHFLAGS = CLVar(''), + QT_MOCFROMCXXFLAGS = CLVar('-i'), + + # suffixes/prefixes for the headers / sources to generate + QT_UICDECLPREFIX = '', + QT_UICDECLSUFFIX = '.h', + QT_UICIMPLPREFIX = 'uic_', + QT_UICIMPLSUFFIX = '$CXXFILESUFFIX', + QT_MOCHPREFIX = 'moc_', + QT_MOCHSUFFIX = '$CXXFILESUFFIX', + QT_MOCCXXPREFIX = '', + QT_MOCCXXSUFFIX = '.moc', + QT_UISUFFIX = '.ui', + + # Commands for the qt support ... + # command to generate header, implementation and moc-file + # from a .ui file + QT_UICCOM = [ + CLVar('$QT_UIC $QT_UICDECLFLAGS -o ${TARGETS[0]} $SOURCE'), + CLVar('$QT_UIC $QT_UICIMPLFLAGS -impl ${TARGETS[0].file} ' + '-o ${TARGETS[1]} $SOURCE'), + CLVar('$QT_MOC $QT_MOCFROMHFLAGS -o ${TARGETS[2]} ${TARGETS[0]}')], + # command to generate meta object information for a class + # declarated in a header + QT_MOCFROMHCOM = ( + '$QT_MOC $QT_MOCFROMHFLAGS -o ${TARGETS[0]} $SOURCE'), + # command to generate meta object information for a class + # declarated in a cpp file + QT_MOCFROMCXXCOM = [ + CLVar('$QT_MOC $QT_MOCFROMCXXFLAGS -o ${TARGETS[0]} $SOURCE'), + Action(checkMocIncluded,None)]) + + # ... and the corresponding builders + uicBld = Builder(action=SCons.Action.Action('$QT_UICCOM', '$QT_UICCOMSTR'), + emitter=uicEmitter, + src_suffix='$QT_UISUFFIX', + suffix='$QT_UICDECLSUFFIX', + prefix='$QT_UICDECLPREFIX', + source_scanner=uicScanner) + mocBld = Builder(action={}, prefix={}, suffix={}) + for h in header_extensions: + act = SCons.Action.Action('$QT_MOCFROMHCOM', '$QT_MOCFROMHCOMSTR') + mocBld.add_action(h, act) + mocBld.prefix[h] = '$QT_MOCHPREFIX' + mocBld.suffix[h] = '$QT_MOCHSUFFIX' + for cxx in cxx_suffixes: + act = SCons.Action.Action('$QT_MOCFROMCXXCOM', '$QT_MOCFROMCXXCOMSTR') + mocBld.add_action(cxx, act) + mocBld.prefix[cxx] = '$QT_MOCCXXPREFIX' + mocBld.suffix[cxx] = '$QT_MOCCXXSUFFIX' + + # register the builders + env['BUILDERS']['Uic'] = uicBld + env['BUILDERS']['Moc'] = mocBld + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + static_obj.add_src_builder('Uic') + shared_obj.add_src_builder('Uic') + + # We use the emitters of Program / StaticLibrary / SharedLibrary + # to scan for moc'able files + # We can't refer to the builders directly, we have to fetch them + # as Environment attributes because that sets them up to be called + # correctly later by our emitter. + env.AppendUnique(PROGEMITTER =[AutomocStatic], + SHLIBEMITTER=[AutomocShared], + LIBEMITTER =[AutomocStatic], + # Of course, we need to link against the qt libraries + CPPPATH=["$QT_CPPPATH"], + LIBPATH=["$QT_LIBPATH"], + LIBS=['$QT_LIB']) + +def exists(env): + return _detect(env) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/rmic.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/rmic.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/rmic.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/rmic.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,126 @@ +"""SCons.Tool.rmic + +Tool-specific initialization for rmic. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/rmic.py 2013/03/03 09:48:35 garyo" + +import os.path + +import SCons.Action +import SCons.Builder +import SCons.Node.FS +import SCons.Util + +def emit_rmic_classes(target, source, env): + """Create and return lists of Java RMI stub and skeleton + class files to be created from a set of class files. + """ + class_suffix = env.get('JAVACLASSSUFFIX', '.class') + classdir = env.get('JAVACLASSDIR') + + if not classdir: + try: + s = source[0] + except IndexError: + classdir = '.' + else: + try: + classdir = s.attributes.java_classdir + except AttributeError: + classdir = '.' + classdir = env.Dir(classdir).rdir() + if str(classdir) == '.': + c_ = None + else: + c_ = str(classdir) + os.sep + + slist = [] + for src in source: + try: + classname = src.attributes.java_classname + except AttributeError: + classname = str(src) + if c_ and classname[:len(c_)] == c_: + classname = classname[len(c_):] + if class_suffix and classname[:-len(class_suffix)] == class_suffix: + classname = classname[-len(class_suffix):] + s = src.rfile() + s.attributes.java_classdir = classdir + s.attributes.java_classname = classname + slist.append(s) + + stub_suffixes = ['_Stub'] + if env.get('JAVAVERSION') == '1.4': + stub_suffixes.append('_Skel') + + tlist = [] + for s in source: + for suff in stub_suffixes: + fname = s.attributes.java_classname.replace('.', os.sep) + \ + suff + class_suffix + t = target[0].File(fname) + t.attributes.java_lookupdir = target[0] + tlist.append(t) + + return tlist, source + +RMICAction = SCons.Action.Action('$RMICCOM', '$RMICCOMSTR') + +RMICBuilder = SCons.Builder.Builder(action = RMICAction, + emitter = emit_rmic_classes, + src_suffix = '$JAVACLASSSUFFIX', + target_factory = SCons.Node.FS.Dir, + source_factory = SCons.Node.FS.File) + +def generate(env): + """Add Builders and construction variables for rmic to an Environment.""" + env['BUILDERS']['RMIC'] = RMICBuilder + + env['RMIC'] = 'rmic' + env['RMICFLAGS'] = SCons.Util.CLVar('') + env['RMICCOM'] = '$RMIC $RMICFLAGS -d ${TARGET.attributes.java_lookupdir} -classpath ${SOURCE.attributes.java_classdir} ${SOURCES.attributes.java_classname}' + env['JAVACLASSSUFFIX'] = '.class' + +def exists(env): + # As reported by Jan Nijtmans in issue #2730, the simple + # return env.Detect('rmic') + # doesn't always work during initialization. For now, we + # stop trying to detect an executable (analogous to the + # javac Builder). + # TODO: Come up with a proper detect() routine...and enable it. + return 1 + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/rpcgen.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/rpcgen.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/rpcgen.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/rpcgen.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,70 @@ +"""SCons.Tool.rpcgen + +Tool-specific initialization for RPCGEN tools. + +Three normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/rpcgen.py 2013/03/03 09:48:35 garyo" + +from SCons.Builder import Builder +import SCons.Util + +cmd = "cd ${SOURCE.dir} && $RPCGEN -%s $RPCGENFLAGS %s -o ${TARGET.abspath} ${SOURCE.file}" + +rpcgen_client = cmd % ('l', '$RPCGENCLIENTFLAGS') +rpcgen_header = cmd % ('h', '$RPCGENHEADERFLAGS') +rpcgen_service = cmd % ('m', '$RPCGENSERVICEFLAGS') +rpcgen_xdr = cmd % ('c', '$RPCGENXDRFLAGS') + +def generate(env): + "Add RPCGEN Builders and construction variables for an Environment." + + client = Builder(action=rpcgen_client, suffix='_clnt.c', src_suffix='.x') + header = Builder(action=rpcgen_header, suffix='.h', src_suffix='.x') + service = Builder(action=rpcgen_service, suffix='_svc.c', src_suffix='.x') + xdr = Builder(action=rpcgen_xdr, suffix='_xdr.c', src_suffix='.x') + env.Append(BUILDERS={'RPCGenClient' : client, + 'RPCGenHeader' : header, + 'RPCGenService' : service, + 'RPCGenXDR' : xdr}) + env['RPCGEN'] = 'rpcgen' + env['RPCGENFLAGS'] = SCons.Util.CLVar('') + env['RPCGENCLIENTFLAGS'] = SCons.Util.CLVar('') + env['RPCGENHEADERFLAGS'] = SCons.Util.CLVar('') + env['RPCGENSERVICEFLAGS'] = SCons.Util.CLVar('') + env['RPCGENXDRFLAGS'] = SCons.Util.CLVar('') + +def exists(env): + return env.Detect('rpcgen') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/rpm.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/rpm.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/rpm.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/rpm.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,132 @@ +"""SCons.Tool.rpm + +Tool-specific initialization for rpm. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +The rpm tool calls the rpmbuild command. The first and only argument should a +tar.gz consisting of the source file and a specfile. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/rpm.py 2013/03/03 09:48:35 garyo" + +import os +import re +import shutil +import subprocess + +import SCons.Builder +import SCons.Node.FS +import SCons.Util +import SCons.Action +import SCons.Defaults + +def get_cmd(source, env): + tar_file_with_included_specfile = source + if SCons.Util.is_List(source): + tar_file_with_included_specfile = source[0] + return "%s %s %s"%(env['RPM'], env['RPMFLAGS'], + tar_file_with_included_specfile.abspath ) + +def build_rpm(target, source, env): + # create a temporary rpm build root. + tmpdir = os.path.join( os.path.dirname( target[0].abspath ), 'rpmtemp' ) + if os.path.exists(tmpdir): + shutil.rmtree(tmpdir) + + # now create the mandatory rpm directory structure. + for d in ['RPMS', 'SRPMS', 'SPECS', 'BUILD']: + os.makedirs( os.path.join( tmpdir, d ) ) + + # set the topdir as an rpmflag. + env.Prepend( RPMFLAGS = '--define \'_topdir %s\'' % tmpdir ) + + # now call rpmbuild to create the rpm package. + handle = subprocess.Popen(get_cmd(source, env), + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + shell=True) + output = handle.stdout.read() + status = handle.wait() + + if status: + raise SCons.Errors.BuildError( node=target[0], + errstr=output, + filename=str(target[0]) ) + else: + # XXX: assume that LC_ALL=c is set while running rpmbuild + output_files = re.compile( 'Wrote: (.*)' ).findall( output ) + + for output, input in zip( output_files, target ): + rpm_output = os.path.basename(output) + expected = os.path.basename(input.get_path()) + + assert expected == rpm_output, "got %s but expected %s" % (rpm_output, expected) + shutil.copy( output, input.abspath ) + + + # cleanup before leaving. + shutil.rmtree(tmpdir) + + return status + +def string_rpm(target, source, env): + try: + return env['RPMCOMSTR'] + except KeyError: + return get_cmd(source, env) + +rpmAction = SCons.Action.Action(build_rpm, string_rpm) + +RpmBuilder = SCons.Builder.Builder(action = SCons.Action.Action('$RPMCOM', '$RPMCOMSTR'), + source_scanner = SCons.Defaults.DirScanner, + suffix = '$RPMSUFFIX') + + + +def generate(env): + """Add Builders and construction variables for rpm to an Environment.""" + try: + bld = env['BUILDERS']['Rpm'] + except KeyError: + bld = RpmBuilder + env['BUILDERS']['Rpm'] = bld + + env.SetDefault(RPM = 'LC_ALL=c rpmbuild') + env.SetDefault(RPMFLAGS = SCons.Util.CLVar('-ta')) + env.SetDefault(RPMCOM = rpmAction) + env.SetDefault(RPMSUFFIX = '.rpm') + +def exists(env): + return env.Detect('rpmbuild') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/rpmutils.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/rpmutils.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/rpmutils.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/rpmutils.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,533 @@ +"""SCons.Tool.rpmutils.py + +RPM specific helper routines for general usage in the test framework +and SCons core modules. + +Since we check for the RPM package target name in several places, +we have to know which machine/system name RPM will use for the current +hardware setup. The following dictionaries and functions try to +mimic the exact naming rules of the RPM source code. +They were directly derived from the file "rpmrc.in" of the version +rpm-4.9.1.3. For updating to a more recent version of RPM, this Python +script can be used standalone. The usage() function below shows the +exact syntax. + +""" + +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/rpmutils.py 2013/03/03 09:48:35 garyo" + + +import platform + +# Start of rpmrc dictionaries (Marker, don't change or remove!) +os_canon = { + 'AIX' : ['AIX','5'], + 'AmigaOS' : ['AmigaOS','5'], + 'BSD_OS' : ['bsdi','12'], + 'CYGWIN32_95' : ['cygwin32','15'], + 'CYGWIN32_NT' : ['cygwin32','14'], + 'Darwin' : ['darwin','21'], + 'FreeBSD' : ['FreeBSD','8'], + 'HP-UX' : ['hpux10','6'], + 'IRIX' : ['Irix','2'], + 'IRIX64' : ['Irix64','10'], + 'Linux' : ['Linux','1'], + 'Linux/390' : ['OS/390','20'], + 'Linux/ESA' : ['VM/ESA','20'], + 'MacOSX' : ['macosx','21'], + 'MiNT' : ['FreeMiNT','17'], + 'NEXTSTEP' : ['NextStep','11'], + 'OS/390' : ['OS/390','18'], + 'OSF1' : ['osf1','7'], + 'SCO_SV' : ['SCO_SV3.2v5.0.2','9'], + 'SunOS4' : ['SunOS','4'], + 'SunOS5' : ['solaris','3'], + 'UNIX_SV' : ['MP_RAS','16'], + 'VM/ESA' : ['VM/ESA','19'], + 'machten' : ['machten','13'], + 'osf3.2' : ['osf1','7'], + 'osf4.0' : ['osf1','7'], +} + +buildarch_compat = { + 'alpha' : ['noarch'], + 'alphaev5' : ['alpha'], + 'alphaev56' : ['alphaev5'], + 'alphaev6' : ['alphapca56'], + 'alphaev67' : ['alphaev6'], + 'alphapca56' : ['alphaev56'], + 'amd64' : ['x86_64'], + 'armv3l' : ['noarch'], + 'armv4b' : ['noarch'], + 'armv4l' : ['armv3l'], + 'armv4tl' : ['armv4l'], + 'armv5tejl' : ['armv5tel'], + 'armv5tel' : ['armv4tl'], + 'armv6l' : ['armv5tejl'], + 'armv7l' : ['armv6l'], + 'atariclone' : ['m68kmint','noarch'], + 'atarist' : ['m68kmint','noarch'], + 'atariste' : ['m68kmint','noarch'], + 'ataritt' : ['m68kmint','noarch'], + 'athlon' : ['i686'], + 'falcon' : ['m68kmint','noarch'], + 'geode' : ['i586'], + 'hades' : ['m68kmint','noarch'], + 'hppa1.0' : ['parisc'], + 'hppa1.1' : ['hppa1.0'], + 'hppa1.2' : ['hppa1.1'], + 'hppa2.0' : ['hppa1.2'], + 'i386' : ['noarch','fat'], + 'i486' : ['i386'], + 'i586' : ['i486'], + 'i686' : ['i586'], + 'ia32e' : ['x86_64'], + 'ia64' : ['noarch'], + 'm68k' : ['noarch'], + 'milan' : ['m68kmint','noarch'], + 'mips' : ['noarch'], + 'mipsel' : ['noarch'], + 'parisc' : ['noarch'], + 'pentium3' : ['i686'], + 'pentium4' : ['pentium3'], + 'ppc' : ['noarch','fat'], + 'ppc32dy4' : ['noarch'], + 'ppc64' : ['noarch','fat'], + 'ppc64iseries' : ['ppc64'], + 'ppc64pseries' : ['ppc64'], + 'ppc8260' : ['noarch'], + 'ppc8560' : ['noarch'], + 'ppciseries' : ['noarch'], + 'ppcpseries' : ['noarch'], + 's390' : ['noarch'], + 's390x' : ['noarch'], + 'sh3' : ['noarch'], + 'sh4' : ['noarch'], + 'sh4a' : ['sh4'], + 'sparc' : ['noarch'], + 'sparc64' : ['sparcv9v'], + 'sparc64v' : ['sparc64'], + 'sparcv8' : ['sparc'], + 'sparcv9' : ['sparcv8'], + 'sparcv9v' : ['sparcv9'], + 'sun4c' : ['noarch'], + 'sun4d' : ['noarch'], + 'sun4m' : ['noarch'], + 'sun4u' : ['noarch'], + 'x86_64' : ['noarch'], +} + +os_compat = { + 'BSD_OS' : ['bsdi'], + 'Darwin' : ['MacOSX'], + 'FreeMiNT' : ['mint','MiNT','TOS'], + 'IRIX64' : ['IRIX'], + 'MiNT' : ['FreeMiNT','mint','TOS'], + 'TOS' : ['FreeMiNT','MiNT','mint'], + 'bsdi4.0' : ['bsdi'], + 'hpux10.00' : ['hpux9.07'], + 'hpux10.01' : ['hpux10.00'], + 'hpux10.10' : ['hpux10.01'], + 'hpux10.20' : ['hpux10.10'], + 'hpux10.30' : ['hpux10.20'], + 'hpux11.00' : ['hpux10.30'], + 'hpux9.05' : ['hpux9.04'], + 'hpux9.07' : ['hpux9.05'], + 'mint' : ['FreeMiNT','MiNT','TOS'], + 'ncr-sysv4.3' : ['ncr-sysv4.2'], + 'osf4.0' : ['osf3.2','osf1'], + 'solaris2.4' : ['solaris2.3'], + 'solaris2.5' : ['solaris2.3','solaris2.4'], + 'solaris2.6' : ['solaris2.3','solaris2.4','solaris2.5'], + 'solaris2.7' : ['solaris2.3','solaris2.4','solaris2.5','solaris2.6'], +} + +arch_compat = { + 'alpha' : ['axp','noarch'], + 'alphaev5' : ['alpha'], + 'alphaev56' : ['alphaev5'], + 'alphaev6' : ['alphapca56'], + 'alphaev67' : ['alphaev6'], + 'alphapca56' : ['alphaev56'], + 'amd64' : ['x86_64','athlon','noarch'], + 'armv3l' : ['noarch'], + 'armv4b' : ['noarch'], + 'armv4l' : ['armv3l'], + 'armv4tl' : ['armv4l'], + 'armv5tejl' : ['armv5tel'], + 'armv5tel' : ['armv4tl'], + 'armv6l' : ['armv5tejl'], + 'armv7l' : ['armv6l'], + 'atariclone' : ['m68kmint','noarch'], + 'atarist' : ['m68kmint','noarch'], + 'atariste' : ['m68kmint','noarch'], + 'ataritt' : ['m68kmint','noarch'], + 'athlon' : ['i686'], + 'falcon' : ['m68kmint','noarch'], + 'geode' : ['i586'], + 'hades' : ['m68kmint','noarch'], + 'hppa1.0' : ['parisc'], + 'hppa1.1' : ['hppa1.0'], + 'hppa1.2' : ['hppa1.1'], + 'hppa2.0' : ['hppa1.2'], + 'i370' : ['noarch'], + 'i386' : ['noarch','fat'], + 'i486' : ['i386'], + 'i586' : ['i486'], + 'i686' : ['i586'], + 'ia32e' : ['x86_64','athlon','noarch'], + 'ia64' : ['noarch'], + 'milan' : ['m68kmint','noarch'], + 'mips' : ['noarch'], + 'mipsel' : ['noarch'], + 'osfmach3_i386' : ['i486'], + 'osfmach3_i486' : ['i486','osfmach3_i386'], + 'osfmach3_i586' : ['i586','osfmach3_i486'], + 'osfmach3_i686' : ['i686','osfmach3_i586'], + 'osfmach3_ppc' : ['ppc'], + 'parisc' : ['noarch'], + 'pentium3' : ['i686'], + 'pentium4' : ['pentium3'], + 'powerpc' : ['ppc'], + 'powerppc' : ['ppc'], + 'ppc' : ['rs6000'], + 'ppc32dy4' : ['ppc'], + 'ppc64' : ['ppc'], + 'ppc64iseries' : ['ppc64'], + 'ppc64pseries' : ['ppc64'], + 'ppc8260' : ['ppc'], + 'ppc8560' : ['ppc'], + 'ppciseries' : ['ppc'], + 'ppcpseries' : ['ppc'], + 'rs6000' : ['noarch','fat'], + 's390' : ['noarch'], + 's390x' : ['s390','noarch'], + 'sh3' : ['noarch'], + 'sh4' : ['noarch'], + 'sh4a' : ['sh4'], + 'sparc' : ['noarch'], + 'sparc64' : ['sparcv9'], + 'sparc64v' : ['sparc64'], + 'sparcv8' : ['sparc'], + 'sparcv9' : ['sparcv8'], + 'sparcv9v' : ['sparcv9'], + 'sun4c' : ['sparc'], + 'sun4d' : ['sparc'], + 'sun4m' : ['sparc'], + 'sun4u' : ['sparc64'], + 'x86_64' : ['amd64','athlon','noarch'], +} + +buildarchtranslate = { + 'alphaev5' : ['alpha'], + 'alphaev56' : ['alpha'], + 'alphaev6' : ['alpha'], + 'alphaev67' : ['alpha'], + 'alphapca56' : ['alpha'], + 'amd64' : ['x86_64'], + 'armv3l' : ['armv3l'], + 'armv4b' : ['armv4b'], + 'armv4l' : ['armv4l'], + 'armv4tl' : ['armv4tl'], + 'armv5tejl' : ['armv5tejl'], + 'armv5tel' : ['armv5tel'], + 'armv6l' : ['armv6l'], + 'armv7l' : ['armv7l'], + 'atariclone' : ['m68kmint'], + 'atarist' : ['m68kmint'], + 'atariste' : ['m68kmint'], + 'ataritt' : ['m68kmint'], + 'athlon' : ['i386'], + 'falcon' : ['m68kmint'], + 'geode' : ['i386'], + 'hades' : ['m68kmint'], + 'i386' : ['i386'], + 'i486' : ['i386'], + 'i586' : ['i386'], + 'i686' : ['i386'], + 'ia32e' : ['x86_64'], + 'ia64' : ['ia64'], + 'milan' : ['m68kmint'], + 'osfmach3_i386' : ['i386'], + 'osfmach3_i486' : ['i386'], + 'osfmach3_i586' : ['i386'], + 'osfmach3_i686' : ['i386'], + 'osfmach3_ppc' : ['ppc'], + 'pentium3' : ['i386'], + 'pentium4' : ['i386'], + 'powerpc' : ['ppc'], + 'powerppc' : ['ppc'], + 'ppc32dy4' : ['ppc'], + 'ppc64iseries' : ['ppc64'], + 'ppc64pseries' : ['ppc64'], + 'ppc8260' : ['ppc'], + 'ppc8560' : ['ppc'], + 'ppciseries' : ['ppc'], + 'ppcpseries' : ['ppc'], + 's390' : ['s390'], + 's390x' : ['s390x'], + 'sh3' : ['sh3'], + 'sh4' : ['sh4'], + 'sh4a' : ['sh4'], + 'sparc64v' : ['sparc64'], + 'sparcv8' : ['sparc'], + 'sparcv9' : ['sparc'], + 'sparcv9v' : ['sparc'], + 'sun4c' : ['sparc'], + 'sun4d' : ['sparc'], + 'sun4m' : ['sparc'], + 'sun4u' : ['sparc64'], + 'x86_64' : ['x86_64'], +} + +optflags = { + 'alpha' : ['-O2','-g','-mieee'], + 'alphaev5' : ['-O2','-g','-mieee','-mtune=ev5'], + 'alphaev56' : ['-O2','-g','-mieee','-mtune=ev56'], + 'alphaev6' : ['-O2','-g','-mieee','-mtune=ev6'], + 'alphaev67' : ['-O2','-g','-mieee','-mtune=ev67'], + 'alphapca56' : ['-O2','-g','-mieee','-mtune=pca56'], + 'amd64' : ['-O2','-g'], + 'armv3l' : ['-O2','-g','-march=armv3'], + 'armv4b' : ['-O2','-g','-march=armv4'], + 'armv4l' : ['-O2','-g','-march=armv4'], + 'armv4tl' : ['-O2','-g','-march=armv4t'], + 'armv5tejl' : ['-O2','-g','-march=armv5te'], + 'armv5tel' : ['-O2','-g','-march=armv5te'], + 'armv6l' : ['-O2','-g','-march=armv6'], + 'armv7l' : ['-O2','-g','-march=armv7'], + 'atariclone' : ['-O2','-g','-fomit-frame-pointer'], + 'atarist' : ['-O2','-g','-fomit-frame-pointer'], + 'atariste' : ['-O2','-g','-fomit-frame-pointer'], + 'ataritt' : ['-O2','-g','-fomit-frame-pointer'], + 'athlon' : ['-O2','-g','-march=athlon'], + 'falcon' : ['-O2','-g','-fomit-frame-pointer'], + 'fat' : ['-O2','-g','-arch','i386','-arch','ppc'], + 'geode' : ['-Os','-g','-m32','-march=geode'], + 'hades' : ['-O2','-g','-fomit-frame-pointer'], + 'hppa1.0' : ['-O2','-g','-mpa-risc-1-0'], + 'hppa1.1' : ['-O2','-g','-mpa-risc-1-0'], + 'hppa1.2' : ['-O2','-g','-mpa-risc-1-0'], + 'hppa2.0' : ['-O2','-g','-mpa-risc-1-0'], + 'i386' : ['-O2','-g','-march=i386','-mtune=i686'], + 'i486' : ['-O2','-g','-march=i486'], + 'i586' : ['-O2','-g','-march=i586'], + 'i686' : ['-O2','-g','-march=i686'], + 'ia32e' : ['-O2','-g'], + 'ia64' : ['-O2','-g'], + 'm68k' : ['-O2','-g','-fomit-frame-pointer'], + 'milan' : ['-O2','-g','-fomit-frame-pointer'], + 'mips' : ['-O2','-g'], + 'mipsel' : ['-O2','-g'], + 'parisc' : ['-O2','-g','-mpa-risc-1-0'], + 'pentium3' : ['-O2','-g','-march=pentium3'], + 'pentium4' : ['-O2','-g','-march=pentium4'], + 'ppc' : ['-O2','-g','-fsigned-char'], + 'ppc32dy4' : ['-O2','-g','-fsigned-char'], + 'ppc64' : ['-O2','-g','-fsigned-char'], + 'ppc8260' : ['-O2','-g','-fsigned-char'], + 'ppc8560' : ['-O2','-g','-fsigned-char'], + 'ppciseries' : ['-O2','-g','-fsigned-char'], + 'ppcpseries' : ['-O2','-g','-fsigned-char'], + 's390' : ['-O2','-g'], + 's390x' : ['-O2','-g'], + 'sh3' : ['-O2','-g'], + 'sh4' : ['-O2','-g','-mieee'], + 'sh4a' : ['-O2','-g','-mieee'], + 'sparc' : ['-O2','-g','-m32','-mtune=ultrasparc'], + 'sparc64' : ['-O2','-g','-m64','-mtune=ultrasparc'], + 'sparc64v' : ['-O2','-g','-m64','-mtune=niagara'], + 'sparcv8' : ['-O2','-g','-m32','-mtune=ultrasparc','-mv8'], + 'sparcv9' : ['-O2','-g','-m32','-mtune=ultrasparc'], + 'sparcv9v' : ['-O2','-g','-m32','-mtune=niagara'], + 'x86_64' : ['-O2','-g'], +} + +arch_canon = { + 'IP' : ['sgi','7'], + 'alpha' : ['alpha','2'], + 'alphaev5' : ['alphaev5','2'], + 'alphaev56' : ['alphaev56','2'], + 'alphaev6' : ['alphaev6','2'], + 'alphaev67' : ['alphaev67','2'], + 'alphapca56' : ['alphapca56','2'], + 'amd64' : ['amd64','1'], + 'armv3l' : ['armv3l','12'], + 'armv4b' : ['armv4b','12'], + 'armv4l' : ['armv4l','12'], + 'armv5tejl' : ['armv5tejl','12'], + 'armv5tel' : ['armv5tel','12'], + 'armv6l' : ['armv6l','12'], + 'armv7l' : ['armv7l','12'], + 'atariclone' : ['m68kmint','13'], + 'atarist' : ['m68kmint','13'], + 'atariste' : ['m68kmint','13'], + 'ataritt' : ['m68kmint','13'], + 'athlon' : ['athlon','1'], + 'falcon' : ['m68kmint','13'], + 'geode' : ['geode','1'], + 'hades' : ['m68kmint','13'], + 'i370' : ['i370','14'], + 'i386' : ['i386','1'], + 'i486' : ['i486','1'], + 'i586' : ['i586','1'], + 'i686' : ['i686','1'], + 'ia32e' : ['ia32e','1'], + 'ia64' : ['ia64','9'], + 'm68k' : ['m68k','6'], + 'm68kmint' : ['m68kmint','13'], + 'milan' : ['m68kmint','13'], + 'mips' : ['mips','4'], + 'mipsel' : ['mipsel','11'], + 'pentium3' : ['pentium3','1'], + 'pentium4' : ['pentium4','1'], + 'ppc' : ['ppc','5'], + 'ppc32dy4' : ['ppc32dy4','5'], + 'ppc64' : ['ppc64','16'], + 'ppc64iseries' : ['ppc64iseries','16'], + 'ppc64pseries' : ['ppc64pseries','16'], + 'ppc8260' : ['ppc8260','5'], + 'ppc8560' : ['ppc8560','5'], + 'ppciseries' : ['ppciseries','5'], + 'ppcpseries' : ['ppcpseries','5'], + 'rs6000' : ['rs6000','8'], + 's390' : ['s390','14'], + 's390x' : ['s390x','15'], + 'sh' : ['sh','17'], + 'sh3' : ['sh3','17'], + 'sh4' : ['sh4','17'], + 'sh4a' : ['sh4a','17'], + 'sparc' : ['sparc','3'], + 'sparc64' : ['sparc64','2'], + 'sparc64v' : ['sparc64v','2'], + 'sparcv8' : ['sparcv8','3'], + 'sparcv9' : ['sparcv9','3'], + 'sparcv9v' : ['sparcv9v','3'], + 'sun4' : ['sparc','3'], + 'sun4c' : ['sparc','3'], + 'sun4d' : ['sparc','3'], + 'sun4m' : ['sparc','3'], + 'sun4u' : ['sparc64','2'], + 'x86_64' : ['x86_64','1'], + 'xtensa' : ['xtensa','18'], +} + +# End of rpmrc dictionaries (Marker, don't change or remove!) + +def defaultMachine(): + """ Return the canonicalized machine name. """ + rmachine = platform.machine() + + # Try to lookup the string in the canon table + if rmachine in arch_canon: + rmachine = arch_canon[rmachine][0] + + return rmachine + +def defaultSystem(): + """ Return the canonicalized system name. """ + rsystem = platform.system() + + # Try to lookup the string in the canon tables + if rsystem in os_canon: + rsystem = os_canon[rsystem][0] + + return rsystem + +def defaultNames(): + """ Return the canonicalized machine and system name. """ + return defaultMachine(), defaultSystem() + +def updateRpmDicts(rpmrc, pyfile): + """ Read the given rpmrc file with RPM definitions and update the + info dictionaries in the file pyfile with it. + The arguments will usually be 'rpmrc.in' from a recent RPM source + tree, and 'rpmutils.py' referring to this script itself. + See also usage() below. + """ + try: + # Read old rpmutils.py file + oldpy = open(pyfile,"r").readlines() + # Read current rpmrc.in file + rpm = open(rpmrc,"r").readlines() + # Parse for data + data = {} + # Allowed section names that get parsed + sections = ['optflags', + 'arch_canon', + 'os_canon', + 'buildarchtranslate', + 'arch_compat', + 'os_compat', + 'buildarch_compat'] + for l in rpm: + l = l.rstrip('\n').replace(':',' ') + # Skip comments + if l.lstrip().startswith('#'): + continue + tokens = l.strip().split() + if len(tokens): + key = tokens[0] + if key in sections: + # Have we met this section before? + if not data.has_key(tokens[0]): + # No, so insert it + data[key] = {} + # Insert data + data[key][tokens[1]] = tokens[2:] + # Write new rpmutils.py file + out = open(pyfile,"w") + pm = 0 + for l in oldpy: + if pm: + if l.startswith('# End of rpmrc dictionaries'): + pm = 0 + out.write(l) + else: + out.write(l) + if l.startswith('# Start of rpmrc dictionaries'): + pm = 1 + # Write data sections to single dictionaries + for key, entries in data.iteritems(): + out.write("%s = {\n" % key) + for arch in sorted(entries.keys()): + out.write(" '%s' : ['%s'],\n" % (arch, "','".join(entries[arch]))) + out.write("}\n\n") + out.close() + except: + pass + +def usage(): + print "rpmutils.py rpmrc.in rpmutils.py" + +def main(): + import sys + + if len(sys.argv) < 3: + usage() + sys.exit(0) + updateRpmDicts(sys.argv[1], sys.argv[2]) + +if __name__ == "__main__": + main() diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sgiar.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sgiar.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sgiar.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sgiar.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,68 @@ +"""SCons.Tool.sgiar + +Tool-specific initialization for SGI ar (library archive). If CC +exists, static libraries should be built with it, so the prelinker has +a chance to resolve C++ template instantiations. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/sgiar.py 2013/03/03 09:48:35 garyo" + +import SCons.Defaults +import SCons.Tool +import SCons.Util + +def generate(env): + """Add Builders and construction variables for ar to an Environment.""" + SCons.Tool.createStaticLibBuilder(env) + + if env.Detect('CC'): + env['AR'] = 'CC' + env['ARFLAGS'] = SCons.Util.CLVar('-ar') + env['ARCOM'] = '$AR $ARFLAGS -o $TARGET $SOURCES' + else: + env['AR'] = 'ar' + env['ARFLAGS'] = SCons.Util.CLVar('r') + env['ARCOM'] = '$AR $ARFLAGS $TARGET $SOURCES' + + env['SHLINK'] = '$LINK' + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') + env['SHLINKCOM'] = '$SHLINK $SHLINKFLAGS -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' + env['LIBPREFIX'] = 'lib' + env['LIBSUFFIX'] = '.a' + +def exists(env): + return env.Detect('CC') or env.Detect('ar') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sgic++.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sgic++.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sgic++.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sgic++.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,58 @@ +"""SCons.Tool.sgic++ + +Tool-specific initialization for MIPSpro C++ on SGI. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/sgic++.py 2013/03/03 09:48:35 garyo" + +import SCons.Util + +cplusplus = __import__('c++', globals(), locals(), []) + +def generate(env): + """Add Builders and construction variables for SGI MIPS C++ to an Environment.""" + + cplusplus.generate(env) + + env['CXX'] = 'CC' + env['CXXFLAGS'] = SCons.Util.CLVar('-LANG:std') + env['SHCXX'] = '$CXX' + env['SHOBJSUFFIX'] = '.o' + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 + +def exists(env): + return env.Detect('CC') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sgicc.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sgicc.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sgicc.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sgicc.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,53 @@ +"""SCons.Tool.sgicc + +Tool-specific initialization for MIPSPro cc on SGI. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/sgicc.py 2013/03/03 09:48:35 garyo" + +import cc + +def generate(env): + """Add Builders and construction variables for gcc to an Environment.""" + cc.generate(env) + + env['CXX'] = 'CC' + env['SHOBJSUFFIX'] = '.o' + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 + +def exists(env): + return env.Detect('cc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sgilink.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sgilink.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sgilink.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sgilink.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,62 @@ +"""SCons.Tool.sgilink + +Tool-specific initialization for the SGI MIPSPro linker on SGI. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/sgilink.py 2013/03/03 09:48:35 garyo" + +import SCons.Util + +import link + +linkers = ['CC', 'cc'] + +def generate(env): + """Add Builders and construction variables for MIPSPro to an Environment.""" + link.generate(env) + + env['LINK'] = env.Detect(linkers) or 'cc' + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') + + # __RPATH is set to $_RPATH in the platform specification if that + # platform supports it. + env['RPATHPREFIX'] = '-rpath ' + env['RPATHSUFFIX'] = '' + env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}' + +def exists(env): + return env.Detect(linkers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sunar.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sunar.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sunar.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sunar.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,67 @@ +"""engine.SCons.Tool.sunar + +Tool-specific initialization for Solaris (Forte) ar (library archive). If CC +exists, static libraries should be built with it, so that template +instantians can be resolved. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/sunar.py 2013/03/03 09:48:35 garyo" + +import SCons.Defaults +import SCons.Tool +import SCons.Util + +def generate(env): + """Add Builders and construction variables for ar to an Environment.""" + SCons.Tool.createStaticLibBuilder(env) + + if env.Detect('CC'): + env['AR'] = 'CC' + env['ARFLAGS'] = SCons.Util.CLVar('-xar') + env['ARCOM'] = '$AR $ARFLAGS -o $TARGET $SOURCES' + else: + env['AR'] = 'ar' + env['ARFLAGS'] = SCons.Util.CLVar('r') + env['ARCOM'] = '$AR $ARFLAGS $TARGET $SOURCES' + + env['SHLINK'] = '$LINK' + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -G') + env['SHLINKCOM'] = '$SHLINK $SHLINKFLAGS -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' + env['LIBPREFIX'] = 'lib' + env['LIBSUFFIX'] = '.a' + +def exists(env): + return env.Detect('CC') or env.Detect('ar') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sunc++.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sunc++.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sunc++.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sunc++.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,142 @@ +"""SCons.Tool.sunc++ + +Tool-specific initialization for C++ on SunOS / Solaris. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/sunc++.py 2013/03/03 09:48:35 garyo" + +import SCons + +import os +import re +import subprocess + +cplusplus = __import__('c++', globals(), locals(), []) + +package_info = {} + +def get_package_info(package_name, pkginfo, pkgchk): + try: + return package_info[package_name] + except KeyError: + version = None + pathname = None + try: + sadm_contents = open('/var/sadm/install/contents', 'r').read() + except EnvironmentError: + pass + else: + sadm_re = re.compile('^(\S*/bin/CC)(=\S*)? %s$' % package_name, re.M) + sadm_match = sadm_re.search(sadm_contents) + if sadm_match: + pathname = os.path.dirname(sadm_match.group(1)) + + try: + p = subprocess.Popen([pkginfo, '-l', package_name], + stdout=subprocess.PIPE, + stderr=open('/dev/null', 'w')) + except EnvironmentError: + pass + else: + pkginfo_contents = p.communicate()[0] + version_re = re.compile('^ *VERSION:\s*(.*)$', re.M) + version_match = version_re.search(pkginfo_contents) + if version_match: + version = version_match.group(1) + + if pathname is None: + try: + p = subprocess.Popen([pkgchk, '-l', package_name], + stdout=subprocess.PIPE, + stderr=open('/dev/null', 'w')) + except EnvironmentError: + pass + else: + pkgchk_contents = p.communicate()[0] + pathname_re = re.compile(r'^Pathname:\s*(.*/bin/CC)$', re.M) + pathname_match = pathname_re.search(pkgchk_contents) + if pathname_match: + pathname = os.path.dirname(pathname_match.group(1)) + + package_info[package_name] = (pathname, version) + return package_info[package_name] + +# use the package installer tool lslpp to figure out where cppc and what +# version of it is installed +def get_cppc(env): + cxx = env.subst('$CXX') + if cxx: + cppcPath = os.path.dirname(cxx) + else: + cppcPath = None + + cppcVersion = None + + pkginfo = env.subst('$PKGINFO') + pkgchk = env.subst('$PKGCHK') + + for package in ['SPROcpl']: + path, version = get_package_info(package, pkginfo, pkgchk) + if path and version: + cppcPath, cppcVersion = path, version + break + + return (cppcPath, 'CC', 'CC', cppcVersion) + +def generate(env): + """Add Builders and construction variables for SunPRO C++.""" + path, cxx, shcxx, version = get_cppc(env) + if path: + cxx = os.path.join(path, cxx) + shcxx = os.path.join(path, shcxx) + + cplusplus.generate(env) + + env['CXX'] = cxx + env['SHCXX'] = shcxx + env['CXXVERSION'] = version + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS -KPIC') + env['SHOBJPREFIX'] = 'so_' + env['SHOBJSUFFIX'] = '.o' + +def exists(env): + path, cxx, shcxx, version = get_cppc(env) + if path and cxx: + cppc = os.path.join(path, cxx) + if os.path.exists(cppc): + return cppc + return None + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/suncc.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/suncc.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/suncc.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/suncc.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,58 @@ +"""SCons.Tool.suncc + +Tool-specific initialization for Sun Solaris (Forte) CC and cc. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/suncc.py 2013/03/03 09:48:35 garyo" + +import SCons.Util + +import cc + +def generate(env): + """ + Add Builders and construction variables for Forte C and C++ compilers + to an Environment. + """ + cc.generate(env) + + env['CXX'] = 'CC' + env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS -KPIC') + env['SHOBJPREFIX'] = 'so_' + env['SHOBJSUFFIX'] = '.o' + +def exists(env): + return env.Detect('CC') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sunf77.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sunf77.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sunf77.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sunf77.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,63 @@ +"""SCons.Tool.sunf77 + +Tool-specific initialization for sunf77, the Sun Studio F77 compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/sunf77.py 2013/03/03 09:48:35 garyo" + +import SCons.Util + +from FortranCommon import add_all_to_env + +compilers = ['sunf77', 'f77'] + +def generate(env): + """Add Builders and construction variables for sunf77 to an Environment.""" + add_all_to_env(env) + + fcomp = env.Detect(compilers) or 'f77' + env['FORTRAN'] = fcomp + env['F77'] = fcomp + + env['SHFORTRAN'] = '$FORTRAN' + env['SHF77'] = '$F77' + + env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS -KPIC') + env['SHF77FLAGS'] = SCons.Util.CLVar('$F77FLAGS -KPIC') + +def exists(env): + return env.Detect(compilers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sunf90.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sunf90.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sunf90.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sunf90.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,64 @@ +"""SCons.Tool.sunf90 + +Tool-specific initialization for sunf90, the Sun Studio F90 compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/sunf90.py 2013/03/03 09:48:35 garyo" + +import SCons.Util + +from FortranCommon import add_all_to_env + +compilers = ['sunf90', 'f90'] + +def generate(env): + """Add Builders and construction variables for sun f90 compiler to an + Environment.""" + add_all_to_env(env) + + fcomp = env.Detect(compilers) or 'f90' + env['FORTRAN'] = fcomp + env['F90'] = fcomp + + env['SHFORTRAN'] = '$FORTRAN' + env['SHF90'] = '$F90' + + env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS -KPIC') + env['SHF90FLAGS'] = SCons.Util.CLVar('$F90FLAGS -KPIC') + +def exists(env): + return env.Detect(compilers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sunf95.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sunf95.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sunf95.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sunf95.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,64 @@ +"""SCons.Tool.sunf95 + +Tool-specific initialization for sunf95, the Sun Studio F95 compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/sunf95.py 2013/03/03 09:48:35 garyo" + +import SCons.Util + +from FortranCommon import add_all_to_env + +compilers = ['sunf95', 'f95'] + +def generate(env): + """Add Builders and construction variables for sunf95 to an + Environment.""" + add_all_to_env(env) + + fcomp = env.Detect(compilers) or 'f95' + env['FORTRAN'] = fcomp + env['F95'] = fcomp + + env['SHFORTRAN'] = '$FORTRAN' + env['SHF95'] = '$F95' + + env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS -KPIC') + env['SHF95FLAGS'] = SCons.Util.CLVar('$F95FLAGS -KPIC') + +def exists(env): + return env.Detect(compilers) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sunlink.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sunlink.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/sunlink.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/sunlink.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,76 @@ +"""SCons.Tool.sunlink + +Tool-specific initialization for the Sun Solaris (Forte) linker. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/sunlink.py 2013/03/03 09:48:35 garyo" + +import os +import os.path + +import SCons.Util + +import link + +ccLinker = None + +# search for the acc compiler and linker front end + +try: + dirs = os.listdir('/opt') +except (IOError, OSError): + # Not being able to read the directory because it doesn't exist + # (IOError) or isn't readable (OSError) is okay. + dirs = [] + +for d in dirs: + linker = '/opt/' + d + '/bin/CC' + if os.path.exists(linker): + ccLinker = linker + break + +def generate(env): + """Add Builders and construction variables for Forte to an Environment.""" + link.generate(env) + + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -G') + + env['RPATHPREFIX'] = '-R' + env['RPATHSUFFIX'] = '' + env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}' + +def exists(env): + return ccLinker + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/swig.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/swig.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/swig.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/swig.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,183 @@ +"""SCons.Tool.swig + +Tool-specific initialization for swig. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/swig.py 2013/03/03 09:48:35 garyo" + +import os.path +import re +import subprocess + +import SCons.Action +import SCons.Defaults +import SCons.Scanner +import SCons.Tool +import SCons.Util + +SwigAction = SCons.Action.Action('$SWIGCOM', '$SWIGCOMSTR') + +def swigSuffixEmitter(env, source): + if '-c++' in SCons.Util.CLVar(env.subst("$SWIGFLAGS", source=source)): + return '$SWIGCXXFILESUFFIX' + else: + return '$SWIGCFILESUFFIX' + +# Match '%module test', as well as '%module(directors="1") test' +# Also allow for test to be quoted (SWIG permits double quotes, but not single) +# Also allow for the line to have spaces after test if not quoted +_reModule = re.compile(r'%module(\s*\(.*\))?\s+("?)(\S+)\2') + +def _find_modules(src): + """Find all modules referenced by %module lines in `src`, a SWIG .i file. + Returns a list of all modules, and a flag set if SWIG directors have + been requested (SWIG will generate an additional header file in this + case.)""" + directors = 0 + mnames = [] + try: + matches = _reModule.findall(open(src).read()) + except IOError: + # If the file's not yet generated, guess the module name from the file stem + matches = [] + mnames.append(os.path.splitext(os.path.basename(src))[0]) + + for m in matches: + mnames.append(m[2]) + directors = directors or m[0].find('directors') >= 0 + return mnames, directors + +def _add_director_header_targets(target, env): + # Directors only work with C++ code, not C + suffix = env.subst(env['SWIGCXXFILESUFFIX']) + # For each file ending in SWIGCXXFILESUFFIX, add a new target director + # header by replacing the ending with SWIGDIRECTORSUFFIX. + for x in target[:]: + n = x.name + d = x.dir + if n[-len(suffix):] == suffix: + target.append(d.File(n[:-len(suffix)] + env['SWIGDIRECTORSUFFIX'])) + +def _swigEmitter(target, source, env): + swigflags = env.subst("$SWIGFLAGS", target=target, source=source) + flags = SCons.Util.CLVar(swigflags) + for src in source: + src = str(src.rfile()) + mnames = None + if "-python" in flags and "-noproxy" not in flags: + if mnames is None: + mnames, directors = _find_modules(src) + if directors: + _add_director_header_targets(target, env) + python_files = [m + ".py" for m in mnames] + outdir = env.subst('$SWIGOUTDIR', target=target, source=source) + # .py files should be generated in SWIGOUTDIR if specified, + # otherwise in the same directory as the target + if outdir: + python_files = [env.fs.File(os.path.join(outdir, j)) for j in python_files] + else: + python_files = [target[0].dir.File(m) for m in python_files] + target.extend(python_files) + if "-java" in flags: + if mnames is None: + mnames, directors = _find_modules(src) + if directors: + _add_director_header_targets(target, env) + java_files = [[m + ".java", m + "JNI.java"] for m in mnames] + java_files = SCons.Util.flatten(java_files) + outdir = env.subst('$SWIGOUTDIR', target=target, source=source) + if outdir: + java_files = [os.path.join(outdir, j) for j in java_files] + java_files = list(map(env.fs.File, java_files)) + for jf in java_files: + t_from_s = lambda t, p, s, x: t.dir + SCons.Util.AddMethod(jf, t_from_s, 'target_from_source') + target.extend(java_files) + return (target, source) + +def _get_swig_version(env): + """Run the SWIG command line tool to get and return the version number""" + pipe = SCons.Action._subproc(env, [env['SWIG'], '-version'], + stdin = 'devnull', + stderr = 'devnull', + stdout = subprocess.PIPE) + if pipe.wait() != 0: return + + out = pipe.stdout.read() + match = re.search(r'SWIG Version\s+(\S+)$', out, re.MULTILINE) + if match: + return match.group(1) + +def generate(env): + """Add Builders and construction variables for swig to an Environment.""" + c_file, cxx_file = SCons.Tool.createCFileBuilders(env) + + c_file.suffix['.i'] = swigSuffixEmitter + cxx_file.suffix['.i'] = swigSuffixEmitter + + c_file.add_action('.i', SwigAction) + c_file.add_emitter('.i', _swigEmitter) + cxx_file.add_action('.i', SwigAction) + cxx_file.add_emitter('.i', _swigEmitter) + + java_file = SCons.Tool.CreateJavaFileBuilder(env) + + java_file.suffix['.i'] = swigSuffixEmitter + + java_file.add_action('.i', SwigAction) + java_file.add_emitter('.i', _swigEmitter) + + env['SWIG'] = 'swig' + env['SWIGVERSION'] = _get_swig_version(env) + env['SWIGFLAGS'] = SCons.Util.CLVar('') + env['SWIGDIRECTORSUFFIX'] = '_wrap.h' + env['SWIGCFILESUFFIX'] = '_wrap$CFILESUFFIX' + env['SWIGCXXFILESUFFIX'] = '_wrap$CXXFILESUFFIX' + env['_SWIGOUTDIR'] = r'${"-outdir \"%s\"" % SWIGOUTDIR}' + env['SWIGPATH'] = [] + env['SWIGINCPREFIX'] = '-I' + env['SWIGINCSUFFIX'] = '' + env['_SWIGINCFLAGS'] = '$( ${_concat(SWIGINCPREFIX, SWIGPATH, SWIGINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['SWIGCOM'] = '$SWIG -o $TARGET ${_SWIGOUTDIR} ${_SWIGINCFLAGS} $SWIGFLAGS $SOURCES' + + expr = '^[ \t]*%[ \t]*(?:include|import|extern)[ \t]*(<|"?)([^>\s"]+)(?:>|"?)' + scanner = SCons.Scanner.ClassicCPP("SWIGScan", ".i", "SWIGPATH", expr) + + env.Append(SCANNERS = scanner) + +def exists(env): + return env.Detect(['swig']) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/tar.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/tar.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/tar.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/tar.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,73 @@ +"""SCons.Tool.tar + +Tool-specific initialization for tar. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/tar.py 2013/03/03 09:48:35 garyo" + +import SCons.Action +import SCons.Builder +import SCons.Defaults +import SCons.Node.FS +import SCons.Util + +tars = ['tar', 'gtar'] + +TarAction = SCons.Action.Action('$TARCOM', '$TARCOMSTR') + +TarBuilder = SCons.Builder.Builder(action = TarAction, + source_factory = SCons.Node.FS.Entry, + source_scanner = SCons.Defaults.DirScanner, + suffix = '$TARSUFFIX', + multi = 1) + + +def generate(env): + """Add Builders and construction variables for tar to an Environment.""" + try: + bld = env['BUILDERS']['Tar'] + except KeyError: + bld = TarBuilder + env['BUILDERS']['Tar'] = bld + + env['TAR'] = env.Detect(tars) or 'gtar' + env['TARFLAGS'] = SCons.Util.CLVar('-c') + env['TARCOM'] = '$TAR $TARFLAGS -f $TARGET $SOURCES' + env['TARSUFFIX'] = '.tar' + +def exists(env): + return env.Detect(tars) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/tex.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/tex.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/tex.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/tex.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,986 @@ +"""SCons.Tool.tex + +Tool-specific initialization for TeX. +Generates .dvi files from .tex files + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/tex.py 2013/03/03 09:48:35 garyo" + +import os.path +import re +import shutil +import sys +import platform +import glob + +import SCons.Action +import SCons.Node +import SCons.Node.FS +import SCons.Util +import SCons.Scanner.LaTeX + +Verbose = False + +must_rerun_latex = True + +# these are files that just need to be checked for changes and then rerun latex +check_suffixes = ['.toc', '.lof', '.lot', '.out', '.nav', '.snm'] + +# these are files that require bibtex or makeindex to be run when they change +all_suffixes = check_suffixes + ['.bbl', '.idx', '.nlo', '.glo', '.acn', '.bcf'] + +# +# regular expressions used to search for Latex features +# or outputs that require rerunning latex +# +# search for all .aux files opened by latex (recorded in the .fls file) +openout_aux_re = re.compile(r"OUTPUT *(.*\.aux)") + +# search for all .bcf files opened by latex (recorded in the .fls file) +# for use by biber +openout_bcf_re = re.compile(r"OUTPUT *(.*\.bcf)") + +#printindex_re = re.compile(r"^[^%]*\\printindex", re.MULTILINE) +#printnomenclature_re = re.compile(r"^[^%]*\\printnomenclature", re.MULTILINE) +#printglossary_re = re.compile(r"^[^%]*\\printglossary", re.MULTILINE) + +# search to find rerun warnings +warning_rerun_str = '(^LaTeX Warning:.*Rerun)|(^Package \w+ Warning:.*Rerun)' +warning_rerun_re = re.compile(warning_rerun_str, re.MULTILINE) + +# search to find citation rerun warnings +rerun_citations_str = "^LaTeX Warning:.*\n.*Rerun to get citations correct" +rerun_citations_re = re.compile(rerun_citations_str, re.MULTILINE) + +# search to find undefined references or citations warnings +undefined_references_str = '(^LaTeX Warning:.*undefined references)|(^Package \w+ Warning:.*undefined citations)' +undefined_references_re = re.compile(undefined_references_str, re.MULTILINE) + +# used by the emitter +auxfile_re = re.compile(r".", re.MULTILINE) +tableofcontents_re = re.compile(r"^[^%\n]*\\tableofcontents", re.MULTILINE) +makeindex_re = re.compile(r"^[^%\n]*\\makeindex", re.MULTILINE) +bibliography_re = re.compile(r"^[^%\n]*\\bibliography", re.MULTILINE) +bibunit_re = re.compile(r"^[^%\n]*\\begin\{bibunit\}", re.MULTILINE) +multibib_re = re.compile(r"^[^%\n]*\\newcites\{([^\}]*)\}", re.MULTILINE) +addbibresource_re = re.compile(r"^[^%\n]*\\(addbibresource|addglobalbib|addsectionbib)", re.MULTILINE) +listoffigures_re = re.compile(r"^[^%\n]*\\listoffigures", re.MULTILINE) +listoftables_re = re.compile(r"^[^%\n]*\\listoftables", re.MULTILINE) +hyperref_re = re.compile(r"^[^%\n]*\\usepackage.*\{hyperref\}", re.MULTILINE) +makenomenclature_re = re.compile(r"^[^%\n]*\\makenomenclature", re.MULTILINE) +makeglossary_re = re.compile(r"^[^%\n]*\\makeglossary", re.MULTILINE) +makeglossaries_re = re.compile(r"^[^%\n]*\\makeglossaries", re.MULTILINE) +makeacronyms_re = re.compile(r"^[^%\n]*\\makeglossaries", re.MULTILINE) +beamer_re = re.compile(r"^[^%\n]*\\documentclass\{beamer\}", re.MULTILINE) +regex = r'^[^%\n]*\\newglossary\s*\[([^\]]+)\]?\s*\{([^}]*)\}\s*\{([^}]*)\}\s*\{([^}]*)\}\s*\{([^}]*)\}' +newglossary_re = re.compile(regex, re.MULTILINE) + +newglossary_suffix = [] + +# search to find all files included by Latex +include_re = re.compile(r'^[^%\n]*\\(?:include|input){([^}]*)}', re.MULTILINE) +includeOnly_re = re.compile(r'^[^%\n]*\\(?:include){([^}]*)}', re.MULTILINE) + +# search to find all graphics files included by Latex +includegraphics_re = re.compile(r'^[^%\n]*\\(?:includegraphics(?:\[[^\]]+\])?){([^}]*)}', re.MULTILINE) + +# search to find all files opened by Latex (recorded in .log file) +openout_re = re.compile(r"OUTPUT *(.*)") + +# list of graphics file extensions for TeX and LaTeX +TexGraphics = SCons.Scanner.LaTeX.TexGraphics +LatexGraphics = SCons.Scanner.LaTeX.LatexGraphics + +# An Action sufficient to build any generic tex file. +TeXAction = None + +# An action to build a latex file. This action might be needed more +# than once if we are dealing with labels and bibtex. +LaTeXAction = None + +# An action to run BibTeX on a file. +BibTeXAction = None + +# An action to run Biber on a file. +BiberAction = None + +# An action to run MakeIndex on a file. +MakeIndexAction = None + +# An action to run MakeIndex (for nomencl) on a file. +MakeNclAction = None + +# An action to run MakeIndex (for glossary) on a file. +MakeGlossaryAction = None + +# An action to run MakeIndex (for acronyms) on a file. +MakeAcronymsAction = None + +# An action to run MakeIndex (for newglossary commands) on a file. +MakeNewGlossaryAction = None + +# Used as a return value of modify_env_var if the variable is not set. +_null = SCons.Scanner.LaTeX._null + +modify_env_var = SCons.Scanner.LaTeX.modify_env_var + +def check_file_error_message(utility, filename='log'): + msg = '%s returned an error, check the %s file\n' % (utility, filename) + sys.stdout.write(msg) + +def FindFile(name,suffixes,paths,env,requireExt=False): + if requireExt: + name,ext = SCons.Util.splitext(name) + # if the user gave an extension use it. + if ext: + name = name + ext + if Verbose: + print " searching for '%s' with extensions: " % name,suffixes + + for path in paths: + testName = os.path.join(path,name) + if Verbose: + print " look for '%s'" % testName + if os.path.isfile(testName): + if Verbose: + print " found '%s'" % testName + return env.fs.File(testName) + else: + name_ext = SCons.Util.splitext(testName)[1] + if name_ext: + continue + + # if no suffix try adding those passed in + for suffix in suffixes: + testNameExt = testName + suffix + if Verbose: + print " look for '%s'" % testNameExt + + if os.path.isfile(testNameExt): + if Verbose: + print " found '%s'" % testNameExt + return env.fs.File(testNameExt) + if Verbose: + print " did not find '%s'" % name + return None + +def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None): + """A builder for LaTeX files that checks the output in the aux file + and decides how many times to use LaTeXAction, and BibTeXAction.""" + + global must_rerun_latex + + # This routine is called with two actions. In this file for DVI builds + # with LaTeXAction and from the pdflatex.py with PDFLaTeXAction + # set this up now for the case where the user requests a different extension + # for the target filename + if (XXXLaTeXAction == LaTeXAction): + callerSuffix = ".dvi" + else: + callerSuffix = env['PDFSUFFIX'] + + basename = SCons.Util.splitext(str(source[0]))[0] + basedir = os.path.split(str(source[0]))[0] + basefile = os.path.split(str(basename))[1] + abspath = os.path.abspath(basedir) + + targetext = os.path.splitext(str(target[0]))[1] + targetdir = os.path.split(str(target[0]))[0] + + saved_env = {} + for var in SCons.Scanner.LaTeX.LaTeX.env_variables: + saved_env[var] = modify_env_var(env, var, abspath) + + # Create base file names with the target directory since the auxiliary files + # will be made there. That's because the *COM variables have the cd + # command in the prolog. We check + # for the existence of files before opening them--even ones like the + # aux file that TeX always creates--to make it possible to write tests + # with stubs that don't necessarily generate all of the same files. + + targetbase = os.path.join(targetdir, basefile) + + # if there is a \makeindex there will be a .idx and thus + # we have to run makeindex at least once to keep the build + # happy even if there is no index. + # Same for glossaries, nomenclature, and acronyms + src_content = source[0].get_text_contents() + run_makeindex = makeindex_re.search(src_content) and not os.path.isfile(targetbase + '.idx') + run_nomenclature = makenomenclature_re.search(src_content) and not os.path.isfile(targetbase + '.nlo') + run_glossary = makeglossary_re.search(src_content) and not os.path.isfile(targetbase + '.glo') + run_glossaries = makeglossaries_re.search(src_content) and not os.path.isfile(targetbase + '.glo') + run_acronyms = makeacronyms_re.search(src_content) and not os.path.isfile(targetbase + '.acn') + + saved_hashes = {} + suffix_nodes = {} + + + for suffix in all_suffixes+sum(newglossary_suffix, []): + theNode = env.fs.File(targetbase + suffix) + suffix_nodes[suffix] = theNode + saved_hashes[suffix] = theNode.get_csig() + + if Verbose: + print "hashes: ",saved_hashes + + must_rerun_latex = True + + # .aux files already processed by BibTex + already_bibtexed = [] + + # + # routine to update MD5 hash and compare + # + def check_MD5(filenode, suffix): + global must_rerun_latex + # two calls to clear old csig + filenode.clear_memoized_values() + filenode.ninfo = filenode.new_ninfo() + new_md5 = filenode.get_csig() + + if saved_hashes[suffix] == new_md5: + if Verbose: + print "file %s not changed" % (targetbase+suffix) + return False # unchanged + saved_hashes[suffix] = new_md5 + must_rerun_latex = True + if Verbose: + print "file %s changed, rerunning Latex, new hash = " % (targetbase+suffix), new_md5 + return True # changed + + # generate the file name that latex will generate + resultfilename = targetbase + callerSuffix + + count = 0 + + while (must_rerun_latex and count < int(env.subst('$LATEXRETRIES'))) : + result = XXXLaTeXAction(target, source, env) + if result != 0: + return result + + count = count + 1 + + must_rerun_latex = False + # Decide if various things need to be run, or run again. + + # Read the log file to find warnings/errors + logfilename = targetbase + '.log' + logContent = '' + if os.path.isfile(logfilename): + logContent = open(logfilename, "rb").read() + + + # Read the fls file to find all .aux files + flsfilename = targetbase + '.fls' + flsContent = '' + auxfiles = [] + if os.path.isfile(flsfilename): + flsContent = open(flsfilename, "rb").read() + auxfiles = openout_aux_re.findall(flsContent) + # remove duplicates + dups = {} + for x in auxfiles: + dups[x] = 1 + auxfiles = list(dups.keys()) + + bcffiles = [] + if os.path.isfile(flsfilename): + flsContent = open(flsfilename, "rb").read() + bcffiles = openout_bcf_re.findall(flsContent) + # remove duplicates + dups = {} + for x in bcffiles: + dups[x] = 1 + bcffiles = list(dups.keys()) + + if Verbose: + print "auxfiles ",auxfiles + print "bcffiles ",bcffiles + + # Now decide if bibtex will need to be run. + # The information that bibtex reads from the .aux file is + # pass-independent. If we find (below) that the .bbl file is unchanged, + # then the last latex saw a correct bibliography. + # Therefore only do this once + # Go through all .aux files and remember the files already done. + for auxfilename in auxfiles: + if auxfilename not in already_bibtexed: + already_bibtexed.append(auxfilename) + target_aux = os.path.join(targetdir, auxfilename) + if os.path.isfile(target_aux): + content = open(target_aux, "rb").read() + if content.find("bibdata") != -1: + if Verbose: + print "Need to run bibtex on ",auxfilename + bibfile = env.fs.File(SCons.Util.splitext(target_aux)[0]) + result = BibTeXAction(bibfile, bibfile, env) + if result != 0: + check_file_error_message(env['BIBTEX'], 'blg') + must_rerun_latex = True + + # Now decide if biber will need to be run. + # When the backend for biblatex is biber (by choice or default) the + # citation information is put in the .bcf file. + # The information that biber reads from the .bcf file is + # pass-independent. If we find (below) that the .bbl file is unchanged, + # then the last latex saw a correct bibliography. + # Therefore only do this once + # Go through all .bcf files and remember the files already done. + for bcffilename in bcffiles: + if bcffilename not in already_bibtexed: + already_bibtexed.append(bcffilename) + target_bcf = os.path.join(targetdir, bcffilename) + if os.path.isfile(target_bcf): + content = open(target_bcf, "rb").read() + if content.find("bibdata") != -1: + if Verbose: + print "Need to run biber on ",bcffilename + bibfile = env.fs.File(SCons.Util.splitext(target_bcf)[0]) + result = BiberAction(bibfile, bibfile, env) + if result != 0: + check_file_error_message(env['BIBER'], 'blg') + must_rerun_latex = True + + # Now decide if latex will need to be run again due to index. + if check_MD5(suffix_nodes['.idx'],'.idx') or (count == 1 and run_makeindex): + # We must run makeindex + if Verbose: + print "Need to run makeindex" + idxfile = suffix_nodes['.idx'] + result = MakeIndexAction(idxfile, idxfile, env) + if result != 0: + check_file_error_message(env['MAKEINDEX'], 'ilg') + return result + + # TO-DO: need to add a way for the user to extend this list for whatever + # auxiliary files they create in other (or their own) packages + # Harder is case is where an action needs to be called -- that should be rare (I hope?) + + for index in check_suffixes: + check_MD5(suffix_nodes[index],index) + + # Now decide if latex will need to be run again due to nomenclature. + if check_MD5(suffix_nodes['.nlo'],'.nlo') or (count == 1 and run_nomenclature): + # We must run makeindex + if Verbose: + print "Need to run makeindex for nomenclature" + nclfile = suffix_nodes['.nlo'] + result = MakeNclAction(nclfile, nclfile, env) + if result != 0: + check_file_error_message('%s (nomenclature)' % env['MAKENCL'], + 'nlg') + #return result + + # Now decide if latex will need to be run again due to glossary. + if check_MD5(suffix_nodes['.glo'],'.glo') or (count == 1 and run_glossaries) or (count == 1 and run_glossary): + # We must run makeindex + if Verbose: + print "Need to run makeindex for glossary" + glofile = suffix_nodes['.glo'] + result = MakeGlossaryAction(glofile, glofile, env) + if result != 0: + check_file_error_message('%s (glossary)' % env['MAKEGLOSSARY'], + 'glg') + #return result + + # Now decide if latex will need to be run again due to acronyms. + if check_MD5(suffix_nodes['.acn'],'.acn') or (count == 1 and run_acronyms): + # We must run makeindex + if Verbose: + print "Need to run makeindex for acronyms" + acrfile = suffix_nodes['.acn'] + result = MakeAcronymsAction(acrfile, acrfile, env) + if result != 0: + check_file_error_message('%s (acronyms)' % env['MAKEACRONYMS'], + 'alg') + return result + + # Now decide if latex will need to be run again due to newglossary command. + for ig in range(len(newglossary_suffix)): + if check_MD5(suffix_nodes[newglossary_suffix[ig][2]],newglossary_suffix[ig][2]) or (count == 1): + # We must run makeindex + if Verbose: + print "Need to run makeindex for newglossary" + newglfile = suffix_nodes[newglossary_suffix[ig][2]] + MakeNewGlossaryAction = SCons.Action.Action("$MAKENEWGLOSSARY ${SOURCE.filebase}%s -s ${SOURCE.filebase}.ist -t ${SOURCE.filebase}%s -o ${SOURCE.filebase}%s" % (newglossary_suffix[ig][2],newglossary_suffix[ig][0],newglossary_suffix[ig][1]), "$MAKENEWGLOSSARYCOMSTR") + + result = MakeNewGlossaryAction(newglfile, newglfile, env) + if result != 0: + check_file_error_message('%s (newglossary)' % env['MAKENEWGLOSSARY'], + newglossary_suffix[ig][0]) + return result + + # Now decide if latex needs to be run yet again to resolve warnings. + if warning_rerun_re.search(logContent): + must_rerun_latex = True + if Verbose: + print "rerun Latex due to latex or package rerun warning" + + if rerun_citations_re.search(logContent): + must_rerun_latex = True + if Verbose: + print "rerun Latex due to 'Rerun to get citations correct' warning" + + if undefined_references_re.search(logContent): + must_rerun_latex = True + if Verbose: + print "rerun Latex due to undefined references or citations" + + if (count >= int(env.subst('$LATEXRETRIES')) and must_rerun_latex): + print "reached max number of retries on Latex ,",int(env.subst('$LATEXRETRIES')) +# end of while loop + + # rename Latex's output to what the target name is + if not (str(target[0]) == resultfilename and os.path.isfile(resultfilename)): + if os.path.isfile(resultfilename): + print "move %s to %s" % (resultfilename, str(target[0]), ) + shutil.move(resultfilename,str(target[0])) + + # Original comment (when TEXPICTS was not restored): + # The TEXPICTS enviroment variable is needed by a dvi -> pdf step + # later on Mac OSX so leave it + # + # It is also used when searching for pictures (implicit dependencies). + # Why not set the variable again in the respective builder instead + # of leaving local modifications in the environment? What if multiple + # latex builds in different directories need different TEXPICTS? + for var in SCons.Scanner.LaTeX.LaTeX.env_variables: + if var == 'TEXPICTS': + continue + if saved_env[var] is _null: + try: + del env['ENV'][var] + except KeyError: + pass # was never set + else: + env['ENV'][var] = saved_env[var] + + return result + +def LaTeXAuxAction(target = None, source= None, env=None): + result = InternalLaTeXAuxAction( LaTeXAction, target, source, env ) + return result + +LaTeX_re = re.compile("\\\\document(style|class)") + +def is_LaTeX(flist,env,abspath): + """Scan a file list to decide if it's TeX- or LaTeX-flavored.""" + + # We need to scan files that are included in case the + # \documentclass command is in them. + + # get path list from both env['TEXINPUTS'] and env['ENV']['TEXINPUTS'] + savedpath = modify_env_var(env, 'TEXINPUTS', abspath) + paths = env['ENV']['TEXINPUTS'] + if SCons.Util.is_List(paths): + pass + else: + # Split at os.pathsep to convert into absolute path + paths = paths.split(os.pathsep) + + # now that we have the path list restore the env + if savedpath is _null: + try: + del env['ENV']['TEXINPUTS'] + except KeyError: + pass # was never set + else: + env['ENV']['TEXINPUTS'] = savedpath + if Verbose: + print "is_LaTeX search path ",paths + print "files to search :",flist + + # Now that we have the search path and file list, check each one + for f in flist: + if Verbose: + print " checking for Latex source ",str(f) + + content = f.get_text_contents() + if LaTeX_re.search(content): + if Verbose: + print "file %s is a LaTeX file" % str(f) + return 1 + if Verbose: + print "file %s is not a LaTeX file" % str(f) + + # now find included files + inc_files = [ ] + inc_files.extend( include_re.findall(content) ) + if Verbose: + print "files included by '%s': "%str(f),inc_files + # inc_files is list of file names as given. need to find them + # using TEXINPUTS paths. + + # search the included files + for src in inc_files: + srcNode = FindFile(src,['.tex','.ltx','.latex'],paths,env,requireExt=False) + # make this a list since is_LaTeX takes a list. + fileList = [srcNode,] + if Verbose: + print "FindFile found ",srcNode + if srcNode is not None: + file_test = is_LaTeX(fileList, env, abspath) + + # return on first file that finds latex is needed. + if file_test: + return file_test + + if Verbose: + print " done scanning ",str(f) + + return 0 + +def TeXLaTeXFunction(target = None, source= None, env=None): + """A builder for TeX and LaTeX that scans the source file to + decide the "flavor" of the source and then executes the appropriate + program.""" + + # find these paths for use in is_LaTeX to search for included files + basedir = os.path.split(str(source[0]))[0] + abspath = os.path.abspath(basedir) + + if is_LaTeX(source,env,abspath): + result = LaTeXAuxAction(target,source,env) + if result != 0: + check_file_error_message(env['LATEX']) + else: + result = TeXAction(target,source,env) + if result != 0: + check_file_error_message(env['TEX']) + return result + +def TeXLaTeXStrFunction(target = None, source= None, env=None): + """A strfunction for TeX and LaTeX that scans the source file to + decide the "flavor" of the source and then returns the appropriate + command string.""" + if env.GetOption("no_exec"): + + # find these paths for use in is_LaTeX to search for included files + basedir = os.path.split(str(source[0]))[0] + abspath = os.path.abspath(basedir) + + if is_LaTeX(source,env,abspath): + result = env.subst('$LATEXCOM',0,target,source)+" ..." + else: + result = env.subst("$TEXCOM",0,target,source)+" ..." + else: + result = '' + return result + +def tex_eps_emitter(target, source, env): + """An emitter for TeX and LaTeX sources when + executing tex or latex. It will accept .ps and .eps + graphics files + """ + (target, source) = tex_emitter_core(target, source, env, TexGraphics) + + return (target, source) + +def tex_pdf_emitter(target, source, env): + """An emitter for TeX and LaTeX sources when + executing pdftex or pdflatex. It will accept graphics + files of types .pdf, .jpg, .png, .gif, and .tif + """ + (target, source) = tex_emitter_core(target, source, env, LatexGraphics) + + return (target, source) + +def ScanFiles(theFile, target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir, aux_files): + """ For theFile (a Node) update any file_tests and search for graphics files + then find all included files and call ScanFiles recursively for each of them""" + + content = theFile.get_text_contents() + if Verbose: + print " scanning ",str(theFile) + + for i in range(len(file_tests_search)): + if file_tests[i][0] is None: + if Verbose: + print "scan i ",i," files_tests[i] ",file_tests[i], file_tests[i][1] + file_tests[i][0] = file_tests_search[i].search(content) + if Verbose and file_tests[i][0]: + print " found match for ",file_tests[i][1][-1] + # for newglossary insert the suffixes in file_tests[i] + if file_tests[i][0] and file_tests[i][1][-1] == 'newglossary': + findresult = file_tests_search[i].findall(content) + for l in range(len(findresult)) : + (file_tests[i][1]).insert(0,'.'+findresult[l][3]) + (file_tests[i][1]).insert(0,'.'+findresult[l][2]) + (file_tests[i][1]).insert(0,'.'+findresult[l][0]) + suffix_list = ['.'+findresult[l][0],'.'+findresult[l][2],'.'+findresult[l][3] ] + newglossary_suffix.append(suffix_list) + if Verbose: + print " new suffixes for newglossary ",newglossary_suffix + + + incResult = includeOnly_re.search(content) + if incResult: + aux_files.append(os.path.join(targetdir, incResult.group(1))) + if Verbose: + print "\include file names : ", aux_files + # recursively call this on each of the included files + inc_files = [ ] + inc_files.extend( include_re.findall(content) ) + if Verbose: + print "files included by '%s': "%str(theFile),inc_files + # inc_files is list of file names as given. need to find them + # using TEXINPUTS paths. + + for src in inc_files: + srcNode = FindFile(src,['.tex','.ltx','.latex'],paths,env,requireExt=False) + if srcNode is not None: + file_tests = ScanFiles(srcNode, target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir, aux_files) + if Verbose: + print " done scanning ",str(theFile) + return file_tests + +def tex_emitter_core(target, source, env, graphics_extensions): + """An emitter for TeX and LaTeX sources. + For LaTeX sources we try and find the common created files that + are needed on subsequent runs of latex to finish tables of contents, + bibliographies, indices, lists of figures, and hyperlink references. + """ + basename = SCons.Util.splitext(str(source[0]))[0] + basefile = os.path.split(str(basename))[1] + targetdir = os.path.split(str(target[0]))[0] + targetbase = os.path.join(targetdir, basefile) + + basedir = os.path.split(str(source[0]))[0] + abspath = os.path.abspath(basedir) + target[0].attributes.path = abspath + + # + # file names we will make use of in searching the sources and log file + # + emit_suffixes = ['.aux', '.log', '.ilg', '.blg', '.nls', '.nlg', '.gls', '.glg', '.alg'] + all_suffixes + auxfilename = targetbase + '.aux' + logfilename = targetbase + '.log' + flsfilename = targetbase + '.fls' + + env.SideEffect(auxfilename,target[0]) + env.SideEffect(logfilename,target[0]) + env.SideEffect(flsfilename,target[0]) + if Verbose: + print "side effect :",auxfilename,logfilename,flsfilename + env.Clean(target[0],auxfilename) + env.Clean(target[0],logfilename) + env.Clean(target[0],flsfilename) + + content = source[0].get_text_contents() + + # These variables are no longer used. + #idx_exists = os.path.isfile(targetbase + '.idx') + #nlo_exists = os.path.isfile(targetbase + '.nlo') + #glo_exists = os.path.isfile(targetbase + '.glo') + #acr_exists = os.path.isfile(targetbase + '.acn') + + # set up list with the regular expressions + # we use to find features used + file_tests_search = [auxfile_re, + makeindex_re, + bibliography_re, + bibunit_re, + multibib_re, + addbibresource_re, + tableofcontents_re, + listoffigures_re, + listoftables_re, + hyperref_re, + makenomenclature_re, + makeglossary_re, + makeglossaries_re, + makeacronyms_re, + beamer_re, + newglossary_re ] + # set up list with the file suffixes that need emitting + # when a feature is found + file_tests_suff = [['.aux','aux_file'], + ['.idx', '.ind', '.ilg','makeindex'], + ['.bbl', '.blg','bibliography'], + ['.bbl', '.blg','bibunit'], + ['.bbl', '.blg','multibib'], + ['.bbl', '.blg','.bcf','addbibresource'], + ['.toc','contents'], + ['.lof','figures'], + ['.lot','tables'], + ['.out','hyperref'], + ['.nlo', '.nls', '.nlg','nomenclature'], + ['.glo', '.gls', '.glg','glossary'], + ['.glo', '.gls', '.glg','glossaries'], + ['.acn', '.acr', '.alg','acronyms'], + ['.nav', '.snm', '.out', '.toc','beamer'], + ['newglossary',] ] + # for newglossary the suffixes are added as we find the command + # build the list of lists + file_tests = [] + for i in range(len(file_tests_search)): + file_tests.append( [None, file_tests_suff[i]] ) + + # TO-DO: need to add a way for the user to extend this list for whatever + # auxiliary files they create in other (or their own) packages + + # get path list from both env['TEXINPUTS'] and env['ENV']['TEXINPUTS'] + savedpath = modify_env_var(env, 'TEXINPUTS', abspath) + paths = env['ENV']['TEXINPUTS'] + if SCons.Util.is_List(paths): + pass + else: + # Split at os.pathsep to convert into absolute path + paths = paths.split(os.pathsep) + + # now that we have the path list restore the env + if savedpath is _null: + try: + del env['ENV']['TEXINPUTS'] + except KeyError: + pass # was never set + else: + env['ENV']['TEXINPUTS'] = savedpath + if Verbose: + print "search path ",paths + + # scan all sources for side effect files + aux_files = [] + file_tests = ScanFiles(source[0], target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir, aux_files) + + for (theSearch,suffix_list) in file_tests: + # add side effects if feature is present.If file is to be generated,add all side effects + if Verbose and theSearch: + print "check side effects for ",suffix_list[-1] + if (theSearch != None) or (not source[0].exists() ): + file_list = [targetbase,] + # for bibunit we need a list of files + if suffix_list[-1] == 'bibunit': + file_basename = os.path.join(targetdir, 'bu*.aux') + file_list = glob.glob(file_basename) + # remove the suffix '.aux' + for i in range(len(file_list)): + file_list.append(SCons.Util.splitext(file_list[i])[0]) + # for multibib we need a list of files + if suffix_list[-1] == 'multibib': + for multibibmatch in multibib_re.finditer(content): + if Verbose: + print "multibib match ",multibibmatch.group(1) + if multibibmatch != None: + baselist = multibibmatch.group(1).split(',') + if Verbose: + print "multibib list ", baselist + for i in range(len(baselist)): + file_list.append(os.path.join(targetdir, baselist[i])) + # now define the side effects + for file_name in file_list: + for suffix in suffix_list[:-1]: + env.SideEffect(file_name + suffix,target[0]) + if Verbose: + print "side effect tst :",file_name + suffix, " target is ",str(target[0]) + env.Clean(target[0],file_name + suffix) + + for aFile in aux_files: + aFile_base = SCons.Util.splitext(aFile)[0] + env.SideEffect(aFile_base + '.aux',target[0]) + if Verbose: + print "side effect aux :",aFile_base + '.aux' + env.Clean(target[0],aFile_base + '.aux') + # read fls file to get all other files that latex creates and will read on the next pass + # remove files from list that we explicitly dealt with above + if os.path.isfile(flsfilename): + content = open(flsfilename, "rb").read() + out_files = openout_re.findall(content) + myfiles = [auxfilename, logfilename, flsfilename, targetbase+'.dvi',targetbase+'.pdf'] + for filename in out_files[:]: + if filename in myfiles: + out_files.remove(filename) + env.SideEffect(out_files,target[0]) + if Verbose: + print "side effect fls :",out_files + env.Clean(target[0],out_files) + + return (target, source) + + +TeXLaTeXAction = None + +def generate(env): + """Add Builders and construction variables for TeX to an Environment.""" + + global TeXLaTeXAction + if TeXLaTeXAction is None: + TeXLaTeXAction = SCons.Action.Action(TeXLaTeXFunction, + strfunction=TeXLaTeXStrFunction) + + env.AppendUnique(LATEXSUFFIXES=SCons.Tool.LaTeXSuffixes) + + generate_common(env) + + import dvi + dvi.generate(env) + + bld = env['BUILDERS']['DVI'] + bld.add_action('.tex', TeXLaTeXAction) + bld.add_emitter('.tex', tex_eps_emitter) + +def generate_darwin(env): + try: + environ = env['ENV'] + except KeyError: + environ = {} + env['ENV'] = environ + + if (platform.system() == 'Darwin'): + try: + ospath = env['ENV']['PATHOSX'] + except: + ospath = None + if ospath: + env.AppendENVPath('PATH', ospath) + +def generate_common(env): + """Add internal Builders and construction variables for LaTeX to an Environment.""" + + # Add OSX system paths so TeX tools can be found + # when a list of tools is given the exists() method is not called + generate_darwin(env) + + # A generic tex file Action, sufficient for all tex files. + global TeXAction + if TeXAction is None: + TeXAction = SCons.Action.Action("$TEXCOM", "$TEXCOMSTR") + + # An Action to build a latex file. This might be needed more + # than once if we are dealing with labels and bibtex. + global LaTeXAction + if LaTeXAction is None: + LaTeXAction = SCons.Action.Action("$LATEXCOM", "$LATEXCOMSTR") + + # Define an action to run BibTeX on a file. + global BibTeXAction + if BibTeXAction is None: + BibTeXAction = SCons.Action.Action("$BIBTEXCOM", "$BIBTEXCOMSTR") + + # Define an action to run Biber on a file. + global BiberAction + if BiberAction is None: + BiberAction = SCons.Action.Action("$BIBERCOM", "$BIBERCOMSTR") + + # Define an action to run MakeIndex on a file. + global MakeIndexAction + if MakeIndexAction is None: + MakeIndexAction = SCons.Action.Action("$MAKEINDEXCOM", "$MAKEINDEXCOMSTR") + + # Define an action to run MakeIndex on a file for nomenclatures. + global MakeNclAction + if MakeNclAction is None: + MakeNclAction = SCons.Action.Action("$MAKENCLCOM", "$MAKENCLCOMSTR") + + # Define an action to run MakeIndex on a file for glossaries. + global MakeGlossaryAction + if MakeGlossaryAction is None: + MakeGlossaryAction = SCons.Action.Action("$MAKEGLOSSARYCOM", "$MAKEGLOSSARYCOMSTR") + + # Define an action to run MakeIndex on a file for acronyms. + global MakeAcronymsAction + if MakeAcronymsAction is None: + MakeAcronymsAction = SCons.Action.Action("$MAKEACRONYMSCOM", "$MAKEACRONYMSCOMSTR") + + try: + environ = env['ENV'] + except KeyError: + environ = {} + env['ENV'] = environ + + # Some Linux platforms have pdflatex set up in a way + # that requires that the HOME environment variable be set. + # Add it here if defined. + v = os.environ.get('HOME') + if v: + environ['HOME'] = v + + CDCOM = 'cd ' + if platform.system() == 'Windows': + # allow cd command to change drives on Windows + CDCOM = 'cd /D ' + + env['TEX'] = 'tex' + env['TEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') + env['TEXCOM'] = CDCOM + '${TARGET.dir} && $TEX $TEXFLAGS ${SOURCE.file}' + + env['PDFTEX'] = 'pdftex' + env['PDFTEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') + env['PDFTEXCOM'] = CDCOM + '${TARGET.dir} && $PDFTEX $PDFTEXFLAGS ${SOURCE.file}' + + env['LATEX'] = 'latex' + env['LATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') + env['LATEXCOM'] = CDCOM + '${TARGET.dir} && $LATEX $LATEXFLAGS ${SOURCE.file}' + env['LATEXRETRIES'] = 4 + + env['PDFLATEX'] = 'pdflatex' + env['PDFLATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') + env['PDFLATEXCOM'] = CDCOM + '${TARGET.dir} && $PDFLATEX $PDFLATEXFLAGS ${SOURCE.file}' + + env['BIBTEX'] = 'bibtex' + env['BIBTEXFLAGS'] = SCons.Util.CLVar('') + env['BIBTEXCOM'] = CDCOM + '${TARGET.dir} && $BIBTEX $BIBTEXFLAGS ${SOURCE.filebase}' + + env['BIBER'] = 'biber' + env['BIBERFLAGS'] = SCons.Util.CLVar('') + env['BIBERCOM'] = CDCOM + '${TARGET.dir} && $BIBER $BIBERFLAGS ${SOURCE.filebase}' + + env['MAKEINDEX'] = 'makeindex' + env['MAKEINDEXFLAGS'] = SCons.Util.CLVar('') + env['MAKEINDEXCOM'] = CDCOM + '${TARGET.dir} && $MAKEINDEX $MAKEINDEXFLAGS ${SOURCE.file}' + + env['MAKEGLOSSARY'] = 'makeindex' + env['MAKEGLOSSARYSTYLE'] = '${SOURCE.filebase}.ist' + env['MAKEGLOSSARYFLAGS'] = SCons.Util.CLVar('-s ${MAKEGLOSSARYSTYLE} -t ${SOURCE.filebase}.glg') + env['MAKEGLOSSARYCOM'] = CDCOM + '${TARGET.dir} && $MAKEGLOSSARY ${SOURCE.filebase}.glo $MAKEGLOSSARYFLAGS -o ${SOURCE.filebase}.gls' + + env['MAKEACRONYMS'] = 'makeindex' + env['MAKEACRONYMSSTYLE'] = '${SOURCE.filebase}.ist' + env['MAKEACRONYMSFLAGS'] = SCons.Util.CLVar('-s ${MAKEACRONYMSSTYLE} -t ${SOURCE.filebase}.alg') + env['MAKEACRONYMSCOM'] = CDCOM + '${TARGET.dir} && $MAKEACRONYMS ${SOURCE.filebase}.acn $MAKEACRONYMSFLAGS -o ${SOURCE.filebase}.acr' + + env['MAKENCL'] = 'makeindex' + env['MAKENCLSTYLE'] = 'nomencl.ist' + env['MAKENCLFLAGS'] = '-s ${MAKENCLSTYLE} -t ${SOURCE.filebase}.nlg' + env['MAKENCLCOM'] = CDCOM + '${TARGET.dir} && $MAKENCL ${SOURCE.filebase}.nlo $MAKENCLFLAGS -o ${SOURCE.filebase}.nls' + + env['MAKENEWGLOSSARY'] = 'makeindex' + env['MAKENEWGLOSSARYCOM'] = CDCOM + '${TARGET.dir} && $MAKENEWGLOSSARY ' + +def exists(env): + generate_darwin(env) + return env.Detect('tex') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/textfile.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/textfile.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/textfile.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/textfile.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,175 @@ +# -*- python -*- +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__doc__ = """ +Textfile/Substfile builder for SCons. + + Create file 'target' which typically is a textfile. The 'source' + may be any combination of strings, Nodes, or lists of same. A + 'linesep' will be put between any part written and defaults to + os.linesep. + + The only difference between the Textfile builder and the Substfile + builder is that strings are converted to Value() nodes for the + former and File() nodes for the latter. To insert files in the + former or strings in the latter, wrap them in a File() or Value(), + respectively. + + The values of SUBST_DICT first have any construction variables + expanded (its keys are not expanded). If a value of SUBST_DICT is + a python callable function, it is called and the result is expanded + as the value. Values are substituted in a "random" order; if any + substitution could be further expanded by another subsitition, it + is unpredictible whether the expansion will occur. +""" + +__revision__ = "src/engine/SCons/Tool/textfile.py 2013/03/03 09:48:35 garyo" + +import SCons + +import os +import re + +from SCons.Node import Node +from SCons.Node.Python import Value +from SCons.Util import is_String, is_Sequence, is_Dict + +def _do_subst(node, subs): + """ + Fetch the node contents and replace all instances of the keys with + their values. For example, if subs is + {'%VERSION%': '1.2345', '%BASE%': 'MyProg', '%prefix%': '/bin'}, + then all instances of %VERSION% in the file will be replaced with + 1.2345 and so forth. + """ + contents = node.get_text_contents() + if not subs: return contents + for (k,v) in subs: + contents = re.sub(k, v, contents) + return contents + +def _action(target, source, env): + # prepare the line separator + linesep = env['LINESEPARATOR'] + if linesep is None: + linesep = os.linesep + elif is_String(linesep): + pass + elif isinstance(linesep, Value): + linesep = linesep.get_text_contents() + else: + raise SCons.Errors.UserError( + 'unexpected type/class for LINESEPARATOR: %s' + % repr(linesep), None) + + # create a dictionary to use for the substitutions + if 'SUBST_DICT' not in env: + subs = None # no substitutions + else: + d = env['SUBST_DICT'] + if is_Dict(d): + d = list(d.items()) + elif is_Sequence(d): + pass + else: + raise SCons.Errors.UserError('SUBST_DICT must be dict or sequence') + subs = [] + for (k,v) in d: + if callable(v): + v = v() + if is_String(v): + v = env.subst(v) + else: + v = str(v) + subs.append((k,v)) + + # write the file + try: + fd = open(target[0].get_path(), "wb") + except (OSError,IOError), e: + raise SCons.Errors.UserError("Can't write target file %s" % target[0]) + # separate lines by 'linesep' only if linesep is not empty + lsep = None + for s in source: + if lsep: fd.write(lsep) + fd.write(_do_subst(s, subs)) + lsep = linesep + fd.close() + +def _strfunc(target, source, env): + return "Creating '%s'" % target[0] + +def _convert_list_R(newlist, sources): + for elem in sources: + if is_Sequence(elem): + _convert_list_R(newlist, elem) + elif isinstance(elem, Node): + newlist.append(elem) + else: + newlist.append(Value(elem)) +def _convert_list(target, source, env): + if len(target) != 1: + raise SCons.Errors.UserError("Only one target file allowed") + newlist = [] + _convert_list_R(newlist, source) + return target, newlist + +_common_varlist = ['SUBST_DICT', 'LINESEPARATOR'] + +_text_varlist = _common_varlist + ['TEXTFILEPREFIX', 'TEXTFILESUFFIX'] +_text_builder = SCons.Builder.Builder( + action = SCons.Action.Action(_action, _strfunc, varlist = _text_varlist), + source_factory = Value, + emitter = _convert_list, + prefix = '$TEXTFILEPREFIX', + suffix = '$TEXTFILESUFFIX', + ) + +_subst_varlist = _common_varlist + ['SUBSTFILEPREFIX', 'TEXTFILESUFFIX'] +_subst_builder = SCons.Builder.Builder( + action = SCons.Action.Action(_action, _strfunc, varlist = _subst_varlist), + source_factory = SCons.Node.FS.File, + emitter = _convert_list, + prefix = '$SUBSTFILEPREFIX', + suffix = '$SUBSTFILESUFFIX', + src_suffix = ['.in'], + ) + +def generate(env): + env['LINESEPARATOR'] = os.linesep + env['BUILDERS']['Textfile'] = _text_builder + env['TEXTFILEPREFIX'] = '' + env['TEXTFILESUFFIX'] = '.txt' + env['BUILDERS']['Substfile'] = _subst_builder + env['SUBSTFILEPREFIX'] = '' + env['SUBSTFILESUFFIX'] = '' + +def exists(env): + return 1 + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/tlib.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/tlib.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/tlib.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/tlib.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,53 @@ +"""SCons.Tool.tlib + +XXX + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/tlib.py 2013/03/03 09:48:35 garyo" + +import SCons.Tool +import SCons.Tool.bcc32 +import SCons.Util + +def generate(env): + SCons.Tool.bcc32.findIt('tlib', env) + """Add Builders and construction variables for ar to an Environment.""" + SCons.Tool.createStaticLibBuilder(env) + env['AR'] = 'tlib' + env['ARFLAGS'] = SCons.Util.CLVar('') + env['ARCOM'] = '$AR $TARGET $ARFLAGS /a $SOURCES' + env['LIBPREFIX'] = '' + env['LIBSUFFIX'] = '.lib' + +def exists(env): + return SCons.Tool.bcc32.findIt('tlib', env) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/wix.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/wix.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/wix.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/wix.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,104 @@ +"""SCons.Tool.wix + +Tool-specific initialization for wix, the Windows Installer XML Tool. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/wix.py 2013/03/03 09:48:35 garyo" + +import SCons.Builder +import SCons.Action +import os + +def generate(env): + """Add Builders and construction variables for WiX to an Environment.""" + if not exists(env): + return + + env['WIXCANDLEFLAGS'] = ['-nologo'] + env['WIXCANDLEINCLUDE'] = [] + env['WIXCANDLECOM'] = '$WIXCANDLE $WIXCANDLEFLAGS -I $WIXCANDLEINCLUDE -o ${TARGET} ${SOURCE}' + + env['WIXLIGHTFLAGS'].append( '-nologo' ) + env['WIXLIGHTCOM'] = "$WIXLIGHT $WIXLIGHTFLAGS -out ${TARGET} ${SOURCES}" + env['WIXSRCSUF'] = '.wxs' + env['WIXOBJSUF'] = '.wixobj' + + object_builder = SCons.Builder.Builder( + action = '$WIXCANDLECOM', + suffix = '$WIXOBJSUF', + src_suffix = '$WIXSRCSUF') + + linker_builder = SCons.Builder.Builder( + action = '$WIXLIGHTCOM', + src_suffix = '$WIXOBJSUF', + src_builder = object_builder) + + env['BUILDERS']['WiX'] = linker_builder + +def exists(env): + env['WIXCANDLE'] = 'candle.exe' + env['WIXLIGHT'] = 'light.exe' + + # try to find the candle.exe and light.exe tools and + # add the install directory to light libpath. + for path in os.environ['PATH'].split(os.pathsep): + if not path: + continue + + # workaround for some weird python win32 bug. + if path[0] == '"' and path[-1:]=='"': + path = path[1:-1] + + # normalize the path + path = os.path.normpath(path) + + # search for the tools in the PATH environment variable + try: + files = os.listdir(path) + if env['WIXCANDLE'] in files and env['WIXLIGHT'] in files: + env.PrependENVPath('PATH', path) + # include appropriate flags if running WiX 2.0 + if 'wixui.wixlib' in files and 'WixUI_en-us.wxl' in files: + env['WIXLIGHTFLAGS'] = [ os.path.join( path, 'wixui.wixlib' ), + '-loc', + os.path.join( path, 'WixUI_en-us.wxl' ) ] + else: + env['WIXLIGHTFLAGS'] = [] + return 1 + except OSError: + pass # ignore this, could be a stale PATH entry. + + return None + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/xgettext.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/xgettext.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/xgettext.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/xgettext.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,339 @@ +""" xgettext tool + +Tool specific initialization of `xgettext` tool. +""" + +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Tool/xgettext.py 2013/03/03 09:48:35 garyo" + +############################################################################# +class _CmdRunner(object): + """ Callabe object, which runs shell command storing its stdout and stderr to + variables. It also provides `strfunction()` method, which shall be used by + scons Action objects to print command string. """ + + def __init__( self, command, commandstr = None): + self.out = None + self.err = None + self.status = None + self.command = command + self.commandstr = commandstr + + def __call__(self, target, source, env): + import SCons.Action + import subprocess + import os + import sys + kw = { + 'stdin' : 'devnull', + 'stdout' : subprocess.PIPE, + 'stderr' : subprocess.PIPE, + 'universal_newlines' : True, + 'shell' : True + } + command = env.subst(self.command, target = target, source = source) + proc = SCons.Action._subproc(env, command, **kw) + self.out, self.err = proc.communicate() + self.status = proc.wait() + if self.err: sys.stderr.write(unicode(self.err)) + return self.status + + def strfunction(self, target, source, env): + import os + comstr = self.commandstr + if env.subst(comstr, target = target, source = source) == "": + comstr = self.command + s = env.subst(comstr, target = target, source = source) + return s +############################################################################# + +############################################################################# +def _update_pot_file(target, source, env): + """ Action function for `POTUpdate` builder """ + import re + import os + import SCons.Action + nop = lambda target, source, env : 0 + + # Save scons cwd and os cwd (NOTE: they may be different. After the job, we + # revert ech one to its original state). + save_cwd = env.fs.getcwd() + save_os_cwd = os.getcwd() + chdir = target[0].dir + chdir_str = repr(chdir.get_abspath()) + # Print chdir message (employ SCons.Action.Action for that. It knows better + # than me how to to this correctly). + env.Execute(SCons.Action.Action(nop, "Entering " + chdir_str)) + # Go to target's directory and do our job + env.fs.chdir(chdir, 1) # Go into target's directory + try: + cmd = _CmdRunner('$XGETTEXTCOM', '$XGETTEXTCOMSTR') + action = SCons.Action.Action(cmd, strfunction=cmd.strfunction) + status = action([ target[0] ], source, env) + except: + # Something went wrong. + env.Execute(SCons.Action.Action(nop, "Leaving " + chdir_str)) + # Revert working dirs to previous state and re-throw exception. + env.fs.chdir(save_cwd, 0) + os.chdir(save_os_cwd) + raise + # Print chdir message. + env.Execute(SCons.Action.Action(nop, "Leaving " + chdir_str)) + # Revert working dirs to previous state. + env.fs.chdir(save_cwd, 0) + os.chdir(save_os_cwd) + # If the command was not successfull, return error code. + if status: return status + + new_content = cmd.out + + if not new_content: + # When xgettext finds no internationalized messages, no *.pot is created + # (because we don't want to bother translators with empty POT files). + needs_update = False + explain = "no internationalized messages encountered" + else: + if target[0].exists(): + # If the file already exists, it's left unaltered unless its messages + # are outdated (w.r.t. to these recovered by xgettext from sources). + old_content = target[0].get_text_contents() + re_cdate = re.compile(r'^"POT-Creation-Date: .*"$[\r\n]?', re.M) + old_content_nocdate = re.sub(re_cdate,"",old_content) + new_content_nocdate = re.sub(re_cdate,"",new_content) + if(old_content_nocdate == new_content_nocdate): + # Messages are up-to-date + needs_update = False + explain = "messages in file found to be up-to-date" + else: + # Messages are outdated + needs_update = True + explain = "messages in file were outdated" + else: + # No POT file found, create new one + needs_update = True + explain = "new file" + if needs_update: + # Print message employing SCons.Action.Action for that. + msg = "Writting " + repr(str(target[0])) + " (" + explain + ")" + env.Execute(SCons.Action.Action(nop, msg)) + f = open(str(target[0]),"w") + f.write(new_content) + f.close() + return 0 + else: + # Print message employing SCons.Action.Action for that. + msg = "Not writting " + repr(str(target[0])) + " (" + explain + ")" + env.Execute(SCons.Action.Action(nop, msg)) + return 0 +############################################################################# + +############################################################################# +from SCons.Builder import BuilderBase +############################################################################# +class _POTBuilder(BuilderBase): + def _execute(self, env, target, source, *args): + if not target: + if env.has_key('POTDOMAIN') and env['POTDOMAIN']: + domain = env['POTDOMAIN'] + else: + domain = 'messages' + target = [ domain ] + return BuilderBase._execute(self, env, target, source, *args) +############################################################################# + +############################################################################# +def _scan_xgettext_from_files(target, source, env, files = None, path = None): + """ Parses `POTFILES.in`-like file and returns list of extracted file names. + """ + import re + import SCons.Util + import SCons.Node.FS + + if files is None: + return 0 + if not SCons.Util.is_List(files): + files = [ files ] + + if path is None: + if env.has_key('XGETTEXTPATH'): + path = env['XGETTEXTPATH'] + else: + path = [] + if not SCons.Util.is_List(path): + path = [ path ] + + path = SCons.Util.flatten(path) + + dirs = () + for p in path: + if not isinstance(p, SCons.Node.FS.Base): + if SCons.Util.is_String(p): + p = env.subst(p, source = source, target = target) + p = env.arg2nodes(p, env.fs.Dir) + dirs += tuple(p) + # cwd is the default search path (when no path is defined by user) + if not dirs: + dirs = (env.fs.getcwd(),) + + # Parse 'POTFILE.in' files. + re_comment = re.compile(r'^#[^\n\r]*$\r?\n?', re.M) + re_emptyln = re.compile(r'^[ \t\r]*$\r?\n?', re.M) + re_trailws = re.compile(r'[ \t\r]+$') + for f in files: + # Find files in search path $XGETTEXTPATH + if isinstance(f, SCons.Node.FS.Base) and f.rexists(): + contents = f.get_text_contents() + contents = re_comment.sub("", contents) + contents = re_emptyln.sub("", contents) + contents = re_trailws.sub("", contents) + depnames = contents.splitlines() + for depname in depnames: + depfile = SCons.Node.FS.find_file(depname, dirs) + if not depfile: + depfile = env.arg2nodes(depname, dirs[0].File) + env.Depends(target, depfile) + return 0 +############################################################################# + +############################################################################# +def _pot_update_emitter(target, source, env): + """ Emitter function for `POTUpdate` builder """ + from SCons.Tool.GettextCommon import _POTargetFactory + import SCons.Util + import SCons.Node.FS + + if env.has_key('XGETTEXTFROM'): + xfrom = env['XGETTEXTFROM'] + else: + return target, source + if not SCons.Util.is_List(xfrom): + xfrom = [ xfrom ] + + xfrom = SCons.Util.flatten(xfrom) + + # Prepare list of 'POTFILE.in' files. + files = [] + for xf in xfrom: + if not isinstance(xf, SCons.Node.FS.Base): + if SCons.Util.is_String(xf): + # Interpolate variables in strings + xf = env.subst(xf, source = source, target = target) + xf = env.arg2nodes(xf) + files.extend(xf) + if files: + env.Depends(target, files) + _scan_xgettext_from_files(target, source, env, files) + return target, source +############################################################################# + +############################################################################# +from SCons.Environment import _null +############################################################################# +def _POTUpdateBuilderWrapper(env, target=None, source=_null, **kw): + return env._POTUpdateBuilder(target, source, **kw) +############################################################################# + +############################################################################# +def _POTUpdateBuilder(env, **kw): + """ Creates `POTUpdate` builder object """ + import SCons.Action + from SCons.Tool.GettextCommon import _POTargetFactory + kw['action'] = SCons.Action.Action(_update_pot_file, None) + kw['suffix'] = '$POTSUFFIX' + kw['target_factory'] = _POTargetFactory(env, alias='$POTUPDATE_ALIAS').File + kw['emitter'] = _pot_update_emitter + return _POTBuilder(**kw) +############################################################################# + +############################################################################# +def generate(env,**kw): + """ Generate `xgettext` tool """ + import SCons.Util + from SCons.Tool.GettextCommon import RPaths, _detect_xgettext + + try: + env['XGETTEXT'] = _detect_xgettext(env) + except: + env['XGETTEXT'] = 'xgettext' + # NOTE: sources="$SOURCES" would work as well. However, we use following + # construction to convert absolute paths provided by scons onto paths + # relative to current working dir. Note, that scons expands $SOURCE(S) to + # absolute paths for sources $SOURCE(s) outside of current subtree (e.g. in + # "../"). With source=$SOURCE these absolute paths would be written to the + # resultant *.pot file (and its derived *.po files) as references to lines in + # source code (e.g. referring lines in *.c files). Such references would be + # correct (e.g. in poedit) only on machine on which *.pot was generated and + # would be of no use on other hosts (having a copy of source code located + # in different place in filesystem). + sources = '$( ${_concat( "", SOURCES, "", __env__, XgettextRPaths, TARGET' \ + + ', SOURCES)} $)' + + # NOTE: the output from $XGETTEXTCOM command must go to stdout, not to a file. + # This is required by the POTUpdate builder's action. + xgettextcom = '$XGETTEXT $XGETTEXTFLAGS $_XGETTEXTPATHFLAGS' \ + + ' $_XGETTEXTFROMFLAGS -o - ' + sources + + xgettextpathflags = '$( ${_concat( XGETTEXTPATHPREFIX, XGETTEXTPATH' \ + + ', XGETTEXTPATHSUFFIX, __env__, RDirs, TARGET, SOURCES)} $)' + xgettextfromflags = '$( ${_concat( XGETTEXTFROMPREFIX, XGETTEXTFROM' \ + + ', XGETTEXTFROMSUFFIX, __env__, target=TARGET, source=SOURCES)} $)' + + env.SetDefault( + _XGETTEXTDOMAIN = '${TARGET.filebase}', + XGETTEXTFLAGS = [ ], + XGETTEXTCOM = xgettextcom, + XGETTEXTCOMSTR = '', + XGETTEXTPATH = [ ], + XGETTEXTPATHPREFIX = '-D', + XGETTEXTPATHSUFFIX = '', + XGETTEXTFROM = None, + XGETTEXTFROMPREFIX = '-f', + XGETTEXTFROMSUFFIX = '', + _XGETTEXTPATHFLAGS = xgettextpathflags, + _XGETTEXTFROMFLAGS = xgettextfromflags, + POTSUFFIX = ['.pot'], + POTUPDATE_ALIAS = 'pot-update', + XgettextRPaths = RPaths(env) + ) + env.Append( BUILDERS = { + '_POTUpdateBuilder' : _POTUpdateBuilder(env) + } ) + env.AddMethod(_POTUpdateBuilderWrapper, 'POTUpdate') + env.AlwaysBuild(env.Alias('$POTUPDATE_ALIAS')) +############################################################################# + +############################################################################# +def exists(env): + """ Check, whether the tool exists """ + from SCons.Tool.GettextCommon import _xgettext_exists + try: + return _xgettext_exists(env) + except: + return False +############################################################################# + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/yacc.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/yacc.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/yacc.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/yacc.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,140 @@ +"""SCons.Tool.yacc + +Tool-specific initialization for yacc. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/yacc.py 2013/03/03 09:48:35 garyo" + +import os.path + +import SCons.Defaults +import SCons.Tool +import SCons.Util + +YaccAction = SCons.Action.Action("$YACCCOM", "$YACCCOMSTR") + +def _yaccEmitter(target, source, env, ysuf, hsuf): + yaccflags = env.subst("$YACCFLAGS", target=target, source=source) + flags = SCons.Util.CLVar(yaccflags) + targetBase, targetExt = os.path.splitext(SCons.Util.to_String(target[0])) + + if '.ym' in ysuf: # If using Objective-C + target = [targetBase + ".m"] # the extension is ".m". + + + # If -d is specified on the command line, yacc will emit a .h + # or .hpp file with the same name as the .c or .cpp output file. + if '-d' in flags: + target.append(targetBase + env.subst(hsuf, target=target, source=source)) + + # If -g is specified on the command line, yacc will emit a .vcg + # file with the same base name as the .y, .yacc, .ym or .yy file. + if "-g" in flags: + base, ext = os.path.splitext(SCons.Util.to_String(source[0])) + target.append(base + env.subst("$YACCVCGFILESUFFIX")) + + # If -v is specirfied yacc will create the output debug file + # which is not really source for any process, but should + # be noted and also be cleaned + # Bug #2558 + if "-v" in flags: + env.SideEffect(targetBase+'.output',target[0]) + env.Clean(target[0],targetBase+'.output') + + + + # With --defines and --graph, the name of the file is totally defined + # in the options. + fileGenOptions = ["--defines=", "--graph="] + for option in flags: + for fileGenOption in fileGenOptions: + l = len(fileGenOption) + if option[:l] == fileGenOption: + # A file generating option is present, so add the file + # name to the list of targets. + fileName = option[l:].strip() + target.append(fileName) + + return (target, source) + +def yEmitter(target, source, env): + return _yaccEmitter(target, source, env, ['.y', '.yacc'], '$YACCHFILESUFFIX') + +def ymEmitter(target, source, env): + return _yaccEmitter(target, source, env, ['.ym'], '$YACCHFILESUFFIX') + +def yyEmitter(target, source, env): + return _yaccEmitter(target, source, env, ['.yy'], '$YACCHXXFILESUFFIX') + +def generate(env): + """Add Builders and construction variables for yacc to an Environment.""" + c_file, cxx_file = SCons.Tool.createCFileBuilders(env) + + # C + c_file.add_action('.y', YaccAction) + c_file.add_emitter('.y', yEmitter) + + c_file.add_action('.yacc', YaccAction) + c_file.add_emitter('.yacc', yEmitter) + + # Objective-C + c_file.add_action('.ym', YaccAction) + c_file.add_emitter('.ym', ymEmitter) + + # C++ + cxx_file.add_action('.yy', YaccAction) + cxx_file.add_emitter('.yy', yyEmitter) + + env['YACC'] = env.Detect('bison') or 'yacc' + env['YACCFLAGS'] = SCons.Util.CLVar('') + env['YACCCOM'] = '$YACC $YACCFLAGS -o $TARGET $SOURCES' + env['YACCHFILESUFFIX'] = '.h' + + # Apparently, OS X now creates file.hpp like everybody else + # I have no idea when it changed; it was fixed in 10.4 + #if env['PLATFORM'] == 'darwin': + # # Bison on Mac OS X just appends ".h" to the generated target .cc + # # or .cpp file name. Hooray for delayed expansion of variables. + # env['YACCHXXFILESUFFIX'] = '${TARGET.suffix}.h' + #else: + # env['YACCHXXFILESUFFIX'] = '.hpp' + env['YACCHXXFILESUFFIX'] = '.hpp' + + env['YACCVCGFILESUFFIX'] = '.vcg' + +def exists(env): + return env.Detect(['bison', 'yacc']) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/zip.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/zip.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Tool/zip.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Tool/zip.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,99 @@ +"""SCons.Tool.zip + +Tool-specific initialization for zip. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Tool/zip.py 2013/03/03 09:48:35 garyo" + +import os.path + +import SCons.Builder +import SCons.Defaults +import SCons.Node.FS +import SCons.Util + +try: + import zipfile + internal_zip = 1 +except ImportError: + internal_zip = 0 + +if internal_zip: + zipcompression = zipfile.ZIP_DEFLATED + def zip(target, source, env): + compression = env.get('ZIPCOMPRESSION', 0) + zf = zipfile.ZipFile(str(target[0]), 'w', compression) + for s in source: + if s.isdir(): + for dirpath, dirnames, filenames in os.walk(str(s)): + for fname in filenames: + path = os.path.join(dirpath, fname) + if os.path.isfile(path): + zf.write(path) + else: + zf.write(str(s)) + zf.close() +else: + zipcompression = 0 + zip = "$ZIP $ZIPFLAGS ${TARGET.abspath} $SOURCES" + + +zipAction = SCons.Action.Action(zip, varlist=['ZIPCOMPRESSION']) + +ZipBuilder = SCons.Builder.Builder(action = SCons.Action.Action('$ZIPCOM', '$ZIPCOMSTR'), + source_factory = SCons.Node.FS.Entry, + source_scanner = SCons.Defaults.DirScanner, + suffix = '$ZIPSUFFIX', + multi = 1) + + +def generate(env): + """Add Builders and construction variables for zip to an Environment.""" + try: + bld = env['BUILDERS']['Zip'] + except KeyError: + bld = ZipBuilder + env['BUILDERS']['Zip'] = bld + + env['ZIP'] = 'zip' + env['ZIPFLAGS'] = SCons.Util.CLVar('') + env['ZIPCOM'] = zipAction + env['ZIPCOMPRESSION'] = zipcompression + env['ZIPSUFFIX'] = '.zip' + +def exists(env): + return internal_zip or env.Detect('zip') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Util.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Util.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Util.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Util.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,1492 @@ +"""SCons.Util + +Various utility functions go here. +""" +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Util.py 2013/03/03 09:48:35 garyo" + +import os +import sys +import copy +import re +import types + +from collections import UserDict, UserList, UserString + +# Don't "from types import ..." these because we need to get at the +# types module later to look for UnicodeType. +InstanceType = types.InstanceType +MethodType = types.MethodType +FunctionType = types.FunctionType +try: unicode +except NameError: UnicodeType = None +else: UnicodeType = unicode + +def dictify(keys, values, result={}): + for k, v in zip(keys, values): + result[k] = v + return result + +_altsep = os.altsep +if _altsep is None and sys.platform == 'win32': + # My ActivePython 2.0.1 doesn't set os.altsep! What gives? + _altsep = '/' +if _altsep: + def rightmost_separator(path, sep): + return max(path.rfind(sep), path.rfind(_altsep)) +else: + def rightmost_separator(path, sep): + return path.rfind(sep) + +# First two from the Python Cookbook, just for completeness. +# (Yeah, yeah, YAGNI...) +def containsAny(str, set): + """Check whether sequence str contains ANY of the items in set.""" + for c in set: + if c in str: return 1 + return 0 + +def containsAll(str, set): + """Check whether sequence str contains ALL of the items in set.""" + for c in set: + if c not in str: return 0 + return 1 + +def containsOnly(str, set): + """Check whether sequence str contains ONLY items in set.""" + for c in str: + if c not in set: return 0 + return 1 + +def splitext(path): + "Same as os.path.splitext() but faster." + sep = rightmost_separator(path, os.sep) + dot = path.rfind('.') + # An ext is only real if it has at least one non-digit char + if dot > sep and not containsOnly(path[dot:], "0123456789."): + return path[:dot],path[dot:] + else: + return path,"" + +def updrive(path): + """ + Make the drive letter (if any) upper case. + This is useful because Windows is inconsitent on the case + of the drive letter, which can cause inconsistencies when + calculating command signatures. + """ + drive, rest = os.path.splitdrive(path) + if drive: + path = drive.upper() + rest + return path + +class NodeList(UserList): + """This class is almost exactly like a regular list of Nodes + (actually it can hold any object), with one important difference. + If you try to get an attribute from this list, it will return that + attribute from every item in the list. For example: + + >>> someList = NodeList([ ' foo ', ' bar ' ]) + >>> someList.strip() + [ 'foo', 'bar' ] + """ + def __nonzero__(self): + return len(self.data) != 0 + + def __str__(self): + return ' '.join(map(str, self.data)) + + def __iter__(self): + return iter(self.data) + + def __call__(self, *args, **kwargs): + result = [x(*args, **kwargs) for x in self.data] + return self.__class__(result) + + def __getattr__(self, name): + result = [getattr(x, name) for x in self.data] + return self.__class__(result) + + +_get_env_var = re.compile(r'^\$([_a-zA-Z]\w*|{[_a-zA-Z]\w*})$') + +def get_environment_var(varstr): + """Given a string, first determine if it looks like a reference + to a single environment variable, like "$FOO" or "${FOO}". + If so, return that variable with no decorations ("FOO"). + If not, return None.""" + mo=_get_env_var.match(to_String(varstr)) + if mo: + var = mo.group(1) + if var[0] == '{': + return var[1:-1] + else: + return var + else: + return None + +class DisplayEngine(object): + print_it = True + def __call__(self, text, append_newline=1): + if not self.print_it: + return + if append_newline: text = text + '\n' + try: + sys.stdout.write(unicode(text)) + except IOError: + # Stdout might be connected to a pipe that has been closed + # by now. The most likely reason for the pipe being closed + # is that the user has press ctrl-c. It this is the case, + # then SCons is currently shutdown. We therefore ignore + # IOError's here so that SCons can continue and shutdown + # properly so that the .sconsign is correctly written + # before SCons exits. + pass + + def set_mode(self, mode): + self.print_it = mode + +def render_tree(root, child_func, prune=0, margin=[0], visited={}): + """ + Render a tree of nodes into an ASCII tree view. + root - the root node of the tree + child_func - the function called to get the children of a node + prune - don't visit the same node twice + margin - the format of the left margin to use for children of root. + 1 results in a pipe, and 0 results in no pipe. + visited - a dictionary of visited nodes in the current branch if not prune, + or in the whole tree if prune. + """ + + rname = str(root) + + children = child_func(root) + retval = "" + for pipe in margin[:-1]: + if pipe: + retval = retval + "| " + else: + retval = retval + " " + + if rname in visited: + return retval + "+-[" + rname + "]\n" + + retval = retval + "+-" + rname + "\n" + if not prune: + visited = copy.copy(visited) + visited[rname] = 1 + + for i in range(len(children)): + margin.append(i 0 + last = t[0] + lasti = i = 1 + while i < n: + if t[i] != last: + t[lasti] = last = t[i] + lasti = lasti + 1 + i = i + 1 + return t[:lasti] + del t + + # Brute force is all that's left. + u = [] + for x in s: + if x not in u: + u.append(x) + return u + + + +# From Alex Martelli, +# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560 +# ASPN: Python Cookbook: Remove duplicates from a sequence +# First comment, dated 2001/10/13. +# (Also in the printed Python Cookbook.) + +def uniquer(seq, idfun=None): + if idfun is None: + def idfun(x): return x + seen = {} + result = [] + for item in seq: + marker = idfun(item) + # in old Python versions: + # if seen.has_key(marker) + # but in new ones: + if marker in seen: continue + seen[marker] = 1 + result.append(item) + return result + +# A more efficient implementation of Alex's uniquer(), this avoids the +# idfun() argument and function-call overhead by assuming that all +# items in the sequence are hashable. + +def uniquer_hashables(seq): + seen = {} + result = [] + for item in seq: + #if not item in seen: + if item not in seen: + seen[item] = 1 + result.append(item) + return result + + + +# Much of the logic here was originally based on recipe 4.9 from the +# Python CookBook, but we had to dumb it way down for Python 1.5.2. +class LogicalLines(object): + + def __init__(self, fileobj): + self.fileobj = fileobj + + def readline(self): + result = [] + while True: + line = self.fileobj.readline() + if not line: + break + if line[-2:] == '\\\n': + result.append(line[:-2]) + else: + result.append(line) + break + return ''.join(result) + + def readlines(self): + result = [] + while True: + line = self.readline() + if not line: + break + result.append(line) + return result + + + +class UniqueList(UserList): + def __init__(self, seq = []): + UserList.__init__(self, seq) + self.unique = True + def __make_unique(self): + if not self.unique: + self.data = uniquer_hashables(self.data) + self.unique = True + def __lt__(self, other): + self.__make_unique() + return UserList.__lt__(self, other) + def __le__(self, other): + self.__make_unique() + return UserList.__le__(self, other) + def __eq__(self, other): + self.__make_unique() + return UserList.__eq__(self, other) + def __ne__(self, other): + self.__make_unique() + return UserList.__ne__(self, other) + def __gt__(self, other): + self.__make_unique() + return UserList.__gt__(self, other) + def __ge__(self, other): + self.__make_unique() + return UserList.__ge__(self, other) + def __cmp__(self, other): + self.__make_unique() + return UserList.__cmp__(self, other) + def __len__(self): + self.__make_unique() + return UserList.__len__(self) + def __getitem__(self, i): + self.__make_unique() + return UserList.__getitem__(self, i) + def __setitem__(self, i, item): + UserList.__setitem__(self, i, item) + self.unique = False + def __getslice__(self, i, j): + self.__make_unique() + return UserList.__getslice__(self, i, j) + def __setslice__(self, i, j, other): + UserList.__setslice__(self, i, j, other) + self.unique = False + def __add__(self, other): + result = UserList.__add__(self, other) + result.unique = False + return result + def __radd__(self, other): + result = UserList.__radd__(self, other) + result.unique = False + return result + def __iadd__(self, other): + result = UserList.__iadd__(self, other) + result.unique = False + return result + def __mul__(self, other): + result = UserList.__mul__(self, other) + result.unique = False + return result + def __rmul__(self, other): + result = UserList.__rmul__(self, other) + result.unique = False + return result + def __imul__(self, other): + result = UserList.__imul__(self, other) + result.unique = False + return result + def append(self, item): + UserList.append(self, item) + self.unique = False + def insert(self, i): + UserList.insert(self, i) + self.unique = False + def count(self, item): + self.__make_unique() + return UserList.count(self, item) + def index(self, item): + self.__make_unique() + return UserList.index(self, item) + def reverse(self): + self.__make_unique() + UserList.reverse(self) + def sort(self, *args, **kwds): + self.__make_unique() + return UserList.sort(self, *args, **kwds) + def extend(self, other): + UserList.extend(self, other) + self.unique = False + + +class Unbuffered(object): + """ + A proxy class that wraps a file object, flushing after every write, + and delegating everything else to the wrapped object. + """ + def __init__(self, file): + self.file = file + self.softspace = 0 ## backward compatibility; not supported in Py3k + def write(self, arg): + try: + self.file.write(arg) + self.file.flush() + except IOError: + # Stdout might be connected to a pipe that has been closed + # by now. The most likely reason for the pipe being closed + # is that the user has press ctrl-c. It this is the case, + # then SCons is currently shutdown. We therefore ignore + # IOError's here so that SCons can continue and shutdown + # properly so that the .sconsign is correctly written + # before SCons exits. + pass + def __getattr__(self, attr): + return getattr(self.file, attr) + +def make_path_relative(path): + """ makes an absolute path name to a relative pathname. + """ + if os.path.isabs(path): + drive_s,path = os.path.splitdrive(path) + + import re + if not drive_s: + path=re.compile("/*(.*)").findall(path)[0] + else: + path=path[1:] + + assert( not os.path.isabs( path ) ), path + return path + + + +# The original idea for AddMethod() and RenameFunction() come from the +# following post to the ActiveState Python Cookbook: +# +# ASPN: Python Cookbook : Install bound methods in an instance +# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/223613 +# +# That code was a little fragile, though, so the following changes +# have been wrung on it: +# +# * Switched the installmethod() "object" and "function" arguments, +# so the order reflects that the left-hand side is the thing being +# "assigned to" and the right-hand side is the value being assigned. +# +# * Changed explicit type-checking to the "try: klass = object.__class__" +# block in installmethod() below so that it still works with the +# old-style classes that SCons uses. +# +# * Replaced the by-hand creation of methods and functions with use of +# the "new" module, as alluded to in Alex Martelli's response to the +# following Cookbook post: +# +# ASPN: Python Cookbook : Dynamically added methods to a class +# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81732 + +def AddMethod(obj, function, name=None): + """ + Adds either a bound method to an instance or an unbound method to + a class. If name is ommited the name of the specified function + is used by default. + Example: + a = A() + def f(self, x, y): + self.z = x + y + AddMethod(f, A, "add") + a.add(2, 4) + print a.z + AddMethod(lambda self, i: self.l[i], a, "listIndex") + print a.listIndex(5) + """ + if name is None: + name = function.func_name + else: + function = RenameFunction(function, name) + + if hasattr(obj, '__class__') and obj.__class__ is not type: + # "obj" is an instance, so it gets a bound method. + setattr(obj, name, MethodType(function, obj, obj.__class__)) + else: + # "obj" is a class, so it gets an unbound method. + setattr(obj, name, MethodType(function, None, obj)) + +def RenameFunction(function, name): + """ + Returns a function identical to the specified function, but with + the specified name. + """ + return FunctionType(function.func_code, + function.func_globals, + name, + function.func_defaults) + + +md5 = False +def MD5signature(s): + return str(s) + +def MD5filesignature(fname, chunksize=65536): + f = open(fname, "rb") + result = f.read() + f.close() + return result + +try: + import hashlib +except ImportError: + pass +else: + if hasattr(hashlib, 'md5'): + md5 = True + def MD5signature(s): + m = hashlib.md5() + m.update(str(s)) + return m.hexdigest() + + def MD5filesignature(fname, chunksize=65536): + m = hashlib.md5() + f = open(fname, "rb") + while True: + blck = f.read(chunksize) + if not blck: + break + m.update(str(blck)) + f.close() + return m.hexdigest() + +def MD5collect(signatures): + """ + Collects a list of signatures into an aggregate signature. + + signatures - a list of signatures + returns - the aggregate signature + """ + if len(signatures) == 1: + return signatures[0] + else: + return MD5signature(', '.join(signatures)) + + + +def silent_intern(x): + """ + Perform sys.intern() on the passed argument and return the result. + If the input is ineligible (e.g. a unicode string) the original argument is + returned and no exception is thrown. + """ + try: + return sys.intern(x) + except TypeError: + return x + + + +# From Dinu C. Gherman, +# Python Cookbook, second edition, recipe 6.17, p. 277. +# Also: +# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/68205 +# ASPN: Python Cookbook: Null Object Design Pattern + +#TODO??? class Null(object): +class Null(object): + """ Null objects always and reliably "do nothing." """ + def __new__(cls, *args, **kwargs): + if not '_instance' in vars(cls): + cls._instance = super(Null, cls).__new__(cls, *args, **kwargs) + return cls._instance + def __init__(self, *args, **kwargs): + pass + def __call__(self, *args, **kwargs): + return self + def __repr__(self): + return "Null(0x%08X)" % id(self) + def __nonzero__(self): + return False + def __getattr__(self, name): + return self + def __setattr__(self, name, value): + return self + def __delattr__(self, name): + return self + +class NullSeq(Null): + def __len__(self): + return 0 + def __iter__(self): + return iter(()) + def __getitem__(self, i): + return self + def __delitem__(self, i): + return self + def __setitem__(self, i, v): + return self + + +del __revision__ + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Variables/BoolVariable.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Variables/BoolVariable.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Variables/BoolVariable.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Variables/BoolVariable.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,89 @@ +"""engine.SCons.Variables.BoolVariable + +This file defines the option type for SCons implementing true/false values. + +Usage example: + + opts = Variables() + opts.Add(BoolVariable('embedded', 'build for an embedded system', 0)) + ... + if env['embedded'] == 1: + ... +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Variables/BoolVariable.py 2013/03/03 09:48:35 garyo" + +__all__ = ['BoolVariable',] + +import SCons.Errors + +__true_strings = ('y', 'yes', 'true', 't', '1', 'on' , 'all' ) +__false_strings = ('n', 'no', 'false', 'f', '0', 'off', 'none') + + +def _text2bool(val): + """ + Converts strings to True/False depending on the 'truth' expressed by + the string. If the string can't be converted, the original value + will be returned. + + See '__true_strings' and '__false_strings' for values considered + 'true' or 'false respectivly. + + This is usable as 'converter' for SCons' Variables. + """ + lval = val.lower() + if lval in __true_strings: return True + if lval in __false_strings: return False + raise ValueError("Invalid value for boolean option: %s" % val) + + +def _validator(key, val, env): + """ + Validates the given value to be either '0' or '1'. + + This is usable as 'validator' for SCons' Variables. + """ + if not env[key] in (True, False): + raise SCons.Errors.UserError( + 'Invalid value for boolean option %s: %s' % (key, env[key])) + + +def BoolVariable(key, help, default): + """ + The input parameters describe a boolen option, thus they are + returned with the correct converter and validator appended. The + 'help' text will by appended by '(yes|no) to show the valid + valued. The result is usable for input to opts.Add(). + """ + return (key, '%s (yes|no)' % help, default, + _validator, _text2bool) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Variables/EnumVariable.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Variables/EnumVariable.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Variables/EnumVariable.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Variables/EnumVariable.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,103 @@ +"""engine.SCons.Variables.EnumVariable + +This file defines the option type for SCons allowing only specified +input-values. + +Usage example: + + opts = Variables() + opts.Add(EnumVariable('debug', 'debug output and symbols', 'no', + allowed_values=('yes', 'no', 'full'), + map={}, ignorecase=2)) + ... + if env['debug'] == 'full': + ... +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Variables/EnumVariable.py 2013/03/03 09:48:35 garyo" + +__all__ = ['EnumVariable',] + + +import SCons.Errors + +def _validator(key, val, env, vals): + if not val in vals: + raise SCons.Errors.UserError( + 'Invalid value for option %s: %s. Valid values are: %s' % (key, val, vals)) + + +def EnumVariable(key, help, default, allowed_values, map={}, ignorecase=0): + """ + The input parameters describe a option with only certain values + allowed. They are returned with an appropriate converter and + validator appended. The result is usable for input to + Variables.Add(). + + 'key' and 'default' are the values to be passed on to Variables.Add(). + + 'help' will be appended by the allowed values automatically + + 'allowed_values' is a list of strings, which are allowed as values + for this option. + + The 'map'-dictionary may be used for converting the input value + into canonical values (eg. for aliases). + + 'ignorecase' defines the behaviour of the validator: + + If ignorecase == 0, the validator/converter are case-sensitive. + If ignorecase == 1, the validator/converter are case-insensitive. + If ignorecase == 2, the validator/converter is case-insensitive and + the converted value will always be lower-case. + + The 'validator' tests whether the value is in the list of allowed + values. The 'converter' converts input values according to the + given 'map'-dictionary (unmapped input values are returned + unchanged). + """ + help = '%s (%s)' % (help, '|'.join(allowed_values)) + # define validator + if ignorecase >= 1: + validator = lambda key, val, env: \ + _validator(key, val.lower(), env, allowed_values) + else: + validator = lambda key, val, env: \ + _validator(key, val, env, allowed_values) + # define converter + if ignorecase == 2: + converter = lambda val: map.get(val.lower(), val).lower() + elif ignorecase == 1: + converter = lambda val: map.get(val.lower(), val) + else: + converter = lambda val: map.get(val, val) + return (key, help, default, validator, converter) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Variables/ListVariable.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Variables/ListVariable.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Variables/ListVariable.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Variables/ListVariable.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,135 @@ +"""engine.SCons.Variables.ListVariable + +This file defines the option type for SCons implementing 'lists'. + +A 'list' option may either be 'all', 'none' or a list of names +separated by comma. After the option has been processed, the option +value holds either the named list elements, all list elemens or no +list elements at all. + +Usage example: + + list_of_libs = Split('x11 gl qt ical') + + opts = Variables() + opts.Add(ListVariable('shared', + 'libraries to build as shared libraries', + 'all', + elems = list_of_libs)) + ... + for lib in list_of_libs: + if lib in env['shared']: + env.SharedObject(...) + else: + env.Object(...) +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Variables/ListVariable.py 2013/03/03 09:48:35 garyo" + +# Know Bug: This should behave like a Set-Type, but does not really, +# since elements can occur twice. + +__all__ = ['ListVariable',] + +import collections + +import SCons.Util + + +class _ListVariable(collections.UserList): + def __init__(self, initlist=[], allowedElems=[]): + collections.UserList.__init__(self, [_f for _f in initlist if _f]) + self.allowedElems = sorted(allowedElems) + + def __cmp__(self, other): + raise NotImplementedError + def __eq__(self, other): + raise NotImplementedError + def __ge__(self, other): + raise NotImplementedError + def __gt__(self, other): + raise NotImplementedError + def __le__(self, other): + raise NotImplementedError + def __lt__(self, other): + raise NotImplementedError + def __str__(self): + if len(self) == 0: + return 'none' + self.data.sort() + if self.data == self.allowedElems: + return 'all' + else: + return ','.join(self) + def prepare_to_store(self): + return self.__str__() + +def _converter(val, allowedElems, mapdict): + """ + """ + if val == 'none': + val = [] + elif val == 'all': + val = allowedElems + else: + val = [_f for _f in val.split(',') if _f] + val = [mapdict.get(v, v) for v in val] + notAllowed = [v for v in val if not v in allowedElems] + if notAllowed: + raise ValueError("Invalid value(s) for option: %s" % + ','.join(notAllowed)) + return _ListVariable(val, allowedElems) + + +## def _validator(key, val, env): +## """ +## """ +## # todo: write validater for pgk list +## return 1 + + +def ListVariable(key, help, default, names, map={}): + """ + The input parameters describe a 'package list' option, thus they + are returned with the correct converter and validater appended. The + result is usable for input to opts.Add() . + + A 'package list' option may either be 'all', 'none' or a list of + package names (separated by space). + """ + names_str = 'allowed names: %s' % ' '.join(names) + if SCons.Util.is_List(default): + default = ','.join(default) + help = '\n '.join( + (help, '(all|none|comma-separated list of names)', names_str)) + return (key, help, default, + None, #_validator, + lambda val: _converter(val, names, map)) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Variables/PackageVariable.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Variables/PackageVariable.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Variables/PackageVariable.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Variables/PackageVariable.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,106 @@ +"""engine.SCons.Variables.PackageVariable + +This file defines the option type for SCons implementing 'package +activation'. + +To be used whenever a 'package' may be enabled/disabled and the +package path may be specified. + +Usage example: + + Examples: + x11=no (disables X11 support) + x11=yes (will search for the package installation dir) + x11=/usr/local/X11 (will check this path for existance) + + To replace autoconf's --with-xxx=yyy + + opts = Variables() + opts.Add(PackageVariable('x11', + 'use X11 installed here (yes = search some places', + 'yes')) + ... + if env['x11'] == True: + dir = ... search X11 in some standard places ... + env['x11'] = dir + if env['x11']: + ... build with x11 ... +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Variables/PackageVariable.py 2013/03/03 09:48:35 garyo" + +__all__ = ['PackageVariable',] + +import SCons.Errors + +__enable_strings = ('1', 'yes', 'true', 'on', 'enable', 'search') +__disable_strings = ('0', 'no', 'false', 'off', 'disable') + +def _converter(val): + """ + """ + lval = val.lower() + if lval in __enable_strings: return True + if lval in __disable_strings: return False + #raise ValueError("Invalid value for boolean option: %s" % val) + return val + + +def _validator(key, val, env, searchfunc): + # NB: searchfunc is currenty undocumented and unsupported + """ + """ + # todo: write validator, check for path + import os + if env[key] is True: + if searchfunc: + env[key] = searchfunc(key, val) + elif env[key] and not os.path.exists(val): + raise SCons.Errors.UserError( + 'Path does not exist for option %s: %s' % (key, val)) + + +def PackageVariable(key, help, default, searchfunc=None): + # NB: searchfunc is currenty undocumented and unsupported + """ + The input parameters describe a 'package list' option, thus they + are returned with the correct converter and validator appended. The + result is usable for input to opts.Add() . + + A 'package list' option may either be 'all', 'none' or a list of + package names (seperated by space). + """ + help = '\n '.join( + (help, '( yes | no | /path/to/%s )' % key)) + return (key, help, default, + lambda k, v, e: _validator(k,v,e,searchfunc), + _converter) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Variables/PathVariable.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Variables/PathVariable.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Variables/PathVariable.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Variables/PathVariable.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,147 @@ +"""SCons.Variables.PathVariable + +This file defines an option type for SCons implementing path settings. + +To be used whenever a a user-specified path override should be allowed. + +Arguments to PathVariable are: + option-name = name of this option on the command line (e.g. "prefix") + option-help = help string for option + option-dflt = default value for this option + validator = [optional] validator for option value. Predefined + validators are: + + PathAccept -- accepts any path setting; no validation + PathIsDir -- path must be an existing directory + PathIsDirCreate -- path must be a dir; will create + PathIsFile -- path must be a file + PathExists -- path must exist (any type) [default] + + The validator is a function that is called and which + should return True or False to indicate if the path + is valid. The arguments to the validator function + are: (key, val, env). The key is the name of the + option, the val is the path specified for the option, + and the env is the env to which the Otions have been + added. + +Usage example: + + Examples: + prefix=/usr/local + + opts = Variables() + + opts = Variables() + opts.Add(PathVariable('qtdir', + 'where the root of Qt is installed', + qtdir, PathIsDir)) + opts.Add(PathVariable('qt_includes', + 'where the Qt includes are installed', + '$qtdir/includes', PathIsDirCreate)) + opts.Add(PathVariable('qt_libraries', + 'where the Qt library is installed', + '$qtdir/lib')) + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/Variables/PathVariable.py 2013/03/03 09:48:35 garyo" + +__all__ = ['PathVariable',] + +import os +import os.path + +import SCons.Errors + +class _PathVariableClass(object): + + def PathAccept(self, key, val, env): + """Accepts any path, no checking done.""" + pass + + def PathIsDir(self, key, val, env): + """Validator to check if Path is a directory.""" + if not os.path.isdir(val): + if os.path.isfile(val): + m = 'Directory path for option %s is a file: %s' + else: + m = 'Directory path for option %s does not exist: %s' + raise SCons.Errors.UserError(m % (key, val)) + + def PathIsDirCreate(self, key, val, env): + """Validator to check if Path is a directory, + creating it if it does not exist.""" + if os.path.isfile(val): + m = 'Path for option %s is a file, not a directory: %s' + raise SCons.Errors.UserError(m % (key, val)) + if not os.path.isdir(val): + os.makedirs(val) + + def PathIsFile(self, key, val, env): + """validator to check if Path is a file""" + if not os.path.isfile(val): + if os.path.isdir(val): + m = 'File path for option %s is a directory: %s' + else: + m = 'File path for option %s does not exist: %s' + raise SCons.Errors.UserError(m % (key, val)) + + def PathExists(self, key, val, env): + """validator to check if Path exists""" + if not os.path.exists(val): + m = 'Path for option %s does not exist: %s' + raise SCons.Errors.UserError(m % (key, val)) + + def __call__(self, key, help, default, validator=None): + # NB: searchfunc is currenty undocumented and unsupported + """ + The input parameters describe a 'path list' option, thus they + are returned with the correct converter and validator appended. The + result is usable for input to opts.Add() . + + The 'default' option specifies the default path to use if the + user does not specify an override with this option. + + validator is a validator, see this file for examples + """ + if validator is None: + validator = self.PathExists + + if SCons.Util.is_List(key) or SCons.Util.is_Tuple(key): + return (key, '%s ( /path/to/%s )' % (help, key[0]), default, + validator, None) + else: + return (key, '%s ( /path/to/%s )' % (help, key), default, + validator, None) + +PathVariable = _PathVariableClass() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Variables/__init__.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Variables/__init__.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Variables/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Variables/__init__.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,312 @@ +"""engine.SCons.Variables + +This file defines the Variables class that is used to add user-friendly +customizable variables to an SCons build. +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. + +__revision__ = "src/engine/SCons/Variables/__init__.py 2013/03/03 09:48:35 garyo" + +import os.path +import sys + +import SCons.Environment +import SCons.Errors +import SCons.Util +import SCons.Warnings + +from BoolVariable import BoolVariable # okay +from EnumVariable import EnumVariable # okay +from ListVariable import ListVariable # naja +from PackageVariable import PackageVariable # naja +from PathVariable import PathVariable # okay + + +class Variables(object): + instance=None + + """ + Holds all the options, updates the environment with the variables, + and renders the help text. + """ + def __init__(self, files=[], args={}, is_global=1): + """ + files - [optional] List of option configuration files to load + (backward compatibility) If a single string is passed it is + automatically placed in a file list + """ + self.options = [] + self.args = args + if not SCons.Util.is_List(files): + if files: + files = [ files ] + else: + files = [] + self.files = files + self.unknown = {} + + # create the singleton instance + if is_global: + self=Variables.instance + + if not Variables.instance: + Variables.instance=self + + def _do_add(self, key, help="", default=None, validator=None, converter=None): + class Variable(object): + pass + + option = Variable() + + # if we get a list or a tuple, we take the first element as the + # option key and store the remaining in aliases. + if SCons.Util.is_List(key) or SCons.Util.is_Tuple(key): + option.key = key[0] + option.aliases = key[1:] + else: + option.key = key + option.aliases = [ key ] + option.help = help + option.default = default + option.validator = validator + option.converter = converter + + self.options.append(option) + + # options might be added after the 'unknown' dict has been set up, + # so we remove the key and all its aliases from that dict + for alias in list(option.aliases) + [ option.key ]: + if alias in self.unknown: + del self.unknown[alias] + + def keys(self): + """ + Returns the keywords for the options + """ + return [o.key for o in self.options] + + def Add(self, key, help="", default=None, validator=None, converter=None, **kw): + """ + Add an option. + + key - the name of the variable, or a list or tuple of arguments + help - optional help text for the options + default - optional default value + validator - optional function that is called to validate the option's value + Called with (key, value, environment) + converter - optional function that is called to convert the option's value before + putting it in the environment. + """ + + if SCons.Util.is_List(key) or isinstance(key, tuple): + self._do_add(*key) + return + + if not SCons.Util.is_String(key) or \ + not SCons.Environment.is_valid_construction_var(key): + raise SCons.Errors.UserError("Illegal Variables.Add() key `%s'" % str(key)) + + self._do_add(key, help, default, validator, converter) + + def AddVariables(self, *optlist): + """ + Add a list of options. + + Each list element is a tuple/list of arguments to be passed on + to the underlying method for adding options. + + Example: + opt.AddVariables( + ('debug', '', 0), + ('CC', 'The C compiler'), + ('VALIDATE', 'An option for testing validation', 'notset', + validator, None), + ) + """ + for o in optlist: + self._do_add(*o) + + + def Update(self, env, args=None): + """ + Update an environment with the option variables. + + env - the environment to update. + """ + + values = {} + + # first set the defaults: + for option in self.options: + if not option.default is None: + values[option.key] = option.default + + # next set the value specified in the options file + for filename in self.files: + if os.path.exists(filename): + dir = os.path.split(os.path.abspath(filename))[0] + if dir: + sys.path.insert(0, dir) + try: + values['__name__'] = filename + exec open(filename, 'rU').read() in {}, values + finally: + if dir: + del sys.path[0] + del values['__name__'] + + # set the values specified on the command line + if args is None: + args = self.args + + for arg, value in args.items(): + added = False + for option in self.options: + if arg in list(option.aliases) + [ option.key ]: + values[option.key] = value + added = True + if not added: + self.unknown[arg] = value + + # put the variables in the environment: + # (don't copy over variables that are not declared as options) + for option in self.options: + try: + env[option.key] = values[option.key] + except KeyError: + pass + + # Call the convert functions: + for option in self.options: + if option.converter and option.key in values: + value = env.subst('${%s}'%option.key) + try: + try: + env[option.key] = option.converter(value) + except TypeError: + env[option.key] = option.converter(value, env) + except ValueError, x: + raise SCons.Errors.UserError('Error converting option: %s\n%s'%(option.key, x)) + + + # Finally validate the values: + for option in self.options: + if option.validator and option.key in values: + option.validator(option.key, env.subst('${%s}'%option.key), env) + + def UnknownVariables(self): + """ + Returns any options in the specified arguments lists that + were not known, declared options in this object. + """ + return self.unknown + + def Save(self, filename, env): + """ + Saves all the options in the given file. This file can + then be used to load the options next run. This can be used + to create an option cache file. + + filename - Name of the file to save into + env - the environment get the option values from + """ + + # Create the file and write out the header + try: + fh = open(filename, 'w') + + try: + # Make an assignment in the file for each option + # within the environment that was assigned a value + # other than the default. + for option in self.options: + try: + value = env[option.key] + try: + prepare = value.prepare_to_store + except AttributeError: + try: + eval(repr(value)) + except KeyboardInterrupt: + raise + except: + # Convert stuff that has a repr() that + # cannot be evaluated into a string + value = SCons.Util.to_String(value) + else: + value = prepare() + + defaultVal = env.subst(SCons.Util.to_String(option.default)) + if option.converter: + defaultVal = option.converter(defaultVal) + + if str(env.subst('${%s}' % option.key)) != str(defaultVal): + fh.write('%s = %s\n' % (option.key, repr(value))) + except KeyError: + pass + finally: + fh.close() + + except IOError, x: + raise SCons.Errors.UserError('Error writing options to file: %s\n%s' % (filename, x)) + + def GenerateHelpText(self, env, sort=None): + """ + Generate the help text for the options. + + env - an environment that is used to get the current values + of the options. + """ + + if sort: + options = sorted(self.options, key=lambda x: x.key) + else: + options = self.options + + def format(opt, self=self, env=env): + if opt.key in env: + actual = env.subst('${%s}' % opt.key) + else: + actual = None + return self.FormatVariableHelpText(env, opt.key, opt.help, opt.default, actual, opt.aliases) + lines = [_f for _f in map(format, options) if _f] + + return ''.join(lines) + + format = '\n%s: %s\n default: %s\n actual: %s\n' + format_ = '\n%s: %s\n default: %s\n actual: %s\n aliases: %s\n' + + def FormatVariableHelpText(self, env, key, help, default, actual, aliases=[]): + # Don't display the key name itself as an alias. + aliases = [a for a in aliases if a != key] + if len(aliases)==0: + return self.format % (key, help, default, actual) + else: + return self.format_ % (key, help, default, actual, aliases) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Warnings.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Warnings.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/Warnings.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/Warnings.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,246 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +"""SCons.Warnings + +This file implements the warnings framework for SCons. + +""" + +__revision__ = "src/engine/SCons/Warnings.py 2013/03/03 09:48:35 garyo" + +import sys + +import SCons.Errors + +class Warning(SCons.Errors.UserError): + pass + +class WarningOnByDefault(Warning): + pass + + +# NOTE: If you add a new warning class, add it to the man page, too! + +class CacheWriteErrorWarning(Warning): + pass + +class CorruptSConsignWarning(WarningOnByDefault): + pass + +class DependencyWarning(Warning): + pass + +class DuplicateEnvironmentWarning(WarningOnByDefault): + pass + +class FutureReservedVariableWarning(WarningOnByDefault): + pass + +class LinkWarning(WarningOnByDefault): + pass + +class MisleadingKeywordsWarning(WarningOnByDefault): + pass + +class MissingSConscriptWarning(WarningOnByDefault): + pass + +class NoMD5ModuleWarning(WarningOnByDefault): + pass + +class NoMetaclassSupportWarning(WarningOnByDefault): + pass + +class NoObjectCountWarning(WarningOnByDefault): + pass + +class NoParallelSupportWarning(WarningOnByDefault): + pass + +class ReservedVariableWarning(WarningOnByDefault): + pass + +class StackSizeWarning(WarningOnByDefault): + pass + +class VisualCMissingWarning(WarningOnByDefault): + pass + +# Used when MSVC_VERSION and MSVS_VERSION do not point to the +# same version (MSVS_VERSION is deprecated) +class VisualVersionMismatch(WarningOnByDefault): + pass + +class VisualStudioMissingWarning(Warning): + pass + +class FortranCxxMixWarning(LinkWarning): + pass + + +# Deprecation warnings + +class FutureDeprecatedWarning(Warning): + pass + +class DeprecatedWarning(Warning): + pass + +class MandatoryDeprecatedWarning(DeprecatedWarning): + pass + + +# Special case; base always stays DeprecatedWarning +class PythonVersionWarning(DeprecatedWarning): + pass + +class DeprecatedSourceCodeWarning(FutureDeprecatedWarning): + pass + +class DeprecatedBuildDirWarning(DeprecatedWarning): + pass + +class TaskmasterNeedsExecuteWarning(DeprecatedWarning): + pass + +class DeprecatedCopyWarning(MandatoryDeprecatedWarning): + pass + +class DeprecatedOptionsWarning(MandatoryDeprecatedWarning): + pass + +class DeprecatedSourceSignaturesWarning(MandatoryDeprecatedWarning): + pass + +class DeprecatedTargetSignaturesWarning(MandatoryDeprecatedWarning): + pass + +class DeprecatedDebugOptionsWarning(MandatoryDeprecatedWarning): + pass + +class DeprecatedSigModuleWarning(MandatoryDeprecatedWarning): + pass + +class DeprecatedBuilderKeywordsWarning(MandatoryDeprecatedWarning): + pass + + +# The below is a list of 2-tuples. The first element is a class object. +# The second element is true if that class is enabled, false if it is disabled. +_enabled = [] + +# If set, raise the warning as an exception +_warningAsException = 0 + +# If not None, a function to call with the warning +_warningOut = None + +def suppressWarningClass(clazz): + """Suppresses all warnings that are of type clazz or + derived from clazz.""" + _enabled.insert(0, (clazz, 0)) + +def enableWarningClass(clazz): + """Enables all warnings that are of type clazz or + derived from clazz.""" + _enabled.insert(0, (clazz, 1)) + +def warningAsException(flag=1): + """Turn warnings into exceptions. Returns the old value of the flag.""" + global _warningAsException + old = _warningAsException + _warningAsException = flag + return old + +def warn(clazz, *args): + global _enabled, _warningAsException, _warningOut + + warning = clazz(args) + for clazz, flag in _enabled: + if isinstance(warning, clazz): + if flag: + if _warningAsException: + raise warning + + if _warningOut: + _warningOut(warning) + break + +def process_warn_strings(arguments): + """Process string specifications of enabling/disabling warnings, + as passed to the --warn option or the SetOption('warn') function. + + + An argument to this option should be of the form + or no-. The warning class is munged in order + to get an actual class name from the classes above, which we + need to pass to the {enable,disable}WarningClass() functions. + The supplied is split on hyphens, each element + is capitalized, then smushed back together. Then the string + "Warning" is appended to get the class name. + + For example, 'deprecated' will enable the DeprecatedWarning + class. 'no-dependency' will disable the DependencyWarning class. + + As a special case, --warn=all and --warn=no-all will enable or + disable (respectively) the base Warning class of all warnings. + + """ + + def _capitalize(s): + if s[:5] == "scons": + return "SCons" + s[5:] + else: + return s.capitalize() + + for arg in arguments: + + elems = arg.lower().split('-') + enable = 1 + if elems[0] == 'no': + enable = 0 + del elems[0] + + if len(elems) == 1 and elems[0] == 'all': + class_name = "Warning" + else: + class_name = ''.join(map(_capitalize, elems)) + "Warning" + try: + clazz = globals()[class_name] + except KeyError: + sys.stderr.write("No warning type: '%s'\n" % arg) + else: + if enable: + enableWarningClass(clazz) + elif issubclass(clazz, MandatoryDeprecatedWarning): + fmt = "Can not disable mandataory warning: '%s'\n" + sys.stderr.write(fmt % arg) + else: + suppressWarningClass(clazz) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/__init__.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/__init__.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/__init__.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,49 @@ +"""SCons + +The main package for the SCons software construction utility. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/__init__.py 2013/03/03 09:48:35 garyo" + +__version__ = "2.3.0" + +__build__ = "" + +__buildsys__ = "reepicheep" + +__date__ = "2013/03/03 09:48:35" + +__developer__ = "garyo" + +# make sure compatibility is always in place +import SCons.compat + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/compat/__init__.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/compat/__init__.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/compat/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/compat/__init__.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,237 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__doc__ = """ +SCons compatibility package for old Python versions + +This subpackage holds modules that provide backwards-compatible +implementations of various things that we'd like to use in SCons but which +only show up in later versions of Python than the early, old version(s) +we still support. + +Other code will not generally reference things in this package through +the SCons.compat namespace. The modules included here add things to +the builtins namespace or the global module list so that the rest +of our code can use the objects and names imported here regardless of +Python version. + +Simply enough, things that go in the builtins name space come from +our _scons_builtins module. + +The rest of the things here will be in individual compatibility modules +that are either: 1) suitably modified copies of the future modules that +we want to use; or 2) backwards compatible re-implementations of the +specific portions of a future module's API that we want to use. + +GENERAL WARNINGS: Implementations of functions in the SCons.compat +modules are *NOT* guaranteed to be fully compliant with these functions in +later versions of Python. We are only concerned with adding functionality +that we actually use in SCons, so be wary if you lift this code for +other uses. (That said, making these more nearly the same as later, +official versions is still a desirable goal, we just don't need to be +obsessive about it.) + +We name the compatibility modules with an initial '_scons_' (for example, +_scons_subprocess.py is our compatibility module for subprocess) so +that we can still try to import the real module name and fall back to +our compatibility module if we get an ImportError. The import_as() +function defined below loads the module as the "real" name (without the +'_scons'), after which all of the "import {module}" statements in the +rest of our code will find our pre-loaded compatibility module. +""" + +__revision__ = "src/engine/SCons/compat/__init__.py 2013/03/03 09:48:35 garyo" + +import os +import sys +import imp # Use the "imp" module to protect imports from fixers. + +def import_as(module, name): + """ + Imports the specified module (from our local directory) as the + specified name, returning the loaded module object. + """ + dir = os.path.split(__file__)[0] + return imp.load_module(name, *imp.find_module(module, [dir])) + +def rename_module(new, old): + """ + Attempts to import the old module and load it under the new name. + Used for purely cosmetic name changes in Python 3.x. + """ + try: + sys.modules[new] = imp.load_module(old, *imp.find_module(old)) + return True + except ImportError: + return False + + +rename_module('builtins', '__builtin__') +import _scons_builtins + + +try: + import hashlib +except ImportError: + # Pre-2.5 Python has no hashlib module. + try: + import_as('_scons_hashlib', 'hashlib') + except ImportError: + # If we failed importing our compatibility module, it probably + # means this version of Python has no md5 module. Don't do + # anything and let the higher layer discover this fact, so it + # can fall back to using timestamp. + pass + +try: + set +except NameError: + # Pre-2.4 Python has no native set type + import_as('_scons_sets', 'sets') + import builtins, sets + builtins.set = sets.Set + + +try: + import collections +except ImportError: + # Pre-2.4 Python has no collections module. + import_as('_scons_collections', 'collections') +else: + try: + collections.UserDict + except AttributeError: + exec('from UserDict import UserDict as _UserDict') + collections.UserDict = _UserDict + del _UserDict + try: + collections.UserList + except AttributeError: + exec('from UserList import UserList as _UserList') + collections.UserList = _UserList + del _UserList + try: + collections.UserString + except AttributeError: + exec('from UserString import UserString as _UserString') + collections.UserString = _UserString + del _UserString + + +try: + import io +except ImportError: + # Pre-2.6 Python has no io module. + import_as('_scons_io', 'io') + + +try: + os.devnull +except AttributeError: + # Pre-2.4 Python has no os.devnull attribute + _names = sys.builtin_module_names + if 'posix' in _names: + os.devnull = '/dev/null' + elif 'nt' in _names: + os.devnull = 'nul' + os.path.devnull = os.devnull +try: + os.path.lexists +except AttributeError: + # Pre-2.4 Python has no os.path.lexists function + def lexists(path): + return os.path.exists(path) or os.path.islink(path) + os.path.lexists = lexists + + +# When we're using the '-3' option during regression tests, importing +# cPickle gives a warning no matter how it's done, so always use the +# real profile module, whether it's fast or not. +if os.environ.get('SCONS_HORRIBLE_REGRESSION_TEST_HACK') is None: + # Not a regression test with '-3', so try to use faster version. + # In 3.x, 'pickle' automatically loads the fast version if available. + rename_module('pickle', 'cPickle') + + +# In 3.x, 'profile' automatically loads the fast version if available. +rename_module('profile', 'cProfile') + + +# Before Python 3.0, the 'queue' module was named 'Queue'. +rename_module('queue', 'Queue') + + +# Before Python 3.0, the 'winreg' module was named '_winreg' +rename_module('winreg', '_winreg') + + +try: + import subprocess +except ImportError: + # Pre-2.4 Python has no subprocess module. + import_as('_scons_subprocess', 'subprocess') + +try: + sys.intern +except AttributeError: + # Pre-2.6 Python has no sys.intern() function. + import builtins + try: + sys.intern = builtins.intern + except AttributeError: + # Pre-2.x Python has no builtin intern() function. + def intern(x): + return x + sys.intern = intern + del intern +try: + sys.maxsize +except AttributeError: + # Pre-2.6 Python has no sys.maxsize attribute + # Wrapping sys in () is silly, but protects it from 2to3 renames fixer + sys.maxsize = (sys).maxint + + +if os.environ.get('SCONS_HORRIBLE_REGRESSION_TEST_HACK') is not None: + # We can't apply the 'callable' fixer until the floor is 2.6, but the + # '-3' option to Python 2.6 and 2.7 generates almost ten thousand + # warnings. This hack allows us to run regression tests with the '-3' + # option by replacing the callable() built-in function with a hack + # that performs the same function but doesn't generate the warning. + # Note that this hack is ONLY intended to be used for regression + # testing, and should NEVER be used for real runs. + from types import ClassType + def callable(obj): + if hasattr(obj, '__call__'): return True + if isinstance(obj, (ClassType, type)): return True + return False + import builtins + builtins.callable = callable + del callable + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/compat/_scons_builtins.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/compat/_scons_builtins.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/compat/_scons_builtins.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/compat/_scons_builtins.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,107 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +# Portions of the following are derived from the compat.py file in +# Twisted, under the following copyright: +# +# Copyright (c) 2001-2004 Twisted Matrix Laboratories + +__doc__ = """ +Compatibility idioms for builtins names + +This module adds names to the builtins module for things that we want +to use in SCons but which don't show up until later Python versions than +the earliest ones we support. + +This module checks for the following builtins names: + + all() + any() + memoryview() + +Implementations of functions are *NOT* guaranteed to be fully compliant +with these functions in later versions of Python. We are only concerned +with adding functionality that we actually use in SCons, so be wary +if you lift this code for other uses. (That said, making these more +nearly the same as later, official versions is still a desirable goal, +we just don't need to be obsessive about it.) + +If you're looking at this with pydoc and various names don't show up in +the FUNCTIONS or DATA output, that means those names are already built in +to this version of Python and we don't need to add them from this module. +""" + +__revision__ = "src/engine/SCons/compat/_scons_builtins.py 2013/03/03 09:48:35 garyo" + +import builtins + +try: + all +except NameError: + # Pre-2.5 Python has no all() function. + def all(iterable): + """ + Returns True if all elements of the iterable are true. + """ + for element in iterable: + if not element: + return False + return True + builtins.all = all + all = all + +try: + any +except NameError: + # Pre-2.5 Python has no any() function. + def any(iterable): + """ + Returns True if any element of the iterable is true. + """ + for element in iterable: + if element: + return True + return False + builtins.any = any + any = any + +try: + memoryview +except NameError: + # Pre-2.7 doesn't have the memoryview() built-in. + class memoryview(object): + def __init__(self, obj): + # wrapping buffer in () keeps the fixer from changing it + self.obj = (buffer)(obj) + def __getitem__(self, indx): + if isinstance(indx, slice): + return self.obj[indx.start:indx.stop] + else: + return self.obj[indx] + builtins.memoryview = memoryview + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/compat/_scons_collections.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/compat/_scons_collections.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/compat/_scons_collections.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/compat/_scons_collections.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,45 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__doc__ = """ +collections compatibility module for older (pre-2.4) Python versions + +This does not not NOT (repeat, *NOT*) provide complete collections +functionality. It only wraps the portions of collections functionality +used by SCons, in an interface that looks enough like collections for +our purposes. +""" + +__revision__ = "src/engine/SCons/compat/_scons_collections.py 2013/03/03 09:48:35 garyo" + +# Use exec to hide old names from fixers. +exec("""if True: + from UserDict import UserDict + from UserList import UserList + from UserString import UserString""") + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/compat/_scons_dbm.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/compat/_scons_dbm.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/compat/_scons_dbm.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/compat/_scons_dbm.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,45 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__doc__ = """ +dbm compatibility module for Python versions that don't have dbm. + +This does not not NOT (repeat, *NOT*) provide complete dbm functionality. +It's just a stub on which to hang just enough pieces of dbm functionality +that the whichdb.whichdb() implementstation in the various 2.X versions of +Python won't blow up even if dbm wasn't compiled in. +""" + +__revision__ = "src/engine/SCons/compat/_scons_dbm.py 2013/03/03 09:48:35 garyo" + +class error(Exception): + pass + +def open(*args, **kw): + raise error() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/compat/_scons_hashlib.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/compat/_scons_hashlib.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/compat/_scons_hashlib.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/compat/_scons_hashlib.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,76 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__doc__ = """ +hashlib backwards-compatibility module for older (pre-2.5) Python versions + +This does not not NOT (repeat, *NOT*) provide complete hashlib +functionality. It only wraps the portions of MD5 functionality used +by SCons, in an interface that looks like hashlib (or enough for our +purposes, anyway). In fact, this module will raise an ImportError if +the underlying md5 module isn't available. +""" + +__revision__ = "src/engine/SCons/compat/_scons_hashlib.py 2013/03/03 09:48:35 garyo" + +import md5 +from string import hexdigits + +class md5obj(object): + + md5_module = md5 + + def __init__(self, name, string=''): + if not name in ('MD5', 'md5'): + raise ValueError("unsupported hash type") + self.name = 'md5' + self.m = self.md5_module.md5() + + def __repr__(self): + return '<%s HASH object @ %#x>' % (self.name, id(self)) + + def copy(self): + import copy + result = copy.copy(self) + result.m = self.m.copy() + return result + + def digest(self): + return self.m.digest() + + def update(self, arg): + return self.m.update(arg) + + def hexdigest(self): + return self.m.hexdigest() + +new = md5obj + +def md5(string=''): + return md5obj('md5', string) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/compat/_scons_io.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/compat/_scons_io.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/compat/_scons_io.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/compat/_scons_io.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,45 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__doc__ = """ +io compatibility module for older (pre-2.6) Python versions + +This does not not NOT (repeat, *NOT*) provide complete io +functionality. It only wraps the portions of io functionality used +by SCons, in an interface that looks enough like io for our purposes. +""" + +__revision__ = "src/engine/SCons/compat/_scons_io.py 2013/03/03 09:48:35 garyo" + +# Use the "imp" module to protect the imports below from fixers. +import imp + +_cStringIO = imp.load_module('cStringIO', *imp.find_module('cStringIO')) +StringIO = _cStringIO.StringIO +del _cStringIO + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/compat/_scons_sets.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/compat/_scons_sets.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/compat/_scons_sets.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/compat/_scons_sets.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,563 @@ +"""Classes to represent arbitrary sets (including sets of sets). + +This module implements sets using dictionaries whose values are +ignored. The usual operations (union, intersection, deletion, etc.) +are provided as both methods and operators. + +Important: sets are not sequences! While they support 'x in s', +'len(s)', and 'for x in s', none of those operations are unique for +sequences; for example, mappings support all three as well. The +characteristic operation for sequences is subscripting with small +integers: s[i], for i in range(len(s)). Sets don't support +subscripting at all. Also, sequences allow multiple occurrences and +their elements have a definite order; sets on the other hand don't +record multiple occurrences and don't remember the order of element +insertion (which is why they don't support s[i]). + +The following classes are provided: + +BaseSet -- All the operations common to both mutable and immutable + sets. This is an abstract class, not meant to be directly + instantiated. + +Set -- Mutable sets, subclass of BaseSet; not hashable. + +ImmutableSet -- Immutable sets, subclass of BaseSet; hashable. + An iterable argument is mandatory to create an ImmutableSet. + +_TemporarilyImmutableSet -- A wrapper around a Set, hashable, + giving the same hash value as the immutable set equivalent + would have. Do not use this class directly. + +Only hashable objects can be added to a Set. In particular, you cannot +really add a Set as an element to another Set; if you try, what is +actually added is an ImmutableSet built from it (it compares equal to +the one you tried adding). + +When you ask if `x in y' where x is a Set and y is a Set or +ImmutableSet, x is wrapped into a _TemporarilyImmutableSet z, and +what's tested is actually `z in y'. + +""" + +# Code history: +# +# - Greg V. Wilson wrote the first version, using a different approach +# to the mutable/immutable problem, and inheriting from dict. +# +# - Alex Martelli modified Greg's version to implement the current +# Set/ImmutableSet approach, and make the data an attribute. +# +# - Guido van Rossum rewrote much of the code, made some API changes, +# and cleaned up the docstrings. +# +# - Raymond Hettinger added a number of speedups and other +# improvements. + +# protect this import from the fixers... +exec('from itertools import ifilterfalse as filterfalse') + +__all__ = ['BaseSet', 'Set', 'ImmutableSet'] + +class BaseSet(object): + """Common base class for mutable and immutable sets.""" + + __slots__ = ['_data'] + + # Constructor + + def __init__(self): + """This is an abstract class.""" + # Don't call this from a concrete subclass! + if self.__class__ is BaseSet: + raise TypeError("BaseSet is an abstract class. " + "Use Set or ImmutableSet.") + + # Standard protocols: __len__, __repr__, __str__, __iter__ + + def __len__(self): + """Return the number of elements of a set.""" + return len(self._data) + + def __repr__(self): + """Return string representation of a set. + + This looks like 'Set([])'. + """ + return self._repr() + + # __str__ is the same as __repr__ + __str__ = __repr__ + + def _repr(self, sort_them=False): + elements = list(self._data.keys()) + if sort_them: + elements.sort() + return '%s(%r)' % (self.__class__.__name__, elements) + + def __iter__(self): + """Return an iterator over the elements or a set. + + This is the keys iterator for the underlying dict. + """ + # Wrapping name in () prevents fixer from "fixing" this + return (self._data.iterkeys)() + + # Three-way comparison is not supported. However, because __eq__ is + # tried before __cmp__, if Set x == Set y, x.__eq__(y) returns True and + # then cmp(x, y) returns 0 (Python doesn't actually call __cmp__ in this + # case). + + def __cmp__(self, other): + raise TypeError("can't compare sets using cmp()") + + # Equality comparisons using the underlying dicts. Mixed-type comparisons + # are allowed here, where Set == z for non-Set z always returns False, + # and Set != z always True. This allows expressions like "x in y" to + # give the expected result when y is a sequence of mixed types, not + # raising a pointless TypeError just because y contains a Set, or x is + # a Set and y contain's a non-set ("in" invokes only __eq__). + # Subtle: it would be nicer if __eq__ and __ne__ could return + # NotImplemented instead of True or False. Then the other comparand + # would get a chance to determine the result, and if the other comparand + # also returned NotImplemented then it would fall back to object address + # comparison (which would always return False for __eq__ and always + # True for __ne__). However, that doesn't work, because this type + # *also* implements __cmp__: if, e.g., __eq__ returns NotImplemented, + # Python tries __cmp__ next, and the __cmp__ here then raises TypeError. + + def __eq__(self, other): + if isinstance(other, BaseSet): + return self._data == other._data + else: + return False + + def __ne__(self, other): + if isinstance(other, BaseSet): + return self._data != other._data + else: + return True + + # Copying operations + + def copy(self): + """Return a shallow copy of a set.""" + result = self.__class__() + result._data.update(self._data) + return result + + __copy__ = copy # For the copy module + + def __deepcopy__(self, memo): + """Return a deep copy of a set; used by copy module.""" + # This pre-creates the result and inserts it in the memo + # early, in case the deep copy recurses into another reference + # to this same set. A set can't be an element of itself, but + # it can certainly contain an object that has a reference to + # itself. + from copy import deepcopy + result = self.__class__() + memo[id(self)] = result + data = result._data + value = True + for elt in self: + data[deepcopy(elt, memo)] = value + return result + + # Standard set operations: union, intersection, both differences. + # Each has an operator version (e.g. __or__, invoked with |) and a + # method version (e.g. union). + # Subtle: Each pair requires distinct code so that the outcome is + # correct when the type of other isn't suitable. For example, if + # we did "union = __or__" instead, then Set().union(3) would return + # NotImplemented instead of raising TypeError (albeit that *why* it + # raises TypeError as-is is also a bit subtle). + + def __or__(self, other): + """Return the union of two sets as a new set. + + (I.e. all elements that are in either set.) + """ + if not isinstance(other, BaseSet): + return NotImplemented + return self.union(other) + + def union(self, other): + """Return the union of two sets as a new set. + + (I.e. all elements that are in either set.) + """ + result = self.__class__(self) + result._update(other) + return result + + def __and__(self, other): + """Return the intersection of two sets as a new set. + + (I.e. all elements that are in both sets.) + """ + if not isinstance(other, BaseSet): + return NotImplemented + return self.intersection(other) + + def intersection(self, other): + """Return the intersection of two sets as a new set. + + (I.e. all elements that are in both sets.) + """ + if not isinstance(other, BaseSet): + other = Set(other) + if len(self) <= len(other): + little, big = self, other + else: + little, big = other, self + common = iter(filter(big._data.has_key, little)) + return self.__class__(common) + + def __xor__(self, other): + """Return the symmetric difference of two sets as a new set. + + (I.e. all elements that are in exactly one of the sets.) + """ + if not isinstance(other, BaseSet): + return NotImplemented + return self.symmetric_difference(other) + + def symmetric_difference(self, other): + """Return the symmetric difference of two sets as a new set. + + (I.e. all elements that are in exactly one of the sets.) + """ + result = self.__class__() + data = result._data + value = True + selfdata = self._data + try: + otherdata = other._data + except AttributeError: + otherdata = Set(other)._data + for elt in filterfalse(otherdata.has_key, selfdata): + data[elt] = value + for elt in filterfalse(selfdata.has_key, otherdata): + data[elt] = value + return result + + def __sub__(self, other): + """Return the difference of two sets as a new Set. + + (I.e. all elements that are in this set and not in the other.) + """ + if not isinstance(other, BaseSet): + return NotImplemented + return self.difference(other) + + def difference(self, other): + """Return the difference of two sets as a new Set. + + (I.e. all elements that are in this set and not in the other.) + """ + result = self.__class__() + data = result._data + try: + otherdata = other._data + except AttributeError: + otherdata = Set(other)._data + value = True + for elt in filterfalse(otherdata.has_key, self): + data[elt] = value + return result + + # Membership test + + def __contains__(self, element): + """Report whether an element is a member of a set. + + (Called in response to the expression `element in self'.) + """ + try: + return element in self._data + except TypeError: + transform = getattr(element, "__as_temporarily_immutable__", None) + if transform is None: + raise # re-raise the TypeError exception we caught + return transform() in self._data + + # Subset and superset test + + def issubset(self, other): + """Report whether another set contains this set.""" + self._binary_sanity_check(other) + if len(self) > len(other): # Fast check for obvious cases + return False + for elt in filterfalse(other._data.has_key, self): + return False + return True + + def issuperset(self, other): + """Report whether this set contains another set.""" + self._binary_sanity_check(other) + if len(self) < len(other): # Fast check for obvious cases + return False + for elt in filterfalse(self._data.has_key, other): + return False + return True + + # Inequality comparisons using the is-subset relation. + __le__ = issubset + __ge__ = issuperset + + def __lt__(self, other): + self._binary_sanity_check(other) + return len(self) < len(other) and self.issubset(other) + + def __gt__(self, other): + self._binary_sanity_check(other) + return len(self) > len(other) and self.issuperset(other) + + # Assorted helpers + + def _binary_sanity_check(self, other): + # Check that the other argument to a binary operation is also + # a set, raising a TypeError otherwise. + if not isinstance(other, BaseSet): + raise TypeError("Binary operation only permitted between sets") + + def _compute_hash(self): + # Calculate hash code for a set by xor'ing the hash codes of + # the elements. This ensures that the hash code does not depend + # on the order in which elements are added to the set. This is + # not called __hash__ because a BaseSet should not be hashable; + # only an ImmutableSet is hashable. + result = 0 + for elt in self: + result ^= hash(elt) + return result + + def _update(self, iterable): + # The main loop for update() and the subclass __init__() methods. + data = self._data + + # Use the fast update() method when a dictionary is available. + if isinstance(iterable, BaseSet): + data.update(iterable._data) + return + + value = True + + if type(iterable) in (list, tuple, xrange): + # Optimized: we know that __iter__() and next() can't + # raise TypeError, so we can move 'try:' out of the loop. + it = iter(iterable) + while True: + try: + for element in it: + data[element] = value + return + except TypeError: + transform = getattr(element, "__as_immutable__", None) + if transform is None: + raise # re-raise the TypeError exception we caught + data[transform()] = value + else: + # Safe: only catch TypeError where intended + for element in iterable: + try: + data[element] = value + except TypeError: + transform = getattr(element, "__as_immutable__", None) + if transform is None: + raise # re-raise the TypeError exception we caught + data[transform()] = value + + +class ImmutableSet(BaseSet): + """Immutable set class.""" + + __slots__ = ['_hashcode'] + + # BaseSet + hashing + + def __init__(self, iterable=None): + """Construct an immutable set from an optional iterable.""" + self._hashcode = None + self._data = {} + if iterable is not None: + self._update(iterable) + + def __hash__(self): + if self._hashcode is None: + self._hashcode = self._compute_hash() + return self._hashcode + + def __getstate__(self): + return self._data, self._hashcode + + def __setstate__(self, state): + self._data, self._hashcode = state + +class Set(BaseSet): + """ Mutable set class.""" + + __slots__ = [] + + # BaseSet + operations requiring mutability; no hashing + + def __init__(self, iterable=None): + """Construct a set from an optional iterable.""" + self._data = {} + if iterable is not None: + self._update(iterable) + + def __getstate__(self): + # getstate's results are ignored if it is not + return self._data, + + def __setstate__(self, data): + self._data, = data + + def __hash__(self): + """A Set cannot be hashed.""" + # We inherit object.__hash__, so we must deny this explicitly + raise TypeError("Can't hash a Set, only an ImmutableSet.") + + # In-place union, intersection, differences. + # Subtle: The xyz_update() functions deliberately return None, + # as do all mutating operations on built-in container types. + # The __xyz__ spellings have to return self, though. + + def __ior__(self, other): + """Update a set with the union of itself and another.""" + self._binary_sanity_check(other) + self._data.update(other._data) + return self + + def union_update(self, other): + """Update a set with the union of itself and another.""" + self._update(other) + + def __iand__(self, other): + """Update a set with the intersection of itself and another.""" + self._binary_sanity_check(other) + self._data = (self & other)._data + return self + + def intersection_update(self, other): + """Update a set with the intersection of itself and another.""" + if isinstance(other, BaseSet): + self &= other + else: + self._data = (self.intersection(other))._data + + def __ixor__(self, other): + """Update a set with the symmetric difference of itself and another.""" + self._binary_sanity_check(other) + self.symmetric_difference_update(other) + return self + + def symmetric_difference_update(self, other): + """Update a set with the symmetric difference of itself and another.""" + data = self._data + value = True + if not isinstance(other, BaseSet): + other = Set(other) + if self is other: + self.clear() + for elt in other: + if elt in data: + del data[elt] + else: + data[elt] = value + + def __isub__(self, other): + """Remove all elements of another set from this set.""" + self._binary_sanity_check(other) + self.difference_update(other) + return self + + def difference_update(self, other): + """Remove all elements of another set from this set.""" + data = self._data + if not isinstance(other, BaseSet): + other = Set(other) + if self is other: + self.clear() + for elt in filter(data.has_key, other): + del data[elt] + + # Python dict-like mass mutations: update, clear + + def update(self, iterable): + """Add all values from an iterable (such as a list or file).""" + self._update(iterable) + + def clear(self): + """Remove all elements from this set.""" + self._data.clear() + + # Single-element mutations: add, remove, discard + + def add(self, element): + """Add an element to a set. + + This has no effect if the element is already present. + """ + try: + self._data[element] = True + except TypeError: + transform = getattr(element, "__as_immutable__", None) + if transform is None: + raise # re-raise the TypeError exception we caught + self._data[transform()] = True + + def remove(self, element): + """Remove an element from a set; it must be a member. + + If the element is not a member, raise a KeyError. + """ + try: + del self._data[element] + except TypeError: + transform = getattr(element, "__as_temporarily_immutable__", None) + if transform is None: + raise # re-raise the TypeError exception we caught + del self._data[transform()] + + def discard(self, element): + """Remove an element from a set if it is a member. + + If the element is not a member, do nothing. + """ + try: + self.remove(element) + except KeyError: + pass + + def pop(self): + """Remove and return an arbitrary set element.""" + return self._data.popitem()[0] + + def __as_immutable__(self): + # Return a copy of self as an immutable set + return ImmutableSet(self) + + def __as_temporarily_immutable__(self): + # Return self wrapped in a temporarily immutable set + return _TemporarilyImmutableSet(self) + + +class _TemporarilyImmutableSet(BaseSet): + # Wrap a mutable set as if it was temporarily immutable. + # This only supplies hashing and equality comparisons. + + def __init__(self, set): + self._set = set + self._data = set._data # Needed by ImmutableSet.__eq__() + + def __hash__(self): + return self._set._compute_hash() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/compat/_scons_subprocess.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/compat/_scons_subprocess.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/compat/_scons_subprocess.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/compat/_scons_subprocess.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,1281 @@ +# subprocess - Subprocesses with accessible I/O streams +# +# For more information about this module, see PEP 324. +# +# This module should remain compatible with Python 2.2, see PEP 291. +# +# Copyright (c) 2003-2005 by Peter Astrand +# +# Licensed to PSF under a Contributor Agreement. +# See http://www.python.org/2.4/license for licensing details. + +r"""subprocess - Subprocesses with accessible I/O streams + +This module allows you to spawn processes, connect to their +input/output/error pipes, and obtain their return codes. This module +intends to replace several other, older modules and functions, like: + +os.system +os.spawn* +os.popen* +popen2.* +commands.* + +Information about how the subprocess module can be used to replace these +modules and functions can be found below. + + + +Using the subprocess module +=========================== +This module defines one class called Popen: + +class Popen(args, bufsize=0, executable=None, + stdin=None, stdout=None, stderr=None, + preexec_fn=None, close_fds=False, shell=False, + cwd=None, env=None, universal_newlines=False, + startupinfo=None, creationflags=0): + + +Arguments are: + +args should be a string, or a sequence of program arguments. The +program to execute is normally the first item in the args sequence or +string, but can be explicitly set by using the executable argument. + +On UNIX, with shell=False (default): In this case, the Popen class +uses os.execvp() to execute the child program. args should normally +be a sequence. A string will be treated as a sequence with the string +as the only item (the program to execute). + +On UNIX, with shell=True: If args is a string, it specifies the +command string to execute through the shell. If args is a sequence, +the first item specifies the command string, and any additional items +will be treated as additional shell arguments. + +On Windows: the Popen class uses CreateProcess() to execute the child +program, which operates on strings. If args is a sequence, it will be +converted to a string using the list2cmdline method. Please note that +not all MS Windows applications interpret the command line the same +way: The list2cmdline is designed for applications using the same +rules as the MS C runtime. + +bufsize, if given, has the same meaning as the corresponding argument +to the built-in open() function: 0 means unbuffered, 1 means line +buffered, any other positive value means use a buffer of +(approximately) that size. A negative bufsize means to use the system +default, which usually means fully buffered. The default value for +bufsize is 0 (unbuffered). + +stdin, stdout and stderr specify the executed programs' standard +input, standard output and standard error file handles, respectively. +Valid values are PIPE, an existing file descriptor (a positive +integer), an existing file object, and None. PIPE indicates that a +new pipe to the child should be created. With None, no redirection +will occur; the child's file handles will be inherited from the +parent. Additionally, stderr can be STDOUT, which indicates that the +stderr data from the applications should be captured into the same +file handle as for stdout. + +If preexec_fn is set to a callable object, this object will be called +in the child process just before the child is executed. + +If close_fds is true, all file descriptors except 0, 1 and 2 will be +closed before the child process is executed. + +if shell is true, the specified command will be executed through the +shell. + +If cwd is not None, the current directory will be changed to cwd +before the child is executed. + +If env is not None, it defines the environment variables for the new +process. + +If universal_newlines is true, the file objects stdout and stderr are +opened as a text files, but lines may be terminated by any of '\n', +the Unix end-of-line convention, '\r', the Macintosh convention or +'\r\n', the Windows convention. All of these external representations +are seen as '\n' by the Python program. Note: This feature is only +available if Python is built with universal newline support (the +default). Also, the newlines attribute of the file objects stdout, +stdin and stderr are not updated by the communicate() method. + +The startupinfo and creationflags, if given, will be passed to the +underlying CreateProcess() function. They can specify things such as +appearance of the main window and priority for the new process. +(Windows only) + + +This module also defines two shortcut functions: + +call(*popenargs, **kwargs): + Run command with arguments. Wait for command to complete, then + return the returncode attribute. + + The arguments are the same as for the Popen constructor. Example: + + retcode = call(["ls", "-l"]) + +check_call(*popenargs, **kwargs): + Run command with arguments. Wait for command to complete. If the + exit code was zero then return, otherwise raise + CalledProcessError. The CalledProcessError object will have the + return code in the returncode attribute. + + The arguments are the same as for the Popen constructor. Example: + + check_call(["ls", "-l"]) + +Exceptions +---------- +Exceptions raised in the child process, before the new program has +started to execute, will be re-raised in the parent. Additionally, +the exception object will have one extra attribute called +'child_traceback', which is a string containing traceback information +from the childs point of view. + +The most common exception raised is OSError. This occurs, for +example, when trying to execute a non-existent file. Applications +should prepare for OSErrors. + +A ValueError will be raised if Popen is called with invalid arguments. + +check_call() will raise CalledProcessError, if the called process +returns a non-zero return code. + + +Security +-------- +Unlike some other popen functions, this implementation will never call +/bin/sh implicitly. This means that all characters, including shell +metacharacters, can safely be passed to child processes. + + +Popen objects +============= +Instances of the Popen class have the following methods: + +poll() + Check if child process has terminated. Returns returncode + attribute. + +wait() + Wait for child process to terminate. Returns returncode attribute. + +communicate(input=None) + Interact with process: Send data to stdin. Read data from stdout + and stderr, until end-of-file is reached. Wait for process to + terminate. The optional stdin argument should be a string to be + sent to the child process, or None, if no data should be sent to + the child. + + communicate() returns a tuple (stdout, stderr). + + Note: The data read is buffered in memory, so do not use this + method if the data size is large or unlimited. + +The following attributes are also available: + +stdin + If the stdin argument is PIPE, this attribute is a file object + that provides input to the child process. Otherwise, it is None. + +stdout + If the stdout argument is PIPE, this attribute is a file object + that provides output from the child process. Otherwise, it is + None. + +stderr + If the stderr argument is PIPE, this attribute is file object that + provides error output from the child process. Otherwise, it is + None. + +pid + The process ID of the child process. + +returncode + The child return code. A None value indicates that the process + hasn't terminated yet. A negative value -N indicates that the + child was terminated by signal N (UNIX only). + + +Replacing older functions with the subprocess module +==================================================== +In this section, "a ==> b" means that b can be used as a replacement +for a. + +Note: All functions in this section fail (more or less) silently if +the executed program cannot be found; this module raises an OSError +exception. + +In the following examples, we assume that the subprocess module is +imported with "from subprocess import *". + + +Replacing /bin/sh shell backquote +--------------------------------- +output=`mycmd myarg` +==> +output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0] + + +Replacing shell pipe line +------------------------- +output=`dmesg | grep hda` +==> +p1 = Popen(["dmesg"], stdout=PIPE) +p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE) +output = p2.communicate()[0] + + +Replacing os.system() +--------------------- +sts = os.system("mycmd" + " myarg") +==> +p = Popen("mycmd" + " myarg", shell=True) +pid, sts = os.waitpid(p.pid, 0) + +Note: + +* Calling the program through the shell is usually not required. + +* It's easier to look at the returncode attribute than the + exitstatus. + +A more real-world example would look like this: + +try: + retcode = call("mycmd" + " myarg", shell=True) + if retcode < 0: + print >>sys.stderr, "Child was terminated by signal", -retcode + else: + print >>sys.stderr, "Child returned", retcode +except OSError, e: + print >>sys.stderr, "Execution failed:", e + + +Replacing os.spawn* +------------------- +P_NOWAIT example: + +pid = os.spawnlp(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg") +==> +pid = Popen(["/bin/mycmd", "myarg"]).pid + + +P_WAIT example: + +retcode = os.spawnlp(os.P_WAIT, "/bin/mycmd", "mycmd", "myarg") +==> +retcode = call(["/bin/mycmd", "myarg"]) + + +Vector example: + +os.spawnvp(os.P_NOWAIT, path, args) +==> +Popen([path] + args[1:]) + + +Environment example: + +os.spawnlpe(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg", env) +==> +Popen(["/bin/mycmd", "myarg"], env={"PATH": "/usr/bin"}) + + +Replacing os.popen* +------------------- +pipe = os.popen(cmd, mode='r', bufsize) +==> +pipe = Popen(cmd, shell=True, bufsize=bufsize, stdout=PIPE).stdout + +pipe = os.popen(cmd, mode='w', bufsize) +==> +pipe = Popen(cmd, shell=True, bufsize=bufsize, stdin=PIPE).stdin + + +(child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize) +==> +p = Popen(cmd, shell=True, bufsize=bufsize, + stdin=PIPE, stdout=PIPE, close_fds=True) +(child_stdin, child_stdout) = (p.stdin, p.stdout) + + +(child_stdin, + child_stdout, + child_stderr) = os.popen3(cmd, mode, bufsize) +==> +p = Popen(cmd, shell=True, bufsize=bufsize, + stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) +(child_stdin, + child_stdout, + child_stderr) = (p.stdin, p.stdout, p.stderr) + + +(child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize) +==> +p = Popen(cmd, shell=True, bufsize=bufsize, + stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) +(child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout) + + +Replacing popen2.* +------------------ +Note: If the cmd argument to popen2 functions is a string, the command +is executed through /bin/sh. If it is a list, the command is directly +executed. + +(child_stdout, child_stdin) = popen2.popen2("somestring", bufsize, mode) +==> +p = Popen(["somestring"], shell=True, bufsize=bufsize + stdin=PIPE, stdout=PIPE, close_fds=True) +(child_stdout, child_stdin) = (p.stdout, p.stdin) + + +(child_stdout, child_stdin) = popen2.popen2(["mycmd", "myarg"], bufsize, mode) +==> +p = Popen(["mycmd", "myarg"], bufsize=bufsize, + stdin=PIPE, stdout=PIPE, close_fds=True) +(child_stdout, child_stdin) = (p.stdout, p.stdin) + +The popen2.Popen3 and popen3.Popen4 basically works as subprocess.Popen, +except that: + +* subprocess.Popen raises an exception if the execution fails +* the capturestderr argument is replaced with the stderr argument. +* stdin=PIPE and stdout=PIPE must be specified. +* popen2 closes all filedescriptors by default, but you have to specify + close_fds=True with subprocess.Popen. + + +""" + +import sys +mswindows = (sys.platform == "win32") + +import os +import types +import traceback + +# Exception classes used by this module. +class CalledProcessError(Exception): + """This exception is raised when a process run by check_call() returns + a non-zero exit status. The exit status will be stored in the + returncode attribute.""" + def __init__(self, returncode, cmd): + self.returncode = returncode + self.cmd = cmd + def __str__(self): + return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode) + + +if mswindows: + try: + import threading + except ImportError: + # SCons: the threading module is only used by the communicate() + # method, which we don't actually use, so don't worry if we + # can't import it. + pass + import msvcrt + try: + # Try to get _subprocess + from _subprocess import * + class STARTUPINFO(object): + dwFlags = 0 + hStdInput = None + hStdOutput = None + hStdError = None + wShowWindow = 0 + class pywintypes(object): + error = IOError + except ImportError: + # If not there, then drop back to requiring pywin32 + # TODO: Should this be wrapped in try as well? To notify user to install + # pywin32 ? With URL to it? + import pywintypes + from win32api import GetStdHandle, STD_INPUT_HANDLE, \ + STD_OUTPUT_HANDLE, STD_ERROR_HANDLE + from win32api import GetCurrentProcess, DuplicateHandle, \ + GetModuleFileName, GetVersion + from win32con import DUPLICATE_SAME_ACCESS, SW_HIDE + from win32pipe import CreatePipe + from win32process import CreateProcess, STARTUPINFO, \ + GetExitCodeProcess, STARTF_USESTDHANDLES, \ + STARTF_USESHOWWINDOW, CREATE_NEW_CONSOLE + from win32event import WaitForSingleObject, INFINITE, WAIT_OBJECT_0 + + +else: + import select + import errno + import fcntl + import pickle + + try: + fcntl.F_GETFD + except AttributeError: + fcntl.F_GETFD = 1 + + try: + fcntl.F_SETFD + except AttributeError: + fcntl.F_SETFD = 2 + +__all__ = ["Popen", "PIPE", "STDOUT", "call", "check_call", "CalledProcessError"] + +try: + MAXFD = os.sysconf("SC_OPEN_MAX") +except KeyboardInterrupt: + raise # SCons: don't swallow keyboard interrupts +except: + MAXFD = 256 + +try: + isinstance(1, int) +except TypeError: + def is_int(obj): + return isinstance(obj, type(1)) + def is_int_or_long(obj): + return type(obj) in (type(1), type(1L)) +else: + def is_int(obj): + return isinstance(obj, int) + def is_int_or_long(obj): + return isinstance(obj, (int, long)) + +try: + types.StringTypes +except AttributeError: + try: + types.StringTypes = (str, unicode) + except NameError: + types.StringTypes = (str,) +def is_string(obj): + return isinstance(obj, types.StringTypes) + +_active = [] + +def _cleanup(): + for inst in _active[:]: + if inst.poll(_deadstate=sys.maxsize) >= 0: + try: + _active.remove(inst) + except ValueError: + # This can happen if two threads create a new Popen instance. + # It's harmless that it was already removed, so ignore. + pass + +PIPE = -1 +STDOUT = -2 + + +def call(*popenargs, **kwargs): + """Run command with arguments. Wait for command to complete, then + return the returncode attribute. + + The arguments are the same as for the Popen constructor. Example: + + retcode = call(["ls", "-l"]) + """ + return apply(Popen, popenargs, kwargs).wait() + + +def check_call(*popenargs, **kwargs): + """Run command with arguments. Wait for command to complete. If + the exit code was zero then return, otherwise raise + CalledProcessError. The CalledProcessError object will have the + return code in the returncode attribute. + + The arguments are the same as for the Popen constructor. Example: + + check_call(["ls", "-l"]) + """ + retcode = call(*popenargs, **kwargs) + cmd = kwargs.get("args") + if cmd is None: + cmd = popenargs[0] + if retcode: + raise CalledProcessError(retcode, cmd) + return retcode + + +def list2cmdline(seq): + """ + Translate a sequence of arguments into a command line + string, using the same rules as the MS C runtime: + + 1) Arguments are delimited by white space, which is either a + space or a tab. + + 2) A string surrounded by double quotation marks is + interpreted as a single argument, regardless of white space + contained within. A quoted string can be embedded in an + argument. + + 3) A double quotation mark preceded by a backslash is + interpreted as a literal double quotation mark. + + 4) Backslashes are interpreted literally, unless they + immediately precede a double quotation mark. + + 5) If backslashes immediately precede a double quotation mark, + every pair of backslashes is interpreted as a literal + backslash. If the number of backslashes is odd, the last + backslash escapes the next double quotation mark as + described in rule 3. + """ + + # See + # http://msdn.microsoft.com/library/en-us/vccelng/htm/progs_12.asp + result = [] + needquote = False + for arg in seq: + bs_buf = [] + + # Add a space to separate this argument from the others + if result: + result.append(' ') + + needquote = (" " in arg) or ("\t" in arg) + if needquote: + result.append('"') + + for c in arg: + if c == '\\': + # Don't know if we need to double yet. + bs_buf.append(c) + elif c == '"': + # Double backspaces. + result.append('\\' * len(bs_buf)*2) + bs_buf = [] + result.append('\\"') + else: + # Normal char + if bs_buf: + result.extend(bs_buf) + bs_buf = [] + result.append(c) + + # Add remaining backspaces, if any. + if bs_buf: + result.extend(bs_buf) + + if needquote: + result.extend(bs_buf) + result.append('"') + + return ''.join(result) + +class Popen(object): + def __init__(self, args, bufsize=0, executable=None, + stdin=None, stdout=None, stderr=None, + preexec_fn=None, close_fds=False, shell=False, + cwd=None, env=None, universal_newlines=False, + startupinfo=None, creationflags=0): + """Create new Popen instance.""" + _cleanup() + + self._child_created = False + if not is_int_or_long(bufsize): + raise TypeError("bufsize must be an integer") + + if mswindows: + if preexec_fn is not None: + raise ValueError("preexec_fn is not supported on Windows " + "platforms") + if close_fds: + raise ValueError("close_fds is not supported on Windows " + "platforms") + else: + # POSIX + if startupinfo is not None: + raise ValueError("startupinfo is only supported on Windows " + "platforms") + if creationflags != 0: + raise ValueError("creationflags is only supported on Windows " + "platforms") + + self.stdin = None + self.stdout = None + self.stderr = None + self.pid = None + self.returncode = None + self.universal_newlines = universal_newlines + + # Input and output objects. The general principle is like + # this: + # + # Parent Child + # ------ ----- + # p2cwrite ---stdin---> p2cread + # c2pread <--stdout--- c2pwrite + # errread <--stderr--- errwrite + # + # On POSIX, the child objects are file descriptors. On + # Windows, these are Windows file handles. The parent objects + # are file descriptors on both platforms. The parent objects + # are None when not using PIPEs. The child objects are None + # when not redirecting. + + (p2cread, p2cwrite, + c2pread, c2pwrite, + errread, errwrite) = self._get_handles(stdin, stdout, stderr) + + self._execute_child(args, executable, preexec_fn, close_fds, + cwd, env, universal_newlines, + startupinfo, creationflags, shell, + p2cread, p2cwrite, + c2pread, c2pwrite, + errread, errwrite) + + if p2cwrite: + self.stdin = os.fdopen(p2cwrite, 'wb', bufsize) + if c2pread: + if universal_newlines: + self.stdout = os.fdopen(c2pread, 'rU', bufsize) + else: + self.stdout = os.fdopen(c2pread, 'rb', bufsize) + if errread: + if universal_newlines: + self.stderr = os.fdopen(errread, 'rU', bufsize) + else: + self.stderr = os.fdopen(errread, 'rb', bufsize) + + + def _translate_newlines(self, data): + data = data.replace("\r\n", "\n") + data = data.replace("\r", "\n") + return data + + + def __del__(self): + if not self._child_created: + # We didn't get to successfully create a child process. + return + # In case the child hasn't been waited on, check if it's done. + self.poll(_deadstate=sys.maxsize) + if self.returncode is None and _active is not None: + # Child is still running, keep us alive until we can wait on it. + _active.append(self) + + + def communicate(self, input=None): + """Interact with process: Send data to stdin. Read data from + stdout and stderr, until end-of-file is reached. Wait for + process to terminate. The optional input argument should be a + string to be sent to the child process, or None, if no data + should be sent to the child. + + communicate() returns a tuple (stdout, stderr).""" + + # Optimization: If we are only using one pipe, or no pipe at + # all, using select() or threads is unnecessary. + if [self.stdin, self.stdout, self.stderr].count(None) >= 2: + stdout = None + stderr = None + if self.stdin: + if input: + self.stdin.write(input) + self.stdin.close() + elif self.stdout: + stdout = self.stdout.read() + elif self.stderr: + stderr = self.stderr.read() + self.wait() + return (stdout, stderr) + + return self._communicate(input) + + + if mswindows: + # + # Windows methods + # + def _get_handles(self, stdin, stdout, stderr): + """Construct and return tupel with IO objects: + p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite + """ + if stdin is None and stdout is None and stderr is None: + return (None, None, None, None, None, None) + + p2cread, p2cwrite = None, None + c2pread, c2pwrite = None, None + errread, errwrite = None, None + + if stdin is None: + p2cread = GetStdHandle(STD_INPUT_HANDLE) + elif stdin == PIPE: + p2cread, p2cwrite = CreatePipe(None, 0) + # Detach and turn into fd + p2cwrite = p2cwrite.Detach() + p2cwrite = msvcrt.open_osfhandle(p2cwrite, 0) + elif is_int(stdin): + p2cread = msvcrt.get_osfhandle(stdin) + else: + # Assuming file-like object + p2cread = msvcrt.get_osfhandle(stdin.fileno()) + p2cread = self._make_inheritable(p2cread) + + if stdout is None: + c2pwrite = GetStdHandle(STD_OUTPUT_HANDLE) + elif stdout == PIPE: + c2pread, c2pwrite = CreatePipe(None, 0) + # Detach and turn into fd + c2pread = c2pread.Detach() + c2pread = msvcrt.open_osfhandle(c2pread, 0) + elif is_int(stdout): + c2pwrite = msvcrt.get_osfhandle(stdout) + else: + # Assuming file-like object + c2pwrite = msvcrt.get_osfhandle(stdout.fileno()) + c2pwrite = self._make_inheritable(c2pwrite) + + if stderr is None: + errwrite = GetStdHandle(STD_ERROR_HANDLE) + elif stderr == PIPE: + errread, errwrite = CreatePipe(None, 0) + # Detach and turn into fd + errread = errread.Detach() + errread = msvcrt.open_osfhandle(errread, 0) + elif stderr == STDOUT: + errwrite = c2pwrite + elif is_int(stderr): + errwrite = msvcrt.get_osfhandle(stderr) + else: + # Assuming file-like object + errwrite = msvcrt.get_osfhandle(stderr.fileno()) + errwrite = self._make_inheritable(errwrite) + + return (p2cread, p2cwrite, + c2pread, c2pwrite, + errread, errwrite) + + + def _make_inheritable(self, handle): + """Return a duplicate of handle, which is inheritable""" + return DuplicateHandle(GetCurrentProcess(), handle, + GetCurrentProcess(), 0, 1, + DUPLICATE_SAME_ACCESS) + + + def _find_w9xpopen(self): + """Find and return absolut path to w9xpopen.exe""" + w9xpopen = os.path.join(os.path.dirname(GetModuleFileName(0)), + "w9xpopen.exe") + if not os.path.exists(w9xpopen): + # Eeek - file-not-found - possibly an embedding + # situation - see if we can locate it in sys.exec_prefix + w9xpopen = os.path.join(os.path.dirname(sys.exec_prefix), + "w9xpopen.exe") + if not os.path.exists(w9xpopen): + raise RuntimeError("Cannot locate w9xpopen.exe, which is " + "needed for Popen to work with your " + "shell or platform.") + return w9xpopen + + + def _execute_child(self, args, executable, preexec_fn, close_fds, + cwd, env, universal_newlines, + startupinfo, creationflags, shell, + p2cread, p2cwrite, + c2pread, c2pwrite, + errread, errwrite): + """Execute program (MS Windows version)""" + + if not isinstance(args, types.StringTypes): + args = list2cmdline(args) + + # Process startup details + if startupinfo is None: + startupinfo = STARTUPINFO() + if None not in (p2cread, c2pwrite, errwrite): + startupinfo.dwFlags = startupinfo.dwFlags | STARTF_USESTDHANDLES + startupinfo.hStdInput = p2cread + startupinfo.hStdOutput = c2pwrite + startupinfo.hStdError = errwrite + + if shell: + startupinfo.dwFlags = startupinfo.dwFlags | STARTF_USESHOWWINDOW + startupinfo.wShowWindow = SW_HIDE + comspec = os.environ.get("COMSPEC", "cmd.exe") + args = comspec + " /c " + args + if (GetVersion() >= 0x80000000L or + os.path.basename(comspec).lower() == "command.com"): + # Win9x, or using command.com on NT. We need to + # use the w9xpopen intermediate program. For more + # information, see KB Q150956 + # (http://web.archive.org/web/20011105084002/http://support.microsoft.com/support/kb/articles/Q150/9/56.asp) + w9xpopen = self._find_w9xpopen() + args = '"%s" %s' % (w9xpopen, args) + # Not passing CREATE_NEW_CONSOLE has been known to + # cause random failures on win9x. Specifically a + # dialog: "Your program accessed mem currently in + # use at xxx" and a hopeful warning about the + # stability of your system. Cost is Ctrl+C wont + # kill children. + creationflags = creationflags | CREATE_NEW_CONSOLE + + # Start the process + try: + hp, ht, pid, tid = CreateProcess(executable, args, + # no special security + None, None, + # must inherit handles to pass std + # handles + 1, + creationflags, + env, + cwd, + startupinfo) + except pywintypes.error, e: + # Translate pywintypes.error to WindowsError, which is + # a subclass of OSError. FIXME: We should really + # translate errno using _sys_errlist (or simliar), but + # how can this be done from Python? + raise WindowsError(*e.args) + + # Retain the process handle, but close the thread handle + self._child_created = True + self._handle = hp + self.pid = pid + ht.Close() + + # Child is launched. Close the parent's copy of those pipe + # handles that only the child should have open. You need + # to make sure that no handles to the write end of the + # output pipe are maintained in this process or else the + # pipe will not close when the child process exits and the + # ReadFile will hang. + if p2cread is not None: + p2cread.Close() + if c2pwrite is not None: + c2pwrite.Close() + if errwrite is not None: + errwrite.Close() + + + def poll(self, _deadstate=None): + """Check if child process has terminated. Returns returncode + attribute.""" + if self.returncode is None: + if WaitForSingleObject(self._handle, 0) == WAIT_OBJECT_0: + self.returncode = GetExitCodeProcess(self._handle) + return self.returncode + + + def wait(self): + """Wait for child process to terminate. Returns returncode + attribute.""" + if self.returncode is None: + obj = WaitForSingleObject(self._handle, INFINITE) + self.returncode = GetExitCodeProcess(self._handle) + return self.returncode + + + def _readerthread(self, fh, buffer): + buffer.append(fh.read()) + + + def _communicate(self, input): + stdout = None # Return + stderr = None # Return + + if self.stdout: + stdout = [] + stdout_thread = threading.Thread(target=self._readerthread, + args=(self.stdout, stdout)) + stdout_thread.setDaemon(True) + stdout_thread.start() + if self.stderr: + stderr = [] + stderr_thread = threading.Thread(target=self._readerthread, + args=(self.stderr, stderr)) + stderr_thread.setDaemon(True) + stderr_thread.start() + + if self.stdin: + if input is not None: + self.stdin.write(input) + self.stdin.close() + + if self.stdout: + stdout_thread.join() + if self.stderr: + stderr_thread.join() + + # All data exchanged. Translate lists into strings. + if stdout is not None: + stdout = stdout[0] + if stderr is not None: + stderr = stderr[0] + + # Translate newlines, if requested. We cannot let the file + # object do the translation: It is based on stdio, which is + # impossible to combine with select (unless forcing no + # buffering). + if self.universal_newlines and hasattr(file, 'newlines'): + if stdout: + stdout = self._translate_newlines(stdout) + if stderr: + stderr = self._translate_newlines(stderr) + + self.wait() + return (stdout, stderr) + + else: + # + # POSIX methods + # + def _get_handles(self, stdin, stdout, stderr): + """Construct and return tupel with IO objects: + p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite + """ + p2cread, p2cwrite = None, None + c2pread, c2pwrite = None, None + errread, errwrite = None, None + + if stdin is None: + pass + elif stdin == PIPE: + p2cread, p2cwrite = os.pipe() + elif is_int(stdin): + p2cread = stdin + else: + # Assuming file-like object + p2cread = stdin.fileno() + + if stdout is None: + pass + elif stdout == PIPE: + c2pread, c2pwrite = os.pipe() + elif is_int(stdout): + c2pwrite = stdout + else: + # Assuming file-like object + c2pwrite = stdout.fileno() + + if stderr is None: + pass + elif stderr == PIPE: + errread, errwrite = os.pipe() + elif stderr == STDOUT: + errwrite = c2pwrite + elif is_int(stderr): + errwrite = stderr + else: + # Assuming file-like object + errwrite = stderr.fileno() + + return (p2cread, p2cwrite, + c2pread, c2pwrite, + errread, errwrite) + + + def _set_cloexec_flag(self, fd): + try: + cloexec_flag = fcntl.FD_CLOEXEC + except AttributeError: + cloexec_flag = 1 + + old = fcntl.fcntl(fd, fcntl.F_GETFD) + fcntl.fcntl(fd, fcntl.F_SETFD, old | cloexec_flag) + + + def _close_fds(self, but): + for i in range(3, MAXFD): + if i == but: + continue + try: + os.close(i) + except KeyboardInterrupt: + raise # SCons: don't swallow keyboard interrupts + except: + pass + + + def _execute_child(self, args, executable, preexec_fn, close_fds, + cwd, env, universal_newlines, + startupinfo, creationflags, shell, + p2cread, p2cwrite, + c2pread, c2pwrite, + errread, errwrite): + """Execute program (POSIX version)""" + + if is_string(args): + args = [args] + + if shell: + args = ["/bin/sh", "-c"] + args + + if executable is None: + executable = args[0] + + # For transferring possible exec failure from child to parent + # The first char specifies the exception type: 0 means + # OSError, 1 means some other error. + errpipe_read, errpipe_write = os.pipe() + self._set_cloexec_flag(errpipe_write) + + self.pid = os.fork() + self._child_created = True + if self.pid == 0: + # Child + try: + # Close parent's pipe ends + if p2cwrite: + os.close(p2cwrite) + if c2pread: + os.close(c2pread) + if errread: + os.close(errread) + os.close(errpipe_read) + + # Dup fds for child + if p2cread: + os.dup2(p2cread, 0) + if c2pwrite: + os.dup2(c2pwrite, 1) + if errwrite: + os.dup2(errwrite, 2) + + # Close pipe fds. Make sure we don't close the same + # fd more than once, or standard fds. + try: + set + except NameError: + # Fall-back for earlier Python versions, so epydoc + # can use this module directly to execute things. + if p2cread: + os.close(p2cread) + if c2pwrite and c2pwrite not in (p2cread,): + os.close(c2pwrite) + if errwrite and errwrite not in (p2cread, c2pwrite): + os.close(errwrite) + else: + for fd in set((p2cread, c2pwrite, errwrite))-set((0,1,2)): + if fd: os.close(fd) + + # Close all other fds, if asked for + if close_fds: + self._close_fds(but=errpipe_write) + + if cwd is not None: + os.chdir(cwd) + + if preexec_fn: + apply(preexec_fn) + + if env is None: + os.execvp(executable, args) + else: + os.execvpe(executable, args, env) + + except KeyboardInterrupt: + raise # SCons: don't swallow keyboard interrupts + + except: + exc_type, exc_value, tb = sys.exc_info() + # Save the traceback and attach it to the exception object + exc_lines = traceback.format_exception(exc_type, + exc_value, + tb) + exc_value.child_traceback = ''.join(exc_lines) + os.write(errpipe_write, pickle.dumps(exc_value)) + + # This exitcode won't be reported to applications, so it + # really doesn't matter what we return. + os._exit(255) + + # Parent + os.close(errpipe_write) + if p2cread and p2cwrite: + os.close(p2cread) + if c2pwrite and c2pread: + os.close(c2pwrite) + if errwrite and errread: + os.close(errwrite) + + # Wait for exec to fail or succeed; possibly raising exception + data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB + os.close(errpipe_read) + if data != "": + os.waitpid(self.pid, 0) + child_exception = pickle.loads(data) + raise child_exception + + + def _handle_exitstatus(self, sts): + if os.WIFSIGNALED(sts): + self.returncode = -os.WTERMSIG(sts) + elif os.WIFEXITED(sts): + self.returncode = os.WEXITSTATUS(sts) + else: + # Should never happen + raise RuntimeError("Unknown child exit status!") + + + def poll(self, _deadstate=None): + """Check if child process has terminated. Returns returncode + attribute.""" + if self.returncode is None: + try: + pid, sts = os.waitpid(self.pid, os.WNOHANG) + if pid == self.pid: + self._handle_exitstatus(sts) + except os.error: + if _deadstate is not None: + self.returncode = _deadstate + return self.returncode + + + def wait(self): + """Wait for child process to terminate. Returns returncode + attribute.""" + if self.returncode is None: + pid, sts = os.waitpid(self.pid, 0) + self._handle_exitstatus(sts) + return self.returncode + + + def _communicate(self, input): + read_set = [] + write_set = [] + stdout = None # Return + stderr = None # Return + + if self.stdin: + # Flush stdio buffer. This might block, if the user has + # been writing to .stdin in an uncontrolled fashion. + self.stdin.flush() + if input: + write_set.append(self.stdin) + else: + self.stdin.close() + if self.stdout: + read_set.append(self.stdout) + stdout = [] + if self.stderr: + read_set.append(self.stderr) + stderr = [] + + input_offset = 0 + while read_set or write_set: + rlist, wlist, xlist = select.select(read_set, write_set, []) + + if self.stdin in wlist: + # When select has indicated that the file is writable, + # we can write up to PIPE_BUF bytes without risk + # blocking. POSIX defines PIPE_BUF >= 512 + m = memoryview(input)[input_offset:input_offset+512] + bytes_written = os.write(self.stdin.fileno(), m) + input_offset = input_offset + bytes_written + if input_offset >= len(input): + self.stdin.close() + write_set.remove(self.stdin) + + if self.stdout in rlist: + data = os.read(self.stdout.fileno(), 1024) + if data == "": + self.stdout.close() + read_set.remove(self.stdout) + stdout.append(data) + + if self.stderr in rlist: + data = os.read(self.stderr.fileno(), 1024) + if data == "": + self.stderr.close() + read_set.remove(self.stderr) + stderr.append(data) + + # All data exchanged. Translate lists into strings. + if stdout is not None: + stdout = ''.join(stdout) + if stderr is not None: + stderr = ''.join(stderr) + + # Translate newlines, if requested. We cannot let the file + # object do the translation: It is based on stdio, which is + # impossible to combine with select (unless forcing no + # buffering). + if self.universal_newlines and hasattr(file, 'newlines'): + if stdout: + stdout = self._translate_newlines(stdout) + if stderr: + stderr = self._translate_newlines(stderr) + + self.wait() + return (stdout, stderr) + + +def _demo_posix(): + # + # Example 1: Simple redirection: Get process list + # + plist = Popen(["ps"], stdout=PIPE).communicate()[0] + print "Process list:" + print plist + + # + # Example 2: Change uid before executing child + # + if os.getuid() == 0: + p = Popen(["id"], preexec_fn=lambda: os.setuid(100)) + p.wait() + + # + # Example 3: Connecting several subprocesses + # + print "Looking for 'hda'..." + p1 = Popen(["dmesg"], stdout=PIPE) + p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE) + print repr(p2.communicate()[0]) + + # + # Example 4: Catch execution error + # + print + print "Trying a weird file..." + try: + print Popen(["/this/path/does/not/exist"]).communicate() + except OSError, e: + if e.errno == errno.ENOENT: + print "The file didn't exist. I thought so..." + print "Child traceback:" + print e.child_traceback + else: + print "Error", e.errno + else: + sys.stderr.write( "Gosh. No error.\n" ) + + +def _demo_windows(): + # + # Example 1: Connecting several subprocesses + # + print "Looking for 'PROMPT' in set output..." + p1 = Popen("set", stdout=PIPE, shell=True) + p2 = Popen('find "PROMPT"', stdin=p1.stdout, stdout=PIPE) + print repr(p2.communicate()[0]) + + # + # Example 2: Simple execution of program + # + print "Executing calc..." + p = Popen("calc") + p.wait() + + +if __name__ == "__main__": + if mswindows: + _demo_windows() + else: + _demo_posix() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/cpp.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/cpp.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/cpp.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/cpp.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,589 @@ +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/cpp.py 2013/03/03 09:48:35 garyo" + +__doc__ = """ +SCons C Pre-Processor module +""" +#TODO 2.3 and before has no sorted() +import SCons.compat + +import os +import re + +# +# First "subsystem" of regular expressions that we set up: +# +# Stuff to turn the C preprocessor directives in a file's contents into +# a list of tuples that we can process easily. +# + +# A table of regular expressions that fetch the arguments from the rest of +# a C preprocessor line. Different directives have different arguments +# that we want to fetch, using the regular expressions to which the lists +# of preprocessor directives map. +cpp_lines_dict = { + # Fetch the rest of a #if/#elif/#ifdef/#ifndef as one argument, + # separated from the keyword by white space. + ('if', 'elif', 'ifdef', 'ifndef',) + : '\s+(.+)', + + # Fetch the rest of a #import/#include/#include_next line as one + # argument, with white space optional. + ('import', 'include', 'include_next',) + : '\s*(.+)', + + # We don't care what comes after a #else or #endif line. + ('else', 'endif',) : '', + + # Fetch three arguments from a #define line: + # 1) The #defined keyword. + # 2) The optional parentheses and arguments (if it's a function-like + # macro, '' if it's not). + # 3) The expansion value. + ('define',) : '\s+([_A-Za-z][_A-Za-z0-9_]*)(\([^)]*\))?\s*(.*)', + + # Fetch the #undefed keyword from a #undef line. + ('undef',) : '\s+([_A-Za-z][A-Za-z0-9_]*)', +} + +# Create a table that maps each individual C preprocessor directive to +# the corresponding compiled regular expression that fetches the arguments +# we care about. +Table = {} +for op_list, expr in cpp_lines_dict.items(): + e = re.compile(expr) + for op in op_list: + Table[op] = e +del e +del op +del op_list + +# Create a list of the expressions we'll use to match all of the +# preprocessor directives. These are the same as the directives +# themselves *except* that we must use a negative lookahead assertion +# when matching "if" so it doesn't match the "if" in "ifdef." +override = { + 'if' : 'if(?!def)', +} +l = [override.get(x, x) for x in Table.keys()] + + +# Turn the list of expressions into one big honkin' regular expression +# that will match all the preprocessor lines at once. This will return +# a list of tuples, one for each preprocessor line. The preprocessor +# directive will be the first element in each tuple, and the rest of +# the line will be the second element. +e = '^\s*#\s*(' + '|'.join(l) + ')(.*)$' + +# And last but not least, compile the expression. +CPP_Expression = re.compile(e, re.M) + + + + +# +# Second "subsystem" of regular expressions that we set up: +# +# Stuff to translate a C preprocessor expression (as found on a #if or +# #elif line) into an equivalent Python expression that we can eval(). +# + +# A dictionary that maps the C representation of Boolean operators +# to their Python equivalents. +CPP_to_Python_Ops_Dict = { + '!' : ' not ', + '!=' : ' != ', + '&&' : ' and ', + '||' : ' or ', + '?' : ' and ', + ':' : ' or ', + '\r' : '', +} + +CPP_to_Python_Ops_Sub = lambda m: CPP_to_Python_Ops_Dict[m.group(0)] + +# We have to sort the keys by length so that longer expressions +# come *before* shorter expressions--in particular, "!=" must +# come before "!" in the alternation. Without this, the Python +# re module, as late as version 2.2.2, empirically matches the +# "!" in "!=" first, instead of finding the longest match. +# What's up with that? +l = sorted(CPP_to_Python_Ops_Dict.keys(), key=lambda a: len(a), reverse=True) + +# Turn the list of keys into one regular expression that will allow us +# to substitute all of the operators at once. +expr = '|'.join(map(re.escape, l)) + +# ...and compile the expression. +CPP_to_Python_Ops_Expression = re.compile(expr) + +# A separate list of expressions to be evaluated and substituted +# sequentially, not all at once. +CPP_to_Python_Eval_List = [ + ['defined\s+(\w+)', '"\\1" in __dict__'], + ['defined\s*\((\w+)\)', '"\\1" in __dict__'], + ['/\*.*\*/', ''], + ['/\*.*', ''], + ['//.*', ''], + ['(0x[0-9A-Fa-f]*)[UL]+', '\\1'], +] + +# Replace the string representations of the regular expressions in the +# list with compiled versions. +for l in CPP_to_Python_Eval_List: + l[0] = re.compile(l[0]) + +# Wrap up all of the above into a handy function. +def CPP_to_Python(s): + """ + Converts a C pre-processor expression into an equivalent + Python expression that can be evaluated. + """ + s = CPP_to_Python_Ops_Expression.sub(CPP_to_Python_Ops_Sub, s) + for expr, repl in CPP_to_Python_Eval_List: + s = expr.sub(repl, s) + return s + + + +del expr +del l +del override + + + +class FunctionEvaluator(object): + """ + Handles delayed evaluation of a #define function call. + """ + def __init__(self, name, args, expansion): + """ + Squirrels away the arguments and expansion value of a #define + macro function for later evaluation when we must actually expand + a value that uses it. + """ + self.name = name + self.args = function_arg_separator.split(args) + try: + expansion = expansion.split('##') + except AttributeError: + pass + self.expansion = expansion + def __call__(self, *values): + """ + Evaluates the expansion of a #define macro function called + with the specified values. + """ + if len(self.args) != len(values): + raise ValueError("Incorrect number of arguments to `%s'" % self.name) + # Create a dictionary that maps the macro arguments to the + # corresponding values in this "call." We'll use this when we + # eval() the expansion so that arguments will get expanded to + # the right values. + locals = {} + for k, v in zip(self.args, values): + locals[k] = v + + parts = [] + for s in self.expansion: + if not s in self.args: + s = repr(s) + parts.append(s) + statement = ' + '.join(parts) + + return eval(statement, globals(), locals) + + + +# Find line continuations. +line_continuations = re.compile('\\\\\r?\n') + +# Search for a "function call" macro on an expansion. Returns the +# two-tuple of the "function" name itself, and a string containing the +# arguments within the call parentheses. +function_name = re.compile('(\S+)\(([^)]*)\)') + +# Split a string containing comma-separated function call arguments into +# the separate arguments. +function_arg_separator = re.compile(',\s*') + + + +class PreProcessor(object): + """ + The main workhorse class for handling C pre-processing. + """ + def __init__(self, current=os.curdir, cpppath=(), dict={}, all=0): + global Table + + cpppath = tuple(cpppath) + + self.searchpath = { + '"' : (current,) + cpppath, + '<' : cpppath + (current,), + } + + # Initialize our C preprocessor namespace for tracking the + # values of #defined keywords. We use this namespace to look + # for keywords on #ifdef/#ifndef lines, and to eval() the + # expressions on #if/#elif lines (after massaging them from C to + # Python). + self.cpp_namespace = dict.copy() + self.cpp_namespace['__dict__'] = self.cpp_namespace + + if all: + self.do_include = self.all_include + + # For efficiency, a dispatch table maps each C preprocessor + # directive (#if, #define, etc.) to the method that should be + # called when we see it. We accomodate state changes (#if, + # #ifdef, #ifndef) by pushing the current dispatch table on a + # stack and changing what method gets called for each relevant + # directive we might see next at this level (#else, #elif). + # #endif will simply pop the stack. + d = { + 'scons_current_file' : self.scons_current_file + } + for op in Table.keys(): + d[op] = getattr(self, 'do_' + op) + self.default_table = d + + # Controlling methods. + + def tupleize(self, contents): + """ + Turns the contents of a file into a list of easily-processed + tuples describing the CPP lines in the file. + + The first element of each tuple is the line's preprocessor + directive (#if, #include, #define, etc., minus the initial '#'). + The remaining elements are specific to the type of directive, as + pulled apart by the regular expression. + """ + global CPP_Expression, Table + contents = line_continuations.sub('', contents) + cpp_tuples = CPP_Expression.findall(contents) + return [(m[0],) + Table[m[0]].match(m[1]).groups() for m in cpp_tuples] + + def __call__(self, file): + """ + Pre-processes a file. + + This is the main public entry point. + """ + self.current_file = file + return self.process_contents(self.read_file(file), file) + + def process_contents(self, contents, fname=None): + """ + Pre-processes a file contents. + + This is the main internal entry point. + """ + self.stack = [] + self.dispatch_table = self.default_table.copy() + self.current_file = fname + self.tuples = self.tupleize(contents) + + self.initialize_result(fname) + while self.tuples: + t = self.tuples.pop(0) + # Uncomment to see the list of tuples being processed (e.g., + # to validate the CPP lines are being translated correctly). + #print t + self.dispatch_table[t[0]](t) + return self.finalize_result(fname) + + # Dispatch table stack manipulation methods. + + def save(self): + """ + Pushes the current dispatch table on the stack and re-initializes + the current dispatch table to the default. + """ + self.stack.append(self.dispatch_table) + self.dispatch_table = self.default_table.copy() + + def restore(self): + """ + Pops the previous dispatch table off the stack and makes it the + current one. + """ + try: self.dispatch_table = self.stack.pop() + except IndexError: pass + + # Utility methods. + + def do_nothing(self, t): + """ + Null method for when we explicitly want the action for a + specific preprocessor directive to do nothing. + """ + pass + + def scons_current_file(self, t): + self.current_file = t[1] + + def eval_expression(self, t): + """ + Evaluates a C preprocessor expression. + + This is done by converting it to a Python equivalent and + eval()ing it in the C preprocessor namespace we use to + track #define values. + """ + t = CPP_to_Python(' '.join(t[1:])) + try: return eval(t, self.cpp_namespace) + except (NameError, TypeError): return 0 + + def initialize_result(self, fname): + self.result = [fname] + + def finalize_result(self, fname): + return self.result[1:] + + def find_include_file(self, t): + """ + Finds the #include file for a given preprocessor tuple. + """ + fname = t[2] + for d in self.searchpath[t[1]]: + if d == os.curdir: + f = fname + else: + f = os.path.join(d, fname) + if os.path.isfile(f): + return f + return None + + def read_file(self, file): + return open(file).read() + + # Start and stop processing include lines. + + def start_handling_includes(self, t=None): + """ + Causes the PreProcessor object to start processing #import, + #include and #include_next lines. + + This method will be called when a #if, #ifdef, #ifndef or #elif + evaluates True, or when we reach the #else in a #if, #ifdef, + #ifndef or #elif block where a condition already evaluated + False. + + """ + d = self.dispatch_table + d['import'] = self.do_import + d['include'] = self.do_include + d['include_next'] = self.do_include + + def stop_handling_includes(self, t=None): + """ + Causes the PreProcessor object to stop processing #import, + #include and #include_next lines. + + This method will be called when a #if, #ifdef, #ifndef or #elif + evaluates False, or when we reach the #else in a #if, #ifdef, + #ifndef or #elif block where a condition already evaluated True. + """ + d = self.dispatch_table + d['import'] = self.do_nothing + d['include'] = self.do_nothing + d['include_next'] = self.do_nothing + + # Default methods for handling all of the preprocessor directives. + # (Note that what actually gets called for a given directive at any + # point in time is really controlled by the dispatch_table.) + + def _do_if_else_condition(self, condition): + """ + Common logic for evaluating the conditions on #if, #ifdef and + #ifndef lines. + """ + self.save() + d = self.dispatch_table + if condition: + self.start_handling_includes() + d['elif'] = self.stop_handling_includes + d['else'] = self.stop_handling_includes + else: + self.stop_handling_includes() + d['elif'] = self.do_elif + d['else'] = self.start_handling_includes + + def do_ifdef(self, t): + """ + Default handling of a #ifdef line. + """ + self._do_if_else_condition(t[1] in self.cpp_namespace) + + def do_ifndef(self, t): + """ + Default handling of a #ifndef line. + """ + self._do_if_else_condition(t[1] not in self.cpp_namespace) + + def do_if(self, t): + """ + Default handling of a #if line. + """ + self._do_if_else_condition(self.eval_expression(t)) + + def do_elif(self, t): + """ + Default handling of a #elif line. + """ + d = self.dispatch_table + if self.eval_expression(t): + self.start_handling_includes() + d['elif'] = self.stop_handling_includes + d['else'] = self.stop_handling_includes + + def do_else(self, t): + """ + Default handling of a #else line. + """ + pass + + def do_endif(self, t): + """ + Default handling of a #endif line. + """ + self.restore() + + def do_define(self, t): + """ + Default handling of a #define line. + """ + _, name, args, expansion = t + try: + expansion = int(expansion) + except (TypeError, ValueError): + pass + if args: + evaluator = FunctionEvaluator(name, args[1:-1], expansion) + self.cpp_namespace[name] = evaluator + else: + self.cpp_namespace[name] = expansion + + def do_undef(self, t): + """ + Default handling of a #undef line. + """ + try: del self.cpp_namespace[t[1]] + except KeyError: pass + + def do_import(self, t): + """ + Default handling of a #import line. + """ + # XXX finish this -- maybe borrow/share logic from do_include()...? + pass + + def do_include(self, t): + """ + Default handling of a #include line. + """ + t = self.resolve_include(t) + include_file = self.find_include_file(t) + if include_file: + #print "include_file =", include_file + self.result.append(include_file) + contents = self.read_file(include_file) + new_tuples = [('scons_current_file', include_file)] + \ + self.tupleize(contents) + \ + [('scons_current_file', self.current_file)] + self.tuples[:] = new_tuples + self.tuples + + # Date: Tue, 22 Nov 2005 20:26:09 -0500 + # From: Stefan Seefeld + # + # By the way, #include_next is not the same as #include. The difference + # being that #include_next starts its search in the path following the + # path that let to the including file. In other words, if your system + # include paths are ['/foo', '/bar'], and you are looking at a header + # '/foo/baz.h', it might issue an '#include_next ' which would + # correctly resolve to '/bar/baz.h' (if that exists), but *not* see + # '/foo/baz.h' again. See http://www.delorie.com/gnu/docs/gcc/cpp_11.html + # for more reasoning. + # + # I have no idea in what context 'import' might be used. + + # XXX is #include_next really the same as #include ? + do_include_next = do_include + + # Utility methods for handling resolution of include files. + + def resolve_include(self, t): + """Resolve a tuple-ized #include line. + + This handles recursive expansion of values without "" or <> + surrounding the name until an initial " or < is found, to handle + #include FILE + where FILE is a #define somewhere else. + """ + s = t[1] + while not s[0] in '<"': + #print "s =", s + try: + s = self.cpp_namespace[s] + except KeyError: + m = function_name.search(s) + s = self.cpp_namespace[m.group(1)] + if callable(s): + args = function_arg_separator.split(m.group(2)) + s = s(*args) + if not s: + return None + return (t[0], s[0], s[1:-1]) + + def all_include(self, t): + """ + """ + self.result.append(self.resolve_include(t)) + +class DumbPreProcessor(PreProcessor): + """A preprocessor that ignores all #if/#elif/#else/#endif directives + and just reports back *all* of the #include files (like the classic + SCons scanner did). + + This is functionally equivalent to using a regular expression to + find all of the #include lines, only slower. It exists mainly as + an example of how the main PreProcessor class can be sub-classed + to tailor its behavior. + """ + def __init__(self, *args, **kw): + PreProcessor.__init__(self, *args, **kw) + d = self.default_table + for func in ['if', 'elif', 'else', 'endif', 'ifdef', 'ifndef']: + d[func] = d[func] = self.do_nothing + +del __revision__ + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/dblite.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/dblite.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/dblite.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/dblite.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,254 @@ +# dblite.py module contributed by Ralf W. Grosse-Kunstleve. +# Extended for Unicode by Steven Knight. + +import SCons.compat + +import builtins +import os +# compat layer imports "cPickle" for us if it's available. +import pickle +import shutil +import time + +keep_all_files = 00000 +ignore_corrupt_dbfiles = 0 + +def corruption_warning(filename): + print "Warning: Discarding corrupt database:", filename + +try: unicode +except NameError: + def is_string(s): + return isinstance(s, str) +else: + def is_string(s): + return type(s) in (str, unicode) + +try: + unicode('a') +except NameError: + def unicode(s): return s + +dblite_suffix = '.dblite' +tmp_suffix = '.tmp' + +class dblite(object): + + # Squirrel away references to the functions in various modules + # that we'll use when our __del__() method calls our sync() method + # during shutdown. We might get destroyed when Python is in the midst + # of tearing down the different modules we import in an essentially + # arbitrary order, and some of the various modules's global attributes + # may already be wiped out from under us. + # + # See the discussion at: + # http://mail.python.org/pipermail/python-bugs-list/2003-March/016877.html + + _open = builtins.open + _pickle_dump = staticmethod(pickle.dump) + _os_chmod = os.chmod + try: + _os_chown = os.chown + except AttributeError: + _os_chown = None + _os_rename = os.rename + _os_unlink = os.unlink + _shutil_copyfile = shutil.copyfile + _time_time = time.time + + def __init__(self, file_base_name, flag, mode): + assert flag in (None, "r", "w", "c", "n") + if (flag is None): flag = "r" + base, ext = os.path.splitext(file_base_name) + if ext == dblite_suffix: + # There's already a suffix on the file name, don't add one. + self._file_name = file_base_name + self._tmp_name = base + tmp_suffix + else: + self._file_name = file_base_name + dblite_suffix + self._tmp_name = file_base_name + tmp_suffix + self._flag = flag + self._mode = mode + self._dict = {} + self._needs_sync = 00000 + if self._os_chown is not None and (os.geteuid()==0 or os.getuid()==0): + # running as root; chown back to current owner/group when done + try: + statinfo = os.stat(self._file_name) + self._chown_to = statinfo.st_uid + self._chgrp_to = statinfo.st_gid + except OSError, e: + # db file doesn't exist yet. + # Check os.environ for SUDO_UID, use if set + self._chown_to = int(os.environ.get('SUDO_UID', -1)) + self._chgrp_to = int(os.environ.get('SUDO_GID', -1)) + else: + self._chown_to = -1 # don't chown + self._chgrp_to = -1 # don't chgrp + if (self._flag == "n"): + self._open(self._file_name, "wb", self._mode) + else: + try: + f = self._open(self._file_name, "rb") + except IOError, e: + if (self._flag != "c"): + raise e + self._open(self._file_name, "wb", self._mode) + else: + p = f.read() + if (len(p) > 0): + try: + self._dict = pickle.loads(p) + except (pickle.UnpicklingError, EOFError): + if (ignore_corrupt_dbfiles == 0): raise + if (ignore_corrupt_dbfiles == 1): + corruption_warning(self._file_name) + + def close(self): + if (self._needs_sync): + self.sync() + + def __del__(self): + self.close() + + def sync(self): + self._check_writable() + f = self._open(self._tmp_name, "wb", self._mode) + self._pickle_dump(self._dict, f, 1) + f.close() + # Windows doesn't allow renaming if the file exists, so unlink + # it first, chmod'ing it to make sure we can do so. On UNIX, we + # may not be able to chmod the file if it's owned by someone else + # (e.g. from a previous run as root). We should still be able to + # unlink() the file if the directory's writable, though, so ignore + # any OSError exception thrown by the chmod() call. + try: self._os_chmod(self._file_name, 0777) + except OSError: pass + self._os_unlink(self._file_name) + self._os_rename(self._tmp_name, self._file_name) + if self._os_chown is not None and self._chown_to > 0: # don't chown to root or -1 + try: + self._os_chown(self._file_name, self._chown_to, self._chgrp_to) + except OSError: + pass + self._needs_sync = 00000 + if (keep_all_files): + self._shutil_copyfile( + self._file_name, + self._file_name + "_" + str(int(self._time_time()))) + + def _check_writable(self): + if (self._flag == "r"): + raise IOError("Read-only database: %s" % self._file_name) + + def __getitem__(self, key): + return self._dict[key] + + def __setitem__(self, key, value): + self._check_writable() + if (not is_string(key)): + raise TypeError("key `%s' must be a string but is %s" % (key, type(key))) + if (not is_string(value)): + raise TypeError("value `%s' must be a string but is %s" % (value, type(value))) + self._dict[key] = value + self._needs_sync = 0001 + + def keys(self): + return list(self._dict.keys()) + + def has_key(self, key): + return key in self._dict + + def __contains__(self, key): + return key in self._dict + + def iterkeys(self): + # Wrapping name in () prevents fixer from "fixing" this + return (self._dict.iterkeys)() + + __iter__ = iterkeys + + def __len__(self): + return len(self._dict) + +def open(file, flag=None, mode=0666): + return dblite(file, flag, mode) + +def _exercise(): + db = open("tmp", "n") + assert len(db) == 0 + db["foo"] = "bar" + assert db["foo"] == "bar" + db[unicode("ufoo")] = unicode("ubar") + assert db[unicode("ufoo")] == unicode("ubar") + db.sync() + db = open("tmp", "c") + assert len(db) == 2, len(db) + assert db["foo"] == "bar" + db["bar"] = "foo" + assert db["bar"] == "foo" + db[unicode("ubar")] = unicode("ufoo") + assert db[unicode("ubar")] == unicode("ufoo") + db.sync() + db = open("tmp", "r") + assert len(db) == 4, len(db) + assert db["foo"] == "bar" + assert db["bar"] == "foo" + assert db[unicode("ufoo")] == unicode("ubar") + assert db[unicode("ubar")] == unicode("ufoo") + try: + db.sync() + except IOError, e: + assert str(e) == "Read-only database: tmp.dblite" + else: + raise RuntimeError("IOError expected.") + db = open("tmp", "w") + assert len(db) == 4 + db["ping"] = "pong" + db.sync() + try: + db[(1,2)] = "tuple" + except TypeError, e: + assert str(e) == "key `(1, 2)' must be a string but is ", str(e) + else: + raise RuntimeError("TypeError exception expected") + try: + db["list"] = [1,2] + except TypeError, e: + assert str(e) == "value `[1, 2]' must be a string but is ", str(e) + else: + raise RuntimeError("TypeError exception expected") + db = open("tmp", "r") + assert len(db) == 5 + db = open("tmp", "n") + assert len(db) == 0 + dblite._open("tmp.dblite", "w") + db = open("tmp", "r") + dblite._open("tmp.dblite", "w").write("x") + try: + db = open("tmp", "r") + except pickle.UnpicklingError: + pass + else: + raise RuntimeError("pickle exception expected.") + global ignore_corrupt_dbfiles + ignore_corrupt_dbfiles = 2 + db = open("tmp", "r") + assert len(db) == 0 + os.unlink("tmp.dblite") + try: + db = open("tmp", "w") + except IOError, e: + assert str(e) == "[Errno 2] No such file or directory: 'tmp.dblite'", str(e) + else: + raise RuntimeError("IOError expected.") + print "OK" + +if (__name__ == "__main__"): + _exercise() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/SCons/exitfuncs.py mapnik-2.2.0/scons/scons-local-2.3.0/SCons/exitfuncs.py --- mapnik-2.1.0/scons/scons-local-2.3.0/SCons/exitfuncs.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/SCons/exitfuncs.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,64 @@ +"""SCons.exitfuncs + +Register functions which are executed when SCons exits for any reason. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation +# +# 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. +# + +__revision__ = "src/engine/SCons/exitfuncs.py 2013/03/03 09:48:35 garyo" + + +import atexit + +_exithandlers = [] +def _run_exitfuncs(): + """run any registered exit functions + + _exithandlers is traversed in reverse order so functions are executed + last in, first out. + """ + + while _exithandlers: + func, targs, kargs = _exithandlers.pop() + func(*targs, **kargs) + +def register(func, *targs, **kargs): + """register a function to be executed upon normal program termination + + func - function to be called at exit + targs - optional arguments to pass to func + kargs - optional keyword arguments to pass to func + """ + _exithandlers.append((func, targs, kargs)) + + +# make our exit function get run by python when it exits +atexit.register(_run_exitfuncs) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff -Nru mapnik-2.1.0/scons/scons-local-2.3.0/scons-2.3.0.egg-info mapnik-2.2.0/scons/scons-local-2.3.0/scons-2.3.0.egg-info --- mapnik-2.1.0/scons/scons-local-2.3.0/scons-2.3.0.egg-info 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/scons/scons-local-2.3.0/scons-2.3.0.egg-info 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,13 @@ +Metadata-Version: 1.0 +Name: scons +Version: 2.3.0 +Summary: Open Source next-generation build tool. +Home-page: http://www.scons.org/ +Author: Steven Knight +Author-email: knight@baldmt.com +License: UNKNOWN +Description: Open Source next-generation build tool. + Improved, cross-platform substitute for the classic Make + utility. In short, SCons is an easier, more reliable + and faster way to build software. +Platform: UNKNOWN diff -Nru mapnik-2.1.0/scons/scons-time.py mapnik-2.2.0/scons/scons-time.py --- mapnik-2.1.0/scons/scons-time.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons-time.py 2013-06-04 01:35:27.000000000 +0000 @@ -9,7 +9,7 @@ # # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -32,7 +32,7 @@ from __future__ import division from __future__ import nested_scopes -__revision__ = "src/script/scons-time.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" +__revision__ = "src/script/scons-time.py 2013/03/03 09:48:35 garyo" import getopt import glob diff -Nru mapnik-2.1.0/scons/scons.py mapnik-2.2.0/scons/scons.py --- mapnik-2.1.0/scons/scons.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/scons.py 2013-06-04 01:35:27.000000000 +0000 @@ -2,7 +2,7 @@ # # SCons - a Software Constructor # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -23,15 +23,15 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "src/script/scons.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" +__revision__ = "src/script/scons.py 2013/03/03 09:48:35 garyo" -__version__ = "2.2.0" +__version__ = "2.3.0" -__build__ = "issue-2856:2676:d23b7a2f45e8[MODIFIED]" +__build__ = "" -__buildsys__ = "oberbrunner-dev" +__buildsys__ = "reepicheep" -__date__ = "2012/08/05 15:38:28" +__date__ = "2013/03/03 09:48:35" __developer__ = "garyo" @@ -55,18 +55,12 @@ # engine modules if they're in either directory. -# Check to see if the python version is > 3.0 which is currently unsupported -# If so exit with error message -try: - if sys.version_info >= (3,0,0): - msg = "scons: *** SCons version %s does not run under Python version %s.\n\ -Python 3.0 and later are not yet supported.\n" - sys.stderr.write(msg % (__version__, sys.version.split()[0])) - sys.exit(1) -except AttributeError: - # Pre-1.6 Python has no sys.version_info - # No need to check version as we then know the version is < 3.0.0 and supported - pass +if sys.version_info >= (3,0,0): + msg = "scons: *** SCons version %s does not run under Python version %s.\n\ +Python 3 is not yet supported.\n" + sys.stderr.write(msg % (__version__, sys.version.split()[0])) + sys.exit(1) + script_dir = sys.path[0] @@ -184,7 +178,15 @@ ############################################################################## if __name__ == "__main__": - import SCons.Script + try: + import SCons.Script + except: + ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', 'engine') + if os.path.exists(ROOT): + sys.path += [ROOT] + print("SCons import failed. Trying to run from source directory") + import SCons.Script + # this does all the work, and calls sys.exit # with the proper exit status when done. SCons.Script.main() diff -Nru mapnik-2.1.0/scons/sconsign.py mapnik-2.2.0/scons/sconsign.py --- mapnik-2.1.0/scons/sconsign.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/scons/sconsign.py 2013-06-04 01:35:27.000000000 +0000 @@ -2,7 +2,7 @@ # # SCons - a Software Constructor # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -23,15 +23,15 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "src/script/sconsign.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" +__revision__ = "src/script/sconsign.py 2013/03/03 09:48:35 garyo" -__version__ = "2.2.0" +__version__ = "2.3.0" -__build__ = "issue-2856:2676:d23b7a2f45e8[MODIFIED]" +__build__ = "" -__buildsys__ = "oberbrunner-dev" +__buildsys__ = "reepicheep" -__date__ = "2012/08/05 15:38:28" +__date__ = "2013/03/03 09:48:35" __developer__ = "garyo" diff -Nru mapnik-2.1.0/src/agg/agg_renderer.cpp mapnik-2.2.0/src/agg/agg_renderer.cpp --- mapnik-2.1.0/src/agg/agg_renderer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/agg/agg_renderer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,8 +26,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -36,8 +38,9 @@ #include #include #include -#include +#include #include +#include #include #include @@ -53,7 +56,6 @@ #include "agg_image_accessors.h" #include "agg_span_image_filter_rgba.h" // boost -#include #include #include @@ -62,32 +64,6 @@ namespace mapnik { -class pattern_source : private boost::noncopyable -{ -public: - pattern_source(image_data_32 const& pattern) - : pattern_(pattern) {} - - unsigned int width() const - { - return pattern_.width(); - } - unsigned int height() const - { - return pattern_.height(); - } - agg::rgba8 pixel(int x, int y) const - { - unsigned c = pattern_(x,y); - return agg::rgba8(c & 0xff, - (c >> 8) & 0xff, - (c >> 16) & 0xff, - (c >> 24) & 0xff); - } -private: - image_data_32 const& pattern_; -}; - template agg_renderer::agg_renderer(Map const& m, T & pixmap, double scale_factor, unsigned offset_x, unsigned offset_y) @@ -103,7 +79,32 @@ font_engine_(), font_manager_(font_engine_), detector_(boost::make_shared(box2d(-m.buffer_size(), -m.buffer_size(), m.width() + m.buffer_size() ,m.height() + m.buffer_size()))), - ras_ptr(new rasterizer) + ras_ptr(new rasterizer), + query_extent_(), + gamma_method_(GAMMA_POWER), + gamma_(1.0) +{ + setup(m); +} + +template +agg_renderer::agg_renderer(Map const& m, request const& req, T & pixmap, double scale_factor, unsigned offset_x, unsigned offset_y) + : feature_style_processor(m, scale_factor), + pixmap_(pixmap), + internal_buffer_(), + current_buffer_(&pixmap), + style_level_compositing_(false), + width_(pixmap_.width()), + height_(pixmap_.height()), + scale_factor_(scale_factor), + t_(req.width(),req.height(),req.extent(),offset_x,offset_y), + font_engine_(), + font_manager_(font_engine_), + detector_(boost::make_shared(box2d(-req.buffer_size(), -req.buffer_size(), req.width() + req.buffer_size() ,req.height() + req.buffer_size()))), + ras_ptr(new rasterizer), + query_extent_(), + gamma_method_(GAMMA_POWER), + gamma_(1.0) { setup(m); } @@ -123,7 +124,10 @@ font_engine_(), font_manager_(font_engine_), detector_(detector), - ras_ptr(new rasterizer) + ras_ptr(new rasterizer), + query_extent_(), + gamma_method_(GAMMA_POWER), + gamma_(1.0) { setup(m); } @@ -132,12 +136,25 @@ void agg_renderer::setup(Map const &m) { boost::optional const& bg = m.background(); - if (bg) pixmap_.set_background(*bg); + if (bg) + { + if (bg->alpha() < 255) + { + mapnik::color bg_color = *bg; + bg_color.premultiply(); + pixmap_.set_background(bg_color); + } + else + { + pixmap_.set_background(*bg); + } + } boost::optional const& image_filename = m.background_image(); if (image_filename) { - boost::optional bg_marker = mapnik::marker_cache::instance()->find(*image_filename,true); + // NOTE: marker_cache returns premultiplied image, if needed + boost::optional bg_marker = mapnik::marker_cache::instance().find(*image_filename,true); if (bg_marker && (*bg_marker)->is_bitmap()) { mapnik::image_ptr bg_image = *(*bg_marker)->get_bitmap_data(); @@ -152,17 +169,12 @@ { for (unsigned y=0;y -void agg_renderer::render_marker(pixel_position const& pos, marker const& marker, agg::trans_affine const& tr, - double opacity, composite_mode_e comp_op) +void agg_renderer::render_marker(pixel_position const& pos, + marker const& marker, + agg::trans_affine const& tr, + double opacity, + composite_mode_e comp_op) { typedef agg::rgba8 color_type; typedef agg::order_rgba order_type; @@ -300,9 +303,15 @@ typedef agg::pixfmt_custom_blend_rgba pixfmt_comp_type; typedef agg::renderer_base renderer_base; typedef agg::renderer_scanline_aa_solid renderer_type; + typedef agg::pod_bvector svg_attribute_type; ras_ptr->reset(); - ras_ptr->gamma(agg::gamma_power()); + if (gamma_method_ != GAMMA_POWER || gamma_ != 1.0) + { + ras_ptr->gamma(agg::gamma_power()); + gamma_method_ = GAMMA_POWER; + gamma_ = 1.0; + } agg::scanline_u8 sl; agg::rendering_buffer buf(current_buffer_->raw_data(), width_, height_, width_ * 4); pixfmt_comp_type pixf(buf); @@ -323,10 +332,10 @@ using namespace mapnik::svg; vertex_stl_adapter stl_storage((*marker.get_vector_data())->source()); svg_path_adapter svg_path(stl_storage); - svg_renderer, + svg_renderer_agg svg_renderer(svg_path, + pixfmt_comp_type> svg_renderer(svg_path, (*marker.get_vector_data())->attributes()); svg_renderer.render(*ras_ptr, sl, renb, mtx, opacity, bbox); @@ -335,11 +344,10 @@ { double width = (*marker.get_bitmap_data())->width(); double height = (*marker.get_bitmap_data())->height(); - double cx = 0.5 * width; - double cy = 0.5 * height; - if (std::fabs(1.0 - scale_factor_) < 0.001 && tr.is_identity()) { + double cx = 0.5 * width; + double cy = 0.5 * height; composite(current_buffer_->data(), **marker.get_bitmap_data(), comp_op, opacity, boost::math::iround(pos.x - cx), @@ -384,7 +392,7 @@ src.width(), src.height(), src.width()*4); - agg::pixfmt_rgba32_pre pixf(marker_buf); + agg::pixfmt_rgba32_pre marker_pixf(marker_buf); typedef agg::image_accessor_clone img_accessor_type; typedef agg::span_interpolator_linear interpolator_type; typedef agg::span_image_filter_rgba_2x2, span_gen_type> renderer_type; - img_accessor_type ia(pixf); + img_accessor_type ia(marker_pixf); interpolator_type interpolator(agg::trans_affine(p, 0, 0, width, height) ); span_gen_type sg(ia, interpolator, filter); renderer_type rp(renb,sa, sg, unsigned(opacity*255)); diff -Nru mapnik-2.1.0/src/agg/process_building_symbolizer.cpp mapnik-2.2.0/src/agg/process_building_symbolizer.cpp --- mapnik-2.1.0/src/agg/process_building_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/agg/process_building_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,14 +22,20 @@ // mapnik #include +#include #include #include #include #include +#include +#include // boost #include +// stl +#include + // agg #include "agg_basics.h" #include "agg_rendering_buffer.h" @@ -64,13 +70,18 @@ agg::scanline_u8 sl; ras_ptr->reset(); - ras_ptr->gamma(agg::gamma_power()); + if (gamma_method_ != GAMMA_POWER || gamma_ != 1.0) + { + ras_ptr->gamma(agg::gamma_power()); + gamma_method_ = GAMMA_POWER; + gamma_ = 1.0; + } double height = 0.0; expression_ptr height_expr = sym.height(); if (height_expr) { - value_type result = boost::apply_visitor(evaluate(feature), *height_expr); + value_type result = boost::apply_visitor(evaluate(feature), *height_expr); height = result.to_double() * scale_factor_; } @@ -93,11 +104,15 @@ { frame->move_to(x,y); } - else if (cm == SEG_LINETO || cm == SEG_CLOSE) + else if (cm == SEG_LINETO) { frame->line_to(x,y); face_segments.push_back(segment_t(x0,y0,x,y)); } + else if (cm == SEG_CLOSE) + { + frame->close_path(); + } x0 = x; y0 = y; } @@ -134,18 +149,23 @@ frame->move_to(x,y+height); roof->move_to(x,y+height); } - else if (cm == SEG_LINETO || cm == SEG_CLOSE) + else if (cm == SEG_LINETO) { frame->line_to(x,y+height); roof->line_to(x,y+height); } + else if (cm == SEG_CLOSE) + { + frame->close_path(); + roof->close_path(); + } } path_type path(t_,*frame,prj_trans); agg::conv_stroke stroke(path); stroke.width(scale_factor_); ras_ptr->add_path(stroke); - ren.color(agg::rgba8(int(r*0.8), int(g*0.8), int(b*0.8), int(255 * sym.get_opacity()))); + ren.color(agg::rgba8(int(r*0.8), int(g*0.8), int(b*0.8), int(a * sym.get_opacity()))); agg::render_scanlines(*ras_ptr, sl, ren); ras_ptr->reset(); diff -Nru mapnik-2.1.0/src/agg/process_debug_symbolizer.cpp mapnik-2.2.0/src/agg/process_debug_symbolizer.cpp --- mapnik-2.1.0/src/agg/process_debug_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/agg/process_debug_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,93 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include +#include +#include +#include + +namespace mapnik { + +void draw_rect(image_32 &pixmap, box2d const& box) +{ + int x0 = static_cast(box.minx()); + int x1 = static_cast(box.maxx()); + int y0 = static_cast(box.miny()); + int y1 = static_cast(box.maxy()); + unsigned color1 = 0xff0000ff; + for (int x=x0; x +void agg_renderer::process(debug_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans) +{ + debug_symbolizer_mode_e mode = sym.get_mode(); + if (mode == DEBUG_SYM_MODE_COLLISION) + { + label_collision_detector4::query_iterator itr = detector_->begin(), end = detector_->end(); + for (;itr!=end; itr++) + { + draw_rect(pixmap_, itr->box); + } + } + else if (mode == DEBUG_SYM_MODE_VERTEX) + { + for (unsigned i=0; i::process(debug_symbolizer const&, + mapnik::feature_impl &, + proj_transform const&); +} + diff -Nru mapnik-2.1.0/src/agg/process_line_pattern_symbolizer.cpp mapnik-2.2.0/src/agg/process_line_pattern_symbolizer.cpp --- mapnik-2.1.0/src/agg/process_line_pattern_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/agg/process_line_pattern_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -20,19 +20,20 @@ * *****************************************************************************/ -// boost -#include // mapnik +#include #include #include #include #include #include -#include #include #include #include #include +#include +#include + // agg #include "agg_basics.h" #include "agg_rendering_buffer.h" @@ -47,6 +48,39 @@ #include "agg_renderer_outline_image.h" #include "agg_conv_clip_polyline.h" +// boost +#include + +namespace { + +class pattern_source : private mapnik::noncopyable +{ +public: + pattern_source(mapnik::image_data_32 const& pattern) + : pattern_(pattern) {} + + unsigned int width() const + { + return pattern_.width(); + } + unsigned int height() const + { + return pattern_.height(); + } + agg::rgba8 pixel(int x, int y) const + { + unsigned c = pattern_(x,y); + return agg::rgba8(c & 0xff, + (c >> 8) & 0xff, + (c >> 16) & 0xff, + (c >> 24) & 0xff); + } +private: + mapnik::image_data_32 const& pattern_; +}; + +} + namespace mapnik { template @@ -67,7 +101,7 @@ std::string filename = path_processor_type::evaluate( *sym.get_filename(), feature); - boost::optional mark = marker_cache::instance()->find(filename,true); + boost::optional mark = marker_cache::instance().find(filename,true); if (!mark) return; if (!(*mark)->is_bitmap()) @@ -99,23 +133,21 @@ if (sym.clip()) { double padding = (double)(query_extent_.width()/pixmap_.width()); - float half_stroke = (*mark)->width()/2.0; + double half_stroke = (*mark)->width()/2.0; if (half_stroke > 1) padding *= half_stroke; - double x0 = query_extent_.minx(); - double y0 = query_extent_.miny(); - double x1 = query_extent_.maxx(); - double y1 = query_extent_.maxy(); - clipping_extent.init(x0 - padding, y0 - padding, x1 + padding , y1 + padding); + padding *= scale_factor_; + clipping_extent.pad(padding); } - typedef boost::mpl::vector conv_types; + typedef boost::mpl::vector conv_types; vertex_converter, rasterizer_type, line_pattern_symbolizer, CoordTransform, proj_transform, agg::trans_affine, conv_types> converter(clipping_extent,ras,sym,t_,prj_trans,tr,scale_factor_); if (sym.clip()) converter.set(); //optional clip (default: true) converter.set(); //always transform + if (sym.simplify_tolerance() > 0.0) converter.set(); // optional simplify converter if (sym.smooth() > 0.0) converter.set(); // optional smooth converter BOOST_FOREACH(geometry_type & geom, feature.paths()) diff -Nru mapnik-2.1.0/src/agg/process_line_symbolizer.cpp mapnik-2.2.0/src/agg/process_line_symbolizer.cpp --- mapnik-2.1.0/src/agg/process_line_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/agg/process_line_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,6 +21,7 @@ *****************************************************************************/ // mapnik +#include #include #include #include @@ -47,6 +48,7 @@ // stl #include +#include namespace mapnik { @@ -64,7 +66,12 @@ unsigned a=col.alpha(); ras_ptr->reset(); - set_gamma_method(stroke_, ras_ptr); + if (stroke_.get_gamma() != gamma_ || stroke_.get_gamma_method() != gamma_method_) + { + set_gamma_method(stroke_, ras_ptr); + gamma_method_ = stroke_.get_gamma_method(); + gamma_ = stroke_.get_gamma(); + } agg::rendering_buffer buf(current_buffer_->raw_data(),width_,height_, width_ * 4); @@ -76,7 +83,7 @@ typedef agg::renderer_base renderer_base; typedef boost::mpl::vector conv_types; + simplify_tag, smooth_tag, dash_tag, stroke_tag> conv_types; pixfmt_comp_type pixf(buf); pixf.comp_op(static_cast(sym.comp_op())); @@ -89,18 +96,16 @@ if (sym.clip()) { double padding = (double)(query_extent_.width()/pixmap_.width()); - float half_stroke = stroke_.get_width()/2.0; + double half_stroke = stroke_.get_width()/2.0; if (half_stroke > 1) padding *= half_stroke; - if (fabs(sym.offset()) > 0) - padding *= fabs(sym.offset()) * 1.2; - double x0 = query_extent_.minx(); - double y0 = query_extent_.miny(); - double x1 = query_extent_.maxx(); - double y1 = query_extent_.maxy(); - clipping_extent.init(x0 - padding, y0 - padding, x1 + padding , y1 + padding); + if (std::fabs(sym.offset()) > 0) + padding *= std::fabs(sym.offset()) * 1.2; + padding *= scale_factor_; + clipping_extent.pad(padding); // debugging - //box2d inverse(x0 + padding, y0 + padding, x1 - padding , y1 - padding); + //box2d inverse = query_extent_; + //inverse.pad(-padding); //draw_geo_extent(inverse,mapnik::color("red")); } @@ -108,9 +113,7 @@ { typedef agg::renderer_outline_aa renderer_type; typedef agg::rasterizer_outline_aa rasterizer_type; - // need to reduce width by half to match standard rasterizer look - double scaled = scale_factor_ * .5; - agg::line_profile_aa profile(stroke_.get_width() * scaled, agg::gamma_power(stroke_.get_gamma())); + agg::line_profile_aa profile(stroke_.get_width() * scale_factor_, agg::gamma_power(stroke_.get_gamma())); renderer_type ren(renb, profile); ren.color(agg::rgba8_pre(r, g, b, int(a*stroke_.get_opacity()))); rasterizer_type ras(ren); @@ -118,14 +121,13 @@ vertex_converter, rasterizer_type, line_symbolizer, CoordTransform, proj_transform, agg::trans_affine, conv_types> - converter(clipping_extent,ras,sym,t_,prj_trans,tr,scaled); + converter(clipping_extent,ras,sym,t_,prj_trans,tr,scale_factor_); if (sym.clip()) converter.set(); // optional clip (default: true) converter.set(); // always transform - if (fabs(sym.offset()) > 0.0) converter.set(); // parallel offset + if (std::fabs(sym.offset()) > 0.0) converter.set(); // parallel offset converter.set(); // optional affine transform + if (sym.simplify_tolerance() > 0.0) converter.set(); // optional simplify converter if (sym.smooth() > 0.0) converter.set(); // optional smooth converter - if (stroke_.has_dash()) converter.set(); - converter.set(); //always stroke BOOST_FOREACH( geometry_type & geom, feature.paths()) { @@ -143,8 +145,9 @@ if (sym.clip()) converter.set(); // optional clip (default: true) converter.set(); // always transform - if (fabs(sym.offset()) > 0.0) converter.set(); // parallel offset + if (std::fabs(sym.offset()) > 0.0) converter.set(); // parallel offset converter.set(); // optional affine transform + if (sym.simplify_tolerance() > 0.0) converter.set(); // optional simplify converter if (sym.smooth() > 0.0) converter.set(); // optional smooth converter if (stroke_.has_dash()) converter.set(); converter.set(); //always stroke @@ -158,7 +161,6 @@ } typedef agg::renderer_scanline_aa_solid renderer_type; - renderer_base renb(pixf); renderer_type ren(renb); ren.color(agg::rgba8_pre(r, g, b, int(a * stroke_.get_opacity()))); agg::scanline_u8 sl; diff -Nru mapnik-2.1.0/src/agg/process_markers_symbolizer.cpp mapnik-2.2.0/src/agg/process_markers_symbolizer.cpp --- mapnik-2.1.0/src/agg/process_markers_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/agg/process_markers_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,17 +26,18 @@ #include #include +#include #include -#include #include #include #include #include -#include +#include #include #include #include #include +#include // agg #include "agg_basics.h" @@ -73,13 +74,21 @@ std::string filename = path_processor_type::evaluate(*sym.get_filename(), feature); + // https://github.com/mapnik/mapnik/issues/1316 + bool snap_pixels = !mapnik::marker_cache::instance().is_uri(filename); + if (!filename.empty()) { - boost::optional mark = mapnik::marker_cache::instance()->find(filename, true); + boost::optional mark = mapnik::marker_cache::instance().find(filename, true); if (mark && *mark) { ras_ptr->reset(); - ras_ptr->gamma(agg::gamma_power()); + if (gamma_method_ != GAMMA_POWER || gamma_ != 1.0) + { + ras_ptr->gamma(agg::gamma_power()); + gamma_method_ = GAMMA_POWER; + gamma_ = 1.0; + } agg::trans_affine geom_tr; evaluate_transform(geom_tr, feature, sym.get_transform()); agg::trans_affine tr = agg::trans_affine_scaling(scale_factor_); @@ -89,7 +98,7 @@ using namespace mapnik::svg; typedef agg::renderer_scanline_aa_solid renderer_type; typedef agg::pod_bvector svg_attribute_type; - typedef svg_renderer svg_renderer_type; @@ -119,8 +128,15 @@ agg::trans_affine_translation recenter(-center.x, -center.y); agg::trans_affine marker_trans = recenter * tr; buf_type render_buffer(current_buffer_->raw_data(), width_, height_, width_ * 4); - dispatch_type rasterizer_dispatch(render_buffer,svg_renderer,*ras_ptr, - bbox, marker_trans, sym, *detector_, scale_factor_); + dispatch_type rasterizer_dispatch(render_buffer, + svg_renderer, + *ras_ptr, + bbox, + marker_trans, + sym, + *detector_, + scale_factor_, + snap_pixels); vertex_converter, dispatch_type, markers_symbolizer, CoordTransform, proj_transform, agg::trans_affine, conv_types> converter(query_extent_, rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_); @@ -136,15 +152,12 @@ } converter.template set(); //always transform if (sym.smooth() > 0.0) converter.template set(); // optional smooth converter - BOOST_FOREACH(geometry_type & geom, feature.paths()) - { - converter.apply(geom); - } + apply_markers_multi(feature, converter, sym); } else { box2d const& bbox = (*mark)->bounding_box(); - setup_transform_scaling(tr, bbox, feature, sym); + setup_transform_scaling(tr, bbox.width(), bbox.height(), feature, sym); evaluate_transform(tr, feature, sym.get_image_transform()); coord2d center = bbox.center(); agg::trans_affine_translation recenter(-center.x, -center.y); @@ -155,8 +168,15 @@ bool result = push_explicit_style( (*stock_vector_marker)->attributes(), attributes, sym); svg_renderer_type svg_renderer(svg_path, result ? attributes : (*stock_vector_marker)->attributes()); buf_type render_buffer(current_buffer_->raw_data(), width_, height_, width_ * 4); - dispatch_type rasterizer_dispatch(render_buffer,svg_renderer,*ras_ptr, - bbox, marker_trans, sym, *detector_, scale_factor_); + dispatch_type rasterizer_dispatch(render_buffer, + svg_renderer, + *ras_ptr, + bbox, + marker_trans, + sym, + *detector_, + scale_factor_, + snap_pixels); vertex_converter, dispatch_type, markers_symbolizer, CoordTransform, proj_transform, agg::trans_affine, conv_types> converter(query_extent_, rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_); @@ -172,25 +192,28 @@ } converter.template set(); //always transform if (sym.smooth() > 0.0) converter.template set(); // optional smooth converter - BOOST_FOREACH(geometry_type & geom, feature.paths()) - { - converter.apply(geom); - } + apply_markers_multi(feature, converter, sym); } } else // raster markers { - box2d const& bbox = (*mark)->bounding_box(); - setup_transform_scaling(tr, bbox, feature, sym); + setup_transform_scaling(tr, (*mark)->width(), (*mark)->height(), feature, sym); evaluate_transform(tr, feature, sym.get_image_transform()); + box2d const& bbox = (*mark)->bounding_box(); coord2d center = bbox.center(); agg::trans_affine_translation recenter(-center.x, -center.y); agg::trans_affine marker_trans = recenter * tr; boost::optional marker = (*mark)->get_bitmap_data(); typedef raster_markers_rasterizer_dispatch dispatch_type; buf_type render_buffer(current_buffer_->raw_data(), width_, height_, width_ * 4); - dispatch_type rasterizer_dispatch(render_buffer,*ras_ptr, **marker, - marker_trans, sym, *detector_, scale_factor_); + dispatch_type rasterizer_dispatch(render_buffer, + *ras_ptr, + **marker, + marker_trans, + sym, + *detector_, + scale_factor_, + true /*snap rasters no matter what*/); vertex_converter, dispatch_type, markers_symbolizer, CoordTransform, proj_transform, agg::trans_affine, conv_types> converter(query_extent_, rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_); @@ -207,11 +230,7 @@ } converter.template set(); //always transform if (sym.smooth() > 0.0) converter.template set(); // optional smooth converter - - BOOST_FOREACH(geometry_type & geom, feature.paths()) - { - converter.apply(geom); - } + apply_markers_multi(feature, converter, sym); } } } diff -Nru mapnik-2.1.0/src/agg/process_point_symbolizer.cpp mapnik-2.2.0/src/agg/process_point_symbolizer.cpp --- mapnik-2.1.0/src/agg/process_point_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/agg/process_point_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,15 +21,19 @@ *****************************************************************************/ // mapnik +#include #include #include #include #include #include -#include #include #include +#include +#include +#include + // agg #include "agg_trans_affine.h" @@ -52,7 +56,7 @@ boost::optional marker; if ( !filename.empty() ) { - marker = marker_cache::instance()->find(filename, true); + marker = marker_cache::instance().find(filename, true); } else { @@ -68,7 +72,7 @@ evaluate_transform(tr, feature, sym.get_image_transform()); agg::trans_affine_translation recenter(-center.x, -center.y); agg::trans_affine recenter_tr = recenter * tr; - box2d label_ext = bbox * recenter_tr; + box2d label_ext = bbox * recenter_tr * agg::trans_affine_scaling(scale_factor_); for (unsigned i=0; i + // mapnik +#include #include #include #include @@ -30,8 +32,10 @@ #include #include #include -#include #include +#include +#include + // agg #include "agg_basics.h" #include "agg_rendering_buffer.h" @@ -57,13 +61,17 @@ agg::rendering_buffer buf(current_buffer_->raw_data(), width_, height_, width_ * 4); ras_ptr->reset(); - set_gamma_method(sym,ras_ptr); - + if (sym.get_gamma() != gamma_ || sym.get_gamma_method() != gamma_method_) + { + set_gamma_method(sym, ras_ptr); + gamma_method_ = sym.get_gamma_method(); + gamma_ = sym.get_gamma(); + } std::string filename = path_processor_type::evaluate( *sym.get_filename(), feature); boost::optional marker; if ( !filename.empty() ) { - marker = marker_cache::instance()->find(filename, true); + marker = marker_cache::instance().find(filename, true); } else { @@ -139,13 +147,14 @@ agg::trans_affine tr; evaluate_transform(tr, feature, sym.get_transform()); - typedef boost::mpl::vector conv_types; + typedef boost::mpl::vector conv_types; vertex_converter, rasterizer, polygon_pattern_symbolizer, CoordTransform, proj_transform, agg::trans_affine, conv_types> converter(query_extent_,*ras_ptr,sym,t_,prj_trans,tr,scale_factor_); if (prj_trans.equal() && sym.clip()) converter.set(); //optional clip (default: true) converter.set(); //always transform + if (sym.simplify_tolerance() > 0.0) converter.set(); // optional simplify converter if (sym.smooth() > 0.0) converter.set(); // optional smooth converter BOOST_FOREACH( geometry_type & geom, feature.paths()) diff -Nru mapnik-2.1.0/src/agg/process_polygon_symbolizer.cpp mapnik-2.2.0/src/agg/process_polygon_symbolizer.cpp --- mapnik-2.1.0/src/agg/process_polygon_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/agg/process_polygon_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,7 +22,9 @@ // boost #include + // mapnik +#include #include #include #include @@ -46,12 +48,16 @@ { ras_ptr->reset(); - set_gamma_method(sym,ras_ptr); - + if (sym.get_gamma() != gamma_ || sym.get_gamma_method() != gamma_method_) + { + set_gamma_method(sym, ras_ptr); + gamma_method_ = sym.get_gamma_method(); + gamma_ = sym.get_gamma(); + } agg::trans_affine tr; evaluate_transform(tr, feature, sym.get_transform()); - typedef boost::mpl::vector conv_types; + typedef boost::mpl::vector conv_types; vertex_converter, rasterizer, polygon_symbolizer, CoordTransform, proj_transform, agg::trans_affine, conv_types> converter(query_extent_,*ras_ptr,sym,t_,prj_trans,tr,scale_factor_); @@ -59,6 +65,7 @@ if (prj_trans.equal() && sym.clip()) converter.set(); //optional clip (default: true) converter.set(); //always transform converter.set(); + if (sym.simplify_tolerance() > 0.0) converter.set(); // optional simplify converter if (sym.smooth() > 0.0) converter.set(); // optional smooth converter BOOST_FOREACH( geometry_type & geom, feature.paths()) diff -Nru mapnik-2.1.0/src/agg/process_raster_symbolizer.cpp mapnik-2.2.0/src/agg/process_raster_symbolizer.cpp --- mapnik-2.1.0/src/agg/process_raster_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/agg/process_raster_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,10 +21,13 @@ *****************************************************************************/ // mapnik +#include #include #include #include #include +#include +#include #include #include #include @@ -36,6 +39,10 @@ // stl #include +// agg +#include "agg_rendering_buffer.h" +#include "agg_pixfmt_rgba.h" + namespace mapnik { @@ -56,22 +63,37 @@ box2d target_ext = box2d(source->ext_); prj_trans.backward(target_ext, PROJ_ENVELOPE_POINTS); box2d ext = t_.forward(target_ext); - int start_x = static_cast(ext.minx()); - int start_y = static_cast(ext.miny()); - int end_x = static_cast(ceil(ext.maxx())); - int end_y = static_cast(ceil(ext.maxy())); + int start_x = static_cast(std::floor(ext.minx()+.5)); + int start_y = static_cast(std::floor(ext.miny()+.5)); + int end_x = static_cast(std::floor(ext.maxx()+.5)); + int end_y = static_cast(std::floor(ext.maxy()+.5)); int raster_width = end_x - start_x; int raster_height = end_y - start_y; if (raster_width > 0 && raster_height > 0) { - image_data_32 target_data(raster_width,raster_height); - raster target(target_ext, target_data); + raster target(target_ext, raster_width,raster_height); scaling_method_e scaling_method = sym.get_scaling_method(); double filter_radius = sym.calculate_filter_factor(); - double offset_x = ext.minx() - start_x; - double offset_y = ext.miny() - start_y; + bool premultiply_source = !source->premultiplied_alpha_; + boost::optional is_premultiplied = sym.premultiplied(); + if (is_premultiplied) + { + if (*is_premultiplied) premultiply_source = false; + else premultiply_source = true; + } + if (premultiply_source) + { + agg::rendering_buffer buffer(source->data_.getBytes(), + source->data_.width(), + source->data_.height(), + source->data_.width() * 4); + agg::pixfmt_rgba32 pixf(buffer); + pixf.premultiply(); + } if (!prj_trans.equal()) { + double offset_x = ext.minx() - start_x; + double offset_y = ext.miny() - start_y; reproject_and_scale_raster(target, *source, prj_trans, offset_x, offset_y, sym.get_mesh_size(), @@ -80,20 +102,30 @@ } else { - if (scaling_method == SCALING_BILINEAR8){ - scale_image_bilinear8(target.data_,source->data_, offset_x, offset_y); - } else { - double scaling_ratio = ext.width() / source->data_.width(); + if (scaling_method == SCALING_BILINEAR8) + { + scale_image_bilinear8(target.data_, + source->data_, + 0.0, + 0.0); + } + else + { + double image_ratio_x = ext.width() / source->data_.width(); + double image_ratio_y = ext.height() / source->data_.height(); scale_image_agg(target.data_, source->data_, scaling_method, - scaling_ratio, - offset_x, - offset_y, + image_ratio_x, + image_ratio_y, + 0.0, + 0.0, filter_radius); } } - composite(current_buffer_->data(), target.data_, sym.comp_op(), sym.get_opacity(), start_x, start_y, true); + composite(current_buffer_->data(), target.data_, + sym.comp_op(), sym.get_opacity(), + start_x, start_y, false); } } } diff -Nru mapnik-2.1.0/src/agg/process_shield_symbolizer.cpp mapnik-2.2.0/src/agg/process_shield_symbolizer.cpp --- mapnik-2.1.0/src/agg/process_shield_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/agg/process_shield_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,13 +21,13 @@ *****************************************************************************/ // mapnik +#include #include #include #include -#include -#include -#include #include +#include +#include // boost #include @@ -49,7 +49,7 @@ text_renderer ren(*current_buffer_, font_manager_, - *(font_manager_.get_stroker()), + sym.get_halo_rasterizer(), sym.comp_op(), scale_factor_); diff -Nru mapnik-2.1.0/src/agg/process_text_symbolizer.cpp mapnik-2.2.0/src/agg/process_text_symbolizer.cpp --- mapnik-2.1.0/src/agg/process_text_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/agg/process_text_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,9 +21,12 @@ *****************************************************************************/ // mapnik +#include #include #include #include +#include +#include namespace mapnik { @@ -42,7 +45,7 @@ text_renderer ren(*current_buffer_, font_manager_, - *(font_manager_.get_stroker()), + sym.get_halo_rasterizer(), sym.comp_op(), scale_factor_); diff -Nru mapnik-2.1.0/src/box2d.cpp mapnik-2.2.0/src/box2d.cpp --- mapnik-2.1.0/src/box2d.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/box2d.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,13 +22,13 @@ // mapnik #include +#include // stl #include // boost #include -#include #include // agg @@ -41,9 +41,9 @@ :minx_(0),miny_(0),maxx_(-1),maxy_(-1) {} template -box2d::box2d(T minx_,T miny_,T maxx_,T maxy_) +box2d::box2d(T minx,T miny,T maxx,T maxy) { - init(minx_,miny_,maxx_,maxy_); + init(minx,miny,maxx,maxy); } template @@ -128,6 +128,30 @@ return maxy_; } +template +void box2d::set_minx(T v) +{ + minx_ = v; +} + +template +void box2d::set_miny(T v) +{ + miny_ = v; +} + +template +void box2d::set_maxx(T v) +{ + maxx_ = v; +} + +template +void box2d::set_maxy(T v) +{ + maxy_ = v; +} + template #if !defined(__SUNPRO_CC) inline @@ -344,12 +368,23 @@ maxy_ = std::min(maxy_,other.maxy()); } +template +#if !defined(__SUNPRO_CC) +inline +#endif +void box2d::pad(T padding) +{ + minx_ -= padding; + miny_ -= padding; + maxx_ += padding; + maxy_ += padding; +} template #if !defined(__SUNPRO_CC) inline #endif -bool box2d::from_string(const std::string& s) +bool box2d::from_string(std::string const& s) { unsigned i = 0; double d[4]; @@ -359,14 +394,17 @@ for (boost::tokenizer >::iterator beg = tok.begin(); beg != tok.end(); ++beg) { - std::string item(*beg); - boost::trim(item); + std::string item = mapnik::util::trim_copy(*beg); // note: we intentionally do not use mapnik::util::conversions::string2double // here to ensure that shapeindex can statically compile mapnik::box2d without // needing to link to libmapnik std::string::const_iterator str_beg = item.begin(); std::string::const_iterator str_end = item.end(); - bool r = boost::spirit::qi::phrase_parse(str_beg,str_end,boost::spirit::qi::double_,boost::spirit::ascii::space,d[i]); + bool r = boost::spirit::qi::phrase_parse(str_beg, + str_end, + boost::spirit::qi::double_, + boost::spirit::ascii::space, + d[i]); if (!(r && (str_beg == str_end))) { break; diff -Nru mapnik-2.1.0/src/build.py mapnik-2.2.0/src/build.py --- mapnik-2.1.0/src/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/build.py 2013-06-04 01:35:27.000000000 +0000 @@ -17,7 +17,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# import os @@ -48,6 +48,7 @@ # note: .data gets the actual list to allow a true copy # and avoids unintended pollution of other environments libmapnik_cxxflags = copy(lib_env['CXXFLAGS'].data) +libmapnik_defines = copy(lib_env['CPPDEFINES']) ABI_VERSION = env['ABI_VERSION'] @@ -56,26 +57,34 @@ system = 'boost_system%s' % env['BOOST_APPEND'] # clear out and re-set libs for this env -lib_env['LIBS'] = ['freetype','ltdl','png','tiff','z','proj',env['ICU_LIB_NAME'],filesystem,system,regex] +lib_env['LIBS'] = ['freetype','z',env['ICU_LIB_NAME'],filesystem,system,regex] + +if env['PROJ']: + lib_env['LIBS'].append('proj') + +if env['PNG']: + lib_env['LIBS'].append('png') if env['JPEG']: lib_env['LIBS'].append('jpeg') +if env['TIFF']: + lib_env['LIBS'].append('tiff') + if len(env['EXTRA_FREETYPE_LIBS']): lib_env['LIBS'].extend(copy(env['EXTRA_FREETYPE_LIBS'])) -# libxml2 should be optional but is currently not -# https://github.com/mapnik/mapnik/issues/913 lib_env['LIBS'].append('xml2') if env['THREADING'] == 'multi': lib_env['LIBS'].append('boost_thread%s' % env['BOOST_APPEND']) +if '-DBOOST_REGEX_HAS_ICU' in env['CPPDEFINES']: + lib_env['LIBS'].append('icui18n') if env['RUNTIME_LINK'] == 'static': if 'icuuc' in env['ICU_LIB_NAME']: lib_env['LIBS'].append('icudata') - lib_env['LIBS'].append('icui18n') else: lib_env['LIBS'].insert(0, 'agg') @@ -100,6 +109,13 @@ source = Split( """ + fs.cpp + debug_symbolizer.cpp + request.cpp + well_known_srs.cpp + params.cpp + image_filter_types.cpp + miniz_png.cpp color.cpp css_color_grammar.cpp conversions.cpp @@ -109,6 +125,7 @@ box2d.cpp building_symbolizer.cpp datasource_cache.cpp + datasource_cache_static.cpp debug.cpp deepcopy.cpp expression_node.cpp @@ -138,19 +155,19 @@ path_expression_grammar.cpp placement_finder.cpp plugin.cpp - png_reader.cpp point_symbolizer.cpp polygon_pattern_symbolizer.cpp polygon_symbolizer.cpp + rule.cpp save_map.cpp shield_symbolizer.cpp text_symbolizer.cpp - tiff_reader.cpp wkb.cpp projection.cpp proj_transform.cpp distance.cpp scale_denominator.cpp + simplify.cpp memory_datasource.cpp stroke.cpp symbolizer.cpp @@ -158,14 +175,15 @@ unicode.cpp markers_symbolizer.cpp raster_colorizer.cpp + raster_symbolizer.cpp wkt/wkt_factory.cpp wkt/wkt_generator.cpp mapped_memory_cache.cpp marker_cache.cpp - svg_parser.cpp - svg_path_parser.cpp - svg_points_parser.cpp - svg_transform_parser.cpp + svg/svg_parser.cpp + svg/svg_path_parser.cpp + svg/svg_points_parser.cpp + svg/svg_transform_parser.cpp warp.cpp json/geometry_grammar.cpp json/geometry_parser.cpp @@ -187,55 +205,50 @@ text_properties.cpp xml_tree.cpp config_error.cpp + color_factory.cpp """ ) +if env['PLUGIN_LINKING'] == 'static': + hit = False + for plugin in env['REQUESTED_PLUGINS']: + details = env['PLUGINS'][plugin] + if details['lib'] in env['LIBS'] or not details['lib']: + plugin_env = SConscript('../plugins/input/%s/build.py' % plugin) + if not plugin_env: + print("Notice: no 'plugin_env' variable found for plugin: '%s'" % plugin) + else: + hit = True + DEF = '-DMAPNIK_STATIC_PLUGIN_%s' % plugin.upper() + lib_env.Append(CPPDEFINES = DEF) + if DEF not in libmapnik_defines: + libmapnik_defines.append(DEF) + if plugin_env.has_key('SOURCES') and plugin_env['SOURCES']: + source += ['../plugins/input/%s/%s' % (plugin, src) for src in plugin_env['SOURCES']] + if plugin_env.has_key('CPPDEFINES') and plugin_env['CPPDEFINES']: + lib_env.AppendUnique(CPPDEFINES=plugin_env['CPPDEFINES']) + if plugin_env.has_key('CXXFLAGS') and plugin_env['CXXFLAGS']: + lib_env.AppendUnique(CXXFLAGS=plugin_env['CXXFLAGS']) + if plugin_env.has_key('LINKFLAGS') and plugin_env['LINKFLAGS']: + lib_env.AppendUnique(LINKFLAGS=plugin_env['LINKFLAGS']) + if plugin_env.has_key('CPPPATH') and plugin_env['CPPPATH']: + lib_env.AppendUnique(CPPPATH=copy(plugin_env['CPPPATH'])) + if plugin_env.has_key('LIBS') and plugin_env['LIBS']: + lib_env.AppendUnique(LIBS=plugin_env['LIBS']) + else: + print("Notice: dependencies not met for plugin '%s', not building..." % plugin) + if hit: + lib_env.Append(CPPDEFINES = '-DMAPNIK_STATIC_PLUGINS') + libmapnik_defines.append('-DMAPNIK_STATIC_PLUGINS') + if env['HAS_CAIRO']: - lib_env.PrependUnique(LIBPATH=env['CAIROMM_LIBPATHS']) - lib_env.Append(LIBS=env['CAIROMM_LINKFLAGS']) - lib_env.Append(CXXFLAGS = '-DHAVE_CAIRO') - libmapnik_cxxflags.append('-DHAVE_CAIRO') - lib_env.PrependUnique(CPPPATH=copy(env['CAIROMM_CPPPATHS'])) + lib_env.AppendUnique(LIBPATH=env['CAIRO_LIBPATHS']) + lib_env.Append(LIBS=env['CAIRO_ALL_LIBS']) + lib_env.Append(CPPDEFINES = '-DHAVE_CAIRO') + libmapnik_defines.append('-DHAVE_CAIRO') + lib_env.AppendUnique(CPPPATH=copy(env['CAIRO_CPPPATHS'])) source.insert(0,'cairo_renderer.cpp') - #cairo_env.PrependUnique(CPPPATH=env['CAIROMM_CPPPATHS']) - # not safe, to much depends on graphics.hpp - #cairo_env = lib_env.Clone() - #cairo_env.Append(CXXFLAGS = '-DHAVE_CAIRO') - #fixup = ['feature_type_style.cpp','load_map.cpp','cairo_renderer.cpp','graphics.cpp','image_util.cpp'] - #for cpp in fixup: - # if cpp in source: - # source.remove(cpp) - # if env['LINKING'] == 'static': - # source.insert(0,cairo_env.StaticObject(cpp)) - # else: - # source.insert(0,cairo_env.SharedObject(cpp)) - - -processor_cpp = 'feature_style_processor.cpp' - -if env['RENDERING_STATS']: - env3 = lib_env.Clone() - env3.Append(CXXFLAGS='-DRENDERING_STATS') - if env['LINKING'] == 'static': - source.insert(0,env3.StaticObject(processor_cpp)) - else: - source.insert(0,env3.SharedObject(processor_cpp)) -else: - source.insert(0,processor_cpp); - -if env.get('BOOST_LIB_VERSION_FROM_HEADER'): - boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1]) - if boost_version_from_header < 46: - # avoid ubuntu issue with boost interprocess: - # https://github.com/mapnik/mapnik/issues/1001 - env4 = lib_env.Clone() - env4.Append(CXXFLAGS = '-fpermissive') - cpp ='mapped_memory_cache.cpp' - source.remove(cpp) - if env['LINKING'] == 'static': - source.insert(0,env4.StaticObject(cpp)) - else: - source.insert(0,env4.SharedObject(cpp)) + source.insert(0,'cairo_context.cpp') if env['JPEG']: source += Split( @@ -243,6 +256,18 @@ jpeg_reader.cpp """) +if env['TIFF']: + source += Split( + """ + tiff_reader.cpp + """) + +if env['PNG']: + source += Split( + """ + png_reader.cpp + """) + # agg backend source += Split( """ @@ -257,9 +282,16 @@ agg/process_raster_symbolizer.cpp agg/process_shield_symbolizer.cpp agg/process_markers_symbolizer.cpp + agg/process_debug_symbolizer.cpp """ ) +# clipper +source += Split( + """ + ../deps/clipper/src/clipper.cpp + """) + if env['RUNTIME_LINK'] == "static": source += glob.glob('../deps/agg/src/' + '*.cpp') @@ -281,26 +313,41 @@ """) # https://github.com/mapnik/mapnik/issues/1438 -#if env['SVG_RENDERER']: # svg backend -# source += Split( -# """ -# svg/svg_renderer.cpp -# svg/svg_generator.cpp -# svg/svg_output_attributes.cpp -# svg/process_symbolizers.cpp -# svg/process_building_symbolizer.cpp -# svg/process_line_pattern_symbolizer.cpp -# svg/process_line_symbolizer.cpp -# svg/process_markers_symbolizer.cpp -# svg/process_point_symbolizer.cpp -# svg/process_polygon_pattern_symbolizer.cpp -# svg/process_polygon_symbolizer.cpp -# svg/process_raster_symbolizer.cpp -# svg/process_shield_symbolizer.cpp -# svg/process_text_symbolizer.cpp -# """) -# lib_env.Append(CXXFLAGS = '-DSVG_RENDERER') -# libmapnik_cxxflags.append('-DSVG_RENDERER') +if env['SVG_RENDERER']: # svg backend + source += Split( + """ + svg/output/svg_renderer.cpp + svg/output/svg_generator.cpp + svg/output/svg_output_attributes.cpp + svg/output/process_symbolizers.cpp + svg/output/process_building_symbolizer.cpp + svg/output/process_line_pattern_symbolizer.cpp + svg/output/process_line_symbolizer.cpp + svg/output/process_markers_symbolizer.cpp + svg/output/process_point_symbolizer.cpp + svg/output/process_polygon_pattern_symbolizer.cpp + svg/output/process_polygon_symbolizer.cpp + svg/output/process_raster_symbolizer.cpp + svg/output/process_shield_symbolizer.cpp + svg/output/process_text_symbolizer.cpp + """) + lib_env.Append(CPPDEFINES = '-DSVG_RENDERER') + libmapnik_defines.append('-DSVG_RENDERER') + + +if env.get('BOOST_LIB_VERSION_FROM_HEADER'): + boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1]) + if boost_version_from_header < 46: + # avoid ubuntu issue with boost interprocess: + # https://github.com/mapnik/mapnik/issues/1001 + env4 = lib_env.Clone() + env4.Append(CXXFLAGS = '-fpermissive') + cpp ='mapped_memory_cache.cpp' + source.remove(cpp) + if env['LINKING'] == 'static': + source.insert(0,env4.StaticObject(cpp)) + else: + source.insert(0,env4.SharedObject(cpp)) if env['XMLPARSER'] == 'libxml2' and env['HAS_LIBXML2']: source += Split( @@ -308,8 +355,8 @@ libxml2_loader.cpp """) env2 = lib_env.Clone() - env2.Append(CXXFLAGS = '-DHAVE_LIBXML2') - libmapnik_cxxflags.append('-DHAVE_LIBXML2') + env2.Append(CPPDEFINES = '-DHAVE_LIBXML2') + libmapnik_defines.append('-DHAVE_LIBXML2') fixup = ['libxml2_loader.cpp'] for cpp in fixup: if cpp in source: @@ -325,22 +372,41 @@ """ ) +processor_cpp = 'feature_style_processor.cpp' + +if env['RENDERING_STATS']: + env3 = lib_env.Clone() + env3.Append(CPPDEFINES='-DRENDERING_STATS') + if env['LINKING'] == 'static': + source.insert(0,env3.StaticObject(processor_cpp)) + else: + source.insert(0,env3.SharedObject(processor_cpp)) +else: + source.insert(0,processor_cpp); + +# clone the env one more time to isolate mapnik_lib_link_flag +lib_env_final = lib_env.Clone() + if env['CUSTOM_LDFLAGS']: - linkflags = '%s %s' % (env['CUSTOM_LDFLAGS'], mapnik_lib_link_flag) + lib_env_final.Prepend(LINKFLAGS='%s %s' % (env['CUSTOM_LDFLAGS'], mapnik_lib_link_flag)) else: - linkflags = mapnik_lib_link_flag + lib_env_final.Prepend(LINKFLAGS=mapnik_lib_link_flag) # cache library values for other builds to use env['LIBMAPNIK_LIBS'] = copy(lib_env['LIBS']) +env['LIBMAPNIK_LINKFLAGS'] = copy(lib_env['LINKFLAGS']) env['LIBMAPNIK_CXXFLAGS'] = libmapnik_cxxflags +env['LIBMAPNIK_DEFINES'] = libmapnik_defines + +mapnik = None if env['PLATFORM'] == 'Darwin': target_path = env['MAPNIK_LIB_BASE_DEST'] if 'uninstall' not in COMMAND_LINE_TARGETS: if env['LINKING'] == 'static': - mapnik = lib_env.StaticLibrary('mapnik', source, LINKFLAGS=linkflags) + mapnik = lib_env_final.StaticLibrary('mapnik', source) else: - mapnik = lib_env.SharedLibrary('mapnik', source, LINKFLAGS=linkflags) + mapnik = lib_env_final.SharedLibrary('mapnik', source) result = env.Install(target_path, mapnik) env.Alias(target='install', source=result) @@ -362,15 +428,14 @@ if 'uninstall' not in COMMAND_LINE_TARGETS: if env['LINKING'] == 'static': - mapnik = lib_env.StaticLibrary('mapnik', source, LINKFLAGS=linkflags) + mapnik = lib_env_final.StaticLibrary('mapnik', source) else: - mapnik = lib_env.SharedLibrary('mapnik', source, LINKFLAGS=linkflags) + mapnik = lib_env_final.SharedLibrary('mapnik', source) result = env.InstallAs(target=target, source=mapnik) env.Alias(target='install', source=result) if result: env.AddPostAction(result, ldconfig) - # Install symlinks target1 = os.path.join(env['MAPNIK_LIB_BASE_DEST'], "%s.%d.%d" % \ (os.path.basename(env.subst(env['MAPNIK_LIB_NAME'])),int(major), int(minor))) @@ -385,39 +450,13 @@ env['create_uninstall_target'](env, target1) env['create_uninstall_target'](env, target) -includes = glob.glob('../include/mapnik/*.hpp') -svg_includes = glob.glob('../include/mapnik/svg/*.hpp') -wkt_includes = glob.glob('../include/mapnik/wkt/*.hpp') -grid_includes = glob.glob('../include/mapnik/grid/*.hpp') -json_includes = glob.glob('../include/mapnik/json/*.hpp') -util_includes = glob.glob('../include/mapnik/util/*.hpp') -text_placements_includes = glob.glob('../include/mapnik/text_placements/*.hpp') -formatting_includes = glob.glob('../include/mapnik/formatting/*.hpp') - -inc_target = os.path.normpath(env['INSTALL_PREFIX']+'/include/mapnik') -svg_inc_target = os.path.normpath(env['INSTALL_PREFIX']+'/include/mapnik/svg') -wkt_inc_target = os.path.normpath(env['INSTALL_PREFIX']+'/include/mapnik/wkt') -grid_inc_target = os.path.normpath(env['INSTALL_PREFIX']+'/include/mapnik/grid') -json_inc_target = os.path.normpath(env['INSTALL_PREFIX']+'/include/mapnik/json') -util_inc_target = os.path.normpath(env['INSTALL_PREFIX']+'/include/mapnik/util') -text_placements_inc_target = os.path.normpath(env['INSTALL_PREFIX']+'/include/mapnik/text_placements') -formatting_inc_target = os.path.normpath(env['INSTALL_PREFIX']+'/include/mapnik/formatting') - -if 'uninstall' not in COMMAND_LINE_TARGETS: - env.Alias(target='install', source=env.Install(inc_target, includes)) - env.Alias(target='install', source=env.Install(svg_inc_target, svg_includes)) - env.Alias(target='install', source=env.Install(wkt_inc_target, wkt_includes)) - env.Alias(target='install', source=env.Install(grid_inc_target, grid_includes)) - env.Alias(target='install', source=env.Install(json_inc_target, json_includes)) - env.Alias(target='install', source=env.Install(util_inc_target, util_includes)) - env.Alias(target='install', source=env.Install(text_placements_inc_target, text_placements_includes)) - env.Alias(target='install', source=env.Install(formatting_inc_target, formatting_includes)) - -env['create_uninstall_target'](env, inc_target) -env['create_uninstall_target'](env, svg_inc_target) -env['create_uninstall_target'](env, wkt_inc_target) -env['create_uninstall_target'](env, grid_inc_target) -env['create_uninstall_target'](env, json_inc_target) -env['create_uninstall_target'](env, util_inc_target) -env['create_uninstall_target'](env, text_placements_inc_target) -env['create_uninstall_target'](env, formatting_inc_target) + # to enable local testing + lib_major_minor = "%s.%d.%d" % (os.path.basename(env.subst(env['MAPNIK_LIB_NAME'])), int(major), int(minor)) + local_lib = os.path.basename(env.subst(env['MAPNIK_LIB_NAME'])) + if os.path.islink(lib_major_minor) or os.path.exists(lib_major_minor): + os.remove(lib_major_minor) + os.symlink(local_lib,lib_major_minor) + Clean(mapnik,lib_major_minor); + +if not env['RUNTIME_LINK'] == 'static': + Depends(mapnik, env.subst('../deps/agg/libagg.a')) diff -Nru mapnik-2.1.0/src/building_symbolizer.cpp mapnik-2.2.0/src/building_symbolizer.cpp --- mapnik-2.1.0/src/building_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/building_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,6 +22,8 @@ // mapnik #include +#include +#include namespace mapnik { diff -Nru mapnik-2.1.0/src/cairo_context.cpp mapnik-2.2.0/src/cairo_context.cpp --- mapnik-2.1.0/src/cairo_context.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/cairo_context.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,503 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#include +#include +#include +#include +#include + +#include + +#include +namespace mapnik { + +cairo_face::cairo_face(boost::shared_ptr const& engine, face_ptr const& face) + : face_(face) +{ + static cairo_user_data_key_t key; + c_face_ = cairo_ft_font_face_create_for_ft_face(face->get_face(), FT_LOAD_NO_HINTING); + cairo_font_face_set_user_data(c_face_, &key, new handle(engine, face), destroy); +} + +cairo_face::~cairo_face() +{ + if (c_face_) cairo_font_face_destroy(c_face_); +} + +cairo_font_face_t * cairo_face::face() const +{ + return c_face_; +} + +cairo_context::cairo_context(cairo_ptr const& cairo) + : cairo_(cairo) +{} + +void cairo_context::clip() +{ + cairo_clip(cairo_.get()); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::show_page() +{ + cairo_show_page(cairo_.get()); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::set_color(color const &color, double opacity) +{ + set_color(color.red()/255.0, color.green()/255.0, color.blue()/255.0, color.alpha() * opacity / 255.0); +} + +void cairo_context::set_color(double r, double g, double b, double opacity) +{ + // http://lists.cairographics.org/archives/cairo/2008-August/014759.html + cairo_set_source_rgba(cairo_.get(), r, g, b, opacity); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::set_operator(composite_mode_e comp_op) +{ + switch (comp_op) + { + case clear: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_CLEAR); + break; + case src: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_SOURCE); + break; + case dst: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_DEST); + break; + case src_over: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_OVER); + break; + case dst_over: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_DEST_OVER); + break; + case src_in: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_IN); + break; + case dst_in: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_DEST_IN); + break; + case src_out: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_OUT); + break; + case dst_out: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_DEST_OUT); + break; + case src_atop: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_ATOP); + break; + case dst_atop: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_DEST_ATOP); + break; + case _xor: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_XOR); + break; + case plus: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_ADD); + break; +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0) + case multiply: + cairo_set_operator(cairo_.get(), CAIRO_OPERATOR_MULTIPLY); + break; + case screen: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_SCREEN); + break; + case overlay: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_OVERLAY); + break; + case darken: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_DARKEN); + break; + case lighten: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_LIGHTEN); + break; + case color_dodge: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_COLOR_DODGE); + break; + case color_burn: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_COLOR_BURN); + break; + case hard_light: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_HARD_LIGHT); + break; + case soft_light: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_SOFT_LIGHT); + break; + case difference: + cairo_set_operator(cairo_.get(),CAIRO_OPERATOR_DIFFERENCE); + break; + case exclusion: + cairo_set_operator(cairo_.get(), CAIRO_OPERATOR_EXCLUSION); + break; +#else + case multiply: + case screen: + case overlay: + case darken: + case lighten: + case color_dodge: + case color_burn: + case hard_light: + case soft_light: + case difference: + case exclusion: + break; +#endif + case contrast: + case minus: + case invert: + case invert_rgb: + case grain_merge: + case grain_extract: + case hue: + case saturation: + case _color: + case _value: + //case colorize_alpha: + break; + } + // + check_object_status_and_throw_exception(*this); +} + +void cairo_context::set_line_join(line_join_e join) +{ + if (join == MITER_JOIN) + cairo_set_line_join(cairo_.get(), CAIRO_LINE_JOIN_MITER); + else if (join == MITER_REVERT_JOIN) + cairo_set_line_join(cairo_.get(), CAIRO_LINE_JOIN_MITER); + else if (join == ROUND_JOIN) + cairo_set_line_join(cairo_.get(), CAIRO_LINE_JOIN_ROUND); + else + cairo_set_line_join(cairo_.get(), CAIRO_LINE_JOIN_BEVEL); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::set_line_cap(line_cap_e cap) +{ + if (cap == BUTT_CAP) + cairo_set_line_cap(cairo_.get(), CAIRO_LINE_CAP_BUTT); + else if (cap == SQUARE_CAP) + cairo_set_line_cap(cairo_.get(), CAIRO_LINE_CAP_SQUARE); + else + cairo_set_line_cap(cairo_.get(), CAIRO_LINE_CAP_ROUND); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::set_miter_limit(double limit) +{ + cairo_set_miter_limit(cairo_.get(), limit); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::set_line_width(double width) +{ + cairo_set_line_width(cairo_.get(), width); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::set_dash(dash_array const &dashes, double scale_factor) +{ + std::valarray d(dashes.size() * 2); + dash_array::const_iterator itr = dashes.begin(); + dash_array::const_iterator end = dashes.end(); + int index = 0; + + for (; itr != end; ++itr) + { + d[index++] = itr->first * scale_factor; + d[index++] = itr->second * scale_factor; + } + + cairo_set_dash(cairo_.get() , &d[0], d.size(), 0/*offset*/); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::set_fill_rule(cairo_fill_rule_t fill_rule) +{ + cairo_set_fill_rule(cairo_.get(),fill_rule); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::move_to(double x, double y) +{ +#if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 6, 0) + if (x < -32767.0) x = -32767.0; + else if (x > 32767.0) x = 32767.0; + if (y < -32767.0) y = -32767.0; + else if (y > 32767.0) y = 32767.0; +#endif + cairo_move_to(cairo_.get(), x, y); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::curve_to(double ct1_x, double ct1_y, double ct2_x, double ct2_y, double end_x, double end_y) +{ + cairo_curve_to(cairo_.get(), ct1_x,ct1_y,ct2_x,ct2_y,end_x,end_y); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::close_path() +{ + cairo_close_path(cairo_.get()); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::line_to(double x, double y) +{ +#if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 6, 0) + if (x < -32767.0) x = -32767.0; + else if (x > 32767.0) x = 32767.0; + if (y < -32767.0) y = -32767.0; + else if (y > 32767.0) y = 32767.0; +#endif + cairo_line_to(cairo_.get(), x, y); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::rectangle(double x, double y, double w, double h) +{ + cairo_rectangle(cairo_.get(), x, y, w, h); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::stroke() +{ + cairo_stroke(cairo_.get()); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::fill() +{ + cairo_fill(cairo_.get()); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::paint() +{ + cairo_paint(cairo_.get()); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::set_pattern(cairo_pattern const& pattern) +{ + cairo_set_source(cairo_.get(), pattern.pattern()); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::set_gradient(cairo_gradient const& pattern, const box2d &bbox) +{ + cairo_pattern_t * gradient = pattern.gradient(); + double bx1=bbox.minx(); + double by1=bbox.miny(); + double bx2=bbox.maxx(); + double by2=bbox.maxy(); + if (pattern.units() != USER_SPACE_ON_USE) + { + if (pattern.units() == OBJECT_BOUNDING_BOX) + { + cairo_path_extents(cairo_.get(), &bx1, &by1, &bx2, &by2); + } + cairo_matrix_t cairo_matrix; + cairo_pattern_get_matrix(gradient, &cairo_matrix); + cairo_matrix_scale(&cairo_matrix,1.0/(bx2-bx1),1.0/(by2-by1)); + cairo_matrix_translate(&cairo_matrix, -bx1,-by1); + cairo_pattern_set_matrix(gradient, &cairo_matrix); + } + cairo_set_source(cairo_.get(), const_cast(gradient)); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::add_image(double x, double y, image_data_32 & data, double opacity) +{ + cairo_pattern pattern(data); + pattern.set_origin(x, y); + cairo_save(cairo_.get()); + cairo_set_source(cairo_.get(), const_cast(pattern.pattern())); + cairo_paint_with_alpha(cairo_.get(), opacity); + cairo_restore(cairo_.get()); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::add_image(agg::trans_affine const& tr, image_data_32 & data, double opacity) +{ + cairo_pattern pattern(data); + if (!tr.is_identity()) + { + double m[6]; + tr.store_to(m); + cairo_matrix_t cairo_matrix; + cairo_matrix_init(&cairo_matrix,m[0],m[1],m[2],m[3],m[4],m[5]); + cairo_matrix_invert(&cairo_matrix); + pattern.set_matrix(cairo_matrix); + } + cairo_save(cairo_.get()); + cairo_set_source(cairo_.get(), const_cast(pattern.pattern())); + cairo_paint_with_alpha(cairo_.get(), opacity); + cairo_restore(cairo_.get()); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::set_font_face(cairo_face_manager & manager, face_ptr face) +{ + cairo_set_font_face(cairo_.get(), manager.get_face(face)->face()); +} + +void cairo_context::set_font_matrix(cairo_matrix_t const& matrix) +{ + cairo_set_font_matrix(cairo_.get(), &matrix); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::set_matrix(cairo_matrix_t const& matrix) +{ + cairo_set_matrix(cairo_.get(), &matrix); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::transform(cairo_matrix_t const& matrix) +{ + cairo_transform(cairo_.get(), &matrix); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::translate(double x, double y) +{ + cairo_translate(cairo_.get(), x, y); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::save() +{ + cairo_save(cairo_.get()); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::restore() +{ + cairo_restore(cairo_.get()); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::show_glyph(unsigned long index, double x, double y) +{ + cairo_glyph_t glyph; + glyph.index = index; + glyph.x = x; + glyph.y = y; + + cairo_show_glyphs(cairo_.get(), &glyph, 1); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::glyph_path(unsigned long index, double x, double y) +{ + cairo_glyph_t glyph; + glyph.index = index; + glyph.x = x; + glyph.y = y; + + cairo_glyph_path(cairo_.get(), &glyph, 1); + check_object_status_and_throw_exception(*this); +} + +void cairo_context::add_text(text_path const& path, + cairo_face_manager & manager, + face_manager & font_manager, + double scale_factor) +{ + double sx = path.center.x; + double sy = path.center.y; + + path.rewind(); + + for (int iii = 0; iii < path.num_nodes(); iii++) + { + char_info_ptr c; + double x, y, angle; + + path.vertex(c, x, y, angle); + + face_set_ptr faces = font_manager.get_face_set(c->format->face_name, c->format->fontset); + double text_size = c->format->text_size * scale_factor; + faces->set_character_sizes(text_size); + + glyph_ptr glyph = faces->get_glyph(c->c); + + if (glyph) + { + cairo_matrix_t matrix; + matrix.xx = text_size * std::cos(angle); + matrix.xy = text_size * std::sin(angle); + matrix.yx = text_size * -std::sin(angle); + matrix.yy = text_size * std::cos(angle); + matrix.x0 = 0; + matrix.y0 = 0; + set_font_matrix(matrix); + set_font_face(manager, glyph->get_face()); + glyph_path(glyph->get_index(), sx + x, sy - y); + set_line_width(2.0 * c->format->halo_radius * scale_factor); + set_line_join(ROUND_JOIN); + set_color(c->format->halo_fill); + stroke(); + } + } + + path.rewind(); + + for (int iii = 0; iii < path.num_nodes(); iii++) + { + char_info_ptr c; + double x, y, angle; + + path.vertex(c, x, y, angle); + + face_set_ptr faces = font_manager.get_face_set(c->format->face_name, c->format->fontset); + double text_size = c->format->text_size * scale_factor; + faces->set_character_sizes(text_size); + + glyph_ptr glyph = faces->get_glyph(c->c); + + if (glyph) + { + cairo_matrix_t matrix; + matrix.xx = text_size * std::cos(angle); + matrix.xy = text_size * std::sin(angle); + matrix.yx = text_size * -std::sin(angle); + matrix.yy = text_size * std::cos(angle); + matrix.x0 = 0; + matrix.y0 = 0; + set_font_matrix(matrix); + set_font_face(manager, glyph->get_face()); + set_color(c->format->fill); + show_glyph(glyph->get_index(), sx + x, sy - y); + } + } + +} +} diff -Nru mapnik-2.1.0/src/cairo_renderer.cpp mapnik-2.2.0/src/cairo_renderer.cpp --- mapnik-2.1.0/src/cairo_renderer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/cairo_renderer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,220 +23,78 @@ #if defined(HAVE_CAIRO) // mapnik +#include +#include #include +#include +#include +#include #include -#include #include +#include #include #include #include #include #include #include +#include +#include +#include #include #include #include #include +#include #include #include #include #include #include #include +#include +#include + // cairo -#include -#include +#include #include #include // boost -#include #include +#include // agg #include "agg_conv_clip_polyline.h" #include "agg_conv_clip_polygon.h" #include "agg_conv_smooth_poly1.h" +#include "agg_rendering_buffer.h" +#include "agg_pixfmt_rgba.h" // markers #include "agg_path_storage.h" #include "agg_ellipse.h" +// stl +#include + namespace mapnik { -class cairo_pattern : private boost::noncopyable -{ -public: - cairo_pattern(image_data_32 const& data) - { - int pixels = data.width() * data.height(); - const unsigned int *in_ptr = data.getData(); - const unsigned int *in_end = in_ptr + pixels; - unsigned int *out_ptr; - - surface_ = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, data.width(), data.height()); - - out_ptr = reinterpret_cast(surface_->get_data()); - - while (in_ptr < in_end) - { - unsigned int in = *in_ptr++; - unsigned int r = (in >> 0) & 0xff; - unsigned int g = (in >> 8) & 0xff; - unsigned int b = (in >> 16) & 0xff; - unsigned int a = (in >> 24) & 0xff; - - //r = r * a / 255; - //g = g * a / 255; - //b = b * a / 255; - - *out_ptr++ = (a << 24) | (r << 16) | (g << 8) | b; - } - // mark the surface as dirty as we've modified it behind cairo's back - surface_->mark_dirty(); - pattern_ = Cairo::SurfacePattern::create(surface_); - } - - ~cairo_pattern() - { - } - - void set_matrix(Cairo::Matrix const& matrix) - { - pattern_->set_matrix(matrix); - } - - void set_origin(double x, double y) - { - Cairo::Matrix matrix; - - pattern_->get_matrix(matrix); - matrix.x0 = -x; - matrix.y0 = -y; - - pattern_->set_matrix(matrix); - } - - void set_extend(Cairo::Extend extend) - { - pattern_->set_extend(extend); - } - - void set_filter(Cairo::Filter filter) - { - pattern_->set_filter(filter); - } - - Cairo::RefPtr const& pattern() const - { - return pattern_; - } - -private: - Cairo::RefPtr surface_; - Cairo::RefPtr pattern_; -}; - -class cairo_gradient : private boost::noncopyable +struct cairo_save_restore { -public: - cairo_gradient(const mapnik::gradient &grad, double opacity=1.0) - { - double x1,x2,y1,y2,r; - grad.get_control_points(x1,y1,x2,y2,r); - if (grad.get_gradient_type() == LINEAR) - { - pattern_ = Cairo::LinearGradient::create(x1, y1, x2, y2); - } - else if (grad.get_gradient_type() == RADIAL) - { - pattern_ = Cairo::RadialGradient::create(x1, y1, 0, x2, y2, r); - } - - units_ = grad.get_units(); - - BOOST_FOREACH ( mapnik::stop_pair const& st, grad.get_stop_array() ) - { - mapnik::color const& stop_color = st.second; - double r= static_cast (stop_color.red())/255.0; - double g= static_cast (stop_color.green())/255.0; - double b= static_cast (stop_color.blue())/255.0; - double a= static_cast (stop_color.alpha())/255.0; - pattern_->add_color_stop_rgba(st.first, r, g, b, a*opacity); - } - - double m[6]; - agg::trans_affine tr = grad.get_transform(); - tr.invert(); - tr.store_to(m); - pattern_->set_matrix(Cairo::Matrix(m[0],m[1],m[2],m[3],m[4],m[5])); - } - - ~cairo_gradient() - { - } - - - Cairo::RefPtr const& gradient() const + cairo_save_restore(cairo_context & context) + : context_(context) { - return pattern_; + context_.save(); } - - gradient_unit_e units() const + ~cairo_save_restore() { - return units_; + context_.restore(); } - -private: - Cairo::RefPtr pattern_; - gradient_unit_e units_; - + cairo_context & context_; }; -class cairo_face : private boost::noncopyable -{ -public: - cairo_face(boost::shared_ptr const& engine, face_ptr const& face) - : face_(face) - { - static cairo_user_data_key_t key; - cairo_font_face_t *c_face; - - c_face = cairo_ft_font_face_create_for_ft_face(face->get_face(), FT_LOAD_NO_HINTING); - cairo_font_face_set_user_data(c_face, &key, new handle(engine, face), destroy); - - cairo_face_ = Cairo::RefPtr(new Cairo::FontFace(c_face)); - } - - Cairo::RefPtr const& face() const - { - return cairo_face_; - } - -private: - class handle - { - public: - handle(boost::shared_ptr const& engine, face_ptr const& face) - : engine_(engine), face_(face) {} - - private: - boost::shared_ptr engine_; - face_ptr face_; - }; - - static void destroy(void *data) - { - handle *h = static_cast(data); - - delete h; - } - -private: - face_ptr face_; - Cairo::RefPtr cairo_face_; -}; cairo_face_manager::cairo_face_manager(boost::shared_ptr engine) : font_engine_(engine) @@ -261,512 +119,58 @@ return entry; } -class cairo_context : private boost::noncopyable -{ -public: - cairo_context(Cairo::RefPtr const& context) - : context_(context) - { - context_->save(); - } - - ~cairo_context() - { - context_->restore(); - } - - void set_color(color const &color, double opacity = 1.0) - { - set_color(color.red(), color.green(), color.blue(), color.alpha() * opacity / 255.0); - } - - void set_color(int r, int g, int b, double opacity = 1.0) - { - context_->set_source_rgba(r / 255.0, g / 255.0, b / 255.0, opacity); - } - - void set_operator(composite_mode_e comp_op) - { - switch (comp_op) - { - case clear: - context_->set_operator(Cairo::OPERATOR_CLEAR); - break; - case src: - context_->set_operator(Cairo::OPERATOR_SOURCE); - break; - case dst: - context_->set_operator(Cairo::OPERATOR_DEST); - break; - case src_over: - context_->set_operator(Cairo::OPERATOR_OVER); - break; - case dst_over: - context_->set_operator(Cairo::OPERATOR_DEST_OVER); - break; - case src_in: - context_->set_operator(Cairo::OPERATOR_IN); - break; - case dst_in: - context_->set_operator(Cairo::OPERATOR_DEST_IN); - break; - case src_out: - context_->set_operator(Cairo::OPERATOR_OUT); - break; - case dst_out: - context_->set_operator(Cairo::OPERATOR_DEST_OUT); - break; - case src_atop: - context_->set_operator(Cairo::OPERATOR_ATOP); - break; - case dst_atop: - context_->set_operator(Cairo::OPERATOR_DEST_ATOP); - break; - case _xor: - context_->set_operator(Cairo::OPERATOR_XOR); - break; - case plus: - context_->set_operator(Cairo::OPERATOR_ADD); - break; -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0) - case multiply: - context_->set_operator(static_cast(CAIRO_OPERATOR_MULTIPLY)); - break; - case screen: - context_->set_operator(static_cast(CAIRO_OPERATOR_SCREEN)); - break; - case overlay: - context_->set_operator(static_cast(CAIRO_OPERATOR_OVERLAY)); - break; - case darken: - context_->set_operator(static_cast(CAIRO_OPERATOR_DARKEN)); - break; - case lighten: - context_->set_operator(static_cast(CAIRO_OPERATOR_LIGHTEN)); - break; - case color_dodge: - context_->set_operator(static_cast(CAIRO_OPERATOR_COLOR_DODGE)); - break; - case color_burn: - context_->set_operator(static_cast(CAIRO_OPERATOR_COLOR_BURN)); - break; - case hard_light: - context_->set_operator(static_cast(CAIRO_OPERATOR_HARD_LIGHT)); - break; - case soft_light: - context_->set_operator(static_cast(CAIRO_OPERATOR_SOFT_LIGHT)); - break; - case difference: - context_->set_operator(static_cast(CAIRO_OPERATOR_DIFFERENCE)); - break; - case exclusion: - context_->set_operator(static_cast(CAIRO_OPERATOR_EXCLUSION)); - break; -#else -#warning building against cairo older that 1.10.0, some compositing options are disabled - case multiply: - case screen: - case overlay: - case darken: - case lighten: - case color_dodge: - case color_burn: - case hard_light: - case soft_light: - case difference: - case exclusion: - break; -#endif - case contrast: - case minus: - case invert: - case invert_rgb: - case grain_merge: - case grain_extract: - case hue: - case saturation: - case _color: - case _value: - //case colorize_alpha: - break; - } - } - - void set_line_join(line_join_e join) - { - if (join == MITER_JOIN) - context_->set_line_join(Cairo::LINE_JOIN_MITER); - else if (join == MITER_REVERT_JOIN) - context_->set_line_join(Cairo::LINE_JOIN_MITER); - else if (join == ROUND_JOIN) - context_->set_line_join(Cairo::LINE_JOIN_ROUND); - else - context_->set_line_join(Cairo::LINE_JOIN_BEVEL); - } - - void set_line_cap(line_cap_e cap) - { - if (cap == BUTT_CAP) - context_->set_line_cap(Cairo::LINE_CAP_BUTT); - else if (cap == SQUARE_CAP) - context_->set_line_cap(Cairo::LINE_CAP_SQUARE); - else - context_->set_line_cap(Cairo::LINE_CAP_ROUND); - } - - void set_miter_limit(double limit) - { - context_->set_miter_limit(limit); - } - - void set_line_width(double width) - { - context_->set_line_width(width); - } - - void set_dash(dash_array const &dashes, double scale_factor) - { - std::valarray d(dashes.size() * 2); - dash_array::const_iterator itr = dashes.begin(); - dash_array::const_iterator end = dashes.end(); - int index = 0; - - for (; itr != end; ++itr) - { - d[index++] = itr->first * scale_factor; - d[index++] = itr->second * scale_factor; - } - - context_->set_dash(d, 0.0); - } - - void set_fill_rule(Cairo::FillRule fill_rule) - { - context_->set_fill_rule(fill_rule); - } - - void move_to(double x, double y) - { -#if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 6, 0) - if (x < -32767.0) x = -32767.0; - else if (x > 32767.0) x = 32767.0; - if (y < -32767.0) y = -32767.0; - else if (y > 32767.0) y = 32767.0; -#endif - - context_->move_to(x, y); - } - - void curve_to(double ct1_x, double ct1_y, double ct2_x, double ct2_y, double end_x, double end_y) - { - context_->curve_to(ct1_x,ct1_y,ct2_x,ct2_y,end_x,end_y); - } - - void close_path() - { - context_->close_path(); - } - - void line_to(double x, double y) - { -#if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 6, 0) - if (x < -32767.0) x = -32767.0; - else if (x > 32767.0) x = 32767.0; - if (y < -32767.0) y = -32767.0; - else if (y > 32767.0) y = 32767.0; -#endif - - context_->line_to(x, y); - } - - template - void add_path(T& path, unsigned start_index = 0) - { - double x, y; - - path.rewind(start_index); - - for (unsigned cm = path.vertex(&x, &y); cm != SEG_END; cm = path.vertex(&x, &y)) - { - if (cm == SEG_MOVETO) - { - move_to(x, y); - } - else if (cm == SEG_LINETO) - { - line_to(x, y); - } - else if (cm == SEG_CLOSE) - { - close_path(); - } - } - } - - template - void add_agg_path(T& path, unsigned start_index = 0) - { - double x=0; - double y=0; - - path.rewind(start_index); - - for (unsigned cm = path.vertex(&x, &y); !agg::is_stop(cm); cm = path.vertex(&x, &y)) - { - if (agg::is_move_to(cm)) - { - move_to(x, y); - } - else if (agg::is_drawing(cm)) - { - if (agg::is_curve3(cm)) - { - double end_x=0; - double end_y=0; - - MAPNIK_LOG_WARN(cairo_renderer) << "Curve 3 not implemented"; - - path.vertex(&end_x, &end_y); - - curve_to(x,y,x,y,end_x,end_y); - } - else if (agg::is_curve4(cm)) - { - double ct2_x=0; - double ct2_y=0; - double end_x=0; - double end_y=0; - - path.vertex(&ct2_x, &ct2_y); - path.vertex(&end_x, &end_y); - - curve_to(x,y,ct2_x,ct2_y,end_x,end_y); - } - else if (agg::is_line_to(cm)) - { - line_to(x, y); - } - else - { - MAPNIK_LOG_WARN(cairo_renderer) << "Unimplemented drawing command: " << cm; - move_to(x, y); - } - } - else if (agg::is_close(cm)) - { - close_path(); - } - else - { - MAPNIK_LOG_WARN(cairo_renderer) << "Unimplemented path command: " << cm; - } - } - } - - void rectangle(double x, double y, double w, double h) - { - context_->rectangle(x, y, w, h); - } - - void stroke() - { - context_->stroke(); - } - - void fill() - { - context_->fill(); - } - - void paint() - { - context_->paint(); - } - - void set_pattern(cairo_pattern const& pattern) - { - context_->set_source(pattern.pattern()); - } - - void set_gradient(cairo_gradient const& pattern, const box2d &bbox) - { - Cairo::RefPtr p = pattern.gradient(); - - double bx1=bbox.minx(); - double by1=bbox.miny(); - double bx2=bbox.maxx(); - double by2=bbox.maxy(); - if (pattern.units() != USER_SPACE_ON_USE) - { - if (pattern.units() == OBJECT_BOUNDING_BOX) - { - context_->get_path_extents (bx1, by1, bx2, by2); - } - Cairo::Matrix m = p->get_matrix(); - m.scale(1.0/(bx2-bx1),1.0/(by2-by1)); - m.translate(-bx1,-by1); - p->set_matrix(m); - } - - context_->set_source(p); - } - - void add_image(double x, double y, image_data_32 & data, double opacity = 1.0) - { - cairo_pattern pattern(data); - - pattern.set_origin(x, y); - - context_->save(); - context_->set_source(pattern.pattern()); - context_->paint_with_alpha(opacity); - context_->restore(); - } - - void add_image(agg::trans_affine const& tr, image_data_32 & data, double opacity = 1.0) - { - cairo_pattern pattern(data); - if (!tr.is_identity()) - { - double m[6]; - tr.store_to(m); - Cairo::Matrix cairo_matrix(m[0],m[1],m[2],m[3],m[4],m[5]); - cairo_matrix.invert(); - pattern.set_matrix(cairo_matrix); - } - context_->save(); - context_->set_source(pattern.pattern()); - context_->paint_with_alpha(opacity); - context_->restore(); - } - - - void set_font_face(cairo_face_manager & manager, face_ptr face) - { - context_->set_font_face(manager.get_face(face)->face()); - } - - void set_font_matrix(Cairo::Matrix const& matrix) - { - context_->set_font_matrix(matrix); - } - - void set_matrix(Cairo::Matrix const& matrix) - { - context_->set_matrix(matrix); - } - - void transform(Cairo::Matrix const& matrix) - { - context_->transform(matrix); - } - - void translate(double x, double y) - { - context_->translate(x,y); - } - - void save() - { - context_->save(); - } - - void restore() - { - context_->restore(); - } - - void show_glyph(unsigned long index, double x, double y) - { - Cairo::Glyph glyph; - - glyph.index = index; - glyph.x = x; - glyph.y = y; - - cairo_show_glyphs(context_->cobj(), &glyph, 1); - if (context_->get_status() != CAIRO_STATUS_SUCCESS) - { - throw std::runtime_error("cairo: show_glyph"); - } - } - - void glyph_path(unsigned long index, double x, double y) - { - Cairo::Glyph glyph; - - glyph.index = index; - glyph.x = x; - glyph.y = y; - - cairo_glyph_path(context_->cobj(), &glyph, 1); - if (context_->get_status() != CAIRO_STATUS_SUCCESS) - { - throw std::runtime_error("cairo: glyph_path"); - } - } - - void add_text(text_path const& path, - cairo_face_manager & manager, - face_manager &font_manager, - double scale_factor = 1.0) - { - double sx = path.center.x; - double sy = path.center.y; - - path.rewind(); - - for (int iii = 0; iii < path.num_nodes(); iii++) - { - char_info_ptr c; - double x, y, angle; - - path.vertex(&c, &x, &y, &angle); - - face_set_ptr faces = font_manager.get_face_set(c->format->face_name, c->format->fontset); - float text_size = c->format->text_size * scale_factor; - faces->set_character_sizes(text_size); - - glyph_ptr glyph = faces->get_glyph(c->c); - - if (glyph) - { - Cairo::Matrix matrix; - - matrix.xx = text_size * cos(angle); - matrix.xy = text_size * sin(angle); - matrix.yx = text_size * -sin(angle); - matrix.yy = text_size * cos(angle); - matrix.x0 = 0; - matrix.y0 = 0; - - set_font_matrix(matrix); - - set_font_face(manager, glyph->get_face()); - - glyph_path(glyph->get_index(), sx + x, sy - y); - set_line_width(2.0 * c->format->halo_radius * scale_factor); - set_line_join(ROUND_JOIN); - set_color(c->format->halo_fill); - stroke(); - set_color(c->format->fill); - show_glyph(glyph->get_index(), sx + x, sy - y); - } - } - } +cairo_renderer_base::cairo_renderer_base(Map const& m, + cairo_ptr const& cairo, + double scale_factor, + unsigned offset_x, + unsigned offset_y) + : m_(m), + context_(cairo), + width_(m.width()), + height_(m.height()), + scale_factor_(scale_factor), + t_(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y), + font_engine_(boost::make_shared()), + font_manager_(*font_engine_), + face_manager_(font_engine_), + detector_(boost::make_shared( + box2d(-m.buffer_size(), -m.buffer_size(), + m.width() + m.buffer_size(), m.height() + m.buffer_size()))) +{ + setup(m); +} -private: - Cairo::RefPtr context_; -}; +cairo_renderer_base::cairo_renderer_base(Map const& m, + request const& req, + cairo_ptr const& cairo, + double scale_factor, + unsigned offset_x, + unsigned offset_y) + : m_(m), + context_(cairo), + width_(req.width()), + height_(req.height()), + scale_factor_(scale_factor), + t_(req.width(),req.height(),req.extent(),offset_x,offset_y), + font_engine_(boost::make_shared()), + font_manager_(*font_engine_), + face_manager_(font_engine_), + detector_(boost::make_shared( + box2d(-req.buffer_size(), -req.buffer_size(), + req.width() + req.buffer_size(), req.height() + req.buffer_size()))) +{ + setup(m); +} cairo_renderer_base::cairo_renderer_base(Map const& m, - Cairo::RefPtr const& context, + cairo_ptr const& cairo, + boost::shared_ptr detector, double scale_factor, unsigned offset_x, unsigned offset_y) : m_(m), - context_(context), + context_(cairo), width_(m.width()), height_(m.height()), scale_factor_(scale_factor), @@ -774,56 +178,103 @@ font_engine_(boost::make_shared()), font_manager_(*font_engine_), face_manager_(font_engine_), - detector_(box2d(-m.buffer_size() ,-m.buffer_size() , m.width() + m.buffer_size() ,m.height() + m.buffer_size())) + detector_(detector) { MAPNIK_LOG_DEBUG(cairo_renderer) << "cairo_renderer_base: Scale=" << m.scale(); } template <> -cairo_renderer::cairo_renderer(Map const& m, Cairo::RefPtr const& context, double scale_factor, unsigned offset_x, unsigned offset_y) +cairo_renderer::cairo_renderer(Map const& m, cairo_ptr const& cairo, double scale_factor, unsigned offset_x, unsigned offset_y) : feature_style_processor(m,scale_factor), - cairo_renderer_base(m,context,scale_factor,offset_x,offset_y) {} + cairo_renderer_base(m,cairo,scale_factor,offset_x,offset_y) {} template <> -cairo_renderer::cairo_renderer(Map const& m, Cairo::RefPtr const& surface, double scale_factor, unsigned offset_x, unsigned offset_y) +cairo_renderer::cairo_renderer(Map const& m, cairo_surface_ptr const& surface, double scale_factor, unsigned offset_x, unsigned offset_y) : feature_style_processor(m,scale_factor), - cairo_renderer_base(m,Cairo::Context::create(surface),scale_factor,offset_x,offset_y) {} + cairo_renderer_base(m,create_context(surface),scale_factor,offset_x,offset_y) {} -cairo_renderer_base::~cairo_renderer_base() {} +template <> +cairo_renderer::cairo_renderer(Map const& m, request const& req, cairo_ptr const& cairo, double scale_factor, unsigned offset_x, unsigned offset_y) + : feature_style_processor(m,scale_factor), + cairo_renderer_base(m,req,cairo,scale_factor,offset_x,offset_y) {} -void cairo_renderer_base::start_map_processing(Map const& map) -{ - MAPNIK_LOG_DEBUG(cairo_renderer) << "cairo_renderer_base: Start map processing bbox=" << map.get_current_extent(); +template <> +cairo_renderer::cairo_renderer(Map const& m, request const& req, cairo_surface_ptr const& surface, double scale_factor, unsigned offset_x, unsigned offset_y) + : feature_style_processor(m,scale_factor), + cairo_renderer_base(m,req, create_context(surface),scale_factor,offset_x,offset_y) {} -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 6, 0) - box2d bounds = t_.forward(t_.extent()); - context_->rectangle(bounds.minx(), bounds.miny(), bounds.maxx(), bounds.maxy()); - context_->clip(); -#else -#warning building against cairo older that 1.6.0, map clipping is disabled -#endif +template <> +cairo_renderer::cairo_renderer(Map const& m, cairo_ptr const& cairo, boost::shared_ptr detector, double scale_factor, unsigned offset_x, unsigned offset_y) + : feature_style_processor(m,scale_factor), + cairo_renderer_base(m,cairo,detector,scale_factor,offset_x,offset_y) {} + +template <> +cairo_renderer::cairo_renderer(Map const& m, cairo_surface_ptr const& surface, boost::shared_ptr detector, double scale_factor, unsigned offset_x, unsigned offset_y) + : feature_style_processor(m,scale_factor), + cairo_renderer_base(m,create_context(surface),detector,scale_factor,offset_x,offset_y) {} + +cairo_renderer_base::~cairo_renderer_base() {} +void cairo_renderer_base::setup(Map const& map) +{ boost::optional bg = m_.background(); if (bg) { - cairo_context context(context_); - context.set_color(*bg); - context.paint(); + cairo_save_restore guard(context_); + context_.set_color(*bg); + context_.paint(); + } + boost::optional const& image_filename = map.background_image(); + if (image_filename) + { + // NOTE: marker_cache returns premultiplied image, if needed + boost::optional bg_marker = mapnik::marker_cache::instance().find(*image_filename,true); + if (bg_marker && (*bg_marker)->is_bitmap()) + { + mapnik::image_ptr bg_image = *(*bg_marker)->get_bitmap_data(); + int w = bg_image->width(); + int h = bg_image->height(); + if ( w > 0 && h > 0) + { + // repeat background-image both vertically and horizontally + unsigned x_steps = unsigned(std::ceil(width_/double(w))); + unsigned y_steps = unsigned(std::ceil(height_/double(h))); + for (unsigned x=0;x -void cairo_renderer::end_map_processing(Map const& ) +void cairo_renderer::end_map_processing(Map const& ) { MAPNIK_LOG_DEBUG(cairo_renderer) << "cairo_renderer_base: End map processing"; - context_->show_page(); + context_.show_page(); } void cairo_renderer_base::start_layer_processing(layer const& lay, box2d const& query_extent) @@ -834,7 +285,7 @@ if (lay.clear_label_cache()) { - detector_.clear(); + detector_->clear(); } query_extent_ = query_extent; } @@ -858,21 +309,22 @@ mapnik::feature_impl & feature, proj_transform const& prj_trans) { - cairo_context context(context_); - context.set_operator(sym.comp_op()); - context.set_color(sym.get_fill(), sym.get_opacity()); + cairo_save_restore guard(context_); + context_.set_operator(sym.comp_op()); + context_.set_color(sym.get_fill(), sym.get_opacity()); agg::trans_affine tr; evaluate_transform(tr, feature, sym.get_transform()); - typedef boost::mpl::vector conv_types; + typedef boost::mpl::vector conv_types; vertex_converter, cairo_context, polygon_symbolizer, CoordTransform, proj_transform, agg::trans_affine, conv_types> - converter(query_extent_,context,sym,t_,prj_trans,tr,1.0); + converter(query_extent_,context_,sym,t_,prj_trans,tr,1.0); if (prj_trans.equal() && sym.clip()) converter.set(); //optional clip (default: true) converter.set(); //always transform converter.set(); + if (sym.simplify_tolerance() > 0.0) converter.set(); // optional simplify converter if (sym.smooth() > 0.0) converter.set(); // optional smooth converter BOOST_FOREACH( geometry_type & geom, feature.paths()) @@ -883,7 +335,7 @@ } } // fill polygon - context.fill(); + context_.fill(); } void cairo_renderer_base::process(building_symbolizer const& sym, @@ -891,15 +343,14 @@ proj_transform const& prj_trans) { typedef coord_transform path_type; - - cairo_context context(context_); - context.set_operator(sym.comp_op()); + cairo_save_restore guard(context_); + context_.set_operator(sym.comp_op()); color const& fill = sym.get_fill(); double height = 0.0; expression_ptr height_expr = sym.height(); if (height_expr) { - value_type result = boost::apply_visitor(evaluate(feature), *height_expr); + value_type result = boost::apply_visitor(evaluate(feature), *height_expr); height = result.to_double() * scale_factor_; } @@ -923,11 +374,15 @@ { frame->move_to(x,y); } - else if (cm == SEG_LINETO || cm == SEG_CLOSE) + else if (cm == SEG_LINETO) { frame->line_to(x,y); face_segments.push_back(segment_t(x0,y0,x,y)); } + else if (cm == SEG_CLOSE) + { + frame->close_path(); + } x0 = x; y0 = y; } @@ -944,10 +399,10 @@ faces->line_to(itr->get<0>(), itr->get<1>() + height); path_type faces_path(t_, *faces, prj_trans); - context.set_color(int(fill.red() * 0.8), int(fill.green() * 0.8), - int(fill.blue() * 0.8), fill.alpha() * sym.get_opacity() / 255.0); - context.add_path(faces_path); - context.fill(); + context_.set_color(fill.red() * 0.8 / 255.0, fill.green() * 0.8 / 255.0, + fill.blue() * 0.8 / 255.0, fill.alpha() * sym.get_opacity() / 255.0); + context_.add_path(faces_path); + context_.fill(); frame->move_to(itr->get<0>(), itr->get<1>()); frame->line_to(itr->get<0>(), itr->get<1>() + height); @@ -962,23 +417,29 @@ frame->move_to(x,y+height); roof->move_to(x,y+height); } - else if (cm == SEG_LINETO || cm == SEG_CLOSE) + else if (cm == SEG_LINETO) { frame->line_to(x,y+height); roof->line_to(x,y+height); } + else if (cm == SEG_CLOSE) + { + frame->close_path(); + roof->close_path(); + } } path_type path(t_, *frame, prj_trans); - context.set_color(fill.red()*0.8, fill.green()*0.8, fill.blue()*0.8,sym.get_opacity()); - context.set_line_width(scale_factor_); - context.add_path(path); - context.stroke(); + context_.set_color(fill.red() * 0.8 / 255.0, fill.green() * 0.8/255.0, + fill.blue() * 0.8 / 255.0, fill.alpha() * sym.get_opacity() / 255.0); + context_.set_line_width(scale_factor_); + context_.add_path(path); + context_.stroke(); path_type roof_path(t_, *roof, prj_trans); - context.set_color(fill, fill.alpha() * sym.get_opacity() / 255.0 ); - context.add_path(roof_path); - context.fill(); + context_.set_color(fill, sym.get_opacity()); + context_.add_path(roof_path); + context_.fill(); } } } @@ -989,19 +450,18 @@ { typedef boost::mpl::vector conv_types; - cairo_context context(context_); + simplify_tag, smooth_tag, dash_tag, stroke_tag> conv_types; + cairo_save_restore guard(context_); mapnik::stroke const& stroke_ = sym.get_stroke(); - context.set_operator(sym.comp_op()); - - context.set_color(stroke_.get_color(), stroke_.get_opacity()); - context.set_line_join(stroke_.get_line_join()); - context.set_line_cap(stroke_.get_line_cap()); - context.set_miter_limit(stroke_.get_miterlimit()); - context.set_line_width(stroke_.get_width() * scale_factor_); + context_.set_operator(sym.comp_op()); + context_.set_color(stroke_.get_color(), stroke_.get_opacity()); + context_.set_line_join(stroke_.get_line_join()); + context_.set_line_cap(stroke_.get_line_cap()); + context_.set_miter_limit(stroke_.get_miterlimit()); + context_.set_line_width(stroke_.get_width() * scale_factor_); if (stroke_.has_dash()) { - context.set_dash(stroke_.get_dash_array(), scale_factor_); + context_.set_dash(stroke_.get_dash_array(), scale_factor_); } agg::trans_affine tr; @@ -1011,25 +471,23 @@ if (sym.clip()) { double padding = (double)(query_extent_.width()/width_); - float half_stroke = stroke_.get_width()/2.0; + double half_stroke = stroke_.get_width()/2.0; if (half_stroke > 1) padding *= half_stroke; - if (fabs(sym.offset()) > 0) - padding *= fabs(sym.offset()) * 1.2; - double x0 = query_extent_.minx(); - double y0 = query_extent_.miny(); - double x1 = query_extent_.maxx(); - double y1 = query_extent_.maxy(); - clipping_extent.init(x0 - padding, y0 - padding, x1 + padding , y1 + padding); + if (std::fabs(sym.offset()) > 0) + padding *= std::fabs(sym.offset()) * 1.2; + padding *= scale_factor_; + clipping_extent.pad(padding); } vertex_converter, cairo_context, line_symbolizer, CoordTransform, proj_transform, agg::trans_affine, conv_types> - converter(clipping_extent,context,sym,t_,prj_trans,tr,scale_factor_); + converter(clipping_extent,context_,sym,t_,prj_trans,tr,scale_factor_); if (sym.clip()) converter.set(); // optional clip (default: true) converter.set(); // always transform - if (fabs(sym.offset()) > 0.0) converter.set(); // parallel offset + if (std::fabs(sym.offset()) > 0.0) converter.set(); // parallel offset converter.set(); // optional affine transform + if (sym.simplify_tolerance() > 0.0) converter.set(); // optional simplify converter if (sym.smooth() > 0.0) converter.set(); // optional smooth converter BOOST_FOREACH( geometry_type & geom, feature.paths()) @@ -1040,19 +498,18 @@ } } // stroke - context.stroke(); + context_.stroke(); } void cairo_renderer_base::render_box(box2d const& b) { - cairo_context context(context_); - context.move_to(b.minx(), b.miny()); - context.line_to(b.minx(), b.maxy()); - context.line_to(b.maxx(), b.maxy()); - context.line_to(b.maxx(), b.miny()); - context.close_path(); - - context.stroke(); + cairo_save_restore guard(context_); + context_.move_to(b.minx(), b.miny()); + context_.line_to(b.minx(), b.maxy()); + context_.line_to(b.maxx(), b.maxy()); + context_.line_to(b.maxx(), b.miny()); + context_.close_path(); + context_.stroke(); } void render_vector_marker(cairo_context & context, pixel_position const& pos, mapnik::svg_storage_type & vmarker, @@ -1079,9 +536,7 @@ mapnik::svg::path_attributes const& attr = attributes[i]; if (!attr.visibility_flag) continue; - - context.save(); - + cairo_save_restore guard(context); transform = attr.transform; transform *= mtx; @@ -1092,7 +547,9 @@ { double m[6]; transform.store_to(m); - context.transform(Cairo::Matrix(m[0],m[1],m[2],m[3],m[4],m[5])); + cairo_matrix_t matrix; + cairo_matrix_init(&matrix,m[0],m[1],m[2],m[3],m[4],m[5]); + context.transform(matrix); } vertex_stl_adapter stl_storage(vmarker.source()); @@ -1103,11 +560,11 @@ context.add_agg_path(svg_path,attr.index); if (attr.even_odd_flag) { - context.set_fill_rule(Cairo::FILL_RULE_EVEN_ODD); + context.set_fill_rule(CAIRO_FILL_RULE_EVEN_ODD); } else { - context.set_fill_rule(Cairo::FILL_RULE_WINDING); + context.set_fill_rule(CAIRO_FILL_RULE_WINDING); } if(attr.fill_gradient.get_gradient_type() != NO_GRADIENT) { @@ -1119,7 +576,8 @@ else if(attr.fill_flag) { double fill_opacity = attr.fill_opacity * opacity * attr.fill_color.opacity(); - context.set_color(attr.fill_color.r,attr.fill_color.g,attr.fill_color.b, fill_opacity); + context.set_color(attr.fill_color.r/255.0,attr.fill_color.g/255.0, + attr.fill_color.b/255.0, fill_opacity); context.fill(); } } @@ -1140,7 +598,8 @@ else if (attr.stroke_flag) { double stroke_opacity = attr.stroke_opacity * opacity * attr.stroke_color.opacity(); - context.set_color(attr.stroke_color.r,attr.stroke_color.g,attr.stroke_color.b, stroke_opacity); + context.set_color(attr.stroke_color.r/255.0,attr.stroke_color.g/255.0, + attr.stroke_color.b/255.0, stroke_opacity); context.set_line_width(attr.stroke_width); context.set_line_cap(line_cap_enum(attr.line_cap)); context.set_line_join(line_join_enum(attr.line_join)); @@ -1148,31 +607,41 @@ context.stroke(); } } - - context.restore(); } } -void cairo_renderer_base::render_marker(pixel_position const& pos, marker const& marker, const agg::trans_affine & tr, double opacity, bool recenter) +void cairo_renderer_base::render_marker(pixel_position const& pos, + marker const& marker, + agg::trans_affine const& tr, + double opacity, + bool recenter) { - cairo_context context(context_); - + cairo_save_restore guard(context_); if (marker.is_vector()) { mapnik::svg_path_ptr vmarker = *marker.get_vector_data(); if (vmarker) { + agg::trans_affine marker_tr = tr; + marker_tr *=agg::trans_affine_scaling(scale_factor_); agg::pod_bvector const & attributes = vmarker->attributes(); - render_vector_marker(context, pos, *vmarker, attributes, tr, opacity, recenter); + render_vector_marker(context_, pos, *vmarker, attributes, marker_tr, opacity, recenter); } } else if (marker.is_bitmap()) { - agg::trans_affine matrix = tr; - matrix *= agg::trans_affine_translation(pos.x, pos.y); - context.add_image(matrix, **marker.get_bitmap_data(), opacity); + double width = (*marker.get_bitmap_data())->width(); + double height = (*marker.get_bitmap_data())->height(); + double cx = 0.5 * width; + double cy = 0.5 * height; + agg::trans_affine marker_tr; + marker_tr *= agg::trans_affine_translation(-cx,-cy); + marker_tr *= tr; + marker_tr *= agg::trans_affine_scaling(scale_factor_); + marker_tr *= agg::trans_affine_translation(pos.x,pos.y); + context_.add_image(marker_tr, **marker.get_bitmap_data(), opacity); } } @@ -1185,7 +654,7 @@ boost::optional marker; if ( !filename.empty() ) { - marker = marker_cache::instance()->find(filename, true); + marker = marker_cache::instance().find(filename, true); } else { @@ -1195,6 +664,15 @@ if (marker) { + box2d const& bbox = (*marker)->bounding_box(); + coord2d center = bbox.center(); + + agg::trans_affine tr; + evaluate_transform(tr, feature, sym.get_image_transform()); + agg::trans_affine_translation recenter(-center.x, -center.y); + agg::trans_affine recenter_tr = recenter * tr; + box2d label_ext = bbox * recenter_tr * agg::trans_affine_scaling(scale_factor_); + for (unsigned i = 0; i < feature.num_geometries(); ++i) { geometry_type const& geom = feature.get_geometry(i); @@ -1215,21 +693,14 @@ prj_trans.backward(x, y, z); t_.forward(&x, &y); - - double dx = 0.5 * (*marker)->width(); - double dy = 0.5 * (*marker)->height(); - agg::trans_affine tr = agg::trans_affine_scaling(scale_factor_); - evaluate_transform(tr, feature, sym.get_image_transform()); - box2d label_ext (-dx, -dy, dx, dy); - label_ext *= tr; - label_ext *= agg::trans_affine_translation(x,y); + label_ext.re_center(x,y); if (sym.get_allow_overlap() || - detector_.has_placement(label_ext)) + detector_->has_placement(label_ext)) { render_marker(pixel_position(x,y),**marker, tr, sym.get_opacity()); if (!sym.get_ignore_placement()) - detector_.insert(label_ext); + detector_->insert(label_ext); } } } @@ -1244,28 +715,25 @@ sym, feature, prj_trans, width_, height_, scale_factor_, - t_, font_manager_, detector_, query_extent_); - cairo_context context(context_); - context.set_operator(sym.comp_op()); + t_, font_manager_, *detector_, query_extent_); + + cairo_save_restore guard(context_); + context_.set_operator(sym.comp_op()); while (helper.next()) { placements_type const& placements = helper.placements(); for (unsigned int ii = 0; ii < placements.size(); ++ii) { - pixel_position marker_pos = helper.get_marker_position(placements[ii]); - double dx = 0.5 * helper.get_marker_width(); - double dy = 0.5 * helper.get_marker_height(); - agg::trans_affine marker_tr = agg::trans_affine_translation(-dx,-dy); - marker_tr *= agg::trans_affine_scaling(scale_factor_); - marker_tr *= agg::trans_affine_translation(dx,dy); - marker_tr *= helper.get_image_transform(); - render_marker(marker_pos, + pixel_position pos = helper.get_marker_position(placements[ii]); + pos.x += 0.5 * helper.get_marker_width(); + pos.y += 0.5 * helper.get_marker_height(); + render_marker(pos, helper.get_marker(), - marker_tr, + helper.get_image_transform(), sym.get_opacity()); - context.add_text(placements[ii], face_manager_, font_manager_, scale_factor_); + context_.add_text(placements[ii], face_manager_, font_manager_, scale_factor_); } } } @@ -1278,19 +746,19 @@ typedef coord_transform path_type; std::string filename = path_processor_type::evaluate( *sym.get_filename(), feature); - boost::optional marker = mapnik::marker_cache::instance()->find(filename,true); + boost::optional marker = mapnik::marker_cache::instance().find(filename,true); if (!marker && !(*marker)->is_bitmap()) return; unsigned width((*marker)->width()); unsigned height((*marker)->height()); - cairo_context context(context_); - context.set_operator(sym.comp_op()); + cairo_save_restore guard(context_); + context_.set_operator(sym.comp_op()); cairo_pattern pattern(**((*marker)->get_bitmap_data())); - pattern.set_extend(Cairo::EXTEND_REPEAT); - pattern.set_filter(Cairo::FILTER_BILINEAR); - context.set_line_width(height * scale_factor_); + pattern.set_extend(CAIRO_EXTEND_REPEAT); + pattern.set_filter(CAIRO_FILTER_BILINEAR); + context_.set_line_width(height * scale_factor_); for (unsigned i = 0; i < feature.num_geometries(); ++i) { @@ -1319,7 +787,7 @@ double angle = atan2(dy, dx); double offset = fmod(length, width); - Cairo::Matrix matrix; + cairo_matrix_t matrix; cairo_matrix_init_identity(&matrix); cairo_matrix_translate(&matrix,x0,y0); cairo_matrix_rotate(&matrix,angle); @@ -1328,11 +796,11 @@ pattern.set_matrix(matrix); - context.set_pattern(pattern); + context_.set_pattern(pattern); - context.move_to(x0, y0); - context.line_to(x, y); - context.stroke(); + context_.move_to(x0, y0); + context_.line_to(x, y); + context_.stroke(); length = length + hypot(x - x0, y - y0); } @@ -1351,18 +819,18 @@ typedef agg::conv_clip_polygon clipped_geometry_type; typedef coord_transform path_type; - cairo_context context(context_); - context.set_operator(sym.comp_op()); + cairo_save_restore guard(context_); + context_.set_operator(sym.comp_op()); std::string filename = path_processor_type::evaluate( *sym.get_filename(), feature); - boost::optional marker = mapnik::marker_cache::instance()->find(filename,true); + boost::optional marker = mapnik::marker_cache::instance().find(filename,true); if (!marker && !(*marker)->is_bitmap()) return; cairo_pattern pattern(**((*marker)->get_bitmap_data())); - pattern.set_extend(Cairo::EXTEND_REPEAT); + pattern.set_extend(CAIRO_EXTEND_REPEAT); - context.set_pattern(pattern); + context_.set_pattern(pattern); //pattern_alignment_e align = sym.get_alignment(); //unsigned offset_x=0; @@ -1386,14 +854,15 @@ agg::trans_affine tr; evaluate_transform(tr, feature, sym.get_transform()); - typedef boost::mpl::vector conv_types; + typedef boost::mpl::vector conv_types; vertex_converter, cairo_context, polygon_pattern_symbolizer, CoordTransform, proj_transform, agg::trans_affine, conv_types> - converter(query_extent_,context,sym,t_,prj_trans,tr, scale_factor_); + converter(query_extent_,context_,sym,t_,prj_trans,tr, scale_factor_); if (prj_trans.equal() && sym.clip()) converter.set(); //optional clip (default: true) converter.set(); //always transform converter.set(); + if (sym.simplify_tolerance() > 0.0) converter.set(); // optional simplify converter if (sym.smooth() > 0.0) converter.set(); // optional smooth converter BOOST_FOREACH( geometry_type & geom, feature.paths()) @@ -1404,7 +873,7 @@ } } // fill polygon - context.fill(); + context_.fill(); } void cairo_renderer_base::process(raster_symbolizer const& sym, @@ -1422,22 +891,37 @@ box2d target_ext = box2d(source->ext_); prj_trans.backward(target_ext, PROJ_ENVELOPE_POINTS); box2d ext = t_.forward(target_ext); - int start_x = static_cast(ext.minx()); - int start_y = static_cast(ext.miny()); - int end_x = static_cast(ceil(ext.maxx())); - int end_y = static_cast(ceil(ext.maxy())); + int start_x = static_cast(std::floor(ext.minx()+.5)); + int start_y = static_cast(std::floor(ext.miny()+.5)); + int end_x = static_cast(std::floor(ext.maxx()+.5)); + int end_y = static_cast(std::floor(ext.maxy()+.5)); int raster_width = end_x - start_x; int raster_height = end_y - start_y; if (raster_width > 0 && raster_height > 0) { - image_data_32 target_data(raster_width,raster_height); - raster target(target_ext, target_data); + raster target(target_ext, raster_width,raster_height); scaling_method_e scaling_method = sym.get_scaling_method(); double filter_radius = sym.calculate_filter_factor(); - double offset_x = ext.minx() - start_x; - double offset_y = ext.miny() - start_y; + bool premultiply_source = !source->premultiplied_alpha_; + boost::optional is_premultiplied = sym.premultiplied(); + if (is_premultiplied) + { + if (*is_premultiplied) premultiply_source = false; + else premultiply_source = true; + } + if (premultiply_source) + { + agg::rendering_buffer buffer(source->data_.getBytes(), + source->data_.width(), + source->data_.height(), + source->data_.width() * 4); + agg::pixfmt_rgba32 pixf(buffer); + pixf.premultiply(); + } if (!prj_trans.equal()) { + double offset_x = ext.minx() - start_x; + double offset_y = ext.miny() - start_y; reproject_and_scale_raster(target, *source, prj_trans, offset_x, offset_y, sym.get_mesh_size(), @@ -1446,22 +930,30 @@ } else { - if (scaling_method == SCALING_BILINEAR8){ - scale_image_bilinear8(target.data_,source->data_, offset_x, offset_y); - } else { - double scaling_ratio = ext.width() / source->data_.width(); + if (scaling_method == SCALING_BILINEAR8) + { + scale_image_bilinear8(target.data_, + source->data_, + 0.0, + 0.0); + } + else + { + double image_ratio_x = ext.width() / source->data_.width(); + double image_ratio_y = ext.height() / source->data_.height(); scale_image_agg(target.data_, source->data_, scaling_method, - scaling_ratio, - offset_x, - offset_y, + image_ratio_x, + image_ratio_y, + 0.0, + 0.0, filter_radius); } } - cairo_context context(context_); - context.set_operator(sym.comp_op()); - context.add_image(start_x, start_y, target.data_, sym.get_opacity()); + cairo_save_restore guard(context_); + context_.set_operator(sym.comp_op()); + context_.add_image(start_x, start_y, target.data_, sym.get_opacity()); } } } @@ -1494,11 +986,17 @@ { marker_placement_e placement_method = sym_.get_marker_placement(); - if (placement_method != MARKER_LINE_PLACEMENT) + if (placement_method != MARKER_LINE_PLACEMENT || + path.type() == Point) { double x = 0; double y = 0; - if (placement_method == MARKER_INTERIOR_PLACEMENT) + if (path.type() == LineString) + { + if (!label::middle_point(path, x, y)) + return; + } + else if (placement_method == MARKER_INTERIOR_PLACEMENT) { if (!label::interior_position(path, x, y)) return; @@ -1577,11 +1075,17 @@ { marker_placement_e placement_method = sym_.get_marker_placement(); - if (placement_method != MARKER_LINE_PLACEMENT) + if (placement_method != MARKER_LINE_PLACEMENT || + path.type() == Point) { double x = 0; double y = 0; - if (placement_method == MARKER_INTERIOR_PLACEMENT) + if (path.type() == LineString) + { + if (!label::middle_point(path, x, y)) + return; + } + else if (placement_method == MARKER_INTERIOR_PLACEMENT) { if (!label::interior_position(path, x, y)) return; @@ -1643,8 +1147,8 @@ { typedef boost::mpl::vector conv_types; - cairo_context context(context_); - context.set_operator(sym.comp_op()); + cairo_save_restore guard(context_); + context_.set_operator(sym.comp_op()); agg::trans_affine tr = agg::trans_affine_scaling(scale_factor_); @@ -1652,13 +1156,13 @@ if (!filename.empty()) { - boost::optional mark = mapnik::marker_cache::instance()->find(filename, true); + boost::optional mark = mapnik::marker_cache::instance().find(filename, true); if (mark && *mark) { agg::trans_affine geom_tr; evaluate_transform(geom_tr, feature, sym.get_transform()); box2d const& bbox = (*mark)->bounding_box(); - setup_transform_scaling(tr, bbox, feature, sym); + setup_transform_scaling(tr, bbox.width(), bbox.height(), feature, sym); evaluate_transform(tr, feature, sym.get_image_transform()); if ((*mark)->is_vector()) @@ -1686,10 +1190,10 @@ bool result = push_explicit_style( (*stock_vector_marker)->attributes(), attributes, sym); agg::trans_affine marker_tr = agg::trans_affine_scaling(scale_factor_); evaluate_transform(marker_tr, feature, sym.get_image_transform()); - box2d bbox = marker_ellipse.bounding_box(); + box2d new_bbox = marker_ellipse.bounding_box(); - dispatch_type dispatch(context, marker_ellipse, result?attributes:(*stock_vector_marker)->attributes(), - detector_, sym, bbox, marker_tr, scale_factor_); + dispatch_type dispatch(context_, marker_ellipse, result?attributes:(*stock_vector_marker)->attributes(), + *detector_, sym, new_bbox, marker_tr, scale_factor_); vertex_converter, dispatch_type, markers_symbolizer, CoordTransform, proj_transform, agg::trans_affine, conv_types> converter(query_extent_, dispatch, sym, t_, prj_trans, marker_tr, scale_factor_); @@ -1706,18 +1210,15 @@ } converter.set(); //always transform if (sym.smooth() > 0.0) converter.set(); // optional smooth converter - BOOST_FOREACH(geometry_type & geom, feature.paths()) - { - converter.apply(geom); - } + apply_markers_multi(feature, converter, sym); } else { svg_attributes_type attributes; bool result = push_explicit_style( (*stock_vector_marker)->attributes(), attributes, sym); - dispatch_type dispatch(context, **stock_vector_marker, result?attributes:(*stock_vector_marker)->attributes(), - detector_, sym, bbox, tr, scale_factor_); + dispatch_type dispatch(context_, **stock_vector_marker, result?attributes:(*stock_vector_marker)->attributes(), + *detector_, sym, bbox, tr, scale_factor_); vertex_converter, dispatch_type, markers_symbolizer, CoordTransform, proj_transform, agg::trans_affine, conv_types> converter(query_extent_, dispatch, sym, t_, prj_trans, tr, scale_factor_); @@ -1734,10 +1235,7 @@ } converter.set(); //always transform if (sym.smooth() > 0.0) converter.set(); // optional smooth converter - BOOST_FOREACH(geometry_type & geom, feature.paths()) - { - converter.apply(geom); - } + apply_markers_multi(feature, converter, sym); } } else // raster markers @@ -1748,8 +1246,8 @@ boost::optional marker = (*mark)->get_bitmap_data(); if ( marker ) { - dispatch_type dispatch(context, *marker, - detector_, sym, bbox, tr, scale_factor_); + dispatch_type dispatch(context_, *marker, + *detector_, sym, bbox, tr, scale_factor_); vertex_converter, dispatch_type, markers_symbolizer, CoordTransform, proj_transform, agg::trans_affine, conv_types> @@ -1767,10 +1265,7 @@ } converter.set(); //always transform if (sym.smooth() > 0.0) converter.set(); // optional smooth converter - BOOST_FOREACH(geometry_type & geom, feature.paths()) - { - converter.apply(geom); - } + apply_markers_multi(feature, converter, sym); } } } @@ -1786,23 +1281,23 @@ sym, feature, prj_trans, width_, height_, scale_factor_, - t_, font_manager_, detector_, query_extent_); + t_, font_manager_, *detector_, query_extent_); - cairo_context context(context_); - context.set_operator(sym.comp_op()); + cairo_save_restore guard(context_); + context_.set_operator(sym.comp_op()); while (helper.next()) { placements_type const& placements = helper.placements(); for (unsigned int ii = 0; ii < placements.size(); ++ii) { - context.add_text(placements[ii], face_manager_, font_manager_, scale_factor_); + context_.add_text(placements[ii], face_manager_, font_manager_, scale_factor_); } } } -template class cairo_renderer; -template class cairo_renderer; +template class cairo_renderer; +template class cairo_renderer; } #endif // HAVE_CAIRO diff -Nru mapnik-2.1.0/src/color.cpp mapnik-2.2.0/src/color.cpp --- mapnik-2.1.0/src/color.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/color.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,24 +25,20 @@ #include #include +// agg +#include "agg_color_rgba.h" + // boost #include -#include // stl #include -#include - namespace mapnik { -color::color( std::string const& css_string) - : red_(0), - green_(0), - blue_(0), - alpha_(0xff) +color::color(std::string const& str) { - color_factory::init_from_string(*this,css_string); + *this = parse_color(str); } std::string color::to_string() const @@ -51,17 +47,17 @@ if (alpha_ == 255) { ss << "rgb(" - << red() << "," - << green() << "," - << blue() << ")"; + << static_cast(red()) << "," + << static_cast(green()) << "," + << static_cast(blue()) << ")"; } else { ss << "rgba(" - << red() << "," - << green() << "," - << blue() << "," - << alpha()/255.0 << ")"; + << static_cast(red()) << "," + << static_cast(green()) << "," + << static_cast(blue()) << "," + << alpha() / 255.0 << ")"; } return ss.str(); } @@ -71,104 +67,37 @@ if (alpha_ == 255 ) { return (boost::format("#%1$02x%2$02x%3$02x") - % red() - % green() - % blue() ).str(); + % static_cast(red()) + % static_cast(green()) + % static_cast(blue())).str(); } else { return (boost::format("#%1$02x%2$02x%3$02x%4$02x") - % red() - % green() - % blue() - % alpha()).str(); + % static_cast(red()) + % static_cast(green()) + % static_cast(blue()) + % static_cast(alpha())).str(); } } - -/****************************************************************************/ -void color_factory::init_from_string(color & c, std::string const& css_color) +void color::premultiply() { - typedef std::string::const_iterator iterator_type; - typedef mapnik::css_color_grammar css_color_grammar; - - css_color_grammar g; - iterator_type first = css_color.begin(); - iterator_type last = css_color.end(); - // boost 1.41 -> 1.44 compatibility, to be removed in mapnik 2.1 (dane) -#if BOOST_VERSION >= 104500 - bool result = - boost::spirit::qi::phrase_parse(first, - last, - g, - boost::spirit::ascii::space, - c); - if (!result) - { - throw config_error(std::string("Failed to parse color value: ") + - "Expected a CSS color, but got '" + css_color + "'"); - } -#else - mapnik::css css_; - bool result = - boost::spirit::qi::phrase_parse(first, - last, - g, - boost::spirit::ascii::space, - css_); - if (!result) - { - throw config_error(std::string("Failed to parse color value: ") + - "Expected a CSS color, but got '" + css_color + "'"); - } - c.set_red(css_.r); - c.set_green(css_.g); - c.set_blue(css_.b); - c.set_alpha(css_.a); -#endif + agg::rgba8 pre_c = agg::rgba8(red_,green_,blue_,alpha_); + pre_c.premultiply(); + red_ = pre_c.r; + green_ = pre_c.g; + blue_ = pre_c.b; } -bool color_factory::parse_from_string(color & c, std::string const& css_color, - mapnik::css_color_grammar const& g) +void color::demultiply() { - std::string::const_iterator first = css_color.begin(); - std::string::const_iterator last = css_color.end(); - // boost 1.41 -> 1.44 compatibility, to be removed in mapnik 2.1 (dane) -#if BOOST_VERSION >= 104500 - bool result = - boost::spirit::qi::phrase_parse(first, - last, - g, - boost::spirit::ascii::space, - c); - return result && (first == last); -#else - mapnik::css css_; - bool result = - boost::spirit::qi::phrase_parse(first, - last, - g, - boost::spirit::ascii::space, - css_); - if (result && (first == last)) - { - c.set_red(css_.r); - c.set_green(css_.g); - c.set_blue(css_.b); - c.set_alpha(css_.a); - return true; - } - return false; -#endif + // note: this darkens too much: https://github.com/mapnik/mapnik/issues/1519 + agg::rgba8 pre_c = agg::rgba8(red_,green_,blue_,alpha_); + pre_c.demultiply(); + red_ = pre_c.r; + green_ = pre_c.g; + blue_ = pre_c.b; } - -color color_factory::from_string(std::string const& css_color) -{ - color c; - init_from_string(c, css_color); - return c; } - -} - diff -Nru mapnik-2.1.0/src/color_factory.cpp mapnik-2.2.0/src/color_factory.cpp --- mapnik-2.1.0/src/color_factory.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/color_factory.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,76 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include +#include +#include +#include + +// boost +#include +#include + +// stl +#include + + +namespace mapnik { + +color parse_color(std::string const& str) +{ + css_color_grammar g; + return parse_color(str, g); +} + +color parse_color(std::string const& str, + css_color_grammar const& g) +{ + color c; + + std::string::const_iterator first = str.begin(); + std::string::const_iterator last = str.end(); + + // boost 1.41 -> 1.44 compatibility, to be removed in mapnik 2.1 (dane) +#if BOOST_VERSION >= 104500 + bool result = boost::spirit::qi::phrase_parse(first, last, g, + boost::spirit::ascii::space, + c); +#else + mapnik::css css_; + bool result = boost::spirit::qi::phrase_parse(first, last, g, + boost::spirit::ascii::space, + css_); + c.set_red(css_.r); + c.set_green(css_.g); + c.set_blue(css_.b); + c.set_alpha(css_.a); + +#endif + + if (result && (first == last)) + return c; + else + throw config_error( "Failed to parse color: \"" + str + "\"" ); +} + +} diff -Nru mapnik-2.1.0/src/config_error.cpp mapnik-2.2.0/src/config_error.cpp --- mapnik-2.1.0/src/config_error.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/config_error.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -1,35 +1,61 @@ #include #include +#include namespace mapnik { config_error::config_error(std::string const& what) - : what_(what), line_number_(0), file_(), node_name_(), msg_() + : what_(what), + line_number_(0), + file_(), + node_name_(), + msg_() { } -config_error::config_error(std::string const& what, xml_node const& node) - : what_(what), line_number_(node.line()), file_(node.filename()), node_name_(node.name()), msg_() +config_error::config_error(std::string const& what, + xml_node const& node) + : what_(what), + line_number_(node.line()), + file_(node.filename()), + node_name_(node.name()), + msg_() { } -config_error::config_error(std::string const& what, unsigned line_number, std::string const& filename) - : what_(what), line_number_(line_number), file_(filename), node_name_(), msg_() +config_error::config_error(std::string const& what, + unsigned line_number, + std::string const& filename) + : what_(what), + line_number_(line_number), + file_(filename), + node_name_(), + msg_() { - } char const* config_error::what() const throw() { - std::stringstream s; - s << what_; - if (!node_name_.empty()) s << " in " << node_name_; - if (line_number_ > 0) s << " at line " << line_number_; - if (!file_.empty()) s << " of '" << file_ << "'"; - msg_ = s.str(); //Avoid returning pointer to dead object + msg_ = what_; + if (!node_name_.empty()) + { + msg_ += " in " + node_name_; + } + if (line_number_ > 0) + { + std::string number; + if (util::to_string(number,line_number_)) + { + msg_ += " at line " + number; + } + } + if (!file_.empty()) + { + msg_ += " of '" + file_ + "'"; + } return msg_.c_str(); } diff -Nru mapnik-2.1.0/src/conversions.cpp mapnik-2.2.0/src/conversions.cpp --- mapnik-2.1.0/src/conversions.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/conversions.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,10 +22,16 @@ // mapnik #include +#include + +#include -// boost #include +#if _MSC_VER +#define snprintf _snprintf +#endif + #define BOOST_SPIRIT_AUTO(domain_, name, expr) \ typedef boost::proto::result_of:: \ deep_copy::type name##_expr_type; \ @@ -33,77 +39,232 @@ boost::spirit::domain_::domain, name##_expr_type); \ BOOST_AUTO(name, boost::proto::deep_copy(expr)); \ +// karma is used by default unless +// the boost version is too old +#define MAPNIK_KARMA_TO_STRING + +#ifdef MAPNIK_KARMA_TO_STRING + #include + #if BOOST_VERSION < 104500 + #undef MAPNIK_KARMA_TO_STRING + #else + #include + #endif +#endif -namespace mapnik { namespace util { +namespace mapnik { + +namespace util { using namespace boost::spirit; BOOST_SPIRIT_AUTO(qi, INTEGER, qi::int_) +#ifdef BIGINT +BOOST_SPIRIT_AUTO(qi, LONGLONG, qi::long_long) +#endif BOOST_SPIRIT_AUTO(qi, FLOAT, qi::float_) BOOST_SPIRIT_AUTO(qi, DOUBLE, qi::double_) -bool string2int(const char * value, int & result) +struct bool_symbols : qi::symbols +{ + bool_symbols() + { + add("true",true) + ("false",false) + ("yes",true) + ("no",false) + ("on",true) + ("off",false) + ("1",true) + ("0",false); + } +}; + +bool string2bool(const char * iter, const char * end, bool & result) +{ + using boost::spirit::qi::no_case; + bool r = qi::phrase_parse(iter,end, no_case[bool_symbols()] ,ascii::space,result); + return r && (iter == end); +} + +bool string2bool(std::string const& value, bool & result) +{ + using boost::spirit::qi::no_case; + std::string::const_iterator str_beg = value.begin(); + std::string::const_iterator str_end = value.end(); + bool r = qi::phrase_parse(str_beg,str_end,no_case[bool_symbols()],ascii::space,result); + return r && (str_beg == str_end); +} + +bool string2int(const char * iter, const char * end, int & result) { - size_t length = strlen(value); - if (length < 1 || value == NULL) - return false; - const char *iter = value; - const char *end = value + length; bool r = qi::phrase_parse(iter,end,INTEGER,ascii::space,result); return r && (iter == end); } bool string2int(std::string const& value, int & result) { - if (value.empty()) - return false; std::string::const_iterator str_beg = value.begin(); std::string::const_iterator str_end = value.end(); bool r = qi::phrase_parse(str_beg,str_end,INTEGER,ascii::space,result); return r && (str_beg == str_end); } +#ifdef BIGINT +bool string2int(const char * iter, const char * end, mapnik::value_integer & result) +{ + bool r = qi::phrase_parse(iter,end,LONGLONG,ascii::space,result); + return r && (iter == end); +} + +bool string2int(std::string const& value, mapnik::value_integer & result) +{ + std::string::const_iterator str_beg = value.begin(); + std::string::const_iterator str_end = value.end(); + bool r = qi::phrase_parse(str_beg,str_end,LONGLONG,ascii::space,result); + return r && (str_beg == str_end); +} +#endif + bool string2double(std::string const& value, double & result) { - if (value.empty()) - return false; std::string::const_iterator str_beg = value.begin(); std::string::const_iterator str_end = value.end(); bool r = qi::phrase_parse(str_beg,str_end,DOUBLE,ascii::space,result); return r && (str_beg == str_end); } -bool string2double(const char * value, double & result) +bool string2double(const char * iter, const char * end, double & result) { - size_t length = strlen(value); - if (length < 1 || value == NULL) - return false; - const char *iter = value; - const char *end = value + length; bool r = qi::phrase_parse(iter,end,DOUBLE,ascii::space,result); return r && (iter == end); } bool string2float(std::string const& value, float & result) { - if (value.empty()) - return false; std::string::const_iterator str_beg = value.begin(); std::string::const_iterator str_end = value.end(); bool r = qi::phrase_parse(str_beg,str_end,FLOAT,ascii::space,result); return r && (str_beg == str_end); } -bool string2float(const char * value, float & result) +bool string2float(const char * iter, const char * end, float & result) { - size_t length = strlen(value); - if (length < 1 || value == NULL) - return false; - const char *iter = value; - const char *end = value + length; bool r = qi::phrase_parse(iter,end,FLOAT,ascii::space,result); return r && (iter == end); } +// double conversion - here we use sprintf over karma to work +// around https://github.com/mapnik/mapnik/issues/1741 +bool to_string(std::string & s, double val) +{ + s.resize(s.capacity()); + while (true) + { + size_t n2 = static_cast(snprintf(&s[0], s.size()+1, "%g", val)); + if (n2 <= s.size()) + { + s.resize(n2); + break; + } + s.resize(n2); + } + return true; } + +#ifdef MAPNIK_KARMA_TO_STRING + +bool to_string(std::string & str, int value) +{ + namespace karma = boost::spirit::karma; + std::back_insert_iterator sink(str); + return karma::generate(sink, value); +} + +#ifdef BIGINT +bool to_string(std::string & str, mapnik::value_integer value) +{ + namespace karma = boost::spirit::karma; + std::back_insert_iterator sink(str); + return karma::generate(sink, value); +} +#endif + +bool to_string(std::string & str, unsigned value) +{ + namespace karma = boost::spirit::karma; + std::back_insert_iterator sink(str); + return karma::generate(sink, value); +} + +bool to_string(std::string & str, bool value) +{ + namespace karma = boost::spirit::karma; + std::back_insert_iterator sink(str); + return karma::generate(sink, value); +} + +#else + +bool to_string(std::string & s, int val) +{ + s.resize(s.capacity()); + while (true) + { + size_t n2 = static_cast(snprintf(&s[0], s.size()+1, "%d", val)); + if (n2 <= s.size()) + { + s.resize(n2); + break; + } + s.resize(n2); + } + return true; +} + +#ifdef BIGINT +bool to_string(std::string & s, mapnik::value_integer val) +{ + s.resize(s.capacity()); + while (true) + { + size_t n2 = static_cast(snprintf(&s[0], s.size()+1, "%lld", val)); + if (n2 <= s.size()) + { + s.resize(n2); + break; + } + s.resize(n2); + } + return true; +} +#endif + +bool to_string(std::string & s, unsigned val) +{ + s.resize(s.capacity()); + while (true) + { + size_t n2 = static_cast(snprintf(&s[0], s.size()+1, "%u", val)); + if (n2 <= s.size()) + { + s.resize(n2); + break; + } + s.resize(n2); + } + return true; +} + +bool to_string(std::string & s, bool val) +{ + if (val) s = "true"; + else s = "false"; + return true; +} + +#endif + +} // end namespace util + } diff -Nru mapnik-2.1.0/src/css_color_grammar.cpp mapnik-2.2.0/src/css_color_grammar.cpp --- mapnik-2.1.0/src/css_color_grammar.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/css_color_grammar.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,7 +25,7 @@ #if BOOST_VERSION >= 104500 -#include +#include namespace mapnik { @@ -183,87 +183,8 @@ ; } -double hue_to_rgb( double m1, double m2, double h) -{ - if (h < 0.0) h = h + 1.0; - else if (h > 1) h = h - 1.0; - - if (h * 6 < 1.0) - return m1 + (m2 - m1) * h * 6.0; - if (h * 2 < 1.0) - return m2; - if (h * 3 < 2.0) - return m1 + (m2 - m1)* (2.0/3.0 - h) * 6.0; - return m1; -} - -template -css_color_grammar::css_color_grammar() - : css_color_grammar::base_type(css_color) - -{ - using qi::lit; - using qi::_val; - using qi::double_; - using qi::_1; - using qi::_a; - using qi::_b; - using qi::_c; - using ascii::no_case; - using phoenix::at_c; - - css_color %= rgba_color - | rgba_percent_color - | hsl_percent_color - | hex_color - | hex_color_small - | no_case[named]; - - hex_color = lit('#') - >> hex2 [ at_c<0>(_val) = _1 ] - >> hex2 [ at_c<1>(_val) = _1 ] - >> hex2 [ at_c<2>(_val) = _1 ] - >>-hex2 [ at_c<3>(_val) = _1 ] - ; - - hex_color_small = lit('#') - >> hex1 [ at_c<0>(_val) = _1 | _1 << 4 ] - >> hex1 [ at_c<1>(_val) = _1 | _1 << 4 ] - >> hex1 [ at_c<2>(_val) = _1 | _1 << 4 ] - >>-hex1 [ at_c<3>(_val) = _1 | _1 << 4 ] - ; - - rgba_color = lit("rgb") >> -lit('a') - >> lit('(') - >> dec3 [at_c<0>(_val) = _1] >> ',' - >> dec3 [at_c<1>(_val) = _1] >> ',' - >> dec3 [at_c<2>(_val) = _1] - >> -(','>> -double_ [at_c<3>(_val) = alpha_converter(_1)]) - >> lit(')') - ; - - rgba_percent_color = lit("rgb") >> -lit('a') - >> lit('(') - >> double_ [at_c<0>(_val) = percent_converter(_1)] >> '%' >> ',' - >> double_ [at_c<1>(_val) = percent_converter(_1)] >> '%' >> ',' - >> double_ [at_c<2>(_val) = percent_converter(_1)] >> '%' - >> -(','>> -double_ [at_c<3>(_val) = alpha_converter(_1)]) - >> lit(')') - ; - - hsl_percent_color = lit("hsl") >> -lit('a') - >> lit('(') - >> double_ [ _a = _1] >> ',' // hue 0..360 - >> double_ [ _b = _1] >> '%' >> ',' // saturation 0..100% - >> double_ [ _c = _1] >> '%' // lightness 0..100% - >> -(','>> -double_ [at_c<3>(_val) = alpha_converter(_1)]) // opacity 0...1 - >> lit (')') [ hsl_converter(_val,_a,_b,_c)] - ; -} - template struct mapnik::css_color_grammar; - } -#endif \ No newline at end of file +#endif diff -Nru mapnik-2.1.0/src/datasource_cache.cpp mapnik-2.2.0/src/datasource_cache.cpp --- mapnik-2.1.0/src/datasource_cache.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/datasource_cache.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,44 +24,41 @@ #include #include #include +#include +#include +#include // boost #include #include #include -// ltdl -#include - // stl #include -#include +#include #include -namespace mapnik -{ +namespace mapnik { + +extern datasource_ptr create_static_datasource(parameters const& params); +extern std::vector get_static_datasource_names(); -bool is_input_plugin (std::string const& filename) +bool is_input_plugin(std::string const& filename) { return boost::algorithm::ends_with(filename,std::string(".input")); } - datasource_cache::datasource_cache() { - if (lt_dlinit()) throw std::runtime_error("lt_dlinit() failed"); + PluginInfo::init(); } datasource_cache::~datasource_cache() { - lt_dlexit(); + PluginInfo::exit(); } -std::map > datasource_cache::plugins_; -bool datasource_cache::registered_=false; -std::vector datasource_cache::plugin_directories_; - -datasource_ptr datasource_cache::create(const parameters& params, bool bind) +datasource_ptr datasource_cache::create(parameters const& params) { boost::optional type = params.get("type"); if ( ! type) @@ -70,148 +67,167 @@ "parameter 'type' is missing"); } + datasource_ptr ds; + +#ifdef MAPNIK_STATIC_PLUGINS + // return if it's created, raise otherwise + ds = create_static_datasource(params); + if (ds) + { + return ds; + } +#endif + #ifdef MAPNIK_THREADSAFE mutex::scoped_lock lock(mutex_); #endif - datasource_ptr ds; std::map >::iterator itr=plugins_.find(*type); - if ( itr == plugins_.end() ) + if (itr == plugins_.end()) { - throw config_error(std::string("Could not create datasource. No plugin ") + - "found for type '" + * type + "' (searched in: " + plugin_directories() + ")"); + std::string s("Could not create datasource for type: '"); + s += *type + "'"; + if (plugin_directories_.empty()) + { + s + " (no datasource plugin directories have been successfully registered)"; + } + else + { + s + " (searched for datasource plugins in '" + plugin_directories() + "')"; + } + throw config_error(s); } - if ( ! itr->second->handle()) + if (! itr->second->valid()) { throw std::runtime_error(std::string("Cannot load library: ") + - lt_dlerror()); + itr->second->get_error()); } // http://www.mr-edd.co.uk/blog/supressing_gcc_warnings #ifdef __GNUC__ __extension__ #endif - create_ds* create_datasource = - reinterpret_cast(lt_dlsym(itr->second->handle(), "create")); + create_ds* create_datasource = reinterpret_cast(itr->second->get_symbol("create")); if (! create_datasource) { throw std::runtime_error(std::string("Cannot load symbols: ") + - lt_dlerror()); + itr->second->get_error()); } + ds = datasource_ptr(create_datasource(params), datasource_deleter()); + #ifdef MAPNIK_LOG - MAPNIK_LOG_DEBUG(datasource_cache) << "datasource_cache: Size=" << params.size(); + MAPNIK_LOG_DEBUG(datasource_cache) + << "datasource_cache: Datasource=" + << ds << " type=" << type; + + MAPNIK_LOG_DEBUG(datasource_cache) + << "datasource_cache: Size=" + << params.size(); parameters::const_iterator i = params.begin(); for (; i != params.end(); ++i) { - MAPNIK_LOG_DEBUG(datasource_cache) << "datasource_cache: -- " << i->first << "=" << i->second; + MAPNIK_LOG_DEBUG(datasource_cache) + << "datasource_cache: -- " + << i->first << "=" << i->second; } #endif - ds = datasource_ptr(create_datasource(params, bind), datasource_deleter()); - - MAPNIK_LOG_DEBUG(datasource_cache) << "datasource_cache: Datasource=" << ds << " type=" << type; - return ds; } -bool datasource_cache::insert(std::string const& type,const lt_dlhandle module) -{ - return plugins_.insert(make_pair(type,boost::make_shared - (type,module))).second; -} - std::string datasource_cache::plugin_directories() { return boost::algorithm::join(plugin_directories_,", "); } -std::vector datasource_cache::plugin_names () +std::vector datasource_cache::plugin_names() { std::vector names; + +#ifdef MAPNIK_STATIC_PLUGINS + names = get_static_datasource_names(); +#endif + std::map >::const_iterator itr; - for (itr = plugins_.begin();itr!=plugins_.end();++itr) + for (itr = plugins_.begin(); itr != plugins_.end(); ++itr) { names.push_back(itr->first); } + return names; } void datasource_cache::register_datasources(std::string const& str) { #ifdef MAPNIK_THREADSAFE - mutex::scoped_lock lock(mapnik::singleton::mutex_); + mutex::scoped_lock lock(mutex_); #endif - boost::filesystem::path path(str); // TODO - only push unique paths plugin_directories_.push_back(str); - boost::filesystem::directory_iterator end_itr; - - if (exists(path) && is_directory(path)) + if (mapnik::util::exists(str) && mapnik::util::is_directory(str)) { - for (boost::filesystem::directory_iterator itr(path);itr!=end_itr;++itr ) + boost::filesystem::directory_iterator end_itr; + for (boost::filesystem::directory_iterator itr(str); itr != end_itr; ++itr ) { #if (BOOST_FILESYSTEM_VERSION == 3) - if (!is_directory( *itr ) && is_input_plugin(itr->path().filename().string())) + if (!boost::filesystem::is_directory(*itr) && is_input_plugin(itr->path().filename().string())) #else // v2 - if (!is_directory( *itr ) && is_input_plugin(itr->path().leaf())) + if (!boost::filesystem::is_directory(*itr) && is_input_plugin(itr->path().leaf())) #endif - { + { #if (BOOST_FILESYSTEM_VERSION == 3) - if (register_datasource(itr->path().string().c_str())) + if (register_datasource(itr->path().string())) #else // v2 - if (register_datasource(itr->string().c_str())) + if (register_datasource(itr->string())) #endif - { - registered_ = true; - } + { + registered_ = true; } + } } } } -bool datasource_cache::register_datasource(std::string const& str) +bool datasource_cache::register_datasource(std::string const& filename) { bool success = false; try { - lt_dlhandle module = lt_dlopen(str.c_str()); - if (module) + boost::shared_ptr plugin = boost::make_shared(filename,"datasource_name"); + if (plugin->valid()) { - // http://www.mr-edd.co.uk/blog/supressing_gcc_warnings -#ifdef __GNUC__ - __extension__ -#endif - datasource_name* ds_name = - reinterpret_cast(lt_dlsym(module, "datasource_name")); - if (ds_name && insert(ds_name(),module)) - { - MAPNIK_LOG_DEBUG(datasource_cache) << "datasource_cache: Registered=" << ds_name(); - - success = true; - } - else if (!ds_name) + if (plugin->name().empty()) { MAPNIK_LOG_ERROR(datasource_cache) << "Problem loading plugin library '" - << str << "' (plugin is lacking compatible interface)"; + << filename << "' (plugin is lacking compatible interface)"; + } + else + { + plugins_.insert(std::make_pair(plugin->name(),plugin)); + MAPNIK_LOG_DEBUG(datasource_cache) + << "datasource_cache: Registered=" + << plugin->name(); + success = true; } } else { MAPNIK_LOG_ERROR(datasource_cache) - << "Problem loading plugin library: " << str - << " (dlopen failed - plugin likely has an unsatisfied dependency or incompatible ABI)"; + << "Problem loading plugin library: " + << filename << " (dlopen failed - plugin likely has an unsatisfied dependency or incompatible ABI)"; } } - catch (...) { - MAPNIK_LOG_ERROR(datasource_cache) - << "Exception caught while loading plugin library: " << str; + catch (std::exception const& ex) + { + MAPNIK_LOG_ERROR(datasource_cache) + << "Exception caught while loading plugin library: " + << filename << " (" << ex.what() << ")"; } return success; } diff -Nru mapnik-2.1.0/src/datasource_cache_static.cpp mapnik-2.2.0/src/datasource_cache_static.cpp --- mapnik-2.1.0/src/datasource_cache_static.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/datasource_cache_static.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,171 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include + +#ifdef MAPNIK_STATIC_PLUGINS +#include + +// boost +#include +#include +#include +#endif + +// stl +#include + +// static plugin linkage +#ifdef MAPNIK_STATIC_PLUGINS + #if defined(MAPNIK_STATIC_PLUGIN_CSV) + #include "plugins/input/csv/csv_datasource.hpp" + #endif + #if defined(MAPNIK_STATIC_PLUGIN_GDAL) + #include "plugins/input/gdal/gdal_datasource.hpp" + #endif + #if defined(MAPNIK_STATIC_PLUGIN_GEOJSON) + #include "plugins/input/geojson/geojson_datasource.hpp" + #endif + #if defined(MAPNIK_STATIC_PLUGIN_GEOS) + #include "plugins/input/geos/geos_datasource.hpp" + #endif + #if defined(MAPNIK_STATIC_PLUGIN_KISMET) + #include "plugins/input/kismet/kismet_datasource.hpp" + #endif + #if defined(MAPNIK_STATIC_PLUGIN_OCCI) + #include "plugins/input/occi/occi_datasource.hpp" + #endif + #if defined(MAPNIK_STATIC_PLUGIN_OGR) + #include "plugins/input/ogr/ogr_datasource.hpp" + #endif + #if defined(MAPNIK_STATIC_PLUGIN_OSM) + #include "plugins/input/osm/osm_datasource.hpp" + #endif + #if defined(MAPNIK_STATIC_PLUGIN_POSTGIS) + #include "plugins/input/postgis/postgis_datasource.hpp" + #endif + #if defined(MAPNIK_STATIC_PLUGIN_PYTHON) + #include "plugins/input/python/python_datasource.hpp" + #endif + #if defined(MAPNIK_STATIC_PLUGIN_RASTER) + #include "plugins/input/raster/raster_datasource.hpp" + #endif + #if defined(MAPNIK_STATIC_PLUGIN_RASTERLITE) + #include "plugins/input/rasterlite/rasterlite_datasource.hpp" + #endif + #if defined(MAPNIK_STATIC_PLUGIN_SHAPE) + #include "plugins/input/shape/shape_datasource.hpp" + #endif + #if defined(MAPNIK_STATIC_PLUGIN_SQLITE) + #include "plugins/input/sqlite/sqlite_datasource.hpp" + #endif +#endif + +namespace mapnik { + +#ifdef MAPNIK_STATIC_PLUGINS +template +datasource_ptr ds_generator(parameters const& params) +{ + return boost::make_shared(params); +} + +typedef datasource_ptr (*ds_generator_ptr)(parameters const& params); +typedef boost::unordered_map datasource_map; + +static datasource_map ds_map = boost::assign::map_list_of + #if defined(MAPNIK_STATIC_PLUGIN_CSV) + (std::string("csv"), &ds_generator) + #endif + #if defined(MAPNIK_STATIC_PLUGIN_GDAL) + (std::string("gdal"), &ds_generator) + #endif + #if defined(MAPNIK_STATIC_PLUGIN_GEOJSON) + (std::string("geojson"), &ds_generator) + #endif + #if defined(MAPNIK_STATIC_PLUGIN_OCCI) + (std::string("occi"), &ds_generator) + #endif + #if defined(MAPNIK_STATIC_PLUGIN_OGR) + (std::string("ogr"), &ds_generator) + #endif + #if defined(MAPNIK_STATIC_PLUGIN_OSM) + (std::string("osm"), &ds_generator) + #endif + #if defined(MAPNIK_STATIC_PLUGIN_POSTGIS) + (std::string("postgis"), &ds_generator) + #endif + #if defined(MAPNIK_STATIC_PLUGIN_PYTHON) + (std::string("python"), &ds_generator) + #endif + #if defined(MAPNIK_STATIC_PLUGIN_RASTER) + (std::string("raster"), &ds_generator) + #endif + #if defined(MAPNIK_STATIC_PLUGIN_RASTERLITE) + (std::string("rasterlite"), &ds_generator) + #endif + #if defined(MAPNIK_STATIC_PLUGIN_SHAPE) + (std::string("shape"), &ds_generator) + #endif + #if defined(MAPNIK_STATIC_PLUGIN_SQLITE) + (std::string("sqlite"), &ds_generator) + #endif +; +#endif + +datasource_ptr create_static_datasource(parameters const& params) +{ + datasource_ptr ds; + +#ifdef MAPNIK_STATIC_PLUGINS + boost::optional type = params.get("type"); + + datasource_map::iterator it = ds_map.find(*type); + + if (it != ds_map.end()) + { + ds = it->second(params); + } +#endif + + return ds; +} + +std::vector get_static_datasource_names() +{ + std::vector names; + +#ifdef MAPNIK_STATIC_PLUGINS + datasource_map::iterator it = ds_map.begin(); + while (it != ds_map.end()) + { + names.push_back(it->first); + + it++; + } +#endif + + return names; +} + +} diff -Nru mapnik-2.1.0/src/debug.cpp mapnik-2.2.0/src/debug.cpp --- mapnik-2.1.0/src/debug.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/debug.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,16 +25,17 @@ // stl #include +#include #ifndef MAPNIK_LOG_FORMAT -#define MAPNIK_LOG_FORMAT "Mapnik LOG> %Y-%m-%d %H:%M:%S:" + #define MAPNIK_LOG_FORMAT Mapnik LOG> %Y-%m-%d %H:%M:%S: #endif #ifndef MAPNIK_DEFAULT_LOG_SEVERITY #ifdef MAPNIK_DEBUG - #define MAPNIK_DEFAULT_LOG_SEVERITY 1 + #define MAPNIK_DEFAULT_LOG_SEVERITY 0 #else - #define MAPNIK_DEFAULT_LOG_SEVERITY 3 + #define MAPNIK_DEFAULT_LOG_SEVERITY 2 #endif #endif @@ -60,14 +61,10 @@ #if MAPNIK_DEFAULT_LOG_SEVERITY == 0 logger::debug #elif MAPNIK_DEFAULT_LOG_SEVERITY == 1 - logger::info - #elif MAPNIK_DEFAULT_LOG_SEVERITY == 2 logger::warn - #elif MAPNIK_DEFAULT_LOG_SEVERITY == 3 + #elif MAPNIK_DEFAULT_LOG_SEVERITY == 2 logger::error - #elif MAPNIK_DEFAULT_LOG_SEVERITY == 4 - logger::fatal - #elif MAPNIK_DEFAULT_LOG_SEVERITY == 5 + #elif MAPNIK_DEFAULT_LOG_SEVERITY == 3 logger::none #else #error "Wrong default log severity level specified!" @@ -114,7 +111,7 @@ std::string logger::file_name_; std::streambuf* logger::saved_buf_ = 0; -void logger::use_file(const std::string& filepath) +void logger::use_file(std::string const& filepath) { // save clog rdbuf if (saved_buf_ == 0) diff -Nru mapnik-2.1.0/src/debug_symbolizer.cpp mapnik-2.2.0/src/debug_symbolizer.cpp --- mapnik-2.1.0/src/debug_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/debug_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,57 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include +#include + +namespace mapnik +{ + +static const char * debug_symbolizer_mode_strings[] = { + "collision", + "vertex", + "" +}; + +IMPLEMENT_ENUM( debug_symbolizer_mode_e, debug_symbolizer_mode_strings ) + +debug_symbolizer::debug_symbolizer() +: symbolizer_base(), + mode_(DEBUG_SYM_MODE_COLLISION) {} + +debug_symbolizer::debug_symbolizer(debug_symbolizer const& rhs) + : symbolizer_base(rhs), + mode_(rhs.mode_) {} + +debug_symbolizer_mode_e debug_symbolizer::get_mode() const +{ + return mode_; +} + +void debug_symbolizer::set_mode(debug_symbolizer_mode_e mode) +{ + mode_ = mode; +} + +} + diff -Nru mapnik-2.1.0/src/deepcopy.cpp mapnik-2.2.0/src/deepcopy.cpp --- mapnik-2.1.0/src/deepcopy.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/deepcopy.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,11 +25,22 @@ #include #include #include -#include -#include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // boost #include @@ -101,7 +112,7 @@ parameters p(ds_in->params()); // TODO : re-use datasource extent if already set. - datasource_ptr ds_out = datasource_cache::create(p); + datasource_ptr ds_out = datasource_cache::instance().create(p); if (ds_out) { lyr_out.set_datasource(ds_out); @@ -119,7 +130,6 @@ feature_type_style style_out(style_in,true); // deep copy map_out.insert_style(kv.first, style_out); } - } - }} +}} diff -Nru mapnik-2.1.0/src/distance.cpp mapnik-2.2.0/src/distance.cpp --- mapnik-2.1.0/src/distance.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/distance.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -29,12 +29,6 @@ namespace mapnik { -using std::atan2; -using std::cos; -using std::pow; -using std::sin; -using std::sqrt; - static const double deg2rad = 0.0174532925199432958; static const double R = 6372795.0; // average great-circle radius of the earth @@ -49,11 +43,11 @@ double dlat = lat1 - lat0; double dlon = lon1 - lon0; - double sin_dlat = sin(0.5 * dlat); - double sin_dlon = sin(0.5 * dlon); + double sin_dlat = std::sin(0.5 * dlat); + double sin_dlon = std::sin(0.5 * dlon); - double a = pow(sin_dlat,2.0) + cos(lat0)*cos(lat1)*pow(sin_dlon,2.0); - double c = 2 * atan2(sqrt(a),sqrt(1 - a)); + double a = std::pow(sin_dlat,2.0) + std::cos(lat0)*std::cos(lat1)*std::pow(sin_dlon,2.0); + double c = 2 * std::atan2(std::sqrt(a),std::sqrt(1 - a)); return R * c; } } diff -Nru mapnik-2.1.0/src/expression.cpp mapnik-2.2.0/src/expression.cpp --- mapnik-2.1.0/src/expression.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/expression.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,25 +24,33 @@ #include #include #include +#include #include +#include // boost -#include #include namespace mapnik { -expression_ptr expression_factory::compile(std::string const& str,transcoder const& tr) +expression_ptr parse_expression(std::string const& str, std::string const& encoding) { - expression_ptr expr(boost::make_shared(true)); + transcoder tr(encoding); + expression_grammar g(tr); + return parse_expression(str, g); +} + +expression_ptr parse_expression(std::string const& str, + mapnik::expression_grammar const& g) +{ + expr_node node; std::string::const_iterator itr = str.begin(); std::string::const_iterator end = str.end(); - mapnik::expression_grammar g(tr); - bool r = boost::spirit::qi::phrase_parse(itr,end,g, boost::spirit::standard_wide::space,*expr); - if (r && itr==end) + bool r = boost::spirit::qi::phrase_parse(itr, end, g, boost::spirit::standard_wide::space, node); + if (r && itr == end) { - return expr; + return boost::make_shared(node); } else { @@ -50,24 +58,5 @@ } } -bool expression_factory::parse_from_string(expression_ptr const& expr, - std::string const& str, - mapnik::expression_grammar const& g) -{ - std::string::const_iterator itr = str.begin(); - std::string::const_iterator end = str.end(); - bool r = boost::spirit::qi::phrase_parse(itr,end,g, boost::spirit::standard_wide::space,*expr); - return (r && itr==end); -} - -expression_ptr parse_expression (std::string const& wkt,std::string const& encoding) -{ - transcoder tr(encoding); - return expression_factory::compile(wkt,tr); -} -expression_ptr parse_expression (std::string const& wkt) -{ - return parse_expression(wkt,"utf8"); -} } diff -Nru mapnik-2.1.0/src/expression_grammar.cpp mapnik-2.2.0/src/expression_grammar.cpp --- mapnik-2.1.0/src/expression_grammar.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/expression_grammar.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -20,155 +20,15 @@ * *****************************************************************************/ -#include +// mapnik +#include -namespace mapnik -{ +// stl +#include -template -expr_node regex_match_impl::operator() (T0 & node, T1 const& pattern) const -{ -#if defined(BOOST_REGEX_HAS_ICU) - return regex_match_node(node,tr_.transcode(pattern.c_str())); -#else - return regex_match_node(node,pattern); -#endif -} - -template -expr_node regex_replace_impl::operator() (T0 & node, T1 const& pattern, T2 const& format) const -{ -#if defined(BOOST_REGEX_HAS_ICU) - return regex_replace_node(node,tr_.transcode(pattern.c_str()),tr_.transcode(format.c_str())); -#else - return regex_replace_node(node,pattern,format); -#endif -} - -template -expression_grammar::expression_grammar(mapnik::transcoder const& tr) - : expression_grammar::base_type(expr), - unicode_(unicode_impl(tr)), - regex_match_(regex_match_impl(tr)), - regex_replace_(regex_replace_impl(tr)) +namespace mapnik { - using boost::phoenix::construct; - using qi::_1; - using qi::_a; - using qi::_b; - using qi::_r1; -#if BOOST_VERSION > 104200 - using qi::no_skip; -#endif - using qi::lexeme; - using qi::_val; - using qi::lit; - using qi::int_; - using qi::double_; - using qi::hex; - using qi::omit; - using standard_wide::char_; - using standard_wide::no_case; - expr = logical_expr.alias(); - - logical_expr = not_expr [_val = _1] - >> - *( ( ( lit("and") | lit("&&")) >> not_expr [_val && _1] ) - | (( lit("or") | lit("||")) >> not_expr [_val || _1]) - ) - ; - - not_expr = - cond_expr [_val = _1 ] - | ((lit("not") | lit('!')) >> cond_expr [ _val = !_1 ]) - ; - - cond_expr = equality_expr [_val = _1] | additive_expr [_val = _1] - ; - - equality_expr = - relational_expr [_val = _1] - >> *( ( (lit("=") | lit("eq") | lit("is")) >> relational_expr [_val == _1]) - | (( lit("!=") | lit("<>") | lit("neq") ) >> relational_expr [_val != _1]) - ) - ; - - regex_match_expr = lit(".match") - >> lit('(') - >> ustring [_val = _1] - >> lit(')') - ; - - regex_replace_expr = - lit(".replace") - >> lit('(') - >> ustring [_a = _1] - >> lit(',') - >> ustring [_b = _1] - >> lit(')') [_val = regex_replace_(_r1,_a,_b)] - ; - - relational_expr = additive_expr[_val = _1] - >> - *( ( (lit("<=") | lit("le") ) >> additive_expr [ _val <= _1 ]) - | ( (lit('<') | lit("lt") ) >> additive_expr [ _val < _1 ]) - | ( (lit(">=") | lit("ge") ) >> additive_expr [ _val >= _1 ]) - | ( (lit('>') | lit("gt") ) >> additive_expr [ _val > _1 ]) - ) - ; - - additive_expr = multiplicative_expr [_val = _1] - >> * ( '+' >> multiplicative_expr[_val += _1] - | '-' >> multiplicative_expr[_val -= _1] - ) - ; - - multiplicative_expr = unary_expr [_val = _1] - >> *( '*' >> unary_expr [_val *= _1] - | '/' >> unary_expr [_val /= _1] - | '%' >> unary_expr [_val %= _1] - | regex_match_expr[_val = regex_match_(_val, _1)] - | regex_replace_expr(_val) [_val = _1] - ) - ; - - unary_expr = primary_expr [_val = _1] - | '+' >> primary_expr [_val = _1] - | '-' >> primary_expr [_val = -_1] - ; - - primary_expr = strict_double [_val = _1] - | int_ [_val = _1] - | no_case[lit("true")] [_val = true] - | no_case[lit("false")] [_val = false] - | no_case[lit("null")] [_val = value_null() ] - | no_case[geom_type][_val = _1 ] - | ustring [_val = unicode_(_1) ] - | lit("[mapnik::geometry_type]")[_val = construct()] - | attr [_val = construct( _1 ) ] - | '(' >> expr [_val = _1 ] >> ')' - ; - - unesc_char.add("\\a", '\a')("\\b", '\b')("\\f", '\f')("\\n", '\n') - ("\\r", '\r')("\\t", '\t')("\\v", '\v')("\\\\", '\\') - ("\\\'", '\'')("\\\"", '\"') - ; - -#if BOOST_VERSION > 104500 - quote_char %= char_('\'') | char_('"'); - ustring %= omit[quote_char[_a = _1]] - >> *(unesc_char | "\\x" >> hex | (char_ - lit(_a))) - >> lit(_a); - attr %= '[' >> no_skip[+~char_(']')] >> ']'; -#else - ustring %= lit('\'') - >> *(unesc_char | "\\x" >> hex | (char_ - lit('\''))) - >> lit('\''); - attr %= '[' >> lexeme[+(char_ - ']')] >> ']'; -#endif - -} template struct mapnik::expression_grammar; -} \ No newline at end of file +} diff -Nru mapnik-2.1.0/src/expression_node.cpp mapnik-2.2.0/src/expression_node.cpp --- mapnik-2.1.0/src/expression_node.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/expression_node.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -48,4 +48,4 @@ format(f) {} #endif -} \ No newline at end of file +} diff -Nru mapnik-2.1.0/src/expression_string.cpp mapnik-2.2.0/src/expression_string.cpp --- mapnik-2.1.0/src/expression_string.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/expression_string.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,13 +21,22 @@ *****************************************************************************/ // mapnik -#include + +#include // needed by msvc +#include // needed by msvc +#include +#include +#include +#include // boost #include +#if defined(BOOST_REGEX_HAS_ICU) +#include // for u32regex +#endif // icu -#include +#include // for UnicodeString namespace mapnik @@ -112,7 +121,7 @@ #else str_ += x.pattern.str(); str_ +="','"; - str_ += x.pattern.str(); + str_ += x.format; #endif str_ +="')"; } diff -Nru mapnik-2.1.0/src/feature_kv_iterator.cpp mapnik-2.2.0/src/feature_kv_iterator.cpp --- mapnik-2.1.0/src/feature_kv_iterator.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/feature_kv_iterator.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -49,15 +49,13 @@ bool feature_kv_iterator::equal( feature_kv_iterator const& other) const { - return ( itr_ == other.itr_); + return ( itr_ == other.itr_ ); } feature_kv_iterator::value_type const& feature_kv_iterator::dereference() const { boost::get<0>(kv_) = itr_->first; - boost::optional val = f_.get_optional(itr_->second); - if (val) boost::get<1>(kv_) = *val; - else boost::get<1>(kv_) = value_null(); + boost::get<1>(kv_) = f_.get(itr_->second); return kv_; } diff -Nru mapnik-2.1.0/src/feature_style_processor.cpp mapnik-2.2.0/src/feature_style_processor.cpp --- mapnik-2.1.0/src/feature_style_processor.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/feature_style_processor.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,609 +21,27 @@ *****************************************************************************/ // mapnik -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include +#include #include - -// boost -#include -#include - -// stl -#include +#include #if defined(HAVE_CAIRO) +#include #include #endif #if defined(SVG_RENDERER) -#include -#endif - -#if defined(RENDERING_STATS) -#include -#include -#include +#include #endif namespace mapnik { -template struct has_process; - -template -struct process_impl -{ - template - static void process(T0 & ren, T1 const& sym, T2 & f, T3 const& tr) - { - ren.process(sym,f,tr); - } -}; - -template <> // No-op specialization -struct process_impl -{ - template - static void process(T0 & ren, T1 const& sym, T2 & f, T3 const& tr) - { - boost::ignore_unused_variable_warning(ren); - boost::ignore_unused_variable_warning(f); - boost::ignore_unused_variable_warning(tr); -#ifdef MAPNIK_DEBUG - std::clog << "NO-OP ...\n"; -#endif - } -}; - -/** Calls the renderer's process function, - * \param output Renderer - * \param f Feature to process - * \param prj_trans Projection - * \param sym Symbolizer object - */ -template -struct feature_style_processor::symbol_dispatch : public boost::static_visitor<> -{ - symbol_dispatch (Processor & output, - mapnik::feature_impl & f, - proj_transform const& prj_trans) - : output_(output), - f_(f), - prj_trans_(prj_trans) {} - - template - void operator () (T const& sym) const - { - process_impl::value>::process(output_,sym,f_,prj_trans_); - } - - Processor & output_; - mapnik::feature_impl & f_; - proj_transform const& prj_trans_; -}; - -typedef char (&no_tag)[1]; -typedef char (&yes_tag)[2]; - -template -struct process_memfun_helper {}; - -template no_tag has_process_helper(...); -template yes_tag has_process_helper(process_memfun_helper* p); - -template -struct has_process -{ - typedef typename T0::processor_impl_type processor_impl_type; - BOOST_STATIC_CONSTANT(bool - , value = sizeof(has_process_helper(0)) == sizeof(yes_tag) - ); -}; - - -template -feature_style_processor::feature_style_processor(Map const& m, double scale_factor) - : m_(m), scale_factor_(scale_factor) -{ -} - -template -void feature_style_processor::apply() -{ -#if defined(RENDERING_STATS) - std::clog << "\n//-- starting rendering timer...\n"; - mapnik::progress_timer t(std::clog, "total map rendering"); -#endif - - Processor & p = static_cast(*this); - p.start_map_processing(m_); - - try - { - projection proj(m_.srs()); - double scale_denom = mapnik::scale_denominator(m_,proj.is_geographic()); - scale_denom *= scale_factor_; - - BOOST_FOREACH ( layer const& lyr, m_.layers() ) - { - if (lyr.visible(scale_denom)) - { - std::set names; - apply_to_layer(lyr, p, proj, scale_denom, names); - } - } - } - catch (proj_init_error& ex) - { - MAPNIK_LOG_ERROR(feature_style_processor) << "feature_style_processor: proj_init_error=" << ex.what(); - } - - p.end_map_processing(m_); - -#if defined(RENDERING_STATS) - t.stop(); - std::clog << "//-- rendering timer stopped...\n\n"; -#endif - -} - -template -void feature_style_processor::apply(mapnik::layer const& lyr, std::set& names) -{ - Processor & p = static_cast(*this); - p.start_map_processing(m_); - try - { - projection proj(m_.srs()); - double scale_denom = mapnik::scale_denominator(m_,proj.is_geographic()); - scale_denom *= scale_factor_; - - if (lyr.visible(scale_denom)) - { - apply_to_layer(lyr, p, proj, scale_denom, names); - } - } - catch (proj_init_error& ex) - { - MAPNIK_LOG_ERROR(feature_style_processor) << "feature_style_processor: proj_init_error=" << ex.what(); - } - p.end_map_processing(m_); -} - -template -void feature_style_processor::apply_to_layer(layer const& lay, Processor & p, - projection const& proj0, - double scale_denom, - std::set& names) -{ - std::vector const& style_names = lay.styles(); - - unsigned int num_styles = style_names.size(); - if (! num_styles) - { - MAPNIK_LOG_DEBUG(feature_style_processor) << "feature_style_processor: No style for layer=" << lay.name(); - - return; - } - - mapnik::datasource_ptr ds = lay.datasource(); - if (! ds) - { - MAPNIK_LOG_DEBUG(feature_style_processor) << "feature_style_processor: No datasource for layer=" << lay.name(); - - return; - } - -#if defined(RENDERING_STATS) - progress_timer layer_timer(std::clog, "rendering total for layer: '" + lay.name() + "'"); -#endif - - projection proj1(lay.srs()); - proj_transform prj_trans(proj0,proj1); - -#if defined(RENDERING_STATS) - if (! prj_trans.equal()) - { - std::clog << "notice: reprojecting layer: '" << lay.name() << "' from/to:\n\t'" - << lay.srs() << "'\n\t'" - << m_.srs() << "'\n"; - } -#endif - - box2d buffered_query_ext = m_.get_buffered_extent(); // buffered - - // clip buffered extent by maximum extent, if supplied - boost::optional > const& maximum_extent = m_.maximum_extent(); - if (maximum_extent) { - buffered_query_ext.clip(*maximum_extent); - } - - box2d layer_ext = lay.envelope(); - bool fw_success = false; - - // first, try intersection of map extent forward projected into layer srs - if (prj_trans.forward(buffered_query_ext, PROJ_ENVELOPE_POINTS) && buffered_query_ext.intersects(layer_ext)) - { - fw_success = true; - layer_ext.clip(buffered_query_ext); - } - // if no intersection and projections are also equal, early return - else if (prj_trans.equal()) - { -#if defined(RENDERING_STATS) - layer_timer.discard(); -#endif - return; - } - // next try intersection of layer extent back projected into map srs - else if (prj_trans.backward(layer_ext, PROJ_ENVELOPE_POINTS) && buffered_query_ext.intersects(layer_ext)) - { - layer_ext.clip(buffered_query_ext); - // forward project layer extent back into native projection - if (! prj_trans.forward(layer_ext, PROJ_ENVELOPE_POINTS)) - { - MAPNIK_LOG_DEBUG(feature_style_processor) - << "feature_style_processor: Layer=" << lay.name() - << " extent=" << layer_ext << " in map projection " - << " did not reproject properly back to layer projection"; - } - } - else - { - // if no intersection then nothing to do for layer -#if defined(RENDERING_STATS) - layer_timer.discard(); -#endif - return; - } - - // if we've got this far, now prepare the unbuffered extent - // which is used as a bbox for clipping geometries - box2d query_ext = m_.get_current_extent(); // unbuffered - if (maximum_extent) - { - query_ext.clip(*maximum_extent); - } - - box2d layer_ext2 = lay.envelope(); - if (fw_success) - { - if (prj_trans.forward(query_ext, PROJ_ENVELOPE_POINTS)) - { - layer_ext2.clip(query_ext); - } - } - else - { - if (prj_trans.backward(layer_ext2, PROJ_ENVELOPE_POINTS)) - { - layer_ext2.clip(query_ext); - prj_trans.forward(layer_ext2, PROJ_ENVELOPE_POINTS); - } - } - - p.start_layer_processing(lay, layer_ext2); - - double qw = query_ext.width()>0 ? query_ext.width() : 1; - double qh = query_ext.height()>0 ? query_ext.height() : 1; - query::resolution_type res(m_.width()/qw, - m_.height()/qh); - - query q(layer_ext,res,scale_denom,m_.get_current_extent()); - std::vector active_styles; - attribute_collector collector(names); - double filt_factor = 1.0; - directive_collector d_collector(filt_factor); - - // iterate through all named styles collecting active styles and attribute names - BOOST_FOREACH(std::string const& style_name, style_names) - { - boost::optional style=m_.find_style(style_name); - if (!style) - { - MAPNIK_LOG_DEBUG(feature_style_processor) - << "feature_style_processor: Style=" << style_name - << " required for layer=" << lay.name() << " does not exist."; - - continue; - } - - const std::vector& rules=(*style).get_rules(); - bool active_rules=false; - - BOOST_FOREACH(rule const& r, rules) - { - if (r.active(scale_denom)) - { - active_rules = true; - if (ds->type() == datasource::Vector) - { - collector(r); - } - // TODO - in the future rasters should be able to be filtered. - } - } - if (active_rules) - { - active_styles.push_back(const_cast(&(*style))); - } - } - - // Don't even try to do more work if there are no active styles. - if (active_styles.size() > 0) - { - // push all property names - BOOST_FOREACH(std::string const& name, names) - { - q.add_property_name(name); - } - - // Update filter_factor for all enabled raster layers. - BOOST_FOREACH (feature_type_style * style, active_styles) - { - BOOST_FOREACH(rule const& r, style->get_rules()) - { - if (r.active(scale_denom) && - ds->type() == datasource::Raster && - ds->params().get("filter_factor",0.0) == 0.0) - { - rule::symbolizers const& symbols = r.get_symbolizers(); - rule::symbolizers::const_iterator symIter = symbols.begin(); - rule::symbolizers::const_iterator symEnd = symbols.end(); - while (symIter != symEnd) - { - // if multiple raster symbolizers, last will be respected - // should we warn or throw? - boost::apply_visitor(d_collector,*symIter++); - } - q.set_filter_factor(filt_factor); - } - } - } - - // Also query the group by attribute - std::string group_by = lay.group_by(); - if (group_by != "") - { - q.add_property_name(group_by); - } - - bool cache_features = lay.cache_features() && active_styles.size() > 1; - - // Render incrementally when the column that we group by - // changes value. - if (group_by != "") - { - featureset_ptr features = ds->features(q); - if (features) { - // Cache all features into the memory_datasource before rendering. - memory_datasource cache; - feature_ptr feature, prev; - - while ((feature = features->next())) - { - if (prev && prev->get(group_by) != feature->get(group_by)) - { - // We're at a value boundary, so render what we have - // up to this point. - int i = 0; - BOOST_FOREACH (feature_type_style * style, active_styles) - { - render_style(lay, p, style, style_names[i++], - cache.features(q), prj_trans, scale_denom); - } - cache.clear(); - } - cache.push(feature); - prev = feature; - } - - int i = 0; - BOOST_FOREACH (feature_type_style * style, active_styles) - { - render_style(lay, p, style, style_names[i++], - cache.features(q), prj_trans, scale_denom); - } - } - } - else if (cache_features) - { - featureset_ptr features = ds->features(q); - if (features) { - // Cache all features into the memory_datasource before rendering. - memory_datasource cache; - feature_ptr feature; - while ((feature = features->next())) - { - cache.push(feature); - } - - int i = 0; - BOOST_FOREACH (feature_type_style * style, active_styles) - { - render_style(lay, p, style, style_names[i++], - cache.features(q), prj_trans, scale_denom); - } - } - } - // We only have a single style and no grouping. - else - { - int i = 0; - BOOST_FOREACH (feature_type_style * style, active_styles) - { - featureset_ptr features = ds->features(q); - if (features) { - render_style(lay, p, style, style_names[i++], - features, prj_trans, scale_denom); - } - } - } - } - -#if defined(RENDERING_STATS) - layer_timer.stop(); -#endif - - p.end_layer_processing(lay); -} - - -template -void feature_style_processor::render_style( - layer const& lay, - Processor & p, - feature_type_style* style, - std::string const& style_name, - featureset_ptr features, - proj_transform const& prj_trans, - double scale_denom) -{ - - p.start_style_processing(*style); - -#if defined(RENDERING_STATS) - std::ostringstream s1; - s1 << "rendering style for layer: '" << lay.name() - << "' and style '" << style_name << "'"; - mapnik::progress_timer style_timer(std::clog, s1.str()); - - int feature_processed_count = 0; - int feature_count = 0; -#endif - - feature_ptr feature; - while ((feature = features->next())) - { -#if defined(RENDERING_STATS) - feature_count++; - bool feat_processed = false; -#endif - - bool do_else = true; - bool do_also = false; - - BOOST_FOREACH(rule * r, style->get_if_rules(scale_denom) ) - { - expression_ptr const& expr=r->get_filter(); - value_type result = boost::apply_visitor(evaluate(*feature),*expr); - if (result.to_bool()) - { -#if defined(RENDERING_STATS) - feat_processed = true; -#endif - - p.painted(true); - - do_else=false; - do_also=true; - rule::symbolizers const& symbols = r->get_symbolizers(); - - // if the underlying renderer is not able to process the complete set of symbolizers, - // process one by one. - if(!p.process(symbols,*feature,prj_trans)) - { - - BOOST_FOREACH (symbolizer const& sym, symbols) - { - boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym); - } - } - if (style->get_filter_mode() == FILTER_FIRST) - { - // Stop iterating over rules and proceed with next feature. - break; - } - } - } - if (do_else) - { - BOOST_FOREACH( rule * r, style->get_else_rules(scale_denom) ) - { -#if defined(RENDERING_STATS) - feat_processed = true; -#endif - - p.painted(true); - - rule::symbolizers const& symbols = r->get_symbolizers(); - // if the underlying renderer is not able to process the complete set of symbolizers, - // process one by one. - if(!p.process(symbols,*feature,prj_trans)) - { - BOOST_FOREACH (symbolizer const& sym, symbols) - { - boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym); - } - } - } - } - if (do_also) - { - BOOST_FOREACH( rule * r, style->get_also_rules(scale_denom) ) - { -#if defined(RENDERING_STATS) - feat_processed = true; -#endif - - p.painted(true); - - rule::symbolizers const& symbols = r->get_symbolizers(); - // if the underlying renderer is not able to process the complete set of symbolizers, - // process one by one. - if(!p.process(symbols,*feature,prj_trans)) - { - BOOST_FOREACH (symbolizer const& sym, symbols) - { - boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym); - } - } - } - } -#if defined(RENDERING_STATS) - if (feat_processed) - feature_processed_count++; -#endif - } - -#if defined(RENDERING_STATS) - style_timer.stop(); - - // done with style - std::ostringstream s; - if (feature_count > 0) - { - double perc_processed = ((double)feature_processed_count/(double)feature_count)*100.0; - - s << "percent rendered: " << perc_processed << "% - " << feature_processed_count - << " rendered for " << feature_count << " queried for "; - s << std::setw(15 - (int)s.tellp()) << " layer '" << lay.name() << "' and style '" << style_name << "'\n"; - } - else - { - s << "" << std::setw(15) << "- no features returned from query for layer '" << lay.name() << "' and style '" << style_name << "'\n"; - } - std::clog << s.str(); - style_timer.discard(); -#endif - p.end_style_processing(*style); -} - - #if defined(HAVE_CAIRO) -template class feature_style_processor >; -template class feature_style_processor >; +template class feature_style_processor >; +template class feature_style_processor >; #endif #if defined(SVG_RENDERER) diff -Nru mapnik-2.1.0/src/feature_type_style.cpp mapnik-2.2.0/src/feature_type_style.cpp --- mapnik-2.1.0/src/feature_type_style.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/feature_type_style.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,6 +21,11 @@ *****************************************************************************/ #include +#include +#include + +// boost +#include namespace mapnik { @@ -38,7 +43,6 @@ : filter_mode_(FILTER_ALL), filters_(), direct_filters_(), - scale_denom_validity_(-1), opacity_(1.0f) {} @@ -47,7 +51,6 @@ filters_(rhs.filters_), direct_filters_(rhs.direct_filters_), comp_op_(rhs.comp_op_), - scale_denom_validity_(-1), opacity_(rhs.opacity_) { if (!deep_copy) { @@ -64,11 +67,10 @@ feature_type_style& feature_type_style::operator=(feature_type_style const& rhs) { if (this == &rhs) return *this; - rules_=rhs.rules_; + rules_=rhs.rules_; filters_ = rhs.filters_; direct_filters_ = rhs.direct_filters_; comp_op_ = rhs.comp_op_; - scale_denom_validity_ = -1; opacity_= rhs.opacity_; return *this; } @@ -76,7 +78,6 @@ void feature_type_style::add_rule(rule const& rule) { rules_.push_back(rule); - scale_denom_validity_ = -1; } rules const& feature_type_style::get_rules() const @@ -89,6 +90,18 @@ return rules_; } +bool feature_type_style::active(double scale_denom) const +{ + BOOST_FOREACH(rule const& r, rules_) + { + if (r.active(scale_denom)) + { + return true; + } + } + return false; +} + void feature_type_style::set_filter_mode(filter_mode_e mode) { filter_mode_ = mode; @@ -139,59 +152,5 @@ return opacity_; } -void feature_type_style::update_rule_cache(double scale_denom) -{ - if_rules_.clear(); - else_rules_.clear(); - also_rules_.clear(); - - BOOST_FOREACH(rule const& r, rules_) - { - if (r.active(scale_denom)) - { - if (r.has_else_filter()) - { - else_rules_.push_back(const_cast(&r)); - } - else if (r.has_also_filter()) - { - also_rules_.push_back(const_cast(&r)); - } - else - { - if_rules_.push_back(const_cast(&r)); - } - } - } - - scale_denom_validity_ = scale_denom; -} - -rule_ptrs const& feature_type_style::get_if_rules(double scale_denom) -{ - if (scale_denom_validity_ != scale_denom) - { - update_rule_cache(scale_denom); - } - return if_rules_; -} - -rule_ptrs const& feature_type_style::get_else_rules(double scale_denom) -{ - if (scale_denom_validity_ != scale_denom) - { - update_rule_cache(scale_denom); - } - return else_rules_; -} - -rule_ptrs const& feature_type_style::get_also_rules(double scale_denom) -{ - if (scale_denom_validity_ != scale_denom) - { - update_rule_cache(scale_denom); - } - return also_rules_; -} } diff -Nru mapnik-2.1.0/src/font_engine_freetype.cpp mapnik-2.2.0/src/font_engine_freetype.cpp --- mapnik-2.1.0/src/font_engine_freetype.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/font_engine_freetype.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -27,12 +27,19 @@ #include #include #include +#include +#include +#include // boost #include #include #include + +// stl #include +#include +#include // icu #include @@ -42,7 +49,11 @@ namespace mapnik { -freetype_engine::freetype_engine() + + +freetype_engine::freetype_engine() : + library_(NULL) + { FT_Error error = FT_Init_FreeType( &library_ ); if (error) @@ -58,15 +69,16 @@ bool freetype_engine::is_font_file(std::string const& file_name) { - /** only accept files that will be matched by freetype2's `figurefiletype()` */ - std::string const& fn = boost::algorithm::to_lower_copy(file_name); + // only accept files that will be matched by freetype2's `figurefiletype()` + std::string fn = file_name; + std::transform(fn.begin(), fn.end(), fn.begin(), ::tolower); return boost::algorithm::ends_with(fn,std::string(".ttf")) || boost::algorithm::ends_with(fn,std::string(".otf")) || boost::algorithm::ends_with(fn,std::string(".ttc")) || boost::algorithm::ends_with(fn,std::string(".pfa")) || boost::algorithm::ends_with(fn,std::string(".pfb")) || boost::algorithm::ends_with(fn,std::string(".ttc")) || - /** Plus OSX custom ext */ + // Plus OSX custom ext boost::algorithm::ends_with(fn,std::string(".dfont")); } @@ -103,11 +115,11 @@ if (face->family_name && face->style_name) { std::string name = std::string(face->family_name) + " " + std::string(face->style_name); - // skip fonts with leading . in name + // skip fonts with leading . in the name if (!boost::algorithm::starts_with(name,".")) { - success = true; name2file_.insert(std::make_pair(name, std::make_pair(i,file_name))); + success = true; } } else @@ -133,12 +145,11 @@ bool freetype_engine::register_fonts(std::string const& dir, bool recurse) { - boost::filesystem::path path(dir); - if (!boost::filesystem::exists(path)) + if (!mapnik::util::exists(dir)) { return false; } - if (!boost::filesystem::is_directory(path)) + if (!mapnik::util::is_directory(dir)) { return mapnik::freetype_engine::register_font(dir); } @@ -166,8 +177,8 @@ std::string base_name = itr->filename(); #endif if (!boost::algorithm::starts_with(base_name,".") && - boost::filesystem::is_regular_file(file_name) && - is_font_file(file_name)) + boost::filesystem::is_regular_file(file_name) && + is_font_file(file_name)) { if (mapnik::freetype_engine::register_font(file_name)) { @@ -199,18 +210,47 @@ face_ptr freetype_engine::create_face(std::string const& family_name) { - std::map >::iterator itr; + std::map >::const_iterator itr; itr = name2file_.find(family_name); if (itr != name2file_.end()) { FT_Face face; - FT_Error error = FT_New_Face (library_, - itr->second.second.c_str(), - itr->second.first, - &face); - if (!error) + + std::map::const_iterator mem_font_itr = memory_fonts_.find(itr->second.second); + + if (mem_font_itr != memory_fonts_.end()) // memory font + { + FT_Error error = FT_New_Memory_Face(library_, + (FT_Byte const*) mem_font_itr->second.c_str(), //buffer + mem_font_itr->second.size(), // size + itr->second.first, // face index + &face); + + if (!error) return boost::make_shared(face); + } + else { - return boost::make_shared(face); + // load font into memory +#ifdef MAPNIK_THREADSAFE + mutex::scoped_lock lock(mutex_); +#endif + std::ifstream is(itr->second.second.c_str() , std::ios::binary); + std::string buffer((std::istreambuf_iterator(is)), + std::istreambuf_iterator()); + std::pair::iterator,bool> result + = memory_fonts_.insert(std::make_pair(itr->second.second, buffer)); + + FT_Error error = FT_New_Memory_Face (library_, + (FT_Byte const*) result.first->second.c_str(), + buffer.size(), + itr->second.first, + &face); + if (!error) return boost::make_shared(face); + else + { + // we can't load font, erase it. + memory_fonts_.erase(result.first); + } } } return face_ptr(); @@ -227,12 +267,36 @@ return stroker_ptr(); } -char_info font_face_set::character_dimensions(const unsigned c) +void font_face_set::add(face_ptr face) +{ + faces_.push_back(face); + dimension_cache_.clear(); //Make sure we don't use old cached data +} + +font_face_set::size_type font_face_set::size() const +{ + return faces_.size(); +} + +glyph_ptr font_face_set::get_glyph(unsigned c) const +{ + BOOST_FOREACH ( face_ptr const& face, faces_) + { + FT_UInt g = face->get_char(c); + if (g) return boost::make_shared(face, g); + } + + // Final fallback to empty square if nothing better in any font + return boost::make_shared(*faces_.begin(), 0); +} + +char_info font_face_set::character_dimensions(unsigned int c) { //Check if char is already in cache - std::map::const_iterator itr; - itr = dimension_cache_.find(c); - if (itr != dimension_cache_.end()) { + typedef std::map::const_iterator iterator_type; + iterator_type itr = dimension_cache_.find(c); + if (itr != dimension_cache_.end()) + { return itr->second; } @@ -269,8 +333,8 @@ unsigned tempx = face->glyph->advance.x >> 6; - char_info dim(c, tempx, glyph_bbox.yMax, glyph_bbox.yMin, face->size->metrics.height/64.0 /* >> 6 */); - dimension_cache_.insert(std::pair(c, dim)); + char_info dim(c, tempx, glyph_bbox.yMax, glyph_bbox.yMin, face->size->metrics.height/64.0); + dimension_cache_.insert(std::make_pair(c, dim)); return dim; } @@ -321,15 +385,137 @@ ubidi_close(bidi); } +void font_face_set::set_pixel_sizes(unsigned size) +{ + BOOST_FOREACH ( face_ptr const& face, faces_) + { + face->set_pixel_sizes(size); + } +} + +void font_face_set::set_character_sizes(double size) +{ + BOOST_FOREACH ( face_ptr const& face, faces_) + { + face->set_character_sizes(size); + } +} + + +template +void composite_bitmap(T & pixmap, + FT_Bitmap *bitmap, + unsigned rgba, + int x, + int y, + double opacity, + composite_mode_e comp_op) +{ + int x_max=x+bitmap->width; + int y_max=y+bitmap->rows; + int i,p,j,q; + + for (i=x,p=0;ibuffer[q*bitmap->width+p]; + if (gray) + { + pixmap.composite_pixel(comp_op, i, j, rgba, gray, opacity); + } + } + } +} + +template +void render_halo(T & pixmap, + FT_Bitmap *bitmap, + unsigned rgba, + int x1, + int y1, + double halo_radius, + double opacity, + composite_mode_e comp_op) +{ + int width = bitmap->width; + int height = bitmap->rows; + int x, y; + if (halo_radius < 1.0) + { + for (x=0; x < width; x++) + { + for (y=0; y < height; y++) + { + int gray = bitmap->buffer[y*bitmap->width+x]; + if (gray) + { + pixmap.composite_pixel(comp_op, x+x1-1, y+y1-1, rgba, gray*halo_radius*halo_radius, opacity); + pixmap.composite_pixel(comp_op, x+x1, y+y1-1, rgba, gray*halo_radius, opacity); + pixmap.composite_pixel(comp_op, x+x1+1, y+y1-1, rgba, gray*halo_radius*halo_radius, opacity); + + pixmap.composite_pixel(comp_op, x+x1-1, y+y1, rgba, gray*halo_radius, opacity); + pixmap.composite_pixel(comp_op, x+x1, y+y1, rgba, gray, opacity); + pixmap.composite_pixel(comp_op, x+x1+1, y+y1, rgba, gray*halo_radius, opacity); + + pixmap.composite_pixel(comp_op, x+x1-1, y+y1+1, rgba, gray*halo_radius*halo_radius, opacity); + pixmap.composite_pixel(comp_op, x+x1, y+y1+1, rgba, gray*halo_radius, opacity); + pixmap.composite_pixel(comp_op, x+x1+1, y+y1+1, rgba, gray*halo_radius*halo_radius, opacity); + } + } + } + } else { + for (x=0; x < width; x++) + { + for (y=0; y < height; y++) + { + int gray = bitmap->buffer[y*bitmap->width+x]; + if (gray) + { + for (int n=-halo_radius; n <=halo_radius; ++n) + for (int m=-halo_radius; m <= halo_radius; ++m) + pixmap.composite_pixel(comp_op, x+x1+m, y+y1+n, rgba, gray, opacity); + } + } + } + } +} + +template +void render_halo_id(T & pixmap, + FT_Bitmap *bitmap, + mapnik::value_integer feature_id, + int x1, + int y1, + int halo_radius) +{ + int width = bitmap->width; + int height = bitmap->rows; + int x, y; + for (x=0; x < width; x++) + { + for (y=0; y < height; y++) + { + int gray = bitmap->buffer[y*bitmap->width+x]; + if (gray) + { + for (int n=-halo_radius; n <=halo_radius; ++n) + for (int m=-halo_radius; m <= halo_radius; ++m) + pixmap.setPixel(x+x1+m,y+y1+n,feature_id); + } + } + } +} + template -text_renderer::text_renderer (pixmap_type & pixmap, - face_manager &font_manager_, - stroker & s, - composite_mode_e comp_op, - double scale_factor) +text_renderer::text_renderer(pixmap_type & pixmap, + face_manager & font_manager, + halo_rasterizer_e rasterizer, + composite_mode_e comp_op, + double scale_factor) : pixmap_(pixmap), - font_manager_(font_manager_), - stroker_(s), + font_manager_(font_manager), + rasterizer_(rasterizer), comp_op_(comp_op), scale_factor_(scale_factor) {} @@ -347,12 +533,12 @@ bbox.xMin = bbox.yMin = 32000; // Initialize these so we can tell if we bbox.xMax = bbox.yMax = -32000; // properly grew the bbox later - for (int i = 0; i < path.num_nodes(); i++) + for (int i = 0; i < path.num_nodes(); ++i) { char_info_ptr c; double x, y, angle; - path.vertex(&c, &x, &y, &angle); + path.vertex(c, x, y, angle); // TODO Enable when we have support for setting verbosity // MAPNIK_LOG_DEBUG(font_engine_freetype) << "text_renderer: prepare_glyphs=" @@ -370,10 +556,10 @@ glyph_ptr glyph = faces->get_glyph(unsigned(c->c)); FT_Face face = glyph->get_face()->get_face(); - matrix.xx = (FT_Fixed)( cos( angle ) * 0x10000L ); - matrix.xy = (FT_Fixed)(-sin( angle ) * 0x10000L ); - matrix.yx = (FT_Fixed)( sin( angle ) * 0x10000L ); - matrix.yy = (FT_Fixed)( cos( angle ) * 0x10000L ); + matrix.xx = (FT_Fixed)( std::cos( angle ) * 0x10000L ); + matrix.xy = (FT_Fixed)(-std::sin( angle ) * 0x10000L ); + matrix.yx = (FT_Fixed)( std::sin( angle ) * 0x10000L ); + matrix.yy = (FT_Fixed)( std::cos( angle ) * 0x10000L ); FT_Set_Transform(face, &matrix, &pen); @@ -412,27 +598,7 @@ } template -void composite_bitmap(T & pixmap, FT_Bitmap *bitmap, unsigned rgba, int x, int y, double opacity, composite_mode_e comp_op) -{ - int x_max=x+bitmap->width; - int y_max=y+bitmap->rows; - int i,p,j,q; - - for (i=x,p=0;ibuffer[q*bitmap->width+p]; - if (gray) - { - pixmap.composite_pixel(comp_op, i, j, rgba, gray, opacity); - } - } - } -} - -template -void text_renderer::render(pixel_position pos) +void text_renderer::render(pixel_position const& pos) { FT_Error error; FT_Vector start; @@ -448,24 +614,44 @@ double halo_radius = itr->properties->halo_radius * scale_factor_; //make sure we've got reasonable values. if (halo_radius <= 0.0 || halo_radius > 1024.0) continue; - stroker_.init(halo_radius); FT_Glyph g; error = FT_Glyph_Copy(itr->image, &g); if (!error) { FT_Glyph_Transform(g,0,&start); - FT_Glyph_Stroke(&g,stroker_.get(),1); - error = FT_Glyph_To_Bitmap( &g,FT_RENDER_MODE_NORMAL,0,1); - if ( ! error ) + if (rasterizer_ == HALO_RASTERIZER_FULL) { - - FT_BitmapGlyph bit = (FT_BitmapGlyph)g; - composite_bitmap(pixmap_, &bit->bitmap, itr->properties->halo_fill.rgba(), - bit->left, - height - bit->top, - itr->properties->text_opacity, - comp_op_ - ); + stroker_ptr stk = font_manager_.get_stroker(); + stk->init(halo_radius); + FT_Glyph_Stroke(&g,stk->get(),1); + error = FT_Glyph_To_Bitmap( &g,FT_RENDER_MODE_NORMAL,0,1); + if (!error) + { + FT_BitmapGlyph bit = (FT_BitmapGlyph)g; + composite_bitmap(pixmap_, + &bit->bitmap, + itr->properties->halo_fill.rgba(), + bit->left, + height - bit->top, + itr->properties->text_opacity, + comp_op_); + } + } + else + { + error = FT_Glyph_To_Bitmap( &g,FT_RENDER_MODE_NORMAL,0,1); + if (!error) + { + FT_BitmapGlyph bit = (FT_BitmapGlyph)g; + render_halo(pixmap_, + &bit->bitmap, + itr->properties->halo_fill.rgba(), + bit->left, + height - bit->top, + halo_radius, + itr->properties->text_opacity, + comp_op_); + } } } FT_Done_Glyph(g); @@ -481,13 +667,11 @@ { FT_BitmapGlyph bit = (FT_BitmapGlyph)itr->image; - //render_bitmap(&bit->bitmap, itr->properties->fill.rgba(), - // bit->left, - // height - bit->top, itr->properties->text_opacity); - - composite_bitmap(pixmap_, &bit->bitmap, itr->properties->fill.rgba(), + composite_bitmap(pixmap_, + &bit->bitmap, + itr->properties->fill.rgba(), bit->left, - height - bit->top, + height - bit->top, itr->properties->text_opacity, comp_op_ ); @@ -495,9 +679,9 @@ } } - template -void text_renderer::render_id(int feature_id, pixel_position pos, double min_radius) +void text_renderer::render_id(mapnik::value_integer feature_id, + pixel_position const& pos) { FT_Error error; FT_Vector start; @@ -510,25 +694,18 @@ typename glyphs_t::iterator itr; for (itr = glyphs_.begin(); itr != glyphs_.end(); ++itr) { - stroker_.init(std::max(itr->properties->halo_radius, min_radius)); - FT_Glyph g; - error = FT_Glyph_Copy(itr->image, &g); - if (!error) + FT_Glyph_Transform(itr->image,0,&start); + error = FT_Glyph_To_Bitmap( &(itr->image),FT_RENDER_MODE_NORMAL,0,1); + if ( ! error ) { - FT_Glyph_Transform(g,0,&start); - FT_Glyph_Stroke(&g,stroker_.get(),1); - error = FT_Glyph_To_Bitmap( &g,FT_RENDER_MODE_NORMAL,0,1); - //error = FT_Glyph_To_Bitmap( &g,FT_RENDER_MODE_MONO,0,1); - if ( ! error ) - { - - FT_BitmapGlyph bit = (FT_BitmapGlyph)g; - render_bitmap_id(&bit->bitmap, feature_id, - bit->left, - height - bit->top); - } + FT_BitmapGlyph bit = (FT_BitmapGlyph)itr->image; + render_halo_id(pixmap_, + &bit->bitmap, + feature_id, + bit->left, + height - bit->top, + itr->properties->halo_radius); } - FT_Done_Glyph(g); } } @@ -536,11 +713,20 @@ boost::mutex freetype_engine::mutex_; #endif std::map > freetype_engine::name2file_; -template void text_renderer::render(pixel_position); -template text_renderer::text_renderer(image_32&, face_manager&, stroker&, composite_mode_e, double); -template box2dtext_renderer::prepare_glyphs(text_path const&); +std::map freetype_engine::memory_fonts_; -template void text_renderer::render_id(int, pixel_position, double ); -template text_renderer::text_renderer(grid&, face_manager&, stroker&, composite_mode_e, double); +template text_renderer::text_renderer(image_32&, + face_manager&, + halo_rasterizer_e, + composite_mode_e, + double); +template box2dtext_renderer::prepare_glyphs(text_path const&); +template void text_renderer::render(pixel_position const&); +template void text_renderer::render_id(mapnik::value_integer, + pixel_position const&); +template text_renderer::text_renderer(grid&, + face_manager&, + halo_rasterizer_e, + composite_mode_e, double); template box2dtext_renderer::prepare_glyphs(text_path const& ); } diff -Nru mapnik-2.1.0/src/font_set.cpp mapnik-2.2.0/src/font_set.cpp --- mapnik-2.1.0/src/font_set.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/font_set.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,12 +25,9 @@ //stl #include -#include namespace mapnik { -font_set::font_set() - : name_("") {} font_set::font_set(std::string const& name) : name_(name) {} @@ -61,6 +58,11 @@ face_names_.push_back(face_name); } +void font_set::set_name(std::string const& name) +{ + name_ = name; +} + std::string const& font_set::get_name() const { return name_; diff -Nru mapnik-2.1.0/src/formatting/base.cpp mapnik-2.2.0/src/formatting/base.cpp --- mapnik-2.1.0/src/formatting/base.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/formatting/base.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -50,7 +50,7 @@ { continue; } - node_ptr n = registry::instance()->from_xml(*itr); + node_ptr n = registry::instance().from_xml(*itr); if (n) list->push_back(n); } if (list->get_children().size() == 1) { diff -Nru mapnik-2.1.0/src/formatting/expression.cpp mapnik-2.2.0/src/formatting/expression.cpp --- mapnik-2.1.0/src/formatting/expression.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/formatting/expression.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,7 +22,7 @@ // mapnik #include -#include +#include #include #include #include @@ -30,6 +30,9 @@ #include #include +// boost +#include + namespace mapnik { namespace formatting { @@ -63,7 +66,7 @@ n->text_size = get_expression(xml, "size"); n->character_spacing = get_expression(xml, "character-spacing"); n->line_spacing = get_expression(xml, "line-spacing"); - n->text_opacity = get_expression(xml, "opactity"); + n->text_opacity = get_expression(xml, "opacity"); n->wrap_before = get_expression(xml, "wrap-before"); n->wrap_char = get_expression(xml, "wrap-character"); n->fill = get_expression(xml, "fill"); @@ -80,29 +83,29 @@ } -void expression_format::apply(char_properties const& p, const Feature &feature, processed_text &output) const +void expression_format::apply(char_properties const& p, feature_impl const& feature, processed_text &output) const { char_properties new_properties = p; if (face_name) new_properties.face_name = - boost::apply_visitor(evaluate(feature), *face_name).to_string(); + boost::apply_visitor(evaluate(feature), *face_name).to_string(); if (text_size) new_properties.text_size = - boost::apply_visitor(evaluate(feature), *text_size).to_double(); + boost::apply_visitor(evaluate(feature), *text_size).to_double(); if (character_spacing) new_properties.character_spacing = - boost::apply_visitor(evaluate(feature), *character_spacing).to_double(); + boost::apply_visitor(evaluate(feature), *character_spacing).to_double(); if (line_spacing) new_properties.line_spacing = - boost::apply_visitor(evaluate(feature), *line_spacing).to_double(); + boost::apply_visitor(evaluate(feature), *line_spacing).to_double(); if (text_opacity) new_properties.text_opacity = - boost::apply_visitor(evaluate(feature), *text_opacity).to_double(); + boost::apply_visitor(evaluate(feature), *text_opacity).to_double(); if (wrap_before) new_properties.wrap_before = - boost::apply_visitor(evaluate(feature), *wrap_before).to_bool(); + boost::apply_visitor(evaluate(feature), *wrap_before).to_bool(); if (wrap_char) new_properties.wrap_char = - boost::apply_visitor(evaluate(feature), *character_spacing).to_unicode()[0]; + boost::apply_visitor(evaluate(feature), *character_spacing).to_unicode()[0]; // if (fill) new_properties.fill = -// boost::apply_visitor(evaluate(feature), *fill).to_color(); +// boost::apply_visitor(evaluate(feature), *fill).to_color(); // if (halo_fill) new_properties.halo_fill = -// boost::apply_visitor(evaluate(feature), *halo_fill).to_color(); +// boost::apply_visitor(evaluate(feature), *halo_fill).to_color(); if (halo_radius) new_properties.halo_radius = - boost::apply_visitor(evaluate(feature), *halo_radius).to_double(); + boost::apply_visitor(evaluate(feature), *halo_radius).to_double(); if (child_) { child_->apply(new_properties, feature, output); diff -Nru mapnik-2.1.0/src/formatting/format.cpp mapnik-2.2.0/src/formatting/format.cpp --- mapnik-2.1.0/src/formatting/format.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/formatting/format.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,10 +22,14 @@ // mapnik #include +#include #include #include #include +// boost +#include + namespace mapnik { namespace formatting { @@ -59,10 +63,10 @@ n->face_name = xml.get_opt_attr("face-name"); /*TODO: Fontset is problematic. We don't have the fontsets pointer here... */ - n->text_size = xml.get_opt_attr("size"); - n->character_spacing = xml.get_opt_attr("character-spacing"); - n->line_spacing = xml.get_opt_attr("line-spacing"); - n->text_opacity = xml.get_opt_attr("opactity"); + n->text_size = xml.get_opt_attr("size"); + n->character_spacing = xml.get_opt_attr("character-spacing"); + n->line_spacing = xml.get_opt_attr("line-spacing"); + n->text_opacity = xml.get_opt_attr("opacity"); boost::optional wrap = xml.get_opt_attr("wrap-before"); if (wrap) n->wrap_before = *wrap; n->wrap_char = xml.get_opt_attr("wrap-character"); @@ -74,7 +78,7 @@ } -void format_node::apply(char_properties const& p, const Feature &feature, processed_text &output) const +void format_node::apply(char_properties const& p, const feature_impl &feature, processed_text &output) const { char_properties new_properties = p; if (face_name) new_properties.face_name = *face_name; diff -Nru mapnik-2.1.0/src/formatting/list.cpp mapnik-2.2.0/src/formatting/list.cpp --- mapnik-2.1.0/src/formatting/list.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/formatting/list.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,8 +22,11 @@ // mapnik #include +#include + // boost #include +#include namespace mapnik { using boost::property_tree::ptree; @@ -40,7 +43,7 @@ } -void list_node::apply(char_properties const& p, Feature const& feature, processed_text &output) const +void list_node::apply(char_properties const& p, feature_impl const& feature, processed_text &output) const { BOOST_FOREACH(node_ptr const& node, children_) { diff -Nru mapnik-2.1.0/src/formatting/registry.cpp mapnik-2.2.0/src/formatting/registry.cpp --- mapnik-2.1.0/src/formatting/registry.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/formatting/registry.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include diff -Nru mapnik-2.1.0/src/formatting/text.cpp mapnik-2.2.0/src/formatting/text.cpp --- mapnik-2.1.0/src/formatting/text.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/formatting/text.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -28,12 +28,16 @@ #include #include +// boost +#include +#include + namespace mapnik { namespace formatting { -using boost::property_tree::ptree; +using boost::property_tree::ptree; void text_node::to_xml(ptree &xml) const { @@ -47,9 +51,9 @@ return boost::make_shared(xml.get_value()); } -void text_node::apply(char_properties const& p, Feature const& feature, processed_text &output) const +void text_node::apply(char_properties const& p, feature_impl const& feature, processed_text &output) const { - UnicodeString text_str = boost::apply_visitor(evaluate(feature), *text_).to_unicode(); + UnicodeString text_str = boost::apply_visitor(evaluate(feature), *text_).to_unicode(); if (p.text_transform == UPPERCASE) { text_str = text_str.toUpper(); diff -Nru mapnik-2.1.0/src/fs.cpp mapnik-2.2.0/src/fs.cpp --- mapnik-2.1.0/src/fs.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/fs.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,153 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +//#define BOOST_FILESYSTEM_VERSION 2 + +// mapnik +#include +#include + +// boost +#include + +// stl +#include + +#if (BOOST_FILESYSTEM_VERSION <= 2) +#include + +namespace boost { +namespace filesystem { +path read_symlink(const path& p) +{ + path symlink_path; + +#ifdef BOOST_POSIX_API + for (std::size_t path_max = 64;; path_max *= 2)// loop 'til buffer is large enough + { + boost::scoped_array buf(new char[path_max]); + ssize_t result; + if ((result=::readlink(p.string().c_str(), buf.get(), path_max))== -1) + { + throw std::runtime_error("could not read symlink"); + } + else + { + if(result != static_cast(path_max)) + { + symlink_path.assign(buf.get(), buf.get() + result); + break; + } + } + } +#endif + return symlink_path; +} +} +} +#endif + +namespace mapnik { + +namespace util { + + bool exists(std::string const& filepath) + { +#ifdef _WINDOWS + return boost::filesystem::exists(mapnik::utf8_to_utf16(filepath)); +#else + return boost::filesystem::exists(filepath); +#endif + } + + bool is_directory(std::string const& filepath) + { +#ifdef _WINDOWS + return boost::filesystem::is_directory(mapnik::utf8_to_utf16(filepath)); +#else + return boost::filesystem::is_directory(filepath); +#endif + } + + bool remove(std::string const& filepath) + { +#ifdef _WINDOWS + return boost::filesystem::remove(mapnik::utf8_to_utf16(filepath)); +#else + return boost::filesystem::remove(filepath); +#endif + } + + bool is_relative(std::string const& filepath) + { + +#ifdef _WINDOWS + boost::filesystem::path child_path(mapnik::utf8_to_utf16(filepath)); +#else + boost::filesystem::path child_path(filepath); +#endif + return (! child_path.has_root_directory() && ! child_path.has_root_name()); + } + + + std::string make_relative(std::string const& filepath, std::string const& base) + { +#ifdef _WINDOWS + boost::filesystem::path absolute_path(mapnik::utf8_to_utf16(base)); +#else + boost::filesystem::path absolute_path(base); +#endif + // support symlinks + if (boost::filesystem::is_symlink(absolute_path)) + { + absolute_path = boost::filesystem::read_symlink(absolute_path); + } +#if (BOOST_FILESYSTEM_VERSION == 3) + return boost::filesystem::absolute(absolute_path.parent_path() / filepath).string(); +#else + return boost::filesystem::complete(absolute_path.branch_path() / filepath).normalize().string(); +#endif + } + + std::string make_absolute(std::string const& filepath, std::string const& base) + { +#if (BOOST_FILESYSTEM_VERSION == 3) + // TODO - normalize is now deprecated, use make_preferred? + return boost::filesystem::absolute(boost::filesystem::path(base)/filepath).string(); +#else // v2 + return boost::filesystem::complete(boost::filesystem::path(base)/filepath).normalize().string(); +#endif + } + + std::string dirname(std::string const& filepath) + { + boost::filesystem::path bp(filepath); +#if (BOOST_FILESYSTEM_VERSION == 3) + return bp.parent_path().string(); +#else // v2 + return bp.branch_path().string(); +#endif + } + +} // end namespace util + +} // end namespace mapnik diff -Nru mapnik-2.1.0/src/gamma_method.cpp mapnik-2.2.0/src/gamma_method.cpp --- mapnik-2.1.0/src/gamma_method.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/gamma_method.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,6 +22,7 @@ // mapnik #include +#include namespace mapnik { diff -Nru mapnik-2.1.0/src/gradient.cpp mapnik-2.2.0/src/gradient.cpp --- mapnik-2.1.0/src/gradient.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/gradient.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,7 +21,7 @@ *****************************************************************************/ #include -#include +#include namespace mapnik { @@ -35,6 +35,14 @@ IMPLEMENT_ENUM( gradient_e, gradient_strings ) +static const char * gradient_unit_strings[] = { + "user-space-on-use", + "user-space-on-use-bounding-box", + "object-bounding-box", + "" +}; + +IMPLEMENT_ENUM( gradient_unit_e, gradient_unit_strings ) gradient::gradient() : gradient_type_(NO_GRADIENT), diff -Nru mapnik-2.1.0/src/graphics.cpp mapnik-2.2.0/src/graphics.cpp --- mapnik-2.1.0/src/graphics.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/graphics.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -31,16 +31,13 @@ #include "agg_rendering_buffer.h" #include "agg_pixfmt_rgba.h" -// cairo -#ifdef HAVE_CAIRO -#include -#endif - // boost #include -// stl -#include +// cairo +#ifdef HAVE_CAIRO +#include +#endif namespace mapnik { @@ -57,22 +54,22 @@ painted_(rhs.painted_) {} #ifdef HAVE_CAIRO -image_32::image_32(Cairo::RefPtr rhs) - :width_(rhs->get_width()), - height_(rhs->get_height()), - data_(rhs->get_width(),rhs->get_height()) +image_32::image_32(cairo_surface_ptr const& surface) + :width_(cairo_image_surface_get_width(&*surface)), + height_(cairo_image_surface_get_height(&*surface)), + data_(width_, height_) { painted_ = true; - if (rhs->get_format() != Cairo::FORMAT_ARGB32) + if ( cairo_image_surface_get_format(&*surface) != CAIRO_FORMAT_ARGB32) { MAPNIK_LOG_WARN(graphics) << "Unable to convert this Cairo format"; - return; // throw exception ?? + throw; } - int stride = rhs->get_stride() / 4; + int stride = cairo_image_surface_get_stride(&*surface) / 4; boost::scoped_array out_row(new unsigned int[width_]); - const unsigned int *in_row = (const unsigned int *)rhs->get_data(); + const unsigned int *in_row = (const unsigned int *)cairo_image_surface_get_data(&*surface); for (unsigned int row = 0; row < height_; row++, in_row += stride) { @@ -117,7 +114,7 @@ unsigned b = (rgba >> 16) & 0xff; // magic numbers for grayscale - unsigned a = (int)((r * .3) + (g * .59) + (b * .11)); + unsigned a = static_cast(std::ceil((r * .3) + (g * .59) + (b * .11))); row_from[x] = (a << 24)| (255 << 16) | (255 << 8) | (255) ; } @@ -145,42 +142,39 @@ void image_32::set_alpha(float opacity) { + for (unsigned int y = 0; y < height_; ++y) { - for (unsigned int y = 0; y < height_; ++y) + unsigned int* row_to = data_.getRow(y); + for (unsigned int x = 0; x < width_; ++x) { - unsigned int* row_to = data_.getRow(y); - for (unsigned int x = 0; x < width_; ++x) - { - unsigned rgba = row_to[x]; + unsigned rgba = row_to[x]; #ifdef MAPNIK_BIG_ENDIAN - unsigned a0 = (rgba & 0xff); - unsigned a1 = int( (rgba & 0xff) * opacity ); + unsigned a0 = (rgba & 0xff); + unsigned a1 = int( (rgba & 0xff) * opacity ); - if (a0 == a1) continue; + if (a0 == a1) continue; - unsigned r = (rgba >> 24) & 0xff; - unsigned g = (rgba >> 16 ) & 0xff; - unsigned b = (rgba >> 8) & 0xff; + unsigned r = (rgba >> 24) & 0xff; + unsigned g = (rgba >> 16 ) & 0xff; + unsigned b = (rgba >> 8) & 0xff; - row_to[x] = (a1) | (b << 8) | (g << 16) | (r << 24) ; + row_to[x] = (a1) | (b << 8) | (g << 16) | (r << 24) ; #else - unsigned a0 = (rgba >> 24) & 0xff; - unsigned a1 = int( ((rgba >> 24) & 0xff) * opacity ); - //unsigned a1 = opacity; - if (a0 == a1) continue; - - unsigned r = rgba & 0xff; - unsigned g = (rgba >> 8 ) & 0xff; - unsigned b = (rgba >> 16) & 0xff; + unsigned a0 = (rgba >> 24) & 0xff; + unsigned a1 = int( ((rgba >> 24) & 0xff) * opacity ); + //unsigned a1 = opacity; + if (a0 == a1) continue; + + unsigned r = rgba & 0xff; + unsigned g = (rgba >> 8 ) & 0xff; + unsigned b = (rgba >> 16) & 0xff; - row_to[x] = (a1 << 24)| (b << 16) | (g << 8) | (r) ; + row_to[x] = (a1 << 24)| (b << 16) | (g << 8) | (r) ; #endif - } } } - } void image_32::set_background(const color& c) @@ -214,7 +208,7 @@ typedef color_type::value_type value_type; typedef agg::order_rgba order_type; typedef agg::comp_op_adaptor_rgba blender_type; - + if (checkBounds(x,y)) { unsigned rgba = data_(x,y); @@ -222,8 +216,8 @@ unsigned cb = (c >> 16 ) & 0xff; unsigned cg = (c >> 8) & 0xff; unsigned cr = (c & 0xff); - blender_type::blend_pix(op, (value_type*)&rgba, cr, cg, cb, ca, cover); - data_(x,y) = rgba; + blender_type::blend_pix(op, (value_type*)&rgba, cr, cg, cb, ca, cover); + data_(x,y) = rgba; } } diff -Nru mapnik-2.1.0/src/grid/grid.cpp mapnik-2.2.0/src/grid/grid.cpp --- mapnik-2.1.0/src/grid/grid.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/grid/grid.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,6 +22,12 @@ // mapnik #include +#include +#include +#include + +// boost +#include namespace mapnik { @@ -66,9 +72,21 @@ } template +void hit_grid::clear() +{ + painted_ = false; + f_keys_.clear(); + features_.clear(); + names_.clear(); + f_keys_[base_mask] = ""; + data_.set(base_mask); + ctx_ = boost::make_shared(); +} + +template void hit_grid::add_feature(mapnik::feature_impl & feature) { - int feature_id = feature.id(); + value_type feature_id = feature.id(); // avoid adding duplicate features (e.g. in the case of both a line symbolizer and a polygon symbolizer) typename feature_key_type::const_iterator feature_pos = f_keys_.find(feature_id); if (feature_pos != f_keys_.end()) @@ -126,6 +144,6 @@ } -template class hit_grid; +template class hit_grid; } diff -Nru mapnik-2.1.0/src/grid/grid_renderer.cpp mapnik-2.2.0/src/grid/grid_renderer.cpp --- mapnik-2.1.0/src/grid/grid_renderer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/grid/grid_renderer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,12 +23,15 @@ // mapnik #include #include -#include -#include +#include #include + +#include +#include #include #include +#include #include #include #include @@ -36,12 +39,13 @@ #include #include #include +#include #include -#include +#include #include +#include // boost -#include #include // agg @@ -69,6 +73,24 @@ } template +grid_renderer::grid_renderer(Map const& m, request const& req, T & pixmap, double scale_factor, unsigned offset_x, unsigned offset_y) + : feature_style_processor(m, scale_factor), + pixmap_(pixmap), + width_(pixmap_.width()), + height_(pixmap_.height()), + scale_factor_(scale_factor), + // NOTE: can change this to m dims instead of pixmap_ if render-time + // resolution support is dropped from grid_renderer python interface + t_(pixmap_.width(),pixmap_.height(),req.extent(),offset_x,offset_y), + font_engine_(), + font_manager_(font_engine_), + detector_(boost::make_shared(box2d(-req.buffer_size(), -req.buffer_size(), req.width() + req.buffer_size() ,req.height() + req.buffer_size()))), + ras_ptr(new grid_rasterizer) +{ + setup(m); +} + +template void grid_renderer::setup(Map const& m) { MAPNIK_LOG_DEBUG(grid_renderer) << "grid_renderer: Scale=" << m.scale(); @@ -104,17 +126,6 @@ detector_->clear(); } query_extent_ = query_extent; - int buffer_size = lay.buffer_size(); - if (buffer_size != 0 ) - { - double padding = buffer_size * (double)(query_extent.width()/pixmap_.width()); - double x0 = query_extent_.minx(); - double y0 = query_extent_.miny(); - double x1 = query_extent_.maxx(); - double y1 = query_extent_.maxy(); - query_extent_.init(x0 - padding, y0 - padding, x1 + padding , y1 + padding); - } - boost::optional > const& maximum_extent = lay.maximum_extent(); if (maximum_extent) { @@ -134,15 +145,16 @@ if (marker.is_vector()) { typedef coord_transform path_type; - typedef agg::renderer_base ren_base; - typedef agg::renderer_scanline_bin_solid renderer; + typedef typename grid_renderer_base_type::pixfmt_type pixfmt_type; + typedef typename grid_renderer_base_type::pixfmt_type::color_type color_type; + typedef agg::renderer_scanline_bin_solid renderer_type; agg::scanline_bin sl; grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_); - mapnik::pixfmt_gray32 pixf(buf); + pixfmt_type pixf(buf); - ren_base renb(pixf); - renderer ren(renb); + grid_renderer_base_type renb(pixf); + renderer_type ren(renb); ras_ptr->reset(); @@ -158,10 +170,10 @@ using namespace mapnik::svg; vertex_stl_adapter stl_storage((*marker.get_vector_data())->source()); svg_path_adapter svg_path(stl_storage); - svg_renderer, - renderer, - mapnik::pixfmt_gray32> svg_renderer(svg_path, + renderer_type, + pixfmt_type> svg_renderer(svg_path, (*marker.get_vector_data())->attributes()); svg_renderer.render_id(*ras_ptr, sl, renb, feature.id(), mtx, opacity, bbox); @@ -186,8 +198,11 @@ // TODO - remove support for step != or add support for agg scaling with opacity double ratio = (1.0/step); image_data_32 target(ratio * data.width(), ratio * data.height()); - mapnik::scale_image_agg(target,data, SCALING_NEAR, - scale_factor_, 0.0, 0.0, 1.0, ratio); + mapnik::scale_image_agg(target, + data, + SCALING_NEAR, + ratio, + ratio); pixmap_.set_rectangle(feature.id(), target, boost::math::iround(pos.x - cx), boost::math::iround(pos.y - cy)); diff -Nru mapnik-2.1.0/src/grid/process_building_symbolizer.cpp mapnik-2.2.0/src/grid/process_building_symbolizer.cpp --- mapnik-2.1.0/src/grid/process_building_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/grid/process_building_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,17 +21,22 @@ *****************************************************************************/ // mapnik +#include #include #include -#include -#include +#include #include #include #include +#include +#include // boost #include +// stl +#include + // agg #include "agg_rasterizer_scanline_aa.h" #include "agg_renderer_scanline.h" @@ -46,16 +51,17 @@ mapnik::feature_impl & feature, proj_transform const& prj_trans) { + typedef typename grid_renderer_base_type::pixfmt_type pixfmt_type; + typedef typename grid_renderer_base_type::pixfmt_type::color_type color_type; + typedef agg::renderer_scanline_bin_solid renderer_type; typedef coord_transform path_type; - typedef agg::renderer_base ren_base; - typedef agg::renderer_scanline_bin_solid renderer; agg::scanline_bin sl; grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_); - mapnik::pixfmt_gray32 pixf(buf); + pixfmt_type pixf(buf); - ren_base renb(pixf); - renderer ren(renb); + grid_renderer_base_type renb(pixf); + renderer_type ren(renb); ras_ptr->reset(); @@ -63,7 +69,7 @@ expression_ptr height_expr = sym.height(); if (height_expr) { - value_type result = boost::apply_visitor(evaluate(feature), *height_expr); + value_type result = boost::apply_visitor(evaluate(feature), *height_expr); height = result.to_double() * scale_factor_; } @@ -108,7 +114,7 @@ path_type faces_path (t_,*faces,prj_trans); ras_ptr->add_path(faces_path); - ren.color(mapnik::gray32(feature.id())); + ren.color(color_type(feature.id())); agg::render_scanlines(*ras_ptr, sl, ren); ras_ptr->reset(); @@ -120,7 +126,7 @@ for (unsigned j=0;jmove_to(x,y+height); @@ -135,13 +141,13 @@ path_type path(t_,*frame,prj_trans); agg::conv_stroke stroke(path); ras_ptr->add_path(stroke); - ren.color(mapnik::gray32(feature.id())); + ren.color(color_type(feature.id())); agg::render_scanlines(*ras_ptr, sl, ren); ras_ptr->reset(); path_type roof_path (t_,*roof,prj_trans); ras_ptr->add_path(roof_path); - ren.color(mapnik::gray32(feature.id())); + ren.color(color_type(feature.id())); agg::render_scanlines(*ras_ptr, sl, ren); } } diff -Nru mapnik-2.1.0/src/grid/process_line_pattern_symbolizer.cpp mapnik-2.2.0/src/grid/process_line_pattern_symbolizer.cpp --- mapnik-2.1.0/src/grid/process_line_pattern_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/grid/process_line_pattern_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,10 +21,10 @@ *****************************************************************************/ // mapnik +#include #include #include -#include -#include +#include #include #include @@ -46,15 +46,16 @@ proj_transform const& prj_trans) { typedef coord_transform path_type; - typedef agg::renderer_base ren_base; - typedef agg::renderer_scanline_bin_solid renderer; + typedef typename grid_renderer_base_type::pixfmt_type pixfmt_type; + typedef typename grid_renderer_base_type::pixfmt_type::color_type color_type; + typedef agg::renderer_scanline_bin_solid renderer_type; agg::scanline_bin sl; grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_); - mapnik::pixfmt_gray32 pixf(buf); + pixfmt_type pixf(buf); - ren_base renb(pixf); - renderer ren(renb); + grid_renderer_base_type renb(pixf); + renderer_type ren(renb); ras_ptr->reset(); @@ -75,7 +76,7 @@ } // render id - ren.color(mapnik::gray32(feature.id())); + ren.color(color_type(feature.id())); agg::render_scanlines(*ras_ptr, sl, ren); // add feature properties to grid cache diff -Nru mapnik-2.1.0/src/grid/process_line_symbolizer.cpp mapnik-2.2.0/src/grid/process_line_symbolizer.cpp --- mapnik-2.1.0/src/grid/process_line_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/grid/process_line_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,10 +21,10 @@ *****************************************************************************/ // mapnik +#include #include #include -#include -#include +#include #include #include @@ -50,17 +50,18 @@ mapnik::feature_impl & feature, proj_transform const& prj_trans) { - typedef agg::renderer_base renderer_base; - typedef agg::renderer_scanline_bin_solid renderer_type; + typedef typename grid_renderer_base_type::pixfmt_type pixfmt_type; + typedef typename grid_renderer_base_type::pixfmt_type::color_type color_type; + typedef agg::renderer_scanline_bin_solid renderer_type; typedef boost::mpl::vector conv_types; + simplify_tag, smooth_tag, dash_tag, stroke_tag> conv_types; agg::scanline_bin sl; grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_); - mapnik::pixfmt_gray32 pixf(buf); + pixfmt_type pixf(buf); - renderer_base renb(pixf); + grid_renderer_base_type renb(pixf); renderer_type ren(renb); ras_ptr->reset(); @@ -74,16 +75,13 @@ if (sym.clip()) { double padding = (double)(query_extent_.width()/pixmap_.width()); - float half_stroke = stroke_.get_width()/2.0; + double half_stroke = stroke_.get_width()/2.0; if (half_stroke > 1) padding *= half_stroke; - if (fabs(sym.offset()) > 0) - padding *= fabs(sym.offset()) * 1.2; - double x0 = query_extent_.minx(); - double y0 = query_extent_.miny(); - double x1 = query_extent_.maxx(); - double y1 = query_extent_.maxy(); - clipping_extent.init(x0 - padding, y0 - padding, x1 + padding , y1 + padding); + if (std::fabs(sym.offset()) > 0) + padding *= std::fabs(sym.offset()) * 1.2; + padding *= scale_factor_; + clipping_extent.pad(padding); } vertex_converter, grid_rasterizer, line_symbolizer, @@ -91,8 +89,9 @@ converter(clipping_extent,*ras_ptr,sym,t_,prj_trans,tr,scale_factor_); if (sym.clip()) converter.set(); // optional clip (default: true) converter.set(); // always transform - if (fabs(sym.offset()) > 0.0) converter.set(); // parallel offset + if (std::fabs(sym.offset()) > 0.0) converter.set(); // parallel offset converter.set(); // optional affine transform + if (sym.simplify_tolerance() > 0.0) converter.set(); // optional simplify converter if (sym.smooth() > 0.0) converter.set(); // optional smooth converter if (stroke_.has_dash()) converter.set(); converter.set(); //always stroke @@ -106,7 +105,7 @@ } // render id - ren.color(mapnik::gray32(feature.id())); + ren.color(color_type(feature.id())); agg::render_scanlines(*ras_ptr, sl, ren); // add feature properties to grid cache diff -Nru mapnik-2.1.0/src/grid/process_markers_symbolizer.cpp mapnik-2.2.0/src/grid/process_markers_symbolizer.cpp --- mapnik-2.1.0/src/grid/process_markers_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/grid/process_markers_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -28,7 +28,6 @@ - current_buffer_ -> pixmap_ - agg::rendering_buffer -> grid_renderering_buffer - no gamma - - mapnik::pixfmt_gray32 - agg::scanline_bin sl - grid_rendering_buffer - agg::renderer_scanline_bin_solid @@ -43,25 +42,25 @@ */ // mapnik +#include #include #include -#include -#include +#include #include #include #include #include -#include #include #include #include #include -#include +#include #include #include #include #include +#include // agg #include "agg_basics.h" @@ -84,9 +83,9 @@ proj_transform const& prj_trans) { typedef grid_rendering_buffer buf_type; - typedef mapnik::pixfmt_gray32 pixfmt_type; - typedef agg::renderer_base renderer_base; - typedef agg::renderer_scanline_bin_solid renderer_type; + typedef typename grid_renderer_base_type::pixfmt_type pixfmt_type; + typedef typename grid_renderer_base_type::pixfmt_type::color_type color_type; + typedef agg::renderer_scanline_bin_solid renderer_type; typedef label_collision_detector4 detector_type; typedef boost::mpl::vector conv_types; @@ -94,7 +93,7 @@ if (!filename.empty()) { - boost::optional mark = mapnik::marker_cache::instance()->find(filename, true); + boost::optional mark = mapnik::marker_cache::instance().find(filename, true); if (mark && *mark) { ras_ptr->reset(); @@ -106,7 +105,7 @@ { using namespace mapnik::svg; typedef agg::pod_bvector svg_attribute_type; - typedef svg_renderer svg_renderer_type; @@ -163,15 +162,12 @@ } converter.template set(); //always transform if (sym.smooth() > 0.0) converter.template set(); // optional smooth converter - BOOST_FOREACH(geometry_type & geom, feature.paths()) - { - converter.apply(geom); - } + apply_markers_multi(feature, converter, sym); } else { box2d const& bbox = (*mark)->bounding_box(); - setup_transform_scaling(tr, bbox, feature, sym); + setup_transform_scaling(tr, bbox.width(), bbox.height(), feature, sym); evaluate_transform(tr, feature, sym.get_image_transform()); // TODO - clamping to >= 4 pixels coord2d center = bbox.center(); @@ -208,17 +204,14 @@ } converter.template set(); //always transform if (sym.smooth() > 0.0) converter.template set(); // optional smooth converter - BOOST_FOREACH(geometry_type & geom, feature.paths()) - { - converter.apply(geom); - } + apply_markers_multi(feature, converter, sym); } } else // raster markers { - box2d const& bbox = (*mark)->bounding_box(); - setup_transform_scaling(tr, bbox, feature, sym); + setup_transform_scaling(tr, (*mark)->width(), (*mark)->height(), feature, sym); evaluate_transform(tr, feature, sym.get_image_transform()); + box2d const& bbox = (*mark)->bounding_box(); // - clamp sizes to > 4 pixels of interactivity coord2d center = bbox.center(); agg::trans_affine_translation recenter(-center.x, -center.y); @@ -227,7 +220,7 @@ typedef raster_markers_rasterizer_dispatch_grid dispatch_type; @@ -256,10 +249,7 @@ } converter.template set(); //always transform if (sym.smooth() > 0.0) converter.template set(); // optional smooth converter - BOOST_FOREACH(geometry_type & geom, feature.paths()) - { - converter.apply(geom); - } + apply_markers_multi(feature, converter, sym); } } } diff -Nru mapnik-2.1.0/src/grid/process_point_symbolizer.cpp mapnik-2.2.0/src/grid/process_point_symbolizer.cpp --- mapnik-2.1.0/src/grid/process_point_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/grid/process_point_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,17 +21,19 @@ *****************************************************************************/ // mapnik +#include #include #include -#include -#include +#include #include #include +#include #include -#include #include #include +#include +#include // agg #include "agg_trans_affine.h" @@ -54,7 +56,7 @@ boost::optional marker; if ( !filename.empty() ) { - marker = marker_cache::instance()->find(filename, true); + marker = marker_cache::instance().find(filename, true); } else { @@ -72,7 +74,7 @@ agg::trans_affine_translation recenter(-center.x, -center.y); agg::trans_affine recenter_tr = recenter * tr; - box2d label_ext = bbox * recenter_tr; + box2d label_ext = bbox * recenter_tr * agg::trans_affine_scaling(scale_factor_) ; for (unsigned i=0; i // mapnik +#include #include #include -#include -#include +#include #include #include #include @@ -71,18 +71,18 @@ converter.apply(geom); } } - - typedef agg::renderer_base ren_base; - typedef agg::renderer_scanline_bin_solid renderer; + typedef typename grid_renderer_base_type::pixfmt_type pixfmt_type; + typedef typename grid_renderer_base_type::pixfmt_type::color_type color_type; + typedef agg::renderer_scanline_bin_solid renderer_type; grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_); - mapnik::pixfmt_gray32 pixf(buf); + pixfmt_type pixf(buf); - ren_base renb(pixf); - renderer ren(renb); + grid_renderer_base_type renb(pixf); + renderer_type ren(renb); // render id - ren.color(mapnik::gray32(feature.id())); + ren.color(color_type(feature.id())); agg::scanline_bin sl; agg::render_scanlines(*ras_ptr, sl, ren); diff -Nru mapnik-2.1.0/src/grid/process_polygon_symbolizer.cpp mapnik-2.2.0/src/grid/process_polygon_symbolizer.cpp --- mapnik-2.1.0/src/grid/process_polygon_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/grid/process_polygon_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,10 +24,10 @@ #include // mapnik +#include #include #include -#include -#include +#include #include #include #include @@ -48,12 +48,16 @@ mapnik::feature_impl & feature, proj_transform const& prj_trans) { + typedef agg::renderer_scanline_bin_solid renderer_type; + typedef typename grid_renderer_base_type::pixfmt_type pixfmt_type; + typedef typename grid_renderer_base_type::pixfmt_type::color_type color_type; + ras_ptr->reset(); agg::trans_affine tr; evaluate_transform(tr, feature, sym.get_transform()); - typedef boost::mpl::vector conv_types; + typedef boost::mpl::vector conv_types; vertex_converter, grid_rasterizer, polygon_symbolizer, CoordTransform, proj_transform, agg::trans_affine, conv_types> converter(query_extent_,*ras_ptr,sym,t_,prj_trans,tr,scale_factor_); @@ -61,6 +65,7 @@ if (prj_trans.equal() && sym.clip()) converter.set(); //optional clip (default: true) converter.set(); //always transform converter.set(); + if (sym.simplify_tolerance() > 0.0) converter.set(); // optional simplify converter if (sym.smooth() > 0.0) converter.set(); // optional smooth converter @@ -72,17 +77,14 @@ } } - typedef agg::renderer_base ren_base; - typedef agg::renderer_scanline_bin_solid renderer; - grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_); - mapnik::pixfmt_gray32 pixf(buf); + pixfmt_type pixf(buf); - ren_base renb(pixf); - renderer ren(renb); + grid_renderer_base_type renb(pixf); + renderer_type ren(renb); // render id - ren.color(mapnik::gray32(feature.id())); + ren.color(color_type(feature.id())); agg::scanline_bin sl; agg::render_scanlines(*ras_ptr, sl, ren); diff -Nru mapnik-2.1.0/src/grid/process_raster_symbolizer.cpp mapnik-2.2.0/src/grid/process_raster_symbolizer.cpp --- mapnik-2.1.0/src/grid/process_raster_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/grid/process_raster_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,6 +21,7 @@ *****************************************************************************/ // mapnik +#include #include #include diff -Nru mapnik-2.1.0/src/grid/process_shield_symbolizer.cpp mapnik-2.2.0/src/grid/process_shield_symbolizer.cpp --- mapnik-2.1.0/src/grid/process_shield_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/grid/process_shield_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -1,3 +1,4 @@ + /***************************************************************************** * * This file is part of Mapnik (c++ mapping toolkit) @@ -21,15 +22,14 @@ *****************************************************************************/ // mapnik +#include #include #include -#include -#include +#include #include #include -#include -#include -#include +#include +#include // agg #include "agg_trans_affine.h" @@ -52,7 +52,7 @@ text_renderer ren(pixmap_, font_manager_, - *(font_manager_.get_stroker()), + sym.get_halo_rasterizer(), sym.comp_op(), scale_factor_); @@ -80,7 +80,7 @@ sym.comp_op()); ren.prepare_glyphs(placements[ii]); - ren.render_id(feature.id(), placements[ii].center, 2); + ren.render_id(feature.id(), placements[ii].center); } } if (placement_found) diff -Nru mapnik-2.1.0/src/grid/process_text_symbolizer.cpp mapnik-2.2.0/src/grid/process_text_symbolizer.cpp --- mapnik-2.1.0/src/grid/process_text_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/grid/process_text_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,8 +21,10 @@ *****************************************************************************/ // mapnik +#include #include #include +#include namespace mapnik { @@ -42,7 +44,7 @@ text_renderer ren(pixmap_, font_manager_, - *(font_manager_.get_stroker()), + sym.get_halo_rasterizer(), sym.comp_op(), scale_factor_); @@ -52,7 +54,7 @@ for (unsigned int ii = 0; ii < placements.size(); ++ii) { ren.prepare_glyphs(placements[ii]); - ren.render_id(feature.id(), placements[ii].center, 2); + ren.render_id(feature.id(), placements[ii].center); } } if (placement_found) pixmap_.add_feature(feature); diff -Nru mapnik-2.1.0/src/image_compositing.cpp mapnik-2.2.0/src/image_compositing.cpp --- mapnik-2.1.0/src/image_compositing.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/image_compositing.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -99,6 +99,21 @@ return mode; } +/* +Note: the difference between agg::pixfmt_rgba32 and agg:pixfmt_rgba32_pre is subtle. + +From http://www.antigrain.com/news/release_notes/v22.agdoc.html: + +Format agg::pixfmt_rgba32 is the main and the fastest pixel format and it's supposed to be used in most cases. But it always uses plain colors as input and produces pre-multiplied result on the canvas. It has even less number of calculations than agg::pixfmt_rgba32_pre. Format agg::pixfmt_rgba32_plain is slow because of division operations. APIs allowing for alpha-blending require premultiplied colors. Besides, if you display RGBA with RGB API (that is, without alpha, like WinAPI BitBlt), the colors still must be premultiplied. Note that the formulas in agg::pixfmt_rgba32 and agg::pixfmt_rgb24 are exactly the same! So, premultiplied colors are more natural and agg::pixfmt_rgba32_plain is rather useless. + +Format agg::pixfmt_rgba32_pre is a bit slower than agg::pixfmt_rgba32 because of additional "cover" values, i.e. secondary alphas, that are to be mixed with the source premultiplied color. That spoils the beauty of the premultiplied colors idea. But the "cover" values are important because there can be other color spaces and color types that don't have any "alpha" at all, or the alpha is incompatible with integral types. So, the "cover" is a secondary, uniform alpha in range of 0…255, used specifically for anti-aliasing purposes. +One needs to consider this issue when transforming images. Actually, all RGBA images are supposed to be in the premultiplied color space and the result of filtering is also premultiplied. Since the resulting colors of the filtered images are the source for the renderers, one should use the premultiplied renderers, that is, agg::pixfmt_rgba32_pre, or the new one, agg::pixfmt_rgb24_pre. But it's important only if images are translucent, that is, have actual alpha channel. + +For example, if you generate some pattern with AGG (premultiplied) and would like to use it for filling, you'll need to use agg::pixfmt_rgba32_pre. If you use agg::span_image_filter_rgb24_gamma_bilinear (that is, RGB for input) and draw it on the RGBA canvas, you still need to use agg::pixfmt_rgba32_pre as the destination canvas. The only thing you need is to premultiply the background color used out of bounds. + +*/ + + template void composite(T1 & dst, T2 & src, composite_mode_e mode, float opacity, @@ -124,6 +139,12 @@ ren.blend_from(pixf_mask,0,dx,dy,unsigned(255*opacity)); } -template void composite(mapnik::image_data_32&, mapnik::image_data_32& ,composite_mode_e, float, int, int, bool); +template void composite(mapnik::image_data_32&, + mapnik::image_data_32&, + composite_mode_e, + float, + int, + int, + bool); } diff -Nru mapnik-2.1.0/src/image_filter_grammar.cpp mapnik-2.2.0/src/image_filter_grammar.cpp --- mapnik-2.1.0/src/image_filter_grammar.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/image_filter_grammar.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,7 +22,6 @@ // mapnik #include -#include // boost #include @@ -44,11 +43,21 @@ using qi::_1; using qi::_a; using qi::_b; + using qi::_c; + using qi::_d; + using qi::_e; + using qi::_f; + using qi::_g; + using qi::_h; + using qi::_r1; using qi::eps; using qi::char_; + using qi::lexeme; + using qi::double_; + using boost::spirit::ascii::string; using phoenix::push_back; using phoenix::construct; - + using phoenix::at_c; #if BOOST_VERSION >= 104700 using qi::no_skip; start = -(filter % no_skip[*char_(", ")]) @@ -59,31 +68,63 @@ #endif filter = - lit("emboss")[push_back(_val,construct())] + lit("emboss") >> no_args [push_back(_val,construct())] + | + lit("blur") >> no_args [push_back(_val,construct())] + | + lit("gray") >> no_args [push_back(_val,construct())] | - lit("blur")[push_back(_val,construct())] + lit("edge-detect") >> no_args [push_back(_val,construct())] | - lit("gray")[push_back(_val,construct())] + lit("sobel") >> no_args [push_back(_val,construct())] | - lit("edge-detect")[push_back(_val,construct())] + lit("sharpen") >> no_args [push_back(_val,construct())] | - lit("sobel")[push_back(_val,construct())] + lit("x-gradient") >> no_args [push_back(_val,construct())] | - lit("sharpen")[push_back(_val,construct())] + lit("y-gradient") >> no_args [push_back(_val,construct())] | - lit("x-gradient")[push_back(_val,construct())] + lit("invert") >> no_args [push_back(_val,construct())] | - lit("y-gradient")[push_back(_val,construct())] + agg_blur_filter(_val) | - (lit("agg-stack-blur")[_a = 1, _b = 1] - >> -( lit('(') >> radius_[_a = _1] - >> lit(',') - >> radius_[_b = _1] - >> lit(')')) - [push_back(_val,construct(_a,_b))]) + //hsla_filter(_val) + //| + colorize_alpha_filter(_val) + ; + + agg_blur_filter = lit("agg-stack-blur")[_a = 1, _b = 1] + >> -( lit('(') >> -( radius_[_a = _1][_b = _1] + >> -(lit(',') >> radius_[_b = _1])) + >> lit(')')) + [push_back(_r1,construct(_a,_b))] + ; + + /* + hsla_filter = lit("hsla") + >> lit('(') + >> double_[_a = _1] >> lit('x') >> double_[_b = _1] >> lit(';') + >> double_[_c = _1] >> lit('x') >> double_[_d = _1] >> lit(';') + >> double_[_e = _1] >> lit('x') >> double_[_f = _1] >> lit(';') + >> double_[_g = _1] >> lit('x') >> double_[_h = _1] >> lit(')') + [push_back(_r1, construct(_a,_b,_c,_d,_e,_f,_g,_h))] + ; + */ + + colorize_alpha_filter = lit("colorize-alpha")[_a = construct()] + >> lit('(') + >> (css_color_[at_c<0>(_b) = _1, at_c<1>(_b) = 0] + >> -color_stop_offset(_b)) [push_back(_a,_b)] + >> +(lit(',') >> css_color_[at_c<0>(_b) =_1,at_c<1>(_b) = 0] + >> -color_stop_offset(_b))[push_back(_a,_b)] + >> lit(')') [push_back(_r1,_a)] + ; + + color_stop_offset = (double_ >> lit('%'))[at_c<1>(_r1) = percent_offset(_1)] | - lit("invert")[push_back(_val,construct())] + double_[at_c<1>(_r1) = _1] ; + no_args = -(lit('(') >> lit(')')); } template struct mapnik::image_filter_grammar >; diff -Nru mapnik-2.1.0/src/image_filter_types.cpp mapnik-2.2.0/src/image_filter_types.cpp --- mapnik-2.1.0/src/image_filter_types.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/image_filter_types.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,80 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2012 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ +// mapnik +#include +#include // image_filter_grammar + +// boost +#include +#include + +// stl +#include + +namespace mapnik { + +namespace filter { + +template +struct to_string_visitor : boost::static_visitor +{ + to_string_visitor(Out & out) + : out_(out) {} + + template + void operator () (T const& filter_tag) + { + out_ << filter_tag; + } + + Out & out_; +}; + +inline std::ostream& operator<< (std::ostream& os, filter_type const& filter) +{ + to_string_visitor visitor(os); + boost::apply_visitor(visitor, filter); + return os; +} + +bool generate_image_filters(std::back_insert_iterator& sink, std::vector const& filters) +{ + using boost::spirit::karma::stream; + using boost::spirit::karma::generate; + bool r = generate(sink, stream % ' ', filters); + return r; +} + +bool parse_image_filters(std::string const& filters, std::vector& image_filters) +{ + std::string::const_iterator itr = filters.begin(); + std::string::const_iterator end = filters.end(); + mapnik::image_filter_grammar > filter_grammar; + bool r = boost::spirit::qi::phrase_parse(itr,end, + filter_grammar, + boost::spirit::qi::ascii::space, + image_filters); + return r && itr==end; +} + +}} diff -Nru mapnik-2.1.0/src/image_reader.cpp mapnik-2.2.0/src/image_reader.cpp --- mapnik-2.1.0/src/image_reader.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/image_reader.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -27,26 +27,70 @@ namespace mapnik { + +typedef factory ImageReaderFactory; + typedef factory ImageReaderFactory; + image_reader* (*)(char const*, std::size_t)> MemImageReaderFactory; -bool register_image_reader(const std::string& type,image_reader* (* fun)(const std::string&)) +inline boost::optional type_from_bytes(char const* data, size_t size) { - return ImageReaderFactory::instance()->register_product(type,fun); + typedef boost::optional result_type; + if (size >= 4) + { + unsigned int magic = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; + if (magic == 0x89504E47U) + { + return result_type("png"); + } + else if (magic == 0x49492A00 || magic == 0x4D4D002A) + { + return result_type("tiff"); + } + } + if (size>=2) + { + unsigned int magic = ((data[0] << 8) | data[1]) & 0xffff; + if (magic == 0xffd8) + { + return result_type("jpeg"); + } + } + + return result_type(); +} + +bool register_image_reader(std::string const& type,image_reader* (* fun)(std::string const&)) +{ + return ImageReaderFactory::instance().register_product(type,fun); +} + +bool register_image_reader(std::string const& type,image_reader* (* fun)(char const*, std::size_t)) +{ + return MemImageReaderFactory::instance().register_product(type,fun); +} + +image_reader* get_image_reader(char const* data, size_t size) +{ + boost::optional type = type_from_bytes(data,size); + if (type) + return MemImageReaderFactory::instance().create_object(*type, data,size); + return 0; } -image_reader* get_image_reader(const std::string& filename,const std::string& type) +image_reader* get_image_reader(std::string const& filename,std::string const& type) { - return ImageReaderFactory::instance()->create_object(type,filename); + return ImageReaderFactory::instance().create_object(type,filename); } -image_reader* get_image_reader(const std::string& filename) +image_reader* get_image_reader(std::string const& filename) { boost::optional type = type_from_filename(filename); if (type) { - return ImageReaderFactory::instance()->create_object(*type,filename); + return ImageReaderFactory::instance().create_object(*type,filename); } return 0; } diff -Nru mapnik-2.1.0/src/image_scaling.cpp mapnik-2.2.0/src/image_scaling.cpp --- mapnik-2.1.0/src/image_scaling.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/image_scaling.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,7 +23,8 @@ // mapnik #include #include -#include +// does not handle alpha correctly +//#include // boost #include @@ -257,15 +258,18 @@ void scale_image_agg(Image & target, Image const& source, scaling_method_e scaling_method, - double image_ratio, + double image_ratio_x, + double image_ratio_y, double x_off_f, double y_off_f, - double filter_radius, - double ratio) + double filter_radius) { - typedef agg::pixfmt_rgba32 pixfmt; + // "the image filters should work namely in the premultiplied color space" + // http://old.nabble.com/Re:--AGG--Basic-image-transformations-p1110665.html + // "Yes, you need to use premultiplied images only. Only in this case the simple weighted averaging works correctly in the image fitering." + // http://permalink.gmane.org/gmane.comp.graphics.agg/3443 typedef agg::pixfmt_rgba32_pre pixfmt_pre; - typedef agg::renderer_base renderer_base; + typedef agg::renderer_base renderer_base_pre; // define some stuff we'll use soon agg::rasterizer_scanline_aa<> ras; @@ -275,27 +279,27 @@ // initialize source AGG buffer agg::rendering_buffer rbuf_src((unsigned char*)source.getBytes(), source.width(), source.height(), source.width() * 4); - pixfmt pixf_src(rbuf_src); - typedef agg::image_accessor_clone img_src_type; + pixfmt_pre pixf_src(rbuf_src); + typedef agg::image_accessor_clone img_src_type; img_src_type img_src(pixf_src); - // initialise destination AGG buffer (with transparency) + // initialize destination AGG buffer (with transparency) agg::rendering_buffer rbuf_dst((unsigned char*)target.getBytes(), target.width(), target.height(), target.width() * 4); pixfmt_pre pixf_dst(rbuf_dst); - renderer_base rb_dst(pixf_dst); - rb_dst.clear(agg::rgba(0, 0, 0, 0)); + renderer_base_pre rb_dst_pre(pixf_dst); + rb_dst_pre.clear(agg::rgba(0, 0, 0, 0)); // create a scaling matrix agg::trans_affine img_mtx; - img_mtx /= agg::trans_affine_scaling(image_ratio * ratio, image_ratio * ratio); + img_mtx /= agg::trans_affine_scaling(image_ratio_x, image_ratio_y); // create a linear interpolator for our scaling matrix typedef agg::span_interpolator_linear<> interpolator_type; interpolator_type interpolator(img_mtx); // draw an anticlockwise polygon to render our image into - double scaled_width = source.width() * image_ratio; - double scaled_height = source.height() * image_ratio; + double scaled_width = target.width(); + double scaled_height = target.height(); ras.reset(); ras.move_to_d(x_off_f, y_off_f); ras.line_to_d(x_off_f + scaled_width, y_off_f); @@ -308,7 +312,7 @@ { typedef agg::span_image_filter_rgba_nn span_gen_type; span_gen_type sg(img_src, interpolator); - agg::render_scanlines_aa(ras, sl, rb_dst, sa, sg); + agg::render_scanlines_aa(ras, sl, rb_dst_pre, sa, sg); return; } case SCALING_BILINEAR: @@ -345,12 +349,32 @@ case SCALING_BLACKMAN: filter.calculate(agg::image_filter_blackman(filter_radius), true); break; } - typedef mapnik::span_image_resample_rgba_affine span_gen_type; + // details on various resampling considerations + // http://old.nabble.com/Re%3A-Newbie---texture-p5057255.html + + // high quality resampler + typedef agg::span_image_resample_rgba_affine span_gen_type; + + // faster, lower quality + //typedef agg::span_image_filter_rgba span_gen_type; + + // local, modified agg::span_image_resample_rgba_affine + // dating back to when we were not handling alpha correctly + // and this file helped work around symptoms + // https://github.com/mapnik/mapnik/issues/1489 + //typedef mapnik::span_image_resample_rgba_affine span_gen_type; span_gen_type sg(img_src, interpolator, filter); - agg::render_scanlines_aa(ras, sl, rb_dst, sa, sg); + agg::render_scanlines_aa(ras, sl, rb_dst_pre, sa, sg); } -template void scale_image_agg (image_data_32& target,const image_data_32& source, scaling_method_e scaling_method, double scale_factor, double x_off_f, double y_off_f, double filter_radius, double ratio); +template void scale_image_agg(image_data_32& target, + const image_data_32& source, + scaling_method_e scaling_method, + double image_ratio_x, + double image_ratio_y, + double x_off_f, + double y_off_f, + double filter_radius); template void scale_image_bilinear_old (image_data_32& target,const image_data_32& source, double x_off_f, double y_off_f); diff -Nru mapnik-2.1.0/src/image_util.cpp mapnik-2.2.0/src/image_util.cpp --- mapnik-2.1.0/src/image_util.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/image_util.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -20,29 +20,47 @@ * *****************************************************************************/ +#if defined(HAVE_PNG) extern "C" { #include } +#endif // mapnik -#include +#if defined(HAVE_PNG) #include +#endif + +#if defined(HAVE_TIFF) #include +#endif + +#if defined(HAVE_JPEG) +#include +#endif + +#include +#include #include #include #include #include #include #include -// jpeg -#if defined(HAVE_JPEG) -#include -#endif #ifdef HAVE_CAIRO #include -#include +#include +#ifdef CAIRO_HAS_PDF_SURFACE +#include +#endif // CAIRO_HAS_PDF_SURFACE +#ifdef CAIRO_HAS_PS_SURFACE +#include +#endif // CAIRO_HAS_PS_SURFACE +#ifdef CAIRO_HAS_SVG_SURFACE +#include +#endif // CAIRO_HAS_SVG_SURFACE #endif // boost @@ -54,6 +72,7 @@ #include #include #include +#include namespace mapnik { @@ -105,13 +124,15 @@ else throw ImageWriterException("Could not write file to " + filename ); } +#if defined(HAVE_PNG) void handle_png_options(std::string const& type, int * colors, int * compression, int * strategy, int * trans_mode, double * gamma, - bool * use_octree) + bool * use_octree, + bool * use_miniz) { if (type == "png" || type == "png24" || type == "png32") { @@ -138,19 +159,20 @@ { *use_octree = true; } + else if (t == "e=miniz") + { + *use_miniz = true; + } else if (boost::algorithm::starts_with(t, "c=")) { if (*colors < 0) throw ImageWriterException("invalid color parameter: unavailable for true color images"); - if (!mapnik::util::string2int(t.substr(2),*colors) || *colors < 0 || *colors > 256) + if (!mapnik::util::string2int(t.substr(2),*colors) || *colors < 1 || *colors > 256) throw ImageWriterException("invalid color parameter: " + t.substr(2)); } else if (boost::algorithm::starts_with(t, "t=")) { - if (*colors < 0) - throw ImageWriterException("invalid trans_mode parameter: unavailable for true color images"); - if (!mapnik::util::string2int(t.substr(2),*trans_mode) || *trans_mode < 0 || *trans_mode > 2) throw ImageWriterException("invalid trans_mode parameter: " + t.substr(2)); } @@ -173,9 +195,9 @@ */ if (!mapnik::util::string2int(t.substr(2),*compression) || *compression < Z_DEFAULT_COMPRESSION - || *compression > Z_BEST_COMPRESSION) + || *compression > 10) // use 10 here rather than Z_BEST_COMPRESSION (9) to allow for MZ_UBER_COMPRESSION { - throw ImageWriterException("invalid compression parameter: " + t.substr(2) + " (only -1 through 9 are valid)"); + throw ImageWriterException("invalid compression parameter: " + t.substr(2) + " (only -1 through 10 are valid)"); } } else if (boost::algorithm::starts_with(t, "s=")) @@ -197,14 +219,23 @@ { *strategy = Z_RLE; } + else if (s == "fixed") + { + *strategy = Z_FIXED; + } else { throw ImageWriterException("invalid compression strategy parameter: " + s); } } } + if ((*use_miniz == false) && *compression > Z_BEST_COMPRESSION) + { + throw ImageWriterException("invalid compression value: (only -1 through 9 are valid)"); + } } } +#endif template void save_to_stream(T const& image, @@ -214,16 +245,18 @@ { if (stream && image.width() > 0 && image.height() > 0) { - //all this should go into image_writer factory - std::string t = boost::algorithm::to_lower_copy(type); + std::string t = type; + std::transform(t.begin(), t.end(), t.begin(), ::tolower); if (t == "png" || boost::algorithm::starts_with(t, "png")) { +#if defined(HAVE_PNG) int colors = 256; int compression = Z_DEFAULT_COMPRESSION; int strategy = Z_DEFAULT_STRATEGY; int trans_mode = -1; double gamma = -1; bool use_octree = true; + bool use_miniz = false; handle_png_options(t, &colors, @@ -231,27 +264,37 @@ &strategy, &trans_mode, &gamma, - &use_octree); + &use_octree, + &use_miniz); if (palette.valid()) - save_as_png8_pal(stream, image, palette, compression, strategy); + { + save_as_png8_pal(stream, image, palette, compression, strategy, use_miniz); + } else if (colors < 0) - save_as_png(stream, image, compression, strategy); + { + save_as_png(stream, image, compression, strategy, trans_mode, use_miniz); + } else if (use_octree) - save_as_png8_oct(stream, image, colors, compression, strategy); + { + save_as_png8_oct(stream, image, colors, compression, strategy, trans_mode, use_miniz); + } else - save_as_png8_hex(stream, image, colors, compression, strategy, trans_mode, gamma); + { + save_as_png8_hex(stream, image, colors, compression, strategy, trans_mode, gamma, use_miniz); + } +#else + throw ImageWriterException("png output is not enabled in your build of Mapnik"); +#endif } else if (boost::algorithm::starts_with(t, "tif")) { throw ImageWriterException("palettes are not currently supported when writing to tiff format (yet)"); } -#if defined(HAVE_JPEG) else if (boost::algorithm::starts_with(t, "jpeg")) { throw ImageWriterException("palettes are not currently supported when writing to jpeg format"); } -#endif else throw ImageWriterException("unknown file type: " + type); } else throw ImageWriterException("Could not write to empty stream" ); @@ -265,16 +308,18 @@ { if (stream && image.width() > 0 && image.height() > 0) { - //all this should go into image_writer factory - std::string t = boost::algorithm::to_lower_copy(type); + std::string t = type; + std::transform(t.begin(), t.end(), t.begin(), ::tolower); if (t == "png" || boost::algorithm::starts_with(t, "png")) { +#if defined(HAVE_PNG) int colors = 256; - int compression = Z_DEFAULT_COMPRESSION; + int compression = Z_DEFAULT_COMPRESSION; // usually mapped to z=6 in zlib int strategy = Z_DEFAULT_STRATEGY; int trans_mode = -1; double gamma = -1; bool use_octree = true; + bool use_miniz = false; handle_png_options(t, &colors, @@ -282,22 +327,36 @@ &strategy, &trans_mode, &gamma, - &use_octree); + &use_octree, + &use_miniz); if (colors < 0) - save_as_png(stream, image, compression, strategy); + { + save_as_png(stream, image, compression, strategy, trans_mode, use_miniz); + } else if (use_octree) - save_as_png8_oct(stream, image, colors, compression, strategy); + { + save_as_png8_oct(stream, image, colors, compression, strategy, trans_mode, use_miniz); + } else - save_as_png8_hex(stream, image, colors, compression, strategy, trans_mode, gamma); + { + save_as_png8_hex(stream, image, colors, compression, strategy, trans_mode, gamma, use_miniz); + } +#else + throw ImageWriterException("png output is not enabled in your build of Mapnik"); +#endif } else if (boost::algorithm::starts_with(t, "tif")) { +#if defined(HAVE_TIFF) save_as_tiff(stream, image); +#else + throw ImageWriterException("tiff output is not enabled in your build of Mapnik"); +#endif } -#if defined(HAVE_JPEG) else if (boost::algorithm::starts_with(t, "jpeg")) { +#if defined(HAVE_JPEG) int quality = 85; std::string const& val = t.substr(4); if (!val.empty()) @@ -308,8 +367,10 @@ } } save_as_jpeg(stream, quality, image); - } +#else + throw ImageWriterException("jpeg output is not enabled in your build of Mapnik"); #endif + } else throw ImageWriterException("unknown file type: " + type); } else throw ImageWriterException("Could not write to empty stream" ); @@ -323,6 +384,7 @@ { save_to_file(image, filename, *type); } + else throw ImageWriterException("Could not write file to " + filename ); } template @@ -333,6 +395,7 @@ { save_to_file(image, filename, *type, palette); } + else throw ImageWriterException("Could not write file to " + filename ); } #if defined(HAVE_CAIRO) @@ -344,6 +407,7 @@ { save_to_cairo_file(map,filename,*type,scale_factor); } + else throw ImageWriterException("Could not write file to " + filename ); } void save_to_cairo_file(mapnik::Map const& map, @@ -354,37 +418,37 @@ std::ofstream file (filename.c_str(), std::ios::out|std::ios::trunc|std::ios::binary); if (file) { - Cairo::RefPtr surface; + cairo_surface_ptr surface; unsigned width = map.width(); unsigned height = map.height(); if (type == "pdf") { -#if defined(CAIRO_HAS_PDF_SURFACE) - surface = Cairo::PdfSurface::create(filename,width,height); +#ifdef CAIRO_HAS_PDF_SURFACE + surface = cairo_surface_ptr(cairo_pdf_surface_create(filename.c_str(),width,height),cairo_surface_closer()); #else throw ImageWriterException("PDFSurface not supported in the cairo backend"); #endif } -#if defined(CAIRO_HAS_SVG_SURFACE) +#ifdef CAIRO_HAS_SVG_SURFACE else if (type == "svg") { - surface = Cairo::SvgSurface::create(filename,width,height); + surface = cairo_surface_ptr(cairo_svg_surface_create(filename.c_str(),width,height),cairo_surface_closer()); } #endif -#if defined(CAIRO_HAS_PS_SURFACE) +#ifdef CAIRO_HAS_PS_SURFACE else if (type == "ps") { - surface = Cairo::PsSurface::create(filename,width,height); + surface = cairo_surface_ptr(cairo_ps_surface_create(filename.c_str(),width,height),cairo_surface_closer()); } #endif -#if defined(CAIRO_HAS_IMAGE_SURFACE) +#ifdef CAIRO_HAS_IMAGE_SURFACE else if (type == "ARGB32") { - surface = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32,width,height); + surface = cairo_surface_ptr(cairo_image_surface_create(CAIRO_FORMAT_ARGB32,width,height),cairo_surface_closer()); } else if (type == "RGB24") { - surface = Cairo::ImageSurface::create(Cairo::FORMAT_RGB24,width,height); + surface = cairo_surface_ptr(cairo_image_surface_create(CAIRO_FORMAT_RGB24,width,height),cairo_surface_closer()); } #endif else @@ -392,7 +456,7 @@ throw ImageWriterException("unknown file type: " + type); } - Cairo::RefPtr context = Cairo::Context::create(surface); + //cairo_t * ctx = cairo_create(surface); // TODO - expose as user option /* @@ -402,15 +466,14 @@ } */ - - mapnik::cairo_renderer ren(map, context, scale_factor); + mapnik::cairo_renderer ren(map, create_context(surface), scale_factor); ren.apply(); if (type == "ARGB32" || type == "RGB24") { - surface->write_to_png(filename); + cairo_surface_write_to_png(&*surface, filename.c_str()); } - surface->finish(); + cairo_surface_finish(&*surface); } } diff -Nru mapnik-2.1.0/src/jpeg_reader.cpp mapnik-2.2.0/src/jpeg_reader.cpp --- mapnik-2.1.0/src/jpeg_reader.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/jpeg_reader.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -31,142 +31,282 @@ } // boost +#include #include -#include +#include +#include +#include // std #include namespace mapnik { -class JpegReader : public image_reader, boost::noncopyable + +template +class jpeg_reader : public image_reader { +public: + typedef T source_type; + typedef boost::iostreams::stream input_stream; + const static unsigned BUF_SIZE = 4096; +private: + struct jpeg_stream_wrapper + { + jpeg_source_mgr manager; + input_stream * stream; + JOCTET buffer[BUF_SIZE]; + }; + + struct jpeg_info_guard + { + jpeg_info_guard(jpeg_decompress_struct * cinfo) + : i_(cinfo) {} + + ~jpeg_info_guard() + { + jpeg_destroy_decompress(i_); + } + jpeg_decompress_struct * i_; + }; + private: - std::string fileName_; + source_type source_; + input_stream stream_; unsigned width_; unsigned height_; public: - explicit JpegReader(const std::string& fileName); - ~JpegReader(); + explicit jpeg_reader(std::string const& file_name); + explicit jpeg_reader(char const* data, size_t size); + ~jpeg_reader(); unsigned width() const; unsigned height() const; + inline bool premultiplied_alpha() const { return true; } void read(unsigned x,unsigned y,image_data_32& image); private: void init(); + static void on_error(j_common_ptr cinfo); + static void on_error_message(j_common_ptr cinfo); + static void init_source(j_decompress_ptr cinfo); + static boolean fill_input_buffer(j_decompress_ptr cinfo); + static void skip(j_decompress_ptr cinfo, long count); + static void term(j_decompress_ptr cinfo); + static void attach_stream(j_decompress_ptr cinfo, input_stream* in); }; namespace { -image_reader* createJpegReader(const std::string& file) +image_reader* create_jpeg_reader(std::string const& file) +{ + return new jpeg_reader(file); +} + +image_reader* create_jpeg_reader2(char const* data, size_t size) { - return new JpegReader(file); + return new jpeg_reader(data, size); } -const bool registered = register_image_reader("jpeg",createJpegReader); + +const bool registered = register_image_reader("jpeg",create_jpeg_reader); +const bool registered2 = register_image_reader("jpeg",create_jpeg_reader2); } -JpegReader::JpegReader(const std::string& fileName) - : fileName_(fileName), +// ctors +template +jpeg_reader::jpeg_reader(std::string const& file_name) + : source_(file_name,std::ios_base::in | std::ios_base::binary), + stream_(source_), width_(0), height_(0) { + if (!stream_) throw image_reader_exception("cannot open image file "+ file_name); init(); } -JpegReader::~JpegReader() {} +template +jpeg_reader::jpeg_reader(char const* data, size_t size) + : source_(data, size), + stream_(source_), + width_(0), + height_(0) +{ + if (!stream_) throw image_reader_exception("cannot open image stream"); + init(); +} -void JpegReader::init() +// dtor +template +jpeg_reader::~jpeg_reader() {} + +// jpeg stream wrapper +template +void jpeg_reader::init_source (j_decompress_ptr cinfo) { - FILE *fp = fopen(fileName_.c_str(),"rb"); - if (!fp) throw image_reader_exception("JPEG Reader: cannot open image file " + fileName_); + jpeg_stream_wrapper* wrap = reinterpret_cast(cinfo->src); + wrap->stream->seekg(0,std::ios_base::beg); +} - struct jpeg_decompress_struct cinfo; - struct jpeg_error_mgr jerr; +template +boolean jpeg_reader::fill_input_buffer (j_decompress_ptr cinfo) +{ + jpeg_stream_wrapper* wrap = reinterpret_cast(cinfo->src); + wrap->stream->read(reinterpret_cast(&wrap->buffer[0]),BUF_SIZE); + std::streamsize size = wrap->stream->gcount(); + wrap->manager.next_input_byte = wrap->buffer; + wrap->manager.bytes_in_buffer = BUF_SIZE; + return (size > 0) ? TRUE : FALSE; +} - cinfo.err = jpeg_std_error(&jerr); +template +void jpeg_reader::skip(j_decompress_ptr cinfo, long count) +{ + if (count <= 0) return; //A zero or negative skip count should be treated as a no-op. + jpeg_stream_wrapper* wrap = reinterpret_cast(cinfo->src); - jpeg_create_decompress(&cinfo); - jpeg_stdio_src(&cinfo, fp); - jpeg_read_header(&cinfo, TRUE); + if (wrap->manager.bytes_in_buffer > 0u + && static_cast(count) < wrap->manager.bytes_in_buffer) + { + wrap->manager.bytes_in_buffer -= count; + wrap->manager.next_input_byte = &wrap->buffer[BUF_SIZE - wrap->manager.bytes_in_buffer]; + } + else + { + wrap->stream->seekg(count, std::ios_base::cur); + // trigger buffer fill + wrap->manager.next_input_byte = 0; + wrap->manager.bytes_in_buffer = 0; //bytes_in_buffer may be zero on return. + } +} + +template +void jpeg_reader::term (j_decompress_ptr cinfo) +{ +// no-op +} + +template +void jpeg_reader::attach_stream (j_decompress_ptr cinfo, input_stream* in) +{ + if (cinfo->src == 0) + { + cinfo->src = (struct jpeg_source_mgr *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(jpeg_stream_wrapper)); + } + typename jpeg_reader::jpeg_stream_wrapper * src = reinterpret_cast (cinfo->src); + src->manager.init_source = init_source; + src->manager.fill_input_buffer = fill_input_buffer; + src->manager.skip_input_data = skip; + src->manager.resync_to_restart = jpeg_resync_to_restart; + src->manager.term_source = term; + src->manager.bytes_in_buffer = 0; + src->manager.next_input_byte = 0; + src->stream = in; +} + +template +void jpeg_reader::on_error(j_common_ptr cinfo) +{ + throw image_reader_exception("JPEG Reader: libjpeg could not read image"); +} + +template +void jpeg_reader::on_error_message(j_common_ptr cinfo) +{ + // used to supress jpeg from printing to stderr +} +template +void jpeg_reader::init() +{ + jpeg_decompress_struct cinfo; + jpeg_info_guard iguard(&cinfo); + jpeg_error_mgr jerr; + cinfo.err = jpeg_std_error(&jerr); + jerr.error_exit = on_error; + jerr.output_message = on_error_message; + jpeg_create_decompress(&cinfo); + attach_stream(&cinfo, &stream_); + int ret = jpeg_read_header(&cinfo, TRUE); + if (ret != JPEG_HEADER_OK) + throw image_reader_exception("JPEG Reader: failed to read header"); jpeg_start_decompress(&cinfo); width_ = cinfo.output_width; height_ = cinfo.output_height; - // if enabled: "Application transferred too few scanlines" - //jpeg_finish_decompress(&cinfo); - jpeg_destroy_decompress(&cinfo); - fclose(fp); + + if (cinfo.out_color_space == JCS_UNKNOWN) + { + throw image_reader_exception("JPEG Reader: failed to read unknown color space"); + } + if (cinfo.output_width == 0 || cinfo.output_height == 0) + { + throw image_reader_exception("JPEG Reader: failed to read image size of"); + } } -unsigned JpegReader::width() const +template +unsigned jpeg_reader::width() const { return width_; } -unsigned JpegReader::height() const +template +unsigned jpeg_reader::height() const { return height_; } -void JpegReader::read(unsigned x0, unsigned y0, image_data_32& image) +template +void jpeg_reader::read(unsigned x0, unsigned y0, image_data_32& image) { - struct jpeg_decompress_struct cinfo; + stream_.clear(); + stream_.seekg(0, std::ios_base::beg); - FILE *fp = fopen(fileName_.c_str(),"rb"); - if (!fp) throw image_reader_exception("JPEG Reader: cannot open image file " + fileName_); - - struct jpeg_error_mgr jerr; + jpeg_decompress_struct cinfo; + jpeg_info_guard iguard(&cinfo); + jpeg_error_mgr jerr; cinfo.err = jpeg_std_error(&jerr); - + jerr.error_exit = on_error; + jerr.output_message = on_error_message; jpeg_create_decompress(&cinfo); - jpeg_stdio_src(&cinfo, fp); - - jpeg_read_header(&cinfo, TRUE); - if (cinfo.out_color_space == JCS_UNKNOWN) - throw image_reader_exception("JPEG Reader: failed to read unknown color space in " + fileName_); - + attach_stream(&cinfo, &stream_); + int ret = jpeg_read_header(&cinfo, TRUE); + if (ret != JPEG_HEADER_OK) throw image_reader_exception("JPEG Reader read(): failed to read header"); jpeg_start_decompress(&cinfo); - - if (cinfo.output_width == 0) { - jpeg_destroy_decompress (&cinfo); - fclose(fp); - throw image_reader_exception("JPEG Reader: failed to read image size of " + fileName_); - } - JSAMPARRAY buffer; int row_stride; unsigned char a,r,g,b; row_stride = cinfo.output_width * cinfo.output_components; buffer = (*cinfo.mem->alloc_sarray) ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1); - unsigned w = std::min(unsigned(image.width()),width_); - unsigned h = std::min(unsigned(image.height()),height_); + unsigned w = std::min(unsigned(image.width()),width_ - x0); + unsigned h = std::min(unsigned(image.height()),height_ - y0); boost::scoped_array out_row(new unsigned int[w]); - // TODO - handle x0 - for (unsigned i=0;i=y0 && i= y0 && row < y0 + h) { - for (unsigned int x=0; x 2) { - g = buffer[0][cinfo.output_components*x+1]; - b = buffer[0][cinfo.output_components*x+2]; + g = buffer[0][cinfo.output_components * col + 1]; + b = buffer[0][cinfo.output_components * col + 2]; } else { g = r; b = r; } out_row[x] = color(r, g, b, a).rgba(); } - image.setRow(i-y0, out_row.get(), w); + image.setRow(row - y0, out_row.get(), w); } + ++row; } jpeg_finish_decompress(&cinfo); - jpeg_destroy_decompress(&cinfo); - fclose(fp); } + } diff -Nru mapnik-2.1.0/src/json/feature_collection_parser.cpp mapnik-2.2.0/src/json/feature_collection_parser.cpp --- mapnik-2.1.0/src/json/feature_collection_parser.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/json/feature_collection_parser.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -20,6 +20,12 @@ * *****************************************************************************/ +// TODO https://github.com/mapnik/mapnik/issues/1658 +#include +#if BOOST_VERSION >= 105200 +#define BOOST_SPIRIT_USE_PHOENIX_V3 +#endif + // mapnik #include #include @@ -29,6 +35,9 @@ #include #include +// stl +#include + namespace mapnik { namespace json { #if BOOST_VERSION >= 104700 diff -Nru mapnik-2.1.0/src/json/feature_grammar.cpp mapnik-2.2.0/src/json/feature_grammar.cpp --- mapnik-2.1.0/src/json/feature_grammar.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/json/feature_grammar.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -38,7 +38,7 @@ put_property_(put_property(tr)) { using qi::lit; - using qi::int_; + using qi::long_long; using qi::double_; #if BOOST_VERSION > 104200 using qi::no_skip; @@ -90,7 +90,7 @@ #else number = strict_double #endif - | int_ + | int__ | lit("true") [_val = true] | lit ("false") [_val = false] | lit("null")[_val = construct()] @@ -134,23 +134,26 @@ attribute_value %= number | string_ ; + feature.name("Feature"); + properties.name("Properties"); + attributes.name("Attributes"); on_error ( feature , std::clog << phoenix::val("Error! Expecting ") - << _4 // what failed? + << _4 // what failed? << phoenix::val(" here: \"") - << construct(_3, _2) // iterators to error-pos, end + << where_message_(_3, _2, 16) // where? 16 is max chars to output << phoenix::val("\"") << std::endl ); } -template struct mapnik::json::feature_grammar; -template struct mapnik::json::feature_grammar >,mapnik::Feature>; +template struct mapnik::json::feature_grammar; +template struct mapnik::json::feature_grammar >,mapnik::feature_impl>; }} diff -Nru mapnik-2.1.0/src/json/geojson_generator.cpp mapnik-2.2.0/src/json/geojson_generator.cpp --- mapnik-2.1.0/src/json/geojson_generator.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/json/geojson_generator.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,6 +22,7 @@ // boost #include +#include #include #if BOOST_VERSION >= 104700 @@ -37,7 +38,7 @@ feature_generator::~feature_generator() {} -bool feature_generator::generate(std::string & geojson, mapnik::Feature const& f) +bool feature_generator::generate(std::string & geojson, mapnik::feature_impl const& f) { sink_type sink(geojson); return karma::generate(sink, *grammar_,f); @@ -61,11 +62,11 @@ #include #include -#include +#include namespace mapnik { namespace json { -bool feature_generator::generate(std::string & geojson, mapnik::Feature const& f) +bool feature_generator::generate(std::string & geojson, mapnik::feature_impl const& f) { std::ostringstream s; s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100; diff -Nru mapnik-2.1.0/src/json/geometry_grammar.cpp mapnik-2.2.0/src/json/geometry_grammar.cpp --- mapnik-2.1.0/src/json/geometry_grammar.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/json/geometry_grammar.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -28,6 +28,11 @@ // boost #include +#include +#include +#include +#include // for clog, endl, etc +#include // for string namespace mapnik { namespace json { @@ -52,9 +57,9 @@ using qi::_pass; using qi::fail; using qi::on_error; - using phoenix::new_; - using phoenix::push_back; - using phoenix::construct; + using boost::phoenix::new_; + using boost::phoenix::push_back; + using boost::phoenix::construct; // Nabialek trick - FIXME: how to bind argument to dispatch rule? // geometry = lit("\"geometry\"") // >> lit(':') >> lit('{') @@ -139,16 +144,21 @@ // points points = lit('[')[_a = SEG_MOVETO] > -(point (_a,_r1) % lit(',')[_a = SEG_LINETO]) > lit(']'); + // give some rules names + geometry.name("Geometry"); + geometry_collection.name("GeometryCollection"); + geometry_dispatch.name("Geometry dispatch"); + coordinates.name("Coordinates"); // error handler on_error ( geometry , std::clog - << phoenix::val("Error! Expecting ") - << _4 // what failed? - << phoenix::val(" here: \"") - << construct(_3, _2) // iterators to error-pos, end - << phoenix::val("\"") + << boost::phoenix::val("Error! Expecting ") + << _4 // what failed? + << boost::phoenix::val(" here: \"") + << where_message_(_3, _2, 16) // max 16 chars + << boost::phoenix::val("\"") << std::endl ); } diff -Nru mapnik-2.1.0/src/json/geometry_parser.cpp mapnik-2.2.0/src/json/geometry_parser.cpp --- mapnik-2.1.0/src/json/geometry_parser.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/json/geometry_parser.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -30,6 +30,9 @@ #include #include +// stl +#include + namespace mapnik { namespace json { #if BOOST_VERSION >= 104700 diff -Nru mapnik-2.1.0/src/layer.cpp mapnik-2.2.0/src/layer.cpp --- mapnik-2.1.0/src/layer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/layer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -27,8 +27,6 @@ // stl #include -#include - namespace mapnik { @@ -42,8 +40,7 @@ clear_label_cache_(false), cache_features_(false), group_by_(""), - ds_(), - buffer_size_(0) {} + ds_() {} layer::layer(const layer& rhs) : name_(rhs.name_), @@ -60,7 +57,7 @@ buffer_size_(rhs.buffer_size_), maximum_extent_(rhs.maximum_extent_) {} -layer& layer::operator=(const layer& rhs) +layer& layer::operator=(layer const& rhs) { layer tmp(rhs); swap(tmp); @@ -72,21 +69,22 @@ return (this == &other); } -void layer::swap(const layer& rhs) +void layer::swap(layer& rhs) { - name_=rhs.name_; - srs_ = rhs.srs_; - min_zoom_=rhs.min_zoom_; - max_zoom_=rhs.max_zoom_; - active_=rhs.active_; - queryable_=rhs.queryable_; - clear_label_cache_ = rhs.clear_label_cache_; - cache_features_ = rhs.cache_features_; - group_by_ = rhs.group_by_; - styles_=rhs.styles_; - ds_=rhs.ds_; - buffer_size_ = rhs.buffer_size_; - maximum_extent_ = rhs.maximum_extent_; + using std::swap; + swap(name_, rhs.name_); + swap(srs_, rhs.srs_); + swap(min_zoom_, rhs.min_zoom_); + swap(max_zoom_, rhs.max_zoom_); + swap(active_, rhs.active_); + swap(queryable_, rhs.queryable_); + swap(clear_label_cache_, rhs.clear_label_cache_); + swap(cache_features_, rhs.cache_features_); + swap(group_by_, rhs.group_by_); + swap(styles_, rhs.styles_); + swap(ds_, rhs.ds_); + swap(buffer_size_, rhs.buffer_size_); + swap(maximum_extent_, rhs.maximum_extent_); } layer::~layer() {} @@ -198,14 +196,20 @@ void layer::set_buffer_size(int size) { - buffer_size_ = size; + buffer_size_.reset(size); } -int layer::buffer_size() const +boost::optional const& layer::buffer_size() const { return buffer_size_; } +void layer::reset_buffer_size() +{ + buffer_size_.reset(); +} + + box2d layer::envelope() const { if (ds_) return ds_->envelope(); diff -Nru mapnik-2.1.0/src/libxml2_loader.cpp mapnik-2.2.0/src/libxml2_loader.cpp --- mapnik-2.1.0/src/libxml2_loader.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/libxml2_loader.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,15 +23,12 @@ #ifdef HAVE_LIBXML2 // mapnik -#include #include #include #include - -// boost -#include -#include -#include +#include +#include +#include // libxml #include @@ -40,15 +37,13 @@ #include // stl -#include - -using namespace std; +#include #define DEFAULT_OPTIONS (XML_PARSE_NOERROR | XML_PARSE_NOENT | XML_PARSE_NOBLANKS | XML_PARSE_DTDLOAD | XML_PARSE_NOCDATA) namespace mapnik { -class libxml2_loader : boost::noncopyable +class libxml2_loader : mapnik::noncopyable { public: libxml2_loader(const char *encoding = NULL, int options = DEFAULT_OPTIONS, const char *url = NULL) : @@ -75,10 +70,9 @@ void load(std::string const& filename, xml_node &node) { - boost::filesystem::path path(filename); - if (!boost::filesystem::exists(path)) + if (!mapnik::util::exists(filename)) { - throw config_error(string("Could not load map file: File does not exist"), 0, filename); + throw config_error(std::string("Could not load map file: File does not exist"), 0, filename); } xmlDocPtr doc = xmlCtxtReadFile(ctx_, filename.c_str(), encoding_, options_); @@ -88,21 +82,13 @@ xmlError * error = xmlCtxtGetLastError(ctx_); if (error) { - std::ostringstream os; - os << "XML document not well formed"; - os << ": " << std::endl << error->message; + std::string msg("XML document not well formed:\n"); + msg += error->message; // remove CR - std::string msg = os.str().substr(0, os.str().size() - 1); + msg = msg.substr(0, msg.size() - 1); throw config_error(msg, error->line, error->file); } } - - /* - if ( ! ctx->valid ) - { - MAPNIK_LOG_WARN(libxml2_loader) << "libxml2_loader: Failed to validate DTD."; - } - */ load(doc, node); } @@ -116,9 +102,8 @@ { if (!base_path.empty()) { - boost::filesystem::path path(base_path); - if (!boost::filesystem::exists(path)) { - throw config_error(string("Could not locate base_path '") + + if (!mapnik::util::exists(base_path)) { + throw config_error(std::string("Could not locate base_path '") + base_path + "': file or directory does not exist"); } } @@ -132,18 +117,18 @@ { if (!doc) { + std::string msg("XML document not well formed"); xmlError * error = xmlCtxtGetLastError( ctx_ ); - std::ostringstream os; - os << "XML document not well formed"; - int line=0; - std::string file; if (error) { - os << ": " << std::endl << error->message; - line = error->line; - file = error->file; + msg += ":\n"; + msg += error->message; + throw config_error(msg, error->line, error->file); + } + else + { + throw config_error(msg); } - throw config_error(os.str(), line, file); } int iXIncludeReturn = xmlXIncludeProcessFlags(doc, options_); @@ -190,7 +175,7 @@ case XML_TEXT_NODE: { std::string trimmed((const char*)cur_node->content); - boost::algorithm::trim(trimmed); + mapnik::util::trim(trimmed); if (trimmed.empty()) break; //Don't add empty text nodes node.add_child(trimmed, cur_node->line, true); } diff -Nru mapnik-2.1.0/src/load_map.cpp mapnik-2.2.0/src/load_map.cpp --- mapnik-2.1.0/src/load_map.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/load_map.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -48,40 +48,36 @@ #include #include #include +#include #include +#include +#include // boost #include #include -#include #include #include #include #include -#include // agg #include "agg_trans_affine.h" -// stl -#include -#include - using boost::tokenizer; -using std::endl; - namespace mapnik { using boost::optional; -class map_parser : boost::noncopyable { +class map_parser : mapnik::noncopyable { public: map_parser(bool strict, std::string const& filename = "") : strict_(strict), filename_(filename), relative_to_xml_(true), - font_manager_(font_engine_) + font_manager_(font_engine_), + xml_base_path_() {} void parse_map(Map & map, xml_node const& sty, std::string const& base_path); @@ -106,16 +102,17 @@ void parse_building_symbolizer(rule & rule, xml_node const& sym); void parse_raster_symbolizer(rule & rule, xml_node const& sym); void parse_markers_symbolizer(rule & rule, xml_node const& sym); + void parse_debug_symbolizer(rule & rule, xml_node const& sym); - void parse_raster_colorizer(raster_colorizer_ptr const& rc, xml_node const& node); + bool parse_raster_colorizer(raster_colorizer_ptr const& rc, xml_node const& node); bool parse_stroke(stroke & strk, xml_node const & sym); void ensure_font_face(std::string const& face_name); void find_unused_nodes(xml_node const& root); - void find_unused_nodes_recursive(xml_node const& node, std::stringstream &error_text); + void find_unused_nodes_recursive(xml_node const& node, std::string & error_text); - std::string ensure_relative_to_xml(boost::optional opt_path); + std::string ensure_relative_to_xml(boost::optional const& opt_path); void ensure_exists(std::string const& file_path); boost::optional get_opt_color_attr(boost::property_tree::ptree const& node, std::string const& name); @@ -128,17 +125,18 @@ face_manager font_manager_; std::map file_sources_; std::map fontsets_; + std::string xml_base_path_; }; //#include -void load_map(Map & map, std::string const& filename, bool strict) +void load_map(Map & map, std::string const& filename, bool strict, std::string base_path) { // TODO - use xml encoding? xml_tree tree("utf8"); tree.set_filename(filename); read_xml(filename, tree.root()); map_parser parser(strict, filename); - parser.parse_map(map, tree.root(), ""); + parser.parse_map(map, tree.root(), base_path); //dump_xml(tree.root()); } @@ -147,9 +145,13 @@ // TODO - use xml encoding? xml_tree tree("utf8"); if (!base_path.empty()) + { read_xml_string(str, tree.root(), base_path); // accept base_path passed into function + } else - read_xml_string(str, tree.root(), map.base_path()); // default to map base_path + { + read_xml_string(str, tree.root(), map.base_path()); // FIXME - this value is not fully known yet + } map_parser parser(strict, base_path); parser.parse_map(map, tree.root(), base_path); } @@ -178,18 +180,11 @@ { map.set_base_path(*base_path_from_xml); } - else + else if (!filename_.empty()) { - boost::filesystem::path xml_path(filename_); - // TODO - should we make this absolute? -#if (BOOST_FILESYSTEM_VERSION == 3) - std::string base = xml_path.parent_path().string(); -#else // v2 - std::string base = xml_path.branch_path().string(); -#endif - - map.set_base_path(base); + map.set_base_path(mapnik::util::dirname(filename_)); } + xml_base_path_ = map.base_path(); optional bgcolor = map_node.get_opt_attr("background-color"); if (bgcolor) @@ -203,7 +198,17 @@ map.set_background_image(ensure_relative_to_xml(image_filename)); } - map.set_srs(map_node.get_attr("srs", map.srs())); + std::string srs = map_node.get_attr("srs", map.srs()); + try + { + // create throwaway projection object here to ensure it is valid + projection proj(srs); + } + catch (proj_init_error const& ex) + { + throw mapnik::config_error(ex.what()); + } + map.set_srs(srs); optional buffer_size = map_node.get_opt_attr("buffer-size"); if (buffer_size) @@ -221,15 +226,15 @@ } else { - std::ostringstream s_err; - s_err << "failed to parse Map maximum-extent '" << *maximum_extent << "'"; + std::string s_err("failed to parse Map maximum-extent '"); + s_err += *maximum_extent + "'"; if (strict_) { - throw config_error(s_err.str()); + throw config_error(s_err); } else { - MAPNIK_LOG_ERROR(load_map) << "map_parser: " << s_err.str(); + MAPNIK_LOG_ERROR(load_map) << "map_parser: " << s_err; } } } @@ -258,8 +263,7 @@ for (boost::tokenizer >::iterator beg = tokens.begin(); beg != tokens.end(); ++beg) { - std::string item(*beg); - boost::trim(item); + std::string item = mapnik::util::trim_copy(*beg); if (!mapnik::util::string2int(item,n[i])) { throw config_error(std::string("Invalid version string encountered: '") @@ -286,7 +290,7 @@ } } - catch (const config_error & ex) + catch (config_error const& ex) { ex.append_context(map_node); throw; @@ -343,16 +347,15 @@ { if (paramIter->is("Parameter")) { - std::string name = paramIter->get_attr("name"); + std::string param_name = paramIter->get_attr("name"); std::string value = paramIter->get_text(); - params[name] = value; + params[param_name] = value; } } datasource_templates_[name] = params; } else if (itr->is("Parameters")) { - std::string name = itr->get_attr("name", std::string("Unnamed")); parameters & params = map.get_extra_parameters(); xml_node::const_iterator paramIter = itr->begin(); xml_node::const_iterator endParam = itr->end(); @@ -368,13 +371,13 @@ if (*type == "int") { is_string = false; - int value = paramIter->get_value(); + mapnik::value_integer value = paramIter->get_value(); params[name] = value; } else if (*type == "float") { is_string = false; - double value = paramIter->get_value(); + double value = paramIter->get_value(); params[name] = value; } } @@ -388,7 +391,7 @@ } } } - } catch (const config_error & ex) { + } catch (config_error const& ex) { ex.append_context(include); throw; } @@ -430,16 +433,11 @@ optional filters = sty.get_opt_attr("image-filters"); if (filters) { - std::string filter_mode = *filters; - std::string::const_iterator itr = filter_mode.begin(); - std::string::const_iterator end = filter_mode.end(); - bool result = boost::spirit::qi::phrase_parse(itr,end, - sty.get_tree().image_filters_grammar, - boost::spirit::qi::ascii::space, - style.image_filters()); - if (!result || itr!=end) + std::string filter_str = *filters; + bool result = filter::parse_image_filters(filter_str, style.image_filters()); + if (!result) { - throw config_error("failed to parse image-filters: '" + std::string(itr,end) + "'"); + throw config_error("failed to parse image-filters: '" + filter_str + "'"); } } @@ -450,9 +448,9 @@ optional direct_filters = sty.get_opt_attr("direct-image-filters"); if (direct_filters) { - std::string filter_mode = *direct_filters; - std::string::const_iterator itr = filter_mode.begin(); - std::string::const_iterator end = filter_mode.end(); + std::string filter_str = *direct_filters; + std::string::const_iterator itr = filter_str.begin(); + std::string::const_iterator end = filter_str.end(); bool result = boost::spirit::qi::phrase_parse(itr,end, sty.get_tree().image_filters_grammar, boost::spirit::qi::ascii::space, @@ -476,7 +474,7 @@ } map.insert_style(name, style); - } catch (const config_error & ex) { + } catch (config_error const& ex) { ex.append_context(std::string("in style '") + name + "'", sty); throw; } @@ -514,9 +512,9 @@ // XXX Hack because map object isn't accessible by text_symbolizer // when it's parsed - fontsets_.insert(pair(name, fontset)); + fontsets_.insert(std::pair(name, fontset)); } - catch (const config_error & ex) + catch (config_error const& ex) { ex.append_context(std::string("in FontSet '") + name + "'", fset); throw; @@ -554,9 +552,17 @@ { name = node.get_attr("name", std::string("Unnamed")); - // XXX if no projection is given inherit from map? [DS] + // If no projection is given inherit from map std::string srs = node.get_attr("srs", map.srs()); - + try + { + // create throwaway projection object here to ensure it is valid + projection proj(srs); + } + catch (proj_init_error const& ex) + { + throw mapnik::config_error(ex.what()); + } layer lyr(name, srs); optional status = node.get_opt_attr("status"); @@ -621,15 +627,15 @@ } else { - std::ostringstream s_err; - s_err << "failed to parse Layer maximum-extent '" << *maximum_extent << "' for '" << name << "'"; + std::string s_err("failed to parse Layer maximum-extent '"); + s_err += *maximum_extent + "' for '" + name + "'"; if (strict_) { - throw config_error(s_err.str()); + throw config_error(s_err); } else { - MAPNIK_LOG_ERROR(load_map) << "map_parser: " << s_err.str(); + MAPNIK_LOG_ERROR(load_map) << "map_parser: " << s_err; } } } @@ -645,15 +651,15 @@ std::string style_name = child->get_text(); if (style_name.empty()) { - std::ostringstream ss; - ss << "StyleName is empty in Layer: '" << lyr.name() << "'"; + std::string ss("StyleName is empty in Layer: '"); + ss += lyr.name() + "'"; if (strict_) { - throw config_error(ss.str()); + throw config_error(ss); } else { - MAPNIK_LOG_WARN(load_map) << "map_parser: " << ss.str(); + MAPNIK_LOG_WARN(load_map) << "map_parser: " << ss; } } else @@ -669,7 +675,14 @@ { std::map::const_iterator base_itr = datasource_templates_.find(*base); if (base_itr!=datasource_templates_.end()) + { params = base_itr->second; + } + else + { + MAPNIK_LOG_ERROR(datasource) << "Datasource template '" << *base + << "' not found for layer '" << name << "'"; + } } xml_node::const_iterator paramIter = child->begin(); @@ -678,9 +691,9 @@ { if (paramIter->is("Parameter")) { - std::string name = paramIter->get_attr("name"); + std::string param_name = paramIter->get_attr("name"); std::string value = paramIter->get_text(); - params[name] = value; + params[param_name] = value; } } @@ -699,7 +712,7 @@ try { boost::shared_ptr ds = - datasource_cache::instance()->create(params); + datasource_cache::instance().create(params); lyr.set_datasource(ds); } catch (std::exception const& ex) @@ -714,7 +727,7 @@ } map.addLayer(lyr); } - catch (const config_error & ex) + catch (config_error const& ex) { if (!name.empty()) { @@ -806,11 +819,15 @@ { parse_markers_symbolizer(rule, *symIter); } + else if (symIter->is("DebugSymbolizer")) + { + parse_debug_symbolizer(rule, *symIter); + } } style.add_rule(rule); } - catch (const config_error & ex) + catch (config_error const& ex) { if (!name.empty()) { @@ -842,10 +859,9 @@ mapnik::transform_list_ptr tl = boost::make_shared(); if (!mapnik::parse_transform(*tl, *geometry_transform_wkt, pt.get_tree().transform_expr_grammar)) { - std::stringstream ss; - ss << "Could not parse transform from '" << *geometry_transform_wkt - << "', expected transform attribute"; - throw config_error(ss.str()); + std::string ss("Could not parse transform from '"); + ss += *geometry_transform_wkt + "', expected transform attribute"; + throw config_error(ss); } sym.set_transform(tl); } @@ -853,6 +869,25 @@ optional clip = pt.get_opt_attr("clip"); if (clip) sym.set_clip(*clip); + // simplify algorithm + optional simplify_algorithm_name = pt.get_opt_attr("simplify-algorithm"); + if (simplify_algorithm_name) + { + optional simplify_algorithm = simplify_algorithm_from_string(*simplify_algorithm_name); + if (simplify_algorithm) + { + sym.set_simplify_algorithm(*simplify_algorithm); + } + else + { + throw config_error("failed to parse simplify-algorithm: '" + *simplify_algorithm_name + "'"); + } + } + + // simplify value + optional simplify_tolerance = pt.get_opt_attr("simplify"); + if (simplify_tolerance) sym.set_simplify_tolerance(*simplify_tolerance); + // smooth value optional smooth = pt.get_opt_attr("smooth"); if (smooth) sym.set_smooth(*smooth); @@ -899,13 +934,7 @@ *file = ensure_relative_to_xml(file); std::string filename = *file; ensure_exists(filename); - path_expression_ptr expr(boost::make_shared()); - if (!parse_path_from_string(expr, filename, sym.get_tree().path_expr_grammar)) - { - throw mapnik::config_error("Failed to parse path_expression '" + filename + "'"); - } - - symbol.set_filename(expr); + symbol.set_filename( parse_path(filename, sym.get_tree().path_expr_grammar) ); optional image_transform_wkt = sym.get_opt_attr("transform"); if (image_transform_wkt) @@ -921,21 +950,20 @@ parse_symbolizer_base(symbol, sym); rule.append(symbol); } - catch (const config_error & ex) + catch (config_error const& ex) { ex.append_context(sym); throw; } } - -void map_parser::parse_markers_symbolizer(rule & rule, xml_node const& node) +void map_parser::parse_markers_symbolizer(rule & rule, xml_node const& sym) { try { std::string filename(""); - optional file = node.get_opt_attr("file"); - optional base = node.get_opt_attr("base"); + optional file = sym.get_opt_attr("file"); + optional base = sym.get_opt_attr("base"); if (file && !file->empty()) { @@ -951,7 +979,7 @@ filename = ensure_relative_to_xml(file); } - optional marker_type = node.get_opt_attr("marker-type"); + optional marker_type = sym.get_opt_attr("marker-type"); if (marker_type) { // TODO - revisit whether to officially deprecate marker-type @@ -962,77 +990,80 @@ { if (*marker_type == "ellipse") { - filename = marker_cache::known_svg_prefix_ + "ellipse"; + filename = marker_cache::instance().known_svg_prefix_ + "ellipse"; } else if (*marker_type == "arrow") { - filename = marker_cache::known_svg_prefix_ + "arrow"; + filename = marker_cache::instance().known_svg_prefix_ + "arrow"; } } } - markers_symbolizer sym; + markers_symbolizer symbol; if (!filename.empty()) { ensure_exists(filename); - path_expression_ptr expr(boost::make_shared()); - if (!parse_path_from_string(expr, filename, node.get_tree().path_expr_grammar)) - { - throw mapnik::config_error("Failed to parse path_expression '" + filename + "'"); - } - sym.set_filename(expr); + symbol.set_filename( parse_path(filename, sym.get_tree().path_expr_grammar) ); } // overall opacity to be applied to all paths - optional opacity = node.get_opt_attr("opacity"); - if (opacity) sym.set_opacity(*opacity); + optional opacity = sym.get_opt_attr("opacity"); + if (opacity) symbol.set_opacity(*opacity); - optional fill_opacity = node.get_opt_attr("fill-opacity"); - if (fill_opacity) sym.set_fill_opacity(*fill_opacity); + optional fill_opacity = sym.get_opt_attr("fill-opacity"); + if (fill_opacity) symbol.set_fill_opacity(*fill_opacity); - optional image_transform_wkt = node.get_opt_attr("transform"); + optional image_transform_wkt = sym.get_opt_attr("transform"); if (image_transform_wkt) { mapnik::transform_list_ptr tl = boost::make_shared(); - if (!mapnik::parse_transform(*tl, *image_transform_wkt, node.get_tree().transform_expr_grammar)) + if (!mapnik::parse_transform(*tl, *image_transform_wkt, sym.get_tree().transform_expr_grammar)) { throw mapnik::config_error("Failed to parse transform: '" + *image_transform_wkt + "'"); } - sym.set_image_transform(tl); + symbol.set_image_transform(tl); } - optional c = node.get_opt_attr("fill"); - if (c) sym.set_fill(*c); - optional spacing = node.get_opt_attr("spacing"); - if (spacing) sym.set_spacing(*spacing); - optional max_error = node.get_opt_attr("max-error"); - if (max_error) sym.set_max_error(*max_error); - optional allow_overlap = node.get_opt_attr("allow-overlap"); - optional ignore_placement = node.get_opt_attr("ignore-placement"); - if (allow_overlap) sym.set_allow_overlap(*allow_overlap); - if (ignore_placement) sym.set_ignore_placement(*ignore_placement); + optional c = sym.get_opt_attr("fill"); + if (c) symbol.set_fill(*c); + + optional spacing = sym.get_opt_attr("spacing"); + if (spacing) symbol.set_spacing(*spacing); + + optional max_error = sym.get_opt_attr("max-error"); + if (max_error) symbol.set_max_error(*max_error); - optional width = node.get_opt_attr("width"); - if (width) sym.set_width(*width); + optional allow_overlap = sym.get_opt_attr("allow-overlap"); + if (allow_overlap) symbol.set_allow_overlap(*allow_overlap); + + optional ignore_placement = sym.get_opt_attr("ignore-placement"); + if (ignore_placement) symbol.set_ignore_placement(*ignore_placement); - optional height = node.get_opt_attr("height"); - if (height) sym.set_height(*height); + optional width = sym.get_opt_attr("width"); + if (width) symbol.set_width(*width); + + optional height = sym.get_opt_attr("height"); + if (height) symbol.set_height(*height); stroke strk; - if (parse_stroke(strk,node)) + if (parse_stroke(strk,sym)) { - sym.set_stroke(strk); + symbol.set_stroke(strk); } - marker_placement_e placement = node.get_attr("placement",sym.get_marker_placement()); - sym.set_marker_placement(placement); - parse_symbolizer_base(sym, node); - rule.append(sym); + marker_placement_e placement = sym.get_attr("placement",symbol.get_marker_placement()); + symbol.set_marker_placement(placement); + + marker_multi_policy_e mpolicy = sym.get_attr("multi-policy",symbol.get_marker_multi_policy()); + symbol.set_marker_multi_policy(mpolicy); + + parse_symbolizer_base(symbol, sym); + rule.append(symbol); } catch (config_error const& ex) { - ex.append_context(node); + ex.append_context(sym); throw; } } @@ -1060,17 +1091,12 @@ file = ensure_relative_to_xml(file); ensure_exists(file); - path_expression_ptr expr(boost::make_shared()); - if (!parse_path_from_string(expr, file, sym.get_tree().path_expr_grammar)) - { - throw mapnik::config_error("Failed to parse path_expression '" + file + "'"); - } - line_pattern_symbolizer symbol(expr); + line_pattern_symbolizer symbol( parse_path(file, sym.get_tree().path_expr_grammar) ); parse_symbolizer_base(symbol, sym); rule.append(symbol); } - catch (const config_error & ex) + catch (config_error const& ex) { ex.append_context(sym); throw; @@ -1102,19 +1128,14 @@ file = ensure_relative_to_xml(file); ensure_exists(file); - path_expression_ptr expr(boost::make_shared()); - if (!parse_path_from_string(expr, file, sym.get_tree().path_expr_grammar)) - { - throw mapnik::config_error("Failed to parse path_expression '" + file + "'"); - } - polygon_pattern_symbolizer symbol(expr); + polygon_pattern_symbolizer symbol( parse_path(file, sym.get_tree().path_expr_grammar) ); // pattern alignment pattern_alignment_e p_alignment = sym.get_attr("alignment",LOCAL_ALIGNMENT); symbol.set_alignment(p_alignment); // opacity - optional opacity = sym.get_opt_attr("opacity"); + optional opacity = sym.get_opt_attr("opacity"); if (opacity) symbol.set_opacity(*opacity); // gamma @@ -1128,7 +1149,7 @@ parse_symbolizer_base(symbol, sym); rule.append(symbol); } - catch (const config_error & ex) + catch (config_error const& ex) { ex.append_context(sym); throw; @@ -1142,22 +1163,25 @@ text_placements_ptr placement_finder; optional placement_type = sym.get_opt_attr("placement-type"); if (placement_type) { - placement_finder = placements::registry::instance()->from_xml(*placement_type, sym, fontsets_); + placement_finder = placements::registry::instance().from_xml(*placement_type, sym, fontsets_); } else { placement_finder = boost::make_shared(); placement_finder->defaults.from_xml(sym, fontsets_); } if (strict_ && - !placement_finder->defaults.format.fontset.size()) + !placement_finder->defaults.format.fontset) { ensure_font_face(placement_finder->defaults.format.face_name); } text_symbolizer text_symbol = text_symbolizer(placement_finder); parse_symbolizer_base(text_symbol, sym); + optional halo_rasterizer = sym.get_opt_attr("halo-rasterizer"); + if (halo_rasterizer) text_symbol.set_halo_rasterizer(*halo_rasterizer); + rule.append(text_symbol); } - catch (const config_error & ex) + catch (config_error const& ex) { ex.append_context(sym); throw; @@ -1171,13 +1195,13 @@ text_placements_ptr placement_finder; optional placement_type = sym.get_opt_attr("placement-type"); if (placement_type) { - placement_finder = placements::registry::instance()->from_xml(*placement_type, sym, fontsets_); + placement_finder = placements::registry::instance().from_xml(*placement_type, sym, fontsets_); } else { placement_finder = boost::make_shared(); } placement_finder->defaults.from_xml(sym, fontsets_); if (strict_ && - !placement_finder->defaults.format.fontset.size()) + !placement_finder->defaults.format.fontset) { ensure_font_face(placement_finder->defaults.format.face_name); } @@ -1201,7 +1225,7 @@ shield_symbol.set_shield_displacement(shield_dx,shield_dy); // opacity - optional opacity = sym.get_opt_attr("opacity"); + optional opacity = sym.get_opt_attr("opacity"); if (opacity) { shield_symbol.set_opacity(*opacity); @@ -1247,23 +1271,18 @@ sym.get_opt_attr("no-text"); if (no_text) { - MAPNIK_LOG_ERROR(raster_symbolizer) << "'no-text' is deprecated and will be removed in Mapnik 3.x, to create a ShieldSymbolizer without text just provide an element like: \"' '\""; + MAPNIK_LOG_ERROR(shield_symbolizer) << "'no-text' is deprecated and will be removed in Mapnik 3.x, to create a ShieldSymbolizer without text just provide an element like: \"' '\""; if (*no_text) shield_symbol.set_name(parse_expression("' '")); } file = ensure_relative_to_xml(file); ensure_exists(file); - path_expression_ptr expr(boost::make_shared()); - if (!parse_path_from_string(expr, file, sym.get_tree().path_expr_grammar)) - { - throw mapnik::config_error("Failed to parse path_expression '" + file + "'"); - } - shield_symbol.set_filename(expr); + shield_symbol.set_filename( parse_path(file, sym.get_tree().path_expr_grammar) ); parse_symbolizer_base(shield_symbol, sym); rule.append(shield_symbol); } - catch (const config_error & ex) + catch (config_error const& ex) { ex.append_context(sym); throw; @@ -1372,7 +1391,7 @@ parse_symbolizer_base(symbol, sym); rule.append(symbol); } - catch (const config_error & ex) + catch (config_error const& ex) { ex.append_context(sym); throw; @@ -1401,7 +1420,7 @@ parse_symbolizer_base(poly_sym, sym); rule.append(poly_sym); } - catch (const config_error & ex) + catch (config_error const& ex) { ex.append_context(sym); throw; @@ -1427,7 +1446,7 @@ parse_symbolizer_base(building_sym, sym); rule.append(building_sym); } - catch (const config_error & ex) + catch (config_error const& ex) { ex.append_context(sym); throw; @@ -1478,7 +1497,7 @@ } // opacity - optional opacity = sym.get_opt_attr("opacity"); + optional opacity = sym.get_opt_attr("opacity"); if (opacity) raster_sym.set_opacity(*opacity); // filter factor @@ -1489,32 +1508,57 @@ optional mesh_size = sym.get_opt_attr("mesh-size"); if (mesh_size) raster_sym.set_mesh_size(*mesh_size); + // premultiplied status of image + optional premultiplied = sym.get_opt_attr("premultiplied"); + if (premultiplied) raster_sym.set_premultiplied(*premultiplied); xml_node::const_iterator cssIter = sym.begin(); xml_node::const_iterator endCss = sym.end(); + bool found_colorizer = false; for(; cssIter != endCss; ++cssIter) { if (cssIter->is("RasterColorizer")) { + found_colorizer = true; raster_colorizer_ptr colorizer = boost::make_shared(); raster_sym.set_colorizer(colorizer); - parse_raster_colorizer(colorizer, *cssIter); + if (parse_raster_colorizer(colorizer, *cssIter)) + raster_sym.set_colorizer(colorizer); + } } + // look for properties one level up + if (!found_colorizer) + { + raster_colorizer_ptr colorizer = boost::make_shared(); + if (parse_raster_colorizer(colorizer, sym)) + raster_sym.set_colorizer(colorizer); + } parse_symbolizer_base(raster_sym, sym); rule.append(raster_sym); } - catch (const config_error & ex) + catch (config_error const& ex) { ex.append_context(sym); throw; } } -void map_parser::parse_raster_colorizer(raster_colorizer_ptr const& rc, +void map_parser::parse_debug_symbolizer(rule & rule, xml_node const & sym) +{ + debug_symbolizer symbol; + parse_symbolizer_base(symbol, sym); + debug_symbolizer_mode_e mode = + sym.get_attr("mode", DEBUG_SYM_MODE_COLLISION); + symbol.set_mode(mode); + rule.append(symbol); +} + +bool map_parser::parse_raster_colorizer(raster_colorizer_ptr const& rc, xml_node const& node) { + bool found_stops = false; try { // mode @@ -1553,6 +1597,7 @@ { if (stopIter->is("stop")) { + found_stops = true; // colour is optional. optional stopcolor = stopIter->get_opt_attr("color"); if (!stopcolor) { @@ -1591,11 +1636,12 @@ } } } - catch (const config_error & ex) + catch (config_error const& ex) { ex.append_context(node); throw; } + return found_stops; } void map_parser::ensure_font_face(std::string const& face_name) @@ -1607,29 +1653,17 @@ } } -std::string map_parser::ensure_relative_to_xml(boost::optional opt_path) +std::string map_parser::ensure_relative_to_xml(boost::optional const& opt_path) { - if (marker_cache::is_uri(*opt_path)) + if (marker_cache::instance().is_uri(*opt_path)) return *opt_path; - if (relative_to_xml_) + if (!xml_base_path_.empty() && relative_to_xml_) { - boost::filesystem::path xml_path = filename_; - boost::filesystem::path rel_path = *opt_path; - if (!rel_path.has_root_path()) - { -#if (BOOST_FILESYSTEM_VERSION == 3) - // TODO - normalize is now deprecated, use make_preferred? - boost::filesystem::path full = boost::filesystem::absolute(xml_path.parent_path()/rel_path); -#else // v2 - boost::filesystem::path full = boost::filesystem::complete(xml_path.branch_path()/rel_path).normalize(); -#endif - - MAPNIK_LOG_DEBUG(load_map) << "map_parser: Modifying relative paths to be relative to xml..."; - MAPNIK_LOG_DEBUG(load_map) << "map_parser: -- Original base path=" << *opt_path; - MAPNIK_LOG_DEBUG(load_map) << "map_parser: -- Relative base path=" << full.string(); - - return full.string(); + std::string starting_path = *opt_path; + if (mapnik::util::is_relative(starting_path)) + { + return mapnik::util::make_absolute(starting_path,xml_base_path_); } } return *opt_path; @@ -1637,25 +1671,25 @@ void map_parser::ensure_exists(std::string const& file_path) { - if (marker_cache::is_uri(file_path)) + if (marker_cache::instance().is_uri(file_path)) return; // validate that the filename exists if it is not a dynamic PathExpression if (!boost::algorithm::find_first(file_path,"[") && !boost::algorithm::find_first(file_path,"]")) { - if (!boost::filesystem::exists(file_path)) + if (!mapnik::util::exists(file_path)) { - throw mapnik::config_error("point-file could not be found: '" + file_path + "'"); + throw mapnik::config_error("file could not be found: '" + file_path + "'"); } } } void map_parser::find_unused_nodes(xml_node const& root) { - std::stringstream error_message; + std::string error_message; find_unused_nodes_recursive(root, error_message); - if (!error_message.str().empty()) + if (!error_message.empty()) { - std::string msg("Unable to process some data while parsing '" + filename_ + "':" + error_message.str()); + std::string msg("Unable to process some data while parsing '" + filename_ + "':" + error_message); if (strict_) { throw config_error(msg); @@ -1667,14 +1701,14 @@ } } -void map_parser::find_unused_nodes_recursive(xml_node const& node, std::stringstream &error_message) +void map_parser::find_unused_nodes_recursive(xml_node const& node, std::string & error_message) { if (!node.processed()) { if (node.is_text()) { - error_message << "\n* text '" << node.text() << "'"; + error_message += "\n* text '" + node.text() + "'"; } else { - error_message << "\n* node '" << node.name() << "' at line " << node.line(); + error_message += "\n* node '" + node.name() + "' at line " + node.line_to_string(); } return; //All attributes and children are automatically unprocessed, too. } @@ -1685,9 +1719,9 @@ { if (!aitr->second.processed) { - error_message << "\n* attribute '" << aitr->first << - "' with value '" << aitr->second.value << - "' at line " << node.line(); + error_message += "\n* attribute '" + aitr->first + + "' with value '" + aitr->second.value + + "' at line " + node.line_to_string(); } } xml_node::const_iterator itr = node.begin(); diff -Nru mapnik-2.1.0/src/map.cpp mapnik-2.2.0/src/map.cpp --- mapnik-2.1.0/src/map.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/map.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,6 +21,10 @@ *****************************************************************************/ // mapnik +#include +#include +#include +#include #include #include #include @@ -38,6 +42,9 @@ // boost #include +// stl +#include + namespace mapnik { @@ -58,7 +65,7 @@ Map::Map() : width_(400), height_(400), - srs_("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"), + srs_(MAPNIK_LONGLAT_PROJ), buffer_size_(0), aspectFixMode_(GROW_BBOX), base_path_("") {} @@ -71,7 +78,7 @@ aspectFixMode_(GROW_BBOX), base_path_("") {} -Map::Map(const Map& rhs) +Map::Map(Map const& rhs) : width_(rhs.width_), height_(rhs.height_), srs_(rhs.srs_), @@ -89,7 +96,7 @@ Map::~Map() {} -Map& Map::operator=(const Map& rhs) +Map& Map::operator=(Map const& rhs) { if (this==&rhs) return *this; width_=rhs.width_; @@ -128,12 +135,12 @@ return styles_.end(); } -Map::const_style_iterator Map::begin_styles() const +Map::const_style_iterator Map::begin_styles() const { return styles_.begin(); } -Map::const_style_iterator Map::end_styles() const +Map::const_style_iterator Map::end_styles() const { return styles_.end(); } @@ -159,6 +166,10 @@ bool Map::insert_fontset(std::string const& name, font_set const& fontset) { + if (fontset.get_name() != name) + { + throw mapnik::config_error("Fontset name must match the name used to reference it on the map"); + } return fontsets_.insert(make_pair(name, fontset)).second; } @@ -186,7 +197,7 @@ return layers_.size(); } -void Map::addLayer(const layer& l) +void Map::addLayer(layer const& l) { layers_.push_back(l); } @@ -202,7 +213,7 @@ styles_.clear(); } -const layer& Map::getLayer(size_t index) const +layer const& Map::getLayer(size_t index) const { return layers_[index]; } @@ -234,7 +245,9 @@ void Map::set_width(unsigned width) { - if (width >= MIN_MAPSIZE && width <= MAX_MAPSIZE) + if (width != width_ && + width >= MIN_MAPSIZE && + width <= MAX_MAPSIZE) { width_=width; fixAspectRatio(); @@ -243,7 +256,9 @@ void Map::set_height(unsigned height) { - if (height >= MIN_MAPSIZE && height <= MAX_MAPSIZE) + if (height != height_ && + height >= MIN_MAPSIZE && + height <= MAX_MAPSIZE) { height_=height; fixAspectRatio(); @@ -252,8 +267,12 @@ void Map::resize(unsigned width,unsigned height) { - if (width >= MIN_MAPSIZE && width <= MAX_MAPSIZE && - height >= MIN_MAPSIZE && height <= MAX_MAPSIZE) + if ((width != width_ || + height != height_) && + width >= MIN_MAPSIZE && + width <= MAX_MAPSIZE && + height >= MIN_MAPSIZE && + height <= MAX_MAPSIZE) { width_=width; height_=height; @@ -286,7 +305,7 @@ return background_; } -void Map::set_background(const color& c) +void Map::set_background(color const& c) { background_ = c; } @@ -340,54 +359,61 @@ void Map::zoom_all() { - if (maximum_extent_) { - zoom_to_box(*maximum_extent_); - } - else + try { - try + if (layers_.empty()) { - if (!layers_.size() > 0) - return; - projection proj0(srs_); - box2d ext; - bool success = false; - bool first = true; - std::vector::const_iterator itr = layers_.begin(); - std::vector::const_iterator end = layers_.end(); - while (itr != end) + return; + } + projection proj0(srs_); + box2d ext; + bool success = false; + bool first = true; + std::vector::const_iterator itr = layers_.begin(); + std::vector::const_iterator end = layers_.end(); + while (itr != end) + { + if (itr->active()) { - if (itr->active()) + std::string const& layer_srs = itr->srs(); + projection proj1(layer_srs); + proj_transform prj_trans(proj0,proj1); + box2d layer_ext = itr->envelope(); + if (prj_trans.backward(layer_ext, PROJ_ENVELOPE_POINTS)) { - std::string const& layer_srs = itr->srs(); - projection proj1(layer_srs); - - proj_transform prj_trans(proj0,proj1); - - box2d layer_ext = itr->envelope(); - if (prj_trans.backward(layer_ext, PROJ_ENVELOPE_POINTS)) + success = true; + MAPNIK_LOG_DEBUG(map) << "map: Layer " << itr->name() << " original ext=" << itr->envelope(); + MAPNIK_LOG_DEBUG(map) << "map: Layer " << itr->name() << " transformed to map srs=" << layer_ext; + if (first) { - success = true; - - MAPNIK_LOG_DEBUG(map) << "map: Layer " << itr->name() << " original ext=" << itr->envelope(); - MAPNIK_LOG_DEBUG(map) << "map: Layer " << itr->name() << " transformed to map srs=" << layer_ext; - - if (first) - { - ext = layer_ext; - first = false; - } - else - { - ext.expand_to_include(layer_ext); - } + ext = layer_ext; + first = false; + } + else + { + ext.expand_to_include(layer_ext); } } - ++itr; } - if (success) { - zoom_to_box(ext); - } else { + ++itr; + } + if (success) + { + if (maximum_extent_) { + ext.clip(*maximum_extent_); + } + zoom_to_box(ext); + } + else + { + if (maximum_extent_) + { + MAPNIK_LOG_ERROR(map) << "could not zoom to combined layer extents" + << " so falling back to maximum-extent for zoom_all result"; + zoom_to_box(*maximum_extent_); + } + else + { std::ostringstream s; s << "could not zoom to combined layer extents " << "using zoom_all because proj4 could not " @@ -396,14 +422,14 @@ throw std::runtime_error(s.str()); } } - catch (proj_init_error & ex) - { - throw mapnik::config_error(std::string("Projection error during map.zoom_all: ") + ex.what()); - } + } + catch (proj_init_error const& ex) + { + throw mapnik::config_error(std::string("Projection error during map.zoom_all: ") + ex.what()); } } -void Map::zoom_to_box(const box2d &box) +void Map::zoom_to_box(box2d const& box) { current_extent_=box; fixAspectRatio(); @@ -465,7 +491,7 @@ } } -const box2d& Map::get_current_extent() const +box2d const& Map::get_current_extent() const { return current_extent_; } @@ -507,7 +533,7 @@ double Map::scale_denominator() const { projection map_proj(srs_); - return mapnik::scale_denominator( *this, map_proj.is_geographic()); + return mapnik::scale_denominator( scale(), map_proj.is_geographic()); } CoordTransform Map::view_transform() const @@ -539,23 +565,24 @@ { throw std::runtime_error("query_point: could not project x,y into layer srs"); } - // TODO - pass tolerance to features_at_point as well - featureset_ptr fs = ds->features_at_point(mapnik::coord2d(x,y)); + // calculate default tolerance + mapnik::box2d map_ex = current_extent_; + if (maximum_extent_) + { + map_ex.clip(*maximum_extent_); + } + if (!prj_trans.backward(map_ex,PROJ_ENVELOPE_POINTS)) + { + std::ostringstream s; + s << "query_point: could not project map extent '" << map_ex + << "' into layer srs for tolerance calculation"; + throw std::runtime_error(s.str()); + } + double tol = (map_ex.maxx() - map_ex.minx()) / width_ * 3; + featureset_ptr fs = ds->features_at_point(mapnik::coord2d(x,y), tol); + MAPNIK_LOG_DEBUG(map) << "map: Query at point tol=" << tol << "(" << x << "," << y << ")"; if (fs) { - mapnik::box2d map_ex = current_extent_; - if (maximum_extent_) { - map_ex.clip(*maximum_extent_); - } - if (!prj_trans.backward(map_ex,PROJ_ENVELOPE_POINTS)) - { - std::ostringstream s; - s << "query_point: could not project map extent '" << map_ex - << "' into layer srs for tolerance calculation"; - throw std::runtime_error(s.str()); - } - double tol = (map_ex.maxx() - map_ex.minx()) / width_ * 3; - MAPNIK_LOG_DEBUG(map) << "map: Query at point tol=" << tol << "(" << x << "," << y << ")"; return boost::make_shared >(fs, hit_test_filter(x,y,tol)); } @@ -565,7 +592,7 @@ { std::ostringstream s; s << "Invalid layer index passed to query_point: '" << index << "'"; - if (layers_.size() > 0) s << " for map with " << layers_.size() << " layers(s)"; + if (!layers_.empty()) s << " for map with " << layers_.size() << " layers(s)"; else s << " (map has no layers)"; throw std::out_of_range(s.str()); } diff -Nru mapnik-2.1.0/src/mapped_memory_cache.cpp mapnik-2.2.0/src/mapped_memory_cache.cpp --- mapnik-2.1.0/src/mapped_memory_cache.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/mapped_memory_cache.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,19 +22,17 @@ // mapnik #include +#include #include // boost #include #include -#include #include namespace mapnik { -boost::unordered_map mapped_memory_cache::cache_; - void mapped_memory_cache::clear() { #ifdef MAPNIK_THREADSAFE @@ -65,8 +63,7 @@ return result; } - boost::filesystem::path path(uri); - if (exists(path)) + if (mapnik::util::exists(uri)) { try { @@ -81,9 +78,11 @@ } return result; } - catch (...) + catch (std::exception const& ex) { - MAPNIK_LOG_ERROR(mapped_memory_cache) << "Exception caught while loading mapping memory file: " << uri; + MAPNIK_LOG_ERROR(mapped_memory_cache) + << "Error loading mapped memory file: '" + << uri << "' (" << ex.what() << ")"; } } /* diff -Nru mapnik-2.1.0/src/marker_cache.cpp mapnik-2.2.0/src/marker_cache.cpp --- mapnik-2.1.0/src/marker_cache.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/marker_cache.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -31,10 +31,10 @@ #include #include #include +#include // boost #include -#include #include #include @@ -45,11 +45,8 @@ namespace mapnik { -boost::unordered_map marker_cache::marker_cache_; -boost::unordered_map marker_cache::svg_cache_; -std::string marker_cache::known_svg_prefix_ = "shape://"; - marker_cache::marker_cache() + : known_svg_prefix_("shape://") { insert_svg("ellipse", "" @@ -154,6 +151,7 @@ double lox,loy,hix,hiy; svg.bounding_rect(&lox, &loy, &hix, &hiy); marker_path->set_bounding_box(lox,loy,hix,hiy); + marker_path->set_dimensions(svg.width(),svg.height()); marker_ptr mark(boost::make_shared(marker_path)); result.reset(mark); if (update_cache) @@ -164,8 +162,7 @@ // otherwise assume file-based else { - boost::filesystem::path path(uri); - if (!exists(path)) + if (!mapnik::util::exists(uri)) { MAPNIK_LOG_ERROR(marker_cache) << "Marker does not exist: " << uri; return result; @@ -183,6 +180,7 @@ double lox,loy,hix,hiy; svg.bounding_rect(&lox, &loy, &hix, &hiy); marker_path->set_bounding_box(lox,loy,hix,hiy); + marker_path->set_dimensions(svg.width(),svg.height()); marker_ptr mark(boost::make_shared(marker_path)); result.reset(mark); if (update_cache) @@ -201,11 +199,12 @@ BOOST_ASSERT(width > 0 && height > 0); mapnik::image_ptr image(boost::make_shared(width,height)); reader->read(0,0,*image); - // ensure images are premultiplied - // TODO - don't need to multiply jpegs - agg::rendering_buffer buffer(image->getBytes(),image->width(),image->height(),image->width() * 4); - agg::pixfmt_rgba32 pixf(buffer); - pixf.premultiply(); + if (!reader->premultiplied_alpha()) + { + agg::rendering_buffer buffer(image->getBytes(),image->width(),image->height(),image->width() * 4); + agg::pixfmt_rgba32 pixf(buffer); + pixf.premultiply(); + } marker_ptr mark(boost::make_shared(image)); result.reset(mark); if (update_cache) @@ -224,10 +223,6 @@ { MAPNIK_LOG_ERROR(marker_cache) << "Exception caught while loading: '" << uri << "' (" << ex.what() << ")"; } - catch (...) - { - MAPNIK_LOG_ERROR(marker_cache) << "Exception caught while loading: '" << uri << "'"; - } return result; } diff -Nru mapnik-2.1.0/src/markers_symbolizer.cpp mapnik-2.2.0/src/markers_symbolizer.cpp --- mapnik-2.1.0/src/markers_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/markers_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,9 +22,10 @@ // mapnik #include - -// boost -#include +#include +#include +#include +#include namespace mapnik { @@ -37,6 +38,15 @@ IMPLEMENT_ENUM( marker_placement_e, marker_placement_strings ) +static const char * marker_multi_policy_strings[] = { + "each", + "whole", + "largest", + "" +}; + +IMPLEMENT_ENUM( marker_multi_policy_e, marker_multi_policy_strings ) + markers_symbolizer::markers_symbolizer() : symbolizer_with_image(parse_path("shape://ellipse")), symbolizer_base(), @@ -46,7 +56,10 @@ allow_overlap_(false), spacing_(100.0), max_error_(0.2), - marker_p_(MARKER_POINT_PLACEMENT) { } + marker_p_(MARKER_POINT_PLACEMENT), + // TODO: consider defaulting to MARKER_WHOLE_MULTI, + // for backward compatibility with 2.0.0 + marker_mp_(MARKER_EACH_MULTI) { } markers_symbolizer::markers_symbolizer(path_expression_ptr const& filename) : symbolizer_with_image(filename), @@ -57,7 +70,10 @@ allow_overlap_(false), spacing_(100.0), max_error_(0.2), - marker_p_(MARKER_POINT_PLACEMENT) { } + marker_p_(MARKER_POINT_PLACEMENT), + // TODO: consider defaulting to MARKER_WHOLE_MULTI, + // for backward compatibility with 2.0.0 + marker_mp_(MARKER_EACH_MULTI) { } markers_symbolizer::markers_symbolizer(markers_symbolizer const& rhs) : symbolizer_with_image(rhs), @@ -71,7 +87,8 @@ fill_(rhs.fill_), fill_opacity_(rhs.fill_opacity_), stroke_(rhs.stroke_), - marker_p_(rhs.marker_p_) {} + marker_p_(rhs.marker_p_), + marker_mp_(rhs.marker_mp_) {} void markers_symbolizer::set_ignore_placement(bool ignore_placement) { @@ -173,4 +190,14 @@ return marker_p_; } +void markers_symbolizer::set_marker_multi_policy(marker_multi_policy_e marker_mp) +{ + marker_mp_ = marker_mp; +} + +marker_multi_policy_e markers_symbolizer::get_marker_multi_policy() const +{ + return marker_mp_; +} + } diff -Nru mapnik-2.1.0/src/memory_datasource.cpp mapnik-2.2.0/src/memory_datasource.cpp --- mapnik-2.1.0/src/memory_datasource.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/memory_datasource.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,7 +26,6 @@ #include #include #include -#include // boost #include @@ -62,9 +61,11 @@ bool first_; }; -memory_datasource::memory_datasource() +memory_datasource::memory_datasource(datasource::datasource_t type, bool bbox_check) : datasource(parameters()), - desc_("in-memory datasource","utf-8") {} + desc_("in-memory datasource","utf-8"), + type_(type), + bbox_check_(bbox_check) {} memory_datasource::~memory_datasource() {} @@ -77,30 +78,36 @@ datasource::datasource_t memory_datasource::type() const { - return datasource::Vector; + return type_; } featureset_ptr memory_datasource::features(const query& q) const { - return boost::make_shared(q.get_bbox(),*this); + return boost::make_shared(q.get_bbox(),*this,bbox_check_); } -featureset_ptr memory_datasource::features_at_point(coord2d const& pt) const +featureset_ptr memory_datasource::features_at_point(coord2d const& pt, double tol) const { box2d box = box2d(pt.x, pt.y, pt.x, pt.y); - + box.pad(tol); MAPNIK_LOG_DEBUG(memory_datasource) << "memory_datasource: Box=" << box << ", Point x=" << pt.x << ",y=" << pt.y; - return boost::make_shared(box,*this); } +void memory_datasource::set_envelope(box2d const& box) +{ + extent_ = box; +} + box2d memory_datasource::envelope() const { - box2d ext; - accumulate_extent func(ext); - std::for_each(features_.begin(),features_.end(),func); - return ext; + if (!extent_.valid()) + { + accumulate_extent func(extent_); + std::for_each(features_.begin(),features_.end(),func); + } + return extent_; } boost::optional memory_datasource::get_geometry_type() const diff -Nru mapnik-2.1.0/src/miniz.c mapnik-2.2.0/src/miniz.c --- mapnik-2.1.0/src/miniz.c 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/miniz.c 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,4834 @@ +/* miniz.c v1.14 - public domain deflate/inflate, zlib-subset, ZIP reading/writing/appending, PNG writing + See "unlicense" statement at the end of this file. + Rich Geldreich , last updated May 20, 2012 + Implements RFC 1950: http://www.ietf.org/rfc/rfc1950.txt and RFC 1951: http://www.ietf.org/rfc/rfc1951.txt + + Most API's defined in miniz.c are optional. For example, to disable the archive related functions just define + MINIZ_NO_ARCHIVE_APIS, or to get rid of all stdio usage define MINIZ_NO_STDIO (see the list below for more macros). + + * Change History + 5/20/12 v1.14 - MinGW32/64 GCC 4.6.1 compiler fixes: added MZ_FORCEINLINE, #include (thanks fermtect). + 5/19/12 v1.13 - From jason@cornsyrup.org and kelwert@mtu.edu - Fix mz_crc32() so it doesn't compute the wrong CRC-32's when mz_ulong is 64-bit. + Temporarily/locally slammed in "typedef unsigned long mz_ulong" and re-ran a randomized regression test on ~500k files. + Eliminated a bunch of warnings when compiling with GCC 32-bit/64. + Ran all examples, miniz.c, and tinfl.c through MSVC 2008's /analyze (static analysis) option and fixed all warnings (except for the silly + "Use of the comma-operator in a tested expression.." analysis warning, which I purposely use to work around a MSVC compiler warning). + Created 32-bit and 64-bit Codeblocks projects/workspace. Built and tested Linux executables. The codeblocks workspace is compatible with Linux+Win32/x64. + Added miniz_tester solution/project, which is a useful little app derived from LZHAM's tester app that I use as part of the regression test. + Ran miniz.c and tinfl.c through another series of regression testing on ~500,000 files and archives. + Modified example5.c so it purposely disables a bunch of high-level functionality (MINIZ_NO_STDIO, etc.). (Thanks to corysama for the MINIZ_NO_STDIO bug report.) + Fix ftell() usage in examples so they exit with an error on files which are too large (a limitation of the examples, not miniz itself). + 4/12/12 v1.12 - More comments, added low-level example5.c, fixed a couple minor level_and_flags issues in the archive API's. + level_and_flags can now be set to MZ_DEFAULT_COMPRESSION. Thanks to Bruce Dawson for the feedback/bug report. + 5/28/11 v1.11 - Added statement from unlicense.org + 5/27/11 v1.10 - Substantial compressor optimizations: + Level 1 is now ~4x faster than before. The L1 compressor's throughput now varies between 70-110MB/sec. on a + Core i7 (actual throughput varies depending on the type of data, and x64 vs. x86). + Improved baseline L2-L9 compression perf. Also, greatly improved compression perf. issues on some file types. + Refactored the compression code for better readability and maintainability. + Added level 10 compression level (L10 has slightly better ratio than level 9, but could have a potentially large + drop in throughput on some files). + 5/15/11 v1.09 - Initial stable release. + + * Low-level Deflate/Inflate implementation notes: + + Compression: Use the "tdefl" API's. The compressor supports raw, static, and dynamic blocks, lazy or + greedy parsing, match length filtering, RLE-only, and Huffman-only streams. It performs and compresses + approximately as well as zlib. + + Decompression: Use the "tinfl" API's. The entire decompressor is implemented as a single function + coroutine: see tinfl_decompress(). It supports decompression into a 32KB (or larger power of 2) wrapping buffer, or into a memory + block large enough to hold the entire file. + + The low-level tdefl/tinfl API's do not make any use of dynamic memory allocation. + + * zlib-style API notes: + + miniz.c implements a fairly large subset of zlib. There's enough functionality present for it to be a drop-in + zlib replacement in many apps: + The z_stream struct, optional memory allocation callbacks + deflateInit/deflateInit2/deflate/deflateReset/deflateEnd/deflateBound + inflateInit/inflateInit2/inflate/inflateEnd + compress, compress2, compressBound, uncompress + CRC-32, Adler-32 - Using modern, minimal code size, CPU cache friendly routines. + Supports raw deflate streams or standard zlib streams with adler-32 checking. + + Limitations: + The callback API's are not implemented yet. No support for gzip headers or zlib static dictionaries. + I've tried to closely emulate zlib's various flavors of stream flushing and return status codes, but + there are no guarantees that miniz.c pulls this off perfectly. + + * PNG writing: See the tdefl_write_image_to_png_file_in_memory() function, originally written by + Alex Evans. Supports 1-4 bytes/pixel images. + + * ZIP archive API notes: + + The ZIP archive API's where designed with simplicity and efficiency in mind, with just enough abstraction to + get the job done with minimal fuss. There are simple API's to retrieve file information, read files from + existing archives, create new archives, append new files to existing archives, or clone archive data from + one archive to another. It supports archives located in memory or the heap, on disk (using stdio.h), + or you can specify custom file read/write callbacks. + + - Archive reading: Just call this function to read a single file from a disk archive: + + void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char *pArchive_name, + size_t *pSize, mz_uint zip_flags); + + For more complex cases, use the "mz_zip_reader" functions. Upon opening an archive, the entire central + directory is located and read as-is into memory, and subsequent file access only occurs when reading individual files. + + - Archives file scanning: The simple way is to use this function to scan a loaded archive for a specific file: + + int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags); + + The locate operation can optionally check file comments too, which (as one example) can be used to identify + multiple versions of the same file in an archive. This function uses a simple linear search through the central + directory, so it's not very fast. + + Alternately, you can iterate through all the files in an archive (using mz_zip_reader_get_num_files()) and + retrieve detailed info on each file by calling mz_zip_reader_file_stat(). + + - Archive creation: Use the "mz_zip_writer" functions. The ZIP writer immediately writes compressed file data + to disk and builds an exact image of the central directory in memory. The central directory image is written + all at once at the end of the archive file when the archive is finalized. + + The archive writer can optionally align each file's local header and file data to any power of 2 alignment, + which can be useful when the archive will be read from optical media. Also, the writer supports placing + arbitrary data blobs at the very beginning of ZIP archives. Archives written using either feature are still + readable by any ZIP tool. + + - Archive appending: The simple way to add a single file to an archive is to call this function: + + mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, const char *pArchive_name, + const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags); + + The archive will be created if it doesn't already exist, otherwise it'll be appended to. + Note the appending is done in-place and is not an atomic operation, so if something goes wrong + during the operation it's possible the archive could be left without a central directory (although the local + file headers and file data will be fine, so the archive will be recoverable). + + For more complex archive modification scenarios: + 1. The safest way is to use a mz_zip_reader to read the existing archive, cloning only those bits you want to + preserve into a new archive using using the mz_zip_writer_add_from_zip_reader() function (which compiles the + compressed file data as-is). When you're done, delete the old archive and rename the newly written archive, and + you're done. This is safe but requires a bunch of temporary disk space or heap memory. + + 2. Or, you can convert an mz_zip_reader in-place to an mz_zip_writer using mz_zip_writer_init_from_reader(), + append new files as needed, then finalize the archive which will write an updated central directory to the + original archive. (This is basically what mz_zip_add_mem_to_archive_file_in_place() does.) There's a + possibility that the archive's central directory could be lost with this method if anything goes wrong, though. + + - ZIP archive support limitations: + No zip64 or spanning support. Extraction functions can only handle unencrypted, stored or deflated files. + Requires streams capable of seeking. + + * This is a header file library, like stb_image.c. To get only a header file, either cut and paste the + below header, or create miniz.h, #define MINIZ_HEADER_FILE_ONLY, and then include miniz.c from it. + + * Important: For best perf. be sure to customize the below macros for your target platform: + #define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1 + #define MINIZ_LITTLE_ENDIAN 1 + #define MINIZ_HAS_64BIT_REGISTERS 1 +*/ + +#ifndef MINIZ_HEADER_INCLUDED +#define MINIZ_HEADER_INCLUDED + +#include + +#if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_ARCHIVE_APIS) +#include +#endif + +// Defines to completely disable specific portions of miniz.c: +// If all macros here are defined the only functionality remaining will be CRC-32, adler-32, tinfl, and tdefl. + +// Define MINIZ_NO_STDIO to disable all usage and any functions which rely on stdio for file I/O. +//#define MINIZ_NO_STDIO + +// If MINIZ_NO_TIME is specified then the ZIP archive functions will not be able to get the current time, or +// get/set file times. +//#define MINIZ_NO_TIME + +// Define MINIZ_NO_ARCHIVE_APIS to disable all ZIP archive API's. +//#define MINIZ_NO_ARCHIVE_APIS + +// Define MINIZ_NO_ARCHIVE_APIS to disable all writing related ZIP archive API's. +//#define MINIZ_NO_ARCHIVE_WRITING_APIS + +// Define MINIZ_NO_ZLIB_APIS to remove all ZLIB-style compression/decompression API's. +//#define MINIZ_NO_ZLIB_APIS + +// Define MINIZ_NO_ZLIB_COMPATIBLE_NAME to disable zlib names, to prevent conflicts against stock zlib. +//#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES + +// Define MINIZ_NO_MALLOC to disable all calls to malloc, free, and realloc. +// Note if MINIZ_NO_MALLOC is defined then the user must always provide custom user alloc/free/realloc +// callbacks to the zlib and archive API's, and a few stand-alone helper API's which don't provide custom user +// functions (such as tdefl_compress_mem_to_heap() and tinfl_decompress_mem_to_heap()) won't work. +//#define MINIZ_NO_MALLOC + +#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || defined(__i486__) || defined(__i486) || defined(i386) || defined(__ia64__) || defined(__x86_64__) +// MINIZ_X86_OR_X64_CPU is only used to help set the below macros. +#define MINIZ_X86_OR_X64_CPU 1 +#endif + +#if (__BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__) || MINIZ_X86_OR_X64_CPU +// Set MINIZ_LITTLE_ENDIAN to 1 if the processor is little endian. +#define MINIZ_LITTLE_ENDIAN 1 +#endif + +#if MINIZ_X86_OR_X64_CPU +// Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient integer loads and stores from unaligned addresses. +#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1 +#endif + +#if defined(_M_X64) || defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) || defined(__ia64__) || defined(__x86_64__) +// Set MINIZ_HAS_64BIT_REGISTERS to 1 if operations on 64-bit integers are reasonably fast (and don't involve compiler generated calls to helper functions). +#define MINIZ_HAS_64BIT_REGISTERS 1 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// ------------------- zlib-style API Definitions. + +// For more compatibility with zlib, miniz.c uses unsigned long for some parameters/struct members. Beware: mz_ulong can be either 32 or 64-bits! +typedef unsigned long mz_ulong; + +// mz_free() internally uses the MZ_FREE() macro (which by default calls free() unless you've modified the MZ_MALLOC macro) to release a block allocated from the heap. +void mz_free(void *p); + +#define MZ_ADLER32_INIT (1) +// mz_adler32() returns the initial adler-32 value to use when called with ptr==NULL. +mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len); + +#define MZ_CRC32_INIT (0) +// mz_crc32() returns the initial CRC-32 value to use when called with ptr==NULL. +mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len); + +// Compression strategies. +enum { MZ_DEFAULT_STRATEGY = 0, MZ_FILTERED = 1, MZ_HUFFMAN_ONLY = 2, MZ_RLE = 3, MZ_FIXED = 4 }; + +// Method +#define MZ_DEFLATED 8 + +#ifndef MINIZ_NO_ZLIB_APIS + +// Heap allocation callbacks. +// Note that mz_alloc_func parameter types purpsosely differ from zlib's: items/size is size_t, not unsigned long. +typedef void *(*mz_alloc_func)(void *opaque, size_t items, size_t size); +typedef void (*mz_free_func)(void *opaque, void *address); +typedef void *(*mz_realloc_func)(void *opaque, void *address, size_t items, size_t size); + +#define MZ_VERSION "9.1.14" +#define MZ_VERNUM 0x91E0 +#define MZ_VER_MAJOR 9 +#define MZ_VER_MINOR 1 +#define MZ_VER_REVISION 14 +#define MZ_VER_SUBREVISION 0 + +// Flush values. For typical usage you only need MZ_NO_FLUSH and MZ_FINISH. The other values are for advanced use (refer to the zlib docs). +enum { MZ_NO_FLUSH = 0, MZ_PARTIAL_FLUSH = 1, MZ_SYNC_FLUSH = 2, MZ_FULL_FLUSH = 3, MZ_FINISH = 4, MZ_BLOCK = 5 }; + +// Return status codes. MZ_PARAM_ERROR is non-standard. +enum { MZ_OK = 0, MZ_STREAM_END = 1, MZ_NEED_DICT = 2, MZ_ERRNO = -1, MZ_STREAM_ERROR = -2, MZ_DATA_ERROR = -3, MZ_MEM_ERROR = -4, MZ_BUF_ERROR = -5, MZ_VERSION_ERROR = -6, MZ_PARAM_ERROR = -10000 }; + +// Compression levels: 0-9 are the standard zlib-style levels, 10 is best possible compression (not zlib compatible, and may be very slow), MZ_DEFAULT_COMPRESSION=MZ_DEFAULT_LEVEL. +enum { MZ_NO_COMPRESSION = 0, MZ_BEST_SPEED = 1, MZ_BEST_COMPRESSION = 9, MZ_UBER_COMPRESSION = 10, MZ_DEFAULT_LEVEL = 6, MZ_DEFAULT_COMPRESSION = -1 }; + +// Window bits +#define MZ_DEFAULT_WINDOW_BITS 15 + +struct mz_internal_state; + +// Compression/decompression stream struct. +typedef struct mz_stream_s +{ + const unsigned char *next_in; // pointer to next byte to read + unsigned int avail_in; // number of bytes available at next_in + mz_ulong total_in; // total number of bytes consumed so far + + unsigned char *next_out; // pointer to next byte to write + unsigned int avail_out; // number of bytes that can be written to next_out + mz_ulong total_out; // total number of bytes produced so far + + char *msg; // error msg (unused) + struct mz_internal_state *state; // internal state, allocated by zalloc/zfree + + mz_alloc_func zalloc; // optional heap allocation function (defaults to malloc) + mz_free_func zfree; // optional heap free function (defaults to free) + void *opaque; // heap alloc function user pointer + + int data_type; // data_type (unused) + mz_ulong adler; // adler32 of the source or uncompressed data + mz_ulong reserved; // not used +} mz_stream; + +typedef mz_stream *mz_streamp; + +// Returns the version string of miniz.c. +const char *mz_version(void); + +// mz_deflateInit() initializes a compressor with default options: +// Parameters: +// pStream must point to an initialized mz_stream struct. +// level must be between [MZ_NO_COMPRESSION, MZ_BEST_COMPRESSION]. +// level 1 enables a specially optimized compression function that's been optimized purely for performance, not ratio. +// (This special func. is currently only enabled when MINIZ_USE_UNALIGNED_LOADS_AND_STORES and MINIZ_LITTLE_ENDIAN are defined.) +// Return values: +// MZ_OK on success. +// MZ_STREAM_ERROR if the stream is bogus. +// MZ_PARAM_ERROR if the input parameters are bogus. +// MZ_MEM_ERROR on out of memory. +int mz_deflateInit(mz_streamp pStream, int level); + +// mz_deflateInit2() is like mz_deflate(), except with more control: +// Additional parameters: +// method must be MZ_DEFLATED +// window_bits must be MZ_DEFAULT_WINDOW_BITS (to wrap the deflate stream with zlib header/adler-32 footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate/no header or footer) +// mem_level must be between [1, 9] (it's checked but ignored by miniz.c) +int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy); + +// Quickly resets a compressor without having to reallocate anything. Same as calling mz_deflateEnd() followed by mz_deflateInit()/mz_deflateInit2(). +int mz_deflateReset(mz_streamp pStream); + +// mz_deflate() compresses the input to output, consuming as much of the input and producing as much output as possible. +// Parameters: +// pStream is the stream to read from and write to. You must initialize/update the next_in, avail_in, next_out, and avail_out members. +// flush may be MZ_NO_FLUSH, MZ_PARTIAL_FLUSH/MZ_SYNC_FLUSH, MZ_FULL_FLUSH, or MZ_FINISH. +// Return values: +// MZ_OK on success (when flushing, or if more input is needed but not available, and/or there's more output to be written but the output buffer is full). +// MZ_STREAM_END if all input has been consumed and all output bytes have been written. Don't call mz_deflate() on the stream anymore. +// MZ_STREAM_ERROR if the stream is bogus. +// MZ_PARAM_ERROR if one of the parameters is invalid. +// MZ_BUF_ERROR if no forward progress is possible because the input and/or output buffers are empty. (Fill up the input buffer or free up some output space and try again.) +int mz_deflate(mz_streamp pStream, int flush); + +// mz_deflateEnd() deinitializes a compressor: +// Return values: +// MZ_OK on success. +// MZ_STREAM_ERROR if the stream is bogus. +int mz_deflateEnd(mz_streamp pStream); + +// mz_deflateBound() returns a (very) conservative upper bound on the amount of data that could be generated by deflate(), assuming flush is set to only MZ_NO_FLUSH or MZ_FINISH. +mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len); + +// Single-call compression functions mz_compress() and mz_compress2(): +// Returns MZ_OK on success, or one of the error codes from mz_deflate() on failure. +int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len); +int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level); + +// mz_compressBound() returns a (very) conservative upper bound on the amount of data that could be generated by calling mz_compress(). +mz_ulong mz_compressBound(mz_ulong source_len); + +// Initializes a decompressor. +int mz_inflateInit(mz_streamp pStream); + +// mz_inflateInit2() is like mz_inflateInit() with an additional option that controls the window size and whether or not the stream has been wrapped with a zlib header/footer: +// window_bits must be MZ_DEFAULT_WINDOW_BITS (to parse zlib header/footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate). +int mz_inflateInit2(mz_streamp pStream, int window_bits); + +// Decompresses the input stream to the output, consuming only as much of the input as needed, and writing as much to the output as possible. +// Parameters: +// pStream is the stream to read from and write to. You must initialize/update the next_in, avail_in, next_out, and avail_out members. +// flush may be MZ_NO_FLUSH, MZ_SYNC_FLUSH, or MZ_FINISH. +// On the first call, if flush is MZ_FINISH it's assumed the input and output buffers are both sized large enough to decompress the entire stream in a single call (this is slightly faster). +// MZ_FINISH implies that there are no more source bytes available beside what's already in the input buffer, and that the output buffer is large enough to hold the rest of the decompressed data. +// Return values: +// MZ_OK on success. Either more input is needed but not available, and/or there's more output to be written but the output buffer is full. +// MZ_STREAM_END if all needed input has been consumed and all output bytes have been written. For zlib streams, the adler-32 of the decompressed data has also been verified. +// MZ_STREAM_ERROR if the stream is bogus. +// MZ_DATA_ERROR if the deflate stream is invalid. +// MZ_PARAM_ERROR if one of the parameters is invalid. +// MZ_BUF_ERROR if no forward progress is possible because the input buffer is empty but the inflater needs more input to continue, or if the output buffer is not large enough. Call mz_inflate() again +// with more input data, or with more room in the output buffer (except when using single call decompression, described above). +int mz_inflate(mz_streamp pStream, int flush); + +// Deinitializes a decompressor. +int mz_inflateEnd(mz_streamp pStream); + +// Single-call decompression. +// Returns MZ_OK on success, or one of the error codes from mz_inflate() on failure. +int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len); + +// Returns a string description of the specified error code, or NULL if the error code is invalid. +const char *mz_error(int err); + +// Redefine zlib-compatible names to miniz equivalents, so miniz.c can be used as a drop-in replacement for the subset of zlib that miniz.c supports. +// Define MINIZ_NO_ZLIB_COMPATIBLE_NAMES to disable zlib-compatibility if you use zlib in the same project. +#ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES + typedef unsigned char Byte; + typedef unsigned int uInt; + typedef mz_ulong uLong; + typedef Byte Bytef; + typedef uInt uIntf; + typedef char charf; + typedef int intf; + typedef void *voidpf; + typedef uLong uLongf; + typedef void *voidp; + typedef void *const voidpc; + #define Z_NULL 0 + #define Z_NO_FLUSH MZ_NO_FLUSH + #define Z_PARTIAL_FLUSH MZ_PARTIAL_FLUSH + #define Z_SYNC_FLUSH MZ_SYNC_FLUSH + #define Z_FULL_FLUSH MZ_FULL_FLUSH + #define Z_FINISH MZ_FINISH + #define Z_BLOCK MZ_BLOCK + #define Z_OK MZ_OK + #define Z_STREAM_END MZ_STREAM_END + #define Z_NEED_DICT MZ_NEED_DICT + #define Z_ERRNO MZ_ERRNO + #define Z_STREAM_ERROR MZ_STREAM_ERROR + #define Z_DATA_ERROR MZ_DATA_ERROR + #define Z_MEM_ERROR MZ_MEM_ERROR + #define Z_BUF_ERROR MZ_BUF_ERROR + #define Z_VERSION_ERROR MZ_VERSION_ERROR + #define Z_PARAM_ERROR MZ_PARAM_ERROR + #define Z_NO_COMPRESSION MZ_NO_COMPRESSION + #define Z_BEST_SPEED MZ_BEST_SPEED + #define Z_BEST_COMPRESSION MZ_BEST_COMPRESSION + #define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION + #define Z_DEFAULT_STRATEGY MZ_DEFAULT_STRATEGY + #define Z_FILTERED MZ_FILTERED + #define Z_HUFFMAN_ONLY MZ_HUFFMAN_ONLY + #define Z_RLE MZ_RLE + #define Z_FIXED MZ_FIXED + #define Z_DEFLATED MZ_DEFLATED + #define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS + #define alloc_func mz_alloc_func + #define free_func mz_free_func + #define internal_state mz_internal_state + #define z_stream mz_stream + #define deflateInit mz_deflateInit + #define deflateInit2 mz_deflateInit2 + #define deflateReset mz_deflateReset + #define deflate mz_deflate + #define deflateEnd mz_deflateEnd + #define deflateBound mz_deflateBound + #define compress mz_compress + #define compress2 mz_compress2 + #define compressBound mz_compressBound + #define inflateInit mz_inflateInit + #define inflateInit2 mz_inflateInit2 + #define inflate mz_inflate + #define inflateEnd mz_inflateEnd + #define uncompress mz_uncompress + #define crc32 mz_crc32 + #define adler32 mz_adler32 + #define MAX_WBITS 15 + #define MAX_MEM_LEVEL 9 + #define zError mz_error + #define ZLIB_VERSION MZ_VERSION + #define ZLIB_VERNUM MZ_VERNUM + #define ZLIB_VER_MAJOR MZ_VER_MAJOR + #define ZLIB_VER_MINOR MZ_VER_MINOR + #define ZLIB_VER_REVISION MZ_VER_REVISION + #define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION + #define zlibVersion mz_version + #define zlib_version mz_version() +#endif // #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES + +#endif // MINIZ_NO_ZLIB_APIS + +// ------------------- Types and macros + +typedef unsigned char mz_uint8; +typedef signed short mz_int16; +typedef unsigned short mz_uint16; +typedef unsigned int mz_uint32; +typedef unsigned int mz_uint; +typedef long long mz_int64; +typedef unsigned long long mz_uint64; +typedef int mz_bool; + +#define MZ_FALSE (0) +#define MZ_TRUE (1) + +// Works around MSVC's spammy "warning C4127: conditional expression is constant" message. +#ifdef _MSC_VER + #define MZ_MACRO_END while (0, 0) +#else + #define MZ_MACRO_END while (0) +#endif + +// ------------------- ZIP archive reading/writing + +#ifndef MINIZ_NO_ARCHIVE_APIS + +enum +{ + MZ_ZIP_MAX_IO_BUF_SIZE = 64*1024, + MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE = 260, + MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE = 256 +}; + +typedef struct +{ + mz_uint32 m_file_index; + mz_uint32 m_central_dir_ofs; + mz_uint16 m_version_made_by; + mz_uint16 m_version_needed; + mz_uint16 m_bit_flag; + mz_uint16 m_method; +#ifndef MINIZ_NO_TIME + time_t m_time; +#endif + mz_uint32 m_crc32; + mz_uint64 m_comp_size; + mz_uint64 m_uncomp_size; + mz_uint16 m_internal_attr; + mz_uint32 m_external_attr; + mz_uint64 m_local_header_ofs; + mz_uint32 m_comment_size; + char m_filename[MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE]; + char m_comment[MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE]; +} mz_zip_archive_file_stat; + +typedef size_t (*mz_file_read_func)(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n); +typedef size_t (*mz_file_write_func)(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n); + +struct mz_zip_internal_state_tag; +typedef struct mz_zip_internal_state_tag mz_zip_internal_state; + +typedef enum +{ + MZ_ZIP_MODE_INVALID = 0, + MZ_ZIP_MODE_READING = 1, + MZ_ZIP_MODE_WRITING = 2, + MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED = 3 +} mz_zip_mode; + +typedef struct +{ + mz_uint64 m_archive_size; + mz_uint64 m_central_directory_file_ofs; + mz_uint m_total_files; + mz_zip_mode m_zip_mode; + + mz_uint m_file_offset_alignment; + + mz_alloc_func m_pAlloc; + mz_free_func m_pFree; + mz_realloc_func m_pRealloc; + void *m_pAlloc_opaque; + + mz_file_read_func m_pRead; + mz_file_write_func m_pWrite; + void *m_pIO_opaque; + + mz_zip_internal_state *m_pState; + +} mz_zip_archive; + +typedef enum +{ + MZ_ZIP_FLAG_CASE_SENSITIVE = 0x0100, + MZ_ZIP_FLAG_IGNORE_PATH = 0x0200, + MZ_ZIP_FLAG_COMPRESSED_DATA = 0x0400, + MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY = 0x0800 +} mz_zip_flags; + +// ZIP archive reading + +// Inits a ZIP archive reader. +// These functions read and validate the archive's central directory. +mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, mz_uint32 flags); +mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint32 flags); + +#ifndef MINIZ_NO_STDIO +mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint32 flags); +#endif + +// Returns the total number of files in the archive. +mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip); + +// Returns detailed information about an archive file entry. +mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat *pStat); + +// Determines if an archive file entry is a directory entry. +mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, mz_uint file_index); +mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, mz_uint file_index); + +// Retrieves the filename of an archive file entry. +// Returns the number of bytes written to pFilename, or if filename_buf_size is 0 this function returns the number of bytes needed to fully store the filename. +mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_uint filename_buf_size); + +// Attempts to locates a file in the archive's central directory. +// Valid flags: MZ_ZIP_FLAG_CASE_SENSITIVE, MZ_ZIP_FLAG_IGNORE_PATH +// Returns -1 if the file cannot be found. +int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags); + +// Extracts a archive file to a memory buffer using no memory allocation. +mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size); +mz_bool mz_zip_reader_extract_file_to_mem_no_alloc(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size); + +// Extracts a archive file to a memory buffer. +mz_bool mz_zip_reader_extract_to_mem(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags); +mz_bool mz_zip_reader_extract_file_to_mem(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags); + +// Extracts a archive file to a dynamically allocated heap buffer. +void *mz_zip_reader_extract_to_heap(mz_zip_archive *pZip, mz_uint file_index, size_t *pSize, mz_uint flags); +void *mz_zip_reader_extract_file_to_heap(mz_zip_archive *pZip, const char *pFilename, size_t *pSize, mz_uint flags); + +// Extracts a archive file using a callback function to output the file's data. +mz_bool mz_zip_reader_extract_to_callback(mz_zip_archive *pZip, mz_uint file_index, mz_file_write_func pCallback, void *pOpaque, mz_uint flags); +mz_bool mz_zip_reader_extract_file_to_callback(mz_zip_archive *pZip, const char *pFilename, mz_file_write_func pCallback, void *pOpaque, mz_uint flags); + +#ifndef MINIZ_NO_STDIO +// Extracts a archive file to a disk file and sets its last accessed and modified times. +// This function only extracts files, not archive directory records. +mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index, const char *pDst_filename, mz_uint flags); +mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, const char *pArchive_filename, const char *pDst_filename, mz_uint flags); +#endif + +// Ends archive reading, freeing all allocations, and closing the input archive file if mz_zip_reader_init_file() was used. +mz_bool mz_zip_reader_end(mz_zip_archive *pZip); + +// ZIP archive writing + +#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS + +// Inits a ZIP archive writer. +mz_bool mz_zip_writer_init(mz_zip_archive *pZip, mz_uint64 existing_size); +mz_bool mz_zip_writer_init_heap(mz_zip_archive *pZip, size_t size_to_reserve_at_beginning, size_t initial_allocation_size); + +#ifndef MINIZ_NO_STDIO +mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_reserve_at_beginning); +#endif + +// Converts a ZIP archive reader object into a writer object, to allow efficient in-place file appends to occur on an existing archive. +// For archives opened using mz_zip_reader_init_file, pFilename must be the archive's filename so it can be reopened for writing. If the file can't be reopened, mz_zip_reader_end() will be called. +// For archives opened using mz_zip_reader_init_mem, the memory block must be growable using the realloc callback (which defaults to realloc unless you've overridden it). +// Finally, for archives opened using mz_zip_reader_init, the mz_zip_archive's user provided m_pWrite function cannot be NULL. +// Note: In-place archive modification is not recommended unless you know what you're doing, because if execution stops or something goes wrong before +// the archive is finalized the file's central directory will be hosed. +mz_bool mz_zip_writer_init_from_reader(mz_zip_archive *pZip, const char *pFilename); + +// Adds the contents of a memory buffer to an archive. These functions record the current local time into the archive. +// To add a directory entry, call this method with an archive name ending in a forwardslash with empty buffer. +// level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION. +mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, mz_uint level_and_flags); +mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, mz_uint64 uncomp_size, mz_uint32 uncomp_crc32); + +#ifndef MINIZ_NO_STDIO +// Adds the contents of a disk file to an archive. This function also records the disk file's modified time into the archive. +// level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION. +mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, const char *pSrc_filename, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags); +#endif + +// Adds a file to an archive by fully cloning the data from another archive. +// This function fully clones the source file's compressed data (no recompression), along with its full filename, extra data, and comment fields. +mz_bool mz_zip_writer_add_from_zip_reader(mz_zip_archive *pZip, mz_zip_archive *pSource_zip, mz_uint file_index); + +// Finalizes the archive by writing the central directory records followed by the end of central directory record. +// After an archive is finalized, the only valid call on the mz_zip_archive struct is mz_zip_writer_end(). +// An archive must be manually finalized by calling this function for it to be valid. +mz_bool mz_zip_writer_finalize_archive(mz_zip_archive *pZip); +mz_bool mz_zip_writer_finalize_heap_archive(mz_zip_archive *pZip, void **pBuf, size_t *pSize); + +// Ends archive writing, freeing all allocations, and closing the output file if mz_zip_writer_init_file() was used. +// Note for the archive to be valid, it must have been finalized before ending. +mz_bool mz_zip_writer_end(mz_zip_archive *pZip); + +// Misc. high-level helper functions: + +// mz_zip_add_mem_to_archive_file_in_place() efficiently (but not atomically) appends a memory blob to a ZIP archive. +// level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION. +mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags); + +// Reads a single file from an archive into a heap block. +// Returns NULL on failure. +void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char *pArchive_name, size_t *pSize, mz_uint zip_flags); + +#endif // #ifndef MINIZ_NO_ARCHIVE_WRITING_APIS + +#endif // #ifndef MINIZ_NO_ARCHIVE_APIS + +// ------------------- Low-level Decompression API Definitions + +// Decompression flags used by tinfl_decompress(). +// TINFL_FLAG_PARSE_ZLIB_HEADER: If set, the input has a valid zlib header and ends with an adler32 checksum (it's a valid zlib stream). Otherwise, the input is a raw deflate stream. +// TINFL_FLAG_HAS_MORE_INPUT: If set, there are more input bytes available beyond the end of the supplied input buffer. If clear, the input buffer contains all remaining input. +// TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF: If set, the output buffer is large enough to hold the entire decompressed stream. If clear, the output buffer is at least the size of the dictionary (typically 32KB). +// TINFL_FLAG_COMPUTE_ADLER32: Force adler-32 checksum computation of the decompressed bytes. +enum +{ + TINFL_FLAG_PARSE_ZLIB_HEADER = 1, + TINFL_FLAG_HAS_MORE_INPUT = 2, + TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF = 4, + TINFL_FLAG_COMPUTE_ADLER32 = 8 +}; + +// High level decompression functions: +// tinfl_decompress_mem_to_heap() decompresses a block in memory to a heap block allocated via malloc(). +// On entry: +// pSrc_buf, src_buf_len: Pointer and size of the Deflate or zlib source data to decompress. +// On return: +// Function returns a pointer to the decompressed data, or NULL on failure. +// *pOut_len will be set to the decompressed data's size, which could be larger than src_buf_len on uncompressible data. +// The caller must call mz_free() on the returned block when it's no longer needed. +void *tinfl_decompress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags); + +// tinfl_decompress_mem_to_mem() decompresses a block in memory to another block in memory. +// Returns TINFL_DECOMPRESS_MEM_TO_MEM_FAILED on failure, or the number of bytes written on success. +#define TINFL_DECOMPRESS_MEM_TO_MEM_FAILED ((size_t)(-1)) +size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags); + +// tinfl_decompress_mem_to_callback() decompresses a block in memory to an internal 32KB buffer, and a user provided callback function will be called to flush the buffer. +// Returns 1 on success or 0 on failure. +typedef int (*tinfl_put_buf_func_ptr)(const void* pBuf, int len, void *pUser); +int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size, tinfl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags); + +struct tinfl_decompressor_tag; typedef struct tinfl_decompressor_tag tinfl_decompressor; + +// Max size of LZ dictionary. +#define TINFL_LZ_DICT_SIZE 32768 + +// Return status. +typedef enum +{ + TINFL_STATUS_BAD_PARAM = -3, + TINFL_STATUS_ADLER32_MISMATCH = -2, + TINFL_STATUS_FAILED = -1, + TINFL_STATUS_DONE = 0, + TINFL_STATUS_NEEDS_MORE_INPUT = 1, + TINFL_STATUS_HAS_MORE_OUTPUT = 2 +} tinfl_status; + +// Initializes the decompressor to its initial state. +#define tinfl_init(r) do { (r)->m_state = 0; } MZ_MACRO_END +#define tinfl_get_adler32(r) (r)->m_check_adler32 + +// Main low-level decompressor coroutine function. This is the only function actually needed for decompression. All the other functions are just high-level helpers for improved usability. +// This is a universal API, i.e. it can be used as a building block to build any desired higher level decompression API. In the limit case, it can be called once per every byte input or output. +tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags); + +// Internal/private bits follow. +enum +{ + TINFL_MAX_HUFF_TABLES = 3, TINFL_MAX_HUFF_SYMBOLS_0 = 288, TINFL_MAX_HUFF_SYMBOLS_1 = 32, TINFL_MAX_HUFF_SYMBOLS_2 = 19, + TINFL_FAST_LOOKUP_BITS = 10, TINFL_FAST_LOOKUP_SIZE = 1 << TINFL_FAST_LOOKUP_BITS +}; + +typedef struct +{ + mz_uint8 m_code_size[TINFL_MAX_HUFF_SYMBOLS_0]; + mz_int16 m_look_up[TINFL_FAST_LOOKUP_SIZE], m_tree[TINFL_MAX_HUFF_SYMBOLS_0 * 2]; +} tinfl_huff_table; + +#if MINIZ_HAS_64BIT_REGISTERS + #define TINFL_USE_64BIT_BITBUF 1 +#endif + +#if TINFL_USE_64BIT_BITBUF + typedef mz_uint64 tinfl_bit_buf_t; + #define TINFL_BITBUF_SIZE (64) +#else + typedef mz_uint32 tinfl_bit_buf_t; + #define TINFL_BITBUF_SIZE (32) +#endif + +struct tinfl_decompressor_tag +{ + mz_uint32 m_state, m_num_bits, m_zhdr0, m_zhdr1, m_z_adler32, m_final, m_type, m_check_adler32, m_dist, m_counter, m_num_extra, m_table_sizes[TINFL_MAX_HUFF_TABLES]; + tinfl_bit_buf_t m_bit_buf; + size_t m_dist_from_out_buf_start; + tinfl_huff_table m_tables[TINFL_MAX_HUFF_TABLES]; + mz_uint8 m_raw_header[4], m_len_codes[TINFL_MAX_HUFF_SYMBOLS_0 + TINFL_MAX_HUFF_SYMBOLS_1 + 137]; +}; + +// ------------------- Low-level Compression API Definitions + +// Set TDEFL_LESS_MEMORY to 1 to use less memory (compression will be slightly slower, and raw/dynamic blocks will be output more frequently). +#define TDEFL_LESS_MEMORY 0 + +// tdefl_init() compression flags logically OR'd together (low 12 bits contain the max. number of probes per dictionary search): +// TDEFL_DEFAULT_MAX_PROBES: The compressor defaults to 128 dictionary probes per dictionary search. 0=Huffman only, 1=Huffman+LZ (fastest/crap compression), 4095=Huffman+LZ (slowest/best compression). +enum +{ + TDEFL_HUFFMAN_ONLY = 0, TDEFL_DEFAULT_MAX_PROBES = 128, TDEFL_MAX_PROBES_MASK = 0xFFF +}; + +// TDEFL_WRITE_ZLIB_HEADER: If set, the compressor outputs a zlib header before the deflate data, and the Adler-32 of the source data at the end. Otherwise, you'll get raw deflate data. +// TDEFL_COMPUTE_ADLER32: Always compute the adler-32 of the input data (even when not writing zlib headers). +// TDEFL_GREEDY_PARSING_FLAG: Set to use faster greedy parsing, instead of more efficient lazy parsing. +// TDEFL_NONDETERMINISTIC_PARSING_FLAG: Enable to decrease the compressor's initialization time to the minimum, but the output may vary from run to run given the same input (depending on the contents of memory). +// TDEFL_RLE_MATCHES: Only look for RLE matches (matches with a distance of 1) +// TDEFL_FILTER_MATCHES: Discards matches <= 5 chars if enabled. +// TDEFL_FORCE_ALL_STATIC_BLOCKS: Disable usage of optimized Huffman tables. +// TDEFL_FORCE_ALL_RAW_BLOCKS: Only use raw (uncompressed) deflate blocks. +enum +{ + TDEFL_WRITE_ZLIB_HEADER = 0x01000, + TDEFL_COMPUTE_ADLER32 = 0x02000, + TDEFL_GREEDY_PARSING_FLAG = 0x04000, + TDEFL_NONDETERMINISTIC_PARSING_FLAG = 0x08000, + TDEFL_RLE_MATCHES = 0x10000, + TDEFL_FILTER_MATCHES = 0x20000, + TDEFL_FORCE_ALL_STATIC_BLOCKS = 0x40000, + TDEFL_FORCE_ALL_RAW_BLOCKS = 0x80000 +}; + +// High level compression functions: +// tdefl_compress_mem_to_heap() compresses a block in memory to a heap block allocated via malloc(). +// On entry: +// pSrc_buf, src_buf_len: Pointer and size of source block to compress. +// flags: The max match finder probes (default is 128) logically OR'd against the above flags. Higher probes are slower but improve compression. +// On return: +// Function returns a pointer to the compressed data, or NULL on failure. +// *pOut_len will be set to the compressed data's size, which could be larger than src_buf_len on uncompressible data. +// The caller must free() the returned block when it's no longer needed. +void *tdefl_compress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags); + +// tdefl_compress_mem_to_mem() compresses a block in memory to another block in memory. +// Returns 0 on failure. +size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags); + +// Compresses an image to a compressed PNG file in memory. +// On entry: +// pImage, w, h, and num_chans describe the image to compress. num_chans may be 1, 2, 3, or 4. +// The image pitch in bytes per scanline will be w*num_chans. The leftmost pixel on the top scanline is stored first in memory. +// On return: +// Function returns a pointer to the compressed data, or NULL on failure. +// *pLen_out will be set to the size of the PNG image file. +// The caller must mz_free() the returned heap block (which will typically be larger than *pLen_out) when it's no longer needed. +void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, int num_chans, size_t *pLen_out); + +// Output stream interface. The compressor uses this interface to write compressed data. It'll typically be called TDEFL_OUT_BUF_SIZE at a time. +typedef mz_bool (*tdefl_put_buf_func_ptr)(const void* pBuf, int len, void *pUser); + +// tdefl_compress_mem_to_output() compresses a block to an output stream. The above helpers use this function internally. +mz_bool tdefl_compress_mem_to_output(const void *pBuf, size_t buf_len, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags); + +enum { TDEFL_MAX_HUFF_TABLES = 3, TDEFL_MAX_HUFF_SYMBOLS_0 = 288, TDEFL_MAX_HUFF_SYMBOLS_1 = 32, TDEFL_MAX_HUFF_SYMBOLS_2 = 19, TDEFL_LZ_DICT_SIZE = 32768, TDEFL_LZ_DICT_SIZE_MASK = TDEFL_LZ_DICT_SIZE - 1, TDEFL_MIN_MATCH_LEN = 3, TDEFL_MAX_MATCH_LEN = 258 }; + +// TDEFL_OUT_BUF_SIZE MUST be large enough to hold a single entire compressed output block (using static/fixed Huffman codes). +#if TDEFL_LESS_MEMORY +enum { TDEFL_LZ_CODE_BUF_SIZE = 24 * 1024, TDEFL_OUT_BUF_SIZE = (TDEFL_LZ_CODE_BUF_SIZE * 13 ) / 10, TDEFL_MAX_HUFF_SYMBOLS = 288, TDEFL_LZ_HASH_BITS = 12, TDEFL_LEVEL1_HASH_SIZE_MASK = 4095, TDEFL_LZ_HASH_SHIFT = (TDEFL_LZ_HASH_BITS + 2) / 3, TDEFL_LZ_HASH_SIZE = 1 << TDEFL_LZ_HASH_BITS }; +#else +enum { TDEFL_LZ_CODE_BUF_SIZE = 64 * 1024, TDEFL_OUT_BUF_SIZE = (TDEFL_LZ_CODE_BUF_SIZE * 13 ) / 10, TDEFL_MAX_HUFF_SYMBOLS = 288, TDEFL_LZ_HASH_BITS = 15, TDEFL_LEVEL1_HASH_SIZE_MASK = 4095, TDEFL_LZ_HASH_SHIFT = (TDEFL_LZ_HASH_BITS + 2) / 3, TDEFL_LZ_HASH_SIZE = 1 << TDEFL_LZ_HASH_BITS }; +#endif + +// The low-level tdefl functions below may be used directly if the above helper functions aren't flexible enough. The low-level functions don't make any heap allocations, unlike the above helper functions. +typedef enum +{ + TDEFL_STATUS_BAD_PARAM = -2, + TDEFL_STATUS_PUT_BUF_FAILED = -1, + TDEFL_STATUS_OKAY = 0, + TDEFL_STATUS_DONE = 1, +} tdefl_status; + +// Must map to MZ_NO_FLUSH, MZ_SYNC_FLUSH, etc. enums +typedef enum +{ + TDEFL_NO_FLUSH = 0, + TDEFL_SYNC_FLUSH = 2, + TDEFL_FULL_FLUSH = 3, + TDEFL_FINISH = 4 +} tdefl_flush; + +// tdefl's compression state structure. +struct tdefl_compressor +{ + tdefl_put_buf_func_ptr m_pPut_buf_func; + void *m_pPut_buf_user; + mz_uint m_flags, m_max_probes[2]; + int m_greedy_parsing; + mz_uint m_adler32, m_lookahead_pos, m_lookahead_size, m_dict_size; + mz_uint8 *m_pLZ_code_buf, *m_pLZ_flags, *m_pOutput_buf, *m_pOutput_buf_end; + mz_uint m_num_flags_left, m_total_lz_bytes, m_lz_code_buf_dict_pos, m_bits_in, m_bit_buffer; + mz_uint m_saved_match_dist, m_saved_match_len, m_saved_lit, m_output_flush_ofs, m_output_flush_remaining, m_finished, m_block_index, m_wants_to_finish; + tdefl_status m_prev_return_status; + const void *m_pIn_buf; + void *m_pOut_buf; + size_t *m_pIn_buf_size, *m_pOut_buf_size; + tdefl_flush m_flush; + const mz_uint8 *m_pSrc; + size_t m_src_buf_left, m_out_buf_ofs; + mz_uint8 m_dict[TDEFL_LZ_DICT_SIZE + TDEFL_MAX_MATCH_LEN - 1]; + mz_uint16 m_huff_count[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; + mz_uint16 m_huff_codes[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; + mz_uint8 m_huff_code_sizes[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; + mz_uint8 m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE]; + mz_uint16 m_next[TDEFL_LZ_DICT_SIZE]; + mz_uint16 m_hash[TDEFL_LZ_HASH_SIZE]; + mz_uint8 m_output_buf[TDEFL_OUT_BUF_SIZE]; +}; + +// Initializes the compressor. +// There is no corresponding deinit() function because the tdefl API's do not dynamically allocate memory. +// pBut_buf_func: If NULL, output data will be supplied to the specified callback. In this case, the user should call the tdefl_compress_buffer() API for compression. +// If pBut_buf_func is NULL the user should always call the tdefl_compress() API. +// flags: See the above enums (TDEFL_HUFFMAN_ONLY, TDEFL_WRITE_ZLIB_HEADER, etc.) +tdefl_status tdefl_init(tdefl_compressor *d, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags); + +// Compresses a block of data, consuming as much of the specified input buffer as possible, and writing as much compressed data to the specified output buffer as possible. +tdefl_status tdefl_compress(tdefl_compressor *d, const void *pIn_buf, size_t *pIn_buf_size, void *pOut_buf, size_t *pOut_buf_size, tdefl_flush flush); + +// tdefl_compress_buffer() is only usable when the tdefl_init() is called with a non-NULL tdefl_put_buf_func_ptr. +// tdefl_compress_buffer() always consumes the entire input buffer. +tdefl_status tdefl_compress_buffer(tdefl_compressor *d, const void *pIn_buf, size_t in_buf_size, tdefl_flush flush); + +tdefl_status tdefl_get_prev_return_status(tdefl_compressor *d); +mz_uint32 tdefl_get_adler32(tdefl_compressor *d); + +// Can't use tdefl_create_comp_flags_from_zip_params if MINIZ_NO_ZLIB_APIS isn't defined, because it uses some of its macros. +#ifndef MINIZ_NO_ZLIB_APIS +// Create tdefl_compress() flags given zlib-style compression parameters. +// level may range from [0,10] (where 10 is absolute max compression, but may be much slower on some files) +// window_bits may be -15 (raw deflate) or 15 (zlib) +// strategy may be either MZ_DEFAULT_STRATEGY, MZ_FILTERED, MZ_HUFFMAN_ONLY, MZ_RLE, or MZ_FIXED +mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, int strategy); +#endif // #ifndef MINIZ_NO_ZLIB_APIS + +#ifdef __cplusplus +} +#endif + +#endif // MINIZ_HEADER_INCLUDED + +// ------------------- End of Header: Implementation follows. (If you only want the header, define MINIZ_HEADER_FILE_ONLY.) + +#ifndef MINIZ_HEADER_FILE_ONLY + +typedef unsigned char mz_validate_uint16[sizeof(mz_uint16)==2 ? 1 : -1]; +typedef unsigned char mz_validate_uint32[sizeof(mz_uint32)==4 ? 1 : -1]; +typedef unsigned char mz_validate_uint64[sizeof(mz_uint64)==8 ? 1 : -1]; + +#include +#include + +#define MZ_ASSERT(x) assert(x) + +#ifdef MINIZ_NO_MALLOC + #define MZ_MALLOC(x) NULL + #define MZ_FREE(x) (void)x, ((void)0) + #define MZ_REALLOC(p, x) NULL +#else + #define MZ_MALLOC(x) malloc(x) + #define MZ_FREE(x) free(x) + #define MZ_REALLOC(p, x) realloc(p, x) +#endif + +#define MZ_MAX(a,b) (((a)>(b))?(a):(b)) +#define MZ_MIN(a,b) (((a)<(b))?(a):(b)) +#define MZ_CLEAR_OBJ(obj) memset(&(obj), 0, sizeof(obj)) + +#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN + #define MZ_READ_LE16(p) *((const mz_uint16 *)(p)) + #define MZ_READ_LE32(p) *((const mz_uint32 *)(p)) +#else + #define MZ_READ_LE16(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U)) + #define MZ_READ_LE32(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U) | ((mz_uint32)(((const mz_uint8 *)(p))[2]) << 16U) | ((mz_uint32)(((const mz_uint8 *)(p))[3]) << 24U)) +#endif + +#ifdef _MSC_VER + #define MZ_FORCEINLINE __forceinline +#elif defined(__GNUC__) + #define MZ_FORCEINLINE __attribute__((__always_inline__)) +#else + #define MZ_FORCEINLINE +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +// ------------------- zlib-style API's + +mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len) +{ + mz_uint32 i, s1 = (mz_uint32)(adler & 0xffff), s2 = (mz_uint32)(adler >> 16); size_t block_len = buf_len % 5552; + if (!ptr) return MZ_ADLER32_INIT; + while (buf_len) { + for (i = 0; i + 7 < block_len; i += 8, ptr += 8) { + s1 += ptr[0], s2 += s1; s1 += ptr[1], s2 += s1; s1 += ptr[2], s2 += s1; s1 += ptr[3], s2 += s1; + s1 += ptr[4], s2 += s1; s1 += ptr[5], s2 += s1; s1 += ptr[6], s2 += s1; s1 += ptr[7], s2 += s1; + } + for ( ; i < block_len; ++i) s1 += *ptr++, s2 += s1; + s1 %= 65521U, s2 %= 65521U; buf_len -= block_len; block_len = 5552; + } + return (s2 << 16) + s1; +} + +// Karl Malbrain's compact CRC-32. See "A compact CCITT crc16 and crc32 C implementation that balances processor cache usage against speed": http://www.geocities.com/malbrain/ +mz_ulong mz_crc32(mz_ulong crc, const mz_uint8 *ptr, size_t buf_len) +{ + static const mz_uint32 s_crc32[16] = { 0, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c, + 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c }; + mz_uint32 crcu32 = (mz_uint32)crc; + if (!ptr) return MZ_CRC32_INIT; + crcu32 = ~crcu32; while (buf_len--) { mz_uint8 b = *ptr++; crcu32 = (crcu32 >> 4) ^ s_crc32[(crcu32 & 0xF) ^ (b & 0xF)]; crcu32 = (crcu32 >> 4) ^ s_crc32[(crcu32 & 0xF) ^ (b >> 4)]; } + return ~crcu32; +} + +void mz_free(void *p) +{ + MZ_FREE(p); +} + +#ifndef MINIZ_NO_ZLIB_APIS + +static void *def_alloc_func(void *opaque, size_t items, size_t size) { (void)opaque, (void)items, (void)size; return MZ_MALLOC(items * size); } +static void def_free_func(void *opaque, void *address) { (void)opaque, (void)address; MZ_FREE(address); } +//static void *def_realloc_func(void *opaque, void *address, size_t items, size_t size) { (void)opaque, (void)address, (void)items, (void)size; return MZ_REALLOC(address, items * size); } + +const char *mz_version(void) +{ + return MZ_VERSION; +} + +int mz_deflateInit(mz_streamp pStream, int level) +{ + return mz_deflateInit2(pStream, level, MZ_DEFLATED, MZ_DEFAULT_WINDOW_BITS, 9, MZ_DEFAULT_STRATEGY); +} + +int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy) +{ + tdefl_compressor *pComp; + mz_uint comp_flags = TDEFL_COMPUTE_ADLER32 | tdefl_create_comp_flags_from_zip_params(level, window_bits, strategy); + + if (!pStream) return MZ_STREAM_ERROR; + if ((method != MZ_DEFLATED) || ((mem_level < 1) || (mem_level > 9)) || ((window_bits != MZ_DEFAULT_WINDOW_BITS) && (-window_bits != MZ_DEFAULT_WINDOW_BITS))) return MZ_PARAM_ERROR; + + pStream->data_type = 0; + pStream->adler = MZ_ADLER32_INIT; + pStream->msg = NULL; + pStream->reserved = 0; + pStream->total_in = 0; + pStream->total_out = 0; + if (!pStream->zalloc) pStream->zalloc = def_alloc_func; + if (!pStream->zfree) pStream->zfree = def_free_func; + + pComp = (tdefl_compressor *)pStream->zalloc(pStream->opaque, 1, sizeof(tdefl_compressor)); + if (!pComp) + return MZ_MEM_ERROR; + + pStream->state = (struct mz_internal_state *)pComp; + + if (tdefl_init(pComp, NULL, NULL, comp_flags) != TDEFL_STATUS_OKAY) + { + mz_deflateEnd(pStream); + return MZ_PARAM_ERROR; + } + + return MZ_OK; +} + +int mz_deflateReset(mz_streamp pStream) +{ + if ((!pStream) || (!pStream->state) || (!pStream->zalloc) || (!pStream->zfree)) return MZ_STREAM_ERROR; + pStream->total_in = pStream->total_out = 0; + tdefl_init((tdefl_compressor*)pStream->state, NULL, NULL, ((tdefl_compressor*)pStream->state)->m_flags); + return MZ_OK; +} + +int mz_deflate(mz_streamp pStream, int flush) +{ + size_t in_bytes, out_bytes; + mz_ulong orig_total_in, orig_total_out; + int mz_status = MZ_OK; + + if ((!pStream) || (!pStream->state) || (flush < 0) || (flush > MZ_FINISH) || (!pStream->next_out)) return MZ_STREAM_ERROR; + if (!pStream->avail_out) return MZ_BUF_ERROR; + + if (flush == MZ_PARTIAL_FLUSH) flush = MZ_SYNC_FLUSH; + + if (((tdefl_compressor*)pStream->state)->m_prev_return_status == TDEFL_STATUS_DONE) + return (flush == MZ_FINISH) ? MZ_STREAM_END : MZ_BUF_ERROR; + + orig_total_in = pStream->total_in; orig_total_out = pStream->total_out; + for ( ; ; ) + { + tdefl_status defl_status; + in_bytes = pStream->avail_in; out_bytes = pStream->avail_out; + + defl_status = tdefl_compress((tdefl_compressor*)pStream->state, pStream->next_in, &in_bytes, pStream->next_out, &out_bytes, (tdefl_flush)flush); + pStream->next_in += (mz_uint)in_bytes; pStream->avail_in -= (mz_uint)in_bytes; + pStream->total_in += (mz_uint)in_bytes; pStream->adler = tdefl_get_adler32((tdefl_compressor*)pStream->state); + + pStream->next_out += (mz_uint)out_bytes; pStream->avail_out -= (mz_uint)out_bytes; + pStream->total_out += (mz_uint)out_bytes; + + if (defl_status < 0) + { + mz_status = MZ_STREAM_ERROR; + break; + } + else if (defl_status == TDEFL_STATUS_DONE) + { + mz_status = MZ_STREAM_END; + break; + } + else if (!pStream->avail_out) + break; + else if ((!pStream->avail_in) && (flush != MZ_FINISH)) + { + if ((flush) || (pStream->total_in != orig_total_in) || (pStream->total_out != orig_total_out)) + break; + return MZ_BUF_ERROR; // Can't make forward progress without some input. + } + } + return mz_status; +} + +int mz_deflateEnd(mz_streamp pStream) +{ + if (!pStream) return MZ_STREAM_ERROR; + if (pStream->state) + { + pStream->zfree(pStream->opaque, pStream->state); + pStream->state = NULL; + } + return MZ_OK; +} + +mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len) +{ + (void)pStream; + // This is really over conservative. (And lame, but it's actually pretty tricky to compute a true upper bound given the way tdefl's blocking works.) + return MZ_MAX(128 + (source_len * 110) / 100, 128 + source_len + ((source_len / (31 * 1024)) + 1) * 5); +} + +int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level) +{ + int status; + mz_stream stream; + memset(&stream, 0, sizeof(stream)); + + // In case mz_ulong is 64-bits (argh I hate longs). + if ((source_len | *pDest_len) > 0xFFFFFFFFU) return MZ_PARAM_ERROR; + + stream.next_in = pSource; + stream.avail_in = (mz_uint32)source_len; + stream.next_out = pDest; + stream.avail_out = (mz_uint32)*pDest_len; + + status = mz_deflateInit(&stream, level); + if (status != MZ_OK) return status; + + status = mz_deflate(&stream, MZ_FINISH); + if (status != MZ_STREAM_END) + { + mz_deflateEnd(&stream); + return (status == MZ_OK) ? MZ_BUF_ERROR : status; + } + + *pDest_len = stream.total_out; + return mz_deflateEnd(&stream); +} + +int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len) +{ + return mz_compress2(pDest, pDest_len, pSource, source_len, MZ_DEFAULT_COMPRESSION); +} + +mz_ulong mz_compressBound(mz_ulong source_len) +{ + return mz_deflateBound(NULL, source_len); +} + +typedef struct +{ + tinfl_decompressor m_decomp; + mz_uint m_dict_ofs, m_dict_avail, m_first_call, m_has_flushed; int m_window_bits; + mz_uint8 m_dict[TINFL_LZ_DICT_SIZE]; + tinfl_status m_last_status; +} inflate_state; + +int mz_inflateInit2(mz_streamp pStream, int window_bits) +{ + inflate_state *pDecomp; + if (!pStream) return MZ_STREAM_ERROR; + if ((window_bits != MZ_DEFAULT_WINDOW_BITS) && (-window_bits != MZ_DEFAULT_WINDOW_BITS)) return MZ_PARAM_ERROR; + + pStream->data_type = 0; + pStream->adler = 0; + pStream->msg = NULL; + pStream->total_in = 0; + pStream->total_out = 0; + pStream->reserved = 0; + if (!pStream->zalloc) pStream->zalloc = def_alloc_func; + if (!pStream->zfree) pStream->zfree = def_free_func; + + pDecomp = (inflate_state*)pStream->zalloc(pStream->opaque, 1, sizeof(inflate_state)); + if (!pDecomp) return MZ_MEM_ERROR; + + pStream->state = (struct mz_internal_state *)pDecomp; + + tinfl_init(&pDecomp->m_decomp); + pDecomp->m_dict_ofs = 0; + pDecomp->m_dict_avail = 0; + pDecomp->m_last_status = TINFL_STATUS_NEEDS_MORE_INPUT; + pDecomp->m_first_call = 1; + pDecomp->m_has_flushed = 0; + pDecomp->m_window_bits = window_bits; + + return MZ_OK; +} + +int mz_inflateInit(mz_streamp pStream) +{ + return mz_inflateInit2(pStream, MZ_DEFAULT_WINDOW_BITS); +} + +int mz_inflate(mz_streamp pStream, int flush) +{ + inflate_state* pState; + mz_uint n, first_call, decomp_flags = TINFL_FLAG_COMPUTE_ADLER32; + size_t in_bytes, out_bytes, orig_avail_in; + tinfl_status status; + + if ((!pStream) || (!pStream->state)) return MZ_STREAM_ERROR; + if (flush == MZ_PARTIAL_FLUSH) flush = MZ_SYNC_FLUSH; + if ((flush) && (flush != MZ_SYNC_FLUSH) && (flush != MZ_FINISH)) return MZ_STREAM_ERROR; + + pState = (inflate_state*)pStream->state; + if (pState->m_window_bits > 0) decomp_flags |= TINFL_FLAG_PARSE_ZLIB_HEADER; + orig_avail_in = pStream->avail_in; + + first_call = pState->m_first_call; pState->m_first_call = 0; + if (pState->m_last_status < 0) return MZ_DATA_ERROR; + + if (pState->m_has_flushed && (flush != MZ_FINISH)) return MZ_STREAM_ERROR; + pState->m_has_flushed |= (flush == MZ_FINISH); + + if ((flush == MZ_FINISH) && (first_call)) + { + // MZ_FINISH on the first call implies that the input and output buffers are large enough to hold the entire compressed/decompressed file. + decomp_flags |= TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF; + in_bytes = pStream->avail_in; out_bytes = pStream->avail_out; + status = tinfl_decompress(&pState->m_decomp, pStream->next_in, &in_bytes, pStream->next_out, pStream->next_out, &out_bytes, decomp_flags); + pState->m_last_status = status; + pStream->next_in += (mz_uint)in_bytes; pStream->avail_in -= (mz_uint)in_bytes; pStream->total_in += (mz_uint)in_bytes; + pStream->adler = tinfl_get_adler32(&pState->m_decomp); + pStream->next_out += (mz_uint)out_bytes; pStream->avail_out -= (mz_uint)out_bytes; pStream->total_out += (mz_uint)out_bytes; + + if (status < 0) + return MZ_DATA_ERROR; + else if (status != TINFL_STATUS_DONE) + { + pState->m_last_status = TINFL_STATUS_FAILED; + return MZ_BUF_ERROR; + } + return MZ_STREAM_END; + } + // flush != MZ_FINISH then we must assume there's more input. + if (flush != MZ_FINISH) decomp_flags |= TINFL_FLAG_HAS_MORE_INPUT; + + if (pState->m_dict_avail) + { + n = MZ_MIN(pState->m_dict_avail, pStream->avail_out); + memcpy(pStream->next_out, pState->m_dict + pState->m_dict_ofs, n); + pStream->next_out += n; pStream->avail_out -= n; pStream->total_out += n; + pState->m_dict_avail -= n; pState->m_dict_ofs = (pState->m_dict_ofs + n) & (TINFL_LZ_DICT_SIZE - 1); + return ((pState->m_last_status == TINFL_STATUS_DONE) && (!pState->m_dict_avail)) ? MZ_STREAM_END : MZ_OK; + } + + for ( ; ; ) + { + in_bytes = pStream->avail_in; + out_bytes = TINFL_LZ_DICT_SIZE - pState->m_dict_ofs; + + status = tinfl_decompress(&pState->m_decomp, pStream->next_in, &in_bytes, pState->m_dict, pState->m_dict + pState->m_dict_ofs, &out_bytes, decomp_flags); + pState->m_last_status = status; + + pStream->next_in += (mz_uint)in_bytes; pStream->avail_in -= (mz_uint)in_bytes; + pStream->total_in += (mz_uint)in_bytes; pStream->adler = tinfl_get_adler32(&pState->m_decomp); + + pState->m_dict_avail = (mz_uint)out_bytes; + + n = MZ_MIN(pState->m_dict_avail, pStream->avail_out); + memcpy(pStream->next_out, pState->m_dict + pState->m_dict_ofs, n); + pStream->next_out += n; pStream->avail_out -= n; pStream->total_out += n; + pState->m_dict_avail -= n; pState->m_dict_ofs = (pState->m_dict_ofs + n) & (TINFL_LZ_DICT_SIZE - 1); + + if (status < 0) + return MZ_DATA_ERROR; // Stream is corrupted (there could be some uncompressed data left in the output dictionary - oh well). + else if ((status == TINFL_STATUS_NEEDS_MORE_INPUT) && (!orig_avail_in)) + return MZ_BUF_ERROR; // Signal caller that we can't make forward progress without supplying more input or by setting flush to MZ_FINISH. + else if (flush == MZ_FINISH) + { + // The output buffer MUST be large to hold the remaining uncompressed data when flush==MZ_FINISH. + if (status == TINFL_STATUS_DONE) + return pState->m_dict_avail ? MZ_BUF_ERROR : MZ_STREAM_END; + // status here must be TINFL_STATUS_HAS_MORE_OUTPUT, which means there's at least 1 more byte on the way. If there's no more room left in the output buffer then something is wrong. + else if (!pStream->avail_out) + return MZ_BUF_ERROR; + } + else if ((status == TINFL_STATUS_DONE) || (!pStream->avail_in) || (!pStream->avail_out) || (pState->m_dict_avail)) + break; + } + + return ((status == TINFL_STATUS_DONE) && (!pState->m_dict_avail)) ? MZ_STREAM_END : MZ_OK; +} + +int mz_inflateEnd(mz_streamp pStream) +{ + if (!pStream) + return MZ_STREAM_ERROR; + if (pStream->state) + { + pStream->zfree(pStream->opaque, pStream->state); + pStream->state = NULL; + } + return MZ_OK; +} + +int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len) +{ + mz_stream stream; + int status; + memset(&stream, 0, sizeof(stream)); + + // In case mz_ulong is 64-bits (argh I hate longs). + if ((source_len | *pDest_len) > 0xFFFFFFFFU) return MZ_PARAM_ERROR; + + stream.next_in = pSource; + stream.avail_in = (mz_uint32)source_len; + stream.next_out = pDest; + stream.avail_out = (mz_uint32)*pDest_len; + + status = mz_inflateInit(&stream); + if (status != MZ_OK) + return status; + + status = mz_inflate(&stream, MZ_FINISH); + if (status != MZ_STREAM_END) + { + mz_inflateEnd(&stream); + return ((status == MZ_BUF_ERROR) && (!stream.avail_in)) ? MZ_DATA_ERROR : status; + } + *pDest_len = stream.total_out; + + return mz_inflateEnd(&stream); +} + +const char *mz_error(int err) +{ + static struct { int m_err; const char *m_pDesc; } s_error_descs[] = + { + { MZ_OK, "" }, { MZ_STREAM_END, "stream end" }, { MZ_NEED_DICT, "need dictionary" }, { MZ_ERRNO, "file error" }, { MZ_STREAM_ERROR, "stream error" }, + { MZ_DATA_ERROR, "data error" }, { MZ_MEM_ERROR, "out of memory" }, { MZ_BUF_ERROR, "buf error" }, { MZ_VERSION_ERROR, "version error" }, { MZ_PARAM_ERROR, "parameter error" } + }; + mz_uint i; for (i = 0; i < sizeof(s_error_descs) / sizeof(s_error_descs[0]); ++i) if (s_error_descs[i].m_err == err) return s_error_descs[i].m_pDesc; + return NULL; +} + +#endif //MINIZ_NO_ZLIB_APIS + +// ------------------- Low-level Decompression (completely independent from all compression API's) + +#define TINFL_MEMCPY(d, s, l) memcpy(d, s, l) +#define TINFL_MEMSET(p, c, l) memset(p, c, l) + +#define TINFL_CR_BEGIN switch(r->m_state) { case 0: +#define TINFL_CR_RETURN(state_index, result) do { status = result; r->m_state = state_index; goto common_exit; case state_index:; } MZ_MACRO_END +#define TINFL_CR_RETURN_FOREVER(state_index, result) do { for ( ; ; ) { TINFL_CR_RETURN(state_index, result); } } MZ_MACRO_END +#define TINFL_CR_FINISH } + +// TODO: If the caller has indicated that there's no more input, and we attempt to read beyond the input buf, then something is wrong with the input because the inflator never +// reads ahead more than it needs to. Currently TINFL_GET_BYTE() pads the end of the stream with 0's in this scenario. +#define TINFL_GET_BYTE(state_index, c) do { \ + if (pIn_buf_cur >= pIn_buf_end) { \ + for ( ; ; ) { \ + if (decomp_flags & TINFL_FLAG_HAS_MORE_INPUT) { \ + TINFL_CR_RETURN(state_index, TINFL_STATUS_NEEDS_MORE_INPUT); \ + if (pIn_buf_cur < pIn_buf_end) { \ + c = *pIn_buf_cur++; \ + break; \ + } \ + } else { \ + c = 0; \ + break; \ + } \ + } \ + } else c = *pIn_buf_cur++; } MZ_MACRO_END + +#define TINFL_NEED_BITS(state_index, n) do { mz_uint c; TINFL_GET_BYTE(state_index, c); bit_buf |= (((tinfl_bit_buf_t)c) << num_bits); num_bits += 8; } while (num_bits < (mz_uint)(n)) +#define TINFL_SKIP_BITS(state_index, n) do { if (num_bits < (mz_uint)(n)) { TINFL_NEED_BITS(state_index, n); } bit_buf >>= (n); num_bits -= (n); } MZ_MACRO_END +#define TINFL_GET_BITS(state_index, b, n) do { if (num_bits < (mz_uint)(n)) { TINFL_NEED_BITS(state_index, n); } b = bit_buf & ((1 << (n)) - 1); bit_buf >>= (n); num_bits -= (n); } MZ_MACRO_END + +// TINFL_HUFF_BITBUF_FILL() is only used rarely, when the number of bytes remaining in the input buffer falls below 2. +// It reads just enough bytes from the input stream that are needed to decode the next Huffman code (and absolutely no more). It works by trying to fully decode a +// Huffman code by using whatever bits are currently present in the bit buffer. If this fails, it reads another byte, and tries again until it succeeds or until the +// bit buffer contains >=15 bits (deflate's max. Huffman code size). +#define TINFL_HUFF_BITBUF_FILL(state_index, pHuff) \ + do { \ + temp = (pHuff)->m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]; \ + if (temp >= 0) { \ + code_len = temp >> 9; \ + if ((code_len) && (num_bits >= code_len)) \ + break; \ + } else if (num_bits > TINFL_FAST_LOOKUP_BITS) { \ + code_len = TINFL_FAST_LOOKUP_BITS; \ + do { \ + temp = (pHuff)->m_tree[~temp + ((bit_buf >> code_len++) & 1)]; \ + } while ((temp < 0) && (num_bits >= (code_len + 1))); if (temp >= 0) break; \ + } TINFL_GET_BYTE(state_index, c); bit_buf |= (((tinfl_bit_buf_t)c) << num_bits); num_bits += 8; \ + } while (num_bits < 15); + +// TINFL_HUFF_DECODE() decodes the next Huffman coded symbol. It's more complex than you would initially expect because the zlib API expects the decompressor to never read +// beyond the final byte of the deflate stream. (In other words, when this macro wants to read another byte from the input, it REALLY needs another byte in order to fully +// decode the next Huffman code.) Handling this properly is particularly important on raw deflate (non-zlib) streams, which aren't followed by a byte aligned adler-32. +// The slow path is only executed at the very end of the input buffer. +#define TINFL_HUFF_DECODE(state_index, sym, pHuff) do { \ + int temp; mz_uint code_len, c; \ + if (num_bits < 15) { \ + if ((pIn_buf_end - pIn_buf_cur) < 2) { \ + TINFL_HUFF_BITBUF_FILL(state_index, pHuff); \ + } else { \ + bit_buf |= (((tinfl_bit_buf_t)pIn_buf_cur[0]) << num_bits) | (((tinfl_bit_buf_t)pIn_buf_cur[1]) << (num_bits + 8)); pIn_buf_cur += 2; num_bits += 16; \ + } \ + } \ + if ((temp = (pHuff)->m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= 0) \ + code_len = temp >> 9, temp &= 511; \ + else { \ + code_len = TINFL_FAST_LOOKUP_BITS; do { temp = (pHuff)->m_tree[~temp + ((bit_buf >> code_len++) & 1)]; } while (temp < 0); \ + } sym = temp; bit_buf >>= code_len; num_bits -= code_len; } MZ_MACRO_END + +tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags) +{ + static const int s_length_base[31] = { 3,4,5,6,7,8,9,10,11,13, 15,17,19,23,27,31,35,43,51,59, 67,83,99,115,131,163,195,227,258,0,0 }; + static const int s_length_extra[31]= { 0,0,0,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,0,0,0 }; + static const int s_dist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193, 257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0}; + static const int s_dist_extra[32] = { 0,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}; + static const mz_uint8 s_length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 }; + static const int s_min_table_sizes[3] = { 257, 1, 4 }; + + tinfl_status status = TINFL_STATUS_FAILED; mz_uint32 num_bits, dist, counter, num_extra; tinfl_bit_buf_t bit_buf; + const mz_uint8 *pIn_buf_cur = pIn_buf_next, *const pIn_buf_end = pIn_buf_next + *pIn_buf_size; + mz_uint8 *pOut_buf_cur = pOut_buf_next, *const pOut_buf_end = pOut_buf_next + *pOut_buf_size; + size_t out_buf_size_mask = (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF) ? (size_t)-1 : ((pOut_buf_next - pOut_buf_start) + *pOut_buf_size) - 1, dist_from_out_buf_start; + + // Ensure the output buffer's size is a power of 2, unless the output buffer is large enough to hold the entire output file (in which case it doesn't matter). + if (((out_buf_size_mask + 1) & out_buf_size_mask) || (pOut_buf_next < pOut_buf_start)) { *pIn_buf_size = *pOut_buf_size = 0; return TINFL_STATUS_BAD_PARAM; } + + num_bits = r->m_num_bits; bit_buf = r->m_bit_buf; dist = r->m_dist; counter = r->m_counter; num_extra = r->m_num_extra; dist_from_out_buf_start = r->m_dist_from_out_buf_start; + TINFL_CR_BEGIN + + bit_buf = num_bits = dist = counter = num_extra = r->m_zhdr0 = r->m_zhdr1 = 0; r->m_z_adler32 = r->m_check_adler32 = 1; + if (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER) + { + TINFL_GET_BYTE(1, r->m_zhdr0); TINFL_GET_BYTE(2, r->m_zhdr1); + counter = (((r->m_zhdr0 * 256 + r->m_zhdr1) % 31 != 0) || (r->m_zhdr1 & 32) || ((r->m_zhdr0 & 15) != 8)); + if (!(decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)) counter |= (((1U << (8U + (r->m_zhdr0 >> 4))) > 32768U) || ((out_buf_size_mask + 1) < (size_t)(1U << (8U + (r->m_zhdr0 >> 4))))); + if (counter) { TINFL_CR_RETURN_FOREVER(36, TINFL_STATUS_FAILED); } + } + + do + { + TINFL_GET_BITS(3, r->m_final, 3); r->m_type = r->m_final >> 1; + if (r->m_type == 0) + { + TINFL_SKIP_BITS(5, num_bits & 7); + for (counter = 0; counter < 4; ++counter) { if (num_bits) TINFL_GET_BITS(6, r->m_raw_header[counter], 8); else TINFL_GET_BYTE(7, r->m_raw_header[counter]); } + if ((counter = (r->m_raw_header[0] | (r->m_raw_header[1] << 8))) != (mz_uint)(0xFFFF ^ (r->m_raw_header[2] | (r->m_raw_header[3] << 8)))) { TINFL_CR_RETURN_FOREVER(39, TINFL_STATUS_FAILED); } + while ((counter) && (num_bits)) + { + TINFL_GET_BITS(51, dist, 8); + while (pOut_buf_cur >= pOut_buf_end) { TINFL_CR_RETURN(52, TINFL_STATUS_HAS_MORE_OUTPUT); } + *pOut_buf_cur++ = (mz_uint8)dist; + counter--; + } + while (counter) + { + size_t n; while (pOut_buf_cur >= pOut_buf_end) { TINFL_CR_RETURN(9, TINFL_STATUS_HAS_MORE_OUTPUT); } + while (pIn_buf_cur >= pIn_buf_end) + { + if (decomp_flags & TINFL_FLAG_HAS_MORE_INPUT) + { + TINFL_CR_RETURN(38, TINFL_STATUS_NEEDS_MORE_INPUT); + } + else + { + TINFL_CR_RETURN_FOREVER(40, TINFL_STATUS_FAILED); + } + } + n = MZ_MIN(MZ_MIN((size_t)(pOut_buf_end - pOut_buf_cur), (size_t)(pIn_buf_end - pIn_buf_cur)), counter); + TINFL_MEMCPY(pOut_buf_cur, pIn_buf_cur, n); pIn_buf_cur += n; pOut_buf_cur += n; counter -= (mz_uint)n; + } + } + else if (r->m_type == 3) + { + TINFL_CR_RETURN_FOREVER(10, TINFL_STATUS_FAILED); + } + else + { + if (r->m_type == 1) + { + mz_uint8 *p = r->m_tables[0].m_code_size; mz_uint i; + r->m_table_sizes[0] = 288; r->m_table_sizes[1] = 32; TINFL_MEMSET(r->m_tables[1].m_code_size, 5, 32); + for ( i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8; + } + else + { + for (counter = 0; counter < 3; counter++) { TINFL_GET_BITS(11, r->m_table_sizes[counter], "\05\05\04"[counter]); r->m_table_sizes[counter] += s_min_table_sizes[counter]; } + MZ_CLEAR_OBJ(r->m_tables[2].m_code_size); for (counter = 0; counter < r->m_table_sizes[2]; counter++) { mz_uint s; TINFL_GET_BITS(14, s, 3); r->m_tables[2].m_code_size[s_length_dezigzag[counter]] = (mz_uint8)s; } + r->m_table_sizes[2] = 19; + } + for ( ; (int)r->m_type >= 0; r->m_type--) + { + int tree_next, tree_cur; tinfl_huff_table *pTable; + mz_uint i, j, used_syms, total, sym_index, next_code[17], total_syms[16]; pTable = &r->m_tables[r->m_type]; MZ_CLEAR_OBJ(total_syms); MZ_CLEAR_OBJ(pTable->m_look_up); MZ_CLEAR_OBJ(pTable->m_tree); + for (i = 0; i < r->m_table_sizes[r->m_type]; ++i) total_syms[pTable->m_code_size[i]]++; + used_syms = 0, total = 0; next_code[0] = next_code[1] = 0; + for (i = 1; i <= 15; ++i) { used_syms += total_syms[i]; next_code[i + 1] = (total = ((total + total_syms[i]) << 1)); } + if ((65536 != total) && (used_syms > 1)) + { + TINFL_CR_RETURN_FOREVER(35, TINFL_STATUS_FAILED); + } + for (tree_next = -1, sym_index = 0; sym_index < r->m_table_sizes[r->m_type]; ++sym_index) + { + mz_uint rev_code = 0, l, cur_code, code_size = pTable->m_code_size[sym_index]; if (!code_size) continue; + cur_code = next_code[code_size]++; for (l = code_size; l > 0; l--, cur_code >>= 1) rev_code = (rev_code << 1) | (cur_code & 1); + if (code_size <= TINFL_FAST_LOOKUP_BITS) { mz_int16 k = (mz_int16)((code_size << 9) | sym_index); while (rev_code < TINFL_FAST_LOOKUP_SIZE) { pTable->m_look_up[rev_code] = k; rev_code += (1 << code_size); } continue; } + if (0 == (tree_cur = pTable->m_look_up[rev_code & (TINFL_FAST_LOOKUP_SIZE - 1)])) { pTable->m_look_up[rev_code & (TINFL_FAST_LOOKUP_SIZE - 1)] = (mz_int16)tree_next; tree_cur = tree_next; tree_next -= 2; } + rev_code >>= (TINFL_FAST_LOOKUP_BITS - 1); + for (j = code_size; j > (TINFL_FAST_LOOKUP_BITS + 1); j--) + { + tree_cur -= ((rev_code >>= 1) & 1); + if (!pTable->m_tree[-tree_cur - 1]) { pTable->m_tree[-tree_cur - 1] = (mz_int16)tree_next; tree_cur = tree_next; tree_next -= 2; } else tree_cur = pTable->m_tree[-tree_cur - 1]; + } + tree_cur -= ((rev_code >>= 1) & 1); pTable->m_tree[-tree_cur - 1] = (mz_int16)sym_index; + } + if (r->m_type == 2) + { + for (counter = 0; counter < (r->m_table_sizes[0] + r->m_table_sizes[1]); ) + { + mz_uint s; TINFL_HUFF_DECODE(16, dist, &r->m_tables[2]); if (dist < 16) { r->m_len_codes[counter++] = (mz_uint8)dist; continue; } + if ((dist == 16) && (!counter)) + { + TINFL_CR_RETURN_FOREVER(17, TINFL_STATUS_FAILED); + } + num_extra = "\02\03\07"[dist - 16]; TINFL_GET_BITS(18, s, num_extra); s += "\03\03\013"[dist - 16]; + TINFL_MEMSET(r->m_len_codes + counter, (dist == 16) ? r->m_len_codes[counter - 1] : 0, s); counter += s; + } + if ((r->m_table_sizes[0] + r->m_table_sizes[1]) != counter) + { + TINFL_CR_RETURN_FOREVER(21, TINFL_STATUS_FAILED); + } + TINFL_MEMCPY(r->m_tables[0].m_code_size, r->m_len_codes, r->m_table_sizes[0]); TINFL_MEMCPY(r->m_tables[1].m_code_size, r->m_len_codes + r->m_table_sizes[0], r->m_table_sizes[1]); + } + } + for ( ; ; ) + { + mz_uint8 *pSrc; + for ( ; ; ) + { + if (((pIn_buf_end - pIn_buf_cur) < 4) || ((pOut_buf_end - pOut_buf_cur) < 2)) + { + TINFL_HUFF_DECODE(23, counter, &r->m_tables[0]); + if (counter >= 256) + break; + while (pOut_buf_cur >= pOut_buf_end) { TINFL_CR_RETURN(24, TINFL_STATUS_HAS_MORE_OUTPUT); } + *pOut_buf_cur++ = (mz_uint8)counter; + } + else + { + int sym2; mz_uint code_len; +#if TINFL_USE_64BIT_BITBUF + if (num_bits < 30) { bit_buf |= (((tinfl_bit_buf_t)MZ_READ_LE32(pIn_buf_cur)) << num_bits); pIn_buf_cur += 4; num_bits += 32; } +#else + if (num_bits < 15) { bit_buf |= (((tinfl_bit_buf_t)MZ_READ_LE16(pIn_buf_cur)) << num_bits); pIn_buf_cur += 2; num_bits += 16; } +#endif + if ((sym2 = r->m_tables[0].m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= 0) + code_len = sym2 >> 9; + else + { + code_len = TINFL_FAST_LOOKUP_BITS; do { sym2 = r->m_tables[0].m_tree[~sym2 + ((bit_buf >> code_len++) & 1)]; } while (sym2 < 0); + } + counter = sym2; bit_buf >>= code_len; num_bits -= code_len; + if (counter & 256) + break; + +#if !TINFL_USE_64BIT_BITBUF + if (num_bits < 15) { bit_buf |= (((tinfl_bit_buf_t)MZ_READ_LE16(pIn_buf_cur)) << num_bits); pIn_buf_cur += 2; num_bits += 16; } +#endif + if ((sym2 = r->m_tables[0].m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= 0) + code_len = sym2 >> 9; + else + { + code_len = TINFL_FAST_LOOKUP_BITS; do { sym2 = r->m_tables[0].m_tree[~sym2 + ((bit_buf >> code_len++) & 1)]; } while (sym2 < 0); + } + bit_buf >>= code_len; num_bits -= code_len; + + pOut_buf_cur[0] = (mz_uint8)counter; + if (sym2 & 256) + { + pOut_buf_cur++; + counter = sym2; + break; + } + pOut_buf_cur[1] = (mz_uint8)sym2; + pOut_buf_cur += 2; + } + } + if ((counter &= 511) == 256) break; + + num_extra = s_length_extra[counter - 257]; counter = s_length_base[counter - 257]; + if (num_extra) { mz_uint extra_bits; TINFL_GET_BITS(25, extra_bits, num_extra); counter += extra_bits; } + + TINFL_HUFF_DECODE(26, dist, &r->m_tables[1]); + num_extra = s_dist_extra[dist]; dist = s_dist_base[dist]; + if (num_extra) { mz_uint extra_bits; TINFL_GET_BITS(27, extra_bits, num_extra); dist += extra_bits; } + + dist_from_out_buf_start = pOut_buf_cur - pOut_buf_start; + if ((dist > dist_from_out_buf_start) && (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)) + { + TINFL_CR_RETURN_FOREVER(37, TINFL_STATUS_FAILED); + } + + pSrc = pOut_buf_start + ((dist_from_out_buf_start - dist) & out_buf_size_mask); + + if ((MZ_MAX(pOut_buf_cur, pSrc) + counter) > pOut_buf_end) + { + while (counter--) + { + while (pOut_buf_cur >= pOut_buf_end) { TINFL_CR_RETURN(53, TINFL_STATUS_HAS_MORE_OUTPUT); } + *pOut_buf_cur++ = pOut_buf_start[(dist_from_out_buf_start++ - dist) & out_buf_size_mask]; + } + continue; + } +#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES + else if ((counter >= 9) && (counter <= dist)) + { + const mz_uint8 *pSrc_end = pSrc + (counter & ~7); + do + { + ((mz_uint32 *)pOut_buf_cur)[0] = ((const mz_uint32 *)pSrc)[0]; + ((mz_uint32 *)pOut_buf_cur)[1] = ((const mz_uint32 *)pSrc)[1]; + pOut_buf_cur += 8; + } while ((pSrc += 8) < pSrc_end); + if ((counter &= 7) < 3) + { + if (counter) + { + pOut_buf_cur[0] = pSrc[0]; + if (counter > 1) + pOut_buf_cur[1] = pSrc[1]; + pOut_buf_cur += counter; + } + continue; + } + } +#endif + do + { + pOut_buf_cur[0] = pSrc[0]; + pOut_buf_cur[1] = pSrc[1]; + pOut_buf_cur[2] = pSrc[2]; + pOut_buf_cur += 3; pSrc += 3; + } while ((int)(counter -= 3) > 2); + if ((int)counter > 0) + { + pOut_buf_cur[0] = pSrc[0]; + if ((int)counter > 1) + pOut_buf_cur[1] = pSrc[1]; + pOut_buf_cur += counter; + } + } + } + } while (!(r->m_final & 1)); + if (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER) + { + TINFL_SKIP_BITS(32, num_bits & 7); for (counter = 0; counter < 4; ++counter) { mz_uint s; if (num_bits) TINFL_GET_BITS(41, s, 8); else TINFL_GET_BYTE(42, s); r->m_z_adler32 = (r->m_z_adler32 << 8) | s; } + } + TINFL_CR_RETURN_FOREVER(34, TINFL_STATUS_DONE); + TINFL_CR_FINISH + +common_exit: + r->m_num_bits = num_bits; r->m_bit_buf = bit_buf; r->m_dist = dist; r->m_counter = counter; r->m_num_extra = num_extra; r->m_dist_from_out_buf_start = dist_from_out_buf_start; + *pIn_buf_size = pIn_buf_cur - pIn_buf_next; *pOut_buf_size = pOut_buf_cur - pOut_buf_next; + if ((decomp_flags & (TINFL_FLAG_PARSE_ZLIB_HEADER | TINFL_FLAG_COMPUTE_ADLER32)) && (status >= 0)) + { + const mz_uint8 *ptr = pOut_buf_next; size_t buf_len = *pOut_buf_size; + mz_uint32 i, s1 = r->m_check_adler32 & 0xffff, s2 = r->m_check_adler32 >> 16; size_t block_len = buf_len % 5552; + while (buf_len) + { + for (i = 0; i + 7 < block_len; i += 8, ptr += 8) + { + s1 += ptr[0], s2 += s1; s1 += ptr[1], s2 += s1; s1 += ptr[2], s2 += s1; s1 += ptr[3], s2 += s1; + s1 += ptr[4], s2 += s1; s1 += ptr[5], s2 += s1; s1 += ptr[6], s2 += s1; s1 += ptr[7], s2 += s1; + } + for ( ; i < block_len; ++i) s1 += *ptr++, s2 += s1; + s1 %= 65521U, s2 %= 65521U; buf_len -= block_len; block_len = 5552; + } + r->m_check_adler32 = (s2 << 16) + s1; if ((status == TINFL_STATUS_DONE) && (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER) && (r->m_check_adler32 != r->m_z_adler32)) status = TINFL_STATUS_ADLER32_MISMATCH; + } + return status; +} + +// Higher level helper functions. +void *tinfl_decompress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags) +{ + tinfl_decompressor decomp; void *pBuf = NULL, *pNew_buf; size_t src_buf_ofs = 0, out_buf_capacity = 0; + *pOut_len = 0; + tinfl_init(&decomp); + for ( ; ; ) + { + size_t src_buf_size = src_buf_len - src_buf_ofs, dst_buf_size = out_buf_capacity - *pOut_len, new_out_buf_capacity; + tinfl_status status = tinfl_decompress(&decomp, (const mz_uint8*)pSrc_buf + src_buf_ofs, &src_buf_size, (mz_uint8*)pBuf, pBuf ? (mz_uint8*)pBuf + *pOut_len : NULL, &dst_buf_size, + (flags & ~TINFL_FLAG_HAS_MORE_INPUT) | TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF); + if ((status < 0) || (status == TINFL_STATUS_NEEDS_MORE_INPUT)) + { + MZ_FREE(pBuf); *pOut_len = 0; return NULL; + } + src_buf_ofs += src_buf_size; + *pOut_len += dst_buf_size; + if (status == TINFL_STATUS_DONE) break; + new_out_buf_capacity = out_buf_capacity * 2; if (new_out_buf_capacity < 128) new_out_buf_capacity = 128; + pNew_buf = MZ_REALLOC(pBuf, new_out_buf_capacity); + if (!pNew_buf) + { + MZ_FREE(pBuf); *pOut_len = 0; return NULL; + } + pBuf = pNew_buf; out_buf_capacity = new_out_buf_capacity; + } + return pBuf; +} + +size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags) +{ + tinfl_decompressor decomp; tinfl_status status; tinfl_init(&decomp); + status = tinfl_decompress(&decomp, (const mz_uint8*)pSrc_buf, &src_buf_len, (mz_uint8*)pOut_buf, (mz_uint8*)pOut_buf, &out_buf_len, (flags & ~TINFL_FLAG_HAS_MORE_INPUT) | TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF); + return (status != TINFL_STATUS_DONE) ? TINFL_DECOMPRESS_MEM_TO_MEM_FAILED : out_buf_len; +} + +int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size, tinfl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags) +{ + int result = 0; + tinfl_decompressor decomp; + mz_uint8 *pDict = (mz_uint8*)MZ_MALLOC(TINFL_LZ_DICT_SIZE); size_t in_buf_ofs = 0, dict_ofs = 0; + if (!pDict) + return TINFL_STATUS_FAILED; + tinfl_init(&decomp); + for ( ; ; ) + { + size_t in_buf_size = *pIn_buf_size - in_buf_ofs, dst_buf_size = TINFL_LZ_DICT_SIZE - dict_ofs; + tinfl_status status = tinfl_decompress(&decomp, (const mz_uint8*)pIn_buf + in_buf_ofs, &in_buf_size, pDict, pDict + dict_ofs, &dst_buf_size, + (flags & ~(TINFL_FLAG_HAS_MORE_INPUT | TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF))); + in_buf_ofs += in_buf_size; + if ((dst_buf_size) && (!(*pPut_buf_func)(pDict + dict_ofs, (int)dst_buf_size, pPut_buf_user))) + break; + if (status != TINFL_STATUS_HAS_MORE_OUTPUT) + { + result = (status == TINFL_STATUS_DONE); + break; + } + dict_ofs = (dict_ofs + dst_buf_size) & (TINFL_LZ_DICT_SIZE - 1); + } + MZ_FREE(pDict); + *pIn_buf_size = in_buf_ofs; + return result; +} + +// ------------------- Low-level Compression (independent from all decompression API's) + +// Purposely making these tables static for faster init and thread safety. +static const mz_uint16 s_tdefl_len_sym[256] = { + 257,258,259,260,261,262,263,264,265,265,266,266,267,267,268,268,269,269,269,269,270,270,270,270,271,271,271,271,272,272,272,272, + 273,273,273,273,273,273,273,273,274,274,274,274,274,274,274,274,275,275,275,275,275,275,275,275,276,276,276,276,276,276,276,276, + 277,277,277,277,277,277,277,277,277,277,277,277,277,277,277,277,278,278,278,278,278,278,278,278,278,278,278,278,278,278,278,278, + 279,279,279,279,279,279,279,279,279,279,279,279,279,279,279,279,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280, + 281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281, + 282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282, + 283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283, + 284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,285 }; + +static const mz_uint8 s_tdefl_len_extra[256] = { + 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,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,4,4,4,4,4,4,4,4,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,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0 }; + +static const mz_uint8 s_tdefl_small_dist_sym[512] = { + 0,1,2,3,4,4,5,5,6,6,6,6,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,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,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,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,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,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,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,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,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,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, + 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, + 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, + 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17 }; + +static const mz_uint8 s_tdefl_small_dist_extra[512] = { + 0,0,0,0,1,1,1,1,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,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,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,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,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,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,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,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,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,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,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,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, + 7,7,7,7,7,7,7,7 }; + +static const mz_uint8 s_tdefl_large_dist_sym[128] = { + 0,0,18,19,20,20,21,21,22,22,22,22,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,26,26,26, + 26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28, + 28,28,28,28,28,28,28,28,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29 }; + +static const mz_uint8 s_tdefl_large_dist_extra[128] = { + 0,0,8,8,9,9,9,9,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, + 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,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13 }; + +// Radix sorts tdefl_sym_freq[] array by 16-bit key m_key. Returns ptr to sorted values. +typedef struct { mz_uint16 m_key, m_sym_index; } tdefl_sym_freq; +static tdefl_sym_freq* tdefl_radix_sort_syms(mz_uint num_syms, tdefl_sym_freq* pSyms0, tdefl_sym_freq* pSyms1) +{ + mz_uint32 total_passes = 2, pass_shift, pass, i, hist[256 * 2]; tdefl_sym_freq* pCur_syms = pSyms0, *pNew_syms = pSyms1; MZ_CLEAR_OBJ(hist); + for (i = 0; i < num_syms; i++) { mz_uint freq = pSyms0[i].m_key; hist[freq & 0xFF]++; hist[256 + ((freq >> 8) & 0xFF)]++; } + while ((total_passes > 1) && (num_syms == hist[(total_passes - 1) * 256])) total_passes--; + for (pass_shift = 0, pass = 0; pass < total_passes; pass++, pass_shift += 8) + { + const mz_uint32* pHist = &hist[pass << 8]; + mz_uint offsets[256], cur_ofs = 0; + for (i = 0; i < 256; i++) { offsets[i] = cur_ofs; cur_ofs += pHist[i]; } + for (i = 0; i < num_syms; i++) pNew_syms[offsets[(pCur_syms[i].m_key >> pass_shift) & 0xFF]++] = pCur_syms[i]; + { tdefl_sym_freq* t = pCur_syms; pCur_syms = pNew_syms; pNew_syms = t; } + } + return pCur_syms; +} + +// tdefl_calculate_minimum_redundancy() originally written by: Alistair Moffat, alistair@cs.mu.oz.au, Jyrki Katajainen, jyrki@diku.dk, November 1996. +static void tdefl_calculate_minimum_redundancy(tdefl_sym_freq *A, int n) +{ + int root, leaf, next, avbl, used, dpth; + if (n==0) return; else if (n==1) { A[0].m_key = 1; return; } + A[0].m_key += A[1].m_key; root = 0; leaf = 2; + for (next=1; next < n-1; next++) + { + if (leaf>=n || A[root].m_key=n || (root=0; next--) A[next].m_key = A[A[next].m_key].m_key+1; + avbl = 1; used = dpth = 0; root = n-2; next = n-1; + while (avbl>0) + { + while (root>=0 && (int)A[root].m_key==dpth) { used++; root--; } + while (avbl>used) { A[next--].m_key = (mz_uint16)(dpth); avbl--; } + avbl = 2*used; dpth++; used = 0; + } +} + +// Limits canonical Huffman code table's max code size. +enum { TDEFL_MAX_SUPPORTED_HUFF_CODESIZE = 32 }; +static void tdefl_huffman_enforce_max_code_size(int *pNum_codes, int code_list_len, int max_code_size) +{ + int i; mz_uint32 total = 0; if (code_list_len <= 1) return; + for (i = max_code_size + 1; i <= TDEFL_MAX_SUPPORTED_HUFF_CODESIZE; i++) pNum_codes[max_code_size] += pNum_codes[i]; + for (i = max_code_size; i > 0; i--) total += (((mz_uint32)pNum_codes[i]) << (max_code_size - i)); + while (total != (1UL << max_code_size)) + { + pNum_codes[max_code_size]--; + for (i = max_code_size - 1; i > 0; i--) if (pNum_codes[i]) { pNum_codes[i]--; pNum_codes[i + 1] += 2; break; } + total--; + } +} + +static void tdefl_optimize_huffman_table(tdefl_compressor *d, int table_num, int table_len, int code_size_limit, int static_table) +{ + int i, j, l, num_codes[1 + TDEFL_MAX_SUPPORTED_HUFF_CODESIZE]; mz_uint next_code[TDEFL_MAX_SUPPORTED_HUFF_CODESIZE + 1]; MZ_CLEAR_OBJ(num_codes); + if (static_table) + { + for (i = 0; i < table_len; i++) num_codes[d->m_huff_code_sizes[table_num][i]]++; + } + else + { + tdefl_sym_freq syms0[TDEFL_MAX_HUFF_SYMBOLS], syms1[TDEFL_MAX_HUFF_SYMBOLS], *pSyms; + int num_used_syms = 0; + const mz_uint16 *pSym_count = &d->m_huff_count[table_num][0]; + for (i = 0; i < table_len; i++) if (pSym_count[i]) { syms0[num_used_syms].m_key = (mz_uint16)pSym_count[i]; syms0[num_used_syms++].m_sym_index = (mz_uint16)i; } + + pSyms = tdefl_radix_sort_syms(num_used_syms, syms0, syms1); tdefl_calculate_minimum_redundancy(pSyms, num_used_syms); + + for (i = 0; i < num_used_syms; i++) num_codes[pSyms[i].m_key]++; + + tdefl_huffman_enforce_max_code_size(num_codes, num_used_syms, code_size_limit); + + MZ_CLEAR_OBJ(d->m_huff_code_sizes[table_num]); MZ_CLEAR_OBJ(d->m_huff_codes[table_num]); + for (i = 1, j = num_used_syms; i <= code_size_limit; i++) + for (l = num_codes[i]; l > 0; l--) d->m_huff_code_sizes[table_num][pSyms[--j].m_sym_index] = (mz_uint8)(i); + } + + next_code[1] = 0; for (j = 0, i = 2; i <= code_size_limit; i++) next_code[i] = j = ((j + num_codes[i - 1]) << 1); + + for (i = 0; i < table_len; i++) + { + mz_uint rev_code = 0, code, code_size; if ((code_size = d->m_huff_code_sizes[table_num][i]) == 0) continue; + code = next_code[code_size]++; for (l = code_size; l > 0; l--, code >>= 1) rev_code = (rev_code << 1) | (code & 1); + d->m_huff_codes[table_num][i] = (mz_uint16)rev_code; + } +} + +#define TDEFL_PUT_BITS(b, l) do { \ + mz_uint bits = b; mz_uint len = l; MZ_ASSERT(bits <= ((1U << len) - 1U)); \ + d->m_bit_buffer |= (bits << d->m_bits_in); d->m_bits_in += len; \ + while (d->m_bits_in >= 8) { \ + if (d->m_pOutput_buf < d->m_pOutput_buf_end) \ + *d->m_pOutput_buf++ = (mz_uint8)(d->m_bit_buffer); \ + d->m_bit_buffer >>= 8; \ + d->m_bits_in -= 8; \ + } \ +} MZ_MACRO_END + +#define TDEFL_RLE_PREV_CODE_SIZE() { if (rle_repeat_count) { \ + if (rle_repeat_count < 3) { \ + d->m_huff_count[2][prev_code_size] = (mz_uint16)(d->m_huff_count[2][prev_code_size] + rle_repeat_count); \ + while (rle_repeat_count--) packed_code_sizes[num_packed_code_sizes++] = prev_code_size; \ + } else { \ + d->m_huff_count[2][16] = (mz_uint16)(d->m_huff_count[2][16] + 1); packed_code_sizes[num_packed_code_sizes++] = 16; packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_repeat_count - 3); \ +} rle_repeat_count = 0; } } + +#define TDEFL_RLE_ZERO_CODE_SIZE() { if (rle_z_count) { \ + if (rle_z_count < 3) { \ + d->m_huff_count[2][0] = (mz_uint16)(d->m_huff_count[2][0] + rle_z_count); while (rle_z_count--) packed_code_sizes[num_packed_code_sizes++] = 0; \ + } else if (rle_z_count <= 10) { \ + d->m_huff_count[2][17] = (mz_uint16)(d->m_huff_count[2][17] + 1); packed_code_sizes[num_packed_code_sizes++] = 17; packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_z_count - 3); \ + } else { \ + d->m_huff_count[2][18] = (mz_uint16)(d->m_huff_count[2][18] + 1); packed_code_sizes[num_packed_code_sizes++] = 18; packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_z_count - 11); \ +} rle_z_count = 0; } } + +static mz_uint8 s_tdefl_packed_code_size_syms_swizzle[] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 }; + +static void tdefl_start_dynamic_block(tdefl_compressor *d) +{ + int num_lit_codes, num_dist_codes, num_bit_lengths; mz_uint i, total_code_sizes_to_pack, num_packed_code_sizes, rle_z_count, rle_repeat_count, packed_code_sizes_index; + mz_uint8 code_sizes_to_pack[TDEFL_MAX_HUFF_SYMBOLS_0 + TDEFL_MAX_HUFF_SYMBOLS_1], packed_code_sizes[TDEFL_MAX_HUFF_SYMBOLS_0 + TDEFL_MAX_HUFF_SYMBOLS_1], prev_code_size = 0xFF; + + d->m_huff_count[0][256] = 1; + + tdefl_optimize_huffman_table(d, 0, TDEFL_MAX_HUFF_SYMBOLS_0, 15, MZ_FALSE); + tdefl_optimize_huffman_table(d, 1, TDEFL_MAX_HUFF_SYMBOLS_1, 15, MZ_FALSE); + + for (num_lit_codes = 286; num_lit_codes > 257; num_lit_codes--) if (d->m_huff_code_sizes[0][num_lit_codes - 1]) break; + for (num_dist_codes = 30; num_dist_codes > 1; num_dist_codes--) if (d->m_huff_code_sizes[1][num_dist_codes - 1]) break; + + memcpy(code_sizes_to_pack, &d->m_huff_code_sizes[0][0], num_lit_codes); + memcpy(code_sizes_to_pack + num_lit_codes, &d->m_huff_code_sizes[1][0], num_dist_codes); + total_code_sizes_to_pack = num_lit_codes + num_dist_codes; num_packed_code_sizes = 0; rle_z_count = 0; rle_repeat_count = 0; + + memset(&d->m_huff_count[2][0], 0, sizeof(d->m_huff_count[2][0]) * TDEFL_MAX_HUFF_SYMBOLS_2); + for (i = 0; i < total_code_sizes_to_pack; i++) + { + mz_uint8 code_size = code_sizes_to_pack[i]; + if (!code_size) + { + TDEFL_RLE_PREV_CODE_SIZE(); + if (++rle_z_count == 138) { TDEFL_RLE_ZERO_CODE_SIZE(); } + } + else + { + TDEFL_RLE_ZERO_CODE_SIZE(); + if (code_size != prev_code_size) + { + TDEFL_RLE_PREV_CODE_SIZE(); + d->m_huff_count[2][code_size] = (mz_uint16)(d->m_huff_count[2][code_size] + 1); packed_code_sizes[num_packed_code_sizes++] = code_size; + } + else if (++rle_repeat_count == 6) + { + TDEFL_RLE_PREV_CODE_SIZE(); + } + } + prev_code_size = code_size; + } + if (rle_repeat_count) { TDEFL_RLE_PREV_CODE_SIZE(); } else { TDEFL_RLE_ZERO_CODE_SIZE(); } + + tdefl_optimize_huffman_table(d, 2, TDEFL_MAX_HUFF_SYMBOLS_2, 7, MZ_FALSE); + + TDEFL_PUT_BITS(2, 2); + + TDEFL_PUT_BITS(num_lit_codes - 257, 5); + TDEFL_PUT_BITS(num_dist_codes - 1, 5); + + for (num_bit_lengths = 18; num_bit_lengths >= 0; num_bit_lengths--) if (d->m_huff_code_sizes[2][s_tdefl_packed_code_size_syms_swizzle[num_bit_lengths]]) break; + num_bit_lengths = MZ_MAX(4, (num_bit_lengths + 1)); TDEFL_PUT_BITS(num_bit_lengths - 4, 4); + for (i = 0; (int)i < num_bit_lengths; i++) TDEFL_PUT_BITS(d->m_huff_code_sizes[2][s_tdefl_packed_code_size_syms_swizzle[i]], 3); + + for (packed_code_sizes_index = 0; packed_code_sizes_index < num_packed_code_sizes; ) + { + mz_uint code = packed_code_sizes[packed_code_sizes_index++]; MZ_ASSERT(code < TDEFL_MAX_HUFF_SYMBOLS_2); + TDEFL_PUT_BITS(d->m_huff_codes[2][code], d->m_huff_code_sizes[2][code]); + if (code >= 16) TDEFL_PUT_BITS(packed_code_sizes[packed_code_sizes_index++], "\02\03\07"[code - 16]); + } +} + +static void tdefl_start_static_block(tdefl_compressor *d) +{ + mz_uint i; + mz_uint8 *p = &d->m_huff_code_sizes[0][0]; + + for (i = 0; i <= 143; ++i) *p++ = 8; + for ( ; i <= 255; ++i) *p++ = 9; + for ( ; i <= 279; ++i) *p++ = 7; + for ( ; i <= 287; ++i) *p++ = 8; + + memset(d->m_huff_code_sizes[1], 5, 32); + + tdefl_optimize_huffman_table(d, 0, 288, 15, MZ_TRUE); + tdefl_optimize_huffman_table(d, 1, 32, 15, MZ_TRUE); + + TDEFL_PUT_BITS(1, 2); +} + +static const mz_uint mz_bitmasks[17] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF }; + +#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN && MINIZ_HAS_64BIT_REGISTERS +static mz_bool tdefl_compress_lz_codes(tdefl_compressor *d) +{ + mz_uint flags; + mz_uint8 *pLZ_codes; + mz_uint8 *pOutput_buf = d->m_pOutput_buf; + mz_uint8 *pLZ_code_buf_end = d->m_pLZ_code_buf; + mz_uint64 bit_buffer = d->m_bit_buffer; + mz_uint bits_in = d->m_bits_in; + +#define TDEFL_PUT_BITS_FAST(b, l) { bit_buffer |= (((mz_uint64)(b)) << bits_in); bits_in += (l); } + + flags = 1; + for (pLZ_codes = d->m_lz_code_buf; pLZ_codes < pLZ_code_buf_end; flags >>= 1) + { + if (flags == 1) + flags = *pLZ_codes++ | 0x100; + + if (flags & 1) + { + mz_uint s0, s1, n0, n1, sym, num_extra_bits; + mz_uint match_len = pLZ_codes[0], match_dist = *(const mz_uint16 *)(pLZ_codes + 1); pLZ_codes += 3; + + MZ_ASSERT(d->m_huff_code_sizes[0][s_tdefl_len_sym[match_len]]); + TDEFL_PUT_BITS_FAST(d->m_huff_codes[0][s_tdefl_len_sym[match_len]], d->m_huff_code_sizes[0][s_tdefl_len_sym[match_len]]); + TDEFL_PUT_BITS_FAST(match_len & mz_bitmasks[s_tdefl_len_extra[match_len]], s_tdefl_len_extra[match_len]); + + // This sequence coaxes MSVC into using cmov's vs. jmp's. + s0 = s_tdefl_small_dist_sym[match_dist & 511]; + n0 = s_tdefl_small_dist_extra[match_dist & 511]; + s1 = s_tdefl_large_dist_sym[match_dist >> 8]; + n1 = s_tdefl_large_dist_extra[match_dist >> 8]; + sym = (match_dist < 512) ? s0 : s1; + num_extra_bits = (match_dist < 512) ? n0 : n1; + + MZ_ASSERT(d->m_huff_code_sizes[1][sym]); + TDEFL_PUT_BITS_FAST(d->m_huff_codes[1][sym], d->m_huff_code_sizes[1][sym]); + TDEFL_PUT_BITS_FAST(match_dist & mz_bitmasks[num_extra_bits], num_extra_bits); + } + else + { + mz_uint lit = *pLZ_codes++; + MZ_ASSERT(d->m_huff_code_sizes[0][lit]); + TDEFL_PUT_BITS_FAST(d->m_huff_codes[0][lit], d->m_huff_code_sizes[0][lit]); + + if (((flags & 2) == 0) && (pLZ_codes < pLZ_code_buf_end)) + { + flags >>= 1; + lit = *pLZ_codes++; + MZ_ASSERT(d->m_huff_code_sizes[0][lit]); + TDEFL_PUT_BITS_FAST(d->m_huff_codes[0][lit], d->m_huff_code_sizes[0][lit]); + + if (((flags & 2) == 0) && (pLZ_codes < pLZ_code_buf_end)) + { + flags >>= 1; + lit = *pLZ_codes++; + MZ_ASSERT(d->m_huff_code_sizes[0][lit]); + TDEFL_PUT_BITS_FAST(d->m_huff_codes[0][lit], d->m_huff_code_sizes[0][lit]); + } + } + } + + if (pOutput_buf >= d->m_pOutput_buf_end) + return MZ_FALSE; + + *(mz_uint64*)pOutput_buf = bit_buffer; + pOutput_buf += (bits_in >> 3); + bit_buffer >>= (bits_in & ~7); + bits_in &= 7; + } + +#undef TDEFL_PUT_BITS_FAST + + d->m_pOutput_buf = pOutput_buf; + d->m_bits_in = 0; + d->m_bit_buffer = 0; + + while (bits_in) + { + mz_uint32 n = MZ_MIN(bits_in, 16); + TDEFL_PUT_BITS((mz_uint)bit_buffer & mz_bitmasks[n], n); + bit_buffer >>= n; + bits_in -= n; + } + + TDEFL_PUT_BITS(d->m_huff_codes[0][256], d->m_huff_code_sizes[0][256]); + + return (d->m_pOutput_buf < d->m_pOutput_buf_end); +} +#else +static mz_bool tdefl_compress_lz_codes(tdefl_compressor *d) +{ + mz_uint flags; + mz_uint8 *pLZ_codes; + + flags = 1; + for (pLZ_codes = d->m_lz_code_buf; pLZ_codes < d->m_pLZ_code_buf; flags >>= 1) + { + if (flags == 1) + flags = *pLZ_codes++ | 0x100; + if (flags & 1) + { + mz_uint sym, num_extra_bits; + mz_uint match_len = pLZ_codes[0], match_dist = (pLZ_codes[1] | (pLZ_codes[2] << 8)); pLZ_codes += 3; + + MZ_ASSERT(d->m_huff_code_sizes[0][s_tdefl_len_sym[match_len]]); + TDEFL_PUT_BITS(d->m_huff_codes[0][s_tdefl_len_sym[match_len]], d->m_huff_code_sizes[0][s_tdefl_len_sym[match_len]]); + TDEFL_PUT_BITS(match_len & mz_bitmasks[s_tdefl_len_extra[match_len]], s_tdefl_len_extra[match_len]); + + if (match_dist < 512) + { + sym = s_tdefl_small_dist_sym[match_dist]; num_extra_bits = s_tdefl_small_dist_extra[match_dist]; + } + else + { + sym = s_tdefl_large_dist_sym[match_dist >> 8]; num_extra_bits = s_tdefl_large_dist_extra[match_dist >> 8]; + } + MZ_ASSERT(d->m_huff_code_sizes[1][sym]); + TDEFL_PUT_BITS(d->m_huff_codes[1][sym], d->m_huff_code_sizes[1][sym]); + TDEFL_PUT_BITS(match_dist & mz_bitmasks[num_extra_bits], num_extra_bits); + } + else + { + mz_uint lit = *pLZ_codes++; + MZ_ASSERT(d->m_huff_code_sizes[0][lit]); + TDEFL_PUT_BITS(d->m_huff_codes[0][lit], d->m_huff_code_sizes[0][lit]); + } + } + + TDEFL_PUT_BITS(d->m_huff_codes[0][256], d->m_huff_code_sizes[0][256]); + + return (d->m_pOutput_buf < d->m_pOutput_buf_end); +} +#endif // MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN && MINIZ_HAS_64BIT_REGISTERS + +static mz_bool tdefl_compress_block(tdefl_compressor *d, mz_bool static_block) +{ + if (static_block) + tdefl_start_static_block(d); + else + tdefl_start_dynamic_block(d); + return tdefl_compress_lz_codes(d); +} + +static int tdefl_flush_block(tdefl_compressor *d, int flush) +{ + mz_uint saved_bit_buf, saved_bits_in; + mz_uint8 *pSaved_output_buf; + mz_bool comp_block_succeeded = MZ_FALSE; + int n, use_raw_block = ((d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS) != 0) && (d->m_lookahead_pos - d->m_lz_code_buf_dict_pos) <= d->m_dict_size; + mz_uint8 *pOutput_buf_start = ((d->m_pPut_buf_func == NULL) && ((*d->m_pOut_buf_size - d->m_out_buf_ofs) >= TDEFL_OUT_BUF_SIZE)) ? ((mz_uint8 *)d->m_pOut_buf + d->m_out_buf_ofs) : d->m_output_buf; + + d->m_pOutput_buf = pOutput_buf_start; + d->m_pOutput_buf_end = d->m_pOutput_buf + TDEFL_OUT_BUF_SIZE - 16; + + MZ_ASSERT(!d->m_output_flush_remaining); + d->m_output_flush_ofs = 0; + d->m_output_flush_remaining = 0; + + *d->m_pLZ_flags = (mz_uint8)(*d->m_pLZ_flags >> d->m_num_flags_left); + d->m_pLZ_code_buf -= (d->m_num_flags_left == 8); + + if ((d->m_flags & TDEFL_WRITE_ZLIB_HEADER) && (!d->m_block_index)) + { + TDEFL_PUT_BITS(0x78, 8); TDEFL_PUT_BITS(0x01, 8); + } + + TDEFL_PUT_BITS(flush == TDEFL_FINISH, 1); + + pSaved_output_buf = d->m_pOutput_buf; saved_bit_buf = d->m_bit_buffer; saved_bits_in = d->m_bits_in; + + if (!use_raw_block) + comp_block_succeeded = tdefl_compress_block(d, (d->m_flags & TDEFL_FORCE_ALL_STATIC_BLOCKS) || (d->m_total_lz_bytes < 48)); + + // If the block gets expanded, forget the current contents of the output buffer and send a raw block instead. + if ( ((use_raw_block) || ((d->m_total_lz_bytes) && ((d->m_pOutput_buf - pSaved_output_buf + 1U) >= d->m_total_lz_bytes))) && + ((d->m_lookahead_pos - d->m_lz_code_buf_dict_pos) <= d->m_dict_size) ) + { + mz_uint i; d->m_pOutput_buf = pSaved_output_buf; d->m_bit_buffer = saved_bit_buf, d->m_bits_in = saved_bits_in; + TDEFL_PUT_BITS(0, 2); + if (d->m_bits_in) { TDEFL_PUT_BITS(0, 8 - d->m_bits_in); } + for (i = 2; i; --i, d->m_total_lz_bytes ^= 0xFFFF) + { + TDEFL_PUT_BITS(d->m_total_lz_bytes & 0xFFFF, 16); + } + for (i = 0; i < d->m_total_lz_bytes; ++i) + { + TDEFL_PUT_BITS(d->m_dict[(d->m_lz_code_buf_dict_pos + i) & TDEFL_LZ_DICT_SIZE_MASK], 8); + } + } + // Check for the extremely unlikely (if not impossible) case of the compressed block not fitting into the output buffer when using dynamic codes. + else if (!comp_block_succeeded) + { + d->m_pOutput_buf = pSaved_output_buf; d->m_bit_buffer = saved_bit_buf, d->m_bits_in = saved_bits_in; + tdefl_compress_block(d, MZ_TRUE); + } + + if (flush) + { + if (flush == TDEFL_FINISH) + { + if (d->m_bits_in) { TDEFL_PUT_BITS(0, 8 - d->m_bits_in); } + if (d->m_flags & TDEFL_WRITE_ZLIB_HEADER) { mz_uint i, a = d->m_adler32; for (i = 0; i < 4; i++) { TDEFL_PUT_BITS((a >> 24) & 0xFF, 8); a <<= 8; } } + } + else + { + mz_uint i, z = 0; TDEFL_PUT_BITS(0, 3); if (d->m_bits_in) { TDEFL_PUT_BITS(0, 8 - d->m_bits_in); } for (i = 2; i; --i, z ^= 0xFFFF) { TDEFL_PUT_BITS(z & 0xFFFF, 16); } + } + } + + MZ_ASSERT(d->m_pOutput_buf < d->m_pOutput_buf_end); + + memset(&d->m_huff_count[0][0], 0, sizeof(d->m_huff_count[0][0]) * TDEFL_MAX_HUFF_SYMBOLS_0); + memset(&d->m_huff_count[1][0], 0, sizeof(d->m_huff_count[1][0]) * TDEFL_MAX_HUFF_SYMBOLS_1); + + d->m_pLZ_code_buf = d->m_lz_code_buf + 1; d->m_pLZ_flags = d->m_lz_code_buf; d->m_num_flags_left = 8; d->m_lz_code_buf_dict_pos += d->m_total_lz_bytes; d->m_total_lz_bytes = 0; d->m_block_index++; + + if ((n = (int)(d->m_pOutput_buf - pOutput_buf_start)) != 0) + { + if (d->m_pPut_buf_func) + { + *d->m_pIn_buf_size = d->m_pSrc - (const mz_uint8 *)d->m_pIn_buf; + if (!(*d->m_pPut_buf_func)(d->m_output_buf, n, d->m_pPut_buf_user)) + return (d->m_prev_return_status = TDEFL_STATUS_PUT_BUF_FAILED); + } + else if (pOutput_buf_start == d->m_output_buf) + { + int bytes_to_copy = (int)MZ_MIN((size_t)n, (size_t)(*d->m_pOut_buf_size - d->m_out_buf_ofs)); + memcpy((mz_uint8 *)d->m_pOut_buf + d->m_out_buf_ofs, d->m_output_buf, bytes_to_copy); + d->m_out_buf_ofs += bytes_to_copy; + if ((n -= bytes_to_copy) != 0) + { + d->m_output_flush_ofs = bytes_to_copy; + d->m_output_flush_remaining = n; + } + } + else + { + d->m_out_buf_ofs += n; + } + } + + return d->m_output_flush_remaining; +} + +#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES +#define TDEFL_READ_UNALIGNED_WORD(p) *(const mz_uint16*)(p) +static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahead_pos, mz_uint max_dist, mz_uint max_match_len, mz_uint *pMatch_dist, mz_uint *pMatch_len) +{ + mz_uint dist, pos = lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK, match_len = *pMatch_len, probe_pos = pos, next_probe_pos, probe_len; + mz_uint num_probes_left = d->m_max_probes[match_len >= 32]; + const mz_uint16 *s = (const mz_uint16*)(d->m_dict + pos), *p, *q; + mz_uint16 c01 = TDEFL_READ_UNALIGNED_WORD(&d->m_dict[pos + match_len - 1]), s01 = TDEFL_READ_UNALIGNED_WORD(s); + MZ_ASSERT(max_match_len <= TDEFL_MAX_MATCH_LEN); if (max_match_len <= match_len) return; + for ( ; ; ) + { + for ( ; ; ) + { + if (--num_probes_left == 0) return; + #define TDEFL_PROBE \ + next_probe_pos = d->m_next[probe_pos]; \ + if ((!next_probe_pos) || ((dist = (mz_uint16)(lookahead_pos - next_probe_pos)) > max_dist)) return; \ + probe_pos = next_probe_pos & TDEFL_LZ_DICT_SIZE_MASK; \ + if (TDEFL_READ_UNALIGNED_WORD(&d->m_dict[probe_pos + match_len - 1]) == c01) break; + TDEFL_PROBE; TDEFL_PROBE; TDEFL_PROBE; + } + if (!dist) break; q = (const mz_uint16*)(d->m_dict + probe_pos); if (TDEFL_READ_UNALIGNED_WORD(q) != s01) continue; p = s; probe_len = 32; + do { } while ( (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && + (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (--probe_len > 0) ); + if (!probe_len) + { + *pMatch_dist = dist; *pMatch_len = MZ_MIN(max_match_len, TDEFL_MAX_MATCH_LEN); break; + } + else if ((probe_len = ((mz_uint)(p - s) * 2) + (mz_uint)(*(const mz_uint8*)p == *(const mz_uint8*)q)) > match_len) + { + *pMatch_dist = dist; if ((*pMatch_len = match_len = MZ_MIN(max_match_len, probe_len)) == max_match_len) break; + c01 = TDEFL_READ_UNALIGNED_WORD(&d->m_dict[pos + match_len - 1]); + } + } +} +#else +static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahead_pos, mz_uint max_dist, mz_uint max_match_len, mz_uint *pMatch_dist, mz_uint *pMatch_len) +{ + mz_uint dist, pos = lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK, match_len = *pMatch_len, probe_pos = pos, next_probe_pos, probe_len; + mz_uint num_probes_left = d->m_max_probes[match_len >= 32]; + const mz_uint8 *s = d->m_dict + pos, *p, *q; + mz_uint8 c0 = d->m_dict[pos + match_len], c1 = d->m_dict[pos + match_len - 1]; + MZ_ASSERT(max_match_len <= TDEFL_MAX_MATCH_LEN); if (max_match_len <= match_len) return; + for ( ; ; ) + { + for ( ; ; ) + { + if (--num_probes_left == 0) return; + #define TDEFL_PROBE \ + next_probe_pos = d->m_next[probe_pos]; \ + if ((!next_probe_pos) || ((dist = (mz_uint16)(lookahead_pos - next_probe_pos)) > max_dist)) return; \ + probe_pos = next_probe_pos & TDEFL_LZ_DICT_SIZE_MASK; \ + if ((d->m_dict[probe_pos + match_len] == c0) && (d->m_dict[probe_pos + match_len - 1] == c1)) break; + TDEFL_PROBE; TDEFL_PROBE; TDEFL_PROBE; + } + if (!dist) break; p = s; q = d->m_dict + probe_pos; for (probe_len = 0; probe_len < max_match_len; probe_len++) if (*p++ != *q++) break; + if (probe_len > match_len) + { + *pMatch_dist = dist; if ((*pMatch_len = match_len = probe_len) == max_match_len) return; + c0 = d->m_dict[pos + match_len]; c1 = d->m_dict[pos + match_len - 1]; + } + } +} +#endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES + +#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN +static mz_bool tdefl_compress_fast(tdefl_compressor *d) +{ + // Faster, minimally featured LZRW1-style match+parse loop with better register utilization. Intended for applications where raw throughput is valued more highly than ratio. + mz_uint lookahead_pos = d->m_lookahead_pos, lookahead_size = d->m_lookahead_size, dict_size = d->m_dict_size, total_lz_bytes = d->m_total_lz_bytes, num_flags_left = d->m_num_flags_left; + mz_uint8 *pLZ_code_buf = d->m_pLZ_code_buf, *pLZ_flags = d->m_pLZ_flags; + mz_uint cur_pos = lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK; + + while ((d->m_src_buf_left) || ((d->m_flush) && (lookahead_size))) + { + const mz_uint TDEFL_COMP_FAST_LOOKAHEAD_SIZE = 4096; + mz_uint dst_pos = (lookahead_pos + lookahead_size) & TDEFL_LZ_DICT_SIZE_MASK; + mz_uint num_bytes_to_process = (mz_uint)MZ_MIN(d->m_src_buf_left, TDEFL_COMP_FAST_LOOKAHEAD_SIZE - lookahead_size); + d->m_src_buf_left -= num_bytes_to_process; + lookahead_size += num_bytes_to_process; + + while (num_bytes_to_process) + { + mz_uint32 n = MZ_MIN(TDEFL_LZ_DICT_SIZE - dst_pos, num_bytes_to_process); + memcpy(d->m_dict + dst_pos, d->m_pSrc, n); + if (dst_pos < (TDEFL_MAX_MATCH_LEN - 1)) + memcpy(d->m_dict + TDEFL_LZ_DICT_SIZE + dst_pos, d->m_pSrc, MZ_MIN(n, (TDEFL_MAX_MATCH_LEN - 1) - dst_pos)); + d->m_pSrc += n; + dst_pos = (dst_pos + n) & TDEFL_LZ_DICT_SIZE_MASK; + num_bytes_to_process -= n; + } + + dict_size = MZ_MIN(TDEFL_LZ_DICT_SIZE - lookahead_size, dict_size); + if ((!d->m_flush) && (lookahead_size < TDEFL_COMP_FAST_LOOKAHEAD_SIZE)) break; + + while (lookahead_size >= 4) + { + mz_uint cur_match_dist, cur_match_len = 1; + mz_uint8 *pCur_dict = d->m_dict + cur_pos; + mz_uint first_trigram = (*(const mz_uint32 *)pCur_dict) & 0xFFFFFF; + mz_uint hash = (first_trigram ^ (first_trigram >> (24 - (TDEFL_LZ_HASH_BITS - 8)))) & TDEFL_LEVEL1_HASH_SIZE_MASK; + mz_uint probe_pos = d->m_hash[hash]; + d->m_hash[hash] = (mz_uint16)lookahead_pos; + + if (((cur_match_dist = (mz_uint16)(lookahead_pos - probe_pos)) <= dict_size) && ((*(const mz_uint32 *)(d->m_dict + (probe_pos &= TDEFL_LZ_DICT_SIZE_MASK)) & 0xFFFFFF) == first_trigram)) + { + const mz_uint16 *p = (const mz_uint16 *)pCur_dict; + const mz_uint16 *q = (const mz_uint16 *)(d->m_dict + probe_pos); + mz_uint32 probe_len = 32; + do { } while ( (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && + (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (--probe_len > 0) ); + cur_match_len = ((mz_uint)(p - (const mz_uint16 *)pCur_dict) * 2) + (mz_uint)(*(const mz_uint8 *)p == *(const mz_uint8 *)q); + if (!probe_len) + cur_match_len = cur_match_dist ? TDEFL_MAX_MATCH_LEN : 0; + + if ((cur_match_len < TDEFL_MIN_MATCH_LEN) || ((cur_match_len == TDEFL_MIN_MATCH_LEN) && (cur_match_dist >= 8U*1024U))) + { + cur_match_len = 1; + *pLZ_code_buf++ = (mz_uint8)first_trigram; + *pLZ_flags = (mz_uint8)(*pLZ_flags >> 1); + d->m_huff_count[0][(mz_uint8)first_trigram]++; + } + else + { + mz_uint32 s0, s1; + cur_match_len = MZ_MIN(cur_match_len, lookahead_size); + + MZ_ASSERT((cur_match_len >= TDEFL_MIN_MATCH_LEN) && (cur_match_dist >= 1) && (cur_match_dist <= TDEFL_LZ_DICT_SIZE)); + + cur_match_dist--; + + pLZ_code_buf[0] = (mz_uint8)(cur_match_len - TDEFL_MIN_MATCH_LEN); + *(mz_uint16 *)(&pLZ_code_buf[1]) = (mz_uint16)cur_match_dist; + pLZ_code_buf += 3; + *pLZ_flags = (mz_uint8)((*pLZ_flags >> 1) | 0x80); + + s0 = s_tdefl_small_dist_sym[cur_match_dist & 511]; + s1 = s_tdefl_large_dist_sym[cur_match_dist >> 8]; + d->m_huff_count[1][(cur_match_dist < 512) ? s0 : s1]++; + + d->m_huff_count[0][s_tdefl_len_sym[cur_match_len - TDEFL_MIN_MATCH_LEN]]++; + } + } + else + { + *pLZ_code_buf++ = (mz_uint8)first_trigram; + *pLZ_flags = (mz_uint8)(*pLZ_flags >> 1); + d->m_huff_count[0][(mz_uint8)first_trigram]++; + } + + if (--num_flags_left == 0) { num_flags_left = 8; pLZ_flags = pLZ_code_buf++; } + + total_lz_bytes += cur_match_len; + lookahead_pos += cur_match_len; + dict_size = MZ_MIN(dict_size + cur_match_len, TDEFL_LZ_DICT_SIZE); + cur_pos = (cur_pos + cur_match_len) & TDEFL_LZ_DICT_SIZE_MASK; + MZ_ASSERT(lookahead_size >= cur_match_len); + lookahead_size -= cur_match_len; + + if (pLZ_code_buf > &d->m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE - 8]) + { + int n; + d->m_lookahead_pos = lookahead_pos; d->m_lookahead_size = lookahead_size; d->m_dict_size = dict_size; + d->m_total_lz_bytes = total_lz_bytes; d->m_pLZ_code_buf = pLZ_code_buf; d->m_pLZ_flags = pLZ_flags; d->m_num_flags_left = num_flags_left; + if ((n = tdefl_flush_block(d, 0)) != 0) + return (n < 0) ? MZ_FALSE : MZ_TRUE; + total_lz_bytes = d->m_total_lz_bytes; pLZ_code_buf = d->m_pLZ_code_buf; pLZ_flags = d->m_pLZ_flags; num_flags_left = d->m_num_flags_left; + } + } + + while (lookahead_size) + { + mz_uint8 lit = d->m_dict[cur_pos]; + + total_lz_bytes++; + *pLZ_code_buf++ = lit; + *pLZ_flags = (mz_uint8)(*pLZ_flags >> 1); + if (--num_flags_left == 0) { num_flags_left = 8; pLZ_flags = pLZ_code_buf++; } + + d->m_huff_count[0][lit]++; + + lookahead_pos++; + dict_size = MZ_MIN(dict_size + 1, TDEFL_LZ_DICT_SIZE); + cur_pos = (cur_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK; + lookahead_size--; + + if (pLZ_code_buf > &d->m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE - 8]) + { + int n; + d->m_lookahead_pos = lookahead_pos; d->m_lookahead_size = lookahead_size; d->m_dict_size = dict_size; + d->m_total_lz_bytes = total_lz_bytes; d->m_pLZ_code_buf = pLZ_code_buf; d->m_pLZ_flags = pLZ_flags; d->m_num_flags_left = num_flags_left; + if ((n = tdefl_flush_block(d, 0)) != 0) + return (n < 0) ? MZ_FALSE : MZ_TRUE; + total_lz_bytes = d->m_total_lz_bytes; pLZ_code_buf = d->m_pLZ_code_buf; pLZ_flags = d->m_pLZ_flags; num_flags_left = d->m_num_flags_left; + } + } + } + + d->m_lookahead_pos = lookahead_pos; d->m_lookahead_size = lookahead_size; d->m_dict_size = dict_size; + d->m_total_lz_bytes = total_lz_bytes; d->m_pLZ_code_buf = pLZ_code_buf; d->m_pLZ_flags = pLZ_flags; d->m_num_flags_left = num_flags_left; + return MZ_TRUE; +} +#endif // MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN + +static MZ_FORCEINLINE void tdefl_record_literal(tdefl_compressor *d, mz_uint8 lit) +{ + d->m_total_lz_bytes++; + *d->m_pLZ_code_buf++ = lit; + *d->m_pLZ_flags = (mz_uint8)(*d->m_pLZ_flags >> 1); if (--d->m_num_flags_left == 0) { d->m_num_flags_left = 8; d->m_pLZ_flags = d->m_pLZ_code_buf++; } + d->m_huff_count[0][lit]++; +} + +static MZ_FORCEINLINE void tdefl_record_match(tdefl_compressor *d, mz_uint match_len, mz_uint match_dist) +{ + mz_uint32 s0, s1; + + MZ_ASSERT((match_len >= TDEFL_MIN_MATCH_LEN) && (match_dist >= 1) && (match_dist <= TDEFL_LZ_DICT_SIZE)); + + d->m_total_lz_bytes += match_len; + + d->m_pLZ_code_buf[0] = (mz_uint8)(match_len - TDEFL_MIN_MATCH_LEN); + + match_dist -= 1; + d->m_pLZ_code_buf[1] = (mz_uint8)(match_dist & 0xFF); + d->m_pLZ_code_buf[2] = (mz_uint8)(match_dist >> 8); d->m_pLZ_code_buf += 3; + + *d->m_pLZ_flags = (mz_uint8)((*d->m_pLZ_flags >> 1) | 0x80); if (--d->m_num_flags_left == 0) { d->m_num_flags_left = 8; d->m_pLZ_flags = d->m_pLZ_code_buf++; } + + s0 = s_tdefl_small_dist_sym[match_dist & 511]; s1 = s_tdefl_large_dist_sym[(match_dist >> 8) & 127]; + d->m_huff_count[1][(match_dist < 512) ? s0 : s1]++; + + if (match_len >= TDEFL_MIN_MATCH_LEN) d->m_huff_count[0][s_tdefl_len_sym[match_len - TDEFL_MIN_MATCH_LEN]]++; +} + +static mz_bool tdefl_compress_normal(tdefl_compressor *d) +{ + const mz_uint8 *pSrc = d->m_pSrc; size_t src_buf_left = d->m_src_buf_left; + tdefl_flush flush = d->m_flush; + + while ((src_buf_left) || ((flush) && (d->m_lookahead_size))) + { + mz_uint len_to_move, cur_match_dist, cur_match_len, cur_pos; + // Update dictionary and hash chains. Keeps the lookahead size equal to TDEFL_MAX_MATCH_LEN. + if ((d->m_lookahead_size + d->m_dict_size) >= (TDEFL_MIN_MATCH_LEN - 1)) + { + mz_uint dst_pos = (d->m_lookahead_pos + d->m_lookahead_size) & TDEFL_LZ_DICT_SIZE_MASK, ins_pos = d->m_lookahead_pos + d->m_lookahead_size - 2; + mz_uint hash = (d->m_dict[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] << TDEFL_LZ_HASH_SHIFT) ^ d->m_dict[(ins_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK]; + mz_uint num_bytes_to_process = (mz_uint)MZ_MIN(src_buf_left, TDEFL_MAX_MATCH_LEN - d->m_lookahead_size); + const mz_uint8 *pSrc_end = pSrc + num_bytes_to_process; + src_buf_left -= num_bytes_to_process; + d->m_lookahead_size += num_bytes_to_process; + while (pSrc != pSrc_end) + { + mz_uint8 c = *pSrc++; d->m_dict[dst_pos] = c; if (dst_pos < (TDEFL_MAX_MATCH_LEN - 1)) d->m_dict[TDEFL_LZ_DICT_SIZE + dst_pos] = c; + hash = ((hash << TDEFL_LZ_HASH_SHIFT) ^ c) & (TDEFL_LZ_HASH_SIZE - 1); + d->m_next[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] = d->m_hash[hash]; d->m_hash[hash] = (mz_uint16)(ins_pos); + dst_pos = (dst_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK; ins_pos++; + } + } + else + { + while ((src_buf_left) && (d->m_lookahead_size < TDEFL_MAX_MATCH_LEN)) + { + mz_uint8 c = *pSrc++; + mz_uint dst_pos = (d->m_lookahead_pos + d->m_lookahead_size) & TDEFL_LZ_DICT_SIZE_MASK; + src_buf_left--; + d->m_dict[dst_pos] = c; + if (dst_pos < (TDEFL_MAX_MATCH_LEN - 1)) + d->m_dict[TDEFL_LZ_DICT_SIZE + dst_pos] = c; + if ((++d->m_lookahead_size + d->m_dict_size) >= TDEFL_MIN_MATCH_LEN) + { + mz_uint ins_pos = d->m_lookahead_pos + (d->m_lookahead_size - 1) - 2; + mz_uint hash = ((d->m_dict[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] << (TDEFL_LZ_HASH_SHIFT * 2)) ^ (d->m_dict[(ins_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK] << TDEFL_LZ_HASH_SHIFT) ^ c) & (TDEFL_LZ_HASH_SIZE - 1); + d->m_next[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] = d->m_hash[hash]; d->m_hash[hash] = (mz_uint16)(ins_pos); + } + } + } + d->m_dict_size = MZ_MIN(TDEFL_LZ_DICT_SIZE - d->m_lookahead_size, d->m_dict_size); + if ((!flush) && (d->m_lookahead_size < TDEFL_MAX_MATCH_LEN)) + break; + + // Simple lazy/greedy parsing state machine. + len_to_move = 1; cur_match_dist = 0; cur_match_len = d->m_saved_match_len ? d->m_saved_match_len : (TDEFL_MIN_MATCH_LEN - 1); cur_pos = d->m_lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK; + if (d->m_flags & (TDEFL_RLE_MATCHES | TDEFL_FORCE_ALL_RAW_BLOCKS)) + { + if ((d->m_dict_size) && (!(d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS))) + { + mz_uint8 c = d->m_dict[(cur_pos - 1) & TDEFL_LZ_DICT_SIZE_MASK]; + cur_match_len = 0; while (cur_match_len < d->m_lookahead_size) { if (d->m_dict[cur_pos + cur_match_len] != c) break; cur_match_len++; } + if (cur_match_len < TDEFL_MIN_MATCH_LEN) cur_match_len = 0; else cur_match_dist = 1; + } + } + else + { + tdefl_find_match(d, d->m_lookahead_pos, d->m_dict_size, d->m_lookahead_size, &cur_match_dist, &cur_match_len); + } + if (((cur_match_len == TDEFL_MIN_MATCH_LEN) && (cur_match_dist >= 8U*1024U)) || (cur_pos == cur_match_dist) || ((d->m_flags & TDEFL_FILTER_MATCHES) && (cur_match_len <= 5))) + { + cur_match_dist = cur_match_len = 0; + } + if (d->m_saved_match_len) + { + if (cur_match_len > d->m_saved_match_len) + { + tdefl_record_literal(d, (mz_uint8)d->m_saved_lit); + if (cur_match_len >= 128) + { + tdefl_record_match(d, cur_match_len, cur_match_dist); + d->m_saved_match_len = 0; len_to_move = cur_match_len; + } + else + { + d->m_saved_lit = d->m_dict[cur_pos]; d->m_saved_match_dist = cur_match_dist; d->m_saved_match_len = cur_match_len; + } + } + else + { + tdefl_record_match(d, d->m_saved_match_len, d->m_saved_match_dist); + len_to_move = d->m_saved_match_len - 1; d->m_saved_match_len = 0; + } + } + else if (!cur_match_dist) + tdefl_record_literal(d, d->m_dict[MZ_MIN(cur_pos, sizeof(d->m_dict) - 1)]); + else if ((d->m_greedy_parsing) || (d->m_flags & TDEFL_RLE_MATCHES) || (cur_match_len >= 128)) + { + tdefl_record_match(d, cur_match_len, cur_match_dist); + len_to_move = cur_match_len; + } + else + { + d->m_saved_lit = d->m_dict[MZ_MIN(cur_pos, sizeof(d->m_dict) - 1)]; d->m_saved_match_dist = cur_match_dist; d->m_saved_match_len = cur_match_len; + } + // Move the lookahead forward by len_to_move bytes. + d->m_lookahead_pos += len_to_move; + MZ_ASSERT(d->m_lookahead_size >= len_to_move); + d->m_lookahead_size -= len_to_move; + d->m_dict_size = MZ_MIN(d->m_dict_size + len_to_move, TDEFL_LZ_DICT_SIZE); + // Check if it's time to flush the current LZ codes to the internal output buffer. + if ( (d->m_pLZ_code_buf > &d->m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE - 8]) || + ( (d->m_total_lz_bytes > 31*1024) && (((((mz_uint)(d->m_pLZ_code_buf - d->m_lz_code_buf) * 115) >> 7) >= d->m_total_lz_bytes) || (d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS))) ) + { + int n; + d->m_pSrc = pSrc; d->m_src_buf_left = src_buf_left; + if ((n = tdefl_flush_block(d, 0)) != 0) + return (n < 0) ? MZ_FALSE : MZ_TRUE; + } + } + + d->m_pSrc = pSrc; d->m_src_buf_left = src_buf_left; + return MZ_TRUE; +} + +static tdefl_status tdefl_flush_output_buffer(tdefl_compressor *d) +{ + if (d->m_pIn_buf_size) + { + *d->m_pIn_buf_size = d->m_pSrc - (const mz_uint8 *)d->m_pIn_buf; + } + + if (d->m_pOut_buf_size) + { + size_t n = MZ_MIN(*d->m_pOut_buf_size - d->m_out_buf_ofs, d->m_output_flush_remaining); + memcpy((mz_uint8 *)d->m_pOut_buf + d->m_out_buf_ofs, d->m_output_buf + d->m_output_flush_ofs, n); + d->m_output_flush_ofs += (mz_uint)n; + d->m_output_flush_remaining -= (mz_uint)n; + d->m_out_buf_ofs += n; + + *d->m_pOut_buf_size = d->m_out_buf_ofs; + } + + return (d->m_finished && !d->m_output_flush_remaining) ? TDEFL_STATUS_DONE : TDEFL_STATUS_OKAY; +} + +tdefl_status tdefl_compress(tdefl_compressor *d, const void *pIn_buf, size_t *pIn_buf_size, void *pOut_buf, size_t *pOut_buf_size, tdefl_flush flush) +{ + if (!d) + { + if (pIn_buf_size) *pIn_buf_size = 0; + if (pOut_buf_size) *pOut_buf_size = 0; + return TDEFL_STATUS_BAD_PARAM; + } + + d->m_pIn_buf = pIn_buf; d->m_pIn_buf_size = pIn_buf_size; + d->m_pOut_buf = pOut_buf; d->m_pOut_buf_size = pOut_buf_size; + d->m_pSrc = (const mz_uint8 *)(pIn_buf); d->m_src_buf_left = pIn_buf_size ? *pIn_buf_size : 0; + d->m_out_buf_ofs = 0; + d->m_flush = flush; + + if ( ((d->m_pPut_buf_func != NULL) == ((pOut_buf != NULL) || (pOut_buf_size != NULL))) || (d->m_prev_return_status != TDEFL_STATUS_OKAY) || + (d->m_wants_to_finish && (flush != TDEFL_FINISH)) || (pIn_buf_size && *pIn_buf_size && !pIn_buf) || (pOut_buf_size && *pOut_buf_size && !pOut_buf) ) + { + if (pIn_buf_size) *pIn_buf_size = 0; + if (pOut_buf_size) *pOut_buf_size = 0; + return (d->m_prev_return_status = TDEFL_STATUS_BAD_PARAM); + } + d->m_wants_to_finish |= (flush == TDEFL_FINISH); + + if ((d->m_output_flush_remaining) || (d->m_finished)) + return (d->m_prev_return_status = tdefl_flush_output_buffer(d)); + +#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN + if (((d->m_flags & TDEFL_MAX_PROBES_MASK) == 1) && + ((d->m_flags & TDEFL_GREEDY_PARSING_FLAG) != 0) && + ((d->m_flags & (TDEFL_FILTER_MATCHES | TDEFL_FORCE_ALL_RAW_BLOCKS | TDEFL_RLE_MATCHES)) == 0)) + { + if (!tdefl_compress_fast(d)) + return d->m_prev_return_status; + } + else +#endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN + { + if (!tdefl_compress_normal(d)) + return d->m_prev_return_status; + } + + if ((d->m_flags & (TDEFL_WRITE_ZLIB_HEADER | TDEFL_COMPUTE_ADLER32)) && (pIn_buf)) + d->m_adler32 = (mz_uint32)mz_adler32(d->m_adler32, (const mz_uint8 *)pIn_buf, d->m_pSrc - (const mz_uint8 *)pIn_buf); + + if ((flush) && (!d->m_lookahead_size) && (!d->m_src_buf_left) && (!d->m_output_flush_remaining)) + { + if (tdefl_flush_block(d, flush) < 0) + return d->m_prev_return_status; + d->m_finished = (flush == TDEFL_FINISH); + if (flush == TDEFL_FULL_FLUSH) { MZ_CLEAR_OBJ(d->m_hash); MZ_CLEAR_OBJ(d->m_next); d->m_dict_size = 0; } + } + + return (d->m_prev_return_status = tdefl_flush_output_buffer(d)); +} + +tdefl_status tdefl_compress_buffer(tdefl_compressor *d, const void *pIn_buf, size_t in_buf_size, tdefl_flush flush) +{ + MZ_ASSERT(d->m_pPut_buf_func); return tdefl_compress(d, pIn_buf, &in_buf_size, NULL, NULL, flush); +} + +tdefl_status tdefl_init(tdefl_compressor *d, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags) +{ + d->m_pPut_buf_func = pPut_buf_func; d->m_pPut_buf_user = pPut_buf_user; + d->m_flags = (mz_uint)(flags); d->m_max_probes[0] = 1 + ((flags & 0xFFF) + 2) / 3; d->m_greedy_parsing = (flags & TDEFL_GREEDY_PARSING_FLAG) != 0; + d->m_max_probes[1] = 1 + (((flags & 0xFFF) >> 2) + 2) / 3; + if (!(flags & TDEFL_NONDETERMINISTIC_PARSING_FLAG)) MZ_CLEAR_OBJ(d->m_hash); + d->m_lookahead_pos = d->m_lookahead_size = d->m_dict_size = d->m_total_lz_bytes = d->m_lz_code_buf_dict_pos = d->m_bits_in = 0; + d->m_output_flush_ofs = d->m_output_flush_remaining = d->m_finished = d->m_block_index = d->m_bit_buffer = d->m_wants_to_finish = 0; + d->m_pLZ_code_buf = d->m_lz_code_buf + 1; d->m_pLZ_flags = d->m_lz_code_buf; d->m_num_flags_left = 8; + d->m_pOutput_buf = d->m_output_buf; d->m_pOutput_buf_end = d->m_output_buf; d->m_prev_return_status = TDEFL_STATUS_OKAY; + d->m_saved_match_dist = d->m_saved_match_len = d->m_saved_lit = 0; d->m_adler32 = 1; + d->m_pIn_buf = NULL; d->m_pOut_buf = NULL; + d->m_pIn_buf_size = NULL; d->m_pOut_buf_size = NULL; + d->m_flush = TDEFL_NO_FLUSH; d->m_pSrc = NULL; d->m_src_buf_left = 0; d->m_out_buf_ofs = 0; + memset(&d->m_huff_count[0][0], 0, sizeof(d->m_huff_count[0][0]) * TDEFL_MAX_HUFF_SYMBOLS_0); + memset(&d->m_huff_count[1][0], 0, sizeof(d->m_huff_count[1][0]) * TDEFL_MAX_HUFF_SYMBOLS_1); + return TDEFL_STATUS_OKAY; +} + +tdefl_status tdefl_get_prev_return_status(tdefl_compressor *d) +{ + return d->m_prev_return_status; +} + +mz_uint32 tdefl_get_adler32(tdefl_compressor *d) +{ + return d->m_adler32; +} + +mz_bool tdefl_compress_mem_to_output(const void *pBuf, size_t buf_len, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags) +{ + tdefl_compressor *pComp; mz_bool succeeded; if (((buf_len) && (!pBuf)) || (!pPut_buf_func)) return MZ_FALSE; + pComp = (tdefl_compressor*)MZ_MALLOC(sizeof(tdefl_compressor)); if (!pComp) return MZ_FALSE; + succeeded = (tdefl_init(pComp, pPut_buf_func, pPut_buf_user, flags) == TDEFL_STATUS_OKAY); + succeeded = succeeded && (tdefl_compress_buffer(pComp, pBuf, buf_len, TDEFL_FINISH) == TDEFL_STATUS_DONE); + MZ_FREE(pComp); return succeeded; +} + +struct tdefl_output_buffer +{ + size_t m_size, m_capacity; + mz_uint8 *m_pBuf; + mz_bool m_expandable; +}; + +static mz_bool tdefl_output_buffer_putter(const void *pBuf, int len, void *pUser) +{ + tdefl_output_buffer *p = (tdefl_output_buffer *)pUser; + size_t new_size = p->m_size + len; + if (new_size > p->m_capacity) + { + size_t new_capacity = p->m_capacity; mz_uint8 *pNew_buf; if (!p->m_expandable) return MZ_FALSE; + do { new_capacity = MZ_MAX(128U, new_capacity << 1U); } while (new_size > new_capacity); + pNew_buf = (mz_uint8*)MZ_REALLOC(p->m_pBuf, new_capacity); if (!pNew_buf) return MZ_FALSE; + p->m_pBuf = pNew_buf; p->m_capacity = new_capacity; + } + memcpy((mz_uint8*)p->m_pBuf + p->m_size, pBuf, len); p->m_size = new_size; + return MZ_TRUE; +} + +void *tdefl_compress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags) +{ + tdefl_output_buffer out_buf; MZ_CLEAR_OBJ(out_buf); + if (!pOut_len) return MZ_FALSE; else *pOut_len = 0; + out_buf.m_expandable = MZ_TRUE; + if (!tdefl_compress_mem_to_output(pSrc_buf, src_buf_len, tdefl_output_buffer_putter, &out_buf, flags)) return NULL; + *pOut_len = out_buf.m_size; return out_buf.m_pBuf; +} + +size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags) +{ + tdefl_output_buffer out_buf; MZ_CLEAR_OBJ(out_buf); + if (!pOut_buf) return 0; + out_buf.m_pBuf = (mz_uint8*)pOut_buf; out_buf.m_capacity = out_buf_len; + if (!tdefl_compress_mem_to_output(pSrc_buf, src_buf_len, tdefl_output_buffer_putter, &out_buf, flags)) return 0; + return out_buf.m_size; +} + +#ifndef MINIZ_NO_ZLIB_APIS +static const mz_uint s_tdefl_num_probes[11] = { 0, 1, 6, 32, 16, 32, 128, 256, 512, 768, 1500 }; + +// level may actually range from [0,10] (10 is a "hidden" max level, where we want a bit more compression and it's fine if throughput to fall off a cliff on some files). +mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, int strategy) +{ + mz_uint comp_flags = s_tdefl_num_probes[(level >= 0) ? MZ_MIN(10, level) : MZ_DEFAULT_LEVEL] | ((level <= 3) ? TDEFL_GREEDY_PARSING_FLAG : 0); + if (window_bits > 0) comp_flags |= TDEFL_WRITE_ZLIB_HEADER; + + if (!level) comp_flags |= TDEFL_FORCE_ALL_RAW_BLOCKS; + else if (strategy == MZ_FILTERED) comp_flags |= TDEFL_FILTER_MATCHES; + else if (strategy == MZ_HUFFMAN_ONLY) comp_flags &= ~TDEFL_MAX_PROBES_MASK; + else if (strategy == MZ_FIXED) comp_flags |= TDEFL_FORCE_ALL_STATIC_BLOCKS; + else if (strategy == MZ_RLE) comp_flags |= TDEFL_RLE_MATCHES; + + return comp_flags; +} +#endif //MINIZ_NO_ZLIB_APIS + +#ifdef _MSC_VER +#pragma warning (push) +#pragma warning (disable:4204) // nonstandard extension used : non-constant aggregate initializer (also supported by GNU C and C99, so no big deal) +#endif + +// Simple PNG writer function by Alex Evans, 2011. Released into the public domain: https://gist.github.com/908299, more context at +// http://altdevblogaday.org/2011/04/06/a-smaller-jpg-encoder/. +void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, int num_chans, size_t *pLen_out) +{ + tdefl_compressor *pComp = (tdefl_compressor *)MZ_MALLOC(sizeof(tdefl_compressor)); tdefl_output_buffer out_buf; int i, bpl = w * num_chans, y, z; mz_uint32 c; *pLen_out = 0; + if (!pComp) return NULL; + MZ_CLEAR_OBJ(out_buf); out_buf.m_expandable = MZ_TRUE; out_buf.m_capacity = 57+MZ_MAX(64, (1+bpl)*h); if (NULL == (out_buf.m_pBuf = (mz_uint8*)MZ_MALLOC(out_buf.m_capacity))) { MZ_FREE(pComp); return NULL; } + // write dummy header + for (z = 41; z; --z) tdefl_output_buffer_putter(&z, 1, &out_buf); + // compress image data + tdefl_init(pComp, tdefl_output_buffer_putter, &out_buf, TDEFL_DEFAULT_MAX_PROBES | TDEFL_WRITE_ZLIB_HEADER); + for (y = 0; y < h; ++y) { tdefl_compress_buffer(pComp, &z, 1, TDEFL_NO_FLUSH); tdefl_compress_buffer(pComp, (mz_uint8*)pImage + y * bpl, bpl, TDEFL_NO_FLUSH); } + if (tdefl_compress_buffer(pComp, NULL, 0, TDEFL_FINISH) != TDEFL_STATUS_DONE) { MZ_FREE(pComp); MZ_FREE(out_buf.m_pBuf); return NULL; } + // write real header + *pLen_out = out_buf.m_size-41; + { + mz_uint8 pnghdr[41]={0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48,0x44,0x52, + 0,0,(mz_uint8)(w>>8),(mz_uint8)w,0,0,(mz_uint8)(h>>8),(mz_uint8)h,8,"\0\0\04\02\06"[num_chans],0,0,0,0,0,0,0, + (mz_uint8)(*pLen_out>>24),(mz_uint8)(*pLen_out>>16),(mz_uint8)(*pLen_out>>8),(mz_uint8)*pLen_out,0x49,0x44,0x41,0x54}; + c=(mz_uint32)mz_crc32(MZ_CRC32_INIT,pnghdr+12,17); for (i=0; i<4; ++i, c<<=8) ((mz_uint8*)(pnghdr+29))[i]=(mz_uint8)(c>>24); + memcpy(out_buf.m_pBuf, pnghdr, 41); + } + // write footer (IDAT CRC-32, followed by IEND chunk) + if (!tdefl_output_buffer_putter("\0\0\0\0\0\0\0\0\x49\x45\x4e\x44\xae\x42\x60\x82", 16, &out_buf)) { *pLen_out = 0; MZ_FREE(pComp); MZ_FREE(out_buf.m_pBuf); return NULL; } + c = (mz_uint32)mz_crc32(MZ_CRC32_INIT,out_buf.m_pBuf+41-4, *pLen_out+4); for (i=0; i<4; ++i, c<<=8) (out_buf.m_pBuf+out_buf.m_size-16)[i] = (mz_uint8)(c >> 24); + // compute final size of file, grab compressed data buffer and return + *pLen_out += 57; MZ_FREE(pComp); return out_buf.m_pBuf; +} + +#ifdef _MSC_VER +#pragma warning (pop) +#endif + +// ------------------- .ZIP archive reading + +#ifndef MINIZ_NO_ARCHIVE_APIS + +#ifdef MINIZ_NO_STDIO + #define MZ_FILE void * +#else + #include + #include + + #if defined(_MSC_VER) + static FILE *mz_fopen(const char *pFilename, const char *pMode) + { + FILE* pFile = NULL; + fopen_s(&pFile, pFilename, pMode); + return pFile; + } + static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream) + { + FILE* pFile = NULL; + if (freopen_s(&pFile, pPath, pMode, pStream)) + return NULL; + return pFile; + } + #else + static FILE *mz_fopen(const char *pFilename, const char *pMode) + { + return fopen(pFilename, pMode); + } + static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream) + { + return freopen(pPath, pMode, pStream); + } + #endif // #if defined(_MSC_VER) + + #if defined(_MSC_VER) || defined(__MINGW64__) + #ifndef MINIZ_NO_TIME + #include + #endif + #define MZ_FILE FILE + #define MZ_FOPEN mz_fopen + #define MZ_FCLOSE fclose + #define MZ_FREAD fread + #define MZ_FWRITE fwrite + #define MZ_FTELL64 _ftelli64 + #define MZ_FSEEK64 _fseeki64 + #define MZ_FILE_STAT_STRUCT _stat + #define MZ_FILE_STAT _stat + #define MZ_FFLUSH fflush + #define MZ_FREOPEN mz_freopen + #define MZ_DELETE_FILE remove + #elif defined(__MINGW32__) + #ifndef MINIZ_NO_TIME + #include + #endif + #define MZ_FILE FILE + #define MZ_FOPEN mz_fopen + #define MZ_FCLOSE fclose + #define MZ_FREAD fread + #define MZ_FWRITE fwrite + #define MZ_FTELL64 ftello64 + #define MZ_FSEEK64 fseeko64 + #define MZ_FILE_STAT_STRUCT _stat + #define MZ_FILE_STAT _stat + #define MZ_FFLUSH fflush + #define MZ_FREOPEN mz_freopen + #define MZ_DELETE_FILE remove + #elif defined(__TINYC__) + #ifndef MINIZ_NO_TIME + #include + #endif + #define MZ_FILE FILE + #define MZ_FOPEN mz_fopen + #define MZ_FCLOSE fclose + #define MZ_FREAD fread + #define MZ_FWRITE fwrite + #define MZ_FTELL64 ftell + #define MZ_FSEEK64 fseek + #define MZ_FILE_STAT_STRUCT stat + #define MZ_FILE_STAT stat + #define MZ_FFLUSH fflush + #define MZ_FREOPEN mz_freopen + #define MZ_DELETE_FILE remove + #else + #ifndef MINIZ_NO_TIME + #include + #endif + #define MZ_FILE FILE + #define MZ_FOPEN mz_fopen + #define MZ_FCLOSE fclose + #define MZ_FREAD fread + #define MZ_FWRITE fwrite + #define MZ_FTELL64 ftello + #define MZ_FSEEK64 fseeko + #define MZ_FILE_STAT_STRUCT stat + #define MZ_FILE_STAT stat + #define MZ_FFLUSH fflush + #define MZ_FREOPEN mz_freopen + #define MZ_DELETE_FILE remove + #endif // #ifdef _MSC_VER +#endif // #ifdef MINIZ_NO_STDIO + +#define MZ_TOLOWER(c) ((((c) >= 'A') && ((c) <= 'Z')) ? ((c) - 'A' + 'a') : (c)) + +// Various ZIP archive enums. To completely avoid cross platform compiler alignment and platform endian issues, miniz.c doesn't use structs for any of this stuff. +enum +{ + // ZIP archive identifiers and record sizes + MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG = 0x06054b50, MZ_ZIP_CENTRAL_DIR_HEADER_SIG = 0x02014b50, MZ_ZIP_LOCAL_DIR_HEADER_SIG = 0x04034b50, + MZ_ZIP_LOCAL_DIR_HEADER_SIZE = 30, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE = 46, MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE = 22, + // Central directory header record offsets + MZ_ZIP_CDH_SIG_OFS = 0, MZ_ZIP_CDH_VERSION_MADE_BY_OFS = 4, MZ_ZIP_CDH_VERSION_NEEDED_OFS = 6, MZ_ZIP_CDH_BIT_FLAG_OFS = 8, + MZ_ZIP_CDH_METHOD_OFS = 10, MZ_ZIP_CDH_FILE_TIME_OFS = 12, MZ_ZIP_CDH_FILE_DATE_OFS = 14, MZ_ZIP_CDH_CRC32_OFS = 16, + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS = 20, MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS = 24, MZ_ZIP_CDH_FILENAME_LEN_OFS = 28, MZ_ZIP_CDH_EXTRA_LEN_OFS = 30, + MZ_ZIP_CDH_COMMENT_LEN_OFS = 32, MZ_ZIP_CDH_DISK_START_OFS = 34, MZ_ZIP_CDH_INTERNAL_ATTR_OFS = 36, MZ_ZIP_CDH_EXTERNAL_ATTR_OFS = 38, MZ_ZIP_CDH_LOCAL_HEADER_OFS = 42, + // Local directory header offsets + MZ_ZIP_LDH_SIG_OFS = 0, MZ_ZIP_LDH_VERSION_NEEDED_OFS = 4, MZ_ZIP_LDH_BIT_FLAG_OFS = 6, MZ_ZIP_LDH_METHOD_OFS = 8, MZ_ZIP_LDH_FILE_TIME_OFS = 10, + MZ_ZIP_LDH_FILE_DATE_OFS = 12, MZ_ZIP_LDH_CRC32_OFS = 14, MZ_ZIP_LDH_COMPRESSED_SIZE_OFS = 18, MZ_ZIP_LDH_DECOMPRESSED_SIZE_OFS = 22, + MZ_ZIP_LDH_FILENAME_LEN_OFS = 26, MZ_ZIP_LDH_EXTRA_LEN_OFS = 28, + // End of central directory offsets + MZ_ZIP_ECDH_SIG_OFS = 0, MZ_ZIP_ECDH_NUM_THIS_DISK_OFS = 4, MZ_ZIP_ECDH_NUM_DISK_CDIR_OFS = 6, MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS = 8, + MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS = 10, MZ_ZIP_ECDH_CDIR_SIZE_OFS = 12, MZ_ZIP_ECDH_CDIR_OFS_OFS = 16, MZ_ZIP_ECDH_COMMENT_SIZE_OFS = 20, +}; + +typedef struct +{ + void *m_p; + size_t m_size, m_capacity; + mz_uint m_element_size; +} mz_zip_array; + +struct mz_zip_internal_state_tag +{ + mz_zip_array m_central_dir; + mz_zip_array m_central_dir_offsets; + mz_zip_array m_sorted_central_dir_offsets; + MZ_FILE *m_pFile; + void *m_pMem; + size_t m_mem_size; + size_t m_mem_capacity; +}; + +#define MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(array_ptr, element_size) (array_ptr)->m_element_size = element_size +#define MZ_ZIP_ARRAY_ELEMENT(array_ptr, element_type, index) ((element_type *)((array_ptr)->m_p))[index] + +static MZ_FORCEINLINE void mz_zip_array_clear(mz_zip_archive *pZip, mz_zip_array *pArray) +{ + pZip->m_pFree(pZip->m_pAlloc_opaque, pArray->m_p); + memset(pArray, 0, sizeof(mz_zip_array)); +} + +static mz_bool mz_zip_array_ensure_capacity(mz_zip_archive *pZip, mz_zip_array *pArray, size_t min_new_capacity, mz_uint growing) +{ + void *pNew_p; size_t new_capacity = min_new_capacity; MZ_ASSERT(pArray->m_element_size); if (pArray->m_capacity >= min_new_capacity) return MZ_TRUE; + if (growing) { new_capacity = MZ_MAX(1, pArray->m_capacity); while (new_capacity < min_new_capacity) new_capacity *= 2; } + if (NULL == (pNew_p = pZip->m_pRealloc(pZip->m_pAlloc_opaque, pArray->m_p, pArray->m_element_size, new_capacity))) return MZ_FALSE; + pArray->m_p = pNew_p; pArray->m_capacity = new_capacity; + return MZ_TRUE; +} + +static MZ_FORCEINLINE mz_bool mz_zip_array_reserve(mz_zip_archive *pZip, mz_zip_array *pArray, size_t new_capacity, mz_uint growing) +{ + if (new_capacity > pArray->m_capacity) { if (!mz_zip_array_ensure_capacity(pZip, pArray, new_capacity, growing)) return MZ_FALSE; } + return MZ_TRUE; +} + +static MZ_FORCEINLINE mz_bool mz_zip_array_resize(mz_zip_archive *pZip, mz_zip_array *pArray, size_t new_size, mz_uint growing) +{ + if (new_size > pArray->m_capacity) { if (!mz_zip_array_ensure_capacity(pZip, pArray, new_size, growing)) return MZ_FALSE; } + pArray->m_size = new_size; + return MZ_TRUE; +} + +static MZ_FORCEINLINE mz_bool mz_zip_array_ensure_room(mz_zip_archive *pZip, mz_zip_array *pArray, size_t n) +{ + return mz_zip_array_reserve(pZip, pArray, pArray->m_size + n, MZ_TRUE); +} + +static MZ_FORCEINLINE mz_bool mz_zip_array_push_back(mz_zip_archive *pZip, mz_zip_array *pArray, const void *pElements, size_t n) +{ + size_t orig_size = pArray->m_size; if (!mz_zip_array_resize(pZip, pArray, orig_size + n, MZ_TRUE)) return MZ_FALSE; + memcpy((mz_uint8*)pArray->m_p + orig_size * pArray->m_element_size, pElements, n * pArray->m_element_size); + return MZ_TRUE; +} + +#ifndef MINIZ_NO_TIME +static time_t mz_zip_dos_to_time_t(int dos_time, int dos_date) +{ + struct tm tm; + memset(&tm, 0, sizeof(tm)); tm.tm_isdst = -1; + tm.tm_year = ((dos_date >> 9) & 127) + 1980 - 1900; tm.tm_mon = ((dos_date >> 5) & 15) - 1; tm.tm_mday = dos_date & 31; + tm.tm_hour = (dos_time >> 11) & 31; tm.tm_min = (dos_time >> 5) & 63; tm.tm_sec = (dos_time << 1) & 62; + return mktime(&tm); +} + +static void mz_zip_time_to_dos_time(time_t time, mz_uint16 *pDOS_time, mz_uint16 *pDOS_date) +{ +#ifdef _MSC_VER + struct tm tm_struct; + struct tm *tm = &tm_struct; + errno_t err = localtime_s(tm, &time); + if (err) + { + *pDOS_date = 0; *pDOS_time = 0; + return; + } +#else + struct tm *tm = localtime(&time); +#endif + *pDOS_time = (mz_uint16)(((tm->tm_hour) << 11) + ((tm->tm_min) << 5) + ((tm->tm_sec) >> 1)); + *pDOS_date = (mz_uint16)(((tm->tm_year + 1900 - 1980) << 9) + ((tm->tm_mon + 1) << 5) + tm->tm_mday); +} +#endif + +#ifndef MINIZ_NO_STDIO +static mz_bool mz_zip_get_file_modified_time(const char *pFilename, mz_uint16 *pDOS_time, mz_uint16 *pDOS_date) +{ +#ifdef MINIZ_NO_TIME + (void)pFilename; *pDOS_date = *pDOS_time = 0; +#else + struct MZ_FILE_STAT_STRUCT file_stat; if (MZ_FILE_STAT(pFilename, &file_stat) != 0) return MZ_FALSE; + mz_zip_time_to_dos_time(file_stat.st_mtime, pDOS_time, pDOS_date); +#endif // #ifdef MINIZ_NO_TIME + return MZ_TRUE; +} + +static mz_bool mz_zip_set_file_times(const char *pFilename, time_t access_time, time_t modified_time) +{ +#ifndef MINIZ_NO_TIME + struct utimbuf t; t.actime = access_time; t.modtime = modified_time; + return !utime(pFilename, &t); +#else + (void)pFilename, (void)access_time, (void)modified_time; + return MZ_TRUE; +#endif // #ifndef MINIZ_NO_TIME +} +#endif + +static mz_bool mz_zip_reader_init_internal(mz_zip_archive *pZip, mz_uint32 flags) +{ + (void)flags; + if ((!pZip) || (pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_INVALID)) + return MZ_FALSE; + + if (!pZip->m_pAlloc) pZip->m_pAlloc = def_alloc_func; + if (!pZip->m_pFree) pZip->m_pFree = def_free_func; + if (!pZip->m_pRealloc) pZip->m_pRealloc = def_realloc_func; + + pZip->m_zip_mode = MZ_ZIP_MODE_READING; + pZip->m_archive_size = 0; + pZip->m_central_directory_file_ofs = 0; + pZip->m_total_files = 0; + + if (NULL == (pZip->m_pState = (mz_zip_internal_state *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, sizeof(mz_zip_internal_state)))) + return MZ_FALSE; + memset(pZip->m_pState, 0, sizeof(mz_zip_internal_state)); + MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir, sizeof(mz_uint8)); + MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir_offsets, sizeof(mz_uint32)); + MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_sorted_central_dir_offsets, sizeof(mz_uint32)); + return MZ_TRUE; +} + +static MZ_FORCEINLINE mz_bool mz_zip_reader_filename_less(const mz_zip_array *pCentral_dir_array, const mz_zip_array *pCentral_dir_offsets, mz_uint l_index, mz_uint r_index) +{ + const mz_uint8 *pL = &MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_array, mz_uint8, MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_offsets, mz_uint32, l_index)), *pE; + const mz_uint8 *pR = &MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_array, mz_uint8, MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_offsets, mz_uint32, r_index)); + mz_uint l_len = MZ_READ_LE16(pL + MZ_ZIP_CDH_FILENAME_LEN_OFS), r_len = MZ_READ_LE16(pR + MZ_ZIP_CDH_FILENAME_LEN_OFS); + mz_uint8 l = 0, r = 0; + pL += MZ_ZIP_CENTRAL_DIR_HEADER_SIZE; pR += MZ_ZIP_CENTRAL_DIR_HEADER_SIZE; + pE = pL + MZ_MIN(l_len, r_len); + while (pL < pE) + { + if ((l = MZ_TOLOWER(*pL)) != (r = MZ_TOLOWER(*pR))) + break; + pL++; pR++; + } + return (pL == pE) ? (l_len < r_len) : (l < r); +} + +#define MZ_SWAP_UINT32(a, b) do { mz_uint32 t = a; a = b; b = t; } MZ_MACRO_END + +// Heap sort of lowercased filenames, used to help accelerate plain central directory searches by mz_zip_reader_locate_file(). (Could also use qsort(), but it could allocate memory.) +static void mz_zip_reader_sort_central_dir_offsets_by_filename(mz_zip_archive *pZip) +{ + mz_zip_internal_state *pState = pZip->m_pState; + const mz_zip_array *pCentral_dir_offsets = &pState->m_central_dir_offsets; + const mz_zip_array *pCentral_dir = &pState->m_central_dir; + mz_uint32 *pIndices = &MZ_ZIP_ARRAY_ELEMENT(&pState->m_sorted_central_dir_offsets, mz_uint32, 0); + const int size = pZip->m_total_files; + int start = (size - 2) >> 1, end; + while (start >= 0) + { + int child, root = start; + for ( ; ; ) + { + if ((child = (root << 1) + 1) >= size) + break; + child += (((child + 1) < size) && (mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, pIndices[child], pIndices[child + 1]))); + if (!mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, pIndices[root], pIndices[child])) + break; + MZ_SWAP_UINT32(pIndices[root], pIndices[child]); root = child; + } + start--; + } + + end = size - 1; + while (end > 0) + { + int child, root = 0; + MZ_SWAP_UINT32(pIndices[end], pIndices[0]); + for ( ; ; ) + { + if ((child = (root << 1) + 1) >= end) + break; + child += (((child + 1) < end) && mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, pIndices[child], pIndices[child + 1])); + if (!mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, pIndices[root], pIndices[child])) + break; + MZ_SWAP_UINT32(pIndices[root], pIndices[child]); root = child; + } + end--; + } +} + +static mz_bool mz_zip_reader_read_central_dir(mz_zip_archive *pZip, mz_uint32 flags) +{ + mz_uint cdir_size, num_this_disk, cdir_disk_index; + mz_uint64 cdir_ofs; + mz_int64 cur_file_ofs; + const mz_uint8 *p; + mz_uint32 buf_u32[4096 / sizeof(mz_uint32)]; mz_uint8 *pBuf = (mz_uint8 *)buf_u32; + // Basic sanity checks - reject files which are too small, and check the first 4 bytes of the file to make sure a local header is there. + if (pZip->m_archive_size < MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) + return MZ_FALSE; + // Find the end of central directory record by scanning the file from the end towards the beginning. + cur_file_ofs = MZ_MAX((mz_int64)pZip->m_archive_size - (mz_int64)sizeof(buf_u32), 0); + for ( ; ; ) + { + int i, n = (int)MZ_MIN(sizeof(buf_u32), pZip->m_archive_size - cur_file_ofs); + if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pBuf, n) != (mz_uint)n) + return MZ_FALSE; + for (i = n - 4; i >= 0; --i) + if (MZ_READ_LE32(pBuf + i) == MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG) + break; + if (i >= 0) + { + cur_file_ofs += i; + break; + } + if ((!cur_file_ofs) || ((pZip->m_archive_size - cur_file_ofs) >= (0xFFFF + MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE))) + return MZ_FALSE; + cur_file_ofs = MZ_MAX(cur_file_ofs - (sizeof(buf_u32) - 3), 0); + } + // Read and verify the end of central directory record. + if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pBuf, MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) != MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) + return MZ_FALSE; + if ((MZ_READ_LE32(pBuf + MZ_ZIP_ECDH_SIG_OFS) != MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG) || + ((pZip->m_total_files = MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS)) != MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS))) + return MZ_FALSE; + + num_this_disk = MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_NUM_THIS_DISK_OFS); + cdir_disk_index = MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_NUM_DISK_CDIR_OFS); + if (((num_this_disk | cdir_disk_index) != 0) && ((num_this_disk != 1) || (cdir_disk_index != 1))) + return MZ_FALSE; + + if ((cdir_size = MZ_READ_LE32(pBuf + MZ_ZIP_ECDH_CDIR_SIZE_OFS)) < pZip->m_total_files * MZ_ZIP_CENTRAL_DIR_HEADER_SIZE) + return MZ_FALSE; + + cdir_ofs = MZ_READ_LE32(pBuf + MZ_ZIP_ECDH_CDIR_OFS_OFS); + if ((cdir_ofs + (mz_uint64)cdir_size) > pZip->m_archive_size) + return MZ_FALSE; + + pZip->m_central_directory_file_ofs = cdir_ofs; + + if (pZip->m_total_files) + { + mz_uint i, n; + // Read the entire central directory into a heap block, and allocate another heap block to hold the unsorted central dir file record offsets, and another to hold the sorted indices. + if ((!mz_zip_array_resize(pZip, &pZip->m_pState->m_central_dir, cdir_size, MZ_FALSE)) || + (!mz_zip_array_resize(pZip, &pZip->m_pState->m_central_dir_offsets, pZip->m_total_files, MZ_FALSE)) || + (!mz_zip_array_resize(pZip, &pZip->m_pState->m_sorted_central_dir_offsets, pZip->m_total_files, MZ_FALSE))) + return MZ_FALSE; + if (pZip->m_pRead(pZip->m_pIO_opaque, cdir_ofs, pZip->m_pState->m_central_dir.m_p, cdir_size) != cdir_size) + return MZ_FALSE; + + // Now create an index into the central directory file records, do some basic sanity checking on each record, and check for zip64 entries (which are not yet supported). + p = (const mz_uint8 *)pZip->m_pState->m_central_dir.m_p; + for (n = cdir_size, i = 0; i < pZip->m_total_files; ++i) + { + mz_uint total_header_size, comp_size, decomp_size, disk_index; + if ((n < MZ_ZIP_CENTRAL_DIR_HEADER_SIZE) || (MZ_READ_LE32(p) != MZ_ZIP_CENTRAL_DIR_HEADER_SIG)) + return MZ_FALSE; + MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, i) = (mz_uint32)(p - (const mz_uint8 *)pZip->m_pState->m_central_dir.m_p); + MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_sorted_central_dir_offsets, mz_uint32, i) = i; + comp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS); + decomp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS); + if (((!MZ_READ_LE32(p + MZ_ZIP_CDH_METHOD_OFS)) && (decomp_size != comp_size)) || (decomp_size && !comp_size) || (decomp_size == 0xFFFFFFFF) || (comp_size == 0xFFFFFFFF)) + return MZ_FALSE; + disk_index = MZ_READ_LE16(p + MZ_ZIP_CDH_DISK_START_OFS); + if ((disk_index != num_this_disk) && (disk_index != 1)) + return MZ_FALSE; + if (((mz_uint64)MZ_READ_LE32(p + MZ_ZIP_CDH_LOCAL_HEADER_OFS) + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + comp_size) > pZip->m_archive_size) + return MZ_FALSE; + if ((total_header_size = MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS) + MZ_READ_LE16(p + MZ_ZIP_CDH_EXTRA_LEN_OFS) + MZ_READ_LE16(p + MZ_ZIP_CDH_COMMENT_LEN_OFS)) > n) + return MZ_FALSE; + n -= total_header_size; p += total_header_size; + } + } + + if ((flags & MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY) == 0) + mz_zip_reader_sort_central_dir_offsets_by_filename(pZip); + + return MZ_TRUE; +} + +mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, mz_uint32 flags) +{ + if ((!pZip) || (!pZip->m_pRead)) + return MZ_FALSE; + if (!mz_zip_reader_init_internal(pZip, flags)) + return MZ_FALSE; + pZip->m_archive_size = size; + if (!mz_zip_reader_read_central_dir(pZip, flags)) + { + mz_zip_reader_end(pZip); + return MZ_FALSE; + } + return MZ_TRUE; +} + +static size_t mz_zip_mem_read_func(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n) +{ + mz_zip_archive *pZip = (mz_zip_archive *)pOpaque; + size_t s = (file_ofs >= pZip->m_archive_size) ? 0 : (size_t)MZ_MIN(pZip->m_archive_size - file_ofs, n); + memcpy(pBuf, (const mz_uint8 *)pZip->m_pState->m_pMem + file_ofs, s); + return s; +} + +mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint32 flags) +{ + if (!mz_zip_reader_init_internal(pZip, flags)) + return MZ_FALSE; + pZip->m_archive_size = size; + pZip->m_pRead = mz_zip_mem_read_func; + pZip->m_pIO_opaque = pZip; + pZip->m_pState->m_pMem = (void *)pMem; + pZip->m_pState->m_mem_size = size; + if (!mz_zip_reader_read_central_dir(pZip, flags)) + { + mz_zip_reader_end(pZip); + return MZ_FALSE; + } + return MZ_TRUE; +} + +#ifndef MINIZ_NO_STDIO +static size_t mz_zip_file_read_func(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n) +{ + mz_zip_archive *pZip = (mz_zip_archive *)pOpaque; + mz_int64 cur_ofs = MZ_FTELL64(pZip->m_pState->m_pFile); + if (((mz_int64)file_ofs < 0) || (((cur_ofs != (mz_int64)file_ofs)) && (MZ_FSEEK64(pZip->m_pState->m_pFile, (mz_int64)file_ofs, SEEK_SET)))) + return 0; + return MZ_FREAD(pBuf, 1, n, pZip->m_pState->m_pFile); +} + +mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint32 flags) +{ + mz_uint64 file_size; + MZ_FILE *pFile = MZ_FOPEN(pFilename, "rb"); + if (!pFile) + return MZ_FALSE; + if (MZ_FSEEK64(pFile, 0, SEEK_END)) + return MZ_FALSE; + file_size = MZ_FTELL64(pFile); + if (!mz_zip_reader_init_internal(pZip, flags)) + { + MZ_FCLOSE(pFile); + return MZ_FALSE; + } + pZip->m_pRead = mz_zip_file_read_func; + pZip->m_pIO_opaque = pZip; + pZip->m_pState->m_pFile = pFile; + pZip->m_archive_size = file_size; + if (!mz_zip_reader_read_central_dir(pZip, flags)) + { + mz_zip_reader_end(pZip); + return MZ_FALSE; + } + return MZ_TRUE; +} +#endif // #ifndef MINIZ_NO_STDIO + +mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip) +{ + return pZip ? pZip->m_total_files : 0; +} + +static MZ_FORCEINLINE const mz_uint8 *mz_zip_reader_get_cdh(mz_zip_archive *pZip, mz_uint file_index) +{ + if ((!pZip) || (!pZip->m_pState) || (file_index >= pZip->m_total_files) || (pZip->m_zip_mode != MZ_ZIP_MODE_READING)) + return NULL; + return &MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir, mz_uint8, MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, file_index)); +} + +mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, mz_uint file_index) +{ + mz_uint m_bit_flag; + const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); + if (!p) + return MZ_FALSE; + m_bit_flag = MZ_READ_LE16(p + MZ_ZIP_CDH_BIT_FLAG_OFS); + return (m_bit_flag & 1); +} + +mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, mz_uint file_index) +{ + mz_uint filename_len, internal_attr, external_attr; + const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); + if (!p) + return MZ_FALSE; + + internal_attr = MZ_READ_LE16(p + MZ_ZIP_CDH_INTERNAL_ATTR_OFS); + external_attr = MZ_READ_LE32(p + MZ_ZIP_CDH_EXTERNAL_ATTR_OFS); + if ((!internal_attr) && ((external_attr & 0x10) != 0)) + return MZ_TRUE; + + filename_len = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS); + if (filename_len) + { + if (*(p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + filename_len - 1) == '/') + return MZ_TRUE; + } + + return MZ_FALSE; +} + +mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat *pStat) +{ + mz_uint n; + const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); + if ((!p) || (!pStat)) + return MZ_FALSE; + + // Unpack the central directory record. + pStat->m_file_index = file_index; + pStat->m_central_dir_ofs = MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, file_index); + pStat->m_version_made_by = MZ_READ_LE16(p + MZ_ZIP_CDH_VERSION_MADE_BY_OFS); + pStat->m_version_needed = MZ_READ_LE16(p + MZ_ZIP_CDH_VERSION_NEEDED_OFS); + pStat->m_bit_flag = MZ_READ_LE16(p + MZ_ZIP_CDH_BIT_FLAG_OFS); + pStat->m_method = MZ_READ_LE16(p + MZ_ZIP_CDH_METHOD_OFS); +#ifndef MINIZ_NO_TIME + pStat->m_time = mz_zip_dos_to_time_t(MZ_READ_LE16(p + MZ_ZIP_CDH_FILE_TIME_OFS), MZ_READ_LE16(p + MZ_ZIP_CDH_FILE_DATE_OFS)); +#endif + pStat->m_crc32 = MZ_READ_LE32(p + MZ_ZIP_CDH_CRC32_OFS); + pStat->m_comp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS); + pStat->m_uncomp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS); + pStat->m_internal_attr = MZ_READ_LE16(p + MZ_ZIP_CDH_INTERNAL_ATTR_OFS); + pStat->m_external_attr = MZ_READ_LE32(p + MZ_ZIP_CDH_EXTERNAL_ATTR_OFS); + pStat->m_local_header_ofs = MZ_READ_LE32(p + MZ_ZIP_CDH_LOCAL_HEADER_OFS); + + // Copy as much of the filename and comment as possible. + n = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS); n = MZ_MIN(n, MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE - 1); + memcpy(pStat->m_filename, p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE, n); pStat->m_filename[n] = '\0'; + + n = MZ_READ_LE16(p + MZ_ZIP_CDH_COMMENT_LEN_OFS); n = MZ_MIN(n, MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE - 1); + pStat->m_comment_size = n; + memcpy(pStat->m_comment, p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS) + MZ_READ_LE16(p + MZ_ZIP_CDH_EXTRA_LEN_OFS), n); pStat->m_comment[n] = '\0'; + + return MZ_TRUE; +} + +mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_uint filename_buf_size) +{ + mz_uint n; + const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); + if (!p) { if (filename_buf_size) pFilename[0] = '\0'; return 0; } + n = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS); + if (filename_buf_size) + { + n = MZ_MIN(n, filename_buf_size - 1); + memcpy(pFilename, p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE, n); + pFilename[n] = '\0'; + } + return n + 1; +} + +static MZ_FORCEINLINE mz_bool mz_zip_reader_string_equal(const char *pA, const char *pB, mz_uint len, mz_uint flags) +{ + mz_uint i; + if (flags & MZ_ZIP_FLAG_CASE_SENSITIVE) + return 0 == memcmp(pA, pB, len); + for (i = 0; i < len; ++i) + if (MZ_TOLOWER(pA[i]) != MZ_TOLOWER(pB[i])) + return MZ_FALSE; + return MZ_TRUE; +} + +static MZ_FORCEINLINE int mz_zip_reader_filename_compare(const mz_zip_array *pCentral_dir_array, const mz_zip_array *pCentral_dir_offsets, mz_uint l_index, const char *pR, mz_uint r_len) +{ + const mz_uint8 *pL = &MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_array, mz_uint8, MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_offsets, mz_uint32, l_index)), *pE; + mz_uint l_len = MZ_READ_LE16(pL + MZ_ZIP_CDH_FILENAME_LEN_OFS); + mz_uint8 l = 0, r = 0; + pL += MZ_ZIP_CENTRAL_DIR_HEADER_SIZE; + pE = pL + MZ_MIN(l_len, r_len); + while (pL < pE) + { + if ((l = MZ_TOLOWER(*pL)) != (r = MZ_TOLOWER(*pR))) + break; + pL++; pR++; + } + return (pL == pE) ? (int)(l_len - r_len) : (l - r); +} + +static int mz_zip_reader_locate_file_binary_search(mz_zip_archive *pZip, const char *pFilename) +{ + mz_zip_internal_state *pState = pZip->m_pState; + const mz_zip_array *pCentral_dir_offsets = &pState->m_central_dir_offsets; + const mz_zip_array *pCentral_dir = &pState->m_central_dir; + mz_uint32 *pIndices = &MZ_ZIP_ARRAY_ELEMENT(&pState->m_sorted_central_dir_offsets, mz_uint32, 0); + const int size = pZip->m_total_files; + const mz_uint filename_len = (mz_uint)strlen(pFilename); + int l = 0, h = size - 1; + while (l <= h) + { + int m = (l + h) >> 1, file_index = pIndices[m], comp = mz_zip_reader_filename_compare(pCentral_dir, pCentral_dir_offsets, file_index, pFilename, filename_len); + if (!comp) + return file_index; + else if (comp < 0) + l = m + 1; + else + h = m - 1; + } + return -1; +} + +int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags) +{ + mz_uint file_index; size_t name_len, comment_len; + if ((!pZip) || (!pZip->m_pState) || (!pName) || (pZip->m_zip_mode != MZ_ZIP_MODE_READING)) + return -1; + if (((flags & (MZ_ZIP_FLAG_IGNORE_PATH | MZ_ZIP_FLAG_CASE_SENSITIVE)) == 0) && (!pComment) && (pZip->m_pState->m_sorted_central_dir_offsets.m_p)) + return mz_zip_reader_locate_file_binary_search(pZip, pName); + name_len = strlen(pName); if (name_len > 0xFFFF) return -1; + comment_len = pComment ? strlen(pComment) : 0; if (comment_len > 0xFFFF) return -1; + for (file_index = 0; file_index < pZip->m_total_files; file_index++) + { + const mz_uint8 *pHeader = &MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir, mz_uint8, MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, file_index)); + mz_uint filename_len = MZ_READ_LE16(pHeader + MZ_ZIP_CDH_FILENAME_LEN_OFS); + const char *pFilename = (const char *)pHeader + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE; + if (filename_len < name_len) + continue; + if (comment_len) + { + mz_uint file_extra_len = MZ_READ_LE16(pHeader + MZ_ZIP_CDH_EXTRA_LEN_OFS), file_comment_len = MZ_READ_LE16(pHeader + MZ_ZIP_CDH_COMMENT_LEN_OFS); + const char *pFile_comment = pFilename + filename_len + file_extra_len; + if ((file_comment_len != comment_len) || (!mz_zip_reader_string_equal(pComment, pFile_comment, file_comment_len, flags))) + continue; + } + if ((flags & MZ_ZIP_FLAG_IGNORE_PATH) && (filename_len)) + { + int ofs = filename_len - 1; + do + { + if ((pFilename[ofs] == '/') || (pFilename[ofs] == '\\') || (pFilename[ofs] == ':')) + break; + } while (--ofs >= 0); + ofs++; + pFilename += ofs; filename_len -= ofs; + } + if ((filename_len == name_len) && (mz_zip_reader_string_equal(pName, pFilename, filename_len, flags))) + return file_index; + } + return -1; +} + +mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size) +{ + int status = TINFL_STATUS_DONE; + mz_uint64 needed_size, cur_file_ofs, comp_remaining, out_buf_ofs = 0, read_buf_size, read_buf_ofs = 0, read_buf_avail; + mz_zip_archive_file_stat file_stat; + void *pRead_buf; + mz_uint32 local_header_u32[(MZ_ZIP_LOCAL_DIR_HEADER_SIZE + sizeof(mz_uint32) - 1) / sizeof(mz_uint32)]; mz_uint8 *pLocal_header = (mz_uint8 *)local_header_u32; + tinfl_decompressor inflator; + + if ((buf_size) && (!pBuf)) + return MZ_FALSE; + + if (!mz_zip_reader_file_stat(pZip, file_index, &file_stat)) + return MZ_FALSE; + + if (!file_stat.m_comp_size) + return MZ_TRUE; + + // Encryption and patch files are not supported. + if (file_stat.m_bit_flag & (1 | 32)) + return MZ_FALSE; + + // This function only supports stored and deflate. + if ((!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) && (file_stat.m_method != 0) && (file_stat.m_method != MZ_DEFLATED)) + return MZ_FALSE; + + // Ensure supplied output buffer is large enough. + needed_size = (flags & MZ_ZIP_FLAG_COMPRESSED_DATA) ? file_stat.m_comp_size : file_stat.m_uncomp_size; + if (buf_size < needed_size) + return MZ_FALSE; + + // Read and parse the local directory entry. + cur_file_ofs = file_stat.m_local_header_ofs; + if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != MZ_ZIP_LOCAL_DIR_HEADER_SIZE) + return MZ_FALSE; + if (MZ_READ_LE32(pLocal_header) != MZ_ZIP_LOCAL_DIR_HEADER_SIG) + return MZ_FALSE; + + cur_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_FILENAME_LEN_OFS) + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_EXTRA_LEN_OFS); + if ((cur_file_ofs + file_stat.m_comp_size) > pZip->m_archive_size) + return MZ_FALSE; + + if ((flags & MZ_ZIP_FLAG_COMPRESSED_DATA) || (!file_stat.m_method)) + { + // The file is stored or the caller has requested the compressed data. + if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pBuf, (size_t)needed_size) != needed_size) + return MZ_FALSE; + return ((flags & MZ_ZIP_FLAG_COMPRESSED_DATA) != 0) || (mz_crc32(MZ_CRC32_INIT, (const mz_uint8 *)pBuf, (size_t)file_stat.m_uncomp_size) == file_stat.m_crc32); + } + + // Decompress the file either directly from memory or from a file input buffer. + tinfl_init(&inflator); + + if (pZip->m_pState->m_pMem) + { + // Read directly from the archive in memory. + pRead_buf = (mz_uint8 *)pZip->m_pState->m_pMem + cur_file_ofs; + read_buf_size = read_buf_avail = file_stat.m_comp_size; + comp_remaining = 0; + } + else if (pUser_read_buf) + { + // Use a user provided read buffer. + if (!user_read_buf_size) + return MZ_FALSE; + pRead_buf = (mz_uint8 *)pUser_read_buf; + read_buf_size = user_read_buf_size; + read_buf_avail = 0; + comp_remaining = file_stat.m_uncomp_size; + } + else + { + // Temporarily allocate a read buffer. + read_buf_size = MZ_MIN(file_stat.m_comp_size, MZ_ZIP_MAX_IO_BUF_SIZE); +#ifdef _MSC_VER + if (((0, sizeof(size_t) == sizeof(mz_uint32))) && (read_buf_size > 0x7FFFFFFF)) +#else + if (((sizeof(size_t) == sizeof(mz_uint32))) && (read_buf_size > 0x7FFFFFFF)) +#endif + return MZ_FALSE; + if (NULL == (pRead_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)read_buf_size))) + return MZ_FALSE; + read_buf_avail = 0; + comp_remaining = file_stat.m_comp_size; + } + + do + { + size_t in_buf_size, out_buf_size = (size_t)(file_stat.m_uncomp_size - out_buf_ofs); + if ((!read_buf_avail) && (!pZip->m_pState->m_pMem)) + { + read_buf_avail = MZ_MIN(read_buf_size, comp_remaining); + if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pRead_buf, (size_t)read_buf_avail) != read_buf_avail) + { + status = TINFL_STATUS_FAILED; + break; + } + cur_file_ofs += read_buf_avail; + comp_remaining -= read_buf_avail; + read_buf_ofs = 0; + } + in_buf_size = (size_t)read_buf_avail; + status = tinfl_decompress(&inflator, (mz_uint8 *)pRead_buf + read_buf_ofs, &in_buf_size, (mz_uint8 *)pBuf, (mz_uint8 *)pBuf + out_buf_ofs, &out_buf_size, TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF | (comp_remaining ? TINFL_FLAG_HAS_MORE_INPUT : 0)); + read_buf_avail -= in_buf_size; + read_buf_ofs += in_buf_size; + out_buf_ofs += out_buf_size; + } while (status == TINFL_STATUS_NEEDS_MORE_INPUT); + + if (status == TINFL_STATUS_DONE) + { + // Make sure the entire file was decompressed, and check its CRC. + if ((out_buf_ofs != file_stat.m_uncomp_size) || (mz_crc32(MZ_CRC32_INIT, (const mz_uint8 *)pBuf, (size_t)file_stat.m_uncomp_size) != file_stat.m_crc32)) + status = TINFL_STATUS_FAILED; + } + + if ((!pZip->m_pState->m_pMem) && (!pUser_read_buf)) + pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); + + return status == TINFL_STATUS_DONE; +} + +mz_bool mz_zip_reader_extract_file_to_mem_no_alloc(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size) +{ + int file_index = mz_zip_reader_locate_file(pZip, pFilename, NULL, flags); + if (file_index < 0) + return MZ_FALSE; + return mz_zip_reader_extract_to_mem_no_alloc(pZip, file_index, pBuf, buf_size, flags, pUser_read_buf, user_read_buf_size); +} + +mz_bool mz_zip_reader_extract_to_mem(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags) +{ + return mz_zip_reader_extract_to_mem_no_alloc(pZip, file_index, pBuf, buf_size, flags, NULL, 0); +} + +mz_bool mz_zip_reader_extract_file_to_mem(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags) +{ + return mz_zip_reader_extract_file_to_mem_no_alloc(pZip, pFilename, pBuf, buf_size, flags, NULL, 0); +} + +void *mz_zip_reader_extract_to_heap(mz_zip_archive *pZip, mz_uint file_index, size_t *pSize, mz_uint flags) +{ + mz_uint64 comp_size, uncomp_size, alloc_size; + const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); + void *pBuf; + + if (pSize) + *pSize = 0; + if (!p) + return NULL; + + comp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS); + uncomp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS); + + alloc_size = (flags & MZ_ZIP_FLAG_COMPRESSED_DATA) ? comp_size : uncomp_size; +#ifdef _MSC_VER + if (((0, sizeof(size_t) == sizeof(mz_uint32))) && (alloc_size > 0x7FFFFFFF)) +#else + if (((sizeof(size_t) == sizeof(mz_uint32))) && (alloc_size > 0x7FFFFFFF)) +#endif + return NULL; + if (NULL == (pBuf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)alloc_size))) + return NULL; + + if (!mz_zip_reader_extract_to_mem(pZip, file_index, pBuf, (size_t)alloc_size, flags)) + { + pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); + return NULL; + } + + if (pSize) *pSize = (size_t)alloc_size; + return pBuf; +} + +void *mz_zip_reader_extract_file_to_heap(mz_zip_archive *pZip, const char *pFilename, size_t *pSize, mz_uint flags) +{ + int file_index = mz_zip_reader_locate_file(pZip, pFilename, NULL, flags); + if (file_index < 0) + { + if (pSize) *pSize = 0; + return MZ_FALSE; + } + return mz_zip_reader_extract_to_heap(pZip, file_index, pSize, flags); +} + +mz_bool mz_zip_reader_extract_to_callback(mz_zip_archive *pZip, mz_uint file_index, mz_file_write_func pCallback, void *pOpaque, mz_uint flags) +{ + int status = TINFL_STATUS_DONE; mz_uint file_crc32 = MZ_CRC32_INIT; + mz_uint64 read_buf_size, read_buf_ofs = 0, read_buf_avail, comp_remaining, out_buf_ofs = 0, cur_file_ofs; + mz_zip_archive_file_stat file_stat; + void *pRead_buf = NULL; void *pWrite_buf = NULL; + mz_uint32 local_header_u32[(MZ_ZIP_LOCAL_DIR_HEADER_SIZE + sizeof(mz_uint32) - 1) / sizeof(mz_uint32)]; mz_uint8 *pLocal_header = (mz_uint8 *)local_header_u32; + + if (!mz_zip_reader_file_stat(pZip, file_index, &file_stat)) + return MZ_FALSE; + + if (!file_stat.m_comp_size) + return MZ_TRUE; + + // Encryption and patch files are not supported. + if (file_stat.m_bit_flag & (1 | 32)) + return MZ_FALSE; + + // This function only supports stored and deflate. + if ((!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) && (file_stat.m_method != 0) && (file_stat.m_method != MZ_DEFLATED)) + return MZ_FALSE; + + // Read and parse the local directory entry. + cur_file_ofs = file_stat.m_local_header_ofs; + if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != MZ_ZIP_LOCAL_DIR_HEADER_SIZE) + return MZ_FALSE; + if (MZ_READ_LE32(pLocal_header) != MZ_ZIP_LOCAL_DIR_HEADER_SIG) + return MZ_FALSE; + + cur_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_FILENAME_LEN_OFS) + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_EXTRA_LEN_OFS); + if ((cur_file_ofs + file_stat.m_comp_size) > pZip->m_archive_size) + return MZ_FALSE; + + // Decompress the file either directly from memory or from a file input buffer. + if (pZip->m_pState->m_pMem) + { + pRead_buf = (mz_uint8 *)pZip->m_pState->m_pMem + cur_file_ofs; + read_buf_size = read_buf_avail = file_stat.m_comp_size; + comp_remaining = 0; + } + else + { + read_buf_size = MZ_MIN(file_stat.m_comp_size, MZ_ZIP_MAX_IO_BUF_SIZE); + if (NULL == (pRead_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)read_buf_size))) + return MZ_FALSE; + read_buf_avail = 0; + comp_remaining = file_stat.m_comp_size; + } + + if ((flags & MZ_ZIP_FLAG_COMPRESSED_DATA) || (!file_stat.m_method)) + { + // The file is stored or the caller has requested the compressed data. + if (pZip->m_pState->m_pMem) + { +#ifdef _MSC_VER + if (((0, sizeof(size_t) == sizeof(mz_uint32))) && (file_stat.m_comp_size > 0xFFFFFFFF)) +#else + if (((sizeof(size_t) == sizeof(mz_uint32))) && (file_stat.m_comp_size > 0xFFFFFFFF)) +#endif + return MZ_FALSE; + if (pCallback(pOpaque, out_buf_ofs, pRead_buf, (size_t)file_stat.m_comp_size) != file_stat.m_comp_size) + status = TINFL_STATUS_FAILED; + else if (!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) + file_crc32 = (mz_uint32)mz_crc32(file_crc32, (const mz_uint8 *)pRead_buf, (size_t)file_stat.m_comp_size); + cur_file_ofs += file_stat.m_comp_size; + out_buf_ofs += file_stat.m_comp_size; + comp_remaining = 0; + } + else + { + while (comp_remaining) + { + read_buf_avail = MZ_MIN(read_buf_size, comp_remaining); + if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pRead_buf, (size_t)read_buf_avail) != read_buf_avail) + { + status = TINFL_STATUS_FAILED; + break; + } + + if (!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) + file_crc32 = (mz_uint32)mz_crc32(file_crc32, (const mz_uint8 *)pRead_buf, (size_t)read_buf_avail); + + if (pCallback(pOpaque, out_buf_ofs, pRead_buf, (size_t)read_buf_avail) != read_buf_avail) + { + status = TINFL_STATUS_FAILED; + break; + } + cur_file_ofs += read_buf_avail; + out_buf_ofs += read_buf_avail; + comp_remaining -= read_buf_avail; + } + } + } + else + { + tinfl_decompressor inflator; + tinfl_init(&inflator); + + if (NULL == (pWrite_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, TINFL_LZ_DICT_SIZE))) + status = TINFL_STATUS_FAILED; + else + { + do + { + mz_uint8 *pWrite_buf_cur = (mz_uint8 *)pWrite_buf + (out_buf_ofs & (TINFL_LZ_DICT_SIZE - 1)); + size_t in_buf_size, out_buf_size = TINFL_LZ_DICT_SIZE - (out_buf_ofs & (TINFL_LZ_DICT_SIZE - 1)); + if ((!read_buf_avail) && (!pZip->m_pState->m_pMem)) + { + read_buf_avail = MZ_MIN(read_buf_size, comp_remaining); + if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pRead_buf, (size_t)read_buf_avail) != read_buf_avail) + { + status = TINFL_STATUS_FAILED; + break; + } + cur_file_ofs += read_buf_avail; + comp_remaining -= read_buf_avail; + read_buf_ofs = 0; + } + + in_buf_size = (size_t)read_buf_avail; + status = tinfl_decompress(&inflator, (const mz_uint8 *)pRead_buf + read_buf_ofs, &in_buf_size, (mz_uint8 *)pWrite_buf, pWrite_buf_cur, &out_buf_size, comp_remaining ? TINFL_FLAG_HAS_MORE_INPUT : 0); + read_buf_avail -= in_buf_size; + read_buf_ofs += in_buf_size; + + if (out_buf_size) + { + if (pCallback(pOpaque, out_buf_ofs, pWrite_buf_cur, out_buf_size) != out_buf_size) + { + status = TINFL_STATUS_FAILED; + break; + } + file_crc32 = (mz_uint32)mz_crc32(file_crc32, pWrite_buf_cur, out_buf_size); + if ((out_buf_ofs += out_buf_size) > file_stat.m_uncomp_size) + { + status = TINFL_STATUS_FAILED; + break; + } + } + } while ((status == TINFL_STATUS_NEEDS_MORE_INPUT) || (status == TINFL_STATUS_HAS_MORE_OUTPUT)); + } + } + + if ((status == TINFL_STATUS_DONE) && (!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA))) + { + // Make sure the entire file was decompressed, and check its CRC. + if ((out_buf_ofs != file_stat.m_uncomp_size) || (file_crc32 != file_stat.m_crc32)) + status = TINFL_STATUS_FAILED; + } + + if (!pZip->m_pState->m_pMem) + pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); + if (pWrite_buf) + pZip->m_pFree(pZip->m_pAlloc_opaque, pWrite_buf); + + return status == TINFL_STATUS_DONE; +} + +mz_bool mz_zip_reader_extract_file_to_callback(mz_zip_archive *pZip, const char *pFilename, mz_file_write_func pCallback, void *pOpaque, mz_uint flags) +{ + int file_index = mz_zip_reader_locate_file(pZip, pFilename, NULL, flags); + if (file_index < 0) + return MZ_FALSE; + return mz_zip_reader_extract_to_callback(pZip, file_index, pCallback, pOpaque, flags); +} + +#ifndef MINIZ_NO_STDIO +static size_t mz_zip_file_write_callback(void *pOpaque, mz_uint64 ofs, const void *pBuf, size_t n) +{ + (void)ofs; return MZ_FWRITE(pBuf, 1, n, (MZ_FILE*)pOpaque); +} + +mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index, const char *pDst_filename, mz_uint flags) +{ + mz_bool status; + mz_zip_archive_file_stat file_stat; + MZ_FILE *pFile; + if (!mz_zip_reader_file_stat(pZip, file_index, &file_stat)) + return MZ_FALSE; + pFile = MZ_FOPEN(pDst_filename, "wb"); + if (!pFile) + return MZ_FALSE; + status = mz_zip_reader_extract_to_callback(pZip, file_index, mz_zip_file_write_callback, pFile, flags); + if (MZ_FCLOSE(pFile) == EOF) + return MZ_FALSE; +#ifndef MINIZ_NO_TIME + if (status) + mz_zip_set_file_times(pDst_filename, file_stat.m_time, file_stat.m_time); +#endif + return status; +} +#endif // #ifndef MINIZ_NO_STDIO + +mz_bool mz_zip_reader_end(mz_zip_archive *pZip) +{ + if ((!pZip) || (!pZip->m_pState) || (!pZip->m_pAlloc) || (!pZip->m_pFree) || (pZip->m_zip_mode != MZ_ZIP_MODE_READING)) + return MZ_FALSE; + + if (pZip->m_pState) + { + mz_zip_internal_state *pState = pZip->m_pState; pZip->m_pState = NULL; + mz_zip_array_clear(pZip, &pState->m_central_dir); + mz_zip_array_clear(pZip, &pState->m_central_dir_offsets); + mz_zip_array_clear(pZip, &pState->m_sorted_central_dir_offsets); + +#ifndef MINIZ_NO_STDIO + if (pState->m_pFile) + { + MZ_FCLOSE(pState->m_pFile); + pState->m_pFile = NULL; + } +#endif // #ifndef MINIZ_NO_STDIO + + pZip->m_pFree(pZip->m_pAlloc_opaque, pState); + } + pZip->m_zip_mode = MZ_ZIP_MODE_INVALID; + + return MZ_TRUE; +} + +#ifndef MINIZ_NO_STDIO +mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, const char *pArchive_filename, const char *pDst_filename, mz_uint flags) +{ + int file_index = mz_zip_reader_locate_file(pZip, pArchive_filename, NULL, flags); + if (file_index < 0) + return MZ_FALSE; + return mz_zip_reader_extract_to_file(pZip, file_index, pDst_filename, flags); +} +#endif + +// ------------------- .ZIP archive writing + +#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS + +static void mz_write_le16(mz_uint8 *p, mz_uint16 v) { p[0] = (mz_uint8)v; p[1] = (mz_uint8)(v >> 8); } +static void mz_write_le32(mz_uint8 *p, mz_uint32 v) { p[0] = (mz_uint8)v; p[1] = (mz_uint8)(v >> 8); p[2] = (mz_uint8)(v >> 16); p[3] = (mz_uint8)(v >> 24); } +#define MZ_WRITE_LE16(p, v) mz_write_le16((mz_uint8 *)(p), (mz_uint16)(v)) +#define MZ_WRITE_LE32(p, v) mz_write_le32((mz_uint8 *)(p), (mz_uint32)(v)) + +mz_bool mz_zip_writer_init(mz_zip_archive *pZip, mz_uint64 existing_size) +{ + if ((!pZip) || (pZip->m_pState) || (!pZip->m_pWrite) || (pZip->m_zip_mode != MZ_ZIP_MODE_INVALID)) + return MZ_FALSE; + + if (pZip->m_file_offset_alignment) + { + // Ensure user specified file offset alignment is a power of 2. + if (pZip->m_file_offset_alignment & (pZip->m_file_offset_alignment - 1)) + return MZ_FALSE; + } + + if (!pZip->m_pAlloc) pZip->m_pAlloc = def_alloc_func; + if (!pZip->m_pFree) pZip->m_pFree = def_free_func; + if (!pZip->m_pRealloc) pZip->m_pRealloc = def_realloc_func; + + pZip->m_zip_mode = MZ_ZIP_MODE_WRITING; + pZip->m_archive_size = existing_size; + pZip->m_central_directory_file_ofs = 0; + pZip->m_total_files = 0; + + if (NULL == (pZip->m_pState = (mz_zip_internal_state *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, sizeof(mz_zip_internal_state)))) + return MZ_FALSE; + memset(pZip->m_pState, 0, sizeof(mz_zip_internal_state)); + MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir, sizeof(mz_uint8)); + MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir_offsets, sizeof(mz_uint32)); + MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_sorted_central_dir_offsets, sizeof(mz_uint32)); + return MZ_TRUE; +} + +static size_t mz_zip_heap_write_func(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n) +{ + mz_zip_archive *pZip = (mz_zip_archive *)pOpaque; + mz_zip_internal_state *pState = pZip->m_pState; + mz_uint64 new_size = MZ_MAX(file_ofs + n, pState->m_mem_size); +#ifdef _MSC_VER + if ((!n) || ((0, sizeof(size_t) == sizeof(mz_uint32)) && (new_size > 0x7FFFFFFF))) +#else + if ((!n) || ((sizeof(size_t) == sizeof(mz_uint32)) && (new_size > 0x7FFFFFFF))) +#endif + return 0; + if (new_size > pState->m_mem_capacity) + { + void *pNew_block; + size_t new_capacity = MZ_MAX(64, pState->m_mem_capacity); while (new_capacity < new_size) new_capacity *= 2; + if (NULL == (pNew_block = pZip->m_pRealloc(pZip->m_pAlloc_opaque, pState->m_pMem, 1, new_capacity))) + return 0; + pState->m_pMem = pNew_block; pState->m_mem_capacity = new_capacity; + } + memcpy((mz_uint8 *)pState->m_pMem + file_ofs, pBuf, n); + pState->m_mem_size = (size_t)new_size; + return n; +} + +mz_bool mz_zip_writer_init_heap(mz_zip_archive *pZip, size_t size_to_reserve_at_beginning, size_t initial_allocation_size) +{ + pZip->m_pWrite = mz_zip_heap_write_func; + pZip->m_pIO_opaque = pZip; + if (!mz_zip_writer_init(pZip, size_to_reserve_at_beginning)) + return MZ_FALSE; + if (0 != (initial_allocation_size = MZ_MAX(initial_allocation_size, size_to_reserve_at_beginning))) + { + if (NULL == (pZip->m_pState->m_pMem = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, initial_allocation_size))) + { + mz_zip_writer_end(pZip); + return MZ_FALSE; + } + pZip->m_pState->m_mem_capacity = initial_allocation_size; + } + return MZ_TRUE; +} + +#ifndef MINIZ_NO_STDIO +static size_t mz_zip_file_write_func(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n) +{ + mz_zip_archive *pZip = (mz_zip_archive *)pOpaque; + mz_int64 cur_ofs = MZ_FTELL64(pZip->m_pState->m_pFile); + if (((mz_int64)file_ofs < 0) || (((cur_ofs != (mz_int64)file_ofs)) && (MZ_FSEEK64(pZip->m_pState->m_pFile, (mz_int64)file_ofs, SEEK_SET)))) + return 0; + return MZ_FWRITE(pBuf, 1, n, pZip->m_pState->m_pFile); +} + +mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_reserve_at_beginning) +{ + MZ_FILE *pFile; + pZip->m_pWrite = mz_zip_file_write_func; + pZip->m_pIO_opaque = pZip; + if (!mz_zip_writer_init(pZip, size_to_reserve_at_beginning)) + return MZ_FALSE; + if (NULL == (pFile = MZ_FOPEN(pFilename, "wb"))) + { + mz_zip_writer_end(pZip); + return MZ_FALSE; + } + pZip->m_pState->m_pFile = pFile; + if (size_to_reserve_at_beginning) + { + mz_uint64 cur_ofs = 0; char buf[4096]; MZ_CLEAR_OBJ(buf); + do + { + size_t n = (size_t)MZ_MIN(sizeof(buf), size_to_reserve_at_beginning); + if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_ofs, buf, n) != n) + { + mz_zip_writer_end(pZip); + return MZ_FALSE; + } + cur_ofs += n; size_to_reserve_at_beginning -= n; + } while (size_to_reserve_at_beginning); + } + return MZ_TRUE; +} +#endif // #ifndef MINIZ_NO_STDIO + +mz_bool mz_zip_writer_init_from_reader(mz_zip_archive *pZip, const char *pFilename) +{ + mz_zip_internal_state *pState; + if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_READING)) + return MZ_FALSE; + // No sense in trying to write to an archive that's already at the support max size + if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + MZ_ZIP_LOCAL_DIR_HEADER_SIZE) > 0xFFFFFFFF)) + return MZ_FALSE; + + pState = pZip->m_pState; + + if (pState->m_pFile) + { +#ifdef MINIZ_NO_STDIO + pFilename; return MZ_FALSE; +#else + // Archive is being read from stdio - try to reopen as writable. + if (pZip->m_pIO_opaque != pZip) + return MZ_FALSE; + if (!pFilename) + return MZ_FALSE; + pZip->m_pWrite = mz_zip_file_write_func; + if (NULL == (pState->m_pFile = MZ_FREOPEN(pFilename, "r+b", pState->m_pFile))) + { + // The mz_zip_archive is now in a bogus state because pState->m_pFile is NULL, so just close it. + mz_zip_reader_end(pZip); + return MZ_FALSE; + } +#endif // #ifdef MINIZ_NO_STDIO + } + else if (pState->m_pMem) + { + // Archive lives in a memory block. Assume it's from the heap that we can resize using the realloc callback. + if (pZip->m_pIO_opaque != pZip) + return MZ_FALSE; + pState->m_mem_capacity = pState->m_mem_size; + pZip->m_pWrite = mz_zip_heap_write_func; + } + // Archive is being read via a user provided read function - make sure the user has specified a write function too. + else if (!pZip->m_pWrite) + return MZ_FALSE; + + // Start writing new files at the archive's current central directory location. + pZip->m_archive_size = pZip->m_central_directory_file_ofs; + pZip->m_zip_mode = MZ_ZIP_MODE_WRITING; + pZip->m_central_directory_file_ofs = 0; + + return MZ_TRUE; +} + +mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, mz_uint level_and_flags) +{ + return mz_zip_writer_add_mem_ex(pZip, pArchive_name, pBuf, buf_size, NULL, 0, level_and_flags, 0, 0); +} + +typedef struct +{ + mz_zip_archive *m_pZip; + mz_uint64 m_cur_archive_file_ofs; + mz_uint64 m_comp_size; +} mz_zip_writer_add_state; + +static mz_bool mz_zip_writer_add_put_buf_callback(const void* pBuf, int len, void *pUser) +{ + mz_zip_writer_add_state *pState = (mz_zip_writer_add_state *)pUser; + if ((int)pState->m_pZip->m_pWrite(pState->m_pZip->m_pIO_opaque, pState->m_cur_archive_file_ofs, pBuf, len) != len) + return MZ_FALSE; + pState->m_cur_archive_file_ofs += len; + pState->m_comp_size += len; + return MZ_TRUE; +} + +static mz_bool mz_zip_writer_create_local_dir_header(mz_zip_archive *pZip, mz_uint8 *pDst, mz_uint16 filename_size, mz_uint16 extra_size, mz_uint64 uncomp_size, mz_uint64 comp_size, mz_uint32 uncomp_crc32, mz_uint16 method, mz_uint16 bit_flags, mz_uint16 dos_time, mz_uint16 dos_date) +{ + (void)pZip; + memset(pDst, 0, MZ_ZIP_LOCAL_DIR_HEADER_SIZE); + MZ_WRITE_LE32(pDst + MZ_ZIP_LDH_SIG_OFS, MZ_ZIP_LOCAL_DIR_HEADER_SIG); + MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_VERSION_NEEDED_OFS, method ? 20 : 0); + MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_BIT_FLAG_OFS, bit_flags); + MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_METHOD_OFS, method); + MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_FILE_TIME_OFS, dos_time); + MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_FILE_DATE_OFS, dos_date); + MZ_WRITE_LE32(pDst + MZ_ZIP_LDH_CRC32_OFS, uncomp_crc32); + MZ_WRITE_LE32(pDst + MZ_ZIP_LDH_COMPRESSED_SIZE_OFS, comp_size); + MZ_WRITE_LE32(pDst + MZ_ZIP_LDH_DECOMPRESSED_SIZE_OFS, uncomp_size); + MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_FILENAME_LEN_OFS, filename_size); + MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_EXTRA_LEN_OFS, extra_size); + return MZ_TRUE; +} + +static mz_bool mz_zip_writer_create_central_dir_header(mz_zip_archive *pZip, mz_uint8 *pDst, mz_uint16 filename_size, mz_uint16 extra_size, mz_uint16 comment_size, mz_uint64 uncomp_size, mz_uint64 comp_size, mz_uint32 uncomp_crc32, mz_uint16 method, mz_uint16 bit_flags, mz_uint16 dos_time, mz_uint16 dos_date, mz_uint64 local_header_ofs, mz_uint32 ext_attributes) +{ + (void)pZip; + memset(pDst, 0, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE); + MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_SIG_OFS, MZ_ZIP_CENTRAL_DIR_HEADER_SIG); + MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_VERSION_NEEDED_OFS, method ? 20 : 0); + MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_BIT_FLAG_OFS, bit_flags); + MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_METHOD_OFS, method); + MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_FILE_TIME_OFS, dos_time); + MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_FILE_DATE_OFS, dos_date); + MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_CRC32_OFS, uncomp_crc32); + MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS, comp_size); + MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS, uncomp_size); + MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_FILENAME_LEN_OFS, filename_size); + MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_EXTRA_LEN_OFS, extra_size); + MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_COMMENT_LEN_OFS, comment_size); + MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_EXTERNAL_ATTR_OFS, ext_attributes); + MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_LOCAL_HEADER_OFS, local_header_ofs); + return MZ_TRUE; +} + +static mz_bool mz_zip_writer_add_to_central_dir(mz_zip_archive *pZip, const char *pFilename, mz_uint16 filename_size, const void *pExtra, mz_uint16 extra_size, const void *pComment, mz_uint16 comment_size, mz_uint64 uncomp_size, mz_uint64 comp_size, mz_uint32 uncomp_crc32, mz_uint16 method, mz_uint16 bit_flags, mz_uint16 dos_time, mz_uint16 dos_date, mz_uint64 local_header_ofs, mz_uint32 ext_attributes) +{ + mz_zip_internal_state *pState = pZip->m_pState; + mz_uint32 central_dir_ofs = (mz_uint32)pState->m_central_dir.m_size; + size_t orig_central_dir_size = pState->m_central_dir.m_size; + mz_uint8 central_dir_header[MZ_ZIP_CENTRAL_DIR_HEADER_SIZE]; + + // No zip64 support yet + if ((local_header_ofs > 0xFFFFFFFF) || (((mz_uint64)pState->m_central_dir.m_size + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + filename_size + extra_size + comment_size) > 0xFFFFFFFF)) + return MZ_FALSE; + + if (!mz_zip_writer_create_central_dir_header(pZip, central_dir_header, filename_size, extra_size, comment_size, uncomp_size, comp_size, uncomp_crc32, method, bit_flags, dos_time, dos_date, local_header_ofs, ext_attributes)) + return MZ_FALSE; + + if ((!mz_zip_array_push_back(pZip, &pState->m_central_dir, central_dir_header, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE)) || + (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pFilename, filename_size)) || + (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pExtra, extra_size)) || + (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pComment, comment_size)) || + (!mz_zip_array_push_back(pZip, &pState->m_central_dir_offsets, ¢ral_dir_ofs, 1))) + { + // Try to push the central directory array back into its original state. + mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE); + return MZ_FALSE; + } + + return MZ_TRUE; +} + +static mz_bool mz_zip_writer_validate_archive_name(const char *pArchive_name) +{ + // Basic ZIP archive filename validity checks: Valid filenames cannot start with a forward slash, cannot contain a drive letter, and cannot use DOS-style backward slashes. + if (*pArchive_name == '/') + return MZ_FALSE; + while (*pArchive_name) + { + if ((*pArchive_name == '\\') || (*pArchive_name == ':')) + return MZ_FALSE; + pArchive_name++; + } + return MZ_TRUE; +} + +static mz_uint mz_zip_writer_compute_padding_needed_for_file_alignment(mz_zip_archive *pZip) +{ + mz_uint32 n; + if (!pZip->m_file_offset_alignment) + return 0; + n = (mz_uint32)(pZip->m_archive_size & (pZip->m_file_offset_alignment - 1)); + return (pZip->m_file_offset_alignment - n) & (pZip->m_file_offset_alignment - 1); +} + +static mz_bool mz_zip_writer_write_zeros(mz_zip_archive *pZip, mz_uint64 cur_file_ofs, mz_uint32 n) +{ + char buf[4096]; + memset(buf, 0, MZ_MIN(sizeof(buf), n)); + while (n) + { + mz_uint32 s = MZ_MIN(sizeof(buf), n); + if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_file_ofs, buf, s) != s) + return MZ_FALSE; + cur_file_ofs += s; n -= s; + } + return MZ_TRUE; +} + +mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, mz_uint64 uncomp_size, mz_uint32 uncomp_crc32) +{ + mz_uint16 method = 0, dos_time = 0, dos_date = 0; + mz_uint level, ext_attributes = 0, num_alignment_padding_bytes; + mz_uint64 local_dir_header_ofs = pZip->m_archive_size, cur_archive_file_ofs = pZip->m_archive_size, comp_size = 0; + size_t archive_name_size; + mz_uint8 local_dir_header[MZ_ZIP_LOCAL_DIR_HEADER_SIZE]; + tdefl_compressor *pComp = NULL; + mz_bool store_data_uncompressed; + mz_zip_internal_state *pState; + + if ((int)level_and_flags < 0) + level_and_flags = MZ_DEFAULT_LEVEL; + level = level_and_flags & 0xF; + store_data_uncompressed = ((!level) || (level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)); + + if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) || ((buf_size) && (!pBuf)) || (!pArchive_name) || ((comment_size) && (!pComment)) || (pZip->m_total_files == 0xFFFF) || (level > MZ_UBER_COMPRESSION)) + return MZ_FALSE; + + pState = pZip->m_pState; + + if ((!(level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) && (uncomp_size)) + return MZ_FALSE; + // No zip64 support yet + if ((buf_size > 0xFFFFFFFF) || (uncomp_size > 0xFFFFFFFF)) + return MZ_FALSE; + if (!mz_zip_writer_validate_archive_name(pArchive_name)) + return MZ_FALSE; + +#ifndef MINIZ_NO_TIME + { + time_t cur_time; time(&cur_time); + mz_zip_time_to_dos_time(cur_time, &dos_time, &dos_date); + } +#endif // #ifndef MINIZ_NO_TIME + + archive_name_size = strlen(pArchive_name); + if (archive_name_size > 0xFFFF) + return MZ_FALSE; + + num_alignment_padding_bytes = mz_zip_writer_compute_padding_needed_for_file_alignment(pZip); + + // no zip64 support yet + if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + num_alignment_padding_bytes + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + comment_size + archive_name_size) > 0xFFFFFFFF)) + return MZ_FALSE; + + if ((archive_name_size) && (pArchive_name[archive_name_size - 1] == '/')) + { + // Set DOS Subdirectory attribute bit. + ext_attributes |= 0x10; + // Subdirectories cannot contain data. + if ((buf_size) || (uncomp_size)) + return MZ_FALSE; + } + + // Try to do any allocations before writing to the archive, so if an allocation fails the file remains unmodified. (A good idea if we're doing an in-place modification.) + if ((!mz_zip_array_ensure_room(pZip, &pState->m_central_dir, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + archive_name_size + comment_size)) || (!mz_zip_array_ensure_room(pZip, &pState->m_central_dir_offsets, 1))) + return MZ_FALSE; + + if ((!store_data_uncompressed) && (buf_size)) + { + if (NULL == (pComp = (tdefl_compressor *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, sizeof(tdefl_compressor)))) + return MZ_FALSE; + } + + if (!mz_zip_writer_write_zeros(pZip, cur_archive_file_ofs, num_alignment_padding_bytes + sizeof(local_dir_header))) + { + pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); + return MZ_FALSE; + } + local_dir_header_ofs += num_alignment_padding_bytes; + if (pZip->m_file_offset_alignment) { MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignment - 1)) == 0); } + cur_archive_file_ofs += num_alignment_padding_bytes + sizeof(local_dir_header); + + MZ_CLEAR_OBJ(local_dir_header); + if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pArchive_name, archive_name_size) != archive_name_size) + { + pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); + return MZ_FALSE; + } + cur_archive_file_ofs += archive_name_size; + + if (!(level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) + { + uncomp_crc32 = (mz_uint32)mz_crc32(MZ_CRC32_INIT, (const mz_uint8*)pBuf, buf_size); + uncomp_size = buf_size; + if (uncomp_size <= 3) + { + level = 0; + store_data_uncompressed = MZ_TRUE; + } + } + + if (store_data_uncompressed) + { + if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pBuf, buf_size) != buf_size) + { + pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); + return MZ_FALSE; + } + + cur_archive_file_ofs += buf_size; + comp_size = buf_size; + + if (level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA) + method = MZ_DEFLATED; + } + else if (buf_size) + { + mz_zip_writer_add_state state; + + state.m_pZip = pZip; + state.m_cur_archive_file_ofs = cur_archive_file_ofs; + state.m_comp_size = 0; + + if ((tdefl_init(pComp, mz_zip_writer_add_put_buf_callback, &state, tdefl_create_comp_flags_from_zip_params(level, -15, MZ_DEFAULT_STRATEGY)) != TDEFL_STATUS_OKAY) || + (tdefl_compress_buffer(pComp, pBuf, buf_size, TDEFL_FINISH) != TDEFL_STATUS_DONE)) + { + pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); + return MZ_FALSE; + } + + comp_size = state.m_comp_size; + cur_archive_file_ofs = state.m_cur_archive_file_ofs; + + method = MZ_DEFLATED; + } + + pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); + pComp = NULL; + + // no zip64 support yet + if ((comp_size > 0xFFFFFFFF) || (cur_archive_file_ofs > 0xFFFFFFFF)) + return MZ_FALSE; + + if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, 0, uncomp_size, comp_size, uncomp_crc32, method, 0, dos_time, dos_date)) + return MZ_FALSE; + + if (pZip->m_pWrite(pZip->m_pIO_opaque, local_dir_header_ofs, local_dir_header, sizeof(local_dir_header)) != sizeof(local_dir_header)) + return MZ_FALSE; + + if (!mz_zip_writer_add_to_central_dir(pZip, pArchive_name, (mz_uint16)archive_name_size, NULL, 0, pComment, comment_size, uncomp_size, comp_size, uncomp_crc32, method, 0, dos_time, dos_date, local_dir_header_ofs, ext_attributes)) + return MZ_FALSE; + + pZip->m_total_files++; + pZip->m_archive_size = cur_archive_file_ofs; + + return MZ_TRUE; +} + +#ifndef MINIZ_NO_STDIO +mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, const char *pSrc_filename, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags) +{ + mz_uint uncomp_crc32 = MZ_CRC32_INIT, level, num_alignment_padding_bytes; + mz_uint16 method = 0, dos_time = 0, dos_date = 0, ext_attributes = 0; + mz_uint64 local_dir_header_ofs = pZip->m_archive_size, cur_archive_file_ofs = pZip->m_archive_size, uncomp_size = 0, comp_size = 0; + size_t archive_name_size; + mz_uint8 local_dir_header[MZ_ZIP_LOCAL_DIR_HEADER_SIZE]; + MZ_FILE *pSrc_file = NULL; + + if ((int)level_and_flags < 0) + level_and_flags = MZ_DEFAULT_LEVEL; + level = level_and_flags & 0xF; + + if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) || (!pArchive_name) || ((comment_size) && (!pComment)) || (level > MZ_UBER_COMPRESSION)) + return MZ_FALSE; + if (level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA) + return MZ_FALSE; + if (!mz_zip_writer_validate_archive_name(pArchive_name)) + return MZ_FALSE; + + archive_name_size = strlen(pArchive_name); + if (archive_name_size > 0xFFFF) + return MZ_FALSE; + + num_alignment_padding_bytes = mz_zip_writer_compute_padding_needed_for_file_alignment(pZip); + + // no zip64 support yet + if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + num_alignment_padding_bytes + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + comment_size + archive_name_size) > 0xFFFFFFFF)) + return MZ_FALSE; + + if (!mz_zip_get_file_modified_time(pSrc_filename, &dos_time, &dos_date)) + return MZ_FALSE; + + pSrc_file = MZ_FOPEN(pSrc_filename, "rb"); + if (!pSrc_file) + return MZ_FALSE; + MZ_FSEEK64(pSrc_file, 0, SEEK_END); + uncomp_size = MZ_FTELL64(pSrc_file); + MZ_FSEEK64(pSrc_file, 0, SEEK_SET); + + if (uncomp_size > 0xFFFFFFFF) + { + // No zip64 support yet + MZ_FCLOSE(pSrc_file); + return MZ_FALSE; + } + if (uncomp_size <= 3) + level = 0; + + if (!mz_zip_writer_write_zeros(pZip, cur_archive_file_ofs, num_alignment_padding_bytes + sizeof(local_dir_header))) + return MZ_FALSE; + local_dir_header_ofs += num_alignment_padding_bytes; + if (pZip->m_file_offset_alignment) { MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignment - 1)) == 0); } + cur_archive_file_ofs += num_alignment_padding_bytes + sizeof(local_dir_header); + + MZ_CLEAR_OBJ(local_dir_header); + if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pArchive_name, archive_name_size) != archive_name_size) + { + MZ_FCLOSE(pSrc_file); + return MZ_FALSE; + } + cur_archive_file_ofs += archive_name_size; + + if (uncomp_size) + { + mz_uint64 uncomp_remaining = uncomp_size; + void *pRead_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, MZ_ZIP_MAX_IO_BUF_SIZE); + if (!pRead_buf) + { + MZ_FCLOSE(pSrc_file); + return MZ_FALSE; + } + + if (!level) + { + while (uncomp_remaining) + { + mz_uint n = (mz_uint)MZ_MIN(MZ_ZIP_MAX_IO_BUF_SIZE, uncomp_remaining); + if ((MZ_FREAD(pRead_buf, 1, n, pSrc_file) != n) || (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pRead_buf, n) != n)) + { + pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); + MZ_FCLOSE(pSrc_file); + return MZ_FALSE; + } + uncomp_crc32 = (mz_uint32)mz_crc32(uncomp_crc32, (const mz_uint8 *)pRead_buf, n); + uncomp_remaining -= n; + cur_archive_file_ofs += n; + } + comp_size = uncomp_size; + } + else + { + mz_bool result = MZ_FALSE; + mz_zip_writer_add_state state; + tdefl_compressor *pComp = (tdefl_compressor *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, sizeof(tdefl_compressor)); + if (!pComp) + { + pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); + MZ_FCLOSE(pSrc_file); + return MZ_FALSE; + } + + state.m_pZip = pZip; + state.m_cur_archive_file_ofs = cur_archive_file_ofs; + state.m_comp_size = 0; + + if (tdefl_init(pComp, mz_zip_writer_add_put_buf_callback, &state, tdefl_create_comp_flags_from_zip_params(level, -15, MZ_DEFAULT_STRATEGY)) != TDEFL_STATUS_OKAY) + { + pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); + pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); + MZ_FCLOSE(pSrc_file); + return MZ_FALSE; + } + + for ( ; ; ) + { + size_t in_buf_size = (mz_uint32)MZ_MIN(uncomp_remaining, MZ_ZIP_MAX_IO_BUF_SIZE); + tdefl_status status; + + if (MZ_FREAD(pRead_buf, 1, in_buf_size, pSrc_file) != in_buf_size) + break; + + uncomp_crc32 = (mz_uint32)mz_crc32(uncomp_crc32, (const mz_uint8 *)pRead_buf, in_buf_size); + uncomp_remaining -= in_buf_size; + + status = tdefl_compress_buffer(pComp, pRead_buf, in_buf_size, uncomp_remaining ? TDEFL_NO_FLUSH : TDEFL_FINISH); + if (status == TDEFL_STATUS_DONE) + { + result = MZ_TRUE; + break; + } + else if (status != TDEFL_STATUS_OKAY) + break; + } + + pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); + + if (!result) + { + pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); + MZ_FCLOSE(pSrc_file); + return MZ_FALSE; + } + + comp_size = state.m_comp_size; + cur_archive_file_ofs = state.m_cur_archive_file_ofs; + + method = MZ_DEFLATED; + } + + pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); + } + + MZ_FCLOSE(pSrc_file); pSrc_file = NULL; + + // no zip64 support yet + if ((comp_size > 0xFFFFFFFF) || (cur_archive_file_ofs > 0xFFFFFFFF)) + return MZ_FALSE; + + if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, 0, uncomp_size, comp_size, uncomp_crc32, method, 0, dos_time, dos_date)) + return MZ_FALSE; + + if (pZip->m_pWrite(pZip->m_pIO_opaque, local_dir_header_ofs, local_dir_header, sizeof(local_dir_header)) != sizeof(local_dir_header)) + return MZ_FALSE; + + if (!mz_zip_writer_add_to_central_dir(pZip, pArchive_name, (mz_uint16)archive_name_size, NULL, 0, pComment, comment_size, uncomp_size, comp_size, uncomp_crc32, method, 0, dos_time, dos_date, local_dir_header_ofs, ext_attributes)) + return MZ_FALSE; + + pZip->m_total_files++; + pZip->m_archive_size = cur_archive_file_ofs; + + return MZ_TRUE; +} +#endif // #ifndef MINIZ_NO_STDIO + +mz_bool mz_zip_writer_add_from_zip_reader(mz_zip_archive *pZip, mz_zip_archive *pSource_zip, mz_uint file_index) +{ + mz_uint n, bit_flags, num_alignment_padding_bytes; + mz_uint64 comp_bytes_remaining, local_dir_header_ofs; + mz_uint64 cur_src_file_ofs, cur_dst_file_ofs; + mz_uint32 local_header_u32[(MZ_ZIP_LOCAL_DIR_HEADER_SIZE + sizeof(mz_uint32) - 1) / sizeof(mz_uint32)]; mz_uint8 *pLocal_header = (mz_uint8 *)local_header_u32; + mz_uint8 central_header[MZ_ZIP_CENTRAL_DIR_HEADER_SIZE]; + size_t orig_central_dir_size; + mz_zip_internal_state *pState; + void *pBuf; const mz_uint8 *pSrc_central_header; + + if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING)) + return MZ_FALSE; + if (NULL == (pSrc_central_header = mz_zip_reader_get_cdh(pSource_zip, file_index))) + return MZ_FALSE; + pState = pZip->m_pState; + + num_alignment_padding_bytes = mz_zip_writer_compute_padding_needed_for_file_alignment(pZip); + + // no zip64 support yet + if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + num_alignment_padding_bytes + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE) > 0xFFFFFFFF)) + return MZ_FALSE; + + cur_src_file_ofs = MZ_READ_LE32(pSrc_central_header + MZ_ZIP_CDH_LOCAL_HEADER_OFS); + cur_dst_file_ofs = pZip->m_archive_size; + + if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, cur_src_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != MZ_ZIP_LOCAL_DIR_HEADER_SIZE) + return MZ_FALSE; + if (MZ_READ_LE32(pLocal_header) != MZ_ZIP_LOCAL_DIR_HEADER_SIG) + return MZ_FALSE; + cur_src_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE; + + if (!mz_zip_writer_write_zeros(pZip, cur_dst_file_ofs, num_alignment_padding_bytes)) + return MZ_FALSE; + cur_dst_file_ofs += num_alignment_padding_bytes; + local_dir_header_ofs = cur_dst_file_ofs; + if (pZip->m_file_offset_alignment) { MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignment - 1)) == 0); } + + if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != MZ_ZIP_LOCAL_DIR_HEADER_SIZE) + return MZ_FALSE; + cur_dst_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE; + + n = MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_FILENAME_LEN_OFS) + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_EXTRA_LEN_OFS); + comp_bytes_remaining = n + MZ_READ_LE32(pSrc_central_header + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS); + + if (NULL == (pBuf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)MZ_MAX(sizeof(mz_uint32) * 4, MZ_MIN(MZ_ZIP_MAX_IO_BUF_SIZE, comp_bytes_remaining))))) + return MZ_FALSE; + + while (comp_bytes_remaining) + { + n = (mz_uint)MZ_MIN(MZ_ZIP_MAX_IO_BUF_SIZE, comp_bytes_remaining); + if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, cur_src_file_ofs, pBuf, n) != n) + { + pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); + return MZ_FALSE; + } + cur_src_file_ofs += n; + + if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pBuf, n) != n) + { + pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); + return MZ_FALSE; + } + cur_dst_file_ofs += n; + + comp_bytes_remaining -= n; + } + + bit_flags = MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_BIT_FLAG_OFS); + if (bit_flags & 8) + { + // Copy data descriptor + if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, cur_src_file_ofs, pBuf, sizeof(mz_uint32) * 4) != sizeof(mz_uint32) * 4) + { + pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); + return MZ_FALSE; + } + + n = sizeof(mz_uint32) * ((MZ_READ_LE32(pBuf) == 0x08074b50) ? 4 : 3); + if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pBuf, n) != n) + { + pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); + return MZ_FALSE; + } + + cur_src_file_ofs += n; + cur_dst_file_ofs += n; + } + pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); + + // no zip64 support yet + if (cur_dst_file_ofs > 0xFFFFFFFF) + return MZ_FALSE; + + orig_central_dir_size = pState->m_central_dir.m_size; + + memcpy(central_header, pSrc_central_header, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE); + MZ_WRITE_LE32(central_header + MZ_ZIP_CDH_LOCAL_HEADER_OFS, local_dir_header_ofs); + if (!mz_zip_array_push_back(pZip, &pState->m_central_dir, central_header, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE)) + return MZ_FALSE; + + n = MZ_READ_LE16(pSrc_central_header + MZ_ZIP_CDH_FILENAME_LEN_OFS) + MZ_READ_LE16(pSrc_central_header + MZ_ZIP_CDH_EXTRA_LEN_OFS) + MZ_READ_LE16(pSrc_central_header + MZ_ZIP_CDH_COMMENT_LEN_OFS); + if (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pSrc_central_header + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE, n)) + { + mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE); + return MZ_FALSE; + } + + if (pState->m_central_dir.m_size > 0xFFFFFFFF) + return MZ_FALSE; + n = (mz_uint32)pState->m_central_dir.m_size; + if (!mz_zip_array_push_back(pZip, &pState->m_central_dir_offsets, &n, 1)) + { + mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE); + return MZ_FALSE; + } + + pZip->m_total_files++; + pZip->m_archive_size = cur_dst_file_ofs; + + return MZ_TRUE; +} + +mz_bool mz_zip_writer_finalize_archive(mz_zip_archive *pZip) +{ + mz_zip_internal_state *pState; + mz_uint64 central_dir_ofs, central_dir_size; + mz_uint8 hdr[MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE]; + + if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING)) + return MZ_FALSE; + + pState = pZip->m_pState; + + // no zip64 support yet + if ((pZip->m_total_files > 0xFFFF) || ((pZip->m_archive_size + pState->m_central_dir.m_size + MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) > 0xFFFFFFFF)) + return MZ_FALSE; + + central_dir_ofs = 0; + central_dir_size = 0; + if (pZip->m_total_files) + { + // Write central directory + central_dir_ofs = pZip->m_archive_size; + central_dir_size = pState->m_central_dir.m_size; + pZip->m_central_directory_file_ofs = central_dir_ofs; + if (pZip->m_pWrite(pZip->m_pIO_opaque, central_dir_ofs, pState->m_central_dir.m_p, (size_t)central_dir_size) != central_dir_size) + return MZ_FALSE; + pZip->m_archive_size += central_dir_size; + } + + // Write end of central directory record + MZ_CLEAR_OBJ(hdr); + MZ_WRITE_LE32(hdr + MZ_ZIP_ECDH_SIG_OFS, MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG); + MZ_WRITE_LE16(hdr + MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS, pZip->m_total_files); + MZ_WRITE_LE16(hdr + MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS, pZip->m_total_files); + MZ_WRITE_LE32(hdr + MZ_ZIP_ECDH_CDIR_SIZE_OFS, central_dir_size); + MZ_WRITE_LE32(hdr + MZ_ZIP_ECDH_CDIR_OFS_OFS, central_dir_ofs); + + if (pZip->m_pWrite(pZip->m_pIO_opaque, pZip->m_archive_size, hdr, sizeof(hdr)) != sizeof(hdr)) + return MZ_FALSE; +#ifndef MINIZ_NO_STDIO + if ((pState->m_pFile) && (MZ_FFLUSH(pState->m_pFile) == EOF)) + return MZ_FALSE; +#endif // #ifndef MINIZ_NO_STDIO + + pZip->m_archive_size += sizeof(hdr); + + pZip->m_zip_mode = MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED; + return MZ_TRUE; +} + +mz_bool mz_zip_writer_finalize_heap_archive(mz_zip_archive *pZip, void **pBuf, size_t *pSize) +{ + if ((!pZip) || (!pZip->m_pState) || (!pBuf) || (!pSize)) + return MZ_FALSE; + if (pZip->m_pWrite != mz_zip_heap_write_func) + return MZ_FALSE; + if (!mz_zip_writer_finalize_archive(pZip)) + return MZ_FALSE; + + *pBuf = pZip->m_pState->m_pMem; + *pSize = pZip->m_pState->m_mem_size; + pZip->m_pState->m_pMem = NULL; + pZip->m_pState->m_mem_size = pZip->m_pState->m_mem_capacity = 0; + return MZ_TRUE; +} + +mz_bool mz_zip_writer_end(mz_zip_archive *pZip) +{ + mz_zip_internal_state *pState; + mz_bool status = MZ_TRUE; + if ((!pZip) || (!pZip->m_pState) || (!pZip->m_pAlloc) || (!pZip->m_pFree) || ((pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) && (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED))) + return MZ_FALSE; + + pState = pZip->m_pState; + pZip->m_pState = NULL; + mz_zip_array_clear(pZip, &pState->m_central_dir); + mz_zip_array_clear(pZip, &pState->m_central_dir_offsets); + mz_zip_array_clear(pZip, &pState->m_sorted_central_dir_offsets); + +#ifndef MINIZ_NO_STDIO + if (pState->m_pFile) + { + MZ_FCLOSE(pState->m_pFile); + pState->m_pFile = NULL; + } +#endif // #ifndef MINIZ_NO_STDIO + + if ((pZip->m_pWrite == mz_zip_heap_write_func) && (pState->m_pMem)) + { + pZip->m_pFree(pZip->m_pAlloc_opaque, pState->m_pMem); + pState->m_pMem = NULL; + } + + pZip->m_pFree(pZip->m_pAlloc_opaque, pState); + pZip->m_zip_mode = MZ_ZIP_MODE_INVALID; + return status; +} + +#ifndef MINIZ_NO_STDIO +mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags) +{ + mz_bool status, created_new_archive = MZ_FALSE; + mz_zip_archive zip_archive; + struct MZ_FILE_STAT_STRUCT file_stat; + MZ_CLEAR_OBJ(zip_archive); + if ((int)level_and_flags < 0) + level_and_flags = MZ_DEFAULT_LEVEL; + if ((!pZip_filename) || (!pArchive_name) || ((buf_size) && (!pBuf)) || ((comment_size) && (!pComment)) || ((level_and_flags & 0xF) > MZ_UBER_COMPRESSION)) + return MZ_FALSE; + if (!mz_zip_writer_validate_archive_name(pArchive_name)) + return MZ_FALSE; + if (MZ_FILE_STAT(pZip_filename, &file_stat) != 0) + { + // Create a new archive. + if (!mz_zip_writer_init_file(&zip_archive, pZip_filename, 0)) + return MZ_FALSE; + created_new_archive = MZ_TRUE; + } + else + { + // Append to an existing archive. + if (!mz_zip_reader_init_file(&zip_archive, pZip_filename, level_and_flags | MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY)) + return MZ_FALSE; + if (!mz_zip_writer_init_from_reader(&zip_archive, pZip_filename)) + { + mz_zip_reader_end(&zip_archive); + return MZ_FALSE; + } + } + status = mz_zip_writer_add_mem_ex(&zip_archive, pArchive_name, pBuf, buf_size, pComment, comment_size, level_and_flags, 0, 0); + // Always finalize, even if adding failed for some reason, so we have a valid central directory. (This may not always succeed, but we can try.) + if (!mz_zip_writer_finalize_archive(&zip_archive)) + status = MZ_FALSE; + if (!mz_zip_writer_end(&zip_archive)) + status = MZ_FALSE; + if ((!status) && (created_new_archive)) + { + // It's a new archive and something went wrong, so just delete it. + int ignoredStatus = MZ_DELETE_FILE(pZip_filename); + (void)ignoredStatus; + } + return status; +} + +void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char *pArchive_name, size_t *pSize, mz_uint flags) +{ + int file_index; + mz_zip_archive zip_archive; + void *p = NULL; + + if (pSize) + *pSize = 0; + + if ((!pZip_filename) || (!pArchive_name)) + return NULL; + + MZ_CLEAR_OBJ(zip_archive); + if (!mz_zip_reader_init_file(&zip_archive, pZip_filename, flags | MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY)) + return NULL; + + if ((file_index = mz_zip_reader_locate_file(&zip_archive, pArchive_name, NULL, flags)) >= 0) + p = mz_zip_reader_extract_to_heap(&zip_archive, file_index, pSize, flags); + + mz_zip_reader_end(&zip_archive); + return p; +} + +#endif // #ifndef MINIZ_NO_STDIO + +#endif // #ifndef MINIZ_NO_ARCHIVE_WRITING_APIS + +#endif // #ifndef MINIZ_NO_ARCHIVE_APIS + +#ifdef __cplusplus +} +#endif + +#endif // MINIZ_HEADER_FILE_ONLY + +/* + This is free and unencumbered software released into the public domain. + + Anyone is free to copy, modify, publish, use, compile, sell, or + distribute this software, either in source code form or as a compiled + binary, for any purpose, commercial or non-commercial, and by any + means. + + In jurisdictions that recognize copyright laws, the author or authors + of this software dedicate any and all copyright interest in the + software to the public domain. We make this dedication for the benefit + of the public at large and to the detriment of our heirs and + successors. We intend this dedication to be an overt act of + relinquishment in perpetuity of all present and future rights to this + software under copyright law. + + 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 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. + + For more information, please refer to +*/ \ No newline at end of file diff -Nru mapnik-2.1.0/src/miniz_png.cpp mapnik-2.2.0/src/miniz_png.cpp --- mapnik-2.1.0/src/miniz_png.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/miniz_png.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,365 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2012 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include +#include +#include +#include + +// miniz +#define MINIZ_NO_ARCHIVE_APIS +#define MINIZ_NO_STDIO +#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES +#include "miniz.c" + +// zlib +#include + +// stl +#include +#include +#include + +namespace mapnik { namespace MiniZ { + +PNGWriter::PNGWriter(int level, int strategy) +{ + buffer = NULL; + compressor = NULL; + + if (level == -1) + { + level = MZ_DEFAULT_LEVEL; // 6 + } + else if (level < 0 || level > 10) + { + throw std::runtime_error("compression level must be between 0 and 10"); + } + mz_uint flags = s_tdefl_num_probes[level] | (level <= 3) ? TDEFL_GREEDY_PARSING_FLAG : 0 | TDEFL_WRITE_ZLIB_HEADER; + if (strategy == Z_FILTERED) flags |= TDEFL_FILTER_MATCHES; + else if (strategy == Z_HUFFMAN_ONLY) flags &= ~TDEFL_MAX_PROBES_MASK; + else if (strategy == Z_RLE) flags |= TDEFL_RLE_MATCHES; + else if (strategy == Z_FIXED) flags |= TDEFL_FORCE_ALL_STATIC_BLOCKS; + + buffer = (tdefl_output_buffer *)MZ_MALLOC(sizeof(tdefl_output_buffer)); + if (buffer == NULL) + { + throw std::bad_alloc(); + } + + buffer->m_pBuf = NULL; + buffer->m_capacity = 8192; + buffer->m_expandable = MZ_TRUE; + buffer->m_pBuf = (mz_uint8 *)MZ_MALLOC(buffer->m_capacity); + if (buffer->m_pBuf == NULL) + { + throw std::bad_alloc(); + } + + compressor = (tdefl_compressor *)MZ_MALLOC(sizeof(tdefl_compressor)); + if (compressor == NULL) + { + throw std::bad_alloc(); + } + + // Reset output buffer. + buffer->m_size = 0; + tdefl_status tdstatus = tdefl_init(compressor, tdefl_output_buffer_putter, buffer, flags); + if (tdstatus != TDEFL_STATUS_OKAY) + { + throw std::runtime_error("tdefl_init failed"); + } + + // Write preamble. + mz_bool status = tdefl_output_buffer_putter(preamble, 8, buffer); + if (status != MZ_TRUE) + { + throw std::bad_alloc(); + } +} + +PNGWriter::~PNGWriter() +{ + if (compressor) + { + MZ_FREE(compressor); + } + if (buffer) + { + if (buffer->m_pBuf) + { + MZ_FREE(buffer->m_pBuf); + } + MZ_FREE(buffer); + } +} + +inline void PNGWriter::writeUInt32BE(mz_uint8 *target, mz_uint32 value) +{ + target[0] = (value >> 24) & 0xFF; + target[1] = (value >> 16) & 0xFF; + target[2] = (value >> 8) & 0xFF; + target[3] = value & 0xFF; +} + +size_t PNGWriter::startChunk(const mz_uint8 header[], size_t length) +{ + size_t start = buffer->m_size; + mz_bool status = tdefl_output_buffer_putter(header, length, buffer); + if (status != MZ_TRUE) + { + throw std::bad_alloc(); + } + return start; +} + +void PNGWriter::finishChunk(size_t start) +{ + // Write chunk length at the beginning of the chunk. + size_t payloadLength = buffer->m_size - start - 4 - 4; + writeUInt32BE(buffer->m_pBuf + start, payloadLength); + + // Write CRC32 checksum. Don't include the 4-byte length, but /do/ include + // the 4-byte chunk name. + mz_uint32 crc = mz_crc32(MZ_CRC32_INIT, buffer->m_pBuf + start + 4, payloadLength + 4); + mz_uint8 checksum[] = { crc >> 24, crc >> 16, crc >> 8, crc }; + mz_bool status = tdefl_output_buffer_putter(checksum, 4, buffer); + if (status != MZ_TRUE) + { + throw std::bad_alloc(); + } +} + +void PNGWriter::writeIHDR(mz_uint32 width, mz_uint32 height, mz_uint8 pixel_depth) +{ + // Write IHDR chunk. + size_t IHDR = startChunk(IHDR_tpl, 21); + writeUInt32BE(buffer->m_pBuf + IHDR + 8, width); + writeUInt32BE(buffer->m_pBuf + IHDR + 12, height); + + if (pixel_depth == 32) + { + // Alpha full color image. + buffer->m_pBuf[IHDR + 16] = 8; // bit depth + buffer->m_pBuf[IHDR + 17] = 6; // color type (6 == true color with alpha) + } + else if (pixel_depth == 24) + { + // Full color image. + buffer->m_pBuf[IHDR + 16] = 8; // bit depth + buffer->m_pBuf[IHDR + 17] = 2; // color type (2 == true color without alpha) + } + else + { + // Paletted image. + buffer->m_pBuf[IHDR + 16] = pixel_depth; // bit depth + buffer->m_pBuf[IHDR + 17] = 3; // color type (3 == indexed color) + } + + buffer->m_pBuf[IHDR + 18] = 0; // compression method + buffer->m_pBuf[IHDR + 19] = 0; // filter method + buffer->m_pBuf[IHDR + 20] = 0; // interlace method + finishChunk(IHDR); +} + +void PNGWriter::writePLTE(std::vector const& palette) +{ + // Write PLTE chunk. + size_t PLTE = startChunk(PLTE_tpl, 8); + const mz_uint8 *colors = reinterpret_cast(&palette[0]); + mz_bool status = tdefl_output_buffer_putter(colors, palette.size() * 3, buffer); + if (status != MZ_TRUE) + { + throw std::bad_alloc(); + } + finishChunk(PLTE); +} + +void PNGWriter::writetRNS(std::vector const& alpha) +{ + if (alpha.size() == 0) + { + return; + } + + std::vector transparency(alpha.size()); + unsigned char transparencySize = 0; // Stores position of biggest to nonopaque value. + for(unsigned i = 0; i < alpha.size(); i++) + { + transparency[i] = alpha[i]; + if (alpha[i] < 255) + { + transparencySize = i + 1; + } + } + if (transparencySize > 0) + { + // Write tRNS chunk. + size_t tRNS = startChunk(tRNS_tpl, 8); + mz_bool status = tdefl_output_buffer_putter(&transparency[0], transparencySize, buffer); + if (status != MZ_TRUE) + { + throw std::bad_alloc(); + } + finishChunk(tRNS); + } +} + +template +void PNGWriter::writeIDAT(T const& image) +{ + // Write IDAT chunk. + size_t IDAT = startChunk(IDAT_tpl, 8); + mz_uint8 filter_type = 0; + tdefl_status status; + + int bytes_per_pixel = sizeof(typename T::pixel_type); + int stride = image.width() * bytes_per_pixel; + + for (unsigned int y = 0; y < image.height(); y++) + { + // Write filter_type + status = tdefl_compress_buffer(compressor, &filter_type, 1, TDEFL_NO_FLUSH); + if (status != TDEFL_STATUS_OKAY) + { + throw std::runtime_error("failed to compress image"); + } + + // Write scanline + status = tdefl_compress_buffer(compressor, (mz_uint8 *)image.getRow(y), stride, TDEFL_NO_FLUSH); + if (status != TDEFL_STATUS_OKAY) + { + throw std::runtime_error("failed to compress image"); + } + } + + status = tdefl_compress_buffer(compressor, NULL, 0, TDEFL_FINISH); + if (status != TDEFL_STATUS_DONE) + { + throw std::runtime_error("failed to compress image"); + } + + finishChunk(IDAT); +} + +template +void PNGWriter::writeIDATStripAlpha(T const& image) { + // Write IDAT chunk. + size_t IDAT = startChunk(IDAT_tpl, 8); + mz_uint8 filter_type = 0; + tdefl_status status; + + size_t stride = image.width() * 3; + size_t i, j; + mz_uint8 *scanline = (mz_uint8 *)MZ_MALLOC(stride); + + for (unsigned int y = 0; y < image.height(); y++) { + // Write filter_type + status = tdefl_compress_buffer(compressor, &filter_type, 1, TDEFL_NO_FLUSH); + if (status != TDEFL_STATUS_OKAY) + { + MZ_FREE(scanline); + throw std::runtime_error("failed to compress image"); + } + + // Strip alpha bytes from scanline + mz_uint8 *row = (mz_uint8 *)image.getRow(y); + for (i = 0, j = 0; j < stride; i += 4, j += 3) { + scanline[j] = row[i]; + scanline[j+1] = row[i+1]; + scanline[j+2] = row[i+2]; + } + + // Write scanline + status = tdefl_compress_buffer(compressor, scanline, stride, TDEFL_NO_FLUSH); + if (status != TDEFL_STATUS_OKAY) { + MZ_FREE(scanline); + throw std::runtime_error("failed to compress image"); + } + } + + MZ_FREE(scanline); + + status = tdefl_compress_buffer(compressor, NULL, 0, TDEFL_FINISH); + if (status != TDEFL_STATUS_DONE) throw std::runtime_error("failed to compress image"); + + finishChunk(IDAT); +} + +void PNGWriter::writeIEND() +{ + // Write IEND chunk. + size_t IEND = startChunk(IEND_tpl, 8); + finishChunk(IEND); +} + +void PNGWriter::toStream(std::ostream& stream) +{ + stream.write((char *)buffer->m_pBuf, buffer->m_size); +} + +const mz_uint8 PNGWriter::preamble[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a +}; + +const mz_uint8 PNGWriter::IHDR_tpl[] = { + 0x00, 0x00, 0x00, 0x0D, // chunk length + 'I', 'H', 'D', 'R', // "IHDR" + 0x00, 0x00, 0x00, 0x00, // image width (4 bytes) + 0x00, 0x00, 0x00, 0x00, // image height (4 bytes) + 0x00, // bit depth (1 byte) + 0x00, // color type (1 byte) + 0x00, // compression method (1 byte), has to be 0 + 0x00, // filter method (1 byte) + 0x00 // interlace method (1 byte) +}; + +const mz_uint8 PNGWriter::PLTE_tpl[] = { + 0x00, 0x00, 0x00, 0x00, // chunk length + 'P', 'L', 'T', 'E' // "IDAT" +}; + +const mz_uint8 PNGWriter::tRNS_tpl[] = { + 0x00, 0x00, 0x00, 0x00, // chunk length + 't', 'R', 'N', 'S' // "IDAT" +}; + +const mz_uint8 PNGWriter::IDAT_tpl[] = { + 0x00, 0x00, 0x00, 0x00, // chunk length + 'I', 'D', 'A', 'T' // "IDAT" +}; + +const mz_uint8 PNGWriter::IEND_tpl[] = { + 0x00, 0x00, 0x00, 0x00, // chunk length + 'I', 'E', 'N', 'D' // "IEND" +}; + +template void PNGWriter::writeIDAT(image_data_8 const& image); +template void PNGWriter::writeIDAT >(image_view const& image); +template void PNGWriter::writeIDAT(image_data_32 const& image); +template void PNGWriter::writeIDAT >(image_view const& image); +template void PNGWriter::writeIDATStripAlpha(image_data_32 const& image); +template void PNGWriter::writeIDATStripAlpha >(image_view const& image); + +}} + diff -Nru mapnik-2.1.0/src/palette.cpp mapnik-2.2.0/src/palette.cpp --- mapnik-2.1.0/src/palette.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/palette.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,6 +23,10 @@ #include #include +// stl +#include +#include + namespace mapnik { @@ -43,21 +47,22 @@ return x.b < y.b; } -std::size_t rgba::hash_func::operator()(rgba const& p) const -{ - return ((std::size_t)p.r * 33023 + (std::size_t)p.g * 30013 + - (std::size_t)p.b * 27011 + (std::size_t)p.a * 24007) % 21001; -} - - rgba_palette::rgba_palette(std::string const& pal, palette_type type) : colors_(0) { +#ifdef USE_DENSE_HASH_MAP + color_hashmap_.set_empty_key(0); +#endif parse(pal, type); } rgba_palette::rgba_palette() - : colors_(0) {} + : colors_(0) +{ +#ifdef USE_DENSE_HASH_MAP + color_hashmap_.set_empty_key(0); +#endif +} const std::vector& rgba_palette::palette() const { @@ -74,19 +79,46 @@ return colors_ > 0; } +std::string rgba_palette::to_string() const +{ + unsigned length = rgb_pal_.size(); + unsigned alphaLength = alpha_pal_.size(); + std::ostringstream str(""); + str << "[Palette " << length; + if (length == 1) + { + str << " color"; + } + else + { + str << " colors"; + } + str << std::hex << std::setfill('0'); + for (unsigned i = 0; i < length; i++) { + str << " #"; + str << std::setw(2) << (unsigned)rgb_pal_[i].r; + str << std::setw(2) << (unsigned)rgb_pal_[i].g; + str << std::setw(2) << (unsigned)rgb_pal_[i].b; + if (i < alphaLength) str << std::setw(2) << alpha_pal_[i]; + } + str << "]"; + return str.str(); +} + // return color index in returned earlier palette -unsigned rgba_palette::quantize(rgba const& c) const +unsigned char rgba_palette::quantize(unsigned val) const { - unsigned index = 0; - if (colors_ == 1) return index; + unsigned char index = 0; + if (colors_ == 1 || val == 0) return index; - rgba_hash_table::iterator it = color_hashmap_.find(c); + rgba_hash_table::iterator it = color_hashmap_.find(val); if (it != color_hashmap_.end()) { index = it->second; } else { + rgba c(val); int dr, dg, db, da; int dist, newdist; @@ -143,7 +175,7 @@ } // Cache found index for the color c into the hashmap. - color_hashmap_[c] = index; + color_hashmap_[val] = index; } return index; @@ -166,7 +198,6 @@ } sorted_pal_.clear(); - color_hashmap_.clear(); rgb_pal_.clear(); alpha_pal_.clear(); @@ -193,6 +224,11 @@ colors_ = sorted_pal_.size(); +#ifdef USE_DENSE_HASH_MAP + color_hashmap_.resize((colors_*2)); +#endif + color_hashmap_.clear(); + // Sort palette for binary searching in quantization std::sort(sorted_pal_.begin(), sorted_pal_.end(), rgba::mean_sort_cmp()); @@ -200,7 +236,11 @@ for (unsigned i = 0; i < colors_; i++) { rgba c = sorted_pal_[i]; - color_hashmap_[c] = i; + unsigned val = c.r | (c.g << 8) | (c.b << 16) | (c.a << 24); + if (val != 0) + { + color_hashmap_[val] = i; + } rgb_pal_.push_back(rgb(c)); if (c.a < 0xFF) { diff -Nru mapnik-2.1.0/src/params.cpp mapnik-2.2.0/src/params.cpp --- mapnik-2.1.0/src/params.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/params.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,48 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2012 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include +#include +#include +#include + +namespace mapnik { + +template boost::optional parameters::get(std::string const& key) const; +template boost::optional parameters::get(std::string const& key, std::string const& default_opt_value) const; + +template boost::optional parameters::get(std::string const& key) const; +template boost::optional parameters::get(std::string const& key, value_double const& default_opt_value) const; + +template boost::optional parameters::get(std::string const& key) const; +template boost::optional parameters::get(std::string const& key, int const& default_opt_value) const; + +template boost::optional parameters::get(std::string const& key) const; +template boost::optional parameters::get(std::string const& key, mapnik::boolean const& default_opt_value) const; + +#ifdef BIGINT +template boost::optional parameters::get(std::string const& key) const; +template boost::optional parameters::get(std::string const& key, value_integer const& default_opt_value) const; +#endif + +} diff -Nru mapnik-2.1.0/src/parse_path.cpp mapnik-2.2.0/src/parse_path.cpp --- mapnik-2.1.0/src/parse_path.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/parse_path.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,36 +23,132 @@ #include #include +#include +#include +#include +#include + +// boost +#include +#include #include +// stl +#include + + namespace mapnik { -path_expression_ptr parse_path(std::string const & str) +path_expression_ptr parse_path(std::string const& str) { - path_expression_ptr path = boost::make_shared(); path_expression_grammar g; + return parse_path(str,g); +} +path_expression_ptr parse_path(std::string const& str, + path_expression_grammar const& g) +{ + path_expression path; + std::string::const_iterator itr = str.begin(); std::string::const_iterator end = str.end(); - bool r = qi::phrase_parse(itr, end, g, space, *path); + bool r = qi::phrase_parse(itr, end, g, boost::spirit::standard_wide::space, path); if (r && itr == end) { - return path; + return boost::make_shared(path); //path; } else { - throw std::runtime_error("Failed to parse path expression"); + throw std::runtime_error("Failed to parse path expression: \"" + str + "\""); } } -bool parse_path_from_string(path_expression_ptr const& path, - std::string const & str, - path_expression_grammar const& g) +namespace path_processor_detail { + struct path_visitor_ : boost::static_visitor + { + path_visitor_ (std::string & filename, feature_impl const& f) + : filename_(filename), + feature_(f) {} + + void operator() (std::string const& token) const + { + filename_ += token; + } + + void operator() (attribute const& attr) const + { + // convert mapnik::value to std::string + value const& val = feature_.get(attr.name()); + filename_ += val.to_string(); + } + + std::string & filename_; + feature_impl const& feature_; + }; + + struct to_string_ : boost::static_visitor + { + to_string_ (std::string & str) + : str_(str) {} + + void operator() (std::string const& token) const + { + str_ += token; + } + + void operator() (attribute const& attr) const + { + str_ += "["; + str_ += attr.name(); + str_ += "]"; + } + + std::string & str_; + }; + + struct collect_ : boost::static_visitor + { + collect_ (std::set & cont) + : cont_(cont) {} + + void operator() (std::string const& token) const + { + boost::ignore_unused_variable_warning(token); + } + + void operator() (attribute const& attr) const + { + cont_.insert(attr.name()); + } + + std::set & cont_; + }; +} + +std::string path_processor::evaluate(path_expression const& path,feature_impl const& f) { - std::string::const_iterator itr = str.begin(); - std::string::const_iterator end = str.end(); - bool r = qi::phrase_parse(itr, end, g, space, *path); - return (r && itr==end); + std::string out; + path_processor_detail::path_visitor_ eval(out,f); + BOOST_FOREACH( mapnik::path_component const& token, path) + boost::apply_visitor(eval,token); + return out; +} + +std::string path_processor::to_string(path_expression const& path) +{ + std::string str; + path_processor_detail::to_string_ visitor(str); + BOOST_FOREACH( mapnik::path_component const& token, path) + boost::apply_visitor(visitor,token); + return str; +} + +void path_processor::collect_attributes(path_expression const& path, std::set& names) +{ + path_processor_detail::collect_ visitor(names); + BOOST_FOREACH( mapnik::path_component const& token, path) + boost::apply_visitor(visitor,token); } + } diff -Nru mapnik-2.1.0/src/parse_transform.cpp mapnik-2.2.0/src/parse_transform.cpp --- mapnik-2.1.0/src/parse_transform.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/parse_transform.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -39,7 +39,7 @@ transform_list_ptr tl = boost::make_shared(); transcoder tc(encoding); expression_grammar ge(tc); - transform_expression_grammar__string gte(ge); + transform_expression_grammar_string gte(ge); if (!parse_transform(*tl, str, gte)) { @@ -50,7 +50,7 @@ bool parse_transform(transform_list& transform, std::string const& str, - transform_expression_grammar__string const& g) + transform_expression_grammar_string const& g) { std::string::const_iterator itr = str.begin(); std::string::const_iterator end = str.end(); diff -Nru mapnik-2.1.0/src/path_expression_grammar.cpp mapnik-2.2.0/src/path_expression_grammar.cpp --- mapnik-2.1.0/src/path_expression_grammar.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/path_expression_grammar.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,7 +25,6 @@ #include // boost -#include #include #include #include diff -Nru mapnik-2.1.0/src/placement_finder.cpp mapnik-2.2.0/src/placement_finder.cpp --- mapnik-2.1.0/src/placement_finder.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/placement_finder.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,6 +21,8 @@ *****************************************************************************/ //mapnik +#include +#include #include #include #include @@ -32,7 +34,6 @@ // boost #include -#include #include #include #include @@ -40,6 +41,7 @@ //stl #include #include +#include #ifndef M_PI #define M_PI 3.14159265358979323846 @@ -95,7 +97,7 @@ } template -placement_finder::placement_finder(Feature const& feature, +placement_finder::placement_finder(feature_impl const& feature, text_placement_info const& placement_info, string_info const& info, DetectorT & detector, @@ -482,11 +484,8 @@ if (p.minimum_padding > 0) { - double min_pad = pi.get_actual_minimum_padding(); - box2d epad(e.minx()-min_pad, - e.miny()-min_pad, - e.maxx()+min_pad, - e.maxy()+min_pad); + box2d epad = e; + epad.pad(pi.get_actual_minimum_padding()); if (!dimensions_.contains(epad)) { return; @@ -663,8 +662,8 @@ anglesum += angle; } anglesum /= current_placement->nodes_.size(); //Now it is angle average - double cosa = orientation * cos(anglesum); - double sina = orientation * sin(anglesum); + double cosa = orientation * std::cos(anglesum); + double sina = orientation * std::sin(anglesum); //Offset all the characters by this angle for (unsigned i = 0; i < current_placement->nodes_.size(); i++) @@ -841,7 +840,7 @@ while (angle_delta < -M_PI) angle_delta += 2*M_PI; if (p.max_char_angle_delta > 0 && - fabs(angle_delta) > p.max_char_angle_delta) + std::fabs(angle_delta) > p.max_char_angle_delta) { //MAPNIK_LOG_ERROR(placement_finder) << "FAIL: Too Bendy!"; return std::auto_ptr(NULL); @@ -919,7 +918,7 @@ double cwidth = ci.width + ci.format->character_spacing; char_info_ptr c; double x, y, angle; - current_placement->vertex(&c, &x, &y, &angle); + current_placement->vertex(c, x, y, angle); x = current_placement->center.x + x; y = current_placement->center.y - y; @@ -963,11 +962,9 @@ } if (p.minimum_padding > 0) { - double min_pad = pi.get_actual_minimum_padding(); - box2d epad(e.minx()-min_pad, - e.miny()-min_pad, - e.maxx()+min_pad, - e.maxy()+min_pad); + + box2d epad = e; + epad.pad(pi.get_actual_minimum_padding()); if (!dimensions_.contains(epad)) { status = false; diff -Nru mapnik-2.1.0/src/plugin.cpp mapnik-2.2.0/src/plugin.cpp --- mapnik-2.1.0/src/plugin.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/plugin.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,30 +21,86 @@ *****************************************************************************/ #include -#include +#include + +#ifdef _WINDOWS + #include + #define handle HMODULE + #define dlsym GetProcAddress + #define dlclose FreeLibrary + #define dlerror GetLastError +#else + #include + #define handle void * +#endif + +// TODO - handle/report dlerror namespace mapnik { -PluginInfo::PluginInfo (const std::string& name,const lt_dlhandle module) - :name_(name),module_(module) {} +struct _mapnik_lib_t { + handle dl; +}; + +PluginInfo::PluginInfo(std::string const& filename, + std::string const& library_name) + : filename_(filename), + name_(), + module_(new mapnik_lib_t) + { +#ifdef _WINDOWS + if (module_) module_->dl = LoadLibraryA(filename.c_str()); +#else + if (module_) module_->dl = dlopen(filename.c_str(),RTLD_LAZY); +#endif + if (module_ && module_->dl) + { + name_func* name = reinterpret_cast(dlsym(module_->dl, library_name.c_str())); + if (name) name_ = name(); + } + } PluginInfo::~PluginInfo() { if (module_) { - lt_dlclose(module_),module_=0; + if (module_->dl) dlclose(module_->dl),module_->dl=0; + delete module_; } } -const std::string& PluginInfo::name() const + +void * PluginInfo::get_symbol(std::string const& sym_name) const +{ + return static_cast(dlsym(module_->dl, sym_name.c_str())); +} + +std::string const& PluginInfo::name() const { return name_; } -lt_dlhandle PluginInfo::handle() const +bool PluginInfo::valid() const +{ + if (module_ && module_->dl && !name_.empty()) return true; + return false; +} + +std::string PluginInfo::get_error() const +{ + return std::string("could not open: '") + name_ + "'"; +} + +void PluginInfo::init() { - return module_; + // do any initialization needed } +void PluginInfo::exit() +{ + // do any shutdown needed +} + + } diff -Nru mapnik-2.1.0/src/png_reader.cpp mapnik-2.2.0/src/png_reader.cpp --- mapnik-2.1.0/src/png_reader.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/png_reader.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -20,6 +20,7 @@ * *****************************************************************************/ +// mapnik #include #include @@ -27,50 +28,72 @@ { #include } - +// boost #include -#include +#include +#include namespace mapnik { -class png_reader : public image_reader, boost::noncopyable + +template +class png_reader : public image_reader { + typedef T source_type; + typedef boost::iostreams::stream ifstream; + + struct png_struct_guard + { + png_struct_guard(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr) + : p_(png_ptr_ptr), + i_(info_ptr_ptr) {} + + ~png_struct_guard() + { + png_destroy_read_struct(p_,i_,0); + } + png_structpp p_; + png_infopp i_; + }; + private: - std::string fileName_; + + source_type source_; + ifstream stream_; unsigned width_; unsigned height_; int bit_depth_; int color_type_; public: - explicit png_reader(const std::string& fileName); + explicit png_reader(std::string const& file_name); + explicit png_reader(char const* data, std::size_t size); ~png_reader(); unsigned width() const; unsigned height() const; + bool premultiplied_alpha() const { return false; } //http://www.libpng.org/pub/png/spec/1.1/PNG-Rationale.html void read(unsigned x,unsigned y,image_data_32& image); private: void init(); + static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length); }; namespace { -image_reader* create_png_reader(const std::string& file) + +image_reader* create_png_reader(std::string const& file) { - return new png_reader(file); -} -const bool registered = register_image_reader("png",create_png_reader); + return new png_reader(file); } -png_reader::png_reader(const std::string& fileName) - : fileName_(fileName), - width_(0), - height_(0), - bit_depth_(0), - color_type_(0) +image_reader* create_png_reader2(char const * data, std::size_t size) { - init(); + return new png_reader(data, size); +} + +const bool registered = register_image_reader("png",create_png_reader); +const bool registered2 = register_image_reader("png", create_png_reader2); } -png_reader::~png_reader() {} void user_error_fn(png_structp png_ptr, png_const_charp error_msg) { @@ -82,42 +105,70 @@ MAPNIK_LOG_DEBUG(png_reader) << "libpng warning: '" << warning_msg << "'"; } -static void -png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) +template +void png_reader::png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) { - png_size_t check; - check = (png_size_t)fread(data, (png_size_t)1, length, - (FILE *)png_get_io_ptr(png_ptr)); - - if (check != length) + ifstream * fin = reinterpret_cast(png_get_io_ptr(png_ptr)); + fin->read(reinterpret_cast(data), length); + if (fin->gcount() != static_cast(length)) { png_error(png_ptr, "Read Error"); } } -void png_reader::init() +template +png_reader::png_reader(std::string const& file_name) + : source_(file_name,std::ios_base::in | std::ios_base::binary), + stream_(source_), + width_(0), + height_(0), + bit_depth_(0), + color_type_(0) +{ + + if (!stream_) throw image_reader_exception("cannot open image file "+ file_name); + init(); +} + +template +png_reader::png_reader(char const* data, std::size_t size) + : source_(data,size), + stream_(source_), + width_(0), + height_(0), + bit_depth_(0), + color_type_(0) +{ + + if (!stream_) throw image_reader_exception("cannot open image stream"); + init(); +} + + +template +png_reader::~png_reader() {} + + +template +void png_reader::init() { - FILE *fp=fopen(fileName_.c_str(),"rb"); - if (!fp) throw image_reader_exception("cannot open image file "+fileName_); png_byte header[8]; memset(header,0,8); - if ( fread(header,1,8,fp) != 8) + stream_.read(reinterpret_cast(header),8); + if ( stream_.gcount() != 8) { - fclose(fp); - throw image_reader_exception("Could not read " + fileName_); + throw image_reader_exception("Could not read image"); } int is_png=!png_sig_cmp(header,0,8); if (!is_png) { - fclose(fp); - throw image_reader_exception(fileName_ + " is not a png file"); + throw image_reader_exception("File or stream is not a png"); } png_structp png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING,0,0,0); if (!png_ptr) { - fclose(fp); throw image_reader_exception("failed to allocate png_ptr"); } @@ -125,24 +176,11 @@ png_set_error_fn(png_ptr, png_get_error_ptr(png_ptr), user_error_fn, user_warning_fn); png_infop info_ptr; - try - { - info_ptr = png_create_info_struct(png_ptr); - if (!info_ptr) - { - png_destroy_read_struct(&png_ptr,0,0); - fclose(fp); - throw image_reader_exception("failed to create info_ptr"); - } - } - catch (std::exception const& ex) - { - png_destroy_read_struct(&png_ptr,0,0); - fclose(fp); - throw; - } + png_struct_guard sguard(&png_ptr,&info_ptr); + info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) throw image_reader_exception("failed to create info_ptr"); - png_set_read_fn(png_ptr, (png_voidp)fp, png_read_data); + png_set_read_fn(png_ptr, (png_voidp)&stream_, png_read_data); png_set_sig_bytes(png_ptr,8); png_read_info(png_ptr, info_ptr); @@ -154,32 +192,31 @@ height_=height; MAPNIK_LOG_DEBUG(png_reader) << "png_reader: bit_depth=" << bit_depth_ << ",color_type=" << color_type_; - - png_destroy_read_struct(&png_ptr,&info_ptr,0); - fclose(fp); } -unsigned png_reader::width() const +template +unsigned png_reader::width() const { return width_; } -unsigned png_reader::height() const +template +unsigned png_reader::height() const { return height_; } -void png_reader::read(unsigned x0, unsigned y0,image_data_32& image) +template +void png_reader::read(unsigned x0, unsigned y0,image_data_32& image) { - FILE *fp=fopen(fileName_.c_str(),"rb"); - if (!fp) throw image_reader_exception("cannot open image file "+fileName_); + stream_.clear(); + stream_.seekg(0, std::ios_base::beg); png_structp png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING,0,0,0); if (!png_ptr) { - fclose(fp); throw image_reader_exception("failed to allocate png_ptr"); } @@ -187,24 +224,11 @@ png_set_error_fn(png_ptr, png_get_error_ptr(png_ptr), user_error_fn, user_warning_fn); png_infop info_ptr; - try - { - info_ptr = png_create_info_struct(png_ptr); - if (!info_ptr) - { - png_destroy_read_struct(&png_ptr,0,0); - fclose(fp); - throw image_reader_exception("failed to create info_ptr"); - } - } - catch (std::exception const& ex) - { - png_destroy_read_struct(&png_ptr,0,0); - fclose(fp); - throw; - } + png_struct_guard sguard(&png_ptr,&info_ptr); + info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) throw image_reader_exception("failed to create info_ptr"); - png_set_read_fn(png_ptr, (png_voidp)fp, png_read_data); + png_set_read_fn(png_ptr, (png_voidp)&stream_, png_read_data); png_read_info(png_ptr, info_ptr); if (color_type_ == PNG_COLOR_TYPE_PALETTE) @@ -247,24 +271,21 @@ else { png_read_update_info(png_ptr, info_ptr); - unsigned w=std::min(unsigned(image.width()),width_); - unsigned h=std::min(unsigned(image.height()),height_); + unsigned w=std::min(unsigned(image.width()),width_ - x0); + unsigned h=std::min(unsigned(image.height()),height_ - y0); unsigned rowbytes=png_get_rowbytes(png_ptr, info_ptr); boost::scoped_array row(new png_byte[rowbytes]); //START read image rows - for (unsigned i=0;i=y0 && i= y0 && i < (y0 + h)) { - image.setRow(i-y0,reinterpret_cast(&row[x0]),w); + image.setRow(i-y0,reinterpret_cast(&row[x0 * 4]),w); } } //END } - png_read_end(png_ptr,0); - png_destroy_read_struct(&png_ptr, &info_ptr,0); - fclose(fp); } } diff -Nru mapnik-2.1.0/src/point_symbolizer.cpp mapnik-2.2.0/src/point_symbolizer.cpp --- mapnik-2.1.0/src/point_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/point_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,6 +22,8 @@ // mapnik #include +#include +#include #include namespace mapnik diff -Nru mapnik-2.1.0/src/polygon_pattern_symbolizer.cpp mapnik-2.2.0/src/polygon_pattern_symbolizer.cpp --- mapnik-2.1.0/src/polygon_pattern_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/polygon_pattern_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,6 +22,7 @@ // mapnik #include +#include namespace mapnik { diff -Nru mapnik-2.1.0/src/processed_text.cpp mapnik-2.2.0/src/processed_text.cpp --- mapnik-2.1.0/src/processed_text.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/processed_text.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,6 +22,7 @@ #include #include +#include namespace mapnik { @@ -65,22 +66,22 @@ face_set_ptr faces = font_manager_.get_face_set(p.face_name, p.fontset); if (faces->size() == 0) { - if (!p.fontset.get_name().empty()) + if (p.fontset && !p.fontset->get_name().empty()) { - if (p.fontset.size()) + if (p.fontset->size()) { if (!p.face_name.empty()) { - throw config_error("Unable to find specified font face '" + p.face_name + "' in font set: '" + p.fontset.get_name() + "'"); + throw config_error("Unable to find specified font face '" + p.face_name + "' in font set: '" + p.fontset->get_name() + "'"); } else { - throw config_error("No valid font face could be loaded for font set: '" + p.fontset.get_name() + "'"); + throw config_error("No valid font face could be loaded for font set: '" + p.fontset->get_name() + "'"); } } else { - throw config_error("Font set '" + p.fontset.get_name() + "' does not contain any Font face-name entries"); + throw config_error("Font set '" + p.fontset->get_name() + "' does not contain any Font face-name entries"); } } else if (!p.face_name.empty()) diff -Nru mapnik-2.1.0/src/proj_transform.cpp mapnik-2.2.0/src/proj_transform.cpp --- mapnik-2.1.0/src/proj_transform.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/proj_transform.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,36 +26,56 @@ #include #include +#ifdef MAPNIK_USE_PROJ4 // proj4 #include +#endif // stl #include - -static const float MAXEXTENT = 20037508.34; -static const float M_PI_by2 = M_PI / 2; -static const float D2R = M_PI / 180; -static const float R2D = 180 / M_PI; -static const float M_PIby360 = M_PI / 360; -static const float MAXEXTENTby180 = MAXEXTENT/180; +#include namespace mapnik { proj_transform::proj_transform(projection const& source, projection const& dest) : source_(source), - dest_(dest) + dest_(dest), + is_source_longlat_(false), + is_dest_longlat_(false), + wgs84_to_merc_(false), + merc_to_wgs84_(false) { - is_source_longlat_ = source_.is_geographic(); - is_dest_longlat_ = dest_.is_geographic(); is_source_equal_dest_ = (source_ == dest_); - if (source.params() == "+init=epsg:3857" && dest.params() == "+init=epsg:4326") - { - wgs84_to_merc_ = true; - } - else + if (!is_source_equal_dest_) { - wgs84_to_merc_ = false; + is_source_longlat_ = source_.is_geographic(); + is_dest_longlat_ = dest_.is_geographic(); + boost::optional src_k = source.well_known(); + boost::optional dest_k = dest.well_known(); + bool known_trans = false; + if (src_k && dest_k) + { + if (*src_k == WGS_84 && *dest_k == G_MERC) + { + wgs84_to_merc_ = true; + known_trans = true; + } + else if (*src_k == G_MERC && *dest_k == WGS_84) + { + merc_to_wgs84_ = true; + known_trans = true; + } + } + if (!known_trans) + { +#ifdef MAPNIK_USE_PROJ4 + source_.init_proj4(); + dest_.init_proj4(); +#else + throw std::runtime_error(std::string("Cannot initialize proj_transform for given projections without proj4 support (-DMAPNIK_USE_PROJ4): '") + source_.params() + "'->'" + dest_.params() + "'"); +#endif + } } } @@ -64,7 +84,6 @@ return is_source_equal_dest_; } - bool proj_transform::forward (double & x, double & y , double & z) const { return forward(&x, &y, &z, 1); @@ -76,20 +95,16 @@ if (is_source_equal_dest_) return true; - if (wgs84_to_merc_) { - int i; - for(i=0; i 180) x[i] = 180; - if (x[i] < -180) x[i] = -180; - if (y[i] > 85.0511) y[i] = 85.0511; - if (y[i] < -85.0511) y[i] = -85.0511; - } - return true; + if (wgs84_to_merc_) + { + return lonlat2merc(x,y,point_count); + } + else if (merc_to_wgs84_) + { + return merc2lonlat(x,y,point_count); } +#ifdef MAPNIK_USE_PROJ4 if (is_source_longlat_) { int i; @@ -99,16 +114,11 @@ } } - do { -#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 - mutex::scoped_lock lock(projection::mutex_); -#endif - if (pj_transform( source_.proj_, dest_.proj_, point_count, - 0, x,y,z) != 0) - { - return false; - } - } while(false); + if (pj_transform( source_.proj_, dest_.proj_, point_count, + 0, x,y,z) != 0) + { + return false; + } if (is_dest_longlat_) { @@ -118,7 +128,7 @@ y[i] *= RAD_TO_DEG; } } - +#endif return true; } @@ -127,20 +137,16 @@ if (is_source_equal_dest_) return true; - if (wgs84_to_merc_) { - int i; - for(i=0; i MAXEXTENT) x[i] = MAXEXTENT; - if (x[i] < -MAXEXTENT) x[i] = -MAXEXTENT; - if (y[i] > MAXEXTENT) y[i] = MAXEXTENT; - if (y[i] < -MAXEXTENT) y[i] = -MAXEXTENT; - } - return true; + if (wgs84_to_merc_) + { + return merc2lonlat(x,y,point_count); + } + else if (merc_to_wgs84_) + { + return lonlat2merc(x,y,point_count); } +#ifdef MAPNIK_USE_PROJ4 if (is_dest_longlat_) { int i; @@ -150,17 +156,11 @@ } } - do { -#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 - mutex::scoped_lock lock(projection::mutex_); -#endif - - if (pj_transform( dest_.proj_, source_.proj_, point_count, - 0, x,y,z) != 0) - { - return false; - } - } while(false); + if (pj_transform( dest_.proj_, source_.proj_, point_count, + 0, x,y,z) != 0) + { + return false; + } if (is_source_longlat_) { @@ -170,7 +170,7 @@ y[i] *= RAD_TO_DEG; } } - +#endif return true; } @@ -226,7 +226,7 @@ if (points <= 4) { steps = 0; } else { - steps = static_cast(ceil((points - 4) / 4.0)); + steps = static_cast(std::ceil((points - 4) / 4.0)); } steps += 1; diff -Nru mapnik-2.1.0/src/projection.cpp mapnik-2.2.0/src/projection.cpp --- mapnik-2.1.0/src/projection.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/projection.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,36 +23,68 @@ // mapnik #include #include +#include +#include -// boost -#include +// stl +#include +#ifdef MAPNIK_USE_PROJ4 // proj4 #include - -namespace mapnik { - #if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 +#include +#ifdef _MSC_VER +#pragma NOTE(mapnik is building against < proj 4.8, reprojection will be faster if you use >= 4.8) +#else #warning mapnik is building against < proj 4.8, reprojection will be faster if you use >= 4.8 -boost::mutex projection::mutex_; +#endif +static boost::mutex mutex_; #endif -projection::projection(std::string const& params) - : params_(params) -{ - init(); +#endif + +namespace mapnik { + + +projection::projection(std::string const& params, bool defer_proj_init) + : params_(params), + defer_proj_init_(defer_proj_init), + proj_(NULL), + proj_ctx_(NULL) +{ + boost::optional is_known = is_known_geographic(params_); + if (is_known){ + is_geographic_ = *is_known; + } + else + { +#ifdef MAPNIK_USE_PROJ4 + init_proj4(); +#else + throw std::runtime_error(std::string("Cannot initialize projection '") + params_ + " ' without proj4 support (-DMAPNIK_USE_PROJ4)"); +#endif + } + if (!defer_proj_init_) init_proj4(); } projection::projection(projection const& rhs) - : params_(rhs.params_) + : params_(rhs.params_), + defer_proj_init_(rhs.defer_proj_init_), + is_geographic_(rhs.is_geographic_), + proj_(NULL), + proj_ctx_(NULL) { - init(); + if (!defer_proj_init_) init_proj4(); } projection& projection::operator=(projection const& rhs) { projection tmp(rhs); swap(tmp); + proj_ctx_ = 0; + proj_ = 0; + if (!defer_proj_init_) init_proj4(); return *this; } @@ -66,6 +98,31 @@ return !(*this == other); } +void projection::init_proj4() const +{ +#ifdef MAPNIK_USE_PROJ4 + if (!proj_) + { +#if PJ_VERSION >= 480 + proj_ctx_ = pj_ctx_alloc(); + proj_ = pj_init_plus_ctx(proj_ctx_, params_.c_str()); + if (!proj_) + { + if (proj_ctx_) pj_ctx_free(proj_ctx_); + throw proj_init_error(params_); + } +#else + #if defined(MAPNIK_THREADSAFE) + mutex::scoped_lock lock(mutex_); + #endif + proj_ = pj_init_plus(params_.c_str()); + if (!proj_) throw proj_init_error(params_); +#endif + is_geographic_ = pj_is_latlong(proj_) ? true : false; + } +#endif +} + bool projection::is_initialized() const { return proj_ ? true : false; @@ -76,6 +133,11 @@ return is_geographic_; } +boost::optional projection::well_known() const +{ + return is_well_known_srs(params_); +} + std::string const& projection::params() const { return params_; @@ -83,9 +145,14 @@ void projection::forward(double & x, double &y ) const { -#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 +#ifdef MAPNIK_USE_PROJ4 + if (!proj_) + { + throw std::runtime_error("projection::forward not supported unless proj4 is initialized"); + } + #if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 mutex::scoped_lock lock(mutex_); -#endif + #endif projUV p; p.u = x * DEG_TO_RAD; p.v = y * DEG_TO_RAD; @@ -97,13 +164,22 @@ x *=RAD_TO_DEG; y *=RAD_TO_DEG; } +#else + throw std::runtime_error("projection::forward not supported without proj4 support (-DMAPNIK_USE_PROJ4)"); +#endif } void projection::inverse(double & x,double & y) const { -#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 +#ifdef MAPNIK_USE_PROJ4 + if (!proj_) + { + throw std::runtime_error("projection::inverse not supported unless proj4 is initialized"); + } + + #if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 mutex::scoped_lock lock(mutex_); -#endif + #endif if (is_geographic_) { x *=DEG_TO_RAD; @@ -115,53 +191,37 @@ p = pj_inv(p,proj_); x = RAD_TO_DEG * p.u; y = RAD_TO_DEG * p.v; -} - -projection::~projection() -{ -#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 - mutex::scoped_lock lock(mutex_); -#endif - if (proj_) pj_free(proj_); -#if PJ_VERSION >= 480 - if (proj_ctx_) pj_ctx_free(proj_ctx_); +#else + throw std::runtime_error("projection::inverse not supported without proj4 support (-DMAPNIK_USE_PROJ4)"); #endif } -void projection::init() +projection::~projection() { -#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 - mutex::scoped_lock lock(mutex_); -#endif -#if PJ_VERSION >= 480 - proj_ctx_ = pj_ctx_alloc(); - proj_ = pj_init_plus_ctx(proj_ctx_, params_.c_str()); - if (!proj_) - { +#ifdef MAPNIK_USE_PROJ4 + #if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 + mutex::scoped_lock lock(mutex_); + #endif + if (proj_) pj_free(proj_); + #if PJ_VERSION >= 480 if (proj_ctx_) pj_ctx_free(proj_ctx_); - throw proj_init_error(params_); - } -#else - proj_ = pj_init_plus(params_.c_str()); - if (!proj_) throw proj_init_error(params_); + #endif #endif - is_geographic_ = pj_is_latlong(proj_) ? true : false; } std::string projection::expanded() const { - if (proj_) { - std::string def(pj_get_def( proj_, 0 )); - //boost::algorithm::ireplace_first(def,params_,""); - boost::trim(def); - return def; - } - return std::string(""); +#ifdef MAPNIK_USE_PROJ4 + if (proj_) return mapnik::util::trim_copy(pj_get_def( proj_, 0 )); +#endif + return params_; } void projection::swap(projection& rhs) { std::swap(params_,rhs.params_); - init(); + std::swap(defer_proj_init_,rhs.defer_proj_init_); + std::swap(is_geographic_,rhs.is_geographic_); } + } diff -Nru mapnik-2.1.0/src/rapidxml_loader.cpp mapnik-2.2.0/src/rapidxml_loader.cpp --- mapnik-2.1.0/src/rapidxml_loader.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/rapidxml_loader.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -31,20 +31,17 @@ #include #include #include - -// boost -#include -#include +#include +#include // stl #include #include -using namespace std; namespace rapidxml = boost::property_tree::detail::rapidxml; namespace mapnik { -class rapidxml_loader : boost::noncopyable +class rapidxml_loader : mapnik::noncopyable { public: rapidxml_loader(const char *encoding = NULL) : @@ -57,7 +54,7 @@ { } - void load(const std::string & filename, xml_node &node) + void load(std::string const& filename, xml_node &node) { filename_ = filename; std::basic_ifstream stream(filename.c_str()); @@ -82,8 +79,9 @@ try { // Parse using appropriate flags - const int f_tws = rapidxml::parse_normalize_whitespace - | rapidxml::parse_trim_whitespace; + // https://github.com/mapnik/mapnik/issues/1856 + // const int f_tws = rapidxml::parse_normalize_whitespace; + const int f_tws = rapidxml::parse_trim_whitespace; rapidxml::xml_document<> doc; doc.parse(&v.front()); @@ -93,7 +91,7 @@ populate_tree(child, node); } } - catch (rapidxml::parse_error &e) + catch (rapidxml::parse_error const& e) { long line = static_cast( std::count(&v.front(), e.where(), '\n') + 1); @@ -101,20 +99,21 @@ } } - void load_string(const std::string & buffer, xml_node &node, std::string const & base_path ) + void load_string(std::string const& buffer, xml_node &node, std::string const & base_path ) { // if (!base_path.empty()) // { -// boost::filesystem::path path(base_path); -// if (!boost::filesystem::exists(path)) { -// throw config_error(string("Could not locate base_path '") + +// if (!mapnik::util::exists(base_path)) { +// throw config_error(std::string("Could not locate base_path '") + // base_path + "': file or directory does not exist"); // } // } - - load(buffer, node); + // https://github.com/mapnik/mapnik/issues/1857 + std::stringstream s; + s << buffer; + load(s, node); } private: void populate_tree(rapidxml::xml_node *cur_node, xml_node &node) @@ -144,10 +143,7 @@ case rapidxml::node_data: case rapidxml::node_cdata: { - std::string trimmed(cur_node->value()); - boost::trim(trimmed); - if (trimmed.empty()) break; //Don't add empty text nodes - node.add_child(trimmed, 0, true); + node.add_child(cur_node->value(), 0, true); } break; default: diff -Nru mapnik-2.1.0/src/raster_colorizer.cpp mapnik-2.2.0/src/raster_colorizer.cpp --- mapnik-2.1.0/src/raster_colorizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/raster_colorizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,10 +22,16 @@ // mapnik #include +#include +#include // for to_double +#include +#include #include +#include // stl #include +#include namespace mapnik { @@ -116,7 +122,7 @@ return true; } -void raster_colorizer::colorize(raster_ptr const& raster, Feature const& f) const +void raster_colorizer::colorize(raster_ptr const& raster, feature_impl const& f) const { unsigned *imageData = raster->data_.getData(); @@ -254,7 +260,7 @@ case COLORIZER_EXACT: default: //approximately equal (within epsilon) - if(fabs(value - stopValue) < epsilon_) + if(std::fabs(value - stopValue) < epsilon_) { outputColor = stopColor; } diff -Nru mapnik-2.1.0/src/raster_symbolizer.cpp mapnik-2.2.0/src/raster_symbolizer.cpp --- mapnik-2.1.0/src/raster_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/raster_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,193 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2012 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include + + +// mapnik +#include +#include +#include +#include +#include +#include +#include +#include + +// boost +#include + +namespace mapnik +{ + +raster_symbolizer::raster_symbolizer() + : symbolizer_base(), + mode_("normal"), + scaling_(SCALING_NEAR), + opacity_(1.0), + colorizer_(), + filter_factor_(-1), + mesh_size_(16) {} + +raster_symbolizer::raster_symbolizer(raster_symbolizer const& rhs) + : symbolizer_base(rhs), + mode_(rhs.mode_), + scaling_(rhs.scaling_), + opacity_(rhs.opacity_), + colorizer_(rhs.colorizer_), + filter_factor_(rhs.filter_factor_), + mesh_size_(rhs.mesh_size_), + premultiplied_(rhs.premultiplied_) {} + +std::string const& raster_symbolizer::get_mode() const +{ + MAPNIK_LOG_ERROR(raster_symbolizer) << "getting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x"; + return mode_; +} +void raster_symbolizer::set_mode(std::string const& mode) +{ + MAPNIK_LOG_ERROR(raster_symbolizer) << "setting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x"; + mode_ = mode; + if (mode == "normal") + { + MAPNIK_LOG_ERROR(raster_symbolizer) << "converting 'mode=normal' to 'comp-op:src_over'"; + this->set_comp_op(src_over); + } + else + { + std::string mode2 = boost::algorithm::replace_last_copy(mode,"2",""); + boost::optional comp_op = comp_op_from_string(mode2); + if (comp_op) + { + MAPNIK_LOG_ERROR(raster_symbolizer) << "converting 'mode:" << mode << "' to 'comp-op:" + *comp_op_to_string(*comp_op) + "'"; + this->set_comp_op(*comp_op); + } + else + { + MAPNIK_LOG_ERROR(raster_symbolizer) << "could not convert mode '" << mode << "' into comp-op, defaulting to 'comp-op:src-over'"; + } + } +} + +scaling_method_e raster_symbolizer::get_scaling_method() const +{ + return scaling_; +} + +void raster_symbolizer::set_scaling_method(scaling_method_e scaling) +{ + scaling_ = scaling; +} + +void raster_symbolizer::set_opacity(float opacity) +{ + opacity_ = opacity; +} + +float raster_symbolizer::get_opacity() const +{ + return opacity_; +} + +raster_colorizer_ptr raster_symbolizer::get_colorizer() const +{ + return colorizer_; +} + +void raster_symbolizer::set_colorizer(raster_colorizer_ptr const& colorizer) +{ + colorizer_ = colorizer; +} + +double raster_symbolizer::get_filter_factor() const +{ + return filter_factor_; +} + +void raster_symbolizer::set_filter_factor(double filter_factor) +{ + filter_factor_=filter_factor; +} + +double raster_symbolizer::calculate_filter_factor() const +{ + if (filter_factor_ > 0) + { + // respect explicitly specified values + return filter_factor_; + } else { + double ff = 1.0; + + switch(scaling_) + { + case SCALING_NEAR: + ff = 1.0; + break; + // TODO potentially some of these algorithms would use filter_factor >2.0. + // Contributions welcome from someone who knows more about them. + case SCALING_BILINEAR: + case SCALING_BILINEAR8: + case SCALING_BICUBIC: + case SCALING_SPLINE16: + case SCALING_SPLINE36: + case SCALING_HANNING: + case SCALING_HAMMING: + case SCALING_HERMITE: + case SCALING_KAISER: + case SCALING_QUADRIC: + case SCALING_CATROM: + case SCALING_GAUSSIAN: + case SCALING_BESSEL: + case SCALING_MITCHELL: + case SCALING_SINC: + case SCALING_LANCZOS: + case SCALING_BLACKMAN: + ff = 2.0; + break; + } + return ff; + } +} + +unsigned raster_symbolizer::get_mesh_size() const +{ + return mesh_size_; +} + +void raster_symbolizer::set_mesh_size(unsigned mesh_size) +{ + mesh_size_=mesh_size; +} + +void raster_symbolizer::set_premultiplied(bool premultiplied) +{ + premultiplied_=premultiplied; +} + +boost::optional raster_symbolizer::premultiplied() const +{ + return premultiplied_; +} + +} + diff -Nru mapnik-2.1.0/src/request.cpp mapnik-2.2.0/src/request.cpp --- mapnik-2.1.0/src/request.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/request.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,85 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include + +namespace mapnik +{ + +request::request(unsigned width, + unsigned height, + box2d const& extent) + : width_(width), + height_(height), + extent_(extent), + buffer_size_(0) {} + +request::~request() {} + +unsigned request::width() const +{ + return width_; +} + +unsigned request::height() const +{ + return height_; +} + +void request::set_buffer_size(int buffer_size) +{ + buffer_size_ = buffer_size; +} + +int request::buffer_size() const +{ + return buffer_size_; +} + +void request::set_extent(box2d const& box) +{ + extent_ = box; +} + +box2d const& request::extent() const +{ + return extent_; +} + +box2d request::get_buffered_extent() const +{ + double extra = 2.0 * scale() * buffer_size_; + box2d ext(extent_); + ext.width(extent_.width() + extra); + ext.height(extent_.height() + extra); + return ext; +} + +double request::scale() const +{ + if (width_>0) + return extent_.width()/width_; + return extent_.width(); +} + +} diff -Nru mapnik-2.1.0/src/rule.cpp mapnik-2.2.0/src/rule.cpp --- mapnik-2.1.0/src/rule.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/rule.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,274 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include +#include +#include +#include +#include + +// all symbolizers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// boost +#include +#include +#include + +// stl +#include + +namespace { + + struct deepcopy_symbolizer : public boost::static_visitor<> + { + void operator () (mapnik::raster_symbolizer & sym) const + { + mapnik::raster_colorizer_ptr old_colorizer = sym.get_colorizer(); + mapnik::raster_colorizer_ptr new_colorizer = mapnik::raster_colorizer_ptr(); + new_colorizer->set_stops(old_colorizer->get_stops()); + new_colorizer->set_default_mode(old_colorizer->get_default_mode()); + new_colorizer->set_default_color(old_colorizer->get_default_color()); + new_colorizer->set_epsilon(old_colorizer->get_epsilon()); + sym.set_colorizer(new_colorizer); + } + + void operator () (mapnik::text_symbolizer & sym) const + { + copy_text_ptr(sym); + } + + void operator () (mapnik::shield_symbolizer & sym) const + { + copy_text_ptr(sym); + } + + void operator () (mapnik::building_symbolizer & sym) const + { + copy_height_ptr(sym); + } + + template void operator () (T &sym) const + { + boost::ignore_unused_variable_warning(sym); + } + + template + void copy_text_ptr(T & sym) const + { + boost::ignore_unused_variable_warning(sym); + MAPNIK_LOG_WARN(rule) << "rule: deep copying TextSymbolizers is broken!"; + } + + template + void copy_height_ptr(T & sym) const + { + std::string height_expr = mapnik::to_expression_string(*sym.height()); + sym.set_height(mapnik::parse_expression(height_expr,"utf8")); + } + }; + +} +namespace mapnik +{ + +rule::rule() + : name_(), + min_scale_(0), + max_scale_(std::numeric_limits::infinity()), + syms_(), + filter_(boost::make_shared(true)), + else_filter_(false), + also_filter_(false) {} + +rule::rule(std::string const& name, + double min_scale_denominator, + double max_scale_denominator) + : name_(name), + min_scale_(min_scale_denominator), + max_scale_(max_scale_denominator), + syms_(), + filter_(boost::make_shared(true)), + else_filter_(false), + also_filter_(false) {} + +rule::rule(const rule& rhs, bool deep_copy) + : name_(rhs.name_), + min_scale_(rhs.min_scale_), + max_scale_(rhs.max_scale_), + syms_(rhs.syms_), + filter_(rhs.filter_), + else_filter_(rhs.else_filter_), + also_filter_(rhs.also_filter_) +{ + if (deep_copy) { + + std::string expr = to_expression_string(*filter_); + filter_ = parse_expression(expr,"utf8"); + symbolizers::const_iterator it = syms_.begin(); + symbolizers::const_iterator end = syms_.end(); + + for(; it != end; ++it) + { + boost::apply_visitor(deepcopy_symbolizer(),*it); + } + } +} + +rule& rule::operator=(rule const& rhs) +{ + rule tmp(rhs); + swap(tmp); + return *this; +} + +bool rule::operator==(rule const& other) +{ + return (this == &other); +} + +void rule::swap(rule& rhs) throw() +{ + name_=rhs.name_; + min_scale_=rhs.min_scale_; + max_scale_=rhs.max_scale_; + syms_=rhs.syms_; + filter_=rhs.filter_; + else_filter_=rhs.else_filter_; + also_filter_=rhs.also_filter_; +} + +void rule::set_max_scale(double scale) +{ + max_scale_=scale; +} + +double rule::get_max_scale() const +{ + return max_scale_; +} + +void rule::set_min_scale(double scale) +{ + min_scale_=scale; +} + +double rule::get_min_scale() const +{ + return min_scale_; +} + +void rule::set_name(std::string const& name) +{ + name_=name; +} + +std::string const& rule::get_name() const +{ + return name_; +} + +void rule::append(symbolizer const& sym) +{ + syms_.push_back(sym); +} + +void rule::remove_at(size_t index) +{ + if (index < syms_.size()) + { + syms_.erase(syms_.begin()+index); + } +} + +rule::symbolizers const& rule::get_symbolizers() const +{ + return syms_; +} + +rule::symbolizers::const_iterator rule::begin() const +{ + return syms_.begin(); +} + +rule::symbolizers::const_iterator rule::end() const +{ + return syms_.end(); +} + +rule::symbolizers::iterator rule::begin() +{ + return syms_.begin(); +} + +rule::symbolizers::iterator rule::end() +{ + return syms_.end(); +} + +void rule::set_filter(expression_ptr const& filter) +{ + filter_=filter; +} + +expression_ptr const& rule::get_filter() const +{ + return filter_; +} + +void rule::set_else(bool else_filter) +{ + else_filter_=else_filter; +} + +bool rule::has_else_filter() const +{ + return else_filter_; +} + +void rule::set_also(bool also_filter) +{ + also_filter_=also_filter; +} + +bool rule::has_also_filter() const +{ + return also_filter_; +} + +bool rule::active(double scale) const +{ + return ( !syms_.empty() && scale >= min_scale_ - 1e-6 && scale < max_scale_ + 1e-6); +} + +} diff -Nru mapnik-2.1.0/src/save_map.cpp mapnik-2.2.0/src/save_map.cpp --- mapnik-2.1.0/src/save_map.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/save_map.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,6 +21,7 @@ *****************************************************************************/ // mapnik +#include #include #include #include @@ -34,7 +35,10 @@ #include #include #include +#include #include +#include + // boost #include #include @@ -98,6 +102,10 @@ { set_attr( sym_node, "rasterizer", sym.get_rasterizer() ); } + if ( sym.offset() != dfl.offset() || explicit_defaults_ ) + { + set_attr( sym_node, "offset", sym.offset() ); + } serialize_symbolizer_base(sym_node, sym); } @@ -180,10 +188,18 @@ set_attr( sym_node, "mesh-size", sym.get_mesh_size() ); } - if (sym.get_colorizer()) { + if (sym.get_colorizer()) + { serialize_raster_colorizer(sym_node, sym.get_colorizer(), explicit_defaults_); } + + boost::optional premultiplied = sym.premultiplied(); + if (premultiplied) + { + set_attr( sym_node, "premultiplied", *sym.premultiplied()); + } + serialize_symbolizer_base(sym_node, sym); } @@ -238,6 +254,11 @@ add_font_attributes( sym_node, sym); serialize_symbolizer_base(sym_node, sym); + text_symbolizer dfl; + if (sym.get_halo_rasterizer() != dfl.get_halo_rasterizer() || explicit_defaults_) + { + set_attr(sym_node, "halo-rasterizer", sym.get_halo_rasterizer()); + } } void operator () ( building_symbolizer const& sym ) @@ -311,6 +332,10 @@ { set_attr( sym_node, "placement", sym.get_marker_placement() ); } + if ( sym.get_marker_multi_policy() != dfl.get_marker_multi_policy() || explicit_defaults_ ) + { + set_attr( sym_node, "multi-policy", sym.get_marker_multi_policy() ); + } if (sym.get_image_transform()) { std::string tr_str = sym.get_image_transform_string(); @@ -350,6 +375,14 @@ { set_attr( node, "clip", sym.clip() ); } + if (sym.simplify_algorithm() != dfl.simplify_algorithm() || explicit_defaults_) + { + set_attr( node, "simplify-algorithm", *simplify_algorithm_to_string(sym.simplify_algorithm()) ); + } + if (sym.simplify_tolerance() != dfl.simplify_tolerance() || explicit_defaults_) + { + set_attr( node, "simplify", sym.simplify_tolerance() ); + } if (sym.smooth() != dfl.smooth() || explicit_defaults_) { set_attr( node, "smooth", sym.smooth() ); @@ -640,12 +673,12 @@ serialize_type( boost::property_tree::ptree & node): node_(node) {} - void operator () ( int val ) const + void operator () ( mapnik::value_integer val ) const { node_.put(".type", "int" ); } - void operator () ( double val ) const + void operator () ( mapnik::value_double val ) const { node_.put(".type", "float" ); } @@ -734,10 +767,10 @@ set_attr( layer_node, "group-by", layer.group_by() ); } - int buffer_size = layer.buffer_size(); + boost::optional const& buffer_size = layer.buffer_size(); if ( buffer_size || explicit_defaults) { - set_attr( layer_node, "buffer-size", buffer_size ); + set_attr( layer_node, "buffer-size", *buffer_size ); } optional > const& maximum_extent = layer.maximum_extent(); diff -Nru mapnik-2.1.0/src/scale_denominator.cpp mapnik-2.2.0/src/scale_denominator.cpp --- mapnik-2.1.0/src/scale_denominator.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/scale_denominator.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,19 +22,18 @@ // mapnik #include -#include +#include // stl #include namespace mapnik { -static const double pi = 3.14159265359; -static const double meters_per_degree = 6378137 * 2 * pi/ 360; +static const double meters_per_degree = 6378137 * 2 * M_PI / 360; -double scale_denominator(Map const& map, bool geographic) +double scale_denominator(double map_scale, bool geographic) { - double denom = map.scale() / 0.00028; + double denom = map_scale / 0.00028; if (geographic) denom *= meters_per_degree; return denom; } diff -Nru mapnik-2.1.0/src/shield_symbolizer.cpp mapnik-2.2.0/src/shield_symbolizer.cpp --- mapnik-2.1.0/src/shield_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/shield_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -28,9 +28,6 @@ // boost #include -// stl -#include - namespace mapnik { diff -Nru mapnik-2.1.0/src/simplify.cpp mapnik-2.2.0/src/simplify.cpp --- mapnik-2.1.0/src/simplify.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/simplify.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,41 @@ +// mapnik +#include + +// boost +#include +#include + +namespace mapnik +{ + +typedef boost::bimap simplify_algorithm_lookup_type; +static const simplify_algorithm_lookup_type simplify_lookup = boost::assign::list_of + (radial_distance,"radial-distance") + (douglas_peucker,"douglas-peucker") + (visvalingam_whyatt,"visvalingam-whyatt") + (zhao_saalfeld,"zhao-saalfeld") + ; + +boost::optional simplify_algorithm_from_string(std::string const& name) +{ + boost::optional algo; + simplify_algorithm_lookup_type::right_const_iterator right_iter = simplify_lookup.right.find(name); + if (right_iter != simplify_lookup.right.end()) + { + algo.reset(right_iter->second); + } + return algo; +} + +boost::optional simplify_algorithm_to_string(simplify_algorithm_e value) +{ + boost::optional algo; + simplify_algorithm_lookup_type::left_const_iterator left_iter = simplify_lookup.left.find(value); + if (left_iter != simplify_lookup.left.end()) + { + algo.reset(left_iter->second); + } + return algo; +} + +} diff -Nru mapnik-2.1.0/src/stroke.cpp mapnik-2.2.0/src/stroke.cpp --- mapnik-2.1.0/src/stroke.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/stroke.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,6 +21,7 @@ *****************************************************************************/ #include +#include namespace mapnik { diff -Nru mapnik-2.1.0/src/svg/output/process_building_symbolizer.cpp mapnik-2.2.0/src/svg/output/process_building_symbolizer.cpp --- mapnik-2.1.0/src/svg/output/process_building_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/output/process_building_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,39 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include + +namespace mapnik +{ +template +void svg_renderer::process(building_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans) +{ + // nothing yet. +} + +template void svg_renderer >::process(building_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); +} diff -Nru mapnik-2.1.0/src/svg/output/process_line_pattern_symbolizer.cpp mapnik-2.2.0/src/svg/output/process_line_pattern_symbolizer.cpp --- mapnik-2.1.0/src/svg/output/process_line_pattern_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/output/process_line_pattern_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,39 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include + +namespace mapnik +{ +template +void svg_renderer::process(line_pattern_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans) +{ + // nothing yet. +} + +template void svg_renderer >::process(line_pattern_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); +} diff -Nru mapnik-2.1.0/src/svg/output/process_line_symbolizer.cpp mapnik-2.2.0/src/svg/output/process_line_symbolizer.cpp --- mapnik-2.1.0/src/svg/output/process_line_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/output/process_line_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,48 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include + +namespace mapnik +{ +/*! + * @brief Collect presentation attributes found in line symbolizer. + */ +template +void svg_renderer::process(line_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans) +{ + path_attributes_.set_stroke_color(sym.get_stroke().get_color()); + path_attributes_.set_stroke_opacity(sym.get_stroke().get_opacity()); + path_attributes_.set_stroke_width(sym.get_stroke().get_width()); + path_attributes_.set_stroke_linecap(sym.get_stroke().get_line_cap()); + path_attributes_.set_stroke_linejoin(sym.get_stroke().get_line_join()); + path_attributes_.set_stroke_dasharray(sym.get_stroke().get_dash_array()); + path_attributes_.set_stroke_dashoffset(sym.get_stroke().dash_offset()); +} + +template void svg_renderer >::process(line_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); +} diff -Nru mapnik-2.1.0/src/svg/output/process_markers_symbolizer.cpp mapnik-2.2.0/src/svg/output/process_markers_symbolizer.cpp --- mapnik-2.1.0/src/svg/output/process_markers_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/output/process_markers_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,39 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include + +namespace mapnik +{ +template +void svg_renderer::process(markers_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans) +{ + // nothing yet. +} + +template void svg_renderer >::process(markers_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); +} diff -Nru mapnik-2.1.0/src/svg/output/process_point_symbolizer.cpp mapnik-2.2.0/src/svg/output/process_point_symbolizer.cpp --- mapnik-2.1.0/src/svg/output/process_point_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/output/process_point_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,39 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include + +namespace mapnik +{ +template +void svg_renderer::process(point_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans) +{ + // nothing yet. +} + +template void svg_renderer >::process(point_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); +} diff -Nru mapnik-2.1.0/src/svg/output/process_polygon_pattern_symbolizer.cpp mapnik-2.2.0/src/svg/output/process_polygon_pattern_symbolizer.cpp --- mapnik-2.1.0/src/svg/output/process_polygon_pattern_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/output/process_polygon_pattern_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,39 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include + +namespace mapnik +{ +template +void svg_renderer::process(polygon_pattern_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans) +{ + // nothing yet. +} + +template void svg_renderer >::process(polygon_pattern_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); +} diff -Nru mapnik-2.1.0/src/svg/output/process_polygon_symbolizer.cpp mapnik-2.2.0/src/svg/output/process_polygon_symbolizer.cpp --- mapnik-2.1.0/src/svg/output/process_polygon_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/output/process_polygon_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,43 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include + +namespace mapnik +{ +/*! + * @brief Collect presentation attributes found in polygon symbolizer. + */ +template +void svg_renderer::process(polygon_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans) +{ + path_attributes_.set_fill_color(sym.get_fill()); + path_attributes_.set_fill_opacity(sym.get_opacity()); +} + +template void svg_renderer >::process(polygon_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); +} diff -Nru mapnik-2.1.0/src/svg/output/process_raster_symbolizer.cpp mapnik-2.2.0/src/svg/output/process_raster_symbolizer.cpp --- mapnik-2.1.0/src/svg/output/process_raster_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/output/process_raster_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,39 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include + +namespace mapnik +{ +template +void svg_renderer::process(raster_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans) +{ + // nothing yet. +} + +template void svg_renderer >::process(raster_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); +} diff -Nru mapnik-2.1.0/src/svg/output/process_shield_symbolizer.cpp mapnik-2.2.0/src/svg/output/process_shield_symbolizer.cpp --- mapnik-2.1.0/src/svg/output/process_shield_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/output/process_shield_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,39 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include + +namespace mapnik +{ +template +void svg_renderer::process(shield_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans) +{ + // nothing yet. +} + +template void svg_renderer >::process(shield_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); +} diff -Nru mapnik-2.1.0/src/svg/output/process_symbolizers.cpp mapnik-2.2.0/src/svg/output/process_symbolizers.cpp --- mapnik-2.1.0/src/svg/output/process_symbolizers.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/output/process_symbolizers.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,66 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include + +namespace mapnik { + +template +bool svg_renderer::process(rule::symbolizers const& syms, + mapnik::feature_impl & feature, + proj_transform const& prj_trans) +{ + // svg renderer supports processing of multiple symbolizers. + typedef coord_transform path_type; + + // process each symbolizer to collect its (path) information. + // path information (attributes from line_ and polygon_ symbolizers) + // is collected with the path_attributes_ data member. + BOOST_FOREACH(symbolizer const& sym, syms) + { + boost::apply_visitor(symbol_dispatch(*this, feature, prj_trans), sym); + } + + // generate path output for each geometry of the current feature. + for(unsigned i=0; i 0) + { + path_type path(t_, geom, prj_trans); + generator_.generate_path(path, path_attributes_); + } + } + + // set the previously collected values back to their defaults + // for the feature that will be processed next. + path_attributes_.reset(); + + return true; +} + +template bool svg_renderer >::process(rule::symbolizers const& syms, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); + +} diff -Nru mapnik-2.1.0/src/svg/output/process_text_symbolizer.cpp mapnik-2.2.0/src/svg/output/process_text_symbolizer.cpp --- mapnik-2.1.0/src/svg/output/process_text_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/output/process_text_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,39 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include + +namespace mapnik +{ +template +void svg_renderer::process(text_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans) +{ + // nothing yet. +} + +template void svg_renderer >::process(text_symbolizer const& sym, + mapnik::feature_impl & feature, + proj_transform const& prj_trans); +} diff -Nru mapnik-2.1.0/src/svg/output/svg_generator.cpp mapnik-2.2.0/src/svg/output/svg_generator.cpp --- mapnik-2.1.0/src/svg/output/svg_generator.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/output/svg_generator.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,69 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include +#include + +// boost +#include + +namespace mapnik { namespace svg { + + using namespace boost::spirit; + + template + svg_generator::svg_generator(OutputIterator& output_iterator) + : output_iterator_(output_iterator) {} + + template + svg_generator::~svg_generator() {} + + template + void svg_generator::generate_header() + { + karma::generate(output_iterator_, lit("\n")); + karma::generate(output_iterator_, lit("\n")); + } + + template + void svg_generator::generate_opening_root(root_output_attributes const& root_attributes) + { + root_attributes_grammar attributes_grammar; + karma::generate(output_iterator_, lit("\n"), root_attributes); + } + + template + void svg_generator::generate_closing_root() + { + karma::generate(output_iterator_, lit("")); + } + + template + void svg_generator::generate_rect(rect_output_attributes const& rect_attributes) + { + rect_attributes_grammar attributes_grammar; + karma::generate(output_iterator_, lit("\n"), rect_attributes); + } + + template class svg_generator >; + }} diff -Nru mapnik-2.1.0/src/svg/output/svg_output_attributes.cpp mapnik-2.2.0/src/svg/output/svg_output_attributes.cpp --- mapnik-2.1.0/src/svg/output/svg_output_attributes.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/output/svg_output_attributes.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,290 @@ + +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include + +namespace mapnik { namespace svg { + + // path_output_attributes + + void path_output_attributes::set_fill_color(color const& fill_color) + { + fill_color_ = fill_color.to_hex_string(); + } + + void path_output_attributes::set_fill_opacity(double fill_opacity) + { + fill_opacity_ = fill_opacity; + } + + void path_output_attributes::set_stroke_color(color const& stroke_color) + { + stroke_color_ = stroke_color.to_hex_string(); + } + + void path_output_attributes::set_stroke_opacity(double stroke_opacity) + { + stroke_opacity_ = stroke_opacity; + } + + void path_output_attributes::set_stroke_width(double stroke_width) + { + stroke_width_ = stroke_width; + } + + void path_output_attributes::set_stroke_linecap(line_cap_e stroke_linecap) + { + switch(stroke_linecap) + { + case BUTT_CAP: + stroke_linecap_ = "butt"; + break; + case SQUARE_CAP: + stroke_linecap_ = "square"; + break; + case ROUND_CAP: + stroke_linecap_ = "round"; + break; + default: + stroke_linecap_ = "butt"; + } + } + + void path_output_attributes::set_stroke_linejoin(line_join_e stroke_linejoin) + { + switch(stroke_linejoin) + { + case MITER_JOIN: + stroke_linejoin_ = "miter"; + break; + case MITER_REVERT_JOIN: + stroke_linejoin_ = "miter"; + break; + case ROUND_JOIN: + stroke_linejoin_ = "round"; + break; + case BEVEL_JOIN: + stroke_linejoin_ = "bevel"; + break; + default: + stroke_linejoin_ = "miter"; + } + } + + void path_output_attributes::set_stroke_dasharray(dash_array const& stroke_dasharray) + { + stroke_dasharray_ = stroke_dasharray; + } + + void path_output_attributes::set_stroke_dashoffset(double stroke_dashoffset) + { + stroke_dashoffset_ = stroke_dashoffset; + } + + std::string const& path_output_attributes::fill_color() const + { + return fill_color_; + } + + double path_output_attributes::fill_opacity() const + { + return fill_opacity_; + } + + std::string const& path_output_attributes::stroke_color() const + { + return stroke_color_; + } + + double path_output_attributes::stroke_opacity() const + { + return stroke_opacity_; + } + + double path_output_attributes::stroke_width() const + { + return stroke_width_; + } + + std::string const& path_output_attributes::stroke_linecap() const + { + return stroke_linecap_; + } + + std::string const& path_output_attributes::stroke_linejoin() const + { + return stroke_linejoin_; + } + + dash_array const& path_output_attributes::stroke_dasharray() const + { + return stroke_dasharray_; + } + + double path_output_attributes::stroke_dashoffset() const + { + return stroke_dashoffset_; + } + + void path_output_attributes::reset() + { + fill_color_ = "none"; + fill_opacity_ = 1.0; + stroke_color_ = "none"; + stroke_opacity_ = 1.0; + stroke_width_ = 0.0; + stroke_linecap_ = "butt"; + stroke_linejoin_ = "miter"; + stroke_dasharray_.clear(); + stroke_dashoffset_ = 0.0; + } + + // rect_output_attributes + + void rect_output_attributes::set_x(int x) + { + x_ = x; + } + + void rect_output_attributes::set_y(int y) + { + y_ = y; + } + + void rect_output_attributes::set_width(unsigned width) + { + width_ = width; + } + + void rect_output_attributes::set_height(unsigned height) + { + height_ = height; + } + + void rect_output_attributes::set_fill_color(color const& fill_color) + { + fill_color_ = fill_color.to_hex_string(); + } + + int rect_output_attributes::x() const + { + return x_; + } + + int rect_output_attributes::y() const + { + return y_; + } + + int rect_output_attributes::width() const + { + return width_; + } + + int rect_output_attributes::height() const + { + return height_; + } + + std::string const& rect_output_attributes::fill_color() const + { + return fill_color_; + } + + void rect_output_attributes::reset() + { + x_ = 0; + y_ = 0; + width_ = 400; + height_ = 400; + fill_color_ = "#000000"; + } + + // rect_output_attributes + + const double root_output_attributes::SVG_VERSION = 1.1; + const std::string root_output_attributes::SVG_NAMESPACE_URL = "http://www.w3.org/2000/svg"; + + root_output_attributes::root_output_attributes() + : width_(400), + height_(400), + svg_version_(SVG_VERSION), + svg_namespace_url_(SVG_NAMESPACE_URL) + {} + + root_output_attributes::root_output_attributes(unsigned width, unsigned height) + : width_(width), + height_(height), + svg_version_(SVG_VERSION), + svg_namespace_url_(SVG_NAMESPACE_URL) + {} + + void root_output_attributes::set_width(unsigned width) + { + width_ = width; + } + + void root_output_attributes::set_height(unsigned height) + { + height_ = height; + } + + void root_output_attributes::set_svg_version(double svg_version) + { + svg_version_ = svg_version; + } + + void root_output_attributes::set_svg_namespace_url(std::string const& svg_namespace_url) + { + svg_namespace_url_ = svg_namespace_url; + } + + unsigned root_output_attributes::width() const + { + return width_; + } + + unsigned root_output_attributes::height() const + { + return height_; + } + + double root_output_attributes::svg_version() const + { + return svg_version_; + } + + std::string const& root_output_attributes::svg_namespace_url() const + { + return svg_namespace_url_; + } + + void root_output_attributes::reset() + { + width_ = 400; + height_ = 400; + svg_version_ = SVG_VERSION; + svg_namespace_url_ = SVG_NAMESPACE_URL; + } + }} diff -Nru mapnik-2.1.0/src/svg/output/svg_renderer.cpp mapnik-2.2.0/src/svg/output/svg_renderer.cpp --- mapnik-2.1.0/src/svg/output/svg_renderer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/output/svg_renderer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,91 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include +#include +#include + +// stl +#include + +namespace mapnik +{ +template +svg_renderer::svg_renderer(Map const& m, T & output_iterator, unsigned offset_x, unsigned offset_y) : + feature_style_processor(m), + output_iterator_(output_iterator), + width_(m.width()), + height_(m.height()), + t_(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y), + generator_(output_iterator) +{} + +template +svg_renderer::~svg_renderer() {} + +template +void svg_renderer::start_map_processing(Map const& map) +{ + MAPNIK_LOG_DEBUG(svg_renderer) << "svg_renderer: Start map processing"; + + // generate XML header. + generator_.generate_header(); + + // generate SVG root element opening tag. + // the root element defines the size of the image, + // which is taken from the map's dimensions. + svg::root_output_attributes root_attributes(width_, height_); + generator_.generate_opening_root(root_attributes); + + boost::optional const& bgcolor = map.background(); + if(bgcolor) + { + // generate background color as a rectangle that spans the whole image. + svg::rect_output_attributes bg_attributes(0, 0, width_, height_, *bgcolor); + generator_.generate_rect(bg_attributes); + } +} + +template +void svg_renderer::end_map_processing(Map const& map) +{ + // generate SVG root element closing tag. + generator_.generate_closing_root(); + + MAPNIK_LOG_DEBUG(svg_renderer) << "svg_renderer: End map processing"; +} + +template +void svg_renderer::start_layer_processing(layer const& lay, box2d const& query_extent) +{ + MAPNIK_LOG_DEBUG(svg_renderer) << "svg_renderer: Start layer processing=" << lay.name(); +} + +template +void svg_renderer::end_layer_processing(layer const& lay) +{ + MAPNIK_LOG_DEBUG(svg_renderer) << "svg_renderer: End layer processing=" << lay.name(); +} + +template class svg_renderer >; +} diff -Nru mapnik-2.1.0/src/svg/process_building_symbolizer.cpp mapnik-2.2.0/src/svg/process_building_symbolizer.cpp --- mapnik-2.1.0/src/svg/process_building_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg/process_building_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include - -namespace mapnik -{ -template -void svg_renderer::process(building_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans) -{ - // nothing yet. -} - -template void svg_renderer >::process(building_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); -} diff -Nru mapnik-2.1.0/src/svg/process_line_pattern_symbolizer.cpp mapnik-2.2.0/src/svg/process_line_pattern_symbolizer.cpp --- mapnik-2.1.0/src/svg/process_line_pattern_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg/process_line_pattern_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include - -namespace mapnik -{ -template -void svg_renderer::process(line_pattern_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans) -{ - // nothing yet. -} - -template void svg_renderer >::process(line_pattern_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); -} diff -Nru mapnik-2.1.0/src/svg/process_line_symbolizer.cpp mapnik-2.2.0/src/svg/process_line_symbolizer.cpp --- mapnik-2.1.0/src/svg/process_line_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg/process_line_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include - -namespace mapnik -{ -/*! - * @brief Collect presentation attributes found in line symbolizer. - */ -template -void svg_renderer::process(line_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans) -{ - path_attributes_.set_stroke_color(sym.get_stroke().get_color()); - path_attributes_.set_stroke_opacity(sym.get_stroke().get_opacity()); - path_attributes_.set_stroke_width(sym.get_stroke().get_width()); - path_attributes_.set_stroke_linecap(sym.get_stroke().get_line_cap()); - path_attributes_.set_stroke_linejoin(sym.get_stroke().get_line_join()); - path_attributes_.set_stroke_dasharray(sym.get_stroke().get_dash_array()); - path_attributes_.set_stroke_dashoffset(sym.get_stroke().dash_offset()); -} - -template void svg_renderer >::process(line_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); -} diff -Nru mapnik-2.1.0/src/svg/process_markers_symbolizer.cpp mapnik-2.2.0/src/svg/process_markers_symbolizer.cpp --- mapnik-2.1.0/src/svg/process_markers_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg/process_markers_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include - -namespace mapnik -{ -template -void svg_renderer::process(markers_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans) -{ - // nothing yet. -} - -template void svg_renderer >::process(markers_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); -} diff -Nru mapnik-2.1.0/src/svg/process_point_symbolizer.cpp mapnik-2.2.0/src/svg/process_point_symbolizer.cpp --- mapnik-2.1.0/src/svg/process_point_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg/process_point_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include - -namespace mapnik -{ -template -void svg_renderer::process(point_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans) -{ - // nothing yet. -} - -template void svg_renderer >::process(point_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); -} diff -Nru mapnik-2.1.0/src/svg/process_polygon_pattern_symbolizer.cpp mapnik-2.2.0/src/svg/process_polygon_pattern_symbolizer.cpp --- mapnik-2.1.0/src/svg/process_polygon_pattern_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg/process_polygon_pattern_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include - -namespace mapnik -{ -template -void svg_renderer::process(polygon_pattern_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans) -{ - // nothing yet. -} - -template void svg_renderer >::process(polygon_pattern_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); -} diff -Nru mapnik-2.1.0/src/svg/process_polygon_symbolizer.cpp mapnik-2.2.0/src/svg/process_polygon_symbolizer.cpp --- mapnik-2.1.0/src/svg/process_polygon_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg/process_polygon_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include - -namespace mapnik -{ -/*! - * @brief Collect presentation attributes found in polygon symbolizer. - */ -template -void svg_renderer::process(polygon_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans) -{ - path_attributes_.set_fill_color(sym.get_fill()); - path_attributes_.set_fill_opacity(sym.get_opacity()); -} - -template void svg_renderer >::process(polygon_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); -} diff -Nru mapnik-2.1.0/src/svg/process_raster_symbolizer.cpp mapnik-2.2.0/src/svg/process_raster_symbolizer.cpp --- mapnik-2.1.0/src/svg/process_raster_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg/process_raster_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include - -namespace mapnik -{ -template -void svg_renderer::process(raster_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans) -{ - // nothing yet. -} - -template void svg_renderer >::process(raster_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); -} diff -Nru mapnik-2.1.0/src/svg/process_shield_symbolizer.cpp mapnik-2.2.0/src/svg/process_shield_symbolizer.cpp --- mapnik-2.1.0/src/svg/process_shield_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg/process_shield_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include - -namespace mapnik -{ -template -void svg_renderer::process(shield_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans) -{ - // nothing yet. -} - -template void svg_renderer >::process(shield_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); -} diff -Nru mapnik-2.1.0/src/svg/process_symbolizers.cpp mapnik-2.2.0/src/svg/process_symbolizers.cpp --- mapnik-2.1.0/src/svg/process_symbolizers.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg/process_symbolizers.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include - -namespace mapnik { - -template -bool svg_renderer::process(rule::symbolizers const& syms, - Feature const& feature, - proj_transform const& prj_trans) -{ - // svg renderer supports processing of multiple symbolizers. - - typedef coord_transform path_type; - - // process each symbolizer to collect its (path) information. - // path information (attributes from line_ and polygon_ symbolizers) - // is collected with the path_attributes_ data member. - BOOST_FOREACH(symbolizer const& sym, syms) - { - boost::apply_visitor(symbol_dispatch(*this, feature, prj_trans), sym); - } - - // generate path output for each geometry of the current feature. - for(unsigned i=0; i 1) - { - path_type path(t_, geom, prj_trans); - generator_.generate_path(path, path_attributes_); - } - } - - // set the previously collected values back to their defaults - // for the feature that will be processed next. - path_attributes_.reset(); - - return true; -}; - -template bool svg_renderer >::process(rule::symbolizers const& syms, - Feature const& feature, - proj_transform const& prj_trans); - -} diff -Nru mapnik-2.1.0/src/svg/process_text_symbolizer.cpp mapnik-2.2.0/src/svg/process_text_symbolizer.cpp --- mapnik-2.1.0/src/svg/process_text_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg/process_text_symbolizer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include - -namespace mapnik -{ -template -void svg_renderer::process(text_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans) -{ - // nothing yet. -} - -template void svg_renderer >::process(text_symbolizer const& sym, - Feature const& feature, - proj_transform const& prj_trans); -} diff -Nru mapnik-2.1.0/src/svg/svg_generator.cpp mapnik-2.2.0/src/svg/svg_generator.cpp --- mapnik-2.1.0/src/svg/svg_generator.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg/svg_generator.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include -#include - -// boost -#include - -namespace mapnik { namespace svg { - - using namespace boost::spirit; - - template - svg_generator::svg_generator(OutputIterator& output_iterator) - : output_iterator_(output_iterator) {} - - template - svg_generator::~svg_generator() {} - - template - void svg_generator::generate_header() - { - karma::generate(output_iterator_, lit("\n")); - karma::generate(output_iterator_, lit("\n")); - } - - template - void svg_generator::generate_opening_root(root_output_attributes const& root_attributes) - { - root_attributes_grammar attributes_grammar; - karma::generate(output_iterator_, lit("\n"), root_attributes); - } - - template - void svg_generator::generate_closing_root() - { - karma::generate(output_iterator_, lit("")); - } - - template - void svg_generator::generate_rect(rect_output_attributes const& rect_attributes) - { - rect_attributes_grammar attributes_grammar; - karma::generate(output_iterator_, lit("\n"), rect_attributes); - } - - template - void svg_generator::generate_path(path_type const& path, path_output_attributes const& path_attributes) - { - path_data_grammar data_grammar(path); - path_attributes_grammar attributes_grammar; - path_dash_array_grammar dash_array_grammar; - - karma::generate(output_iterator_, lit("\n"), path_attributes); - } - - template class svg_generator >; - }} diff -Nru mapnik-2.1.0/src/svg/svg_output_attributes.cpp mapnik-2.2.0/src/svg/svg_output_attributes.cpp --- mapnik-2.1.0/src/svg/svg_output_attributes.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg/svg_output_attributes.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,290 +0,0 @@ - -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include - -namespace mapnik { namespace svg { - - // path_output_attributes - - void path_output_attributes::set_fill_color(color const& fill_color) - { - fill_color_ = fill_color.to_hex_string(); - } - - void path_output_attributes::set_fill_opacity(const double fill_opacity) - { - fill_opacity_ = fill_opacity; - } - - void path_output_attributes::set_stroke_color(color const& stroke_color) - { - stroke_color_ = stroke_color.to_hex_string(); - } - - void path_output_attributes::set_stroke_opacity(const double stroke_opacity) - { - stroke_opacity_ = stroke_opacity; - } - - void path_output_attributes::set_stroke_width(const double stroke_width) - { - stroke_width_ = stroke_width; - } - - void path_output_attributes::set_stroke_linecap(const line_cap_e stroke_linecap) - { - switch(stroke_linecap) - { - case BUTT_CAP: - stroke_linecap_ = "butt"; - break; - case SQUARE_CAP: - stroke_linecap_ = "square"; - break; - case ROUND_CAP: - stroke_linecap_ = "round"; - break; - default: - stroke_linecap_ = "butt"; - } - } - - void path_output_attributes::set_stroke_linejoin(const line_join_e stroke_linejoin) - { - switch(stroke_linejoin) - { - case MITER_JOIN: - stroke_linejoin_ = "miter"; - break; - case MITER_REVERT_JOIN: - stroke_linejoin_ = "miter"; - break; - case ROUND_JOIN: - stroke_linejoin_ = "round"; - break; - case BEVEL_JOIN: - stroke_linejoin_ = "bevel"; - break; - default: - stroke_linejoin_ = "miter"; - } - } - - void path_output_attributes::set_stroke_dasharray(const dash_array stroke_dasharray) - { - stroke_dasharray_ = stroke_dasharray; - } - - void path_output_attributes::set_stroke_dashoffset(const double stroke_dashoffset) - { - stroke_dashoffset_ = stroke_dashoffset; - } - - const std::string path_output_attributes::fill_color() const - { - return fill_color_; - } - - const double path_output_attributes::fill_opacity() const - { - return fill_opacity_; - } - - const std::string path_output_attributes::stroke_color() const - { - return stroke_color_; - } - - const double path_output_attributes::stroke_opacity() const - { - return stroke_opacity_; - } - - const double path_output_attributes::stroke_width() const - { - return stroke_width_; - } - - const std::string path_output_attributes::stroke_linecap() const - { - return stroke_linecap_; - } - - const std::string path_output_attributes::stroke_linejoin() const - { - return stroke_linejoin_; - } - - const dash_array path_output_attributes::stroke_dasharray() const - { - return stroke_dasharray_; - } - - const double path_output_attributes::stroke_dashoffset() const - { - return stroke_dashoffset_; - } - - void path_output_attributes::reset() - { - fill_color_ = "none"; - fill_opacity_ = 1.0; - stroke_color_ = "none"; - stroke_opacity_ = 1.0; - stroke_width_ = 0.0; - stroke_linecap_ = "butt"; - stroke_linejoin_ = "miter"; - stroke_dasharray_.clear(); - stroke_dashoffset_ = 0.0; - } - - // rect_output_attributes - - void rect_output_attributes::set_x(const int x) - { - x_ = x; - } - - void rect_output_attributes::set_y(const int y) - { - y_ = y; - } - - void rect_output_attributes::set_width(const unsigned width) - { - width_ = width; - } - - void rect_output_attributes::set_height(const unsigned height) - { - height_ = height; - } - - void rect_output_attributes::set_fill_color(color const& fill_color) - { - fill_color_ = fill_color.to_hex_string(); - } - - const int rect_output_attributes::x() const - { - return x_; - } - - const int rect_output_attributes::y() const - { - return y_; - } - - const int rect_output_attributes::width() const - { - return width_; - } - - const int rect_output_attributes::height() const - { - return height_; - } - - const std::string rect_output_attributes::fill_color() const - { - return fill_color_; - } - - void rect_output_attributes::reset() - { - x_ = 0; - y_ = 0; - width_ = 400; - height_ = 400; - fill_color_ = "#000000"; - } - - // rect_output_attributes - - const double root_output_attributes::SVG_VERSION = 1.1; - const std::string root_output_attributes::SVG_NAMESPACE_URL = "http://www.w3.org/2000/svg"; - - root_output_attributes::root_output_attributes() - : width_(400), - height_(400), - svg_version_(SVG_VERSION), - svg_namespace_url_(SVG_NAMESPACE_URL) - {} - - root_output_attributes::root_output_attributes(const unsigned width, const unsigned height) - : width_(width), - height_(height), - svg_version_(SVG_VERSION), - svg_namespace_url_(SVG_NAMESPACE_URL) - {} - - void root_output_attributes::set_width(const unsigned width) - { - width_ = width; - } - - void root_output_attributes::set_height(const unsigned height) - { - height_ = height; - } - - void root_output_attributes::set_svg_version(const double svg_version) - { - svg_version_ = svg_version; - } - - void root_output_attributes::set_svg_namespace_url(std::string const& svg_namespace_url) - { - svg_namespace_url_ = svg_namespace_url; - } - - const unsigned root_output_attributes::width() const - { - return width_; - } - - const unsigned root_output_attributes::height() const - { - return height_; - } - - const double root_output_attributes::svg_version() const - { - return svg_version_; - } - - const std::string root_output_attributes::svg_namespace_url() const - { - return svg_namespace_url_; - } - - void root_output_attributes::reset() - { - width_ = 400; - height_ = 400; - svg_version_ = SVG_VERSION; - svg_namespace_url_ = SVG_NAMESPACE_URL; - } - }} diff -Nru mapnik-2.1.0/src/svg/svg_parser.cpp mapnik-2.2.0/src/svg/svg_parser.cpp --- mapnik-2.1.0/src/svg/svg_parser.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/svg_parser.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,1086 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#include +#include +#include +#include +#include + +#include "agg_ellipse.h" +#include "agg_rounded_rect.h" +#include "agg_span_gradient.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +// xml2 +#include + + +namespace mapnik { namespace svg { + +bool parse_reader(svg_parser & parser,xmlTextReaderPtr reader); +void process_node(svg_parser & parser,xmlTextReaderPtr reader); +void start_element(svg_parser & parser,xmlTextReaderPtr reader); +void end_element(svg_parser & parser,xmlTextReaderPtr reader); +void parse_path(svg_parser & parser,xmlTextReaderPtr reader); +void parse_dimensions(svg_parser & parser,xmlTextReaderPtr reader); +void parse_polygon(svg_parser & parser,xmlTextReaderPtr reader); +void parse_polyline(svg_parser & parser,xmlTextReaderPtr reader); +void parse_line(svg_parser & parser,xmlTextReaderPtr reader); +void parse_rect(svg_parser & parser,xmlTextReaderPtr reader); +void parse_circle(svg_parser & parser,xmlTextReaderPtr reader); +void parse_ellipse(svg_parser & parser,xmlTextReaderPtr reader); +void parse_linear_gradient(svg_parser & parser,xmlTextReaderPtr reader); +void parse_radial_gradient(svg_parser & parser,xmlTextReaderPtr reader); +bool parse_common_gradient(svg_parser & parser,xmlTextReaderPtr reader); +void parse_gradient_stop(svg_parser & parser,xmlTextReaderPtr reader); +void parse_pattern(svg_parser & parser,xmlTextReaderPtr reader); +void parse_attr(svg_parser & parser,xmlTextReaderPtr reader); +void parse_attr(svg_parser & parser,const xmlChar * name, const xmlChar * value ); + +typedef std::vector > color_lookup_type; + +namespace qi = boost::spirit::qi; + +typedef std::vector > pairs_type; + +template +struct key_value_sequence_ordered + : qi::grammar +{ + key_value_sequence_ordered() + : key_value_sequence_ordered::base_type(query) + { + query = pair >> *( qi::lit(';') >> pair); + pair = key >> -(':' >> value); + key = qi::char_("a-zA-Z_") >> *qi::char_("a-zA-Z_0-9-"); + value = +(qi::char_ - qi::lit(';')); + } + + qi::rule query; + qi::rule(), SkipType> pair; + qi::rule key, value; +}; + +agg::rgba8 parse_color(const char* str) +{ + mapnik::color c(100,100,100); + try + { + c = mapnik::parse_color(str); + } + catch (mapnik::config_error const& ex) + { + MAPNIK_LOG_ERROR(svg_parser) << ex.what(); + } + return agg::rgba8(c.red(), c.green(), c.blue(), c.alpha()); +} + +double parse_double(const char* str) +{ + using namespace boost::spirit::qi; + double val = 0.0; + parse(str, str + std::strlen(str),double_,val); + return val; +} + +/* + * parse a double that might end with a % + * if it does then set the ref bool true and divide the result by 100 + */ +double parse_double_optional_percent(const char* str, bool &percent) +{ + using namespace boost::spirit::qi; + using boost::phoenix::ref; + using qi::_1; + + double val = 0.0; + char unit='\0'; + parse(str, str + std::strlen(str),double_[ref(val)=_1] >> *char_('%')[ref(unit)=_1]); + if (unit =='%') + { + percent = true; + val/=100.0; + } + else + { + percent = false; + } + return val; +} + +bool parse_style (const char* str, pairs_type & v) +{ + using namespace boost::spirit::qi; + typedef boost::spirit::ascii::space_type skip_type; + key_value_sequence_ordered kv_parser; + return phrase_parse(str, str + std::strlen(str), kv_parser, skip_type(), v); +} + +bool parse_reader(svg_parser & parser, xmlTextReaderPtr reader) +{ + int ret = xmlTextReaderRead(reader); + try { + while (ret == 1) + { + process_node(parser,reader); + ret = xmlTextReaderRead(reader); + } + } + catch (std::exception const& ex) + { + xmlFreeTextReader(reader); + throw; + } + xmlFreeTextReader(reader); + if (ret != 0) + { + // parsing failure + return false; + } + return true; +} + + +void start_element(svg_parser & parser, xmlTextReaderPtr reader) +{ + const xmlChar *name; + name = xmlTextReaderConstName(reader); + + if (xmlStrEqual(name, BAD_CAST "defs")) + { + if (xmlTextReaderIsEmptyElement(reader) == 0) + parser.is_defs_ = true; + } + // the gradient tags *should* be in defs, but illustrator seems not to put them in there so + // accept them anywhere + else if (xmlStrEqual(name, BAD_CAST "linearGradient")) + { + parse_linear_gradient(parser,reader); + } + else if (xmlStrEqual(name, BAD_CAST "radialGradient")) + { + parse_radial_gradient(parser,reader); + } + else if (xmlStrEqual(name, BAD_CAST "stop")) + { + parse_gradient_stop(parser,reader); + } + if ( !parser.is_defs_ ) + { + + if (xmlStrEqual(name, BAD_CAST "g")) + { + parser.path_.push_attr(); + parse_attr(parser,reader); + } + else + { + parser.path_.push_attr(); + parse_attr(parser,reader); + if (parser.path_.display()) + { + if (xmlStrEqual(name, BAD_CAST "path")) + { + parse_path(parser,reader); + } + else if (xmlStrEqual(name, BAD_CAST "polygon") ) + { + parse_polygon(parser,reader); + } + else if (xmlStrEqual(name, BAD_CAST "polyline")) + { + parse_polyline(parser,reader); + } + else if (xmlStrEqual(name, BAD_CAST "line")) + { + parse_line(parser,reader); + } + else if (xmlStrEqual(name, BAD_CAST "rect")) + { + parse_rect(parser,reader); + } + else if (xmlStrEqual(name, BAD_CAST "circle")) + { + parse_circle(parser,reader); + } + else if (xmlStrEqual(name, BAD_CAST "ellipse")) + { + parse_ellipse(parser,reader); + } + else if (xmlStrEqual(name, BAD_CAST "svg")) + { + parse_dimensions(parser,reader); + } +#ifdef MAPNIK_LOG + else if (!xmlStrEqual(name, BAD_CAST "svg")) + { + MAPNIK_LOG_WARN(svg_parser) << "svg_parser: Unhandled svg element=" << name; + } +#endif + } + parser.path_.pop_attr(); + } + } +} + +void end_element(svg_parser & parser, xmlTextReaderPtr reader) +{ + const xmlChar *name; + name = xmlTextReaderConstName(reader); + + + if (!parser.is_defs_ && xmlStrEqual(name, BAD_CAST "g")) + { + parser.path_.pop_attr(); + } + else if (xmlStrEqual(name, BAD_CAST "defs")) + { + parser.is_defs_ = false; + } + else if ((xmlStrEqual(name, BAD_CAST "linearGradient")) || (xmlStrEqual(name, BAD_CAST "radialGradient"))) + { + parser.gradient_map_[parser.temporary_gradient_.first] = parser.temporary_gradient_.second; + } + +} + +void process_node(svg_parser & parser, xmlTextReaderPtr reader) +{ + int node_type = xmlTextReaderNodeType(reader); + switch (node_type) + { + case 1: //start element + start_element(parser,reader); + break; + case 15:// end element + end_element(parser,reader); + break; + default: + break; + } +} + +void parse_attr(svg_parser & parser, const xmlChar * name, const xmlChar * value ) +{ + if (xmlStrEqual(name, BAD_CAST "transform")) + { + agg::trans_affine tr; + mapnik::svg::parse_transform((const char*) value,tr); + parser.path_.transform().premultiply(tr); + } + else if (xmlStrEqual(name, BAD_CAST "fill")) + { + if (xmlStrEqual(value, BAD_CAST "none")) + { + parser.path_.fill_none(); + } + else if (boost::starts_with((const char*)value, "url(#")) + { + // see if we have a known gradient fill + std::string id = std::string((const char*)&value[5]); + // get rid of the trailing ) + id.erase(id.end()-1); + if (parser.gradient_map_.count(id) > 0) + { + parser.path_.add_fill_gradient(parser.gradient_map_[id]); + } + else + { + MAPNIK_LOG_ERROR(svg_parser) << "Failed to find gradient fill: " << id; + } + } + else + { + parser.path_.fill(parse_color((const char*) value)); + } + } + else if (xmlStrEqual(name, BAD_CAST "fill-opacity")) + { + parser.path_.fill_opacity(parse_double((const char*) value)); + } + else if (xmlStrEqual(name, BAD_CAST "fill-rule")) + { + if (xmlStrEqual(value, BAD_CAST "evenodd")) + { + parser.path_.even_odd(true); + } + } + else if (xmlStrEqual(name, BAD_CAST "stroke")) + { + if (xmlStrEqual(value, BAD_CAST "none")) + { + parser.path_.stroke_none(); + } + else if (boost::starts_with((const char*)value, "url(#")) + { + // see if we have a known gradient fill + std::string id = std::string((const char*)&value[5]); + // get rid of the trailing ) + id.erase(id.end()-1); + if (parser.gradient_map_.count(id) > 0) + { + parser.path_.add_stroke_gradient(parser.gradient_map_[id]); + } + else + { + MAPNIK_LOG_ERROR(svg_parser) << "Failed to find gradient fill: " << id; + } + } + else + { + parser.path_.stroke(parse_color((const char*) value)); + } + } + else if (xmlStrEqual(name, BAD_CAST "stroke-width")) + { + parser.path_.stroke_width(parse_double((const char*)value)); + } + else if (xmlStrEqual(name, BAD_CAST "stroke-opacity")) + { + parser.path_.stroke_opacity(parse_double((const char*)value)); + } + else if(xmlStrEqual(name,BAD_CAST "stroke-width")) + { + parser.path_.stroke_width(parse_double((const char*) value)); + } + else if(xmlStrEqual(name,BAD_CAST "stroke-linecap")) + { + if(xmlStrEqual(value,BAD_CAST "butt")) + parser.path_.line_cap(agg::butt_cap); + else if(xmlStrEqual(value,BAD_CAST "round")) + parser.path_.line_cap(agg::round_cap); + else if(xmlStrEqual(value,BAD_CAST "square")) + parser.path_.line_cap(agg::square_cap); + } + else if(xmlStrEqual(name,BAD_CAST "stroke-linejoin")) + { + if(xmlStrEqual(value,BAD_CAST "miter")) + parser.path_.line_join(agg::miter_join); + else if(xmlStrEqual(value,BAD_CAST "round")) + parser.path_.line_join(agg::round_join); + else if(xmlStrEqual(value,BAD_CAST "bevel")) + parser.path_.line_join(agg::bevel_join); + } + else if(xmlStrEqual(name,BAD_CAST "stroke-miterlimit")) + { + parser.path_.miter_limit(parse_double((const char*)value)); + } + + else if(xmlStrEqual(name, BAD_CAST "opacity")) + { + double opacity = parse_double((const char*)value); + parser.path_.opacity(opacity); + } + else if (xmlStrEqual(name, BAD_CAST "visibility")) + { + parser.path_.visibility(!xmlStrEqual(value, BAD_CAST "hidden")); + } + else if (xmlStrEqual(name, BAD_CAST "display") && xmlStrEqual(value, BAD_CAST "none")) + { + parser.path_.display(false); + } +} + + +void parse_attr(svg_parser & parser, xmlTextReaderPtr reader) +{ + const xmlChar *name, *value; + + if (xmlTextReaderMoveToFirstAttribute(reader) == 1) + { + do + { + name = xmlTextReaderConstName(reader); + value = xmlTextReaderConstValue(reader); + + if (xmlStrEqual(name, BAD_CAST "style")) + { + typedef std::vector > cont_type; + typedef cont_type::value_type value_type; + cont_type vec; + parse_style((const char*)value, vec); + BOOST_FOREACH(value_type kv , vec ) + { + parse_attr(parser,BAD_CAST kv.first.c_str(),BAD_CAST kv.second.c_str()); + } + } + else + { + parse_attr(parser,name,value); + } + } while(xmlTextReaderMoveToNextAttribute(reader) == 1); + } + xmlTextReaderMoveToElement(reader); +} + +void parse_dimensions(svg_parser & parser, xmlTextReaderPtr reader) +{ + xmlChar *value; + double width = 0; + double height = 0; + value = xmlTextReaderGetAttribute(reader, BAD_CAST "width"); + if (value) + { + width = parse_double((const char*)value); + xmlFree(value); + } + xmlChar *value2; + value2 = xmlTextReaderGetAttribute(reader, BAD_CAST "width"); + if (value2) + { + height = parse_double((const char*)value2); + xmlFree(value2); + } + parser.path_.set_dimensions(width,height); + +} +void parse_path(svg_parser & parser, xmlTextReaderPtr reader) +{ + xmlChar *value; + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "d"); + if (value) + { + // d="" (empty paths) are valid + if (std::strlen((const char*)value) < 1) + { + xmlFree(value); + } + else + { + parser.path_.begin_path(); + + if (!mapnik::svg::parse_path((const char*) value, parser.path_)) + { + xmlFree(value); + xmlChar *id_value; + id_value = xmlTextReaderGetAttribute(reader, BAD_CAST "id"); + if (id_value) + { + std::string id_string((const char *) id_value); + xmlFree(id_value); + throw std::runtime_error(std::string("unable to parse invalid svg with id '") + id_string + "'"); + } + else + { + throw std::runtime_error("unable to parse invalid svg "); + } + } + parser.path_.end_path(); + xmlFree(value); + } + } +} + +void parse_polygon(svg_parser & parser, xmlTextReaderPtr reader) +{ + xmlChar *value; + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "points"); + if (value) + { + parser.path_.begin_path(); + if (!mapnik::svg::parse_points((const char*) value, parser.path_)) + { + xmlFree(value); + throw std::runtime_error("Failed to parse "); + } + parser.path_.close_subpath(); + parser.path_.end_path(); + xmlFree(value); + } +} + +void parse_polyline(svg_parser & parser, xmlTextReaderPtr reader) +{ + xmlChar *value; + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "points"); + if (value) + { + parser.path_.begin_path(); + if (!mapnik::svg::parse_points((const char*) value, parser.path_)) + { + xmlFree(value); + throw std::runtime_error("Failed to parse "); + } + + parser.path_.end_path(); + xmlFree(value); + } +} + +void parse_line(svg_parser & parser, xmlTextReaderPtr reader) +{ + xmlChar *value; + double x1 = 0.0; + double y1 = 0.0; + double x2 = 0.0; + double y2 = 0.0; + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "x1"); + if (value) + { + x1 = parse_double((const char*)value); + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "y1"); + if (value) + { + y1 = parse_double((const char*)value); + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "x2"); + if (value) + { + x2 = parse_double((const char*)value); + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "y2"); + if (value) + { + y2 = parse_double((const char*)value); + xmlFree(value); + } + + parser.path_.begin_path(); + parser.path_.move_to(x1, y1); + parser.path_.line_to(x2, y2); + parser.path_.end_path(); + +} + +void parse_circle(svg_parser & parser, xmlTextReaderPtr reader) +{ + xmlChar *value; + double cx = 0.0; + double cy = 0.0; + double r = 0.0; + value = xmlTextReaderGetAttribute(reader, BAD_CAST "cx"); + if (value) + { + cx = parse_double((const char*)value); + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "cy"); + if (value) + { + cy = parse_double((const char*)value); + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "r"); + if (value) + { + r = parse_double((const char*)value); + xmlFree(value); + } + + parser.path_.begin_path(); + + if(r != 0.0) + { + if(r < 0.0) throw std::runtime_error("parse_circle: Invalid radius"); + agg::ellipse c(cx, cy, r, r); + parser.path_.storage().concat_path(c); + } + + parser.path_.end_path(); +} + +void parse_ellipse(svg_parser & parser, xmlTextReaderPtr reader) +{ + xmlChar *value; + double cx = 0.0; + double cy = 0.0; + double rx = 0.0; + double ry = 0.0; + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "cx"); + if (value) + { + cx = parse_double((const char*)value); + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "cy"); + if (value) + { + cy = parse_double((const char*)value); + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "rx"); + if (value) + { + rx = parse_double((const char*)value); + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "ry"); + if (value) + { + ry = parse_double((const char*)value); + xmlFree(value); + } + + parser.path_.begin_path(); + + if(rx != 0.0 && ry != 0.0) + { + if(rx < 0.0) throw std::runtime_error("parse_ellipse: Invalid rx"); + if(ry < 0.0) throw std::runtime_error("parse_ellipse: Invalid ry"); + agg::ellipse c(cx, cy, rx, ry); + parser.path_.storage().concat_path(c); + } + + parser.path_.end_path(); + +} + +void parse_rect(svg_parser & parser, xmlTextReaderPtr reader) +{ + xmlChar *value; + double x = 0.0; + double y = 0.0; + double w = 0.0; + double h = 0.0; + double rx = 0.0; + double ry = 0.0; + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "x"); + if (value) + { + x = parse_double((const char*)value); + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "y"); + if (value) + { + y = parse_double((const char*)value); + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "width"); + if (value) + { + w = parse_double((const char*)value); + xmlFree(value); + } + value = xmlTextReaderGetAttribute(reader, BAD_CAST "height"); + if (value) + { + h = parse_double((const char*)value); + xmlFree(value); + } + + bool rounded = true; + value = xmlTextReaderGetAttribute(reader, BAD_CAST "rx"); + if (value) + { + rx = parse_double((const char*)value); + xmlFree(value); + } + else rounded = false; + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "ry"); + if (value) + { + ry = parse_double((const char*)value); + if (!rounded) + { + rx = ry; + rounded = true; + } + xmlFree(value); + } + else if (rounded) + { + ry = rx; + } + + if(w != 0.0 && h != 0.0) + { + if(w < 0.0) throw std::runtime_error("parse_rect: Invalid width"); + if(h < 0.0) throw std::runtime_error("parse_rect: Invalid height"); + if(rx < 0.0) throw std::runtime_error("parse_rect: Invalid rx"); + if(ry < 0.0) throw std::runtime_error("parse_rect: Invalid ry"); + parser.path_.begin_path(); + + if(rounded) + { + agg::rounded_rect r; + r.rect(x,y,x+w,y+h); + r.radius(rx,ry); + parser.path_.storage().concat_path(r); + } + else + { + parser.path_.move_to(x, y); + parser.path_.line_to(x + w, y); + parser.path_.line_to(x + w, y + h); + parser.path_.line_to(x, y + h); + parser.path_.close_subpath(); + } + parser.path_.end_path(); + } +} + + +/* + * +*/ +void parse_gradient_stop(svg_parser & parser, xmlTextReaderPtr reader) +{ + xmlChar *value; + + double offset = 0.0; + mapnik::color stop_color; + double opacity = 1.0; + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "offset"); + if (value) + { + offset = parse_double((const char*)value); + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "style"); + if (value) + { + typedef std::vector > cont_type; + typedef cont_type::value_type value_type; + cont_type vec; + parse_style((const char*)value, vec); + + BOOST_FOREACH(value_type kv , vec ) + { + if (kv.first == "stop-color") + { + try + { + stop_color = mapnik::parse_color(kv.second.c_str()); + } + catch (mapnik::config_error const& ex) + { + MAPNIK_LOG_ERROR(svg_parser) << ex.what(); + } + } + else if (kv.first == "stop-opacity") + { + opacity = parse_double(kv.second.c_str()); + } + } + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "stop-color"); + if (value) + { + try + { + stop_color = mapnik::parse_color((const char *) value); + } + catch (mapnik::config_error const& ex) + { + MAPNIK_LOG_ERROR(svg_parser) << ex.what(); + } + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "stop-opacity"); + if (value) + { + opacity = parse_double((const char *) value); + xmlFree(value); + } + + + stop_color.set_alpha(opacity*255); + + parser.temporary_gradient_.second.add_stop(offset, stop_color); + + /* + MAPNIK_LOG_DEBUG(svg_parser) << "\tFound Stop: " << offset << " " + << (unsigned)stop_color.red() << " " + << (unsigned)stop_color.green() << " " + << (unsigned)stop_color.blue() << " " + << (unsigned)stop_color.alpha(); + */ +} + +bool parse_common_gradient(svg_parser & parser, xmlTextReaderPtr reader) +{ + xmlChar *value; + + std::string id; + value = xmlTextReaderGetAttribute(reader, BAD_CAST "id"); + if (value) + { + // start a new gradient + gradient new_grad; + id = std::string((const char *) value); + parser.temporary_gradient_ = std::make_pair(id, new_grad); + xmlFree(value); + } + else + { + // no point without an ID + return false; + } + + // check if we should inherit from another tag + value = xmlTextReaderGetAttribute(reader, BAD_CAST "xlink:href"); + if (value) + { + if (value[0] == '#') + { + std::string linkid = (const char *) &value[1]; + if (parser.gradient_map_.count(linkid)) + { + parser.temporary_gradient_.second = parser.gradient_map_[linkid]; + } + else + { + MAPNIK_LOG_ERROR(svg_parser) << "Failed to find linked gradient " << linkid; + } + } + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "gradientUnits"); + if (value) + { + if (xmlStrEqual(value, BAD_CAST "userSpaceOnUse")) + { + parser.temporary_gradient_.second.set_units(USER_SPACE_ON_USE); + } + else + { + parser.temporary_gradient_.second.set_units(OBJECT_BOUNDING_BOX); + } + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "gradientTransform"); + if (value) + { + agg::trans_affine tr; + mapnik::svg::parse_transform((const char*) value,tr); + parser.temporary_gradient_.second.set_transform(tr); + xmlFree(value); + } + + return true; +} + +/** + * +*/ +void parse_radial_gradient(svg_parser & parser, xmlTextReaderPtr reader) +{ + if (!parse_common_gradient(parser,reader)) + return; + + xmlChar *value; + double cx = 0.5; + double cy = 0.5; + double fx = 0.0; + double fy = 0.0; + double r = 0.5; + bool has_percent=true; + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "cx"); + if (value) + { + cx = parse_double_optional_percent((const char*)value, has_percent); + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "cy"); + if (value) + { + cy = parse_double_optional_percent((const char*)value, has_percent); + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "fx"); + if (value) + { + fx = parse_double_optional_percent((const char*)value, has_percent); + xmlFree(value); + } + else + fx = cx; + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "fy"); + if (value) + { + fy = parse_double_optional_percent((const char*)value, has_percent); + xmlFree(value); + } + else + fy = cy; + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "r"); + if (value) + { + r = parse_double_optional_percent((const char*)value, has_percent); + xmlFree(value); + } + // this logic for detecting %'s will not support mixed coordinates. + if (has_percent && parser.temporary_gradient_.second.get_units() == USER_SPACE_ON_USE) + { + parser.temporary_gradient_.second.set_units(USER_SPACE_ON_USE_BOUNDING_BOX); + } + + parser.temporary_gradient_.second.set_gradient_type(RADIAL); + parser.temporary_gradient_.second.set_control_points(fx,fy,cx,cy,r); + // add this here in case we have no end tag, will be replaced if we do + parser.gradient_map_[parser.temporary_gradient_.first] = parser.temporary_gradient_.second; + + //MAPNIK_LOG_DEBUG(svg_parser) << "Found Radial Gradient: " << " " << cx << " " << cy << " " << fx << " " << fy << " " << r; +} + +void parse_linear_gradient(svg_parser & parser, xmlTextReaderPtr reader) +{ + if (!parse_common_gradient(parser,reader)) + return; + + xmlChar *value; + double x1 = 0.0; + double x2 = 1.0; + double y1 = 0.0; + double y2 = 1.0; + + bool has_percent=true; + value = xmlTextReaderGetAttribute(reader, BAD_CAST "x1"); + if (value) + { + x1 = parse_double_optional_percent((const char*)value, has_percent); + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "x2"); + if (value) + { + x2 = parse_double_optional_percent((const char*)value, has_percent); + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "y1"); + if (value) + { + y1 = parse_double_optional_percent((const char*)value, has_percent); + xmlFree(value); + } + + value = xmlTextReaderGetAttribute(reader, BAD_CAST "y2"); + if (value) + { + y2 = parse_double_optional_percent((const char*)value, has_percent); + xmlFree(value); + } + // this logic for detecting %'s will not support mixed coordinates. + if (has_percent && parser.temporary_gradient_.second.get_units() == USER_SPACE_ON_USE) + { + parser.temporary_gradient_.second.set_units(USER_SPACE_ON_USE_BOUNDING_BOX); + } + + parser.temporary_gradient_.second.set_gradient_type(LINEAR); + parser.temporary_gradient_.second.set_control_points(x1,y1,x2,y2); + // add this here in case we have no end tag, will be replaced if we do + parser.gradient_map_[parser.temporary_gradient_.first] = parser.temporary_gradient_.second; + + //MAPNIK_LOG_DEBUG(svg_parser) << "Found Linear Gradient: " << "(" << x1 << " " << y1 << "),(" << x2 << " " << y2 << ")"; +} + +void parse_pattern(svg_parser & parser, xmlTextReaderPtr reader) +{ + //const xmlChar *value; +} + +svg_parser::svg_parser(svg_converter > & path) + : path_(path), + is_defs_(false) {} + +svg_parser::~svg_parser() {} + +void svg_parser::parse(std::string const& filename) +{ + xmlTextReaderPtr reader = xmlNewTextReaderFilename(filename.c_str()); + if (reader == NULL) + { + MAPNIK_LOG_ERROR(svg_parser) << "Unable to open '" << filename << "'"; + } + else if (!parse_reader(*this,reader)) + { + MAPNIK_LOG_ERROR(svg_parser) << "Unable to parse '" << filename << "'"; + } +} + +void svg_parser::parse_from_string(std::string const& svg) +{ + xmlTextReaderPtr reader = xmlReaderForMemory(svg.c_str(),svg.size(),NULL,NULL, + (XML_PARSE_NOBLANKS | XML_PARSE_NOCDATA | XML_PARSE_NOERROR | XML_PARSE_NOWARNING)); + if (reader == NULL) + { + MAPNIK_LOG_ERROR(svg_parser) << "Unable to parse '" << svg << "'"; + } + else if (!parse_reader(*this,reader)) + { + MAPNIK_LOG_ERROR(svg_parser) << "Unable to parse '" << svg << "'"; + } +} + + +}} diff -Nru mapnik-2.1.0/src/svg/svg_path_parser.cpp mapnik-2.2.0/src/svg/svg_path_parser.cpp --- mapnik-2.1.0/src/svg/svg_path_parser.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/svg_path_parser.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,52 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include +#include +#include +#include + +// agg +#include "agg_path_storage.h" + +// stl +#include +#include + +namespace mapnik { namespace svg { + + template + bool parse_path(const char* wkt, PathType & p) + { + using namespace boost::spirit; + typedef const char* iterator_type; + typedef ascii::space_type skip_type; + svg_path_grammar g(p); + iterator_type first = wkt; + iterator_type last = wkt + std::strlen(wkt); + return qi::phrase_parse(first, last, g, skip_type()); + } + + template bool parse_path(const char*, svg_converter_type&); + + }} diff -Nru mapnik-2.1.0/src/svg/svg_points_parser.cpp mapnik-2.2.0/src/svg/svg_points_parser.cpp --- mapnik-2.1.0/src/svg/svg_points_parser.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/svg_points_parser.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,47 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include +#include +#include +// stl +#include +#include + +namespace mapnik { namespace svg { + + template + bool parse_points(const char* wkt, PathType & p) + { + using namespace boost::spirit; + typedef const char* iterator_type; + typedef ascii::space_type skip_type; + svg_points_grammar g(p); + iterator_type first = wkt; + iterator_type last = wkt + std::strlen(wkt); + return qi::phrase_parse(first, last, g, skip_type()); + } + + template bool parse_points(const char*, svg_converter_type&); + + }} diff -Nru mapnik-2.1.0/src/svg/svg_renderer.cpp mapnik-2.2.0/src/svg/svg_renderer.cpp --- mapnik-2.1.0/src/svg/svg_renderer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg/svg_renderer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include -#include -#include - -// stl -#include - -namespace mapnik -{ -template -svg_renderer::svg_renderer(Map const& m, T & output_iterator, unsigned offset_x, unsigned offset_y) : - feature_style_processor(m), - output_iterator_(output_iterator), - width_(m.width()), - height_(m.height()), - t_(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y), - generator_(output_iterator) -{} - -template -svg_renderer::~svg_renderer() {} - -template -void svg_renderer::start_map_processing(Map const& map) -{ - MAPNIK_LOG_DEBUG(svg_renderer) << "svg_renderer: Start map processing"; - - // generate XML header. - generator_.generate_header(); - - // generate SVG root element opening tag. - // the root element defines the size of the image, - // which is taken from the map's dimensions. - svg::root_output_attributes root_attributes(width_, height_); - generator_.generate_opening_root(root_attributes); - - boost::optional const& bgcolor = map.background(); - if(bgcolor) - { - // generate background color as a rectangle that spans the whole image. - svg::rect_output_attributes bg_attributes(0, 0, width_, height_, *bgcolor); - generator_.generate_rect(bg_attributes); - } -} - -template -void svg_renderer::end_map_processing(Map const& map) -{ - // generate SVG root element closing tag. - generator_.generate_closing_root(); - - MAPNIK_LOG_DEBUG(svg_renderer) << "svg_renderer: End map processing"; -} - -template -void svg_renderer::start_layer_processing(layer const& lay) -{ - MAPNIK_LOG_DEBUG(svg_renderer) << "svg_renderer: Start layer processing=" << lay.name(); -} - -template -void svg_renderer::end_layer_processing(layer const& lay) -{ - MAPNIK_LOG_DEBUG(svg_renderer) << "svg_renderer: End layer processing=" << lay.name(); -} - -template class svg_renderer >; -} diff -Nru mapnik-2.1.0/src/svg/svg_transform_parser.cpp mapnik-2.2.0/src/svg/svg_transform_parser.cpp --- mapnik-2.1.0/src/svg/svg_transform_parser.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/svg/svg_transform_parser.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,63 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include +#include +// agg +#include "agg_trans_affine.h" +// stl +#include +#include + +namespace mapnik { namespace svg { + + template + bool parse_transform(const char * wkt, TransformType & p) + { + using namespace boost::spirit; + typedef const char * iterator_type; + typedef ascii::space_type skip_type; + svg_transform_grammar g(p); + iterator_type first = wkt; + iterator_type last = wkt + std::strlen(wkt); + return qi::phrase_parse(first, last, g, skip_type()); + } + +/* + template + bool parse_transform(std::string const& wkt, TransformType & p) + { + using namespace boost::spirit; + typedef std::string::const_iterator iterator_type; + typedef ascii::space_type skip_type; + svg_transform_grammar g(p); + iterator_type first = wkt.begin(); + iterator_type last = wkt.end(); + return qi::phrase_parse(first, last, g, skip_type()); + } +*/ + + template MAPNIK_DECL bool parse_transform(const char*, agg::trans_affine&); +//template bool parse_transform(std::string const& , agg::trans_affine&); + + }} diff -Nru mapnik-2.1.0/src/svg_parser.cpp mapnik-2.2.0/src/svg_parser.cpp --- mapnik-2.1.0/src/svg_parser.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg_parser.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,1037 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#include -#include -#include -#include -#include - -#include "agg_ellipse.h" -#include "agg_rounded_rect.h" -#include "agg_span_gradient.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -namespace mapnik { namespace svg { - - -typedef std::vector > color_lookup_type; - -namespace qi = boost::spirit::qi; - -typedef std::vector > pairs_type; - -template -struct key_value_sequence_ordered - : qi::grammar -{ - key_value_sequence_ordered() - : key_value_sequence_ordered::base_type(query) - { - query = pair >> *( qi::lit(';') >> pair); - pair = key >> -(':' >> value); - key = qi::char_("a-zA-Z_") >> *qi::char_("a-zA-Z_0-9-"); - value = +(qi::char_ - qi::lit(';')); - } - - qi::rule query; - qi::rule(), SkipType> pair; - qi::rule key, value; -}; - -agg::rgba8 parse_color(const char* str) -{ - mapnik::color c(100,100,100); - try - { - mapnik::color_factory::init_from_string(c,str); - } - catch (mapnik::config_error & ex) - { - MAPNIK_LOG_ERROR(svg_parser) << ex.what(); - } - return agg::rgba8(c.red(), c.green(), c.blue(), c.alpha()); -} - -double parse_double(const char* str) -{ - using namespace boost::spirit::qi; - double val = 0.0; - parse(str, str+ strlen(str),double_,val); - return val; -} - -/* - * parse a double that might end with a % - * if it does then set the ref bool true and divide the result by 100 - */ -double parse_double_optional_percent(const char* str, bool &percent) -{ - using namespace boost::spirit::qi; - using boost::phoenix::ref; - using qi::_1; - - double val = 0.0; - char unit='\0'; - parse(str, str+ strlen(str),double_[ref(val)=_1] >> *char_('%')[ref(unit)=_1]); - if (unit =='%') - { - percent = true; - val/=100.0; - } - else - { - percent = false; - } - return val; -} - -bool parse_style (const char* str, pairs_type & v) -{ - using namespace boost::spirit::qi; - typedef boost::spirit::ascii::space_type skip_type; - key_value_sequence_ordered kv_parser; - return phrase_parse(str, str + strlen(str), kv_parser, skip_type(), v); -} - -svg_parser::svg_parser(svg_converter > & path) - : path_(path), - is_defs_(false) -{} - -svg_parser::~svg_parser() {} - -void svg_parser::parse(std::string const& filename) -{ - xmlTextReaderPtr reader = xmlNewTextReaderFilename(filename.c_str()); - if (reader == NULL) - { - MAPNIK_LOG_ERROR(svg_parser) << "Unable to open '" << filename << "'"; - } - else if (!parse_reader(reader)) - { - MAPNIK_LOG_ERROR(svg_parser) << "Unable to parse '" << filename << "'"; - } -} - -void svg_parser::parse_from_string(std::string const& svg) -{ - xmlTextReaderPtr reader = xmlReaderForMemory(svg.c_str(),svg.size(),NULL,NULL, - (XML_PARSE_NOBLANKS | XML_PARSE_NOCDATA | XML_PARSE_NOERROR | XML_PARSE_NOWARNING)); - if (reader == NULL) - { - MAPNIK_LOG_ERROR(svg_parser) << "Unable to parse '" << svg << "'"; - } - else if (!parse_reader(reader)) - { - MAPNIK_LOG_ERROR(svg_parser) << "Unable to parse '" << svg << "'"; - } -} - -bool svg_parser::parse_reader(xmlTextReaderPtr reader) -{ - int ret = xmlTextReaderRead(reader); - try { - while (ret == 1) - { - process_node(reader); - ret = xmlTextReaderRead(reader); - } - } - catch (std::exception const& ex) - { - xmlFreeTextReader(reader); - throw; - } - xmlFreeTextReader(reader); - if (ret != 0) - { - // parsing failure - return false; - } - return true; -} - -void svg_parser::process_node(xmlTextReaderPtr reader) -{ - int node_type = xmlTextReaderNodeType(reader); - switch (node_type) - { - case 1: //start element - start_element(reader); - break; - case 15:// end element - end_element(reader); - break; - default: - break; - } -} - -void svg_parser::start_element(xmlTextReaderPtr reader) -{ - const xmlChar *name; - name = xmlTextReaderConstName(reader); - - if (xmlStrEqual(name, BAD_CAST "defs")) - { - if (xmlTextReaderIsEmptyElement(reader) == 0) - is_defs_ = true; - } - // the gradient tags *should* be in defs, but illustrator seems not to put them in there so - // accept them anywhere - else if (xmlStrEqual(name, BAD_CAST "linearGradient")) - { - parse_linear_gradient(reader); - } - else if (xmlStrEqual(name, BAD_CAST "radialGradient")) - { - parse_radial_gradient(reader); - } - else if (xmlStrEqual(name, BAD_CAST "stop")) - { - parse_gradient_stop(reader); - } - if ( !is_defs_ ) - { - - if (xmlStrEqual(name, BAD_CAST "g")) - { - path_.push_attr(); - parse_attr(reader); - } - else - { - path_.push_attr(); - parse_attr(reader); - if (path_.display()) - { - if (xmlStrEqual(name, BAD_CAST "path")) - { - parse_path(reader); - } - else if (xmlStrEqual(name, BAD_CAST "polygon") ) - { - parse_polygon(reader); - } - else if (xmlStrEqual(name, BAD_CAST "polyline")) - { - parse_polyline(reader); - } - else if (xmlStrEqual(name, BAD_CAST "line")) - { - parse_line(reader); - } - else if (xmlStrEqual(name, BAD_CAST "rect")) - { - parse_rect(reader); - } - else if (xmlStrEqual(name, BAD_CAST "circle")) - { - parse_circle(reader); - } - else if (xmlStrEqual(name, BAD_CAST "ellipse")) - { - parse_ellipse(reader); - } -#ifdef MAPNIK_LOG - else if (!xmlStrEqual(name, BAD_CAST "svg")) - { - MAPNIK_LOG_WARN(svg_parser) << "svg_parser: Unhandled svg element=" << name; - } -#endif - } - path_.pop_attr(); - } - } -} - -void svg_parser::end_element(xmlTextReaderPtr reader) -{ - const xmlChar *name; - name = xmlTextReaderConstName(reader); - - - if (!is_defs_ && xmlStrEqual(name, BAD_CAST "g")) - { - path_.pop_attr(); - } - else if (xmlStrEqual(name, BAD_CAST "defs")) - { - is_defs_ = false; - } - else if ((xmlStrEqual(name, BAD_CAST "linearGradient")) || (xmlStrEqual(name, BAD_CAST "radialGradient"))) - { - gradient_map_[temporary_gradient_.first] = temporary_gradient_.second; - } - -} - -void svg_parser::parse_attr(const xmlChar * name, const xmlChar * value ) -{ - if (xmlStrEqual(name, BAD_CAST "transform")) - { - agg::trans_affine tr; - mapnik::svg::parse_transform((const char*) value,tr); - path_.transform().premultiply(tr); - } - else if (xmlStrEqual(name, BAD_CAST "fill")) - { - if (xmlStrEqual(value, BAD_CAST "none")) - { - path_.fill_none(); - } - else if (boost::starts_with((const char*)value, "url(#")) - { - // see if we have a known gradient fill - std::string id = std::string((const char*)&value[5]); - // get rid of the trailing ) - id.erase(id.end()-1); - if (gradient_map_.count(id) > 0) - { - path_.add_fill_gradient(gradient_map_[id]); - } - else - { - MAPNIK_LOG_ERROR(svg_parser) << "Failed to find gradient fill: " << id; - } - } - else - { - path_.fill(parse_color((const char*) value)); - } - } - else if (xmlStrEqual(name, BAD_CAST "fill-opacity")) - { - path_.fill_opacity(parse_double((const char*) value)); - } - else if (xmlStrEqual(name, BAD_CAST "fill-rule")) - { - if (xmlStrEqual(value, BAD_CAST "evenodd")) - { - path_.even_odd(true); - } - } - else if (xmlStrEqual(name, BAD_CAST "stroke")) - { - if (xmlStrEqual(value, BAD_CAST "none")) - { - path_.stroke_none(); - } - else if (boost::starts_with((const char*)value, "url(#")) - { - // see if we have a known gradient fill - std::string id = std::string((const char*)&value[5]); - // get rid of the trailing ) - id.erase(id.end()-1); - if (gradient_map_.count(id) > 0) - { - path_.add_stroke_gradient(gradient_map_[id]); - } - else - { - MAPNIK_LOG_ERROR(svg_parser) << "Failed to find gradient fill: " << id; - } - } - else - { - path_.stroke(parse_color((const char*) value)); - } - } - else if (xmlStrEqual(name, BAD_CAST "stroke-width")) - { - path_.stroke_width(parse_double((const char*)value)); - } - else if (xmlStrEqual(name, BAD_CAST "stroke-opacity")) - { - path_.stroke_opacity(parse_double((const char*)value)); - } - else if(xmlStrEqual(name,BAD_CAST "stroke-width")) - { - path_.stroke_width(parse_double((const char*) value)); - } - else if(xmlStrEqual(name,BAD_CAST "stroke-linecap")) - { - if(xmlStrEqual(value,BAD_CAST "butt")) - path_.line_cap(agg::butt_cap); - else if(xmlStrEqual(value,BAD_CAST "round")) - path_.line_cap(agg::round_cap); - else if(xmlStrEqual(value,BAD_CAST "square")) - path_.line_cap(agg::square_cap); - } - else if(xmlStrEqual(name,BAD_CAST "stroke-linejoin")) - { - if(xmlStrEqual(value,BAD_CAST "miter")) - path_.line_join(agg::miter_join); - else if(xmlStrEqual(value,BAD_CAST "round")) - path_.line_join(agg::round_join); - else if(xmlStrEqual(value,BAD_CAST "bevel")) - path_.line_join(agg::bevel_join); - } - else if(xmlStrEqual(name,BAD_CAST "stroke-miterlimit")) - { - path_.miter_limit(parse_double((const char*)value)); - } - - else if(xmlStrEqual(name, BAD_CAST "opacity")) - { - double opacity = parse_double((const char*)value); - path_.stroke_opacity(opacity); - path_.fill_opacity(opacity); - } - else if (xmlStrEqual(name, BAD_CAST "visibility")) - { - path_.visibility(!xmlStrEqual(value, BAD_CAST "hidden")); - } - else if (xmlStrEqual(name, BAD_CAST "display") && xmlStrEqual(value, BAD_CAST "none")) - { - path_.display(false); - } -} - - -void svg_parser::parse_attr(xmlTextReaderPtr reader) -{ - const xmlChar *name, *value; - - if (xmlTextReaderMoveToFirstAttribute(reader) == 1) - { - do - { - name = xmlTextReaderConstName(reader); - value = xmlTextReaderConstValue(reader); - - if (xmlStrEqual(name, BAD_CAST "style")) - { - typedef std::vector > cont_type; - typedef cont_type::value_type value_type; - cont_type vec; - parse_style((const char*)value, vec); - BOOST_FOREACH(value_type kv , vec ) - { - parse_attr(BAD_CAST kv.first.c_str(),BAD_CAST kv.second.c_str()); - } - } - else - { - parse_attr(name,value); - } - } while(xmlTextReaderMoveToNextAttribute(reader) == 1); - } - xmlTextReaderMoveToElement(reader); -} -void svg_parser::parse_path(xmlTextReaderPtr reader) -{ - xmlChar *value; - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "d"); - if (value) - { - // d="" (empty paths) are valid - if (strlen((const char*)value) < 1) - { - xmlFree(value); - } - else - { - path_.begin_path(); - - if (!mapnik::svg::parse_path((const char*) value, path_)) - { - xmlFree(value); - xmlChar *id_value; - id_value = xmlTextReaderGetAttribute(reader, BAD_CAST "id"); - if (id_value) - { - std::string id_string((const char *) id_value); - xmlFree(id_value); - throw std::runtime_error(std::string("unable to parse invalid svg with id '") + id_string + "'"); - } - else - { - throw std::runtime_error("unable to parse invalid svg "); - } - } - path_.end_path(); - xmlFree(value); - } - } -} - -void svg_parser::parse_polygon(xmlTextReaderPtr reader) -{ - xmlChar *value; - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "points"); - if (value) - { - path_.begin_path(); - if (!mapnik::svg::parse_points((const char*) value, path_)) - { - xmlFree(value); - throw std::runtime_error("Failed to parse "); - } - path_.close_subpath(); - path_.end_path(); - xmlFree(value); - } -} - -void svg_parser::parse_polyline(xmlTextReaderPtr reader) -{ - xmlChar *value; - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "points"); - if (value) - { - path_.begin_path(); - if (!mapnik::svg::parse_points((const char*) value, path_)) - { - xmlFree(value); - throw std::runtime_error("Failed to parse "); - } - - path_.end_path(); - xmlFree(value); - } -} - -void svg_parser::parse_line(xmlTextReaderPtr reader) -{ - xmlChar *value; - double x1 = 0.0; - double y1 = 0.0; - double x2 = 0.0; - double y2 = 0.0; - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "x1"); - if (value) - { - x1 = parse_double((const char*)value); - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "y1"); - if (value) - { - y1 = parse_double((const char*)value); - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "x2"); - if (value) - { - x2 = parse_double((const char*)value); - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "y2"); - if (value) - { - y2 = parse_double((const char*)value); - xmlFree(value); - } - - path_.begin_path(); - path_.move_to(x1, y1); - path_.line_to(x2, y2); - path_.end_path(); - -} - -void svg_parser::parse_circle(xmlTextReaderPtr reader) -{ - xmlChar *value; - double cx = 0.0; - double cy = 0.0; - double r = 0.0; - value = xmlTextReaderGetAttribute(reader, BAD_CAST "cx"); - if (value) - { - cx = parse_double((const char*)value); - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "cy"); - if (value) - { - cy = parse_double((const char*)value); - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "r"); - if (value) - { - r = parse_double((const char*)value); - xmlFree(value); - } - - path_.begin_path(); - - if(r != 0.0) - { - if(r < 0.0) throw std::runtime_error("parse_circle: Invalid radius"); - agg::ellipse c(cx, cy, r, r); - path_.storage().concat_path(c); - } - - path_.end_path(); -} - -void svg_parser::parse_ellipse(xmlTextReaderPtr reader) -{ - xmlChar *value; - double cx = 0.0; - double cy = 0.0; - double rx = 0.0; - double ry = 0.0; - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "cx"); - if (value) - { - cx = parse_double((const char*)value); - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "cy"); - if (value) - { - cy = parse_double((const char*)value); - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "rx"); - if (value) - { - rx = parse_double((const char*)value); - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "ry"); - if (value) - { - ry = parse_double((const char*)value); - xmlFree(value); - } - - path_.begin_path(); - - if(rx != 0.0 && ry != 0.0) - { - if(rx < 0.0) throw std::runtime_error("parse_ellipse: Invalid rx"); - if(ry < 0.0) throw std::runtime_error("parse_ellipse: Invalid ry"); - agg::ellipse c(cx, cy, rx, ry); - path_.storage().concat_path(c); - } - - path_.end_path(); - -} - -void svg_parser::parse_rect(xmlTextReaderPtr reader) -{ - xmlChar *value; - double x = 0.0; - double y = 0.0; - double w = 0.0; - double h = 0.0; - double rx = 0.0; - double ry = 0.0; - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "x"); - if (value) - { - x = parse_double((const char*)value); - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "y"); - if (value) - { - y = parse_double((const char*)value); - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "width"); - if (value) - { - w = parse_double((const char*)value); - xmlFree(value); - } - value = xmlTextReaderGetAttribute(reader, BAD_CAST "height"); - if (value) - { - h = parse_double((const char*)value); - xmlFree(value); - } - - bool rounded = true; - value = xmlTextReaderGetAttribute(reader, BAD_CAST "rx"); - if (value) - { - rx = parse_double((const char*)value); - xmlFree(value); - } - else rounded = false; - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "ry"); - if (value) - { - ry = parse_double((const char*)value); - if (!rounded) - { - rx = ry; - rounded = true; - } - xmlFree(value); - } - else if (rounded) - { - ry = rx; - } - - if(w != 0.0 && h != 0.0) - { - if(w < 0.0) throw std::runtime_error("parse_rect: Invalid width"); - if(h < 0.0) throw std::runtime_error("parse_rect: Invalid height"); - if(rx < 0.0) throw std::runtime_error("parse_rect: Invalid rx"); - if(ry < 0.0) throw std::runtime_error("parse_rect: Invalid ry"); - path_.begin_path(); - - if(rounded) - { - agg::rounded_rect r; - r.rect(x,y,x+w,y+h); - r.radius(rx,ry); - path_.storage().concat_path(r); - } - else - { - path_.move_to(x, y); - path_.line_to(x + w, y); - path_.line_to(x + w, y + h); - path_.line_to(x, y + h); - path_.close_subpath(); - } - path_.end_path(); - } -} - - -/* - * -*/ -void svg_parser::parse_gradient_stop(xmlTextReaderPtr reader) -{ - xmlChar *value; - - double offset = 0.0; - mapnik::color stop_color; - double opacity = 1.0; - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "offset"); - if (value) - { - offset = parse_double((const char*)value); - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "style"); - if (value) - { - typedef std::vector > cont_type; - typedef cont_type::value_type value_type; - cont_type vec; - parse_style((const char*)value, vec); - - BOOST_FOREACH(value_type kv , vec ) - { - if (kv.first == "stop-color") - { - try - { - mapnik::color_factory::init_from_string(stop_color,kv.second.c_str()); - } - catch (mapnik::config_error & ex) - { - MAPNIK_LOG_ERROR(svg_parser) << ex.what(); - } - } - else if (kv.first == "stop-opacity") - { - opacity = parse_double(kv.second.c_str()); - } - } - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "stop-color"); - if (value) - { - try - { - mapnik::color_factory::init_from_string(stop_color,(const char *) value); - } - catch (mapnik::config_error & ex) - { - MAPNIK_LOG_ERROR(svg_parser) << ex.what(); - } - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "stop-opacity"); - if (value) - { - opacity = parse_double((const char *) value); - xmlFree(value); - } - - - stop_color.set_alpha(opacity*255); - - temporary_gradient_.second.add_stop(offset, stop_color); - - /* - MAPNIK_LOG_DEBUG(svg_parser) << "\tFound Stop: " << offset << " " - << (unsigned)stop_color.red() << " " - << (unsigned)stop_color.green() << " " - << (unsigned)stop_color.blue() << " " - << (unsigned)stop_color.alpha(); - */ -} - -bool svg_parser::parse_common_gradient(xmlTextReaderPtr reader) -{ - xmlChar *value; - - std::string id; - value = xmlTextReaderGetAttribute(reader, BAD_CAST "id"); - if (value) - { - // start a new gradient - gradient new_grad; - id = std::string((const char *) value); - temporary_gradient_ = std::make_pair(id, new_grad); - xmlFree(value); - } - else - { - // no point without an ID - return false; - } - - // check if we should inherit from another tag - value = xmlTextReaderGetAttribute(reader, BAD_CAST "xlink:href"); - if (value) - { - if (value[0] == '#') - { - std::string linkid = (const char *) &value[1]; - if (gradient_map_.count(linkid)) - { - temporary_gradient_.second = gradient_map_[linkid]; - } - else - { - MAPNIK_LOG_ERROR(svg_parser) << "Failed to find linked gradient " << linkid; - } - } - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "gradientUnits"); - if (value) - { - if (xmlStrEqual(value, BAD_CAST "userSpaceOnUse")) - { - temporary_gradient_.second.set_units(USER_SPACE_ON_USE); - } - else - { - temporary_gradient_.second.set_units(OBJECT_BOUNDING_BOX); - } - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "gradientTransform"); - if (value) - { - agg::trans_affine tr; - mapnik::svg::parse_transform((const char*) value,tr); - temporary_gradient_.second.set_transform(tr); - xmlFree(value); - } - - return true; -} - -/** - * -*/ -void svg_parser::parse_radial_gradient(xmlTextReaderPtr reader) -{ - if (!parse_common_gradient(reader)) - return; - - xmlChar *value; - double cx = 0.5; - double cy = 0.5; - double fx = 0.0; - double fy = 0.0; - double r = 0.5; - bool has_percent=true; - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "cx"); - if (value) - { - cx = parse_double_optional_percent((const char*)value, has_percent); - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "cy"); - if (value) - { - cy = parse_double_optional_percent((const char*)value, has_percent); - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "fx"); - if (value) - { - fx = parse_double_optional_percent((const char*)value, has_percent); - xmlFree(value); - } - else - fx = cx; - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "fy"); - if (value) - { - fy = parse_double_optional_percent((const char*)value, has_percent); - xmlFree(value); - } - else - fy = cy; - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "r"); - if (value) - { - r = parse_double_optional_percent((const char*)value, has_percent); - xmlFree(value); - } - // this logic for detecting %'s will not support mixed coordinates. - if (has_percent && temporary_gradient_.second.get_units() == USER_SPACE_ON_USE) - { - temporary_gradient_.second.set_units(USER_SPACE_ON_USE_BOUNDING_BOX); - } - - temporary_gradient_.second.set_gradient_type(RADIAL); - temporary_gradient_.second.set_control_points(fx,fy,cx,cy,r); - // add this here in case we have no end tag, will be replaced if we do - gradient_map_[temporary_gradient_.first] = temporary_gradient_.second; - - //MAPNIK_LOG_DEBUG(svg_parser) << "Found Radial Gradient: " << " " << cx << " " << cy << " " << fx << " " << fy << " " << r; -} - -void svg_parser::parse_linear_gradient(xmlTextReaderPtr reader) -{ - if (!parse_common_gradient(reader)) - return; - - xmlChar *value; - double x1 = 0.0; - double x2 = 1.0; - double y1 = 0.0; - double y2 = 1.0; - - bool has_percent=true; - value = xmlTextReaderGetAttribute(reader, BAD_CAST "x1"); - if (value) - { - x1 = parse_double_optional_percent((const char*)value, has_percent); - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "x2"); - if (value) - { - x2 = parse_double_optional_percent((const char*)value, has_percent); - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "y1"); - if (value) - { - y1 = parse_double_optional_percent((const char*)value, has_percent); - xmlFree(value); - } - - value = xmlTextReaderGetAttribute(reader, BAD_CAST "y2"); - if (value) - { - y2 = parse_double_optional_percent((const char*)value, has_percent); - xmlFree(value); - } - // this logic for detecting %'s will not support mixed coordinates. - if (has_percent && temporary_gradient_.second.get_units() == USER_SPACE_ON_USE) - { - temporary_gradient_.second.set_units(USER_SPACE_ON_USE_BOUNDING_BOX); - } - - temporary_gradient_.second.set_gradient_type(LINEAR); - temporary_gradient_.second.set_control_points(x1,y1,x2,y2); - // add this here in case we have no end tag, will be replaced if we do - gradient_map_[temporary_gradient_.first] = temporary_gradient_.second; - - //MAPNIK_LOG_DEBUG(svg_parser) << "Found Linear Gradient: " << "(" << x1 << " " << y1 << "),(" << x2 << " " << y2 << ")"; -} - -void svg_parser::parse_pattern(xmlTextReaderPtr reader) -{ - //const xmlChar *value; -} - -}} diff -Nru mapnik-2.1.0/src/svg_path_parser.cpp mapnik-2.2.0/src/svg_path_parser.cpp --- mapnik-2.1.0/src/svg_path_parser.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg_path_parser.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include -#include -#include -#include -#include -// agg -#include "agg_path_storage.h" - -// stl -#include - -namespace mapnik { namespace svg { - - template - bool parse_path(const char* wkt, PathType & p) - { - using namespace boost::spirit; - typedef const char* iterator_type; - typedef ascii::space_type skip_type; - svg_path_grammar g(p); - iterator_type first = wkt; - iterator_type last = wkt + std::strlen(wkt); - return qi::phrase_parse(first, last, g, skip_type()); - } - - template bool parse_path(const char*, svg_converter_type&); - - }} diff -Nru mapnik-2.1.0/src/svg_points_parser.cpp mapnik-2.2.0/src/svg_points_parser.cpp --- mapnik-2.1.0/src/svg_points_parser.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg_points_parser.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include -#include -#include -// stl -#include - -namespace mapnik { namespace svg { - - template - bool parse_points(const char* wkt, PathType & p) - { - using namespace boost::spirit; - typedef const char* iterator_type; - typedef ascii::space_type skip_type; - svg_points_grammar g(p); - iterator_type first = wkt; - iterator_type last = wkt + std::strlen(wkt); - return qi::phrase_parse(first, last, g, skip_type()); - } - - template bool parse_points(const char*, svg_converter_type&); - - }} diff -Nru mapnik-2.1.0/src/svg_transform_parser.cpp mapnik-2.2.0/src/svg_transform_parser.cpp --- mapnik-2.1.0/src/svg_transform_parser.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/svg_transform_parser.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2011 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include -#include -// agg -#include "agg_trans_affine.h" -// stl -#include - -namespace mapnik { namespace svg { - - template - bool parse_transform(const char * wkt, TransformType & p) - { - using namespace boost::spirit; - typedef const char * iterator_type; - typedef ascii::space_type skip_type; - svg_transform_grammar g(p); - iterator_type first = wkt; - iterator_type last = wkt + std::strlen(wkt); - return qi::phrase_parse(first, last, g, skip_type()); - } - -/* - template - bool parse_transform(std::string const& wkt, TransformType & p) - { - using namespace boost::spirit; - typedef std::string::const_iterator iterator_type; - typedef ascii::space_type skip_type; - svg_transform_grammar g(p); - iterator_type first = wkt.begin(); - iterator_type last = wkt.end(); - return qi::phrase_parse(first, last, g, skip_type()); - } -*/ - - template MAPNIK_DECL bool parse_transform(const char*, agg::trans_affine&); -//template bool parse_transform(std::string const& , agg::trans_affine&); - - }} diff -Nru mapnik-2.1.0/src/symbolizer.cpp mapnik-2.2.0/src/symbolizer.cpp --- mapnik-2.1.0/src/symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,23 +22,21 @@ //mapnik #include -#include +#include +#include #include namespace mapnik { -void evaluate_transform(agg::trans_affine& tr, Feature const& feature, +void evaluate_transform(agg::trans_affine& tr, feature_impl const& feature, transform_list_ptr const& trans_expr) { - #ifdef MAPNIK_LOG - MAPNIK_LOG_DEBUG(transform) << "transform: evaluate " - << (trans_expr - ? transform_processor_type::to_string(*trans_expr) - : std::string("null")); - #endif - if (trans_expr) { +#ifdef MAPNIK_LOG + MAPNIK_LOG_DEBUG(transform) << "transform: evaluate " + << transform_processor_type::to_string(*trans_expr); +#endif transform_processor_type::evaluate(tr, feature, *trans_expr); } } @@ -47,6 +45,8 @@ symbolizer_base::symbolizer_base() : comp_op_(src_over), clip_(true), + simplify_algorithm_value_(radial_distance), + simplify_tolerance_value_(0.0), smooth_value_(0.0) { } @@ -56,6 +56,8 @@ : comp_op_(other.comp_op_), affine_transform_(other.affine_transform_), clip_(other.clip_), + simplify_algorithm_value_(other.simplify_algorithm_value_), + simplify_tolerance_value_(other.simplify_tolerance_value_), smooth_value_(other.smooth_value_) {} void symbolizer_base::set_comp_op(composite_mode_e comp_op) @@ -88,9 +90,13 @@ std::string symbolizer_base::get_transform_string() const { if (affine_transform_) + { return transform_processor_type::to_string(*affine_transform_); + } else + { return std::string(); + } } void symbolizer_base::set_clip(bool clip) @@ -103,6 +109,26 @@ return clip_; } +void symbolizer_base::set_simplify_algorithm(simplify_algorithm_e algo) +{ + simplify_algorithm_value_ = algo; +} + +simplify_algorithm_e symbolizer_base::simplify_algorithm() const +{ + return simplify_algorithm_value_; +} + +void symbolizer_base::set_simplify_tolerance(double simplify_tolerance) +{ + simplify_tolerance_value_ = simplify_tolerance; +} + +double symbolizer_base::simplify_tolerance() const +{ + return simplify_tolerance_value_; +} + void symbolizer_base::set_smooth(double smooth) { smooth_value_ = smooth; @@ -168,9 +194,13 @@ std::string symbolizer_with_image::get_image_transform_string() const { if (image_transform_) + { return transform_processor_type::to_string(*image_transform_); + } else + { return std::string(); + } } } // end of namespace mapnik diff -Nru mapnik-2.1.0/src/symbolizer_helpers.cpp mapnik-2.2.0/src/symbolizer_helpers.cpp --- mapnik-2.1.0/src/symbolizer_helpers.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/symbolizer_helpers.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -21,10 +21,18 @@ *****************************************************************************/ // mapnik +#include +#include +#include +#include +#include #include #include #include #include +#include +#include +#include // agg #include "agg_conv_clip_polyline.h" @@ -279,7 +287,7 @@ if (placement_->properties.orientation) { // https://github.com/mapnik/mapnik/issues/1352 - mapnik::evaluate evaluator(feature_); + mapnik::evaluate evaluator(feature_); angle_ = boost::apply_visitor( evaluator, *(placement_->properties.orientation)).to_double(); @@ -401,7 +409,7 @@ marker_.reset(); if (!filename.empty()) { - marker_ = marker_cache::instance()->find(filename, true); + marker_ = marker_cache::instance().find(filename, true); } if (!marker_) { marker_w_ = 0; diff -Nru mapnik-2.1.0/src/text_placements/list.cpp mapnik-2.2.0/src/text_placements/list.cpp --- mapnik-2.1.0/src/text_placements/list.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/text_placements/list.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -26,6 +26,7 @@ //boost #include +#include namespace mapnik diff -Nru mapnik-2.1.0/src/text_placements/simple.cpp mapnik-2.2.0/src/text_placements/simple.cpp --- mapnik-2.1.0/src/text_placements/simple.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/text_placements/simple.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -31,6 +31,7 @@ #include #include #include +#include namespace mapnik { diff -Nru mapnik-2.1.0/src/text_properties.cpp mapnik-2.2.0/src/text_properties.cpp --- mapnik-2.1.0/src/text_properties.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/text_properties.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -20,6 +20,8 @@ * *****************************************************************************/ // mapnik +#include +#include #include #include #include @@ -30,6 +32,7 @@ // boost #include +#include namespace mapnik { @@ -60,7 +63,7 @@ } -void text_symbolizer_properties::process(processed_text &output, Feature const& feature) const +void text_symbolizer_properties::process(processed_text &output, feature_impl const& feature) const { output.clear(); if (tree_) { @@ -86,24 +89,24 @@ if (placement_) label_placement = *placement_; optional valign_ = sym.get_opt_attr("vertical-alignment"); if (valign_) valign = *valign_; - optional text_ratio_ = sym.get_opt_attr("text-ratio"); + optional text_ratio_ = sym.get_opt_attr("text-ratio"); if (text_ratio_) text_ratio = *text_ratio_; - optional wrap_width_ = sym.get_opt_attr("wrap-width"); + optional wrap_width_ = sym.get_opt_attr("wrap-width"); if (wrap_width_) wrap_width = *wrap_width_; optional label_position_tolerance_ = sym.get_opt_attr("label-position-tolerance"); if (label_position_tolerance_) label_position_tolerance = *label_position_tolerance_; - optional spacing_ = sym.get_opt_attr("spacing"); + optional spacing_ = sym.get_opt_attr("spacing"); if (spacing_) label_spacing = *spacing_; else { // https://github.com/mapnik/mapnik/issues/1427 - spacing_ = sym.get_opt_attr("label-spacing"); + spacing_ = sym.get_opt_attr("label-spacing"); if (spacing_) label_spacing = *spacing_; } - optional minimum_distance_ = sym.get_opt_attr("minimum-distance"); + optional minimum_distance_ = sym.get_opt_attr("minimum-distance"); if (minimum_distance_) minimum_distance = *minimum_distance_; - optional min_padding_ = sym.get_opt_attr("minimum-padding"); + optional min_padding_ = sym.get_opt_attr("minimum-padding"); if (min_padding_) minimum_padding = *min_padding_; - optional min_path_length_ = sym.get_opt_attr("minimum-path-length"); + optional min_path_length_ = sym.get_opt_attr("minimum-path-length"); if (min_path_length_) minimum_path_length = *min_path_length_; optional avoid_edges_ = sym.get_opt_attr("avoid-edges"); if (avoid_edges_) avoid_edges = *avoid_edges_; @@ -256,7 +259,7 @@ void char_properties::from_xml(xml_node const& sym, fontset_map const& fontsets) { - optional text_size_ = sym.get_opt_attr("size"); + optional text_size_ = sym.get_opt_attr("size"); if (text_size_) text_size = *text_size_; optional character_spacing_ = sym.get_opt_attr("character-spacing"); if (character_spacing_) character_spacing = *character_spacing_; @@ -293,11 +296,11 @@ throw config_error("Unable to find any fontset named '" + *fontset_name_ + "'", sym); } } - if (!face_name.empty() && !fontset.get_name().empty()) + if (!face_name.empty() && fontset) { throw config_error("Can't have both face-name and fontset-name", sym); } - if (face_name.empty() && fontset.get_name().empty()) + if (face_name.empty() && !fontset) { throw config_error("Must have face-name or fontset-name", sym); } @@ -305,11 +308,9 @@ void char_properties::to_xml(boost::property_tree::ptree &node, bool explicit_defaults, char_properties const &dfl) const { - std::string const& fontset_name = fontset.get_name(); - std::string const& dfl_fontset_name = dfl.fontset.get_name(); - if (fontset_name != dfl_fontset_name || explicit_defaults) + if (fontset) { - set_attr(node, "fontset-name", fontset_name); + set_attr(node, "fontset-name", fontset->get_name()); } if (face_name != dfl.face_name || explicit_defaults) diff -Nru mapnik-2.1.0/src/text_symbolizer.cpp mapnik-2.2.0/src/text_symbolizer.cpp --- mapnik-2.1.0/src/text_symbolizer.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/text_symbolizer.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -34,6 +34,15 @@ namespace mapnik { +static const char * halo_rasterizer_strings[] = { + "full", + "fast", + "" +}; + +IMPLEMENT_ENUM( halo_rasterizer_e, halo_rasterizer_strings ) + + static const char * label_placement_strings[] = { "point", "line", @@ -92,7 +101,8 @@ text_symbolizer::text_symbolizer(text_placements_ptr placements) : symbolizer_base(), - placement_options_(placements) + placement_options_(placements), + halo_rasterizer_(HALO_RASTERIZER_FULL) { } @@ -101,7 +111,8 @@ float size, color const& fill, text_placements_ptr placements) : symbolizer_base(), - placement_options_(placements) + placement_options_(placements), + halo_rasterizer_(HALO_RASTERIZER_FULL) { set_name(name); set_face_name(face_name); @@ -112,7 +123,8 @@ text_symbolizer::text_symbolizer(expression_ptr name, float size, color const& fill, text_placements_ptr placements) : symbolizer_base(), - placement_options_(placements) + placement_options_(placements), + halo_rasterizer_(HALO_RASTERIZER_FULL) { set_name(name); set_text_size(size); @@ -121,7 +133,9 @@ text_symbolizer::text_symbolizer(text_symbolizer const& rhs) : symbolizer_base(rhs), - placement_options_(rhs.placement_options_) /*TODO: Copy options! */ + placement_options_(rhs.placement_options_), + halo_rasterizer_(rhs.halo_rasterizer_) + /*TODO: Copy options! */ { } @@ -130,9 +144,7 @@ if (this == &other) return *this; placement_options_ = other.placement_options_; /*TODO: Copy options? */ - - MAPNIK_LOG_DEBUG(text_symbolizer) << "text_symbolizer: TODO - Metawriter (text_symbolizer::operator=)"; - + halo_rasterizer_ = other.halo_rasterizer_; return *this; } @@ -173,27 +185,27 @@ placement_options_->defaults.format.fontset = fontset; } -font_set const& text_symbolizer::get_fontset() const +boost::optional const& text_symbolizer::get_fontset() const { return placement_options_->defaults.format.fontset; } -unsigned text_symbolizer::get_text_ratio() const +double text_symbolizer::get_text_ratio() const { return placement_options_->defaults.text_ratio; } -void text_symbolizer::set_text_ratio(unsigned ratio) +void text_symbolizer::set_text_ratio(double ratio) { placement_options_->defaults.text_ratio = ratio; } -unsigned text_symbolizer::get_wrap_width() const +double text_symbolizer::get_wrap_width() const { return placement_options_->defaults.wrap_width; } -void text_symbolizer::set_wrap_width(unsigned width) +void text_symbolizer::set_wrap_width(double width) { placement_options_->defaults.wrap_width = width; } @@ -238,32 +250,32 @@ placement_options_->defaults.format.text_transform = convert; } -unsigned text_symbolizer::get_line_spacing() const +double text_symbolizer::get_line_spacing() const { return placement_options_->defaults.format.line_spacing; } -void text_symbolizer::set_line_spacing(unsigned spacing) +void text_symbolizer::set_line_spacing(double spacing) { placement_options_->defaults.format.line_spacing = spacing; } -unsigned text_symbolizer::get_character_spacing() const +double text_symbolizer::get_character_spacing() const { return placement_options_->defaults.format.character_spacing; } -void text_symbolizer::set_character_spacing(unsigned spacing) +void text_symbolizer::set_character_spacing(double spacing) { placement_options_->defaults.format.character_spacing = spacing; } -unsigned text_symbolizer::get_label_spacing() const +double text_symbolizer::get_label_spacing() const { return placement_options_->defaults.label_spacing; } -void text_symbolizer::set_label_spacing(unsigned spacing) +void text_symbolizer::set_label_spacing(double spacing) { placement_options_->defaults.label_spacing = spacing; } @@ -298,12 +310,12 @@ placement_options_->defaults.max_char_angle_delta = angle; } -void text_symbolizer::set_text_size(float size) +void text_symbolizer::set_text_size(double size) { placement_options_->defaults.format.text_size = size; } -float text_symbolizer::get_text_size() const +double text_symbolizer::get_text_size() const { return placement_options_->defaults.format.text_size; } @@ -338,6 +350,16 @@ return placement_options_->defaults.format.halo_radius; } +void text_symbolizer::set_halo_rasterizer(halo_rasterizer_e rasterizer_p) +{ + halo_rasterizer_ = rasterizer_p; +} + +halo_rasterizer_e text_symbolizer::get_halo_rasterizer() const +{ + return halo_rasterizer_; +} + void text_symbolizer::set_label_placement(label_placement_e label_p) { placement_options_->defaults.label_placement = label_p; diff -Nru mapnik-2.1.0/src/tiff_reader.cpp mapnik-2.2.0/src/tiff_reader.cpp --- mapnik-2.1.0/src/tiff_reader.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/tiff_reader.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -23,10 +23,14 @@ // mapnik #include #include -#include -// stl -#include +// boost +#include + +// iostreams +#include +#include +#include extern "C" { @@ -36,29 +40,109 @@ namespace mapnik { -using std::min; -using std::max; +namespace impl { + +static toff_t tiff_seek_proc(thandle_t fd, toff_t off, int whence) +{ + std::istream* in = reinterpret_cast(fd); + + switch(whence) + { + case SEEK_SET: + in->seekg(off, std::ios_base::beg); + break; + case SEEK_CUR: + in->seekg(off, std::ios_base::cur); + break; + case SEEK_END: + in->seekg(off, std::ios_base::end); + break; + } + return static_cast(in->tellg()); +} + +static int tiff_close_proc(thandle_t fd) +{ + return 0; +} + +static toff_t tiff_size_proc(thandle_t fd) +{ + std::istream* in = reinterpret_cast(fd); + std::ios::pos_type pos = in->tellg(); + in->seekg(0, std::ios::end); + std::ios::pos_type len = in->tellg(); + in->seekg(pos); + return static_cast(len); +} + +static tsize_t tiff_read_proc(thandle_t fd, tdata_t buf, tsize_t size) +{ + std::istream * in = reinterpret_cast(fd); + std::streamsize request_size = size; + if (static_cast(request_size) != size) + return static_cast(-1); + in->read(reinterpret_cast(buf), request_size); + return static_cast(in->gcount()); +} + +static tsize_t tiff_write_proc(thandle_t fd, tdata_t buf, tsize_t size) +{ + return 0; +} + +static void tiff_unmap_proc(thandle_t fd, tdata_t base, toff_t size) +{ +} +static int tiff_map_proc(thandle_t fd, tdata_t* pbase, toff_t* psize) +{ + return 0; +} + +} + +template class tiff_reader : public image_reader { + typedef boost::shared_ptr tiff_ptr; + typedef T source_type; + typedef boost::iostreams::stream input_stream; + + struct tiff_closer + { + void operator() (TIFF * tif) + { + if (tif != 0) + { + TIFFClose(tif); + } + } + }; + private: - std::string file_name_; + source_type source_; + input_stream stream_; int read_method_; - unsigned width_; - unsigned height_; + std::size_t width_; + std::size_t height_; int rows_per_strip_; int tile_width_; int tile_height_; + tiff_ptr tif_; + bool premultiplied_alpha_; public: enum TiffType { generic=1, stripped, tiled }; - explicit tiff_reader(const std::string& file_name); + explicit tiff_reader(std::string const& file_name); + tiff_reader(char const* data, std::size_t size); virtual ~tiff_reader(); unsigned width() const; unsigned height() const; + bool premultiplied_alpha() const; void read(unsigned x,unsigned y,image_data_32& image); private: tiff_reader(const tiff_reader&); @@ -67,38 +151,83 @@ void read_generic(unsigned x,unsigned y,image_data_32& image); void read_stripped(unsigned x,unsigned y,image_data_32& image); void read_tiled(unsigned x,unsigned y,image_data_32& image); - TIFF* load_if_exists(const std::string& filename); + TIFF* open(std::istream & input); + static void on_error(const char* /*module*/, const char* fmt, va_list argptr); }; namespace { -image_reader* create_tiff_reader(const std::string& file) + +image_reader* create_tiff_reader(std::string const& file) +{ + return new tiff_reader(file); +} + +image_reader* create_tiff_reader2(char const * data, std::size_t size) { - return new tiff_reader(file); + return new tiff_reader(data, size); } const bool registered = register_image_reader("tiff",create_tiff_reader); +const bool registered2 = register_image_reader("tiff", create_tiff_reader2); + } -tiff_reader::tiff_reader(const std::string& file_name) - : file_name_(file_name), +template +tiff_reader::tiff_reader(std::string const& file_name) + : source_(file_name, std::ios_base::in | std::ios_base::binary), + stream_(source_), read_method_(generic), width_(0), height_(0), rows_per_strip_(0), tile_width_(0), - tile_height_(0) + tile_height_(0), + premultiplied_alpha_(false) { + if (!stream_) throw image_reader_exception("TIFF reader: cannot open file "+ file_name); init(); } +template +tiff_reader::tiff_reader(char const* data, std::size_t size) + : source_(data, size), + stream_(source_), + read_method_(generic), + width_(0), + height_(0), + rows_per_strip_(0), + tile_width_(0), + tile_height_(0), + premultiplied_alpha_(false) +{ + if (!stream_) throw image_reader_exception("TIFF reader: cannot open image stream "); + stream_.seekg(0, std::ios::beg); + init(); +} + +template +void tiff_reader::on_error(const char* /*module*/, const char* fmt, va_list argptr) +{ + char msg[10240]; + vsprintf(msg, fmt, argptr); + throw image_reader_exception(msg); +} -void tiff_reader::init() +template +void tiff_reader::init() { - // TODO: error handling TIFFSetWarningHandler(0); - TIFF* tif = load_if_exists(file_name_); - if (!tif) throw image_reader_exception( std::string("Can't load tiff file: '") + file_name_ + "'"); + // Note - we intentially set the error handling to null + // when opening the image for the first time to avoid + // leaking in TiffOpen: https://github.com/mapnik/mapnik/issues/1783 + TIFFSetErrorHandler(0); + + TIFF* tif = open(stream_); + + if (!tif) throw image_reader_exception("Can't open tiff file"); + + TIFFSetErrorHandler(on_error); char msg[1024]; @@ -116,35 +245,48 @@ { read_method_=stripped; } - TIFFClose(tif); + //TIFFTAG_EXTRASAMPLES + uint16 extrasamples; + uint16* sampleinfo; + TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES, + &extrasamples, &sampleinfo); + if (extrasamples == 1 && + sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA) + { + premultiplied_alpha_ = true; + } } else { - TIFFClose(tif); throw image_reader_exception(msg); } } - -tiff_reader::~tiff_reader() +template +tiff_reader::~tiff_reader() { - // } - -unsigned tiff_reader::width() const +template +unsigned tiff_reader::width() const { return width_; } - -unsigned tiff_reader::height() const +template +unsigned tiff_reader::height() const { return height_; } +template +bool tiff_reader::premultiplied_alpha() const +{ + return premultiplied_alpha_; +} -void tiff_reader::read(unsigned x,unsigned y,image_data_32& image) +template +void tiff_reader::read(unsigned x,unsigned y,image_data_32& image) { if (read_method_==stripped) { @@ -160,22 +302,20 @@ } } - -void tiff_reader::read_generic(unsigned /*x*/,unsigned /*y*/,image_data_32& /*image*/) +template +void tiff_reader::read_generic(unsigned /*x*/,unsigned /*y*/,image_data_32& /*image*/) { - TIFF* tif = load_if_exists(file_name_); + TIFF* tif = open(stream_); if (tif) { MAPNIK_LOG_DEBUG(tiff_reader) << "tiff_reader: TODO - tiff is not stripped or tiled"; - - TIFFClose(tif); } } - -void tiff_reader::read_tiled(unsigned x0,unsigned y0,image_data_32& image) +template +void tiff_reader::read_tiled(unsigned x0,unsigned y0,image_data_32& image) { - TIFF* tif = load_if_exists(file_name_); + TIFF* tif = open(stream_); if (tif) { uint32* buf = (uint32*)_TIFFmalloc(tile_width_*tile_height_*sizeof(uint32)); @@ -191,8 +331,8 @@ for (int y=start_y;y=n0;--n) { @@ -213,14 +353,13 @@ } } _TIFFfree(buf); - TIFFClose(tif); } } - -void tiff_reader::read_stripped(unsigned x0,unsigned y0,image_data_32& image) +template +void tiff_reader::read_stripped(unsigned x0,unsigned y0,image_data_32& image) { - TIFF* tif = load_if_exists(file_name_); + TIFF* tif = open(stream_); if (tif) { uint32* buf = (uint32*)_TIFFmalloc(width_*rows_per_strip_*sizeof(uint32)); @@ -234,12 +373,12 @@ int row,tx0,tx1,ty0,ty1; tx0=x0; - tx1=min(width+x0,(unsigned)width_); + tx1=std::min(width+x0,(unsigned)width_); for (unsigned y=start_y; y < end_y; y+=rows_per_strip_) { - ty0 = max(y0,y)-y; - ty1 = min(height+y0,y+rows_per_strip_)-y; + ty0 = std::max(y0,y)-y; + ty1 = std::min(height+y0,y+rows_per_strip_)-y; if (!TIFFReadRGBAStrip(tif,y,buf)) break; @@ -254,21 +393,25 @@ } } _TIFFfree(buf); - TIFFClose(tif); } } -TIFF* tiff_reader::load_if_exists(std::string const& filename) +template +TIFF* tiff_reader::open(std::istream & input) { - TIFF * tif = 0; - boost::filesystem::path path(file_name_); - if (exists(path)) // && is_regular(path)) { -- not supported in boost-1.33.* + if (!tif_) { - // File path is a full file path and does exist - tif = TIFFOpen(filename.c_str(), "rb"); + tif_ = tiff_ptr(TIFFClientOpen("tiff_input_stream", "rm", + reinterpret_cast(&input), + impl::tiff_read_proc, + impl::tiff_write_proc, + impl::tiff_seek_proc, + impl::tiff_close_proc, + impl::tiff_size_proc, + impl::tiff_map_proc, + impl::tiff_unmap_proc), tiff_closer()); } - - return tif; -} + return tif_.get(); } +} // namespace mapnik diff -Nru mapnik-2.1.0/src/transform_expression_grammar.cpp mapnik-2.2.0/src/transform_expression_grammar.cpp --- mapnik-2.1.0/src/transform_expression_grammar.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/transform_expression_grammar.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -25,9 +25,10 @@ // boost #include +#include +#include +#include -// spirit -#include namespace mapnik { diff -Nru mapnik-2.1.0/src/utils.cpp mapnik-2.2.0/src/utils.cpp --- mapnik-2.1.0/src/utils.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/utils.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,61 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifdef _WINDOWS +// windows specific methods for UTF8 from/to UTF16 +#include +#include +#include + +#include + +namespace mapnik { + +std::string utf16_to_utf8(std::wstring const& wstr) +{ + std::string str; + int size = WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), -1, 0, 0, 0, 0); + if(size > 0) + { + std::vector buffer(size); + WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), -1, &buffer[0], size, 0, 0); + str.assign(buffer.begin(), buffer.end() - 1); + } + return str; +} + +std::wstring utf8_to_utf16 (std::string const& str) +{ + std::wstring wstr; + int size = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, 0, 0); + if (size > 0) + { + std::vector buffer(size); + MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, &buffer[0], size); + wstr.assign(buffer.begin(), buffer.end() - 1); + } + return wstr; +} + +} // namespace mapnik + +#endif // _WINDOWS diff -Nru mapnik-2.1.0/src/warp.cpp mapnik-2.2.0/src/warp.cpp --- mapnik-2.1.0/src/warp.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/warp.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -27,7 +27,8 @@ #include #include #include -#include +#include +#include // agg #include "agg_image_filters.h" @@ -47,28 +48,30 @@ namespace mapnik { void reproject_and_scale_raster(raster & target, raster const& source, - proj_transform const& prj_trans, - double offset_x, double offset_y, - unsigned mesh_size, - double filter_radius, - scaling_method_e scaling_method) + proj_transform const& prj_trans, + double offset_x, double offset_y, + unsigned mesh_size, + double filter_radius, + scaling_method_e scaling_method) { CoordTransform ts(source.data_.width(), source.data_.height(), source.ext_); CoordTransform tt(target.data_.width(), target.data_.height(), target.ext_, offset_x, offset_y); unsigned i, j; - unsigned mesh_nx = ceil(source.data_.width()/double(mesh_size)+1); - unsigned mesh_ny = ceil(source.data_.height()/double(mesh_size)+1); + unsigned mesh_nx = std::ceil(source.data_.width()/double(mesh_size) + 1); + unsigned mesh_ny = std::ceil(source.data_.height()/double(mesh_size) + 1); ImageData xs(mesh_nx, mesh_ny); ImageData ys(mesh_nx, mesh_ny); // Precalculate reprojected mesh - for(j=0; j span_gen_type; span_gen_type sg(ia, interpolator, filter); agg::render_scanlines_aa(rasterizer, scanline, rb_pre, diff -Nru mapnik-2.1.0/src/well_known_srs.cpp mapnik-2.2.0/src/well_known_srs.cpp --- mapnik-2.1.0/src/well_known_srs.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/src/well_known_srs.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,83 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// mapnik +#include +#include +#include + +// boost +#include + +namespace mapnik { + +static const char * well_known_srs_strings[] = { + "mapnik-longlat", + "mapnik-gmerc", + "" +}; + +boost::optional is_well_known_srs(std::string const& srs) +{ + if (srs == "+init=epsg:4326" || srs == MAPNIK_LONGLAT_PROJ) + { + return boost::optional(mapnik::WGS_84); + } + else if (srs == "+init=epsg:3857" || srs == MAPNIK_GMERC_PROJ) + { + return boost::optional(mapnik::G_MERC); + } + return boost::optional(); +} + +boost::optional is_known_geographic(std::string const& srs) +{ + std::string trimmed = util::trim_copy(srs); + if (trimmed == "+init=epsg:3857") + { + return boost::optional(false); + } + else if (trimmed == "+init=epsg:4326") + { + return boost::optional(true); + } + else if (srs.find("+proj=") != std::string::npos) + { + if ((srs.find("+proj=longlat") != std::string::npos) || + (srs.find("+proj=latlong") != std::string::npos) || + (srs.find("+proj=lonlat") != std::string::npos) || + (srs.find("+proj=latlon") != std::string::npos) + ) + { + return boost::optional(true); + } + else + { + return boost::optional(false); + } + } + return boost::optional(); +} + +IMPLEMENT_ENUM( well_known_srs_e, well_known_srs_strings ) + +} diff -Nru mapnik-2.1.0/src/wkb.cpp mapnik-2.2.0/src/wkb.cpp --- mapnik-2.1.0/src/wkb.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/wkb.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -27,9 +27,9 @@ #include #include #include +#include // boost -#include #include namespace mapnik @@ -37,7 +37,7 @@ typedef coord_array CoordinateArray; -struct wkb_reader : boost::noncopyable +struct wkb_reader : mapnik::noncopyable { private: enum wkbByteOrder { @@ -82,7 +82,8 @@ { if (size_ >= 44 && (unsigned char)(wkb_[0]) == (unsigned char)(0x00) - && (unsigned char)(wkb_[38]) == (unsigned char)(0x7C)) + && (unsigned char)(wkb_[38]) == (unsigned char)(0x7C) + && (unsigned char)(wkb_[size_ - 1]) == (unsigned char)(0xFE)) { format_ = wkbSpatiaLite; } @@ -353,14 +354,14 @@ CoordinateArray ar(num_points); read_coords(ar); poly->move_to(ar[0].x, ar[0].y); - for (int j = 1; j < num_points - 1; ++j) + for (int j = 1; j < num_points ; ++j) { poly->line_to(ar[j].x, ar[j].y); } - poly->close(ar[num_points-1].x, ar[num_points-1].y); + poly->close_path(); } } - if (poly->size() > 2) // ignore if polygon has less than 3 vertices + if (poly->size() > 3) // ignore if polygon has less than (3 + close_path) vertices paths.push_back(poly); } } @@ -389,11 +390,11 @@ CoordinateArray ar(num_points); read_coords_xyz(ar); poly->move_to(ar[0].x, ar[0].y); - for (int j = 1; j < num_points - 1; ++j) + for (int j = 1; j < num_points; ++j) { poly->line_to(ar[j].x, ar[j].y); } - poly->close(ar[num_points-1].x, ar[num_points-1].y); + poly->close_path(); } } if (poly->size() > 2) // ignore if polygon has less than 3 vertices @@ -441,7 +442,7 @@ case wkbMultiLineStringZ: s << "MultiLineStringZ"; break; case wkbMultiPolygonZ: s << "MultiPolygonZ"; break; case wkbGeometryCollectionZ: s << "GeometryCollectionZ"; break; - default: s << "wkbUknown(" << type << ")"; break; + default: s << "wkbUnknown(" << type << ")"; break; } return s.str(); diff -Nru mapnik-2.1.0/src/wkt/wkt_factory.cpp mapnik-2.2.0/src/wkt/wkt_factory.cpp --- mapnik-2.1.0/src/wkt/wkt_factory.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/wkt/wkt_factory.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -30,6 +30,8 @@ // stl #include #include +#include + namespace mapnik { diff -Nru mapnik-2.1.0/src/wkt/wkt_generator.cpp mapnik-2.2.0/src/wkt/wkt_generator.cpp --- mapnik-2.1.0/src/wkt/wkt_generator.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/wkt/wkt_generator.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -24,19 +24,23 @@ #if BOOST_VERSION >= 104700 +#include #include -#include +#include +#include #include namespace mapnik { namespace util { -boost::tuple detail::multi_geometry_type::operator() (geometry_container const& geom) const +template +boost::tuple detail::multi_geometry_type::operator() (T const& geom) const { + typedef T geometry_container; unsigned type = 0u; bool collection = false; - geometry_container::const_iterator itr = geom.begin(); - geometry_container::const_iterator end = geom.end(); + typename geometry_container::const_iterator itr = geom.begin(); + typename geometry_container::const_iterator end = geom.end(); for ( ; itr != end; ++itr) { @@ -50,8 +54,8 @@ return boost::tuple(type, collection); } -template -wkt_generator::wkt_generator(bool single) +template +wkt_generator::wkt_generator(bool single) : wkt_generator::base_type(wkt) { using boost::spirit::karma::uint_; @@ -59,53 +63,60 @@ using boost::spirit::karma::_1; using boost::spirit::karma::lit; using boost::spirit::karma::_a; + using boost::spirit::karma::_b; + using boost::spirit::karma::_c; using boost::spirit::karma::_r1; using boost::spirit::karma::eps; using boost::spirit::karma::string; - + wkt = point | linestring | polygon ; - + point = &uint_(mapnik::Point)[_1 = _type(_val)] << string[ phoenix::if_ (single) [_1 = "Point("] .else_[_1 = "("]] << point_coord [_1 = _first(_val)] << lit(')') ; - + linestring = &uint_(mapnik::LineString)[_1 = _type(_val)] << string[ phoenix::if_ (single) [_1 = "LineString("] .else_[_1 = "("]] << coords << lit(')') ; - + polygon = &uint_(mapnik::Polygon)[_1 = _type(_val)] << string[ phoenix::if_ (single) [_1 = "Polygon("] .else_[_1 = "("]] << coords2 << lit("))") ; - - point_coord = &uint_ << coord_type << lit(' ') << coord_type + + point_coord = &uint_ << coordinate << lit(' ') << coordinate ; - - polygon_coord %= ( &uint_(mapnik::SEG_MOVETO) << eps[_r1 += 1] + + polygon_coord %= ( &uint_(mapnik::SEG_MOVETO) + << eps[_r1 += 1][_a = _x(_val)][ _b = _y(_val)] << string[ if_ (_r1 > 1) [_1 = "),("] - .else_[_1 = "("] ] | &uint_ << ",") - << coord_type + .else_[_1 = "("]] + | + &uint_(mapnik::SEG_LINETO) + << lit(',') << eps[_a = _x(_val)][_b = _y(_val)] + ) + << coordinate[_1 = _a] << lit(' ') - << coord_type + << coordinate[_1 = _b] ; - - coords2 %= *polygon_coord(_a) + + coords2 %= *polygon_coord(_a,_b,_c) ; - + coords = point_coord % lit(',') ; } -template -wkt_multi_generator::wkt_multi_generator() +template +wkt_multi_generator::wkt_multi_generator() : wkt_multi_generator::base_type(wkt) { using boost::spirit::karma::lit; @@ -138,10 +149,27 @@ } -template struct mapnik::util::wkt_generator >; -template struct mapnik::util::wkt_multi_generator >; +template struct mapnik::util::wkt_generator, mapnik::geometry_type>; +template struct mapnik::util::wkt_multi_generator, mapnik::geometry_container >; + +bool to_wkt(std::string & wkt, mapnik::geometry_type const& geom) +{ + typedef std::back_insert_iterator sink_type; + sink_type sink(wkt); + wkt_generator generator(true); + bool result = karma::generate(sink, generator, geom); + return result; +} +bool to_wkt(std::string & wkt, mapnik::geometry_container const& geom) +{ + typedef std::back_insert_iterator sink_type; + sink_type sink(wkt); + wkt_multi_generator generator; + bool result = karma::generate(sink, generator, geom); + return result; +} }} -#endif \ No newline at end of file +#endif diff -Nru mapnik-2.1.0/src/xml_tree.cpp mapnik-2.2.0/src/xml_tree.cpp --- mapnik-2.1.0/src/xml_tree.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/src/xml_tree.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -22,97 +22,25 @@ //mapnik #include +#include #include #include #include #include +#include #include +#include +#include +#include +#include #include #include #include - -//boost -#include +#include namespace mapnik { -template -inline boost::optional fast_cast(xml_tree const& tree, std::string const& value) -{ - try - { - return boost::lexical_cast(value); - } - catch (boost::bad_lexical_cast const& ex) - { - return boost::optional(); - } -} - -template <> -inline boost::optional fast_cast(xml_tree const& tree, std::string const& value) -{ - int result; - if (mapnik::util::string2int(value, result)) - return boost::optional(result); - return boost::optional(); -} - -template <> -inline boost::optional fast_cast(xml_tree const& tree, std::string const& value) -{ - double result; - if (mapnik::util::string2double(value, result)) - return boost::optional(result); - return boost::optional(); -} - -template <> -inline boost::optional fast_cast(xml_tree const& tree, std::string const& value) -{ - float result; - if (mapnik::util::string2float(value, result)) - return boost::optional(result); - return boost::optional(); -} - -template <> -inline boost::optional fast_cast(xml_tree const& tree, std::string const& value) -{ - return value; -} - -template <> -inline boost::optional fast_cast(xml_tree const& tree, std::string const& value) -{ - mapnik::color c; - if (mapnik::color_factory::parse_from_string(c, value, tree.color_grammar)) - { - return c; - } - else - { - throw config_error("Failed to parse color '"+value+"'"); - } -} - -template <> -inline boost::optional fast_cast(xml_tree const& tree, std::string const& value) -{ - expression_ptr expr(boost::make_shared(true)); - if (expression_factory::parse_from_string(expr, value, tree.expr_grammar)) - { - return expr; - } - else - { - throw mapnik::config_error("Failed to parse expression '" + value + "'"); - } -} - -/****************************************************************************/ - class boolean; template struct name_trait @@ -140,7 +68,11 @@ DEFINE_NAME_TRAIT( float, "float") DEFINE_NAME_TRAIT( unsigned, "unsigned") DEFINE_NAME_TRAIT( boolean, "boolean") -DEFINE_NAME_TRAIT( int, "integer" ) +#ifdef BIGINT +DEFINE_NAME_TRAIT( mapnik::value_integer, "long long" ) +#else +DEFINE_NAME_TRAIT( mapnik::value_integer, "int" ) +#endif DEFINE_NAME_TRAIT( std::string, "string" ) DEFINE_NAME_TRAIT( color, "color" ) DEFINE_NAME_TRAIT(expression_ptr, "expression_ptr" ) @@ -164,8 +96,6 @@ } }; -/****************************************************************************/ - xml_tree::xml_tree(std::string const& encoding) : node_(*this, ""), file_(), @@ -199,30 +129,21 @@ return node_; } -/****************************************************************************/ xml_attribute::xml_attribute(std::string const& value_) : value(value_), processed(false) { } -/****************************************************************************/ - node_not_found::node_not_found(std::string const& node_name) - : node_name_(node_name) -{ - -} + : node_name_(node_name) {} const char* node_not_found::what() const throw() { return ("Node "+node_name_+ "not found").c_str(); } -node_not_found::~node_not_found() throw() -{ - -} +node_not_found::~node_not_found() throw() {} attribute_not_found::attribute_not_found( @@ -230,57 +151,44 @@ std::string const& attribute_name) : node_name_(node_name), - attribute_name_(attribute_name) -{ - -} + attribute_name_(attribute_name) {} const char* attribute_not_found::what() const throw() { return ("Attribute '" + attribute_name_ +"' not found in node '"+node_name_+ "'").c_str(); } -attribute_not_found::~attribute_not_found() throw() -{ - -} +attribute_not_found::~attribute_not_found() throw() {} more_than_one_child::more_than_one_child(std::string const& node_name) - : node_name_(node_name) -{ - -} + : node_name_(node_name) {} const char* more_than_one_child::what() const throw() { return ("More than one child node in node '" + node_name_ +"'").c_str(); } -more_than_one_child::~more_than_one_child() throw() -{ - -} - -/****************************************************************************/ +more_than_one_child::~more_than_one_child() throw() {} xml_node::xml_node(xml_tree &tree, std::string const& name, unsigned line, bool is_text) : tree_(tree), name_(name), is_text_(is_text), line_(line), - processed_(false) -{ - -} + processed_(false) {} std::string xml_node::xml_text = ""; std::string const& xml_node::name() const { if (!is_text_) + { return name_; + } else + { return xml_text; + } } std::string const& xml_node::text() const @@ -289,7 +197,8 @@ { processed_ = true; return name_; - } else + } + else { throw config_error("text() called on non-text node", *this); } @@ -399,7 +308,7 @@ std::map::const_iterator itr = attributes_.find(name); if (itr == attributes_.end()) return boost::optional(); itr->second.processed = true; - boost::optional result = fast_cast(tree_, itr->second.value); + boost::optional result = xml_attribute_cast(tree_, std::string(itr->second.value)); if (!result) { throw config_error(std::string("Failed to parse attribute '") + @@ -410,11 +319,11 @@ } template -T xml_node::get_attr(std::string const& name, T const& default_value) const +T xml_node::get_attr(std::string const& name, T const& default_opt_value) const { boost::optional value = get_opt_attr(name); if (value) return *value; - return default_value; + return default_opt_value; } template @@ -432,7 +341,8 @@ if (is_text_) { return name_; - } else + } + else { return ""; } @@ -448,7 +358,7 @@ template T xml_node::get_value() const { - boost::optional result = fast_cast(tree_, get_text()); + boost::optional result = xml_attribute_cast(tree_, get_text()); if (!result) { throw config_error(std::string("Failed to parse value. Expected ") @@ -463,6 +373,14 @@ return line_; } +std::string xml_node::line_to_string() const +{ + std::string number; + util::to_string(number,line_); + return number; +} + + #define compile_get_opt_attr(T) template boost::optional xml_node::get_opt_attr(std::string const&) const #define compile_get_attr(T) template T xml_node::get_attr(std::string const&) const; template T xml_node::get_attr(std::string const&, T const&) const #define compile_get_value(T) template T xml_node::get_value() const @@ -470,6 +388,7 @@ compile_get_opt_attr(boolean); compile_get_opt_attr(std::string); compile_get_opt_attr(unsigned); +compile_get_opt_attr(mapnik::value_integer); compile_get_opt_attr(float); compile_get_opt_attr(double); compile_get_opt_attr(color); @@ -481,16 +400,19 @@ compile_get_opt_attr(vertical_alignment_e); compile_get_opt_attr(horizontal_alignment_e); compile_get_opt_attr(justify_alignment_e); +compile_get_opt_attr(halo_rasterizer_e); compile_get_opt_attr(expression_ptr); compile_get_attr(std::string); compile_get_attr(filter_mode_e); compile_get_attr(point_placement_e); +compile_get_attr(debug_symbolizer_mode_e); compile_get_attr(marker_placement_e); +compile_get_attr(marker_multi_policy_e); compile_get_attr(pattern_alignment_e); compile_get_attr(line_rasterizer_e); compile_get_attr(colorizer_mode); compile_get_attr(double); -compile_get_value(int); +compile_get_value(value_integer); compile_get_value(double); compile_get_value(expression_ptr); } //ns mapnik diff -Nru mapnik-2.1.0/tests/cpp_tests/agg_blend_src_over_test.cpp mapnik-2.2.0/tests/cpp_tests/agg_blend_src_over_test.cpp --- mapnik-2.1.0/tests/cpp_tests/agg_blend_src_over_test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/agg_blend_src_over_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,215 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "agg_color_rgba.h" +#include "agg_pixfmt_rgba.h" +#include "agg_rendering_buffer.h" +#include "agg_renderer_base.h" + +typedef agg::rgba8 color; +typedef agg::order_rgba order; + +std::string to_string(color const& c) +{ + std::ostringstream s; + s << "rgba(" << (unsigned)c.r << "," << (unsigned)c.g << "," << (unsigned)c.b << "," << (unsigned)c.a << ")"; + return s.str(); +} + +template +color blend(color const& source, color const& dest, unsigned cover=255) +{ + unsigned stride = 4; + unsigned size = 1; + + color source_pre = source; + source_pre.premultiply(); + color dest_pre = dest; + dest_pre.premultiply(); + + unsigned char* buffer = new unsigned char[size*size*stride]; + memset(buffer, 0, size*size*stride); + buffer[0] = dest_pre.r; + buffer[1] = dest_pre.g; + buffer[2] = dest_pre.b; + buffer[3] = dest_pre.a; + // http://www.antigrain.com/doc/basic_renderers/basic_renderers.agdoc.html + agg::rendering_buffer rbuf(buffer, + size, + size, + size * stride); + color::value_type* psource = (color::value_type*)rbuf.row_ptr(0,0,1); + blender::blend_pix(psource,source_pre.r,source_pre.g,source_pre.b,source_pre.a,cover); + color color_result(psource[0],psource[1],psource[2],psource[3]); + color_result.demultiply(); + delete [] buffer; + return color_result; +} + +// agg::pixfmt_alpha_blend_rgba +color normal_blend(color const& source, color const& dest, unsigned cover=255) +{ + typedef agg::renderer_base renderer_type; + unsigned stride = 4; + unsigned size = 1; + color source_pre = source; + source_pre.premultiply(); + color dest_pre = dest; + dest_pre.premultiply(); + // source buffer + unsigned char* source_buffer = new unsigned char[size*size*stride]; + memset(source_buffer, 0, size*size*stride); + source_buffer[0] = source_pre.r; + source_buffer[1] = source_pre.g; + source_buffer[2] = source_pre.b; + source_buffer[3] = source_pre.a; + agg::rendering_buffer source_rbuffer(source_buffer,size,size,size * 4); + agg::pixfmt_rgba32_pre pixf_source(source_rbuffer); + + // destination buffer + unsigned char* dest_buffer = new unsigned char[size*size*stride]; + memset(dest_buffer, 0, size*size*stride); + dest_buffer[0] = dest_pre.r; + dest_buffer[1] = dest_pre.g; + dest_buffer[2] = dest_pre.b; + dest_buffer[3] = dest_pre.a; + agg::rendering_buffer dest_rbuffer(dest_buffer,size,size,size * 4); + agg::pixfmt_rgba32_pre pixf_dest(dest_rbuffer); + + // renderer: blends source into destination + renderer_type ren(pixf_dest); + ren.blend_from(pixf_source,0,0,0,cover); + color color_result(dest_buffer[0],dest_buffer[1],dest_buffer[2],dest_buffer[3]); + color_result.demultiply(); + delete [] source_buffer; + delete [] dest_buffer; + return color_result; +} + + + +namespace agg { + +// the original agg template code for src_over +// before we changed A as per https://github.com/mapnik/mapnik/issues/1452 +template struct comp_op_rgba_src_over2 +{ + typedef ColorT color_type; + typedef Order order_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e + { + base_shift = color_type::base_shift, + base_mask = color_type::base_mask + }; + + // Dca' = Sca + Dca.(1 - Sa) + // Da' = Sa + Da - Sa.Da + static void blend_pix(value_type* p, + unsigned sr, unsigned sg, unsigned sb, + unsigned sa, unsigned cover) + { + if(cover < 255) + { + sr = (sr * cover + 255) >> 8; + sg = (sg * cover + 255) >> 8; + sb = (sb * cover + 255) >> 8; + sa = (sa * cover + 255) >> 8; + } + calc_type s1a = base_mask - sa; + p[Order::R] = (value_type)(sr + ((p[Order::R] * s1a + base_mask) >> base_shift)); + p[Order::G] = (value_type)(sg + ((p[Order::G] * s1a + base_mask) >> base_shift)); + p[Order::B] = (value_type)(sb + ((p[Order::B] * s1a + base_mask) >> base_shift)); + p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift)); + } +}; + +} + +int main(int argc, char** argv) +{ + std::vector args; + for (int i=1;i source_over_old_agg; + typedef agg::comp_op_rgba_src_over source_over; + + color white(255,255,255,255); + color black(0,0,0,255); + + BOOST_TEST_EQ( to_string(blend(white,white)), to_string(white) ); + BOOST_TEST_EQ( to_string(blend(white,black)), to_string(white) ); + BOOST_TEST_EQ( to_string(blend(black,white)), to_string(black) ); + + // https://github.com/mapnik/mapnik/issues/1452#issuecomment-8154646 + color near_white(254,254,254,254); // Source + color near_trans(1,1,1,1); // Dest + color expected_color(252,252,252,255); // expected result + BOOST_TEST_EQ( to_string(blend(near_white,near_trans)), to_string(color(252,252,252,254)) ); + BOOST_TEST_EQ( to_string(blend(near_white,near_trans)), to_string(expected_color) ); + BOOST_TEST_EQ( to_string(normal_blend(near_white,near_trans)), to_string(expected_color) ); + + // using normal_blend as expected, compare a variety of other colors + + { + color source(128,128,128,255); + color dest(128,128,128,255); + unsigned cover = 128; + std::string expected_str = to_string(normal_blend(source,dest,cover)); + BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + } + + { + color source(128,128,128,255); + color dest(128,128,128,255); + unsigned cover = 245; + std::string expected_str = to_string(normal_blend(source,dest,cover)); + BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + } + + // commenting until I study these failures more (dane) + /* + { + // fails, why? + color source(127,127,127,127); + color dest(127,127,127,127); + unsigned cover = 255; + std::string expected_str = to_string(normal_blend(source,dest,cover)); + BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + } + + { + // fails, why? + color source(128,128,128,128); + color dest(128,128,128,128); + unsigned cover = 128; + std::string expected_str = to_string(normal_blend(source,dest,cover)); + BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + } + */ + + if (!::boost::detail::test_errors()) { + if (quiet) std::clog << "\x1b[1;32m.\x1b[0m"; + else std::clog << "C++ AGG blending: \x1b[1;32m✓ \x1b[0m\n"; +#if BOOST_VERSION >= 104600 + ::boost::detail::report_errors_remind().called_report_errors_function = true; +#endif + } else { + std::clog << "C++ AGG blending: "; + return ::boost::report_errors(); + } +} diff -Nru mapnik-2.1.0/tests/cpp_tests/build.py mapnik-2.2.0/tests/cpp_tests/build.py --- mapnik-2.1.0/tests/cpp_tests/build.py 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/build.py 2013-06-04 01:35:27.000000000 +0000 @@ -6,19 +6,40 @@ test_env = env.Clone() -test_env['LIBS'] = copy(env['LIBMAPNIK_LIBS']) -test_env.AppendUnique(LIBS='mapnik') -test_env.AppendUnique(LIBS='sqlite3') -test_env.AppendUnique(CXXFLAGS='-g') - -for cpp_test in glob.glob('*_test.cpp'): - test_env_local = test_env.Clone() - name = cpp_test.replace('.cpp','-bin') - source_files = [cpp_test] - if 'csv_parse' in cpp_test: - source_files += glob.glob('../../plugins/input/csv/' + '*.cpp') - test_program = test_env_local.Program(name, source=source_files, LINKFLAGS=env['CUSTOM_LDFLAGS']) - Depends(test_program, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME'])) - # build locally if installing - if 'install' in COMMAND_LINE_TARGETS: - env.Alias('install',test_program) +if not env['CPP_TESTS']: + for cpp_test_bin in glob.glob('*-bin'): + os.unlink(cpp_test_bin) +else: + test_env['LIBS'] = copy(env['LIBMAPNIK_LIBS']) + test_env.AppendUnique(LIBS='mapnik') + test_env.AppendUnique(CXXFLAGS='-g') + test_env['CXXFLAGS'] = copy(test_env['LIBMAPNIK_CXXFLAGS']) + if test_env['HAS_CAIRO']: + test_env.PrependUnique(CPPPATH=test_env['CAIRO_CPPPATHS']) + test_env.Append(CPPDEFINES = '-DHAVE_CAIRO') + for cpp_test in glob.glob('*_test.cpp'): + name = cpp_test.replace('.cpp','-bin') + source_files = [cpp_test] + test_program = None + # enable for faster compile while developing just this test + #if 'agg_blend_src_over_test' in cpp_test: + if False: + # customization here for faster compile + agg_env = Environment(ENV=os.environ) + agg_env['CXX'] = env['CXX'] + agg_env['CXXFLAGS'] = env['CXXFLAGS'] + if 'agg' in test_env['LIBS']: + agg_env.AppendUnique(LIBS='agg') + agg_env.Append(CPPPATH = '#deps/agg/include') + agg_env.Append(LIBPATH = '#deps/agg') + agg_env['CPPPATH'] = ['#deps/agg/include',env['BOOST_INCLUDES']] + test_program = agg_env.Program(name, source=source_files, LINKFLAGS=env['CUSTOM_LDFLAGS']) + else: + test_env_local = test_env.Clone() + if 'csv_parse' in cpp_test: + source_files += glob.glob('../../plugins/input/csv/' + '*.cpp') + test_program = test_env_local.Program(name, source=source_files, LINKFLAGS=env['CUSTOM_LDFLAGS']) + Depends(test_program, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME'])) + # build locally if installing + if 'install' in COMMAND_LINE_TARGETS: + env.Alias('install',test_program) diff -Nru mapnik-2.1.0/tests/cpp_tests/clipping_test.cpp mapnik-2.2.0/tests/cpp_tests/clipping_test.cpp --- mapnik-2.1.0/tests/cpp_tests/clipping_test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/clipping_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,136 @@ + +// mapnik +#include +#include + +// boost +#include +#include +#include + +// stl +#include +#include +#include +#include +#include + +// agg +#include "agg_conv_clip_polygon.h" +#include "agg_conv_clip_polyline.h" +//#include "agg_path_storage.h" +//#include "agg_conv_clipper.h" + +#include "utils.hpp" + +template +std::string dump_path(T & path) +{ + unsigned cmd = 1; + double x = 0; + double y = 0; + unsigned idx = 0; + std::ostringstream s; + path.rewind(0); + while ((cmd = path.vertex(&x, &y)) != mapnik::SEG_END) + { + if (idx > 0) s << ","; + s << x << " " << y << " " << cmd; + idx++; + } + return s.str(); +} + +std::string clip_line(mapnik::box2d const& bbox, + mapnik::geometry_type & geom) +{ + typedef agg::conv_clip_polyline line_clipper; + line_clipper clipped(geom); + clipped.clip_box(bbox.minx(),bbox.miny(),bbox.maxx(),bbox.maxy()); + return dump_path(clipped); +} + +void parse_geom(mapnik::geometry_type & geom, + std::string const& geom_string) { + std::vector vertices; + boost::split(vertices, geom_string, boost::is_any_of(",")); + BOOST_FOREACH(std::string const& vert, vertices) + { + std::vector commands; + boost::split(commands, vert, boost::is_any_of(" ")); + if (commands.size() != 3) + { + throw std::runtime_error(std::string("could not parse geometry '") + geom_string + "'"); + } + double x = 0; + double y = 0; + int c = 0; + if (mapnik::util::string2double(commands[0],x) + && mapnik::util::string2double(commands[1],y) + && mapnik::util::string2int(commands[2],c)) + { + geom.push_vertex(x,y,(mapnik::CommandType)c); + } + else + { + throw std::runtime_error(std::string("could not parse geometry '") + geom_string + "'"); + } + } +} + +int main(int argc, char** argv) +{ + std::vector args; + for (int i=1;i parts; + boost::split(parts, csv_line, boost::is_any_of(";")); + // first part is clipping box + mapnik::box2d bbox; + if (!bbox.from_string(parts[0])) { + throw std::runtime_error(std::string("could not parse bbox '") + parts[0] + "'"); + } + // second part is input geometry + mapnik::geometry_type geom; + parse_geom(geom,parts[1]); + //std::clog << dump_path(geom) << "\n"; + // third part is expected, clipped geometry + BOOST_TEST_EQ(clip_line(bbox,geom),parts[2]); + } + stream.close(); + } + catch (std::exception const& ex) + { + std::cerr << ex.what() << "\n"; + } + + if (!::boost::detail::test_errors()) + { + if (quiet) std::clog << "\x1b[1;32m.\x1b[0m"; + else std::clog << "C++ clipping: \x1b[1;32m✓ \x1b[0m\n"; +#if BOOST_VERSION >= 104600 + ::boost::detail::report_errors_remind().called_report_errors_function = true; +#endif + } + else + { + return ::boost::report_errors(); + } +} diff -Nru mapnik-2.1.0/tests/cpp_tests/conversions_test.cpp mapnik-2.2.0/tests/cpp_tests/conversions_test.cpp --- mapnik-2.1.0/tests/cpp_tests/conversions_test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/conversions_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,295 @@ +#include +#include +#include +#include +#include +#include +#include + +#if defined(_MSC_VER) +#include +#endif + +int main(int argc, char** argv) +{ + #if defined(_MSC_VER) + unsigned int old = _set_output_format(_TWO_DIGIT_EXPONENT); + #endif + std::vector args; + for (int i=1;i= 104600 + ::boost::detail::report_errors_remind().called_report_errors_function = true; +#endif + } else { + return ::boost::report_errors(); + } +} diff -Nru mapnik-2.1.0/tests/cpp_tests/csv_parse_test.cpp mapnik-2.2.0/tests/cpp_tests/csv_parse_test.cpp --- mapnik-2.1.0/tests/cpp_tests/csv_parse_test.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/csv_parse_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -#include -#include -#include -#include "plugins/input/csv/csv_datasource.hpp" -#include - - -int main( int, char*[] ) -{ - // test of directly instanciating a datasource - try { - mapnik::parameters params; - params["type"]="csv"; - params["file"]="./tests/data/csv/wkt.csv"; - csv_datasource ds(params); - BOOST_TEST(true); - } catch (std::exception const& ex) { - BOOST_TEST(false); - std::clog << "threw: " << ex.what() << "\n"; - } - - if (!::boost::detail::test_errors()) { - std::clog << "C++ CSV parse: \x1b[1;32m✓ \x1b[0m\n"; -#if BOOST_VERSION >= 104600 - ::boost::detail::report_errors_remind().called_report_errors_function = true; -#endif - } else { - return ::boost::report_errors(); - } -} diff -Nru mapnik-2.1.0/tests/cpp_tests/data/cases.txt mapnik-2.2.0/tests/cpp_tests/data/cases.txt --- mapnik-2.1.0/tests/cpp_tests/data/cases.txt 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/data/cases.txt 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,9 @@ +# testcase format is: +# ;; +# SEG_END=0 SEG_MOVETO = 1 SEG_LINETO = 2 SEG_CLOSE = (0x40 | 0x0f) +50,50,150,150;0 0 1,200 200 2;50 50 1,150 150 2 +50,50,150,150;50 50 1,150 50 2,150 150 2,50 150 2,50 50 2;50 50 1,150 50 2,150 150 2,50 150 2,50 50 2 +# points are dropped by line clipper +50,50,150,150;75 75 1; +# TODO - should the close path be kept after clipping? +# 50,50,150,150;50 50 1,150 50 2,150 150 2,50 150 2,50 50 2,0 0 79;50 50 1,150 50 2,150 150 2,50 150 2,50 50 2 diff -Nru mapnik-2.1.0/tests/cpp_tests/exceptions_test.cpp mapnik-2.2.0/tests/cpp_tests/exceptions_test.cpp --- mapnik-2.1.0/tests/cpp_tests/exceptions_test.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/exceptions_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -1,9 +1,9 @@ #include #include -#include #include #include #include +#include #include #include #include @@ -18,14 +18,23 @@ #include #include #include +#include +#include +#include -extern "C" { -#include -} +#include "utils.hpp" -int main( int, char*[] ) +int main(int argc, char** argv) { + std::vector args; + for (int i=1;iregister_datasource(csv_plugin); + mapnik::datasource_cache::instance().register_datasource(csv_plugin); mapnik::parameters p; p["type"]="csv"; p["inline"]="x,y\n0,0"; - mapnik::datasource_ptr ds = mapnik::datasource_cache::instance()->create(p); - //mapnik::datasource_ptr ds = boost::make_shared(); - //mapnik::context_ptr ctx = boost::make_shared(); - //mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx, 1)); - //mapnik::memory_datasource *mem_ds = dynamic_cast(ds.get()); - //mem_ds->push(feature); + mapnik::datasource_ptr ds = mapnik::datasource_cache::instance().create(p); mapnik::layer l("layer"); l.set_datasource(ds); l.add_style("style"); @@ -64,7 +69,7 @@ mapnik::agg_renderer ren(m,im); //std::clog << mapnik::save_map_to_string(m) << "\n"; BOOST_TEST(true); - // should throw here + // should throw here with "CSV Plugin: no attribute 'foo'. Valid attributes are: x,y." ren.apply(); BOOST_TEST(false); } catch (...) { @@ -73,40 +78,22 @@ } std::string shape_plugin("./plugins/input/shape.input"); - if (boost::filesystem::exists(shape_plugin)) { + if (mapnik::util::exists(shape_plugin)) { try { - mapnik::datasource_cache::instance()->register_datasource(shape_plugin); + mapnik::datasource_cache::instance().register_datasource(shape_plugin); mapnik::parameters p2; p2["type"]="shape"; p2["file"]="foo"; - mapnik::datasource_cache::instance()->create(p2); + mapnik::datasource_cache::instance().create(p2); BOOST_TEST(false); } catch (...) { BOOST_TEST(true); } } - - /* - // not working, oddly segfaults valgrind - try { - sqlite3_initialize(); - // http://stackoverflow.com/questions/11107703/sqlite3-sigsegvs-with-valgrind - sqlite3_config(SQLITE_CONFIG_HEAP, malloc (1024*1024), 1024*1024, 64); - mapnik::datasource_cache::instance()->register_datasource("./plugins/input/sqlite.input"); - mapnik::parameters p; - p["type"]="sqlite"; - p["file"]="tests/data/sqlite/world.sqlite"; - p["table"]="world_merc"; - mapnik::datasource_cache::instance()->create(p); - sqlite3_shutdown(); - BOOST_TEST(true); - } catch (...) { - BOOST_TEST(false); - } - */ if (!::boost::detail::test_errors()) { - std::clog << "C++ exceptions: \x1b[1;32m✓ \x1b[0m\n"; + if (quiet) std::clog << "\x1b[1;32m.\x1b[0m"; + else std::clog << "C++ exceptions: \x1b[1;32m✓ \x1b[0m\n"; #if BOOST_VERSION >= 104600 ::boost::detail::report_errors_remind().called_report_errors_function = true; #endif diff -Nru mapnik-2.1.0/tests/cpp_tests/font_registration_test.cpp mapnik-2.2.0/tests/cpp_tests/font_registration_test.cpp --- mapnik-2.1.0/tests/cpp_tests/font_registration_test.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/font_registration_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -1,78 +1,98 @@ #include -#include -namespace fs = boost::filesystem; -using fs::path; -namespace sys = boost::system; +#include #include #include #include +#include +#include -int main( int, char*[] ) +#include "utils.hpp" + +int main(int argc, char** argv) { - std::string fontdir("fonts/"); + std::vector args; + for (int i=1;i face_names; + BOOST_TEST(set_working_dir(args)); - std::string foo("foo"); + std::string fontdir("fonts/"); - // fake directories - BOOST_TEST( !mapnik::freetype_engine::register_fonts(foo , true ) ); - face_names = mapnik::freetype_engine::face_names(); - BOOST_TEST( face_names.size() == 0 ); - BOOST_TEST( !mapnik::freetype_engine::register_fonts(foo) ); - face_names = mapnik::freetype_engine::face_names(); - BOOST_TEST( face_names.size() == 0 ); - - // directories without fonts - std::string src("src"); - // an empty directory will not return true - // we need to register at least one font and not fail on any - // to return true - BOOST_TEST( mapnik::freetype_engine::register_font(src) == false ); - BOOST_TEST( mapnik::freetype_engine::register_fonts(src, true) == false ); - BOOST_TEST( mapnik::freetype_engine::face_names().size() == 0 ); - - // bogus, emtpy file that looks like font - BOOST_TEST( mapnik::freetype_engine::register_font("tests/data/fonts/fake.ttf") == false ); - BOOST_TEST( mapnik::freetype_engine::register_fonts("tests/data/fonts/fake.ttf") == false ); - BOOST_TEST( mapnik::freetype_engine::face_names().size() == 0 ); - - BOOST_TEST( mapnik::freetype_engine::register_font("tests/data/fonts/intentionally-broken.ttf") == false ); - BOOST_TEST( mapnik::freetype_engine::register_fonts("tests/data/fonts/intentionally-broken.ttf") == false ); - BOOST_TEST( mapnik::freetype_engine::face_names().size() == 0 ); - - // register unifont, since we know it sits in the root fonts/ dir - BOOST_TEST( mapnik::freetype_engine::register_fonts(fontdir) ); - face_names = mapnik::freetype_engine::face_names(); - //std::clog << "number of registered fonts: " << face_names.size() << std::endl; - BOOST_TEST( face_names.size() > 0 ); - BOOST_TEST( face_names.size() == 1 ); - - // re-register unifont, should not have any affect - BOOST_TEST( mapnik::freetype_engine::register_fonts(fontdir, false) ); - face_names = mapnik::freetype_engine::face_names(); - //std::clog << "number of registered fonts: " << face_names.size() << std::endl; - BOOST_TEST( face_names.size() == 1 ); - - // register a single dejavu font - std::string dejavu_bold_oblique("tests/data/fonts/DejaVuSansMono-BoldOblique.ttf"); - BOOST_TEST( mapnik::freetype_engine::register_font(dejavu_bold_oblique) ); - face_names = mapnik::freetype_engine::face_names(); - //std::clog << "number of registered fonts: " << face_names.size() << std::endl; - BOOST_TEST( face_names.size() == 2 ); - - // recurse to find all dejavu fonts - BOOST_TEST( mapnik::freetype_engine::register_fonts(fontdir, true) ); - face_names = mapnik::freetype_engine::face_names(); - //std::clog << "number of registered fonts: " << face_names.size() << std::endl; - BOOST_TEST( face_names.size() == 22 ); + BOOST_TEST( mapnik::util::exists( fontdir ) ); + BOOST_TEST( mapnik::util::is_directory( fontdir ) ); + + std::vector face_names; + + std::string foo("foo"); + + // fake directories + BOOST_TEST( !mapnik::freetype_engine::register_fonts(foo , true ) ); + face_names = mapnik::freetype_engine::face_names(); + BOOST_TEST( face_names.size() == 0 ); + BOOST_TEST( !mapnik::freetype_engine::register_fonts(foo) ); + face_names = mapnik::freetype_engine::face_names(); + BOOST_TEST( face_names.size() == 0 ); + + // directories without fonts + std::string src("src"); + // an empty directory will not return true + // we need to register at least one font and not fail on any + // to return true + BOOST_TEST( mapnik::freetype_engine::register_font(src) == false ); + BOOST_TEST( mapnik::freetype_engine::register_fonts(src, true) == false ); + BOOST_TEST( mapnik::freetype_engine::face_names().size() == 0 ); + + // bogus, emtpy file that looks like font + BOOST_TEST( mapnik::freetype_engine::register_font("tests/data/fonts/fake.ttf") == false ); + BOOST_TEST( mapnik::freetype_engine::register_fonts("tests/data/fonts/fake.ttf") == false ); + BOOST_TEST( mapnik::freetype_engine::face_names().size() == 0 ); + + BOOST_TEST( mapnik::freetype_engine::register_font("tests/data/fonts/intentionally-broken.ttf") == false ); + BOOST_TEST( mapnik::freetype_engine::register_fonts("tests/data/fonts/intentionally-broken.ttf") == false ); + BOOST_TEST( mapnik::freetype_engine::face_names().size() == 0 ); + + // register unifont, since we know it sits in the root fonts/ dir + BOOST_TEST( mapnik::freetype_engine::register_fonts(fontdir) ); + face_names = mapnik::freetype_engine::face_names(); + //std::clog << "number of registered fonts: " << face_names.size() << std::endl; + BOOST_TEST( face_names.size() > 0 ); + BOOST_TEST( face_names.size() == 1 ); + + // re-register unifont, should not have any affect + BOOST_TEST( mapnik::freetype_engine::register_fonts(fontdir, false) ); + face_names = mapnik::freetype_engine::face_names(); + //std::clog << "number of registered fonts: " << face_names.size() << std::endl; + BOOST_TEST( face_names.size() == 1 ); + + // register a single dejavu font + std::string dejavu_bold_oblique("tests/data/fonts/DejaVuSansMono-BoldOblique.ttf"); + BOOST_TEST( mapnik::freetype_engine::register_font(dejavu_bold_oblique) ); + face_names = mapnik::freetype_engine::face_names(); + //std::clog << "number of registered fonts: " << face_names.size() << std::endl; + BOOST_TEST( face_names.size() == 2 ); + + // recurse to find all dejavu fonts + BOOST_TEST( mapnik::freetype_engine::register_fonts(fontdir, true) ); + face_names = mapnik::freetype_engine::face_names(); + //std::clog << "number of registered fonts: " << face_names.size() << std::endl; + BOOST_TEST( face_names.size() == 22 ); + } + catch (std::exception const & ex) + { + std::clog << "C++ fonts registration problem: " << ex.what() << "\n"; + BOOST_TEST(false); + } if (!::boost::detail::test_errors()) { - std::clog << "C++ fonts registration: \x1b[1;32m✓ \x1b[0m\n"; + if (quiet) std::clog << "\x1b[1;32m.\x1b[0m"; + else std::clog << "C++ fonts registration: \x1b[1;32m✓ \x1b[0m\n"; #if BOOST_VERSION >= 104600 ::boost::detail::report_errors_remind().called_report_errors_function = true; #endif diff -Nru mapnik-2.1.0/tests/cpp_tests/fontset_runtime_test.cpp mapnik-2.2.0/tests/cpp_tests/fontset_runtime_test.cpp --- mapnik-2.1.0/tests/cpp_tests/fontset_runtime_test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/fontset_runtime_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,84 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "utils.hpp" + +int main(int argc, char** argv) +{ + std::vector args; + for (int i=1;i(); + ctx->push("name"); + mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx,1)); + mapnik::transcoder tr("utf-8"); + UnicodeString ustr = tr.transcode("hello world!"); + feature->put("name",ustr); + mapnik::geometry_type * pt = new mapnik::geometry_type(mapnik::Point); + pt->move_to(128,128); + feature->add_geometry(pt); + mapnik::datasource_ptr memory_ds = boost::make_shared(); + mapnik::memory_datasource *cache = dynamic_cast(memory_ds.get()); + cache->push(feature); + mapnik::Map m(256,256); + mapnik::font_set fontset("fontset"); + // NOTE: this is a valid font, but will fail because none are registered + fontset.add_face_name("DejaVu Sans Book"); + m.insert_fontset("fontset", fontset); + mapnik::layer lyr("layer"); + lyr.set_datasource(memory_ds); + lyr.add_style("style"); + m.addLayer(lyr); + mapnik::feature_type_style the_style; + mapnik::rule the_rule; + mapnik::text_symbolizer text_sym(mapnik::parse_expression("[name]"),10,mapnik::color(0,0,0)); + text_sym.set_fontset(fontset); + the_rule.append(text_sym); + the_style.add_rule(the_rule); + m.insert_style("style",the_style ); + m.zoom_to_box(mapnik::box2d(-256,-256, + 256,256)); + mapnik::image_32 buf(m.width(),m.height()); + mapnik::agg_renderer ren(m,buf); + ren.apply(); + } catch (std::exception const& ex) { + BOOST_TEST_EQ(std::string(ex.what()),std::string("No valid font face could be loaded for font set: 'fontset'")); + } + if (!::boost::detail::test_errors()) { + if (quiet) std::clog << "\x1b[1;32m.\x1b[0m"; + else std::clog << "C++ fontset runtime: \x1b[1;32m✓ \x1b[0m\n"; +#if BOOST_VERSION >= 104600 + ::boost::detail::report_errors_remind().called_report_errors_function = true; +#endif + } else { + return ::boost::report_errors(); + } +} diff -Nru mapnik-2.1.0/tests/cpp_tests/geometry_converters_test.cpp mapnik-2.2.0/tests/cpp_tests/geometry_converters_test.cpp --- mapnik-2.1.0/tests/cpp_tests/geometry_converters_test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/geometry_converters_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,194 @@ +#include +#include +#include +#include +#include +#include "utils.hpp" + +#if BOOST_VERSION >= 104700 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// stl +#include + +struct output_geometry_backend +{ + output_geometry_backend(boost::ptr_vector & paths, mapnik::eGeomType type) + : paths_(paths), + type_(type) {} + + template + void add_path(T & path) + { + mapnik::vertex2d vtx(mapnik::vertex2d::no_init); + path.rewind(0); + std::auto_ptr geom_ptr(new mapnik::geometry_type(type_)); + + while ((vtx.cmd = path.vertex(&vtx.x, &vtx.y)) != mapnik::SEG_END) + { + //std::cerr << vtx.x << "," << vtx.y << " cmd=" << vtx.cmd << std::endl; + geom_ptr->push_vertex(vtx.x, vtx.y, (mapnik::CommandType)vtx.cmd); + } + paths_.push_back(geom_ptr); + } + boost::ptr_vector & paths_; + mapnik::eGeomType type_; +}; + +boost::optional linestring_bbox_clipping(mapnik::box2d bbox, + std::string wkt_in) +{ + using namespace mapnik; + agg::trans_affine tr; + projection src(MAPNIK_LONGLAT_PROJ); + projection dst(MAPNIK_LONGLAT_PROJ); + proj_transform prj_trans(src,dst); + line_symbolizer sym; + CoordTransform t(bbox.width(),bbox.height(), bbox); + boost::ptr_vector output_paths; + output_geometry_backend backend(output_paths, mapnik::LineString); + + typedef boost::mpl::vector conv_types; + vertex_converter, output_geometry_backend, line_symbolizer, + CoordTransform, proj_transform, agg::trans_affine, conv_types> + converter(bbox, backend, sym, t, prj_trans, tr, 1.0); + + converter.set(); + + boost::ptr_vector p; + if (!mapnik::from_wkt(wkt_in , p)) + { + throw std::runtime_error("Failed to parse WKT"); + } + + BOOST_FOREACH( geometry_type & geom, p) + { + converter.apply(geom); + } + + std::string wkt_out; + if (mapnik::util::to_wkt(wkt_out, output_paths)) + { + return boost::optional(wkt_out); + } + + return boost::optional(); +} + +boost::optional polygon_bbox_clipping(mapnik::box2d bbox, + std::string wkt_in) +{ + using namespace mapnik; + agg::trans_affine tr; + projection src(MAPNIK_LONGLAT_PROJ); + projection dst(MAPNIK_LONGLAT_PROJ); + proj_transform prj_trans(src,dst); + polygon_symbolizer sym; + CoordTransform t(bbox.width(),bbox.height(), bbox); + boost::ptr_vector output_paths; + output_geometry_backend backend(output_paths, mapnik::Polygon); + + typedef boost::mpl::vector conv_types; + vertex_converter, output_geometry_backend, polygon_symbolizer, + CoordTransform, proj_transform, agg::trans_affine, conv_types> + converter(bbox, backend, sym, t, prj_trans, tr, 1.0); + + converter.set(); + + boost::ptr_vector p; + if (!mapnik::from_wkt(wkt_in , p)) + { + throw std::runtime_error("Failed to parse WKT"); + } + + BOOST_FOREACH( geometry_type & geom, p) + { + converter.apply(geom); + } + + std::string wkt_out; + if (mapnik::util::to_wkt(wkt_out, output_paths)) + { + return boost::optional(wkt_out); + } + + return boost::optional(); +} +#endif + +int main(int argc, char** argv) +{ + std::vector args; + for (int i=1;i= 104700 + + // LineString/bbox clipping + { + std::string wkt_in("LineString(0 0,200 200)"); + boost::optional result = linestring_bbox_clipping(mapnik::box2d(50,50,150,150),wkt_in); + BOOST_TEST(result); + BOOST_TEST_EQ(*result,std::string("LineString(50 50,150 150)")); + } + // Polygon/bbox clipping +#if 0 + // these tests will fail + { + std::string wkt_in("Polygon((50 50,150 50,150 150,50 150,50 50))"); + boost::optional result = polygon_bbox_clipping(mapnik::box2d(50,50,150,150),wkt_in); + BOOST_TEST(result); + BOOST_TEST_EQ(*result,std::string("Polygon((50 50,150 50,150 150,50 150,50 50))")); + } + + { + std::string wkt_in("Polygon((60 60,140 60,140 160,60 140,60 60))"); + boost::optional result = polygon_bbox_clipping(mapnik::box2d(50,50,150,150),wkt_in); + BOOST_TEST(result); + BOOST_TEST_EQ(*result,std::string("Polygon((60 60,140 60,140 160,60 140,60 60))")); + } + + { + std::string wkt_in("Polygon((0 0,10 0,10 10,0 10,0 0))"); + boost::optional result = polygon_bbox_clipping(mapnik::box2d(50,50,150,150),wkt_in); + BOOST_TEST(result); + BOOST_TEST_EQ(*result, std::string("GeometryCollection EMPTY")); + } + { + std::string wkt_in("Polygon((0 0,100 200,200 0,0 0 ))"); + boost::optional result = polygon_bbox_clipping(mapnik::box2d(50,50,150,150),wkt_in); + BOOST_TEST(result); + BOOST_TEST_EQ(*result,std::string("Polygon((50 50,50 100,75 150,125 150,150 100,150 50,50 50))")); + } +#endif + +#endif + + if (!::boost::detail::test_errors()) + { + if (quiet) std::clog << "\x1b[1;32m.\x1b[0m"; + else std::clog << "C++ geometry conversions: \x1b[1;32m✓ \x1b[0m\n"; +#if BOOST_VERSION >= 104600 + ::boost::detail::report_errors_remind().called_report_errors_function = true; +#endif + } + else + { + return ::boost::report_errors(); + } +} diff -Nru mapnik-2.1.0/tests/cpp_tests/image_io_test.cpp mapnik-2.2.0/tests/cpp_tests/image_io_test.cpp --- mapnik-2.1.0/tests/cpp_tests/image_io_test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/image_io_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,100 @@ +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "utils.hpp" + +int main(int argc, char** argv) +{ + std::vector args; + for (int i=1;i type; + try + { + BOOST_TEST(set_working_dir(args)); + + should_throw = "./tests/cpp_tests/data/blank.jpg"; + BOOST_TEST( mapnik::util::exists( should_throw ) ); + type = mapnik::type_from_filename(should_throw); + BOOST_TEST( type ); + try + { + std::auto_ptr reader(mapnik::get_image_reader(should_throw,*type)); + if (reader.get()) BOOST_TEST( false ); + } + catch (std::exception const&) + { + BOOST_TEST( true ); + } + + should_throw = "./tests/cpp_tests/data/blank.png"; + BOOST_TEST( mapnik::util::exists( should_throw ) ); + type = mapnik::type_from_filename(should_throw); + BOOST_TEST( type ); + try + { + std::auto_ptr reader(mapnik::get_image_reader(should_throw,*type)); + if (reader.get()) BOOST_TEST( false ); + } + catch (std::exception const&) + { + BOOST_TEST( true ); + } + + should_throw = "./tests/cpp_tests/data/blank.tiff"; + BOOST_TEST( mapnik::util::exists( should_throw ) ); + type = mapnik::type_from_filename(should_throw); + BOOST_TEST( type ); + try + { + std::auto_ptr reader(mapnik::get_image_reader(should_throw,*type)); + if (reader.get()) BOOST_TEST( false ); + } + catch (std::exception const&) + { + BOOST_TEST( true ); + } + + should_throw = "./tests/data/images/xcode-CgBI.png"; + BOOST_TEST( mapnik::util::exists( should_throw ) ); + type = mapnik::type_from_filename(should_throw); + BOOST_TEST( type ); + try + { + std::auto_ptr reader(mapnik::get_image_reader(should_throw,*type)); + if (reader.get()) BOOST_TEST( false ); + } + catch (std::exception const&) + { + BOOST_TEST( true ); + } + + } + catch (std::exception const & ex) + { + std::clog << "C++ image i/o problem: " << ex.what() << "\n"; + BOOST_TEST(false); + } + + if (!::boost::detail::test_errors()) { + if (quiet) std::clog << "\x1b[1;32m.\x1b[0m"; + else std::clog << "C++ image i/o: \x1b[1;32m✓ \x1b[0m\n"; +#if BOOST_VERSION >= 104600 + ::boost::detail::report_errors_remind().called_report_errors_function = true; +#endif + } else { + return ::boost::report_errors(); + } +} diff -Nru mapnik-2.1.0/tests/cpp_tests/label_algo_test.cpp mapnik-2.2.0/tests/cpp_tests/label_algo_test.cpp --- mapnik-2.1.0/tests/cpp_tests/label_algo_test.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/label_algo_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -3,10 +3,18 @@ #include #include #include +#include +#include - -int main( int, char*[] ) +int main(int argc, char** argv) { + std::vector args; + for (int i=1;i= 104600 ::boost::detail::report_errors_remind().called_report_errors_function = true; #endif diff -Nru mapnik-2.1.0/tests/cpp_tests/map_request_test.cpp mapnik-2.2.0/tests/cpp_tests/map_request_test.cpp --- mapnik-2.1.0/tests/cpp_tests/map_request_test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/map_request_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,170 @@ +#include +#include + +#include +#include +#include +#include +#if defined(HAVE_CAIRO) +#include +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "utils.hpp" + +bool compare_images(std::string const& src_fn,std::string const& dest_fn) +{ + using namespace mapnik; + std::auto_ptr reader1(mapnik::get_image_reader(dest_fn,"png")); + if (!reader1.get()) + { + throw mapnik::image_reader_exception("Failed to load: " + dest_fn); + } + boost::shared_ptr image_ptr1 = boost::make_shared(reader1->width(),reader1->height()); + reader1->read(0,0,image_ptr1->data()); + + std::auto_ptr reader2(mapnik::get_image_reader(src_fn,"png")); + if (!reader2.get()) + { + throw mapnik::image_reader_exception("Failed to load: " + src_fn); + } + boost::shared_ptr image_ptr2 = boost::make_shared(reader2->width(),reader2->height()); + reader2->read(0,0,image_ptr2->data()); + + image_data_32 const& dest = image_ptr1->data(); + image_data_32 const& src = image_ptr2->data(); + + unsigned int width = src.width(); + unsigned int height = src.height(); + if ((width != dest.width()) || height != dest.height()) return false; + for (unsigned int y = 0; y < height; ++y) + { + const unsigned int* row_from = src.getRow(y); + const unsigned int* row_to = dest.getRow(y); + for (unsigned int x = 0; x < width; ++x) + { + if (row_from[x] != row_to[x]) return false; + } + } + return true; +} + +int main(int argc, char** argv) +{ + std::vector args; + for (int i=1;i renderer1(m,im,scale_factor); + renderer1.apply(); + std::string actual1("/tmp/map-request-marker-text-line-actual1.png"); + //mapnik::save_to_file(im,expected); + mapnik::save_to_file(im,actual1); + BOOST_TEST(compare_images(actual1,expected)); + + // reset image + im.clear(); + + // set up a mapnik::request object + mapnik::request req(m.width(),m.height(),m.get_current_extent()); + req.set_buffer_size(m.buffer_size()); + + // render using apply() and mapnik::request + mapnik::agg_renderer renderer2(m,req,im,scale_factor); + renderer2.apply(); + std::string actual2("/tmp/map-request-marker-text-line-actual2.png"); + mapnik::save_to_file(im,actual2); + BOOST_TEST(compare_images(actual2,expected)); + + // reset image + im.clear(); + + // render with apply_to_layer api and mapnik::request params passed to apply_to_layer + mapnik::agg_renderer renderer3(m,req,im,scale_factor); + renderer3.start_map_processing(m); + mapnik::projection map_proj(m.srs(),true); + double scale_denom = mapnik::scale_denominator(req.scale(),map_proj.is_geographic()); + scale_denom *= scale_factor; + BOOST_FOREACH ( mapnik::layer const& lyr, m.layers() ) + { + if (lyr.visible(scale_denom)) + { + std::set names; + renderer3.apply_to_layer(lyr, + renderer3, + map_proj, + req.scale(), + scale_denom, + req.width(), + req.height(), + req.extent(), + req.buffer_size(), + names); + + } + } + renderer3.end_map_processing(m); + std::string actual3("/tmp/map-request-marker-text-line-actual3.png"); + mapnik::save_to_file(im,actual3); + BOOST_TEST(compare_images(actual3,expected)); + + // also test cairo +#if defined(HAVE_CAIRO) + mapnik::cairo_surface_ptr image_surface( + cairo_image_surface_create(CAIRO_FORMAT_ARGB32,req.width(),req.height()), + mapnik::cairo_surface_closer()); + mapnik::cairo_ptr image_context = (mapnik::create_context(image_surface)); + mapnik::cairo_renderer png_render(m,req,image_context,scale_factor); + png_render.apply(); + //cairo_surface_write_to_png(&*image_surface, expected_cairo.c_str()); + std::string actual_cairo("/tmp/map-request-marker-text-line-actual4.png"); + cairo_surface_write_to_png(&*image_surface, actual_cairo.c_str()); + BOOST_TEST(compare_images(actual_cairo,expected_cairo)); +#endif + // TODO - test grid_renderer + + } catch (std::exception const& ex) { + std::clog << ex.what() << "\n"; + } + */ + if (!::boost::detail::test_errors()) { + if (quiet) std::clog << "\x1b[1;32m.\x1b[0m"; + else std::clog << "C++ Map Request rendering hook: \x1b[1;32m✓ \x1b[0m\n"; +#if BOOST_VERSION >= 104600 + ::boost::detail::report_errors_remind().called_report_errors_function = true; +#endif + } else { + return ::boost::report_errors(); + } +} diff -Nru mapnik-2.1.0/tests/cpp_tests/params_test.cpp mapnik-2.2.0/tests/cpp_tests/params_test.cpp --- mapnik-2.1.0/tests/cpp_tests/params_test.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/params_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -1,26 +1,36 @@ #include #include #include +#include #include #include +#include +#include +#include -int main( int, char*[] ) +int main(int argc, char** argv) { + std::vector args; + for (int i=1;i("bool") && *params.get("bool") == true)); + //params["bool"] = true; + //BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); params["bool"] = "true"; BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); - params["bool"] = 1; - BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); + //params["bool"] = 1; + //BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); - params["bool"] = "1"; - BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); + //params["bool"] = "1"; + //BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); params["bool"] = "True"; BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); @@ -32,17 +42,17 @@ BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); // false - params["bool"] = false; - BOOST_TEST( (params.get("bool") && *params.get("bool") == false) ); + //params["bool"] = false; + //BOOST_TEST( (params.get("bool") && *params.get("bool") == false) ); params["bool"] = "false"; BOOST_TEST( (params.get("bool") && *params.get("bool") == false) ); - params["bool"] = 0; - BOOST_TEST( (params.get("bool") && *params.get("bool") == false)); + //params["bool"] = 0; + //BOOST_TEST( (params.get("bool") && *params.get("bool") == false)); - params["bool"] = "0"; - BOOST_TEST( (params.get("bool") && *params.get("bool") == false)); + //params["bool"] = "0"; + //BOOST_TEST( (params.get("bool") && *params.get("bool") == false)); params["bool"] = "False"; BOOST_TEST( (params.get("bool") && *params.get("bool") == false)); @@ -58,8 +68,8 @@ BOOST_TEST( (params.get("string") && *params.get("string") == "hello") ); // int - params["int"] = 1; - BOOST_TEST( (params.get("int") && *params.get("int") == 1) ); + params["int"] = mapnik::value_integer(1); + BOOST_TEST( (params.get("int") && *params.get("int") == 1) ); // double params["double"] = 1.5; @@ -70,7 +80,8 @@ //BOOST_TEST( (params.get("null")/* && *params.get("null") == mapnik::value_null()*/) ); if (!::boost::detail::test_errors()) { - std::clog << "C++ parameters: \x1b[1;32m✓ \x1b[0m\n"; + if (quiet) std::clog << "\x1b[1;32m.\x1b[0m"; + else std::clog << "C++ parameters: \x1b[1;32m✓ \x1b[0m\n"; #if BOOST_VERSION >= 104600 ::boost::detail::report_errors_remind().called_report_errors_function = true; #endif Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/cpp_tests/support/map-request-marker-text-line-expected-cairo.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/cpp_tests/support/map-request-marker-text-line-expected-cairo.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/cpp_tests/support/map-request-marker-text-line-expected.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/cpp_tests/support/map-request-marker-text-line-expected.png differ diff -Nru mapnik-2.1.0/tests/cpp_tests/svg_renderer_tests/combined_test.cpp mapnik-2.2.0/tests/cpp_tests/svg_renderer_tests/combined_test.cpp --- mapnik-2.1.0/tests/cpp_tests/svg_renderer_tests/combined_test.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/svg_renderer_tests/combined_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -5,7 +5,7 @@ // mapnik #include -#include +#include #include // std @@ -30,7 +30,7 @@ typedef svg_renderer > svg_ren; Map map(800, 600); - map.set_background(color_factory::from_string("white")); + map.set_background(parse_color("white")); std::ostringstream output_stream; std::ostream_iterator output_stream_iterator(output_stream); diff -Nru mapnik-2.1.0/tests/cpp_tests/svg_renderer_tests/compilation_test.cpp mapnik-2.2.0/tests/cpp_tests/svg_renderer_tests/compilation_test.cpp --- mapnik-2.1.0/tests/cpp_tests/svg_renderer_tests/compilation_test.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/svg_renderer_tests/compilation_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -5,7 +5,7 @@ // mapnik #include -#include +#include // std #include diff -Nru mapnik-2.1.0/tests/cpp_tests/svg_renderer_tests/file_output_test.cpp mapnik-2.2.0/tests/cpp_tests/svg_renderer_tests/file_output_test.cpp --- mapnik-2.1.0/tests/cpp_tests/svg_renderer_tests/file_output_test.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/svg_renderer_tests/file_output_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -14,14 +14,14 @@ // mapnik #include -#include +#include #include // stl #include #include -namespace filesystem = boost::filesystem; +namespace fs = boost::filesystem; /* * This test case tests the generation of an SVG document @@ -43,7 +43,7 @@ typedef svg_renderer > svg_ren; Map map(800, 600); - map.set_background(color_factory::from_string("blue")); + map.set_background(parse_color("blue")); std::string output_filename = "file_output_test_case.svg"; std::ofstream output_stream(output_filename.c_str()); @@ -57,10 +57,10 @@ output_stream.close(); - filesystem::path output_filename_path = - filesystem::system_complete(filesystem::path(".")) / filesystem::path(output_filename); + fs::path output_filename_path = + fs::system_complete(fs::path(".")) / fs::path(output_filename); - BOOST_CHECK_MESSAGE(filesystem::exists(output_filename_path), "File '"+output_filename_path.string()+"' was created."); + BOOST_CHECK_MESSAGE(fs::exists(output_filename_path), "File '"+output_filename_path.string()+"' was created."); } else { diff -Nru mapnik-2.1.0/tests/cpp_tests/svg_renderer_tests/path_element_test.cpp mapnik-2.2.0/tests/cpp_tests/svg_renderer_tests/path_element_test.cpp --- mapnik-2.1.0/tests/cpp_tests/svg_renderer_tests/path_element_test.cpp 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/svg_renderer_tests/path_element_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -3,17 +3,15 @@ // boost.test #include -// boost.spirit -#include - // boost.filesystem #include // mapnik #include -#include +#include +#include +#include #include -#include #include #include @@ -21,14 +19,14 @@ #include #include -namespace filesystem = boost::filesystem; +namespace fs = boost::filesystem; using namespace mapnik; void prepare_map(Map& m) { const std::string mapnik_dir("/usr/local/lib/mapnik/"); std::cout << " looking for 'shape.input' plugin in... " << mapnik_dir << "input/" << "\n"; - datasource_cache::instance()->register_datasources(mapnik_dir + "input/"); + datasource_cache::instance().register_datasources(mapnik_dir + "input/"); // create styles @@ -135,7 +133,7 @@ p["file"]="../../../demo/data/boundaries"; layer lyr("Provinces"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("provinces"); m.addLayer(lyr); } @@ -146,7 +144,7 @@ p["type"]="shape"; p["file"]="../../../demo/data/qcdrainage"; layer lyr("Quebec Hydrography"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("drainage"); m.addLayer(lyr); } @@ -157,7 +155,7 @@ p["file"]="../../../demo/data/ontdrainage"; layer lyr("Ontario Hydrography"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("drainage"); m.addLayer(lyr); } @@ -168,7 +166,7 @@ p["type"]="shape"; p["file"]="../../../demo/data/boundaries_l"; layer lyr("Provincial borders"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("provlines"); m.addLayer(lyr); } @@ -179,7 +177,7 @@ p["type"]="shape"; p["file"]="../../../demo/data/roads"; layer lyr("Roads"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("smallroads"); lyr.add_style("road-border"); lyr.add_style("road-fill"); @@ -205,10 +203,10 @@ output_stream.close(); - filesystem::path output_filename_path = - filesystem::system_complete(filesystem::path(".")) / filesystem::path(output_filename); + fs::path output_filename_path = + fs::system_complete(fs::path(".")) / fs::path(output_filename); - BOOST_CHECK_MESSAGE(filesystem::exists(output_filename_path), + BOOST_CHECK_MESSAGE(fs::exists(output_filename_path), "File '"+output_filename_path.string()+"' was created."); } else @@ -220,7 +218,7 @@ BOOST_AUTO_TEST_CASE(path_element_test_case_1) { Map m(800,600); - m.set_background(color_factory::from_string("steelblue")); + m.set_background(parse_color("steelblue")); prepare_map(m); diff -Nru mapnik-2.1.0/tests/cpp_tests/utils.hpp mapnik-2.2.0/tests/cpp_tests/utils.hpp --- mapnik-2.1.0/tests/cpp_tests/utils.hpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/utils.hpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,26 @@ +#include +#include +#include +#include +#include + +inline static bool set_working_dir(std::vector args) +{ + std::vector::iterator itr = std::find(args.begin(), args.end(), "-d"); + if (itr!=args.end()) + { + unsigned dist = std::distance(args.begin(),itr); + if (args.size() > dist+1) + { + std::string chdir = args.at(dist+1); + bool exists = mapnik::util::exists( chdir ); + if (exists) + { + boost::filesystem::current_path(chdir); + return true; + } + } + return false; + } + return true; +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/cpp_tests/wkb_formats_test.cpp mapnik-2.2.0/tests/cpp_tests/wkb_formats_test.cpp --- mapnik-2.1.0/tests/cpp_tests/wkb_formats_test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/cpp_tests/wkb_formats_test.cpp 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,127 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +int main(int argc, char** argv) +{ + std::vector args; + for (int i=1;ipaths(), + (const char*)sp_valid_blob, + sizeof(sp_valid_blob) / sizeof(sp_valid_blob[0]), + mapnik::wkbSpatiaLite) + ); + + BOOST_TEST( + mapnik::geometry_utils::from_wkb(feature->paths(), + (const char*)sp_valid_blob, + sizeof(sp_valid_blob) / sizeof(sp_valid_blob[0]), + mapnik::wkbAuto) + ); + + BOOST_TEST( + mapnik::geometry_utils::from_wkb(feature->paths(), + (const char*)sp_invalid_blob, + sizeof(sp_invalid_blob) / sizeof(sp_invalid_blob[0]), + mapnik::wkbAuto) == false + ); + + // sqlite generic wkb blob + BOOST_TEST( + mapnik::geometry_utils::from_wkb(feature->paths(), + (const char*)sq_valid_blob, + sizeof(sq_valid_blob) / sizeof(sq_valid_blob[0]), + mapnik::wkbGeneric) + ); + + BOOST_TEST( + mapnik::geometry_utils::from_wkb(feature->paths(), + (const char*)sq_valid_blob, + sizeof(sq_valid_blob) / sizeof(sq_valid_blob[0]), + mapnik::wkbAuto) + ); + + BOOST_TEST( + mapnik::geometry_utils::from_wkb(feature->paths(), + (const char*)sq_invalid_blob, + sizeof(sq_invalid_blob) / sizeof(sq_invalid_blob[0]), + mapnik::wkbGeneric) == false + ); + + } catch (std::exception const& ex) { + BOOST_TEST(false); + std::clog << "threw: " << ex.what() << "\n"; + } + + if (!::boost::detail::test_errors()) { + if (quiet) std::clog << "\x1b[1;32m.\x1b[0m"; + else std::clog << "C++ CSV parse: \x1b[1;32m✓ \x1b[0m\n"; +#if BOOST_VERSION >= 104600 + ::boost::detail::report_errors_remind().called_report_errors_function = true; +#endif + } else { + return ::boost::report_errors(); + } +} diff -Nru mapnik-2.1.0/tests/data/broken_maps/bool_value_broken.xml mapnik-2.2.0/tests/data/broken_maps/bool_value_broken.xml --- mapnik-2.1.0/tests/data/broken_maps/bool_value_broken.xml 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/tests/data/broken_maps/bool_value_broken.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,5 +1,5 @@ - + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/data/broken_maps/xml_tag_mismatch.xml mapnik-2.2.0/tests/data/broken_maps/xml_tag_mismatch.xml --- mapnik-2.1.0/tests/data/broken_maps/xml_tag_mismatch.xml 2012-08-23 21:57:06.000000000 +0000 +++ mapnik-2.2.0/tests/data/broken_maps/xml_tag_mismatch.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,6 +1,6 @@ - + - + style ../../data/shp/world_merc diff -Nru mapnik-2.1.0/tests/data/good_maps/agg_stack_blur.xml mapnik-2.2.0/tests/data/good_maps/agg_stack_blur.xml --- mapnik-2.1.0/tests/data/good_maps/agg_stack_blur.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/agg_stack_blur.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,4 +1,4 @@ - + - + style style2 diff -Nru mapnik-2.1.0/tests/data/good_maps/also_and_else_filter.xml mapnik-2.2.0/tests/data/good_maps/also_and_else_filter.xml --- mapnik-2.1.0/tests/data/good_maps/also_and_else_filter.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/also_and_else_filter.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,17 +1,17 @@ - + diff -Nru mapnik-2.1.0/tests/data/good_maps/bool_values.xml mapnik-2.2.0/tests/data/good_maps/bool_values.xml --- mapnik-2.1.0/tests/data/good_maps/bool_values.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/bool_values.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,43 +1,43 @@ - + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/data/good_maps/bounds_clipping.xml mapnik-2.2.0/tests/data/good_maps/bounds_clipping.xml --- mapnik-2.1.0/tests/data/good_maps/bounds_clipping.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/bounds_clipping.xml 2013-06-04 01:35:27.000000000 +0000 @@ -13,7 +13,7 @@ +proj=krovak +lat_0=49.5 +lon_0=24.83333333333333 +alpha=30.28813975277778 +k=0.9999 +x_0=0 +y_0=0 +ellps=bessel +units=m +towgs84=498.17,136.89,510.08,6.007,4.343,3.831,3.38 +no_defs ---> +--> - + style base diff -Nru mapnik-2.1.0/tests/data/good_maps/interior_point.xml mapnik-2.2.0/tests/data/good_maps/interior_point.xml --- mapnik-2.1.0/tests/data/good_maps/interior_point.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/interior_point.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,4 +1,4 @@ - + - + multipolygon_style sqlite diff -Nru mapnik-2.1.0/tests/data/good_maps/layer_buffer_size_reduction.xml mapnik-2.2.0/tests/data/good_maps/layer_buffer_size_reduction.xml --- mapnik-2.1.0/tests/data/good_maps/layer_buffer_size_reduction.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/layer_buffer_size_reduction.xml 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,17 @@ + + + + point_style + + sqlite + ../sqlite/qgis_spatiallite.sqlite + point + + + + diff -Nru mapnik-2.1.0/tests/data/good_maps/line_symbolizer.xml mapnik-2.2.0/tests/data/good_maps/line_symbolizer.xml --- mapnik-2.1.0/tests/data/good_maps/line_symbolizer.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/line_symbolizer.xml 2013-06-04 01:35:27.000000000 +0000 @@ -6,14 +6,14 @@ - + test - + shape ../../data/shp/poly.shp diff -Nru mapnik-2.1.0/tests/data/good_maps/line_symbolizer2.xml mapnik-2.2.0/tests/data/good_maps/line_symbolizer2.xml --- mapnik-2.1.0/tests/data/good_maps/line_symbolizer2.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/line_symbolizer2.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,4 +1,4 @@ - + sqlite @@ -12,7 +12,7 @@ - + polygon_style multipolygon @@ -26,7 +26,7 @@ - + line_style lines diff -Nru mapnik-2.1.0/tests/data/good_maps/line_symbolizer_offset.xml mapnik-2.2.0/tests/data/good_maps/line_symbolizer_offset.xml --- mapnik-2.1.0/tests/data/good_maps/line_symbolizer_offset.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/line_symbolizer_offset.xml 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,18 @@ + + + + style + + csv + + wkt,name + "MULTILINESTRING ((10 10, 20 20, 10 40),(40 40, 30 30, 40 20, 30 10))",line + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/data/good_maps/marker-text-line.xml mapnik-2.2.0/tests/data/good_maps/marker-text-line.xml --- mapnik-2.1.0/tests/data/good_maps/marker-text-line.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/marker-text-line.xml 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,103 @@ + + + + + + + + + ellipse + + csv + +x,y +2.5,2.5 + + + + + + line + + csv + +wkt +"LINESTRING(0 0, 2.5 2.5, 5 5)" +"LINESTRING(0 5, 2.5 2.5, 5 0)" + + + + + + text + + csv + +x,y +2,2.5 +3,2.5 + + + + + + + + + + frame + + csv + +x,y +0,0 +5,0 +0,5 +5,5 + + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/data/good_maps/marker_ellipse_transform.xml mapnik-2.2.0/tests/data/good_maps/marker_ellipse_transform.xml --- mapnik-2.1.0/tests/data/good_maps/marker_ellipse_transform.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/marker_ellipse_transform.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,4 +1,4 @@ - + - + ellipse csv @@ -49,7 +49,7 @@ - + frame csv diff -Nru mapnik-2.1.0/tests/data/good_maps/marker_ellipse_transform2.xml mapnik-2.2.0/tests/data/good_maps/marker_ellipse_transform2.xml --- mapnik-2.1.0/tests/data/good_maps/marker_ellipse_transform2.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/marker_ellipse_transform2.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,4 +1,4 @@ - + - + ellipse csv @@ -49,7 +49,7 @@ - + frame csv diff -Nru mapnik-2.1.0/tests/data/good_maps/markers_symbolizer_lines.xml mapnik-2.2.0/tests/data/good_maps/markers_symbolizer_lines.xml --- mapnik-2.1.0/tests/data/good_maps/markers_symbolizer_lines.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/markers_symbolizer_lines.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,5 +1,5 @@ - + - + 1 sqlite diff -Nru mapnik-2.1.0/tests/data/good_maps/markers_symbolizer_lines_file.xml mapnik-2.2.0/tests/data/good_maps/markers_symbolizer_lines_file.xml --- mapnik-2.1.0/tests/data/good_maps/markers_symbolizer_lines_file.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/markers_symbolizer_lines_file.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,5 +1,5 @@ - + - + 1 sqlite diff -Nru mapnik-2.1.0/tests/data/good_maps/markers_symbolizer_points.xml mapnik-2.2.0/tests/data/good_maps/markers_symbolizer_points.xml --- mapnik-2.1.0/tests/data/good_maps/markers_symbolizer_points.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/markers_symbolizer_points.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,5 +1,5 @@ - + - + 1 sqlite @@ -46,7 +46,7 @@ - + meta_point_bboxs ogr diff -Nru mapnik-2.1.0/tests/data/good_maps/markers_symbolizer_points_file.xml mapnik-2.2.0/tests/data/good_maps/markers_symbolizer_points_file.xml --- mapnik-2.1.0/tests/data/good_maps/markers_symbolizer_points_file.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/markers_symbolizer_points_file.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,12 +1,12 @@ - + - + 1 sqlite @@ -21,7 +21,7 @@ - + meta_point_bboxs ogr diff -Nru mapnik-2.1.0/tests/data/good_maps/markers_symbolizer_points_gradient.xml mapnik-2.2.0/tests/data/good_maps/markers_symbolizer_points_gradient.xml --- mapnik-2.1.0/tests/data/good_maps/markers_symbolizer_points_gradient.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/markers_symbolizer_points_gradient.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,4 +1,4 @@ - + - + 1 sqlite diff -Nru mapnik-2.1.0/tests/data/good_maps/markers_symbolizer_points_stacked.xml mapnik-2.2.0/tests/data/good_maps/markers_symbolizer_points_stacked.xml --- mapnik-2.1.0/tests/data/good_maps/markers_symbolizer_points_stacked.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/markers_symbolizer_points_stacked.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,4 +1,4 @@ - + - + 1 sqlite diff -Nru mapnik-2.1.0/tests/data/good_maps/merc2wgs84_reprojection.xml mapnik-2.2.0/tests/data/good_maps/merc2wgs84_reprojection.xml --- mapnik-2.1.0/tests/data/good_maps/merc2wgs84_reprojection.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/merc2wgs84_reprojection.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,11 +1,11 @@ - + - + My Style shape diff -Nru mapnik-2.1.0/tests/data/good_maps/osm-styles.xml mapnik-2.2.0/tests/data/good_maps/osm-styles.xml --- mapnik-2.1.0/tests/data/good_maps/osm-styles.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/osm-styles.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,5 +1,5 @@ - + - + red osm @@ -23,7 +23,7 @@ - + green osm diff -Nru mapnik-2.1.0/tests/data/good_maps/paths_relative_to_script.xml mapnik-2.2.0/tests/data/good_maps/paths_relative_to_script.xml --- mapnik-2.1.0/tests/data/good_maps/paths_relative_to_script.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/paths_relative_to_script.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - - - - ../data/shp/poly.shp - shape - - - - \ No newline at end of file diff -Nru mapnik-2.1.0/tests/data/good_maps/paths_relative_to_xml.xml mapnik-2.2.0/tests/data/good_maps/paths_relative_to_xml.xml --- mapnik-2.1.0/tests/data/good_maps/paths_relative_to_xml.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/paths_relative_to_xml.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,7 +1,7 @@ - + ../shp/poly.shp shape diff -Nru mapnik-2.1.0/tests/data/good_maps/point_csv.xml mapnik-2.2.0/tests/data/good_maps/point_csv.xml --- mapnik-2.1.0/tests/data/good_maps/point_csv.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/point_csv.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,5 +1,5 @@ - + - + 1 ../vrt/points.vrt diff -Nru mapnik-2.1.0/tests/data/good_maps/point_json.xml mapnik-2.2.0/tests/data/good_maps/point_json.xml --- mapnik-2.1.0/tests/data/good_maps/point_json.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/point_json.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,5 +1,5 @@ - + - + 1 ../json/points.json diff -Nru mapnik-2.1.0/tests/data/good_maps/point_json_inline.xml mapnik-2.2.0/tests/data/good_maps/point_json_inline.xml --- mapnik-2.1.0/tests/data/good_maps/point_json_inline.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/point_json_inline.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,5 +1,5 @@ - + - + 1 diff -Nru mapnik-2.1.0/tests/data/good_maps/point_symbolizer.xml mapnik-2.2.0/tests/data/good_maps/point_symbolizer.xml --- mapnik-2.1.0/tests/data/good_maps/point_symbolizer.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/point_symbolizer.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,5 +1,5 @@ - + - + 1 sqlite diff -Nru mapnik-2.1.0/tests/data/good_maps/point_symbolizer_ignore_placements.xml mapnik-2.2.0/tests/data/good_maps/point_symbolizer_ignore_placements.xml --- mapnik-2.1.0/tests/data/good_maps/point_symbolizer_ignore_placements.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/point_symbolizer_ignore_placements.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,5 +1,5 @@ - + - + 1 sqlite diff -Nru mapnik-2.1.0/tests/data/good_maps/polygon_pattern_seamless.xml mapnik-2.2.0/tests/data/good_maps/polygon_pattern_seamless.xml --- mapnik-2.1.0/tests/data/good_maps/polygon_pattern_seamless.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/polygon_pattern_seamless.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,4 +1,4 @@ - + - + style ../../data/shp/world_merc diff -Nru mapnik-2.1.0/tests/data/good_maps/raster-alpha-gradient.xml mapnik-2.2.0/tests/data/good_maps/raster-alpha-gradient.xml --- mapnik-2.1.0/tests/data/good_maps/raster-alpha-gradient.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/raster-alpha-gradient.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - - - - - - - transp - - ../raster/transp.tiff - gdal - - - - \ No newline at end of file diff -Nru mapnik-2.1.0/tests/data/good_maps/raster-alpha.xml mapnik-2.2.0/tests/data/good_maps/raster-alpha.xml --- mapnik-2.1.0/tests/data/good_maps/raster-alpha.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/raster-alpha.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - - - - - - - white - - ../raster/white-alpha.tiff - gdal - - - - \ No newline at end of file diff -Nru mapnik-2.1.0/tests/data/good_maps/rtl_text_map.xml mapnik-2.2.0/tests/data/good_maps/rtl_text_map.xml --- mapnik-2.1.0/tests/data/good_maps/rtl_text_map.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/rtl_text_map.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,4 +1,4 @@ - + @@ -9,7 +9,7 @@ - + custom_font ../shp/farsi-labels diff -Nru mapnik-2.1.0/tests/data/good_maps/shield_symbolizer.xml mapnik-2.2.0/tests/data/good_maps/shield_symbolizer.xml --- mapnik-2.1.0/tests/data/good_maps/shield_symbolizer.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/shield_symbolizer.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,5 +1,5 @@ - + - + 2 ../json/lines.json @@ -26,7 +26,7 @@ - + 1 ../json/points.json diff -Nru mapnik-2.1.0/tests/data/good_maps/sqlite.xml mapnik-2.2.0/tests/data/good_maps/sqlite.xml --- mapnik-2.1.0/tests/data/good_maps/sqlite.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/sqlite.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,4 +1,4 @@ - + - + world_borders_style1 world_borders_style2 @@ -32,7 +32,7 @@ - + point_style sqlite diff -Nru mapnik-2.1.0/tests/data/good_maps/style_level_comp_op.xml mapnik-2.2.0/tests/data/good_maps/style_level_comp_op.xml --- mapnik-2.1.0/tests/data/good_maps/style_level_comp_op.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/style_level_comp_op.xml 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,49 @@ + + + + + + + + land + + shape + ../shp/new_zealand/ne_50m_land.shp + + + + + markers + + shape + ../shp/new_zealand/ne_50m_populated_places_simple.shp + + + + diff -Nru mapnik-2.1.0/tests/data/good_maps/style_level_image_filter.xml mapnik-2.2.0/tests/data/good_maps/style_level_image_filter.xml --- mapnik-2.1.0/tests/data/good_maps/style_level_image_filter.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/style_level_image_filter.xml 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,68 @@ + + + + + + + + + + land + + shape + ../shp/new_zealand/ne_50m_land.shp + + + + + markers + labels + + shape + ../shp/new_zealand/ne_50m_populated_places_simple.shp + + + + diff -Nru mapnik-2.1.0/tests/data/good_maps/style_level_opacity_and_blur.xml mapnik-2.2.0/tests/data/good_maps/style_level_opacity_and_blur.xml --- mapnik-2.1.0/tests/data/good_maps/style_level_opacity_and_blur.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/style_level_opacity_and_blur.xml 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + style + style2 + + ../shp/world_merc + shape + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/data/good_maps/text_breaks.xml mapnik-2.2.0/tests/data/good_maps/text_breaks.xml --- mapnik-2.1.0/tests/data/good_maps/text_breaks.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/text_breaks.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,5 +1,5 @@ - + - + 1 diff -Nru mapnik-2.1.0/tests/data/good_maps/text_halo_and_collision.xml mapnik-2.2.0/tests/data/good_maps/text_halo_and_collision.xml --- mapnik-2.1.0/tests/data/good_maps/text_halo_and_collision.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/text_halo_and_collision.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,4 +1,4 @@ - + - + labels csv @@ -35,7 +35,7 @@ - + frame csv diff -Nru mapnik-2.1.0/tests/data/good_maps/text_rotation.xml mapnik-2.2.0/tests/data/good_maps/text_rotation.xml --- mapnik-2.1.0/tests/data/good_maps/text_rotation.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/text_rotation.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,4 +1,4 @@ - + - + labels sqlite diff -Nru mapnik-2.1.0/tests/data/good_maps/wgs842merc_reprojection.xml mapnik-2.2.0/tests/data/good_maps/wgs842merc_reprojection.xml --- mapnik-2.1.0/tests/data/good_maps/wgs842merc_reprojection.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/wgs842merc_reprojection.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,10 +1,10 @@ - + - + My Style shape diff -Nru mapnik-2.1.0/tests/data/good_maps/xinclude/layers.xml mapnik-2.2.0/tests/data/good_maps/xinclude/layers.xml --- mapnik-2.1.0/tests/data/good_maps/xinclude/layers.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/xinclude/layers.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,7 +1,7 @@ - + world_borders_style point_style diff -Nru mapnik-2.1.0/tests/data/good_maps/xinclude/layers_with_entities.xml mapnik-2.2.0/tests/data/good_maps/xinclude/layers_with_entities.xml --- mapnik-2.1.0/tests/data/good_maps/xinclude/layers_with_entities.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/xinclude/layers_with_entities.xml 2013-06-04 01:35:27.000000000 +0000 @@ -3,7 +3,7 @@ - + world_borders_style point_style diff -Nru mapnik-2.1.0/tests/data/good_maps/xinclude/map.xml mapnik-2.2.0/tests/data/good_maps/xinclude/map.xml --- mapnik-2.1.0/tests/data/good_maps/xinclude/map.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/xinclude/map.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,6 +1,6 @@ - + diff -Nru mapnik-2.1.0/tests/data/good_maps/xinclude/map_with_entities_and_includes.xml mapnik-2.2.0/tests/data/good_maps/xinclude/map_with_entities_and_includes.xml --- mapnik-2.1.0/tests/data/good_maps/xinclude/map_with_entities_and_includes.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/good_maps/xinclude/map_with_entities_and_includes.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,6 +1,6 @@ - + Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/images/12_654_1580.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/images/12_654_1580.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/images/xcode-CgBI.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/images/xcode-CgBI.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/images/yellow_half_trans.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/images/yellow_half_trans.png differ diff -Nru mapnik-2.1.0/tests/data/json/null_feature.json mapnik-2.2.0/tests/data/json/null_feature.json --- mapnik-2.1.0/tests/data/json/null_feature.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/json/null_feature.json 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,12 @@ +{ "type": "FeatureCollection", + "features": [ + { "type": "Feature", + "geometry": {"type": "Point"}, + "properties": {"feat_id": 0} + }, + { "type": "Feature", + "geometry": {"type": "Point", "coordinates":[0,0]}, + "properties": {"feat_id": 1} + } +] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/data/osm/64bit.osm mapnik-2.2.0/tests/data/osm/64bit.osm --- mapnik-2.1.0/tests/data/osm/64bit.osm 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/osm/64bit.osm 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/palettes/palette256.act and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/palettes/palette256.act differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/palettes/palette64.act and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/palettes/palette64.act differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/pngsuite/xcsn0g01.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/pngsuite/xcsn0g01.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/pngsuite/xhdn0g08.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/pngsuite/xhdn0g08.png differ diff -Nru mapnik-2.1.0/tests/data/python_plugin/python_circle_datasource.xml mapnik-2.2.0/tests/data/python_plugin/python_circle_datasource.xml --- mapnik-2.1.0/tests/data/python_plugin/python_circle_datasource.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/python_plugin/python_circle_datasource.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,5 +1,5 @@ - + - + 1 python @@ -26,7 +26,7 @@ - + 2 python @@ -36,7 +36,7 @@ - + 3 python diff -Nru mapnik-2.1.0/tests/data/python_plugin/python_point_datasource.xml mapnik-2.2.0/tests/data/python_plugin/python_point_datasource.xml --- mapnik-2.1.0/tests/data/python_plugin/python_point_datasource.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/data/python_plugin/python_point_datasource.xml 2013-06-04 01:35:27.000000000 +0000 @@ -1,5 +1,5 @@ - + - + 1 python Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/raster/nodata-edge.tif and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/raster/nodata-edge.tif differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/raster/river.tiff and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/raster/river.tiff differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/raster/river_merc.tiff and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/raster/river_merc.tiff differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/raster/river_wgs.tiff and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/raster/river_wgs.tiff differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/raster/white-alpha-assoc-alpha-correct.tiff and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/raster/white-alpha-assoc-alpha-correct.tiff differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/raster/white-alpha-assoc-alpha-wrong.tiff and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/raster/white-alpha-assoc-alpha-wrong.tiff differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/raster/white-alpha.tiff and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/raster/white-alpha.tiff differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/charplacement.dbf and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/charplacement.dbf differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/charplacement.shp and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/charplacement.shp differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/charplacement.shx and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/charplacement.shx differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/displacement.dbf and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/displacement.dbf differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/displacement.shp and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/displacement.shp differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/displacement.shx and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/displacement.shx differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/long_lat.dbf and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/long_lat.dbf differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/long_lat.dbt and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/long_lat.dbt differ diff -Nru mapnik-2.1.0/tests/data/shp/long_lat.prj mapnik-2.2.0/tests/data/shp/long_lat.prj --- mapnik-2.1.0/tests/data/shp/long_lat.prj 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/shp/long_lat.prj 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/long_lat.shp and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/long_lat.shp differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/long_lat.shx and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/long_lat.shx differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/new_zealand/ne_50m_land.dbf and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/new_zealand/ne_50m_land.dbf differ diff -Nru mapnik-2.1.0/tests/data/shp/new_zealand/ne_50m_land.prj mapnik-2.2.0/tests/data/shp/new_zealand/ne_50m_land.prj --- mapnik-2.1.0/tests/data/shp/new_zealand/ne_50m_land.prj 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/shp/new_zealand/ne_50m_land.prj 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/new_zealand/ne_50m_land.shp and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/new_zealand/ne_50m_land.shp differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/new_zealand/ne_50m_land.shx and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/new_zealand/ne_50m_land.shx differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/new_zealand/ne_50m_populated_places_simple.dbf and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/new_zealand/ne_50m_populated_places_simple.dbf differ diff -Nru mapnik-2.1.0/tests/data/shp/new_zealand/ne_50m_populated_places_simple.prj mapnik-2.2.0/tests/data/shp/new_zealand/ne_50m_populated_places_simple.prj --- mapnik-2.1.0/tests/data/shp/new_zealand/ne_50m_populated_places_simple.prj 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/shp/new_zealand/ne_50m_populated_places_simple.prj 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/new_zealand/ne_50m_populated_places_simple.shp and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/new_zealand/ne_50m_populated_places_simple.shp differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/new_zealand/ne_50m_populated_places_simple.shx and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/new_zealand/ne_50m_populated_places_simple.shx differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/overlap.dbf and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/overlap.dbf differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/overlap.shp and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/overlap.shp differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/overlap.shx and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/overlap.shx differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/points/ogr_zfield.dbf and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/points/ogr_zfield.dbf differ diff -Nru mapnik-2.1.0/tests/data/shp/points/ogr_zfield.prj mapnik-2.2.0/tests/data/shp/points/ogr_zfield.prj --- mapnik-2.1.0/tests/data/shp/points/ogr_zfield.prj 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/shp/points/ogr_zfield.prj 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/points/ogr_zfield.shp and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/points/ogr_zfield.shp differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/points/ogr_zfield.shx and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/points/ogr_zfield.shx differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/points/poi.dbf and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/points/poi.dbf differ diff -Nru mapnik-2.1.0/tests/data/shp/points/poi.prj mapnik-2.2.0/tests/data/shp/points/poi.prj --- mapnik-2.1.0/tests/data/shp/points/poi.prj 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/shp/points/poi.prj 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1 @@ +PROJCS["NAD_1983_HARN_StatePlane_North_Carolina_FIPS_3200_Feet",GEOGCS["GCS_North_American_1983_HARN",DATUM["D_North_American_1983_HARN",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",2000000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-79.0],PARAMETER["Standard_Parallel_1",34.33333333333334],PARAMETER["Standard_Parallel_2",36.16666666666666],PARAMETER["Latitude_Of_Origin",33.75],UNIT["Foot_US",0.3048006096012192]] \ No newline at end of file Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/points/poi.shp and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/points/poi.shp differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/points/poi.shx and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/points/poi.shx differ diff -Nru mapnik-2.1.0/tests/data/shp/points/poi.xml mapnik-2.2.0/tests/data/shp/points/poi.xml --- mapnik-2.1.0/tests/data/shp/points/poi.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/shp/points/poi.xml 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1 @@ +20120921162140001.0FALSEpoi0020.000file://\\ba-projectman\drawings\GIS\gis_data\shapefiles\TileMill\poi.shpLocal Area NetworkProjectedGCS_North_American_1983_HARNLinear Unit: Foot_US (0.304801)NAD_1983_HARN_StatePlane_North_Carolina_FIPS_3200_Feet<ProjectedCoordinateSystem xsi:type='typens:ProjectedCoordinateSystem' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:typens='http://www.esri.com/schemas/ArcGIS/10.1'><WKT>PROJCS[&quot;NAD_1983_HARN_StatePlane_North_Carolina_FIPS_3200_Feet&quot;,GEOGCS[&quot;GCS_North_American_1983_HARN&quot;,DATUM[&quot;D_North_American_1983_HARN&quot;,SPHEROID[&quot;GRS_1980&quot;,6378137.0,298.257222101]],PRIMEM[&quot;Greenwich&quot;,0.0],UNIT[&quot;Degree&quot;,0.0174532925199433]],PROJECTION[&quot;Lambert_Conformal_Conic&quot;],PARAMETER[&quot;False_Easting&quot;,2000000.0],PARAMETER[&quot;False_Northing&quot;,0.0],PARAMETER[&quot;Central_Meridian&quot;,-79.0],PARAMETER[&quot;Standard_Parallel_1&quot;,34.33333333333334],PARAMETER[&quot;Standard_Parallel_2&quot;,36.16666666666666],PARAMETER[&quot;Latitude_Of_Origin&quot;,33.75],UNIT[&quot;Foot_US&quot;,0.3048006096012192],AUTHORITY[&quot;EPSG&quot;,3404]]</WKT><XOrigin>-121841900</XOrigin><YOrigin>-93659000</YOrigin><XYScale>36365718.124241434</XYScale><ZOrigin>-100000</ZOrigin><ZScale>10000</ZScale><MOrigin>-100000</MOrigin><MScale>10000</MScale><XYTolerance>0.0032808333333333331</XYTolerance><ZTolerance>0.001</ZTolerance><MTolerance>0.001</MTolerance><HighPrecision>true</HighPrecision><WKID>3359</WKID><LatestWKID>3404</LatestWKID></ProjectedCoordinateSystem>FeatureClassToFeatureClass Z:\GIS\gis_data\geodatabase\working\UNCW_GIS.gdb\land_status\main_campus_interest_point Z:\GIS\gis_data\shapefiles\TileMill poi.shp # "interst_id "PKInterstID" true true true 20 Text 0 0 ,First,#,Z:\GIS\gis_data\geodatabase\working\UNCW_GIS.gdb\land_status\main_campus_interest_point,interst_id,-1,-1;state_d "StateDOM" true true false 16 Text 0 0 ,First,#,Z:\GIS\gis_data\geodatabase\working\UNCW_GIS.gdb\land_status\main_campus_interest_point,state_d,-1,-1;cnty_name "CntyName" true true false 50 Text 0 0 ,First,#,Z:\GIS\gis_data\geodatabase\working\UNCW_GIS.gdb\land_status\main_campus_interest_point,cnty_name,-1,-1;latitude "Latitude" true true false 8 Double 0 0 ,First,#,Z:\GIS\gis_data\geodatabase\working\UNCW_GIS.gdb\land_status\main_campus_interest_point,latitude,-1,-1;longitude "Longitude" true true false 8 Double 0 0 ,First,#,Z:\GIS\gis_data\geodatabase\working\UNCW_GIS.gdb\land_status\main_campus_interest_point,longitude,-1,-1;Name "Name" true true false 50 Text 0 0 ,First,#,Z:\GIS\gis_data\geodatabase\working\UNCW_GIS.gdb\land_status\main_campus_interest_point,Name,-1,-1;Website "Website" true true false 100 Text 0 0 ,First,#,Z:\GIS\gis_data\geodatabase\working\UNCW_GIS.gdb\land_status\main_campus_interest_point,Website,-1,-1" #20121204105923002012120410592300Microsoft Windows 7 Version 6.1 (Build 7600) ; Esri ArcGIS 10.1.1.3143poiShapefile0.000datasetEPSG7.11.20SimpleFALSE0FALSETRUEpoiFeature Class0FIDFIDOID400Internal feature number.EsriSequential unique whole numbers that are automatically generated.ShapeShapeGeometry000Feature geometry.EsriCoordinates defining the features.interst_idinterst_idString2000state_dstate_dString1600cnty_namecnty_nameString5000latitudelatitudeDouble1900longitudelongitudeDouble1900NameNameString5000WebsiteWebsiteString1000020121204 Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/points/poi.zip and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/points/poi.zip differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/points/poi_ogr.dbf and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/points/poi_ogr.dbf differ diff -Nru mapnik-2.1.0/tests/data/shp/points/poi_ogr.prj mapnik-2.2.0/tests/data/shp/points/poi_ogr.prj --- mapnik-2.1.0/tests/data/shp/points/poi_ogr.prj 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/shp/points/poi_ogr.prj 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1 @@ +PROJCS["NAD_1983_HARN_StatePlane_North_Carolina_FIPS_3200_Feet",GEOGCS["GCS_North_American_1983_HARN",DATUM["D_North_American_1983_HARN",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.017453292519943295]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",2000000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-79.0],PARAMETER["Standard_Parallel_1",34.33333333333334],PARAMETER["Standard_Parallel_2",36.16666666666666],PARAMETER["Latitude_Of_Origin",33.75],UNIT["Foot_US",0.30480060960121924]] \ No newline at end of file Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/points/poi_ogr.shp and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/points/poi_ogr.shp differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/points/poi_ogr.shx and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/points/poi_ogr.shx differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/points/qgis.dbf and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/points/qgis.dbf differ diff -Nru mapnik-2.1.0/tests/data/shp/points/qgis.prj mapnik-2.2.0/tests/data/shp/points/qgis.prj --- mapnik-2.1.0/tests/data/shp/points/qgis.prj 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/shp/points/qgis.prj 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff -Nru mapnik-2.1.0/tests/data/shp/points/qgis.qpj mapnik-2.2.0/tests/data/shp/points/qgis.qpj --- mapnik-2.1.0/tests/data/shp/points/qgis.qpj 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/shp/points/qgis.qpj 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1 @@ +GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]] Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/points/qgis.shp and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/points/qgis.shp differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/points/qgis.shx and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/points/qgis.shx differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/points/qgis_multi.dbf and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/points/qgis_multi.dbf differ diff -Nru mapnik-2.1.0/tests/data/shp/points/qgis_multi.prj mapnik-2.2.0/tests/data/shp/points/qgis_multi.prj --- mapnik-2.1.0/tests/data/shp/points/qgis_multi.prj 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/shp/points/qgis_multi.prj 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff -Nru mapnik-2.1.0/tests/data/shp/points/qgis_multi.qpj mapnik-2.2.0/tests/data/shp/points/qgis_multi.qpj --- mapnik-2.1.0/tests/data/shp/points/qgis_multi.qpj 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/shp/points/qgis_multi.qpj 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1 @@ +GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]] Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/points/qgis_multi.shp and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/points/qgis_multi.shp differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/points/qgis_multi.shx and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/points/qgis_multi.shx differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/textspacing.dbf and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/textspacing.dbf differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/textspacing.shp and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/textspacing.shp differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/shp/textspacing.shx and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/shp/textspacing.shx differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/data/sqlite/64bit_int.sqlite and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/data/sqlite/64bit_int.sqlite differ diff -Nru mapnik-2.1.0/tests/data/svg/rect2.svg mapnik-2.2.0/tests/data/svg/rect2.svg --- mapnik-2.1.0/tests/data/svg/rect2.svg 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/data/svg/rect2.svg 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,39 @@ + + + + + + + + + image/svg+xml + + + + + + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/python_tests/box2d_test.py mapnik-2.2.0/tests/python_tests/box2d_test.py --- mapnik-2.1.0/tests/python_tests/box2d_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/box2d_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -3,9 +3,9 @@ import os from nose.tools import * +from utilities import execution_path, run_all import mapnik - def test_coord_init(): c = mapnik.Coord(100, 100) @@ -100,8 +100,34 @@ eq_(c.y, 150) def test_envelope_multiplication(): + # no width then no impact of multiplication + a = mapnik.Box2d(100, 100, 100, 100) + a *= 5 + eq_(a.minx,100) + eq_(a.miny,100) + eq_(a.maxx,100) + eq_(a.maxy,100) + + a = mapnik.Box2d(100.0, 100.0, 100.0, 100.0) + a *= 5 + eq_(a.minx,100) + eq_(a.miny,100) + eq_(a.maxx,100) + eq_(a.maxy,100) + + a = mapnik.Box2d(100.0, 100.0, 100.001, 100.001) + a *= 5 + assert_almost_equal(a.minx, 99.9979, places=3) + assert_almost_equal(a.miny, 99.9979, places=3) + assert_almost_equal(a.maxx, 100.0030, places=3) + assert_almost_equal(a.maxy, 100.0030, places=3) + e = mapnik.Box2d(100, 100, 200, 200) e *= 2 + eq_(e.minx,50) + eq_(e.miny,50) + eq_(e.maxx,250) + eq_(e.maxy,250) assert_true(e.contains(50, 50)) assert_true(e.contains(50, 250)) @@ -148,5 +174,4 @@ eq_(e1,e2) if __name__ == "__main__": - setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/buffer_clear_test.py mapnik-2.2.0/tests/python_tests/buffer_clear_test.py --- mapnik-2.1.0/tests/python_tests/buffer_clear_test.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/buffer_clear_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,63 @@ +import sys +import os, mapnik +from timeit import Timer, time +from nose.tools import * +from utilities import execution_path, run_all + +def setup(): + # All of the paths used are relative, if we run the tests + # from another directory we need to chdir() + os.chdir(execution_path('.')) + +def test_clearing_image_data(): + im = mapnik.Image(256,256) + # make sure it equals itself + bytes = im.tostring() + eq_(im.tostring(),bytes) + # set background, then clear + im.background = mapnik.Color('green') + eq_(im.tostring()!=bytes,True) + # clear image, should now equal original + im.clear() + eq_(im.tostring(),bytes) + +def make_map(): + ds = mapnik.MemoryDatasource() + context = mapnik.Context() + context.push('Name') + pixel_key = 1 + f = mapnik.Feature(context,pixel_key) + f['Name'] = str(pixel_key) + f.add_geometries_from_wkt('POLYGON ((0 0, 0 256, 256 256, 256 0, 0 0))') + ds.add_feature(f) + s = mapnik.Style() + r = mapnik.Rule() + symb = mapnik.PolygonSymbolizer() + r.symbols.append(symb) + s.rules.append(r) + lyr = mapnik.Layer('Places') + lyr.datasource = ds + lyr.styles.append('places_labels') + width,height = 256,256 + m = mapnik.Map(width,height) + m.append_style('places_labels',s) + m.layers.append(lyr) + m.zoom_all() + return m + +def test_clearing_grid_data(): + g = mapnik.Grid(256,256) + utf = g.encode() + # make sure it equals itself + eq_(g.encode(),utf) + m = make_map() + mapnik.render_layer(m,g,layer=0,fields=['__id__','Name']) + eq_(g.encode()!=utf,True) + # clear grid, should now match original + g.clear() + eq_(g.encode(),utf) + + +if __name__ == "__main__": + setup() + run_all(eval(x) for x in dir() if x.startswith("test_")) \ No newline at end of file diff -Nru mapnik-2.1.0/tests/python_tests/cairo_test.py mapnik-2.2.0/tests/python_tests/cairo_test.py --- mapnik-2.1.0/tests/python_tests/cairo_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/cairo_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -3,14 +3,14 @@ import os import mapnik from nose.tools import * -from utilities import execution_path +from utilities import execution_path, run_all def setup(): # All of the paths used are relative, if we run the tests # from another directory we need to chdir() os.chdir(execution_path('.')) -if mapnik.has_pycairo() and 'sqlite' in mapnik.DatasourceCache.instance().plugin_names(): +if mapnik.has_pycairo() and 'sqlite' in mapnik.DatasourceCache.plugin_names(): def _pycairo_surface(type,sym): import cairo @@ -60,4 +60,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/compositing_test.py mapnik-2.2.0/tests/python_tests/compositing_test.py --- mapnik-2.1.0/tests/python_tests/compositing_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/compositing_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -2,8 +2,8 @@ from nose.tools import * import os,sys -from utilities import execution_path -from utilities import Todo +from utilities import execution_path, run_all, Todo +from utilities import get_unique_colors, pixel2channels, side_by_side_image import mapnik def setup(): @@ -11,52 +11,75 @@ # from another directory we need to chdir() os.chdir(execution_path('.')) -def validate_pixels_are_demultiplied(image): - bad_pixels = [] +def is_pre(color,alpha): + return (color*255.0/alpha) <= 255 + +def debug_image(image,step=2): + for x in range(0,image.width(),step): + for y in range(0,image.height(),step): + pixel = image.get_pixel(x,y) + red,green,blue,alpha = pixel2channels(pixel) + print "rgba(%s,%s,%s,%s) at %s,%s" % (red,green,blue,alpha,x,y) + +def replace_style(m, name, style): + m.remove_style(name) + m.append_style(name, style) + +# note: it is impossible to know for all pixel colors +# we can only detect likely cases of non premultiplied colors +def validate_pixels_are_not_premultiplied(image): + over_alpha = False + transparent = True + fully_opaque = True for x in range(0,image.width(),2): for y in range(0,image.height(),2): pixel = image.get_pixel(x,y) - r = pixel & 0xff - g = (pixel >> 8) & 0xff - b = (pixel >> 16) & 0xff - a = (pixel >> 24) & 0xff - is_valid = (r >=0 and r < 256) and \ - (g >=0 and g < 256) and \ - (b >=0 and b < 256) and \ - (a >=0 and a < 256) - if not is_valid: - bad_pixels.append("rgba(%s,%s,%s,%s) at %s,%s" % (r,g,b,a,x,y)) - num_bad = len(bad_pixels) - return (num_bad == 0,num_bad) + red,green,blue,alpha = pixel2channels(pixel) + if alpha > 0: + transparent = False + if alpha < 255: + fully_opaque = False + color_max = max(red,green,blue) + if color_max > alpha: + over_alpha = True + return over_alpha or transparent or fully_opaque + +def validate_pixels_are_not_premultiplied2(image): + looks_not_multiplied = False + for x in range(0,image.width(),2): + for y in range(0,image.height(),2): + pixel = image.get_pixel(x,y) + red,green,blue,alpha = pixel2channels(pixel) + #each value of the color channels will never be bigger than that of the alpha channel. + if alpha > 0: + if red > 0 and red > alpha: + print 'red: %s, a: %s' % (red,alpha) + looks_not_multiplied = True + return looks_not_multiplied def validate_pixels_are_premultiplied(image): bad_pixels = [] for x in range(0,image.width(),2): for y in range(0,image.height(),2): pixel = image.get_pixel(x,y) - red = pixel & 0xff - green = (pixel >> 8) & 0xff - blue = (pixel >> 16) & 0xff - alpha = (pixel >> 24) & 0xff - a2 = alpha - if a2 == 0: - a2 = 1 - else: - a2 = a2*256 - is_valid = (red >=0 and red/a2 < 256) and \ - (green >=0 and red/a2 < 256) and \ - (blue >=0 and red/a2 < 256) and \ - (alpha >=0 and alpha < 256) - if not is_valid: - import pdb;pdb.set_trace() - bad_pixels.append("rgba(%s,%s,%s,%s) at %s,%s" % (red,green,blue,alpha,x,y)) + red,green,blue,alpha = pixel2channels(pixel) + if alpha > 0: + pixel = image.get_pixel(x,y) + is_valid = ((0 <= red <= alpha) and is_pre(red,alpha)) \ + and ((0 <= green <= alpha) and is_pre(green,alpha)) \ + and ((0 <= blue <= alpha) and is_pre(blue,alpha)) \ + and (alpha >= 0 and alpha <= 255) + if not is_valid: + bad_pixels.append("rgba(%s,%s,%s,%s) at %s,%s" % (red,green,blue,alpha,x,y)) num_bad = len(bad_pixels) return (num_bad == 0,bad_pixels) - def test_compare_images(): b = mapnik.Image.open('./images/support/b.png') b.premultiply() + num_ops = len(mapnik.CompositeOp.names) + successes = [] + fails = [] for name in mapnik.CompositeOp.names: a = mapnik.Image.open('./images/support/a.png') a.premultiply() @@ -65,15 +88,23 @@ expected = 'images/composited/' + name + '.png' valid = validate_pixels_are_premultiplied(a) if not valid[0]: - print '%s not validly pre-:\n\t%s pixels (%s)' % (name,len(valid[1]),valid[1][0]) + fails.append('%s not validly premultiplied!:\n\t %s pixels (%s)' % (name,len(valid[1]),valid[1][0])) a.demultiply() - valid = validate_pixels_are_demultiplied(a) - if not valid[0]: - print '%s not validly de-:\n\t%s pixels (%s)' % (name,len(valid[1]),valid[1][0]) + if not validate_pixels_are_not_premultiplied(a): + fails.append('%s not validly demultiplied' % (name)) a.save(actual) + if not os.path.exists(expected): + print 'generating expected test image: %s' % expected + a.save(expected) expected_im = mapnik.Image.open(expected) # compare them - eq_(a.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected)) + if a.tostring() == expected_im.tostring(): + successes.append(name) + else: + fails.append('failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected)) + fail_im = side_by_side_image(expected_im, a) + fail_im.save('/tmp/mapnik-comp-op-test-' + name + '.fail.png') + eq_(len(successes),num_ops,'\n'+'\n'.join(fails)) b.demultiply() # b will be slightly modified by pre and then de multiplication rounding errors # TODO - write test to ensure the image is 99% the same. @@ -81,7 +112,151 @@ #b.save('/tmp/mapnik-comp-op-test-original-mask.png') #eq_(b.tostring(),expected_b.tostring(), '/tmp/mapnik-comp-op-test-original-mask.png is no longer equivalent to original mask: ./images/support/b.png') +def test_pre_multiply_status(): + b = mapnik.Image.open('./images/support/b.png') + # not premultiplied yet, should appear that way + result = validate_pixels_are_not_premultiplied(b) + eq_(result,True) + # not yet premultiplied therefore should return false + result = validate_pixels_are_premultiplied(b) + eq_(result[0],False) + # now actually premultiply the pixels + b.premultiply() + # now checking if premultiplied should succeed + result = validate_pixels_are_premultiplied(b) + eq_(result[0],True) + # should now not appear to look not premultiplied + result = validate_pixels_are_not_premultiplied(b) + eq_(result,False) + # now actually demultiply the pixels + b.demultiply() + # should now appear demultiplied + result = validate_pixels_are_not_premultiplied(b) + eq_(result,True) + +def test_pre_multiply_status_of_map1(): + m = mapnik.Map(256,256) + im = mapnik.Image(m.width,m.height) + eq_(validate_pixels_are_not_premultiplied(im),True) + mapnik.render(m,im) + eq_(validate_pixels_are_not_premultiplied(im),True) + +def test_pre_multiply_status_of_map2(): + m = mapnik.Map(256,256) + m.background = mapnik.Color(1,1,1,255) + im = mapnik.Image(m.width,m.height) + eq_(validate_pixels_are_not_premultiplied(im),True) + mapnik.render(m,im) + eq_(validate_pixels_are_not_premultiplied(im),True) + +if 'shape' in mapnik.DatasourceCache.plugin_names(): + def test_style_level_comp_op(): + m = mapnik.Map(256, 256) + mapnik.load_map(m, '../data/good_maps/style_level_comp_op.xml') + m.zoom_all() + successes = [] + fails = [] + for name in mapnik.CompositeOp.names: + # find_style returns a copy of the style object + style_markers = m.find_style("markers") + style_markers.comp_op = getattr(mapnik.CompositeOp, name) + # replace the original style with the modified one + replace_style(m, "markers", style_markers) + im = mapnik.Image(m.width, m.height) + mapnik.render(m, im) + actual = '/tmp/mapnik-style-comp-op-' + name + '.png' + expected = 'images/style-comp-op/' + name + '.png' + im.save(actual) + if not os.path.exists(expected): + print 'generating expected test image: %s' % expected + im.save(expected) + expected_im = mapnik.Image.open(expected) + # compare them + if im.tostring() == expected_im.tostring(): + successes.append(name) + else: + fails.append('failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected)) + fail_im = side_by_side_image(expected_im, im) + fail_im.save('/tmp/mapnik-style-comp-op-' + name + '.fail.png') + eq_(len(fails), 0, '\n'+'\n'.join(fails)) + + def test_style_level_opacity(): + m = mapnik.Map(512,512) + mapnik.load_map(m,'../data/good_maps/style_level_opacity_and_blur.xml') + m.zoom_all() + im = mapnik.Image(512,512) + mapnik.render(m,im) + actual = '/tmp/mapnik-style-level-opacity.png' + expected = 'images/support/mapnik-style-level-opacity.png' + im.save(actual) + expected_im = mapnik.Image.open(expected) + eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) + +def test_rounding_and_color_expectations(): + m = mapnik.Map(1,1) + m.background = mapnik.Color('rgba(255,255,255,.4999999)') + im = mapnik.Image(m.width,m.height) + mapnik.render(m,im) + # ugh 252, see: https://github.com/mapnik/mapnik/issues/1519 + eq_(get_unique_colors(im),['rgba(252,252,252,127)']) + m = mapnik.Map(1,1) + m.background = mapnik.Color('rgba(255,255,255,.5)') + im = mapnik.Image(m.width,m.height) + mapnik.render(m,im) + eq_(get_unique_colors(im),['rgba(253,253,253,128)']) + im_file = mapnik.Image.open('../data/images/stripes_pattern.png') + eq_(get_unique_colors(im_file),['rgba(0,0,0,0)', 'rgba(74,74,74,255)']) + # should have no effect + im_file.premultiply() + eq_(get_unique_colors(im_file),['rgba(0,0,0,0)', 'rgba(74,74,74,255)']) + im_file.set_alpha(.5) + # should have effect now that image has transparency + im_file.premultiply() + eq_(get_unique_colors(im_file),['rgba(0,0,0,0)', 'rgba(37,37,37,127)']) + # should restore to original nonpremultiplied colors + im_file.demultiply() + eq_(get_unique_colors(im_file),['rgba(0,0,0,0)', 'rgba(74,74,74,127)']) + + +def test_background_image_and_background_color(): + m = mapnik.Map(8,8) + m.background = mapnik.Color('rgba(255,255,255,.5)') + m.background_image = '../data/images/stripes_pattern.png' + im = mapnik.Image(m.width,m.height) + mapnik.render(m,im) + # note: data loss due to rounding as per https://github.com/mapnik/mapnik/issues/1519 + # means that background will roundtrip to 253 not 255 + #eq_(get_unique_colors(im),['rgba(255,255,255,128)', 'rgba(74,74,74,255)']) + eq_(get_unique_colors(im),['rgba(253,253,253,128)', 'rgba(74,74,74,255)']) + +def test_background_image_with_alpha_and_background_color(): + m = mapnik.Map(10,10) + m.background = mapnik.Color('rgba(255,255,255,.5)') + m.background_image = '../data/images/yellow_half_trans.png' + im = mapnik.Image(m.width,m.height) + mapnik.render(m,im) + eq_(get_unique_colors(im),['rgba(255,255,85,191)']) + +def test_background_image_with_alpha_and_background_color_against_composited_control(): + m = mapnik.Map(10,10) + m.background = mapnik.Color('rgba(255,255,255,.5)') + m.background_image = '../data/images/yellow_half_trans.png' + im = mapnik.Image(m.width,m.height) + mapnik.render(m,im) + # create and composite the expected result + im1 = mapnik.Image(10,10) + im1.background = mapnik.Color('rgba(255,255,255,.5)') + im1.premultiply() + im2 = mapnik.Image(10,10) + im2.background = mapnik.Color('rgba(255,255,0,.5)') + im2.premultiply() + im1.composite(im2) + im1.demultiply() + # compare image rendered (compositing in `agg_renderer::setup`) + # vs image composited via python bindings + #raise Todo("looks like we need to investigate PNG color rounding when saving") + #eq_(get_unique_colors(im),get_unique_colors(im1)) if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/csv_test.py mapnik-2.2.0/tests/python_tests/csv_test.py --- mapnik-2.1.0/tests/python_tests/csv_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/csv_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -2,20 +2,28 @@ # -*- coding: utf-8 -*- import glob +import sys from nose.tools import * from utilities import execution_path import os, mapnik +default_logging_severity = mapnik.logger.get_severity() + def setup(): + # make the tests silent since we intentially test error conditions that are noisy + mapnik.logger.set_severity(mapnik.severity_type.None) # All of the paths used are relative, if we run the tests # from another directory we need to chdir() os.chdir(execution_path('.')) -if 'csv' in mapnik.DatasourceCache.instance().plugin_names(): +def teardown(): + mapnik.logger.set_severity(default_logging_severity) + +if 'csv' in mapnik.DatasourceCache.plugin_names(): def get_csv_ds(filename): - return mapnik.Datasource(type='csv',file=os.path.join('../data/csv/',filename),quiet=True) + return mapnik.Datasource(type='csv',file=os.path.join('../data/csv/',filename)) def test_broken_files(visual=False): broken = glob.glob("../data/csv/fails/*.*") @@ -28,7 +36,7 @@ throws = False if visual: try: - ds = mapnik.Datasource(type='csv',file=csv,strict=True,quiet=True) + ds = mapnik.Datasource(type='csv',file=csv,strict=True) print '\x1b[33mfailed\x1b[0m',csv except Exception: print '\x1b[1;32m✓ \x1b[0m', csv @@ -40,7 +48,7 @@ for csv in good_files: if visual: try: - ds = mapnik.Datasource(type='csv',file=csv,quiet=True) + ds = mapnik.Datasource(type='csv',file=csv) print '\x1b[1;32m✓ \x1b[0m', csv except Exception: print '\x1b[33mfailed\x1b[0m',csv @@ -137,9 +145,9 @@ def test_wkt_field(**kwargs): ds = get_csv_ds('wkt.csv') - eq_(len(ds.fields()),2) - eq_(ds.fields(),['type','WKT']) - eq_(ds.field_types(),['str','str']) + eq_(len(ds.fields()),1) + eq_(ds.fields(),['type']) + eq_(ds.field_types(),['str']) fs = ds.all_features() eq_(len(fs[0].geometries()),1) eq_(fs[0].geometries()[0].type(),mapnik.DataGeometryType.Point) @@ -206,7 +214,7 @@ eq_(desc['type'],mapnik.DataType.Vector) eq_(desc['encoding'],'utf-8') - def test_windows_newlines(**kwargs): + def test_reading_windows_newlines(**kwargs): ds = get_csv_ds('windows_newlines.csv') eq_(len(ds.fields()),3) feats = ds.all_features() @@ -222,8 +230,8 @@ eq_(desc['type'],mapnik.DataType.Vector) eq_(desc['encoding'],'utf-8') - def test_mac_newlines(**kwargs): - ds = get_csv_ds('windows_newlines.csv') + def test_reading_mac_newlines(**kwargs): + ds = get_csv_ds('mac_newlines.csv') eq_(len(ds.fields()),3) feats = ds.all_features() eq_(len(feats),1) @@ -238,6 +246,42 @@ eq_(desc['type'],mapnik.DataType.Vector) eq_(desc['encoding'],'utf-8') + def check_newlines(filename): + ds = get_csv_ds(filename) + eq_(len(ds.fields()),3) + feats = ds.all_features() + eq_(len(feats),1) + fs = ds.featureset() + feat = fs.next() + eq_(feat['x'],0) + eq_(feat['y'],0) + eq_(feat['line'],'many\n lines\n of text\n with unix newlines') + desc = ds.describe() + eq_(desc['geometry_type'],mapnik.DataGeometryType.Point) + eq_(desc['name'],'csv') + eq_(desc['type'],mapnik.DataType.Vector) + eq_(desc['encoding'],'utf-8') + + def test_mixed_mac_unix_newlines(**kwargs): + check_newlines('mac_newlines_with_unix_inline.csv') + + def test_mixed_mac_unix_newlines_escaped(**kwargs): + check_newlines('mac_newlines_with_unix_inline_escaped.csv') + + # To hard to support this case + #def test_mixed_unix_windows_newlines(**kwargs): + # check_newlines('unix_newlines_with_windows_inline.csv') + + # To hard to support this case + #def test_mixed_unix_windows_newlines_escaped(**kwargs): + # check_newlines('unix_newlines_with_windows_inline_escaped.csv') + + def test_mixed_windows_unix_newlines(**kwargs): + check_newlines('windows_newlines_with_unix_inline.csv') + + def test_mixed_windows_unix_newlines_escaped(**kwargs): + check_newlines('windows_newlines_with_unix_inline_escaped.csv') + def test_tabs(**kwargs): ds = get_csv_ds('tabs_in_csv.csv') eq_(len(ds.fields()),3) @@ -360,9 +404,9 @@ eq_(feat['Name'],u"Winthrop, WA") def validate_geojson_datasource(ds): - eq_(len(ds.fields()),2) - eq_(ds.fields(),['type','GeoJSON']) - eq_(ds.field_types(),['str','str']) + eq_(len(ds.fields()),1) + eq_(ds.fields(),['type']) + eq_(ds.field_types(),['str']) fs = ds.all_features() eq_(len(fs[0].geometries()),1) eq_(fs[0].geometries()[0].type(),mapnik.DataGeometryType.Point) @@ -418,6 +462,115 @@ # this has invalid header # so throw ds = get_csv_ds('more_column_values_than_headers.csv') + def test_that_feature_id_only_incremented_for_valid_rows(**kwargs): + ds = mapnik.Datasource(type='csv', + file=os.path.join('../data/csv/warns','feature_id_counting.csv')) + eq_(len(ds.fields()),3) + eq_(ds.fields(),['x','y','id']) + eq_(ds.field_types(),['int','int','int']) + fs = ds.featureset() + # first + feat = fs.next() + eq_(feat['x'],0) + eq_(feat['y'],0) + eq_(feat['id'],1) + # second, should have skipped bogus one + feat = fs.next() + eq_(feat['x'],0) + eq_(feat['y'],0) + eq_(feat['id'],2) + desc = ds.describe() + eq_(desc['geometry_type'],mapnik.DataGeometryType.Point) + eq_(len(ds.all_features()),2) + + def test_dynamically_defining_headers1(**kwargs): + ds = mapnik.Datasource(type='csv', + file=os.path.join('../data/csv/fails','needs_headers_two_lines.csv'), + headers='x,y,name') + eq_(len(ds.fields()),3) + eq_(ds.fields(),['x','y','name']) + eq_(ds.field_types(),['int','int','str']) + fs = ds.featureset() + feat = fs.next() + eq_(feat['x'],0) + eq_(feat['y'],0) + eq_(feat['name'],'data_name') + desc = ds.describe() + eq_(desc['geometry_type'],mapnik.DataGeometryType.Point) + eq_(len(ds.all_features()),2) + + def test_dynamically_defining_headers2(**kwargs): + ds = mapnik.Datasource(type='csv', + file=os.path.join('../data/csv/fails','needs_headers_one_line.csv'), + headers='x,y,name') + eq_(len(ds.fields()),3) + eq_(ds.fields(),['x','y','name']) + eq_(ds.field_types(),['int','int','str']) + fs = ds.featureset() + feat = fs.next() + eq_(feat['x'],0) + eq_(feat['y'],0) + eq_(feat['name'],'data_name') + desc = ds.describe() + eq_(desc['geometry_type'],mapnik.DataGeometryType.Point) + eq_(len(ds.all_features()),1) + + def test_dynamically_defining_headers3(**kwargs): + ds = mapnik.Datasource(type='csv', + file=os.path.join('../data/csv/fails','needs_headers_one_line_no_newline.csv'), + headers='x,y,name') + eq_(len(ds.fields()),3) + eq_(ds.fields(),['x','y','name']) + eq_(ds.field_types(),['int','int','str']) + fs = ds.featureset() + feat = fs.next() + eq_(feat['x'],0) + eq_(feat['y'],0) + eq_(feat['name'],'data_name') + desc = ds.describe() + eq_(desc['geometry_type'],mapnik.DataGeometryType.Point) + eq_(len(ds.all_features()),1) + + def test_that_64bit_int_fields_work(**kwargs): + ds = get_csv_ds('64bit_int.csv') + eq_(len(ds.fields()),3) + eq_(ds.fields(),['x','y','bigint']) + eq_(ds.field_types(),['int','int','int']) + fs = ds.featureset() + feat = fs.next() + eq_(feat['bigint'],2147483648) + feat = fs.next() + eq_(feat['bigint'],sys.maxint) + eq_(feat['bigint'],9223372036854775807) + eq_(feat['bigint'],0x7FFFFFFFFFFFFFFF) + desc = ds.describe() + eq_(desc['geometry_type'],mapnik.DataGeometryType.Point) + eq_(len(ds.all_features()),2) + + def test_various_number_types(**kwargs): + ds = get_csv_ds('number_types.csv') + eq_(len(ds.fields()),3) + eq_(ds.fields(),['x','y','floats']) + eq_(ds.field_types(),['int','int','float']) + fs = ds.featureset() + feat = fs.next() + eq_(feat['floats'],.0) + feat = fs.next() + eq_(feat['floats'],+.0) + feat = fs.next() + eq_(feat['floats'],1e-06) + feat = fs.next() + eq_(feat['floats'],-1e-06) + feat = fs.next() + eq_(feat['floats'],0.000001) + feat = fs.next() + eq_(feat['floats'],1.234e+16) + feat = fs.next() + eq_(feat['floats'],1.234e+16) + desc = ds.describe() + eq_(desc['geometry_type'],mapnik.DataGeometryType.Point) + eq_(len(ds.all_features()),8) + if __name__ == "__main__": setup() [eval(run)(visual=True) for run in dir() if 'test_' in run] diff -Nru mapnik-2.1.0/tests/python_tests/datasource_test.py mapnik-2.2.0/tests/python_tests/datasource_test.py --- mapnik-2.1.0/tests/python_tests/datasource_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/datasource_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -1,8 +1,7 @@ #!/usr/bin/env python from nose.tools import * -from utilities import execution_path - +from utilities import execution_path, run_all import os, mapnik def setup(): @@ -11,11 +10,11 @@ os.chdir(execution_path('.')) def test_that_datasources_exist(): - if len(mapnik.DatasourceCache.instance().plugin_names()) == 0: + if len(mapnik.DatasourceCache.plugin_names()) == 0: print '***NOTICE*** - no datasource plugins have been loaded' def test_field_listing(): - if 'shape' in mapnik.DatasourceCache.instance().plugin_names(): + if 'shape' in mapnik.DatasourceCache.plugin_names(): ds = mapnik.Shapefile(file='../data/shp/poly.shp') fields = ds.fields() eq_(fields, ['AREA', 'EAS_ID', 'PRFEDEA']) @@ -26,14 +25,14 @@ eq_(desc['encoding'],'utf-8') def test_total_feature_count_shp(): - if 'shape' in mapnik.DatasourceCache.instance().plugin_names(): + if 'shape' in mapnik.DatasourceCache.plugin_names(): ds = mapnik.Shapefile(file='../data/shp/poly.shp') features = ds.all_features() num_feats = len(features) eq_(num_feats, 10) def test_total_feature_count_json(): - if 'ogr' in mapnik.DatasourceCache.instance().plugin_names(): + if 'ogr' in mapnik.DatasourceCache.plugin_names(): ds = mapnik.Ogr(file='../data/json/points.json',layer_by_index=0) desc = ds.describe() eq_(desc['geometry_type'],mapnik.DataGeometryType.Point) @@ -45,7 +44,7 @@ eq_(num_feats, 5) def test_sqlite_reading(): - if 'sqlite' in mapnik.DatasourceCache.instance().plugin_names(): + if 'sqlite' in mapnik.DatasourceCache.plugin_names(): ds = mapnik.SQLite(file='../data/sqlite/world.sqlite',table_by_index=0) desc = ds.describe() eq_(desc['geometry_type'],mapnik.DataGeometryType.Polygon) @@ -58,14 +57,14 @@ def test_reading_json_from_string(): json = open('../data/json/points.json','r').read() - if 'ogr' in mapnik.DatasourceCache.instance().plugin_names(): + if 'ogr' in mapnik.DatasourceCache.plugin_names(): ds = mapnik.Ogr(file=json,layer_by_index=0) features = ds.all_features() num_feats = len(features) eq_(num_feats, 5) def test_feature_envelope(): - if 'shape' in mapnik.DatasourceCache.instance().plugin_names(): + if 'shape' in mapnik.DatasourceCache.plugin_names(): ds = mapnik.Shapefile(file='../data/shp/poly.shp') features = ds.all_features() for feat in features: @@ -76,7 +75,7 @@ eq_(intersects, True) def test_feature_attributes(): - if 'shape' in mapnik.DatasourceCache.instance().plugin_names(): + if 'shape' in mapnik.DatasourceCache.plugin_names(): ds = mapnik.Shapefile(file='../data/shp/poly.shp') features = ds.all_features() feat = features[0] @@ -86,7 +85,7 @@ eq_(ds.field_types(),['float','int','str']) def test_ogr_layer_by_sql(): - if 'ogr' in mapnik.DatasourceCache.instance().plugin_names(): + if 'ogr' in mapnik.DatasourceCache.plugin_names(): ds = mapnik.Ogr(file='../data/shp/poly.shp', layer_by_sql='SELECT * FROM poly WHERE EAS_ID = 168') features = ds.all_features() num_feats = len(features) @@ -126,4 +125,4 @@ if __name__ == '__main__': setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/datasource_xml_template_test.py mapnik-2.2.0/tests/python_tests/datasource_xml_template_test.py --- mapnik-2.1.0/tests/python_tests/datasource_xml_template_test.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/datasource_xml_template_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +from nose.tools import * +from utilities import execution_path, run_all +import mapnik + +def setup(): + # All of the paths used are relative, if we run the tests + # from another directory we need to chdir() + os.chdir(execution_path('.')) + +def test_datasource_template_is_working(): + m = mapnik.Map(256,256) + try: + mapnik.load_map(m,'../data/good_maps/datasource.xml') + except RuntimeError, e: + if "Required parameter 'type'" in str(e): + raise RuntimeError(e) + +if __name__ == "__main__": + setup() + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/extra_map_props_test.py mapnik-2.2.0/tests/python_tests/extra_map_props_test.py --- mapnik-2.1.0/tests/python_tests/extra_map_props_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/extra_map_props_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -2,12 +2,8 @@ # -*- coding: utf-8 -*- from nose.tools import * -from utilities import execution_path -from Queue import Queue -import threading - +from utilities import execution_path, run_all import os, mapnik -import sqlite3 def setup(): # All of the paths used are relative, if we run the tests @@ -38,4 +34,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/feature_id_test.py mapnik-2.2.0/tests/python_tests/feature_id_test.py --- mapnik-2.1.0/tests/python_tests/feature_id_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/feature_id_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -1,9 +1,7 @@ #!/usr/bin/env python from nose.tools import * - -from utilities import execution_path, Todo - +from utilities import execution_path, run_all import os, sys, glob, mapnik import itertools @@ -13,7 +11,7 @@ os.chdir(execution_path('.')) def compare_shape_between_mapnik_and_ogr(shapefile,query=None): - plugins = mapnik.DatasourceCache.instance().plugin_names() + plugins = mapnik.DatasourceCache.plugin_names() if 'shape' in plugins and 'ogr' in plugins: ds1 = mapnik.Ogr(file=shapefile,layer_by_index=0) ds2 = mapnik.Shapefile(file=shapefile) @@ -41,27 +39,28 @@ def test_shapefile_polygon_feature_query_id(): bbox = (15523428.2632, 4110477.6323, -11218494.8310, 7495720.7404) query = mapnik.Query(mapnik.Box2d(*bbox)) - if 'ogr' in mapnik.DatasourceCache.instance().plugin_names(): + if 'ogr' in mapnik.DatasourceCache.plugin_names(): ds = mapnik.Ogr(file='../data/shp/world_merc.shp',layer_by_index=0) for fld in ds.fields(): query.add_property_name(fld) compare_shape_between_mapnik_and_ogr('../data/shp/world_merc.shp',query) def test_feature_hit_count(): - raise Todo("need to optimize multigeom bbox handling in shapeindex: https://github.com/mapnik/mapnik/issues/783") + pass + #raise Todo("need to optimize multigeom bbox handling in shapeindex: https://github.com/mapnik/mapnik/issues/783") # results in different results between shp and ogr! #bbox = (-14284551.8434, 2074195.1992, -7474929.8687, 8140237.7628) - bbox = (1113194.91,4512803.085,2226389.82,6739192.905) - query = mapnik.Query(mapnik.Box2d(*bbox)) - if 'ogr' in mapnik.DatasourceCache.instance().plugin_names(): - ds1 = mapnik.Ogr(file='../data/shp/world_merc.shp',layer_by_index=0) - for fld in ds1.fields(): - query.add_property_name(fld) - ds2 = mapnik.Shapefile(file='../data/shp/world_merc.shp') - count1 = len(ds1.features(query).features) - count2 = len(ds2.features(query).features) - eq_(count1,count2,"Feature count differs between OGR driver (%s features) and Shapefile Driver (%s features) when querying the same bbox" % (count1,count2)) + #bbox = (1113194.91,4512803.085,2226389.82,6739192.905) + #query = mapnik.Query(mapnik.Box2d(*bbox)) + #if 'ogr' in mapnik.DatasourceCache.plugin_names(): + # ds1 = mapnik.Ogr(file='../data/shp/world_merc.shp',layer_by_index=0) + # for fld in ds1.fields(): + # query.add_property_name(fld) + # ds2 = mapnik.Shapefile(file='../data/shp/world_merc.shp') + # count1 = len(ds1.features(query).features) + # count2 = len(ds2.features(query).features) + # eq_(count1,count2,"Feature count differs between OGR driver (%s features) and Shapefile Driver (%s features) when querying the same bbox" % (count1,count2)) if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/feature_test.py mapnik-2.2.0/tests/python_tests/feature_test.py --- mapnik-2.1.0/tests/python_tests/feature_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/feature_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -3,6 +3,7 @@ import itertools import unittest from nose.tools import * +from utilities import execution_path, run_all import mapnik from binascii import unhexlify @@ -89,4 +90,4 @@ eq_(expr.evaluate(f),True) if __name__ == "__main__": - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/filter_test.py mapnik-2.2.0/tests/python_tests/filter_test.py --- mapnik-2.1.0/tests/python_tests/filter_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/filter_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- from nose.tools import * +from utilities import run_all import mapnik if hasattr(mapnik,'Expression'): @@ -20,9 +21,9 @@ = 0) + ([region] >= 0) - and + and ([region] <= 50) ]]> @@ -49,7 +50,7 @@ ''' -def test_filter_init(): +def test_filter_init(): m = mapnik.Map(1,1) mapnik.load_map_from_string(m,map_) filters = [] @@ -74,7 +75,7 @@ 0) and ([region] - <= + <= 50) ''')) @@ -157,25 +158,34 @@ expr = mapnik.Expression("[name].replace('(\B)|( )','$1 ')") eq_(expr.evaluate(f),'t e s t') +def test_unicode_regex_replace_to_str(): + expr = mapnik.Expression("[name].replace('(\B)|( )','$1 ')") + eq_(str(expr),"[name].replace('(\B)|( )','$1 ')") + def test_unicode_regex_replace(): context = mapnik.Context() context.push('name') f = mapnik.Feature(context,0) f["name"] = 'Québec' expr = mapnik.Expression("[name].replace('(\B)|( )','$1 ')") + # will fail if -DBOOST_REGEX_HAS_ICU is not defined eq_(expr.evaluate(f), u'Q u é b e c') def test_float_precision(): context = mapnik.Context() context.push('num') f = mapnik.Feature(context,0) - f["num"] = 1.0000 - eq_(f["num"],1.0000) - expr = mapnik.Expression("[num] = 1.0000") + f["num1"] = 1.0000 + f["num2"] = 1.0001 + eq_(f["num1"],1.0000) + eq_(f["num2"],1.0001) + expr = mapnik.Expression("[num1] = 1.0000") + eq_(expr.evaluate(f),True) + expr = mapnik.Expression("[num1].match('1')") eq_(expr.evaluate(f),True) - expr = mapnik.Expression("[num].match('.*0$')") + expr = mapnik.Expression("[num2] = 1.0001") eq_(expr.evaluate(f),True) - expr = mapnik.Expression("[num].match('.*0$')") + expr = mapnik.Expression("[num2].match('1.0001')") eq_(expr.evaluate(f),True) def test_string_matching_on_precision(): @@ -187,5 +197,240 @@ expr = mapnik.Expression("[num].match('.*(^0|00)$')") eq_(expr.evaluate(f),True) +def test_creation_of_null_value(): + context = mapnik.Context() + context.push('nv') + f = mapnik.Feature(context,0) + f["nv"] = None + eq_(f["nv"],None) + eq_(f["nv"] is None,True) + # test boolean + f["nv"] = 0 + eq_(f["nv"],0) + eq_(f["nv"] is not None,True) + +def test_creation_of_bool(): + context = mapnik.Context() + context.push('bool') + f = mapnik.Feature(context,0) + f["bool"] = True + eq_(f["bool"],True) + # TODO - will become int of 1 do to built in boost python conversion + # https://github.com/mapnik/mapnik/issues/1873 + eq_(isinstance(f["bool"],bool) or isinstance(f["bool"],int),True) + f["bool"] = False + eq_(f["bool"],False) + eq_(isinstance(f["bool"],bool) or isinstance(f["bool"],int),True) + # test NoneType + f["bool"] = None + eq_(f["bool"],None) + eq_(isinstance(f["bool"],bool) or isinstance(f["bool"],int),False) + # test integer + f["bool"] = 0 + eq_(f["bool"],0) + # https://github.com/mapnik/mapnik/issues/1873 + # ugh, boost_python's built into converter does not work right + #eq_(isinstance(f["bool"],bool),False) + +null_equality = [ + ['hello',False,unicode], + [u'',False,unicode], + [0,False,int], + [123,False,int], + [0.0,False,float], + [123.123,False,float], + [.1,False,float], + [False,False,int], # TODO - should become bool: https://github.com/mapnik/mapnik/issues/1873 + [True,False,int], # TODO - should become bool: https://github.com/mapnik/mapnik/issues/1873 + [None,True,None], + [2147483648,False,int], + [922337203685477580,False,int] +] + +def test_expressions_with_null_equality(): + for eq in null_equality: + context = mapnik.Context() + f = mapnik.Feature(context,0) + f["prop"] = eq[0] + eq_(f["prop"],eq[0]) + if eq[0] is None: + eq_(f["prop"] is None, True) + else: + eq_(isinstance(f['prop'],eq[2]),True,'%s is not an instance of %s' % (f['prop'],eq[2])) + expr = mapnik.Expression("[prop] = null") + eq_(expr.evaluate(f),eq[1]) + expr = mapnik.Expression("[prop] is null") + eq_(expr.evaluate(f),eq[1]) + +def test_expressions_with_null_equality2(): + for eq in null_equality: + context = mapnik.Context() + f = mapnik.Feature(context,0) + f["prop"] = eq[0] + eq_(f["prop"],eq[0]) + if eq[0] is None: + eq_(f["prop"] is None, True) + else: + eq_(isinstance(f['prop'],eq[2]),True,'%s is not an instance of %s' % (f['prop'],eq[2])) + # TODO - support `is not` syntax: + # https://github.com/mapnik/mapnik/issues/796 + expr = mapnik.Expression("not [prop] is null") + eq_(expr.evaluate(f),not eq[1]) + # https://github.com/mapnik/mapnik/issues/1642 + expr = mapnik.Expression("[prop] != null") + eq_(expr.evaluate(f),not eq[1]) + +truthyness = [ + [u'hello',True,unicode], + [u'',False,unicode], + [0,False,int], + [123,True,int], + [0.0,False,float], + [123.123,True,float], + [.1,True,float], + [False,False,int], # TODO - should become bool: https://github.com/mapnik/mapnik/issues/1873 + [True,True,int], # TODO - should become bool: https://github.com/mapnik/mapnik/issues/1873 + [None,False,None], + [2147483648,True,int], + [922337203685477580,True,int] +] + +def test_expressions_for_thruthyness(): + context = mapnik.Context() + for eq in truthyness: + f = mapnik.Feature(context,0) + f["prop"] = eq[0] + eq_(f["prop"],eq[0]) + if eq[0] is None: + eq_(f["prop"] is None, True) + else: + eq_(isinstance(f['prop'],eq[2]),True,'%s is not an instance of %s' % (f['prop'],eq[2])) + expr = mapnik.Expression("[prop]") + eq_(expr.to_bool(f),eq[1]) + expr = mapnik.Expression("not [prop]") + eq_(expr.to_bool(f),not eq[1]) + expr = mapnik.Expression("! [prop]") + eq_(expr.to_bool(f),not eq[1]) + # also test if feature does not have property at all + f2 = mapnik.Feature(context,1) + # no property existing will return value_null since + # https://github.com/mapnik/mapnik/commit/562fada9d0f680f59b2d9f396c95320a0d753479#include/mapnik/feature.hpp + eq_(f2["prop"] is None,True) + expr = mapnik.Expression("[prop]") + eq_(expr.evaluate(f2),None) + eq_(expr.to_bool(f2),False) + +# https://github.com/mapnik/mapnik/issues/1859 +def test_if_null_and_empty_string_are_equal(): + context = mapnik.Context() + f = mapnik.Feature(context,0) + f["empty"] = u"" + f["null"] = None + # ensure base assumptions are good + eq_(mapnik.Expression("[empty] = ''").to_bool(f),True) + eq_(mapnik.Expression("[null] = null").to_bool(f),True) + eq_(mapnik.Expression("[empty] != ''").to_bool(f),False) + eq_(mapnik.Expression("[null] != null").to_bool(f),False) + # now test expected behavior + eq_(mapnik.Expression("[null] = ''").to_bool(f),False) + eq_(mapnik.Expression("[empty] = null").to_bool(f),False) + eq_(mapnik.Expression("[empty] != null").to_bool(f),True) + # this one is the back compatibility shim + eq_(mapnik.Expression("[null] != ''").to_bool(f),False) + +def test_filtering_nulls_and_empty_strings(): + context = mapnik.Context() + f = mapnik.Feature(context,0) + f["prop"] = u"hello" + eq_(f["prop"],u"hello") + eq_(mapnik.Expression("[prop]").to_bool(f),True) + eq_(mapnik.Expression("! [prop]").to_bool(f),False) + eq_(mapnik.Expression("[prop] != null").to_bool(f),True) + eq_(mapnik.Expression("[prop] != ''").to_bool(f),True) + eq_(mapnik.Expression("[prop] != null and [prop] != ''").to_bool(f),True) + eq_(mapnik.Expression("[prop] != null or [prop] != ''").to_bool(f),True) + f["prop2"] = u"" + eq_(f["prop2"],u"") + eq_(mapnik.Expression("[prop2]").to_bool(f),False) + eq_(mapnik.Expression("! [prop2]").to_bool(f),True) + eq_(mapnik.Expression("[prop2] != null").to_bool(f),True) + eq_(mapnik.Expression("[prop2] != ''").to_bool(f),False) + eq_(mapnik.Expression("[prop2] = ''").to_bool(f),True) + eq_(mapnik.Expression("[prop2] != null or [prop2] != ''").to_bool(f),True) + eq_(mapnik.Expression("[prop2] != null and [prop2] != ''").to_bool(f),False) + f["prop3"] = None + eq_(f["prop3"],None) + eq_(mapnik.Expression("[prop3]").to_bool(f),False) + eq_(mapnik.Expression("! [prop3]").to_bool(f),True) + eq_(mapnik.Expression("[prop3] != null").to_bool(f),False) + eq_(mapnik.Expression("[prop3] = null").to_bool(f),True) + + # https://github.com/mapnik/mapnik/issues/1859 + #eq_(mapnik.Expression("[prop3] != ''").to_bool(f),True) + eq_(mapnik.Expression("[prop3] != ''").to_bool(f),False) + + eq_(mapnik.Expression("[prop3] = ''").to_bool(f),False) + + # https://github.com/mapnik/mapnik/issues/1859 + #eq_(mapnik.Expression("[prop3] != null or [prop3] != ''").to_bool(f),True) + eq_(mapnik.Expression("[prop3] != null or [prop3] != ''").to_bool(f),False) + + eq_(mapnik.Expression("[prop3] != null and [prop3] != ''").to_bool(f),False) + # attr not existing should behave the same as prop3 + eq_(mapnik.Expression("[prop4]").to_bool(f),False) + eq_(mapnik.Expression("! [prop4]").to_bool(f),True) + eq_(mapnik.Expression("[prop4] != null").to_bool(f),False) + eq_(mapnik.Expression("[prop4] = null").to_bool(f),True) + + # https://github.com/mapnik/mapnik/issues/1859 + ##eq_(mapnik.Expression("[prop4] != ''").to_bool(f),True) + eq_(mapnik.Expression("[prop4] != ''").to_bool(f),False) + + eq_(mapnik.Expression("[prop4] = ''").to_bool(f),False) + + # https://github.com/mapnik/mapnik/issues/1859 + ##eq_(mapnik.Expression("[prop4] != null or [prop4] != ''").to_bool(f),True) + eq_(mapnik.Expression("[prop4] != null or [prop4] != ''").to_bool(f),False) + + eq_(mapnik.Expression("[prop4] != null and [prop4] != ''").to_bool(f),False) + f["prop5"] = False + eq_(f["prop5"],False) + eq_(mapnik.Expression("[prop5]").to_bool(f),False) + eq_(mapnik.Expression("! [prop5]").to_bool(f),True) + eq_(mapnik.Expression("[prop5] != null").to_bool(f),True) + eq_(mapnik.Expression("[prop5] = null").to_bool(f),False) + eq_(mapnik.Expression("[prop5] != ''").to_bool(f),True) + eq_(mapnik.Expression("[prop5] = ''").to_bool(f),False) + eq_(mapnik.Expression("[prop5] != null or [prop5] != ''").to_bool(f),True) + eq_(mapnik.Expression("[prop5] != null and [prop5] != ''").to_bool(f),True) + # note, we need to do [prop5] != 0 here instead of false due to this bug: + # https://github.com/mapnik/mapnik/issues/1873 + eq_(mapnik.Expression("[prop5] != null and [prop5] != '' and [prop5] != 0").to_bool(f),False) + +# https://github.com/mapnik/mapnik/issues/1872 +def test_falseyness_comparision(): + context = mapnik.Context() + f = mapnik.Feature(context,0) + f["prop"] = 0 + eq_(mapnik.Expression("[prop]").to_bool(f),False) + eq_(mapnik.Expression("[prop] = false").to_bool(f),True) + eq_(mapnik.Expression("not [prop] != false").to_bool(f),True) + eq_(mapnik.Expression("not [prop] = true").to_bool(f),True) + eq_(mapnik.Expression("[prop] = true").to_bool(f),False) + eq_(mapnik.Expression("[prop] != true").to_bool(f),True) + +# https://github.com/mapnik/mapnik/issues/1806, fixed by https://github.com/mapnik/mapnik/issues/1872 +def test_truthyness_comparision(): + context = mapnik.Context() + f = mapnik.Feature(context,0) + f["prop"] = 1 + eq_(mapnik.Expression("[prop]").to_bool(f),True) + eq_(mapnik.Expression("[prop] = false").to_bool(f),False) + eq_(mapnik.Expression("not [prop] != false").to_bool(f),False) + eq_(mapnik.Expression("not [prop] = true").to_bool(f),False) + eq_(mapnik.Expression("[prop] = true").to_bool(f),True) + eq_(mapnik.Expression("[prop] != true").to_bool(f),False) + + if __name__ == "__main__": - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/font_test.py mapnik-2.2.0/tests/python_tests/font_test.py --- mapnik-2.1.0/tests/python_tests/font_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/font_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -1,7 +1,7 @@ #!/usr/bin/env python from nose.tools import * - +from utilities import execution_path, run_all import mapnik # Tests that exercise fonts. @@ -13,4 +13,4 @@ # ts = mapnik.TextSymbolizer('Name', 'Invalid Font Name', int(8), mapnik.Color('black')) if __name__ == "__main__": - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/fontset_test.py mapnik-2.2.0/tests/python_tests/fontset_test.py --- mapnik-2.1.0/tests/python_tests/fontset_test.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/fontset_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +from nose.tools import * +from utilities import execution_path +from utilities import execution_path, run_all +import os, mapnik + +def setup(): + # All of the paths used are relative, if we run the tests + # from another directory we need to chdir() + os.chdir(execution_path('.')) + +def test_loading_fontset_from_map(): + m = mapnik.Map(256,256) + mapnik.load_map(m,'../data/good_maps/fontset.xml',True) + fs = m.find_fontset('book-fonts') + eq_(len(fs.names),2) + eq_(list(fs.names),['DejaVu Sans Book','DejaVu Sans Oblique']) + +def test_loading_fontset_from_python(): + m = mapnik.Map(256,256) + fset = mapnik.FontSet('foo') + fset.add_face_name('Comic Sans') + fset.add_face_name('Papyrus') + eq_(fset.name,'foo') + fset.name = 'my-set' + eq_(fset.name,'my-set') + m.append_fontset('my-set', fset) + sty = mapnik.Style() + rule = mapnik.Rule() + tsym = mapnik.TextSymbolizer() + eq_(tsym.fontset,None) + tsym.fontset = fset + rule.symbols.append(tsym) + sty.rules.append(rule) + m.append_style('Style',sty) + serialized_map = mapnik.save_map_to_string(m) + eq_('fontset-name="my-set"' in serialized_map,True) + +if __name__ == "__main__": + setup() + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/geojson_plugin_test.py mapnik-2.2.0/tests/python_tests/geojson_plugin_test.py --- mapnik-2.1.0/tests/python_tests/geojson_plugin_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/geojson_plugin_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -2,8 +2,7 @@ # -*- coding: utf-8 -*- from nose.tools import * -from utilities import execution_path - +from utilities import execution_path, run_all import os, mapnik def setup(): @@ -11,19 +10,22 @@ # from another directory we need to chdir() os.chdir(execution_path('.')) -if 'geojson' in mapnik.DatasourceCache.instance().plugin_names(): +if 'geojson' in mapnik.DatasourceCache.plugin_names(): def test_geojson_init(): - s = mapnik.Datasource(type='geojson',file='../data/json/escaped.json') - e = s.envelope() + ds = mapnik.Datasource(type='geojson',file='../data/json/escaped.json') + e = ds.envelope() assert_almost_equal(e.minx, -81.705583, places=7) assert_almost_equal(e.miny, 41.480573, places=6) assert_almost_equal(e.maxx, -81.705583, places=5) assert_almost_equal(e.maxy, 41.480573, places=3) def test_geojson_properties(): - s = mapnik.Datasource(type='geojson',file='../data/json/escaped.json') - f = s.features_at_point(s.envelope().center()).features[0] + ds = mapnik.Datasource(type='geojson',file='../data/json/escaped.json') + f = ds.features_at_point(s.envelope().center()).features[0] + + desc = ds.describe() + eq_(desc['geometry_type'],mapnik.DataGeometryType.Point) eq_(f['name'], u'test') eq_(f['description'], u'Test: \u005C') @@ -34,8 +36,11 @@ eq_(f['NOM_FR'], u'Québec') def test_geojson_properties(): - s = mapnik.Datasource(type='geojson',file='../data/json/escaped.json') - f = s.all_features()[0] + ds = mapnik.Datasource(type='geojson',file='../data/json/escaped.json') + f = ds.all_features()[0] + + desc = ds.describe() + eq_(desc['geometry_type'],mapnik.DataGeometryType.Point) eq_(f['name'], u'Test') eq_(f['int'], 1) @@ -63,4 +68,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/geometry_io_test.py mapnik-2.2.0/tests/python_tests/geometry_io_test.py --- mapnik-2.1.0/tests/python_tests/geometry_io_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/geometry_io_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -2,8 +2,7 @@ from nose.tools import * import os,sys -from utilities import execution_path -from utilities import Todo +from utilities import execution_path, run_all import mapnik from binascii import unhexlify @@ -14,7 +13,7 @@ wkts = [ [1,"POINT(30 10)"], - [1,"POINT(30.0 10.0)"], + [1,"POINT(30 10)"], [1,"POINT(30.1 10.1)"], [1,"LINESTRING(30 10,10 30,40 40)"], [1,"POLYGON((30 10,10 20,20 40,40 40,30 10))"], @@ -61,7 +60,7 @@ ] geojson = [ -[1,'{"type":"Point","coordinates":[30.0,10.0]}'], +[1,'{"type":"Point","coordinates":[30,10]}'], [1,'{"type":"Point","coordinates":[30.0,10.0]}'], [1,'{"type":"Point","coordinates":[30.1,10.1]}'], [1,'{"type":"LineString","coordinates":[[30.0,10.0],[10.0,30.0],[40.0,40.0]]}'], @@ -195,16 +194,15 @@ f.geometries()[3] def test_wkt_rounding(): - raise Todo("fixme or remove test") # currently fails because we use output precision of 6 - should we make configurable? https://github.com/mapnik/mapnik/issues/1009 # if precision is set to 15 still fails due to very subtle rounding issues - wkt = "POLYGON((7.904185417583761 54.180426336712856,7.89918053477129 54.178168035931542,7.897715691021261 54.182318426556606,7.893565300396205 54.183111883587891,7.89039147227129 54.187567449994106,7.885874870708761 54.190680242962827,7.879893425396261 54.193915106244049,7.894541862896233 54.194647528119134,7.900645378521233 54.190680242962827,7.904185417583761 54.180426336712856))" + wkt = "POLYGON((7.904185 54.180426,7.89918 54.178168,7.897715 54.182318,7.893565 54.183111,7.890391 54.187567,7.885874 54.19068,7.879893 54.193915,7.894541 54.194647,7.900645 54.19068,7.904185 54.180426))" compare_wkt_from_wkt(wkt,1) def test_wkt_collection_flattening(): - raise Todo("fixme or remove test") + wkt = 'GEOMETRYCOLLECTION(POLYGON((1 1,2 1,2 2,1 2,1 1)),POLYGON((40 40,20 45,45 30,40 40)),POLYGON((20 35,45 20,30 5,10 10,10 30,20 35),(30 20,20 25,20 15,30 20)),LINESTRING(2 3,3 4))' # currently fails as the MULTIPOLYGON inside will be returned as multiple polygons - not a huge deal - should we worry? - wkt = "GEOMETRYCOLLECTION(POLYGON((1 1,2 1,2 2,1 2,1 1)),MULTIPOLYGON(((40 40,20 45,45 30,40 40)),((20 35,45 20,30 5,10 10,10 30,20 35),(30 20,20 25,20 15,30 20))),LINESTRING(2 3,3 4))" + #wkt = "GEOMETRYCOLLECTION(POLYGON((1 1,2 1,2 2,1 2,1 1)),MULTIPOLYGON(((40 40,20 45,45 30,40 40)),((20 35,45 20,30 5,10 10,10 30,20 35),(30 20,20 25,20 15,30 20))),LINESTRING(2 3,3 4))" compare_wkt_from_wkt(wkt,4) # skip since this data is not checked into tests @@ -226,4 +224,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/grayscale_test.py mapnik-2.2.0/tests/python_tests/grayscale_test.py --- mapnik-2.1.0/tests/python_tests/grayscale_test.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/grayscale_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,13 @@ +import mapnik +from nose.tools import * +from utilities import execution_path, run_all + +def test_grayscale_conversion(): + im = mapnik.Image(2,2) + im.background = mapnik.Color('white') + im.set_grayscale_to_alpha() + pixel = im.get_pixel(0,0) + eq_((pixel >> 24) & 0xff,255); + +if __name__ == "__main__": + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/image_encoding_speed_test.py mapnik-2.2.0/tests/python_tests/image_encoding_speed_test.py --- mapnik-2.1.0/tests/python_tests/image_encoding_speed_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/image_encoding_speed_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -5,7 +5,7 @@ import os, mapnik from timeit import Timer, time from nose.tools import * -from utilities import execution_path +from utilities import execution_path, run_all def setup(): # All of the paths used are relative, if we run the tests @@ -18,14 +18,24 @@ 'png8:m=h', 'png8:m=o:t=0', 'png8:m=o:t=1', + 'png8:m=o:t=2', 'png8:m=h:t=0', 'png8:m=h:t=1', + 'png8:m=h:t=2', 'png:z=1', + 'png:z=1:t=0', # forces rbg, no a 'png8:z=1', 'png8:z=1:m=o', 'png8:z=1:m=h', - 'png8:z=1:c=50', 'png8:z=1:c=1', + 'png8:z=1:c=24', + 'png8:z=1:c=64', + 'png8:z=1:c=128', + 'png8:z=1:c=200', + 'png8:z=1:c=255', + 'png8:z=9:c=64', + 'png8:z=9:c=128', + 'png8:z=9:c=200', 'png8:z=1:c=50:m=h', 'png8:z=1:c=1:m=o', 'png8:z=1:c=1:m=o:s=filtered', @@ -36,10 +46,18 @@ 'png:m=h;g=1.0', ] +tiles = [ +'blank', +'solid', +'many_colors', +'aerial_24' +] + +iterations = 10 + def do_encoding(): image = None - iterations = 10 results = {} sortable = {} @@ -53,47 +71,55 @@ min_ = min(set)*1000 avg = (sum(set)/len(set))*1000 name = func.__name__ + ' ' + format - results[name] = [avg,min_,elapsed*1000,name] - sortable[name] = [avg] + results[name] = [min_,avg,elapsed*1000,name,len(func())] + sortable[name] = [min_] - def blank(): - eval('image.tostring("%s")' % c) - blank_im = mapnik.Image(512,512) - - for c in combinations: - t = Timer(blank) - run(blank,blank_im,c,t) - - def solid(): - eval('image.tostring("%s")' % c) - solid_im = mapnik.Image(512,512) - solid_im.background = mapnik.Color("#f2efe9") - - for c in combinations: - t = Timer(solid) - run(solid,solid_im,c,t) - - def many_colors(): - eval('image.tostring("%s")' % c) - # lots of colors: http://tile.osm.org/13/4194/2747.png - many_colors_im = mapnik.Image.open('../data/images/13_4194_2747.png') - - for c in combinations: - t = Timer(many_colors) - run(many_colors,many_colors_im,c,t) + if 'blank' in tiles: + def blank(): + return eval('image.tostring("%s")' % c) + blank_im = mapnik.Image(512,512) + for c in combinations: + t = Timer(blank) + run(blank,blank_im,c,t) + + if 'solid' in tiles: + def solid(): + return eval('image.tostring("%s")' % c) + solid_im = mapnik.Image(512,512) + solid_im.background = mapnik.Color("#f2efe9") + for c in combinations: + t = Timer(solid) + run(solid,solid_im,c,t) + + if 'many_colors' in tiles: + def many_colors(): + return eval('image.tostring("%s")' % c) + # lots of colors: http://tile.osm.org/13/4194/2747.png + many_colors_im = mapnik.Image.open('../data/images/13_4194_2747.png') + for c in combinations: + t = Timer(many_colors) + run(many_colors,many_colors_im,c,t) + + if 'aerial_24' in tiles: + def aerial_24(): + return eval('image.tostring("%s")' % c) + aerial_24_im = mapnik.Image.open('../data/images/12_654_1580.png') + for c in combinations: + t = Timer(aerial_24) + run(aerial_24,aerial_24_im,c,t) for key, value in sorted(sortable.iteritems(), key=lambda (k,v): (v,k)): s = results[key] - avg = str(s[0])[:6] - min_ = str(s[1])[:6] + min_ = str(s[0])[:6] + avg = str(s[1])[:6] elapsed = str(s[2])[:6] + percent_reduction = s[4] name = s[3] - print 'avg: %sms | min: %sms | total: %sms <-- %s' % (min_,avg,elapsed,name) + size = s[4] + print 'min: %sms | avg: %sms | total: %sms | len: %s <-- %s' % (min_,avg,elapsed,size,name) if __name__ == "__main__": setup() do_encoding() - for t in dir(): - if 'test_' in t: - eval(t)() + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/image_filters_test.py mapnik-2.2.0/tests/python_tests/image_filters_test.py --- mapnik-2.1.0/tests/python_tests/image_filters_test.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/image_filters_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +from nose.tools import * +from utilities import execution_path, run_all +from utilities import side_by_side_image +import os, mapnik +import re + +def setup(): + # All of the paths used are relative, if we run the tests + # from another directory we need to chdir() + os.chdir(execution_path('.')) + +def replace_style(m, name, style): + m.remove_style(name) + m.append_style(name, style) + +def test_append(): + s = mapnik.Style() + eq_(s.image_filters,'') + s.image_filters = 'gray' + eq_(s.image_filters,'gray') + s.image_filters = 'sharpen' + eq_(s.image_filters,'sharpen') + +if 'shape' in mapnik.DatasourceCache.plugin_names(): + def test_style_level_image_filter(): + m = mapnik.Map(256, 256) + mapnik.load_map(m, '../data/good_maps/style_level_image_filter.xml') + m.zoom_all() + successes = [] + fails = [] + for name in ("", "agg-stack-blur(2,2)", "blur", + "edge-detect", "emboss", "gray", "invert", + "sharpen", "sobel", "x-gradient", "y-gradient"): + if name == "": + filename = "none" + else: + filename = re.sub(r"[^-_a-z.0-9]", "", name) + # find_style returns a copy of the style object + style_markers = m.find_style("markers") + style_markers.image_filters = name + style_labels = m.find_style("labels") + style_labels.image_filters = name + # replace the original style with the modified one + replace_style(m, "markers", style_markers) + replace_style(m, "labels", style_labels) + im = mapnik.Image(m.width, m.height) + mapnik.render(m, im) + actual = '/tmp/mapnik-style-image-filter-' + filename + '.png' + expected = 'images/style-image-filter/' + filename + '.png' + im.save(actual) + if not os.path.exists(expected): + print 'generating expected test image: %s' % expected + im.save(expected) + expected_im = mapnik.Image.open(expected) + # compare them + if im.tostring() == expected_im.tostring(): + successes.append(name) + else: + fails.append('failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected)) + fail_im = side_by_side_image(expected_im, im) + fail_im.save('/tmp/mapnik-style-image-filter-' + filename + '.fail.png') + eq_(len(fails), 0, '\n'+'\n'.join(fails)) + +if __name__ == "__main__": + setup() + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/image_test.py mapnik-2.2.0/tests/python_tests/image_test.py --- mapnik-2.1.0/tests/python_tests/image_test.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/image_test.py 2013-06-04 01:35:27.000000000 +0000 @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import sys +import os, mapnik +from timeit import Timer, time +from nose.tools import * +from utilities import execution_path, run_all + +def setup(): + # All of the paths used are relative, if we run the tests + # from another directory we need to chdir() + os.chdir(execution_path('.')) + +def test_tiff_round_trip(): + filepath = '/tmp/mapnik-tiff-io.tiff' + im = mapnik.Image(255,267) + im.background = mapnik.Color('rgba(1,2,3,.5)') + im.save(filepath,'tiff') + im2 = mapnik.Image.open(filepath) + eq_(im.width(),im2.width()) + eq_(im.height(),im2.height()) + eq_(len(im.tostring()),len(im2.tostring())) + eq_(len(im.tostring('tiff')),len(im2.tostring('tiff'))) + +def test_jpeg_round_trip(): + filepath = '/tmp/mapnik-jpeg-io.jpeg' + im = mapnik.Image(255,267) + im.background = mapnik.Color('rgba(1,2,3,.5)') + im.save(filepath,'jpeg') + im2 = mapnik.Image.open(filepath) + eq_(im.width(),im2.width()) + eq_(im.height(),im2.height()) + eq_(len(im.tostring()),len(im2.tostring())) + eq_(len(im.tostring('jpeg')),len(im2.tostring('jpeg'))) + +def test_png_round_trip(): + filepath = '/tmp/mapnik-png-io.png' + im = mapnik.Image(255,267) + im.background = mapnik.Color('rgba(1,2,3,.5)') + im.save(filepath,'png') + im2 = mapnik.Image.open(filepath) + eq_(im.width(),im2.width()) + eq_(im.height(),im2.height()) + eq_(len(im.tostring()),len(im2.tostring())) + eq_(len(im.tostring('png')),len(im2.tostring('png'))) + eq_(len(im.tostring('png8')),len(im2.tostring('png8'))) + +def test_image_open_from_string(): + filepath = '../data/images/dummy.png' + im1 = mapnik.Image.open(filepath) + im2 = mapnik.Image.fromstring(open(filepath,'rb').read()) + eq_(im1.width(),im2.width()) + length = len(im1.tostring()) + eq_(length,len(im2.tostring())) + eq_(len(mapnik.Image.fromstring(im1.tostring('png')).tostring()),length) + eq_(len(mapnik.Image.fromstring(im1.tostring('jpeg')).tostring()),length) + eq_(len(mapnik.Image.frombuffer(buffer(im1.tostring('png'))).tostring()),length) + eq_(len(mapnik.Image.frombuffer(buffer(im1.tostring('jpeg'))).tostring()),length) + + # TODO - https://github.com/mapnik/mapnik/issues/1831 + eq_(len(mapnik.Image.fromstring(im1.tostring('tiff')).tostring()),length) + eq_(len(mapnik.Image.frombuffer(buffer(im1.tostring('tiff'))).tostring()),length) + +if __name__ == "__main__": + setup() + run_all(eval(x) for x in dir() if x.startswith("test_")) Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/composited/color.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/composited/color.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/composited/grain_extract.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/composited/grain_extract.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/composited/grain_merge.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/composited/grain_merge.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/composited/hue.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/composited/hue.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/composited/saturation.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/composited/saturation.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/composited/src_over.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/composited/src_over.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/composited/value.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/composited/value.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/clear.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/clear.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/color.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/color.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/color_burn.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/color_burn.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/color_dodge.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/color_dodge.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/contrast.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/contrast.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/darken.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/darken.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/difference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/difference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/dst.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/dst.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/dst_atop.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/dst_atop.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/dst_in.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/dst_in.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/dst_out.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/dst_out.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/dst_over.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/dst_over.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/exclusion.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/exclusion.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/grain_extract.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/grain_extract.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/grain_merge.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/grain_merge.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/hard_light.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/hard_light.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/hue.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/hue.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/invert.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/invert.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/lighten.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/lighten.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/minus.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/minus.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/multiply.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/multiply.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/overlay.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/overlay.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/plus.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/plus.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/saturation.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/saturation.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/screen.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/screen.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/soft_light.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/soft_light.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/src.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/src.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/src_atop.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/src_atop.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/src_in.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/src_in.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/src_out.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/src_out.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/src_over.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/src_over.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/value.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/value.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-comp-op/xor.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-comp-op/xor.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-image-filter/agg-stack-blur22.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-image-filter/agg-stack-blur22.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-image-filter/blur.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-image-filter/blur.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-image-filter/edge-detect.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-image-filter/edge-detect.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-image-filter/emboss.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-image-filter/emboss.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-image-filter/gray.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-image-filter/gray.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-image-filter/invert.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-image-filter/invert.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-image-filter/none.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-image-filter/none.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-image-filter/sharpen.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-image-filter/sharpen.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-image-filter/sobel.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-image-filter/sobel.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-image-filter/x-gradient.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-image-filter/x-gradient.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/style-image-filter/y-gradient.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/style-image-filter/y-gradient.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/char_placement.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/char_placement.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/displacement.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/displacement.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/blank-png+t=0.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/blank-png+t=0.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/blank-png.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/blank-png.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+c=1+t=0.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+c=1+t=0.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+c=1.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+c=1.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+t=0.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+t=0.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+t=1.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+t=1.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+t=2.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+t=2.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=h.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=h.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+c=1+t=0.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+c=1+t=0.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+c=1.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+c=1.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+t=0.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+t=0.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+t=1.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+t=1.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+t=2.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+t=2.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=o.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/blank-png8+m=o.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/solid-png+t=0.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/solid-png+t=0.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/solid-png.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/solid-png.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+c=1+t=0.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+c=1+t=0.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+c=1.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+c=1.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+t=0.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+t=0.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+t=1.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+t=1.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+t=2.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+t=2.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=h.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=h.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+c=1+t=0.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+c=1+t=0.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+c=1.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+c=1.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+t=0.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+t=0.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+t=1.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+t=1.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+t=2.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+t=2.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=o.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/encoding-opts/solid-png8+m=o.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/mapnik-layer-buffer-size.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/mapnik-layer-buffer-size.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/mapnik-marker-ellipse-render1.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/mapnik-marker-ellipse-render1.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/mapnik-marker-ellipse-render2.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/mapnik-marker-ellipse-render2.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/mapnik-merc2merc-reprojection-render1.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/mapnik-merc2merc-reprojection-render1.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/mapnik-merc2merc-reprojection-render2.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/mapnik-merc2merc-reprojection-render2.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/mapnik-merc2wgs84-reprojection-render.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/mapnik-merc2wgs84-reprojection-render.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/mapnik-palette-test.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/mapnik-palette-test.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/mapnik-style-level-opacity.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/mapnik-style-level-opacity.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/mapnik-wgs842merc-reprojection-render.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/mapnik-wgs842merc-reprojection-render.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/marker-text-line-scale-factor-0.005.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/marker-text-line-scale-factor-0.005.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/marker-text-line-scale-factor-0.1.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/marker-text-line-scale-factor-0.1.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/marker-text-line-scale-factor-0.899.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/marker-text-line-scale-factor-0.899.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/marker-text-line-scale-factor-1.5.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/marker-text-line-scale-factor-1.5.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/marker-text-line-scale-factor-1.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/marker-text-line-scale-factor-1.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/marker-text-line-scale-factor-10.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/marker-text-line-scale-factor-10.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/marker-text-line-scale-factor-100.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/marker-text-line-scale-factor-100.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/marker-text-line-scale-factor-1e-05.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/marker-text-line-scale-factor-1e-05.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/marker-text-line-scale-factor-2.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/marker-text-line-scale-factor-2.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/marker-text-line-scale-factor-5.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/marker-text-line-scale-factor-5.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/overlap.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/overlap.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/raster-alpha-gradient.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/raster-alpha-gradient.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/raster-alpha.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/raster-alpha.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/spacing.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/spacing.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/tif_colortable.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/tif_colortable.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/transparency/aerial_rgb.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/transparency/aerial_rgb.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/transparency/aerial_rgba.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/transparency/aerial_rgba.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/transparency/white0.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/transparency/white0.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/transparency/white1.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/transparency/white1.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/transparency/white2.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/transparency/white2.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/python_tests/images/support/vrt_colortable.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/python_tests/images/support/vrt_colortable.png differ diff -Nru mapnik-2.1.0/tests/python_tests/introspection_test.py mapnik-2.2.0/tests/python_tests/introspection_test.py --- mapnik-2.1.0/tests/python_tests/introspection_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/introspection_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -2,7 +2,7 @@ import os from nose.tools import * -from utilities import execution_path +from utilities import execution_path, run_all import mapnik @@ -68,4 +68,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/json_feature_properties_test.py mapnik-2.2.0/tests/python_tests/json_feature_properties_test.py --- mapnik-2.1.0/tests/python_tests/json_feature_properties_test.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/json_feature_properties_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,103 @@ +#encoding: utf8 + +from nose.tools import * +import os,sys +import mapnik +from utilities import execution_path, run_all +try: + import json +except ImportError: + import simplejson as json + +chars = [ + { + "name":"single_quote", + "test": "string with ' quote", + "json": '{"type":"Feature","id":1,"geometry":null,"properties":{"name":"string with \' quote"}}' + }, + { + "name":"escaped_single_quote", + "test":"string with \' quote", + "json":'{"type":"Feature","id":1,"geometry":null,"properties":{"name":"string with \' quote"}}' + }, + { + "name":"double_quote", + "test":'string with " quote', + "json":'{"type":"Feature","id":1,"geometry":null,"properties":{"name":"string with \\" quote"}}' + }, + { + "name":"double_quote2", + "test":"string with \" quote", + "json":'{"type":"Feature","id":1,"geometry":null,"properties":{"name":"string with \\" quote"}}' + }, + { + "name":"reverse_solidus", # backslash + "test":"string with \\ quote", + "json":'{"type":"Feature","id":1,"geometry":null,"properties":{"name":"string with \\\ quote"}}' + }, + { + "name":"solidus", # forward slash + "test":"string with / quote", + "json":'{"type":"Feature","id":1,"geometry":null,"properties":{"name":"string with / quote"}}' + }, + { + "name":"backspace", + "test":"string with \b quote", + "json":'{"type":"Feature","id":1,"geometry":null,"properties":{"name":"string with \\b quote"}}' + }, + { + "name":"formfeed", + "test":"string with \f quote", + "json":'{"type":"Feature","id":1,"geometry":null,"properties":{"name":"string with \\f quote"}}' + }, + { + "name":"newline", + "test":"string with \n quote", + "json":'{"type":"Feature","id":1,"geometry":null,"properties":{"name":"string with \\n quote"}}' + }, + { + "name":"carriage_return", + "test":"string with \r quote", + "json":'{"type":"Feature","id":1,"geometry":null,"properties":{"name":"string with \\r quote"}}' + }, + { + "name":"horiztonal_tab", + "test":"string with \t quote", + "json":'{"type":"Feature","id":1,"geometry":null,"properties":{"name":"string with \\t quote"}}' + }, + # remainder are c++ reserved, but not json + { + "name":"vert_tab", + "test":"string with \v quote", + "json":'{"type":"Feature","id":1,"geometry":null,"properties":{"name":"string with \\u000b quote"}}' + }, + { + "name":"alert", + "test":"string with \a quote", + "json":'{"type":"Feature","id":1,"geometry":null,"properties":{"name":"string with \u0007 quote"}}' + } +] + +ctx = mapnik.Context() +ctx.push('name') + +def test_char_escaping(): + for char in chars: + feat = mapnik.Feature(ctx,1) + expected = char['test'] + feat["name"] = expected + eq_(feat["name"],expected) + # confirm the python json module + # is working as we would expect + pyjson2 = json.loads(char['json']) + eq_(pyjson2['properties']['name'],expected) + # confirm our behavior is the same as python json module + # for the original string + geojson_feat_string = feat.to_geojson() + eq_(geojson_feat_string,char['json'],"Mapnik's json escaping is not to spec: actual(%s) and expected(%s)" % (geojson_feat_string,char['json'])) + # and the round tripped string + pyjson = json.loads(geojson_feat_string) + eq_(pyjson['properties']['name'],expected) + +if __name__ == "__main__": + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/layer_buffer_size_test.py mapnik-2.2.0/tests/python_tests/layer_buffer_size_test.py --- mapnik-2.1.0/tests/python_tests/layer_buffer_size_test.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/layer_buffer_size_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,35 @@ +#coding=utf8 +import os +import mapnik +from utilities import execution_path, run_all +from nose.tools import * + +def setup(): + # All of the paths used are relative, if we run the tests + # from another directory we need to chdir() + os.chdir(execution_path('.')) + +if 'sqlite' in mapnik.DatasourceCache.plugin_names(): + + # the negative buffer on the layer should + # override the postive map buffer leading + # only one point to be rendered in the map + def test_layer_buffer_size_1(): + m = mapnik.Map(512,512) + eq_(m.buffer_size,0) + mapnik.load_map(m,'../data/good_maps/layer_buffer_size_reduction.xml') + eq_(m.buffer_size,256) + eq_(m.layers[0].buffer_size,-150) + m.zoom_all() + im = mapnik.Image(m.width,m.height) + mapnik.render(m,im) + actual = '/tmp/mapnik-layer-buffer-size.png' + expected = 'images/support/mapnik-layer-buffer-size.png' + im.save(actual) + expected_im = mapnik.Image.open(expected) + eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) + + +if __name__ == "__main__": + setup() + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/layer_modification_test.py mapnik-2.2.0/tests/python_tests/layer_modification_test.py --- mapnik-2.1.0/tests/python_tests/layer_modification_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/layer_modification_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -1,10 +1,8 @@ #!/usr/bin/env python -from nose.tools import * - import os from nose.tools import * -from utilities import execution_path +from utilities import execution_path, run_all import mapnik def setup(): @@ -74,4 +72,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/layer_test.py mapnik-2.2.0/tests/python_tests/layer_test.py --- mapnik-2.1.0/tests/python_tests/layer_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/layer_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- from nose.tools import * +from utilities import execution_path, run_all import mapnik # Map initialization @@ -20,8 +21,8 @@ eq_(l.maxzoom > 1e+6,True) eq_(l.group_by,"") eq_(l.maximum_extent,None) - eq_(l.buffer_size,0.0) + eq_(l.buffer_size,None) eq_(len(l.styles),0) if __name__ == "__main__": - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/load_map_test.py mapnik-2.2.0/tests/python_tests/load_map_test.py --- mapnik-2.1.0/tests/python_tests/load_map_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/load_map_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -1,7 +1,7 @@ #!/usr/bin/env python from nose.tools import * -from utilities import execution_path +from utilities import execution_path, run_all import os, sys, glob, mapnik @@ -10,50 +10,42 @@ # from another directory we need to chdir() os.chdir(execution_path('.')) -# We expect these files to not raise any -# exceptions at all -def assert_loads_successfully(file): - m = mapnik.Map(512, 512) - - try: - strict = True - mapnik.load_map(m, file, strict) - - # libxml2 is not smart about paths, and clips the last directory off - # of a path if it does not end in a trailing slash - base_path = os.path.dirname(file) + '/' - mapnik.load_map_from_string(m,open(file,'rb').read(),strict,base_path) - except RuntimeError, e: - # only test datasources that we have installed - if not 'Could not create datasource' in str(e): - raise RuntimeError(e) - - -# We expect these files to raise a RuntimeError -# and fail if there isn't one (or a different type -# of exception) -@raises(RuntimeError) -def assert_raises_runtime_error(file): - m = mapnik.Map(512, 512) - - strict = True - mapnik.load_map(m, file, strict) - def test_broken_files(): + default_logging_severity = mapnik.logger.get_severity() + mapnik.logger.set_severity(mapnik.severity_type.None) broken_files = glob.glob("../data/broken_maps/*.xml") - # Add a filename that doesn't exist broken_files.append("../data/broken/does_not_exist.xml") - for file in broken_files: - yield assert_raises_runtime_error, file + failures = []; + for filename in broken_files: + try: + m = mapnik.Map(512, 512) + strict = True + mapnik.load_map(m, filename, strict) + failures.append('Loading broken map (%s) did not raise RuntimeError!' % filename) + except RuntimeError: + pass + eq_(len(failures),0,'\n'+'\n'.join(failures)) + mapnik.logger.set_severity(default_logging_severity) def test_good_files(): good_files = glob.glob("../data/good_maps/*.xml") - for file in good_files: - yield assert_loads_successfully, file + failures = []; + for filename in good_files: + try: + m = mapnik.Map(512, 512) + strict = True + mapnik.load_map(m, filename, strict) + base_path = os.path.dirname(filename) + mapnik.load_map_from_string(m,open(filename,'rb').read(),strict,base_path) + except RuntimeError, e: + # only test datasources that we have installed + if not 'Could not create datasource' in str(e): + failures.append('Failed to load valid map (%s)!' % filename) + eq_(len(failures),0,'\n'+'\n'.join(failures)) if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/map_deepcopy_test.py mapnik-2.2.0/tests/python_tests/map_deepcopy_test.py --- mapnik-2.1.0/tests/python_tests/map_deepcopy_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/map_deepcopy_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -1,7 +1,7 @@ #!/usr/bin/env python from nose.tools import * -from utilities import execution_path +from utilities import execution_path, run_all from copy import deepcopy import os, mapnik @@ -40,4 +40,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/map_query_test.py mapnik-2.2.0/tests/python_tests/map_query_test.py --- mapnik-2.1.0/tests/python_tests/map_query_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/map_query_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -1,8 +1,7 @@ #!/usr/bin/env python from nose.tools import * -from utilities import execution_path - +from utilities import execution_path, run_all import os, mapnik def setup(): @@ -29,14 +28,14 @@ m = mapnik.Map(256,256) m.query_point(0,0,0) -if 'shape' in mapnik.DatasourceCache.instance().plugin_names(): +if 'shape' in mapnik.DatasourceCache.plugin_names(): # map has never been zoomed (even with data) @raises(RuntimeError) def test_map_query_throw4(): m = mapnik.Map(256,256) mapnik.load_map(m,'../data/good_maps/agg_poly_gamma_map.xml') m.query_point(0,0,0) - + # invalid coords in general (do not intersect) @raises(RuntimeError) def test_map_query_throw5(): @@ -44,17 +43,7 @@ mapnik.load_map(m,'../data/good_maps/agg_poly_gamma_map.xml') m.zoom_all() m.query_point(0,9999999999999999,9999999999999999) - - # invalid coords for back projecting - @raises(RuntimeError) - def test_map_query_throw6(): - m = mapnik.Map(256,256) - mapnik.load_map(m,'../data/good_maps/merc2wgs84_reprojection.xml') - wgs84_bounds = mapnik.Box2d(-180,-90,180,90) - m.maximum_extent = wgs84_bounds - m.zoom_all() - m.query_point(0,-180,-90) - + def test_map_query_works1(): m = mapnik.Map(256,256) mapnik.load_map(m,'../data/good_maps/wgs842merc_reprojection.xml') @@ -64,7 +53,7 @@ fs = m.query_point(0,-11012435.5376, 4599674.6134) # somewhere in kansas feat = fs.next() eq_(feat.attributes['NAME_FORMA'],u'United States of America') - + def test_map_query_works2(): m = mapnik.Map(256,256) mapnik.load_map(m,'../data/good_maps/merc2wgs84_reprojection.xml') @@ -73,12 +62,12 @@ # caution - will go square due to evil aspect_fix_mode backhandedness m.zoom_all() #mapnik.render_to_file(m,'works2.png') - # valid that aspec_fix_mode modified the bbox - eq_(m.envelope(),mapnik.Box2d(-179.999999975,-179.999999975,179.999999975,179.999999975)) + # validate that aspect_fix_mode modified the bbox reasonably + eq_(str(m.envelope()),str(mapnik.Box2d(-179.999999975,-167.951396161,179.999999975,192.048603789))) fs = m.query_point(0,-98.9264, 38.1432) # somewhere in kansas feat = fs.next() eq_(feat.attributes['NAME'],u'United States') - + def test_map_query_in_pixels_works1(): m = mapnik.Map(256,256) mapnik.load_map(m,'../data/good_maps/wgs842merc_reprojection.xml') @@ -88,7 +77,7 @@ fs = m.query_map_point(0,55,100) # somewhere in middle of us feat = fs.next() eq_(feat.attributes['NAME_FORMA'],u'United States of America') - + def test_map_query_in_pixels_works2(): m = mapnik.Map(256,256) mapnik.load_map(m,'../data/good_maps/merc2wgs84_reprojection.xml') @@ -96,12 +85,12 @@ m.maximum_extent = wgs84_bounds # caution - will go square due to evil aspect_fix_mode backhandedness m.zoom_all() - # valid that aspec_fix_mode modified the bbox - eq_(m.envelope(),mapnik.Box2d(-179.999999975,-179.999999975,179.999999975,179.999999975)) - fs = m.query_map_point(0,55,100) # somewhere in middle of us + # validate that aspect_fix_mode modified the bbox reasonably + eq_(str(m.envelope()),str(mapnik.Box2d(-179.999999975,-167.951396161,179.999999975,192.048603789))) + fs = m.query_map_point(0,55,100) # somewhere in Canada feat = fs.next() - eq_(feat.attributes['NAME'],u'United States') + eq_(feat.attributes['NAME'],u'Canada') if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/mapnik_config_test.py mapnik-2.2.0/tests/python_tests/mapnik_config_test.py --- mapnik-2.1.0/tests/python_tests/mapnik_config_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/mapnik_config_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -1,35 +1,80 @@ #!/usr/bin/env python from nose.tools import * -from subprocess import call +from utilities import execution_path, run_all +from subprocess import Popen, PIPE, STDOUT import os -#import os, sys, glob, mapnik +import os, sys, glob, mapnik -#def test(): -# # mapnik-config program -# # should be on default path... -# mc = 'mapnik-config' -# valid = ['--help', -# '--prefix', -# '--libs', -# '--dep-libs', -# '--ldflags', -# '--cflags', -# '--fonts', -# '--input-plugins', -# '-v', -# '--version', -# '--svn-revision', -# ] -# -# # valid args should return 1 -# for item in valid: -# eq_(0,call([mc,item])) -# -# # errors should return 1 -# eq_(1,call([mc,''])) -# eq_(1,call([mc,'foo'])) +def test_mapnik_config_no_args(): + process = Popen('mapnik-config', shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) + result = process.communicate() + eq_('Usage: mapnik-config ' in result[0],True) + eq_(result[1],'') + eq_(process.returncode,1) + +def test_mapnik_config_help(): + process = Popen('mapnik-config --help', shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) + result = process.communicate() + eq_('Usage: mapnik-config ' in result[0],True) + eq_(result[1],'') + eq_(process.returncode,0) + +def test_mapnik_config_help_short(): + process = Popen('mapnik-config -h', shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) + result = process.communicate() + eq_('Usage: mapnik-config ' in result[0],True) + eq_(result[1],'') + eq_(process.returncode,0) + +def test_mapnik_config_valid_opts(): + valid_args = [ + '-h', + '--help', + '-v', + '--version', + '--version-number', + '--git-revision', + '--git-describe', + '--fonts', + '--input-plugins', + '--defines', + '--prefix', + '--lib-name', + '--libs', + '--dep-libs', + '--ldflags', + '--includes', + '--dep-includes', + '--cxxflags', + '--cflags', + '--all-flags', + '--cxx' + ] + for item in valid_args: + cmd = 'mapnik-config ' + item + process = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) + result = process.communicate() + eq_(process.returncode,0) + eq_(len(result[0]) > 1,True,cmd) + eq_(result[1],'') + +def test_mapnik_config_invalid_option(): + cmd = 'mapnik-config --invalid-does-not-exist' + process = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) + result = process.communicate() + eq_(process.returncode,0) + eq_(result[0].strip(),'') + eq_(result[1].strip(),'unknown option --invalid-does-not-exist') + +def test_mapnik_config_valid_and_invalid_option(): + cmd = 'mapnik-config --libs --invalid-does-not-exist' + process = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) + result = process.communicate() + eq_('mapnik' in result[0],True) + eq_(result[1].strip(),'unknown option --invalid-does-not-exist') + eq_(process.returncode,0) if __name__ == "__main__": - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/mapnik_logger_test.py mapnik-2.2.0/tests/python_tests/mapnik_logger_test.py --- mapnik-2.1.0/tests/python_tests/mapnik_logger_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/mapnik_logger_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -1,5 +1,6 @@ #!/usr/bin/env python from nose.tools import * +from utilities import execution_path, run_all import mapnik def test_logger_init(): @@ -8,9 +9,10 @@ eq_(mapnik.severity_type.Error,2) eq_(mapnik.severity_type.None,3) default = mapnik.logger.get_severity() - mapnik.logger.set_severity(mapnik.severity_type.Debug) - eq_(mapnik.logger.get_severity(),mapnik.severity_type.Debug) + mapnik.logger.set_severity(mapnik.severity_type.Debug) + eq_(mapnik.logger.get_severity(),mapnik.severity_type.Debug) mapnik.logger.set_severity(default) + eq_(mapnik.logger.get_severity(),default) if __name__ == "__main__": - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/markers_complex_rendering_test.py mapnik-2.2.0/tests/python_tests/markers_complex_rendering_test.py --- mapnik-2.1.0/tests/python_tests/markers_complex_rendering_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/markers_complex_rendering_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -1,7 +1,7 @@ #coding=utf8 import os import mapnik -from utilities import execution_path +from utilities import execution_path, run_all from nose.tools import * def setup(): @@ -9,7 +9,7 @@ # from another directory we need to chdir() os.chdir(execution_path('.')) -if 'csv' in mapnik.DatasourceCache.instance().plugin_names(): +if 'csv' in mapnik.DatasourceCache.plugin_names(): def test_marker_ellipse_render1(): m = mapnik.Map(256,256) mapnik.load_map(m,'../data/good_maps/marker_ellipse_transform.xml') @@ -21,7 +21,7 @@ im.save(actual) expected_im = mapnik.Image.open(expected) eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) - + def test_marker_ellipse_render2(): # currently crashes https://github.com/mapnik/mapnik/issues/1365 m = mapnik.Map(256,256) @@ -37,4 +37,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/memory_datasource_test.py mapnik-2.2.0/tests/python_tests/memory_datasource_test.py --- mapnik-2.1.0/tests/python_tests/memory_datasource_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/memory_datasource_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -1,5 +1,6 @@ #encoding: utf8 import mapnik +from utilities import execution_path, run_all from nose.tools import * def test_add_feature(): @@ -30,4 +31,4 @@ eq_(len(retrieved), 0) if __name__ == "__main__": - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/multi_tile_raster_test.py mapnik-2.2.0/tests/python_tests/multi_tile_raster_test.py --- mapnik-2.1.0/tests/python_tests/multi_tile_raster_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/multi_tile_raster_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -1,8 +1,7 @@ #!/usr/bin/env python from nose.tools import * -from utilities import execution_path, save_data, contains_word - +from utilities import execution_path, run_all, contains_word import os, mapnik def setup(): @@ -13,7 +12,7 @@ def test_multi_tile_policy(): srs = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' lyr = mapnik.Layer('raster') - if 'raster' in mapnik.DatasourceCache.instance().plugin_names(): + if 'raster' in mapnik.DatasourceCache.plugin_names(): lyr.datasource = mapnik.Raster( file = '../data/raster_tiles/${x}/${y}.tif', lox = -180, @@ -40,8 +39,6 @@ im = mapnik.Image(_map.width, _map.height) mapnik.render(_map, im) - save_data('test_multi_tile_policy.png', im.tostring('png')) - # test green chunk eq_(im.view(0,64,1,1).tostring(), '\x00\xff\x00\xff') eq_(im.view(127,64,1,1).tostring(), '\x00\xff\x00\xff') @@ -68,4 +65,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/object_test.py mapnik-2.2.0/tests/python_tests/object_test.py --- mapnik-2.1.0/tests/python_tests/object_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/object_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -3,8 +3,7 @@ import os from nose.tools import * -from utilities import execution_path -from utilities import Todo +from utilities import execution_path, run_all import tempfile import mapnik @@ -14,6 +13,22 @@ # from another directory we need to chdir() os.chdir(execution_path('.')) +def test_debug_symbolizer(): + s = mapnik.DebugSymbolizer() + eq_(s.mode,mapnik.debug_symbolizer_mode.collision) + +def test_raster_symbolizer(): + s = mapnik.RasterSymbolizer() + eq_(s.comp_op,mapnik.CompositeOp.src_over) # note: mode is deprecated + eq_(s.scaling,mapnik.scaling_method.NEAR) + eq_(s.opacity,1.0) + eq_(s.colorizer,None) + eq_(s.filter_factor,-1) + eq_(s.mesh_size,16) + eq_(s.premultiplied,None) + s.premultiplied = True + eq_(s.premultiplied,True) + def test_line_pattern(): s = mapnik.LinePatternSymbolizer(mapnik.PathExpression('../data/images/dummy.png')) eq_(s.filename, '../data/images/dummy.png') @@ -75,6 +90,7 @@ s = mapnik.TextSymbolizer() eq_(s.comp_op,mapnik.CompositeOp.src_over) eq_(s.clip,True) + eq_(s.halo_rasterizer,mapnik.halo_rasterizer.FULL) # https://github.com/mapnik/mapnik/issues/1420 eq_(s.text_transform, mapnik.text_transform.NONE) @@ -155,7 +171,7 @@ # 11c34b1: default transform list is empty, not identity matrix eq_(s.transform, '') - eq_(len(s.fontset.names), 0) + eq_(s.fontset, None) # ShieldSymbolizer missing image file # images paths are now PathExpressions are evaluated at runtime @@ -170,11 +186,11 @@ def check_transform(expr, expect_str=None): s.transform = expr eq_(s.transform, expr if expect_str is None else expect_str) - check_transform("matrix(1 2 3 4 5 6)", "matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)") + check_transform("matrix(1 2 3 4 5 6)", "matrix(1, 2, 3, 4, 5, 6)") check_transform("matrix(1, 2, 3, 4, 5, 6 +7)", "matrix(1, 2, 3, 4, 5, (6+7))") check_transform("rotate([a])") check_transform("rotate([a] -2)", "rotate(([a]-2))") - check_transform("rotate([a] -2 -3)", "rotate([a], -2.0, -3.0)") + check_transform("rotate([a] -2 -3)", "rotate([a], -2, -3)") check_transform("rotate([a] -2 -3 -4)", "rotate(((([a]-2)-3)-4))") check_transform("rotate([a] -2, 3, 4)", "rotate(([a]-2), 3, 4)") check_transform("translate([tx]) rotate([a])") @@ -209,6 +225,7 @@ eq_(p.fill_opacity,None) eq_(p.filename,'shape://ellipse') eq_(p.placement,mapnik.marker_placement.POINT_PLACEMENT) + eq_(p.multi_policy,mapnik.marker_multi_policy.EACH) eq_(p.fill,None) eq_(p.ignore_placement,False) eq_(p.spacing,100) @@ -218,7 +235,7 @@ eq_(p.transform,'') eq_(p.clip,True) eq_(p.comp_op,mapnik.CompositeOp.src_over) - + p.width = mapnik.Expression('12') p.height = mapnik.Expression('12') @@ -239,10 +256,14 @@ p.allow_overlap = True p.opacity = 0.5 p.fill_opacity = 0.5 + p.placement = mapnik.marker_placement.LINE_PLACEMENT + p.multi_policy = mapnik.marker_multi_policy.WHOLE eq_(p.allow_overlap, True) eq_(p.opacity, 0.5) eq_(p.fill_opacity, 0.5) + eq_(p.multi_policy,mapnik.marker_multi_policy.WHOLE) + eq_(p.placement,mapnik.marker_placement.LINE_PLACEMENT) #https://github.com/mapnik/mapnik/issues/1285 #https://github.com/mapnik/mapnik/issues/1427 @@ -318,6 +339,16 @@ m = mapnik.Map(256, 256, '+proj=latlong') eq_(m.srs, '+proj=latlong') +def test_map_style_access(): + m = mapnik.Map(256, 256) + sty = mapnik.Style() + m.append_style("style",sty) + styles = list(m.styles) + eq_(len(styles),1) + eq_(styles[0][0],'style') + # returns a copy so let's just check it is the right instance + eq_(isinstance(styles[0][1],mapnik.Style),True) + def test_map_maximum_extent_modification(): m = mapnik.Map(256, 256) eq_(m.maximum_extent, None) @@ -533,4 +564,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/ogr_and_shape_geometries_test.py mapnik-2.2.0/tests/python_tests/ogr_and_shape_geometries_test.py --- mapnik-2.1.0/tests/python_tests/ogr_and_shape_geometries_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/ogr_and_shape_geometries_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -2,7 +2,7 @@ from nose.tools import * -from utilities import execution_path, Todo +from utilities import execution_path, run_all import os, sys, glob, mapnik @@ -18,7 +18,7 @@ "MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)),((20 35, 45 20, 30 5, 10 10, 10 30, 20 35),(30 20, 20 25, 20 15, 30 20)))" ] -plugins = mapnik.DatasourceCache.instance().plugin_names() +plugins = mapnik.DatasourceCache.plugin_names() if 'shape' in plugins and 'ogr' in plugins: def ensure_geometries_are_interpreted_equivalently(filename): @@ -41,4 +41,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/ogr_test.py mapnik-2.2.0/tests/python_tests/ogr_test.py --- mapnik-2.1.0/tests/python_tests/ogr_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/ogr_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -2,8 +2,7 @@ # -*- coding: utf-8 -*- from nose.tools import * -from utilities import execution_path - +from utilities import execution_path, run_all import os, mapnik def setup(): @@ -11,7 +10,7 @@ # from another directory we need to chdir() os.chdir(execution_path('.')) -if 'ogr' in mapnik.DatasourceCache.instance().plugin_names(): +if 'ogr' in mapnik.DatasourceCache.plugin_names(): # Shapefile initialization def test_shapefile_init(): @@ -26,22 +25,21 @@ # Shapefile properties def test_shapefile_properties(): - # NOTE: encoding is latin1 but gdal >= 1.9 should now expose utf8 encoded features - # See SHAPE_ENCODING for overriding: http://gdal.org/ogr/drv_shapefile.html - # So: failure for the NOM_FR field is expected for older gdal ds = mapnik.Ogr(file='../../demo/data/boundaries.shp',layer_by_index=0) - f = ds.features_at_point(ds.envelope().center()).features[0] + f = ds.features_at_point(ds.envelope().center(), 0.001).features[0] eq_(ds.geometry_type(),mapnik.DataGeometryType.Polygon) eq_(f['CGNS_FID'], u'6f733341ba2011d892e2080020a0f4c9') eq_(f['COUNTRY'], u'CAN') eq_(f['F_CODE'], u'FA001') eq_(f['NAME_EN'], u'Quebec') - # this seems to break if icu data linking is not working - eq_(f['NOM_FR'], u'Qu\xe9bec') - eq_(f['NOM_FR'], u'Québec') eq_(f['Shape_Area'], 1512185733150.0) eq_(f['Shape_Leng'], 19218883.724300001) + # NOTE: encoding is latin1 but gdal >= 1.9 should now expose utf8 encoded features + # See SHAPE_ENCODING for overriding: http://gdal.org/ogr/drv_shapefile.html + # Failure for the NOM_FR field is expected for older gdal + #eq_(f['NOM_FR'], u'Qu\xe9bec') + #eq_(f['NOM_FR'], u'Québec') @raises(RuntimeError) def test_that_nonexistant_query_field_throws(**kwargs): @@ -56,7 +54,12 @@ query.add_property_name('bogus') fs = ds.features(query) + # disabled because OGR prints an annoying error: ERROR 1: Invalid Point object. Missing 'coordinates' member. + #def test_handling_of_null_features(): + # ds = mapnik.Ogr(file='../data/json/null_feature.json',layer_by_index=0) + # fs = ds.all_features() + # eq_(len(fs),1) if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/osm_test.py mapnik-2.2.0/tests/python_tests/osm_test.py --- mapnik-2.1.0/tests/python_tests/osm_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/osm_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -2,8 +2,7 @@ # -*- coding: utf-8 -*- from nose.tools import * -from utilities import execution_path, Todo - +from utilities import execution_path, run_all import os, mapnik def setup(): @@ -11,9 +10,9 @@ # from another directory we need to chdir() os.chdir(execution_path('.')) -if 'osm' in mapnik.DatasourceCache.instance().plugin_names(): +if 'osm' in mapnik.DatasourceCache.plugin_names(): - # Shapefile initialization + # osm initialization def test_osm_init(): ds = mapnik.Osm(file='../data/osm/nodes.osm') @@ -25,14 +24,9 @@ eq_(e.maxx <= 180.0,True) eq_(e.maxy <= 90,True) - @raises(RuntimeError) def test_that_nonexistant_query_field_throws(**kwargs): - raise Todo("fixme") ds = mapnik.Osm(file='../data/osm/nodes.osm') - # ugh, more odd stuff hardcoded... - eq_(len(ds.fields()),5) - eq_(ds.fields(),['bicycle', 'foot', 'horse', 'name', 'width']) - eq_(ds.field_types(),['str', 'str', 'str', 'str', 'str']) + eq_(len(ds.fields()),0) query = mapnik.Query(ds.envelope()) for fld in ds.fields(): query.add_property_name(fld) @@ -40,7 +34,19 @@ query.add_property_name('bogus') fs = ds.features(query) + def test_that_64bit_int_fields_work(): + ds = mapnik.Osm(file='../data/osm/64bit.osm') + eq_(len(ds.fields()),4) + eq_(ds.fields(),['bigint', 'highway', 'junction', 'note']) + eq_(ds.field_types(),['str', 'str', 'str', 'str']) + fs = ds.featureset() + feat = fs.next() + eq_(feat.id(),4294968186) + eq_(feat['bigint'], None) + feat = fs.next() + eq_(feat['bigint'],'9223372036854775807') + if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/palette_test.py mapnik-2.2.0/tests/python_tests/palette_test.py --- mapnik-2.1.0/tests/python_tests/palette_test.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/palette_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from nose.tools import * +from utilities import execution_path, run_all +import os, mapnik + +def setup(): + # All of the paths used are relative, if we run the tests + # from another directory we need to chdir() + os.chdir(execution_path('.')) + +expected_64 = '[Palette 64 colors #494746 #c37631 #89827c #d1955c #7397b9 #fc9237 #a09f9c #fbc147 #9bb3ce #b7c9a1 #b5d29c #c4b9aa #cdc4a5 #d5c8a3 #c1d7aa #ccc4b6 #dbd19c #b2c4d5 #eae487 #c9c8c6 #e4db99 #c9dcb5 #dfd3ac #cbd2c2 #d6cdbc #dbd2b6 #c0ceda #ece597 #f7ef86 #d7d3c3 #dfcbc3 #d1d0cd #d1e2bf #d3dec1 #dbd3c4 #e6d8b6 #f4ef91 #d3d3cf #cad5de #ded7c9 #dfdbce #fcf993 #ffff8a #dbd9d7 #dbe7cd #d4dce2 #e4ded3 #ebe3c9 #e0e2e2 #f4edc3 #fdfcae #e9e5dc #f4edda #eeebe4 #fefdc5 #e7edf2 #edf4e5 #f2efe9 #f6ede7 #fefedd #f6f4f0 #f1f5f8 #fbfaf8 #ffffff]' + +expected_256 = '[Palette 256 colors #272727 #3c3c3c #484847 #564b41 #605243 #6a523e #555555 #785941 #5d5d5d #746856 #676767 #956740 #ba712e #787777 #cb752a #c27c3d #b68049 #dc8030 #df9e10 #878685 #e1a214 #928b82 #a88a70 #ea8834 #e7a81d #cb8d55 #909090 #94938c #e18f48 #f68d36 #6f94b7 #e1ab2e #8e959b #c79666 #999897 #ff9238 #ef9447 #a99a88 #f1b32c #919ca6 #a1a09f #f0b04b #8aa4bf #f8bc39 #b3ac8f #d1a67a #e3b857 #a8a8a7 #ffc345 #a2adb9 #afaeab #f9ab69 #afbba4 #c4c48a #b4b2af #dec177 #9ab2cf #a3bebb #d7b491 #b6cd9e #b5d29c #b9c8a2 #f1c969 #c5c79e #bbbab9 #cabdaa #a6bcd1 #cec4a7 #e7cc89 #dad98a #d5c9a3 #fabd8a #c1d7aa #cec5b4 #d1d1a5 #d9cf9f #c5c4c3 #d3c7b5 #ddd59d #b4c6d6 #d1cbb4 #d1c7ba #d7d1aa #e1c6ab #cbc7c2 #dbd0a9 #e8e58a #fee178 #d3cbba #dfd7a3 #d2cfb9 #c9ddb5 #d2cbbe #c3cbce #d7cbba #dcceb2 #dfd3aa #e5dd9a #dbd3b1 #ceccc6 #d7cbbe #d7cfba #dfc3be #dfd3ae #cbcbcb #cbd3c3 #d3cfc0 #e0d8aa #d7cfbe #dbd3b8 #ebe596 #dfd8b0 #c0ceda #f1ee89 #decfbc #d7cfc4 #d7d3c3 #d1d0cd #d2dfc0 #dbd3c3 #e7c7c3 #e7d7b3 #f2ed92 #d1e2bf #dad7c3 #fef383 #d3d3cf #dbd3c7 #e0d3c2 #dfd7c0 #ebe4a8 #dbd7c7 #dfd3c7 #f7f38f #c9d4de #dcdcc5 #dfd7c7 #e7d5c2 #d6d5d4 #faf78e #d7dfca #fbfb8a #fffb86 #dfd7cb #e5ddc0 #dad7d2 #ecd6c1 #cfd7de #e8d0cc #fbfb8e #fffb8a #eae3b8 #e3d7cd #dfdbce #fffb8e #ffff8a #f5efa6 #dae6cc #e3dbcf #edddc3 #dddbd6 #d5dbdf #ffff91 #e3dbd3 #fefc99 #e7dbd2 #eaddcd #e3dfd3 #ebd7d3 #dddddd #d4dee6 #e2dfd7 #fcdcc0 #e7dbd7 #e7dfd3 #ebe4cb #f4eeb8 #e3dfdb #e7dfd7 #ebded5 #e7e3d7 #fefea6 #e1ecd6 #ece5d3 #e7e3db #dee3e5 #ebe3db #efdfdb #efe3d8 #f4efc9 #e6ecdb #ebe3df #ebe7db #f0ecd3 #e5e6e5 #efe7da #ebe7df #efe3df #fefeb8 #dfe7ef #ebe7e3 #edebde #efe7e0 #e8efe0 #e7f3df #ebebe3 #e7ebe8 #f5edd9 #efebe3 #e3ebf1 #e9efe7 #ebebea #efebe7 #f0efe2 #ecf3e5 #fefdc9 #efefe7 #f3efe7 #f5f3e1 #f2efe9 #e9eef4 #ffeddf #efefef #f3efeb #f3f3eb #f0f7eb #fbf7e1 #fefed8 #f3f3ef #f7f3eb #eef3f7 #f7f7ea #f3f3f3 #f3f7ef #f7f3ef #f3f3f7 #f7f3f3 #f7f7ef #fffee3 #f3f7f7 #f7f7f3 #fcf7ee #f7f7f7 #f7fbf4 #f5f7fb #fbf7f6 #fffeef #f7fbfb #fbfbf7 #fbfbfb #fbfbff #fbfffb #fffbfb #fbffff #fffffb #ffffff]' + +expected_rgb = '[Palette 2 colors #ff00ff #ffffff]' + +def test_reading_palettes(): + act = open('../data/palettes/palette64.act','rb') + palette = mapnik.Palette(act.read(),'act') + eq_(palette.to_string(),expected_64); + act = open('../data/palettes/palette256.act','rb') + palette = mapnik.Palette(act.read(),'act') + eq_(palette.to_string(),expected_256); + palette = mapnik.Palette('\xff\x00\xff\xff\xff\xff', 'rgb') + eq_(palette.to_string(),expected_rgb); + +if 'shape' in mapnik.DatasourceCache.plugin_names(): + + def test_render_with_palette(): + m = mapnik.Map(600,400) + mapnik.load_map(m,'../data/good_maps/agg_poly_gamma_map.xml') + m.zoom_all() + im = mapnik.Image(m.width,m.height) + mapnik.render(m,im) + act = open('../data/palettes/palette256.act','rb') + palette = mapnik.Palette(act.read(),'act') + # test saving directly to filesystem + im.save('/tmp/mapnik-palette-test.png','png',palette) + # test saving to a string + open('/tmp/mapnik-palette-test2.png','wb').write(im.tostring('png',palette)); + # compare the two methods + eq_(mapnik.Image.open('/tmp/mapnik-palette-test.png').tostring(),mapnik.Image.open('/tmp/mapnik-palette-test2.png').tostring(),'%s not eq to %s' % ('/tmp/mapnik-palette-test.png','/tmp/mapnik-palette-test2.png')) + # compare to expected + eq_(mapnik.Image.open('/tmp/mapnik-palette-test.png').tostring(),mapnik.Image.open('./images/support/mapnik-palette-test.png').tostring(),'%s not eq to %s' % ('/tmp/mapnik-palette-test.png','./images/support/mapnik-palette-test.png')) + +if __name__ == "__main__": + setup() + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/parameters_test.py mapnik-2.2.0/tests/python_tests/parameters_test.py --- mapnik-2.1.0/tests/python_tests/parameters_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/parameters_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -2,30 +2,43 @@ # -*- coding: utf-8 -*- import os +import sys from nose.tools import * -from utilities import execution_path - +from utilities import execution_path, run_all import mapnik def setup(): os.chdir(execution_path('.')) -def test_parameter(): +def test_parameter_null(): + p = mapnik.Parameter('key',None) + eq_(p[0],'key') + eq_(p[1],None) + +def test_parameter_string(): p = mapnik.Parameter('key','value') eq_(p[0],'key') eq_(p[1],'value') - p = mapnik.Parameter('int',1) - eq_(p[0],'int') - eq_(p[1],1) +def test_parameter_unicode(): + p = mapnik.Parameter('key',u'value') + eq_(p[0],'key') + eq_(p[1],u'value') - p = mapnik.Parameter('float',1.0777) - eq_(p[0],'float') - eq_(p[1],1.0777) +def test_parameter_integer(): + p = mapnik.Parameter('int',sys.maxint) + eq_(p[0],'int') + eq_(p[1],sys.maxint) - p = mapnik.Parameter('bool_string','True') - eq_(p[0],'bool_string') - eq_(p[1],'True') +def test_parameter_double(): + p = mapnik.Parameter('double',float(sys.maxint)) + eq_(p[0],'double') + eq_(p[1],float(sys.maxint)) + +def test_parameter_boolean(): + p = mapnik.Parameter('boolean',True) + eq_(p[0],'boolean') + eq_(p[1],True) eq_(bool(p[1]),True) @@ -45,4 +58,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/pickling_test.py mapnik-2.2.0/tests/python_tests/pickling_test.py --- mapnik-2.1.0/tests/python_tests/pickling_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/pickling_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -3,8 +3,7 @@ import os from nose.tools import * -from utilities import execution_path -from utilities import Todo +from utilities import execution_path, run_all import tempfile import mapnik, pickle @@ -43,4 +42,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/png_encoding_test.py mapnik-2.2.0/tests/python_tests/png_encoding_test.py --- mapnik-2.1.0/tests/python_tests/png_encoding_test.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/png_encoding_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,139 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import sys +import os, mapnik +from timeit import Timer, time +from nose.tools import * +from utilities import execution_path, run_all + +def setup(): + # All of the paths used are relative, if we run the tests + # from another directory we need to chdir() + os.chdir(execution_path('.')) + +tmp_dir = '/tmp/mapnik-png/' +if not os.path.exists(tmp_dir): + os.makedirs(tmp_dir) + +opts = [ +'png', +'png:t=0', +'png8:m=o', +'png8:m=o:c=1', +'png8:m=o:t=0', +'png8:m=o:c=1:t=0', +'png8:m=o:t=1', +'png8:m=o:t=2', +'png8:m=h', +'png8:m=h:c=1', +'png8:m=h:t=0', +'png8:m=h:c=1:t=0', +'png8:m=h:t=1', +'png8:m=h:t=2', +] + +# Todo - use itertools.product +#z_opts = range(1,9+1) +#t_opts = range(0,2+1) + +def gen_filepath(name,format): + return os.path.join('images/support/encoding-opts',name+'-'+format.replace(":","+")+'.png') + +generate = False + +def test_expected_encodings(): + im = mapnik.Image(256,256) + for opt in opts: + expected = gen_filepath('solid',opt) + actual = os.path.join(tmp_dir,os.path.basename(expected)) + if generate or not os.path.exists(expected): + print 'generating expected image %s' % expected + im.save(expected,opt) + else: + im.save(actual,opt) + eq_(mapnik.Image.open(actual).tostring(), + mapnik.Image.open(expected).tostring(), + '%s (actual) not == to %s (expected)' % (actual,expected)) + + for opt in opts: + expected = gen_filepath('blank',opt) + actual = os.path.join(tmp_dir,os.path.basename(expected)) + if generate or not os.path.exists(expected): + print 'generating expected image %s' % expected + im.save(expected,opt) + else: + im.save(actual,opt) + eq_(mapnik.Image.open(actual).tostring(), + mapnik.Image.open(expected).tostring(), + '%s (actual) not == to %s (expected)' % (actual,expected)) + +def test_transparency_levels(): + # create partial transparency image + im = mapnik.Image(256,256) + im.background = mapnik.Color('rgba(255,255,255,.5)') + c2 = mapnik.Color('rgba(255,255,0,.2)') + c3 = mapnik.Color('rgb(0,255,255)') + for y in range(0,im.height()/2): + for x in range(0,im.width()/2): + im.set_pixel(x,y,c2) + for y in range(im.height()/2,im.height()): + for x in range(im.width()/2,im.width()): + im.set_pixel(x,y,c3) + + t0 = tmp_dir + 'white0.png' + t2 = tmp_dir + 'white2.png' + t1 = tmp_dir + 'white1.png' + + # octree + format = 'png8:m=o:t=0' + im.save(t0,format) + im_in = mapnik.Image.open(t0) + t0_len = len(im_in.tostring(format)) + eq_(t0_len,len(mapnik.Image.open('images/support/transparency/white0.png').tostring(format))) + format = 'png8:m=o:t=1' + im.save(t1,format) + im_in = mapnik.Image.open(t1) + t1_len = len(im_in.tostring(format)) + eq_(len(im.tostring(format)),len(mapnik.Image.open('images/support/transparency/white1.png').tostring(format))) + format = 'png8:m=o:t=2' + im.save(t2,format) + im_in = mapnik.Image.open(t2) + t2_len = len(im_in.tostring(format)) + eq_(len(im.tostring(format)),len(mapnik.Image.open('images/support/transparency/white2.png').tostring(format))) + + eq_(t0_len < t1_len < t2_len,True) + + # hextree + format = 'png8:m=h:t=0' + im.save(t0,format) + im_in = mapnik.Image.open(t0) + t0_len = len(im_in.tostring(format)) + eq_(t0_len,len(mapnik.Image.open('images/support/transparency/white0.png').tostring(format))) + format = 'png8:m=h:t=1' + im.save(t1,format) + im_in = mapnik.Image.open(t1) + t1_len = len(im_in.tostring(format)) + eq_(len(im.tostring(format)),len(mapnik.Image.open('images/support/transparency/white1.png').tostring(format))) + format = 'png8:m=h:t=2' + im.save(t2,format) + im_in = mapnik.Image.open(t2) + t2_len = len(im_in.tostring(format)) + eq_(len(im.tostring(format)),len(mapnik.Image.open('images/support/transparency/white2.png').tostring(format))) + + eq_(t0_len < t1_len < t2_len,True) + +def test_transparency_levels_aerial(): + im = mapnik.Image.open('../data/images/12_654_1580.png') + im_in = mapnik.Image.open('./images/support/transparency/aerial_rgba.png') + eq_(len(im.tostring('png')),len(im_in.tostring('png'))) + + im_in = mapnik.Image.open('./images/support/transparency/aerial_rgb.png') + eq_(len(im.tostring('png')),len(im_in.tostring('png'))) + eq_(len(im.tostring('png:t=0')),len(im_in.tostring('png:t=0'))) + eq_(len(im.tostring('png:t=0')) == len(im_in.tostring('png')), False) + + +if __name__ == "__main__": + setup() + run_all(eval(x) for x in dir() if x.startswith("test_")) \ No newline at end of file diff -Nru mapnik-2.1.0/tests/python_tests/pngsuite_test.py mapnik-2.2.0/tests/python_tests/pngsuite_test.py --- mapnik-2.1.0/tests/python_tests/pngsuite_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/pngsuite_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -3,7 +3,7 @@ import os import mapnik from nose.tools import * -from utilities import execution_path +from utilities import execution_path, run_all datadir = '../data/pngsuite' @@ -32,4 +32,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/postgis_test.py mapnik-2.2.0/tests/python_tests/postgis_test.py --- mapnik-2.1.0/tests/python_tests/postgis_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/postgis_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -3,9 +3,12 @@ from nose.tools import * import atexit import time -from utilities import execution_path +from utilities import execution_path, run_all from subprocess import Popen, PIPE import os, mapnik +from Queue import Queue +import threading + MAPNIK_TEST_DBNAME = 'mapnik-tmp-postgis-test-db' POSTGIS_TEMPLATE_DBNAME = 'template_postgis' @@ -129,6 +132,26 @@ INSERT INTO test7(gid, geom) values (1, GeomFromEWKT('SRID=4326;GEOMETRYCOLLECTION(MULTILINESTRING((10 10,20 20,10 40),(40 40,30 30,40 20,30 10)),LINESTRING EMPTY)')); ''' +insert_table_8 = ''' +CREATE TABLE test8(gid serial PRIMARY KEY,int_field bigint, geom geometry); +INSERT INTO test8(gid, int_field, geom) values (1, 2147483648, ST_MakePoint(1,1)); +INSERT INTO test8(gid, int_field, geom) values (2, 922337203685477580, ST_MakePoint(1,1)); +''' + +insert_table_9 = ''' +CREATE TABLE test9(gid serial PRIMARY KEY, name varchar, geom geometry); +INSERT INTO test9(gid, name, geom) values (1, 'name', ST_MakePoint(1,1)); +INSERT INTO test9(gid, name, geom) values (2, '', ST_MakePoint(1,1)); +INSERT INTO test9(gid, name, geom) values (3, null, ST_MakePoint(1,1)); +''' + +insert_table_10 = ''' +CREATE TABLE test10(gid serial PRIMARY KEY, bool_field boolean, geom geometry); +INSERT INTO test10(gid, bool_field, geom) values (1, TRUE, ST_MakePoint(1,1)); +INSERT INTO test10(gid, bool_field, geom) values (2, FALSE, ST_MakePoint(1,1)); +INSERT INTO test10(gid, bool_field, geom) values (3, null, ST_MakePoint(1,1)); +''' + def postgis_setup(): call('dropdb %s' % MAPNIK_TEST_DBNAME,silent=True) @@ -143,13 +166,16 @@ call("""psql -q %s -c '%s'""" % (MAPNIK_TEST_DBNAME,insert_table_5b),silent=False) call('''psql -q %s -c "%s"''' % (MAPNIK_TEST_DBNAME,insert_table_6),silent=False) call('''psql -q %s -c "%s"''' % (MAPNIK_TEST_DBNAME,insert_table_7),silent=False) + call('''psql -q %s -c "%s"''' % (MAPNIK_TEST_DBNAME,insert_table_8),silent=False) + call('''psql -q %s -c "%s"''' % (MAPNIK_TEST_DBNAME,insert_table_9),silent=False) + call('''psql -q %s -c "%s"''' % (MAPNIK_TEST_DBNAME,insert_table_10),silent=False) def postgis_takedown(): pass # fails as the db is in use: https://github.com/mapnik/mapnik/issues/960 #call('dropdb %s' % MAPNIK_TEST_DBNAME) -if 'postgis' in mapnik.DatasourceCache.instance().plugin_names() \ +if 'postgis' in mapnik.DatasourceCache.plugin_names() \ and createdb_and_dropdb_on_path() \ and psql_can_connect() \ and shp2pgsql_on_path(): @@ -443,9 +469,195 @@ fs = ds.featureset() eq_(fs.next()['gid'],1) + def create_ds(): + ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME, + table='test', + max_size=20, + geometry_field='geom') + fs = ds.all_features() + + def test_threaded_create(NUM_THREADS=100): + # run one to start before thread loop + # to ensure that a throw stops the test + # from running all threads + create_ds() + for i in range(NUM_THREADS): + t = threading.Thread(target=create_ds) + t.start() + t.join() + + def create_ds_and_error(): + try: + ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME, + table='asdfasdfasdfasdfasdf', + max_size=20) + fs = ds.all_features() + except: pass + + def test_threaded_create2(NUM_THREADS=10): + for i in range(NUM_THREADS): + t = threading.Thread(target=create_ds_and_error) + t.start() + t.join() + + def test_that_64bit_int_fields_work(): + ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME, + table='test8', + geometry_field='geom') + eq_(len(ds.fields()),2) + eq_(ds.fields(),['gid','int_field']) + eq_(ds.field_types(),['int','int']) + fs = ds.featureset() + feat = fs.next() + eq_(feat.id(),1) + eq_(feat['gid'],1) + eq_(feat['int_field'],2147483648) + feat = fs.next() + eq_(feat.id(),2) + eq_(feat['gid'],2) + eq_(feat['int_field'],922337203685477580) + + def test_persist_connection_off(): + # NOTE: max_size should be equal or greater than + # the pool size. There's currently no API to + # check nor set that size, but the current + # default is 20, so we use that value. See + # http://github.com/mapnik/mapnik/issues/863 + max_size = 20 + for i in range(0, max_size+1): + ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME, + max_size=1, # unused + persist_connection=False, + table='(select ST_MakePoint(0,0) as g, pg_backend_pid() as p, 1 as v) as w', + geometry_field='g') + fs = ds.featureset() + eq_(fs.next()['v'], 1) + + def test_null_comparision(): + ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='test9', + geometry_field='geom') + fs = ds.featureset() + feat = fs.next() + eq_(feat['gid'],1) + eq_(feat['name'],'name') + eq_(mapnik.Expression("[name] = 'name'").evaluate(feat),True) + eq_(mapnik.Expression("[name] = ''").evaluate(feat),False) + eq_(mapnik.Expression("[name] = null").evaluate(feat),False) + eq_(mapnik.Expression("[name] = true").evaluate(feat),False) + eq_(mapnik.Expression("[name] = false").evaluate(feat),False) + eq_(mapnik.Expression("[name] != 'name'").evaluate(feat),False) + eq_(mapnik.Expression("[name] != ''").evaluate(feat),True) + eq_(mapnik.Expression("[name] != null").evaluate(feat),True) + eq_(mapnik.Expression("[name] != true").evaluate(feat),True) + eq_(mapnik.Expression("[name] != false").evaluate(feat),True) + + feat = fs.next() + eq_(feat['gid'],2) + eq_(feat['name'],'') + eq_(mapnik.Expression("[name] = 'name'").evaluate(feat),False) + eq_(mapnik.Expression("[name] = ''").evaluate(feat),True) + eq_(mapnik.Expression("[name] = null").evaluate(feat),False) + eq_(mapnik.Expression("[name] = true").evaluate(feat),False) + eq_(mapnik.Expression("[name] = false").evaluate(feat),False) + eq_(mapnik.Expression("[name] != 'name'").evaluate(feat),True) + eq_(mapnik.Expression("[name] != ''").evaluate(feat),False) + eq_(mapnik.Expression("[name] != null").evaluate(feat),True) + eq_(mapnik.Expression("[name] != true").evaluate(feat),True) + eq_(mapnik.Expression("[name] != false").evaluate(feat),True) + + feat = fs.next() + eq_(feat['gid'],3) + eq_(feat['name'],None) # null + eq_(mapnik.Expression("[name] = 'name'").evaluate(feat),False) + eq_(mapnik.Expression("[name] = ''").evaluate(feat),False) + eq_(mapnik.Expression("[name] = null").evaluate(feat),True) + eq_(mapnik.Expression("[name] = true").evaluate(feat),False) + eq_(mapnik.Expression("[name] = false").evaluate(feat),False) + eq_(mapnik.Expression("[name] != 'name'").evaluate(feat),True) + # https://github.com/mapnik/mapnik/issues/1859 + eq_(mapnik.Expression("[name] != ''").evaluate(feat),False) + eq_(mapnik.Expression("[name] != null").evaluate(feat),False) + eq_(mapnik.Expression("[name] != true").evaluate(feat),True) + eq_(mapnik.Expression("[name] != false").evaluate(feat),True) + + def test_null_comparision2(): + ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='test10', + geometry_field='geom') + fs = ds.featureset() + feat = fs.next() + eq_(feat['gid'],1) + eq_(feat['bool_field'],True) + eq_(mapnik.Expression("[bool_field] = 'name'").evaluate(feat),False) + eq_(mapnik.Expression("[bool_field] = ''").evaluate(feat),False) + eq_(mapnik.Expression("[bool_field] = null").evaluate(feat),False) + eq_(mapnik.Expression("[bool_field] = true").evaluate(feat),True) + eq_(mapnik.Expression("[bool_field] = false").evaluate(feat),False) + eq_(mapnik.Expression("[bool_field] != 'name'").evaluate(feat),True) + eq_(mapnik.Expression("[bool_field] != ''").evaluate(feat),True) # in 2.1.x used to be False + eq_(mapnik.Expression("[bool_field] != null").evaluate(feat),True) # in 2.1.x used to be False + eq_(mapnik.Expression("[bool_field] != true").evaluate(feat),False) + eq_(mapnik.Expression("[bool_field] != false").evaluate(feat),True) + + feat = fs.next() + eq_(feat['gid'],2) + eq_(feat['bool_field'],False) + eq_(mapnik.Expression("[bool_field] = 'name'").evaluate(feat),False) + eq_(mapnik.Expression("[bool_field] = ''").evaluate(feat),False) + eq_(mapnik.Expression("[bool_field] = null").evaluate(feat),False) + eq_(mapnik.Expression("[bool_field] = true").evaluate(feat),False) + eq_(mapnik.Expression("[bool_field] = false").evaluate(feat),True) + eq_(mapnik.Expression("[bool_field] != 'name'").evaluate(feat),True) + eq_(mapnik.Expression("[bool_field] != ''").evaluate(feat),True) + eq_(mapnik.Expression("[bool_field] != null").evaluate(feat),True) # in 2.1.x used to be False + eq_(mapnik.Expression("[bool_field] != true").evaluate(feat),True) + eq_(mapnik.Expression("[bool_field] != false").evaluate(feat),False) + + feat = fs.next() + eq_(feat['gid'],3) + eq_(feat['bool_field'],None) # null + eq_(mapnik.Expression("[bool_field] = 'name'").evaluate(feat),False) + eq_(mapnik.Expression("[bool_field] = ''").evaluate(feat),False) + eq_(mapnik.Expression("[bool_field] = null").evaluate(feat),True) + eq_(mapnik.Expression("[bool_field] = true").evaluate(feat),False) + eq_(mapnik.Expression("[bool_field] = false").evaluate(feat),False) + eq_(mapnik.Expression("[bool_field] != 'name'").evaluate(feat),True) # in 2.1.x used to be False + # https://github.com/mapnik/mapnik/issues/1859 + eq_(mapnik.Expression("[bool_field] != ''").evaluate(feat),False) + eq_(mapnik.Expression("[bool_field] != null").evaluate(feat),False) + eq_(mapnik.Expression("[bool_field] != true").evaluate(feat),True) # in 2.1.x used to be False + eq_(mapnik.Expression("[bool_field] != false").evaluate(feat),True) # in 2.1.x used to be False + + # https://github.com/mapnik/mapnik/issues/1816 + def test_exception_message_reporting(): + try: + ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='doesnotexist') + except Exception, e: + eq_(e.message != 'unidentifiable C++ exception', True) + + def test_null_id_field(): + opts = {'type':'postgis', + 'dbname':MAPNIK_TEST_DBNAME, + 'geometry_field':'geom', + 'table':"(select null::bigint as osm_id, GeomFromEWKT('SRID=4326;POINT(0 0)') as geom) as tmp"} + ds = mapnik.Datasource(**opts) + fs = ds.featureset() + feat = fs.next() + eq_(feat.id(),1L) + eq_(feat['osm_id'],None) + + @raises(StopIteration) + def test_null_key_field(): + opts = {'type':'postgis', + "key_field": 'osm_id', + 'dbname':MAPNIK_TEST_DBNAME, + 'geometry_field':'geom', + 'table':"(select null::bigint as osm_id, GeomFromEWKT('SRID=4326;POINT(0 0)') as geom) as tmp"} + ds = mapnik.Datasource(**opts) + fs = ds.featureset() + feat = fs.next() ## should throw since key_field is null: StopIteration: No more features. + atexit.register(postgis_takedown) if __name__ == "__main__": setup() - #test_auto_detection_and_subquery() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/projection_test.py mapnik-2.2.0/tests/python_tests/projection_test.py --- mapnik-2.1.0/tests/python_tests/projection_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/projection_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -3,6 +3,9 @@ from nose.tools import * import mapnik +import random +import math +from utilities import run_all # Tests that exercise map projections. @@ -46,5 +49,70 @@ assert_almost_equal(e.forward(p).center().y, e.center().y) assert_almost_equal(e.forward(p).center().x, e.center().x) +def wgs2merc(lon,lat): + x = lon * 20037508.34 / 180; + y = math.log(math.tan((90 + lat) * math.pi / 360)) / (math.pi / 180); + y = y * 20037508.34 / 180; + return [x,y]; + +def merc2wgs(x,y): + x = (x / 20037508.34) * 180; + y = (y / 20037508.34) * 180; + y = 180 / math.pi * (2 * math.atan(math.exp(y * math.pi/180)) - math.pi/2); + if x > 180: x = 180; + if x < -180: x = -180; + if y > 85.0511: y = 85.0511; + if y < -85.0511: y = -85.0511; + return [x,y] + +#echo -109 37 | cs2cs -f "%.10f" +init=epsg:4326 +to +init=epsg:3857 +#-12133824.4964668211 4439106.7872505859 0.0000000000 + +## todo +# benchmarks +# better well known detection +# better srs matching with strip/trim +# python copy to avoid crash + +def test_proj_transform_between_init_and_literal(): + one = mapnik.Projection('+init=epsg:4326') + two = mapnik.Projection('+init=epsg:3857') + tr1 = mapnik.ProjTransform(one,two) + tr1b = mapnik.ProjTransform(two,one) + wgs84 = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' + merc = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over' + src = mapnik.Projection(wgs84) + dest = mapnik.Projection(merc) + tr2 = mapnik.ProjTransform(src,dest) + tr2b = mapnik.ProjTransform(dest,src) + for x in xrange(-180,180,10): + for y in xrange(-60,60,10): + coord = mapnik.Coord(x,y) + merc_coord1 = tr1.forward(coord) + merc_coord2 = tr1b.backward(coord) + merc_coord3 = tr2.forward(coord) + merc_coord4 = tr2b.backward(coord) + eq_(math.fabs(merc_coord1.x - merc_coord1.x) < 1,True) + eq_(math.fabs(merc_coord1.x - merc_coord2.x) < 1,True) + eq_(math.fabs(merc_coord1.x - merc_coord3.x) < 1,True) + eq_(math.fabs(merc_coord1.x - merc_coord4.x) < 1,True) + eq_(math.fabs(merc_coord1.y - merc_coord1.y) < 1,True) + eq_(math.fabs(merc_coord1.y - merc_coord2.y) < 1,True) + eq_(math.fabs(merc_coord1.y - merc_coord3.y) < 1,True) + eq_(math.fabs(merc_coord1.y - merc_coord4.y) < 1,True) + lon_lat_coord1 = tr1.backward(merc_coord1) + lon_lat_coord2 = tr1b.forward(merc_coord2) + lon_lat_coord3 = tr2.backward(merc_coord3) + lon_lat_coord4 = tr2b.forward(merc_coord4) + eq_(math.fabs(coord.x - lon_lat_coord1.x) < 1,True) + eq_(math.fabs(coord.x - lon_lat_coord2.x) < 1,True) + eq_(math.fabs(coord.x - lon_lat_coord3.x) < 1,True) + eq_(math.fabs(coord.x - lon_lat_coord4.x) < 1,True) + eq_(math.fabs(coord.y - lon_lat_coord1.y) < 1,True) + eq_(math.fabs(coord.y - lon_lat_coord2.y) < 1,True) + eq_(math.fabs(coord.y - lon_lat_coord3.y) < 1,True) + eq_(math.fabs(coord.y - lon_lat_coord4.y) < 1,True) + + if __name__ == "__main__": - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/python_plugin_test.py mapnik-2.2.0/tests/python_tests/python_plugin_test.py --- mapnik-2.1.0/tests/python_tests/python_plugin_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/python_plugin_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -5,7 +5,7 @@ import math import mapnik import sys -from utilities import execution_path +from utilities import execution_path, run_all from nose.tools import * def setup(): @@ -16,15 +16,17 @@ class PointDatasource(mapnik.PythonDatasource): def __init__(self): super(PointDatasource, self).__init__( - envelope = mapnik.Box2d(0,-10,100,110) + geometry_type = mapnik.DataGeometryType.Point, + envelope = mapnik.Box2d(0,-10,100,110), + data_type = mapnik.DataType.Vector ) def features(self, query): return mapnik.PythonDatasource.wkt_features( - keys = ('label',), + keys = ('label',), features = ( - ( 'POINT (5 6)', { 'label': 'foo-bar'} ), - ( 'POINT (60 50)', { 'label': 'buzz-quux'} ), + ( 'POINT (5 6)', { 'label': 'foo-bar'} ), + ( 'POINT (60 50)', { 'label': 'buzz-quux'} ), ) ) @@ -74,7 +76,9 @@ class CirclesDatasource(mapnik.PythonDatasource): def __init__(self, centre_x=-20, centre_y=0, step=10): super(CirclesDatasource, self).__init__( - geometry_type=mapnik.DataGeometryType.Polygon + geometry_type = mapnik.DataGeometryType.Polygon, + envelope = mapnik.Box2d(-180, -90, 180, 90), + data_type = mapnik.DataType.Vector ) # note that the plugin loader will set all arguments to strings and will not try to parse them @@ -94,7 +98,7 @@ features = ConcentricCircles(centre, query.bbox, self.step) ) -if 'python' in mapnik.DatasourceCache.instance().plugin_names(): +if 'python' in mapnik.DatasourceCache.plugin_names(): # make sure we can load from ourself as a module sys.path.append(execution_path('.')) @@ -153,4 +157,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/query_test.py mapnik-2.2.0/tests/python_tests/query_test.py --- mapnik-2.1.0/tests/python_tests/query_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/query_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -4,7 +4,7 @@ import os, mapnik from nose.tools import * -from utilities import execution_path +from utilities import execution_path, run_all def setup(): # All of the paths used are relative, if we run the tests @@ -17,6 +17,10 @@ r = query.resolution assert_almost_equal(r[0], 1.0, places=7) assert_almost_equal(r[1], 1.0, places=7) + # https://github.com/mapnik/mapnik/issues/1762 + eq_(query.property_names,[]) + query.add_property_name('migurski') + eq_(query.property_names,['migurski']) # Converting *from* tuples *to* resolutions is not yet supported @raises(TypeError) @@ -30,4 +34,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/query_tolerance_test.py mapnik-2.2.0/tests/python_tests/query_tolerance_test.py --- mapnik-2.1.0/tests/python_tests/query_tolerance_test.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/query_tolerance_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +from nose.tools import * +from utilities import execution_path, run_all +import os, mapnik + +def setup(): + # All of the paths used are relative, if we run the tests + # from another directory we need to chdir() + os.chdir(execution_path('.')) + +if 'shape' in mapnik.DatasourceCache.plugin_names(): + def test_query_tolerance(): + srs = '+init=epsg:4326' + lyr = mapnik.Layer('test') + ds = mapnik.Shapefile(file='../data/shp/arrows.shp') + lyr.datasource = ds + lyr.srs = srs + _width = 256 + _map = mapnik.Map(_width,_width, srs) + _map.layers.append(lyr) + # zoom determines tolerance + _map.zoom_all() + _map_env = _map.envelope() + tol = (_map_env.maxx - _map_env.minx) / _width * 3 + # 0.046875 for arrows.shp and zoom_all + eq_(tol,0.046875) + # check point really exists + x, y = 2.0, 4.0 + features = _map.query_point(0,x,y).features + eq_(len(features),1) + # check inside tolerance limit + x = 2.0 + tol * 0.9 + features = _map.query_point(0,x,y).features + eq_(len(features),1) + # check outside tolerance limit + x = 2.0 + tol * 1.1 + features = _map.query_point(0,x,y).features + eq_(len(features),0) + +if __name__ == "__main__": + setup() + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/raster_alpha_test.py mapnik-2.2.0/tests/python_tests/raster_alpha_test.py --- mapnik-2.1.0/tests/python_tests/raster_alpha_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/raster_alpha_test.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -#!/usr/bin/env python - -from nose.tools import * -from utilities import execution_path - -import os, mapnik - -def setup(): - # All of the paths used are relative, if we run the tests - # from another directory we need to chdir() - os.chdir(execution_path('.')) - -if 'gdal' in mapnik.DatasourceCache.instance().plugin_names(): - - def test_map_alpha_compare(): - m = mapnik.Map(600,400) - mapnik.load_map(m,'../data/good_maps/raster-alpha.xml') - m.zoom_all() - actual = '/tmp/mapnik-raster-alpha.png' - expected = 'images/support/raster-alpha.png' - im = mapnik.Image(m.width,m.height) - mapnik.render(m,im) - im.save(actual) - expected_im = mapnik.Image.open(expected) - eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected)) - - def test_map_alpha_gradient_compare(): - m = mapnik.Map(600,400) - mapnik.load_map(m,'../data/good_maps/raster-alpha-gradient.xml') - m.zoom_all() - actual = '/tmp/mapnik-raster-alpha-gradient.png' - expected = 'images/support/raster-alpha-gradient.png' - im = mapnik.Image(m.width,m.height) - mapnik.render(m,im) - im.save(actual) - expected_im = mapnik.Image.open(expected) - eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected)) - - -if __name__ == "__main__": - setup() - [eval(run)() for run in dir() if 'test_' in run] diff -Nru mapnik-2.1.0/tests/python_tests/raster_colorizer_test.py mapnik-2.2.0/tests/python_tests/raster_colorizer_test.py --- mapnik-2.1.0/tests/python_tests/raster_colorizer_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/raster_colorizer_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -1,7 +1,7 @@ #coding=utf8 import os import mapnik -from utilities import execution_path +from utilities import execution_path, run_all from nose.tools import * def setup(): @@ -103,4 +103,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/raster_colormapped_test.py mapnik-2.2.0/tests/python_tests/raster_colormapped_test.py --- mapnik-2.1.0/tests/python_tests/raster_colormapped_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/raster_colormapped_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -1,7 +1,7 @@ #coding=utf8 import os import mapnik -from utilities import execution_path +from utilities import execution_path, run_all from nose.tools import * def setup(): @@ -9,7 +9,7 @@ # from another directory we need to chdir() os.chdir(execution_path('.')) -if 'gdal' in mapnik.DatasourceCache.instance().plugin_names(): +if 'gdal' in mapnik.DatasourceCache.plugin_names(): def test_vrt_rendering(): m = mapnik.Map(512,512) @@ -22,7 +22,7 @@ im.save(actual) expected_im = mapnik.Image.open(expected) eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected)) - + def test_tif_rendering_nodata(): m = mapnik.Map(512,512) mapnik.load_map(m,'../data/good_maps/tiff_colortable.xml') @@ -37,4 +37,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/raster_symbolizer_test.py mapnik-2.2.0/tests/python_tests/raster_symbolizer_test.py --- mapnik-2.1.0/tests/python_tests/raster_symbolizer_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/raster_symbolizer_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -1,7 +1,7 @@ #!/usr/bin/env python from nose.tools import * -from utilities import execution_path, save_data, contains_word +from utilities import execution_path, run_all, contains_word, get_unique_colors import os, mapnik @@ -14,7 +14,7 @@ def test_dataraster_coloring(): srs = '+init=epsg:32630' lyr = mapnik.Layer('dataraster') - if 'gdal' in mapnik.DatasourceCache.instance().plugin_names(): + if 'gdal' in mapnik.DatasourceCache.plugin_names(): lyr.datasource = mapnik.Gdal( file = '../data/raster/dataraster.tif', band = 1, @@ -51,8 +51,6 @@ im = mapnik.Image(_map.width,_map.height) mapnik.render(_map, im) - # save a png somewhere so we can see it - save_data('test_dataraster_coloring.png', im.tostring('png')) imdata = im.tostring() # we have some values in the [20,30) interval so check that they're colored assert contains_word('\xff\xff\x00\xff', imdata) @@ -60,7 +58,7 @@ def test_dataraster_query_point(): srs = '+init=epsg:32630' lyr = mapnik.Layer('dataraster') - if 'gdal' in mapnik.DatasourceCache.instance().plugin_names(): + if 'gdal' in mapnik.DatasourceCache.plugin_names(): lyr.datasource = mapnik.Gdal( file = '../data/raster/dataraster.tif', band = 1, @@ -125,7 +123,7 @@ map_layer = mapnik.Layer('test_layer') filepath = '../data/raster/white-alpha.png' - if 'gdal' in mapnik.DatasourceCache.instance().plugin_names(): + if 'gdal' in mapnik.DatasourceCache.plugin_names(): map_layer.datasource = mapnik.Gdal(file=filepath) map_layer.styles.append('raster_style') map.layers.append(map_layer) @@ -135,17 +133,15 @@ mim = mapnik.Image(WIDTH, HEIGHT) mapnik.render(map, mim) - save_data('test_raster_with_alpha_blends_correctly_with_background.png', - mim.tostring('png')) imdata = mim.tostring() # All white is expected - assert contains_word('\xff\xff\xff\xff', imdata) + eq_(get_unique_colors(mim),['rgba(254,254,254,255)']) def test_raster_warping(): lyrSrs = "+init=epsg:32630" mapSrs = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' lyr = mapnik.Layer('dataraster', lyrSrs) - if 'gdal' in mapnik.DatasourceCache.instance().plugin_names(): + if 'gdal' in mapnik.DatasourceCache.plugin_names(): lyr.datasource = mapnik.Gdal( file = '../data/raster/dataraster.tif', band = 1, @@ -160,14 +156,14 @@ _map.append_style('foo', style) lyr.styles.append('foo') _map.layers.append(lyr) - prj_trans = mapnik.ProjTransform(mapnik.Projection(mapSrs), - mapnik.Projection(lyrSrs)) + map_proj = mapnik.Projection(mapSrs) + layer_proj = mapnik.Projection(lyrSrs) + prj_trans = mapnik.ProjTransform(map_proj, + layer_proj) _map.zoom_to_box(prj_trans.backward(lyr.envelope())) im = mapnik.Image(_map.width,_map.height) mapnik.render(_map, im) - # save a png somewhere so we can see it - save_data('test_raster_warping.png', im.tostring('png')) imdata = im.tostring() assert contains_word('\xff\xff\x00\xff', imdata) @@ -175,7 +171,7 @@ lyrSrs = "+init=epsg:32630" mapSrs = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' lyr = mapnik.Layer('dataraster', lyrSrs) - if 'gdal' in mapnik.DatasourceCache.instance().plugin_names(): + if 'gdal' in mapnik.DatasourceCache.plugin_names(): lyr.datasource = mapnik.Gdal( file = '../data/raster/dataraster.tif', band = 1, @@ -195,11 +191,8 @@ im = mapnik.Image(_map.width,_map.height) mapnik.render(_map, im) - # save a png somewhere so we can see it - save_data('test_raster_warping_does_not_overclip_source.png', - im.tostring('png')) assert im.view(0,200,1,1).tostring()=='\xff\xff\x00\xff' if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/render_grid_test.py mapnik-2.2.0/tests/python_tests/render_grid_test.py --- mapnik-2.1.0/tests/python_tests/render_grid_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/render_grid_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- from nose.tools import * -from utilities import execution_path +from utilities import execution_path, run_all import os, mapnik try: @@ -268,16 +268,24 @@ eq_(grid.get_pixel(128,128),int32) utf1 = grid.encode('utf',resolution=4) eq_(utf1['keys'],[str(int32)]) - - # this will fail because it is used internally to mark alpha - #max_neg = -(int32+1) - # so we use max neg-1 max_neg = -(int32) grid = gen_grid_for_id(max_neg) eq_(grid.get_pixel(128,128),max_neg) utf1 = grid.encode('utf',resolution=4) eq_(utf1['keys'],[str(max_neg)]) +def test_64bit_int_id(): + int64 = 0x7FFFFFFFFFFFFFFF + grid = gen_grid_for_id(int64) + eq_(grid.get_pixel(128,128),int64) + utf1 = grid.encode('utf',resolution=4) + eq_(utf1['keys'],[str(int64)]) + max_neg = -(int64) + grid = gen_grid_for_id(max_neg) + eq_(grid.get_pixel(128,128),max_neg) + utf1 = grid.encode('utf',resolution=4) + eq_(utf1['keys'],[str(max_neg)]) + def test_id_zero(): grid = gen_grid_for_id(0) eq_(grid.get_pixel(128,128),0) @@ -374,4 +382,4 @@ if __name__ == "__main__": setup() - [eval(run)() for run in dir() if 'test_' in run] + run_all(eval(x) for x in dir() if x.startswith("test_")) diff -Nru mapnik-2.1.0/tests/python_tests/render_test.py mapnik-2.2.0/tests/python_tests/render_test.py --- mapnik-2.1.0/tests/python_tests/render_test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/python_tests/render_test.py 2013-06-04 01:35:28.000000000 +0000 @@ -5,63 +5,83 @@ import tempfile import os, mapnik from nose.tools import * -from utilities import execution_path +from utilities import execution_path, run_all def setup(): # All of the paths used are relative, if we run the tests # from another directory we need to chdir() os.chdir(execution_path('.')) - def test_simplest_render(): m = mapnik.Map(256, 256) - i = mapnik.Image(m.width, m.height) - - mapnik.render(m, i) - - s = i.tostring() - + im = mapnik.Image(m.width, m.height) + eq_(im.painted(),False) + eq_(im.is_solid(),True) + mapnik.render(m, im) + eq_(im.painted(),False) + eq_(im.is_solid(),True) + s = im.tostring() eq_(s, 256 * 256 * '\x00\x00\x00\x00') def test_render_image_to_string(): - i = mapnik.Image(256, 256) - - i.background = mapnik.Color('black') - - s = i.tostring() - + im = mapnik.Image(256, 256) + im.background = mapnik.Color('black') + eq_(im.painted(),False) + eq_(im.is_solid(),True) + s = im.tostring() eq_(s, 256 * 256 * '\x00\x00\x00\xff') + s = im.tostring('png') - s = i.tostring('png') +def test_non_solid_image(): + im = mapnik.Image(256, 256) + im.background = mapnik.Color('black') + eq_(im.painted(),False) + eq_(im.is_solid(),True) + # set one pixel to a different color + im.set_pixel(0,0,mapnik.Color('white')) + eq_(im.painted(),False) + eq_(im.is_solid(),False) + +def test_non_solid_image_view(): + im = mapnik.Image(256, 256) + im.background = mapnik.Color('black') + view = im.view(0,0,256,256) + eq_(view.is_solid(),True) + # set one pixel to a different color + im.set_pixel(0,0,mapnik.Color('white')) + eq_(im.is_solid(),False) + # view, since it is the exact dimensions of the image + # should also be non-solid + eq_(view.is_solid(),False) + # but not a view that excludes the single diff pixel + view2 = im.view(1,1,256,256) + eq_(view2.is_solid(),True) def test_setting_alpha(): w,h = 256,256 im1 = mapnik.Image(w,h) # white, half transparent im1.background = mapnik.Color('rgba(255,255,255,.5)') - + eq_(im1.painted(),False) + eq_(im1.is_solid(),True) # pure white im2 = mapnik.Image(w,h) im2.background = mapnik.Color('rgba(255,255,255,1)') im2.set_alpha(.5) - + eq_(im2.painted(),False) + eq_(im2.is_solid(),True) eq_(len(im1.tostring()), len(im2.tostring())) - def test_render_image_to_file(): - i = mapnik.Image(256, 256) - - i.background = mapnik.Color('black') - + im = mapnik.Image(256, 256) + im.background = mapnik.Color('black') if mapnik.has_jpeg(): - i.save('test.jpg') - i.save('test.png', 'png') - + im.save('test.jpg') + im.save('test.png', 'png') if os.path.exists('test.jpg'): os.remove('test.jpg') else: return False - if os.path.exists('test.png'): os.remove('test.png') else: @@ -71,34 +91,32 @@ tmp_map = 'tmp_map.xml' m = mapnik.Map(w,h) mapnik.load_map(m,mapfile) - i = mapnik.Image(w,h) + im = mapnik.Image(w,h) m.zoom_all() - mapnik.render(m,i) + mapnik.render(m,im) mapnik.save_map(m,tmp_map) m2 = mapnik.Map(w,h) mapnik.load_map(m2,tmp_map) - i2 = mapnik.Image(w,h) + im2 = mapnik.Image(w,h) m2.zoom_all() - mapnik.render(m2,i2) + mapnik.render(m2,im2) os.remove(tmp_map) - return i,i2 + return im,im2 def test_render_from_serialization(): try: - i,i2 = get_paired_images(100,100,'../data/good_maps/building_symbolizer.xml') - eq_(i.tostring(),i2.tostring()) + im,im2 = get_paired_images(100,100,'../data/good_maps/building_symbolizer.xml') + eq_(im.tostring(),im2.tostring()) - i,i2 = get_paired_images(100,100,'../data/good_maps/polygon_symbolizer.xml') - eq_(i.tostring(),i2.tostring()) + im,im2 = get_paired_images(100,100,'../data/good_maps/polygon_symbolizer.xml') + eq_(im.tostring(),im2.tostring()) except RuntimeError, e: # only test datasources that we have installed if not 'Could not create datasource' in str(e): raise RuntimeError(e) def test_render_points(): - if not mapnik.has_cairo(): return - # create and populate point datasource (WGS84 lat-lon coordinates) ds = mapnik.MemoryDatasource() context = mapnik.Context() @@ -120,7 +138,7 @@ symb.allow_overlap = True r.symbols.append(symb) s.rules.append(r) - lyr = mapnik.Layer('Places','+proj=latlon +datum=WGS84') + lyr = mapnik.Layer('Places','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs') lyr.datasource = ds lyr.styles.append('places_labels') # latlon bounding box corners @@ -128,25 +146,52 @@ lr_lonlat = mapnik.Coord(143.40,-38.80) # render for different projections projs = { - 'latlon': '+proj=latlon +datum=WGS84', + 'google': '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over', + 'latlon': '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', 'merc': '+proj=merc +datum=WGS84 +k=1.0 +units=m +over +no_defs', - 'google': '+proj=merc +ellps=sphere +R=6378137 +a=6378137 +units=m', 'utm': '+proj=utm +zone=54 +datum=WGS84' } for projdescr in projs.iterkeys(): m = mapnik.Map(1000, 500, projs[projdescr]) m.append_style('places_labels',s) m.layers.append(lyr) - p = mapnik.Projection(projs[projdescr]) - m.zoom_to_box(p.forward(mapnik.Box2d(ul_lonlat,lr_lonlat))) + dest_proj = mapnik.Projection(projs[projdescr]) + src_proj = mapnik.Projection('+init=epsg:4326') + tr = mapnik.ProjTransform(src_proj,dest_proj) + m.zoom_to_box(tr.forward(mapnik.Box2d(ul_lonlat,lr_lonlat))) # Render to SVG so that it can be checked how many points are there with string comparison - svg_file = os.path.join(tempfile.gettempdir(),'%s.svg') + svg_file = os.path.join(tempfile.gettempdir(), 'mapnik-render-points-%s.svg' % projdescr) mapnik.render_to_file(m, svg_file) num_points_present = len(ds.all_features()) svg = open(svg_file,'r').read() num_points_rendered = svg.count('> 24) & 0xff + red = pixel & 0xff + green = (pixel >> 8) & 0xff + blue = (pixel >> 16) & 0xff + return red,green,blue,alpha + +def pixel2rgba(pixel): + return 'rgba(%s,%s,%s,%s)' % pixel2channels(pixel) + +def get_unique_colors(im): + pixels = [] + for x in range(im.width()): + for y in range(im.height()): + pixel = im.get_pixel(x,y) + if pixel not in pixels: + pixels.append(pixel) + pixels = sorted(pixels) + return map(pixel2rgba,pixels) + +def run_all(iterable): + failed = 0 + for test in iterable: + try: + test() + sys.stderr.write("\x1b[32m✓ \x1b[m" + test.__name__ + "\x1b[m\n") + except: + exc_type, exc_value, exc_tb = sys.exc_info() + failed += 1 + sys.stderr.write("\x1b[31m✘ \x1b[m" + test.__name__ + "\x1b[m\n") + for mline in traceback.format_exception_only(exc_type, exc_value): + for line in mline.rstrip().split("\n"): + sys.stderr.write(" \x1b[31m" + line + "\x1b[m\n") + sys.stderr.write(" Traceback:\n") + for mline in traceback.format_tb(exc_tb): + for line in mline.rstrip().split("\n"): + if not 'utilities.py' in line and not 'trivial.py' in line and not line.strip() == 'test()': + sys.stderr.write(" " + line + "\n") + sys.stderr.flush() + return failed + +def side_by_side_image(left_im, right_im): + width = left_im.width() + 1 + right_im.width() + height = max(left_im.height(), right_im.height()) + im = mapnik.Image(width, height) + im.blend(0, 0, left_im, 1.0) + im.blend(left_im.width() + 1, 0, right_im, 1.0) + return im diff -Nru mapnik-2.1.0/tests/run_tests.py mapnik-2.2.0/tests/run_tests.py --- mapnik-2.1.0/tests/run_tests.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/run_tests.py 2013-06-04 01:35:28.000000000 +0000 @@ -4,8 +4,8 @@ try: import nose -except ImportError: - sys.stderr.write("Unable to run python tests: the third party 'nose' module is required\nTo install 'nose' do:\n\tsudo pip install nose (or on debian systems: apt-get install python-nose\n") +except ImportError, e: + sys.stderr.write("Unable to run python tests: the third party 'nose' module is required\nTo install 'nose' do:\n\tsudo pip install nose (or on debian systems: apt-get install python-nose): %s\n" % e) sys.exit(1) from python_tests.utilities import TodoPlugin @@ -72,8 +72,8 @@ argv.append('-v') argv.append('-v') - dirname = os.path.dirname(sys.argv[0]) - argv.extend(['-w', dirname+'/python_tests']) + dirname = os.path.dirname(sys.argv[0]) + argv.extend(['-w', os.path.join(dirname,'python_tests')]) if not nose.run(argv=argv, plugins=[TodoPlugin(), Doctest()]): sys.exit(1) diff -Nru mapnik-2.1.0/tests/visual_tests/.gitignore mapnik-2.2.0/tests/visual_tests/.gitignore --- mapnik-2.1.0/tests/visual_tests/.gitignore 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/.gitignore 2013-06-04 01:35:28.000000000 +0000 @@ -1,2 +1 @@ -*-agg.png *-out.xml diff -Nru mapnik-2.1.0/tests/visual_tests/clean.sh mapnik-2.2.0/tests/visual_tests/clean.sh --- mapnik-2.1.0/tests/visual_tests/clean.sh 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/clean.sh 2013-06-04 01:35:28.000000000 +0000 @@ -1,3 +1,2 @@ -rm -f images/*-agg.png rm -f xml_output/*-out.xml diff -Nru mapnik-2.1.0/tests/visual_tests/compare.py mapnik-2.2.0/tests/visual_tests/compare.py --- mapnik-2.1.0/tests/visual_tests/compare.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/compare.py 2013-06-04 01:35:28.000000000 +0000 @@ -3,64 +3,62 @@ import sys import mapnik -COMPUTE_THRESHOLD = 16 +try: + import json +except ImportError: + import simplejson as json -errors = [] -passed = 0 +COMPUTE_THRESHOLD = 16 # returns true if pixels are not identical -def compare_pixels(pixel1, pixel2): +def compare_pixels(pixel1, pixel2, alpha=True): if pixel1 == pixel2: return False r_diff = abs((pixel1 & 0xff) - (pixel2 & 0xff)) g_diff = abs(((pixel1 >> 8) & 0xff) - ((pixel2 >> 8) & 0xff)) b_diff = abs(((pixel1 >> 16) & 0xff)- ((pixel2 >> 16) & 0xff)) - a_diff = abs(((pixel1 >> 24) & 0xff) - ((pixel2 >> 24) & 0xff)) - if(r_diff > COMPUTE_THRESHOLD or - g_diff > COMPUTE_THRESHOLD or - b_diff > COMPUTE_THRESHOLD or - a_diff > COMPUTE_THRESHOLD): - return True + if alpha: + a_diff = abs(((pixel1 >> 24) & 0xff) - ((pixel2 >> 24) & 0xff)) + if(r_diff > COMPUTE_THRESHOLD or + g_diff > COMPUTE_THRESHOLD or + b_diff > COMPUTE_THRESHOLD or + a_diff > COMPUTE_THRESHOLD): + return True else: - return False + if(r_diff > COMPUTE_THRESHOLD or + g_diff > COMPUTE_THRESHOLD or + b_diff > COMPUTE_THRESHOLD): + return True + return False # compare two images and return number of different pixels -def compare(actual, expected): - global errors - global passed +def compare(actual, expected, alpha=True): im1 = mapnik.Image.open(actual) try: im2 = mapnik.Image.open(expected) except RuntimeError: - errors.append((None, actual, expected)) - return -1 + return 99999990 diff = 0 pixels = im1.width() * im1.height() delta_pixels = (im2.width() * im2.height()) - pixels if delta_pixels != 0: - errors.append((delta_pixels, actual, expected)) return delta_pixels for x in range(0,im1.width(),2): for y in range(0,im1.height(),2): - if compare_pixels(im1.get_pixel(x,y),im2.get_pixel(x,y)): + if compare_pixels(im1.get_pixel(x,y),im2.get_pixel(x,y),alpha=alpha): diff += 1 - if diff != 0: - errors.append((diff, actual, expected)) - passed += 1 return diff -def summary(): +def compare_grids(actual, expected, threshold=0, alpha=True): global errors global passed - print "-"*80 - print "Visual text rendering summary:", - if len(errors) != 0: - for error in errors: - if (error[0] is None): - print "Could not verify %s: No reference image found!" % error[1] - else: - print "Failed: %d different pixels:\n\t%s (actual)\n\t%s (expected)" % error - sys.exit(1) - else: - print 'All %s tests passed: \x1b[1;32m✓ \x1b[0m' % passed - sys.exit(0) + im1 = json.loads(open(actual).read()) + try: + im2 = json.loads(open(expected).read()) + except RuntimeError: + return 9999990 + equal = (im1 == im2) + # TODO - real diffing + if not equal: + return 99999999 + return 0 diff -Nru mapnik-2.1.0/tests/visual_tests/data/Yosemite_L9.tfw mapnik-2.2.0/tests/visual_tests/data/Yosemite_L9.tfw --- mapnik-2.1.0/tests/visual_tests/data/Yosemite_L9.tfw 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/data/Yosemite_L9.tfw 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,6 @@ +191.092170573681 +0.000000000000 +0.000000000000 +-191.092170573681 +-13383825.126807762310 +4651869.862067188136 Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/data/Yosemite_L9.tif and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/data/Yosemite_L9.tif differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/data/hex.dbf and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/data/hex.dbf differ diff -Nru mapnik-2.1.0/tests/visual_tests/data/hex.prj mapnik-2.2.0/tests/visual_tests/data/hex.prj --- mapnik-2.1.0/tests/visual_tests/data/hex.prj 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/data/hex.prj 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1 @@ +PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"],AUTHORITY["EPSG","3857"],AXIS["X",EAST],AXIS["Y",NORTH]] \ No newline at end of file Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/data/hex.shp and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/data/hex.shp differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/data/hex.shx and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/data/hex.shx differ diff -Nru mapnik-2.1.0/tests/visual_tests/data/line-offset.csv mapnik-2.2.0/tests/visual_tests/data/line-offset.csv --- mapnik-2.1.0/tests/visual_tests/data/line-offset.csv 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/data/line-offset.csv 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,9 @@ +wkt,name,nr,ref +"LineString(-5.177724 50.191914,-5.177742 50.191769,-5.17773 50.191624,-5.177689 50.191481,-5.177619 50.191343,-5.177522 50.191212,-5.177398 50.19109,-5.177251 50.190979,-5.177082 50.190882,-5.176895 50.190799,-5.176693 50.190733,-5.176479 50.190685,-5.176257 50.190654,-5.176031 50.190643,-5.175804 50.19065,-5.175581 50.190677,-5.175365 50.190722,-5.17516 50.190784,-5.17497 50.190863,-5.174797 50.190957,-5.174645 50.191065,-5.174516 50.191185,-5.174413 50.191314,-5.174337 50.191451,-5.17429 50.191594,-5.174272 50.191738,-5.174283 50.191884,-5.174324 50.192026,-5.174394 50.192165,-5.174492 50.192296,-5.174615 50.192418,-5.174763 50.192529,-5.174931 50.192626,-5.175118 50.192708,-5.17532 50.192774,-5.175534 50.192823,-5.175756 50.192853,-5.175983 50.192865,-5.176209 50.192857,-5.176433 50.192831,-5.176649 50.192786,-5.176854 50.192724,-5.177044 50.192645,-5.177217 50.19255,-5.177369 50.192442,-5.177498 50.192323,-5.177601 50.192193,-5.177677 50.192056,-5.177724 50.191914)","",,4 +"LineString(-5.182328 50.19193,-5.182346 50.191785,-5.182334 50.19164,-5.182293 50.191497,-5.182223 50.191358,-5.182125 50.191227,-5.182002 50.191105,-5.181854 50.190995,-5.181686 50.190897,-5.181499 50.190815,-5.181297 50.190749,-5.181083 50.1907,-5.180861 50.19067,-5.180634 50.190658,-5.180408 50.190666,-5.180184 50.190692,-5.179968 50.190737,-5.179763 50.190799,-5.179573 50.190878,-5.1794 50.190973,-5.179248 50.191081,-5.179119 50.1912,-5.179016 50.19133,-5.17894 50.191467,-5.178893 50.191609,-5.178875 50.191754,-5.178887 50.191899,-5.178928 50.192042,-5.178998 50.19218,-5.179095 50.192311,-5.179219 50.192433,-5.179366 50.192544,-5.179535 50.192641,-5.179722 50.192724,-5.179924 50.19279,-5.180138 50.192838,-5.18036 50.192869,-5.180586 50.19288,-5.180813 50.192873,-5.181036 50.192846,-5.181252 50.192802,-5.181457 50.192739,-5.181648 50.19266,-5.18182 50.192566,-5.181972 50.192458,-5.182101 50.192338,-5.182204 50.192209,-5.18228 50.192072,-5.182328 50.19193)","",,3 +"LineString(-5.187052 50.191945,-5.187004 50.192087,-5.186928 50.192224,-5.186825 50.192354,-5.186696 50.192473,-5.186544 50.192581,-5.186371 50.192675,-5.186181 50.192755,-5.185976 50.192817,-5.18576 50.192862,-5.185537 50.192888,-5.18531 50.192896,-5.185084 50.192884,-5.184862 50.192854,-5.184648 50.192805,-5.184446 50.192739,-5.184259 50.192657,-5.18409 50.192559,-5.183943 50.192449,-5.183819 50.192327,-5.183722 50.192196,-5.183652 50.192057,-5.183611 50.191914,-5.183599 50.191769,-5.183617 50.191624,-5.183664 50.191482,-5.18374 50.191345,-5.183843 50.191216,-5.183972 50.191096,-5.184124 50.190988,-5.184297 50.190894,-5.184487 50.190815,-5.184692 50.190752,-5.184908 50.190708,-5.185132 50.190681,-5.185358 50.190674,-5.185585 50.190685,-5.185807 50.190716,-5.186021 50.190764,-5.186223 50.19083,-5.18641 50.190913,-5.186578 50.19101,-5.186726 50.191121,-5.186849 50.191243,-5.186947 50.191374,-5.187017 50.191512,-5.187058 50.191655,-5.18707 50.1918,-5.187052 50.191945)","",,2 +"LineString(-5.191775 50.191899,-5.191728 50.192041,-5.191652 50.192178,-5.191549 50.192307,-5.19142 50.192427,-5.191268 50.192535,-5.191095 50.192629,-5.190905 50.192708,-5.1907 50.192771,-5.190484 50.192816,-5.190261 50.192842,-5.190034 50.192849,-5.189808 50.192838,-5.189586 50.192808,-5.189372 50.192759,-5.18917 50.192693,-5.188983 50.19261,-5.188814 50.192513,-5.188667 50.192402,-5.188543 50.192281,-5.188446 50.192149,-5.188376 50.192011,-5.188334 50.191868,-5.188323 50.191723,-5.188341 50.191578,-5.188388 50.191436,-5.188464 50.191299,-5.188567 50.19117,-5.188696 50.19105,-5.188848 50.190942,-5.189021 50.190848,-5.189211 50.190769,-5.189416 50.190706,-5.189632 50.190661,-5.189856 50.190635,-5.190082 50.190627,-5.190309 50.190639,-5.190531 50.190669,-5.190744 50.190718,-5.190947 50.190784,-5.191134 50.190866,-5.191302 50.190964,-5.19145 50.191074,-5.191573 50.191196,-5.191671 50.191328,-5.191741 50.191466,-5.191782 50.191609,-5.191793 50.191754,-5.191775 50.191899)","",,1 +"LineString(-5.177742 50.191769,-5.174272 50.191738)","CCW, dy > 0",, +"LineString(-5.182346 50.191785,-5.178875 50.191754)","CCW, dy < 0",, +"LineString(-5.18707 50.1918,-5.183599 50.191769)","CW, dy > 0",, +"LineString(-5.191793 50.191754,-5.188323 50.191723)","CW, dy < 0",, \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/data/line-offset.osm mapnik-2.2.0/tests/visual_tests/data/line-offset.osm --- mapnik-2.1.0/tests/visual_tests/data/line-offset.osm 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/data/line-offset.osm 1970-01-01 00:00:00.000000000 +0000 @@ -1,435 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/data/lines.csv mapnik-2.2.0/tests/visual_tests/data/lines.csv --- mapnik-2.1.0/tests/visual_tests/data/lines.csv 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/data/lines.csv 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,10 @@ +wkt,name,nr +"LineString(0.194483 -0.117354,0.23691 -0.137246,0.252846 -0.181313,0.232953 -0.223741,0.188886 -0.239676,0.146458 -0.219784,0.130523 -0.175717,0.150415 -0.133289,0.194483 -0.117354)","Circle",6 +"LineString(0.747335 -0.107159,0.789763 -0.127051,0.805698 -0.171118,0.785806 -0.213546,0.741739 -0.229481,0.699311 -0.209589,0.683376 -0.165522,0.703268 -0.123094,0.747335 -0.107159)","Circle with long name",7 +"LineString(0.346487 -0.240215,0.535306 -0.240215)","Short line with long name",5 +"LineString(0.347059 -0.122112,0.535878 -0.122112)","Short line",4 +"LineString(0 0,0.9 0)","Rendered @ integer pos. ABCDEFGHIJKLMNOPQRSTUVWXYZ",3 +"LineString(0.002268 0.073178,0.902268 0.073178)","Long line with long name",2 +"LineString(0.003411 0.172529,0.103411 0.172529,0.203411 0.172529,0.303411 0.172529,0.403411 0.172529,0.503411 0.172529,0.603411 0.172529,0.703411 0.172529,0.803411 0.172529,0.903411 0.172529)","Long line with long name and many points",1 +"LineString(0.002841 0.250458,0.902841 0.250458)","Short name",8 +"LineString(0 -0.051,0.9 -0.051)","Rendered @ non-integer p. ABCDEFGHIJKLMNOPQRSTUVWXYZ",9 diff -Nru mapnik-2.1.0/tests/visual_tests/data/lines.osm mapnik-2.2.0/tests/visual_tests/data/lines.osm --- mapnik-2.1.0/tests/visual_tests/data/lines.osm 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/data/lines.osm 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru mapnik-2.1.0/tests/visual_tests/data/marker-multi-policy.csv mapnik-2.2.0/tests/visual_tests/data/marker-multi-policy.csv --- mapnik-2.1.0/tests/visual_tests/data/marker-multi-policy.csv 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/data/marker-multi-policy.csv 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,3 @@ +i|wkt +1|MULTIPOLYGON(((90 40,50 0,10 40,50 80,90 40)),((190 40,150 0,110 40,150 80,190 40)),((190 140,150 100,110 140,150 180,190 140))) +2|MULTIPOLYGON(((48 130,40 122,32 130,40 138,48 130)),((40 140,20 120,0 140,20 160,40 140)),((48 150,40 142,32 150,40 158,48 150))) diff -Nru mapnik-2.1.0/tests/visual_tests/data/marker-on-line.csv mapnik-2.2.0/tests/visual_tests/data/marker-on-line.csv --- mapnik-2.1.0/tests/visual_tests/data/marker-on-line.csv 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/data/marker-on-line.csv 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,2 @@ +i|wkt +1|LINESTRING(-10 0, 0 20, 10 0, 15 5) diff -Nru mapnik-2.1.0/tests/visual_tests/data/points.csv mapnik-2.2.0/tests/visual_tests/data/points.csv --- mapnik-2.1.0/tests/visual_tests/data/points.csv 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/data/points.csv 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,11 @@ +lat,long,name,nr +0,0,Test one,1 +0,0.1,Test two,2 +0,0.2,Test three,3 +0,0.3,Test four,4 +0,0.4,Test five,5 +0,0.5,Test six,6 +0,0.6,Test seven,7 +0,0.7,Test eight,8 +0,0.8,Test nine,9 +0,0.9,Test ten,10 \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/data/points.osm mapnik-2.2.0/tests/visual_tests/data/points.osm --- mapnik-2.1.0/tests/visual_tests/data/points.osm 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/data/points.osm 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/data/snow-cover.tif and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/data/snow-cover.tif differ diff -Nru mapnik-2.1.0/tests/visual_tests/data/whole-centroid.csv mapnik-2.2.0/tests/visual_tests/data/whole-centroid.csv --- mapnik-2.1.0/tests/visual_tests/data/whole-centroid.csv 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/data/whole-centroid.csv 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,2 @@ +i|wkt +1|MULTIPOLYGON(((1350057.96009438 5942345.52058283,1384876.13646624 5891754.2133652,1527153.68896859 5865144.36766544,1489794.86785838 5828107.21457916,1521644.71000822 5808839.16705438,1500586.73589334 5782129.46376012,1549474.58270654 5722446.94649062,1526963.22131985 5715859.64352432,1468675.11142609 5744853.11521536,1367157.74707515 5695509.5055605,1353768.57268098 5663160.88833932,1395853.46277285 5615400.34143299,1363168.83576153 5576894.81504537,1376836.42020216 5503694.0028362,1516356.92287605 5396662.575031,1560328.12173938 5261876.31080913,1640818.23615492 5173802.74601002,1796912.65253506 5148129.98779792,1773597.67574436 5083111.70893878,2005049.37613903 4960037.26198969,2060770.68121407 4885821.98463312,2042650.53978071 4835753.32622244,1988073.15379307 4907241.27057499,1882814.34135654 4930901.063827,1835287.04135981 4832212.44229475,1909252.60910046 4777690.54700568,1911262.92778469 4716420.6995481,1847346.61575592 4693181.77244718,1788068.875589 4568718.26175616,1740109.09937055 4581073.81722757,1805880.43939388 4708906.48580766,1744005.2815483 4870423.42300908,1235522.56053157 5220039.63151647,1125161.53055404 5466602.89896275,973921.757167397 5532097.82173426,838019.24926376 5432786.3871293,852954.651385017 5491916.6901273,776607.959736312 5509523.04321204,782761.478548388 5595015.13624148,736908.312373676 5638877.1573602,793460.506128018 5662194.42680345,756857.878318762 5745270.82868898,783472.587455564 5769448.93739922,874497.199243332 5767386.72200479,939134.416294499 5854912.10535634,1005956.9462694 5754390.71173147,1033261.27965169 5860165.00562569,1127666.33041638 5816836.29071798,1118791.82929085 5867309.80784728,1164989.30665057 5868344.65660203,1165652.54817671 5921100.82966656,1350057.96009438 5942345.52058283),(1386948.01482887 5449379.17151171,1392606.60718488 5463421.03119553,1382120.31115215 5458937.77184712,1386948.01482887 5449379.17151171),(1385381.11851082 5146477.94829492,1386669.06721543 5146224.9584086,1386111.70929647 5147206.59661607,1385381.11851082 5146477.94829492)),((1382897.20987839 5687974.04417046,1371857.98993491 5675822.90372079,1377393.1289756 5689163.60754804,1382897.20987839 5687974.04417046)),((1095847.54640445 5317215.2838641,1091704.01231816 5313451.44710224,1091394.65545324 5321701.46563701,1094455.94145006 5323479.01597989,1095847.54640445 5317215.2838641)),((1162299.15983606 5288324.53042776,1160289.06379081 5267765.62824438,1124543.26210218 5277407.73480368,1162299.15983606 5288324.53042776)),((1123028.09251298 5247084.38946664,1122316.87228631 5254141.60947014,1124512.20396424 5250317.54284925,1123028.09251298 5247084.38946664)),((1215144.97114443 5209828.83212963,1209640.77892215 5214848.8689761,1210908.5966028 5219286.46510058,1215144.97114443 5209828.83212963)),((1148446.00580429 5208658.24432317,1145817.64130717 5213552.48912728,1149497.41839483 5212548.16532901,1148446.00580429 5208658.24432317)),((1059019.27398736 5033998.10699295,1093806.61486026 4942691.99568292,1065234.68643633 4743259.71214946,1003916.12604469 4759901.51823648,986197.736653606 4704377.88889769,935856.725207561 4715744.68629496,952523.590688621 4846503.91226084,911984.817004403 4999606.76073705,1059019.27398736 5033998.10699295)),((928311.824080081 5021563.59386512,914520.452365687 5011234.44611049,926301.728034833 5030262.29618597,928311.824080081 5021563.59386512)),((1443164.46899898 4995230.22633471,1441618.24127186 5000220.31310592,1445823.55767554 5002226.81825718,1443164.46899898 4995230.22633471)),((1553061.29669992 4968395.29665014,1542207.75766705 4973291.02362767,1552690.38015659 4974433.31609162,1553061.29669992 4968395.29665014)),((1581911.63517033 4947738.11891254, 1587632.34380218 4947004.77788114,1580427.52371907 4944237.33055168,1581911.63517033 4947738.11891254)),((923085.819265294 4735088.56864719,915479.024500905 4745293.69583645,924260.796490606 4748923.38178062,923085.819265294 4735088.56864719)),((1693571.31832746 4688858.4894456,1690973.90064878 4691713.90965507,1696416.19923417 4693935.9965921,1693571.31832746 4688858.4894456)),((1466448.61029075 4677403.01590106,1465211.85074803 4680849.56314581,1469231.59756058 4680414.29421003,1466448.61029075 4677403.01590106)),((1655135.14718535 4654767.34922581,1646940.91946804 4659946.37928978,1655166.09400377 4661409.67928983,1655135.14718535 4654767.34922581)),((1664813.70899286 4642559.56041499,1660020.95963625 4652672.28390196,1665772.39244759 4652790.51476716,1664813.70899286 4642559.56041499)),((1668555.37971741 4630998.75869634,1663236.86840579 4636007.55629286,1665215.68367412 4640507.06235257,1668555.37971741 4630998.75869634)),((1728668.01606527 4598788.94471507,1679439.97688818 4506146.77040914,1705043.45977066 4440345.73224938,1678852.4326158 4390316.66779138,1382835.42756099 4550662.053593,1482404.47818411 4610314.59733156,1532745.60094962 4575266.49172867,1728668.01606527 4598788.94471507)),((1344059.17537453 4572873.96816367,1339173.36292359 4577580.75464391,1342420.21851156 4577895.44505675,1344059.17537453 4572873.96816367)),((1375259.46829558 4566170.07673534,1366044.55216722 4570443.18173048,1373589.78725316 4570168.66006012,1375259.46829558 4566170.07673534)),((1337596.41101701 4402695.43852239,1328134.14298011 4415398.45409661,1341214.18314831 4410841.06668909,1337596.41101701 4402695.43852239))) diff -Nru mapnik-2.1.0/tests/visual_tests/grids/collision-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/collision-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/collision-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/collision-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,109 @@ +{ + "keys": [ + "", + "1" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! ", + " !! ", + " !!!! ", + " !!!!! ", + " !!!!! ", + " !!!!! ", + " !!!! ", + " !!! ", + " !!! ", + " !!!! ", + " !!!!! ", + " !!!!!!! ", + " !!!!!! ", + " !!!! ", + " ! !!! ", + " !!!! ", + " !!!!! ", + " !!!!!! ", + " !!!! ", + " !! ", + " !! ", + " !!!! ", + " !!!!! ", + " !!!!! ", + " !!!!! ", + " !!!! ", + " !! ", + " ", + " !!!! ", + " !!!! ", + " !!!! ", + " !!!! ", + " !!! ", + " !!! ", + " !!!! ", + " ! ! ", + " ", + " ", + " !!!! ", + " !!!! ", + " !!!! ", + " !!! ", + " !!! ", + " !!!! ", + " !!!! ", + " ! ", + " !! ", + " !!!! ", + " !!!! ", + " !!!! ", + " !!!! ", + " !!!! ", + " !!!! ", + " !!! ", + " ! ", + " !!! ", + " !!!! ", + " !!!! ", + " !!! ", + " !!!! ", + " !!!! ", + " !!!! ", + " !!! ", + " ", + " !! ", + " !!! ", + " !!!! ", + " !!!! ", + " !!! ", + " !!!! ", + " !!! ", + " ! ! ! ", + " !! ", + " !!!! ", + " !!!!! ", + " !!!!!! ", + " !!!! ", + " !! ! !! ", + " !!!! ", + " !!!!! ", + " !!!!!!!! ", + " !!!!!! ", + " !! !!! ", + " !!!!!! ", + " !!!!!!!! ", + " !!!!!! !! ", + " !!! !!!! ", + " !!!!! !! ", + " !!!!!!!! ", + " !!!!!! ", + " !!! " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/expressionformat-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/expressionformat-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/expressionformat-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/expressionformat-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! # $ % & ' ( ) * + ", + " ", + " # $$$ %%% &&&& ''''' (( ( )) ) ))) ** *** ++ + ", + " ' ((((((( )) ))))) * * * + + ++++ ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/formatting-1-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/formatting-1-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/formatting-1-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/formatting-1-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! # $ % & ' ( ) * + ", + " ", + "! ! $$$ $ $ &&& & && ((( ( ** ", + " !!! ! !!! ! $$ $ $ $$$ $$$ &&& & &&& & ( ((( ( ((((( ( * * * *** ", + " ! !! !!! $$ $ $ $$$ $ $ & && && & ( ( (( (( ((( ( * * ** ", + " ", + " !!!! !!! $$$$$$$$$ $ &&&&&&&& (((((((((( ******** ", + " !!!!!!! $$$$$$$$$ &&&& & (((((( ( ( ***** **** ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/formatting-2-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/formatting-2-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/formatting-2-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/formatting-2-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! # $ % & ' ( ) * + ", + " ", + "! ! $$$ $ $ &&& & && ((( ( ** ", + " !!! ! !!! ! $$ $ $ $$$ $$$ &&& & &&& & ( ((( ( ((((( ( * * * *** ", + " ! !! !!! $$ $ $ $$$ $ $ & && && & ( ( (( (( ((( ( * * ** ", + " ", + " !!!! !!! $$$$$$$$$ $ &&&&&&&& (((((((((( ******** ", + " !!!!!!! $$$$$$$$$ &&&& & (((((( ( ( ***** **** ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/formatting-3-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/formatting-3-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/formatting-3-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/formatting-3-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! # $ % & ' ( ) * + ", + " ", + "! ! $$$ $ $ &&& & && ((( ( ** ", + " !!! ! !!! ! $$ $ $ $$$ $$$ &&& & &&& & ( ((( ( ((((( ( * * * *** ", + " ! !! !!! $$ $ $ $$$ $ $ & && && & ( ( (( (( ((( ( * * ** ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/formatting-4-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/formatting-4-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/formatting-4-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/formatting-4-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! # $ % & ' ( ) * + ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/jalign-auto-200-200-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/jalign-auto-200-200-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/jalign-auto-200-200-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/jalign-auto-200-200-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,59 @@ +{ + "keys": [ + "", + "5" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!! ! ! ! ! ! !!! !!!!!! ! ! ", + " ! ! !!! ! !! !! ! !! ! ! !!! ! ", + " ", + " !! ! !! ! ! !!!! ! ", + " !!! ! ! !! !!!! ! ", + " ", + " ", + " ", + " ", + " ", + " !!!!!! ! ! !!!!!! ! ! ", + " ! ! !!! ! ! ! !!! ! ", + " ! ", + " !! ! !!!! ! ", + " !!! ! !!!! ! ", + " ", + " ", + " ", + " ", + " ", + " !!!!!! ! ! ! ! ! !!! !!!!!! ! ! ", + " ! ! !!! ! !! !! ! !! ! ! !!! ! ", + " ", + " !! ! !! ! ! !!!! ! ", + " !!! ! ! !! !!!! ! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/line-offset-900-250-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/line-offset-900-250-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/line-offset-900-250-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/line-offset-900-250-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,79 @@ +{ + "keys": [ + "", + "3", + "2", + "1", + "4", + "8", + "7", + "6", + "5" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !! ", + " ! !!!!!!! # ####### ", + " !!!!!!! !!!!!!!!! !!! ####### ############# ", + " !!!!!!!! !!!!!!!!! !!!! ## ##### ########## ### ", + " !! !!!!! !!!!!!!!!!! !!!!! # ###### ######## # ##### $$$$$$ ", + " %% %%% !!!! ! !! ! !!!!! ### # ## ## ##### $$ $$$ ", + " %% %%%%%%% %% !!!!!!! !! !! ##### # ## ### $$ $ $$$$$$$ $ $ ", + " % %%%%%%%%%% %%%%%%%% %% !!!! ! !!! #### # ### $ $$$$$$$$$ $$$$$$$ $$ $ ", + " % %%%%%%%%%%%%%%%%%% %% % !!! ! ! #### # # $ $$$$$$$$$$ $ $$$$$$$$$ $ ", + " % %%% %%% %%% %%% % !!!!! ! ! ##### # # $$$$$ $$$$$$$ $ ", + " % %%%% %%%%% !!!!! !!!!! ### # ### $ $$$$ $ ", + " %%%%% %%%%% % !! !!!!! #### ##### $ $$$$ $ ", + " % %%%% %%% % ! ! !!! # ### $ $$$ $ ", + " %%%% % % % !!!! # ## $$$ $$$ $ ", + " %%%%% %%% ! !! # ## $$$ $ $$ ", + " %%%% &&&& & && %%% ''''' '''' '''''''' !!!!! # (((((( (((( ((( ### $$$$ )))))) )) ) )) $$$$$ ", + " % % &&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ! !! '''''''' '''' ! ! # (((((((((( (((( # $$ $ )))))))))) ))))))))))))))) ", + " % &&&&&&&& &&& %%%% !!!! ' ! !!! #### ( ( # ### $$$ ))))))))) ) $$ $ ", + " % %%%%% !!! !!! #### # ### $$$ $$$ $ ", + " %%% % !!! ! ! !!! ## # ### $$$$ $$$ ", + " % % % !!! !!!! ### # ### $$$$ $$$$$ ", + " % %% %% % !!! ! ! !!! ### # # ### $ $$$$$ $$ $$ ", + " % %%% %%%%%% !!! ! !!!!!! ### # ###### $$$ $$$ $$$$ $ ", + " %%%%%%%% % %%%%% % !!!! ! !!!!!! ### # ###### $ $$$$$ $ $$$$$$$$$ ", + " % %%%%%%%%%%%%% %%%%%%%%% % !!!!! ! ! !!! ### # # ## ### $ $$$$$$$$$$$$$$$$ $$$$$ $ ", + " % %%%%%% %%%%%%%%%%%% % ! !! ! ! ! ## ## # ## ## $$ $$$ $$$$$$$$$$ $ $ ", + " %% %% %%%%%%% %%%% !!!!! !!! !!! ! #### ## ## # $ $$$$$$$$$$$$ $$ ", + " %%% %%% !!!!!! !!!!!!! !! # ##### ######### ### $$$$$ $$$$$ ", + " !!!!! !!! !!!!!!!! ###### ### ######## ", + " !! !!!!!!!!!! !!!!!! ## ########## ###### ", + " !!!!!! !!! ! ! ##### #### # ## ", + " !!! !! ## #### ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/lines-1-200-200-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/lines-1-200-200-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/lines-1-200-200-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/lines-1-200-200-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,67 @@ +{ + "keys": [ + "", + "8", + "7", + "6", + "5", + "9", + "1", + "4", + "2", + "3" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ! ! ! ! ", + " ############################################# ", + " ############################################# ", + " ############################################# ", + " ", + " ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " '' '' (((((((((( ))))))) ", + " ''''''' (((((((((( )))))))) ", + " ''''''''' (((((((((( )))))))) ", + " '''' '''' )))) )))) ", + " ''' ''' ))) )))) ", + " '''' '''' )))))))) ", + " '''''''' ********** )))))))) ", + " ''''''' ********** )))))) ", + " ''' ********** ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/lines-1-400-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/lines-1-400-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/lines-1-400-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/lines-1-400-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,117 @@ +{ + "keys": [ + "", + "8", + "7", + "6", + "5", + "9", + "2", + "1", + "4", + "3" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ", + " ", + " ", + " ", + " ########################################################################################## ", + " ########################################################################################## ", + " ########################################################################################## ", + " ########################################################################################## ", + " # # # ", + " ", + " ", + " ", + " ", + " ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $ $ ", + " ", + " ", + " ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " ", + " ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " ", + " ", + " ", + " '''''' ", + " ((((( ))))))))))))))))))) ''''''''''' ", + " ((((((((((( ))))))))))))))))))) '''''''''''' ", + " (((((((((((( ))))))))))))))))))) ''''' ''''' ", + " ((((( ((((( '''' '''' ", + " ((( ((( ''' '''' ", + " (((( (((( '''' ''' ", + " ((( ((( '''' '''' ", + " ((( ((( ''' ''' ", + " (((( (((( ''' '''' ", + " ((( (((( '''' '''' ", + " (((( (((( '''''''''''' ", + " ((((((((((((( ''''''''''' ", + " ((((((((((( ******************* '''''''' ", + " (((((((( ******************* ''' ", + " ((( ******************* ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/lines-1-600-600-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/lines-1-600-600-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/lines-1-600-600-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/lines-1-600-600-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,167 @@ +{ + "keys": [ + "", + "8", + "7", + "6", + "5", + "9", + "2", + "1", + "4", + "3" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ######################################################################################################################################## ", + " ######################################################################################################################################## ", + " ######################################################################################################################################## ", + " ## ## # # ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $ $ ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %% %% % % ", + " ", + " ", + " ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " ", + " ", + " ", + " ", + " ", + " '''' ", + " ( ''''''''' ", + " ((((((( )))))))))))))))))))))))))))) '''''''''''''' ", + " ((((((((((( )))))))))))))))))))))))))))) ''''''' '''''''' ", + " ((((((((((((((( )))))))))))))))))))))))))))) ''''' ''''' ", + " (((((( (((((( ''' ''' ", + " (((( (((( '''' '''' ", + " ((( (((( ''' ''' ", + " (((( ((( '''' '''' ", + " ((( ((( '''' '''' ", + " (((( (((( ''' ''' ", + " ((( ((( '''' ''' ", + " ((( (((( '''' '''' ", + " (((( ((( ''' ''' ", + " ((( (((( '''' '''' ", + " (((( ((( ''' ''' ", + " (((( (((( ''''' ''''' ", + " (((( ((( ''''''' ''''''' ", + " (((((( (((((( ''''''''''''''' ", + " (((((((((((((((( '''''''''' ", + " (((((((((((( **************************** ''''' ", + " (((((((( **************************** ", + " ((( **************************** ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/lines-1-800-800-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/lines-1-800-800-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/lines-1-800-800-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/lines-1-800-800-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,217 @@ +{ + "keys": [ + "", + "8", + "7", + "6", + "5", + "9", + "2", + "1", + "4", + "3" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " #################################################################################################################################################################################### ", + " #################################################################################################################################################################################### ", + " #################################################################################################################################################################################### ", + " # # # # # # # # # ## # # ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $ $ ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %% %% % % ", + " ", + " ", + " ", + " ", + " ", + " ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&& && & & & ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " '' ", + " ''''''' ", + " ( '''''''''''' ", + " ((((((( )))))))))))))))))))))))))))))))))))))) ''''''''''''''''' ", + " (((((((((((( )))))))))))))))))))))))))))))))))))))) '''''''' '''''''' ", + " ((((((((((((((((( )))))))))))))))))))))))))))))))))))))) '''''' '''''' ", + " (((((((( (((((((( '''' '''' ", + " (((((( (((((( '''' '''' ", + " (((( ((((( ''' ''' ", + " (((( ((( '''' ''' ", + " (((( ((( ''' '''' ", + " ((( (((( '''' ''' ", + " (((( ((( ''' '''' ", + " ((( (((( '''' '''' ", + " (((( (((( ''' ''' ", + " ((( ((( '''' '''' ", + " (((( (((( '''' ''' ", + " (((( ((( ''' '''' ", + " ((( (((( '''' '''' ", + " (((( ((( '''' '''' ", + " ((( (((( ''' '''' ", + " ((( (((( '''' '''' ", + " (((( (((( '''''' '''''' ", + " (((( (((( '''''''' ''''''' ", + " (((((( ((((( ''''''''''''''''' ", + " (((((((( (((((((( ''''''''''''' ", + " (((((((((((((((((( '''''''' ", + " (((((((((((( ************************************** ''' ", + " (((((((( ************************************** ", + " ((( ************************************** ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/lines-2-200-200-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/lines-2-200-200-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/lines-2-200-200-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/lines-2-200-200-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,67 @@ +{ + "keys": [ + "", + "8", + "7", + "6", + "5", + "9", + "1", + "4", + "2", + "3" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ! ! ! ", + " ############################################# ", + " ############################################# ", + " ############################################# ", + " ", + " ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " '' '' (((((((((( ))))))) ", + " ''''''' (((((((((( )))))))) ", + " ''''''''' (((((((((( )))))))) ", + " '''' '''' )))) )))) ", + " ''' ''' ))) )))) ", + " '''' '''' )))))))) ", + " '''''''' ********** )))))))) ", + " ''''''' ********** )))))) ", + " ''' ********** ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/lines-2-400-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/lines-2-400-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/lines-2-400-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/lines-2-400-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,117 @@ +{ + "keys": [ + "", + "8", + "7", + "6", + "5", + "9", + "2", + "1", + "4", + "3" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ", + " ", + " ", + " ", + " ########################################################################################## ", + " ########################################################################################## ", + " ########################################################################################## ", + " ########################################################################################## ", + " ", + " ", + " ", + " ", + " ", + " ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " ", + " ", + " ", + " ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " ", + " ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " ", + " ", + " ", + " '''''' ", + " ((((( ))))))))))))))))))) ''''''''''' ", + " ((((((((((( ))))))))))))))))))) '''''''''''' ", + " (((((((((((( ))))))))))))))))))) ''''' ''''' ", + " ((((( ((((( '''' '''' ", + " ((( ((( ''' '''' ", + " (((( (((( '''' ''' ", + " ((( ((( '''' '''' ", + " ((( ((( ''' ''' ", + " (((( (((( ''' '''' ", + " ((( (((( '''' '''' ", + " (((( (((( '''''''''''' ", + " ((((((((((((( ''''''''''' ", + " ((((((((((( ******************* '''''''' ", + " (((((((( ******************* ''' ", + " ((( ******************* ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/lines-2-600-600-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/lines-2-600-600-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/lines-2-600-600-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/lines-2-600-600-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,167 @@ +{ + "keys": [ + "", + "8", + "7", + "6", + "5", + "9", + "2", + "1", + "4", + "3" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ######################################################################################################################################## ", + " ######################################################################################################################################## ", + " ######################################################################################################################################## ", + " ## ## ## # ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$ $$ ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " ", + " ", + " ", + " ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " ", + " ", + " ", + " ", + " ", + " '''' ", + " ( ''''''''' ", + " ((((((( )))))))))))))))))))))))))))) '''''''''''''' ", + " ((((((((((( )))))))))))))))))))))))))))) ''''''' '''''''' ", + " ((((((((((((((( )))))))))))))))))))))))))))) ''''' ''''' ", + " (((((( (((((( ''' ''' ", + " (((( (((( '''' '''' ", + " ((( (((( ''' ''' ", + " (((( ((( '''' '''' ", + " ((( ((( '''' '''' ", + " (((( (((( ''' ''' ", + " ((( ((( '''' ''' ", + " ((( (((( '''' '''' ", + " (((( ((( ''' ''' ", + " ((( (((( '''' '''' ", + " (((( ((( ''' ''' ", + " (((( (((( ''''' ''''' ", + " (((( ((( ''''''' ''''''' ", + " (((((( (((((( ''''''''''''''' ", + " (((((((((((((((( '''''''''' ", + " (((((((((((( **************************** ''''' ", + " (((((((( **************************** ", + " ((( **************************** ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/lines-2-800-800-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/lines-2-800-800-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/lines-2-800-800-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/lines-2-800-800-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,217 @@ +{ + "keys": [ + "", + "8", + "7", + "6", + "5", + "9", + "2", + "1", + "4", + "3" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " #################################################################################################################################################################################### ", + " #################################################################################################################################################################################### ", + " #################################################################################################################################################################################### ", + " # # # # # # # # # # # ## # # ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $ $ ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %% %% % % % ", + " ", + " ", + " ", + " ", + " ", + " ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " && && & & ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " '' ", + " ''''''' ", + " ( '''''''''''' ", + " ((((((( )))))))))))))))))))))))))))))))))))))) ''''''''''''''''' ", + " (((((((((((( )))))))))))))))))))))))))))))))))))))) '''''''' '''''''' ", + " ((((((((((((((((( )))))))))))))))))))))))))))))))))))))) '''''' '''''' ", + " (((((((( (((((((( '''' '''' ", + " (((((( (((((( '''' '''' ", + " (((( ((((( ''' ''' ", + " (((( ((( '''' ''' ", + " (((( ((( ''' '''' ", + " ((( (((( '''' ''' ", + " (((( ((( ''' '''' ", + " ((( (((( '''' '''' ", + " (((( (((( ''' ''' ", + " ((( ((( '''' '''' ", + " (((( (((( '''' ''' ", + " (((( ((( ''' '''' ", + " ((( (((( '''' '''' ", + " (((( ((( '''' '''' ", + " ((( (((( ''' '''' ", + " ((( (((( '''' '''' ", + " (((( (((( '''''' '''''' ", + " (((( (((( '''''''' ''''''' ", + " (((((( ((((( ''''''''''''''''' ", + " (((((((( (((((((( ''''''''''''' ", + " (((((((((((((((((( '''''''' ", + " (((((((((((( ************************************** ''' ", + " (((((((( ************************************** ", + " ((( ************************************** ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/lines-3-200-200-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/lines-3-200-200-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/lines-3-200-200-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/lines-3-200-200-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,67 @@ +{ + "keys": [ + "", + "8", + "7", + "6", + "5", + "9", + "1", + "4", + "2", + "3" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ! ! ! ! ", + " ############################################# ", + " ############################################# ", + " ############################################# ", + " ", + " ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " '' '' (((((((((( ))))))) ", + " ''''''' (((((((((( )))))))) ", + " ''''''''' (((((((((( )))))))) ", + " '''' '''' )))) )))) ", + " ''' ''' ))) )))) ", + " '''' '''' )))))))) ", + " '''''''' ********** )))))))) ", + " ''''''' ********** )))))) ", + " ''' ********** ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/lines-3-400-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/lines-3-400-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/lines-3-400-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/lines-3-400-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,117 @@ +{ + "keys": [ + "", + "8", + "7", + "6", + "5", + "9", + "2", + "1", + "4", + "3" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ", + " ", + " ", + " ", + " ########################################################################################## ", + " ########################################################################################## ", + " ########################################################################################## ", + " ########################################################################################## ", + " # # # ", + " ", + " ", + " ", + " ", + " ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $ $ ", + " ", + " ", + " ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " ", + " ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " ", + " ", + " ", + " '''''' ", + " ((((( ))))))))))))))))))) ''''''''''' ", + " ((((((((((( ))))))))))))))))))) '''''''''''' ", + " (((((((((((( ))))))))))))))))))) ''''' ''''' ", + " ((((( ((((( '''' '''' ", + " ((( ((( ''' '''' ", + " (((( (((( '''' ''' ", + " ((( ((( '''' '''' ", + " ((( ((( ''' ''' ", + " (((( (((( ''' '''' ", + " ((( (((( '''' '''' ", + " (((( (((( '''''''''''' ", + " ((((((((((((( ''''''''''' ", + " ((((((((((( ******************* '''''''' ", + " (((((((( ******************* ''' ", + " ((( ******************* ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/lines-3-600-600-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/lines-3-600-600-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/lines-3-600-600-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/lines-3-600-600-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,167 @@ +{ + "keys": [ + "", + "8", + "7", + "6", + "5", + "9", + "2", + "1", + "4", + "3" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ######################################################################################################################################## ", + " ######################################################################################################################################## ", + " ######################################################################################################################################## ", + " ## ## # # ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$ $$ $$ $$ ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %% %% % % ", + " ", + " ", + " ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " ", + " ", + " ", + " ", + " ", + " '''' ", + " ( ''''''''' ", + " ((((((( )))))))))))))))))))))))))))) '''''''''''''' ", + " ((((((((((( )))))))))))))))))))))))))))) ''''''' '''''''' ", + " ((((((((((((((( )))))))))))))))))))))))))))) ''''' ''''' ", + " (((((( (((((( ''' ''' ", + " (((( (((( '''' '''' ", + " ((( (((( ''' ''' ", + " (((( ((( '''' '''' ", + " ((( ((( '''' '''' ", + " (((( (((( ''' ''' ", + " ((( ((( '''' ''' ", + " ((( (((( '''' '''' ", + " (((( ((( ''' ''' ", + " ((( (((( '''' '''' ", + " (((( ((( ''' ''' ", + " (((( (((( ''''' ''''' ", + " (((( ((( ''''''' ''''''' ", + " (((((( (((((( ''''''''''''''' ", + " (((((((((((((((( '''''''''' ", + " (((((((((((( **************************** ''''' ", + " (((((((( **************************** ", + " ((( **************************** ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/lines-3-800-800-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/lines-3-800-800-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/lines-3-800-800-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/lines-3-800-800-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,217 @@ +{ + "keys": [ + "", + "8", + "7", + "6", + "5", + "9", + "2", + "1", + "4", + "3" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " #################################################################################################################################################################################### ", + " #################################################################################################################################################################################### ", + " #################################################################################################################################################################################### ", + " # # # # # # # # # ## # # # # # # # # # # # ## # # ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $ $ $ $ $ $ ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %% %% % % ", + " ", + " ", + " ", + " ", + " ", + " ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " &&& && & & & ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " '' ", + " ''''''' ", + " ( '''''''''''' ", + " ((((((( )))))))))))))))))))))))))))))))))))))) ''''''''''''''''' ", + " (((((((((((( )))))))))))))))))))))))))))))))))))))) '''''''' '''''''' ", + " ((((((((((((((((( )))))))))))))))))))))))))))))))))))))) '''''' '''''' ", + " (((((((( (((((((( '''' '''' ", + " (((((( (((((( '''' '''' ", + " (((( ((((( ''' ''' ", + " (((( ((( '''' ''' ", + " (((( ((( ''' '''' ", + " ((( (((( '''' ''' ", + " (((( ((( ''' '''' ", + " ((( (((( '''' '''' ", + " (((( (((( ''' ''' ", + " ((( ((( '''' '''' ", + " (((( (((( '''' ''' ", + " (((( ((( ''' '''' ", + " ((( (((( '''' '''' ", + " (((( ((( '''' '''' ", + " ((( (((( ''' '''' ", + " ((( (((( '''' '''' ", + " (((( (((( '''''' '''''' ", + " (((( (((( '''''''' ''''''' ", + " (((((( ((((( ''''''''''''''''' ", + " (((((((( (((((((( ''''''''''''' ", + " (((((((((((((((((( '''''''' ", + " (((((((((((( ************************************** ''' ", + " (((((((( ************************************** ", + " ((( ************************************** ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/lines-shield-200-200-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/lines-shield-200-200-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/lines-shield-200-200-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/lines-shield-200-200-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,65 @@ +{ + "keys": [ + "", + "7", + "6", + "5", + "4", + "1", + "2", + "3" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !! !!! !! !!! !! !!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !! !! !! !! !! !! ", + " ! ! ! ", + " ", + " ", + " ############################################# ", + " ", + " $ $ $ ", + " $$ $$ $$ $$ $$ $$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$ $ $$ $ $$ $ ", + " ", + " ", + " ", + " %% ", + " &&& %%%%%%%%%% ' '' ", + " && & %% '' ' ' ", + " & && '''' ' ", + " & &&&&& '' '' ", + " &&& &&& ' ' ' ", + " & && (( ''' ", + " & (((((((((( ", + " (( ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/lines-shield-400-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/lines-shield-400-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/lines-shield-400-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/lines-shield-400-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,117 @@ +{ + "keys": [ + "", + "8", + "7", + "6", + "5", + "9", + "4", + "2", + "1", + "3" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! ! ! ! ! ! ", + " !! !! !! !! !! !! !! !! !! !! !! !! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!! !! !!! !! !!! !! !!! !! !!! !! !!! !! ", + " ", + " ", + " ", + " ", + " # # # # # # ", + " # ## # ## # ## # ## # ## # ## ", + " # ## # ## # ## # ## # ## # ## ", + " ### # ### # ### # ### # ### # ### # ", + " ", + " ", + " ", + " ", + " ", + " ", + " $ $ $ $ $ $ ", + " $ $$ $ $$ $ $$ $ $$ $ $$ $ $$ ", + " $ $$ $ $$ $ $$ $ $$ $ $$ $ $$ ", + " $$$ $$$ $$$ $$$ $$$ $$$ ", + " ", + " ", + " ", + " % % % % % % ", + " %% %% %% %% %% %% %% %% %% %% %% %% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " % %% % %% % %% % %% % %% % %% ", + " ", + " & & & & & & ", + " & && & && & && & && & && & && ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " & && & && & && & && & && & && ", + " & & & & & & ", + " ", + " ", + " ", + " '' ' ' (( (((( ( ", + " ))) ))) ''''''''''''''''''' (((( ((( ", + " ))))) ))) '' ' (( ( ", + " )) )) ( ((( ", + " )) ))) ( ( ", + " ( ", + " ) ) ", + " ) ) ( ( ", + " ) (( ", + " ) ) ( (( ", + " )) )) (((( (((( ", + " )))) )))) * (((( (((( ", + " ) ) ) )) ** * ( ", + " ) ) ******************* ", + " ** * ", + " * ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/lines-shield-600-600-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/lines-shield-600-600-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/lines-shield-600-600-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/lines-shield-600-600-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,167 @@ +{ + "keys": [ + "", + "8", + "7", + "6", + "5", + "9", + "2", + "1", + "4", + "3" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! !!! ! !!! ! !!! ! !!! ! !!! ! !!! ! !!! ! !!! ! !!! ", + " ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ", + " !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! ", + " ! ! ! ! ! ! ! ! ! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " # # # # # # # # # ", + " # ## # ## # ## # ## # ## # ## # ## # ## # ## ", + " ######################################################################################################################################## ", + " # ## # ## # ## # ## # ## # ## # ## # ## # ## ", + " # # # # # # # # # ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " $ $ $ $ $ $ $ $ $ ", + " $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$ $$$ $$ $$$ $$ $$$ $$ $$$ $$ $$$ $$ $$$ $$ $$$ $$ $$$ $$ $$$ ", + " $ $ $ $ $ $ $ $ $ ", + " ", + " ", + " ", + " ", + " ", + " ", + " % % % % % % % % % ", + " %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " %% % %% % %% % %% % %% % %% % %% % %% % %% % ", + " ", + " ", + " ", + " ", + " && & & && & & && & & && & & && & & && & & && & & && & & && & & ", + " && & && & && & && & && & && & && & && & && & ", + " && && && && && && && && && && && && && && && && && && ", + " &&& & & &&& & & &&& & & &&& & & &&& & & &&& & & &&& & & &&& & & &&& & & ", + " ", + " ", + " ", + " ", + " ", + " ", + " ' ' '' ' ", + " ( )) ) ))) '' ''' ", + " (( ( (( (( )))))))))))))))))))))))))))) '''' '' ", + " (((( (((( )) )) )) ''' ' ", + " ( ((( ((( ) ) ' ' ", + " ( ( ", + " ( '' ' ", + " ((( ( '''' '' ", + " ( ( ' ' '' ", + " ( (((( ' '' ", + " ((( (( ' ", + " ( ( ' ", + " ( ' ' ", + " ( ''' ", + " ( ( ' '' ", + " (( ( ( ' '''' ", + " ((((( ( ' ' ' ", + " ((( ( ' ' ' '' ", + " ( ( ((( ( * * ''' ", + " (( ( ** ** ** '' ", + " (((( **************************** ", + " ( ( ** ** *** ", + " * * ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/lines-shield-800-800-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/lines-shield-800-800-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/lines-shield-800-800-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/lines-shield-800-800-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,217 @@ +{ + "keys": [ + "", + "8", + "7", + "6", + "5", + "9", + "2", + "1", + "4", + "3" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! ! ! ! ! ! ! ! ! ! ! ! ", + " !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !! ! ! !! ! ! !! ! ! !! ! ! !! ! ! !! ! ! !! ! ! !! ! ! !! ! ! !! ! ! !! ! ! !! ! ! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " # ### # ### # ### # ### # ### # ### # ### # ### # ### # ### # ### # ### ", + " ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ", + " ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ", + " # # # # # # # # # # # # ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " $$ $ $$ $ $$ $ $$ $ $$ $ $$ $ $$ $ $$ $ $$ $ $$ $ $$ $ $$ $ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ ", + " $ $ $ $ $ $ $ $ $ $ $ $ ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " % % % % % % % % % % % % ", + " %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% ", + " ", + " ", + " ", + " ", + " ", + " ", + " & & & & & & & & & & & & ", + " & && & && & && & && & && & && & && & && & && & && & && & && ", + " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ", + " && && && && && && && && && && && && && && && && && && && && && && && && ", + " & & & & & & & & & & & & ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ' ", + " '''' ' '' ", + " ( ))) ) ) )) ) ) ) ''' ''''' ", + " ( ( ( ( ) ) ) ) )) ' ' ''' ", + " (((( (((( )) )) )) )) )) ' ' ' ", + " (( ((( (((( ) ) '' ' ", + " ( (( ' ''' ", + " ((( '' ''''' ", + " ( (( ' ' ", + " (( (( ' ' ", + " ( (( ' ", + " ( ' ' ", + " ( ", + " '' '' ", + " ( ( '''' '' ", + " ( '' '''' ", + " (((( (( ' '' ", + " (( (((( '' ", + " (( ' ' ", + " ( ' ' ", + " ( ( ' ' ' ' ", + " ( '''' '' ", + " ((( ( ''' ''''' ", + " (( ((( '' ' ' '' ", + " ((( (((( '''''' ' ", + " ( ( (( (( * * * '''' ", + " ((( ( ** ** ** ** ** '' ", + " (((( ************************************** ", + " ( *** ** ** * ** ", + " * * * ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/list-100-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/list-100-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/list-100-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/list-100-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "1", + "3", + "5", + "7", + "9", + "2", + "4", + "6", + "8", + "10" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + "! ! # $ % % & ", + "!!! ## $$$ %%% &&& ", + " ", + " ! ' # ( $ ) % * & +", + " ", + " ", + " '' ( ) ** ++", + " ' (( )) ** ++", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/list-150-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/list-150-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/list-150-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/list-150-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "4", + "6", + "7", + "8", + "9", + "2", + "1", + "3", + "5", + "10" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!!! # $ % % && ", + " '' !! ! !! ###$$$ %% & ", + " ", + " ( ' ) ! * # $ % & + ", + " ", + " ", + " ) ) +++", + " ))))) ) )))) ++ ", + " ) ))))) )) )))) ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/list-250-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/list-250-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/list-250-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/list-250-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "1", + "3", + "5", + "7", + "9", + "2", + "4", + "6", + "8", + "10" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! ! ### #### # $$ $$$$ $ %% %% %%%%%% &&& &&& & ", + " !! # ## $$$$ $$$ %%%% %% %% & & & ", + " ", + " ! ' # ( $ ) % * & + ", + " ", + " ", + " ' ' ( ) ) * ", + " ''' ' ' '' ' (( ) ))) ) ) ))) * ", + " '''''' ' '' '' ) )))))) ))))) ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/list-300-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/list-300-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/list-300-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/list-300-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "1", + "3", + "5", + "7", + "9", + "2", + "4", + "6", + "8", + "10" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!! !!!! ### #### # $$$$$$$$ % %%% %%%%%% & &&& &&&& ", + " ! !! # ### $$ $ %%% % % % &&& & & & ", + " ", + " ! ' # ( $ ) % * & + ", + " ", + " ", + " ' ' ' ( ) ) ", + " ' ''' ' ''' ' ( ) ))) ) ) ) * ", + " ' '''''' ' '' '' ) ))))) )) )) ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/list-400-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/list-400-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/list-400-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/list-400-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "1", + "3", + "5", + "7", + "9", + "10", + "2", + "4", + "6", + "8" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!! !! # ######## $$ $$$$ $ %%% %%% %%% &&& &&& & ' ''' ", + " !! ! ! ### # ## # $$ $ $$$ % % % %% & & && ''''' ", + " ", + " ! ( # ) $ * % + & ' ", + " ", + " ", + " ( ( ) * + ", + " ( ((( ( (((( ( ))))) )))) ***** * * ++ + ++ + ++ ", + " ( ((((( (( ((( ))))) ) ))))) * ***** ** * ++++ + ++ +++ + ", + " + ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/list-600-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/list-600-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/list-600-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/list-600-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "2", + "4", + "6", + "8", + "10", + "1", + "3", + "5", + "7", + "9" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! !!! !! ! ## #### # $$ $$$ $ %%% %%%%%% &&& &&& ", + " !! ! !!! #### ## # $$ $ $$$ % %%%%% & && ", + " % ", + " ' ! ( # ) $ * % + & ", + " ", + " ", + " ' ( ( ( ) * + ", + " ''''' ' ' ''' ( ((( ( ( ((((( )) ) ) )) *** * * *** ***** +++++ +++ +++ ", + " '''' ' ''' ''' ( ((((( (( ((((( )))) ) ) ) )) ****** **** * ** * + +++++ +++ ++ ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/list-800-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/list-800-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/list-800-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/list-800-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! # $ % & ' ( ) * + ", + " ", + " ", + " ! ! # # $ $ % & & & ' ( ) * + + ", + " ! !!! ! !!!!!! # ### # #### # $$$$$ $ $$ $$$$ %%%%% %%%% & &&& & &&&&&& ''''' ' ' ((((( ((((((((( )) ) )) ) )) *** * * *** +++ + ++++++ ", + " ! !!!!! !!!!!!! # ##### ## ### $$$$ $ $$ $$ $$$$ %%%%% % %%%%% & &&&&& && &&& ' ''''' '' ' ( ((((( (( ((( ((( )))) ) )) ))) ) ****** * *** ++++++ + ++ + ", + " ) ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/marker-multi-policy-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/marker-multi-policy-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/marker-multi-policy-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/marker-multi-policy-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,110 @@ +{ + "keys": [ + "", + "1", + "2" + ], + "data": {}, + "grid": [ + " ! ", + " ! ", + " ! ", + " ! ", + " ! ", + " ! ", + " ! ", + " ! ", + " ! ", + " ! ", + " ! ", + " # ! ", + " # # # ! ", + " # # # # ! ", + " # # # # ! ", + " # # # # ! ", + " # # # # ! ", + " # ## # ! ", + " # ## # ! ", + " # ## # ! !!!!! ", + " # ## # ! !!!!!! ", + " # ## ## ! !!!!!!!! ", + " # ### # ! !!!!!!!! ", + " # ## # ! !!!!!!!! ! ", + " # # # ! !!!!!!! ! ", + " # # # ! !!!!!! ! ", + " # # # ! ! ", + " # # # ! ! ", + " # # # # ! ! ", + " # # # # ! ! ", + " # # # # ! ! ", + " # # # # ! ! ", + " # # # ! ! ", + " # ! ! ", + " ! ! ", + " ! ! ", + " ! ! ", + " ! ! ", + " ! ! ", + " ! ! ", + " ! ! ", + " ! ! ", + " ! ! ", + " ! ! ", + " !! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! !! ", + " ! !!! ! ! ", + " ! !!!!! ! ! ", + " ! !!!!! ! ! ", + " ! !!!!! ! ! ", + " ! !!!! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! !!! ! !!! ! ", + " ! !!!!!! ! !!!!!! ! ", + " ! !!!!!!! ! !!!!!!!! ! ", + " ! !!!!!!! ! !!!!!!!! ! ", + " ! !!!!!!!! ! !!!!!!!! ! ", + " ! !!!!!!! ! !!!!!!!! ! ", + " ! !!!!!!! ! !!!!!! ! ", + " ! !!!!! ! !!!! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ! ! " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/marker-on-hex-grid-257-256-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/marker-on-hex-grid-257-256-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/marker-on-hex-grid-257-256-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/marker-on-hex-grid-257-256-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,73 @@ +{ + "keys": [ + "", + "1" + ], + "data": {}, + "grid": [ + " !!!! !!!! !!!! !!!! !!!! !!!! ", + " ! ! ! ! ! ! ! ", + " ! ", + " ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " ! ", + " ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ! ", + " ", + " ! ! ", + " ! ! ! ! ! ! ! ! ! ! ! ", + " ! ", + " ! ", + " ! ! ! ! ! ! ! ! ! ! ! ! ", + " ! ! ", + " ", + " ! ! ! ! ! ! ! ! ! ! ", + " ! ! ! ", + " ! ", + " ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ", + " ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! !!!! !!!! !!!! !!!! !!!! !!!! ", + " ! ! ! ", + " ! ! ! ! ! ! ", + " !!!! !!!! !!!! !!!! !!!! !!!! ! ", + " ! ! ! ! ! ", + " ! ! ! ! ! ", + " ! !!!! !!!! !!!! !!!! !!!! !!!! ", + " ! ! ! ! ! ! ", + " ! ! ! ! ", + " !!!! !!!! !!!! !!!! !!!! !!!! ! ", + " ! ! ! ! ! ! ! ", + " ! ! ", + " ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " ! ", + " ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ! ", + " ", + " ! ! ", + " ! ! ! ! ! ! ! ! ! ! ! ", + " ! ", + " ! ", + " ! ! ! ! ! ! ! ! ! ! ! ! ", + " ! ! ", + " ", + " ! ! ! ! ! ! ! ! ! ! ", + " ! ! ! ", + " ! ", + " ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ", + " ! ! ", + " ! ! ! ! ! ! ! ! ", + " !!!! !!!! !!!! !!!! !!!! !!!! ! ", + " ! ! ! ", + " ! ! ! ! ! ! ", + " ! !!!! !!!! !!!! !!!! !!!! !!!! ", + " ! ! ! ! ! ", + " ! ! ! ! ! ", + " !!!! !!!! !!!! !!!! !!!! !!!! ! ", + " ! ! ! ! ! ", + " ! ! ! ! " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/marker-on-hex-grid-400-600-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/marker-on-hex-grid-400-600-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/marker-on-hex-grid-400-600-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/marker-on-hex-grid-400-600-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,159 @@ +{ + "keys": [ + "", + "1" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! ! ! ! ", + " !! ! !! ! ! !! ! !! ! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " !!!!!! !!!!!! !!!!!! !!!!!! !!!!!! !!!!!! ", + " ! ! ! ! ! ! ", + " ! ! ! ! ! !! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + "! ! ! ! ! ! ! ! ! ", + "! !!!! !!!! ! !!! ! !!!! !!!! !!!! ", + " ! ! ! ! ! ! ! ! ! ", + " ! !! ! ! ! !! ! !! ! ", + " ! ! ! ! ! ! ! ! !", + " ! ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " !! ! !! ! ! ! !! !! ! !", + " ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + "! !!!!!! !!!!!! !!!!!! !!!!!! !!!!!! !!!!!! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! !! ! ! ", + " ! ! ! ! ! ! ! !", + " ! ! ! ! ! ! ! ! ! ", + " !!!! !!!! ! !!!! ! !!! !!!! !!!! ", + " ! ! ! ! ! ! !! ! !", + " !! ! ! ! ! !! ! !! ", + " ! ! ! ! ! ! ! ! ! ", + "! ! ! ! ! ! ! ! ! ! ", + "! ! ! ! ! ! ! ! ! ! ", + " !! ! !! ! ! ! !! ! !! ! ", + " ! ! ! !! ! !! ! ", + " ! ! ! ! ! ! ! ! ! !", + " !!!! !!!! ! !!!! ! !!! !!!! !!!! ", + " ! ! ! ! ! ! ! ", + " !! ! ! ! ! !! ! !! ! !", + " ! ! ! ! ! ! ! ", + "! ! ! ! ! ! ! ! ! ! ", + "! !!!! ! !!!! ! !!!! !!!! !!!! !!!! ", + " ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! !! ! ! ", + " ! ! ! ! ! ! ! ! !", + " ! ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " !! ! !! ! ! ! !! !! ! !", + " !! ! ! ! ! !! ! ", + " ! ! ! ! ! ! ! ! ! ", + "! !!!! ! !!!! ! !!! ! !!!! !!!! !!!! ", + " ! ! ! ! ! ! ! ! ", + " ! !! ! ! ! ! ! !! ! !! ! ", + " ! ! ! ! ! ! ! !", + " ! ! ! ! ! ! ! ! ! ", + " !!!!!! !!!!!! !!!!!! !!!!!! !!!!!! !!!!!! ", + " ! ! ! ! ! ! ! ! !", + " !! ! ! ! ! ! !! ! ! ", + " ! ! ! ! ! ! ! ! ! ! ", + "! ! ! ! ! ! ! ! ! ! ", + "! ! ! ! ! ! ! ! ! ! ! ! ", + " !! ! !! ! ! ! !! ! !! ! ", + " !! ! ! !! ! !! ! ", + " ! ! ! ! ! ! ! ! !", + " !!!! !!!! ! !!!! ! !!! !!!! !!!! ", + " ! ! ! ! ! ! ! ! ! ", + " !! ! !! ! ! ! !! ! !! ! !", + " ! ! ! ! ! ! ! ", + "! ! ! ! ! ! ! ! ! ! ", + "! !!!!!! !!!!!! !!!!!! !!!!!! !!!!!! !!!!!! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! !! ! ! ", + " ! ! ! ! ! ! ! !", + " ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ! ! ! ", + " !! ! !! ! ! ! ! !! !! ! !", + " !! ! ! ! ! !! !! ", + " ! ! ! ! ! ! ! ! ! ! ", + "! !!!! !!!! ! !!! ! !!!! !!!! !!!! ", + " ! ! ! ! ! ! ! ", + " ! !! ! !! ! ! !! ! !! ! ", + " ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " !!!!!! !!!!!! !!!!!! !!!!!! !!!!!! !!!!!! ", + " ! ! ! ! ! ! ! ", + " !! ! ! ! ! ! !! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + "! ! ! ! ! ! ! ! ! ! ! ", + " !! ! ! ! ! ! !! ! ! ", + " !! ! ! !! ! !! !! ", + " ! ! ! ! ! ! ! ! ! !", + " ! ! !! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " !! ! !! ! ! ! !! ! !! ! !", + " ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ", + "! !!!!!! !!!!!! !!!!!! !!!!! !!!!!! !!!!!! ", + " ! ! ! ! ! ! ", + " ! ! ! ! ! ! !! ! ! ", + " ! ! ! ! ! ! ! ! !", + " ! ! ! ! ! ! ! ! ! ! ", + " ! ! !! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! !", + " ! ! ! ! ", + " ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/marker-on-hex-grid-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/marker-on-hex-grid-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/marker-on-hex-grid-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/marker-on-hex-grid-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,109 @@ +{ + "keys": [ + "", + "1" + ], + "data": {}, + "grid": [ + " !!!!!! !!!!!! !!!!! !!!!!! !!!!!! !!!!!! ", + " ! !! !! ! !! ! ! !! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! !! ! ! ! ! ", + " ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ", + " !!!!!! !!!!!! !!!!! !!!!!! !!!!!! !!!!!! ", + " ! ! !! !! ! ! ! ! !! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! !! ! ! ! ! ", + " ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " !!!!!! !!!!!! !!!!! !!!!!! !!!!!! !!!!!! ", + " ! ! !! !! ! ! ! ! !! ", + " ! ! ! !! !! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! !! ! ! ! ", + " ! ! ! ! !! ! ! ! ", + " ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " !!!!!! !!!!!! !!!!! !!!!!! !!!!!! !!!!!! ", + " ! ! ! !! ! ! ! ! ! ! ", + " ! ! ! !! !! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " !! ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! !! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " !!!! !!!! ! !!! ! !!!! !!!! !!!! ", + " ! ! !! ! ! ! ! ! ! ", + " ! ! ! ! !! !! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! !!!! !!!! !!!! ! !!!! ! !!!! !!!! ", + " ! ! ! !! !! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! !! !! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " !!!!!! !!!!!! !!!!! !!!!!! !!!!!! !!!!!! ", + " ! ! ! !! !! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ! ! ! ", + " ! ! ! !! !! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ", + " !!!!!! !!!!!! !!!!! !!!!!! !!!!!! !!!!!! ", + " ! ! ! !! !! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! !! ! ! ! ! ", + " ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ", + " !!!!!! !!!!!! !!!!! !!!!!! !!!!!! !!!!!! ", + " ! ! !! !! ! ! ! ! ", + " ! ! ! ! !! ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! !! ! ! ! ! ", + " ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ", + " !!!!!! !!!!!! !!!!!! !!!!!! !!!!!! !!!!!! ", + " ! ! ! !! ! !! ! ! ! ! ! ! ", + " ! ! ! !! !! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! !! ! ! ! ", + " ! ! ! ! !! !! ! ! ! ! ", + " ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ", + " ! !!!! !!!! !!!! ! !!! ! !!!! !!!! ", + " ! ! ! ! ! !! ! ! ! ! ! ! ", + " ! ! ! ! ! !! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ", + " !!!! !!!! ! !!! ! !!!! !!!! !!!! ", + " ! ! !! !! !! ! ! !! ", + " ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " !! ! ! ! ! ! ! !! ! ! ", + " ! ! ! ! ! ! ! ! ! ", + " ! ! ! ! ! ! ", + " ! ! ! ! ! ", + " ! ! ! ! ! ! " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/marker-on-line-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/marker-on-line-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/marker-on-line-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/marker-on-line-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,109 @@ +{ + "keys": [ + "", + "1" + ], + "data": {}, + "grid": [ + " ! ", + " !! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! !!! ", + " ! !!! ", + " ! !! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " ! ! ! ", + " ! ! ", + " ! ! ! ", + " ! ! ", + " ! ! ! ", + " ! ! ", + " ! ! ! ", + " ! ! ", + " ! ! ! ", + " ! ! ", + " ! ! ! ", + " ! ! ", + " ! ! ! ", + " ! ! ", + " ! ! ! ", + " ! ! ", + " ! ! ! ", + " ! ! ", + " ! ! ! ", + " ! ! ", + " ! ! ! ", + " ! ! ", + " ! ! ! ", + " ! ! ", + " ! !! " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/marker-on-line-spacing-eq-width-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/marker-on-line-spacing-eq-width-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/marker-on-line-spacing-eq-width-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/marker-on-line-spacing-eq-width-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,109 @@ +{ + "keys": [ + "", + "1" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!! ", + " !!! !!!!! !", + " !! !!!!! !!!!! ", + " !!!! !!!!! !!!!! ", + " !!!! !!!!!!!!!!!! !!!! ", + " !!!! !!!!!!!!!!!! !!!! ", + " !!! !!!!! !!!!!! !!!! ", + " !!! !!!!! !!!!!! !!!! !! ", + " ! !!!!! !!!!! !!!!! !!! ", + " !!!!! !!!!!!!!!!! !!!! ", + " !!!! !!!!!!!!!!! !!!! ", + " !!! !!!!! !!!!! !!!!! ", + " !! !!!!! !!!!! !!!!! ! ", + " !! !!!! !!!!! !!!!! !!! ", + " !!!! !!!!!! !!!!! !!! ", + " !!!! !!!!!!!!!!!! !!!! ", + " !!!! !!!!! !!!!!! !!!! ", + " !!! !!!!! !!!!!! !!!! ", + " !!! !!!!! !!!!! !!!!! !! ", + " !!!!! !!!!! !!!!! !!! ", + " !!!! !!!!!!!!!!! !!!! ", + " !!!! !!!!!!!!!!! !!!! ", + " !!!! !!!!! !!!!! !!!!! ", + " !! !!!!! !!!!! !!!!! ! ", + " !! !!!! !!!!!! !!!!! !!! ", + " !!!! !!!!!! !!!!! !!!! ", + " !!!! !!!!!!!!!!!! !!!! ", + " !!! !!!!! !!!!! !!!! ", + " !!! !!!!! !!!!! !!!!! !! ", + " !!!!! !!!!! !!!!! !! ", + " !!!!! !!!!! !!! ", + "!!!!!! !!! ", + " !!!!! ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/marker-on-line-spacing-eq-width-overlap-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/marker-on-line-spacing-eq-width-overlap-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/marker-on-line-spacing-eq-width-overlap-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/marker-on-line-spacing-eq-width-overlap-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,109 @@ +{ + "keys": [ + "", + "1" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!! ", + " !!! !!!!! !", + " !! !!!!! !!!!! ", + " !!!! !!!!! !!!!! ", + " !!!! !!!!!!!!!!!! !!!! ", + " !!!! !!!!!!!!!!!! !!!! ", + " !!! !!!!! !!!!!! !!!! ", + " !!! !!!!! !!!!!! !!!! !! ", + " ! !!!!! !!!!! !!!!! !!! ", + " !!!!! !!!!!!!!!!! !!!! ", + " !!!! !!!!!!!!!!! !!!! ", + " !!! !!!!! !!!!! !!!!! ", + " !! !!!!! !!!!! !!!!! ! ", + " !! !!!! !!!!! !!!!! !!! ", + " !!!! !!!!!! !!!!! !!! ", + " !!!! !!!!!!!!!!!! !!!! ", + " !!!! !!!!! !!!!!! !!!! ", + " !!! !!!!! !!!!!! !!!! ", + " !!! !!!!! !!!!! !!!!! !! ", + " !!!!! !!!!! !!!!! !!! ", + " !!!! !!!!!!!!!!! !!!! ", + " !!!! !!!!!!!!!!! !!!! ", + " !!!! !!!!! !!!!! !!!!! ", + " !! !!!!! !!!!! !!!!! ! ", + " !! !!!! !!!!!! !!!!! !!! ", + " !!!! !!!!!! !!!!! !!!! ", + " !!!! !!!!!!!!!!!! !!!! ", + " !!! !!!!! !!!!! !!!! ", + " !!! !!!!! !!!!! !!!!! !! ", + " !!!!! !!!!! !!!!! !! ", + " !!!!! !!!!! !!! ", + "!!!!!! !!! ", + " !!!!! ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/marker-svg-opacity-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/marker-svg-opacity-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/marker-svg-opacity-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/marker-svg-opacity-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,37 @@ +{ + "keys": [ + "", + "4", + "3", + "2", + "1" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " !!! ", + " !!! ", + " !!! ", + " ", + " ", + " ### ", + " ### ", + " ### ", + " ", + " ", + " $$$ ", + " $$$ ", + " $$$ ", + " ", + " ", + " %%% ", + " %%% ", + " %%% ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/marker-with-background-image-257-256-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/marker-with-background-image-257-256-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/marker-with-background-image-257-256-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/marker-with-background-image-257-256-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,73 @@ +{ + "keys": [ + "", + "1" + ], + "data": {}, + "grid": [ + " !!!!!!!! ", + " !!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!! " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/marker-with-background-image-400-600-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/marker-with-background-image-400-600-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/marker-with-background-image-400-600-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/marker-with-background-image-400-600-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,159 @@ +{ + "keys": [ + "", + "1" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!! ", + " !!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/marker-with-background-image-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/marker-with-background-image-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/marker-with-background-image-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/marker-with-background-image-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,109 @@ +{ + "keys": [ + "", + "1" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!! ", + " !!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/marker-with-background-image-and-hsla-transform-257-256-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/marker-with-background-image-and-hsla-transform-257-256-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/marker-with-background-image-and-hsla-transform-257-256-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/marker-with-background-image-and-hsla-transform-257-256-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,73 @@ +{ + "keys": [ + "", + "1" + ], + "data": {}, + "grid": [ + " !!!!!!!! ", + " !!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!! " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/marker-with-background-image-and-hsla-transform-400-600-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/marker-with-background-image-and-hsla-transform-400-600-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/marker-with-background-image-and-hsla-transform-400-600-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/marker-with-background-image-and-hsla-transform-400-600-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,159 @@ +{ + "keys": [ + "", + "1" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!! ", + " !!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/marker-with-background-image-and-hsla-transform-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/marker-with-background-image-and-hsla-transform-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/marker-with-background-image-and-hsla-transform-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/marker-with-background-image-and-hsla-transform-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,109 @@ +{ + "keys": [ + "", + "1" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!!!!! ", + " !!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/marker_line_placement_on_points-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/marker_line_placement_on_points-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/marker_line_placement_on_points-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/marker_line_placement_on_points-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,40 @@ +{ + "keys": [ + "", + "4", + "3", + "6", + "5", + "7", + "1", + "2" + ], + "data": {}, + "grid": [ + " !!!!!! ###### ", + " !!!!! ##### ", + " !! ## ", + " ", + " ", + " ", + " ", + " ", + " $$$$ ", + " $$$$$$ ", + " $$$$$$$ ", + " $$$$$$ ", + " %%%$$%% ", + " %%&&&&% ", + " &&&&&& ", + " &&&&&&& ", + " &&&&&& ", + " && ", + " ", + " ", + " ", + " ", + " ", + " ''' ((( ", + " ''''' ((((( " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/rtl-point-200-200-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/rtl-point-200-200-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/rtl-point-200-200-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/rtl-point-200-200-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,59 @@ +{ + "keys": [ + "", + "5" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! ", + " ! ", + " ", + " !! ! ! ! ", + " ! ! ! ", + " ", + " ", + " ! ", + " ", + " ! ! ", + " ", + " ! ", + " !!! ", + " !!!! ", + " !! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/shield-on-line-spacing-eq-width-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/shield-on-line-spacing-eq-width-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/shield-on-line-spacing-eq-width-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/shield-on-line-spacing-eq-width-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,109 @@ +{ + "keys": [ + "", + "1" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !!!!! !! ", + " !!!!! !! ", + " !!!!! ", + " !! !!!!! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + " !! ", + "! ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/shield-on-polygon-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/shield-on-polygon-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/shield-on-polygon-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/shield-on-polygon-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,39 @@ +{ + "keys": [ + "", + "1", + "3", + "2", + "4", + "5", + "6" + ], + "data": {}, + "grid": [ + " ! ", + " !! ", + " !!! ", + " !! # ", + " !!! ", + " !!!! ", + " !!!! !! ", + " !!!!!!!! ", + " !!!!!!!! ", + " !!!!!!!!! ", + " !!!!!!! ", + " !!!! ", + " $$ % !!! ", + " $$$$$!!! ", + " $$$$$$ ! ", + " $$$$$$ ", + " $$$$$$ ", + " $$$$$$ ", + " $$$$$$$$ ", + " $$$$$$$$ ", + " $$$$$$$$$ ", + " $$$$$$$$$ ", + " &$$$$$$$$ ", + " $$$$$$$$ ", + " '' $ " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/shield-on-polygon-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/shield-on-polygon-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/shield-on-polygon-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/shield-on-polygon-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,115 @@ +{ + "keys": [ + "", + "1", + "3", + "2", + "4", + "7", + "5", + "6" + ], + "data": {}, + "grid": [ + " !!! ", + " !!! ", + " !! ", + " !! ! ", + " !!!!! ", + " !!!!!!!! ", + " !!!!!!!! ! ", + " !!!!!!!!! ", + " !!!!!!!!!! ", + " !!!!!!!!!! ", + " !!!!!!!!! ", + " !!!!!!! ", + " !!!!!!! ", + " !!!!!!! ## ", + " !!!!!!! ## ", + " !!!!!!! ", + " !!!!! ! ", + " !!!!! !! ", + " !!! !!! ", + " !!!!!! !!!! ", + " !!!!!!! !!! ", + " !!!!!!! !!! ", + " !!!!!!!!!!! ", + " !!!!!!!!!!! ", + " !!!!!!!!!!!! !!! ", + " !!!!!!!!!!!! !!!!!!! ", + " !!!!!!!!!!!!!! !!!!!!!! ", + " !!!!!!!!!!!!!!!!!! !!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!!! ! ", + " !!!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!!!! ", + " !!!!!!!!!!!!! ", + " !!!!!!!!!!!! ", + " $$$ !!!!!!!!!!!! ", + " $$ !!!!!!!!!!! ", + " $$$$$ %% !!!!!!!!!!! ", + " $$$$$$$$ %% !!!!!!!!!!! ", + " $$$$$$$$ $$$$$$ !!!!!!!!!!! ", + " $$$$$$$$ $$$$$$$$ !!!!!!!!!!! ", + " $$$$$$$$$$$$$$$$$$ !!!!!!!!!!! ", + " $$$$$$$$$$$$$$$$$$ !!!!!!!! ", + " $$$$$$$$$$$$$$$$$ !!!! ", + " $$$$$$$$$$$$$$$$$$$ ! ", + " $$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " &&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " ''$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " ''$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", + " $$$$$$ $$$$$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$$$$$ ", + " $$$$$$$$$$$$ ", + " $$ $$$$$ ", + " ((( ", + " (((( ", + " (((((( ", + " (((((( " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-490-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-490-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-490-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-490-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "8", + "5", + "1", + "2", + "6", + "7", + "9", + "10", + "3", + "4" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! ", + " ! ", + " # ! ! ", + " ## ", + " $$$ % ##### &&& ' ' ! ! ( (((( ) ", + " $ % % * + ### && '' ! ( ( ( )) ", + " $ %% ** + & ' ! (( ( (( )) ", + " $ ** ++++ & ( ", + " * + + ", + " ! ! ", + " ! ", + " ! ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-495-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-495-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-495-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-495-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "8", + "5", + "1", + "2", + "3", + "6", + "7", + "9", + "10", + "4" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! ", + " ! ", + " ! ! ", + " ## ", + " $$$ % % & #### ' ' ( ! ! ) )))) * ", + " $ % % & + ## '' ( ( ! ) ) ) ** ", + " $$ %% & ++ '' (( !! )) )))) ** ", + " $ & ++++ ) ", + " & & ++ ", + " ! ", + " ! ", + " ! ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-497-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-497-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-497-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-497-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "8", + "5", + "1", + "2", + "3", + "6", + "7", + "9", + "10", + "4" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !! ", + " ! ", + " # ! ! ", + " ## ", + " $$$ % % & #### ''' ((( !!! ) )) ) ) *** ", + " $ %% & + ### '' (( ! ) )) ) * ", + " $$ % & ++ ' ( !! ) )) ) * ", + " $ & ++++ ' ( ! * ", + " & & ++ ", + " ! ", + " ! ", + " ! ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-498-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-498-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-498-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-498-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "8", + "5", + "1", + "2", + "3", + "6", + "7", + "9", + "10", + "4" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !! ", + " !! ", + " # ! ", + " ## ", + " $$$ % % & ##### ''' ((( ! )) ) ) ** ", + " $ %% & + ### '' (( !! ) ) ) * ", + " $$ % & ++ '' (( !! )))) )) ** ", + " $ & ++++ ' ( * ", + " & & ++ ", + " !! ", + " ! ", + " !! ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-499-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-499-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-499-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-499-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "8", + "5", + "1", + "2", + "3", + "6", + "7", + "9", + "10", + "4" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !! ", + " !! ", + " # ! ", + " ## ", + " $$ % % & ##### '' (( ! ) )))) * ", + " $ %% & + ### '' ((( !! )) ) )) ** ", + " $$ && ++ '' (( !! )) ) )) ** ", + " $ & ++++ ' ( ) ", + " & & + ", + " !! ", + " ! ", + " !! ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "8", + "5", + "1", + "2", + "3", + "6", + "7", + "9", + "10", + "4" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !! ", + " ! ", + " # ! ! ", + " ## ", + " $$ % % & #### ' ( ! ! ) )))) ) * * ", + " $ %% & + ## ''' ((( ! ) ) ) * ", + " $$ && ++ '' (( !! )) )))) ** ", + " $ & ++++ ) ", + " & & + ", + " ! ", + " ! ", + " !! ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-501-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-501-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-501-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-501-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "8", + "5", + "1", + "2", + "3", + "6", + "7", + "9", + "10", + "4" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! ", + " ! ", + " # ! ! ", + " ## ", + " $$ % % & #### ' ( !!! ) ) )) ) *** ", + " $ %% & + ## '' ( ( ! ) )) ) * ", + " $$ && + '' (( ! )) * ", + " $ && ++++ ! * ", + " & & + + ", + " ! ! ", + " ! ", + " ! ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-502-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-502-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-502-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-502-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "8", + "5", + "1", + "2", + "6", + "7", + "9", + "10", + "3", + "4" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! ", + " ! ", + " ! ! ", + " ## ", + " $$ % % #### & & ' ' !!! ( (( ( ( ))) ", + " $ %% * + ## && ' ' ! ( ( ( ) ", + " $$ % ** ++ && '' ! (((( (( )) ", + " $ ** ++++ ! ) ", + " * +++ ", + " ! ", + " ! ", + " ! ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-505-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-505-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-505-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-505-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "8", + "5", + "1", + "2", + "6", + "7", + "9", + "10", + "3", + "4" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !! ", + " !! ", + " ! ! ", + " # ", + " $$ % % #### &&& '' ! ( (((( ( ))) ", + " $ %% * + ## && '' ! ( ( ( ) ", + " $$ %%% ** ++ && '' !! (( (((( ) ", + " $ % ** +++++ & ' ( ) ", + " * +++ ", + " ! ", + " ! ", + " !! ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-510-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-510-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/shieldsymbolizer-1-510-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/shieldsymbolizer-1-510-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "8", + "5", + "1", + "2", + "6", + "7", + "9", + "10", + "3", + "4" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !! ", + " !! ", + " ! ", + " ## ", + " $ % % #### & & ''' ! ( ( (( ( ))) ", + " $$ %%% * + ## && '' ! ( (( ( ) ", + " $$ %%% * ++ & ' !! ( (( ( ) ", + " % * ++++ ' ) ", + " * * + ", + " !! ", + " ! ", + " !! ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/simple-100-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/simple-100-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/simple-100-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/simple-100-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,41 @@ +{ + "keys": [ + "", + "2", + "5", + "8", + "1", + "9", + "10", + "3", + "7" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!! !!!! ", + " ! ! #### $$$$$ ", + " ", + " ", + " %% ", + " % %% %%% %% %%%% & '", + " % % % %% ", + " % % % % ", + " ", + " ", + " (( (((( ((( )))))) ", + " (((( ((( (( ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/simple-150-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/simple-150-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/simple-150-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/simple-150-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,41 @@ +{ + "keys": [ + "", + "2", + "7", + "4", + "10", + "1", + "6", + "3", + "8" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!! !!!! # ### # # # ", + " ! !$$ $$ ### # ### %%%", + " ", + " ", + " &&& & ''' ' ", + " & & &&&&&& &&&& && ' ' ''''' ' '' ", + " & & && &&& ' ''' ' ' ", + " && & ' ' ' ", + " ", + " ", + " ( ( ) ))) )))))) ", + " ((((( ( (((( ))) ) ))) ", + " ( ((((( (( (((( ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/simple-250-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/simple-250-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/simple-250-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/simple-250-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "2", + "5", + "8", + "10", + "1", + "4", + "7", + "3", + "6", + "9" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ! ! # # # $ $ $ ", + " !!! ! ! !! ! # ### # ####### $$$$$ $$ $ $$$$ ", + " !!!!!! ! !! !! # ###### ## #### $$$$ $ $$ $$$$ $ %%%% ", + " $ ", + " ", + " && ''' ' ' ((( ( ", + " & &&&&&& &&&& && ' ' '''''' '''' '''( ( ((((( ( (((((((( ", + " & && & & && ' ' '' '' ' '' ( ((( ( ((( ( (", + " & & & & '' ' ' ( ( ( ( ( ", + " ", + " ", + " ) ) ) * * + ", + " ) ))) ) ) )))))) * *** * * *** +++++ + +++ ", + " ) ))))) )) )) )) * ****** ***** ++++ + + +++ ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/simple-300-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/simple-300-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/simple-300-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/simple-300-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "2", + "5", + "8", + "10", + "1", + "4", + "7", + "3", + "6", + "9" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ! ! ! # $ $ ", + " ! !!! ! !!! ! ##### #### $$$$$ $$$ $$ % %%% %%", + " ! !!!!!! ! !! !! # ##### # ## $ $$$$$ $$ $$$ $ %% % % ", + " $$ ", + " ", + " &&& & '' ' ((( ( ", + " & & &&&&& &&&& && ' '' ''' '''' ''' ( ( ((((( (((((((( ((% ", + " & && && & ' ' '' ' '' ( (( (( ((( ( ", + " &&& & & ' ' ' ' ((( ( (( ( ", + " ", + " ", + " ) ) )) * * + + ", + " ) ))) ) )) ))))))) * *** * * * + +++ + ++++ ++ ", + " ) )))))) )) ))))))) * ***** ** ** + +++++ +++ ++ ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/simple-400-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/simple-400-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/simple-400-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/simple-400-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "2", + "4", + "6", + "8", + "10", + "1", + "3", + "5", + "7", + "9" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ! ! # $ % ", + " ! !!! ! !!!! ! ##### #### $$$$$ $ $ %% % %% % %% && &&&& &", + " ! !!!!! !! !!! ##### # ##### $ $$$$$ $$ $ %%%% % %% %%% % &&&& &&& ", + " % ", + " ", + " ''' ' ", + " ' '''''' '''' '' ( # ) $ * % + & ", + " ' '' ' ' ", + " ' ' ' '' ", + " ", + " ", + " ( ( ) ) ) * + ", + " ((((( ( (( (((( ) ))) ) )))))) ***** ********* +++ + + +++ ", + " (((( ( (( (( (((( ) ))))) )) ))) * ***** ** *** *** ++++++ + +++ ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/simple-600-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/simple-600-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/simple-600-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/simple-600-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "1", + "3", + "5", + "7", + "9", + "2", + "4", + "6", + "8", + "10" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ! # # # $ % & ", + " !!!!! ! ! !!! # ### # # ##### $$ $ $ $$ %%% % % %%% %%%%% &&&&& &&& &&& ", + " !!!! ! !!! !!! # ##### ## ##### $$$$ $ $ $ $$ %%%%%% %%%% % %% % & &&&&& &&& && ", + " ", + " ", + " ", + " ! ' # ( $ ) % * & + ", + " ", + " ", + " ", + " ", + " ' ' ( ( ( ) * * * + ", + " ''''' ' '''' ( ((( ( (( ( (( ))) ) ) ))) * *** * **** ** +++++ +++ ", + " '''' ' '''' '' ( (((((( ((( ((( )))))) ))))) * ***** ***** ** + +++++ ++++ ", + " ** ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/simple-800-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/simple-800-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/simple-800-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/simple-800-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ +{ + "keys": [ + "", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ! ! # # $ $ % & & & ' ( ) * + + ", + " ! !!! ! !!!!!! # ### # #### # $$$$$ $ $$ $$$$ %%%%% %%%% & &&& & &&&&&& ''''' ' ' ((((( ((((((((( )) ) )) ) )) *** * * *** +++ + ++++++ ", + " ! !!!!! !!!!!!! # ##### ## ### $$$$ $ $$ $$ $$$$ %%%%% % %%%%% & &&&&& && &&& ' ''''' '' ' ( ((((( (( ((( ((( )))) ) )) ))) ) ****** * *** ++++++ + ++ + ", + " ) ", + " ", + " ", + " ! # $ % & ' ( ) * + ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/simple-E-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/simple-E-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/simple-E-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/simple-E-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,34 @@ +{ + "keys": [ + "", + "5" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!! ! ", + " ! ! !!!!! !! !!! ", + " !! !! !!! ", + " ! ! ! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/simple-N-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/simple-N-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/simple-N-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/simple-N-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,34 @@ +{ + "keys": [ + "", + "5" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!! ! !! ", + " !!!!!! !!! !! ", + " ! !! !! !! ", + " ! ! ! ", + " ", + " ! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/simple-NE-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/simple-NE-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/simple-NE-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/simple-NE-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,34 @@ +{ + "keys": [ + "", + "5" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!! ! ", + " ! !!!!! !! !!! ", + " !! !! !!! ", + " ! ! ! ", + " ", + " ! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/simple-NW-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/simple-NW-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/simple-NW-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/simple-NW-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,34 @@ +{ + "keys": [ + "", + "5" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!! ! ", + " ! !!!!! !! !!! ", + " !! !! !!! ", + " ! ! ! ", + " ", + " ! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/simple-S-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/simple-S-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/simple-S-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/simple-S-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,34 @@ +{ + "keys": [ + "", + "5" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! ", + " ", + " ", + " !!! ! !! ", + " !!!!!! !!! !! ", + " ! !! !! !! ", + " ! ! ! ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/simple-SE-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/simple-SE-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/simple-SE-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/simple-SE-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,34 @@ +{ + "keys": [ + "", + "5" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! ", + " ", + " ", + " !!! ! ", + " ! !!!!! !! !!! ", + " !! !! !!! ", + " ! ! ! ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/simple-SW-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/simple-SW-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/simple-SW-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/simple-SW-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,34 @@ +{ + "keys": [ + "", + "5" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! ", + " ", + " ", + " !!! ! ", + " ! !!!!! !! !!! ", + " !! !! !!! ", + " ! ! ! ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/simple-W-500-100-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/simple-W-500-100-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/simple-W-500-100-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/simple-W-500-100-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,34 @@ +{ + "keys": [ + "", + "5" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!! ! ", + " ! !!!!! !! !!! ! ", + " !! !! !!! ", + " ! ! ! ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/text-halo-rasterizer-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/text-halo-rasterizer-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/text-halo-rasterizer-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/text-halo-rasterizer-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,124 @@ +{ + "keys": [ + "", + "1", + "9", + "2", + "10", + "3", + "11", + "4", + "12", + "5", + "13", + "6", + "14", + "7", + "15", + "8", + "16" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! ! ! ## ## ", + " ! ! !! ! #### # ", + " !!! ! ! !! #### ### ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " $ $ $ %% %% ", + " $ $ $$ $$ %%%% % ", + " $$$ $ $ $$ %%%% %%% ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " & & '' ' ", + " & & && & '''' '' ", + " &&& & & && '''' ''' ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ( ( (( )) )) ", + " ( ( (( )))) ) ", + " ((( ( ( ( )))) ) ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ********** ++ +++ + ", + " ****** * ++ +++ + ", + " ********* ++++++ ++ ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ,,,,,,,,, ,, ------ -- -- ", + " ,,,,,, , ,, - ---- - --- ", + " ,,,,,,,,,,,,, - ---- ------ ", + " ", + " ", + " ", + " ", + " ", + " ", + " .. ...... // // // /// ", + " .............. ////// // /// ", + " .............. ////// // /// ", + " ............. ///////////// ", + " ", + " ", + " ", + " ", + " ", + " ", + " 000 000000 111 111111 ", + " 000000000000 1111111111 ", + " 000000000000 11111111111 ", + " 00000000000 11111111111 ", + " 00000000000 1111111 11 ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/tiff-alpha-broken-assoc-alpha-gdal-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/tiff-alpha-broken-assoc-alpha-gdal-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/tiff-alpha-broken-assoc-alpha-gdal-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/tiff-alpha-broken-assoc-alpha-gdal-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,108 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/tiff-alpha-gdal-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/tiff-alpha-gdal-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/tiff-alpha-gdal-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/tiff-alpha-gdal-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,108 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/tiff-alpha-gradient-gdal-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/tiff-alpha-gradient-gdal-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/tiff-alpha-gradient-gdal-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/tiff-alpha-gradient-gdal-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,108 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/tiff-edge-alignment-gdal1-255-257-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/tiff-edge-alignment-gdal1-255-257-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/tiff-edge-alignment-gdal1-255-257-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/tiff-edge-alignment-gdal1-255-257-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,73 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/tiff-edge-alignment-gdal1-256-256-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/tiff-edge-alignment-gdal1-256-256-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/tiff-edge-alignment-gdal1-256-256-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/tiff-edge-alignment-gdal1-256-256-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,72 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/tiff-edge-alignment-gdal2-255-257-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/tiff-edge-alignment-gdal2-255-257-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/tiff-edge-alignment-gdal2-255-257-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/tiff-edge-alignment-gdal2-255-257-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,73 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/tiff-edge-alignment-gdal2-256-256-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/tiff-edge-alignment-gdal2-256-256-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/tiff-edge-alignment-gdal2-256-256-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/tiff-edge-alignment-gdal2-256-256-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,72 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/tiff-nodata-edge-gdal-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/tiff-nodata-edge-gdal-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/tiff-nodata-edge-gdal-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/tiff-nodata-edge-gdal-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,108 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/tiff-nodata-edge-gdal-969-793-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/tiff-nodata-edge-gdal-969-793-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/tiff-nodata-edge-gdal-969-793-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/tiff-nodata-edge-gdal-969-793-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,207 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/tiff-opaque-edge-gdal-256-256-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/tiff-opaque-edge-gdal-256-256-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/tiff-opaque-edge-gdal-256-256-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/tiff-opaque-edge-gdal-256-256-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,72 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/tiff-opaque-edge-gdal-969-793-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/tiff-opaque-edge-gdal-969-793-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/tiff-opaque-edge-gdal-969-793-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/tiff-opaque-edge-gdal-969-793-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,207 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/tiff-opaque-edge-gdal2-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/tiff-opaque-edge-gdal2-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/tiff-opaque-edge-gdal2-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/tiff-opaque-edge-gdal2-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,108 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/tiff-opaque-edge-gdal2-969-793-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/tiff-opaque-edge-gdal2-969-793-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/tiff-opaque-edge-gdal2-969-793-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/tiff-opaque-edge-gdal2-969-793-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,207 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/tiff-opaque-edge-raster2-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/tiff-opaque-edge-raster2-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/tiff-opaque-edge-raster2-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/tiff-opaque-edge-raster2-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,108 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/tiff-opaque-edge-raster2-969-793-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/tiff-opaque-edge-raster2-969-793-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/tiff-opaque-edge-raster2-969-793-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/tiff-opaque-edge-raster2-969-793-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,207 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/tiff-resampling-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/tiff-resampling-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/tiff-resampling-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/tiff-resampling-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,108 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/grids/whole-centroid-600-400-1.0-grid-reference.json mapnik-2.2.0/tests/visual_tests/grids/whole-centroid-600-400-1.0-grid-reference.json --- mapnik-2.1.0/tests/visual_tests/grids/whole-centroid-600-400-1.0-grid-reference.json 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/grids/whole-centroid-600-400-1.0-grid-reference.json 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,109 @@ +{ + "keys": [ + "", + "1" + ], + "data": {}, + "grid": [ + " !!!! ", + " !!!!! ", + " ! ! ", + " ! ! ", + " ! !!! ", + " ! ! ", + " ! ! ! ! ! ", + " ! ! ! !!! ! ", + " ! ! ! ", + " ! ! ", + " ! ! ! ", + " !!!!!!! !! ! ", + " ! ! ", + " ! !!! ! ", + " ! !! ! ! ", + " !! ", + " ! ! ", + " ! ", + " !! ! ", + " !! ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ! ", + " ! ! ! ! ", + " !!! ! !! ", + " ! ! !! ! ", + " ! ! ! ", + " ! ! ! ! ", + " !! ! ! ", + " ! ", + " ! ! ", + " ! ! ", + " ! ! ", + " ! ! ", + " !!! ", + " ! !!!!! ! ", + " ! !!!!! ! ", + " ! !!!!! ", + " ! !!!!! ! ", + " !! ! ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ! ! ! ", + " ! ! ", + " ! ! ", + " ! !!! ", + " ! ! !! ", + " !! ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! !! ", + " ! ! ", + " ! ! ", + " ! !! ! ! ! ", + " !!! ! ! ", + " ! ! ! ", + " ! ! ! ! ", + " ! ! !! !! ", + " ! ! ! ", + " ! ! !! ! ", + " ! ! ! !! ! ", + " ! ! ! ! ! ! ", + " ! ! ", + " ! ! ! ! ! ", + " ! ! ", + " ! ! ! ! ! ", + " ! ! ! ! ", + " ! ! ! ", + " ! ! ! ", + " ! ", + " ! ! ! ", + " ! ! !! ! ! ", + " ! ! ! ", + " !! ! !! ", + " ! !! ", + " ! ! ", + " ! ! ", + " ! ! ", + " ! ! ! ", + " ! ", + " !! ! ! ", + " ! ! !!!! !! ", + " ! ! !! ! !!! ", + " ! ! ", + " ! ! ", + " !! ! ", + " ! ! ", + " ! ! ", + " ! ", + " ! ! ", + " ! ", + " !! ", + " ! !! ! ", + " ! ! " + ] +} \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/html_report_template.html mapnik-2.2.0/tests/visual_tests/html_report_template.html --- mapnik-2.1.0/tests/visual_tests/html_report_template.html 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/html_report_template.html 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,33 @@ + + + + + + + +
+
expected
+
% difference
+
actual
+{{RESULTS}} +
+ + Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/collision-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/collision-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/collision-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/collision-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/collision-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/collision-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/collision-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/collision-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/expressionformat-500-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/expressionformat-500-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/expressionformat-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/expressionformat-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/expressionformat-500-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/expressionformat-500-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/expressionformat-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/expressionformat-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/expressionformat-500-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/expressionformat-500-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formating-500-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formating-500-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-1-500-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-1-500-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-1-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-1-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-1-500-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-1-500-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-1-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-1-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-1-500-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-1-500-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-2-500-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-2-500-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-2-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-2-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-2-500-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-2-500-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-2-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-2-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-2-500-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-2-500-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-3-500-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-3-500-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-3-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-3-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-3-500-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-3-500-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-3-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-3-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-3-500-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-3-500-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-4-500-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-4-500-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-4-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-4-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-4-500-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-4-500-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-4-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-4-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/formatting-4-500-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/formatting-4-500-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/jalign-auto-200-200-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/jalign-auto-200-200-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/jalign-auto-200-200-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/jalign-auto-200-200-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/jalign-auto-200-200-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/jalign-auto-200-200-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/jalign-auto-200-200-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/jalign-auto-200-200-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/jalign-auto-200-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/jalign-auto-200-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/line-offset-900-250-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/line-offset-900-250-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/line-offset-900-250-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/line-offset-900-250-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/line-offset-900-250-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/line-offset-900-250-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/line-offset-900-250-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/line-offset-900-250-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/line-offset-900-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/line-offset-900-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-200-200-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-200-200-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-200-200-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-200-200-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-200-200-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-200-200-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-200-200-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-200-200-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-200-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-200-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-400-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-400-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-400-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-400-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-400-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-400-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-400-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-400-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-400-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-400-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-600-600-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-600-600-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-600-600-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-600-600-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-600-600-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-600-600-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-600-600-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-600-600-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-600-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-600-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-800-800-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-800-800-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-800-800-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-800-800-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-800-800-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-800-800-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-800-800-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-800-800-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-1-800-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-1-800-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-200-200-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-200-200-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-200-200-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-200-200-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-200-200-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-200-200-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-200-200-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-200-200-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-200-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-200-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-400-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-400-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-400-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-400-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-400-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-400-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-400-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-400-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-400-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-400-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-600-600-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-600-600-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-600-600-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-600-600-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-600-600-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-600-600-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-600-600-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-600-600-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-600-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-600-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-800-800-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-800-800-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-800-800-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-800-800-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-800-800-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-800-800-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-800-800-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-800-800-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-2-800-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-2-800-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-200-200-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-200-200-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-200-200-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-200-200-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-200-200-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-200-200-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-200-200-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-200-200-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-200-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-200-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-400-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-400-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-400-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-400-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-400-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-400-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-400-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-400-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-400-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-400-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-600-600-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-600-600-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-600-600-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-600-600-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-600-600-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-600-600-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-600-600-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-600-600-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-600-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-600-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-800-800-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-800-800-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-800-800-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-800-800-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-800-800-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-800-800-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-800-800-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-800-800-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-3-800-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-3-800-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-200-200-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-200-200-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-200-200-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-200-200-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-200-200-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-200-200-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-200-200-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-200-200-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-200-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-200-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-400-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-400-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-400-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-400-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-400-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-400-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-400-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-400-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-400-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-400-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-600-600-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-600-600-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-600-600-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-600-600-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-600-600-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-600-600-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-600-600-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-600-600-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-600-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-600-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-800-800-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-800-800-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-800-800-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-800-800-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-800-800-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-800-800-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-800-800-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-800-800-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/lines-shield-800-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/lines-shield-800-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-100-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-100-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-100-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-100-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-100-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-100-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-100-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-100-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-100-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-100-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-150-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-150-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-150-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-150-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-150-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-150-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-150-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-150-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-150-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-150-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-200-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-200-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-250-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-250-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-250-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-250-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-250-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-250-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-250-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-250-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-250-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-250-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-300-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-300-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-300-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-300-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-300-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-300-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-300-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-300-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-300-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-300-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-400-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-400-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-400-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-400-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-400-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-400-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-400-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-400-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-400-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-400-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-600-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-600-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-600-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-600-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-600-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-600-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-600-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-600-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-600-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-600-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-800-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-800-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-800-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-800-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-800-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-800-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-800-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-800-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/list-800-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/list-800-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-multi-policy-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-multi-policy-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-multi-policy-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-multi-policy-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-multi-policy-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-multi-policy-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-multi-policy-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-multi-policy-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-hex-grid-257-256-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-hex-grid-257-256-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-hex-grid-257-256-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-hex-grid-257-256-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-hex-grid-257-256-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-hex-grid-257-256-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-hex-grid-257-256-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-hex-grid-257-256-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-hex-grid-400-600-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-hex-grid-400-600-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-hex-grid-400-600-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-hex-grid-400-600-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-hex-grid-400-600-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-hex-grid-400-600-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-hex-grid-400-600-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-hex-grid-400-600-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-hex-grid-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-hex-grid-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-hex-grid-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-hex-grid-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-hex-grid-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-hex-grid-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-hex-grid-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-hex-grid-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-line-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-line-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-line-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-line-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-line-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-line-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-line-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-line-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-line-spacing-eq-width-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-line-spacing-eq-width-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-line-spacing-eq-width-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-line-spacing-eq-width-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-line-spacing-eq-width-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-line-spacing-eq-width-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-line-spacing-eq-width-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-line-spacing-eq-width-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-line-spacing-eq-width-overlap-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-line-spacing-eq-width-overlap-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-line-spacing-eq-width-overlap-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-line-spacing-eq-width-overlap-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-line-spacing-eq-width-overlap-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-line-spacing-eq-width-overlap-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-on-line-spacing-eq-width-overlap-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-on-line-spacing-eq-width-overlap-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-svg-opacity-500-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-svg-opacity-500-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-svg-opacity-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-svg-opacity-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-svg-opacity-500-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-svg-opacity-500-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-svg-opacity-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-svg-opacity-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-257-256-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-257-256-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-257-256-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-257-256-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-257-256-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-257-256-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-257-256-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-257-256-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-400-600-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-400-600-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-400-600-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-400-600-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-400-600-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-400-600-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-400-600-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-400-600-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-257-256-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-257-256-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-257-256-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-257-256-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-257-256-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-257-256-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-257-256-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-257-256-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-400-600-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-400-600-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-400-600-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-400-600-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-400-600-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-400-600-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-400-600-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-400-600-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker-with-background-image-and-hsla-transform-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker_line_placement_on_points-500-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker_line_placement_on_points-500-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker_line_placement_on_points-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker_line_placement_on_points-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker_line_placement_on_points-500-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker_line_placement_on_points-500-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/marker_line_placement_on_points-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/marker_line_placement_on_points-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/python-Format-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/python-Format-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/python-IfElse-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/python-IfElse-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/python-List-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/python-List-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/python-MyText-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/python-MyText-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/python-TextNode-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/python-TextNode-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/rtl-point-200-200-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/rtl-point-200-200-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/rtl-point-200-200-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/rtl-point-200-200-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/rtl-point-200-200-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/rtl-point-200-200-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/rtl-point-200-200-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/rtl-point-200-200-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/rtl-point-200-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/rtl-point-200-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shield-on-line-spacing-eq-width-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shield-on-line-spacing-eq-width-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shield-on-line-spacing-eq-width-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shield-on-line-spacing-eq-width-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shield-on-line-spacing-eq-width-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shield-on-line-spacing-eq-width-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shield-on-line-spacing-eq-width-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shield-on-line-spacing-eq-width-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shield-on-polygon-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shield-on-polygon-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shield-on-polygon-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shield-on-polygon-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shield-on-polygon-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shield-on-polygon-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shield-on-polygon-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shield-on-polygon-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shield-on-polygon-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shield-on-polygon-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shield-on-polygon-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shield-on-polygon-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-490-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-490-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-490-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-490-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-490-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-490-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-490-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-490-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-490-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-490-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-495-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-495-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-495-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-495-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-495-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-495-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-495-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-495-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-495-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-495-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-497-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-497-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-497-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-497-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-497-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-497-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-497-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-497-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-497-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-497-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-498-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-498-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-498-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-498-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-498-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-498-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-498-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-498-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-498-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-498-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-499-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-499-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-499-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-499-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-499-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-499-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-499-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-499-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-499-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-499-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-500-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-500-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-500-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-500-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-500-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-500-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-501-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-501-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-501-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-501-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-501-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-501-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-501-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-501-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-501-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-501-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-502-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-502-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-502-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-502-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-502-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-502-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-502-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-502-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-502-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-502-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-505-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-505-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-505-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-505-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-505-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-505-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-505-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-505-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-505-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-505-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-510-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-510-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-510-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-510-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-510-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-510-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-510-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-510-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/shieldsymbolizer-1-510-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/shieldsymbolizer-1-510-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-100-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-100-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-100-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-100-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-100-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-100-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-100-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-100-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-100-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-100-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-150-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-150-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-150-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-150-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-150-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-150-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-150-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-150-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-150-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-150-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-200-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-200-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-250-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-250-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-250-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-250-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-250-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-250-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-250-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-250-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-250-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-250-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-300-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-300-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-300-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-300-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-300-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-300-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-300-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-300-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-300-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-300-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-400-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-400-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-400-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-400-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-400-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-400-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-400-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-400-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-400-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-400-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-600-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-600-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-600-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-600-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-600-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-600-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-600-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-600-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-600-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-600-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-800-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-800-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-800-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-800-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-800-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-800-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-800-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-800-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-800-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-800-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-E-500-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-E-500-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-E-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-E-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-E-500-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-E-500-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-E-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-E-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-E-500-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-E-500-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-N-500-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-N-500-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-N-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-N-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-N-500-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-N-500-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-N-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-N-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-N-500-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-N-500-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-NE-500-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-NE-500-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-NE-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-NE-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-NE-500-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-NE-500-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-NE-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-NE-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-NE-500-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-NE-500-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-NW-500-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-NW-500-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-NW-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-NW-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-NW-500-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-NW-500-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-NW-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-NW-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-NW-500-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-NW-500-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-S-500-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-S-500-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-S-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-S-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-S-500-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-S-500-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-S-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-S-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-S-500-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-S-500-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-SE-500-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-SE-500-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-SE-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-SE-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-SE-500-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-SE-500-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-SE-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-SE-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-SE-500-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-SE-500-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-SW-500-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-SW-500-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-SW-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-SW-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-SW-500-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-SW-500-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-SW-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-SW-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-SW-500-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-SW-500-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-W-500-100-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-W-500-100-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-W-500-100-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-W-500-100-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-W-500-100-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-W-500-100-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-W-500-100-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-W-500-100-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/simple-W-500-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/simple-W-500-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/text-halo-rasterizer-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/text-halo-rasterizer-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/text-halo-rasterizer-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/text-halo-rasterizer-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/text-halo-rasterizer-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/text-halo-rasterizer-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/text-halo-rasterizer-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/text-halo-rasterizer-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-alpha-broken-assoc-alpha-gdal-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-alpha-broken-assoc-alpha-gdal-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-alpha-broken-assoc-alpha-gdal-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-alpha-broken-assoc-alpha-gdal-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-alpha-broken-assoc-alpha-gdal-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-alpha-broken-assoc-alpha-gdal-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-alpha-broken-assoc-alpha-gdal-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-alpha-broken-assoc-alpha-gdal-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-alpha-gdal-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-alpha-gdal-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-alpha-gdal-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-alpha-gdal-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-alpha-gdal-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-alpha-gdal-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-alpha-gdal-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-alpha-gdal-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-alpha-gradient-gdal-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-alpha-gradient-gdal-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-alpha-gradient-gdal-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-alpha-gradient-gdal-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-alpha-gradient-gdal-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-alpha-gradient-gdal-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-alpha-gradient-gdal-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-alpha-gradient-gdal-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-edge-alignment-gdal1-255-257-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-edge-alignment-gdal1-255-257-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-edge-alignment-gdal1-255-257-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-edge-alignment-gdal1-255-257-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-edge-alignment-gdal1-255-257-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-edge-alignment-gdal1-255-257-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-edge-alignment-gdal1-255-257-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-edge-alignment-gdal1-255-257-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-edge-alignment-gdal1-256-256-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-edge-alignment-gdal1-256-256-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-edge-alignment-gdal1-256-256-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-edge-alignment-gdal1-256-256-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-edge-alignment-gdal1-256-256-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-edge-alignment-gdal1-256-256-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-edge-alignment-gdal1-256-256-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-edge-alignment-gdal1-256-256-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-edge-alignment-gdal2-255-257-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-edge-alignment-gdal2-255-257-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-edge-alignment-gdal2-255-257-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-edge-alignment-gdal2-255-257-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-edge-alignment-gdal2-255-257-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-edge-alignment-gdal2-255-257-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-edge-alignment-gdal2-255-257-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-edge-alignment-gdal2-255-257-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-edge-alignment-gdal2-256-256-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-edge-alignment-gdal2-256-256-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-edge-alignment-gdal2-256-256-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-edge-alignment-gdal2-256-256-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-edge-alignment-gdal2-256-256-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-edge-alignment-gdal2-256-256-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-edge-alignment-gdal2-256-256-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-edge-alignment-gdal2-256-256-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-nodata-edge-gdal-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-nodata-edge-gdal-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-nodata-edge-gdal-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-nodata-edge-gdal-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-nodata-edge-gdal-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-nodata-edge-gdal-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-nodata-edge-gdal-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-nodata-edge-gdal-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-nodata-edge-gdal-969-793-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-nodata-edge-gdal-969-793-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-nodata-edge-gdal-969-793-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-nodata-edge-gdal-969-793-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-nodata-edge-gdal-969-793-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-nodata-edge-gdal-969-793-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-nodata-edge-gdal-969-793-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-nodata-edge-gdal-969-793-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-gdal-256-256-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-gdal-256-256-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-gdal-256-256-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-gdal-256-256-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-gdal-256-256-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-gdal-256-256-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-gdal-256-256-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-gdal-256-256-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-gdal-969-793-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-gdal-969-793-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-gdal-969-793-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-gdal-969-793-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-gdal-969-793-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-gdal-969-793-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-gdal-969-793-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-gdal-969-793-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-gdal2-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-gdal2-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-gdal2-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-gdal2-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-gdal2-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-gdal2-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-gdal2-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-gdal2-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-gdal2-969-793-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-gdal2-969-793-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-gdal2-969-793-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-gdal2-969-793-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-gdal2-969-793-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-gdal2-969-793-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-gdal2-969-793-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-gdal2-969-793-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-raster2-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-raster2-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-raster2-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-raster2-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-raster2-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-raster2-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-raster2-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-raster2-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-raster2-969-793-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-raster2-969-793-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-raster2-969-793-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-raster2-969-793-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-raster2-969-793-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-raster2-969-793-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-opaque-edge-raster2-969-793-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-opaque-edge-raster2-969-793-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-resampling-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-resampling-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-resampling-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-resampling-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-resampling-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-resampling-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/tiff-resampling-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/tiff-resampling-600-400-2.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/whole-centroid-600-400-1.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/whole-centroid-600-400-1.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/whole-centroid-600-400-1.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/whole-centroid-600-400-1.0-cairo-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/whole-centroid-600-400-2.0-agg-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/whole-centroid-600-400-2.0-agg-reference.png differ Binary files /tmp/vKEQn4Nxyh/mapnik-2.1.0/tests/visual_tests/images/whole-centroid-600-400-2.0-cairo-reference.png and /tmp/Oz2YZXflHp/mapnik-2.2.0/tests/visual_tests/images/whole-centroid-600-400-2.0-cairo-reference.png differ diff -Nru mapnik-2.1.0/tests/visual_tests/styles/collision.xml mapnik-2.2.0/tests/visual_tests/styles/collision.xml --- mapnik-2.1.0/tests/visual_tests/styles/collision.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/collision.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,43 @@ + + + + + + + + line + text + + csv + +i|wkt +1|LINESTRING(-98.465624973178 64.664065539837, -84.403124973178 49.195315539837, -72.449999973178 40.757815539837, -61.199999973178 29.507815539837, -60.496874973178 22.476565539837, -58.387499973178 4.1953155398369, -52.059374973178 -7.7578094601631, -41.512499973178 -34.476559460163, -27.449999973178 -45.023434460163, -14.090624973178 -52.054684460163, 7.0031250268221 -61.195309460163) + + | + + + + + line + text + + csv + +i|wkt +1|LINESTRING(-55.574999973178 68.882815539837, -51.356249973178 42.164065539837, -57.684374973178 33.023440539837, -64.012499973178 21.773440539837, -63.309374973178 3.4921905398369, -45.731249973178 -46.429684460163, -16.903124973178 -50.648434460163, -2.8406249731779 -50.648434460163, 14.737500026822 -50.648434460163, 46.378125026822 -41.507809460163, 78.721875026822 -17.601559460163) +2|LINESTRING(-21.824999973178 69.585940539837, -108.30937497318 41.460940539837, -13.387499973178 24.585940539837, -108.30937497318 6.3046905398369, -19.012499973178 -2.1328094601631, -83.699999973178 -26.039059460163, 5.5968750268221 -26.039059460163, -30.262499973178 -63.304684460163, 40.050000026822 -19.710934460163, 62.550000026822 -61.195309460163) +3|LINESTRING(-73.856249973178 77.320315539837, -11.278124973178 -61.898434460163, -112.52812497318 61.148440539837, 31.612500026822 -61.898434460163, 56.925000026822 -13.382809460163) + + | + + + + diff -Nru mapnik-2.1.0/tests/visual_tests/styles/expressionformat.xml mapnik-2.2.0/tests/visual_tests/styles/expressionformat.xml --- mapnik-2.1.0/tests/visual_tests/styles/expressionformat.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/expressionformat.xml 2013-06-04 01:35:28.000000000 +0000 @@ -1,12 +1,12 @@ - + - + My Style - osm - ../data/points.osm + csv + ../data/points.csv @@ -14,7 +14,7 @@ - [name] + [name] diff -Nru mapnik-2.1.0/tests/visual_tests/styles/formating.xml mapnik-2.2.0/tests/visual_tests/styles/formating.xml --- mapnik-2.1.0/tests/visual_tests/styles/formating.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/formating.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ - - - - - - My Style - - osms - ../data/points.osm - - - - - - diff -Nru mapnik-2.1.0/tests/visual_tests/styles/formatting-1.xml mapnik-2.2.0/tests/visual_tests/styles/formatting-1.xml --- mapnik-2.1.0/tests/visual_tests/styles/formatting-1.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/formatting-1.xml 2013-06-04 01:35:28.000000000 +0000 @@ -1,12 +1,12 @@ - + - + My Style - osm - ../data/points.osm + csv + ../data/points.csv @@ -15,7 +15,7 @@ - [name]+' ''('+[name]+')' + [name]+' ''('+[name]+')' diff -Nru mapnik-2.1.0/tests/visual_tests/styles/formatting-2.xml mapnik-2.2.0/tests/visual_tests/styles/formatting-2.xml --- mapnik-2.1.0/tests/visual_tests/styles/formatting-2.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/formatting-2.xml 2013-06-04 01:35:28.000000000 +0000 @@ -1,12 +1,12 @@ - + - + My Style - osm - ../data/points.osm + csv + ../data/points.csv diff -Nru mapnik-2.1.0/tests/visual_tests/styles/formatting-3.xml mapnik-2.2.0/tests/visual_tests/styles/formatting-3.xml --- mapnik-2.1.0/tests/visual_tests/styles/formatting-3.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/formatting-3.xml 2013-06-04 01:35:28.000000000 +0000 @@ -1,12 +1,12 @@ - + - + My Style - osm - ../data/points.osm + csv + ../data/points.csv diff -Nru mapnik-2.1.0/tests/visual_tests/styles/formatting-4.xml mapnik-2.2.0/tests/visual_tests/styles/formatting-4.xml --- mapnik-2.1.0/tests/visual_tests/styles/formatting-4.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/formatting-4.xml 2013-06-04 01:35:28.000000000 +0000 @@ -1,12 +1,12 @@ - + - + My Style - osm - ../data/points.osm + csv + ../data/points.csv diff -Nru mapnik-2.1.0/tests/visual_tests/styles/jalign-auto.xml mapnik-2.2.0/tests/visual_tests/styles/jalign-auto.xml --- mapnik-2.1.0/tests/visual_tests/styles/jalign-auto.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/jalign-auto.xml 2013-06-04 01:35:28.000000000 +0000 @@ -1,18 +1,18 @@ - + - + My Style - osm - ../data/points.osm + csv + ../data/points.csv diff -Nru mapnik-2.1.0/tests/visual_tests/styles/lines-1.xml mapnik-2.2.0/tests/visual_tests/styles/lines-1.xml --- mapnik-2.1.0/tests/visual_tests/styles/lines-1.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/lines-1.xml 2013-06-04 01:35:28.000000000 +0000 @@ -1,17 +1,18 @@ - + - + My Style - osm - ../data/lines.osm + csv + ../data/lines.csv + + + + + boundary + each + whole + largest + + csv + ../data/marker-multi-policy.csv + | + + + diff -Nru mapnik-2.1.0/tests/visual_tests/styles/marker-on-hex-grid.xml mapnik-2.2.0/tests/visual_tests/styles/marker-on-hex-grid.xml --- mapnik-2.1.0/tests/visual_tests/styles/marker-on-hex-grid.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/marker-on-hex-grid.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + 1 + + shape + ../data/hex.shp + + + + diff -Nru mapnik-2.1.0/tests/visual_tests/styles/marker-on-line-spacing-eq-width-overlap.xml mapnik-2.2.0/tests/visual_tests/styles/marker-on-line-spacing-eq-width-overlap.xml --- mapnik-2.1.0/tests/visual_tests/styles/marker-on-line-spacing-eq-width-overlap.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/marker-on-line-spacing-eq-width-overlap.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,53 @@ + + + + + alpha + + csv + + wkt + "LINESTRING(0 0, 10 2)" + + + + + beta + + csv + + wkt + "LINESTRING(0 2, 10 4)" + + + + + gamma + + csv + + wkt + "LINESTRING(0 4, 10 6)" + + + + + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/marker-on-line-spacing-eq-width.xml mapnik-2.2.0/tests/visual_tests/styles/marker-on-line-spacing-eq-width.xml --- mapnik-2.1.0/tests/visual_tests/styles/marker-on-line-spacing-eq-width.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/marker-on-line-spacing-eq-width.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,53 @@ + + + + + alpha + + csv + + wkt + "LINESTRING(0 0, 10 2)" + + + + + beta + + csv + + wkt + "LINESTRING(0 2, 10 4)" + + + + + gamma + + csv + + wkt + "LINESTRING(0 4, 10 6)" + + + + + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/marker-on-line.xml mapnik-2.2.0/tests/visual_tests/styles/marker-on-line.xml --- mapnik-2.1.0/tests/visual_tests/styles/marker-on-line.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/marker-on-line.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,21 @@ + + + + + line + point-placement + + csv + ../data/marker-on-line.csv + | + + + diff -Nru mapnik-2.1.0/tests/visual_tests/styles/marker-svg-opacity.xml mapnik-2.2.0/tests/visual_tests/styles/marker-svg-opacity.xml --- mapnik-2.1.0/tests/visual_tests/styles/marker-svg-opacity.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/marker-svg-opacity.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,58 @@ + + + + + + ellipse + + csv + +x,y,id +1,1,1 +2,2,2 +3,3,3 +4,4,4 + + + + + + + + + + frame + + csv + +x,y +0,0 +5,0 +0,5 +5,5 + + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/marker-with-background-image-and-hsla-transform.xml mapnik-2.2.0/tests/visual_tests/styles/marker-with-background-image-and-hsla-transform.xml --- mapnik-2.1.0/tests/visual_tests/styles/marker-with-background-image-and-hsla-transform.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/marker-with-background-image-and-hsla-transform.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,66 @@ + + + + + + ellipse + + csv + +x,y +2.5,2.5 + + + + + + + + + + frame + + csv + +x,y +0,0 +5,0 +0,5 +5,5 + + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/marker-with-background-image.xml mapnik-2.2.0/tests/visual_tests/styles/marker-with-background-image.xml --- mapnik-2.1.0/tests/visual_tests/styles/marker-with-background-image.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/marker-with-background-image.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,66 @@ + + + + + + ellipse + + csv + +x,y +2.5,2.5 + + + + + + + + + + frame + + csv + +x,y +0,0 +5,0 +0,5 +5,5 + + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/marker_line_placement_on_points.xml mapnik-2.2.0/tests/visual_tests/styles/marker_line_placement_on_points.xml --- mapnik-2.1.0/tests/visual_tests/styles/marker_line_placement_on_points.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/marker_line_placement_on_points.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,36 @@ + + + + + + 1 + + csv + + x,y,id + 0,0,1 + 5,0,1 + 5,5,1 + 0,5,1 + 2.5,2.5,2 + 2.5,3,3 + 2.5,2,3 + 3,2.5,3 + 2,2.5,3 + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/rtl-point.xml mapnik-2.2.0/tests/visual_tests/styles/rtl-point.xml --- mapnik-2.1.0/tests/visual_tests/styles/rtl-point.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/rtl-point.xml 2013-06-04 01:35:28.000000000 +0000 @@ -1,18 +1,18 @@ - + - + My Style - osm - ../data/points.osm + csv + ../data/points.csv + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/shield-on-polygon.xml mapnik-2.2.0/tests/visual_tests/styles/shield-on-polygon.xml --- mapnik-2.1.0/tests/visual_tests/styles/shield-on-polygon.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/shield-on-polygon.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,49 @@ + + + + + + -180,-85.05112877980659,180,85.05112877980659 + 0,0,2 + png + 0 + 22 + + + + + + + countries-outline + countries + + ../../data/shp/new_zealand/ne_50m_land.shp + + + + + + + places + + ../../data/shp/new_zealand/ne_50m_populated_places_simple.shp + + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/shieldsymbolizer-1.xml mapnik-2.2.0/tests/visual_tests/styles/shieldsymbolizer-1.xml --- mapnik-2.1.0/tests/visual_tests/styles/shieldsymbolizer-1.xml 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/shieldsymbolizer-1.xml 2013-06-04 01:35:28.000000000 +0000 @@ -1,54 +1,54 @@ - + - + My Style - osm - ../data/points.osm + csv + ../data/points.csv diff -Nru mapnik-2.1.0/tests/visual_tests/styles/text-halo-rasterizer.xml mapnik-2.2.0/tests/visual_tests/styles/text-halo-rasterizer.xml --- mapnik-2.1.0/tests/visual_tests/styles/text-halo-rasterizer.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/text-halo-rasterizer.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,224 @@ + + + + + + labels + + csv + +id,x,y +0.1,1.5,4.5 +0.3,1.5,4 +0.5,1.5,3.5 +0.7,1.5,3 +1,1.5,2.5 +1.5,1.5,2 +2.5,1.5,1.5 +4,1.5,1 + +100.1,3.5,4.5 +100.3,3.5,4 +100.5,3.5,3.5 +100.7,3.5,3 +101,3.5,2.5 +101.5,3.5,2 +102.5,3.5,1.5 +104,3.5,1 + + + + + + + + + + + frame + + csv + +x,y +0,0 +5,0 +0,5 +5,5 + + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/tiff-alpha-broken-assoc-alpha-gdal.xml mapnik-2.2.0/tests/visual_tests/styles/tiff-alpha-broken-assoc-alpha-gdal.xml --- mapnik-2.1.0/tests/visual_tests/styles/tiff-alpha-broken-assoc-alpha-gdal.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/tiff-alpha-broken-assoc-alpha-gdal.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,21 @@ + + + + + + + white + + + + ../../data/raster/white-alpha-assoc-alpha-wrong.tiff + gdal + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/tiff-alpha-broken-assoc-alpha-raster.xml mapnik-2.2.0/tests/visual_tests/styles/tiff-alpha-broken-assoc-alpha-raster.xml --- mapnik-2.1.0/tests/visual_tests/styles/tiff-alpha-broken-assoc-alpha-raster.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/tiff-alpha-broken-assoc-alpha-raster.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,22 @@ + + + + + + + white + + + + ../../data/raster/white-alpha-assoc-alpha-wrong.tiff + raster + 1001859.9561,5922814.94334,1021141.75555,5942096.74279 + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/tiff-alpha-gdal.xml mapnik-2.2.0/tests/visual_tests/styles/tiff-alpha-gdal.xml --- mapnik-2.1.0/tests/visual_tests/styles/tiff-alpha-gdal.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/tiff-alpha-gdal.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,19 @@ + + + + + + + white + + ../../data/raster/white-alpha-assoc-alpha-correct.tiff + gdal + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/tiff-alpha-gradient-gdal.xml mapnik-2.2.0/tests/visual_tests/styles/tiff-alpha-gradient-gdal.xml --- mapnik-2.1.0/tests/visual_tests/styles/tiff-alpha-gradient-gdal.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/tiff-alpha-gradient-gdal.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,19 @@ + + + + + + + transp + + ../../data/raster/transp.tiff + gdal + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/tiff-alpha-gradient-raster.xml mapnik-2.2.0/tests/visual_tests/styles/tiff-alpha-gradient-raster.xml --- mapnik-2.1.0/tests/visual_tests/styles/tiff-alpha-gradient-raster.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/tiff-alpha-gradient-raster.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,20 @@ + + + + + + + transp + + ../../data/raster/transp.tiff + raster + 0,0,256,256 + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/tiff-alpha-raster.xml mapnik-2.2.0/tests/visual_tests/styles/tiff-alpha-raster.xml --- mapnik-2.1.0/tests/visual_tests/styles/tiff-alpha-raster.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/tiff-alpha-raster.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,20 @@ + + + + + + + white + + ../../data/raster/white-alpha-assoc-alpha-correct.tiff + raster + 1001859.9561,5922814.94334,1021141.75555,5942096.74279 + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/tiff-edge-alignment-gdal1.xml mapnik-2.2.0/tests/visual_tests/styles/tiff-edge-alignment-gdal1.xml --- mapnik-2.1.0/tests/visual_tests/styles/tiff-edge-alignment-gdal1.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/tiff-edge-alignment-gdal1.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,17 @@ + + + + + + test + + ../data/Yosemite_L9.tif + gdal + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/tiff-edge-alignment-gdal2.xml mapnik-2.2.0/tests/visual_tests/styles/tiff-edge-alignment-gdal2.xml --- mapnik-2.1.0/tests/visual_tests/styles/tiff-edge-alignment-gdal2.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/tiff-edge-alignment-gdal2.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,17 @@ + + + + + + test + + ../data/Yosemite_L9.tif + gdal + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/tiff-nodata-edge-gdal.xml mapnik-2.2.0/tests/visual_tests/styles/tiff-nodata-edge-gdal.xml --- mapnik-2.1.0/tests/visual_tests/styles/tiff-nodata-edge-gdal.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/tiff-nodata-edge-gdal.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,20 @@ + + + + + + + style + + + ../../data/raster/nodata-edge.tif + gdal + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/tiff-nodata-edge-raster.xml mapnik-2.2.0/tests/visual_tests/styles/tiff-nodata-edge-raster.xml --- mapnik-2.1.0/tests/visual_tests/styles/tiff-nodata-edge-raster.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/tiff-nodata-edge-raster.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,22 @@ + + + + + + + style + + + + ../../data/raster/nodata-edge.tif + raster + -12329035.765216826,4508650.398543958,-12328653.027947057,4508957.346255356 + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/tiff-opaque-edge-gdal.xml mapnik-2.2.0/tests/visual_tests/styles/tiff-opaque-edge-gdal.xml --- mapnik-2.1.0/tests/visual_tests/styles/tiff-opaque-edge-gdal.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/tiff-opaque-edge-gdal.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,19 @@ + + + + + + test + + + + ../../data/raster/river_wgs.tiff + gdal + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/tiff-opaque-edge-gdal2.xml mapnik-2.2.0/tests/visual_tests/styles/tiff-opaque-edge-gdal2.xml --- mapnik-2.1.0/tests/visual_tests/styles/tiff-opaque-edge-gdal2.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/tiff-opaque-edge-gdal2.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,17 @@ + + + + testmerc + + + + ../../data/raster/river_merc.tiff + gdal + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/tiff-opaque-edge-raster.xml mapnik-2.2.0/tests/visual_tests/styles/tiff-opaque-edge-raster.xml --- mapnik-2.1.0/tests/visual_tests/styles/tiff-opaque-edge-raster.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/tiff-opaque-edge-raster.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,18 @@ + + + + + + test + + ../../data/raster/river_wgs.tiff + raster + 0,0,256,210 + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/tiff-opaque-edge-raster2.xml mapnik-2.2.0/tests/visual_tests/styles/tiff-opaque-edge-raster2.xml --- mapnik-2.1.0/tests/visual_tests/styles/tiff-opaque-edge-raster2.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/tiff-opaque-edge-raster2.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,18 @@ + + + + testmerc + + + + ../../data/raster/river_merc.tiff + -8249238.098993212,-486119.1339340762,-8024337.037783274,-302066.9754826002 + raster + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/tiff-resampling.xml mapnik-2.2.0/tests/visual_tests/styles/tiff-resampling.xml --- mapnik-2.1.0/tests/visual_tests/styles/tiff-resampling.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/tiff-resampling.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,18 @@ + + + + + + style + + ../data/snow-cover.tif + gdal + + + + \ No newline at end of file diff -Nru mapnik-2.1.0/tests/visual_tests/styles/whole-centroid.xml mapnik-2.2.0/tests/visual_tests/styles/whole-centroid.xml --- mapnik-2.1.0/tests/visual_tests/styles/whole-centroid.xml 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/styles/whole-centroid.xml 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,21 @@ + + + + + boundary + whole + + csv + ../data/whole-centroid.csv + | + + + diff -Nru mapnik-2.1.0/tests/visual_tests/test.py mapnik-2.2.0/tests/visual_tests/test.py --- mapnik-2.1.0/tests/visual_tests/test.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/test.py 2013-06-04 01:35:28.000000000 +0000 @@ -2,15 +2,72 @@ # -*- coding: utf-8 -*- import mapnik +mapnik.logger.set_severity(mapnik.severity_type.None) + +import shutil import sys import os.path -from compare import compare, summary +from compare import compare, compare_grids + +try: + import json +except ImportError: + import simplejson as json + +visual_output_dir = "/tmp/mapnik-visual-images" defaults = { 'sizes': [(500, 100)], - 'bbox': mapnik.Box2d(-0.05, -0.01, 0.95, 0.01) + 'scales':[1.0,2.0], + 'agg': True, + 'cairo': mapnik.has_cairo(), + 'grid': True } +cairo_threshold = 10 +if 'Linux' == os.uname()[0]: + # we assume if linux then you are running packaged cairo + # which is older than the 1.12.14 version we used on OS X + # to generate the expected images, so we'll rachet back the threshold + # https://github.com/mapnik/mapnik/issues/1868 + cairo_threshold = 120 + +def render_cairo(m, output, scale_factor): + mapnik.render_to_file(m, output, 'ARGB32', scale_factor) + # open and re-save as png8 to save space + new_im = mapnik.Image.open(output) + new_im.save(output, 'png8:m=h') + +def render_grid(m, output, scale_factor): + grid = mapnik.Grid(m.width, m.height) + mapnik.render_layer(m, grid, layer=0) + utf1 = grid.encode('utf', resolution=4) + open(output,'wb').write(json.dumps(utf1, indent=1)) + +renderers = [ + { 'name': 'agg', + 'render': lambda m, output, scale_factor: mapnik.render_to_file(m, output, 'png8:m=h', scale_factor), + 'compare': lambda actual, reference: compare(actual, reference, alpha=True), + 'threshold': 0, + 'filetype': 'png', + 'dir': 'images' + }, + { 'name': 'cairo', + 'render': render_cairo, + 'compare': lambda actual, reference: compare(actual, reference, alpha=False), + 'threshold': cairo_threshold, + 'filetype': 'png', + 'dir': 'images' + }, + { 'name': 'grid', + 'render': render_grid, + 'compare': lambda actual, reference: compare_grids(actual, reference, alpha=False), + 'threshold': 0, + 'filetype': 'json', + 'dir': 'grids' + } +] + sizes_many_in_big_range = [(800, 100), (600, 100), (400, 100), (300, 100), (250, 100), (150, 100), (100, 100)] @@ -18,56 +75,231 @@ sizes_many_in_small_range = [(490, 100), (495, 100), (497, 100), (498, 100), (499, 100), (500, 100), (501, 100), (502, 100), (505, 100), (510, 100)] +default_text_box = mapnik.Box2d(-0.05, -0.01, 0.95, 0.01) + dirname = os.path.dirname(__file__) -files = [ - {'name': "list", 'sizes': sizes_many_in_big_range}, - {'name': "simple", 'sizes': sizes_many_in_big_range}, - {'name': "lines-1", 'sizes': sizes_few_square}, - {'name': "lines-2", 'sizes': sizes_few_square}, - {'name': "lines-3", 'sizes': sizes_few_square}, - {'name': "lines-shield", 'sizes': sizes_few_square}, - {'name': "simple-E"}, - {'name': "simple-NE"}, - {'name': "simple-NW"}, - {'name': "simple-N"}, - {'name': "simple-SE"}, - {'name': "simple-SW"}, - {'name': "simple-S"}, - {'name': "simple-W"}, - {'name': "formatting-1"}, - {'name': "formatting-2"}, - {'name': "formatting-3"}, - {'name': "formatting-4"}, - {'name': "expressionformat"}, - {'name': "shieldsymbolizer-1", 'sizes': sizes_many_in_small_range}, - {'name': "rtl-point", 'sizes': [(200, 200)]}, - {'name': "jalign-auto", 'sizes': [(200, 200)]}, - {'name': "line-offset", 'sizes':[(900, 250)], - 'bbox': mapnik.Box2d(-5.192, 50.189, -5.174, 50.195)}, - ] - -def render(filename, width, height, bbox, quiet=False): - if not quiet: - print "Rendering style \"%s\" with size %dx%d ... \x1b[1;32m✓ \x1b[0m" % (filename, width, height) - print "-"*80 +files = { + 'list': {'sizes': sizes_many_in_big_range,'bbox':default_text_box}, + 'simple': {'sizes': sizes_many_in_big_range,'bbox':default_text_box}, + 'lines-1': {'sizes': sizes_few_square,'bbox':default_text_box}, + 'lines-2': {'sizes': sizes_few_square,'bbox':default_text_box}, + 'lines-3': {'sizes': sizes_few_square,'bbox':default_text_box}, + # https://github.com/mapnik/mapnik/issues/1696 + # https://github.com/mapnik/mapnik/issues/1521 + # fails with clang++ on os x + 'lines-shield': {'sizes': sizes_few_square,'bbox':default_text_box}, + 'collision': {'sizes':[(600,400)]}, + 'shield-on-polygon': {'sizes':[(600,400)]}, + 'shield-on-line-spacing-eq-width': {'sizes':[(600,400)]}, + 'marker-svg-opacity':{}, + 'marker-multi-policy': {'sizes':[(600,400)]}, + 'marker-on-line': {'sizes':[(600,400)], + 'bbox': mapnik.Box2d(-10, 0, 15, 20)}, + 'marker-on-line-spacing-eq-width': {'sizes':[(600,400)]}, + 'marker-on-line-spacing-eq-width-overlap': {'sizes':[(600,400)]}, + 'marker_line_placement_on_points':{}, + 'marker-with-background-image': {'sizes':[(600,400),(400,600),(257,256)]}, + #'marker-with-background-image-and-hsla-transform': {'sizes':[(600,400),(400,600),(257,256)]}, + 'marker-on-hex-grid': {'sizes':[(600,400),(400,600),(257,256)]}, + 'whole-centroid': {'sizes':[(600,400)], + 'bbox': mapnik.Box2d(736908, 4390316, 2060771, 5942346)}, + 'text-halo-rasterizer': {'sizes':[(600,400)]}, + 'simple-E': {'bbox':mapnik.Box2d(-0.05, -0.01, 0.95, 0.01)}, + 'simple-NE': {'bbox':default_text_box}, + 'simple-NW': {'bbox':default_text_box}, + 'simple-N': {'bbox':default_text_box}, + 'simple-SE': {'bbox':default_text_box}, + 'simple-SW': {'bbox':default_text_box}, + 'simple-S': {'bbox':default_text_box}, + 'simple-W': {'bbox':default_text_box}, + 'formatting-1': {'bbox':default_text_box}, + 'formatting-2': {'bbox':default_text_box}, + 'formatting-3': {'bbox':default_text_box}, + 'formatting-4': {'bbox':default_text_box}, + 'expressionformat': {'bbox':default_text_box}, + 'shieldsymbolizer-1': {'sizes': sizes_many_in_small_range,'bbox':default_text_box}, + 'rtl-point': {'sizes': [(200, 200)],'bbox':default_text_box}, + 'jalign-auto': {'sizes': [(200, 200)],'bbox':default_text_box}, + 'line-offset': {'sizes':[(900, 250)],'bbox': mapnik.Box2d(-5.192, 50.189, -5.174, 50.195)}, + 'tiff-alpha-gdal': {'sizes':[(600,400)]}, + 'tiff-alpha-broken-assoc-alpha-gdal': {'sizes':[(600,400)]}, + 'tiff-alpha-gradient-gdal': {'sizes':[(600,400)]}, + 'tiff-nodata-edge-gdal': {'sizes':[(600,400),(969,793)]}, + 'tiff-opaque-edge-gdal': {'sizes':[(256,256),(969,793)]}, + 'tiff-opaque-edge-gdal2': {'sizes':[(600,400),(969,793)]}, + 'tiff-opaque-edge-raster2': {'sizes':[(600,400),(969,793)]}, + 'tiff-resampling': {'sizes':[(600,400)]}, + # https://github.com/mapnik/mapnik/issues/1622 + 'tiff-edge-alignment-gdal1': {'sizes':[(256,256),(255,257)], + 'bbox':mapnik.Box2d(-13267022.12540147,4618019.500877209,-13247454.246160466,4637587.380118214) + }, + 'tiff-edge-alignment-gdal2': {'sizes':[(256,256),(255,257)], + 'bbox':mapnik.Box2d(-13267022.12540147,4598451.621636203,-13247454.246160466,4618019.500877209) + }, + # https://github.com/mapnik/mapnik/issues/1520 + # commented because these are not critical failures + #'tiff-alpha-raster': {'sizes':[(600,400)]}, + #'tiff-alpha-broken-assoc-alpha-raster': {'sizes':[(600,400)]}, + #'tiff-nodata-edge-raster': {'sizes':[(600,400)]}, + #'tiff-opaque-edge-raster': {'sizes':[(256,256)]}, + } + +class Reporting: + DIFF = 1 + NOT_FOUND = 2 + OTHER = 3 + REPLACE = 4 + def __init__(self, quiet, overwrite_failures = False): + self.quiet = quiet + self.passed = 0 + self.failed = 0 + self.overwrite_failures = overwrite_failures + self.errors = [ #(type, actual, expected, diff, message) + ] + + def result_fail(self, actual, expected, diff): + self.failed += 1 + if self.quiet: + sys.stderr.write('\x1b[31m.\x1b[0m') + else: + print '\x1b[31m✘\x1b[0m (\x1b[34m%u different pixels\x1b[0m)' % diff + + if self.overwrite_failures: + self.errors.append((self.REPLACE, actual, expected, diff, None)) + contents = open(actual, 'r').read() + open(expected, 'wb').write(contents) + else: + self.errors.append((self.DIFF, actual, expected, diff, None)) + + def result_pass(self, actual, expected, diff): + self.passed += 1 + if self.quiet: + sys.stderr.write('\x1b[32m.\x1b[0m') + else: + print '\x1b[32m✓\x1b[0m' + + def not_found(self, actual, expected): + self.failed += 1 + self.errors.append((self.NOT_FOUND, actual, expected, 0, None)) + if self.quiet: + sys.stderr.write('\x1b[33m.\x1b[0m') + else: + print '\x1b[33m?\x1b[0m (\x1b[34mReference file not found, creating\x1b[0m)' + contents = open(actual, 'r').read() + open(expected, 'wb').write(contents) + + def other_error(self, expected, message): + self.failed += 1 + self.errors.append((self.OTHER, None, expected, 0, message)) + if self.quiet: + sys.stderr.write('\x1b[31m.\x1b[0m') + else: + print '\x1b[31m✘\x1b[0m (\x1b[34m%s\x1b[0m)' % message + + def make_html_item(self,actual,expected,diff): + item = ''' +
+ + + +
+ ''' % (expected,expected,'%') + item += '
%s
' % (diff) + item += ''' +
+ + + +
+ ''' % (actual,actual,'%') + return item + + def summary(self): + if self.passed == 0: + print '\nNOTICE: No valid visual tests were run' + return 0 + if len(self.errors) == 0: + print '\nAll %s visual tests passed: \x1b[1;32m✓ \x1b[0m' % self.passed + return 0 + sortable_errors = [] + print "\nVisual rendering: %s failed / %s passed" % (len(self.errors), self.passed) + for idx, error in enumerate(self.errors): + if error[0] == self.OTHER: + print str(idx+1) + ") \x1b[31mfailure to run test:\x1b[0m %s (\x1b[34m%s\x1b[0m)" % (error[2],error[4]) + elif error[0] == self.NOT_FOUND: + print str(idx+1) + ") Generating reference image: '%s'" % error[2] + continue + elif error[0] == self.DIFF: + print str(idx+1) + ") \x1b[34m%s different pixels\x1b[0m:\n\t%s (\x1b[31mactual\x1b[0m)\n\t%s (\x1b[32mexpected\x1b[0m)" % (error[3], error[1], error[2]) + if '.png' in error[1]: # ignore grids + sortable_errors.append((error[3],error)) + elif error[0] == self.REPLACE: + print str(idx+1) + ") \x1b[31mreplaced reference with new version:\x1b[0m %s" % error[2] + if len(sortable_errors): + # drop failure results in folder + vdir = os.path.join(visual_output_dir,'visual-test-results') + if not os.path.exists(vdir): + os.makedirs(vdir) + html_template = open(os.path.join(dirname,'html_report_template.html'),'r').read() + name = 'comparison.html' + failures_realpath = os.path.join(vdir,name) + html_out = open(failures_realpath,'w+') + sortable_errors.sort(reverse=True) + html_body = '' + for item in sortable_errors: + # copy images into single directory + actual = item[1][1] + expected = item[1][2] + diff = item[0] + actual_new = os.path.join(vdir,os.path.basename(actual)) + shutil.copy(actual,actual_new) + expected_new = os.path.join(vdir,os.path.basename(expected)) + shutil.copy(expected,expected_new) + html_body += self.make_html_item(os.path.relpath(actual_new,vdir),os.path.relpath(expected_new,vdir),diff) + html_out.write(html_template.replace('{{RESULTS}}',html_body)) + print 'View failures by opening %s' % failures_realpath + return 1 + +def render(filename,config, width, height, bbox, scale_factor, reporting): m = mapnik.Map(width, height) - mapnik.load_map(m, os.path.join(dirname, "styles", "%s.xml" % filename), False) - if bbox is not None: - m.zoom_to_box(bbox) - else: - m.zoom_all() - expected = os.path.join(dirname, "images", '%s-%d-reference.png' % (filename, width)) - if not os.path.exists('/tmp/mapnik-visual-images'): - os.makedirs('/tmp/mapnik-visual-images') - actual = os.path.join("/tmp/mapnik-visual-images", '%s-%d-agg.png' % (filename, width)) - mapnik.render_to_file(m, actual) - diff = compare(actual, expected) - if diff > 0: - print "-"*80 - print '\x1b[33mError:\x1b[0m %u different pixels' % diff - print "-"*80 + postfix = "%s-%d-%d-%s" % (filename, width, height, scale_factor) + try: + mapnik.load_map(m, os.path.join(dirname, "styles", "%s.xml" % filename), False) + if bbox is not None: + m.zoom_to_box(bbox) + else: + m.zoom_all() + except Exception, e: + if 'Could not create datasource' in str(e): + return m + reporting.other_error(filename, repr(e)) + return m + + for renderer in renderers: + # TODO - grid renderer does not support scale_factor yet via python + if renderer['name'] == 'grid' and scale_factor != 1.0: + continue + if config.get(renderer['name'], True): + expected = os.path.join(dirname, renderer['dir'], '%s-%s-reference.%s' % + (postfix, renderer['name'], renderer['filetype'])) + actual = os.path.join(visual_output_dir, '%s-%s.%s' % + (postfix, renderer['name'], renderer['filetype'])) + if not quiet: + print "\"%s\" with %s..." % (postfix, renderer['name']), + try: + renderer['render'](m, actual, scale_factor) + if not os.path.exists(expected): + reporting.not_found(actual, expected) + else: + diff = renderer['compare'](actual, expected) + if diff > renderer['threshold']: + reporting.result_fail(actual, expected, diff) + else: + reporting.result_pass(actual, expected, diff) + except Exception, e: + reporting.other_error(expected, repr(e)) return m if __name__ == "__main__": @@ -77,19 +309,38 @@ else: quiet = False - if len(sys.argv) == 2: - files = [{"name": sys.argv[1], "sizes": sizes_few_square}] - elif len(sys.argv) > 2: - files = [] - for name in sys.argv[1:]: - files.append({"name": name}) + if '--overwrite' in sys.argv: + overwrite_failures = True + sys.argv.remove('--overwrite') + else: + overwrite_failures = False - if 'osm' in mapnik.DatasourceCache.instance().plugin_names(): - for f in files: - config = dict(defaults) - config.update(f) - for size in config['sizes']: - m = render(config['name'], size[0], size[1], config['bbox'], quiet=quiet) - mapnik.save_map(m, os.path.join(dirname, 'xml_output', "%s-out.xml" % config['name'])) + select_files = {} + if len(sys.argv) > 1: + for name in sys.argv[1:]: + if name in files: + select_files[name]=files[name] + else: + select_files[name]={} + if len(select_files) > 0: + files = select_files + + if not os.path.exists(visual_output_dir): + os.makedirs(visual_output_dir) + + reporting = Reporting(quiet, overwrite_failures) + for filename in files: + config = dict(defaults) + config.update(files[filename]) + for size in config['sizes']: + for scale_factor in config['scales']: + m = render(filename, + config, + size[0], + size[1], + config.get('bbox'), + scale_factor, + reporting) + mapnik.save_map(m, os.path.join(dirname, 'xml_output', "%s-out.xml" % filename)) - summary() + sys.exit(reporting.summary()) diff -Nru mapnik-2.1.0/tests/visual_tests/test_python.py mapnik-2.2.0/tests/visual_tests/test_python.py --- mapnik-2.1.0/tests/visual_tests/test_python.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/tests/visual_tests/test_python.py 2013-06-04 01:35:28.000000000 +0000 @@ -71,7 +71,7 @@ layer = mapnik.Layer('Layer') -layer.datasource = mapnik.Shapefile(file=os.path.join(dirname,"data/points.shp")) +layer.datasource = mapnik.Datasource(**{file=os.path.join(dirname,"data/points.csv")) layer.styles.append('Style') m.layers.append(layer) @@ -85,7 +85,7 @@ format_trees = [ ('TextNode', mapnik.FormattingText("[name]")), ('MyText', MyText()), - ('IfElse', IfElse("[nr] != '5'", + ('IfElse', IfElse("[nr] != 5", mapnik.FormattingText("[name]"), mapnik.FormattingText("'SPECIAL!'"))), ('Format', formatnode), diff -Nru mapnik-2.1.0/utils/format_source_files/format_source_files.sh mapnik-2.2.0/utils/format_source_files/format_source_files.sh --- mapnik-2.1.0/utils/format_source_files/format_source_files.sh 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/format_source_files/format_source_files.sh 2013-06-04 01:35:28.000000000 +0000 @@ -3,12 +3,11 @@ # batch format *.{hpp,cpp} files MAPNIK_DIR=`pwd` -DIRS="$MAPNIK_DIR/plugins $MAPNIK_DIR/demo/c++ $MAPNIK_DIR/src $MAPNIK_DIR/include $MAPNIK_DIR/bindings $MAPNIK_DIR/utils $MAPNIK_DIR/tests" +DIRS="$MAPNIK_DIR/plugins $MAPNIK_DIR/demo/c++ $MAPNIK_DIR/src $MAPNIK_DIR/include $MAPNIK_DIR/bindings $MAPNIK_DIR/utils $MAPNIK_DIR/tests $MAPNIK_DIR/deps/agg" + EMACS="emacs" for file in $(find $DIRS -name '*.cpp' -o -name '*.hpp') do $EMACS -batch $file -l $MAPNIK_DIR/utils/format_source_files/mapnik_format.el -f mapnik-format-function done - - diff -Nru mapnik-2.1.0/utils/format_source_files/mapnik_format.el mapnik-2.2.0/utils/format_source_files/mapnik_format.el --- mapnik-2.1.0/utils/format_source_files/mapnik_format.el 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/format_source_files/mapnik_format.el 2013-06-04 01:35:28.000000000 +0000 @@ -1,5 +1,7 @@ (defun mapnik-format-function () "Format buffer according to mapnik style (TODO)" + (add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode)) + (c-set-style "bsd") (c-set-style "bsd") (c-set-offset 'innamespace 0) (c-set-offset 'template-args-cont 'c-lineup-template-args) diff -Nru mapnik-2.1.0/utils/geometry_to_wkb/main.cpp mapnik-2.2.0/utils/geometry_to_wkb/main.cpp --- mapnik-2.1.0/utils/geometry_to_wkb/main.cpp 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/geometry_to_wkb/main.cpp 2013-06-04 01:35:28.000000000 +0000 @@ -20,7 +20,6 @@ * *****************************************************************************/ -//$Id$ #include #include @@ -44,7 +43,7 @@ std::cerr << "Geometry to WKB converter\n"; - mapnik::datasource_cache::instance()->register_datasources("/opt/mapnik/lib/mapnik/input/"); + mapnik::datasource_cache::instance().register_datasources("/opt/mapnik/lib/mapnik/input/"); std::string filename(argv[1]); std::cerr << filename << std::endl; @@ -57,7 +56,7 @@ try { - ds = mapnik::datasource_cache::instance()->create(p); + ds = mapnik::datasource_cache::instance().create(p); } catch ( ... ) { @@ -105,5 +104,3 @@ return EXIT_SUCCESS; } - - diff -Nru mapnik-2.1.0/utils/mapnik-config/build.py mapnik-2.2.0/utils/mapnik-config/build.py --- mapnik-2.1.0/utils/mapnik-config/build.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/mapnik-config/build.py 2013-06-04 01:35:28.000000000 +0000 @@ -9,25 +9,27 @@ config_env = env.Clone() -# TODO -# major/minor versions -# git rev-list --max-count=1 HEAD - config_variables = '''#!/bin/sh ## variables -CONFIG_PREFIX=%(prefix)s -CONFIG_MAPNIK_LIBNAME=%(mapnik_libname)s -CONFIG_MAPNIK_INCLUDE=${CONFIG_PREFIX}/include -CONFIG_MAPNIK_LIB=${CONFIG_PREFIX}/%(libdir_schema)s +CONFIG_PREFIX="$( cd "$( dirname $( dirname "$0" ))" && pwd )" + +CONFIG_MAPNIK_VERSION_STRING='%(version_string)s' CONFIG_MAPNIK_VERSION='%(version)s' -CONFIG_MAPNIK_LDFLAGS='%(ldflags)s' -CONFIG_DEP_LIBS='%(dep_libs)s' -CONFIG_OTHER_INCLUDES='%(other_includes)s' -CONFIG_FONTS='%(fonts)s' -CONFIG_INPUT_PLUGINS='%(input_plugins)s' CONFIG_GIT_REVISION='%(git_revision)s' +CONFIG_GIT_DESCRIBE='%(git_describe)s' +CONFIG_FONTS="%(fonts)s" +CONFIG_INPUT_PLUGINS="%(input_plugins)s" +CONFIG_MAPNIK_DEFINES='%(defines)s' +CONFIG_MAPNIK_LIBNAME='%(mapnik_libname)s' +CONFIG_MAPNIK_LIBPATH="%(mapnik_libpath)s" +CONFIG_DEP_LIBS='%(dep_libs)s' +CONFIG_MAPNIK_LDFLAGS='%(ldflags)s' +CONFIG_MAPNIK_INCLUDE="${CONFIG_PREFIX}/include -I${CONFIG_PREFIX}/include/mapnik/agg" +CONFIG_DEP_INCLUDES='%(dep_includes)s' +CONFIG_CXXFLAGS='%(cxxflags)s' +CONFIG_CXX='%(cxx)s' ''' @@ -38,22 +40,19 @@ os.chmod(config_file,0755) except: pass +cxxflags = ' '.join(config_env['LIBMAPNIK_CXXFLAGS']) -# todo - refine this list - -other_includes = ''.join([' -I%s' % i for i in config_env['CPPPATH'] if not i.startswith('#')]) +defines = ' '.join(config_env['LIBMAPNIK_DEFINES']) -other_includes += ' ' +dep_includes = ''.join([' -I%s' % i for i in config_env['CPPPATH'] if not i.startswith('#')]) -other_includes += ' '.join(config_env['LIBMAPNIK_CXXFLAGS']) - -other_includes += ' ' +dep_includes += ' ' if config_env['HAS_CAIRO']: - other_includes += ''.join([' -I%s' % i for i in env['CAIROMM_CPPPATHS'] if not i.startswith('#')]) - + dep_includes += ''.join([' -I%s' % i for i in env['CAIRO_CPPPATHS'] if not i.startswith('#')]) ldflags = config_env['CUSTOM_LDFLAGS'] + ''.join([' -L%s' % i for i in config_env['LIBPATH'] if not i.startswith('#')]) +ldflags += config_env['LIBMAPNIK_LINKFLAGS'] dep_libs = ''.join([' -l%s' % i for i in env['LIBMAPNIK_LIBS']]) @@ -61,7 +60,9 @@ dep_libs = dep_libs.replace('-lagg','') git_revision = 'unknown' -# present only for official releases where git metadata is stripped +git_describe = 'unknown' +# special GIT_REVISION/GIT_DESCRIBE files present only for official releases +# where the git directory metadata is stripped # more info: https://github.com/mapnik/mapnik/wiki/MapnikReleaseSteps revision_release_file = '../../GIT_REVISION' if os.path.exists(revision_release_file): @@ -72,19 +73,49 @@ if not stderr: git_revision = stdin.strip() +describe_release_file = '../../GIT_DESCRIBE' +if os.path.exists(describe_release_file): + git_describe = open(describe_release_file,'r').read() +else: + git_cmd = "git describe" + stdin, stderr = Popen(git_cmd, shell=True, stdout=PIPE, stderr=PIPE).communicate() + if not stderr: + git_describe = stdin.strip() + +# for fonts and input plugins we should try +# to store the relative path, if feasible +fontspath = config_env['MAPNIK_FONTS'] +lib_root = os.path.join(config_env['INSTALL_PREFIX'], config_env['LIBDIR_SCHEMA']) +if lib_root in fontspath: + fontspath = "${CONFIG_PREFIX}/" + os.path.relpath(fontspath,config_env['INSTALL_PREFIX']) +inputpluginspath = config_env['MAPNIK_INPUT_PLUGINS'] +if lib_root in inputpluginspath: + inputpluginspath = "${CONFIG_PREFIX}/" + os.path.relpath(inputpluginspath,config_env['INSTALL_PREFIX']) + +lib_path = "${CONFIG_PREFIX}/" + config_env['LIBDIR_SCHEMA'] + configuration = { - "prefix": config_env['PREFIX'], + "git_revision": git_revision, + "git_describe": git_describe, + "version_string": config_env['MAPNIK_VERSION_STRING'], + "version": config_env['MAPNIK_VERSION'], "mapnik_libname": 'mapnik', - "libdir_schema": config_env['LIBDIR_SCHEMA'], + "mapnik_libpath": lib_path, "ldflags": ldflags, "dep_libs": dep_libs, - "other_includes": other_includes, - "fonts": config_env['MAPNIK_FONTS'], - "input_plugins": config_env['MAPNIK_INPUT_PLUGINS'], - "git_revision": git_revision, - "version": config_env['MAPNIK_VERSION_STRING'], + "dep_includes": dep_includes, + "fonts": fontspath, + "input_plugins": inputpluginspath, + "defines":defines, + "cxxflags":cxxflags, + "cxx":env['CXX'] } +## if we are statically linking depedencies +## then they do not need to be reported in ldflags +#if env['RUNTIME_LINK'] == 'static': +# configuration['ldflags'] = '' +# configuration['dep_libs'] = '' template = 'mapnik-config.template.sh' config_file = 'mapnik-config' diff -Nru mapnik-2.1.0/utils/mapnik-config/mapnik-config.template.sh mapnik-2.2.0/utils/mapnik-config/mapnik-config.template.sh --- mapnik-2.1.0/utils/mapnik-config/mapnik-config.template.sh 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/mapnik-config/mapnik-config.template.sh 2013-06-04 01:35:28.000000000 +0000 @@ -1,20 +1,6 @@ ## program below -CONFIG_JSON="{ - \"prefix\": \"${CONFIG_PREFIX}\", - \"mapnik_libname\": \"${CONFIG_MAPNIK_LIBNAME}\", - \"mapnik_include\": \"${CONFIG_MAPNIK_INCLUDE}\", - \"mapnik_lib\": \"${CONFIG_MAPNIK_LIB}\", - \"version\": \"${CONFIG_MAPNIK_VERSION}\", - \"ldflags\": \"${CONFIG_MAPNIK_LDFLAGS}\", - \"dep_libs\": \"${CONFIG_DEP_LIBS}\", - \"other_includes\": \"${CONFIG_OTHER_INCLUDES}\", - \"fonts\": \"${CONFIG_FONTS}\", - \"input_plugins\": \"${CONFIG_INPUT_PLUGINS}\", - \"git_revision\": \"${CONFIG_GIT_REVISION}\" -}" - usage() { cat <&2; } + if test $# -eq 0; then usage 1 fi while test $# -gt 0; do case "$1" in - -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; esac case "$1" in - --prefix=*) - prefix=$optarg - includedir=$CONFIG_PREFIX/include - CONFIG_MAPNIK_LIB=$CONFIG_PREFIX/lib + --help) + usage 0 ;; - --prefix) - echo $CONFIG_PREFIX + -h) + usage 0 ;; -v) - echo $CONFIG_MAPNIK_VERSION + echo ${CONFIG_MAPNIK_VERSION_STRING} ;; --version) - echo $CONFIG_MAPNIK_VERSION + echo ${CONFIG_MAPNIK_VERSION_STRING} ;; - --json) - echo $CONFIG_JSON + --version-number) + echo ${CONFIG_MAPNIK_VERSION} ;; --git-revision) echo ${CONFIG_GIT_REVISION} ;; - --help) - usage 0 + --git-describe) + echo ${CONFIG_GIT_DESCRIBE} ;; --fonts) @@ -89,30 +80,57 @@ echo ${CONFIG_INPUT_PLUGINS} ;; - --cflags) - echo -I${CONFIG_MAPNIK_INCLUDE} ${CONFIG_OTHER_INCLUDES} + --defines) + echo ${CONFIG_MAPNIK_DEFINES} + ;; + + --prefix) + echo ${CONFIG_PREFIX} + ;; + + --lib-name) + echo ${CONFIG_MAPNIK_LIBNAME} ;; --libs) - echo -L${CONFIG_MAPNIK_LIB} -l${CONFIG_MAPNIK_LIBNAME} + echo -L${CONFIG_MAPNIK_LIBPATH} -l${CONFIG_MAPNIK_LIBNAME} + ;; + + --dep-libs) + echo ${CONFIG_DEP_LIBS} ;; --ldflags) echo ${CONFIG_MAPNIK_LDFLAGS} ;; - --lib-name) - echo ${CONFIG_MAPNIK_LIBNAME} + --includes) + echo -I${CONFIG_MAPNIK_INCLUDE} ;; - --dep-libs) - echo ${CONFIG_DEP_LIBS} + --dep-includes) + echo ${CONFIG_DEP_INCLUDES} + ;; + + --cxxflags) + echo ${CONFIG_CXXFLAGS} + ;; + + --cflags) + echo -I${CONFIG_MAPNIK_INCLUDE} ${CONFIG_DEP_INCLUDES} ${CONFIG_MAPNIK_DEFINES} ${CONFIG_CXXFLAGS} + ;; + + --cxx) + echo ${CONFIG_CXX} + ;; + + --all-flags) + echo -I${CONFIG_MAPNIK_INCLUDE} ${CONFIG_DEP_INCLUDES} ${CONFIG_MAPNIK_DEFINES} ${CONFIG_CXXFLAGS} -L${CONFIG_MAPNIK_LIBPATH} -l${CONFIG_MAPNIK_LIBNAME} ${CONFIG_MAPNIK_LDFLAGS} ${CONFIG_DEP_LIBS} ;; *) - # if no matches, return 'usage 1' meaning usage + 1 (error return type) - usage 1 - exit 1 + # push to stderr any invalid options + echo "unknown option $1" 1>&2; ;; esac shift diff -Nru mapnik-2.1.0/utils/ogrindex/build.py mapnik-2.2.0/utils/ogrindex/build.py --- mapnik-2.1.0/utils/ogrindex/build.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/ogrindex/build.py 2013-06-04 01:35:28.000000000 +0000 @@ -17,7 +17,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# import os import glob @@ -40,7 +40,6 @@ program_env['LIBS'].append('mapnik') program_env['LIBS'].append(env['ICU_LIB_NAME']) program_env['LIBS'].append('boost_system%s' % env['BOOST_APPEND']) -program_env['LIBS'].append('boost_filesystem%s' % env['BOOST_APPEND']) program_env['LIBS'].append('boost_program_options%s' % env['BOOST_APPEND']) if env['RUNTIME_LINK'] == 'static': diff -Nru mapnik-2.1.0/utils/ogrindex/ogrindex.cpp mapnik-2.2.0/utils/ogrindex/ogrindex.cpp --- mapnik-2.1.0/utils/ogrindex/ogrindex.cpp 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/ogrindex/ogrindex.cpp 2013-06-04 01:35:28.000000000 +0000 @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: ogrindex.cc 27 2005-03-30 21:45:40Z pavlenko $ #include @@ -28,12 +27,12 @@ #include #include -#include #include #include #include #include +#include #include #include "../shapeindex/quadtree.hpp" @@ -125,7 +124,7 @@ std::string ogrname (*itr++); - if (! boost::filesystem::exists (ogrname)) + if (! mapnik::util::exists (ogrname)) { std::clog << "error : file " << ogrname << " doesn't exists" << std::endl; continue; @@ -137,7 +136,7 @@ if (breakpoint == string::npos) breakpoint = ogrname.length(); std::string ogrlayername (ogrname.substr(0, breakpoint)); - if (boost::filesystem::exists (ogrlayername + ".ogrindex")) + if (mapnik::util::exists (ogrlayername + ".ogrindex")) { std::clog << "error : " << ogrlayername << ".ogrindex file already exists for " << ogrname << std::endl; continue; diff -Nru mapnik-2.1.0/utils/performance/build.py mapnik-2.2.0/utils/performance/build.py --- mapnik-2.1.0/utils/performance/build.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/performance/build.py 2013-06-04 01:35:28.000000000 +0000 @@ -17,7 +17,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# import os Import ('env') diff -Nru mapnik-2.1.0/utils/pgsql2sqlite/build.py mapnik-2.2.0/utils/pgsql2sqlite/build.py --- mapnik-2.1.0/utils/pgsql2sqlite/build.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/pgsql2sqlite/build.py 2013-06-04 01:35:28.000000000 +0000 @@ -17,7 +17,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# import os from copy import copy @@ -38,8 +38,8 @@ program_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS']) if env['HAS_CAIRO']: - program_env.PrependUnique(CPPPATH=env['CAIROMM_CPPPATHS']) - program_env.Append(CXXFLAGS = '-DHAVE_CAIRO') + program_env.PrependUnique(CPPPATH=env['CAIRO_CPPPATHS']) + program_env.Append(CPPDEFINES = '-DHAVE_CAIRO') program_env.PrependUnique(CPPPATH=['#plugins/input/postgis']) diff -Nru mapnik-2.1.0/utils/pgsql2sqlite/main.cpp mapnik-2.2.0/utils/pgsql2sqlite/main.cpp --- mapnik-2.1.0/utils/pgsql2sqlite/main.cpp 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/pgsql2sqlite/main.cpp 2013-06-04 01:35:28.000000000 +0000 @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ // mapnik #include "pgsql2sqlite.hpp" diff -Nru mapnik-2.1.0/utils/pgsql2sqlite/pgsql2sqlite.hpp mapnik-2.2.0/utils/pgsql2sqlite/pgsql2sqlite.hpp --- mapnik-2.1.0/utils/pgsql2sqlite/pgsql2sqlite.hpp 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/pgsql2sqlite/pgsql2sqlite.hpp 2013-06-04 01:35:28.000000000 +0000 @@ -19,32 +19,143 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #include "sqlite.hpp" // mapnik #include #include +#include +#include #include +#include #include "connection_manager.hpp" #include "cursorresultset.hpp" // boost #include -#include -#include +#include #include -#include -#include #include -#include //stl #include #include +static std::string numeric2string(const char* buf) +{ + boost::int16_t ndigits = int2net(buf); + boost::int16_t weight = int2net(buf+2); + boost::int16_t sign = int2net(buf+4); + boost::int16_t dscale = int2net(buf+6); + + boost::scoped_array digits(new boost::int16_t[ndigits]); + for (int n=0; n < ndigits ;++n) + { + digits[n] = int2net(buf+8+n*2); + } + + std::ostringstream ss; + + if (sign == 0x4000) ss << "-"; + + int i = std::max(weight,boost::int16_t(0)); + int d = 0; + + // Each numeric "digit" is actually a value between 0000 and 9999 stored in a 16 bit field. + // For example, the number 1234567809990001 is stored as four digits: [1234] [5678] [999] [1]. + // Note that the last two digits show that the leading 0's are lost when the number is split. + // We must be careful to re-insert these 0's when building the string. + + while ( i >= 0) + { + if (i <= weight && d < ndigits) + { + // All digits after the first must be padded to make the field 4 characters long + if (d != 0) + { +#ifdef _WINDOWS + int dig = digits[d]; + if (dig < 10) + { + ss << "000"; // 0000 - 0009 + } + else if (dig < 100) + { + ss << "00"; // 0010 - 0099 + } + else + { + ss << "0"; // 0100 - 0999; + } +#else + switch(digits[d]) + { + case 0 ... 9: + ss << "000"; // 0000 - 0009 + break; + case 10 ... 99: + ss << "00"; // 0010 - 0099 + break; + case 100 ... 999: + ss << "0"; // 0100 - 0999 + break; + } +#endif + } + ss << digits[d++]; + } + else + { + if (d == 0) + ss << "0"; + else + ss << "0000"; + } + + i--; + } + if (dscale > 0) + { + ss << '.'; + // dscale counts the number of decimal digits following the point, not the numeric digits + while (dscale > 0) + { + int value; + if (i <= weight && d < ndigits) + value = digits[d++]; + else + value = 0; + + // Output up to 4 decimal digits for this value + if (dscale > 0) { + ss << (value / 1000); + value %= 1000; + dscale--; + } + if (dscale > 0) { + ss << (value / 100); + value %= 100; + dscale--; + } + if (dscale > 0) { + ss << (value / 10); + value %= 10; + dscale--; + } + if (dscale > 0) { + ss << value; + dscale--; + } + + i--; + } + } + return ss.str(); +} + + namespace mapnik { template @@ -101,14 +212,7 @@ if ( rs->next()) { - try - { - srid = boost::lexical_cast(rs->getValue("srid")); - } - catch (boost::bad_lexical_cast &ex) - { - std::clog << ex.what() << std::endl; - } + mapnik::util::string2int(rs->getValue("srid"),srid); geom_col = rs->getValue("f_geometry_column"); geom_type = rs->getValue("type"); } @@ -263,16 +367,12 @@ } case 1700: { - std::string str = mapnik::sql_utils::numeric2string(buf); - try + std::string str = numeric2string(buf); + double val; + if (mapnik::util::string2double(str,val)) { - double val = boost::lexical_cast(str); output_rec.push_back(sqlite::value_type(val)); } - catch (boost::bad_lexical_cast & ex) - { - std::clog << ex.what() << "\n"; - } break; } diff -Nru mapnik-2.1.0/utils/pgsql2sqlite/sqlite.cpp mapnik-2.2.0/utils/pgsql2sqlite/sqlite.cpp --- mapnik-2.1.0/utils/pgsql2sqlite/sqlite.cpp 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/pgsql2sqlite/sqlite.cpp 2013-06-04 01:35:28.000000000 +0000 @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #include "sqlite.hpp" diff -Nru mapnik-2.1.0/utils/pgsql2sqlite/sqlite.hpp mapnik-2.2.0/utils/pgsql2sqlite/sqlite.hpp --- mapnik-2.1.0/utils/pgsql2sqlite/sqlite.hpp 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/pgsql2sqlite/sqlite.hpp 2013-06-04 01:35:28.000000000 +0000 @@ -19,12 +19,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ +#include // boost #include -#include #include + //sqlite3 #include @@ -37,7 +37,7 @@ namespace mapnik { namespace sqlite { - class database : private boost::noncopyable + class database : private mapnik::noncopyable { friend class prepared_statement; @@ -74,7 +74,7 @@ typedef boost::variant value_type; typedef std::vector record_type; - class prepared_statement : boost::noncopyable + class prepared_statement : mapnik::noncopyable { struct binder : public boost::static_visitor { diff -Nru mapnik-2.1.0/utils/shapefile/shapefile_reader.py mapnik-2.2.0/utils/shapefile/shapefile_reader.py --- mapnik-2.1.0/utils/shapefile/shapefile_reader.py 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/utils/shapefile/shapefile_reader.py 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1,88 @@ +#!/usr/bin/env python +# Utility to interrogate ESRI shape files + +import os +import sys +import struct + +ShapeType = { 0 : "NullShape", + 1 : "Point", + 3 : "PolyLine", + 5 : "Polygon", + 8 : "MultiPoint", + 11: "PointZ", + 13: "PolyLineZ", + 15: "PolygonZ", + 18: "MultiPointZ", + 21: "PointM", + 23: "PolyLineM", + 25: "PolygonM", + 28: "MultiPointM", + 31: "MultiPatch"} + +def test_record(_type, record) : + if _type == 0: + print "NULL shape" + elif _type == 11: #PointZ + test_pointz(record) + +def test_pointz(record): + if len(record) != 36 : + print>>sys.stderr,"BAD SHAPE FILE: expected 36 bytes got",len(record) + sys.exit(1) + _type,x,y,z,m = struct.unpack(">sys.stderr,"BAD SHAPE FILE: expected PointZ or NullShape got",_type + sys.exit(1) + +if __name__ == "__main__" : + + if len(sys.argv) !=2: + print>>sys.stderr, "Usage:",sys.argv[0],"" + sys.exit(1) + + shx_filename = sys.argv[1][:-3]+"shx" + shp_filename = sys.argv[1][:-3]+"shp" + + shx = open(shx_filename) + shp = open(shp_filename) + + header = (struct.Struct(">IIIIIII"),struct.Struct("II") + record = struct.Struct(">II") + calc_total_size = 50 + count = 0 + while shx.tell() < shx_file_length * 2 : + offset,shx_content_length = record.unpack_from(shx.read(8)) + shp.seek(offset*2, os.SEEK_SET) + record_number,content_length = record_header.unpack_from(shp.read(8)) + + if shx_content_length <> content_length: + print "BAD SHAPE FILE: content_lenght mismatch in SHP and SHX",shx_content_length,content_length + sys.exit(1) + ## + test_record(_type, shp.read(2*content_length)) + calc_total_size +=(4 + content_length) + count+=1 + + print "SHAPES COUNT=",count + delta = shp_file_length-calc_total_size + if delta > 0 : + print "BAD SHAPE FILE: extra ", 2*delta,"bytes" + elif delta < 0: + print "BAD SHAPE FILE: missing ", 2*delta,"bytes" + else: + print "SHAPE FILE LOOKS GOOD!" diff -Nru mapnik-2.1.0/utils/shapeindex/build.py mapnik-2.2.0/utils/shapeindex/build.py --- mapnik-2.1.0/utils/shapeindex/build.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/shapeindex/build.py 2013-06-04 01:35:28.000000000 +0000 @@ -17,7 +17,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# import os import glob @@ -37,9 +37,8 @@ headers = ['#plugins/input/shape'] + env['CPPPATH'] boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND'] -boost_filesystem = 'boost_filesystem%s' % env['BOOST_APPEND'] boost_system = 'boost_system%s' % env['BOOST_APPEND'] -libraries = [boost_program_options, boost_filesystem, boost_system] +libraries = ['mapnik', boost_program_options, boost_system] if env.get('BOOST_LIB_VERSION_FROM_HEADER'): boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1]) diff -Nru mapnik-2.1.0/utils/shapeindex/quadtree.hpp mapnik-2.2.0/utils/shapeindex/quadtree.hpp --- mapnik-2.1.0/utils/shapeindex/quadtree.hpp 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/shapeindex/quadtree.hpp 2013-06-04 01:35:28.000000000 +0000 @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: quadtree.hh 17 2005-03-08 23:58:43Z pavlenko $ #ifndef QUADTREE_HPP #define QUADTREE_HPP diff -Nru mapnik-2.1.0/utils/shapeindex/shapeindex.cpp mapnik-2.2.0/utils/shapeindex/shapeindex.cpp --- mapnik-2.1.0/utils/shapeindex/shapeindex.cpp 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/shapeindex/shapeindex.cpp 2013-06-04 01:35:28.000000000 +0000 @@ -19,16 +19,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: shapeindex.cc 27 2005-03-30 21:45:40Z pavlenko $ #include #include #include - +#include #include #include -#include #include #include "quadtree.hpp" #include "shapefile.hpp" @@ -123,7 +121,7 @@ boost::algorithm::ireplace_last(shapename,".shp",""); std::string shapename_full (shapename+".shp"); - if (! boost::filesystem::exists (shapename_full)) + if (! mapnik::util::exists (shapename_full)) { clog << "error : file " << shapename_full << " does not exist" << endl; continue; diff -Nru mapnik-2.1.0/utils/svg2png/build.py mapnik-2.2.0/utils/svg2png/build.py --- mapnik-2.1.0/utils/svg2png/build.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/svg2png/build.py 2013-06-04 01:35:28.000000000 +0000 @@ -17,7 +17,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# import os import glob @@ -36,8 +36,8 @@ program_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS']) if env['HAS_CAIRO']: - program_env.PrependUnique(CPPPATH=env['CAIROMM_CPPPATHS']) - program_env.Append(CXXFLAGS = '-DHAVE_CAIRO') + program_env.PrependUnique(CPPPATH=env['CAIRO_CPPPATHS']) + program_env.Append(CPPDEFINES = '-DHAVE_CAIRO') libraries = copy(env['LIBMAPNIK_LIBS']) boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND'] diff -Nru mapnik-2.1.0/utils/svg2png/svg2png.cpp mapnik-2.2.0/utils/svg2png/svg2png.cpp --- mapnik-2.1.0/utils/svg2png/svg2png.cpp 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/svg2png/svg2png.cpp 2013-06-04 01:35:28.000000000 +0000 @@ -32,11 +32,10 @@ #include #include #include -#include +#include #include #include -#include #include #include "agg_rasterizer_scanline_aa.h" @@ -127,7 +126,7 @@ } boost::optional marker_ptr = - mapnik::marker_cache::instance()->find(svg_name, false); + mapnik::marker_cache::instance().find(svg_name, false); if (!marker_ptr) { std::clog << "svg2png error: could not open: '" << svg_name << "'\n"; @@ -142,7 +141,7 @@ continue; } - typedef agg::pixfmt_rgba32_plain pixfmt; + typedef agg::pixfmt_rgba32_pre pixfmt; typedef agg::renderer_base renderer_base; typedef agg::renderer_scanline_aa_solid renderer_solid; agg::rasterizer_scanline_aa<> ras_ptr; @@ -170,15 +169,16 @@ mapnik::svg::vertex_stl_adapter stl_storage((*marker.get_vector_data())->source()); mapnik::svg::svg_path_adapter svg_path(stl_storage); - mapnik::svg::svg_renderer, renderer_solid, - agg::pixfmt_rgba32_plain > svg_renderer_this(svg_path, - (*marker.get_vector_data())->attributes()); + agg::pixfmt_rgba32_pre > svg_renderer_this(svg_path, + (*marker.get_vector_data())->attributes()); svg_renderer_this.render(ras_ptr, sl, renb, mtx, opacity, bbox); boost::algorithm::ireplace_last(svg_name,".svg",".png"); + im.demultiply(); mapnik::save_to_file(im.data(),svg_name,"png"); if (auto_open) { diff -Nru mapnik-2.1.0/utils/upgrade_map_xml/build.py mapnik-2.2.0/utils/upgrade_map_xml/build.py --- mapnik-2.1.0/utils/upgrade_map_xml/build.py 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/utils/upgrade_map_xml/build.py 2013-06-04 01:35:28.000000000 +0000 @@ -17,7 +17,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id$ +# import os Import ('env') diff -Nru mapnik-2.1.0/workspace/.gitignore mapnik-2.2.0/workspace/.gitignore --- mapnik-2.1.0/workspace/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ mapnik-2.2.0/workspace/.gitignore 2013-06-04 01:35:28.000000000 +0000 @@ -0,0 +1 @@ +*.user* diff -Nru mapnik-2.1.0/workspace/agg.pri mapnik-2.2.0/workspace/agg.pri --- mapnik-2.1.0/workspace/agg.pri 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/workspace/agg.pri 1970-01-01 00:00:00.000000000 +0000 @@ -1,152 +0,0 @@ - -HEADERS += \ - $$PWD/../deps/agg/include/agg_alpha_mask_u8.h \ - $$PWD/../deps/agg/include/agg_arc.h \ - $$PWD/../deps/agg/include/agg_array.h \ - $$PWD/../deps/agg/include/agg_arrowhead.h \ - $$PWD/../deps/agg/include/agg_basics.h \ - $$PWD/../deps/agg/include/agg_bezier_arc.h \ - $$PWD/../deps/agg/include/agg_bitset_iterator.h \ - $$PWD/../deps/agg/include/agg_blur.h \ - $$PWD/../deps/agg/include/agg_bounding_rect.h \ - $$PWD/../deps/agg/include/agg_bspline.h \ - $$PWD/../deps/agg/include/agg_clip_liang_barsky.h \ - $$PWD/../deps/agg/include/agg_color_gray.h \ - $$PWD/../deps/agg/include/agg_color_rgba.h \ - $$PWD/../deps/agg/include/agg_config.h \ - $$PWD/../deps/agg/include/agg_conv_adaptor_vcgen.h \ - $$PWD/../deps/agg/include/agg_conv_adaptor_vpgen.h \ - $$PWD/../deps/agg/include/agg_conv_bspline.h \ - $$PWD/../deps/agg/include/agg_conv_clip_polygon.h \ - $$PWD/../deps/agg/include/agg_conv_clip_polyline.h \ - $$PWD/../deps/agg/include/agg_conv_close_polygon.h \ - $$PWD/../deps/agg/include/agg_conv_concat.h \ - $$PWD/../deps/agg/include/agg_conv_contour.h \ - $$PWD/../deps/agg/include/agg_conv_curve.h \ - $$PWD/../deps/agg/include/agg_conv_dash.h \ - $$PWD/../deps/agg/include/agg_conv_gpc.h \ - $$PWD/../deps/agg/include/agg_conv_marker_adaptor.h \ - $$PWD/../deps/agg/include/agg_conv_marker.h \ - $$PWD/../deps/agg/include/agg_conv_segmentator.h \ - $$PWD/../deps/agg/include/agg_conv_shorten_path.h \ - $$PWD/../deps/agg/include/agg_conv_smooth_poly1.h \ - $$PWD/../deps/agg/include/agg_conv_stroke.h \ - $$PWD/../deps/agg/include/agg_conv_transform.h \ - $$PWD/../deps/agg/include/agg_conv_unclose_polygon.h \ - $$PWD/../deps/agg/include/agg_curves.h \ - $$PWD/../deps/agg/include/agg_dda_line.h \ - $$PWD/../deps/agg/include/agg_ellipse_bresenham.h \ - $$PWD/../deps/agg/include/agg_ellipse.h \ - $$PWD/../deps/agg/include/agg_embedded_raster_fonts.h \ - $$PWD/../deps/agg/include/agg_font_cache_manager.h \ - $$PWD/../deps/agg/include/agg_gamma_functions.h \ - $$PWD/../deps/agg/include/agg_gamma_lut.h \ - $$PWD/../deps/agg/include/agg_glyph_raster_bin.h \ - $$PWD/../deps/agg/include/agg_gradient_lut.h \ - $$PWD/../deps/agg/include/agg_gsv_text.h \ - $$PWD/../deps/agg/include/agg_image_accessors.h \ - $$PWD/../deps/agg/include/agg_image_filters.h \ - $$PWD/../deps/agg/include/agg_line_aa_basics.h \ - $$PWD/../deps/agg/include/agg_math.h \ - $$PWD/../deps/agg/include/agg_math_stroke.h \ - $$PWD/../deps/agg/include/agg_path_length.h \ - $$PWD/../deps/agg/include/agg_path_storage.h \ - $$PWD/../deps/agg/include/agg_path_storage_integer.h \ - $$PWD/../deps/agg/include/agg_pattern_filters_rgba.h \ - $$PWD/../deps/agg/include/agg_pixfmt_amask_adaptor.h \ - $$PWD/../deps/agg/include/agg_pixfmt_gray.h \ - $$PWD/../deps/agg/include/agg_pixfmt_rgba.h \ - $$PWD/../deps/agg/include/agg_pixfmt_rgb.h \ - $$PWD/../deps/agg/include/agg_pixfmt_rgb_packed.h \ - $$PWD/../deps/agg/include/agg_pixfmt_transposer.h \ - $$PWD/../deps/agg/include/agg_rasterizer_cells_aa.h \ - $$PWD/../deps/agg/include/agg_rasterizer_compound_aa.h \ - $$PWD/../deps/agg/include/agg_rasterizer_outline_aa.h \ - $$PWD/../deps/agg/include/agg_rasterizer_outline.h \ - $$PWD/../deps/agg/include/agg_rasterizer_scanline_aa.h \ - $$PWD/../deps/agg/include/agg_rasterizer_sl_clip.h \ - $$PWD/../deps/agg/include/agg_renderer_base.h \ - $$PWD/../deps/agg/include/agg_renderer_markers.h \ - $$PWD/../deps/agg/include/agg_renderer_mclip.h \ - $$PWD/../deps/agg/include/agg_renderer_outline_aa.h \ - $$PWD/../deps/agg/include/agg_renderer_outline_image.h \ - $$PWD/../deps/agg/include/agg_renderer_primitives.h \ - $$PWD/../deps/agg/include/agg_renderer_raster_text.h \ - $$PWD/../deps/agg/include/agg_renderer_scanline.h \ - $$PWD/../deps/agg/include/agg_rendering_buffer_dynarow.h \ - $$PWD/../deps/agg/include/agg_rendering_buffer.h \ - $$PWD/../deps/agg/include/agg_rounded_rect.h \ - $$PWD/../deps/agg/include/agg_scanline_bin.h \ - $$PWD/../deps/agg/include/agg_scanline_boolean_algebra.h \ - $$PWD/../deps/agg/include/agg_scanline_p.h \ - $$PWD/../deps/agg/include/agg_scanline_storage_aa.h \ - $$PWD/../deps/agg/include/agg_scanline_storage_bin.h \ - $$PWD/../deps/agg/include/agg_scanline_u.h \ - $$PWD/../deps/agg/include/agg_shorten_path.h \ - $$PWD/../deps/agg/include/agg_simul_eq.h \ - $$PWD/../deps/agg/include/agg_span_allocator.h \ - $$PWD/../deps/agg/include/agg_span_converter.h \ - $$PWD/../deps/agg/include/agg_span_gouraud_gray.h \ - $$PWD/../deps/agg/include/agg_span_gouraud.h \ - $$PWD/../deps/agg/include/agg_span_gouraud_rgba.h \ - $$PWD/../deps/agg/include/agg_span_gradient_alpha.h \ - $$PWD/../deps/agg/include/agg_span_gradient.h \ - $$PWD/../deps/agg/include/agg_span_image_filter_gray.h \ - $$PWD/../deps/agg/include/agg_span_image_filter.h \ - $$PWD/../deps/agg/include/agg_span_image_filter_rgba.h \ - $$PWD/../deps/agg/include/agg_span_image_filter_rgb.h \ - $$PWD/../deps/agg/include/agg_span_interpolator_adaptor.h \ - $$PWD/../deps/agg/include/agg_span_interpolator_linear.h \ - $$PWD/../deps/agg/include/agg_span_interpolator_persp.h \ - $$PWD/../deps/agg/include/agg_span_interpolator_trans.h \ - $$PWD/../deps/agg/include/agg_span_pattern_gray.h \ - $$PWD/../deps/agg/include/agg_span_pattern_rgba.h \ - $$PWD/../deps/agg/include/agg_span_pattern_rgb.h \ - $$PWD/../deps/agg/include/agg_span_solid.h \ - $$PWD/../deps/agg/include/agg_span_subdiv_adaptor.h \ - $$PWD/../deps/agg/include/agg_trans_affine.h \ - $$PWD/../deps/agg/include/agg_trans_bilinear.h \ - $$PWD/../deps/agg/include/agg_trans_double_path.h \ - $$PWD/../deps/agg/include/agg_trans_lens.h \ - $$PWD/../deps/agg/include/agg_trans_perspective.h \ - $$PWD/../deps/agg/include/agg_trans_single_path.h \ - $$PWD/../deps/agg/include/agg_trans_viewport.h \ - $$PWD/../deps/agg/include/agg_trans_warp_magnifier.h \ - $$PWD/../deps/agg/include/agg_vcgen_bspline.h \ - $$PWD/../deps/agg/include/agg_vcgen_contour.h \ - $$PWD/../deps/agg/include/agg_vcgen_dash.h \ - $$PWD/../deps/agg/include/agg_vcgen_markers_term.h \ - $$PWD/../deps/agg/include/agg_vcgen_smooth_poly1.h \ - $$PWD/../deps/agg/include/agg_vcgen_stroke.h \ - $$PWD/../deps/agg/include/agg_vcgen_vertex_sequence.h \ - $$PWD/../deps/agg/include/agg_vertex_sequence.h \ - $$PWD/../deps/agg/include/agg_vpgen_clip_polygon.h \ - $$PWD/../deps/agg/include/agg_vpgen_clip_polyline.h \ - $$PWD/../deps/agg/include/agg_vpgen_segmentator.h - -SOURCES += \ - $$PWD/../deps/agg/src/agg_arc.cpp \ - $$PWD/../deps/agg/src/agg_arrowhead.cpp \ - $$PWD/../deps/agg/src/agg_bezier_arc.cpp \ - $$PWD/../deps/agg/src/agg_bspline.cpp \ - $$PWD/../deps/agg/src/agg_curves.cpp \ - $$PWD/../deps/agg/src/agg_embedded_raster_fonts.cpp \ - $$PWD/../deps/agg/src/agg_gsv_text.cpp \ - $$PWD/../deps/agg/src/agg_image_filters.cpp \ - $$PWD/../deps/agg/src/agg_line_aa_basics.cpp \ - $$PWD/../deps/agg/src/agg_line_profile_aa.cpp \ - $$PWD/../deps/agg/src/agg_rounded_rect.cpp \ - $$PWD/../deps/agg/src/agg_sqrt_tables.cpp \ - $$PWD/../deps/agg/src/agg_trans_affine.cpp \ - $$PWD/../deps/agg/src/agg_trans_double_path.cpp \ - $$PWD/../deps/agg/src/agg_trans_single_path.cpp \ - $$PWD/../deps/agg/src/agg_trans_warp_magnifier.cpp \ - $$PWD/../deps/agg/src/agg_vcgen_bspline.cpp \ - $$PWD/../deps/agg/src/agg_vcgen_contour.cpp \ - $$PWD/../deps/agg/src/agg_vcgen_dash.cpp \ - $$PWD/../deps/agg/src/agg_vcgen_markers_term.cpp \ - $$PWD/../deps/agg/src/agg_vcgen_smooth_poly1.cpp \ - $$PWD/../deps/agg/src/agg_vcgen_stroke.cpp \ - $$PWD/../deps/agg/src/agg_vpgen_clip_polygon.cpp \ - $$PWD/../deps/agg/src/agg_vpgen_clip_polyline.cpp \ - $$PWD/../deps/agg/src/agg_vpgen_segmentator.cpp diff -Nru mapnik-2.1.0/workspace/bindings.pri mapnik-2.2.0/workspace/bindings.pri --- mapnik-2.1.0/workspace/bindings.pri 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/workspace/bindings.pri 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ - -HEADERS += \ - $$PWD/../bindings/python/mapnik_enumeration.hpp \ - $$PWD/../bindings/python/mapnik_svg.hpp \ - $$PWD/../bindings/python/mapnik_value_converter.hpp \ - $$PWD/../bindings/python/python_grid_utils.hpp \ - $$PWD/../bindings/python/python_optional.hpp - -SOURCES += \ - $$PWD/../bindings/python/mapnik_color.cpp \ - $$PWD/../bindings/python/mapnik_coord.cpp \ - $$PWD/../bindings/python/mapnik_datasource.cpp \ - $$PWD/../bindings/python/mapnik_datasource_cache.cpp \ - $$PWD/../bindings/python/mapnik_envelope.cpp \ - $$PWD/../bindings/python/mapnik_expression.cpp \ - $$PWD/../bindings/python/mapnik_feature.cpp \ - $$PWD/../bindings/python/mapnik_featureset.cpp \ - $$PWD/../bindings/python/mapnik_font_engine.cpp \ - $$PWD/../bindings/python/mapnik_geometry.cpp \ - $$PWD/../bindings/python/mapnik_grid.cpp \ - $$PWD/../bindings/python/mapnik_grid_view.cpp \ - $$PWD/../bindings/python/mapnik_image.cpp \ - $$PWD/../bindings/python/mapnik_image_view.cpp \ - $$PWD/../bindings/python/mapnik_layer.cpp \ - $$PWD/../bindings/python/mapnik_logger.cpp \ - $$PWD/../bindings/python/mapnik_line_pattern_symbolizer.cpp \ - $$PWD/../bindings/python/mapnik_line_symbolizer.cpp \ - $$PWD/../bindings/python/mapnik_map.cpp \ - $$PWD/../bindings/python/mapnik_markers_symbolizer.cpp \ - $$PWD/../bindings/python/mapnik_palette.cpp \ - $$PWD/../bindings/python/mapnik_parameters.cpp \ - $$PWD/../bindings/python/mapnik_point_symbolizer.cpp \ - $$PWD/../bindings/python/mapnik_polygon_pattern_symbolizer.cpp \ - $$PWD/../bindings/python/mapnik_polygon_symbolizer.cpp \ - $$PWD/../bindings/python/mapnik_proj_transform.cpp \ - $$PWD/../bindings/python/mapnik_projection.cpp \ - $$PWD/../bindings/python/mapnik_python.cpp \ - $$PWD/../bindings/python/mapnik_query.cpp \ - $$PWD/../bindings/python/mapnik_raster_colorizer.cpp \ - $$PWD/../bindings/python/mapnik_raster_symbolizer.cpp \ - $$PWD/../bindings/python/mapnik_rule.cpp \ - $$PWD/../bindings/python/mapnik_shield_symbolizer.cpp \ - $$PWD/../bindings/python/mapnik_stroke.cpp \ - $$PWD/../bindings/python/mapnik_style.cpp \ - $$PWD/../bindings/python/mapnik_symbolizer.cpp \ - $$PWD/../bindings/python/mapnik_text_symbolizer.cpp \ - $$PWD/../bindings/python/mapnik_view_transform.cpp \ - $$PWD/../bindings/python/python_cairo.cpp diff -Nru mapnik-2.1.0/workspace/mapnik.pro mapnik-2.2.0/workspace/mapnik.pro --- mapnik-2.1.0/workspace/mapnik.pro 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/workspace/mapnik.pro 2013-06-04 01:35:28.000000000 +0000 @@ -8,312 +8,16 @@ INCLUDEPATH = \ ../deps/agg/include \ - ../deps/threadpool \ ../include \ + /usr/lib/oracle/11.2.0.3/client/include -HEADERS += \ - ../include/mapnik/formatting/base.hpp \ - ../include/mapnik/formatting/expression.hpp \ - ../include/mapnik/formatting/format.hpp \ - ../include/mapnik/formatting/list.hpp \ - ../include/mapnik/formatting/registry.hpp \ - ../include/mapnik/formatting/text.hpp \ - ../include/mapnik/grid/grid.hpp \ - ../include/mapnik/grid/grid_pixel.hpp \ - ../include/mapnik/grid/grid_pixfmt.hpp \ - ../include/mapnik/grid/grid_rasterizer.hpp \ - ../include/mapnik/grid/grid_renderer.hpp \ - ../include/mapnik/grid/grid_rendering_buffer.hpp \ - ../include/mapnik/grid/grid_util.hpp \ - ../include/mapnik/grid/grid_view.hpp \ - ../include/mapnik/internal/dump_xml.hpp \ - ../include/mapnik/json/feature_collection_grammar.hpp \ - ../include/mapnik/json/feature_collection_parser.hpp \ - ../include/mapnik/json/feature_generator_grammar.hpp \ - ../include/mapnik/json/feature_grammar.hpp \ - ../include/mapnik/json/geojson_generator.hpp \ - ../include/mapnik/json/geometry_generator_grammar.hpp \ - ../include/mapnik/svg/svg_converter.hpp \ - ../include/mapnik/svg/svg_generator.hpp \ - ../include/mapnik/svg/svg_output_attributes.hpp \ - ../include/mapnik/svg/svg_output_grammars.hpp \ - ../include/mapnik/svg/svg_parser.hpp \ - ../include/mapnik/svg/svg_path_adapter.hpp \ - ../include/mapnik/svg/svg_path_attributes.hpp \ - ../include/mapnik/svg/svg_path_commands.hpp \ - ../include/mapnik/svg/svg_path_grammar.hpp \ - ../include/mapnik/svg/svg_path_iterator.hpp \ - ../include/mapnik/svg/svg_path_parser.hpp \ - ../include/mapnik/svg/svg_points_grammar.hpp \ - ../include/mapnik/svg/svg_renderer.hpp \ - ../include/mapnik/svg/svg_storage.hpp \ - ../include/mapnik/svg/svg_transform_grammar.hpp \ - ../include/mapnik/text_placements/base.hpp \ - ../include/mapnik/text_placements/dummy.hpp \ - ../include/mapnik/text_placements/list.hpp \ - ../include/mapnik/text_placements/registry.hpp \ - ../include/mapnik/text_placements/simple.hpp \ - ../include/mapnik/util/container_adapter.hpp \ - ../include/mapnik/util/conversions.hpp \ - ../include/mapnik/util/dasharray_parser.hpp \ - ../include/mapnik/util/deepcopy.hpp \ - ../include/mapnik/util/geometry_svg_generator.hpp \ - ../include/mapnik/util/geometry_to_ds_type.hpp \ - ../include/mapnik/util/geometry_to_wkb.hpp \ - ../include/mapnik/util/geometry_to_wkt.hpp \ - ../include/mapnik/util/geometry_wkt_generator.hpp \ - ../include/mapnik/util/vertex_iterator.hpp \ - ../include/mapnik/wkt/wkt_factory.hpp \ - ../include/mapnik/wkt/wkt_grammar.hpp \ - ../include/mapnik/agg_helpers.hpp \ - ../include/mapnik/agg_pattern_source.hpp \ - ../include/mapnik/agg_rasterizer.hpp \ - ../include/mapnik/agg_renderer.hpp \ - ../include/mapnik/attribute.hpp \ - ../include/mapnik/attribute_collector.hpp \ - ../include/mapnik/attribute_descriptor.hpp \ - ../include/mapnik/boolean.hpp \ - ../include/mapnik/box2d.hpp \ - ../include/mapnik/building_symbolizer.hpp \ - ../include/mapnik/cairo_renderer.hpp \ - ../include/mapnik/char_info.hpp \ - ../include/mapnik/color.hpp \ - ../include/mapnik/color_factory.hpp \ - ../include/mapnik/config.hpp \ - ../include/mapnik/config_error.hpp \ - ../include/mapnik/coord.hpp \ - ../include/mapnik/coord_array.hpp \ - ../include/mapnik/css_color_grammar.hpp \ - ../include/mapnik/ctrans.hpp \ - ../include/mapnik/debug.hpp \ - ../include/mapnik/datasource.hpp \ - ../include/mapnik/datasource_cache.hpp \ - ../include/mapnik/distance.hpp \ - ../include/mapnik/ellipsoid.hpp \ - ../include/mapnik/enumeration.hpp \ - ../include/mapnik/expression_evaluator.hpp \ - ../include/mapnik/expression_grammar.hpp \ - ../include/mapnik/expression_node.hpp \ - ../include/mapnik/expression_string.hpp \ - ../include/mapnik/factory.hpp \ - ../include/mapnik/fastmath.hpp \ - ../include/mapnik/feature.hpp \ - ../include/mapnik/feature_factory.hpp \ - ../include/mapnik/feature_kv_iterator.hpp \ - ../include/mapnik/feature_layer_desc.hpp \ - ../include/mapnik/feature_style_processor.hpp \ - ../include/mapnik/feature_type_style.hpp \ - ../include/mapnik/filter_factory.hpp \ - ../include/mapnik/filter_featureset.hpp \ - ../include/mapnik/font_engine_freetype.hpp \ - ../include/mapnik/font_set.hpp \ - ../include/mapnik/gamma_method.hpp \ - ../include/mapnik/geom_util.hpp \ - ../include/mapnik/geometry.hpp \ - ../include/mapnik/global.hpp \ - ../include/mapnik/gradient.hpp \ - ../include/mapnik/graphics.hpp \ - ../include/mapnik/hextree.hpp \ - ../include/mapnik/hit_test_filter.hpp \ - ../include/mapnik/image_compositing.hpp \ - ../include/mapnik/image_data.hpp \ - ../include/mapnik/image_reader.hpp \ - ../include/mapnik/image_util.hpp \ - ../include/mapnik/image_view.hpp \ - ../include/mapnik/jpeg_io.hpp \ - ../include/mapnik/label_collision_detector.hpp \ - ../include/mapnik/layer.hpp \ - ../include/mapnik/line_pattern_symbolizer.hpp \ - ../include/mapnik/line_symbolizer.hpp \ - ../include/mapnik/load_map.hpp \ - ../include/mapnik/map.hpp \ - ../include/mapnik/mapped_memory_cache.hpp \ - ../include/mapnik/marker.hpp \ - ../include/mapnik/marker_cache.hpp \ - ../include/mapnik/markers_placement.hpp \ - ../include/mapnik/markers_symbolizer.hpp \ - ../include/mapnik/memory.hpp \ - ../include/mapnik/memory_datasource.hpp \ - ../include/mapnik/memory_featureset.hpp \ - ../include/mapnik/octree.hpp \ - ../include/mapnik/palette.hpp \ - ../include/mapnik/params.hpp \ - ../include/mapnik/parse_path.hpp \ - ../include/mapnik/path_expression_grammar.hpp \ - ../include/mapnik/pixel_position.hpp \ - ../include/mapnik/placement_finder.hpp \ - ../include/mapnik/plugin.hpp \ - ../include/mapnik/png_io.hpp \ - ../include/mapnik/point_symbolizer.hpp \ - ../include/mapnik/polygon_pattern_symbolizer.hpp \ - ../include/mapnik/polygon_symbolizer.hpp \ - ../include/mapnik/pool.hpp \ - ../include/mapnik/processed_text.hpp \ - ../include/mapnik/proj_transform.hpp \ - ../include/mapnik/projection.hpp \ - ../include/mapnik/ptree_helpers.hpp \ - ../include/mapnik/quad_tree.hpp \ - ../include/mapnik/query.hpp \ - ../include/mapnik/raster.hpp \ - ../include/mapnik/raster_colorizer.hpp \ - ../include/mapnik/raster_symbolizer.hpp \ - ../include/mapnik/rule.hpp \ - ../include/mapnik/save_map.hpp \ - ../include/mapnik/scale_denominator.hpp \ - ../include/mapnik/segment.hpp \ - ../include/mapnik/shield_symbolizer.hpp \ - ../include/mapnik/sql_utils.hpp \ - ../include/mapnik/stroke.hpp \ - ../include/mapnik/svg_renderer.hpp \ - ../include/mapnik/symbolizer.hpp \ - ../include/mapnik/symbolizer_helpers.hpp \ - ../include/mapnik/text_path.hpp \ - ../include/mapnik/text_properties.hpp \ - ../include/mapnik/text_symbolizer.hpp \ - ../include/mapnik/tiff_io.hpp \ - ../include/mapnik/timer.hpp \ - ../include/mapnik/unicode.hpp \ - ../include/mapnik/utils.hpp \ - ../include/mapnik/value.hpp \ - ../include/mapnik/value_error.hpp \ - ../include/mapnik/version.hpp \ - ../include/mapnik/vertex.hpp \ - ../include/mapnik/vertex_vector.hpp \ - ../include/mapnik/warp.hpp \ - ../include/mapnik/wkb.hpp \ - ../include/mapnik/xml_loader.hpp \ - ../include/mapnik/xml_node.hpp \ - ../include/mapnik/xml_tree.hpp - - -SOURCES += \ - ../src/agg/agg_renderer.cpp \ - ../src/agg/process_building_symbolizer.cpp \ - ../src/agg/process_line_pattern_symbolizer.cpp \ - ../src/agg/process_line_symbolizer.cpp \ - ../src/agg/process_markers_symbolizer.cpp \ - ../src/agg/process_point_symbolizer.cpp \ - ../src/agg/process_polygon_pattern_symbolizer.cpp \ - ../src/agg/process_polygon_symbolizer.cpp \ - ../src/agg/process_raster_symbolizer.cpp \ - ../src/agg/process_shield_symbolizer.cpp \ - ../src/agg/process_text_symbolizer.cpp \ - ../src/formatting/base.cpp \ - ../src/formatting/expression.cpp \ - ../src/formatting/format.cpp \ - ../src/formatting/list.cpp \ - ../src/formatting/registry.cpp \ - ../src/formatting/text.cpp \ - ../src/grid/grid_renderer.cpp \ - ../src/grid/process_building_symbolizer.cpp \ - ../src/grid/process_line_pattern_symbolizer.cpp \ - ../src/grid/process_line_symbolizer.cpp \ - ../src/grid/process_markers_symbolizer.cpp \ - ../src/grid/process_point_symbolizer.cpp \ - ../src/grid/process_polygon_pattern_symbolizer.cpp \ - ../src/grid/process_polygon_symbolizer.cpp \ - ../src/grid/process_raster_symbolizer.cpp \ - ../src/grid/process_shield_symbolizer.cpp \ - ../src/grid/process_text_symbolizer.cpp \ - ../src/json/feature_collection_parser.cpp \ - ../src/json/geojson_generator.cpp \ - ../src/svg/process_building_symbolizer.cpp \ - ../src/svg/process_line_pattern_symbolizer.cpp \ - ../src/svg/process_line_symbolizer.cpp \ - ../src/svg/process_markers_symbolizer.cpp \ - ../src/svg/process_point_symbolizer.cpp \ - ../src/svg/process_polygon_pattern_symbolizer.cpp \ - ../src/svg/process_polygon_symbolizer.cpp \ - ../src/svg/process_raster_symbolizer.cpp \ - ../src/svg/process_shield_symbolizer.cpp \ - ../src/svg/process_symbolizers.cpp \ - ../src/svg/process_text_symbolizer.cpp \ - ../src/svg/svg_generator.cpp \ - ../src/svg/svg_output_attributes.cpp \ - ../src/svg/svg_renderer.cpp \ - ../src/text_placements/base.cpp \ - ../src/text_placements/dummy.cpp \ - ../src/text_placements/list.cpp \ - ../src/text_placements/registry.cpp \ - ../src/text_placements/simple.cpp \ - ../src/wkt/wkt_factory.cpp \ - ../src/arrow.cpp \ - ../src/box2d.cpp \ - ../src/building_symbolizer.cpp \ - ../src/cairo_renderer.cpp \ - ../src/color.cpp \ - ../src/config_error.cpp \ - ../src/conversions.cpp \ - ../src/datasource_cache.cpp \ - ../src/debug.cpp \ - ../src/deepcopy.cpp \ - ../src/distance.cpp \ - ../src/expression.cpp \ - ../src/expression_string.cpp \ - ../src/feature_kv_iterator.cpp \ - ../src/feature_style_processor.cpp \ - ../src/feature_type_style.cpp \ - ../src/font_engine_freetype.cpp \ - ../src/font_set.cpp \ - ../src/gamma_method.cpp \ - ../src/gradient.cpp \ - ../src/graphics.cpp \ - ../src/image_compositing.cpp \ - ../src/image_reader.cpp \ - ../src/image_util.cpp \ - ../src/jpeg_reader.cpp \ - ../src/layer.cpp \ - ../src/libxml2_loader.cpp \ - ../src/line_pattern_symbolizer.cpp \ - ../src/line_symbolizer.cpp \ - ../src/load_map.cpp \ - ../src/map.cpp \ - ../src/mapped_memory_cache.cpp \ - ../src/marker_cache.cpp \ - ../src/markers_placement.cpp \ - ../src/markers_symbolizer.cpp \ - ../src/memory.cpp \ - ../src/memory_datasource.cpp \ - ../src/palette.cpp \ - ../src/parse_path.cpp \ - ../src/placement_finder.cpp \ - ../src/plugin.cpp \ - ../src/png_reader.cpp \ - ../src/point_symbolizer.cpp \ - ../src/polygon_pattern_symbolizer.cpp \ - ../src/polygon_symbolizer.cpp \ - ../src/processed_text.cpp \ - ../src/proj_transform.cpp \ - ../src/projection.cpp \ - ../src/rapidxml_loader.cpp \ - ../src/raster_colorizer.cpp \ - ../src/save_map.cpp \ - ../src/scale_denominator.cpp \ - ../src/shield_symbolizer.cpp \ - ../src/stroke.cpp \ - ../src/svg_parser.cpp \ - ../src/svg_path_parser.cpp \ - ../src/svg_points_parser.cpp \ - ../src/svg_transform_parser.cpp \ - ../src/symbolizer.cpp \ - ../src/symbolizer_helpers.cpp \ - ../src/text_properties.cpp \ - ../src/text_symbolizer.cpp \ - ../src/tiff_reader.cpp \ - ../src/unicode.cpp \ - ../src/warp.cpp \ - ../src/wkb.cpp \ - ../src/xml_tree.cpp +include(All.files) OTHER_FILES += \ ../SConstruct \ ../config.py \ ../CHANGELOG.md -include(agg.pri) -include(plugins.pri) -include(bindings.pri) - unix { DEFINES += LINUX=1 MAPNIK_LOG=1 } diff -Nru mapnik-2.1.0/workspace/plugins.pri mapnik-2.2.0/workspace/plugins.pri --- mapnik-2.1.0/workspace/plugins.pri 2012-08-23 21:57:07.000000000 +0000 +++ mapnik-2.2.0/workspace/plugins.pri 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ - -HEADERS += \ - $$PWD/../plugins/input/csv/csv_datasource.hpp \ - $$PWD/../plugins/input/gdal/gdal_featureset.hpp \ - $$PWD/../plugins/input/gdal/gdal_datasource.hpp \ - $$PWD/../plugins/input/geos/geos_datasource.hpp \ - $$PWD/../plugins/input/geos/geos_featureset.hpp \ - $$PWD/../plugins/input/kismet/kismet_featureset.hpp \ - $$PWD/../plugins/input/kismet/kismet_datasource.hpp \ - $$PWD/../plugins/input/kismet/kismet_types.hpp \ - $$PWD/../plugins/input/occi/occi_featureset.hpp \ - $$PWD/../plugins/input/occi/occi_datasource.hpp \ - $$PWD/../plugins/input/occi/occi_types.hpp \ - $$PWD/../plugins/input/occi/spatial_classesh.h \ - $$PWD/../plugins/input/occi/spatial_classesm.h \ - $$PWD/../plugins/input/ogr/ogr_converter.hpp \ - $$PWD/../plugins/input/ogr/ogr_featureset.hpp \ - $$PWD/../plugins/input/ogr/ogr_datasource.hpp \ - $$PWD/../plugins/input/ogr/ogr_layer_ptr.hpp \ - $$PWD/../plugins/input/ogr/ogr_feature_ptr.hpp \ - $$PWD/../plugins/input/ogr/ogr_index.hpp \ - $$PWD/../plugins/input/ogr/ogr_index_featureset.hpp \ - $$PWD/../plugins/input/osm/basiccurl.h \ - $$PWD/../plugins/input/osm/dataset_deliverer.h \ - $$PWD/../plugins/input/osm/osm.h \ - $$PWD/../plugins/input/osm/osmparser.h \ - $$PWD/../plugins/input/osm/osmtagtypes.h \ - $$PWD/../plugins/input/osm/osm_featureset.hpp \ - $$PWD/../plugins/input/osm/osm_datasource.hpp \ - $$PWD/../plugins/input/postgis/connection.hpp \ - $$PWD/../plugins/input/postgis/connection_manager.hpp \ - $$PWD/../plugins/input/postgis/cursorresultset.hpp \ - $$PWD/../plugins/input/postgis/postgis_datasource.hpp \ - $$PWD/../plugins/input/postgis/postgis_featureset.hpp \ - $$PWD/../plugins/input/postgis/resultset.hpp \ - $$PWD/../plugins/input/raster/raster_info.hpp \ - $$PWD/../plugins/input/raster/raster_featureset.hpp \ - $$PWD/../plugins/input/raster/raster_datasource.hpp \ - $$PWD/../plugins/input/rasterlite/rasterlite_include.hpp \ - $$PWD/../plugins/input/rasterlite/rasterlite_featureset.hpp \ - $$PWD/../plugins/input/rasterlite/rasterlite_datasource.hpp \ - $$PWD/../plugins/input/shape/dbffile.hpp \ - $$PWD/../plugins/input/shape/shape.hpp \ - $$PWD/../plugins/input/shape/shape_datasource.hpp \ - $$PWD/../plugins/input/shape/shape_featureset.hpp \ - $$PWD/../plugins/input/shape/shapefile.hpp \ - $$PWD/../plugins/input/shape/shape_index_featureset.hpp \ - $$PWD/../plugins/input/shape/shape_io.hpp \ - $$PWD/../plugins/input/shape/shp_index.hpp \ - $$PWD/../plugins/input/sqlite/sqlite_connection.hpp \ - $$PWD/../plugins/input/sqlite/sqlite_featureset.hpp \ - $$PWD/../plugins/input/sqlite/sqlite_datasource.hpp \ - $$PWD/../plugins/input/sqlite/sqlite_types.hpp - -SOURCES += \ - $$PWD/../plugins/input/csv/csv_datasource.cpp \ - $$PWD/../plugins/input/gdal/gdal_featureset.cpp \ - $$PWD/../plugins/input/gdal/gdal_datasource.cpp \ - $$PWD/../plugins/input/geos/geos_datasource.cpp \ - $$PWD/../plugins/input/geos/geos_featureset.cpp \ - $$PWD/../plugins/input/kismet/kismet_featureset.cpp \ - $$PWD/../plugins/input/kismet/kismet_datasource.cpp \ - $$PWD/../plugins/input/occi/occi_featureset.cpp \ - $$PWD/../plugins/input/occi/occi_datasource.cpp \ - $$PWD/../plugins/input/occi/occi_types.cpp \ - $$PWD/../plugins/input/occi/spatial_classesm.cpp \ - $$PWD/../plugins/input/occi/spatial_classeso.cpp \ - $$PWD/../plugins/input/ogr/ogr_converter.cpp \ - $$PWD/../plugins/input/ogr/ogr_featureset.cpp \ - $$PWD/../plugins/input/ogr/ogr_datasource.cpp \ - $$PWD/../plugins/input/ogr/ogr_index_featureset.cpp \ - $$PWD/../plugins/input/osm/basiccurl.cpp \ - $$PWD/../plugins/input/osm/dataset_deliverer.cpp \ - $$PWD/../plugins/input/osm/osm.cpp \ - $$PWD/../plugins/input/osm/osmparser.cpp \ - $$PWD/../plugins/input/osm/osm_featureset.cpp \ - $$PWD/../plugins/input/osm/osm_datasource.cpp \ - $$PWD/../plugins/input/osm/render.cpp \ - $$PWD/../plugins/input/postgis/postgis_datasource.cpp \ - $$PWD/../plugins/input/postgis/postgis_featureset.cpp \ - $$PWD/../plugins/input/raster/raster_info.cpp \ - $$PWD/../plugins/input/raster/raster_featureset.cpp \ - $$PWD/../plugins/input/raster/raster_datasource.cpp \ - $$PWD/../plugins/input/rasterlite/rasterlite_featureset.cpp \ - $$PWD/../plugins/input/rasterlite/rasterlite_datasource.cpp \ - $$PWD/../plugins/input/shape/dbffile.cpp \ - $$PWD/../plugins/input/shape/shape.cpp \ - $$PWD/../plugins/input/shape/shape_datasource.cpp \ - $$PWD/../plugins/input/shape/shape_featureset.cpp \ - $$PWD/../plugins/input/shape/shape_index_featureset.cpp \ - $$PWD/../plugins/input/shape/shape_io.cpp \ - $$PWD/../plugins/input/sqlite/sqlite_featureset.cpp \ - $$PWD/../plugins/input/sqlite/sqlite_datasource.cpp