[xorg-commit-diffs] xc/lib/Xst Imakefile, NONE, 1.1.4.1 Xst.h, NONE, 1.1.4.1 Xst_alpha.h, NONE, 1.1.4.1 Xst_cb.c, NONE, 1.1.4.1 Xst_cb.h, NONE, 1.1.4.1 Xst_cntl.c, NONE, 1.1.4.1 Xst_cntl.h, NONE, 1.1.4.1 Xst_colors.h, NONE, 1.1.4.1 Xst_conv.c, NONE, 1.1.4.1 Xst_conv.h, NONE, 1.1.4.1 Xst_env.c, NONE, 1.1.4.1 Xst_env.h, NONE, 1.1.4.1 Xst_ext.c, NONE, 1.1.4.1 Xst_ext.h, NONE, 1.1.4.1 Xst_font.c, NONE, 1.1.4.1 Xst_font.h, NONE, 1.1.4.1 Xst_fontpath.h, NONE, 1.1.4.1 Xst_gc.c, NONE, 1.1.4.1 Xst_gc.h, NONE, 1.1.4.1 Xst_glyph.c, NONE, 1.1.4.1 Xst_glyph.h, NONE, 1.1.4.1 Xst_layout.c, NONE, 1.1.4.1 Xst_layoutengine.h, NONE, 1.1.4.1 Xst_line.c, NONE, 1.1.4.1 Xst_line.h, NONE, 1.1.4.1 Xst_private.h, NONE, 1.1.4.1 Xst_scaler.c, NONE, 1.1.4.1 Xst_scaler.h, NONE, 1.1.4.1 Xst_space.c, NONE, 1.1.4.1 Xst_space.h, NONE, 1.1.4.1 Xst_string.c, NONE, 1.1.4.1 Xst_string.h, NONE, 1.1.4.1 Xst_style.c, NONE, 1.1.4.1 Xst_style.h, NONE, 1.1.4.1 Xst_text.c, NONE, 1.1.4.1 Xst_text.h, NONE, 1.1.4.1 Xst_typedef.h, NONE, 1.1.4.1 Xst_util.c, NONE, 1.1.4.1 Xst_util.h, NONE, 1.1.4.1 Xst_xlib.c, NONE, 1.1.4.1 Xst_xlib.h, NONE, 1.1.4.1

Alexander Gelfenbain xorg-commit at pdx.freedesktop.org
Mon Apr 5 19:41:23 PDT 2004


Committed by: adg

Update of /cvs/xorg/xc/lib/Xst
In directory pdx:/tmp/cvs-serv16834/lib/Xst

Added Files:
      Tag: XORG-RELEASE-1-STSF
	Imakefile Xst.h Xst_alpha.h Xst_cb.c Xst_cb.h Xst_cntl.c 
	Xst_cntl.h Xst_colors.h Xst_conv.c Xst_conv.h Xst_env.c 
	Xst_env.h Xst_ext.c Xst_ext.h Xst_font.c Xst_font.h 
	Xst_fontpath.h Xst_gc.c Xst_gc.h Xst_glyph.c Xst_glyph.h 
	Xst_layout.c Xst_layoutengine.h Xst_line.c Xst_line.h 
	Xst_private.h Xst_scaler.c Xst_scaler.h Xst_space.c 
	Xst_space.h Xst_string.c Xst_string.h Xst_style.c Xst_style.h 
	Xst_text.c Xst_text.h Xst_typedef.h Xst_util.c Xst_util.h 
	Xst_xlib.c Xst_xlib.h 
Log Message:
Initial import of XST into the XORG-RELEASE-1-STSF branch

--- NEW FILE: Imakefile ---
XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:05 cpqbld Exp $
/******************************************************************************
 ******************************************************************************
 **
 ** Description: Imakefile for the DtPrint extension library.
 **
 ** (c) Copyright 1996 Hewlett-Packard Company
 ** (c) Copyright 1996 International Business Machines Corp.
 ** (c) Copyright 1996 Sun Microsystems, Inc.
 ** (c) Copyright 1996 Novell, Inc.
 ** (c) Copyright 1996 Digital Equipment Corp.
 ** (c) Copyright 1996 Fujitsu Limited
 ** (c) Copyright 1996 Hitachi, Ltd.
 ** 
 ** Permission is hereby granted, free of charge, to any person obtaining a copy
 ** of this software and associated documentation files (the "Software"), to deal
 ** in the Software without restriction, including without limitation the rights
 ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 ** copies of the Software, and to permit persons to whom the Software is
 ** furnished to do so, subject to the following conditions:
 **
 ** The above copyright notice and this permission notice shall be included in
 ** all copies or substantial portions of the Software.
 **
 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 **
 ** Except as contained in this notice, the names of the copyright holders shall
 ** not be used in advertising or otherwise to promote the sale, use or other
 ** dealings in this Software without prior written authorization from said
 ** copyright holders.
 **
 ******************************************************************************
 *****************************************************************************/
XCOMM $XFree86: xc/lib/Xst/Imakefile,v 1.3 2001/01/17 19:43:01 dawes Exp $


#define DoNormalLib	NormalLibXst
#define DoSharedLib	SharedLibXst
#define DoExtraLib	SharedLibXst
#define DoDebugLib	DebugLibXst
#define DoProfileLib	ProfileLibXst
#define LibName		Xst
#define SoRev		SOXSTREV
#define LibHeaders	NO

#include <Threads.tmpl>

REQUIREDLIBS = -L$(TOP)/../stsf/STClientLibrary/src -lST -L$(TOP)/../stsf/stsflib -lstsf

#if Malloc0ReturnsNull
ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif

DEFINES = $(ALLOC_DEFINES) -DUSE_XST_EXTENSION -DUSEICU 

EXTRA_INCLUDES = -I../X11 -I../../include -I$(TOP)/../stsf/interface -I$(TOP)/../stsf/stsflib -I$(TOP)/../stsf/STClientLibrary/src

/*
 * NOTE: libXst.a has a dependency on stsf found in
 * ../../../stsf
 */
HEADERS = Xst.h Xst_alpha.h Xst_cb.h Xst_cntl.h Xst_colors.h Xst_conv.h Xst_env.h Xst_ext.h \
          Xst_font.h Xst_fontpath.h Xst_gc.h Xst_glyph.h Xst_layoutengine.h Xst_line.h \
          Xst_private.h Xst_scaler.h Xst_space.h Xst_string.h Xst_style.h Xst_text.h \
          Xst_typedef.h Xst_util.h

   SRCS = Xst_cb.c Xst_cntl.c Xst_conv.c \
          Xst_env.c Xst_ext.c Xst_font.c \
          Xst_gc.c Xst_glyph.c \
          Xst_layout.c Xst_line.c Xst_scaler.c Xst_space.c \
          Xst_string.c Xst_style.c Xst_text.c Xst_util.c

   OBJS = Xst_cb.o Xst_cntl.o Xst_conv.o \
          Xst_env.o Xst_ext.o Xst_font.o \
          Xst_gc.o Xst_glyph.o \
          Xst_layout.o Xst_line.o Xst_scaler.o Xst_space.o \
          Xst_string.o Xst_style.o Xst_text.o Xst_util.o

LINTLIBS = $(LINTXLIB) $(LINTXEXT) ../X11 ../../include/extensions

#include <Library.tmpl>

DependTarget()

--- NEW FILE: Xst.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_alpha.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_cb.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_cb.h ---
#ifndef _XST_CB_H
#define _XST_CB_H

void _XSTSetGC ( Display *dpy, GC gc, int *ch_values, int *function_gc, 
		 unsigned int *color_gc );
void _XSTResetGC ( Display *dpy, GC gc, int ch_values, int function_gc, 
		   unsigned int color_gc );


typedef struct {
    Drawable   pDraw;
    GC         pGC;
    uint32_t  *TaTable;
    int        TaDirty;
    uint32_t  *HLaTable;
    int        HLaDirty;
    uint32_t  *UL1aTable;
    int        UL1aDirty;
    uint32_t  *UL2aTable;
    int        UL2aDirty;
    uint32_t  *STaTable;
    int        STaDirty;
    STGraphics stGR;
    uint32_t   hlbgc;
    int        x;
    int        y;
    uint32_t   width;
    uint32_t   height;
    uint32_t   depth;
    Display   *dpy;
} STOutputDevicePrivData;

#endif

--- NEW FILE: Xst_cntl.c ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
 * This software is provided "AS IS," without a warranty of any kind.
 *
 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
 * SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES OR
 * LIABILITIES  SUFFERED BY LICENSEE AS A RESULT OF  OR RELATING TO USE,
 * MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS DERIVATIVES.
 * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE,
 * PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
 * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE
 * THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE
 * SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 *
 * You acknowledge that this software is not designed, licensed or intended
 * for use in the design, construction, operation or maintenance of any
 * nuclear facility.
 *
 */

/* @(#)Xst_cntl.c	1.54 03/03/06 SMI */

#define NEED_REPLIES

#include "Xlibint.h"
#include <stdlib.h>
#include <unistd.h>
#include <locale.h>
#include <X11/Xlib.h>
#include <X11/Xproto.h>

#include "extensions/XSTstr.h"
#include "Xst_ext.h"


/******************************** General support structures ************************/

/********************************** Static Local Variables **************************/

int STClient = False;

/******************************* XSTTypeEnv Static Functions ************************/

/********************************** XSTEnv Global Functions *************************/

/* **********************************************************************************
 * XSTEnable(Display *)
 *
 * Returns:     NONE
 * Called by:   USER
 * Calls:       NONE
 *
 * @dpy:	X display pointer
 *
 * This function sends a request to the server to enable the ST extension.  It can 
 * only be enabled if the server is capable of using the extension.  This function is
 * meaningless for applications using client side.
 */
void XSTEnable(Display *dpy)
{
#ifdef USE_XST_EXTENSION
    XSTCodes *extcodes = _XSTCodes ( dpy );
#endif

#ifdef USE_XST_EXTENSION
    if ( extcodes )
    {
        xSTEnableReq  *req = NULL;
         
    	LockDisplay ( dpy );
    	GetReq ( STEnable, req );
	req->reqType   = extcodes->codes->major_opcode;
	req->stReqType = X_STEnable;
    	UnlockDisplay ( dpy );
    	SyncHandle ();
    }
#endif
}


/* **********************************************************************************
 * XSTDisable(Display *)
 *
 * Returns:     NONE
 * Called by:   USER
 * Calls:       NONE
 *
 * @dpy:	X display pointer
 *
 * This function sends a protocol message to the server to disable the ST extension.
 * By doing this, no applications may use the ST server extension.  This may be a bug.
 * May only want to disable ST for this application.  This function is meaningless 
 * for local applications as they are already at the fallback doing ST locally.
 */
void XSTDisable(Display *dpy)
{
#ifdef USE_XST_EXTENSION
    XSTCodes *extcodes = _XSTCodes ( dpy );
#endif

#ifdef USE_XST_EXTENSION
    if ( extcodes )
    {
        xSTDisableReq  *req = NULL;
         
    	LockDisplay ( dpy );
    	GetReq ( STDisable, req );
	req->reqType   = extcodes->codes->major_opcode;
	req->stReqType = X_STDisable;
    	UnlockDisplay ( dpy );
    	SyncHandle ();
    }
#endif
}


/* **********************************************************************************
 * XSTVersion(Display *)
 *
 * Returns:     version
 * Called by:   USER
 * Calls:       NONE
 *
 * @dpy:	X display pointer
 *
 * This function sends a protocol message to retreive the version information.
 */
unsigned int 
XSTVersion(Display *dpy)
{
    unsigned int oVersion;
#ifdef USE_XST_EXTENSION
    XSTCodes *extcodes = _XSTCodes ( dpy );
#endif

#ifdef USE_XST_EXTENSION
    if ( extcodes )
    {
        xSTQueryVersionReq  *req = NULL;
        xSTQueryVersionReply reply;

	LockDisplay ( dpy );
	GetReq ( STQueryVersion, req );
	req->reqType   = extcodes->codes->major_opcode;
	req->stReqType = X_STQueryVersion;

	if ( _XReply ( dpy, (xReply *) &reply, 0, xTrue )) 
	{
	    oVersion = ( reply.majorVersion << 16 ) + reply.minorVersion;
	}

    	UnlockDisplay ( dpy );
    	SyncHandle ();
    }
#endif

    return oVersion;
}


/* **********************************************************************************
 * XSTInfo(Display *)
 *
 * Returns:     STSTUS
 * Called by:   USER
 * Calls:       NONE
 *
 * @dpy:	X display pointer
 *
 * This function sends a protocol message to get the status of the ST extension.
 */
int XSTInfo(Display *dpy)
{
    int oStatus = 0;
#ifdef USE_XST_EXTENSION
    XSTCodes *extcodes = _XSTCodes ( dpy );
#endif

#ifdef USE_XST_EXTENSION
    if ( extcodes )
    {
        xSTInfoReq  *req = NULL;
        xSTInfoReply reply;

	LockDisplay ( dpy );
	GetReq ( STInfo, req );
	req->reqType   = extcodes->codes->major_opcode;
	req->stReqType = X_STInfo;

	if ( _XReply ( dpy, (xReply *) &reply, 0, xTrue )) 
	{
	    oStatus = (int)reply.state;
	}

    	UnlockDisplay ( dpy );
    	SyncHandle ();
    }
#endif
    return oStatus;
}

/* **********************************************************************************
 * XSTClientSide(Display *)
 *
 * Returns:     STSTUS
 * Called by:   USER
 * Calls:       NONE
 *
 * @dpy:	X display pointer
 *
 * This function tells the local application to use client side rendering.
 */
int XSTClient(Display *dpy)
{
    STClient = TRUE;
}

/* **********************************************************************************
 * XSTServerSide(Display *)
 *
 * Returns:     STSTUS
 * Called by:   USER
 * Calls:       NONE
 *
 * @dpy:	X display pointer
 *
 * This function tells the local application to use server side rendering.
 */
int XSTServer(Display *dpy)
{
    STClient = False;
}

--- NEW FILE: Xst_cntl.h ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
 * This software is provided "AS IS," without a warranty of any kind.
 *
 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
 * SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES OR
 * LIABILITIES  SUFFERED BY LICENSEE AS A RESULT OF  OR RELATING TO USE,
 * MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS DERIVATIVES.
 * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE,
 * PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
 * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE
 * THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE
 * SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 *
 * You acknowledge that this software is not designed, licensed or intended
 * for use in the design, construction, operation or maintenance of any
 * nuclear facility.
 *
 */

/* @(#)Xst_cntl.c	1.54 03/03/06 SMI */

#define NEED_REPLIES

void XSTEnable(Display *dpy);


/* **********************************************************************************
 * XSTDisable(Display *)
 *
 * Returns:     NONE
 * Called by:   USER
 * Calls:       NONE
 *
 * @dpy:	X display pointer
 *
 * This function sends a protocol message to the server to disable the ST extension.
 * By doing this, no applications may use the ST server extension.  This may be a bug.
 * May only want to disable ST for this application.  This function is meaningless 
 * for local applications as they are already at the fallback doing ST locally.
 */
void XSTDisable(Display *dpy);

/* **********************************************************************************
 * XSTVersion(Display *)
 *
 * Returns:     version
 * Called by:   USER
 * Calls:       NONE
 *
 * @dpy:	X display pointer
 *
 * This function sends a protocol message to retreive the version information.
 */
unsigned int XSTVersion(Display *dpy);


/* **********************************************************************************
 * XSTInfo(Display *)
 *
 * Returns:     STSTUS
 * Called by:   USER
 * Calls:       NONE
 *
 * @dpy:	X display pointer
 *
 * This function sends a protocol message to get the status of the ST extension.
 */
int XSTInfo(Display *dpy);

/* **********************************************************************************
 * XSTClientSide(Display *)
 *
 * Returns:     STSTUS
 * Called by:   USER
 * Calls:       NONE
 *
 * @dpy:	X display pointer
 *
 * This function tells the local application to use client side rendering.
 */
int XSTClient(Display *dpy);

/* **********************************************************************************
 * XSTServerSide(Display *)
 *
 * Returns:     STSTUS
 * Called by:   USER
 * Calls:       NONE
 *
 * @dpy:	X display pointer
 *
 * This function tells the local application to use server side rendering.
 */
int XSTServer(Display *dpy);

--- NEW FILE: Xst_colors.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_conv.c ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
 * This software is provided "AS IS," without a warranty of any kind.
 *
 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
 * SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES OR
 * LIABILITIES  SUFFERED BY LICENSEE AS A RESULT OF  OR RELATING TO USE,
 * MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS DERIVATIVES.
 * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE,
 * PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
 * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE
 * THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE
 * SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 *
 * You acknowledge that this software is not designed, licensed or intended
 * for use in the design, construction, operation or maintenance of any
 * nuclear facility.
 *
 */

/* @(#)Xst_conv.c	1.42	04/02/05 SMI */

#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include "stsfutil.h"
#include "Xlibint.h"
#include <stdio.h>
#include <locale.h>
#include <dlfcn.h>
#ifndef i386
#include <link.h>
#endif
#include "Xst_typedef.h"
#include "Xst_conv.h"
#include <netinet/in.h>		/* htons() */
#include <inttypes.h>

#include <X11/Xlib.h>
#include <X11/Xproto.h>
#ifndef USEICU
#include <iconv.h>
#else
#include "unicode/utypes.h"
#include "unicode/ucnv.h"
#endif

/******************************** General support structures ************************/

/********************************** Static Local Variables **************************/

struct XSTHandle {
	char             *Locale;    /* lookup string to check for existence      */
	char             *FromCode;  /* iconv conversion string name              */
	XSTCount	  bytes;     /* bytes per glyph (base units for MB)	 */
	XSTEncoding       encoding;  /* encoding for strings                      */
	struct XSTHandle *next;	     /* next handle in the list                   */
	XSTLocale         locale;    /* locale/language to use with tags          */
};

#ifndef USEICU
struct XSTIconvList {
	char		    *ToCode;   /* iconv conversion string name              */
	char		    *FromCode; /* iconv conversion string name              */
	iconv_t		     cd;       /* iconv file descriptor (iconv_open)        */
	struct XSTIconvList *next;     /* next open iconv in the list               */
};

/* 
 * Pointer to first iconv file desc. in list 
 */
static struct XSTIconvList *Iconv   = NULL; 
#endif

/* 
 * Pointer to first handle in the list       
 */
static struct XSTHandle    *Handles = NULL; 

/* 
 * Pointer to Utf16 string removed first char
 */
static int                  pModified = 0;  

/********************************* XSTConv Static Functions *************************/

#ifndef USEICU
/* **********************************************************************************
 * _XSTConvXtoY(iconv_t, const char *, XSTCount, XSTCount *)
 *
 * Returns:     pointer to formatted string
 * Called by:   _XSTConvUTF16toX
 *		_XSTConvXtoUTF16
 * Calls:       NONE
 *
 * @cd:			iconv converter to perform conversion
 * @iString:		input string to convert
 * @iStringLength:	input string length in bytes
 * @oStringLength:	output string length. Modified by function
 *
 * This function translates a string from one format into another format and returns 
 * the new string.
 */
static void *
_XSTConvXtoY ( iconv_t cd, const char *iString, XSTCount iStringLength, 
	       XSTCount *oStringLength )
{
    char       *oString = (char *)calloc ( 1,iStringLength*4 );
    size_t      ileft   = iStringLength;
    size_t      oleft   = iStringLength*4;
    size_t      ret;
    const char *fptr;
    char       *tptr;

    *oStringLength = iStringLength;

    if ( oString == NULL )
    {
	return (void *)NULL;
    }

    fptr  = iString;
    tptr  = (char *)oString;

    while ( ileft )
    {

	while ( 1 ) {

	    ret = iconv ( cd, &fptr, &ileft, &tptr, &oleft );
	    if ( ret != (size_t)-1 )
	    {
		*oStringLength = ( *oStringLength * 4 ) - oleft;
		break;
	    }
	    if ( errno == E2BIG )
	    {
		*oStringLength += 1024;
		oleft          += 1024;
		oString         = (char *)realloc ( oString, *oStringLength );
		tptr            = oString + *oStringLength - 1024 - oleft;
	    }
	    else if ( errno )
	    {
/*
		perror("Iconv conversion error");
*/
		return (void *) fptr;
	    }	
	}
    }

    return (void *)oString;
}

/* **********************************************************************************
 * _XSTConvIconvOpen(char *, char *)
 *
 * Returns:     iconv_t (iconv_open return value )
 * Called by:   _XSTConvUTF16toX
 *              _XSTConvXtoUTF16
 * Calls:       NONE
 *
 * @ToCode:	iconv ToCode value
 * @FromCode:	iconv FromCode value
 *
 * This function searches a list of ToCode/FromCode combinations and returns the open 
 * iconv file descriptor if available, otherwise, it creates a new item for the list
 * opens iconv with the ToCode/FromCode combination and returns the result of the 
 * iconv_open command.
 */
/*
 * XXX TODO: libiconv was broken somehow on FreeBSD and we had to do this ugly hack.
 * Need to investigate libiconv and come up with a better solution
 */
iconv_t 
_XSTConvIconvOpen ( char *ToCode, char *FromCode )
{
    struct XSTIconvList *tmp         = Iconv;
    int                  alreadyOpen = FALSE;

    /*
     * See if we already have this iconv converter open
     */
    while ( tmp != NULL )
 	if ( !strcmp ( FromCode, tmp->FromCode ) && !strcmp ( ToCode, tmp->ToCode ))
        {
#ifndef sun
            alreadyOpen = TRUE;
            iconv_close ( tmp->cd );
            break;
#else
            return tmp->cd;
#endif
	}
	else
            tmp = tmp->next;

    if ( !alreadyOpen ) 
    {
        /*
         * Allocate the space for a new iconv converter to go on the list
         */
        tmp = (struct XSTIconvList *) Xmalloc ( sizeof ( struct XSTIconvList ));
        if ( tmp == NULL )
            return 0;

        tmp->FromCode = (char *) Xmalloc ( strlen ( FromCode ) + 1 );
        tmp->ToCode   = (char *) Xmalloc ( strlen ( ToCode ) + 1 );
        if ( tmp->FromCode == NULL || tmp->ToCode == NULL )
        {
            if ( tmp->FromCode )	Xfree ( tmp->FromCode );
            if ( tmp->ToCode )	Xfree ( tmp->ToCode );
            Xfree ( tmp );
            return (iconv_t)-1;
        }

        /*
         * Store the data for the new iconv converter
         */
        (void) memcpy ( tmp->FromCode, FromCode, strlen ( FromCode ) + 1 );
        (void) memcpy ( tmp->ToCode,   ToCode,   strlen ( ToCode ) + 1 );
        tmp->next = Iconv;
        Iconv     = tmp;
    } 


    /* We always want UTF-16 to be big-endian.  On some systems you have to
       specify "UTF-16BE" to force this, but not all systems support it, so
       we try "UTF-16BE", and then fall back to "UTF-16" if it fails. */

    tmp->cd = (iconv_t) -1;

    if (strcmp(ToCode, "UTF-16") == 0) {
	tmp->cd = iconv_open ( "UTF-16BE", FromCode );
    } else  if (strcmp(FromCode, "UTF-16") == 0) {
	tmp->cd = iconv_open ( ToCode, "UTF-16BE" );
    }

    if (tmp->cd == (iconv_t) -1) {
	tmp->cd = iconv_open ( ToCode, FromCode );
    }
    return tmp->cd;
}

/* **********************************************************************************
 * _XSTConvIconvclose()
 *
 * Returns:     NONE
 * Called by:   XSTTypeEnvDispose
 * Calls:       NONE
 *
 * This function closes all open iconv converters and frees their memory.
 */
void 
_XSTConvIconvClose ()
{
    struct XSTIconvList *tmp  = Iconv;
    struct XSTIconvList *next = NULL;

    while ( tmp != NULL )
    {
	next = tmp->next;

	(void) iconv_close ( tmp->cd );
	Xfree ( tmp->FromCode );
	Xfree ( tmp->ToCode );
	Xfree ( tmp );

	tmp = next;
    }

    Iconv = NULL;
}
#endif

/* **********************************************************************************
 * _XSTConvUTF16toX(char *, char *, XSTCount, XSTCount *)
 *
 * Returns:     pointer to UTF16 string
 * Called by:   XSTFontGetUnicodeNameString
 *		XSTTextGetText
 * Calls:       _XSTConvXtoY
 *
 * @iToCode:		iconv destination code
 * @iString:		input string to convert
 * @iStringLength:	input string length
 * @oStringLength:	output string length. Modified by function
 *
 * This function translates a string from one format into utf16 format and returns the
 * new string.
 *
 * NOTE: The output of this function may have Big Endian/Little Endian data as the 
 *       first element. This cannot be removed by this function as it does not know 
 *       the size of the resulting data.
 */
void *
_XSTConvUTF16toX ( char *iToCode, char *iString, XSTCount iStringLength, 
		   XSTCount *oStringLength )
{
    void       *oString;
#ifdef USEICU
    UConverter *conv;
    UErrorCode  err     = U_ZERO_ERROR;
    utf16      *utf16le = NULL;
    utf16      *futf16  = NULL;
    utf16      *tutf16  = (utf16 *)iString;
    char       *tchar   = iString;
    int         limit   = sizeof ( uint32_t ) * iStringLength;
    int         i;
#else
    iconv_t     cd;
    utf8       *tUtf8;
    int         oLength;
#endif

    *oStringLength = 0;

#ifdef USEICU
#ifndef sun
    for ( i = 0; i < iStringLength / 2; i++ )  /** Fix this for 4 byte utf16 chars **/
    {
        tutf16[i] = ntohs ( tutf16[i] );
    }
#if 0
    /*
     * Make space for UTF16LE buffer
     */
    if (( utf16le = (utf16 *)malloc ( sizeof ( utf16 ) * iStringLength )) == NULL )
	return NULL;

    tutf16 = utf16le;
    futf16 = utf16le;

    /*
     * Convert from UTF-16BE to UTF-16LE on x86 machines
     */
    conv = ucnv_open ( "UTF-16", &err );

    /*
     * No preflight necessary since UTF16BE -> UTF16LE calls for no additional length
     */
    ucnv_toUnicode ( conv, (UChar **)&utf16le, (UChar *)((char *)utf16le + limit / 2),
		     (const char **)&tchar, 
		     (char *)(tchar + iStringLength),
		     NULL, TRUE, &err );

    ucnv_close ( conv );
#endif
    utf16le = tutf16;
    iString = tchar;
#endif
#ifdef i386
    /*
     * For x86, Convert to UTF16LE 
     */
    for ( i = 0; i < iStringLength / 2; i++ )
    {
        unsigned int temp;

        temp = (int)iString[i * 2];
        iString[i * 2] = iString[i * 2 + 1];
        iString[i * 2 + 1] = (char) temp;
    }
#endif

    /*
     * Create space for the destination code
     */
    if (( oString = (void *) malloc ( limit )) == NULL )
	return NULL;

    utf16le = oString;

    /*
     * Convert from UTF-16 machine format to desired format X
     */
    conv = ucnv_open ( iToCode, &err );

    /*
     * Allocate space for buffer
     */
    ucnv_fromUnicode ( conv, (char **)&oString, (char *)((char *)oString + 
                       limit), (const UChar **)&tutf16, 
                       (UChar *)(tutf16 + iStringLength/2), NULL, TRUE, &err );

    ucnv_close ( conv );

    *oStringLength = ( (XSTCount)oString - (XSTCount)utf16le );
    oString        = utf16le;

    if ( futf16 != NULL )
	free ( futf16 );
#else
    /*
     * Do not convert if iFromCode is UTF-16 already.
     */
    if ( !strncmp ( iToCode, "UTF-16", 6 ))
	return (void *)iString;

    /*
     * Check if we can convert directly from UTF16 encoding to iToCode encoding.
     */
    cd = _XSTConvIconvOpen ( iToCode, "UTF-16" );
    if ( cd == (iconv_t)-1 ) 
    {
	/*
	 * We will need a two step process. If the encoding is already UTF-8, then
         * there was some error since UTF16->UTF8 should exist.
	 */
	if ( !strncmp ( iToCode, "UTF-8", 6 ))
	    return (void *)NULL;

	/*
	 * Convert from current UTF16 encoding to UTF8.
	 */
	cd = _XSTConvIconvOpen ( "UTF-8", "UTF-16" );
	if ( cd == (iconv_t)-1 ) 
	{
	    return (void *)NULL;
	}

	tUtf8 = (utf8 *)_XSTConvXtoY ( cd, iString, iStringLength, &oLength );

	/*
	 * Convert from UTF8 to iToCode destination encoding
	 */
	cd = _XSTConvIconvOpen ( iToCode, "UTF-8" );
	if ( cd == (iconv_t)-1 ) 
	{
	    free ( tUtf8 );
	    return (void *)NULL;
	}
        oString = (void *)_XSTConvXtoY ( cd, (char *)tUtf8, oLength, &oLength );
	free(tUtf8);
    }
    else
        oString = (void *)_XSTConvXtoY ( cd, iString, iStringLength, &oLength );
    *oStringLength = oLength;
#endif
    return oString;
}


/* **********************************************************************************
 * _XSTConvXtoUTF16(char *, char *, XSTCount, XSTCount *)
 *
 * Returns:     pointer to UTF16 string
 * Called by:   _XSTTypeEnvFillInFontReq
 *		XSTTextNew
 *		XSTTextSetText
 * Calls:       _XSTConvXtoY
 *
 * @iFromCode:		iconv source code
 * @iString:		input string to convert
 * @iStringLength:	input string length
 * @oStringLength:	output string length. Modified by function
 *
 * This function translates a string from one format into utf16 format and returns the
 * new string.
 */
utf16 *
_XSTConvXtoUTF16 ( char *iFromCode, char *iString, XSTCount iStringLength, 
		   XSTCount *oStringLength )
{
    utf16      *oUtf16;
#ifdef USEICU
    UConverter *conv;
    UErrorCode  err     = U_ZERO_ERROR;
    utf16      *utf16be = NULL;
    utf16      *futf16  = NULL;
    char       *tchar   = iString;
    int         limit   = sizeof ( uint32_t ) * iStringLength;
    int         i;
#else
    iconv_t     cd;
    utf8       *tUtf8;
    int         oLength;
#endif

#ifdef USEICU
    /*
     * Create space for the destination code
     */
    if (( oUtf16 = (utf16 *) malloc ( limit )) == NULL )
	return NULL;

    utf16be = oUtf16;
    futf16  = oUtf16;

    /*
     * Convert from format X to machine dependent UTF-16
     */
    conv = ucnv_open ( iFromCode, &err );

    /*
     * Convert from format X to machine dependent UTF-16. Remember that
     * conversion will cause input and output buffers to be incremented
     * foward.
     */
    ucnv_toUnicode ( conv, (UChar **)&oUtf16, (UChar *)(oUtf16 + limit), 
		     (const char **)&iString, 
		     (char *)(iString + iStringLength),
		     NULL, TRUE, &err );

    ucnv_close ( conv );

    /*
     * Determine the length of the output buffer and reset the input and
     * output buffers back to their starts
     */
    *oStringLength = ( (XSTCount)oUtf16 - (XSTCount)utf16be );
    oUtf16         = utf16be;
    iString        = tchar;

#ifndef sun
    for ( i = 0; i < *oStringLength / 2; i++ ) /** here too **/
    {
        oUtf16[i] = htons ( oUtf16[i] );
    }

#if 0
    /*
     * Make space for UTF16BE buffer
     */
    if (( utf16be = (utf16 *)malloc ( sizeof ( utf16 ) * (*oStringLength) )) == NULL )
	return NULL;

    tutf16 = utf16be;

    /*
     * Convert from UTF-16LE to UTF-16BE on x86 machines
     */
    conv = ucnv_open ( "UTF-16", &err );

    /*
     * No preflight necessary since UTF16BE -> UTF16LE calls for no additional length
     */
    ucnv_fromUnicode ( conv, (char **)&utf16be, (char *)(utf16be + (*oStringLength)), 
		       (UChar **)&oUtf16, (UChar *)(oUtf16 + (*oStringLength)), 
		       NULL, TRUE, &err );

    ucnv_close ( conv );

    if ( futf16 )
        free ( futf16 );
    oUtf16 = tutf16;
#endif
#endif

#else

#ifdef CHECK_ENDIAN
    pModified = False;
#endif

    *oStringLength = 0;

    if ( iStringLength == 0 )
	return (utf16 *)NULL;

    /*
     * Do not convert if iFromCode is UTF-16 already.
     */
    if ( !strncmp ( iFromCode, "UTF-16", 6 ))
	return (utf16 *)iString;

    /*
     * Check if we can convert directly from the current encoding to UTF16.
     */
    cd = _XSTConvIconvOpen ( "UTF-16", iFromCode ); 
    if ( cd == (iconv_t)-1 ) 
    {
	/*
	 * We will need a two step process. If the encoding is already UTF-8, then
         * there was some error since UTF8->UTF16 should exist.
	 */
	if ( !strncmp ( iFromCode, "UTF-8", 6 ))
	    return (utf16 *)NULL;

	/*
	 * Convert from current encoding to UTF8.
	 */
	cd = _XSTConvIconvOpen ( "UTF-8", iFromCode ); 
	if ( cd == (iconv_t)-1 ) 
	{
	    return (utf16 *)NULL;
	}

	tUtf8 = (utf8 *)_XSTConvXtoY(cd, iString, iStringLength, &oLength);

#ifdef CHECK_ENDIAN
	/*
	 * Check if iconv added a Big Endian/Little Endian data item to the front of
	 * the string.
	 */
	if ( oLength     != iStringLength && 
	     oLength * 2 != iStringLength && 
	     oLength * 4 != iStringLength &&
	     oLength != iStringLength * 2 && 
	     oLength != iStringLength * 4)
	{
	    oLength--;
	    tUtf8++;
	    pModified = True;
	}
#endif

	/*
	 * Convert from UTF8 to UTF16
	 */
	cd = _XSTConvIconvOpen ( "UTF-16", "UTF-8" );
	if (cd == (iconv_t)-1) 
	{
#ifdef CHECK_ENDIAN
	    if ( pModified )
		tUtf8--;
#endif

	    free ( tUtf8 );
	    return (utf16 *)NULL;
	}
        oUtf16 = (utf16 *)_XSTConvXtoY ( cd, (char *)tUtf8, oLength, &oLength );
#ifdef CHECK_ENDIAN
	if ( pModified )
	    tUtf8--;
#endif
	free ( tUtf8 );
    }
    else
    {
        oUtf16 = (utf16 *)_XSTConvXtoY ( cd, iString, iStringLength, &oLength );

	/*
	 * Check if iconv added a Unicode Byte Order Mark (BOM) to the front of
	 * the string.  If it did, remove it.  If it's little endian, swap, as
	 * XST & STSF always use UTF-16 in big-endian ordering.
	 */
	if ( oUtf16[0] == 0xFFFE ) /* little endian BOM */
	{
	    int i;
	    for ( i = 1 ; i < oLength; i++ ) {
		oUtf16[i-1] = htons ( oUtf16[i] );
	    }
	    oUtf16[i] = 0;
	    oLength -= sizeof ( utf16 );
	    pModified = True;
	} else if ( oUtf16[0] == 0xFEFF ) { /* big endian BOM */
	    oLength -= sizeof ( utf16 );
	    memmove ( oUtf16, &oUtf16[1], oLength );
	    pModified = True;
	}
    }

    *oStringLength = oLength;
#endif
    return oUtf16;
}

/* **********************************************************************************
 * _XSTConvGetFromCodeWLocale(char *)
 *
 * Returns:     pointer to iconv FromCode string
 * Called by:   _XSTTypeEnvFillInFontReq
 *		XSTTextNew
 *		XSTTextSetText
 *		XSTTextGetText
 * Calls:       GetIconvFromCodeWLocEnc pointer via glue
 *		GetBytesPerCharacterWLocEnc pointer via glue
 *
 * @iLocale:	locale to convert from. (Must be non-null).
 *
 * This function dlopens an Xst language library and returns the associated iconv 
 * FromCode.
 */
char *_XSTConvGetFromCodeWLocale(char *iLocale)
{
    struct XSTHandle *tmp     = Handles;

    while ( tmp != NULL )
    {
	if ( tmp->Locale )
	    if ( !strcmp ( tmp->Locale, iLocale ))
	    {
	        return tmp->FromCode;
	    }
	tmp = tmp->next;
    }
   
    tmp = (struct XSTHandle *) Xmalloc ( sizeof ( struct XSTHandle ));

    if ( tmp )
    {
        tmp->next = Handles;
	tmp->Locale = (char *)Xmalloc ( strlen ( iLocale ) + 1 );
	if ( tmp->Locale != NULL )
	{
	    STLanguage  lang;
	    STTerritory terr;

	    (void) strcpy ( tmp->Locale, iLocale );
            ParsePosixLocale ( iLocale, &lang, &terr, &tmp->encoding );
            XSTEncodingGetInfo ( tmp->encoding, &tmp->FromCode, &tmp->bytes, NULL );
	    tmp->locale = ST_LOCALE2 ( terr, lang );
	    Handles = tmp;
        }
    }

    return tmp->FromCode;
}

char *_XSTConvGetFromCodeWEncoding ( XSTEncoding iEnc )
{
    struct XSTHandle *tmp     = Handles;

    while ( tmp != NULL )
    {
	if ( tmp->encoding, iEnc )
	{
	    return tmp->FromCode;
	}
	tmp = tmp->next;
    }
   
    tmp = (struct XSTHandle *) Xmalloc ( sizeof ( struct XSTHandle ));

    if ( tmp )
    {
	STLanguage  lang;
	STTerritory terr;

        tmp->next = Handles;
	tmp->encoding = iEnc;
	tmp->Locale = NULL;
        XSTEncodingGetInfo ( tmp->encoding, &tmp->FromCode, &tmp->bytes, NULL );
	tmp->locale = ST_LOCALE2 ( terr, lang );
	Handles = tmp;
    }

    return tmp->FromCode;
}


/* **********************************************************************************
 * _XSTConvGetBytesPerCharacter(char *)
 *
 * Returns:     Number of bytes per glyph
 * Called by:   
 * Calls:       NONE
 *
 * @iFromCode:	FromCode string received by previous function.
 *
 * This function dlopens an Xst language list library. It uses the list to find the
 * language libraries to open and searches each for the FromCode that matches the
 * iLocale/iEncoding pair. Currently this function is uncalled as the alternate
 * method using iLocale is preferred.
 */
XSTCount _XSTConvGetBytesPerCharacter(char *iFromCode)
{
    struct XSTHandle *tmp = Handles;

    /*
     * We need to have loaded the library already (the iFromCode guarantees it).
     */
    while ( tmp != NULL )
	if ( !strcmp ( tmp->FromCode, iFromCode ))
	{
	    return tmp->bytes;
	}
	else
	    tmp = tmp->next;

    return 0;
}

/* **********************************************************************************
 * _XSTConvGetEncoding(char *)
 *
 * Returns:     Encoding value
 * Called by:   
 * Calls:       NONE
 *
 * @iFromCode:	FromCode string received by previous function.
 *
 * This function dlopens an Xst language list library. It uses the list to find the
 * language libraries to open and searches each for the FromCode that matches the
 * iLocale/iEncoding pair. Currently this function is uncalled as the alternate
 * method using iLocale is preferred.
 */
XSTEncoding _XSTConvGetEncoding(char *iFromCode)
{
    struct XSTHandle *tmp = Handles;

    /*
     * We need to have loaded the library already (the iFromCode guarantees it).
     */
    while ( tmp != NULL )
	if ( !strcmp ( tmp->FromCode, iFromCode ))
	{
	    return tmp->encoding;
	}
	else
	    tmp = tmp->next;

    return 0;
}

/* **********************************************************************************
 * _XSTConvGetPModified()
 *
 * Returns:     Value of pModified
 * Called by:   
 * Calls:       NONE
 *
 * This function returns the value of pModified. This lets the caller know whether to 
 * decrement the pointer to the utf16 string.
 */
int _XSTConvGetPModified()
{
    return pModified;
}

/* **********************************************************************************
 * _XSTConvGetLocale(char *)
 *
 * Returns:     XSTLocale
 * Called by:   
 * Calls:       NONE
 *
 * @iFromCode:	FromCode string received by previous function.
 *
 * This function returns the list of language IDs to use to search the XSTNameTags
 */
XSTLocale _XSTConvGetLocale(char *iFromCode)
{
    struct XSTHandle *tmp = Handles;

    /*
     * We need to have loaded the library already (the iFromCode guarantees it).
     */
    while ( tmp != NULL )
	if ( !strcmp ( tmp->FromCode, iFromCode ))
	{
	    return tmp->locale;
	}
	else
	    tmp = tmp->next;

    return ST_LOCALE2 ( ST_TERRITORY_UNITED_STATES, ST_LANGUAGE_ENGLISH );
}


/* **********************************************************************************
 * XSTGetEncoding(char *)
 *
 * Returns:     XSTEncoding
 * Called by:   
 * Calls:       NONE
 *
 * @iLocale:	Locale string received from setlocale() or user defined.
 *
 * This function returns the XSTEncoding value correlating to the locale string
 */
XSTEncoding _XSTGetEncoding(char *iLocale)
{
    XSTEncoding      oEnc = XST_ENCODING_UTF8;
    STLanguage       lang;
    STTerritory      terr;
    struct XSTHandle *tmp = Handles;

    while ( tmp != NULL )
    {
	if ( (tmp->Locale != NULL) && !strcmp ( tmp->Locale, iLocale ))
	{
	    return tmp->encoding;
	}
	tmp = tmp->next;
    }

    ParsePosixLocale ( iLocale, &lang, &terr, &oEnc );

    return oEnc;
}

--- NEW FILE: Xst_conv.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_env.c ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
[...2180 lines suppressed...]

        oFont = reply.Font;

        UnlockDisplay ( dpy );
        SyncHandle ();
    }
    else
    {
	STStatus st = STTypeEnvFindFontBySignature ( (STTypeEnv)iEnv, 
						     iSignature, 
                                       		     (STFont *)&oFont );

        if ( st != ST_OK )
	    XST_Error ( dpy, X_STTypeEnvFindFontBySignature, st );
    }
#endif

    return oFont;
}


--- NEW FILE: Xst_env.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_ext.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_ext.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_font.c ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
[...1487 lines suppressed...]
        SyncHandle ();
    }
    else
    {
	STStatus st = STFontGetSignature ( (STTypeEnv)iEnv, (STFont)iFont, 
					   &oByte );

        if ( st != ST_OK )
	    XST_Error ( dpy, X_STFontGetSignature, st );
    }
#endif
    return oByte;
}


STGlyph
XSTFontMapChar ( XSTTypeEnv iEnv, XSTFont iFont, char *iCh )
{
}


--- NEW FILE: Xst_font.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_fontpath.h ---
#define XST_SET_FONT_PATH	1
#define XST_ADD_FONT_PATH	2
#define XST_REMOVE_FONT_PATH	3

--- NEW FILE: Xst_gc.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_gc.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_glyph.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_glyph.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_layout.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_layoutengine.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_line.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_line.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_private.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_scaler.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_scaler.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_space.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_space.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_string.c ---
/*
 * Copyright  2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
[...991 lines suppressed...]

    return bytes;
}

/* **********************************************************************************
 * XSTStringLength(char *, XSTEncoding)
 *
 * @iString:		string of characters
 * @iEnc		encoding of string
 *
 * Returns:     XSTCount number of bytes in the string
 * Called by:
 * Calls:       NONE
 *
 * This function returns the number of bytes in the string.
 */
XSTCount XSTStringLength(char *iString, XSTEncoding iEnc)
{
    return ( _mblength ( iString, BYTES, iEnc ));
}

--- NEW FILE: Xst_string.h ---
/*
 * Copyright  2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
 * This software is provided "AS IS," without a warranty of any kind.
 *
 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
 * SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES OR
 * LIABILITIES  SUFFERED BY LICENSEE AS A RESULT OF  OR RELATING TO USE,
 * MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS DERIVATIVES.
 * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE,
 * PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
 * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE
 * THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE
 * SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 *
 * You acknowledge that this software is not designed, licensed or intended
 * for use in the design, construction, operation or maintenance of any
 * nuclear facility.
 *
 */

/* @(#)Xst_string.h	1.9 03/06/28 SMI */

#ifndef _XSTSTRING_H
#define _XSTSTRING_H

/******************************** XSTString General Defines *************************/

/******************************* XSTConv Function Prototypes ************************/

/** @defgroup String XSTString functions
 * @{
 */

/**
 * Returns the number of bytes in iString
 *
 * @param iString		pointer to string of characters
 * @param iEnc			Encoding of string. see Xst_enum.h for encoding types
 * @param iNumCharacters	Number of characters in the string.
 *
 * @return number of bytes
 */
XSTCount XSTStringCountBytes(char       *iString, 
		             XSTCount    iNumCharacters,
		             XSTEncoding iEnc);


/**
 * Returns the number of characters in iString
 *
 * @param iString		pointer to string of characters
 * @param iEnc			Encoding of string. see Xst_enum.h for encoding types
 * @param iNumBytes		Number of bytes in the string.
 *
 * @return number of characters
 */
XSTCount XSTStringCountCharacters(char       *iString, 
			          XSTCount    iNumBytes,
			          XSTEncoding iEnc);

/** 
 * @}  
 */
#endif

--- NEW FILE: Xst_style.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_style.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_text.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_text.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_typedef.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_util.c ---
/*
 * Copyright 2001, 2002, Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
 * This software is provided "AS IS," without a warranty of any kind.
 *
 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
 * SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES OR
 * LIABILITIES  SUFFERED BY LICENSEE AS A RESULT OF  OR RELATING TO USE,
 * MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS DERIVATIVES.
 * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE,
 * PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
 * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE
 * THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE
 * SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 *
 * You acknowledge that this software is not designed, licensed or intended
 * for use in the design, construction, operation or maintenance of any
 * nuclear facility.
 *
 */

/* @(#)Xst_util.c	1.2	03/10/23 SMI */

#include "Xlibint.h"
#include <errno.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xproto.h>
#include <string.h>
#include <stdio.h>
#include <locale.h>
#include "Xst_typedef.h"
#include "Xst_conv.h"

/******************************** General support structures ************************/

/********************************** Static Local Variables **************************/

/********************************* XSTConv Static Functions *************************/

/* **********************************************************************************
 * XSTGetEncoding(char *)
 *
 * Returns:     XSTEncoding
 * Called by:   
 * Calls:       NONE
 *
 * @iLocale:	Locale string received from setlocale() or user defined.
 *
 * This function returns the XSTEncoding value correlating to the locale string
 */
XSTEncoding XSTGetEncoding(char *iLocale)
{
    return _XSTGetEncoding ( iLocale );
}

void XSTFree ( void *iMemory )
{
    free ( iMemory );
}

void XST_Error ( Display *dpy, int iFunc, STStatus iError )
{
    xError rep;

    rep.errorCode  = iError + 20;
    rep.minorCode  = iFunc;
    rep.resourceID = 0;
    rep.majorCode  = 182;
    _XError ( dpy, (xError *)&rep );      
}


--- NEW FILE: Xst_util.h ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_xlib.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: Xst_xlib.h ---
(This appears to be a binary file; contents omitted.)




More information about the xorg-commit-diffs mailing list