You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2012/06/07 03:03:30 UTC
svn commit: r1347243 - in /subversion/trunk/subversion/libsvn_ra_serf: log.c
ra_serf.h xml.c
Author: gstein
Date: Thu Jun 7 01:03:30 2012
New Revision: 1347243
URL: http://svn.apache.org/viewvc?rev=1347243&view=rev
Log:
The new XML parsing requires a couple more features: wildcard
transitions, and streaming cdata callbacks. Implement the former, and
do a little bit of prep for the latter.
* subversion/libsvn_ra_serf/ra_serf.h:
(svn_ra_serf__xml_opened_t): add the TAG parameter so that the
callback can determine (and capture) what tag caused the
transition. update the docstring.
(svn_ra_serf__xml_cdata_t): sketch out the proper handler
(svn_ra_serf__xml_context_create): leave tbd for docco and param
* subversion/libsvn_ra_serf/xml.c:
(svn_ra_serf__xml_context_t): add CDATA_CB member
(svn_ra_serf__xml_context_create): leave a bit of todo stuff
(svn_ra_serf__xml_cb_start): ignore CuSTOM_OPEN and call OPENED_CB
for all transitions. pass the tag.
* subversion/libsvn_ra_serf/log.c:
(log_opened): update signature to include TAG. since we're now
called for all transitions, look for the transition to ITEM as the
indicator to initialize the collection hash tables.
Modified:
subversion/trunk/subversion/libsvn_ra_serf/log.c
subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
subversion/trunk/subversion/libsvn_ra_serf/xml.c
Modified: subversion/trunk/subversion/libsvn_ra_serf/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/log.c?rev=1347243&r1=1347242&r2=1347243&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/log.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/log.c Thu Jun 7 01:03:30 2012
@@ -237,15 +237,18 @@ static svn_error_t *
log_opened(svn_ra_serf__xml_estate_t *xes,
void *baton,
int entered_state,
+ const svn_ra_serf__dav_props_t *tag,
apr_pool_t *scratch_pool)
{
log_context_t *log_ctx = baton;
- apr_pool_t *state_pool = svn_ra_serf__xml_state_pool(xes);
- SVN_ERR_ASSERT(entered_state == ITEM);
+ if (entered_state == ITEM)
+ {
+ apr_pool_t *state_pool = svn_ra_serf__xml_state_pool(xes);
- log_ctx->collect_revprops = apr_hash_make(state_pool);
- log_ctx->collect_paths = apr_hash_make(state_pool);
+ log_ctx->collect_revprops = apr_hash_make(state_pool);
+ log_ctx->collect_paths = apr_hash_make(state_pool);
+ }
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h?rev=1347243&r1=1347242&r2=1347243&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Thu Jun 7 01:03:30 2012
@@ -618,11 +618,21 @@ typedef struct svn_ra_serf__xml_context_
/* An opaque structure for the XML parse element/state. */
typedef struct svn_ra_serf__xml_estate_t svn_ra_serf__xml_estate_t;
-/* Called just after the parser moves into ENTERED_STATE. */
+/* Called just after the parser moves into ENTERED_STATE. The tag causing
+ the transition is passed in TAG.
+
+ This callback is applied to a parsing context by using the
+ svn_ra_serf__xml_context_customize() function.
+
+ NOTE: this callback, when set, will be invoked on *every* transition.
+ The callback must examine ENTERED_STATE to determine if any action
+ must be taken. The original state is not provided, but must be derived
+ from ENTERED_STATE and/or the TAG causing the transition (if needed). */
typedef svn_error_t *
(*svn_ra_serf__xml_opened_t)(svn_ra_serf__xml_estate_t *xes,
void *baton,
int entered_state,
+ const svn_ra_serf__dav_props_t *tag,
apr_pool_t *scratch_pool);
@@ -646,6 +656,16 @@ typedef svn_error_t *
apr_pool_t *scratch_pool);
+/* ### TBD */
+typedef svn_error_t *
+(*svn_ra_serf__xml_cdata_t)(svn_ra_serf__xml_estate_t *xes,
+ void *baton,
+ int current_state,
+ const char *data,
+ apr_size_t *len,
+ apr_pool_t *scratch_pool);
+
+
/* State transition table.
When the XML Context is constructed, it is in state 0. User states are
@@ -687,11 +707,15 @@ typedef struct svn_ra_serf__xml_transiti
} svn_ra_serf__xml_transition_t;
+/* ### docco */
svn_ra_serf__xml_context_t *
svn_ra_serf__xml_context_create(
const svn_ra_serf__xml_transition_t *ttable,
svn_ra_serf__xml_opened_t opened_cb,
svn_ra_serf__xml_closed_t closed_cb,
+#ifdef NOT_YET
+ svn_ra_serf__xml_cdata_t cdata_cb,
+#endif
void *baton,
apr_pool_t *result_pool);
Modified: subversion/trunk/subversion/libsvn_ra_serf/xml.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/xml.c?rev=1347243&r1=1347242&r2=1347243&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/xml.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/xml.c Thu Jun 7 01:03:30 2012
@@ -55,6 +55,7 @@ struct svn_ra_serf__xml_context_t {
/* The callback information. */
svn_ra_serf__xml_opened_t opened_cb;
svn_ra_serf__xml_closed_t closed_cb;
+ svn_ra_serf__xml_cdata_t cdata_cb;
void *baton;
/* Linked list of free states. */
@@ -448,6 +449,9 @@ svn_ra_serf__xml_context_create(
const svn_ra_serf__xml_transition_t *ttable,
svn_ra_serf__xml_opened_t opened_cb,
svn_ra_serf__xml_closed_t closed_cb,
+#ifdef NOT_YET
+ svn_ra_serf__xml_cdata_t cdata_cb,
+#endif
void *baton,
apr_pool_t *result_pool)
{
@@ -458,6 +462,9 @@ svn_ra_serf__xml_context_create(
xmlctx->ttable = ttable;
xmlctx->opened_cb = opened_cb;
xmlctx->closed_cb = closed_cb;
+#if 0
+ xmlctx->cdata_cb = cdata_cb;
+#endif
xmlctx->baton = baton;
xmlctx->scratch_pool = svn_pool_create(result_pool);
@@ -648,11 +655,12 @@ svn_ra_serf__xml_cb_start(svn_ra_serf__x
new_xes->prev = current;
xmlctx->current = new_xes;
- if (scan->custom_open)
+ if (xmlctx->opened_cb)
{
START_CALLBACK(xmlctx);
SVN_ERR(xmlctx->opened_cb(new_xes, xmlctx->baton,
- new_xes->state, xmlctx->scratch_pool));
+ new_xes->state, &new_xes->tag,
+ xmlctx->scratch_pool));
END_CALLBACK(xmlctx);
svn_pool_clear(xmlctx->scratch_pool);
}