72 #define MAX_FLOAT_WIDTH (128*MB_LEN_MAX) 73 #define MAX_INT_WIDTH (64*MB_LEN_MAX) 74 #define MAX_POINTER_WIDTH (128*MB_LEN_MAX) 76 #define SPACE() L" \t" 77 #define DIGITS() L"0123456789" 78 #define INTEGER_SPECS() L"dioxXuc" 79 #define STRING_SPECS() L"s" 80 #define POINTER_SPECS() L"p" 81 #define FLOAT_SPECS() L"fgGeE" 82 #define FLAGS() L"- +0#" 83 #define WC_CSPEC() L'%' 84 #define WC_PSPEC() L'$' 85 #define WC_RADIX() L'.' 86 #define SHORT_SPEC() L'h' 87 #define LONG_SPEC() L'l' 88 #define LONG_DOUBLE_SPEC() L'L' 90 #define GET_WC( wc, mbs, size) (size = mbtowc( &wc, mbs, MB_LEN_MAX), wc) 92 #define REPORT_LINE_WIDTH 72 93 #define REPORT_LINE_INDENT 9 108 #if defined(ENABLE_UNUSED_FUNCTION) 143 va_start (args, format);
149 #if defined(ENABLE_UNUSED_FUNCTION) 156 co_code_module (
int code)
167 co_code_id (
int code)
210 sprintf (label,
" (%d/%d)", co_code_module (code), co_code_id (code));
222 message =
"Warning:";
224 fprintf (file,
"%-*s", REPORT_LINE_INDENT, message);
227 message = co_message ();
229 (length = msg_length + label_length) > co_Report_msg_width;
234 if (msg_length <= co_Report_msg_width)
237 line_length = msg_length;
244 for (line_length = co_Report_msg_width;
246 && !wcschr (
SPACE (), wc); line_length--)
250 if (line_length == 0)
253 line_length = co_Report_msg_width;
267 len = cptr - message;
271 strncpy (line, message, len);
273 fprintf (file,
"%s\n%-*s", line, REPORT_LINE_INDENT,
"");
278 fprintf (file,
"%s%s\n\n", message, label);
301 int default_position = 0;
306 const char *parameter;
337 index = default_position;
340 co_print_parameter (index, type,
342 end - start), width);
346 length = (parameter !=
NULL) ?
strlen (parameter) : 0;
347 adj_ar_replace (co_Current_message, parameter, length, start, end);
372 #if defined (ENABLE_UNUSED_FUNCTION) 413 if (co_Current_arguments)
416 co_Current_arguments =
NULL;
419 if (co_String_values)
422 co_String_values =
NULL;
425 if (co_Current_message)
428 co_Current_message =
NULL;
431 if (co_Conversion_buffer !=
NULL)
434 co_Conversion_buffer =
NULL;
437 if (co_Parameter_string !=
NULL)
440 co_Parameter_string =
NULL;
469 if (!co_Current_arguments)
485 for (error = 0, start = 0; !
error; start = end)
512 string = va_arg (args,
char *);
513 nchars = (int)
strlen (
string) + 1;
556 #if defined(ENABLE_UNUSED_FUNCTION) 568 static const char *bad_index =
"?";
569 static const char *bad_type =
"*";
573 if (!co_Parameter_string)
576 if (co_Parameter_string ==
NULL)
590 if (index < 0 || index >=
adj_ar_length (co_Current_arguments))
610 width > (
int)
strlen (
string) ? width + 1 : (
int)
strlen (
string) + 1);
700 if (result == 0 && val > 0 &&
GET_WC (wc, rest, csize) ==
WC_PSPEC ())
723 while (wcschr (
DIGITS (),
GET_WC (wc, (p += csize), csize)))
806 const char *new_cspec, *end;
809 if (!co_Conversion_buffer)
812 if (co_Conversion_buffer ==
NULL)
static ADJ_ARRAY * co_Conversion_buffer
int intl_mbs_len(const char *mbs)
#define GET_WC(wc, mbs, size)
static CO_DETAIL co_Current_detail
static int co_Current_code
#define REPORT_LINE_INDENT
char * intl_mbs_chr(const char *mbs, wchar_t wc)
#define CO_ER_FMT_BAD_CODE
static ADJ_ARRAY * co_String_values
const char * intl_mbs_nth(const char *mbs, size_t n)
#define CO_ER_FMT_BAD_FORMAT
#define CO_ER_FMT_BAD_DETAIL
void * adj_ar_get_buffer(const ADJ_ARRAY *adj_array_p)
int co_signal(int code, const char *format,...)
union co_argument::@3 value
int intl_mbs_spn(const char *mbs, const wchar_t *chars)
int adj_ar_length(const ADJ_ARRAY *adj_array_p)
static const char * co_conversion_spec(const char *cspec, int size)
static int co_Message_completed
long double long_double_value
#define CO_ERR_BAD_POSITION
int str_to_int32(int *ret_p, char **end_p, const char *str_p, int base)
int adj_ar_replace(ADJ_ARRAY *adj_array_p, const void *src, int src_length, int start, int end)
int adj_ar_append(ADJ_ARRAY *adj_array_p, const void *src, int src_length)
int adj_ar_remove(ADJ_ARRAY *adj_array_p, int start, int end)
static ADJ_ARRAY * co_Parameter_string
static void error(const char *msg)
static ADJ_ARRAY * co_Current_message
static int co_find_conversion(const char *format, int from, int *start, CO_FORMAT_TYPE *type, int *position, int *width)
#define CO_ERR_BAD_DETAIL
enum co_format_type CO_FORMAT_TYPE
static int co_signalv(int code, const char *format, va_list args)
#define CO_ER_FMT_BAD_POSITION
#define LONG_DOUBLE_SPEC()
#define MAX_POINTER_WIDTH
ADJ_ARRAY * adj_ar_new(int element_size, int min, float growth_rate)
#define REPORT_LINE_WIDTH
#define CO_ERR_BAD_FORMAT
static ADJ_ARRAY * co_Current_arguments
int adj_ar_initialize(ADJ_ARRAY *adj_array_p, const void *initial, int initial_length)
void adj_ar_free(ADJ_ARRAY *adj_array_p)