Add fork_exec example.

This commit is contained in:
Stefan Krah 2013-03-14 15:18:24 +01:00
parent e7035bf03f
commit 170a8f61e1
1 changed files with 22 additions and 0 deletions

View File

@ -261,6 +261,28 @@ formatted this way::
/*[define_output_end]*/
Benefits of a compact notation
==============================
The advantages of a concise notation are especially obvious when a large
number of parameters is involved. The argument parsing part of
``_posixsubprocess.fork_exec`` is fully specified by this definition::
/*[define subprocess_fork_exec]
def _posixsubprocess.fork_exec(
process_args: "O", executable_list: "O",
close_fds: "p", py_fds_to_keep: "O",
cwd_obj: "O", env_list: "O",
p2cread: "i", p2cwrite: "i", c2pread: "i", c2pwrite: "i",
errread: "i", errwrite: "i", errpipe_read: "i", errpipe_write: "i",
restore_signals: "i", call_setsid: "i", preexec_fn: "i", /) -> int: pass
[define_end]*/
Note that the *preprocess* tool currently emits a redundant C-declaration
section for this example, so the output is longer than necessary.
Easy validation of the definition
=================================