Blame trio/trio.h

Packit Service a2489d
/*************************************************************************
Packit Service a2489d
 *
Packit Service a2489d
 * $Id: trio.h,v 1.15 2002/06/23 11:58:06 breese Exp $
Packit Service a2489d
 *
Packit Service a2489d
 * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
Packit Service a2489d
 *
Packit Service a2489d
 * Permission to use, copy, modify, and distribute this software for any
Packit Service a2489d
 * purpose with or without fee is hereby granted, provided that the above
Packit Service a2489d
 * copyright notice and this permission notice appear in all copies.
Packit Service a2489d
 *
Packit Service a2489d
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
Packit Service a2489d
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
Packit Service a2489d
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
Packit Service a2489d
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
Packit Service a2489d
 *
Packit Service a2489d
 *************************************************************************
Packit Service a2489d
 *
Packit Service a2489d
 * http://ctrio.sourceforge.net/
Packit Service a2489d
 *
Packit Service a2489d
 ************************************************************************/
Packit Service a2489d
Packit Service a2489d
#ifndef TRIO_TRIO_H
Packit Service a2489d
#define TRIO_TRIO_H
Packit Service a2489d
Packit Service a2489d
#include <stdio.h>
Packit Service a2489d
#include <stdlib.h>
Packit Service a2489d
#if defined(TRIO_COMPILER_ANCIENT)
Packit Service a2489d
# include <varargs.h>
Packit Service a2489d
#else
Packit Service a2489d
# include <stdarg.h>
Packit Service a2489d
#endif
Packit Service a2489d
Packit Service a2489d
#if !defined(WITHOUT_TRIO)
Packit Service a2489d
Packit Service a2489d
/*
Packit Service a2489d
 * Use autoconf defines if present. Packages using trio must define
Packit Service a2489d
 * HAVE_CONFIG_H as a compiler option themselves.
Packit Service a2489d
 */
Packit Service a2489d
#if defined(HAVE_CONFIG_H)
Packit Service a2489d
# include <config.h>
Packit Service a2489d
#endif
Packit Service a2489d
Packit Service a2489d
#include "triodef.h"
Packit Service a2489d
Packit Service a2489d
#ifdef __cplusplus
Packit Service a2489d
extern "C" {
Packit Service a2489d
#endif
Packit Service a2489d
Packit Service a2489d
/*
Packit Service a2489d
 * Error codes.
Packit Service a2489d
 *
Packit Service a2489d
 * Remember to add a textual description to trio_strerror.
Packit Service a2489d
 */
Packit Service a2489d
enum {
Packit Service a2489d
  TRIO_EOF      = 1,
Packit Service a2489d
  TRIO_EINVAL   = 2,
Packit Service a2489d
  TRIO_ETOOMANY = 3,
Packit Service a2489d
  TRIO_EDBLREF  = 4,
Packit Service a2489d
  TRIO_EGAP     = 5,
Packit Service a2489d
  TRIO_ENOMEM   = 6,
Packit Service a2489d
  TRIO_ERANGE   = 7,
Packit Service a2489d
  TRIO_ERRNO    = 8,
Packit Service a2489d
  TRIO_ECUSTOM  = 9
Packit Service a2489d
};
Packit Service a2489d
Packit Service a2489d
/* Error macros */
Packit Service a2489d
#define TRIO_ERROR_CODE(x) ((-(x)) & 0x00FF)
Packit Service a2489d
#define TRIO_ERROR_POSITION(x) ((-(x)) >> 8)
Packit Service a2489d
#define TRIO_ERROR_NAME(x) trio_strerror(x)
Packit Service a2489d
Packit Service a2489d
typedef int (*trio_outstream_t) TRIO_PROTO((trio_pointer_t, int));
Packit Service a2489d
typedef int (*trio_instream_t) TRIO_PROTO((trio_pointer_t));
Packit Service a2489d
Packit Service a2489d
TRIO_CONST char *trio_strerror TRIO_PROTO((int));
Packit Service a2489d
Packit Service a2489d
/*************************************************************************
Packit Service a2489d
 * Print Functions
Packit Service a2489d
 */
Packit Service a2489d
Packit Service a2489d
int trio_printf TRIO_PROTO((TRIO_CONST char *format, ...));
Packit Service a2489d
int trio_vprintf TRIO_PROTO((TRIO_CONST char *format, va_list args));
Packit Service a2489d
int trio_printfv TRIO_PROTO((TRIO_CONST char *format, void **args));
Packit Service a2489d
Packit Service a2489d
int trio_fprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...));
Packit Service a2489d
int trio_vfprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args));
Packit Service a2489d
int trio_fprintfv TRIO_PROTO((FILE *file, TRIO_CONST char *format, void **args));
Packit Service a2489d
Packit Service a2489d
int trio_dprintf TRIO_PROTO((int fd, TRIO_CONST char *format, ...));
Packit Service a2489d
int trio_vdprintf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args));
Packit Service a2489d
int trio_dprintfv TRIO_PROTO((int fd, TRIO_CONST char *format, void **args));
Packit Service a2489d
Packit Service a2489d
int trio_cprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
Packit Service a2489d
			     TRIO_CONST char *format, ...));
Packit Service a2489d
int trio_vcprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
Packit Service a2489d
			      TRIO_CONST char *format, va_list args));
Packit Service a2489d
int trio_cprintfv TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
Packit Service a2489d
			      TRIO_CONST char *format, void **args));
Packit Service a2489d
Packit Service a2489d
int trio_sprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, ...));
Packit Service a2489d
int trio_vsprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, va_list args));
Packit Service a2489d
int trio_sprintfv TRIO_PROTO((char *buffer, TRIO_CONST char *format, void **args));
Packit Service a2489d
Packit Service a2489d
int trio_snprintf TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...));
Packit Service a2489d
int trio_vsnprintf TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
Packit Service a2489d
		   va_list args));
Packit Service a2489d
int trio_snprintfv TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
Packit Service a2489d
		   void **args));
Packit Service a2489d
Packit Service a2489d
int trio_snprintfcat TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...));
Packit Service a2489d
int trio_vsnprintfcat TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
Packit Service a2489d
                      va_list args));
Packit Service a2489d
Packit Service a2489d
char *trio_aprintf TRIO_PROTO((TRIO_CONST char *format, ...));
Packit Service a2489d
char *trio_vaprintf TRIO_PROTO((TRIO_CONST char *format, va_list args));
Packit Service a2489d
Packit Service a2489d
int trio_asprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, ...));
Packit Service a2489d
int trio_vasprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, va_list args));
Packit Service a2489d
Packit Service a2489d
/*************************************************************************
Packit Service a2489d
 * Scan Functions
Packit Service a2489d
 */
Packit Service a2489d
int trio_scanf TRIO_PROTO((TRIO_CONST char *format, ...));
Packit Service a2489d
int trio_vscanf TRIO_PROTO((TRIO_CONST char *format, va_list args));
Packit Service a2489d
int trio_scanfv TRIO_PROTO((TRIO_CONST char *format, void **args));
Packit Service a2489d
Packit Service a2489d
int trio_fscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...));
Packit Service a2489d
int trio_vfscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args));
Packit Service a2489d
int trio_fscanfv TRIO_PROTO((FILE *file, TRIO_CONST char *format, void **args));
Packit Service a2489d
Packit Service a2489d
int trio_dscanf TRIO_PROTO((int fd, TRIO_CONST char *format, ...));
Packit Service a2489d
int trio_vdscanf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args));
Packit Service a2489d
int trio_dscanfv TRIO_PROTO((int fd, TRIO_CONST char *format, void **args));
Packit Service a2489d
Packit Service a2489d
int trio_cscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
Packit Service a2489d
			    TRIO_CONST char *format, ...));
Packit Service a2489d
int trio_vcscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
Packit Service a2489d
			     TRIO_CONST char *format, va_list args));
Packit Service a2489d
int trio_cscanfv TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
Packit Service a2489d
			     TRIO_CONST char *format, void **args));
Packit Service a2489d
Packit Service a2489d
int trio_sscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, ...));
Packit Service a2489d
int trio_vsscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, va_list args));
Packit Service a2489d
int trio_sscanfv TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, void **args));
Packit Service a2489d
Packit Service a2489d
/*************************************************************************
Packit Service a2489d
 * Locale Functions
Packit Service a2489d
 */
Packit Service a2489d
void trio_locale_set_decimal_point TRIO_PROTO((char *decimalPoint));
Packit Service a2489d
void trio_locale_set_thousand_separator TRIO_PROTO((char *thousandSeparator));
Packit Service a2489d
void trio_locale_set_grouping TRIO_PROTO((char *grouping));
Packit Service a2489d
Packit Service a2489d
/*************************************************************************
Packit Service a2489d
 * Renaming
Packit Service a2489d
 */
Packit Service a2489d
#ifdef TRIO_REPLACE_STDIO
Packit Service a2489d
/* Replace the <stdio.h> functions */
Packit Service a2489d
#ifndef HAVE_PRINTF
Packit Service a2489d
# define printf trio_printf
Packit Service a2489d
#endif
Packit Service a2489d
#ifndef HAVE_VPRINTF
Packit Service a2489d
# define vprintf trio_vprintf
Packit Service a2489d
#endif
Packit Service a2489d
#ifndef HAVE_FPRINTF
Packit Service a2489d
# define fprintf trio_fprintf
Packit Service a2489d
#endif
Packit Service a2489d
#ifndef HAVE_VFPRINTF
Packit Service a2489d
# define vfprintf trio_vfprintf
Packit Service a2489d
#endif
Packit Service a2489d
#ifndef HAVE_SPRINTF
Packit Service a2489d
# define sprintf trio_sprintf
Packit Service a2489d
#endif
Packit Service a2489d
#ifndef HAVE_VSPRINTF
Packit Service a2489d
# define vsprintf trio_vsprintf
Packit Service a2489d
#endif
Packit Service a2489d
#ifndef HAVE_SNPRINTF
Packit Service a2489d
# define snprintf trio_snprintf
Packit Service a2489d
#endif
Packit Service a2489d
#ifndef HAVE_VSNPRINTF
Packit Service a2489d
# define vsnprintf trio_vsnprintf
Packit Service a2489d
#endif
Packit Service a2489d
#ifndef HAVE_SCANF
Packit Service a2489d
# define scanf trio_scanf
Packit Service a2489d
#endif
Packit Service a2489d
#ifndef HAVE_VSCANF
Packit Service a2489d
# define vscanf trio_vscanf
Packit Service a2489d
#endif
Packit Service a2489d
#ifndef HAVE_FSCANF
Packit Service a2489d
# define fscanf trio_fscanf
Packit Service a2489d
#endif
Packit Service a2489d
#ifndef HAVE_VFSCANF
Packit Service a2489d
# define vfscanf trio_vfscanf
Packit Service a2489d
#endif
Packit Service a2489d
#ifndef HAVE_SSCANF
Packit Service a2489d
# define sscanf trio_sscanf
Packit Service a2489d
#endif
Packit Service a2489d
#ifndef HAVE_VSSCANF
Packit Service a2489d
# define vsscanf trio_vsscanf
Packit Service a2489d
#endif
Packit Service a2489d
/* These aren't stdio functions, but we make them look similar */
Packit Service a2489d
#define dprintf trio_dprintf
Packit Service a2489d
#define vdprintf trio_vdprintf
Packit Service a2489d
#define aprintf trio_aprintf
Packit Service a2489d
#define vaprintf trio_vaprintf
Packit Service a2489d
#define asprintf trio_asprintf
Packit Service a2489d
#define vasprintf trio_vasprintf
Packit Service a2489d
#define dscanf trio_dscanf
Packit Service a2489d
#define vdscanf trio_vdscanf
Packit Service a2489d
#endif
Packit Service a2489d
Packit Service a2489d
#ifdef __cplusplus
Packit Service a2489d
} /* extern "C" */
Packit Service a2489d
#endif
Packit Service a2489d
Packit Service a2489d
#endif /* WITHOUT_TRIO */
Packit Service a2489d
Packit Service a2489d
#endif /* TRIO_TRIO_H */