Browse Source

os2: update include paths. add missing libc includes to geniconv.

Ozkan Sezer 4 years ago
parent
commit
110a0f7bb1

+ 1 - 1
src/core/os2/SDL_os2.c

@@ -22,7 +22,7 @@
 
 #if defined(__OS2__)
 
-#include "core/os2/geniconv/geniconv.h"
+#include "geniconv/geniconv.h"
 
 // SDL_OS2Quit() will be called from SDL_QuitSubSystem().
 

+ 6 - 9
src/core/os2/SDL_os2.h

@@ -1,31 +1,28 @@
-#ifndef _SDL_os2_h
-#define _SDL_os2_h
+#ifndef SDL_os2_h_
+#define SDL_os2_h_
 
 #include "SDL_log.h"
 #include "SDL_stdinc.h"
-#include ".\src\core\os2\geniconv\geniconv.h"
+#include "geniconv/geniconv.h"
 
 #if OS2DEBUG==SDLOUTPUT
-
 # define debug(s,...) SDL_LogDebug( SDL_LOG_CATEGORY_APPLICATION, \
                                     __func__"(): "##s, ##__VA_ARGS__ )
-
 #elif defined(OS2DEBUG)
-
 # define debug(s,...) printf( __func__"(): "##s"\n", ##__VA_ARGS__ )
 
 #else
 
 # define debug(s,...)
 
-#endif // OS2DEBUG
+#endif /* OS2DEBUG */
 
 
-// StrUTF8New() - geniconv\sys2utf8.c.
+// StrUTF8New() - geniconv/sys2utf8.c.
 #define OS2_SysToUTF8(S) StrUTF8New( 1, S, SDL_strlen( S ) + 1 )
 #define OS2_UTF8ToSys(S) StrUTF8New( 0, (char *)(S), SDL_strlen( S ) + 1 )
 
 // SDL_OS2Quit() will be called from SDL_QuitSubSystem().
 void SDL_OS2Quit();
 
-#endif // _SDL_os2_h
+#endif /* SDL_os2_h_ */

+ 2 - 2
src/core/os2/geniconv/geniconv.c

@@ -7,7 +7,8 @@
 #define INCL_DOSMODULEMGR     /* Module Manager values */
 #define INCL_DOSERRORS        /* Error values */
 #include <os2.h>
-#include <iconv.h>
+
+#include "geniconv.h"
 
 //#define DEBUG
 
@@ -107,7 +108,6 @@ static void _init()
 }
 
 
-
 //           Public routines.
 //           ----------------
 

+ 4 - 4
src/core/os2/geniconv/geniconv.h

@@ -37,16 +37,16 @@ int libiconv_close(iconv_t cd);
 // System codepage <-> UTF-8.
 
 // StrUTF8()
-// Coverts string from system cp. to UTF-8 (fToUTF8 is not 0) or from UTF-8 to
-// the system cp. (fToUTF8 is 0). Converted ASCIIZ string will be placed at the
+// Coverts string from system cp to UTF-8 (fToUTF8 is not 0) or from UTF-8 to
+// the system cp (fToUTF8 is 0). Converted ASCIIZ string will be placed at the
 // buffer pcDst, up to cbDst - 1 (for sys->utf8) or 2 (for utf8->sys) bytes.
 // Returns the number of bytes written into pcDst, not counting the terminating
 // 0 byte(s) or -1 on error.
 int StrUTF8(int fToUTF8, char *pcDst, int cbDst, char *pcSrc, int cbSrc);
 
 // StrUTF8New()
-// Coverts string from system cp. to UTF-8 (fToUTF8 is not 0) or from UTF-8 to
-// the system cp. (fToUTF8 is 0). Memory for the new string is obtained by
+// Coverts string from system cp to UTF-8 (fToUTF8 is not 0) or from UTF-8 to
+// the system cp (fToUTF8 is 0). Memory for the new string is obtained by
 // using libc malloc().
 // Returns converted string, terminating two bytes 0 is appended to the result.
 // Returns null on error.

+ 2 - 1
src/core/os2/geniconv/os2cp.c

@@ -1,10 +1,11 @@
-#include "os2cp.h"
 #define INCL_DOSNLS
 #define INCL_DOSERRORS
 #include <os2.h>
 #include <string.h>
 #include <ctype.h>
 
+#include "os2cp.h"
+
 typedef struct _CP2NAME {
   ULONG		ulCode;
   PSZ		pszName;

+ 2 - 2
src/core/os2/geniconv/os2iconv.c

@@ -5,10 +5,10 @@
 */
 
 #define ICONV_THREAD_SAFE 1
-//#undef ICONV_THREAD_SAFE
 
-#include "iconv.h"
+#include "geniconv.h"
 #include <uconv.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #ifdef ICONV_THREAD_SAFE

+ 2 - 3
src/core/os2/geniconv/sys2utf8.c

@@ -1,4 +1,4 @@
-#include <iconv.h>
+#include "geniconv.h"
 #include <stdlib.h>
 
 int StrUTF8(int fToUTF8, char *pcDst, int cbDst, char *pcSrc, int cbSrc)
@@ -47,8 +47,7 @@ int StrUTF8(int fToUTF8, char *pcDst, int cbDst, char *pcSrc, int cbSrc)
 
   iconv_close( cd );
 
-  // Write trailing ZERO (1 byte for UTF-8, 2 bytes for the system cp.).
-
+  // Write trailing ZERO (1 byte for UTF-8, 2 bytes for the system cp).
   if ( fToUTF8 )
   {
     if ( cbDst < 1 )

+ 5 - 3
src/core/os2/geniconv/test.c

@@ -1,8 +1,9 @@
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <geniconv.h>
+#include "geniconv.h"
 
-void main()
+int main(void)
 {
   char       acBuf[128];
   char       *inbuf = "ôÅÓÔ - ÐÒÏ×ÅÒËÁ"; // KOI8-R string.
@@ -17,7 +18,7 @@ void main()
   if ( ic == (iconv_t)(-1) )
   {
     puts( "iconv_open() fail" );
-    return;
+    return 1;
   }
 
   iconv( ic, &inbuf, &inbytesleft, &outbuf, &outbytesleft );
@@ -42,4 +43,5 @@ void main()
   iconv_clean();
 
   puts( "Done." );
+  return 0;
 }

+ 1 - 1
src/loadso/os2/SDL_sysloadso.c

@@ -26,7 +26,7 @@
 /* System dependent library loading routines                           */
 
 #include "SDL_loadso.h"
-#include ".\core\os2\SDL_os2.h"
+#include "../../core/os2/SDL_os2.h"
 
 #define INCL_DOSMODULEMGR
 #define INCL_DOSERRORS

+ 2 - 2
src/video/os2/SDL_os2output.h

@@ -21,7 +21,7 @@
 #ifndef _SDL_os2output_
 #define _SDL_os2output_
 
-#include ".\core\os2\SDL_os2.h"
+#include "../../core/os2/SDL_os2.h"
 
 typedef struct _VODATA *PVODATA;
 
@@ -51,4 +51,4 @@ typedef struct _OS2VIDEOOUTPUT {
 extern OS2VIDEOOUTPUT voDive;
 extern OS2VIDEOOUTPUT voVMan;
 
-#endif // _SDL_os2output_
+#endif /* _SDL_os2output_ */

+ 2 - 3
src/video/os2/SDL_os2util.h

@@ -30,9 +30,8 @@
 #define INCL_GPI
 #include <os2.h>
 
-/*#define debug(s,...) SDL_LogDebug( SDL_LOG_CATEGORY_VIDEO, \
-                                   __func__"(): "##s, ##__VA_ARGS__ )*/
+/*#define debug(s,...) SDL_LogDebug( SDL_LOG_CATEGORY_VIDEO, __func__"(): "##s, ##__VA_ARGS__ )*/
 
 HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY);
 
-#endif // _SDL_os2util_h
+#endif /* _SDL_os2util_h */

+ 1 - 3
src/video/os2/SDL_os2video.h

@@ -24,7 +24,7 @@
 #define _SDL_os2video_h
 
 #include "../SDL_sysvideo.h"
-#include ".\core\os2\SDL_os2.h"
+#include "../../core/os2/SDL_os2.h"
 
 #define INCL_DOS
 #define INCL_DOSERRORS
@@ -34,8 +34,6 @@
 #define INCL_OS2MM
 #define INCL_DOSMEMMGR
 #include <os2.h>
-//#include <gradd.h>               // Defines FOURCC_xxxx
-
 
 #include "SDL_os2mouse.h"
 #include "SDL_os2output.h"

+ 4 - 2
src/video/os2/SDL_os2vman.c

@@ -25,13 +25,15 @@
 #define INCL_DOSMODULEMGR
 #define INCL_WIN
 #define INCL_GPI
-#define INCL_GPIBITMAPS         // GPI bit map functions
+#define INCL_GPIBITMAPS /* GPI bit map functions */
 #include <os2.h>
+#include <gradd.h>
+#if 0 /* not used */
 #define INCL_GRE_DEVICE
 #define INCL_GRE_DEVMISC
 #include <pmddi.h>
+#endif
 #include "SDL_os2output.h"
-#include "gradd.h"
 #include "SDL_os2video.h"
 
 typedef struct _VODATA {