| 1334 | |
| 1335 | # Simple syntax |
| 1336 | def getP(indirect=True): |
| 1337 | |
| 1338 | class Fun(Callback): |
| 1339 | |
| 1340 | def __init__(self): |
| 1341 | Callback.__init__(self) |
| 1342 | self.construct("Fun", {}) |
| 1343 | |
| 1344 | def get_n_in(self): return 2 |
| 1345 | def get_n_out(self): return 1 |
| 1346 | |
| 1347 | def eval(self,arg): |
| 1348 | x = arg[0] |
| 1349 | y = arg[1] |
| 1350 | |
| 1351 | z0 = 3*y |
| 1352 | z1 = x+z0 |
| 1353 | z2 = sin(z1) |
| 1354 | return [z2] |
| 1355 | |
| 1356 | self.cb = Fun() |
| 1357 | |
| 1358 | if not indirect: |
| 1359 | return self.cb |
| 1360 | |
| 1361 | f = Function("f", [x,y],[self.cb(x,y)]) |
| 1362 | |
| 1363 | return f |
| 1364 | |
| 1365 | for indirect in [True,False]: |
| 1366 | f = getP(indirect=indirect) |