Pièce jointe « lasso-export.diff »
Téléchargement 1 --- lasso-2.3.6.orig/lasso/id-ff/provider.h
2 +++ lasso-2.3.6/lasso/id-ff/provider.h
3 @@ -215,6 +215,9 @@
4 const char *service_id);
5 LASSO_EXPORT gchar* lasso_provider_get_metadata_one(LassoProvider *provider, const char *name);
6 LASSO_EXPORT GList* lasso_provider_get_metadata_list(LassoProvider *provider, const char *name);
7 +LASSO_EXPORT int lasso_provider_verify_saml_signature(LassoProvider *provider,
8 + xmlNode *signed_node,
9 + xmlDoc *doc);
10
11 LASSO_EXPORT LassoProvider* lasso_provider_new_from_dump(const gchar *dump);
12
13 --- lasso-2.3.6.orig/bindings/utils.c
14 +++ lasso-2.3.6/bindings/utils.c
15 @@ -51,3 +51,26 @@
16 lasso_release_xml_node_list(list);
17 return node;
18 }
19 +
20 +/**
21 + * lasso_string_fragment_to_xmldoc:
22 + * @fragment: a fragment of an XML document
23 + * @size:
24 + *
25 + * Try to get one and only one node from a string, the node can be a simple string or a single node.
26 + *
27 + * Return value: a newly allocated xmlNode* or NULL if parsing fails.
28 + */
29 +static xmlDoc*
30 +lasso_string_fragment_to_xmldoc(const char *fragment, int size) {
31 + xmlDoc *doc = NULL;
32 +
33 + if (size == 0) {
34 + size = strlen(fragment);
35 + }
36 +
37 + /* single node case, with preceding or following spaces */
38 + doc = xmlReadMemory(fragment, size, NULL, NULL, XML_PARSE_NONET);
39 +
40 + return doc;
41 +}
42 --- lasso-2.3.6.orig/bindings/utils.py
43 +++ lasso-2.3.6/bindings/utils.py
44 @@ -233,6 +233,10 @@
45 arg = unconstify(arg_type(arg))
46 return arg and arg.startswith('xmlNode')
47
48 +def is_xml_doc(arg):
49 + arg = unconstify(arg_type(arg))
50 + return arg and arg.startswith('xmlDoc')
51 +
52 def is_boolean(arg):
53 return arg_type(arg) in ('gboolean','bool')
54
55 --- lasso-2.3.6.orig/bindings/perl/typemap-out
56 +++ lasso-2.3.6/bindings/perl/typemap-out
57 @@ -9,6 +9,9 @@
58 T_XMLNODE
59 $arg = xmlnode_to_pv($var, FALSE);
60
61 +T_XMLDOC
62 + $arg = xmldoc_to_pv($var, FALSE);
63 +
64 T_GLIST_STRING
65 {
66 I32 ix, length;
67 --- lasso-2.3.6.orig/bindings/perl/glist_handling.c
68 +++ lasso-2.3.6/bindings/perl/glist_handling.c
69 @@ -81,6 +81,48 @@
70 }
71
72 /**
73 + * xmldoc_to_pv:
74 + * @doc: an xmlDoc* object
75 + * @do_free: do we need to free the doc after the conversion
76 + *
77 + * Return value: a newly allocated SV/PV or under.
78 + */
79 +static SV*
80 +xmldoc_to_pv(xmlDoc *doc, gboolean do_free)
81 +{
82 + xmlChar *xmlString;
83 + int size;
84 + SV *pestring = NULL;
85 +
86 + if (doc == NULL) {
87 + return &PL_sv_undef;
88 + }
89 +
90 + xmlDocDumpMemory(doc, &xmlString, &size);
91 + pestring = newSVpv((char*)xmlString, size);
92 + if (do_free) {
93 + lasso_release_xml_doc(doc);
94 + }
95 + xmlFree(xmlString);
96 +
97 + return pestring;
98 +}
99 +
100 +static xmlDoc *
101 +pv_to_xmldoc(SV *value) {
102 + unsigned int size;
103 + char *string;
104 +
105 + if (! SvPOK(value))
106 + return NULL;
107 + string = SvPV(value, size);
108 + if (! string)
109 + return NULL;
110 +
111 + return lasso_string_fragment_to_xmldoc(string, size);
112 +}
113 +
114 +/**
115 * array_to_glist_string:
116 * @array: a Perl array
117 *
118 --- lasso-2.3.6.orig/bindings/perl/typemap-in
119 +++ lasso-2.3.6/bindings/perl/typemap-in
120 @@ -11,6 +11,9 @@
121 T_XMLNODE
122 $var = pv_to_xmlnode($arg);
123
124 +T_XMLDOC
125 + $var = pv_to_xmldoc($arg);
126 +
127 T_GLIST_STRING
128 $var = array_to_glist_string((AV*)SvRV($arg));
129
130 --- lasso-2.3.6.orig/bindings/perl/lang.py
131 +++ lasso-2.3.6/bindings/perl/lang.py
132 @@ -101,6 +101,8 @@
133 const LassoProvider *\tT_GOBJECT_WRAPPER
134 xmlNode*\tT_XMLNODE
135 const xmlNode*\tT_XMLNODE
136 +xmlDoc*\tT_XMLDOC
137 +const xmlDoc*\tT_XMLDOC
138 GList_string\tT_GLIST_STRING
139 GList_xmlnode\tT_GLIST_XMLNODE
140 GList_gobject\tT_GLIST_GOBJECT
141 @@ -310,7 +312,7 @@
142 if arg_default(arg):
143 arg_names.append(aname + ' = ' + self.default_value(arg))
144 else:
145 - if is_cstring(arg) or is_glist(arg) or is_xml_node(arg) or is_object(arg):
146 + if is_cstring(arg) or is_glist(arg) or is_xml_node(arg) or is_xml_doc(arg) or is_object(arg):
147 arg_names.append(aname + ' = NULL')
148 else:
149 raise Exception('Do not know what to do for optional: %s' % arg)
150 @@ -321,7 +323,9 @@
151 if is_glist(arg) and not is_transfer_full(arg):
152 cleanup.append(self.release_list(arg_name(arg), arg))
153 if is_xml_node(arg) and not is_transfer_full(arg):
154 - cleanup.append('lasso_release_xml_node(%s)' % arg_name(arg))
155 + cleanup.append('lasso_release_xml_node(%s);' % arg_name(arg))
156 + if is_xml_doc(arg) and not is_transfer_full(arg):
157 + cleanup.append('lasso_release_xml_doc(%s);' % arg_name(arg))
158 if is_hashtable(arg):
159 raise Exception("No cleanup code generation for GHashTable")
160 self.xs.p(','.join(arg_names))
161 @@ -478,7 +482,7 @@
162 return str + '*'
163
164 def glist_type(self, member):
165 - x = self.element_type_lookup(member, { 'string': 'GList_string', 'xml_node': 'GList_xmlnode', 'gobject': 'GList_gobject'})
166 + x = self.element_type_lookup(member, { 'string': 'GList_string', 'xml_node': 'GList_xmlnode', 'xml_doc': 'GList_xmldoc', 'gobject': 'GList_gobject'})
167 if is_const(member):
168 return x + '_const'
169 return x
170 @@ -491,6 +495,8 @@
171 return lookup_table['string']
172 elif is_xml_node(type):
173 return lookup_table['xml_node']
174 + elif is_xml_doc(type):
175 + return lookup_table['xml_doc']
176 elif is_object(type):
177 return lookup_table['gobject']
178 else:
179 @@ -506,6 +512,8 @@
180 macro = 'lasso_release_list_of_strings'
181 elif is_xml_node(type):
182 macro = 'lasso_release_list_of_xml_node'
183 + elif is_xml_doc(type):
184 + macro = 'lasso_release_list_of_xml_doc'
185 elif is_object(type):
186 macro = 'lasso_release_list_of_gobjects'
187 else:
188 @@ -520,6 +528,8 @@
189 macro = 'SvPV_nolen'
190 elif is_xml_node(type):
191 macro = 'pv_to_xmlnode'
192 + elif is_xml_doc(type):
193 + macro = 'pv_to_xmldoc'
194 elif is_object(type):
195 macro = 'gperl_get_object'
196 else:
197 @@ -534,6 +544,8 @@
198 macro = 'lasso_list_add_string'
199 elif is_xml_node(type):
200 macro = 'lasso_list_add_new_xml_node'
201 + elif is_xml_doc(type):
202 + macro = 'lasso_list_add_new_xml_doc'
203 elif is_object(type):
204 macro = 'lasso_list_add_gobject'
205 else:
206 @@ -550,12 +562,14 @@
207 macro = 'lasso_assign_string'
208 elif is_xml_node(arg):
209 macro = 'lasso_assign_xml_node'
210 + elif is_xml_doc(arg):
211 + macro = 'lasso_assign_xml_doc'
212 elif is_glist(arg):
213 if not el_type:
214 raise Exception('%s has no element type %s' % (arg, struct))
215 if is_cstring(el_type):
216 macro = 'lasso_assign_list_of_strings'
217 - elif is_xml_node(el_type):
218 + elif is_xml_node(el_type) or is_xml_doc(el_type):
219 macro = 'lasso_assign_simple' # FIXME
220 elif is_object(el_type):
221 macro = 'lasso_assign_list_of_gobjects'
222 --- lasso-2.3.6.orig/bindings/python/wrapper_top.c
223 +++ lasso-2.3.6/bindings/python/wrapper_top.c
224 @@ -18,6 +18,8 @@
225 PyMODINIT_FUNC init_lasso(void);
226 G_GNUC_UNUSED static PyObject* get_pystring_from_xml_node(xmlNode *xmlnode);
227 G_GNUC_UNUSED static xmlNode* get_xml_node_from_pystring(PyObject *string);
228 +G_GNUC_UNUSED static PyObject* get_pystring_from_xml_doc(xmlDoc *xmldoc);
229 +G_GNUC_UNUSED static xmlDoc* get_xml_doc_from_pystring(PyObject *string);
230 G_GNUC_UNUSED static PyObject* get_dict_from_hashtable_of_objects(GHashTable *value);
231 G_GNUC_UNUSED static PyObject* get_dict_from_hashtable_of_strings(GHashTable *value);
232 G_GNUC_UNUSED static PyObject* PyGObjectPtr_New(GObject *obj);
233 @@ -130,6 +132,24 @@
234 return pystring;
235 }
236
237 +static PyObject*
238 +get_pystring_from_xml_doc(xmlDoc *xmldoc)
239 +{
240 + PyObject *pystring = NULL;
241 + xmlChar *xmlString;
242 + int size;
243 +
244 + if (xmldoc == NULL) {
245 + return NULL;
246 + }
247 +
248 + xmlDocDumpMemory(xmldoc, &xmlString, &size);
249 + pystring = PyString_FromStringAndSize((char*)xmlString, size);
250 + xmlFree(xmlString);
251 +
252 + return pystring;
253 +}
254 +
255 static gboolean
256 valid_seq(PyObject *seq) {
257 if (! seq || ( seq != Py_None && ! PyTuple_Check(seq))) {
258 @@ -328,6 +348,12 @@
259 PyString_Size(string));
260 }
261
262 +static xmlDoc*
263 +get_xml_doc_from_pystring(PyObject *string) {
264 + return lasso_string_fragment_to_xmldoc(PyString_AsString(string),
265 + PyString_Size(string));
266 +}
267 +
268 /** Return a tuple containing the string contained in a_list */
269 static PyObject *
270 get_list_of_strings(const GList *a_list) {
271 --- lasso-2.3.6.orig/bindings/python/lang.py
272 +++ lasso-2.3.6/bindings/python/lang.py
273 @@ -78,6 +78,8 @@
274 pass
275 elif is_xml_node(type):
276 print >>fd, ' lasso_release_xml_node(%s);' % name
277 + elif is_xml_doc(type):
278 + print >>fd, ' lasso_release_xml_doc(%s);' % name
279 elif is_glist(type):
280 etype = element_type(type)
281 if is_cstring(etype):
282 @@ -375,7 +377,7 @@
283 print >> fd, ' def get_%s(self):' % mname
284 print >> fd, ' t = _lasso.%s_%s_get(self._cptr)' % (
285 klassname, mname)
286 - if is_int(m, self.binding_data) or is_xml_node(m) or is_cstring(m) or is_boolean(m):
287 + if is_int(m, self.binding_data) or is_xml_node(m) or is_xml_doc(m) or is_cstring(m) or is_boolean(m):
288 pass
289 elif is_object(m):
290 print >> fd, ' t = cptrToPy(t)'
291 @@ -383,7 +385,7 @@
292 el_type = element_type(m)
293 if is_cstring(el_type):
294 pass
295 - elif is_xml_node(el_type):
296 + elif is_xml_node(el_type) or is_xml_doc(el_type):
297 pass
298 elif is_object(el_type):
299 print >> fd, ' if not t: return t'
300 @@ -400,21 +402,21 @@
301 print >> fd, ' t = frozendict(d2)'
302 else:
303 print >> fd, ' t = frozendict(t)'
304 - elif is_boolean(m) or is_int(m, self.binding_data) or is_xml_node(m) or is_cstring(m):
305 + elif is_boolean(m) or is_int(m, self.binding_data) or is_xml_node(m) or is_xml_doc(m) or is_cstring(m):
306 pass
307 else:
308 raise Exception('Unsupported python getter %s.%s' % (clss, m))
309 print >> fd, ' return t;'
310 # setter
311 print >> fd, ' def set_%s(self, value):' % mname
312 - if is_int(m, self.binding_data) or is_xml_node(m) or is_cstring(m) or is_boolean(m):
313 + if is_int(m, self.binding_data) or is_xml_node(m) or is_xml_doc(m) or is_cstring(m) or is_boolean(m):
314 pass
315 elif is_object(m):
316 print >> fd, ' if value is not None:'
317 print >> fd, ' value = value and value._cptr'
318 elif is_glist(m):
319 el_type = element_type(m)
320 - if is_cstring(el_type) or is_xml_node(el_type):
321 + if is_cstring(el_type) or is_xml_node(el_type) or is_xml_doc(el_type):
322 pass
323 elif is_object(el_type):
324 print >> fd, ' if value is not None:'
325 @@ -463,7 +465,7 @@
326
327 if is_out(arg):
328 c_args.append(outvar)
329 - elif is_xml_node(arg) or is_boolean(arg) or is_cstring(arg) or is_int(arg, self.binding_data) or is_glist(arg) or is_hashtable(arg) or is_time_t_pointer(arg):
330 + elif is_xml_node(arg) or is_xml_doc(arg) or is_boolean(arg) or is_cstring(arg) or is_int(arg, self.binding_data) or is_glist(arg) or is_hashtable(arg) or is_time_t_pointer(arg):
331 c_args.append(arg_name(arg))
332 elif is_object(arg):
333 c_args.append('%(name)s and %(name)s._cptr' % { 'name': arg_name(arg) })
334 @@ -506,7 +508,7 @@
335 print >> fd, ' rc = _lasso.%s(self._cptr%s)' % (
336 function_name, c_args)
337 print >> fd, ' Error.raise_on_rc(rc)'
338 - elif is_int(m.return_arg, self.binding_data) or is_xml_node(m.return_arg) or is_cstring(m.return_arg) or is_boolean(m.return_arg):
339 + elif is_int(m.return_arg, self.binding_data) or is_xml_node(m.return_arg) or is_xml_doc(m.return_arg) or is_cstring(m.return_arg) or is_boolean(m.return_arg):
340 print >> fd, ' return _lasso.%s(self._cptr%s)' % (
341 function_name, c_args)
342 elif is_glist(m.return_arg):
343 @@ -758,7 +760,7 @@
344 parse_format = 'i'
345 parse_arg = '&value'
346 print >> fd, ' %s value;' % type
347 - elif is_glist(m) or is_hashtable(m) or is_xml_node(m) or is_boolean(m):
348 + elif is_glist(m) or is_hashtable(m) or is_xml_node(m) or is_xml_doc(m) or is_boolean(m):
349 parse_format = 'O'
350 print >> fd, ' PyObject *cvt_value;'
351 parse_arg = '&cvt_value'
352 @@ -782,12 +784,17 @@
353 elif is_xml_node(m):
354 print >> fd, ' if (this->%s) xmlFreeNode(this->%s);' % (name, name)
355 print >> fd, ' this->%s = get_xml_node_from_pystring(cvt_value);' % name
356 + elif is_xml_doc(m):
357 + print >> fd, ' if (this->%s) xmlFreeDoc(this->%s);' % (name, name)
358 + print >> fd, ' this->%s = get_xml_doc_from_pystring(cvt_value);' % name
359 elif is_glist(m):
360 el_type = element_type(m)
361 if is_cstring(el_type):
362 print >> fd, ' set_list_of_strings(&this->%s, cvt_value);' % name
363 elif is_xml_node(el_type):
364 print >> fd, ' set_list_of_xml_nodes(&this->%s, cvt_value);' % name
365 + elif is_xml_doc(el_type):
366 + print >> fd, ' set_list_of_xml_docs(&this->%s, cvt_value);' % name
367 elif is_object(el_type):
368 print >> fd, ' set_list_of_pygobject(&this->%s, cvt_value);' % name
369 else:
370 @@ -838,6 +845,8 @@
371 print >> fd, ' %s = get_list_of_strings(%s);' % (return_pyvar_name, return_var_name)
372 elif is_xml_node(el_type):
373 print >> fd, ' %s = get_list_of_xml_nodes(%s);' % (return_pyvar_name, return_var_name)
374 + elif is_xml_doc(el_type):
375 + print >> fd, ' %s = get_list_of_xml_docs(%s);' % (return_pyvar_name, return_var_name)
376 else:
377 raise Exception('failed to make an assignment for %s' % (arg,))
378 elif is_hashtable(arg):
379 @@ -853,6 +862,13 @@
380 print >> fd, ' } else {'
381 print >> fd, ' %s = noneRef();' % return_pyvar_name
382 print >> fd, ' }'
383 + elif is_xml_doc(arg):
384 + # convert xmlDoc* to strings
385 + print >> fd, ' if (%s) {' % return_var_name
386 + print >> fd, ' %s = get_pystring_from_xml_doc(%s);' % (return_pyvar_name, return_var_name)
387 + print >> fd, ' } else {'
388 + print >> fd, ' %s = noneRef();' % return_pyvar_name
389 + print >> fd, ' }'
390 elif is_object(arg):
391 # return a PyGObjectPtr (wrapper around GObject)
392 print >> fd, '''\
393 @@ -907,7 +923,7 @@
394 arg_def = ' %s %s = %s;' % (arg[0], arg[1], defval)
395 else:
396 arg_def = ' %s %s;' % (arg[0], arg[1])
397 - elif is_xml_node(arg) or is_list(arg) or is_time_t_pointer(arg):
398 + elif is_xml_node(arg) or is_xml_doc(arg) or is_list(arg) or is_time_t_pointer(arg):
399 parse_tuple_format.append('O')
400 parse_tuple_args.append('&cvt_%s' % aname)
401 arg_def = ' %s %s = NULL;' % (arg[0], arg[1])
402 @@ -950,12 +966,16 @@
403 print >> fd, ' set_list_of_strings(&%s, cvt_%s);' % (arg[1], arg[1])
404 elif qualifier == 'xmlNode*':
405 print >> fd, ' set_list_of_xml_nodes(&%s, cvt_%s);' % (arg[1], arg[1])
406 + elif qualifier == 'xmlDoc*':
407 + print >> fd, ' set_list_of_xml_docs(&%s, cvt_%s);' % (arg[1], arg[1])
408 elif isinstance(qualifier, basestring) and qualifier.startswith('Lasso'):
409 print >> fd, ' set_list_of_pygobject(&%s, cvt_%s);' % (arg[1], arg[1])
410 else:
411 print >> sys.stderr, 'E: unqualified GList argument in', name, qualifier, arg
412 elif is_xml_node(arg):
413 print >> fd, ' %s = get_xml_node_from_pystring(cvt_%s);' % (arg[1], arg[1])
414 + elif is_xml_doc(arg):
415 + print >> fd, ' %s = get_xml_doc_from_pystring(cvt_%s);' % (arg[1], arg[1])
416 elif is_time_t_pointer(arg):
417 print >> fd, ' %s = get_time_t(cvt_%s);' % (arg[1], arg[1])
418 elif f == 'O':
419 --- lasso-2.3.6.orig/bindings/java/lang.py
420 +++ lasso-2.3.6/bindings/java/lang.py
421 @@ -69,7 +69,7 @@
422 def jni_glist_elem_type(type):
423 if is_cstring(type):
424 return 'jstring'
425 - elif is_xml_node(type):
426 + elif is_xml_node(type) or is_xml_doc(type):
427 return 'jstring'
428 elif is_object(type):
429 return 'jobject'
430 @@ -85,7 +85,7 @@
431 def JNI_elem_type(type):
432 if is_cstring(type):
433 return 'String'
434 - elif is_xml_node(type):
435 + elif is_xml_node(type) or is_xml_doc(type):
436 return 'String'
437 elif is_object(type):
438 return convert_class_name(type)
439 @@ -231,7 +231,7 @@
440 return 'String'
441 elif is_collection(vtype):
442 return 'Object[]'
443 - elif is_xml_node(vtype):
444 + elif is_xml_node(vtype) or is_xml_doc(vtype):
445 return 'String'
446 elif is_object(vtype):
447 return convert_class_name(unpointerize(unconstify(vtype)))
448 @@ -252,6 +252,8 @@
449 return 'Object[]'
450 elif vtype == 'xmlNode*':
451 return 'String'
452 + elif vtype == 'xmlDoc*':
453 + return 'String'
454 elif isinstance(vtype,basestring) and vtype.startswith('Lasso'):
455 if vtype.endswith('*'):
456 vtype = vtype[:-1]
457 @@ -300,7 +302,7 @@
458 print >> fd, ' public static native void %s(GObject obj, %s[] value);' % (name,jtype)
459 name = '%s_add' % prefix
460 print >> fd, ' public static native void %s(GObject obj, %s value);' % (name,jtype)
461 - if not m[2].get('element-type') in ('xmlNode*',):
462 + if not m[2].get('element-type') in ('xmlNode*', 'xmlDoc*'):
463 name = '%s_remove' % prefix
464 print >> fd, ' public static native void %s(GObject obj, %s value);' % (name,jtype)
465 elif mtype == 'GHashTable*':
466 @@ -388,7 +390,7 @@
467 return 'jstring'
468 elif is_glist(type) or is_hashtable(type):
469 return 'jobjectArray'
470 - elif is_xml_node(type):
471 + elif is_xml_node(type) or is_xml_doc(type):
472 return 'jstring'
473 elif is_object(type):
474 return 'jobject'
475 @@ -408,6 +410,8 @@
476 return 'get_list_of_strings(env, %s, &%s)' % (right, left)
477 elif is_xml_node(el_type):
478 return 'get_list_of_xml_nodes(env, %s, &%s)' % (right, left)
479 + elif is_xml_doc(el_type):
480 + return 'get_list_of_xml_docs(env, %s, &%s)' % (right, left)
481 elif is_object(el_type):
482 return 'get_list_of_objects(env, %s, &%s)' % (right, left)
483 else:
484 @@ -420,6 +424,8 @@
485 return 'get_hash_of_strings(env, %s, &%s)' % (right, left)
486 elif is_xml_node(type):
487 return 'xml_node_to_jstring(env, %s, &%s)' % (right, left)
488 + elif is_xml_doc(type):
489 + return 'xml_doc_to_jstring(env, %s, &%s)' % (right, left)
490 elif is_object(type):
491 if is_transfer_full(type):
492 return 'gobject_to_jobject(env, (GObject*)%s, &%s);' % (right, left)
493 @@ -439,6 +445,8 @@
494 return 'set_list_of_strings(env, &%s,%s);' % (left,right)
495 elif is_xml_node(el_type):
496 return 'set_list_of_xml_nodes(env, &%s, %s);' % (left, right)
497 + elif is_xml_doc(el_type):
498 + return 'set_list_of_xml_docs(env, &%s, %s);' % (left, right)
499 elif is_object(el_type):
500 return 'set_list_of_objects(env, &%s, %s);' % (left, right)
501 else:
502 @@ -451,6 +459,8 @@
503 return 'set_hash_of_strings(env, %s, %s);' % (left,right)
504 elif is_xml_node(type):
505 return 'jstring_to_xml_node(env, %s, &%s);' % (right, left)
506 + elif is_xml_doc(type):
507 + return 'jstring_to_xml_doc(env, %s, &%s);' % (right, left)
508 elif is_object(type):
509 if is_transfer_full(type) or full:
510 return 'jobject_to_gobject(env, %s, (GObject**)&%s);' % (right, left)
511 @@ -640,6 +650,8 @@
512 print >> fd, ' add_to_list_of_strings(env, &%(field)s, value);' % d
513 elif is_xml_node(el_type):
514 print >> fd, ' add_to_list_of_xml_nodes(env, &%(field)s, value);' % d
515 + elif is_xml_doc(el_type):
516 + print >> fd, ' add_to_list_of_xml_docs(env, &%(field)s, value);' % d
517 elif is_object(el_type):
518 print >> fd, ' add_to_list_of_objects(env, &%(field)s, value);' % d
519 else:
520 @@ -661,6 +673,9 @@
521 if is_xml_node(el_type):
522 print >>sys.stderr, 'W: remove for list of xml node not supported: %s' % (m,)
523 return
524 + if is_xml_doc(el_type):
525 + print >>sys.stderr, 'W: remove for list of xml doc not supported: %s' % (m,)
526 + return
527 print >> fd,'/* Remover for %(type)s<%(el_type)s> %(klass)s.%(name)s */' % d
528 print >> fd, '%(signature)s, jobject jobj, %(jni_el_type)s value)\n {' % d
529 print >> fd, ' %(klass)s *gobj = NULL;' % d
530 @@ -824,7 +839,7 @@
531 print >> fd, ' public void addTo%s(%s value) {' % (jname,jtype)
532 print >> fd, ' LassoJNI.%s_add(this, value);' % prefix
533 print >> fd, ' }'
534 - if m[2].get('element-type') not in ('xmlNode*',):
535 + if m[2].get('element-type') not in ('xmlNode*', 'xmlDoc*'):
536 print >> fd, ' public void removeFrom%s(%s value) {' % (jname,jtype)
537 print >> fd, ' LassoJNI.%s_remove(this, value);' % prefix
538 print >> fd, ' }'
539 @@ -838,7 +853,7 @@
540 print >> fd, ' public void addTo%s(%s value) {' % (old_jname,jtype)
541 print >> fd, ' this.addTo%s(value);' % jname
542 print >> fd, ' }'
543 - if m[2].get('element-type') not in ('xmlNode*',):
544 + if m[2].get('element-type') not in ('xmlNode*', 'xmlDoc*'):
545 print >> fd, ' public void removeFrom%s(%s value) {' % (old_jname,jtype)
546 print >> fd, ' this.removeFrom%s(value);' % jname
547 print >> fd, ' }'
548 --- lasso-2.3.6.orig/bindings/php5/wrapper_source.py
549 +++ lasso-2.3.6/bindings/php5/wrapper_source.py
550 @@ -33,7 +33,7 @@
551
552 def is_object(self, t):
553 return t not in ['char*', 'const char*', 'gchar*', 'const gchar*', 'GList*', 'GHashTable*', 'GType',
554 - 'xmlNode*', 'int', 'gint', 'gboolean', 'const gboolean'] + self.binding_data.enums
555 + 'xmlNode*', 'xmlDoc*', 'int', 'gint', 'gboolean', 'const gboolean'] + self.binding_data.enums
556
557 def generate(self):
558 self.generate_header()
559 @@ -131,6 +131,17 @@
560 }
561 }
562 ''' % q
563 + elif arg_type(type) == 'xmlDoc*':
564 + print >> self.fd, '''\
565 + {
566 + char* xmlString = get_string_from_xml_doc(%(c_variable)s);
567 + if (xmlString) {
568 + ZVAL_STRING(%(zval_name)s, xmlString, 0);
569 + } else {
570 + ZVAL_NULL(%(zval_name)s);
571 + }
572 + }
573 +''' % q
574 elif is_glist(type):
575 elem_type = make_arg(element_type(type))
576 if not arg_type(elem_type):
577 @@ -141,6 +152,9 @@
578 elif arg_type(elem_type).startswith('xmlNode'):
579 function = 'set_array_from_list_of_xmlnodes'
580 free_function = 'free_glist(&%(c_variable)s, (GFunc)xmlFree);'
581 + elif arg_type(elem_type).startswith('xmlDoc'):
582 + function = 'set_array_from_list_of_xmldocs'
583 + free_function = 'free_glist(&%(c_variable)s, (GFunc)xmlFree);'
584 elif is_object(elem_type):
585 function = 'set_array_from_list_of_objects'
586 free_function = 'g_list_free(%(c_variable)s);'
587 @@ -198,6 +212,17 @@
588 }
589 }
590 '''
591 + elif is_xml_doc(arg):
592 + print >> self.fd, '''\
593 + {
594 + char* xmlString = get_string_from_xml_doc(return_c_value);
595 + if (xmlString) {
596 + RETVAL_STRING(xmlString, 0);
597 + } else {
598 + RETVAL_NULL();
599 + }
600 + }
601 +'''
602 elif is_glist(arg):
603 el_type = element_type(arg)
604 if is_cstring(el_type):
605 @@ -212,6 +237,12 @@
606 '''
607 if free or is_transfer_full(arg):
608 print >> self.fd, ' lasso_release_list_of_xml_node(return_c_value);'
609 + elif is_xml_doc(el_type):
610 + print >> self.fd, '''\
611 + set_array_from_list_of_xmldocs((GList*)return_c_value, &return_value);
612 +'''
613 + if free or is_transfer_full(arg):
614 + print >> self.fd, ' lasso_release_list_of_xml_node(return_c_value);'
615 elif is_object(el_type):
616 print >> self.fd, '''\
617 set_array_from_list_of_objects((GList*)return_c_value, &return_value);
618 @@ -284,6 +315,12 @@
619 print >> self.fd, ' %s %s = NULL;' % ('xmlNode*', arg_name(arg))
620 print >> self.fd, ' %s %s_str = NULL;' % ('char*', arg_name(arg))
621 print >> self.fd, ' %s %s_len = 0;' % ('int', arg_name(arg))
622 + elif is_xml_doc(arg):
623 + parse_tuple_format.append('s!')
624 + parse_tuple_args.append('&%s_str, &%s_len' % (arg_name(arg), arg_name(arg)))
625 + print >> self.fd, ' %s %s = NULL;' % ('xmlDoc*', arg_name(arg))
626 + print >> self.fd, ' %s %s_str = NULL;' % ('char*', arg_name(arg))
627 + print >> self.fd, ' %s %s_len = 0;' % ('int', arg_name(arg))
628 elif is_glist(arg):
629 parse_tuple_format.append('a!')
630 parse_tuple_args.append('&zval_%s' % arg_name(arg))
631 @@ -320,6 +357,9 @@
632 elif is_xml_node(arg):
633 print >> self.fd, '''\
634 %(name)s = get_xml_node_from_string(%(name)s_str);''' % {'name': arg[1]}
635 + elif is_xml_doc(arg):
636 + print >> self.fd, '''\
637 + %(name)s = get_xml_doc_from_string(%(name)s_str);''' % {'name': arg[1]}
638 elif f.startswith('s'):
639 print >> self.fd, '''\
640 %(name)s = %(name)s_str;''' % {'name': arg[1]}
641 @@ -363,6 +403,8 @@
642 pass
643 elif argtype == 'xmlNode*':
644 print >> self.fd, ' xmlFree(%s);' % argname
645 + elif argtype == 'xmlDoc*':
646 + print >> self.fd, ' xmlFree(%s);' % argname
647 elif f.startswith('a'):
648 el_type = element_type(arg)
649 if is_cstring(el_type):
650 @@ -478,12 +520,16 @@
651 print >> self.fd, ' lasso_assign_string(this->%(name)s, %(name)s_str);' % d
652 elif is_xml_node(m):
653 print >> self.fd, ' lasso_assign_new_xml_node(this->%(name)s, get_xml_node_from_string(%(name)s_str));' % d
654 + elif is_xml_doc(m):
655 + print >> self.fd, ' lasso_assign_new_xml_doc(this->%(name)s, get_xml_doc_from_string(%(name)s_str));' % d
656 elif is_glist(m):
657 el_type = element_type(m)
658 if is_cstring(el_type):
659 print >> self.fd, ' lasso_assign_new_list_of_strings(this->%(name)s, get_list_from_array_of_strings(zval_%(name)s));' % d
660 elif is_xml_node(el_type):
661 print >> self.fd, ' lasso_assign_new_list_of_xml_node(this->%(name)s, get_list_from_array_of_xmlnodes(zval_%(name)s))' % d
662 + elif is_xml_doc(el_type):
663 + print >> self.fd, ' lasso_assign_new_list_of_xml_doc(this->%(name)s, get_list_from_array_of_xmldocs(zval_%(name)s))' % d
664 elif is_object(el_type):
665 print >> self.fd, ' lasso_assign_new_list_of_gobjects(this->%(name)s, get_list_from_array_of_objects(zval_%(name)s));' % d
666 else:
667 @@ -508,7 +554,7 @@
668
669 def generate_functions_list(self):
670 print >> self.fd, '''\
671 -static function_entry lasso_functions[] = {'''
672 +static zend_function_entry lasso_functions[] = {'''
673 for m in self.functions_list:
674 print >> self.fd, ' PHP_FE(%s, NULL)' % m
675 print >> self.fd, '''\
676 --- lasso-2.3.6.orig/bindings/php5/wrapper_source_top.c
677 +++ lasso-2.3.6/bindings/php5/wrapper_source_top.c
678 @@ -146,12 +146,33 @@
679 return xmlString;
680 }
681
682 +static char*
683 +get_string_from_xml_doc(xmlDoc *xmldoc)
684 +{
685 + xmlChar *xmlString;
686 + int size;
687 +
688 + if (xmldoc == NULL) {
689 + return NULL;
690 + }
691 +
692 + xmlDocDumpMemory(xmldoc, &xmlString, &size);
693 +
694 + return (char *) xmlString;
695 +}
696 +
697 static xmlNode*
698 get_xml_node_from_string(char *string)
699 {
700 return lasso_string_fragment_to_xmlnode(string, 0);
701 }
702
703 +static xmlDoc*
704 +get_xml_doc_from_string(char *string)
705 +{
706 + return lasso_string_fragment_to_xmldoc(string, 0);
707 +}
708 +
709 static GList*
710 get_list_from_array_of_strings(zval* array)
711 {
Fichiers joints
Pour vous référer aux pièces jointes d'une page, utilisez attachment:filename, comme indiqué ci-dessous dans la liste de fichiers. N'utilisez pas l'URL du lien [get], car elle peut changer et donc être facilement cassée.Vous n'êtes pas autorisé à joindre un fichier à cette page.