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-02-04 09:16:30
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23261 Modified Files: rdmxchange_main.c Log Message: Add import code, debugged version Index: rdmxchange_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/rdmxchange_main.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** rdmxchange_main.c 15 Jan 2006 03:07:47 -0000 1.3 --- rdmxchange_main.c 4 Feb 2006 09:16:22 -0000 1.4 *************** *** 9,14 **** * 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, --- 9,13 ---- * 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, as of version 2 of the License. * * RoadMap is distributed in the hope that it will be useful, *************** *** 39,55 **** static roadmap_db_model *RdmMapModel = NULL; - static roadmap_db_model *RdmIndexModel = NULL; static char *RdmXchangePath = "."; static int RdmXchangeVerbose = 0; #define RDMXCHANGE_MAX_MODULES 256 ! static RdmXchangeExport *RdmXchangeExportList[RDMXCHANGE_MAX_MODULES]; static int RdmXchangeExportRegistered = 0; ! void rdmxchange_main_register_export (RdmXchangeExport *export) { int i; --- 38,234 ---- static roadmap_db_model *RdmMapModel = NULL; static char *RdmXchangePath = "."; static int RdmXchangeVerbose = 0; + static int RdmXchangeDebug = 0; #define RDMXCHANGE_MAX_MODULES 256 ! static const RdmXchangeExport *RdmXchangeExportList[RDMXCHANGE_MAX_MODULES]; static int RdmXchangeExportRegistered = 0; ! static const RdmXchangeImport *RdmXchangeImportList[RDMXCHANGE_MAX_MODULES]; ! static int RdmXchangeImportLength[RDMXCHANGE_MAX_MODULES]; ! static int RdmXchangeImportRegistered = 0; ! ! ! static void rdmxchange_main_trim (char *text) { ! ! char *eol; ! ! eol = strchr (text, '\n'); ! if (eol != NULL) *eol = 0; ! } ! ! ! static int rdmxchange_main_split (char *text, char *field[], int max) { ! ! int i; ! char *p; ! ! ! rdmxchange_main_trim (text); ! ! field[0] = text; ! p = strchr (text, ','); ! ! for (i = 1; p != NULL && *p != 0; ++i) { ! ! *p = 0; ! if (i >= max) { ! buildmap_fatal ((int)(p - text), "too many fields"); ! } ! field[i] = ++p; ! ! p = strchr (p, ','); ! } ! ! return i; ! } ! ! ! static const RdmXchangeImport *rdmxchange_main_search (const char *table) { ! ! int i; ! ! for (i = RdmXchangeImportRegistered - 1; i >= 0; --i) { ! ! int length = RdmXchangeImportLength[i]; ! ! if (strncmp (RdmXchangeImportList[i]->type, table, length) == 0) { ! ! if ((table[length] == '/') || (table[length] == 0)) { ! return RdmXchangeImportList[i]; ! } ! } ! } ! buildmap_fatal (1, "unknown table %s", table); ! return NULL; ! } ! ! ! static void rdmxchange_main_analyse (FILE *input) { ! ! int line_count; ! int count; ! int table_index; ! char *field[256]; ! char table_name[1024]; ! char buffer[1024]; ! const RdmXchangeImport *importer; ! ! line_count = 0; ! ! /* Analyze all the table declarations. */ ! ! while (! feof(input)) { ! ! if (fgets (buffer, sizeof(buffer), input) == NULL) return; ! ! buildmap_set_line (++line_count); ! ! /* The first empty line signals the end of the table declarations. */ ! if (buffer[0] == '\n' || buffer[0] == 0) break; ! ! if (RdmXchangeDebug) { ! printf ("%s", buffer); ! fflush(stdout); ! } ! if (rdmxchange_main_split (buffer, field, 256) != 2) { ! buildmap_fatal (1, "invalid table descriptor"); ! } ! ! importer = rdmxchange_main_search (field[0]); ! if (importer == NULL) continue; ! ! count = atoi(field[1]); ! if (count <= 0) { ! buildmap_fatal (2, "%s: invalid record count %d", field[0], count); ! } ! ! importer->table (field[0], count); ! } ! ! /* Analyze the data records, table per table. */ ! ! while (! feof(input)) { ! ! /* read the table name. */ ! ! if (fgets (table_name, sizeof(table_name), input) == NULL) return; ! ! buildmap_set_line (++line_count); ! if (table_name[0] == '\n' || table_name[0] == 0) continue; ! ! if (RdmXchangeDebug) { ! printf ("%s", table_name); ! fflush(stdout); ! } ! rdmxchange_main_trim (table_name); ! importer = rdmxchange_main_search (table_name); ! ! ! /* Read the field line. */ ! ! if (fgets (buffer, sizeof(buffer), input) == NULL) return; ! ! buildmap_set_line (++line_count); ! if (buffer[0] == '\n' || buffer[0] == 0) continue; ! ! if (RdmXchangeDebug) { ! printf ("%s", buffer); ! fflush(stdout); ! } ! count = rdmxchange_main_split (buffer, field, 256); ! table_index = importer->schema (table_name, field, count); ! ! ! /* Read the data records until we find an empty line. */ ! ! while (! feof(input)) { ! ! if (fgets (buffer, sizeof(buffer), input) == NULL) return; ! ! buildmap_set_line (++line_count); ! if (buffer[0] == '\n' || buffer[0] == 0) break; ! ! if (importer == NULL) continue; ! ! if (RdmXchangeDebug) { ! printf ("%s", buffer); ! fflush(stdout); ! } ! count = rdmxchange_main_split (buffer, field, 256); ! importer->data (table_index, field, count); ! } ! } ! } ! ! ! static void rdmxchange_main_declare (const roadmap_db_handler *dbhandler, ! const RdmXchangeImport *importer) { ! ! /* Declare the export side (map reader). */ ! ! RdmMapModel = roadmap_db_register (RdmMapModel, dbhandler->name, dbhandler); ! ! ! /* Declare the import side (import code). */ ! ! if (RdmXchangeImportRegistered >= RDMXCHANGE_MAX_MODULES) { ! fprintf (stderr, "too many tables\n"); ! exit(1); ! } ! RdmXchangeImportLength[RdmXchangeImportRegistered] = strlen(importer->type); ! RdmXchangeImportList[RdmXchangeImportRegistered++] = importer; ! } ! ! ! /* The export list is dynamic, since we don't need to export a table ! * if that table is not present in the map file. ! */ ! void rdmxchange_main_register_export (const RdmXchangeExport *export) { int i; *************** *** 69,72 **** --- 248,258 ---- + int rdmxchange_import_int (const char *data) { + + if (data[0] == 0) return 0; + return atoi(data); + } + + /* Main program. ----------------------------------------------------------- */ *************** *** 77,107 **** ! RdmMapModel = ! roadmap_db_register (RdmMapModel, "zip", &RoadMapZipExport); ! RdmMapModel = ! roadmap_db_register (RdmMapModel, "street", &RoadMapStreetExport); ! RdmMapModel = ! roadmap_db_register (RdmMapModel, "range", &RoadMapRangeExport); ! RdmMapModel = ! roadmap_db_register (RdmMapModel, "polygon", &RoadMapPolygonExport); ! RdmMapModel = ! roadmap_db_register (RdmMapModel, "shape", &RoadMapShapeExport); ! RdmMapModel = ! roadmap_db_register (RdmMapModel, "line", &RoadMapLineExport); ! RdmMapModel = ! roadmap_db_register (RdmMapModel, "point", &RoadMapPointExport); ! RdmMapModel = ! roadmap_db_register (RdmMapModel, "square", &RoadMapSquareExport); ! RdmMapModel = ! roadmap_db_register (RdmMapModel, "metadata", &RoadMapMetadataExport); ! RdmMapModel = ! roadmap_db_register (RdmMapModel, "string", &RoadMapDictionaryExport); ! ! RdmIndexModel = ! roadmap_db_register (RdmIndexModel, "index", &RoadMapIndexExport); ! RdmIndexModel = ! roadmap_db_register (RdmIndexModel, "metadata", &RoadMapMetadataExport); ! RdmIndexModel = ! roadmap_db_register (RdmIndexModel, "string", &RoadMapDictionaryExport); --- 263,278 ---- ! rdmxchange_main_declare (&RoadMapZipExport, &RdmXchangeZipImport); ! rdmxchange_main_declare (&RoadMapStreetExport, &RdmXchangeStreetImport); ! rdmxchange_main_declare (&RoadMapRangeExport, &RdmXchangeRangeImport); ! rdmxchange_main_declare (&RoadMapPolygonExport, &RdmXchangePolygonImport); ! rdmxchange_main_declare (&RoadMapShapeExport, &RdmXchangeShapeImport); ! rdmxchange_main_declare (&RoadMapLineExport, &RdmXchangeLineImport); ! rdmxchange_main_declare (&RoadMapPointExport, &RdmXchangePointImport); ! rdmxchange_main_declare (&RoadMapSquareExport, &RdmXchangeSquareImport); ! rdmxchange_main_declare (&RoadMapIndexExport, &RdmXchangeIndexImport); ! rdmxchange_main_declare (&RoadMapMetadataExport, &RdmXchangeMetadataImport); ! rdmxchange_main_declare (&RoadMapDictionaryExport, ! &RdmXchangeDictionaryImport); *************** *** 114,118 **** if (strcasecmp (argv[i], "-h") == 0 || strcasecmp (argv[i], "--help") == 0) { ! printf ("Usage: rdmxchange [-v|--verbose] file ...\n"); exit(0); } --- 285,289 ---- if (strcasecmp (argv[i], "-h") == 0 || strcasecmp (argv[i], "--help") == 0) { ! printf ("Usage: rdmxchange [-v|--verbose] [--path=path] file ...\n"); exit(0); } *************** *** 123,129 **** RdmXchangeVerbose = 1; } ! else if (strncasecmp (argv[i], "--output=", 9) == 0) { ! RdmXchangePath = strdup(argv[i]+9); } else { --- 294,304 ---- RdmXchangeVerbose = 1; } ! else if (strcasecmp (argv[i], "--debug") == 0) { ! RdmXchangeDebug = 1; ! } ! else if (strncasecmp (argv[i], "--path=", 7) == 0) { ! ! RdmXchangePath = strdup(argv[i]+7); } else { *************** *** 136,140 **** /* This is a file to import or export. */ ! FILE *output; char *fullname; --- 311,315 ---- /* This is a file to import or export. */ ! FILE *io; char *fullname; *************** *** 143,147 **** if (extension == NULL) { ! fprintf (stderr, "invalid input file %s\n", argv[i]); exit(1); } --- 318,322 ---- if (extension == NULL) { ! fprintf (stderr, "invalid input file %s (no extension)\n", argv[i]); exit(1); } *************** *** 149,171 **** if (strcmp (extension, ".rdm") == 0) { ! /* This is a file to export. */ int export; - roadmap_db_model *model; ! if (strcmp (basename, "index.rdm") == 0) { ! ! model = RdmIndexModel; ! ! } else if (strcmp (basename, "usdir.rdm") == 0) { fprintf (stderr, "obsolete US directory file found. Skipped.\n"); free (basename); continue; - - } else { - - model = RdmMapModel; } --- 324,337 ---- if (strcmp (extension, ".rdm") == 0) { ! /* --- This is a file to export. */ int export; ! if (strcmp (basename, "usdir.rdm") == 0) { fprintf (stderr, "obsolete US directory file found. Skipped.\n"); free (basename); continue; } *************** *** 173,177 **** RdmXchangeExportRegistered = 0; ! if (! roadmap_db_open ("", argv[i], model)) { fprintf (stderr, "cannot open map database %s", argv[i]); exit(1); --- 339,343 ---- RdmXchangeExportRegistered = 0; ! if (! roadmap_db_open ("", argv[i], RdmMapModel)) { fprintf (stderr, "cannot open map database %s", argv[i]); exit(1); *************** *** 182,187 **** fullname = roadmap_path_join (RdmXchangePath, basename); ! output = fopen (fullname, "w"); ! if (output == NULL) { fprintf (stderr, "cannot open output file %s", fullname); exit(1); --- 348,353 ---- fullname = roadmap_path_join (RdmXchangePath, basename); ! io = fopen (fullname, "w"); ! if (io == NULL) { fprintf (stderr, "cannot open output file %s", fullname); exit(1); *************** *** 189,208 **** for (export = 0; export < RdmXchangeExportRegistered; ++export) { ! RdmXchangeExportList[export]->head (output); } ! fprintf (output, "\n"); for (export = 0; export < RdmXchangeExportRegistered; ++export) { ! RdmXchangeExportList[export]->data (output); } ! fclose (output); roadmap_db_close ("", argv[i]); roadmap_path_free (fullname); ! } else if (strcmp (argv[i], ".rdx") == 0) { ! /* This is a file to import. */ } else { --- 355,392 ---- for (export = 0; export < RdmXchangeExportRegistered; ++export) { ! RdmXchangeExportList[export]->head (io); } ! fprintf (io, "\n"); for (export = 0; export < RdmXchangeExportRegistered; ++export) { ! RdmXchangeExportList[export]->data (io); } ! fclose (io); roadmap_db_close ("", argv[i]); roadmap_path_free (fullname); ! } else if (strcmp (extension, ".rdx") == 0) { ! /* --- This is a file to import. */ ! ! io = fopen (argv[i], "r"); ! if (io == NULL) { ! fprintf (stderr, "cannot open input file %s", argv[i]); ! exit(1); ! } ! buildmap_set_source (argv[i]); ! rdmxchange_main_analyse (io); ! fclose (io); ! ! strcpy (extension, ".rdm"); ! ! if (buildmap_db_open (RdmXchangePath, basename) < 0) { ! fprintf (stderr, "cannot create map database %s", basename); ! exit(1); ! } ! buildmap_db_save (); ! buildmap_db_close (); } else { |
From: Pascal F M. <pas...@us...> - 2006-02-04 09:16:03
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23025 Modified Files: rdmxchange_line.c Log Message: Add import code, debugged version Index: rdmxchange_line.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/rdmxchange_line.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rdmxchange_line.c 11 Jan 2006 09:53:59 -0000 1.2 --- rdmxchange_line.c 4 Feb 2006 09:15:50 -0000 1.3 *************** *** 9,14 **** * 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, --- 9,13 ---- * 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, as of version 2 of the License. * * RoadMap is distributed in the hope that it will be useful, *************** *** 152,156 **** roadmap_db_handler RoadMapLineExport = { ! "dictionary", roadmap_line_map, roadmap_line_activate, --- 151,155 ---- roadmap_db_handler RoadMapLineExport = { ! "line", roadmap_line_map, roadmap_line_activate, *************** *** 161,174 **** static void rdmxchange_line_export_head (FILE *file) { ! fprintf (file, "table line/data %d\n", RoadMapLineActive->LineCount); ! fprintf (file, "table line/bysquare1 %d\n", RoadMapLineActive->LineBySquare1Count); ! fprintf (file, "table line/index2 %d\n", RoadMapLineActive->LineIndex2Count); ! fprintf (file, "table line/bysquare2 %d\n", RoadMapLineActive->LineBySquare2Count); } --- 160,173 ---- static void rdmxchange_line_export_head (FILE *file) { ! fprintf (file, "line/data,%d\n", RoadMapLineActive->LineCount); ! fprintf (file, "line/bysquare1,%d\n", RoadMapLineActive->LineBySquare1Count); ! fprintf (file, "line/index2,%d\n", RoadMapLineActive->LineIndex2Count); ! fprintf (file, "line/bysquare2,%d\n", RoadMapLineActive->LineBySquare2Count); } *************** *** 184,188 **** ! fprintf (file, "table line/data\n" "from,to\n"); line = RoadMapLineActive->Line; --- 183,187 ---- ! fprintf (file, "line/data\n" "from,to\n"); line = RoadMapLineActive->Line; *************** *** 194,198 **** ! fprintf (file, "table line/bysquare1\n" "first[%d],last\n", ROADMAP_CATEGORY_RANGE); bysquare = RoadMapLineActive->LineBySquare1; --- 193,197 ---- ! fprintf (file, "line/bysquare1\n" "first[%d],last\n", ROADMAP_CATEGORY_RANGE); bysquare = RoadMapLineActive->LineBySquare1; *************** *** 207,211 **** ! fprintf (file, "table line/index2\n" "index\n"); index2 = RoadMapLineActive->LineIndex2; --- 206,210 ---- ! fprintf (file, "line/index2\n" "index\n"); index2 = RoadMapLineActive->LineIndex2; *************** *** 217,221 **** ! fprintf (file, "table line/bysquare2\n" "first[%d],last\n", ROADMAP_CATEGORY_RANGE); bysquare = RoadMapLineActive->LineBySquare2; --- 216,220 ---- ! fprintf (file, "line/bysquare2\n" "first[%d],last\n", ROADMAP_CATEGORY_RANGE); bysquare = RoadMapLineActive->LineBySquare2; *************** *** 241,242 **** --- 240,504 ---- } + + /* The import side. ----------------------------------------------------- */ + + static RoadMapLine *Line = NULL; + static int *LineIndex2 = NULL; + static RoadMapLineBySquare *LineSquare1 = NULL; + static RoadMapLineBySquare *LineSquare2 = NULL; + static int LineCount = 0; + static int LineIndex2Count = 0; + static int LineSquare1Count = 0; + static int LineSquare2Count = 0; + static int LineCursor = 0; + + + static void rdmxchange_line_save (void) { + + int i; + int *db_index2; + RoadMapLine *db_lines; + RoadMapLineBySquare *db_square1; + RoadMapLineBySquare *db_square2; + + buildmap_db *root; + buildmap_db *data_table; + buildmap_db *square1_table; + buildmap_db *index2_table; + buildmap_db *square2_table; + + + /* Create the tables. */ + + root = buildmap_db_add_section (NULL, "line"); + if (root == NULL) buildmap_fatal (0, "Can't add a new section"); + + data_table = buildmap_db_add_section (root, "data"); + if (data_table == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (data_table, LineCount, sizeof(RoadMapLine)); + + square1_table = buildmap_db_add_section (root, "bysquare1"); + if (square1_table == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (square1_table, + LineSquare1Count, sizeof(RoadMapLineBySquare)); + + index2_table = buildmap_db_add_section (root, "index2"); + if (index2_table == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (index2_table, LineIndex2Count, sizeof(int)); + + square2_table = buildmap_db_add_section (root, "bysquare2"); + if (square2_table == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (square2_table, + LineSquare2Count, sizeof(RoadMapLineBySquare)); + + db_lines = (RoadMapLine *) buildmap_db_get_data (data_table); + db_square1 = (RoadMapLineBySquare *) buildmap_db_get_data (square1_table); + db_index2 = (int *) buildmap_db_get_data (index2_table); + db_square2 = (RoadMapLineBySquare *) buildmap_db_get_data (square2_table); + + /* Fill in the data. */ + + for (i = 0; i < LineCount; ++i) { + db_lines[i] = Line[i]; + } + + for (i = 0; i < LineSquare1Count; ++i) { + db_square1[i] = LineSquare1[i]; + } + + for (i = 0; i < LineIndex2Count; ++i) { + db_index2[i] = LineIndex2[i]; + } + + for (i = 0; i < LineSquare2Count; ++i) { + db_square2[i] = LineSquare2[i]; + } + + /* Do not save this data ever again. */ + free (Line); + Line = NULL; + LineCount = 0; + + free (LineSquare1); + LineSquare1 = NULL; + LineSquare1Count = 0; + + free (LineIndex2); + LineIndex2 = NULL; + LineIndex2Count = 0; + + free (LineSquare2); + LineSquare2 = NULL; + LineSquare2Count = 0; + } + + + static buildmap_db_module RdmXchangeLineModule = { + "line", + NULL, + rdmxchange_line_save, + NULL, + NULL + }; + + + static void rdmxchange_line_import_table (const char *name, int count) { + + buildmap_db_register (&RdmXchangeLineModule); + + if (strcmp (name, "line/data") == 0) { + + if (Line != NULL) free (Line); + + Line = calloc (count, sizeof(RoadMapLine)); + LineCount = count; + + } else if (strcmp (name, "line/bysquare1") == 0) { + + if (LineSquare1 != NULL) free (LineSquare1); + + LineSquare1 = calloc (count, sizeof(RoadMapLineBySquare)); + LineSquare1Count = count; + + } else if (strcmp (name, "line/index2") == 0) { + + if (LineIndex2 != NULL) free (LineIndex2); + + LineIndex2 = calloc (count, sizeof(int)); + LineIndex2Count = count; + + } else if (strcmp (name, "line/bysquare2") == 0) { + + if (LineSquare2 != NULL) free (LineSquare2); + + LineSquare2 = calloc (count, sizeof(RoadMapLineBySquare)); + LineSquare2Count = count; + + } else { + + buildmap_fatal (1, "invalid table name %s", name); + } + } + + + static int rdmxchange_line_bad_square (char *fields[], int count) { + + char first_name[64]; + + snprintf (first_name, sizeof(first_name), + "first[%d]", ROADMAP_CATEGORY_RANGE); + + if ((count != 2) || + (strcmp(fields[0], first_name) != 0) || + (strcmp(fields[1], "last") != 0)) { + return 1; + } + + return 0; + } + + static int rdmxchange_line_import_schema (const char *table, + char *fields[], int count) { + + LineCursor = 0; + + if (strcmp (table, "line/data") == 0) { + + if (Line == NULL || + count != 2 || + (strcmp(fields[0], "from") != 0) || + (strcmp(fields[1], "to") != 0)) { + buildmap_fatal (1, "invalid schema for table %s", table); + } + return 1; + + } else if (strcmp (table, "line/bysquare1") == 0) { + + if (LineSquare1 == NULL || rdmxchange_line_bad_square(fields, count)) { + buildmap_fatal (1, "invalid schema for table %s", table); + } + return 2; + + } else if (strcmp (table, "line/index2") == 0) { + + if ((LineIndex2 == NULL) || + (count != 1) || (strcmp (fields[0], "index") != 0)) { + buildmap_fatal (1, "invalid schema for table %s", table); + } + return 3; + + } else if (strcmp (table, "line/bysquare2") == 0) { + + if (LineSquare2 == NULL || rdmxchange_line_bad_square(fields, count)) { + buildmap_fatal (1, "invalid schema for table %s", table); + } + return 4; + + } + + buildmap_fatal (1, "invalid table name %s", table); + return 0; + } + + static void rdmxchange_line_import_data (int table, + char *fields[], int count) { + + int i; + + switch (table) { + + case 1: + + if (count != 2) { + buildmap_fatal (count, "invalid line/data record"); + } + Line[LineCursor].from = rdmxchange_import_int (fields[0]); + Line[LineCursor].to = rdmxchange_import_int (fields[1]); + break; + + case 2: + + if (count != ROADMAP_CATEGORY_RANGE + 1) { + buildmap_fatal (count, "invalid line/bysquare record"); + } + for (i = 0; i < ROADMAP_CATEGORY_RANGE; ++i) { + LineSquare1[LineCursor].first[i] = + rdmxchange_import_int (fields[i]); + } + LineSquare1[LineCursor].last = rdmxchange_import_int (fields[i]); + break; + + case 3: + + if (count != 1) { + buildmap_fatal (count, "invalid line/index2 record"); + } + LineIndex2[LineCursor] = rdmxchange_import_int (fields[0]); + break; + + case 4: + + if (count != ROADMAP_CATEGORY_RANGE + 1) { + buildmap_fatal (count, "invalid line/bysquare record"); + } + for (i = 0; i < ROADMAP_CATEGORY_RANGE; ++i) { + LineSquare2[LineCursor].first[i] = + rdmxchange_import_int (fields[i]); + } + LineSquare2[LineCursor].last = rdmxchange_import_int (fields[i]); + break; + + default: + + buildmap_fatal (1, "invalid table"); + } + LineCursor += 1; + } + + + RdmXchangeImport RdmXchangeLineImport = { + "line", + rdmxchange_line_import_table, + rdmxchange_line_import_schema, + rdmxchange_line_import_data + }; |
From: Pascal F M. <pas...@us...> - 2006-02-04 09:15:23
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22874 Modified Files: rdmxchange_index.c Log Message: Add import code, debugged version Index: rdmxchange_index.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/rdmxchange_index.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rdmxchange_index.c 11 Jan 2006 09:53:28 -0000 1.2 --- rdmxchange_index.c 4 Feb 2006 09:15:12 -0000 1.3 *************** *** 9,14 **** * 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, --- 9,13 ---- * 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, as of version 2 of the License. * * RoadMap is distributed in the hope that it will be useful, *************** *** 155,171 **** static void rdmxchange_index_export_head (FILE *file) { ! fprintf (file, "table index/authority %d\n", RoadMapIndexActive->authority_count); ! fprintf (file, "table index/territory %d\n", RoadMapIndexActive->territory_count); ! fprintf (file, "table index/map %d\n", RoadMapIndexActive->map_count); ! fprintf (file, "table index/name %d\n", RoadMapIndexActive->name_count); ! fprintf (file, "table index/city %d\n", RoadMapIndexActive->city_count); } --- 154,170 ---- static void rdmxchange_index_export_head (FILE *file) { ! fprintf (file, "index/authority,%d\n", RoadMapIndexActive->authority_count); ! fprintf (file, "index/territory,%d\n", RoadMapIndexActive->territory_count); ! fprintf (file, "index/map,%d\n", RoadMapIndexActive->map_count); ! fprintf (file, "index/name,%d\n", RoadMapIndexActive->name_count); ! fprintf (file, "index/city,%d\n", RoadMapIndexActive->city_count); } *************** *** 182,186 **** ! fprintf (file, "table index/authority\n" "symbol," "path," --- 181,185 ---- ! fprintf (file, "index/authority\n" "symbol," "path," *************** *** 209,213 **** ! fprintf (file, "table index/territory\n" "wtid," "name," --- 208,212 ---- ! fprintf (file, "index/territory\n" "wtid," "name," *************** *** 243,247 **** ! fprintf (file, "table index/map\n" "class,file\n"); map = RoadMapIndexActive->map; --- 242,246 ---- ! fprintf (file, "index/map\n" "class,file\n"); map = RoadMapIndexActive->map; *************** *** 253,257 **** ! fprintf (file, "table index/name\n" "index\n"); name = RoadMapIndexActive->name; --- 252,256 ---- ! fprintf (file, "index/name\n" "index\n"); name = RoadMapIndexActive->name; *************** *** 263,267 **** ! fprintf (file, "table index/city\n" "index\n"); city = RoadMapIndexActive->city; --- 262,266 ---- ! fprintf (file, "index/city\n" "index\n"); city = RoadMapIndexActive->city; *************** *** 285,286 **** --- 284,633 ---- rdmxchange_main_register_export (&RdmXchangeIndexExport); } + + + /* The import side. ----------------------------------------------------- */ + + static RoadMapAuthority *IndexAuthority = NULL; + static RoadMapTerritory *IndexTerritory = NULL; + static RoadMapMap *IndexMap = NULL; + static RoadMapString *IndexName = NULL; + static RoadMapString *IndexCity = NULL; + static int IndexAuthorityCount = 0; + static int IndexTerritoryCount = 0; + static int IndexMapCount = 0; + static int IndexNameCount = 0; + static int IndexCityCount = 0; + static int IndexCursor = 0; + + + static void rdmxchange_index_save (void) { + + int i; + + 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; + + + /* Create the tables. */ + + root = buildmap_db_add_section (NULL, "index"); + if (root == NULL) buildmap_fatal (1, "cannot create map section"); + + authority_table = buildmap_db_add_section (root, "authority"); + buildmap_db_add_data + (authority_table, IndexAuthorityCount, sizeof(RoadMapAuthority)); + + territory_table = buildmap_db_add_section (root, "territory"); + buildmap_db_add_data + (territory_table, IndexTerritoryCount, sizeof(RoadMapTerritory)); + + map_table = buildmap_db_add_section (root, "map"); + buildmap_db_add_data (map_table, IndexMapCount, sizeof(RoadMapMap)); + + name_table = buildmap_db_add_section (root, "name"); + buildmap_db_add_data (name_table, IndexNameCount, sizeof(RoadMapString)); + + city_table = buildmap_db_add_section (root, "city"); + buildmap_db_add_data (city_table, IndexCityCount, 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); + + + /* Fill the data in. */ + + for (i = 0; i < IndexAuthorityCount; ++i) { + db_authority[i] = IndexAuthority[i]; + } + + for (i = 0; i < IndexTerritoryCount; ++i) { + db_territory[i] = IndexTerritory[i]; + } + + for (i = 0; i < IndexMapCount; ++i) { + db_map[i] = IndexMap[i]; + } + + for (i = 0; i < IndexNameCount; ++i) { + db_name[i] = IndexName[i]; + } + + for (i = 0; i < IndexCityCount; ++i) { + db_city[i] = IndexCity[i]; + } + + /* Do not save this data ever again. */ + free (IndexAuthority); + IndexAuthority = NULL; + IndexAuthorityCount = 0; + + free (IndexTerritory); + IndexTerritory = NULL; + IndexTerritoryCount = 0; + + free (IndexMap); + IndexMap = NULL; + IndexMapCount = 0; + + free (IndexName); + IndexName = NULL; + IndexNameCount = 0; + + free (IndexCity); + IndexCity = NULL; + IndexCityCount = 0; + } + + + static buildmap_db_module RdmXchangeIndexModule = { + "index", + NULL, + rdmxchange_index_save, + NULL, + NULL + }; + + + static void rdmxchange_index_import_table (const char *name, int count) { + + buildmap_db_register (&RdmXchangeIndexModule); + + if (strcmp (name, "index/authority") == 0) { + + if (IndexAuthority != NULL) free (IndexAuthority); + + IndexAuthority = calloc (count, sizeof(RoadMapAuthority)); + IndexAuthorityCount = count; + + } else if (strcmp (name, "index/territory") == 0) { + + if (IndexTerritory != NULL) free (IndexTerritory); + + IndexTerritory = calloc (count, sizeof(RoadMapTerritory)); + IndexTerritoryCount = count; + + } else if (strcmp (name, "index/map") == 0) { + + if (IndexMap != NULL) free (IndexMap); + + IndexMap = calloc (count, sizeof(RoadMapMap)); + IndexMapCount = count; + + } else if (strcmp (name, "index/name") == 0) { + + if (IndexName != NULL) free (IndexName); + + IndexName = calloc (count, sizeof(RoadMapString)); + IndexNameCount = count; + + } else if (strcmp (name, "index/city") == 0) { + + if (IndexCity != NULL) free (IndexCity); + + IndexCity = calloc (count, sizeof(RoadMapString)); + IndexCityCount = count; + + } else { + + buildmap_fatal (1, "invalid table name %s", name); + } + } + + + static int rdmxchange_index_import_schema (const char *table, + char *fields[], int count) { + + IndexCursor = 0; + + if (strcmp (table, "index/authority") == 0) { + + if (IndexAuthority == NULL || + count != 10 || + strcmp(fields[0], "symbol") != 0 || + strcmp(fields[1], "path") != 0 || + strcmp(fields[2], "edges.east") != 0 || + strcmp(fields[3], "edges.north") != 0 || + strcmp(fields[4], "edges.west") != 0 || + strcmp(fields[5], "edges.south") != 0 || + strcmp(fields[6], "name.first") != 0 || + strcmp(fields[7], "name.count") != 0 || + strcmp(fields[8], "territory.first") != 0 || + strcmp(fields[9], "territory.count") != 0) { + buildmap_fatal (1, "invalid schema for table index/authority"); + } + + return 1; + + } else if (strcmp (table, "index/territory") == 0) { + + if (IndexTerritory == NULL || + count != 13 || + strcmp(fields[0], "wtid") != 0 || + strcmp(fields[1], "name") != 0 || + strcmp(fields[2], "path") != 0 || + strcmp(fields[3], "edges.east") != 0 || + strcmp(fields[4], "edges.north") != 0 || + strcmp(fields[5], "edges.west") != 0 || + strcmp(fields[6], "edges.south") != 0 || + strcmp(fields[7], "map.first") != 0 || + strcmp(fields[8], "map.count") != 0 || + strcmp(fields[9], "city.first") != 0 || + strcmp(fields[10], "city.count") != 0 || + strcmp(fields[11], "postal.low") != 0 || + strcmp(fields[12], "postal.high") != 0) { + buildmap_fatal (1, "invalid schema for table index/territory"); + } + + return 2; + + } else if (strcmp (table, "index/map") == 0) { + + if (IndexTerritory == NULL || + count != 2 || + strcmp(fields[0], "class") != 0 || + strcmp(fields[1], "file") != 0) { + buildmap_fatal (1, "invalid schema for table index/map"); + } + + return 3; + + } else if (strcmp (table, "index/name") == 0) { + + if (IndexName == NULL || count != 1 || strcmp(fields[0], "index") != 0) { + buildmap_fatal (1, "invalid schema for table index/name"); + } + + return 4; + + } else if (strcmp (table, "index/city") == 0) { + + if (IndexCity == NULL || count != 1 || strcmp(fields[0], "index") != 0) { + buildmap_fatal (1, "invalid schema for table index/city"); + } + + return 5; + } + + buildmap_fatal (1, "invalid table name %s", table); + return 0; + } + + static void rdmxchange_index_import_data (int table, + char *fields[], int count) { + + switch (table) { + + case 1: + + if (count != 10) { + buildmap_fatal (count, "invalid index/authority record"); + } + IndexAuthority[IndexCursor].symbol = + (RoadMapString) rdmxchange_import_int (fields[0]); + IndexAuthority[IndexCursor].pathname = + (RoadMapString) rdmxchange_import_int (fields[1]); + IndexAuthority[IndexCursor].edges.east = + rdmxchange_import_int (fields[2]); + IndexAuthority[IndexCursor].edges.north = + rdmxchange_import_int (fields[3]); + IndexAuthority[IndexCursor].edges.west = + rdmxchange_import_int (fields[4]); + IndexAuthority[IndexCursor].edges.south = + rdmxchange_import_int (fields[5]); + IndexAuthority[IndexCursor].name_first = + (unsigned short) rdmxchange_import_int (fields[6]); + IndexAuthority[IndexCursor].name_count = + (unsigned short) rdmxchange_import_int (fields[7]); + IndexAuthority[IndexCursor].territory_first = + (unsigned short) rdmxchange_import_int (fields[8]); + IndexAuthority[IndexCursor].territory_count = + (unsigned short) rdmxchange_import_int (fields[9]); + break; + + case 2: + + if (count != 13) { + buildmap_fatal (count, "invalid index/territory record"); + } + IndexTerritory[IndexCursor].wtid = rdmxchange_import_int (fields[0]); + IndexTerritory[IndexCursor].name = + (RoadMapString) rdmxchange_import_int (fields[1]); + IndexTerritory[IndexCursor].pathname = + (RoadMapString) rdmxchange_import_int (fields[2]); + IndexTerritory[IndexCursor].edges.east = + rdmxchange_import_int (fields[3]); + IndexTerritory[IndexCursor].edges.north = + rdmxchange_import_int (fields[4]); + IndexTerritory[IndexCursor].edges.west = + rdmxchange_import_int (fields[5]); + IndexTerritory[IndexCursor].edges.south = + rdmxchange_import_int (fields[6]); + IndexTerritory[IndexCursor].map_first = + (unsigned short) rdmxchange_import_int (fields[7]); + IndexTerritory[IndexCursor].map_count = + (unsigned short) rdmxchange_import_int (fields[8]); + IndexTerritory[IndexCursor].city_first = + (unsigned short) rdmxchange_import_int (fields[9]); + IndexTerritory[IndexCursor].city_count = + (unsigned short) rdmxchange_import_int (fields[10]); + IndexTerritory[IndexCursor].postal_low = + (unsigned int) rdmxchange_import_int (fields[11]); + IndexTerritory[IndexCursor].postal_high = + (unsigned int) rdmxchange_import_int (fields[12]); + break; + + case 3: + + if (count != 2) { + buildmap_fatal (count, "invalid index/map record"); + } + IndexMap[IndexCursor].class = + (RoadMapString) rdmxchange_import_int (fields[0]); + IndexMap[IndexCursor].filename = + (RoadMapString) rdmxchange_import_int (fields[1]); + break; + + case 4: + + if (count != 1) { + buildmap_fatal (count, "invalid index/name record"); + } + IndexName[IndexCursor] = + (RoadMapString) rdmxchange_import_int (fields[0]); + break; + + case 5: + + if (count != 1) { + buildmap_fatal (count, "invalid index/city record"); + } + IndexCity[IndexCursor] = + (RoadMapString) rdmxchange_import_int (fields[0]); + break; + + default: + + buildmap_fatal (1, "invalid table"); + } + } + + + RdmXchangeImport RdmXchangeIndexImport = { + "index", + rdmxchange_index_import_table, + rdmxchange_index_import_schema, + rdmxchange_index_import_data + }; |
From: Pascal F M. <pas...@us...> - 2006-02-04 09:14:45
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22635 Modified Files: rdmxchange.h Log Message: Add import code, debugged version Index: rdmxchange.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/rdmxchange.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** rdmxchange.h 15 Jan 2006 03:07:24 -0000 1.3 --- rdmxchange.h 4 Feb 2006 09:14:34 -0000 1.4 *************** *** 27,32 **** --- 27,37 ---- #include <stdio.h> + #include "roadmap.h" #include "roadmap_dbread.h" + #include "buildmap.h" + + + /* The map export side. ----------------------------------------------- */ typedef void (*RdmXchangeExporter) (FILE *output); *************** *** 42,46 **** ! void rdmxchange_main_register_export (RdmXchangeExport *export); --- 47,51 ---- ! void rdmxchange_main_register_export (const RdmXchangeExport *export); *************** *** 57,60 **** --- 62,101 ---- extern roadmap_db_handler RoadMapRangeExport; + + /* The map import side. ----------------------------------------------- */ + + short rdmxchange_import_short (const char *data); + int rdmxchange_import_int (const char *data); + + + typedef void (*RdmXchangeTableImporter) (const char *table, int count); + typedef int (*RdmXchangeSchemaImporter) (const char *table, + char *fields[], int count); + typedef void (*RdmXchangeDataImporter) (int table, + char *fields[], int count); + + typedef struct { + + const char *type; + + RdmXchangeTableImporter table; + RdmXchangeSchemaImporter schema; + RdmXchangeDataImporter data; + + } RdmXchangeImport; + + + extern RdmXchangeImport RdmXchangeZipImport; + extern RdmXchangeImport RdmXchangeStreetImport; + extern RdmXchangeImport RdmXchangeRangeImport; + extern RdmXchangeImport RdmXchangePolygonImport; + extern RdmXchangeImport RdmXchangeShapeImport; + extern RdmXchangeImport RdmXchangeLineImport; + extern RdmXchangeImport RdmXchangePointImport; + extern RdmXchangeImport RdmXchangeSquareImport; + extern RdmXchangeImport RdmXchangeIndexImport; + extern RdmXchangeImport RdmXchangeMetadataImport; + extern RdmXchangeImport RdmXchangeDictionaryImport; + #endif // INCLUDED__RDMXCHANGE__H |
From: Pascal F M. <pas...@us...> - 2006-02-04 09:14:18
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22450 Modified Files: rdmxchange_dictionary.c Log Message: Add import code, debugged version Index: rdmxchange_dictionary.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/rdmxchange_dictionary.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rdmxchange_dictionary.c 11 Jan 2006 09:52:59 -0000 1.2 --- rdmxchange_dictionary.c 4 Feb 2006 09:14:04 -0000 1.3 *************** *** 9,14 **** * 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, --- 9,13 ---- * 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, as of version 2 of the License. * * RoadMap is distributed in the hope that it will be useful, *************** *** 145,149 **** roadmap_db_handler RoadMapDictionaryExport = { ! "dictionary", rdmxchange_dictionary_map, rdmxchange_dictionary_activate, --- 144,148 ---- roadmap_db_handler RoadMapDictionaryExport = { ! "string", rdmxchange_dictionary_map, rdmxchange_dictionary_activate, *************** *** 158,176 **** for (volume = DictionaryVolume; volume != NULL; volume = volume->next) { ! fprintf (file, "table string/%s/node %d\n", ! volume->name, ! volume->node_count); ! ! fprintf (file, "table string/%s/tree %d\n", volume->name, volume->tree_count); ! fprintf (file, "table string/%s/data %d\n", volume->name, ! volume->size); ! fprintf (file, "table string/%s/index %d\n", volume->name, volume->string_count); } } --- 157,175 ---- for (volume = DictionaryVolume; volume != NULL; volume = volume->next) { ! fprintf (file, "string/%s/tree,%d\n", volume->name, volume->tree_count); ! fprintf (file, "string/%s/node,%d\n", volume->name, ! volume->node_count); ! fprintf (file, "string/%s/index,%d\n", volume->name, volume->string_count); + + fprintf (file, "string/%s/data,%d\n", + volume->name, + volume->size); } } *************** *** 190,194 **** for (volume = DictionaryVolume; volume != NULL; volume = volume->next) { ! fprintf (file, "table string/%s/node\n" "character,type,index\n", volume->name); node = volume->node; --- 189,205 ---- for (volume = DictionaryVolume; volume != NULL; volume = volume->next) { ! fprintf (file, "string/%s/tree\n" ! "first,count,position\n", volume->name); ! tree = volume->tree; ! ! for (i = 0; i < volume->tree_count; ++i, ++tree) { ! fprintf (file, "%.0d,%.0d,%.0d\n", tree->first, ! tree->count, ! tree->position); ! } ! fprintf (file, "\n"); ! ! ! fprintf (file, "string/%s/node\n" "character,type,index\n", volume->name); node = volume->node; *************** *** 206,222 **** ! fprintf (file, "table string/%s/tree\n" ! "first,count,position\n", volume->name); ! tree = volume->tree; ! for (i = 0; i < volume->tree_count; ++i, ++tree) { ! fprintf (file, "%.0d,%.0d,%.0d\n", tree->first, ! tree->count, ! tree->position); } fprintf (file, "\n"); ! fprintf (file, "table string/%s/data\n" "text\n", volume->name); data = volume->data + 1; /* Skip the first (empty) string. */ --- 217,231 ---- ! fprintf (file, "string/%s/index\n" ! "offset\n", volume->name); ! index = volume->string_index; ! for (i = 0; i < volume->string_count; ++i, ++index) { ! fprintf (file, "%d\n", *index); } fprintf (file, "\n"); ! fprintf (file, "string/%s/data\n" "text\n", volume->name); data = volume->data + 1; /* Skip the first (empty) string. */ *************** *** 227,240 **** } fprintf (file, "\n"); - - - fprintf (file, "table string/%s/index\n" - "offset\n", volume->name); - index = volume->string_index; - - for (i = 0; i < volume->string_count; ++i, ++index) { - fprintf (file, "%d\n", *index); - } - fprintf (file, "\n"); } } --- 236,239 ---- *************** *** 242,246 **** static RdmXchangeExport RdmXchangeDictionaryExport = { ! "dictionary", rdmxchange_dictionary_export_head, rdmxchange_dictionary_export_data --- 241,245 ---- static RdmXchangeExport RdmXchangeDictionaryExport = { ! "string", rdmxchange_dictionary_export_head, rdmxchange_dictionary_export_data *************** *** 251,252 **** --- 250,593 ---- rdmxchange_main_register_export (&RdmXchangeDictionaryExport); } + + + /* The import side. ----------------------------------------------------- */ + + static int DictionaryCursor = 0; + static struct dictionary_volume *DictionaryCurrentVolume = 0; + + + static void rdmxchange_dictionary_save_one (buildmap_db *root, + struct dictionary_volume *volume) { + + int i; + + struct roadmap_dictionary_tree *db_tree; + struct roadmap_dictionary_reference *db_node; + unsigned int *db_index; + char *db_data; + + buildmap_db *child; + buildmap_db *table_tree; + buildmap_db *table_node; + buildmap_db *table_index; + buildmap_db *table_data; + + + if (volume->tree == NULL || + volume->node == NULL || + volume->string_index == NULL || + volume->data == NULL) { + buildmap_fatal (1, "incomplete dictionary volume %s", volume->name); + } + + /* Create the tables. */ + + child = buildmap_db_add_section (root, volume->name); + if (child == NULL) { + buildmap_fatal (0, "Cannot add new section %s", volume->name); + } + + table_tree = + buildmap_db_add_child (child, + "tree", + volume->tree_count, + sizeof(struct roadmap_dictionary_tree)); + + table_node = + buildmap_db_add_child (child, + "node", + volume->node_count, + sizeof(struct roadmap_dictionary_reference)); + + table_index = buildmap_db_add_child (child, + "index", + volume->string_count, + sizeof(unsigned int)); + + table_data = buildmap_db_add_child (child, "data", volume->size, 1); + + db_tree = + (struct roadmap_dictionary_tree *) buildmap_db_get_data (table_tree); + db_node = (struct roadmap_dictionary_reference *) + buildmap_db_get_data (table_node); + db_index = (unsigned int *) buildmap_db_get_data (table_index); + db_data = buildmap_db_get_data (table_data); + + + /* Fill the data in. */ + + for (i = 0; i < volume->tree_count; ++i) { + db_tree[i] = volume->tree[i]; + } + for (i = 0; i < volume->node_count; ++i) { + db_node[i] = volume->node[i]; + } + for (i = 0; i < volume->string_count; ++i) { + db_index[i] = volume->string_index[i]; + } + memcpy (db_data, volume->data, volume->size); + + /* Do not save this data ever again. */ + free (volume->tree); + free (volume->node); + free (volume->string_index); + free (volume->data); + free (volume->name); + free (volume); + } + + + static void rdmxchange_dictionary_save (void) { + + buildmap_db *root; + + struct dictionary_volume *volume; + struct dictionary_volume *next; + + + root = buildmap_db_add_section (NULL, "string"); + if (root == NULL) buildmap_fatal (0, "Can't add a new section"); + + for (volume = DictionaryVolume; volume != NULL; volume = next) { + + next = volume->next; + rdmxchange_dictionary_save_one (root, volume); + } + } + + + static buildmap_db_module RdmXchangeDictionaryModule = { + "string", + NULL, + rdmxchange_dictionary_save, + NULL, + NULL + }; + + + static struct dictionary_volume *rdmxchange_dictionary_find (const char *name) { + + struct dictionary_volume *volume; + + for (volume = DictionaryVolume; volume != NULL; volume = volume->next) { + + if (strcmp (name, volume->name) ==0) return volume; + } + return NULL; + } + + + static void rdmxchange_dictionary_import_table (const char *name, int count) { + + char *p; + struct dictionary_volume *volume; + + + buildmap_db_register (&RdmXchangeDictionaryModule); + + if (strncmp (name, "string/", 7) == 0) { + + /* Separate the volume name. */ + + char *volume_name = strdup (name + 7); + + p = strchr (volume_name, '/'); + if (p == NULL) buildmap_fatal (1, "invalid table name %s", name); + *(p++) = 0; + + /* Retrieve the volume, or create a new one. */ + + volume = rdmxchange_dictionary_find (volume_name); + if (volume == NULL) { + volume = calloc (1, sizeof(struct dictionary_volume)); + volume->name = volume_name; + volume->next = DictionaryVolume; + DictionaryVolume = volume; + } else { + free (volume_name); /* We already have a copy in volume->name. */ + } + + /* Now gather the information about the specific table. */ + + if (strcmp (p, "tree") == 0) { + + if (volume->tree != NULL) { + buildmap_fatal (1, "duplicate tree in %s", volume->name); + } + volume->tree = calloc (count, sizeof(struct roadmap_dictionary_tree)); + volume->tree_count = count; + + } else if (strcmp (p, "node") == 0) { + + if (volume->node != NULL) { + buildmap_fatal (1, "duplicate node in %s", volume->name); + } + volume->node = calloc (count, + sizeof(struct roadmap_dictionary_reference)); + volume->node_count = count; + + } else if (strcmp (p, "index") == 0) { + + if (volume->string_index != NULL) { + buildmap_fatal (1, "duplicate index in %s", volume->name); + } + volume->string_index = calloc (count, sizeof (unsigned int)); + volume->string_count = count; + + } else if (strcmp (p, "data") == 0) { + + if (volume->data != NULL) { + buildmap_fatal (1, "duplicate data in %s", volume->name); + } + volume->data = calloc (count, sizeof (char)); + volume->size = count; + + } else { + + buildmap_fatal (1, "invalid table name %s", name); + } + + } else { + + buildmap_fatal (1, "invalid table name %s", name); + } + } + + + static int rdmxchange_dictionary_import_schema (const char *table, + char *fields[], int count) { + + struct dictionary_volume *volume; + + DictionaryCursor = 0; + + if (strncmp (table, "string/", 7) == 0) { + + /* Separate the volume name. */ + + char *volume_name = strdup (table + 7); + char *p = strchr (volume_name, '/'); + + if (p == NULL) buildmap_fatal (1, "invalid table name %s", table); + *(p++) = 0; + + /* Retrieve the volume (it must exist). */ + + volume = rdmxchange_dictionary_find (volume_name); + if (volume == NULL) { + buildmap_fatal (1, "%s: unknown volume", table); + } + DictionaryCurrentVolume = volume; + + if (strcmp (p, "tree") == 0) { + + if (volume->tree == NULL || + count != 3 || + strcmp(fields[0], "first") != 0 || + strcmp(fields[1], "count") != 0 || + strcmp(fields[2], "position") != 0) { + buildmap_fatal (1, "invalid schema for table %s", table); + } + return 1; + + } else if (strcmp (p, "node") == 0) { + + if (volume->node == NULL || + count != 3 || + strcmp(fields[0], "character") != 0 || + strcmp(fields[1], "type") != 0 || + strcmp(fields[2], "index") != 0) { + buildmap_fatal (1, "invalid schema for table %s", table); + } + return 2; + + } else if (strcmp (p, "index") == 0) { + + if (volume->string_index == NULL || + count != 1 || strcmp (fields[0], "offset") != 0) { + buildmap_fatal (1, "invalid schema for table %s", table); + } + return 3; + + } else if (strcmp (p, "data") == 0) { + + if (volume->data == NULL || + count != 1 || strcmp (fields[0], "text") != 0) { + buildmap_fatal (1, "invalid schema for table %s", table); + } + volume->data[0] = 0; + DictionaryCursor = 1; + return 4; + } + } + + buildmap_fatal (1, "invalid table name %s", table); + return 0; + } + + + static void rdmxchange_dictionary_import_data (int table, + char *fields[], int count) { + + switch (table) { + + case 1: + + if (count != 3) { + buildmap_fatal (count, "invalid string tree record"); + } + DictionaryCurrentVolume->tree[DictionaryCursor].first = + (unsigned short) rdmxchange_import_int (fields[0]); + DictionaryCurrentVolume->tree[DictionaryCursor].count = + (unsigned char) rdmxchange_import_int (fields[1]); + DictionaryCurrentVolume->tree[DictionaryCursor].position = + (unsigned char) rdmxchange_import_int (fields[2]); + break; + + case 2: + + if (count != 3) { + buildmap_fatal (count, "invalid string node record"); + } + DictionaryCurrentVolume->node[DictionaryCursor].character = *(fields[0]); + DictionaryCurrentVolume->node[DictionaryCursor].type = + (unsigned char) rdmxchange_import_int (fields[1]); + DictionaryCurrentVolume->node[DictionaryCursor].index = + (unsigned short) rdmxchange_import_int (fields[2]); + break; + + case 3: + + if (count != 1) { + buildmap_fatal (count, "invalid string index record"); + } + DictionaryCurrentVolume->string_index[DictionaryCursor] = + rdmxchange_import_int (fields[0]); + break; + + case 4: + + if (count != 1) { + buildmap_fatal (count, "invalid string data record"); + } + strcpy (DictionaryCurrentVolume->data + DictionaryCursor, fields[0]); + DictionaryCursor += strlen(fields[0]); + break; + + default: + + buildmap_fatal (1, "invalid table"); + } + + DictionaryCursor += 1; + } + + + RdmXchangeImport RdmXchangeDictionaryImport = { + "string", + rdmxchange_dictionary_import_table, + rdmxchange_dictionary_import_schema, + rdmxchange_dictionary_import_data + }; + |
From: Pascal F M. <pas...@us...> - 2006-01-17 06:41:23
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19304 Modified Files: buildmap_zip.c Log Message: Tables start at index 0, like any other C array Index: buildmap_zip.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_zip.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** buildmap_zip.c 16 Jan 2006 20:52:26 -0000 1.5 --- buildmap_zip.c 17 Jan 2006 06:41:15 -0000 1.6 *************** *** 88,92 **** ! for (i = 1; i < ZipCodeCount; i++) { if (ZipCode[i].zip_code == zip) { --- 88,92 ---- ! for (i = 0; i < ZipCodeCount; ++i) { if (ZipCode[i].zip_code == zip) { *************** *** 113,118 **** } - ZipCodeCount += 1; - i = ZipCodeCount; --- 113,116 ---- *************** *** 124,127 **** --- 122,127 ---- ZipCode[i].bounding_box.south = + 0x7fffffff; + ZipCodeCount += 1; + return (RoadMapZip)i; } *************** *** 130,134 **** int buildmap_zip_get_zip_code (RoadMapZip index) { ! if (index <= 0 || index >= ZipCodeCount) { buildmap_fatal (0, "invalid zip index"); } --- 130,134 ---- int buildmap_zip_get_zip_code (RoadMapZip index) { ! if (index >= ZipCodeCount) { buildmap_fatal (0, "invalid zip index"); } *************** *** 140,144 **** int buildmap_zip_get_longitude (RoadMapZip index) { ! if (index <= 0 || index >= ZipCodeCount) { buildmap_fatal (0, "invalid zip index"); } --- 140,144 ---- int buildmap_zip_get_longitude (RoadMapZip index) { ! if (index >= ZipCodeCount) { buildmap_fatal (0, "invalid zip index"); } *************** *** 151,155 **** int buildmap_zip_get_latitude (RoadMapZip index) { ! if (index <= 0 || index >= ZipCodeCount) { buildmap_fatal (0, "invalid zip index"); } --- 151,155 ---- int buildmap_zip_get_latitude (RoadMapZip index) { ! if (index >= ZipCodeCount) { buildmap_fatal (0, "invalid zip index"); } *************** *** 164,168 **** int i; ! for (i = 1; i < ZipCodeCount; i++) { if (ZipCode[i].zip_code == zip) { --- 164,168 ---- int i; ! for (i = 0; i < ZipCodeCount; ++i) { if (ZipCode[i].zip_code == zip) { *************** *** 186,190 **** db_zip = (int *) buildmap_db_get_data (root); ! for (i = 1; i < ZipCodeCount; i++) { db_zip[i] = ZipCode[i].zip_code; } --- 186,190 ---- db_zip = (int *) buildmap_db_get_data (root); ! for (i = 0; i < ZipCodeCount; ++i) { db_zip[i] = ZipCode[i].zip_code; } *************** *** 204,208 **** RoadMapArea area_reset = {0, 0, 0, 0}; ! for (i = 0; i < BUILDMAP_MAX_ZIP; i++) { ZipCode[i].zip_code = 0; --- 204,208 ---- RoadMapArea area_reset = {0, 0, 0, 0}; ! for (i = 0; i < ZipCodeCount; ++i) { ZipCode[i].zip_code = 0; |
From: Pascal F M. <pas...@us...> - 2006-01-17 06:40:31
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19129 Modified Files: roadmap_dbread.c Log Message: Cleanup (use const whenever possible) Index: roadmap_dbread.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_dbread.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** roadmap_dbread.c 2 Jan 2006 09:06:39 -0000 1.11 --- roadmap_dbread.c 17 Jan 2006 06:40:22 -0000 1.12 *************** *** 25,30 **** * #include "roadmap_dbread.h" * ! * roadmap_db_model *roadmap_db_register ! * (char *section, roadmap_db_handler *handler); * * int roadmap_db_open (const char *path, --- 25,31 ---- * #include "roadmap_dbread.h" * ! * roadmap_db_model *roadmap_db_register (const roadmap_db_model *model, ! * const char *section, ! * const roadmap_db_handler *handler); * * int roadmap_db_open (const char *path, *************** *** 179,183 **** (roadmap_db_model *model, roadmap_db *this, char *section) { ! roadmap_db_model *registered; this->handler_context = NULL; --- 180,184 ---- (roadmap_db_model *model, roadmap_db *this, char *section) { ! const roadmap_db_model *registered; this->handler_context = NULL; *************** *** 227,233 **** int done; ! char *section; ! roadmap_db *child; ! roadmap_db_model *registered; --- 228,234 ---- int done; ! const char *section; ! const roadmap_db *child; ! const roadmap_db_model *registered; *************** *** 281,285 **** (roadmap_db_model *model, roadmap_db *this, char *section) { ! roadmap_db_model *registered; for (registered = model; --- 282,286 ---- (roadmap_db_model *model, roadmap_db *this, char *section) { ! const roadmap_db_model *registered; for (registered = model; *************** *** 341,349 **** roadmap_db_model *roadmap_db_register ! (roadmap_db_model *model, ! char *section, ! roadmap_db_handler *handler) { ! roadmap_db_model *registered; /* Check there is not a handler already: */ --- 342,351 ---- roadmap_db_model *roadmap_db_register ! (const roadmap_db_model *model, ! const char *section, ! const roadmap_db_handler *handler) { ! const roadmap_db_model *registered; ! roadmap_db_model *new_model; /* Check there is not a handler already: */ *************** *** 370,382 **** } ! registered = malloc (sizeof(roadmap_db_model)); ! roadmap_check_allocated(registered); ! registered->section = section; ! registered->handler = handler; ! registered->next = model; ! return registered; } --- 372,384 ---- } ! new_model = malloc (sizeof(roadmap_db_model)); ! roadmap_check_allocated(new_model); ! new_model->section = section; ! new_model->handler = handler; ! new_model->next = model; ! return new_model; } |
From: Pascal F M. <pas...@us...> - 2006-01-17 06:40:20
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19093 Modified Files: roadmap_dbread.h Log Message: Cleanup (use const whenever possible) Index: roadmap_dbread.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_dbread.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** roadmap_dbread.h 2 Jan 2006 09:06:28 -0000 1.4 --- roadmap_dbread.h 17 Jan 2006 06:40:13 -0000 1.5 *************** *** 57,69 **** typedef struct roadmap_db_model_s { ! char *section; ! roadmap_db_handler *handler; - struct roadmap_db_model_s *next; } roadmap_db_model; ! roadmap_db_model *roadmap_db_register ! (roadmap_db_model *model, char *section, roadmap_db_handler *handler); --- 57,71 ---- typedef struct roadmap_db_model_s { ! const char *section; ! const roadmap_db_handler *handler; ! ! const struct roadmap_db_model_s *next; } roadmap_db_model; ! roadmap_db_model *roadmap_db_register (const roadmap_db_model *model, ! const char *section, ! const roadmap_db_handler *handler); |
From: Pascal F M. <pas...@us...> - 2006-01-17 06:39:42
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18892 Modified Files: roadmap_hash.c Log Message: Fix typo Index: roadmap_hash.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_hash.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** roadmap_hash.c 16 Jan 2006 20:26:14 -0000 1.5 --- roadmap_hash.c 17 Jan 2006 06:39:34 -0000 1.6 *************** *** 223,227 **** /* This was the last hash created. Remove it from the list. */ ! HashLast = cursor->next_hash; } else { --- 223,227 ---- /* This was the last hash created. Remove it from the list. */ ! HashLast = hash->next_hash; } else { |
From: Pascal F M. <pas...@us...> - 2006-01-16 20:58:07
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4946 Modified Files: roadmap_county.c Log Message: roadmap_hash_free & roadmap_hash_reset were incompatible (list not updated) Index: roadmap_county.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_county.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** roadmap_county.c 14 Nov 2005 07:07:52 -0000 1.10 --- roadmap_county.c 16 Jan 2006 20:57:59 -0000 1.11 *************** *** 156,160 **** } ! roadmap_hash_free (county_context->hash); free (county_context); --- 156,160 ---- } ! roadmap_hash_delete (county_context->hash); free (county_context); |
From: Pascal F M. <pas...@us...> - 2006-01-16 20:57:40
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4879 Modified Files: rdmindex_main.c Log Message: Make buildmap more modular using self registration of the "table" builders Index: rdmindex_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/rdmindex_main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rdmindex_main.c 3 Jan 2006 04:14:11 -0000 1.2 --- rdmindex_main.c 16 Jan 2006 20:57:33 -0000 1.3 *************** *** 84,89 **** buildmap_db_open (RdmIndexPath, RdmIndexName); ! buildmap_dictionary_save (); ! buildmap_index_save (); buildmap_db_close (); --- 84,88 ---- buildmap_db_open (RdmIndexPath, RdmIndexName); ! buildmap_db_save (); buildmap_db_close (); *************** *** 361,371 **** buildmap_set_source (RdmIndexName); ! buildmap_index_sort(); if (RdmIndexVerbose) { roadmap_hash_summary (); ! buildmap_dictionary_summary (); ! buildmap_index_summary (); } --- 360,369 ---- buildmap_set_source (RdmIndexName); ! buildmap_db_sort(); if (RdmIndexVerbose) { roadmap_hash_summary (); ! buildmap_db_summary (); } |
From: Pascal F M. <pas...@us...> - 2006-01-16 20:57:08
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4766 Modified Files: buildus_main.c Log Message: Make buildmap more modular using self registration of the "table" builders Index: buildus_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildus_main.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** buildus_main.c 2 Jan 2006 23:32:21 -0000 1.11 --- buildus_main.c 16 Jan 2006 20:56:57 -0000 1.12 *************** *** 81,86 **** } ! buildmap_dictionary_save (); ! buildus_county_save (); buildmap_db_close (); --- 81,85 ---- } ! buildmap_db_save (); buildmap_db_close (); *************** *** 189,205 **** - buildus_county_initialize (); - buildus_fips_read (BuildMapTiger, BuildMapVerbose); buildus_scan_maps (); ! buildus_county_sort(); if (BuildMapVerbose) { roadmap_hash_summary (); ! buildmap_dictionary_summary (); ! buildus_fips_summary (); } --- 188,201 ---- buildus_fips_read (BuildMapTiger, BuildMapVerbose); buildus_scan_maps (); ! buildmap_db_sort(); if (BuildMapVerbose) { roadmap_hash_summary (); ! buildmap_db_summary (); } |
From: Pascal F M. <pas...@us...> - 2006-01-16 20:55:53
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4594 Modified Files: buildplace_main.c Log Message: Make buildmap more modular using self registration of the "table" builders Index: buildplace_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildplace_main.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** buildplace_main.c 14 Nov 2005 07:05:07 -0000 1.4 --- buildplace_main.c 16 Jan 2006 20:55:44 -0000 1.5 *************** *** 138,152 **** } - static void buildplace_initialize (void) { - - buildmap_point_initialize(); - buildmap_place_initialize(); - } - - - static void buildplace_sort (void) { - - buildmap_place_sort (); - } static void buildplace_save (const char *name) { --- 138,141 ---- *************** *** 168,175 **** } ! buildmap_square_save (); ! buildmap_point_save (); ! buildmap_dictionary_save (); ! buildmap_place_save (); buildmap_db_close (); --- 157,161 ---- } ! buildmap_db_save (); buildmap_db_close (); *************** *** 188,202 **** - static void buildplace_reset (void) { - - buildmap_square_reset (); - buildmap_point_reset (); - buildmap_place_reset (); - buildmap_dictionary_reset (); - roadmap_hash_reset (); - buildplace_dsg_reset (); - } - - static void buildplace_dsg_initialize (void) { int i; --- 174,177 ---- *************** *** 370,375 **** int verbose) { - buildplace_initialize (); - switch (BuildPlaceFormatFamily) { --- 345,348 ---- *************** *** 383,400 **** } ! buildplace_sort(); if (verbose) { roadmap_hash_summary (); ! buildmap_dictionary_summary (); ! ! buildmap_square_summary (); ! buildmap_place_summary (); buildplace_dsg_summary (); } buildplace_save (fips); ! buildplace_reset (); } --- 356,373 ---- } ! buildmap_db_sort(); if (verbose) { roadmap_hash_summary (); ! buildmap_db_summary (); buildplace_dsg_summary (); } buildplace_save (fips); ! ! buildmap_db_reset (); ! buildplace_dsg_reset (); ! roadmap_hash_reset (); } |
From: Pascal F M. <pas...@us...> - 2006-01-16 20:54:59
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4413 Modified Files: buildmap_main.c Log Message: Make buildmap more modular using self registration of the "table" builders Index: buildmap_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_main.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** buildmap_main.c 2 Jan 2006 23:31:16 -0000 1.8 --- buildmap_main.c 16 Jan 2006 20:54:51 -0000 1.9 *************** *** 153,180 **** } - static void buildmap_county_initialize (void) { - - buildmap_zip_initialize(); - buildmap_city_initialize(); - buildmap_point_initialize(); - buildmap_range_initialize(); - buildmap_line_initialize(); - buildmap_polygon_initialize(); - buildmap_shape_initialize(); - buildmap_street_initialize(); - buildmap_area_initialize(); - buildmap_metadata_initialize(); - } - - - static void buildmap_county_sort (void) { - - buildmap_line_sort (); - buildmap_street_sort (); - buildmap_range_sort (); - buildmap_shape_sort (); - buildmap_polygon_sort (); - buildmap_metadata_sort (); - } static void buildmap_county_save (const char *name) { --- 153,156 ---- *************** *** 189,222 **** } ! buildmap_square_save (); ! buildmap_line_save (); ! buildmap_point_save (); ! buildmap_shape_save (); ! buildmap_dictionary_save (); ! buildmap_city_save (); ! buildmap_street_save (); ! buildmap_range_save (); ! buildmap_polygon_save (); ! buildmap_zip_save (); ! buildmap_metadata_save (); buildmap_db_close (); } - static void buildmap_county_reset (void) { - - buildmap_square_reset (); - buildmap_line_reset (); - buildmap_point_reset (); - buildmap_shape_reset (); - buildmap_dictionary_reset (); - buildmap_city_reset (); - buildmap_street_reset (); - buildmap_metadata_reset (); - buildmap_range_reset (); - buildmap_polygon_reset (); - buildmap_zip_reset (); - roadmap_hash_reset (); - } static void buildmap_county_process (const char *source, --- 165,173 ---- } ! buildmap_db_save (); buildmap_db_close (); } static void buildmap_county_process (const char *source, *************** *** 224,229 **** int verbose, int canals, int rivers) { - buildmap_county_initialize (); - switch (BuildMapFormatFamily) { --- 175,178 ---- *************** *** 254,276 **** } ! buildmap_county_sort(); if (verbose) { - roadmap_hash_summary (); ! buildmap_dictionary_summary (); ! ! buildmap_zip_summary (); ! buildmap_square_summary (); ! buildmap_street_summary (); ! buildmap_line_summary (); ! buildmap_range_summary (); ! buildmap_shape_summary (); ! buildmap_polygon_summary (); ! buildmap_metadata_summary (); } buildmap_county_save (county); ! buildmap_county_reset (); } --- 203,216 ---- } ! buildmap_db_sort(); if (verbose) { roadmap_hash_summary (); ! buildmap_db_summary (); } buildmap_county_save (county); ! buildmap_db_reset (); ! roadmap_hash_reset (); } |
From: Pascal F M. <pas...@us...> - 2006-01-16 20:53:26
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4026 Modified Files: buildus_county.c Log Message: Make buildmap more modular using self registration of the "table" builders Index: buildus_county.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildus_county.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** buildus_county.c 14 Nov 2005 07:05:23 -0000 1.4 --- buildus_county.c 16 Jan 2006 20:53:18 -0000 1.5 *************** *** 23,36 **** * SYNOPSYS: * - * void buildus_county_initialize (void); * int buildus_county_add (int fips, * RoadMapString name, RoadMapString state_symbol); * int buildus_county_add_state (RoadMapString name, int code); * void buildus_county_add_city (int fips, RoadMapString city); * void buildus_county_set_position (int fips, * const RoadMapArea *bounding_box); - * void buildus_county_sort (void); - * void buildus_county_save (void); - * void buildus_county_summary (void); * * These functions are used to build a table of counties from --- 23,33 ---- * SYNOPSYS: * * int buildus_county_add (int fips, * RoadMapString name, RoadMapString state_symbol); * int buildus_county_add_state (RoadMapString name, int code); * void buildus_county_add_city (int fips, RoadMapString city); + * * void buildus_county_set_position (int fips, * const RoadMapArea *bounding_box); * * These functions are used to build a table of counties from *************** *** 89,93 **** ! void buildus_county_initialize (void) { int i; --- 86,93 ---- ! static void buildus_county_register (void); ! ! ! static void buildus_county_initialize (void) { int i; *************** *** 105,108 **** --- 105,110 ---- StateMaxCode = 0; StateCount = 0; + + buildus_county_register(); } *************** *** 117,120 **** --- 119,125 ---- + if (CountyByFips == NULL) buildus_county_initialize (); + + /* First search if that county is not yet known. */ *************** *** 194,197 **** --- 199,206 ---- RoadMapArea area_reset = {0, 0, 0, 0}; + + if (CountyByFips == NULL) buildus_county_initialize (); + + /* Search if that state is not yet known. */ *************** *** 226,229 **** --- 235,241 ---- + if (CountyByFips == NULL) buildus_county_initialize (); + + /* First retrieve the county. */ *************** *** 357,361 **** } ! void buildus_county_sort (void) { int i; --- 369,373 ---- } ! static void buildus_county_sort (void) { int i; *************** *** 399,403 **** ! void buildus_county_save (void) { int i; --- 411,415 ---- ! static void buildus_county_save (void) { int i; *************** *** 547,552 **** ! void buildus_county_summary (void) { } --- 559,573 ---- ! static buildmap_db_module BuildUsCountyModule = { ! "county", ! buildus_county_sort, ! buildus_county_save, ! NULL, ! NULL ! }; ! + static void buildus_county_register (void) { + buildmap_db_register (&BuildUsCountyModule); } |
From: Pascal F M. <pas...@us...> - 2006-01-16 20:52:34
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3767 Modified Files: buildmap_zip.c Log Message: Make buildmap more modular using self registration of the "table" builders Index: buildmap_zip.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_zip.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** buildmap_zip.c 14 Nov 2005 07:04:38 -0000 1.4 --- buildmap_zip.c 16 Jan 2006 20:52:26 -0000 1.5 *************** *** 23,36 **** * SYNOPSYS: * - * void buildmap_zip_initialize (void); * void buildmap_zip_set_county (int county_code); * RoadMapZip buildmap_zip_add (int zip, int longitude, int latitude); * int buildmap_zip_get_zip_code (RoadMapZip index); * int buildmap_zip_get_longitude (RoadMapZip index); * int buildmap_zip_get_latitude (RoadMapZip index); * RoadMapZip buildmap_zip_locate (int zip); - * void buildmap_zip_save (void); - * void buildmap_zip_summary (void); - * void buildmap_zip_reset (void); * * These functions are used to build a table of zip codes from --- 23,33 ---- * SYNOPSYS: * * void buildmap_zip_set_county (int county_code); * RoadMapZip buildmap_zip_add (int zip, int longitude, int latitude); + * * int buildmap_zip_get_zip_code (RoadMapZip index); * int buildmap_zip_get_longitude (RoadMapZip index); * int buildmap_zip_get_latitude (RoadMapZip index); * RoadMapZip buildmap_zip_locate (int zip); * * These functions are used to build a table of zip codes from *************** *** 75,82 **** ! void buildmap_zip_initialize (void) { ! ! /* TBD: Load the existing ZIP table. */ ! } --- 72,76 ---- ! static void buildmap_zip_register (void); *************** *** 90,93 **** --- 84,91 ---- int i; + + if (ZipCodeCount == 0) buildmap_zip_register(); + + for (i = 1; i < ZipCodeCount; i++) { *************** *** 177,181 **** ! void buildmap_zip_save (void) { int i; --- 175,179 ---- ! static void buildmap_zip_save (void) { int i; *************** *** 194,198 **** ! void buildmap_zip_summary (void) { fprintf (stderr, "-- zip code table: %d items, %d add\n", --- 192,196 ---- ! static void buildmap_zip_summary (void) { fprintf (stderr, "-- zip code table: %d items, %d add\n", *************** *** 201,205 **** ! void buildmap_zip_reset (void) { int i; --- 199,203 ---- ! static void buildmap_zip_reset (void) { int i; *************** *** 218,219 **** --- 216,231 ---- } + + static buildmap_db_module BuildMapZipModule = { + "zip", + NULL, + buildmap_zip_save, + buildmap_zip_summary, + buildmap_zip_reset + }; + + + static void buildmap_zip_register (void) { + buildmap_db_register (&BuildMapZipModule); + } + |
From: Pascal F M. <pas...@us...> - 2006-01-16 20:52:03
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3648 Modified Files: buildmap_street.c Log Message: Make buildmap more modular using self registration of the "table" builders Index: buildmap_street.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_street.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** buildmap_street.c 14 Nov 2005 07:03:50 -0000 1.3 --- buildmap_street.c 16 Jan 2006 20:51:55 -0000 1.4 *************** *** 23,27 **** * SYNOPSYS: * - * void buildmap_street_initialize (void); * int buildmap_street_add * (char cfcc, --- 23,26 ---- *************** *** 31,41 **** * RoadMapString fedirs, * int line); ! * void buildmap_street_sort (void); ! * int buildmap_street_get_sorted (int street); * int buildmap_street_count (void); ! * void buildmap_street_save (void); * void buildmap_street_print_sorted (FILE *file, int street); - * void buildmap_street_summary (void); - * void buildmap_street_reset (void); * * These functions are used to build a table of streets from --- 30,38 ---- * RoadMapString fedirs, * int line); ! * * int buildmap_street_count (void); ! * ! * int buildmap_street_get_sorted (int street); * void buildmap_street_print_sorted (FILE *file, int street); * * These functions are used to build a table of streets from *************** *** 81,85 **** ! void buildmap_street_initialize (void) { StreetByName = roadmap_hash_new ("StreetByName", BUILDMAP_BLOCK); --- 78,85 ---- ! static void buildmap_street_register (void); ! ! ! static void buildmap_street_initialize (void) { StreetByName = roadmap_hash_new ("StreetByName", BUILDMAP_BLOCK); *************** *** 87,90 **** --- 87,92 ---- StreetAddCount = 0; StreetCount = 0; + + buildmap_street_register(); } *************** *** 108,111 **** --- 110,117 ---- BuildMapStreet *this_street; + + if (StreetByName == NULL) buildmap_street_initialize(); + + StreetAddCount += 1; *************** *** 264,268 **** ! void buildmap_street_save (void) { int i; --- 270,274 ---- ! static void buildmap_street_save (void) { int i; *************** *** 305,309 **** ! void buildmap_street_summary (void) { fprintf (stderr, --- 311,315 ---- ! static void buildmap_street_summary (void) { fprintf (stderr, *************** *** 313,317 **** ! void buildmap_street_reset (void) { int i; --- 319,323 ---- ! static void buildmap_street_reset (void) { int i; *************** *** 326,329 **** --- 332,336 ---- StreetCount = 0; + roadmap_hash_delete (StreetByName); StreetByName = NULL; *************** *** 334,335 **** --- 341,356 ---- } + + static buildmap_db_module BuildMapStreetModule = { + "street", + buildmap_street_sort, + buildmap_street_save, + buildmap_street_summary, + buildmap_street_reset + }; + + + static void buildmap_street_register (void) { + buildmap_db_register (&BuildMapStreetModule); + } + |
From: Pascal F M. <pas...@us...> - 2006-01-16 20:51:09
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3458 Modified Files: buildmap_square.c Log Message: Make buildmap more modular using self registration of the "table" builders Index: buildmap_square.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_square.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** buildmap_square.c 14 Nov 2005 07:03:36 -0000 1.3 --- buildmap_square.c 16 Jan 2006 20:51:00 -0000 1.4 *************** *** 26,38 **** * (int minlongitude, int maxlongitude, * int minlatitude, int maxlatitude); * int buildmap_square_add (int longitude, int latitude); ! * void buildmap_square_sort (void); * short buildmap_square_get_sorted (int squareid); * int buildmap_square_get_count (void); * void buildmap_square_get_reference_sorted * (int square, int *longitude, int *latitude); - * void buildmap_square_save (void); - * void buildmap_square_summary (void); - * void buildmap_square_reset (void); * * These functions are used to build a table of lines from --- 26,36 ---- * (int minlongitude, int maxlongitude, * int minlatitude, int maxlatitude); + * * int buildmap_square_add (int longitude, int latitude); ! * * short buildmap_square_get_sorted (int squareid); * int buildmap_square_get_count (void); * void buildmap_square_get_reference_sorted * (int square, int *longitude, int *latitude); * * These functions are used to build a table of lines from *************** *** 83,86 **** --- 81,87 ---- + static void buildmap_square_register (void); + + static int buildmap_square_search (int longitude, int latitude) { *************** *** 207,210 **** --- 208,213 ---- Square[i].maxlongitude = maxlongitude; } + + buildmap_square_register(); } *************** *** 295,299 **** ! void buildmap_square_save (void) { int i; --- 298,302 ---- ! static void buildmap_square_save (void) { int i; *************** *** 355,359 **** ! void buildmap_square_summary (void) { fprintf (stderr, "-- square table statistics: %d squares, %d bytes used\n", --- 358,362 ---- ! static void buildmap_square_summary (void) { fprintf (stderr, "-- square table statistics: %d squares, %d bytes used\n", *************** *** 362,366 **** ! void buildmap_square_reset (void) { SquareCount = 0; --- 365,369 ---- ! static void buildmap_square_reset (void) { SquareCount = 0; *************** *** 385,386 **** --- 388,403 ---- } + + static buildmap_db_module BuildMapSquareModule = { + "square", + buildmap_square_sort, + buildmap_square_save, + buildmap_square_summary, + buildmap_square_reset + }; + + + static void buildmap_square_register (void) { + buildmap_db_register (&BuildMapSquareModule); + } + |
From: Pascal F M. <pas...@us...> - 2006-01-16 20:50:19
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3223 Modified Files: buildmap_shape.c Log Message: Make buildmap more modular using self registration of the "table" builders Index: buildmap_shape.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_shape.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** buildmap_shape.c 14 Nov 2005 07:02:25 -0000 1.4 --- buildmap_shape.c 16 Jan 2006 20:50:08 -0000 1.5 *************** *** 23,33 **** * SYNOPSYS: * - * void buildmap_shape_initialize (void); * int buildmap_shape_add * (int line, int sequence, int longitude, int latitude); - * void buildmap_shape_sort (void); - * void buildmap_shape_save (void); - * void buildmap_shape_summary (void); - * void buildmap_shape_reset (void); * * These functions are used to build a table of shape points from --- 23,28 ---- *************** *** 78,82 **** ! void buildmap_shape_initialize (void) { ShapeByLine = roadmap_hash_new ("ShapeByLine", BUILDMAP_BLOCK); --- 73,80 ---- ! static void buildmap_shape_register (void); ! ! ! static void buildmap_shape_initialize (void) { ShapeByLine = roadmap_hash_new ("ShapeByLine", BUILDMAP_BLOCK); *************** *** 88,91 **** --- 86,91 ---- ShapeLineCount = 0; ShapeMaxSequence = 0; + + buildmap_shape_register(); } *************** *** 100,103 **** --- 100,107 ---- BuildMapShape *this_shape; + + if (ShapeByLine == NULL) buildmap_shape_initialize (); + + ShapeAddCount += 1; *************** *** 201,205 **** ! void buildmap_shape_sort (void) { int i; --- 205,209 ---- ! static void buildmap_shape_sort (void) { int i; *************** *** 222,226 **** ! void buildmap_shape_save (void) { int i; --- 226,230 ---- ! static void buildmap_shape_save (void) { int i; *************** *** 483,487 **** ! void buildmap_shape_summary (void) { fprintf (stderr, --- 487,491 ---- ! static void buildmap_shape_summary (void) { fprintf (stderr, *************** *** 495,499 **** ! void buildmap_shape_reset (void) { int i; --- 499,503 ---- ! static void buildmap_shape_reset (void) { int i; *************** *** 515,518 **** --- 519,523 ---- ShapeMaxSequence = 0; + roadmap_hash_delete (ShapeByLine); ShapeByLine = NULL; *************** *** 520,521 **** --- 525,540 ---- } + + static buildmap_db_module BuildMapShapeModule = { + "shape", + buildmap_shape_sort, + buildmap_shape_save, + buildmap_shape_summary, + buildmap_shape_reset + }; + + + static void buildmap_shape_register (void) { + buildmap_db_register (&BuildMapShapeModule); + } + |
From: Pascal F M. <pas...@us...> - 2006-01-16 20:49:43
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2974 Modified Files: buildmap_range.c Log Message: Make buildmap more modular using self registration of the "table" builders Index: buildmap_range.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_range.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** buildmap_range.c 14 Nov 2005 07:02:02 -0000 1.8 --- buildmap_range.c 16 Jan 2006 20:49:34 -0000 1.9 *************** *** 23,36 **** * SYNOPSYS: * - * void buildmap_range_initialize (void); * int buildmap_range_add * (int line, int street, int fradd, int toadd, RoadMapZip zip); * void buildmap_range_add_no_address (int line, int street); * void buildmap_range_add_place (RoadMapString place, RoadMapString city); - * void buildmap_range_sort (void); - * void buildmap_range_save (void); - * void buildmap_range_print (int index); - * void buildmap_range_summary (void); - * void buildmap_range_reset (void); * * These functions are used to build a table of street ranges from --- 23,30 ---- *************** *** 92,96 **** static int *SortedNoAddress = NULL; ! void buildmap_range_initialize (void) { RangeByLine = roadmap_hash_new ("RangeByLine", BUILDMAP_BLOCK); --- 86,93 ---- static int *SortedNoAddress = NULL; ! static void buildmap_range_register (void); ! ! ! static void buildmap_range_initialize (void) { RangeByLine = roadmap_hash_new ("RangeByLine", BUILDMAP_BLOCK); *************** *** 102,105 **** --- 99,104 ---- RangeAddCount = 0; RangeCount = 0; + + buildmap_range_register(); } *************** *** 181,184 **** --- 180,186 ---- + if (RangeByLine == NULL) buildmap_range_initialize(); + + if (line < 0) { buildmap_fatal (0, "negative line index"); *************** *** 271,274 **** --- 273,279 ---- + if (RangeByLine == NULL) buildmap_range_initialize(); + + if (line <= 0 || street <= 0) { return; *************** *** 334,337 **** --- 339,345 ---- + if (RangeByLine == NULL) buildmap_range_initialize(); + + if (city <= 0) { return; *************** *** 386,390 **** ! void buildmap_range_print (FILE *file, int index) { BuildMapRange *this_range; --- 394,398 ---- ! static void buildmap_range_print (FILE *file, int index) { BuildMapRange *this_range; *************** *** 500,504 **** } ! void buildmap_range_sort (void) { int i; --- 508,512 ---- } ! static void buildmap_range_sort (void) { int i; *************** *** 553,557 **** ! void buildmap_range_save (void) { int i; --- 561,565 ---- ! static void buildmap_range_save (void) { int i; *************** *** 982,986 **** ! void buildmap_range_summary (void) { fprintf (stderr, --- 990,994 ---- ! static void buildmap_range_summary (void) { fprintf (stderr, *************** *** 993,997 **** ! void buildmap_range_reset (void) { int i; --- 1001,1005 ---- ! static void buildmap_range_reset (void) { int i; *************** *** 1023,1028 **** --- 1031,1041 ---- } + roadmap_hash_delete (RangeByLine); RangeByLine = NULL; + + roadmap_hash_delete (RangePlaceByPlace); RangePlaceByPlace = NULL; + + roadmap_hash_delete (RangeNoAddressByLine); RangeNoAddressByLine = NULL; *************** *** 1036,1037 **** --- 1049,1064 ---- } + + static buildmap_db_module BuildMapRangeModule = { + "range", + buildmap_range_sort, + buildmap_range_save, + buildmap_range_summary, + buildmap_range_reset + }; + + + static void buildmap_range_register (void) { + buildmap_db_register (&BuildMapRangeModule); + } + |
From: Pascal F M. <pas...@us...> - 2006-01-16 20:48:57
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2711 Modified Files: buildmap_polygon.c Log Message: Make buildmap more modular using self registration of the "table" builders Index: buildmap_polygon.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_polygon.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** buildmap_polygon.c 11 Dec 2005 18:04:46 -0000 1.4 --- buildmap_polygon.c 16 Jan 2006 20:48:50 -0000 1.5 *************** *** 23,27 **** * SYNOPSYS: * - * void buildmap_polygon_initialize (void); * int buildmap_polygon_add_landmark * (int landid, char cfcc, RoadMapString name); --- 23,26 ---- *************** *** 29,37 **** * int buildmap_polygon_add_line * (RoadMapString cenid, int polyid, int tlid, int side); * int buildmap_polygon_use_line (int tlid); - * void buildmap_polygon_sort (void); - * void buildmap_polygon_save (void); - * void buildmap_polygon_summary (void); - * void buildmap_polygon_reset (void); * * These functions are used to build a table of lines from --- 28,33 ---- * int buildmap_polygon_add_line * (RoadMapString cenid, int polyid, int tlid, int side); + * * int buildmap_polygon_use_line (int tlid); * * These functions are used to build a table of lines from *************** *** 143,146 **** --- 139,145 ---- + static void buildmap_polygon_register (void); + + static BuildMapLandmark *buildmap_polygon_search_landmark (int landid) { *************** *** 467,471 **** ! void buildmap_polygon_initialize (void) { LandmarkById = roadmap_hash_new ("LandmarkById", BUILDMAP_BLOCK); --- 466,470 ---- ! static void buildmap_polygon_initialize (void) { LandmarkById = roadmap_hash_new ("LandmarkById", BUILDMAP_BLOCK); *************** *** 491,494 **** --- 490,495 ---- PolygonLineCount = 0; LandmarkCount = 0; + + buildmap_polygon_register(); } *************** *** 502,505 **** --- 503,509 ---- + if (LandmarkById == NULL) buildmap_polygon_initialize (); + + if (cfcc < 0) { buildmap_fatal (0, "invalid cfcc"); *************** *** 541,544 **** --- 545,551 ---- + if (LandmarkById == NULL) buildmap_polygon_initialize (); + + this_landmark = buildmap_polygon_search_landmark (landid); if (this_landmark == NULL) { *************** *** 590,593 **** --- 597,602 ---- + if (LandmarkById == NULL) buildmap_polygon_initialize (); + this_polygon = buildmap_polygon_search (cenid, polyid); if (this_polygon == NULL) { *************** *** 674,677 **** --- 683,689 ---- BuildMapPolygonLine *this_line; + + if (LandmarkById == NULL) return 0; + for (index = roadmap_hash_get_first (PolygonLineById, tlid); index >= 0; *************** *** 730,734 **** ! void buildmap_polygon_sort (void) { int i; --- 742,746 ---- ! static void buildmap_polygon_sort (void) { int i; *************** *** 894,898 **** ! void buildmap_polygon_save (void) { int i; --- 906,910 ---- ! static void buildmap_polygon_save (void) { int i; *************** *** 1010,1014 **** ! void buildmap_polygon_summary (void) { fprintf (stderr, --- 1022,1026 ---- ! static void buildmap_polygon_summary (void) { fprintf (stderr, *************** *** 1018,1022 **** ! void buildmap_polygon_reset (void) { int i; --- 1030,1034 ---- ! static void buildmap_polygon_reset (void) { int i; *************** *** 1048,1054 **** --- 1060,1085 ---- PolygonLineCount = 0; + roadmap_hash_delete (LandmarkById); LandmarkById = NULL; + + roadmap_hash_delete (PolygonByPolyid); PolygonByPolyid = NULL; + + roadmap_hash_delete (PolygonLineById); PolygonLineById = NULL; } + + static buildmap_db_module BuildMapPolygonModule = { + "polygon", + buildmap_polygon_sort, + buildmap_polygon_save, + buildmap_polygon_summary, + buildmap_polygon_reset + }; + + + static void buildmap_polygon_register (void) { + buildmap_db_register (&BuildMapPolygonModule); + } + |
From: Pascal F M. <pas...@us...> - 2006-01-16 20:48:09
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2520 Modified Files: buildmap_point.c Log Message: Make buildmap more modular using self registration of the "table" builders Index: buildmap_point.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_point.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** buildmap_point.c 14 Nov 2005 07:01:18 -0000 1.3 --- buildmap_point.c 16 Jan 2006 20:48:01 -0000 1.4 *************** *** 23,30 **** * SYNOPSYS: * - * void buildmap_point_initialize (void); * int buildmap_point_add (int longitude, int latitude); * - * void buildmap_point_sort (void); * int buildmap_point_get_square (int pointid); * int buildmap_point_get_longitude (int pointid); --- 23,28 ---- *************** *** 34,40 **** * int buildmap_point_get_latitude_sorted (int point); * int buildmap_point_get_square_sorted (int pointid); - * void buildmap_point_save (void); - * void buildmap_point_summary (void); - * void buildmap_point_reset (void); * * These functions are used to build a table of lines from --- 32,35 ---- *************** *** 80,84 **** ! void buildmap_point_initialize (void) { PointByPosition = --- 75,81 ---- ! static void buildmap_point_register (void); ! ! static void buildmap_point_initialize (void) { PointByPosition = *************** *** 96,99 **** --- 93,98 ---- SortMaxLatitude = -0x7fffffff; SortMinLatitude = 0x7fffffff; + + buildmap_point_register(); } *************** *** 107,110 **** --- 106,112 ---- + if (PointByPosition == NULL) buildmap_point_initialize(); + + /* First check if the point is already known. */ *************** *** 331,335 **** ! void buildmap_point_save (void) { int i; --- 333,337 ---- ! static void buildmap_point_save (void) { int i; *************** *** 395,399 **** ! void buildmap_point_summary (void) { fprintf (stderr, "-- point table statistics: %d points, %d bytes used\n", --- 397,401 ---- ! static void buildmap_point_summary (void) { fprintf (stderr, "-- point table statistics: %d points, %d bytes used\n", *************** *** 402,406 **** ! void buildmap_point_reset (void) { int i; --- 404,408 ---- ! static void buildmap_point_reset (void) { int i; *************** *** 413,421 **** } ! free (SortedPoint); ! SortedPoint = NULL; PointCount = 0; PointByPosition = NULL; --- 415,426 ---- } ! if (SortedPoint != NULL) { ! free (SortedPoint); ! SortedPoint = NULL; ! } PointCount = 0; + roadmap_hash_delete (PointByPosition); PointByPosition = NULL; *************** *** 426,427 **** --- 431,446 ---- } + + static buildmap_db_module BuildMapPointModule = { + "point", + buildmap_point_sort, + buildmap_point_save, + buildmap_point_summary, + buildmap_point_reset + }; + + + static void buildmap_point_register (void) { + buildmap_db_register (&BuildMapPointModule); + } + |
From: Pascal F M. <pas...@us...> - 2006-01-16 20:47:29
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2426 Modified Files: buildmap_place.c Log Message: Avoid showing the source file name if we have no message to display Index: buildmap_place.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_place.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** buildmap_place.c 14 Nov 2005 07:00:44 -0000 1.3 --- buildmap_place.c 16 Jan 2006 20:47:20 -0000 1.4 *************** *** 23,28 **** * SYNOPSYS: * - * void buildmap_place_initialize (void); * int buildmap_place_add (int name, int cfcc, int point); * int buildmap_place_get_sorted (int place); * int buildmap_place_get_name_sorted (int place); --- 23,28 ---- * SYNOPSYS: * * int buildmap_place_add (int name, int cfcc, int point); + * * int buildmap_place_get_sorted (int place); * int buildmap_place_get_name_sorted (int place); *************** *** 37,44 **** * void buildmap_place_get_square_sorted (int place); * int buildmap_place_compare (const void *r1, const void *r2); - * void buildmap_place_sort (void); - * void buildmap_place_save (void); - * void buildmap_place_summary (void); - * void buildmap_place_reset (void); * * These functions are used to build a table of places from --- 37,40 ---- *************** *** 80,84 **** ! void buildmap_place_initialize (void) { PlaceByName = roadmap_hash_new ("PlaceByName", BUILDMAP_BLOCK); --- 76,83 ---- ! static void buildmap_place_register (void); ! ! ! static void buildmap_place_initialize (void) { PlaceByName = roadmap_hash_new ("PlaceByName", BUILDMAP_BLOCK); *************** *** 90,93 **** --- 89,94 ---- PlaceCount = 0; + + buildmap_place_register(); } *************** *** 100,103 **** --- 101,107 ---- + if (PlaceByName == NULL) buildmap_place_initialize(); + + block = PlaceCount / BUILDMAP_BLOCK; offset = PlaceCount % BUILDMAP_BLOCK; *************** *** 265,269 **** } ! void buildmap_place_sort (void) { int i; --- 269,273 ---- } ! static void buildmap_place_sort (void) { int i; *************** *** 313,317 **** ! void buildmap_place_save (void) { int i; --- 317,321 ---- ! static void buildmap_place_save (void) { int i; *************** *** 410,414 **** ! void buildmap_place_summary (void) { fprintf (stderr, --- 414,418 ---- ! static void buildmap_place_summary (void) { fprintf (stderr, *************** *** 418,422 **** ! void buildmap_place_reset (void) { int i; --- 422,426 ---- ! static void buildmap_place_reset (void) { int i; *************** *** 433,437 **** --- 437,457 ---- PlaceCount = 0; + + roadmap_hash_delete (PlaceByName); PlaceByName = NULL; } + + static buildmap_db_module BuildMapPlaceModule = { + "place", + buildmap_place_sort, + buildmap_place_save, + buildmap_place_summary, + buildmap_place_reset + }; + + + static void buildmap_place_register (void) { + buildmap_db_register (&BuildMapPlaceModule); + } + |
From: Pascal F M. <pas...@us...> - 2006-01-16 20:46:30
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2257 Modified Files: buildmap_metadata.c Log Message: Avoid showing the source file name if we have no message to display Index: buildmap_metadata.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_metadata.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** buildmap_metadata.c 2 Jan 2006 09:08:31 -0000 1.2 --- buildmap_metadata.c 16 Jan 2006 20:46:22 -0000 1.3 *************** *** 23,28 **** * SYNOPSYS: * - * void buildmap_metadata_initialize (void); - * * void buildmap_metadata_add_attribute (const char *category, * const char *name, --- 23,26 ---- *************** *** 33,41 **** * const char *value); * - * void buildmap_metadata_sort (void); - * void buildmap_metadata_save (void); - * void buildmap_metadata_summary (void); - * void buildmap_metadata_reset (void); - * * These functions are used to build a table of attributes that describe * what this map file contains. --- 31,34 ---- *************** *** 76,80 **** ! void buildmap_metadata_initialize (void) { AttributeByName = --- 69,76 ---- ! static void buildmap_metadata_register (void); ! ! ! static void buildmap_metadata_initialize (void) { AttributeByName = *************** *** 87,90 **** --- 83,88 ---- AttributeDictionary = buildmap_dictionary_open ("attributes"); + + buildmap_metadata_register (); } *************** *** 99,112 **** BuildMapAttribute *this_attribute; /* First check if the attribute is already known. */ ! RoadMapString coded_category = buildmap_dictionary_add (AttributeDictionary, category, strlen(category)); ! RoadMapString coded_name = buildmap_dictionary_add (AttributeDictionary, name, strlen(name)); ! RoadMapString coded_value = buildmap_dictionary_add (AttributeDictionary, value, strlen(value)); --- 97,117 ---- BuildMapAttribute *this_attribute; + RoadMapString coded_category; + RoadMapString coded_name; + RoadMapString coded_value; + + + if (AttributeByName == NULL) buildmap_metadata_initialize(); + /* First check if the attribute is already known. */ ! coded_category = buildmap_dictionary_add (AttributeDictionary, category, strlen(category)); ! coded_name = buildmap_dictionary_add (AttributeDictionary, name, strlen(name)); ! coded_value = buildmap_dictionary_add (AttributeDictionary, value, strlen(value)); *************** *** 202,209 **** ! void buildmap_metadata_sort (void) {} ! ! ! void buildmap_metadata_save (void) { int i; --- 207,211 ---- ! static void buildmap_metadata_save (void) { int i; *************** *** 263,267 **** ! void buildmap_metadata_summary (void) { fprintf (stderr, --- 265,269 ---- ! static void buildmap_metadata_summary (void) { fprintf (stderr, *************** *** 271,275 **** ! void buildmap_metadata_reset (void) { int i; --- 273,277 ---- ! static void buildmap_metadata_reset (void) { int i; *************** *** 284,288 **** --- 286,305 ---- AttributeCount = 0; + roadmap_hash_delete (AttributeByName); AttributeByName = NULL; } + + static buildmap_db_module BuildMapMetadataModule = { + "metadata", + NULL, + buildmap_metadata_save, + buildmap_metadata_summary, + buildmap_metadata_reset + }; + + + static void buildmap_metadata_register (void) { + buildmap_db_register (&BuildMapMetadataModule); + } + |
From: Pascal F M. <pas...@us...> - 2006-01-16 20:44:35
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1955 Modified Files: buildmap_messages.c Log Message: Avoid showing the source file name if we have no message to display Index: buildmap_messages.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_messages.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** buildmap_messages.c 3 Jan 2006 04:05:42 -0000 1.3 --- buildmap_messages.c 16 Jan 2006 20:44:26 -0000 1.4 *************** *** 192,197 **** va_list ap; ! SourceLine = 0; ! buildmap_show_source (stderr, "--", -1); if (ErrorCount > 0) { --- 192,199 ---- va_list ap; ! if (ErrorCount > 0 || verbose) { ! SourceLine = 0; ! buildmap_show_source (stderr, "--", -1); ! } if (ErrorCount > 0) { |