Anonymous avatar Anonymous committed 02ab562

Format changes and doc regen

Comments (0)

Files changed (38)

  *  - Call "CR_THREAD_INIT" at the start of each coroutine thread
  *  - Call "CR_YIELD" at the desired points within coroutine thread
  *
- *  \code
-    example of initialization, registration, and start of cr_lib
-    ------------------------------------------------------------
+ *	\code
+	example of initialization, registration, and start of cr_lib
+	------------------------------------------------------------
 
-    #define CONTEXT_ARRAY_CNT   ( 2 + 1 )
+	#define CONTEXT_ARRAY_CNT   ( 2 + 1 )
 
-    CR_CONTEXT context_array[ CONTEXT_ARRAY_CNT ];
+	CR_CONTEXT context_array[ CONTEXT_ARRAY_CNT ];
 
-    int main( int argc, char* argv[ ] )
-    {
-        // 1. initialize cr_lib
-        cr_init( context_array, CONTEXT_ARRAY_CNT );
+	int main( int argc, char* argv[ ] ) {
+		// 1. initialize cr_lib
+		cr_init( context_array, CONTEXT_ARRAY_CNT );
 
-        // 2. register functions
-        cr_register_thread( Thread_A );
-        cr_register_thread( Thread_B );
+		// 2. register functions
+		cr_register_thread( Thread_A );
+		cr_register_thread( Thread_B );
 
-        // 3. bootstrap system
-        CR_START( Thread_A );
+		// 3. bootstrap system
+		CR_START( Thread_A );
 
-        return 0;
-    }
+		return 0;
+	}
 
-         coroutine 1                                     coroutine 2
-         -----------                                     -----------
-    void Thread_A( void )                           void Thread_B( void )
-    {                                               {
-        CR_THREAD_INIT( );                              CR_THREAD_INIT( );
+	coroutine 1					coroutine 2
+	-----------					-----------
+	void Thread_A( void ) {			void Thread_B( void ) {
+		CR_THREAD_INIT( );				CR_THREAD_INIT( );
 
-        for ( ; ; ) {                                   while ( 1 ) {
-            // main body of code                             // main body of code
-            CR_YIELD( Thread_B );                            CR_YIELD( cr_idle );
+		for ( ; ; ) {					while ( 1 ) {
+			// main body of code				// main body of code
+			CR_YIELD( Thread_B );				CR_YIELD( cr_idle );
+			// user code					// user code
+		}						}
+	}						}
 
-            // user code                                     // user code
-        }                                               }
-    }                                               }
+	*Note: locals within a corouitne thread should use the 'volatile' qualifier
 
-    *Note: locals within a corouitne thread should use the 'volatile' qualifier
+	E.g.:
+	coroutine 1
+	-----------
+	void Thread_A( void ) {
+		// locals use the 'volatile' qualifier
+		int32_t volatile count = 0;
 
-    E.g.:
-         coroutine 1
-         -----------
-    void Thread_A( void )
-    {
-        // locals use the 'volatile' qualifier
-        int32_t volatile count = 0;
+		CR_THREAD_INIT( );
 
-        CR_THREAD_INIT( );
+		for ( ;; ) {
+			count += 1;
 
-        for ( ;; ) {
-            count += 1;
-
-            // main body of code
-            CR_YIELD( Thread_B );
-
-            // user code
-        }
-    }
+			// main body of code
+			CR_YIELD( Thread_B );
+			// user code
+		}
+	}
 
  *  \endcode
  *
  *  \note For internal use only.
  */
 enum {
-    CR_ERROR_CR_EXITING = 0 /*!< Used in asserts for clarity */
+	CR_ERROR_CR_EXITING = 0 /*!< Used in asserts for clarity */
 };
 
-jmp_buf                 cr_g_reg_func_env;
+jmp_buf			cr_g_reg_func_env;
 
 /** \brief Pointer to the user defined array of coroutine contexts
  *  \note For internal use only.
  */
-CR_CONTEXT*             cr_g_context        = 0;
+CR_CONTEXT*		cr_g_context		= 0;
 
 /** \brief The number of elements in the coroutine context array
  *  \note For internal use only.
  */
-uint32_t                cr_g_context_cnt    = 0;
+uint32_t		cr_g_context_cnt	= 0;
 
 /** \brief Holds the ID of the coroutine to be activated - by cr_idle
  */
-cr_id_t                 cr_g_activate_id    = CR_IDLE_THREAD_ID;
+cr_id_t			cr_g_activate_id	= CR_IDLE_THREAD_ID;
 
 /** \brief Flag that's set when CR_START is called
  *  \note For internal use only.
  */
-int32_t                 cr_g_sys_started    = false;
+int32_t			cr_g_sys_started	= false;
 
 /** \brief The ID of the coroutine that's active
  *  \note For internal use only.
  */
-cr_id_t                 cr_g_current_cr_id  = CR_IDLE_THREAD_ID;
+cr_id_t			cr_g_current_cr_id	= CR_IDLE_THREAD_ID;
 
 /** \brief The ID of the previously active coroutine
  *  \note For internal use only.
  */
-cr_id_t                 cr_g_previous_cr_id  = CR_IDLE_THREAD_ID;
+cr_id_t			cr_g_previous_cr_id	= CR_IDLE_THREAD_ID;
 
 /** \brief The total number of registered coroutines
  *  \note For internal use only.
  */
-static int32_t          cr_g_thread_cnt      = CR_THREAD_CNT_INIT;
+static int32_t		cr_g_thread_cnt		= CR_THREAD_CNT_INIT;
 
 /** \brief Find the ID of a coroutine.
  *
  *  \retval CR_INVALID_ID when no ID is found
  *  \retval id a valid coroutine's ID
  */
-cr_id_t cr_get_id( void ( *pFunc )( void ) )
-{
-    int32_t i;
-    cr_id_t id = CR_INVALID_ID;
+cr_id_t cr_get_id( void ( *pFunc )( void ) ) {
+	int32_t i;
+	cr_id_t id = CR_INVALID_ID;
 
-    for ( i = 0; i <= cr_g_thread_cnt; i++ ) {
-        if ( cr_g_context[ i ].pFunc == pFunc ) {
-            id = i;
-            break;
-        }
-    }
+	for ( i = 0; i <= cr_g_thread_cnt; i++ ) {
+		if ( cr_g_context[ i ].pFunc == pFunc ) {
+			id = i;
+			break;
+		}
+	}
 
-//    printf( "cr_get_id pFunc: 0x%X\n", pFunc );
-//    printf( "cr_get_id id: %d\n", id );
+//	printf( "cr_get_id pFunc: 0x%X\n", pFunc );
+//	printf( "cr_get_id id: %d\n", id );
 
-    return id;
+	return id;
 }
 
 /** \brief Resets the system to an initial state.
  *
  *  This function sets all the system's global variables to their original state.
  */
-void cr_reset( void )
-{
-    cr_g_context        = 0;
-    cr_g_context_cnt    = 0;
-    cr_g_thread_cnt     = CR_THREAD_CNT_INIT;
-    cr_g_previous_cr_id = CR_INVALID_ID;
-    cr_g_current_cr_id  = CR_INVALID_ID;
-    cr_g_activate_id    = CR_IDLE_THREAD_ID;
-    cr_g_sys_started    = false;
+void cr_reset( void ) {
+	cr_g_context		= 0;
+	cr_g_context_cnt	= 0;
+	cr_g_thread_cnt		= CR_THREAD_CNT_INIT;
+	cr_g_previous_cr_id	= CR_INVALID_ID;
+	cr_g_current_cr_id	= CR_INVALID_ID;
+	cr_g_activate_id	= CR_IDLE_THREAD_ID;
+	cr_g_sys_started	= false;
 }
 
 /** \brief cr_lib's initialization function.
  *  \param cr_context_count the element count of the array
  *  \attention This initialization function must be the first function called in the library.
  */
-void cr_init( CR_CONTEXT*    cr_context,
-              size_t         cr_context_count )
-{
-    // Init the array of CR_CONTEXT structs as well as the globals.
-    assert( cr_context && "user param cr_context must be non-zero!\n" );
-    assert( ( cr_context_count > 0 ) && "user param cr_context_count must be non-zero!\n" );
+void cr_init( CR_CONTEXT* cr_context, size_t cr_context_count ) {
+	// Init the array of CR_CONTEXT structs as well as the globals.
+	assert( cr_context && "user param cr_context must be non-zero!\n" );
+	assert( ( cr_context_count > 0 ) && "user param cr_context_count must be non-zero!\n" );
 
-    memset( cr_context, 0, cr_context_count * sizeof( CR_CONTEXT ) );
+	memset( cr_context, 0, cr_context_count * sizeof( CR_CONTEXT ) );
 
-    cr_g_context        = cr_context;
-    cr_g_context_cnt    = ( uint32_t ) cr_context_count;
+	cr_g_context		= cr_context;
+	cr_g_context_cnt	= ( uint32_t ) cr_context_count;
 
-    // Register the idle thread, which should _always_ be the first coroutine registered.
-    cr_register_thread( cr_idle );
+	// Register the idle thread, which should _always_ be the first coroutine registered.
+	cr_register_thread( cr_idle );
 }
 
 /** \brief The internal system's coroutine thread.
  *
  *  \attention This coroutine thread must be explicitly called for it to run.
  */
-void cr_idle( void )
-{
-    // This needs to be static because the function initially returns normally.
-    static cr_id_t temp_id;
+void cr_idle( void ) {
+	// This needs to be static because the function initially returns normally.
+	static cr_id_t temp_id;
 
-    CR_THREAD_INIT( );
+	CR_THREAD_INIT( );
 
-    assert( ( this_id__ == CR_IDLE_THREAD_ID ) && "cr_idle: this_id__ != CR_IDLE_THREAD_ID!\n" );
+	assert( ( this_id__ == CR_IDLE_THREAD_ID ) && "cr_idle: this_id__ != CR_IDLE_THREAD_ID!\n" );
 
-    // This will be the entry point when longjump is called with cr_idle's context.
-    // No need to perform another setjmp from within the loop; not much happening.
-    for ( ; ; ) {
-        // Spin until a non-idle thread is activated.
-        if ( cr_g_activate_id == CR_IDLE_THREAD_ID ) {
-            continue;
-        }
+	// This will be the entry point when longjump is called with cr_idle's context.
+	// No need to perform another setjmp from within the loop; not much happening.
+	for ( ; ; ) {
+		// Spin until a non-idle thread is activated.
+		if ( cr_g_activate_id == CR_IDLE_THREAD_ID ) {
+			continue;
+		}
 
-        assert( ( cr_g_activate_id != CR_INVALID_ID ) && "cr_idle: cr_g_activate_id == CR_INVALID_ID!\n" );
-        assert( ( ( uint32_t ) cr_g_activate_id <= cr_g_context_cnt) && "cr_idle: cr_g_activate_id out of bounds!\n" );
-        assert( ( cr_g_activate_id != this_id__ ) && "cr_idle: recursive coroutine call!\n" );
+		assert( ( cr_g_activate_id != CR_INVALID_ID ) && "cr_idle: cr_g_activate_id == CR_INVALID_ID!\n" );
+		assert( ( ( uint32_t ) cr_g_activate_id <= cr_g_context_cnt) && "cr_idle: cr_g_activate_id out of bounds!\n" );
+		assert( ( cr_g_activate_id != this_id__ ) && "cr_idle: recursive coroutine call!\n" );
 
-        temp_id             = cr_g_activate_id;
-        cr_g_activate_id    = CR_IDLE_THREAD_ID;
-        cr_g_previous_cr_id = CR_IDLE_THREAD_ID;
+		temp_id			= cr_g_activate_id;
+		cr_g_activate_id	= CR_IDLE_THREAD_ID;
+		cr_g_previous_cr_id	= CR_IDLE_THREAD_ID;
 
-        if ( !setjmp( cr_g_context[ CR_IDLE_THREAD_ID ].env ) ) {
-            longjmp( cr_g_context[ temp_id ].env, SETJMP_DFLT_RET_VAL );
-        } else {
-            /* explicit block for the longjmp */ ;
-        }
-    }
+		if ( !setjmp( cr_g_context[ CR_IDLE_THREAD_ID ].env ) ) {
+			longjmp( cr_g_context[ temp_id ].env, SETJMP_DFLT_RET_VAL );
+		} else {
+			/* explicit block for the longjmp */ ;
+		}
+	}
 }
 
 /** \brief Register a function as a coroutine thread
  *  \return The ID of the registered coroutine.
  *  \attention All coroutine thread registration must be completed before calling CR_START.
  */
-cr_id_t cr_register_thread( void ( *pFunc )( void ) )
-{
-    // Increase the coroutine count.
-    cr_g_thread_cnt += 1;
+cr_id_t cr_register_thread( void ( *pFunc )( void ) ) {
+	// Increase the coroutine count.
+	cr_g_thread_cnt += 1;
 
-    if ( cr_g_thread_cnt == CR_IDLE_THREAD_ID ) {
-        if ( pFunc != cr_idle ) {
-            perror( "cr_idle error: cr_g_thread_cnt != CR_IDLE_THREAD_ID. Note, coroutines shouldn't be registered prior to calling cr_init." );
-        }
-    }
+	if ( cr_g_thread_cnt == CR_IDLE_THREAD_ID ) {
+		if ( pFunc != cr_idle ) {
+			perror( "cr_idle error: cr_g_thread_cnt != CR_IDLE_THREAD_ID. Note, coroutines shouldn't be registered prior to calling cr_init." );
+		}
+	}
 
-    assert( pFunc && "cr_register_thread: pFunc is invalid!\n" );
+	assert( pFunc && "cr_register_thread: pFunc is invalid!\n" );
 
-    // Account fot the cr_idle coroutine (one reserved index in the array) in the assert check.
-    assert( ( cr_g_thread_cnt < cr_g_context_cnt) &&
-                "cr_register_thread: [ cr_g_thread_cnt < cr_g_context_cnt ] failed\n" );
+	// Account fot the cr_idle coroutine (one reserved index in the array) in the assert check.
+	assert( ( cr_g_thread_cnt < cr_g_context_cnt) &&
+		"cr_register_thread: [ cr_g_thread_cnt < cr_g_context_cnt ] failed\n" );
 
-    // Assign the coroutine's ID and function pointer to its context structure
-    cr_g_context[ cr_g_thread_cnt ].id    = cr_g_thread_cnt;
-    cr_g_context[ cr_g_thread_cnt ].pFunc = pFunc;
+	// Assign the coroutine's ID and function pointer to its context structure
+	cr_g_context[ cr_g_thread_cnt ].id	= cr_g_thread_cnt;
+	cr_g_context[ cr_g_thread_cnt ].pFunc	= pFunc;
 
-    // cr_g_current_cr_id is used by the CR_THREAD_INIT macro to identify
-    // the coroutine.
-    cr_g_current_cr_id = cr_g_thread_cnt;
+	// cr_g_current_cr_id is used by the CR_THREAD_INIT macro to identify
+	// the coroutine.
+	cr_g_current_cr_id = cr_g_thread_cnt;
 
-    if ( !setjmp( cr_g_reg_func_env ) ) {
-        pFunc( ); // this function won't return normally
-    } else {
-        /* explicit block for the longjmp */
-		;
-    }
+	if ( !setjmp( cr_g_reg_func_env ) ) {
+		pFunc( ); // this function won't return normally
+	} else {
+		/* explicit block for the longjmp */ ;
+	}
 
-    // The function is now a coroutine.
-    // This is where we return from CR_THREAD_INIT via the longjump.
+	// The function is now a coroutine.
+	// This is where we return from CR_THREAD_INIT via the longjump.
 
-    // A sentinal. At init the coroutine returned via a longjump so the return
-    // point saved in the function's prolog is valid and will return here
-    // should the coroutine actually return normally via the epilog code.
-    if ( cr_g_sys_started == CR_SYSTEM_STARTED ) {
-        // What to do?
-        // - nothing and return normally
-        // - yield to whatever is in cr_g_previous_cr_id
-        // - yield to cr_idle
-        // - assert
-        // - exit
+	// A sentinal. At init the coroutine returned via a longjump so the return
+	// point saved in the function's prolog is valid and will return here
+	// should the coroutine actually return normally via the epilog code.
+	if ( cr_g_sys_started == CR_SYSTEM_STARTED ) {
+		// What to do?
+		// - nothing and return normally
+		// - yield to whatever is in cr_g_previous_cr_id
+		// - yield to cr_idle
+		// - assert
+		// - exit
 
-        // Note, cr_g_current_cr_id holds the ID of the exiting coroutine.
-        // Note, cr_g_previous_cr_id holds the ID of the previous coroutine.
+		// Note, cr_g_current_cr_id holds the ID of the exiting coroutine.
+		// Note, cr_g_previous_cr_id holds the ID of the previous coroutine.
 
-        // Note, it's not possible to remove the exiting coroutine from the
-        // context array because the remaining coroutine ID's cannot be changed,
-        // a coroutine's ID is the index into the context array.
+		// Note, it's not possible to remove the exiting coroutine from the
+		// context array because the remaining coroutine ID's cannot be changed,
+		// a coroutine's ID is the index into the context array.
 
-        // Look at the cr_g_current_cr_id variable in a debugger to see the ID
-        // of the exiting coroutine.
-        assert( CR_ERROR_CR_EXITING && "cr_register_thread: coruotine exiting!\n" );
+		// Look at the cr_g_current_cr_id variable in a debugger to see the ID
+		// of the exiting coroutine.
+		assert( CR_ERROR_CR_EXITING && "cr_register_thread: coruotine exiting!\n" );
 
-        // Pass EXIT_SUCCESS; we want any user registered clean-up functions to be called.
-        exit( EXIT_SUCCESS );
-    }
+		// Pass EXIT_SUCCESS; we want any user registered clean-up functions to be called.
+		exit( EXIT_SUCCESS );
+	}
 
-    return cr_g_thread_cnt;
+	return cr_g_thread_cnt;
 }
 
 // end of file
 #include <assert.h>
 
 #ifdef __INTEL_COMPILER
-    // ICC - disable assert warning: "warning #279: controlling expression is constant"
-    #pragma warning (disable: 279)
+	// ICC - disable assert warning: "warning #279: controlling expression is constant"
+	#pragma warning (disable: 279)
 #endif
 
 /** \brief Coroutine variable typedefs
  *
  *  \note Local types _should_ include the volatile qualifier.
  */
-typedef int8_t      volatile 	cr_int8_t;
-typedef uint8_t     volatile 	cr_uint8_t;
-typedef int16_t     volatile 	cr_int16_t;
-typedef uint16_t    volatile 	cr_uint16_t;
-typedef int32_t     volatile 	cr_int32_t;
-typedef uint32_t    volatile 	cr_uint32_t;
-typedef int64_t     volatile 	cr_int64_t;
-typedef uint64_t    volatile 	cr_uint64_t;
+typedef int8_t		volatile	cr_int8_t;
+typedef uint8_t		volatile	cr_uint8_t;
+typedef int16_t		volatile	cr_int16_t;
+typedef uint16_t	volatile	cr_uint16_t;
+typedef int32_t		volatile	cr_int32_t;
+typedef uint32_t	volatile	cr_uint32_t;
+typedef int64_t		volatile	cr_int64_t;
+typedef uint64_t	volatile	cr_uint64_t;
 
 
 /** \brief Annonymous enumerations that define various states and settings.
  */
 enum {
-    SETJMP_DFLT_RET_VAL         =  1,                   /*!< longjmp's required second paramter, which is setjmp's return value */
-    CR_IDLE_THREAD_ID           =  0,                   /*!< ID of the system's cr_idle coroutine */
-    CR_SYSTEM_STARTED           = -1,                   /*!< Sentinal flag used internally */
-    CR_INVALID_ID               = -1,                   /*!< Returned by cr_get_id when an ID is not found */
-    CR_THREAD_CNT_INIT          = -1                    /*!< Internal initialization value */
+    SETJMP_DFLT_RET_VAL	=  1,	/*!< longjmp's required second paramter, which is setjmp's return value */
+    CR_IDLE_THREAD_ID		=  0,	/*!< ID of the system's cr_idle coroutine */
+    CR_SYSTEM_STARTED		= -1,	/*!< Sentinal flag used internally */
+    CR_INVALID_ID		= -1,	/*!< Returned by cr_get_id when an ID is not found */
+    CR_THREAD_CNT_INIT		= -1	/*!< Internal initialization value */
 };
 
 /** \brief Coroutine ID typedef
  *  Coroutine ID type used by the cr_lib system.
  *
  */
-typedef int32_t volatile 	cr_id_t;
+typedef int32_t volatile	cr_id_t;
 
 /** \brief Coroutine context information
  *
  *  \note The context array _must_ include 1 extra element for the system's cr_idle coroutine.
  */
 typedef struct CR_CONTEXT {
-    void        ( *pFunc )( void );
-    jmp_buf     env;
-    cr_id_t     id;
+	void		( *pFunc )( void );
+	jmp_buf		env;
+	cr_id_t		id;
 } CR_CONTEXT;
 
 /** \brief Initializes a function as a coroutine
  *  \attention This macro should be placed at the start of the function being
  *  registered as a coroutine. Also, a coroutine should never return normally.
  */
-#define CR_THREAD_INIT( )                                               \
-            static fenv_t envp;                                         \
-            static cr_id_t this_id__;                                   \
-            this_id__ = cr_g_current_cr_id;                             \
-            if ( !setjmp( cr_g_context[ this_id__ ].env ) ) {           \
-                fegetenv( &envp );                                      \
-                longjmp( cr_g_reg_func_env, SETJMP_DFLT_RET_VAL );      \
-            } else { fesetenv( &envp ); }
+#define CR_THREAD_INIT( )						\
+	static fenv_t envp;						\
+	static cr_id_t this_id__;					\
+	this_id__ = cr_g_current_cr_id;				\
+	if ( !setjmp( cr_g_context[ this_id__ ].env ) ) {		\
+		fegetenv( &envp );					\
+		longjmp( cr_g_reg_func_env, SETJMP_DFLT_RET_VAL );	\
+	} else { fesetenv( &envp ); }
 
 /** \brief Starts the cr_lib system
  *
  *  \hideinitializer
  *  \attention cr_init must have been called and coroutine registration completed
  */
-#define CR_START( func_name )                                                                                           \
-            cr_g_previous_cr_id = CR_INVALID_ID;                                                                        \
-            cr_g_current_cr_id = cr_get_id( func_name );                                                                \
-            assert( ( cr_g_current_cr_id != CR_INVALID_ID ) && "CR_START:  CR_INVALID_ID!\n" );                         \
-            assert( ( ( uint32_t ) cr_g_current_cr_id < cr_g_context_cnt ) && "CR_START: ID out of bounds!\n" );        \
-            cr_g_sys_started = CR_SYSTEM_STARTED;                                                                       \
-            longjmp( cr_g_context[ cr_g_current_cr_id ].env, SETJMP_DFLT_RET_VAL )
+#define CR_START( func_name )											\
+	cr_g_previous_cr_id = CR_INVALID_ID;									\
+	cr_g_current_cr_id = cr_get_id( func_name );								\
+	assert( ( cr_g_current_cr_id != CR_INVALID_ID ) && "CR_START:  CR_INVALID_ID!\n" );			\
+	assert( ( ( uint32_t ) cr_g_current_cr_id < cr_g_context_cnt ) && "CR_START: ID out of bounds!\n" );	\
+	cr_g_sys_started = CR_SYSTEM_STARTED;									\
+	longjmp( cr_g_context[ cr_g_current_cr_id ].env, SETJMP_DFLT_RET_VAL )
 
 /** \brief Explicitly yields to a coroutine
  *
  *  \param func_name the name of a user coroutine or cr_idle
  *  \hideinitializer
  */
-#define CR_YIELD( func_name )                                                                                   \
-            cr_g_current_cr_id = cr_get_id( func_name );                                                        \
-            assert( ( cr_g_current_cr_id != CR_INVALID_ID ) && "CR_YIELD: CR_INVALID_ID!\n" );                  \
-            assert( ( ( uint32_t ) cr_g_current_cr_id < cr_g_context_cnt) && "CR_YIELD: ID out of bounds!\n" ); \
-            assert( ( cr_g_current_cr_id != this_id__ ) && "CR_YIELD: recursive coroutine call!\n" );           \
-            cr_g_previous_cr_id = this_id__;                                                                    \
-            if ( !setjmp( cr_g_context[ this_id__ ].env ) ) {                                                   \
-                fegetenv( &envp );                                                                              \
-                longjmp( cr_g_context[ cr_g_current_cr_id ].env, SETJMP_DFLT_RET_VAL );                         \
-            } else { fesetenv( &envp ); }
+#define CR_YIELD( func_name )											\
+	cr_g_current_cr_id = cr_get_id( func_name );								\
+	assert( ( cr_g_current_cr_id != CR_INVALID_ID ) && "CR_YIELD: CR_INVALID_ID!\n" );			\
+	assert( ( ( uint32_t ) cr_g_current_cr_id < cr_g_context_cnt) && "CR_YIELD: ID out of bounds!\n" );	\
+	assert( ( cr_g_current_cr_id != this_id__ ) && "CR_YIELD: recursive coroutine call!\n" );		\
+	cr_g_previous_cr_id = this_id__;									\
+	if ( !setjmp( cr_g_context[ this_id__ ].env ) ) {							\
+		fegetenv( &envp );										\
+		longjmp( cr_g_context[ cr_g_current_cr_id ].env, SETJMP_DFLT_RET_VAL );			\
+	} else { fesetenv( &envp ); }
 
 
 
 extern "C" {
 #endif
 
-    /* Should _not_ be modified by the user. They're defined as extern because they're used in the macros. */
-    extern CR_CONTEXT*  cr_g_context;
-    extern uint32_t     cr_g_context_cnt;
-    extern int32_t      cr_g_sys_started;
-    extern cr_id_t      cr_g_previous_cr_id;
-    extern cr_id_t      cr_g_current_cr_id;
-    extern jmp_buf      cr_g_reg_func_env;
+	/* Should _not_ be modified by the user. They're defined as extern because they're used in the macros. */
+	extern CR_CONTEXT*	cr_g_context;
+	extern uint32_t		cr_g_context_cnt;
+	extern int32_t		cr_g_sys_started;
+	extern cr_id_t		cr_g_previous_cr_id;
+	extern cr_id_t		cr_g_current_cr_id;
+	extern jmp_buf		cr_g_reg_func_env;
 
-    /* Can be modified by the user. */
-    extern cr_id_t      cr_g_activate_id;
+	/* Can be modified by the user. */
+	extern cr_id_t		cr_g_activate_id;
 
-    /* User callable functions. */
-    extern void         cr_reset( void );
-    extern void         cr_init( CR_CONTEXT* cr_context, size_t cr_context_count );
-    extern cr_id_t      cr_get_id( void ( *pFunc )( void ) );
-    extern void         cr_idle( void );
-    extern cr_id_t      cr_register_thread( void ( *pFunc )( void ) );
+	/* User callable functions. */
+	extern void		cr_reset( void );
+	extern void		cr_init( CR_CONTEXT* cr_context, size_t cr_context_count );
+	extern cr_id_t		cr_get_id( void ( *pFunc )( void ) );
+	extern void		cr_idle( void );
+	extern cr_id_t		cr_register_thread( void ( *pFunc )( void ) );
 
 #ifdef __cplusplus
 }
  *  \brief User setable: set or unset the standard printf macro
  *
  */
-//#undef          NPRINTF
-#define         NPRINTF
+//#undef	NPRINTF
+#define	NPRINTF
 
 /** \def NDPRINTF
  *  \brief User setable: set or un-set the debug printf macro
  *
  */
-//#undef          NDPRINTF
-#define         NDPRINTF
+//#undef	NDPRINTF
+#define	NDPRINTF
 
 /** \def NEPRINTF
  *  \brief User setable: set or un-set the error printf macro
  *
  */
-//#undef          NEPRINTF
-#define         NEPRINTF
+//#undef	NEPRINTF
+#define	NEPRINTF
 
 // __func__ (C99) : The function where the printf is called
 // __LINE__ : The line where the printf is called
  *  \brief Standard printf macro with a variable number of arguments
  */
 #ifdef NPRINTF
-    #define PRINTF( fmt )
-    #define PRINTF_VA( fmt, ... )
+	#define PRINTF( fmt )
+	#define PRINTF_VA( fmt, ... )
 #else
-    #define PRINTF( fmt )                printf( fmt )
-    #define PRINTF_VA( fmt, ... )        printf( fmt, __VA_ARGS__ )
+	#define PRINTF( fmt )		printf( fmt )
+	#define PRINTF_VA( fmt, ... )	printf( fmt, __VA_ARGS__ )
 #endif
 
 /** \def DPRINTF
  *  \brief Debug printf macro with a variable number of arguments
  */
 #ifdef NDPRINTF
-    #define DPRINTF( fmt )
-    #define DPRINTF_VA( fmt, ... )
+	#define DPRINTF( fmt )
+	#define DPRINTF_VA( fmt, ... )
 #else
-    #define DPRINTF( fmt )                printf( "[%s:%s:%d] " fmt, __FILE__, __func__, __LINE__ )
-    #define DPRINTF_VA( fmt, ... )        printf( "[%s:%s:%d] " fmt, __FILE__, __func__, __LINE__, __VA_ARGS__ )
+	#define DPRINTF( fmt )		printf( "[%s:%s:%d] " fmt, __FILE__, __func__, __LINE__ )
+	#define DPRINTF_VA( fmt, ... )	printf( "[%s:%s:%d] " fmt, __FILE__, __func__, __LINE__, __VA_ARGS__ )
 #endif
 
 /** \def EPRINTF
  *  \brief Error printf macros with a variable number of arguments
  */
 #ifdef NEPRINTF
-    #define EPRINTF( fmt )
-    #define EPRINTF_VA( fmt, ... )
+	#define EPRINTF( fmt )
+	#define EPRINTF_VA( fmt, ... )
 #else
-    #define EPRINTF( fmt )                printf( "[%s:%s:%d] " fmt, __FILE__, __func__, __LINE__ )
-    #define EPRINTF_VA( fmt, ... )        printf( "[%s:%s:%d] " fmt, __FILE__, __func__, __LINE__, __VA_ARGS__ )
+	#define EPRINTF( fmt )		printf( "[%s:%s:%d] " fmt, __FILE__, __func__, __LINE__ )
+	#define EPRINTF_VA( fmt, ... )	printf( "[%s:%s:%d] " fmt, __FILE__, __func__, __LINE__, __VA_ARGS__ )
 #endif
 
 
 /*----------------------- Language Standards -----------------------------------
-- C89           __STDC__                                    ANSI X3.159-1989
-- C90           __STDC_VERSION__                            ISO/IEC 9899:1990
-- C94           __STDC_VERSION__        = 199409L           ISO/IEC 9899-1:1994
-- C99           __STDC_VERSION__        = 199901L           ISO/IEC 9899:1999
-- C++98         __cplusplus             = 199707L           ISO/IEC 14882:1998
-- C++/CLI       __cplusplus_cli         = 200406L           ECMA-372
-- EC++          __embedded_cplusplus                        Embedded C++
+- C89		__STDC__				ANSI X3.159-1989
+- C90		__STDC_VERSION__			ISO/IEC 9899:1990
+- C94		__STDC_VERSION__	= 199409L	ISO/IEC 9899-1:1994
+- C99		__STDC_VERSION__	= 199901L	ISO/IEC 9899:1999
+- C++98		__cplusplus		= 199707L	ISO/IEC 14882:1998
+- C++/CLI	__cplusplus_cli		= 200406L	ECMA-372
+- EC++	__embedded_cplusplus				Embedded C++
 ------------------------------------------------------------------------------*/
 // Note that not all compliant compilers provide the correct pre-defined macros.
 #ifdef __STDC__
-    #define PREDEF_STANDARD_C_1989
+	#define PREDEF_STANDARD_C_1989
 
-    #ifdef __STDC_VERSION__
-        #define PREDEF_STANDARD_C_1990
+	#ifdef __STDC_VERSION__
+		#define PREDEF_STANDARD_C_1990
 
-        #if ( __STDC_VERSION__ >= 199409L )
-            #define PREDEF_STANDARD_C_1994
-        #endif
+		#if ( __STDC_VERSION__ >= 199409L )
+			#define PREDEF_STANDARD_C_1994
+		#endif
 
-        #if ( __STDC_VERSION__ >= 199901L )
-            #define PREDEF_STANDARD_C_1999
-        #endif
-    #endif
+		#if ( __STDC_VERSION__ >= 199901L )
+			#define PREDEF_STANDARD_C_1999
+		#endif
+	#endif
 #endif
 
 #ifndef __cplusplus
-    #if !defined( __DMC__ ) && !defined( _MSC_VER )
-        #ifndef PREDEF_STANDARD_C_1999
-            #error "ISO C99 compiler is required for this code to compile"
-        #endif
-    #endif
+	#if !defined( __DMC__ ) && !defined( _MSC_VER )
+		#ifndef PREDEF_STANDARD_C_1999
+			#error "ISO C99 compiler is required for this code to compile"
+		#endif
+	#endif
 #endif
 
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 #ifdef __INTEL_COMPILER
-    #pragma warning (disable: 279)
+	#pragma warning (disable: 279)
 
-    // OS X
-    #ifdef __APPLE__
-        // none
-    #endif
+	// OS X
+	#ifdef __APPLE__
+		// none
+	#endif
 
-    // GNUC on *nix
-    #if !defined( __APPLE__ ) && defined( __GNUC__ )
-        #define restrict    __restrict
-        #define inline      __inline
-    #endif
+	// GNUC on *nix
+	#if !defined( __APPLE__ ) && defined( __GNUC__ )
+		#define restrict    __restrict
+		#define inline      __inline
+	#endif
 
-    // *MS VC++ with Intel compiler
-    #if defined( _MSC_VER ) && !defined( __APPLE__ ) && !defined( __GNUC__ )
-        #define alloca  _alloca
+	// *MS VC++ with Intel compiler
+	#if defined( _MSC_VER ) && !defined( __APPLE__ ) && !defined( __GNUC__ )
+		#define alloca  _alloca
 
-        #ifndef __cplusplus
-            #define inline  __inline
-        #endif
-    #endif
+		#ifndef __cplusplus
+			#define inline  __inline
+		#endif
+	#endif
 #endif
 
 // *MS VC++ only
 #if defined( _MSC_VER ) && !defined( __INTEL_COMPILER )
-    #ifndef __cplusplus
-        #define inline  __inline
-    #endif
+	#ifndef __cplusplus
+		#define inline  __inline
+	#endif
 
-    #define restrict    __restrict
+	#define restrict    __restrict
 #endif
 
 

doxygen/html/annotated.html

 <div class="navigation" id="top">
   <div class="tabs">
     <ul class="tablist">
-      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
+      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
       <li class="current"><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
       <li><a href="files.html"><span>Files</span></a></li>
       <li><a href="examples.html"><span>Examples</span></a></li>
   <tr><td class="indexkey"><a class="el" href="structtimespec.html">timespec</a></td><td class="indexvalue"></td></tr>
 </table>
 </div>
-<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 25 2010 09:38:58 for cr_lib by&nbsp;
+<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 25 2010 10:41:01 for cr_lib by&nbsp;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
 </body>

doxygen/html/classes.html

 <div class="navigation" id="top">
   <div class="tabs">
     <ul class="tablist">
-      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
+      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
       <li class="current"><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
       <li><a href="files.html"><span>Files</span></a></li>
       <li><a href="examples.html"><span>Examples</span></a></li>
 </td><td><a name="letter_T"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&nbsp;&nbsp;T&nbsp;&nbsp;</div></td></tr></table>
 </td></tr><tr><td><a class="el" href="struct_c_r___c_o_n_t_e_x_t.html">CR_CONTEXT</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structpthread__once__t__.html">pthread_once_t_</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structptw32__handle__t.html">ptw32_handle_t</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structsched__param.html">sched_param</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structtimespec.html">timespec</a>&nbsp;&nbsp;&nbsp;</td></tr></table><div class="qindex"><a class="qindex" href="#letter_C">C</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_P">P</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_S">S</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_T">T</a></div>
 </div>
-<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 25 2010 09:38:58 for cr_lib by&nbsp;
+<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 25 2010 10:41:01 for cr_lib by&nbsp;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
 </body>

doxygen/html/cr_8c.html

 <div class="navigation" id="top">
   <div class="tabs">
     <ul class="tablist">
-      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
+      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
       <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
       <li class="current"><a href="files.html"><span>Files</span></a></li>
       <li><a href="examples.html"><span>Examples</span></a></li>
 <code>#include &lt;signal.h&gt;</code><br/>
 <code>#include &quot;<a class="el" href="cr__config_8h_source.html">cr_config.h</a>&quot;</code><br/>
 <code>#include &quot;<a class="el" href="cr_8h_source.html">cr.h</a>&quot;</code><br/>
+<div class="dynheader">
+Include dependency graph for cr.c:</div>
+<div class="dyncontent">
+<div class="center"><img src="cr_8c__incl.png" border="0" usemap="#cr_8c" alt=""/></div>
+<map name="cr_8c" id="cr_8c">
+</map>
+</div>
 
 <p><a href="cr_8c_source.html">Go to the source code of this file.</a></p>
 <table class="memberdecls">
 </dd>
 </dl>
 
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00155">155</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00150">150</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
 
 </div>
 </div>
 </dl>
 <dl><dt><b>Examples: </b></dt><dd><a class="el" href="demo__2_8c-example.html#a2">demo_2.c</a>, and <a class="el" href="demo__4_8c-example.html#a3">demo_4.c</a>.</dd>
 </dl>
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00203">203</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00198">198</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
 
 </div>
 </div>
 <dl class="attention"><dt><b>Attention:</b></dt><dd>This coroutine thread must be explicitly called for it to run. </dd></dl>
 <dl><dt><b>Examples: </b></dt><dd><a class="el" href="demo__2_8c-example.html#a5">demo_2.c</a>, and <a class="el" href="demo__4_8c-example.html#a7">demo_4.c</a>.</dd>
 </dl>
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00270">270</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00261">261</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+
+<p><div class="dynheader">
+Here is the caller graph for this function:</div>
+<div class="dyncontent">
+<div class="center"><img src="cr_8c_accd73b48023970380bfdecb56483976c_icgraph.png" border="0" usemap="#cr_8c_accd73b48023970380bfdecb56483976c_icgraph" alt=""/></div>
+<map name="cr_8c_accd73b48023970380bfdecb56483976c_icgraph" id="cr_8c_accd73b48023970380bfdecb56483976c_icgraph">
+</map>
+</div>
+</p>
 
 </div>
 </div>
 <dl class="attention"><dt><b>Attention:</b></dt><dd>This initialization function must be the first function called in the library. </dd></dl>
 <dl><dt><b>Examples: </b></dt><dd><a class="el" href="demo__1_8c-example.html#a4">demo_1.c</a>, <a class="el" href="demo__2_8c-example.html#a8">demo_2.c</a>, <a class="el" href="demo__3_8c-example.html#a4">demo_3.c</a>, and <a class="el" href="demo__4_8c-example.html#a10">demo_4.c</a>.</dd>
 </dl>
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00245">245</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00238">238</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+
+<p><div class="dynheader">
+Here is the call graph for this function:</div>
+<div class="dyncontent">
+<div class="center"><img src="cr_8c_aca6b87323f9ce0bf21b3f06209a97989_cgraph.png" border="0" usemap="#cr_8c_aca6b87323f9ce0bf21b3f06209a97989_cgraph" alt=""/></div>
+<map name="cr_8c_aca6b87323f9ce0bf21b3f06209a97989_cgraph" id="cr_8c_aca6b87323f9ce0bf21b3f06209a97989_cgraph">
+</map>
+</div>
+</p>
 
 </div>
 </div>
 <dl class="attention"><dt><b>Attention:</b></dt><dd>All coroutine thread registration must be completed before calling CR_START. </dd></dl>
 <dl><dt><b>Examples: </b></dt><dd><a class="el" href="demo__1_8c-example.html#a5">demo_1.c</a>, <a class="el" href="demo__2_8c-example.html#a9">demo_2.c</a>, <a class="el" href="demo__3_8c-example.html#a5">demo_3.c</a>, and <a class="el" href="demo__4_8c-example.html#a11">demo_4.c</a>.</dd>
 </dl>
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00317">317</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00307">307</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+
+<p><div class="dynheader">
+Here is the call graph for this function:</div>
+<div class="dyncontent">
+<div class="center"><img src="cr_8c_ae30bdb4ef569c0678e4cb49829f11bbb_cgraph.png" border="0" usemap="#cr_8c_ae30bdb4ef569c0678e4cb49829f11bbb_cgraph" alt=""/></div>
+<map name="cr_8c_ae30bdb4ef569c0678e4cb49829f11bbb_cgraph" id="cr_8c_ae30bdb4ef569c0678e4cb49829f11bbb_cgraph">
+</map>
+</div>
+</p>
+
+<p><div class="dynheader">
+Here is the caller graph for this function:</div>
+<div class="dyncontent">
+<div class="center"><img src="cr_8c_ae30bdb4ef569c0678e4cb49829f11bbb_icgraph.png" border="0" usemap="#cr_8c_ae30bdb4ef569c0678e4cb49829f11bbb_icgraph" alt=""/></div>
+<map name="cr_8c_ae30bdb4ef569c0678e4cb49829f11bbb_icgraph" id="cr_8c_ae30bdb4ef569c0678e4cb49829f11bbb_icgraph">
+</map>
+</div>
+</p>
 
 </div>
 </div>
 <p>This function sets all the system's global variables to their original state. </p>
 <dl><dt><b>Examples: </b></dt><dd><a class="el" href="demo__1_8c-example.html#a2">demo_1.c</a>, <a class="el" href="demo__2_8c-example.html#a6">demo_2.c</a>, <a class="el" href="demo__3_8c-example.html#a2">demo_3.c</a>, and <a class="el" href="demo__4_8c-example.html#a8">demo_4.c</a>.</dd>
 </dl>
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00225">225</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00219">219</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
 
 </div>
 </div>
 <p>Pointer to the user defined array of coroutine contexts. </p>
 <dl class="note"><dt><b>Note:</b></dt><dd>For internal use only. </dd></dl>
 
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00164">164</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00159">159</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
 
 </div>
 </div>
 <p>The number of elements in the coroutine context array. </p>
 <dl class="note"><dt><b>Note:</b></dt><dd>For internal use only. </dd></dl>
 
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00169">169</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00164">164</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
 
 </div>
 </div>
 <p>The ID of the coroutine that's active. </p>
 <dl class="note"><dt><b>Note:</b></dt><dd>For internal use only. </dd></dl>
 
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00183">183</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00178">178</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
 
 </div>
 </div>
 <p>The ID of the previously active coroutine. </p>
 <dl class="note"><dt><b>Note:</b></dt><dd>For internal use only. </dd></dl>
 
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00188">188</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00183">183</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
 
 </div>
 </div>
 <p>Flag that's set when CR_START is called. </p>
 <dl class="note"><dt><b>Note:</b></dt><dd>For internal use only. </dd></dl>
 
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00178">178</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00173">173</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
 
 </div>
 </div>
 </div>
-<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 25 2010 09:38:58 for cr_lib by&nbsp;
+<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 25 2010 10:41:01 for cr_lib by&nbsp;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
 </body>

doxygen/html/cr_8c_source.html

 <div class="navigation" id="top">
   <div class="tabs">
     <ul class="tablist">
-      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
+      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
       <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
       <li class="current"><a href="files.html"><span>Files</span></a></li>
       <li><a href="examples.html"><span>Examples</span></a></li>
 <a name="l00024"></a>00024 <span class="preprocessor">#include &quot;<a class="code" href="cr__config_8h.html">cr_config.h</a>&quot;</span>
 <a name="l00025"></a>00025 <span class="preprocessor">#include &quot;<a class="code" href="cr_8h.html">cr.h</a>&quot;</span>
 <a name="l00026"></a>00026 
-<a name="l00155"></a>00155 <span class="keyword">enum</span> {
-<a name="l00156"></a><a class="code" href="cr_8c.html#a06fc87d81c62e9abb8790b6e5713c55ba84eb6a791d344cea4fadd2638f7b460e">00156</a>     <a class="code" href="cr_8c.html#a06fc87d81c62e9abb8790b6e5713c55ba84eb6a791d344cea4fadd2638f7b460e">CR_ERROR_CR_EXITING</a> = 0 
-<a name="l00157"></a>00157 };
-<a name="l00158"></a>00158 
-<a name="l00159"></a>00159 jmp_buf                 cr_g_reg_func_env;
+<a name="l00150"></a>00150 <span class="keyword">enum</span> {
+<a name="l00151"></a><a class="code" href="cr_8c.html#a06fc87d81c62e9abb8790b6e5713c55ba84eb6a791d344cea4fadd2638f7b460e">00151</a>   <a class="code" href="cr_8c.html#a06fc87d81c62e9abb8790b6e5713c55ba84eb6a791d344cea4fadd2638f7b460e">CR_ERROR_CR_EXITING</a> = 0 
+<a name="l00152"></a>00152 };
+<a name="l00153"></a>00153 
+<a name="l00154"></a>00154 jmp_buf     cr_g_reg_func_env;
+<a name="l00155"></a>00155 
+<a name="l00159"></a><a class="code" href="cr_8h.html#a22841ff791649abd0bcb62392ebb9778">00159</a> <a class="code" href="struct_c_r___c_o_n_t_e_x_t.html" title="Coroutine context information.">CR_CONTEXT</a>*   <a class="code" href="cr_8c.html#a22841ff791649abd0bcb62392ebb9778" title="Pointer to the user defined array of coroutine contexts.">cr_g_context</a>    = 0;
 <a name="l00160"></a>00160 
-<a name="l00164"></a><a class="code" href="cr_8h.html#a22841ff791649abd0bcb62392ebb9778">00164</a> <a class="code" href="struct_c_r___c_o_n_t_e_x_t.html" title="Coroutine context information.">CR_CONTEXT</a>*             <a class="code" href="cr_8c.html#a22841ff791649abd0bcb62392ebb9778" title="Pointer to the user defined array of coroutine contexts.">cr_g_context</a>        = 0;
+<a name="l00164"></a><a class="code" href="cr_8h.html#a8238e77b653b2cc4905373b805fc3567">00164</a> uint32_t    <a class="code" href="cr_8c.html#a8238e77b653b2cc4905373b805fc3567" title="The number of elements in the coroutine context array.">cr_g_context_cnt</a>  = 0;
 <a name="l00165"></a>00165 
-<a name="l00169"></a><a class="code" href="cr_8h.html#a8238e77b653b2cc4905373b805fc3567">00169</a> uint32_t                <a class="code" href="cr_8c.html#a8238e77b653b2cc4905373b805fc3567" title="The number of elements in the coroutine context array.">cr_g_context_cnt</a>    = 0;
-<a name="l00170"></a>00170 
-<a name="l00173"></a><a class="code" href="cr_8h.html#a1345c6db4d2d1d939e7841da46704d8e">00173</a> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>                 <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a>    = CR_IDLE_THREAD_ID;
+<a name="l00168"></a><a class="code" href="cr_8h.html#a1345c6db4d2d1d939e7841da46704d8e">00168</a> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>     <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a>  = CR_IDLE_THREAD_ID;
+<a name="l00169"></a>00169 
+<a name="l00173"></a><a class="code" href="cr_8h.html#a00999e3368c59592db0c069abf1f1296">00173</a> int32_t     <a class="code" href="cr_8c.html#a00999e3368c59592db0c069abf1f1296" title="Flag that&amp;#39;s set when CR_START is called.">cr_g_sys_started</a>  = <span class="keyword">false</span>;
 <a name="l00174"></a>00174 
-<a name="l00178"></a><a class="code" href="cr_8h.html#a00999e3368c59592db0c069abf1f1296">00178</a> int32_t                 <a class="code" href="cr_8c.html#a00999e3368c59592db0c069abf1f1296" title="Flag that&amp;#39;s set when CR_START is called.">cr_g_sys_started</a>    = <span class="keyword">false</span>;
+<a name="l00178"></a><a class="code" href="cr_8h.html#acf4ab64c8de56045d84e53b65dba7eb8">00178</a> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>     <a class="code" href="cr_8c.html#acf4ab64c8de56045d84e53b65dba7eb8" title="The ID of the coroutine that&amp;#39;s active.">cr_g_current_cr_id</a>  = CR_IDLE_THREAD_ID;
 <a name="l00179"></a>00179 
-<a name="l00183"></a><a class="code" href="cr_8h.html#acf4ab64c8de56045d84e53b65dba7eb8">00183</a> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>                 <a class="code" href="cr_8c.html#acf4ab64c8de56045d84e53b65dba7eb8" title="The ID of the coroutine that&amp;#39;s active.">cr_g_current_cr_id</a>  = CR_IDLE_THREAD_ID;
+<a name="l00183"></a><a class="code" href="cr_8h.html#ae7e93574baec3ae2b083c7f36916fbbd">00183</a> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>     <a class="code" href="cr_8c.html#ae7e93574baec3ae2b083c7f36916fbbd" title="The ID of the previously active coroutine.">cr_g_previous_cr_id</a> = CR_IDLE_THREAD_ID;
 <a name="l00184"></a>00184 
-<a name="l00188"></a><a class="code" href="cr_8h.html#ae7e93574baec3ae2b083c7f36916fbbd">00188</a> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>                 <a class="code" href="cr_8c.html#ae7e93574baec3ae2b083c7f36916fbbd" title="The ID of the previously active coroutine.">cr_g_previous_cr_id</a>  = CR_IDLE_THREAD_ID;
+<a name="l00188"></a>00188 <span class="keyword">static</span> int32_t    cr_g_thread_cnt   = CR_THREAD_CNT_INIT;
 <a name="l00189"></a>00189 
-<a name="l00193"></a>00193 <span class="keyword">static</span> int32_t          cr_g_thread_cnt      = CR_THREAD_CNT_INIT;
-<a name="l00194"></a>00194 
-<a name="l00203"></a><a class="code" href="cr_8h.html#a3e7a31163658d81c9473e5b637d9eb90">00203</a> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a> <a class="code" href="cr_8c.html#a3e7a31163658d81c9473e5b637d9eb90" title="Find the ID of a coroutine.">cr_get_id</a>( <span class="keywordtype">void</span> ( *pFunc )( <span class="keywordtype">void</span> ) )
-<a name="l00204"></a>00204 {
-<a name="l00205"></a>00205     int32_t i;
-<a name="l00206"></a>00206     <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a> <span class="keywordtype">id</span> = CR_INVALID_ID;
-<a name="l00207"></a>00207 
-<a name="l00208"></a>00208     <span class="keywordflow">for</span> ( i = 0; i &lt;= cr_g_thread_cnt; i++ ) {
-<a name="l00209"></a>00209         <span class="keywordflow">if</span> ( cr_g_context[ i ].pFunc == pFunc ) {
-<a name="l00210"></a>00210             <span class="keywordtype">id</span> = i;
-<a name="l00211"></a>00211             <span class="keywordflow">break</span>;
-<a name="l00212"></a>00212         }
-<a name="l00213"></a>00213     }
+<a name="l00198"></a><a class="code" href="cr_8h.html#a3e7a31163658d81c9473e5b637d9eb90">00198</a> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a> <a class="code" href="cr_8c.html#a3e7a31163658d81c9473e5b637d9eb90" title="Find the ID of a coroutine.">cr_get_id</a>( <span class="keywordtype">void</span> ( *pFunc )( <span class="keywordtype">void</span> ) ) {
+<a name="l00199"></a>00199   int32_t i;
+<a name="l00200"></a>00200   <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a> <span class="keywordtype">id</span> = CR_INVALID_ID;
+<a name="l00201"></a>00201 
+<a name="l00202"></a>00202   <span class="keywordflow">for</span> ( i = 0; i &lt;= cr_g_thread_cnt; i++ ) {
+<a name="l00203"></a>00203     <span class="keywordflow">if</span> ( cr_g_context[ i ].pFunc == pFunc ) {
+<a name="l00204"></a>00204       <span class="keywordtype">id</span> = i;
+<a name="l00205"></a>00205       <span class="keywordflow">break</span>;
+<a name="l00206"></a>00206     }
+<a name="l00207"></a>00207   }
+<a name="l00208"></a>00208 
+<a name="l00209"></a>00209 <span class="comment">//  printf( &quot;cr_get_id pFunc: 0x%X\n&quot;, pFunc );</span>
+<a name="l00210"></a>00210 <span class="comment">//  printf( &quot;cr_get_id id: %d\n&quot;, id );</span>
+<a name="l00211"></a>00211 
+<a name="l00212"></a>00212   <span class="keywordflow">return</span> id;
+<a name="l00213"></a>00213 }
 <a name="l00214"></a>00214 
-<a name="l00215"></a>00215 <span class="comment">//    printf( &quot;cr_get_id pFunc: 0x%X\n&quot;, pFunc );</span>
-<a name="l00216"></a>00216 <span class="comment">//    printf( &quot;cr_get_id id: %d\n&quot;, id );</span>
-<a name="l00217"></a>00217 
-<a name="l00218"></a>00218     <span class="keywordflow">return</span> id;
-<a name="l00219"></a>00219 }
-<a name="l00220"></a>00220 
-<a name="l00225"></a><a class="code" href="cr_8h.html#a3e8d6963f6ee2cc49502186eca21d879">00225</a> <span class="keywordtype">void</span> <a class="code" href="cr_8c.html#a3e8d6963f6ee2cc49502186eca21d879" title="Resets the system to an initial state.">cr_reset</a>( <span class="keywordtype">void</span> )
-<a name="l00226"></a>00226 {
-<a name="l00227"></a>00227     cr_g_context        = 0;
-<a name="l00228"></a>00228     <a class="code" href="cr_8c.html#a8238e77b653b2cc4905373b805fc3567" title="The number of elements in the coroutine context array.">cr_g_context_cnt</a>    = 0;
-<a name="l00229"></a>00229     cr_g_thread_cnt     = CR_THREAD_CNT_INIT;
-<a name="l00230"></a>00230     <a class="code" href="cr_8c.html#ae7e93574baec3ae2b083c7f36916fbbd" title="The ID of the previously active coroutine.">cr_g_previous_cr_id</a> = CR_INVALID_ID;
-<a name="l00231"></a>00231     <a class="code" href="cr_8c.html#acf4ab64c8de56045d84e53b65dba7eb8" title="The ID of the coroutine that&amp;#39;s active.">cr_g_current_cr_id</a>  = CR_INVALID_ID;
-<a name="l00232"></a>00232     <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a>    = CR_IDLE_THREAD_ID;
-<a name="l00233"></a>00233     <a class="code" href="cr_8c.html#a00999e3368c59592db0c069abf1f1296" title="Flag that&amp;#39;s set when CR_START is called.">cr_g_sys_started</a>    = <span class="keyword">false</span>;
-<a name="l00234"></a>00234 }
-<a name="l00235"></a>00235 
-<a name="l00245"></a><a class="code" href="cr_8h.html#aca6b87323f9ce0bf21b3f06209a97989">00245</a> <span class="keywordtype">void</span> <a class="code" href="cr_8c.html#aca6b87323f9ce0bf21b3f06209a97989" title="cr_lib&amp;#39;s initialization function.">cr_init</a>( <a class="code" href="struct_c_r___c_o_n_t_e_x_t.html" title="Coroutine context information.">CR_CONTEXT</a>*    cr_context,
-<a name="l00246"></a>00246               <span class="keywordtype">size_t</span>         cr_context_count )
-<a name="l00247"></a>00247 {
-<a name="l00248"></a>00248     <span class="comment">// Init the array of CR_CONTEXT structs as well as the globals.</span>
-<a name="l00249"></a>00249     assert( cr_context &amp;&amp; <span class="stringliteral">&quot;user param cr_context must be non-zero!\n&quot;</span> );
-<a name="l00250"></a>00250     assert( ( cr_context_count &gt; 0 ) &amp;&amp; <span class="stringliteral">&quot;user param cr_context_count must be non-zero!\n&quot;</span> );
+<a name="l00219"></a><a class="code" href="cr_8h.html#a3e8d6963f6ee2cc49502186eca21d879">00219</a> <span class="keywordtype">void</span> <a class="code" href="cr_8c.html#a3e8d6963f6ee2cc49502186eca21d879" title="Resets the system to an initial state.">cr_reset</a>( <span class="keywordtype">void</span> ) {
+<a name="l00220"></a>00220   cr_g_context    = 0;
+<a name="l00221"></a>00221   <a class="code" href="cr_8c.html#a8238e77b653b2cc4905373b805fc3567" title="The number of elements in the coroutine context array.">cr_g_context_cnt</a>  = 0;
+<a name="l00222"></a>00222   cr_g_thread_cnt   = CR_THREAD_CNT_INIT;
+<a name="l00223"></a>00223   <a class="code" href="cr_8c.html#ae7e93574baec3ae2b083c7f36916fbbd" title="The ID of the previously active coroutine.">cr_g_previous_cr_id</a> = CR_INVALID_ID;
+<a name="l00224"></a>00224   <a class="code" href="cr_8c.html#acf4ab64c8de56045d84e53b65dba7eb8" title="The ID of the coroutine that&amp;#39;s active.">cr_g_current_cr_id</a>  = CR_INVALID_ID;
+<a name="l00225"></a>00225   <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a>  = CR_IDLE_THREAD_ID;
+<a name="l00226"></a>00226   <a class="code" href="cr_8c.html#a00999e3368c59592db0c069abf1f1296" title="Flag that&amp;#39;s set when CR_START is called.">cr_g_sys_started</a>  = <span class="keyword">false</span>;
+<a name="l00227"></a>00227 }
+<a name="l00228"></a>00228 
+<a name="l00238"></a><a class="code" href="cr_8h.html#aca6b87323f9ce0bf21b3f06209a97989">00238</a> <span class="keywordtype">void</span> <a class="code" href="cr_8c.html#aca6b87323f9ce0bf21b3f06209a97989" title="cr_lib&amp;#39;s initialization function.">cr_init</a>( <a class="code" href="struct_c_r___c_o_n_t_e_x_t.html" title="Coroutine context information.">CR_CONTEXT</a>* cr_context, <span class="keywordtype">size_t</span> cr_context_count ) {
+<a name="l00239"></a>00239   <span class="comment">// Init the array of CR_CONTEXT structs as well as the globals.</span>
+<a name="l00240"></a>00240   assert( cr_context &amp;&amp; <span class="stringliteral">&quot;user param cr_context must be non-zero!\n&quot;</span> );
+<a name="l00241"></a>00241   assert( ( cr_context_count &gt; 0 ) &amp;&amp; <span class="stringliteral">&quot;user param cr_context_count must be non-zero!\n&quot;</span> );
+<a name="l00242"></a>00242 
+<a name="l00243"></a>00243   memset( cr_context, 0, cr_context_count * <span class="keyword">sizeof</span>( <a class="code" href="struct_c_r___c_o_n_t_e_x_t.html" title="Coroutine context information.">CR_CONTEXT</a> ) );
+<a name="l00244"></a>00244 
+<a name="l00245"></a>00245   cr_g_context    = cr_context;
+<a name="l00246"></a>00246   <a class="code" href="cr_8c.html#a8238e77b653b2cc4905373b805fc3567" title="The number of elements in the coroutine context array.">cr_g_context_cnt</a>  = ( uint32_t ) cr_context_count;
+<a name="l00247"></a>00247 
+<a name="l00248"></a>00248   <span class="comment">// Register the idle thread, which should _always_ be the first coroutine registered.</span>
+<a name="l00249"></a>00249   <a class="code" href="cr_8c.html#ae30bdb4ef569c0678e4cb49829f11bbb" title="Register a function as a coroutine thread.">cr_register_thread</a>( <a class="code" href="cr_8c.html#accd73b48023970380bfdecb56483976c" title="The internal system&amp;#39;s coroutine thread.">cr_idle</a> );
+<a name="l00250"></a>00250 }
 <a name="l00251"></a>00251 
-<a name="l00252"></a>00252     memset( cr_context, 0, cr_context_count * <span class="keyword">sizeof</span>( <a class="code" href="struct_c_r___c_o_n_t_e_x_t.html" title="Coroutine context information.">CR_CONTEXT</a> ) );
-<a name="l00253"></a>00253 
-<a name="l00254"></a>00254     cr_g_context        = cr_context;
-<a name="l00255"></a>00255     <a class="code" href="cr_8c.html#a8238e77b653b2cc4905373b805fc3567" title="The number of elements in the coroutine context array.">cr_g_context_cnt</a>    = ( uint32_t ) cr_context_count;
-<a name="l00256"></a>00256 
-<a name="l00257"></a>00257     <span class="comment">// Register the idle thread, which should _always_ be the first coroutine registered.</span>
-<a name="l00258"></a>00258     <a class="code" href="cr_8c.html#ae30bdb4ef569c0678e4cb49829f11bbb" title="Register a function as a coroutine thread.">cr_register_thread</a>( <a class="code" href="cr_8c.html#accd73b48023970380bfdecb56483976c" title="The internal system&amp;#39;s coroutine thread.">cr_idle</a> );
-<a name="l00259"></a>00259 }
-<a name="l00260"></a>00260 
-<a name="l00270"></a><a class="code" href="cr_8h.html#accd73b48023970380bfdecb56483976c">00270</a> <span class="keywordtype">void</span> <a class="code" href="cr_8c.html#accd73b48023970380bfdecb56483976c" title="The internal system&amp;#39;s coroutine thread.">cr_idle</a>( <span class="keywordtype">void</span> )
-<a name="l00271"></a>00271 {
-<a name="l00272"></a>00272     <span class="comment">// This needs to be static because the function initially returns normally.</span>
-<a name="l00273"></a>00273     <span class="keyword">static</span> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a> temp_id;
-<a name="l00274"></a>00274 
-<a name="l00275"></a>00275     <a class="code" href="cr_8h.html#ac68ef77f5ea5f5dda5a2f046a2c96429" title="Initializes a function as a coroutine.">CR_THREAD_INIT</a>( );
+<a name="l00261"></a><a class="code" href="cr_8h.html#accd73b48023970380bfdecb56483976c">00261</a> <span class="keywordtype">void</span> <a class="code" href="cr_8c.html#accd73b48023970380bfdecb56483976c" title="The internal system&amp;#39;s coroutine thread.">cr_idle</a>( <span class="keywordtype">void</span> ) {
+<a name="l00262"></a>00262   <span class="comment">// This needs to be static because the function initially returns normally.</span>
+<a name="l00263"></a>00263   <span class="keyword">static</span> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a> temp_id;
+<a name="l00264"></a>00264 
+<a name="l00265"></a>00265   <a class="code" href="cr_8h.html#ac68ef77f5ea5f5dda5a2f046a2c96429" title="Initializes a function as a coroutine.">CR_THREAD_INIT</a>( );
+<a name="l00266"></a>00266 
+<a name="l00267"></a>00267   assert( ( this_id__ == <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a60cd04d936d5d89f7468cf9f5240a487">CR_IDLE_THREAD_ID</a> ) &amp;&amp; <span class="stringliteral">&quot;cr_idle: this_id__ != CR_IDLE_THREAD_ID!\n&quot;</span> );
+<a name="l00268"></a>00268 
+<a name="l00269"></a>00269   <span class="comment">// This will be the entry point when longjump is called with cr_idle&#39;s context.</span>
+<a name="l00270"></a>00270   <span class="comment">// No need to perform another setjmp from within the loop; not much happening.</span>
+<a name="l00271"></a>00271   <span class="keywordflow">for</span> ( ; ; ) {
+<a name="l00272"></a>00272     <span class="comment">// Spin until a non-idle thread is activated.</span>
+<a name="l00273"></a>00273     <span class="keywordflow">if</span> ( <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a> == <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a60cd04d936d5d89f7468cf9f5240a487">CR_IDLE_THREAD_ID</a> ) {
+<a name="l00274"></a>00274       <span class="keywordflow">continue</span>;
+<a name="l00275"></a>00275     }
 <a name="l00276"></a>00276 
-<a name="l00277"></a>00277     assert( ( this_id__ == <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a60cd04d936d5d89f7468cf9f5240a487">CR_IDLE_THREAD_ID</a> ) &amp;&amp; <span class="stringliteral">&quot;cr_idle: this_id__ != CR_IDLE_THREAD_ID!\n&quot;</span> );
-<a name="l00278"></a>00278 
-<a name="l00279"></a>00279     <span class="comment">// This will be the entry point when longjump is called with cr_idle&#39;s context.</span>
-<a name="l00280"></a>00280     <span class="comment">// No need to perform another setjmp from within the loop; not much happening.</span>
-<a name="l00281"></a>00281     <span class="keywordflow">for</span> ( ; ; ) {
-<a name="l00282"></a>00282         <span class="comment">// Spin until a non-idle thread is activated.</span>
-<a name="l00283"></a>00283         <span class="keywordflow">if</span> ( <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a> == <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a60cd04d936d5d89f7468cf9f5240a487">CR_IDLE_THREAD_ID</a> ) {
-<a name="l00284"></a>00284             <span class="keywordflow">continue</span>;
-<a name="l00285"></a>00285         }
-<a name="l00286"></a>00286 
-<a name="l00287"></a>00287         assert( ( <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a> != <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7acd063e5de520275d94952e07b5f29b18">CR_INVALID_ID</a> ) &amp;&amp; <span class="stringliteral">&quot;cr_idle: cr_g_activate_id == CR_INVALID_ID!\n&quot;</span> );
-<a name="l00288"></a>00288         assert( ( ( uint32_t ) <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a> &lt;= <a class="code" href="cr_8c.html#a8238e77b653b2cc4905373b805fc3567" title="The number of elements in the coroutine context array.">cr_g_context_cnt</a>) &amp;&amp; <span class="stringliteral">&quot;cr_idle: cr_g_activate_id out of bounds!\n&quot;</span> );
-<a name="l00289"></a>00289         assert( ( <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a> != this_id__ ) &amp;&amp; <span class="stringliteral">&quot;cr_idle: recursive coroutine call!\n&quot;</span> );
-<a name="l00290"></a>00290 
-<a name="l00291"></a>00291         temp_id             = <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a>;
-<a name="l00292"></a>00292         <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a>    = CR_IDLE_THREAD_ID;
-<a name="l00293"></a>00293         <a class="code" href="cr_8c.html#ae7e93574baec3ae2b083c7f36916fbbd" title="The ID of the previously active coroutine.">cr_g_previous_cr_id</a> = CR_IDLE_THREAD_ID;
-<a name="l00294"></a>00294 
-<a name="l00295"></a>00295         <span class="keywordflow">if</span> ( !setjmp( cr_g_context[ <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a60cd04d936d5d89f7468cf9f5240a487">CR_IDLE_THREAD_ID</a> ].env ) ) {
-<a name="l00296"></a>00296             longjmp( cr_g_context[ temp_id ].env, <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a7f396d7461f79cb150ed6b69934f58ec">SETJMP_DFLT_RET_VAL</a> );
-<a name="l00297"></a>00297         } <span class="keywordflow">else</span> {
-<a name="l00298"></a>00298             <span class="comment">/* explicit block for the longjmp */</span> ;
-<a name="l00299"></a>00299         }
-<a name="l00300"></a>00300     }
-<a name="l00301"></a>00301 }
-<a name="l00302"></a>00302 
-<a name="l00317"></a><a class="code" href="cr_8h.html#ae30bdb4ef569c0678e4cb49829f11bbb">00317</a> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a> <a class="code" href="cr_8c.html#ae30bdb4ef569c0678e4cb49829f11bbb" title="Register a function as a coroutine thread.">cr_register_thread</a>( <span class="keywordtype">void</span> ( *pFunc )( <span class="keywordtype">void</span> ) )
-<a name="l00318"></a>00318 {
-<a name="l00319"></a>00319     <span class="comment">// Increase the coroutine count.</span>
-<a name="l00320"></a>00320     cr_g_thread_cnt += 1;
-<a name="l00321"></a>00321 
-<a name="l00322"></a>00322     <span class="keywordflow">if</span> ( cr_g_thread_cnt == <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a60cd04d936d5d89f7468cf9f5240a487">CR_IDLE_THREAD_ID</a> ) {
-<a name="l00323"></a>00323         <span class="keywordflow">if</span> ( pFunc != <a class="code" href="cr_8c.html#accd73b48023970380bfdecb56483976c" title="The internal system&amp;#39;s coroutine thread.">cr_idle</a> ) {
-<a name="l00324"></a>00324             perror( <span class="stringliteral">&quot;cr_idle error: cr_g_thread_cnt != CR_IDLE_THREAD_ID. Note, coroutines shouldn&#39;t be registered prior to calling cr_init.&quot;</span> );
-<a name="l00325"></a>00325         }
-<a name="l00326"></a>00326     }
-<a name="l00327"></a>00327 
-<a name="l00328"></a>00328     assert( pFunc &amp;&amp; <span class="stringliteral">&quot;cr_register_thread: pFunc is invalid!\n&quot;</span> );
-<a name="l00329"></a>00329 
-<a name="l00330"></a>00330     <span class="comment">// Account fot the cr_idle coroutine (one reserved index in the array) in the assert check.</span>
-<a name="l00331"></a>00331     assert( ( cr_g_thread_cnt &lt; <a class="code" href="cr_8c.html#a8238e77b653b2cc4905373b805fc3567" title="The number of elements in the coroutine context array.">cr_g_context_cnt</a>) &amp;&amp;
-<a name="l00332"></a>00332                 <span class="stringliteral">&quot;cr_register_thread: [ cr_g_thread_cnt &lt; cr_g_context_cnt ] failed\n&quot;</span> );
-<a name="l00333"></a>00333 
-<a name="l00334"></a>00334     <span class="comment">// Assign the coroutine&#39;s ID and function pointer to its context structure</span>
-<a name="l00335"></a>00335     cr_g_context[ cr_g_thread_cnt ].id    = cr_g_thread_cnt;
-<a name="l00336"></a>00336     cr_g_context[ cr_g_thread_cnt ].pFunc = pFunc;
-<a name="l00337"></a>00337 
-<a name="l00338"></a>00338     <span class="comment">// cr_g_current_cr_id is used by the CR_THREAD_INIT macro to identify</span>
-<a name="l00339"></a>00339     <span class="comment">// the coroutine.</span>
-<a name="l00340"></a>00340     <a class="code" href="cr_8c.html#acf4ab64c8de56045d84e53b65dba7eb8" title="The ID of the coroutine that&amp;#39;s active.">cr_g_current_cr_id</a> = cr_g_thread_cnt;
-<a name="l00341"></a>00341 
-<a name="l00342"></a>00342     <span class="keywordflow">if</span> ( !setjmp( cr_g_reg_func_env ) ) {
-<a name="l00343"></a>00343         pFunc( ); <span class="comment">// this function won&#39;t return normally</span>
-<a name="l00344"></a>00344     } <span class="keywordflow">else</span> {
-<a name="l00345"></a>00345         <span class="comment">/* explicit block for the longjmp */</span>
-<a name="l00346"></a>00346     ;
-<a name="l00347"></a>00347     }
-<a name="l00348"></a>00348 
-<a name="l00349"></a>00349     <span class="comment">// The function is now a coroutine.</span>
-<a name="l00350"></a>00350     <span class="comment">// This is where we return from CR_THREAD_INIT via the longjump.</span>
-<a name="l00351"></a>00351 
-<a name="l00352"></a>00352     <span class="comment">// A sentinal. At init the coroutine returned via a longjump so the return</span>
-<a name="l00353"></a>00353     <span class="comment">// point saved in the function&#39;s prolog is valid and will return here</span>
-<a name="l00354"></a>00354     <span class="comment">// should the coroutine actually return normally via the epilog code.</span>
-<a name="l00355"></a>00355     <span class="keywordflow">if</span> ( <a class="code" href="cr_8c.html#a00999e3368c59592db0c069abf1f1296" title="Flag that&amp;#39;s set when CR_START is called.">cr_g_sys_started</a> == <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a01288475e3cc36707461f9b757d00e74">CR_SYSTEM_STARTED</a> ) {
-<a name="l00356"></a>00356         <span class="comment">// What to do?</span>
-<a name="l00357"></a>00357         <span class="comment">// - nothing and return normally</span>
-<a name="l00358"></a>00358         <span class="comment">// - yield to whatever is in cr_g_previous_cr_id</span>
-<a name="l00359"></a>00359         <span class="comment">// - yield to cr_idle</span>
-<a name="l00360"></a>00360         <span class="comment">// - assert</span>
-<a name="l00361"></a>00361         <span class="comment">// - exit</span>
-<a name="l00362"></a>00362 
-<a name="l00363"></a>00363         <span class="comment">// Note, cr_g_current_cr_id holds the ID of the exiting coroutine.</span>
-<a name="l00364"></a>00364         <span class="comment">// Note, cr_g_previous_cr_id holds the ID of the previous coroutine.</span>
+<a name="l00277"></a>00277     assert( ( <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a> != <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7acd063e5de520275d94952e07b5f29b18">CR_INVALID_ID</a> ) &amp;&amp; <span class="stringliteral">&quot;cr_idle: cr_g_activate_id == CR_INVALID_ID!\n&quot;</span> );
+<a name="l00278"></a>00278     assert( ( ( uint32_t ) <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a> &lt;= <a class="code" href="cr_8c.html#a8238e77b653b2cc4905373b805fc3567" title="The number of elements in the coroutine context array.">cr_g_context_cnt</a>) &amp;&amp; <span class="stringliteral">&quot;cr_idle: cr_g_activate_id out of bounds!\n&quot;</span> );
+<a name="l00279"></a>00279     assert( ( <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a> != this_id__ ) &amp;&amp; <span class="stringliteral">&quot;cr_idle: recursive coroutine call!\n&quot;</span> );
+<a name="l00280"></a>00280 
+<a name="l00281"></a>00281     temp_id     = <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a>;
+<a name="l00282"></a>00282     <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a>  = CR_IDLE_THREAD_ID;
+<a name="l00283"></a>00283     <a class="code" href="cr_8c.html#ae7e93574baec3ae2b083c7f36916fbbd" title="The ID of the previously active coroutine.">cr_g_previous_cr_id</a> = CR_IDLE_THREAD_ID;
+<a name="l00284"></a>00284 
+<a name="l00285"></a>00285     <span class="keywordflow">if</span> ( !setjmp( cr_g_context[ <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a60cd04d936d5d89f7468cf9f5240a487">CR_IDLE_THREAD_ID</a> ].env ) ) {
+<a name="l00286"></a>00286       longjmp( cr_g_context[ temp_id ].env, <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a7f396d7461f79cb150ed6b69934f58ec">SETJMP_DFLT_RET_VAL</a> );
+<a name="l00287"></a>00287     } <span class="keywordflow">else</span> {
+<a name="l00288"></a>00288       <span class="comment">/* explicit block for the longjmp */</span> ;
+<a name="l00289"></a>00289     }
+<a name="l00290"></a>00290   }
+<a name="l00291"></a>00291 }
+<a name="l00292"></a>00292 
+<a name="l00307"></a><a class="code" href="cr_8h.html#ae30bdb4ef569c0678e4cb49829f11bbb">00307</a> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a> <a class="code" href="cr_8c.html#ae30bdb4ef569c0678e4cb49829f11bbb" title="Register a function as a coroutine thread.">cr_register_thread</a>( <span class="keywordtype">void</span> ( *pFunc )( <span class="keywordtype">void</span> ) ) {
+<a name="l00308"></a>00308   <span class="comment">// Increase the coroutine count.</span>
+<a name="l00309"></a>00309   cr_g_thread_cnt += 1;
+<a name="l00310"></a>00310 
+<a name="l00311"></a>00311   <span class="keywordflow">if</span> ( cr_g_thread_cnt == <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a60cd04d936d5d89f7468cf9f5240a487">CR_IDLE_THREAD_ID</a> ) {
+<a name="l00312"></a>00312     <span class="keywordflow">if</span> ( pFunc != <a class="code" href="cr_8c.html#accd73b48023970380bfdecb56483976c" title="The internal system&amp;#39;s coroutine thread.">cr_idle</a> ) {
+<a name="l00313"></a>00313       perror( <span class="stringliteral">&quot;cr_idle error: cr_g_thread_cnt != CR_IDLE_THREAD_ID. Note, coroutines shouldn&#39;t be registered prior to calling cr_init.&quot;</span> );
+<a name="l00314"></a>00314     }
+<a name="l00315"></a>00315   }
+<a name="l00316"></a>00316 
+<a name="l00317"></a>00317   assert( pFunc &amp;&amp; <span class="stringliteral">&quot;cr_register_thread: pFunc is invalid!\n&quot;</span> );
+<a name="l00318"></a>00318 
+<a name="l00319"></a>00319   <span class="comment">// Account fot the cr_idle coroutine (one reserved index in the array) in the assert check.</span>
+<a name="l00320"></a>00320   assert( ( cr_g_thread_cnt &lt; <a class="code" href="cr_8c.html#a8238e77b653b2cc4905373b805fc3567" title="The number of elements in the coroutine context array.">cr_g_context_cnt</a>) &amp;&amp;
+<a name="l00321"></a>00321     <span class="stringliteral">&quot;cr_register_thread: [ cr_g_thread_cnt &lt; cr_g_context_cnt ] failed\n&quot;</span> );
+<a name="l00322"></a>00322 
+<a name="l00323"></a>00323   <span class="comment">// Assign the coroutine&#39;s ID and function pointer to its context structure</span>
+<a name="l00324"></a>00324   cr_g_context[ cr_g_thread_cnt ].id  = cr_g_thread_cnt;
+<a name="l00325"></a>00325   cr_g_context[ cr_g_thread_cnt ].pFunc = pFunc;
+<a name="l00326"></a>00326 
+<a name="l00327"></a>00327   <span class="comment">// cr_g_current_cr_id is used by the CR_THREAD_INIT macro to identify</span>
+<a name="l00328"></a>00328   <span class="comment">// the coroutine.</span>
+<a name="l00329"></a>00329   <a class="code" href="cr_8c.html#acf4ab64c8de56045d84e53b65dba7eb8" title="The ID of the coroutine that&amp;#39;s active.">cr_g_current_cr_id</a> = cr_g_thread_cnt;
+<a name="l00330"></a>00330 
+<a name="l00331"></a>00331   <span class="keywordflow">if</span> ( !setjmp( cr_g_reg_func_env ) ) {
+<a name="l00332"></a>00332     pFunc( ); <span class="comment">// this function won&#39;t return normally</span>
+<a name="l00333"></a>00333   } <span class="keywordflow">else</span> {
+<a name="l00334"></a>00334     <span class="comment">/* explicit block for the longjmp */</span> ;
+<a name="l00335"></a>00335   }
+<a name="l00336"></a>00336 
+<a name="l00337"></a>00337   <span class="comment">// The function is now a coroutine.</span>
+<a name="l00338"></a>00338   <span class="comment">// This is where we return from CR_THREAD_INIT via the longjump.</span>
+<a name="l00339"></a>00339 
+<a name="l00340"></a>00340   <span class="comment">// A sentinal. At init the coroutine returned via a longjump so the return</span>
+<a name="l00341"></a>00341   <span class="comment">// point saved in the function&#39;s prolog is valid and will return here</span>
+<a name="l00342"></a>00342   <span class="comment">// should the coroutine actually return normally via the epilog code.</span>
+<a name="l00343"></a>00343   <span class="keywordflow">if</span> ( <a class="code" href="cr_8c.html#a00999e3368c59592db0c069abf1f1296" title="Flag that&amp;#39;s set when CR_START is called.">cr_g_sys_started</a> == <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a01288475e3cc36707461f9b757d00e74">CR_SYSTEM_STARTED</a> ) {
+<a name="l00344"></a>00344     <span class="comment">// What to do?</span>
+<a name="l00345"></a>00345     <span class="comment">// - nothing and return normally</span>
+<a name="l00346"></a>00346     <span class="comment">// - yield to whatever is in cr_g_previous_cr_id</span>
+<a name="l00347"></a>00347     <span class="comment">// - yield to cr_idle</span>
+<a name="l00348"></a>00348     <span class="comment">// - assert</span>
+<a name="l00349"></a>00349     <span class="comment">// - exit</span>
+<a name="l00350"></a>00350 
+<a name="l00351"></a>00351     <span class="comment">// Note, cr_g_current_cr_id holds the ID of the exiting coroutine.</span>
+<a name="l00352"></a>00352     <span class="comment">// Note, cr_g_previous_cr_id holds the ID of the previous coroutine.</span>
+<a name="l00353"></a>00353 
+<a name="l00354"></a>00354     <span class="comment">// Note, it&#39;s not possible to remove the exiting coroutine from the</span>
+<a name="l00355"></a>00355     <span class="comment">// context array because the remaining coroutine ID&#39;s cannot be changed,</span>
+<a name="l00356"></a>00356     <span class="comment">// a coroutine&#39;s ID is the index into the context array.</span>
+<a name="l00357"></a>00357 
+<a name="l00358"></a>00358     <span class="comment">// Look at the cr_g_current_cr_id variable in a debugger to see the ID</span>
+<a name="l00359"></a>00359     <span class="comment">// of the exiting coroutine.</span>
+<a name="l00360"></a>00360     assert( <a class="code" href="cr_8c.html#a06fc87d81c62e9abb8790b6e5713c55ba84eb6a791d344cea4fadd2638f7b460e">CR_ERROR_CR_EXITING</a> &amp;&amp; <span class="stringliteral">&quot;cr_register_thread: coruotine exiting!\n&quot;</span> );
+<a name="l00361"></a>00361 
+<a name="l00362"></a>00362     <span class="comment">// Pass EXIT_SUCCESS; we want any user registered clean-up functions to be called.</span>
+<a name="l00363"></a>00363     exit( EXIT_SUCCESS );
+<a name="l00364"></a>00364   }
 <a name="l00365"></a>00365 
-<a name="l00366"></a>00366         <span class="comment">// Note, it&#39;s not possible to remove the exiting coroutine from the</span>
-<a name="l00367"></a>00367         <span class="comment">// context array because the remaining coroutine ID&#39;s cannot be changed,</span>
-<a name="l00368"></a>00368         <span class="comment">// a coroutine&#39;s ID is the index into the context array.</span>
-<a name="l00369"></a>00369 
-<a name="l00370"></a>00370         <span class="comment">// Look at the cr_g_current_cr_id variable in a debugger to see the ID</span>
-<a name="l00371"></a>00371         <span class="comment">// of the exiting coroutine.</span>
-<a name="l00372"></a>00372         assert( <a class="code" href="cr_8c.html#a06fc87d81c62e9abb8790b6e5713c55ba84eb6a791d344cea4fadd2638f7b460e">CR_ERROR_CR_EXITING</a> &amp;&amp; <span class="stringliteral">&quot;cr_register_thread: coruotine exiting!\n&quot;</span> );
-<a name="l00373"></a>00373 
-<a name="l00374"></a>00374         <span class="comment">// Pass EXIT_SUCCESS; we want any user registered clean-up functions to be called.</span>
-<a name="l00375"></a>00375         exit( EXIT_SUCCESS );
-<a name="l00376"></a>00376     }
-<a name="l00377"></a>00377 
-<a name="l00378"></a>00378     <span class="keywordflow">return</span> cr_g_thread_cnt;
-<a name="l00379"></a>00379 }
-<a name="l00380"></a>00380 
-<a name="l00381"></a>00381 <span class="comment">// end of file</span>
+<a name="l00366"></a>00366   <span class="keywordflow">return</span> cr_g_thread_cnt;
+<a name="l00367"></a>00367 }
+<a name="l00368"></a>00368 
+<a name="l00369"></a>00369 <span class="comment">// end of file</span>
 </pre></div></div>
 </div>
-<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 25 2010 09:38:58 for cr_lib by&nbsp;
+<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 25 2010 10:41:01 for cr_lib by&nbsp;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
 </body>

doxygen/html/cr_8h.html

 <div class="navigation" id="top">
   <div class="tabs">
     <ul class="tablist">
-      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
+      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
       <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
       <li class="current"><a href="files.html"><span>Files</span></a></li>
       <li><a href="examples.html"><span>Examples</span></a></li>
 <code>#include &lt;stdbool.h&gt;</code><br/>
 <code>#include &lt;fenv.h&gt;</code><br/>
 <code>#include &lt;assert.h&gt;</code><br/>
+<div class="dynheader">
+Include dependency graph for cr.h:</div>
+<div class="dyncontent">
+<div class="center"><img src="cr_8h__incl.png" border="0" usemap="#cr_8h" alt=""/></div>
+<map name="cr_8h" id="cr_8h">
+</map>
+</div>
+<div class="dynheader">
+This graph shows which files directly or indirectly include this file:</div>
+<div class="dyncontent">
+<div class="center"><img src="cr_8h__dep__incl.png" border="0" usemap="#cr_8hdep" alt=""/></div>
+<map name="cr_8hdep" id="cr_8hdep">
+</map>
+</div>
 
 <p><a href="cr_8h_source.html">Go to the source code of this file.</a></p>
 <table class="memberdecls">
   </dd>
 </dl>
 
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00203">203</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00198">198</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
 
 </div>
 </div>
 <p>This coroutine thread is used in conjunction with the cr_g_activate_id variable. cr_g_activate_id can be set to a coroutine's ID, e.g. in an ISR handler, and this function will activate the coroutine. This will work only if this function is explicitly called via CR_YIELD.</p>
 <dl class="attention"><dt><b>Attention:</b></dt><dd>This coroutine thread must be explicitly called for it to run. </dd></dl>
 
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00270">270</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00261">261</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+
+<p><div class="dynheader">
+Here is the caller graph for this function:</div>
+<div class="dyncontent">
+<div class="center"><img src="cr_8h_accd73b48023970380bfdecb56483976c_icgraph.png" border="0" usemap="#cr_8h_accd73b48023970380bfdecb56483976c_icgraph" alt=""/></div>
+<map name="cr_8h_accd73b48023970380bfdecb56483976c_icgraph" id="cr_8h_accd73b48023970380bfdecb56483976c_icgraph">
+</map>
+</div>
+</p>
 
 </div>
 </div>
 </dl>
 <dl class="attention"><dt><b>Attention:</b></dt><dd>This initialization function must be the first function called in the library. </dd></dl>
 
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00245">245</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00238">238</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+
+<p><div class="dynheader">
+Here is the call graph for this function:</div>
+<div class="dyncontent">
+<div class="center"><img src="cr_8h_aca6b87323f9ce0bf21b3f06209a97989_cgraph.png" border="0" usemap="#cr_8h_aca6b87323f9ce0bf21b3f06209a97989_cgraph" alt=""/></div>
+<map name="cr_8h_aca6b87323f9ce0bf21b3f06209a97989_cgraph" id="cr_8h_aca6b87323f9ce0bf21b3f06209a97989_cgraph">
+</map>
+</div>
+</p>
 
 </div>
 </div>
 <dl class="return"><dt><b>Returns:</b></dt><dd>The ID of the registered coroutine. </dd></dl>
 <dl class="attention"><dt><b>Attention:</b></dt><dd>All coroutine thread registration must be completed before calling CR_START. </dd></dl>
 
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00317">317</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00307">307</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+
+<p><div class="dynheader">
+Here is the call graph for this function:</div>
+<div class="dyncontent">
+<div class="center"><img src="cr_8h_ae30bdb4ef569c0678e4cb49829f11bbb_cgraph.png" border="0" usemap="#cr_8h_ae30bdb4ef569c0678e4cb49829f11bbb_cgraph" alt=""/></div>
+<map name="cr_8h_ae30bdb4ef569c0678e4cb49829f11bbb_cgraph" id="cr_8h_ae30bdb4ef569c0678e4cb49829f11bbb_cgraph">
+</map>
+</div>
+</p>
+
+<p><div class="dynheader">
+Here is the caller graph for this function:</div>
+<div class="dyncontent">
+<div class="center"><img src="cr_8h_ae30bdb4ef569c0678e4cb49829f11bbb_icgraph.png" border="0" usemap="#cr_8h_ae30bdb4ef569c0678e4cb49829f11bbb_icgraph" alt=""/></div>
+<map name="cr_8h_ae30bdb4ef569c0678e4cb49829f11bbb_icgraph" id="cr_8h_ae30bdb4ef569c0678e4cb49829f11bbb_icgraph">
+</map>
+</div>
+</p>
 
 </div>
 </div>
 <p>Resets the system to an initial state. </p>
 <p>This function sets all the system's global variables to their original state. </p>
 
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00225">225</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00219">219</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
 
 </div>
 </div>
 <p>Pointer to the user defined array of coroutine contexts. </p>
 <dl class="note"><dt><b>Note:</b></dt><dd>For internal use only. </dd></dl>
 
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00164">164</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00159">159</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
 
 </div>
 </div>
 <p>The number of elements in the coroutine context array. </p>
 <dl class="note"><dt><b>Note:</b></dt><dd>For internal use only. </dd></dl>
 
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00169">169</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00164">164</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
 
 </div>
 </div>
 <p>The ID of the coroutine that's active. </p>
 <dl class="note"><dt><b>Note:</b></dt><dd>For internal use only. </dd></dl>
 
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00183">183</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00178">178</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
 
 </div>
 </div>
 <p>The ID of the previously active coroutine. </p>
 <dl class="note"><dt><b>Note:</b></dt><dd>For internal use only. </dd></dl>
 
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00188">188</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00183">183</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
 
 </div>
 </div>
 <p>Flag that's set when CR_START is called. </p>
 <dl class="note"><dt><b>Note:</b></dt><dd>For internal use only. </dd></dl>
 
-<p>Definition at line <a class="el" href="cr_8c_source.html#l00178">178</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
+<p>Definition at line <a class="el" href="cr_8c_source.html#l00173">173</a> of file <a class="el" href="cr_8c_source.html">cr.c</a>.</p>
 
 </div>
 </div>
 </div>
-<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 25 2010 09:38:58 for cr_lib by&nbsp;
+<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 25 2010 10:41:01 for cr_lib by&nbsp;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
 </body>

doxygen/html/cr_8h_source.html

 <div class="navigation" id="top">
   <div class="tabs">
     <ul class="tablist">
-      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
+      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
       <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
       <li class="current"><a href="files.html"><span>Files</span></a></li>
       <li><a href="examples.html"><span>Examples</span></a></li>
 <a name="l00025"></a>00025 <span class="preprocessor">#include &lt;assert.h&gt;</span>
 <a name="l00026"></a>00026 
 <a name="l00027"></a>00027 <span class="preprocessor">#ifdef __INTEL_COMPILER</span>
-<a name="l00028"></a>00028 <span class="preprocessor"></span>    <span class="comment">// ICC - disable assert warning: &quot;warning #279: controlling expression is constant&quot;</span>
-<a name="l00029"></a>00029 <span class="preprocessor">    #pragma warning (disable: 279)</span>
+<a name="l00028"></a>00028 <span class="preprocessor"></span>  <span class="comment">// ICC - disable assert warning: &quot;warning #279: controlling expression is constant&quot;</span>
+<a name="l00029"></a>00029 <span class="preprocessor">  #pragma warning (disable: 279)</span>
 <a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
 <a name="l00031"></a>00031 <span class="preprocessor"></span>
-<a name="l00038"></a><a class="code" href="cr_8h.html#aa058fade3e44aea5c2098896835e47fc">00038</a> <span class="keyword">typedef</span> int8_t      <span class="keyword">volatile</span>  cr_int8_t;
-<a name="l00039"></a>00039 <span class="keyword">typedef</span> uint8_t     <span class="keyword">volatile</span>  cr_uint8_t;
-<a name="l00040"></a>00040 <span class="keyword">typedef</span> int16_t     <span class="keyword">volatile</span>  cr_int16_t;
-<a name="l00041"></a>00041 <span class="keyword">typedef</span> uint16_t    <span class="keyword">volatile</span>  cr_uint16_t;
-<a name="l00042"></a>00042 <span class="keyword">typedef</span> int32_t     <span class="keyword">volatile</span>  cr_int32_t;
-<a name="l00043"></a>00043 <span class="keyword">typedef</span> uint32_t    <span class="keyword">volatile</span>  cr_uint32_t;
-<a name="l00044"></a>00044 <span class="keyword">typedef</span> int64_t     <span class="keyword">volatile</span>  cr_int64_t;
-<a name="l00045"></a>00045 <span class="keyword">typedef</span> uint64_t    <span class="keyword">volatile</span>  cr_uint64_t;
+<a name="l00038"></a><a class="code" href="cr_8h.html#aa058fade3e44aea5c2098896835e47fc">00038</a> <span class="keyword">typedef</span> int8_t    <span class="keyword">volatile</span>  cr_int8_t;
+<a name="l00039"></a>00039 <span class="keyword">typedef</span> uint8_t   <span class="keyword">volatile</span>  cr_uint8_t;
+<a name="l00040"></a>00040 <span class="keyword">typedef</span> int16_t   <span class="keyword">volatile</span>  cr_int16_t;
+<a name="l00041"></a>00041 <span class="keyword">typedef</span> uint16_t  <span class="keyword">volatile</span>  cr_uint16_t;
+<a name="l00042"></a>00042 <span class="keyword">typedef</span> int32_t   <span class="keyword">volatile</span>  cr_int32_t;
+<a name="l00043"></a>00043 <span class="keyword">typedef</span> uint32_t  <span class="keyword">volatile</span>  cr_uint32_t;
+<a name="l00044"></a>00044 <span class="keyword">typedef</span> int64_t   <span class="keyword">volatile</span>  cr_int64_t;
+<a name="l00045"></a>00045 <span class="keyword">typedef</span> uint64_t  <span class="keyword">volatile</span>  cr_uint64_t;
 <a name="l00046"></a>00046 
 <a name="l00047"></a>00047 
 <a name="l00050"></a>00050 <span class="keyword">enum</span> {
-<a name="l00051"></a><a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a7f396d7461f79cb150ed6b69934f58ec">00051</a>     <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a7f396d7461f79cb150ed6b69934f58ec">SETJMP_DFLT_RET_VAL</a>         =  1,                   
-<a name="l00052"></a><a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a60cd04d936d5d89f7468cf9f5240a487">00052</a>     <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a60cd04d936d5d89f7468cf9f5240a487">CR_IDLE_THREAD_ID</a>           =  0,                   
-<a name="l00053"></a><a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a01288475e3cc36707461f9b757d00e74">00053</a>     <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a01288475e3cc36707461f9b757d00e74">CR_SYSTEM_STARTED</a>           = -1,                   
-<a name="l00054"></a><a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7acd063e5de520275d94952e07b5f29b18">00054</a>     <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7acd063e5de520275d94952e07b5f29b18">CR_INVALID_ID</a>               = -1,                   
-<a name="l00055"></a><a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a139db075566e7ab9f59a9de7f6d2359f">00055</a>     <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a139db075566e7ab9f59a9de7f6d2359f">CR_THREAD_CNT_INIT</a>          = -1                    
+<a name="l00051"></a><a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a7f396d7461f79cb150ed6b69934f58ec">00051</a>     <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a7f396d7461f79cb150ed6b69934f58ec">SETJMP_DFLT_RET_VAL</a> =  1, 
+<a name="l00052"></a><a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a60cd04d936d5d89f7468cf9f5240a487">00052</a>     <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a60cd04d936d5d89f7468cf9f5240a487">CR_IDLE_THREAD_ID</a>   =  0, 
+<a name="l00053"></a><a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a01288475e3cc36707461f9b757d00e74">00053</a>     <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a01288475e3cc36707461f9b757d00e74">CR_SYSTEM_STARTED</a>   = -1, 
+<a name="l00054"></a><a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7acd063e5de520275d94952e07b5f29b18">00054</a>     <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7acd063e5de520275d94952e07b5f29b18">CR_INVALID_ID</a>   = -1, 
+<a name="l00055"></a><a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a139db075566e7ab9f59a9de7f6d2359f">00055</a>     <a class="code" href="cr_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a139db075566e7ab9f59a9de7f6d2359f">CR_THREAD_CNT_INIT</a>    = -1  
 <a name="l00056"></a>00056 };
 <a name="l00057"></a>00057 
 <a name="l00063"></a><a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186">00063</a> <span class="keyword">typedef</span> int32_t <span class="keyword">volatile</span>  cr_id_t;
 <a name="l00064"></a>00064 
 <a name="l00071"></a><a class="code" href="struct_c_r___c_o_n_t_e_x_t.html">00071</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_c_r___c_o_n_t_e_x_t.html" title="Coroutine context information.">CR_CONTEXT</a> {
-<a name="l00072"></a>00072     void        ( *pFunc )( void );
-<a name="l00073"></a>00073     jmp_buf     env;
-<a name="l00074"></a>00074     <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>     id;
+<a name="l00072"></a>00072   void    ( *pFunc )( void );
+<a name="l00073"></a>00073   jmp_buf   env;
+<a name="l00074"></a>00074   <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>   id;
 <a name="l00075"></a>00075 } <a class="code" href="struct_c_r___c_o_n_t_e_x_t.html" title="Coroutine context information.">CR_CONTEXT</a>;
 <a name="l00076"></a>00076 
-<a name="l00090"></a><a class="code" href="cr_8h.html#ac68ef77f5ea5f5dda5a2f046a2c96429">00090</a> <span class="preprocessor">#define CR_THREAD_INIT( )                                               \</span>
-<a name="l00091"></a>00091 <span class="preprocessor">            static fenv_t envp;                                         \</span>
-<a name="l00092"></a>00092 <span class="preprocessor">            static cr_id_t this_id__;                                   \</span>
-<a name="l00093"></a>00093 <span class="preprocessor">            this_id__ = cr_g_current_cr_id;                             \</span>
-<a name="l00094"></a>00094 <span class="preprocessor">            if ( !setjmp( cr_g_context[ this_id__ ].env ) ) {           \</span>
-<a name="l00095"></a>00095 <span class="preprocessor">                fegetenv( &amp;envp );                                      \</span>
-<a name="l00096"></a>00096 <span class="preprocessor">                longjmp( cr_g_reg_func_env, SETJMP_DFLT_RET_VAL );      \</span>
-<a name="l00097"></a>00097 <span class="preprocessor">            } else { fesetenv( &amp;envp ); }</span>
+<a name="l00090"></a><a class="code" href="cr_8h.html#ac68ef77f5ea5f5dda5a2f046a2c96429">00090</a> <span class="preprocessor">#define CR_THREAD_INIT( )           \</span>
+<a name="l00091"></a>00091 <span class="preprocessor">  static fenv_t envp;           \</span>
+<a name="l00092"></a>00092 <span class="preprocessor">  static cr_id_t this_id__;         \</span>
+<a name="l00093"></a>00093 <span class="preprocessor">  this_id__ = cr_g_current_cr_id;       \</span>
+<a name="l00094"></a>00094 <span class="preprocessor">  if ( !setjmp( cr_g_context[ this_id__ ].env ) ) {   \</span>
+<a name="l00095"></a>00095 <span class="preprocessor">    fegetenv( &amp;envp );          \</span>
+<a name="l00096"></a>00096 <span class="preprocessor">    longjmp( cr_g_reg_func_env, SETJMP_DFLT_RET_VAL );  \</span>
+<a name="l00097"></a>00097 <span class="preprocessor">  } else { fesetenv( &amp;envp ); }</span>
 <a name="l00098"></a>00098 <span class="preprocessor"></span>
-<a name="l00108"></a><a class="code" href="cr_8h.html#ad89b832374912ca6c097b550a95a8ebf">00108</a> <span class="preprocessor">#define CR_START( func_name )                                                                                           \</span>
-<a name="l00109"></a>00109 <span class="preprocessor">            cr_g_previous_cr_id = CR_INVALID_ID;                                                                        \</span>
-<a name="l00110"></a>00110 <span class="preprocessor">            cr_g_current_cr_id = cr_get_id( func_name );                                                                \</span>
-<a name="l00111"></a>00111 <span class="preprocessor">            assert( ( cr_g_current_cr_id != CR_INVALID_ID ) &amp;&amp; &quot;CR_START:  CR_INVALID_ID!\n&quot; );                         \</span>
-<a name="l00112"></a>00112 <span class="preprocessor">            assert( ( ( uint32_t ) cr_g_current_cr_id &lt; cr_g_context_cnt ) &amp;&amp; &quot;CR_START: ID out of bounds!\n&quot; );        \</span>
-<a name="l00113"></a>00113 <span class="preprocessor">            cr_g_sys_started = CR_SYSTEM_STARTED;                                                                       \</span>
-<a name="l00114"></a>00114 <span class="preprocessor">            longjmp( cr_g_context[ cr_g_current_cr_id ].env, SETJMP_DFLT_RET_VAL )</span>
+<a name="l00108"></a><a class="code" href="cr_8h.html#ad89b832374912ca6c097b550a95a8ebf">00108</a> <span class="preprocessor">#define CR_START( func_name )                     \</span>
+<a name="l00109"></a>00109 <span class="preprocessor">  cr_g_previous_cr_id = CR_INVALID_ID;                  \</span>
+<a name="l00110"></a>00110 <span class="preprocessor">  cr_g_current_cr_id = cr_get_id( func_name );                \</span>
+<a name="l00111"></a>00111 <span class="preprocessor">  assert( ( cr_g_current_cr_id != CR_INVALID_ID ) &amp;&amp; &quot;CR_START:  CR_INVALID_ID!\n&quot; );     \</span>
+<a name="l00112"></a>00112 <span class="preprocessor">  assert( ( ( uint32_t ) cr_g_current_cr_id &lt; cr_g_context_cnt ) &amp;&amp; &quot;CR_START: ID out of bounds!\n&quot; );  \</span>
+<a name="l00113"></a>00113 <span class="preprocessor">  cr_g_sys_started = CR_SYSTEM_STARTED;                 \</span>
+<a name="l00114"></a>00114 <span class="preprocessor">  longjmp( cr_g_context[ cr_g_current_cr_id ].env, SETJMP_DFLT_RET_VAL )</span>
 <a name="l00115"></a>00115 <span class="preprocessor"></span>
-<a name="l00124"></a><a class="code" href="cr_8h.html#a18adb578c9437579bc39134852d4fc5b">00124</a> <span class="preprocessor">#define CR_YIELD( func_name )                                                                                   \</span>
-<a name="l00125"></a>00125 <span class="preprocessor">            cr_g_current_cr_id = cr_get_id( func_name );                                                        \</span>
-<a name="l00126"></a>00126 <span class="preprocessor">            assert( ( cr_g_current_cr_id != CR_INVALID_ID ) &amp;&amp; &quot;CR_YIELD: CR_INVALID_ID!\n&quot; );                  \</span>
-<a name="l00127"></a>00127 <span class="preprocessor">            assert( ( ( uint32_t ) cr_g_current_cr_id &lt; cr_g_context_cnt) &amp;&amp; &quot;CR_YIELD: ID out of bounds!\n&quot; ); \</span>
-<a name="l00128"></a>00128 <span class="preprocessor">            assert( ( cr_g_current_cr_id != this_id__ ) &amp;&amp; &quot;CR_YIELD: recursive coroutine call!\n&quot; );           \</span>
-<a name="l00129"></a>00129 <span class="preprocessor">            cr_g_previous_cr_id = this_id__;                                                                    \</span>
-<a name="l00130"></a>00130 <span class="preprocessor">            if ( !setjmp( cr_g_context[ this_id__ ].env ) ) {                                                   \</span>
-<a name="l00131"></a>00131 <span class="preprocessor">                fegetenv( &amp;envp );                                                                              \</span>
-<a name="l00132"></a>00132 <span class="preprocessor">                longjmp( cr_g_context[ cr_g_current_cr_id ].env, SETJMP_DFLT_RET_VAL );                         \</span>
-<a name="l00133"></a>00133 <span class="preprocessor">            } else { fesetenv( &amp;envp ); }</span>
+<a name="l00124"></a><a class="code" href="cr_8h.html#a18adb578c9437579bc39134852d4fc5b">00124</a> <span class="preprocessor">#define CR_YIELD( func_name )                     \</span>
+<a name="l00125"></a>00125 <span class="preprocessor">  cr_g_current_cr_id = cr_get_id( func_name );                \</span>
+<a name="l00126"></a>00126 <span class="preprocessor">  assert( ( cr_g_current_cr_id != CR_INVALID_ID ) &amp;&amp; &quot;CR_YIELD: CR_INVALID_ID!\n&quot; );      \</span>
+<a name="l00127"></a>00127 <span class="preprocessor">  assert( ( ( uint32_t ) cr_g_current_cr_id &lt; cr_g_context_cnt) &amp;&amp; &quot;CR_YIELD: ID out of bounds!\n&quot; ); \</span>
+<a name="l00128"></a>00128 <span class="preprocessor">  assert( ( cr_g_current_cr_id != this_id__ ) &amp;&amp; &quot;CR_YIELD: recursive coroutine call!\n&quot; );   \</span>
+<a name="l00129"></a>00129 <span class="preprocessor">  cr_g_previous_cr_id = this_id__;                  \</span>
+<a name="l00130"></a>00130 <span class="preprocessor">  if ( !setjmp( cr_g_context[ this_id__ ].env ) ) {             \</span>
+<a name="l00131"></a>00131 <span class="preprocessor">    fegetenv( &amp;envp );                    \</span>
+<a name="l00132"></a>00132 <span class="preprocessor">    longjmp( cr_g_context[ cr_g_current_cr_id ].env, SETJMP_DFLT_RET_VAL );     \</span>
+<a name="l00133"></a>00133 <span class="preprocessor">  } else { fesetenv( &amp;envp ); }</span>
 <a name="l00134"></a>00134 <span class="preprocessor"></span>
 <a name="l00135"></a>00135 
 <a name="l00136"></a>00136 
 <a name="l00138"></a>00138 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
 <a name="l00139"></a>00139 <span class="preprocessor">#endif</span>
 <a name="l00140"></a>00140 <span class="preprocessor"></span>
-<a name="l00141"></a>00141     <span class="comment">/* Should _not_ be modified by the user. They&#39;re defined as extern because they&#39;re used in the macros. */</span>
-<a name="l00142"></a>00142     <span class="keyword">extern</span> <a class="code" href="struct_c_r___c_o_n_t_e_x_t.html" title="Coroutine context information.">CR_CONTEXT</a>*  <a class="code" href="cr_8c.html#a22841ff791649abd0bcb62392ebb9778" title="Pointer to the user defined array of coroutine contexts.">cr_g_context</a>;
-<a name="l00143"></a>00143     <span class="keyword">extern</span> uint32_t     <a class="code" href="cr_8c.html#a8238e77b653b2cc4905373b805fc3567" title="The number of elements in the coroutine context array.">cr_g_context_cnt</a>;
-<a name="l00144"></a>00144     <span class="keyword">extern</span> int32_t      <a class="code" href="cr_8c.html#a00999e3368c59592db0c069abf1f1296" title="Flag that&amp;#39;s set when CR_START is called.">cr_g_sys_started</a>;
-<a name="l00145"></a>00145     <span class="keyword">extern</span> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>      <a class="code" href="cr_8c.html#ae7e93574baec3ae2b083c7f36916fbbd" title="The ID of the previously active coroutine.">cr_g_previous_cr_id</a>;
-<a name="l00146"></a>00146     <span class="keyword">extern</span> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>      <a class="code" href="cr_8c.html#acf4ab64c8de56045d84e53b65dba7eb8" title="The ID of the coroutine that&amp;#39;s active.">cr_g_current_cr_id</a>;
-<a name="l00147"></a>00147     <span class="keyword">extern</span> jmp_buf      cr_g_reg_func_env;
+<a name="l00141"></a>00141   <span class="comment">/* Should _not_ be modified by the user. They&#39;re defined as extern because they&#39;re used in the macros. */</span>
+<a name="l00142"></a>00142   <span class="keyword">extern</span> <a class="code" href="struct_c_r___c_o_n_t_e_x_t.html" title="Coroutine context information.">CR_CONTEXT</a>*  <a class="code" href="cr_8c.html#a22841ff791649abd0bcb62392ebb9778" title="Pointer to the user defined array of coroutine contexts.">cr_g_context</a>;
+<a name="l00143"></a>00143   <span class="keyword">extern</span> uint32_t   <a class="code" href="cr_8c.html#a8238e77b653b2cc4905373b805fc3567" title="The number of elements in the coroutine context array.">cr_g_context_cnt</a>;
+<a name="l00144"></a>00144   <span class="keyword">extern</span> int32_t    <a class="code" href="cr_8c.html#a00999e3368c59592db0c069abf1f1296" title="Flag that&amp;#39;s set when CR_START is called.">cr_g_sys_started</a>;
+<a name="l00145"></a>00145   <span class="keyword">extern</span> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>    <a class="code" href="cr_8c.html#ae7e93574baec3ae2b083c7f36916fbbd" title="The ID of the previously active coroutine.">cr_g_previous_cr_id</a>;
+<a name="l00146"></a>00146   <span class="keyword">extern</span> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>    <a class="code" href="cr_8c.html#acf4ab64c8de56045d84e53b65dba7eb8" title="The ID of the coroutine that&amp;#39;s active.">cr_g_current_cr_id</a>;
+<a name="l00147"></a>00147   <span class="keyword">extern</span> jmp_buf    cr_g_reg_func_env;
 <a name="l00148"></a>00148 
-<a name="l00149"></a>00149     <span class="comment">/* Can be modified by the user. */</span>
-<a name="l00150"></a>00150     <span class="keyword">extern</span> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>      <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a>;
+<a name="l00149"></a>00149   <span class="comment">/* Can be modified by the user. */</span>
+<a name="l00150"></a>00150   <span class="keyword">extern</span> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>    <a class="code" href="cr_8c.html#a1345c6db4d2d1d939e7841da46704d8e" title="Holds the ID of the coroutine to be activated - by cr_idle.">cr_g_activate_id</a>;
 <a name="l00151"></a>00151 
-<a name="l00152"></a>00152     <span class="comment">/* User callable functions. */</span>
-<a name="l00153"></a>00153     <span class="keyword">extern</span> <span class="keywordtype">void</span>         <a class="code" href="cr_8c.html#a3e8d6963f6ee2cc49502186eca21d879" title="Resets the system to an initial state.">cr_reset</a>( <span class="keywordtype">void</span> );
-<a name="l00154"></a>00154     <span class="keyword">extern</span> <span class="keywordtype">void</span>         <a class="code" href="cr_8c.html#aca6b87323f9ce0bf21b3f06209a97989" title="cr_lib&amp;#39;s initialization function.">cr_init</a>( <a class="code" href="struct_c_r___c_o_n_t_e_x_t.html" title="Coroutine context information.">CR_CONTEXT</a>* cr_context, <span class="keywordtype">size_t</span> cr_context_count );
-<a name="l00155"></a>00155     <span class="keyword">extern</span> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>      <a class="code" href="cr_8c.html#a3e7a31163658d81c9473e5b637d9eb90" title="Find the ID of a coroutine.">cr_get_id</a>( <span class="keywordtype">void</span> ( *pFunc )( <span class="keywordtype">void</span> ) );
-<a name="l00156"></a>00156     <span class="keyword">extern</span> <span class="keywordtype">void</span>         <a class="code" href="cr_8c.html#accd73b48023970380bfdecb56483976c" title="The internal system&amp;#39;s coroutine thread.">cr_idle</a>( <span class="keywordtype">void</span> );
-<a name="l00157"></a>00157     <span class="keyword">extern</span> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>      <a class="code" href="cr_8c.html#ae30bdb4ef569c0678e4cb49829f11bbb" title="Register a function as a coroutine thread.">cr_register_thread</a>( <span class="keywordtype">void</span> ( *pFunc )( <span class="keywordtype">void</span> ) );
+<a name="l00152"></a>00152   <span class="comment">/* User callable functions. */</span>
+<a name="l00153"></a>00153   <span class="keyword">extern</span> <span class="keywordtype">void</span>   <a class="code" href="cr_8c.html#a3e8d6963f6ee2cc49502186eca21d879" title="Resets the system to an initial state.">cr_reset</a>( <span class="keywordtype">void</span> );
+<a name="l00154"></a>00154   <span class="keyword">extern</span> <span class="keywordtype">void</span>   <a class="code" href="cr_8c.html#aca6b87323f9ce0bf21b3f06209a97989" title="cr_lib&amp;#39;s initialization function.">cr_init</a>( <a class="code" href="struct_c_r___c_o_n_t_e_x_t.html" title="Coroutine context information.">CR_CONTEXT</a>* cr_context, <span class="keywordtype">size_t</span> cr_context_count );
+<a name="l00155"></a>00155   <span class="keyword">extern</span> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>    <a class="code" href="cr_8c.html#a3e7a31163658d81c9473e5b637d9eb90" title="Find the ID of a coroutine.">cr_get_id</a>( <span class="keywordtype">void</span> ( *pFunc )( <span class="keywordtype">void</span> ) );
+<a name="l00156"></a>00156   <span class="keyword">extern</span> <span class="keywordtype">void</span>   <a class="code" href="cr_8c.html#accd73b48023970380bfdecb56483976c" title="The internal system&amp;#39;s coroutine thread.">cr_idle</a>( <span class="keywordtype">void</span> );
+<a name="l00157"></a>00157   <span class="keyword">extern</span> <a class="code" href="cr_8h.html#ae9a0f05a9df6e08a47e828db183fa186" title="Coroutine ID typedef.">cr_id_t</a>    <a class="code" href="cr_8c.html#ae30bdb4ef569c0678e4cb49829f11bbb" title="Register a function as a coroutine thread.">cr_register_thread</a>( <span class="keywordtype">void</span> ( *pFunc )( <span class="keywordtype">void</span> ) );
 <a name="l00158"></a>00158 
 <a name="l00159"></a>00159 <span class="preprocessor">#ifdef __cplusplus</span>
 <a name="l00160"></a>00160 <span class="preprocessor"></span>}
 <a name="l00165"></a>00165 <span class="comment">// end of file</span>
 </pre></div></div>
 </div>
-<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 25 2010 09:38:58 for cr_lib by&nbsp;
+<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 25 2010 10:41:01 for cr_lib by&nbsp;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
 </body>

doxygen/html/cr__config_8h.html

 <div class="navigation" id="top">
   <div class="tabs">
     <ul class="tablist">
-      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
+      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
       <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
       <li class="current"><a href="files.html"><span>Files</span></a></li>
       <li><a href="examples.html"><span>Examples</span></a></li>
 <h1>cr_config.h File Reference</h1>  </div>
 </div>
 <div class="contents">
+<div class="dynheader">
+This graph shows which files directly or indirectly include this file:</div>
+<div class="dyncontent">
+<div class="center"><img src="cr__config_8h__dep__incl.png" border="0" usemap="#cr__config_8hdep" alt=""/></div>
+<map name="cr__config_8hdep" id="cr__config_8hdep">
+</map>
+</div>
 
 <p><a href="cr__config_8h_source.html">Go to the source code of this file.</a></p>
 <table class="memberdecls">
 
 <p>Definition in file <a class="el" href="cr__config_8h_source.html">cr_config.h</a>.</p>
 </div>
-<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 25 2010 09:38:58 for cr_lib by&nbsp;
+<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 25 2010 10:41:01 for cr_lib by&nbsp;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
 </body>

doxygen/html/cr__config_8h_source.html

 <div class="navigation" id="top">
   <div class="tabs">
     <ul class="tablist">
-      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
+      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
       <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
       <li class="current"><a href="files.html"><span>Files</span></a></li>
       <li><a href="examples.html"><span>Examples</span></a></li>
 <a name="l00019"></a>00019 <span class="preprocessor"></span>
 <a name="l00020"></a>00020 <span class="comment">//------------------------------------------------------------------------------</span>
 <a name="l00021"></a>00021 <span class="comment">//------------------------------------------------------------------------------</span>
-<a name="l00026"></a>00026 <span class="comment"></span><span class="comment">//#undef          NPRINTF</span>
-<a name="l00027"></a><a class="code" href="cr__config_8h.html#a869fb889b331af26f9622355a458bdbb">00027</a> <span class="preprocessor">#define         NPRINTF</span>
+<a name="l00026"></a>00026 <span class="comment"></span><span class="comment">//#undef  NPRINTF</span>
+<a name="l00027"></a><a class="code" href="cr__config_8h.html#a869fb889b331af26f9622355a458bdbb">00027</a> <span class="preprocessor">#define NPRINTF</span>
 <a name="l00028"></a>00028 <span class="preprocessor"></span>
-<a name="l00033"></a>00033 <span class="comment">//#undef          NDPRINTF</span>
-<a name="l00034"></a><a class="code" href="cr__config_8h.html#ae7206eb8cc0f94759d5cb60adbab8090">00034</a> <span class="preprocessor">#define         NDPRINTF</span>
+<a name="l00033"></a>00033 <span class="comment">//#undef  NDPRINTF</span>
+<a name="l00034"></a><a class="code" href="cr__config_8h.html#ae7206eb8cc0f94759d5cb60adbab8090">00034</a> <span class="preprocessor">#define NDPRINTF</span>
 <a name="l00035"></a>00035 <span class="preprocessor"></span>
-<a name="l00040"></a>00040 <span class="comment">//#undef          NEPRINTF</span>
-<a name="l00041"></a><a class="code" href="cr__config_8h.html#aa200f6e1e47c14c0589aeaab512c5b21">00041</a> <span class="preprocessor">#define         NEPRINTF</span>
+<a name="l00040"></a>00040 <span class="comment">//#undef  NEPRINTF</span>
+<a name="l00041"></a><a class="code" href="cr__config_8h.html#aa200f6e1e47c14c0589aeaab512c5b21">00041</a> <span class="preprocessor">#define NEPRINTF</span>
 <a name="l00042"></a>00042 <span class="preprocessor"></span>
 <a name="l00043"></a>00043 <span class="comment">// __func__ (C99) : The function where the printf is called</span>
 <a name="l00044"></a>00044 <span class="comment">// __LINE__ : The line where the printf is called</span>
 <a name="l00045"></a>00045 <span class="comment">// __FILE__ : The file where the printf is called</span>
 <a name="l00046"></a>00046 
 <a name="l00053"></a>00053 <span class="preprocessor">#ifdef NPRINTF</span>
-<a name="l00054"></a><a class="code" href="cr__config_8h.html#a9cf515ebc1330eb9cc663b2552286e14">00054</a> <span class="preprocessor"></span><span class="preprocessor">    #define PRINTF( fmt )</span>
-<a name="l00055"></a><a class="code" href="cr__config_8h.html#ae6e0a233142353eb48a95cf58bdb4f92">00055</a> <span class="preprocessor"></span><span class="preprocessor">    #define PRINTF_VA( fmt, ... )</span>
+<a name="l00054"></a><a class="code" href="cr__config_8h.html#a9cf515ebc1330eb9cc663b2552286e14">00054</a> <span class="preprocessor"></span><span class="preprocessor">  #define PRINTF( fmt )</span>
+<a name="l00055"></a><a class="code" href="cr__config_8h.html#ae6e0a233142353eb48a95cf58bdb4f92">00055</a> <span class="preprocessor"></span><span class="preprocessor">  #define PRINTF_VA( fmt, ... )</span>
 <a name="l00056"></a>00056 <span class="preprocessor"></span><span class="preprocessor">#else</span>
-<a name="l00057"></a>00057 <span class="preprocessor"></span><span class="preprocessor">    #define PRINTF( fmt )                printf( fmt )</span>
-<a name="l00058"></a>00058 <span class="preprocessor"></span><span class="preprocessor">    #define PRINTF_VA( fmt, ... )        printf( fmt, __VA_ARGS__ )</span>
+<a name="l00057"></a>00057 <span class="preprocessor"></span><span class="preprocessor">  #define PRINTF( fmt )   printf( fmt )</span>
+<a name="l00058"></a>00058 <span class="preprocessor"></span><span class="preprocessor">  #define PRINTF_VA( fmt, ... ) printf( fmt, __VA_ARGS__ )</span>
 <a name="l00059"></a>00059 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
 <a name="l00060"></a>00060 <span class="preprocessor"></span>
 <a name="l00067"></a>00067 <span class="preprocessor">#ifdef NDPRINTF</span>
-<a name="l00068"></a><a class="code" href="cr__config_8h.html#accf6006906cc6f69483a802415ce8e3f">00068</a> <span class="preprocessor"></span><span class="preprocessor">    #define DPRINTF( fmt )</span>
-<a name="l00069"></a><a class="code" href="cr__config_8h.html#ae1cd4b13bc177e09548403138f14fe94">00069</a> <span class="preprocessor"></span><span class="preprocessor">    #define DPRINTF_VA( fmt, ... )</span>
+<a name="l00068"></a><a class="code" href="cr__config_8h.html#accf6006906cc6f69483a802415ce8e3f">00068</a> <span class="preprocessor"></span><span class="preprocessor">  #define DPRINTF( fmt )</span>
+<a name="l00069"></a><a class="code" href="cr__config_8h.html#ae1cd4b13bc177e09548403138f14fe94">00069</a> <span class="preprocessor"></span><span class="preprocessor">  #define DPRINTF_VA( fmt, ... )</span>
 <a name="l00070"></a>00070 <span class="preprocessor"></span><span class="preprocessor">#else</span>
-<a name="l00071"></a>00071 <span class="preprocessor"></span><span class="preprocessor">    #define DPRINTF( fmt )                printf( &quot;[%s:%s:%d] &quot; fmt, __FILE__, __func__, __LINE__ )</span>
-<a name="l00072"></a>00072 <span class="preprocessor"></span><span class="preprocessor">    #define DPRINTF_VA( fmt, ... )        printf( &quot;[%s:%s:%d] &quot; fmt, __FILE__, __func__, __LINE__, __VA_ARGS__ )</span>
+<a name="l00071"></a>00071 <span class="preprocessor"></span><span class="preprocessor">  #define DPRINTF( fmt )    printf( &quot;[%s:%s:%d] &quot; fmt, __FILE__, __func__, __LINE__ )</span>
+<a name="l00072"></a>00072 <span class="preprocessor"></span><span class="preprocessor">  #define DPRINTF_VA( fmt, ... )  printf( &quot;[%s:%s:%d] &quot; fmt, __FILE__, __func__, __LINE__, __VA_ARGS__ )</span>
 <a name="l00073"></a>00073 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
 <a name="l00074"></a>00074 <span class="preprocessor"></span>
 <a name="l00081"></a>00081 <span class="preprocessor">#ifdef NEPRINTF</span>
-<a name="l00082"></a><a class="code" href="cr__config_8h.html#ad9f414bfa7c91a6e48dbd7ca18f9cd73">00082</a> <span class="preprocessor"></span><span class="preprocessor">    #define EPRINTF( fmt )</span>
-<a name="l00083"></a><a class="code" href="cr__config_8h.html#aae9d6c746a7bfd44e3267ba5034a137e">00083</a> <span class="preprocessor"></span><span class="preprocessor">    #define EPRINTF_VA( fmt, ... )</span>
+<a name="l00082"></a><a class="code" href="cr__config_8h.html#ad9f414bfa7c91a6e48dbd7ca18f9cd73">00082</a> <span class="preprocessor"></span><span class="preprocessor">  #define EPRINTF( fmt )</span>
+<a name="l00083"></a><a class="code" href="cr__config_8h.html#aae9d6c746a7bfd44e3267ba5034a137e">00083</a> <span class="preprocessor"></span><span class="preprocessor">  #define EPRINTF_VA( fmt, ... )</span>
 <a name="l00084"></a>00084 <span class="preprocessor"></span><span class="preprocessor">#else</span>
-<a name="l00085"></a>00085 <span class="preprocessor"></span><span class="preprocessor">    #define EPRINTF( fmt )                printf( &quot;[%s:%s:%d] &quot; fmt, __FILE__, __func__, __LINE__ )</span>
-<a name="l00086"></a>00086 <span class="preprocessor"></span><span class="preprocessor">    #define EPRINTF_VA( fmt, ... )        printf( &quot;[%s:%s:%d] &quot; fmt, __FILE__, __func__, __LINE__, __VA_ARGS__ )</span>
+<a name="l00085"></a>00085 <span class="preprocessor"></span><span class="preprocessor">  #define EPRINTF( fmt )    printf( &quot;[%s:%s:%d] &quot; fmt, __FILE__, __func__, __LINE__ )</span>
+<a name="l00086"></a>00086 <span class="preprocessor"></span><span class="preprocessor">  #define EPRINTF_VA( fmt, ... )  printf( &quot;[%s:%s:%d] &quot; fmt, __FILE__, __func__, __LINE__, __VA_ARGS__ )</span>
 <a name="l00087"></a>00087 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
 <a name="l00088"></a>00088 <span class="preprocessor"></span>
 <a name="l00089"></a>00089 
 <a name="l00090"></a>00090 <span class="comment">/*----------------------- Language Standards -----------------------------------</span>
-<a name="l00091"></a>00091 <span class="comment">- C89           __STDC__                                    ANSI X3.159-1989</span>
-<a name="l00092"></a>00092 <span class="comment">- C90           __STDC_VERSION__                            ISO/IEC 9899:1990</span>
-<a name="l00093"></a>00093 <span class="comment">- C94           __STDC_VERSION__        = 199409L           ISO/IEC 9899-1:1994</span>
-<a name="l00094"></a>00094 <span class="comment">- C99           __STDC_VERSION__        = 199901L           ISO/IEC 9899:1999</span>
-<a name="l00095"></a>00095 <span class="comment">- C++98         __cplusplus             = 199707L           ISO/IEC 14882:1998</span>
-<a name="l00096"></a>00096 <span class="comment">- C++/CLI       __cplusplus_cli         = 200406L           ECMA-372</span>
-<a name="l00097"></a>00097 <span class="comment">- EC++          __embedded_cplusplus                        Embedded C++</span>
+<a name="l00091"></a>00091 <span class="comment">- C89   __STDC__        ANSI X3.159-1989</span>
+<a name="l00092"></a>00092 <span class="comment">- C90   __STDC_VERSION__      ISO/IEC 9899:1990</span>
+<a name="l00093"></a>00093 <span class="comment">- C94   __STDC_VERSION__  = 199409L ISO/IEC 9899-1:1994</span>
+<a name="l00094"></a>00094 <span class="comment">- C99   __STDC_VERSION__  = 199901L ISO/IEC 9899:1999</span>
+<a name="l00095"></a>00095 <span class="comment">- C++98   __cplusplus   = 199707L ISO/IEC 14882:1998</span>
+<a name="l00096"></a>00096 <span class="comment">- C++/CLI __cplusplus_cli   = 200406L ECMA-372</span>
+<a name="l00097"></a>00097 <span class="comment">- EC++  __embedded_cplusplus        Embedded C++</span>
 <a name="l00098"></a>00098 <span class="comment">------------------------------------------------------------------------------*/</span>
 <a name="l00099"></a>00099 <span class="comment">// Note that not all compliant compilers provide the correct pre-defined macros.</span>
 <a name="l00100"></a>00100 <span class="preprocessor">#ifdef __STDC__</span>
-<a name="l00101"></a>00101 <span class="preprocessor"></span><span class="preprocessor">    #define PREDEF_STANDARD_C_1989</span>
+<a name="l00101"></a>00101 <span class="preprocessor"></span><span class="preprocessor">  #define PREDEF_STANDARD_C_1989</span>
 <a name="l00102"></a>00102 <span class="preprocessor"></span>
-<a name="l00103"></a>00103 <span class="preprocessor">    #ifdef __STDC_VERSION__</span>
-<a name="l00104"></a>00104 <span class="preprocessor"></span><span class="preprocessor">        #define PREDEF_STANDARD_C_1990</span>
+<a name="l00103"></a>00103 <span class="preprocessor">  #ifdef __STDC_VERSION__</span>
+<a name="l00104"></a>00104 <span class="preprocessor"></span><span class="preprocessor">    #define PREDEF_STANDARD_C_1990</span>
 <a name="l00105"></a>00105 <span class="preprocessor"></span>
-<a name="l00106"></a>00106 <span class="preprocessor">        #if ( __STDC_VERSION__ &gt;= 199409L )</span>
-<a name="l00107"></a>00107 <span class="preprocessor"></span><span class="preprocessor">            #define PREDEF_STANDARD_C_1994</span>
-<a name="l00108"></a>00108 <span class="preprocessor"></span><span class="preprocessor">        #endif</span>
+<a name="l00106"></a>00106 <span class="preprocessor">    #if ( __STDC_VERSION__ &gt;= 199409L )</span>
+<a name="l00107"></a>00107 <span class="preprocessor"></span><span class="preprocessor">      #define PREDEF_STANDARD_C_1994</span>
+<a name="l00108"></a>00108 <span class="preprocessor"></span><span class="preprocessor">    #endif</span>
 <a name="l00109"></a>00109 <span class="preprocessor"></span>
-<a name="l00110"></a>00110 <span class="preprocessor">        #if ( __STDC_VERSION__ &gt;= 199901L )</span>
-<a name="l00111"></a>00111 <span class="preprocessor"></span><span class="preprocessor">            #define PREDEF_STANDARD_C_1999</span>
-<a name="l00112"></a>00112 <span class="preprocessor"></span><span class="preprocessor">        #endif</span>
-<a name="l00113"></a>00113 <span class="preprocessor"></span><span class="preprocessor">    #endif</span>
+<a name="l00110"></a>00110 <span class="preprocessor">    #if ( __STDC_VERSION__ &gt;= 199901L )</span>
+<a name="l00111"></a>00111 <span class="preprocessor"></span><span class="preprocessor">      #define PREDEF_STANDARD_C_1999</span>
+<a name="l00112"></a>00112 <span class="preprocessor"></span><span class="preprocessor">    #endif</span>
+<a name="l00113"></a>00113 <span class="preprocessor"></span><span class="preprocessor">  #endif</span>
 <a name="l00114"></a>00114 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
 <a name="l00115"></a>00115 <span class="preprocessor"></span>
 <a name="l00116"></a>00116 <span class="preprocessor">#ifndef __cplusplus</span>
-<a name="l00117"></a>00117 <span class="preprocessor"></span><span class="preprocessor">    #if !defined( __DMC__ ) &amp;&amp; !defined( _MSC_VER )</span>
-<a name="l00118"></a>00118 <span class="preprocessor"></span><span class="preprocessor">        #ifndef PREDEF_STANDARD_C_1999</span>
-<a name="l00119"></a>00119 <span class="preprocessor"></span><span class="preprocessor">            #error &quot;ISO C99 compiler is required for this code to compile&quot;</span>
-<a name="l00120"></a>00120 <span class="preprocessor"></span><span class="preprocessor">        #endif</span>
-<a name="l00121"></a>00121 <span class="preprocessor"></span><span class="preprocessor">    #endif</span>
+<a name="l00117"></a>00117 <span class="preprocessor"></span><span class="preprocessor">  #if !defined( __DMC__ ) &amp;&amp; !defined( _MSC_VER )</span>
+<a name="l00118"></a>00118 <span class="preprocessor"></span><span class="preprocessor">    #ifndef PREDEF_STANDARD_C_1999</span>
+<a name="l00119"></a>00119 <span class="preprocessor"></span><span class="preprocessor">      #error &quot;ISO C99 compiler is required for this code to compile&quot;</span>
+<a name="l00120"></a>00120 <span class="preprocessor"></span><span class="preprocessor">    #endif</span>
+<a name="l00121"></a>00121 <span class="preprocessor"></span><span class="preprocessor">  #endif</span>
 <a name="l00122"></a>00122 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
 <a name="l00123"></a>00123 <span class="preprocessor"></span>
 <a name="l00124"></a>00124 <span class="comment">//------------------------------------------------------------------------------</span>
 <a name="l00125"></a>00125 <span class="comment">//------------------------------------------------------------------------------</span>
 <a name="l00126"></a>00126 <span class="preprocessor">#ifdef __INTEL_COMPILER</span>
-<a name="l00127"></a>00127 <span class="preprocessor"></span><span class="preprocessor">    #pragma warning (disable: 279)</span>
+<a name="l00127"></a>00127 <span class="preprocessor"></span><span class="preprocessor">  #pragma warning (disable: 279)</span>
 <a name="l00128"></a>00128 <span class="preprocessor"></span>
-<a name="l00129"></a>00129     <span class="comment">// OS X</span>
-<a name="l00130"></a>00130 <span class="preprocessor">    #ifdef __APPLE__</span>
-<a name="l00131"></a>00131 <span class="preprocessor"></span>        <span class="comment">// none</span>
-<a name="l00132"></a>00132 <span class="preprocessor">    #endif</span>
+<a name="l00129"></a>00129   <span class="comment">// OS X</span>
+<a name="l00130"></a>00130 <span class="preprocessor">  #ifdef __APPLE__</span>
+<a name="l00131"></a>00131 <span class="preprocessor"></span>    <span class="comment">// none</span>
+<a name="l00132"></a>00132 <span class="preprocessor">  #endif</span>
 <a name="l00133"></a>00133 <span class="preprocessor"></span>
-<a name="l00134"></a>00134     <span class="comment">// GNUC on *nix</span>
-<a name="l00135"></a>00135 <span class="preprocessor">    #if !defined( __APPLE__ ) &amp;&amp; defined( __GNUC__ )</span>
-<a name="l00136"></a>00136 <span class="preprocessor"></span><span class="preprocessor">        #define restrict    __restrict</span>
-<a name="l00137"></a>00137 <span class="preprocessor"></span><span class="preprocessor">        #define inline      __inline</span>
-<a name="l00138"></a>00138 <span class="preprocessor"></span><span class="preprocessor">    #endif</span>
+<a name="l00134"></a>00134   <span class="comment">// GNUC on *nix</span>
+<a name="l00135"></a>00135 <span class="preprocessor">  #if !defined( __APPLE__ ) &amp;&amp; defined( __GNUC__ )</span>
+<a name="l00136"></a>00136 <span class="preprocessor"></span><span class="preprocessor">    #define restrict    __restrict</span>
+<a name="l00137"></a>00137 <span class="preprocessor"></span><span class="preprocessor">    #define inline      __inline</span>
+<a name="l00138"></a>00138 <span class="preprocessor"></span><span class="preprocessor">  #endif</span>
 <a name="l00139"></a>00139 <span class="preprocessor"></span>
-<a name="l00140"></a>00140     <span class="comment">// *MS VC++ with Intel compiler</span>
-<a name="l00141"></a>00141 <span class="preprocessor">    #if defined( _MSC_VER ) &amp;&amp; !defined( __APPLE__ ) &amp;&amp; !defined( __GNUC__ )</span>
-<a name="l00142"></a>00142 <span class="preprocessor"></span><span class="preprocessor">        #define alloca  _alloca</span>
+<a name="l00140"></a>00140   <span class="comment">// *MS VC++ with Intel compiler</span>
+<a name="l00141"></a>00141 <span class="preprocessor">  #if defined( _MSC_VER ) &amp;&amp; !defined( __APPLE__ ) &amp;&amp; !defined( __GNUC__ )</span>
+<a name="l00142"></a>00142 <span class="preprocessor"></span><span class="preprocessor">    #define alloca  _alloca</span>
 <a name="l00143"></a>00143 <span class="preprocessor"></span>
-<a name="l00144"></a>00144 <span class="preprocessor">        #ifndef __cplusplus</span>
-<a name="l00145"></a>00145 <span class="preprocessor"></span><span class="preprocessor">            #define inline  __inline</span>
-<a name="l00146"></a>00146 <span class="preprocessor"></span><span class="preprocessor">        #endif</span>
-<a name="l00147"></a>00147 <span class="preprocessor"></span><span class="preprocessor">    #endif</span>
+<a name="l00144"></a>00144 <span class="preprocessor">    #ifndef __cplusplus</span>
+<a name="l00145"></a>00145 <span class="preprocessor"></span><span class="preprocessor">      #define inline  __inline</span>
+<a name="l00146"></a>00146 <span class="preprocessor"></span><span class="preprocessor">    #endif</span>
+<a name="l00147"></a>00147 <span class="preprocessor"></span><span class="preprocessor">  #endif</span>
 <a name="l00148"></a>00148 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
 <a name="l00149"></a>00149 <span class="preprocessor"></span>
 <a name="l00150"></a>00150 <span class="comment">// *MS VC++ only</span>
 <a name="l00151"></a>00151 <span class="preprocessor">#if defined( _MSC_VER ) &amp;&amp; !defined( __INTEL_COMPILER )</span>
-<a name="l00152"></a>00152 <span class="preprocessor"></span><span class="preprocessor">    #ifndef __cplusplus</span>
-<a name="l00153"></a>00153 <span class="preprocessor"></span><span class="preprocessor">        #define inline  __inline</span>
-<a name="l00154"></a>00154 <span class="preprocessor"></span><span class="preprocessor">    #endif</span>
+<a name="l00152"></a>00152 <span class="preprocessor"></span><span class="preprocessor">  #ifndef __cplusplus</span>
+<a name="l00153"></a>00153 <span class="preprocessor"></span><span class="preprocessor">    #define inline  __inline</span>
+<a name="l00154"></a>00154 <span class="preprocessor"></span><span class="preprocessor">  #endif</span>
 <a name="l00155"></a>00155 <span class="preprocessor"></span>
-<a name="l00156"></a>00156 <span class="preprocessor">    #define restrict    __restrict</span>
+<a name="l00156"></a>00156 <span class="preprocessor">  #define restrict    __restrict</span>
 <a name="l00157"></a>00157 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
 <a name="l00158"></a>00158 <span class="preprocessor"></span>
 <a name="l00159"></a>00159 
 <a name="l00172"></a>00172 <span class="comment">// end of file</span>
 </pre></div></div>
 </div>
-<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 25 2010 09:38:58 for cr_lib by&nbsp;
+<hr class="footer"/><address class="footer"><small>Generated on Fri Jun 25 2010 10:41:01 for cr_lib by&nbsp;
 <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
 </body>

doxygen/html/demo_1_8c-example.html

 <div class="navigation" id="top">
   <div class="tabs">
     <ul class="tablist">
-      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
+      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
       <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
       <li><a href="files.html"><span>Files</span></a></li>
       <li><a href="examples.html"><span>Examples</span></a></li>
 <span class="keyword">static</span> <span class="keywordtype">void</span> cleanup( <span class="keywordtype">void</span> );
 <span class="keyword">static</span> <span class="keywordtype">void</span> signal_handler( <span class="keywordtype">int</span> signal );
 
-<span class="keywordtype">void</span> Thread_A( <span class="keywordtype">void</span> )
-{
-    <span class="comment">// A. locals use the &#39;volatile&#39; qualifier</span>
-    cr_int32_t      i;
-    cr_uint32_t     cnt = 0;
+<span class="keywordtype">void</span> Thread_A( <span class="keywordtype">void</span> ) {
+  <span class="comment">// A. locals use the &#39;volatile&#39; qualifier</span>
+  cr_int32_t  i;
+  cr_uint32_t cnt = 0;
 
-    <span class="comment">// B. the required init call</span>
-    <a name="a0"></a><a class="code" href="cr_8h.html#ac68ef77f5ea5f5dda5a2f046a2c96429" title="Initializes a function as a coroutine.">CR_THREAD_INIT</a>( );
+  <span class="comment">// B. the required init call</span>
+  <a name="a0"></a><a class="code" href="cr_8h.html#ac68ef77f5ea5f5dda5a2f046a2c96429" title="Initializes a function as a coroutine.">CR_THREAD_INIT</a>( );
 
-    <span class="keywordflow">while</span> ( <span class="keyword">true</span> ) {
-        i = 100000;
+  <span class="keywordflow">while</span> ( <span class="keyword">true</span> ) {
+    i = 100000;
 
-        <span class="keywordflow">while</span> ( i-- ) {
-            cnt += 1;
-        }
+    <span class="keywordflow">while</span> ( i-- ) {
+      cnt += 1;
+    }
 
-        printf( <span class="stringliteral">&quot;- Thread_A yielding to Thread_B\n&quot;</span> );
+    printf( <span class="stringliteral">&quot;- Thread_A yielding to Thread_B\n&quot;</span> );