Oyranos  git-devel
Oyranos is a full featured Color Management System
Macros
oyjl_macros.h File Reference
#include "oyjl_version.h"

Macros

#define OYJL_GET_RESULT_STRING(options_, optionL_, default_, variable_)   const char * variable_; if(oyjlOptions_GetResult( options_, optionL_, &variable_, NULL, NULL ) != oyjlOPTION_USER_CHANGED) variable_ = default_;
 
#define OYJL_GET_RESULT_DOUBLE(options_, optionL_, default_, variable_)   double variable_; if(oyjlOptions_GetResult( options_, optionL_, NULL, &variable_, NULL ) != oyjlOPTION_USER_CHANGED) variable_ = default_;
 
#define OYJL_GET_RESULT_INT(options_, optionL_, default_, variable_)   int variable_; if(oyjlOptions_GetResult( options_, optionL_, NULL, NULL, &variable_ ) != oyjlOPTION_USER_CHANGED) variable_ = default_;
 
#define OYJL_CREATE_VA_STRING(format_, text_, alloc_, error_action)
 

Detailed Description

License:
MIT http://www.opensource.org/licenses/mit-license.php
Copyright:
(c) 2011 - Kai-Uwe Behrmann ku.b@.nosp@m.gmx..nosp@m.de

Macro Definition Documentation

◆ OYJL_CREATE_VA_STRING

#define OYJL_CREATE_VA_STRING (   format_,
  text_,
  alloc_,
  error_action 
)
Value:
if(format_ && strchr(format_,'%') != NULL) { \
va_list list; \
size_t sz = 0; \
int len = 0; \
void*(* allocate_)(size_t size) = alloc_; \
if(!allocate_) allocate_ = malloc; \
\
text_ = NULL; \
\
va_start( list, format_); \
len = vsnprintf( text_, sz, format_, list); \
va_end ( list ); \
\
{ \
text_ = (char*)allocate_( sizeof(char) * len + 2 ); \
if(!text_) \
{ \
oyjlMessage_p( oyjlMSG_ERROR, 0, OYJL_DBG_FORMAT "could not allocate memory", OYJL_DBG_ARGS ); \
error_action; \
} \
va_start( list, format_); \
len = vsnprintf( text_, len+1, format_, list); \
va_end ( list ); \
} \
} else if(format_) \
{ \
text_ = oyjlStringCopy( format_, alloc_ );\
}
usage error
Definition: oyjl_debug.h:89
char * oyjlStringCopy(const char *string, void *(*alloc)(size_t))
duplicate a string with custom allocator
Definition: oyjl_string.c:257

convert ( const char * format, ... ) function args into a string

Referenced by oyjlPrintSub(), oyjlPrintSubProfiling(), oyjlReadCommandF(), oyjlStr_Add(), oyjlStringAdd(), oyjlStringListAdd(), oyjlTermColorF(), oyjlTermColorFPtr(), oyjlTreeGetValueF(), oyjlTreeSetDoubleF(), oyjlTreeSetIntF(), and oyjlTreeSetStringF().

◆ OYJL_GET_RESULT_DOUBLE

#define OYJL_GET_RESULT_DOUBLE (   options_,
  optionL_,
  default_,
  variable_ 
)    double variable_; if(oyjlOptions_GetResult( options_, optionL_, NULL, &variable_, NULL ) != oyjlOPTION_USER_CHANGED) variable_ = default_;

obtain result from oyjlOptions_s by name e.g. inside oyjlOPTIONTYPE_FUNCTION callbacks

◆ OYJL_GET_RESULT_INT

#define OYJL_GET_RESULT_INT (   options_,
  optionL_,
  default_,
  variable_ 
)    int variable_; if(oyjlOptions_GetResult( options_, optionL_, NULL, NULL, &variable_ ) != oyjlOPTION_USER_CHANGED) variable_ = default_;

obtain result from oyjlOptions_s by name e.g. inside oyjlOPTIONTYPE_FUNCTION callbacks

◆ OYJL_GET_RESULT_STRING

#define OYJL_GET_RESULT_STRING (   options_,
  optionL_,
  default_,
  variable_ 
)    const char * variable_; if(oyjlOptions_GetResult( options_, optionL_, &variable_, NULL, NULL ) != oyjlOPTION_USER_CHANGED) variable_ = default_;

Obtain result from oyjlOptions_s by name e.g. inside oyjlOPTIONTYPE_FUNCTION callbacks. Example: OYJL_GET_RESULT_STRING( opts, "o", NULL, my_o_string_variable );