next up previous contents
Next: B.4 On-Line Help Up: B IDL Support Previous: B.2 Using CDF's IDL

B.3 CDF ``Include'' Files

A number of parameters (macro constants) are necessary when calling functions in the CDF library from a C program. These parameters are defined in cdf.h . When calling the CDF functions/procedures in IDL, local variables are used to accomplish the same thing. An IDL batchgif file, cdf.pro, is provided that creates/initializes the necessary local variables. cdf.pro is executed automatically by the startup file when you run IDL. All necessary CDF parameters will be available including the status codes commonly used (CDF_OK and CDF_WARN). Most users will not need the other status codes since the CDFerror function can be used to determine the explanation of a status code. If you do require the other status codes, execute the batch file cdf1.pro (the IDL internal path will know where to find it). If you are using the Internal Interface (CDFlib), you will also need the parameters (local variables) defined in cdf2.pro.

IDL limits the number of local variables that may be defined in any one function/procedure. This limit might be reached if you have to include one or more of the CDF ``include'' files. If that happens you will have to use one or more of the ``mapping'' functions provided with the CDF/IDL interface. The use of these ``mapping'' functions eliminates the need to include the corresponding `include' file.

+--------------------------------------------------------------+
| Include File   Mapping Function   Purpose                    |
+--------------------------------------------------------------+
| cdf.pro        mcp.pro            Map CDF parameters         |
| cdf1.pro       msc.pro            Map status codes           |
| cdf2.pro       mii.pro            Map Internal Interface     |
+--------------------------------------------------------------+

Each function returns the longword value that corresponds to the parameter passed in as a character string. For example, the status code value for NO_SUCH_CDF would be retrieved as follows...

   IDL> status = CDFopen ('test1', id)
   IDL> if (status eq MSC('NO_SUCH_CDF')) ...

In this case the batch file cdf1.pro would not have to be included.



cdfsupport@nssdca.gsfc.nasa.gov