Both sides previous revisionPrevious revisionNext revision | Previous revision |
tutorials:advanced:task_trees [2015/07/09 11:32] – Updated ptr-cram-function lambda list handling. mpomarlan | tutorials:advanced:task_trees [2020/09/17 14:09] (current) – [Plan transformations: task trees, code replacement, and serialization] gkazhoya |
---|
====== Plan transformations: task trees, code replacement, and serialization ====== | ====== Plan transformations: task trees, code replacement, and serialization ====== |
| |
| **Disclaimer:** the most up to date overview of plan transformations you can find in README.md of ''cram_plan_transformation'' package (''CRAM_REPO/cram_3d_world/cram_plan_transformation/README.md''). The tutorial below is out of date and has not be maintained, unfortunately, but you might still find some useful explanations there. Otherwise, stick to the README. |
| |
**Description:** this tutorial is aimed at CRAM developers, and its purpose is to present an in-development aspect of CRAM. It is less a proper tutorial and more documentation for work in progress. Expect content to change. It contains an intro to task trees, a data structure used by CRAM functions (note: this has existed in CRAM for a while and will not change). It also describes code replacement (also long existing), failure handling through code replacement (new), and serialization of task trees and functions (new). | **Description:** this tutorial is aimed at CRAM developers, and its purpose is to present an in-development aspect of CRAM. It is less a proper tutorial and more documentation for work in progress. Expect content to change. It contains an intro to task trees, a data structure used by CRAM functions (note: this has existed in CRAM for a while and will not change). It also describes code replacement (also long existing), failure handling through code replacement (new), and serialization of task trees and functions (new). |
<code lisp> | <code lisp> |
(swank:operate-on-system-for-emacs "cram-projection" (quote load-op)) | (swank:operate-on-system-for-emacs "cram-projection" (quote load-op)) |
(cram-projection:define-projection-environment example-env) | |
(in-package :cpl-impl) | (in-package :cpl-impl) |
| (cram-projection:define-projection-environment example-env) |
| |
(def-top-level-cram-function tryprj () | (def-top-level-cram-function tryprj () |
</code> | </code> |
| |
Currently, by default the :ptr-parameter to cpl-impl:replace-task-code is nil, so when modifying a ptr-cram-function make sure to put a reasonable value there. (TODO: replace the default nil with the current effective compile-time parameter for the modified node.) | By default the :ptr-parameter to cpl-impl:replace-task-code is set to the previously effective value of ptr-parameter that is stored in the task tree node. This either the ptr-parameter in the code slot of the node (if there are no code replacements), or the ptr-parameter in the car object in the code-replacements list of the node. When a task tree node is created and a ptr-parameter is not specified, the default is nil. |
| |
In our example here, the compile-time parameter is a string. It can however be anything, including a struct or a list, for when you need to pass on several objects through plan transformation. | In our example here, the compile-time parameter is a string. It can however be anything, including a struct or a list, for when you need to pass on several objects through plan transformation. |