Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.executable/library/motif')
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/.cvsignore2
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/NgCommon.c178
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/NgCommon.h95
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/NgImage.c181
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/NgImage.h37
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/NgImageData.c490
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/NgImageData.h170
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/NgWinBMPFileFormat.c367
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/NgWinBMPFileFormat.h34
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/build.sh134
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/build.xml21
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c266
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c218
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak63
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/make_hpux_PA_RISC.mak66
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/make_hpux_ia64_32.mak66
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/make_linux.mak95
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/make_solaris.mak65
18 files changed, 2548 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/.cvsignore b/bundles/org.eclipse.equinox.executable/library/motif/.cvsignore
new file mode 100644
index 000000000..5535df034
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/.cvsignore
@@ -0,0 +1,2 @@
+*.o
+eclipse
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/NgCommon.c b/bundles/org.eclipse.equinox.executable/library/motif/NgCommon.c
new file mode 100644
index 000000000..89ecdf47b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/NgCommon.c
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include "NgCommon.h"
+
+/* Non-zero = big-endian architecture */
+static BYTE4 hostIsMSB = 0;
+
+/* Store last error msg */
+#define MAX_MSG_SIZE 100
+char errorMsg[MAX_MSG_SIZE];
+
+/* Library initialization */
+void NgInit()
+{
+ BYTE4 result = (BYTE4) 'A';
+
+ /* determine the byte ordering of the host machine */
+ hostIsMSB = (BYTE4) (*((char *) &result) != 'A');
+
+ errorMsg[0] = 0;
+}
+
+/**
+ * Memory allocation routine
+ */
+void *NgMalloc (UBYTE4 size)
+{
+ return malloc (size);
+}
+
+/**
+ * Memory allocation routine
+ */
+void NgFree (void *memblock)
+{
+ if (memblock != NULL)
+ free (memblock);
+}
+
+void NgMemSet (void *dest, UBYTE1 c, BYTE4 count)
+{
+ memset (dest, c, count);
+}
+
+void NgMemCpy (void *dest, void *src, BYTE4 count)
+{
+ memcpy (dest, src, count);
+}
+
+/**
+ * Error Reporting
+ */
+
+ng_err_t NgError (ng_err_t error_type, char* msg) {
+ if (msg != NULL)
+ {
+ /* Store a copy of the last error msg - truncate if necessary */
+ size_t size = strlen (msg);
+ if (size >= MAX_MSG_SIZE) size = MAX_MSG_SIZE - 1;
+ NgMemCpy (errorMsg, msg, size);
+ errorMsg[size] = 0;
+ }
+ return error_type;
+}
+
+const char *NgGetLastErrorMsg()
+{
+ return errorMsg;
+}
+
+/**
+ * Stream manipulation routines
+ */
+ng_err_t NgStreamInit (ng_stream_t *stream, char *fullname)
+{
+ stream->file = fopen (fullname, "rb");
+ stream->size = 0;
+ stream->pos = 0;
+ if (stream->file == NULL) return NgError (ERR_NG, "Can't open file");
+ return ERR_OK;
+}
+
+void NgStreamClose (ng_stream_t *stream)
+{
+ if (stream->file != NULL)
+ {
+ fclose (stream->file);
+ stream->file = NULL;
+ }
+ stream->size = -1;
+}
+
+char NgStreamEof (ng_stream_t *stream)
+{
+ return stream->size == -1;
+}
+
+BYTE4 NgStreamGetPosition (ng_stream_t *stream)
+{
+ return stream->pos;
+}
+
+BYTE4 NgStreamSkip (ng_stream_t *stream, BYTE4 nbr)
+{
+ if (stream->size == -1) return 0;
+ if (fseek (stream->file, nbr, SEEK_CUR))
+ {
+ NgStreamClose (stream);
+ return 0;
+ }
+ stream->pos += nbr;
+ return nbr;
+}
+
+BYTE4 NgStreamRead (ng_stream_t *stream, char *buffer, BYTE4 nbr)
+{
+ size_t cnt;
+ if (stream->size == -1) return 0;
+ cnt = fread (buffer, sizeof (char), nbr, stream->file);
+ if (cnt != nbr)
+ {
+ NgStreamClose (stream);
+ return 0;
+ }
+ stream->pos += nbr;
+ return nbr;
+}
+
+BYTE1 NgIsMSB()
+{
+ return hostIsMSB != 0;
+}
+
+UBYTE2 SystemToLittleEndianUBYTE2 (UBYTE2 value)
+{
+ return hostIsMSB ? ((value&0xFF) << 8)|((value&0xFF00)>>8) : value;
+}
+
+UBYTE4 SystemToLittleEndianUBYTE4 (UBYTE4 value)
+{
+ return hostIsMSB ? ((value&0xFF000000L)>>24)|((value&0xFF0000L)>>8) | ((value&0xFF00L)<<8) | ((value&0xFFL)<<24) : value;
+}
+
+UBYTE2 SystemToBigEndianUBYTE2 (UBYTE2 value)
+{
+ return hostIsMSB ? value : ((value&0xFF) << 8)|((value&0xFF00)>>8);
+}
+
+UBYTE2 LittleEndianToSystemUBYTE2 (UBYTE2 value)
+{
+ return hostIsMSB ? ((value&0xFF) << 8)|((value&0xFF00)>>8) : value;
+}
+
+UBYTE4 LittleEndianToSystemUBYTE4 (UBYTE4 value)
+{
+ return hostIsMSB ? ((value&0xFF000000L)>>24)|((value&0xFF0000L)>>8) | ((value&0xFF00L)<<8) | ((value&0xFFL)<<24) : value;
+}
+
+UBYTE2 BigEndianToSystemUBYTE2 (UBYTE2 value)
+{
+ return hostIsMSB ? value : ((value&0xFF) << 8)|((value&0xFF00)>>8);
+}
+
+UBYTE4 BigEndianToSystemUBYTE4 (UBYTE4 value)
+{
+ return hostIsMSB ? value : ((value&0xFF000000L)>>24)|((value&0xFF0000L)>>8)|((value&0xFF00L)<<8) | ((value&0xFFL)<<24);
+}
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/NgCommon.h b/bundles/org.eclipse.equinox.executable/library/motif/NgCommon.h
new file mode 100644
index 000000000..a4c2589f4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/NgCommon.h
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#ifndef __NG_COMMON_H
+#define __NG_COMMON_H
+
+#include <memory.h>
+#include <stdio.h>
+
+typedef char BYTE1;
+typedef unsigned char UBYTE1;
+typedef short BYTE2;
+typedef unsigned short UBYTE2;
+typedef long BYTE4;
+typedef unsigned long UBYTE4;
+
+/* error reporting */
+#define ERR_OK 1
+#define ERR_SUBSCRIPT_OUT_OF_RANGE -1
+#define ERR_INVALID_BIT_COUNT -2
+#define ERR_NG -4
+
+typedef BYTE4 ng_err_t;
+ng_err_t NgError (ng_err_t error_type, char* msg);
+const char *NgGetLastErrorMsg();
+
+/**
+ * NgInit
+ * Must be called prior to using the image decoders
+ */
+void NgInit();
+
+/* memory management */
+void *NgMalloc (UBYTE4 size);
+void NgFree (void *memblock);
+void NgMemSet (void *dest, UBYTE1 c, BYTE4 count);
+void NgMemCpy (void *dest, void *src, BYTE4 count);
+
+/* stream api */
+typedef struct {
+ FILE *file;
+ BYTE4 size;
+ BYTE4 pos;
+} ng_stream_t;
+
+/**
+ * Init a stream given the path and name of a file
+ * Note. NgStreamClose should be called to release
+ * the related OS resource.
+ */
+ng_err_t NgStreamInit (ng_stream_t *stream, char *fullname);
+
+/**
+ * Close any OS resource managed the given stream.
+ * In particular, close the file if the stream is using one.
+ */
+void NgStreamClose (ng_stream_t *stream);
+
+char NgStreamEof (ng_stream_t *stream);
+
+BYTE4 NgStreamGetPosition (ng_stream_t *stream);
+/**
+ * Skips nbr bytes.
+ * Return nbr if all bytes were skipped.
+ * If nbr bytes can't be skipped, the stream is closed
+ * (NgStreamEof returns 1). 0 is returned.
+ */
+BYTE4 NgStreamSkip (ng_stream_t *stream, BYTE4 nbr);
+/**
+ * Copies nbr bytes to buffer from stream.
+ * Returns nbr if all bytes were copied.
+ * If nbr bytes can't be read, no bytes are copied. The stream
+ * is closed (NgStreamEof returns 1). 0 is returned.
+ */
+BYTE4 NgStreamRead (ng_stream_t *stream, char *buffer, BYTE4 nbr);
+
+/* little/big endian conversion */
+BYTE1 NgIsMSB();
+UBYTE2 SystemToLittleEndianUBYTE2 (UBYTE2);
+UBYTE4 SystemToLittleEndianUBYTE4 (UBYTE4);
+UBYTE2 SystemToBigEndianUBYTE2 (UBYTE2);
+UBYTE2 LittleEndianToSystemUBYTE2 (UBYTE2);
+UBYTE4 LittleEndianToSystemUBYTE4 (UBYTE4);
+UBYTE2 BigEndianToSystemUBYTE2 (UBYTE2);
+UBYTE4 BigEndianToSystemUBYTE4 (UBYTE4);
+
+#endif /* NG_COMMON_H */
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/NgImage.c b/bundles/org.eclipse.equinox.executable/library/motif/NgImage.c
new file mode 100644
index 000000000..04ffbe701
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/NgImage.c
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#include "NgCommon.h"
+#include "NgImageData.h"
+#include "NgImage.h"
+#include "NgWinBMPFileFormat.h"
+
+/**
+ * Return the nbr of entries in the default color palette
+ */
+int getNbrColorsXPalette(Display *xDisplay)
+{
+ Visual *visual = XDefaultVisual (xDisplay, XDefaultScreen(xDisplay));
+ return visual->map_entries;
+}
+
+/**
+ * Return the RGB codes of the default palette
+ * palette: buffer of size numColors * 3, holding the RGB values
+ */
+ng_err_t getXPalette (Display *xDisplay, int numColors, char* palette)
+{
+ XColor color;
+ int i;
+ int index = 0;
+ int colormap = XDefaultColormap (xDisplay, XDefaultScreen(xDisplay));
+ for (i = 0; i < numColors; i++)
+ {
+ color.pixel = i;
+ XQueryColor (xDisplay, colormap, &color);
+ palette[index++] = ((color.red >> 8) & 0xFF);
+ palette[index++] = ((color.green >> 8) & 0xFF);
+ palette[index++] = ((color.blue >> 8) & 0xFF);
+ }
+ return ERR_OK;
+}
+
+/**
+ * Put a device-independent image of any depth into a drawable of the same size,
+ */
+ng_err_t putImage(ng_bitmap_image_t *image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY,
+ Display *xDisplay, Visual *visual, int screenDepth,
+ int drawable)
+{
+
+ XImage *xImagePtr;
+ int bufSize;
+ int destRedMask = 0, destGreenMask = 0, destBlueMask = 0;
+ BYTE1 screenDirect;
+ UBYTE1 *srcData = NgBitmapImageImageData(image);
+ UBYTE4 srcDepth = NgBitmapImageBitCount(image);
+ BYTE4 sbpp, dbpp;
+ GC tempGC;
+ int numColors = 0;
+
+ /* We only support image depth of 24 bits */
+ if (srcDepth != 24) return NgError (ERR_NG, "Error unsupported depth - only support 24 bit");
+ if (screenDepth <= 8)
+ {
+ numColors = getNbrColorsXPalette (xDisplay);
+ if (numColors == 0)
+ return NgError (ERR_NG, "Error pseudo-color mode detected, no colors available");
+ numColors = 1 << XDefaultDepthOfScreen (XDefaultScreenOfDisplay (xDisplay));
+ screenDirect = 0;
+ } else
+ {
+ destRedMask = visual->red_mask;
+ destGreenMask = visual->green_mask;
+ destBlueMask = visual->blue_mask;
+ screenDirect = 1;
+ }
+
+ xImagePtr = XCreateImage(xDisplay, visual, screenDepth, ZPixmap, 0, 0, srcWidth, srcHeight, 32, 0);
+ if (xImagePtr == NULL) return NgError (ERR_NG, "Error XCreateImage failed");
+ bufSize = xImagePtr->bytes_per_line * srcHeight;
+
+ xImagePtr->data = (char*) XtMalloc (bufSize);
+ sbpp = NgBitmapImageBytesPerRow(image);
+ dbpp = xImagePtr->bytes_per_line;
+
+ if (screenDirect)
+ {
+ /* 24 bit source to direct screen destination */
+ NgBitmapImageBlitDirectToDirect(srcData, sbpp, srcWidth, srcHeight,
+ (UBYTE1*)xImagePtr->data, xImagePtr->bits_per_pixel, dbpp, xImagePtr->byte_order,
+ destRedMask, destGreenMask, destBlueMask);
+ } else
+ {
+ /* 24 bit source to palette screen destination */
+ char *palette = (char*) NgMalloc (numColors * 3);
+ getXPalette (xDisplay, numColors, palette);
+ NgBitmapImageBlitDirectToPalette(srcData, sbpp, srcWidth, srcHeight,
+ (UBYTE1*)xImagePtr->data, xImagePtr->bits_per_pixel, dbpp, xImagePtr->byte_order,
+ (UBYTE1*)palette, numColors);
+ NgFree (palette);
+ }
+
+ tempGC = XCreateGC (xDisplay, drawable, 0, NULL);
+ XPutImage(xDisplay, drawable, tempGC, xImagePtr, 0, 0, 0, 0, srcWidth, srcHeight);
+
+ XDestroyImage (xImagePtr);
+ XFreeGC (xDisplay, tempGC);
+ return ERR_OK;
+}
+
+ng_err_t init(ng_bitmap_image_t *image, Display *xDisplay, int screenDepth, int drawable, Pixmap *pixmap)
+{
+ ng_err_t err;
+ int width = (int)NgBitmapImageWidth(image);
+ int height = (int)NgBitmapImageHeight(image);
+
+ Visual *visual = XDefaultVisual(xDisplay, XDefaultScreen(xDisplay));
+ *pixmap = XCreatePixmap(xDisplay, drawable, width, height, screenDepth);
+ if (*pixmap == 0)
+ {
+ return NgError (ERR_NG, "Error XCreatePixmap failed");
+ }
+ err = putImage(image, 0, 0, width, height, 0, 0, xDisplay, visual, screenDepth, *pixmap);
+ if (err != ERR_OK)
+ {
+ XFreePixmap (xDisplay, *pixmap);
+ return NgError (err, "Error putImage failed");
+ }
+
+ return ERR_OK;
+}
+
+/**
+ * loadBMPImage
+ * Create a pixmap representing the given BMP file, for the specified display and screen.
+ *
+ * display: connection to X server
+ * screen: the screen to create the pixmap for
+ * bmpPathname: absolute path and name to the bmp file
+ *
+ * returned value: the pixmap newly created if successful. 0 otherwise.
+ */
+Pixmap loadBMPImage (Display *display, Screen *screen, char *bmpPathname) {
+ Window drawable = XDefaultRootWindow (display);
+ ng_stream_t in;
+ ng_bitmap_image_t image;
+ ng_err_t err = ERR_OK;
+ int screenDepth = XDefaultDepthOfScreen (screen);
+ Pixmap pixmap;
+
+ NgInit();
+
+ if (NgStreamInit (&in, bmpPathname) != ERR_OK)
+ {
+ NgError (ERR_NG, "Error can't open BMP file");
+ return 0;
+ }
+ NgBitmapImageInit (&image);
+ err = NgBmpDecoderReadImage (&in, &image);
+ NgStreamClose (&in);
+
+ if (err != ERR_OK)
+ {
+ NgBitmapImageFree (&image);
+ return 0;
+ }
+
+ err = init (&image, display, screenDepth, drawable, &pixmap);
+ NgBitmapImageFree (&image);
+
+ return err == ERR_OK ? pixmap : 0;
+}
+
+const char *getBMPErrorMessage ()
+{
+ return NgGetLastErrorMsg ();
+}
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/NgImage.h b/bundles/org.eclipse.equinox.executable/library/motif/NgImage.h
new file mode 100644
index 000000000..9f1b1320a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/NgImage.h
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#ifndef __NG_IMAGE_H
+#define __NG_IMAGE_H
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xos.h>
+#include <X11/Intrinsic.h>
+
+/**
+ * loadBMPImage
+ * Create a pixmap representing the given BMP file, for the specified display and screen.
+ *
+ * display: connection to X server
+ * screen: the screen to create the pixmap for
+ * bmpPathname: absolute path and name to the bmp file
+ *
+ * returned value: the pixmap newly created if successful. 0 otherwise.
+ */
+Pixmap loadBMPImage (Display *display, Screen *screen, char *bmpPathname);
+
+/**
+ * Return error message describing why the BMP file could not be displayed
+ */
+const char *getBMPErrorMessage();
+
+#endif /* NG_IMAGE_H */
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/NgImageData.c b/bundles/org.eclipse.equinox.executable/library/motif/NgImageData.c
new file mode 100644
index 000000000..d19f1dc22
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/NgImageData.c
@@ -0,0 +1,490 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#include "NgImageData.h"
+
+static UBYTE4 RoundRow (UBYTE4 width)
+{
+ UBYTE4 result = (width + RowRounding - 1)
+ & ~(RowRounding - 1) ;
+ return result ;
+}
+
+void NgBitmapImageInit (ng_bitmap_image_t *image)
+{
+ NgBitmapImageClearData (image);
+}
+
+void NgBitmapImageFree (ng_bitmap_image_t *image)
+{
+ NgFree (image->color_map);
+ NgFree (image->image_data);
+ NgFree (image->alpha_data);
+}
+
+void NgBitmapImageClearData (ng_bitmap_image_t *image)
+{
+ image->bit_count = 0;
+ image->image_width = 0;
+ image->image_height = 0;
+ image->color_count = 0;
+ image->color_map = NULL;
+ image->image_data = NULL;
+ image->alpha_data = NULL;
+ image->transparent_pixel = -1;
+}
+
+void NgBitmapImageSetSize(ng_bitmap_image_t *image,
+ UBYTE4 color_count,
+ UBYTE4 bits,
+ UBYTE4 width,
+ UBYTE4 height)
+{
+ NgFree (image->color_map);
+ NgFree (image->image_data);
+ NgBitmapImageClearData (image);
+
+ switch (bits)
+ {
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ {
+ UBYTE4 bitsize;
+ UBYTE4 bytecount;
+
+ image->bit_count = bits;
+ image->color_count = color_count;
+ image->image_width = width;
+ image->image_height = height;
+
+ image->color_map = (ng_color_map_entry_t *) NgMalloc (sizeof(ng_color_map_entry_t) * image->color_count);
+ NgMemSet (image->color_map, 0, sizeof (ng_color_map_entry_t) * image->color_count);
+ bitsize = image->bit_count * image->image_width;
+ image->row_width = RoundRow ((bitsize + 7)/8);
+ bytecount = image->row_width * image->image_height;
+ image->image_data = (UBYTE1 *) NgMalloc (bytecount);
+ NgMemSet (image->image_data, 0, (BYTE4)bytecount);
+ }
+ break ;
+ case 16:
+ {
+ image->bit_count = bits;
+ image->color_count = color_count;
+ image->image_width = width;
+ image->image_height = height;
+ image->row_width = RoundRow (2 * image->image_width);
+ image->image_data = (UBYTE1 *) NgMalloc (image->row_width * image->image_height);
+ NgMemSet (image->image_data, 0, image->row_width * image->image_height);
+ }
+ break;
+ case 24:
+ {
+ image->bit_count = bits;
+ image->color_count = color_count;
+ image->image_width = width;
+ image->image_height = height;
+ image->row_width = RoundRow (3 * image->image_width);
+ image->image_data = (UBYTE1 *) NgMalloc (image->row_width * image->image_height);
+ NgMemSet (image->image_data, 0, image->row_width * image->image_height);
+ }
+ break;
+ case 32:
+ {
+ image->bit_count = bits;
+ image->color_count = color_count;
+ image->image_width = width;
+ image->image_height = height;
+ image->row_width = RoundRow (4 * image->image_width);
+ image->image_data = (UBYTE1 *) NgMalloc (image->row_width * image->image_height);
+ NgMemSet (image->image_data, 0, image->row_width * image->image_height);
+ }
+ break ;
+ default:
+ NgError (ERR_INVALID_BIT_COUNT, NULL);
+ }
+}
+
+ng_color_map_entry_t *NgBitmapImageColorMap (ng_bitmap_image_t *image, UBYTE4 index)
+{
+ if (index >= image->color_count)
+ {
+ NgError (ERR_SUBSCRIPT_OUT_OF_RANGE, "Error NgBitmapImageColorMap failed");
+ return NULL;
+ }
+
+ return &image->color_map [index] ;
+}
+
+/* blit constants */
+#define TYPE_INDEX_1_MSB 1
+#define TYPE_INDEX_1_LSB 2
+#define TYPE_INDEX_2 3
+#define TYPE_INDEX_4 4
+#define TYPE_INDEX_8 5
+#define TYPE_GENERIC_24 6
+#define TYPE_GENERIC_8 7
+#define TYPE_GENERIC_16_MSB 8
+#define TYPE_GENERIC_16_LSB 9
+#define TYPE_GENERIC_32_MSB 10
+#define TYPE_GENERIC_32_LSB 11
+
+/**
+ * Computes the required channel shift from a mask.
+ */
+UBYTE4 getChannelShift(UBYTE4 mask)
+{
+ UBYTE4 i;
+ if (mask == 0) return 0;
+ for (i = 0; ((mask & 1) == 0) && (i < 32); ++i)
+ {
+ mask >>= 1;
+ }
+ return i;
+}
+
+/**
+ * Computes the required channel width (depth) from a mask.
+ */
+UBYTE4 getChannelWidth(UBYTE4 mask, UBYTE4 shift)
+{
+ UBYTE4 i;
+ if (mask == 0) return 0;
+ mask >>= shift;
+ for (i = shift; ((mask & 1) != 0) && (i < 32); ++i)
+ {
+ mask >>= 1;
+ }
+ return i - shift;
+}
+
+/**
+ * Blits a direct palette image into a direct palette image.
+ *
+ * srcData the source byte array containing image data
+ * srcStride the source number of bytes per line
+ * srcWidth the width of the source blit region
+ * srcHeight the height of the source blit region
+ * destData the destination byte array containing image data
+ * destDepth the destination depth: one of 8, 16, 24, 32
+ * destStride the destination number of bytes per line
+ * destOrder the destination byte ordering: 0 for LSB, 1 otherwise
+ * ignored if destDepth is not 16 or 32
+ * destRedMask the destination red channel mask
+ * destGreenMask the destination green channel mask
+ * destBlueMask the destination blue channel mask
+ *
+ * It is assumed that.
+ * srcDepth: 24 - BGR ordering (BMP format)
+ * no alpha
+ * srcX: 0
+ * srcY: 0
+ * destX: 0
+ * destY: 0
+ * destWidth: same as srcWidth
+ * destHeight: same as srcHeight
+ */
+void NgBitmapImageBlitDirectToDirect(
+ UBYTE1 *srcData, BYTE4 srcStride,
+ BYTE4 srcWidth, BYTE4 srcHeight,
+ UBYTE1 *destData, BYTE4 destDepth, BYTE4 destStride, BYTE4 destOrder,
+ UBYTE4 destRedMask, UBYTE4 destGreenMask, UBYTE4 destBlueMask)
+{
+ BYTE4 srcX = 0, srcY = 0, destX = 0, destY = 0, destWidth = srcWidth, destHeight = srcHeight;
+
+ BYTE4 sbpp, stype, spr, dbpp, dtype, dpr, dprxi, dpryi, dp, sp, dy, dx;
+ BYTE4 destRedShift, destRedWidth;
+ BYTE4 destRedPreShift, destGreenShift, destGreenWidth, destGreenPreShift;
+ BYTE4 destBlueShift, destBlueWidth, destBluePreShift;
+ UBYTE1 r, g, b;
+ UBYTE4 data;
+
+ /*** Prepare source-related data ***/
+ sbpp = 3;
+ stype = TYPE_GENERIC_24;
+
+ spr = srcY * srcStride + srcX * sbpp;
+
+ /*** Prepare destination-related data ***/
+ switch (destDepth)
+ {
+ case 8:
+ dbpp = 1;
+ dtype = TYPE_GENERIC_8;
+ break;
+ case 16:
+ dbpp = 2;
+ dtype = (destOrder != 0) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB;
+ break;
+ case 24:
+ dbpp = 3;
+ dtype = TYPE_GENERIC_24;
+ break;
+ case 32:
+ dbpp = 4;
+ dtype = (destOrder != 0) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB;
+ break;
+ default:
+ return;
+ }
+
+ dpr = destY * destStride + destX * dbpp;
+ dprxi = dbpp;
+ dpryi = destStride;
+
+ /*** Blit ***/
+ dp = dpr;
+ sp = spr;
+
+ /*** Comprehensive blit (apply transformations) ***/
+ destRedShift = getChannelShift(destRedMask);
+ destRedWidth = getChannelWidth(destRedMask, destRedShift);
+ destRedPreShift = 8 - destRedWidth;
+ destGreenShift = getChannelShift(destGreenMask);
+ destGreenWidth = getChannelWidth(destGreenMask, destGreenShift);
+ destGreenPreShift = 8 - destGreenWidth;
+ destBlueShift = getChannelShift(destBlueMask);
+ destBlueWidth = getChannelWidth(destBlueMask, destBlueShift);
+ destBluePreShift = 8 - destBlueWidth;
+
+ r = 0; g = 0; b = 0;
+ for (dy = destHeight; dy > 0; --dy, sp = spr += srcStride, dp = dpr += dpryi)
+ {
+ for (dx = destWidth; dx > 0; --dx, dp += dprxi)
+ {
+ /*** READ NEXT PIXEL ASSUMING BGR ordering (BMP format) ***/
+ b = srcData[sp];
+ g = srcData[sp + 1];
+ r = srcData[sp + 2];
+ sp += 3;
+ /*** WRITE NEXT PIXEL ***/
+ data =
+ (r >> destRedPreShift << destRedShift) |
+ (g >> destGreenPreShift << destGreenShift) |
+ (b >> destBluePreShift << destBlueShift);
+ switch (dtype)
+ {
+ case TYPE_GENERIC_8:
+ {
+ destData[dp] = (UBYTE1) data;
+ } break;
+ case TYPE_GENERIC_16_MSB:
+ {
+ destData[dp] = (UBYTE1) (data >> 8);
+ destData[dp + 1] = (UBYTE1) (data & 0xff);
+ } break;
+ case TYPE_GENERIC_16_LSB:
+ {
+ destData[dp] = (UBYTE1) (data & 0xff);
+ destData[dp + 1] = (UBYTE1) (data >> 8);
+ } break;
+ case TYPE_GENERIC_24:
+ {
+ destData[dp] = (UBYTE1) (data >> 16);
+ destData[dp + 1] = (UBYTE1) (data >> 8);
+ destData[dp + 2] = (UBYTE1) (data & 0xff);
+ } break;
+ case TYPE_GENERIC_32_MSB:
+ {
+ destData[dp] = (UBYTE1) (data >> 24);
+ destData[dp + 1] = (UBYTE1) (data >> 16);
+ destData[dp + 2] = (UBYTE1) (data >> 8);
+ destData[dp + 3] = (UBYTE1) (data & 0xff);
+ } break;
+ case TYPE_GENERIC_32_LSB:
+ {
+ destData[dp] = (UBYTE1) (data & 0xff);
+ destData[dp + 1] = (UBYTE1) (data >> 8);
+ destData[dp + 2] = (UBYTE1) (data >> 16);
+ destData[dp + 3] = (UBYTE1) (data >> 24);
+ } break;
+ }
+ }
+ }
+}
+
+/**
+ * Create a simple hash table used when converting direct colors to values in a palette
+ * Each bucket stores the RGB codes and the corresponding palette index.
+ * The key is made from the RGB values.
+ * It is used as a cache. New entries colliding with older ones simply
+ * replace them.
+ */
+ng_palette_bucket_t *NgRGBIndexCreate ()
+{
+ ng_palette_bucket_t *table = (ng_palette_bucket_t *)NgMalloc (RGBIndexTableSize * sizeof (ng_palette_bucket_t));
+ NgMemSet (table, 0, RGBIndexTableSize * sizeof (ng_palette_bucket_t));
+ return table;
+}
+
+void NgRGBIndexFree (ng_palette_bucket_t *table)
+{
+ NgFree (table);
+}
+
+void NgRGBIndexSet (ng_palette_bucket_t *table, UBYTE1 r, UBYTE1 g, UBYTE1 b, UBYTE1 index)
+{
+ int i = (r * g * b) % RGBIndexTableSize;
+ table[i].blue = b;
+ table[i].green = g;
+ table[i].red = r;
+ table[i].index = index;
+ table[i].isSet = 1;
+}
+
+int NgRGBIndexGet (ng_palette_bucket_t *table, UBYTE1 r, UBYTE1 g, UBYTE1 b)
+{
+ int i = (r * g * b) % RGBIndexTableSize;
+ if (table[i].isSet && table[i].blue == b && table[i].green == g && table[i].red == r)
+ return table[i].index;
+ return -1;
+}
+
+/**
+ * Blits a direct palette image into an index palette image.
+ *
+ * srcData the source byte array containing image data
+ * srcStride the source number of bytes per line
+ * srcX the top-left x-coord of the source blit region
+ * srcY the top-left y-coord of the source blit region
+ * srcWidth the width of the source blit region
+ * srcHeight the height of the source blit region
+ * destData the destination byte array containing image data
+ * destDepth the destination depth: one of 1, 2, 4, 8
+ * destStride the destination number of bytes per line
+ * destOrder the destination byte ordering: 0 if LSB, 1 otherwise;
+ * ignored if destDepth is not 1
+ * destX the top-left x-coord of the destination blit region
+ * destY the top-left y-coord of the destination blit region
+ * destWidth the width of the destination blit region
+ * destHeight the height of the destination blit region
+ * destColors the destination palette red green blue component intensities
+ * destNumColors the number of colors in destColors
+ *
+ * It is assumed that.
+ * srcDepth: 24 - BGR ordering (BMP format)
+ * no alpha
+ * srcX: 0
+ * srcY: 0
+ * destX: 0
+ * destY: 0
+ * destWidth: same as srcWidth
+ * destHeight: same as srcHeight
+ */
+
+void NgBitmapImageBlitDirectToPalette(
+ UBYTE1 *srcData, BYTE4 srcStride,
+ BYTE4 srcWidth, BYTE4 srcHeight,
+ UBYTE1 *destData, BYTE4 destDepth, BYTE4 destStride, BYTE4 destOrder,
+ UBYTE1 *destColors, int destNumColors)
+{
+ BYTE4 srcX = 0, srcY = 0, destX = 0, destY = 0, destWidth = srcWidth, destHeight = srcHeight;
+ BYTE4 sbpp, spr, dtype, dpr, dp, sp, destPaletteSize, dy, dx, j, dr, dg, db, distance, minDistance;
+
+ UBYTE1 r = 0, g = 0, b = 0, index = 0;
+ int storedIndex;
+ ng_palette_bucket_t *RGBIndexTable;
+
+ /*** Prepare source-related data ***/
+ sbpp = 3;
+ spr = srcY * srcStride + srcX * sbpp;
+
+ /*** Prepare destination-related data ***/
+ switch (destDepth)
+ {
+ case 8:
+ dtype = TYPE_INDEX_8;
+ break;
+ case 4:
+ destStride <<= 1;
+ dtype = TYPE_INDEX_4;
+ break;
+ case 2:
+ destStride <<= 2;
+ dtype = TYPE_INDEX_2;
+ break;
+ case 1:
+ destStride <<= 3;
+ dtype = (destOrder != 0) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB;
+ break;
+ default:
+ return;
+ }
+ dpr = destY * destStride + destX;
+
+ dp = dpr;
+ sp = spr;
+ destPaletteSize = destNumColors;
+
+ RGBIndexTable = NgRGBIndexCreate ();
+ for (dy = destHeight; dy > 0; --dy, sp = spr += srcStride, dp = dpr += destStride)
+ {
+ for (dx = destWidth; dx > 0; --dx, dp += 1)
+ {
+ /*** READ NEXT PIXEL ASSUMING BGR ordering (BMP format) ***/
+ b = srcData[sp];
+ g = srcData[sp+1];
+ r = srcData[sp+2];
+ sp += 3;
+
+ /*** MAP COLOR TO THE PALETTE ***/
+ storedIndex = NgRGBIndexGet (RGBIndexTable, r, g, b);
+ if (storedIndex >= 0)
+ {
+ index = (UBYTE1) storedIndex;
+ } else
+ {
+ for (j = 0, minDistance = 0x7fffffff; j < destPaletteSize; ++j)
+ {
+ dr = (destColors[j*3] & 0xff) - r;
+ dg = (destColors[j*3+1] & 0xff) - g;
+ db = (destColors[j*3+2] & 0xff) - b;
+ distance = dr * dr + dg * dg + db * db;
+ if (distance < minDistance)
+ {
+ index = (UBYTE1)j;
+ if (distance == 0) break;
+ minDistance = distance;
+ }
+ }
+ NgRGBIndexSet (RGBIndexTable, r, g, b, index);
+ }
+
+ /*** WRITE NEXT PIXEL ***/
+ switch (dtype) {
+ case TYPE_INDEX_8:
+ destData[dp] = (UBYTE1) index;
+ break;
+ case TYPE_INDEX_4:
+ if ((dp & 1) != 0) destData[dp >> 1] = ((destData[dp >> 1] & 0xf0) | index);
+ else destData[dp >> 1] = ((destData[dp >> 1] & 0x0f) | (index << 4));
+ break;
+ case TYPE_INDEX_2:
+ {
+ int shift = 6 - (dp & 3) * 2;
+ destData[dp >> 2] = ((destData[dp >> 2] & ~(0x03 << shift)) | (index << shift));
+ } break;
+ case TYPE_INDEX_1_MSB:
+ {
+ int shift = 7 - (dp & 7);
+ destData[dp >> 3] = ((destData[dp >> 3] & ~(0x01 << shift)) | (index << shift));
+ } break;
+ case TYPE_INDEX_1_LSB:
+ {
+ int shift = dp & 7;
+ destData[dp >> 3] = ((destData[dp >> 3] & ~(0x01 << shift)) | (index << shift));
+ } break;
+ }
+ }
+ }
+ NgRGBIndexFree (RGBIndexTable);
+}
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/NgImageData.h b/bundles/org.eclipse.equinox.executable/library/motif/NgImageData.h
new file mode 100644
index 000000000..df3c9013d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/NgImageData.h
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#ifndef __NG_IMAGEDATA_H
+#define __NG_IMAGEDATA_H
+
+/**
+ * Type ng_bitmap_image_t (C version of SWT ImageData)
+ *
+ * Unlike ImageData, ng_bitmap_image_t and all its api are 'internal'.
+ * The api marked 'public' is in the sense that it can be used
+ * by the rest of the native graphic library.
+ */
+
+#include "NgCommon.h"
+
+typedef struct ng_bitmap_image_t ng_bitmap_image_t;
+
+typedef struct {
+ UBYTE1 blue;
+ UBYTE1 green;
+ UBYTE1 red;
+} ng_color_map_entry_t;
+
+/* ImageData in SWT expects RGB not BGR */
+enum { RedOffset=0, GreenOffset=1, BlueOffset=2 };
+
+struct ng_bitmap_image_t {
+ /* Width in bytes of each row */
+ UBYTE4 row_width;
+ /* Number of bits per pixel (depth) 1, 2, 4, 8, 16 or 24 */
+ UBYTE4 bit_count;
+ UBYTE4 image_width;
+ UBYTE4 image_height;
+ /* image data
+ * 24-bit images, 3 bytes per pixel representing RGB values
+ * 32 bit images, 4 bytes per pixel representing RGB values + one wasted byte
+ * 16 bit images, 2 bytes per pixel
+ * rest (1, 2, 4, 8): index into color map
+ */
+ UBYTE1 *image_data;
+ /* alpha data (either NULL or of size image_width*image_height) */
+ UBYTE1 *alpha_data;
+ /* transparent pixel - default is -1 which means no transparent pixel */
+ BYTE4 transparent_pixel;
+ /* number of entries in color map */
+ UBYTE4 color_count;
+ ng_color_map_entry_t *color_map;
+};
+
+/************************************************
+ * Public API ng_bitmap_image_t
+ ************************************************/
+
+/**
+ * Init an image
+ */
+void NgBitmapImageInit (ng_bitmap_image_t *);
+
+/**
+ * Dispose the resources allocated by the image.
+ */
+void NgBitmapImageFree (ng_bitmap_image_t *);
+
+/**
+ * Access start of image data
+ * return: a pointer to an array of UBYTE1 of size image_row * image_width
+ * signature: UBYTE1 *NgBitmapImageImageData (ng_bitmap_image_t *image)
+ */
+#define NgBitmapImageImageData(image) ((image)->image_data)
+
+/**
+ * signature: UBYTE4 NgBitmapImageWidth (ng_bitmap_image_t *image)
+ */
+#define NgBitmapImageWidth(image) ((image)->image_width)
+
+/**
+ * signature: UBYTE4 NgBitmapImageHeight (ng_bitmap_image_t *image)
+ */
+#define NgBitmapImageHeight(image) ((image)->image_height)
+
+/**
+ * signature: UBYTE4 NgBitmapImageBitCount (ng_bitmap_image_t *image)
+ */
+#define NgBitmapImageBitCount(image) ((image)->bit_count)
+
+/**
+ * signature: UBYTE4 NgBitmapImageColorCount (ng_bitmap_image_t *image)
+ */
+#define NgBitmapImageColorCount(image) ((image)->color_count)
+
+/**
+ * Access a row of the image
+ * row: a value which must be between 0 and image_height-1
+ * return: a pointer to the desired row, which is an array of size row_width
+ * signature: UBYTE1 *NgBitmapImageGetRow (ng_bitmap_image_t *image, UBYTE4 row)
+ */
+#define NgBitmapImageGetRow(image, row) (&image->image_data[row * image->row_width])
+
+/**
+ * signature: UBYTE4 NgBitmapImageBytesPerRow (ng_bitmap_image_t *image)
+ */
+#define NgBitmapImageBytesPerRow(image) ((image)->row_width)
+
+/**
+ * Retrieve an entry from the color map
+ * index: a value which must be between 0 and color_count-1
+ */
+ng_color_map_entry_t *NgBitmapImageColorMap (ng_bitmap_image_t *, UBYTE4 index);
+
+/**
+ * Get the value of the transparent pixel
+ * signature: BYTE4 NgBitmapImageGetTransparent (ng_bitmap_image_t *image)
+ */
+#define NgBitmapImageGetTransparent(image) ((image)->transparent_pixel)
+
+/**
+ * Get the alpha data
+ * signature: UBYTE1 *NgBitmapImageGetAlpha (ng_bitmap_image_t* image)
+ */
+#define NgBitmapImageGetAlpha(image) ((image)->alpha_data)
+
+void NgBitmapImageBlitDirectToDirect(
+ UBYTE1 *srcData, BYTE4 srcStride,
+ BYTE4 srcWidth, BYTE4 srcHeight,
+ UBYTE1 *destData, BYTE4 destDepth, BYTE4 destStride, BYTE4 destOrder,
+ UBYTE4 destRedMask, UBYTE4 destGreenMask, UBYTE4 destBlueMask);
+
+/* Size of hash table used in NgBitmapImageBlitDirectToPalette */
+#define RGBIndexTableSize 103
+
+typedef struct {
+ UBYTE1 isSet;
+ UBYTE1 blue;
+ UBYTE1 green;
+ UBYTE1 red;
+ UBYTE1 index;
+} ng_palette_bucket_t;
+
+void NgBitmapImageBlitDirectToPalette(
+ UBYTE1 *srcData, BYTE4 srcStride,
+ BYTE4 srcWidth, BYTE4 srcHeight,
+ UBYTE1 *destData, BYTE4 destDepth, BYTE4 destStride, BYTE4 destOrder,
+ UBYTE1 *destColors, int destNumColors);
+
+/************************************************
+ * Private API ng_bitmap_image_t
+ ************************************************/
+
+/* Number of bytes to round each row to */
+#define RowRounding 4
+
+void NgBitmapImageInitialize (ng_bitmap_image_t *);
+void NgBitmapImageClearData (ng_bitmap_image_t *);
+
+void NgBitmapImageSetSize(ng_bitmap_image_t *,
+ UBYTE4 color_count,
+ UBYTE4 bits,
+ UBYTE4 width,
+ UBYTE4 height);
+
+#endif /* NG_IMAGEDATA_H */
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/NgWinBMPFileFormat.c b/bundles/org.eclipse.equinox.executable/library/motif/NgWinBMPFileFormat.c
new file mode 100644
index 000000000..cf8b77f28
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/NgWinBMPFileFormat.c
@@ -0,0 +1,367 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#include "NgCommon.h"
+#include "NgWinBMPFileFormat.h"
+
+#define BMPHeaderFixedSize 40
+
+BYTE4 decompressRLE4Data(BYTE1 *src, BYTE4 numBytes, BYTE4 stride, BYTE1 *dest, BYTE4 destSize)
+{
+ BYTE4 sp = 0;
+ BYTE4 se = numBytes;
+ BYTE4 dp = 0;
+ BYTE4 de = destSize;
+ BYTE4 x = 0, y = 0;
+ BYTE4 i;
+ while (sp < se)
+ {
+ int len = src[sp] & 0xFF;
+ sp++;
+ if (len == 0)
+ {
+ len = src[sp] & 0xFF;
+ sp++;
+ switch (len)
+ {
+ case 0: /* end of line */
+ y++;
+ x = 0;
+ dp = y * stride;
+ if (dp >= de)
+ return -1;
+ break;
+ case 1: /* end of bitmap */
+ return 1;
+ case 2: /* delta */
+ x += src[sp] & 0xFF;
+ sp++;
+ y += src[sp] & 0xFF;
+ sp++;
+ dp = y * stride + x / 2;
+ if (dp >= de)
+ return -1;
+ break;
+ default: /* absolute mode run */
+ if ((len & 1) != 0) /* odd run lengths not currently supported */
+ return -1;
+ x += len;
+ len = len / 2;
+ if (len > (se - sp))
+ return -1;
+ if (len > (de - dp))
+ return -1;
+ for (i = 0; i < len; i++)
+ {
+ dest[dp] = src[sp];
+ dp++;
+ sp++;
+ }
+ if ((sp & 1) != 0)
+ sp++; /* word align sp? */
+ break;
+ }
+ } else
+ {
+ BYTE1 theByte;
+ if ((len & 1) != 0)
+ return -1;
+ x += len;
+ len = len / 2;
+ theByte = src[sp];
+ sp++;
+ if (len > (de - dp))
+ return -1;
+ for (i = 0; i < len; i++)
+ {
+ dest[dp] = theByte;
+ dp++;
+ }
+ }
+ }
+ return 1;
+}
+
+BYTE4 decompressRLE8Data(BYTE1 *src, BYTE4 numBytes, BYTE4 stride, BYTE1 *dest, BYTE4 destSize)
+{
+ BYTE4 sp = 0;
+ BYTE4 se = numBytes;
+ BYTE4 dp = 0;
+ BYTE4 de = destSize;
+ BYTE4 x = 0, y = 0;
+ BYTE4 i;
+ while (sp < se) {
+ int len = src[sp] & 0xFF;
+ sp++;
+ if (len == 0) {
+ len = src[sp] & 0xFF;
+ sp++;
+ switch (len)
+ {
+ case 0: /* end of line */
+ y++;
+ x = 0;
+ dp = y * stride;
+ if (dp >= de)
+ return -1;
+ break;
+ case 1: /* end of bitmap */
+ return 1;
+ case 2: /* delta */
+ x += src[sp] & 0xFF;
+ sp++;
+ y += src[sp] & 0xFF;
+ sp++;
+ dp = y * stride + x;
+ if (dp >= de)
+ return -1;
+ break;
+ default: /* absolute mode run */
+ if (len > (se - sp))
+ return -1;
+ if (len > (de - dp))
+ return -1;
+ for (i = 0; i < len; i++)
+ {
+ dest[dp] = src[sp];
+ dp++;
+ sp++;
+ }
+ if ((sp & 1) != 0)
+ sp++; /* word align sp? */
+ x += len;
+ break;
+ }
+ } else
+ {
+ BYTE1 theByte = src[sp];
+ sp++;
+ if (len > (de - dp))
+ return -1;
+ for (i = 0; i < len; i++)
+ {
+ dest[dp] = theByte;
+ dp++;
+ }
+ x += len;
+ }
+ }
+ return 1;
+}
+
+ng_err_t decompressData (BYTE1 *src, BYTE4 numBytes, BYTE1 *dest, BYTE4 destSize, BYTE4 stride, BYTE4 cmp)
+{
+ if (cmp == 1)
+ {
+ /* BMP_RLE8_COMPRESSION */
+ if (decompressRLE8Data (src, numBytes, stride, dest, destSize) <= 0)
+ return NgError (ERR_NG, "Error decompressRLE8Data failed");
+ } else if (cmp == 2)
+ {
+ /* BMP_RLE4_COMPRESSION */
+ if (decompressRLE4Data (src, numBytes, stride, dest, destSize) <= 0)
+ return NgError (ERR_NG, "Error decompressRLE4Data failed");
+ } else
+ {
+ return NgError (ERR_NG, "Error decompressData failed - unsupported compression");
+ }
+ return ERR_OK;
+}
+
+void flipScanLines(BYTE1 *data, BYTE4 numBytes, int stride, int height)
+{
+ BYTE4 i1 = 0;
+ BYTE4 i2 = (height - 1) * stride;
+ BYTE4 i, index;
+ for (i = 0; i < height / 2; i++)
+ {
+ for (index = 0; index < stride; index++)
+ {
+ BYTE1 b = data[index + i1];
+ data[index + i1] = data[index + i2];
+ data[index + i2] = b;
+ }
+ i1 += stride;
+ i2 -= stride;
+ }
+}
+
+/**
+ * BmpDecoderReadImage
+ *
+ * Decode the content of a bmp file.
+ *
+ * in : the input stream
+ * image : a pointer to a ng_bitmap_image_t
+ *
+ * return: ERR_OK if the image was correctly built from the input stream
+ * ERR_NG otherwise.
+ */
+ng_err_t NgBmpDecoderReadImage (ng_stream_t *in, ng_bitmap_image_t *image)
+{
+ BYTE4 *fileHeader = (BYTE4*) NgMalloc (5 * sizeof(BYTE4));
+ BYTE1 *infoHeader, *data;
+ BYTE4 width, height, stride, dataSize, cmp, pos;
+ BYTE2 depth;
+ BYTE2 d0;
+
+ NgStreamRead (in, (char *) &d0, sizeof(BYTE2));
+ fileHeader[0] = (BYTE4)LittleEndianToSystemUBYTE2(d0);
+ NgStreamRead (in, (char *) &fileHeader[1], sizeof(BYTE4));
+ fileHeader[1] = LittleEndianToSystemUBYTE4(fileHeader[1]);
+ NgStreamRead (in, (char *) &d0, sizeof(BYTE2));
+ fileHeader[2] = (BYTE4)LittleEndianToSystemUBYTE2(d0);
+ NgStreamRead (in, (char *) &d0, sizeof(BYTE2));
+ fileHeader[3] = (BYTE4)LittleEndianToSystemUBYTE2(d0);
+ NgStreamRead (in, (char *) &fileHeader[4], sizeof(BYTE4));
+ fileHeader[4] = LittleEndianToSystemUBYTE4(fileHeader[4]);
+
+ if (NgStreamEof (in))
+ {
+ NgFree (fileHeader);
+ return NgError (ERR_NG, "Error invalid header file");
+ }
+ if (fileHeader[0] != 0x4D42)
+ {
+ NgFree (fileHeader);
+ return NgError (ERR_NG, "Error not a BMP file");
+ }
+
+ infoHeader = (BYTE1*) NgMalloc (BMPHeaderFixedSize * sizeof (BYTE1));
+ NgStreamRead (in, infoHeader, BMPHeaderFixedSize * sizeof (BYTE1));
+
+ if (NgStreamEof (in))
+ {
+ NgFree (fileHeader);
+ NgFree (infoHeader);
+ return NgError (ERR_NG, "Error invalid info header");
+ }
+
+ NgMemCpy (&width, &infoHeader[4], sizeof (BYTE4));
+ width = LittleEndianToSystemUBYTE4(width);
+
+ NgMemCpy (&height, &infoHeader[8], sizeof (BYTE4));
+ height = LittleEndianToSystemUBYTE4(height);
+
+ NgMemCpy (&depth, &infoHeader[14], sizeof (BYTE2));
+ depth = LittleEndianToSystemUBYTE2(depth);
+
+ stride = (width * depth + 7) / 8;
+ stride = (stride + 3) / 4 * 4; /* Round up to 4 byte multiple */
+
+ if (depth <= 8)
+ {
+ BYTE4 i, index;
+ BYTE1 *colors;
+ BYTE4 numColors;
+ NgMemCpy (&numColors, &infoHeader[32], sizeof (BYTE4));
+ numColors = LittleEndianToSystemUBYTE4(numColors);
+ if (numColors == 0)
+ {
+ BYTE2 value;
+ NgMemCpy (&value, &infoHeader[14], sizeof (BYTE2));
+ value = LittleEndianToSystemUBYTE2(value);
+ numColors = 1 << value;
+ } else
+ {
+ if (numColors > 256)
+ numColors = 256;
+ }
+ colors = (BYTE1*) NgMalloc (numColors * 4);
+ NgStreamRead (in, colors, numColors * 4);
+
+ if (NgStreamEof (in))
+ {
+ NgFree (fileHeader);
+ NgFree (infoHeader);
+ NgFree (colors);
+ return NgError (ERR_NG, "Error invalid palette info");
+ }
+
+ index = 0;
+
+ NgBitmapImageSetSize(image, (UBYTE4)numColors, (UBYTE4)depth,
+ (UBYTE4)width, (UBYTE4)height);
+
+ for (i = 0; i < numColors; i++)
+ {
+ ng_color_map_entry_t *color_map = NgBitmapImageColorMap (image, i);
+ color_map->blue = colors[index++];
+ color_map->green = colors[index++];
+ color_map->red = colors[index++];
+ index++;
+ }
+
+ NgFree (colors);
+ } else
+ {
+ /* direct - 16 and 24 bits */
+ NgBitmapImageSetSize(image, 0, (UBYTE4)depth,
+ (UBYTE4)width, (UBYTE4)height);
+ }
+
+ pos = NgStreamGetPosition (in);
+ if (pos < fileHeader[4])
+ {
+ NgStreamSkip (in, fileHeader[4] - pos);
+ }
+
+ dataSize = height * stride;
+
+ data = (BYTE1*)NgBitmapImageImageData(image);
+ NgMemCpy (&cmp, &infoHeader[16], sizeof (BYTE4));
+ cmp = LittleEndianToSystemUBYTE4(cmp);
+ if (cmp == 0)
+ {
+ /* BMP_NO_COMPRESSION */
+ BYTE4 cnt;
+ cnt = NgStreamRead (in, data, dataSize);
+ if (cnt != dataSize)
+ {
+ NgFree (fileHeader);
+ NgFree (infoHeader);
+ return NgError (ERR_NG, "Error failed reading uncompressed data");
+ }
+ } else
+ {
+ BYTE4 compressedSize;
+ BYTE1 *compressed;
+ BYTE4 cnt;
+ ng_err_t res;
+ NgMemCpy (&compressedSize, &infoHeader[20], sizeof (BYTE4));
+ compressedSize = LittleEndianToSystemUBYTE4(compressedSize);
+ compressed = (BYTE1*) NgMalloc (compressedSize * sizeof (BYTE1));
+ cnt = NgStreamRead (in, compressed, compressedSize);
+ if (cnt != compressedSize)
+ {
+ NgFree (fileHeader);
+ NgFree (infoHeader);
+ NgFree (compressed);
+ return NgError (ERR_NG, "Error failed reading compressed data");
+ }
+ res = decompressData (compressed, compressedSize, data, dataSize, stride, cmp);
+ if (res != ERR_OK)
+ {
+ NgFree (fileHeader);
+ NgFree (infoHeader);
+ NgFree (compressed);
+ return NgError (res, "Error failed data decompression");
+ }
+
+ NgFree (compressed);
+ }
+
+ flipScanLines(data, dataSize, stride, height);
+
+ NgFree (fileHeader);
+ NgFree (infoHeader);
+ return ERR_OK;
+}
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/NgWinBMPFileFormat.h b/bundles/org.eclipse.equinox.executable/library/motif/NgWinBMPFileFormat.h
new file mode 100644
index 000000000..3ff010db1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/NgWinBMPFileFormat.h
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#ifndef __NG_WINBMPFILEFORMAT_H
+#define __NG_WINBMPFILEFORMAT_H
+
+/**
+ * BMP Decoder
+ */
+#include "NgCommon.h"
+#include "NgImageData.h"
+
+/**
+ * BmpDecoderReadImage
+ *
+ * Decode the content of a bmp file.
+ *
+ * in : the input stream
+ * image : a pointer to a ng_bitmap_image_t
+ *
+ * return: ERR_OK if the image was correctly built from the input stream
+ * ERR_NG otherwise.
+ */
+ng_err_t NgBmpDecoderReadImage (ng_stream_t *in, ng_bitmap_image_t *image);
+
+#endif /* __NG_WINBMPFILEFORMAT_H */
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/build.sh b/bundles/org.eclipse.equinox.executable/library/motif/build.sh
new file mode 100644
index 000000000..86ea1eab2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/build.sh
@@ -0,0 +1,134 @@
+#!/bin/sh
+#*******************************************************************************
+# Copyright (c) 2000, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+# Kevin Cornell (Rational Software Corporation)
+# Sumit Sarkar (Hewlett-Packard)
+#*******************************************************************************
+#
+# Usage: sh build.sh [<optional switches>] [clean]
+#
+# where the optional switches are:
+# -output <PROGRAM_OUTPUT> - executable filename ("eclipse")
+# -os <DEFAULT_OS> - default Eclipse "-os" value
+# -arch <DEFAULT_OS_ARCH> - default Eclipse "-arch" value
+# -ws <DEFAULT_WS> - default Eclipse "-ws" value
+#
+#
+# This script can also be invoked with the "clean" argument.
+
+cd `dirname $0`
+
+# Define default values for environment variables used in the makefiles.
+programOutput="eclipse"
+defaultOS=""
+defaultOSArch=""
+defaultWS=""
+makefile=""
+if [ "$OS" = "" ]; then
+ OS=`uname -s`
+fi
+if [ "$MODEL" = "" ]; then
+ MODEL=`uname -m`
+fi
+
+case $OS in
+ "AIX")
+ makefile="make_aix.mak"
+ defaultOS="aix"
+ defaultOSArch="ppc"
+ defaultWS="motif"
+ MOTIF_HOME=/usr
+ OUTPUT_DIR="../../bin/$defaultWS/$defaultOS/$defaultOSArch"
+ ;;
+ "Linux")
+ makefile="make_linux.mak"
+ defaultOS="linux"
+ defaultOSArch="x86"
+ defaultWS="motif"
+ X11_HOME=/usr/X11R6
+ MOTIF_HOME=/bluebird/teamswt/swt-builddir/motif21
+ OUTPUT_DIR="../../bin/$defaultWS/$defaultOS/$defaultOSArch"
+ ;;
+ "SunOS")
+ makefile="make_solaris.mak"
+ defaultOS="solaris"
+ defaultOSArch="sparc"
+ defaultWS="motif"
+ OS="Solaris"
+ X11_HOME=/usr/openwin
+ MOTIF_HOME=/usr/dt
+ OUTPUT_DIR="../../bin/$defaultWS/$defaultOS/$defaultOSArch"
+ ;;
+ "HP-UX")
+ X11_HOME=/usr
+ MOTIF_HOME=/usr
+ case $MODEL in
+ "ia64")
+ makefile="make_hpux_ia64_32.mak"
+ defaultOS="hpux"
+ defaultOSArch="ia64_32"
+ defaultWS="motif"
+ OUTPUT_DIR="../../bin/$defaultWS/$defaultOS/$defaultOSArch"
+ ;;
+ *)
+ makefile="make_hpux_PA_RISC.mak"
+ defaultOS="hpux"
+ defaultOSArch="PA_RISC"
+ defaultWS="motif"
+ OUTPUT_DIR="../../bin/$defaultWS/$defaultOS/$defaultOSArch"
+ ;;
+ esac
+ ;;
+ *)
+ echo "Unknown OS -- build aborted"
+ ;;
+esac
+
+# Parse the command line arguments and override the default values.
+extraArgs=""
+while [ "$1" != "" ]; do
+ if [ "$1" = "-os" ] && [ "$2" != "" ]; then
+ defaultOS="$2"
+ shift
+ elif [ "$1" = "-arch" ] && [ "$2" != "" ]; then
+ defaultOSArch="$2"
+ shift
+ elif [ "$1" = "-ws" ] && [ "$2" != "" ]; then
+ defaultWS="$2"
+ shift
+ elif [ "$1" = "-output" ] && [ "$2" != "" ]; then
+ programOutput="$2"
+ shift
+ else
+ extraArgs="$extraArgs $1"
+ fi
+ shift
+done
+
+# Set up environment variables needed by the makefiles.
+PROGRAM_OUTPUT="$programOutput"
+DEFAULT_OS="$defaultOS"
+DEFAULT_OS_ARCH="$defaultOSArch"
+DEFAULT_WS="$defaultWS"
+
+export OUTPUT_DIR PROGRAM_OUTPUT DEFAULT_OS DEFAULT_OS_ARCH DEFAULT_WS X11_HOME MOTIF_HOME
+
+# If the OS is supported (a makefile exists)
+if [ "$makefile" != "" ]; then
+ if [ "$extraArgs" != "" ]; then
+ make -f $makefile $extraArgs
+ else
+ echo "Building $OS launcher. Defaults: -os $DEFAULT_OS -arch $DEFAULT_OS_ARCH -ws $DEFAULT_WS"
+ make -f $makefile clean
+ make -f $makefile all
+ fi
+else
+ echo "Unknown OS ($OS) -- build aborted"
+fi
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/build.xml b/bundles/org.eclipse.equinox.executable/library/motif/build.xml
new file mode 100644
index 000000000..b4308a9a2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/build.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project default="build_eclipse" basedir=".">
+
+<target name="build_eclipse">
+ <exec dir="." executable="sh">
+ <arg line="${basedir}/build.sh"/>
+ <arg line="install"/>
+ </exec>
+ <eclipse.refreshLocal resource="platform-launcher" depth="infinite" />
+</target>
+
+<target name="clean">
+ <tstamp/>
+ <exec dir="." executable="sh">
+ <arg line="${basedir}/build.sh"/>
+ <arg line="clean"/>
+ </exec>
+</target>
+
+</project> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c
new file mode 100644
index 000000000..69aebdf1f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c
@@ -0,0 +1,266 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Kevin Cornell (Rational Software Corporation)
+ *******************************************************************************/
+
+
+/* UNIX/Motif specific logic for displaying the splash screen. */
+#include "eclipseCommon.h"
+#include "eclipseMozilla.h"
+#include "eclipseOS.h"
+#include "eclipseUtil.h"
+#include "NgImage.h"
+
+#include <Xm/XmAll.h>
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/IntrinsicP.h>
+#include <X11/Intrinsic.h>
+#include <X11/Shell.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <sys/ioctl.h>
+#ifdef SOLARIS
+#include <sys/filio.h>
+#endif
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include <locale.h>
+#include <stdlib.h>
+
+/* Global Variables */
+char* consoleVM = "java";
+char* defaultVM = "java";
+char* shippedVMDir = "jre/bin/";
+
+/* Define the special arguments for the various Java VMs. */
+static char* argVM_JAVA[] = { NULL };
+#if AIX
+static char* argVM_JAVA_AIX131[] = { "-Xquickstart", NULL };
+#endif
+static char* argVM_J9[] = { "-jit", "-mca:1024", "-mco:1024", "-mn:256", "-mo:4096",
+ "-moi:16384", "-mx:262144", "-ms:16", "-mr:16", NULL };
+
+
+/* Define local variables for the main window. */
+extern XtAppContext appContext;
+extern Widget topWindow;
+
+/* Define local variables for handling the splash window and its image. */
+static Widget shellHandle = 0;
+
+extern void centreShell( Widget widget, Widget expose );
+
+
+#ifdef NETSCAPE_FIX
+static void fixEnvForNetscape();
+#endif /* NETSCAPE_FIX */
+
+/* Show the Splash Window
+ *
+ * Create the splash window, load the pixmap and display the splash window.
+ */
+int showSplash( const char* featureImage )
+{
+ int argc [] = {0};
+ int x, y;
+ unsigned int width, height, depth, border;
+ ArgList args;
+ unsigned int nArgs;
+ Pixmap splashPixmap = 0;
+ Window root;
+ Display *xDisplay;
+ Screen* screen;
+ Widget scrolledHandle, drawingHandle, image;
+
+ initWindowSystem(&initialArgc, initialArgv, 1);
+
+ xDisplay = XtOpenDisplay(appContext, NULL, NULL, NULL, 0, 0, argc, 0);
+ screen = XDefaultScreenOfDisplay( xDisplay );
+ if (featureImage != NULL)
+ {
+ splashPixmap = loadBMPImage(xDisplay, screen, (char*)featureImage);
+ }
+ /* If the splash image could not be found, return an error. */
+ if (splashPixmap == 0)
+ return ENOENT;
+
+ XGetGeometry (xDisplay, splashPixmap, &root, &x, &y, &width, &height, &border, &depth);
+
+ /* make sure we never pass more than 20 args */
+ args = malloc(10 * sizeof(Arg));
+
+ nArgs = 0;
+ /* Note that XtSetArg is a macro, and the 1st argument will be evaluated twice
+ * so increment nArgs on its own */
+ XtSetArg(args[nArgs], XmNmwmDecorations, 0); nArgs++;
+ XtSetArg(args[nArgs], XmNtitle, officialName); nArgs++;
+ XtSetArg(args[nArgs], XmNwidth, width); nArgs++;
+ XtSetArg(args[nArgs], XmNheight, height); nArgs++;
+ shellHandle = XtAppCreateShell(officialName, "", applicationShellWidgetClass, xDisplay, args, nArgs);
+
+ nArgs = 0;
+ XtSetArg(args[nArgs++], XmNancestorSensitive, 1);
+ scrolledHandle = XmCreateMainWindow(shellHandle, NULL, args, nArgs);
+ if(scrolledHandle == 0)
+ return -1;
+ XtManageChild(scrolledHandle);
+
+ nArgs = 0;
+ XtSetArg(args[nArgs], XmNancestorSensitive, 1); nArgs++;
+ XtSetArg(args[nArgs], XmNborderWidth, 0); nArgs++;
+ XtSetArg(args[nArgs], XmNbackground, 0xFF00FF); nArgs++;
+ XtSetArg(args[nArgs], XmNmarginWidth, 0); nArgs++;
+ XtSetArg(args[nArgs], XmNmarginHeight, 0); nArgs++;
+ XtSetArg(args[nArgs], XmNresizePolicy, XmRESIZE_NONE); nArgs++;
+ XtSetArg(args[nArgs], XmNtraversalOn, 1); nArgs++;
+ drawingHandle = XmCreateDrawingArea(scrolledHandle, NULL, args, nArgs);
+ if(drawingHandle == 0)
+ return -1;
+ XtManageChild(drawingHandle);
+
+ nArgs = 0;
+ XtSetArg(args[nArgs], XmNlabelType, XmPIXMAP); nArgs++;
+ XtSetArg(args[nArgs], XmNlabelPixmap, splashPixmap);nArgs++;
+ XtSetArg(args[nArgs], XmNwidth, width); nArgs++;
+ XtSetArg(args[nArgs], XmNheight, height); nArgs++;
+ XtSetArg(args[nArgs], XmNmarginWidth, 0); nArgs++;
+ XtSetArg(args[nArgs], XmNmarginHeight, 0); nArgs++;
+ image = XmCreateLabelGadget ( drawingHandle, "", args, nArgs );
+ XtManageChild( image );
+
+ XtRealizeWidget(shellHandle);
+ XtSetMappedWhenManaged(shellHandle, 1);
+
+ if(XtIsTopLevelShell(shellHandle))
+ XtMapWidget(shellHandle);
+ else
+ XtPopup(shellHandle, XtGrabNone);
+
+ /* Centre the splash screen and display it. */
+ centreShell( shellHandle, drawingHandle );
+ dispatchMessages();
+
+ free(args);
+ return 0;
+}
+
+/* Get the window system specific VM arguments */
+char** getArgVM( char* vm )
+{
+ char** result;
+
+#ifdef AIX
+ char* version;
+#endif
+
+ if (isJ9VM( vm ))
+ return argVM_J9;
+
+ /* Use the default arguments for a standard Java VM */
+ result = argVM_JAVA;
+
+#ifdef AIX
+ /* Determine whether Java version is 1.3.1 or later */
+ version = getVMVersion( vm );
+ if (version != NULL)
+ {
+ if (versionCmp(version, "1.3.1") >= 0)
+ result = argVM_JAVA_AIX131;
+ free(version);
+ }
+#endif
+
+ return result;
+}
+
+
+long getSplashHandle() {
+ return (long)shellHandle;
+}
+
+void dispatchMessages() {
+ XtInputMask mask;
+ /* Process any outstanding messages */
+ while ((mask = XtAppPending(appContext)) != 0) {
+ XtAppProcessEvent(appContext, mask);
+ }
+}
+
+void takeDownSplash()
+{
+ if (shellHandle != 0)
+ {
+ XtUnrealizeWidget( shellHandle );
+ XFlush( XtDisplay( shellHandle ) );
+ }
+}
+
+#ifdef NETSCAPE_FIX
+extern char* findCommand( char*);
+static const char* XFILESEARCHPATH = "XFILESEARCHPATH";
+
+static void fixEnvForNetscape()
+{
+ char* netscapePath = NULL;
+ char* netscapeResource = NULL;
+ char* ch;
+ char* envValue;
+ struct stat stats;
+
+ /* If netscape appears to be installed */
+ netscapePath = findCommand("netscape");
+ if (netscapePath != NULL)
+ {
+ /* Look for the resource file Netscape.ad in the same directory as "netscape". */
+ netscapeResource = malloc( strlen(netscapePath) + 50 );
+ strcpy( netscapeResource, netscapePath );
+ ch = strrchr( netscapeResource, (int) dirSeparator );
+ ch =(ch == NULL ? netscapeResource : (ch+1));
+ strcpy( ch, "Netscape.ad" );
+
+ /* If it does not exist there, try "/opt/netscape/Netscape.ad". */
+ if (stat( netscapeResource, &stats ) != 0)
+ {
+ strcpy( netscapeResource, "/opt/netscape/Netscape.ad" );
+ }
+
+ /* If the resource file exists */
+ if (stat( netscapeResource, &stats ) == 0 && (stats.st_mode & S_IFREG) != 0)
+ {
+ /* Either define XFILESEARCHPATH or append the Netscape resource file. */
+ envValue = getenv( XFILESEARCHPATH );
+ if (envValue == NULL)
+ {
+ ch = malloc( strlen(XFILESEARCHPATH) + strlen(netscapeResource) + 5 );
+ sprintf( ch, "%s=%s", XFILESEARCHPATH, netscapeResource );
+ }
+ else
+ {
+ ch = malloc( strlen(XFILESEARCHPATH) + strlen(netscapeResource) +
+ strlen(envValue) + 5 );
+ sprintf( ch, "%s=%s:%s", XFILESEARCHPATH, envValue, netscapeResource );
+ }
+ putenv( ch );
+ free( ch );
+ }
+
+ /* Clean up. */
+ free( netscapePath );
+ free( netscapeResource );
+ }
+
+}
+#endif /* NETSCAPE_FIX */
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c
new file mode 100644
index 000000000..3442ac985
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Andrew Niefer
+ *******************************************************************************/
+
+#include "eclipseCommon.h"
+#include "eclipseOS.h"
+
+#include <locale.h>
+#include <dlfcn.h>
+#include <stdlib.h>
+#include <Xm/XmAll.h>
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/IntrinsicP.h>
+#include <X11/Intrinsic.h>
+#include <X11/Shell.h>
+
+#ifndef NO_XINERAMA_EXTENSIONS
+#include <X11/extensions/Xinerama.h>
+#endif
+
+#define ECLIPSE_ICON 401
+
+char dirSeparator = '/';
+char pathSeparator = ':';
+
+void centreShell( Widget widget, Widget expose );
+void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash );
+
+/* Global Variables */
+XtAppContext appContext = 0;
+Widget topWindow = 0;
+
+/* Define local variables for the main window. */
+static int saveArgc = 0; /* arguments after they were parsed, for window system */
+static char** saveArgv = 0;
+
+int motifInitialized = 0;
+
+/* Display a Message */
+void displayMessage( char* title, char* message )
+{
+ char* displayName = NULL;
+ Widget msgBox = NULL;
+ XmString msg;
+ Arg arg[20];
+ int nArgs;
+ XEvent event;
+
+ /* If there is no associated display, just print the error and return. */
+ displayName = getenv("DISPLAY");
+ if (displayName == NULL || strlen(displayName) == 0)
+ {
+ printf( "%s: %s\n", title, message );
+ return;
+ }
+
+ /* If Xt has not been initialized yet, do it now. */
+ if (topWindow == 0)
+ {
+ initWindowSystem( &saveArgc, saveArgv, 1 );
+ }
+
+ msg = XmStringGenerate( message, NULL, XmCHARSET_TEXT, NULL );
+
+ /* Output a simple message box. */
+ nArgs = 0;
+ XtSetArg( arg[ nArgs ], XmNdialogType, XmDIALOG_MESSAGE ); nArgs++;
+ XtSetArg( arg[ nArgs ], XmNtitle, title ); nArgs++;
+ XtSetArg( arg[ nArgs ], XmNmessageString, msg ); nArgs++;
+ msgBox = XmCreateMessageDialog( topWindow, officialName, arg, nArgs );
+ XtUnmanageChild( XmMessageBoxGetChild( msgBox, XmDIALOG_CANCEL_BUTTON ) );
+ XtUnmanageChild( XmMessageBoxGetChild( msgBox, XmDIALOG_HELP_BUTTON ) );
+ XtManageChild( msgBox );
+ centreShell( msgBox, msgBox );
+ if (msg != 0) XmStringFree (msg);
+
+ /* Wait for the OK button to be pressed. */
+ while (XtIsRealized( msgBox ) && XtIsManaged( msgBox ))
+ {
+ XtAppNextEvent( appContext, &event );
+ XtDispatchEvent( &event );
+ }
+ XtDestroyWidget( msgBox );
+}
+
+/* Initialize Window System
+ *
+ * Initialize the Xt and Xlib.
+ */
+void initWindowSystem( int* pArgc, char* argv[], int showSplash )
+{
+ Arg arg[20];
+
+ if(motifInitialized == 1)
+ return;
+ /* Save the arguments in case displayMessage() is called in the main launcher. */
+ if (saveArgv == 0)
+ {
+ saveArgc = *pArgc;
+ saveArgv = argv;
+ }
+
+ /* Create the top level shell that will not be used other than
+ to initialize the application. */
+ XtSetLanguageProc (NULL, NULL, NULL);
+ topWindow = XtAppInitialize( &appContext, officialName, NULL, 0,
+ pArgc, argv, NULL, NULL, 0 );
+ XtSetArg( arg[ 0 ], XmNmappedWhenManaged, False );
+ XtSetValues( topWindow, arg, 1 );
+ XtRealizeWidget( topWindow );
+ motifInitialized = 1;
+}
+
+/* Centre the shell on the screen. */
+void centreShell( Widget widget, Widget expose )
+{
+ XtAppContext context;
+ XEvent event;
+ Arg arg[20];
+ int nArgs;
+ Position x, y;
+ Dimension width, height;
+ Screen* screen;
+ int waiting;
+ short screenWidth, screenHeight;
+
+#ifndef NO_XINERAMA_EXTENSIONS
+ Display* display;
+ int monitorCount;
+ XineramaScreenInfo* info;
+#endif
+
+ /* Realize the shell to calculate its width/height. */
+ XtRealizeWidget( widget );
+
+ /* Get the desired dimensions of the shell. */
+ nArgs = 0;
+ XtSetArg( arg[ nArgs ], XmNwidth, &width ); nArgs++;
+ XtSetArg( arg[ nArgs ], XmNheight, &height ); nArgs++;
+ XtSetArg( arg[ nArgs ], XmNscreen, &screen ); nArgs++;
+ XtGetValues( widget, arg, nArgs );
+
+ screenWidth = screen->width;
+ screenHeight = screen->height;
+#ifndef NO_XINERAMA_EXTENSIONS
+ display = XtDisplay( widget );
+ if (XineramaIsActive( display )) {
+ info = XineramaQueryScreens( display, &monitorCount );
+ if (info != 0) {
+ if (monitorCount > 1) {
+ screenWidth = info->width;
+ screenHeight = info->height;
+ }
+ XFree (info);
+ }
+ }
+#endif
+
+ /* Calculate the X and Y position for the shell. */
+ x = (screenWidth - width) / 2;
+ y = (screenHeight - height) / 2;
+
+ /* Set the new shell position and display it. */
+ nArgs = 0;
+ XtSetArg( arg[ nArgs ], XmNx, x ); nArgs++;
+ XtSetArg( arg[ nArgs ], XmNy, y ); nArgs++;
+ XtSetValues( widget, arg, nArgs );
+ XtMapWidget( widget );
+
+ /* Wait for an expose event on the desired widget. This wait loop is required when
+ * the startVM command fails and the message box is created before the splash
+ * window is displayed. Without this wait, the message box sometimes appears
+ * under the splash window and the user cannot see it.
+ */
+ context = XtWidgetToApplicationContext( widget );
+ waiting = True;
+ while (waiting)
+ {
+ XtAppNextEvent( context, &event );
+ if (event.xany.type == Expose && event.xany.window == XtWindow( expose ))
+ {
+ waiting = False;
+ }
+ XtDispatchEvent( &event );
+ }
+ XFlush( XtDisplay( widget ) );
+}
+
+/* Load the specified shared library
+ */
+void * loadLibrary( char * library ){
+ void * result= dlopen(library, RTLD_LAZY);
+ if(result == 0)
+ printf("%s\n",dlerror());
+ return result;
+}
+
+/* Unload the shared library
+ */
+void unloadLibrary( void * handle ){
+ dlclose(handle);
+}
+
+/* Find the given symbol in the shared library
+ */
+void * findSymbol( void * handle, char * symbol ){
+ return dlsym(handle, symbol);
+}
+
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak b/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak
new file mode 100644
index 000000000..592731b81
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak
@@ -0,0 +1,63 @@
+#*******************************************************************************
+# Copyright (c) 2000, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+# Kevin Cornell (Rational Software Corporation)
+#*******************************************************************************
+
+# Makefile for creating the AIX/Motif eclipse launcher program.
+
+# This makefile expects the following environment variables set:
+#
+# PROGRAM_OUTPUT - the filename of the output executable
+# DEFAULT_OS - the default value of the "-os" switch
+# DEFAULT_OS_ARCH - the default value of the "-arch" switch
+# DEFAULT_WS - the default value of the "-ws" switch
+# X11_HOME - the full path to X11 header files
+# MOTIF_HOME - the full path to Motif header files
+
+# Define the object modules to be compiled and flags.
+OBJS = eclipse.o eclipseUtil.o eclipseShm.o eclipseConfig.o eclipseMotif.o NgCommon.o NgImage.o NgImageData.o NgWinBMPFileFormat.o
+EXEC = $(PROGRAM_OUTPUT)
+LIBS = -L$(MOTIF_HOME)/lib -lXm -lXt -lX11
+CFLAGS = -O -s \
+ -DNO_XINERAMA_EXTENSIONS \
+ -DDEFAULT_OS="\"$(DEFAULT_OS)\"" \
+ -DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \
+ -DDEFAULT_WS="\"$(DEFAULT_WS)\"" \
+ -DAIX \
+ -I./ \
+ -I../ \
+ -I$(MOTIF_HOME)/include
+
+all: $(EXEC)
+
+.c.o:
+ $(CC) $(CFLAGS) -c $< -o $@
+
+eclipse.o: ../eclipse.c ../eclipseOS.h
+ $(CC) $(CFLAGS) -c $< -o $@
+
+eclipseUtil.o: ../eclipseUtil.c ../eclipseUtil.h ../eclipseOS.h
+ $(CC) $(CFLAGS) -c $< -o $@
+
+eclipseShm.o: ../eclipseShm.c ../eclipseShm.h ../eclipseOS.h
+ $(CC) $(CFLAGS) -c $< -o $@
+
+eclipseConfig.o: ../eclipseConfig.c ../eclipseConfig.h ../eclipseOS.h
+ $(CC) $(CFLAGS) -c $< -o $@
+
+$(EXEC): $(OBJS)
+ $(CC) -o $(EXEC) $(OBJS) $(LIBS)
+
+install: all
+ cp $(EXEC) $(OUTPUT_DIR)
+ rm -f $(EXEC) $(OBJS)
+
+clean:
+ rm -f $(EXEC) $(OBJS)
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/make_hpux_PA_RISC.mak b/bundles/org.eclipse.equinox.executable/library/motif/make_hpux_PA_RISC.mak
new file mode 100644
index 000000000..d43f88416
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/make_hpux_PA_RISC.mak
@@ -0,0 +1,66 @@
+#*******************************************************************************
+# Copyright (c) 2000, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+# Kevin Cornell (Rational Software Corporation)
+#*******************************************************************************
+
+# Makefile for creating the HPUX/Motif eclipse launcher program.
+
+# This makefile expects the following environment variables set:
+#
+# PROGRAM_OUTPUT - the filename of the output executable
+# DEFAULT_OS - the default value of the "-os" switch
+# DEFAULT_OS_ARCH - the default value of the "-arch" switch
+# DEFAULT_WS - the default value of the "-ws" switch
+# X11_HOME - the full path to X11 header files
+# MOTIF_HOME - the full path to Motif header files
+
+# Define the object modules to be compiled and flags.
+OBJS = eclipse.o eclipseUtil.o eclipseShm.o eclipseConfig.o eclipseMotif.o NgCommon.o NgImage.o NgImageData.o NgWinBMPFileFormat.o
+EXEC = $(PROGRAM_OUTPUT)
+LIBS = -L$(MOTIF_HOME)/lib -L$(X11_HOME)/lib -lXm -lXt -lX11
+CFLAGS = -O -s \
+ -DNO_XINERAMA_EXTENSIONS \
+ -DNETSCAPE_FIX \
+ -DDEFAULT_OS="\"$(DEFAULT_OS)\"" \
+ -DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \
+ -DDEFAULT_WS="\"$(DEFAULT_WS)\"" \
+ +Z \
+ -I./ \
+ -I../ \
+ -I$(MOTIF_HOME)/include \
+ -I$(X11_HOME)/include \
+ +DAportable
+
+all: $(EXEC)
+
+.c.o:
+ $(CC) $(CFLAGS) -c $< -o $@
+
+eclipse.o: ../eclipse.c ../eclipseOS.h
+ $(CC) $(CFLAGS) -c ../eclipse.c -o $@
+
+eclipseUtil.o: ../eclipseUtil.c ../eclipseUtil.h ../eclipseOS.h
+ $(CC) $(CFLAGS) -c ../eclipseUtil.c -o $@
+
+eclipseShm.o: ../eclipseShm.c ../eclipseShm.h ../eclipseOS.h
+ $(CC) $(CFLAGS) -c ../eclipseShm.c -o $@
+
+eclipseConfig.o: ../eclipseConfig.c ../eclipseConfig.h ../eclipseOS.h
+ $(CC) $(CFLAGS) -c ../eclipseConfig.c -o $@
+
+$(EXEC): $(OBJS)
+ $(CC) -o $(EXEC) $(OBJS) $(LIBS)
+
+install: all
+ cp $(EXEC) $(OUTPUT_DIR)
+ rm -f $(EXEC) $(OBJS)
+
+clean:
+ rm -f $(EXEC) $(OBJS)
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/make_hpux_ia64_32.mak b/bundles/org.eclipse.equinox.executable/library/motif/make_hpux_ia64_32.mak
new file mode 100644
index 000000000..64b701298
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/make_hpux_ia64_32.mak
@@ -0,0 +1,66 @@
+#*******************************************************************************
+# Copyright (c) 2000, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+# Kevin Cornell (Rational Software Corporation)
+# Sumit Sarkar (Hewlett-Packard)
+#*******************************************************************************
+
+# Makefile for creating the HPUX/Motif eclipse launcher program.
+
+# This makefile expects the following environment variables set:
+#
+# PROGRAM_OUTPUT - the filename of the output executable
+# DEFAULT_OS - the default value of the "-os" switch
+# DEFAULT_OS_ARCH - the default value of the "-arch" switch
+# DEFAULT_WS - the default value of the "-ws" switch
+# X11_HOME - the full path to X11 header files
+# MOTIF_HOME - the full path to Motif header files
+
+# Define the object modules to be compiled and flags.
+OBJS = eclipse.o eclipseUtil.o eclipseShm.o eclipseConfig.o eclipseMotif.o NgCommon.o NgImage.o NgImageData.o NgWinBMPFileFormat.o
+EXEC = $(PROGRAM_OUTPUT)
+LIBS = -L$(MOTIF_HOME)/lib -L$(X11_HOME)/lib -lXm -lXt -lX11
+CFLAGS = -O -s \
+ -DNO_XINERAMA_EXTENSIONS \
+ -DNETSCAPE_FIX \
+ -DDEFAULT_OS="\"$(DEFAULT_OS)\"" \
+ -DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \
+ -DDEFAULT_WS="\"$(DEFAULT_WS)\"" \
+ +Z \
+ -I./ \
+ -I../ \
+ -I$(MOTIF_HOME)/include \
+ -I$(X11_HOME)/include
+
+all: $(EXEC)
+
+.c.o:
+ $(CC) $(CFLAGS) -c $< -o $@
+
+eclipse.o: ../eclipse.c ../eclipseOS.h
+ $(CC) $(CFLAGS) -c ../eclipse.c -o $@
+
+eclipseUtil.o: ../eclipseUtil.c ../eclipseUtil.h ../eclipseOS.h
+ $(CC) $(CFLAGS) -c ../eclipseUtil.c -o $@
+
+eclipseShm.o: ../eclipseShm.c ../eclipseShm.h ../eclipseOS.h
+ $(CC) $(CFLAGS) -c ../eclipseShm.c -o $@
+
+eclipseConfig.o: ../eclipseConfig.c ../eclipseConfig.h ../eclipseOS.h
+ $(CC) $(CFLAGS) -c ../eclipseConfig.c -o $@
+
+$(EXEC): $(OBJS)
+ $(CC) -o $(EXEC) $(OBJS) $(LIBS)
+
+install: all
+ cp $(EXEC) $(OUTPUT_DIR)
+ rm -f $(EXEC) $(OBJS)
+
+clean:
+ rm -f $(EXEC) $(OBJS)
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/make_linux.mak b/bundles/org.eclipse.equinox.executable/library/motif/make_linux.mak
new file mode 100644
index 000000000..990c7f1dd
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/make_linux.mak
@@ -0,0 +1,95 @@
+#*******************************************************************************
+# Copyright (c) 2000, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+# Kevin Cornell (Rational Software Corporation)
+#*******************************************************************************
+
+# Makefile for creating the Linux/Motif eclipse launcher program.
+
+# This makefile expects the following environment variables set:
+#
+# PROGRAM_OUTPUT - the filename of the output executable
+# PROGRAM_LIBRARY - the filename of the output library
+# DEFAULT_OS - the default value of the "-os" switch
+# DEFAULT_OS_ARCH - the default value of the "-arch" switch
+# DEFAULT_WS - the default value of the "-ws" switch
+# X11_HOME - the full path to X11 header files
+# MOTIF_HOME - the full path to Motif header files
+# JAVA_JNI - the full path to the java jni header files
+
+ifeq ($(PROGRAM_OUTPUT),)
+ PROGRAM_OUTPUT=eclipse
+endif
+ifeq ($(PROGRAM_LIBRARY),)
+ PROGRAM_LIBRARY=eclipse_001.so
+endif
+
+# Define the object modules to be compiled and flags.
+#OBJS = eclipse.o eclipseUtil.o eclipseJNI.o eclipseConfig.o eclipseMozilla.o eclipseMotif.o NgCommon.o NgImage.o NgImageData.o NgWinBMPFileFormat.o
+
+MAIN_OBJS = eclipseMain.o
+COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseMotifCommon.o
+DLL_OBJS = eclipse.o eclipseMotif.o eclipseUtil.o eclipseJNI.o eclipseMozilla.o NgCommon.o NgImage.o NgImageData.o NgWinBMPFileFormat.o
+
+
+EXEC = $(PROGRAM_OUTPUT)
+DLL = $(PROGRAM_LIBRARY)
+LIBS = -Xlinker -rpath -Xlinker . -L$(MOTIF_HOME)/lib -L$(X11_HOME)/lib -lXm -lXt -lX11 -lXinerama
+LFLAGS = -shared -fpic -Wl,--export-dynamic
+CFLAGS = -g -s -Wall \
+ -DLINUX \
+ -DMOZILLA_FIX \
+ -DDEFAULT_OS="\"$(DEFAULT_OS)\"" \
+ -DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \
+ -DDEFAULT_WS="\"$(DEFAULT_WS)\"" \
+ -fPIC \
+ -I./ \
+ -I../ \
+ -I$(MOTIF_HOME)/include \
+ -I$(X11_HOME)/include \
+ -I$(JAVA_JNI)
+
+all: $(EXEC) $(DLL)
+
+.c.o:
+ $(CC) $(CFLAGS) -c $< -o $@
+
+eclipseMain.o: ../eclipseMain.c ../eclipseUnicode.h ../eclipseCommon.h
+ $(CC) $(CFLAGS) -c $< -o $@
+
+eclipse.o: ../eclipse.c ../eclipseOS.h ../eclipseCommon.h ../eclipseJNI.h
+ $(CC) $(CFLAGS) -c $< -o $@
+
+eclipseCommon.o: ../eclipseCommon.c ../eclipseCommon.h ../eclipseUnicode.h
+ $(CC) $(CFLAGS) -c $< -o $@
+
+eclipseUtil.o: ../eclipseUtil.c ../eclipseUtil.h ../eclipseOS.h
+ $(CC) $(CFLAGS) -c $< -o $@
+
+eclipseJNI.o: ../eclipseJNI.c ../eclipseCommon.h ../eclipseOS.h ../eclipseJNI.h
+ $(CC) $(CFLAGS) -c $< -o $@
+
+eclipseConfig.o: ../eclipseConfig.c ../eclipseConfig.h ../eclipseOS.h
+ $(CC) $(CFLAGS) -c $< -o $@
+
+eclipseMozilla.o: ../eclipseMozilla.c ../eclipseMozilla.h ../eclipseOS.h
+ $(CC) $(CFLAGS) -c $< -o $@
+
+$(EXEC): $(MAIN_OBJS) $(COMMON_OBJS)
+ $(CC) -o $(EXEC) $(MAIN_OBJS) $(COMMON_OBJS) $(LIBS)
+
+$(DLL): $(DLL_OBJS) $(COMMON_OBJS)
+ $(CC) $(LFLAGS) -o $(DLL) $(DLL_OBJS) $(COMMON_OBJS) $(LIBS)
+
+install: all
+ cp $(EXEC) $(DLL) $(OUTPUT_DIR)
+ rm -f $(EXEC) $(MAIN_OBJS) $(COMMON_OBJS) $(DLL_OBJS)
+
+clean:
+ rm -f $(EXEC) $(MAIN_OBJS) $(COMMON_OBJS) $(DLL_OBJS)
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/make_solaris.mak b/bundles/org.eclipse.equinox.executable/library/motif/make_solaris.mak
new file mode 100644
index 000000000..2bcdd5af0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/make_solaris.mak
@@ -0,0 +1,65 @@
+#*******************************************************************************
+# Copyright (c) 2000, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+# Kevin Cornell (Rational Software Corporation)
+#*******************************************************************************
+
+# Makefile for creating the Solaris/Motif eclipse launcher program.
+
+# This makefile expects the following environment variables set:
+#
+# PROGRAM_OUTPUT - the filename of the output executable
+# DEFAULT_OS - the default value of the "-os" switch
+# DEFAULT_OS_ARCH - the default value of the "-arch" switch
+# DEFAULT_WS - the default value of the "-ws" switch
+# X11_HOME - the full path to X11 header files
+# MOTIF_HOME - the full path to Motif header files
+
+# Define the object modules to be compiled and flags.
+OBJS = eclipse.o eclipseUtil.o eclipseShm.o eclipseConfig.o eclipseMotif.o NgCommon.o NgImage.o NgImageData.o NgWinBMPFileFormat.o
+EXEC = $(PROGRAM_OUTPUT)
+LIBS = -L$(MOTIF_HOME)/lib -L$(X11_HOME)/lib -lXm -lXt -lX11 -lintl
+CFLAGS = -O -s \
+ -DSOLARIS \
+ -DNO_XINERAMA_EXTENSIONS \
+ -DNETSCAPE_FIX \
+ -DDEFAULT_OS="\"$(DEFAULT_OS)\"" \
+ -DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \
+ -DDEFAULT_WS="\"$(DEFAULT_WS)\"" \
+ -I./ \
+ -I../ \
+ -I$(MOTIF_HOME)/include \
+ -I$(X11_HOME)/include
+
+all: $(EXEC)
+
+.c.o:
+ $(CC) $(CFLAGS) -c $< -o $@
+
+eclipse.o: ../eclipse.c ../eclipseOS.h
+ $(CC) $(CFLAGS) -c $^ -o $@
+
+eclipseUtil.o: ../eclipseUtil.c ../eclipseUtil.h ../eclipseOS.h
+ $(CC) $(CFLAGS) -c $^ -o $@
+
+eclipseShm.o: ../eclipseShm.c ../eclipseShm.h ../eclipseOS.h
+ $(CC) $(CFLAGS) -c $^ -o $@
+
+eclipseConfig.o: ../eclipseConfig.c ../eclipseConfig.h ../eclipseOS.h
+ $(CC) $(CFLAGS) -c $^ -o $@
+
+$(EXEC): $(OBJS)
+ $(CC) -o $(EXEC) $(OBJS) $(LIBS)
+
+install: all
+ cp $(EXEC) $(OUTPUT_DIR)
+ rm -f $(EXEC) $(OBJS)
+
+clean:
+ rm -f $(EXEC) $(OBJS)

Back to the top