From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Determination for the number of named function parameters (with SmPL)
Date: Mon, 01 Dec 2014 12:12:17 +0100 [thread overview]
Message-ID: <547C4D11.1050206@users.sourceforge.net> (raw)
Hello,
Would you like to know how many named function parameters are used in the source files?
How do you think about to try the following semantic query approach out a bit more?
@initialize:python@
@@
import sys
import sqlite3 as SQLite
connection = SQLite.connect(":memory:")
c = connection.cursor()
c.execute("""create table numbers (number integer)""")
delimiter = "|"
def store_number(count):
"""Add an integer to an internal list."""
c.execute("""insert into numbers (number) values (?)""",
(count, )
)
@counting_parameters@
identifier work;
parameter list[number] pl;
type return_type;
@@
return_type work(pl)
{
...
}
@script:python collection@
count << counting_parameters.number;
@@
store_number(count)
@finalize:python@
@@
c.execute("""select count(*) nr from numbers""")
result = c.fetchone()
if result[0] > 0:
c.execute("""create index x on numbers (number)""")
c.execute("select number, count(*) nr from numbers group by number")
sys.stdout.write(delimiter.join( ("number", "counter") ))
sys.stdout.write("\r\n")
for result in c:
sys.stdout.write(delimiter.join((str(result[0]),
str(result[1])
)))
sys.stdout.write("\r\n")
else:
sys.stderr.write("No result for this analysis!\n")
connection.close()
elfring at Sonne:~/Projekte/Coccinelle/Probe> XX=$(date) && spatch.opt -timeout 12 -sp-file list_parameter_numbers1.cocci -dir /usr/src/linux-stable > list_parameter_numbers1.txt 2> list_parameter_numbers1-errors.txt ; YY=$(date) && echo "$XX * $YY"
...
elfring at Sonne:~/Projekte/Coccinelle/Probe> cat list_parameter_numbers1.txt
number|counter
0|29
1|18261
2|15374
3|12237
4|8159
5|4339
6|2701
7|1183
8|518
9|260
10|146
11|83
12|42
13|21
14|9
15|7
16|2
17|4
18|1
21|1
22|1
Do you find such an analysis result from the source files for Linux 3.17.4
interesting for further considerations?
Regards,
Markus
WARNING: multiple messages have this Message-ID (diff)
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: cocci@systeme.lip6.fr
Subject: Determination for the number of named function parameters (with SmPL)
Date: Mon, 01 Dec 2014 11:12:17 +0000 [thread overview]
Message-ID: <547C4D11.1050206@users.sourceforge.net> (raw)
Hello,
Would you like to know how many named function parameters are used in the source files?
How do you think about to try the following semantic query approach out a bit more?
@initialize:python@
@@
import sys
import sqlite3 as SQLite
connection = SQLite.connect(":memory:")
c = connection.cursor()
c.execute("""create table numbers (number integer)""")
delimiter = "|"
def store_number(count):
"""Add an integer to an internal list."""
c.execute("""insert into numbers (number) values (?)""",
(count, )
)
@counting_parameters@
identifier work;
parameter list[number] pl;
type return_type;
@@
return_type work(pl)
{
...
}
@script:python collection@
count << counting_parameters.number;
@@
store_number(count)
@finalize:python@
@@
c.execute("""select count(*) nr from numbers""")
result = c.fetchone()
if result[0] > 0:
c.execute("""create index x on numbers (number)""")
c.execute("select number, count(*) nr from numbers group by number")
sys.stdout.write(delimiter.join( ("number", "counter") ))
sys.stdout.write("\r\n")
for result in c:
sys.stdout.write(delimiter.join((str(result[0]),
str(result[1])
)))
sys.stdout.write("\r\n")
else:
sys.stderr.write("No result for this analysis!\n")
connection.close()
elfring@Sonne:~/Projekte/Coccinelle/Probe> XX=$(date) && spatch.opt -timeout 12 -sp-file list_parameter_numbers1.cocci -dir /usr/src/linux-stable > list_parameter_numbers1.txt 2> list_parameter_numbers1-errors.txt ; YY=$(date) && echo "$XX * $YY"
...
elfring@Sonne:~/Projekte/Coccinelle/Probe> cat list_parameter_numbers1.txt
number|counter
0|29
1|18261
2|15374
3|12237
4|8159
5|4339
6|2701
7|1183
8|518
9|260
10|146
11|83
12|42
13|21
14|9
15|7
16|2
17|4
18|1
21|1
22|1
Do you find such an analysis result from the source files for Linux 3.17.4
interesting for further considerations?
Regards,
Markus
WARNING: multiple messages have this Message-ID (diff)
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: kernel-janitors@vger.kernel.org
Cc: Coccinelle <cocci@systeme.lip6.fr>, LKML <linux-kernel@vger.kernel.org>
Subject: Determination for the number of named function parameters (with SmPL)
Date: Mon, 01 Dec 2014 12:12:17 +0100 [thread overview]
Message-ID: <547C4D11.1050206@users.sourceforge.net> (raw)
Hello,
Would you like to know how many named function parameters are used in the source files?
How do you think about to try the following semantic query approach out a bit more?
@initialize:python@
@@
import sys
import sqlite3 as SQLite
connection = SQLite.connect(":memory:")
c = connection.cursor()
c.execute("""create table numbers (number integer)""")
delimiter = "|"
def store_number(count):
"""Add an integer to an internal list."""
c.execute("""insert into numbers (number) values (?)""",
(count, )
)
@counting_parameters@
identifier work;
parameter list[number] pl;
type return_type;
@@
return_type work(pl)
{
...
}
@script:python collection@
count << counting_parameters.number;
@@
store_number(count)
@finalize:python@
@@
c.execute("""select count(*) nr from numbers""")
result = c.fetchone()
if result[0] > 0:
c.execute("""create index x on numbers (number)""")
c.execute("select number, count(*) nr from numbers group by number")
sys.stdout.write(delimiter.join( ("number", "counter") ))
sys.stdout.write("\r\n")
for result in c:
sys.stdout.write(delimiter.join((str(result[0]),
str(result[1])
)))
sys.stdout.write("\r\n")
else:
sys.stderr.write("No result for this analysis!\n")
connection.close()
elfring@Sonne:~/Projekte/Coccinelle/Probe> XX=$(date) && spatch.opt -timeout 12 -sp-file list_parameter_numbers1.cocci -dir /usr/src/linux-stable > list_parameter_numbers1.txt 2> list_parameter_numbers1-errors.txt ; YY=$(date) && echo "$XX * $YY"
...
elfring@Sonne:~/Projekte/Coccinelle/Probe> cat list_parameter_numbers1.txt
number|counter
0|29
1|18261
2|15374
3|12237
4|8159
5|4339
6|2701
7|1183
8|518
9|260
10|146
11|83
12|42
13|21
14|9
15|7
16|2
17|4
18|1
21|1
22|1
Do you find such an analysis result from the source files for Linux 3.17.4
interesting for further considerations?
Regards,
Markus
next reply other threads:[~2014-12-01 11:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-01 11:12 SF Markus Elfring [this message]
2014-12-01 11:12 ` Determination for the number of named function parameters (with SmPL) SF Markus Elfring
2014-12-01 11:12 ` SF Markus Elfring
2014-12-01 11:23 ` [Cocci] " walter harms
2014-12-01 11:23 ` walter harms
2014-12-01 11:23 ` walter harms
2014-12-02 16:30 ` [Cocci] " Mark D Rustad
2014-12-02 16:30 ` Mark D Rustad
2014-12-02 16:30 ` Mark D Rustad
2014-12-02 16:48 ` [Cocci] " Julia Lawall
2014-12-02 16:48 ` Julia Lawall
2014-12-02 16:48 ` Julia Lawall
2014-12-03 10:30 ` [Cocci] " SF Markus Elfring
2014-12-03 10:30 ` SF Markus Elfring
2014-12-03 10:30 ` SF Markus Elfring
2014-12-16 19:30 ` [Cocci] " SF Markus Elfring
2014-12-16 19:30 ` SF Markus Elfring
2014-12-16 19:30 ` SF Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=547C4D11.1050206@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=cocci@systeme.lip6.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.