Example: I want to read in and process 3 days of events, from day1996 703 to 705 (all my "processing will do here is print out the time stamps of each event and the total number of events. An important thing which is illustrated here is the use of the routine getRequestTimesForDaysEvents_c which is used so as to prevent the retrieval of overlapping data at the start and end of days. -------------------------------------------------------------------------------- The code: #include #include #include "hdfi.h" #include "cris.h" #include "level1.h" #include "prototype/cris/crisGetData/getEvents_c.h" int main(int argc, char *argv[]) { struct ce_crisEvt *pEvent; int i, day1996, day1996Start, day1996End, autoMemoryFreeFlag; uint32 *eventRequestTimesArray; int totalEventCount; /* setting autoMemoryFreeFlag to true so I don't need to worry */ /* about deallocating memory. If I wanted to save some of the */ /* arrays of structures or times beyond a subsequent call to */ /* the same routine, I would need to turn this feature off and */ /* manually deallocate the memory myself at some point, using free(). */ autoMemoryFreeFlag = 1; day1996Start = 703; day1996End = 705; totalEventCount = 0; for (day1996 = day1996Start; day1996 <= day1996End; day1996++) { printf("\nday = %d\n\n", day1996); eventRequestTimesArray = getRequestTimesForDaysEvents_c(day1996, autoMemoryFreeFlag); i = 0; while (eventRequestTimesArray[i] > 0) { pEvent = getEvents_c(eventRequestTimesArray[i]); /* here's my processing... */ while (pEvent->secs1996 != 0) { printf("evtno, secs1996 = %ld, %ld\n", pEvent->evtno, pEvent->secs1996); totalEventCount++; pEvent++; } i++; } } printf("\ntotalEventCount = %d\n", totalEventCount); return 0; } ------------------------------------------------------------------------ The run: [Note that there are no overlapping time stamps between days.] % setenv L1_CRIS_DATA_BASE_DIRECTORY /home/idunn1/ACEdata/level1/data/cris4 % test day = 703 evtno, secs1996 = 8583015, 60652708 evtno, secs1996 = 8583020, 60652708 evtno, secs1996 = 8583021, 60652708 evtno, secs1996 = 8583022, 60652708 evtno, secs1996 = 8583025, 60652708 evtno, secs1996 = 8583027, 60652708 evtno, secs1996 = 8583029, 60652708 evtno, secs1996 = 8583032, 60652708 . . . evtno, secs1996 = 8669290, 60738723 evtno, secs1996 = 8669295, 60738723 evtno, secs1996 = 8669302, 60738723 evtno, secs1996 = 8669312, 60738723 evtno, secs1996 = 8669318, 60738723 evtno, secs1996 = 8669324, 60738723 evtno, secs1996 = 8669330, 60738723 day = 704 evtno, secs1996 = 8669288, 60738979 evtno, secs1996 = 8669291, 60738979 evtno, secs1996 = 8669292, 60738979 evtno, secs1996 = 8669293, 60738979 evtno, secs1996 = 8669296, 60738979 evtno, secs1996 = 8669297, 60738979 evtno, secs1996 = 8669298, 60738979 . . . evtno, secs1996 = 8755757, 60825149 evtno, secs1996 = 8755758, 60825149 evtno, secs1996 = 8755764, 60825149 evtno, secs1996 = 8755765, 60825149 evtno, secs1996 = 8755768, 60825149 evtno, secs1996 = 8755769, 60825149 evtno, secs1996 = 8755776, 60825149 evtno, secs1996 = 8755777, 60825149 day = 705 evtno, secs1996 = 8755719, 60825405 evtno, secs1996 = 8755721, 60825405 evtno, secs1996 = 8755723, 60825405 evtno, secs1996 = 8755729, 60825405 evtno, secs1996 = 8755732, 60825405 evtno, secs1996 = 8755732, 60825405 evtno, secs1996 = 8755733, 60825405 evtno, secs1996 = 8755739, 60825405 . . . evtno, secs1996 = 8842236, 60911677 evtno, secs1996 = 8842240, 60911677 evtno, secs1996 = 8842241, 60911677 evtno, secs1996 = 8842244, 60911677 evtno, secs1996 = 8842248, 60911677 evtno, secs1996 = 8842263, 60911677 evtno, secs1996 = 8842270, 60911677 evtno, secs1996 = 8842274, 60911677 totalEventCount = 206704 ------------------------------------------------------------------------ The Makefile: # where is your base directory? (ACE_WARE must be defined in your environment.) BASE_DIR = ${ACE_WARE} INCLUDE_DIR = ${BASE_DIR}/include LIBRARY_DIR = ${BASE_DIR}/lib # which compiler are you using? # setenv CC gcc (CC can be defined in your environment.) # CC = gcc (or not.) # code optimization and warnings flags FLAGS = -O2 -Wall # include files needed here are found in these directories: # # include/hdf: declarations for HDF types used throughout ACEware # include/structures: declarations for CRIS/SIS data structs # include/level1: level1 routine declarations # include/level1_1: level1_1 routine declarations INCLUDE_HEADER_DIRS = -I${INCLUDE_DIR}/hdf \ -I${INCLUDE_DIR}/structures \ -I${INCLUDE_DIR}/level1 \ -I${INCLUDE_DIR}/level1_1 INCLUDE_LIB_DIRS = -L${LIBRARY_DIR} # order of library inclusion is important INCLUDE_LIBRARIES = -llevel1_1 -llevel1 all: ${CC} ${FLAGS} test.c -o test \ ${INCLUDE_HEADER_DIRS} \ ${INCLUDE_LIB_DIRS} \ ${INCLUDE_LIBRARIES} clean: rm -rf *.o test ------------------------------------------------------------------------ The make: % make gcc -O2 -Wall test.c -o test \ -I/home/idunn1/ACEware/include/hdf -I/home/idunn1/ACEware/include/structures -I/home/idunn1/ACEware/include/level1 -I/home/idunn1/ACEware/include/level1_1 \ -L/home/idunn1/ACEware/lib \ -llevel1_1 -llevel1 % ------------------------------------------------------------------------