FreeBASIC  0.91.0
data.c
Go to the documentation of this file.
1 /* DATA core */
2 
3 #include "fb.h"
4 
6 
7 static void hSkipLink( void )
8 {
9  /* If a link was reached, move to the next non-link, or NULL ("EOF") */
10  while( __fb_data_ptr && (__fb_data_ptr->len == FB_DATATYPE_LINK) ) {
11  __fb_data_ptr = __fb_data_ptr->next;
12  }
13 
14  DBG_ASSERT( (__fb_data_ptr == NULL) ||
15  (__fb_data_ptr->len != FB_DATATYPE_LINK) );
16 }
17 
18 FBCALL void fb_DataRestore( FB_DATADESC *labeladdr )
19 {
20  FB_LOCK();
21 
22  __fb_data_ptr = labeladdr;
23  hSkipLink( );
24 
25  FB_UNLOCK();
26 }
27 
28 /* Callers are expected to FB_LOCK/FB_UNLOCK */
29 void fb_DataNext( void )
30 {
31  /* Move forward in current DATA table, if any */
32  if( __fb_data_ptr ) {
33  DBG_ASSERT( __fb_data_ptr->len != FB_DATATYPE_LINK );
34  __fb_data_ptr += 1;
35  hSkipLink( );
36  }
37 }