next up previous contents
Next: Appendix Up: Contents Previous: Using the CTK Graphical   Contents

Subsections


Extending the CTK Inbuilt Block Library

This chapter provides some brief notes to help user's who wish to add their own primitive blocks to the toolkit.

Setting Up Your Local CTK

Before you add your own blocks to CTK you have to make your own local version of the CTK binaries. This is done by following the steps:

  1. First you have to make your own local CTK directory. For example:

    mkdir /home/jon/CTK
    

  2. Then if your shell is csh or tcsh edit your .login and change the definition of CTKLOCAL to point to this directory:

    setenv CTKLOCAL  /home/jon/CTK
    

    If your shell is bash, ksh, zsh or sh then edit your .profile to include the line:

    CTKLOCAL=/usr/local/CTK/local
    

  3. Now copy the files under $CTKROOT/local to $CTKLOCAL:

    cp -r \$CTKROOT/local/* \$CTKLOCAL
    

  4. Now test that it is working by trying to rebuild the binaries locally:

           cd \$CTKROOT/src
           make
    

  5. Finally edit your $PATH to add the $CTKLOCAL/bin to your path making sure it precedes $CTKROOT/bin.

Writing Your Own Primitive Block

The within $CTKLOCAL/src there are files named ctk_NEW_BLOCK_TEMPLATE.cpp and ctk_NEW_BLOCK_TEMPLATE.hh. These files provide an annotated template for the code you need to implement when writing your own inbuilt blocks. The files my_blocks.cpp and my_blocks.hh contain code for a few simple example blocks. Further examples are in the $CTKROOT/src directory.

More detailed CTK developers documentation should eventually be available.

Once you have written the .cpp and .hh files for the block you wish to add you need to perform the following three steps:

  1. Add your new .hh file to the list of includes in the file my_block_headers.hh.

  2. Add a line to the file my_translation_table according to the instructions it contains.

  3. Edit the file Makefile.local in $CTKLOCAL/src and change the definition of OBJS to include the file you have added.

Once these steps have been completed move to the directory $CTKROOT/src and type `make' and the local CTK binaries should now be rebuilt to include your new block in the CTK library. To check that the rebuild has been successful you can type `ctk' to start up the GUI and check that your block appears correctly in the pull-down block menu.


next up previous contents
Next: Appendix Up: Contents Previous: Using the CTK Graphical   Contents
Jon Barker 2001-02-15