|
Boost-Commit : |
From: ghost_at_[hidden]
Date: 2007-09-01 04:55:38
Author: vladimir_prus
Date: 2007-09-01 04:55:35 EDT (Sat, 01 Sep 2007)
New Revision: 39102
URL: http://svn.boost.org/trac/boost/changeset/39102
Log:
Initial support for defining action body from Python.
Text files modified:
trunk/tools/jam/src/builtins.c | 21 +++++++++++++++++++++
trunk/tools/jam/src/jam.c | 5 +++++
2 files changed, 26 insertions(+), 0 deletions(-)
Modified: trunk/tools/jam/src/builtins.c
==============================================================================
--- trunk/tools/jam/src/builtins.c (original)
+++ trunk/tools/jam/src/builtins.c 2007-09-01 04:55:35 EDT (Sat, 01 Sep 2007)
@@ -1695,6 +1695,27 @@
return Py_None;
}
+
+/* Accepts two arguments -- an action name and an action body.
+ Defines an action on bjam side.
+
+ This interface does not (yet) support the list of bound
+ variables of the action flags (together/piecemeal/etc). */
+PyObject*
+bjam_define_action(PyObject* self, PyObject *args)
+{
+ char* name;
+ char* body;
+ module_t* m;
+
+ if (!PyArg_ParseTuple(args, "ss:define_action", &name, &body))
+ return NULL;
+
+ new_rule_actions(root_module(), name, newstr(body), L0, 0);
+
+ return Py_None;
+}
+
#endif
#ifdef HAVE_POPEN
Modified: trunk/tools/jam/src/jam.c
==============================================================================
--- trunk/tools/jam/src/jam.c (original)
+++ trunk/tools/jam/src/jam.c 2007-09-01 04:55:35 EDT (Sat, 01 Sep 2007)
@@ -206,6 +206,9 @@
extern PyObject*
bjam_import_rule(PyObject* self, PyObject* args);
+
+ extern PyObject*
+ bjam_define_action(PyObject* self, PyObject* args);
#endif
int main( int argc, char **argv, char **arg_environ )
@@ -339,6 +342,8 @@
"Call the specified bjam rule."},
{"import_rule", bjam_import_rule, METH_VARARGS,
"Imports Python callable to bjam."},
+ {"define_action", bjam_define_action, METH_VARARGS,
+ "Defines a command line action."},
{NULL, NULL, 0, NULL}
};
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk