Skip to contentSkip to conversation

Extending source code at file end with SmPL

Cocci SF Markus Elfring 2 participants 5 messages Feb 2, 2016 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

Hello,

I became interested in another source code transformation. I would like to append something to selected source files at the end.

How should the "file end" be expressed for the semantic patch language?

Regards,
Markus

A message that is not in the archive (sent off-list or not yet received): alpine.DEB.2.10.1602021111510.2494@hadrien

#2 lore raw
Quoted 5 lines
Quoted 1 line

How should the "file end" be expressed for the semantic patch language?

There is no convenient way to express this. You could perhaps match all of the function definitions, find their line numbers, and put something after the last one.

Thanks for your feedback.

How are the chances to extend the SmPL capabilities for matching of special positional constraints?

Are we looking for the support of functionality which is similar to the use of the search operator "$" within regular expressions?
http://www.regular-expressions.info/anchors.html

Would it make sense to clarify any further extensions?

Regards,
Markus

A message that is not in the archive (sent off-list or not yet received): alpine.DEB.2.10.1602021205280.2494@hadrien

#4 lore raw
Quoted 3 lines
Quoted 1 line

Would it make sense to clarify any further extensions?

Why don't you just use cat?

A software tool like "cat" does usually not generate the desired patch file.

I would also appreciate if the input file will be checked according to specific source code search patterns.

Regards,
Markus

#5 lore raw
Quoted 8 lines · SF Markus Elfring
Quoted 3 lines
Quoted 1 line

Would it make sense to clarify any further extensions?

Why don't you just use cat?

A software tool like "cat" does usually not generate the desired patch file.

I would also appreciate if the input file will be checked according to specific source code search patterns.

I guess you can generate what you want with Coccinelle, and then cat it onto the end of some other file and do diff to get a patch.

julia

Quoted 4 lines

Regards,
Markus

#6 lore raw
Quoted 5 lines
Quoted 2 lines

I would also appreciate if the input file will be checked according to specific source code search patterns.

I guess you can generate what you want with Coccinelle, and then cat it onto the end of some other file and do diff to get a patch.

I am looking for possibilities to keep a tool like "spatch" the central interface for the specification of desired source code changes. I would like to avoid the patch generation for special search patterns by various workarounds.
How many software development efforts are needed then to keep corresponding context information (like line numbers for patch hunks) consistent?

Regards,
Markus