beautypg.com

4ć11 – Rockwell Automation 6008-SI IBM PC I/O SCNNR 6008-SI User Manual

Page 38

background image

Chapter 4

Programming Overview

4-11

File H_6008SI.H defines constants according to a logical pattern. The
first few letters of each constant’s name tells you how it’s used, as follows:

Constant:

Definition:

C_

scanner commands (listed in chapter 7, Executing a Management Request, and

chapter 8, Queueing a Block Transfer)

CM_

scanner operating modes (program, test, and run; listed in chapter 7)

SC_

confirmation status values (listed in chapters 7 and 8, Confirmation Status Codes)

SF_

fault status bits and values (listed in chapter 7, Autoconfigure and Link Status

Information)

SL_

link (adapter) configuration status bits and values (listed in chapter 7, Autoconfigure

and Link Status Information)

SO_

operating status bits (listed in chapter 5, Scanner Status)

MAX

user program limits (listed above, in Defined Constants)

C compilers treat capitals and lower case differently, so it’s OK to select
names that begin with c_, cm_, and so on. But stay away from local or
global variable names beginning with any of the above character sequences
in capitals.

Avoiding Link Time Errors

You eventually link one of our supplied libraries with your program.
Please plan now to avoid naming conflicts. (You need to be concerned
only with the names of your functions and extern variables. Your static,
auto,
and register variable names can’t conflict with ours.)

Link time name conflicts could show up in two ways. The linker could
refuse to create an executable program. But most likely the link would
proceed with no indication of anything wrong, and your routine would be
linked in and exclude our routine (or the compiler’s library routine) of the
same name. Then your program would crash (or give wrong results) when
one of our routines called your routine instead of the “standard” routine.
Bugs like these can be hard to uncover, so it’s best to avoid them in the
first place. Borland’s TLINK linker offers the /d option to diagnose this
sort of problem. We recommend you use the /d option if you’re using
Borland’s Turbo C++ or Borland C++ to develop your application.

In this manual you’ll see the names of almost all the functions in the
libraries we supply, and naturally you should not use any of those names
for your own code. In addition, the libraries have a few internal support
routines whose names begin with io_ or IO_, and you should avoid those
names also.