Deprecate stdio_ext API.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-03-21 17:22:05 +01:00
parent 20698b35c7
commit 91ab47f99c
19 changed files with 74 additions and 342 deletions

View File

@ -76,8 +76,14 @@ stdio/clearerr.o \
stdio/clearerr_unlocked.o \
stdio/cbprintf.o \
stdio/dprintf.o \
stdio/fbufsize.o \
stdio/fbufsize_unlocked.o \
stdio_ext/__fbufsize.o \
stdio_ext/__fpending.o \
stdio_ext/__fpurge.o \
stdio_ext/__freadable.o \
stdio_ext/__freading.o \
stdio_ext/__fseterr.o \
stdio_ext/__fwritable.o \
stdio_ext/__fwriting.o \
stdio/fclose.o \
stdio/fdeletefile.o \
stdio/feof.o \
@ -99,19 +105,11 @@ stdio/flockfile.o \
stdio/fmemopen.o \
stdio/fnewfile.o \
stdio/fparsemode.o \
stdio/fpending.o \
stdio/fpending_unlocked.o \
stdio/fprintf_unlocked.o \
stdio/fpurge.o \
stdio/fpurge_unlocked.o \
stdio/fputc.o \
stdio/fputc_unlocked.o \
stdio/fputs.o \
stdio/fputs_unlocked.o \
stdio/freadable.o \
stdio/freadable_unlocked.o \
stdio/freading.o \
stdio/freading_unlocked.o \
stdio/fread.o \
stdio/fread_unlocked.o \
stdio/fregister.o \
@ -123,8 +121,6 @@ stdio/fseeko.o \
stdio/fseeko_unlocked.o \
stdio/fsetdefaultbuf.o \
stdio/fsetdefaultbuf_unlocked.o \
stdio/fseterr.o \
stdio/fseterr_unlocked.o \
stdio/fshutdown.o \
stdio/ftell.o \
stdio/ftello.o \
@ -132,12 +128,8 @@ stdio/ftello_unlocked.o \
stdio/ftrylockfile.o \
stdio/funlockfile.o \
stdio/funregister.o \
stdio/fwritable.o \
stdio/fwritable_unlocked.o \
stdio/fwrite.o \
stdio/fwrite_unlocked.o \
stdio/fwriting.o \
stdio/fwriting_unlocked.o \
stdio/getdelim.o \
stdio/getline.o \
stdio/rewind.o \

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014, 2015.
This file is part of the Sortix C Library.
@ -289,14 +289,11 @@ int vfscanf_unlocked(FILE* __restrict stream, const char* __restrict format, __g
/* Functions that are Sortix extensions used for libc internal purposes. */
#if __USE_SORTIX
int fflush_stop_reading(FILE* fp);
int fflush_stop_reading_unlocked(FILE* fp);
int fflush_stop_writing(FILE* fp);
int fflush_stop_writing_unlocked(FILE* fp);
void fdeletefile(FILE* fp);
void fseterr(FILE* fp);
void fseterr_unlocked(FILE* fp);
void fregister(FILE* fp);
void fresetfile(FILE* fp);
void funregister(FILE* fp);
@ -306,25 +303,6 @@ int fsetdefaultbuf_unlocked(FILE* fp);
int fshutdown(FILE* fp);
#endif
/* The <stdio_ext.h> functions. */
#if __USE_SORTIX && (!defined(__IMPLICIT_SORTIX_SOURCE) || defined(__is_sortix_libc))
#include <stdio_ext.h>
#define fbufsize __fbufsize
size_t fbufsize_unlocked(FILE* fp);
#define freading __freading
int freading_unlocked(FILE* fp);
#define fwriting __fwriting
int fwriting_unlocked(FILE* fp);
#define freadable __freadable
int freadable_unlocked(FILE* fp);
#define fwritable __fwritable
int fwritable_unlocked(FILE* fp);
#define fpurge __fpurge
void fpurge_unlocked(FILE* fp);
#define fpending __fpending
size_t fpending_unlocked(FILE* fp);
#endif
/* The backends for printf and scanf. */
#if __USE_SORTIX
int cbprintf(void*, size_t (*)(void*, const char*, size_t), const char*, ...)

View File

@ -32,13 +32,13 @@
__BEGIN_DECLS
size_t __fbufsize(FILE* fp);
int __freading(FILE* fp);
int __fwriting(FILE* fp);
int __freadable(FILE* fp);
int __fwritable(FILE* fp);
void __fpurge(FILE* fp);
size_t __fpending(FILE* fp);
void __fpurge(FILE* fp);
int __freadable(FILE* fp);
int __freading(FILE* fp);
void __fseterr(FILE* fp);
int __fwritable(FILE* fp);
int __fwriting(FILE* fp);
__END_DECLS

View File

@ -1,30 +0,0 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
This file is part of the Sortix C Library.
The Sortix C Library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
The Sortix C Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
stdio/fbufsize_unlocked.cpp
Returns the size of the FILE's buffer.
*******************************************************************************/
#include <stdio.h>
extern "C" size_t fbufsize_unlocked(FILE* fp)
{
return fp->buffersize;
}

View File

@ -1,30 +0,0 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
This file is part of the Sortix C Library.
The Sortix C Library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
The Sortix C Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
stdio/fpending_unlocked.cpp
Returns the number of bytes pending in the output buffer.
*******************************************************************************/
#include <stdio.h>
extern "C" size_t fpending_unlocked(FILE* fp)
{
return fp->amount_output_buffered;
}

View File

@ -1,32 +0,0 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
This file is part of the Sortix C Library.
The Sortix C Library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
The Sortix C Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
stdio/fpurge.cpp
Discards all contents in the FILE's buffer.
*******************************************************************************/
#include <stdio.h>
extern "C" void fpurge(FILE* fp)
{
flockfile(fp);
fpurge_unlocked(fp);
funlockfile(fp);
}

View File

@ -1,33 +0,0 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
This file is part of the Sortix C Library.
The Sortix C Library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
The Sortix C Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
stdio/freadable.cpp
Returns whether this FILE can be read from.
*******************************************************************************/
#include <stdio.h>
extern "C" int freadable(FILE* fp)
{
flockfile(fp);
int ret = freadable_unlocked(fp);
funlockfile(fp);
return ret;
}

View File

@ -1,33 +0,0 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
This file is part of the Sortix C Library.
The Sortix C Library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
The Sortix C Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
stdio/freading.cpp
Returns whether the last operation was a read or FILE is read only.
*******************************************************************************/
#include <stdio.h>
extern "C" int freading(FILE* fp)
{
flockfile(fp);
int ret = freading_unlocked(fp);
funlockfile(fp);
return ret;
}

View File

@ -1,38 +0,0 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2015.
This file is part of the Sortix C Library.
The Sortix C Library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
The Sortix C Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
stdio/fseterr.cpp
Sets the error condition bit on a FILE.
*******************************************************************************/
#include <stdio.h>
extern "C" void fseterr(FILE* fp)
{
flockfile(fp);
fseterr_unlocked(fp);
funlockfile(fp);
}
// &%#!ing gnulib compatibility.
extern "C" void __fseterr(FILE* fp)
{
fseterr(fp);
}

View File

@ -1,33 +0,0 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
This file is part of the Sortix C Library.
The Sortix C Library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
The Sortix C Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
stdio/fwritable.cpp
Returns whether this FILE can be written to.
*******************************************************************************/
#include <stdio.h>
extern "C" int fwritable(FILE* fp)
{
flockfile(fp);
int ret = fwritable_unlocked(fp);
funlockfile(fp);
return ret;
}

View File

@ -1,33 +0,0 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
This file is part of the Sortix C Library.
The Sortix C Library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
The Sortix C Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
stdio/fwriting.cpp
Returns whether the last operation was a write or FILE is write only.
*******************************************************************************/
#include <stdio.h>
extern "C" int fwriting(FILE* fp)
{
flockfile(fp);
int ret = fwriting_unlocked(fp);
funlockfile(fp);
return ret;
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2015.
This file is part of the Sortix C Library.
@ -17,17 +17,18 @@
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
stdio/fbufsize.cpp
stdio_ext/__fbufsize.cpp
Returns the size of the FILE's buffer.
*******************************************************************************/
#include <stdio.h>
#include <stdio_ext.h>
extern "C" size_t fbufsize(FILE* fp)
extern "C" size_t __fbufsize(FILE* fp)
{
flockfile(fp);
size_t result = fbufsize_unlocked(fp);
size_t result = fp->buffersize;
funlockfile(fp);
return result;
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014, 2015.
This file is part of the Sortix C Library.
@ -17,17 +17,18 @@
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
stdio/fpending.cpp
stdio_ext/__fpending.cpp
Returns the number of bytes pending in the output buffer.
*******************************************************************************/
#include <stdio.h>
#include <stdio_ext.h>
extern "C" size_t fpending(FILE* fp)
extern "C" size_t __fpending(FILE* fp)
{
flockfile(fp);
size_t ret = fpending_unlocked(fp);
size_t result = fp->amount_output_buffered;
funlockfile(fp);
return ret;
return result;
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2015.
This file is part of the Sortix C Library.
@ -17,16 +17,19 @@
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
stdio/fpurge_unlocked.cpp
stdio_ext/__fpurge.cpp
Discards all contents in the FILE's buffer.
*******************************************************************************/
#include <stdio.h>
#include <stdio_ext.h>
extern "C" void fpurge_unlocked(FILE* fp)
extern "C" void __fpurge(FILE* fp)
{
flockfile(fp);
fp->offset_input_buffer = 0;
fp->amount_input_buffered = 0;
fp->amount_output_buffered = 0;
funlockfile(fp);
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014, 2015.
This file is part of the Sortix C Library.
@ -17,14 +17,18 @@
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
stdio/freadable_unlocked.cpp
stdio_ext/__freadable.cpp
Returns whether this FILE can be read from.
*******************************************************************************/
#include <stdio.h>
#include <stdio_ext.h>
extern "C" int freadable_unlocked(FILE* fp)
extern "C" int __freadable(FILE* fp)
{
return fp->flags & _FILE_READABLE;
flockfile(fp);
int result = fp->flags & _FILE_READABLE ? 1 : 0;
funlockfile(fp);
return result;
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014, 2015.
This file is part of the Sortix C Library.
@ -17,18 +17,22 @@
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
stdio/freading_unlocked.cpp
stdio_ext/__freading.cpp
Returns whether the last operation was a read or FILE is read only.
*******************************************************************************/
#include <stdio.h>
#include <stdio_ext.h>
extern "C" int freading_unlocked(FILE* fp)
extern "C" int __freading(FILE* fp)
{
int result = 0;
flockfile(fp);
if ( fp->flags & _FILE_LAST_READ )
return 1;
if ( (fp->flags & _FILE_READABLE) && !(fp->flags & _FILE_WRITABLE) )
return 1;
return 0;
result = 1;
else if ( (fp->flags & _FILE_READABLE) && !(fp->flags & _FILE_WRITABLE) )
result = 1;
funlockfile(fp);
return result;
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014, 2015.
This file is part of the Sortix C Library.
@ -17,14 +17,17 @@
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
stdio/fseterr_unlocked.cpp
stdio_ext/__fseterr.cpp
Sets the error condition bit on a FILE.
*******************************************************************************/
#include <stdio.h>
#include <stdio_ext.h>
extern "C" void fseterr_unlocked(FILE* fp)
extern "C" void __fseterr(FILE* fp)
{
flockfile(fp);
fp->flags |= _FILE_STATUS_ERROR;
funlockfile(fp);
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014, 2015.
This file is part of the Sortix C Library.
@ -17,14 +17,18 @@
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
stdio/fwritable_unlocked.cpp
stdio_ext/__fwritable.cpp
Returns whether this FILE can be written to.
*******************************************************************************/
#include <stdio.h>
#include <stdio_ext.h>
extern "C" int fwritable_unlocked(FILE* fp)
extern "C" int __fwritable(FILE* fp)
{
return fp->flags & _FILE_WRITABLE;
flockfile(fp);
int result = fp->flags & _FILE_WRITABLE ? 1 : 0;
funlockfile(fp);
return result;
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014, 2015.
This file is part of the Sortix C Library.
@ -17,18 +17,22 @@
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
stdio/fwriting_unlocked.cpp
stdio_ext/__fwriting.cpp
Returns whether the last operation was a write or FILE is write only.
*******************************************************************************/
#include <stdio.h>
#include <stdio_ext.h>
extern "C" int fwriting_unlocked(FILE* fp)
extern "C" int __fwriting(FILE* fp)
{
int result = 0;
flockfile(fp);
if ( fp->flags & _FILE_LAST_WRITE )
return 1;
result = 1;
if ( (fp->flags & _FILE_WRITABLE) && !(fp->flags & _FILE_READABLE) )
return 1;
return 0;
result = 1;
funlockfile(fp);
return result;
}