51 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			51 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
|  | /****************************************************************************
 | ||
|  | 
 | ||
|  | Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED. | ||
|  | 
 | ||
|  | This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT | ||
|  | be copied by any method or incorporated into another program without | ||
|  | the express written consent of Aerospace C.Power. This Information or any portion | ||
|  | thereof remains the property of Aerospace C.Power. The Information contained herein | ||
|  | is believed to be accurate and Aerospace C.Power assumes no responsibility or | ||
|  | liability for its use in any way and conveys no license or title under | ||
|  | any patent or copyright and makes no representation or warranty that this | ||
|  | Information is free from patent or copyright infringement. | ||
|  | 
 | ||
|  | ****************************************************************************/ | ||
|  | #ifndef __STRFORMAT_H__
 | ||
|  | #define __STRFORMAT_H__
 | ||
|  | 
 | ||
|  | #include <stdarg.h>
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | extern "C" { | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #define STRFORMAT_OK 0
 | ||
|  | #define STRFORMAT_FAILED 1
 | ||
|  | typedef unsigned int StrFormatResult; | ||
|  | 
 | ||
|  | /* The data argument may only be considered valid during the function call */ | ||
|  | typedef StrFormatResult (*str_format_write)(void *user_data, | ||
|  |     const char *data, unsigned int len); | ||
|  | 
 | ||
|  | typedef StrFormatResult (*str_format_enable)(unsigned int enable); | ||
|  | 
 | ||
|  | typedef struct _str_format_context | ||
|  | { | ||
|  |   str_format_write write_str; | ||
|  |   void *user_data; | ||
|  |   str_format_enable enable_str; | ||
|  | } str_format_context; | ||
|  | 
 | ||
|  | int format_str(const str_format_context *ctxt, const char *format, ...); | ||
|  | 
 | ||
|  | int format_str_v(const str_format_context *ctxt, const char *format, va_list ap); | ||
|  | 
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | } | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #endif /*__STRFORMAT_H__*/
 |