blob: ca49fabb0aa956fa8a806db61ea87db1a1e5b084 [file] [log] [blame]
Bjorn Reese70a9da52001-04-21 16:57:29 +00001/*************************************************************************
2 *
3 * $Id$
4 *
5 * Copyright (C) 2000 Bjorn Reese and Daniel Stenberg.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
13 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
14 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
15 *
16 ************************************************************************
17 *
18 * Private functions, types, etc. used for callback functions.
19 *
20 * The ref pointer is an opaque type and should remain as such.
21 * Private data must only be accessible through the getter and
22 * setter functions.
23 *
24 ************************************************************************/
25
26#ifndef TRIO_TRIOP_H
27#define TRIO_TRIOP_H
28
Bjorn Reese906ec8a2001-06-05 12:46:33 +000029#include <stdlib.h>
Bjorn Reese70a9da52001-04-21 16:57:29 +000030
Bjorn Reese906ec8a2001-06-05 12:46:33 +000031#ifdef __cplusplus
32extern "C" {
33#endif
34
35#ifndef TRIO_C99
36# define TRIO_C99 1
37#endif
38#ifndef TRIO_BSD
39# define TRIO_BSD 1
40#endif
41#ifndef TRIO_GNU
42# define TRIO_GNU 1
43#endif
44#ifndef TRIO_MISC
45# define TRIO_MISC 1
46#endif
47#ifndef TRIO_UNIX98
48# define TRIO_UNIX98 1
49#endif
50#ifndef TRIO_MICROSOFT
51# define TRIO_MICROSOFT 1
52#endif
53#ifndef TRIO_EXTENSION
54# define TRIO_EXTENSION 1
55#endif
56#ifndef TRIO_WIDECHAR
57# define TRIO_WIDECHAR 0
58#endif
59#ifndef TRIO_ERRORS
60# define TRIO_ERRORS 1
61#endif
62
63#ifndef TRIO_MALLOC
64# define TRIO_MALLOC(n) malloc(n)
65#endif
66#ifndef TRIO_REALLOC
67# define TRIO_REALLOC(x,n) realloc((x),(n))
68#endif
69#ifndef TRIO_FREE
70# define TRIO_FREE(x) free(x)
71#endif
Bjorn Reese70a9da52001-04-21 16:57:29 +000072
73typedef int (*trio_callback_t)(void *ref);
74
75void *trio_register(trio_callback_t callback, const char *name);
76void trio_unregister(void *handle);
77
78const char *trio_get_format(void *ref);
79void *trio_get_argument(void *ref);
80
81/* Modifiers */
82int trio_get_width(void *ref);
83void trio_set_width(void *ref, int width);
84int trio_get_precision(void *ref);
85void trio_set_precision(void *ref, int precision);
86int trio_get_base(void *ref);
87void trio_set_base(void *ref, int base);
88int trio_get_padding(void *ref);
89void trio_set_padding(void *ref, int is_padding);
90int trio_get_short(void *ref); /* h */
91void trio_set_shortshort(void *ref, int is_shortshort);
92int trio_get_shortshort(void *ref); /* hh */
93void trio_set_short(void *ref, int is_short);
94int trio_get_long(void *ref); /* l */
95void trio_set_long(void *ref, int is_long);
96int trio_get_longlong(void *ref); /* ll */
97void trio_set_longlong(void *ref, int is_longlong);
98int trio_get_longdouble(void *ref); /* L */
99void trio_set_longdouble(void *ref, int is_longdouble);
100int trio_get_alternative(void *ref); /* # */
101void trio_set_alternative(void *ref, int is_alternative);
102int trio_get_alignment(void *ref); /* - */
103void trio_set_alignment(void *ref, int is_leftaligned);
104int trio_get_spacing(void *ref); /* (space) */
105void trio_set_spacing(void *ref, int is_space);
106int trio_get_sign(void *ref); /* + */
107void trio_set_sign(void *ref, int is_showsign);
108int trio_get_quote(void *ref); /* ' */
109void trio_set_quote(void *ref, int is_quote);
110int trio_get_upper(void *ref);
111void trio_set_upper(void *ref, int is_upper);
Bjorn Reese906ec8a2001-06-05 12:46:33 +0000112#if TRIO_C99
Bjorn Reese70a9da52001-04-21 16:57:29 +0000113int trio_get_largest(void *ref); /* j */
114void trio_set_largest(void *ref, int is_largest);
115int trio_get_ptrdiff(void *ref); /* t */
116void trio_set_ptrdiff(void *ref, int is_ptrdiff);
117int trio_get_size(void *ref); /* z / Z */
118void trio_set_size(void *ref, int is_size);
119#endif
120
121/* Printing */
122int trio_print_ref(void *ref, const char *format, ...);
123int trio_vprint_ref(void *ref, const char *format, va_list args);
124int trio_printv_ref(void *ref, const char *format, void **args);
125
126void trio_print_int(void *ref, int number);
127void trio_print_uint(void *ref, unsigned int number);
128/* void trio_print_long(void *ref, long number); */
129/* void trio_print_ulong(void *ref, unsigned long number); */
130void trio_print_double(void *ref, double number);
131void trio_print_string(void *ref, char *string);
132void trio_print_pointer(void *ref, void *pointer);
133
Bjorn Reese906ec8a2001-06-05 12:46:33 +0000134#ifdef __cplusplus
135} /* extern "C" */
136#endif
137
Bjorn Reese70a9da52001-04-21 16:57:29 +0000138#endif /* TRIO_TRIOP_H */