#ifdef AIX_PROD
/* @(#)56	1.3  src/threads/cma_stdio.h, threads.src, os2dce21.dss, 960602a.1  11/10/95  13:18:54 */
/*
 * COMPONENT_NAME:  threads.src 
 *
 * FUNCTIONS: 
 *
 * ORIGINS: 72
 *
 * OBJECT CODE ONLY SOURCE MATERIALS
 *
 */
#endif /* AIX_PROD */
/*
 * (c) Copyright 1990, 1991 OPEN SOFTWARE FOUNDATION, INC.
 * ALL RIGHTS RESERVED
 */
/*
 * HISTORY
 * $Log: cma_stdio.h,v $
 * Revision 1.2  1992/01/19  22:14:47  devrcs
 * Dropping DCE1.0 OSF1_misc port archive
 *
 * $EndLog$
 */
/*
 */

/*
 *  OSF DCE Version 1.0 
 */
/*
 *  Copyright (c) 1990, 1991 by
 *  Digital Equipment Corporation, Maynard Massachusetts.
 *  All rights reserved.
 *
 *  This software is furnished under a license and may be used and  copied
 *  only  in  accordance  with  the  terms  of  such  license and with the
 *  inclusion of the above copyright notice.  This software or  any  other
 *  copies  thereof may not be provided or otherwise made available to any
 *  other person.  No title to and ownership of  the  software  is  hereby
 *  transferred.
 *
 *  The information in this software is subject to change  without  notice
 *  and  should  not  be  construed  as  a commitment by DIGITAL Equipment
 *  Corporation.
 *
 *  DIGITAL assumes no responsibility for the use or  reliability  of  its
 *  software on equipment which is not supplied by DIGITAL.
 */

/*
 *  FACILITY:
 *
 *	Concert Multhithread (tm) Architecture
 *
 *  ABSTRACT:
 *
 *	Header file for example jacket routines which make the selected
 *	C run-time library routines thread reentrant.  These jackets are
 *	transparent to the calling code, so that, when a reentrant version
 *	of the library becomes available, they can be dispensed with without
 *	requiring changes to the calling code.
 *
 *  AUTHORS:
 *
 *	Webb Scales
 *
 *  CREATION DATE:
 *
 *	29 June 1990
 *
 *  MODIFICATION HISTORY:
 * 
 *	001	Paul Curtin	26 October 1990
 *		Added if's to scanf functions, dependent upon (v)ariable
 * 		versions.
 *	002	Paul Curtin	19 November 1990
 *		Conditionally removed protos on vms for; cma_pclose, cma_popen,
 *		cma_setbuffer, cma_setlinebuf, cma_tempnam, and cma_ttyslot
 *	003	Paul Curtin	21 November 1990
 *		Rearranged conditional exclusion
 *	004	Paul Curtin	31 January 1991
 *		Removed conditional types for cma prototypes, to match `man'
 * 		pgs.
 *	005	Paul Curtin	25 February 1991
 * 		Conditionalized *scanf* defines, because the wrapper 
 *		routines are dependent upon v*scanf versions that are 
 *		not currently available.
 *	006	Paul Curtin	23 April 1991
 *		Changed the parameter name template to filespec for cma_mktemp.
 *	007	Dave Butenhof	27 August 1991
 *		Fix v*printf functions so they'll work.
 *	008	Dave Butenhof	04 September 1991
 *		Include stdarg.h or varargs.h to define the va_list type used
 *		in the vprintf functions.
 *	009	Dave Butenhof	18 September 1991
 *		Integrate Apollo CMA5 reverse drop: fix putchar() macro to
 *		output to stdout rather than stdin.
 *	010	Dave Butenhof	19 September 1991
 *		Integrate HPUX CMA5 reverse drop: exclude wrappers if
 *		_POSIX_REENTRANT_FUNCTIONS, and exclude several wrappers
 *		(for unimplemented functions) anyway for HPUX.
 *	011	Dave Butenhof	01 October 1991
 *		Fix cma_ungetc() prototype to match ANSI C (c is "int", not
 *		"char").
 *	012	Dave Butenhof	03 October 1991
 *		Exclude wrappers if _CMA_THREAD_SYNC_IO_ is defined.
 *	013	Dave Butenhof	19 November 1991
 *		Remove direct check for _POSIX_REENTRANT_FUNCTIONS; rely on
 *		_CMA_REENTRANT_CLIB_, since we control that. OSF/1 defines
 *		_POSIX_REENTRANT_FUNCTIONS, but OSF DCE reference port isn't
 *		using libc_r.a.
 */

#ifndef CMA_STDIO
#define CMA_STDIO

/*
 *  INCLUDE FILES
 */

#if defined(vms) || defined(__vms) || defined(VMS) || defined(__VMS)
# include <cma.h>
#else
# include <dce/cma.h>
#endif

#include <stdio.h>
#include <limits.h>
#include <nl_types.h>

#if _CMA_OSIMPL_ == _CMA__OS_OSF
# include <unistd.h>
#endif
# include <stdarg.h>

/*
 * MACROS
 */

/*
 * C Run-time Library "Standard I/O" Routine Wrappers
 */
#if !_CMA_REENTRANT_CLIB_

# define ctermid	cma_ctermid 
# define cuserid	cma_cuserid 
# define fclose		cma_fclose 
# define fflush		cma_fflush 
# define fdopen		cma_fdopen 
# define fgetc		cma_fgetc 
# define fgets		cma_fgets 
# define fopen		cma_fopen 
# define fprintf	cma_fprintf 
# define fputc		cma_fputc 
# define fputs		cma_fputs 
# define fread		cma_fread 
# define freopen	cma_freopen 
# define fseek		cma_fseek 
# define ftell		cma_ftell 
# define fwrite		cma_fwrite 
# define gets		cma_gets 
# define getw		cma_getw 
# define isatty		cma_isatty 
# define mktemp		cma_mktemp 
# define printf		cma_printf 
# define puts		cma_puts 
# define putw		cma_putw 
# define rewind		cma_rewind 
# define setbuf		cma_setbuf 
# define setvbuf	cma_setvbuf 
# define sprintf	cma_sprintf 
# define tmpfile	cma_tmpfile 
# define tmpnam		cma_tmpnam 
# define ttyname	cma_ttyname 
# define catopen        cma_catopen
# define catgets        cma_catgets
# define catclose       cma_catclose


# if vfscanf_present
#  define scanf		cma_scanf 
#  define fscanf	cma_fscanf 
#  define sscanf	cma_sscanf 
# endif

# if _CMA_OS_ != _CMA__VMS
#  define pclose	cma_pclose 
#  define popen		cma_popen 
#  ifndef __hpux
#   define setbuffer	cma_setbuffer 
#   define setlinebuf	cma_setlinebuf 
#  endif
#  define tempnam	cma_tempnam 
#  define ttyslot	cma_ttyslot
# endif

# undef	getc
# define	getc	cma_fgetc

# undef	getchar
# define getchar()	cma_fgetc (stdin)

# undef putc
# define putc		cma_fputc

# undef	putchar
# define putchar(c)	cma_fputc (c, stdout)

/*
 * INTERFACES
 */

extern char *
cma_ctermid (
	char	*s);

extern char *
cma_cuserid (
	char	*s);

extern int
cma_fclose (
	FILE	*stream);

extern int
cma_fflush (
	FILE	*stream);

extern FILE *
cma_fdopen (
	int	fildes,
	char	*type);

extern int
cma_fgetc (
	FILE	*stream);

extern char *
cma_fgets (
	char	*s,
	int	n,
	FILE	*stream);

extern FILE *
cma_fopen (
	char	*filename,
	char	*type);

extern int
cma_fprintf (
	FILE	*stream,
	char	*format,
	...);

extern int
cma_fputc (
	int	c,
	FILE	*stream);

extern int
cma_fputs (
	char	*s,
	FILE	*stream);

extern int
cma_fread (
	char	*ptr,
	unsigned size,
	unsigned nitems,
	FILE	*stream);

extern FILE *
cma_freopen (
	char	*filename,
	char	*type,
	FILE	*stream);

#if vfscanf_present
extern int
cma_fscanf (
	FILE	*stream,
	char	*format,
	...);
#endif

extern int
cma_fseek (
	FILE	*stream,
	long	offset,
	int	ptrname);

extern long
cma_ftell (
	FILE	*stream);

extern int
cma_fwrite (
	char	*ptr,
	unsigned size,
	unsigned nitems,
	FILE	*stream);

extern char *
cma_gets (
	char	*s);

extern int
cma_getw (
	FILE	*stream);

extern int
cma_isatty (
	int	filedes);

extern char *
cma_mktemp (
	char	*filespec);

#ifndef vms
/* pclose and popen do not exist on vms */
extern int
cma_pclose (
    FILE	*stream);

extern FILE *
cma_popen (
	char	*command,
	char	*type);
#endif

extern int
cma_printf (
	char	*format,
	...);

extern int
cma_puts (
	char	*s);

extern int
cma_putw (
	int	w,
	FILE	*stream);

extern void 
cma_rewind (
	FILE *stream);

#if vscanf_present
extern int
cma_scanf (
	char	*format,
	...);
#endif

extern void
cma_setbuf (
	FILE	*stream,
	char	*buf);

#if _CMA_OS_ != _CMA__VMS && !defined(__hpux)
/* setbuffer and setlinebuf do not exist on vms or HPUX */
extern void
cma_setbuffer (
	FILE	*stream,
	char	*buf,
	int	size);

extern void
cma_setlinebuf (
	FILE	*stream);
#endif

#if _CMA_HARDWARE_ == _CMA__MIPS || _CMA_HARDWARE_ == _CMA__VAX
extern void
#else
extern int
#endif
cma_setvbuf (
	FILE	*stream,
	char	*buf,
	int	type,
	int	size);

#if defined(SYSV) || (_CMA_VENDOR_ == _CMA__IBM)
extern int
#else
extern char *
#endif
cma_sprintf (
	char	*s,
	char	*format,
	...);

#if vsscanf_present
extern int
cma_sscanf (
	char	*s,
	char	*format,
	...);
#endif

#ifndef vms
/* tempnam does not exist on vms */
extern char *
cma_tempnam (
	char	*dir, 
	char	*pfx);
#endif

extern FILE *
cma_tmpfile (void);

extern char *
cma_tmpnam (
	char	*s);

extern char *
cma_ttyname (
	int	filedes);

#ifndef vms
/* ttyslot does not exist on vms */
extern int
cma_ttyslot (void);
#endif

extern char
cma_ungetc (
	int	c,
	FILE	*stream);

extern int
cma_vfprintf (
	FILE	*stream,
	char	*format,
	va_list	ap);

extern int
cma_vprintf (
	char	*format,
	va_list	ap);

#ifdef SYSV
extern int
#else
extern char *
#endif
cma_vsprintf (
	char	*s,
	char	*format,
	va_list	ap);

extern nl_catd
cma_catopen (
	char    *name,
	int     oflag);

extern char *
cma_catgets (
        nl_catd cat_descriptor,
        int     set_number,
        int     message_number,
        char    *string);

extern int
cma_catclose (
        nl_catd cat_descriptor);

#endif /* _CMA_REENTRANT_CLIB_ */

#endif




