Blame trio/trio.h

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