You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(92) |
Dec
(141) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(126) |
Feb
(72) |
Mar
(31) |
Apr
(200) |
May
(81) |
Jun
(130) |
Jul
(112) |
Aug
(134) |
Sep
(76) |
Oct
(89) |
Nov
(153) |
Dec
(9) |
2007 |
Jan
(59) |
Feb
(82) |
Mar
(50) |
Apr
(20) |
May
(9) |
Jun
(81) |
Jul
(41) |
Aug
(109) |
Sep
(91) |
Oct
(87) |
Nov
(33) |
Dec
(60) |
2008 |
Jan
(21) |
Feb
(15) |
Mar
(38) |
Apr
(75) |
May
(59) |
Jun
(46) |
Jul
(30) |
Aug
(20) |
Sep
(35) |
Oct
(32) |
Nov
(34) |
Dec
(19) |
2009 |
Jan
(29) |
Feb
(71) |
Mar
(54) |
Apr
(17) |
May
(4) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(58) |
Sep
(7) |
Oct
(7) |
Nov
(12) |
Dec
(18) |
2011 |
Jan
(17) |
Feb
(29) |
Mar
(11) |
Apr
(5) |
May
(1) |
Jun
|
Jul
|
Aug
(11) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(87) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(44) |
Jun
(79) |
Jul
(16) |
Aug
(31) |
Sep
|
Oct
(51) |
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Pascal F M. <pas...@us...> - 2006-01-02 09:16:02
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13399 Modified Files: Makefile Log Message: Prepare for the new index file format Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/Makefile,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** Makefile 7 Dec 2005 18:57:35 -0000 1.70 --- Makefile 2 Jan 2006 09:15:53 -0000 1.71 *************** *** 107,114 **** --- 107,116 ---- roadmap_string.c \ roadmap_voice.c \ + roadmap_scan.c \ roadmap_list.c \ roadmap_config.c \ roadmap_option.c \ roadmap_metadata.c \ + roadmap_index.c \ roadmap_county.c \ roadmap_locator.c \ *************** *** 183,187 **** ! BMSRCS=buildmap_messages.c \ buildmap_dictionary.c \ buildmap_dbwrite.c \ --- 185,189 ---- ! BMLIBSRCS=buildmap_messages.c \ buildmap_dictionary.c \ buildmap_dbwrite.c \ *************** *** 201,205 **** buildmap_empty.c \ buildmap_place.c \ ! buildmap_main.c BMOBJS=$(BMSRCS:.c=.o) --- 203,211 ---- buildmap_empty.c \ buildmap_place.c \ ! buildmap_index.c \ ! ! BMLIBOBJS=$(BMLIBSRCS:.c=.o) ! ! BMSRCS=buildmap_main.c BMOBJS=$(BMSRCS:.c=.o) *************** *** 230,234 **** BUILD=buildmap buildus dumpmap buildplace SCRIPTS=rdmdownload rdmgetall rdmgenmaps rdmgendcwmaps rdmcompare ! RUNTIME=$(RDMLIBS) libguiroadgps.a libguiroadmap.a DRIVERS=rdmkismet rdmghost rdmfriends rdmtrace TOOLS=sunrise $(SQLTOOLS) --- 236,240 ---- BUILD=buildmap buildus dumpmap buildplace SCRIPTS=rdmdownload rdmgetall rdmgenmaps rdmgendcwmaps rdmcompare ! RUNTIME=rdmindex $(RDMLIBS) libguiroadgps.a libguiroadmap.a DRIVERS=rdmkismet rdmghost rdmfriends rdmtrace TOOLS=sunrise $(SQLTOOLS) *************** *** 237,244 **** # --- Conventional targets ---------------------------------------- ! .PHONY: all gtk gtk2 qt rebuild build everything \ clean strip install uninstall unix gpx ! all: everything gtk: --- 243,250 ---- # --- Conventional targets ---------------------------------------- ! .PHONY: all gtk gtk2 qt rebuild build \ clean strip install uninstall unix gpx ! all: runtime build $(TOOLS) icons gtk: *************** *** 251,257 **** $(MAKE) DESKTOP=QT ! rebuild: clean everything - everything: runtime build $(TOOLS) icons unix: --- 257,262 ---- $(MAKE) DESKTOP=QT ! rebuild: clean all unix: *************** *** 328,333 **** mkdir -p $(DESTDIR)$(pkgbindir) cd $(DESTDIR)$(pkgbindir) && rm -f $(BUILD) $(SCRIPTS) ! cp $(BUILD) $(SCRIPTS) $(DRIVERS) $(DESTDIR)$(pkgbindir)/. ! cd $(DESTDIR)$(pkgbindir) && chmod a+x $(BUILD) $(SCRIPTS) $(DRIVERS) mkdir -p $(DESTDIR)$(man1dir) $(INSTALL_DATA) roadgps.1 roadmap.1 $(DESTDIR)$(man1dir)/. --- 333,338 ---- mkdir -p $(DESTDIR)$(pkgbindir) cd $(DESTDIR)$(pkgbindir) && rm -f $(BUILD) $(SCRIPTS) ! cp $(BUILD) $(SCRIPTS) rdmindex $(DRIVERS) $(DESTDIR)$(pkgbindir)/. ! cd $(DESTDIR)$(pkgbindir) && chmod a+x $(BUILD) $(SCRIPTS) rdmindex $(DRIVERS) mkdir -p $(DESTDIR)$(man1dir) $(INSTALL_DATA) roadgps.1 roadmap.1 $(DESTDIR)$(man1dir)/. *************** *** 372,375 **** --- 377,398 ---- $(MAKE) -C icons STDCFLAGS="$(CFLAGS)" all + # --- The real targets -------------------------------------------- + + libbuildmap.a: $(BMLIBOBJS) + $(AR) $(ARFLAGS) libbuildmap.a $(BMLIBOBJS) + $(RANLIB) libbuildmap.a + + libroadmap.a: $(RMLIBOBJS) + $(AR) $(ARFLAGS) libroadmap.a $(RMLIBOBJS) + $(RANLIB) libroadmap.a + + libguiroadmap.a: $(RMGUIOBJS) $(RMPLUGINOBJS) + $(AR) $(ARFLAGS) libguiroadmap.a $(RMGUIOBJS) $(RMPLUGINOBJS) + $(RANLIB) libguiroadmap.a + + libguiroadgps.a: $(RGGUIOBJS) + $(AR) $(ARFLAGS) libguiroadgps.a $(RGGUIOBJS) + $(RANLIB) libguiroadgps.a + sunrise: roadmap_sunrise.c $(CC) -g -DSUNRISE_PROGRAM roadmap_sunrise.c -o sunrise -lm *************** *** 378,381 **** --- 401,407 ---- $(CC) -g sqliteload.c $(SQLCFLAGS) $(SQLLDFLAGS) -o sqliteload -lm + rdmindex : rdmindex_main.c libbuildmap.a $(RDMLIBS) + $(CC) -g rdmindex_main.c -o rdmindex libbuildmap.a $(RDMLIBS) $(LIBS) + rdmkismet: roadmap_kismet.c $(RDMLIBS) $(CC) -g roadmap_kismet.c -o rdmkismet $(RDMLIBS) $(RDMLIBS) -lm *************** *** 390,413 **** $(CC) -g roadmap_trace.c -o rdmtrace $(RDMLIBS) -lm - # --- The real targets -------------------------------------------- - - libroadmap.a: $(RMLIBOBJS) - $(AR) $(ARFLAGS) libroadmap.a $(RMLIBOBJS) - $(RANLIB) libroadmap.a - - libguiroadmap.a: $(RMGUIOBJS) $(RMPLUGINOBJS) - $(AR) $(ARFLAGS) libguiroadmap.a $(RMGUIOBJS) $(RMPLUGINOBJS) - $(RANLIB) libguiroadmap.a - - libguiroadgps.a: $(RGGUIOBJS) - $(AR) $(ARFLAGS) libguiroadgps.a $(RGGUIOBJS) - $(RANLIB) libguiroadgps.a - dumpmap: $(DMOBJS) $(RDMLIBS) $(CC) $(LDFLAGS) $(DMOBJS) -o dumpmap $(LIBS) ! buildmap: $(BMOBJS) $(RDMLIBS) ! $(CC) $(LDFLAGS) $(BMOBJS) -o buildmap $(LIBS) buildus: $(BUOBJS) $(RDMLIBS) $(CC) $(LDFLAGS) $(BUOBJS) -o buildus $(LIBS) --- 416,426 ---- $(CC) -g roadmap_trace.c -o rdmtrace $(RDMLIBS) -lm dumpmap: $(DMOBJS) $(RDMLIBS) $(CC) $(LDFLAGS) $(DMOBJS) -o dumpmap $(LIBS) ! buildmap: $(BMOBJS) libbuildmap.a $(RDMLIBS) ! $(CC) $(LDFLAGS) $(BMOBJS) -o buildmap libbuildmap.a $(LIBS) + # buildus to be retired soon. buildus: $(BUOBJS) $(RDMLIBS) $(CC) $(LDFLAGS) $(BUOBJS) -o buildus $(LIBS) |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:15:04
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13263 Modified Files: buildmap_tiger.c Log Message: Add data source attribute Index: buildmap_tiger.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_tiger.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** buildmap_tiger.c 14 Nov 2005 07:04:11 -0000 1.6 --- buildmap_tiger.c 2 Jan 2006 09:14:54 -0000 1.7 *************** *** 981,985 **** buildmap_metadata_add_attribute ("Territory", "Parent", "us"); /* for now. */ ! buildmap_metadata_add_attribute ("Class", "Name", "Road"); free(base); --- 981,986 ---- buildmap_metadata_add_attribute ("Territory", "Parent", "us"); /* for now. */ ! buildmap_metadata_add_attribute ("Class", "Name", "All"); ! buildmap_metadata_add_attribute ("Map", "Source", "USCB"); free(base); |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:14:21
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13129 Added Files: roadmap_index.h Log Message: Prepare for the new index file format --- NEW FILE: roadmap_index.h --- /* roadmap_county.c - retrieve the county to which a specific place belongs. * * LICENSE: * * Copyright 2002 Pascal F. Martin * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap 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 RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef INCLUDED__ROADMAP_INDEX__H #define INCLUDED__ROADMAP_INDEX__H #include "roadmap_types.h" #include "roadmap_dbread.h" int roadmap_index_by_position (const RoadMapPosition *position, int *wtid, int count); int roadmap_index_by_city (const char *authority, const char *city); int roadmap_index_by_authority (const char *authority, int *wtid, int count); const char *roadmap_index_get_territory_name (int wtid); const char *roadmap_index_get_authority_name (int wtid); int roadmap_index_get_territory_count (void); const RoadMapArea *roadmap_index_get_territory_edges (int wtid); extern roadmap_db_handler RoadMapIndexHandler; #endif // INCLUDED__ROADMAP_INDEX__H |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:14:11
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13107 Added Files: roadmap_index.c Log Message: Prepare for the new index file format --- NEW FILE: roadmap_index.c --- /* roadmap_index.c - Access the directory index used to select a map. * * LICENSE: * * Copyright 2005 Pascal F. Martin * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap 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 RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * int roadmap_index_by_position (RoadMapPosition *position, * int *wtid, * int count); * * int roadmap_index_by_city (const char *city, const char *territory); * * extern roadmap_db_handler RoadMapIndexHandler; * * These functions are used to retrieve a map given a location or city. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "roadmap.h" #include "roadmap_math.h" #include "roadmap_hash.h" #include "roadmap_dbread.h" #include "roadmap_db_index.h" #include "roadmap_dictionary.h" #include "roadmap_index.h" static char RoadMapIndexType[] = "RoadMapIndexType"; typedef struct { char *type; RoadMapAuthority *authority; int authority_count; RoadMapTerritory *territory; int territory_count; RoadMapMap *map; int map_count; RoadMapString *name; int name_count; RoadMapString *city; int city_count; RoadMapHash *hash; RoadMapDictionary classes; RoadMapDictionary names; RoadMapDictionary cities; RoadMapDictionary files; char *territory_is_covered; } RoadMapIndexContext; static RoadMapIndexContext *RoadMapIndexActive = NULL; static void *roadmap_index_map (roadmap_db *root) { roadmap_db *authority_table; roadmap_db *territory_table; roadmap_db *map_table; roadmap_db *name_table; roadmap_db *city_table; RoadMapIndexContext *context; context = malloc (sizeof(RoadMapIndexContext)); roadmap_check_allocated(context); context->type = RoadMapIndexType; authority_table = roadmap_db_get_subsection (root, "authority"); territory_table = roadmap_db_get_subsection (root, "territory"); map_table = roadmap_db_get_subsection (root, "map"); name_table = roadmap_db_get_subsection (root, "name"); city_table = roadmap_db_get_subsection (root, "city"); context->authority = (RoadMapAuthority *) roadmap_db_get_data (authority_table); context->territory = (RoadMapTerritory *) roadmap_db_get_data (territory_table); context->map = (RoadMapMap *) roadmap_db_get_data (map_table); context->name = (RoadMapString *) roadmap_db_get_data (name_table); context->city = (RoadMapString *) roadmap_db_get_data (city_table); context->authority_count = roadmap_db_get_count (authority_table); context->territory_count = roadmap_db_get_count (territory_table); context->map_count = roadmap_db_get_count (map_table); context->name_count = roadmap_db_get_count (name_table); context->city_count = roadmap_db_get_count (city_table); if (roadmap_db_get_size(authority_table) != context->authority_count * sizeof(RoadMapAuthority)) { roadmap_log (ROADMAP_FATAL, "invalid index/authority structure"); } if (roadmap_db_get_size(territory_table) != context->territory_count * sizeof(RoadMapTerritory)) { roadmap_log (ROADMAP_FATAL, "invalid index/territory structure"); } if (roadmap_db_get_size(map_table) != context->map_count * sizeof(RoadMapMap)) { roadmap_log (ROADMAP_FATAL, "invalid index/map structure"); } if (roadmap_db_get_size(name_table) != context->name_count * sizeof(RoadMapString)) { roadmap_log (ROADMAP_FATAL, "invalid index/name structure"); } if (roadmap_db_get_size(city_table) != context->city_count * sizeof(RoadMapString)) { roadmap_log (ROADMAP_FATAL, "invalid index/city structure"); } context->names = roadmap_dictionary_open ("name"); context->cities = roadmap_dictionary_open ("city"); context->classes = roadmap_dictionary_open ("class"); context->files = roadmap_dictionary_open ("file"); context->territory_is_covered = (char *) malloc(context->territory_count); return context; } static void roadmap_index_activate (void *context) { RoadMapIndexContext *index_context = (RoadMapIndexContext *) context; if (index_context != NULL) { if (index_context->type != RoadMapIndexType) { roadmap_log (ROADMAP_FATAL, "cannot activate (invalid context type)"); } index_context->hash = roadmap_hash_new ("territoryIndex", index_context->territory_count); } RoadMapIndexActive = index_context; } static void roadmap_index_unmap (void *context) { RoadMapIndexContext *index_context = (RoadMapIndexContext *) context; if (index_context->type != RoadMapIndexType) { roadmap_log (ROADMAP_FATAL, "cannot unmap (invalid context type)"); } if (index_context == RoadMapIndexActive) { RoadMapIndexActive = NULL; } roadmap_hash_free (index_context->hash); free (index_context->territory_is_covered); free (index_context); } roadmap_db_handler RoadMapIndexHandler = { "index", roadmap_index_map, roadmap_index_activate, roadmap_index_unmap }; static int roadmap_index_search_territory (int wtid) { int i; for (i = roadmap_hash_get_first (RoadMapIndexActive->hash, wtid); i >= 0; i = roadmap_hash_get_next (RoadMapIndexActive->hash, i)) { if (wtid == RoadMapIndexActive->territory[i].wtid) return i; } for (i = RoadMapIndexActive->territory_count - 1; i >= 0; --i) { if (wtid == RoadMapIndexActive->territory[i].wtid) { roadmap_hash_add (RoadMapIndexActive->hash, wtid, i); return i; } } return -1; } static RoadMapAuthority *roadmap_index_search_authority (const char *name) { int i; int j; int names_end; RoadMapString index; RoadMapAuthority *this_authority; index = roadmap_dictionary_locate (RoadMapIndexActive->names, name); if (index <= 0) return NULL; for (i = RoadMapIndexActive->authority_count - 1; i >= 0; --i) { this_authority = RoadMapIndexActive->authority + i; if (this_authority->symbol == index) return this_authority; names_end = this_authority->name_first + this_authority->name_count; for (j = this_authority->name_first; j < names_end; ++j) { if (RoadMapIndexActive->name[j] == index) return this_authority; } } return NULL; } int roadmap_index_by_position (const RoadMapPosition *position, int *wtid, int count) { int i; int j; int territory_end; int found; RoadMapAuthority *this_authority; RoadMapTerritory *this_territory; if (RoadMapIndexActive == NULL) { /* There is no point of looking for a territory if none is available. */ return 0; } found = 0; /* First find the territories that might "cover" the given location. * these territories have priority. */ for (i = RoadMapIndexActive->authority_count - 1; i >= 0; --i) { this_authority = RoadMapIndexActive->authority + i; if (this_authority->symbol == 0) continue; /* Unused entry. */ if (position->longitude > this_authority->edges.east) continue; if (position->longitude < this_authority->edges.west) continue; if (position->latitude > this_authority->edges.north) continue; if (position->latitude < this_authority->edges.south) continue; if (this_authority->edges.south == this_authority->edges.north) continue; territory_end = this_authority->territory_first + this_authority->territory_count; for (j = this_authority->territory_first; j < territory_end; ++j) { this_territory = RoadMapIndexActive->territory + j; if (position->longitude > this_territory->edges.east) continue; if (position->longitude < this_territory->edges.west) continue; if (position->latitude > this_territory->edges.north) continue; if (position->latitude < this_territory->edges.south) continue; wtid[found++] = j; RoadMapIndexActive->territory_is_covered[j] = 1; if (found >= count) goto search_complete; } } /* Then find the territories that are merely visible. */ for (i = RoadMapIndexActive->authority_count - 1; i >= 0; --i) { this_authority = RoadMapIndexActive->authority + i; if (this_authority->symbol == 0) continue; /* Unused entry. */ if (! roadmap_math_is_visible (&(this_authority->edges))) continue; if (this_authority->edges.south == this_authority->edges.north) continue; territory_end = this_authority->territory_first + this_authority->territory_count; for (j = this_authority->territory_first; j < territory_end; ++j) { this_territory = RoadMapIndexActive->territory + j; if (roadmap_math_is_visible (&(this_territory->edges))) { /* Do not register the same territory more than once. */ if (RoadMapIndexActive->territory_is_covered[j]) continue; wtid[found++] = j; if (found >= count) goto search_complete; } } } search_complete: /* Translate the territory's index into it's wtid and reset the * coverage flag. */ for (i = found - 1; i >= 0; --i) { j = wtid[i]; wtid[i] = RoadMapIndexActive->territory[j].wtid; RoadMapIndexActive->territory_is_covered[j] = 0; } return found; } int roadmap_index_by_city (const char *authority, const char *city) { int i; int j; int city_end; int territory_end; RoadMapAuthority *this_authority; RoadMapTerritory *this_territory; RoadMapString city_index; if (RoadMapIndexActive == NULL) return 0; this_authority = roadmap_index_search_authority (authority); if (this_authority == NULL) { return 0; /* Entity is not in this map. */ } city_index = roadmap_dictionary_locate (RoadMapIndexActive->cities, city); territory_end = this_authority->territory_first + this_authority->territory_count; for (j = this_authority->territory_first; j < territory_end; ++j) { this_territory = RoadMapIndexActive->territory + j; city_end = this_territory->city_first + this_territory->city_count; for (i = this_territory->city_first; i < city_end; ++i) { if (RoadMapIndexActive->city[i] == city_index) { return this_territory->wtid; } } } return 0; /* No such city in this state. */ } int roadmap_index_by_authority (const char *name, int *wtid, int count) { int i; int found; int territory_end; RoadMapAuthority *this_authority; if (RoadMapIndexActive == NULL) return 0; this_authority = roadmap_index_search_authority (name); if (this_authority == NULL) { return 0; /* This authority is not listed in this map. */ } /* Retrieve all the territories, but not more than what is expected by * the caller. */ if (count < this_authority->territory_count) { territory_end = this_authority->territory_first + count; } else { territory_end = this_authority->territory_first + this_authority->territory_count; } found = 0; for (i = this_authority->territory_first; i < territory_end; ++i) { wtid[found++] = RoadMapIndexActive->territory[i].wtid; } return found; } const char *roadmap_index_get_territory_name (int wtid) { int i; if (RoadMapIndexActive == NULL) return ""; i = roadmap_index_search_territory (wtid); if (i < 0) return ""; return roadmap_dictionary_get (RoadMapIndexActive->names, RoadMapIndexActive->territory[i].name); } const char *roadmap_index_get_authority_symbol (int wtid) { int i; int index; RoadMapAuthority *this_authority; if (RoadMapIndexActive == NULL) return ""; index = roadmap_index_search_territory (wtid); if (index < 0) return ""; for (i = RoadMapIndexActive->authority_count - 1; i >= 0; --i) { this_authority = RoadMapIndexActive->authority + i; if (index >= this_authority->territory_first && index <= this_authority->territory_first + this_authority->territory_count) { return roadmap_dictionary_get (RoadMapIndexActive->names, this_authority->symbol); } } return ""; } const char *roadmap_index_get_authority_name (int wtid) { int i; int index; RoadMapAuthority *this_authority; if (RoadMapIndexActive == NULL) return ""; index = roadmap_index_search_territory (wtid); if (index < 0) return ""; for (i = RoadMapIndexActive->authority_count - 1; i >= 0; --i) { this_authority = RoadMapIndexActive->authority + i; if (index >= this_authority->territory_first && index <= this_authority->territory_first + this_authority->territory_count) { return roadmap_dictionary_get (RoadMapIndexActive->names, RoadMapIndexActive->name[this_authority->name_first]); } } return ""; } int roadmap_index_get_territory_count (void) { if (RoadMapIndexActive == NULL) { return 0; /* None is available, anyway. */ } return RoadMapIndexActive->territory_count; } const RoadMapArea *roadmap_index_get_territory_edges (int wtid) { int i; if (RoadMapIndexActive == NULL) return NULL; i = roadmap_index_search_territory (wtid); if (i < 0) return NULL; return &RoadMapIndexActive->territory[i].edges; } |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:14:03
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13094 Added Files: rdmindex_main.c Log Message: Prepare for the new index file format --- NEW FILE: rdmindex_main.c --- /* rdmindex_main.c - The main function of the map index builder tool. * * LICENSE: * * Copyright 2002 Pascal F. Martin * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap 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 RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <string.h> #include <stdlib.h> #include <stdio.h> #include <popt.h> #include "roadmap_dbread.h" #include "roadmap_dictionary.h" #include "roadmap_types.h" #include "roadmap_hash.h" #include "roadmap_path.h" #include "roadmap_index.h" #include "roadmap_square.h" #include "roadmap_metadata.h" #include "buildmap.h" #include "buildmap_index.h" static roadmap_db_model *RoadMapIndexModel; static int RdmIndexVerbose = 0; static int RdmIndexSilent = 0; static int RdmIndexGrand = 0; static int RdmIndexRecursive = 0; static char *RdmIndexPath; static struct poptOption RdmIndexOptions[] = { POPT_AUTOHELP {"grand", 'g', POPT_ARG_NONE, &RdmIndexGrand, 0, "Build a grand index of index files", NULL}, {"recursive", 'r', POPT_ARG_NONE, &RdmIndexRecursive, 0, "Search the map files recursively", NULL}, {"verbose", 'v', POPT_ARG_NONE, &RdmIndexVerbose, 0, "Show progress information", NULL}, {"silent", 's', POPT_ARG_NONE, &RdmIndexSilent, 0, "Show nothing", NULL}, {"path", 'p', POPT_ARG_STRING, &RdmIndexPath, 0, "Location of the generated index file", "PATH"}, {NULL, 0, 0, NULL, 0, NULL, NULL} }; static void rdmindex_save (void) { buildmap_set_source ("index"); buildmap_db_open (RdmIndexPath, "index"); buildmap_dictionary_save (); buildmap_index_save (); buildmap_db_close (); } static void rdmindex_scan_cities (void) { int i; char *name; RoadMapDictionary cities; cities = roadmap_dictionary_open ("city"); if (! cities) return; /* May not exist is all map files. */ for (i = 1, name = roadmap_dictionary_get (cities, 1); name != NULL; name = roadmap_dictionary_get (cities, ++i)) { buildmap_index_add_city (name); } } static void rdmindex_scan_indexes (const char *path) { } static void rdmindex_scan_maps (const char *path) { int i; char **files; char **cursor; char *extension; int extension_index; char *name; char *fullname; int wtid; const char *class; const char *attribute; RoadMapArea edges; roadmap_path_set ("maps", path); files = roadmap_path_list (path, ".rdm"); for (cursor = files; *cursor != NULL; ++cursor) { name = *cursor; if (strcmp (name, "index.rdm") == 0) continue; fullname = roadmap_path_join (path, name); buildmap_set_source (fullname); if (! RdmIndexSilent) buildmap_info ("scanning the map file..."); if (! roadmap_db_open (path, name, RoadMapIndexModel)) { buildmap_fatal (0, "cannot open the map database"); } roadmap_db_activate (path, name); wtid = atoi(roadmap_metadata_get_attribute ("Territory", "Id")); class = roadmap_metadata_get_attribute ("Class", "Name"); if (wtid == 0 || class[0] == 0) { buildmap_error (0, "incorrect map identity: ID is '%s', class is '%s'", roadmap_metadata_get_attribute ("Territory", "Id"), class); } else { attribute = roadmap_metadata_get_attribute ("Territory", "Parent"); buildmap_index_add_map (wtid, class, attribute, fullname); roadmap_square_edges (ROADMAP_SQUARE_GLOBAL, &edges); buildmap_index_set_map_edges (&edges); for (i = 1; ; ++i) { attribute = roadmap_metadata_get_attribute_next ("Territory", "Parent", i); if ((attribute == NULL) || (attribute[0] == 0)) break; buildmap_index_add_authority_name (attribute); } attribute = roadmap_metadata_get_attribute ("Territory", "Name"); if (attribute[0] != 0) { buildmap_index_set_territory_name (attribute); } rdmindex_scan_cities (); // TBD: Postal codes. } roadmap_db_close (path, name); roadmap_path_free(fullname); } roadmap_path_list_free (files); } static const char **rdmindex_subdirectories (const char *path) { char **files = roadmap_path_list (path, ""); char **cursor1; char **cursor2; for (cursor1 = cursor2 = files; *cursor1 != NULL; ++cursor1) { char *filename = roadmap_path_join (path, *cursor1); if (roadmap_path_is_directory (filename)) { if (cursor2 != cursor1) { *cursor2 = *cursor1; } ++cursor2; } roadmap_path_free (filename); } *cursor2 = NULL; return (const char **)files; } static void rdmindex_recurse (const char *path) { const char **files; const char **cursor; if (RdmIndexGrand) { rdmindex_scan_indexes (path); } else { rdmindex_scan_maps (path); } files = rdmindex_subdirectories (path); for (cursor = files; *cursor != NULL; ++cursor) { char *filename = roadmap_path_join (path, *cursor); rdmindex_recurse (filename); roadmap_path_free (filename); } roadmap_path_list_free ((char **)files); } int main (int argc, const char **argv) { int i; poptContext decoder; const char **leftovers; RdmIndexPath = strdup(roadmap_path_preferred("maps")); decoder = poptGetContext ("rdmindex", argc, argv, RdmIndexOptions, 0); while (poptGetNextOpt(decoder) > 0) ; leftovers = poptGetArgs(decoder); buildmap_index_initialize (RdmIndexPath); RoadMapIndexModel = roadmap_db_register (RoadMapIndexModel, "string", &RoadMapDictionaryHandler); if (RdmIndexGrand) { RoadMapIndexModel = roadmap_db_register (RoadMapIndexModel, "index", &RoadMapIndexHandler); /* By default, we scan the local subdirectories. */ if (leftovers == NULL || leftovers[0] == NULL) { leftovers = rdmindex_subdirectories ("."); } } else { RoadMapIndexModel = roadmap_db_register (RoadMapIndexModel, "square", &RoadMapSquareHandler); /* Unused at that time. RoadMapIndexModel = roadmap_db_register (RoadMapIndexModel, "zip", &RoadMapZipHandler); */ /* By default we scan the local directory. */ if (leftovers == NULL || leftovers[0] == NULL) { static const char *RdmIndexDefault[] = {".", NULL}; leftovers = RdmIndexDefault; } } if (leftovers == NULL || leftovers[0] == NULL) { poptPrintUsage (decoder, stderr, 0); return 1; } if (RdmIndexRecursive) { for (i = 0; leftovers[i] != NULL; ++i) { rdmindex_recurse (leftovers[i]); } } else { for (i = 0; leftovers[i] != NULL; ++i) { if (RdmIndexGrand) { rdmindex_scan_indexes (leftovers[i]); } else { rdmindex_scan_maps (leftovers[i]); } } } buildmap_index_sort(); if (RdmIndexVerbose) { roadmap_hash_summary (); buildmap_dictionary_summary (); buildmap_index_summary (); } rdmindex_save (); return 0; } |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:13:55
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13072 Added Files: buildmap_index.h Log Message: Prepare for the new index file format --- NEW FILE: buildmap_index.h --- /* buildmap_index.h - Build the index table for RoadMap. * * LICENSE: * * Copyright 2002 Pascal F. Martin * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap 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 RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: */ #ifndef INCLUDED__BUILDMAP_INDEX__H #define INCLUDED__BUILDMAP_INDEX__H #include "roadmap_types.h" void buildmap_index_initialize (const char *path); void buildmap_index_add_map (int wtid, const char *class, const char *authority, const char *filename); void buildmap_index_set_territory_name (const char *name); void buildmap_index_add_authority_name (const char *name); void buildmap_index_set_map_edges (const RoadMapArea *edges); void buildmap_index_add_city (const char *city); void buildmap_index_add_postal_code (unsigned int code); void buildmap_index_sort (void); void buildmap_index_save (void); void buildmap_index_summary (void); #endif // INCLUDED__BUILDMAP_INDEX__H |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:13:45
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13052 Added Files: buildmap_index.c Log Message: Prepare for the new index file format --- NEW FILE: buildmap_index.c --- /* buildmap_index.c - Build the index table for RoadMap. * * LICENSE: * * Copyright 2002 Pascal F. Martin * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap 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 RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * void buildmap_index_initialize (const char *path); * * void buildmap_index_add_map (int wtid, * const char *class, * const char *authority, * const char *filename); * void buildmap_index_set_territory_name (const char *name); * void buildmap_index_add_authority_name (const char *name); * void buildmap_index_set_map_edges (const RoadMapArea *edges); * void buildmap_index_add_city (const char *city); * void buildmap_index_add_postal_code (unsigned int code); * * void buildmap_index_sort (void); * void buildmap_index_save (void); * void buildmap_index_summary (void); * * These functions are used to build a table of counties from * the census bureau list of FIPS code. * The goal is to help localize the specific map for a given address * or position. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "roadmap_db_index.h" #include "roadmap_path.h" #include "roadmap_hash.h" #include "buildmap.h" #include "buildmap_index.h" #define BUILDMAP_MAX_NAME 16 // Arbitrary value... static BuildMapDictionary MapClasses; static BuildMapDictionary MapCities; static BuildMapDictionary MapNames; static BuildMapDictionary MapFiles; typedef struct buildmap_city_record { struct buildmap_city_record *next; RoadMapString name; } BuildMapCity; typedef struct buildmap_file_record { struct buildmap_file_record *next; char *filename; RoadMapString class; RoadMapString filename_index; } BuildMapFile; typedef struct buildmap_territory_record { struct buildmap_territory_record *next; char *pathname; int wtid; RoadMapString authority; RoadMapString pathname_index; RoadMapString name; RoadMapArea edges; BuildMapFile *maps; BuildMapCity *cities; unsigned int city_count; unsigned int postal_low; unsigned int postal_high; } BuildMapTerritory; typedef struct { char *pathname; RoadMapString symbol; RoadMapString pathname_index; int name_count; RoadMapString names[BUILDMAP_MAX_NAME]; RoadMapArea edges; BuildMapTerritory *territories; } BuildMapAuthority; static int AuthorityCount = 0; static BuildMapAuthority *MapAuthority[BUILDMAP_BLOCK] = {NULL}; static BuildMapAuthority *BuildMapCurrentAuthority = NULL; static int TerritoryCount = 0; static BuildMapTerritory *Territory[BUILDMAP_BLOCK] = {NULL}; static BuildMapTerritory *BuildMapCurrentTerritory = NULL; static int MapCount = 0; static BuildMapFile *Map[BUILDMAP_BLOCK] = {NULL}; static int CityCount = 0; static BuildMapCity *MapCity[BUILDMAP_BLOCK] = {NULL}; static int NameCount = 0; static RoadMapHash *TerritoryByWtid = NULL; static RoadMapHash *AuthorityBySymbol = NULL; static const char *BuildMapBasePath = NULL; static int BuildMapBaseLength = 0; void buildmap_index_initialize (const char *path) { TerritoryByWtid = roadmap_hash_new ("TerritoryByWtid", BUILDMAP_BLOCK); AuthorityBySymbol = roadmap_hash_new ("AuthorityBySymbol", BUILDMAP_BLOCK); MapClasses = buildmap_dictionary_open ("class"); MapCities = buildmap_dictionary_open ("city"); MapNames = buildmap_dictionary_open ("name"); MapFiles = buildmap_dictionary_open ("file"); MapCount = 0; CityCount = 0; TerritoryCount = 0; AuthorityCount = 0; BuildMapBasePath = strdup(path); BuildMapBaseLength = strlen(BuildMapBasePath); } static BuildMapAuthority * buildmap_index_search_authority (RoadMapString authority) { int i; int index; BuildMapAuthority *this_authority; for (index = roadmap_hash_get_first (AuthorityBySymbol, authority); index >= 0; index = roadmap_hash_get_next (AuthorityBySymbol, index)) { this_authority = MapAuthority[index / BUILDMAP_BLOCK] + (index % BUILDMAP_BLOCK); if (this_authority->symbol == authority) return this_authority; for (i = 0; i < this_authority->name_count; ++i) { if (this_authority->names[i] == authority) return this_authority; } } return NULL; } static BuildMapAuthority *buildmap_index_new_authority (RoadMapString symbol) { int block = AuthorityCount / BUILDMAP_BLOCK; int offset = AuthorityCount % BUILDMAP_BLOCK; BuildMapAuthority *this_authority; if (MapAuthority[block] == NULL) { /* We need to add a new block to the table. */ MapAuthority[block] = calloc (BUILDMAP_BLOCK, sizeof(BuildMapAuthority)); if (MapAuthority[block] == NULL) { buildmap_fatal (0, "no more memory"); } } this_authority = MapAuthority[block] + offset; this_authority->symbol = symbol; this_authority->name_count = 0; this_authority->territories = NULL; if (++AuthorityCount > 0xffff) { buildmap_fatal (0, "too many authorities for a single index"); } return this_authority; } static BuildMapTerritory *buildmap_index_new_territory (int wtid, BuildMapAuthority *this_authority) { int block = TerritoryCount / BUILDMAP_BLOCK; int offset = TerritoryCount % BUILDMAP_BLOCK; BuildMapTerritory *this_territory; if (Territory[block] == NULL) { /* We need to add a new block to the table. */ Territory[block] = calloc (BUILDMAP_BLOCK, sizeof(BuildMapTerritory)); if (Territory[block] == NULL) { buildmap_fatal (0, "no more memory"); } roadmap_hash_resize (TerritoryByWtid, (block+1) * BUILDMAP_BLOCK); } this_territory = Territory[block] + offset; this_territory->wtid = wtid; this_territory->authority = this_authority->symbol; this_territory->maps = NULL; this_territory->cities = NULL; this_territory->city_count = 0; this_territory->postal_low = 0; this_territory->postal_high = 0; roadmap_hash_add (TerritoryByWtid, wtid, TerritoryCount); this_territory->next = this_authority->territories; this_authority->territories = this_territory; if (++TerritoryCount > 0xffff) { buildmap_fatal (0, "too many territories for a single index"); } BuildMapCurrentTerritory = this_territory; return this_territory; } static void buildmap_index_new_map (BuildMapTerritory *territory, RoadMapString class, const char *filename) { int block = MapCount / BUILDMAP_BLOCK; int offset = MapCount % BUILDMAP_BLOCK; BuildMapFile *this_map; if (Map[block] == NULL) { /* We need to add a new block to the table. */ Map[block] = calloc (BUILDMAP_BLOCK, sizeof(BuildMapFile)); if (Map[block] == NULL) { buildmap_fatal (0, "no more memory"); } } this_map = Map[block] + offset; this_map->class = class; /* If the map file is in a subdirectory of the index we are creating, * record only the relative path. This way the whole set can be moved * or installed elsewhere without having to rebuild the index. */ if (strncmp (BuildMapBasePath, filename, BuildMapBaseLength) == 0) { const char *relative = roadmap_path_skip_separator (filename+BuildMapBaseLength); if (relative != NULL) filename = relative; } this_map->filename = strdup(filename); this_map->next = territory->maps; territory->maps = this_map; if (++MapCount > 0xffff) { buildmap_fatal (0, "too many maps for a single index"); } } static void buildmap_index_include_area (RoadMapArea *outer, const RoadMapArea *inner) { if ((outer->east == 0) || (outer->east < inner->east)) { outer->east = inner->east; } if ((outer->west == 0) || (outer->west > inner->west)) { outer->west = inner->west; } if ((outer->north == 0) || (outer->north < inner->north)) { outer->north = inner->north; } if ((outer->south == 0) || (outer->south > inner->south)) { outer->south = inner->south; } } void buildmap_index_add_map (int wtid, const char *class, const char *authority, const char *filename) { int index; BuildMapFile *this_map; BuildMapTerritory *this_territory; BuildMapAuthority *this_authority; RoadMapString class_index; RoadMapString authority_index; class_index = buildmap_dictionary_add (MapClasses, class, strlen(class)); authority_index = buildmap_dictionary_add (MapNames, authority, strlen(authority)); /* First search if that map is not yet known. */ for (index = roadmap_hash_get_first (TerritoryByWtid, wtid); index >= 0; index = roadmap_hash_get_next (TerritoryByWtid, index)) { this_territory = Territory[index / BUILDMAP_BLOCK] + (index % BUILDMAP_BLOCK); if (this_territory->wtid == wtid) { /* Run some coherency checks. */ if (this_territory->authority != authority_index) { buildmap_fatal (0, "territory %d is managed by multiple authorities", wtid); } for (this_map = this_territory->maps; this_map != NULL; this_map = this_map->next) { if (this_map->class == class_index) { buildmap_fatal (0, "class %s appears more than once for territory %d", class, wtid); } } /* The territory was known: just create the map entry. */ buildmap_index_new_map (this_territory, class_index, filename); BuildMapCurrentTerritory = this_territory; BuildMapCurrentAuthority = buildmap_index_search_authority (authority_index); return; } } /* Now search the authority, or create a new one if necessary. */ this_authority = buildmap_index_search_authority (authority_index); if (this_authority == NULL) { this_authority = buildmap_index_new_authority (authority_index); } /* This territory was not known yet: create a new record. */ this_territory = buildmap_index_new_territory (wtid, this_authority); buildmap_index_new_map (this_territory, class_index, filename); } void buildmap_index_set_territory_name (const char *name) { BuildMapCurrentTerritory->name = buildmap_dictionary_add (MapNames, name, strlen(name)); } void buildmap_index_add_authority_name (const char *name) { int i; int count; RoadMapString name_index; count = BuildMapCurrentAuthority->name_count; name_index = buildmap_dictionary_add (MapNames, name, strlen(name)); for (i = 0; i < count; ++i) { if (BuildMapCurrentAuthority->names[i] == name_index) return; } if (count >= BUILDMAP_MAX_NAME) { RoadMapString symbol = BuildMapCurrentAuthority->symbol; buildmap_fatal (0, "too many names for authority %s", buildmap_dictionary_get (MapNames, symbol)); } BuildMapCurrentAuthority->names[count] = name_index; BuildMapCurrentAuthority->name_count = count + 1; } void buildmap_index_set_map_edges (const RoadMapArea *edges) { buildmap_index_include_area (&(BuildMapCurrentTerritory->edges), edges); buildmap_index_include_area (&(BuildMapCurrentAuthority->edges), &(BuildMapCurrentTerritory->edges)); } void buildmap_index_add_city (const char *city) { int block; int offset; BuildMapCity *this_city; BuildMapTerritory *this_territory = BuildMapCurrentTerritory; block = CityCount / BUILDMAP_BLOCK; offset = CityCount % BUILDMAP_BLOCK; if (MapCity[block] == NULL) { /* We need to add a new block to the table. */ MapCity[block] = calloc (BUILDMAP_BLOCK, sizeof(BuildMapCity)); if (MapCity[block] == NULL) { buildmap_fatal (0, "no more memory"); } } this_city = MapCity[block] + offset; this_city->next = this_territory->cities; this_city->name = buildmap_dictionary_add (MapCities, city, strlen(city)); this_territory->cities = this_city; this_territory->city_count += 1; CityCount += 1; } void buildmap_index_add_postal_code (unsigned int code) { if ((BuildMapCurrentTerritory->postal_low == 0) || (BuildMapCurrentTerritory->postal_low > code)) { BuildMapCurrentTerritory->postal_low = code; } if (BuildMapCurrentTerritory->postal_high < code) { BuildMapCurrentTerritory->postal_high = code; } } static void buildmap_index_common_parent (char *common, const char *file) { char *p1; const char *p2; for (p1 = common, p2 = file; *p1 > 0; ++p1, ++p2) { if (*p1 != *p2) break; } if (*p1 == 0) return; /* Nothing to do. */ *p1 = 0; p1 = roadmap_path_parent (NULL, common); strcpy (common, p1); roadmap_path_free (p1); } void buildmap_index_sort (void) { int index; int length; const char *p; BuildMapFile *this_map; BuildMapTerritory *this_territory; BuildMapAuthority *this_authority; buildmap_info ("sorting index..."); /* Retrieve the path for each territory by finding the * common denominator among the child maps. */ for (index = 0; index < TerritoryCount; ++index) { this_territory = Territory[index / BUILDMAP_BLOCK] + (index % BUILDMAP_BLOCK); this_territory->pathname = roadmap_path_parent (NULL, this_territory->maps->filename); for (this_map = this_territory->maps->next; this_map != NULL; this_map = this_map->next) { buildmap_index_common_parent (this_territory->pathname, this_map->filename); } /* Remove the common part from the file names. */ length = strlen (this_territory->pathname); p = roadmap_path_skip_separator (this_territory->maps->filename + length); if (p == NULL) { buildmap_fatal (0, "invalid common path %s", this_territory->pathname); } length = (int) (p - this_territory->maps->filename); if (length > 0) { for (this_map = this_territory->maps; this_map != NULL; this_map = this_map->next) { char *relative = this_map->filename + length; this_map->filename_index = buildmap_dictionary_add (MapFiles, relative, strlen(relative)); } } } /* Retrieve the path for each authority by finding the * common denominator among the child territories. */ NameCount = 0; for (index = 0; index < AuthorityCount; ++index) { this_authority = MapAuthority[index / BUILDMAP_BLOCK] + (index % BUILDMAP_BLOCK); if (this_authority->territories == NULL) continue; this_authority->pathname = strdup (this_authority->territories->pathname); for (this_territory = this_authority->territories->next; this_territory != NULL; this_territory = this_territory->next) { buildmap_index_common_parent (this_authority->pathname, this_territory->pathname); } /* Remove the common part from the territory paths. */ length = strlen (this_authority->pathname); p = roadmap_path_skip_separator (this_authority->territories->pathname + length); if (p == NULL) { buildmap_fatal (0, "invalid common path %s", this_authority->pathname); } length = (int) (p - this_authority->territories->pathname); if (length > 0) { for (this_territory = this_authority->territories; this_territory != NULL; this_territory = this_territory->next) { char *relative = this_territory->pathname + length; this_territory->pathname_index = buildmap_dictionary_add (MapFiles, relative, strlen(relative)); } } NameCount += this_authority->name_count; /* Total number of names. */ } } void buildmap_index_save (void) { int i; int index; int territory_cursor; int map_cursor; int name_cursor; int city_cursor; RoadMapAuthority *one_authority; RoadMapTerritory *one_territory; RoadMapAuthority *db_authority; RoadMapTerritory *db_territory; RoadMapMap *db_map; RoadMapString *db_name; RoadMapString *db_city; buildmap_db *root; buildmap_db *authority_table; buildmap_db *territory_table; buildmap_db *map_table; buildmap_db *name_table; buildmap_db *city_table; BuildMapFile *this_map; BuildMapCity *this_city; BuildMapTerritory *this_territory; buildmap_info ("saving index..."); root = buildmap_db_add_section (NULL, "index"); authority_table = buildmap_db_add_section (root, "authority"); buildmap_db_add_data (authority_table, AuthorityCount, sizeof(RoadMapAuthority)); territory_table = buildmap_db_add_section (root, "territory"); buildmap_db_add_data (territory_table, TerritoryCount, sizeof(RoadMapTerritory)); map_table = buildmap_db_add_section (root, "map"); buildmap_db_add_data (map_table, MapCount, sizeof(RoadMapMap)); name_table = buildmap_db_add_section (root, "name"); buildmap_db_add_data (name_table, NameCount, sizeof(RoadMapString)); city_table = buildmap_db_add_section (root, "city"); buildmap_db_add_data (city_table, CityCount, sizeof(RoadMapString)); db_authority = (RoadMapAuthority *) buildmap_db_get_data (authority_table); db_territory = (RoadMapTerritory *) buildmap_db_get_data (territory_table); db_map = (RoadMapMap *) buildmap_db_get_data (map_table); db_name = (RoadMapString *) buildmap_db_get_data (name_table); db_city = (RoadMapString *) buildmap_db_get_data (city_table); name_cursor = 0; city_cursor = 0; map_cursor = 0; territory_cursor = 0; for (index = 0; index < AuthorityCount; ++index) { BuildMapAuthority *this_authority = MapAuthority[index / BUILDMAP_BLOCK] + (index % BUILDMAP_BLOCK); one_authority = db_authority + index; one_authority->symbol = this_authority->symbol; one_authority->pathname = this_authority->pathname_index; one_authority->edges = this_authority->edges; one_authority->name_first = name_cursor; for (i = 0; i < this_authority->name_count; ++i) { if (name_cursor >= NameCount) { buildmap_fatal (0, "invalid map count"); } db_name[name_cursor++] = this_authority->names[i]; } one_authority->name_count = this_authority->name_count; one_authority->territory_first = territory_cursor; for (this_territory = this_authority->territories; this_territory != NULL; this_territory = this_territory->next) { if (territory_cursor >= TerritoryCount) { buildmap_fatal (0, "invalid territory count"); } one_territory = db_territory + territory_cursor; one_territory->pathname = this_territory->pathname_index; one_territory->name = 0; one_territory->edges = this_territory->edges; one_territory->map_first = map_cursor; for (this_map = this_territory->maps; this_map != NULL; this_map = this_map->next) { if (map_cursor >= MapCount) { buildmap_fatal (0, "invalid map count"); } db_map[map_cursor].class = this_map->class; db_map[map_cursor].filename = this_map->filename_index; map_cursor += 1; } one_territory->map_count = map_cursor - one_territory->map_first; for (this_city = this_territory->cities; this_city != NULL; this_city = this_city->next) { if (city_cursor >= CityCount) { buildmap_fatal (0, "invalid city count"); } db_city[city_cursor++] = this_city->name; } one_territory->city_count = city_cursor - one_territory->city_first; one_territory->postal_low = this_territory->postal_low; one_territory->postal_high = this_territory->postal_high; territory_cursor += 1; } one_authority->territory_count = territory_cursor - one_authority->territory_first; } } void buildmap_index_summary (void) { } |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:11:55
|
Update of /cvsroot/roadmap/roadmap/src/gtk2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12805 Modified Files: roadmap_main.c Log Message: Fix warning Index: roadmap_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk2/roadmap_main.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** roadmap_main.c 16 Dec 2005 14:13:48 -0000 1.24 --- roadmap_main.c 2 Jan 2006 09:11:46 -0000 1.25 *************** *** 27,30 **** --- 27,31 ---- #include <stdlib.h> + #include <stdlib.h> #include <string.h> #include <sys/time.h> |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:11:32
|
Update of /cvsroot/roadmap/roadmap/src/gtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12754 Modified Files: roadmap_main.c Log Message: Fix warning Index: roadmap_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk/roadmap_main.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** roadmap_main.c 16 Dec 2005 14:13:48 -0000 1.17 --- roadmap_main.c 2 Jan 2006 09:11:22 -0000 1.18 *************** *** 27,30 **** --- 27,31 ---- #include <time.h> + #include <stdlib.h> #include <sys/time.h> |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:11:02
|
Update of /cvsroot/roadmap/roadmap/src/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12658 Modified Files: roadmap_path.c Log Message: Prepare for the new index file format Index: roadmap_path.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/win32/roadmap_path.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** roadmap_path.c 17 Oct 2005 07:24:06 -0000 1.4 --- roadmap_path.c 2 Jan 2006 09:10:54 -0000 1.5 *************** *** 139,143 **** char *roadmap_path_join (const char *path, const char *name) { ! if (path == NULL) { return strdup (name); } --- 139,143 ---- char *roadmap_path_join (const char *path, const char *name) { ! if (path == NULL || path[0] == 0) { return strdup (name); } *************** *** 479,482 **** --- 479,490 ---- } + const char *roadmap_path_skip_separator (const char *name) { + + if ((*name == '/') || (*name == '\\')) { + return name + 1; + } + return NULL; // Not a valid path separator. + } + const char *roadmap_path_temporary (void) { return roadmap_path_user(); |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:10:33
|
Update of /cvsroot/roadmap/roadmap/src/unix In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12530 Modified Files: roadmap_path.c Log Message: Prepare for the new index file format Index: roadmap_path.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/unix/roadmap_path.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** roadmap_path.c 13 Nov 2005 23:48:52 -0000 1.18 --- roadmap_path.c 2 Jan 2006 09:10:25 -0000 1.19 *************** *** 196,200 **** char *roadmap_path_join (const char *path, const char *name) { ! if (path == NULL) { return strdup (name); } --- 196,200 ---- char *roadmap_path_join (const char *path, const char *name) { ! if (path == NULL || path[0] == 0) { return strdup (name); } *************** *** 580,583 **** --- 580,592 ---- + const char *roadmap_path_skip_separator (const char *name) { + + if (*name == '/') { + return name + 1; + } + return NULL; // Not a valid path separator. + } + + const char *roadmap_path_temporary (void) { |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:10:25
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12506 Modified Files: roadmap_path.h Log Message: Prepare for the new index file format Index: roadmap_path.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_path.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** roadmap_path.h 17 Oct 2005 07:22:43 -0000 1.9 --- roadmap_path.h 2 Jan 2006 09:10:14 -0000 1.10 *************** *** 65,68 **** --- 65,70 ---- * function roadmap_path_parent() works in a similar fashion, except that * it returns the path of the parent directory of the concatenation result. + * Both functions ignore the path argument if it is either NULL or empty. + * Only the file name is considered in this case. * * For example, on UNIX, if path is "/usr/include" and name is "sys/errno.h" *************** *** 137,140 **** --- 139,144 ---- int roadmap_path_is_directory (const char *name); + const char *roadmap_path_skip_separator (const char *name); + const char *roadmap_path_temporary (void); |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:09:46
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12198 Modified Files: roadmap_db_index.h Log Message: Cleanup Index: roadmap_db_index.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_db_index.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_db_index.h 17 Dec 2005 21:12:36 -0000 1.1 --- roadmap_db_index.h 2 Jan 2006 09:09:38 -0000 1.2 *************** *** 25,33 **** * The RoadMap index is described by the following table: * ! * index/authorities The authority body. Links to territories. ! * index/territories The territory. Sorted by authority, links to maps. ! * index/files A map file (a specific territory & class). ! * index/names Describes the names of a specific authority. ! * index/cities Links the name of a city with its associated territory. * * NOTE: --- 25,33 ---- * The RoadMap index is described by the following table: * ! * index/authority The authority body. Links to territories. ! * index/territory The territory. Sorted by authority, links to maps. ! * index/map A map file (a specific territory & class). ! * index/name Describes the names of a specific authority. ! * index/citiek Links the name of a city with its associated territory. * * NOTE: *************** *** 98,102 **** #include "roadmap_types.h" ! typedef struct { /* table index/authorities */ RoadMapString symbol; /* Relative to the index's parent. */ --- 98,102 ---- #include "roadmap_types.h" ! typedef struct { /* table index/authority */ RoadMapString symbol; /* Relative to the index's parent. */ *************** *** 118,123 **** int wtid; /* Stands for "world territory ID". */ RoadMapString pathname; /* Relative or absolute path for the map files. */ - unsigned short reserved; /* Must be 0. */ RoadMapArea edges; /* Bounding earth area for this territory. */ --- 118,123 ---- int wtid; /* Stands for "world territory ID". */ + RoadMapString name; RoadMapString pathname; /* Relative or absolute path for the map files. */ RoadMapArea edges; /* Bounding earth area for this territory. */ *************** *** 135,148 **** ! typedef struct { /* table index/files */ RoadMapString class; RoadMapString filename; /* ... relative to the authority/territory path. */ ! } RoadMapFile; ! /* table index/names is an array of RoadMapString sorted by authority. */ ! /* table index/cities is an array of RoadMapString sorted by map. */ #endif // INCLUDE__ROADMAP_DB_INDEX__H --- 135,148 ---- ! typedef struct { /* table index/map */ RoadMapString class; RoadMapString filename; /* ... relative to the authority/territory path. */ ! } RoadMapMap; ! /* table index/name is an array of RoadMapString sorted by authority. */ ! /* table index/city is an array of RoadMapString sorted by map. */ #endif // INCLUDE__ROADMAP_DB_INDEX__H |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:08:57
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11958 Modified Files: buildmap_metadata.h Log Message: Add support for multi-valued attributes Index: buildmap_metadata.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_metadata.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** buildmap_metadata.h 15 Nov 2005 05:05:36 -0000 1.1 --- buildmap_metadata.h 2 Jan 2006 09:08:49 -0000 1.2 *************** *** 26,33 **** --- 26,38 ---- void buildmap_metadata_initialize (void); + void buildmap_metadata_add_attribute (const char *category, const char *name, const char *value); + void buildmap_metadata_add_value (const char *category, + const char *name, + const char *value); + void buildmap_metadata_sort (void); void buildmap_metadata_save (void); |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:08:40
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11852 Modified Files: buildmap_metadata.c Log Message: Add support for multi-valued attributes Index: buildmap_metadata.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_metadata.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** buildmap_metadata.c 15 Nov 2005 05:05:28 -0000 1.1 --- buildmap_metadata.c 2 Jan 2006 09:08:31 -0000 1.2 *************** *** 24,31 **** --- 24,36 ---- * * void buildmap_metadata_initialize (void); + * * void buildmap_metadata_add_attribute (const char *category, * const char *name, * const char *value); * + * void buildmap_metadata_add_value (const char *category, + * const char *name, + * const char *value); + * * void buildmap_metadata_sort (void); * void buildmap_metadata_save (void); *************** *** 51,57 **** static int AttributeCount = 0; ! static RoadMapAttribute *Attribute[BUILDMAP_BLOCK] = {NULL}; static RoadMapHash *AttributeByName = NULL; --- 56,73 ---- + #define BUILDMAP_MAX_VALUES 64 + + typedef struct { + + RoadMapString category; + RoadMapString name; + + RoadMapString values[BUILDMAP_MAX_VALUES]; + short count; + + } BuildMapAttribute; static int AttributeCount = 0; ! static BuildMapAttribute *Attribute[BUILDMAP_BLOCK] = {NULL}; static RoadMapHash *AttributeByName = NULL; *************** *** 81,85 **** int block; int offset; ! RoadMapAttribute *this_attribute; --- 97,101 ---- int block; int offset; ! BuildMapAttribute *this_attribute; *************** *** 104,108 **** (this_attribute->category == coded_category)) { ! if (this_attribute->value != coded_value) { roadmap_log (ROADMAP_FATAL, "attribute %s.%s changed to %s", --- 120,124 ---- (this_attribute->category == coded_category)) { ! if (this_attribute->values[0] != coded_value) { roadmap_log (ROADMAP_FATAL, "attribute %s.%s changed to %s", *************** *** 137,141 **** this_attribute->category = coded_category; this_attribute->name = coded_name; ! this_attribute->value = coded_value; AttributeCount += 1; --- 153,158 ---- this_attribute->category = coded_category; this_attribute->name = coded_name; ! this_attribute->values[0] = coded_value; ! this_attribute->count = 1; AttributeCount += 1; *************** *** 143,146 **** --- 160,205 ---- + void buildmap_metadata_add_value (const char *category, + const char *name, + const char *value) { + + int i; + BuildMapAttribute *this_attribute; + + + RoadMapString coded_category = + buildmap_dictionary_locate (AttributeDictionary, category); + + RoadMapString coded_name = + buildmap_dictionary_locate (AttributeDictionary, name); + + RoadMapString coded_value = + buildmap_dictionary_add (AttributeDictionary, value, strlen(value)); + + for (i = roadmap_hash_get_first (AttributeByName, coded_name); + i >= 0; + i = roadmap_hash_get_next (AttributeByName, i)) { + + this_attribute = Attribute[i / BUILDMAP_BLOCK] + (i % BUILDMAP_BLOCK); + + if ((this_attribute->name == coded_name) && + (this_attribute->category == coded_category)) { + + if (this_attribute->count >= BUILDMAP_MAX_VALUES) { + roadmap_log (ROADMAP_FATAL, + "too many values for attribute %s.%s", + category, name); + } + + this_attribute->values[this_attribute->count++] = coded_value; + + return; + } + } + + roadmap_log (ROADMAP_FATAL, "attribute %s.%s not found", category, name); + } + + void buildmap_metadata_sort (void) {} *************** *** 149,162 **** int i; ! RoadMapAttribute *one_attribute; ! RoadMapAttribute *db_attributes; buildmap_db *root; buildmap_db *table_attributes; buildmap_info ("saving %d attributes...", AttributeCount); root = buildmap_db_add_section (NULL, "metadata"); --- 208,233 ---- int i; + int j; + int values_count; + int values_cursor; ! BuildMapAttribute *one_attribute; ! RoadMapAttribute *db_attributes; ! RoadMapString *db_values; buildmap_db *root; buildmap_db *table_attributes; + buildmap_db *table_values; buildmap_info ("saving %d attributes...", AttributeCount); + values_count = 0; + for (i = 0; i < AttributeCount; ++i) { + + one_attribute = Attribute[i/BUILDMAP_BLOCK] + (i % BUILDMAP_BLOCK); + values_count += one_attribute->count; + } + root = buildmap_db_add_section (NULL, "metadata"); *************** *** 165,177 **** (table_attributes, AttributeCount, sizeof(RoadMapAttribute)); db_attributes = (RoadMapAttribute *) buildmap_db_get_data (table_attributes); for (i = 0; i < AttributeCount; ++i) { one_attribute = Attribute[i/BUILDMAP_BLOCK] + (i % BUILDMAP_BLOCK); ! db_attributes[i] = *one_attribute; ! db_attributes[i].filler = 0; } } --- 236,262 ---- (table_attributes, AttributeCount, sizeof(RoadMapAttribute)); + table_values = buildmap_db_add_section (root, "values"); + buildmap_db_add_data + (table_values, values_count, sizeof(RoadMapString)); + db_attributes = (RoadMapAttribute *) buildmap_db_get_data (table_attributes); + db_values = (RoadMapString *) buildmap_db_get_data (table_values); + values_cursor = 0; + for (i = 0; i < AttributeCount; ++i) { one_attribute = Attribute[i/BUILDMAP_BLOCK] + (i % BUILDMAP_BLOCK); ! db_attributes[i].category = one_attribute->category; ! db_attributes[i].name = one_attribute->name; ! ! db_attributes[i].value_first = values_cursor; ! db_attributes[i].value_count = one_attribute->count; ! ! for (j = 0; j < one_attribute->count; ++j) { ! db_values[values_cursor++] = one_attribute->values[j]; ! } } } |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:07:39
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11616 Modified Files: roadmap_locator.c Log Message: roadmap_db_open() does not scan the search path anymore, it opens the specified file Index: roadmap_locator.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_locator.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** roadmap_locator.c 14 Nov 2005 07:13:47 -0000 1.17 --- roadmap_locator.c 2 Jan 2006 09:07:29 -0000 1.18 *************** *** 36,39 **** --- 36,40 ---- #include "roadmap.h" #include "roadmap_types.h" + #include "roadmap_scan.h" #include "roadmap_dbread.h" #include "roadmap_dictionary.h" *************** *** 54,57 **** --- 55,59 ---- int fips; + const char *path; unsigned int last_access; }; *************** *** 78,81 **** --- 80,86 ---- static void roadmap_locator_configure (void) { + int usdir_open; + const char *path; + if (RoadMapCountyCache == NULL) { *************** *** 115,120 **** (RoadMapUsModel, "string", &RoadMapDictionaryHandler); ! if (! roadmap_db_open ("usdir", RoadMapUsModel, "r")) { ! roadmap_log (ROADMAP_FATAL, "cannot open directory database (usdir)"); } --- 120,140 ---- (RoadMapUsModel, "string", &RoadMapDictionaryHandler); ! usdir_open = 0; ! ! for (path = roadmap_scan ("maps", "usdir.rdm"); ! path != NULL; ! path = roadmap_scan_next ("maps", "usdir.rdm", path)) { ! ! if (roadmap_db_open (path, "usdir.rdm", RoadMapUsModel)) { ! break; ! } ! roadmap_log (ROADMAP_ERROR, ! "cannot open database directory usdir in %s", path); ! } ! ! if (path == NULL) { ! roadmap_log (ROADMAP_ERROR, ! "cannot open any database directory"); ! return; } *************** *** 139,146 **** snprintf (map_name, sizeof(map_name), ! "usc%05d", RoadMapCountyCache[index].fips); ! roadmap_db_close (map_name); RoadMapCountyCache[index].fips = 0; RoadMapCountyCache[index].last_access = 0; } --- 159,168 ---- snprintf (map_name, sizeof(map_name), ! "usc%05d.rdm", RoadMapCountyCache[index].fips); ! ! roadmap_db_close (RoadMapCountyCache[index].path, map_name); RoadMapCountyCache[index].fips = 0; + RoadMapCountyCache[index].path = NULL; RoadMapCountyCache[index].last_access = 0; } *************** *** 179,182 **** --- 201,205 ---- int oldest = 0; + const char *path; char map_name[64]; *************** *** 185,189 **** return ROADMAP_US_NOMAP; } ! snprintf (map_name, sizeof(map_name), "usc%05d", fips); /* Look for the oldest entry in the cache. */ --- 208,213 ---- return ROADMAP_US_NOMAP; } ! snprintf (map_name, sizeof(map_name), "usc%05d.rdm", fips); ! /* Look for the oldest entry in the cache. */ *************** *** 193,197 **** if (RoadMapCountyCache[i].fips == fips) { ! roadmap_db_activate (map_name); RoadMapActiveCounty = fips; --- 217,221 ---- if (RoadMapCountyCache[i].fips == fips) { ! roadmap_db_activate (RoadMapCountyCache[i].path, map_name); RoadMapActiveCounty = fips; *************** *** 207,231 **** if (RoadMapCountyCache[oldest].fips > 0) { - roadmap_locator_remove (oldest); if (RoadMapCountyCache[oldest].fips == RoadMapActiveCounty) { RoadMapActiveCounty = 0; } } access = roadmap_locator_new_access (); ! while (! roadmap_db_open (map_name, RoadMapCountyModel, "r")) { ! if (! RoadMapDownload (fips)) { ! return ROADMAP_US_NOMAP; } - } ! RoadMapCountyCache[oldest].fips = fips; ! RoadMapCountyCache[oldest].last_access = access; ! RoadMapActiveCounty = fips; ! ! return ROADMAP_US_OK; } --- 231,263 ---- if (RoadMapCountyCache[oldest].fips > 0) { if (RoadMapCountyCache[oldest].fips == RoadMapActiveCounty) { RoadMapActiveCounty = 0; } + roadmap_locator_remove (oldest); } access = roadmap_locator_new_access (); ! do { ! for (path = roadmap_scan ("maps", map_name); ! path != NULL; ! path = roadmap_scan_next ("maps", map_name, path)) { ! ! if (roadmap_db_open (path, map_name, RoadMapCountyModel)) { ! ! RoadMapCountyCache[oldest].fips = fips; ! RoadMapCountyCache[oldest].path = path; ! RoadMapCountyCache[oldest].last_access = access; ! ! RoadMapActiveCounty = fips; ! ! return ROADMAP_US_OK; ! } } ! } while (RoadMapDownload (fips)); ! return ROADMAP_US_NOMAP; } *************** *** 235,242 **** int i; ! for (i = RoadMapCountyCacheSize-1; i >= 0; --i) { ! if (RoadMapCountyCache[i].fips == fips) { ! roadmap_locator_remove (i); } } --- 267,277 ---- int i; ! if (RoadMapCountyCache != NULL) { ! for (i = RoadMapCountyCacheSize-1; i >= 0; --i) { ! ! if (RoadMapCountyCache[i].fips == fips) { ! roadmap_locator_remove (i); ! } } } *************** *** 249,252 **** --- 284,288 ---- roadmap_locator_configure(); + if (RoadMapCountyCache == NULL) return 0; count = roadmap_county_count(); *************** *** 277,280 **** --- 313,318 ---- count = roadmap_locator_allocate (fips); + if (count <= 0) return 0; + return roadmap_county_by_position (position, *fips, count); } *************** *** 287,290 **** --- 325,329 ---- count = roadmap_locator_allocate (fips); + if (count <= 0) return 0; state = roadmap_dictionary_locate (RoadMapUsStateDictionary, state_symbol); *************** *** 302,305 **** --- 341,345 ---- roadmap_locator_configure(); + if (RoadMapCountyCache == NULL) return ROADMAP_US_NOMAP; state = roadmap_dictionary_locate (RoadMapUsStateDictionary, state_symbol); *************** *** 328,331 **** --- 368,372 ---- roadmap_locator_configure(); + if (RoadMapCountyCache == NULL) return ROADMAP_US_NOMAP; return roadmap_locator_open (fips); *************** *** 340,343 **** --- 381,385 ---- RoadMapString roadmap_locator_get_state (const char *state) { + if (RoadMapCountyCache == NULL) return 0; return roadmap_dictionary_locate (RoadMapUsStateDictionary, state); } |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:06:48
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11521 Modified Files: roadmap_dbread.c Log Message: roadmap_db_open() does not scan the search path anymore, it opens the specified file Index: roadmap_dbread.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_dbread.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** roadmap_dbread.c 14 Nov 2005 07:08:35 -0000 1.10 --- roadmap_dbread.c 2 Jan 2006 09:06:39 -0000 1.11 *************** *** 28,34 **** * (char *section, roadmap_db_handler *handler); * ! * int roadmap_db_open (char *name, roadmap_db_model *model); * ! * void roadmap_db_activate (char *name); * * roadmap_db *roadmap_db_get_subsection (roadmap_db *parent, char *path); --- 28,35 ---- * (char *section, roadmap_db_handler *handler); * ! * int roadmap_db_open (const char *path, ! * const char *name, roadmap_db_model *model); * ! * void roadmap_db_activate (const char *path, const char *name); * * roadmap_db *roadmap_db_get_subsection (roadmap_db *parent, char *path); *************** *** 41,45 **** * roadmap_db *roadmap_db_get_next (roadmap_db *section); * ! * void roadmap_db_close (char *name); * void roadmap_db_end (void); */ --- 42,46 ---- * roadmap_db *roadmap_db_get_next (roadmap_db *section); * ! * void roadmap_db_close (const char *path, const char *name); * void roadmap_db_end (void); */ *************** *** 59,62 **** --- 60,64 ---- char *name; + char *path; RoadMapFileContext file; *************** *** 83,86 **** --- 85,108 ---- + static roadmap_db_database *roadmap_db_find (const char *path, + const char *name) { + + roadmap_db_database *database; + + for (database = RoadmapDatabaseFirst; + database != NULL; + database = database->next) { + + if ((strcmp (name, database->name) == 0) && + (strcmp (path, database->path) == 0)) { + + return database; + } + } + + return NULL; + } + + static void roadmap_db_make_tree (roadmap_db_database *database, roadmap_db *parent) { *************** *** 313,316 **** --- 335,339 ---- free(database->name); + free(database->path); free(database); } *************** *** 359,396 **** ! int roadmap_db_open (char *name, roadmap_db_model *model, const char *mode) { ! ! char *full_name; ! RoadMapFileContext file; ! ! roadmap_db_database *database; - for (database = RoadmapDatabaseFirst; - database != NULL; - database = database->next) { ! if (strcmp (name, database->name) == 0) { ! roadmap_db_call_activate (database); ! return 1; /* Already open. */ ! } } ! full_name = malloc (strlen(name) + strlen(ROADMAP_DB_TYPE) + 4); ! roadmap_check_allocated(full_name); ! ! strcpy (full_name, name); ! strcat (full_name, ROADMAP_DB_TYPE); ! ! if (roadmap_file_map ("maps", full_name, NULL, mode, &file) == NULL) { ! roadmap_log (ROADMAP_INFO, "cannot open database file %s", full_name); ! free (full_name); return 0; } ! roadmap_log (ROADMAP_INFO, "Opening database file %s", full_name); ! free (full_name); database = malloc(sizeof(*database)); --- 382,407 ---- ! int roadmap_db_open (const char *path, ! const char *name, ! roadmap_db_model *model) { + RoadMapFileContext file; + roadmap_db_database *database = roadmap_db_find (path, name); ! if (database != NULL) { ! roadmap_db_call_activate (database); ! return 1; /* Already open. */ } ! if (roadmap_file_map (path, name, "r", &file) == NULL) { ! roadmap_log (ROADMAP_INFO, ! "cannot open database file %s in %s", name, path); return 0; } ! roadmap_log (ROADMAP_INFO, "Opening database file %s in %s", name, path); database = malloc(sizeof(*database)); *************** *** 399,402 **** --- 410,414 ---- database->file = file; database->name = strdup(name); + database->path = strdup(path); database->base = roadmap_file_base (file); database->size = roadmap_file_size (file); *************** *** 429,451 **** ! void roadmap_db_activate (char *name) { ! ! roadmap_db_database *database; ! ! for (database = RoadmapDatabaseFirst; ! database != NULL; ! database = database->next) { ! ! if (strcmp (name, database->name) == 0) { ! roadmap_log (ROADMAP_DEBUG, "Activating database %s", name); ! roadmap_db_call_activate (database); ! return; ! } } ! roadmap_log ! (ROADMAP_ERROR, "cannot activate database %s (not found)", name); } --- 441,456 ---- ! void roadmap_db_activate (const char *path, const char *name) { ! roadmap_db_database *database = roadmap_db_find (path, name); ! if (database == NULL) { ! roadmap_log ! (ROADMAP_ERROR, "cannot activate database %s (not found)", name); ! return; } ! roadmap_log (ROADMAP_DEBUG, "Activating database %s", name); ! roadmap_db_call_activate (database); } *************** *** 559,574 **** ! void roadmap_db_close (char *name) { ! ! roadmap_db_database *database; ! for (database = RoadmapDatabaseFirst; ! database != NULL; ! database = database->next) { ! if (strcmp (name, database->name) == 0) { ! roadmap_db_close_database (database); ! break; ! } } } --- 564,573 ---- ! void roadmap_db_close (const char *path, const char *name) { ! roadmap_db_database *database = roadmap_db_find (path, name); ! if (database != NULL) { ! roadmap_db_close_database (database); } } |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:06:38
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11492 Modified Files: roadmap_dbread.h Log Message: roadmap_db_open() does not scan the search path anymore, it opens the specified file Index: roadmap_dbread.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_dbread.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** roadmap_dbread.h 14 Nov 2005 07:08:50 -0000 1.3 --- roadmap_dbread.h 2 Jan 2006 09:06:28 -0000 1.4 *************** *** 68,74 **** ! int roadmap_db_open (char *name, roadmap_db_model *model, const char *mode); ! void roadmap_db_activate (char *name); roadmap_db *roadmap_db_get_subsection (roadmap_db *parent, char *path); --- 68,75 ---- ! int roadmap_db_open (const char *path, ! const char *name, roadmap_db_model *model); ! void roadmap_db_activate (const char *path, const char *name); roadmap_db *roadmap_db_get_subsection (roadmap_db *parent, char *path); *************** *** 82,86 **** roadmap_db *roadmap_db_get_next (roadmap_db *section); ! void roadmap_db_close (char *name); void roadmap_db_end (void); --- 83,87 ---- roadmap_db *roadmap_db_get_next (roadmap_db *section); ! void roadmap_db_close (const char *path, const char *name); void roadmap_db_end (void); |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:05:21
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11092 Modified Files: buildus_main.c Log Message: roadmap_file_map() does not scan the search path anymore, it maps the specified file Index: buildus_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildus_main.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** buildus_main.c 14 Nov 2005 07:05:41 -0000 1.9 --- buildus_main.c 2 Jan 2006 09:05:14 -0000 1.10 *************** *** 116,123 **** char *extension; - int extension_index; int fips; - char map_name[64]; DIR *directory; --- 116,121 ---- *************** *** 156,173 **** if (strcmp (extension, ".rdm") != 0) continue; ! extension_index = extension - entry->d_name; ! ! memcpy (map_name, entry->d_name, extension_index); ! map_name[extension_index] = 0; ! ! fips = atoi (map_name + 3); ! buildmap_set_source (map_name); if (! BuildMapSilent) buildmap_info ("scanning the county file..."); ! if (! roadmap_db_open (map_name, RoadMapCountyModel, "r")) { ! buildmap_fatal (0, "cannot open map database %s", map_name); } ! roadmap_db_activate (map_name); buildus_scan_cities (fips); --- 154,167 ---- if (strcmp (extension, ".rdm") != 0) continue; ! fips = atoi (entry->d_name + 3); ! buildmap_set_source (entry->d_name); if (! BuildMapSilent) buildmap_info ("scanning the county file..."); ! if (! roadmap_db_open (BuildMapPath, entry->d_name, RoadMapCountyModel)) { ! buildmap_fatal (0, "cannot open map database %s in %s", ! entry->d_name, BuildMapPath); } ! roadmap_db_activate (BuildMapPath, entry->d_name); buildus_scan_cities (fips); *************** *** 176,180 **** buildus_county_set_position (fips, &edges); ! roadmap_db_close (map_name); } --- 170,174 ---- buildus_county_set_position (fips, &edges); ! roadmap_db_close (BuildMapPath, entry->d_name); } |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:04:55
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10943 Modified Files: dumpmap_main.c Log Message: roadmap_file_map() does not scan the search path anymore, it maps the specified file Index: dumpmap_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/dumpmap_main.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dumpmap_main.c 14 Nov 2005 07:06:03 -0000 1.3 --- dumpmap_main.c 2 Jan 2006 09:04:48 -0000 1.4 *************** *** 263,268 **** const char **leftovers; - char *path = NULL; - char *p; poptContext decoder = --- 263,266 ---- *************** *** 314,329 **** printf ("%s\n", *leftovers); ! /* Get the file name and convert it into a database name. */ ! path = strdup (*leftovers); ! p = strchr (path, '.'); ! if (p != NULL) { ! *p = 0; ! } ! ! if (! roadmap_db_open (path, RoadMapCountyModel, "r")) { roadmap_log (ROADMAP_FATAL, "cannot open the map database"); } - roadmap_db_close (path); leftovers += 1; } --- 312,320 ---- printf ("%s\n", *leftovers); ! if (! roadmap_db_open ("", *leftovers, RoadMapCountyModel)) { roadmap_log (ROADMAP_FATAL, "cannot open the map database"); } + roadmap_db_close ("", *leftovers); leftovers += 1; } |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:03:20
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10635 Modified Files: roadmap_metadata.c Log Message: Add support for multi-valued attributes Index: roadmap_metadata.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_metadata.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_metadata.c 15 Nov 2005 05:05:44 -0000 1.1 --- roadmap_metadata.c 2 Jan 2006 09:03:12 -0000 1.2 *************** *** 49,52 **** --- 49,55 ---- int AttributesCount; + RoadMapString *Values; + int ValuesCount; + RoadMapDictionary RoadMapAttributeStrings; *************** *** 61,64 **** --- 64,68 ---- roadmap_db *attributes_table; + roadmap_db *values_table; *************** *** 72,75 **** --- 76,80 ---- attributes_table = roadmap_db_get_subsection (root, "attributes"); + values_table = roadmap_db_get_subsection (root, "values"); context->Attributes = *************** *** 77,80 **** --- 82,88 ---- context->AttributesCount = roadmap_db_get_count (attributes_table); + context->Values = (RoadMapString *) roadmap_db_get_data (values_table); + context->ValuesCount = roadmap_db_get_count (values_table); + if (roadmap_db_get_size (attributes_table) != context->AttributesCount * sizeof(RoadMapAttribute)) { *************** *** 83,86 **** --- 91,100 ---- } + if (roadmap_db_get_size (values_table) != + context->ValuesCount * sizeof(RoadMapString)) { + roadmap_log (ROADMAP_ERROR, "invalid metadata/values structure"); + goto roadmap_metadata_map_abort; + } + return context; *************** *** 138,141 **** --- 152,163 ---- const char *name) { + return roadmap_metadata_get_attribute_next (category, name, 0); + } + + + const char *roadmap_metadata_get_attribute_next (const char *category, + const char *name, + int index) { + int i; RoadMapString coded_category = *************** *** 148,158 **** for (i = RoadMapMetadataActive->AttributesCount - 1; i >= 0; --i) { if (RoadMapMetadataActive->Attributes[i].name == coded_name && RoadMapMetadataActive->Attributes[i].category == coded_category) { return roadmap_dictionary_get (RoadMapMetadataActive->RoadMapAttributeStrings, ! RoadMapMetadataActive->Attributes[i].value); } } return ""; } --- 170,189 ---- for (i = RoadMapMetadataActive->AttributesCount - 1; i >= 0; --i) { + if (RoadMapMetadataActive->Attributes[i].name == coded_name && RoadMapMetadataActive->Attributes[i].category == coded_category) { + + short cursor = + RoadMapMetadataActive->Attributes[i].value_first + index; + + if (index >= RoadMapMetadataActive->Attributes[i].value_count) { + return NULL; + } return roadmap_dictionary_get (RoadMapMetadataActive->RoadMapAttributeStrings, ! RoadMapMetadataActive->Values[cursor]); } } + return ""; } |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:02:45
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10546 Modified Files: roadmap_metadata.h Log Message: Add support for multi-valued attributes Index: roadmap_metadata.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_metadata.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_metadata.h 15 Nov 2005 05:05:52 -0000 1.1 --- roadmap_metadata.h 2 Jan 2006 09:02:37 -0000 1.2 *************** *** 32,35 **** --- 32,39 ---- const char *name); + const char *roadmap_metadata_get_attribute_next (const char *category, + const char *name, + int index); + extern roadmap_db_handler RoadMapMetadataHandler; |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:02:24
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10479 Modified Files: roadmap_db_metadata.h Log Message: Add support for multi-valued attributes Index: roadmap_db_metadata.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_db_metadata.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_db_metadata.h 15 Nov 2005 07:58:58 -0000 1.1 --- roadmap_db_metadata.h 2 Jan 2006 09:02:16 -0000 1.2 *************** *** 26,29 **** --- 26,32 ---- * * metadata/attributes The list of attributes associated with this map. + * metadata/values The list of attributes values. + * + * A single attribute may have a list of values. */ *************** *** 37,45 **** RoadMapString category; RoadMapString name; ! RoadMapString value; ! RoadMapString filler; } RoadMapAttribute; #endif // INCLUDED__ROADMAP_DB_ATTRIBUTES__H --- 40,50 ---- RoadMapString category; RoadMapString name; ! short value_first; ! short value_count; } RoadMapAttribute; + /* Table metadata/values is an array of RoadMapString sorted by attribute. */ + #endif // INCLUDED__ROADMAP_DB_ATTRIBUTES__H |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:01:42
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10238 Modified Files: roadmap_sprite.c Log Message: roadmap_file_map() does not scan the search path anymore, it maps the specified file Index: roadmap_sprite.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_sprite.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** roadmap_sprite.c 14 Nov 2005 07:16:44 -0000 1.10 --- roadmap_sprite.c 2 Jan 2006 09:01:34 -0000 1.11 *************** *** 33,36 **** --- 33,37 ---- #include "roadmap_math.h" #include "roadmap_file.h" + #include "roadmap_scan.h" #include "roadmap_canvas.h" #include "roadmap_sprite.h" *************** *** 311,315 **** ! static void roadmap_sprite_load_file (const char *data, int size) { int argc; --- 312,316 ---- ! static void roadmap_sprite_load_text (const char *data, int size) { int argc; *************** *** 435,438 **** --- 436,456 ---- + static void roadmap_sprite_load_file (const char *path) { + + RoadMapFileContext file; + + if (roadmap_file_map (path, "sprites", "r", &file) == NULL) { + + roadmap_log (ROADMAP_ERROR, "cannot map file sprites in %s", path); + + } else { + roadmap_sprite_load_text + (roadmap_file_base(file), roadmap_file_size(file)); + + roadmap_file_unmap (&file); + } + } + + static void roadmap_sprite_resolve_aliases (void) { *************** *** 572,596 **** RoadMapSprite sprite; - RoadMapFileContext file; ! for (cursor = roadmap_file_map ("config", "sprites", NULL, "r", &file); cursor != NULL; ! cursor = roadmap_file_map ("config", "sprites", cursor, "r", &file)) { ! ! roadmap_sprite_load_file ! (roadmap_file_base(file), roadmap_file_size(file)); ! roadmap_file_unmap (&file); } ! for (cursor = roadmap_file_map ("user", "sprites", NULL, "r", &file); cursor != NULL; ! cursor = roadmap_file_map ("user", "sprites", cursor, "r", &file)) { ! ! roadmap_sprite_load_file ! (roadmap_file_base(file), roadmap_file_size(file)); ! roadmap_file_unmap (&file); } --- 590,607 ---- RoadMapSprite sprite; ! for (cursor = roadmap_scan ("config", "sprites"); cursor != NULL; ! cursor = roadmap_scan_next ("config", "sprites", cursor)) { ! roadmap_sprite_load_file (cursor); } ! for (cursor = roadmap_scan ("user", "sprites"); cursor != NULL; ! cursor = roadmap_scan_next ("user", "sprites", cursor)) { ! roadmap_sprite_load_file (cursor); } *************** *** 601,605 **** const char *hardcoded = "S Default\nF black 1\nP -4,-4 4,-4 4,4 -4,4\n"; ! roadmap_sprite_load_file (hardcoded, strlen(hardcoded)); RoadMapSpriteDefault = roadmap_sprite_search ("Default"); --- 612,616 ---- const char *hardcoded = "S Default\nF black 1\nP -4,-4 4,-4 4,4 -4,4\n"; ! roadmap_sprite_load_text (hardcoded, strlen(hardcoded)); RoadMapSpriteDefault = roadmap_sprite_search ("Default"); |
From: Pascal F M. <pas...@us...> - 2006-01-02 09:00:39
|
Update of /cvsroot/roadmap/roadmap/src/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9774 Modified Files: roadmap_file.c Log Message: roadmap_file_map() does not scan the search path anymore, it maps the specified file Index: roadmap_file.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/win32/roadmap_file.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** roadmap_file.c 16 Oct 2005 05:11:34 -0000 1.2 --- roadmap_file.c 2 Jan 2006 09:00:31 -0000 1.3 *************** *** 35,41 **** struct RoadMapFileContextStructure { ! HANDLE hFile; ! void *base; ! int size; }; --- 35,42 ---- struct RoadMapFileContextStructure { ! HANDLE hFile; ! void *base; ! int size; ! LPWSTR name; }; *************** *** 230,240 **** ! const char *roadmap_file_map (const char *set, ! const char *name, ! const char *sequence, ! RoadMapFileContext *file) { RoadMapFileContext context; DWORD file_size; context = malloc (sizeof(*context)); --- 231,243 ---- ! const char *roadmap_file_map (const char *path, ! const char *name, ! const char *mode, ! RoadMapFileContext *file) { RoadMapFileContext context; DWORD file_size; + char *full_name; + context = malloc (sizeof(*context)); *************** *** 243,315 **** context->hFile = INVALID_HANDLE_VALUE; context->base = NULL; context->size = 0; if (name[0] == '\\') { ! LPWSTR name_unicode = ConvertToUNICODE(name); ! context->hFile = CreateFileForMapping( ! name_unicode, GENERIC_READ , FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - free(name_unicode); - sequence = ""; /* Whatever, but NULL. */ - - } else { - - char *full_name; - LPWSTR full_name_unicode; - - int full_name_size; - int name_size = strlen(name); - int size; - - - if (sequence == NULL) { - sequence = roadmap_path_first(set); - } else { - sequence = roadmap_path_next(set, sequence); - } - if (sequence == NULL) { - return NULL; - } - - full_name_size = 512; - full_name = malloc (full_name_size); - roadmap_check_allocated(full_name); - - do { - size = strlen(sequence) + name_size + 2; - - if (size >= full_name_size) { - full_name = realloc (full_name, size); - roadmap_check_allocated(full_name); - full_name_size = size; - } - - strcpy (full_name, sequence); - strcat (full_name, "\\"); - strcat (full_name, name); - - full_name_unicode = ConvertToUNICODE(full_name); - context->hFile = CreateFileForMapping( - full_name_unicode, - GENERIC_READ , - FILE_SHARE_READ, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, NULL); - free(full_name_unicode); - - if (context->hFile != INVALID_HANDLE_VALUE) break; - - sequence = roadmap_path_next(set, sequence); - - } while (sequence != NULL); - - free (full_name); - } if (context->hFile == INVALID_HANDLE_VALUE ) { ! if (sequence == 0) { ! roadmap_log (ROADMAP_INFO, "cannot open file %s", name); ! } roadmap_file_unmap (&context); return NULL; --- 246,267 ---- context->hFile = INVALID_HANDLE_VALUE; context->base = NULL; + context->name = NULL; context->size = 0; if (name[0] == '\\') { ! full_name = name; ! } else { ! full_name = roadmap_path_join (path, name); ! } ! context->name = ConvertToUNICODE(name); ! ! context->hFile = CreateFileForMapping( ! context->name, GENERIC_READ , FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (context->hFile == INVALID_HANDLE_VALUE ) { ! roadmap_log (ROADMAP_INFO, "cannot open file %s", name); roadmap_file_unmap (&context); return NULL; *************** *** 319,329 **** if (file_size == INVALID_FILE_SIZE) { ! if (sequence == 0) { ! roadmap_log (ROADMAP_ERROR, "cannot stat file %s", name); ! } roadmap_file_unmap (&context); return NULL; } - context->size = file_size; --- 271,278 ---- if (file_size == INVALID_FILE_SIZE) { ! roadmap_log (ROADMAP_ERROR, "cannot get size of file %s", name); roadmap_file_unmap (&context); return NULL; } context->size = file_size; *************** *** 335,350 **** if (context->hFile == INVALID_HANDLE_VALUE) { ! if (sequence == 0) { ! roadmap_log (ROADMAP_INFO, "cannot open file %s", name); ! } roadmap_file_unmap (&context); return NULL; } ! context->base = ! MapViewOfFile( ! context->hFile, ! FILE_MAP_READ, ! 0,0,0 ); if (context->base == NULL) { --- 284,293 ---- if (context->hFile == INVALID_HANDLE_VALUE) { ! roadmap_log (ROADMAP_INFO, "cannot open file %s", name); roadmap_file_unmap (&context); return NULL; } ! context->base = MapViewOfFile(context->hFile, FILE_MAP_READ, 0, 0, 0 ); if (context->base == NULL) { *************** *** 356,360 **** *file = context; ! return sequence; /* Indicate the next directory in the path. */ } --- 299,303 ---- *file = context; ! return context->base; } *************** *** 389,392 **** --- 332,336 ---- CloseHandle(context->hFile); } + free(context->name); free(context); *file = NULL; |