1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5/***
6* mbusafecrt_internal.h - internal declarations for SafeCRT functions
7*
8
9*
10* Purpose:
11* This file contains the internal declarations SafeCRT
12* functions ported to MacOS. These are the safe versions of
13* functions standard functions banned by SWI
14****/
15
16/* shields! */
17
18#ifndef MBUSAFECRT_INTERNAL_H
19#define MBUSAFECRT_INTERNAL_H
20
21#include "pal_char16.h"
22#include "pal_mstypes.h"
23
24typedef __builtin_va_list va_list;
25
26// The ifdef below are to accommodate Unix build
27// that complains about them being declared in stdarg.h already.
28#ifndef va_start
29#define va_start __builtin_va_start
30#endif
31#ifndef va_end
32#define va_end __builtin_va_end
33#endif
34
35#include "mbusafecrt.h"
36
37#ifdef EOF
38#undef EOF
39#endif
40#define EOF -1
41
42#ifdef WEOF
43#undef WEOF
44#endif
45#define WEOF -1
46
47#define CASSERT(p) extern int sanity_check_dummy[1+((!(p))*(-2))];
48
49extern tSafeCRT_AssertFuncPtr sMBUSafeCRTAssertFunc;
50
51typedef struct miniFILE_struct
52{
53 char* _ptr;
54 int _cnt;
55 char* _base;
56 int _flag;
57} miniFILE;
58
59#define _IOSTRG 1
60#define _IOWRT 2
61#define _IOREAD 4
62#define _IOMYBUF 8
63
64int _putc_nolock( char inChar, miniFILE* inStream );
65int _putwc_nolock( wchar_t inChar, miniFILE* inStream );
66int _getc_nolock( miniFILE* inStream );
67int _getwc_nolock( miniFILE* inStream );
68int _ungetc_nolock( char inChar, miniFILE* inStream );
69int _ungetwc_nolock( wchar_t inChar, miniFILE* inStream );
70
71errno_t _safecrt_cfltcvt(double *arg, char *buffer, size_t sizeInBytes, int type, int precision, int flags);
72
73void _safecrt_fassign(int flag, void* argument, char * number );
74void _safecrt_wfassign(int flag, void* argument, wchar_t * number );
75
76int _minimal_chartowchar( wchar_t* outWChar, const char* inChar );
77
78int _output_s( miniFILE* outfile, const char* _Format, va_list _ArgList);
79int _woutput_s( miniFILE* outfile, const wchar_t* _Format, va_list _ArgList);
80int _output( miniFILE *outfile, const char* _Format, va_list _ArgList);
81
82int _soutput_s( char *_Dst, size_t _Size, const char *_Format, va_list _ArgList );
83int _swoutput_s( wchar_t *_Dst, size_t _Size, const wchar_t *_Format, va_list _ArgList );
84
85int __tinput_s( miniFILE* inFile, const unsigned char * inFormat, va_list inArgList );
86int __twinput_s( miniFILE* inFile, const wchar_t * inFormat, va_list inArgList );
87
88#endif /* MBUSAFECRT_INTERNAL_H */
89