3. C Programming Notes

3.1 General Comments

The sequential processing scenario seems the best way to handle BIL (band interleaved by line) tapes; whereas, the random scenario is better for BSQ (band sequential) processing.

Only external variables should be declared in header files (and rarely since they are then globals). Under no circumstances should static variables be defined in header files.

3.2 Type Definitions

Use the following raw C types.

 char                Signed 8-bit integer or text string
 unsigned char       Unsigned 8-bit integer
 short               Signed 16-bit integer
 unsigned short      Unsigned 16-bit integer
 int                 Signed 32-bit integer (Do not use long)
 unsigned int        Unsigned 32-bit integer
 long long           Signed 64-bit integer
 unsigned long long  Unsigned 64-bit integer
 float               32-bit real
 double              64-bit real
The following can precede a variable declaration.

   const             Variable value can not be changed
   static            Define variable as a static

3.3 Include Files

Programmers writing modules to run in conjunction with the LAS system need to use a variety of include files. Each major service (such as image i/o or tape i/o) generally requires that a programmer include a specific file. TAE also requires an include file. These files typically define several symbolic constants. Whatever the contents or purpose of these include files, they are all accessed in the same way on the LAS system. All LAS include files are stored in the directory whose specification is the value of the environment variable LASINCLUDE.

To lessen the number of include files that must be specified within the source code, one general include file "las.h" has been defined. This include file contains general include files within LAS. It does not contain the include files that are used for very specific tasks such as tape i/o and labeled table.

The standard C include files or operating system include files may need to be specified.

Thus, a typical application program might make the following include statements:


     #include <stdio.h>
     #include <unistd.h>
     #include "las.h"
The Makefile specification will specify the path name where the include file can be located.

The individual include files and their contents are listed in the Include File section of this guide.