readosm_internals.h   readosm_internals.h 
skipping to change at line 21 skipping to change at line 21
/ /
/ Version: MPL 1.1/GPL 2.0/LGPL 2.1 / Version: MPL 1.1/GPL 2.0/LGPL 2.1
/ /
/ The contents of this file are subject to the Mozilla Public License Versi on / The contents of this file are subject to the Mozilla Public License Versi on
/ 1.1 (the "License"); you may not use this file except in compliance with / 1.1 (the "License"); you may not use this file except in compliance with
/ the License. You may obtain a copy of the License at / the License. You may obtain a copy of the License at
/ http://www.mozilla.org/MPL/ / http://www.mozilla.org/MPL/
/ /
/ Software distributed under the License is distributed on an "AS IS" basis , / Software distributed under the License is distributed on an "AS IS" basis ,
/ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License / WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
/ for the specific language governing rights and limitations under the / for the specific language governing rights and limitations under theskip:
/ License. / License.
/ /
/ The Original Code is the ReadOSM library / The Original Code is the ReadOSM library
/ /
/ The Initial Developer of the Original Code is Alessandro Furieri / The Initial Developer of the Original Code is Alessandro Furieri
/ /
/ Portions created by the Initial Developer are Copyright (C) 2012 / Portions created by the Initial Developer are Copyright (C) 2012
/ the Initial Developer. All Rights Reserved. / the Initial Developer. All Rights Reserved.
/ /
/ Contributor(s): / Contributor(s):
skipping to change at line 65 skipping to change at line 65
/* file formats */ /* file formats */
#define READOSM_OSM_FORMAT 4589 #define READOSM_OSM_FORMAT 4589
#define READOSM_PBF_FORMAT 7491 #define READOSM_PBF_FORMAT 7491
/* XML tags */ /* XML tags */
#define READOSM_CURRENT_TAG_UNKNOWN 0 #define READOSM_CURRENT_TAG_UNKNOWN 0
#define READOSM_CURRENT_TAG_IS_NODE 101 #define READOSM_CURRENT_TAG_IS_NODE 101
#define READOSM_CURRENT_TAG_IS_WAY 102 #define READOSM_CURRENT_TAG_IS_WAY 102
#define READOSM_CURRENT_TAG_IS_RELATION 103 #define READOSM_CURRENT_TAG_IS_RELATION 103
/* block size */
#define READOSM_BLOCK_SZ 128
typedef struct readosm_internal_tag_struct typedef struct readosm_internal_tag_struct
{ {
/* a struct wrapping TAG items */ /* a struct wrapping TAG items */
char *key; /* pointer to KEY value (NULL terminated str ing) */ char *key; /* pointer to KEY value (NULL terminated str ing) */
char *value; /* pointer to VALUE (NULL terminated string) */ char *value; /* pointer to VALUE (NULL terminated string) */
struct readosm_internal_tag_struct *next; /* supporting linked list */
} readosm_internal_tag; } readosm_internal_tag;
typedef struct readosm_internal_tag_block_struct
{
/* a struct wrapping a block of TAG items */
readosm_internal_tag tags[READOSM_BLOCK_SZ]; /* array of Tags */
int next_item; /* index to next free (unused) item */
struct readosm_internal_tag_block_struct *next; /* supporting linked
list */
} readosm_internal_tag_block;
typedef struct readosm_export_tag_struct typedef struct readosm_export_tag_struct
{ {
/* a struct intended to export TAG items */ /* a struct intended to export TAG items */
char *key; /* pointer to KEY value (NULL terminated str ing) */ char *key; /* pointer to KEY value (NULL terminated str ing) */
char *value; /* pointer to VALUE (NULL terminated string) */ char *value; /* pointer to VALUE (NULL terminated string) */
} readosm_export_tag; } readosm_export_tag;
typedef struct readosm_internal_node_struct typedef struct readosm_internal_node_struct
{ {
/* a struct wrapping NODE items */ /* a struct wrapping NODE items */
long long id; /* NODE-ID (unique value) */ long long id; /* NODE-ID (unique value) */
double latitude; /* geographic latitude */ double latitude; /* geographic latitude */
double longitude; /* geographic longitude */ double longitude; /* geographic longitude */
int version; /* version id */ int version; /* version id */
long long changeset; /* changeset id */ long long changeset; /* changeset id */
char *user; /* pointer to user name (NULL termin ated string) */ char *user; /* pointer to user name (NULL termin ated string) */
int uid; /* uid identifying the user */ int uid; /* uid identifying the user */
char *timestamp; /* last modified timestamp */ char *timestamp; /* last modified timestamp */
int tag_count; /* how many TAG items are there */ int tag_count; /* how many TAG items are there */
readosm_internal_tag *first_tag; /* pointers supporting a linked list readosm_internal_tag_block first_tag; /* pointers supporting a lin
*/ ked list */
readosm_internal_tag *last_tag; /* of TAG items */ readosm_internal_tag_block *last_tag; /* of TAG blocks (first bloc
k is static) */
} readosm_internal_node; } readosm_internal_node;
typedef struct readosm_export_node_struct typedef struct readosm_export_node_struct
{ {
/* a struct intended to export NODE items */ /* a struct intended to export NODE items */
long long id; /* NODE-ID (unique value) */ long long id; /* NODE-ID (unique value) */
double latitude; /* geographic latitude */ double latitude; /* geographic latitude */
double longitude; /* geographic longitude */ double longitude; /* geographic longitude */
int version; /* version id */ int version; /* version id */
long long changeset; /* changeset id */ long long changeset; /* changeset id */
char *user; /* pointer to user name (NULL termin ated string) */ char *user; /* pointer to user name (NULL termin ated string) */
int uid; /* uid identifying the user */ int uid; /* uid identifying the user */
char *timestamp; /* last modified timestamp */ char *timestamp; /* last modified timestamp */
int tag_count; /* how many TAG items are there */ int tag_count; /* how many TAG items are there */
readosm_export_tag *tags; /* array of TAG items */ readosm_export_tag *tags; /* array of TAG items */
} readosm_export_node; } readosm_export_node;
typedef struct readosm_internal_ref_struct typedef struct readosm_internal_ref_struct
{ {
/* a struct wrapping WAY-ND items */ /* a block of WAY-ND items */
long long node_ref; /* referenced NODE-ID */ long long node_refs[READOSM_BLOCK_SZ]; /* referenced NODE-ID array
*/
int next_item; /* index to next free (unused) item */
struct readosm_internal_ref_struct *next; /* supporting linked list */ struct readosm_internal_ref_struct *next; /* supporting linked list */
} readosm_internal_ref; } readosm_internal_ref;
typedef struct readosm_internal_way_struct typedef struct readosm_internal_way_struct
{ {
/* a struct wrapping WAY items */ /* a struct wrapping WAY items */
long long id; /* WAY-ID (unique value) */ long long id; /* WAY-ID (unique value) */
int version; /* version id */ int version; /* version id */
long long changeset; /* changeset id */ long long changeset; /* changeset id */
char *user; /* pointer to user name (NULL termin ated string) */ char *user; /* pointer to user name (NULL termin ated string) */
int uid; /* uid identifying the user */ int uid; /* uid identifying the user */
char *timestamp; /* last modified timestamp */ char *timestamp; /* last modified timestamp */
int ref_count; /* how many WAY-ND items are there */ int ref_count; /* how many WAY-ND items are there */
readosm_internal_ref *first_ref; /* pointers supporting a linked list readosm_internal_ref first_ref; /* pointers supporting a linked list
*/ */
readosm_internal_ref *last_ref; /* of WAY-ND items */ readosm_internal_ref *last_ref; /* of WAY-ND items (first block is s
tatic) */
int tag_count; /* how many TAG items are there */ int tag_count; /* how many TAG items are there */
readosm_internal_tag *first_tag; /* pointers supporting a linked list readosm_internal_tag_block first_tag; /* pointers supporting a lin
*/ ked list */
readosm_internal_tag *last_tag; /* of TAG items */ readosm_internal_tag_block *last_tag; /* of TAG blocks (first bloc
k is static) */
} readosm_internal_way; } readosm_internal_way;
typedef struct readosm_export_way_struct typedef struct readosm_export_way_struct
{ {
/* a struct intended to export WAY items */ /* a struct intended to export WAY items */
long long id; /* WAY-ID (unique value) */ long long id; /* WAY-ID (unique value) */
int version; /* version id */ int version; /* version id */
long long changeset; /* changeset id */ long long changeset; /* changeset id */
char *user; /* pointer to user name (NULL termin ated string) */ char *user; /* pointer to user name (NULL termin ated string) */
int uid; /* uid identifying the user */ int uid; /* uid identifying the user */
skipping to change at line 156 skipping to change at line 167
int tag_count; /* how many TAG items are there */ int tag_count; /* how many TAG items are there */
readosm_export_tag *tags; /* array of TAG items */ readosm_export_tag *tags; /* array of TAG items */
} readosm_export_way; } readosm_export_way;
typedef struct readosm_internal_member_struct typedef struct readosm_internal_member_struct
{ {
/* a struct wrapping RELATION-MEMBER items */ /* a struct wrapping RELATION-MEMBER items */
int member_type; /* member type [some READOSM_MEMBER_xx const ant] */ int member_type; /* member type [some READOSM_MEMBER_xx const ant] */
long long id; /* ID of the referenced object */ long long id; /* ID of the referenced object */
char *role; /* pointer to role value (NULL termi nated string) */ char *role; /* pointer to role value (NULL termi nated string) */
struct readosm_internal_member_struct *next; /* supporting linked list */
} readosm_internal_member; } readosm_internal_member;
typedef struct readosm_internal_member_block_struct
{
/* a block of RELATION-MEMBER items */
readosm_internal_member members[READOSM_BLOCK_SZ]; /* array of MEMBERs
*/
int next_item; /* index to next free (unused) item */
struct readosm_internal_member_block_struct *next; /* supporting linked
list */
} readosm_internal_member_block;
typedef struct readosm_export_member_struct typedef struct readosm_export_member_struct
{ {
/* a struct intended to export RELATION-MEMBER items */ /* a struct intended to export RELATION-MEMBER items */
int member_type; /* member type [some READOSM_MEMBER_xx const ant] */ int member_type; /* member type [some READOSM_MEMBER_xx const ant] */
long long id; /* ID of the referenced object */ long long id; /* ID of the referenced object */
char *role; /* pointer to role value (NULL termi nated string) */ char *role; /* pointer to role value (NULL termi nated string) */
} readosm_export_member; } readosm_export_member;
typedef struct readosm_internal_relation_struct typedef struct readosm_internal_relation_struct
{ {
/* a struct wrapping RELATION items */ /* a struct wrapping RELATION items */
long long id; /* RELATION-ID (unique value) */ long long id; /* RELATION-ID (unique value) */
int version; /* version id */ int version; /* version id */
long long changeset; /* changeset id */ long long changeset; /* changeset id */
char *user; /* pointer to user name (NULL termin ated string) */ char *user; /* pointer to user name (NULL termin ated string) */
int uid; /* uid identifying the user */ int uid; /* uid identifying the user */
char *timestamp; /* last modified timestamp */ char *timestamp; /* last modified timestamp */
int member_count; /* how many RELATION-MEMBER items are there */ int member_count; /* how many RELATION-MEMBER items are there */
readosm_internal_member *first_member; /* pointers supporting a lin readosm_internal_member_block first_member; /* pointers supporti
ked list */ ng a linked list */
readosm_internal_member *last_member; /* of RELATION-MEMBER items readosm_internal_member_block *last_member; /* of RELATION-MEMBE
*/ R items (first block is static) */
int tag_count; /* how many TAG items are there */ int tag_count; /* how many TAG items are there */
readosm_internal_tag *first_tag; /* pointers supporting a linked list readosm_internal_tag_block first_tag; /* pointers supporting a lin
*/ ked list */
readosm_internal_tag *last_tag; /* of TAG items */ readosm_internal_tag_block *last_tag; /* of TAG-blocks (first bloc
k is static) */
} readosm_internal_relation; } readosm_internal_relation;
typedef struct readosm_export_relation_struct typedef struct readosm_export_relation_struct
{ {
/* a struct intended to export RELATION objects */ /* a struct intended to export RELATION objects */
long long id; /* RELATION-ID (unique value) */ long long id; /* RELATION-ID (unique value) */
int version; /* version id */ int version; /* version id */
long long changeset; /* changeset id */ long long changeset; /* changeset id */
char *user; /* pointer to user name (NULL termin ated string) */ char *user; /* pointer to user name (NULL termin ated string) */
int uid; /* uid identifying the user */ int uid; /* uid identifying the user */
skipping to change at line 228 skipping to change at line 246
{ {
/* a struct representing an OSM input file */ /* a struct representing an OSM input file */
int magic1; /* magic signature #1 */ int magic1; /* magic signature #1 */
FILE *in; /* file handle */ FILE *in; /* file handle */
int file_format; /* the actual file format */ int file_format; /* the actual file format */
char little_endian_cpu; /* actual CPU endianness */ char little_endian_cpu; /* actual CPU endianness */
int magic2; /* magic signature #2 */ int magic2; /* magic signature #2 */
} readosm_file; } readosm_file;
/* functions handling common OSM objects */ /* functions handling common OSM objects */
readosm_internal_tag *alloc_internal_tag (void); READOSM_PRIVATE void release_internal_tag_block (readosm_internal_tag_block
void destroy_internal_tag (readosm_internal_tag * tag); *
readosm_internal_ref *alloc_internal_ref (void); tag_block, int destroy);
void destroy_internal_ref (readosm_internal_ref * ref); READOSM_PRIVATE void
readosm_internal_member *alloc_internal_member (void); release_internal_member_block (readosm_internal_member_block * member_block
void destroy_internal_member (readosm_internal_member * member); ,
void init_internal_node (readosm_internal_node * node); int destroy);
void append_tag_to_node (readosm_internal_node * node, const char *key, con READOSM_PRIVATE void init_internal_node (readosm_internal_node * node);
st char *value); READOSM_PRIVATE void append_tag_to_node (readosm_internal_node * node,
void destroy_internal_node (readosm_internal_node * node); const char *key, const char *value)
readosm_internal_way *alloc_internal_way (void); ;
void append_reference_to_way (readosm_internal_way * way, long long node_re READOSM_PRIVATE void destroy_internal_node (readosm_internal_node * node);
f); READOSM_PRIVATE readosm_internal_way *alloc_internal_way (void);
void append_tag_to_way (readosm_internal_way * way, const char *key, const READOSM_PRIVATE void append_reference_to_way (readosm_internal_way * way,
char *value); long long node_ref);
void destroy_internal_way (readosm_internal_way * way); READOSM_PRIVATE void append_tag_to_way (readosm_internal_way * way,
readosm_internal_relation *alloc_internal_relation (void); const char *key, const char *value);
void append_member_to_relation (readosm_internal_relation * relation, int t READOSM_PRIVATE void destroy_internal_way (readosm_internal_way * way);
ype, long long id, const char *role); READOSM_PRIVATE readosm_internal_relation *alloc_internal_relation (void);
void append_tag_to_relation (readosm_internal_relation * relation, const ch READOSM_PRIVATE void append_member_to_relation (readosm_internal_relation *
ar *key, const char *value); relation, int type,
void destroy_internal_relation (readosm_internal_relation * relation); long long id, const char *ro
le);
READOSM_PRIVATE void append_tag_to_relation (readosm_internal_relation *
relation, const char *key,
const char *value);
READOSM_PRIVATE void destroy_internal_relation (readosm_internal_relation *
relation);
/* XML and ProtoBuf parsers */ /* XML and ProtoBuf parsers */
int parse_osm_pbf (readosm_file * input, const void *user_data, readosm_nod READOSM_PRIVATE int parse_osm_pbf (readosm_file * input, const void *user_d
e_callback node_fnct, readosm_way_callback way_fnct, readosm_relation_callb ata,
ack relation_fnct); readosm_node_callback node_fnct,
int parse_osm_xml (readosm_file * input, const void *user_data, readosm_nod readosm_way_callback way_fnct,
e_callback node_fnct, readosm_way_callback way_fnct, readosm_relation_callb readosm_relation_callback relation_fnct);
ack relation_fnct); READOSM_PRIVATE int parse_osm_xml (readosm_file * input, const void *user_d
ata,
readosm_node_callback node_fnct,
readosm_way_callback way_fnct,
readosm_relation_callback relation_fnct);
/* callback handlers */ /* callback handlers */
int call_node_callback (readosm_node_callback node_callback, const void *us READOSM_PRIVATE int call_node_callback (readosm_node_callback node_callback
er_data, readosm_internal_node * node); ,
int call_way_callback (readosm_way_callback way_callback, const void *user_ const void *user_data,
data, readosm_internal_way * way); readosm_internal_node * node);
int call_relation_callback (readosm_relation_callback relation_callback, co READOSM_PRIVATE int call_way_callback (readosm_way_callback way_callback,
nst void *user_data, readosm_internal_relation * relation); const void *user_data,
readosm_internal_way * way);
READOSM_PRIVATE int call_relation_callback (readosm_relation_callback
relation_callback,
const void *user_data,
readosm_internal_relation *
relation);
 End of changes. 15 change blocks. 
49 lines changed or deleted 85 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/