BOOL retdat(buffer,offset,sample,sample_num)
ADB *buffer ;
unsigned short offset, sample_num ;
unsigned char *sample ;
retdat copies one sample from the data_set into the area pointed to by "sample". Samples are numbered starting at 0. The directory entry located at "offset" bytes from the beginning of the ADB determines the location of the data_set and the size of the sample.
buffer
ADB - aircraft data block
offset
offset in bytes to directory entry
sample_num
number of desired sample
sample
location to which to copy the data
true if the sample is copied, false otherwise.
BOOL retdat(buffer,offset,data_element,data_set_index) find the specified directory entry if the directory entry element size = OVERFLOW then return NO if the data_set_index * element_size >= byte_count then return NO bytes_to_transfer = entry element_size data_element_address = start_of_adb + entry_data_offset + entry_element_size * data_set_index while there are still bytes_to_transfer do transfer the next data_element return YES
/* FILE: RETDAT.C */ #include #include "air.h" BOOLE retdat(buffer,offset,data_element,data_set_index) ADB *buffer ; unsigned short offset ; unsigned char *data_element ; unsigned short data_set_index ; { DIR_ENTRY *entry ; unsigned short bytes_to_transfer ; unsigned char *adb_data_element, *char_buffer ; char_buffer = (unsigned char *)buffer ; entry = (DIR_ENTRY *)(char_buffer + offset) ; if (entry->element_size == OVERFLOW) return(NO) ; if ((data_set_index * entry->element_size) >= entry->byte_count) return(NO) ; bytes_to_transfer = entry->element_size ; adb_data_element = char_buffer + entry->data_offset + entry->element_size * data_set_index ; while (bytes_to_transfer-- > 0) *data_element++ = *adb_data_element++ ; return(YES) ; }