next up previous contents
Next: Modifying Header Files Up: Starting to Program Previous: Starting to Program   Contents

Linking Your Own Code

A basic skeleton windows interface is provided written using tw_windows. This is called skeleton.c and included in the provided Makefile with the line

OFILES = skeleton.o

Your own routines can be immediately added by re-writing the example algorithms provided. Do not waste time trying to understand the user interface wrappers and graphics. The whole point of Tina is that you don't need to do this. Concentrate instead on the process of code modification, debugging (eg: using DDD) and location of algorithmic sources in the library. Once you are familiar with this process you may wish to extend your scope and try adding your own files or modifying library routines.

When writing a new routine it is recommended that you start by copying an existing function from the library and using it as a template (See Tina memo 2005-004, the Programmer Reference, for a quick overview of functions). For example, if you wish to write a simple image processing routine you may wish to start by looking at imf_add(). Suitable templates can often be located by chasing down through the function calls in the user interface. Simply add the new fucntion in the same file as the chosen template until you have a better idea of what the completed function will look like and what header files you need. Tina software contains useful approaches to memory management and data processing and as the software has already been debugged, you will be less likely to forget to do things (such as testing the validity of input data and freeing up memory). You won't find out about these or the other functionality of the libraries unless you look.

You can modify any of the software already in the libraries simply by copying the C file (and if needed the accompanying .h file) to your project directory and including the object file in the Makefile. To do this you will need to include the object file (eg: imgPrc_add.o) in the list of OFILES specified in the Makefile.

OFILES = skeleton.o imgPrc_add.o

This file, when compiled and linked, will supercede the library version.

Once a function has been written you may wish to separate it into a new file. This will require you to duplicate the structure of the original file (including headers), and at this point you should also generate a .h file for the function prototypes in the new file. To compile with your own files simply include your source code filename in the Makefile provided.

OFILES = skeleton.o yourownprog.o imgPrc_add.o

next up previous contents
Next: Modifying Header Files Up: Starting to Program Previous: Starting to Program   Contents
root 2019-06-17