/picolibc-3.7.0-3.6.0/newlib/libc/stdio/ |
D | ungetc.c | 81 register FILE *fp) in __submore() argument 86 if (fp->_ub._base == fp->_ubuf) in __submore() 93 fp->_ub._base = p; in __submore() 94 fp->_ub._size = BUFSIZ; in __submore() 95 p += BUFSIZ - sizeof (fp->_ubuf); in __submore() 96 for (i = sizeof (fp->_ubuf); --i >= 0;) in __submore() 97 p[i] = fp->_ubuf[i]; in __submore() 98 fp->_p = p; in __submore() 101 i = fp->_ub._size; in __submore() 102 p = (unsigned char *) realloc ((void *) (fp->_ub._base), i << 1); in __submore() [all …]
|
D | fseeko.c | 97 register FILE *fp, in fseeko() argument 116 CHECK_INIT (ptr, fp); in fseeko() 118 _newlib_flockfile_start (fp); in fseeko() 123 if (fp->_flags & __SAPP && fp->_flags & __SWR) in fseeko() 126 fflush ( fp); in fseeko() 131 if ((seekfn = fp->_seek) == NULL) in fseeko() 134 _newlib_flockfile_exit (fp); in fseeko() 151 fflush ( fp); /* may adjust seek offset on append stream */ in fseeko() 152 if (fp->_flags & __SOFF) in fseeko() 153 curoff = fp->_offset; in fseeko() [all …]
|
D | refill.c | 27 lflush (FILE *fp) in lflush() argument 29 if ((fp->_flags & (__SLBF | __SWR)) == (__SLBF | __SWR)) in lflush() 30 return fflush ( fp); in lflush() 41 register FILE * fp) in _srefill() argument 45 CHECK_INIT (ptr, fp); in _srefill() 47 fp->_r = 0; /* largely a convenience for callers */ in _srefill() 50 if (fp->_flags & __SEOF) in _srefill() 54 if ((fp->_flags & __SRD) == 0) in _srefill() 56 if ((fp->_flags & __SRW) == 0) in _srefill() 59 fp->_flags |= __SERR; in _srefill() [all …]
|
D | fflush.c | 105 register FILE * fp) in _sflush() argument 112 flags = fp->_flags; in _sflush() 119 fp->_flags |= __SNPT; in _sflush() 129 if ((fp->_r > 0 || fp->_ur > 0) && fp->_seek != NULL) in _sflush() 144 if (fp->_flags & __SOFF) in _sflush() 145 curoff = fp->_offset; in _sflush() 151 if (fp->_flags & __SL64) in _sflush() 152 curoff = fp->_seek64 (fp->_cookie, 0, SEEK_CUR); in _sflush() 155 curoff = fp->_seek (fp->_cookie, 0, SEEK_CUR); in _sflush() 165 fp->_flags |= __SERR; in _sflush() [all …]
|
D | freopen.c | 81 register FILE *__restrict fp) in freopen() argument 87 CHECK_INIT (ptr, fp); in freopen() 95 oflags2 = fp->_flags2; in freopen() 97 _flockfile (fp); in freopen() 102 _funlockfile (fp); in freopen() 106 fclose ( fp); in freopen() 118 if (fp->_flags == 0) in freopen() 119 fp->_flags = __SEOF; /* hold on to it */ in freopen() 122 if (fp->_flags & __SWR) in freopen() 123 fflush ( fp); in freopen() [all …]
|
D | wsetup.c | 35 register FILE * fp) in _swsetup() argument 39 CHECK_INIT (_REENT, fp); in _swsetup() 45 if ((fp->_flags & __SWR) == 0) in _swsetup() 47 if ((fp->_flags & __SRW) == 0) in _swsetup() 50 fp->_flags |= __SERR; in _swsetup() 53 if (fp->_flags & __SRD) in _swsetup() 56 if (HASUB (fp)) in _swsetup() 57 FREEUB (ptr, fp); in _swsetup() 58 fp->_flags &= ~(__SRD | __SEOF); in _swsetup() 59 fp->_r = 0; in _swsetup() [all …]
|
D | ftello.c | 87 register FILE * fp) in ftello() argument 93 CHECK_INIT (ptr, fp); in ftello() 95 _newlib_flockfile_start (fp); in ftello() 97 if (fp->_seek == NULL) in ftello() 100 _newlib_flockfile_exit (fp); in ftello() 105 if (!(fp->_flags & __SRD) && (fp->_flags & __SWR) && in ftello() 106 fp->_p != NULL && fp->_p - fp->_bf._base > 0 && in ftello() 107 (fp->_flags & __SAPP)) in ftello() 109 pos = fp->_seek (fp->_cookie, (_fpos_t) 0, SEEK_END); in ftello() 112 _newlib_flockfile_exit (fp); in ftello() [all …]
|
D | setvbuf.c | 92 setvbuf (register FILE * fp, in setvbuf() argument 101 CHECK_INIT (reent, fp); in setvbuf() 119 _newlib_flockfile_start (fp); in setvbuf() 120 fflush ( fp); in setvbuf() 121 if (HASUB(fp)) in setvbuf() 122 FREEUB(reent, fp); in setvbuf() 123 fp->_r = fp->_lbfsize = 0; in setvbuf() 124 if (fp->_flags & __SMBF) in setvbuf() 125 free ((void *) fp->_bf._base); in setvbuf() 126 fp->_flags &= ~(__SLBF | __SNBF | __SMBF | __SOPT | __SNPT | __SEOF); in setvbuf() [all …]
|
D | fread.c | 98 FILE * fp, in crlf_r() argument 120 int c = _sgetc_raw ( fp); in crlf_r() 124 ungetc (c, fp); in crlf_r() 132 r = getc ( fp); in crlf_r() 149 FILE * __restrict fp) in fread() argument 159 CHECK_INIT(ptr, fp); in fread() 161 _newlib_flockfile_start (fp); in fread() 162 if (ORIENT (fp, -1) != -1) in fread() 167 if (fp->_r < 0) in fread() 168 fp->_r = 0; in fread() [all …]
|
D | nano-vfscanf.c | 135 register FILE *fp, in VFSCANF() argument 139 CHECK_INIT(data, fp); in VFSCANF() 140 return _SVFSCANF (fp, fmt, ap); in VFSCANF() 155 register FILE *fp) in sungetc() argument 161 fp->_flags &= ~__SEOF; in sungetc() 167 if (HASUB (fp)) in sungetc() 169 if (fp->_r >= fp->_ub._size && __submore (fp)) in sungetc() 172 *--fp->_p = c; in sungetc() 173 fp->_r++; in sungetc() 180 if (fp->_bf._base != NULL && fp->_p > fp->_bf._base && fp->_p[-1] == c) in sungetc() [all …]
|
D | fclose.c | 60 register FILE * fp) in fclose() argument 64 if (fp == NULL) in fclose() 67 CHECK_INIT (rptr, fp); in fclose() 75 if (!(fp->_flags2 & __SNLK)) in fclose() 76 _flockfile (fp); in fclose() 78 if (fp->_flags == 0) /* not open! */ in fclose() 80 if (!(fp->_flags2 & __SNLK)) in fclose() 81 _funlockfile (fp); in fclose() 89 r = (fp->_flags & __SWR) ? _sflush ( fp) : 0; in fclose() 94 r = _sflush ( fp); in fclose() [all …]
|
D | makebuf.c | 40 register FILE *fp) in _smakebuf() argument 47 if (fp->_flags & __SNBF) in _smakebuf() 49 fp->_bf._base = fp->_p = fp->_nbuf; in _smakebuf() 50 fp->_bf._size = 1; in _smakebuf() 53 flags = _swhatbuf ( fp, &size, &couldbetty); in _smakebuf() 56 if (!(fp->_flags & __SSTR)) in _smakebuf() 58 fp->_flags = (fp->_flags & ~__SLBF) | __SNBF; in _smakebuf() 59 fp->_bf._base = fp->_p = fp->_nbuf; in _smakebuf() 60 fp->_bf._size = 1; in _smakebuf() 65 fp->_flags |= __SMBF; in _smakebuf() [all …]
|
D | fvwrite.c | 30 #define COPY(n) (void) memmove ((void *) fp->_p, (void *) p, (size_t) (n)) 53 register FILE *fp, in _sfvwrite() argument 67 if (cantwrite (ptr, fp)) in _sfvwrite() 77 if (fp->_flags & __SCLE) /* text mode */ in _sfvwrite() 79 if (fp->_flags2 & __SWID) in _sfvwrite() 86 if (__swputc_r (ptr, *p, fp) == EOF) in _sfvwrite() 102 if (__sputc_r (ptr, *p, fp) == EOF) in _sfvwrite() 115 if (fp->_flags & __SNBF) in _sfvwrite() 124 w = fp->_write (fp->_cookie, p, in _sfvwrite() 133 else if ((fp->_flags & __SLBF) == 0) in _sfvwrite() [all …]
|
D | fgetwc.c | 129 register FILE *fp) in __fgetwc() argument 134 if (fp->_r <= 0 && _srefill ( fp)) in __fgetwc() 139 wc = *fp->_p++; in __fgetwc() 140 fp->_r--; in __fgetwc() 145 nconv = mbrtowc (&wc, (char *) fp->_p, fp->_r, &fp->_mbstate); in __fgetwc() 156 fp->_p++; in __fgetwc() 157 fp->_r--; in __fgetwc() 162 fp->_p += nconv; in __fgetwc() 163 fp->_r -= nconv; in __fgetwc() 167 while (_srefill( fp) == 0); in __fgetwc() [all …]
|
D | fopen.c | 121 register FILE *fp; in fopen() local 127 if ((fp = __sfp ()) == NULL) in fopen() 133 fp->_flags = 0; /* release */ in fopen() 135 __lock_close_recursive (fp->_lock); in fopen() 141 _newlib_flockfile_start (fp); in fopen() 143 fp->_file = f; in fopen() 144 fp->_flags = flags; in fopen() 145 fp->_cookie = (void *) fp; in fopen() 146 fp->_read = __sread; in fopen() 147 fp->_write = __swrite; in fopen() [all …]
|
D | wbuf.c | 39 register FILE *fp) in _swbuf() argument 45 CHECK_INIT (ptr, fp); in _swbuf() 55 fp->_w = fp->_lbfsize; in _swbuf() 56 if (cantwrite (ptr, fp)) in _swbuf() 60 if (ORIENT (fp, -1) != -1) in _swbuf() 73 n = fp->_p - fp->_bf._base; in _swbuf() 74 if (n >= fp->_bf._size) in _swbuf() 76 if (fflush ( fp)) in _swbuf() 80 fp->_w--; in _swbuf() 81 *fp->_p++ = c; in _swbuf() [all …]
|
D | fgetws.c | 105 FILE * fp) in fgetws() argument 112 _newlib_flockfile_start (fp); in fgetws() 113 if (ORIENT (fp, 1) != 1) in fgetws() 122 if (fp->_r <= 0 && _srefill ( fp)) in fgetws() 128 src = (char *) fp->_p; in fgetws() 129 nl = memchr (fp->_p, '\n', fp->_r); in fgetws() 133 nl != NULL ? (nl - fp->_p + 1) : fp->_r, in fgetws() 136 &fp->_mbstate); in fgetws() 149 src = memchr (fp->_p, '\0', fp->_r); in fgetws() 152 fp->_r -= (unsigned char *) src - fp->_p; in fgetws() [all …]
|
D | nano-vfprintf.c | 175 FILE *fp, in _ssputs() argument 181 w = fp->_w; in _ssputs() 182 if (len >= w && fp->_flags & (__SMBF | __SOPT)) in _ssputs() 186 int curpos = (fp->_p - fp->_bf._base); in _ssputs() 194 size_t newsize = fp->_bf._size * 3 / 2; in _ssputs() 197 if (fp->_flags & __SOPT) in _ssputs() 206 memcpy (str, fp->_bf._base, curpos); in _ssputs() 207 fp->_flags = (fp->_flags & ~__SOPT) | __SMBF; in _ssputs() 211 str = (unsigned char *)realloc (fp->_bf._base, newsize); in _ssputs() 215 free (fp->_bf._base); in _ssputs() [all …]
|
D | stdio_ext.c | 67 __fbufsize (FILE * fp) in __fbufsize() argument 69 return (size_t) fp->_bf._size; in __fbufsize() 73 __fpending (FILE * fp) in __fpending() argument 75 return fp->_p - fp->_bf._base; in __fpending() 79 __flbf (FILE * fp) in __flbf() argument 81 return (fp->_flags & __SLBF) != 0; in __flbf() 85 __freadable (FILE * fp) in __freadable() argument 87 return (fp->_flags & (__SRD | __SRW)) != 0; in __freadable() 91 __fwritable (FILE * fp) in __fwritable() argument 93 return (fp->_flags & (__SWR | __SRW)) != 0; in __fwritable() [all …]
|
D | ssputs.c | 10 FILE *fp, in __ssputs() argument 16 w = (unsigned int) fp->_w; in __ssputs() 17 if (len >= w && fp->_flags & (__SMBF | __SOPT)) { in __ssputs() 20 int curpos = (fp->_p - fp->_bf._base); in __ssputs() 28 unsigned int newsize = fp->_bf._size * 3 / 2; in __ssputs() 31 if (fp->_flags & __SOPT) in __ssputs() 37 memcpy (str, fp->_bf._base, curpos); in __ssputs() 38 fp->_flags = (fp->_flags & ~__SOPT) | __SMBF; in __ssputs() 42 str = (unsigned char *)realloc (fp->_bf._base, in __ssputs() 46 free (fp->_bf._base); in __ssputs() [all …]
|
/picolibc-3.7.0-3.6.0/newlib/libc/stdio64/ |
D | fseeko64.c | 90 register FILE *fp, in fseeko64() argument 104 if (!(fp->_flags & __SL64)) in fseeko64() 111 return (_off64_t) fseeko (fp, offset, whence); in fseeko64() 116 CHECK_INIT (ptr, fp); in fseeko64() 118 _newlib_flockfile_start (fp); in fseeko64() 120 curoff = fp->_offset; in fseeko64() 125 if (fp->_flags & __SAPP && fp->_flags & __SWR) in fseeko64() 128 fflush (fp); in fseeko64() 133 if ((seekfn = fp->_seek64) == NULL) in fseeko64() 136 _newlib_flockfile_exit(fp); in fseeko64() [all …]
|
D | freopen64.c | 82 register FILE *fp) in freopen64() argument 89 CHECK_INIT (ptr, fp); in freopen64() 97 oflags2 = fp->_flags2; in freopen64() 99 _flockfile (fp); in freopen64() 104 _funlockfile (fp); in freopen64() 108 fclose (fp); in freopen64() 120 if (fp->_flags == 0) in freopen64() 121 fp->_flags = __SEOF; /* hold on to it */ in freopen64() 124 if (fp->_flags & __SWR) in freopen64() 125 fflush (fp); in freopen64() [all …]
|
D | ftello64.c | 80 register FILE * fp) in ftello64() argument 85 if (!(fp->_flags & __SL64)) in ftello64() 86 return (_off64_t) ftello (fp); in ftello64() 90 CHECK_INIT (ptr, fp); in ftello64() 92 _newlib_flockfile_start(fp); in ftello64() 94 if (fp->_seek64 == NULL) in ftello64() 97 _newlib_flockfile_exit(fp); in ftello64() 102 if (!(fp->_flags & __SRD) && (fp->_flags & __SWR) && in ftello64() 103 fp->_p != NULL && fp->_p - fp->_bf._base > 0 && in ftello64() 104 (fp->_flags & __SAPP)) in ftello64() [all …]
|
D | fopen64.c | 70 register FILE *fp; in fopen64() local 76 if ((fp = __sfp ()) == NULL) in fopen64() 82 fp->_flags = 0; /* release */ in fopen64() 84 __lock_close_recursive (fp->_lock); in fopen64() 90 _newlib_flockfile_start (fp); in fopen64() 92 fp->_file = f; in fopen64() 93 fp->_flags = flags; in fopen64() 94 fp->_cookie = (void *) fp; in fopen64() 95 fp->_read = __sread; in fopen64() 96 fp->_write = __swrite64; in fopen64() [all …]
|
/picolibc-3.7.0-3.6.0/test/ |
D | t_fmemopen.c | 140 FILE *fp; in ATF_TC_BODY() local 143 fp = fmemopen(&buf[0], sizeof(buf), *p); in ATF_TC_BODY() 148 ATF_CHECK(fp != NULL); in ATF_TC_BODY() 150 ATF_CHECK(fclose(fp) == 0); in ATF_TC_BODY() 168 FILE *fp; in ATF_TC_BODY() local 175 fp = fmemopen(NULL, BUFSIZ, *p); in ATF_TC_BODY() 176 ATF_CHECK(fp != NULL); in ATF_TC_BODY() 182 ATF_CHECK(ftello(fp) == (off_t)0); in ATF_TC_BODY() 184 ATF_CHECK(fclose(fp) == 0); in ATF_TC_BODY() 197 FILE *fp; in ATF_TC_BODY() local [all …]
|