> Is there still a need to perform parallelisation for the mentioned software
> components by other approaches?

The multi-processing support by the Coccinelle software triggers some
development challenges.
If data should be shared between started (background) processes,
an external system need to be selected for the desired storage service.
Thus I would like to send these data over network interfaces by the attached
script for the evolving semantic patch language.

I stumble on the following error message.

elfring@Sonne:~/Projekte/Coccinelle/janitor> /usr/local/bin/spatch -D 
server_id=localhost -D server_port=1234 
list_duplicate_statement_pairs_from_if_branches-client2.cocci 
~/Projekte/Linux/next-patched/drivers/media/dvb-frontends/stv0297.c
…
Using Python version:
2.7.15 (default, May 21 2018, 17:53:03) [GCC]
…
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "<string>", line 34, in store_statements
AttributeError: __exit__
Error in Python script, line 55, file …


I would appreciate if the shown data processing approach can work with
version ranges of involved recent software components.
So I am looking for additional solution ideas.

Regards,
Markus
@initialize:python@
server_id << virtual.server_id;
server_port << virtual.server_port;
@@
import json, socket, struct, sys
sys.stderr.write("Using Python version:\n%s\n" % (sys.version))

if server_id == False:
   server_id = "localhost"

if server_port == False:
   server_port = 1234

def store_statements(fun, source, s1, s2):
    """Send data for the service."""
    records = []

    for place in source:
       
records.append('{"name":%s,"file":%s,"line":%s,"column":%s,"s1":%s,"s2":%s}'
                      % (json.dumps(fun),
                         json.dumps(place.file),
                         json.dumps(place.line),
                         json.dumps(int(place.column) + 1),
                         json.dumps(s1),
                         json.dumps(s2)))

    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as so:
         so.connect((server_id, server_port))
         result = "[\n"
         result += ",\n".join(records)
         result += "]"
         b = bytes(result)
         p = struct.pack(">I", len(b))
         p += b
         so.sendall(p)

@searching exists@
identifier work;
statement s1, s2;
position pos;
type T;
@@
 T work(...)
 {
 ... when any
 if (...)
 {
 ... when any
 s1@pos
 s2
 }
 ... when any
 }

@script:python collection@
fun << searching.work;
s1 << searching.s1;
s2 << searching.s2;
place << searching.pos;
@@
store_statements(fun, place, s1, s2)
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to