[Scummvm-cvs-logs] CVS: scummvm/backends/PalmOS/Src/missing _stdio.cpp,1.10,1.11 stdio.h,1.5,1.6

Chris Apers chrilith at users.sourceforge.net
Wed Oct 20 02:25:52 CEST 2004


Update of /cvsroot/scummvm/scummvm/backends/PalmOS/Src/missing
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31387

Modified Files:
	_stdio.cpp stdio.h 
Log Message:
Added fgetc/getc function

Index: _stdio.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/missing/_stdio.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- _stdio.cpp	6 Oct 2004 09:41:33 -0000	1.10
+++ _stdio.cpp	20 Oct 2004 09:17:46 -0000	1.11
@@ -29,6 +29,8 @@
 
 static void dummy(Boolean){};
 
+// TODO : implement "errno"
+
 void StdioInit(UInt16 volRefNum, const Char *output, LedProc ledProc) {
 	gStdioVolRefNum = volRefNum;
 	
@@ -37,7 +39,6 @@
 	else
 		gStdioLedProc = dummy;
 		
-
 	VFSFileDelete(gStdioVolRefNum, output);
 	VFSFileCreate(gStdioVolRefNum, output);
 	VFSFileOpen  (gStdioVolRefNum, output,vfsModeWrite, &gStdioOutput);
@@ -53,7 +54,7 @@
 	if (error == errNone)
 		MemPtrFree(stream);
 
-#ifdef DEBUG
+#ifdef _DEBUG_STDIO
 	FrmCustomAlert(FrmWarnAlert,"error fclose",0,0);
 #endif
 	return error;
@@ -62,7 +63,7 @@
 UInt16 feof(FileRef *stream) {
 	Err error = VFSFileEOF(*stream);
 
-#ifdef DEBUG
+#ifdef _DEBUG_STDIO
 		switch (error)
 		{
 			case vfsErrFileEOF:
@@ -86,6 +87,15 @@
 	return error;
 }
 
+Int16 fgetc(FileRef *stream) {
+	UInt32 numBytesRead;
+	Err e;
+	Char c;
+	
+	e = VFSFileRead(*stream, 1, &c, &numBytesRead);
+	return (int)(!e ? c : EOF);
+}
+
 Char *fgets(Char *s, UInt32 n, FileRef *stream) {
 	UInt32 numBytesRead;
 	gStdioLedProc(true);
@@ -104,7 +114,7 @@
 	
 		return s;
 	}
-#ifdef DEBUG
+#ifdef _DEBUG_STDIO
 		switch (error)
 		{
 			case expErrNotOpen:
@@ -180,7 +190,7 @@
 		}
 	}
 
-#ifdef DEBUG
+#ifdef _DEBUG_STDIO
 	else
 	{
 		switch (err)
@@ -222,7 +232,7 @@
 	if (error == errNone || error == vfsErrFileEOF)
 		return (UInt32)(numBytesRead/size);
 
-#ifdef DEBUG
+#ifdef _DEBUG_STDIO
 		switch (error)
 		{
 			case expErrNotOpen:

Index: stdio.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/missing/stdio.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- stdio.h	25 May 2004 13:33:31 -0000	1.5
+++ stdio.h	20 Oct 2004 09:17:46 -0000	1.6
@@ -41,6 +41,7 @@
 #define clearerr(a)
 #define fflush(a)
 #define vsnprintf(a,b,c,d)	vsprintf(a,c,d)
+#define getc(a)				fgetc(a)
 
 #define	SEEK_SET			vfsOriginBeginning 
 #define	SEEK_CUR			vfsOriginCurrent  
@@ -49,6 +50,7 @@
 UInt16		fclose	(FileRef *stream);
 UInt16		feof	(FileRef *stream);
 Char *		fgets	(Char *s, UInt32 n, FileRef *stream);
+Int16		fgetc	(FileRef *stream);
 FileRef *	fopen	(const Char *filename, const Char *type);
 UInt32		fread	(void *ptr, UInt32 size, UInt32 nitems, FileRef *stream);
 UInt32		fwrite	(const void *ptr, UInt32 size, UInt32 nitems, FileRef *stream);
@@ -64,4 +66,4 @@
 void	StdioInit	(UInt16 volRefNum, const Char *output, LedProc ledProc);
 void	StdioRelease();
 
-#endif
\ No newline at end of file
+#endif





More information about the Scummvm-git-logs mailing list