+2010-11-13 Andrew M. Bishop <amb@gedanken.demon.co.uk>
+
+ Version 1.5.1 released
+
+2010-11-13 Andrew M. Bishop <amb@gedanken.demon.co.uk>
+
+ * doc/NEWS.txt, doc/README.txt: Updated for version 1.5.1.
+
+ * doc/USAGE.txt: Update program usage for new logging option.
+
+ * xml/routino-translations.xml:
+ Add translation for ferry into German (patch from Michael Günnewig).
+
+ * src/relationsx.c: Fix bug with relation processing.
+
+ * src/logging.h: Add GCC attributes for the logging functions.
+
+ * src/logging.h, src/logging.c: New file.
+
+ * src/Makefile, src/nodesx.c, src/optimiser.c, src/osmparser.c, src/planetsplitter.c,
+ src/relationsx.c, src/router.c, src/segmentsx.c, src/superx.c, src/tagmodifier.c,
+ src/waysx.c:
+ Add an option to make the output more suitable for a log file.
+
+2010-10-31 Andrew M. Bishop <amb@gedanken.demon.co.uk>
+
+ * src/files.c:
+ Ensure that enough memory gets allocated in FileName() function.
+
2010-10-30 Andrew M. Bishop <amb@gedanken.demon.co.uk>
Version 1.5 released
+Version 1.5.1 of Routino released : Sat Nov 13 2010
+---------------------------------------------------
+
+Bug fixes:
+ Ensure that enough memory is allocated for filenames.
+ Fix bug that sometimes causes crash when processing route relations.
+
+Documentation:
+ Update documentation to reflect changes in program usage and function.
+
+Programs:
+ Add an option to make the output more suitable for a log file.
+
+Documentation:
+ Update documentation to reflect changes in program usage.
+
+
Version 1.5 of Routino released : Sat Oct 30 2010
-------------------------------------------------
Version 1.4 of Routino was released on 31st May 2010.
Version 1.4.1 of Routino was released on 10th July 2010.
Version 1.5 of Routino was released on 30th October 2010.
+ Version 1.5.1 of Routino was released on 13th November 2010.
The full version history is available in the NEWS.txt file.
[--sort-ram-size=<size>]
[--tmpdir=<dirname>]
[--parse-only | --process-only]
+ [--loggable]
[--max-iterations=<number>]
[--tagging=<filename>]
[<filename.osm> ...]
Don't read in any files but process the existing temporary file
into the routing database.
+ --loggable
+ Print progress messages that are suitable for logging to a file;
+ normally an incrementing counter is printed which is more
+ suitable for realtime display than logging.
+
--max-iterations=<number>
The maximum number of iterations to use when generating
super-nodes and super-segments. Defaults to 10 which is normally
[--dir=<dirname>] [--prefix=<name>]
[--profiles=<filename>] [--translations=<filename>]
[--exact-nodes-only]
- [--quiet]
+ [--loggable | --quiet]
[--output-html]
[--output-gpx-track] [--output-gpx-route]
[--output-text] [--output-text-all]
within a segment (quicker but less accurate unless the points
are already near nodes).
+ --loggable
+ Print progress messages that are suitable for logging to a file;
+ normally an incrementing counter is printed which is more
+ suitable for realtime display than logging.
+
--quiet
Don't generate any screen output while running (useful for
running in a script).
XML file for test purposes.
Usage: tagmodifier [--help]
+ [--loggable]
[--tagging=<filename>]
[<filename.osm>]
--help
Prints out the help information.
+ --loggable
+ Print progress messages that are suitable for logging to a file;
+ normally an incrementing counter is printed which is more
+ suitable for realtime display than logging.
+
--tagging=<filename>
The name of the XML file containing the tagging rules (defaults
to 'tagging.xml' in the current directory).
<property type="multilane" percent="25" />
<property type="bridge" percent="50" />
<property type="tunnel" percent="50" />
- <property type="footroute" percent="55" />
- <property type="bicycleroute" percent="55" />
+...
</properties>
<restrictions>
<oneway obey="0" />
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML>
+
+<!--
+ Routino documentation - algorithm
+
+ Part of the Routino routing software.
+
+ This file Copyright 2008-2010 Andrew M. Bishop
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see http://www.gnu.org/licenses/.
+-->
+
+<HEAD>
+<TITLE>Routino : Software</TITLE>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<LINK href="style.css" type="text/css" rel="stylesheet">
+</HEAD>
+
+<BODY>
+
+<!-- Header Start -->
+
+<div class="header" align="center">
+
+<h1>Routino : Software</h1>
+
+<hr>
+</div>
+
+<!-- Header End -->
+
+<!-- Content Start -->
+
+<div class="content">
+
+<h2><a name="H_1_1" title="Introduction"></a>Routino Introduction</h2>
+
+Routino is an application for finding a route between two points using the
+dataset of topographical information collected by
+<a class="ext" title="OpenStreetMap" href="http://www.openstreetmap.org/">http://www.OpenStreetMap.org</a>.
+
+<p>
+
+Starting from the raw OpenStreetMap data (in the form of the '.osm' XML files
+available on the internet) a custom database is generated that contains the
+information useful for routing. With this database and two points specified by
+latitude and longitude an optimum route (either shortest or quickest) is
+determined. The route is calculated for OpenStreetMap highways (roads, paths
+etc) using one of the common forms of transport defined in OpenStreetMap (foot,
+bicycle, horse, motorcar, motorbike etc).
+
+<p>
+
+When processing the OpenStreetMap data the types of highways are recorded and
+these set default limits on the types of traffic allowed. More specific
+information about permissions for different types of transport are also recorded
+as are maximum speed limits. Further restrictions like oneway streets, weight,
+height, width and length limits are also included where specified. Additionally
+a set of properties of each highway are also recorded. The processing of the
+input file is controlled by a configuration file which determines the
+information that is used.
+
+<p>
+
+When calculating a route the type of transport to be used is taken into account
+to ensure that the known restrictions are followed. Each of the different
+highway types can further be allowed or disallowed depending on preferences.
+For each type of highway a default speed limit is defined (although the actual
+speed used will be the lowest of the default and any specified in the original
+data). To make use of the information about restrictions the weight, height,
+width and length of the transport can also be specified. Further preferences
+about road properties (e.g. paved or not) can also be selected.
+
+<p>
+
+The result of calculating the route can be presented in several different ways.
+An HTML file can be produced that contains a description of the route to take
+with instructions for each of the important junctions. The contents of the file
+are created based on a set of translations specified in a configuration file.
+The route is also available in a
+<a class="ext" title="GPX format" href="http://www.topografix.com/gpx.asp">GPX (GPS eXchange) XML format</a>.
+format file containing either every point and highway segment (a track file) or
+just a waypoint and translated instructions for the important junctions (a route
+file).
+Additionally there are two plain text files that contain all data points or just
+the important ones (intended for debugging and further processing).
+
+<p>
+
+One of the design aims of Routino was to make the software are flexible as
+possible in selecting routing preferences but also have a sensible set of
+default values. Another design aim was that finding the optimum route should be
+very fast and most of the speed increases come from the carefully chosen and
+optimised data format.
+
+
+<h2><a name="H_1_2"></a>Disclaimer</h2>
+
+The route that is calculated by this software is only as good as the input data.
+
+<p>
+
+Routino comes with ABSOLUTELY NO WARRANTY for the software itself or the route
+that is calculated by it.
+
+
+<h2><a name="H_1_3"></a>Demonstration</h2>
+
+A live demonstration of the router for the UK is available on the internet:
+<br>
+<a title="Routino demo" href="http://www.routino.org/uk/">http://www.routino.org/uk/</a>
+
+<p>
+
+The source code download available below also includes a set of files that can
+be used to create your own interactive map.
+
+<p>
+
+The interactive map is made possible by use of the OpenLayers Javascript
+library from <a class="ext" href="http://www.openlayers.org" title="OpenLayers">http://www.openlayers.org/</a>.
+
+
+<h2><a name="H_1_4"></a>Documentation</h2>
+
+A full set of
+<a href="index.html" title="Documentation">documentation</a>
+is available that describes how to install and use the programs as well as
+what should go in the configuration files and how it works.
+
+
+<h2><a name="H_1_5"></a>Status</h2>
+
+Version 1.0 of Routino was released on 8th April 2009.
+<br>
+Version 1.1 of Routino was released on 13th June 2009.
+<br>
+Version 1.2 of Routino was released on 21st October 2009.
+<br>
+Version 1.3 of Routino was released on 21st January 2010.
+<br>
+Version 1.4 of Routino was released on 31st May 2010.
+<br>
+Version 1.4.1 of Routino was released on 10th July 2010.
+<br>
+Version 1.5 of Routino was released on 30th October 2010.
+<br>
+Version 1.5.1 of Routino was released on 13th November 2010.
+
+<p>
+
+The full version history is available in the NEWS file.
+
+
+<h3><a name="H_1_5_1" title="Changes"></a>Changes in Version 1.5</h3>
+
+<dl>
+ <dt>Bug fixes:
+ <dd>Check that number of nodes/segments/ways doesn't exceed numerical limits.
+ <br>Allow 32-bit systems to seek within files larger than 4GB.
+ <br>Allow nearly 4G nodes to be stored instead of 2G before.
+ <br>Added rules to makefile for installation (paths specified in top-level).
+ <br>Stricter checking of UTF-8 in XML files and better UTF-8 output.
+ <br>Improve error message if parsing of command line options fail.
+ <br>Fix bugs in router's --help-profile-json and --help-profile-perl options.
+ <br>Rename heapsort function to allow compilation on Mac OS with no change.
+ <br>Reduce impact of property preferences close to 50% by using sqrt().
+
+ <dt>Documentation:
+ <dd>Update documentation to reflect changes in program usage and function.
+
+ <dt>OSM tagging
+ <dd>Traffic restrictions on nodes are now included in default tagging file.
+ <br>Added processing for ferry routes (as pseudo-highway type 'ferry').
+ <br>Process foot and bicycle route relations to create new properties.
+
+ <dt>Configuration Files:
+ <dd>Added Dutch output translations.
+ <br>Added ferry information to profiles.
+ <br>Added foot and bicycle route relation processing.
+
+ <dt>planetsplitter
+ <dd>The slim mode now includes the output data as well as the temporary data.
+ <br>The slim mode is now a separate executable and not a command line option.
+ <br>Traffic restrictions on nodes are now understood when parsing OSM files.
+ <br>Falls back to installed tagging.xml configuration file as last resort.
+
+ <dt>router:
+ <dd>Added a slim mode (as a separate executable and not a command line option).
+ <br>Traffic will not be routed through a node that does not allow it.
+ <br>Falls back to installed profiles.xml & translations.xml files as last resort.
+
+ <dt>filedumper:
+ <dd>Added a slim mode (as a separate executable and not a command line option).
+
+ <dt>Web pages:
+ <dd>Added Dutch translation of router.html.
+</dl>
+
+<h3><a name="H_1_5_2"></a>Additional Changes in Version 1.5.1</h3>
+
+<dl>
+ <dt>Bug fixes:
+ <dd>Ensure that enough memory is allocated for filenames.
+ <br>Fix bug that sometimes causes crash when processing route relations.
+
+ <dt>Documentation:
+ <dd>Update documentation to reflect changes in program usage and function.
+
+ <dt>Programs:
+ <dd>Add an option to make the output more suitable for a log file.
+
+ <dt>Documentation:
+ <dd>Update documentation to reflect changes in program usage.
+</dl>
+
+
+<h3><a name="H_1_5_3"></a>License</h3>
+
+This program is free software: you can redistribute it and/or modify it under
+the terms of the
+<a class="ext" title="Affero GPLv3" href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">GNU Affero General Public License</a>
+as published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+<p>
+
+It is important to note that for this program I have decided to use the
+<em>Affero GPLv3</em> instead of just using the GPL. This license adds
+additional requirements to anybody who provides a networked service using this
+software.
+
+
+<h3><a name="H_1_5_4"></a>Copyright</h3>
+
+Routino is copyright Andrew M. Bishop 2008-2010.
+
+
+<h2><a name="H_1_6"></a>Download</h2>
+
+The <a title="Download directory" href="http://www.routino.org/download/">download directory</a>
+contains the latest version of the source code.
+
+
+</div>
+
+<!-- Content End -->
+
+<!-- Footer Start -->
+
+<div class="footer" align="center">
+<hr>
+
+<address>
+© Andrew M. Bishop = <amb "at" gedanken.demon.co.uk>
+</address>
+
+</div>
+
+<!-- Footer End -->
+
+</BODY>
+
+</HTML>
[--sort-ram-size=<size>]
[--tmpdir=<dirname>]
[--parse-only | --process-only]
+ [--loggable]
[--max-iterations=<number>]
[--tagging=<filename>]
[<filename.osm> ...]
<dt>--process-only
<dd>Don't read in any files but process the existing temporary file into the
routing database.
+ <dt>--loggable
+ <dd>Print progress messages that are suitable for logging to a file; normally
+ an incrementing counter is printed which is more suitable for realtime
+ display than logging.
<dt>--max-iterations=<number>
<dd>The maximum number of iterations to use when generating super-nodes and
super-segments. Defaults to 10 which is normally enough.
[--dir=<dirname>] [--prefix=<name>]
[--profiles=<filename>] [--translations=<filename>]
[--exact-nodes-only]
- [--quiet]
+ [--loggable | --quiet]
[--output-html]
[--output-gpx-track] [--output-gpx-route]
[--output-text] [--output-text-all]
<dd>When processing the specified latitude and longitude points only select
the nearest node instead of finding the nearest point within a segment
(quicker but less accurate unless the points are already near nodes).
+ <dt>--loggable
+ <dd>Print progress messages that are suitable for logging to a file; normally
+ an incrementing counter is printed which is more suitable for realtime
+ display than logging.
<dt>--quiet
<dd>Don't generate any screen output while running (useful for running in a script).
<dt>--language=<lang>
<li>cycleway = Cycleway
<li>path = Path
<li>steps = Steps
+ <li>ferry = Ferry
</ul>
Default value depends on the profile selected by the --transport option.
<dt>--speed-<highway>=<speed>
<pre class="boxed">
Usage: tagmodifier [--help]
+ [--loggable]
[--tagging=<filename>]
[<filename.osm>]
</pre>
<dl>
<dt>--help
<dd>Prints out the help information.
+ <dt>--loggable
+ <dd>Print progress messages that are suitable for logging to a file; normally
+ an incrementing counter is printed which is more suitable for realtime
+ display than logging.
<dt>--tagging=<filename>
<dd>The name of the XML file containing the tagging rules (defaults to
'tagging.xml' in the current directory).
-# $Header: /home/amb/routino/src/RCS/Makefile,v 1.42 2010/09/17 17:42:20 amb Exp $
+# $Header: /home/amb/routino/src/RCS/Makefile,v 1.43 2010/11/13 14:22:28 amb Exp $
#
# Source code Makefile
#
LDFLAGS=-lm -lc
CFLAGS+= -O3
-CFLAGS+= -O0 -g
+#CFLAGS+= -O0 -g
#CFLAGS+= -pg
#CFLAGS+= --coverage
PLANETSPLITTER_OBJ=planetsplitter.o \
nodesx.o segmentsx.o waysx.o relationsx.o superx.o \
ways.o types.o \
- files.o \
+ files.o logging.o \
results.o queue.o sorting.o \
xmlparse.o tagging.o osmparser.o
PLANETSPLITTER_SLIM_OBJ=planetsplitter-slim.o \
nodesx-slim.o segmentsx-slim.o waysx-slim.o relationsx-slim.o superx-slim.o \
ways.o types.o \
- files.o \
+ files.o logging.o \
results.o queue.o sorting.o \
xmlparse.o tagging.o osmparser.o
ROUTER_OBJ=router.o \
nodes.o segments.o ways.o types.o fakes.o \
optimiser.o output.o \
- files.o profiles.o xmlparse.o \
+ files.o logging.o profiles.o xmlparse.o \
results.o queue.o translations.o
router : $(ROUTER_OBJ)
ROUTER_SLIM_OBJ=router-slim.o \
nodes-slim.o segments-slim.o ways-slim.o types.o fakes.o \
optimiser-slim.o output-slim.o \
- files.o profiles.o xmlparse.o \
+ files.o logging.o profiles.o xmlparse.o \
results.o queue.o translations.o
router-slim : $(ROUTER_SLIM_OBJ)
FILEDUMPER_OBJ=filedumper.o \
nodes.o segments.o ways.o types.o \
visualiser.o \
- files.o xmlparse.o
+ files.o logging.o xmlparse.o
filedumper : $(FILEDUMPER_OBJ)
$(LD) $(FILEDUMPER_OBJ) -o $@ $(LDFLAGS)
FILEDUMPER_SLIM_OBJ=filedumper-slim.o \
nodes-slim.o segments-slim.o ways-slim.o types.o \
visualiser-slim.o \
- files.o xmlparse.o
+ files.o logging.o xmlparse.o
filedumper-slim : $(FILEDUMPER_SLIM_OBJ)
$(LD) $(FILEDUMPER_SLIM_OBJ) -o $@ $(LDFLAGS)
########
TAGMODIFIER_OBJ=tagmodifier.o \
- files.o \
+ files.o logging.o \
xmlparse.o tagging.o
tagmodifier : $(TAGMODIFIER_OBJ)
/***************************************
- $Header: /home/amb/routino/src/RCS/files.c,v 1.24 2010/10/16 10:59:18 amb Exp $
+ $Header: /home/amb/routino/src/RCS/files.c,v 1.25 2010/10/31 17:52:40 amb Exp $
Functions to handle files.
char *FileName(const char *dirname,const char *prefix, const char *name)
{
- char *filename=(char*)malloc((dirname?strlen(dirname):0)+1+(prefix?strlen(prefix):0)+1+strlen(name));
+ char *filename=(char*)malloc((dirname?strlen(dirname):0)+1+(prefix?strlen(prefix):0)+1+strlen(name)+1);
sprintf(filename,"%s%s%s%s%s",dirname?dirname:"",dirname?"/":"",prefix?prefix:"",prefix?"-":"",name);
--- /dev/null
+/***************************************
+ $Header: /home/amb/routino/src/RCS/logging.c,v 1.1 2010/11/13 14:22:40 amb Exp $
+
+ Functions to handle logging functions.
+
+ Part of the Routino routing software.
+ ******************/ /******************
+ This file Copyright 2008-2010 Andrew M. Bishop
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ ***************************************/
+
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "logging.h"
+
+
+/*+ The option to print the output in a way that allows logging to a file. +*/
+int option_loggable=0;
+
+
+/* Local functions */
+
+static void vfprintf_first(FILE *file,const char *format,va_list ap);
+static void vfprintf_middle(FILE *file,const char *format,va_list ap);
+static void vfprintf_last(FILE *file,const char *format,va_list ap);
+
+/* Local variables */
+
+static int printed_length=0;
+
+
+/*++++++++++++++++++++++++++++++++++++++
+ Print the first message in an overwriting sequence.
+
+ const char *format The format string.
+
+ ... The other arguments.
+ ++++++++++++++++++++++++++++++++++++++*/
+
+void printf_first(const char *format, ...)
+{
+ va_list ap;
+
+ if(option_loggable)
+ return;
+
+ va_start(ap,format);
+
+ vfprintf_first(stdout,format,ap);
+
+ va_end(ap);
+}
+
+
+/*++++++++++++++++++++++++++++++++++++++
+ Print the middle message in an overwriting sequence.
+
+ const char *format The format string.
+
+ ... The other arguments.
+ ++++++++++++++++++++++++++++++++++++++*/
+
+void printf_middle(const char *format, ...)
+{
+ va_list ap;
+
+ if(option_loggable)
+ return;
+
+ va_start(ap,format);
+
+ vfprintf_middle(stdout,format,ap);
+
+ va_end(ap);
+}
+
+
+/*++++++++++++++++++++++++++++++++++++++
+ Print the last message in an overwriting sequence.
+
+ const char *format The format string.
+
+ ... The other arguments.
+ ++++++++++++++++++++++++++++++++++++++*/
+
+void printf_last(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap,format);
+
+ vfprintf_last(stdout,format,ap);
+
+ va_end(ap);
+}
+
+
+/*++++++++++++++++++++++++++++++++++++++
+ Print the first message in an overwriting sequence.
+
+ FILE *file The file to write to.
+
+ const char *format The format string.
+
+ ... The other arguments.
+ ++++++++++++++++++++++++++++++++++++++*/
+
+void fprintf_first(FILE *file,const char *format, ...)
+{
+ va_list ap;
+
+ if(option_loggable)
+ return;
+
+ va_start(ap,format);
+
+ vfprintf_first(file,format,ap);
+
+ va_end(ap);
+}
+
+
+/*++++++++++++++++++++++++++++++++++++++
+ Print the middle message in an overwriting sequence.
+
+ FILE *file The file to write to.
+
+ const char *format The format string.
+
+ ... The other arguments.
+ ++++++++++++++++++++++++++++++++++++++*/
+
+void fprintf_middle(FILE *file,const char *format, ...)
+{
+ va_list ap;
+
+ if(option_loggable)
+ return;
+
+ va_start(ap,format);
+
+ vfprintf_middle(file,format,ap);
+
+ va_end(ap);
+}
+
+
+/*++++++++++++++++++++++++++++++++++++++
+ Print the last message in an overwriting sequence.
+
+ FILE *file The file to write to.
+
+ const char *format The format string.
+
+ ... The other arguments.
+ ++++++++++++++++++++++++++++++++++++++*/
+
+void fprintf_last(FILE *file,const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap,format);
+
+ vfprintf_last(file,format,ap);
+
+ va_end(ap);
+}
+
+
+/*++++++++++++++++++++++++++++++++++++++
+ Print the first message in an overwriting sequence.
+
+ FILE *file The file to write to.
+
+ const char *format The format string.
+
+ va_list ap The other arguments.
+ ++++++++++++++++++++++++++++++++++++++*/
+
+static void vfprintf_first(FILE *file,const char *format,va_list ap)
+{
+ int retval;
+
+ retval=vfprintf(file,format,ap);
+ fflush(file);
+
+ if(retval>0)
+ printed_length=retval;
+}
+
+
+/*++++++++++++++++++++++++++++++++++++++
+ Print the middle message in an overwriting sequence.
+
+ FILE *file The file to write to.
+
+ const char *format The format string.
+
+ va_list ap The other arguments.
+ ++++++++++++++++++++++++++++++++++++++*/
+
+static void vfprintf_middle(FILE *file,const char *format,va_list ap)
+{
+ int retval;
+
+ putchar('\r');
+ retval=vfprintf(file,format,ap);
+ fflush(file);
+
+ if(retval>0)
+ printed_length=retval;
+}
+
+
+/*++++++++++++++++++++++++++++++++++++++
+ Print the last message in an overwriting sequence.
+
+ FILE *file The file to write to.
+
+ const char *format The format string.
+
+ va_list ap The other arguments.
+ ++++++++++++++++++++++++++++++++++++++*/
+
+static void vfprintf_last(FILE *file,const char *format,va_list ap)
+{
+ int retval;
+
+ if(!option_loggable)
+ putchar('\r');
+ retval=vfprintf(file,format,ap);
+
+ if(retval>0)
+ while(retval++<printed_length)
+ putchar(' ');
+
+ putchar('\n');
+ fflush(file);
+}
--- /dev/null
+/***************************************
+ $Header: /home/amb/routino/src/RCS/logging.h,v 1.2 2010/11/13 14:50:33 amb Exp $
+
+ Header file for logging function prototypes
+
+ Part of the Routino routing software.
+ ******************/ /******************
+ This file Copyright 2008-2010 Andrew M. Bishop
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ ***************************************/
+
+
+#ifndef LOGGING_H
+#define LOGGING_H /*+ To stop multiple inclusions. +*/
+
+#include <stdio.h>
+
+
+/* Variables */
+
+extern int option_loggable;
+
+
+/* In logging.c */
+
+#ifdef __GNUC__
+
+void printf_first(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
+void printf_middle(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
+void printf_last(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
+
+void fprintf_first(FILE *file,const char *format, ...) __attribute__ ((format (printf, 2, 3)));
+void fprintf_middle(FILE *file,const char *format, ...) __attribute__ ((format (printf, 2, 3)));
+void fprintf_last(FILE *file,const char *format, ...) __attribute__ ((format (printf, 2, 3)));
+
+#else
+
+void printf_first(const char *format, ...);
+void printf_middle(const char *format, ...);
+void printf_last(const char *format, ...);
+
+void fprintf_first(FILE *file,const char *format, ...);
+void fprintf_middle(FILE *file,const char *format, ...);
+void fprintf_last(FILE *file,const char *format, ...);
+
+#endif
+
+
+#endif /* LOGGING_H */
/***************************************
- $Header: /home/amb/routino/src/RCS/nodesx.c,v 1.75 2010/10/09 14:14:42 amb Exp $
+ $Header: /home/amb/routino/src/RCS/nodesx.c,v 1.76 2010/11/13 14:22:28 amb Exp $
Extented Node data type functions.
#include "types.h"
#include "files.h"
+#include "logging.h"
#include "functions.h"
/* Print the start message */
- printf("Sorting Nodes");
- fflush(stdout);
+ printf_first("Sorting Nodes");
/* Close the files and re-open them (finished appending) */
/* Print the final message */
- printf("\rSorted Nodes: Nodes=%d Duplicates=%d\n",nodesx->xnumber,nodesx->xnumber-nodesx->number);
- fflush(stdout);
+ printf_last("Sorted Nodes: Nodes=%d Duplicates=%d",nodesx->xnumber,nodesx->xnumber-nodesx->number);
}
/* Print the start message */
- printf("Sorting Nodes Geographically");
- fflush(stdout);
+ printf_first("Sorting Nodes Geographically");
/* Allocate the memory for the geographical offsets array */
/* Print the final message */
- printf("\rSorted Nodes Geographically \n");
- fflush(stdout);
+ printf_last("Sorted Nodes Geographically");
}
/* Print the start message */
- printf("Checking: Nodes=0");
- fflush(stdout);
+ printf_first("Checking: Nodes=0");
/* While we are here we can work out the range of data */
total++;
if(!(total%10000))
- {
- printf("\rChecking: Nodes=%d Highway=%d not-Highway=%d",total,highway,nothighway);
- fflush(stdout);
- }
+ printf_middle("Checking: Nodes=%d Highway=%d not-Highway=%d",total,highway,nothighway);
}
/* Close the files and re-open them */
/* Print the final message */
- printf("\rChecked: Nodes=%d Highway=%d not-Highway=%d \n",total,highway,nothighway);
- fflush(stdout);
+ printf_last("Checked: Nodes=%d Highway=%d not-Highway=%d",total,highway,nothighway);
}
/* Print the start message */
- printf("Creating Real Nodes: Nodes=0");
- fflush(stdout);
+ printf_first("Creating Real Nodes: Nodes=0");
/* Map into memory */
#endif
if(!((i+1)%10000))
- {
- printf("\rCreating Real Nodes: Nodes=%d",i+1);
- fflush(stdout);
- }
+ printf_middle("Creating Real Nodes: Nodes=%d",i+1);
}
/* Free the unneeded memory */
/* Print the final message */
- printf("\rCreating Real Nodes: Nodes=%d \n",nodesx->number);
- fflush(stdout);
+ printf_last("Creating Real Nodes: Nodes=%d",nodesx->number);
}
/* Print the start message */
- printf("Indexing Segments: Segments=0");
- fflush(stdout);
+ printf_first("Indexing Segments: Segments=0");
/* Map into memory */
}
if(!((i+1)%10000))
- {
- printf("\rIndexing Segments: Segments=%d",i+1);
- fflush(stdout);
- }
+ printf_middle("Indexing Segments: Segments=%d",i+1);
}
/* Unmap from memory */
/* Print the final message */
- printf("\rIndexed Segments: Segments=%d \n",segmentsx->number);
- fflush(stdout);
+ printf_last("Indexed Segments: Segments=%d ",segmentsx->number);
}
/* Print the start message */
- printf("Writing Nodes: Nodes=0");
- fflush(stdout);
+ printf_first("Writing Nodes: Nodes=0");
/* Map into memory */
WriteFile(fd,node,sizeof(Node));
if(!((i+1)%10000))
- {
- printf("\rWriting Nodes: Nodes=%d",i+1);
- fflush(stdout);
- }
+ printf_middle("Writing Nodes: Nodes=%d",i+1);
}
/* Write out the header structure */
/* Print the final message */
- printf("\rWrote Nodes: Nodes=%d \n",nodesx->number);
- fflush(stdout);
+ printf_last("Wrote Nodes: Nodes=%d",nodesx->number);
}
/***************************************
- $Header: /home/amb/routino/src/RCS/optimiser.c,v 1.93 2010/08/04 16:44:51 amb Exp $
+ $Header: /home/amb/routino/src/RCS/optimiser.c,v 1.94 2010/11/13 14:22:28 amb Exp $
Routing optimiser.
#include "segments.h"
#include "ways.h"
+#include "logging.h"
#include "functions.h"
#include "results.h"
Way *way;
if(!option_quiet)
- {
- printf("Routing: Super-Nodes checked = 0");
- fflush(stdout);
- }
+ printf_first("Routing: Super-Nodes checked = 0");
/* Set up the finish conditions */
endloop:
if(!option_quiet && !(results->number%10000))
- {
- printf("\rRouting: Super-Nodes checked = %d",results->number);
- fflush(stdout);
- }
+ printf_middle("Routing: Super-Nodes checked = %d",results->number);
segment=NextSegment(segments,segment,node1);
}
}
if(!option_quiet)
- {
- printf("\rRouting: Super-Nodes checked = %d\n",results->number);
- fflush(stdout);
- }
+ printf_last("Routing: Super-Nodes checked = %d",results->number);
/* Finish off the end part of the route. */
/***************************************
- $Header: /home/amb/routino/src/RCS/osmparser.c,v 1.72 2010/09/25 18:47:32 amb Exp $
+ $Header: /home/amb/routino/src/RCS/osmparser.c,v 1.73 2010/11/13 14:22:28 amb Exp $
OSM XML file parser (either JOSM or planet)
#include "xmlparse.h"
#include "tagging.h"
+#include "logging.h"
+
/* Macros */
nnodes++;
if(!(nnodes%1000))
- {
- printf("\rReading: Lines=%ld Nodes=%ld Ways=%ld Relations=%ld",ParseXML_LineNumber(),nnodes,nways,nrelations);
- fflush(stdout);
- }
+ printf_middle("Reading: Lines=%ld Nodes=%ld Ways=%ld Relations=%ld",ParseXML_LineNumber(),nnodes,nways,nrelations);
current_tags=NewTagList();
nways++;
if(!(nways%1000))
- {
- printf("\rReading: Lines=%ld Nodes=%ld Ways=%ld Relations=%ld",ParseXML_LineNumber(),nnodes,nways,nrelations);
- fflush(stdout);
- }
+ printf_middle("Reading: Lines=%ld Nodes=%ld Ways=%ld Relations=%ld",ParseXML_LineNumber(),nnodes,nways,nrelations);
current_tags=NewTagList();
nrelations++;
if(!(nrelations%1000))
- {
- printf("\rReading: Lines=%ld Nodes=%ld Ways=%ld Relations=%ld",ParseXML_LineNumber(),nnodes,nways,nrelations);
- fflush(stdout);
- }
+ printf_middle("Reading: Lines=%ld Nodes=%ld Ways=%ld Relations=%ld",ParseXML_LineNumber(),nnodes,nways,nrelations);
current_tags=NewTagList();
nnodes=0,nways=0,nrelations=0;
- printf("\rReading: Lines=0 Nodes=0 Ways=0 Relations=0");
- fflush(stdout);
+ printf_first("Reading: Lines=0 Nodes=0 Ways=0 Relations=0");
retval=ParseXML(file,xml_toplevel_tags,XMLPARSE_UNKNOWN_ATTR_IGNORE);
- printf("\rRead: Lines=%ld Nodes=%ld Ways=%ld Relations=%ld \n",ParseXML_LineNumber(),nnodes,nways,nrelations);
- fflush(stdout);
+ printf_last("Read: Lines=%ld Nodes=%ld Ways=%ld Relations=%ld",ParseXML_LineNumber(),nnodes,nways,nrelations);
return(retval);
}
/***************************************
- $Header: /home/amb/routino/src/RCS/planetsplitter.c,v 1.81 2010/09/17 18:38:39 amb Exp $
+ $Header: /home/amb/routino/src/RCS/planetsplitter.c,v 1.82 2010/11/13 14:22:28 amb Exp $
OSM planet file splitter.
#include "superx.h"
#include "files.h"
+#include "logging.h"
#include "functions.h"
#include "functionsx.h"
#include "tagging.h"
option_parse_only=1;
else if(!strcmp(argv[arg],"--process-only"))
option_process_only=1;
+ else if(!strcmp(argv[arg],"--loggable"))
+ option_loggable=1;
else if(!strncmp(argv[arg],"--max-iterations=",17))
max_iterations=atoi(&argv[arg][17]);
else if(!strncmp(argv[arg],"--tagging=",10))
" [--sort-ram-size=<size>]\n"
" [--tmpdir=<dirname>]\n"
" [--parse-only | --process-only]\n"
+ " [--loggable]\n"
" [--max-iterations=<number>]\n"
" [--tagging=<filename>]\n"
" [<filename.osm> ...]\n");
"--parse-only Parse the input OSM files and store the results.\n"
"--process-only Process the stored results from previous option.\n"
"\n"
+ "--loggable Print progress messages suitable for logging to file.\n"
+ "\n"
"--max-iterations=<number> The number of iterations for finding super-nodes.\n"
"\n"
"--tagging=<filename> The name of the XML file containing the tagging rules\n"
/***************************************
- $Header: /home/amb/routino/src/RCS/relationsx.c,v 1.8 2010/10/09 18:20:18 amb Exp $
+ $Header: /home/amb/routino/src/RCS/relationsx.c,v 1.10 2010/11/13 14:57:30 amb Exp $
Extended Relation data type functions.
#include "relationsx.h"
#include "files.h"
+#include "logging.h"
#include "functions.h"
{
RouteRelX *unmatched=NULL,*lastunmatched=NULL;
int nunmatched=0,lastnunmatched=0,iteration=0;
- int i,j;
if(waysx->number==0)
return;
do
{
+ int ways=0,relations=0;
+ int i;
+
SeekFile(relationsx->rfd,0);
/* Print the start message */
- printf("Processing Route Relations: Iteration=%d Relations=0",iteration);
- fflush(stdout);
+ printf_first("Processing Route Relations: Iteration=%d Relations=0 Modified Ways=0",iteration);
for(i=0;i<relationsx->rxnumber;i++)
{
/* Decide what type of route it is */
if(iteration==0)
+ {
+ relations++;
routes=relationx.routes;
+ }
else
{
- if((lastunmatched[j].routes|relationx.routes)==relationx.routes)
- routes=0; /* Nothing new to add */
- else
- for(j=0;j<lastnunmatched;j++)
- if(lastunmatched[j].id==relationx.id)
- {
+ int j;
+
+ for(j=0;j<lastnunmatched;j++)
+ if(lastunmatched[j].id==relationx.id)
+ {
+ relations++;
+
+ if((lastunmatched[j].routes|relationx.routes)==relationx.routes)
+ routes=0; /* Nothing new to add */
+ else
routes=lastunmatched[j].routes;
- break;
- }
+ break;
+ }
}
/* Loop through the ways */
#if SLIM
PutBackWayX(waysx,way,1);
#endif
+
+ ways++;
}
}
}
while(relationid);
if(!((i+1)%10000))
- {
- printf("\rProcessing Route Relations: Iteration=%d Relations=%d",iteration,i+1);
- fflush(stdout);
- }
+ printf_middle("Processing Route Relations: Iteration=%d Relations=%d Modified Ways=%d",iteration,relations,ways);
}
if(lastunmatched)
/* Print the final message */
- printf("\rProcessed Route Relations: Iteration=%d Relations=%d \n",iteration,relationsx->rxnumber);
- fflush(stdout);
+ printf_last("Processed Route Relations: Iteration=%d Relations=%d Modified Ways=%d",iteration,relations,ways);
}
while(lastnunmatched && ++iteration<5);
/***************************************
- $Header: /home/amb/routino/src/RCS/router.c,v 1.89 2010/09/15 18:19:36 amb Exp $
+ $Header: /home/amb/routino/src/RCS/router.c,v 1.90 2010/11/13 14:22:28 amb Exp $
OSM router.
#include "ways.h"
#include "files.h"
+#include "logging.h"
#include "functions.h"
#include "translations.h"
#include "profiles.h"
exactnodes=1;
else if(!strcmp(argv[arg],"--quiet"))
option_quiet=1;
+ else if(!strcmp(argv[arg],"--loggable"))
+ option_loggable=1;
else if(!strcmp(argv[arg],"--output-html"))
option_html=1;
else if(!strcmp(argv[arg],"--output-gpx-track"))
if(!option_quiet)
{
- printf("\rRouted: Super-Nodes Checked = %d\n",begin->number);
+ printf("Routed: Super-Nodes Checked = %d\n",begin->number);
fflush(stdout);
}
}
" [--dir=<dirname>] [--prefix=<name>]\n"
" [--profiles=<filename>] [--translations=<filename>]\n"
" [--exact-nodes-only]\n"
- " [--quiet]\n"
+ " [--loggable | --quiet]\n"
" [--language=<lang>]\n"
" [--output-html]\n"
" [--output-gpx-track] [--output-gpx-route]\n"
"\n"
"--exact-nodes-only Only route between nodes (don't find closest segment).\n"
"\n"
+ "--loggable Print progress messages suitable for logging to file.\n"
"--quiet Don't print any screen output when running.\n"
+ "\n"
"--language=<lang> Use the translations for specified language.\n"
"--output-html Write an HTML description of the route.\n"
"--output-gpx-track Write a GPX track file with all route points.\n"
/***************************************
- $Header: /home/amb/routino/src/RCS/segmentsx.c,v 1.68 2010/10/09 14:14:42 amb Exp $
+ $Header: /home/amb/routino/src/RCS/segmentsx.c,v 1.69 2010/11/13 14:22:28 amb Exp $
Extended Segment data type functions.
#include "types.h"
#include "files.h"
+#include "logging.h"
#include "functions.h"
/* Print the start message */
- printf("Sorting Segments");
- fflush(stdout);
+ printf_first("Sorting Segments");
/* Close the files and re-open them (finished appending) */
/* Print the final message */
- printf("\rSorted Segments: Segments=%d\n",segmentsx->xnumber);
- fflush(stdout);
+ printf_last("Sorted Segments: Segments=%d",segmentsx->xnumber);
}
/* Print the start message */
- printf("Checking: Segments=0 Duplicate=0 Loop=0 Missing-Node=0");
- fflush(stdout);
+ printf_first("Checking: Segments=0 Duplicate=0 Loop=0 Missing-Node=0");
/* Allocate the array of indexes */
total++;
if(!(total%10000))
- {
- printf("\rChecking: Segments=%d Duplicate=%d Loop=%d Missing-Node=%d",total,duplicate,loop,missing);
- fflush(stdout);
- }
+ printf_middle("Checking: Segments=%d Duplicate=%d Loop=%d Missing-Node=%d",total,duplicate,loop,missing);
}
/* Close the files and re-open them */
/* Print the final message */
- printf("\rChecked: Segments=%d Duplicate=%d Loop=%d Missing-Node=%d \n",total,duplicate,loop,missing);
- fflush(stdout);
+ printf_last("Checked: Segments=%d Duplicate=%d Loop=%d Missing-Node=%d",total,duplicate,loop,missing);
}
/* Print the start message */
- printf("Measuring Segments: Segments=0");
- fflush(stdout);
+ printf_first("Measuring Segments: Segments=0");
/* Map into memory */
index++;
if(!(index%10000))
- {
- printf("\rMeasuring Segments: Segments=%d",index);
- fflush(stdout);
- }
+ printf_middle("Measuring Segments: Segments=%d",index);
}
/* Close the files and re-open them */
/* Print the final message */
- printf("\rMeasured Segments: Segments=%d \n",segmentsx->number);
- fflush(stdout);
+ printf_last("Measured Segments: Segments=%d",segmentsx->number);
}
/* Print the start message */
- printf("Rotating Segments: Segments=0 Rotated=0");
- fflush(stdout);
+ printf_first("Rotating Segments: Segments=0 Rotated=0");
/* Close the files and re-open them (finished appending) */
index++;
if(!(index%10000))
- {
- printf("\rRotating Segments: Segments=%d Rotated=%d",index,rotated);
- fflush(stdout);
- }
+ printf_middle("Rotating Segments: Segments=%d Rotated=%d",index,rotated);
}
/* Close the files and re-open them */
/* Print the final message */
- printf("\rRotated Segments: Segments=%d Rotated=%d \n",index,rotated);
- fflush(stdout);
+ printf_last("Rotated Segments: Segments=%d Rotated=%d",index,rotated);
}
/* Print the start message */
- printf("Deduplicating Segments: Segments=0 Duplicate=0");
- fflush(stdout);
+ printf_first("Deduplicating Segments: Segments=0 Duplicate=0");
/* Map into memory */
index++;
if(!(index%10000))
- {
- printf("\rDeduplicating Segments: Segments=%d Duplicate=%d",index,duplicate);
- fflush(stdout);
- }
+ printf_middle("Deduplicating Segments: Segments=%d Duplicate=%d",index,duplicate);
}
/* Close the files and re-open them */
/* Print the final message */
- printf("\rDeduplicated Segments: Segments=%d Duplicate=%d Unique=%d\n",index,duplicate,index-duplicate);
- fflush(stdout);
+ printf_last("Deduplicated Segments: Segments=%d Duplicate=%d Unique=%d",index,duplicate,index-duplicate);
}
/* Print the start message */
- printf("Creating Real Segments: Segments=0");
- fflush(stdout);
+ printf_first("Creating Real Segments: Segments=0");
/* Map into memory */
#endif
if(!((i+1)%10000))
- {
- printf("\rCreating Real Segments: Segments=%d",i+1);
- fflush(stdout);
- }
+ printf_middle("Creating Real Segments: Segments=%d",i+1);
}
/* Unmap from memory */
/* Print the final message */
- printf("\rCreating Real Segments: Segments=%d \n",segmentsx->number);
- fflush(stdout);
+ printf_last("Creating Real Segments: Segments=%d",segmentsx->number);
}
/* Print the start message */
- printf("Indexing Nodes: Nodes=0");
- fflush(stdout);
+ printf_first("Indexing Nodes: Nodes=0");
/* Map into memory */
while(1);
if(!((i+1)%10000))
- {
- printf("\rIndexing Nodes: Nodes=%d",i+1);
- fflush(stdout);
- }
+ printf_middle("Indexing Nodes: Nodes=%d",i+1);
}
/* Unmap from memory */
/* Print the final message */
- printf("\rIndexed Nodes: Nodes=%d \n",nodesx->number);
- fflush(stdout);
+ printf_last("Indexed Nodes: Nodes=%d",nodesx->number);
}
/* Print the start message */
- printf("Writing Segments: Segments=0");
- fflush(stdout);
+ printf_first("Writing Segments: Segments=0");
/* Write out the segments data */
WriteFile(fd,segment,sizeof(Segment));
if(!((i+1)%10000))
- {
- printf("\rWriting Segments: Segments=%d",i+1);
- fflush(stdout);
- }
+ printf_middle("Writing Segments: Segments=%d",i+1);
}
/* Write out the header structure */
/* Print the final message */
- printf("\rWrote Segments: Segments=%d \n",segmentsx->number);
- fflush(stdout);
+ printf_last("Wrote Segments: Segments=%d",segmentsx->number);
}
/***************************************
- $Header: /home/amb/routino/src/RCS/superx.c,v 1.44 2010/10/09 14:14:42 amb Exp $
+ $Header: /home/amb/routino/src/RCS/superx.c,v 1.45 2010/11/13 14:22:28 amb Exp $
Super-Segment data type functions.
#include "superx.h"
#include "files.h"
+#include "logging.h"
#include "results.h"
/* Print the start message */
- printf("Finding Super-Nodes: Nodes=0 Super-Nodes=0");
- fflush(stdout);
+ printf_first("Finding Super-Nodes: Nodes=0 Super-Nodes=0");
/* Map into memory */
}
if(!((i+1)%10000))
- {
- printf("\rFinding Super-Nodes: Nodes=%d Super-Nodes=%d",i+1,nnodes);
- fflush(stdout);
- }
+ printf_middle("Finding Super-Nodes: Nodes=%d Super-Nodes=%d",i+1,nnodes);
}
/* Unmap from memory */
/* Print the final message */
- printf("\rFound Super-Nodes: Nodes=%d Super-Nodes=%d \n",nodesx->number,nnodes);
- fflush(stdout);
+ printf_last("Found Super-Nodes: Nodes=%d Super-Nodes=%d",nodesx->number,nnodes);
}
/* Print the start message */
- printf("Creating Super-Segments: Super-Nodes=0 Super-Segments=0");
- fflush(stdout);
+ printf_first("Creating Super-Segments: Super-Nodes=0 Super-Segments=0");
/* Map into memory */
sn++;
if(!(sn%10000))
- {
- printf("\rCreating Super-Segments: Super-Nodes=%d Super-Segments=%d",sn,ss);
- fflush(stdout);
- }
+ printf_middle("Creating Super-Segments: Super-Nodes=%d Super-Segments=%d",sn,ss);
}
}
/* Print the final message */
- printf("\rCreated Super-Segments: Super-Nodes=%d Super-Segments=%d \n",sn,ss);
- fflush(stdout);
+ printf_last("Created Super-Segments: Super-Nodes=%d Super-Segments=%d",sn,ss);
return(supersegmentsx);
}
/* Print the start message */
- printf("Merging: Segments=0 Super-Segments=0 Merged=0 Added=0");
- fflush(stdout);
+ printf_first("Merging: Segments=0 Super-Segments=0 Merged=0 Added=0");
/* Map into memory */
AppendSegment(mergedsegmentsx,segmentx->way,segmentx->node1,segmentx->node2,segmentx->distance|SEGMENT_NORMAL);
if(!((i+1)%10000))
- {
- printf("\rMerging: Segments=%d Super-Segments=%d Merged=%d Added=%d",i+1,j,m,a);
- fflush(stdout);
- }
+ printf_middle("Merging: Segments=%d Super-Segments=%d Merged=%d Added=%d",i+1,j,m,a);
}
/* Unmap from memory */
/* Print the final message */
- printf("\rMerged: Segments=%d Super-Segments=%d Merged=%d Added=%d \n",segmentsx->number,supersegmentsx->number,m,a);
- fflush(stdout);
+ printf_last("Merged: Segments=%d Super-Segments=%d Merged=%d Added=%d",segmentsx->number,supersegmentsx->number,m,a);
return(mergedsegmentsx);
}
/***************************************
- $Header: /home/amb/routino/src/RCS/tagmodifier.c,v 1.7 2010/09/05 18:26:01 amb Exp $
+ $Header: /home/amb/routino/src/RCS/tagmodifier.c,v 1.8 2010/11/13 14:22:28 amb Exp $
Test application for OSM XML file parser / tagging rule testing.
#include <errno.h>
#include "files.h"
+#include "logging.h"
#include "xmlparse.h"
#include "tagging.h"
nnodes++;
if(!(nnodes%1000))
- fprintf(stderr,"\rReading: Lines=%ld Nodes=%ld Ways=%ld Relations=%ld",ParseXML_LineNumber(),nnodes,nways,nrelations);
+ fprintf_middle(stderr,"Reading: Lines=%ld Nodes=%ld Ways=%ld Relations=%ld",ParseXML_LineNumber(),nnodes,nways,nrelations);
current_tags=NewTagList();
}
nways++;
if(!(nways%1000))
- fprintf(stderr,"\rReading: Lines=%ld Nodes=%ld Ways=%ld Relations=%ld",ParseXML_LineNumber(),nnodes,nways,nrelations);
+ fprintf_middle(stderr,"Reading: Lines=%ld Nodes=%ld Ways=%ld Relations=%ld",ParseXML_LineNumber(),nnodes,nways,nrelations);
current_tags=NewTagList();
}
nrelations++;
if(!(nrelations%1000))
- fprintf(stderr,"\rReading: Lines=%ld Nodes=%ld Ways=%ld Relations=%ld",ParseXML_LineNumber(),nnodes,nways,nrelations);
+ fprintf_middle(stderr,"Reading: Lines=%ld Nodes=%ld Ways=%ld Relations=%ld",ParseXML_LineNumber(),nnodes,nways,nrelations);
current_tags=NewTagList();
}
{
if(!strcmp(argv[arg],"--help"))
print_usage(1);
+ else if(!strcmp(argv[arg],"--loggable"))
+ option_loggable=1;
else if(!strncmp(argv[arg],"--tagging=",10))
tagging=&argv[arg][10];
else if(argv[arg][0]=='-' && argv[arg][1]=='-')
/* Parse the file */
- fprintf(stderr,"\rReading: Lines=0 Nodes=0 Ways=0 Relations=0");
+ fprintf_first(stderr,"Reading: Lines=0 Nodes=0 Ways=0 Relations=0");
retval=ParseXML(file,xml_toplevel_tags,XMLPARSE_UNKNOWN_ATTR_IGNORE);
- fprintf(stderr,"\rRead: Lines=%ld Nodes=%ld Ways=%ld Relations=%ld \n",ParseXML_LineNumber(),nnodes,nways,nrelations);
+ fprintf_last(stderr,"Read: Lines=%ld Nodes=%ld Ways=%ld Relations=%ld",ParseXML_LineNumber(),nnodes,nways,nrelations);
/* Tidy up */
{
fprintf(stderr,
"Usage: tagmodifier [--help]\n"
+ " [--loggable]\n"
" [--tagging=<filename>]\n"
" [<filename.osm>]\n");
"\n"
"--help Prints this information.\n"
"\n"
+ "--loggable Print progress messages suitable for logging to file.\n"
+ "\n"
"--tagging=<filename> The name of the XML file containing the tagging rules\n"
" (defaults to 'tagging.xml' in current directory).\n"
"\n"
/***************************************
- $Header: /home/amb/routino/src/RCS/waysx.c,v 1.51 2010/09/19 16:17:45 amb Exp $
+ $Header: /home/amb/routino/src/RCS/waysx.c,v 1.52 2010/11/13 14:22:28 amb Exp $
Extended Way data type functions.
#include "waysx.h"
#include "files.h"
+#include "logging.h"
#include "functions.h"
/* Print the start message */
- printf("Sorting Ways by Name");
- fflush(stdout);
+ printf_first("Sorting Ways by Name");
/* Close the file and re-open it (finished appending) */
/* Print the final message */
- printf("\rSorted Ways by Name: Ways=%d\n",waysx->xnumber);
- fflush(stdout);
+ printf_last("Sorted Ways by Name: Ways=%d",waysx->xnumber);
/* Print the start message */
- printf("Separating Way Names: Ways=0 Names=0");
- fflush(stdout);
+ printf_first("Separating Way Names: Ways=0 Names=0");
/* Open the files */
WriteFile(fd,&wayx,sizeof(WayX));
if(!((i+1)%10000))
- {
- printf("\rSeparating Way Names: Ways=%d Names=%d",i+1,nnames);
- fflush(stdout);
- }
+ printf_middle("Separating Way Names: Ways=%d Names=%d",i+1,nnames);
}
if(names[0]) free(names[0]);
/* Print the final message */
- printf("\rSeparated Way Names: Ways=%d Names=%d \n",waysx->xnumber,nnames);
- fflush(stdout);
+ printf_last("Separated Way Names: Ways=%d Names=%d ",waysx->xnumber,nnames);
/* Print the start message */
- printf("Sorting Ways");
- fflush(stdout);
+ printf_first("Sorting Ways");
/* Open the files */
/* Print the final message */
- printf("\rSorted Ways: Ways=%d Duplicates=%d\n",waysx->number,waysx->xnumber-waysx->number);
- fflush(stdout);
+ printf_last("Sorted Ways: Ways=%d Duplicates=%d",waysx->number,waysx->xnumber-waysx->number);
}
/* Print the start message */
- printf("Sorting Ways by Properties");
- fflush(stdout);
+ printf_first("Sorting Ways by Properties");
/* Close the file and re-open it */
/* Print the final message */
- printf("\rSorted Ways by Properties: Ways=%d\n",waysx->number);
- fflush(stdout);
+ printf_last("Sorted Ways by Properties: Ways=%d",waysx->number);
/* Print the start message */
- printf("Compacting Ways: Ways=0 Properties=0");
- fflush(stdout);
+ printf_first("Compacting Ways: Ways=0 Properties=0");
/* Open the files */
WriteFile(fd,&wayx,sizeof(WayX));
if(!((i+1)%10000))
- {
- printf("\rCompacting Ways: Ways=%d Properties=%d",i+1,waysx->cnumber);
- fflush(stdout);
- }
+ printf_middle("Compacting Ways: Ways=%d Properties=%d",i+1,waysx->cnumber);
}
/* Close the files */
/* Print the final message */
- printf("\rCompacted Ways: Ways=%d Properties=%d \n",waysx->number,waysx->cnumber);
- fflush(stdout);
+ printf_last("Compacted Ways: Ways=%d Properties=%d ",waysx->number,waysx->cnumber);
/* Print the start message */
- printf("Sorting Ways");
- fflush(stdout);
+ printf_first("Sorting Ways");
/* Open the files */
/* Print the final message */
- printf("\rSorted Ways: Ways=%d\n",waysx->number);
- fflush(stdout);
+ printf_last("Sorted Ways: Ways=%d",waysx->number);
}
/* Print the start message */
- printf("Writing Ways: Ways=0");
- fflush(stdout);
+ printf_first("Writing Ways: Ways=0");
/* Map into memory */
WriteFile(fd,&wayx->way,sizeof(Way));
if(!((i+1)%10000))
- {
- printf("\rWriting Ways: Ways=%d",i+1);
- fflush(stdout);
- }
+ printf_middle("Writing Ways: Ways=%d",i+1);
}
/* Unmap from memory */
/* Print the final message */
- printf("\rWrote Ways: Ways=%d \n",waysx->number);
- fflush(stdout);
+ printf_last("Wrote Ways: Ways=%d",waysx->number);
}
<?xml version="1.0" encoding="utf-8"?>
<!-- ============================================================
- $Header: /home/amb/routino/xml/RCS/routino-translations.xml,v 1.10 2010/09/15 18:30:37 amb Exp $
+ $Header: /home/amb/routino/xml/RCS/routino-translations.xml,v 1.11 2010/11/13 14:59:55 amb Exp $
An XML format file containing Routino output translations.
<highway type="cycleway" string="Fietspad" />
<highway type="path" string="Pad" />
<highway type="steps" string="Trap" />
- <highway type="ferry" string="ferry" /> <!-- FIXME - needs translation -->
+ <highway type="ferry" string="Fähre" />
<!-- The type of route -->
<route type="shortest" string="Kortste" /> <!-- For the description and route name -->