#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
#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
// 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
#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
#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
# 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
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
<<
$(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)
# 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
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)
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
..\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)
/*
* 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;
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;
/*
* 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;
/*
* 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;
/*
* 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;
/*
* 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;
* 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);
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;
XImage *image;
XImage *shapeimage;
XpmAttributes *attributes;
+#endif
{
XpmImage xpmimage;
XpmInfo info;
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;
}
ErrorStatus = WriteColors(&ptr, &ptr_size, &used_size,
image->colorTable, image->ncolors, image->cpp);
-
+
if (ErrorStatus != XpmSuccess)
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
WriteColors(dataptr, data_size, used_size, colors, ncolors, cpp)
char **dataptr;
XpmColor *colors;
unsigned int ncolors;
unsigned int cpp;
+#endif
{
char buf[BUFSIZ];
unsigned int a, key, l;
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;
unsigned int cpp;
unsigned int *pixels;
XpmColor *colors;
+#endif
{
char *s = dataptr;
unsigned int x, y, h;
*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;
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;
*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;
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;
XImage *image;
XImage *shapeimage;
XpmAttributes *attributes;
+#endif
{
XpmImage xpmimage;
XpmInfo info;
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;
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;
XpmColor *colors;
unsigned int ncolors;
unsigned int cpp;
+#endif
{
char buf[BUFSIZ];
unsigned int a, key, l;
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;
unsigned int cpp;
unsigned int *pixels;
XpmColor *colors;
+#endif
{
char *s;
unsigned int x, y, h, offset;
*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;
*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;
XpmExtension *ext;
unsigned int num;
unsigned int ext_nlines;
+#endif
{
unsigned int x, y, a, b;
char **line;
# 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
* 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;
/*
* 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
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;
* 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;
}
* 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
* 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,
int ncols;
XpmAllocColorFunc allocColor;
void *closure;
+#endif
{
XColor xcolor;
int status;
*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 {
#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;
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,
unsigned int *nalloc_pixels;
Pixel *used_pixels;
unsigned int *nused_pixels;
+#endif
{
/* variables stored in the XpmAttributes structure */
Visual *visual;
/* 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;
Pixel *pixels;
int n;
void *closure; /* not used */
+#endif
{
return XFreeColors(display, colormap, pixels, n, 0);
}
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)
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;
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 */
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
}
/*
* 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;
unsigned int width;
unsigned int height;
XImage **image_return;
+#endif
{
int bitmap_pad;
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];
}
+#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;
_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;
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 */
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;
* 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;
unsigned int height;
unsigned int *pixelindex;
Pixel *pixels;
+#endif
{
register char *src;
register char *dst;
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;
unsigned int height;
unsigned int *pixelindex;
Pixel *pixels;
+#endif
{
unsigned char *data;
unsigned int *iptr;
* 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;
unsigned int height;
unsigned int *pixelindex;
Pixel *pixels;
+#endif
{
unsigned char *data;
unsigned int *iptr;
* 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;
unsigned int height;
unsigned int *pixelindex;
Pixel *pixels;
+#endif
{
char *data;
unsigned int *iptr;
* 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;
unsigned int height;
unsigned int *pixelindex;
Pixel *pixels;
+#endif
{
if (image->byte_order != image->bitmap_bit_order)
PutImagePixels(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)
Pixmap *pixmap_return;
Pixmap *shapemask_return;
XpmAttributes *attributes;
+#endif
{
XImage *ximage, *shapeimage;
int ErrorStatus;
unsigned char *array;
XImage *tmp_img;
BOOL success = FALSE;
-
+
array = XpmMalloc ((((width+15)>>4)<<4)*sizeof (*array));
if (array != NULL)
{
}
XpmFree (array);
}
-
+
if (!success)
{
for (y = 0; y < height; ++y)
# 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;
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 */
unsigned long pixel;
{
unsigned char *addr;
-
+
addr = &((unsigned char *)ximage->data) [ZINDEX16(x, y, ximage)];
addr[0] = pixel >> 8;
addr[1] = pixel;
unsigned long pixel;
{
unsigned char *addr;
-
+
addr = &((unsigned char *)ximage->data) [ZINDEX16(x, y, ximage)];
addr[1] = pixel >> 8;
addr[0] = 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)
XpmImage *image;
XpmInfo *info;
XpmAttributes *attributes;
+#endif
{
/* variables stored in the XpmAttributes structure */
Visual *visual;
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
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) {
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++)
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
}
#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;
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]);}
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 {
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
}
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
}
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)
XImage **image_return;
XImage **shapeimage_return;
XpmAttributes *attributes;
+#endif
{
XpmImage image;
XpmInfo info;
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;
/*
* 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;
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)
XImage **image_return;
XImage **shapeimage_return;
XpmAttributes *attributes;
+#endif
{
XpmImage image;
XpmInfo info;
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;
/*
* 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;
#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;
/*
* 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];
/*
* 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;
* 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;
/*
* 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;
/*
* 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;
/*
* 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;
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));
*
*/
+#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;
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;
* 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;
* 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;
* 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;
/*
* 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;
/*
* 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);
/*
* 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;
/*
* 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) {
/*
* 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)
/*
* 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) {
* 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;
#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;
/*
* 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:
#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);
}
"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)
unsigned int *width, *height, *ncolors, *cpp;
unsigned int *x_hotspot, *y_hotspot, *hotspot;
unsigned int *extensions;
+#endif
{
unsigned int l;
char buf[BUFSIZ];
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;
unsigned int cpp;
XpmColor **colorTablePtr;
xpmHashTable *hashtable;
+#endif
{
unsigned int key, l, a, b;
unsigned int curkey; /* current color key */
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;
XpmColor *colorTable;
xpmHashTable *hashtable;
unsigned int **pixels;
+#endif
{
unsigned int *iptr, *iptr2;
unsigned int a, x, y;
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;
* 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;
#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;
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)
XImage **image_return;
XImage **shapeimage_return;
XpmAttributes *attributes;
+#endif
{
XpmImage image;
XpmInfo info;
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;
/*
* 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];
/*
* 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:
/* 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) {
#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???
* 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;
}
/* 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;
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 */
}
#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[] =
{
* 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;
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) {
* 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)
XImage *shapeimage;
XpmImage *xpmimage;
XpmAttributes *attributes;
+#endif
{
/* variables stored in the XpmAttributes structure */
unsigned int cpp;
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);
/*
* 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) {
storePixel);
# endif
#else
+
+#ifndef __OS2__
ErrorStatus = MSWGetImagePixels(display, image, width, height, &pmap,
storePixel);
+#endif
+
#endif
if (ErrorStatus != XpmSuccess)
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
ScanTransparentColor(color, cpp, attributes)
XpmColor *color;
unsigned int cpp;
XpmAttributes *attributes;
+#endif
{
char *s;
unsigned int a, b, c;
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;
unsigned int mask;
unsigned int cpp;
XpmAttributes *attributes;
+#endif
{
/* variables stored in the XpmAttributes structure */
Colormap colormap;
#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;
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 */
#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
*
*/
+#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;
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;
* 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;
* 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;
* 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;
unsigned int height;
PixelsMap *pmap;
int (*storeFunc) ();
+#endif
{
unsigned int *iptr;
int x, y;
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)
{
CLEAN_UP (XpmNoMemory)
}
}
-
+
CLEAN_UP (XpmSuccess)
}
# 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;
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);
/* 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);
}
/* 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;
return (r);
}
-static int
+static int
rgbFromHex(char *hex, int *r, int *g, int *b)
{
int len;
}
/* Color related functions */
-int
+int
XParseColor(Display *d, Colormap *cmap, char *name, XColor *color)
{
int r, g, b; /* only 8 bit values used */
}
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;
/* 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)
{
}
return;
}
-int
+int
XFreeColors(Display *d, Colormap cmap,
unsigned long pixels[], int npixels, unsigned long planes)
{
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
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;
}
-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);
}
}
#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
/* 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
#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;
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;
XImage *image;
XImage *shapeimage;
XpmAttributes *attributes;
+#endif
{
XpmImage xpmimage;
XpmInfo info;
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];
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;
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;
}
}
-
+#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;
unsigned int cpp;
unsigned int *pixels;
XpmColor *colors;
+#endif
{
char *s, *p, *buf;
unsigned int x, y, h;
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;
/*
* 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];
/*
* 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:
/* 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