Re: Passing code replacements by APIs (for SmPL)?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Desirable source code adjustments can also be generated into SmPL script variants.

Will any more software users get further development ideas from an SmPL script
like the following?


// See also:
// https://elixir.bootlin.com/linux/v6.16-rc2/source/include/uapi/linux/usb/ch9.h#L472-L678
@initialize:python@
@@
import sys
x = {}

def store_data(action, input, code):
    """Add information to an internal data structure."""
    x[code] = (action, input)

@find@
expression e;
identifier action, input;
type input_type, return_type != void;
@@
 static inline return_type action(input_type input)
 {
 return e;
 }

@script:python collection@
action << find.action;
input << find.input;
code << find.e;
@@
store_data(action, input, code)

@finalize:python@
@@
if x:
   sys.stdout.write("@replacements@\nconst struct usb_endpoint_descriptor *epd;\n@@\n(\n")
   sys.stdout.write("|\n".join("-{}\n+{}({})\n".format(key, value[0], value[1])
                    for key, value in x.items()))
   sys.stdout.write(")\n")
else:
   sys.stderr.write("No result for this analysis!\n")



Would you become interested to convert contents from any header (or source) files
into more advanced transformation approaches?

Regards,
Markus




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux