7.0 Utility Field Macros

Field Macros are macros that manipulate and return information about SIDF data at the bit level.

In the field macros section, it is important to remember that formatted FID values are put into a section as a byte stream where the most significant byte is first, the second most significant byte is next, etc.

Where noted, the macros depend upon longFid (a local variable) being set before the macros are called.

If the FID is long, the engine sets longFID to TRUE. If the FID is not long, longFID is set to FALSE. The following function is used to set longFID:

  int IsLong(unsigned char *fid) 
  { 
     if(*fid & 0x80) 
     { 
        //fid is a Standard or OS FID 
        if (*fid == 0x80 || ((*fid & 0xC0) == 0x80)) 
           ++fid; // fid is Standard or OS FID 
        else 
           fid += 2; // fid is Developer FID 
   
        if (*fid & 0x80) 
              return TRUE; // fid is a long FID 
     else 
              return FALSE; //fid is a Short FID 
     } 
   
     else 
     return FALSE; //fid is Small FID 
  }
  

The function is used as follows:

  UINT8 longFid; 
  char *fid; 
  UINT32 fidValue = 0x8000C0; 
  ... 
  fid = (char *)&fidValue; 
  longFid = IsLong(fid);
  

A special note is needed for macro parameters. The contents of non-pointer parameters in macros can be changed. The parameter prototypes will not show as pointer types because the macro does not use a pointer to change the parameter's contents. For example, macro “typedef Demo(param) ((param) = 0)” changes the contents of param.