dtudcfonted, dtudcexch: delete from repository

This commit is contained in:
Jon Trulson
2018-06-27 18:05:34 -06:00
parent 53086aa9df
commit e0036e6167
122 changed files with 0 additions and 58123 deletions

View File

@@ -1,84 +0,0 @@
XCOMM $XConsortium: Imakefile /main/16 1996/09/09 11:45:13 drk $
#define DoNormalLib YES
#define DoSharedLib NO
#define DoDebugLib NO
#define DoProfileLib NO
#define LibName fal
#define LibHeaders NO
#define LibInstall NO
FALDESTDIR = $(CDE_INSTALLATION_TOP)
FONTLIST = config
XLOCALEDIR = $(XPROJECTROOT)/lib/X11/locale
XFONTDIR = $(XPROJECTROOT)/lib/X11/fonts
UDCFONTPATH = $(XFONTDIR)/misc
FALOPT1 = -DDTUDCFONTPATH='"'$(XFONTDIR)/misc'"'
FALOPT2 = -DXLOCALEDIR='"'$(XLOCALEDIR)'"'
FALOPT3 = -DDTUDCFONTSLISTDIR='"'$(FALDESTDIR)/$(FONTLIST)'"'
#ifdef X11ProjectRoot
OPT2 = -DFONTC='"'$(XPROJECTROOT)/bin/bdftopcf'"'
#else
OPT2 = -DFONTC='"'$(BINDIR)/bdftopcf'"'
#endif
DEPEND_DEFINES = $(DEPENDDEFINES)
DEFINES = $(FALOPT1) $(FALOPT2) $(OPT2) $(FALOPT3)
UDC_INC_PATH1 = -I./include
UDC_INC_PATH2 = -I../include
UDC_INC_PATH3 = -I./
INCLUDES = \
$(UDC_INC_PATH1)\
$(UDC_INC_PATH2)\
$(UDC_INC_PATH3)
SRCS1 = falfont.c readpcf.c \
syncx.c
SRCS2 = _faludcInf.c \
_fallcCT.c _fallcCharSet.c _fallcConv.c _fallcDB.c \
_fallcDefConv.c _fallcDynamic.c _fallcEuc.c _fallcFile.c \
_fallcGenConv.c _fallcGeneric.c _fallcInit.c _fallcPrTxt.c \
_fallcPubWrap.c _fallcPublic.c _fallcRM.c _fallcSjis.c \
_fallcStd.c _fallcTxtPr.c _fallcUTF.c _fallcUtil.c \
_fallcWrap.c \
_falomGeneric.c _falQuarks.c _falSetLocale.c _falrm.c
SRCS3 = _falutilbitmap.c
SRCS = $(SRCS1) $(SRCS2) $(SRCS3)
OBJS = falfont.o readpcf.o \
syncx.o \
_faludcInf.o \
_fallcCT.o _fallcCharSet.o _fallcConv.o _fallcDB.o \
_fallcDefConv.o _fallcDynamic.o _fallcEuc.o _fallcFile.o \
_fallcGenConv.o _fallcGeneric.o _fallcInit.o _fallcPrTxt.o \
_fallcPubWrap.o _fallcPublic.o _fallcRM.o _fallcSjis.o \
_fallcStd.o _fallcTxtPr.o _fallcUTF.o _fallcUtil.o \
_fallcWrap.o _falomGeneric.o _falQuarks.o _falSetLocale.o \
_falrm.o \
_falutilbitmap.o
all::
$(RM) fonts.list;\
$(CP) ./fonts.list.header ./fonts.list ;\
chmod ug+w fonts.list;\
key=`echo $(UDCFONTPATH) | sed -e 's/:/ /g'` ; \
for dir in $$key ; \
do \
echo $$dir: >> ./fonts.list ;\
done
#include <Library.tmpl>
install::
if [ -d $(DESTDIR)/$(FALDESTDIR)/$(FONTLIST) ]; then set +x; \
else (set -x; $(MKDIRHIER) $(DESTDIR)/$(FALDESTDIR)/$(FONTLIST)); fi ; \
(set -x ; $(CP) ./fonts.list $(DESTDIR)/$(FALDESTDIR)/$(FONTLIST) ; \
chmod 0644 $(DESTDIR)/$(FALDESTDIR)/$(FONTLIST)/fonts.list )
DependTarget()

View File

@@ -1,456 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* Quarks.c 1.1 - Fujitsu source for CDEnext 95/11/06 20:31:17 */
/* $XConsortium: _falQuarks.c /main/2 1996/09/09 13:20:21 rswiston $ */
/***********************************************************
Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard,
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
Copyright (c) 1987, 1988, 1990 X Consortium
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 X CONSORTIUM 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 name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
*/
#include "_fallibint.h"
#include <X11/Xresource.h>
/* Not cost effective, at least for vanilla MIT clients */
/* #define PERMQ */
typedef unsigned long Signature;
typedef unsigned long Entry;
#ifdef PERMQ
typedef unsigned char Bits;
#endif
static XrmQuark nextQuark = 1; /* next available quark number */
static unsigned long quarkMask = 0;
static Entry zero = 0;
static Entry *quarkTable = &zero; /* crock */
static unsigned long quarkRehash;
static XrmString **stringTable = NULL;
#ifdef PERMQ
static Bits **permTable = NULL;
#endif
static XrmQuark nextUniq = -1; /* next quark from falrmUniqueQuark */
#define QUANTUMSHIFT 8
#define QUANTUMMASK ((1 << QUANTUMSHIFT) - 1)
#define CHUNKPER 8
#define CHUNKMASK ((CHUNKPER << QUANTUMSHIFT) - 1)
#define LARGEQUARK ((Entry)0x80000000L)
#define QUARKSHIFT 18
#define QUARKMASK ((LARGEQUARK - 1) >> QUARKSHIFT)
#define XSIGMASK ((1L << QUARKSHIFT) - 1)
#define STRQUANTSIZE (sizeof(XrmString) * (QUANTUMMASK + 1))
#ifdef PERMQ
#define QUANTSIZE (STRQUANTSIZE + \
(sizeof(Bits) * ((QUANTUMMASK + 1) >> 3))
#else
#define QUANTSIZE STRQUANTSIZE
#endif
#define HASH(sig) ((sig) & quarkMask)
#define REHASHVAL(sig) ((((sig) % quarkRehash) + 2) | 1)
#define REHASH(idx,rehash) ((idx + rehash) & quarkMask)
#define NAME(q) stringTable[(q) >> QUANTUMSHIFT][(q) & QUANTUMMASK]
#ifdef PERMQ
#define BYTEREF(q) permTable[(q) >> QUANTUMSHIFT][((q) & QUANTUMMASK) >> 3]
#define ISPERM(q) (BYTEREF(q) & (1 << ((q) & 7)))
#define SETPERM(q) BYTEREF(q) |= (1 << ((q) & 7))
#define CLEARPERM(q) BYTEREF(q) &= ~(1 << ((q) & 7))
#endif
/* Permanent memory allocation */
#define WALIGN sizeof(unsigned long)
#define DALIGN sizeof(double)
#define NEVERFREETABLESIZE ((8192-12) & ~(DALIGN-1))
static char *neverFreeTable = NULL;
static int neverFreeTableSize = 0;
static char *permalloc(length)
register unsigned int length;
{
char *ret;
if (neverFreeTableSize < length) {
if (length >= NEVERFREETABLESIZE)
return Xmalloc(length);
if (! (ret = Xmalloc(NEVERFREETABLESIZE)))
return (char *) NULL;
neverFreeTableSize = NEVERFREETABLESIZE;
neverFreeTable = ret;
}
ret = neverFreeTable;
neverFreeTable += length;
neverFreeTableSize -= length;
return(ret);
}
#ifndef WORD64
typedef struct {char a; double b;} TestType1;
typedef struct {char a; unsigned long b;} TestType2;
#endif
#ifdef XTHREADS
static char *_falpermalloc();
char *falpermalloc(length)
unsigned int length;
{
char *p;
_XLockMutex(_Xglobal_lock);
p = _falpermalloc(length);
_XUnlockMutex(_Xglobal_lock);
return p;
}
#define falpermalloc _falpermalloc
static
#endif /* XTHREADS */
char *falpermalloc(length)
unsigned int length;
{
int i;
if (neverFreeTableSize && length < NEVERFREETABLESIZE) {
#ifndef WORD64
if ((sizeof(TestType1) !=
(sizeof(TestType2) - sizeof(unsigned long) + sizeof(double))) &&
!(length & (DALIGN-1)) &&
(i = (NEVERFREETABLESIZE - neverFreeTableSize) & (DALIGN-1))) {
neverFreeTableSize -= DALIGN - i;
neverFreeTable += DALIGN - i;
} else
#endif
if (i = (NEVERFREETABLESIZE - neverFreeTableSize) & (WALIGN-1)) {
neverFreeTableSize -= WALIGN - i;
neverFreeTable += WALIGN - i;
}
}
return permalloc(length);
}
static Bool
ExpandQuarkTable()
{
unsigned long oldmask, newmask;
register char c, *s;
register Entry *oldentries, *entries;
register Entry entry;
register int oldidx, newidx, rehash;
Signature sig;
XrmQuark q;
oldentries = quarkTable;
if (oldmask = quarkMask)
newmask = (oldmask << 1) + 1;
else {
if (!stringTable) {
stringTable = (XrmString **)Xmalloc(sizeof(XrmString *) *
CHUNKPER);
if (!stringTable)
return False;
stringTable[0] = (XrmString *)NULL;
}
#ifdef PERMQ
if (!permTable)
permTable = (Bits **)Xmalloc(sizeof(Bits *) * CHUNKPER);
if (!permTable)
return False;
#endif
stringTable[0] = (XrmString *)falpermalloc(QUANTSIZE);
if (!stringTable[0])
return False;
#ifdef PERMQ
permTable[0] = (Bits *)((char *)stringTable[0] + STRQUANTSIZE);
#endif
newmask = 0x1ff;
}
entries = (Entry *)Xmalloc(sizeof(Entry) * (newmask + 1));
if (!entries)
return False;
bzero((char *)entries, sizeof(Entry) * (newmask + 1));
quarkTable = entries;
quarkMask = newmask;
quarkRehash = quarkMask - 2;
for (oldidx = 0; oldidx <= oldmask; oldidx++) {
if (entry = oldentries[oldidx]) {
if (entry & LARGEQUARK)
q = entry & (LARGEQUARK-1);
else
q = (entry >> QUARKSHIFT) & QUARKMASK;
for (sig = 0, s = NAME(q); c = *s++; )
sig = (sig << 1) + c;
newidx = HASH(sig);
if (entries[newidx]) {
rehash = REHASHVAL(sig);
do {
newidx = REHASH(newidx, rehash);
} while (entries[newidx]);
}
entries[newidx] = entry;
}
}
if (oldmask)
Xfree((char *)oldentries);
return True;
}
#if NeedFunctionPrototypes
XrmQuark _falrmInternalStringToQuark(
register _Xconst char *name, register int len, register Signature sig,
Bool permstring)
#else
XrmQuark _falrmInternalStringToQuark(name, len, sig, permstring)
register XrmString name;
register int len;
register Signature sig;
Bool permstring;
#endif
{
register XrmQuark q;
register Entry entry;
register int idx, rehash;
register int i;
register char *s1, *s2;
char *new;
rehash = 0;
idx = HASH(sig);
_XLockMutex(_Xglobal_lock);
while (entry = quarkTable[idx]) {
if (entry & LARGEQUARK)
q = entry & (LARGEQUARK-1);
else {
if ((entry - sig) & XSIGMASK)
goto nomatch;
q = (entry >> QUARKSHIFT) & QUARKMASK;
}
for (i = len, s1 = (char *)name, s2 = NAME(q); --i >= 0; ) {
if (*s1++ != *s2++)
goto nomatch;
}
if (*s2) {
nomatch: if (!rehash)
rehash = REHASHVAL(sig);
idx = REHASH(idx, rehash);
continue;
}
#ifdef PERMQ
if (permstring && !ISPERM(q)) {
Xfree(NAME(q));
NAME(q) = (char *)name;
SETPERM(q);
}
#endif
_XUnlockMutex(_Xglobal_lock);
return q;
}
if (nextUniq == nextQuark)
goto fail;
if ((nextQuark + (nextQuark >> 2)) > quarkMask) {
if (!ExpandQuarkTable())
goto fail;
_XUnlockMutex(_Xglobal_lock);
return _falrmInternalStringToQuark(name, len, sig, permstring);
}
q = nextQuark;
if (!(q & QUANTUMMASK)) {
if (!(q & CHUNKMASK)) {
if (!(new = Xrealloc((char *)stringTable,
sizeof(XrmString *) *
((q >> QUANTUMSHIFT) + CHUNKPER))))
goto fail;
stringTable = (XrmString **)new;
#ifdef PERMQ
if (!(new = Xrealloc((char *)permTable,
sizeof(Bits *) *
((q >> QUANTUMSHIFT) + CHUNKPER))))
goto fail;
permTable = (Bits **)new;
#endif
}
new = falpermalloc(QUANTSIZE);
if (!new)
goto fail;
stringTable[q >> QUANTUMSHIFT] = (XrmString *)new;
#ifdef PERMQ
permTable[q >> QUANTUMSHIFT] = (Bits *)(new + STRQUANTSIZE);
#endif
}
if (!permstring) {
s2 = (char *)name;
#ifdef PERMQ
name = Xmalloc(len+1);
#else
name = permalloc(len+1);
#endif
if (!name)
goto fail;
for (i = len, s1 = (char *)name; --i >= 0; )
*s1++ = *s2++;
*s1++ = '\0';
#ifdef PERMQ
CLEARPERM(q);
}
else {
SETPERM(q);
#endif
}
NAME(q) = (char *)name;
if (q <= QUARKMASK)
entry = (q << QUARKSHIFT) | (sig & XSIGMASK);
else
entry = q | LARGEQUARK;
quarkTable[idx] = entry;
nextQuark++;
_XUnlockMutex(_Xglobal_lock);
return q;
fail:
_XUnlockMutex(_Xglobal_lock);
return NULLQUARK;
}
#if NeedFunctionPrototypes
XrmQuark falrmStringToQuark(
_Xconst char *name)
#else
XrmQuark falrmStringToQuark(name)
XrmString name;
#endif
{
register char c, *tname;
register Signature sig = 0;
if (!name)
return (NULLQUARK);
for (tname = (char *)name; c = *tname++; )
sig = (sig << 1) + c;
return _falrmInternalStringToQuark(name, tname-(char *)name-1, sig, False);
}
#if NeedFunctionPrototypes
XrmQuark falrmPermStringToQuark(
_Xconst char *name)
#else
XrmQuark falrmPermStringToQuark(name)
XrmString name;
#endif
{
register char c, *tname;
register Signature sig = 0;
if (!name)
return (NULLQUARK);
for (tname = (char *)name; c = *tname++; )
sig = (sig << 1) + c;
return _falrmInternalStringToQuark(name, tname-(char *)name-1, sig, True);
}
XrmQuark falrmUniqueQuark()
{
XrmQuark q;
_XLockMutex(_Xglobal_lock);
if (nextUniq == nextQuark)
q = NULLQUARK;
else
q = nextUniq--;
_XUnlockMutex(_Xglobal_lock);
return q;
}
XrmString falrmQuarkToString(quark)
register XrmQuark quark;
{
XrmString s;
_XLockMutex(_Xglobal_lock);
if (quark <= 0 || quark >= nextQuark)
s = NULLSTRING;
else {
#ifdef PERMQ
/* We have to mark the quark as permanent, since the caller might hold
* onto the string pointer forver.
*/
SETPERM(quark);
#endif
s = NAME(quark);
}
_XUnlockMutex(_Xglobal_lock);
return s;
}

View File

@@ -1,242 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* SetLocale.c 1.1 - Fujitsu source for CDEnext 95/11/06 20:31:29 */
/* $XConsortium: _falSetLocale.c /main/1 1996/04/08 15:15:08 cde-fuj $ */
/*
* Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation,
* and Nippon Telegraph and Telephone Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the names of OMRON, NTT Software, and NTT
* not be used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. OMRON, NTT Software,
* and NTT make no representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* OMRON, NTT SOFTWARE, AND NTT, DISCLAIM ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL OMRON, NTT SOFTWARE, OR NTT, BE
* LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Authors: Li Yuhong OMRON Corporation
* Tetsuya Kato NTT Software Corporation
* Hiroshi Kuribayashi OMRON Corporation
*
*/
/*
Copyright (c) 1987 X Consortium
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 X CONSORTIUM 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 name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
*/
#include "_fallibint.h"
#include "_fallcint.h"
#include <X11/Xlocale.h>
#include <X11/Xos.h>
#ifdef X_LOCALE
/* alternative setlocale() for when the OS does not provide one */
#ifdef X_NOT_STDC_ENV
extern char *getenv();
#endif
#define MAXLOCALE 64 /* buffer size of locale name */
#if NeedFunctionPrototypes
char *
_falsetlocale(
int category,
_Xconst char *name
)
#else
char *
_falsetlocale(category, name)
int category;
char *name;
#endif
{
static char *xsl_name;
char *old_name;
XrmMethods methods;
XPointer state;
if (category != LC_CTYPE && category != LC_ALL)
return NULL;
if (!name) {
if (xsl_name)
return xsl_name;
return "C";
}
if (!*name)
name = getenv("LC_CTYPE");
if (!name || !*name)
name = getenv("LANG");
if (!name || !*name)
name = "C";
old_name = xsl_name;
xsl_name = (char *)name;
methods = _falrmInitParseInfo(&state);
xsl_name = old_name;
if (!methods)
return NULL;
name = (*methods->lcname)(state);
xsl_name = Xmalloc(strlen(name) + 1);
if (!xsl_name) {
xsl_name = old_name;
(*methods->destroy)(state);
return NULL;
}
strcpy(xsl_name, name);
if (old_name)
Xfree(old_name);
(*methods->destroy)(state);
return xsl_name;
}
#else /* X_LOCALE */
/*
* _fallcMapOSLocaleName is an implementation dependent routine that derives
* the LC_CTYPE locale name as used in the sample implementation from that
* returned by setlocale.
* Should match the code in Xt ExtractLocaleName.
*/
char *
_fallcMapOSLocaleName(osname, siname)
char *osname;
char *siname;
{
#if defined(hpux) || defined(CSRG_BASED) || defined(sun) || defined(SVR4) || defined(sgi) || defined(AIXV3) || defined(ultrix) || defined(WIN32)
#ifdef hpux
#define SKIPCOUNT 2
#define STARTCHAR ':'
#define ENDCHAR ';'
#else
#ifdef ultrix
#define SKIPCOUNT 2
#define STARTCHAR '\001'
#define ENDCHAR '\001'
#else
#ifdef WIN32
#define SKIPCOUNT 1
#define STARTCHAR '='
#define ENDCHAR ';'
#define WHITEFILL
#else
#if defined(AIXV3)
#define STARTCHAR ' '
#define ENDCHAR ' '
#else
#if !defined(sun) || defined(SVR4)
#define STARTCHAR '/'
#endif
#define ENDCHAR '/'
#endif
#endif
#endif
#endif
char *start;
char *end;
int len;
#ifdef SKIPCOUNT
int n;
#endif
start = osname;
#ifdef SKIPCOUNT
for (n = SKIPCOUNT;
--n >= 0 && start && (start = strchr (start, STARTCHAR));
start++)
;
if (!start)
start = osname;
#endif
#ifdef STARTCHAR
if (start && (start = strchr (start, STARTCHAR))) {
start++;
#endif
if (end = strchr (start, ENDCHAR)) {
len = end - start;
strncpy(siname, start, len);
*(siname + len) = '\0';
#ifdef WHITEFILL
for (start = siname; start = strchr(start, ' '); )
*start++ = '-';
#endif
return siname;
#ifdef STARTCHAR
}
#endif
}
#ifdef WHITEFILL
if (strchr(osname, ' ')) {
strcpy(siname, osname);
for (start = siname; start = strchr(start, ' '); )
*start++ = '-';
return siname;
}
#endif
#undef STARTCHAR
#undef ENDCHAR
#undef WHITEFILL
#endif
return osname;
}
#endif /* X_LOCALE */

View File

@@ -1,906 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* lcCT.c 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:33 */
/* $XConsortium: _fallcCT.c /main/1 1996/04/08 15:15:33 cde-fuj $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of TOSHIBA not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. TOSHIBA make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
#include "_fallibint.h"
#include "_fallcPubI.h"
#include <X11/Xos.h>
#include <stdio.h>
typedef struct _StateRec {
XlcCharSet charset;
XlcCharSet GL_charset;
XlcCharSet GR_charset;
XlcCharSet ext_seg_charset;
int ext_seg_left;
} StateRec, *State;
typedef struct _CTDataRec {
char *name;
char *encoding; /* Compound Text encoding */
} CTDataRec, *CTData;
typedef struct _CTInfoRec {
XlcCharSet charset;
int encoding_len;
char *encoding; /* Compound Text encoding */
int ext_segment_len;
char *ext_segment; /* extended segment */
struct _CTInfoRec *next;
} CTInfoRec, *CTInfo;
static CTDataRec default_ct_data[] =
{
{ "ISO8859-1:GL", "\033(B" },
{ "ISO8859-1:GR", "\033-A" },
{ "ISO8859-2:GR", "\033-B" },
{ "ISO8859-3:GR", "\033-C" },
{ "ISO8859-4:GR", "\033-D" },
{ "ISO8859-7:GR", "\033-F" },
{ "ISO8859-6:GR", "\033-G" },
{ "ISO8859-8:GR", "\033-H" },
{ "ISO8859-5:GR", "\033-L" },
{ "ISO8859-9:GR", "\033-M" },
{ "JISX0201.1976-0:GL", "\033(J" },
{ "JISX0201.1976-0:GR", "\033)I" },
{ "GB2312.1980-0:GL", "\033$(A" },
{ "GB2312.1980-0:GR", "\033$)A" },
{ "JISX0208.1983-0:GL", "\033$(B" },
{ "JISX0208.1983-0:GR", "\033$)B" },
{ "KSC5601.1987-0:GL", "\033$(C" },
{ "KSC5601.1987-0:GR", "\033$)C" },
#ifdef notdef
{ "JISX0212.1990-0:GL", "\033$(D" },
{ "JISX0212.1990-0:GR", "\033$)D" },
{ "CNS11643.1986-1:GL", "\033$(G" },
{ "CNS11643.1986-1:GR", "\033$)G" },
{ "CNS11643.1986-2:GL", "\033$(H" },
{ "CNS11643.1986-2:GR", "\033$)H" },
/* Non-Standard Character Set Encodings */
{ "TIS620.2533-1:GR", "\033-T"},
#endif
} ;
#define XctC0 0x0000
#define XctHT 0x0009
#define XctNL 0x000a
#define XctESC 0x001b
#define XctGL 0x0020
#define XctC1 0x0080
#define XctCSI 0x009b
#define XctGR 0x00a0
#define XctCntrlFunc 0x0023
#define XctMB 0x0024
#define XctOtherCoding 0x0025
#define XctGL94 0x0028
#define XctGR94 0x0029
#define XctGR96 0x002d
#define XctNonStandard 0x002f
#define XctIgnoreExt 0x0030
#define XctNotIgnoreExt 0x0031
#define XctLeftToRight 0x0031
#define XctRightToLeft 0x0032
#define XctDirection 0x005d
#define XctDirectionEnd 0x005d
#define XctGL94MB 0x2428
#define XctGR94MB 0x2429
#define XctExtSeg 0x252f
#define XctOtherSeg 0x2f00
#define XctESCSeq 0x1b00
#define XctCSISeq 0x9b00
#define SKIP_I(str) while (*(str) >= 0x20 && *(str) <= 0x2f) (str)++;
#define SKIP_P(str) while (*(str) >= 0x30 && *(str) <= 0x3f) (str)++;
typedef struct {
XlcSide side;
int char_size;
int set_size;
int ext_seg_length;
int version;
CTInfo ct_info;
} CTParseRec, *CTParse;
static CTInfo ct_list = NULL;
static CTInfo
_XlcGetCTInfoFromEncoding(encoding, length)
register char *encoding;
register int length;
{
register CTInfo ct_info;
for (ct_info = ct_list; ct_info; ct_info = ct_info->next) {
if (length >= ct_info->encoding_len) {
if (ct_info->ext_segment) {
if (!strncmp(ct_info->encoding, encoding, 4) &&
!strncmp(ct_info->ext_segment, encoding + 6,
ct_info->ext_segment_len))
return ct_info;
} else if (!strncmp(ct_info->encoding, encoding,
ct_info->encoding_len)) {
return ct_info;
}
}
}
return (CTInfo) NULL;
}
static unsigned int
_XlcParseCT(parse, text, length)
register CTParse parse;
char **text;
int *length;
{
unsigned int ret = 0;
unsigned char ch;
register unsigned char *str = (unsigned char *) *text;
bzero((char *) parse, sizeof(CTParseRec));
switch (ch = *str++) {
case XctESC:
if (*str == XctOtherCoding && *(str + 1) == XctNonStandard
&& *(str + 2) >= 0x30 && *(str + 2) <= 0x3f && *length >= 6) {
/* non-standard encodings */
parse->side = XlcGLGR;
parse->set_size = 0;
str += 2;
if (*str <= 0x34) {
parse->char_size = *str - 0x30;
if (parse->char_size == 0) parse->char_size = 1;
ret = XctExtSeg;
parse->ct_info = _XlcGetCTInfoFromEncoding(*text, *length);
} else
ret = XctOtherSeg;
str++;
parse->ext_seg_length = (*str - 128) * 128 + *(str + 1) - 128;
str += 2;
goto done;
} else if (*str == XctCntrlFunc && *length >= 4 &&
*(str + 1) >= 0x20 && *(str + 1) <= 0x2f &&
(*(str + 2) == XctIgnoreExt ||
*(str + 2) == XctNotIgnoreExt)) {
/* ignore extension or not */
str++;
parse->version = *str++ - 0x20;
ret = *str++;
goto done;
}
if (*str == XctMB) { /* multiple-byte sets */
parse->char_size = 2;
str++;
} else
parse->char_size = 1;
switch (*str) {
case XctGL94:
parse->side = XlcGL;
parse->set_size = 94;
ret = (parse->char_size == 1) ? XctGL94 : XctGL94MB;
break;
case XctGR94:
parse->side = XlcGR;
parse->set_size = 94;
ret = (parse->char_size == 1) ? XctGR94 : XctGR94MB;
break;
case XctGR96:
if (parse->char_size == 1) {
parse->side = XlcGR;
parse->set_size = 96;
ret = XctGR96;
}
break;
}
if (ret) {
str++;
if (*str >= 0x24 && *str <= 0x2f) { /* non-standard */
ret = 0;
str++;
}
}
SKIP_I(str)
if (ret && *str < 0x40) /* non-standard */
ret = 0;
if (*str < 0x30 || *str > 0x7e || (char *) str - *text >= *length)
break;
if (ret == 0)
ret = XctESCSeq;
else {
if (parse->char_size == 2) {
if (*str >= 0x70)
parse->char_size = 4;
else if (*str >= 0x60)
parse->char_size = 3;
}
parse->ct_info = _XlcGetCTInfoFromEncoding(*text, *length);
}
str++;
goto done;
case XctCSI:
/* direction */
if (*str == XctLeftToRight && *(str + 1) == XctDirection) {
ret = XctLeftToRight;
str += 2;
goto done;
} else if (*str == XctRightToLeft && *(str + 1) == XctDirection) {
ret = XctRightToLeft;
str += 2;
goto done;
} else if (*str == XctDirectionEnd) {
ret = XctDirectionEnd;
str++;
goto done;
}
SKIP_P(str)
SKIP_I(str)
if (*str < 0x40 && *str > 0x7e)
break;
ret = XctCSISeq;
str++;
goto done;
}
if (ch & 0x80) {
if (ch < 0xa0)
ret = XctC1;
else
ret = XctGR;
} else {
if (ch == XctHT || ch == XctNL)
ret = ch;
else if (ch < 0x20)
ret = XctC0;
else
ret = XctGL;
}
return ret;
done:
*length -= (char *) str - *text;
*text = (char *) str;
return ret;
}
XlcCharSet
_fallcAddCT(name, encoding)
char *name;
char *encoding;
{
CTInfo ct_info;
XlcCharSet charset;
CTParseRec parse;
char *ct_ptr = encoding;
int length;
unsigned int type;
length = strlen(encoding);
switch (type = _XlcParseCT(&parse, &ct_ptr, &length)) {
case XctExtSeg:
case XctGL94:
case XctGL94MB:
case XctGR94:
case XctGR94MB:
case XctGR96:
if (parse.ct_info) /* existed */
return parse.ct_info->charset;
break;
default:
return (XlcCharSet) NULL;
}
charset = _fallcCreateDefaultCharSet(name, encoding);
if (charset == NULL)
return (XlcCharSet) NULL;
_fallcAddCharSet(charset);
ct_info = (CTInfo) Xmalloc(sizeof(CTInfoRec));
if (ct_info == NULL)
return (XlcCharSet) NULL;
ct_info->charset = charset;
ct_info->encoding = charset->ct_sequence;
ct_info->encoding_len = strlen(ct_info->encoding);
if (type == XctExtSeg) {
ct_info->ext_segment = ct_info->encoding + 6;
ct_info->ext_segment_len = strlen(ct_info->ext_segment);
} else {
ct_info->ext_segment = NULL;
ct_info->ext_segment_len = 0;
}
ct_info->next = ct_list;
ct_list = ct_info;
return charset;
}
static CTInfo
_XlcGetCTInfoFromCharSet(charset)
register XlcCharSet charset;
{
register CTInfo ct_info;
for (ct_info = ct_list; ct_info; ct_info = ct_info->next)
if (ct_info->charset == charset)
return ct_info;
return (CTInfo) NULL;
}
Bool
_fallcParseCharSet(charset)
XlcCharSet charset;
{
CTParseRec parse;
char *ptr, buf[BUFSIZ];
unsigned int type;
int length;
if (charset->ct_sequence == NULL)
return False;
ptr = charset->ct_sequence;
length = strlen(ptr);
type = _XlcParseCT(&parse, &ptr, &length);
if (charset->name) {
charset->xrm_name = falrmStringToQuark(charset->name);
snprintf(buf, sizeof(buf), "%s", charset->name);
if (ptr = strchr(buf, ':'))
*ptr = '\0';
charset->xrm_encoding_name = falrmStringToQuark(buf);
charset->encoding_name = falrmQuarkToString(charset->xrm_encoding_name);
} else {
charset->xrm_name = 0;
charset->encoding_name = NULL;
charset->xrm_encoding_name = 0;
}
charset->side = parse.side;
charset->char_size = parse.char_size;
charset->set_size = parse.set_size;
return True;
}
static void init_converter();
Bool
_fallcInitCTInfo()
{
register XlcCharSet charset;
register CTData ct_data;
register int num;
if (ct_list == NULL) {
num = sizeof(default_ct_data) / sizeof(CTDataRec);
for (ct_data = default_ct_data; num-- > 0; ct_data++) {
charset = _fallcAddCT(ct_data->name, ct_data->encoding);
if (charset == NULL)
continue;
}
init_converter();
}
return True;
}
static int
_XlcCheckCTSequence(state, ctext, ctext_len)
State state;
char **ctext;
int *ctext_len;
{
XlcCharSet charset;
CTParseRec parse;
CTInfo ct_info;
int length;
_XlcParseCT(&parse, ctext, ctext_len);
ct_info = parse.ct_info;
if (parse.ext_seg_length > 0) { /* XctExtSeg or XctOtherSeg */
if (ct_info) {
length = ct_info->ext_segment_len;
*ctext += length;
*ctext_len -= length;
state->ext_seg_left = parse.ext_seg_length - length;
state->ext_seg_charset = ct_info->charset;
} else {
state->ext_seg_left = parse.ext_seg_length;
state->ext_seg_charset = NULL;
}
} else if (ct_info) {
if (charset = ct_info->charset) {
if (charset->side == XlcGL)
state->GL_charset = charset;
else if (charset->side == XlcGR)
state->GR_charset = charset;
}
}
return 0;
}
static void
init_state(conv)
XlcConv conv;
{
State state = (State) conv->state;
static XlcCharSet GL_charset = NULL;
static XlcCharSet GR_charset = NULL;
if (GL_charset == NULL) {
GL_charset = _fallcGetCharSet("ISO8859-1:GL");
GR_charset = _fallcGetCharSet("ISO8859-1:GR");
}
state->GL_charset = state->charset = GL_charset;
state->GR_charset = GR_charset;
state->ext_seg_charset = NULL;
state->ext_seg_left = 0;
}
static int
cttocs(conv, from, from_left, to, to_left, args, num_args)
XlcConv conv;
XPointer *from;
int *from_left;
XPointer *to;
int *to_left;
XPointer *args;
int num_args;
{
register State state = (State) conv->state;
register unsigned char ch;
int length;
XlcCharSet charset = NULL;
char *ctptr, *bufptr;
int ctext_len, buf_len;
ctptr = *((char **) from);
bufptr = *((char **) to);
ctext_len = *from_left;
buf_len = *to_left;
while (ctext_len > 0 && buf_len > 0) {
if (state->ext_seg_left > 0) {
length = min(state->ext_seg_left, ctext_len);
length = min(length, buf_len);
ctext_len -= length;
state->ext_seg_left -= length;
if (state->ext_seg_charset) {
charset = state->ext_seg_charset;
buf_len -= length;
if (charset->side == XlcGL) {
while (length-- > 0)
*bufptr++ = *ctptr++ & 0x7f;
} else if (charset->side == XlcGR) {
while (length-- > 0)
*bufptr++ = *ctptr++ | 0x80;
} else {
while (length-- > 0)
*bufptr++ = *ctptr++;
}
if (state->ext_seg_left < 1)
state->ext_seg_charset = NULL;
}
break;
}
ch = *((unsigned char *) ctptr);
if (ch == 0x1b || ch == 0x9b) {
length = _XlcCheckCTSequence(state, &ctptr, &ctext_len);
if (length < 0)
return -1;
if (state->ext_seg_left > 0 && charset)
break;
} else {
if (charset) {
if (charset != (ch & 0x80 ? state->GR_charset :
state->GL_charset))
break;
} else
charset = ch & 0x80 ? state->GR_charset : state->GL_charset;
if ((ch < 0x20 && ch != '\0' && ch != '\n' && ch != '\t') ||
(ch >= 0x80 && ch < 0xa0))
return -1;
*bufptr++ = *ctptr++;
ctext_len--;
buf_len--;
}
}
if (charset)
state->charset = charset;
if (num_args > 0)
*((XlcCharSet *) args[0]) = state->charset;
*from_left -= ctptr - *((char **) from);
*from = (XPointer) ctptr;
*to_left -= bufptr - *((char **) to);
*to = (XPointer) bufptr;
return 0;
}
static int
cstoct(conv, from, from_left, to, to_left, args, num_args)
XlcConv conv;
XPointer *from;
int *from_left;
XPointer *to;
int *to_left;
XPointer *args;
int num_args;
{
State state = (State) conv->state;
XlcSide side;
unsigned char min_ch, max_ch;
register unsigned char ch;
int length;
CTInfo ct_info;
XlcCharSet charset;
char *csptr, *ctptr;
int csstr_len, ct_len;
if (num_args < 1)
return -1;
csptr = *((char **) from);
ctptr = *((char **) to);
csstr_len = *from_left;
ct_len = *to_left;
charset = (XlcCharSet) args[0];
ct_info = _XlcGetCTInfoFromCharSet(charset);
if (ct_info == NULL)
return -1;
side = charset->side;
if (ct_info->ext_segment) {
if (charset != state->ext_seg_charset && state->ext_seg_left < 1) {
length = ct_info->encoding_len;
if (ct_len < length)
return -1;
strcpy(ctptr, ct_info->encoding);
ctptr[4] = ((ct_info->ext_segment_len + csstr_len) / 128) | 0x80;
ctptr[5] = ((ct_info->ext_segment_len + csstr_len) % 128) | 0x80;
ctptr += length;
ct_len -= length;
state->ext_seg_left = csstr_len;
}
length = min(state->ext_seg_left, csstr_len);
state->ext_seg_left -= length;
if (side == XlcGL) {
while (length-- > 0)
*ctptr++ = *csptr++ & 0x7f;
} else if (side == XlcGR) {
while (length-- > 0)
*ctptr++ = *csptr++ | 0x80;
} else {
while (length-- > 0)
*ctptr++ = *csptr++;
}
state->ext_seg_charset = (state->ext_seg_left > 0) ? charset : NULL;
} else {
if ((side == XlcGR && charset != state->GR_charset) ||
(side == XlcGL && charset != state->GL_charset)) {
ct_len -= ct_info->encoding_len;
if (ct_len < 0)
return -1;
strcpy(ctptr, ct_info->encoding);
ctptr += ct_info->encoding_len;
}
min_ch = 0x20;
max_ch = 0x7f;
if (charset->set_size == 94) {
max_ch--;
if (charset->char_size > 1 || side == XlcGR)
min_ch++;
}
while (csstr_len > 0 && ct_len > 0) {
ch = *((unsigned char *) csptr++) & 0x7f;
if (ch < min_ch || ch > max_ch)
if (ch != 0x00 && ch != 0x09 && ch != 0x0a && ch != 0x1b)
continue; /* XXX */
if (side == XlcGL)
*ctptr++ = ch & 0x7f;
else if (side == XlcGR)
*ctptr++ = ch | 0x80;
else
*ctptr++ = ch;
csstr_len--;
ct_len--;
}
if (side == XlcGR)
state->GR_charset = charset;
else if (side == XlcGL)
state->GL_charset = charset;
}
*from_left -= csptr - *((char **) from);
*from = (XPointer) csptr;
*to_left -= ctptr - *((char **) to);
*to = (XPointer) ctptr;
return 0;
}
static int
strtocs(conv, from, from_left, to, to_left, args, num_args)
XlcConv conv;
XPointer *from;
int *from_left;
XPointer *to;
int *to_left;
XPointer *args;
int num_args;
{
State state = (State) conv->state;
register char *src, *dst;
unsigned char side;
register length;
src = (char *) *from;
dst = (char *) *to;
length = min(*from_left, *to_left);
side = *((unsigned char *) src) & 0x80;
while (side == (*((unsigned char *) src) & 0x80) && length-- > 0)
*dst++ = *src++;
*from_left -= src - (char *) *from;
*from = (XPointer) src;
*to_left -= dst - (char *) *to;
*to = (XPointer) dst;
if (num_args > 0)
*((XlcCharSet *)args[0]) = side ? state->GR_charset : state->GL_charset;
return 0;
}
static int
cstostr(conv, from, from_left, to, to_left, args, num_args)
XlcConv conv;
XPointer *from;
int *from_left;
XPointer *to;
int *to_left;
XPointer *args;
int num_args;
{
State state = (State) conv->state;
char *csptr, *string_ptr;
int csstr_len, str_len;
unsigned char ch;
int unconv_num = 0;
if (num_args < 1 || (state->GL_charset != (XlcCharSet) args[0] &&
state->GR_charset != (XlcCharSet) args[0]))
return -1;
csptr = *((char **) from);
string_ptr = *((char **) to);
csstr_len = *from_left;
str_len = *to_left;
while (csstr_len-- > 0 && str_len > 0) {
ch = *((unsigned char *) csptr++);
if ((ch < 0x20 && ch != 0x00 && ch != 0x09 && ch != 0x0a) ||
ch == 0x7f || ((ch & 0x80) && ch < 0xa0)) {
unconv_num++;
continue;
}
*((unsigned char *) string_ptr++) = ch;
str_len--;
}
*from_left -= csptr - *((char **) from);
*from = (XPointer) csptr;
*to_left -= string_ptr - *((char **) to);
*to = (XPointer) string_ptr;
return unconv_num;
}
static void
close_converter(conv)
XlcConv conv;
{
if (conv->state)
Xfree((char *) conv->state);
Xfree((char *) conv);
}
static XlcConv
create_conv(methods)
XlcConvMethods methods;
{
register XlcConv conv;
conv = (XlcConv) Xmalloc(sizeof(XlcConvRec));
if (conv == NULL)
return (XlcConv) NULL;
conv->state = (XPointer) Xmalloc(sizeof(StateRec));
if (conv->state == NULL)
goto err;
conv->methods = methods;
init_state(conv);
return conv;
err:
close_converter(conv);
return (XlcConv) NULL;
}
static XlcConvMethodsRec cttocs_methods = {
close_converter,
cttocs,
init_state
} ;
static XlcConv
open_cttocs(from_lcd, from_type, to_lcd, to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{
return create_conv(&cttocs_methods);
}
static XlcConvMethodsRec cstoct_methods = {
close_converter,
cstoct,
init_state
} ;
static XlcConv
open_cstoct(from_lcd, from_type, to_lcd, to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{
return create_conv(&cstoct_methods);
}
static XlcConvMethodsRec strtocs_methods = {
close_converter,
strtocs,
init_state
} ;
static XlcConv
open_strtocs(from_lcd, from_type, to_lcd, to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{
return create_conv(&strtocs_methods);
}
static XlcConvMethodsRec cstostr_methods = {
close_converter,
cstostr,
init_state
} ;
static XlcConv
open_cstostr(from_lcd, from_type, to_lcd, to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{
return create_conv(&cstostr_methods);
}
static void
init_converter()
{
_fallcSetConverter((XLCd) NULL, XlcNCompoundText, (XLCd) NULL, XlcNCharSet,
open_cttocs);
_fallcSetConverter((XLCd) NULL, XlcNString, (XLCd) NULL, XlcNCharSet,
open_strtocs);
_fallcSetConverter((XLCd) NULL, XlcNCharSet, (XLCd) NULL, XlcNCompoundText,
open_cstoct);
_fallcSetConverter((XLCd) NULL, XlcNCharSet, (XLCd) NULL, XlcNString,
open_cstostr);
}

View File

@@ -1,187 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* lcCharSet.c 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:33 */
/* $XConsortium: _fallcCharSet.c /main/1 1996/04/08 15:15:44 cde-fuj $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of TOSHIBA not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. TOSHIBA make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
#include <stdio.h>
#include "_fallibint.h"
#include "_fallcPublic.h"
#if NeedVarargsPrototypes
char *
_fallcGetCSValues(XlcCharSet charset, ...)
#else
char *
_fallcGetCSValues(charset, va_alist)
XlcCharSet charset;
va_dcl
#endif
{
va_list var;
XlcArgList args;
char *ret;
int num_args;
Va_start(var, charset);
_fallcCountVaList(var, &num_args);
va_end(var);
Va_start(var, charset);
_fallcVaToArgList(var, num_args, &args);
va_end(var);
if (args == (XlcArgList) NULL)
return (char *) NULL;
if (charset->get_values)
ret = (*charset->get_values)(charset, args, num_args);
else
ret = args->name;
Xfree(args);
return ret;
}
typedef struct _XlcCharSetListRec {
XlcCharSet charset;
struct _XlcCharSetListRec *next;
} XlcCharSetListRec, *XlcCharSetList;
static XlcCharSetList charset_list = NULL;
XlcCharSet
_fallcGetCharSet(name)
char *name;
{
XlcCharSetList list;
XrmQuark xrm_name;
xrm_name = falrmStringToQuark(name);
for (list = charset_list; list; list = list->next) {
if (xrm_name == list->charset->xrm_name)
return (XlcCharSet) list->charset;
}
return (XlcCharSet) NULL;
}
Bool
_fallcAddCharSet(charset)
XlcCharSet charset;
{
XlcCharSetList list;
if (_fallcGetCharSet(charset->name))
return False;
list = (XlcCharSetList) Xmalloc(sizeof(XlcCharSetListRec));
if (list == NULL)
return False;
list->charset = charset;
list->next = charset_list;
charset_list = list;
return True;
}
static XlcResource resources[] = {
{ XlcNName, NULLQUARK, sizeof(char *),
XOffsetOf(XlcCharSetRec, name), XlcGetMask },
{ XlcNEncodingName, NULLQUARK, sizeof(char *),
XOffsetOf(XlcCharSetRec, encoding_name), XlcGetMask },
{ XlcNSide, NULLQUARK, sizeof(XlcSide),
XOffsetOf(XlcCharSetRec, side), XlcGetMask },
{ XlcNCharSize, NULLQUARK, sizeof(int),
XOffsetOf(XlcCharSetRec, char_size), XlcGetMask },
{ XlcNSetSize, NULLQUARK, sizeof(int),
XOffsetOf(XlcCharSetRec, set_size), XlcGetMask },
{ XlcNControlSequence, NULLQUARK, sizeof(char *),
XOffsetOf(XlcCharSetRec, ct_sequence), XlcGetMask }
};
static char *
get_values(charset, args, num_args)
register XlcCharSet charset;
register XlcArgList args;
register int num_args;
{
if (resources[0].xrm_name == NULLQUARK)
_fallcCompileResourceList(resources, XlcNumber(resources));
return _fallcGetValues((XPointer) charset, resources, XlcNumber(resources),
args, num_args, XlcGetMask);
}
XlcCharSet
_fallcCreateDefaultCharSet(name, ct_sequence)
char *name;
char *ct_sequence;
{
XlcCharSet charset;
charset = (XlcCharSet) Xmalloc(sizeof(XlcCharSetRec));
if (charset == NULL)
return (XlcCharSet) NULL;
bzero((char *) charset, sizeof(XlcCharSetRec));
charset->name = (char *) Xmalloc(strlen(name) + strlen(ct_sequence) + 2);
if (charset->name == NULL) {
Xfree((char *) charset);
return (XlcCharSet) NULL;
}
strcpy(charset->name, name);
charset->ct_sequence = charset->name + strlen(name) + 1;
strcpy(charset->ct_sequence, ct_sequence);
charset->get_values = get_values;
_fallcParseCharSet(charset);
return (XlcCharSet) charset;
}

View File

@@ -1,356 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* lcConv.c 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:34 */
/* $XConsortium: _fallcConv.c /main/1 1996/04/08 15:15:57 cde-fuj $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of TOSHIBA not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. TOSHIBA make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
#include "_fallibint.h"
#include "_fallcPubI.h"
#include <stdio.h>
typedef XlcConv (*XlcConverter)();
typedef struct _fallcConverterListRec {
XLCd from_lcd;
char *from;
XrmQuark from_type;
XLCd to_lcd;
char *to;
XrmQuark to_type;
XlcConverter converter;
struct _fallcConverterListRec *next;
} XlcConverterListRec, *XlcConverterList;
static XlcConverterList conv_list = NULL;
static void
close_converter(conv)
XlcConv conv;
{
(*conv->methods->close)(conv);
}
static XlcConv
get_converter(from_lcd, from_type, to_lcd, to_type)
XLCd from_lcd;
XrmQuark from_type;
XLCd to_lcd;
XrmQuark to_type;
{
register XlcConverterList list, prev = NULL;
XlcConv conv;
for (list = conv_list; list; list = list->next) {
if (list->from_lcd == from_lcd && list->to_lcd == to_lcd
&& list->from_type == from_type && list->to_type == to_type) {
if (prev && prev != conv_list) { /* XXX */
prev->next = list->next;
list->next = conv_list;
conv_list = list;
}
return (*list->converter)(from_lcd, list->from, to_lcd, list->to);
}
prev = list;
}
return (XlcConv) NULL;
}
Bool
_fallcSetConverter(from_lcd, from, to_lcd, to, converter)
XLCd from_lcd;
char *from;
XLCd to_lcd;
char *to;
XlcOpenConverterProc converter;
{
register XlcConverterList list;
register XrmQuark from_type, to_type;
from_type = falrmStringToQuark(from);
to_type = falrmStringToQuark(to);
for (list = conv_list; list; list = list->next) {
if (list->from_lcd == from_lcd && list->to_lcd == to_lcd
&& list->from_type == from_type && list->to_type == to_type) {
list->converter = converter;
return True;
}
}
list = (XlcConverterList) Xmalloc(sizeof(XlcConverterListRec));
if (list == NULL)
return False;
list->from_lcd = from_lcd;
list->from = from;
list->from_type = from_type;
list->to_lcd = to_lcd;
list->to = to;
list->to_type = to_type;
list->converter = converter;
list->next = conv_list;
conv_list = list;
return True;
}
typedef struct _ConvRec {
XlcConv from_conv;
XlcConv to_conv;
} ConvRec, *Conv;
static int
indirect_convert(lc_conv, from, from_left, to, to_left, args, num_args)
XlcConv lc_conv;
XPointer *from;
int *from_left;
XPointer *to;
int *to_left;
XPointer *args;
int num_args;
{
Conv conv = (Conv) lc_conv->state;
XlcConv from_conv = conv->from_conv;
XlcConv to_conv = conv->to_conv;
XlcCharSet charset;
char buf[BUFSIZ], *cs;
XPointer tmp_args[1];
int cs_left, ret, length, unconv_num = 0;
if (from == NULL || *from == NULL) {
if (from_conv->methods->reset)
(*from_conv->methods->reset)(from_conv);
if (to_conv->methods->reset)
(*to_conv->methods->reset)(to_conv);
return 0;
}
while (*from_left > 0) {
cs = buf;
cs_left = BUFSIZ;
tmp_args[0] = (XPointer) &charset;
ret = (*from_conv->methods->convert)(from_conv, from, from_left, &cs,
&cs_left, tmp_args, 1);
if (ret < 0)
break;
length = cs_left = cs - buf;
cs = buf;
tmp_args[0] = (XPointer) charset;
ret = (*to_conv->methods->convert)(to_conv, &cs, &cs_left, to, to_left,
tmp_args, 1);
if (ret < 0) {
unconv_num += length / charset->char_size;
continue;
}
if (*to_left < 1)
break;
}
return unconv_num;
}
static void
close_indirect_converter(lc_conv)
XlcConv lc_conv;
{
Conv conv = (Conv) lc_conv->state;
if (conv) {
if (conv->from_conv)
close_converter(conv->from_conv);
if (conv->to_conv)
close_converter(conv->to_conv);
Xfree((char *) conv);
}
Xfree((char *) lc_conv);
}
static void
reset_indirect_converter(lc_conv)
XlcConv lc_conv;
{
Conv conv = (Conv) lc_conv->state;
if (conv) {
if (conv->from_conv && conv->from_conv->methods->reset)
(*conv->from_conv->methods->reset)(conv->from_conv);
if (conv->to_conv && conv->to_conv->methods->reset)
(*conv->to_conv->methods->reset)(conv->to_conv);
}
}
static XlcConvMethodsRec conv_methods = {
close_indirect_converter,
indirect_convert,
reset_indirect_converter
} ;
static XlcConv
open_indirect_converter(from_lcd, from, to_lcd, to)
XLCd from_lcd;
char *from;
XLCd to_lcd;
char *to;
{
XlcConv lc_conv, from_conv, to_conv;
Conv conv;
XrmQuark from_type, to_type;
static XrmQuark QChar, QCharSet, QCTCharSet = (XrmQuark) 0;
if (QCTCharSet == (XrmQuark) 0) {
QCTCharSet = falrmStringToQuark(XlcNCTCharSet);
QCharSet = falrmStringToQuark(XlcNCharSet);
QChar = falrmStringToQuark(XlcNChar);
}
from_type = falrmStringToQuark(from);
to_type = falrmStringToQuark(to);
if (from_type == QCharSet || from_type == QChar || to_type == QCharSet ||
to_type == QChar)
return (XlcConv) NULL;
lc_conv = (XlcConv) Xmalloc(sizeof(XlcConvRec));
if (lc_conv == NULL)
return (XlcConv) NULL;
lc_conv->methods = &conv_methods;
lc_conv->state = (XPointer) Xmalloc(sizeof(ConvRec));
if (lc_conv->state == NULL)
goto err;
conv = (Conv) lc_conv->state;
from_conv = get_converter(from_lcd, from_type, from_lcd, QCTCharSet);
if (from_conv == NULL)
from_conv = get_converter(from_lcd, from_type, from_lcd, QCharSet);
if (from_conv == NULL)
from_conv = get_converter((XLCd)NULL, from_type, (XLCd)NULL, QCharSet);
if (from_conv == NULL)
from_conv = get_converter(from_lcd, from_type, from_lcd, QChar);
if (from_conv == NULL)
goto err;
conv->from_conv = from_conv;
to_conv = get_converter(to_lcd, QCTCharSet, to_lcd, to_type);
if (to_conv == NULL)
to_conv = get_converter(to_lcd, QCharSet, to_lcd, to_type);
if (to_conv == NULL)
to_conv = get_converter((XLCd) NULL, QCharSet, (XLCd) NULL, to_type);
if (to_conv == NULL)
goto err;
conv->to_conv = to_conv;
return lc_conv;
err:
close_indirect_converter(lc_conv);
return (XlcConv) NULL;
}
XlcConv
_fallcOpenConverter(from_lcd, from, to_lcd, to)
XLCd from_lcd;
char *from;
XLCd to_lcd;
char *to;
{
XlcConv conv;
XrmQuark from_type, to_type;
from_type = falrmStringToQuark(from);
to_type = falrmStringToQuark(to);
if (conv = get_converter(from_lcd, from_type, to_lcd, to_type))
return conv;
return open_indirect_converter(from_lcd, from, to_lcd, to);
}
void
_fallcCloseConverter(conv)
XlcConv conv;
{
close_converter(conv);
}
int
_fallcConvert(conv, from, from_left, to, to_left, args, num_args)
XlcConv conv;
XPointer *from;
int *from_left;
XPointer *to;
int *to_left;
XPointer *args;
int num_args;
{
return (*conv->methods->convert)(conv, from, from_left, to, to_left, args,
num_args);
}
void
_fallcResetConverter(conv)
XlcConv conv;
{
if (conv->methods->reset)
(*conv->methods->reset)(conv);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,387 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* lcDefConv.c 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:35 */
/* $XConsortium: _fallcDefConv.c /main/1 1996/04/08 15:16:17 cde-fuj $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of TOSHIBA not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. TOSHIBA make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
#include "_fallibint.h"
#include "_fallcPubI.h"
typedef struct _StateRec {
XlcCharSet charset;
XlcCharSet GL_charset;
XlcCharSet GR_charset;
XlcConv ct_conv;
int (*to_converter)();
} StateRec, *State;
static int
strtostr(conv, from, from_left, to, to_left, args, num_args)
XlcConv conv;
XPointer *from;
int *from_left;
XPointer *to;
int *to_left;
XPointer *args;
int num_args;
{
register char *src, *dst;
unsigned char side;
register length;
if (from == NULL || *from == NULL)
return 0;
src = (char *) *from;
dst = (char *) *to;
length = min(*from_left, *to_left);
if (num_args > 0) {
side = *((unsigned char *) src) & 0x80;
while (side == (*((unsigned char *) src) & 0x80) && length-- > 0)
*dst++ = *src++;
} else {
while (length-- > 0)
*dst++ = *src++;
}
*from_left -= src - (char *) *from;
*from = (XPointer) src;
*to_left -= dst - (char *) *to;
*to = (XPointer) dst;
if (num_args > 0) {
State state = (State) conv->state;
*((XlcCharSet *)args[0]) = side ? state->GR_charset : state->GL_charset;
}
return 0;
}
static int
wcstostr(conv, from, from_left, to, to_left, args, num_args)
XlcConv conv;
XPointer *from;
int *from_left;
XPointer *to;
int *to_left;
XPointer *args;
int num_args;
{
register wchar_t *src, side;
register char *dst;
register length;
if (from == NULL || *from == NULL)
return 0;
src = (wchar_t *) *from;
dst = (char *) *to;
length = min(*from_left, *to_left);
if (num_args > 0) {
side = *src & 0x80;
while (side == (*src & 0x80) && length-- > 0)
*dst++ = *src++;
} else {
while (length-- > 0)
*dst++ = *src++;
}
*from_left -= src - (wchar_t *) *from;
*from = (XPointer) src;
*to_left -= dst - (char *) *to;
*to = (XPointer) dst;
if (num_args > 0) {
State state = (State) conv->state;
*((XlcCharSet *)args[0]) = side ? state->GR_charset : state->GL_charset;
}
return 0;
}
static int
cstostr(conv, from, from_left, to, to_left, args, num_args)
XlcConv conv;
XPointer *from;
int *from_left;
XPointer *to;
int *to_left;
XPointer *args;
int num_args;
{
register char *src, *dst;
unsigned char side;
register length;
if (from == NULL || *from == NULL)
return 0;
if (num_args > 0) {
State state = (State) conv->state;
XlcCharSet charset = (XlcCharSet) args[0];
if (charset != state->GL_charset && charset != state->GR_charset)
return -1;
}
src = (char *) *from;
dst = (char *) *to;
length = min(*from_left, *to_left);
if (num_args > 0) {
side = *((unsigned char *) src) & 0x80;
while (side == (*((unsigned char *) src) & 0x80) && length-- > 0)
*dst++ = *src++;
} else {
while (length-- > 0)
*dst++ = *src++;
}
*from_left -= src - (char *) *from;
*from = (XPointer) src;
*to_left -= dst - (char *) *to;
*to = (XPointer) dst;
if (num_args > 0) {
State state = (State) conv->state;
*((XlcCharSet *)args[0]) = side ? state->GR_charset : state->GL_charset;
}
return 0;
}
static int
strtowcs(conv, from, from_left, to, to_left, args, num_args)
XlcConv conv;
XPointer *from;
int *from_left;
XPointer *to;
int *to_left;
XPointer *args;
int num_args;
{
register char *src;
register wchar_t *dst;
register length;
if (from == NULL || *from == NULL)
return 0;
if (num_args > 0) {
State state = (State) conv->state;
XlcCharSet charset = (XlcCharSet) args[0];
if (charset != state->GL_charset && charset != state->GR_charset)
return -1;
}
src = (char *) *from;
dst = (wchar_t *) *to;
length = min(*from_left, *to_left);
while (length-- > 0)
*dst++ = (wchar_t) *src++;
*from_left -= src - (char *) *from;
*from = (XPointer) src;
*to_left -= dst - (wchar_t *) *to;
*to = (XPointer) dst;
return 0;
}
static void
close_converter(conv)
XlcConv conv;
{
if (conv->state)
Xfree((char *) conv->state);
Xfree((char *) conv);
}
static XlcConv
create_conv(methods)
XlcConvMethods methods;
{
register XlcConv conv;
State state;
static XlcCharSet GL_charset = NULL;
static XlcCharSet GR_charset = NULL;
if (GL_charset == NULL) {
GL_charset = _fallcGetCharSet("ISO8859-1:GL");
GR_charset = _fallcGetCharSet("ISO8859-1:GR");
}
conv = (XlcConv) Xmalloc(sizeof(XlcConvRec));
if (conv == NULL)
return (XlcConv) NULL;
conv->state = NULL;
state = (State) Xmalloc(sizeof(StateRec));
if (state == NULL)
goto err;
state->GL_charset = state->charset = GL_charset;
state->GR_charset = GR_charset;
conv->methods = methods;
conv->state = (XPointer) state;
return conv;
err:
close_converter(conv);
return (XlcConv) NULL;
}
static XlcConvMethodsRec strtostr_methods = {
close_converter,
strtostr,
NULL
} ;
static XlcConv
open_strtostr(from_lcd, from_type, to_lcd, to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{
return create_conv(&strtostr_methods);
}
static XlcConvMethodsRec wcstostr_methods = {
close_converter,
wcstostr,
NULL
} ;
static XlcConv
open_wcstostr(from_lcd, from_type, to_lcd, to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{
return create_conv(&wcstostr_methods);
}
static XlcConvMethodsRec cstostr_methods = {
close_converter,
cstostr,
NULL
} ;
static XlcConv
open_cstostr(from_lcd, from_type, to_lcd, to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{
return create_conv(&cstostr_methods);
}
static XlcConvMethodsRec strtowcs_methods = {
close_converter,
strtowcs,
NULL
} ;
static XlcConv
open_strtowcs(from_lcd, from_type, to_lcd, to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{
return create_conv(&strtowcs_methods);
}
XLCd
_fallcDefaultLoader(name)
char *name;
{
XLCd lcd;
if (strcmp(name, "C"))
return (XLCd) NULL;
lcd = _fallcCreateLC(name, _fallcPublicMethods);
_fallcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_strtowcs);
_fallcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCompoundText, open_strtostr);
_fallcSetConverter(lcd, XlcNMultiByte, lcd, XlcNString, open_strtostr);
_fallcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet, open_strtostr);
_fallcSetConverter(lcd, XlcNMultiByte, lcd, XlcNChar, open_strtostr);/* XXX */
_fallcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_wcstostr);
_fallcSetConverter(lcd, XlcNWideChar, lcd, XlcNCompoundText, open_wcstostr);
_fallcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_wcstostr);
_fallcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_wcstostr);
_fallcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_strtostr);
_fallcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_strtowcs);
_fallcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_cstostr);
_fallcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_strtowcs);
return lcd;
}

View File

@@ -1,73 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: _fallcDynamic.c /main/3 1996/05/08 19:00:37 drk $ */
/* lcDynamic.c 1.1 - Fujitsu source for CDEnext 95/12/07 10:56:55 */
/*
* Copyright 1995 by FUJITSU LIMITED
* This is source code modified by FUJITSU LIMITED under the Joint
* Development Agreement for the CDEnext PST.
* This is unpublished proprietry source code of FUJITSU LIMITED
*
* Modifier: Takanori Tateno FUJITSU LIMITED
*
*/
#include <stdio.h>
#include <string.h>
#include "_fallibint.h"
#ifdef USE_DYNAMIC_LOADER
#ifndef XLOCALEDIR
#define XLOCALEDIR "/usr/lib/X11/locale"
#endif
#define LCLIBNAME "xi18n.so"
extern void *dlopen();
extern void *dlsym();
extern int dlclose();
extern char *dlerror();
#define LAZY 1
#define NOW 2
#define GLOBAL 0x100
XLCd
_fallcDynamicLoader(name)
char *name;
{
char libpath[1024];
XLCdMethods _fallcGenericMethods;
XLCd lcd;
void *nlshandler;
sprintf(libpath,"%s/%s/%s",
XLOCALEDIR,name,LCLIBNAME);
nlshandler = dlopen(libpath,LAZY);
_fallcGenericMethods = (XLCdMethods)dlsym(nlshandler,
"genericMethods");
lcd = _fallcCreateLC(name,_fallcGenericMethods);
return lcd;
}
#endif /* USE_DYNAMIC_LOADER */

File diff suppressed because it is too large Load Diff

View File

@@ -1,377 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* lcFile.c 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:36 */
/* $XConsortium: _fallcFile.c /main/1 1996/04/08 15:16:48 cde-fuj $ */
/*
*
* Copyright IBM Corporation 1993
*
* All Rights Reserved
*
* License to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS, AND
* NONINFRINGEMENT OF THIRD PARTY RIGHTS, IN NO EVENT SHALL
* IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
*/
#include <stdio.h>
#include <ctype.h>
#include "_fallibint.h"
#include "_fallcPubI.h"
#include <X11/Xos.h>
#ifdef X_NOT_STDC_ENV
extern char *getenv();
#endif
/************************************************************************/
#define iscomment(ch) ((ch) == '#' || (ch) == '\0')
#define isreadable(f) ((access((f), R_OK) != -1) ? 1 : 0)
/*
#define isspace(ch) ((ch) == ' ' || (ch) == '\t' || (ch) == '\n')
*/
static int
parse_line(line, argv, argsize)
char *line;
char **argv;
int argsize;
{
int argc = 0;
char *p = line;
while(argc < argsize){
while(isspace(*p)){
++p;
}
if(*p == '\0'){
break;
}
argv[argc++] = p;
while(! isspace(*p) && *p != '\0'){
++p;
}
if(*p == '\0'){
break;
}
*p++ = '\0';
}
return argc;
}
#ifndef XLOCALEDIR
#define XLOCALEDIR "/usr/lib/X11/locale"
#endif
static void
xlocaledir(path)
char *path;
{
char *dir, *p = path;
int len;
dir = getenv("XLOCALEDIR");
if(dir != NULL){
len = strlen(dir);
strcpy(p, dir);
p[len++] = ':';
p += len;
}
strcpy(p, XLOCALEDIR);
}
static int
parse_path(path, argv, argsize)
char *path;
char **argv;
int argsize;
{
char *p = path;
int i, n;
while((p = strchr(p, ':')) != NULL){
*p = ' '; /* place space on delimter */
}
n = parse_line(path, argv, argsize);
if(n == 0){
return 0;
}
for(i = 0; i < n; ++i){
int len;
p = argv[i];
len = strlen(p);
if(p[len - 1] == '/'){
/* eliminate slash */
p[len - 1] = '\0';
}
}
return n;
}
enum { LtoR, RtoL };
static char *
_XlcResolveName(lc_name, file_name, direction)
char *lc_name;
char *file_name;
int direction; /* mapping direction */
{
FILE *fp;
char buf[BUFSIZE], *name = NULL;
fp = fopen(file_name, "r");
if(fp == (FILE *)NULL){
return NULL;
}
while(fgets(buf, BUFSIZE, fp) != NULL){
char *p = buf;
int n;
char *args[2], *from, *to;
while(isspace(*p)){
++p;
}
if(iscomment(*p)){
continue;
}
n = parse_line(p, args, 2); /* get first 2 fields */
if(n != 2){
continue;
}
if(direction == LtoR){
from = args[0], to = args[1]; /* left to right */
}else{
from = args[1], to = args[0]; /* right to left */
}
if(! strcmp(from, lc_name)){
name = Xmalloc(strlen(to) + 1);
if(name != NULL){
strcpy(name, to);
}
break;
}
}
if(fp != (FILE *)NULL){
fclose(fp);
}
return name;
}
/*
#define isupper(ch) ('A' <= (ch) && (ch) <= 'Z')
#define tolower(ch) ((ch) - 'A' + 'a')
*/
static char *
lowercase(dst, src)
char *dst;
char *src;
{
char *s, *t;
for(s = src, t = dst; *s; ++s, ++t){
*t = isupper(*s) ? tolower(*s) : *s;
}
*t = '\0';
return dst;
}
/************************************************************************/
char *
_fallcFileName(lcd, category)
XLCd lcd;
char *category;
{
char lc_name[BUFSIZE];
char cat[BUFSIZE], dir[BUFSIZE];
int i, n;
char *args[256];
char *file_name = NULL;
if(lcd == (XLCd)NULL){
return NULL;
}
if(! _fallcResolveLocaleName(XLC_PUBLIC(lcd, siname), lc_name,
NULL, NULL, NULL)){
return NULL;
}
lowercase(cat, category);
xlocaledir(dir);
n = parse_path(dir, args, 256);
for(i = 0; i < n; ++i){
char buf[BUFSIZE], *name;
sprintf(buf, "%s/%s.dir", args[i], cat);
name = _XlcResolveName(lc_name, buf, RtoL);
if(name == NULL){
continue;
}
if(*name == '/'){
/* supposed to be absolute path name */
file_name = name;
}else{
sprintf(buf, "%s/%s", args[i], name);
Xfree(name);
file_name = Xmalloc(strlen(buf) + 1);
if(file_name == NULL){
break;
}
strcpy(file_name, buf);
}
if(isreadable(file_name)){
break;
}
Xfree(file_name);
file_name = NULL;
/* Then, try with next dir */
}
return file_name;
}
/************************************************************************/
#ifndef LOCALE_ALIAS
#define LOCALE_ALIAS "locale.alias"
#endif
int
_fallcResolveLocaleName(lc_name, full_name, language, territory, codeset)
char *lc_name;
char *full_name;
char *language;
char *territory;
char *codeset;
{
char dir[BUFSIZE], buf[BUFSIZE], *name = NULL;
int i, n;
char *args[256];
xlocaledir(dir);
n = parse_path(dir, args, 256);
for(i = 0; i < n; ++i){
sprintf(buf, "%s/%s", args[i], LOCALE_ALIAS);
name = _XlcResolveName(lc_name, buf, LtoR);
if(name != NULL){
break;
}
}
if(name != NULL){
snprintf(buf, sizeof(buf), "%s", name);
Xfree(name);
}else{
snprintf(buf, sizeof(buf), "%s", lc_name);
}
if(full_name != NULL){
strcpy(full_name, buf);
}
if(language || territory || codeset){
char *ptr, *name_p;
/*
* Decompose locale name
*/
if(language) *language = '\0';
if(territory) *territory = '\0';
if(codeset) *codeset = '\0';
name_p = buf;
ptr = language;
while (1) {
if (*name_p == '_') {
if (ptr)
*ptr = '\0';
ptr = territory;
} else if (*name_p == '.') {
if (ptr)
*ptr = '\0';
ptr = codeset;
} else {
if (ptr)
*ptr++ = *name_p;
if (*name_p == '\0')
break;
}
name_p++;
}
}
return (buf[0] != '\0') ? 1 : 0;
}
/************************************************************************/
#ifndef LOCALE_DIR
#define LOCALE_DIR "locale.dir"
#endif
int
_fallcResolveDBName(lc_name, file_name)
char *lc_name;
char *file_name;
{
char dir[BUFSIZE], buf[BUFSIZE], *name = NULL;
int i, n;
char *args[256];
xlocaledir(dir);
n = parse_path(dir, args, 256);
for(i = 0; i < n; ++i){
sprintf(buf, "%s/%s", args[i], LOCALE_DIR);
name = _XlcResolveName(lc_name, buf, RtoL);
if(name != NULL){
break;
}
}
if(name == NULL){
return 0;
}
strcpy(buf, name);
Xfree(name);
if(file_name != NULL){
strcpy(file_name, buf);
}
return 1;
}
/************************************************************************/
int
_fallcResolveI18NPath(path_name)
char *path_name;
{
if(path_name != NULL){
xlocaledir(path_name);
}
return 1;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,170 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* XlcGeneric.h 1.3 - Fujitsu source for CDEnext 95/12/07 10:53:07 */
/* $XConsortium: _fallcGeneric.h /main/1 1996/04/08 15:17:24 cde-fuj $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of TOSHIBA not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. TOSHIBA make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
/*
* Copyright 1995 by FUJITSU LIMITED
* This is source code modified by FUJITSU LIMITED under the Joint
* Development Agreement for the CDEnext PST.
* This is unpublished proprietry source code of FUJITSU LIMITED
*
* Modifier: Takanori Tateno FUJITSU LIMITED
*
*/
#ifndef _XLCGENERIC_H_
#define _XLCGENERIC_H_
#include "_fallcPubI.h"
typedef struct _ByteInfo {
unsigned char start,end;
} ByteInfoRec, *ByteInfo;
typedef struct _ByteInfoList {
int M; /* 1 <= M <= length */
int byteinfo_num;
ByteInfo byteinfo;
} ByteInfoListRec, *ByteInfoList;
/* conversion_type values */
#define LOCALCONV 1
#define FILECONV 2
#define FUNCTIONCONV 4
typedef struct _Conversion {
unsigned long conversion_type;
int conv_num;
FontScope convlist;
char *cnv_file;
XlcConv cnvfunc;
} ConversionRec, *Conversion;
typedef struct _ExtdSegment {
char *name;
XlcSide side;
FontScope area;
int area_num;
XlcCharSet charset;
} ExtdSegmentRec, *ExtdSegment;
typedef struct _SegConvRec {
int length;
char *source_encoding;
XlcCharSet source;
char *destination_encoding;
XlcCharSet dest;
FontScopeRec range;
int conv_num;
FontScope conv;
} SegConvRec, *SegConv;
typedef struct _ParseInfoRec *ParseInfo;
typedef struct _CodeSetRec {
XlcCharSet *charset_list;
int num_charsets;
int cs_num;
XlcSide side;
int length;
ByteInfoList byteM;
Conversion mbconv;
Conversion ctconv;
ExtdSegment ctextseg;
ParseInfo parse_info;
unsigned long wc_encoding;
} CodeSetRec, *CodeSet;
typedef enum {
E_GL, /* GL encoding */
E_GR, /* GR encoding */
E_SS, /* single shift */
E_LSL, /* locking shift left */
E_LSR, /* locking shift right */
E_LAST
} EncodingType;
typedef struct _ParseInfoRec {
EncodingType type;
char *encoding;
CodeSet codeset;
} ParseInfoRec;
/*
* XLCd private data
*/
#define XLC_GENERIC(lcd, x) (((XLCdGeneric) lcd->core)->gen.x)
#define XLC_GENERIC_PART(lcd) (&(((XLCdGeneric) lcd->core)->gen))
typedef struct _XLCdGenericPart {
int codeset_num;
CodeSet *codeset_list;
unsigned char *mb_parse_table;
int mb_parse_list_num;
ParseInfo *mb_parse_list;
unsigned long wc_encode_mask;
unsigned long wc_shift_bits;
CodeSet initial_state_GL;
CodeSet initial_state_GR;
int segment_conv_num; /* UDC */
SegConv segment_conv; /* UDC */
#ifndef X_NOT_STDC_ENV
Bool use_stdc_env;
Bool force_convert_to_mb;
#endif
} XLCdGenericPart;
typedef struct _XLCdGenericRec {
XLCdCoreRec core;
XLCdPublicPart pub;
XLCdGenericPart gen;
} XLCdGenericRec, *XLCdGeneric;
extern XLCdMethods _fallcGenericMethods;
#endif /* _XLCGENERIC_H_ */

View File

@@ -1,186 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* lcInit.c 1.4 - Fujitsu source for CDEnext 96/03/11 17:13:15 */
/* $XConsortium: _fallcInit.c /main/1 1996/04/08 15:17:36 cde-fuj $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of TOSHIBA not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. TOSHIBA make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
/*
* (c) Copyright 1995 FUJITSU LIMITED
* This is source code modified by FUJITSU LIMITED under the Joint
* Development Agreement for the CDEnext PST.
* This is unpublished proprietary source code of FUJITSU LIMITED
*
* Modifier: Masayoshi Shimamura FUJITSU LIMITED
*
*/
#include "_fallibint.h"
#include "_fallcint.h"
#define USE_GENERIC_LOADER
#define USE_DEFAULT_LOADER
/*** #define USE_EUC_LOADER ***/
/*** #define USE_SJIS_LOADER ***/
/*** #define USE_JIS_LOADER ***/
/*** #define USE_UTF_LOADER ***/
extern XLCd _fallcDefaultLoader(
#if NeedFunctionPrototypes
char*
#endif
);
#ifdef DYNAMIC_LOAD
#ifdef sun
extern XLCd _falsunOsDynamicLoad(
#if NeedFunctionPrototypes
char*
#endif
);
#endif /* sun */
#ifdef AIXV3
extern XLCd _falaixOsDynamicLoad(
#if NeedFunctionPrototypes
char*
#endif
);
#endif /* AIXV3 */
#endif
#ifdef USE_GENERIC_LOADER
extern XLCd _fallcGenericLoader(
#if NeedFunctionPrototypes
char*
#endif
);
#endif
#ifdef USE_UTF_LOADER
extern XLCd _fallcUtfLoader(
#if NeedFunctionPrototypes
char*
#endif
);
#endif
#ifdef USE_EUC_LOADER
extern XLCd _fallcEucLoader(
#if NeedFunctionPrototypes
char*
#endif
);
#endif
#ifdef USE_SJIS_LOADER
extern XLCd _fallcSjisLoader(
#if NeedFunctionPrototypes
char*
#endif
);
#endif
#ifdef USE_JIS_LOADER
extern XLCd _XlcJisLoader(
#if NeedFunctionPrototypes
char*
#endif
);
#endif
#ifdef USE_DYNAMIC_LOADER
extern XLCd _fallcDynamicLoader(
#if NeedFunctionPrototypes
char*
#endif
);
#endif
/*
* The _fallcInitLoader function initializes the locale object loader list
* with vendor specific manner.
*/
void
_fallcInitLoader()
{
#ifdef USE_GENERIC_LOADER
_fallcAddLoader(_fallcGenericLoader, XlcHead);
#endif
#ifdef USE_DEFAULT_LOADER
_fallcAddLoader(_fallcDefaultLoader, XlcHead);
#endif
#ifdef USE_EUC_LOADER
_fallcAddLoader(_fallcEucLoader, XlcHead);
#endif
#ifdef USE_SJIS_LOADER
_fallcAddLoader(_fallcSjisLoader, XlcHead);
#endif
#ifdef USE_JIS_LOADER
_fallcAddLoader(_XlcJisLoader, XlcHead);
#endif
#ifdef USE_UTF_LOADER
_fallcAddLoader(_fallcUtfLoader, XlcHead);
#endif
#ifdef DYNAMIC_LOAD
#ifdef sun
_fallcAddLoader(_falsunOsDynamicLoad, XlcHead);
#endif /* sun */
#ifdef AIXV3
_fallcAddLoader(_falaixOsDynamicLoad, XlcHead);
#endif /* AIXV3 */
#endif /* DYNAMIC_LOAD */
#ifdef USE_DYNAMIC_LOADER
_fallcAddLoader(_fallcDynamicLoader, XlcHead);
#endif
}

View File

@@ -1,267 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* lcPrTxt.c 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:38 */
/* $XConsortium: _fallcPrTxt.c /main/1 1996/04/08 15:17:49 cde-fuj $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of TOSHIBA not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. TOSHIBA make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
#include "_fallibint.h"
#include "_fallcPubI.h"
#include "_falutil.h"
#include <X11/Xatom.h>
static XPointer *
alloc_list(is_wide_char, count, nitems)
Bool is_wide_char;
int count;
int nitems;
{
if (is_wide_char) {
wchar_t **wstr_list;
wstr_list = (wchar_t **) Xmalloc(count * sizeof(wchar_t *));
if (wstr_list == NULL)
return (XPointer *) NULL;
*wstr_list = (wchar_t *) Xmalloc(nitems * sizeof(wchar_t));
if (*wstr_list == NULL) {
Xfree(wstr_list);
return (XPointer *) NULL;
}
return (XPointer *) wstr_list;
} else {
char **str_list;
str_list = (char **) Xmalloc(count * sizeof(char *));
if (str_list == NULL)
return (XPointer *) NULL;
*str_list = (char *) Xmalloc(nitems);
if (*str_list == NULL) {
Xfree(str_list);
return (XPointer *) NULL;
}
return (XPointer *) str_list;
}
}
static void
copy_list(is_wide_char, text, list, count)
Bool is_wide_char;
XPointer text;
XPointer *list;
int count;
{
int length;
if (is_wide_char) {
wchar_t *wc_text, *wstr, **wstr_list;
wc_text = (wchar_t *) text;
wstr_list = (wchar_t **) list;
for (wstr = *wstr_list; count > 0; count--, wstr_list++) {
_falwcscpy(wstr, wc_text);
*wstr_list = wstr;
length = _falwcslen(wstr) + 1;
wstr += length;
wc_text += length;
}
} else {
char *mb_text, *str, **str_list;
mb_text = (char *) text;
str_list = (char **) list;
for (str = *str_list; count > 0; count--, str_list++) {
strcpy(str, mb_text);
*str_list = str;
length = strlen(str) + 1;
str += length;
mb_text += length;
}
}
}
static int
_XTextPropertyToTextList(lcd, dpy, text_prop, to_type, list_ret, count_ret)
XLCd lcd;
Display *dpy;
XTextProperty *text_prop;
char *to_type;
XPointer **list_ret;
int *count_ret;
{
XlcConv conv;
char *from_type;
XPointer from, to, buf;
char *str_ptr, *last_ptr;
Atom encoding;
int from_left, to_left, buf_len, ret;
int unconv_num, nitems = text_prop->nitems;
Bool is_wide_char = False;
if (strcmp(XlcNWideChar, to_type) == 0)
is_wide_char = True;
if (nitems <= 0) {
*list_ret = NULL;
*count_ret = 0;
return Success;
}
if (text_prop->format != 8)
return XConverterNotFound;
encoding = text_prop->encoding;
if (encoding == XA_STRING)
from_type = XlcNString;
else if (encoding == falInternAtom(dpy, "COMPOUND_TEXT", False))
from_type = XlcNCompoundText;
else if (encoding == falInternAtom(dpy, XLC_PUBLIC(lcd, encoding_name), False))
from_type = XlcNMultiByte;
else
return XConverterNotFound;
if (is_wide_char) {
buf_len = text_prop->nitems + 1;
buf = (XPointer) Xmalloc(buf_len * sizeof(wchar_t));
} else {
buf_len = text_prop->nitems * XLC_PUBLIC(lcd, mb_cur_max) + 1;
buf = (XPointer) Xmalloc(buf_len);
}
if (buf == NULL)
return XNoMemory;
to = buf;
to_left = buf_len;
conv = _fallcOpenConverter(lcd, from_type, lcd, to_type);
if (conv == NULL) {
Xfree(buf);
return XConverterNotFound;
}
last_ptr = str_ptr = (char *) text_prop->value;
unconv_num = *count_ret = 0;
while (1) {
if (nitems == 0 || *str_ptr == 0) {
if (nitems)
str_ptr++;
from = (XPointer) last_ptr;
from_left = str_ptr - last_ptr;
last_ptr = str_ptr;
ret = _fallcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0);
if (ret < 0)
continue;
unconv_num += ret;
(*count_ret)++;
if (nitems == 0)
break;
_fallcResetConverter(conv);
} else
str_ptr++;
nitems--;
}
_fallcCloseConverter(conv);
if (is_wide_char)
*((wchar_t *) to) = (wchar_t) 0;
else
*((char *) to) = '\0';
to_left--;
*list_ret = alloc_list(is_wide_char, *count_ret, buf_len - to_left);
if (*list_ret)
copy_list(is_wide_char, buf, *list_ret, *count_ret);
Xfree(buf);
return unconv_num;
}
int
_falmbTextPropertyToTextList(lcd, dpy, text_prop, list_ret, count_ret)
XLCd lcd;
Display *dpy;
XTextProperty *text_prop;
char ***list_ret;
int *count_ret;
{
return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNMultiByte,
(XPointer **) list_ret, count_ret);
}
int
_falwcTextPropertyToTextList(lcd, dpy, text_prop, list_ret, count_ret)
XLCd lcd;
Display *dpy;
XTextProperty *text_prop;
wchar_t ***list_ret;
int *count_ret;
{
return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNWideChar,
(XPointer **) list_ret, count_ret);
}
void
_falwcFreeStringList(lcd, list)
XLCd lcd;
wchar_t **list;
{
if (list) {
if (*list)
Xfree(*list);
Xfree(list);
}
}

View File

@@ -1,277 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* XlcPubI.h 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:05 */
/* $XConsortium: _fallcPubI.h /main/1 1996/04/08 15:17:59 cde-fuj $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of TOSHIBA not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. TOSHIBA make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
#ifndef _XLCPUBLICI_H_
#define _XLCPUBLICI_H_
#include "_fallcPublic.h"
#define XLC_PUBLIC(lcd, x) (((XLCdPublic) lcd->core)->pub.x)
#define XLC_PUBLIC_PART(lcd) (&(((XLCdPublic) lcd->core)->pub))
#define XLC_PUBLIC_METHODS(lcd) (&(((XLCdPublicMethods) lcd->methods)->pub))
/*
* XLCd public methods
*/
typedef struct _XLCdPublicMethodsRec *XLCdPublicMethods;
typedef XLCd (*XlcPubCreateProc)(
#if NeedFunctionPrototypes
char* /* name */,
XLCdMethods /* methods */
#endif
);
typedef Bool (*XlcPubInitializeProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */
#endif
);
typedef void (*XlcPubDestroyProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */
#endif
);
typedef char* (*XlcPubGetValuesProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */,
XlcArgList /* args */,
int /* num_args */
#endif
);
typedef void (*XlcPubGetResourceProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */,
char* /* category */,
char* /* class */,
char*** /* value */,
int* /* count */
#endif
);
typedef struct _XLCdPublicMethodsPart {
XLCdPublicMethods superclass;
XlcPubCreateProc create;
XlcPubInitializeProc initialize;
XlcPubDestroyProc destroy;
XlcPubGetValuesProc get_values;
XlcPubGetResourceProc get_resource;
} XLCdPublicMethodsPart;
typedef struct _XLCdPublicMethodsRec {
XLCdMethodsRec core;
XLCdPublicMethodsPart pub;
} XLCdPublicMethodsRec;
/*
* XLCd public data
*/
typedef struct _XLCdPublicPart {
char *siname; /* for _fallcMapOSLocaleName() */
char *language; /* language part of locale name */
char *territory; /* territory part of locale name */
char *codeset; /* codeset part of locale name */
char *encoding_name; /* encoding name */
int mb_cur_max; /* ANSI C MB_CUR_MAX */
Bool is_state_depend; /* state-depend encoding */
char *default_string; /* for falDefaultString() */
XPointer xlocale_db;
} XLCdPublicPart;
typedef struct _XLCdPublicRec {
XLCdCoreRec core;
XLCdPublicPart pub;
} XLCdPublicRec, *XLCdPublic;
extern XLCdMethods _fallcPublicMethods;
_XFUNCPROTOBEGIN
extern XLCd _fallcCreateLC(
#if NeedFunctionPrototypes
char* /* name */,
XLCdMethods /* methods */
#endif
);
extern void _fallcDestroyLC(
#if NeedFunctionPrototypes
XLCd /* lcd */
#endif
);
extern Bool _fallcParseCharSet(
#if NeedFunctionPrototypes
XlcCharSet /* charset */
#endif
);
extern XlcCharSet _fallcCreateDefaultCharSet(
#if NeedFunctionPrototypes
char* /* name */,
char* /* control_sequence */
#endif
);
extern XlcCharSet _fallcAddCT(
#if NeedFunctionPrototypes
char* /* name */,
char* /* control_sequence */
#endif
);
extern XrmMethods _falrmDefaultInitParseInfo(
#if NeedFunctionPrototypes
XLCd /* lcd */,
XPointer* /* state */
#endif
);
extern int _falmbTextPropertyToTextList(
#if NeedFunctionPrototypes
XLCd /* lcd */,
Display* /* dpy */,
XTextProperty* /* text_prop */,
char*** /* list_ret */,
int* /* count_ret */
#endif
);
extern int _falwcTextPropertyToTextList(
#if NeedFunctionPrototypes
XLCd /* lcd */,
Display* /* dpy */,
XTextProperty* /* text_prop */,
wchar_t*** /* list_ret */,
int* /* count_ret */
#endif
);
extern int _falmbTextListToTextProperty(
#if NeedFunctionPrototypes
XLCd /* lcd */,
Display* /* dpy */,
char** /* list */,
int /* count */,
XICCEncodingStyle /* style */,
XTextProperty* /* text_prop */
#endif
);
extern int _falwcTextListToTextProperty(
#if NeedFunctionPrototypes
XLCd /* lcd */,
Display* /* dpy */,
wchar_t** /* list */,
int /* count */,
XICCEncodingStyle /* style */,
XTextProperty* /* text_prop */
#endif
);
extern void _falwcFreeStringList(
#if NeedFunctionPrototypes
XLCd /* lcd */,
wchar_t** /* list */
#endif
);
extern int _fallcResolveLocaleName(
#if NeedFunctionPrototypes
char* /* lc_name */,
char* /* full_name */,
char* /* language */,
char* /* territory */,
char* /* codeset */
#endif
);
extern int _fallcResolveDBName(
#if NeedFunctionPrototypes
char* /* lc_name */,
char* /* file_name */
#endif
);
extern int _fallcResolveI18NPath(
#if NeedFunctionPrototypes
char* /* path_name */
#endif
);
extern XPointer _fallcCreateLocaleDataBase(
#if NeedFunctionPrototypes
XLCd /* lcd */
#endif
);
extern void _fallcDestroyLocaleDataBase(
#if NeedFunctionPrototypes
XLCd /* lcd */
#endif
);
extern void _fallcGetLocaleDataBase(
#if NeedFunctionPrototypes
XLCd /* lcd */,
char* /* category */,
char* /* name */,
char*** /* value */,
int* /* count */
#endif
);
_XFUNCPROTOEND
#endif /* _XLCPUBLICI_H_ */

View File

@@ -1,127 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* lcPubWrap.c 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:39 */
/* $XConsortium: _fallcPubWrap.c /main/1 1996/04/08 15:18:09 cde-fuj $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of TOSHIBA not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. TOSHIBA make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
#include "_fallibint.h"
#include "_fallcPubI.h"
#if NeedVarargsPrototypes
char *
_falGetLCValues(XLCd lcd, ...)
#else
char *
_falGetLCValues(lcd, va_alist)
XLCd lcd;
va_dcl
#endif
{
va_list var;
XlcArgList args;
char *ret;
int num_args;
XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd);
Va_start(var, lcd);
_fallcCountVaList(var, &num_args);
va_end(var);
Va_start(var, lcd);
_fallcVaToArgList(var, num_args, &args);
va_end(var);
if (args == (XlcArgList) NULL)
return (char *) NULL;
ret = (*methods->get_values)(lcd, args, num_args);
Xfree(args);
return ret;
}
void
_fallcDestroyLC(lcd)
XLCd lcd;
{
XLCdPublicMethods methods = (XLCdPublicMethods) lcd->methods;
(*methods->pub.destroy)(lcd);
}
XLCd
_fallcCreateLC(name, methods)
char *name;
XLCdMethods methods;
{
XLCdPublicMethods pub_methods = (XLCdPublicMethods) methods;
XLCd lcd;
lcd = (*pub_methods->pub.create)(name, methods);
if (lcd == NULL)
return (XLCd) NULL;
if (lcd->core->name == NULL) {
lcd->core->name = (char*) Xmalloc(strlen(name) + 1);
if (lcd->core->name == NULL)
goto err;
strcpy(lcd->core->name, name);
}
if (lcd->methods == NULL)
lcd->methods = methods;
if ((*pub_methods->pub.initialize)(lcd) == False)
goto err;
return lcd;
err:
_fallcDestroyLC(lcd);
return (XLCd) NULL;
}

View File

@@ -1,325 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* lcPublic.c 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:39 */
/* $XConsortium: _fallcPublic.c /main/1 1996/04/08 15:18:20 cde-fuj $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of TOSHIBA not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. TOSHIBA make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
#include <stdio.h>
#include "_fallibint.h"
#include "_fallcPubI.h"
static char *default_string();
static XLCd create();
static Bool initialize();
static void destroy();
static char *get_values();
static XLCdPublicMethodsRec publicMethods = {
{
destroy,
_fallcDefaultMapModifiers,
NULL,
NULL,
_falrmDefaultInitParseInfo,
_falmbTextPropertyToTextList,
_falwcTextPropertyToTextList,
_falmbTextListToTextProperty,
_falwcTextListToTextProperty,
_falwcFreeStringList,
default_string,
NULL,
NULL
},
{
NULL,
create,
initialize,
destroy,
get_values,
_fallcGetLocaleDataBase
}
};
XLCdMethods _fallcPublicMethods = (XLCdMethods) &publicMethods;
static char *
default_string(lcd)
XLCd lcd;
{
return XLC_PUBLIC(lcd, default_string);
}
static XLCd
create(name, methods)
char *name;
XLCdMethods methods;
{
XLCd lcd;
XLCdPublicMethods new;
lcd = (XLCd) Xmalloc(sizeof(XLCdRec));
if (lcd == NULL)
return (XLCd) NULL;
bzero((char *) lcd, sizeof(XLCdRec));
lcd->core = (XLCdCore) Xmalloc(sizeof(XLCdPublicRec));
if (lcd->core == NULL)
goto err;
bzero((char *) lcd->core, sizeof(XLCdPublicRec));
new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec));
if (new == NULL)
goto err;
*new = *((XLCdPublicMethods) methods);
lcd->methods = (XLCdMethods) new;
return lcd;
err:
Xfree(lcd);
return (XLCd) NULL;
}
static Bool
load_public(lcd)
XLCd lcd;
{
XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd);
char **values, *str;
int num;
if(_fallcCreateLocaleDataBase(lcd) == NULL)
return False;
_fallcGetResource(lcd, "XLC_XLOCALE", "mb_cur_max", &values, &num);
if (num > 0) {
pub->mb_cur_max = atoi(values[0]);
if (pub->mb_cur_max < 1)
pub->mb_cur_max = 1;
} else
pub->mb_cur_max = 1;
_fallcGetResource(lcd, "XLC_XLOCALE", "state_dependent", &values, &num);
if (num > 0 && !_fallcCompareISOLatin1(values[0], "True"))
pub->is_state_depend = True;
else
pub->is_state_depend = False;
_fallcGetResource(lcd, "XLC_XLOCALE", "encoding_name", &values, &num);
str = (num > 0) ? values[0] : "STRING";
pub->encoding_name = (char*) Xmalloc(strlen(str) + 1);
if (pub->encoding_name == NULL)
return False;
strcpy(pub->encoding_name, str);
return True;
}
static Bool
initialize_core(lcd)
XLCd lcd;
{
XLCdMethods methods = lcd->methods;
XLCdMethods core = &publicMethods.core;
if (methods->close == NULL)
methods->close = core->close;
if (methods->map_modifiers == NULL)
methods->map_modifiers = core->map_modifiers;
if (methods->open_om == NULL)
_falInitOM(lcd);
if (methods->init_parse_info == NULL)
methods->init_parse_info = core->init_parse_info;
if (methods->mb_text_prop_to_list == NULL)
methods->mb_text_prop_to_list = core->mb_text_prop_to_list;
if (methods->wc_text_prop_to_list == NULL)
methods->wc_text_prop_to_list = core->wc_text_prop_to_list;
if (methods->mb_text_list_to_prop == NULL)
methods->mb_text_list_to_prop = core->mb_text_list_to_prop;
if (methods->wc_text_list_to_prop == NULL)
methods->wc_text_list_to_prop = core->wc_text_list_to_prop;
if (methods->wc_free_string_list == NULL)
methods->wc_free_string_list = core->wc_free_string_list;
if (methods->default_string == NULL)
methods->default_string = core->default_string;
return True;
}
extern Bool _fallcInitCTInfo();
static Bool
initialize(lcd)
XLCd lcd;
{
XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd);
XLCdPublicMethodsPart *pub_methods = &publicMethods.pub;
XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd);
char lang[128], terr[128], code[128], *str;
char *name;
#if !defined(X_NOT_STDC_ENV) && !defined(X_LOCALE)
char siname[256];
char *_fallcMapOSLocaleName();
#endif
_fallcInitCTInfo();
if (initialize_core(lcd) == False)
return False;
name = lcd->core->name;
#if !defined(X_NOT_STDC_ENV) && !defined(X_LOCALE)
name = _fallcMapOSLocaleName(name, siname);
#endif
if (_fallcResolveLocaleName(name, NULL, lang, terr, code) == 0)
return False;
str = (char*) Xmalloc(strlen(name) + strlen(lang) + strlen(terr) +
strlen(code) + 4);
if (str == NULL)
return False;
strcpy(str, name);
pub->siname = str;
str += strlen(str) + 1;
strcpy(str, lang);
pub->language = str;
str += strlen(str) + 1;
strcpy(str, terr);
pub->territory = str;
str += strlen(str) + 1;
strcpy(str, code);
pub->codeset = str;
if (pub->default_string == NULL)
pub->default_string = "";
if (methods->get_values == NULL)
methods->get_values = pub_methods->get_values;
if (methods->get_resource == NULL)
methods->get_resource = pub_methods->get_resource;
return load_public(lcd);
}
static void
destroy_core(lcd)
XLCd lcd;
{
if (lcd->core) {
if (lcd->core->name)
Xfree(lcd->core->name);
Xfree(lcd->core);
}
if (lcd->methods)
Xfree(lcd->methods);
Xfree(lcd);
}
static void
destroy(lcd)
XLCd lcd;
{
XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd);
_fallcDestroyLocaleDataBase(lcd);
if (pub->siname)
Xfree(pub->siname);
if (pub->encoding_name)
Xfree(pub->encoding_name);
destroy_core(lcd);
}
static XlcResource resources[] = {
{ XlcNCodeset, NULLQUARK, sizeof(char *),
XOffsetOf(XLCdPublicRec, pub.codeset), XlcGetMask },
{ XlcNDefaultString, NULLQUARK, sizeof(char *),
XOffsetOf(XLCdPublicRec, pub.default_string), XlcGetMask },
{ XlcNEncodingName, NULLQUARK, sizeof(char *),
XOffsetOf(XLCdPublicRec, pub.encoding_name), XlcGetMask },
{ XlcNLanguage, NULLQUARK, sizeof(char *),
XOffsetOf(XLCdPublicRec, pub.language), XlcGetMask },
{ XlcNMbCurMax, NULLQUARK, sizeof(int),
XOffsetOf(XLCdPublicRec, pub.mb_cur_max), XlcGetMask },
{ XlcNStateDependentEncoding, NULLQUARK, sizeof(Bool),
XOffsetOf(XLCdPublicRec, pub.is_state_depend), XlcGetMask },
{ XlcNTerritory, NULLQUARK, sizeof(char *),
XOffsetOf(XLCdPublicRec, pub.territory), XlcGetMask }
};
static char *
get_values(lcd, args, num_args)
register XLCd lcd;
register XlcArgList args;
register int num_args;
{
XLCdPublic pub = (XLCdPublic) lcd->core;
if (resources[0].xrm_name == NULLQUARK)
_fallcCompileResourceList(resources, XlcNumber(resources));
return _fallcGetValues((XPointer) pub, resources, XlcNumber(resources), args,
num_args, XlcGetMask);
}

View File

@@ -1,311 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* XlcPublic.h 1.3 - Fujitsu source for CDEnext 95/12/07 10:53:08 */
/* $XConsortium: _fallcPublic.h /main/1 1996/04/08 15:18:31 cde-fuj $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of TOSHIBA not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. TOSHIBA make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
/*
* Copyright 1995 by FUJITSU LIMITED
* This is source code modified by FUJITSU LIMITED under the Joint
* Development Agreement for the CDEnext PST.
* This is unpublished proprietry source code of FUJITSU LIMITED
*
* Modifier: Takanori Tateno FUJITSU LIMITED
*
*/
#ifndef _XLCPUBLIC_H_
#define _XLCPUBLIC_H_
#include "_fallcint.h"
#define XlcNCharSize "charSize"
#define XlcNCodeset "codeset"
#define XlcNControlSequence "controlSequence"
#define XlcNDefaultString "defaultString"
#define XlcNEncodingName "encodingName"
#define XlcNLanguage "language"
#define XlcNMbCurMax "mbCurMax"
#define XlcNName "name"
#define XlcNSetSize "setSize"
#define XlcNSide "side"
#define XlcNStateDependentEncoding "stateDependentEncoding"
#define XlcNTerritory "territory"
typedef enum {
XlcUnknown, XlcC0, XlcGL, XlcC1, XlcGR, XlcGLGR, XlcOther, XlcNONE
} XlcSide;
typedef struct _FonScope {
unsigned long start;
unsigned long end;
unsigned long shift;
unsigned long shift_direction;
} FontScopeRec, *FontScope;
typedef struct _UDCArea {
unsigned long start,end;
} UDCAreaRec, *UDCArea;
typedef struct _XlcCharSetRec *XlcCharSet;
typedef char* (*XlcGetCSValuesProc)(
#if NeedFunctionPrototypes
XlcCharSet /* charset */,
XlcArgList /* args */,
int /* num_args */
#endif
);
typedef struct _XlcCharSetRec {
char *name; /* character set name */
XrmQuark xrm_name;
char *encoding_name; /* XLFD encoding name */
XrmQuark xrm_encoding_name;
XlcSide side; /* GL, GR or others */
int char_size; /* number of bytes per character */
int set_size; /* graphic character sets */
char *ct_sequence; /* control sequence of CT */
XlcGetCSValuesProc get_values;
/* UDC */
Bool string_encoding;
UDCArea udc_area;
int udc_area_num;
} XlcCharSetRec;
/*
* conversion methods
*/
typedef struct _XlcConvRec *XlcConv;
typedef XlcConv (*XlcOpenConverterProc)(
#if NeedFunctionPrototypes
XLCd /* from_lcd */,
char* /* from_type */,
XLCd /* to_lcd */,
char* /* to_type */
#endif
);
typedef void (*XlcCloseConverterProc)(
#if NeedFunctionPrototypes
XlcConv /* conv */
#endif
);
typedef int (*XlcConvertProc)(
#if NeedFunctionPrototypes
XlcConv /* conv */,
XPointer* /* from */,
int* /* from_left */,
XPointer* /* to */,
int* /* to_left */,
XPointer* /* args */,
int /* num_args */
#endif
);
typedef void (*XlcResetConverterProc)(
#if NeedFunctionPrototypes
XlcConv /* conv */
#endif
);
typedef struct _XlcConvMethodsRec{
XlcCloseConverterProc close;
XlcConvertProc convert;
XlcResetConverterProc reset;
} XlcConvMethodsRec, *XlcConvMethods;
/*
* conversion data
*/
#define XlcNMultiByte "multiByte"
#define XlcNWideChar "wideChar"
#define XlcNCompoundText "compoundText"
#define XlcNString "string"
#define XlcNCharSet "charSet"
#define XlcNCTCharSet "CTcharSet"
#define XlcNChar "char"
typedef struct _XlcConvRec {
XlcConvMethods methods;
XPointer state;
} XlcConvRec;
_XFUNCPROTOBEGIN
extern Bool _falInitOM(
#if NeedFunctionPrototypes
XLCd /* lcd */
#endif
);
extern Bool _XInitIM(
#if NeedFunctionPrototypes
XLCd /* lcd */
#endif
);
extern char *_falGetLCValues(
#if NeedVarargsPrototypes
XLCd /* lcd */,
...
#endif
);
extern XlcCharSet _fallcGetCharSet(
#if NeedFunctionPrototypes
char* /* name */
#endif
);
extern Bool _fallcAddCharSet(
#if NeedFunctionPrototypes
XlcCharSet /* charset */
#endif
);
extern char *_fallcGetCSValues(
#if NeedVarargsPrototypes
XlcCharSet /* charset */,
...
#endif
);
extern XlcConv _fallcOpenConverter(
#if NeedFunctionPrototypes
XLCd /* from_lcd */,
char* /* from_type */,
XLCd /* to_lcd */,
char* /* to_type */
#endif
);
extern void _fallcCloseConverter(
#if NeedFunctionPrototypes
XlcConv /* conv */
#endif
);
extern int _fallcConvert(
#if NeedFunctionPrototypes
XlcConv /* conv */,
XPointer* /* from */,
int* /* from_left */,
XPointer* /* to */,
int* /* to_left */,
XPointer* /* args */,
int /* num_args */
#endif
);
extern void _fallcResetConverter(
#if NeedFunctionPrototypes
XlcConv /* conv */
#endif
);
extern Bool _fallcSetConverter(
#if NeedFunctionPrototypes
XLCd /* from_lcd */,
char* /* from_type */,
XLCd /* to_lcd */,
char* /* to_type */,
XlcOpenConverterProc /* open_converter */
#endif
);
extern void _fallcGetResource(
#if NeedFunctionPrototypes
XLCd /* lcd */,
char* /* category */,
char* /* class */,
char*** /* value */,
int* /* count */
#endif
);
extern char *_fallcFileName(
#if NeedFunctionPrototypes
XLCd /* lcd */,
char* /* category */
#endif
);
extern int _falwcslen(
#if NeedFunctionPrototypes
wchar_t* /* wstr */
#endif
);
extern wchar_t *_falwcscpy(
#if NeedFunctionPrototypes
wchar_t* /* wstr1 */,
wchar_t* /* wstr2 */
#endif
);
extern int _fallcCompareISOLatin1(
#if NeedFunctionPrototypes
char* /* str1 */,
char* /* str2 */
#endif
);
extern int _fallcNCompareISOLatin1(
#if NeedFunctionPrototypes
char* /* str1 */,
char* /* str2 */,
int /* len */
#endif
);
_XFUNCPROTOEND
#endif /* _XLCPUBLIC_H_ */

View File

@@ -1,145 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* lcRM.c 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:40 */
/* $XConsortium: _fallcRM.c /main/1 1996/04/08 15:18:41 cde-fuj $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of TOSHIBA not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. TOSHIBA make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
#include "_fallibint.h"
#include "_fallcPubI.h"
#include <stdio.h>
typedef struct _StateRec {
XLCd lcd;
XlcConv conv;
} StateRec, *State;
static void
mbinit(state)
XPointer state;
{
_fallcResetConverter(((State) state)->conv);
}
static char
mbchar(state, str, lenp)
XPointer state;
char *str;
int *lenp;
{
XlcConv conv = ((State) state)->conv;
XlcCharSet charset;
char *from, *to, buf[BUFSIZ];
int from_left, to_left;
XPointer args[1];
from = str;
*lenp = from_left = XLC_PUBLIC(((State) state)->lcd, mb_cur_max);
to = buf;
to_left = BUFSIZ;
args[0] = (XPointer) &charset;
_fallcConvert(conv, (XPointer *) &from, &from_left, (XPointer *) &to,
&to_left, args, 1);
*lenp -= from_left;
/* XXX */
return buf[0];
}
static void
mbfinish(state)
XPointer state;
{
}
static char *
lcname(state)
XPointer state;
{
return ((State) state)->lcd->core->name;
}
static void
destroy(state)
XPointer state;
{
_fallcCloseConverter(((State) state)->conv);
_falCloseLC(((State) state)->lcd);
Xfree((char *) state);
}
static XrmMethodsRec rm_methods = {
mbinit,
mbchar,
mbfinish,
lcname,
destroy
} ;
XrmMethods
_falrmDefaultInitParseInfo(lcd, rm_state)
XLCd lcd;
XPointer *rm_state;
{
State state;
state = (State) Xmalloc(sizeof(StateRec));
if (state == NULL)
return (XrmMethods) NULL;
state->lcd = lcd;
state->conv = _fallcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNChar);
if (state->conv == NULL) {
Xfree((char *) state);
return (XrmMethods) NULL;
}
*rm_state = (XPointer) state;
return &rm_methods;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,328 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* lcStd.c 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:41 */
/* $XConsortium: _fallcStd.c /main/1 1996/04/08 15:19:02 cde-fuj $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of TOSHIBA not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. TOSHIBA make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
#include "_fallibint.h"
#include "_fallcPubI.h"
int
_fallcmbtowc(lcd, wstr, str, len)
XLCd lcd;
wchar_t *wstr;
char *str;
int len;
{
static XLCd last_lcd = NULL;
static XlcConv conv = NULL;
XPointer from, to;
int from_left, to_left;
wchar_t tmp_wc;
if (lcd == NULL) {
lcd = _fallcCurrentLC();
if (lcd == NULL)
return -1;
}
if (str == NULL)
return XLC_PUBLIC(lcd, is_state_depend);
if (conv && lcd != last_lcd) {
_fallcCloseConverter(conv);
conv = NULL;
}
last_lcd = lcd;
if (conv == NULL) {
conv = _fallcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar);
if (conv == NULL)
return -1;
}
from = (XPointer) str;
from_left = len;
to = (XPointer) (wstr ? wstr : &tmp_wc);
to_left = 1;
if (_fallcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0)
return -1;
return (len - from_left);
}
int
_fallcwctomb(lcd, str, wc)
XLCd lcd;
char *str;
wchar_t wc;
{
static XLCd last_lcd = NULL;
static XlcConv conv = NULL;
XPointer from, to;
int from_left, to_left, length;
if (lcd == NULL) {
lcd = _fallcCurrentLC();
if (lcd == NULL)
return -1;
}
if (str == NULL)
return XLC_PUBLIC(lcd, is_state_depend);
if (conv && lcd != last_lcd) {
_fallcCloseConverter(conv);
conv = NULL;
}
last_lcd = lcd;
if (conv == NULL) {
conv = _fallcOpenConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte);
if (conv == NULL)
return -1;
}
from = (XPointer) &wc;
from_left = 1;
to = (XPointer) str;
length = to_left = XLC_PUBLIC(lcd, mb_cur_max);
if (_fallcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0)
return -1;
return (length - to_left);
}
int
_fallcmbstowcs(lcd, wstr, str, len)
XLCd lcd;
wchar_t *wstr;
char *str;
int len;
{
XlcConv conv;
XPointer from, to;
int from_left, to_left, ret;
if (lcd == NULL) {
lcd = _fallcCurrentLC();
if (lcd == NULL)
return -1;
}
conv = _fallcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar);
if (conv == NULL)
return -1;
from = (XPointer) str;
from_left = strlen(str);
to = (XPointer) wstr;
to_left = len;
if (_fallcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0)
ret = -1;
else {
ret = len - to_left;
if (wstr && to_left > 0)
wstr[ret] = (wchar_t) 0;
}
_fallcCloseConverter(conv);
return ret;
}
int
_fallcwcstombs(lcd, str, wstr, len)
XLCd lcd;
char *str;
wchar_t *wstr;
int len;
{
XlcConv conv;
XPointer from, to;
int from_left, to_left, ret;
if (lcd == NULL) {
lcd = _fallcCurrentLC();
if (lcd == NULL)
return -1;
}
conv = _fallcOpenConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte);
if (conv == NULL)
return -1;
from = (XPointer) wstr;
from_left = _falwcslen(wstr);
to = (XPointer) str;
to_left = len;
if (_fallcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0)
ret = -1;
else {
ret = len - to_left;
if (str && to_left > 0)
str[ret] = '\0';
}
_fallcCloseConverter(conv);
return ret;
}
int
_falmbtowc(wstr, str, len)
wchar_t *wstr;
char *str;
int len;
{
return _fallcmbtowc((XLCd) NULL, wstr, str, len);
}
int
_falmblen(str, len)
char *str;
int len;
{
return _falmbtowc((wchar_t *) NULL, str, len);
}
int
_falwctomb(str, wc)
char *str;
wchar_t wc;
{
return _fallcwctomb((XLCd) NULL, str, wc);
}
int
_falmbstowcs(wstr, str, len)
wchar_t *wstr;
char *str;
int len;
{
return _fallcmbstowcs((XLCd) NULL, wstr, str, len);
}
int
_falwcstombs(str, wstr, len)
char *str;
wchar_t *wstr;
int len;
{
return _fallcwcstombs((XLCd) NULL, str, wstr, len);
}
wchar_t *
_falwcscpy(wstr1, wstr2)
register wchar_t *wstr1, *wstr2;
{
wchar_t *wstr_tmp = wstr1;
while (*wstr1++ = *wstr2++)
;
return wstr_tmp;
}
wchar_t *
_falwcsncpy(wstr1, wstr2, len)
register wchar_t *wstr1, *wstr2;
register len;
{
wchar_t *wstr_tmp = wstr1;
while (len-- > 0)
if (!(*wstr1++ = *wstr2++))
break;
while (len-- > 0)
*wstr1++ = (wchar_t) 0;
return wstr_tmp;
}
int
_falwcslen(wstr)
register wchar_t *wstr;
{
register wchar_t *wstr_ptr = wstr;
while (*wstr_ptr)
wstr_ptr++;
return wstr_ptr - wstr;
}
int
_falwcscmp(wstr1, wstr2)
register wchar_t *wstr1, *wstr2;
{
for ( ; *wstr1 && *wstr2; wstr1++, wstr2++)
if (*wstr1 != *wstr2)
break;
return *wstr1 - *wstr2;
}
int
_falwcsncmp(wstr1, wstr2, len)
register wchar_t *wstr1, *wstr2;
register len;
{
for ( ; *wstr1 && *wstr2 && len > 0; wstr1++, wstr2++, len--)
if (*wstr1 != *wstr2)
break;
if (len <= 0)
return 0;
return *wstr1 - *wstr2;
}

View File

@@ -1,255 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* lcTxtPr.c 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:41 */
/* $XConsortium: _fallcTxtPr.c /main/1 1996/04/08 15:19:12 cde-fuj $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of TOSHIBA not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. TOSHIBA make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
#include "_fallibint.h"
#include "_fallcPubI.h"
#include "_falutil.h"
#include <X11/Xatom.h>
#include <stdio.h>
static int
get_buf_size(is_wide_char, list, count)
Bool is_wide_char;
XPointer list;
int count;
{
register length = 0;
register char **mb_list;
register wchar_t **wc_list;
if (list == NULL)
return 0;
if (is_wide_char) {
wc_list = (wchar_t **) list;
for ( ; count-- > 0; wc_list++) {
if (*wc_list)
length += _falwcslen(*wc_list) + 1;
}
length *= 5; /* XXX */
} else {
mb_list = (char **) list;
for ( ; count-- > 0; mb_list++) {
if (*mb_list)
length += strlen(*mb_list) + 1;
}
length *= 3; /* XXX */
}
length = (length / BUFSIZ + 1) * BUFSIZ; /* XXX */
return length;
}
static int
_XTextListToTextProperty(lcd, dpy, from_type, list, count, style, text_prop)
XLCd lcd;
Display *dpy;
char *from_type;
XPointer list;
int count;
XICCEncodingStyle style;
XTextProperty *text_prop;
{
Atom encoding;
XlcConv conv;
char *to_type;
char **mb_list;
wchar_t **wc_list;
XPointer from;
char *to, *buf, *value;
int from_left, to_left, buf_len, nitems, unconv_num, ret, i;
Bool is_wide_char = False;
if (strcmp(XlcNWideChar, from_type) == 0)
is_wide_char = True;
buf_len = get_buf_size(is_wide_char, list, count);
if ((buf = (char *) Xmalloc(buf_len)) == NULL)
return XNoMemory;
switch (style) {
case XStringStyle:
case XStdICCTextStyle:
encoding = XA_STRING;
to_type = XlcNString;
break;
case XCompoundTextStyle:
encoding = falInternAtom(dpy, "COMPOUND_TEXT", False);
to_type = XlcNCompoundText;
break;
case XTextStyle:
encoding = falInternAtom(dpy, XLC_PUBLIC(lcd, encoding_name), False);
to_type = XlcNMultiByte;
if (is_wide_char == False) {
nitems = 0;
mb_list = (char **) list;
to = buf;
for (i = 0; i < count; i++) {
strcpy(to, *mb_list);
from_left = strlen(*mb_list) + 1;
nitems += from_left;
to += from_left;
mb_list++;
}
unconv_num = 0;
goto done;
}
break;
default:
Xfree(buf);
return XConverterNotFound;
}
if (count < 1) {
nitems = 0;
goto done;
}
retry:
conv = _fallcOpenConverter(lcd, from_type, lcd, to_type);
if (conv == NULL) {
Xfree(buf);
return XConverterNotFound;
}
if (is_wide_char)
wc_list = (wchar_t **) list;
else
mb_list = (char **) list;
to = buf;
to_left = buf_len;
unconv_num = 0;
for (i = 1; to_left > 0; i++) {
if (is_wide_char) {
from = (XPointer) *wc_list;
from_left = _falwcslen(*wc_list);
wc_list++;
} else {
from = (XPointer) *mb_list;
from_left = strlen(*mb_list);
mb_list++;
}
ret = _fallcConvert(conv, &from, &from_left, (XPointer *) &to, &to_left,
NULL, 0);
if (ret < 0)
continue;
if (ret > 0 && style == XStdICCTextStyle && encoding == XA_STRING) {
_fallcCloseConverter(conv);
encoding = falInternAtom(dpy, "COMPOUND_TEXT", False);
to_type = XlcNCompoundText;
goto retry;
}
unconv_num += ret;
*to++ = '\0';
to_left--;
if (i >= count)
break;
_fallcResetConverter(conv);
}
_fallcCloseConverter(conv);
nitems = to - buf;
done:
if (nitems <= 0)
nitems = 1;
value = (char *) Xmalloc(nitems);
if (value == NULL) {
Xfree(buf);
return XNoMemory;
}
if (nitems == 1)
*value = 0;
else
memcpy(value, buf, nitems);
nitems--;
Xfree(buf);
text_prop->value = (unsigned char *) value;
text_prop->encoding = encoding;
text_prop->format = 8;
text_prop->nitems = nitems;
return unconv_num;
}
int
_falmbTextListToTextProperty(lcd, dpy, list, count, style, text_prop)
XLCd lcd;
Display *dpy;
char **list;
int count;
XICCEncodingStyle style;
XTextProperty *text_prop;
{
return _XTextListToTextProperty(lcd, dpy, XlcNMultiByte, (XPointer) list,
count, style, text_prop);
}
int
_falwcTextListToTextProperty(lcd, dpy, list, count, style, text_prop)
XLCd lcd;
Display *dpy;
wchar_t **list;
int count;
XICCEncodingStyle style;
XTextProperty *text_prop;
{
return _XTextListToTextProperty(lcd, dpy, XlcNWideChar, (XPointer) list,
count, style, text_prop);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,196 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* XlcUTF.h 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:06 */
/* $XConsortium: _fallcUTF.h /main/1 1996/04/08 15:19:33 cde-fuj $ */
/******************************************************************
Copyright 1993 by SunSoft, Inc.
Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee,
provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear
in supporting documentation, and that the name of SunSoft, Inc.
not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission.
SunSoft, Inc. makes no representations about the suitability of
this software for any purpose. It is provided "as is" without
express or implied warranty.
SunSoft Inc. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
IN NO EVENT SHALL SunSoft, Inc. BE LIABLE FOR ANY SPECIAL, INDIRECT
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
OR PERFORMANCE OF THIS SOFTWARE.
Author: Hiromu Inukai (inukai@Japan.Sun.COM) SunSoft, inc.
******************************************************************/
#include "_fallibint.h"
#include "_fallcGeneric.h"
#include <X11/Xos.h>
#include <stdio.h>
typedef unsigned short Rune; /* 16 bits */
#define Runeerror 0x80 /* decoding error in UTF */
#define Runeself 0x80 /* rune and UTF sequences are the same (<) */
#define UTFmax 3 /* maximum bytes per rune */
#define BADMAP (0xFFFD)
#define ESC 033
#define NRUNE 65536
#define NLATIN 0x6ff
#define LATINMAX 256
#define KUTENMAX 8407
#define KSCMAX 8743
#define GBMAX 8795
#define tab8859_1 "tab8859_1"
#define tab8859_2 "tab8859_2"
#define tab8859_3 "tab8859_3"
#define tab8859_4 "tab8859_4"
#define tab8859_5 "tab8859_5"
#define tab8859_6 "tab8859_6"
#define tab8859_7 "tab8859_7"
#define tab8859_8 "tab8859_8"
#define tab8859_9 "tab8859_9"
#define jis0208 "jis0208"
#define ksc5601 "ksc5601"
#define gb2312 "gb2312"
#define emit(x) *r = (Rune)x;
typedef enum {
N11n_none, /* No need to normalize (1byte) */
N11n_ja, /* Normalize for ja */
N11n_ko, /* Normalize for ko */
N11n_zh /* Normalize for zh */
} NormalizeType;
typedef struct _UtfDataRec {
XlcCharSet charset;
void (*initialize)( /* Table Initializer */
#if NeedNestedPrototypes
long *tbl,
long fallback
#endif
);
long *fromtbl; /* UTF -> CharSet */
NormalizeType type; /* Normalize type */
void (*cstorune)( /* CharSet -> UTF */
#if NeedNestedPrototypes
unsigned char c,
Rune *r
#endif
);
Bool already_init;
struct _UtfDataRec *next; /* next entry */
} UtfDataRec, *UtfData;
typedef struct _XlcUTFDataRec {
char *name;
XlcSide side;
void (*initialize)();
void (*cstorune)(
#if NeedNestedPrototypes
unsigned char c,
Rune *r
#endif
);
NormalizeType type;
long fallback_value;
} XlcUTFDataRec, *XlcUTFData;
typedef struct _StateRec {
XlcCharSet charset;
XlcCharSet GL_charset;
XlcCharSet GR_charset;
} StateRec, *State;
#define MAX_UTF_CHARSET (sizeof(default_utf_data)/sizeof(XlcUTFDataRec))
#define Char1 Runeself
#define Rune1 Runeself
#define Char21 0xA1
#define Rune21 0x0100
#define Char22 0xF6
#define Rune22 0x4016
#define Char3 0xFC
#define Rune3 0x10000 /* really 0x38E2E */
#define Esc 0xBE
#define Bad Runeerror
#define T1 0x00
#define Tx 0x80
#define T2 0xC0
#define T3 0xE0
#define T4 0xF0
#define T5 0xF8
#define T6 0xFC
#define Bit1 7
#define Bitx 6
#define Bit2 5
#define Bit3 4
#define Bit4 3
#define Bit5 2
#define Bit6 2
#define Mask1 (1<<Bit1)-1
#define Maskx (1<<Bitx)-1
#define Mask2 (1<<Bit2)-1
#define Mask3 (1<<Bit3)-1
#define Mask4 (1<<Bit4)-1
#define Mask5 (1<<Bit5)-1
#define Mask6 (1<<Bit6)-1
#define Wchar1 (1<<Bit1)-1
#define Wchar2 (1<<(Bit2+Bitx))-1
#define Wchar3 (1<<(Bit3+2*Bitx))-1
#define Wchar4 (1<<(Bit4+3*Bitx))-1
#define Wchar5 (1<<(Bit5+4*Bitx))-1
#ifndef EILSEQ
#define EILSEQ 123
#endif
#define J2S(_h, _l) { \
/* lower: 21-7e >> 40-9d,9e-fb >> 40-7e,(skip 7f),80-fc */ \
if (((_l) += (((_h)-- % 2) ? 0x1f : 0x7d)) > 0x7e) (_l)++; \
/* upper: 21-7e >> 81-af >> 81-9f,(skip a0-df),e0-ef */ \
if (((_h) = ((_h) / 2 + 0x71)) > 0x9f) (_h) += 0x40; \
}
#define S2J(_h, _l) { \
/* lower: 40-7e,80-fc >> 21-5f,61-dd >> 21-7e,7f-dc */ \
if (((_l) -= 0x1f) > 0x60) (_l)--; \
/* upper: 81-9f,e0-ef >> 00-1e,5f-6e >> 00-2e >> 21-7d */ \
if (((_h) -= 0x81) > 0x5e) (_h) -= 0x40; (_h) *= 2, (_h) += 0x21; \
/* upper: ,21-7d >> ,22-7e ; lower: ,7f-dc >> ,21-7e */ \
if ((_l) > 0x7e) (_h)++, (_l) -= 0x5e; \
}
#define ISJKANA(_b) (0xa0 <= (_b) && (_b) < 0xe0)
#define CANS2JH(_h) ((0x81 <= (_h) && (_h) < 0xf0) && !ISJKANA(_h))
#define CANS2JL(_l) (0x40 <= (_l) && (_l) < 0xfd && (_l) != 0x7f)
#define CANS2J(_h, _l) (CANS2JH(_h) && CANS2JL(_l))

View File

@@ -1,101 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* lcUtil.c 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:42 */
/* $XConsortium: _fallcUtil.c /main/1 1996/04/08 15:19:43 cde-fuj $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of TOSHIBA not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. TOSHIBA make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
#include <stdio.h>
#include <ctype.h>
#include <X11/Xos.h>
#include "_fallibint.h"
#ifdef X_NOT_STDC_ENV
#ifndef toupper
#define toupper(c) ((int)(c) - 'a' + 'A')
#endif
#endif
int
_fallcCompareISOLatin1(str1, str2)
char *str1, *str2;
{
register char ch1, ch2;
for ( ; (ch1 = *str1) && (ch2 = *str2); str1++, str2++) {
if (islower(ch1))
ch1 = toupper(ch1);
if (islower(ch2))
ch2 = toupper(ch2);
if (ch1 != ch2)
break;
}
return *str1 - *str2;
}
int
_fallcNCompareISOLatin1(str1, str2, len)
char *str1, *str2;
int len;
{
register char ch1, ch2;
for ( ; (ch1 = *str1) && (ch2 = *str2) && len; str1++, str2++, len--) {
if (islower(ch1))
ch1 = toupper(ch1);
if (islower(ch2))
ch2 = toupper(ch2);
if (ch1 != ch2)
break;
}
if (len == 0)
return 0;
return *str1 - *str2;
}

View File

@@ -1,637 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* lcWrap.c 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:42 */
/* $XConsortium: _fallcWrap.c /main/1 1996/04/08 15:19:54 cde-fuj $ */
/*
Copyright (c) 1991 X Consortium
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 X CONSORTIUM 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 name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
*/
/*
* Copyright 1991 by the Open Software Foundation
* Copyright 1993 by the TOSHIBA Corp.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the names of Open Software Foundation and TOSHIBA
* not be used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. Open Software
* Foundation and TOSHIBA make no representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* OPEN SOFTWARE FOUNDATION AND TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL OPEN SOFTWARE FOUNDATIONN OR TOSHIBA BE
* LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* M. Collins OSF
*
* Katsuhisa Yano TOSHIBA Corp.
*/
#include <stdint.h>
#include "_fallibint.h"
#include "_fallcint.h"
#if defined(__linux__)
#include <locale.h>
#else
#include <X11/Xlocale.h>
#endif
#include <X11/Xos.h>
#ifdef WIN32
#undef close
#endif
#include "_falutil.h"
#ifdef __STDC__
#define Const const
#else
#define Const /**/
#endif
#ifdef X_NOT_STDC_ENV
extern char *getenv();
#endif
extern void _fallcInitLoader(
#if NeedFunctionPrototypes
void
#endif
);
#ifdef XTHREADS
LockInfoPtr _Xi18n_lock;
#endif
#if NeedFunctionPrototypes
char *
falSetLocaleModifiers(
_Xconst char *modifiers
)
#else
char *
falSetLocaleModifiers(modifiers)
char *modifiers;
#endif
{
XLCd lcd = _fallcCurrentLC();
char *user_mods;
if (!lcd)
return (char *) NULL;
if (!modifiers)
return lcd->core->modifiers;
user_mods = getenv("XMODIFIERS");
modifiers = (*lcd->methods->map_modifiers) (lcd,
user_mods, (char *)modifiers);
if (modifiers) {
if (lcd->core->modifiers)
Xfree(lcd->core->modifiers);
lcd->core->modifiers = (char *)modifiers;
}
return (char *)modifiers;
}
Bool
falSupportsLocale()
{
return _fallcCurrentLC() != (XLCd)NULL;
}
Bool _fallcValidModSyntax(mods, valid_mods)
char *mods;
char **valid_mods;
{
int i;
char **ptr;
while (mods && (*mods == '@')) {
mods++;
if (*mods == '@')
break;
for (ptr = valid_mods; *ptr; ptr++) {
i = strlen(*ptr);
if (strncmp(mods, *ptr, i) || ((mods[i] != '=')
#ifdef WIN32
&& (mods[i] != '#')
#endif
))
continue;
mods = strchr(mods+i+1, '@');
break;
}
}
return !mods || !*mods;
}
static Const char *im_valid[] = {"im", (char *)NULL};
/*ARGSUSED*/
char *
_fallcDefaultMapModifiers (lcd, user_mods, prog_mods)
XLCd lcd;
char *user_mods;
char *prog_mods;
{
int i;
char *mods;
if (!_fallcValidModSyntax(prog_mods, (char **)im_valid))
return (char *)NULL;
if (!_fallcValidModSyntax(user_mods, (char **)im_valid))
return (char *)NULL;
i = strlen(prog_mods) + 1;
if (user_mods)
i += strlen(user_mods);
mods = Xmalloc(i);
if (mods) {
strcpy(mods, prog_mods);
if (user_mods)
strcat(mods, user_mods);
#ifdef WIN32
{
char *s;
for (s = mods; s = strchr(s, '@'); s++) {
for (s++; *s && *s != '='; s++) {
if (*s == '#') {
*s = '=';
break;
}
}
}
}
#endif
}
return mods;
}
typedef struct _XLCdListRec {
struct _XLCdListRec *next;
XLCd lcd;
int ref_count;
} XLCdListRec, *XLCdList;
static XLCdList lcd_list = NULL;
typedef struct _XlcLoaderListRec {
struct _XlcLoaderListRec *next;
XLCdLoadProc proc;
} XlcLoaderListRec, *XlcLoaderList;
static XlcLoaderList loader_list = NULL;
void
_fallcRemoveLoader(proc)
XLCdLoadProc proc;
{
XlcLoaderList loader, prev;
if (loader_list == NULL)
return;
prev = loader = loader_list;
if (loader->proc == proc) {
loader_list = loader->next;
Xfree(loader);
return;
}
while (loader = loader->next) {
if (loader->proc == proc) {
prev->next = loader->next;
Xfree(loader);
return;
}
prev = loader;
}
return;
}
Bool
_fallcAddLoader(proc, position)
XLCdLoadProc proc;
XlcPosition position;
{
XlcLoaderList loader, last;
_fallcRemoveLoader(proc); /* remove old loader, if exist */
loader = (XlcLoaderList) Xmalloc(sizeof(XlcLoaderListRec));
if (loader == NULL)
return False;
loader->proc = proc;
if (loader_list == NULL)
position = XlcHead;
if (position == XlcHead) {
loader->next = loader_list;
loader_list = loader;
} else {
last = loader_list;
while (last->next)
last = last->next;
loader->next = NULL;
last->next = loader;
}
return True;
}
XLCd
_falOpenLC(name)
char *name;
{
XLCd lcd;
XlcLoaderList loader;
XLCdList cur;
#if !defined(X_NOT_STDC_ENV) && !defined(X_LOCALE)
char siname[256];
char *_fallcMapOSLocaleName();
#endif
if (name == NULL) {
name = setlocale (LC_CTYPE, (char *)NULL);
#if !defined(X_NOT_STDC_ENV) && !defined(X_LOCALE)
name = _fallcMapOSLocaleName (name, siname);
#endif
}
_XLockMutex(_Xi18n_lock);
/*
* search for needed lcd, if found return it
*/
for (cur = lcd_list; cur; cur = cur->next) {
if (!strcmp (cur->lcd->core->name, name)) {
lcd = cur->lcd;
cur->ref_count++;
goto found;
}
}
if (!loader_list)
_fallcInitLoader();
/*
* not there, so try to get and add to list
*/
for (loader = loader_list; loader; loader = loader->next) {
lcd = (*loader->proc)(name);
if (lcd) {
cur = (XLCdList) Xmalloc (sizeof(XLCdListRec));
if (cur) {
cur->lcd = lcd;
cur->ref_count = 1;
cur->next = lcd_list;
lcd_list = cur;
} else {
(*lcd->methods->close)(lcd);
lcd = (XLCd) NULL;
}
break;
}
}
found:
_XUnlockMutex(_Xi18n_lock);
return lcd;
}
void
_falCloseLC(lcd)
XLCd lcd;
{
XLCdList cur, *prev;
for (prev = &lcd_list; cur = *prev; prev = &cur->next) {
if (cur->lcd == lcd) {
if (--cur->ref_count < 1) {
(*lcd->methods->close)(lcd);
*prev = cur->next;
Xfree(cur);
}
break;
}
}
}
/*
* Get the XLCd for the current locale
*/
XLCd
_fallcCurrentLC()
{
XLCd lcd;
static XLCd last_lcd = NULL;
lcd = _falOpenLC((char *) NULL);
if (last_lcd)
_falCloseLC(last_lcd);
last_lcd = lcd;
return lcd;
}
XrmMethods
_falrmInitParseInfo(state)
XPointer *state;
{
XLCd lcd = _falOpenLC((char *) NULL);
if (lcd == (XLCd) NULL)
return (XrmMethods) NULL;
return (*lcd->methods->init_parse_info)(lcd, state);
}
int
falmbTextPropertyToTextList(dpy, text_prop, list_ret, count_ret)
Display *dpy;
XTextProperty *text_prop;
char ***list_ret;
int *count_ret;
{
XLCd lcd = _fallcCurrentLC();
if (lcd == NULL)
return XLocaleNotSupported;
return (*lcd->methods->mb_text_prop_to_list)(lcd, dpy, text_prop, list_ret,
count_ret);
}
int
falwcTextPropertyToTextList(dpy, text_prop, list_ret, count_ret)
Display *dpy;
XTextProperty *text_prop;
wchar_t ***list_ret;
int *count_ret;
{
XLCd lcd = _fallcCurrentLC();
if (lcd == NULL)
return XLocaleNotSupported;
return (*lcd->methods->wc_text_prop_to_list)(lcd, dpy, text_prop, list_ret,
count_ret);
}
int
falmbTextListToTextProperty(dpy, list, count, style, text_prop)
Display *dpy;
char **list;
int count;
XICCEncodingStyle style;
XTextProperty *text_prop;
{
XLCd lcd = _fallcCurrentLC();
if (lcd == NULL)
return XLocaleNotSupported;
return (*lcd->methods->mb_text_list_to_prop)(lcd, dpy, list, count, style,
text_prop);
}
int
falwcTextListToTextProperty(dpy, list, count, style, text_prop)
Display *dpy;
wchar_t **list;
int count;
XICCEncodingStyle style;
XTextProperty *text_prop;
{
XLCd lcd = _fallcCurrentLC();
if (lcd == NULL)
return XLocaleNotSupported;
return (*lcd->methods->wc_text_list_to_prop)(lcd, dpy, list, count, style,
text_prop);
}
void
falwcFreeStringList(list)
wchar_t **list;
{
XLCd lcd = _fallcCurrentLC();
if (lcd == NULL)
return;
(*lcd->methods->wc_free_string_list)(lcd, list);
}
char *
falDefaultString()
{
XLCd lcd = _fallcCurrentLC();
if (lcd == NULL)
return (char *) NULL;
return (*lcd->methods->default_string)(lcd);
}
void
_fallcCopyFromArg(src, dst, size)
char *src;
register char *dst;
register int size;
{
if (size == sizeof(long))
*((long *) dst) = (long) src;
#ifdef LONG64
else if (size == sizeof(int))
*((int *) dst) = (int) (intptr_t) src;
#endif
else if (size == sizeof(short))
*((short *) dst) = (short) (intptr_t) src;
else if (size == sizeof(char))
*((char *) dst) = (char) (intptr_t) src;
else if (size == sizeof(XPointer))
*((XPointer *) dst) = (XPointer) src;
else if (size > sizeof(XPointer))
memcpy(dst, (char *) src, size);
else
memcpy(dst, (char *) &src, size);
}
void
_fallcCopyToArg(src, dst, size)
register char *src;
register char **dst;
register int size;
{
if (size == sizeof(long))
*((long *) *dst) = *((long *) src);
else if (size == sizeof(short))
*((short *) *dst) = *((short *) src);
else if (size == sizeof(char))
*((char *) *dst) = *((char *) src);
else if (size == sizeof(XPointer))
*((XPointer *) *dst) = *((XPointer *) src);
else
memcpy(*dst, src, size);
}
void
_fallcCountVaList(var, count_ret)
va_list var;
int *count_ret;
{
register int count;
for (count = 0; va_arg(var, char *); count++)
va_arg(var, XPointer);
*count_ret = count;
}
void
_fallcVaToArgList(var, count, args_ret)
va_list var;
register int count;
XlcArgList *args_ret;
{
register XlcArgList args;
*args_ret = args = (XlcArgList) Xmalloc(sizeof(XlcArg) * count);
if (args == (XlcArgList) NULL)
return;
for ( ; count-- > 0; args++) {
args->name = va_arg(var, char *);
args->value = va_arg(var, XPointer);
}
}
void
_fallcCompileResourceList(resources, num_resources)
register XlcResourceList resources;
register int num_resources;
{
for ( ; num_resources-- > 0; resources++)
resources->xrm_name = falrmPermStringToQuark(resources->name);
}
char *
_fallcGetValues(base, resources, num_resources, args, num_args, mask)
XPointer base;
XlcResourceList resources;
int num_resources;
XlcArgList args;
int num_args;
unsigned long mask;
{
XlcResourceList res;
XrmQuark xrm_name;
int count;
for ( ; num_args-- > 0; args++) {
res = resources;
count = num_resources;
xrm_name = falrmPermStringToQuark(args->name);
for ( ; count-- > 0; res++) {
if (xrm_name == res->xrm_name && (mask & res->mask)) {
_fallcCopyToArg(base + res->offset, &args->value, res->size);
break;
}
}
if (count < 0)
return args->name;
}
return NULL;
}
char *
_fallcSetValues(base, resources, num_resources, args, num_args, mask)
XPointer base;
XlcResourceList resources;
int num_resources;
XlcArgList args;
int num_args;
unsigned long mask;
{
XlcResourceList res;
XrmQuark xrm_name;
int count;
for ( ; num_args-- > 0; args++) {
res = resources;
count = num_resources;
xrm_name = falrmPermStringToQuark(args->name);
for ( ; count-- > 0; res++) {
if (xrm_name == res->xrm_name && (mask & res->mask)) {
_fallcCopyFromArg(args->value, base + res->offset, res->size);
break;
}
}
if (count < 0)
return args->name;
}
return NULL;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,197 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* locking.h 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:43 */
/* $XConsortium: _fallocking.h /main/1 1996/04/08 15:21:32 cde-fuj $ */
/*
Copyright (c) 1992 X Consortium
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
X CONSORTIUM 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 name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
*/
/*
* Author: Stephen Gildea, MIT X Consortium
*
* locking.h - data types for C Threads locking.
* Used by XlibInt.c, locking.c, LockDis.c
*/
#ifndef _X_locking_H_
#define _X_locking_H_
#define xmalloc(s) Xmalloc(s)
#define xfree(s) Xfree(s)
#include <X11/Xthreads.h>
struct _XCVList {
xcondition_t cv;
xReply *buf;
struct _XCVList *next;
};
extern xthread_t (*_Xthread_self_fn)( /* in XlibInt.c */
#if NeedFunctionPrototypes
void
#endif
);
/* Display->lock is a pointer to one of these */
struct _XLockInfo {
xmutex_t mutex; /* mutex for critical sections */
int reply_bytes_left; /* nbytes of the reply still to read */
Bool reply_was_read; /* _XReadEvents read a reply for _XReply */
struct _XCVList *reply_awaiters; /* list of CVs for _XReply */
struct _XCVList **reply_awaiters_tail;
struct _XCVList *event_awaiters; /* list of CVs for _XReadEvents */
struct _XCVList **event_awaiters_tail;
Bool reply_first; /* who may read, reply queue or event queue */
/* for XLockDisplay */
int locking_level; /* how many times into XLockDisplay we are */
xthread_t locking_thread; /* thread that did XLockDisplay */
xcondition_t cv; /* wait if another thread has XLockDisplay */
xthread_t reading_thread; /* cache */
xthread_t conni_thread; /* thread in XProcessInternalConnection */
xcondition_t writers; /* wait for writable */
int num_free_cvls;
struct _XCVList *free_cvls;
/* used only in XlibInt.c */
void (*pop_reader)(
#if NeedNestedPrototypes
Display* /* dpy */,
struct _XCVList** /* list */,
struct _XCVList*** /* tail */
#endif
);
struct _XCVList *(*push_reader)(
#if NeedNestedPrototypes
Display * /* dpy */,
struct _XCVList*** /* tail */
#endif
);
void (*condition_wait)(
#if NeedNestedPrototypes
xcondition_t /* cv */,
xmutex_t /* mutex */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char* /* file */,
int /* line */
#endif
#endif
);
void (*internal_lock_display)(
#if NeedNestedPrototypes
Display* /* dpy */,
Bool /* wskip */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char* /* file */,
int /* line */
#endif
#endif
);
/* used in XlibInt.c and locking.c */
void (*condition_signal)(
#if NeedNestedPrototypes
xcondition_t /* cv */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char* /* file */,
int /* line */
#endif
#endif
);
void (*condition_broadcast)(
#if NeedNestedPrototypes
xcondition_t /* cv */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char* /* file */,
int /* line */
#endif
#endif
);
/* used in XlibInt.c and XLockDis.c */
void (*lock_wait)(
#if NeedNestedPrototypes
Display* /* dpy */
#endif
);
void (*user_lock_display)(
#if NeedNestedPrototypes
Display* /* dpy */
#endif
);
void (*user_unlock_display)(
#if NeedNestedPrototypes
Display* /* dpy */
#endif
);
struct _XCVList *(*create_cvl)(
#if NeedNestedPrototypes
Display * /* dpy */
#endif
);
};
#define UnlockNextEventReader(d) if ((d)->lock) \
(*(d)->lock->pop_reader)((d),&(d)->lock->event_awaiters,&(d)->lock->event_awaiters_tail)
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
#define ConditionWait(d,c) if ((d)->lock) \
(*(d)->lock->condition_wait)(c, (d)->lock->mutex,__FILE__,__LINE__)
#define ConditionSignal(d,c) if ((d)->lock) \
(*(d)->lock->condition_signal)(c,__FILE__,__LINE__)
#define ConditionBroadcast(d,c) if ((d)->lock) \
(*(d)->lock->condition_broadcast)(c,__FILE__,__LINE__)
#else
#define ConditionWait(d,c) if ((d)->lock) \
(*(d)->lock->condition_wait)(c, (d)->lock->mutex)
#define ConditionSignal(d,c) if ((d)->lock) \
(*(d)->lock->condition_signal)(c)
#define ConditionBroadcast(d,c) if ((d)->lock) \
(*(d)->lock->condition_broadcast)(c)
#endif
typedef struct _LockInfoRec {
xmutex_t lock;
} LockInfoRec;
#endif /* _X_locking_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,204 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* XomGeneric.h 1.6 - Fujitsu source for CDEnext 96/02/29 18:02:52 */
/* $XConsortium: _falomGeneric.h /main/1 1996/04/08 15:20:29 cde-fuj $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of TOSHIBA not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. TOSHIBA make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
/*
* Copyright 1995 by FUJITSU LIMITED
* This is source code modified by FUJITSU LIMITED under the Joint
* Development Agreement for the CDEnext PST.
* This is unpublished proprietary source code of FUJITSU LIMITED
*
* Modifier: Takanori Tateno FUJITSU LIMITED
*
*/
#ifndef _XOMGENERIC_H_
#define _XOMGENERIC_H_
#include "_fallcPublic.h"
#define XOM_GENERIC(om) (&((XOMGeneric) om)->gen)
#define XOC_GENERIC(font_set) (&((XOCGeneric) font_set)->gen)
/* For VW/UDC */
typedef struct _CodeRangeRec {
unsigned long start;
unsigned long end;
unsigned long dmy1;
unsigned long dmy2;
} CodeRangeRec, *CodeRange;
typedef struct _VRotateRec {
char *charset_name; /* Charset name */
XlcSide side; /* Encoding side */
int num_cr;
CodeRange code_range;
char *xlfd_name;
XFontStruct *font;
} VRotateRec, *VRotate;
typedef enum {
XOMMultiByte,
XOMWideChar
} XOMTextType;
typedef struct _FontDataRec {
char *name;
XlcSide side;
/* For VW/UDC */
int scopes_num;
FontScope scopes;
char *xlfd_name;
XFontStruct *font;
} FontDataRec, *FontData;
#define VROTATE_NONE 0
#define VROTATE_PART 1
#define VROTATE_ALL 2
typedef struct _OMDataRec {
int charset_count;
XlcCharSet *charset_list;
int font_data_count;
FontData font_data;
/* For VW/UDC */
int substitute_num;
FontData substitute;
/* Vertical Writing */
int vmap_num;
FontData vmap;
int vrotate_type;
int vrotate_num;
CodeRange vrotate;
} OMDataRec, *OMData;
typedef struct _XOMGenericPart {
int data_num;
OMData data;
Bool on_demand_loading;
char *object_name;
} XOMGenericPart;
typedef struct _XOMGenericRec {
XOMMethods methods;
XOMCoreRec core;
XOMGenericPart gen;
} XOMGenericRec, *XOMGeneric;
/*
* XOC dependent data
*/
typedef struct _FontSetRec {
int id;
int charset_count;
XlcCharSet *charset_list;
int font_data_count;
FontData font_data;
char *font_name;
XFontStruct *info;
XFontStruct *font;
XlcSide side;
Bool is_xchar2b;
/* For VW/UDC */
int substitute_num;
FontData substitute;
/* Vertical Writing */
int vmap_num;
FontData vmap;
int vrotate_num;
VRotate vrotate;
} FontSetRec, *FontSet;
typedef struct _XOCGenericPart {
XlcConv mbs_to_cs;
XlcConv wcs_to_cs;
int font_set_num;
FontSet font_set;
} XOCGenericPart;
typedef struct _XOCGenericRec {
XOCMethods methods;
XOCCoreRec core;
XOCGenericPart gen;
} XOCGenericRec, *XOCGeneric;
_XFUNCPROTOBEGIN
extern XOM _falomGenericOpenOM(
#if NeedFunctionPrototypes
XLCd /* lcd */,
Display* /* dpy */,
XrmDatabase /* rdb */,
_Xconst char* /* res_name */,
_Xconst char* /* res_class */
#endif
);
extern XlcConv _XomInitConverter(
#if NeedFunctionPrototypes
XOC /* oc */,
XOMTextType /* type */
#endif
);
extern int _XomConvert(
#if NeedFunctionPrototypes
XOC /* oc */,
XlcConv /* conv */,
XPointer* /* from */,
int* /* from_left */,
XPointer* /* to */,
int* /* to_left */,
XPointer* /* args */,
int /* num_args */
#endif
);
_XFUNCPROTOEND
#endif /* _XOMGENERIC_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,79 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* XrmI.h 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:12 */
/* $XConsortium: _falrmI.h /main/1 1996/04/08 15:22:08 cde-fuj $ */
/*
Copyright (c) 1990 X Consortium
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 X CONSORTIUM 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 name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
*/
/*
* Macros to abstract out reading the file, and getting its size.
*
* You may need to redefine these for various other operating systems.
*/
#include <X11/Xos.h>
#include <sys/stat.h>
#ifdef WIN32
#define OpenFile(name) open((name), O_RDONLY|O_TEXT)
#else
#define OpenFile(name) open((name), O_RDONLY)
#endif
#define CloseFile(fd) close((fd))
#define ReadFile(fd,buf,size) read((fd), (buf), (size))
#define GetSizeOfFile(name,size) \
{ \
struct stat status_buffer; \
if ( (stat((name), &status_buffer)) == -1 ) \
size = -1; \
else \
size = status_buffer.st_size; \
}

View File

@@ -1,693 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: _faludcInf.c /main/4 1996/10/15 10:28:13 drk $ */
/* udcInf.c 1.4 - Fujitsu source for CDEnext 96/03/19 13:41:00 */
/*
* Copyright 1995 by FUJITSU LIMITED
* This is source code modified by FUJITSU LIMITED under the Joint
* Development Agreement for the CDEnext PST.
* This is unpublished proprietry source code of FUJITSU LIMITED
*
* Modifier: Takanori Tateno FUJITSU LIMITED
*
*/
#include <stdio.h>
#include <stdint.h>
#include <locale.h>
#include "syncx.h"
#include "_fallibint.h"
#include "_fallcint.h"
#include "_fallcPubI.h"
#include "_fallcGeneric.h"
#include "_falomGeneric.h"
/*
external symbols
*/
extern FontData falread_EncodingInfo();
extern int fal_get_codeset();
extern int fal_utyderror ;
extern int fal_utyerror ;
extern unsigned long fal_utyerrno ;
#define FAL_ERROR -1
/*
UDC structure define
*/
typedef struct _FalGlyphRegion {
unsigned long start;
unsigned long end;
} FalGlyphRegion ;
/*
* "code" no jyoui "i" byte me wo "unsigned char" toshite kaesu.
*/
static unsigned char getbyte(code,i)
unsigned long code;
int i;
{
unsigned long byteL;
unsigned char byte;
byteL = code >> (8*(3-i));
byte = (unsigned char)(0x000000ff & byteL);
return(byte);
}
/*
get codeset which described by charset_str and locale.
for examples ...
locale : ja_JP
charset_str : JISX0208.1983-0
*/
fal_get_codeset(locale,charset_str,codeset,num_codeset)
char *locale;
char *charset_str;
int **codeset;
int *num_codeset;
{
XLCdRec lcdrec;
XLCd lcd;
XLCdPublicRec xlcdp;
XPointer rdb;
int num = 0,count,num_ret=0,i,*ret;
char **value,buf[128],*ptr;
fal_utyderror = 0;
fal_utyerror = 0;
if((locale == NULL) || (charset_str == NULL)){
fal_utyerror = 5;
fal_utyderror = 1;
fal_utyerrno = 0x04 ;
return(FAL_ERROR);
}
if(codeset == NULL){
fal_utyerror = 5;
fal_utyderror = 2;
fal_utyerrno = 0x04 ;
return(FAL_ERROR);
}
/* create XLCd */
xlcdp.pub.siname = locale;
lcdrec.core = (XLCdCore)&xlcdp;
lcd = &lcdrec;
/* create X RDB (X NLS DB) */
rdb = _fallcCreateLocaleDataBase(lcd);
if(rdb == NULL){
fal_utyerror = 1;
fal_utyerrno = 0x15 ;
return(FAL_ERROR);
}
for(num=0;;num++){
/* XLC_FONTSET */
sprintf(buf, "fs%d.font.primary", num);
_fallcGetLocaleDataBase(lcd, "XLC_FONTSET", buf, &value, &count);
if(count < 1){
break ;
}
for(i=0;i<count;i++){
strcpy(buf,value[i]);
ptr = (char *)strchr(buf,(int)':');
*ptr = 0;
if(!_fallcCompareISOLatin1(charset_str,buf)){
num_ret += 1;
if(num_ret == 1){
ret = (int *)Xmalloc(sizeof(int));
} else {
ret =
(int *)Xrealloc(ret,num_ret*sizeof(int));
}
if(ret == NULL){
fal_utyerrno = 0x03 ;
return(FAL_ERROR);
}
ret[num_ret-1]=num;
break ;
}
}
}
if(num_ret == 0){
*num_codeset = 0;
*codeset = NULL;
return (0xff);
}
*num_codeset = num_ret;
*codeset = ret;
return 0;
}
static Bool gi_to_vgi(gi,vgi,scope)
unsigned long gi,*vgi;
FontScope scope;
{
if(scope->shift_direction == (unsigned long)'+'){
gi -= scope->shift;
} else {
gi += scope->shift;
}
if(gi >= scope->start && gi <= scope->end){
*vgi = gi;
return(True);
}
return(False);
}
static void shift_area(udc,scope)
FalGlyphRegion *udc;
FontScope scope;
{
if(scope->shift_direction == (unsigned long)'+'){
udc->start += scope->shift;
udc->end += scope->shift;
} else {
udc->start -= scope->shift;
udc->end -= scope->shift;
}
}
/*
get UDC area with glyph index.
for examples ...
locale : ja_JP
charset_str : JISX0208.1983-0
*/
FalGetUDCGIArea(locale,codeset,charset_str,gr,num_gr)
char *locale;
int codeset;
char *charset_str;
FalGlyphRegion **gr;
int *num_gr;
{
XLCdRec lcdrec;
XLCd lcd;
XLCdPublicRec xlcdp;
XPointer rdb;
FalGlyphRegion *udc;
int num = 0,count,num_ret=0;
int i,j,k;
char **value,buf[128],ptr;
FontData font_data;
fal_utyderror = 0;
fal_utyerror = 0;
fal_utyerrno = 0x00 ;
if((locale == NULL) || (charset_str == NULL)){
fal_utyerror = 5;
fal_utyderror = 1;
fal_utyerrno = 0x04;
fal_utyerrno |= (0x0b<<8) ;
return(FAL_ERROR);
}
if(gr == NULL){
fal_utyerror = 5;
fal_utyderror = 1;
fal_utyerrno = 0x04;
fal_utyerrno |= (0x0b<<8) ;
return(FAL_ERROR);
}
if(num_gr == NULL){
fal_utyerror = 5;
fal_utyderror = 2;
fal_utyerrno = 0x04;
fal_utyerrno |= (0x0b<<8) ;
return(FAL_ERROR);
}
/* create XLCd */
xlcdp.pub.siname = locale;
lcdrec.core = (XLCdCore)&xlcdp;
lcd = &lcdrec;
/* create X RDB (X NLS DB) */
rdb = _fallcCreateLocaleDataBase(lcd);
if(rdb == NULL){
fal_utyerror = 1;
fal_utyerrno = 0x15 ;
fal_utyerrno |= (0x0b<<8) ;
return(FAL_ERROR);
}
udc = NULL;
/* XLC_FONTSET */
sprintf(buf, "fs%d.charset.udc_area", codeset-1);
_fallcGetLocaleDataBase(lcd, "XLC_FONTSET", buf, &value, &count);
if(count > 0){
udc = (FalGlyphRegion *)Xmalloc(count * sizeof(FalGlyphRegion));
if(udc == NULL){
fal_utyerrno = 0x03 ;
fal_utyerrno |= (0x0b<<8) ;
return(FAL_ERROR);
}
for(i=0;i<count;i++){
sscanf(value[i],"\\x%lx,\\x%lx", &(udc[i].start), &(udc[i].end));
}
}
*num_gr = count;
sprintf(buf, "fs%d.font.primary", codeset-1);
_fallcGetLocaleDataBase(lcd, "XLC_FONTSET", buf, &value, &count);
if(count > 0){
font_data = falread_EncodingInfo(count,value);
for(i=0;i<count;i++){
if( !_fallcCompareISOLatin1(font_data[i].name,charset_str)){
for(j=0;j<(*num_gr);j++){
for(k=0;k<font_data[i].scopes_num;k++){
if(udc[j].start == font_data[i].scopes[k].start
&& font_data[i].scopes[k].shift){
shift_area(&udc[j],&(font_data[i].scopes[k]));
}
}
}
}
}
}
*gr = udc;
return 0;
}
/*
* Code convert wo tomonau UDC area no kakutoku
* GetUDCCPArea() / glyph_to_code()
*
*/
int fal_gi_to_vgi(lcd,locale,charset_str,codeset,gi,vgi,charsetname)
XLCd lcd;
char *locale;
char *charset_str;
int codeset;
unsigned long gi;
unsigned long *vgi;
char *charsetname;
{
FalGlyphRegion *udc;
int num = 0,count,num_ret=0;
int i,j,k;
char **value,buf[128],ptr;
FontData font_data = NULL;
sprintf(buf, "fs%d.charset.name", codeset-1);
_fallcGetLocaleDataBase(lcd, "XLC_FONTSET", buf, &value, &count);
if(count > 0){
strcpy(charsetname,value[0]);
}
sprintf(buf, "fs%d.font.primary", codeset-1);
_fallcGetLocaleDataBase(lcd, "XLC_FONTSET", buf, &value, &count);
if(count > 0){
font_data = falread_EncodingInfo(count,value);
for(i=0;i<count;i++){
if( !_fallcCompareISOLatin1(font_data[i].name,charset_str)){
for(k=0;k<font_data[i].scopes_num;k++){
if( gi_to_vgi(gi,vgi,&(font_data[i].scopes[k])) == True){
XFree(font_data);
return(True);
}
}
}
}
}
/*
free_fontdata(font_data);
*/
*vgi = gi;
XFree(font_data);
return(True);
}
Bool falnon_standard(lcd,charset)
XLCd lcd;
XlcCharSet charset;
{
char buf[256];
int count,i;
char **value;
if(charset->ct_sequence == NULL){
return(False);
}
for(i=0;;i++){
sprintf(buf, "csd%d.charset_name", i);
_fallcGetLocaleDataBase(lcd, "XLC_CHARSET_DEFINE", buf, &value, &count);
if(count > 0){
if(!_fallcNCompareISOLatin1(value[0],
charset->name,strlen(value[0])) ){
return(True);
}
} else {
return(False);
}
}
}
void
falmake_none_standard(from,charset,src)
char *from;
XlcCharSet charset;
char *src;
{
int name_len,seq_len,i;
name_len = 2 + strlen(charset->encoding_name) + 1;
seq_len = strlen(charset->ct_sequence);
strcpy(from,charset->ct_sequence);
from[seq_len] = name_len / 128 + 128;
from[seq_len+1] = name_len % 128 + 128;
strcpy(&from[seq_len + 2],charset->encoding_name);
from[seq_len+name_len-1] = 0x02; /* STX */
strcpy(&from[seq_len + name_len],src);
}
int
fal_glyph_to_code(locale,charset_str,codeset,glyph_index,codepoint)
char *locale;
char *charset_str;
int codeset;
unsigned long glyph_index;
unsigned long *codepoint;
{
XLCd lcd;
unsigned char *from; int from_left;
unsigned char *to ; int to_left = 10;
unsigned char *dst;
unsigned char byte;
unsigned long from32[25];
unsigned long to32[25];
int i,j;
char tmp[256],charsetname[256],src[10];
XlcConv conv;
XlcCharSet charset;
XPointer args[2];
from = (unsigned char *)from32;
to = (unsigned char *)to32;
dst = (unsigned char *)to32;
memset(dst,0,25);
lcd = (XLCd) (uintptr_t) _fallcGenericLoader(locale);
fal_gi_to_vgi(lcd,locale,charset_str,codeset,
glyph_index,&glyph_index,charsetname);
for(i=0,j=0;i<4;i++){
byte = getbyte(glyph_index,i);
if(byte){
src[j] = byte;
j ++;
}
}
src[j] = 0;
/* get charset */
/*
sprintf(tmp,"%s%s",charset_str,":GL");
charset_name = strdup(tmp);
*/
charset = _fallcGetCharSet(charsetname);
if(charset == NULL){
fal_utyerrno = 0x16 ;
return(FAL_ERROR);
}
/* make ct */
if( falnon_standard(lcd,charset)) {
falmake_none_standard(from,charset,src);
} else if(charset->ct_sequence){
snprintf((char *)from, sizeof(from32), "%s%s", charset->ct_sequence,src);
} else {
snprintf((char *)from, sizeof(from32), "%s", src);
}
/* compound text -> multi byte */
conv = _fallcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte);
from_left = strlen((char *)from);
_fallcConvert(conv,(XPointer *)&from,&from_left,
(XPointer *)&to, &to_left,args,0);
_fallcCloseConverter(conv);
_fallcDestroyLC(lcd);
*codepoint = 0;
for(i=0;dst[i];i++){
*codepoint = ((*codepoint << 8) | dst[i]) ;
}
return(0);
}
typedef struct _FalCodeRegion {
unsigned long start,end;
} FalCodeRegion ;
int
FalGetUDCCPArea(locale,codeset,charset_str,cr,num_cr)
char *locale;
int codeset;
char *charset_str;
FalCodeRegion **cr;
int *num_cr;
{
int i,num_gr,ret;
FalGlyphRegion *gr;
FalCodeRegion *crr;
fal_utyerror = 0;
fal_utyderror = 0;
if(cr == NULL){
fal_utyerror = 5;
fal_utyderror = 1;
fal_utyerrno = 0x04 ;
fal_utyerrno |= (0x0a<<8) ;
return(FAL_ERROR);
}
if(num_cr == NULL){
fal_utyerror = 5;
fal_utyderror = 2;
fal_utyerrno = 0x04 ;
fal_utyerrno |= (0x0a<<8) ;
return(FAL_ERROR);
}
ret = FalGetUDCGIArea(locale,codeset,charset_str,&gr,&num_gr);
if(ret == FAL_ERROR){
fal_utyerrno &= 0xff ;
fal_utyerrno |= (0x0a<<8) ;
return(ret);
}
crr = (FalCodeRegion *)Xmalloc(num_gr*sizeof(FalCodeRegion));
if(crr == NULL){
Xfree(gr);
fal_utyerrno = 0x03 ;
fal_utyerrno |= (0x0a<<8) ;
return(FAL_ERROR);
}
for(i=0;i<num_gr;i++){
ret = fal_glyph_to_code(locale,charset_str,codeset,
gr[i].start, &(crr[i].start));
if(ret == FAL_ERROR){
fal_utyerrno |= (0x0a<<8) ;
Xfree(gr);
Xfree(crr);
return(ret);
}
ret = fal_glyph_to_code(locale,charset_str,codeset,
gr[i].end, &(crr[i].end));
if(ret == FAL_ERROR){
fal_utyerrno |= (0x0a<<8) ;
Xfree(gr);
Xfree(crr);
return(ret);
}
}
Xfree(gr);
*cr = crr;
*num_cr = num_gr;
return(0);
}
/*
* code_to_glyph()
*
*/
typedef struct _FalGIInf {
char *charset_str;
unsigned long glyph_index;
} FalGIInf ;
/*
*
*
*/
static Bool vgi_to_gi(gi,vgi,scope)
unsigned long *gi,vgi;
FontScope scope;
{
if(vgi >= scope->start && vgi <= scope->end){
if(scope->shift_direction == (unsigned long)'+'){
*gi = vgi + scope->shift;
} else {
*gi = vgi - scope->shift;
}
return(True);
}
return(False);
}
/*
*
*
*/
static Bool
fal_vgi_to_gi(lcd,locale,vglyph,glyph,charset,charsetname)
XLCd lcd;
char *locale;
unsigned long vglyph;
unsigned long *glyph;
XlcCharSet charset;
char *charsetname;
{
int num = 0,count,num_ret=0;
int i,j,k;
char **value,buf[128],ptr;
FontData font_data = NULL;
CodeSet cs;
for(i=0;;i++){
sprintf(buf, "fs%d.charset.name",i);
_fallcGetLocaleDataBase(lcd, "XLC_FONTSET", buf, &value, &count);
if(count > 0){
if(!_fallcNCompareISOLatin1(charset->name,value[0],
strlen(charset->name))){
break;
}
} else {
fal_utyerrno = 0x17 ;
return(False);
}
}
/*
sprintf(buf, "fs%d.charset.name", codeset-1);
_fallcGetLocaleDataBase(lcd, "XLC_FONTSET", buf, &value, &count);
if(count > 0){
strcpy(charsetname,value[0]);
}
*/
sprintf(buf, "fs%d.font.primary", i);
_fallcGetLocaleDataBase(lcd, "XLC_FONTSET", buf, &value, &count);
if(count > 0){
font_data = falread_EncodingInfo(count,value);
for(i=0;i<count;i++){
for(k=0;k<font_data[i].scopes_num;k++){
if( vgi_to_gi(glyph,vglyph,&(font_data[i].scopes[k])) == True){
strcpy(charsetname,font_data[i].name);
XFree(font_data);
return(True);
}
}
}
}
*glyph = vglyph;
XFree(font_data);
return(True);
}
int
fal_code_to_glyph(locale,codepoint,gi,num_gi)
char *locale;
unsigned long codepoint;
FalGIInf **gi;
int *num_gi;
{
XLCd lcd;
unsigned char *from; int from_left;
unsigned char *to ; int to_left = 10;
unsigned char *dst;
unsigned char byte;
unsigned int from32[25];
unsigned int to32[25];
int i,j;
char tmp[256],charsetname[256],src[10];
XlcConv conv;
XlcCharSet charset;
XPointer args[2];
unsigned long glyph,vglyph;
from = (unsigned char *)from32;
to = (unsigned char *)to32;
dst = (unsigned char *)to32;
memset(dst,0,25);
lcd = (XLCd) (uintptr_t) _fallcGenericLoader(locale);
for(i=0,j=0;i<4;i++){
byte = getbyte(codepoint,i);
if(byte){
src[j] = byte;
j ++;
}
}
src[j] = 0;
snprintf((char *)from, sizeof(from32), "%s", src);
/* multi byte -> vgi */
conv = _fallcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet);
from_left = strlen((char *)from);
args[0] = (XPointer) &charset;
_fallcConvert(conv,(XPointer *)&from,&from_left,
(XPointer *)&to, &to_left,args,1);
/* vgi -> gi */
vglyph = 0;
for(i=0;dst[i];i++){
vglyph = ((vglyph << 8) | dst[i]) ;
}
if(fal_vgi_to_gi(lcd,locale,vglyph,&glyph,charset,charsetname)==False){
_fallcCloseConverter(conv);
_fallcDestroyLC(lcd);
*num_gi = 0;
return(0);
}
_fallcCloseConverter(conv);
_fallcDestroyLC(lcd);
*gi = (FalGIInf *)Xmalloc(sizeof(FalGIInf));
if(*gi == NULL){
fal_utyerrno = 0x03 ;
return(FAL_ERROR);
}
(*gi)->charset_str = (char *)Xmalloc(strlen(charsetname)+1);
strcpy((*gi)->charset_str,charsetname);
(*gi)->glyph_index = glyph;
*num_gi = 1;
return(0);
}

View File

@@ -1,930 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* Xutil.h 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:12 */
/* $XConsortium: _falutil.h /main/1 1996/04/08 15:20:39 cde-fuj $ */
/***********************************************************
Copyright (c) 1987 X Consortium
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
X CONSORTIUM 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 name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef _XUTIL_H_
#define _XUTIL_H_
/* You must include "syncx.h" before including this file */
/*
* Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
* value (x, y, width, height) was found in the parsed string.
*/
#define NoValue 0x0000
#define XValue 0x0001
#define YValue 0x0002
#define WidthValue 0x0004
#define HeightValue 0x0008
#define AllValues 0x000F
#define XNegative 0x0010
#define YNegative 0x0020
/*
* new version containing base_width, base_height, and win_gravity fields;
* used with WM_NORMAL_HINTS.
*/
typedef struct {
long flags; /* marks which fields in this structure are defined */
int x, y; /* obsolete for new window mgrs, but clients */
int width, height; /* should set so old wm's don't mess up */
int min_width, min_height;
int max_width, max_height;
int width_inc, height_inc;
struct {
int x; /* numerator */
int y; /* denominator */
} min_aspect, max_aspect;
int base_width, base_height; /* added by ICCCM version 1 */
int win_gravity; /* added by ICCCM version 1 */
} XSizeHints;
/*
* The next block of definitions are for window manager properties that
* clients and applications use for communication.
*/
/* flags argument in size hints */
#define USPosition (1L << 0) /* user specified x, y */
#define USSize (1L << 1) /* user specified width, height */
#define PPosition (1L << 2) /* program specified position */
#define PSize (1L << 3) /* program specified size */
#define PMinSize (1L << 4) /* program specified minimum size */
#define PMaxSize (1L << 5) /* program specified maximum size */
#define PResizeInc (1L << 6) /* program specified resize increments */
#define PAspect (1L << 7) /* program specified min and max aspect ratios */
#define PBaseSize (1L << 8) /* program specified base for incrementing */
#define PWinGravity (1L << 9) /* program specified window gravity */
/* obsolete */
#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
typedef struct {
long flags; /* marks which fields in this structure are defined */
Bool input; /* does this application rely on the window manager to
get keyboard input? */
int initial_state; /* see below */
Pixmap icon_pixmap; /* pixmap to be used as icon */
Window icon_window; /* window to be used as icon */
int icon_x, icon_y; /* initial position of icon */
Pixmap icon_mask; /* icon mask bitmap */
XID window_group; /* id of related window group */
/* this structure may be extended in the future */
} XWMHints;
/* definition for flags of XWMHints */
#define InputHint (1L << 0)
#define StateHint (1L << 1)
#define IconPixmapHint (1L << 2)
#define IconWindowHint (1L << 3)
#define IconPositionHint (1L << 4)
#define IconMaskHint (1L << 5)
#define WindowGroupHint (1L << 6)
#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
IconPositionHint|IconMaskHint|WindowGroupHint)
#define XUrgencyHint (1L << 8)
/* definitions for initial window state */
#define WithdrawnState 0 /* for windows that are not mapped */
#define NormalState 1 /* most applications want to start this way */
#define IconicState 3 /* application wants to start as an icon */
/*
* Obsolete states no longer defined by ICCCM
*/
#define DontCareState 0 /* don't know or care */
#define ZoomState 2 /* application wants to start zoomed */
#define InactiveState 4 /* application believes it is seldom used; */
/* some wm's may put it on inactive menu */
/*
* new structure for manipulating TEXT properties; used with WM_NAME,
* WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
*/
typedef struct {
unsigned char *value; /* same as Property routines */
Atom encoding; /* prop type */
int format; /* prop data format: 8, 16, or 32 */
unsigned long nitems; /* number of data items in value */
} XTextProperty;
#define XNoMemory -1
#define XLocaleNotSupported -2
#define XConverterNotFound -3
typedef enum {
XStringStyle, /* STRING */
XCompoundTextStyle, /* COMPOUND_TEXT */
XTextStyle, /* text in owner's encoding (current locale)*/
XStdICCTextStyle /* STRING, else COMPOUND_TEXT */
} XICCEncodingStyle;
typedef struct {
int min_width, min_height;
int max_width, max_height;
int width_inc, height_inc;
} XIconSize;
typedef struct {
char *res_name;
char *res_class;
} XClassHint;
/*
* These macros are used to give some sugar to the image routines so that
* naive people are more comfortable with them.
*/
#define XDestroyImage(ximage) \
((*((ximage)->f.destroy_image))((ximage)))
#define XGetPixel(ximage, x, y) \
((*((ximage)->f.get_pixel))((ximage), (x), (y)))
#define XPutPixel(ximage, x, y, pixel) \
((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
#define XSubImage(ximage, x, y, width, height) \
((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
#define XAddPixel(ximage, value) \
((*((ximage)->f.add_pixel))((ximage), (value)))
/*
* Compose sequence status structure, used in calling XLookupString.
*/
typedef struct _XComposeStatus {
XPointer compose_ptr; /* state table pointer */
int chars_matched; /* match state */
} XComposeStatus;
/*
* Keysym macros, used on Keysyms to test for classes of symbols
*/
#define IsKeypadKey(keysym) \
(((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal))
#define IsPrivateKeypadKey(keysym) \
(((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
#define IsCursorKey(keysym) \
(((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select))
#define IsPFKey(keysym) \
(((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4))
#define IsFunctionKey(keysym) \
(((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35))
#define IsMiscFunctionKey(keysym) \
(((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break))
#define IsModifierKey(keysym) \
((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
|| ((KeySym)(keysym) == XK_Mode_switch) \
|| ((KeySym)(keysym) == XK_Num_Lock))
/*
* opaque reference to Region data type
*/
typedef struct _XRegion *Region;
/* Return values from XRectInRegion() */
#define RectangleOut 0
#define RectangleIn 1
#define RectanglePart 2
/*
* Information used by the visual utility routines to find desired visual
* type from the many visuals a display may support.
*/
typedef struct {
Visual *visual;
VisualID visualid;
int screen;
int depth;
#if defined(__cplusplus) || defined(c_plusplus)
int c_class; /* C++ */
#else
int class;
#endif
unsigned long red_mask;
unsigned long green_mask;
unsigned long blue_mask;
int colormap_size;
int bits_per_rgb;
} XVisualInfo;
#define VisualNoMask 0x0
#define VisualIDMask 0x1
#define VisualScreenMask 0x2
#define VisualDepthMask 0x4
#define VisualClassMask 0x8
#define VisualRedMaskMask 0x10
#define VisualGreenMaskMask 0x20
#define VisualBlueMaskMask 0x40
#define VisualColormapSizeMask 0x80
#define VisualBitsPerRGBMask 0x100
#define VisualAllMask 0x1FF
/*
* This defines a window manager property that clients may use to
* share standard color maps of type RGB_COLOR_MAP:
*/
typedef struct {
Colormap colormap;
unsigned long red_max;
unsigned long red_mult;
unsigned long green_max;
unsigned long green_mult;
unsigned long blue_max;
unsigned long blue_mult;
unsigned long base_pixel;
VisualID visualid; /* added by ICCCM version 1 */
XID killid; /* added by ICCCM version 1 */
} XStandardColormap;
#define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */
/*
* return codes for XReadBitmapFile and XWriteBitmapFile
*/
#define BitmapSuccess 0
#define BitmapOpenFailed 1
#define BitmapFileInvalid 2
#define BitmapNoMemory 3
/****************************************************************
*
* Context Management
*
****************************************************************/
/* Associative lookup table return codes */
#define XCSUCCESS 0 /* No error. */
#define XCNOMEM 1 /* Out of memory */
#define XCNOENT 2 /* No entry in table */
typedef int XContext;
#define XUniqueContext() ((XContext) falrmUniqueQuark())
#define XStringToContext(string) ((XContext) falrmStringToQuark(string))
_XFUNCPROTOBEGIN
/* The following declarations are alphabetized. */
extern XClassHint *XAllocClassHint (
#if NeedFunctionPrototypes
void
#endif
);
extern XIconSize *XAllocIconSize (
#if NeedFunctionPrototypes
void
#endif
);
extern XSizeHints *XAllocSizeHints (
#if NeedFunctionPrototypes
void
#endif
);
extern XStandardColormap *XAllocStandardColormap (
#if NeedFunctionPrototypes
void
#endif
);
extern XWMHints *XAllocWMHints (
#if NeedFunctionPrototypes
void
#endif
);
extern XClipBox(
#if NeedFunctionPrototypes
Region /* r */,
XRectangle* /* rect_return */
#endif
);
extern Region XCreateRegion(
#if NeedFunctionPrototypes
void
#endif
);
extern char *falDefaultString(
#if NeedFunctionPrototypes
void
#endif
);
extern int XDeleteContext(
#if NeedFunctionPrototypes
Display* /* display */,
XID /* rid */,
XContext /* context */
#endif
);
extern XDestroyRegion(
#if NeedFunctionPrototypes
Region /* r */
#endif
);
extern XEmptyRegion(
#if NeedFunctionPrototypes
Region /* r */
#endif
);
extern XEqualRegion(
#if NeedFunctionPrototypes
Region /* r1 */,
Region /* r2 */
#endif
);
extern int XFindContext(
#if NeedFunctionPrototypes
Display* /* display */,
XID /* rid */,
XContext /* context */,
XPointer* /* data_return */
#endif
);
extern Status XGetClassHint(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XClassHint* /* class_hints_return */
#endif
);
extern Status XGetIconSizes(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XIconSize** /* size_list_return */,
int* /* count_return */
#endif
);
extern Status XGetNormalHints(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XSizeHints* /* hints_return */
#endif
);
extern Status XGetRGBColormaps(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XStandardColormap** /* stdcmap_return */,
int* /* count_return */,
Atom /* property */
#endif
);
extern Status XGetSizeHints(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XSizeHints* /* hints_return */,
Atom /* property */
#endif
);
extern Status XGetStandardColormap(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XStandardColormap* /* colormap_return */,
Atom /* property */
#endif
);
extern Status XGetTextProperty(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* window */,
XTextProperty* /* text_prop_return */,
Atom /* property */
#endif
);
extern XVisualInfo *XGetVisualInfo(
#if NeedFunctionPrototypes
Display* /* display */,
long /* vinfo_mask */,
XVisualInfo* /* vinfo_template */,
int* /* nitems_return */
#endif
);
extern Status XGetWMClientMachine(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop_return */
#endif
);
extern XWMHints *XGetWMHints(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */
#endif
);
extern Status XGetWMIconName(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop_return */
#endif
);
extern Status XGetWMName(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop_return */
#endif
);
extern Status XGetWMNormalHints(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XSizeHints* /* hints_return */,
long* /* supplied_return */
#endif
);
extern Status XGetWMSizeHints(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XSizeHints* /* hints_return */,
long* /* supplied_return */,
Atom /* property */
#endif
);
extern Status XGetZoomHints(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XSizeHints* /* zhints_return */
#endif
);
extern XIntersectRegion(
#if NeedFunctionPrototypes
Region /* sra */,
Region /* srb */,
Region /* dr_return */
#endif
);
extern void XConvertCase(
#if NeedFunctionPrototypes
KeySym /* sym */,
KeySym* /* lower */,
KeySym* /* upper */
#endif
);
extern int XLookupString(
#if NeedFunctionPrototypes
XKeyEvent* /* event_struct */,
char* /* buffer_return */,
int /* bytes_buffer */,
KeySym* /* keysym_return */,
XComposeStatus* /* status_in_out */
#endif
);
extern Status XMatchVisualInfo(
#if NeedFunctionPrototypes
Display* /* display */,
int /* screen */,
int /* depth */,
int /* class */,
XVisualInfo* /* vinfo_return */
#endif
);
extern XOffsetRegion(
#if NeedFunctionPrototypes
Region /* r */,
int /* dx */,
int /* dy */
#endif
);
extern Bool XPointInRegion(
#if NeedFunctionPrototypes
Region /* r */,
int /* x */,
int /* y */
#endif
);
extern Region XPolygonRegion(
#if NeedFunctionPrototypes
XPoint* /* points */,
int /* n */,
int /* fill_rule */
#endif
);
extern int XRectInRegion(
#if NeedFunctionPrototypes
Region /* r */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */
#endif
);
extern int XSaveContext(
#if NeedFunctionPrototypes
Display* /* display */,
XID /* rid */,
XContext /* context */,
_Xconst char* /* data */
#endif
);
extern XSetClassHint(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XClassHint* /* class_hints */
#endif
);
extern XSetIconSizes(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XIconSize* /* size_list */,
int /* count */
#endif
);
extern XSetNormalHints(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XSizeHints* /* hints */
#endif
);
extern void XSetRGBColormaps(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XStandardColormap* /* stdcmaps */,
int /* count */,
Atom /* property */
#endif
);
extern XSetSizeHints(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XSizeHints* /* hints */,
Atom /* property */
#endif
);
extern XSetStandardProperties(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
_Xconst char* /* window_name */,
_Xconst char* /* icon_name */,
Pixmap /* icon_pixmap */,
char** /* argv */,
int /* argc */,
XSizeHints* /* hints */
#endif
);
extern void XSetTextProperty(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */,
Atom /* property */
#endif
);
extern void XSetWMClientMachine(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */
#endif
);
extern XSetWMHints(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XWMHints* /* wm_hints */
#endif
);
extern void XSetWMIconName(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */
#endif
);
extern void XSetWMName(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */
#endif
);
extern void XSetWMNormalHints(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XSizeHints* /* hints */
#endif
);
extern void XSetWMProperties(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XTextProperty* /* window_name */,
XTextProperty* /* icon_name */,
char** /* argv */,
int /* argc */,
XSizeHints* /* normal_hints */,
XWMHints* /* wm_hints */,
XClassHint* /* class_hints */
#endif
);
extern void XmbSetWMProperties(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
_Xconst char* /* window_name */,
_Xconst char* /* icon_name */,
char** /* argv */,
int /* argc */,
XSizeHints* /* normal_hints */,
XWMHints* /* wm_hints */,
XClassHint* /* class_hints */
#endif
);
extern void XSetWMSizeHints(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XSizeHints* /* hints */,
Atom /* property */
#endif
);
extern XSetRegion(
#if NeedFunctionPrototypes
Display* /* display */,
GC /* gc */,
Region /* r */
#endif
);
extern void XSetStandardColormap(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XStandardColormap* /* colormap */,
Atom /* property */
#endif
);
extern XSetZoomHints(
#if NeedFunctionPrototypes
Display* /* display */,
Window /* w */,
XSizeHints* /* zhints */
#endif
);
extern XShrinkRegion(
#if NeedFunctionPrototypes
Region /* r */,
int /* dx */,
int /* dy */
#endif
);
extern Status XStringListToTextProperty(
#if NeedFunctionPrototypes
char** /* list */,
int /* count */,
XTextProperty* /* text_prop_return */
#endif
);
extern XSubtractRegion(
#if NeedFunctionPrototypes
Region /* sra */,
Region /* srb */,
Region /* dr_return */
#endif
);
extern int falmbTextListToTextProperty(
#if NeedFunctionPrototypes
Display* /* display */,
char** /* list */,
int /* count */,
XICCEncodingStyle /* style */,
XTextProperty* /* text_prop_return */
#endif
);
extern int falwcTextListToTextProperty(
#if NeedFunctionPrototypes
Display* /* display */,
wchar_t** /* list */,
int /* count */,
XICCEncodingStyle /* style */,
XTextProperty* /* text_prop_return */
#endif
);
extern void falwcFreeStringList(
#if NeedFunctionPrototypes
wchar_t** /* list */
#endif
);
extern Status XTextPropertyToStringList(
#if NeedFunctionPrototypes
XTextProperty* /* text_prop */,
char*** /* list_return */,
int* /* count_return */
#endif
);
extern int falmbTextPropertyToTextList(
#if NeedFunctionPrototypes
Display* /* display */,
XTextProperty* /* text_prop */,
char*** /* list_return */,
int* /* count_return */
#endif
);
extern int falwcTextPropertyToTextList(
#if NeedFunctionPrototypes
Display* /* display */,
XTextProperty* /* text_prop */,
wchar_t*** /* list_return */,
int* /* count_return */
#endif
);
extern XUnionRectWithRegion(
#if NeedFunctionPrototypes
XRectangle* /* rectangle */,
Region /* src_region */,
Region /* dest_region_return */
#endif
);
extern XUnionRegion(
#if NeedFunctionPrototypes
Region /* sra */,
Region /* srb */,
Region /* dr_return */
#endif
);
extern int XWMGeometry(
#if NeedFunctionPrototypes
Display* /* display */,
int /* screen_number */,
_Xconst char* /* user_geometry */,
_Xconst char* /* default_geometry */,
unsigned int /* border_width */,
XSizeHints* /* hints */,
int* /* x_return */,
int* /* y_return */,
int* /* width_return */,
int* /* height_return */,
int* /* gravity_return */
#endif
);
extern XXorRegion(
#if NeedFunctionPrototypes
Region /* sra */,
Region /* srb */,
Region /* dr_return */
#endif
);
_XFUNCPROTOEND
#endif /* _XUTIL_H_ */

View File

@@ -1,210 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: _falutilbitmap.c /main/1 1996/04/08 15:22:19 cde-fuj $ */
/*
Copyright (c) 1990, 1994 X Consortium
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
X CONSORTIUM 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 name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
*/
/*
* Author: Keith Packard, MIT X Consortium
*/
/* Utility functions for reformating font bitmaps */
static unsigned char _reverse_byte[0x100] = {
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
};
/*
* Invert bit order within each BYTE of an array.
*/
void
BitOrderInvert(buf, nbytes)
register unsigned char *buf;
register int nbytes;
{
register unsigned char *rev = _reverse_byte;
for (; --nbytes >= 0; buf++)
*buf = rev[*buf];
}
/*
* Invert byte order within each 16-bits of an array.
*/
void
TwoByteSwap(buf, nbytes)
register unsigned char *buf;
register int nbytes;
{
register unsigned char c;
for (; nbytes > 0; nbytes -= 2, buf += 2)
{
c = buf[0];
buf[0] = buf[1];
buf[1] = c;
}
}
/*
* Invert byte order within each 32-bits of an array.
*/
void
FourByteSwap(buf, nbytes)
register unsigned char *buf;
register int nbytes;
{
register unsigned char c;
for (; nbytes > 0; nbytes -= 4, buf += 4)
{
c = buf[0];
buf[0] = buf[3];
buf[3] = c;
c = buf[1];
buf[1] = buf[2];
buf[2] = c;
}
}
/*
* Repad a bitmap
*/
int
RepadBitmap (pSrc, pDst, srcPad, dstPad, width, height)
char *pSrc, *pDst;
unsigned srcPad, dstPad;
int width, height;
{
int srcWidthBytes,dstWidthBytes;
int row,col;
char *pTmpSrc,*pTmpDst;
switch (srcPad) {
case 1:
srcWidthBytes = (width+7)>>3;
break;
case 2:
srcWidthBytes = ((width+15)>>4)<<1;
break;
case 4:
srcWidthBytes = ((width+31)>>5)<<2;
break;
case 8:
srcWidthBytes = ((width+63)>>6)<<3;
break;
default:
return 0;
}
switch (dstPad) {
case 1:
dstWidthBytes = (width+7)>>3;
break;
case 2:
dstWidthBytes = ((width+15)>>4)<<1;
break;
case 4:
dstWidthBytes = ((width+31)>>5)<<2;
break;
case 8:
dstWidthBytes = ((width+63)>>6)<<3;
break;
default:
return 0;
}
width = srcWidthBytes;
if (width > dstWidthBytes)
width = dstWidthBytes;
pTmpSrc= pSrc;
pTmpDst= pDst;
for (row = 0; row < height; row++)
{
for (col = 0; col < width; col++)
*pTmpDst++ = *pTmpSrc++;
while (col < dstWidthBytes)
{
*pTmpDst++ = '\0';
col++;
}
pTmpSrc += srcWidthBytes - width;
}
return dstWidthBytes * height;
}

View File

@@ -1,95 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* Xvarargs.h 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:13 */
/* $XConsortium: _falvarargs.h /main/1 1996/04/08 15:22:42 cde-fuj $ */
/*
Copyright (c) 1985, 1986, 1987, 1988, 1989 X Consortium
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 X CONSORTIUM 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 name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
*/
#ifndef _XVARARGS_H_
#define _XVARARGS_H_
#ifdef __HIGHC__
#ifndef _STDARG_H
#define _STDARG_H
typedef char *va_list;
/* Amount of space required in an argument list for an arg of type TYPE.
TYPE may alternatively be an expression whose type is used. */
#define __va_rounded_size(TYPE) \
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#define va_start(AP, LASTARG) \
(AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
#define va_end(AP)
#define va_arg(AP, TYPE) \
(AP += __va_rounded_size (TYPE), \
*((TYPE *) (AP - __va_rounded_size (TYPE))))
#endif /* _STDARG_H */
#define Va_start(a,b) va_start(a,b)
#else /* !__HIGHC__ */
#if NeedVarargsPrototypes
# include <stdarg.h>
# define Va_start(a,b) va_start(a,b)
#else
# include <varargs.h>
# define Va_start(a,b) va_start(a)
#endif
#endif /* __HIGHC__ */
#endif /* _XVARARGS_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,89 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: falfont.h /main/5 1996/06/25 20:05:39 cde-fuj $ */
/*
* (c) Copyright 1995 FUJITSU LIMITED
* This is source code modified by FUJITSU LIMITED under the Joint
* Development Agreement for the CDEnext PST.
* This is unpublished proprietary source code of FUJITSU LIMITED
*/
#define GETNUMCHARS(pFinf) \
(((pFinf)->lastCol - (pFinf)->firstCol + 1) * \
((pFinf)->lastRow - (pFinf)->firstRow + 1))
#define GETHIGHT(pCinf) \
((pCinf)->metrics.ascent + (pCinf)->metrics.descent)
#define _FAL_OK 1
/* fal_utyerror */
#define _FAL_OPEN_ER 1
#define _FAL_DIR_NOACCSS 1
#define _FAL_READ_ER 2
#define _FAL_READ_PATH_ER 2
#define _FAL_MALOC_ER 3
#define _FAL_PKEY_ER 4
#define _FAL_PARM_ER 5
#define _FAL_STAT_ER 6
#define _FAL_FONT_ER 7
#define _FAL_FLST_ER 7
#define _FAL_DATA_OPEN_ER 8
#define _FAL_DATA_READ_ER 9
/* fal_utyderror */
/* FalOpenFont */
#define _FAL_O_P_PKEY_DER 1
#define _FAL_O_P_CS_DER 2
/* FalQueryFont */
#define _FAL_Q_P_FINF_DER 1
#define _FAL_Q_P_FONT_DER 2
/* FalReadFont */
#define _FAL_R_P_FINF_DER 1
#define _FAL_R_P_W_DER 2
#define _FAL_R_P_H_DER 3
/* FalGetFontList */
#define _FAL_L_P_LST_DER 1
#define _FAL_L_P_KEY_DER 2
#define _FAL_TRY_NEXT 0xFF
#include "udccom.h"
#define SNF_BOUND 32
#define FILE_SUFFIX( file ) \
( strrchr( file, '.' ) ? strrchr( file, '.' ) : "" )
#define FAL_DATA_ELM 13
#define FAL_LINE_MAX 1024
/* update _Oak_Finf */
#define FAL_UPDATE_FONTINFO 1
#define FAL_READ_FONTINFO 0
/* Buffer of file name */
extern char fal_err_file_buf[] ;

View File

@@ -1,26 +0,0 @@
#############################################################################
##### #####
##### fonts.list #####
##### #####
##### All Rights Reserved, Copyright (C) FUJITSU LIMITED 1995 #####
##### #####
#############################################################################
#
# This file is referenced by :
#
# dtudcfonted
# dtudcexch
# dtaddcpf
# dtcpgpf
# dtgpftocpf
# dtcpftogpf
# dtgpftobdf
# dtbdftocpf
# dtcpftobdf
# and dtlsgpf.
#
# font path ==> path1:
# path2:
# :
# pathN:
#

View File

@@ -1,116 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: font.h /main/1 1995/09/14 20:54:34 cde-fuj2 $ */
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
(c) Copyright 1995 FUJITSU LIMITED
This is source code modified by FUJITSU LIMITED under the Joint
Development Agreement for the CDEnext PST.
This is unpublished proprietary source code of FUJITSU LIMITED
******************************************************************/
#ifndef FONT_H
#define FONT_H 1
#include "servermd.h"
#define NullCharInfo ((CharInfoPtr)0)
#define NullFontInfo ((FontInfoPtr)0)
#define LeftToRight 0
#define RightToLeft 1
/*
* for linear char sets
*/
#define n1dChars(pfi) ((pfi)->lastCol - (pfi)->firstCol + 1)
#define chFirst firstCol /* usage: pfi->chFirst */
#define chLast lastCol /* usage: pfi->chLast */
/*
* for 2D char sets
*/
#define n2dChars(pfi) (((pfi)->lastCol - (pfi)->firstCol + 1) * \
((pfi)->lastRow - (pfi)->firstRow + 1))
#define ADDRXTHISCHARINFO( pf, ch ) \
((CharInfoRec *) &((pf)->pCI[(ch) - (pf)->pFI->chFirst]))
#define GLWIDTHPIXELS(pci) \
((pci)->metrics.rightSideBearing - (pci)->metrics.leftSideBearing)
#define GLHEIGHTPIXELS(pci) \
((pci)->metrics.ascent + (pci)->metrics.descent)
#define GLYPHWIDTHBYTES(pci) (((GLYPHWIDTHPIXELS(pci))+7) >> 3)
#define GLYPHHEIGHTPIXELS(pci) (pci->metrics.ascent + pci->metrics.descent)
#define GLYPHWIDTHPIXELS(pci) (pci->metrics.rightSideBearing \
- pci->metrics.leftSideBearing)
#define GLWIDTHPADDED( bc) ((bc+7) & ~0x7)
#if GLYPHPADBYTES == 0 || GLYPHPADBYTES == 1
#define GLYPHWIDTHBYTESPADDED(pci) (GLYPHWIDTHBYTES(pci))
#define PADGLYPHWIDTHBYTES(w) (((w)+7)>>3)
#endif
#if GLYPHPADBYTES == 2
#define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+1) & ~0x1)
#define PADGLYPHWIDTHBYTES(w) (((((w)+7)>>3)+1) & ~0x1)
#endif
#if GLYPHPADBYTES == 4
#define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+3) & ~0x3)
#define PADGLYPHWIDTHBYTES(w) (((((w)+7)>>3)+3) & ~0x3)
#endif
#if GLYPHPADBYTES == 8 /* for a cray? */
#define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+7) & ~0x7)
#define PADGLYPHWIDTHBYTES(w) (((((w)+7)>>3)+7) & ~0x7)
#endif
typedef struct _FontProp *FontPropPtr;
typedef struct _CharInfo *CharInfoPtr;
typedef struct _FontInfo *FontInfoPtr;
typedef unsigned int DrawDirection;
typedef struct _ExtentInfo *ExtentInfoPtr;
#endif /* FONT_H */

View File

@@ -1,123 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: fontstruct.h /main/3 1996/04/08 15:58:01 cde-fuj $ */
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
(c) Copyright 1995 FUJITSU LIMITED
This is source code modified by FUJITSU LIMITED under the Joint
Development Agreement for the CDEnext PST.
This is unpublished proprietary source code of FUJITSU LIMITED
******************************************************************/
#ifndef FONTSTRUCT_H
#define FONTSTRUCT_H 1
#include "font.h"
#include "misc.h"
typedef struct _CharInfo {
xCharInfo metrics; /* info preformatted for Queries */
unsigned byteOffset:24; /* byte offset of the raster from pGlyphs */
Bool exists:1; /* true iff glyph exists for this char */
unsigned pad:7; /* must be zero for now */
} CharInfoRec;
typedef struct _FontInfo {
unsigned int version1; /* version stamp */
unsigned int allExist;
unsigned int drawDirection;
unsigned int noOverlap; /* true if:
* max(rightSideBearing-characterWidth)
* <= minbounds->metrics.leftSideBearing
*/
unsigned int constantMetrics;
unsigned int terminalFont; /* Should be deprecated! true if:
constant metrics &&
leftSideBearing == 0 &&
rightSideBearing == characterWidth &&
ascent == fontAscent &&
descent == fontDescent
*/
unsigned int linear:1; /* true if firstRow == lastRow */
unsigned int constantWidth:1; /* true if minbounds->metrics.characterWidth
* == maxbounds->metrics.characterWidth
*/
unsigned int inkInside:1; /* true if for all defined glyphs:
* leftSideBearing >= 0 &&
* rightSideBearing <= characterWidth &&
* -fontDescent <= ascent <= fontAscent &&
* -fontAscent <= descent <= fontDescent
*/
unsigned int inkMetrics:1; /* ink metrics != bitmap metrics */
/* used with terminalFont */
/* see font's pInk{CI,Min,Max} */
unsigned int padding:28;
unsigned int firstCol;
unsigned int lastCol;
unsigned int firstRow;
unsigned int lastRow;
unsigned int nProps;
unsigned int lenStrings; /* length in bytes of string table */
unsigned int chDefault; /* default character */
int fontDescent; /* minimum for quality typography */
int fontAscent; /* minimum for quality typography */
CharInfoRec minbounds; /* MIN of glyph metrics over all chars */
CharInfoRec maxbounds; /* MAX of glyph metrics over all chars */
unsigned int pixDepth; /* intensity bits per pixel */
unsigned int glyphSets; /* number of sets of glyphs, for
sub-pixel positioning */
unsigned int version2; /* version stamp double-check */
} FontInfoRec;
typedef struct _ExtentInfo {
DrawDirection drawDirection;
int fontAscent;
int fontDescent;
int overallAscent;
int overallDescent;
int overallWidth;
int overallLeft;
int overallRight;
} ExtentInfoRec;
#endif /* FONTSTRUCT_H */

View File

@@ -1,181 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: misc.h /main/7 1996/04/08 15:58:10 cde-fuj $ */
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
(c) Copyright 1995 FUJITSU LIMITED
This is source code modified by FUJITSU LIMITED under the Joint
Development Agreement for the CDEnext PST.
This is unpublished proprietary source code of FUJITSU LIMITED
******************************************************************/
#ifndef MISC_H
#define MISC_H 1
/*
* X internal definitions
*
*/
extern unsigned long globalSerialNumber;
extern unsigned long serverGeneration;
#ifndef NULL
#if __STDC__ && !NOSTDHDRS
#include <stddef.h>
#else
#define NULL 0
#endif
#endif
#define MAXSCREENS 3
#define MAXCLIENTS 128
#define MAXFORMATS 8
#define MAXVISUALS_PER_SCREEN 50
typedef unsigned char *pointer;
typedef int Bool;
typedef unsigned long PIXEL;
typedef unsigned long ATOM;
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
#include "os.h" /* for ALLOCATE_LOCAL and DEALLOCATE_LOCAL */
#define NullBox ((BoxPtr)0)
#define MILLI_PER_MIN (1000 * 60)
#define MILLI_PER_SECOND (1000)
/* this next is used with None and ParentRelative to tell
PaintWin() what to use to paint the background. Also used
in the macro IS_VALID_PIXMAP */
#define USE_BACKGROUND_PIXEL 3
#define USE_BORDER_PIXEL 3
/* byte swap a long literal */
#define lswapl(x) ((((x) & 0xff) << 24) |\
(((x) & 0xff00) << 8) |\
(((x) & 0xff0000) >> 8) |\
(((x) >> 24) & 0xff))
/* byte swap a short literal */
#define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max(a, b) (((a) > (b)) ? (a) : (b))
#ifndef abs
#define abs(a) ((a) > 0 ? (a) : -(a))
#endif
#ifndef fabs
#define fabs(a) ((a) > 0.0 ? (a) : -(a)) /* floating absolute value */
#endif
#define sign(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0))
/* this assumes b > 0 */
#define modulus(a, b, d) if (((d) = (a) % (b)) < 0) (d) += (b)
/*
* return the least significant bit in x which is set
*
* This works on 1's complement and 2's complement machines.
* If you care about the extra instruction on 2's complement
* machines, change to ((x) & (-(x)))
*/
#define lowbit(x) ((x) & (~(x) + 1))
#define MAXSHORT 32767
#define MINSHORT -MAXSHORT
/* some macros to help swap requests, replies, and events */
#define LengthRestB(stuff) \
(((unsigned long)stuff->length << 2) - sizeof(*stuff))
#define LengthRestS(stuff) \
(((unsigned long)stuff->length << 1) - (sizeof(*stuff) >> 1))
#define LengthRestL(stuff) \
((unsigned long)stuff->length - (sizeof(*stuff) >> 2))
#define SwapRestS(stuff) \
SwapShorts((short *)(stuff + 1), LengthRestS(stuff))
#define SwapRestL(stuff) \
SwapLongs((long *)(stuff + 1), LengthRestL(stuff))
/* byte swap a long */
#define swapl(x, n) n = ((char *) (x))[0];\
((char *) (x))[0] = ((char *) (x))[3];\
((char *) (x))[3] = n;\
n = ((char *) (x))[1];\
((char *) (x))[1] = ((char *) (x))[2];\
((char *) (x))[2] = n;
/* byte swap a short */
#define swaps(x, n) n = ((char *) (x))[0];\
((char *) (x))[0] = ((char *) (x))[1];\
((char *) (x))[1] = n
/* copy long from src to dst byteswapping on the way */
#define cpswapl(src, dst) \
((char *)&(dst))[0] = ((char *) &(src))[3];\
((char *)&(dst))[1] = ((char *) &(src))[2];\
((char *)&(dst))[2] = ((char *) &(src))[1];\
((char *)&(dst))[3] = ((char *) &(src))[0];
/* copy short from src to dst byteswapping on the way */
#define cpswaps(src, dst)\
((char *) &(dst))[0] = ((char *) &(src))[1];\
((char *) &(dst))[1] = ((char *) &(src))[0];
extern void SwapLongs();
extern void SwapShorts();
typedef struct _DDXPoint *DDXPointPtr;
typedef struct _Box *BoxPtr;
#endif /* MISC_H */

View File

@@ -1,169 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: os.h /main/6 1996/05/28 15:33:04 ageorge $ */
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
(c) Copyright 1995 FUJITSU LIMITED
This is source code modified by FUJITSU LIMITED under the Joint
Development Agreement for the CDEnext PST.
This is unpublished proprietary source code of FUJITSU LIMITED
******************************************************************/
#ifndef OS_H
#define OS_H
#include "misc.h"
#ifdef INCLUDE_ALLOCA_H
#include <alloca.h>
#endif
#define NullFID ((FID) 0)
#define SCREEN_SAVER_ON 0
#define SCREEN_SAVER_OFF 1
#define SCREEN_SAVER_FORCER 2
#if defined(stellar)
#define MAX_REQUEST_SIZE 65535
#else
#define MAX_REQUEST_SIZE 16384
#endif
typedef pointer FID;
typedef struct _FontPathRec *FontPathPtr;
typedef struct _NewClientRec *NewClientPtr;
#ifndef NO_ALLOCA
/*
* os-dependent definition of local allocation and deallocation
* If you want something other than Xalloc/Xfree for ALLOCATE/DEALLOCATE
* LOCAL then you add that in here.
*/
#if defined(__HIGHC__)
extern char *alloca();
#if HCVERSION < 21003
#define ALLOCATE_LOCAL(size) alloca((int)(size))
pragma on(alloca);
#else /* HCVERSION >= 21003 */
#define ALLOCATE_LOCAL(size) _Alloca((int)(size))
#endif /* HCVERSION < 21003 */
#define DEALLOCATE_LOCAL(ptr) /* as nothing */
#endif /* defined(__HIGHC__) */
#if defined(__GNUC__)
#if !defined(__linux__)
#ifdef alloca
#undef alloca
#endif
#define alloca ___builtin_alloca
#endif
#define ALLOCATE_LOCAL(size) alloca((int)(size))
#define DEALLOCATE_LOCAL(ptr) /* as nothing */
#else /* ! __GNUC__ */
/*
* warning: mips alloca is unsuitable in the server, do not use.
*/
#if defined(vax) || defined(sun) || defined(stellar)
/*
* Some System V boxes extract alloca.o from /lib/libPW.a; if you
* decide that you don't want to use alloca, you might want to fix
* ../os/4.2bsd/Imakefile
*/
char *alloca();
#define ALLOCATE_LOCAL(size) alloca((int)(size))
#define DEALLOCATE_LOCAL(ptr) /* as nothing */
#endif /* who does alloca */
#endif /* __GNUC__ */
#endif /* NO_ALLOCA */
#ifndef ALLOCATE_LOCAL
#define ALLOCATE_LOCAL(size) Xalloc((unsigned long)(size))
#define DEALLOCATE_LOCAL(ptr) Xfree((pointer)(ptr))
#endif /* ALLOCATE_LOCAL */
#define xalloc(size) Xalloc((unsigned long)(size))
#define xrealloc(ptr, size) Xrealloc((pointer)(ptr), (unsigned long)(size))
#define xfree(ptr) Xfree((pointer)(ptr))
int ReadRequestFromClient();
#ifndef strcat
char *strcat();
#endif
#ifndef strncat
char *strncat();
#endif
#ifndef strcpy
char *strcpy();
#endif
#ifndef strncpy
char *strncpy();
#endif
Bool CloseDownConnection();
FontPathPtr GetFontPath();
FontPathPtr ExpandFontNamePattern();
FID FiOpenForRead();
void CreateWellKnownSockets();
int SetDefaultFontPath();
void FreeFontRecord();
int SetFontPath();
void ErrorF();
void Error();
void FatalError();
void ProcessCommandLine();
void Xfree();
void FlushAllOutput();
void FlushIfCriticalOutputPending();
unsigned long *Xalloc();
unsigned long *Xrealloc();
long GetTimeInMillis();
#endif /* OS_H */

View File

@@ -1,107 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: pcf.h /main/2 1996/02/10 16:25:46 cde-fuj $ */
/*
*
* Copyright 1990 Massachusetts Institute of Technology
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
(c) Copyright 1995 FUJITSU LIMITED
This is source code modified by FUJITSU LIMITED under the Joint
Development Agreement for the CDEnext PST.
This is unpublished proprietary source code of FUJITSU LIMITED
*/
#ifndef _PCF_H_
#define _PCF_H_
/*
* Information used to read/write PCF fonts
*/
typedef struct _PCFTable {
CARD32 type;
CARD32 format;
CARD32 size;
CARD32 offset;
} PCFTableRec, *PCFTablePtr;
#define PCF_FILE_VERSION (('p'<<24)|('c'<<16)|('f'<<8)|1)
#define PCF_FORMAT_MASK 0xffffff00
#define PCF_DEFAULT_FORMAT 0x00000000
#define PCF_INKBOUNDS 0x00000200
#define PCF_ACCEL_W_INKBOUNDS 0x00000100
#define PCF_COMPRESSED_METRICS 0x00000100
#define PCF_FORMAT_MATCH(a,b) (((a)&PCF_FORMAT_MASK) == ((b)&PCF_FORMAT_MASK))
#define PCF_GLYPH_PAD_MASK (3<<0)
#define PCF_BYTE_MASK (1<<2)
#define PCF_BIT_MASK (1<<3)
#define PCF_SCAN_UNIT_MASK (3<<4)
#define PCF_BYTE_ORDER(f) (((f) & PCF_BYTE_MASK)?MSBFirst:LSBFirst)
#define PCF_BIT_ORDER(f) (((f) & PCF_BIT_MASK)?MSBFirst:LSBFirst)
#define PCF_GLYPH_PAD_INDEX(f) ((f) & PCF_GLYPH_PAD_MASK)
#define PCF_GLYPH_PAD(f) (1<<PCF_GLYPH_PAD_INDEX(f))
#define PCF_SCAN_UNIT_INDEX(f) (((f) & PCF_SCAN_UNIT_MASK) >> 4)
#define PCF_SCAN_UNIT(f) (1<<PCF_SCAN_UNIT_INDEX(f))
#define PCF_FORMAT_BITS(f) ((f) & (PCF_GLYPH_PAD_MASK|PCF_BYTE_MASK|PCF_BIT_MASK|PCF_SCAN_UNIT_MASK))
#define PCF_SIZE_TO_INDEX(s) ((s) == 4 ? 2 : (s) == 2 ? 1 : 0)
#define PCF_INDEX_TO_SIZE(b) (1<<b)
#define PCF_FORMAT(bit,byte,glyph,scan) (\
(PCF_SIZE_TO_INDEX(scan) << 4) | \
(((bit) == MSBFirst ? 1 : 0) << 3) | \
(((byte) == MSBFirst ? 1 : 0) << 2) | \
(PCF_SIZE_TO_INDEX(glyph) << 0))
#define PCF_PROPERTIES (1<<0)
#define PCF_ACCELERATORS (1<<1)
#define PCF_METRICS (1<<2)
#define PCF_BITMAPS (1<<3)
#define PCF_INK_METRICS (1<<4)
#define PCF_BDF_ENCODINGS (1<<5)
#define PCF_SWIDTHS (1<<6)
#define PCF_GLYPH_NAMES (1<<7)
#define PCF_BDF_ACCELERATORS (1<<8)
#endif /* _PCF_H_ */

View File

@@ -1,294 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: servermd.h /main/2 1996/04/08 15:58:29 cde-fuj $ */
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
(c) Copyright 1995 FUJITSU LIMITED
This is source code modified by FUJITSU LIMITED under the Joint
Development Agreement for the CDEnext PST.
This is unpublished proprietary source code of FUJITSU LIMITED
******************************************************************/
#ifndef SERVERMD_H
#define SERVERMD_H 1
/*
* The vendor string identifies the vendor responsible for the
* server executable.
*/
#ifndef VENDOR_STRING
#define VENDOR_STRING "MIT X Consortium"
#endif
/*
* The vendor release number identifies, for the purpose of submitting
* traceable bug reports, the release number of software produced
* by the vendor.
*/
#ifndef VENDOR_RELEASE
#define VENDOR_RELEASE 4
#endif
/*
* Machine dependent values:
* GLYPHPADBYTES should be chosen with consideration for the space-time
* trade-off. Padding to 0 bytes means that there is no wasted space
* in the font bitmaps (both on disk and in memory), but that access of
* the bitmaps will cause odd-address memory references. Padding to
* 2 bytes would ensure even address memory references and would
* be suitable for a 68010-class machine, but at the expense of wasted
* space in the font bitmaps. Padding to 4 bytes would be good
* for real 32 bit machines, etc. Be sure that you tell the font
* compiler what kind of padding you want because its defines are
* kept separate from this. See server/include/font.h for how
* GLYPHPADBYTES is used.
*
* Along with this, you should choose an appropriate value for
* GETLEFTBITS_ALIGNMENT, which is used in ddx/mfb/maskbits.h. This
* constant choses what kind of memory references are guarenteed during
* font access; either 1, 2 or 4, for byte, word or longword access,
* respectively. For instance, if you have decided to to have
* GLYPHPADBYTES == 4, then it is pointless for you to have a
* GETLEFTBITS_ALIGNMENT > 1, because the padding of the fonts has already
* guarenteed you that your fonts are longword aligned. On the other
* hand, even if you have chosen GLYPHPADBYTES == 1 to save space, you may
* also decide that the computing involved in aligning the pointer is more
* costly than an odd-address access; you choose GETLEFTBITS_ALIGNMENT == 1.
*
* Next, choose the tuning parameters which are appropriate for your
* hardware; these modify the behaviour of the raw frame buffer code
* in ddx/mfb and ddx/cfb. Defining these incorrectly will not cause
* the server to run incorrectly, but defining these correctly will
* cause some noticeable speed improvements:
*
* AVOID_MEMORY_READ - (8-bit cfb only)
* When stippling pixels on the screen (polytext and pushpixels),
* don't read long words from the display and mask in the
* appropriate values. Rather, perform multiple byte/short/long
* writes as appropriate. This option uses many more instructions
* but runs much faster when the destination is much slower than
* the CPU and at least 1 level of write buffer is availible (2
* is much better). Defined currently for SPARC and MIPS.
*
* FAST_CONSTANT_OFFSET_MODE - (cfb and mfb)
* This define is used on machines which have no auto-increment
* addressing mode, but do have an effectively free constant-offset
* addressing mode. Currently defined for MIPS and SPARC, even though
* I remember the cg6 as performing better without it (cg3 definitely
* performs better with it).
*
* LARGE_INSTRUCTION_CACHE -
* This define increases the number of times some loops are
* unrolled. On 68020 machines (with 256 bytes of i-cache),
* this define will slow execution down as instructions miss
* the cache frequently. On machines with real i-caches, this
* reduces loop overhead, causing a slight performance improvement.
* Currently defined for MIPS and SPARC
*
* FAST_UNALIGNED_READS -
* For machines with more memory bandwidth than CPU, this
* define uses unaligned reads for 8-bit BitBLT instead of doing
* aligned reads and combining the results with shifts and
* logical-ors. Currently defined for 68020 and vax.
* PLENTIFUL_REGISTERS -
* For machines with > 20 registers. Currently used for
* unrolling the text painting code a bit more. Currently
* defined for MIPS.
*/
#ifdef vax
#define IMAGE_BYTE_ORDER LSBFirst /* Values for the VAX only */
#define BITMAP_BIT_ORDER LSBFirst
#define GLYPHPADBYTES 1
#define GETLEFTBITS_ALIGNMENT 4
#define FAST_UNALIGNED_READS
#endif /* vax */
#ifdef sun
#if defined(sun386) || defined(sun5)
# define IMAGE_BYTE_ORDER LSBFirst /* Values for the SUN only */
# define BITMAP_BIT_ORDER LSBFirst
#else
# define IMAGE_BYTE_ORDER MSBFirst /* Values for the SUN only */
# define BITMAP_BIT_ORDER MSBFirst
#endif
#ifdef sparc
# define AVOID_MEMORY_READ
# define LARGE_INSTRUCTION_CACHE
# define FAST_CONSTANT_OFFSET_MODE
#endif
#ifdef mc68020
#define FAST_UNALIGNED_READS
#endif
#define GLYPHPADBYTES 4
#define GETLEFTBITS_ALIGNMENT 1
#endif /* sun */
#if defined(ibm032) || defined (ibm)
#ifdef i386
# define IMAGE_BYTE_ORDER LSBFirst /* Value for PS/2 only */
#else
# define IMAGE_BYTE_ORDER MSBFirst /* Values for the RT only*/
#endif
#define BITMAP_BIT_ORDER MSBFirst
#define GLYPHPADBYTES 1
#define GETLEFTBITS_ALIGNMENT 4
/* ibm pcc doesn't understand pragmas. */
#endif /* ibm */
#ifdef hpux
#define IMAGE_BYTE_ORDER MSBFirst /* Values for the HP only */
#define BITMAP_BIT_ORDER MSBFirst
#define GLYPHPADBYTES 2 /* to match product server */
#define GETLEFTBITS_ALIGNMENT 1
#endif /* hpux */
#if defined(M4315) || defined(M4317) || defined(M4319) || defined(M4330)
#define IMAGE_BYTE_ORDER MSBFirst /* Values for Pegasus only */
#define BITMAP_BIT_ORDER MSBFirst
#define GLYPHPADBYTES 4
#define GETLEFTBITS_ALIGNMENT 1
#define FAST_UNALIGNED_READS
#endif /* tektronix */
#ifdef mips
#ifdef MIPSEL
# define IMAGE_BYTE_ORDER LSBFirst /* Values for the PMAX only */
# define BITMAP_BIT_ORDER LSBFirst
# define GLYPHPADBYTES 4
# define GETLEFTBITS_ALIGNMENT 1
#else
# define IMAGE_BYTE_ORDER MSBFirst /* Values for the MIPS only */
# define BITMAP_BIT_ORDER MSBFirst
# define GLYPHPADBYTES 4
# define GETLEFTBITS_ALIGNMENT 1
#endif
#define AVOID_MEMORY_READ
#define FAST_CONSTANT_OFFSET_MODE
#define LARGE_INSTRUCTION_CACHE
#define PLENTIFUL_REGISTERS
#endif /* mips */
#ifdef stellar
#define IMAGE_BYTE_ORDER MSBFirst /* Values for the stellar only*/
#define BITMAP_BIT_ORDER MSBFirst
#define GLYPHPADBYTES 4
#define GETLEFTBITS_ALIGNMENT 4
/*
* Use SysV random number generator.
*/
#define random rand
#endif /* stellar */
/* size of buffer to use with GetImage, measured in bytes. There's obviously
* a trade-off between the amount of stack (or whatever ALLOCATE_LOCAL gives
* you) used and the number of times the ddx routine has to be called.
*
* for a 1024 x 864 bit monochrome screen with a 32 bit word we get
* 8192/4 words per buffer
* (1024/32) = 32 words per scanline
* 2048 words per buffer / 32 words per scanline = 64 scanlines per buffer
* 864 scanlines / 64 scanlines = 14 buffers to draw a full screen
*/
#if defined(stellar)
#define IMAGE_BUFSIZE (64*1024)
#else
#define IMAGE_BUFSIZE 8192
#endif
/* pad scanline to a longword */
#if defined(ibm) && defined(i386)
#define BITMAP_SCANLINE_UNIT 8
#else
#define BITMAP_SCANLINE_UNIT 32
#endif
#define BITMAP_SCANLINE_PAD 32
#define LOG2_BITMAP_PAD 5
#define LOG2_BYTES_PER_SCANLINE_PAD 2
/*
* This returns the number of padding units, for depth d and width w.
* For bitmaps this can be calculated with the macros above.
* Other depths require either grovelling over the formats field of the
* screenInfo or hardwired constants.
*/
typedef struct _PaddingInfo {
int padRoundUp; /* pixels per pad unit - 1 */
int padPixelsLog2; /* log 2 (pixels per pad unit) */
int padBytesLog2; /* log 2 (bytes per pad unit) */
} PaddingInfo;
extern PaddingInfo PixmapWidthPaddingInfo[];
#define PixmapWidthInPadUnits(w, d) \
(((w) + PixmapWidthPaddingInfo[d].padRoundUp) >> \
PixmapWidthPaddingInfo[d].padPixelsLog2)
/*
* Return the number of bytes to which a scanline of the given
* depth and width will be padded.
*/
#define PixmapBytePad(w, d) \
(PixmapWidthInPadUnits(w, d) << PixmapWidthPaddingInfo[d].padBytesLog2)
#endif /* SERVERMD_H */

View File

@@ -1,903 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: readpcf.c /main/5 1996/06/05 16:42:29 ageorge $ */
/*
* (c) Copyright 1995 FUJITSU LIMITED
* This is source code modified by FUJITSU LIMITED under the Joint
* Development Agreement for the CDEnext PST.
* This is unpublished proprietary source code of FUJITSU LIMITED
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include "FaLib.h"
#include "falfont.h"
#ifndef GLYPHPADOPTIONS
#define GLYPHPADOPTIONS 4
#endif
static CARD32 getLSB32();
static int getINT32();
static int getINT16();
static Bool seekToType();
static void getMetric();
static Bool getAccel();
int falInitReadPcf();
static void ByteSwap();
static void repadBits();
int falPcfGlyph();
void falGetPcfGSize();
int falInitReadPcfProp() ;
int falInitReadSnfProp() ;
int falReadGpfProp() ;
extern void BitOrderInvert() ;
extern void set_errfile_str() ;
static CARD32
getLSB32( p)
unsigned char *p;
{
CARD32 c;
c = *p++;
c |= (CARD32)(*p++) << 8;
c |= (CARD32)(*p++) << 16;
c |= (CARD32)(*p) << 24;
return c;
}
static int
getINT32( p, format)
unsigned char *p;
CARD32 format;
{
CARD32 c;
if (PCF_BYTE_ORDER(format) == MSBFirst) {
c = (CARD32)(*p++) << 24;
c |= (CARD32)(*p++) << 16;
c |= (CARD32)(*p++) << 8;
c |= (CARD32)(*p);
} else {
c = (CARD32)(*p++);
c |= (CARD32)(*p++) << 8;
c |= (CARD32)(*p++) << 16;
c |= (CARD32)(*p) << 24;
}
return (int)c;
}
static int
getINT16( p, format)
unsigned char *p;
CARD32 format;
{
CARD32 c;
if (PCF_BYTE_ORDER(format) == MSBFirst) {
c = (CARD32)(*p++) << 8;
c |= (CARD32)(*p);
} else {
c = (CARD32)(*p++);
c |= (CARD32)(*p) << 8;
}
return (int)c;
}
static Bool
seekToType( tables, ntables, type, formatp, sizep, offsetp)
PCFTablePtr tables;
int ntables;
CARD32 type;
CARD32 *formatp;
CARD32 *sizep;
CARD32 *offsetp;
{
int i;
for ( i = 0; i < ntables; i++) {
if ( getLSB32( (unsigned char *)&tables[i].type ) == type) {
if ( formatp)
*formatp = getLSB32( (unsigned char *)&tables[i].format);
if ( sizep)
*sizep = getLSB32( (unsigned char *)&tables[i].size);
if ( offsetp)
*offsetp = getLSB32( (unsigned char *)&tables[i].offset);
return(TRUE);
}
}
return(FALSE);
}
static void
getMetric( buf, format, metric)
caddr_t buf;
CARD32 format;
xCharInfo *metric;
{
metric->leftSideBearing = getINT16( (unsigned char *)buf, (CARD32)format);
buf += 2;
metric->rightSideBearing = getINT16( (unsigned char *)buf, (CARD32)format);
buf += 2;
metric->characterWidth = getINT16( (unsigned char *)buf, (CARD32)format);
buf += 2;
metric->ascent = getINT16( (unsigned char *)buf, (CARD32)format);
buf += 2;
metric->descent = getINT16( (unsigned char *)buf, (CARD32)format);
buf += 2;
metric->attributes = getINT16( (unsigned char *)buf, (CARD32)format);
buf += 2;
}
static Bool
getAccel( pFontInfo, maxink, buf_top, tables, ntables, type)
FontInfoPtr pFontInfo;
xCharInfo *maxink;
caddr_t buf_top;
PCFTablePtr tables;
int ntables;
CARD32 type;
{
CARD32 format;
CARD32 offset;
caddr_t buffer;
if ( !seekToType( tables, ntables, (CARD32)type, &format, (CARD32 *)NULL, &offset))
return FALSE;
buffer = buf_top + offset;
format = getLSB32( (unsigned char *)buffer );
buffer += 4;
if (!PCF_FORMAT_MATCH(format, PCF_DEFAULT_FORMAT) &&
!PCF_FORMAT_MATCH(format, PCF_ACCEL_W_INKBOUNDS)) {
return FALSE;
}
pFontInfo->noOverlap = *buffer++;
pFontInfo->constantMetrics = *buffer++;
pFontInfo->terminalFont = *buffer++;
pFontInfo->constantWidth = *buffer++;
pFontInfo->inkInside = *buffer++;
pFontInfo->inkMetrics = *buffer++;
pFontInfo->drawDirection = *buffer++;
/* pFontInfo->anamorphic = FALSE; */
/* natural alignment */ buffer++;
pFontInfo->fontAscent = getINT32( (unsigned char *)buffer, (CARD32)format);
buffer += 4;
pFontInfo->fontDescent = getINT32( (unsigned char *)buffer, (CARD32)format);
buffer +=4;
/* pFontInfo->maxOverlap = getINT32( (unsigned char *)buffer, (CARD32)format); */ buffer += 4;
getMetric(buffer, format, &pFontInfo->minbounds.metrics);
buffer += 12;
getMetric(buffer, format, &pFontInfo->maxbounds.metrics);
buffer += 12;
if (PCF_FORMAT_MATCH(format, PCF_ACCEL_W_INKBOUNDS)) {
buffer += 12;
getMetric( buffer, format, maxink);
} else {
*maxink = pFontInfo->maxbounds.metrics;
}
return TRUE;
}
int
falInitReadPcf( pcfinf, buftop)
struct pcf_inf *pcfinf;
caddr_t buftop;
{
CARD32 format;
CARD32 offset;
CARD32 *bitmapSizes;
xCharInfo maxink;
caddr_t buffp;
if ( getLSB32( (unsigned char *)buftop ) != PCF_FILE_VERSION)
goto Bail;
pcfinf->ntables = getLSB32( (unsigned char *)(buftop + 4) );
pcfinf->tables = (PCFTablePtr)(buftop + 8);
if ( !getAccel( &pcfinf->info, &maxink, buftop, pcfinf->tables, pcfinf->ntables,
(CARD32)PCF_BDF_ACCELERATORS))
if ( !getAccel( &pcfinf->info, &maxink, buftop, pcfinf->tables, pcfinf->ntables,
(CARD32)PCF_ACCELERATORS))
goto Bail;
pcfinf->org_bounds = pcfinf->info.maxbounds.metrics;
if ( !seekToType( pcfinf->tables, pcfinf->ntables, (CARD32)PCF_BITMAPS,
&format, (CARD32 *)NULL, &offset))
goto Bail;
buffp = buftop + offset;
format = getLSB32( (unsigned char *)buffp );
buffp += 4;
if (!PCF_FORMAT_MATCH(format, PCF_DEFAULT_FORMAT))
goto Bail;
pcfinf->nbitmaps = getINT32( (unsigned char *)buffp, (CARD32)format);
buffp += 4;
pcfinf->offsets = (CARD32 *)buffp;
buffp += sizeof( *pcfinf->offsets) * pcfinf->nbitmaps;
bitmapSizes = (CARD32 *)buffp;
pcfinf->sizebitmaps = getINT32( (unsigned char *)&bitmapSizes[PCF_GLYPH_PAD_INDEX(format)], (CARD32)format);
pcfinf->bmp_fmt = format;
buffp += sizeof( *bitmapSizes) * GLYPHPADOPTIONS;
pcfinf->bitmaps = buffp;
buffp += pcfinf->sizebitmaps;
if ( !seekToType( pcfinf->tables, pcfinf->ntables, (CARD32)PCF_BDF_ENCODINGS,
&format, (CARD32 *)NULL, &offset))
goto Bail;
buffp = buftop + offset;
format = getLSB32( (unsigned char *)buffp );
buffp += 4;
if (!PCF_FORMAT_MATCH(format, PCF_DEFAULT_FORMAT))
goto Bail;
pcfinf->info.firstCol = getINT16( (unsigned char *)buffp, (CARD32)format);
buffp += 2;
pcfinf->info.lastCol = getINT16( (unsigned char *)buffp, (CARD32)format);
buffp += 2;
pcfinf->info.firstRow = getINT16( (unsigned char *)buffp, (CARD32)format);
buffp += 2;
pcfinf->info.lastRow = getINT16( (unsigned char *)buffp, (CARD32)format);
buffp += 2;
/*
pcfinf->info.defaultCh = getINT16( (unsigned char *)buffp, (CARD32)format); buffp += 2;
*/
pcfinf->info.chDefault = getINT16( (unsigned char *)buffp, (CARD32)format);
buffp += 2;
pcfinf->info.allExist = FALSE;
pcfinf->enc_fmt = format;
pcfinf->encodingOffsets = (CARD16 *)buffp;
return 0;
Bail:
return -1;
}
static void
ByteSwap( p, scan)
char *p;
int scan;
{
char w;
switch( scan) {
case 1:
break;
case 2:
w = *p;
*p = *(p + 1);
*(p + 1) = w;
break;
case 4:
w = *p;
*p = *(p + 3);
*(p + 3) = w;
w = *(p + 1);
*(p + 1) = *(p + 2);
*(p + 2) = w;
break;
}
}
static void
repadBits( src, format, width, height, dest)
char *src;
CARD32 format;
int width, height;
char *dest;
{
int bit, byte, glyph, scan;
int src_bytewidth, dest_bytewidth;
char work[8];
int i, j;
bit = PCF_BIT_ORDER( format);
byte = PCF_BYTE_ORDER( format);
glyph = PCF_GLYPH_PAD( format);
scan = PCF_SCAN_UNIT( format);
src_bytewidth = (( width + ( 8 * glyph ) - 1)/( 8 * glyph)) * glyph;
dest_bytewidth = ( width + 7) /8;
for ( i = 0; i < height; i++, src += src_bytewidth,
dest += dest_bytewidth) {
for ( j = 0; j < src_bytewidth; j += scan) {
memcpy( work, src + j, scan);
if ( bit == LSBFirst)
BitOrderInvert( work, scan );
if ( byte == LSBFirst)
ByteSwap( work, scan);
if (( j + scan) >= dest_bytewidth) {
memcpy( dest + j, work, dest_bytewidth - j);
break;
}
memcpy( dest + j, work, scan);
}
}
}
int
falPcfGlyph( glyph, finf, code)
char *glyph;
Oak_FontInf *finf;
int code;
{
int encode;
int inner_code;
char *bitmap;
int encodingOffset;
int codeRow, codeCol;
int bytewidth;
int bmp_adj, ptn_adj;
int adj_hi;
int cpy_height;
int bmp_height;
if ( !glyph){
fal_utyerrno = FAL_ERR_PARM ;
return FAL_ERROR ;
}
inner_code = code;
codeCol = inner_code & 0xff;
codeRow = (inner_code >> 8) & 0xff;
/* code check */
if (
((code < finf->start) || (code > finf->end))||
((codeCol < finf->pFinf->firstCol)||(codeCol > finf->pFinf->lastCol))||
((codeRow < finf->pFinf->firstRow)||(codeRow > finf->pFinf->lastRow))
) {
fal_utyexists = 1;
return(-1);
}
encode = (codeRow - finf->pFinf->firstRow) * ( finf->pFinf->lastCol - finf->pFinf->firstCol + 1);
encode += codeCol - finf->pFinf->firstCol;
encodingOffset = getINT16( (unsigned char *)(finf->pcfinf.encodingOffsets + encode), finf->pcfinf.enc_fmt);
if (encodingOffset == 0xFFFF) {
fal_utyexists = 1;
return(-1);
}
fal_utyexists = 0;
bitmap = finf->pcfinf.bitmaps + getINT32( (unsigned char *)(finf->pcfinf.offsets + encodingOffset), finf->pcfinf.bmp_fmt);
bmp_height = finf->pFinf->maxbounds.metrics.ascent
+ finf->pFinf->maxbounds.metrics.descent;
if (( adj_hi = finf->pFinf->maxbounds.metrics.ascent
- finf->pcfinf.org_bounds.ascent) > 0) {
bytewidth = 8 * PCF_GLYPH_PAD( finf->pcfinf.bmp_fmt);
bytewidth = (( finf->width + bytewidth - 1)/ bytewidth ) * PCF_GLYPH_PAD( finf->pcfinf.bmp_fmt);
bmp_adj = bytewidth * adj_hi;
ptn_adj = 0;
if (( cpy_height = bmp_height - adj_hi) > finf->height)
cpy_height = finf->height;
} else if ( adj_hi < 0) {
adj_hi *= -1;
bytewidth = ( finf->width + 7) / 8;
bmp_adj = 0;
ptn_adj = bytewidth * adj_hi;
if (( cpy_height = finf->height - adj_hi) > bmp_height)
cpy_height = bmp_height;
} else {
bmp_adj = 0;
ptn_adj = 0;
cpy_height = finf->height;
}
repadBits( bitmap + bmp_adj , finf->pcfinf.bmp_fmt, finf->width, cpy_height, glyph + ptn_adj);
return(0);
}
void
falGetPcfGSize( pcfinf, widthp, heightp)
struct pcf_inf *pcfinf;
unsigned int *widthp, *heightp;
{
unsigned int w, h;
w = pcfinf->org_bounds.rightSideBearing
- pcfinf->org_bounds.leftSideBearing;
h = pcfinf->org_bounds.ascent + pcfinf->org_bounds.descent;
*widthp = w;
*heightp = h;
}
/********************************************************
*
* functions for collect GPF file properties
*
*******************************************************/
#include "fontstruct.h"
static char *getPcfFontProp();
static char *getSnfFontProp();
/*
* read properties and get font style and
* letter size
*/
int
falReadFontProp( file, protect_key_data, databuff, islock )
char *file ; /* name of font file */
int protect_key_data ;
FalFontData *databuff ;
int islock ;
{
Oak_FontInf finf;
int fd ;
char *buf;
char *openfontfile;
struct stat st;
int rtn ;
/* initialezation */
openfontfile = file ;
/* read a condition of a fontfile */
if ( stat( openfontfile, &st ) < 0 ) {
set_errfile_str( fal_err_file, openfontfile ) ;
fal_utyerror = _FAL_STAT_ER;
fal_utyderror = errno;
fal_utyerrno = FAL_ERR_STAT ;
return FAL_ERROR;
}
if ( st.st_size < sizeof( FontInfoRec ) ) {
fal_utyerror = _FAL_FONT_ER;
fal_utyderror = 0;
fal_utyerrno = FAL_ERR_FONT ;
return FAL_ERROR;
}
/* open a fontfile */
if ( (fd = open( openfontfile, ((islock)? O_RDONLY : O_RDWR) )) < 0 ) {
switch( errno ) {
case EACCES :
return _FAL_TRY_NEXT ;
default :
set_errfile_str( fal_err_file, openfontfile ) ;
fal_utyerror = _FAL_OPEN_ER;
fal_utyderror = errno;
fal_utyerrno = FAL_ERR_FNT_OPN ;
return FAL_ERROR;
}
}
#if defined( SVR4 )
buf = (char *)mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
if ( buf != (char *)-1 ) {
/* if "mmap" is normal end */
close( fd );
finf.ismmap = TRUE;
finf.fsize = st.st_size;
} else {
/* if "mmap" is abnormal end , try "read()" */
finf.ismmap = FALSE;
if ( !(buf = (char *)malloc(st.st_size)) ) {
fal_utyerror = _FAL_MALOC_ER;
fal_utyderror = 0;
fal_utyerrno = FAL_ERR_MALLOC ;
close( fd );
return FAL_ERROR;
}
if ( read(fd, buf, st.st_size) != st.st_size ) {
set_errfile_str( fal_err_file, openfontfile ) ;
fal_utyerror = _FAL_READ_ER;
fal_utyderror = errno;
fal_utyerrno = FAL_ERR_FNT_RD ;
free( buf );
close( fd );
return FAL_ERROR;
}
}
#else
finf.ismmap = FALSE;
if ( !(buf = (char *)malloc( st.st_size )) ) {
fal_utyerror = _FAL_MALOC_ER;
fal_utyderror = 0;
fal_utyerrno = FAL_ERR_MALLOC ;
close( fd );
return FAL_ERROR;
}
if ( read(fd, buf, st.st_size) != st.st_size ) {
set_errfile_str( fal_err_file, openfontfile ) ;
fal_utyerror = _FAL_READ_ER;
fal_utyderror = errno;
fal_utyerrno = FAL_ERR_FNT_RD ;
free( buf );
close( fd );
return FAL_ERROR;
}
#endif
finf.fname = openfontfile ;
finf.buf = buf ;
/*
* open GPF font file
*/
rtn = falReadGpfProp( FAL_UPDATE_FONTINFO, &finf, protect_key_data, databuff ) ;
#if defined( SVR4 )
if ( finf.ismmap == TRUE ) {
munmap( buf, finf.fsize );
} else {
free(buf);
close(fd);
}
#else
free( buf );
close( fd );
#endif
return( rtn ) ;
}
/*
* get properties of GPF format file
*/
int
falReadGpfProp( updflg, finf, protect_key_data, databuff )
int updflg ;
Oak_FontInf *finf;
int protect_key_data ;
FalFontData *databuff ;
{
char *openfontfile;
int rtn ;
/* initialize */
openfontfile = finf->fname ;
if( updflg == FAL_UPDATE_FONTINFO ) {
/* case of a PCF format font */
if ( strcmp( FILE_SUFFIX( openfontfile ), PCFSUFFIX ) == 0 ) {
finf->isFef = FALSE;
finf->isPcf = TRUE;
}
else /* case of a SNF format font */
{
FAL_READ_SNF_HEADER( finf, protect_key_data, fal_utyerror, fal_utyderror ) ;
}
} /* updflg */
/*
* get font properties
*/
if ( finf->isFef ){
/* read SNF format property */
if ( rtn = falInitReadSnfProp( finf, (caddr_t)finf->pFinf, databuff ) ) {
if( rtn == _FAL_TRY_NEXT ){
return( rtn ) ;
}
fal_utyerror = _FAL_FONT_ER;
fal_utyderror = 0;
return FAL_ERROR;
}
} else if ( finf->isPcf ) {
/* read PCF format property */
if ( rtn = falInitReadPcfProp( updflg, finf, databuff ) ) {
if( rtn == _FAL_TRY_NEXT ){
return( rtn ) ;
}
fal_utyerror = _FAL_FONT_ER;
fal_utyderror = 0;
return FAL_ERROR;
}
if( updflg == FAL_UPDATE_FONTINFO ) {
finf->pFinf = &finf->pcfinf.info;
finf->pCinf = NULL;
finf->pGlyphs = NULL;
}
} else {
fal_utyerror = _FAL_FONT_ER;
fal_utyderror = 0;
fal_utyerrno = FAL_ERR_FONT ;
return FAL_ERROR;
}
return(0);
}
/*
* get properties of PCF format file
*/
int
falInitReadPcfProp( updflg, finf, databuff )
int updflg ;
Oak_FontInf *finf;
FalFontData *databuff ;
{
struct pcf_inf *pcfinf;
caddr_t buftop;
xCharInfo maxink;
caddr_t buffp;
int lb, rb, as, ds ;
pcfinf = &finf->pcfinf ;
buftop = finf->buf ;
if ( getLSB32( (unsigned char *)buftop ) != PCF_FILE_VERSION)
return _FAL_TRY_NEXT ;
if( updflg == FAL_UPDATE_FONTINFO ) {
pcfinf->ntables = getLSB32( (unsigned char *)(buftop + 4) );
pcfinf->tables = (PCFTablePtr)(buftop + 8);
if ( !getAccel( &pcfinf->info, &maxink, buftop, pcfinf->tables,
pcfinf->ntables, (CARD32)PCF_BDF_ACCELERATORS)) {
if ( !getAccel( &pcfinf->info, &maxink, buftop, pcfinf->tables,
pcfinf->ntables, (CARD32)PCF_ACCELERATORS)) {
fal_utyerrno = FAL_ERR_FONT ;
goto Bail;
}
}
}
/*
* read property
*/
if( updflg == FAL_UPDATE_FONTINFO ) {
pcfinf->org_bounds = pcfinf->info.maxbounds.metrics;
}
lb = pcfinf->org_bounds.leftSideBearing ;
rb = pcfinf->org_bounds.rightSideBearing ;
as = pcfinf->org_bounds.ascent ;
ds = pcfinf->org_bounds.descent ;
databuff->size.w = rb - lb ;
databuff->size.h = as + ds ;
/*
* read property "FONT"
*/
if ( buffp = getPcfFontProp( buftop, pcfinf->tables,
pcfinf->ntables, "FONT" )) {
if( (databuff->xlfdname = (char *)strdup( buffp )) == (char *)NULL ){
fal_utyerrno = FAL_ERR_MALLOC ;
goto Bail;
}
}else{
set_errfile_str( fal_err_file, finf->fname ) ;
fal_utyerrno = FAL_ERR_PROP_FONT ;
return( _FAL_TRY_NEXT ) ;
}
/*
* read property "FAMILY_NAME"
*/
if ( buffp = getPcfFontProp( buftop, pcfinf->tables,
pcfinf->ntables, "FAMILY_NAME")) {
if( (databuff->style.name = (char *)strdup( buffp )) == NULL ){
fal_utyerrno = FAL_ERR_MALLOC ;
goto Bail ;
}
}else{
set_errfile_str( fal_err_file, finf->fname ) ;
fal_utyerrno = FAL_ERR_PROP_FNAME ;
return( _FAL_TRY_NEXT ) ;
}
return 0;
Bail:
return -1;
}
static char *
getPcfFontProp( buftop, tables, ntables, propname)
caddr_t buftop;
PCFTablePtr tables;
int ntables;
char *propname;
{
caddr_t buffer;
int name_ofs;
int i ;
int nprops;
char *propstr ;
CARD32 format, offset;
if ( !seekToType( tables, ntables, (CARD32)PCF_PROPERTIES, &format, (CARD32 *)NULL, &offset))
return NULL;
buffer = buftop + offset;
format = getLSB32( (unsigned char *)buffer );
buffer += 4;
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT))
return NULL;
nprops = getINT32( (unsigned char *)buffer, (CARD32)format);
buffer += 4;
propstr = buffer + (4 * ((nprops * 9 + 3) / 4)) + 4;
for ( i=0; i < nprops ; i++ ) {
name_ofs = getINT32( (unsigned char *)buffer, (CARD32)format ) ;
buffer += 4 ; /* name */
if ( strcmp( propstr + name_ofs, propname) == 0) {
if ( *buffer) { /* isStringProp */
return( propstr + getINT32( (unsigned char *)(buffer + 1), (CARD32)format) );
}else{
return((char *)(intptr_t)getINT32( (unsigned char *)(buffer + 1), (CARD32)format) );
}
}
buffer += 5 ; /* isStringProp + value */
}
return( NULL);
}
/*
* get properties of SNF format file
*/
int
falInitReadSnfProp( finf, buftop, databuff )
Oak_FontInf *finf; /* pointer to the infomation structure */
caddr_t buftop; /* font file */
FalFontData *databuff ;
{
caddr_t stprop ;
int lb, rb, as, ds ;
char *propptr ;
char *fnt = NULL, *fam ;
int nprops, bitmapSize, num_chars ;
/* initialize pointer */
nprops = finf->pFinf->nProps ;
num_chars = ( finf->pFinf->lastRow - finf->pFinf->firstRow + 1 ) *
( finf->pFinf->lastCol - finf->pFinf->firstCol + 1 ) ;
bitmapSize = BYTESOFGLYPHINFO(finf->pFinf) ;
stprop = buftop ;
stprop += sizeof(FontInfoRec) ;
stprop += num_chars * sizeof(CharInfoRec) ;
stprop += bitmapSize ;
/*
* read property "FONTBOUNDINGBOX"
*/
lb = finf->pFinf->maxbounds.metrics.leftSideBearing ;
rb = finf->pFinf->maxbounds.metrics.rightSideBearing ;
as = finf->pFinf->maxbounds.metrics.ascent ;
ds = finf->pFinf->maxbounds.metrics.descent ;
/*
* read property "FONT"
*/
if ( propptr = getSnfFontProp( stprop, nprops, "FONT" )) {
if( (fnt = (char *)strdup( propptr )) == NULL ){
fal_utyerrno = FAL_ERR_MALLOC ;
goto Bail;
}
}else{
set_errfile_str( fal_err_file, finf->fname ) ;
fal_utyerrno = FAL_ERR_PROP_FONT ;
return( _FAL_TRY_NEXT ) ;
}
/*
* read property "FAMILY_NAME"
*/
if ( propptr = getSnfFontProp( stprop, nprops, "FAMILY_NAME")) {
if( (fam = (char *)strdup( propptr )) == NULL ){
fal_utyerrno = FAL_ERR_MALLOC ;
goto Bail ;
}
}else{
set_errfile_str( fal_err_file, finf->fname ) ;
fal_utyerrno = FAL_ERR_PROP_FNAME ;
free(fnt);
return( _FAL_TRY_NEXT ) ;
}
/*
* set data buffer
*/
databuff->size.w = rb - lb ;
databuff->size.h = as + ds ;
databuff->xlfdname = fnt ;
databuff->style.name = fam ;
return 0;
Bail:
free(fnt);
return -1;
}
static char *
getSnfFontProp( buftop, nprops, propname )
caddr_t buftop;
int nprops ;
char *propname;
{
caddr_t buffer;
int name_ofs;
int i ;
char *propstr ;
FontPropRec *ProcRec ;
ProcRec = (FontPropRec *)buftop ;
buffer = (char *)buftop ;
propstr = buffer + nprops * sizeof(FontPropRec) ;
for ( i=0; i < nprops ; i++, ProcRec++ ) {
name_ofs = ProcRec->name ;
if( strcmp( propstr + name_ofs, propname ) == 0 ){
if( ProcRec->indirect ){
return( propstr + ProcRec->value ) ;
}else{
return( (char *) (intptr_t) ProcRec->value ) ;
}
}
}
return( NULL);
}
/***********************< end of readpcf.c >********************/

View File

@@ -1,76 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: syncx.c /main/3 1996/07/04 02:32:52 cde-fuj $ */
/*
* (c) Copyright 1995 FUJITSU LIMITED
* This is source code modified by FUJITSU LIMITED under the Joint
* Development Agreement for the CDEnext PST.
* This is unpublished proprietary source code of FUJITSU LIMITED
*/
#include <stdio.h>
/* "fal" -> "X" */
/* GetFProp.c falGetFontProperty() : Xlib.h */
/* omDefault.c _falwcDefaultTextPerCharExtents(): omGeneric.c */
/* IntAtom.c falInternAtom() : Xlib.h */
/* Font.c falFreeFont() : Xlib.h */
/* FontInfo.c falFreeFontInfo() : Xlib.h */
/* TextToStr.c falFreeStringList() : Xlib.h */
/* FontNames.c falFreeFontNames() : Xlib.h */
/* Bool */ falGetFontProperty() { return 0 ; }
/* Status */ _falwcDefaultTextPerCharExtents(){ return 0 ; }
void _falmbDefaultDrawImageString() { return ; }
/* Atom */ falInternAtom() { return 0 ; }
int _falwcGenericDrawString() { return 0 ; }
char **_falParseBaseFontNameList() { return NULL ; }
/* XFontStruct * */ falLoadQueryFont() { return 0 ; }
falFreeFont() { return 0 ; }
falFreeFontInfo() { return 0 ; }
/* char ** */ falListFonts() { return 0 ; }
void _falmbGenericDrawImageString() { return ; }
void _falwcDefaultDrawImageString() { return ; }
int _falmbDefaultDrawString() { return 0 ; }
int _falmbGenericTextEscapement() { return 0 ; }
void falFreeStringList() { return ; }
/* falrmStringToQuark() { return 0 ; } */
/* falrmPermStringToQuark() { return 0 ; } */
int _falwcDefaultDrawString() { return 0 ; }
/* char * */ falGetAtomName() { return 0 ; }
int _falwcGenericTextExtents() { return 0 ; }
int _falmbGenericTextExtents() { return 0 ; }
void _falwcGenericDrawImageString() { return ; }
falFreeFontNames() { return 0 ; }
/* falrmQuarkToString() { return 0 ; } */
int _falwcDefaultTextExtents() { return 0 ; }
/* Status */ _falmbGenericTextPerCharExtents(){ return 0 ; }
int _falmbDefaultTextEscapement() { return 0 ; }
int _falwcGenericTextEscapement() { return 0 ; }
int _falmbDefaultTextExtents() { return 0 ; }
/* char ** */ falListFontsWithInfo() { return 0 ; }
int _falwcDefaultTextEscapement() { return 0 ; }
/* Status */ _falwcGenericTextPerCharExtents(){ return 0 ; }
/* _fallcMapOSLocaleName() { return 0 ; } */
int _falmbGenericDrawString() { return 0 ; }
/* Status */ _falmbDefaultTextPerCharExtents(){ return 0 ; }

View File

@@ -1,78 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: syncx.h /main/2 1996/06/25 20:04:52 cde-fuj $ */
/*
* (c) Copyright 1995 FUJITSU LIMITED
* This is source code modified by FUJITSU LIMITED under the Joint
* Development Agreement for the CDEnext PST.
* This is unpublished proprietary source code of FUJITSU LIMITED
*/
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xresource.h>
#include "_falutil.h"
extern XrmQuark falrmStringToQuark(
#if NeedFunctionPrototypes
_Xconst char* /* string */
#endif
);
extern XrmString falrmQuarkToString(
#if NeedFunctionPrototypes
XrmQuark /* quark */
#endif
);
extern char *falGetAtomName(
#if NeedFunctionPrototypes
Display* /* display */,
Atom /* atom */
#endif
);
extern char **falListFonts(
#if NeedFunctionPrototypes
Display* /* display */,
_Xconst char* /* pattern */,
int /* maxnames */,
int* /* actual_count_return */
#endif
);
extern char **falListFontsWithInfo(
#if NeedFunctionPrototypes
Display* /* display */,
_Xconst char* /* pattern */,
int /* maxnames */,
int* /* count_return */,
XFontStruct** /* info_return */
#endif
);
extern XFontStruct *falLoadQueryFont(
#if NeedFunctionPrototypes
Display* /* display */,
_Xconst char* /* name */
#endif
);