Why does Coccinelle's scripting interface pass numbers as text/strings?
Just use int to convert it to a number, if you need that.
The ocaml version uses numbers.
If I try out the following statements, ...
@script:python collection depends on !is_void@
typ << function_declaration.t;
fun << function_declaration.f;
places << function_declaration.p;
@@
for place in places:
fields = []
fields.append(fun.ident)
fields.append(typ)
fields.append(place.file)
fields.append(place.line)
print("place.column:", type(place.column))
fields.append(int(place.column) + 1)
result.append(delimiter.join(fields))
... I get another unexpected reaction.
elfring@Sonne:~/Projekte/Coccinelle/lokal/demos/return_values> spatch -sp_file
select_non_void_functions.cocci example1b.c
init_defs_builtins: /usr/share/coccinelle/standard.h
HANDLING: example1b.c
('place.column:', <type 'str'>)
Traceback (most recent call last):
File "<string>", line 11, in <module>
TypeError: sequence item 4: expected string, int found
Failure in collection
Fatal error: exception Pycocci.Pycocciexception
Have you got an idea why this conversion attempt fails?
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)