cextern/cfitsio/lib/eval_l.c
/** Setup the input buffer state to scan directly from a user-specified character buffer.
 * @param base the character buffer
 * @param size the size in bytes of the character buffer
 * 
 * @return the newly allocated buffer state object. 
 */
Setup the input buffer state to scan directly from a user-specified character buffer.
@param base the character buffer
@param size the size in bytes of the character buffer

@return the newly allocated buffer state object.
Setup the input buffer state to scan directly from a user - specified character buffer . @param base the character buffer @param size the size in bytes of the character buffer @return the newly allocated buffer state object .
FF_BUFFER_STATE ff_scan_buffer  (char * base, ff_size_t  size )
{
	FF_BUFFER_STATE b;
	if ( size < 2 ||
	     base[size-2] != FF_END_OF_BUFFER_CHAR ||
	     base[size-1] != FF_END_OF_BUFFER_CHAR )
		return 0;
	b = (FF_BUFFER_STATE) ffalloc(sizeof( struct ff_buffer_state )  );
	if ( ! b )
		FF_FATAL_ERROR( "out of dynamic memory in ff_scan_buffer()" );
	b->ff_buf_size = size - 2;	
	b->ff_buf_pos = b->ff_ch_buf = base;
	b->ff_is_our_buffer = 0;
	b->ff_input_file = 0;
	b->ff_n_chars = b->ff_buf_size;
	b->ff_is_interactive = 0;
	b->ff_at_bol = 1;
	b->ff_fill_buffer = 0;
	b->ff_buffer_status = FF_BUFFER_NEW;
	ff_switch_to_buffer(b  );
	return b;
}
FF_BUFFER_STATE ff_scan_buffer ( char * base , ff_size_t size ) { FF_BUFFER_STATE b ; if ( size < 2 || base [ size - 2 ] != FF_END_OF_BUFFER_CHAR || base [ size - 1 ] != FF_END_OF_BUFFER_CHAR ) return 0 ; b = ( FF_BUFFER_STATE ) ffalloc ( sizeof ( struct ff_buffer_state ) ) ; if ( ! b ) FF_FATAL_ERROR ( " " ) ; b -> ff_buf_size = size - 2 ; b -> ff_buf_pos = b -> ff_ch_buf = base ; b -> ff_is_our_buffer = 0 ; b -> ff_input_file = 0 ; b -> ff_n_chars = b -> ff_buf_size ; b -> ff_is_interactive = 0 ; b -> ff_at_bol = 1 ; b -> ff_fill_buffer = 0 ; b -> ff_buffer_status = FF_BUFFER_NEW ; ff_switch_to_buffer ( b ) ; return b ; }
Setup the input buffer state to scan directly from a user-specified character buffer.
Setup the input buffer state to scan directly from a user - specified character buffer .
/* They forgot to leave room for the EOB's. */ /* "- 2" to take care of EOB's */