blob: 8462c56f8777d06d5b740fbe3e639d58d30ea101 [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
Daniel Veillardb7c29c32002-09-25 22:44:43 +000029#include "triodef.h"
30
Bjorn Reese906ec8a2001-06-05 12:46:33 +000031#include <stdlib.h>
Daniel Veillardb7c29c32002-09-25 22:44:43 +000032#if defined(TRIO_COMPILER_ANCIENT)
33# include <varargs.h>
34#else
35# include <stdarg.h>
36#endif
Bjorn Reese70a9da52001-04-21 16:57:29 +000037
Bjorn Reese906ec8a2001-06-05 12:46:33 +000038#ifdef __cplusplus
39extern "C" {
40#endif
41
42#ifndef TRIO_C99
43# define TRIO_C99 1
44#endif
45#ifndef TRIO_BSD
46# define TRIO_BSD 1
47#endif
48#ifndef TRIO_GNU
49# define TRIO_GNU 1
50#endif
51#ifndef TRIO_MISC
52# define TRIO_MISC 1
53#endif
54#ifndef TRIO_UNIX98
55# define TRIO_UNIX98 1
56#endif
57#ifndef TRIO_MICROSOFT
58# define TRIO_MICROSOFT 1
59#endif
60#ifndef TRIO_EXTENSION
61# define TRIO_EXTENSION 1
62#endif
Bjorn Reese026d29f2002-01-19 15:40:18 +000063#ifndef TRIO_WIDECHAR /* Does not work yet. Do not enable */
Bjorn Reese906ec8a2001-06-05 12:46:33 +000064# define TRIO_WIDECHAR 0
65#endif
66#ifndef TRIO_ERRORS
67# define TRIO_ERRORS 1
68#endif
69
70#ifndef TRIO_MALLOC
71# define TRIO_MALLOC(n) malloc(n)
72#endif
73#ifndef TRIO_REALLOC
74# define TRIO_REALLOC(x,n) realloc((x),(n))
75#endif
76#ifndef TRIO_FREE
77# define TRIO_FREE(x) free(x)
78#endif
Bjorn Reese70a9da52001-04-21 16:57:29 +000079
Daniel Veillardb7c29c32002-09-25 22:44:43 +000080
Bjorn Reese026d29f2002-01-19 15:40:18 +000081/*************************************************************************
82 * User-defined specifiers
83 */
84
Daniel Veillardb7c29c32002-09-25 22:44:43 +000085typedef int (*trio_callback_t) TRIO_PROTO((trio_pointer_t));
Bjorn Reese70a9da52001-04-21 16:57:29 +000086
Daniel Veillardb7c29c32002-09-25 22:44:43 +000087trio_pointer_t trio_register TRIO_PROTO((trio_callback_t callback, const char *name));
88void trio_unregister TRIO_PROTO((trio_pointer_t handle));
Bjorn Reese70a9da52001-04-21 16:57:29 +000089
Daniel Veillardb7c29c32002-09-25 22:44:43 +000090TRIO_CONST char *trio_get_format TRIO_PROTO((trio_pointer_t ref));
91trio_pointer_t trio_get_argument TRIO_PROTO((trio_pointer_t ref));
Bjorn Reese70a9da52001-04-21 16:57:29 +000092
93/* Modifiers */
Daniel Veillardb7c29c32002-09-25 22:44:43 +000094int trio_get_width TRIO_PROTO((trio_pointer_t ref));
95void trio_set_width TRIO_PROTO((trio_pointer_t ref, int width));
96int trio_get_precision TRIO_PROTO((trio_pointer_t ref));
97void trio_set_precision TRIO_PROTO((trio_pointer_t ref, int precision));
98int trio_get_base TRIO_PROTO((trio_pointer_t ref));
99void trio_set_base TRIO_PROTO((trio_pointer_t ref, int base));
100int trio_get_padding TRIO_PROTO((trio_pointer_t ref));
101void trio_set_padding TRIO_PROTO((trio_pointer_t ref, int is_padding));
102int trio_get_short TRIO_PROTO((trio_pointer_t ref)); /* h */
103void trio_set_shortshort TRIO_PROTO((trio_pointer_t ref, int is_shortshort));
104int trio_get_shortshort TRIO_PROTO((trio_pointer_t ref)); /* hh */
105void trio_set_short TRIO_PROTO((trio_pointer_t ref, int is_short));
106int trio_get_long TRIO_PROTO((trio_pointer_t ref)); /* l */
107void trio_set_long TRIO_PROTO((trio_pointer_t ref, int is_long));
108int trio_get_longlong TRIO_PROTO((trio_pointer_t ref)); /* ll */
109void trio_set_longlong TRIO_PROTO((trio_pointer_t ref, int is_longlong));
110int trio_get_longdouble TRIO_PROTO((trio_pointer_t ref)); /* L */
111void trio_set_longdouble TRIO_PROTO((trio_pointer_t ref, int is_longdouble));
112int trio_get_alternative TRIO_PROTO((trio_pointer_t ref)); /* # */
113void trio_set_alternative TRIO_PROTO((trio_pointer_t ref, int is_alternative));
114int trio_get_alignment TRIO_PROTO((trio_pointer_t ref)); /* - */
115void trio_set_alignment TRIO_PROTO((trio_pointer_t ref, int is_leftaligned));
116int trio_get_spacing TRIO_PROTO((trio_pointer_t ref)); /* TRIO_PROTO((space) */
117void trio_set_spacing TRIO_PROTO((trio_pointer_t ref, int is_space));
118int trio_get_sign TRIO_PROTO((trio_pointer_t ref)); /* + */
119void trio_set_sign TRIO_PROTO((trio_pointer_t ref, int is_showsign));
120int trio_get_quote TRIO_PROTO((trio_pointer_t ref)); /* ' */
121void trio_set_quote TRIO_PROTO((trio_pointer_t ref, int is_quote));
122int trio_get_upper TRIO_PROTO((trio_pointer_t ref));
123void trio_set_upper TRIO_PROTO((trio_pointer_t ref, int is_upper));
Bjorn Reese906ec8a2001-06-05 12:46:33 +0000124#if TRIO_C99
Daniel Veillardb7c29c32002-09-25 22:44:43 +0000125int trio_get_largest TRIO_PROTO((trio_pointer_t ref)); /* j */
126void trio_set_largest TRIO_PROTO((trio_pointer_t ref, int is_largest));
127int trio_get_ptrdiff TRIO_PROTO((trio_pointer_t ref)); /* t */
128void trio_set_ptrdiff TRIO_PROTO((trio_pointer_t ref, int is_ptrdiff));
129int trio_get_size TRIO_PROTO((trio_pointer_t ref)); /* z / Z */
130void trio_set_size TRIO_PROTO((trio_pointer_t ref, int is_size));
Bjorn Reese70a9da52001-04-21 16:57:29 +0000131#endif
132
133/* Printing */
Daniel Veillardb7c29c32002-09-25 22:44:43 +0000134int trio_print_ref TRIO_PROTO((trio_pointer_t ref, const char *format, ...));
135int trio_vprint_ref TRIO_PROTO((trio_pointer_t ref, const char *format, va_list args));
136int trio_printv_ref TRIO_PROTO((trio_pointer_t ref, const char *format, trio_pointer_t *args));
Bjorn Reese70a9da52001-04-21 16:57:29 +0000137
Daniel Veillardb7c29c32002-09-25 22:44:43 +0000138void trio_print_int TRIO_PROTO((trio_pointer_t ref, int number));
139void trio_print_uint TRIO_PROTO((trio_pointer_t ref, unsigned int number));
140/* void trio_print_long TRIO_PROTO((trio_pointer_t ref, long number)); */
141/* void trio_print_ulong TRIO_PROTO((trio_pointer_t ref, unsigned long number)); */
142void trio_print_double TRIO_PROTO((trio_pointer_t ref, double number));
143void trio_print_string TRIO_PROTO((trio_pointer_t ref, char *string));
144void trio_print_pointer TRIO_PROTO((trio_pointer_t ref, trio_pointer_t pointer));
Bjorn Reese70a9da52001-04-21 16:57:29 +0000145
Bjorn Reese906ec8a2001-06-05 12:46:33 +0000146#ifdef __cplusplus
147} /* extern "C" */
148#endif
149
Bjorn Reese70a9da52001-04-21 16:57:29 +0000150#endif /* TRIO_TRIOP_H */