int index = 0; while (index < Devices.length) { if (Devices [index] != null) break; index++; } if (index == Devices.length) {
if (XErrorCallback == null) {
protected void init () {	if (debug) OS.XSynchronize (xDisplay, true);			/* Create the warning and error callbacks */	Class clazz = getClass ();	synchronized (clazz) {		int index = 0;		while (index < Devices.length) {			if (Devices [index] != null) break;			index++;		}		if (index == Devices.length) {			XErrorCallback = new Callback (clazz, "XErrorProc", 2);			XNullErrorProc = XErrorCallback.getAddress ();			if (XNullErrorProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);			XIOErrorCallback = new Callback (clazz, "XIOErrorProc", 1);			XNullIOErrorProc = XIOErrorCallback.getAddress ();			if (XNullIOErrorProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);			XErrorProc = OS.XSetErrorHandler (XNullErrorProc);			XIOErrorProc = OS.XSetIOErrorHandler (XNullIOErrorProc);		}	}	xtWarningCallback = new Callback (this, "xtWarningProc", 1);	xtNullWarningProc = xtWarningCallback.getAddress ();	if (xtNullWarningProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);	xtErrorCallback = new Callback (this, "xtErrorProc", 1);	xtNullErrorProc = xtErrorCallback.getAddress ();	if (xtNullErrorProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);	int xtContext = OS.XtDisplayToApplicationContext (xDisplay);	xtWarningProc = OS.XtAppSetWarningHandler (xtContext, xtNullWarningProc);	xtErrorProc = OS.XtAppSetErrorHandler (xtContext, xtNullErrorProc);		/* Only use palettes for <= 8 bpp default visual */	int xScreenPtr = OS.XDefaultScreenOfDisplay (xDisplay);	int defaultDepth = OS.XDefaultDepthOfScreen (xScreenPtr);	if (defaultDepth <= 8) {		int numColors = 1 << defaultDepth;		colorRefCount = new int [numColors];		xcolors = new XColor [numColors];	}		/*	* The following colors are listed in the Windows	* Programmer's Reference as the colors in the default	* palette.	*/	COLOR_BLACK = new Color (this, 0,0,0);	COLOR_DARK_RED = new Color (this, 0x80,0,0);	COLOR_DARK_GREEN = new Color (this, 0,0x80,0);	COLOR_DARK_YELLOW = new Color (this, 0x80,0x80,0);	COLOR_DARK_BLUE = new Color (this, 0,0,0x80);	COLOR_DARK_MAGENTA = new Color (this, 0x80,0,0x80);	COLOR_DARK_CYAN = new Color (this, 0,0x80,0x80);	COLOR_GRAY = new Color (this, 0xC0,0xC0,0xC0);	COLOR_DARK_GRAY = new Color (this, 0x80,0x80,0x80);	COLOR_RED = new Color (this, 0xFF,0,0);	COLOR_GREEN = new Color (this, 0,0xFF,0);	COLOR_YELLOW = new Color (this, 0xFF,0xFF,0);	COLOR_BLUE = new Color (this, 0,0,0xFF);	COLOR_MAGENTA = new Color (this, 0xFF,0,0xFF);	COLOR_CYAN = new Color (this, 0,0xFF,0xFF);	COLOR_WHITE = new Color (this, 0xFF,0xFF,0xFF);	/* Create the parsing tables */	byte[] tabBuffer = {(byte) '\t', 0};	tabPointer = OS.XtMalloc (tabBuffer.length);	OS.memmove (tabPointer, tabBuffer, tabBuffer.length);			int tabString = OS.XmStringComponentCreate(OS.XmSTRING_COMPONENT_TAB, 0, null);	int [] argList = {		OS.XmNpattern, tabPointer,		OS.XmNsubstitute, tabString,	};	tabMapping = OS.XmParseMappingCreate(argList, argList.length / 2);	OS.XmStringFree(tabString);		byte[] crBuffer = {(byte) '\n', 0};	crPointer = OS.XtMalloc (crBuffer.length);			OS.memmove (crPointer, crBuffer, crBuffer.length);			int crString = OS.XmStringComponentCreate(OS.XmSTRING_COMPONENT_SEPARATOR, 0, null);	argList = new int[] {		OS.XmNpattern, crPointer,		OS.XmNsubstitute, crString,	};	crMapping = OS.XmParseMappingCreate(argList, argList.length / 2);	OS.XmStringFree(crString);}