Updates to make VA 3.0 compile again, particularly xpm

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6019 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster
2000-02-15 05:49:02 +00:00
parent f1d626b203
commit ea258ad348
30 changed files with 1242 additions and 61 deletions

View File

@@ -33,7 +33,7 @@
#define wxUSE_GIF 1 // Utilize GIF images #define wxUSE_GIF 1 // Utilize GIF images
#if defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ) #if defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )
#define wxUSE_LONG_LONG 1 #define wxUSE_LONGLONG 1
#endif #endif
#define wxUSE_NET_API 1 // Utilize OS/2's UPM netapi's #define wxUSE_NET_API 1 // Utilize OS/2's UPM netapi's
@@ -103,7 +103,6 @@
#define wxUSE_CHECKLISTBOX 1 #define wxUSE_CHECKLISTBOX 1
// Define 1 to compile check listbox // Define 1 to compile check listbox
#define wxUSE_CARET 1 #define wxUSE_CARET 1
// Define 1 to use wxCaret class // Define 1 to use wxCaret class
#define wxUSE_XPM_IN_OS2 1 #define wxUSE_XPM_IN_OS2 1
@@ -160,7 +159,7 @@
// Set this to 0 if your compiler can't cope // Set this to 0 if your compiler can't cope
// with omission of prototype parameters. // with omission of prototype parameters.
#define wxUSE_ODBC 1 #define wxUSE_ODBC 0
// Define 1 to use ODBC classes // Define 1 to use ODBC classes
#define wxODBC_FWD_ONLY_CURSORS 1 #define wxODBC_FWD_ONLY_CURSORS 1
@@ -257,12 +256,12 @@
#define wxUSE_TOOLBAR 1 #define wxUSE_TOOLBAR 1
#define wxUSE_TOOLBAR_NATIVE 1 #define wxUSE_TOOLBAR_NATIVE 1
// wxSpinCtrl class
#define wxUSE_SPINCTRL 1
// wxStatusBar class // wxStatusBar class
#define wxUSE_STATUSBAR 1 #define wxUSE_STATUSBAR 1
// wxSpinCtrl class
#define wxUSE_SPINCTRL 1
// progress dialog class for lengthy operations // progress dialog class for lengthy operations
#define wxUSE_PROGRESSDLG 1 #define wxUSE_PROGRESSDLG 1

View File

@@ -33,7 +33,7 @@
#define wxUSE_GIF 1 // Utilize GIF images #define wxUSE_GIF 1 // Utilize GIF images
#if defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ) #if defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )
#define wxUSE_LONG_LONG 1 #define wxUSE_LONGLONG 1
#endif #endif
#define wxUSE_NET_API 1 // Utilize OS/2's UPM netapi's #define wxUSE_NET_API 1 // Utilize OS/2's UPM netapi's

View File

@@ -9,7 +9,7 @@
# Use FINAL=1 argument to nmake to build final version with no debug info. # Use FINAL=1 argument to nmake to build final version with no debug info.
# Set WXDIR for your system # Set WXDIR for your system
WXDIR = j:\dev\wx2\wxWindows WXDIR = $(WXWIN)
PROGRAM=minimal PROGRAM=minimal
OBJECTS = $(PROGRAM).obj OBJECTS = $(PROGRAM).obj

View File

@@ -1,5 +1,5 @@
ICON 1 PRELOAD "mondros2.ico" ICON 1 PRELOAD "mondros2.ico"
#include "H:\DEV\WX2\wxWindows\include\wx\os2\wx.rc" #include "G:\DEV\WX2\wxWindows\include\wx\os2\wx.rc"
#define MINIMAL_QUIT 1 #define MINIMAL_QUIT 1
#define MINIMAL_ABOUT 102 #define MINIMAL_ABOUT 102

View File

@@ -39,8 +39,8 @@ $(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
<< <<
$(RC) $(PROGRAM).res $(PROGRAM).exe $(RC) $(PROGRAM).res $(PROGRAM).exe
$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\os2\wx.rc $(PROGRAM).res : $(PROGRAM).rcO $(WXDIR)\include\wx\os2\wx.rc
$(RC) -I $(WXDIR)\include -D __VISAGECPP__ -r $(PROGRAM).rc $(PROGRAM).res $(RC) -I $(WXDIR)\include -D __VISAGECPP__ -r $(PROGRAM).rcO $(PROGRAM).res
clean: clean:
-erase $(OBJECTS) -erase $(OBJECTS)

View File

@@ -18,6 +18,10 @@ OS2LIBFLAGS=/NOL /NOE
# Set an environment variable, WXWIN, to your WXWIN directory # Set an environment variable, WXWIN, to your WXWIN directory
WXDIR=$(WXWIN) WXDIR=$(WXWIN)
# Set to where your UPM and LAN libs are
UPMLIB=D:\MUGLIB
NETLIB=D:\IBMLAN\NETSRC\LIB
WXSRC=$(WXDIR)\src\os2 WXSRC=$(WXDIR)\src\os2
WXINC=$(WXDIR)\include WXINC=$(WXDIR)\include
WXBASESRC=$(WXDIR)\src\common WXBASESRC=$(WXDIR)\src\common
@@ -109,7 +113,7 @@ D=$(D)DLL
INC=-I$(WXINC) -I$(WXDIR)/src/jpeg -I$(WXDIR)/src/zlib -I$(EXTRAINC) INC=-I$(WXINC) -I$(WXDIR)/src/jpeg -I$(WXDIR)/src/zlib -I$(EXTRAINC)
LINKLIBS=CPPOM30I.LIB CPPOOC3I.LIB OS2386.LIB UPM32.LIB NETAPI32.LIB LINKLIBS=CPPOM30I.LIB CPPOOC3I.LIB OS2386.LIB $(UPMLIB)\UPM32.LIB $(NETLIB)\NETAPI32.LIB
EXTRALIBS=$(WXDIR)\lib\os2png.lib $(WXDIR)\lib\os2zlib.lib $(WXDIR)\lib\os2jpeg.lib $(WXDIR)\lib\os2xpm.lib EXTRALIBS=$(WXDIR)\lib\os2png.lib $(WXDIR)\lib\os2zlib.lib $(WXDIR)\lib\os2jpeg.lib $(WXDIR)\lib\os2xpm.lib
LIBS=$(WXLIB) $(EXTRALIBS) LIBS=$(WXLIB) $(EXTRALIBS)

View File

@@ -573,7 +573,7 @@ HTMLLIBOBJS = \
OBJECTS = $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) $(NONESSENTIALOBJS) $(OS2OBJS) OBJECTS = $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) $(NONESSENTIALOBJS) $(OS2OBJS)
# Normal, static library # Normal, static library
all: $(OBJECTS) $(PERIPH_TARGET) png zlib xpm jpeg $(LIBTARGET) all: $(OBJECTS) $(PERIPH_TARGET) png zlib $(LIBTARGET)
dirs: $(OS2DIR)\$D $(COMMDIR)\$D $(GENDIR)\$D $(HTMLDIR)\$D dirs: $(OS2DIR)\$D $(COMMDIR)\$D $(GENDIR)\$D $(HTMLDIR)\$D

View File

@@ -90,14 +90,57 @@ OBJECTS = \
..\xpm\$D\wrffrdat.obj \ ..\xpm\$D\wrffrdat.obj \
..\xpm\$D\wrffri.obj ..\xpm\$D\wrffri.obj
LIBOBJECTS = \
attrib.obj \
crbuffri.obj \
crdatfri.obj \
create.obj \
crifrbuf.obj \
crifrdat.obj \
data.obj \
image.obj \
info.obj \
hashtab.obj \
misc.obj \
parse.obj \
rdftodat.obj \
rdftoi.obj \
rgb.obj \
scan.obj \
simx.obj \
wrffrdat.obj \
wrffri.obj
$(LIBOBJECTS):
copy ..\xpm\$D\attrib.obj
copy ..\xpm\$D\crbuffri.obj
copy ..\xpm\$D\crdatfri.obj
copy ..\xpm\$D\create.obj
copy ..\xpm\$D\crifrbuf.obj
copy ..\xpm\$D\crifrdat.obj
copy ..\xpm\$D\data.obj
copy ..\xpm\$D\image.obj
copy ..\xpm\$D\info.obj
copy ..\xpm\$D\hashtab.obj
copy ..\xpm\$D\misc.obj
copy ..\xpm\$D\parse.obj
copy ..\xpm\$D\rdftodat.obj
copy ..\xpm\$D\rdftoi.obj
copy ..\xpm\$D\rgb.obj
copy ..\xpm\$D\scan.obj
copy ..\xpm\$D\simx.obj
copy ..\xpm\$D\wrffrdat.obj
copy ..\xpm\$D\wrffri.obj
all: $(OS2XPMLIB) all: $(OS2XPMLIB)
$(WXDIR)\lib\os2xpm.lib: $(OBJECTS) $(WXDIR)\lib\os2xpm.lib: $(LIBOBJECTS)
touch $(WXDIR)\lib\os2xpm.lib touch $(WXDIR)\lib\os2xpm.lib
del $(WXDIR)\lib\os2xpm.lib del $(WXDIR)\lib\os2xpm.lib
ilib $(OS2LIBFLAGS) $@ @<< ilib $(OS2LIBFLAGS) $@ @<<
$**; $**;
<< <<
del *.obj
clean: clean:
del $(OS2XPMLIB) del $(OS2XPMLIB)

View File

@@ -43,11 +43,17 @@ LFUNC(FreeOldColorTable, void, (XpmColor **colorTable, int ncolors));
/* /*
* Create a colortable compatible with the old style colortable * Create a colortable compatible with the old style colortable
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int
CreateOldColorTable(XpmColor* ct, int ncolors, XpmColor*** oldct)
#else
static int static int
CreateOldColorTable(ct, ncolors, oldct) CreateOldColorTable(ct, ncolors, oldct)
XpmColor *ct; XpmColor *ct;
int ncolors; int ncolors;
XpmColor ***oldct; XpmColor ***oldct;
#endif
{ {
XpmColor **colorTable, **color; XpmColor **colorTable, **color;
int a; int a;
@@ -63,10 +69,15 @@ CreateOldColorTable(ct, ncolors, oldct)
return (XpmSuccess); return (XpmSuccess);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void FreeOldColorTable(XpmColor** colorTable, int ncolors)
#else
static void static void
FreeOldColorTable(colorTable, ncolors) FreeOldColorTable(colorTable, ncolors)
XpmColor **colorTable; XpmColor **colorTable;
int ncolors; int ncolors;
#endif
{ {
int a, b; int a, b;
XpmColor **color; XpmColor **color;
@@ -88,10 +99,15 @@ FreeOldColorTable(colorTable, ncolors)
/* /*
* Free the computed color table * Free the computed color table
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
void xpmFreeColorTable(XpmColor* colorTable, int ncolors)
#else
void void
xpmFreeColorTable(colorTable, ncolors) xpmFreeColorTable(colorTable, ncolors)
XpmColor *colorTable; XpmColor *colorTable;
int ncolors; int ncolors;
#endif
{ {
int a, b; int a, b;
XpmColor *color; XpmColor *color;
@@ -110,10 +126,15 @@ xpmFreeColorTable(colorTable, ncolors)
/* /*
* Free array of extensions * Free array of extensions
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
void XpmFreeExtensions(XpmExtension* extensions, int nextensions)
#else
void void
XpmFreeExtensions(extensions, nextensions) XpmFreeExtensions(extensions, nextensions)
XpmExtension *extensions; XpmExtension *extensions;
int nextensions; int nextensions;
#endif
{ {
unsigned int i, j, nlines; unsigned int i, j, nlines;
XpmExtension *ext; XpmExtension *ext;
@@ -147,9 +168,15 @@ XpmAttributesSize()
/* /*
* Init returned data to free safely later on * Init returned data to free safely later on
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
void
xpmInitAttributes(XpmAttributes* attributes)
#else
void void
xpmInitAttributes(attributes) xpmInitAttributes(attributes)
XpmAttributes *attributes; XpmAttributes *attributes;
#endif
{ {
if (attributes) { if (attributes) {
attributes->pixels = NULL; attributes->pixels = NULL;
@@ -175,11 +202,16 @@ xpmInitAttributes(attributes)
/* /*
* Fill in the XpmAttributes with the XpmImage and the XpmInfo * Fill in the XpmAttributes with the XpmImage and the XpmInfo
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
void xpmSetAttributes(XpmAttributes* attributes, XpmImage* image, XpmInfo* info)
#else
void void
xpmSetAttributes(attributes, image, info) xpmSetAttributes(attributes, image, info)
XpmAttributes *attributes; XpmAttributes *attributes;
XpmImage *image; XpmImage *image;
XpmInfo *info; XpmInfo *info;
#endif
{ {
if (attributes->valuemask & XpmReturnColorTable) { if (attributes->valuemask & XpmReturnColorTable) {
attributes->colorTable = image->colorTable; attributes->colorTable = image->colorTable;
@@ -245,9 +277,14 @@ xpmSetAttributes(attributes, image, info)
* Free the XpmAttributes structure members * Free the XpmAttributes structure members
* but the structure itself * but the structure itself
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
void XpmFreeAttributes(XpmAttributes* attributes)
#else
void void
XpmFreeAttributes(attributes) XpmFreeAttributes(attributes)
XpmAttributes *attributes; XpmAttributes *attributes;
#endif
{ {
if (attributes->valuemask & XpmReturnPixels && attributes->npixels) { if (attributes->valuemask & XpmReturnPixels && attributes->npixels) {
XpmFree(attributes->pixels); XpmFree(attributes->pixels);

View File

@@ -49,6 +49,16 @@ LFUNC(WriteExtensions, void, (char *dataptr, unsigned int *used_size,
LFUNC(ExtensionsSize, int, (XpmExtension *ext, unsigned int num)); LFUNC(ExtensionsSize, int, (XpmExtension *ext, unsigned int num));
LFUNC(CommentsSize, int, (XpmInfo *info)); LFUNC(CommentsSize, int, (XpmInfo *info));
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int XpmCreateBufferFromImage(
Display* display
, char** buffer_return
, XImage* image
, XImage* shapeimage
, XpmAttributes* attributes
)
#else
int int
XpmCreateBufferFromImage(display, buffer_return, image, shapeimage, attributes) XpmCreateBufferFromImage(display, buffer_return, image, shapeimage, attributes)
Display *display; Display *display;
@@ -56,6 +66,7 @@ XpmCreateBufferFromImage(display, buffer_return, image, shapeimage, attributes)
XImage *image; XImage *image;
XImage *shapeimage; XImage *shapeimage;
XpmAttributes *attributes; XpmAttributes *attributes;
#endif
{ {
XpmImage xpmimage; XpmImage xpmimage;
XpmInfo info; XpmInfo info;
@@ -94,11 +105,16 @@ XpmCreateBufferFromImage(display, buffer_return, image, shapeimage, attributes)
goto error; \ goto error; \
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int XpmCreateBufferFromXpmImage(char** buffer_return, XpmImage* image, XpmInfo* info)
#else
int int
XpmCreateBufferFromXpmImage(buffer_return, image, info) XpmCreateBufferFromXpmImage(buffer_return, image, info)
char **buffer_return; char **buffer_return;
XpmImage *image; XpmImage *image;
XpmInfo *info; XpmInfo *info;
#endif
{ {
/* calculation variables */ /* calculation variables */
int ErrorStatus; int ErrorStatus;
@@ -246,6 +262,17 @@ error:
return (ErrorStatus); return (ErrorStatus);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int WriteColors(
char** dataptr
, unsigned int* data_size
, unsigned int* used_size
, XpmColor* colors
, unsigned int ncolors
, unsigned int cpp
)
#else
static int static int
WriteColors(dataptr, data_size, used_size, colors, ncolors, cpp) WriteColors(dataptr, data_size, used_size, colors, ncolors, cpp)
char **dataptr; char **dataptr;
@@ -254,6 +281,7 @@ WriteColors(dataptr, data_size, used_size, colors, ncolors, cpp)
XpmColor *colors; XpmColor *colors;
unsigned int ncolors; unsigned int ncolors;
unsigned int cpp; unsigned int cpp;
#endif
{ {
char buf[BUFSIZ]; char buf[BUFSIZ];
unsigned int a, key, l; unsigned int a, key, l;
@@ -292,6 +320,18 @@ WriteColors(dataptr, data_size, used_size, colors, ncolors, cpp)
return (XpmSuccess); return (XpmSuccess);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void WritePixels(
char* dataptr
, unsigned int* used_size
, unsigned int width
, unsigned int height
, unsigned int cpp
, unsigned int* pixels
, XpmColor* colors
)
#else
static void static void
WritePixels(dataptr, used_size, width, height, cpp, pixels, colors) WritePixels(dataptr, used_size, width, height, cpp, pixels, colors)
char *dataptr; char *dataptr;
@@ -301,6 +341,7 @@ WritePixels(dataptr, used_size, width, height, cpp, pixels, colors)
unsigned int cpp; unsigned int cpp;
unsigned int *pixels; unsigned int *pixels;
XpmColor *colors; XpmColor *colors;
#endif
{ {
char *s = dataptr; char *s = dataptr;
unsigned int x, y, h; unsigned int x, y, h;
@@ -325,10 +366,16 @@ WritePixels(dataptr, used_size, width, height, cpp, pixels, colors)
*used_size += s - dataptr; *used_size += s - dataptr;
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int
ExtensionsSize(XpmExtension* ext, unsigned int num)
#else
static int static int
ExtensionsSize(ext, num) ExtensionsSize(ext, num)
XpmExtension *ext; XpmExtension *ext;
unsigned int num; unsigned int num;
#endif
{ {
unsigned int x, y, a, size; unsigned int x, y, a, size;
char **line; char **line;
@@ -346,12 +393,22 @@ ExtensionsSize(ext, num)
return size + 13; return size + 13;
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void WriteExtensions(
char* dataptr
, unsigned int* used_size
, XpmExtension* ext
, unsigned int num
)
#else
static void static void
WriteExtensions(dataptr, used_size, ext, num) WriteExtensions(dataptr, used_size, ext, num)
char *dataptr; char *dataptr;
unsigned int *used_size; unsigned int *used_size;
XpmExtension *ext; XpmExtension *ext;
unsigned int num; unsigned int num;
#endif
{ {
unsigned int x, y, a; unsigned int x, y, a;
char **line; char **line;
@@ -380,9 +437,13 @@ WriteExtensions(dataptr, used_size, ext, num)
*used_size += s - dataptr + 13; *used_size += s - dataptr + 13;
} }
static int #ifdef __OS2__
CommentsSize(info) /* Visual Age cannot deal with old, non-ansi, code */
static int CommentsSize(XpmInfo* info)
#else
static int CommentsSize(info)
XpmInfo *info; XpmInfo *info;
#endif
{ {
int size = 0; int size = 0;

View File

@@ -50,6 +50,17 @@ LFUNC(CreateExtensions, void, (char **dataptr, unsigned int offset,
XpmExtension *ext, unsigned int num, XpmExtension *ext, unsigned int num,
unsigned int ext_nlines)); unsigned int ext_nlines));
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int
XpmCreateDataFromImage(
Display* display
, char*** data_return
, XImage* image
, XImage* shapeimage
, XpmAttributes* attributes
)
#else
int int
XpmCreateDataFromImage(display, data_return, image, shapeimage, attributes) XpmCreateDataFromImage(display, data_return, image, shapeimage, attributes)
Display *display; Display *display;
@@ -57,6 +68,7 @@ XpmCreateDataFromImage(display, data_return, image, shapeimage, attributes)
XImage *image; XImage *image;
XImage *shapeimage; XImage *shapeimage;
XpmAttributes *attributes; XpmAttributes *attributes;
#endif
{ {
XpmImage xpmimage; XpmImage xpmimage;
XpmInfo info; XpmInfo info;
@@ -92,11 +104,17 @@ XpmCreateDataFromImage(display, data_return, image, shapeimage, attributes)
goto exit; \ goto exit; \
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int
XpmCreateDataFromXpmImage(char*** data_return, XpmImage* image, XpmInfo* info)
#else
int int
XpmCreateDataFromXpmImage(data_return, image, info) XpmCreateDataFromXpmImage(data_return, image, info)
char ***data_return; char ***data_return;
XpmImage *image; XpmImage *image;
XpmInfo *info; XpmInfo *info;
#endif
{ {
/* calculation variables */ /* calculation variables */
int ErrorStatus; int ErrorStatus;
@@ -209,6 +227,17 @@ exit:
return(ErrorStatus); return(ErrorStatus);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int
CreateColors(
char** dataptr
, unsigned int* data_size
, XpmColor* colors
, unsigned int ncolors
, unsigned int cpp
)
#else
static int static int
CreateColors(dataptr, data_size, colors, ncolors, cpp) CreateColors(dataptr, data_size, colors, ncolors, cpp)
char **dataptr; char **dataptr;
@@ -216,6 +245,7 @@ CreateColors(dataptr, data_size, colors, ncolors, cpp)
XpmColor *colors; XpmColor *colors;
unsigned int ncolors; unsigned int ncolors;
unsigned int cpp; unsigned int cpp;
#endif
{ {
char buf[BUFSIZ]; char buf[BUFSIZ];
unsigned int a, key, l; unsigned int a, key, l;
@@ -249,6 +279,17 @@ CreateColors(dataptr, data_size, colors, ncolors, cpp)
return (XpmSuccess); return (XpmSuccess);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void CreatePixels(
char** dataptr
, unsigned int width
, unsigned int height
, unsigned int cpp
, unsigned int* pixels
, XpmColor* colors
)
#else
static void static void
CreatePixels(dataptr, width, height, cpp, pixels, colors) CreatePixels(dataptr, width, height, cpp, pixels, colors)
char **dataptr; char **dataptr;
@@ -257,6 +298,7 @@ CreatePixels(dataptr, width, height, cpp, pixels, colors)
unsigned int cpp; unsigned int cpp;
unsigned int *pixels; unsigned int *pixels;
XpmColor *colors; XpmColor *colors;
#endif
{ {
char *s; char *s;
unsigned int x, y, h, offset; unsigned int x, y, h, offset;
@@ -281,12 +323,22 @@ CreatePixels(dataptr, width, height, cpp, pixels, colors)
*s = '\0'; *s = '\0';
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void CountExtensions(
XpmExtension* ext
, unsigned int num
, unsigned int* ext_size
, unsigned int* ext_nlines
)
#else
static void static void
CountExtensions(ext, num, ext_size, ext_nlines) CountExtensions(ext, num, ext_size, ext_nlines)
XpmExtension *ext; XpmExtension *ext;
unsigned int num; unsigned int num;
unsigned int *ext_size; unsigned int *ext_size;
unsigned int *ext_nlines; unsigned int *ext_nlines;
#endif
{ {
unsigned int x, y, a, size, nlines; unsigned int x, y, a, size, nlines;
char **line; char **line;
@@ -307,6 +359,17 @@ CountExtensions(ext, num, ext_size, ext_nlines)
*ext_nlines = nlines + 1; *ext_nlines = nlines + 1;
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void
CreateExtensions(
char** dataptr
, unsigned int offset
, XpmExtension* ext
, unsigned int num
, unsigned int ext_nlines
)
#else
static void static void
CreateExtensions(dataptr, offset, ext, num, ext_nlines) CreateExtensions(dataptr, offset, ext, num, ext_nlines)
char **dataptr; char **dataptr;
@@ -314,6 +377,7 @@ CreateExtensions(dataptr, offset, ext, num, ext_nlines)
XpmExtension *ext; XpmExtension *ext;
unsigned int num; unsigned int num;
unsigned int ext_nlines; unsigned int ext_nlines;
#endif
{ {
unsigned int x, y, a, b; unsigned int x, y, a, b;
char **line; char **line;

View File

@@ -141,9 +141,21 @@ LFUNC(APutImagePixels, void, (XImage *ximage, unsigned int width,
# endif/* AMIGA */ # endif/* AMIGA */
#else /* FOR_MSW */ #else /* FOR_MSW */
/* FOR_MSW pixel routine */ /* FOR_MSW pixel routine */
#ifdef __OS2__
LFUNC(MSWPutImagePixels, void, (
HPS hps
, Display* dc
, XImage* image
, unsigned int width
, unsigned int height
, unsigned int* pixelindex
, Pixel* pixels
));
#else
LFUNC(MSWPutImagePixels, void, (Display *dc, XImage *image, LFUNC(MSWPutImagePixels, void, (Display *dc, XImage *image,
unsigned int width, unsigned int height, unsigned int width, unsigned int height,
unsigned int *pixelindex, Pixel *pixels)); unsigned int *pixelindex, Pixel *pixels));
#endif
#endif /* FOR_MSW */ #endif /* FOR_MSW */
#ifdef NEED_STRCASECMP #ifdef NEED_STRCASECMP
@@ -153,9 +165,14 @@ FUNC(xpmstrcasecmp, int, (char *s1, char *s2));
* in case strcasecmp is not provided by the system here is one * in case strcasecmp is not provided by the system here is one
* which does the trick * which does the trick
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int xpmstrcasecmp(register char* s1, register char* s2)
#else
int int
xpmstrcasecmp(s1, s2) xpmstrcasecmp(s1, s2)
register char *s1, *s2; register char *s1, *s2;
#endif
{ {
register int c1, c2; register int c1, c2;
@@ -175,9 +192,14 @@ xpmstrcasecmp(s1, s2)
/* /*
* return the default color key related to the given visual * return the default color key related to the given visual
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int xpmVisualType(Visual* visual)
#else
static int static int
xpmVisualType(visual) xpmVisualType(visual)
Visual *visual; Visual *visual;
#endif
{ {
#ifndef FOR_MSW #ifndef FOR_MSW
# ifndef AMIGA # ifndef AMIGA
@@ -211,9 +233,14 @@ typedef struct {
long closeness; long closeness;
} CloseColor; } CloseColor;
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int closeness_cmp(Const void* a, Const void* b)
#else
static int static int
closeness_cmp(a, b) closeness_cmp(a, b)
Const void *a, *b; Const void *a, *b;
#endif
{ {
CloseColor *x = (CloseColor *) a, *y = (CloseColor *) b; CloseColor *x = (CloseColor *) a, *y = (CloseColor *) b;
@@ -226,19 +253,37 @@ closeness_cmp(a, b)
* call XParseColor if colorname is given, return negative value if failure * call XParseColor if colorname is given, return negative value if failure
* call XAllocColor and return 0 if failure, positive otherwise * call XAllocColor and return 0 if failure, positive otherwise
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int
AllocColor(
Display* display
, Colormap colormap
, char* colorname
, XColor* xcolor
, void* closure
)
#else
static int static int
AllocColor(display, colormap, colorname, xcolor, closure) AllocColor(display, colormap, colorname, xcolor, closure)
Display *display; Display *display;
Colormap colormap; Colormap* colormap;
char *colorname; char *colorname;
XColor *xcolor; XColor *xcolor;
void *closure; /* not used */ void *closure; /* not used */
#endif
{ {
int status; int status;
if (colorname) if (colorname)
#ifdef __OS2__
if (!XParseColor(display, &colormap, colorname, xcolor))
return -1;
status = XAllocColor(display, &colormap, xcolor);
#else
if (!XParseColor(display, colormap, colorname, xcolor)) if (!XParseColor(display, colormap, colorname, xcolor))
return -1; return -1;
status = XAllocColor(display, colormap, xcolor); status = XAllocColor(display, colormap, xcolor);
#endif
return status != 0 ? 1 : 0; return status != 0 ? 1 : 0;
} }
@@ -434,6 +479,29 @@ SetCloseColor(display, colormap, visual, col, image_pixel, mask_pixel,
* return 0 if success, 1 otherwise. * return 0 if success, 1 otherwise.
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int
SetColor(
Display* display
, Colormap colormap
, Visual* visual
, char* colorname
, unsigned int color_index
, Pixel* image_pixel
, Pixel* mask_pixel
, unsigned int* mask_pixel_index
, Pixel* alloc_pixels
, unsigned int* nalloc_pixels
, Pixel* used_pixels
, unsigned int* nused_pixels
, XpmAttributes* attributes
, XColor* cols
, int ncols
, XpmAllocColorFunc allocColor
, void* closure
)
#else
static int static int
SetColor(display, colormap, visual, colorname, color_index, SetColor(display, colormap, visual, colorname, color_index,
image_pixel, mask_pixel, mask_pixel_index, image_pixel, mask_pixel, mask_pixel_index,
@@ -455,6 +523,7 @@ SetColor(display, colormap, visual, colorname, color_index,
int ncols; int ncols;
XpmAllocColorFunc allocColor; XpmAllocColorFunc allocColor;
void *closure; void *closure;
#endif
{ {
XColor xcolor; XColor xcolor;
int status; int status;
@@ -480,8 +549,12 @@ SetColor(display, colormap, visual, colorname, color_index,
*image_pixel = xcolor.pixel; *image_pixel = xcolor.pixel;
#ifndef FOR_MSW #ifndef FOR_MSW
*mask_pixel = 1; *mask_pixel = 1;
#else
#ifdef __OS2__
*mask_pixel = OS2RGB(0,0,0);
#else #else
*mask_pixel = RGB(0,0,0); *mask_pixel = RGB(0,0,0);
#endif
#endif #endif
used_pixels[(*nused_pixels)++] = xcolor.pixel; used_pixels[(*nused_pixels)++] = xcolor.pixel;
} else { } else {
@@ -489,7 +562,11 @@ SetColor(display, colormap, visual, colorname, color_index,
#ifndef FOR_MSW #ifndef FOR_MSW
*mask_pixel = 0; *mask_pixel = 0;
#else #else
*mask_pixel = RGB(255,255,255); #ifdef __OS2__
*mask_pixel = OS2RGB(0,0,0);
#else
*mask_pixel = RGB(0,0,0);
#endif
#endif #endif
/* store the color table index */ /* store the color table index */
*mask_pixel_index = color_index; *mask_pixel_index = color_index;
@@ -497,7 +574,23 @@ SetColor(display, colormap, visual, colorname, color_index,
return (0); return (0);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int
CreateColors(
Display* display
, XpmAttributes* attributes
, XpmColor* colors
, unsigned int ncolors
, Pixel* image_pixels
, Pixel* mask_pixels
, unsigned int* mask_pixel_index
, Pixel* alloc_pixels
, unsigned int* nalloc_pixels
, Pixel* used_pixels
, unsigned int* nused_pixels
)
#else
static int static int
CreateColors(display, attributes, colors, ncolors, image_pixels, mask_pixels, CreateColors(display, attributes, colors, ncolors, image_pixels, mask_pixels,
mask_pixel_index, alloc_pixels, nalloc_pixels, mask_pixel_index, alloc_pixels, nalloc_pixels,
@@ -513,6 +606,7 @@ CreateColors(display, attributes, colors, ncolors, image_pixels, mask_pixels,
unsigned int *nalloc_pixels; unsigned int *nalloc_pixels;
Pixel *used_pixels; Pixel *used_pixels;
unsigned int *nused_pixels; unsigned int *nused_pixels;
#endif
{ {
/* variables stored in the XpmAttributes structure */ /* variables stored in the XpmAttributes structure */
Visual *visual; Visual *visual;
@@ -730,6 +824,17 @@ CreateColors(display, attributes, colors, ncolors, image_pixels, mask_pixels,
/* default FreeColors function, simply call XFreeColors */ /* default FreeColors function, simply call XFreeColors */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int
FreeColors(
Display* display
, Colormap colormap
, Pixel* pixels
, int n
, void* closure
)
#else
static int static int
FreeColors(display, colormap, pixels, n, closure) FreeColors(display, colormap, pixels, n, closure)
Display *display; Display *display;
@@ -737,6 +842,7 @@ FreeColors(display, colormap, pixels, n, closure)
Pixel *pixels; Pixel *pixels;
int n; int n;
void *closure; /* not used */ void *closure; /* not used */
#endif
{ {
return XFreeColors(display, colormap, pixels, n, 0); return XFreeColors(display, colormap, pixels, n, 0);
} }
@@ -750,6 +856,16 @@ FreeColors(display, colormap, pixels, n, closure)
goto error; \ goto error; \
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int XpmCreateImageFromXpmImage(
Display* display
, XpmImage* image
, XImage** image_return
, XImage** shapeimage_return
, XpmAttributes* attributes
)
#else
int int
XpmCreateImageFromXpmImage(display, image, XpmCreateImageFromXpmImage(display, image,
image_return, shapeimage_return, attributes) image_return, shapeimage_return, attributes)
@@ -758,7 +874,13 @@ XpmCreateImageFromXpmImage(display, image,
XImage **image_return; XImage **image_return;
XImage **shapeimage_return; XImage **shapeimage_return;
XpmAttributes *attributes; XpmAttributes *attributes;
#endif
{ {
#ifdef __OS2__
HAB hab;
HPS hps;
SIZEL sizl = {0, 0};
#endif
/* variables stored in the XpmAttributes structure */ /* variables stored in the XpmAttributes structure */
Visual *visual; Visual *visual;
Colormap colormap; Colormap colormap;
@@ -886,8 +1008,14 @@ XpmCreateImageFromXpmImage(display, image,
image->data, image_pixels); image->data, image_pixels);
# endif # endif
#else /* FOR_MSW */ #else /* FOR_MSW */
#ifdef __OS2__
hps = GpiCreatePS(hab, *display, &sizl, GPIA_ASSOC|PU_PELS);
MSWPutImagePixels(hps, display, ximage, image->width, image->height,
image->data, image_pixels);
#else
MSWPutImagePixels(display, ximage, image->width, image->height, MSWPutImagePixels(display, ximage, image->width, image->height,
image->data, image_pixels); image->data, image_pixels);
#endif
#endif #endif
} }
/* create the shape mask image */ /* create the shape mask image */
@@ -906,8 +1034,14 @@ XpmCreateImageFromXpmImage(display, image,
image->data, mask_pixels); image->data, mask_pixels);
# endif # endif
#else /* FOR_MSW */ #else /* FOR_MSW */
#ifdef __OS2__
hps = GpiCreatePS(hab, *display, &sizl, GPIA_ASSOC|PU_PELS);
MSWPutImagePixels(hps, display, shapeimage, image->width, image->height,
image->data, mask_pixels);
#else
MSWPutImagePixels(display, shapeimage, image->width, image->height, MSWPutImagePixels(display, shapeimage, image->width, image->height,
image->data, mask_pixels); image->data, mask_pixels);
#endif
#endif #endif
} }
@@ -964,6 +1098,18 @@ error:
/* /*
* Create an XImage with its data * Create an XImage with its data
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int CreateXImage(
Display* display
, Visual* visual
, unsigned int depth
, int format
, unsigned int width
, unsigned int height
, XImage** image_return
)
#else
static int static int
CreateXImage(display, visual, depth, format, width, height, image_return) CreateXImage(display, visual, depth, format, width, height, image_return)
Display *display; Display *display;
@@ -973,6 +1119,7 @@ CreateXImage(display, visual, depth, format, width, height, image_return)
unsigned int width; unsigned int width;
unsigned int height; unsigned int height;
XImage **image_return; XImage **image_return;
#endif
{ {
int bitmap_pad; int bitmap_pad;
@@ -1057,10 +1204,16 @@ static unsigned char Const _reverse_byte[0x100] = {
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
}; };
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int
_XReverse_Bytes(register unsigned char* bpt, register int nb)
#else
static int static int
_XReverse_Bytes(bpt, nb) _XReverse_Bytes(bpt, nb)
register unsigned char *bpt; register unsigned char *bpt;
register int nb; register int nb;
#endif
{ {
do { do {
*bpt = _reverse_byte[*bpt]; *bpt = _reverse_byte[*bpt];
@@ -1070,10 +1223,15 @@ _XReverse_Bytes(bpt, nb)
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
void xpm_xynormalizeimagebits(register unsigned char* bp, register XImage* img)
#else
void void
xpm_xynormalizeimagebits(bp, img) xpm_xynormalizeimagebits(bp, img)
register unsigned char *bp; register unsigned char *bp;
register XImage *img; register XImage *img;
#endif
{ {
register unsigned char c; register unsigned char c;
@@ -1100,10 +1258,15 @@ xpm_xynormalizeimagebits(bp, img)
_XReverse_Bytes(bp, img->bitmap_unit >> 3); _XReverse_Bytes(bp, img->bitmap_unit >> 3);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
void xpm_znormalizeimagebits(register unsigned char* bp, register XImage* img)
#else
void void
xpm_znormalizeimagebits(bp, img) xpm_znormalizeimagebits(bp, img)
register unsigned char *bp; register unsigned char *bp;
register XImage *img; register XImage *img;
#endif
{ {
register unsigned char c; register unsigned char c;
@@ -1145,6 +1308,15 @@ static unsigned char Const _lomask[0x09] = {
static unsigned char Const _himask[0x09] = { static unsigned char Const _himask[0x09] = {
0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00}; 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00};
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void _putbits(
register char* src
, int dstoffset
, register int numbits
, register char* dst
)
#else
static void static void
_putbits(src, dstoffset, numbits, dst) _putbits(src, dstoffset, numbits, dst)
register char *src; /* address of source bit string */ register char *src; /* address of source bit string */
@@ -1153,6 +1325,7 @@ _putbits(src, dstoffset, numbits, dst)
register int numbits; /* number of bits to copy to register int numbits; /* number of bits to copy to
* destination */ * destination */
register char *dst; /* address of destination bit string */ register char *dst; /* address of destination bit string */
#endif
{ {
register unsigned char chlo, chhi; register unsigned char chlo, chhi;
int hibits; int hibits;
@@ -1193,6 +1366,16 @@ _putbits(src, dstoffset, numbits, dst)
* copy the temp back into the destination image data * copy the temp back into the destination image data
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void PutImagePixels(
, XImage* image
, unsigned int width
, unsigned int height
, unsigned int* pixelindex
, Pixel* pixels
)
#else
static void static void
PutImagePixels(image, width, height, pixelindex, pixels) PutImagePixels(image, width, height, pixelindex, pixels)
XImage *image; XImage *image;
@@ -1200,6 +1383,7 @@ PutImagePixels(image, width, height, pixelindex, pixels)
unsigned int height; unsigned int height;
unsigned int *pixelindex; unsigned int *pixelindex;
Pixel *pixels; Pixel *pixels;
#endif
{ {
register char *src; register char *src;
register char *dst; register char *dst;
@@ -1280,6 +1464,17 @@ static unsigned long byteorderpixel = MSBFirst << 24;
3.2e code - by default you get the speeded-up version. 3.2e code - by default you get the speeded-up version.
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void
PutImagePixels32(
, XImage* image
, unsigned int width
, unsigned int height
, unsigned int* pixelindex
, Pixel* pixels
)
#else
static void static void
PutImagePixels32(image, width, height, pixelindex, pixels) PutImagePixels32(image, width, height, pixelindex, pixels)
XImage *image; XImage *image;
@@ -1287,6 +1482,7 @@ PutImagePixels32(image, width, height, pixelindex, pixels)
unsigned int height; unsigned int height;
unsigned int *pixelindex; unsigned int *pixelindex;
Pixel *pixels; Pixel *pixels;
#endif
{ {
unsigned char *data; unsigned char *data;
unsigned int *iptr; unsigned int *iptr;
@@ -1390,6 +1586,16 @@ PutImagePixels32(image, width, height, pixelindex, pixels)
* write pixels into a 16-bits Z image data structure * write pixels into a 16-bits Z image data structure
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void PutImagePixels16(
, XImage* image
, unsigned int width
, unsigned int height
, unsigned int* pixelindex
, Pixel* pixels
)
#else
static void static void
PutImagePixels16(image, width, height, pixelindex, pixels) PutImagePixels16(image, width, height, pixelindex, pixels)
XImage *image; XImage *image;
@@ -1397,6 +1603,7 @@ PutImagePixels16(image, width, height, pixelindex, pixels)
unsigned int height; unsigned int height;
unsigned int *pixelindex; unsigned int *pixelindex;
Pixel *pixels; Pixel *pixels;
#endif
{ {
unsigned char *data; unsigned char *data;
unsigned int *iptr; unsigned int *iptr;
@@ -1471,6 +1678,16 @@ PutImagePixels16(image, width, height, pixelindex, pixels)
* write pixels into a 8-bits Z image data structure * write pixels into a 8-bits Z image data structure
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void PutImagePixels8(
, XImage* image
, unsigned int width
, unsigned int height
, unsigned int* pixelindex
, Pixel* pixels
)
#else
static void static void
PutImagePixels8(image, width, height, pixelindex, pixels) PutImagePixels8(image, width, height, pixelindex, pixels)
XImage *image; XImage *image;
@@ -1478,6 +1695,7 @@ PutImagePixels8(image, width, height, pixelindex, pixels)
unsigned int height; unsigned int height;
unsigned int *pixelindex; unsigned int *pixelindex;
Pixel *pixels; Pixel *pixels;
#endif
{ {
char *data; char *data;
unsigned int *iptr; unsigned int *iptr;
@@ -1518,6 +1736,16 @@ PutImagePixels8(image, width, height, pixelindex, pixels)
* write pixels into a 1-bit depth image data structure and **offset null** * write pixels into a 1-bit depth image data structure and **offset null**
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void PutImagePixels1(
, XImage* image
, unsigned int width
, unsigned int height
, unsigned int* pixelindex
, Pixel* pixels
)
#else
static void static void
PutImagePixels1(image, width, height, pixelindex, pixels) PutImagePixels1(image, width, height, pixelindex, pixels)
XImage *image; XImage *image;
@@ -1525,6 +1753,7 @@ PutImagePixels1(image, width, height, pixelindex, pixels)
unsigned int height; unsigned int height;
unsigned int *pixelindex; unsigned int *pixelindex;
Pixel *pixels; Pixel *pixels;
#endif
{ {
if (image->byte_order != image->bitmap_bit_order) if (image->byte_order != image->bitmap_bit_order)
PutImagePixels(image, width, height, pixelindex, pixels); PutImagePixels(image, width, height, pixelindex, pixels);
@@ -1632,6 +1861,16 @@ PutImagePixels1(image, width, height, pixelindex, pixels)
} }
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int XpmCreatePixmapFromXpmImage(
, Display* display
, Drawable d
, XpmImage* image
, Pixmap* pixmap_return
, Pixmap* shapemask_return
, XpmAttributes* attributes
#else
int int
XpmCreatePixmapFromXpmImage(display, d, image, XpmCreatePixmapFromXpmImage(display, d, image,
pixmap_return, shapemask_return, attributes) pixmap_return, shapemask_return, attributes)
@@ -1641,6 +1880,7 @@ XpmCreatePixmapFromXpmImage(display, d, image,
Pixmap *pixmap_return; Pixmap *pixmap_return;
Pixmap *shapemask_return; Pixmap *shapemask_return;
XpmAttributes *attributes; XpmAttributes *attributes;
#endif
{ {
XImage *ximage, *shapeimage; XImage *ximage, *shapeimage;
int ErrorStatus; int ErrorStatus;
@@ -1717,6 +1957,19 @@ APutImagePixels (
# endif/* AMIGA */ # endif/* AMIGA */
#else /* FOR_MSW part follows */ #else /* FOR_MSW part follows */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void MSWPutImagePixels(
HPS hps
, Display* dc
, XImage* image
, unsigned int width
, unsigned int height
, unsigned int* pixelindex
, Pixel* pixels
)
#else
static void static void
MSWPutImagePixels(dc, image, width, height, pixelindex, pixels) MSWPutImagePixels(dc, image, width, height, pixelindex, pixels)
Display *dc; Display *dc;
@@ -1725,18 +1978,38 @@ MSWPutImagePixels(dc, image, width, height, pixelindex, pixels)
unsigned int height; unsigned int height;
unsigned int *pixelindex; unsigned int *pixelindex;
Pixel *pixels; Pixel *pixels;
#endif
{ {
unsigned int *data = pixelindex; unsigned int *data = pixelindex;
unsigned int x, y; unsigned int x, y;
HBITMAP obm; HBITMAP obm;
#ifdef __OS2__
POINTL point;
obm = GpiSetBitmap(hps, image->bitmap);
#else
obm = SelectObject(*dc, image->bitmap); obm = SelectObject(*dc, image->bitmap);
#endif
for (y = 0; y < height; y++) { for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) { for (x = 0; x < width; x++) {
#ifdef __OS2__
point.x = x;
point.y = y;
GpiSetColor(hps, (LONG)pixels[*(data++)]);
GpiSetPel(hps, &point);
#else
SetPixel(*dc, x, y, pixels[*(data++)]); /* data is [x+y*width] */ SetPixel(*dc, x, y, pixels[*(data++)]); /* data is [x+y*width] */
#endif
} }
} }
#ifdef __OS2__
GpiSetBitmap(hps, obm);
#else
SelectObject(*dc, obm); SelectObject(*dc, obm);
#endif
} }
#endif /* FOR_MSW */ #endif /* FOR_MSW */
@@ -1936,6 +2209,18 @@ PutPixel1LSB(ximage, x, y, pixel)
/* /*
* This function parses an Xpm file or data and directly create an XImage * This function parses an Xpm file or data and directly create an XImage
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int xpmParseDataAndCreate(
Display* display
, xpmData* data
, XImage** image_return
, XImage** shapeimage_return
, XpmImage* image
, XpmInfo* info
, XpmAttributes* attributes
)
#else
int int
xpmParseDataAndCreate(display, data, image_return, shapeimage_return, xpmParseDataAndCreate(display, data, image_return, shapeimage_return,
image, info, attributes) image, info, attributes)
@@ -1946,6 +2231,7 @@ xpmParseDataAndCreate(display, data, image_return, shapeimage_return,
XpmImage *image; XpmImage *image;
XpmInfo *info; XpmInfo *info;
XpmAttributes *attributes; XpmAttributes *attributes;
#endif
{ {
/* variables stored in the XpmAttributes structure */ /* variables stored in the XpmAttributes structure */
Visual *visual; Visual *visual;
@@ -2275,6 +2561,23 @@ error:
return (ErrorStatus); return (ErrorStatus);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int ParseAndPutPixels(
Display* dc
, xpmData* data
, unsigned int width
, unsigned int height
, unsigned int ncolors
, unsigned int cpp
, XpmColor* colorTable
, xpmHashTable* hashtable
, XImage* image
, Pixel* image_pixels
, XImage* shapeimage
, Pixel* shape_pixels
)
#else
static int static int
ParseAndPutPixels( ParseAndPutPixels(
#ifdef FOR_MSW #ifdef FOR_MSW
@@ -2296,8 +2599,16 @@ ParseAndPutPixels(
Pixel *image_pixels; Pixel *image_pixels;
XImage *shapeimage; XImage *shapeimage;
Pixel *shape_pixels; Pixel *shape_pixels;
#endif
{ {
unsigned int a, x, y; unsigned int a, x, y;
#ifdef __OS2__
HAB hab;
HPS hps;
DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL};
SIZEL sizl = {0, 0};
POINTL point;
#endif
switch (cpp) { switch (cpp) {
@@ -2310,14 +2621,25 @@ ParseAndPutPixels(
HBITMAP obm, sobm; HBITMAP obm, sobm;
if ( shapeimage ) { if ( shapeimage ) {
#ifdef __OS2__
shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
hps = GpiCreatePS(hab, *dc, &sizl, GPIA_ASSOC | PU_PELS);
sobm = GpiSetBitmap(hps, shapeimage->bitmap);
#else
shapedc = CreateCompatibleDC(*dc); shapedc = CreateCompatibleDC(*dc);
sobm = SelectObject(shapedc, shapeimage->bitmap); sobm = SelectObject(shapedc, shapeimage->bitmap);
#endif
} else { } else {
shapedc = NULL; shapedc = NULL;
} }
#ifdef __OS2__
obm = GpiSetBitmap(hps, image->bitmap);
#else
obm = SelectObject(*dc, image->bitmap); obm = SelectObject(*dc, image->bitmap);
#endif #endif
#endif
bzero((char *)colidx, 256 * sizeof(short)); bzero((char *)colidx, 256 * sizeof(short));
for (a = 0; a < ncolors; a++) for (a = 0; a < ncolors; a++)
@@ -2334,10 +2656,24 @@ ParseAndPutPixels(
if (shapeimage) if (shapeimage)
XPutPixel(shapeimage, x, y, XPutPixel(shapeimage, x, y,
shape_pixels[colidx[c] - 1]); shape_pixels[colidx[c] - 1]);
#else
#ifdef __OS2__
point.x = x;
point.y = y;
GpiSetColor(hps, (LONG)image_pixels[colidx[c] - 1]);
GpiSetPel(hps, &point);
#else #else
SetPixel(*dc, x, y, image_pixels[colidx[c] - 1]); SetPixel(*dc, x, y, image_pixels[colidx[c] - 1]);
#endif
if (shapedc) { if (shapedc) {
#ifdef __OS2__
point.x = x;
point.y = y;
GpiSetColor(hps, (LONG)shape_pixels[colidx[c] - 1]);
GpiSetPel(hps, &point);
#else
SetPixel(shapedc, x, y, shape_pixels[colidx[c] - 1]); SetPixel(shapedc, x, y, shape_pixels[colidx[c] - 1]);
#endif
} }
#endif #endif
} else } else
@@ -2346,10 +2682,19 @@ ParseAndPutPixels(
} }
#ifdef FOR_MSW #ifdef FOR_MSW
if ( shapedc ) { if ( shapedc ) {
#ifdef __OS2__
GpiSetBitmap(hps, sobm);
DevCloseDC(shapedc);
#else
SelectObject(shapedc, sobm); SelectObject(shapedc, sobm);
DeleteDC(shapedc); DeleteDC(shapedc);
#endif
} }
#ifdef __OS2__
GpiSetBitmap(hps, obm);
#else
SelectObject(*dc, obm); SelectObject(*dc, obm);
#endif
#endif #endif
} }
break; break;
@@ -2357,7 +2702,6 @@ ParseAndPutPixels(
case (2): /* Optimize for double character case (2): /* Optimize for double character
* colors */ * colors */
{ {
/* free all allocated pointers at all exits */ /* free all allocated pointers at all exits */
#define FREE_CIDX {int f; for (f = 0; f < 256; f++) \ #define FREE_CIDX {int f; for (f = 0; f < 256; f++) \
if (cidx[f]) XpmFree(cidx[f]);} if (cidx[f]) XpmFree(cidx[f]);}
@@ -2394,13 +2738,32 @@ if (cidx[f]) XpmFree(cidx[f]);}
if (shapeimage) if (shapeimage)
XPutPixel(shapeimage, x, y, XPutPixel(shapeimage, x, y,
shape_pixels[cidx[cc1][cc2] - 1]); shape_pixels[cidx[cc1][cc2] - 1]);
#else
#ifdef __OS2__
*dc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
hps = GpiCreatePS(hab, *dc, &sizl, GPIA_ASSOC | PU_PELS);
GpiSetBitmap(hps, image->bitmap);
point.x = x;
point.y = y;
GpiSetColor(hps, (LONG)image_pixels[cidx[cc1][cc2] - 1]);
GpiSetPel(hps, &point);
#else #else
SelectObject(*dc, image->bitmap); SelectObject(*dc, image->bitmap);
SetPixel(*dc, x, y, image_pixels[cidx[cc1][cc2] - 1]); SetPixel(*dc, x, y, image_pixels[cidx[cc1][cc2] - 1]);
#endif
if (shapeimage) { if (shapeimage) {
#ifdef __OS2__
GpiSetBitmap(hps, shapeimage->bitmap);
point.x = x;
point.y = y;
GpiSetColor(hps, (LONG)shape_pixels[cidx[cc1][cc2] - 1]);
GpiSetPel(hps, &point);
#else
SelectObject(*dc, shapeimage->bitmap); SelectObject(*dc, shapeimage->bitmap);
SetPixel(*dc, x, y, SetPixel(*dc, x, y,
shape_pixels[cidx[cc1][cc2] - 1]); shape_pixels[cidx[cc1][cc2] - 1]);
#endif
} }
#endif #endif
} else { } else {
@@ -2441,14 +2804,33 @@ if (cidx[f]) XpmFree(cidx[f]);}
if (shapeimage) if (shapeimage)
XPutPixel(shapeimage, x, y, XPutPixel(shapeimage, x, y,
shape_pixels[HashColorIndex(slot)]); shape_pixels[HashColorIndex(slot)]);
#else
#ifdef __OS2__
*dc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
hps = GpiCreatePS(hab, *dc, &sizl, GPIA_ASSOC | PU_PELS);
GpiSetBitmap(hps, image->bitmap);
point.x = x;
point.y = y;
GpiSetColor(hps, (LONG)image_pixels[HashColorIndex(slot)]);
GpiSetPel(hps, &point);
#else #else
SelectObject(*dc, image->bitmap); SelectObject(*dc, image->bitmap);
SetPixel(*dc, x, y, SetPixel(*dc, x, y,
image_pixels[HashColorIndex(slot)]); image_pixels[HashColorIndex(slot)]);
#endif
if (shapeimage) { if (shapeimage) {
#ifdef __OS2__
GpiSetBitmap(hps, shapeimage->bitmap);
point.x = x;
point.y = y;
GpiSetColor(hps, (LONG)shape_pixels[HashColorIndex(slot)]);
GpiSetPel(hps, &point);
#else
SelectObject(*dc, shapeimage->bitmap); SelectObject(*dc, shapeimage->bitmap);
SetPixel(*dc, x, y, SetPixel(*dc, x, y,
shape_pixels[HashColorIndex(slot)]); shape_pixels[HashColorIndex(slot)]);
#endif
} }
#endif #endif
} }
@@ -2468,12 +2850,31 @@ if (cidx[f]) XpmFree(cidx[f]);}
XPutPixel(image, x, y, image_pixels[a]); XPutPixel(image, x, y, image_pixels[a]);
if (shapeimage) if (shapeimage)
XPutPixel(shapeimage, x, y, shape_pixels[a]); XPutPixel(shapeimage, x, y, shape_pixels[a]);
#else
#ifdef __OS2__
*dc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
hps = GpiCreatePS(hab, *dc, &sizl, GPIA_ASSOC | PU_PELS);
GpiSetBitmap(hps, image->bitmap);
point.x = x;
point.y = y;
GpiSetColor(hps, (LONG)image_pixels[a]);
GpiSetPel(hps, &point);
#else #else
SelectObject(*dc, image->bitmap); SelectObject(*dc, image->bitmap);
SetPixel(*dc, x, y, image_pixels[a]); SetPixel(*dc, x, y, image_pixels[a]);
#endif
if (shapeimage) { if (shapeimage) {
#ifdef __OS2__
GpiSetBitmap(hps, image->bitmap);
point.x = x;
point.y = y;
GpiSetColor(hps, (LONG)shape_pixels[a]);
GpiSetPel(hps, &point);
#else
SelectObject(*dc, shapeimage->bitmap); SelectObject(*dc, shapeimage->bitmap);
SetPixel(*dc, x, y, shape_pixels[a]); SetPixel(*dc, x, y, shape_pixels[a]);
#endif
} }
#endif #endif
} }

View File

@@ -36,6 +36,16 @@
LFUNC(OpenBuffer, void, (char *buffer, xpmData *mdata)); LFUNC(OpenBuffer, void, (char *buffer, xpmData *mdata));
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int XpmCreateImageFromBuffer(
Display* display
, char* buffer
, XImage** image_return
, XImage** shapeimage_return
, XpmAttributes* attributes
)
#else
int int
XpmCreateImageFromBuffer(display, buffer, image_return, XpmCreateImageFromBuffer(display, buffer, image_return,
shapeimage_return, attributes) shapeimage_return, attributes)
@@ -44,6 +54,7 @@ XpmCreateImageFromBuffer(display, buffer, image_return,
XImage **image_return; XImage **image_return;
XImage **shapeimage_return; XImage **shapeimage_return;
XpmAttributes *attributes; XpmAttributes *attributes;
#endif
{ {
XpmImage image; XpmImage image;
XpmInfo info; XpmInfo info;
@@ -79,11 +90,20 @@ XpmCreateImageFromBuffer(display, buffer, image_return,
return (ErrorStatus); return (ErrorStatus);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int XpmCreateXpmImageFromBuffer(
char* buffer
, XpmImage* image
, XpmInfo* info
)
#else
int int
XpmCreateXpmImageFromBuffer(buffer, image, info) XpmCreateXpmImageFromBuffer(buffer, image, info)
char *buffer; char *buffer;
XpmImage *image; XpmImage *image;
XpmInfo *info; XpmInfo *info;
#endif
{ {
xpmData mdata; xpmData mdata;
int ErrorStatus; int ErrorStatus;
@@ -104,10 +124,15 @@ XpmCreateXpmImageFromBuffer(buffer, image, info)
/* /*
* open the given buffer to be read or written as an xpmData which is returned * open the given buffer to be read or written as an xpmData which is returned
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void OpenBuffer(char* buffer, xpmData* mdata)
#else
static void static void
OpenBuffer(buffer, mdata) OpenBuffer(buffer, mdata)
char *buffer; char *buffer;
xpmData *mdata; xpmData *mdata;
#endif
{ {
mdata->type = XPMBUFFER; mdata->type = XPMBUFFER;
mdata->cptr = buffer; mdata->cptr = buffer;

View File

@@ -36,6 +36,16 @@
LFUNC(OpenArray, void, (char **data, xpmData *mdata)); LFUNC(OpenArray, void, (char **data, xpmData *mdata));
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int XpmCreateImageFromData(
Display* display
, char** data
, XImage** image_return
, XImage** shapeimage_return
, XpmAttributes* attributes
)
#else
int int
XpmCreateImageFromData(display, data, image_return, XpmCreateImageFromData(display, data, image_return,
shapeimage_return, attributes) shapeimage_return, attributes)
@@ -44,6 +54,7 @@ XpmCreateImageFromData(display, data, image_return,
XImage **image_return; XImage **image_return;
XImage **shapeimage_return; XImage **shapeimage_return;
XpmAttributes *attributes; XpmAttributes *attributes;
#endif
{ {
XpmImage image; XpmImage image;
XpmInfo info; XpmInfo info;
@@ -79,11 +90,21 @@ XpmCreateImageFromData(display, data, image_return,
return (ErrorStatus); return (ErrorStatus);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int
XpmCreateXpmImageFromData(
char** data
, XpmImage* image
, XpmInfo* info
)
#else
int int
XpmCreateXpmImageFromData(data, image, info) XpmCreateXpmImageFromData(data, image, info)
char **data; char **data;
XpmImage *image; XpmImage *image;
XpmInfo *info; XpmInfo *info;
#endif
{ {
xpmData mdata; xpmData mdata;
int ErrorStatus; int ErrorStatus;
@@ -104,10 +125,15 @@ XpmCreateXpmImageFromData(data, image, info)
/* /*
* open the given array to be read or written as an xpmData which is returned * open the given array to be read or written as an xpmData which is returned
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void OpenArray(char** data, xpmData* mdata)
#else
static void static void
OpenArray(data, mdata) OpenArray(data, mdata)
char **data; char **data;
xpmData *mdata; xpmData *mdata;
#endif
{ {
mdata->type = XPMARRAY; mdata->type = XPMARRAY;
mdata->stream.data = data; mdata->stream.data = data;

View File

@@ -48,9 +48,15 @@ static char *RCS_Id = "$Id$";
#define Ungetc(data, c, file) ungetc(c, file) #define Ungetc(data, c, file) ungetc(c, file)
#endif #endif
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int
ParseComment(xpmData* data)
#else
static int static int
ParseComment(data) ParseComment(data)
xpmData *data; xpmData *data;
#endif
{ {
if (data->type == XPMBUFFER) { if (data->type == XPMBUFFER) {
register char c; register char c;
@@ -175,9 +181,14 @@ ParseComment(data)
/* /*
* skip to the end of the current string and the beginning of the next one * skip to the end of the current string and the beginning of the next one
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int xpmNextString(xpmData* data)
#else
int int
xpmNextString(data) xpmNextString(data)
xpmData *data; xpmData *data;
#endif
{ {
if (!data->type) if (!data->type)
data->cptr = (data->stream.data)[++data->line]; data->cptr = (data->stream.data)[++data->line];
@@ -231,11 +242,20 @@ xpmNextString(data)
/* /*
* skip whitespace and return the following word * skip whitespace and return the following word
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
unsigned int xpmNextWord(
xpmData* data
, char* buf
, unsigned int buflen
)
#else
unsigned int unsigned int
xpmNextWord(data, buf, buflen) xpmNextWord(data, buf, buflen)
xpmData *data; xpmData *data;
char *buf; char *buf;
unsigned int buflen; unsigned int buflen;
#endif
{ {
register unsigned int n = 0; register unsigned int n = 0;
int c; int c;
@@ -268,10 +288,16 @@ xpmNextWord(data, buf, buflen)
* skip whitespace and compute the following unsigned int, * skip whitespace and compute the following unsigned int,
* returns 1 if one is found and 0 if not * returns 1 if one is found and 0 if not
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int
xpmNextUI(xpmData* data, unsigned int* ui_return)
#else
int int
xpmNextUI(data, ui_return) xpmNextUI(data, ui_return)
xpmData *data; xpmData *data;
unsigned int *ui_return; unsigned int *ui_return;
#endif
{ {
char buf[BUFSIZ]; char buf[BUFSIZ];
int l; int l;
@@ -283,11 +309,16 @@ xpmNextUI(data, ui_return)
/* /*
* return end of string - WARNING: malloc! * return end of string - WARNING: malloc!
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int xpmGetString(xpmData* data, char** sptr, unsigned int* l)
#else
int int
xpmGetString(data, sptr, l) xpmGetString(data, sptr, l)
xpmData *data; xpmData *data;
char **sptr; char **sptr;
unsigned int *l; unsigned int *l;
#endif
{ {
unsigned int i, n = 0; unsigned int i, n = 0;
int c; int c;
@@ -367,10 +398,15 @@ xpmGetString(data, sptr, l)
/* /*
* get the current comment line * get the current comment line
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int xpmGetCmt(xpmData* data, char** cmt)
#else
int int
xpmGetCmt(data, cmt) xpmGetCmt(data, cmt)
xpmData *data; xpmData *data;
char **cmt; char **cmt;
#endif
{ {
if (!data->type) if (!data->type)
*cmt = NULL; *cmt = NULL;
@@ -399,9 +435,14 @@ xpmDataType xpmDataTypes[] =
/* /*
* parse xpm header * parse xpm header
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int xpmParseHeader(xpmData* data)
#else
int int
xpmParseHeader(data) xpmParseHeader(data)
xpmData *data; xpmData *data;
#endif
{ {
char buf[BUFSIZ]; char buf[BUFSIZ];
int l, n = 0; int l, n = 0;

View File

@@ -38,10 +38,16 @@
LFUNC(AtomMake, xpmHashAtom, (char *name, void *data)); LFUNC(AtomMake, xpmHashAtom, (char *name, void *data));
LFUNC(HashTableGrows, int, (xpmHashTable * table)); LFUNC(HashTableGrows, int, (xpmHashTable * table));
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static xpmHashAtom
AtomMake(char* name, void* data) /* makes an atom */
#else
static xpmHashAtom static xpmHashAtom
AtomMake(name, data) /* makes an atom */ AtomMake(name, data) /* makes an atom */
char *name; /* WARNING: is just pointed to */ char *name; /* WARNING: is just pointed to */
void *data; void *data;
#endif
{ {
xpmHashAtom object = (xpmHashAtom) XpmMalloc(sizeof(struct _xpmHashAtom)); xpmHashAtom object = (xpmHashAtom) XpmMalloc(sizeof(struct _xpmHashAtom));
@@ -103,10 +109,15 @@ AtomMake(name, data) /* makes an atom */
* *
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
xpmHashAtom* xpmHashSlot(xpmHashTable* table, char* s)
#else
xpmHashAtom * xpmHashAtom *
xpmHashSlot(table, s) xpmHashSlot(table, s)
xpmHashTable *table; xpmHashTable *table;
char *s; char *s;
#endif
{ {
xpmHashAtom *atomTable = table->atomTable; xpmHashAtom *atomTable = table->atomTable;
unsigned int hash; unsigned int hash;
@@ -130,9 +141,14 @@ xpmHashSlot(table, s)
return p; return p;
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int HashTableGrows(xpmHashTable* table)
#else
static int static int
HashTableGrows(table) HashTableGrows(table)
xpmHashTable *table; xpmHashTable *table;
#endif
{ {
xpmHashAtom *atomTable = table->atomTable; xpmHashAtom *atomTable = table->atomTable;
int size = table->size; int size = table->size;
@@ -165,11 +181,16 @@ HashTableGrows(table)
* an xpmHashAtom is created if name doesn't exist, with the given data. * an xpmHashAtom is created if name doesn't exist, with the given data.
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int xpmHashIntern(xpmHashTable* table, char* tag, void* data)
#else
int int
xpmHashIntern(table, tag, data) xpmHashIntern(table, tag, data)
xpmHashTable *table; xpmHashTable *table;
char *tag; char *tag;
void *data; void *data;
#endif
{ {
xpmHashAtom *slot; xpmHashAtom *slot;
@@ -194,9 +215,14 @@ xpmHashIntern(table, tag, data)
* must be called before allocating any atom * must be called before allocating any atom
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int xpmHashTableInit(xpmHashTable* table)
#else
int int
xpmHashTableInit(table) xpmHashTableInit(table)
xpmHashTable *table; xpmHashTable *table;
#endif
{ {
xpmHashAtom *p; xpmHashAtom *p;
xpmHashAtom *atomTable; xpmHashAtom *atomTable;
@@ -217,9 +243,15 @@ xpmHashTableInit(table)
* frees a hashtable and all the stored atoms * frees a hashtable and all the stored atoms
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
void
xpmHashTableFree(xpmHashTable* table)
#else
void void
xpmHashTableFree(table) xpmHashTableFree(table)
xpmHashTable *table; xpmHashTable *table;
#endif
{ {
xpmHashAtom *p; xpmHashAtom *p;
xpmHashAtom *atomTable = table->atomTable; xpmHashAtom *atomTable = table->atomTable;

View File

@@ -37,9 +37,15 @@
/* /*
* Init returned data to free safely later on * Init returned data to free safely later on
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
void
xpmInitXpmImage(XpmImage* image)
#else
void void
xpmInitXpmImage(image) xpmInitXpmImage(image)
XpmImage *image; XpmImage *image;
#endif
{ {
image->ncolors = 0; image->ncolors = 0;
image->colorTable = NULL; image->colorTable = NULL;
@@ -49,9 +55,15 @@ xpmInitXpmImage(image)
/* /*
* Free the XpmImage data which have been allocated * Free the XpmImage data which have been allocated
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
void
XpmFreeXpmImage(XpmImage* image)
#else
void void
XpmFreeXpmImage(image) XpmFreeXpmImage(image)
XpmImage *image; XpmImage *image;
#endif
{ {
if (image->colorTable) if (image->colorTable)
xpmFreeColorTable(image->colorTable, image->ncolors); xpmFreeColorTable(image->colorTable, image->ncolors);

View File

@@ -37,9 +37,15 @@
/* /*
* Init returned data to free safely later on * Init returned data to free safely later on
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
void
xpmInitXpmInfo(XpmInfo* info)
#else
void void
xpmInitXpmInfo(info) xpmInitXpmInfo(info)
XpmInfo *info; XpmInfo *info;
#endif
{ {
if (info) { if (info) {
info->hints_cmt = NULL; info->hints_cmt = NULL;
@@ -53,9 +59,15 @@ xpmInitXpmInfo(info)
/* /*
* Free the XpmInfo data which have been allocated * Free the XpmInfo data which have been allocated
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
void
XpmFreeXpmInfo(XpmInfo* info)
#else
void void
XpmFreeXpmInfo(info) XpmFreeXpmInfo(info)
XpmInfo *info; XpmInfo *info;
#endif
{ {
if (info) { if (info) {
if (info->valuemask & XpmComments) { if (info->valuemask & XpmComments) {
@@ -84,10 +96,15 @@ XpmFreeXpmInfo(info)
/* /*
* Set the XpmInfo valuemask to retrieve required info * Set the XpmInfo valuemask to retrieve required info
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
void xpmSetInfoMask(XpmInfo* info, XpmAttributes* attributes)
#else
void void
xpmSetInfoMask(info, attributes) xpmSetInfoMask(info, attributes)
XpmInfo *info; XpmInfo *info;
XpmAttributes *attributes; XpmAttributes *attributes;
#endif
{ {
info->valuemask = 0; info->valuemask = 0;
if (attributes->valuemask & XpmReturnInfos) if (attributes->valuemask & XpmReturnInfos)
@@ -99,10 +116,16 @@ xpmSetInfoMask(info, attributes)
/* /*
* Fill in the XpmInfo with the XpmAttributes * Fill in the XpmInfo with the XpmAttributes
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
void
xpmSetInfo(XpmInfo* info, XpmAttributes* attributes)
#else
void void
xpmSetInfo(info, attributes) xpmSetInfo(info, attributes)
XpmInfo *info; XpmInfo *info;
XpmAttributes *attributes; XpmAttributes *attributes;
#endif
{ {
info->valuemask = 0; info->valuemask = 0;
if (attributes->valuemask & XpmInfos) { if (attributes->valuemask & XpmInfos) {

View File

@@ -39,9 +39,14 @@
* in case strdup is not provided by the system here is one * in case strdup is not provided by the system here is one
* which does the trick * which does the trick
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
char* xpmstrdup(char* s1)
#else
char * char *
xpmstrdup(s1) xpmstrdup(s1)
char *s1; char *s1;
#endif
{ {
char *s2; char *s2;
int l = strlen(s1) + 1; int l = strlen(s1) + 1;
@@ -53,11 +58,21 @@ xpmstrdup(s1)
#endif #endif
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
unsigned int
xpmatoui(
register char* p
, unsigned int l
, unsigned int* ui_return
)
#else
unsigned int unsigned int
xpmatoui(p, l, ui_return) xpmatoui(p, l, ui_return)
register char *p; register char *p;
unsigned int l; unsigned int l;
unsigned int *ui_return; unsigned int *ui_return;
#endif
{ {
register unsigned int n, i; register unsigned int n, i;
@@ -78,9 +93,14 @@ xpmatoui(p, l, ui_return)
/* /*
* Function returning a character string related to an error code. * Function returning a character string related to an error code.
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
char* XpmGetErrorString(int errcode)
#else
char * char *
XpmGetErrorString(errcode) XpmGetErrorString(errcode)
int errcode; int errcode;
#endif
{ {
switch (errcode) { switch (errcode) {
case XpmColorError: case XpmColorError:
@@ -116,9 +136,15 @@ XpmLibraryVersion()
#undef XpmFree #undef XpmFree
#endif #endif
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
void
XpmFree(void* ptr)
#else
void void
XpmFree(ptr) XpmFree(ptr)
void *ptr; void *ptr;
#endif
{ {
free(ptr); free(ptr);
} }

View File

@@ -54,6 +54,20 @@ char *xpmColorKeys[] = {
"c", /* key #5: color visual */ "c", /* key #5: color visual */
}; };
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int xpmParseValues(
xpmData* data
, unsigned int* width
, unsigned int* height
, unsigned int* ncolors
, unsigned int* cpp
, unsigned int* x_hotspot
, unsigned int* y_hotspot
, unsigned int* hotspot
, unsigned int* extensions
)
#else
int int
xpmParseValues(data, width, height, ncolors, cpp, xpmParseValues(data, width, height, ncolors, cpp,
x_hotspot, y_hotspot, hotspot, extensions) x_hotspot, y_hotspot, hotspot, extensions)
@@ -61,6 +75,7 @@ xpmParseValues(data, width, height, ncolors, cpp,
unsigned int *width, *height, *ncolors, *cpp; unsigned int *width, *height, *ncolors, *cpp;
unsigned int *x_hotspot, *y_hotspot, *hotspot; unsigned int *x_hotspot, *y_hotspot, *hotspot;
unsigned int *extensions; unsigned int *extensions;
#endif
{ {
unsigned int l; unsigned int l;
char buf[BUFSIZ]; char buf[BUFSIZ];
@@ -164,6 +179,16 @@ xpmParseValues(data, width, height, ncolors, cpp,
return (XpmSuccess); return (XpmSuccess);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int xpmParseColors(
xpmData* data
, unsigned int ncolors
, unsigned int cpp
, XpmColor** colorTablePtr
, xpmHashTable* hashtable
)
#else
int int
xpmParseColors(data, ncolors, cpp, colorTablePtr, hashtable) xpmParseColors(data, ncolors, cpp, colorTablePtr, hashtable)
xpmData *data; xpmData *data;
@@ -171,6 +196,7 @@ xpmParseColors(data, ncolors, cpp, colorTablePtr, hashtable)
unsigned int cpp; unsigned int cpp;
XpmColor **colorTablePtr; XpmColor **colorTablePtr;
xpmHashTable *hashtable; xpmHashTable *hashtable;
#endif
{ {
unsigned int key, l, a, b; unsigned int key, l, a, b;
unsigned int curkey; /* current color key */ unsigned int curkey; /* current color key */
@@ -324,6 +350,20 @@ xpmParseColors(data, ncolors, cpp, colorTablePtr, hashtable)
return (XpmSuccess); return (XpmSuccess);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int
ParsePixels(
xpmData* data
, unsigned int width
, unsigned int height
, unsigned int ncolors
, unsigned int cpp
, XpmColor* colorTable
, xpmHashTable* hashtable
, unsigned int** pixels
)
#else
static int static int
ParsePixels(data, width, height, ncolors, cpp, colorTable, hashtable, pixels) ParsePixels(data, width, height, ncolors, cpp, colorTable, hashtable, pixels)
xpmData *data; xpmData *data;
@@ -334,6 +374,7 @@ ParsePixels(data, width, height, ncolors, cpp, colorTable, hashtable, pixels)
XpmColor *colorTable; XpmColor *colorTable;
xpmHashTable *hashtable; xpmHashTable *hashtable;
unsigned int **pixels; unsigned int **pixels;
#endif
{ {
unsigned int *iptr, *iptr2; unsigned int *iptr, *iptr2;
unsigned int a, x, y; unsigned int a, x, y;
@@ -480,11 +521,20 @@ if (cidx[f]) XpmFree(cidx[f]);}
return (XpmSuccess); return (XpmSuccess);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int xpmParseExtensions(
xpmData* data
, XpmExtension** extensions
, unsigned int* nextensions
)
#else
int int
xpmParseExtensions(data, extensions, nextensions) xpmParseExtensions(data, extensions, nextensions)
xpmData *data; xpmData *data;
XpmExtension **extensions; XpmExtension **extensions;
unsigned int *nextensions; unsigned int *nextensions;
#endif
{ {
XpmExtension *exts = NULL, *ext; XpmExtension *exts = NULL, *ext;
unsigned int num = 0; unsigned int num = 0;
@@ -601,11 +651,20 @@ xpmParseExtensions(data, extensions, nextensions)
* This function parses an Xpm file or data and store the found informations * This function parses an Xpm file or data and store the found informations
* in an an XpmImage structure which is returned. * in an an XpmImage structure which is returned.
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int xpmParseData(
xpmData* data
, XpmImage* image
, XpmInfo* info
)
#else
int int
xpmParseData(data, image, info) xpmParseData(data, image, info)
xpmData *data; xpmData *data;
XpmImage *image; XpmImage *image;
XpmInfo *info; XpmInfo *info;
#endif
{ {
/* variables to return */ /* variables to return */
unsigned int width, height, ncolors, cpp; unsigned int width, height, ncolors, cpp;

View File

@@ -34,10 +34,15 @@
#include "XpmI.h" #include "XpmI.h"
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int XpmReadFileToData(char* filename, char*** data_return)
#else
int int
XpmReadFileToData(filename, data_return) XpmReadFileToData(filename, data_return)
char *filename; char *filename;
char ***data_return; char ***data_return;
#endif
{ {
XpmImage image; XpmImage image;
XpmInfo info; XpmInfo info;

View File

@@ -48,6 +48,16 @@ LFUNC(OpenReadFile, int, (char *filename, xpmData *mdata));
LFUNC(xpmDataClose, void, (xpmData *mdata)); LFUNC(xpmDataClose, void, (xpmData *mdata));
#ifndef CXPMPROG #ifndef CXPMPROG
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int XpmReadFileToImage(
Display* display
, char* filename
, XImage** image_return
, XImage** shapeimage_return
, XpmAttributes* attributes
)
#else
int int
XpmReadFileToImage(display, filename, XpmReadFileToImage(display, filename,
image_return, shapeimage_return, attributes) image_return, shapeimage_return, attributes)
@@ -56,6 +66,7 @@ XpmReadFileToImage(display, filename,
XImage **image_return; XImage **image_return;
XImage **shapeimage_return; XImage **shapeimage_return;
XpmAttributes *attributes; XpmAttributes *attributes;
#endif
{ {
XpmImage image; XpmImage image;
XpmInfo info; XpmInfo info;
@@ -93,11 +104,22 @@ XpmReadFileToImage(display, filename,
return (ErrorStatus); return (ErrorStatus);
} }
#ifdef __OS2__
#define popen fopen
#define pclose fclose
/* Visual Age cannot deal with old, non-ansi, code */
int XpmReadFileToXpmImage(
char* filename
, XpmImage* image
, XpmInfo* info
)
#else
int int
XpmReadFileToXpmImage(filename, image, info) XpmReadFileToXpmImage(filename, image, info)
char *filename; char *filename;
XpmImage *image; XpmImage *image;
XpmInfo *info; XpmInfo *info;
#endif
{ {
xpmData mdata; xpmData mdata;
int ErrorStatus; int ErrorStatus;
@@ -122,10 +144,15 @@ XpmReadFileToXpmImage(filename, image, info)
/* /*
* open the given file to be read as an xpmData which is returned. * open the given file to be read as an xpmData which is returned.
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int OpenReadFile(char* filename, xpmData* mdata)
#else
static int static int
OpenReadFile(filename, mdata) OpenReadFile(filename, mdata)
char *filename; char *filename;
xpmData *mdata; xpmData *mdata;
#endif
{ {
#ifndef NO_ZPIPE #ifndef NO_ZPIPE
char *compressfile, buf[BUFSIZ]; char *compressfile, buf[BUFSIZ];
@@ -204,9 +231,15 @@ OpenReadFile(filename, mdata)
/* /*
* close the file related to the xpmData if any * close the file related to the xpmData if any
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void
xpmDataClose(xpmData* mdata)
#else
static void static void
xpmDataClose(mdata) xpmDataClose(mdata)
xpmData *mdata; xpmData *mdata;
#endif
{ {
switch (mdata->type) { switch (mdata->type) {
case XPMFILE: case XPMFILE:

View File

@@ -158,10 +158,15 @@ xpmFreeRgbNames(rgbn, rgbn_max)
#include "rgbtab.h" /* hard coded rgb.txt table */ #include "rgbtab.h" /* hard coded rgb.txt table */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int xpmReadRgbNames(char* rgb_fname, xpmRgbName rgbn[])
#else
int int
xpmReadRgbNames(rgb_fname, rgbn) xpmReadRgbNames(rgb_fname, rgbn)
char *rgb_fname; char *rgb_fname;
xpmRgbName rgbn[]; xpmRgbName rgbn[];
#endif
{ {
/* /*
* check for consistency??? * check for consistency???
@@ -174,13 +179,17 @@ xpmReadRgbNames(rgb_fname, rgbn)
* MSW rgb values are made from 3 BYTEs, this is different from X XColor.red, * MSW rgb values are made from 3 BYTEs, this is different from X XColor.red,
* which has something like #0303 for one color * which has something like #0303 for one color
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
char* xpmGetRgbName(xpmRgbName rgbn[], int rgbn_max, int red, int green, int blue)
#else
char * char *
xpmGetRgbName(rgbn, rgbn_max, red, green, blue) xpmGetRgbName(rgbn, rgbn_max, red, green, blue)
xpmRgbName rgbn[]; /* rgb mnemonics from rgb text file xpmRgbName rgbn[]; /* rgb mnemonics from rgb text file
* not used */ * not used */
int rgbn_max; /* not used */ int rgbn_max; /* not used */
int red, green, blue; /* rgb values */ int red, green, blue; /* rgb values */
#endif
{ {
int i; int i;
unsigned long rgbVal; unsigned long rgbVal;
@@ -198,10 +207,15 @@ xpmGetRgbName(rgbn, rgbn_max, red, green, blue)
} }
/* used in XParseColor in simx.c */ /* used in XParseColor in simx.c */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int xpmGetRGBfromName(char* inname, int* r, int* g, int* b)
#else
int int
xpmGetRGBfromName(inname, r, g, b) xpmGetRGBfromName(inname, r, g, b)
char *inname; char *inname;
int *r, *g, *b; int *r, *g, *b;
#endif
{ {
int left, right, middle; int left, right, middle;
int cmp; int cmp;
@@ -270,11 +284,15 @@ xpmGetRGBfromName(inname, r, g, b)
return (1); return (1);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
void xpmFreeRgbNames(xpmRgbName rgbn[], int rgbn_max)
#else
void void
xpmFreeRgbNames(rgbn, rgbn_max) xpmFreeRgbNames(rgbn, rgbn_max)
xpmRgbName rgbn[]; xpmRgbName rgbn[];
int rgbn_max; int rgbn_max;
#endif
{ {
/* nothing to do */ /* nothing to do */
} }

View File

@@ -47,8 +47,11 @@ typedef struct {
#define myRGB(r,g,b) \ #define myRGB(r,g,b) \
((unsigned long)r<<16|(unsigned long)g<<8|(unsigned long)b) ((unsigned long)r<<16|(unsigned long)g<<8|(unsigned long)b)
*/ */
#ifndef __OS2__
#define myRGB(r,g,b) RGB(r,g,b) /* MSW has this macro */ #define myRGB(r,g,b) RGB(r,g,b) /* MSW has this macro */
#else
#define myRGB(r,g,b) OS2RGB(r,g,b)
#endif
static rgbRecord theRGBRecords[] = static rgbRecord theRGBRecords[] =
{ {

View File

@@ -111,11 +111,16 @@ LFUNC(ScanOtherColors, int, (Display *display, XpmColor *colors, int ncolors,
* This function stores the given pixel in the given arrays which are grown * This function stores the given pixel in the given arrays which are grown
* if not large enough. * if not large enough.
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int storePixel(Pixel pixel, PixelsMap* pmap, unsigned int* index_return)
#else
static int static int
storePixel(pixel, pmap, index_return) storePixel(pixel, pmap, index_return)
Pixel pixel; Pixel pixel;
PixelsMap *pmap; PixelsMap *pmap;
unsigned int *index_return; unsigned int *index_return;
#endif
{ {
unsigned int i; unsigned int i;
Pixel *p; Pixel *p;
@@ -146,11 +151,16 @@ storePixel(pixel, pmap, index_return)
return 0; return 0;
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int storeMaskPixel(Pixel pixel, PixelsMap* pmap, unsigned int* index_return)
#else
static int static int
storeMaskPixel(pixel, pmap, index_return) storeMaskPixel(pixel, pmap, index_return)
Pixel pixel; Pixel pixel;
PixelsMap *pmap; PixelsMap *pmap;
unsigned int *index_return; unsigned int *index_return;
#endif
{ {
if (!pixel) { if (!pixel) {
if (!pmap->ncolors) { if (!pmap->ncolors) {
@@ -176,6 +186,16 @@ storeMaskPixel(pixel, pmap, index_return)
* This function scans the given image and stores the found informations in * This function scans the given image and stores the found informations in
* the given XpmImage structure. * the given XpmImage structure.
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int XpmCreateXpmImageFromImage(
Display* display
, XImage* image
, XImage* shapeimage
, XpmImage* xpmimage
, XpmAttributes* attributes
)
#else
int int
XpmCreateXpmImageFromImage(display, image, shapeimage, XpmCreateXpmImageFromImage(display, image, shapeimage,
xpmimage, attributes) xpmimage, attributes)
@@ -184,6 +204,7 @@ XpmCreateXpmImageFromImage(display, image, shapeimage,
XImage *shapeimage; XImage *shapeimage;
XpmImage *xpmimage; XpmImage *xpmimage;
XpmAttributes *attributes; XpmAttributes *attributes;
#endif
{ {
/* variables stored in the XpmAttributes structure */ /* variables stored in the XpmAttributes structure */
unsigned int cpp; unsigned int cpp;
@@ -250,8 +271,13 @@ XpmCreateXpmImageFromImage(display, image, shapeimage,
storeMaskPixel); storeMaskPixel);
# endif # endif
#else #else
#ifndef __OS2__
ErrorStatus = MSWGetImagePixels(display, shapeimage, width, height, ErrorStatus = MSWGetImagePixels(display, shapeimage, width, height,
&pmap, storeMaskPixel); &pmap, storeMaskPixel);
/* calling convention all messed up OS/2 -- figure out later */
#endif
#endif #endif
if (ErrorStatus != XpmSuccess) if (ErrorStatus != XpmSuccess)
RETURN(ErrorStatus); RETURN(ErrorStatus);
@@ -286,8 +312,12 @@ XpmCreateXpmImageFromImage(display, image, shapeimage,
storePixel); storePixel);
# endif # endif
#else #else
#ifndef __OS2__
ErrorStatus = MSWGetImagePixels(display, image, width, height, &pmap, ErrorStatus = MSWGetImagePixels(display, image, width, height, &pmap,
storePixel); storePixel);
#endif
#endif #endif
if (ErrorStatus != XpmSuccess) if (ErrorStatus != XpmSuccess)
RETURN(ErrorStatus); RETURN(ErrorStatus);
@@ -345,11 +375,16 @@ error:
return (ErrorStatus); return (ErrorStatus);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int ScanTransparentColor(XpmColor* color, unsigned int cpp, XpmAttributes* attributes)
#else
static int static int
ScanTransparentColor(color, cpp, attributes) ScanTransparentColor(color, cpp, attributes)
XpmColor *color; XpmColor *color;
unsigned int cpp; unsigned int cpp;
XpmAttributes *attributes; XpmAttributes *attributes;
#endif
{ {
char *s; char *s;
unsigned int a, b, c; unsigned int a, b, c;
@@ -399,6 +434,18 @@ ScanTransparentColor(color, cpp, attributes)
return (XpmSuccess); return (XpmSuccess);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int ScanOtherColors(
Display* display
, XpmColor* colors
, int ncolors
, Pixel* pixels
, unsigned int mask
, unsigned int cpp
, XpmAttributes* attributes
)
#else
static int static int
ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes) ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes)
Display *display; Display *display;
@@ -408,6 +455,7 @@ ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes)
unsigned int mask; unsigned int mask;
unsigned int cpp; unsigned int cpp;
XpmAttributes *attributes; XpmAttributes *attributes;
#endif
{ {
/* variables stored in the XpmAttributes structure */ /* variables stored in the XpmAttributes structure */
Colormap colormap; Colormap colormap;
@@ -465,7 +513,11 @@ ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes)
xcolor->pixel = *pixels; xcolor->pixel = *pixels;
} }
#ifdef __OS2__
XQueryColors(display, &colormap, xcolors, ncolors);
#else
XQueryColors(display, colormap, xcolors, ncolors); XQueryColors(display, colormap, xcolors, ncolors);
#endif
#ifndef FOR_MSW #ifndef FOR_MSW
/* read the rgb file if any was specified */ /* read the rgb file if any was specified */
@@ -592,12 +644,22 @@ static unsigned long Const low_bits_table[] = {
* *
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int GetImagePixels(
XImage* image
, unsigned int width
, unsigned int height
, PixelsMap* pmap
)
#else
static int static int
GetImagePixels(image, width, height, pmap) GetImagePixels(image, width, height, pmap)
XImage *image; XImage *image;
unsigned int width; unsigned int width;
unsigned int height; unsigned int height;
PixelsMap *pmap; PixelsMap *pmap;
#endif
{ {
char *src; char *src;
char *dst; char *dst;
@@ -695,12 +757,22 @@ GetImagePixels(image, width, height, pmap)
static unsigned long byteorderpixel = MSBFirst << 24; static unsigned long byteorderpixel = MSBFirst << 24;
#endif #endif
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int GetImagePixels32(
XImage* image
, unsigned int width
, unsigned int height
, PixelsMap* pmap
)
#else
static int static int
GetImagePixels32(image, width, height, pmap) GetImagePixels32(image, width, height, pmap)
XImage *image; XImage *image;
unsigned int width; unsigned int width;
unsigned int height; unsigned int height;
PixelsMap *pmap; PixelsMap *pmap;
#endif
{ {
unsigned char *addr; unsigned char *addr;
unsigned char *data; unsigned char *data;
@@ -760,12 +832,22 @@ GetImagePixels32(image, width, height, pmap)
* scan pixels of a 16-bits Z image data structure * scan pixels of a 16-bits Z image data structure
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int GetImagePixels16(
XImage* image
, unsigned int width
, unsigned int height
, PixelsMap* pmap
)
#else
static int static int
GetImagePixels16(image, width, height, pmap) GetImagePixels16(image, width, height, pmap)
XImage *image; XImage *image;
unsigned int width; unsigned int width;
unsigned int height; unsigned int height;
PixelsMap *pmap; PixelsMap *pmap;
#endif
{ {
unsigned char *addr; unsigned char *addr;
unsigned char *data; unsigned char *data;
@@ -806,12 +888,23 @@ GetImagePixels16(image, width, height, pmap)
* scan pixels of a 8-bits Z image data structure * scan pixels of a 8-bits Z image data structure
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int
GetImagePixels8(image, width, height, pmap)
XImage* image
, unsigned int width
, unsigned int height
, PixelsMap* pmap
)
#else
static int static int
GetImagePixels8(image, width, height, pmap) GetImagePixels8(image, width, height, pmap)
XImage *image; XImage *image;
unsigned int width; unsigned int width;
unsigned int height; unsigned int height;
PixelsMap *pmap; PixelsMap *pmap;
#endif
{ {
unsigned int *iptr; unsigned int *iptr;
unsigned char *data; unsigned char *data;
@@ -839,6 +932,17 @@ GetImagePixels8(image, width, height, pmap)
* scan pixels of a 1-bit depth Z image data structure * scan pixels of a 1-bit depth Z image data structure
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int
GetImagePixels1(
XImage* image
, unsigned int width
, unsigned int height
, PixelsMap* pmap
, int (*storeFunc) ()
)
#else
static int static int
GetImagePixels1(image, width, height, pmap, storeFunc) GetImagePixels1(image, width, height, pmap, storeFunc)
XImage *image; XImage *image;
@@ -846,6 +950,7 @@ GetImagePixels1(image, width, height, pmap, storeFunc)
unsigned int height; unsigned int height;
PixelsMap *pmap; PixelsMap *pmap;
int (*storeFunc) (); int (*storeFunc) ();
#endif
{ {
unsigned int *iptr; unsigned int *iptr;
int x, y; int x, y;
@@ -929,6 +1034,18 @@ AGetImagePixels (
# endif/* AMIGA */ # endif/* AMIGA */
#else /* ndef FOR_MSW */ #else /* ndef FOR_MSW */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int
MSWGetImagePixels(
Display* display
, XImage* image
, unsigned int width
, unsigned int height
, PixelsMap* pmap
, int (*storeFunc) ()
)
#else
static int static int
MSWGetImagePixels(display, image, width, height, pmap, storeFunc) MSWGetImagePixels(display, image, width, height, pmap, storeFunc)
Display *display; Display *display;
@@ -937,19 +1054,42 @@ MSWGetImagePixels(display, image, width, height, pmap, storeFunc)
unsigned int height; unsigned int height;
PixelsMap *pmap; PixelsMap *pmap;
int (*storeFunc) (); int (*storeFunc) ();
#endif
{ {
unsigned int *iptr; unsigned int *iptr;
unsigned int x, y; unsigned int x, y;
Pixel pixel; Pixel pixel;
#ifdef __OS2__
HAB hab;
HPS hps;
DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL};
SIZEL sizl = {0, 0};
POINTL point;
#endif
iptr = pmap->pixelindex; iptr = pmap->pixelindex;
#ifdef __OS2__
hps = GpiCreatePS(hab, *display, &sizl, GPIA_ASSOC | PU_PELS);
GpiSetBitmap(hps, image->bitmap);
#else
SelectObject(*display, image->bitmap); SelectObject(*display, image->bitmap);
#endif
for (y = 0; y < height; y++) { for (y = 0; y < height; y++) {
for (x = 0; x < width; x++, iptr++) { for (x = 0; x < width; x++, iptr++) {
#ifdef __OS2__
point.x = x;
point.y = y;
pixel = GpiQueryPel(hps, &point);
#else
pixel = GetPixel(*display, x, y); pixel = GetPixel(*display, x, y);
#endif
#ifndef __OS2__
/* calling convention all messed up under OS/2 */
if ((*storeFunc) (pixel, pmap, iptr)) if ((*storeFunc) (pixel, pmap, iptr))
return (XpmNoMemory); return (XpmNoMemory);
#endif
} }
} }
return (XpmSuccess); return (XpmSuccess);

View File

@@ -125,9 +125,22 @@ int
XDefaultDepth(Display *display, Screen *screen) XDefaultDepth(Display *display, Screen *screen)
{ {
int d, b; int d, b;
#ifdef __OS2__
HPS hpsScreen;
HDC hdcScreen;
LONG lPlanes;
LONG lBitsPerPixel;
LONG nDepth;
hpsScreen = WinGetScreenPS(HWND_DESKTOP);
hdcScreen = GpiQueryDevice(hpsScreen);
DevQueryCaps(hdcScreen, CAPS_COLOR_PLANES, 1L, &lPlanes);
DevQueryCaps(hdcScreen, CAPS_COLOR_BITCOUNT, 1L, &lBitsPerPixel);
b = (int)lBitsPerPixel;
#else
b = GetDeviceCaps(*display, BITSPIXEL); b = GetDeviceCaps(*display, BITSPIXEL);
d = GetDeviceCaps(*display, PLANES); d = GetDeviceCaps(*display, PLANES);
#endif
return (b); return (b);
} }
@@ -140,7 +153,7 @@ XDefaultColormap(Display *display, Screen *screen)
/* convert hex color names, /* convert hex color names,
wrong digits (not a-f,A-F,0-9) are treated as zero */ wrong digits (not a-f,A-F,0-9) are treated as zero */
static int static int
hexCharToInt(c) hexCharToInt(char c)
{ {
int r; int r;
@@ -204,7 +217,11 @@ XParseColor(Display *d, Colormap *cmap, char *name, XColor *color)
} }
if (okay) { if (okay) {
#ifdef __OS2__
color->pixel = OS2RGB(r, g, b);
#else
color->pixel = RGB(r, g, b); color->pixel = RGB(r, g, b);
#endif
color->red = (BYTE) r; color->red = (BYTE) r;
color->green = (BYTE) g; color->green = (BYTE) g;
color->blue = (BYTE) b; color->blue = (BYTE) b;
@@ -255,6 +272,18 @@ XCreateImage(Display *d, Visual *v,
int pad, int foo) int pad, int foo)
{ {
XImage *img = (XImage *) XpmMalloc(sizeof(XImage)); XImage *img = (XImage *) XpmMalloc(sizeof(XImage));
#ifdef __OS2__
HPS hps;
BITMAPINFOHEADER2 bmih;
hps = WinGetScreenPS(HWND_DESKTOP);
memset(&bmih, 0, sizeof(BITMAPINFOHEADER2));
bmih.cbFix = sizeof(BITMAPINFOHEADER2);
bmih.cx = width;
bmih.cy = height;
bmih.cPlanes = 1;
bmih.cBitCount = depth;
#endif
if (img) { if (img) {
/*JW: This is what it should be, but the picture comes out /*JW: This is what it should be, but the picture comes out
@@ -264,8 +293,12 @@ XCreateImage(Display *d, Visual *v,
if ( depth == GetDeviceCaps(*d, BITSPIXEL) ) { if ( depth == GetDeviceCaps(*d, BITSPIXEL) ) {
img->bitmap = CreateCompatibleBitmap(*d, width, height); img->bitmap = CreateCompatibleBitmap(*d, width, height);
} else*/ { } else*/ {
#ifdef __OS2__
img->bitmap = GpiCreateBitmap(hps, &bmih, 0L, NULL, NULL);
#else
img->bitmap = CreateBitmap(width, height, 1 /* plane */ , img->bitmap = CreateBitmap(width, height, 1 /* plane */ ,
depth /* bits per pixel */ , NULL); depth /* bits per pixel */ , NULL);
#endif
} }
img->width = width; img->width = width;
img->height = height; img->height = height;
@@ -286,7 +319,11 @@ void
XDestroyImage(XImage *img) XDestroyImage(XImage *img)
{ {
if (img) { if (img) {
#ifdef __OS2__
GpiDeleteBitmap(img->bitmap);
#else
DeleteObject(img->bitmap); /* check return ??? */ DeleteObject(img->bitmap); /* check return ??? */
#endif
XImageFree(img); XImageFree(img);
} }
} }

View File

@@ -39,7 +39,21 @@
#ifdef FOR_MSW #ifdef FOR_MSW
#if !defined(__OS2__)
#include "windows.h" /* MS windows GDI types */ #include "windows.h" /* MS windows GDI types */
#else
#define INCL_PM
#define INCL_GPI
#include<os2.h>
typedef unsigned long COLORREF;
// RGB under OS2 is more like a PALETTEENTRY struct under Windows so we need a real RGB def
#define OS2RGB(r,g,b) ((ULONG ((BYTE) (r) | ((UINT) (g) << 8)) | (((ULONG)(BYTE)(b)) << 16)))
#define GetBValue(rgb) ((BYTE)((rgb) >> 16))
#define GetGValue(rgb) ((BYTE)(((WORD)(rgb)) >> 8))
#define GetRValue(rgb) ((BYTE)(rgb))
typedef UINT WORD;
#endif
/* /*
* minimal portability layer between ansi and KR C * minimal portability layer between ansi and KR C

View File

@@ -34,10 +34,15 @@
#include "XpmI.h" #include "XpmI.h"
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int XpmWriteFileFromData(char* filename, char** data)
#else
int int
XpmWriteFileFromData(filename, data) XpmWriteFileFromData(filename, data)
char *filename; char *filename;
char **data; char **data;
#endif
{ {
XpmImage image; XpmImage image;
XpmInfo info; XpmInfo info;

View File

@@ -59,6 +59,16 @@ LFUNC(WriteExtensions, void, (FILE *file, XpmExtension *ext,
LFUNC(OpenWriteFile, int, (char *filename, xpmData *mdata)); LFUNC(OpenWriteFile, int, (char *filename, xpmData *mdata));
LFUNC(xpmDataClose, void, (xpmData *mdata)); LFUNC(xpmDataClose, void, (xpmData *mdata));
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int XpmWriteFileFromImage(
Display* display
, char* filename
, XImage* image
, XImage* shapeimage
, XpmAttributes* attributes
)
#else
int int
XpmWriteFileFromImage(display, filename, image, shapeimage, attributes) XpmWriteFileFromImage(display, filename, image, shapeimage, attributes)
Display *display; Display *display;
@@ -66,6 +76,7 @@ XpmWriteFileFromImage(display, filename, image, shapeimage, attributes)
XImage *image; XImage *image;
XImage *shapeimage; XImage *shapeimage;
XpmAttributes *attributes; XpmAttributes *attributes;
#endif
{ {
XpmImage xpmimage; XpmImage xpmimage;
XpmInfo info; XpmInfo info;
@@ -90,11 +101,20 @@ XpmWriteFileFromImage(display, filename, image, shapeimage, attributes)
return (ErrorStatus); return (ErrorStatus);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
int XpmWriteFileFromXpmImage(
char* filename
, XpmImage* image
, XpmInfo* info
)
#else
int int
XpmWriteFileFromXpmImage(filename, image, info) XpmWriteFileFromXpmImage(filename, image, info)
char *filename; char *filename;
XpmImage *image; XpmImage *image;
XpmInfo *info; XpmInfo *info;
#endif
{ {
xpmData mdata; xpmData mdata;
char *name, *dot, *s, new_name[BUFSIZ]; char *name, *dot, *s, new_name[BUFSIZ];
@@ -152,12 +172,23 @@ XpmWriteFileFromXpmImage(filename, image, info)
return (ErrorStatus); return (ErrorStatus);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int
xpmWriteFile(
FILE* file
, XpmImage* image
, char* name
, XpmInfo* info
)
#else
static int static int
xpmWriteFile(file, image, name, info) xpmWriteFile(file, image, name, info)
FILE *file; FILE *file;
XpmImage *image; XpmImage *image;
char *name; char *name;
XpmInfo *info; XpmInfo *info;
#endif
{ {
/* calculation variables */ /* calculation variables */
unsigned int cmts, extensions; unsigned int cmts, extensions;
@@ -210,11 +241,21 @@ xpmWriteFile(file, image, name, info)
return (XpmSuccess); return (XpmSuccess);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void
WriteColors(
FILE* file
, XpmColor* colors
, unsigned int ncolors
)
#else
static void static void
WriteColors(file, colors, ncolors) WriteColors(file, colors, ncolors)
FILE *file; FILE *file;
XpmColor *colors; XpmColor *colors;
unsigned int ncolors; unsigned int ncolors;
#endif
{ {
unsigned int a, key; unsigned int a, key;
char *s; char *s;
@@ -233,7 +274,17 @@ WriteColors(file, colors, ncolors)
} }
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static int WritePixels(
FILE* file
, unsigned int width
, unsigned int height
, unsigned int cpp
, unsigned int* pixels
, XpmColor* colors
)
#else
static int static int
WritePixels(file, width, height, cpp, pixels, colors) WritePixels(file, width, height, cpp, pixels, colors)
FILE *file; FILE *file;
@@ -242,6 +293,7 @@ WritePixels(file, width, height, cpp, pixels, colors)
unsigned int cpp; unsigned int cpp;
unsigned int *pixels; unsigned int *pixels;
XpmColor *colors; XpmColor *colors;
#endif
{ {
char *s, *p, *buf; char *s, *p, *buf;
unsigned int x, y, h; unsigned int x, y, h;
@@ -276,11 +328,20 @@ WritePixels(file, width, height, cpp, pixels, colors)
return (XpmSuccess); return (XpmSuccess);
} }
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void WriteExtensions(
FILE* file
, XpmExtension* ext
, unsigned int num
)
#else
static void static void
WriteExtensions(file, ext, num) WriteExtensions(file, ext, num)
FILE *file; FILE *file;
XpmExtension *ext; XpmExtension *ext;
unsigned int num; unsigned int num;
#endif
{ {
unsigned int x, y, n; unsigned int x, y, n;
char **line; char **line;
@@ -297,10 +358,20 @@ WriteExtensions(file, ext, num)
/* /*
* open the given file to be written as an xpmData which is returned * open the given file to be written as an xpmData which is returned
*/ */
#ifdef __OS2__
#define popen fopen
#define pclose fclose
/* Visual Age cannot deal with old, non-ansi, code */
static int OpenWriteFile(
char* filename
, xpmData* mdata
)
#else
static int static int
OpenWriteFile(filename, mdata) OpenWriteFile(filename, mdata)
char *filename; char *filename;
xpmData *mdata; xpmData *mdata;
#endif
{ {
#ifndef NO_ZPIPE #ifndef NO_ZPIPE
char buf[BUFSIZ]; char buf[BUFSIZ];
@@ -341,9 +412,14 @@ OpenWriteFile(filename, mdata)
/* /*
* close the file related to the xpmData if any * close the file related to the xpmData if any
*/ */
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void xpmDataClose(xpmData* mdata)
#else
static void static void
xpmDataClose(mdata) xpmDataClose(mdata)
xpmData *mdata; xpmData *mdata;
#endif
{ {
switch (mdata->type) { switch (mdata->type) {
case XPMFILE: case XPMFILE:

View File

@@ -300,9 +300,6 @@ typedef struct {
#if NeedFunctionPrototypes #if NeedFunctionPrototypes
# define FUNC(f, t, p) extern t f p # define FUNC(f, t, p) extern t f p
# define LFUNC(f, t, p) static t f p # define LFUNC(f, t, p) static t f p
#else
#define FUNC(f, t, p) extern t f()
#define LFUNC(f, t, p) static t f()
#endif #endif