@@ -34,6 +34,9 @@ static PyTypeObject SoftSwitchableDemo_Type;
3434
3535#define SoftSwitchableDemoObject_Check (v ) (Py_TYPE(v) == &SoftSwitchableDemo_Type)
3636
37+ /* The documentation includes the following code as an example and needs
38+ * the next comment as marker.
39+ */
3740/*DO-NOT-REMOVE-OR-MODIFY-THIS-MARKER:ssf-example-start*/
3841
3942/*
@@ -78,6 +81,8 @@ demo_soft_switchable(PyObject *retval, long *step, PyObject **ob1,
7881 * Specific vars for this example.
7982 */
8083 int do_schedule = * n ;
84+ if (* step == 0 && * n >= 100 )
85+ * step = * n ; // n==100: demo for calling back to Python
8186
8287 /*
8388 * Always present: the switch, that is used to jump to the next step.
@@ -87,8 +92,6 @@ demo_soft_switchable(PyObject *retval, long *step, PyObject **ob1,
8792 * (*step) is the number of the next state to enter.
8893 * The initial value of (*step) is 0.
8994 */
90- if (* step == 0 && * n >= 100 )
91- * step = * n ;
9295 switch (* step ) {
9396 case 0 :
9497 (* step )++ ; // set to the next step
@@ -167,6 +170,9 @@ demo_soft_switchable(PyObject *retval, long *step, PyObject **ob1,
167170 Py_SETREF (retval , PyLong_FromLong (* n ));
168171 break ;
169172
173+ /*
174+ * Demo code for calling back to Python.
175+ */
170176 case 100 :
171177 (* step )++ ; // set to the next step
172178 /*
0 commit comments