1/***********************************************************************
2*                                                                      *
3*               This software is part of the ast package               *
4*          Copyright (c) 1985-2010 AT&T Intellectual Property          *
5*                      and is licensed under the                       *
6*                  Common Public License, Version 1.0                  *
7*                    by AT&T Intellectual Property                     *
8*                                                                      *
9*                A copy of the License is available at                 *
10*            http://www.opensource.org/licenses/cpl1.0.txt             *
11*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12*                                                                      *
13*              Information and Software Systems Research               *
14*                            AT&T Research                             *
15*                           Florham Park NJ                            *
16*                                                                      *
17*                 Glenn Fowler <gsf@research.att.com>                  *
18*                  David Korn <dgk@research.att.com>                   *
19*                   Phong Vo <kpv@research.att.com>                    *
20*                                                                      *
21***********************************************************************/
22#pragma prototyped
23
24#ifndef _STDHDR_H
25#define _STDHDR_H	1
26
27#ifndef _NO_LARGEFILE64_SOURCE
28#define _NO_LARGEFILE64_SOURCE	1
29#endif
30#undef	_LARGEFILE64_SOURCE
31
32#define _ast_fseeko	______fseeko
33#define _ast_ftello	______ftello
34#include "sfhdr.h"
35#undef	_ast_fseeko
36#undef	_ast_ftello
37
38#include "stdio.h"
39
40#define SF_MB		010000
41#define SF_WC		020000
42
43#if _UWIN
44
45#define STDIO_TRANSFER	1
46
47typedef int (*Fun_f)();
48
49typedef struct Funvec_s
50{
51	const char*	name;
52	Fun_f		vec[2];
53} Funvec_t;
54
55extern int	_stdfun(Sfio_t*, Funvec_t*);
56
57#define STDIO_INT(p,n,t,f,a) \
58	{ \
59		typedef t (*_s_f)f; \
60		int		_i; \
61		static Funvec_t	_v = { n }; \
62		if ((_i = _stdfun(p, &_v)) < 0) \
63			return -1; \
64		else if (_i > 0) \
65			return ((_s_f)_v.vec[_i])a; \
66	}
67
68#define STDIO_PTR(p,n,t,f,a) \
69	{ \
70		typedef t (*_s_f)f; \
71		int		_i; \
72		static Funvec_t	_v = { n }; \
73		if ((_i = _stdfun(p, &_v)) < 0) \
74			return 0; \
75		else if (_i > 0) \
76			return ((_s_f)_v.vec[_i])a; \
77	}
78
79#define STDIO_VOID(p,n,t,f,a) \
80	{ \
81		typedef t (*_s_f)f; \
82		int		_i; \
83		static Funvec_t	_v = { n }; \
84		if ((_i = _stdfun(p, &_v)) < 0) \
85			return; \
86		else if (_i > 0) \
87		{ \
88			((_s_f)_v.vec[_i])a; \
89			return; \
90		} \
91	}
92
93#else
94
95#define STDIO_INT(p,n,t,f,a)
96#define STDIO_PTR(p,n,t,f,a)
97#define STDIO_VOID(p,n,t,f,a)
98
99#endif
100
101#define FWIDE(f,r) \
102	do \
103	{ \
104		if (fwide(f, 0) < 0) \
105			return r; \
106		f->bits |= SF_WC; \
107	} while (0)
108
109#ifdef __EXPORT__
110#define extern	__EXPORT__
111#endif
112
113extern int		sfdcwide(Sfio_t*);
114
115#endif
116