|
PreparserUsage
A templating system for making AIRcable BASIC code creation easier. IntroductionTemplates are everywhere around, and python programming language is no exception. By using Cheetah Template Engine we have been able to create some little functions that allow to easily create code that can talk to any stream: Slave, Master and UART. InstallationInstallation PrerequisitesBefore been able to use this template you will need a few prerequisites. You will need to get Python 2.6 and Cheetah 2.x installed. If you're running any Unix based OS like MacOS or Linux then it's quite sure you all ready have python installed, Cheetah can be easily installed by using the package manager from your OS. For MacOS you find instructions here: Cheetah Darwin Port. You may need py25-hashlib for MD5 function and call python2.5 instead of the installed standard python. Windows users might have a more difficult time to install this tools, we've found a useful guide at (1) Setting upOnce you have the prerequisites filled installation is really easy. First you need to get parser.py. And store it somewhere in your path. If you're using a Unix based system then you can mark the file as executable by doing chmod +x parser.py, so then you can call it as parser.py UsageUsage of the script is easy, you just call the script and pass as argument your template, for example: parser.py slave-monitor where slave-monitor is your template. TemplatingFirst we recommend that you understand how Cheetah templating works, for this you can read (1), this is a nice and easy to follow tutorial. Besides the functions provided by Cheetah we have implemented a few more:
ExamplesFor a full example on how to use the templating system you can check our SensorSDK trunk. Links(1) http://www.devshed.com/c/a/Python/Templating-with-Cheetah/ |