Browse Source

Compile error and emulation errors for GFILE_NEED_STDIO

remotes/origin_old/ugfx_release_2.6
inmarket 8 years ago
parent
commit
07a63f7143
  1. 2
      docs/releases.txt
  2. 3
      drivers/gaudio/Win32/gaudio_play_lld.c
  3. 3
      drivers/gaudio/Win32/gaudio_record_lld.c
  4. 3
      drivers/multiple/Win32/gdisp_lld_Win32.c
  5. 3
      drivers/multiple/X/gdisp_lld_X.c
  6. 3
      drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c
  7. 25
      src/gfile/gfile.h
  8. 3
      src/gfile/gfile_fs_native.c
  9. 12
      src/gfile/gfile_stdio.c
  10. 3
      src/ginput/ginput_keyboard.c
  11. 3
      src/gos/gos_linux.c
  12. 3
      src/gos/gos_osx.c
  13. 3
      src/gos/gos_raw32.c
  14. 3
      src/gos/gos_win32.c

2
docs/releases.txt

@ -25,6 +25,8 @@ FEATURE: Add a number of UEXT connector board files for Olimex SAM7EX256
FIX: Fix for error rounding in gdispFillConvexPoly()
FEATURE: Vastly improved gwin arrow button drawing
FIX: GINPUT toggle fixes
FIX: GFILE_ALLOW_FLOAT compile error fixed
FIX: GFILE_NEED_STDIO compile and emulation errors fixed
*** Release 2.2 ***

3
drivers/gaudio/Win32/gaudio_play_lld.c

@ -5,6 +5,9 @@
* http://ugfx.org/license.html
*/
// We need to include stdio.h below. Turn off GFILE_NEED_STDIO just for this file to prevent conflicts
#define GFILE_NEED_STDIO_MUST_BE_OFF
#include "gfx.h"
#if GFX_USE_GAUDIO && GAUDIO_NEED_PLAY

3
drivers/gaudio/Win32/gaudio_record_lld.c

@ -5,6 +5,9 @@
* http://ugfx.org/license.html
*/
// We need to include stdio.h below. Turn off GFILE_NEED_STDIO just for this file to prevent conflicts
#define GFILE_NEED_STDIO_MUST_BE_OFF
#include "gfx.h"
#if GFX_USE_GAUDIO && GAUDIO_NEED_RECORD

3
drivers/multiple/Win32/gdisp_lld_Win32.c

@ -5,6 +5,9 @@
* http://ugfx.org/license.html
*/
// We need to include stdio.h below. Turn off GFILE_NEED_STDIO just for this file to prevent conflicts
#define GFILE_NEED_STDIO_MUST_BE_OFF
#include "gfx.h"
#if GFX_USE_GDISP

3
drivers/multiple/X/gdisp_lld_X.c

@ -5,6 +5,9 @@
* http://ugfx.org/license.html
*/
// We need to include stdio.h below. Turn off GFILE_NEED_STDIO just for this file to prevent conflicts
#define GFILE_NEED_STDIO_MUST_BE_OFF
#include "gfx.h"
#if GFX_USE_GDISP

3
drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c

@ -5,6 +5,9 @@
* http://ugfx.org/license.html
*/
// We need to include stdio.h below. Turn off GFILE_NEED_STDIO just for this file to prevent conflicts
#define GFILE_NEED_STDIO_MUST_BE_OFF
#include "gfx.h"
#if GFX_USE_GDISP

25
src/gfile/gfile.h

@ -398,38 +398,40 @@ extern "C" {
#endif
#endif
#if GFILE_NEED_STDIO && !defined(GFILE_IMPLEMENTATION)
#if GFILE_NEED_STDIO && !defined(GFILE_NEED_STDIO_MUST_BE_OFF)
// Needed routines and definitions
size_t gstdioRead(void * ptr, size_t size, size_t count, GFILE *f);
size_t gstdioWrite(const void * ptr, size_t size, size_t count, GFILE *f);
int gstdioGetpos(GFILE *f, long int *pos);
int gstdioSeek(GFILE *f, size_t offset, int origin);
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
// Stdio emulation
#define stdin gfileStdIn
#define stdout gfileStdOut
#define stderr gfileStdErr
#define FILENAME_MAX 256 // Use a relatively small number for an embedded platform
#define L_tmpnam FILENAME_MAX
#define FOPEN_MAX GFILE_MAX_GFILES
#define TMP_MAX GFILE_MAX_GFILES
#define FILENAME_MAX 256 // Use a relatively small number for an embedded platform
#define L_tmpnam FILENAME_MAX
#define P_tmpdir "/tmp/"
#define FILE GFILE
#define fopen(n,m) gfileOpen(n,m)
#define fclose(f) gfileClose(f)
size_t gstdioRead(void * ptr, size_t size, size_t count, FILE *f);
size_t gstdioWrite(const void * ptr, size_t size, size_t count, FILE *f);
#define fread(p,sz,cnt,f) gstdioRead(p,sz,cnt,f)
#define fwrite(p,sz,cnt,f) gstdioWrite(p,sz,cnt,f)
int gstdioSeek(FILE *f, size_t offset, int origin);
#define fseek(f,ofs,org) gstdioSeek(f,ofs,org)
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define remove(n) (!gfileDelete(n))
#define rename(o,n) (!gfileRename(o,n))
#define fflush(f) (0)
#define ftell(f) gfileGetPos(f)
#define fpos_t long int
int gstdioGetpos(FILE *f, long int *pos);
#define fgetpos(f,pos) gstdioGetpos(f,pos)
#define fsetpos(f, pos) (!gfileSetPos(f, *pos))
#define rewind(f) gfileSetPos(f, 0);
#define feof(f) gfileEOF(f)
#define vfprintf(f,m,a) vfnprintg(f,0,m,a)
#define fprintf(f,m,...) fnprintg(f,0,m,__VA_ARGS__)
#define vprintf(m,a) vfnprintg(gfileStdOut,0,m,a)
@ -438,6 +440,7 @@ extern "C" {
#define snprintf(s,n,m,...) snprintg(s,n,m,__VA_ARGS__)
#define vsprintf(s,m,a) vsnprintg(s,0,m,a)
#define sprintf(s,m,...) snprintg(s,0,m,__VA_ARGS__)
//TODO
//void clearerr ( FILE * stream );
//int ferror ( FILE * stream );

3
src/gfile/gfile_fs_native.c

@ -9,6 +9,9 @@
* The native file-system
********************************************************/
// We need to include stdio.h below. Turn off GFILE_NEED_STDIO just for this file to prevent conflicts
#define GFILE_NEED_STDIO_MUST_BE_OFF
#include "gfx.h"
#if GFX_USE_GFILE && GFILE_NEED_NATIVEFS

12
src/gfile/gfile_stdio.c

@ -11,17 +11,19 @@
#include "gfx.h"
#if GFX_USE_GFILE && GFILE_NEED_STDIO
#if GFX_USE_GFILE && GFILE_NEED_STDIO && !defined(GFILE_NEED_STDIO_MUST_BE_OFF)
size_t gstdioRead(void * ptr, size_t size, size_t count, FILE *f) {
#include "gfile_fs.h"
size_t gstdioRead(void * ptr, size_t size, size_t count, GFILE *f) {
return gfileRead(f, ptr, size*count)/size;
}
size_t gstdioWrite(const void * ptr, size_t size, size_t count, FILE *f) {
size_t gstdioWrite(const void * ptr, size_t size, size_t count, GFILE *f) {
return gfileWrite(f, ptr, size*count)/size;
}
int gstdioSeek(FILE *f, size_t offset, int origin) {
int gstdioSeek(GFILE *f, size_t offset, int origin) {
switch(origin) {
case SEEK_SET:
break;
@ -37,7 +39,7 @@ int gstdioSeek(FILE *f, size_t offset, int origin) {
return gfileSetPos(f, offset) ? 0 : -1;
}
int gstdioGetpos(FILE *f, long int *pos) {
int gstdioGetpos(GFILE *f, long int *pos) {
if (!(f->flags & GFILEFLG_OPEN))
return -1;
*pos = f->pos;

3
src/ginput/ginput_keyboard.c

@ -10,6 +10,9 @@
* @brief GINPUT keyboard code.
*/
// We need to include stdio.h below for MICROCODE_DEBUG. Turn off GFILE_NEED_STDIO just for this file to prevent conflicts
#define GFILE_NEED_STDIO_MUST_BE_OFF
#include "gfx.h"
#if GFX_USE_GINPUT && GINPUT_NEED_KEYBOARD

3
src/gos/gos_linux.c

@ -5,6 +5,9 @@
* http://ugfx.org/license.html
*/
// We need to include stdio.h below. Turn off GFILE_NEED_STDIO just for this file to prevent conflicts
#define GFILE_NEED_STDIO_MUST_BE_OFF
#include "gfx.h"
#if GFX_USE_OS_LINUX

3
src/gos/gos_osx.c

@ -5,6 +5,9 @@
* http://ugfx.org/license.html
*/
// We need to include stdio.h below. Turn off GFILE_NEED_STDIO just for this file to prevent conflicts
#define GFILE_NEED_STDIO_MUST_BE_OFF
#include "gfx.h"
#if GFX_USE_OS_OSX

3
src/gos/gos_raw32.c

@ -5,6 +5,9 @@
* http://ugfx.org/license.html
*/
// We need to include stdio.h below for Win32 emulation. Turn off GFILE_NEED_STDIO just for this file to prevent conflicts
#define GFILE_NEED_STDIO_MUST_BE_OFF
#include "gfx.h"
#if GFX_USE_OS_RAW32

3
src/gos/gos_win32.c

@ -5,6 +5,9 @@
* http://ugfx.org/license.html
*/
// We need to include stdio.h below. Turn off GFILE_NEED_STDIO just for this file to prevent conflicts
#define GFILE_NEED_STDIO_MUST_BE_OFF
#include "gfx.h"
#if GFX_USE_OS_WIN32

Loading…
Cancel
Save