raptor.h   raptor.h 
/* -*- Mode: c; c-basic-offset: 2 -*- /* -*- Mode: c; c-basic-offset: 2 -*-
* *
* raptor.h - Redland Parser Toolkit for RDF (Raptor) interfaces and defini tion * raptor.h - Redland Parser Toolkit for RDF (Raptor) interfaces and defini tion
* *
* Copyright (C) 2000-2007, David Beckett http://purl.org/net/dajobe/ * Copyright (C) 2000-2008, David Beckett http://purl.org/net/dajobe/
* Copyright (C) 2000-2005, University of Bristol, UK http://www.bristol.ac .uk/ * Copyright (C) 2000-2005, University of Bristol, UK http://www.bristol.ac .uk/
* *
* This package is Free Software and part of Redland http://librdf.org/ * This package is Free Software and part of Redland http://librdf.org/
* *
* It is licensed under the following three licenses as alternatives: * It is licensed under the following three licenses as alternatives:
* 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version * 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
* 2. GNU General Public License (GPL) V2 or any newer version * 2. GNU General Public License (GPL) V2 or any newer version
* 3. Apache License, V2.0 or any newer version * 3. Apache License, V2.0 or any newer version
* *
* You may not use this file except in compliance with at least one of * You may not use this file except in compliance with at least one of
skipping to change at line 43 skipping to change at line 43
/* Required for va_list in raptor_vsnprintf */ /* Required for va_list in raptor_vsnprintf */
#include <stdarg.h> #include <stdarg.h>
/** /**
* RAPTOR_API: * RAPTOR_API:
* *
* Macro for wrapping API function call declarations. * Macro for wrapping API function call declarations.
* *
*/ */
#ifdef WIN32 #ifndef RAPTOR_API
# ifdef __GNUC__ # ifdef WIN32
# undef _declspec # ifdef __GNUC__
# define _declspec(x) __declspec(x) # undef _declspec
# endif # define _declspec(x) __declspec(x)
# ifdef RAPTOR_STATIC # endif
# define RAPTOR_API # ifdef RAPTOR_STATIC
# else # define RAPTOR_API
# ifdef RAPTOR_INTERNAL
# define RAPTOR_API _declspec(dllexport)
# else # else
# define RAPTOR_API _declspec(dllimport) # ifdef RAPTOR_INTERNAL
# define RAPTOR_API _declspec(dllexport)
# else
# define RAPTOR_API _declspec(dllimport)
# endif
# endif # endif
# endif
#elif defined(__SYMBIAN32__)
# ifdef RAPTOR_INTERNAL
# define RAPTOR_API __declspec(dllexport)
# else # else
# define RAPTOR_API __declspec(dllimport) # define RAPTOR_API
# endif # endif
#else
# define RAPTOR_API
#endif #endif
/* Use gcc 3.1+ feature to allow marking of deprecated API calls. /* Use gcc 3.1+ feature to allow marking of deprecated API calls.
* This gives a warning during compiling. * This gives a warning during compiling.
*/ */
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3 #if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3
#ifdef __APPLE_CC__ #ifdef __APPLE_CC__
/* OSX gcc cpp-precomp is broken */ /* OSX gcc cpp-precomp is broken */
#define RAPTOR_DEPRECATED #define RAPTOR_DEPRECATED
#else #else
skipping to change at line 219 skipping to change at line 215
/** /**
* raptor_ntriples_parser: * raptor_ntriples_parser:
* *
* @Deprecated: use #raptor_parser. * @Deprecated: use #raptor_parser.
* *
* old structure - use #raptor_parser instead. * old structure - use #raptor_parser instead.
*/ */
typedef raptor_parser raptor_ntriples_parser; typedef raptor_parser raptor_ntriples_parser;
/** /**
* raptor_sax2:
*
* Raptor SAX2 class
*/
typedef struct raptor_sax2_s raptor_sax2;
/**
* raptor_identifier_type: * raptor_identifier_type:
* @RAPTOR_IDENTIFIER_TYPE_RESOURCE: Resource URI (e.g. <literal>rdf:abo ut</literal>) * @RAPTOR_IDENTIFIER_TYPE_RESOURCE: Resource URI (e.g. <literal>rdf:abo ut</literal>)
* @RAPTOR_IDENTIFIER_TYPE_ANONYMOUS: <literal>_:foo</literal> N-Triples, or generated * @RAPTOR_IDENTIFIER_TYPE_ANONYMOUS: <literal>_:foo</literal> N-Triples, or generated
* @RAPTOR_IDENTIFIER_TYPE_PREDICATE: predicate URI. WARNING: Will not b e generated in in Raptor 1.4.9 or newer. Instead a #RAPTOR_IDENTIFIER_TYPE _RESOURCE will be returned. * @RAPTOR_IDENTIFIER_TYPE_PREDICATE: predicate URI. WARNING: Will not b e generated in in Raptor 1.4.9 or newer. Instead a #RAPTOR_IDENTIFIER_TYPE _RESOURCE will be returned.
* @RAPTOR_IDENTIFIER_TYPE_ORDINAL: <literal>rdf:li</literal>, <literal >rdf:_</literal><emphasis>n</emphasis>. No longer generated in any parser in Raptor 1.4.10+, instead a #RAPTOR_IDENTIFIER_TYPE_RESOURCE is returned. * @RAPTOR_IDENTIFIER_TYPE_ORDINAL: <literal>rdf:li</literal>, <literal >rdf:_</literal><emphasis>n</emphasis>. No longer generated in any parser in Raptor 1.4.10+, instead a #RAPTOR_IDENTIFIER_TYPE_RESOURCE is returned.
* @RAPTOR_IDENTIFIER_TYPE_LITERAL: regular literal * @RAPTOR_IDENTIFIER_TYPE_LITERAL: regular literal
* @RAPTOR_IDENTIFIER_TYPE_XML_LITERAL: <literal>rdf:parseType="Literal"</l iteral>. No longer generated by any parser in Raptor 1.4.8+, instead a #RA PTOR_IDENTIFIER_TYPE_LITERAL is returned with a datatype of <literal>rdf:XM LLiteral</literal>. * @RAPTOR_IDENTIFIER_TYPE_XML_LITERAL: <literal>rdf:parseType="Literal"</l iteral>. No longer generated by any parser in Raptor 1.4.8+, instead a #RA PTOR_IDENTIFIER_TYPE_LITERAL is returned with a datatype of <literal>rdf:XM LLiteral</literal>.
* @RAPTOR_IDENTIFIER_TYPE_UNKNOWN: Internal * @RAPTOR_IDENTIFIER_TYPE_UNKNOWN: Internal
* *
* Type of identifier in a #raptor_statement * Type of identifier in a #raptor_statement
skipping to change at line 360 skipping to change at line 363
* GraphViz DOT serializer. * GraphViz DOT serializer.
* @RAPTOR_FEATURE_BNODE_FILL: Fill color of blank nodes for * @RAPTOR_FEATURE_BNODE_FILL: Fill color of blank nodes for
* GraphViz DOT serializer. * GraphViz DOT serializer.
* @RAPTOR_FEATURE_HTML_TAG_SOUP: Use a lax HTML parser if an XML parser * @RAPTOR_FEATURE_HTML_TAG_SOUP: Use a lax HTML parser if an XML parser
* fails when read HTML for GRDDL parser. * fails when read HTML for GRDDL parser.
* @RAPTOR_FEATURE_MICROFORMATS: Look for microformats for GRDDL parser. * @RAPTOR_FEATURE_MICROFORMATS: Look for microformats for GRDDL parser.
* @RAPTOR_FEATURE_HTML_LINK: Look for head &lt;link&gt; to type rdf/xml * @RAPTOR_FEATURE_HTML_LINK: Look for head &lt;link&gt; to type rdf/xml
* for GRDDL parser. * for GRDDL parser.
* @RAPTOR_FEATURE_WWW_TIMEOUT: Set timeout for internal WWW URI requests * @RAPTOR_FEATURE_WWW_TIMEOUT: Set timeout for internal WWW URI requests
* for GRDDL parser. * for GRDDL parser.
* @RAPTOR_FEATURE_WRITE_BASE_URI: Write @base directive for Turtle/N3.
* @RAPTOR_FEATURE_WWW_HTTP_CACHE_CONTROL: HTTP Cache-Control: header
* @RAPTOR_FEATURE_WWW_HTTP_USER_AGENT: HTTP User-Agent: header
* @RAPTOR_FEATURE_JSON_CALLBACK: JSON serializer callback function.
* @RAPTOR_FEATURE_JSON_EXTRA_DATA: JSON serializer extra top-level data
* @RAPTOR_FEATURE_LAST: Internal * @RAPTOR_FEATURE_LAST: Internal
* *
* Raptor parser, serializer or XML writer features. * Raptor parser, serializer or XML writer features.
*/ */
typedef enum { typedef enum {
RAPTOR_FEATURE_SCANNING, RAPTOR_FEATURE_SCANNING,
RAPTOR_FEATURE_ASSUME_IS_RDF, RAPTOR_FEATURE_ASSUME_IS_RDF,
RAPTOR_FEATURE_ALLOW_NON_NS_ATTRIBUTES, RAPTOR_FEATURE_ALLOW_NON_NS_ATTRIBUTES,
RAPTOR_FEATURE_ALLOW_OTHER_PARSETYPES, RAPTOR_FEATURE_ALLOW_OTHER_PARSETYPES,
RAPTOR_FEATURE_ALLOW_BAGID, RAPTOR_FEATURE_ALLOW_BAGID,
skipping to change at line 393 skipping to change at line 401
RAPTOR_FEATURE_RESOURCE_BORDER, RAPTOR_FEATURE_RESOURCE_BORDER,
RAPTOR_FEATURE_LITERAL_BORDER, RAPTOR_FEATURE_LITERAL_BORDER,
RAPTOR_FEATURE_BNODE_BORDER, RAPTOR_FEATURE_BNODE_BORDER,
RAPTOR_FEATURE_RESOURCE_FILL, RAPTOR_FEATURE_RESOURCE_FILL,
RAPTOR_FEATURE_LITERAL_FILL, RAPTOR_FEATURE_LITERAL_FILL,
RAPTOR_FEATURE_BNODE_FILL, RAPTOR_FEATURE_BNODE_FILL,
RAPTOR_FEATURE_HTML_TAG_SOUP, RAPTOR_FEATURE_HTML_TAG_SOUP,
RAPTOR_FEATURE_MICROFORMATS, RAPTOR_FEATURE_MICROFORMATS,
RAPTOR_FEATURE_HTML_LINK, RAPTOR_FEATURE_HTML_LINK,
RAPTOR_FEATURE_WWW_TIMEOUT, RAPTOR_FEATURE_WWW_TIMEOUT,
RAPTOR_FEATURE_LAST=RAPTOR_FEATURE_WWW_TIMEOUT RAPTOR_FEATURE_WRITE_BASE_URI,
RAPTOR_FEATURE_WWW_HTTP_CACHE_CONTROL,
RAPTOR_FEATURE_WWW_HTTP_USER_AGENT,
RAPTOR_FEATURE_JSON_CALLBACK,
RAPTOR_FEATURE_JSON_EXTRA_DATA,
RAPTOR_FEATURE_LAST=RAPTOR_FEATURE_JSON_EXTRA_DATA
} raptor_feature; } raptor_feature;
/** /**
* raptor_genid_type: * raptor_genid_type:
* @RAPTOR_GENID_TYPE_BNODEID: Generated ID is for a blank node * @RAPTOR_GENID_TYPE_BNODEID: Generated ID is for a blank node
* @RAPTOR_GENID_TYPE_BAGID: Generated ID is for rdf:bagID * @RAPTOR_GENID_TYPE_BAGID: Generated ID is for rdf:bagID
* *
* Intended type for a generated identifier asked for by the handler * Intended type for a generated identifier asked for by the handler
* registered with raptor_set_generate_id_handler(). * registered with raptor_set_generate_id_handler().
*/ */
skipping to change at line 650 skipping to change at line 663
* raptor_set_error_handler(), raptor_set_warning_handler(), * raptor_set_error_handler(), raptor_set_warning_handler(),
* raptor_serializer_set_error_handler() and * raptor_serializer_set_error_handler() and
* raptor_serializer_set_warning_handler(). * raptor_serializer_set_warning_handler().
* *
* Also used by raptor_www_set_error_handler() for location-based errors * Also used by raptor_www_set_error_handler() for location-based errors
* in WWW retrieval. * in WWW retrieval.
*/ */
typedef void (*raptor_message_handler)(void *user_data, raptor_locator* loc ator, const char *message); typedef void (*raptor_message_handler)(void *user_data, raptor_locator* loc ator, const char *message);
/** /**
* raptor_message_handler_closure:
* @user_data: user data for handler invocation
* @handler: handler function
*
* The combination of a message handler and the user data to send to it.
*/
typedef struct {
void *user_data;
raptor_message_handler handler;
} raptor_message_handler_closure;
/**
* raptor_statement_handler: * raptor_statement_handler:
* @user_data: user data * @user_data: user data
* @statement: statement to report * @statement: statement to report
* *
* Statement (triple) reporting handler function. * Statement (triple) reporting handler function.
*/ */
typedef void (*raptor_statement_handler)(void *user_data, const raptor_stat ement *statement); typedef void (*raptor_statement_handler)(void *user_data, const raptor_stat ement *statement);
/** /**
* raptor_graph_handler: * raptor_graph_handler:
skipping to change at line 798 skipping to change at line 823
RAPTOR_API RAPTOR_API
void raptor_print_statement(const raptor_statement * statement, FILE *strea m); void raptor_print_statement(const raptor_statement * statement, FILE *strea m);
RAPTOR_API RAPTOR_API
void raptor_print_statement_as_ntriples(const raptor_statement * statement, FILE *stream); void raptor_print_statement_as_ntriples(const raptor_statement * statement, FILE *stream);
RAPTOR_API RAPTOR_DEPRECATED RAPTOR_API RAPTOR_DEPRECATED
void raptor_print_statement_detailed(const raptor_statement * statement, in t detailed, FILE *stream); void raptor_print_statement_detailed(const raptor_statement * statement, in t detailed, FILE *stream);
RAPTOR_API RAPTOR_API
unsigned char* raptor_statement_part_as_counted_string(const void *term, ra ptor_identifier_type type, raptor_uri* literal_datatype, const unsigned cha r *literal_language, size_t* len_p); unsigned char* raptor_statement_part_as_counted_string(const void *term, ra ptor_identifier_type type, raptor_uri* literal_datatype, const unsigned cha r *literal_language, size_t* len_p);
RAPTOR_API RAPTOR_API
unsigned char* raptor_statement_part_as_string(const void *term, raptor_ide ntifier_type type, raptor_uri* literal_datatype, const unsigned char *liter al_language); unsigned char* raptor_statement_part_as_string(const void *term, raptor_ide ntifier_type type, raptor_uri* literal_datatype, const unsigned char *liter al_language);
RAPTOR_API
int raptor_statement_compare(const raptor_statement *s1, const raptor_state
ment *s2);
RAPTOR_API RAPTOR_API
raptor_locator* raptor_get_locator(raptor_parser* rdf_parser); raptor_locator* raptor_get_locator(raptor_parser* rdf_parser);
RAPTOR_API RAPTOR_API
void raptor_set_default_generate_id_parameters(raptor_parser* rdf_parser, c har *prefix, int base); void raptor_set_default_generate_id_parameters(raptor_parser* rdf_parser, c har *prefix, int base);
/* Parsing functions */ /* Parsing functions */
RAPTOR_API RAPTOR_API
int raptor_parse_chunk(raptor_parser* rdf_parser, const unsigned char *buff er, size_t len, int is_end); int raptor_parse_chunk(raptor_parser* rdf_parser, const unsigned char *buff er, size_t len, int is_end);
skipping to change at line 967 skipping to change at line 994
/* Utility functions */ /* Utility functions */
RAPTOR_API RAPTOR_API
int raptor_print_ntriples_string(FILE *stream, const unsigned char *string, const char delim); int raptor_print_ntriples_string(FILE *stream, const unsigned char *string, const char delim);
RAPTOR_API RAPTOR_DEPRECATED RAPTOR_API RAPTOR_DEPRECATED
unsigned char* raptor_ntriples_string_as_utf8_string(raptor_parser* rdf_par ser, const unsigned char *src, int len, size_t *dest_lenp); unsigned char* raptor_ntriples_string_as_utf8_string(raptor_parser* rdf_par ser, const unsigned char *src, int len, size_t *dest_lenp);
RAPTOR_API RAPTOR_DEPRECATED RAPTOR_API RAPTOR_DEPRECATED
const char* raptor_ntriples_term_as_string(raptor_ntriples_term_type term); const char* raptor_ntriples_term_as_string(raptor_ntriples_term_type term);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_string_ntriples(raptor_iostream *iostr, const uns igned char *string, size_t len, const char delim); int raptor_iostream_write_string_ntriples(raptor_iostream *iostr, const uns igned char *string, size_t len, const char delim);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_string_python(raptor_iostream *iostr, const unsig
ned char *string, size_t len, const char delim, int flags);
RAPTOR_API RAPTOR_DEPRECATED
void raptor_iostream_write_string_turtle(raptor_iostream *iostr, const unsi gned char *string, size_t len); void raptor_iostream_write_string_turtle(raptor_iostream *iostr, const unsi gned char *string, size_t len);
RAPTOR_API RAPTOR_API
void raptor_iostream_write_statement_ntriples(raptor_iostream* iostr, const raptor_statement *statement); void raptor_iostream_write_statement_ntriples(raptor_iostream* iostr, const raptor_statement *statement);
RAPTOR_API RAPTOR_API
int raptor_xml_any_escape_string(const unsigned char *string, size_t len, u nsigned char *buffer, size_t length, char quote, int xml_version, raptor_si mple_message_handler error_handler, void *error_data); int raptor_xml_any_escape_string(const unsigned char *string, size_t len, u nsigned char *buffer, size_t length, char quote, int xml_version, raptor_si mple_message_handler error_handler, void *error_data);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_xml_any_escaped_string(raptor_iostream* iostr, co nst unsigned char *string, size_t len, char quote, int xml_version, raptor_ simple_message_handler error_handler, void *error_data); int raptor_iostream_write_xml_any_escaped_string(raptor_iostream* iostr, co nst unsigned char *string, size_t len, char quote, int xml_version, raptor_ simple_message_handler error_handler, void *error_data);
RAPTOR_API RAPTOR_API
int raptor_xml_escape_string(const unsigned char *string, size_t len, unsig ned char *buffer, size_t length, char quote, raptor_simple_message_handler error_handler, void *error_data); int raptor_xml_escape_string(const unsigned char *string, size_t len, unsig ned char *buffer, size_t length, char quote, raptor_simple_message_handler error_handler, void *error_data);
RAPTOR_API RAPTOR_API
skipping to change at line 1012 skipping to change at line 1041
RAPTOR_API RAPTOR_API
unsigned char* raptor_uri_to_relative_uri_string(raptor_uri *base_uri, rap tor_uri *reference_uri); unsigned char* raptor_uri_to_relative_uri_string(raptor_uri *base_uri, rap tor_uri *reference_uri);
RAPTOR_API RAPTOR_API
void raptor_uri_print(const raptor_uri* uri, FILE *stream); void raptor_uri_print(const raptor_uri* uri, FILE *stream);
RAPTOR_API RAPTOR_API
unsigned char* raptor_uri_to_counted_string(raptor_uri *uri, size_t *len_p) ; unsigned char* raptor_uri_to_counted_string(raptor_uri *uri, size_t *len_p) ;
RAPTOR_API RAPTOR_API
unsigned char* raptor_uri_to_string(raptor_uri *uri); unsigned char* raptor_uri_to_string(raptor_uri *uri);
RAPTOR_API RAPTOR_API
void raptor_uri_set_handler(raptor_uri_handler *handler, void *context); void raptor_uri_set_handler(const raptor_uri_handler *handler, void *contex t);
RAPTOR_API RAPTOR_API
void raptor_uri_get_handler(raptor_uri_handler **handler, void **context); void raptor_uri_get_handler(const raptor_uri_handler **handler, void **cont ext);
/** /**
* RAPTOR_RDF_MS_URI: * RAPTOR_RDF_MS_URI:
* *
* RDF Namespace URI (rdf:). * RDF Namespace URI (rdf:).
* *
* Copy with raptor_uri_copy() to use. * Copy with raptor_uri_copy() to use.
*/ */
#define RAPTOR_RDF_MS_URI raptor_rdf_namespace_uri #define RAPTOR_RDF_MS_URI raptor_rdf_namespace_uri
skipping to change at line 1086 skipping to change at line 1115
void raptor_www_set_content_type_handler(raptor_www *www, raptor_www_conten t_type_handler handler, void *user_data); void raptor_www_set_content_type_handler(raptor_www *www, raptor_www_conten t_type_handler handler, void *user_data);
RAPTOR_API RAPTOR_API
void raptor_www_set_final_uri_handler(raptor_www* www, raptor_www_final_uri _handler handler, void *user_data); void raptor_www_set_final_uri_handler(raptor_www* www, raptor_www_final_uri _handler handler, void *user_data);
RAPTOR_API RAPTOR_API
void raptor_www_set_error_handler(raptor_www *www, raptor_message_handler e rror_handler, void *error_data); void raptor_www_set_error_handler(raptor_www *www, raptor_message_handler e rror_handler, void *error_data);
RAPTOR_API RAPTOR_API
void raptor_www_set_uri_filter(raptor_www* www, raptor_uri_filter_func filt er, void* user_data); void raptor_www_set_uri_filter(raptor_www* www, raptor_uri_filter_func filt er, void* user_data);
RAPTOR_API RAPTOR_API
void raptor_www_set_connection_timeout(raptor_www* www, int timeout); void raptor_www_set_connection_timeout(raptor_www* www, int timeout);
RAPTOR_API RAPTOR_API
int raptor_www_set_http_cache_control(raptor_www* www, const char* cache_co
ntrol);
RAPTOR_API
int raptor_www_fetch(raptor_www *www, raptor_uri *uri); int raptor_www_fetch(raptor_www *www, raptor_uri *uri);
RAPTOR_API RAPTOR_API
int raptor_www_fetch_to_string(raptor_www *www, raptor_uri *uri, void **str ing_p, size_t *length_p, void *(*malloc_handler)(size_t size)); int raptor_www_fetch_to_string(raptor_www *www, raptor_uri *uri, void **str ing_p, size_t *length_p, void *(*malloc_handler)(size_t size));
RAPTOR_API RAPTOR_API
void* raptor_www_get_connection(raptor_www *www); void* raptor_www_get_connection(raptor_www *www);
RAPTOR_API RAPTOR_API
void raptor_www_abort(raptor_www *www, const char *reason); void raptor_www_abort(raptor_www *www, const char *reason);
RAPTOR_API RAPTOR_API
raptor_uri* raptor_www_get_final_uri(raptor_www* www); raptor_uri* raptor_www_get_final_uri(raptor_www* www);
skipping to change at line 1114 skipping to change at line 1145
void raptor_free_qname(raptor_qname* name); void raptor_free_qname(raptor_qname* name);
RAPTOR_API RAPTOR_API
int raptor_qname_equal(raptor_qname *name1, raptor_qname *name2); int raptor_qname_equal(raptor_qname *name1, raptor_qname *name2);
/* utility function */ /* utility function */
RAPTOR_API RAPTOR_API
raptor_uri* raptor_qname_string_to_uri(raptor_namespace_stack *nstack, con st unsigned char *name, size_t name_len, raptor_simple_message_handler erro r_handler, void *error_data); raptor_uri* raptor_qname_string_to_uri(raptor_namespace_stack *nstack, con st unsigned char *name, size_t name_len, raptor_simple_message_handler erro r_handler, void *error_data);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_qname(raptor_iostream* iostr, raptor_qname *qname ); int raptor_iostream_write_qname(raptor_iostream* iostr, raptor_qname *qname );
RAPTOR_API RAPTOR_API
const raptor_namespace* raptor_qname_get_namespace(raptor_qname* name); const raptor_namespace* raptor_qname_get_namespace(raptor_qname* name);
RAPTOR_API
const unsigned char* raptor_qname_get_local_name(raptor_qname* name);
RAPTOR_API
const unsigned char* raptor_qname_get_value(raptor_qname* name);
RAPTOR_API
const unsigned char* raptor_qname_get_counted_value(raptor_qname* name, siz
e_t* length_p);
/* raptor_namespace_stack - stack of XML namespaces */ /* raptor_namespace_stack - stack of XML namespaces */
RAPTOR_API RAPTOR_API
raptor_namespace* raptor_new_namespace_from_uri(raptor_namespace_stack *nst ack, const unsigned char *prefix, raptor_uri* ns_uri, int depth); raptor_namespace* raptor_new_namespace_from_uri(raptor_namespace_stack *nst ack, const unsigned char *prefix, raptor_uri* ns_uri, int depth);
RAPTOR_API RAPTOR_API
raptor_namespace_stack* raptor_new_namespaces(raptor_uri_handler *uri_handl er, void *uri_context, raptor_simple_message_handler error_handler, void *e rror_data, int defaults); raptor_namespace_stack* raptor_new_namespaces(const raptor_uri_handler *uri _handler, void *uri_context, raptor_simple_message_handler error_handler, v oid *error_data, int defaults);
RAPTOR_API RAPTOR_API
int raptor_namespaces_init(raptor_namespace_stack *nstack, raptor_uri_handl er *uri_handler, void *uri_context, raptor_simple_message_handler error_han dler, void *error_data, int defaults); int raptor_namespaces_init(raptor_namespace_stack *nstack, const raptor_uri _handler *uri_handler, void *uri_context, raptor_simple_message_handler err or_handler, void *error_data, int defaults);
RAPTOR_API RAPTOR_API
void raptor_namespaces_clear(raptor_namespace_stack *nstack); void raptor_namespaces_clear(raptor_namespace_stack *nstack);
RAPTOR_API RAPTOR_API
void raptor_free_namespaces(raptor_namespace_stack *nstack); void raptor_free_namespaces(raptor_namespace_stack *nstack);
RAPTOR_API RAPTOR_API
void raptor_namespaces_start_namespace(raptor_namespace_stack *nstack, rapt or_namespace *nspace); void raptor_namespaces_start_namespace(raptor_namespace_stack *nstack, rapt or_namespace *nspace);
RAPTOR_API RAPTOR_API
int raptor_namespaces_start_namespace_full(raptor_namespace_stack *nstack, const unsigned char *prefix, const unsigned char *ns_uri_string, int depth) ; int raptor_namespaces_start_namespace_full(raptor_namespace_stack *nstack, const unsigned char *prefix, const unsigned char *ns_uri_string, int depth) ;
RAPTOR_API RAPTOR_API
void raptor_namespaces_end_for_depth(raptor_namespace_stack *nstack, int de pth); void raptor_namespaces_end_for_depth(raptor_namespace_stack *nstack, int de pth);
skipping to change at line 1339 skipping to change at line 1376
/** /**
* raptor_iostream_write_end_func: * raptor_iostream_write_end_func:
* @context: stream context data * @context: stream context data
* *
* Handler function for implementing raptor_iostream_write_end(). * Handler function for implementing raptor_iostream_write_end().
* *
*/ */
typedef void (*raptor_iostream_write_end_func) (void *context); typedef void (*raptor_iostream_write_end_func) (void *context);
/** /**
* raptor_iostream_read_bytes_func:
* @context: stream context data
* @ptr: pointer to buffer to read into
* @size: size of buffer
* @nmemb: number of items
*
* Handler function for implementing raptor_iostream_read_bytes().
*
* Return value: number of items read, 0 or < @size on EOF, <0 on failure
*/
typedef int (*raptor_iostream_read_bytes_func) (void *context, void *ptr, s
ize_t size, size_t nmemb);
/**
* raptor_iostream_read_eof_func:
* @context: stream context data
*
* Handler function for implementing raptor_iostream_read_eof().
*
* Return value: non-0 if EOF
*/
typedef int (*raptor_iostream_read_eof_func) (void *context);
/**
* raptor_iostream_handler: * raptor_iostream_handler:
* @init: initialisation handler - optional, called at most once * @init: initialisation handler - optional, called at most once
* @finish: finishing handler - optional, called at most once * @finish: finishing handler - optional, called at most once
* @write_byte: write byte handler - required * @write_byte: write byte handler - required (for writing)
* @write_bytes: write bytes handler - required * @write_bytes: write bytes handler - required (for writing)
* @write_end: write end handler - optional, called at most once * @write_end: write end handler - optional (for writing), called at most o
nce
* *
* I/O stream implementation handler structure. * I/O stream implementation handler structure.
* *
* DEPRECATED: Use #raptor_iostream_handler2
*/ */
typedef struct { typedef struct {
raptor_iostream_init_func init; raptor_iostream_init_func init;
raptor_iostream_finish_func finish; raptor_iostream_finish_func finish;
raptor_iostream_write_byte_func write_byte; raptor_iostream_write_byte_func write_byte;
raptor_iostream_write_bytes_func write_bytes; raptor_iostream_write_bytes_func write_bytes;
raptor_iostream_write_end_func write_end; raptor_iostream_write_end_func write_end;
} raptor_iostream_handler; } raptor_iostream_handler;
RAPTOR_API /**
* raptor_iostream_handler2:
* @version: interface version. Presently 1 or 2.
* @init: initialisation handler - optional, called at most once (V1)
* @finish: finishing handler - optional, called at most once (V1)
* @write_byte: write byte handler - required (for writing) (V1)
* @write_bytes: write bytes handler - required (for writing) (V1)
* @write_end: write end handler - optional (for writing), called at most o
nce (V1)
* @read_bytes: read bytes handler - required (for reading) (V2)
* @read_eof: read EOF handler - required (for reading) (V2)
*
* I/O stream implementation handler structure.
*
*/
typedef struct {
int version;
/* V1 functions */
raptor_iostream_init_func init;
raptor_iostream_finish_func finish;
raptor_iostream_write_byte_func write_byte;
raptor_iostream_write_bytes_func write_bytes;
raptor_iostream_write_end_func write_end;
/* V2 functions */
raptor_iostream_read_bytes_func read_bytes;
raptor_iostream_read_eof_func read_eof;
} raptor_iostream_handler2;
RAPTOR_API RAPTOR_DEPRECATED
raptor_iostream* raptor_new_iostream_from_handler(void *context, const rapt or_iostream_handler *handler); raptor_iostream* raptor_new_iostream_from_handler(void *context, const rapt or_iostream_handler *handler);
RAPTOR_API RAPTOR_API
raptor_iostream* raptor_new_iostream_from_handler2(void *user_data, const r
aptor_iostream_handler2* const handler2);
RAPTOR_API
raptor_iostream* raptor_new_iostream_to_sink(void); raptor_iostream* raptor_new_iostream_to_sink(void);
RAPTOR_API RAPTOR_API
raptor_iostream* raptor_new_iostream_to_filename(const char *filename); raptor_iostream* raptor_new_iostream_to_filename(const char *filename);
RAPTOR_API RAPTOR_API
raptor_iostream* raptor_new_iostream_to_file_handle(FILE *handle); raptor_iostream* raptor_new_iostream_to_file_handle(FILE *handle);
RAPTOR_API RAPTOR_API
raptor_iostream* raptor_new_iostream_to_string(void **string_p, size_t *len gth_p, void *(*malloc_handler)(size_t size)); raptor_iostream* raptor_new_iostream_to_string(void **string_p, size_t *len gth_p, void *(*malloc_handler)(size_t size));
RAPTOR_API RAPTOR_API
raptor_iostream* raptor_new_iostream_from_sink(void);
RAPTOR_API
raptor_iostream* raptor_new_iostream_from_filename(const char *filename);
RAPTOR_API
raptor_iostream* raptor_new_iostream_from_file_handle(FILE *handle);
RAPTOR_API
raptor_iostream* raptor_new_iostream_from_string(void *string, size_t lengt
h);
RAPTOR_API
void raptor_free_iostream(raptor_iostream *iostr); void raptor_free_iostream(raptor_iostream *iostr);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_bytes(raptor_iostream *iostr, const void *ptr, si ze_t size, size_t nmemb); int raptor_iostream_write_bytes(raptor_iostream *iostr, const void *ptr, si ze_t size, size_t nmemb);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_byte(raptor_iostream *iostr, const int byte); int raptor_iostream_write_byte(raptor_iostream *iostr, const int byte);
RAPTOR_API RAPTOR_API
void raptor_iostream_write_end(raptor_iostream *iostr); void raptor_iostream_write_end(raptor_iostream *iostr);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_string(raptor_iostream *iostr, const void *string ); int raptor_iostream_write_string(raptor_iostream *iostr, const void *string );
RAPTOR_API RAPTOR_API
int raptor_iostream_write_counted_string(raptor_iostream *iostr, const void *string, size_t len); int raptor_iostream_write_counted_string(raptor_iostream *iostr, const void *string, size_t len);
skipping to change at line 1379 skipping to change at line 1480
RAPTOR_API RAPTOR_API
int raptor_iostream_write_bytes(raptor_iostream *iostr, const void *ptr, si ze_t size, size_t nmemb); int raptor_iostream_write_bytes(raptor_iostream *iostr, const void *ptr, si ze_t size, size_t nmemb);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_byte(raptor_iostream *iostr, const int byte); int raptor_iostream_write_byte(raptor_iostream *iostr, const int byte);
RAPTOR_API RAPTOR_API
void raptor_iostream_write_end(raptor_iostream *iostr); void raptor_iostream_write_end(raptor_iostream *iostr);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_string(raptor_iostream *iostr, const void *string ); int raptor_iostream_write_string(raptor_iostream *iostr, const void *string );
RAPTOR_API RAPTOR_API
int raptor_iostream_write_counted_string(raptor_iostream *iostr, const void *string, size_t len); int raptor_iostream_write_counted_string(raptor_iostream *iostr, const void *string, size_t len);
RAPTOR_API RAPTOR_API RAPTOR_DEPRECATED
size_t raptor_iostream_get_bytes_written_count(raptor_iostream *iostr); size_t raptor_iostream_get_bytes_written_count(raptor_iostream *iostr);
RAPTOR_API RAPTOR_API
unsigned long raptor_iostream_tell(raptor_iostream *iostr);
RAPTOR_API
int raptor_iostream_write_decimal(raptor_iostream* iostr, int integer); int raptor_iostream_write_decimal(raptor_iostream* iostr, int integer);
RAPTOR_API RAPTOR_API
int raptor_iostream_format_hexadecimal(raptor_iostream* iostr, unsigned int integer, int width); int raptor_iostream_format_hexadecimal(raptor_iostream* iostr, unsigned int integer, int width);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_stringbuffer(raptor_iostream* iostr, raptor_strin gbuffer *sb); int raptor_iostream_write_stringbuffer(raptor_iostream* iostr, raptor_strin gbuffer *sb);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_uri(raptor_iostream *iostr, raptor_uri *uri); int raptor_iostream_write_uri(raptor_iostream *iostr, raptor_uri *uri);
RAPTOR_API
int raptor_iostream_read_bytes(raptor_iostream* iostr, void *ptr, size_t si
ze, size_t nmemb);
RAPTOR_API
int raptor_iostream_read_eof(raptor_iostream *iostr);
/* Parser and Serializer features */ /* Parser and Serializer features */
RAPTOR_API RAPTOR_API
raptor_feature raptor_feature_from_uri(raptor_uri *uri); raptor_feature raptor_feature_from_uri(raptor_uri *uri);
RAPTOR_API RAPTOR_API
int raptor_feature_value_type(const raptor_feature feature); int raptor_feature_value_type(const raptor_feature feature);
/* SAX2 element Class (raptor_xml_element) */ /* SAX2 element Class (raptor_xml_element) */
RAPTOR_API RAPTOR_API
raptor_xml_element* raptor_new_xml_element(raptor_qname* name, const unsign ed char* xml_language, raptor_uri* xml_base); raptor_xml_element* raptor_new_xml_element(raptor_qname* name, const unsign ed char* xml_language, raptor_uri* xml_base);
skipping to change at line 1417 skipping to change at line 1524
RAPTOR_API RAPTOR_API
raptor_qname** raptor_xml_element_get_attributes(raptor_xml_element* xml_el ement); raptor_qname** raptor_xml_element_get_attributes(raptor_xml_element* xml_el ement);
RAPTOR_API RAPTOR_API
int raptor_xml_element_get_attributes_count(raptor_xml_element* xml_element ); int raptor_xml_element_get_attributes_count(raptor_xml_element* xml_element );
RAPTOR_API RAPTOR_API
int raptor_xml_element_declare_namespace(raptor_xml_element* xml_element, r aptor_namespace *nspace); int raptor_xml_element_declare_namespace(raptor_xml_element* xml_element, r aptor_namespace *nspace);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_xml_element(raptor_iostream *iostr, raptor_xml_el ement *element, raptor_namespace_stack *nstack, int is_empty, int is_end, r aptor_simple_message_handler error_handler, void *error_data, int depth); int raptor_iostream_write_xml_element(raptor_iostream *iostr, raptor_xml_el ement *element, raptor_namespace_stack *nstack, int is_empty, int is_end, r aptor_simple_message_handler error_handler, void *error_data, int depth);
RAPTOR_API RAPTOR_API
int raptor_xml_element_is_empty(raptor_xml_element* xml_element); int raptor_xml_element_is_empty(raptor_xml_element* xml_element);
RAPTOR_API
const unsigned char* raptor_xml_element_get_language(raptor_xml_element* xm
l_element);
/* XML Writer Class (raptor_xml_writer) */ /* XML Writer Class (raptor_xml_writer) */
RAPTOR_API RAPTOR_API
raptor_xml_writer* raptor_new_xml_writer(raptor_namespace_stack *nstack, ra ptor_uri_handler *uri_handler, void *uri_context, raptor_iostream* iostr, r aptor_simple_message_handler error_handler, void *error_data, int canonical ize); raptor_xml_writer* raptor_new_xml_writer(raptor_namespace_stack *nstack, co nst raptor_uri_handler *uri_handler, void *uri_context, raptor_iostream* io str, raptor_simple_message_handler error_handler, void *error_data, int can onicalize);
RAPTOR_API RAPTOR_API
void raptor_free_xml_writer(raptor_xml_writer* xml_writer); void raptor_free_xml_writer(raptor_xml_writer* xml_writer);
RAPTOR_API RAPTOR_API
void raptor_xml_writer_empty_element(raptor_xml_writer* xml_writer, raptor_ xml_element *element); void raptor_xml_writer_empty_element(raptor_xml_writer* xml_writer, raptor_ xml_element *element);
RAPTOR_API RAPTOR_API
void raptor_xml_writer_start_element(raptor_xml_writer* xml_writer, raptor_ xml_element *element); void raptor_xml_writer_start_element(raptor_xml_writer* xml_writer, raptor_ xml_element *element);
RAPTOR_API RAPTOR_API
void raptor_xml_writer_end_element(raptor_xml_writer* xml_writer, raptor_xm l_element *element); void raptor_xml_writer_end_element(raptor_xml_writer* xml_writer, raptor_xm l_element *element);
RAPTOR_API RAPTOR_API
void raptor_xml_writer_cdata(raptor_xml_writer* xml_writer, const unsigned char *s); void raptor_xml_writer_cdata(raptor_xml_writer* xml_writer, const unsigned char *s);
skipping to change at line 1452 skipping to change at line 1561
int raptor_xml_writer_features_enumerate(const raptor_feature feature, cons t char **name, raptor_uri **uri, const char **label); int raptor_xml_writer_features_enumerate(const raptor_feature feature, cons t char **name, raptor_uri **uri, const char **label);
RAPTOR_API RAPTOR_API
int raptor_xml_writer_set_feature(raptor_xml_writer *xml_writer, raptor_fea ture feature, int value); int raptor_xml_writer_set_feature(raptor_xml_writer *xml_writer, raptor_fea ture feature, int value);
RAPTOR_API RAPTOR_API
int raptor_xml_writer_set_feature_string(raptor_xml_writer *xml_writer, rap tor_feature feature, const unsigned char *value); int raptor_xml_writer_set_feature_string(raptor_xml_writer *xml_writer, rap tor_feature feature, const unsigned char *value);
RAPTOR_API RAPTOR_API
int raptor_xml_writer_get_feature(raptor_xml_writer *xml_writer, raptor_fea ture feature); int raptor_xml_writer_get_feature(raptor_xml_writer *xml_writer, raptor_fea ture feature);
RAPTOR_API RAPTOR_API
const unsigned char *raptor_xml_writer_get_feature_string(raptor_xml_writer *xml_writer, raptor_feature feature); const unsigned char *raptor_xml_writer_get_feature_string(raptor_xml_writer *xml_writer, raptor_feature feature);
/**
* raptor_sax2_start_element_handler:
* @user_data: user data
* @xml_element: XML element
*
* SAX2 start element handler
*/
typedef void (*raptor_sax2_start_element_handler)(void *user_data, raptor_x
ml_element *xml_element);
/**
* raptor_sax2_end_element_handler:
* @user_data: user data
* @xml_element: XML element
*
* SAX2 end element handler
*/
typedef void (*raptor_sax2_end_element_handler)(void *user_data, raptor_xml
_element* xml_element);
/**
* raptor_sax2_characters_handler:
* @user_data: user data
* @xml_element: XML element
* @s: string
* @len: string len
*
* SAX2 characters handler
*/
typedef void (*raptor_sax2_characters_handler)(void *user_data, raptor_xml_
element* xml_element, const unsigned char *s, int len);
/**
* raptor_sax2_cdata_handler:
* @user_data: user data
* @xml_element: XML element
* @s: string
* @len: string len
* SAX2 CDATA section handler
*/
typedef void (*raptor_sax2_cdata_handler)(void *user_data, raptor_xml_eleme
nt* xml_element, const unsigned char *s, int len);
/**
* raptor_sax2_comment_handler:
* @user_data: user data
* @xml_element: XML element
* @s: string
*
* SAX2 XML comment handler
*/
typedef void (*raptor_sax2_comment_handler)(void *user_data, raptor_xml_ele
ment* xml_element, const unsigned char *s);
/**
* raptor_sax2_unparsed_entity_decl_handler:
* @user_data: user data
* @entityName: entity name
* @base: base URI
* @systemId: system ID
* @publicId: public ID
* @notationName: notation name
*
* SAX2 unparsed entity (NDATA) handler
*/
typedef void (*raptor_sax2_unparsed_entity_decl_handler)(void *user_data, c
onst unsigned char* entityName, const unsigned char* base, const unsigned c
har* systemId, const unsigned char* publicId, const unsigned char* notation
Name);
/**
* raptor_sax2_external_entity_ref_handler:
* @user_data: user data
* @context: context
* @base: base URI
* @systemId: system ID
* @publicId: public ID
*
* SAX2 external entity reference handler
*
* Return value: 0 if processing should not continue because of a
* fatal error in the handling of the external entity.
*/
typedef int (*raptor_sax2_external_entity_ref_handler)(void *user_data, con
st unsigned char* context, const unsigned char* base, const unsigned char*
systemId, const unsigned char* publicId);
/**
* raptor_log_level:
* @RAPTOR_LOG_LEVEL_NONE: Internal
* @RAPTOR_LOG_LEVEL_FATAL: Fatal error message
* @RAPTOR_LOG_LEVEL_ERROR: Error message
* @RAPTOR_LOG_LEVEL_WARNING: Warning message
* @RAPTOR_LOG_LEVEL_LAST: Internal
*
* Log levels
*/
typedef enum {
RAPTOR_LOG_LEVEL_NONE,
RAPTOR_LOG_LEVEL_FATAL,
RAPTOR_LOG_LEVEL_ERROR,
RAPTOR_LOG_LEVEL_WARNING,
RAPTOR_LOG_LEVEL_LAST=RAPTOR_LOG_LEVEL_WARNING
} raptor_log_level;
/**
* raptor_error_handlers:
* @magic: magic value - must use raptor_error_handlers_init() to set this
* @locator: raptor locator of the error
* @last_log_level: number of log levels; size of @handlers arrays
* @handlers: user handlers per log level
*
* Error handlers structure
*/
typedef struct {
unsigned int magic;
raptor_locator* locator;
/* size of handlers array */
raptor_log_level last_log_level;
raptor_message_handler_closure handlers[RAPTOR_LOG_LEVEL_LAST+1];
} raptor_error_handlers;
RAPTOR_API
void raptor_error_handlers_init(raptor_error_handlers* error_handlers);
/* SAX2 API */
RAPTOR_API
raptor_sax2* raptor_new_sax2(void *user_data, raptor_error_handlers* error_
handlers);
RAPTOR_API
void raptor_free_sax2(raptor_sax2 *sax2);
RAPTOR_API
void raptor_sax2_set_start_element_handler(raptor_sax2* sax2, raptor_sax2_s
tart_element_handler handler);
RAPTOR_API
void raptor_sax2_set_end_element_handler(raptor_sax2* sax2, raptor_sax2_end
_element_handler handler);
RAPTOR_API
void raptor_sax2_set_characters_handler(raptor_sax2* sax2, raptor_sax2_char
acters_handler handler);
RAPTOR_API
void raptor_sax2_set_cdata_handler(raptor_sax2* sax2, raptor_sax2_cdata_han
dler handler);
RAPTOR_API
void raptor_sax2_set_comment_handler(raptor_sax2* sax2, raptor_sax2_comment
_handler handler);
RAPTOR_API
void raptor_sax2_set_unparsed_entity_decl_handler(raptor_sax2* sax2, raptor
_sax2_unparsed_entity_decl_handler handler);
RAPTOR_API
void raptor_sax2_set_external_entity_ref_handler(raptor_sax2* sax2, raptor_
sax2_external_entity_ref_handler handler);
RAPTOR_API
void raptor_sax2_set_namespace_handler(raptor_sax2* sax2, raptor_namespace_
handler handler);
RAPTOR_API
void raptor_sax2_parse_start(raptor_sax2 *sax2, raptor_uri *base_uri);
RAPTOR_API
int raptor_sax2_parse_chunk(raptor_sax2* sax2, const unsigned char *buffer,
size_t len, int is_end);
RAPTOR_API
const unsigned char* raptor_sax2_inscope_xml_language(raptor_sax2* sax2);
RAPTOR_API
raptor_uri* raptor_sax2_inscope_base_uri(raptor_sax2* sax2);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 31 change blocks. 
30 lines changed or deleted 320 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/