<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="raptor-section-general">
<refmeta>
<refentrytitle role="top_of_page" id="raptor-section-general.top_of_page">General</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>RAPTOR Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>General</refname>
<refpurpose>General library startup, shutdown and utility functions</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv id="raptor-section-general.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
extern              const unsigned int <link linkend="raptor-version-major">raptor_version_major</link>;
extern              const unsigned int <link linkend="raptor-version-minor">raptor_version_minor</link>;
extern              const unsigned int <link linkend="raptor-version-release">raptor_version_release</link>;
extern              const unsigned int <link linkend="raptor-version-decimal">raptor_version_decimal</link>;
<link linkend="void">void</link>                <link linkend="raptor-init">raptor_init</link>                         (void);
<link linkend="void">void</link>                <link linkend="raptor-finish">raptor_finish</link>                       (void);
<link linkend="void">void</link>                (<link linkend="raptor-simple-message-handler">*raptor_simple_message_handler</link>)    (<link linkend="void">void</link> *user_data,
                                                         const <link linkend="char">char</link> *message,
                                                         ...);
<link linkend="void">void</link>                (<link linkend="raptor-message-handler">*raptor_message_handler</link>)           (<link linkend="void">void</link> *user_data,
                                                         <link linkend="raptor-locator">raptor_locator</link> *locator,
                                                         const <link linkend="char">char</link> *message);
<link linkend="void">void</link>                (<link linkend="raptor-statement-handler">*raptor_statement_handler</link>)         (<link linkend="void">void</link> *user_data,
                                                         const <link linkend="raptor-statement">raptor_statement</link> *statement);
<link linkend="int">int</link>                 <link linkend="raptor-parsers-enumerate">raptor_parsers_enumerate</link>            (unsigned <link linkend="int">int</link> counter,
                                                         const <link linkend="char">char</link> **name,
                                                         const <link linkend="char">char</link> **label);
<link linkend="int">int</link>                 <link linkend="raptor-syntaxes-enumerate">raptor_syntaxes_enumerate</link>           (unsigned <link linkend="int">int</link> counter,
                                                         const <link linkend="char">char</link> **name,
                                                         const <link linkend="char">char</link> **label,
                                                         const <link linkend="char">char</link> **mime_type,
                                                         unsigned <link linkend="char">char</link> **uri_string);
<link linkend="int">int</link>                 <link linkend="raptor-syntax-name-check">raptor_syntax_name_check</link>            (const <link linkend="char">char</link> *name);
const <link linkend="char">char</link>*         <link linkend="raptor-guess-parser-name">raptor_guess_parser_name</link>            (<link linkend="raptor-uri">raptor_uri</link> *uri,
                                                         const <link linkend="char">char</link> *mime_type,
                                                         unsigned <link linkend="char">char</link> *buffer,
                                                         <link linkend="size-t">size_t</link> len,
                                                         unsigned <link linkend="char">char</link> *identifier);
<link linkend="int">int</link>                 <link linkend="raptor-serializers-enumerate">raptor_serializers_enumerate</link>        (unsigned <link linkend="int">int</link> counter,
                                                         const <link linkend="char">char</link> **name,
                                                         const <link linkend="char">char</link> **label,
                                                         const <link linkend="char">char</link> **mime_type,
                                                         unsigned <link linkend="char">char</link> **uri_string);
<link linkend="int">int</link>                 <link linkend="raptor-serializer-syntax-name-check">raptor_serializer_syntax_name_check</link> (const <link linkend="char">char</link> *name);
<link linkend="int">int</link>                 <link linkend="raptor-print-ntriples-string">raptor_print_ntriples_string</link>        (<link linkend="FILE:CAPS">FILE</link> *stream,
                                                         unsigned <link linkend="char">char</link> *string,
                                                         const <link linkend="char">char</link> delim);
unsigned <link linkend="char">char</link>*      <link linkend="raptor-ntriples-string-as-utf8-string">raptor_ntriples_string_as_utf8_string</link>
                                                        (<link linkend="raptor-parser">raptor_parser</link> *rdf_parser,
                                                         unsigned <link linkend="char">char</link> *src,
                                                         <link linkend="int">int</link> len,
                                                         <link linkend="size-t">size_t</link> *dest_lenp);
const <link linkend="char">char</link>*         <link linkend="raptor-ntriples-term-as-string">raptor_ntriples_term_as_string</link>      (<link linkend="raptor-ntriples-term-type">raptor_ntriples_term_type</link> term);
<link linkend="char">char</link>*               <link linkend="raptor-vsnprintf">raptor_vsnprintf</link>                    (const <link linkend="char">char</link> *message);
enum                <link linkend="raptor-log-level">raptor_log_level</link>;
                    <link linkend="raptor-message-handler-closure">raptor_message_handler_closure</link>;
                    <link linkend="raptor-error-handlers">raptor_error_handlers</link>;
<link linkend="void">void</link>                <link linkend="raptor-error-handlers-init">raptor_error_handlers_init</link>          (<link linkend="raptor-error-handlers">raptor_error_handlers</link> *error_handlers);
</synopsis>
</refsynopsisdiv>









<refsect1 id="raptor-section-general.description" role="desc">
<title role="desc.title">Description</title>
<para>
How to initialise and terminate the library, get
access to version numbers, set message and error handlers,
list the parsed and serialized syntaxes provided in the library
and various other utility functions.
</para>
</refsect1>

<refsect1 id="raptor-section-general.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="raptor-version-major" role="variable">
<title>raptor_version_major</title>
<indexterm zone="raptor-version-major"><primary>raptor_version_major</primary></indexterm><programlisting>extern const unsigned int raptor_version_major;
</programlisting>
<para>
Library major version number as a decimal integer.</para>
<para>

</para></refsect2>
<refsect2 id="raptor-version-minor" role="variable">
<title>raptor_version_minor</title>
<indexterm zone="raptor-version-minor"><primary>raptor_version_minor</primary></indexterm><programlisting>extern const unsigned int raptor_version_minor;
</programlisting>
<para>
Library minor version number as a decimal integer.</para>
<para>

</para></refsect2>
<refsect2 id="raptor-version-release" role="variable">
<title>raptor_version_release</title>
<indexterm zone="raptor-version-release"><primary>raptor_version_release</primary></indexterm><programlisting>extern const unsigned int raptor_version_release;
</programlisting>
<para>
Library release version number as a decimal integer.</para>
<para>

</para></refsect2>
<refsect2 id="raptor-version-decimal" role="variable">
<title>raptor_version_decimal</title>
<indexterm zone="raptor-version-decimal"><primary>raptor_version_decimal</primary></indexterm><programlisting>extern const unsigned int raptor_version_decimal;
</programlisting>
<para>
Library full version as a decimal integer.
</para>
<para>
See also <link linkend="raptor-version-string"><type>raptor_version_string</type></link>.</para>
<para>

</para></refsect2>
<refsect2 id="raptor-init" role="function">
<title>raptor_init ()</title>
<indexterm zone="raptor-init"><primary>raptor_init</primary></indexterm><programlisting><link linkend="void">void</link>                raptor_init                         (void);</programlisting>
<para>
Initialise the raptor library.
</para>
<para>
This function MUST be called before using any of the raptor APIs.</para>
<para>

</para></refsect2>
<refsect2 id="raptor-finish" role="function">
<title>raptor_finish ()</title>
<indexterm zone="raptor-finish"><primary>raptor_finish</primary></indexterm><programlisting><link linkend="void">void</link>                raptor_finish                       (void);</programlisting>
<para>
Terminate the raptor library.
</para>
<para>
Cleans up state of the library.  If called, must be used after
all other objects are destroyed with their destructor.</para>
<para>

</para></refsect2>
<refsect2 id="raptor-simple-message-handler" role="function">
<title>raptor_simple_message_handler ()</title>
<indexterm zone="raptor-simple-message-handler"><primary>raptor_simple_message_handler</primary></indexterm><programlisting><link linkend="void">void</link>                (*raptor_simple_message_handler)    (<link linkend="void">void</link> *user_data,
                                                         const <link linkend="char">char</link> *message,
                                                         ...);</programlisting>
<para>
Simple message handler function.
</para>
<para>
Used by multiple functions including <link linkend="raptor-xml-escape-string"><function>raptor_xml_escape_string()</function></link>,
<link linkend="raptor-iostream-write-xml-escaped-string"><function>raptor_iostream_write_xml_escaped_string()</function></link>, <link linkend="raptor-new-qname"><function>raptor_new_qname()</function></link>,
<link linkend="raptor-qname-string-to-uri"><function>raptor_qname_string_to_uri()</function></link>, <link linkend="raptor-new-namespaces"><function>raptor_new_namespaces()</function></link>,
<link linkend="raptor-namespaces-init"><function>raptor_namespaces_init()</function></link>, <link linkend="raptor-iostream-write-xml-element"><function>raptor_iostream_write_xml_element()</function></link>,
<link linkend="raptor-new-xml-writer"><function>raptor_new_xml_writer()</function></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>user_data</parameter>&nbsp;:</term>
<listitem><simpara> user data
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>message</parameter>&nbsp;:</term>
<listitem><simpara> message to report
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>...</parameter>&nbsp;:</term>
<listitem><simpara> arguments for message
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-message-handler" role="function">
<title>raptor_message_handler ()</title>
<indexterm zone="raptor-message-handler"><primary>raptor_message_handler</primary></indexterm><programlisting><link linkend="void">void</link>                (*raptor_message_handler)           (<link linkend="void">void</link> *user_data,
                                                         <link linkend="raptor-locator">raptor_locator</link> *locator,
                                                         const <link linkend="char">char</link> *message);</programlisting>
<para>
Message with location handler function.
</para>
<para>
Used during parsing and serializing for errors and warnings that
may include location information. Multiple handlers may be set for
parsers and serializers by <link linkend="raptor-set-fatal-error-handler"><function>raptor_set_fatal_error_handler()</function></link>,
<link linkend="raptor-set-error-handler"><function>raptor_set_error_handler()</function></link>, <link linkend="raptor-set-warning-handler"><function>raptor_set_warning_handler()</function></link>,
<link linkend="raptor-serializer-set-error-handler"><function>raptor_serializer_set_error_handler()</function></link> and
<link linkend="raptor-serializer-set-warning-handler"><function>raptor_serializer_set_warning_handler()</function></link>.
</para>
<para>
Also used by <link linkend="raptor-www-set-error-handler"><function>raptor_www_set_error_handler()</function></link> for location-based errors
in WWW retrieval.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>user_data</parameter>&nbsp;:</term>
<listitem><simpara> user data
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>locator</parameter>&nbsp;:</term>
<listitem><simpara> location associated with message or NULL
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>message</parameter>&nbsp;:</term>
<listitem><simpara> message to report
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-statement-handler" role="function">
<title>raptor_statement_handler ()</title>
<indexterm zone="raptor-statement-handler"><primary>raptor_statement_handler</primary></indexterm><programlisting><link linkend="void">void</link>                (*raptor_statement_handler)         (<link linkend="void">void</link> *user_data,
                                                         const <link linkend="raptor-statement">raptor_statement</link> *statement);</programlisting>
<para>
Statement (triple) reporting handler function.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>user_data</parameter>&nbsp;:</term>
<listitem><simpara> user data
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> statement to report
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-parsers-enumerate" role="function">
<title>raptor_parsers_enumerate ()</title>
<indexterm zone="raptor-parsers-enumerate"><primary>raptor_parsers_enumerate</primary></indexterm><programlisting><link linkend="int">int</link>                 raptor_parsers_enumerate            (unsigned <link linkend="int">int</link> counter,
                                                         const <link linkend="char">char</link> **name,
                                                         const <link linkend="char">char</link> **label);</programlisting>
<para>
Get list of syntax parsers.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>counter</parameter>&nbsp;:</term>
<listitem><simpara> index to list of parsers
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>name</parameter>&nbsp;:</term>
<listitem><simpara> pointer to store syntax name (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>label</parameter>&nbsp;:</term>
<listitem><simpara> pointer to store syntax label (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non 0 on failure of if counter is out of range
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-syntaxes-enumerate" role="function">
<title>raptor_syntaxes_enumerate ()</title>
<indexterm zone="raptor-syntaxes-enumerate"><primary>raptor_syntaxes_enumerate</primary></indexterm><programlisting><link linkend="int">int</link>                 raptor_syntaxes_enumerate           (unsigned <link linkend="int">int</link> counter,
                                                         const <link linkend="char">char</link> **name,
                                                         const <link linkend="char">char</link> **label,
                                                         const <link linkend="char">char</link> **mime_type,
                                                         unsigned <link linkend="char">char</link> **uri_string);</programlisting>
<para>
Get information on syntaxes.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>counter</parameter>&nbsp;:</term>
<listitem><simpara> index into the list of syntaxes
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>name</parameter>&nbsp;:</term>
<listitem><simpara> pointer to store the name of the syntax (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>label</parameter>&nbsp;:</term>
<listitem><simpara> pointer to store syntax readable label (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>mime_type</parameter>&nbsp;:</term>
<listitem><simpara> pointer to store syntax MIME Type (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>uri_string</parameter>&nbsp;:</term>
<listitem><simpara> pointer to store syntax URI string (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non 0 on failure of if counter is out of range
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-syntax-name-check" role="function">
<title>raptor_syntax_name_check ()</title>
<indexterm zone="raptor-syntax-name-check"><primary>raptor_syntax_name_check</primary></indexterm><programlisting><link linkend="int">int</link>                 raptor_syntax_name_check            (const <link linkend="char">char</link> *name);</programlisting>
<para>
Check name of a parser.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>name</parameter>&nbsp;:</term>
<listitem><simpara> the syntax name
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non 0 if name is a known syntax name
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-guess-parser-name" role="function">
<title>raptor_guess_parser_name ()</title>
<indexterm zone="raptor-guess-parser-name"><primary>raptor_guess_parser_name</primary></indexterm><programlisting>const <link linkend="char">char</link>*         raptor_guess_parser_name            (<link linkend="raptor-uri">raptor_uri</link> *uri,
                                                         const <link linkend="char">char</link> *mime_type,
                                                         unsigned <link linkend="char">char</link> *buffer,
                                                         <link linkend="size-t">size_t</link> len,
                                                         unsigned <link linkend="char">char</link> *identifier);</programlisting>
<para>
Guess a parser name for content.
</para>
<para>
Find a parser by scoring recognition of the syntax by a block of
characters, the content identifier or a mime type.  The content
identifier is typically a filename or URI or some other identifier.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>uri</parameter>&nbsp;:</term>
<listitem><simpara> URI identifying the syntax (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>mime_type</parameter>&nbsp;:</term>
<listitem><simpara> mime type identifying the content (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>buffer</parameter>&nbsp;:</term>
<listitem><simpara> buffer of content to guess (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&nbsp;:</term>
<listitem><simpara> length of buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>identifier</parameter>&nbsp;:</term>
<listitem><simpara> identifier of content (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a parser name or NULL if no guess could be made
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-serializers-enumerate" role="function">
<title>raptor_serializers_enumerate ()</title>
<indexterm zone="raptor-serializers-enumerate"><primary>raptor_serializers_enumerate</primary></indexterm><programlisting><link linkend="int">int</link>                 raptor_serializers_enumerate        (unsigned <link linkend="int">int</link> counter,
                                                         const <link linkend="char">char</link> **name,
                                                         const <link linkend="char">char</link> **label,
                                                         const <link linkend="char">char</link> **mime_type,
                                                         unsigned <link linkend="char">char</link> **uri_string);</programlisting>
<para>
Get information on syntax serializers.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>counter</parameter>&nbsp;:</term>
<listitem><simpara> index into the list of syntaxes
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>name</parameter>&nbsp;:</term>
<listitem><simpara> pointer to store the name of the syntax (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>label</parameter>&nbsp;:</term>
<listitem><simpara> pointer to store syntax readable label (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>mime_type</parameter>&nbsp;:</term>
<listitem><simpara> pointer to store syntax MIME Type (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>uri_string</parameter>&nbsp;:</term>
<listitem><simpara> pointer to store syntax URI string (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non 0 on failure of if counter is out of range
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-serializer-syntax-name-check" role="function">
<title>raptor_serializer_syntax_name_check ()</title>
<indexterm zone="raptor-serializer-syntax-name-check"><primary>raptor_serializer_syntax_name_check</primary></indexterm><programlisting><link linkend="int">int</link>                 raptor_serializer_syntax_name_check (const <link linkend="char">char</link> *name);</programlisting>
<para>
Check name of a serializer.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>name</parameter>&nbsp;:</term>
<listitem><simpara> the syntax name
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non 0 if name is a known syntax name
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-print-ntriples-string" role="function">
<title>raptor_print_ntriples_string ()</title>
<indexterm zone="raptor-print-ntriples-string"><primary>raptor_print_ntriples_string</primary></indexterm><programlisting><link linkend="int">int</link>                 raptor_print_ntriples_string        (<link linkend="FILE:CAPS">FILE</link> *stream,
                                                         unsigned <link linkend="char">char</link> *string,
                                                         const <link linkend="char">char</link> delim);</programlisting>
<para>
Print an UTF-8 string using N-Triples escapes.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> FILE* stream to print to
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>string</parameter>&nbsp;:</term>
<listitem><simpara> UTF-8 string to print
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>delim</parameter>&nbsp;:</term>
<listitem><simpara> Delimiter character for string (such as ") or \0 for no delim
escaping.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non-0 on failure such as bad UTF-8 encoding.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-ntriples-string-as-utf8-string" role="function">
<title>raptor_ntriples_string_as_utf8_string ()</title>
<indexterm zone="raptor-ntriples-string-as-utf8-string"><primary>raptor_ntriples_string_as_utf8_string</primary></indexterm><programlisting>unsigned <link linkend="char">char</link>*      raptor_ntriples_string_as_utf8_string
                                                        (<link linkend="raptor-parser">raptor_parser</link> *rdf_parser,
                                                         unsigned <link linkend="char">char</link> *src,
                                                         <link linkend="int">int</link> len,
                                                         <link linkend="size-t">size_t</link> *dest_lenp);</programlisting>
<para>
Turn an N-Triples string with escapes into a UTF-8 string.
</para>
<para>
<parameter>Deprecated</parameter>: This requires use of parser internals and was never in the public API header.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>rdf_parser</parameter>&nbsp;:</term>
<listitem><simpara> parser object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>src</parameter>&nbsp;:</term>
<listitem><simpara> data to read from
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&nbsp;:</term>
<listitem><simpara> size of data
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dest_lenp</parameter>&nbsp;:</term>
<listitem><simpara> pointer to length of destination (out) or NULL
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a new UTF-8 string
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-ntriples-term-as-string" role="function">
<title>raptor_ntriples_term_as_string ()</title>
<indexterm zone="raptor-ntriples-term-as-string"><primary>raptor_ntriples_term_as_string</primary></indexterm><programlisting>const <link linkend="char">char</link>*         raptor_ntriples_term_as_string      (<link linkend="raptor-ntriples-term-type">raptor_ntriples_term_type</link> term);</programlisting>
<para>
<parameter>Deprecated</parameter>: an internal debug function, do not use.
</para>
<para>
Get a label for a <link linkend="raptor-ntriples-term-type"><type>raptor_ntriples_term_type</type></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>term</parameter>&nbsp;:</term>
<listitem><simpara> N-Triples term.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a pointer to a constant string.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-vsnprintf" role="function">
<title>raptor_vsnprintf ()</title>
<indexterm zone="raptor-vsnprintf"><primary>raptor_vsnprintf</primary></indexterm><programlisting><link linkend="char">char</link>*               raptor_vsnprintf                    (const <link linkend="char">char</link> *message);</programlisting>
<para>
Format output for a variable arguments list.
</para>
<para>
This is a wrapper around system versions of vsnprintf with
different call and return conventions.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>message</parameter>&nbsp;:</term>
<listitem><simpara> printf-style format string
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a newly allocated string as the format result or NULL on failure
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-log-level" role="enum">
<title>enum raptor_log_level</title>
<indexterm zone="raptor-log-level"><primary>raptor_log_level</primary></indexterm><programlisting>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;
</programlisting>
<para>
Log levels</para>
<para>

</para><variablelist role="enum">
<varlistentry id="RAPTOR-LOG-LEVEL-NONE:CAPS" role="constant">
<term><literal>RAPTOR_LOG_LEVEL_NONE</literal></term>
<listitem><simpara> Internal
</simpara></listitem>
</varlistentry>
<varlistentry id="RAPTOR-LOG-LEVEL-FATAL:CAPS" role="constant">
<term><literal>RAPTOR_LOG_LEVEL_FATAL</literal></term>
<listitem><simpara> Fatal error message
</simpara></listitem>
</varlistentry>
<varlistentry id="RAPTOR-LOG-LEVEL-ERROR:CAPS" role="constant">
<term><literal>RAPTOR_LOG_LEVEL_ERROR</literal></term>
<listitem><simpara> Error message
</simpara></listitem>
</varlistentry>
<varlistentry id="RAPTOR-LOG-LEVEL-WARNING:CAPS" role="constant">
<term><literal>RAPTOR_LOG_LEVEL_WARNING</literal></term>
<listitem><simpara> Warning message
</simpara></listitem>
</varlistentry>
<varlistentry id="RAPTOR-LOG-LEVEL-LAST:CAPS" role="constant">
<term><literal>RAPTOR_LOG_LEVEL_LAST</literal></term>
<listitem><simpara> Internal
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-message-handler-closure" role="struct">
<title>raptor_message_handler_closure</title>
<indexterm zone="raptor-message-handler-closure"><primary>raptor_message_handler_closure</primary></indexterm><programlisting>typedef struct {
  void *user_data;
  raptor_message_handler handler;
} raptor_message_handler_closure;
</programlisting>
<para>
The combination of a message handler and the user data to send to it.</para>
<para>

</para><variablelist role="struct">
<varlistentry>
<term><link linkend="void">void</link>&nbsp;*<structfield>user_data</structfield>;</term>
<listitem><simpara> user data for handler invocation
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="raptor-message-handler">raptor_message_handler</link>&nbsp;<structfield>handler</structfield>;</term>
<listitem><simpara> handler function
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-error-handlers" role="struct">
<title>raptor_error_handlers</title>
<indexterm zone="raptor-error-handlers"><primary>raptor_error_handlers</primary></indexterm><programlisting>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;
</programlisting>
<para>
Error handlers structure</para>
<para>

</para><variablelist role="struct">
<varlistentry>
<term>unsigned&nbsp;<link linkend="int">int</link>&nbsp;<structfield>magic</structfield>;</term>
<listitem><simpara> magic value - must use <link linkend="raptor-error-handlers-init"><function>raptor_error_handlers_init()</function></link> to set this
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="raptor-locator">raptor_locator</link>&nbsp;*<structfield>locator</structfield>;</term>
<listitem><simpara> raptor locator of the error
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="raptor-log-level">raptor_log_level</link>&nbsp;<structfield>last_log_level</structfield>;</term>
<listitem><simpara> number of log levels; size of <parameter>handlers</parameter> arrays
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="raptor-message-handler-closure">raptor_message_handler_closure</link>&nbsp;<structfield>handlers</structfield>[RAPTOR_LOG_LEVEL_LAST+1];</term>
<listitem><simpara> user handlers per log level
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-error-handlers-init" role="function">
<title>raptor_error_handlers_init ()</title>
<indexterm zone="raptor-error-handlers-init"><primary>raptor_error_handlers_init</primary></indexterm><programlisting><link linkend="void">void</link>                raptor_error_handlers_init          (<link linkend="raptor-error-handlers">raptor_error_handlers</link> *error_handlers);</programlisting>
<para>
Initialize <link linkend="raptor-error-handlers"><type>raptor_error_handlers</type></link> object statically.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>error_handlers</parameter>&nbsp;:</term>
<listitem><simpara> error handlers object
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
