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:
parent
f1d626b203
commit
ea258ad348
@ -33,7 +33,7 @@
|
||||
#define wxUSE_GIF 1 // Utilize GIF images
|
||||
|
||||
#if defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )
|
||||
#define wxUSE_LONG_LONG 1
|
||||
#define wxUSE_LONGLONG 1
|
||||
#endif
|
||||
|
||||
#define wxUSE_NET_API 1 // Utilize OS/2's UPM netapi's
|
||||
@ -103,7 +103,6 @@
|
||||
|
||||
#define wxUSE_CHECKLISTBOX 1
|
||||
// Define 1 to compile check listbox
|
||||
|
||||
#define wxUSE_CARET 1
|
||||
// Define 1 to use wxCaret class
|
||||
#define wxUSE_XPM_IN_OS2 1
|
||||
@ -160,7 +159,7 @@
|
||||
// Set this to 0 if your compiler can't cope
|
||||
// with omission of prototype parameters.
|
||||
|
||||
#define wxUSE_ODBC 1
|
||||
#define wxUSE_ODBC 0
|
||||
// Define 1 to use ODBC classes
|
||||
|
||||
#define wxODBC_FWD_ONLY_CURSORS 1
|
||||
@ -257,12 +256,12 @@
|
||||
#define wxUSE_TOOLBAR 1
|
||||
#define wxUSE_TOOLBAR_NATIVE 1
|
||||
|
||||
// wxSpinCtrl class
|
||||
#define wxUSE_SPINCTRL 1
|
||||
|
||||
// wxStatusBar class
|
||||
#define wxUSE_STATUSBAR 1
|
||||
|
||||
// wxSpinCtrl class
|
||||
#define wxUSE_SPINCTRL 1
|
||||
|
||||
// progress dialog class for lengthy operations
|
||||
#define wxUSE_PROGRESSDLG 1
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
#define wxUSE_GIF 1 // Utilize GIF images
|
||||
|
||||
#if defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )
|
||||
#define wxUSE_LONG_LONG 1
|
||||
#define wxUSE_LONGLONG 1
|
||||
#endif
|
||||
|
||||
#define wxUSE_NET_API 1 // Utilize OS/2's UPM netapi's
|
||||
|
@ -9,7 +9,7 @@
|
||||
# Use FINAL=1 argument to nmake to build final version with no debug info.
|
||||
|
||||
# Set WXDIR for your system
|
||||
WXDIR = j:\dev\wx2\wxWindows
|
||||
WXDIR = $(WXWIN)
|
||||
|
||||
PROGRAM=minimal
|
||||
OBJECTS = $(PROGRAM).obj
|
||||
|
@ -1,5 +1,5 @@
|
||||
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_ABOUT 102
|
||||
|
@ -39,8 +39,8 @@ $(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
|
||||
<<
|
||||
$(RC) $(PROGRAM).res $(PROGRAM).exe
|
||||
|
||||
$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\os2\wx.rc
|
||||
$(RC) -I $(WXDIR)\include -D __VISAGECPP__ -r $(PROGRAM).rc $(PROGRAM).res
|
||||
$(PROGRAM).res : $(PROGRAM).rcO $(WXDIR)\include\wx\os2\wx.rc
|
||||
$(RC) -I $(WXDIR)\include -D __VISAGECPP__ -r $(PROGRAM).rcO $(PROGRAM).res
|
||||
|
||||
clean:
|
||||
-erase $(OBJECTS)
|
||||
|
@ -18,6 +18,10 @@ OS2LIBFLAGS=/NOL /NOE
|
||||
# Set an environment variable, WXWIN, to your WXWIN directory
|
||||
WXDIR=$(WXWIN)
|
||||
|
||||
# Set to where your UPM and LAN libs are
|
||||
UPMLIB=D:\MUGLIB
|
||||
NETLIB=D:\IBMLAN\NETSRC\LIB
|
||||
|
||||
WXSRC=$(WXDIR)\src\os2
|
||||
WXINC=$(WXDIR)\include
|
||||
WXBASESRC=$(WXDIR)\src\common
|
||||
@ -109,7 +113,7 @@ D=$(D)DLL
|
||||
|
||||
|
||||
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
|
||||
LIBS=$(WXLIB) $(EXTRALIBS)
|
||||
|
||||
|
@ -573,7 +573,7 @@ HTMLLIBOBJS = \
|
||||
OBJECTS = $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) $(NONESSENTIALOBJS) $(OS2OBJS)
|
||||
|
||||
# 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
|
||||
|
||||
|
@ -90,14 +90,57 @@ OBJECTS = \
|
||||
..\xpm\$D\wrffrdat.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)
|
||||
|
||||
$(WXDIR)\lib\os2xpm.lib: $(OBJECTS)
|
||||
$(WXDIR)\lib\os2xpm.lib: $(LIBOBJECTS)
|
||||
touch $(WXDIR)\lib\os2xpm.lib
|
||||
del $(WXDIR)\lib\os2xpm.lib
|
||||
ilib $(OS2LIBFLAGS) $@ @<<
|
||||
$**;
|
||||
<<
|
||||
del *.obj
|
||||
|
||||
clean:
|
||||
del $(OS2XPMLIB)
|
||||
|
@ -43,11 +43,17 @@ LFUNC(FreeOldColorTable, void, (XpmColor **colorTable, int ncolors));
|
||||
/*
|
||||
* 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
|
||||
CreateOldColorTable(ct, ncolors, oldct)
|
||||
XpmColor *ct;
|
||||
int ncolors;
|
||||
XpmColor ***oldct;
|
||||
#endif
|
||||
{
|
||||
XpmColor **colorTable, **color;
|
||||
int a;
|
||||
@ -63,10 +69,15 @@ CreateOldColorTable(ct, ncolors, oldct)
|
||||
return (XpmSuccess);
|
||||
}
|
||||
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
static void FreeOldColorTable(XpmColor** colorTable, int ncolors)
|
||||
#else
|
||||
static void
|
||||
FreeOldColorTable(colorTable, ncolors)
|
||||
XpmColor **colorTable;
|
||||
int ncolors;
|
||||
#endif
|
||||
{
|
||||
int a, b;
|
||||
XpmColor **color;
|
||||
@ -88,10 +99,15 @@ FreeOldColorTable(colorTable, ncolors)
|
||||
/*
|
||||
* Free the computed color table
|
||||
*/
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
void xpmFreeColorTable(XpmColor* colorTable, int ncolors)
|
||||
#else
|
||||
void
|
||||
xpmFreeColorTable(colorTable, ncolors)
|
||||
XpmColor *colorTable;
|
||||
int ncolors;
|
||||
#endif
|
||||
{
|
||||
int a, b;
|
||||
XpmColor *color;
|
||||
@ -110,10 +126,15 @@ xpmFreeColorTable(colorTable, ncolors)
|
||||
/*
|
||||
* Free array of extensions
|
||||
*/
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
void XpmFreeExtensions(XpmExtension* extensions, int nextensions)
|
||||
#else
|
||||
void
|
||||
XpmFreeExtensions(extensions, nextensions)
|
||||
XpmExtension *extensions;
|
||||
int nextensions;
|
||||
#endif
|
||||
{
|
||||
unsigned int i, j, nlines;
|
||||
XpmExtension *ext;
|
||||
@ -147,9 +168,15 @@ XpmAttributesSize()
|
||||
/*
|
||||
* 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
|
||||
xpmInitAttributes(attributes)
|
||||
XpmAttributes *attributes;
|
||||
#endif
|
||||
{
|
||||
if (attributes) {
|
||||
attributes->pixels = NULL;
|
||||
@ -175,11 +202,16 @@ xpmInitAttributes(attributes)
|
||||
/*
|
||||
* 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
|
||||
xpmSetAttributes(attributes, image, info)
|
||||
XpmAttributes *attributes;
|
||||
XpmImage *image;
|
||||
XpmInfo *info;
|
||||
#endif
|
||||
{
|
||||
if (attributes->valuemask & XpmReturnColorTable) {
|
||||
attributes->colorTable = image->colorTable;
|
||||
@ -245,9 +277,14 @@ xpmSetAttributes(attributes, image, info)
|
||||
* Free the XpmAttributes structure members
|
||||
* but the structure itself
|
||||
*/
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
void XpmFreeAttributes(XpmAttributes* attributes)
|
||||
#else
|
||||
void
|
||||
XpmFreeAttributes(attributes)
|
||||
XpmAttributes *attributes;
|
||||
#endif
|
||||
{
|
||||
if (attributes->valuemask & XpmReturnPixels && attributes->npixels) {
|
||||
XpmFree(attributes->pixels);
|
||||
|
@ -49,6 +49,16 @@ LFUNC(WriteExtensions, void, (char *dataptr, unsigned int *used_size,
|
||||
LFUNC(ExtensionsSize, int, (XpmExtension *ext, unsigned int num));
|
||||
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
|
||||
XpmCreateBufferFromImage(display, buffer_return, image, shapeimage, attributes)
|
||||
Display *display;
|
||||
@ -56,6 +66,7 @@ XpmCreateBufferFromImage(display, buffer_return, image, shapeimage, attributes)
|
||||
XImage *image;
|
||||
XImage *shapeimage;
|
||||
XpmAttributes *attributes;
|
||||
#endif
|
||||
{
|
||||
XpmImage xpmimage;
|
||||
XpmInfo info;
|
||||
@ -94,11 +105,16 @@ XpmCreateBufferFromImage(display, buffer_return, image, shapeimage, attributes)
|
||||
goto error; \
|
||||
}
|
||||
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
int XpmCreateBufferFromXpmImage(char** buffer_return, XpmImage* image, XpmInfo* info)
|
||||
#else
|
||||
int
|
||||
XpmCreateBufferFromXpmImage(buffer_return, image, info)
|
||||
char **buffer_return;
|
||||
XpmImage *image;
|
||||
XpmInfo *info;
|
||||
#endif
|
||||
{
|
||||
/* calculation variables */
|
||||
int ErrorStatus;
|
||||
@ -198,7 +214,7 @@ XpmCreateBufferFromXpmImage(buffer_return, image, info)
|
||||
}
|
||||
ErrorStatus = WriteColors(&ptr, &ptr_size, &used_size,
|
||||
image->colorTable, image->ncolors, image->cpp);
|
||||
|
||||
|
||||
if (ErrorStatus != XpmSuccess)
|
||||
RETURN(ErrorStatus);
|
||||
|
||||
@ -246,6 +262,17 @@ error:
|
||||
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
|
||||
WriteColors(dataptr, data_size, used_size, colors, ncolors, cpp)
|
||||
char **dataptr;
|
||||
@ -254,6 +281,7 @@ WriteColors(dataptr, data_size, used_size, colors, ncolors, cpp)
|
||||
XpmColor *colors;
|
||||
unsigned int ncolors;
|
||||
unsigned int cpp;
|
||||
#endif
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
unsigned int a, key, l;
|
||||
@ -292,6 +320,18 @@ WriteColors(dataptr, data_size, used_size, colors, ncolors, cpp)
|
||||
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
|
||||
WritePixels(dataptr, used_size, width, height, cpp, pixels, colors)
|
||||
char *dataptr;
|
||||
@ -301,6 +341,7 @@ WritePixels(dataptr, used_size, width, height, cpp, pixels, colors)
|
||||
unsigned int cpp;
|
||||
unsigned int *pixels;
|
||||
XpmColor *colors;
|
||||
#endif
|
||||
{
|
||||
char *s = dataptr;
|
||||
unsigned int x, y, h;
|
||||
@ -325,10 +366,16 @@ WritePixels(dataptr, used_size, width, height, cpp, pixels, colors)
|
||||
*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
|
||||
ExtensionsSize(ext, num)
|
||||
XpmExtension *ext;
|
||||
unsigned int num;
|
||||
#endif
|
||||
{
|
||||
unsigned int x, y, a, size;
|
||||
char **line;
|
||||
@ -346,12 +393,22 @@ ExtensionsSize(ext, num)
|
||||
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
|
||||
WriteExtensions(dataptr, used_size, ext, num)
|
||||
char *dataptr;
|
||||
unsigned int *used_size;
|
||||
XpmExtension *ext;
|
||||
unsigned int num;
|
||||
#endif
|
||||
{
|
||||
unsigned int x, y, a;
|
||||
char **line;
|
||||
@ -380,9 +437,13 @@ WriteExtensions(dataptr, used_size, ext, num)
|
||||
*used_size += s - dataptr + 13;
|
||||
}
|
||||
|
||||
static int
|
||||
CommentsSize(info)
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
static int CommentsSize(XpmInfo* info)
|
||||
#else
|
||||
static int CommentsSize(info)
|
||||
XpmInfo *info;
|
||||
#endif
|
||||
{
|
||||
int size = 0;
|
||||
|
||||
|
@ -50,6 +50,17 @@ LFUNC(CreateExtensions, void, (char **dataptr, unsigned int offset,
|
||||
XpmExtension *ext, unsigned int num,
|
||||
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
|
||||
XpmCreateDataFromImage(display, data_return, image, shapeimage, attributes)
|
||||
Display *display;
|
||||
@ -57,6 +68,7 @@ XpmCreateDataFromImage(display, data_return, image, shapeimage, attributes)
|
||||
XImage *image;
|
||||
XImage *shapeimage;
|
||||
XpmAttributes *attributes;
|
||||
#endif
|
||||
{
|
||||
XpmImage xpmimage;
|
||||
XpmInfo info;
|
||||
@ -92,11 +104,17 @@ XpmCreateDataFromImage(display, data_return, image, shapeimage, attributes)
|
||||
goto exit; \
|
||||
}
|
||||
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
int
|
||||
XpmCreateDataFromXpmImage(char*** data_return, XpmImage* image, XpmInfo* info)
|
||||
#else
|
||||
int
|
||||
XpmCreateDataFromXpmImage(data_return, image, info)
|
||||
char ***data_return;
|
||||
XpmImage *image;
|
||||
XpmInfo *info;
|
||||
#endif
|
||||
{
|
||||
/* calculation variables */
|
||||
int ErrorStatus;
|
||||
@ -209,6 +227,17 @@ exit:
|
||||
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
|
||||
CreateColors(dataptr, data_size, colors, ncolors, cpp)
|
||||
char **dataptr;
|
||||
@ -216,6 +245,7 @@ CreateColors(dataptr, data_size, colors, ncolors, cpp)
|
||||
XpmColor *colors;
|
||||
unsigned int ncolors;
|
||||
unsigned int cpp;
|
||||
#endif
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
unsigned int a, key, l;
|
||||
@ -249,6 +279,17 @@ CreateColors(dataptr, data_size, colors, ncolors, cpp)
|
||||
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
|
||||
CreatePixels(dataptr, width, height, cpp, pixels, colors)
|
||||
char **dataptr;
|
||||
@ -257,6 +298,7 @@ CreatePixels(dataptr, width, height, cpp, pixels, colors)
|
||||
unsigned int cpp;
|
||||
unsigned int *pixels;
|
||||
XpmColor *colors;
|
||||
#endif
|
||||
{
|
||||
char *s;
|
||||
unsigned int x, y, h, offset;
|
||||
@ -281,12 +323,22 @@ CreatePixels(dataptr, width, height, cpp, pixels, colors)
|
||||
*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
|
||||
CountExtensions(ext, num, ext_size, ext_nlines)
|
||||
XpmExtension *ext;
|
||||
unsigned int num;
|
||||
unsigned int *ext_size;
|
||||
unsigned int *ext_nlines;
|
||||
#endif
|
||||
{
|
||||
unsigned int x, y, a, size, nlines;
|
||||
char **line;
|
||||
@ -307,6 +359,17 @@ CountExtensions(ext, num, ext_size, ext_nlines)
|
||||
*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
|
||||
CreateExtensions(dataptr, offset, ext, num, ext_nlines)
|
||||
char **dataptr;
|
||||
@ -314,6 +377,7 @@ CreateExtensions(dataptr, offset, ext, num, ext_nlines)
|
||||
XpmExtension *ext;
|
||||
unsigned int num;
|
||||
unsigned int ext_nlines;
|
||||
#endif
|
||||
{
|
||||
unsigned int x, y, a, b;
|
||||
char **line;
|
||||
|
423
src/xpm/create.c
423
src/xpm/create.c
@ -141,9 +141,21 @@ LFUNC(APutImagePixels, void, (XImage *ximage, unsigned int width,
|
||||
# endif/* AMIGA */
|
||||
#else /* FOR_MSW */
|
||||
/* 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,
|
||||
unsigned int width, unsigned int height,
|
||||
unsigned int *pixelindex, Pixel *pixels));
|
||||
#endif
|
||||
#endif /* FOR_MSW */
|
||||
|
||||
#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
|
||||
* 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
|
||||
xpmstrcasecmp(s1, s2)
|
||||
register char *s1, *s2;
|
||||
#endif
|
||||
{
|
||||
register int c1, c2;
|
||||
|
||||
@ -175,9 +192,14 @@ xpmstrcasecmp(s1, s2)
|
||||
/*
|
||||
* 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
|
||||
xpmVisualType(visual)
|
||||
Visual *visual;
|
||||
#endif
|
||||
{
|
||||
#ifndef FOR_MSW
|
||||
# ifndef AMIGA
|
||||
@ -211,9 +233,14 @@ typedef struct {
|
||||
long closeness;
|
||||
} 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
|
||||
closeness_cmp(a, b)
|
||||
Const void *a, *b;
|
||||
#endif
|
||||
{
|
||||
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 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
|
||||
AllocColor(display, colormap, colorname, xcolor, closure)
|
||||
Display *display;
|
||||
Colormap colormap;
|
||||
Colormap* colormap;
|
||||
char *colorname;
|
||||
XColor *xcolor;
|
||||
void *closure; /* not used */
|
||||
#endif
|
||||
{
|
||||
int status;
|
||||
if (colorname)
|
||||
#ifdef __OS2__
|
||||
if (!XParseColor(display, &colormap, colorname, xcolor))
|
||||
return -1;
|
||||
status = XAllocColor(display, &colormap, xcolor);
|
||||
#else
|
||||
if (!XParseColor(display, colormap, colorname, xcolor))
|
||||
return -1;
|
||||
status = XAllocColor(display, colormap, xcolor);
|
||||
#endif
|
||||
return status != 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
@ -304,17 +349,17 @@ SetCloseColor(display, colormap, visual, col, image_pixel, mask_pixel,
|
||||
* occurred, so we try the next closest color, and so on, until no more
|
||||
* colors are within closeness of the target. If we knew that the
|
||||
* colormap had changed, we could skip this sequence.
|
||||
*
|
||||
*
|
||||
* If _none_ of the colors within closeness of the target can be allocated,
|
||||
* then we can finally be pretty sure that the colormap has actually
|
||||
* changed. In this case we try to allocate the original color (again),
|
||||
* then try the closecolor stuff (again)...
|
||||
*
|
||||
*
|
||||
* In theory it would be possible for an infinite loop to occur if another
|
||||
* process kept changing the colormap every time we sorted it, so we set
|
||||
* a maximum on the number of iterations. After this many tries, we use
|
||||
* XGrabServer() to ensure that the colormap remains unchanged.
|
||||
*
|
||||
*
|
||||
* This approach gives particularly bad worst case performance - as many as
|
||||
* <MaximumIterations> colormap reads and sorts may be needed, and as
|
||||
* many as <MaximumIterations> * <ColormapSize> attempted allocations
|
||||
@ -434,6 +479,29 @@ SetCloseColor(display, colormap, visual, col, image_pixel, mask_pixel,
|
||||
* 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
|
||||
SetColor(display, colormap, visual, colorname, color_index,
|
||||
image_pixel, mask_pixel, mask_pixel_index,
|
||||
@ -455,6 +523,7 @@ SetColor(display, colormap, visual, colorname, color_index,
|
||||
int ncols;
|
||||
XpmAllocColorFunc allocColor;
|
||||
void *closure;
|
||||
#endif
|
||||
{
|
||||
XColor xcolor;
|
||||
int status;
|
||||
@ -480,8 +549,12 @@ SetColor(display, colormap, visual, colorname, color_index,
|
||||
*image_pixel = xcolor.pixel;
|
||||
#ifndef FOR_MSW
|
||||
*mask_pixel = 1;
|
||||
#else
|
||||
#ifdef __OS2__
|
||||
*mask_pixel = OS2RGB(0,0,0);
|
||||
#else
|
||||
*mask_pixel = RGB(0,0,0);
|
||||
#endif
|
||||
#endif
|
||||
used_pixels[(*nused_pixels)++] = xcolor.pixel;
|
||||
} else {
|
||||
@ -489,7 +562,11 @@ SetColor(display, colormap, visual, colorname, color_index,
|
||||
#ifndef FOR_MSW
|
||||
*mask_pixel = 0;
|
||||
#else
|
||||
*mask_pixel = RGB(255,255,255);
|
||||
#ifdef __OS2__
|
||||
*mask_pixel = OS2RGB(0,0,0);
|
||||
#else
|
||||
*mask_pixel = RGB(0,0,0);
|
||||
#endif
|
||||
#endif
|
||||
/* store the color table index */
|
||||
*mask_pixel_index = color_index;
|
||||
@ -497,7 +574,23 @@ SetColor(display, colormap, visual, colorname, color_index,
|
||||
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
|
||||
CreateColors(display, attributes, colors, ncolors, image_pixels, mask_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;
|
||||
Pixel *used_pixels;
|
||||
unsigned int *nused_pixels;
|
||||
#endif
|
||||
{
|
||||
/* variables stored in the XpmAttributes structure */
|
||||
Visual *visual;
|
||||
@ -730,6 +824,17 @@ CreateColors(display, attributes, colors, ncolors, image_pixels, mask_pixels,
|
||||
|
||||
|
||||
/* 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
|
||||
FreeColors(display, colormap, pixels, n, closure)
|
||||
Display *display;
|
||||
@ -737,6 +842,7 @@ FreeColors(display, colormap, pixels, n, closure)
|
||||
Pixel *pixels;
|
||||
int n;
|
||||
void *closure; /* not used */
|
||||
#endif
|
||||
{
|
||||
return XFreeColors(display, colormap, pixels, n, 0);
|
||||
}
|
||||
@ -750,6 +856,16 @@ FreeColors(display, colormap, pixels, n, closure)
|
||||
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
|
||||
XpmCreateImageFromXpmImage(display, image,
|
||||
image_return, shapeimage_return, attributes)
|
||||
@ -758,7 +874,13 @@ XpmCreateImageFromXpmImage(display, image,
|
||||
XImage **image_return;
|
||||
XImage **shapeimage_return;
|
||||
XpmAttributes *attributes;
|
||||
#endif
|
||||
{
|
||||
#ifdef __OS2__
|
||||
HAB hab;
|
||||
HPS hps;
|
||||
SIZEL sizl = {0, 0};
|
||||
#endif
|
||||
/* variables stored in the XpmAttributes structure */
|
||||
Visual *visual;
|
||||
Colormap colormap;
|
||||
@ -886,8 +1008,14 @@ XpmCreateImageFromXpmImage(display, image,
|
||||
image->data, image_pixels);
|
||||
# endif
|
||||
#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,
|
||||
image->data, image_pixels);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
/* create the shape mask image */
|
||||
@ -906,8 +1034,14 @@ XpmCreateImageFromXpmImage(display, image,
|
||||
image->data, mask_pixels);
|
||||
# endif
|
||||
#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,
|
||||
image->data, mask_pixels);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
@ -964,6 +1098,18 @@ error:
|
||||
/*
|
||||
* 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
|
||||
CreateXImage(display, visual, depth, format, width, height, image_return)
|
||||
Display *display;
|
||||
@ -973,6 +1119,7 @@ CreateXImage(display, visual, depth, format, width, height, image_return)
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
XImage **image_return;
|
||||
#endif
|
||||
{
|
||||
int bitmap_pad;
|
||||
|
||||
@ -1057,10 +1204,16 @@ static unsigned char Const _reverse_byte[0x100] = {
|
||||
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
|
||||
_XReverse_Bytes(bpt, nb)
|
||||
register unsigned char *bpt;
|
||||
register int nb;
|
||||
#endif
|
||||
{
|
||||
do {
|
||||
*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
|
||||
xpm_xynormalizeimagebits(bp, img)
|
||||
register unsigned char *bp;
|
||||
register XImage *img;
|
||||
#endif
|
||||
{
|
||||
register unsigned char c;
|
||||
|
||||
@ -1100,10 +1258,15 @@ xpm_xynormalizeimagebits(bp, img)
|
||||
_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
|
||||
xpm_znormalizeimagebits(bp, img)
|
||||
register unsigned char *bp;
|
||||
register XImage *img;
|
||||
#endif
|
||||
{
|
||||
register unsigned char c;
|
||||
|
||||
@ -1145,6 +1308,15 @@ static unsigned char Const _lomask[0x09] = {
|
||||
static unsigned char Const _himask[0x09] = {
|
||||
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
|
||||
_putbits(src, dstoffset, numbits, dst)
|
||||
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
|
||||
* destination */
|
||||
register char *dst; /* address of destination bit string */
|
||||
#endif
|
||||
{
|
||||
register unsigned char chlo, chhi;
|
||||
int hibits;
|
||||
@ -1193,6 +1366,16 @@ _putbits(src, dstoffset, numbits, dst)
|
||||
* 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
|
||||
PutImagePixels(image, width, height, pixelindex, pixels)
|
||||
XImage *image;
|
||||
@ -1200,6 +1383,7 @@ PutImagePixels(image, width, height, pixelindex, pixels)
|
||||
unsigned int height;
|
||||
unsigned int *pixelindex;
|
||||
Pixel *pixels;
|
||||
#endif
|
||||
{
|
||||
register char *src;
|
||||
register char *dst;
|
||||
@ -1280,6 +1464,17 @@ static unsigned long byteorderpixel = MSBFirst << 24;
|
||||
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
|
||||
PutImagePixels32(image, width, height, pixelindex, pixels)
|
||||
XImage *image;
|
||||
@ -1287,6 +1482,7 @@ PutImagePixels32(image, width, height, pixelindex, pixels)
|
||||
unsigned int height;
|
||||
unsigned int *pixelindex;
|
||||
Pixel *pixels;
|
||||
#endif
|
||||
{
|
||||
unsigned char *data;
|
||||
unsigned int *iptr;
|
||||
@ -1390,6 +1586,16 @@ PutImagePixels32(image, width, height, pixelindex, pixels)
|
||||
* 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
|
||||
PutImagePixels16(image, width, height, pixelindex, pixels)
|
||||
XImage *image;
|
||||
@ -1397,6 +1603,7 @@ PutImagePixels16(image, width, height, pixelindex, pixels)
|
||||
unsigned int height;
|
||||
unsigned int *pixelindex;
|
||||
Pixel *pixels;
|
||||
#endif
|
||||
{
|
||||
unsigned char *data;
|
||||
unsigned int *iptr;
|
||||
@ -1471,6 +1678,16 @@ PutImagePixels16(image, width, height, pixelindex, pixels)
|
||||
* 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
|
||||
PutImagePixels8(image, width, height, pixelindex, pixels)
|
||||
XImage *image;
|
||||
@ -1478,6 +1695,7 @@ PutImagePixels8(image, width, height, pixelindex, pixels)
|
||||
unsigned int height;
|
||||
unsigned int *pixelindex;
|
||||
Pixel *pixels;
|
||||
#endif
|
||||
{
|
||||
char *data;
|
||||
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**
|
||||
*/
|
||||
|
||||
#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
|
||||
PutImagePixels1(image, width, height, pixelindex, pixels)
|
||||
XImage *image;
|
||||
@ -1525,6 +1753,7 @@ PutImagePixels1(image, width, height, pixelindex, pixels)
|
||||
unsigned int height;
|
||||
unsigned int *pixelindex;
|
||||
Pixel *pixels;
|
||||
#endif
|
||||
{
|
||||
if (image->byte_order != image->bitmap_bit_order)
|
||||
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
|
||||
XpmCreatePixmapFromXpmImage(display, d, image,
|
||||
pixmap_return, shapemask_return, attributes)
|
||||
@ -1641,6 +1880,7 @@ XpmCreatePixmapFromXpmImage(display, d, image,
|
||||
Pixmap *pixmap_return;
|
||||
Pixmap *shapemask_return;
|
||||
XpmAttributes *attributes;
|
||||
#endif
|
||||
{
|
||||
XImage *ximage, *shapeimage;
|
||||
int ErrorStatus;
|
||||
@ -1687,7 +1927,7 @@ APutImagePixels (
|
||||
unsigned char *array;
|
||||
XImage *tmp_img;
|
||||
BOOL success = FALSE;
|
||||
|
||||
|
||||
array = XpmMalloc ((((width+15)>>4)<<4)*sizeof (*array));
|
||||
if (array != NULL)
|
||||
{
|
||||
@ -1706,7 +1946,7 @@ APutImagePixels (
|
||||
}
|
||||
XpmFree (array);
|
||||
}
|
||||
|
||||
|
||||
if (!success)
|
||||
{
|
||||
for (y = 0; y < height; ++y)
|
||||
@ -1717,6 +1957,19 @@ APutImagePixels (
|
||||
|
||||
# endif/* AMIGA */
|
||||
#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
|
||||
MSWPutImagePixels(dc, image, width, height, pixelindex, pixels)
|
||||
Display *dc;
|
||||
@ -1725,18 +1978,38 @@ MSWPutImagePixels(dc, image, width, height, pixelindex, pixels)
|
||||
unsigned int height;
|
||||
unsigned int *pixelindex;
|
||||
Pixel *pixels;
|
||||
#endif
|
||||
{
|
||||
unsigned int *data = pixelindex;
|
||||
unsigned int x, y;
|
||||
HBITMAP obm;
|
||||
|
||||
#ifdef __OS2__
|
||||
POINTL point;
|
||||
|
||||
obm = GpiSetBitmap(hps, image->bitmap);
|
||||
#else
|
||||
obm = SelectObject(*dc, image->bitmap);
|
||||
#endif
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
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] */
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef __OS2__
|
||||
GpiSetBitmap(hps, obm);
|
||||
#else
|
||||
SelectObject(*dc, obm);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* FOR_MSW */
|
||||
@ -1870,7 +2143,7 @@ PutPixel16MSB(ximage, x, y, pixel)
|
||||
unsigned long pixel;
|
||||
{
|
||||
unsigned char *addr;
|
||||
|
||||
|
||||
addr = &((unsigned char *)ximage->data) [ZINDEX16(x, y, ximage)];
|
||||
addr[0] = pixel >> 8;
|
||||
addr[1] = pixel;
|
||||
@ -1885,7 +2158,7 @@ PutPixel16LSB(ximage, x, y, pixel)
|
||||
unsigned long pixel;
|
||||
{
|
||||
unsigned char *addr;
|
||||
|
||||
|
||||
addr = &((unsigned char *)ximage->data) [ZINDEX16(x, y, ximage)];
|
||||
addr[1] = pixel >> 8;
|
||||
addr[0] = pixel;
|
||||
@ -1936,6 +2209,18 @@ PutPixel1LSB(ximage, x, y, pixel)
|
||||
/*
|
||||
* 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
|
||||
xpmParseDataAndCreate(display, data, image_return, shapeimage_return,
|
||||
image, info, attributes)
|
||||
@ -1946,6 +2231,7 @@ xpmParseDataAndCreate(display, data, image_return, shapeimage_return,
|
||||
XpmImage *image;
|
||||
XpmInfo *info;
|
||||
XpmAttributes *attributes;
|
||||
#endif
|
||||
{
|
||||
/* variables stored in the XpmAttributes structure */
|
||||
Visual *visual;
|
||||
@ -2275,6 +2561,23 @@ error:
|
||||
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
|
||||
ParseAndPutPixels(
|
||||
#ifdef FOR_MSW
|
||||
@ -2296,8 +2599,16 @@ ParseAndPutPixels(
|
||||
Pixel *image_pixels;
|
||||
XImage *shapeimage;
|
||||
Pixel *shape_pixels;
|
||||
#endif
|
||||
{
|
||||
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) {
|
||||
|
||||
@ -2310,14 +2621,25 @@ ParseAndPutPixels(
|
||||
HBITMAP obm, sobm;
|
||||
|
||||
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);
|
||||
sobm = SelectObject(shapedc, shapeimage->bitmap);
|
||||
#endif
|
||||
} else {
|
||||
shapedc = NULL;
|
||||
}
|
||||
#ifdef __OS2__
|
||||
obm = GpiSetBitmap(hps, image->bitmap);
|
||||
#else
|
||||
obm = SelectObject(*dc, image->bitmap);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
bzero((char *)colidx, 256 * sizeof(short));
|
||||
for (a = 0; a < ncolors; a++)
|
||||
@ -2334,10 +2656,24 @@ ParseAndPutPixels(
|
||||
if (shapeimage)
|
||||
XPutPixel(shapeimage, x, y,
|
||||
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
|
||||
SetPixel(*dc, x, y, image_pixels[colidx[c] - 1]);
|
||||
#endif
|
||||
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]);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
} else
|
||||
@ -2346,10 +2682,19 @@ ParseAndPutPixels(
|
||||
}
|
||||
#ifdef FOR_MSW
|
||||
if ( shapedc ) {
|
||||
#ifdef __OS2__
|
||||
GpiSetBitmap(hps, sobm);
|
||||
DevCloseDC(shapedc);
|
||||
#else
|
||||
SelectObject(shapedc, sobm);
|
||||
DeleteDC(shapedc);
|
||||
#endif
|
||||
}
|
||||
#ifdef __OS2__
|
||||
GpiSetBitmap(hps, obm);
|
||||
#else
|
||||
SelectObject(*dc, obm);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
@ -2357,7 +2702,6 @@ ParseAndPutPixels(
|
||||
case (2): /* Optimize for double character
|
||||
* colors */
|
||||
{
|
||||
|
||||
/* free all allocated pointers at all exits */
|
||||
#define FREE_CIDX {int f; for (f = 0; f < 256; f++) \
|
||||
if (cidx[f]) XpmFree(cidx[f]);}
|
||||
@ -2394,13 +2738,32 @@ if (cidx[f]) XpmFree(cidx[f]);}
|
||||
if (shapeimage)
|
||||
XPutPixel(shapeimage, x, y,
|
||||
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
|
||||
SelectObject(*dc, image->bitmap);
|
||||
SetPixel(*dc, x, y, image_pixels[cidx[cc1][cc2] - 1]);
|
||||
#endif
|
||||
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);
|
||||
SetPixel(*dc, x, y,
|
||||
shape_pixels[cidx[cc1][cc2] - 1]);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
@ -2441,14 +2804,33 @@ if (cidx[f]) XpmFree(cidx[f]);}
|
||||
if (shapeimage)
|
||||
XPutPixel(shapeimage, x, y,
|
||||
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
|
||||
SelectObject(*dc, image->bitmap);
|
||||
SetPixel(*dc, x, y,
|
||||
image_pixels[HashColorIndex(slot)]);
|
||||
#endif
|
||||
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);
|
||||
SetPixel(*dc, x, y,
|
||||
shape_pixels[HashColorIndex(slot)]);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -2468,12 +2850,31 @@ if (cidx[f]) XpmFree(cidx[f]);}
|
||||
XPutPixel(image, x, y, image_pixels[a]);
|
||||
if (shapeimage)
|
||||
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
|
||||
SelectObject(*dc, image->bitmap);
|
||||
SetPixel(*dc, x, y, image_pixels[a]);
|
||||
#endif
|
||||
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);
|
||||
SetPixel(*dc, x, y, shape_pixels[a]);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -36,6 +36,16 @@
|
||||
|
||||
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
|
||||
XpmCreateImageFromBuffer(display, buffer, image_return,
|
||||
shapeimage_return, attributes)
|
||||
@ -44,6 +54,7 @@ XpmCreateImageFromBuffer(display, buffer, image_return,
|
||||
XImage **image_return;
|
||||
XImage **shapeimage_return;
|
||||
XpmAttributes *attributes;
|
||||
#endif
|
||||
{
|
||||
XpmImage image;
|
||||
XpmInfo info;
|
||||
@ -79,11 +90,20 @@ XpmCreateImageFromBuffer(display, buffer, image_return,
|
||||
return (ErrorStatus);
|
||||
}
|
||||
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
int XpmCreateXpmImageFromBuffer(
|
||||
char* buffer
|
||||
, XpmImage* image
|
||||
, XpmInfo* info
|
||||
)
|
||||
#else
|
||||
int
|
||||
XpmCreateXpmImageFromBuffer(buffer, image, info)
|
||||
char *buffer;
|
||||
XpmImage *image;
|
||||
XpmInfo *info;
|
||||
#endif
|
||||
{
|
||||
xpmData mdata;
|
||||
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
|
||||
*/
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
static void OpenBuffer(char* buffer, xpmData* mdata)
|
||||
#else
|
||||
static void
|
||||
OpenBuffer(buffer, mdata)
|
||||
char *buffer;
|
||||
xpmData *mdata;
|
||||
#endif
|
||||
{
|
||||
mdata->type = XPMBUFFER;
|
||||
mdata->cptr = buffer;
|
||||
|
@ -36,6 +36,16 @@
|
||||
|
||||
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
|
||||
XpmCreateImageFromData(display, data, image_return,
|
||||
shapeimage_return, attributes)
|
||||
@ -44,6 +54,7 @@ XpmCreateImageFromData(display, data, image_return,
|
||||
XImage **image_return;
|
||||
XImage **shapeimage_return;
|
||||
XpmAttributes *attributes;
|
||||
#endif
|
||||
{
|
||||
XpmImage image;
|
||||
XpmInfo info;
|
||||
@ -79,11 +90,21 @@ XpmCreateImageFromData(display, data, image_return,
|
||||
return (ErrorStatus);
|
||||
}
|
||||
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
int
|
||||
XpmCreateXpmImageFromData(
|
||||
char** data
|
||||
, XpmImage* image
|
||||
, XpmInfo* info
|
||||
)
|
||||
#else
|
||||
int
|
||||
XpmCreateXpmImageFromData(data, image, info)
|
||||
char **data;
|
||||
XpmImage *image;
|
||||
XpmInfo *info;
|
||||
#endif
|
||||
{
|
||||
xpmData mdata;
|
||||
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
|
||||
*/
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
static void OpenArray(char** data, xpmData* mdata)
|
||||
#else
|
||||
static void
|
||||
OpenArray(data, mdata)
|
||||
char **data;
|
||||
xpmData *mdata;
|
||||
#endif
|
||||
{
|
||||
mdata->type = XPMARRAY;
|
||||
mdata->stream.data = data;
|
||||
|
@ -48,9 +48,15 @@ static char *RCS_Id = "$Id$";
|
||||
#define Ungetc(data, c, file) ungetc(c, file)
|
||||
#endif
|
||||
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
static int
|
||||
ParseComment(xpmData* data)
|
||||
#else
|
||||
static int
|
||||
ParseComment(data)
|
||||
xpmData *data;
|
||||
#endif
|
||||
{
|
||||
if (data->type == XPMBUFFER) {
|
||||
register char c;
|
||||
@ -175,9 +181,14 @@ ParseComment(data)
|
||||
/*
|
||||
* 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
|
||||
xpmNextString(data)
|
||||
xpmData *data;
|
||||
#endif
|
||||
{
|
||||
if (!data->type)
|
||||
data->cptr = (data->stream.data)[++data->line];
|
||||
@ -231,11 +242,20 @@ xpmNextString(data)
|
||||
/*
|
||||
* 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
|
||||
xpmNextWord(data, buf, buflen)
|
||||
xpmData *data;
|
||||
char *buf;
|
||||
unsigned int buflen;
|
||||
#endif
|
||||
{
|
||||
register unsigned int n = 0;
|
||||
int c;
|
||||
@ -268,10 +288,16 @@ xpmNextWord(data, buf, buflen)
|
||||
* skip whitespace and compute the following unsigned int,
|
||||
* 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
|
||||
xpmNextUI(data, ui_return)
|
||||
xpmData *data;
|
||||
unsigned int *ui_return;
|
||||
#endif
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
int l;
|
||||
@ -283,11 +309,16 @@ xpmNextUI(data, ui_return)
|
||||
/*
|
||||
* 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
|
||||
xpmGetString(data, sptr, l)
|
||||
xpmData *data;
|
||||
char **sptr;
|
||||
unsigned int *l;
|
||||
#endif
|
||||
{
|
||||
unsigned int i, n = 0;
|
||||
int c;
|
||||
@ -367,10 +398,15 @@ xpmGetString(data, sptr, l)
|
||||
/*
|
||||
* get the current comment line
|
||||
*/
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
int xpmGetCmt(xpmData* data, char** cmt)
|
||||
#else
|
||||
int
|
||||
xpmGetCmt(data, cmt)
|
||||
xpmData *data;
|
||||
char **cmt;
|
||||
#endif
|
||||
{
|
||||
if (!data->type)
|
||||
*cmt = NULL;
|
||||
@ -399,9 +435,14 @@ xpmDataType xpmDataTypes[] =
|
||||
/*
|
||||
* parse xpm header
|
||||
*/
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
int xpmParseHeader(xpmData* data)
|
||||
#else
|
||||
int
|
||||
xpmParseHeader(data)
|
||||
xpmData *data;
|
||||
#endif
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
int l, n = 0;
|
||||
|
@ -38,10 +38,16 @@
|
||||
LFUNC(AtomMake, xpmHashAtom, (char *name, void *data));
|
||||
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
|
||||
AtomMake(name, data) /* makes an atom */
|
||||
char *name; /* WARNING: is just pointed to */
|
||||
void *data;
|
||||
#endif
|
||||
{
|
||||
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 *
|
||||
xpmHashSlot(table, s)
|
||||
xpmHashTable *table;
|
||||
char *s;
|
||||
#endif
|
||||
{
|
||||
xpmHashAtom *atomTable = table->atomTable;
|
||||
unsigned int hash;
|
||||
@ -130,9 +141,14 @@ xpmHashSlot(table, s)
|
||||
return p;
|
||||
}
|
||||
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
static int HashTableGrows(xpmHashTable* table)
|
||||
#else
|
||||
static int
|
||||
HashTableGrows(table)
|
||||
xpmHashTable *table;
|
||||
#endif
|
||||
{
|
||||
xpmHashAtom *atomTable = table->atomTable;
|
||||
int size = table->size;
|
||||
@ -165,11 +181,16 @@ HashTableGrows(table)
|
||||
* 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
|
||||
xpmHashIntern(table, tag, data)
|
||||
xpmHashTable *table;
|
||||
char *tag;
|
||||
void *data;
|
||||
#endif
|
||||
{
|
||||
xpmHashAtom *slot;
|
||||
|
||||
@ -194,9 +215,14 @@ xpmHashIntern(table, tag, data)
|
||||
* must be called before allocating any atom
|
||||
*/
|
||||
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
int xpmHashTableInit(xpmHashTable* table)
|
||||
#else
|
||||
int
|
||||
xpmHashTableInit(table)
|
||||
xpmHashTable *table;
|
||||
#endif
|
||||
{
|
||||
xpmHashAtom *p;
|
||||
xpmHashAtom *atomTable;
|
||||
@ -217,9 +243,15 @@ xpmHashTableInit(table)
|
||||
* 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
|
||||
xpmHashTableFree(table)
|
||||
xpmHashTable *table;
|
||||
#endif
|
||||
{
|
||||
xpmHashAtom *p;
|
||||
xpmHashAtom *atomTable = table->atomTable;
|
||||
|
@ -37,9 +37,15 @@
|
||||
/*
|
||||
* 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
|
||||
xpmInitXpmImage(image)
|
||||
XpmImage *image;
|
||||
#endif
|
||||
{
|
||||
image->ncolors = 0;
|
||||
image->colorTable = NULL;
|
||||
@ -49,9 +55,15 @@ xpmInitXpmImage(image)
|
||||
/*
|
||||
* 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
|
||||
XpmFreeXpmImage(image)
|
||||
XpmImage *image;
|
||||
#endif
|
||||
{
|
||||
if (image->colorTable)
|
||||
xpmFreeColorTable(image->colorTable, image->ncolors);
|
||||
|
@ -37,9 +37,15 @@
|
||||
/*
|
||||
* 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
|
||||
xpmInitXpmInfo(info)
|
||||
XpmInfo *info;
|
||||
#endif
|
||||
{
|
||||
if (info) {
|
||||
info->hints_cmt = NULL;
|
||||
@ -53,9 +59,15 @@ xpmInitXpmInfo(info)
|
||||
/*
|
||||
* 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
|
||||
XpmFreeXpmInfo(info)
|
||||
XpmInfo *info;
|
||||
#endif
|
||||
{
|
||||
if (info) {
|
||||
if (info->valuemask & XpmComments) {
|
||||
@ -84,10 +96,15 @@ XpmFreeXpmInfo(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
|
||||
xpmSetInfoMask(info, attributes)
|
||||
XpmInfo *info;
|
||||
XpmAttributes *attributes;
|
||||
#endif
|
||||
{
|
||||
info->valuemask = 0;
|
||||
if (attributes->valuemask & XpmReturnInfos)
|
||||
@ -99,10 +116,16 @@ xpmSetInfoMask(info, attributes)
|
||||
/*
|
||||
* 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
|
||||
xpmSetInfo(info, attributes)
|
||||
XpmInfo *info;
|
||||
XpmAttributes *attributes;
|
||||
#endif
|
||||
{
|
||||
info->valuemask = 0;
|
||||
if (attributes->valuemask & XpmInfos) {
|
||||
|
@ -39,9 +39,14 @@
|
||||
* in case strdup is not provided by the system here is one
|
||||
* which does the trick
|
||||
*/
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
char* xpmstrdup(char* s1)
|
||||
#else
|
||||
char *
|
||||
xpmstrdup(s1)
|
||||
char *s1;
|
||||
#endif
|
||||
{
|
||||
char *s2;
|
||||
int l = strlen(s1) + 1;
|
||||
@ -53,11 +58,21 @@ xpmstrdup(s1)
|
||||
|
||||
#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
|
||||
xpmatoui(p, l, ui_return)
|
||||
register char *p;
|
||||
unsigned int l;
|
||||
unsigned int *ui_return;
|
||||
#endif
|
||||
{
|
||||
register unsigned int n, i;
|
||||
|
||||
@ -78,9 +93,14 @@ xpmatoui(p, l, ui_return)
|
||||
/*
|
||||
* 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 *
|
||||
XpmGetErrorString(errcode)
|
||||
int errcode;
|
||||
#endif
|
||||
{
|
||||
switch (errcode) {
|
||||
case XpmColorError:
|
||||
@ -116,9 +136,15 @@ XpmLibraryVersion()
|
||||
#undef XpmFree
|
||||
#endif
|
||||
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
void
|
||||
XpmFree(void* ptr)
|
||||
#else
|
||||
void
|
||||
XpmFree(ptr)
|
||||
void *ptr;
|
||||
#endif
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
|
@ -54,6 +54,20 @@ char *xpmColorKeys[] = {
|
||||
"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
|
||||
xpmParseValues(data, width, height, ncolors, cpp,
|
||||
x_hotspot, y_hotspot, hotspot, extensions)
|
||||
@ -61,6 +75,7 @@ xpmParseValues(data, width, height, ncolors, cpp,
|
||||
unsigned int *width, *height, *ncolors, *cpp;
|
||||
unsigned int *x_hotspot, *y_hotspot, *hotspot;
|
||||
unsigned int *extensions;
|
||||
#endif
|
||||
{
|
||||
unsigned int l;
|
||||
char buf[BUFSIZ];
|
||||
@ -164,6 +179,16 @@ xpmParseValues(data, width, height, ncolors, cpp,
|
||||
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
|
||||
xpmParseColors(data, ncolors, cpp, colorTablePtr, hashtable)
|
||||
xpmData *data;
|
||||
@ -171,6 +196,7 @@ xpmParseColors(data, ncolors, cpp, colorTablePtr, hashtable)
|
||||
unsigned int cpp;
|
||||
XpmColor **colorTablePtr;
|
||||
xpmHashTable *hashtable;
|
||||
#endif
|
||||
{
|
||||
unsigned int key, l, a, b;
|
||||
unsigned int curkey; /* current color key */
|
||||
@ -324,6 +350,20 @@ xpmParseColors(data, ncolors, cpp, colorTablePtr, hashtable)
|
||||
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
|
||||
ParsePixels(data, width, height, ncolors, cpp, colorTable, hashtable, pixels)
|
||||
xpmData *data;
|
||||
@ -334,6 +374,7 @@ ParsePixels(data, width, height, ncolors, cpp, colorTable, hashtable, pixels)
|
||||
XpmColor *colorTable;
|
||||
xpmHashTable *hashtable;
|
||||
unsigned int **pixels;
|
||||
#endif
|
||||
{
|
||||
unsigned int *iptr, *iptr2;
|
||||
unsigned int a, x, y;
|
||||
@ -480,11 +521,20 @@ if (cidx[f]) XpmFree(cidx[f]);}
|
||||
return (XpmSuccess);
|
||||
}
|
||||
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
int xpmParseExtensions(
|
||||
xpmData* data
|
||||
, XpmExtension** extensions
|
||||
, unsigned int* nextensions
|
||||
)
|
||||
#else
|
||||
int
|
||||
xpmParseExtensions(data, extensions, nextensions)
|
||||
xpmData *data;
|
||||
XpmExtension **extensions;
|
||||
unsigned int *nextensions;
|
||||
#endif
|
||||
{
|
||||
XpmExtension *exts = NULL, *ext;
|
||||
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
|
||||
* 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
|
||||
xpmParseData(data, image, info)
|
||||
xpmData *data;
|
||||
XpmImage *image;
|
||||
XpmInfo *info;
|
||||
#endif
|
||||
{
|
||||
/* variables to return */
|
||||
unsigned int width, height, ncolors, cpp;
|
||||
|
@ -34,10 +34,15 @@
|
||||
|
||||
#include "XpmI.h"
|
||||
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
int XpmReadFileToData(char* filename, char*** data_return)
|
||||
#else
|
||||
int
|
||||
XpmReadFileToData(filename, data_return)
|
||||
char *filename;
|
||||
char ***data_return;
|
||||
#endif
|
||||
{
|
||||
XpmImage image;
|
||||
XpmInfo info;
|
||||
|
@ -48,6 +48,16 @@ LFUNC(OpenReadFile, int, (char *filename, xpmData *mdata));
|
||||
LFUNC(xpmDataClose, void, (xpmData *mdata));
|
||||
|
||||
#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
|
||||
XpmReadFileToImage(display, filename,
|
||||
image_return, shapeimage_return, attributes)
|
||||
@ -56,6 +66,7 @@ XpmReadFileToImage(display, filename,
|
||||
XImage **image_return;
|
||||
XImage **shapeimage_return;
|
||||
XpmAttributes *attributes;
|
||||
#endif
|
||||
{
|
||||
XpmImage image;
|
||||
XpmInfo info;
|
||||
@ -93,11 +104,22 @@ XpmReadFileToImage(display, filename,
|
||||
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
|
||||
XpmReadFileToXpmImage(filename, image, info)
|
||||
char *filename;
|
||||
XpmImage *image;
|
||||
XpmInfo *info;
|
||||
#endif
|
||||
{
|
||||
xpmData mdata;
|
||||
int ErrorStatus;
|
||||
@ -122,10 +144,15 @@ XpmReadFileToXpmImage(filename, image, info)
|
||||
/*
|
||||
* 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
|
||||
OpenReadFile(filename, mdata)
|
||||
char *filename;
|
||||
xpmData *mdata;
|
||||
#endif
|
||||
{
|
||||
#ifndef NO_ZPIPE
|
||||
char *compressfile, buf[BUFSIZ];
|
||||
@ -204,9 +231,15 @@ OpenReadFile(filename, mdata)
|
||||
/*
|
||||
* 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
|
||||
xpmDataClose(mdata)
|
||||
xpmData *mdata;
|
||||
#endif
|
||||
{
|
||||
switch (mdata->type) {
|
||||
case XPMFILE:
|
||||
|
@ -69,7 +69,7 @@ xpmReadRgbNames(rgb_fname, rgbn)
|
||||
|
||||
/* Loop reading each line in the file. */
|
||||
n = 0;
|
||||
rgb = rgbn;
|
||||
rgb = rgbn;
|
||||
/* Quit if rgb text file has too many entries. */
|
||||
while (fgets(line, sizeof(line), rgbf) && n < MAX_RGBNAMES) {
|
||||
|
||||
@ -158,10 +158,15 @@ xpmFreeRgbNames(rgbn, rgbn_max)
|
||||
|
||||
#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
|
||||
xpmReadRgbNames(rgb_fname, rgbn)
|
||||
char *rgb_fname;
|
||||
xpmRgbName rgbn[];
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* 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,
|
||||
* 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 *
|
||||
xpmGetRgbName(rgbn, rgbn_max, red, green, blue)
|
||||
xpmRgbName rgbn[]; /* rgb mnemonics from rgb text file
|
||||
* not used */
|
||||
int rgbn_max; /* not used */
|
||||
int red, green, blue; /* rgb values */
|
||||
|
||||
#endif
|
||||
{
|
||||
int i;
|
||||
unsigned long rgbVal;
|
||||
@ -198,10 +207,15 @@ xpmGetRgbName(rgbn, rgbn_max, red, green, blue)
|
||||
}
|
||||
|
||||
/* 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
|
||||
xpmGetRGBfromName(inname, r, g, b)
|
||||
char *inname;
|
||||
int *r, *g, *b;
|
||||
#endif
|
||||
{
|
||||
int left, right, middle;
|
||||
int cmp;
|
||||
@ -270,11 +284,15 @@ xpmGetRGBfromName(inname, r, g, b)
|
||||
return (1);
|
||||
}
|
||||
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
void xpmFreeRgbNames(xpmRgbName rgbn[], int rgbn_max)
|
||||
#else
|
||||
void
|
||||
xpmFreeRgbNames(rgbn, rgbn_max)
|
||||
xpmRgbName rgbn[];
|
||||
int rgbn_max;
|
||||
|
||||
#endif
|
||||
{
|
||||
/* nothing to do */
|
||||
}
|
||||
|
@ -47,8 +47,11 @@ typedef struct {
|
||||
#define myRGB(r,g,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 */
|
||||
|
||||
#else
|
||||
#define myRGB(r,g,b) OS2RGB(r,g,b)
|
||||
#endif
|
||||
|
||||
static rgbRecord theRGBRecords[] =
|
||||
{
|
||||
|
158
src/xpm/scan.c
158
src/xpm/scan.c
@ -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
|
||||
* 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
|
||||
storePixel(pixel, pmap, index_return)
|
||||
Pixel pixel;
|
||||
PixelsMap *pmap;
|
||||
unsigned int *index_return;
|
||||
#endif
|
||||
{
|
||||
unsigned int i;
|
||||
Pixel *p;
|
||||
@ -146,11 +151,16 @@ storePixel(pixel, pmap, index_return)
|
||||
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
|
||||
storeMaskPixel(pixel, pmap, index_return)
|
||||
Pixel pixel;
|
||||
PixelsMap *pmap;
|
||||
unsigned int *index_return;
|
||||
#endif
|
||||
{
|
||||
if (!pixel) {
|
||||
if (!pmap->ncolors) {
|
||||
@ -176,6 +186,16 @@ storeMaskPixel(pixel, pmap, index_return)
|
||||
* This function scans the given image and stores the found informations in
|
||||
* 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
|
||||
XpmCreateXpmImageFromImage(display, image, shapeimage,
|
||||
xpmimage, attributes)
|
||||
@ -184,6 +204,7 @@ XpmCreateXpmImageFromImage(display, image, shapeimage,
|
||||
XImage *shapeimage;
|
||||
XpmImage *xpmimage;
|
||||
XpmAttributes *attributes;
|
||||
#endif
|
||||
{
|
||||
/* variables stored in the XpmAttributes structure */
|
||||
unsigned int cpp;
|
||||
@ -250,8 +271,13 @@ XpmCreateXpmImageFromImage(display, image, shapeimage,
|
||||
storeMaskPixel);
|
||||
# endif
|
||||
#else
|
||||
|
||||
#ifndef __OS2__
|
||||
ErrorStatus = MSWGetImagePixels(display, shapeimage, width, height,
|
||||
&pmap, storeMaskPixel);
|
||||
/* calling convention all messed up OS/2 -- figure out later */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
if (ErrorStatus != XpmSuccess)
|
||||
RETURN(ErrorStatus);
|
||||
@ -259,10 +285,10 @@ XpmCreateXpmImageFromImage(display, image, shapeimage,
|
||||
|
||||
/*
|
||||
* scan the image data
|
||||
*
|
||||
*
|
||||
* In case depth is 1 or bits_per_pixel is 4, 6, 8, 24 or 32 use optimized
|
||||
* functions, otherwise use slower but sure general one.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
if (image) {
|
||||
@ -286,8 +312,12 @@ XpmCreateXpmImageFromImage(display, image, shapeimage,
|
||||
storePixel);
|
||||
# endif
|
||||
#else
|
||||
|
||||
#ifndef __OS2__
|
||||
ErrorStatus = MSWGetImagePixels(display, image, width, height, &pmap,
|
||||
storePixel);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
if (ErrorStatus != XpmSuccess)
|
||||
RETURN(ErrorStatus);
|
||||
@ -345,11 +375,16 @@ error:
|
||||
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
|
||||
ScanTransparentColor(color, cpp, attributes)
|
||||
XpmColor *color;
|
||||
unsigned int cpp;
|
||||
XpmAttributes *attributes;
|
||||
#endif
|
||||
{
|
||||
char *s;
|
||||
unsigned int a, b, c;
|
||||
@ -399,6 +434,18 @@ ScanTransparentColor(color, cpp, attributes)
|
||||
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
|
||||
ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes)
|
||||
Display *display;
|
||||
@ -408,6 +455,7 @@ ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes)
|
||||
unsigned int mask;
|
||||
unsigned int cpp;
|
||||
XpmAttributes *attributes;
|
||||
#endif
|
||||
{
|
||||
/* variables stored in the XpmAttributes structure */
|
||||
Colormap colormap;
|
||||
@ -416,8 +464,8 @@ ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes)
|
||||
#ifndef FOR_MSW
|
||||
xpmRgbName rgbn[MAX_RGBNAMES];
|
||||
#else
|
||||
xpmRgbName *rgbn = NULL;
|
||||
#endif
|
||||
xpmRgbName *rgbn = NULL;
|
||||
#endif
|
||||
int rgbn_max = 0;
|
||||
unsigned int i, j, c, i2;
|
||||
XpmColor *color;
|
||||
@ -465,7 +513,11 @@ ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes)
|
||||
|
||||
xcolor->pixel = *pixels;
|
||||
}
|
||||
#ifdef __OS2__
|
||||
XQueryColors(display, &colormap, xcolors, ncolors);
|
||||
#else
|
||||
XQueryColors(display, colormap, xcolors, ncolors);
|
||||
#endif
|
||||
|
||||
#ifndef FOR_MSW
|
||||
/* read the rgb file if any was specified */
|
||||
@ -540,7 +592,7 @@ ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes)
|
||||
#ifndef FOR_MSW
|
||||
sprintf(buf, "#%04X%04X%04X",
|
||||
xcolor->red, xcolor->green, xcolor->blue);
|
||||
#else
|
||||
#else
|
||||
sprintf(buf, "#%02x%02x%02x",
|
||||
xcolor->red, xcolor->green, xcolor->blue);
|
||||
#endif
|
||||
@ -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
|
||||
GetImagePixels(image, width, height, pmap)
|
||||
XImage *image;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
PixelsMap *pmap;
|
||||
#endif
|
||||
{
|
||||
char *src;
|
||||
char *dst;
|
||||
@ -695,12 +757,22 @@ GetImagePixels(image, width, height, pmap)
|
||||
static unsigned long byteorderpixel = MSBFirst << 24;
|
||||
#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
|
||||
GetImagePixels32(image, width, height, pmap)
|
||||
XImage *image;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
PixelsMap *pmap;
|
||||
#endif
|
||||
{
|
||||
unsigned char *addr;
|
||||
unsigned char *data;
|
||||
@ -760,12 +832,22 @@ GetImagePixels32(image, width, height, pmap)
|
||||
* 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
|
||||
GetImagePixels16(image, width, height, pmap)
|
||||
XImage *image;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
PixelsMap *pmap;
|
||||
#endif
|
||||
{
|
||||
unsigned char *addr;
|
||||
unsigned char *data;
|
||||
@ -806,12 +888,23 @@ GetImagePixels16(image, width, height, pmap)
|
||||
* 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
|
||||
GetImagePixels8(image, width, height, pmap)
|
||||
XImage *image;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
PixelsMap *pmap;
|
||||
#endif
|
||||
{
|
||||
unsigned int *iptr;
|
||||
unsigned char *data;
|
||||
@ -839,6 +932,17 @@ GetImagePixels8(image, width, height, pmap)
|
||||
* 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
|
||||
GetImagePixels1(image, width, height, pmap, storeFunc)
|
||||
XImage *image;
|
||||
@ -846,6 +950,7 @@ GetImagePixels1(image, width, height, pmap, storeFunc)
|
||||
unsigned int height;
|
||||
PixelsMap *pmap;
|
||||
int (*storeFunc) ();
|
||||
#endif
|
||||
{
|
||||
unsigned int *iptr;
|
||||
int x, y;
|
||||
@ -902,15 +1007,15 @@ AGetImagePixels (
|
||||
unsigned int x, y;
|
||||
unsigned char *pixels;
|
||||
XImage *tmp_img;
|
||||
|
||||
|
||||
pixels = XpmMalloc ((((width+15)>>4)<<4)*sizeof (*pixels));
|
||||
if (pixels == NULL)
|
||||
return XpmNoMemory;
|
||||
|
||||
|
||||
tmp_img = AllocXImage ((((width+15)>>4)<<4), 1, image->rp->BitMap->Depth);
|
||||
if (tmp_img == NULL)
|
||||
CLEAN_UP (XpmNoMemory)
|
||||
|
||||
|
||||
iptr = pmap->pixelindex;
|
||||
for (y = 0; y < height; ++y)
|
||||
{
|
||||
@ -921,7 +1026,7 @@ AGetImagePixels (
|
||||
CLEAN_UP (XpmNoMemory)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CLEAN_UP (XpmSuccess)
|
||||
}
|
||||
|
||||
@ -929,6 +1034,18 @@ AGetImagePixels (
|
||||
|
||||
# endif/* AMIGA */
|
||||
#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
|
||||
MSWGetImagePixels(display, image, width, height, pmap, storeFunc)
|
||||
Display *display;
|
||||
@ -937,19 +1054,42 @@ MSWGetImagePixels(display, image, width, height, pmap, storeFunc)
|
||||
unsigned int height;
|
||||
PixelsMap *pmap;
|
||||
int (*storeFunc) ();
|
||||
#endif
|
||||
{
|
||||
unsigned int *iptr;
|
||||
unsigned int x, y;
|
||||
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;
|
||||
|
||||
#ifdef __OS2__
|
||||
hps = GpiCreatePS(hab, *display, &sizl, GPIA_ASSOC | PU_PELS);
|
||||
GpiSetBitmap(hps, image->bitmap);
|
||||
#else
|
||||
SelectObject(*display, image->bitmap);
|
||||
#endif
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
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);
|
||||
#endif
|
||||
#ifndef __OS2__
|
||||
/* calling convention all messed up under OS/2 */
|
||||
if ((*storeFunc) (pixel, pmap, iptr))
|
||||
return (XpmNoMemory);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return (XpmSuccess);
|
||||
|
@ -121,13 +121,26 @@ XDefaultScreen(Display *d)
|
||||
|
||||
/* I get only 1 plane but 8 bits per pixel,
|
||||
so I think BITSPIXEL should be depth */
|
||||
int
|
||||
int
|
||||
XDefaultDepth(Display *display, Screen *screen)
|
||||
{
|
||||
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);
|
||||
d = GetDeviceCaps(*display, PLANES);
|
||||
#endif
|
||||
return (b);
|
||||
}
|
||||
|
||||
@ -139,8 +152,8 @@ XDefaultColormap(Display *display, Screen *screen)
|
||||
|
||||
/* convert hex color names,
|
||||
wrong digits (not a-f,A-F,0-9) are treated as zero */
|
||||
static int
|
||||
hexCharToInt(c)
|
||||
static int
|
||||
hexCharToInt(char c)
|
||||
{
|
||||
int r;
|
||||
|
||||
@ -156,7 +169,7 @@ hexCharToInt(c)
|
||||
return (r);
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
rgbFromHex(char *hex, int *r, int *g, int *b)
|
||||
{
|
||||
int len;
|
||||
@ -186,7 +199,7 @@ rgbFromHex(char *hex, int *r, int *g, int *b)
|
||||
}
|
||||
|
||||
/* Color related functions */
|
||||
int
|
||||
int
|
||||
XParseColor(Display *d, Colormap *cmap, char *name, XColor *color)
|
||||
{
|
||||
int r, g, b; /* only 8 bit values used */
|
||||
@ -204,7 +217,11 @@ XParseColor(Display *d, Colormap *cmap, char *name, XColor *color)
|
||||
}
|
||||
|
||||
if (okay) {
|
||||
#ifdef __OS2__
|
||||
color->pixel = OS2RGB(r, g, b);
|
||||
#else
|
||||
color->pixel = RGB(r, g, b);
|
||||
#endif
|
||||
color->red = (BYTE) r;
|
||||
color->green = (BYTE) g;
|
||||
color->blue = (BYTE) b;
|
||||
@ -216,14 +233,14 @@ XParseColor(Display *d, Colormap *cmap, char *name, XColor *color)
|
||||
|
||||
/* GRG: 2nd arg is Colormap*, not Colormap */
|
||||
|
||||
int
|
||||
int
|
||||
XAllocColor(Display *d, Colormap *cmap, XColor *color)
|
||||
{
|
||||
/* colormap not used yet so color->pixel is the real COLORREF (RBG) and not an
|
||||
index in some colormap as in X */
|
||||
return (1);
|
||||
}
|
||||
void
|
||||
void
|
||||
XQueryColors(Display *display, Colormap *colormap,
|
||||
XColor *xcolors, int ncolors)
|
||||
{
|
||||
@ -239,7 +256,7 @@ XQueryColors(Display *display, Colormap *colormap,
|
||||
}
|
||||
return;
|
||||
}
|
||||
int
|
||||
int
|
||||
XFreeColors(Display *d, Colormap cmap,
|
||||
unsigned long pixels[], int npixels, unsigned long planes)
|
||||
{
|
||||
@ -255,6 +272,18 @@ XCreateImage(Display *d, Visual *v,
|
||||
int pad, int foo)
|
||||
{
|
||||
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) {
|
||||
/*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) ) {
|
||||
img->bitmap = CreateCompatibleBitmap(*d, width, height);
|
||||
} else*/ {
|
||||
#ifdef __OS2__
|
||||
img->bitmap = GpiCreateBitmap(hps, &bmih, 0L, NULL, NULL);
|
||||
#else
|
||||
img->bitmap = CreateBitmap(width, height, 1 /* plane */ ,
|
||||
depth /* bits per pixel */ , NULL);
|
||||
#endif
|
||||
}
|
||||
img->width = width;
|
||||
img->height = height;
|
||||
@ -275,18 +308,22 @@ XCreateImage(Display *d, Visual *v,
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
XImageFree(XImage *img)
|
||||
{
|
||||
if (img) {
|
||||
XpmFree(img);
|
||||
}
|
||||
}
|
||||
void
|
||||
void
|
||||
XDestroyImage(XImage *img)
|
||||
{
|
||||
if (img) {
|
||||
#ifdef __OS2__
|
||||
GpiDeleteBitmap(img->bitmap);
|
||||
#else
|
||||
DeleteObject(img->bitmap); /* check return ??? */
|
||||
#endif
|
||||
XImageFree(img);
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,21 @@
|
||||
|
||||
#ifdef FOR_MSW
|
||||
|
||||
#if !defined(__OS2__)
|
||||
#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
|
||||
@ -49,11 +63,11 @@
|
||||
/* these defines get undefed at the end of this file */
|
||||
#if __STDC__ || defined(__cplusplus) || defined(c_plusplus)
|
||||
/* ANSI || C++ */
|
||||
#define FUNC(f, t, p) extern t f p
|
||||
#define LFUNC(f, t, p) static t f p
|
||||
# define FUNC(f, t, p) extern t f p
|
||||
# define LFUNC(f, t, p) static t f p
|
||||
#else /* k&R */
|
||||
#define FUNC(f, t, p) extern t f()
|
||||
#define LFUNC(f, t, p) static t f()
|
||||
# define FUNC(f, t, p) extern t f()
|
||||
# define LFUNC(f, t, p) static t f()
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -34,10 +34,15 @@
|
||||
|
||||
#include "XpmI.h"
|
||||
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
int XpmWriteFileFromData(char* filename, char** data)
|
||||
#else
|
||||
int
|
||||
XpmWriteFileFromData(filename, data)
|
||||
char *filename;
|
||||
char **data;
|
||||
#endif
|
||||
{
|
||||
XpmImage image;
|
||||
XpmInfo info;
|
||||
|
@ -59,6 +59,16 @@ LFUNC(WriteExtensions, void, (FILE *file, XpmExtension *ext,
|
||||
LFUNC(OpenWriteFile, int, (char *filename, 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
|
||||
XpmWriteFileFromImage(display, filename, image, shapeimage, attributes)
|
||||
Display *display;
|
||||
@ -66,6 +76,7 @@ XpmWriteFileFromImage(display, filename, image, shapeimage, attributes)
|
||||
XImage *image;
|
||||
XImage *shapeimage;
|
||||
XpmAttributes *attributes;
|
||||
#endif
|
||||
{
|
||||
XpmImage xpmimage;
|
||||
XpmInfo info;
|
||||
@ -90,11 +101,20 @@ XpmWriteFileFromImage(display, filename, image, shapeimage, attributes)
|
||||
return (ErrorStatus);
|
||||
}
|
||||
|
||||
#ifdef __OS2__
|
||||
/* Visual Age cannot deal with old, non-ansi, code */
|
||||
int XpmWriteFileFromXpmImage(
|
||||
char* filename
|
||||
, XpmImage* image
|
||||
, XpmInfo* info
|
||||
)
|
||||
#else
|
||||
int
|
||||
XpmWriteFileFromXpmImage(filename, image, info)
|
||||
char *filename;
|
||||
XpmImage *image;
|
||||
XpmInfo *info;
|
||||
#endif
|
||||
{
|
||||
xpmData mdata;
|
||||
char *name, *dot, *s, new_name[BUFSIZ];
|
||||
@ -152,12 +172,23 @@ XpmWriteFileFromXpmImage(filename, image, info)
|
||||
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
|
||||
xpmWriteFile(file, image, name, info)
|
||||
FILE *file;
|
||||
XpmImage *image;
|
||||
char *name;
|
||||
XpmInfo *info;
|
||||
#endif
|
||||
{
|
||||
/* calculation variables */
|
||||
unsigned int cmts, extensions;
|
||||
@ -210,11 +241,21 @@ xpmWriteFile(file, image, name, info)
|
||||
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
|
||||
WriteColors(file, colors, ncolors)
|
||||
FILE *file;
|
||||
XpmColor *colors;
|
||||
unsigned int ncolors;
|
||||
#endif
|
||||
{
|
||||
unsigned int a, key;
|
||||
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
|
||||
WritePixels(file, width, height, cpp, pixels, colors)
|
||||
FILE *file;
|
||||
@ -242,6 +293,7 @@ WritePixels(file, width, height, cpp, pixels, colors)
|
||||
unsigned int cpp;
|
||||
unsigned int *pixels;
|
||||
XpmColor *colors;
|
||||
#endif
|
||||
{
|
||||
char *s, *p, *buf;
|
||||
unsigned int x, y, h;
|
||||
@ -276,11 +328,20 @@ WritePixels(file, width, height, cpp, pixels, colors)
|
||||
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
|
||||
WriteExtensions(file, ext, num)
|
||||
FILE *file;
|
||||
XpmExtension *ext;
|
||||
unsigned int num;
|
||||
#endif
|
||||
{
|
||||
unsigned int x, y, n;
|
||||
char **line;
|
||||
@ -297,10 +358,20 @@ WriteExtensions(file, ext, num)
|
||||
/*
|
||||
* 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
|
||||
OpenWriteFile(filename, mdata)
|
||||
char *filename;
|
||||
xpmData *mdata;
|
||||
#endif
|
||||
{
|
||||
#ifndef NO_ZPIPE
|
||||
char buf[BUFSIZ];
|
||||
@ -341,9 +412,14 @@ OpenWriteFile(filename, mdata)
|
||||
/*
|
||||
* 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
|
||||
xpmDataClose(mdata)
|
||||
xpmData *mdata;
|
||||
#endif
|
||||
{
|
||||
switch (mdata->type) {
|
||||
case XPMFILE:
|
||||
|
@ -298,11 +298,8 @@ typedef struct {
|
||||
|
||||
/* macros for forward declarations of functions with prototypes */
|
||||
#if NeedFunctionPrototypes
|
||||
#define FUNC(f, t, p) extern 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()
|
||||
# define FUNC(f, t, p) extern t f p
|
||||
# define LFUNC(f, t, p) static t f p
|
||||
#endif
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user