1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Refactor and reimplement dtudcfonted

This commit is contained in:
chase 2018-07-27 16:44:10 -05:00 committed by Jon Trulson
parent 0f1aaa3e46
commit b491f9134f
83 changed files with 3706 additions and 7498 deletions

View file

@ -96,25 +96,17 @@ typedef struct {
} ListData; } ListData;
#ifndef NO_MESSAGE_CATALOG #ifndef NO_MESSAGE_CATALOG
# ifdef __ultrix # define _CLIENT_CAT_NAME "dtudcexch"
# define _CLIENT_CAT_NAME "dtudcexch.cat"
# else /* __ultrix */
# define _CLIENT_CAT_NAME "dtudcexch"
# endif /* __ultrix */
# ifdef _NO_PROTO
extern char *_DtGetMessage();
# else /* _NO_PROTO */
extern char *_DtGetMessage( extern char *_DtGetMessage(
char *filename, char *filename,
int set, int set,
int n, int n,
char *s ); char *s );
# endif /* _NO_PROTO */
#define GETMESSAGE(set, number, string) GetMessage(set, number, string) #define GETMESSAGE(set, number, string) GetMessage(set, number, string)
static char * static char *
GetMessage(set, number, string) GetMessage(int set, int number, char *string)
int set, number;
char *string;
{ {
char *tmp; char *tmp;
static char * point[100]; static char * point[100];

View file

@ -65,10 +65,7 @@ sigint_out()
} }
int int
expCheckCode( code, code_num, code_list ) expCheckCode( unsigned int code, int code_num, int *code_list )
unsigned int code ;
int code_num ;
int *code_list ;
{ {
int i ; int i ;
@ -80,14 +77,15 @@ int *code_list ;
} }
int int
ExpGpftoBDF( gpf_name, bdf_name, code_num, code_list, comment_num, comment_list, make_all ) ExpGpftoBDF(
char *gpf_name ; /* pointer to GPF file name area */ char *gpf_name, /* pointer to GPF file name area */
char *bdf_name ; /* pointer to BDF file name area */ char *bdf_name, /* pointer to BDF file name area */
int code_num ; /* number of GPF code */ int code_num, /* number of GPF code */
int *code_list ; /* pointer to GPF code lists */ int *code_list, /* pointer to GPF code lists */
int comment_num ; /* number comments */ int comment_num, /* number comments */
char **comment_list ;/* pointer to the list of comments */ char **comment_list, /* pointer to the list of comments */
int make_all ; /* convert whole GPF fomat file to BDF */ int make_all /* convert whole GPF fomat file to BDF */
)
{ {
struct stat statbuf ; struct stat statbuf ;
struct btophead r_gpf ; struct btophead r_gpf ;
@ -168,7 +166,7 @@ int make_all ; /* convert whole GPF fomat file to BDF */
w_bdf.code = r_gpf.code ; w_bdf.code = r_gpf.code ;
w_bdf.ptn = r_gpf.ptn ; w_bdf.ptn = r_gpf.ptn ;
if( (rtn = WritePtnToBdf( &w_bdf, buf )) ){ if( (rtn = WritePtnToBdf( &w_bdf )) ){
fprintf(stderr, "\"%s\" cannot write glyph.\n", bdf_name ) ; fprintf(stderr, "\"%s\" cannot write glyph.\n", bdf_name ) ;
fclose(w_bdf.output) ; fclose(w_bdf.output) ;
return rtn ; return rtn ;
@ -193,10 +191,10 @@ int make_all ; /* convert whole GPF fomat file to BDF */
} }
static int static int
writeBdfHeader(head, comment_num, comment_list) writeBdfHeader(struct ptobhead *head,
struct ptobhead *head; int comment_num, /* number comments */
int comment_num ; /* number comments */ char **comment_list /*pointer to the list of comments */
char **comment_list ;/* pointer to the list of comments */ )
{ {
FILE *fp; FILE *fp;
int fd[2]; int fd[2];
@ -276,7 +274,7 @@ char **comment_list ;/* pointer to the list of comments */
char *ep ; char *ep ;
if( (ep = (char *)strchr( comment_list[i], '\n' )) != NULL ) if( (ep = (char *)strchr( comment_list[i], '\n' )) != NULL )
*ep = '\0' ; *ep = '\0' ;
if( comment_list[i] == '\0' ) continue ; if( !comment_list[i] ) continue ;
fprintf(head->output, "COMMENT %s\n", comment_list[i]); fprintf(head->output, "COMMENT %s\n", comment_list[i]);
} }
fprintf(head->output, "COMMENT\n"); fprintf(head->output, "COMMENT\n");
@ -327,12 +325,11 @@ char **comment_list ;/* pointer to the list of comments */
static int static int
readBdfToMemory(head, buf, code_num, code_list, make_all) readBdfToMemory(struct btophead *head, char *buf,
struct btophead *head; int code_num, /* number of GPF code */
char *buf; int *code_list, /* pointer to GPF code lists */
int code_num ; /* number of GPF code */ int make_all /* convert whole GPF fomat file to BDF */
int *code_list ; /* pointer to GPF code lists */ )
int make_all ; /* convert whole GPF fomat file to BDF */
{ {
int code, mwidth, num_char, bsize, rtn; int code, mwidth, num_char, bsize, rtn;
char *ptn; char *ptn;

View file

@ -83,7 +83,7 @@ static char *targ_file = NULL; /* UDC_file_name */
static void static void
sigint_out() sigint_out(void)
{ {
if (WriteGpf.out_file) { if (WriteGpf.out_file) {
UNLINK_TMPFILE( WriteGpf.out_file ); UNLINK_TMPFILE( WriteGpf.out_file );
@ -95,10 +95,7 @@ sigint_out()
int int
ImpBDFCodeList( bdf_name, code_num, code_list ) ImpBDFCodeList(char *bdf_name, int *code_num, int **code_list)
char *bdf_name ;
int *code_num ;
int **code_list ;
{ {
int *glyph_list ; int *glyph_list ;
FILE *bdfp ; FILE *bdfp ;
@ -165,8 +162,7 @@ int **code_list ;
int int
ImpBDFCodeListFree( code_list ) ImpBDFCodeListFree(int **code_list)
int **code_list ;
{ {
free( *code_list ) ; free( *code_list ) ;
return(0) ; return(0) ;
@ -175,9 +171,10 @@ int **code_list ;
int int
ImpBDFCheck( bdf_name, gpf_name ) ImpBDFCheck(
char *bdf_name ; /* BDF file name */ char *bdf_name, /* BDF file name */
char *gpf_name ; /* GPF file name */ char *gpf_name /* GPF file name */
)
{ {
/* parameter check */ /* parameter check */
if( bdf_name == NULL || gpf_name == NULL ){ if( bdf_name == NULL || gpf_name == NULL ){
@ -190,11 +187,12 @@ char *gpf_name ; /* GPF file name */
int int
ImpBDFtoGpf( bdf_name, gpf_name, bdf_codenum, bdf_codelist) ImpBDFtoGpf(
char *bdf_name ; char *bdf_name,
char *gpf_name ; char *gpf_name,
int bdf_codenum ; int bdf_codenum,
int *bdf_codelist ; int *bdf_codelist
)
{ {
int rtn ; int rtn ;
int exit_stat; int exit_stat;
@ -359,10 +357,11 @@ int *bdf_codelist ;
*/ */
static static
impFileConvInit(r_udc, r_gpf, w_gpf ) impFileConvInit(
struct btophead *r_udc; struct btophead *r_udc,
struct btophead *r_gpf; struct btophead *r_gpf,
struct ptobhead *w_gpf; struct ptobhead *w_gpf
)
{ {
int fd[2], snf_fd, permission; int fd[2], snf_fd, permission;
char buf[BUFSIZE]; char buf[BUFSIZE];
@ -386,11 +385,6 @@ struct ptobhead *w_gpf;
if ( ChkPcfFontFile( w_gpf->snf_file ) ) { if ( ChkPcfFontFile( w_gpf->snf_file ) ) {
/* snf */ /* snf */
if ( ( snf_fd = open( w_gpf->snf_file, O_RDONLY ) ) >= 0 ) { if ( ( snf_fd = open( w_gpf->snf_file, O_RDONLY ) ) >= 0 ) {
COMM_SNF_FILEVERSION( snf_fd, finf, buf, permission ) ;
if( permission < 0 ) {
return BDF_INVAL;
}
} else {
return BDF_OPEN_IN; return BDF_OPEN_IN;
} }
} }
@ -477,11 +471,12 @@ struct ptobhead *w_gpf;
static static
impGetGpfInf( r_gpf, w_gpf, buf, bdf_codenum ) impGetGpfInf(
struct btophead *r_gpf; struct btophead *r_gpf,
struct ptobhead *w_gpf; struct ptobhead *w_gpf,
char *buf; char *buf,
int bdf_codenum ; int bdf_codenum
)
{ {
int nchar, rtn; int nchar, rtn;
@ -505,10 +500,11 @@ int bdf_codenum ;
static static
impReadBdfHeaderAndPut(r_gpf, w_gpf, buf) impReadBdfHeaderAndPut(
struct btophead *r_gpf; struct btophead *r_gpf,
struct ptobhead *w_gpf; struct ptobhead *w_gpf,
char *buf; char *buf
)
{ {
char *p; char *p;
unsigned int getstat = 0; unsigned int getstat = 0;
@ -555,12 +551,13 @@ char *buf;
static static
impMergePtn(r_udc, r_gpf, buf, bdf_codenum, bdf_codelist ) impMergePtn(
struct btophead *r_udc; struct btophead *r_udc,
struct btophead *r_gpf; struct btophead *r_gpf,
char *buf; char *buf,
int bdf_codenum ; int bdf_codenum,
int *bdf_codelist ; int *bdf_codelist
)
{ {
int code, rtn, msize, i, j; int code, rtn, msize, i, j;
char *ptn; char *ptn;
@ -615,11 +612,7 @@ int *bdf_codelist ;
} }
static static
impModifyPtn( r_udc, r_gpf, buf, ix ) impModifyPtn(struct btophead *r_udc, struct btophead *r_gpf, char *buf, int ix)
struct btophead *r_udc;
struct btophead *r_gpf;
char *buf;
int ix;
{ {
int mwidth, msize, rtn; int mwidth, msize, rtn;
@ -644,12 +637,13 @@ int ix;
} }
static static
impInsertPtn( r_udc, r_gpf, buf, code, ix ) impInsertPtn(
struct btophead *r_udc; struct btophead *r_udc,
struct btophead *r_gpf; struct btophead *r_gpf,
char *buf; char *buf,
int code; int code,
int ix; int ix
)
{ {
int mwidth, msize, rtn, i; int mwidth, msize, rtn, i;
@ -688,9 +682,7 @@ int ix;
} }
static static
impWriteSnf( r_gpf, w_gpf ) impWriteSnf(struct btophead *r_gpf, struct ptobhead *w_gpf)
struct btophead *r_gpf;
struct ptobhead *w_gpf;
{ {
w_gpf->zoomf = 0; w_gpf->zoomf = 0;
w_gpf->num_chars = r_gpf->num_chars; w_gpf->num_chars = r_gpf->num_chars;

View file

@ -134,8 +134,7 @@ static Widget *button4=NULL;
*/ */
void void
xlfdPopupDialog(w) xlfdPopupDialog(Widget w)
Widget w;
{ {
if (! XtIsManaged(w)) if (! XtIsManaged(w))
XtManageChild(w); XtManageChild(w);
@ -144,8 +143,7 @@ Widget w;
} }
void void
ForcePopdownDialog(w) ForcePopdownDialog(Widget w)
Widget w;
{ {
if (XtIsManaged(w)){ if (XtIsManaged(w)){
XtUnmanageChild(w); XtUnmanageChild(w);
@ -367,10 +365,7 @@ char_set(char *str) /* dtex */
} }
static char * static char *
spc(str, ch, count) spc(char *str, char ch, int count)
char * str;
char ch;
int count;
{ {
char *p; char *p;
p = str + strlen(str); p = str + strlen(str);
@ -506,10 +501,8 @@ static void OpenWindowCB() /* dtex change */
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
OpenCancelCB( widget, clientData, callData ) /* dtex change */ OpenCancelCB( Widget widget, caddr_t clientData, caddr_t callData )
Widget widget; /* dtex change */
caddr_t clientData;
caddr_t callData;
{ {
/* extern void ForcePopdownDialog(); /* extern void ForcePopdownDialog();
if ( !editPtnW ){ if ( !editPtnW ){
@ -523,8 +516,7 @@ caddr_t callData;
* create selection window view * create selection window view
*/ */
void void
PopupSelectXLFD( top ) PopupSelectXLFD( Widget top )
Widget top ;
{ {
if( xlfdDialog == NULL ){ if( xlfdDialog == NULL ){
@ -584,8 +576,7 @@ create_xlfd()
} }
static void static void
udc_call(w) udc_call(Widget w)
Widget w;
{ {
XmString label; XmString label;
char *moji; char *moji;
@ -621,8 +612,7 @@ Widget w;
} }
static void static void
sty_call(w) sty_call(Widget w)
Widget w;
{ {
XmString label; XmString label;
char *moji; char *moji;
@ -651,8 +641,7 @@ Widget w;
} }
static void static void
wls_call(w) wls_call(Widget w)
Widget w;
{ {
XmString label; XmString label;
char *moji; char *moji;
@ -678,8 +667,7 @@ Widget w;
} }
static void static void
hls_call(w) hls_call(Widget w)
Widget w;
{ {
XmString label; XmString label;
char *moji; char *moji;
@ -899,9 +887,7 @@ button_set4()
} }
void void
data_sort(data, count) data_sort(int *data, int count)
int *data;
int count;
{ {
int *p1, *p2, tmp, i; int *p1, *p2, tmp, i;
@ -1071,8 +1057,7 @@ font_init() /* dtex change */
static Widget static Widget
CreateSelectXLFD( top ) /* dtex change */ CreateSelectXLFD( Widget top ) /* dtex change */
Widget top ;
{ {
int n; int n;

View file

@ -168,7 +168,7 @@ void setallcode(ListData *ld)
} }
} }
FalFontID openfont() FalFontID openfont(void)
{ {
int protect_key = FAL_FONT_DISPLAY; int protect_key = FAL_FONT_DISPLAY;
int codeset; int codeset;
@ -311,8 +311,7 @@ void getexistcode(ListData *ld)
*/ */
void void
xlfdPopupDialog(w) xlfdPopupDialog(Widget w)
Widget w;
{ {
if (! XtIsManaged(w)) if (! XtIsManaged(w))
XtManageChild(w); XtManageChild(w);
@ -321,8 +320,7 @@ Widget w;
} }
void void
xlfdPopdownDialog(w) xlfdPopdownDialog(Widget w)
Widget w;
{ {
if (XtIsManaged(w)){ if (XtIsManaged(w)){
XtUnmanageChild(w); XtUnmanageChild(w);
@ -334,10 +332,7 @@ Widget w;
* get pixel width * get pixel width
*/ */
Dimension Dimension
GetPixelWidth( w, columns, width ) GetPixelWidth(Widget w, int columns, Dimension *width)
Widget w ;
int columns ;
Dimension *width ;
{ {
Arg args[1] ; Arg args[1] ;
XtSetArg( args[0], XmNwidth, width ) ; XtSetArg( args[0], XmNwidth, width ) ;
@ -350,9 +345,7 @@ Dimension *width ;
* callbacks * * callbacks *
***************************************************************/ ***************************************************************/
void quit(w, client_data, call_data) void quit(Widget w, caddr_t *client_data, caddr_t *call_data)
Widget w;
caddr_t *client_data, *call_data;
{ {
char *msg; char *msg;
int ans; int ans;
@ -374,9 +367,7 @@ caddr_t *client_data, *call_data;
* Unmanage widgets * Unmanage widgets
*/ */
int int
ClearText( num, slctBText ) ClearText(int num, Widget *slctBText)
int num ;
Widget *slctBText ;
{ {
int i ; int i ;
/* toggle button unset */ /* toggle button unset */
@ -389,9 +380,7 @@ Widget *slctBText ;
} }
int int
ClearButtons( num, slctButton ) ClearButtons(int num, Widget *slctButton)
int num ;
Widget *slctButton ;
{ {
int i, cnt ; int i, cnt ;
Boolean isSet ; Boolean isSet ;
@ -418,13 +407,13 @@ Widget *slctButton ;
* get text field position * get text field position
*/ */
int int
GetPositionOfLists( num, xlfdDialog, listPop, slctBText, x, y ) GetPositionOfLists(
int num ; int num,
Widget xlfdDialog ; Widget xlfdDialog,
Widget *listPop ; Widget *listPop,
Widget *slctBText ; Widget *slctBText,
Position *x ; Position *x,
Position *y ; Position *y)
{ {
int i ; int i ;
Position tbx, tby, tx, ty ; Position tbx, tby, tx, ty ;
@ -462,10 +451,7 @@ Position *y ;
void listEH(w, num, event) void listEH(Widget w, int num, XButtonEvent *event)
Widget w ;
int num ;
XButtonEvent *event;
{ {
int i, j, ITEM_COUNT; int i, j, ITEM_COUNT;
Arg args[10]; Arg args[10];
@ -536,10 +522,7 @@ XButtonEvent *event;
void listPrintCB(w, num, call_data) void listPrintCB(Widget w, int num, XmListCallbackStruct *call_data)
Widget w;
int num ;
XmListCallbackStruct *call_data;
{ {
char *str ; char *str ;
@ -568,9 +551,7 @@ XmListCallbackStruct *call_data;
void OpenWindow(w, client_data, call_data) void OpenWindow(Widget w, caddr_t client_data, caddr_t *call_data)
Widget w;
caddr_t client_data, *call_data;
{ {
int r ; int r ;
int i ; int i ;
@ -680,11 +661,11 @@ caddr_t client_data, *call_data;
int int
CreateXLFDLabelAndText( owner, slctBLabel, slctBText, slctButton ) CreateXLFDLabelAndText(
Widget owner ; Widget owner,
Widget *slctBLabel ; Widget *slctBLabel,
Widget *slctBText ; Widget *slctBText,
Widget *slctButton ; Widget *slctButton)
{ {
Widget _slctBLabel ; Widget _slctBLabel ;
@ -769,15 +750,14 @@ Widget *slctButton ;
int int
CreateOtherLabelAndText( num, owner, baseForm, CreateOtherLabelAndText(
slctBLabel, topW, slctBText, slctButton ) int num,
int num ; Widget owner,
Widget owner ; Widget baseForm,
Widget baseForm ; Widget *slctBLabel,
Widget *slctBLabel ; Widget topW,
Widget topW ; Widget *slctBText,
Widget *slctBText ; Widget *slctButton)
Widget *slctButton ;
{ {
Widget _slctBLabel ; Widget _slctBLabel ;
@ -875,11 +855,7 @@ Widget *slctButton ;
Widget Widget
xlfdCreateScrolledList ( owner, name, args, n ) xlfdCreateScrolledList (Widget owner, char *name, Arg *args, int n)
Widget owner ;
char *name ;
Arg *args ;
int n ;
{ {
Widget listW ; Widget listW ;
@ -901,8 +877,7 @@ int n ;
* create selection window view * create selection window view
*/ */
void void
PopupSelectXLFD( top ) PopupSelectXLFD(Widget top)
Widget top ;
{ {
int n, i, j; int n, i, j;

View file

@ -132,10 +132,7 @@ GetXLFDInfomations()
int int
GetItemsToDisplay( num, itemcnt, xms_list ) GetItemsToDisplay( int num, int *itemcnt, XmString **xms_list )
int num ;
int *itemcnt ;
XmString **xms_list ;
{ {
int i, j, cnt ; int i, j, cnt ;
char *sp ,string[256], buf[256] ; char *sp ,string[256], buf[256] ;
@ -252,9 +249,7 @@ XmString **xms_list ;
static char* static char*
skipSpace( str, skipcnt ) skipSpace( char *str, int skipcnt )
char *str ;
int skipcnt ;
{ {
int i, spacecnt ; int i, spacecnt ;
char *sp ; char *sp ;
@ -276,9 +271,7 @@ int skipcnt ;
int int
SetKeyBuff( num, str ) SetKeyBuff( int num, char *str )
int num ;
char *str ;
{ {
int i, j ; int i, j ;
int cdset, start, end ; int cdset, start, end ;

View file

@ -9,10 +9,9 @@
UDC_INC_PATH1 = -I./ UDC_INC_PATH1 = -I./
UDC_INC_PATH2 = -I./include UDC_INC_PATH2 = -I./include
UDC_INC_PATH3 = -I./libfal UDC_INC_PATH3 = -I./libfal
UDC_INC_PATH4 = -I./libfal/include
UDC_INC_PATH5 = -I$(DTSVCSRC)/DtXpm UDC_INC_PATH4 = -I$(DTSVCSRC)/DtXpm
UDC_INC_PATH6 = -I$(TOP)/../x11/xc UDC_INC_PATH5 = -I$(TOP)/../x11/xc
#ifdef X11ProjectRoot #ifdef X11ProjectRoot
OPT2 = -DFONTC='"'$(XPROJECTROOT)/bin/bdftopcf'"' OPT2 = -DFONTC='"'$(XPROJECTROOT)/bin/bdftopcf'"'
@ -22,12 +21,11 @@ UDC_INC_PATH6 = -I$(TOP)/../x11/xc
DEFINES = $(OPT2) DEFINES = $(OPT2)
INCLUDES = $(UDC_INC_PATH1)\ INCLUDES = $(UDC_INC_PATH1)\
$(UDC_INC_PATH2)\ $(UDC_INC_PATH2)\
$(UDC_INC_PATH3)\ $(UDC_INC_PATH3)\
$(UDC_INC_PATH4)\ $(UDC_INC_PATH4)\
$(UDC_INC_PATH5)\ $(UDC_INC_PATH5)
$(UDC_INC_PATH6)
DEPLIBS = $(DEPDTSVCLIB) $(DEPTTLIB) $(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB) DEPLIBS = $(DEPDTSVCLIB) $(DEPTTLIB) $(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB)
LOCAL_LIBRARIES = $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTOOLLIB) $(XLIB) ./libfuty/liboakfuty.a ./libfal/libfal.a LOCAL_LIBRARIES = $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTOOLLIB) $(XLIB) ./libfuty/liboakfuty.a ./libfal/libfal.a
@ -50,7 +48,7 @@ SYS_LIBRARIES = DtClientSysLibs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
SUBDIRS = \ SUBDIRS = \
libfal \ libfal \
libfuty \ libfuty \
dtaddcpf \ dtaddcpf \
dtbdftocpf \ dtbdftocpf \

View file

@ -68,7 +68,7 @@ extern int CodePoint;
extern Resource resource; extern Resource resource;
static void static void
OpenFont() OpenFont(void)
{ {
int mask; int mask;
FalFontData font_data; FalFontData font_data;
@ -90,7 +90,7 @@ OpenFont()
} }
static void static void
CloseFont() CloseFont(void)
{ {
if (fid != font_id) { if (fid != font_id) {
FalCloseFont(fid); FalCloseFont(fid);
@ -99,9 +99,7 @@ CloseFont()
} }
static void static void
DrawCode(w, low_code) DrawCode(Widget w, int low_code)
Widget w;
int low_code;
{ {
int hi_code; int hi_code;
char *f = NULL; char *f = NULL;
@ -193,20 +191,14 @@ SetPixmap(start_code)
} }
static void static void
Code1Call(w, start_code, data) Code1Call(Widget w, int start_code, XmListCallbackStruct *data)
Widget w;
int start_code;
XmListCallbackStruct *data;
{ {
code1 = start_code + data->item_position -1; code1 = start_code + data->item_position -1;
SetPixmap(code1); SetPixmap(code1);
} }
static void static void
Code2Call(w, code2, data) Code2Call(Widget w, int code2, XmPushButtonCallbackStruct *data)
Widget w;
int code2;
XmPushButtonCallbackStruct *data;
{ {
char asc[16]; char asc[16];
sprintf(asc, "%2.2X%2.2X", code1, code2); sprintf(asc, "%2.2X%2.2X", code1, code2);
@ -215,8 +207,7 @@ XmPushButtonCallbackStruct *data;
} }
static void static void
PrevPage(w, scroll) PrevPage(Widget w, Widget scroll)
Widget w, scroll;
{ {
int *list; int *list;
int num; int num;
@ -229,8 +220,7 @@ Widget w, scroll;
} }
static void static void
NextPage(w, scroll) NextPage(Widget w, Widget scroll)
Widget w, scroll;
{ {
int *list; int *list;
int num, item; int num, item;
@ -244,13 +234,13 @@ Widget w, scroll;
} }
static void static void
Cancel() Cancel(void)
{ {
XtUnmapWidget(XtParent(code_w)); XtUnmapWidget(XtParent(code_w));
} }
static void static void
Apply() Apply(void)
{ {
char *asc; char *asc;
XtVaGetValues(text, XmNvalue, &asc, NULL); XtVaGetValues(text, XmNvalue, &asc, NULL);
@ -260,10 +250,7 @@ Apply()
} }
static void static void
CreateItem(item, item_count, start_code) CreateItem(XmString *item, int *item_count, int *start_code)
XmString *item;
int *item_count;
int *start_code;
{ {
int count; int count;
int start, end; int start, end;
@ -307,8 +294,7 @@ int *start_code;
} }
static Widget static Widget
CreateCodeWindow(w) CreateCodeWindow(Widget w)
Widget w;
{ {
Widget top, base1, base2, base3, base4; Widget top, base1, base2, base3, base4;
Widget frame, scroll, label, sep, form; Widget frame, scroll, label, sep, form;
@ -457,10 +443,7 @@ Widget w;
} }
void void
CodeWindow(widget, font_name, load_font) CodeWindow(Widget widget, char *font_name, Boolean load_font)
Widget widget;
char * font_name;
Boolean load_font;
{ {
static Boolean old_load_font; static Boolean old_load_font;
extern int CodePoint; extern int CodePoint;

View file

@ -31,6 +31,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <signal.h> #include <signal.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
@ -42,9 +43,9 @@
#include "falfont.h" #include "falfont.h"
#include "ufontrsrc.h" #include "ufontrsrc.h"
static void writePtn(); static void writePtn(char *ptn, int width, int height, FILE *fp);
static void sig_receive(); static void sig_receive(void);
char *get_cmd_path() ; char *get_cmd_path(char *path, char *cmd) ;
extern Resource resource; extern Resource resource;
@ -61,9 +62,9 @@ typedef struct { /* area to manage character patterns */
int nptn; /* number of characters in editting */ int nptn; /* number of characters in editting */
int nmaxptn; /* maximum number of characters in editting */ int nmaxptn; /* maximum number of characters in editting */
int ptnsize; /* size per byte of single pattern */ int ptnsize; /* size per byte of single pattern */
UINT ptnmemsize; /* size of memory of whole patterns */ unsigned int ptnmemsize; /* size of memory of whole patterns */
USHORT *ntoc; /* character list / relative code */ unsigned short *ntoc; /* character list / relative code */
USHORT *ctop; /* relative code / bitmap area */ unsigned short *ctop; /* relative code / bitmap area */
char *ptn; /* pointer to the bimap area */ char *ptn; /* pointer to the bimap area */
int cptnnum; /* current pattern number */ int cptnnum; /* current pattern number */
} PATTERN_MNG; } PATTERN_MNG;
@ -86,7 +87,7 @@ char AreaStr[160];
FalFontID font_id; FalFontID font_id;
static char * static char *
get_locale() get_locale(void)
{ {
char *loc; char *loc;
@ -104,8 +105,7 @@ get_locale()
*/ */
int int
ptnSqToNo( num ) ptnSqToNo( int num /*sequential number */)
int num; /* sequential number */
{ {
if( (pm.flag == 0) || (num >= pm.nptn) ) if( (pm.flag == 0) || (num >= pm.nptn) )
return( -1 ); return( -1 );
@ -123,8 +123,7 @@ int num; /* sequential number */
*/ */
int int
ptnNoToSq( ncode ) ptnNoToSq( int ncode /* relative code */)
int ncode; /* relative code */
{ {
int sq; int sq;
@ -149,8 +148,7 @@ int ncode; /* relative code */
*/ */
int int
codeToNo( code ) codeToNo( int code /* character code */)
int code; /* character code */
{ {
return( code - begin_code); return( code - begin_code);
} }
@ -165,8 +163,7 @@ int code; /* character code */
*/ */
int int
noToCode( sno ) noToCode( int sno /* relative code */)
int sno; /* relative code */
{ {
return( sno + begin_code); return( sno + begin_code);
} }
@ -179,8 +176,7 @@ int sno; /* relative code */
*/ */
int int
codeCheck( code ) codeCheck( int code )
int code;
{ {
if (code < begin_code || code > last_code) { if (code < begin_code || code > last_code) {
return( -1 ); return( -1 );
@ -196,11 +192,12 @@ int code;
*/ */
static int static int
ptnOpen(n, maxc, width, height) ptnOpen(
int n; /* initial number of charcters */ int n, /* initial number of charcters */
int maxc; int maxc,
int width; /* pattern width */ int width, /* pattern width */
int height; /* pattern height */ int height /* pattern height */
)
{ {
int i; int i;
int fpsize; int fpsize;
@ -218,12 +215,12 @@ int height; /* pattern height */
pm.nmaxptn = n + GUADDPTNN; pm.nmaxptn = n + GUADDPTNN;
pm.ptnsize = height * ((width+7)/8); pm.ptnsize = height * ((width+7)/8);
fpsize = pm.ptnsize + 1; fpsize = pm.ptnsize + 1;
pm.ptnmemsize = (UINT) ( fpsize * pm.nmaxptn ) ; pm.ptnmemsize = (unsigned int) ( fpsize * pm.nmaxptn ) ;
if(( pm.ntoc = (USHORT *)calloc(maxc, sizeof(USHORT)) ) == NULL) { if(( pm.ntoc = (unsigned short *)calloc(maxc, sizeof(unsigned short)) ) == NULL) {
return( -1 ); return( -1 );
} }
if(( pm.ctop = (USHORT *)calloc(maxc, sizeof(USHORT)) ) == NULL ) { if(( pm.ctop = (unsigned short *)calloc(maxc, sizeof(unsigned short)) ) == NULL ) {
free( pm.ntoc ); free( pm.ntoc );
return( -1 ); return( -1 );
} }
@ -257,7 +254,7 @@ int height; /* pattern height */
*/ */
int int
ptnClose() ptnClose(void)
{ {
if( pm.flag == 0 ) { if( pm.flag == 0 ) {
return( -1 ); return( -1 );
@ -282,18 +279,18 @@ ptnClose()
*/ */
int int
ptnAdd( code, ptn ) ptnAdd(
int code; /* code to be add */ int code, /* code to be add */
char *ptn; /* pointer to the pattern */ char *ptn) /* pointer to the pattern */
{ {
int fpsize; int fpsize;
int ncode; int ncode;
USHORT pno; unsigned short pno;
char *pf; char *pf;
char *pp; char *pp;
int i; int i;
char *re_ptn; char *re_ptn;
UINT re_ptnmemsize; unsigned int re_ptnmemsize;
int cpn; int cpn;
if( pm.flag == 0 ) if( pm.flag == 0 )
@ -339,7 +336,7 @@ char *ptn; /* pointer to the pattern */
} }
pm.cptnnum = cpn; pm.cptnnum = cpn;
pm.ctop[ncode] = (USHORT) cpn; pm.ctop[ncode] = (unsigned short) cpn;
pf = pm.ptn + fpsize*cpn; pf = pm.ptn + fpsize*cpn;
pp = pf + 1; pp = pf + 1;
pf[0] = 1; pf[0] = 1;
@ -352,7 +349,7 @@ char *ptn; /* pointer to the pattern */
} }
pm.ntoc[i+1] = pm.ntoc[i]; pm.ntoc[i+1] = pm.ntoc[i];
} }
pm.ntoc[i+1] = (USHORT) ncode; pm.ntoc[i+1] = (unsigned short) ncode;
pm.nptn += 1; pm.nptn += 1;
return( 1 ); return( 1 );
@ -366,13 +363,11 @@ char *ptn; /* pointer to the pattern */
*/ */
int int
ptnGet( code, ptn ) ptnGet( int code, char *ptn )
int code;
char *ptn;
{ {
int ncode; int ncode;
int fpsize; int fpsize;
USHORT pno; unsigned short pno;
char *pf; char *pf;
char *pp; char *pp;
int i; int i;
@ -404,8 +399,7 @@ char *ptn;
*/ */
int int
ptnSense( code ) ptnSense( int code )
int code;
{ {
if( (pm.flag == 0) || (codeCheck(code) == -1) ) if( (pm.flag == 0) || (codeCheck(code) == -1) )
return( -1 ); return( -1 );
@ -425,12 +419,11 @@ int code;
*/ */
int int
ptnDel( code ) ptnDel( int code )
int code;
{ {
int ncode; int ncode;
int fpsize; int fpsize;
USHORT pno; unsigned short pno;
char *pf; char *pf;
int i; int i;
@ -468,10 +461,10 @@ int code;
*/ */
int int
ptnGetInfo( n, width, height ) ptnGetInfo(
int *n; /* the number of characters in editting */ int *n, /* the number of characters in editting */
int *width; /* pattern width */ int *width, /* pattern width */
int *height; /* pattern height */ int *height) /* pattern height */
{ {
if( pm.flag == 0 ) if( pm.flag == 0 )
return( -1 ); return( -1 );
@ -500,9 +493,9 @@ struct { /* infomation of character pattern */
*/ */
static void static void
bitSetInfo( width, height) bitSetInfo(
int width; /* pattern width */ int width, /* pattern width */
int height; /* pattern height */ int height) /* pattern height */
{ {
bitInfo.width = width; bitInfo.width = width;
bitInfo.height = height; bitInfo.height = height;
@ -517,10 +510,7 @@ int height; /* pattern height */
*/ */
void void
bitSet( ptn, cx, cy ) bitSet( char *ptn, int cx, int cy )
char *ptn;
int cx;
int cy;
{ {
if((cx < 0) || (bitInfo.width <= cx) || (cy < 0) || (bitInfo.height <= cy)) if((cx < 0) || (bitInfo.width <= cx) || (cy < 0) || (bitInfo.height <= cy))
return; return;
@ -533,10 +523,7 @@ int cy;
*/ */
void void
bitReset( ptn, cx, cy ) bitReset( char *ptn, int cx, int cy )
char *ptn;
int cx;
int cy;
{ {
if((cx < 0) || (bitInfo.width <= cx) || (cy < 0) || (bitInfo.height <= cy)) if((cx < 0) || (bitInfo.width <= cx) || (cy < 0) || (bitInfo.height <= cy))
return; return;
@ -549,10 +536,7 @@ int cy;
*/ */
int int
bitRead( ptn, cx, cy ) bitRead( char *ptn, int cx, int cy )
char *ptn;
int cx;
int cy;
{ {
if((cx < 0) || (bitInfo.width <= cx) || (cy < 0) || (bitInfo.height <= cy)) if((cx < 0) || (bitInfo.width <= cx) || (cy < 0) || (bitInfo.height <= cy))
return( 0 ); return( 0 );
@ -568,8 +552,7 @@ int cy;
*/ */
void void
bitPtnClear( ptn ) bitPtnClear( char *ptn )
char *ptn;
{ {
int i; int i;
@ -583,9 +566,9 @@ char *ptn;
*/ */
void void
bitPtnCopy( d_ptn, s_ptn ) bitPtnCopy(
char *d_ptn; /* pointer of the destination file */ char *d_ptn, /* pointer of the destination file */
char *s_ptn; /* pointer of the source file */ char *s_ptn) /* pointer of the source file */
{ {
int i; int i;
@ -608,13 +591,13 @@ char *s_ptn; /* pointer of the source file */
*/ */
int int
bitDrawLine( ptn, x1, y1, x2, y2 ,mode ) bitDrawLine(
char *ptn; /* pointer of the bit map file */ char *ptn, /* pointer of the bit map file */
int x1; int x1,
int y1; int y1,
int x2; int x2,
int y2; int y2,
int mode; /* 0: erase 1: draw */ int mode) /* 0: erase 1: draw */
{ {
float dx, dy; float dx, dy;
float x, y; float x, y;
@ -655,13 +638,13 @@ int mode; /* 0: erase 1: draw */
*/ */
int int
bitDrawCircle( ptn, x1, y1, x2, y2, mode ) bitDrawCircle(
char *ptn; char *ptn,
int x1; int x1,
int y1; int y1,
int x2; int x2,
int y2; int y2,
int mode; int mode)
{ {
int dx, dy; int dx, dy;
int i,x; int i,x;
@ -708,13 +691,13 @@ int mode;
*/ */
int int
bitDrawRect( ptn, x, y, width, height, mode ) bitDrawRect(
char *ptn; char *ptn,
int x; int x,
int y; int y,
int width; int width,
int height; int height,
int mode; int mode)
{ {
int i; int i;
@ -757,12 +740,12 @@ int mode;
*/ */
int int
bitDrawCls( ptn, x, y, width, height ) bitDrawCls(
char *ptn; char *ptn,
int x; int x,
int y; int y,
int width; int width,
int height; int height)
{ {
int i, j; int i, j;
@ -789,12 +772,12 @@ int height;
*/ */
int int
bitDrawSet( ptn, x, y, width, height ) bitDrawSet(
char *ptn; char *ptn,
int x; int x,
int y; int y,
int width; int width,
int height; int height)
{ {
int i, j; int i, j;
@ -820,12 +803,12 @@ int height;
*/ */
int int
bitDrawRev( ptn, x, y, width, height ) bitDrawRev(
char *ptn; char *ptn,
int x; int x,
int y; int y,
int width; int width,
int height; int height)
{ {
int i, j; int i, j;
@ -859,13 +842,13 @@ static int cut_buffer_h=0;
*/ */
int int
bitDrawCpy(ptn, sx, sy, width, height, cut_flag) bitDrawCpy(
char *ptn; char *ptn,
int sx; int sx,
int sy; int sy,
int width; int width,
int height; int height,
int cut_flag; int cut_flag)
{ {
int i, j; int i, j;
@ -890,10 +873,7 @@ int cut_flag;
} }
int int
bitDrawPaste(ptn, dx, dy) bitDrawPaste(char *ptn, int dx, int dy)
char *ptn;
int dx;
int dy;
{ {
int i, j; int i, j;
int width, height; int width, height;
@ -927,12 +907,7 @@ int dy;
*/ */
int int
bitDrawRoll( ptn, x, y, width, height ) bitDrawRoll(char *ptn, int x, int y, int width, int height)
char *ptn;
int x;
int y;
int width;
int height;
{ {
char *point; char *point;
int xx, yy; int xx, yy;
@ -970,12 +945,7 @@ int height;
*/ */
int int
bitDrawSymV( ptn, x, y, width, height ) bitDrawSymV( char *ptn, int x, int y, int width, int height )
char *ptn;
int x;
int y;
int width;
int height;
{ {
int k, j; int k, j;
int d1, d2; int d1, d2;
@ -1009,12 +979,7 @@ int height;
*/ */
int int
bitDrawSymH( ptn, x, y, width, height ) bitDrawSymH( char *ptn, int x, int y, int width, int height )
char *ptn;
int x;
int y;
int width;
int height;
{ {
int k, j; int k, j;
int d1, d2; int d1, d2;
@ -1070,11 +1035,7 @@ char_set(char *str)
* -2 : file is locked * -2 : file is locked
*/ */
int int
readSNF(fdata, width, height, err) readSNF(FalFontData **fdata, int *width, int *height, char *err)
FalFontData **fdata;
int *width;
int *height;
char *err;
{ {
FalFontinfo finfo; FalFontinfo finfo;
int start, end; int start, end;
@ -1300,22 +1261,15 @@ char *err;
} }
static void static void
bicopy(s1, s2, size) bicopy(char *s1, char *s2, int size)
char *s1, *s2;
int size;
{ {
register int i; int i;
for(i=size; i; i--, s1++, s2++) for(i=size; i; i--, s1++, s2++)
*s2 = *s1; *s2 = *s1;
} }
int int
copySNF(start, end, ptn, num, err) copySNF(int start, int end, char ***ptn, int *num, char *err)
int start;
int end;
char ***ptn;
int *num;
char *err;
{ {
FalFontID fid; FalFontID fid;
int mask; int mask;
@ -1395,9 +1349,7 @@ char *err;
} }
void void
freeSNF(addr, count) freeSNF(char **addr, int count)
char **addr;
int count;
{ {
char **p; char **p;
for (p=addr; count; count--, p++) for (p=addr; count; count--, p++)
@ -1417,9 +1369,9 @@ static int sig_flg = 0; /* flag for signal */
*/ */
int int
writeSNF( restart, err ) writeSNF(
int restart; /* ON:continue OFF:initial */ int restart, /* ON:continue OFF:initial */
int *err; /* errors : */ int *err) /* errors : */
{ {
static int pfstdi[2]; static int pfstdi[2];
static FILE *fstdi; static FILE *fstdi;
@ -1481,19 +1433,22 @@ int *err; /* errors : */
case 0: case 0:
close( 0 ); /** 0 ... stdin **/ close( 0 ); /** 0 ... stdin **/
dup( pfstdi[0] ); if( dup( pfstdi[0] ) == -1){
close( pfstdi[0] ); return -1;
close( pfstdi[1] ); } else {
argv[0] = resource.l_ptog_cmd; close( pfstdi[0] );
argv[1] = "-codeset"; close( pfstdi[1] );
argv[2] = code_set; argv[0] = resource.l_ptog_cmd;
argv[3] = "-xlfd"; argv[1] = "-codeset";
argv[4] = fullFontData.xlfdname; argv[2] = code_set;
argv[5] = "-init"; argv[3] = "-xlfd";
argv[6] = "-f"; argv[4] = fullFontData.xlfdname;
argv[7] = NULL; argv[5] = "-init";
execv (command, argv ); argv[6] = "-f";
exit( 103 ); argv[7] = NULL;
execv (command, argv );
exit( 103 );
}
} }
@ -1567,7 +1522,7 @@ int *err; /* errors : */
*/ */
static void static void
sig_receive() sig_receive(void)
{ {
sig_flg = 1; sig_flg = 1;
return; return;
@ -1579,11 +1534,7 @@ sig_receive()
*/ */
static void static void
writePtn(ptn, width, height, fp) writePtn(char *ptn, int width, int height, FILE *fp)
char *ptn;
int width;
int height;
FILE *fp;
{ {
int i, j, k; int i, j, k;
int nbyte; int nbyte;

View file

@ -47,10 +47,10 @@ extern Widget cpyDialog;
** ================================================================== ** ==================================================================
**/ **/
void PopdownCpyPtn(); void PopdownCpyPtn(void);
void DoCpyProc(); void DoCpyProc(void);
void CpyPtnCB(); void CpyPtnCB(void);
void CpyCB(); void CpyCB(Widget w, XtPointer cdata);
/* static */ TextField SrcTf; /* static */ TextField SrcTf;
/* static */ TextField DestTf; /* static */ TextField DestTf;
@ -64,7 +64,7 @@ void CpyCB();
**/ **/
void void
InitCpyPtn() InitCpyPtn(void)
{ {
/* initialize font infomation */ /* initialize font infomation */
} }
@ -77,7 +77,7 @@ InitCpyPtn()
**/ **/
void void
CpyPtnCB() CpyPtnCB(void)
{ {
extern void CpyPtnXLFD(); extern void CpyPtnXLFD();
CpyPtnXLFD(); CpyPtnXLFD();
@ -90,7 +90,7 @@ CpyPtnCB()
**/ **/
void void
PopdownCpyPtn() PopdownCpyPtn(void)
{ {
ForcePopdownDialog(cpyDialog); ForcePopdownDialog(cpyDialog);
} }
@ -102,7 +102,7 @@ PopdownCpyPtn()
**/ **/
String String
CpySrcCodeTfValue() CpySrcCodeTfValue(void)
{ {
return(GetTextFieldValue(&SrcTf)); return(GetTextFieldValue(&SrcTf));
} }
@ -114,7 +114,7 @@ CpySrcCodeTfValue()
**/ **/
String String
CpyDestCodeTfValue() CpyDestCodeTfValue(void)
{ {
return(GetTextFieldValue(&DestTf)); return(GetTextFieldValue(&DestTf));
} }
@ -126,8 +126,7 @@ CpyDestCodeTfValue()
**/ **/
void void
PopupCpyNotice( message ) PopupCpyNotice( String message )
String message;
{ {
char bmsg[512] = ""; char bmsg[512] = "";
@ -152,9 +151,7 @@ String message;
/*ARGSUSED*/ /*ARGSUSED*/
void void
CpyCB(w, cdata) CpyCB(Widget w, XtPointer cdata)
Widget w;
XtPointer cdata;
{ {
extern Boolean BeforeCpyCheck(); extern Boolean BeforeCpyCheck();
if (BeforeCpyCheck(cdata)){ if (BeforeCpyCheck(cdata)){
@ -176,7 +173,7 @@ XtPointer cdata;
**/ **/
static void static void
PopdownMngPtn() PopdownMngPtn(void)
{ {
PopdownDialog(mngPtnW); PopdownDialog(mngPtnW);
} }
@ -187,7 +184,7 @@ PopdownMngPtn()
**/ **/
static void static void
AddCB() AddCB(void)
{ {
int s_code, e_code; int s_code, e_code;
extern Boolean BeforeMngCheck(); extern Boolean BeforeMngCheck();
@ -205,7 +202,7 @@ AddCB()
**/ **/
static void static void
DelCB() DelCB(void)
{ {
int s_code, e_code; int s_code, e_code;
extern void DoDelProc(); extern void DoDelProc();
@ -231,7 +228,7 @@ static TextField MngCodeTf;
**/ **/
void void
MngPtnCB() MngPtnCB(void)
{ {
if (! mngPtnW){ if (! mngPtnW){
Widget rowcol; Widget rowcol;
@ -254,12 +251,13 @@ MngPtnCB()
/** /**
** contents : get the character strings of code for add or delete from the input field ** contents : get the character strings of code for add or delete from the
** input field
** -------------------------------------------- ** --------------------------------------------
**/ **/
String String
MngCodeTfValue() MngCodeTfValue(void)
{ {
return(GetTextFieldValue(&MngCodeTf)); return(GetTextFieldValue(&MngCodeTf));
} }
@ -286,8 +284,7 @@ static Widget dnStaT_code[D_MAX], dnBulB_disp[D_MAX], dnPopW;
**/ **/
void void
PopupDelNotice( owner ) PopupDelNotice( Widget owner )
Widget owner;
{ {
int i; int i;
Widget delNoticeW = NULL; Widget delNoticeW = NULL;
@ -315,7 +312,7 @@ Widget owner;
**/ **/
static void static void
dstrypaneDelNotice() dstrypaneDelNotice(void)
{ {
int i; int i;
@ -331,7 +328,7 @@ dstrypaneDelNotice()
**/ **/
static void static void
DelOkCB() DelOkCB(void)
{ {
CBdnOblB_del(); CBdnOblB_del();
PopdownMngPtn(); PopdownMngPtn();
@ -344,8 +341,7 @@ DelOkCB()
**/ **/
static void static void
delScProc( value ) delScProc( int value )
int value;
{ {
int i; int i;
extern int RelToAbsSq(); extern int RelToAbsSq();
@ -364,8 +360,7 @@ int value;
**/ **/
static Widget static Widget
CreateDelNotice(owner) CreateDelNotice(Widget owner)
Widget owner;
{ {
Widget form, listBase, itemform[D_MAX]; Widget form, listBase, itemform[D_MAX];
char buf[64]; char buf[64];
@ -441,7 +436,7 @@ Widget owner;
**/ **/
static void static void
CBdnOblB_del() CBdnOblB_del(void)
{ {
int code; /* code number for check */ int code; /* code number for check */
int ncode; /* sequential number in the codeset system area */ int ncode; /* sequential number in the codeset system area */
@ -515,8 +510,7 @@ CBdnOblB_del()
**/ **/
static void static void
drawDelPtn( i ) drawDelPtn( int i /* window number */)
int i; /* window number */
{ {
if ( RelToAbsSq( dn.sq_top, i) <= dn.sq_end) { if ( RelToAbsSq( dn.sq_top, i) <= dn.sq_end) {
ptnGet( noToCode(ptnSqToNo(RelToAbsSq( dn.sq_top, i))), ptnGet( noToCode(ptnSqToNo(RelToAbsSq( dn.sq_top, i))),
@ -536,8 +530,7 @@ int i; /* window number */
**/ **/
static void static void
drawDelCode( i ) drawDelCode( int i /* window number */)
int i; /* window number */
{ {
char str[20]; char str[20];
@ -557,9 +550,7 @@ int i; /* window number */
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
EHdnBulB_disp( widget, i ) EHdnBulB_disp( Widget widget, int i /* widget that have some ivent */ )
Widget widget;
int i; /* widget that have some ivent */
{ {
drawDelPtn( i ); drawDelPtn( i );
} }
@ -578,10 +569,7 @@ int i; /* widget that have some ivent */
**/ **/
static void static void
DispErrorMessage( owner, title, msg ) DispErrorMessage( Widget owner, String title, String msg )
Widget owner;
String title;
String msg;
{ {
static NoticeButton buttons[] = { static NoticeButton buttons[] = {
NBTNARGS( NULL, NULL, NULL, True, False ), NBTNARGS( NULL, NULL, NULL, True, False ),
@ -599,8 +587,7 @@ String msg;
**/ **/
void void
DispMngErrorMessage( msg ) DispMngErrorMessage( String msg )
String msg;
{ {
DispErrorMessage( mngPtnW, resource.l_error_title, msg ); DispErrorMessage( mngPtnW, resource.l_error_title, msg );
} }
@ -612,8 +599,7 @@ String msg;
**/ **/
void void
DispCpyErrorMessage( msg ) DispCpyErrorMessage( String msg )
String msg;
{ {
DispErrorMessage( cpyPtnW, resource.l_error_title, msg ); DispErrorMessage( cpyPtnW, resource.l_error_title, msg );
} }

View file

@ -62,20 +62,29 @@ extern XtPointer _XmStringUngenerate (XmString string,
#endif #endif
#include "pixmaps/arrow.pm" #include "pixmaps/arrow.pm"
static Widget CreateCopyXLFD() ; static Widget CreateCopyXLFD(Widget Top);
static void CpyXLFDCB() ; static void CpyXLFDCB(Widget w, caddr_t client_data, caddr_t *call_data);
extern int CreateOtherLabelAndText(); extern int CreateOtherLabelAndText(int num,
extern Widget xlfdCreateScrolledList(); Widget owner,
extern int GetItemsToDisplay(); Widget baseForm,
Widget *slctBLabel,
Widget topW,
Widget *slctBText,
Widget *slctButton);
extern Widget xlfdCreateScrolledList(Widget owner,
char *name,
Arg *args,
int n);
extern int GetItemsToDisplay(int num, int *itemcnt, XmString **xms_list);
extern void xlfdPopupDialog(); extern void xlfdPopupDialog(Widget w);
extern void InitCpyPtn() ; extern void InitCpyPtn(void);
extern void _unmap(); extern void _unmap(void);
extern void CpyCB() ; extern void CpyCB(Widget w, XtPointer cdata);
extern void PopdownCpyPtn() ; extern void PopdownCpyPtn(void);
extern void AddPopupProc() ; extern void AddPopupProc(Widget w, void(*popupcb)());
extern FalFontData fullFontData; extern FalFontData fullFontData;
@ -139,9 +148,7 @@ static Widget focus_widget=NULL;
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
CpyXLFDCB(w, client_data, call_data) CpyXLFDCB(Widget w, caddr_t client_data, caddr_t *call_data)
Widget w;
caddr_t client_data, *call_data;
{ {
char *str; char *str;
XmStringTable st; XmStringTable st;
@ -162,7 +169,7 @@ caddr_t client_data, *call_data;
void void
CpyPtnXLFD() CpyPtnXLFD(void)
{ {
if( cpyDialog == NULL ) if( cpyDialog == NULL )
{ {
@ -199,7 +206,7 @@ CpyPtnXLFD()
static void static void
create_xlfd() create_xlfd(void)
{ {
int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
FalFontData key; FalFontData key;
@ -239,8 +246,7 @@ create_xlfd()
} }
static void static void
udc_call(w) udc_call(Widget w)
Widget w;
{ {
XmString label; XmString label;
char *moji; char *moji;
@ -269,8 +275,7 @@ Widget w;
} }
static void static void
sty_call(w) sty_call(Widget w)
Widget w;
{ {
XmString label; XmString label;
char *moji; char *moji;
@ -294,8 +299,7 @@ Widget w;
} }
static void static void
wls_call(w) wls_call(Widget w)
Widget w;
{ {
XmString label; XmString label;
char *moji; char *moji;
@ -315,8 +319,7 @@ Widget w;
} }
static void static void
hls_call(w) hls_call(Widget w)
Widget w;
{ {
XmString label; XmString label;
char *moji; char *moji;
@ -336,7 +339,7 @@ Widget w;
} }
static void static void
button_set1() button_set1(void)
{ {
int i, j; int i, j;
int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
@ -385,7 +388,7 @@ button_set1()
} }
static void static void
button_set2() button_set2(void)
{ {
int i, j; int i, j;
int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
@ -434,7 +437,7 @@ button_set2()
} }
static void static void
button_set3() button_set3(void)
{ {
int i, j; int i, j;
int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
@ -483,7 +486,7 @@ button_set3()
} }
static void static void
button_set4() button_set4(void)
{ {
int i, j; int i, j;
int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
@ -533,7 +536,7 @@ button_set4()
static void static void
font_init() font_init(void)
{ {
FalFontDataList *fontlist; FalFontDataList *fontlist;
FalFontData *f; FalFontData *f;
@ -675,9 +678,7 @@ font_init()
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
arrow_change(w, wid) arrow_change(Widget w, Widget wid)
Widget w;
Widget wid;
{ {
if (XtIsSensitive(wid)) { if (XtIsSensitive(wid)) {
XtSetSensitive(wid, False); XtSetSensitive(wid, False);
@ -687,14 +688,13 @@ Widget wid;
} }
static void static void
focus(w) focus(Widget w)
Widget w;
{ {
focus_widget = w; focus_widget = w;
} }
static void static void
code_input() code_input(void)
{ {
char *str; char *str;
XmStringTable st; XmStringTable st;
@ -708,15 +708,14 @@ code_input()
} }
static void static void
code_input2() code_input2(void)
{ {
extern void CodeWindow(); extern void CodeWindow();
CodeWindow(codeText[2], fullFontData.xlfdname, False); CodeWindow(codeText[2], fullFontData.xlfdname, False);
} }
static Widget static Widget
CreateCopyXLFD( top ) CreateCopyXLFD( Widget top )
Widget top ;
{ {
int n; int n;

View file

@ -52,7 +52,7 @@
#include <X11/Xmd.h> #include <X11/Xmd.h>
#include <X11/Xproto.h> #include <X11/Xproto.h>
#include "fontstruct.h" #include <X11/fonts/fontstruct.h>
#include "FaLib.h" #include "FaLib.h"
#include "snfstruct.h" #include "snfstruct.h"
@ -61,20 +61,65 @@
#include <errno.h> #include <errno.h>
static int rw_init() ; static int rw_init(struct ptobhead *r_gpf,
static int readSnf() ; struct btophead *r_snf,
static int readSnf_with_init() ; struct ptobhead *w_snf,
static int readSnfHeader() ; int init_all);
static int readBdfHeaderAndPut() ; static int readSnf(struct ptobhead *r_gpf,
static int mergePtn() ; struct btophead *r_snf,
static int ModifyPtn() ; struct ptobhead *w_snf,
static int InsertPtn() ; char *buf);
static int writeSnf() ; static int readSnf_with_init(struct ptobhead *r_gpf,
static void put_error_and_exit(); struct btophead *r_snf,
static void put_help(); struct ptobhead *w_snf,
static int readBdfToMemory_with_init() ; int init,
char *buf,
int num_gr,
FalGlyphRegion *gr);
static int readSnfHeader(struct ptobhead *r_gpf,
struct btophead *r_snf,
struct ptobhead *w_snf,
char *buf) ;
static int readBdfHeaderAndPut(struct btophead *r_snf,
struct ptobhead *w_snf,
char *buf) ;
static int mergePtn(char *com,
struct ptobhead *r_gpf,
struct btophead *r_snf,
char *buf,
int code_area,
int modify,
char *prog_name,
int num_gr,
FalGlyphRegion *gr,
int code_no) ;
static int ModifyPtn(struct ptobhead *r_gpf,
struct btophead *r_snf,
char *buf,
int ix);
static int InsertPtn(struct ptobhead *r_gpf,
struct btophead *r_snf,
char *buf,
int code,
int ix);
static int writeSnf(struct btophead *r_snf, struct ptobhead *w_snf) ;
static void put_error_and_exit(struct ptobhead *ptob_in,
struct btophead *btop,
struct ptobhead *ptob_out,
int er_no,
char *prog_name);
static void put_help(char *prog_name);
static int readBdfToMemory_with_init(struct btophead *head,
int init,
char *buf,
int num_gr,
FalGlyphRegion *gr);
extern int fal_glyph_to_code() ; extern int fal_glyph_to_code(char *locale,
char *charset_str,
int codeset,
unsigned long glyph_index,
unsigned long *codepoint);
static struct ptobhead WriteSnf; static struct ptobhead WriteSnf;
@ -86,14 +131,15 @@ static char *util_locale ;
static pid_t gtob_pid = 0; static pid_t gtob_pid = 0;
static pid_t btop_pid = 0; static pid_t btop_pid = 0;
#if defined( SVR4 ) || defined( SYSV ) || defined(CSRG_BASED) || defined(__linux__) #if defined( SVR4 ) || defined( SYSV ) || defined(CSRG_BASED) || \
defined(__linux__)
static int chld_stat ; static int chld_stat ;
#else #else
static union wait chld_stat ; static union wait chld_stat ;
#endif #endif
static void static void
sigint_out() sigint_out(void)
{ {
if (WriteSnf.out_file) { if (WriteSnf.out_file) {
Unlink_Tmpfile( WriteSnf.out_file, com ); Unlink_Tmpfile( WriteSnf.out_file, com );
@ -101,9 +147,7 @@ sigint_out()
exit( 0 ); exit( 0 );
} }
main( argc, argv ) int main(int argc, char *argv[])
int argc;
char *argv[];
{ {
int code_area , init, modify, help, no_infile, no_style; int code_area , init, modify, help, no_infile, no_style;
int fupd = 0 ; int fupd = 0 ;
@ -433,11 +477,11 @@ char *argv[];
} }
static static
rw_init(r_gpf, r_snf, w_snf, init_all ) rw_init(
struct ptobhead *r_gpf; struct ptobhead *r_gpf,
struct btophead *r_snf; struct btophead *r_snf,
struct ptobhead *w_snf; struct ptobhead *w_snf,
int init_all; int init_all)
{ {
FontInfoRec *finf; FontInfoRec *finf;
int fd[2], snf_fd, permission; int fd[2], snf_fd, permission;
@ -458,13 +502,7 @@ int init_all;
/* SNF format */ /* SNF format */
if ( ChkPcfFontFile( w_snf->snf_file ) ) { if ( ChkPcfFontFile( w_snf->snf_file ) ) {
permission = 0 ;
if( (snf_fd = open( w_snf->snf_file, O_RDONLY ) ) >= 0 ) { if( (snf_fd = open( w_snf->snf_file, O_RDONLY ) ) >= 0 ) {
COMM_SNF_FILEVERSION( snf_fd, finf, buf, permission ) ;
if ( permission < 0 ) {
return BDF_INVAL;
}
} else {
return BDF_OPEN_IN; return BDF_OPEN_IN;
} }
} }
@ -554,11 +592,11 @@ int init_all;
static static
readSnf(r_gpf, r_snf, w_snf, buf) readSnf(
struct ptobhead *r_gpf; struct ptobhead *r_gpf,
struct btophead *r_snf; struct btophead *r_snf,
struct ptobhead *w_snf; struct ptobhead *w_snf,
char *buf; char *buf)
{ {
int nchar, rtn; int nchar, rtn;
@ -580,14 +618,14 @@ char *buf;
} }
static static
readSnf_with_init(r_gpf, r_snf, w_snf, init, buf, num_gr, gr ) readSnf_with_init(
struct ptobhead *r_gpf; struct ptobhead *r_gpf,
struct btophead *r_snf; struct btophead *r_snf,
struct ptobhead *w_snf; struct ptobhead *w_snf,
int init; int init,
char *buf; char *buf,
int num_gr ; int num_gr,
FalGlyphRegion *gr ; FalGlyphRegion *gr)
{ {
int nchar, rtn; int nchar, rtn;
@ -611,11 +649,11 @@ FalGlyphRegion *gr ;
static static
readSnfHeader(r_gpf, r_snf, w_snf, buf) readSnfHeader(
struct ptobhead *r_gpf; struct ptobhead *r_gpf,
struct btophead *r_snf; struct btophead *r_snf,
struct ptobhead *w_snf; struct ptobhead *w_snf,
char *buf; char *buf)
{ {
int rtn; int rtn;
@ -635,10 +673,7 @@ char *buf;
} }
static static
readBdfHeaderAndPut(r_snf, w_snf, buf) readBdfHeaderAndPut(struct btophead *r_snf, struct ptobhead *w_snf, char *buf)
struct btophead *r_snf;
struct ptobhead *w_snf;
char *buf;
{ {
char *p; char *p;
int getstat = 0; int getstat = 0;
@ -695,17 +730,17 @@ char *buf;
} }
static static
mergePtn(com, r_gpf, r_snf, buf, code_area, modify, prog_name, num_gr, gr, code_no) mergePtn(
char *com ; char *com,
struct ptobhead *r_gpf; struct ptobhead *r_gpf,
struct btophead *r_snf; struct btophead *r_snf,
char *buf; char *buf,
int code_area; int code_area,
int modify; int modify,
char *prog_name; char *prog_name,
int num_gr ; int num_gr,
FalGlyphRegion *gr ; FalGlyphRegion *gr,
int code_no ; int code_no)
{ {
int code, rtn, msize, i, j, dspcode; int code, rtn, msize, i, j, dspcode;
char *ptn; char *ptn;
@ -744,8 +779,11 @@ int code_no ;
) { ) {
DispCodePoint( com, char_set, code, dspcode, code_no, util_locale ) ; DispCodePoint( com, char_set, code, dspcode, code_no, util_locale ) ;
USAGE2("%s : The font of a specified code cannot be added/changed \"0x%x\".\n", prog_name, dspcode ); USAGE2("%s : The font of a specified code cannot be added/changed \"0x%x\".\n", prog_name, dspcode );
fgets(buf, BUFSIZE, r_gpf->input); if( fgets(buf, BUFSIZE, r_gpf->input) == NULL){
continue; return -1;
} else {
continue;
}
} }
for ( j = 0; j < r_snf->num_chars; j++ ) { for ( j = 0; j < r_snf->num_chars; j++ ) {
@ -753,8 +791,11 @@ int code_no ;
if ( !modify ) { if ( !modify ) {
DispCodePoint( com, char_set, code, dspcode, code_no, util_locale ) ; DispCodePoint( com, char_set, code, dspcode, code_no, util_locale ) ;
USAGE2("%s : The font has already been registered in a specified code. \"0x%x\"\n", prog_name, dspcode ); USAGE2("%s : The font has already been registered in a specified code. \"0x%x\"\n", prog_name, dspcode );
fgets( buf, BUFSIZE, r_gpf->input ); if(fgets( buf, BUFSIZE, r_gpf->input ) == NULL){
break; return -1;
} else {
break;
}
} }
if ( ( rtn = ModifyPtn( r_gpf, r_snf, buf, j ) ) ) { if ( ( rtn = ModifyPtn( r_gpf, r_snf, buf, j ) ) ) {
return rtn; return rtn;
@ -778,11 +819,11 @@ int code_no ;
static static
ModifyPtn( r_gpf, r_snf, buf, ix ) ModifyPtn(
struct ptobhead *r_gpf; struct ptobhead *r_gpf,
struct btophead *r_snf; struct btophead *r_snf,
char *buf; char *buf,
int ix; int ix)
{ {
int mwidth, msize, rtn; int mwidth, msize, rtn;
@ -807,12 +848,12 @@ int ix;
} }
static static
InsertPtn( r_gpf, r_snf, buf, code, ix ) InsertPtn(
struct ptobhead *r_gpf; struct ptobhead *r_gpf,
struct btophead *r_snf; struct btophead *r_snf,
char *buf; char *buf,
int code; int code,
int ix; int ix)
{ {
int mwidth, msize, rtn, i; int mwidth, msize, rtn, i;
@ -851,9 +892,7 @@ int ix;
} }
static static
writeSnf( r_snf, w_snf ) writeSnf(struct btophead *r_snf, struct ptobhead *w_snf)
struct btophead *r_snf;
struct ptobhead *w_snf;
{ {
w_snf->zoomf = 0; w_snf->zoomf = 0;
w_snf->num_chars = r_snf->num_chars; w_snf->num_chars = r_snf->num_chars;
@ -874,12 +913,12 @@ struct ptobhead *w_snf;
static void static void
put_error_and_exit(ptob_in, btop, ptob_out, er_no, prog_name) put_error_and_exit(
struct ptobhead *ptob_in; struct ptobhead *ptob_in,
struct btophead *btop; struct btophead *btop,
struct ptobhead *ptob_out; struct ptobhead *ptob_out,
int er_no; int er_no,
char *prog_name; char *prog_name)
{ {
ErrMsgTable_AndExit( er_no, ptob_in->in_file, ptob_out->out_file, ErrMsgTable_AndExit( er_no, ptob_in->in_file, ptob_out->out_file,
btop->in_file, NULL, btop->in_file, NULL,
@ -892,8 +931,7 @@ char *prog_name;
static void static void
put_help( prog_name ) put_help(char *prog_name)
char *prog_name;
{ {
USAGE1("Usage: %s -xlfd xlfd_name \n", prog_name); USAGE1("Usage: %s -xlfd xlfd_name \n", prog_name);
USAGE("\t\t[-g character_size][-p character_pattern_file_name]\n"); USAGE("\t\t[-g character_size][-p character_pattern_file_name]\n");
@ -904,7 +942,7 @@ char *prog_name;
USAGE1("%s can insert or modify glyphs in the following code area.\n", prog_name); USAGE1("%s can insert or modify glyphs in the following code area.\n", prog_name);
USAGE("codeset \t\tcode area\n"); USAGE("codeset \t\tcode area\n");
USAGE("----------------------------------------\n"); USAGE("----------------------------------------\n");
DispUdcCpArea() ; DispUdcCpArea(stdout) ;
USAGE("The xlfd name and character size may be obtained using dtlsgpf command.\n"); USAGE("The xlfd name and character size may be obtained using dtlsgpf command.\n");
return; return;
} }
@ -912,12 +950,12 @@ char *prog_name;
static int static int
readBdfToMemory_with_init(head, init, buf, num_gr, gr ) readBdfToMemory_with_init(
struct btophead *head; struct btophead *head,
int init; int init,
char *buf; char *buf,
int num_gr ; int num_gr,
FalGlyphRegion *gr ; FalGlyphRegion *gr)
{ {
int code, mwidth, num_char, bsize, rtn ; int code, mwidth, num_char, bsize, rtn ;
char *ptn; char *ptn;

View file

@ -39,16 +39,16 @@
#include "bdfgpf.h" #include "bdfgpf.h"
#include "udcutil.h" #include "udcutil.h"
static void put_error(); static void put_error(struct btophead *head, int er_no, char *prog_name);
static void put_help() ; static void put_help(char *prog_name);
static void Usage() ; static void Usage(char *prog_name) ;
static void sigint_out() ; static void sigint_out(void) ;
static int CnvBDFtoGPF() ; static int CnvBDFtoGPF(struct btophead *head) ;
static struct btophead Head; static struct btophead Head;
static void static void
sigint_out() sigint_out(void)
{ {
if (Head.out_file) { if (Head.out_file) {
unlink(Head.out_file); unlink(Head.out_file);
@ -56,9 +56,7 @@ sigint_out()
exit(0); exit(0);
} }
main(argc, argv) int main(int argc, char *argv[])
int argc;
char *argv[];
{ {
int rtn, i; int rtn, i;
char *GetTmpPath(); char *GetTmpPath();
@ -190,8 +188,7 @@ char *argv[];
} }
static static
CnvBDFtoGPF(head) CnvBDFtoGPF( struct btophead *head)
struct btophead *head;
{ {
char bdfbuf[BUFSIZE]; char bdfbuf[BUFSIZE];
int rtn; int rtn;
@ -235,10 +232,7 @@ struct btophead *head;
} }
static void static void
put_error(head, er_no, prog_name) put_error(struct btophead *head, int er_no, char *prog_name)
struct btophead *head;
int er_no;
char *prog_name;
{ {
switch(er_no) { switch(er_no) {
case FATAL_ERROR : case FATAL_ERROR :
@ -276,16 +270,14 @@ char *prog_name;
} }
static void static void
put_help(prog_name) put_help(char *prog_name)
char *prog_name;
{ {
USAGE1("Usage: %s [-p character_pattern_file_name] [-bdf BDF_file_name]\n", prog_name); USAGE1("Usage: %s [-p character_pattern_file_name] [-bdf BDF_file_name]\n", prog_name);
USAGE("\t\t[-width character_width] [-height character_height] [-help]\n\n"); USAGE("\t\t[-width character_width] [-height character_height] [-help]\n\n");
} }
static void static void
Usage(prog_name) Usage(char *prog_name)
char *prog_name;
{ {
put_help(prog_name); put_help(prog_name);
exit(PARAM_ERROR * (-1)); exit(PARAM_ERROR * (-1));

View file

@ -37,16 +37,16 @@
#include "bdfgpf.h" #include "bdfgpf.h"
#include "udcutil.h" #include "udcutil.h"
static void put_error(); static void put_error(struct ptobhead *head, int er_no, char *prog_name);
static void put_help() ; static void put_help(char *prog_name);
static void Usage() ; static void Usage(char *prog_name);
static int CnvGPFtoBDF() ; static int CnvGPFtoBDF(struct ptobhead *head) ;
static void sigint_out() ; static void sigint_out(void) ;
static struct ptobhead Head; static struct ptobhead Head;
static void static void
sigint_out() sigint_out(void)
{ {
if ( Head.out_file ) { if ( Head.out_file ) {
unlink( Head.out_file ); unlink( Head.out_file );
@ -54,9 +54,7 @@ sigint_out()
exit( 0 ); exit( 0 );
} }
main( argc, argv ) int main( int argc, char *argv[])
int argc;
char *argv[];
{ {
int rtn, i; int rtn, i;
char *GetTmpPath(); char *GetTmpPath();
@ -184,8 +182,7 @@ char *argv[];
} }
static static
CnvGPFtoBDF( head ) CnvGPFtoBDF(struct ptobhead *head)
struct ptobhead *head;
{ {
char textbuf[BUFSIZE] ; char textbuf[BUFSIZE] ;
int rtn ; int rtn ;
@ -226,10 +223,7 @@ struct ptobhead *head;
} }
static void static void
put_error( head, er_no, prog_name ) put_error(struct ptobhead *head, int er_no, char *prog_name)
struct ptobhead *head;
int er_no;
char *prog_name;
{ {
switch( er_no ) { switch( er_no ) {
case FATAL_ERROR: case FATAL_ERROR:
@ -274,16 +268,14 @@ char *prog_name;
} }
static void static void
put_help( prog_name ) put_help( char *prog_name)
char *prog_name;
{ {
USAGE1("Usage: %s [-bdf BDF_file_name] [-p chracter_pattern_file_name]\n", prog_name); USAGE1("Usage: %s [-bdf BDF_file_name] [-p chracter_pattern_file_name]\n", prog_name);
USAGE("\t\t[-g user_defined_character_file_name] [-help]\n"); USAGE("\t\t[-g user_defined_character_file_name] [-help]\n");
} }
static void static void
Usage( prog_name ) Usage( char *prog_name)
char *prog_name;
{ {
put_help( prog_name ); put_help( prog_name );
exit( PARAM_ERROR * (-1) ); exit( PARAM_ERROR * (-1) );

View file

@ -53,7 +53,7 @@
#include "bdfgpf.h" #include "bdfgpf.h"
#include "snfstruct.h" #include "snfstruct.h"
#include "fontstruct.h" #include <X11/fonts/fontstruct.h>
#include "FaLib.h" #include "FaLib.h"
#include "udcutil.h" #include "udcutil.h"
@ -61,10 +61,12 @@
#include <errno.h> #include <errno.h>
static void sigint_out() ; static void sigint_out(void);
static void put_error_and_exit(); static void put_error_and_exit(struct ptobhead *ptob,
static void put_help(); int er_no,
static int CnvGPFtoBDF() ; char *prog_name);
static void put_help(char *prog_name);
static int CnvGPFtoBDF(struct ptobhead *head);
static struct ptobhead Head; static struct ptobhead Head;
@ -75,7 +77,7 @@ static char *char_set ;
static void static void
sigint_out() sigint_out(void)
{ {
if (Head.out_file) { if (Head.out_file) {
Unlink_Tmpfile(Head.out_file, com); Unlink_Tmpfile(Head.out_file, com);
@ -83,9 +85,7 @@ sigint_out()
exit(0); exit(0);
} }
main( argc, argv ) int main(int argc, char *argv[])
int argc;
char *argv[];
{ {
FontInfoRec *finf; FontInfoRec *finf;
int help, no_infile, style_err, rtn, i; int help, no_infile, style_err, rtn, i;
@ -96,7 +96,8 @@ char *argv[];
char *style ; /* style */ char *style ; /* style */
int chk_fd; int chk_fd;
pid_t chld_pid = 0; pid_t chld_pid = 0;
#if defined( SVR4 ) || defined( SYSV ) || defined(CSRG_BASED) || defined(__linux__) #if defined( SVR4 ) || defined( SYSV ) || defined(CSRG_BASED) || \
defined(__linux__)
int chld_stat ; int chld_stat ;
#else #else
union wait chld_stat ; union wait chld_stat ;
@ -282,15 +283,8 @@ char *argv[];
put_error_and_exit( &Head, MKTMP_ERROR, argv[0] ); put_error_and_exit( &Head, MKTMP_ERROR, argv[0] );
} }
permission = 0;
if ( ( snf_fd = open( Head.snf_file, O_RDONLY ) ) >= 0 ) { if ( ( snf_fd = open( Head.snf_file, O_RDONLY ) ) >= 0 ) {
if ( ChkPcfFontFile( Head.snf_file) ) { if ( ChkPcfFontFile( Head.snf_file) ) {
/* snf file */
COMM_SNF_FILEVERSION( snf_fd, finf, buf, permission ) ;
if( permission < 0 ) {
put_error_and_exit( &Head, BDF_INVAL, argv[0] );
}
} else {
/* pcf */ /* pcf */
close( snf_fd ); close( snf_fd );
} }
@ -396,8 +390,7 @@ char *argv[];
static static
CnvGPFtoBDF( head ) CnvGPFtoBDF(struct ptobhead *head)
struct ptobhead *head;
{ {
int rtn; int rtn;
char textbuf[BUFSIZE]; char textbuf[BUFSIZE];
@ -439,10 +432,7 @@ struct ptobhead *head;
static void static void
put_error_and_exit( ptob, er_no, prog_name ) put_error_and_exit(struct ptobhead *ptob, int er_no, char *prog_name)
struct ptobhead *ptob;
int er_no;
char *prog_name;
{ {
ErrMsgTable_AndExit( er_no, ptob->snf_file, ptob->out_file, ErrMsgTable_AndExit( er_no, ptob->snf_file, ptob->out_file,
ptob->in_file, NULL, ptob->in_file, NULL,
@ -454,8 +444,7 @@ char *prog_name;
static void static void
put_help( prog_name ) put_help(char *prog_name)
char *prog_name;
{ {
USAGE1("Usage: %s -xlfd xlfd_name\n", prog_name); USAGE1("Usage: %s -xlfd xlfd_name\n", prog_name);
USAGE("\t\t[-g character_size][-p character_pattern_file_name]\n" ); USAGE("\t\t[-g character_size][-p character_pattern_file_name]\n" );

View file

@ -52,7 +52,7 @@
#include <X11/Xmd.h> #include <X11/Xmd.h>
#include <X11/Xproto.h> #include <X11/Xproto.h>
#include "fontstruct.h" #include <X11/fonts/fontstruct.h>
#include "FaLib.h" #include "FaLib.h"
#include "snfstruct.h" #include "snfstruct.h"
@ -68,26 +68,63 @@
#define RESIZE_BY_RATE( a, r ) ((int)( (float)(a) * (r))) #define RESIZE_BY_RATE( a, r ) ((int)( (float)(a) * (r)))
#define DEF_RESOLUTION ((78 / 72.27) * 100) #define DEF_RESOLUTION ((78 / 72.27) * 100)
static void put_error_and_exit(); static void put_error_and_exit(struct btophead *ptob_in,
static void put_help(); struct ptobhead *ptob_out,
static void sigint_out() ; int er_no,
static void getDefaultCh() ; char *prog_name);
static void MkFontProp() ; static void put_help(char *prog_name);
static void sigint_out(void);
static void getDefaultCh(unsigned int cbuf);
static void MkFontProp(int font_height, char *font, char *output);
static int CpyGpfInit() ; static int CpyGpfInit(struct btophead *i_gpf,
static int writeGpf() ; struct btophead *o_gpf,
static int check_width() ; struct ptobhead *w_gpf,
static int check_height() ; int type);
static int check_width_height() ; static int writeGpf(struct btophead *i_gpf,
static int getGpfFileName() ; struct btophead *o_gpf,
static int readGpf() ; struct ptobhead *w_gpf);
static int readBdfHeaderAndPut() ; static int check_width(char *prog_name, char *len_str);
static int check_code() ; static int check_height(char *prog_name, char *len_str);
static int readBdfToMemory() ; static int check_width_height(char *prog_name, char *len_str, int mode);
static int cpg_atoi() ; static int getGpfFileName(char *com,
static int is_in_udcregion() ; struct btophead *gpfinf,
int code_area,
int code_no,
char *xlfdname,
char *snf_file,
char *style);
static int readGpf(struct btophead *i_gpf,
char *buf,
int startcode,
int endcode,
int num_gr,
FalGlyphRegion *gr);
static int readBdfHeaderAndPut(struct btophead *o_gpf,
struct ptobhead *w_gpf,
char *buf);
static int check_code(char *prog_name,
char *code_str,
int mode,
char *charset,
int num_gr,
FalGlyphRegion *gr);
static int readBdfToMemory(struct btophead *head,
char *buf,
int startcode,
int endcode,
int num_gr,
FalGlyphRegion *gr);
static int cpg_atoi(char *numstr);
static int is_in_udcregion(int start,
int end,
int num_gr,
FalGlyphRegion *gr);
extern int fal_code_to_glyph() ; extern int fal_code_to_glyph(char *locale,
unsigned long codepoint,
FalGIInf **gi,
int *num_gi);
static struct ptobhead WriteGpf; static struct ptobhead WriteGpf;
@ -103,7 +140,7 @@ static char *xlfdname ;
static void static void
sigint_out() sigint_out(void)
{ {
if (WriteGpf.out_file) { if (WriteGpf.out_file) {
Unlink_Tmpfile( WriteGpf.out_file, com ); Unlink_Tmpfile( WriteGpf.out_file, com );
@ -112,9 +149,7 @@ sigint_out()
} }
main( argc, argv ) int main(int argc, char **argv)
int argc;
char **argv ;
{ {
int code_area , help, no_infile, no_style, type ; int code_area , help, no_infile, no_style, type ;
int rtn, i, exit_code ; int rtn, i, exit_code ;
@ -538,14 +573,14 @@ char **argv ;
static int static int
getGpfFileName( com, gpfinf, code_area, code_no, xlfdname, snf_file, style ) getGpfFileName(
char *com ; char *com,
struct btophead *gpfinf ; struct btophead *gpfinf,
int code_area ; int code_area,
int code_no ; int code_no,
char *xlfdname ; char *xlfdname,
char *snf_file ; char *snf_file,
char *style ; char *style)
{ {
@ -586,11 +621,11 @@ char *style ;
static static
CpyGpfInit(i_gpf, o_gpf, w_gpf, type ) CpyGpfInit(
struct btophead *i_gpf; struct btophead *i_gpf,
struct btophead *o_gpf; struct btophead *o_gpf,
struct ptobhead *w_gpf; struct ptobhead *w_gpf,
int type ; int type)
{ {
FontInfoRec *finf; FontInfoRec *finf;
int ifd[2], ofd[2], snf_fd, permission; int ifd[2], ofd[2], snf_fd, permission;
@ -604,13 +639,7 @@ int type ;
/* SNF format */ /* SNF format */
if( !new_target ){ if( !new_target ){
if ( ChkPcfFontFile( w_gpf->snf_file ) ) { if ( ChkPcfFontFile( w_gpf->snf_file ) ) {
permission = 0 ;
if( (snf_fd = open( w_gpf->snf_file, O_RDONLY ) ) >= 0 ) { if( (snf_fd = open( w_gpf->snf_file, O_RDONLY ) ) >= 0 ) {
COMM_SNF_FILEVERSION( snf_fd, finf, buf, permission ) ;
if ( permission < 0 ) {
return BDF_INVAL;
}
} else {
return BDF_OPEN_IN; return BDF_OPEN_IN;
} }
} }
@ -733,12 +762,13 @@ int type ;
static int static int
readGpf(i_gpf, buf, startcode, endcode, num_gr, gr) readGpf(
struct btophead *i_gpf; struct btophead *i_gpf,
char *buf; char *buf,
int startcode ; int startcode,
int endcode ; int endcode,
FalGlyphRegion *gr ; int num_gr,
FalGlyphRegion *gr)
{ {
int nchar, rtn; int nchar, rtn;
@ -762,10 +792,7 @@ FalGlyphRegion *gr ;
static int static int
readBdfHeaderAndPut(o_gpf, w_gpf, buf) readBdfHeaderAndPut(struct btophead *o_gpf, struct ptobhead *w_gpf, char *buf)
struct btophead *o_gpf;
struct ptobhead *w_gpf;
char *buf;
{ {
FILE *fp ; FILE *fp ;
char *p; char *p;
@ -886,10 +913,7 @@ char *buf;
static static
writeGpf( i_gpf, o_gpf, w_gpf ) writeGpf(struct btophead *i_gpf, struct btophead *o_gpf, struct ptobhead *w_gpf)
struct btophead *i_gpf;
struct btophead *o_gpf;
struct ptobhead *w_gpf;
{ {
FILE *fp ; FILE *fp ;
char rdbuf[BUFSIZE] ; char rdbuf[BUFSIZE] ;
@ -936,27 +960,21 @@ struct ptobhead *w_gpf;
static int static int
check_width( prog_name, len_str ) check_width(char *prog_name, char *len_str)
char *prog_name;
char *len_str;
{ {
return( check_width_height( prog_name, len_str, 0) ); return( check_width_height( prog_name, len_str, 0) );
} }
static int static int
check_height( prog_name, len_str ) check_height(char *prog_name, char *len_str)
char *prog_name;
char *len_str;
{ {
return( check_width_height( prog_name, len_str, 1) ); return( check_width_height( prog_name, len_str, 1) );
} }
static int static int
check_width_height( prog_name, len_str, mode ) check_width_height(char *prog_name, char *len_str, int mode)
char *prog_name; /* width ... 0 , height ... 1 */
char *len_str;
int mode; /* width ... 0 , height ... 1 */
{ {
int ret; int ret;
char *tmp; char *tmp;
@ -983,13 +1001,13 @@ int mode; /* width ... 0 , height ... 1 */
static int static int
check_code( prog_name, code_str, mode, charset, num_gr, gr ) check_code(
char *prog_name; char *prog_name,
char *code_str; char *code_str,
int mode; /* start_code ... 0, end_code ... 1 */ int mode, /* start_code ... 0, end_code ... 1 */
char *charset ; char *charset,
int num_gr ; int num_gr,
FalGlyphRegion *gr ; FalGlyphRegion *gr)
{ {
int err_flg = 0; int err_flg = 0;
int code_num; int code_num;
@ -1054,13 +1072,13 @@ FalGlyphRegion *gr ;
static int static int
readBdfToMemory(head, buf, startcode, endcode, num_gr, gr) readBdfToMemory(
struct btophead *head; struct btophead *head,
char *buf; char *buf,
int startcode ; int startcode,
int endcode ; int endcode,
int num_gr ; int num_gr,
FalGlyphRegion *gr ; FalGlyphRegion *gr)
{ {
int code, mwidth, num_char, bsize, rtn; int code, mwidth, num_char, bsize, rtn;
char *ptn; char *ptn;
@ -1095,11 +1113,8 @@ FalGlyphRegion *gr ;
static void static void
getDefaultCh( code ) getDefaultCh(unsigned int cbuf)
unsigned int code ;
{ {
unsigned int cbuf ;
cbuf = code ;
if( (cbuf & 0xff) < firstCol ) firstCol = cbuf & 0xff ; if( (cbuf & 0xff) < firstCol ) firstCol = cbuf & 0xff ;
if( (cbuf >> 8) < firstRow ) firstRow = cbuf >> 8 ; if( (cbuf >> 8) < firstRow ) firstRow = cbuf >> 8 ;
if( (cbuf & 0xff) > lastCol ) lastCol = cbuf & 0xff ; if( (cbuf & 0xff) > lastCol ) lastCol = cbuf & 0xff ;
@ -1108,8 +1123,7 @@ unsigned int code ;
static int static int
cpg_atoi( numstr ) cpg_atoi(char *numstr)
char *numstr ;
{ {
int val ; int val ;
char *ep, *cbuf ; char *ep, *cbuf ;
@ -1123,9 +1137,7 @@ char *numstr ;
} }
static int static int
is_in_udcregion( start, end, num_gr, gr ) is_in_udcregion( int start, int end, int num_gr, FalGlyphRegion *gr )
int start, end, num_gr ;
FalGlyphRegion *gr ;
{ {
int i ; int i ;
if( start < gr[0].start && end < gr[0].start ){ if( start < gr[0].start && end < gr[0].start ){
@ -1145,10 +1157,7 @@ FalGlyphRegion *gr ;
static void static void
MkFontProp(font_height, font, output) MkFontProp(int font_height, char *font, char *output)
int font_height ;
char *font;
char *output;
{ {
char fbuf[BUFSIZE], split[BUFSIZE] ; char fbuf[BUFSIZE], split[BUFSIZE] ;
char *ep, *pix_sz, *point_sz, *rsl_x, *av_width, *char_set ; char *ep, *pix_sz, *point_sz, *rsl_x, *av_width, *char_set ;
@ -1177,11 +1186,11 @@ char *output;
static void static void
put_error_and_exit(ptob_in, ptob_out, er_no, prog_name) put_error_and_exit(
struct btophead *ptob_in; struct btophead *ptob_in,
struct ptobhead *ptob_out; struct ptobhead *ptob_out,
int er_no; int er_no,
char *prog_name; char *prog_name)
{ {
ErrMsgTable_AndExit( er_no, ptob_in->in_file, ptob_out->out_file, ErrMsgTable_AndExit( er_no, ptob_in->in_file, ptob_out->out_file,
NULL, NULL, NULL, prog_name ); NULL, NULL, NULL, prog_name );
@ -1191,8 +1200,7 @@ char *prog_name;
static void static void
put_help( prog_name ) put_help(char *prog_name)
char *prog_name;
{ {
USAGE1("Usage: %s -ixlfd oxlfd -oxlfd oxlfd\n", prog_name); USAGE1("Usage: %s -ixlfd oxlfd -oxlfd oxlfd\n", prog_name);
USAGE("\t[in_character_size][out_character_size]\n"); USAGE("\t[in_character_size][out_character_size]\n");
@ -1202,7 +1210,7 @@ char *prog_name;
USAGE1("%s can copy glyphs of gpf file in the following code area.\n", prog_name); USAGE1("%s can copy glyphs of gpf file in the following code area.\n", prog_name);
USAGE("codeset \t\tcode area\n"); USAGE("codeset \t\tcode area\n");
USAGE("----------------------------------------\n"); USAGE("----------------------------------------\n");
DispUdcCpArea() ; DispUdcCpArea(stdout) ;
USAGE("If the -start and -end option is omitted, the start/end code of each extractive area is specified.\n"); USAGE("If the -start and -end option is omitted, the start/end code of each extractive area is specified.\n");
USAGE("The xlfd name and character size may be obtained using dtlsgpf command.\n"); USAGE("The xlfd name and character size may be obtained using dtlsgpf command.\n");
return; return;

View file

@ -94,13 +94,6 @@ typedef struct _TempFont {
# define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */ # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */
# define DEFAULTSCANUNIT 1 /* default bitmap scan unit */ # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */
#elif defined(pegasus)
# define DEFAULTGLPAD 4 /* default padding for glyphs */
# define DEFAULTBITORDER MSBFirst /* default bitmap bit order */
# define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */
# define DEFAULTSCANUNIT 1 /* default bitmap scan unit */
#elif defined(mips) #elif defined(mips)
# ifdef MIPSEL # ifdef MIPSEL

View file

@ -36,14 +36,14 @@
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include "font.h" #include <X11/fonts/font.h>
#include "misc.h"
#include <X11/X.h> #include <X11/X.h>
#include <X11/Xproto.h> #include <X11/Xproto.h>
#include <X11/Xmd.h> #include <X11/Xmd.h>
#include <X11/Intrinsic.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include "fontstruct.h" #include <X11/fonts/fontstruct.h>
#include "snfstruct.h" #include "snfstruct.h"
#include <time.h> #include <time.h>
#include "bdftosnf.h" #include "bdftosnf.h"
@ -107,40 +107,80 @@ typedef struct prop_tmp {
static char *readfontfile(); static char *readfontfile(char *fname);
static void Anafprop(); static void Anafprop(FontInfoRec *fip,
static void pSIZE(); FontPropRec *fpropPtr,
static void pPROPS(); char *fpropvnPtr,
static void pCHARS(); char **fontname,
static void pfixCHARS(); FontPropRec **fplistPtr,
static int getarg(); FontPropRec *ps,
FontPropRec *res,
unsigned int *fplistNum);
static void pSIZE(FontPropRec *ps, FontPropRec *res);
static void pPROPS(FontInfoRec *fip,
FontPropRec *fplistPtr,
unsigned int fplistNum);
static void pCHARS(FontInfoRec *fip,
CharInfoRec *cip,
char *glyphPtr,
unsigned int charNum,
unsigned int glyphPad);
static void pfixCHARS(FontInfoRec *fip,
CharInfoRec *cip,
char *glyphPtr,
unsigned int charNum,
unsigned int glyphPad);
static int getarg(int argc,
char *argv[],
char *fname,
int *bitorder,
int *byteorder,
int *scanunit,
int *glyphPad,
int *outLevel,
int *fix);
static Bool seekToType() ; static Bool seekToType(PCFTablePtr tables,
static void getMetric() ; int ntables,
static Bool getAccel() ; CARD32 type,
static Bool getProperties() ; CARD32 *formatp,
static void putPtn() ; CARD32 *sizep,
static void ByteSwap() ; CARD32 *offsetp);
static void invertBits() ; static void getMetric(caddr_t buf, CARD32 format, xCharInfo *metric) ;
static Bool getAccel(FontInfoPtr pFontInfo,
xCharInfo *maxink,
caddr_t buf_top,
PCFTablePtr tables,
int ntables,
CARD32 type);
static Bool getProperties(PcfTmp *pcf,
caddr_t buf_top,
PCFTablePtr tables,
int ntables);
static void putPtn(unsigned char *bits, int width, int height);
static void ByteSwap(char *p, int scan);
static void invertBits(char *src,
CARD32 format,
int width,
int height,
char *dest) ;
static int getINT16() ; static int getINT16(unsigned char *p, CARD32 format);
static int getINT32() ; static int getINT32(unsigned char *p, CARD32 format);
static CARD32 getLSB32(); static CARD32 getLSB32(unsigned char *p);
static char *make_toptn(); static char *make_toptn(int width, int height);
static void pSIZE_pcf(); static void pSIZE_pcf(PropTmp *proptmp);
static PcfTmp *openPcfFont(); static PcfTmp *openPcfFont(char *fontname);
static void setProp(); static void setProp(PcfTmp *pcf, PropTmp *proptmp);
static void pPROPS_pcf(); static void pPROPS_pcf(PcfTmp *pcf);
static void pCHARS_pcf(); static void pCHARS_pcf(PcfTmp *pcf, int fix);
static void BitOrderInvert(); static void BitOrderInvert(unsigned char *buf, int nbytes);
static char *bufp,buf[2048]; static char *bufp,buf[2048];
extern int ChkPcfFontFile(); extern int ChkPcfFontFile(char *filename);
main( argc,argv ) int main( int argc, char *argv[] )
int argc;
char *argv[];
{ {
int i,k; int i,k;
@ -150,7 +190,7 @@ char *argv[];
CharInfoRec *cip, *wkcip; /* character information */ CharInfoRec *cip, *wkcip; /* character information */
unsigned int glyphstotal; /* glyph */ unsigned int glyphstotal; /* glyph */
unsigned int charInfoNum ; /* character information's number */ unsigned int charInfoNum ; /* character information's number */
unsigned int charNum; /* define character number */ unsigned int charNum; /* define character number */
char *glyphPtr; /* glyph */ char *glyphPtr; /* glyph */
FontPropRec *fpropPtr,*fplistPtr; /* font property list */ FontPropRec *fpropPtr,*fplistPtr; /* font property list */
FontPropRec psprop; /* point size property */ FontPropRec psprop; /* point size property */
@ -215,12 +255,6 @@ char *argv[];
if ( !isPcf ) { if ( !isPcf ) {
/* SNF format */ /* SNF format */
COMM_SNF_GETHEADER( fip, fp ) ; COMM_SNF_GETHEADER( fip, fp ) ;
/* font file check */
if ((fip->version1 != fip->version2) ||
(fip->version1 != FONT_FILE_VERSION)) {
USAGE("dtgpftobdf: illegal font version\n");
exit( -1 );
}
cip = (CharInfoRec *)((char *)fip + sizeof(FontInfoRec)); cip = (CharInfoRec *)((char *)fip + sizeof(FontInfoRec));
@ -231,26 +265,16 @@ char *argv[];
charNum = charInfoNum ; charNum = charInfoNum ;
wkcip = cip ; wkcip = cip ;
glyphstotal = fip->maxbounds.byteOffset; glyphPad = (((fip->maxbounds.rightSideBearing
- fip->maxbounds.leftSideBearing)+31)/32)*4;
glyphPad = (((fip->maxbounds.metrics.rightSideBearing
- fip->maxbounds.metrics.leftSideBearing)+31)/32)*4;
if ( fix == TRUE ) { if ( fix == TRUE ) {
for ( i = 0; i < charInfoNum; i++ ) { for ( i = 0; i < charInfoNum; i++ ) {
if ( wkcip->exists == FALSE ) {
charNum-- ;
}
wkcip++; wkcip++;
} }
} else { } else {
glyphstotal = 0 ; glyphstotal = 0 ;
for ( i = 0; i < charInfoNum; i++ ) { for ( i = 0; i < charInfoNum; i++ ) {
if (wkcip->exists == FALSE) {
charNum-- ;
wkcip++;
continue;
}
glyphstotal += (wkcip->metrics.ascent glyphstotal += (wkcip->metrics.ascent
+ wkcip->metrics.descent) * glyphPad; + wkcip->metrics.descent) * glyphPad;
wkcip++; wkcip++;
@ -258,7 +282,7 @@ char *argv[];
} }
fpropPtr = (FontPropRec *)(glyphPtr + glyphstotal); fpropPtr = (FontPropRec *)(glyphPtr + glyphstotal);
fpropvnPtr = ((char *)fpropPtr) + (fip->nProps) * sizeof(FontPropRec); fpropvnPtr = ((char *)fpropPtr) + (fip->nprops) * sizeof(FontPropRec);
} }
@ -303,12 +327,12 @@ char *argv[];
fprintf( stdout,"%s",buf ); fprintf( stdout,"%s",buf );
pSIZE_pcf( &proptmp ); pSIZE_pcf( &proptmp );
fprintf( stdout,"FONTBOUNDINGBOX %d %d %d %d\n", fprintf( stdout,"FONTBOUNDINGBOX %d %d %d %d\n",
pcf->info.maxbounds.metrics.rightSideBearing pcf->info.maxbounds.rightSideBearing
- pcf->info.maxbounds.metrics.leftSideBearing, - pcf->info.maxbounds.leftSideBearing,
pcf->info.maxbounds.metrics.ascent pcf->info.maxbounds.ascent
+ pcf->info.maxbounds.metrics.descent, + pcf->info.maxbounds.descent,
pcf->info.maxbounds.metrics.leftSideBearing, pcf->info.maxbounds.leftSideBearing,
- ( pcf->info.maxbounds.metrics.descent ) - ( pcf->info.maxbounds.descent )
); );
pPROPS_pcf( pcf ); pPROPS_pcf( pcf );
if ( outLevel == FALSE ) { if ( outLevel == FALSE ) {
@ -344,10 +368,8 @@ char *argv[];
/* /*
* read to font file * read to font file
*
*/ */
static char *readfontfile( fname ) static char *readfontfile( char *fname )
char *fname;
{ {
int fd; int fd;
char *fp = NULL; char *fp = NULL;
@ -407,8 +429,7 @@ char *fname;
#define getINT8( p ) ( *p++ ) ; #define getINT8( p ) ( *p++ ) ;
static CARD32 static CARD32
getLSB32( p ) getLSB32( unsigned char *p )
unsigned char *p;
{ {
CARD32 c; CARD32 c;
@ -422,9 +443,7 @@ unsigned char *p;
static int static int
getINT32( p, format ) getINT32( unsigned char *p, CARD32 format )
unsigned char *p;
CARD32 format;
{ {
CARD32 c; CARD32 c;
@ -444,9 +463,7 @@ CARD32 format;
} }
static int static int
getINT16( p, format ) getINT16( unsigned char *p, CARD32 format )
unsigned char *p;
CARD32 format;
{ {
CARD32 c; CARD32 c;
@ -462,13 +479,13 @@ CARD32 format;
} }
static Bool static Bool
seekToType( tables, ntables, type, formatp, sizep, offsetp) seekToType(
PCFTablePtr tables; PCFTablePtr tables,
int ntables; int ntables,
CARD32 type; CARD32 type,
CARD32 *formatp; CARD32 *formatp,
CARD32 *sizep; CARD32 *sizep,
CARD32 *offsetp; CARD32 *offsetp)
{ {
int i; int i;
@ -485,10 +502,7 @@ CARD32 *offsetp;
static void static void
getMetric( buf, format, metric ) getMetric( caddr_t buf, CARD32 format, xCharInfo *metric)
caddr_t buf;
CARD32 format;
xCharInfo *metric;
{ {
metric->leftSideBearing = getINT16( (unsigned char *)buf, format); metric->leftSideBearing = getINT16( (unsigned char *)buf, format);
buf += 2; buf += 2;
@ -505,13 +519,13 @@ xCharInfo *metric;
} }
static Bool static Bool
getAccel( pFontInfo, maxink, buf_top, tables, ntables, type ) getAccel(
FontInfoPtr pFontInfo; FontInfoPtr pFontInfo,
xCharInfo *maxink; xCharInfo *maxink,
caddr_t buf_top; caddr_t buf_top,
PCFTablePtr tables; PCFTablePtr tables,
int ntables; int ntables,
CARD32 type; CARD32 type)
{ {
CARD32 format; CARD32 format;
CARD32 size; CARD32 size;
@ -549,28 +563,24 @@ CARD32 type;
buffer += 4; buffer += 4;
getMetric(buffer, format, &pFontInfo->minbounds.metrics); getMetric(buffer, format, &pFontInfo->minbounds);
buffer += 12; buffer += 12;
getMetric(buffer, format, &pFontInfo->maxbounds.metrics); getMetric(buffer, format, &pFontInfo->maxbounds);
buffer += 12; buffer += 12;
if ( PCF_FORMAT_MATCH( format, PCF_ACCEL_W_INKBOUNDS ) ) { if ( PCF_FORMAT_MATCH( format, PCF_ACCEL_W_INKBOUNDS ) ) {
buffer += 12; buffer += 12;
getMetric( buffer, format, maxink); getMetric( buffer, format, maxink);
} else { } else {
*maxink = pFontInfo->maxbounds.metrics; *maxink = pFontInfo->maxbounds;
} }
return TRUE; return TRUE;
} }
static Bool static Bool
getProperties( pcf, buf_top, tables, ntables) getProperties(PcfTmp *pcf, caddr_t buf_top, PCFTablePtr tables, int ntables)
PcfTmp *pcf;
caddr_t buf_top;
PCFTablePtr tables;
int ntables;
{ {
CARD32 format; CARD32 format;
CARD32 size; CARD32 size;
@ -620,38 +630,40 @@ int ntables;
static PcfTmp * static PcfTmp *
openPcfFont( fontname ) openPcfFont(char *fontname)
char *fontname;
{ {
PcfTmp *pcf_tmp; PcfTmp *pcf_tmp;
CARD32 format; CARD32 format;
CARD32 size; CARD32 size;
CARD32 offset; CARD32 offset;
CARD32 *bitmapSizes; CARD32 *bitmapSizes;
xCharInfo maxink; xCharInfo maxink;
caddr_t buffp; caddr_t buffp;
struct stat st; struct stat st;
pcf_tmp = ( PcfTmp * )calloc( 1, sizeof( PcfTmp ) );
while(1){
pcf_tmp = ( PcfTmp * )calloc( 1, sizeof( PcfTmp ) );
if ( !pcf_tmp ) { if ( !pcf_tmp ) {
USAGE("dtgpftobdf : calloc() error.\n" ) ; USAGE("dtgpftobdf : calloc() error.\n" ) ;
goto Bail; break;
} }
if ( stat( fontname, &st ) ) { if ( stat( fontname, &st ) ) {
goto Bail; break;
} }
if ( ( pcf_tmp->pcf_buffer = readfontfile( fontname)) == (char *)-1 ) { if ( ( pcf_tmp->pcf_buffer = readfontfile( fontname)) == (char *)-1 ) {
goto Bail; break;
} }
pcf_tmp->pcf_bufsz = st.st_size; pcf_tmp->pcf_bufsz = st.st_size;
if ( (format = getLSB32( (unsigned char *)pcf_tmp->pcf_buffer )) != PCF_FILE_VERSION ) { if ( (format = getLSB32( (unsigned char *)pcf_tmp->pcf_buffer )) != PCF_FILE_VERSION ) {
USAGE1("dtgpftobdf : pcf file version(0x%x) error.\n", format ) ; USAGE1("dtgpftobdf : pcf file version(0x%x) error.\n", format ) ;
goto Bail; break;
} }
pcf_tmp->ntables = getLSB32( (unsigned char *)(pcf_tmp->pcf_buffer + 4) ); pcf_tmp->ntables = getLSB32( (unsigned char *)(pcf_tmp->pcf_buffer + 4) );
@ -668,7 +680,7 @@ char *fontname;
) )
) { ) {
USAGE("dtgpftobdf : Cannot get accelerators.\n" ) ; USAGE("dtgpftobdf : Cannot get accelerators.\n" ) ;
goto Bail; break;
} }
} }
@ -678,7 +690,7 @@ char *fontname;
) )
) { ) {
USAGE("dtgpftobdf : getProperties error.\n" ) ; USAGE("dtgpftobdf : getProperties error.\n" ) ;
goto Bail; break;
} }
if ( !seekToType( if ( !seekToType(
pcf_tmp->tables, pcf_tmp->ntables, pcf_tmp->tables, pcf_tmp->ntables,
@ -686,7 +698,7 @@ char *fontname;
) )
) { ) {
USAGE("dtgpftobdf : PCF_BITMAPS error.\n" ) ; USAGE("dtgpftobdf : PCF_BITMAPS error.\n" ) ;
goto Bail; break;
} }
buffp = pcf_tmp->pcf_buffer + offset; buffp = pcf_tmp->pcf_buffer + offset;
@ -696,7 +708,7 @@ char *fontname;
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) {
USAGE("dtgpftobdf : error.!PCF_FORMAT_MATCH(PCF_BITMAPS)\n" ) ; USAGE("dtgpftobdf : error.!PCF_FORMAT_MATCH(PCF_BITMAPS)\n" ) ;
goto Bail; break;
} }
pcf_tmp->nbitmaps = getINT32( (unsigned char *)buffp, format); pcf_tmp->nbitmaps = getINT32( (unsigned char *)buffp, format);
@ -719,7 +731,7 @@ char *fontname;
) )
) { ) {
USAGE("dtgpftobdf : error.(PCF_BDF_ENCODINGS)\n" ) ; USAGE("dtgpftobdf : error.(PCF_BDF_ENCODINGS)\n" ) ;
goto Bail; break;
} }
buffp = pcf_tmp->pcf_buffer + offset; buffp = pcf_tmp->pcf_buffer + offset;
@ -727,7 +739,7 @@ char *fontname;
buffp += 4; buffp += 4;
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) {
USAGE("dtgpftobdf : error.!PCF_FORMAT_MATCH(PCF_BDF_ENCODINGS)\n" ) ; USAGE("dtgpftobdf : error.!PCF_FORMAT_MATCH(PCF_BDF_ENCODINGS)\n" ) ;
goto Bail; break;
} }
pcf_tmp->info.firstCol = getINT16( (unsigned char *)buffp, format); pcf_tmp->info.firstCol = getINT16( (unsigned char *)buffp, format);
@ -738,7 +750,7 @@ char *fontname;
buffp += 2; buffp += 2;
pcf_tmp->info.lastRow = getINT16( (unsigned char *)buffp, format); pcf_tmp->info.lastRow = getINT16( (unsigned char *)buffp, format);
buffp += 2; buffp += 2;
pcf_tmp->info.chDefault = getINT16( (unsigned char *)buffp, format); pcf_tmp->info.defaultCh = getINT16( (unsigned char *)buffp, format);
buffp += 2; buffp += 2;
pcf_tmp->info.allExist = FALSE; pcf_tmp->info.allExist = FALSE;
@ -753,14 +765,14 @@ char *fontname;
(CARD32)PCF_SWIDTHS, &format, &size, &offset (CARD32)PCF_SWIDTHS, &format, &size, &offset
) )
) { ) {
goto Bail; break;
} }
buffp = pcf_tmp->pcf_buffer + offset; buffp = pcf_tmp->pcf_buffer + offset;
format = getLSB32( (unsigned char*)buffp); format = getLSB32( (unsigned char*)buffp);
buffp += 4; buffp += 4;
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) {
goto Bail; break;
} }
pcf_tmp->swd_fmt = (CARD32)format ; pcf_tmp->swd_fmt = (CARD32)format ;
pcf_tmp->swd_num = getINT32( (unsigned char*)buffp, format ) ; pcf_tmp->swd_num = getINT32( (unsigned char*)buffp, format ) ;
@ -776,14 +788,14 @@ char *fontname;
(CARD32)PCF_GLYPH_NAMES, &format, &size, &offset (CARD32)PCF_GLYPH_NAMES, &format, &size, &offset
) )
) { ) {
goto Bail; break;
} }
buffp = pcf_tmp->pcf_buffer + offset; buffp = pcf_tmp->pcf_buffer + offset;
format = getLSB32( (unsigned char*)buffp); format = getLSB32( (unsigned char*)buffp);
buffp += 4; buffp += 4;
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) {
goto Bail; break;
} }
pcf_tmp->glyphs = getINT32( (unsigned char*)buffp, format ) ; pcf_tmp->glyphs = getINT32( (unsigned char*)buffp, format ) ;
buffp += 4; buffp += 4;
@ -800,7 +812,7 @@ char *fontname;
(CARD32)PCF_METRICS, &format, &size, &offset (CARD32)PCF_METRICS, &format, &size, &offset
) )
) { ) {
goto Bail; break;
} }
buffp = pcf_tmp->pcf_buffer + offset; buffp = pcf_tmp->pcf_buffer + offset;
@ -815,41 +827,40 @@ char *fontname;
pcf_tmp->mtr_num = (int)getINT16( (unsigned char*)buffp, format ) ; pcf_tmp->mtr_num = (int)getINT16( (unsigned char*)buffp, format ) ;
buffp += 2; buffp += 2;
}else{ }else{
goto Bail; break;
} }
pcf_tmp->metrics = (xCharInfo *)buffp ; pcf_tmp->metrics = (xCharInfo *)buffp ;
pcf_tmp->mtr_fmt = (CARD32)format ; pcf_tmp->mtr_fmt = (CARD32)format ;
return pcf_tmp; return pcf_tmp;
}
Bail: if ( pcf_tmp ) {
if ( pcf_tmp ) { free( pcf_tmp );
free( pcf_tmp ); }
} return NULL;
return NULL;
} }
static void static void
Anafprop(fip,fpropPtr,fpropvnPtr,fontname,ps,res,fplistPtr,fplistNum) Anafprop(
FontInfoRec *fip; FontInfoRec *fip,
FontPropRec *fpropPtr; FontPropRec *fpropPtr,
char *fpropvnPtr; char *fpropvnPtr,
char **fontname; char **fontname,
FontPropRec **fplistPtr; FontPropRec **fplistPtr,
FontPropRec *ps; FontPropRec *ps,
FontPropRec *res; FontPropRec *res,
unsigned int *fplistNum; unsigned int *fplistNum)
{ {
FontPropRec *wkp ,*wklp; FontPropRec *wkp ,*wklp;
int i, fpnL; int i, fpnL;
char *fpnp; char *fpnp;
*fplistNum = fip->nProps - 1; *fplistNum = fip->nprops - 1;
*fplistPtr = (FontPropRec *)malloc(*fplistNum * sizeof(FontPropRec)); *fplistPtr = (FontPropRec *)malloc(*fplistNum * sizeof(FontPropRec));
wkp = fpropPtr; wkp = fpropPtr;
wklp = *fplistPtr; wklp = *fplistPtr;
for (i = 0; i < fip->nProps; i++) { for (i = 0; i < fip->nprops; i++) {
fpnp = fpropvnPtr + wkp->name; fpnp = fpropvnPtr + wkp->name;
fpnL = strlen(fpnp); fpnL = strlen(fpnp);
if ((fpnL == 4) && (strncmp(fpnp,"FONT",4) == 0)) { if ((fpnL == 4) && (strncmp(fpnp,"FONT",4) == 0)) {
@ -866,12 +877,7 @@ unsigned int *fplistNum;
} }
} }
wklp->name = (CARD32) (intptr_t) fpropvnPtr + wkp->name; wklp->name = (CARD32) (intptr_t) fpropvnPtr + wkp->name;
if (wkp->indirect == TRUE) {
wklp->value = (INT32) (intptr_t) fpropvnPtr + wkp->value;
} else {
wklp->value = wkp->value; wklp->value = wkp->value;
}
wklp->indirect = wkp->indirect;
wkp++; wkp++;
wklp++; wklp++;
} }
@ -880,9 +886,7 @@ unsigned int *fplistNum;
static void static void
setProp( pcf, proptmp ) setProp( PcfTmp *pcf, PropTmp *proptmp )
PcfTmp *pcf;
PropTmp *proptmp;
{ {
int i, fpnL; int i, fpnL;
char *fpnp; char *fpnp;
@ -911,8 +915,7 @@ PropTmp *proptmp;
* *
*/ */
static void static void
pSIZE( ps, res ) pSIZE( FontPropRec *ps, FontPropRec *res )
FontPropRec *ps, *res;
{ {
int k; int k;
float f; float f;
@ -934,8 +937,7 @@ FontPropRec *ps, *res;
/* output to SIZE of pcf font */ /* output to SIZE of pcf font */
static void static void
pSIZE_pcf( proptmp ) pSIZE_pcf( PropTmp *proptmp )
PropTmp *proptmp;
{ {
int k; int k;
float f; float f;
@ -956,10 +958,7 @@ PropTmp *proptmp;
static void static void
pPROPS( fip,fplistPtr,fplistNum ) pPROPS( FontInfoRec *fip, FontPropRec *fplistPtr, unsigned int fplistNum )
FontInfoRec *fip;
FontPropRec *fplistPtr;
unsigned int fplistNum;
{ {
FontPropRec *wkp; FontPropRec *wkp;
int i, k; int i, k;
@ -971,18 +970,13 @@ unsigned int fplistNum;
bufp += k; bufp += k;
k = snprintf( bufp, sizeof(buf) - (bufp - buf), "FONT_DESCENT %d\n", fip->fontDescent ); k = snprintf( bufp, sizeof(buf) - (bufp - buf), "FONT_DESCENT %d\n", fip->fontDescent );
bufp += k; bufp += k;
k = snprintf( bufp, sizeof(buf) - (bufp - buf), "DEFAULT_CHAR %d\n", fip->chDefault ); k = snprintf( bufp, sizeof(buf) - (bufp - buf), "DEFAULT_CHAR %d\n", fip->defaultCh );
bufp += k; bufp += k;
wkp = fplistPtr; wkp = fplistPtr;
for ( i = 0; i < fplistNum; i++ ) { for ( i = 0; i < fplistNum; i++ ) {
if ( wkp->indirect == TRUE ) {
k = snprintf( bufp, sizeof(buf) - (bufp - buf), "%s \"%s\"\n", (char *) (intptr_t) wkp->name, (char *) (intptr_t) wkp->value );
bufp += k;
} else {
k = snprintf( bufp, sizeof(buf) - (bufp - buf), "%s %d\n", (char *) (intptr_t) wkp->name, wkp->value ); k = snprintf( bufp, sizeof(buf) - (bufp - buf), "%s %d\n", (char *) (intptr_t) wkp->name, wkp->value );
bufp += k; bufp += k;
} wkp++;
wkp++;
} }
k = snprintf( bufp, sizeof(buf) - (bufp - buf), "ENDPROPERTIES\n" ); k = snprintf( bufp, sizeof(buf) - (bufp - buf), "ENDPROPERTIES\n" );
bufp += k; bufp += k;
@ -995,8 +989,7 @@ unsigned int fplistNum;
/* output to font property information of pcf fontpcf */ /* output to font property information of pcf fontpcf */
static void static void
pPROPS_pcf( pcf ) pPROPS_pcf(PcfTmp *pcf)
PcfTmp *pcf;
{ {
FontPropPtr wkp; FontPropPtr wkp;
int i, k; int i, k;
@ -1005,16 +998,16 @@ PcfTmp *pcf;
k = sprintf( bufp, "STARTPROPERTIES %d\n", pcf->nprops+3 ); k = sprintf( bufp, "STARTPROPERTIES %d\n", pcf->nprops+3 );
bufp += k; bufp += k;
k = sprintf( bufp, "FONT_ASCENT %d\n", k = sprintf( bufp, "FONT_ASCENT %d\n",
(pcf->info.fontAscent >= pcf->info.maxbounds.metrics.ascent) (pcf->info.fontAscent >= pcf->info.maxbounds.ascent)
? pcf->info.fontAscent : pcf->info.maxbounds.metrics.ascent ? pcf->info.fontAscent : pcf->info.maxbounds.ascent
); );
bufp += k; bufp += k;
k = sprintf( bufp, "FONT_DESCENT %d\n", k = sprintf( bufp, "FONT_DESCENT %d\n",
(pcf->info.fontDescent >= pcf->info.maxbounds.metrics.descent) (pcf->info.fontDescent >= pcf->info.maxbounds.descent)
? pcf->info.fontDescent : pcf->info.maxbounds.metrics.descent ? pcf->info.fontDescent : pcf->info.maxbounds.descent
); );
bufp += k; bufp += k;
k = sprintf( bufp, "DEFAULT_CHAR %d\n", pcf->info.chDefault ); k = sprintf( bufp, "DEFAULT_CHAR %d\n", pcf->info.defaultCh );
bufp += k; bufp += k;
wkp = pcf->props; wkp = pcf->props;
for ( i = 0; i < pcf->nprops; i++ ) { for ( i = 0; i < pcf->nprops; i++ ) {
@ -1043,16 +1036,14 @@ PcfTmp *pcf;
/* /*
* output to character information and patern * output to character information and patern
*
*/ */
static void static void
pCHARS(fip,cip,glyphPtr,charNum,glyphPad) pCHARS(
FontInfoRec *fip; FontInfoRec *fip,
CharInfoRec *cip; CharInfoRec *cip,
char *glyphPtr; char *glyphPtr,
unsigned int charNum; unsigned int charNum,
unsigned int glyphPad; unsigned int glyphPad)
{ {
CharInfoRec *wkp; CharInfoRec *wkp;
int i, j; int i, j;
@ -1077,10 +1068,6 @@ unsigned int glyphPad;
for ( row = frow; row <= lrow; row++ ) { for ( row = frow; row <= lrow; row++ ) {
for ( col = fcol; col <= lcol; col++ ) { for ( col = fcol; col <= lcol; col++ ) {
if ( wkp->exists == FALSE ) {
wkp++;
continue;
}
fprintf( stdout, "STARTCHAR %.2x%.2x\n", row,col ); fprintf( stdout, "STARTCHAR %.2x%.2x\n", row,col );
fprintf( stdout, "ENCODING %d\n", (row << 8) + col ); fprintf( stdout, "ENCODING %d\n", (row << 8) + col );
fprintf( stdout, "SWIDTH 256 0\nDWIDTH %d %d\n", fprintf( stdout, "SWIDTH 256 0\nDWIDTH %d %d\n",
@ -1111,24 +1098,23 @@ unsigned int glyphPad;
/* /*
* output to character information and patern * output to character information and patern
*
*/ */
static void static void
pfixCHARS(fip,cip,glyphPtr,charNum,glyphPad) pfixCHARS(
FontInfoRec *fip; FontInfoRec *fip,
CharInfoRec *cip; CharInfoRec *cip,
char *glyphPtr; char *glyphPtr,
unsigned int charNum; unsigned int charNum,
unsigned int glyphPad; unsigned int glyphPad)
{ {
CharInfoRec *wkp; CharInfoRec *wkp;
register int i, j, k; int i, j, k;
unsigned int frow,lrow,fcol,lcol; unsigned int frow,lrow,fcol,lcol;
register int row, col; int row, col;
unsigned int bbw, bbh, bbox, bboy; unsigned int bbw, bbh, bbox, bboy;
unsigned int xd, yd; unsigned int xd, yd;
unsigned int bml; unsigned int bml;
register char *glyph; char *glyph;
char fixbuf[240], *fixbufp; char fixbuf[240], *fixbufp;
int fixdl; int fixdl;
@ -1162,10 +1148,6 @@ unsigned int glyphPad;
glyph = glyphPtr; glyph = glyphPtr;
for ( row = frow; row <= lrow; row++ ) { for ( row = frow; row <= lrow; row++ ) {
for ( col = fcol; col <= lcol; col++ ) { for ( col = fcol; col <= lcol; col++ ) {
if ( wkp->exists == FALSE ) {
wkp++;
continue;
}
bufp = buf; bufp = buf;
memcpy(bufp,"STARTCHAR ",10); memcpy(bufp,"STARTCHAR ",10);
bufp += 10; bufp += 10;
@ -1199,9 +1181,9 @@ unsigned int glyphPad;
static void static void
putPtn( bits, width, height) putPtn(unsigned char *bits, /* 1 byte boundary , no byte swap data */
unsigned char *bits; /* 1 byte boundary , no byte swap data */ int width,
int width, height; int height)
{ {
int bytewidth; int bytewidth;
int i, j; int i, j;
@ -1218,9 +1200,7 @@ int width, height;
} }
static void static void
ByteSwap( p, scan) ByteSwap(char *p, int scan)
char *p;
int scan;
{ {
char w; char w;
@ -1279,22 +1259,16 @@ static unsigned char _reverse_byte[0x100] = {
}; };
static void static void
BitOrderInvert(buf, nbytes) BitOrderInvert(unsigned char *buf, int nbytes)
register unsigned char *buf;
register int nbytes;
{ {
register unsigned char *rev = _reverse_byte; unsigned char *rev = _reverse_byte;
for (; --nbytes >= 0; buf++) for (; --nbytes >= 0; buf++)
*buf = rev[*buf]; *buf = rev[*buf];
} }
static void static void
invertBits( src, format, width, height, dest) invertBits(char *src, CARD32 format, int width, int height, char *dest)
char *src;
CARD32 format;
int width, height;
char *dest;
{ {
int bit, byte, glyph, scan; int bit, byte, glyph, scan;
int src_bytewidth, dest_bytewidth; int src_bytewidth, dest_bytewidth;
@ -1328,9 +1302,7 @@ char *dest;
} }
static void static void
pCHARS_pcf (pcf, fix) pCHARS_pcf (PcfTmp *pcf, int fix)
PcfTmp *pcf;
int fix ;
{ {
char *bmp_ptn = NULL; char *bmp_ptn = NULL;
char *bitmap = NULL; char *bitmap = NULL;
@ -1356,17 +1328,17 @@ int fix ;
nencoding = row_width * (pcf->info.lastRow - pcf->info.firstRow + 1); nencoding = row_width * (pcf->info.lastRow - pcf->info.firstRow + 1);
if( fix == TRUE ) { if( fix == TRUE ) {
bmp_width = pcf->info.maxbounds.metrics.leftSideBearing bmp_width = pcf->info.maxbounds.leftSideBearing
+ pcf->info.maxbounds.metrics.rightSideBearing ; + pcf->info.maxbounds.rightSideBearing ;
bmp_height = pcf->info.fontAscent + pcf->info.fontDescent ; bmp_height = pcf->info.fontAscent + pcf->info.fontDescent ;
ptn_width = bmp_width ; ptn_width = bmp_width ;
ptn_height = pcf->info.maxbounds.metrics.ascent + ptn_height = pcf->info.maxbounds.ascent +
pcf->info.maxbounds.metrics.descent; pcf->info.maxbounds.descent;
if (!(bmp_ptn = make_toptn( ptn_width, ptn_height))) if (!(bmp_ptn = make_toptn( ptn_width, ptn_height)))
return; return;
if ( ( adj_hi = pcf->info.fontAscent - pcf->info.maxbounds.metrics.ascent ) > 0) { if ( ( adj_hi = pcf->info.fontAscent - pcf->info.maxbounds.ascent ) > 0) {
width_bytes = 8 * PCF_GLYPH_PAD( pcf->bmp_fmt); width_bytes = 8 * PCF_GLYPH_PAD( pcf->bmp_fmt);
width_bytes = (( width_bytes + bmp_width - 1)/width_bytes) * PCF_GLYPH_PAD( pcf->bmp_fmt); width_bytes = (( width_bytes + bmp_width - 1)/width_bytes) * PCF_GLYPH_PAD( pcf->bmp_fmt);
bmp_adj = width_bytes * adj_hi; bmp_adj = width_bytes * adj_hi;
@ -1433,8 +1405,8 @@ int fix ;
fprintf( stdout,"BBX %d %d %d %d\nBITMAP\n", bbw, bbh, bbx, bby ) ; fprintf( stdout,"BBX %d %d %d %d\nBITMAP\n", bbw, bbh, bbx, bby ) ;
if( fix == FALSE ) { if( fix == FALSE ) {
bmp_width = pcf->info.maxbounds.metrics.leftSideBearing bmp_width = pcf->info.maxbounds.leftSideBearing
+ pcf->info.maxbounds.metrics.rightSideBearing ; + pcf->info.maxbounds.rightSideBearing ;
bmp_height = pcf->info.fontAscent + pcf->info.fontDescent ; bmp_height = pcf->info.fontAscent + pcf->info.fontDescent ;
ptn_width = bbw ; ptn_width = bbw ;
ptn_height = bbh ; ptn_height = bbh ;
@ -1442,7 +1414,7 @@ int fix ;
if (!(bmp_ptn = make_toptn( ptn_width, ptn_height))) if (!(bmp_ptn = make_toptn( ptn_width, ptn_height)))
return; return;
if ( ( adj_hi = pcf->info.fontAscent - pcf->info.maxbounds.metrics.ascent ) > 0) { if ( ( adj_hi = pcf->info.fontAscent - pcf->info.maxbounds.ascent ) > 0) {
width_bytes = 8 * PCF_GLYPH_PAD( pcf->bmp_fmt); width_bytes = 8 * PCF_GLYPH_PAD( pcf->bmp_fmt);
width_bytes = (( width_bytes + bmp_width - 1)/width_bytes) * PCF_GLYPH_PAD( pcf->bmp_fmt); width_bytes = (( width_bytes + bmp_width - 1)/width_bytes) * PCF_GLYPH_PAD( pcf->bmp_fmt);
bmp_adj = width_bytes * adj_hi; bmp_adj = width_bytes * adj_hi;
@ -1486,8 +1458,7 @@ int fix ;
} }
static char * static char *
make_toptn( width, height) make_toptn(int width, int height)
int width, height;
{ {
int byte_width; int byte_width;
@ -1500,16 +1471,16 @@ int width, height;
static int static int
getarg(argc,argv,fname,bitorder,byteorder,scanunit,glyphPad,outLevel,fix) getarg(
int argc; int argc,
char *argv[]; char *argv[],
char *fname; char *fname,
int *bitorder; int *bitorder,
int *byteorder; int *byteorder,
int *scanunit; int *scanunit,
int *glyphPad; int *glyphPad,
int *outLevel; int *outLevel,
int *fix; int *fix)
{ {
int i; int i;
int already; int already;

View file

@ -57,27 +57,44 @@
#define START_CODE 0 #define START_CODE 0
#define END_CODE 1 #define END_CODE 1
static int CnvBDFtoGPF() ; static int CnvBDFtoGPF(struct btophead *head,
static int check_width() ; int num_gr,
static int check_height() ; FalGlyphRegion *gr,
static int check_width_height() ; int code_area);
static int check_code() ; static int check_width(char *prog_name, char *len_str);
static int readBdfToMemory() ; static int check_height(char *prog_name, char *len_str);
static void sigint_out() ; static int check_width_height(char *prog_name, char *len_str, int mode);
static void put_error_and_exit(); static int check_code(char *prog_name,
static void put_help(); char *code_str,
static void Usage(); int mode,
char *charset,
int num_gr,
FalGlyphRegion *gr);
static int readBdfToMemory(struct btophead *head,
char *buf,
int num_gr,
FalGlyphRegion *gr,
int code_area);
static void sigint_out(void);
static void put_error_and_exit(struct btophead *btop,
int er_no,
char *prog_name);
static void put_help(char *prog_name);
static void Usage(char *prog_name);
extern int fal_code_to_glyph() ; extern int fal_code_to_glyph(char *locale,
unsigned long codepoint,
FalGIInf **gi,
int *num_gi);
static struct btophead Head; static struct btophead Head;
static char *locale ; static char *locale;
static char *spacing ; static char *spacing;
static char *char_set ; static char *char_set;
static void static void
sigint_out() sigint_out(void)
{ {
if ( Head.out_file ) { if ( Head.out_file ) {
unlink( Head.out_file ); unlink( Head.out_file );
@ -85,9 +102,7 @@ sigint_out()
exit( 0 ); exit( 0 );
} }
main( argc, argv ) int main(int argc, char *argv[])
int argc;
char *argv[];
{ {
int help, code_area, fd[2], rtn, i; int help, code_area, fd[2], rtn, i;
struct stat st; struct stat st;
@ -412,11 +427,11 @@ char *argv[];
static int static int
CnvBDFtoGPF( head, num_gr, gr, code_area ) CnvBDFtoGPF(
struct btophead *head; struct btophead *head,
int num_gr ; int num_gr,
FalGlyphRegion *gr ; FalGlyphRegion *gr,
int code_area ; int code_area)
{ {
int rtn; int rtn;
char bdfbuf[BUFSIZE]; char bdfbuf[BUFSIZE];
@ -463,10 +478,7 @@ int code_area ;
static void static void
put_error_and_exit(btop, er_no, prog_name) put_error_and_exit(struct btophead *btop, int er_no, char *prog_name)
struct btophead *btop;
int er_no;
char *prog_name;
{ {
ErrMsgTable_AndExit( er_no, btop->in_file, NULL, ErrMsgTable_AndExit( er_no, btop->in_file, NULL,
NULL, btop->out_file, NULL, btop->out_file,
@ -481,8 +493,7 @@ char *prog_name;
static void static void
put_help(prog_name) put_help(char *prog_name)
char *prog_name;
{ {
USAGE1("Usage : %s -xlfd xlfd_name\n", prog_name); USAGE1("Usage : %s -xlfd xlfd_name\n", prog_name);
USAGE("\t\t[-g character_size][-p character_pattern_file_name]\n"); USAGE("\t\t[-g character_size][-p character_pattern_file_name]\n");
@ -493,15 +504,14 @@ char *prog_name;
USAGE1("%s can extract glyphs in cpf file format in the following code area.\n", prog_name); USAGE1("%s can extract glyphs in cpf file format in the following code area.\n", prog_name);
USAGE("codeset \t\tcode area\n"); USAGE("codeset \t\tcode area\n");
USAGE("----------------------------------------\n"); USAGE("----------------------------------------\n");
DispUdcCpArea() ; DispUdcCpArea(stdout) ;
USAGE("If the -start and -end option is omitted, the start/end code of each extractive area is specified.\n"); USAGE("If the -start and -end option is omitted, the start/end code of each extractive area is specified.\n");
USAGE("The xlfd name and character size may be obtained using dtlsgpf command.\n"); USAGE("The xlfd name and character size may be obtained using dtlsgpf command.\n");
return; return;
} }
static void static void
Usage(prog_name) Usage(char *prog_name)
char *prog_name;
{ {
put_help( prog_name ); put_help( prog_name );
exit(1); exit(1);
@ -509,27 +519,21 @@ char *prog_name;
static int static int
check_width( prog_name, len_str ) check_width(char *prog_name, char *len_str)
char *prog_name;
char *len_str;
{ {
return( check_width_height( prog_name, len_str, 0) ); return( check_width_height( prog_name, len_str, 0) );
} }
static int static int
check_height( prog_name, len_str ) check_height(char *prog_name, char *len_str)
char *prog_name;
char *len_str;
{ {
return( check_width_height( prog_name, len_str, 1) ); return( check_width_height( prog_name, len_str, 1) );
} }
static int static int
check_width_height( prog_name, len_str, mode ) check_width_height(char *prog_name, char *len_str, int mode)
char *prog_name; /* width ... 0 , height ... 1 */
char *len_str;
int mode; /* width ... 0 , height ... 1 */
{ {
int ret; int ret;
char *tmp; char *tmp;
@ -559,13 +563,13 @@ int mode; /* width ... 0 , height ... 1 */
static int static int
check_code( prog_name, code_str, mode, charset, num_gr, gr ) check_code(
char *prog_name; char *prog_name,
char *code_str; char *code_str,
int mode; /* start_code ... 0, end_code ... 1 */ int mode, /* start_code ... 0, end_code ... 1 */
char *charset ; char *charset,
int num_gr ; int num_gr,
FalGlyphRegion *gr ; FalGlyphRegion *gr)
{ {
int err_flg = 0; int err_flg = 0;
int code_num; int code_num;
@ -628,12 +632,12 @@ FalGlyphRegion *gr ;
static int static int
readBdfToMemory(head, buf, num_gr, gr, code_area) readBdfToMemory(
struct btophead *head; struct btophead *head,
char *buf; char *buf,
int num_gr ; int num_gr,
FalGlyphRegion *gr ; FalGlyphRegion *gr,
int code_area ; int code_area)
{ {
int code, mwidth, num_char, bsize, rtn; int code, mwidth, num_char, bsize, rtn;
char *ptn; char *ptn;

View file

@ -39,23 +39,9 @@
#include "bdfgpf.h" #include "bdfgpf.h"
#include "udcutil.h" #include "udcutil.h"
static char *utillocale;
static void dsp_info_list(); static char *fontdir;
static void dsp_title(); static char *command_name;
static void dspinfo_1line();
static void disp_no_fontslist();
static void sort_offset_list() ;
static int sort_fontlist() ;
static void dsp_error_title() ;
static int dsp_error_files() ;
static void put_help();
static int search_fontfile_name() ;
static int get_new_target() ;
static char *utillocale ;
static char *fontdir ;
static char *command_name ;
typedef struct { typedef struct {
int num; int num;
@ -82,10 +68,37 @@ typedef struct {
#define X_OPT (1<<3) #define X_OPT (1<<3)
#define C_OPT (1<<4) #define C_OPT (1<<4)
static void dsp_info_list(char *com,
int dspopt,
FalFontDataList *lst,
MISS_ENTRY *unknown_file_lst,
int *errflg);
static void dsp_title(FILE *fp, int dspopt);
static void dspinfo_1line(FalFontData data,
FILE *fp,
MISS_ENTRY *unknown_file_lst,
int offset,
int *errflg,
int dspopt);
static void disp_no_fontslist(int dspopt);
static void sort_offset_list(FalFontDataList *flist,
int mask,
int **sort_list,
int *data_cnt);
static int sort_fontlist(FalFontDataList *lst);
static void dsp_error_title(char *com, int *errflg, int dspopt);
static int dsp_error_files(FalFontDataList *lst, MISS_ENTRY *unknown);
static void put_help(char *prog_name);
static int search_fontfile_name(FalFontData data,
char *fname,
MISS_ENTRY *unknown_file_lst,
int offset,
int *errflg);
static int get_new_target(FalFontData *target, FalFontData *choose);
int int
main( argc, argv ) main( int argc, char *argv[] )
int argc;
char *argv[];
{ {
FalFontDataList *lst_m; /* font information list struct */ FalFontDataList *lst_m; /* font information list struct */
FalFontData key; /* font reference information creation struct */ FalFontData key; /* font reference information creation struct */
@ -221,12 +234,12 @@ char *argv[];
static void static void
dsp_info_list( com, dspopt, lst, unknown_file_lst, errflg ) dsp_info_list(
char *com; char *com,
int dspopt; int dspopt,
FalFontDataList *lst; FalFontDataList *lst,
MISS_ENTRY *unknown_file_lst; MISS_ENTRY *unknown_file_lst,
int *errflg ; int *errflg)
{ {
FalFontDataList srt_lst; FalFontDataList srt_lst;
int i, j ; int i, j ;
@ -428,10 +441,7 @@ int *errflg ;
static void static void
dsp_error_title(com, errflg, dspopt ) dsp_error_title(char *com, int *errflg, int dspopt)
char *com;
int *errflg ;
int dspopt ;
{ {
USAGE("\n\n" ); USAGE("\n\n" );
if( dspopt & A_OPT ) { if( dspopt & A_OPT ) {
@ -452,9 +462,7 @@ int dspopt ;
static int static int
dsp_error_files( lst, unknown ) dsp_error_files( FalFontDataList *lst, MISS_ENTRY *unknown )
FalFontDataList *lst;
MISS_ENTRY *unknown;
{ {
int i,j; int i,j;
int entry_start, entry_end; int entry_start, entry_end;
@ -504,11 +512,11 @@ MISS_ENTRY *unknown;
static void static void
sort_offset_list( flist, mask, sort_list, data_cnt ) sort_offset_list(
FalFontDataList *flist ; FalFontDataList *flist,
int mask ; int mask,
int **sort_list ; int **sort_list,
int *data_cnt ; int *data_cnt)
{ {
int *size_offset_list ; int *size_offset_list ;
int cnt, i, j ; int cnt, i, j ;
@ -586,9 +594,7 @@ int *data_cnt ;
static void static void
dsp_title( fp, dspopt ) dsp_title( FILE *fp, int dspopt )
FILE *fp;
int dspopt ;
{ {
if( dspopt & L_OPT || dspopt & X_OPT ) { if( dspopt & L_OPT || dspopt & X_OPT ) {
fprintf(fp, "\n" ) ; fprintf(fp, "\n" ) ;
@ -611,13 +617,13 @@ int dspopt ;
static void static void
dspinfo_1line( data, fp, unknown_file_lst, offset, errflg, dspopt ) dspinfo_1line(
FalFontData data; FalFontData data,
FILE *fp; FILE *fp,
MISS_ENTRY *unknown_file_lst; MISS_ENTRY *unknown_file_lst,
int offset ; int offset,
int *errflg ; int *errflg,
int dspopt ; int dspopt)
{ {
int dsp_on ; int dsp_on ;
char *namep; char *namep;
@ -682,16 +688,14 @@ int dspopt ;
static void static void
disp_no_fontslist( dspopt ) disp_no_fontslist( int dspopt )
int dspopt ;
{ {
fprintf( stdout, "\nThere are no fonts that are used for user defined character.\n" ) ; fprintf( stdout, "\nThere are no fonts that are used for user defined character.\n" ) ;
} }
static void static void
put_help( prog_name ) put_help( char *prog_name )
char *prog_name;
{ {
USAGE1("Usage : %s [-lax][-la][-lx][-C][-codeset number][-help]\n", prog_name); USAGE1("Usage : %s [-lax][-la][-lx][-C][-codeset number][-help]\n", prog_name);
USAGE("\t-l : display of file name and character size\n"); USAGE("\t-l : display of file name and character size\n");
@ -707,12 +711,12 @@ char *prog_name;
static int static int
search_fontfile_name( data, fname, unknown_file_lst, offset, errflg ) search_fontfile_name(
FalFontData data ; FalFontData data,
char *fname ; char *fname,
MISS_ENTRY *unknown_file_lst; MISS_ENTRY *unknown_file_lst,
int offset ; int offset,
int *errflg ; int *errflg)
{ {
FalFontID fid ; FalFontID fid ;
FalFontDataList *flist ; FalFontDataList *flist ;
@ -797,11 +801,8 @@ int *errflg ;
return(0) ; return(0) ;
} }
static int static int
sort_fontlist( lst ) sort_fontlist( FalFontDataList *lst )
FalFontDataList *lst;
{ {
int i,j; int i,j;
FalFontDataList srt; FalFontDataList srt;
@ -853,9 +854,7 @@ FalFontDataList *lst;
/* no sort ... 0 */ /* no sort ... 0 */
static int static int
get_new_target( target, choose ) get_new_target( FalFontData *target, FalFontData *choose )
FalFontData *target;
FalFontData *choose;
{ {
FalFontData diff; FalFontData diff;
DEF_STR_CHK ; DEF_STR_CHK ;

View file

@ -34,21 +34,12 @@
#include "udccom.h" /* 1995.10.09 */ #include "udccom.h" /* 1995.10.09 */
#include "FaLib.h" #include "FaLib.h"
typedef int INT;
typedef short int SHORT;
typedef long int LONG;
typedef char CHAR;
typedef unsigned int UINT;
typedef unsigned short USHORT;
typedef unsigned char UCHAR;
#define ON 1 #define ON 1
#define OFF 0 #define OFF 0
#define MAXPTNSIZE 128 #define MAXPTNSIZE 128
#define MAXPTNBYTE MAXPTNSIZE*((MAXPTNSIZE+7)/8) #define MAXPTNBYTE MAXPTNSIZE*((MAXPTNSIZE+7)/8)
#define ERROR_VAL fal_utyerror #define ERROR_VAL fal_utyerror
#define EXISTS_FLAG fal_utyexists #define EXISTS_FLAG fal_utyexists

View file

@ -209,12 +209,12 @@ typedef struct _FalGIInf {
#include <stdlib.h> #include <stdlib.h>
#include <dirent.h> #include <dirent.h>
#ifdef Bool #ifdef Bool
#undef Bool #undef Bool
#endif #endif
#include "snfstruct.h" #include "snfstruct.h"
#include "fontstruct.h" #include <X11/fonts/fontstruct.h>
#include "pcf.h" #include "pcf.h"
struct pcf_inf { struct pcf_inf {
@ -263,88 +263,66 @@ typedef Oak_FontInf * FalFontID; /* font distinction */
* function prototypes * function prototypes
*/ */
extern FalFontID FalOpenSysFont( extern FalFontID FalOpenSysFont(
#if NeedFunctionPrototypes
FalFontData* /* open_font_data */, FalFontData* /* open_font_data */,
int /* font_data_mask */, int /* font_data_mask */,
FalFontDataList** /* missing_font_list_return */ FalFontDataList** /* missing_font_list_return */
#endif
) ; ) ;
extern int FalGetFontList( extern int FalGetFontList(
#if NeedFunctionPrototypes
FalFontData* /* key_data */, FalFontData* /* key_data */,
int /* mask */, int /* mask */,
FalFontDataList** /* list_ret */ FalFontDataList** /* list_ret */
#endif
) ; ) ;
extern int FalFreeFontList( extern int FalFreeFontList(
#if NeedFunctionPrototypes
FalFontDataList* /* list */ FalFontDataList* /* list */
#endif
) ; ) ;
extern char * extern char *
FalReadFont( FalReadFont(
#if NeedFunctionPrototypes
FalFontID /* fid */ , FalFontID /* fid */ ,
int /* code */ , int /* code */ ,
int /* width */ , int /* width */ ,
int /* height */ int /* height */
#endif
) ; ) ;
extern int FalQueryFont( extern int FalQueryFont(
#if NeedFunctionPrototypes
FalFontID /* fid */ , FalFontID /* fid */ ,
FalFontinfo* /* fontinfo */ FalFontinfo* /* fontinfo */
#endif
) ; ) ;
extern int FalFontOfFontID( extern int FalFontOfFontID(
#if NeedFunctionPrototypes
FalFontID /* fid */, FalFontID /* fid */,
FalFontData* /* fontdata */ FalFontData* /* fontdata */
#endif
) ; ) ;
extern int FalCloseFont( extern int FalCloseFont(
#if NeedFunctionPrototypes
FalFontID /* fid */ FalFontID /* fid */
#endif
) ; ) ;
extern int FalFontIDToFileName( extern int FalFontIDToFileName(
#if NeedFunctionPrototypes
FalFontID /* fid */ , FalFontID /* fid */ ,
char** /* file_name */ char** /* file_name */
#endif
) ; ) ;
extern int FalFree( extern int FalFree(
#if NeedFunctionPrototypes
void* /* list */ void* /* list */
#endif
) ; ) ;
extern int FalGetUDCCPArea( extern int FalGetUDCCPArea(
#if NeedFunctionPrototypes
char* /* locale */ , char* /* locale */ ,
int /* code_set */ , int /* code_set */ ,
char* /* charset_str */ , char* /* charset_str */ ,
FalCodeRegion** /* cr */ , FalCodeRegion** /* cr */ ,
int* /* num_cr */ int* /* num_cr */
#endif
) ; ) ;
extern int FalGetUDCGIArea( extern int FalGetUDCGIArea(
#if NeedFunctionPrototypes
char* /* locale */ , char* /* locale */ ,
int /* codeset */ , int /* codeset */ ,
char* /* charset_str */ , char* /* charset_str */ ,
FalGlyphRegion** /* gr */ , FalGlyphRegion** /* gr */ ,
int* /* num_gr */ int* /* num_gr */
#endif
) ; ) ;
extern FalFontID FalOpenFont() ; extern FalFontID FalOpenFont() ;

View file

@ -29,6 +29,7 @@
*/ */
#include "udccom.h" #include "udccom.h"
#include "FaLib.h"
struct btophead { struct btophead {
char *in_file; char *in_file;
@ -68,17 +69,17 @@ struct ptobhead {
int bdf_width; int bdf_width;
int bdf_height; int bdf_height;
int bdf_x; int bdf_x;
int bdf_y; int bdf_y;
float bdf_point; float bdf_point;
int bdf_xdpi; int bdf_xdpi;
int reserve ; int reserve ;
int *code; int *code;
char **ptn; char **ptn;
int zoomf; int zoomf;
int code_category; int code_category;
int start_code; int start_code;
int end_code; int end_code;
@ -234,287 +235,212 @@ extern char *bdftopcf;
* Function prototypes * Function prototypes
*/ */
extern int falcom_atoi( extern int falcom_atoi(
#if NeedFunctionPrototypes
char* /* str */, char* /* str */,
char /* ed_cod */, char /* ed_cod */,
int* /* val */ int* /* val */
#endif
); );
extern int GetDefaultFile( extern int GetDefaultFile(
#if NeedFunctionPrototypes
int /* size */, int /* size */,
char* /* style */, char* /* style */,
char* /* fname */ char* /* fname */
#endif
); );
extern int get_default_file( extern int get_default_file(
#if NeedFunctionPrototypes
FILE* /* fp */, FILE* /* fp */,
int /* size */, int /* size */,
char* /* style */, char* /* style */,
char* /* fname */ char* /* fname */
#endif
); );
extern char *falcom_get_base_name( extern char *falcom_get_base_name(
#if NeedFunctionPrototypes
char* /* str */ char* /* str */
#endif
); );
extern int GetFileName( extern int GetFileName(
#if NeedFunctionPrototypes
char* /* com */, char* /* com */,
char* /* size_str */, char* /* size_str */,
char* /* style */, char* /* style */,
int /* codeset */, int /* codeset */,
char* /* ofile */ char* /* ofile */
#endif
); );
extern void ErrMsgTable_FalGetFontList( extern void ErrMsgTable_FalGetFontList(
#if NeedFunctionPrototypes
char* /* com */, char* /* com */,
int /* utyerr */, int /* utyerr */,
int /* utyderr */ int /* utyderr */
#endif
); );
extern void fal_cut_tailslash( extern void fal_cut_tailslash(
#if NeedFunctionPrototypes
char* /* name */ char* /* name */
#endif
); );
extern char *GetRealFileName( extern char *GetRealFileName(
#if NeedFunctionPrototypes
char* /* name */ char* /* name */
#endif
); );
extern int IsInRegion( extern int IsInRegion(
#if NeedFunctionPrototypes
int /* code */, int /* code */,
int /* num_gr */, int /* num_gr */,
FalGlyphRegion* /* gr */ FalGlyphRegion* /* gr */
#endif
); );
extern int GetUdcFileName( extern int GetUdcFileName(
#if NeedFunctionPrototypes
char* /* com */, char* /* com */,
int /* code_no */, int /* code_no */,
char* /* xlfdname */, char* /* xlfdname */,
char* /* fname */ char* /* fname */
#endif
); );
extern int GetUdcRegion( extern int GetUdcRegion(
#if NeedFunctionPrototypes
char* /* com */, char* /* com */,
int /* codeset */, int /* codeset */,
char* /* gpf_file */, char* /* gpf_file */,
int* /* num_gr */, int* /* num_gr */,
FalGlyphRegion** /* gr */ FalGlyphRegion** /* gr */
#endif
); );
extern int DispUdcCpArea( extern int DispUdcCpArea(
#if NeedFunctionPrototypes
FILE* /* fp */ FILE* /* fp */
#endif
); );
extern int GetUdcFontName( extern int GetUdcFontName(
#if NeedFunctionPrototypes
char* /* gpf_file */, char* /* gpf_file */,
char* /* bdf_file */, char* /* bdf_file */,
char** /* fontname */ char** /* fontname */
#endif
); );
extern int FileLock( extern int FileLock(
#if NeedFunctionPrototypes
int /* fd */ int /* fd */
#endif
); );
extern int FileUnLock( extern int FileUnLock(
#if NeedFunctionPrototypes
int /* fd */ int /* fd */
#endif
); );
extern int isLock( extern int isLock(
#if NeedFunctionPrototypes
int /* fd */ int /* fd */
#endif
); );
extern int ReadBdfHeader( extern int ReadBdfHeader(
#if NeedFunctionPrototypes
struct btophead* /* head */, struct btophead* /* head */,
char* /* buf */ char* /* buf */
#endif
); );
extern int ReadGpfHeader( extern int ReadGpfHeader(
#if NeedFunctionPrototypes
struct ptobhead* /* head */, struct ptobhead* /* head */,
char* /* buf */ char* /* buf */
#endif
); );
extern int WriteBdfHeader( extern int WriteBdfHeader(
#if NeedFunctionPrototypes
struct ptobhead* /* head */ struct ptobhead* /* head */
#endif
); );
extern void WriteGpfHeader( extern void WriteGpfHeader(
#if NeedFunctionPrototypes
struct btophead* /* head */ struct btophead* /* head */
#endif
); );
extern int WritePtnToBdf( extern int WritePtnToBdf(
#if NeedFunctionPrototypes
struct ptobhead* /* head */ struct ptobhead* /* head */
#endif
); );
extern int putDefaultChars( extern int putDefaultChars(
#if NeedFunctionPrototypes
struct ptobhead* /* head */ struct ptobhead* /* head */
#endif
); );
extern int WritePtnToGpf( extern int WritePtnToGpf(
#if NeedFunctionPrototypes
struct btophead* /* head */ struct btophead* /* head */
#endif
); );
extern int ReadBdfToMemory( extern int ReadBdfToMemory(
#if NeedFunctionPrototypes
struct btophead* /* head */, struct btophead* /* head */,
char* /* buf */ char* /* buf */
#endif
); );
extern int ReadBdfToMemory_with_init( extern int ReadBdfToMemory_with_init(
#if NeedFunctionPrototypes
struct btophead* /* head */, struct btophead* /* head */,
int /* init_start */, int /* init_start */,
int /* init_end */, int /* init_end */,
char* /* buf */ char* /* buf */
#endif
); );
extern int GetBdfCode( extern int GetBdfCode(
#if NeedFunctionPrototypes
struct btophead* /* head */, struct btophead* /* head */,
char* /* buf */, char* /* buf */,
int* /* code */ int* /* code */
#endif
); );
extern int GetBdfPtn( extern int GetBdfPtn(
#if NeedFunctionPrototypes
struct btophead* /* head */, struct btophead* /* head */,
char* /* buf */, char* /* buf */,
char* /* ptn */, char* /* ptn */,
int /* mwidth */, int /* mwidth */,
int /* bsize */ int /* bsize */
#endif
); );
extern int ReadGpfToMemory( extern int ReadGpfToMemory(
#if NeedFunctionPrototypes
struct ptobhead* /* head */, struct ptobhead* /* head */,
char* /* buf */ char* /* buf */
#endif
); );
extern int GetGpfCode( extern int GetGpfCode(
#if NeedFunctionPrototypes
struct ptobhead* /* head */, struct ptobhead* /* head */,
char* /* buf */, char* /* buf */,
int* /* code */ int* /* code */
#endif
); );
extern int GetGpfPtn( extern int GetGpfPtn(
#if NeedFunctionPrototypes
struct ptobhead* /* head */, struct ptobhead* /* head */,
char* /* buf */, char* /* buf */,
char* /* ptn */, char* /* ptn */,
int /* mwidth */, int /* mwidth */,
int /* bsize */ int /* bsize */
#endif
); );
extern void GetBdfLinePtn( extern void GetBdfLinePtn(
#if NeedFunctionPrototypes
char* /* mem */, char* /* mem */,
char* /* buf */, char* /* buf */,
int /* width */ int /* width */
#endif
); );
extern void GetGpfLinePtn( extern void GetGpfLinePtn(
#if NeedFunctionPrototypes
char* /* mem */, char* /* mem */,
char* /* buf */, char* /* buf */,
int /* width */ int /* width */
#endif
); );
extern int PutBdfPtn( extern int PutBdfPtn(
#if NeedFunctionPrototypes
unsigned char* /* ptn */, unsigned char* /* ptn */,
int /* width */, int /* width */,
int /* height */, int /* height */,
FILE* /* fp */ FILE* /* fp */
#endif
); );
extern int PutGpfPtn( extern int PutGpfPtn(
#if NeedFunctionPrototypes
char* /* ptn */, char* /* ptn */,
int /* width */, int /* width */,
int /* height */, int /* height */,
FILE* /* fp */ FILE* /* fp */
#endif
); );
extern int PtnZoom( extern int PtnZoom(
#if NeedFunctionPrototypes
char* /* dmem */, char* /* dmem */,
char* /* smem */, char* /* smem */,
int /* sw */, int /* sw */,
int /* sh */, int /* sh */,
int /* dw */, int /* dw */,
int /* dh */ int /* dh */
#endif
); );
extern char *GetTmpPath( extern char *GetTmpPath(
#if NeedFunctionPrototypes
char* /* path */ char* /* path */
#endif
); );
extern int ChkNumString( extern int ChkNumString(
#if NeedFunctionPrototypes
char* /* str */ char* /* str */
#endif
); );
extern void ErrMsgTable_AndExit( extern void ErrMsgTable_AndExit(
#if NeedFunctionPrototypes
int /* er_no */, int /* er_no */,
char* /* snf_in */, char* /* snf_in */,
char* /* snf_out */, char* /* snf_out */,
@ -522,95 +448,72 @@ extern void ErrMsgTable_AndExit(
char* /* gpf_out */, char* /* gpf_out */,
char* /* bdf_in */, char* /* bdf_in */,
char* /* prog_name */ char* /* prog_name */
#endif
); );
extern void fatal_err_msg( extern void fatal_err_msg(
#if NeedFunctionPrototypes
int /* er_no */, int /* er_no */,
char* /* prog_name */ char* /* prog_name */
#endif
); );
extern void ChatchSig() ; extern void ChatchSig() ;
extern void Put_File_Create_Err_Msg( extern void Put_File_Create_Err_Msg(
#if NeedFunctionPrototypes
int /* msg_level */, int /* msg_level */,
char* /* org_name */, char* /* org_name */,
char* /* tmp_name */, char* /* tmp_name */,
char* /* save_name */, char* /* save_name */,
char* /* com */ char* /* com */
#endif
); );
extern int Make_NewFefFile( extern int Make_NewFefFile(
#if NeedFunctionPrototypes
char* /* org_name */, char* /* org_name */,
char* /* tmp_name */, char* /* tmp_name */,
mode_t /* mode */, mode_t /* mode */,
uid_t /* owner */, uid_t /* owner */,
gid_t /* group */, gid_t /* group */,
char* /* com */ char* /* com */
#endif
); );
extern int Unlink_Tmpfile( extern int Unlink_Tmpfile(
#if NeedFunctionPrototypes
char* /* file */, char* /* file */,
char* /* com */ char* /* com */
#endif
); );
extern int Chmod_File ( extern int Chmod_File (
#if NeedFunctionPrototypes
char* /* fname */, char* /* fname */,
mode_t /* mode */, mode_t /* mode */,
char* /* com */ char* /* com */
#endif
); );
extern int Chown_File ( extern int Chown_File (
#if NeedFunctionPrototypes
char* /* fname */, char* /* fname */,
uid_t /* owner */, uid_t /* owner */,
gid_t /* group */, gid_t /* group */,
char* /* com */ char* /* com */
#endif
); );
extern int ChkPcfFontFile( extern int ChkPcfFontFile(
#if NeedFunctionPrototypes
char* /* filename */ char* /* filename */
#endif
); );
extern int ChkSnfFontFile( extern int ChkSnfFontFile(
#if NeedFunctionPrototypes
char* /* filename */ char* /* filename */
#endif
); );
extern char *get_cmd_path( extern char *get_cmd_path(
#if NeedFunctionPrototypes
char* /* path */, char* /* path */,
char* /* cmd */ char* /* cmd */
#endif
); );
extern int SetCmdPath( extern int SetCmdPath(
#if NeedFunctionPrototypes
char* /* com */, char* /* com */,
char** /* path */, char** /* path */,
char* /* dflt_path */, char* /* dflt_path */,
char* /* cmd */ char* /* cmd */
#endif
); );
extern int extern int
Link_NewFile( Link_NewFile(
#if NeedFunctionPrototypes
char * /* rd_file */, char * /* rd_file */,
char * /* wr_file */ char * /* wr_file */
#endif );
) ;

View file

@ -51,8 +51,7 @@ This is unpublished proprietary source code of FUJITSU LIMITED
******************************************************************/ ******************************************************************/
#ifndef SNFSTRUCT_H #ifndef SNFSTRUCT_H
#define SNFSTRUCT_H 1 #define SNFSTRUCT_H 1
#include "font.h" #include <X11/fonts/font.h>
#include "misc.h"
#include <X11/Xlib.h> #include <X11/Xlib.h>
/* /*
@ -87,12 +86,6 @@ This is unpublished proprietary source code of FUJITSU LIMITED
#define FONT_FILE_VERSION 4 #define FONT_FILE_VERSION 4
typedef struct _FontProp {
CARD32 name; /* offset of string */
INT32 value; /* number or offset of string */
Bool indirect; /* value is a string offset */
} FontPropRec;
/* /*
* the following macro definitions describe a font file image in memory * the following macro definitions describe a font file image in memory
*/ */
@ -106,7 +99,7 @@ typedef struct _FontProp {
* pad out glyphs to a CARD32 boundary * pad out glyphs to a CARD32 boundary
*/ */
#define ADDRXFONTPROPS( pfi) \ #define ADDRXFONTPROPS( pfi) \
((DIXFontProp *) ((char *)ADDRCHARGLYPHS( pfi) + BYTESOFGLYPHINFO(pfi))) ((DIXFontProp *) (char *)ADDRCHARGLYPHS( pfi))
#define ADDRSTRINGTAB( pfi) \ #define ADDRSTRINGTAB( pfi) \
((char *)ADDRXFONTPROPS( pfi) + BYTESOFPROPINFO(pfi)) ((char *)ADDRXFONTPROPS( pfi) + BYTESOFPROPINFO(pfi))
@ -115,7 +108,7 @@ typedef struct _FontProp {
#define BYTESOFCHARINFO(pfi) (sizeof(CharInfoRec) * n2dChars(pfi)) #define BYTESOFCHARINFO(pfi) (sizeof(CharInfoRec) * n2dChars(pfi))
#define BYTESOFPROPINFO(pfi) (sizeof(FontPropRec) * (pfi)->nProps) #define BYTESOFPROPINFO(pfi) (sizeof(FontPropRec) * (pfi)->nProps)
#define BYTESOFSTRINGINFO(pfi) ((pfi)->lenStrings) #define BYTESOFSTRINGINFO(pfi) ((pfi)->lenStrings)
#define BYTESOFGLYPHINFO(pfi) (((pfi)->maxbounds.byteOffset+3) & ~0x3)
#define BYTESOFINKINFO(pfi) (sizeof(CharInfoRec) * (2 + n2dChars(pfi))) #define BYTESOFINKINFO(pfi) (sizeof(CharInfoRec) * (2 + n2dChars(pfi)))
#endif /* SNFSTRUCT_H */ #endif /* SNFSTRUCT_H */

View file

@ -45,16 +45,6 @@
snprintf( (buf), sizeof((buf)), " -i " ) ; \ snprintf( (buf), sizeof((buf)), " -i " ) ; \
snprintf( (command), sizeof((command)), "%s %s > %s", bdftosnf, (buf), (out_file) ); \ snprintf( (command), sizeof((command)), "%s %s > %s", bdftosnf, (buf), (out_file) ); \
} }
#define COMM_SNF_FILEVERSION( snf_fd, finf, buf, permission ) { \
read( (snf_fd), (buf), sizeof(FontInfoRec) ); \
close( (snf_fd) ); \
(finf) = (FontInfoRec *) (buf) ; \
if( \
((finf)->version1 != FONT_FILE_VERSION) || \
((finf)->version2 != FONT_FILE_VERSION) \
) \
(permission) = -1 ; \
}
#define COMM_SNF_NEWTARGET( permission ) (permission) = 0 #define COMM_SNF_NEWTARGET( permission ) (permission) = 0
#define COMM_SNF_EXECLBDFTOSNF( permission, buf, snf_file ) { \ #define COMM_SNF_EXECLBDFTOSNF( permission, buf, snf_file ) { \
execl( bdftosnf, bdftosnf, "-i", 0 ); \ execl( bdftosnf, bdftosnf, "-i", 0 ); \
@ -69,20 +59,8 @@
/* case of a snf former font */ /* case of a snf former font */
#define FAL_GET_SNF_HEADER( buf, protect_key_data, fal_utyerror, fal_utyderror, fd, finf, openfontfile ) { \ #define FAL_GET_SNF_HEADER( buf, protect_key_data, fal_utyerror, fal_utyderror, fd, finf, openfontfile ) { \
(finf)->pFinf = ( FontInfoPtr )(buf); \ (finf)->pFinf = ( FontInfoPtr )(buf); \
if ( \
((finf)->pFinf->version1 != (finf)->pFinf->version2) || \
((finf)->pFinf->version1 != FONT_FILE_VERSION) \
) { \
set_errfile_str( fal_err_file, (openfontfile) ) ; \
(fal_utyerror) = _FAL_FONT_ER; \
(fal_utyderror) = 0; \
fal_utyerrno = FAL_ERR_FONT ; \
fal_utyerrno |= (FAL_FUNCNUM_OPNFNT<<8) ; \
goto FalError01 ; \
} else { \
(finf)->isFef = TRUE ; \ (finf)->isFef = TRUE ; \
(finf)->isPcf = FALSE; \ (finf)->isPcf = FALSE; \
} \
} }
/* falReadGpfProp() */ /* falReadGpfProp() */
@ -90,12 +68,6 @@
(finf)->isFef = TRUE; \ (finf)->isFef = TRUE; \
(finf)->isPcf = FALSE; \ (finf)->isPcf = FALSE; \
(finf)->pFinf = ( FontInfoPtr )(finf)->buf ; \ (finf)->pFinf = ( FontInfoPtr )(finf)->buf ; \
if ( /* not a snf or fef format */ \
((finf)->pFinf->version1 != (finf)->pFinf->version2) || \
((finf)->pFinf->version1 != FONT_FILE_VERSION) \
) { \
return _FAL_TRY_NEXT ; \
} \
} }
#define ISOPTFONT( file ) 1 #define ISOPTFONT( file ) 1

View file

@ -136,8 +136,7 @@ static XrmQuark nextUniq = -1; /* next quark from falrmUniqueQuark */
static char *neverFreeTable = NULL; static char *neverFreeTable = NULL;
static int neverFreeTableSize = 0; static int neverFreeTableSize = 0;
static char *permalloc(length) static char *permalloc(unsigned int length)
register unsigned int length;
{ {
char *ret; char *ret;
@ -155,16 +154,13 @@ static char *permalloc(length)
return(ret); return(ret);
} }
#ifndef WORD64
typedef struct {char a; double b;} TestType1; typedef struct {char a; double b;} TestType1;
typedef struct {char a; unsigned long b;} TestType2; typedef struct {char a; unsigned long b;} TestType2;
#endif
#ifdef XTHREADS #ifdef XTHREADS
static char *_falpermalloc(); static char *_falpermalloc();
char *falpermalloc(length) char *falpermalloc(unsigned int length)
unsigned int length;
{ {
char *p; char *p;
@ -177,13 +173,11 @@ char *falpermalloc(length)
static static
#endif /* XTHREADS */ #endif /* XTHREADS */
char *falpermalloc(length) char *falpermalloc(unsigned int length)
unsigned int length;
{ {
int i; int i;
if (neverFreeTableSize && length < NEVERFREETABLESIZE) { if (neverFreeTableSize && length < NEVERFREETABLESIZE) {
#ifndef WORD64
if ((sizeof(TestType1) != if ((sizeof(TestType1) !=
(sizeof(TestType2) - sizeof(unsigned long) + sizeof(double))) && (sizeof(TestType2) - sizeof(unsigned long) + sizeof(double))) &&
!(length & (DALIGN-1)) && !(length & (DALIGN-1)) &&
@ -191,7 +185,6 @@ char *falpermalloc(length)
neverFreeTableSize -= DALIGN - i; neverFreeTableSize -= DALIGN - i;
neverFreeTable += DALIGN - i; neverFreeTable += DALIGN - i;
} else } else
#endif
if (i = (NEVERFREETABLESIZE - neverFreeTableSize) & (WALIGN-1)) { if (i = (NEVERFREETABLESIZE - neverFreeTableSize) & (WALIGN-1)) {
neverFreeTableSize -= WALIGN - i; neverFreeTableSize -= WALIGN - i;
neverFreeTable += WALIGN - i; neverFreeTable += WALIGN - i;
@ -201,13 +194,13 @@ char *falpermalloc(length)
} }
static Bool static Bool
ExpandQuarkTable() ExpandQuarkTable(void)
{ {
unsigned long oldmask, newmask; unsigned long oldmask, newmask;
register char c, *s; char c, *s;
register Entry *oldentries, *entries; Entry *oldentries, *entries;
register Entry entry; Entry entry;
register int oldidx, newidx, rehash; int oldidx, newidx, rehash;
Signature sig; Signature sig;
XrmQuark q; XrmQuark q;
@ -266,42 +259,41 @@ ExpandQuarkTable()
return True; return True;
} }
#if NeedFunctionPrototypes
XrmQuark _falrmInternalStringToQuark( XrmQuark _falrmInternalStringToQuark(
register _Xconst char *name, register int len, register Signature sig, const char *name, int len, Signature sig, Bool permstring)
Bool permstring)
#else
XrmQuark _falrmInternalStringToQuark(name, len, sig, permstring)
register XrmString name;
register int len;
register Signature sig;
Bool permstring;
#endif
{ {
register XrmQuark q; XrmQuark q;
register Entry entry; Entry entry;
register int idx, rehash; int idx;
register int i; int rehash = 0;
register char *s1, *s2; int i;
char *s1, *s2;
char *new; char *new;
rehash = 0;
idx = HASH(sig); idx = HASH(sig);
_XLockMutex(_Xglobal_lock); _XLockMutex(_Xglobal_lock);
while (entry = quarkTable[idx]) { while (entry = quarkTable[idx]) {
if (entry & LARGEQUARK) if (entry & LARGEQUARK)
q = entry & (LARGEQUARK-1); q = entry & (LARGEQUARK-1);
else { else {
if ((entry - sig) & XSIGMASK) if ((entry - sig) & XSIGMASK){
goto nomatch; if (!rehash)
rehash = REHASHVAL(sig);
idx = REHASH(idx, rehash);
continue;
}
q = (entry >> QUARKSHIFT) & QUARKMASK; q = (entry >> QUARKSHIFT) & QUARKMASK;
} }
for (i = len, s1 = (char *)name, s2 = NAME(q); --i >= 0; ) { for (i = len, s1 = (char *)name, s2 = NAME(q); --i >= 0; ) {
if (*s1++ != *s2++) if (*s1++ != *s2++){
goto nomatch; if (!rehash)
rehash = REHASHVAL(sig);
idx = REHASH(idx, rehash);
continue;
}
} }
if (*s2) { if (*s2) {
nomatch: if (!rehash) if (!rehash)
rehash = REHASHVAL(sig); rehash = REHASHVAL(sig);
idx = REHASH(idx, rehash); idx = REHASH(idx, rehash);
continue; continue;
@ -316,11 +308,15 @@ nomatch: if (!rehash)
_XUnlockMutex(_Xglobal_lock); _XUnlockMutex(_Xglobal_lock);
return q; return q;
} }
if (nextUniq == nextQuark) if (nextUniq == nextQuark){
goto fail; _XUnlockMutex(_Xglobal_lock);
return NULLQUARK;
}
if ((nextQuark + (nextQuark >> 2)) > quarkMask) { if ((nextQuark + (nextQuark >> 2)) > quarkMask) {
if (!ExpandQuarkTable()) if (!ExpandQuarkTable()){
goto fail; _XUnlockMutex(_Xglobal_lock);
return NULLQUARK;
}
_XUnlockMutex(_Xglobal_lock); _XUnlockMutex(_Xglobal_lock);
return _falrmInternalStringToQuark(name, len, sig, permstring); return _falrmInternalStringToQuark(name, len, sig, permstring);
} }
@ -329,20 +325,26 @@ nomatch: if (!rehash)
if (!(q & CHUNKMASK)) { if (!(q & CHUNKMASK)) {
if (!(new = Xrealloc((char *)stringTable, if (!(new = Xrealloc((char *)stringTable,
sizeof(XrmString *) * sizeof(XrmString *) *
((q >> QUANTUMSHIFT) + CHUNKPER)))) ((q >> QUANTUMSHIFT) + CHUNKPER)))){
goto fail; _XUnlockMutex(_Xglobal_lock);
return NULLQUARK;
}
stringTable = (XrmString **)new; stringTable = (XrmString **)new;
#ifdef PERMQ #ifdef PERMQ
if (!(new = Xrealloc((char *)permTable, if (!(new = Xrealloc((char *)permTable,
sizeof(Bits *) * sizeof(Bits *) *
((q >> QUANTUMSHIFT) + CHUNKPER)))) ((q >> QUANTUMSHIFT) + CHUNKPER)))){
goto fail; _XUnlockMutex(_Xglobal_lock);
return NULLQUARK;
}
permTable = (Bits **)new; permTable = (Bits **)new;
#endif #endif
} }
new = falpermalloc(QUANTSIZE); new = falpermalloc(QUANTSIZE);
if (!new) if (!new){
goto fail; _XUnlockMutex(_Xglobal_lock);
return NULLQUARK;
}
stringTable[q >> QUANTUMSHIFT] = (XrmString *)new; stringTable[q >> QUANTUMSHIFT] = (XrmString *)new;
#ifdef PERMQ #ifdef PERMQ
permTable[q >> QUANTUMSHIFT] = (Bits *)(new + STRQUANTSIZE); permTable[q >> QUANTUMSHIFT] = (Bits *)(new + STRQUANTSIZE);
@ -355,8 +357,10 @@ nomatch: if (!rehash)
#else #else
name = permalloc(len+1); name = permalloc(len+1);
#endif #endif
if (!name) if (!name){
goto fail; _XUnlockMutex(_Xglobal_lock);
return NULLQUARK;
}
for (i = len, s1 = (char *)name; --i >= 0; ) for (i = len, s1 = (char *)name; --i >= 0; )
*s1++ = *s2++; *s1++ = *s2++;
*s1++ = '\0'; *s1++ = '\0';
@ -376,21 +380,12 @@ nomatch: if (!rehash)
nextQuark++; nextQuark++;
_XUnlockMutex(_Xglobal_lock); _XUnlockMutex(_Xglobal_lock);
return q; return q;
fail:
_XUnlockMutex(_Xglobal_lock);
return NULLQUARK;
} }
#if NeedFunctionPrototypes XrmQuark falrmStringToQuark(const char *name)
XrmQuark falrmStringToQuark(
_Xconst char *name)
#else
XrmQuark falrmStringToQuark(name)
XrmString name;
#endif
{ {
register char c, *tname; char c, *tname;
register Signature sig = 0; Signature sig = 0;
if (!name) if (!name)
return (NULLQUARK); return (NULLQUARK);
@ -401,16 +396,11 @@ XrmQuark falrmStringToQuark(name)
return _falrmInternalStringToQuark(name, tname-(char *)name-1, sig, False); return _falrmInternalStringToQuark(name, tname-(char *)name-1, sig, False);
} }
#if NeedFunctionPrototypes
XrmQuark falrmPermStringToQuark( XrmQuark falrmPermStringToQuark(
_Xconst char *name) const char *name)
#else
XrmQuark falrmPermStringToQuark(name)
XrmString name;
#endif
{ {
register char c, *tname; char c, *tname;
register Signature sig = 0; Signature sig = 0;
if (!name) if (!name)
return (NULLQUARK); return (NULLQUARK);
@ -421,7 +411,7 @@ XrmQuark falrmPermStringToQuark(name)
return _falrmInternalStringToQuark(name, tname-(char *)name-1, sig, True); return _falrmInternalStringToQuark(name, tname-(char *)name-1, sig, True);
} }
XrmQuark falrmUniqueQuark() XrmQuark falrmUniqueQuark(void)
{ {
XrmQuark q; XrmQuark q;
@ -434,8 +424,7 @@ XrmQuark falrmUniqueQuark()
return q; return q;
} }
XrmString falrmQuarkToString(quark) XrmString falrmQuarkToString(XrmQuark quark)
register XrmQuark quark;
{ {
XrmString s; XrmString s;

View file

@ -88,26 +88,10 @@ from the X Consortium.
#ifdef X_LOCALE #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 */ #define MAXLOCALE 64 /* buffer size of locale name */
#if NeedFunctionPrototypes
char * char *
_falsetlocale( _falsetlocale(int category, const char *name)
int category,
_Xconst char *name
)
#else
char *
_falsetlocale(category, name)
int category;
char *name;
#endif
{ {
static char *xsl_name; static char *xsl_name;
char *old_name; char *old_name;
@ -157,49 +141,32 @@ _falsetlocale(category, name)
*/ */
char * char *
_fallcMapOSLocaleName(osname, siname) _fallcMapOSLocaleName(char *osname, char *siname)
char *osname;
char *siname;
{ {
#if defined(hpux) || defined(CSRG_BASED) || defined(sun) || defined(SVR4) || defined(sgi) || defined(AIXV3) || defined(ultrix) || defined(WIN32) #if defined(hpux) || defined(CSRG_BASED) || defined(sun) || defined(SVR4) || \
defined(WIN32)
#ifdef hpux #ifdef hpux
#define SKIPCOUNT 2 #define SKIPCOUNT 2
#define STARTCHAR ':' #define STARTCHAR ':'
#define ENDCHAR ';' #define ENDCHAR ';'
#else #elif defined(WIN32)
#ifdef ultrix
#define SKIPCOUNT 2
#define STARTCHAR '\001'
#define ENDCHAR '\001'
#else
#ifdef WIN32
#define SKIPCOUNT 1 #define SKIPCOUNT 1
#define STARTCHAR '=' #define STARTCHAR '='
#define ENDCHAR ';' #define ENDCHAR ';'
#define WHITEFILL #define WHITEFILL
#else #elif !defined(sun) || defined(SVR4)
#if defined(AIXV3)
#define STARTCHAR ' '
#define ENDCHAR ' '
#else
#if !defined(sun) || defined(SVR4)
#define STARTCHAR '/' #define STARTCHAR '/'
#endif
#define ENDCHAR '/' #define ENDCHAR '/'
#endif
#endif
#endif
#endif #endif
char *start; char *start;
char *end; char *end;
int len; int len;
#ifdef SKIPCOUNT
int n;
#endif
start = osname; start = osname;
#ifdef SKIPCOUNT #ifdef SKIPCOUNT
int = n;
for (n = SKIPCOUNT; for (n = SKIPCOUNT;
--n >= 0 && start && (start = strchr (start, STARTCHAR)); --n >= 0 && start && (start = strchr (start, STARTCHAR));
start++) start++)

View file

@ -95,17 +95,6 @@ static CTDataRec default_ct_data[] =
{ "JISX0208.1983-0:GR", "\033$)B" }, { "JISX0208.1983-0:GR", "\033$)B" },
{ "KSC5601.1987-0:GL", "\033$(C" }, { "KSC5601.1987-0:GL", "\033$(C" },
{ "KSC5601.1987-0:GR", "\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 XctC0 0x0000
@ -154,11 +143,9 @@ typedef struct {
static CTInfo ct_list = NULL; static CTInfo ct_list = NULL;
static CTInfo static CTInfo
_XlcGetCTInfoFromEncoding(encoding, length) _XlcGetCTInfoFromEncoding(char *encoding, int length)
register char *encoding;
register int length;
{ {
register CTInfo ct_info; CTInfo ct_info;
for (ct_info = ct_list; ct_info; ct_info = ct_info->next) { for (ct_info = ct_list; ct_info; ct_info = ct_info->next) {
if (length >= ct_info->encoding_len) { if (length >= ct_info->encoding_len) {
@ -178,14 +165,11 @@ _XlcGetCTInfoFromEncoding(encoding, length)
} }
static unsigned int static unsigned int
_XlcParseCT(parse, text, length) _XlcParseCT(CTParse parse, char **text, int *length)
register CTParse parse;
char **text;
int *length;
{ {
unsigned int ret = 0; unsigned int ret = 0;
unsigned char ch; unsigned char ch;
register unsigned char *str = (unsigned char *) *text; unsigned char *str = (unsigned char *) *text;
bzero((char *) parse, sizeof(CTParseRec)); bzero((char *) parse, sizeof(CTParseRec));
@ -209,7 +193,9 @@ _XlcParseCT(parse, text, length)
parse->ext_seg_length = (*str - 128) * 128 + *(str + 1) - 128; parse->ext_seg_length = (*str - 128) * 128 + *(str + 1) - 128;
str += 2; str += 2;
goto done; *length -= (char *) str - *text;
*text = (char *) str;
return ret;
} else if (*str == XctCntrlFunc && *length >= 4 && } else if (*str == XctCntrlFunc && *length >= 4 &&
*(str + 1) >= 0x20 && *(str + 1) <= 0x2f && *(str + 1) >= 0x20 && *(str + 1) <= 0x2f &&
(*(str + 2) == XctIgnoreExt || (*(str + 2) == XctIgnoreExt ||
@ -220,7 +206,9 @@ _XlcParseCT(parse, text, length)
parse->version = *str++ - 0x20; parse->version = *str++ - 0x20;
ret = *str++; ret = *str++;
goto done; *length -= (char *) str - *text;
*text = (char *) str;
return ret;
} }
if (*str == XctMB) { /* multiple-byte sets */ if (*str == XctMB) { /* multiple-byte sets */
@ -276,21 +264,29 @@ _XlcParseCT(parse, text, length)
parse->ct_info = _XlcGetCTInfoFromEncoding(*text, *length); parse->ct_info = _XlcGetCTInfoFromEncoding(*text, *length);
} }
str++; str++;
goto done; *length -= (char *) str - *text;
*text = (char *) str;
return ret;
case XctCSI: case XctCSI:
/* direction */ /* direction */
if (*str == XctLeftToRight && *(str + 1) == XctDirection) { if (*str == XctLeftToRight && *(str + 1) == XctDirection) {
ret = XctLeftToRight; ret = XctLeftToRight;
str += 2; str += 2;
goto done; *length -= (char *) str - *text;
*text = (char *) str;
return ret;
} else if (*str == XctRightToLeft && *(str + 1) == XctDirection) { } else if (*str == XctRightToLeft && *(str + 1) == XctDirection) {
ret = XctRightToLeft; ret = XctRightToLeft;
str += 2; str += 2;
goto done; *length -= (char *) str - *text;
*text = (char *) str;
return ret;
} else if (*str == XctDirectionEnd) { } else if (*str == XctDirectionEnd) {
ret = XctDirectionEnd; ret = XctDirectionEnd;
str++; str++;
goto done; *length -= (char *) str - *text;
*text = (char *) str;
return ret;
} }
SKIP_P(str) SKIP_P(str)
@ -301,7 +297,9 @@ _XlcParseCT(parse, text, length)
ret = XctCSISeq; ret = XctCSISeq;
str++; str++;
goto done; *length -= (char *) str - *text;
*text = (char *) str;
return ret;
} }
if (ch & 0x80) { if (ch & 0x80) {
@ -318,19 +316,11 @@ _XlcParseCT(parse, text, length)
ret = XctGL; ret = XctGL;
} }
return ret;
done:
*length -= (char *) str - *text;
*text = (char *) str;
return ret; return ret;
} }
XlcCharSet XlcCharSet
_fallcAddCT(name, encoding) _fallcAddCT(char *name, char *encoding)
char *name;
char *encoding;
{ {
CTInfo ct_info; CTInfo ct_info;
XlcCharSet charset; XlcCharSet charset;
@ -381,10 +371,9 @@ _fallcAddCT(name, encoding)
} }
static CTInfo static CTInfo
_XlcGetCTInfoFromCharSet(charset) _XlcGetCTInfoFromCharSet(XlcCharSet charset)
register XlcCharSet charset;
{ {
register CTInfo ct_info; CTInfo ct_info;
for (ct_info = ct_list; ct_info; ct_info = ct_info->next) for (ct_info = ct_list; ct_info; ct_info = ct_info->next)
if (ct_info->charset == charset) if (ct_info->charset == charset)
@ -394,8 +383,7 @@ _XlcGetCTInfoFromCharSet(charset)
} }
Bool Bool
_fallcParseCharSet(charset) _fallcParseCharSet(XlcCharSet charset)
XlcCharSet charset;
{ {
CTParseRec parse; CTParseRec parse;
char *ptr, buf[BUFSIZ]; char *ptr, buf[BUFSIZ];
@ -434,11 +422,11 @@ _fallcParseCharSet(charset)
static void init_converter(); static void init_converter();
Bool Bool
_fallcInitCTInfo() _fallcInitCTInfo(void)
{ {
register XlcCharSet charset; XlcCharSet charset;
register CTData ct_data; CTData ct_data;
register int num; int num;
if (ct_list == NULL) { if (ct_list == NULL) {
num = sizeof(default_ct_data) / sizeof(CTDataRec); num = sizeof(default_ct_data) / sizeof(CTDataRec);
@ -455,10 +443,7 @@ _fallcInitCTInfo()
static int static int
_XlcCheckCTSequence(state, ctext, ctext_len) _XlcCheckCTSequence(State state, char **ctext, int *ctext_len)
State state;
char **ctext;
int *ctext_len;
{ {
XlcCharSet charset; XlcCharSet charset;
CTParseRec parse; CTParseRec parse;
@ -493,8 +478,7 @@ _XlcCheckCTSequence(state, ctext, ctext_len)
static void static void
init_state(conv) init_state(XlcConv conv)
XlcConv conv;
{ {
State state = (State) conv->state; State state = (State) conv->state;
static XlcCharSet GL_charset = NULL; static XlcCharSet GL_charset = NULL;
@ -512,17 +496,17 @@ init_state(conv)
} }
static int static int
cttocs(conv, from, from_left, to, to_left, args, num_args) cttocs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
register State state = (State) conv->state; State state = (State) conv->state;
register unsigned char ch; unsigned char ch;
int length; int length;
XlcCharSet charset = NULL; XlcCharSet charset = NULL;
char *ctptr, *bufptr; char *ctptr, *bufptr;
@ -600,19 +584,18 @@ cttocs(conv, from, from_left, to, to_left, args, num_args)
} }
static int static int
cstoct(conv, from, from_left, to, to_left, args, num_args) cstoct(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
State state = (State) conv->state; State state = (State) conv->state;
XlcSide side; XlcSide side;
unsigned char min_ch, max_ch; unsigned char min_ch, max_ch, ch;
register unsigned char ch;
int length; int length;
CTInfo ct_info; CTInfo ct_info;
XlcCharSet charset; XlcCharSet charset;
@ -711,19 +694,19 @@ cstoct(conv, from, from_left, to, to_left, args, num_args)
} }
static int static int
strtocs(conv, from, from_left, to, to_left, args, num_args) strtocs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
State state = (State) conv->state; State state = (State) conv->state;
register char *src, *dst; char *src, *dst;
unsigned char side; unsigned char side;
register length; int length;
src = (char *) *from; src = (char *) *from;
dst = (char *) *to; dst = (char *) *to;
@ -746,14 +729,14 @@ strtocs(conv, from, from_left, to, to_left, args, num_args)
} }
static int static int
cstostr(conv, from, from_left, to, to_left, args, num_args) cstostr(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
State state = (State) conv->state; State state = (State) conv->state;
char *csptr, *string_ptr; char *csptr, *string_ptr;
@ -792,8 +775,7 @@ cstostr(conv, from, from_left, to, to_left, args, num_args)
static void static void
close_converter(conv) close_converter(XlcConv conv)
XlcConv conv;
{ {
if (conv->state) if (conv->state)
Xfree((char *) conv->state); Xfree((char *) conv->state);
@ -802,29 +784,25 @@ close_converter(conv)
} }
static XlcConv static XlcConv
create_conv(methods) create_conv(XlcConvMethods methods)
XlcConvMethods methods;
{ {
register XlcConv conv; XlcConv conv;
conv = (XlcConv) Xmalloc(sizeof(XlcConvRec)); conv = (XlcConv) Xmalloc(sizeof(XlcConvRec));
if (conv == NULL) if (conv == NULL)
return (XlcConv) NULL; return (XlcConv) NULL;
conv->state = (XPointer) Xmalloc(sizeof(StateRec)); conv->state = (XPointer) Xmalloc(sizeof(StateRec));
if (conv->state == NULL) if (conv->state == NULL) {
goto err; close_converter(conv);
return (XlcConv) NULL;
}
conv->methods = methods; conv->methods = methods;
init_state(conv); init_state(conv);
return conv; return conv;
err:
close_converter(conv);
return (XlcConv) NULL;
} }
static XlcConvMethodsRec cttocs_methods = { static XlcConvMethodsRec cttocs_methods = {
@ -834,11 +812,7 @@ static XlcConvMethodsRec cttocs_methods = {
} ; } ;
static XlcConv static XlcConv
open_cttocs(from_lcd, from_type, to_lcd, to_type) open_cttocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(&cttocs_methods); return create_conv(&cttocs_methods);
} }
@ -850,11 +824,7 @@ static XlcConvMethodsRec cstoct_methods = {
} ; } ;
static XlcConv static XlcConv
open_cstoct(from_lcd, from_type, to_lcd, to_type) open_cstoct(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(&cstoct_methods); return create_conv(&cstoct_methods);
} }
@ -866,11 +836,7 @@ static XlcConvMethodsRec strtocs_methods = {
} ; } ;
static XlcConv static XlcConv
open_strtocs(from_lcd, from_type, to_lcd, to_type) open_strtocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(&strtocs_methods); return create_conv(&strtocs_methods);
} }
@ -882,17 +848,13 @@ static XlcConvMethodsRec cstostr_methods = {
} ; } ;
static XlcConv static XlcConv
open_cstostr(from_lcd, from_type, to_lcd, to_type) open_cstostr(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(&cstostr_methods); return create_conv(&cstostr_methods);
} }
static void static void
init_converter() init_converter(void)
{ {
_fallcSetConverter((XLCd) NULL, XlcNCompoundText, (XLCd) NULL, XlcNCharSet, _fallcSetConverter((XLCd) NULL, XlcNCompoundText, (XLCd) NULL, XlcNCharSet,
open_cttocs); open_cttocs);

View file

@ -51,15 +51,8 @@
#include "_fallibint.h" #include "_fallibint.h"
#include "_fallcPublic.h" #include "_fallcPublic.h"
#if NeedVarargsPrototypes
char * char *
_fallcGetCSValues(XlcCharSet charset, ...) _fallcGetCSValues(XlcCharSet charset, ...)
#else
char *
_fallcGetCSValues(charset, va_alist)
XlcCharSet charset;
va_dcl
#endif
{ {
va_list var; va_list var;
XlcArgList args; XlcArgList args;
@ -95,8 +88,7 @@ typedef struct _XlcCharSetListRec {
static XlcCharSetList charset_list = NULL; static XlcCharSetList charset_list = NULL;
XlcCharSet XlcCharSet
_fallcGetCharSet(name) _fallcGetCharSet(char *name)
char *name;
{ {
XlcCharSetList list; XlcCharSetList list;
XrmQuark xrm_name; XrmQuark xrm_name;
@ -112,8 +104,7 @@ _fallcGetCharSet(name)
} }
Bool Bool
_fallcAddCharSet(charset) _fallcAddCharSet(XlcCharSet charset)
XlcCharSet charset;
{ {
XlcCharSetList list; XlcCharSetList list;
@ -147,10 +138,7 @@ static XlcResource resources[] = {
}; };
static char * static char *
get_values(charset, args, num_args) get_values(XlcCharSet charset, XlcArgList args, int num_args)
register XlcCharSet charset;
register XlcArgList args;
register int num_args;
{ {
if (resources[0].xrm_name == NULLQUARK) if (resources[0].xrm_name == NULLQUARK)
_fallcCompileResourceList(resources, XlcNumber(resources)); _fallcCompileResourceList(resources, XlcNumber(resources));
@ -160,9 +148,7 @@ get_values(charset, args, num_args)
} }
XlcCharSet XlcCharSet
_fallcCreateDefaultCharSet(name, ct_sequence) _fallcCreateDefaultCharSet(char *name, char *ct_sequence)
char *name;
char *ct_sequence;
{ {
XlcCharSet charset; XlcCharSet charset;

View file

@ -67,20 +67,19 @@ typedef struct _fallcConverterListRec {
static XlcConverterList conv_list = NULL; static XlcConverterList conv_list = NULL;
static void static void
close_converter(conv) close_converter(XlcConv conv)
XlcConv conv;
{ {
(*conv->methods->close)(conv); (*conv->methods->close)(conv);
} }
static XlcConv static XlcConv
get_converter(from_lcd, from_type, to_lcd, to_type) get_converter(
XLCd from_lcd; XLCd from_lcd,
XrmQuark from_type; XrmQuark from_type,
XLCd to_lcd; XLCd to_lcd,
XrmQuark to_type; XrmQuark to_type)
{ {
register XlcConverterList list, prev = NULL; XlcConverterList list, prev = NULL;
XlcConv conv; XlcConv conv;
for (list = conv_list; list; list = list->next) { for (list = conv_list; list; list = list->next) {
@ -103,15 +102,15 @@ get_converter(from_lcd, from_type, to_lcd, to_type)
} }
Bool Bool
_fallcSetConverter(from_lcd, from, to_lcd, to, converter) _fallcSetConverter(
XLCd from_lcd; XLCd from_lcd,
char *from; char *from,
XLCd to_lcd; XLCd to_lcd,
char *to; char *to,
XlcOpenConverterProc converter; XlcOpenConverterProc converter)
{ {
register XlcConverterList list; XlcConverterList list;
register XrmQuark from_type, to_type; XrmQuark from_type, to_type;
from_type = falrmStringToQuark(from); from_type = falrmStringToQuark(from);
to_type = falrmStringToQuark(to); to_type = falrmStringToQuark(to);
@ -148,14 +147,14 @@ typedef struct _ConvRec {
} ConvRec, *Conv; } ConvRec, *Conv;
static int static int
indirect_convert(lc_conv, from, from_left, to, to_left, args, num_args) indirect_convert(
XlcConv lc_conv; XlcConv lc_conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
Conv conv = (Conv) lc_conv->state; Conv conv = (Conv) lc_conv->state;
XlcConv from_conv = conv->from_conv; XlcConv from_conv = conv->from_conv;
@ -205,8 +204,7 @@ indirect_convert(lc_conv, from, from_left, to, to_left, args, num_args)
} }
static void static void
close_indirect_converter(lc_conv) close_indirect_converter(XlcConv lc_conv)
XlcConv lc_conv;
{ {
Conv conv = (Conv) lc_conv->state; Conv conv = (Conv) lc_conv->state;
@ -223,8 +221,7 @@ close_indirect_converter(lc_conv)
} }
static void static void
reset_indirect_converter(lc_conv) reset_indirect_converter(XlcConv lc_conv)
XlcConv lc_conv;
{ {
Conv conv = (Conv) lc_conv->state; Conv conv = (Conv) lc_conv->state;
@ -243,11 +240,7 @@ static XlcConvMethodsRec conv_methods = {
} ; } ;
static XlcConv static XlcConv
open_indirect_converter(from_lcd, from, to_lcd, to) open_indirect_converter(XLCd from_lcd, char *from, XLCd to_lcd, char *to)
XLCd from_lcd;
char *from;
XLCd to_lcd;
char *to;
{ {
XlcConv lc_conv, from_conv, to_conv; XlcConv lc_conv, from_conv, to_conv;
Conv conv; Conv conv;
@ -274,8 +267,10 @@ open_indirect_converter(from_lcd, from, to_lcd, to)
lc_conv->methods = &conv_methods; lc_conv->methods = &conv_methods;
lc_conv->state = (XPointer) Xmalloc(sizeof(ConvRec)); lc_conv->state = (XPointer) Xmalloc(sizeof(ConvRec));
if (lc_conv->state == NULL) if (lc_conv->state == NULL){
goto err; close_indirect_converter(lc_conv);
return (XlcConv) NULL;
}
conv = (Conv) lc_conv->state; conv = (Conv) lc_conv->state;
@ -286,8 +281,10 @@ open_indirect_converter(from_lcd, from, to_lcd, to)
from_conv = get_converter((XLCd)NULL, from_type, (XLCd)NULL, QCharSet); from_conv = get_converter((XLCd)NULL, from_type, (XLCd)NULL, QCharSet);
if (from_conv == NULL) if (from_conv == NULL)
from_conv = get_converter(from_lcd, from_type, from_lcd, QChar); from_conv = get_converter(from_lcd, from_type, from_lcd, QChar);
if (from_conv == NULL) if (from_conv == NULL){
goto err; close_indirect_converter(lc_conv);
return (XlcConv) NULL;
}
conv->from_conv = from_conv; conv->from_conv = from_conv;
to_conv = get_converter(to_lcd, QCTCharSet, to_lcd, to_type); to_conv = get_converter(to_lcd, QCTCharSet, to_lcd, to_type);
@ -295,24 +292,17 @@ open_indirect_converter(from_lcd, from, to_lcd, to)
to_conv = get_converter(to_lcd, QCharSet, to_lcd, to_type); to_conv = get_converter(to_lcd, QCharSet, to_lcd, to_type);
if (to_conv == NULL) if (to_conv == NULL)
to_conv = get_converter((XLCd) NULL, QCharSet, (XLCd) NULL, to_type); to_conv = get_converter((XLCd) NULL, QCharSet, (XLCd) NULL, to_type);
if (to_conv == NULL) if (to_conv == NULL){
goto err; close_indirect_converter(lc_conv);
return (XlcConv) NULL;
}
conv->to_conv = to_conv; conv->to_conv = to_conv;
return lc_conv; return lc_conv;
err:
close_indirect_converter(lc_conv);
return (XlcConv) NULL;
} }
XlcConv XlcConv
_fallcOpenConverter(from_lcd, from, to_lcd, to) _fallcOpenConverter(XLCd from_lcd, char *from, XLCd to_lcd, char *to)
XLCd from_lcd;
char *from;
XLCd to_lcd;
char *to;
{ {
XlcConv conv; XlcConv conv;
XrmQuark from_type, to_type; XrmQuark from_type, to_type;
@ -327,29 +317,27 @@ _fallcOpenConverter(from_lcd, from, to_lcd, to)
} }
void void
_fallcCloseConverter(conv) _fallcCloseConverter(XlcConv conv)
XlcConv conv;
{ {
close_converter(conv); close_converter(conv);
} }
int int
_fallcConvert(conv, from, from_left, to, to_left, args, num_args) _fallcConvert(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
return (*conv->methods->convert)(conv, from, from_left, to, to_left, args, return (*conv->methods->convert)(conv, from, from_left, to, to_left, args,
num_args); num_args);
} }
void void
_fallcResetConverter(conv) _fallcResetConverter(XlcConv conv)
XlcConv conv;
{ {
if (conv->methods->reset) if (conv->methods->reset)
(*conv->methods->reset)(conv); (*conv->methods->reset)(conv);

View file

@ -46,21 +46,12 @@
* SOFTWARE. * SOFTWARE.
* *
*/ */
#ifndef NOT_X_ENV
#include "syncx.h" #include "syncx.h"
#include <X11/Xresource.h> #include <X11/Xresource.h>
#include "_fallibint.h" #include "_fallibint.h"
#include "_fallcPubI.h" #include "_fallcPubI.h"
#else /* NOT_X_ENV */
#define Xmalloc malloc
#define Xrealloc realloc
#define Xfree free
#endif /* NOT_X_ENV */
/* specifying NOT_X_ENV allows users to just use /* specifying NOT_X_ENV allows users to just use
the database parsing routine. */ the database parsing routine. */
/* For UDC/VW */ /* For UDC/VW */
@ -172,7 +163,7 @@ typedef struct {
static DBParseInfo parse_info; static DBParseInfo parse_info;
static void init_parse_info() static void init_parse_info(void)
{ {
static int first = 1; static int first = 1;
char *ptr; char *ptr;
@ -192,7 +183,7 @@ static void init_parse_info()
} }
static void static void
clear_parse_info() clear_parse_info(void)
{ {
int i; int i;
char *ptr; char *ptr;
@ -220,8 +211,7 @@ clear_parse_info()
} }
static Bool static Bool
realloc_parse_info(len) realloc_parse_info(int len)
int len;
{ {
char *p; char *p;
@ -245,8 +235,7 @@ typedef struct _Line {
} Line; } Line;
static void static void
free_line(line) free_line(Line *line)
Line *line;
{ {
if(line->str != NULL){ if(line->str != NULL){
Xfree(line->str); Xfree(line->str);
@ -255,9 +244,7 @@ free_line(line)
} }
static int static int
realloc_line(line, size) realloc_line(Line *line, int size)
Line *line;
int size;
{ {
char *str = line->str; char *str = line->str;
@ -279,21 +266,10 @@ realloc_line(line, size)
#define iswhite(ch) ((ch) == SYM_SPACE || (ch) == SYM_TAB) #define iswhite(ch) ((ch) == SYM_SPACE || (ch) == SYM_TAB)
static void static void
zap_comment(str, quoted) zap_comment(char *str, int *quoted)
char *str;
int *quoted;
{ {
char *p = str; char *p = str;
#ifdef never
*quoted = 0;
if(*p == SYM_COMMENT){
int len = strlen(str);
if(p[len - 1] == SYM_NEWLINE){
*p++ = SYM_NEWLINE;
}
*p = '\0';
}
#else
while(*p){ while(*p){
if(*p == SYM_DOUBLE_QUOTE){ if(*p == SYM_DOUBLE_QUOTE){
if(p == str || p[-1] != SYM_BACKSLASH){ if(p == str || p[-1] != SYM_BACKSLASH){
@ -317,13 +293,11 @@ zap_comment(str, quoted)
} }
++p; ++p;
} }
#endif
} }
static int static int
read_line(fd, line) read_line(FILE *fd, Line *line)
FILE *fd;
Line *line;
{ {
char buf[BUFSIZE], *p; char buf[BUFSIZE], *p;
int len; int len;
@ -347,7 +321,7 @@ read_line(fd, line)
if(cur + len + 1 > line->maxsize){ if(cur + len + 1 > line->maxsize){
/* need to reallocate buffer. */ /* need to reallocate buffer. */
if(! realloc_line(line, line->maxsize + BUFSIZE)){ if(! realloc_line(line, line->maxsize + BUFSIZE)){
goto err; /* realloc error. */ return -1; /* realloc error. */
} }
str = line->str; str = line->str;
} }
@ -369,19 +343,15 @@ read_line(fd, line)
} }
if(quoted){ if(quoted){
/* error. still in quoted state. */ /* error. still in quoted state. */
goto err; return -1;
} }
return line->cursize = cur; return line->cursize = cur;
err:;
return -1;
} }
/************************************************************************/ /************************************************************************/
static Token static Token
get_token(str) get_token(char *str)
char *str;
{ {
switch(*str){ switch(*str){
case SYM_NEWLINE: return T_NEWLINE; case SYM_NEWLINE: return T_NEWLINE;
@ -405,9 +375,7 @@ get_token(str)
} }
static int static int
get_word(str, word) get_word(char *str, char *word)
char *str;
char *word;
{ {
char *p = str, *w = word; char *p = str, *w = word;
Token token; Token token;
@ -435,9 +403,7 @@ get_word(str, word)
} }
static int static int
get_quoted_word(str, word) get_quoted_word(char *str, char *word)
char *str;
char *word;
{ {
char *p = str, *w = word; char *p = str, *w = word;
Token token; Token token;
@ -451,7 +417,8 @@ get_quoted_word(str, word)
token_len = token_tbl[token].len; token_len = token_tbl[token].len;
if(token == T_DOUBLE_QUOTE){ if(token == T_DOUBLE_QUOTE){
p += token_len; p += token_len;
goto found; *w = '\0';
return p - str;
} }
if(token == T_BACKSLASH){ if(token == T_BACKSLASH){
p += token_len; p += token_len;
@ -466,16 +433,12 @@ get_quoted_word(str, word)
} }
/* error. cannot detect next double quote */ /* error. cannot detect next double quote */
return 0; return 0;
found:;
*w = '\0';
return p - str;
} }
/************************************************************************/ /************************************************************************/
static int static int
append_value_list() append_value_list(void)
{ {
char **value_list = parse_info.value; char **value_list = parse_info.value;
char *value = NULL; char *value = NULL;
@ -529,7 +492,7 @@ append_value_list()
parse_info.bufsize = 0; parse_info.bufsize = 0;
return 1; return 1;
err:; err:
if(value_list){ if(value_list){
Xfree((char **)value_list); Xfree((char **)value_list);
} }
@ -544,10 +507,9 @@ append_value_list()
} }
static int static int
construct_name(name) construct_name(char *name)
char *name;
{ {
register int i, len = 0; int i, len = 0;
char *p = name; char *p = name;
for(i = 0; i <= parse_info.nest_depth; ++i){ for(i = 0; i <= parse_info.nest_depth; ++i){
@ -565,57 +527,58 @@ construct_name(name)
} }
static int static int
store_to_database(db) store_to_database(Database *db)
Database *db;
{ {
Database new = (Database)NULL; Database new = (Database)NULL;
char name[BUFSIZE]; char name[BUFSIZE];
if(parse_info.pre_state == S_VALUE){ while(1){
if(! append_value_list()){
goto err; if(parse_info.pre_state == S_VALUE){
if(! append_value_list()){
break;
}
} }
if(parse_info.name[parse_info.nest_depth] == NULL){
break;
}
new = (Database)Xmalloc(sizeof(DatabaseRec));
if(new == (Database)NULL){
break;
}
bzero(new, sizeof(DatabaseRec));
new->category = (char *)Xmalloc(strlen(parse_info.category) + 1);
if(new->category == NULL){
break;
}
strcpy(new->category, parse_info.category);
if(! construct_name(name)){
break;
}
new->name = (char *)Xmalloc(strlen(name) + 1);
if(new->name == NULL){
break;
}
strcpy(new->name, name);
new->next = *db;
new->value = parse_info.value;
new->value_num = parse_info.value_num;
*db = new;
Xfree(parse_info.name[parse_info.nest_depth]);
parse_info.name[parse_info.nest_depth] = NULL;
parse_info.value = (char **)NULL;
parse_info.value_num = 0;
parse_info.value_len = 0;
return 1;
} }
if(parse_info.name[parse_info.nest_depth] == NULL){
goto err;
}
new = (Database)Xmalloc(sizeof(DatabaseRec));
if(new == (Database)NULL){
goto err;
}
bzero(new, sizeof(DatabaseRec));
new->category = (char *)Xmalloc(strlen(parse_info.category) + 1);
if(new->category == NULL){
goto err;
}
strcpy(new->category, parse_info.category);
if(! construct_name(name)){
goto err;
}
new->name = (char *)Xmalloc(strlen(name) + 1);
if(new->name == NULL){
goto err;
}
strcpy(new->name, name);
new->next = *db;
new->value = parse_info.value;
new->value_num = parse_info.value_num;
*db = new;
Xfree(parse_info.name[parse_info.nest_depth]);
parse_info.name[parse_info.nest_depth] = NULL;
parse_info.value = (char **)NULL;
parse_info.value_num = 0;
parse_info.value_len = 0;
return 1;
err:;
if(new){ if(new){
if(new->category){ if(new->category){
Xfree(new->category); Xfree(new->category);
@ -641,8 +604,7 @@ store_to_database(db)
#define END_MARK_LEN 3 /*strlen(END_MARK)*/ #define END_MARK_LEN 3 /*strlen(END_MARK)*/
static int static int
check_category_end(str) check_category_end(char *str)
char *str;
{ {
char *p; char *p;
int len; int len;
@ -667,37 +629,28 @@ check_category_end(str)
/************************************************************************/ /************************************************************************/
static int static int
f_newline(str, token, db) f_newline(char *str, Token token, Database *db)
char *str;
Token token;
Database *db;
{ {
switch(parse_info.pre_state){ switch(parse_info.pre_state){
case S_NULL: case S_NULL:
case S_CATEGORY: case S_CATEGORY:
break; break;
case S_NAME: case S_NAME:
goto err; /* no value */ return 0; /* no value */
case S_VALUE: case S_VALUE:
if(!store_to_database(db)){ if(!store_to_database(db)){
goto err; return 0;
} }
parse_info.pre_state = S_CATEGORY; parse_info.pre_state = S_CATEGORY;
break; break;
default: default:
goto err; return 0;
} }
return token_tbl[token].len; return token_tbl[token].len;
err:;
return 0;
} }
static int static int
f_comment(str, token, db) f_comment(char *str, Token token, Database *db)
char *str;
Token token;
Database *db;
{ {
/* NOTE: comment is already handled in read_line(), /* NOTE: comment is already handled in read_line(),
so this function is not necessary. */ so this function is not necessary. */
@ -711,10 +664,7 @@ f_comment(str, token, db)
} }
static int static int
f_white(str, token, db) f_white(char *str, Token token, Database *db)
char *str;
Token token;
Database *db;
{ {
char *p = str; char *p = str;
@ -725,76 +675,61 @@ f_white(str, token, db)
} }
static int static int
f_semicolon(str, token, db) f_semicolon(char *str, Token token, Database *db)
char *str;
Token token;
Database *db;
{ {
switch(parse_info.pre_state){ switch(parse_info.pre_state){
case S_NULL: case S_NULL:
case S_CATEGORY: case S_CATEGORY:
case S_NAME: case S_NAME:
goto err; return 0;
case S_VALUE: case S_VALUE:
if(! append_value_list()){ if(! append_value_list()){
goto err; return 0;
} }
parse_info.pre_state = S_VALUE; parse_info.pre_state = S_VALUE;
break; break;
default: default:
goto err; return 0;
} }
return token_tbl[token].len; return token_tbl[token].len;
err:;
return 0;
} }
static int static int
f_left_brace(str, token, db) f_left_brace(char *str, Token token, Database *db)
char *str;
Token token;
Database *db;
{ {
switch(parse_info.pre_state){ switch(parse_info.pre_state){
case S_NULL: case S_NULL:
case S_CATEGORY: case S_CATEGORY:
goto err; return 0;
case S_NAME: case S_NAME:
if(parse_info.name[parse_info.nest_depth] == NULL || if(parse_info.name[parse_info.nest_depth] == NULL ||
parse_info.nest_depth + 1 > MAX_NAME_NEST){ parse_info.nest_depth + 1 > MAX_NAME_NEST){
goto err; return 0;
} }
++parse_info.nest_depth; ++parse_info.nest_depth;
parse_info.pre_state = S_CATEGORY; parse_info.pre_state = S_CATEGORY;
break; break;
case S_VALUE: case S_VALUE:
default: default:
goto err; return 0;
} }
return token_tbl[token].len; return token_tbl[token].len;
err:
return 0;
} }
static int static int
f_right_brace(str, token, db) f_right_brace(char *str, Token token, Database *db)
char *str;
Token token;
Database *db;
{ {
if(parse_info.nest_depth < 1){ if(parse_info.nest_depth < 1){
goto err; return 0;
} }
switch(parse_info.pre_state){ switch(parse_info.pre_state){
case S_NULL: case S_NULL:
case S_NAME: case S_NAME:
goto err; return 0;
case S_VALUE: case S_VALUE:
if(! store_to_database(db)){ if(! store_to_database(db)){
goto err; return 0;
} }
/* fall into next case */ /* fall into next case */
case S_CATEGORY: case S_CATEGORY:
@ -806,19 +741,13 @@ f_right_brace(str, token, db)
parse_info.pre_state = S_CATEGORY; parse_info.pre_state = S_CATEGORY;
break; break;
default: default:
goto err; return 0;
} }
return token_tbl[token].len; return token_tbl[token].len;
err:;
return 0;
} }
static int static int
f_double_quote(str, token, db) f_double_quote(char *str, Token token, Database *db)
char *str;
Token token;
Database *db;
{ {
char word[BUFSIZE]; char word[BUFSIZE];
int len = 0; int len = 0;
@ -826,17 +755,17 @@ f_double_quote(str, token, db)
switch(parse_info.pre_state){ switch(parse_info.pre_state){
case S_NULL: case S_NULL:
case S_CATEGORY: case S_CATEGORY:
goto err; return 0;
case S_NAME: case S_NAME:
case S_VALUE: case S_VALUE:
len = get_quoted_word(str, word); len = get_quoted_word(str, word);
if(len < 1){ if(len < 1){
goto err; return 0;
} }
if( (parse_info.bufsize + (int)strlen(word) +1) if( (parse_info.bufsize + (int)strlen(word) +1)
>= parse_info.bufMaxSize){ >= parse_info.bufMaxSize){
if(realloc_parse_info(strlen(word) +1) == False){ if(realloc_parse_info(strlen(word) +1) == False){
goto err; return 0;
} }
} }
strcpy(&parse_info.buf[parse_info.bufsize], word); strcpy(&parse_info.buf[parse_info.bufsize], word);
@ -844,28 +773,19 @@ f_double_quote(str, token, db)
parse_info.pre_state = S_VALUE; parse_info.pre_state = S_VALUE;
break; break;
default: default:
goto err; return 0;
} }
return len; /* including length of token */ return len; /* including length of token */
err:;
return 0;
} }
static int static int
f_backslash(str, token, db) f_backslash(char *str, Token token, Database *db)
char *str;
Token token;
Database *db;
{ {
return f_default(str, token, db); return f_default(str, token, db);
} }
static int static int
f_numeric(str, token, db) f_numeric(char *str, Token token, Database *db)
char *str;
Token token;
Database *db;
{ {
char word[BUFSIZE], *p; char word[BUFSIZE], *p;
int len; int len;
@ -874,19 +794,19 @@ f_numeric(str, token, db)
switch(parse_info.pre_state){ switch(parse_info.pre_state){
case S_NULL: case S_NULL:
case S_CATEGORY: case S_CATEGORY:
goto err; return 0;
case S_NAME: case S_NAME:
case S_VALUE: case S_VALUE:
token_len = token_tbl[token].len; token_len = token_tbl[token].len;
p = str + token_len; p = str + token_len;
len = get_word(p, word); len = get_word(p, word);
if(len < 1){ if(len < 1){
goto err; return 0;
} }
if( (parse_info.bufsize + token_len + (int)strlen(word) +1) if( (parse_info.bufsize + token_len + (int)strlen(word) +1)
>= parse_info.bufMaxSize){ >= parse_info.bufMaxSize){
if(realloc_parse_info(token_len + strlen(word) +1) == False){ if(realloc_parse_info(token_len + strlen(word) +1) == False){
goto err; return 0;
} }
} }
strncpy(&parse_info.buf[parse_info.bufsize], str, token_len); strncpy(&parse_info.buf[parse_info.bufsize], str, token_len);
@ -895,36 +815,30 @@ f_numeric(str, token, db)
parse_info.pre_state = S_VALUE; parse_info.pre_state = S_VALUE;
break; break;
default: default:
goto err; return 0;
} }
return len + token_len; return len + token_len;
err:;
return 0;
} }
static int static int
f_default(str, token, db) f_default(char *str, Token token, Database *db)
char *str;
Token token;
Database *db;
{ {
char word[BUFSIZE], *p; char word[BUFSIZE], *p;
int len; int len;
len = get_word(str, word); len = get_word(str, word);
if(len < 1){ if(len < 1){
goto err; return 0;
} }
switch(parse_info.pre_state){ switch(parse_info.pre_state){
case S_NULL: case S_NULL:
if(parse_info.category != NULL){ if(parse_info.category != NULL){
goto err; return 0;
} }
p = (char *)Xmalloc(strlen(word) + 1); p = (char *)Xmalloc(strlen(word) + 1);
if(p == NULL){ if(p == NULL){
goto err; return 0;
} }
strcpy(p, word); strcpy(p, word);
parse_info.category = p; parse_info.category = p;
@ -942,7 +856,7 @@ f_default(str, token, db)
} }
p = (char *)Xmalloc(strlen(word) + 1); p = (char *)Xmalloc(strlen(word) + 1);
if(p == NULL){ if(p == NULL){
goto err; return 0;
} }
strcpy(p, word); strcpy(p, word);
if(parse_info.name[parse_info.nest_depth] != NULL){ if(parse_info.name[parse_info.nest_depth] != NULL){
@ -956,7 +870,7 @@ f_default(str, token, db)
if( (parse_info.bufsize + (int)strlen(word) +1 ) if( (parse_info.bufsize + (int)strlen(word) +1 )
>= parse_info.bufMaxSize){ >= parse_info.bufMaxSize){
if(realloc_parse_info(strlen(word) +1) == False){ if(realloc_parse_info(strlen(word) +1) == False){
goto err; return 0;
} }
} }
strcpy(&parse_info.buf[parse_info.bufsize], word); strcpy(&parse_info.buf[parse_info.bufsize], word);
@ -964,20 +878,16 @@ f_default(str, token, db)
parse_info.pre_state = S_VALUE; parse_info.pre_state = S_VALUE;
break; break;
default: default:
goto err; return 0;
} }
return len; return len;
err:;
return 0;
} }
/************************************************************************/ /************************************************************************/
#ifdef DEBUG #ifdef DEBUG
static void static void
PrintDatabase(db) PrintDatabase(Database db)
Database db;
{ {
Database p = db; Database p = db;
int i = 0, j; int i = 0, j;
@ -998,8 +908,7 @@ PrintDatabase(db)
#endif #endif
static void static void
DestroyDatabase(db) DestroyDatabase(Database db)
Database db;
{ {
Database p = db; Database p = db;
@ -1023,8 +932,7 @@ DestroyDatabase(db)
} }
static int static int
CountDatabase(db) CountDatabase(Database db)
Database db;
{ {
Database p = db; Database p = db;
int cnt = 0; int cnt = 0;
@ -1037,8 +945,7 @@ CountDatabase(db)
} }
static Database static Database
CreateDatabase(dbfile) CreateDatabase(char *dbfile)
char *dbfile;
{ {
Database db = (Database)NULL; Database db = (Database)NULL;
FILE *fd; FILE *fd;
@ -1101,8 +1008,6 @@ CreateDatabase(dbfile)
/************************************************************************/ /************************************************************************/
#ifndef NOT_X_ENV
/* locale framework functions */ /* locale framework functions */
typedef struct _XlcDatabaseRec { typedef struct _XlcDatabaseRec {
@ -1129,12 +1034,12 @@ static XlcDatabaseList _db_list = (XlcDatabaseList)NULL;
/* This function retrieves XLocale database information. */ /* This function retrieves XLocale database information. */
/************************************************************************/ /************************************************************************/
void void
_fallcGetResource(lcd, category, class, value, count) _fallcGetResource(
XLCd lcd; XLCd lcd,
char *category; char *category,
char *class; char *class,
char ***value; char ***value,
int *count; int *count)
{ {
XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd); XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd);
@ -1148,12 +1053,12 @@ _fallcGetResource(lcd, category, class, value, count)
/* This function retrieves XLocale database information. */ /* This function retrieves XLocale database information. */
/************************************************************************/ /************************************************************************/
void void
_fallcGetLocaleDataBase(lcd, category, name, value, count) _fallcGetLocaleDataBase(
XLCd lcd; XLCd lcd,
char *category; char *category,
char *name; char *name,
char ***value; char ***value,
int *count; int *count)
{ {
XlcDatabase lc_db = (XlcDatabase)XLC_PUBLIC(lcd, xlocale_db); XlcDatabase lc_db = (XlcDatabase)XLC_PUBLIC(lcd, xlocale_db);
XrmQuark category_q, name_q; XrmQuark category_q, name_q;
@ -1172,7 +1077,7 @@ _fallcGetLocaleDataBase(lcd, category, name, value, count)
} }
/************************************************************************/ /************************************************************************/
/* _fallcDestroyLocaleDataBase(lcd) */ /* _fallcDestroyLocaleDataBase(lcd) */
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
/* This function destroy the XLocale Database that bound to the */ /* This function destroy the XLocale Database that bound to the */
/* specified lcd. If the XLocale Database is referred from some */ /* specified lcd. If the XLocale Database is referred from some */
@ -1181,8 +1086,7 @@ _fallcGetLocaleDataBase(lcd, category, name, value, count)
/* remove it from the cache list and free work area. */ /* remove it from the cache list and free work area. */
/************************************************************************/ /************************************************************************/
void void
_fallcDestroyLocaleDataBase(lcd) _fallcDestroyLocaleDataBase(XLCd lcd)
XLCd lcd;
{ {
XlcDatabase lc_db = (XlcDatabase)XLC_PUBLIC(lcd, xlocale_db); XlcDatabase lc_db = (XlcDatabase)XLC_PUBLIC(lcd, xlocale_db);
XlcDatabaseList p, prev; XlcDatabaseList p, prev;
@ -1215,8 +1119,7 @@ _fallcDestroyLocaleDataBase(lcd)
/* the specified XLCd. */ /* the specified XLCd. */
/************************************************************************/ /************************************************************************/
XPointer XPointer
_fallcCreateLocaleDataBase(lcd) _fallcCreateLocaleDataBase(XLCd lcd)
XLCd lcd;
{ {
XlcDatabaseList list, new; XlcDatabaseList list, new;
Database p, database = (Database)NULL; Database p, database = (Database)NULL;
@ -1247,7 +1150,11 @@ _fallcCreateLocaleDataBase(lcd)
n = CountDatabase(database); n = CountDatabase(database);
lc_db = (XlcDatabase)Xmalloc(sizeof(XlcDatabaseRec) * (n + 1)); lc_db = (XlcDatabase)Xmalloc(sizeof(XlcDatabaseRec) * (n + 1));
if(lc_db == (XlcDatabase)NULL){ if(lc_db == (XlcDatabase)NULL){
goto err; DestroyDatabase(database);
if(lc_db != (XlcDatabase)NULL){
Xfree((char *)lc_db);
}
return (XPointer)NULL;
} }
bzero(lc_db, sizeof(XlcDatabaseRec) * (n + 1)); bzero(lc_db, sizeof(XlcDatabaseRec) * (n + 1));
for(p = database, i = 0; p && i < n; p = p->next, ++i){ for(p = database, i = 0; p && i < n; p = p->next, ++i){
@ -1258,7 +1165,11 @@ _fallcCreateLocaleDataBase(lcd)
new = (XlcDatabaseList)Xmalloc(sizeof(XlcDatabaseListRec)); new = (XlcDatabaseList)Xmalloc(sizeof(XlcDatabaseListRec));
if(new == (XlcDatabaseList)NULL){ if(new == (XlcDatabaseList)NULL){
goto err; DestroyDatabase(database);
if(lc_db != (XlcDatabase)NULL){
Xfree((char *)lc_db);
}
return (XPointer)NULL;
} }
new->name_q = name_q; new->name_q = name_q;
new->lc_db = lc_db; new->lc_db = lc_db;
@ -1268,13 +1179,4 @@ _fallcCreateLocaleDataBase(lcd)
_db_list = new; _db_list = new;
return XLC_PUBLIC(lcd, xlocale_db) = (XPointer)lc_db; return XLC_PUBLIC(lcd, xlocale_db) = (XPointer)lc_db;
err:;
DestroyDatabase(database);
if(lc_db != (XlcDatabase)NULL){
Xfree((char *)lc_db);
}
return (XPointer)NULL;
} }
#endif /* NOT_X_ENV */

View file

@ -59,18 +59,18 @@ typedef struct _StateRec {
} StateRec, *State; } StateRec, *State;
static int static int
strtostr(conv, from, from_left, to, to_left, args, num_args) strtostr(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
register char *src, *dst; char *src, *dst;
unsigned char side; unsigned char side;
register length; int length;
if (from == NULL || *from == NULL) if (from == NULL || *from == NULL)
return 0; return 0;
@ -104,18 +104,18 @@ strtostr(conv, from, from_left, to, to_left, args, num_args)
} }
static int static int
wcstostr(conv, from, from_left, to, to_left, args, num_args) wcstostr(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
register wchar_t *src, side; wchar_t *src, side;
register char *dst; char *dst;
register length; int length;
if (from == NULL || *from == NULL) if (from == NULL || *from == NULL)
return 0; return 0;
@ -149,18 +149,18 @@ wcstostr(conv, from, from_left, to, to_left, args, num_args)
} }
static int static int
cstostr(conv, from, from_left, to, to_left, args, num_args) cstostr(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
register char *src, *dst; char *src, *dst;
unsigned char side; unsigned char side;
register length; int length;
if (from == NULL || *from == NULL) if (from == NULL || *from == NULL)
return 0; return 0;
@ -202,18 +202,18 @@ cstostr(conv, from, from_left, to, to_left, args, num_args)
} }
static int static int
strtowcs(conv, from, from_left, to, to_left, args, num_args) strtowcs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
register char *src; char *src;
register wchar_t *dst; wchar_t *dst;
register length; int length;
if (from == NULL || *from == NULL) if (from == NULL || *from == NULL)
return 0; return 0;
@ -244,8 +244,7 @@ strtowcs(conv, from, from_left, to, to_left, args, num_args)
static void static void
close_converter(conv) close_converter(XlcConv conv)
XlcConv conv;
{ {
if (conv->state) if (conv->state)
Xfree((char *) conv->state); Xfree((char *) conv->state);
@ -254,10 +253,9 @@ close_converter(conv)
} }
static XlcConv static XlcConv
create_conv(methods) create_conv(XlcConvMethods methods)
XlcConvMethods methods;
{ {
register XlcConv conv; XlcConv conv;
State state; State state;
static XlcCharSet GL_charset = NULL; static XlcCharSet GL_charset = NULL;
static XlcCharSet GR_charset = NULL; static XlcCharSet GR_charset = NULL;
@ -274,8 +272,10 @@ create_conv(methods)
conv->state = NULL; conv->state = NULL;
state = (State) Xmalloc(sizeof(StateRec)); state = (State) Xmalloc(sizeof(StateRec));
if (state == NULL) if (state == NULL){
goto err; close_converter(conv);
return (XlcConv) NULL;
}
state->GL_charset = state->charset = GL_charset; state->GL_charset = state->charset = GL_charset;
state->GR_charset = GR_charset; state->GR_charset = GR_charset;
@ -284,11 +284,6 @@ create_conv(methods)
conv->state = (XPointer) state; conv->state = (XPointer) state;
return conv; return conv;
err:
close_converter(conv);
return (XlcConv) NULL;
} }
static XlcConvMethodsRec strtostr_methods = { static XlcConvMethodsRec strtostr_methods = {
@ -298,11 +293,7 @@ static XlcConvMethodsRec strtostr_methods = {
} ; } ;
static XlcConv static XlcConv
open_strtostr(from_lcd, from_type, to_lcd, to_type) open_strtostr( XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type )
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(&strtostr_methods); return create_conv(&strtostr_methods);
} }
@ -314,11 +305,7 @@ static XlcConvMethodsRec wcstostr_methods = {
} ; } ;
static XlcConv static XlcConv
open_wcstostr(from_lcd, from_type, to_lcd, to_type) open_wcstostr( XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type )
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(&wcstostr_methods); return create_conv(&wcstostr_methods);
} }
@ -330,11 +317,7 @@ static XlcConvMethodsRec cstostr_methods = {
} ; } ;
static XlcConv static XlcConv
open_cstostr(from_lcd, from_type, to_lcd, to_type) open_cstostr( XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type )
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(&cstostr_methods); return create_conv(&cstostr_methods);
} }
@ -346,18 +329,13 @@ static XlcConvMethodsRec strtowcs_methods = {
} ; } ;
static XlcConv static XlcConv
open_strtowcs(from_lcd, from_type, to_lcd, to_type) open_strtowcs( XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type )
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(&strtowcs_methods); return create_conv(&strtowcs_methods);
} }
XLCd XLCd
_fallcDefaultLoader(name) _fallcDefaultLoader(char *name)
char *name;
{ {
XLCd lcd; XLCd lcd;

View file

@ -52,8 +52,7 @@ extern char *dlerror();
#define GLOBAL 0x100 #define GLOBAL 0x100
XLCd XLCd
_fallcDynamicLoader(name) _fallcDynamicLoader(char *name)
char *name;
{ {
char libpath[1024]; char libpath[1024];
XLCdMethods _fallcGenericMethods; XLCdMethods _fallcGenericMethods;

View file

@ -105,23 +105,23 @@ static CodeSet wc_codeset();
*/ */
static int static int
euc_mbstowcs(conv, from, from_left, to, to_left, args, num_args) euc_mbstowcs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
XLCd lcd = (XLCd)conv->state; XLCd lcd = (XLCd)conv->state;
register Uchar ch; Uchar ch;
register int chr_len = 0; int chr_len = 0;
register int sshift = False; int sshift = False;
register int shift_mult = 0; int shift_mult = 0;
register Uint chrcode; Uint chrcode;
Uint wc_encode = 0; Uint wc_encode = 0;
Uint wc_tmp = 0; Uint wc_tmp = 0;
@ -259,20 +259,20 @@ euc_mbstowcs(conv, from, from_left, to, to_left, args, num_args)
static int static int
euc_wcstombs(conv, from, from_left, to, to_left, args, num_args) euc_wcstombs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
wchar_t *inbufptr = (wchar_t *) *from; wchar_t *inbufptr = (wchar_t *) *from;
register XPointer outbufptr = *to; XPointer outbufptr = *to;
XPointer outbuf_base = outbufptr; XPointer outbuf_base = outbufptr;
wchar_t wch; wchar_t wch;
register length; int length;
Uchar tmp; Uchar tmp;
int num_conv; int num_conv;
int unconv_num = 0; int unconv_num = 0;
@ -324,14 +324,14 @@ euc_wcstombs(conv, from, from_left, to, to_left, args, num_args)
static int static int
euc_mbtocs(conv, from, from_left, to, to_left, args, num_args) euc_mbtocs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
XLCd lcd = (XLCd)conv->state; XLCd lcd = (XLCd)conv->state;
XlcCharSet charset; XlcCharSet charset;
@ -340,7 +340,7 @@ euc_mbtocs(conv, from, from_left, to, to_left, args, num_args)
int length; int length;
int unconv_num = 0; int unconv_num = 0;
int min_ch = 0; int min_ch = 0;
register char *src = *from, *dst = *to; char *src = *from, *dst = *to;
if (isleftside(*src)) { /* 7-bit (CS0) */ if (isleftside(*src)) { /* 7-bit (CS0) */
@ -411,14 +411,14 @@ euc_mbtocs(conv, from, from_left, to, to_left, args, num_args)
static int static int
euc_mbstocs(conv, from, from_left, to, to_left, args, num_args) euc_mbstocs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
XLCd lcd = (XLCd)conv->state; XLCd lcd = (XLCd)conv->state;
char *tmp_from, *tmp_to; char *tmp_from, *tmp_to;
@ -471,21 +471,21 @@ euc_mbstocs(conv, from, from_left, to, to_left, args, num_args)
static int static int
euc_wcstocs(conv, from, from_left, to, to_left, args, num_args) euc_wcstocs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
XLCd lcd = (XLCd)conv->state; XLCd lcd = (XLCd)conv->state;
wchar_t *wcptr = (wchar_t *) *from; wchar_t *wcptr = (wchar_t *) *from;
register char *bufptr = (char *) *to; char *bufptr = (char *) *to;
wchar_t wch; wchar_t wch;
char *tmpptr; char *tmpptr;
register length; int length;
CodeSet codeset; CodeSet codeset;
Ulong wc_encoding; Ulong wc_encoding;
int unconv_num = 0; int unconv_num = 0;
@ -533,20 +533,20 @@ euc_wcstocs(conv, from, from_left, to, to_left, args, num_args)
static int static int
euc_cstombs(conv, from, from_left, to, to_left, args, num_args) euc_cstombs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
XLCd lcd = (XLCd)conv->state; XLCd lcd = (XLCd)conv->state;
register char *csptr = *from; char *csptr = *from;
register char *bufptr = *to; char *bufptr = *to;
int csstr_len = *from_left; int csstr_len = *from_left;
register buf_len = *to_left; int buf_len = *to_left;
int length; int length;
CodeSet codeset; CodeSet codeset;
int cvt_length; int cvt_length;
@ -593,21 +593,21 @@ euc_cstombs(conv, from, from_left, to, to_left, args, num_args)
static int static int
euc_cstowcs(conv, from, from_left, to, to_left, args, num_args) euc_cstowcs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
XLCd lcd = (XLCd)conv->state; XLCd lcd = (XLCd)conv->state;
register char *csptr = *from; char *csptr = *from;
wchar_t *bufptr = (wchar_t *) *to; wchar_t *bufptr = (wchar_t *) *to;
wchar_t *toptr = (wchar_t *) *to; wchar_t *toptr = (wchar_t *) *to;
int csstr_len = *from_left; int csstr_len = *from_left;
register buf_len = *to_left; int buf_len = *to_left;
wchar_t wch; wchar_t wch;
int length; int length;
Ulong wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits); Ulong wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits);
@ -651,14 +651,12 @@ euc_cstowcs(conv, from, from_left, to, to_left, args, num_args)
static CodeSet static CodeSet
wc_codeset(lcd, wch) wc_codeset(XLCd lcd, wchar_t wch)
XLCd lcd;
wchar_t wch;
{ {
register CodeSet *codesets = XLC_GENERIC(lcd, codeset_list); CodeSet *codesets = XLC_GENERIC(lcd, codeset_list);
register int end = XLC_GENERIC(lcd, codeset_num); int end = XLC_GENERIC(lcd, codeset_num);
register Ulong widech = (Ulong)(wch & XLC_GENERIC(lcd, wc_encode_mask)); Ulong widech = (Ulong)(wch & XLC_GENERIC(lcd, wc_encode_mask));
for (; --end >= 0; codesets++) for (; --end >= 0; codesets++)
if ( widech == (*codesets)->wc_encoding ) if ( widech == (*codesets)->wc_encoding )
@ -669,13 +667,11 @@ wc_codeset(lcd, wch)
static CodeSet static CodeSet
GetCodeSetFromCharSet(lcd, charset) GetCodeSetFromCharSet(XLCd lcd, XlcCharSet charset)
XLCd lcd;
XlcCharSet charset;
{ {
register CodeSet *codeset = XLC_GENERIC(lcd, codeset_list); CodeSet *codeset = XLC_GENERIC(lcd, codeset_list);
register XlcCharSet *charset_list; XlcCharSet *charset_list;
register codeset_num, num_charsets; int codeset_num, num_charsets;
codeset_num = XLC_GENERIC(lcd, codeset_num); codeset_num = XLC_GENERIC(lcd, codeset_num);
@ -693,9 +689,7 @@ GetCodeSetFromCharSet(lcd, charset)
static XlcConv static XlcConv
create_conv(lcd, methods) create_conv(XLCd lcd, XlcConvMethods methods)
XLCd lcd;
XlcConvMethods methods;
{ {
XlcConv conv; XlcConv conv;
@ -711,7 +705,6 @@ create_conv(lcd, methods)
/* /*
* Stripped down Direct CT converters for EUC * Stripped down Direct CT converters for EUC
*
*/ */
typedef struct _CTDataRec { typedef struct _CTDataRec {
@ -775,8 +768,7 @@ static enum { Ascii, Kanji, Kana, Userdef } cs_nums;
* initCTptr(): Set ctdptr[] to point at ctdata[], indexed by codeset_num. * initCTptr(): Set ctdptr[] to point at ctdata[], indexed by codeset_num.
*/ */
static void static void
initCTptr(lcd) initCTptr(XLCd lcd)
XLCd lcd;
{ {
int num_codesets = XLC_GENERIC(lcd, codeset_num); int num_codesets = XLC_GENERIC(lcd, codeset_num);
int num_charsets; int num_charsets;
@ -829,27 +821,27 @@ initCTptr(lcd)
#define SKIP_P(str) while (*(str) >= 0x30 && *(str) <= 0x3f) (str)++; #define SKIP_P(str) while (*(str) >= 0x30 && *(str) <= 0x3f) (str)++;
static int static int
euc_ctstowcs(conv, from, from_left, to, to_left, args, num_args) euc_ctstowcs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
XLCd lcd = (XLCd)conv->state; XLCd lcd = (XLCd)conv->state;
Ulong wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits); Ulong wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits);
register XPointer inbufptr = *from; XPointer inbufptr = *from;
XPointer inbuf_base; XPointer inbuf_base;
register wchar_t *outbufptr = (wchar_t *) *to; wchar_t *outbufptr = (wchar_t *) *to;
wchar_t *outbuf_base = outbufptr; wchar_t *outbuf_base = outbufptr;
register clen, length; int clen, length;
int num_conv; int num_conv;
int unconv_num = 0; int unconv_num = 0;
unsigned int ct_seglen = 0; unsigned int ct_seglen = 0;
Uchar ct_type = 0; Uchar ct_type = 0;
register shift_mult; int shift_mult;
wchar_t wc_tmp; wchar_t wc_tmp;
wchar_t wch; wchar_t wch;
Ulong wc_encoding; Ulong wc_encoding;
@ -955,22 +947,22 @@ euc_ctstowcs(conv, from, from_left, to, to_left, args, num_args)
#define userdef (codeset->cs_num == 3) #define userdef (codeset->cs_num == 3)
static int static int
euc_wcstocts(conv, from, from_left, to, to_left, args, num_args) euc_wcstocts(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
register ct_len = *to_left; int ct_len = *to_left;
register wchar_t *inbufptr = (wchar_t *) *from; wchar_t *inbufptr = (wchar_t *) *from;
register char *ctptr = *to; char *ctptr = *to;
XPointer ct_base = ctptr; XPointer ct_base = ctptr;
wchar_t wch; wchar_t wch;
register length; int length;
register unconv_num = 0; int unconv_num = 0;
Uchar tmp; Uchar tmp;
Uchar t1 = 0, t2; Uchar t1 = 0, t2;
int num_conv; int num_conv;
@ -1085,20 +1077,20 @@ euc_wcstocts(conv, from, from_left, to, to_left, args, num_args)
#define userdef (ctdp == ctdptr[Userdef]) #define userdef (ctdp == ctdptr[Userdef])
static int static int
euc_ctstombs(conv, from, from_left, to, to_left, args, num_args) euc_ctstombs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
register XPointer inbufptr = *from; XPointer inbufptr = *from;
register XPointer outbufptr = *to; XPointer outbufptr = *to;
XPointer inbuf_base; XPointer inbuf_base;
XPointer outbuf_base = outbufptr; XPointer outbuf_base = outbufptr;
register clen, length; int clen, length;
int unconv_num = 0; int unconv_num = 0;
int num_conv; int num_conv;
unsigned int ct_seglen = 0; unsigned int ct_seglen = 0;
@ -1204,22 +1196,22 @@ euc_ctstombs(conv, from, from_left, to, to_left, args, num_args)
static int static int
euc_mbstocts(conv, from, from_left, to, to_left, args, num_args) euc_mbstocts(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
register ct_len = *to_left; int ct_len = *to_left;
int cs_num; int cs_num;
int clen, length; int clen, length;
int unconv_num = 0; int unconv_num = 0;
int num_conv; int num_conv;
XPointer inbufptr = *from; XPointer inbufptr = *from;
register char *ctptr = *to; char *ctptr = *to;
XPointer ct_base = ctptr; XPointer ct_base = ctptr;
StateRec ct_state; StateRec ct_state;
@ -1321,8 +1313,7 @@ euc_mbstocts(conv, from, from_left, to, to_left, args, num_args)
static void static void
close_converter(conv) close_converter(XlcConv conv)
XlcConv conv;
{ {
Xfree((char *) conv); Xfree((char *) conv);
} }
@ -1346,118 +1337,73 @@ static XlcConvMethodsRec conv_methods[] = {
static XlcConv static XlcConv
open_mbstocs(from_lcd, from_type, to_lcd, to_type) open_mbstocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[MBSTOCS]); return create_conv(from_lcd, &conv_methods[MBSTOCS]);
} }
static XlcConv static XlcConv
open_wcstocs(from_lcd, from_type, to_lcd, to_type) open_wcstocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[WCSTOCS]); return create_conv(from_lcd, &conv_methods[WCSTOCS]);
} }
static XlcConv static XlcConv
open_mbtocs(from_lcd, from_type, to_lcd, to_type) open_mbtocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[MBTOCS]); return create_conv(from_lcd, &conv_methods[MBTOCS]);
} }
static XlcConv static XlcConv
open_cstombs(from_lcd, from_type, to_lcd, to_type) open_cstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[CSTOMBS]); return create_conv(from_lcd, &conv_methods[CSTOMBS]);
} }
static XlcConv static XlcConv
open_cstowcs(from_lcd, from_type, to_lcd, to_type) open_cstowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[CSTOWCS]); return create_conv(from_lcd, &conv_methods[CSTOWCS]);
} }
static XlcConv static XlcConv
open_mbstowcs(from_lcd, from_type, to_lcd, to_type) open_mbstowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[MBSTOWCS]); return create_conv(from_lcd, &conv_methods[MBSTOWCS]);
} }
static XlcConv static XlcConv
open_wcstombs(from_lcd, from_type, to_lcd, to_type) open_wcstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[WCSTOMBS]); return create_conv(from_lcd, &conv_methods[WCSTOMBS]);
} }
static XlcConv static XlcConv
open_ctstowcs(from_lcd, from_type, to_lcd, to_type) open_ctstowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[CTSTOWCS]); return create_conv(from_lcd, &conv_methods[CTSTOWCS]);
} }
static XlcConv static XlcConv
open_ctstombs(from_lcd, from_type, to_lcd, to_type) open_ctstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[CTSTOMBS]); return create_conv(from_lcd, &conv_methods[CTSTOMBS]);
} }
static XlcConv static XlcConv
open_wcstocts(from_lcd, from_type, to_lcd, to_type) open_wcstocts(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[WCSTOCTS]); return create_conv(from_lcd, &conv_methods[WCSTOCTS]);
} }
static XlcConv static XlcConv
open_mbstocts(from_lcd, from_type, to_lcd, to_type) open_mbstocts(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[MBSTOCTS]); return create_conv(from_lcd, &conv_methods[MBSTOCTS]);
} }
XLCd XLCd
_fallcEucLoader(name) _fallcEucLoader(char *name)
char *name;
{ {
XLCd lcd; XLCd lcd;

View file

@ -51,9 +51,6 @@
#include "_fallibint.h" #include "_fallibint.h"
#include "_fallcPubI.h" #include "_fallcPubI.h"
#include <X11/Xos.h> #include <X11/Xos.h>
#ifdef X_NOT_STDC_ENV
extern char *getenv();
#endif
/************************************************************************/ /************************************************************************/
@ -64,10 +61,7 @@ extern char *getenv();
*/ */
static int static int
parse_line(line, argv, argsize) parse_line(char *line, char **argv, int argsize)
char *line;
char **argv;
int argsize;
{ {
int argc = 0; int argc = 0;
char *p = line; char *p = line;
@ -97,8 +91,7 @@ parse_line(line, argv, argsize)
#endif #endif
static void static void
xlocaledir(path) xlocaledir(char *path)
char *path;
{ {
char *dir, *p = path; char *dir, *p = path;
int len; int len;
@ -114,10 +107,7 @@ xlocaledir(path)
} }
static int static int
parse_path(path, argv, argsize) parse_path(char *path, char **argv, int argsize)
char *path;
char **argv;
int argsize;
{ {
char *p = path; char *p = path;
int i, n; int i, n;
@ -144,10 +134,7 @@ parse_path(path, argv, argsize)
enum { LtoR, RtoL }; enum { LtoR, RtoL };
static char * static char *
_XlcResolveName(lc_name, file_name, direction) _XlcResolveName(char *lc_name, char *file_name, int direction)/*mapping direction*/
char *lc_name;
char *file_name;
int direction; /* mapping direction */
{ {
FILE *fp; FILE *fp;
char buf[BUFSIZE], *name = NULL; char buf[BUFSIZE], *name = NULL;
@ -195,9 +182,7 @@ _XlcResolveName(lc_name, file_name, direction)
#define tolower(ch) ((ch) - 'A' + 'a') #define tolower(ch) ((ch) - 'A' + 'a')
*/ */
static char * static char *
lowercase(dst, src) lowercase(char *dst, char *src)
char *dst;
char *src;
{ {
char *s, *t; char *s, *t;
@ -210,9 +195,7 @@ lowercase(dst, src)
/************************************************************************/ /************************************************************************/
char * char *
_fallcFileName(lcd, category) _fallcFileName(XLCd lcd, char *category)
XLCd lcd;
char *category;
{ {
char lc_name[BUFSIZE]; char lc_name[BUFSIZE];
char cat[BUFSIZE], dir[BUFSIZE]; char cat[BUFSIZE], dir[BUFSIZE];
@ -267,12 +250,12 @@ _fallcFileName(lcd, category)
#endif #endif
int int
_fallcResolveLocaleName(lc_name, full_name, language, territory, codeset) _fallcResolveLocaleName(
char *lc_name; char *lc_name,
char *full_name; char *full_name,
char *language; char *language,
char *territory; char *territory,
char *codeset; char *codeset)
{ {
char dir[BUFSIZE], buf[BUFSIZE], *name = NULL; char dir[BUFSIZE], buf[BUFSIZE], *name = NULL;
int i, n; int i, n;
@ -337,9 +320,7 @@ _fallcResolveLocaleName(lc_name, full_name, language, territory, codeset)
#endif #endif
int int
_fallcResolveDBName(lc_name, file_name) _fallcResolveDBName(char *lc_name, char *file_name)
char *lc_name;
char *file_name;
{ {
char dir[BUFSIZE], buf[BUFSIZE], *name = NULL; char dir[BUFSIZE], buf[BUFSIZE], *name = NULL;
int i, n; int i, n;
@ -367,8 +348,7 @@ _fallcResolveDBName(lc_name, file_name)
/************************************************************************/ /************************************************************************/
int int
_fallcResolveI18NPath(path_name) _fallcResolveI18NPath(char *path_name)
char *path_name;
{ {
if(path_name != NULL){ if(path_name != NULL){
xlocaledir(path_name); xlocaledir(path_name);

File diff suppressed because it is too large Load diff

View file

@ -60,9 +60,9 @@
#include "_fallibint.h" #include "_fallibint.h"
#include "_fallcGeneric.h" #include "_fallcGeneric.h"
static XLCd create(); static XLCd create(char *name, XLCdMethods methods);
static Bool initialize(); static Bool initialize(XLCd lcd);
static void destroy(); static void destroy(XLCd lcd);
static XLCdPublicMethodsRec genericMethods = { static XLCdPublicMethodsRec genericMethods = {
{ NULL }, /* use default methods */ { NULL }, /* use default methods */
@ -78,9 +78,7 @@ static XLCdPublicMethodsRec genericMethods = {
XLCdMethods _fallcGenericMethods = (XLCdMethods) &genericMethods; XLCdMethods _fallcGenericMethods = (XLCdMethods) &genericMethods;
static XLCd static XLCd
create(name, methods) create(char *name, XLCdMethods methods)
char *name;
XLCdMethods methods;
{ {
XLCd lcd; XLCd lcd;
XLCdPublicMethods new; XLCdPublicMethods new;
@ -91,27 +89,25 @@ create(name, methods)
bzero((char *) lcd, sizeof(XLCdRec)); bzero((char *) lcd, sizeof(XLCdRec));
lcd->core = (XLCdCore) Xmalloc(sizeof(XLCdGenericRec)); lcd->core = (XLCdCore) Xmalloc(sizeof(XLCdGenericRec));
if (lcd->core == NULL) if (lcd->core == NULL){
goto err; Xfree(lcd);
return (XLCd) NULL;
}
bzero((char *) lcd->core, sizeof(XLCdGenericRec)); bzero((char *) lcd->core, sizeof(XLCdGenericRec));
new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec)); new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec));
if (new == NULL) if (new == NULL){
goto err; Xfree(lcd);
return (XLCd) NULL;
}
*new = *((XLCdPublicMethods) methods); *new = *((XLCdPublicMethods) methods);
lcd->methods = (XLCdMethods) new; lcd->methods = (XLCdMethods) new;
return lcd; return lcd;
err:
Xfree(lcd);
return (XLCd) NULL;
} }
static Bool static Bool
string_to_encoding(str, encoding) string_to_encoding(char *str, char *encoding)
char *str;
char *encoding;
{ {
char *next; char *next;
long value; long value;
@ -144,9 +140,7 @@ string_to_encoding(str, encoding)
} }
static Bool static Bool
string_to_ulong(str, value) string_to_ulong(char *str, unsigned long *value)
char *str;
unsigned long *value;
{ {
char *tmp1 = str; char *tmp1 = str;
int base; int base;
@ -175,9 +169,7 @@ unsigned long *value;
static Bool static Bool
add_charset(codeset, charset) add_charset(CodeSet codeset, XlcCharSet charset)
CodeSet codeset;
XlcCharSet charset;
{ {
XlcCharSet *new_list; XlcCharSet *new_list;
int num; int num;
@ -199,8 +191,7 @@ add_charset(codeset, charset)
} }
static CodeSet static CodeSet
add_codeset(gen) add_codeset(XLCdGenericPart *gen)
XLCdGenericPart *gen;
{ {
CodeSet new, *new_list; CodeSet new, *new_list;
int num; int num;
@ -216,27 +207,24 @@ add_codeset(gen)
else else
new_list = (CodeSet *) Xmalloc(sizeof(CodeSet)); new_list = (CodeSet *) Xmalloc(sizeof(CodeSet));
if (new_list == NULL) if (new_list == NULL){
goto err; Xfree(new);
return NULL;
}
new_list[num] = new; new_list[num] = new;
gen->codeset_list = new_list; gen->codeset_list = new_list;
gen->codeset_num = num + 1; gen->codeset_num = num + 1;
return new; return new;
err:
Xfree(new);
return NULL;
} }
static Bool static Bool
add_parse_list(gen, type, encoding, codeset) add_parse_list(
XLCdGenericPart *gen; XLCdGenericPart *gen,
EncodingType type; EncodingType type,
char *encoding; char *encoding,
CodeSet codeset; CodeSet codeset)
{ {
ParseInfo new, *new_list; ParseInfo new, *new_list;
char *str; char *str;
@ -249,14 +237,24 @@ add_parse_list(gen, type, encoding, codeset)
strcpy(str, encoding); strcpy(str, encoding);
new = (ParseInfo) Xmalloc(sizeof(ParseInfoRec)); new = (ParseInfo) Xmalloc(sizeof(ParseInfoRec));
if (new == NULL) if (new == NULL){
goto err; Xfree(str);
if (new)
Xfree(new);
return False;
}
bzero((char *) new, sizeof(ParseInfoRec)); bzero((char *) new, sizeof(ParseInfoRec));
if (gen->mb_parse_table == NULL) { if (gen->mb_parse_table == NULL) {
gen->mb_parse_table = (unsigned char *) Xmalloc(256); /* 2^8 */ gen->mb_parse_table = (unsigned char *) Xmalloc(256); /* 2^8 */
if (gen->mb_parse_table == NULL) if (gen->mb_parse_table == NULL){
goto err; Xfree(str);
if (new)
Xfree(new);
return False;
}
bzero((char *) gen->mb_parse_table, 256); bzero((char *) gen->mb_parse_table, 256);
} }
@ -267,8 +265,13 @@ add_parse_list(gen, type, encoding, codeset)
new_list = (ParseInfo *) Xmalloc(2 * sizeof(ParseInfo)); new_list = (ParseInfo *) Xmalloc(2 * sizeof(ParseInfo));
} }
if (new_list == NULL) if (new_list == NULL){
goto err; Xfree(str);
if (new)
Xfree(new);
return False;
}
new_list[num] = new; new_list[num] = new;
new_list[num + 1] = NULL; new_list[num + 1] = NULL;
@ -287,18 +290,10 @@ add_parse_list(gen, type, encoding, codeset)
codeset->parse_info = new; codeset->parse_info = new;
return True; return True;
err:
Xfree(str);
if (new)
Xfree(new);
return False;
} }
static void static void
free_charset(lcd) free_charset(XLCd lcd)
XLCd lcd;
{ {
XLCdGenericPart *gen = XLC_GENERIC_PART(lcd); XLCdGenericPart *gen = XLC_GENERIC_PART(lcd);
CodeSet *codeset; CodeSet *codeset;
@ -324,9 +319,7 @@ free_charset(lcd)
#define FORWARD (unsigned long)'+' #define FORWARD (unsigned long)'+'
#define BACKWARD (unsigned long)'-' #define BACKWARD (unsigned long)'-'
static char *getscope(str,scp) static char *getscope(char *str, FontScope scp)
char *str;
FontScope scp;
{ {
char buff[256],*next; char buff[256],*next;
unsigned long start=0,end=0,dest=0,shift=0,direction=0; unsigned long start=0,end=0,dest=0,shift=0,direction=0;
@ -355,8 +348,7 @@ FontScope scp;
next = str+1 ; next = str+1 ;
return(next); return(next);
} }
static int count_scopemap(str) static int count_scopemap(char *str)
char *str;
{ {
char *ptr; char *ptr;
int num=0; int num=0;
@ -367,9 +359,7 @@ char *str;
} }
return(num); return(num);
} }
FontScope falparse_scopemaps(str,size) FontScope falparse_scopemaps(char *str, int *size)
char *str;
int *size;
{ {
int num=0,i; int num=0,i;
FontScope scope,sc_ptr; FontScope scope,sc_ptr;
@ -388,25 +378,20 @@ int *size;
} }
void void
dbg_printValue(str,value,num) dbg_printValue(char *str, char **value, int num)
char *str;
char **value;
int num;
{ {
/* #ifdef DEBUG
int i; int i;
for(i=0;i<num;i++){ for(i=0;i<num;i++){
fprintf(stderr,"%s value[%d] = %s\n",str,i,value[i]); fprintf(stderr,"%s value[%d] = %s\n",str,i,value[i]);
} }
*/ #endif
} }
void void
dmpscope(name,sc,num) dmpscope(char *name, FontScope sc, int num)
FontScope sc;
int num;
{ {
/* /* should this be protected by ifdef DEBUG?
int i; int i;
fprintf(stderr,"dmpscope %s\n",name); fprintf(stderr,"dmpscope %s\n",name);
for(i=0;i<num;i++){ for(i=0;i<num;i++){
@ -420,9 +405,7 @@ int num;
*/ */
} }
static XlcCharSet srch_charset_define(name,new) static XlcCharSet srch_charset_define(char *name, int *new)
char *name;
int *new;
{ {
XlcCharSet charset = NULL; XlcCharSet charset = NULL;
*new = 0; *new = 0;
@ -436,9 +419,7 @@ int *new;
} }
static int static int
read_charset_define(lcd,gen) read_charset_define(XLCd lcd, XLCdGenericPart *gen)
XLCd lcd;
XLCdGenericPart *gen;
{ {
int i=0; int i=0;
char csd[16],cset_name[256]; char csd[16],cset_name[256];
@ -557,8 +538,7 @@ XLCdGenericPart *gen;
} }
SegConv SegConv
faladd_conversion(gen) faladd_conversion(XLCdGenericPart *gen)
XLCdGenericPart *gen;
{ {
SegConv new_list; SegConv new_list;
int num; int num;
@ -580,9 +560,7 @@ XLCdGenericPart *gen;
} }
static int static int
read_segmentconversion(lcd,gen) read_segmentconversion(XLCd lcd, XLCdGenericPart *gen)
XLCd lcd;
XLCdGenericPart *gen;
{ {
int i=0; int i=0;
char conv[16]; char conv[16];
@ -682,9 +660,7 @@ XLCdGenericPart *gen;
return 1; return 1;
} }
static ExtdSegment create_ctextseg(value,num) static ExtdSegment create_ctextseg(char **value, int num)
char **value;
int num;
{ {
ExtdSegment ret; ExtdSegment ret;
char side_str[128],*ptr; char side_str[128],*ptr;
@ -752,8 +728,7 @@ int num;
/* For VW/UDC end */ /* For VW/UDC end */
static Bool static Bool
load_generic(lcd) load_generic(XLCd lcd)
XLCd lcd;
{ {
XLCdGenericPart *gen = XLC_GENERIC_PART(lcd); XLCdGenericPart *gen = XLC_GENERIC_PART(lcd);
char **value; char **value;
@ -767,8 +742,10 @@ load_generic(lcd)
/***** wc_encoding_mask *****/ /***** wc_encoding_mask *****/
_fallcGetResource(lcd, "XLC_XLOCALE", "wc_encoding_mask", &value, &num); _fallcGetResource(lcd, "XLC_XLOCALE", "wc_encoding_mask", &value, &num);
if (num > 0) { if (num > 0) {
if (string_to_ulong(value[0], &l) == False) if (string_to_ulong(value[0], &l) == False){
goto err; free_charset(lcd);
return False;
}
gen->wc_encode_mask = l; gen->wc_encode_mask = l;
} }
/***** wc_shift_bits *****/ /***** wc_shift_bits *****/
@ -805,8 +782,10 @@ load_generic(lcd)
if (num > 0) { if (num > 0) {
char *tmp; char *tmp;
if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) if (codeset == NULL && (codeset = add_codeset(gen)) == NULL){
goto err; free_charset(lcd);
return False;
}
/* 3.4.1 side */ /* 3.4.1 side */
if( !_fallcNCompareISOLatin1(value[0], "none", 4) ){ if( !_fallcNCompareISOLatin1(value[0], "none", 4) ){
@ -831,8 +810,10 @@ load_generic(lcd)
sprintf(name, "%s.%s", cs , "length"); sprintf(name, "%s.%s", cs , "length");
_fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
if (num > 0) { if (num > 0) {
if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) if (codeset == NULL && (codeset = add_codeset(gen)) == NULL){
goto err; free_charset(lcd);
return False;
}
codeset->length = atoi(value[0]); codeset->length = atoi(value[0]);
if (codeset->length < 1) if (codeset->length < 1)
codeset->length = 1; codeset->length = 1;
@ -853,8 +834,10 @@ load_generic(lcd)
}; };
int j; int j;
if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) if (codeset == NULL && (codeset = add_codeset(gen)) == NULL){
goto err; free_charset(lcd);
return False;
}
for ( ; num-- > 0; value++) { for ( ; num-- > 0; value++) {
char encoding[256]; char encoding[256];
char *tmp = *value; char *tmp = *value;
@ -867,8 +850,10 @@ load_generic(lcd)
break; break;
} }
} }
if (string_to_encoding(tmp, encoding) == False) if (string_to_encoding(tmp, encoding) == False){
goto err; free_charset(lcd);
return False;
}
add_parse_list(gen, type, encoding, codeset); add_parse_list(gen, type, encoding, codeset);
} }
} }
@ -877,10 +862,11 @@ load_generic(lcd)
sprintf(name, "%s.%s", cs, "wc_encoding"); sprintf(name, "%s.%s", cs, "wc_encoding");
_fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
if (num > 0) { if (num > 0) {
if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) if ((codeset == NULL && (codeset = add_codeset(gen)) == NULL) || \
goto err; (string_to_ulong(value[0], &l) == False)){
if (string_to_ulong(value[0], &l) == False) free_charset(lcd);
goto err; return False;
}
codeset->wc_encoding = l; codeset->wc_encoding = l;
} }
@ -891,8 +877,10 @@ load_generic(lcd)
XlcCharSet charset; XlcCharSet charset;
char *encoding; char *encoding;
if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) if (codeset == NULL && (codeset = add_codeset(gen)) == NULL){
goto err; free_charset(lcd);
return False;
}
for ( ; num-- > 0; value++) { for ( ; num-- > 0; value++) {
string_to_encoding(*value, name); string_to_encoding(*value, name);
charset = NULL; charset = NULL;
@ -911,8 +899,10 @@ load_generic(lcd)
} }
} }
if (charset) { if (charset) {
if (add_charset(codeset, charset) == False) if (add_charset(codeset, charset) == False){
goto err; free_charset(lcd);
return False;
}
} }
} }
} }
@ -938,7 +928,8 @@ load_generic(lcd)
(ByteInfoListRec *)Xmalloc( (ByteInfoListRec *)Xmalloc(
(codeset->length)*sizeof(ByteInfoListRec)); (codeset->length)*sizeof(ByteInfoListRec));
if(codeset->byteM == NULL){ if(codeset->byteM == NULL){
goto err; free_charset(lcd);
return False;
} }
} }
@ -1008,16 +999,10 @@ load_generic(lcd)
read_segmentconversion(lcd,gen); /* For VW/UDC */ read_segmentconversion(lcd,gen); /* For VW/UDC */
return True; return True;
err:
free_charset(lcd);
return False;
} }
static Bool static Bool
initialize(lcd) initialize(XLCd lcd)
XLCd lcd;
{ {
XLCdPublicMethods superclass = (XLCdPublicMethods) _fallcPublicMethods; XLCdPublicMethods superclass = (XLCdPublicMethods) _fallcPublicMethods;
@ -1035,8 +1020,7 @@ initialize(lcd)
} }
/* VW/UDC start 95.01.08 */ /* VW/UDC start 95.01.08 */
static void static void
freeByteM(codeset) freeByteM(CodeSet codeset)
CodeSet codeset;
{ {
int i; int i;
ByteInfoList blst; ByteInfoList blst;
@ -1054,8 +1038,7 @@ freeByteM(codeset)
codeset->byteM = NULL; codeset->byteM = NULL;
} }
static void static void
freeConversion(codeset) freeConversion(CodeSet codeset)
CodeSet codeset;
{ {
int i; int i;
Conversion mbconv,ctconv; Conversion mbconv,ctconv;
@ -1081,8 +1064,7 @@ freeConversion(codeset)
} }
} }
static void static void
freeExtdSegment(codeset) freeExtdSegment(CodeSet codeset)
CodeSet codeset;
{ {
int i; int i;
ExtdSegment ctextseg; ExtdSegment ctextseg;
@ -1102,8 +1084,7 @@ freeExtdSegment(codeset)
codeset->ctextseg = NULL; codeset->ctextseg = NULL;
} }
static void static void
freeParseInfo(codeset) freeParseInfo(CodeSet codeset)
CodeSet codeset;
{ {
int i; int i;
ParseInfo parse_info; ParseInfo parse_info;
@ -1119,8 +1100,7 @@ freeParseInfo(codeset)
codeset->parse_info = NULL; codeset->parse_info = NULL;
} }
static void static void
destroy_CodeSetList(gen) destroy_CodeSetList(XLCdGenericPart *gen)
XLCdGenericPart *gen ;
{ {
CodeSet *codeset = gen->codeset_list; CodeSet *codeset = gen->codeset_list;
int i; int i;
@ -1140,10 +1120,9 @@ destroy_CodeSetList(gen)
} }
Xfree(codeset); gen->codeset_list = NULL; Xfree(codeset); gen->codeset_list = NULL;
} }
/* */
static void static void
destroy_SegConv(gen) destroy_SegConv(XLCdGenericPart *gen)
XLCdGenericPart *gen ;
{ {
SegConv seg = gen->segment_conv; SegConv seg = gen->segment_conv;
int i; int i;
@ -1167,8 +1146,7 @@ destroy_SegConv(gen)
} }
static void static void
destroy_gen(lcd) destroy_gen(XLCd lcd)
XLCd lcd;
{ {
XLCdGenericPart *gen = XLC_GENERIC_PART(lcd); XLCdGenericPart *gen = XLC_GENERIC_PART(lcd);
destroy_SegConv(gen); destroy_SegConv(gen);
@ -1184,8 +1162,7 @@ destroy_gen(lcd)
} }
/* VW/UDC end 95.01.08 */ /* VW/UDC end 95.01.08 */
static void static void
destroy(lcd) destroy(XLCd lcd)
XLCd lcd;
{ {
XLCdPublicMethods superclass = XLC_PUBLIC_METHODS(lcd)->superclass; XLCdPublicMethods superclass = XLC_PUBLIC_METHODS(lcd)->superclass;

View file

@ -153,10 +153,8 @@ typedef struct _XLCdGenericPart {
CodeSet initial_state_GR; CodeSet initial_state_GR;
int segment_conv_num; /* UDC */ int segment_conv_num; /* UDC */
SegConv segment_conv; /* UDC */ SegConv segment_conv; /* UDC */
#ifndef X_NOT_STDC_ENV
Bool use_stdc_env; Bool use_stdc_env;
Bool force_convert_to_mb; Bool force_convert_to_mb;
#endif
} XLCdGenericPart; } XLCdGenericPart;
typedef struct _XLCdGenericRec { typedef struct _XLCdGenericRec {

View file

@ -67,74 +67,50 @@
/*** #define USE_UTF_LOADER ***/ /*** #define USE_UTF_LOADER ***/
extern XLCd _fallcDefaultLoader( extern XLCd _fallcDefaultLoader(
#if NeedFunctionPrototypes
char* char*
#endif
); );
#ifdef DYNAMIC_LOAD #ifdef DYNAMIC_LOAD
#ifdef sun #ifdef sun
extern XLCd _falsunOsDynamicLoad( extern XLCd _falsunOsDynamicLoad(
#if NeedFunctionPrototypes
char* char*
#endif
); );
#endif /* sun */ #endif /* sun */
#endif /* DYNAMIC_LOAD */
#ifdef AIXV3
extern XLCd _falaixOsDynamicLoad(
#if NeedFunctionPrototypes
char*
#endif
);
#endif /* AIXV3 */
#endif
#ifdef USE_GENERIC_LOADER #ifdef USE_GENERIC_LOADER
extern XLCd _fallcGenericLoader( extern XLCd _fallcGenericLoader(
#if NeedFunctionPrototypes
char* char*
#endif
); );
#endif #endif
#ifdef USE_UTF_LOADER #ifdef USE_UTF_LOADER
extern XLCd _fallcUtfLoader( extern XLCd _fallcUtfLoader(
#if NeedFunctionPrototypes
char* char*
#endif
); );
#endif #endif
#ifdef USE_EUC_LOADER #ifdef USE_EUC_LOADER
extern XLCd _fallcEucLoader( extern XLCd _fallcEucLoader(
#if NeedFunctionPrototypes
char* char*
#endif
); );
#endif #endif
#ifdef USE_SJIS_LOADER #ifdef USE_SJIS_LOADER
extern XLCd _fallcSjisLoader( extern XLCd _fallcSjisLoader(
#if NeedFunctionPrototypes
char* char*
#endif
); );
#endif #endif
#ifdef USE_JIS_LOADER #ifdef USE_JIS_LOADER
extern XLCd _XlcJisLoader( extern XLCd _XlcJisLoader(
#if NeedFunctionPrototypes
char* char*
#endif
); );
#endif #endif
#ifdef USE_DYNAMIC_LOADER #ifdef USE_DYNAMIC_LOADER
extern XLCd _fallcDynamicLoader( extern XLCd _fallcDynamicLoader(
#if NeedFunctionPrototypes
char* char*
#endif
); );
#endif #endif
@ -144,7 +120,7 @@ extern XLCd _fallcDynamicLoader(
*/ */
void void
_fallcInitLoader() _fallcInitLoader(void)
{ {
#ifdef USE_GENERIC_LOADER #ifdef USE_GENERIC_LOADER
_fallcAddLoader(_fallcGenericLoader, XlcHead); _fallcAddLoader(_fallcGenericLoader, XlcHead);
@ -174,10 +150,6 @@ _fallcInitLoader()
#ifdef sun #ifdef sun
_fallcAddLoader(_falsunOsDynamicLoad, XlcHead); _fallcAddLoader(_falsunOsDynamicLoad, XlcHead);
#endif /* sun */ #endif /* sun */
#ifdef AIXV3
_fallcAddLoader(_falaixOsDynamicLoad, XlcHead);
#endif /* AIXV3 */
#endif /* DYNAMIC_LOAD */ #endif /* DYNAMIC_LOAD */
#ifdef USE_DYNAMIC_LOADER #ifdef USE_DYNAMIC_LOADER

View file

@ -53,10 +53,7 @@
#include <X11/Xatom.h> #include <X11/Xatom.h>
static XPointer * static XPointer *
alloc_list(is_wide_char, count, nitems) alloc_list(Bool is_wide_char, int count, int nitems)
Bool is_wide_char;
int count;
int nitems;
{ {
if (is_wide_char) { if (is_wide_char) {
wchar_t **wstr_list; wchar_t **wstr_list;
@ -90,11 +87,7 @@ alloc_list(is_wide_char, count, nitems)
} }
static void static void
copy_list(is_wide_char, text, list, count) copy_list(Bool is_wide_char, XPointer text, XPointer *list, int count)
Bool is_wide_char;
XPointer text;
XPointer *list;
int count;
{ {
int length; int length;
@ -128,13 +121,13 @@ copy_list(is_wide_char, text, list, count)
} }
static int static int
_XTextPropertyToTextList(lcd, dpy, text_prop, to_type, list_ret, count_ret) _XTextPropertyToTextList(
XLCd lcd; XLCd lcd,
Display *dpy; Display *dpy,
XTextProperty *text_prop; XTextProperty *text_prop,
char *to_type; char *to_type,
XPointer **list_ret; XPointer **list_ret,
int *count_ret; int *count_ret)
{ {
XlcConv conv; XlcConv conv;
char *from_type; char *from_type;
@ -231,33 +224,31 @@ _XTextPropertyToTextList(lcd, dpy, text_prop, to_type, list_ret, count_ret)
} }
int int
_falmbTextPropertyToTextList(lcd, dpy, text_prop, list_ret, count_ret) _falmbTextPropertyToTextList(
XLCd lcd; XLCd lcd,
Display *dpy; Display *dpy,
XTextProperty *text_prop; XTextProperty *text_prop,
char ***list_ret; char ***list_ret,
int *count_ret; int *count_ret)
{ {
return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNMultiByte, return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNMultiByte,
(XPointer **) list_ret, count_ret); (XPointer **) list_ret, count_ret);
} }
int int
_falwcTextPropertyToTextList(lcd, dpy, text_prop, list_ret, count_ret) _falwcTextPropertyToTextList(
XLCd lcd; XLCd lcd,
Display *dpy; Display *dpy,
XTextProperty *text_prop; XTextProperty *text_prop,
wchar_t ***list_ret; wchar_t ***list_ret,
int *count_ret; int *count_ret)
{ {
return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNWideChar, return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNWideChar,
(XPointer **) list_ret, count_ret); (XPointer **) list_ret, count_ret);
} }
void void
_falwcFreeStringList(lcd, list) _falwcFreeStringList(XLCd lcd, wchar_t **list)
XLCd lcd;
wchar_t **list;
{ {
if (list) { if (list) {
if (*list) if (*list)

View file

@ -63,40 +63,30 @@
typedef struct _XLCdPublicMethodsRec *XLCdPublicMethods; typedef struct _XLCdPublicMethodsRec *XLCdPublicMethods;
typedef XLCd (*XlcPubCreateProc)( typedef XLCd (*XlcPubCreateProc)(
#if NeedFunctionPrototypes
char* /* name */, char* /* name */,
XLCdMethods /* methods */ XLCdMethods /* methods */
#endif
); );
typedef Bool (*XlcPubInitializeProc)( typedef Bool (*XlcPubInitializeProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */ XLCd /* lcd */
#endif
); );
typedef void (*XlcPubDestroyProc)( typedef void (*XlcPubDestroyProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */ XLCd /* lcd */
#endif
); );
typedef char* (*XlcPubGetValuesProc)( typedef char* (*XlcPubGetValuesProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
XlcArgList /* args */, XlcArgList /* args */,
int /* num_args */ int /* num_args */
#endif
); );
typedef void (*XlcPubGetResourceProc)( typedef void (*XlcPubGetResourceProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
char* /* category */, char* /* category */,
char* /* class */, char* /* class */,
char*** /* value */, char*** /* value */,
int* /* count */ int* /* count */
#endif
); );
typedef struct _XLCdPublicMethodsPart { typedef struct _XLCdPublicMethodsPart {
@ -139,137 +129,103 @@ extern XLCdMethods _fallcPublicMethods;
_XFUNCPROTOBEGIN _XFUNCPROTOBEGIN
extern XLCd _fallcCreateLC( extern XLCd _fallcCreateLC(
#if NeedFunctionPrototypes
char* /* name */, char* /* name */,
XLCdMethods /* methods */ XLCdMethods /* methods */
#endif
); );
extern void _fallcDestroyLC( extern void _fallcDestroyLC(
#if NeedFunctionPrototypes
XLCd /* lcd */ XLCd /* lcd */
#endif
); );
extern Bool _fallcParseCharSet( extern Bool _fallcParseCharSet(
#if NeedFunctionPrototypes
XlcCharSet /* charset */ XlcCharSet /* charset */
#endif
); );
extern XlcCharSet _fallcCreateDefaultCharSet( extern XlcCharSet _fallcCreateDefaultCharSet(
#if NeedFunctionPrototypes
char* /* name */, char* /* name */,
char* /* control_sequence */ char* /* control_sequence */
#endif
); );
extern XlcCharSet _fallcAddCT( extern XlcCharSet _fallcAddCT(
#if NeedFunctionPrototypes
char* /* name */, char* /* name */,
char* /* control_sequence */ char* /* control_sequence */
#endif
); );
extern XrmMethods _falrmDefaultInitParseInfo( extern XrmMethods _falrmDefaultInitParseInfo(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
XPointer* /* state */ XPointer* /* state */
#endif
); );
extern int _falmbTextPropertyToTextList( extern int _falmbTextPropertyToTextList(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
Display* /* dpy */, Display* /* dpy */,
XTextProperty* /* text_prop */, XTextProperty* /* text_prop */,
char*** /* list_ret */, char*** /* list_ret */,
int* /* count_ret */ int* /* count_ret */
#endif
); );
extern int _falwcTextPropertyToTextList( extern int _falwcTextPropertyToTextList(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
Display* /* dpy */, Display* /* dpy */,
XTextProperty* /* text_prop */, XTextProperty* /* text_prop */,
wchar_t*** /* list_ret */, wchar_t*** /* list_ret */,
int* /* count_ret */ int* /* count_ret */
#endif
); );
extern int _falmbTextListToTextProperty( extern int _falmbTextListToTextProperty(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
Display* /* dpy */, Display* /* dpy */,
char** /* list */, char** /* list */,
int /* count */, int /* count */,
XICCEncodingStyle /* style */, XICCEncodingStyle /* style */,
XTextProperty* /* text_prop */ XTextProperty* /* text_prop */
#endif
); );
extern int _falwcTextListToTextProperty( extern int _falwcTextListToTextProperty(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
Display* /* dpy */, Display* /* dpy */,
wchar_t** /* list */, wchar_t** /* list */,
int /* count */, int /* count */,
XICCEncodingStyle /* style */, XICCEncodingStyle /* style */,
XTextProperty* /* text_prop */ XTextProperty* /* text_prop */
#endif
); );
extern void _falwcFreeStringList( extern void _falwcFreeStringList(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
wchar_t** /* list */ wchar_t** /* list */
#endif
); );
extern int _fallcResolveLocaleName( extern int _fallcResolveLocaleName(
#if NeedFunctionPrototypes
char* /* lc_name */, char* /* lc_name */,
char* /* full_name */, char* /* full_name */,
char* /* language */, char* /* language */,
char* /* territory */, char* /* territory */,
char* /* codeset */ char* /* codeset */
#endif
); );
extern int _fallcResolveDBName( extern int _fallcResolveDBName(
#if NeedFunctionPrototypes
char* /* lc_name */, char* /* lc_name */,
char* /* file_name */ char* /* file_name */
#endif
); );
extern int _fallcResolveI18NPath( extern int _fallcResolveI18NPath(
#if NeedFunctionPrototypes
char* /* path_name */ char* /* path_name */
#endif
); );
extern XPointer _fallcCreateLocaleDataBase( extern XPointer _fallcCreateLocaleDataBase(
#if NeedFunctionPrototypes
XLCd /* lcd */ XLCd /* lcd */
#endif
); );
extern void _fallcDestroyLocaleDataBase( extern void _fallcDestroyLocaleDataBase(
#if NeedFunctionPrototypes
XLCd /* lcd */ XLCd /* lcd */
#endif
); );
extern void _fallcGetLocaleDataBase( extern void _fallcGetLocaleDataBase(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
char* /* category */, char* /* category */,
char* /* name */, char* /* name */,
char*** /* value */, char*** /* value */,
int* /* count */ int* /* count */
#endif
); );
_XFUNCPROTOEND _XFUNCPROTOEND

View file

@ -50,15 +50,8 @@
#include "_fallibint.h" #include "_fallibint.h"
#include "_fallcPubI.h" #include "_fallcPubI.h"
#if NeedVarargsPrototypes
char * char *
_falGetLCValues(XLCd lcd, ...) _falGetLCValues(XLCd lcd, ...)
#else
char *
_falGetLCValues(lcd, va_alist)
XLCd lcd;
va_dcl
#endif
{ {
va_list var; va_list var;
XlcArgList args; XlcArgList args;
@ -85,8 +78,7 @@ _falGetLCValues(lcd, va_alist)
} }
void void
_fallcDestroyLC(lcd) _fallcDestroyLC(XLCd lcd)
XLCd lcd;
{ {
XLCdPublicMethods methods = (XLCdPublicMethods) lcd->methods; XLCdPublicMethods methods = (XLCdPublicMethods) lcd->methods;
@ -94,9 +86,7 @@ _fallcDestroyLC(lcd)
} }
XLCd XLCd
_fallcCreateLC(name, methods) _fallcCreateLC(char *name, XLCdMethods methods)
char *name;
XLCdMethods methods;
{ {
XLCdPublicMethods pub_methods = (XLCdPublicMethods) methods; XLCdPublicMethods pub_methods = (XLCdPublicMethods) methods;
XLCd lcd; XLCd lcd;
@ -107,21 +97,21 @@ _fallcCreateLC(name, methods)
if (lcd->core->name == NULL) { if (lcd->core->name == NULL) {
lcd->core->name = (char*) Xmalloc(strlen(name) + 1); lcd->core->name = (char*) Xmalloc(strlen(name) + 1);
if (lcd->core->name == NULL) if (lcd->core->name == NULL) {
goto err; _fallcDestroyLC(lcd);
return (XLCd) NULL;
}
strcpy(lcd->core->name, name); strcpy(lcd->core->name, name);
} }
if (lcd->methods == NULL) if (lcd->methods == NULL)
lcd->methods = methods; lcd->methods = methods;
if ((*pub_methods->pub.initialize)(lcd) == False) if ((*pub_methods->pub.initialize)(lcd) == False) {
goto err; _fallcDestroyLC(lcd);
return (XLCd) NULL;
}
return lcd; return lcd;
err:
_fallcDestroyLC(lcd);
return (XLCd) NULL;
} }

View file

@ -87,16 +87,13 @@ static XLCdPublicMethodsRec publicMethods = {
XLCdMethods _fallcPublicMethods = (XLCdMethods) &publicMethods; XLCdMethods _fallcPublicMethods = (XLCdMethods) &publicMethods;
static char * static char *
default_string(lcd) default_string(XLCd lcd)
XLCd lcd;
{ {
return XLC_PUBLIC(lcd, default_string); return XLC_PUBLIC(lcd, default_string);
} }
static XLCd static XLCd
create(name, methods) create(char *name, XLCdMethods methods)
char *name;
XLCdMethods methods;
{ {
XLCd lcd; XLCd lcd;
XLCdPublicMethods new; XLCdPublicMethods new;
@ -107,26 +104,25 @@ create(name, methods)
bzero((char *) lcd, sizeof(XLCdRec)); bzero((char *) lcd, sizeof(XLCdRec));
lcd->core = (XLCdCore) Xmalloc(sizeof(XLCdPublicRec)); lcd->core = (XLCdCore) Xmalloc(sizeof(XLCdPublicRec));
if (lcd->core == NULL) if (lcd->core == NULL){
goto err; Xfree(lcd);
return (XLCd) NULL;
}
bzero((char *) lcd->core, sizeof(XLCdPublicRec)); bzero((char *) lcd->core, sizeof(XLCdPublicRec));
new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec)); new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec));
if (new == NULL) if (new == NULL){
goto err; Xfree(lcd);
return (XLCd) NULL;
}
*new = *((XLCdPublicMethods) methods); *new = *((XLCdPublicMethods) methods);
lcd->methods = (XLCdMethods) new; lcd->methods = (XLCdMethods) new;
return lcd; return lcd;
err:
Xfree(lcd);
return (XLCd) NULL;
} }
static Bool static Bool
load_public(lcd) load_public(XLCd lcd)
XLCd lcd;
{ {
XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd); XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd);
char **values, *str; char **values, *str;
@ -160,8 +156,7 @@ load_public(lcd)
} }
static Bool static Bool
initialize_core(lcd) initialize_core(XLCd lcd)
XLCd lcd;
{ {
XLCdMethods methods = lcd->methods; XLCdMethods methods = lcd->methods;
XLCdMethods core = &publicMethods.core; XLCdMethods core = &publicMethods.core;
@ -202,8 +197,7 @@ initialize_core(lcd)
extern Bool _fallcInitCTInfo(); extern Bool _fallcInitCTInfo();
static Bool static Bool
initialize(lcd) initialize(XLCd lcd)
XLCd lcd;
{ {
XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd); XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd);
XLCdPublicMethodsPart *pub_methods = &publicMethods.pub; XLCdPublicMethodsPart *pub_methods = &publicMethods.pub;
@ -261,8 +255,7 @@ initialize(lcd)
} }
static void static void
destroy_core(lcd) destroy_core(XLCd lcd)
XLCd lcd;
{ {
if (lcd->core) { if (lcd->core) {
if (lcd->core->name) if (lcd->core->name)
@ -277,8 +270,7 @@ destroy_core(lcd)
} }
static void static void
destroy(lcd) destroy(XLCd lcd)
XLCd lcd;
{ {
XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd); XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd);
@ -310,10 +302,7 @@ static XlcResource resources[] = {
}; };
static char * static char *
get_values(lcd, args, num_args) get_values(XLCd lcd, XlcArgList args, int num_args)
register XLCd lcd;
register XlcArgList args;
register int num_args;
{ {
XLCdPublic pub = (XLCdPublic) lcd->core; XLCdPublic pub = (XLCdPublic) lcd->core;

View file

@ -92,11 +92,9 @@ typedef struct _UDCArea {
typedef struct _XlcCharSetRec *XlcCharSet; typedef struct _XlcCharSetRec *XlcCharSet;
typedef char* (*XlcGetCSValuesProc)( typedef char* (*XlcGetCSValuesProc)(
#if NeedFunctionPrototypes
XlcCharSet /* charset */, XlcCharSet /* charset */,
XlcArgList /* args */, XlcArgList /* args */,
int /* num_args */ int /* num_args */
#endif
); );
typedef struct _XlcCharSetRec { typedef struct _XlcCharSetRec {
@ -122,22 +120,17 @@ typedef struct _XlcCharSetRec {
typedef struct _XlcConvRec *XlcConv; typedef struct _XlcConvRec *XlcConv;
typedef XlcConv (*XlcOpenConverterProc)( typedef XlcConv (*XlcOpenConverterProc)(
#if NeedFunctionPrototypes
XLCd /* from_lcd */, XLCd /* from_lcd */,
char* /* from_type */, char* /* from_type */,
XLCd /* to_lcd */, XLCd /* to_lcd */,
char* /* to_type */ char* /* to_type */
#endif
); );
typedef void (*XlcCloseConverterProc)( typedef void (*XlcCloseConverterProc)(
#if NeedFunctionPrototypes
XlcConv /* conv */ XlcConv /* conv */
#endif
); );
typedef int (*XlcConvertProc)( typedef int (*XlcConvertProc)(
#if NeedFunctionPrototypes
XlcConv /* conv */, XlcConv /* conv */,
XPointer* /* from */, XPointer* /* from */,
int* /* from_left */, int* /* from_left */,
@ -145,13 +138,10 @@ typedef int (*XlcConvertProc)(
int* /* to_left */, int* /* to_left */,
XPointer* /* args */, XPointer* /* args */,
int /* num_args */ int /* num_args */
#endif
); );
typedef void (*XlcResetConverterProc)( typedef void (*XlcResetConverterProc)(
#if NeedFunctionPrototypes
XlcConv /* conv */ XlcConv /* conv */
#endif
); );
typedef struct _XlcConvMethodsRec{ typedef struct _XlcConvMethodsRec{
@ -181,60 +171,43 @@ typedef struct _XlcConvRec {
_XFUNCPROTOBEGIN _XFUNCPROTOBEGIN
extern Bool _falInitOM( extern Bool _falInitOM(
#if NeedFunctionPrototypes
XLCd /* lcd */ XLCd /* lcd */
#endif
); );
extern Bool _XInitIM( extern Bool _XInitIM(
#if NeedFunctionPrototypes
XLCd /* lcd */ XLCd /* lcd */
#endif
); );
extern char *_falGetLCValues( extern char *_falGetLCValues(
#if NeedVarargsPrototypes
XLCd /* lcd */, XLCd /* lcd */,
... ...
#endif
); );
extern XlcCharSet _fallcGetCharSet( extern XlcCharSet _fallcGetCharSet(
#if NeedFunctionPrototypes
char* /* name */ char* /* name */
#endif
); );
extern Bool _fallcAddCharSet( extern Bool _fallcAddCharSet(
#if NeedFunctionPrototypes
XlcCharSet /* charset */ XlcCharSet /* charset */
#endif
); );
extern char *_fallcGetCSValues( extern char *_fallcGetCSValues(
#if NeedVarargsPrototypes
XlcCharSet /* charset */, XlcCharSet /* charset */,
... ...
#endif
); );
extern XlcConv _fallcOpenConverter( extern XlcConv _fallcOpenConverter(
#if NeedFunctionPrototypes
XLCd /* from_lcd */, XLCd /* from_lcd */,
char* /* from_type */, char* /* from_type */,
XLCd /* to_lcd */, XLCd /* to_lcd */,
char* /* to_type */ char* /* to_type */
#endif
); );
extern void _fallcCloseConverter( extern void _fallcCloseConverter(
#if NeedFunctionPrototypes
XlcConv /* conv */ XlcConv /* conv */
#endif
); );
extern int _fallcConvert( extern int _fallcConvert(
#if NeedFunctionPrototypes
XlcConv /* conv */, XlcConv /* conv */,
XPointer* /* from */, XPointer* /* from */,
int* /* from_left */, int* /* from_left */,
@ -242,68 +215,51 @@ extern int _fallcConvert(
int* /* to_left */, int* /* to_left */,
XPointer* /* args */, XPointer* /* args */,
int /* num_args */ int /* num_args */
#endif
); );
extern void _fallcResetConverter( extern void _fallcResetConverter(
#if NeedFunctionPrototypes
XlcConv /* conv */ XlcConv /* conv */
#endif
); );
extern Bool _fallcSetConverter( extern Bool _fallcSetConverter(
#if NeedFunctionPrototypes
XLCd /* from_lcd */, XLCd /* from_lcd */,
char* /* from_type */, char* /* from_type */,
XLCd /* to_lcd */, XLCd /* to_lcd */,
char* /* to_type */, char* /* to_type */,
XlcOpenConverterProc /* open_converter */ XlcOpenConverterProc /* open_converter */
#endif
); );
extern void _fallcGetResource( extern void _fallcGetResource(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
char* /* category */, char* /* category */,
char* /* class */, char* /* class */,
char*** /* value */, char*** /* value */,
int* /* count */ int* /* count */
#endif
); );
extern char *_fallcFileName( extern char *_fallcFileName(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
char* /* category */ char* /* category */
#endif
); );
extern int _falwcslen( extern int _falwcslen(
#if NeedFunctionPrototypes
wchar_t* /* wstr */ wchar_t* /* wstr */
#endif
); );
extern wchar_t *_falwcscpy( extern wchar_t *_falwcscpy(
#if NeedFunctionPrototypes
wchar_t* /* wstr1 */, wchar_t* /* wstr1 */,
wchar_t* /* wstr2 */ wchar_t* /* wstr2 */
#endif
); );
extern int _fallcCompareISOLatin1( extern int _fallcCompareISOLatin1(
#if NeedFunctionPrototypes
char* /* str1 */, char* /* str1 */,
char* /* str2 */ char* /* str2 */
#endif
); );
extern int _fallcNCompareISOLatin1( extern int _fallcNCompareISOLatin1(
#if NeedFunctionPrototypes
char* /* str1 */, char* /* str1 */,
char* /* str2 */, char* /* str2 */,
int /* len */ int /* len */
#endif
); );
_XFUNCPROTOEND _XFUNCPROTOEND

View file

@ -57,17 +57,13 @@ typedef struct _StateRec {
} StateRec, *State; } StateRec, *State;
static void static void
mbinit(state) mbinit(XPointer state)
XPointer state;
{ {
_fallcResetConverter(((State) state)->conv); _fallcResetConverter(((State) state)->conv);
} }
static char static char
mbchar(state, str, lenp) mbchar(XPointer state, char *str, char *lenp)
XPointer state;
char *str;
int *lenp;
{ {
XlcConv conv = ((State) state)->conv; XlcConv conv = ((State) state)->conv;
XlcCharSet charset; XlcCharSet charset;
@ -91,21 +87,18 @@ mbchar(state, str, lenp)
} }
static void static void
mbfinish(state) mbfinish(XPointer state)
XPointer state;
{ {
} }
static char * static char *
lcname(state) lcname(XPointer state)
XPointer state;
{ {
return ((State) state)->lcd->core->name; return ((State) state)->lcd->core->name;
} }
static void static void
destroy(state) destroy(XPointer state)
XPointer state;
{ {
_fallcCloseConverter(((State) state)->conv); _fallcCloseConverter(((State) state)->conv);
_falCloseLC(((State) state)->lcd); _falCloseLC(((State) state)->lcd);
@ -121,9 +114,7 @@ static XrmMethodsRec rm_methods = {
} ; } ;
XrmMethods XrmMethods
_falrmDefaultInitParseInfo(lcd, rm_state) _falrmDefaultInitParseInfo(XLCd lcd, XPointer *rm_state)
XLCd lcd;
XPointer *rm_state;
{ {
State state; State state;

View file

@ -135,22 +135,22 @@ static CodeSet wc_codeset();
static int static int
sjis_mbstowcs(conv, from, from_left, to, to_left, args, num_args) sjis_mbstowcs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
XLCd lcd = (XLCd)conv->state; XLCd lcd = (XLCd)conv->state;
register int chr_len = 0; int chr_len = 0;
register int outbuf = 0; int outbuf = 0;
register int shift_mult = 0; int shift_mult = 0;
register Uint chrcode = 0; Uint chrcode = 0;
Uchar ch, ch2; Uchar ch, ch2;
Uint wc_encode = 0; Uint wc_encode = 0;
@ -276,20 +276,20 @@ sjis_mbstowcs(conv, from, from_left, to, to_left, args, num_args)
#define byte2 (byte1 == 0) #define byte2 (byte1 == 0)
static int static int
sjis_wcstombs(conv, from, from_left, to, to_left, args, num_args) sjis_wcstombs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
register wchar_t *inbufptr = (wchar_t *) *from; wchar_t *inbufptr = (wchar_t *) *from;
register XPointer outbufptr = *to; XPointer outbufptr = *to;
XPointer outbuf_base = outbufptr; XPointer outbuf_base = outbufptr;
wchar_t wch; wchar_t wch;
register length; int length;
Uchar tmp; Uchar tmp;
Uchar t1, t2; Uchar t1, t2;
int num_conv; int num_conv;
@ -356,74 +356,60 @@ sjis_wcstombs(conv, from, from_left, to, to_left, args, num_args)
* sjis<->jis conversion for widechar kanji (See Note at top of file) * sjis<->jis conversion for widechar kanji (See Note at top of file)
*/ */
static void static void
sjis_to_jis(p1, p2) sjis_to_jis(Uchar *p1, Uchar *p2)
Uchar *p1;
Uchar *p2;
{ {
register Uchar c1 = *p1; Uchar c1 = *p1;
register Uchar c2 = *p2; Uchar c2 = *p2;
register Uchar adjust = c2 < 0x9f; Uchar adjust = c2 < 0x9f;
register Uchar rowOffset = c1 < 0xa0 ? 0x70 : 0xb0; Uchar rowOffset = c1 < 0xa0 ? 0x70 : 0xb0;
register Uchar cellOffset = adjust ? (0x1f + (c2 > 0x7f)) : 0x7e; Uchar cellOffset = adjust ? (0x1f + (c2 > 0x7f)) : 0x7e;
*p1 = ((c1 - rowOffset) << 1) - adjust; *p1 = ((c1 - rowOffset) << 1) - adjust;
*p2 -= cellOffset; *p2 -= cellOffset;
} }
static void static void
jis_to_sjis(p1, p2) jis_to_sjis(Uchar *p1, Uchar *p2)
Uchar *p1;
Uchar *p2;
{ {
register Uchar c1 = *p1; Uchar c1 = *p1;
register Uchar c2 = *p2; Uchar c2 = *p2;
register Uchar rowOffset = c1 < 0x5f ? 0x70 : 0xb0; Uchar rowOffset = c1 < 0x5f ? 0x70 : 0xb0;
register Uchar cellOffset = c1 % 2 ? 0x1f + (c2 > 0x5f) : 0x7e; Uchar cellOffset = c1 % 2 ? 0x1f + (c2 > 0x5f) : 0x7e;
*p1 = ((Uchar)(c1 + 1) >> 1) + rowOffset; *p1 = ((Uchar)(c1 + 1) >> 1) + rowOffset;
*p2 = c2 + cellOffset; *p2 = c2 + cellOffset;
} }
static CodeSet static CodeSet
wc_codeset(lcd, wch) wc_codeset(XLCd lcd, wchar_t wch)
XLCd lcd;
wchar_t wch;
{ {
register CodeSet *codesets = XLC_GENERIC(lcd, codeset_list); CodeSet *codesets = XLC_GENERIC(lcd, codeset_list);
#if !defined(__sony_news) || defined(SVR4) int end = XLC_GENERIC(lcd, codeset_num);
register int end = XLC_GENERIC(lcd, codeset_num); Ulong widech = (Ulong)(wch & XLC_GENERIC(lcd, wc_encode_mask));
register Ulong widech = (Ulong)(wch & XLC_GENERIC(lcd, wc_encode_mask));
for (; --end >= 0; codesets++) for (; --end >= 0; codesets++)
if ( widech == (*codesets)->wc_encoding ) if ( widech == (*codesets)->wc_encoding )
return *codesets; return *codesets;
return NULL; return NULL;
#else
if( iskanji(wch >> 8) )
return( codesets[1] );
if( iskana(wch & 0xff) )
return( codesets[2] );
return( codesets[0] );
#endif
} }
static int static int
sjis_mbtocs(conv, from, from_left, to, to_left, args, num_args) sjis_mbtocs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
XLCd lcd = (XLCd)conv->state; XLCd lcd = (XLCd)conv->state;
XlcCharSet charset = NULL; XlcCharSet charset = NULL;
int char_size = 0; int char_size = 0;
int unconv_num = 0; int unconv_num = 0;
register char *src = *from, *dst = *to; char *src = *from, *dst = *to;
CodeSet *codesets = XLC_GENERIC(lcd, codeset_list); CodeSet *codesets = XLC_GENERIC(lcd, codeset_list);
int codeset_num = XLC_GENERIC(lcd, codeset_num); int codeset_num = XLC_GENERIC(lcd, codeset_num);
@ -497,14 +483,14 @@ sjis_mbtocs(conv, from, from_left, to, to_left, args, num_args)
static int static int
sjis_mbstocs(conv, from, from_left, to, to_left, args, num_args) sjis_mbstocs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
XLCd lcd = (XLCd) conv->state; XLCd lcd = (XLCd) conv->state;
char *tmp_from, *tmp_to; char *tmp_from, *tmp_to;
@ -556,21 +542,21 @@ sjis_mbstocs(conv, from, from_left, to, to_left, args, num_args)
} }
static int static int
sjis_wcstocs(conv, from, from_left, to, to_left, args, num_args) sjis_wcstocs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
XLCd lcd = (XLCd) conv->state; XLCd lcd = (XLCd) conv->state;
wchar_t *wcptr = *((wchar_t **)from); wchar_t *wcptr = *((wchar_t **)from);
register char *bufptr = *((char **) to); char *bufptr = *((char **) to);
wchar_t wch; wchar_t wch;
char *tmpptr; char *tmpptr;
register length; int length;
CodeSet codeset; CodeSet codeset;
Ulong wc_encoding; Ulong wc_encoding;
int buf_len = *to_left; int buf_len = *to_left;
@ -584,7 +570,6 @@ sjis_wcstocs(conv, from, from_left, to, to_left, args, num_args)
if (wcstr_len < buf_len / codeset->length) if (wcstr_len < buf_len / codeset->length)
buf_len = wcstr_len * codeset->length; buf_len = wcstr_len * codeset->length;
#if !defined(__sony_news) || defined(SVR4)
wc_encoding = codeset->wc_encoding; wc_encoding = codeset->wc_encoding;
for ( ; wcstr_len > 0 && buf_len > 0; wcptr++, wcstr_len--) { for ( ; wcstr_len > 0 && buf_len > 0; wcptr++, wcstr_len--) {
@ -604,25 +589,6 @@ sjis_wcstocs(conv, from, from_left, to, to_left, args, num_args)
wch >>= (wchar_t)XLC_GENERIC(lcd, wc_shift_bits); wch >>= (wchar_t)XLC_GENERIC(lcd, wc_shift_bits);
} }
} }
#else
length = codeset->length;
for( ; wcstr_len > 0 && buf_len > 0; wcptr++, wcstr_len-- ) {
wch = *wcptr;
if( codeset != wc_codeset( lcd, wch ) )
break;
buf_len -= length;
if( length == 2 ) {
unsigned short code;
code = sjis2jis( wch & 0xffff );
*bufptr++ = code >> 8;
*bufptr++ = code & 0xff;
}
else
*bufptr++ = wch & 0xff;
}
#endif
if (num_args > 0) if (num_args > 0)
*((XlcCharSet *) args[0]) = *codeset->charset_list; *((XlcCharSet *) args[0]) = *codeset->charset_list;
@ -637,13 +603,11 @@ sjis_wcstocs(conv, from, from_left, to, to_left, args, num_args)
} }
static CodeSet static CodeSet
GetCodeSetFromCharSet(lcd, charset) GetCodeSetFromCharSet(XLCd lcd, XlcCharSet charset)
XLCd lcd;
XlcCharSet charset;
{ {
register CodeSet *codeset = XLC_GENERIC(lcd, codeset_list); CodeSet *codeset = XLC_GENERIC(lcd, codeset_list);
register XlcCharSet *charset_list; XlcCharSet *charset_list;
register codeset_num, num_charsets; int codeset_num, num_charsets;
codeset_num = XLC_GENERIC(lcd, codeset_num); codeset_num = XLC_GENERIC(lcd, codeset_num);
@ -661,20 +625,20 @@ GetCodeSetFromCharSet(lcd, charset)
static int static int
sjis_cstombs(conv, from, from_left, to, to_left, args, num_args) sjis_cstombs(
XlcConv conv; XlcConv conv,
char **from; char **from,
int *from_left; int *from_left,
char **to; char **to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
XLCd lcd = (XLCd) conv->state; XLCd lcd = (XLCd) conv->state;
register char *csptr = *from; char *csptr = *from;
register char *bufptr = *to; char *bufptr = *to;
int csstr_len = *from_left; int csstr_len = *from_left;
register buf_len = *to_left; int buf_len = *to_left;
int length; int length;
CodeSet codeset; CodeSet codeset;
EncodingType type; EncodingType type;
@ -719,21 +683,21 @@ sjis_cstombs(conv, from, from_left, to, to_left, args, num_args)
} }
static int static int
sjis_cstowcs(conv, from, from_left, to, to_left, args, num_args) sjis_cstowcs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
XLCd lcd = (XLCd) conv->state; XLCd lcd = (XLCd) conv->state;
register char *csptr = (char *) *from; char *csptr = (char *) *from;
wchar_t *bufptr = (wchar_t *) *to; wchar_t *bufptr = (wchar_t *) *to;
wchar_t *toptr = (wchar_t *) *to; wchar_t *toptr = (wchar_t *) *to;
int csstr_len = *from_left; int csstr_len = *from_left;
register buf_len = *to_left; int buf_len = *to_left;
wchar_t wch; wchar_t wch;
int length; int length;
Ulong wc_shift_bits = (int)XLC_GENERIC(lcd, wc_shift_bits); Ulong wc_shift_bits = (int)XLC_GENERIC(lcd, wc_shift_bits);
@ -779,7 +743,6 @@ sjis_cstowcs(conv, from, from_left, to, to_left, args, num_args)
/* /*
* Stripped down Direct CT converters for SJIS * Stripped down Direct CT converters for SJIS
*
*/ */
#define BADCHAR(min_ch, c) (BIT8OFF(c) < (char)min_ch && BIT8OFF(c) != 0x0 && \ #define BADCHAR(min_ch, c) (BIT8OFF(c) < (char)min_ch && BIT8OFF(c) != 0x0 && \
@ -846,8 +809,7 @@ static enum { Ascii, Kanji, Kana, Userdef } cs_nums;
* initCTptr(): Set ctptr[] to point at ctdata[], indexed by codeset_num. * initCTptr(): Set ctptr[] to point at ctdata[], indexed by codeset_num.
*/ */
static void static void
initCTptr(lcd) initCTptr(XLCd lcd)
XLCd lcd;
{ {
int num_codesets = XLC_GENERIC(lcd, codeset_num); int num_codesets = XLC_GENERIC(lcd, codeset_num);
int num_charsets; int num_charsets;
@ -892,22 +854,22 @@ initCTptr(lcd)
static int static int
sjis_mbstocts(conv, from, from_left, to, to_left, args, num_args) sjis_mbstocts(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
register ct_len = *to_left; int ct_len = *to_left;
int cs_num; int cs_num;
int clen; int clen;
int unconv_num = 0; int unconv_num = 0;
int num_conv; int num_conv;
XPointer inbufptr = *from; XPointer inbufptr = *from;
register char *ctptr = *to; char *ctptr = *to;
XPointer ct_base = ctptr; XPointer ct_base = ctptr;
StateRec ct_state; StateRec ct_state;
@ -1027,21 +989,21 @@ sjis_mbstocts(conv, from, from_left, to, to_left, args, num_args)
#define byte2 (byte1 == 0) #define byte2 (byte1 == 0)
static int static int
sjis_wcstocts(conv, from, from_left, to, to_left, args, num_args) sjis_wcstocts(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
register ct_len = *to_left; int ct_len = *to_left;
register wchar_t *inbufptr = (wchar_t *) *from; wchar_t *inbufptr = (wchar_t *) *from;
register char *ctptr = *to; char *ctptr = *to;
XPointer ct_base = ctptr; XPointer ct_base = ctptr;
wchar_t wch; wchar_t wch;
register length; int length;
Uchar tmp; Uchar tmp;
Uchar t1 = 0, t2; Uchar t1 = 0, t2;
int num_conv; int num_conv;
@ -1150,20 +1112,20 @@ sjis_wcstocts(conv, from, from_left, to, to_left, args, num_args)
#define SKIP_P(str) while (*(str) >= 0x30 && *(str) <= 0x3f) (str)++; #define SKIP_P(str) while (*(str) >= 0x30 && *(str) <= 0x3f) (str)++;
static int static int
sjis_ctstombs(conv, from, from_left, to, to_left, args, num_args) sjis_ctstombs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
register XPointer inbufptr = *from; XPointer inbufptr = *from;
register XPointer outbufptr = *to; XPointer outbufptr = *to;
XPointer inbuf_base; XPointer inbuf_base;
XPointer outbuf_base = outbufptr; XPointer outbuf_base = outbufptr;
register clen, length; int clen, length;
int unconv_num = 0; int unconv_num = 0;
int num_conv; int num_conv;
unsigned int ct_seglen = 0; unsigned int ct_seglen = 0;
@ -1257,27 +1219,27 @@ sjis_ctstombs(conv, from, from_left, to, to_left, args, num_args)
static int static int
sjis_ctstowcs(conv, from, from_left, to, to_left, args, num_args) sjis_ctstowcs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
XLCd lcd = (XLCd)conv->state; XLCd lcd = (XLCd)conv->state;
Ulong wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits); Ulong wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits);
register XPointer inbufptr = *from; XPointer inbufptr = *from;
XPointer inbuf_base; XPointer inbuf_base;
register wchar_t *outbufptr = (wchar_t *) *to; wchar_t *outbufptr = (wchar_t *) *to;
wchar_t *outbuf_base = outbufptr; wchar_t *outbuf_base = outbufptr;
register clen, length; int clen, length;
int num_conv; int num_conv;
int unconv_num = 0; int unconv_num = 0;
unsigned int ct_seglen = 0; unsigned int ct_seglen = 0;
Uchar ct_type = 0; Uchar ct_type = 0;
register shift_mult; int shift_mult;
wchar_t wc_tmp; wchar_t wc_tmp;
wchar_t wch; wchar_t wch;
Ulong wc_encoding; Ulong wc_encoding;
@ -1349,7 +1311,6 @@ sjis_ctstowcs(conv, from, from_left, to, to_left, args, num_args)
(*from_left) -= 2; (*from_left) -= 2;
continue; continue;
} }
#if !defined(__sony_news) || defined(SVR4)
wc_encoding = (ctdp == ctdptr[Kana] && isleftside(*inbufptr)) ? wc_encoding = (ctdp == ctdptr[Kana] && isleftside(*inbufptr)) ?
ctdptr[Ascii]->wc_encoding : ctdp->wc_encoding; ctdptr[Ascii]->wc_encoding : ctdp->wc_encoding;
@ -1363,16 +1324,6 @@ sjis_ctstowcs(conv, from, from_left, to, to_left, args, num_args)
shift_mult--; shift_mult--;
} while (--clen); } while (--clen);
*outbufptr++ = wch | wc_encoding; *outbufptr++ = wch | wc_encoding;
#else
if( length == 1 )
*outbufptr++ = (unsigned char)*inbufptr++;
else if( length == 2 ) {
unsigned short code;
code = (*inbufptr << 8) | *(inbufptr+1);
*outbufptr++ = jis2sjis( code );
inbufptr += 2;
}
#endif
} }
*to = (XPointer)outbufptr; *to = (XPointer)outbufptr;
@ -1385,17 +1336,14 @@ sjis_ctstowcs(conv, from, from_left, to, to_left, args, num_args)
#undef BADCHAR #undef BADCHAR
static void static void
close_converter(conv) close_converter(XlcConv conv)
XlcConv conv;
{ {
Xfree((char *) conv); Xfree((char *) conv);
} }
static XlcConv static XlcConv
create_conv(lcd, methods) create_conv(XLCd lcd, XlcConvMethods methods)
XLCd lcd;
XlcConvMethods methods;
{ {
XlcConv conv; XlcConv conv;
@ -1428,118 +1376,73 @@ static XlcConvMethodsRec conv_methods[] = {
static XlcConv static XlcConv
open_mbstocs(from_lcd, from_type, to_lcd, to_type) open_mbstocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[MBSTOCS]); return create_conv(from_lcd, &conv_methods[MBSTOCS]);
} }
static XlcConv static XlcConv
open_wcstocs(from_lcd, from_type, to_lcd, to_type) open_wcstocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[WCSTOCS]); return create_conv(from_lcd, &conv_methods[WCSTOCS]);
} }
static XlcConv static XlcConv
open_mbtocs(from_lcd, from_type, to_lcd, to_type) open_mbtocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[MBTOCS]); return create_conv(from_lcd, &conv_methods[MBTOCS]);
} }
static XlcConv static XlcConv
open_cstombs(from_lcd, from_type, to_lcd, to_type) open_cstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[CSTOMBS]); return create_conv(from_lcd, &conv_methods[CSTOMBS]);
} }
static XlcConv static XlcConv
open_cstowcs(from_lcd, from_type, to_lcd, to_type) open_cstowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[CSTOWCS]); return create_conv(from_lcd, &conv_methods[CSTOWCS]);
} }
static XlcConv static XlcConv
open_mbstowcs(from_lcd, from_type, to_lcd, to_type) open_mbstowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[MBSTOWCS]); return create_conv(from_lcd, &conv_methods[MBSTOWCS]);
} }
static XlcConv static XlcConv
open_wcstombs(from_lcd, from_type, to_lcd, to_type) open_wcstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[WCSTOMBS]); return create_conv(from_lcd, &conv_methods[WCSTOMBS]);
} }
static XlcConv static XlcConv
open_wcstocts(from_lcd, from_type, to_lcd, to_type) open_wcstocts(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[WCSTOCTS]); return create_conv(from_lcd, &conv_methods[WCSTOCTS]);
} }
static XlcConv static XlcConv
open_mbstocts(from_lcd, from_type, to_lcd, to_type) open_mbstocts(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[MBSTOCTS]); return create_conv(from_lcd, &conv_methods[MBSTOCTS]);
} }
static XlcConv static XlcConv
open_ctstombs(from_lcd, from_type, to_lcd, to_type) open_ctstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[CTSTOMBS]); return create_conv(from_lcd, &conv_methods[CTSTOMBS]);
} }
static XlcConv static XlcConv
open_ctstowcs(from_lcd, from_type, to_lcd, to_type) open_ctstowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
XLCd from_lcd;
char *from_type;
XLCd to_lcd;
char *to_type;
{ {
return create_conv(from_lcd, &conv_methods[CTSTOWCS]); return create_conv(from_lcd, &conv_methods[CTSTOWCS]);
} }
XLCd XLCd
_fallcSjisLoader(name) _fallcSjisLoader(char *name)
char *name;
{ {
XLCd lcd; XLCd lcd;
CodeSet *codeset_list; CodeSet *codeset_list;

View file

@ -51,11 +51,7 @@
#include "_fallcPubI.h" #include "_fallcPubI.h"
int int
_fallcmbtowc(lcd, wstr, str, len) _fallcmbtowc(XLCd lcd, wchar_t *wstr, char *str, int len)
XLCd lcd;
wchar_t *wstr;
char *str;
int len;
{ {
static XLCd last_lcd = NULL; static XLCd last_lcd = NULL;
static XlcConv conv = NULL; static XlcConv conv = NULL;
@ -96,10 +92,7 @@ _fallcmbtowc(lcd, wstr, str, len)
} }
int int
_fallcwctomb(lcd, str, wc) _fallcwctomb(XLCd lcd, char *str, wchar_t wc)
XLCd lcd;
char *str;
wchar_t wc;
{ {
static XLCd last_lcd = NULL; static XLCd last_lcd = NULL;
static XlcConv conv = NULL; static XlcConv conv = NULL;
@ -139,11 +132,7 @@ _fallcwctomb(lcd, str, wc)
} }
int int
_fallcmbstowcs(lcd, wstr, str, len) _fallcmbstowcs(XLCd lcd, wchar_t *wstr, char *str, int len)
XLCd lcd;
wchar_t *wstr;
char *str;
int len;
{ {
XlcConv conv; XlcConv conv;
XPointer from, to; XPointer from, to;
@ -178,11 +167,7 @@ _fallcmbstowcs(lcd, wstr, str, len)
} }
int int
_fallcwcstombs(lcd, str, wstr, len) _fallcwcstombs(XLCd lcd, char *str, wchar_t *wstr, int len)
XLCd lcd;
char *str;
wchar_t *wstr;
int len;
{ {
XlcConv conv; XlcConv conv;
XPointer from, to; XPointer from, to;
@ -218,51 +203,37 @@ _fallcwcstombs(lcd, str, wstr, len)
int int
_falmbtowc(wstr, str, len) _falmbtowc(wchar_t *wstr, char *str, int len)
wchar_t *wstr;
char *str;
int len;
{ {
return _fallcmbtowc((XLCd) NULL, wstr, str, len); return _fallcmbtowc((XLCd) NULL, wstr, str, len);
} }
int int
_falmblen(str, len) _falmblen(char *str, int len)
char *str;
int len;
{ {
return _falmbtowc((wchar_t *) NULL, str, len); return _falmbtowc((wchar_t *) NULL, str, len);
} }
int int
_falwctomb(str, wc) _falwctomb(char *str, wchar_t wc)
char *str;
wchar_t wc;
{ {
return _fallcwctomb((XLCd) NULL, str, wc); return _fallcwctomb((XLCd) NULL, str, wc);
} }
int int
_falmbstowcs(wstr, str, len) _falmbstowcs(wchar_t *wstr, char *str, int len)
wchar_t *wstr;
char *str;
int len;
{ {
return _fallcmbstowcs((XLCd) NULL, wstr, str, len); return _fallcmbstowcs((XLCd) NULL, wstr, str, len);
} }
int int
_falwcstombs(str, wstr, len) _falwcstombs(char *str, wchar_t *wstr, int len)
char *str;
wchar_t *wstr;
int len;
{ {
return _fallcwcstombs((XLCd) NULL, str, wstr, len); return _fallcwcstombs((XLCd) NULL, str, wstr, len);
} }
wchar_t * wchar_t *
_falwcscpy(wstr1, wstr2) _falwcscpy(wchar_t *wstr1, wchar_t *wstr2)
register wchar_t *wstr1, *wstr2;
{ {
wchar_t *wstr_tmp = wstr1; wchar_t *wstr_tmp = wstr1;
@ -273,9 +244,7 @@ _falwcscpy(wstr1, wstr2)
} }
wchar_t * wchar_t *
_falwcsncpy(wstr1, wstr2, len) _falwcsncpy(wchar_t *wstr1, wchar_t *wstr2, int len)
register wchar_t *wstr1, *wstr2;
register len;
{ {
wchar_t *wstr_tmp = wstr1; wchar_t *wstr_tmp = wstr1;
@ -290,10 +259,9 @@ _falwcsncpy(wstr1, wstr2, len)
} }
int int
_falwcslen(wstr) _falwcslen(wchar_t *wstr)
register wchar_t *wstr;
{ {
register wchar_t *wstr_ptr = wstr; wchar_t *wstr_ptr = wstr;
while (*wstr_ptr) while (*wstr_ptr)
wstr_ptr++; wstr_ptr++;
@ -302,8 +270,7 @@ _falwcslen(wstr)
} }
int int
_falwcscmp(wstr1, wstr2) _falwcscmp(wchar_t *wstr1, wchar_t *wstr2)
register wchar_t *wstr1, *wstr2;
{ {
for ( ; *wstr1 && *wstr2; wstr1++, wstr2++) for ( ; *wstr1 && *wstr2; wstr1++, wstr2++)
if (*wstr1 != *wstr2) if (*wstr1 != *wstr2)
@ -313,9 +280,7 @@ _falwcscmp(wstr1, wstr2)
} }
int int
_falwcsncmp(wstr1, wstr2, len) _falwcsncmp(wchar_t *wstr1, wchar_t *wstr2, int len)
register wchar_t *wstr1, *wstr2;
register len;
{ {
for ( ; *wstr1 && *wstr2 && len > 0; wstr1++, wstr2++, len--) for ( ; *wstr1 && *wstr2 && len > 0; wstr1++, wstr2++, len--)
if (*wstr1 != *wstr2) if (*wstr1 != *wstr2)

View file

@ -54,14 +54,11 @@
#include <stdio.h> #include <stdio.h>
static int static int
get_buf_size(is_wide_char, list, count) get_buf_size(Bool is_wide_char, XPointer list, int count)
Bool is_wide_char;
XPointer list;
int count;
{ {
register length = 0; int length = 0;
register char **mb_list; char **mb_list;
register wchar_t **wc_list; wchar_t **wc_list;
if (list == NULL) if (list == NULL)
return 0; return 0;
@ -87,14 +84,14 @@ get_buf_size(is_wide_char, list, count)
} }
static int static int
_XTextListToTextProperty(lcd, dpy, from_type, list, count, style, text_prop) _XTextListToTextProperty(
XLCd lcd; XLCd lcd,
Display *dpy; Display *dpy,
char *from_type; char *from_type,
XPointer list; XPointer list,
int count; int count,
XICCEncodingStyle style; XICCEncodingStyle style,
XTextProperty *text_prop; XTextProperty *text_prop)
{ {
Atom encoding; Atom encoding;
XlcConv conv; XlcConv conv;
@ -103,7 +100,7 @@ _XTextListToTextProperty(lcd, dpy, from_type, list, count, style, text_prop)
wchar_t **wc_list; wchar_t **wc_list;
XPointer from; XPointer from;
char *to, *buf, *value; char *to, *buf, *value;
int from_left, to_left, buf_len, nitems, unconv_num, ret, i; int from_left, to_left, buf_len, nitems, unconv_num, ret, i, retry, done =0;
Bool is_wide_char = False; Bool is_wide_char = False;
if (strcmp(XlcNWideChar, from_type) == 0) if (strcmp(XlcNWideChar, from_type) == 0)
@ -138,7 +135,7 @@ _XTextListToTextProperty(lcd, dpy, from_type, list, count, style, text_prop)
mb_list++; mb_list++;
} }
unconv_num = 0; unconv_num = 0;
goto done; done++;
} }
break; break;
default: default:
@ -148,107 +145,111 @@ _XTextListToTextProperty(lcd, dpy, from_type, list, count, style, text_prop)
if (count < 1) { if (count < 1) {
nitems = 0; nitems = 0;
goto done; done++;
} }
retry: if(done == 1){
conv = _fallcOpenConverter(lcd, from_type, lcd, to_type); if (nitems <= 0)
if (conv == NULL) { 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); Xfree(buf);
return XConverterNotFound;
text_prop->value = (unsigned char *) value;
text_prop->encoding = encoding;
text_prop->format = 8;
text_prop->nitems = nitems;
return unconv_num;
} }
if (is_wide_char) do{
wc_list = (wchar_t **) list; retry = 0;
else conv = _fallcOpenConverter(lcd, from_type, lcd, to_type);
mb_list = (char **) list; if (conv == NULL) {
Xfree(buf);
to = buf; return XConverterNotFound;
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, 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); NULL, 0);
if (ret < 0) if (ret < 0)
continue; continue;
if (ret > 0 && style == XStdICCTextStyle && encoding == XA_STRING) { if (ret > 0 && style == XStdICCTextStyle && encoding == XA_STRING) {
_fallcCloseConverter(conv); _fallcCloseConverter(conv);
encoding = falInternAtom(dpy, "COMPOUND_TEXT", False); encoding = falInternAtom(dpy, "COMPOUND_TEXT", False);
to_type = XlcNCompoundText; to_type = XlcNCompoundText;
goto retry; retry++;
}
unconv_num += ret;
*to++ = '\0';
to_left--;
if (i >= count)
break;
_fallcResetConverter(conv);
} }
unconv_num += ret;
*to++ = '\0';
to_left--;
if (i >= count)
break;
_fallcResetConverter(conv);
}
_fallcCloseConverter(conv); _fallcCloseConverter(conv);
nitems = to - buf; nitems = to - buf;
done: }while (retry == 1);
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 int
_falmbTextListToTextProperty(lcd, dpy, list, count, style, text_prop) _falmbTextListToTextProperty(
XLCd lcd; XLCd lcd,
Display *dpy; Display *dpy,
char **list; char **list,
int count; int count,
XICCEncodingStyle style; XICCEncodingStyle style,
XTextProperty *text_prop; XTextProperty *text_prop)
{ {
return _XTextListToTextProperty(lcd, dpy, XlcNMultiByte, (XPointer) list, return _XTextListToTextProperty(lcd, dpy, XlcNMultiByte, (XPointer) list,
count, style, text_prop); count, style, text_prop);
} }
int int
_falwcTextListToTextProperty(lcd, dpy, list, count, style, text_prop) _falwcTextListToTextProperty(
XLCd lcd; XLCd lcd,
Display *dpy; Display *dpy,
wchar_t **list; wchar_t **list,
int count; int count,
XICCEncodingStyle style; XICCEncodingStyle style,
XTextProperty *text_prop; XTextProperty *text_prop)
{ {
return _XTextListToTextProperty(lcd, dpy, XlcNWideChar, (XPointer) list, return _XTextListToTextProperty(lcd, dpy, XlcNWideChar, (XPointer) list,
count, style, text_prop); count, style, text_prop);

View file

@ -49,65 +49,52 @@ OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/ ******************************************************************/
#include "_fallcUTF.h" #include "_fallcUTF.h"
#include <stdlib.h>
static long getutfrune(); static long getutfrune(char **read_from, int *from_len);
static void our_wctomb( static void our_wctomb(
#if NeedFunctionPrototypes
unsigned short r, unsigned short r,
char **bufptr, char **bufptr,
int *buf_len int *buf_len
#endif
); );
static int our_mbtowc( static int our_mbtowc(
#if NeedFunctionPrototypes
unsigned long *p, unsigned long *p,
char *s, char *s,
size_t n size_t n
#endif
); );
static void latin2rune( static void latin2rune(
#if NeedFunctionPrototypes
unsigned char c, unsigned char c,
Rune *r Rune *r
#endif
); );
static void jis02012rune( static void jis02012rune(
#if NeedFunctionPrototypes
unsigned char c, unsigned char c,
Rune *r Rune *r
#endif
); );
static void jis02082rune( static void jis02082rune(
#if NeedFunctionPrototypes
unsigned char c, unsigned char c,
Rune *r Rune *r
#endif
); );
static void ksc2rune( static void ksc2rune(
#if NeedFunctionPrototypes
unsigned char c, unsigned char c,
Rune *r Rune *r
#endif
); );
static void gb2rune( static void gb2rune(
#if NeedFunctionPrototypes
unsigned char c, unsigned char c,
Rune *r Rune *r
#endif
); );
static void init_latin1tab(); static void init_latin1tab(long *tbl, long fb_default);
static void init_latin2tab(); static void init_latin2tab(long *tbl, long fb_default);
static void init_latin3tab(); static void init_latin3tab(long *tbl, long fb_default);
static void init_latin4tab(); static void init_latin4tab(long *tbl, long fb_default);
static void init_latin5tab(); static void init_latin5tab(long *tbl, long fb_default);
static void init_latin6tab(); static void init_latin6tab(long *tbl, long fb_default);
static void init_latin7tab(); static void init_latin7tab(long *tbl, long fb_default);
static void init_latin8tab(); static void init_latin8tab(long *tbl, long fb_default);
static void init_latin9tab(); static void init_latin9tab(long *tbl, long fb_default);
static void init_jis0201tab(); static void init_jis0201tab(long *tbl, long fb_default);
static void init_jis0208tab(); static void init_jis0208tab(long *tbl, long fb_default);
static void init_ksc5601tab(); static void init_ksc5601tab(long *tbl, long fb_default);
static void init_gb2312tab(); static void init_gb2312tab(long *tbl, long fb_default);
static char *int_locale = NULL; static char *int_locale = NULL;
@ -149,21 +136,16 @@ static XlcUTFDataRec default_utf_data[] =
static void static void
set_latin_nop(table, default_val) set_latin_nop(long *table, long default_val)
long *table;
long default_val;
{ {
register int i; int i;
for(i = 0; i < 0x1fff; i++) for(i = 0; i < 0x1fff; i++)
table[i] = default_val; table[i] = default_val;
return; return;
} }
static void static void
set_latin_tab(fptr, table, fb_default) set_latin_tab(FILE *fptr, long *table, long fb_default)
FILE *fptr;
long *table;
long fb_default;
{ {
int i = 0; int i = 0;
int j = 0; int j = 0;
@ -186,9 +168,7 @@ extern int _fallcResolveI18NPath();
#define TBL_DATA_DIR "tbl_data" #define TBL_DATA_DIR "tbl_data"
static void static void
init_latin1tab(tbl, fb_default) init_latin1tab(long *tbl, long fb_default)
long *tbl;
long fb_default;
{ {
FILE *fp = NULL; FILE *fp = NULL;
char dirname[BUFSIZE]; char dirname[BUFSIZE];
@ -221,9 +201,7 @@ long fb_default;
} }
static void static void
init_latin2tab(tbl, fb_default) init_latin2tab(long *tbl, long fb_default)
long *tbl;
long fb_default;
{ {
FILE *fp; FILE *fp;
char dirname[BUFSIZE]; char dirname[BUFSIZE];
@ -256,9 +234,7 @@ long fb_default;
} }
static void static void
init_latin3tab(tbl, fb_default) init_latin3tab(long *tbl, long fb_default)
long *tbl;
long fb_default;
{ {
FILE *fp; FILE *fp;
char dirname[BUFSIZE]; char dirname[BUFSIZE];
@ -291,9 +267,7 @@ long fb_default;
} }
static void static void
init_latin4tab(tbl, fb_default) init_latin4tab(long *tbl, long fb_default)
long *tbl;
long fb_default;
{ {
FILE *fp; FILE *fp;
char dirname[BUFSIZE]; char dirname[BUFSIZE];
@ -326,9 +300,7 @@ long fb_default;
} }
static void static void
init_latin5tab(tbl, fb_default) init_latin5tab(long *tbl, long fb_default)
long *tbl;
long fb_default;
{ {
FILE *fp; FILE *fp;
char dirname[BUFSIZE]; char dirname[BUFSIZE];
@ -361,9 +333,7 @@ long fb_default;
} }
static void static void
init_latin6tab(tbl, fb_default) init_latin6tab(long *tbl, long fb_default)
long *tbl;
long fb_default;
{ {
FILE *fp; FILE *fp;
char dirname[BUFSIZE]; char dirname[BUFSIZE];
@ -396,9 +366,7 @@ long fb_default;
} }
static void static void
init_latin7tab(tbl, fb_default) init_latin7tab(long *tbl, long fb_default)
long *tbl;
long fb_default;
{ {
FILE *fp; FILE *fp;
char dirname[BUFSIZE]; char dirname[BUFSIZE];
@ -431,9 +399,7 @@ long fb_default;
} }
static void static void
init_latin8tab(tbl, fb_default) init_latin8tab(long *tbl, long fb_default)
long *tbl;
long fb_default;
{ {
FILE *fp; FILE *fp;
char dirname[BUFSIZE]; char dirname[BUFSIZE];
@ -466,9 +432,7 @@ long fb_default;
} }
static void static void
init_latin9tab(tbl, fb_default) init_latin9tab(long *tbl, long fb_default)
long *tbl;
long fb_default;
{ {
FILE *fp; FILE *fp;
char dirname[BUFSIZE]; char dirname[BUFSIZE];
@ -501,9 +465,7 @@ long fb_default;
} }
static void static void
init_jis0201tab(tbl, fb_default) init_jis0201tab(long *tbl, long fb_default)
long *tbl;
long fb_default;
{ {
int i; int i;
for(i = 0; i < NRUNE; i++) for(i = 0; i < NRUNE; i++)
@ -511,25 +473,23 @@ long fb_default;
} }
static void static void
set_cjk_nop(to_tbl, to_max, default_val) set_cjk_nop(long **to_tbl, int to_max, long default_val)
long **to_tbl;
long default_val;
int to_max;
{ {
register int i; int i;
for(i = 0; i < to_max; i++) for(i = 0; i < to_max; i++)
(*to_tbl)[i] = default_val; (*to_tbl)[i] = default_val;
return; return;
} }
static void static void
set_table(fptr, to_tbl, from_tbl, to_max, fb_default) set_table(
FILE *fptr; FILE *fptr,
long **to_tbl, *from_tbl; long **to_tbl,
int to_max; long *from_tbl,
long fb_default; int to_max,
long fb_default)
{ {
register int i = 0; int i = 0;
int j = 0; int j = 0;
int rv = 0; int rv = 0;
long value; long value;
@ -554,9 +514,7 @@ long fb_default;
static void static void
init_jis0208tab(tbl, fb_default) init_jis0208tab(long *tbl, long fb_default)
long *tbl;
long fb_default;
{ {
FILE *fp; FILE *fp;
char dirname[BUFSIZE]; char dirname[BUFSIZE];
@ -592,9 +550,7 @@ long fb_default;
} }
static void static void
init_ksc5601tab(tbl, fb_default) init_ksc5601tab(long *tbl, long fb_default)
long *tbl;
long fb_default;
{ {
FILE *fp; FILE *fp;
char dirname[BUFSIZE]; char dirname[BUFSIZE];
@ -630,9 +586,7 @@ long fb_default;
} }
static void static void
init_gb2312tab(tbl, fb_default) init_gb2312tab(long *tbl, long fb_default)
long *tbl;
long fb_default;
{ {
FILE *fp; FILE *fp;
char dirname[BUFSIZE]; char dirname[BUFSIZE];
@ -668,7 +622,7 @@ long fb_default;
} }
static UtfData static UtfData
make_entry() make_entry(void)
{ {
UtfData tmp = (UtfData)Xmalloc(sizeof(UtfDataRec)); UtfData tmp = (UtfData)Xmalloc(sizeof(UtfDataRec));
bzero(tmp, sizeof(UtfDataRec)); bzero(tmp, sizeof(UtfDataRec));
@ -677,8 +631,7 @@ make_entry()
static int once = 0; static int once = 0;
static int static int
_XlcInitUTFInfo(lcd) _XlcInitUTFInfo(XLCd lcd)
XLCd lcd;
{ {
if(!once) { if(!once) {
int i; int i;
@ -726,14 +679,14 @@ XLCd lcd;
} }
static int static int
utftocs(conv, from, from_left, to, to_left, args, num_args) utftocs(
XlcConv conv; XlcConv conv,
char **from; char **from,
int *from_left; int *from_left,
char **to; char **to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
char *utfptr; char *utfptr;
char *bufptr; char *bufptr;
@ -763,7 +716,17 @@ utftocs(conv, from, from_left, to, to_left, args, num_args)
tbl += l; tbl += l;
if((r = *tbl) == -1) { if((r = *tbl) == -1) {
if(tmpcharset) { if(tmpcharset) {
goto end; if((num_args > 0) && tmpcharset)
*((XlcCharSet *) args[0]) = tmpcharset;
*from_left -= utfptr - *from;
*from = utfptr;
*to_left -= bufptr - *to;
*to = bufptr;
return 0;
} else { } else {
pdata = pdata->next; pdata = pdata->next;
continue; continue;
@ -799,28 +762,17 @@ utftocs(conv, from, from_left, to, to_left, args, num_args)
if(!tmpcharset) return (-1); /* Unknown Codepoint */ if(!tmpcharset) return (-1); /* Unknown Codepoint */
} }
} }
end:
if((num_args > 0) && tmpcharset)
*((XlcCharSet *) args[0]) = tmpcharset;
*from_left -= utfptr - *from;
*from = utfptr;
*to_left -= bufptr - *to;
*to = bufptr;
return 0;
} }
static int static int
utf1tocs(conv, from, from_left, to, to_left, args, num_args) utf1tocs(
XlcConv conv; XlcConv conv,
char **from; char **from,
int *from_left; int *from_left,
char **to; char **to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
char **ptr = NULL; char **ptr = NULL;
char char_ptr[UTFmax]; char char_ptr[UTFmax];
@ -839,14 +791,14 @@ utf1tocs(conv, from, from_left, to, to_left, args, num_args)
} }
static int static int
ucstocs(conv, from, from_left, to, to_left, args, num_args) ucstocs(
XlcConv conv; XlcConv conv,
XPointer *from; XPointer *from,
int *from_left; int *from_left,
char **to; char **to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
wchar_t *ucsptr; wchar_t *ucsptr;
char *bufptr; char *bufptr;
@ -871,7 +823,17 @@ ucstocs(conv, from, from_left, to, to_left, args, num_args)
tbl += *ucsptr; tbl += *ucsptr;
if((r = *tbl) == -1) { if((r = *tbl) == -1) {
if(tmpcharset) { if(tmpcharset) {
goto end; if((num_args > 0) && tmpcharset)
*((XlcCharSet *) args[0]) = tmpcharset;
*from_left -= ucsptr - (wchar_t *)*from;
*from = (XPointer)ucsptr;
*to_left -= bufptr - *to;
*to = bufptr;
return 0;
} else { } else {
pdata = pdata->next; pdata = pdata->next;
continue; continue;
@ -908,27 +870,10 @@ ucstocs(conv, from, from_left, to, to_left, args, num_args)
} }
if(!tmpcharset) return (-1); /* Unknown Codepoint */ if(!tmpcharset) return (-1); /* Unknown Codepoint */
} }
end:
if((num_args > 0) && tmpcharset)
*((XlcCharSet *) args[0]) = tmpcharset;
*from_left -= ucsptr - (wchar_t *)*from;
*from = (XPointer)ucsptr;
*to_left -= bufptr - *to;
*to = bufptr;
return 0;
} }
static long static long
#if NeedFunctionPrototypes
getutfrune(char **read_from, int *from_len) getutfrune(char **read_from, int *from_len)
#else
getutfrune(read_from, from_len)
char **read_from;
int *from_len;
#endif
{ {
int c, i; int c, i;
char str[UTFmax]; /* MB_LEN_MAX really */ char str[UTFmax]; /* MB_LEN_MAX really */
@ -952,24 +897,22 @@ int *from_len;
} }
static static
cstoutf(conv, from, from_left, to, to_left, args, num_args) cstoutf(
XlcConv conv; XlcConv conv,
char **from; char **from,
int *from_left; int *from_left,
char **to; char **to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
XlcCharSet charset; XlcCharSet charset;
char *csptr, *utfptr; char *csptr, *utfptr;
int csstr_len, utf_len; int csstr_len, utf_len;
int cmp_len = 0; int cmp_len = 0;
void (*putrune)( void (*putrune)(
#if NeedFunctionPrototypes
unsigned char c, unsigned char c,
Rune *r Rune *r
#endif
) = NULL; ) = NULL;
Rune r = (Rune)0; Rune r = (Rune)0;
UtfData pdata = utfdata_list; UtfData pdata = utfdata_list;
@ -1017,14 +960,14 @@ cstoutf(conv, from, from_left, to, to_left, args, num_args)
} }
static static
cstoucs(conv, from, from_left, to, to_left, args, num_args) cstoucs(
XlcConv conv; XlcConv conv,
char **from; char **from,
int *from_left; int *from_left,
XPointer *to; XPointer *to,
int *to_left; int *to_left,
XPointer *args; XPointer *args,
int num_args; int num_args)
{ {
XlcCharSet charset; XlcCharSet charset;
char *csptr; char *csptr;
@ -1032,10 +975,8 @@ cstoucs(conv, from, from_left, to, to_left, args, num_args)
int csstr_len, ucs_len; int csstr_len, ucs_len;
int cmp_len = 0; int cmp_len = 0;
void (*putrune)( void (*putrune)(
#if NeedFunctionPrototypes
unsigned char c, unsigned char c,
Rune *r Rune *r
#endif
) = NULL; ) = NULL;
Rune r = (Rune)0; Rune r = (Rune)0;
UtfData pdata = utfdata_list; UtfData pdata = utfdata_list;
@ -1085,14 +1026,7 @@ cstoucs(conv, from, from_left, to, to_left, args, num_args)
} }
static void static void
#if NeedFunctionPrototypes
our_wctomb(Rune r, char **utfptr, int *utf_len) our_wctomb(Rune r, char **utfptr, int *utf_len)
#else
our_wctomb(r, utfptr, utf_len)
Rune r;
char **utfptr;
int *utf_len;
#endif
{ {
long l = (long)r; long l = (long)r;
@ -1150,26 +1084,14 @@ int *utf_len;
} }
static void static void
#if NeedFunctionPrototypes
latin2rune(unsigned char c, Rune *r) latin2rune(unsigned char c, Rune *r)
#else
latin2rune(c, r)
unsigned char c;
Rune *r;
#endif
{ {
*r = (Rune)c; *r = (Rune)c;
return; return;
} }
static void static void
#if NeedFunctionPrototypes
ksc2rune(unsigned char c, Rune *r) ksc2rune(unsigned char c, Rune *r)
#else
ksc2rune(c, r)
unsigned char c;
Rune *r;
#endif
{ {
static enum { init, cs1last} state = init; static enum { init, cs1last} state = init;
static int korean646 = 1; /* fixed to 1 for now. */ static int korean646 = 1; /* fixed to 1 for now. */
@ -1206,32 +1128,19 @@ Rune *r;
} }
static void static void
#if NeedFunctionPrototypes
jis02012rune(unsigned char c, Rune *r) jis02012rune(unsigned char c, Rune *r)
#else
jis02012rune(c, r)
unsigned char c;
Rune *r;
#endif
{ {
/* To Be Implemented */ /* To Be Implemented */
} }
static void static void
#if NeedFunctionPrototypes
gb2rune(unsigned char c, Rune *r) gb2rune(unsigned char c, Rune *r)
#else
gb2rune(c, r)
unsigned char c;
Rune *r;
#endif
{ {
static enum { state0, state1 } state = state0; static enum { state0, state1 } state = state0;
static int lastc; static int lastc;
long n, ch; long n, ch;
unsigned char ch1 = (c|0x80); /* XXX */ unsigned char ch1 = (c|0x80); /* XXX */
again:
switch(state) switch(state)
{ {
case state0: /* idle state */ case state0: /* idle state */
@ -1261,21 +1170,16 @@ again:
} }
static void static void
#if NeedFunctionPrototypes
jis02082rune(unsigned char c, Rune *r) jis02082rune(unsigned char c, Rune *r)
#else
jis02082rune(c, r)
unsigned char c;
Rune *r;
#endif
{ {
static enum { state0, state1} state = state0; static enum { state0, state1} state = state0;
static int lastc; static int lastc;
unsigned char ch = (c|0x80); /* XXX */ unsigned char ch = (c|0x80); /* XXX */
int n; int n, again;
long l; long l;
again: do {
again = 0;
switch(state) switch(state)
{ {
case state0: /* idle state */ case state0: /* idle state */
@ -1287,7 +1191,7 @@ again:
if((lastc&0x80) != (ch&0x80)){ if((lastc&0x80) != (ch&0x80)){
emit(lastc); emit(lastc);
state = state0; state = state0;
goto again; again += 1;
} }
if(CANS2J(lastc, ch)){ if(CANS2J(lastc, ch)){
int h = lastc, l = ch; int h = lastc, l = ch;
@ -1305,17 +1209,11 @@ again:
} }
state = state0; state = state0;
} }
} while (again == 1);
} }
static int static int
#if NeedFunctionPrototypes
our_mbtowc(unsigned long *p, char *s, size_t n) our_mbtowc(unsigned long *p, char *s, size_t n)
#else
our_mbtowc(p, s, n)
unsigned long *p;
char *s;
size_t n;
#endif
{ {
unsigned char *us; unsigned char *us;
int c0, c1, c2, c3, c4, c5; int c0, c1, c2, c3, c4, c5;
@ -1325,38 +1223,42 @@ size_t n;
return 0; /* no shift states */ return 0; /* no shift states */
if(n < 1) if(n < 1)
goto badlen; return -2; /* bad length */
us = (unsigned char*)s; us = (unsigned char*)s;
c0 = us[0]; c0 = us[0];
if(c0 >= T3) { if(c0 >= T3) {
if(n < 3) if(n < 3)
goto badlen; return -2;
c1 = us[1] ^ Tx; c1 = us[1] ^ Tx;
c2 = us[2] ^ Tx; c2 = us[2] ^ Tx;
if((c1|c2) & T2) { if((c1|c2) & T2) {
goto bad; errno = EILSEQ;
return -1;
} }
if(c0 >= T5) { if(c0 >= T5) {
if(n < 5) if(n < 5)
goto badlen; return -2;
c3 = us[3] ^ Tx; c3 = us[3] ^ Tx;
c4 = us[4] ^ Tx; c4 = us[4] ^ Tx;
if((c3|c4) & T2) { if((c3|c4) & T2) {
goto bad; errno = EILSEQ;
return -1;
} }
if(c0 >= T6) { if(c0 >= T6) {
/* 6 bytes */ /* 6 bytes */
if(n < 6) if(n < 6)
goto badlen; return -2;
c5 = us[5] ^ Tx; c5 = us[5] ^ Tx;
if(c5 & T2) { if(c5 & T2) {
goto bad; errno = EILSEQ;
return -1;
} }
wc = ((((((((((c0 & Mask6) << Bitx) | wc = ((((((((((c0 & Mask6) << Bitx) |
c1) << Bitx) | c2) << Bitx) | c1) << Bitx) | c2) << Bitx) |
c3) << Bitx) | c4) << Bitx) | c5; c3) << Bitx) | c4) << Bitx) | c5;
if(wc <= Wchar5) { if(wc <= Wchar5) {
goto bad; errno = EILSEQ;
return -1;
} }
*p = wc; *p = wc;
return 6; return 6;
@ -1366,7 +1268,8 @@ size_t n;
c1) << Bitx) | c2) << Bitx) | c1) << Bitx) | c2) << Bitx) |
c3) << Bitx) | c4; c3) << Bitx) | c4;
if(wc <= Wchar4) { if(wc <= Wchar4) {
goto bad; errno = EILSEQ;
return -1;
} }
*p = wc; *p = wc;
return 5; return 5;
@ -1374,16 +1277,18 @@ size_t n;
if(c0 >= T4) { if(c0 >= T4) {
/* 4 bytes */ /* 4 bytes */
if(n < 4) if(n < 4)
goto badlen; return -2;
c3 = us[3] ^ Tx; c3 = us[3] ^ Tx;
if(c3 & T2) { if(c3 & T2) {
goto bad; errno = EILSEQ;
return -1;
} }
wc = ((((((c0 & Mask4) << Bitx) | wc = ((((((c0 & Mask4) << Bitx) |
c1) << Bitx) | c2) << Bitx) | c1) << Bitx) | c2) << Bitx) |
c3; c3;
if(wc <= Wchar3) { if(wc <= Wchar3) {
goto bad; errno = EILSEQ;
return -1;
} }
*p = wc; *p = wc;
return 4; return 4;
@ -1392,7 +1297,8 @@ size_t n;
wc = ((((c0 & Mask3) << Bitx) | wc = ((((c0 & Mask3) << Bitx) |
c1) << Bitx) | c2; c1) << Bitx) | c2;
if(wc <= Wchar2) { if(wc <= Wchar2) {
goto bad; errno = EILSEQ;
return -1;
} }
*p = wc; *p = wc;
return 3; return 3;
@ -1400,44 +1306,38 @@ size_t n;
if(c0 >= T2) { if(c0 >= T2) {
/* 2 bytes */ /* 2 bytes */
if(n < 2) if(n < 2)
goto badlen; return -2;
c1 = us[1] ^ Tx; c1 = us[1] ^ Tx;
if(c1 & T2) { if(c1 & T2) {
goto bad; errno = EILSEQ;
return -1;
} }
wc = ((c0 & Mask2) << Bitx) | wc = ((c0 & Mask2) << Bitx) |
c1; c1;
if(wc <= Wchar1) { if(wc <= Wchar1) {
goto bad; errno = EILSEQ;
return -1;
} }
*p = wc; *p = wc;
return 2; return 2;
} }
/* 1 byte */ /* 1 byte */
if(c0 >= Tx) { if(c0 >= Tx) {
goto bad; errno = EILSEQ;
return -1;
} }
*p = c0; *p = c0;
return 1; return 1;
bad:
errno = EILSEQ;
return -1;
badlen:
return -2;
} }
static void static void
close_converter(conv) close_converter(XlcConv conv)
XlcConv conv;
{ {
Xfree((char *) conv); Xfree((char *) conv);
} }
static XlcConv static XlcConv
create_conv(lcd, methods) create_conv(XLCd lcd, XlcConvMethods methods)
XLCd lcd;
XlcConvMethods methods;
{ {
XlcConv conv; XlcConv conv;
@ -1452,10 +1352,10 @@ create_conv(lcd, methods)
return conv; return conv;
err: /* if an error occurs somewhere
close_converter(conv); close_converter(conv);
return (XlcConv) NULL; return (XlcConv) NULL;
*/
} }
static XlcConvMethodsRec mbtocs_methods = { static XlcConvMethodsRec mbtocs_methods = {
@ -1465,11 +1365,7 @@ static XlcConvMethodsRec mbtocs_methods = {
}; };
static XlcConv static XlcConv
open_mbtocs(from_lcd, from, to_lcd, to) open_mbtocs(XLCd from_lcd, char *from, XLCd to_lcd, char *to)
XLCd from_lcd;
char *from;
XLCd to_lcd;
char *to;
{ {
return create_conv(from_lcd, &mbtocs_methods); return create_conv(from_lcd, &mbtocs_methods);
} }
@ -1481,11 +1377,7 @@ static XlcConvMethodsRec mbstocs_methods = {
}; };
static XlcConv static XlcConv
open_mbstocs(from_lcd, from, to_lcd, to) open_mbstocs(XLCd from_lcd, char *from, XLCd to_lcd, char *to)
XLCd from_lcd;
char *from;
XLCd to_lcd;
char *to;
{ {
return create_conv(from_lcd, &mbstocs_methods); return create_conv(from_lcd, &mbstocs_methods);
} }
@ -1497,11 +1389,7 @@ static XlcConvMethodsRec wcstocs_methods = {
}; };
static XlcConv static XlcConv
open_wcstocs(from_lcd, from, to_lcd, to) open_wcstocs(XLCd from_lcd, char *from, XLCd to_lcd, char *to)
XLCd from_lcd;
char *from;
XLCd to_lcd;
char *to;
{ {
return create_conv(from_lcd, &wcstocs_methods); return create_conv(from_lcd, &wcstocs_methods);
} }
@ -1513,11 +1401,7 @@ static XlcConvMethodsRec cstombs_methods = {
}; };
static XlcConv static XlcConv
open_cstombs(from_lcd, from, to_lcd, to) open_cstombs(XLCd from_lcd, char *from, XLCd to_lcd, char *to)
XLCd from_lcd;
char *from;
XLCd to_lcd;
char *to;
{ {
return create_conv(from_lcd, &cstombs_methods); return create_conv(from_lcd, &cstombs_methods);
} }
@ -1529,19 +1413,14 @@ static XlcConvMethodsRec cstowcs_methods = {
}; };
static XlcConv static XlcConv
open_cstowcs(from_lcd, from, to_lcd, to) open_cstowcs(XLCd from_lcd, char *from, XLCd to_lcd, char *to)
XLCd from_lcd;
char *from;
XLCd to_lcd;
char *to;
{ {
return create_conv(from_lcd, &cstowcs_methods); return create_conv(from_lcd, &cstowcs_methods);
} }
XLCd XLCd
_fallcUtfLoader(name) _fallcUtfLoader(char *name)
char *name;
{ {
XLCd lcd; XLCd lcd;

View file

@ -91,18 +91,14 @@ typedef enum {
typedef struct _UtfDataRec { typedef struct _UtfDataRec {
XlcCharSet charset; XlcCharSet charset;
void (*initialize)( /* Table Initializer */ void (*initialize)( /* Table Initializer */
#if NeedNestedPrototypes
long *tbl, long *tbl,
long fallback long fallback
#endif
); );
long *fromtbl; /* UTF -> CharSet */ long *fromtbl; /* UTF -> CharSet */
NormalizeType type; /* Normalize type */ NormalizeType type; /* Normalize type */
void (*cstorune)( /* CharSet -> UTF */ void (*cstorune)( /* CharSet -> UTF */
#if NeedNestedPrototypes
unsigned char c, unsigned char c,
Rune *r Rune *r
#endif
); );
Bool already_init; Bool already_init;
struct _UtfDataRec *next; /* next entry */ struct _UtfDataRec *next; /* next entry */
@ -113,10 +109,8 @@ typedef struct _XlcUTFDataRec {
XlcSide side; XlcSide side;
void (*initialize)(); void (*initialize)();
void (*cstorune)( void (*cstorune)(
#if NeedNestedPrototypes
unsigned char c, unsigned char c,
Rune *r Rune *r
#endif
); );
NormalizeType type; NormalizeType type;
long fallback_value; long fallback_value;

View file

@ -59,10 +59,9 @@
#endif #endif
int int
_fallcCompareISOLatin1(str1, str2) _fallcCompareISOLatin1(char *str1, char *str2)
char *str1, *str2;
{ {
register char ch1, ch2; char ch1, ch2;
for ( ; (ch1 = *str1) && (ch2 = *str2); str1++, str2++) { for ( ; (ch1 = *str1) && (ch2 = *str2); str1++, str2++) {
if (islower(ch1)) if (islower(ch1))
@ -78,11 +77,9 @@ _fallcCompareISOLatin1(str1, str2)
} }
int int
_fallcNCompareISOLatin1(str1, str2, len) _fallcNCompareISOLatin1(char *str1, char *str2, int len)
char *str1, *str2;
int len;
{ {
register char ch1, ch2; char ch1, ch2;
for ( ; (ch1 = *str1) && (ch2 = *str2) && len; str1++, str2++, len--) { for ( ; (ch1 = *str1) && (ch2 = *str2) && len; str1++, str2++, len--) {
if (islower(ch1)) if (islower(ch1))

View file

@ -93,36 +93,16 @@ from the X Consortium.
#endif #endif
#include "_falutil.h" #include "_falutil.h"
#ifdef __STDC__
#define Const const
#else
#define Const /**/
#endif
#ifdef X_NOT_STDC_ENV
extern char *getenv();
#endif
extern void _fallcInitLoader( extern void _fallcInitLoader(
#if NeedFunctionPrototypes
void void
#endif
); );
#ifdef XTHREADS #ifdef XTHREADS
LockInfoPtr _Xi18n_lock; LockInfoPtr _Xi18n_lock;
#endif #endif
#if NeedFunctionPrototypes
char * char *
falSetLocaleModifiers( falSetLocaleModifiers(const char *modifiers)
_Xconst char *modifiers
)
#else
char *
falSetLocaleModifiers(modifiers)
char *modifiers;
#endif
{ {
XLCd lcd = _fallcCurrentLC(); XLCd lcd = _fallcCurrentLC();
char *user_mods; char *user_mods;
@ -143,14 +123,12 @@ falSetLocaleModifiers(modifiers)
} }
Bool Bool
falSupportsLocale() falSupportsLocale(void)
{ {
return _fallcCurrentLC() != (XLCd)NULL; return _fallcCurrentLC() != (XLCd)NULL;
} }
Bool _fallcValidModSyntax(mods, valid_mods) Bool _fallcValidModSyntax(char *mods, char **valid_mods)
char *mods;
char **valid_mods;
{ {
int i; int i;
char **ptr; char **ptr;
@ -174,14 +152,11 @@ Bool _fallcValidModSyntax(mods, valid_mods)
return !mods || !*mods; return !mods || !*mods;
} }
static Const char *im_valid[] = {"im", (char *)NULL}; static const char *im_valid[] = {"im", (char *)NULL};
/*ARGSUSED*/ /*ARGSUSED*/
char * char *
_fallcDefaultMapModifiers (lcd, user_mods, prog_mods) _fallcDefaultMapModifiers (XLCd lcd, char *user_mods, char *prog_mods)
XLCd lcd;
char *user_mods;
char *prog_mods;
{ {
int i; int i;
char *mods; char *mods;
@ -231,8 +206,7 @@ typedef struct _XlcLoaderListRec {
static XlcLoaderList loader_list = NULL; static XlcLoaderList loader_list = NULL;
void void
_fallcRemoveLoader(proc) _fallcRemoveLoader(XLCdLoadProc proc)
XLCdLoadProc proc;
{ {
XlcLoaderList loader, prev; XlcLoaderList loader, prev;
@ -259,9 +233,7 @@ _fallcRemoveLoader(proc)
} }
Bool Bool
_fallcAddLoader(proc, position) _fallcAddLoader(XLCdLoadProc proc, XlcPosition position)
XLCdLoadProc proc;
XlcPosition position;
{ {
XlcLoaderList loader, last; XlcLoaderList loader, last;
@ -292,8 +264,7 @@ _fallcAddLoader(proc, position)
} }
XLCd XLCd
_falOpenLC(name) _falOpenLC(char *name)
char *name;
{ {
XLCd lcd; XLCd lcd;
XlcLoaderList loader; XlcLoaderList loader;
@ -319,7 +290,8 @@ _falOpenLC(name)
if (!strcmp (cur->lcd->core->name, name)) { if (!strcmp (cur->lcd->core->name, name)) {
lcd = cur->lcd; lcd = cur->lcd;
cur->ref_count++; cur->ref_count++;
goto found; _XUnlockMutex(_Xi18n_lock);
return lcd;
} }
} }
@ -345,15 +317,10 @@ _falOpenLC(name)
break; break;
} }
} }
found:
_XUnlockMutex(_Xi18n_lock);
return lcd;
} }
void void
_falCloseLC(lcd) _falCloseLC(XLCd lcd)
XLCd lcd;
{ {
XLCdList cur, *prev; XLCdList cur, *prev;
@ -374,7 +341,7 @@ _falCloseLC(lcd)
*/ */
XLCd XLCd
_fallcCurrentLC() _fallcCurrentLC(void)
{ {
XLCd lcd; XLCd lcd;
static XLCd last_lcd = NULL; static XLCd last_lcd = NULL;
@ -390,8 +357,7 @@ _fallcCurrentLC()
} }
XrmMethods XrmMethods
_falrmInitParseInfo(state) _falrmInitParseInfo(XPointer *state)
XPointer *state;
{ {
XLCd lcd = _falOpenLC((char *) NULL); XLCd lcd = _falOpenLC((char *) NULL);
@ -402,11 +368,11 @@ _falrmInitParseInfo(state)
} }
int int
falmbTextPropertyToTextList(dpy, text_prop, list_ret, count_ret) falmbTextPropertyToTextList(
Display *dpy; Display *dpy,
XTextProperty *text_prop; XTextProperty *text_prop,
char ***list_ret; char ***list_ret,
int *count_ret; int *count_ret)
{ {
XLCd lcd = _fallcCurrentLC(); XLCd lcd = _fallcCurrentLC();
@ -418,11 +384,11 @@ falmbTextPropertyToTextList(dpy, text_prop, list_ret, count_ret)
} }
int int
falwcTextPropertyToTextList(dpy, text_prop, list_ret, count_ret) falwcTextPropertyToTextList(
Display *dpy; Display *dpy,
XTextProperty *text_prop; XTextProperty *text_prop,
wchar_t ***list_ret; wchar_t ***list_ret,
int *count_ret; int *count_ret)
{ {
XLCd lcd = _fallcCurrentLC(); XLCd lcd = _fallcCurrentLC();
@ -434,12 +400,12 @@ falwcTextPropertyToTextList(dpy, text_prop, list_ret, count_ret)
} }
int int
falmbTextListToTextProperty(dpy, list, count, style, text_prop) falmbTextListToTextProperty(
Display *dpy; Display *dpy,
char **list; char **list,
int count; int count,
XICCEncodingStyle style; XICCEncodingStyle style,
XTextProperty *text_prop; XTextProperty *text_prop)
{ {
XLCd lcd = _fallcCurrentLC(); XLCd lcd = _fallcCurrentLC();
@ -451,12 +417,12 @@ falmbTextListToTextProperty(dpy, list, count, style, text_prop)
} }
int int
falwcTextListToTextProperty(dpy, list, count, style, text_prop) falwcTextListToTextProperty(
Display *dpy; Display *dpy,
wchar_t **list; wchar_t **list,
int count; int count,
XICCEncodingStyle style; XICCEncodingStyle style,
XTextProperty *text_prop; XTextProperty *text_prop)
{ {
XLCd lcd = _fallcCurrentLC(); XLCd lcd = _fallcCurrentLC();
@ -468,8 +434,7 @@ falwcTextListToTextProperty(dpy, list, count, style, text_prop)
} }
void void
falwcFreeStringList(list) falwcFreeStringList(wchar_t **list)
wchar_t **list;
{ {
XLCd lcd = _fallcCurrentLC(); XLCd lcd = _fallcCurrentLC();
@ -480,7 +445,7 @@ falwcFreeStringList(list)
} }
char * char *
falDefaultString() falDefaultString(void)
{ {
XLCd lcd = _fallcCurrentLC(); XLCd lcd = _fallcCurrentLC();
@ -491,10 +456,7 @@ falDefaultString()
} }
void void
_fallcCopyFromArg(src, dst, size) _fallcCopyFromArg(char *src, char *dst, int size)
char *src;
register char *dst;
register int size;
{ {
if (size == sizeof(long)) if (size == sizeof(long))
*((long *) dst) = (long) src; *((long *) dst) = (long) src;
@ -515,10 +477,7 @@ _fallcCopyFromArg(src, dst, size)
} }
void void
_fallcCopyToArg(src, dst, size) _fallcCopyToArg(char *src, char **dst, int size)
register char *src;
register char **dst;
register int size;
{ {
if (size == sizeof(long)) if (size == sizeof(long))
*((long *) *dst) = *((long *) src); *((long *) *dst) = *((long *) src);
@ -533,11 +492,9 @@ _fallcCopyToArg(src, dst, size)
} }
void void
_fallcCountVaList(var, count_ret) _fallcCountVaList(va_list var, int *count_ret)
va_list var;
int *count_ret;
{ {
register int count; int count;
for (count = 0; va_arg(var, char *); count++) for (count = 0; va_arg(var, char *); count++)
va_arg(var, XPointer); va_arg(var, XPointer);
@ -546,12 +503,9 @@ _fallcCountVaList(var, count_ret)
} }
void void
_fallcVaToArgList(var, count, args_ret) _fallcVaToArgList(va_list var, int count, XlcArgList *args_ret)
va_list var;
register int count;
XlcArgList *args_ret;
{ {
register XlcArgList args; XlcArgList args;
*args_ret = args = (XlcArgList) Xmalloc(sizeof(XlcArg) * count); *args_ret = args = (XlcArgList) Xmalloc(sizeof(XlcArg) * count);
if (args == (XlcArgList) NULL) if (args == (XlcArgList) NULL)
@ -564,22 +518,20 @@ _fallcVaToArgList(var, count, args_ret)
} }
void void
_fallcCompileResourceList(resources, num_resources) _fallcCompileResourceList(XlcResourceList resources, int num_resources)
register XlcResourceList resources;
register int num_resources;
{ {
for ( ; num_resources-- > 0; resources++) for ( ; num_resources-- > 0; resources++)
resources->xrm_name = falrmPermStringToQuark(resources->name); resources->xrm_name = falrmPermStringToQuark(resources->name);
} }
char * char *
_fallcGetValues(base, resources, num_resources, args, num_args, mask) _fallcGetValues(
XPointer base; XPointer base,
XlcResourceList resources; XlcResourceList resources,
int num_resources; int num_resources,
XlcArgList args; XlcArgList args,
int num_args; int num_args,
unsigned long mask; unsigned long mask)
{ {
XlcResourceList res; XlcResourceList res;
XrmQuark xrm_name; XrmQuark xrm_name;
@ -605,13 +557,13 @@ _fallcGetValues(base, resources, num_resources, args, num_args, mask)
} }
char * char *
_fallcSetValues(base, resources, num_resources, args, num_args, mask) _fallcSetValues(
XPointer base; XPointer base,
XlcResourceList resources; XlcResourceList resources,
int num_resources; int num_resources,
XlcArgList args; XlcArgList args,
int num_args; int num_args,
unsigned long mask; unsigned long mask)
{ {
XlcResourceList res; XlcResourceList res;
XrmQuark xrm_name; XrmQuark xrm_name;

View file

@ -107,12 +107,10 @@ from the X Consortium.
#include "_falvarargs.h" #include "_falvarargs.h"
typedef Bool (*XFilterEventProc)( typedef Bool (*XFilterEventProc)(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* window */, Window /* window */,
XEvent* /* event */, XEvent* /* event */,
XPointer /* client_data */ XPointer /* client_data */
#endif
); );
typedef struct _XIMFilter { typedef struct _XIMFilter {
@ -195,35 +193,25 @@ typedef struct {
*/ */
typedef void (*XmbInitProc)( typedef void (*XmbInitProc)(
#if NeedFunctionPrototypes
XPointer /* state */ XPointer /* state */
#endif
); );
typedef char (*XmbCharProc)( typedef char (*XmbCharProc)(
#if NeedFunctionPrototypes
XPointer /* state */, XPointer /* state */,
char* /* str */, char* /* str */,
int* /* lenp */ int* /* lenp */
#endif
); );
typedef void (*XmbFinishProc)( typedef void (*XmbFinishProc)(
#if NeedFunctionPrototypes
XPointer /* state */ XPointer /* state */
#endif
); );
typedef char* (*XlcNameProc)( typedef char* (*XlcNameProc)(
#if NeedFunctionPrototypes
XPointer /* state */ XPointer /* state */
#endif
); );
typedef void (*XrmDestroyProc)( typedef void (*XrmDestroyProc)(
#if NeedFunctionPrototypes
XPointer /* state */ XPointer /* state */
#endif
); );
typedef struct { typedef struct {
@ -241,41 +229,32 @@ typedef struct _XLCd *XLCd; /* need forward reference */
*/ */
typedef void (*XCloseLCProc)( typedef void (*XCloseLCProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */ XLCd /* lcd */
#endif
); );
typedef char* (*XlcMapModifiersProc)( typedef char* (*XlcMapModifiersProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
char* /* user_mods */, char* /* user_mods */,
char* /* prog_mods */ char* /* prog_mods */
#endif
); );
typedef XOM (*XOpenOMProc)( typedef XOM (*XOpenOMProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
Display* /* display */, Display* /* display */,
XrmDatabase /* rdb */, XrmDatabase /* rdb */,
_Xconst char* /* res_name */, const char* /* res_name */,
_Xconst char* /* res_class */ const char* /* res_class */
#endif
); );
typedef XIM (*XOpenIMProc)( typedef XIM (*XOpenIMProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
Display* /* display */, Display* /* display */,
XrmDatabase /* rdb */, XrmDatabase /* rdb */,
char* /* res_name */, char* /* res_name */,
char* /* res_class */ char* /* res_class */
#endif
); );
typedef Bool (*XRegisterIMInstantiateCBProc)( typedef Bool (*XRegisterIMInstantiateCBProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
Display* /* display */, Display* /* display */,
XrmDatabase /* rdb */, XrmDatabase /* rdb */,
@ -283,11 +262,9 @@ typedef Bool (*XRegisterIMInstantiateCBProc)(
char* /* res_class */, char* /* res_class */,
XIMProc /* callback */, XIMProc /* callback */,
XPointer* /* client_data */ XPointer* /* client_data */
#endif
); );
typedef Bool (*XUnregisterIMInstantiateCBProc)( typedef Bool (*XUnregisterIMInstantiateCBProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
Display* /* display */, Display* /* display */,
XrmDatabase /* rdb */, XrmDatabase /* rdb */,
@ -295,69 +272,54 @@ typedef Bool (*XUnregisterIMInstantiateCBProc)(
char* /* res_class */, char* /* res_class */,
XIMProc /* callback */, XIMProc /* callback */,
XPointer* /* client_data */ XPointer* /* client_data */
#endif
); );
typedef XrmMethods (*XrmInitParseInfoProc)( typedef XrmMethods (*XrmInitParseInfoProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
XPointer* /* state */ XPointer* /* state */
#endif
); );
typedef int (*falmbTextPropertyToTextListProc)( typedef int (*falmbTextPropertyToTextListProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
Display* /* display */, Display* /* display */,
XTextProperty* /* text_prop */, XTextProperty* /* text_prop */,
char*** /* list_return */, char*** /* list_return */,
int* /* count_return */ int* /* count_return */
#endif
); );
typedef int (*falwcTextPropertyToTextListProc)( typedef int (*falwcTextPropertyToTextListProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
Display* /* display */, Display* /* display */,
XTextProperty* /* text_prop */, XTextProperty* /* text_prop */,
wchar_t*** /* list_return */, wchar_t*** /* list_return */,
int* /* count_return */ int* /* count_return */
#endif
); );
typedef int (*falmbTextListToTextPropertyProc)( typedef int (*falmbTextListToTextPropertyProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
Display* /* display */, Display* /* display */,
char** /* list */, char** /* list */,
int /* count */, int /* count */,
XICCEncodingStyle /* style */, XICCEncodingStyle /* style */,
XTextProperty* /* text_prop_return */ XTextProperty* /* text_prop_return */
#endif
); );
typedef int (*falwcTextListToTextPropertyProc)( typedef int (*falwcTextListToTextPropertyProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
Display* /* display */, Display* /* display */,
wchar_t** /* list */, wchar_t** /* list */,
int /* count */, int /* count */,
XICCEncodingStyle /* style */, XICCEncodingStyle /* style */,
XTextProperty* /* text_prop_return */ XTextProperty* /* text_prop_return */
#endif
); );
typedef void (*falwcFreeStringListProc)( typedef void (*falwcFreeStringListProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
wchar_t** /* list */ wchar_t** /* list */
#endif
); );
typedef char* (*falDefaultStringProc)( typedef char* (*falDefaultStringProc)(
#if NeedFunctionPrototypes
XLCd /* lcd */ XLCd /* lcd */
#endif
); );
typedef struct { typedef struct {
@ -416,33 +378,25 @@ typedef struct _XlcResource {
#define XlcNumber(arr) (sizeof(arr) / sizeof(arr[0])) #define XlcNumber(arr) (sizeof(arr) / sizeof(arr[0]))
typedef Status (*XCloseOMProc)( typedef Status (*XCloseOMProc)(
#if NeedFunctionPrototypes
XOM /* om */ XOM /* om */
#endif
); );
typedef char* (*XSetOMValuesProc)( typedef char* (*XSetOMValuesProc)(
#if NeedFunctionPrototypes
XOM /* om */, XOM /* om */,
XlcArgList /* args */, XlcArgList /* args */,
int /* num_args */ int /* num_args */
#endif
); );
typedef char* (*XGetOMValuesProc)( typedef char* (*XGetOMValuesProc)(
#if NeedFunctionPrototypes
XOM /* om */, XOM /* om */,
XlcArgList /* args */, XlcArgList /* args */,
int /* num_args */ int /* num_args */
#endif
); );
typedef XOC (*XCreateOCProc)( typedef XOC (*XCreateOCProc)(
#if NeedFunctionPrototypes
XOM /* om */, XOM /* om */,
XlcArgList /* args */, XlcArgList /* args */,
int /* num_args */ int /* num_args */
#endif
); );
typedef struct _XOMMethodsRec { typedef struct _XOMMethodsRec {
@ -474,25 +428,19 @@ typedef struct _XOM {
} XOMRec; } XOMRec;
typedef void (*XDestroyOCProc)( typedef void (*XDestroyOCProc)(
#if NeedFunctionPrototypes
XOC /* oc */ XOC /* oc */
#endif
); );
typedef char* (*XSetOCValuesProc)( typedef char* (*XSetOCValuesProc)(
#if NeedFunctionPrototypes
XOC /* oc */, XOC /* oc */,
XlcArgList /* args */, XlcArgList /* args */,
int /* num_args */ int /* num_args */
#endif
); );
typedef char* (*XGetOCValuesProc)( typedef char* (*XGetOCValuesProc)(
#if NeedFunctionPrototypes
XOC /* oc */, XOC /* oc */,
XlcArgList /* args */, XlcArgList /* args */,
int /* num_args */ int /* num_args */
#endif
); );
/* /*
@ -505,27 +453,22 @@ typedef char* (*XGetOCValuesProc)(
*/ */
typedef int (*XmbTextEscapementProc)( typedef int (*XmbTextEscapementProc)(
#if NeedFunctionPrototypes
XFontSet /* font_set */, XFontSet /* font_set */,
_Xconst char* /* text */, const char* /* text */,
int /* text_len */ int /* text_len */
#endif
); );
typedef int (*XmbTextExtentsProc)( typedef int (*XmbTextExtentsProc)(
#if NeedFunctionPrototypes
XFontSet /* font_set */, XFontSet /* font_set */,
_Xconst char* /* text */, const char* /* text */,
int /* text_len */, int /* text_len */,
XRectangle* /* overall_ink_extents */, XRectangle* /* overall_ink_extents */,
XRectangle* /* overall_logical_extents */ XRectangle* /* overall_logical_extents */
#endif
); );
typedef Status (*XmbTextPerCharExtentsProc)( typedef Status (*XmbTextPerCharExtentsProc)(
#if NeedFunctionPrototypes
XFontSet /* font_set */, XFontSet /* font_set */,
_Xconst char* /* text */, const char* /* text */,
int /* text_len */, int /* text_len */,
XRectangle* /* ink_extents_buffer */, XRectangle* /* ink_extents_buffer */,
XRectangle* /* logical_extents_buffer */, XRectangle* /* logical_extents_buffer */,
@ -533,57 +476,47 @@ typedef Status (*XmbTextPerCharExtentsProc)(
int* /* num_chars */, int* /* num_chars */,
XRectangle* /* max_ink_extents */, XRectangle* /* max_ink_extents */,
XRectangle* /* max_logical_extents */ XRectangle* /* max_logical_extents */
#endif
); );
typedef int (*XmbDrawStringProc)( typedef int (*XmbDrawStringProc)(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Drawable /* drawable */, Drawable /* drawable */,
XFontSet /* font_set */, XFontSet /* font_set */,
GC /* gc */, GC /* gc */,
int /* x */, int /* x */,
int /* y */, int /* y */,
_Xconst char* /* text */, const char* /* text */,
int /* text_len */ int /* text_len */
#endif
); );
typedef void (*XmbDrawImageStringProc)( typedef void (*XmbDrawImageStringProc)(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Drawable /* drawable */, Drawable /* drawable */,
XFontSet /* font_set */, XFontSet /* font_set */,
GC /* gc */, GC /* gc */,
int /* x */, int /* x */,
int /* y */, int /* y */,
_Xconst char* /* text */, const char* /* text */,
int /* text_len */ int /* text_len */
#endif
); );
typedef int (*XwcTextEscapementProc)( typedef int (*XwcTextEscapementProc)(
#if NeedFunctionPrototypes
XFontSet /* font_set */, XFontSet /* font_set */,
_Xconst wchar_t* /* text */, const wchar_t* /* text */,
int /* text_len */ int /* text_len */
#endif
); );
typedef int (*XwcTextExtentsProc)( typedef int (*XwcTextExtentsProc)(
#if NeedFunctionPrototypes
XFontSet /* font_set */, XFontSet /* font_set */,
_Xconst wchar_t* /* text */, const wchar_t* /* text */,
int /* text_len */, int /* text_len */,
XRectangle* /* overall_ink_extents */, XRectangle* /* overall_ink_extents */,
XRectangle* /* overall_logical_extents */ XRectangle* /* overall_logical_extents */
#endif
); );
typedef Status (*XwcTextPerCharExtentsProc)( typedef Status (*XwcTextPerCharExtentsProc)(
#if NeedFunctionPrototypes
XFontSet /* font_set */, XFontSet /* font_set */,
_Xconst wchar_t* /* text */, const wchar_t* /* text */,
int /* text_len */, int /* text_len */,
XRectangle* /* ink_extents_buffer */, XRectangle* /* ink_extents_buffer */,
XRectangle* /* logical_extents_buffer */, XRectangle* /* logical_extents_buffer */,
@ -591,33 +524,28 @@ typedef Status (*XwcTextPerCharExtentsProc)(
int* /* num_chars */, int* /* num_chars */,
XRectangle* /* max_ink_extents */, XRectangle* /* max_ink_extents */,
XRectangle* /* max_logical_extents */ XRectangle* /* max_logical_extents */
#endif
); );
typedef int (*XwcDrawStringProc)( typedef int (*XwcDrawStringProc)(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Drawable /* drawable */, Drawable /* drawable */,
XFontSet /* font_set */, XFontSet /* font_set */,
GC /* gc */, GC /* gc */,
int /* x */, int /* x */,
int /* y */, int /* y */,
_Xconst wchar_t* /* text */, const wchar_t* /* text */,
int /* text_len */ int /* text_len */
#endif
); );
typedef void (*XwcDrawImageStringProc)( typedef void (*XwcDrawImageStringProc)(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Drawable /* drawable */, Drawable /* drawable */,
XFontSet /* font_set */, XFontSet /* font_set */,
GC /* gc */, GC /* gc */,
int /* x */, int /* x */,
int /* y */, int /* y */,
_Xconst wchar_t* /* text */, const wchar_t* /* text */,
int /* text_len */ int /* text_len */
#endif
); );
typedef struct { typedef struct {
@ -669,12 +597,6 @@ typedef struct _XOC {
} XOCRec; } XOCRec;
/* current Ultrix compiler gets horribly confused */
#if defined(FUNCPROTO) && defined(ultrix)
#undef NeedFunctionPrototypes
#endif
/* /*
* X Input Managers are an instantiable object, so we define it, the * X Input Managers are an instantiable object, so we define it, the
* object itself, a method list and data. * object itself, a method list and data.
@ -685,34 +607,22 @@ typedef struct _XOC {
*/ */
typedef struct { typedef struct {
Status (*close)( Status (*close)(
#if NeedFunctionPrototypes
XIM XIM
#endif
); );
char* (*set_values)( char* (*set_values)(
#if NeedFunctionPrototypes
XIM, XIMArg* XIM, XIMArg*
#endif
); );
char* (*get_values)( char* (*get_values)(
#if NeedFunctionPrototypes
XIM, XIMArg* XIM, XIMArg*
#endif
); );
XIC (*create_ic)( XIC (*create_ic)(
#if NeedFunctionPrototypes
XIM, XIMArg* XIM, XIMArg*
#endif
); );
int (*ctstombs)( int (*ctstombs)(
#if NeedFunctionPrototypes
XIM, char*, int, char*, int, Status * XIM, char*, int, char*, int, Status *
#endif
); );
int (*ctstowcs)( int (*ctstowcs)(
#if NeedFunctionPrototypes
XIM, char*, int, wchar_t*, int, Status * XIM, char*, int, wchar_t*, int, Status *
#endif
); );
} XIMMethodsRec, *XIMMethods; } XIMMethodsRec, *XIMMethods;
@ -763,49 +673,31 @@ typedef struct _XIM {
*/ */
typedef struct { typedef struct {
void (*destroy)( void (*destroy)(
#if NeedFunctionPrototypes
XIC XIC
#endif
); );
void (*set_focus)( void (*set_focus)(
#if NeedFunctionPrototypes
XIC XIC
#endif
); );
void (*unset_focus)( void (*unset_focus)(
#if NeedFunctionPrototypes
XIC XIC
#endif
); );
char* (*set_values)( char* (*set_values)(
#if NeedFunctionPrototypes
XIC, XIMArg* XIC, XIMArg*
#endif
); );
char* (*get_values)( char* (*get_values)(
#if NeedFunctionPrototypes
XIC, XIMArg* XIC, XIMArg*
#endif
); );
char* (*mb_reset)( char* (*mb_reset)(
#if NeedFunctionPrototypes
XIC XIC
#endif
); );
wchar_t* (*wc_reset)( wchar_t* (*wc_reset)(
#if NeedFunctionPrototypes
XIC XIC
#endif
); );
int (*mb_lookup_string)( int (*mb_lookup_string)(
#if NeedFunctionPrototypes
XIC, XKeyEvent*, char*, int, KeySym*, Status* XIC, XKeyEvent*, char*, int, KeySym*, Status*
#endif
); );
int (*wc_lookup_string)( int (*wc_lookup_string)(
#if NeedFunctionPrototypes
XIC, XKeyEvent*, wchar_t*, int, KeySym*, Status* XIC, XKeyEvent*, wchar_t*, int, KeySym*, Status*
#endif
); );
} XICMethodsRec, *XICMethods; } XICMethodsRec, *XICMethods;
@ -847,186 +739,135 @@ typedef struct _XIC {
XICCoreRec core; /* data of this IC */ XICCoreRec core; /* data of this IC */
} XICRec; } XICRec;
/* current Ultrix compiler gets horribly confused */
#if !defined(NeedFunctionPrototypes) && defined(FUNCPROTO)
#define NeedFunctionPrototypes 1
#endif
typedef XLCd (*XLCdLoadProc)( typedef XLCd (*XLCdLoadProc)(
#if NeedFunctionPrototypes
char* char*
#endif
); );
_XFUNCPROTOBEGIN _XFUNCPROTOBEGIN
extern XLCd _falOpenLC( extern XLCd _falOpenLC(
#if NeedFunctionPrototypes
char* /* name */ char* /* name */
#endif
); );
extern void _falCloseLC( extern void _falCloseLC(
#if NeedFunctionPrototypes
XLCd /* lcd */ XLCd /* lcd */
#endif
); );
extern XLCd _fallcCurrentLC( extern XLCd _fallcCurrentLC(
#if NeedFunctionPrototypes
void void
#endif
); );
extern Bool _fallcValidModSyntax( extern Bool _fallcValidModSyntax(
#if NeedFunctionPrototypes
char* /* mods */, char* /* mods */,
char** /* valid */ char** /* valid */
#endif
); );
extern char *_fallcDefaultMapModifiers( extern char *_fallcDefaultMapModifiers(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
char* /* user_mods */, char* /* user_mods */,
char* /* prog_mods */ char* /* prog_mods */
#endif
); );
extern void _XIMCompileResourceList( extern void _XIMCompileResourceList(
#if NeedFunctionPrototypes
XIMResourceList /* res */, XIMResourceList /* res */,
unsigned int /* num_res */ unsigned int /* num_res */
#endif
); );
extern void _XCopyToArg( extern void _XCopyToArg(
#if NeedFunctionPrototypes
XPointer /* src */, XPointer /* src */,
XPointer* /* dst */, XPointer* /* dst */,
unsigned int /* size */ unsigned int /* size */
#endif
); );
extern char ** _falParseBaseFontNameList( extern char ** _falParseBaseFontNameList(
#if NeedFunctionPrototypes
char* /* str */, char* /* str */,
int* /* num */ int* /* num */
#endif
); );
extern XrmMethods _falrmInitParseInfo( extern XrmMethods _falrmInitParseInfo(
#if NeedFunctionPrototypes
XPointer* /* statep */ XPointer* /* statep */
#endif
); );
extern void _XRegisterFilterByMask( extern void _XRegisterFilterByMask(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
Window /* window */, Window /* window */,
unsigned long /* event_mask */, unsigned long /* event_mask */,
Bool (*)( Bool (*)(
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
Window /* window */, Window /* window */,
XEvent* /* event */, XEvent* /* event */,
XPointer /* client_data */ XPointer /* client_data */
#endif
) /* filter */, ) /* filter */,
XPointer /* client_data */ XPointer /* client_data */
#endif
); );
extern void _XRegisterFilterByType( extern void _XRegisterFilterByType(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
Window /* window */, Window /* window */,
int /* start_type */, int /* start_type */,
int /* end_type */, int /* end_type */,
Bool (*)( Bool (*)(
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
Window /* window */, Window /* window */,
XEvent* /* event */, XEvent* /* event */,
XPointer /* client_data */ XPointer /* client_data */
#endif
) /* filter */, ) /* filter */,
XPointer /* client_data */ XPointer /* client_data */
#endif
); );
extern void _XUnregisterFilter( extern void _XUnregisterFilter(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
Window /* window */, Window /* window */,
Bool (*)( Bool (*)(
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
Window /* window */, Window /* window */,
XEvent* /* event */, XEvent* /* event */,
XPointer /* client_data */ XPointer /* client_data */
#endif
) /* filter */, ) /* filter */,
XPointer /* client_data */ XPointer /* client_data */
#endif
); );
extern void _fallcCountVaList( extern void _fallcCountVaList(
#if NeedFunctionPrototypes
va_list /* var */, va_list /* var */,
int* /* count_return */ int* /* count_return */
#endif
); );
extern void _fallcVaToArgList( extern void _fallcVaToArgList(
#if NeedFunctionPrototypes
va_list /* var */, va_list /* var */,
int /* count */, int /* count */,
XlcArgList* /* args_return */ XlcArgList* /* args_return */
#endif
); );
extern void _fallcCompileResourceList( extern void _fallcCompileResourceList(
#if NeedFunctionPrototypes
XlcResourceList /* resources */, XlcResourceList /* resources */,
int /* num_resources */ int /* num_resources */
#endif
); );
extern char *_fallcGetValues( extern char *_fallcGetValues(
#if NeedFunctionPrototypes
XPointer /* base */, XPointer /* base */,
XlcResourceList /* resources */, XlcResourceList /* resources */,
int /* num_resources */, int /* num_resources */,
XlcArgList /* args */, XlcArgList /* args */,
int /* num_args */, int /* num_args */,
unsigned long /* mask */ unsigned long /* mask */
#endif
); );
extern char *_fallcSetValues( extern char *_fallcSetValues(
#if NeedFunctionPrototypes
XPointer /* base */, XPointer /* base */,
XlcResourceList /* resources */, XlcResourceList /* resources */,
int /* num_resources */, int /* num_resources */,
XlcArgList /* args */, XlcArgList /* args */,
int /* num_args */, int /* num_args */,
unsigned long /* mask */ unsigned long /* mask */
#endif
); );
extern Bool _fallcAddLoader( extern Bool _fallcAddLoader(
#if NeedFunctionPrototypes
XLCdLoadProc /* proc */, XLCdLoadProc /* proc */,
XlcPosition /* position */ XlcPosition /* position */
#endif
); );
extern void _fallcRemoveLoader( extern void _fallcRemoveLoader(
#if NeedFunctionPrototypes
XLCdLoadProc /* proc */ XLCdLoadProc /* proc */
#endif
); );
_XFUNCPROTOEND _XFUNCPROTOEND

View file

@ -192,11 +192,9 @@ struct _XDisplay
#define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n) #define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n)
/* /*
* define the following if you want the Data macro to be a procedure instead * define DataRoutineIsProcedure if you want the Data macro to be a procedure
* instead
*/ */
#ifdef CRAY
#define DataRoutineIsProcedure
#endif /* CRAY */
#ifndef _XEVENT_ #ifndef _XEVENT_
/* /*
@ -214,21 +212,14 @@ typedef struct _XSQEvent
#define NEED_REPLIES #define NEED_REPLIES
#endif #endif
#if NeedFunctionPrototypes /* prototypes require event type definitions */
#define NEED_EVENTS #define NEED_EVENTS
#define NEED_REPLIES #define NEED_REPLIES
#endif
#include <X11/Xproto.h> #include <X11/Xproto.h>
#include <errno.h> #include <errno.h>
#define _XBCOPYFUNC _Xbcopy #define _XBCOPYFUNC _Xbcopy
#include <X11/Xfuncs.h> #include <X11/Xfuncs.h>
#include <X11/Xosdefs.h> #include <X11/Xosdefs.h>
/* Utek leaves kernel macros around in include files (bleah) */
#ifdef dirty
#undef dirty
#endif
#ifndef X_NOT_STDC_ENV #ifndef X_NOT_STDC_ENV
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -272,32 +263,24 @@ typedef struct _LockInfoRec *LockInfoPtr;
/* in XlibInt.c */ /* in XlibInt.c */
extern void (*_XCreateMutex_fn)( extern void (*_XCreateMutex_fn)(
#if NeedFunctionPrototypes
LockInfoPtr /* lock */ LockInfoPtr /* lock */
#endif
); );
extern void (*_XFreeMutex_fn)( extern void (*_XFreeMutex_fn)(
#if NeedFunctionPrototypes
LockInfoPtr /* lock */ LockInfoPtr /* lock */
#endif
); );
extern void (*_XLockMutex_fn)( extern void (*_XLockMutex_fn)(
#if NeedFunctionPrototypes
LockInfoPtr /* lock */ LockInfoPtr /* lock */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char * /* file */ , char * /* file */
, int /* line */ , int /* line */
#endif #endif
#endif
); );
extern void (*_XUnlockMutex_fn)( extern void (*_XUnlockMutex_fn)(
#if NeedFunctionPrototypes
LockInfoPtr /* lock */ LockInfoPtr /* lock */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char * /* file */ , char * /* file */
, int /* line */ , int /* line */
#endif #endif
#endif
); );
extern LockInfoPtr _Xglobal_lock; extern LockInfoPtr _Xglobal_lock;
@ -348,9 +331,6 @@ extern LockInfoPtr _Xglobal_lock;
#endif #endif
#ifndef NULL
#define NULL 0
#endif
#define LOCKED 1 #define LOCKED 1
#define UNLOCKED 0 #define UNLOCKED 0
@ -402,26 +382,7 @@ extern int errno; /* Internal system error number. */
* X Protocol packetizing macros. * X Protocol packetizing macros.
*/ */
/* Need to start requests on 64 bit word boundaries
* on a CRAY computer so add a NoOp (127) if needed.
* A character pointer on a CRAY computer will be non-zero
* after shifting right 61 bits of it is not pointing to
* a word boundary.
*/
#ifdef WORD64
#define WORD64ALIGN if ((long)dpy->bufptr >> 61) {\
dpy->last_req = dpy->bufptr;\
*(dpy->bufptr) = X_NoOperation;\
*(dpy->bufptr+1) = 0;\
*(dpy->bufptr+2) = 0;\
*(dpy->bufptr+3) = 1;\
dpy->request++;\
dpy->bufptr += 4;\
}
#else /* else does not require alignment on 64-bit boundaries */
#define WORD64ALIGN #define WORD64ALIGN
#endif /* WORD64 */
/* /*
* GetReq - Get the next available X request packet in the buffer and * GetReq - Get the next available X request packet in the buffer and
@ -537,18 +498,6 @@ extern int errno; /* Internal system error number. */
dpy->request++ dpy->request++
#endif #endif
#ifdef WORD64
#define MakeBigReq(req,n) \
{ \
char _BRdat[4]; \
unsigned long _BRlen = req->length - 1; \
req->length = 0; \
memcpy(_BRdat, ((char *)req) + (_BRlen << 2), 4); \
memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \
memcpy(((char *)req) + 4, _BRdat, 4); \
Data32(dpy, (long *)&_BRdat, 4); \
}
#else
#define MakeBigReq(req,n) \ #define MakeBigReq(req,n) \
{ \ { \
long _BRdat; \ long _BRdat; \
@ -559,7 +508,6 @@ extern int errno; /* Internal system error number. */
((unsigned long *)req)[1] = _BRlen + n + 2; \ ((unsigned long *)req)[1] = _BRlen + n + 2; \
Data32(dpy, &_BRdat, 4); \ Data32(dpy, &_BRdat, 4); \
} }
#endif
#define SetReqLen(req,n,badlen) \ #define SetReqLen(req,n,badlen) \
if ((req->length + n) > (unsigned)65535) { \ if ((req->length + n) > (unsigned)65535) { \
@ -615,10 +563,6 @@ extern int errno; /* Internal system error number. */
ptr = (type) dpy->bufptr; \ ptr = (type) dpy->bufptr; \
dpy->bufptr += (n); dpy->bufptr += (n);
#ifdef WORD64
#define Data16(dpy, data, len) _XData16(dpy, (short *)data, len)
#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len)
#else
#define Data16(dpy, data, len) Data((dpy), (char *)(data), (len)) #define Data16(dpy, data, len) Data((dpy), (char *)(data), (len))
#define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len)) #define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len))
#define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len)) #define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len))
@ -628,7 +572,6 @@ extern int errno; /* Internal system error number. */
#define Data32(dpy, data, len) Data((dpy), (char *)(data), (len)) #define Data32(dpy, data, len) Data((dpy), (char *)(data), (len))
#define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len)) #define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len))
#endif #endif
#endif /* not WORD64 */
#define PackData16(dpy,data,len) Data16 (dpy, data, len) #define PackData16(dpy,data,len) Data16 (dpy, data, len)
#define PackData32(dpy,data,len) Data32 (dpy, data, len) #define PackData32(dpy,data,len) Data32 (dpy, data, len)
@ -778,87 +721,60 @@ _XFUNCPROTOBEGIN
extern void Data(); extern void Data();
#endif #endif
extern int _XError( extern int _XError(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
xError* /* rep */ xError* /* rep */
#endif
); );
extern int _XIOError( extern int _XIOError(
#if NeedFunctionPrototypes
Display* /* dpy */ Display* /* dpy */
#endif
); );
extern int (*_XIOErrorFunction)( extern int (*_XIOErrorFunction)(
#if NeedNestedPrototypes
Display* /* dpy */ Display* /* dpy */
#endif
); );
extern int (*_XErrorFunction)( extern int (*_XErrorFunction)(
#if NeedNestedPrototypes
Display* /* dpy */, Display* /* dpy */,
XErrorEvent* /* error_event */ XErrorEvent* /* error_event */
#endif
); );
extern void _XEatData( extern void _XEatData(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
unsigned long /* n */ unsigned long /* n */
#endif
); );
extern char *_XAllocScratch( extern char *_XAllocScratch(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
unsigned long /* nbytes */ unsigned long /* nbytes */
#endif
); );
extern char *_XAllocTemp( extern char *_XAllocTemp(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
unsigned long /* nbytes */ unsigned long /* nbytes */
#endif
); );
extern void _XFreeTemp( extern void _XFreeTemp(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
char* /* buf */, char* /* buf */,
unsigned long /* nbytes */ unsigned long /* nbytes */
#endif
); );
extern Visual *_XVIDtoVisual( extern Visual *_XVIDtoVisual(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
VisualID /* id */ VisualID /* id */
#endif
); );
extern unsigned long _XSetLastRequestRead( extern unsigned long _XSetLastRequestRead(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
xGenericReply* /* rep */ xGenericReply* /* rep */
#endif
); );
extern int _XGetHostname( extern int _XGetHostname(
#if NeedFunctionPrototypes
char* /* buf */, char* /* buf */,
int /* maxlen */ int /* maxlen */
#endif
); );
extern Screen *_XScreenOfWindow( extern Screen *_XScreenOfWindow(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
Window /* w */ Window /* w */
#endif
); );
extern Bool _XAsyncErrorHandler( extern Bool _XAsyncErrorHandler(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
xReply* /* rep */, xReply* /* rep */,
char* /* buf */, char* /* buf */,
int /* len */, int /* len */,
XPointer /* data */ XPointer /* data */
#endif
); );
extern char *_XGetAsyncReply( extern char *_XGetAsyncReply(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
char* /* replbuf */, char* /* replbuf */,
xReply* /* rep */, xReply* /* rep */,
@ -866,347 +782,238 @@ extern char *_XGetAsyncReply(
int /* len */, int /* len */,
int /* extra */, int /* extra */,
Bool /* discard */ Bool /* discard */
#endif
); );
extern _XFlush( extern _XFlush(
#if NeedFunctionPrototypes
Display* /* dpy */ Display* /* dpy */
#endif
); );
extern int _XEventsQueued( extern int _XEventsQueued(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
int /* mode */ int /* mode */
#endif
); );
extern _XReadEvents( extern _XReadEvents(
#if NeedFunctionPrototypes
Display* /* dpy */ Display* /* dpy */
#endif
); );
extern _XRead( extern _XRead(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
char* /* data */, char* /* data */,
long /* size */ long /* size */
#endif
); );
extern _XReadPad( extern _XReadPad(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
char* /* data */, char* /* data */,
long /* size */ long /* size */
#endif
); );
extern _XSend( extern _XSend(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
_Xconst char* /* data */, const char* /* data */,
long /* size */ long /* size */
#endif
); );
extern Status _XReply( extern Status _XReply(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
xReply* /* rep */, xReply* /* rep */,
int /* extra */, int /* extra */,
Bool /* discard */ Bool /* discard */
#endif
); );
extern _XEnq( extern _XEnq(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
xEvent* /* event */ xEvent* /* event */
#endif
); );
extern _XDeq( extern _XDeq(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
_XQEvent* /* prev */, _XQEvent* /* prev */,
_XQEvent* /* qelt */ _XQEvent* /* qelt */
#endif
); );
extern int (*XESetCreateGC( extern int (*XESetCreateGC(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
int /* extension */, int /* extension */,
int (*) ( int (*) (
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
GC /* gc */, GC /* gc */,
XExtCodes* /* codes */ XExtCodes* /* codes */
#endif
) /* proc */ ) /* proc */
#endif
))( ))(
#if NeedNestedPrototypes
Display*, GC, XExtCodes* Display*, GC, XExtCodes*
#endif
); );
extern int (*XESetCopyGC( extern int (*XESetCopyGC(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
int /* extension */, int /* extension */,
int (*) ( int (*) (
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
GC /* gc */, GC /* gc */,
XExtCodes* /* codes */ XExtCodes* /* codes */
#endif
) /* proc */ ) /* proc */
#endif
))( ))(
#if NeedNestedPrototypes
Display*, GC, XExtCodes* Display*, GC, XExtCodes*
#endif
); );
extern int (*XESetFlushGC( extern int (*XESetFlushGC(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
int /* extension */, int /* extension */,
int (*) ( int (*) (
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
GC /* gc */, GC /* gc */,
XExtCodes* /* codes */ XExtCodes* /* codes */
#endif
) /* proc */ ) /* proc */
#endif
))( ))(
#if NeedNestedPrototypes
Display*, GC, XExtCodes* Display*, GC, XExtCodes*
#endif
); );
extern int (*XESetFreeGC( extern int (*XESetFreeGC(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
int /* extension */, int /* extension */,
int (*) ( int (*) (
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
GC /* gc */, GC /* gc */,
XExtCodes* /* codes */ XExtCodes* /* codes */
#endif
) /* proc */ ) /* proc */
#endif
))( ))(
#if NeedNestedPrototypes
Display*, GC, XExtCodes* Display*, GC, XExtCodes*
#endif
); );
extern int (*XESetCreateFont( extern int (*XESetCreateFont(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
int /* extension */, int /* extension */,
int (*) ( int (*) (
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
XFontStruct* /* fs */, XFontStruct* /* fs */,
XExtCodes* /* codes */ XExtCodes* /* codes */
#endif
) /* proc */ ) /* proc */
#endif
))( ))(
#if NeedNestedPrototypes
Display*, XFontStruct*, XExtCodes* Display*, XFontStruct*, XExtCodes*
#endif
); );
extern int (*XESetFreeFont( extern int (*XESetFreeFont(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
int /* extension */, int /* extension */,
int (*) ( int (*) (
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
XFontStruct* /* fs */, XFontStruct* /* fs */,
XExtCodes* /* codes */ XExtCodes* /* codes */
#endif
) /* proc */ ) /* proc */
#endif
))( ))(
#if NeedNestedPrototypes
Display*, XFontStruct*, XExtCodes* Display*, XFontStruct*, XExtCodes*
#endif
); );
extern int (*XESetCloseDisplay( extern int (*XESetCloseDisplay(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
int /* extension */, int /* extension */,
int (*) ( int (*) (
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
XExtCodes* /* codes */ XExtCodes* /* codes */
#endif
) /* proc */ ) /* proc */
#endif
))( ))(
#if NeedNestedPrototypes
Display*, XExtCodes* Display*, XExtCodes*
#endif
); );
extern int (*XESetError( extern int (*XESetError(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
int /* extension */, int /* extension */,
int (*) ( int (*) (
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
xError* /* err */, xError* /* err */,
XExtCodes* /* codes */, XExtCodes* /* codes */,
int* /* ret_code */ int* /* ret_code */
#endif
) /* proc */ ) /* proc */
#endif
))( ))(
#if NeedNestedPrototypes
Display*, xError*, XExtCodes*, int* Display*, xError*, XExtCodes*, int*
#endif
); );
extern char* (*XESetErrorString( extern char* (*XESetErrorString(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
int /* extension */, int /* extension */,
char* (*) ( char* (*) (
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
int /* code */, int /* code */,
XExtCodes* /* codes */, XExtCodes* /* codes */,
char* /* buffer */, char* /* buffer */,
int /* nbytes */ int /* nbytes */
#endif
) /* proc */ ) /* proc */
#endif
))( ))(
#if NeedNestedPrototypes
Display*, int, XExtCodes*, char*, int Display*, int, XExtCodes*, char*, int
#endif
); );
extern void (*XESetPrintErrorValues ( extern void (*XESetPrintErrorValues (
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
int /* extension */, int /* extension */,
void (*)( void (*)(
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
XErrorEvent* /* ev */, XErrorEvent* /* ev */,
void* /* fp */ void* /* fp */
#endif
) /* proc */ ) /* proc */
#endif
))( ))(
#if NeedNestedPrototypes
Display*, XErrorEvent*, void* Display*, XErrorEvent*, void*
#endif
); );
extern Bool (*XESetWireToEvent( extern Bool (*XESetWireToEvent(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
int /* event_number */, int /* event_number */,
Bool (*) ( Bool (*) (
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
XEvent* /* re */, XEvent* /* re */,
xEvent* /* event */ xEvent* /* event */
#endif
) /* proc */ ) /* proc */
#endif
))( ))(
#if NeedNestedPrototypes
Display*, XEvent*, xEvent* Display*, XEvent*, xEvent*
#endif
); );
extern Status (*XESetEventToWire( extern Status (*XESetEventToWire(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
int /* event_number */, int /* event_number */,
Status (*) ( Status (*) (
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
XEvent* /* re */, XEvent* /* re */,
xEvent* /* event */ xEvent* /* event */
#endif
) /* proc */ ) /* proc */
#endif
))( ))(
#if NeedNestedPrototypes
Display*, XEvent*, xEvent* Display*, XEvent*, xEvent*
#endif
); );
extern Bool (*XESetWireToError( extern Bool (*XESetWireToError(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
int /* error_number */, int /* error_number */,
Bool (*) ( Bool (*) (
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
XErrorEvent* /* he */, XErrorEvent* /* he */,
xError* /* we */ xError* /* we */
#endif
) /* proc */ ) /* proc */
#endif
))( ))(
#if NeedNestedPrototypes
Display*, XErrorEvent*, xError* Display*, XErrorEvent*, xError*
#endif
); );
extern void (*XESetBeforeFlush( extern void (*XESetBeforeFlush(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
int /* error_number */, int /* error_number */,
void (*) ( void (*) (
#if NeedNestedPrototypes
Display* /* display */, Display* /* display */,
XExtCodes* /* codes */, XExtCodes* /* codes */,
char* /* data */, char* /* data */,
long /* len */ long /* len */
#endif
) /* proc */ ) /* proc */
#endif
))( ))(
#if NeedNestedPrototypes
Display*, XExtCodes*, char*, long Display*, XExtCodes*, char*, long
#endif
); );
/* internal connections for IMs */ /* internal connections for IMs */
typedef void (*_XInternalConnectionProc)( typedef void (*_XInternalConnectionProc)(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
int /* fd */, int /* fd */,
XPointer /* call_data */ XPointer /* call_data */
#endif
); );
extern Status _XRegisterInternalConnection( extern Status _XRegisterInternalConnection(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
int /* fd */, int /* fd */,
_XInternalConnectionProc /* callback */, _XInternalConnectionProc /* callback */,
XPointer /* call_data */ XPointer /* call_data */
#endif
); );
extern void _XUnregisterInternalConnection( extern void _XUnregisterInternalConnection(
#if NeedFunctionPrototypes
Display* /* dpy */, Display* /* dpy */,
int /* fd */ int /* fd */
#endif
); );
/* Display structure has pointers to these */ /* Display structure has pointers to these */
@ -1226,19 +1033,15 @@ struct _XConnWatchInfo { /* info from XAddConnectionWatch */
}; };
extern int XTextHeight( extern int XTextHeight(
#if NeedFunctionPrototypes
XFontStruct* /* font_struct */, XFontStruct* /* font_struct */,
_Xconst char* /* string */, const char* /* string */,
int /* count */ int /* count */
#endif
); );
extern int XTextHeight16( extern int XTextHeight16(
#if NeedFunctionPrototypes
XFontStruct* /* font_struct */, XFontStruct* /* font_struct */,
_Xconst XChar2b* /* string */, const XChar2b* /* string */,
int /* count */ int /* count */
#endif
); );
_XFUNCPROTOEND _XFUNCPROTOEND

View file

@ -70,9 +70,7 @@ struct _XCVList {
}; };
extern xthread_t (*_Xthread_self_fn)( /* in XlibInt.c */ extern xthread_t (*_Xthread_self_fn)( /* in XlibInt.c */
#if NeedFunctionPrototypes
void void
#endif
); );
/* Display->lock is a pointer to one of these */ /* Display->lock is a pointer to one of these */
@ -97,77 +95,57 @@ struct _XLockInfo {
struct _XCVList *free_cvls; struct _XCVList *free_cvls;
/* used only in XlibInt.c */ /* used only in XlibInt.c */
void (*pop_reader)( void (*pop_reader)(
#if NeedNestedPrototypes
Display* /* dpy */, Display* /* dpy */,
struct _XCVList** /* list */, struct _XCVList** /* list */,
struct _XCVList*** /* tail */ struct _XCVList*** /* tail */
#endif
); );
struct _XCVList *(*push_reader)( struct _XCVList *(*push_reader)(
#if NeedNestedPrototypes
Display * /* dpy */, Display * /* dpy */,
struct _XCVList*** /* tail */ struct _XCVList*** /* tail */
#endif
); );
void (*condition_wait)( void (*condition_wait)(
#if NeedNestedPrototypes
xcondition_t /* cv */, xcondition_t /* cv */,
xmutex_t /* mutex */ xmutex_t /* mutex */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char* /* file */, , char* /* file */,
int /* line */ int /* line */
#endif
#endif #endif
); );
void (*internal_lock_display)( void (*internal_lock_display)(
#if NeedNestedPrototypes
Display* /* dpy */, Display* /* dpy */,
Bool /* wskip */ Bool /* wskip */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char* /* file */, , char* /* file */,
int /* line */ int /* line */
#endif
#endif #endif
); );
/* used in XlibInt.c and locking.c */ /* used in XlibInt.c and locking.c */
void (*condition_signal)( void (*condition_signal)(
#if NeedNestedPrototypes
xcondition_t /* cv */ xcondition_t /* cv */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char* /* file */, , char* /* file */,
int /* line */ int /* line */
#endif
#endif #endif
); );
void (*condition_broadcast)( void (*condition_broadcast)(
#if NeedNestedPrototypes
xcondition_t /* cv */ xcondition_t /* cv */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char* /* file */, , char* /* file */,
int /* line */ int /* line */
#endif
#endif #endif
); );
/* used in XlibInt.c and XLockDis.c */ /* used in XlibInt.c and XLockDis.c */
void (*lock_wait)( void (*lock_wait)(
#if NeedNestedPrototypes
Display* /* dpy */ Display* /* dpy */
#endif
); );
void (*user_lock_display)( void (*user_lock_display)(
#if NeedNestedPrototypes
Display* /* dpy */ Display* /* dpy */
#endif
); );
void (*user_unlock_display)( void (*user_unlock_display)(
#if NeedNestedPrototypes
Display* /* dpy */ Display* /* dpy */
#endif
); );
struct _XCVList *(*create_cvl)( struct _XCVList *(*create_cvl)(
#if NeedNestedPrototypes
Display * /* dpy */ Display * /* dpy */
#endif
); );
}; };

View file

@ -86,9 +86,7 @@ extern void dbg_printValue(char *str, char **value, int num);
/* For VW/UDC start */ /* For VW/UDC start */
static FontData static FontData
init_fontdata(font_data, font_data_count) init_fontdata(FontData font_data, int font_data_count)
FontData font_data;
int font_data_count;
{ {
FontData fd; FontData fd;
int i; int i;
@ -105,12 +103,12 @@ init_fontdata(font_data, font_data_count)
} }
static VRotate static VRotate
init_vrotate(font_data, font_data_count, type, code_range, code_range_num) init_vrotate(
FontData font_data; FontData font_data,
int font_data_count; int font_data_count,
int type; int type,
CodeRange code_range; CodeRange code_range,
int code_range_num; int code_range_num)
{ {
VRotate vrotate; VRotate vrotate;
int i; int i;
@ -136,13 +134,13 @@ init_vrotate(font_data, font_data_count, type, code_range, code_range_num)
} }
static Bool static Bool
init_fontset(oc) init_fontset(XOC oc)
XOC oc;
{ {
XOCGenericPart *gen; XOCGenericPart *gen;
FontSet font_set; FontSet font_set;
OMData data; OMData data;
int count; int count;
int err = 0;
count = XOM_GENERIC(oc->core.om)->data_num; count = XOM_GENERIC(oc->core.om)->data_num;
data = XOM_GENERIC(oc->core.om)->data; data = XOM_GENERIC(oc->core.om)->data;
@ -161,16 +159,22 @@ init_fontset(oc)
font_set->charset_list = data->charset_list; font_set->charset_list = data->charset_list;
if((font_set->font_data = init_fontdata(data->font_data, if((font_set->font_data = init_fontdata(data->font_data,
data->font_data_count)) == NULL) data->font_data_count)) == NULL){
goto err; err += 1;
break;
}
font_set->font_data_count = data->font_data_count; font_set->font_data_count = data->font_data_count;
if((font_set->substitute = init_fontdata(data->substitute, if((font_set->substitute = init_fontdata(data->substitute,
data->substitute_num)) == NULL) data->substitute_num)) == NULL){
goto err; err += 1;
break;
}
font_set->substitute_num = data->substitute_num; font_set->substitute_num = data->substitute_num;
if((font_set->vmap = init_fontdata(data->vmap, if((font_set->vmap = init_fontdata(data->vmap,
data->vmap_num)) == NULL) data->vmap_num)) == NULL){
goto err; err += 1;
break;
}
font_set->vmap_num = data->vmap_num; font_set->vmap_num = data->vmap_num;
if(data->vrotate_type != VROTATE_NONE) { if(data->vrotate_type != VROTATE_NONE) {
@ -180,35 +184,37 @@ init_fontset(oc)
data->font_data_count, data->font_data_count,
data->vrotate_type, data->vrotate_type,
data->vrotate, data->vrotate,
data->vrotate_num)) == NULL) data->vrotate_num)) == NULL){
goto err; err += 1;
break;
}
font_set->vrotate_num = data->font_data_count; font_set->vrotate_num = data->font_data_count;
} }
} }
return True;
err: if (err == 1){
if(font_set->font_data) if(font_set->font_data)
Xfree(font_set->font_data); Xfree(font_set->font_data);
if(font_set->substitute) if(font_set->substitute)
Xfree(font_set->substitute); Xfree(font_set->substitute);
if(font_set->vmap) if(font_set->vmap)
Xfree(font_set->vmap); Xfree(font_set->vmap);
if(font_set->vrotate) if(font_set->vrotate)
Xfree(font_set->vrotate); Xfree(font_set->vrotate);
if(font_set) if(font_set)
Xfree(font_set); Xfree(font_set);
gen->font_set = (FontSet) NULL; gen->font_set = (FontSet) NULL;
gen->font_set_num = 0; gen->font_set_num = 0;
return False; return False;
} else {
return True;
}
} }
/* For VW/UDC end */ /* For VW/UDC end */
static char * static char *
get_prop_name(dpy, fs) get_prop_name(Display *dpy, XFontStruct *fs)
Display *dpy;
XFontStruct *fs;
{ {
unsigned long fp; unsigned long fp;
@ -219,9 +225,7 @@ get_prop_name(dpy, fs)
} }
static FontData static FontData
check_charset(font_set, font_name) check_charset(FontSet font_set, char *font_name)
FontSet font_set;
char *font_name;
{ {
FontData font_data; FontData font_data;
char *last; char *last;
@ -245,10 +249,7 @@ check_charset(font_set, font_name)
} }
static int static int
check_fontname(oc, name, found_num) check_fontname(XOC oc, char *name, int found_num)
XOC oc;
char *name;
int found_num;
{ {
Display *dpy = oc->core.om->core.display; Display *dpy = oc->core.om->core.display;
XOCGenericPart *gen = XOC_GENERIC(oc); XOCGenericPart *gen = XOC_GENERIC(oc);
@ -309,10 +310,7 @@ check_fontname(oc, name, found_num)
/* For VW/UDC start */ /* For VW/UDC start */
static Bool static Bool
load_fontdata(oc, font_data, font_data_num) load_fontdata(XOC oc, FontData font_data, int font_data_num)
XOC oc;
FontData font_data;
int font_data_num;
{ {
Display *dpy = oc->core.om->core.display; Display *dpy = oc->core.om->core.display;
FontData fd = font_data; FontData fd = font_data;
@ -328,8 +326,7 @@ load_fontdata(oc, font_data, font_data_num)
} }
static Bool static Bool
load_font(oc) load_font(XOC oc)
XOC oc;
{ {
int i; int i;
XOCGenericPart *gen = XOC_GENERIC(oc); XOCGenericPart *gen = XOC_GENERIC(oc);
@ -374,8 +371,7 @@ load_font(oc)
/* For VW/UDC end */ /* For VW/UDC end */
static Bool static Bool
load_font_info(oc) load_font_info(XOC oc)
XOC oc;
{ {
Display *dpy = oc->core.om->core.display; Display *dpy = oc->core.om->core.display;
XOCGenericPart *gen = XOC_GENERIC(oc); XOCGenericPart *gen = XOC_GENERIC(oc);
@ -403,10 +399,11 @@ load_font_info(oc)
/* For Vertical Writing start */ /* For Vertical Writing start */
static void static void
check_fontset_extents(overall, logical_ascent, logical_descent, font) check_fontset_extents(
XCharStruct *overall; XCharStruct *overall,
int *logical_ascent, *logical_descent; int *logical_ascent,
XFontStruct *font; int *logical_descent,
XFontStruct *font)
{ {
overall->lbearing = min(overall->lbearing, font->min_bounds.lbearing); overall->lbearing = min(overall->lbearing, font->min_bounds.lbearing);
overall->rbearing = max(overall->rbearing, font->max_bounds.rbearing); overall->rbearing = max(overall->rbearing, font->max_bounds.rbearing);
@ -420,8 +417,7 @@ check_fontset_extents(overall, logical_ascent, logical_descent, font)
/* For Vertical Writing end */ /* For Vertical Writing end */
static void static void
set_fontset_extents(oc) set_fontset_extents(XOC oc)
XOC oc;
{ {
XRectangle *ink = &oc->core.font_set_extents.max_ink_extent; XRectangle *ink = &oc->core.font_set_extents.max_ink_extent;
XRectangle *logical = &oc->core.font_set_extents.max_logical_extent; XRectangle *logical = &oc->core.font_set_extents.max_logical_extent;
@ -495,8 +491,7 @@ set_fontset_extents(oc)
} }
static Bool static Bool
init_core_part(oc) init_core_part(XOC oc)
XOC oc;
{ {
XOCGenericPart *gen = XOC_GENERIC(oc); XOCGenericPart *gen = XOC_GENERIC(oc);
FontSet font_set; FontSet font_set;
@ -524,12 +519,20 @@ init_core_part(oc)
return False; return False;
font_name_list = (char **) Xmalloc(sizeof(char *) * count); font_name_list = (char **) Xmalloc(sizeof(char *) * count);
if (font_name_list == NULL) if (font_name_list == NULL){
goto err; if (font_name_list)
Xfree(font_name_list);
Xfree(font_struct_list);
return False;
}
font_name_buf = (char *) Xmalloc(length); font_name_buf = (char *) Xmalloc(length);
if (font_name_buf == NULL) if (font_name_buf == NULL){
goto err; if (font_name_list)
Xfree(font_name_list);
Xfree(font_struct_list);
return False;
}
oc->core.font_info.num_font = count; oc->core.font_info.num_font = count;
oc->core.font_info.font_name_list = font_name_list; oc->core.font_info.font_name_list = font_name_list;
@ -556,19 +559,10 @@ init_core_part(oc)
set_fontset_extents(oc); set_fontset_extents(oc);
return True; return True;
err:
if (font_name_list)
Xfree(font_name_list);
Xfree(font_struct_list);
return False;
} }
static char * static char *
get_font_name(oc, pattern) get_font_name(XOC oc, char *pattern)
XOC oc;
char *pattern;
{ {
char **list, *name; char **list, *name;
int count = 0; int count = 0;
@ -589,8 +583,7 @@ get_font_name(oc, pattern)
/* For VW/UDC start*/ /* For VW/UDC start*/
static char static char
*get_rotate_fontname(font_name) *get_rotate_fontname(char *font_name)
char *font_name;
{ {
char *pattern = NULL, *ptr = NULL; char *pattern = NULL, *ptr = NULL;
char *fields[CHARSET_ENCODING_FIELD]; char *fields[CHARSET_ENCODING_FIELD];
@ -663,9 +656,7 @@ static char
} }
static Bool static Bool
is_match_charset(font_data, font_name) is_match_charset(FontData font_data, char *font_name)
FontData font_data;
char *font_name;
{ {
char *last; char *last;
int length, name_len; int length, name_len;
@ -684,10 +675,7 @@ is_match_charset(font_data, font_name)
} }
static int static int
parse_all_name(oc, font_data, pattern) parse_all_name(XOC oc, FontData font_data, char *pattern)
XOC oc;
FontData font_data;
char *pattern;
{ {
if(is_match_charset(font_data, pattern) != True) if(is_match_charset(font_data, pattern) != True)
@ -702,10 +690,7 @@ parse_all_name(oc, font_data, pattern)
} }
static int static int
parse_omit_name(oc, font_data, pattern) parse_omit_name(XOC oc, FontData font_data, char *pattern)
XOC oc;
FontData font_data;
char *pattern;
{ {
char *font_name = (char *) NULL; char *font_name = (char *) NULL;
char *last = (char *) NULL; char *last = (char *) NULL;
@ -770,14 +755,13 @@ parse_omit_name(oc, font_data, pattern)
typedef enum{C_PRIMARY, C_SUBSTITUTE, C_VMAP, C_VROTATE } ClassType; typedef enum{C_PRIMARY, C_SUBSTITUTE, C_VMAP, C_VROTATE } ClassType;
static int static int
parse_fontdata(oc, font_data, font_data_count, name_list, name_list_count, parse_fontdata(
class) XOC oc,
XOC oc; FontData font_data,
FontData font_data; int font_data_count,
int font_data_count; char **name_list,
char **name_list; int name_list_count,
int name_list_count; ClassType class)
ClassType class;
{ {
char **cur_name_list = name_list; char **cur_name_list = name_list;
char *font_name = (char *) NULL; char *font_name = (char *) NULL;
@ -866,11 +850,7 @@ parse_fontdata(oc, font_data, font_data_count, name_list, name_list_count,
static int static int
parse_vw(oc, font_set, name_list, count) parse_vw(XOC oc, FontSet font_set, char **name_list, int count)
XOC oc;
FontSet font_set;
char **name_list;
int count;
{ {
FontData vmap = font_set->vmap; FontData vmap = font_set->vmap;
VRotate vrotate = font_set->vrotate; VRotate vrotate = font_set->vrotate;
@ -929,8 +909,7 @@ parse_vw(oc, font_set, name_list, count)
} }
static int static int
parse_fontname(oc) parse_fontname(XOC oc)
XOC oc;
{ {
XOCGenericPart *gen = XOC_GENERIC(oc); XOCGenericPart *gen = XOC_GENERIC(oc);
FontSet font_set; FontSet font_set;
@ -957,17 +936,22 @@ parse_fontname(oc)
font_set->font_data_count, font_set->font_data_count,
name_list, count, C_PRIMARY); name_list, count, C_PRIMARY);
if(ret == -1) { if(ret == -1) {
goto err; falFreeStringList(name_list);
return -1;
} else if(ret == True) { } else if(ret == True) {
font_set->font_name = (char *)Xmalloc font_set->font_name = (char *)Xmalloc
(strlen(font_set->font_data->xlfd_name) + 1); (strlen(font_set->font_data->xlfd_name) + 1);
if(font_set->font_name == (char *) NULL) if(font_set->font_name == (char *) NULL){
goto err; falFreeStringList(name_list);
return -1;
}
strcpy(font_set->font_name, font_set->font_data->xlfd_name); strcpy(font_set->font_name, font_set->font_data->xlfd_name);
font_set->side = font_set->font_data->side; font_set->side = font_set->font_data->side;
if(parse_vw(oc, font_set, name_list, count) == -1) if(parse_vw(oc, font_set, name_list, count) == -1){
goto err; falFreeStringList(name_list);
return -1;
}
found_num++; found_num++;
/* The substitute font is serched, when the primary fonts */ /* The substitute font is serched, when the primary fonts */
@ -992,7 +976,8 @@ parse_fontname(oc)
font_set->substitute_num, font_set->substitute_num,
name_list, count, C_SUBSTITUTE); name_list, count, C_SUBSTITUTE);
if(ret == -1) { if(ret == -1) {
goto err; falFreeStringList(name_list);
return -1;
} else if(ret == True) { } else if(ret == True) {
for(i=0;i<font_set->substitute_num;i++){ for(i=0;i<font_set->substitute_num;i++){
if(font_set->substitute[i].xlfd_name != NULL){ if(font_set->substitute[i].xlfd_name != NULL){
@ -1001,12 +986,16 @@ parse_fontname(oc)
} }
font_set->font_name = (char *)Xmalloc font_set->font_name = (char *)Xmalloc
(strlen(font_set->substitute[i].xlfd_name) + 1); (strlen(font_set->substitute[i].xlfd_name) + 1);
if(font_set->font_name == (char *) NULL) if(font_set->font_name == (char *) NULL){
goto err; falFreeStringList(name_list);
return -1;
}
strcpy(font_set->font_name,font_set->substitute[i].xlfd_name); strcpy(font_set->font_name,font_set->substitute[i].xlfd_name);
font_set->side = font_set->substitute[i].side; font_set->side = font_set->substitute[i].side;
if(parse_vw(oc, font_set, name_list, count) == -1) if(parse_vw(oc, font_set, name_list, count) == -1){
goto err; falFreeStringList(name_list);
return -1;
}
found_num++; found_num++;
} }
} }
@ -1015,7 +1004,8 @@ parse_fontname(oc)
font_set->substitute_num, font_set->substitute_num,
name_list, count, C_SUBSTITUTE); name_list, count, C_SUBSTITUTE);
if(ret == -1) { if(ret == -1) {
goto err; falFreeStringList(name_list);
return -1;
} else if(ret == True) { } else if(ret == True) {
for(i=0;i<font_set->substitute_num;i++){ for(i=0;i<font_set->substitute_num;i++){
if(font_set->substitute[i].xlfd_name != NULL){ if(font_set->substitute[i].xlfd_name != NULL){
@ -1024,12 +1014,17 @@ parse_fontname(oc)
} }
font_set->font_name = (char *)Xmalloc font_set->font_name = (char *)Xmalloc
(strlen(font_set->substitute[i].xlfd_name) + 1); (strlen(font_set->substitute[i].xlfd_name) + 1);
if(font_set->font_name == (char *) NULL) if(font_set->font_name == (char *) NULL){
goto err; falFreeStringList(name_list);
return -1;
}
strcpy(font_set->font_name,font_set->substitute[i].xlfd_name); strcpy(font_set->font_name,font_set->substitute[i].xlfd_name);
font_set->side = font_set->substitute[i].side; font_set->side = font_set->substitute[i].side;
if(parse_vw(oc, font_set, name_list, count) == -1) if(parse_vw(oc, font_set, name_list, count) == -1){
goto err; falFreeStringList(name_list);
return -1;
}
found_num++; found_num++;
} }
@ -1037,8 +1032,10 @@ parse_fontname(oc)
} }
base_name = (char *) Xmalloc(strlen(oc->core.base_name_list) + 1); base_name = (char *) Xmalloc(strlen(oc->core.base_name_list) + 1);
if (base_name == NULL) if (base_name == NULL){
goto err; falFreeStringList(name_list);
return -1;
}
strcpy(base_name, oc->core.base_name_list); strcpy(base_name, oc->core.base_name_list);
oc->core.base_name_list = base_name; oc->core.base_name_list = base_name;
@ -1046,18 +1043,12 @@ parse_fontname(oc)
falFreeStringList(name_list); falFreeStringList(name_list);
return found_num; return found_num;
err:
falFreeStringList(name_list);
return -1;
} }
/* For VW/UDC end*/ /* For VW/UDC end*/
static Bool static Bool
set_missing_list(oc) set_missing_list(XOC oc)
XOC oc;
{ {
XOCGenericPart *gen = XOC_GENERIC(oc); XOCGenericPart *gen = XOC_GENERIC(oc);
FontSet font_set; FontSet font_set;
@ -1140,8 +1131,7 @@ set_missing_list(oc)
} }
static Bool static Bool
create_fontset(oc) create_fontset(XOC oc)
XOC oc;
{ {
XOMGenericPart *gen = XOM_GENERIC(oc->core.om); XOMGenericPart *gen = XOM_GENERIC(oc->core.om);
int found_num; int found_num;
@ -1175,10 +1165,7 @@ create_fontset(oc)
/* For VW/UDC start */ /* For VW/UDC start */
static void static void
free_fontdataOC(dpy,font_data, font_data_count) free_fontdataOC(Display *dpy, FontData font_data, int font_data_count)
Display *dpy;
FontData font_data;
int font_data_count;
{ {
for( ; font_data_count-- ; font_data++) { for( ; font_data_count-- ; font_data++) {
if(font_data->xlfd_name){ if(font_data->xlfd_name){
@ -1208,9 +1195,7 @@ free_fontdataOC(dpy,font_data, font_data_count)
} }
static void static void
destroy_fontdata(gen,dpy) destroy_fontdata(XOCGenericPart *gen, Display *dpy)
XOCGenericPart *gen ;
Display *dpy ;
{ {
FontSet font_set = (FontSet) NULL; FontSet font_set = (FontSet) NULL;
int font_set_num = 0; int font_set_num = 0;
@ -1252,8 +1237,7 @@ destroy_fontdata(gen,dpy)
/* For VW/UDC end */ /* For VW/UDC end */
static void static void
destroy_oc(oc) destroy_oc(XOC oc)
XOC oc;
{ {
Display *dpy = oc->core.om->core.display; Display *dpy = oc->core.om->core.display;
XOCGenericPart *gen = XOC_GENERIC(oc); XOCGenericPart *gen = XOC_GENERIC(oc);
@ -1287,21 +1271,11 @@ destroy_oc(oc)
if (oc->core.missing_list.charset_list) if (oc->core.missing_list.charset_list)
falFreeStringList(oc->core.missing_list.charset_list); falFreeStringList(oc->core.missing_list.charset_list);
#ifdef notdef
if (oc->core.res_name)
Xfree(oc->core.res_name);
if (oc->core.res_class)
Xfree(oc->core.res_class);
#endif
Xfree(oc); Xfree(oc);
} }
static char * static char *
set_oc_values(oc, args, num_args) set_oc_values(XOC oc, XlcArgList args, int num_args)
XOC oc;
XlcArgList args;
int num_args;
{ {
if (oc->core.resources == NULL) if (oc->core.resources == NULL)
return NULL; return NULL;
@ -1311,10 +1285,7 @@ set_oc_values(oc, args, num_args)
} }
static char * static char *
get_oc_values(oc, args, num_args) get_oc_values(XOC oc, XlcArgList args, int num_args)
XOC oc;
XlcArgList args;
int num_args;
{ {
if (oc->core.resources == NULL) if (oc->core.resources == NULL)
return NULL; return NULL;
@ -1385,10 +1356,7 @@ static XlcResource oc_resources[] = {
}; };
static XOC static XOC
create_oc(om, args, num_args) create_oc(XOM om, XlcArgList args, int num_args)
XOM om;
XlcArgList args;
int num_args;
{ {
XOC oc; XOC oc;
XOMGenericPart *gen = XOM_GENERIC(om); XOMGenericPart *gen = XOM_GENERIC(om);
@ -1406,18 +1374,21 @@ create_oc(om, args, num_args)
_fallcCompileResourceList(oc_resources, XlcNumber(oc_resources)); _fallcCompileResourceList(oc_resources, XlcNumber(oc_resources));
if (_fallcSetValues((XPointer) oc, oc_resources, XlcNumber(oc_resources), if (_fallcSetValues((XPointer) oc, oc_resources, XlcNumber(oc_resources),
args, num_args, XlcCreateMask | XlcDefaultMask)) args, num_args, XlcCreateMask | XlcDefaultMask)){
goto err; destroy_oc(oc);
return (XOC) NULL;
if (oc->core.base_name_list == NULL) }
goto err; if (oc->core.base_name_list == NULL){
destroy_oc(oc);
return (XOC) NULL;
}
oc->core.resources = oc_resources; oc->core.resources = oc_resources;
oc->core.num_resources = XlcNumber(oc_resources); oc->core.num_resources = XlcNumber(oc_resources);
if (create_fontset(oc) == False) if (create_fontset(oc) == False){
goto err; destroy_oc(oc);
return (XOC) NULL;
}
oc->methods = &oc_generic_methods; oc->methods = &oc_generic_methods;
if (gen->object_name) { if (gen->object_name) {
@ -1432,17 +1403,10 @@ create_oc(om, args, num_args)
} }
return oc; return oc;
err:
destroy_oc(oc);
return (XOC) NULL;
} }
static void static void
free_fontdataOM(font_data, font_data_count) free_fontdataOM(FontData font_data, int font_data_count)
FontData font_data;
int font_data_count;
{ {
for( ; font_data_count-- ; font_data++) { for( ; font_data_count-- ; font_data++) {
if(font_data->name){ if(font_data->name){
@ -1457,8 +1421,7 @@ free_fontdataOM(font_data, font_data_count)
} }
static Status static Status
close_om(om) close_om(XOM om)
XOM om;
{ {
XOMGenericPart *gen = XOM_GENERIC(om); XOMGenericPart *gen = XOM_GENERIC(om);
OMData data; OMData data;
@ -1533,10 +1496,7 @@ close_om(om)
} }
static char * static char *
set_om_values(om, args, num_args) set_om_values(XOM om, XlcArgList args, int num_args)
XOM om;
XlcArgList args;
int num_args;
{ {
if (om->core.resources == NULL) if (om->core.resources == NULL)
return NULL; return NULL;
@ -1546,10 +1506,7 @@ set_om_values(om, args, num_args)
} }
static char * static char *
get_om_values(om, args, num_args) get_om_values(XOM om, XlcArgList args, int num_args)
XOM om;
XlcArgList args;
int num_args;
{ {
if (om->core.resources == NULL) if (om->core.resources == NULL)
return NULL; return NULL;
@ -1577,12 +1534,12 @@ static XlcResource om_resources[] = {
}; };
static XOM static XOM
create_om(lcd, dpy, rdb, res_name, res_class) create_om(
XLCd lcd; XLCd lcd,
Display *dpy; Display *dpy,
XrmDatabase rdb; XrmDatabase rdb,
char *res_name; char *res_name,
char *res_class; char *res_class)
{ {
XOM om; XOM om;
@ -1597,14 +1554,18 @@ create_om(lcd, dpy, rdb, res_name, res_class)
om->core.rdb = rdb; om->core.rdb = rdb;
if (res_name) { if (res_name) {
om->core.res_name = (char *) Xmalloc(strlen(res_name) + 1); om->core.res_name = (char *) Xmalloc(strlen(res_name) + 1);
if (om->core.res_name == NULL) if (om->core.res_name == NULL){
goto err; close_om(om);
return (XOM) NULL;
}
strcpy(om->core.res_name, res_name); strcpy(om->core.res_name, res_name);
} }
if (res_class) { if (res_class) {
om->core.res_class = (char *) Xmalloc(strlen(res_class) + 1); om->core.res_class = (char *) Xmalloc(strlen(res_class) + 1);
if (om->core.res_class == NULL) if (om->core.res_class == NULL){
goto err; close_om(om);
return (XOM) NULL;
}
strcpy(om->core.res_class, res_class); strcpy(om->core.res_class, res_class);
} }
@ -1615,16 +1576,10 @@ create_om(lcd, dpy, rdb, res_name, res_class)
om->core.num_resources = XlcNumber(om_resources); om->core.num_resources = XlcNumber(om_resources);
return om; return om;
err:
close_om(om);
return (XOM) NULL;
} }
static OMData static OMData
add_data(om) add_data(XOM om)
XOM om;
{ {
XOMGenericPart *gen = XOM_GENERIC(om); XOMGenericPart *gen = XOM_GENERIC(om);
OMData new; OMData new;
@ -1649,9 +1604,7 @@ add_data(om)
/* For VW/UDC */ /* For VW/UDC */
FontData FontData
falread_EncodingInfo(count,value) falread_EncodingInfo(int count, char **value)
int count;
char **value;
{ {
FontData font_data,ret; FontData font_data,ret;
char *buf, *bufptr,*scp; char *buf, *bufptr,*scp;
@ -1694,11 +1647,11 @@ char **value;
return(ret); return(ret);
} }
static CodeRange read_vrotate(count,value,type,vrotate_num) static CodeRange read_vrotate(
int count; int count,
char **value; char **value,
int *type; int *type,
int *vrotate_num; int *vrotate_num)
{ {
FontData font_data,ret; FontData font_data,ret;
char *buf, *bufptr,*scp; char *buf, *bufptr,*scp;
@ -1720,10 +1673,7 @@ int *vrotate_num;
} }
static void static void
read_vw(lcd,font_set,num) read_vw(XLCd lcd, OMData font_set, int num)
XLCd lcd;
OMData font_set;
int num;
{ {
char **value, buf[BUFSIZ], *bufptr; char **value, buf[BUFSIZ], *bufptr;
int count,i; int count,i;
@ -1746,8 +1696,7 @@ int num;
} }
/* VW/UDC end */ /* VW/UDC end */
static Bool static Bool
init_om(om) init_om(XOM om)
XOM om;
{ {
XLCd lcd = om->core.lcd; XLCd lcd = om->core.lcd;
XOMGenericPart *gen = XOM_GENERIC(om); XOMGenericPart *gen = XOM_GENERIC(om);
@ -1905,17 +1854,8 @@ init_om(om)
} }
XOM XOM
#if NeedFunctionPrototypes
_falomGenericOpenOM(XLCd lcd, Display *dpy, XrmDatabase rdb, _falomGenericOpenOM(XLCd lcd, Display *dpy, XrmDatabase rdb,
_Xconst char *res_name, _Xconst char *res_class) char *res_name, char *res_class)
#else
_falomGenericOpenOM(lcd, dpy, rdb, res_name, res_class)
XLCd lcd;
Display *dpy;
XrmDatabase rdb;
char *res_name;
char *res_class;
#endif
{ {
XOM om; XOM om;
@ -1923,20 +1863,16 @@ _falomGenericOpenOM(lcd, dpy, rdb, res_name, res_class)
if (om == NULL) if (om == NULL)
return (XOM) NULL; return (XOM) NULL;
if (init_om(om) == False) if (init_om(om) == False){
goto err; close_om(om);
return (XOM) NULL;
}
return om; return om;
err:
close_om(om);
return (XOM) NULL;
} }
Bool Bool
_falInitOM(lcd) _falInitOM(XLCd lcd)
XLCd lcd;
{ {
lcd->methods->open_om = _falomGenericOpenOM; lcd->methods->open_om = _falomGenericOpenOM;

View file

@ -170,24 +170,19 @@ typedef struct _XOCGenericRec {
_XFUNCPROTOBEGIN _XFUNCPROTOBEGIN
extern XOM _falomGenericOpenOM( extern XOM _falomGenericOpenOM(
#if NeedFunctionPrototypes
XLCd /* lcd */, XLCd /* lcd */,
Display* /* dpy */, Display* /* dpy */,
XrmDatabase /* rdb */, XrmDatabase /* rdb */,
_Xconst char* /* res_name */, char* /* res_name */,
_Xconst char* /* res_class */ char* /* res_class */
#endif
); );
extern XlcConv _XomInitConverter( extern XlcConv _XomInitConverter(
#if NeedFunctionPrototypes
XOC /* oc */, XOC /* oc */,
XOMTextType /* type */ XOMTextType /* type */
#endif
); );
extern int _XomConvert( extern int _XomConvert(
#if NeedFunctionPrototypes
XOC /* oc */, XOC /* oc */,
XlcConv /* conv */, XlcConv /* conv */,
XPointer* /* from */, XPointer* /* from */,
@ -196,7 +191,6 @@ extern int _XomConvert(
int* /* to_left */, int* /* to_left */,
XPointer* /* args */, XPointer* /* args */,
int /* num_args */ int /* num_args */
#endif
); );
_XFUNCPROTOEND _XFUNCPROTOEND

View file

@ -86,17 +86,6 @@ from the X Consortium.
#include "_falrmI.h" #include "_falrmI.h"
#include <X11/Xos.h> #include <X11/Xos.h>
#ifdef __STDC__
#define Const const
#else
#define Const /**/
#endif
#if defined(__STDC__) && !defined(NORCONST)
#define RConst const
#else
#define RConst /**/
#endif
/* /*
These Xrm routines allow very fast lookup of resources in the resource These Xrm routines allow very fast lookup of resources in the resource
@ -150,14 +139,13 @@ typedef unsigned long Signature;
static XrmQuark XrmQString, XrmQANY; static XrmQuark XrmQString, XrmQANY;
typedef Bool (*DBEnumProc)( typedef Bool (*DBEnumProc)(
#if NeedNestedPrototypes /* this is Nested on purpose, to match Xlib.h */ /* this is Nested on purpose, to match Xlib.h */
XrmDatabase* /* db */, XrmDatabase* /* db */,
XrmBindingList /* bindings */, XrmBindingList /* bindings */,
XrmQuarkList /* quarks */, XrmQuarkList /* quarks */,
XrmRepresentation* /* type */, XrmRepresentation* /* type */,
XrmValue* /* value */, XrmValue* /* value */,
XPointer /* closure */ XPointer /* closure */
#endif
); );
typedef struct _VEntry { typedef struct _VEntry {
@ -319,7 +307,7 @@ typedef unsigned char XrmBits;
#define is_special(bits) ((bits) & (ENDOF|BSLASH)) #define is_special(bits) ((bits) & (ENDOF|BSLASH))
/* parsing types */ /* parsing types */
static XrmBits Const xrmtypes[256] = { static XrmBits const xrmtypes[256] = {
EOS,0,0,0,0,0,0,0, EOS,0,0,0,0,0,0,0,
0,SPACE,EOL,0,0,0,0,0, 0,SPACE,EOL,0,0,0,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
@ -339,7 +327,7 @@ static XrmBits Const xrmtypes[256] = {
/* The rest will be automatically initialized to zero. */ /* The rest will be automatically initialized to zero. */
}; };
void falrmInitialize() void falrmInitialize(void)
{ {
XrmQString = falrmPermStringToQuark("String"); XrmQString = falrmPermStringToQuark("String");
XrmQANY = falrmPermStringToQuark("?"); XrmQANY = falrmPermStringToQuark("?");
@ -355,29 +343,19 @@ XrmDatabase falrmGetDatabase(display)
return retval; return retval;
} }
void falrmSetDatabase(display, database) void falrmSetDatabase(Display *display, XrmDatabase database)
Display *display;
XrmDatabase database;
{ {
LockDisplay(display); LockDisplay(display);
display->db = database; display->db = database;
UnlockDisplay(display); UnlockDisplay(display);
} }
#if NeedFunctionPrototypes void falrmStringToQuarkList(const char *name, XrmQuarkList quarks)/*RETURN*/
void falrmStringToQuarkList(
register _Xconst char *name,
register XrmQuarkList quarks) /* RETURN */
#else
void falrmStringToQuarkList(name, quarks)
register char *name;
register XrmQuarkList quarks; /* RETURN */
#endif
{ {
register XrmBits bits; XrmBits bits;
register Signature sig = 0; Signature sig = 0;
register char ch, *tname; char ch, *tname;
register int i = 0; int i = 0;
if (tname = (char *)name) { if (tname = (char *)name) {
tname--; tname--;
@ -402,23 +380,16 @@ void falrmStringToQuarkList(name, quarks)
*quarks = NULLQUARK; *quarks = NULLQUARK;
} }
#if NeedFunctionPrototypes
void falrmStringToBindingQuarkList( void falrmStringToBindingQuarkList(
register _Xconst char *name, const char *name,
register XrmBindingList bindings, /* RETURN */ XrmBindingList bindings, /* RETURN */
register XrmQuarkList quarks) /* RETURN */ XrmQuarkList quarks) /* RETURN */
#else
void falrmStringToBindingQuarkList(name, bindings, quarks)
register char *name;
register XrmBindingList bindings; /* RETURN */
register XrmQuarkList quarks; /* RETURN */
#endif
{ {
register XrmBits bits; XrmBits bits;
register Signature sig = 0; Signature sig = 0;
register char ch, *tname; char ch, *tname;
register XrmBinding binding; XrmBinding binding;
register int i = 0; int i = 0;
if (tname = (char *)name) { if (tname = (char *)name) {
tname--; tname--;
@ -453,9 +424,7 @@ void falrmStringToBindingQuarkList(name, bindings, quarks)
#ifdef DEBUG #ifdef DEBUG
static void PrintQuarkList(quarks, stream) static void PrintQuarkList(XrmQuarkList quarks, FILE *stream)
XrmQuarkList quarks;
FILE *stream;
{ {
Bool firstNameSeen; Bool firstNameSeen;
@ -471,29 +440,24 @@ static void PrintQuarkList(quarks, stream)
#endif /* DEBUG */ #endif /* DEBUG */
/*ARGSUSED*/ /*ARGSUSED*/
static void mbnoop(state) static void mbnoop(XPointer state)
XPointer state;
{ {
} }
/*ARGSUSED*/ /*ARGSUSED*/
static char mbchar(state, str, lenp) static char mbchar(XPointer state, char *str, int *lenp)
XPointer state;
char *str;
int *lenp;
{ {
*lenp = 1; *lenp = 1;
return *str; return *str;
} }
/*ARGSUSED*/ /*ARGSUSED*/
static char *lcname(state) static char *lcname(XPointer state)
XPointer state;
{ {
return "C"; return "C";
} }
static RConst XrmMethodsRec mb_methods = { static const XrmMethodsRec mb_methods = {
mbnoop, mbnoop,
mbchar, mbchar,
mbnoop, mbnoop,
@ -501,9 +465,9 @@ static RConst XrmMethodsRec mb_methods = {
mbnoop mbnoop
}; };
static XrmDatabase NewDatabase() static XrmDatabase NewDatabase(void)
{ {
register XrmDatabase db; XrmDatabase db;
db = (XrmDatabase) Xmalloc(sizeof(XrmHashBucketRec)); db = (XrmDatabase) Xmalloc(sizeof(XrmHashBucketRec));
if (db) { if (db) {
@ -517,17 +481,15 @@ static XrmDatabase NewDatabase()
} }
/* move all values from ftable to ttable, and free ftable's buckets. /* move all values from ftable to ttable, and free ftable's buckets.
* ttable is quaranteed empty to start with. * ttable is guaranteed empty to start with.
*/ */
static void MoveValues(ftable, ttable) static void MoveValues(LTable ftable, LTable ttable)
LTable ftable;
register LTable ttable;
{ {
register VEntry fentry, nfentry; VEntry fentry, nfentry;
register VEntry *prev; VEntry *prev;
register VEntry *bucket; VEntry *bucket;
register VEntry tentry; VEntry tentry;
register int i; int i;
for (i = ftable->table.mask, bucket = ftable->buckets; i >= 0; i--) { for (i = ftable->table.mask, bucket = ftable->buckets; i >= 0; i--) {
for (fentry = *bucket++; fentry; fentry = nfentry) { for (fentry = *bucket++; fentry; fentry = nfentry) {
@ -546,15 +508,13 @@ static void MoveValues(ftable, ttable)
/* move all tables from ftable to ttable, and free ftable. /* move all tables from ftable to ttable, and free ftable.
* ttable is quaranteed empty to start with. * ttable is quaranteed empty to start with.
*/ */
static void MoveTables(ftable, ttable) static void MoveTables(NTable ftable, NTable ttable)
NTable ftable;
register NTable ttable;
{ {
register NTable fentry, nfentry; NTable fentry, nfentry;
register NTable *prev; NTable *prev;
register NTable *bucket; NTable *bucket;
register NTable tentry; NTable tentry;
register int i; int i;
for (i = ftable->mask, bucket = NodeBuckets(ftable); i >= 0; i--) { for (i = ftable->mask, bucket = NodeBuckets(ftable); i >= 0; i--) {
for (fentry = *bucket++; fentry; fentry = nfentry) { for (fentry = *bucket++; fentry; fentry = nfentry) {
@ -571,11 +531,10 @@ static void MoveTables(ftable, ttable)
} }
/* grow the table, based on current number of entries */ /* grow the table, based on current number of entries */
static void GrowTable(prev) static void GrowTable(NTable *prev)
NTable *prev;
{ {
register NTable table; NTable table;
register int i; int i;
table = *prev; table = *prev;
i = table->mask; i = table->mask;
@ -585,7 +544,7 @@ static void GrowTable(prev)
i = (i << 1) + 1; i = (i << 1) + 1;
i++; /* i is now the new size */ i++; /* i is now the new size */
if (table->leaf) { if (table->leaf) {
register LTable ltable; LTable ltable;
LTableRec otable; LTableRec otable;
ltable = (LTable)table; ltable = (LTable)table;
@ -600,7 +559,7 @@ static void GrowTable(prev)
bzero((char *)ltable->buckets, i * sizeof(VEntry)); bzero((char *)ltable->buckets, i * sizeof(VEntry));
MoveValues(&otable, ltable); MoveValues(&otable, ltable);
} else { } else {
register NTable ntable; NTable ntable;
ntable = (NTable)Xmalloc(sizeof(NTableRec) + i * sizeof(NTable)); ntable = (NTable)Xmalloc(sizeof(NTableRec) + i * sizeof(NTable));
if (!ntable) if (!ntable)
@ -614,17 +573,14 @@ static void GrowTable(prev)
} }
/* merge values from ftable into *pprev, destroy ftable in the process */ /* merge values from ftable into *pprev, destroy ftable in the process */
static void MergeValues(ftable, pprev, override) static void MergeValues(LTable ftable, NTable *pprev, Bool override)
LTable ftable;
NTable *pprev;
Bool override;
{ {
register VEntry fentry, tentry; VEntry fentry, tentry;
register VEntry *prev; VEntry *prev;
register LTable ttable; LTable ttable;
VEntry *bucket; VEntry *bucket;
int i; int i;
register XrmQuark q; XrmQuark q;
ttable = (LTable)*pprev; ttable = (LTable)*pprev;
if (ftable->table.hasloose) if (ftable->table.hasloose)
@ -694,18 +650,15 @@ static void MergeValues(ftable, pprev, override)
} }
/* merge tables from ftable into *pprev, destroy ftable in the process */ /* merge tables from ftable into *pprev, destroy ftable in the process */
static void MergeTables(ftable, pprev, override) static void MergeTables(NTable ftable, NTable *pprev, Bool override)
NTable ftable;
NTable *pprev;
Bool override;
{ {
register NTable fentry, tentry; NTable fentry, tentry;
NTable nfentry; NTable nfentry;
register NTable *prev; NTable *prev;
register NTable ttable; NTable ttable;
NTable *bucket; NTable *bucket;
int i; int i;
register XrmQuark q; XrmQuark q;
ttable = *pprev; ttable = *pprev;
if (ftable->hasloose) if (ftable->hasloose)
@ -767,12 +720,10 @@ static void MergeTables(ftable, pprev, override)
GROW(pprev); GROW(pprev);
} }
void falrmCombineDatabase(from, into, override) void falrmCombineDatabase(XrmDatabase from, XrmDatabase *into, Bool override)
XrmDatabase from, *into;
Bool override;
{ {
register NTable *prev; NTable *prev;
register NTable ftable, ttable, nftable; NTable ftable, ttable, nftable;
if (!*into) { if (!*into) {
*into = from; *into = from;
@ -816,25 +767,24 @@ void falrmCombineDatabase(from, into, override)
} }
} }
void falrmMergeDatabases(from, into) void falrmMergeDatabases(XrmDatabase from, XrmDatabase *into)
XrmDatabase from, *into;
{ {
falrmCombineDatabase(from, into, True); falrmCombineDatabase(from, into, True);
} }
/* store a value in the database, overriding any existing entry */ /* store a value in the database, overriding any existing entry */
static void PutEntry(db, bindings, quarks, type, value) static void PutEntry(
XrmDatabase db; XrmDatabase db,
XrmBindingList bindings; XrmBindingList bindings,
XrmQuarkList quarks; XrmQuarkList quarks,
XrmRepresentation type; XrmRepresentation type,
XrmValuePtr value; XrmValuePtr value)
{ {
register NTable *pprev, *prev; NTable *pprev, *prev;
register NTable table; NTable table;
register XrmQuark q; XrmQuark q;
register VEntry *vprev; VEntry *vprev;
register VEntry entry; VEntry entry;
NTable *nprev, *firstpprev; NTable *nprev, *firstpprev;
#define NEWTABLE(q,i) \ #define NEWTABLE(q,i) \
@ -1011,12 +961,12 @@ static void PutEntry(db, bindings, quarks, type, value)
#undef NEWTABLE #undef NEWTABLE
} }
void falrmQPutResource(pdb, bindings, quarks, type, value) void falrmQPutResource(
XrmDatabase *pdb; XrmDatabase *pdb,
XrmBindingList bindings; XrmBindingList bindings,
XrmQuarkList quarks; XrmQuarkList quarks,
XrmRepresentation type; XrmRepresentation type,
XrmValuePtr value; XrmValuePtr value)
{ {
if (!*pdb) *pdb = NewDatabase(); if (!*pdb) *pdb = NewDatabase();
_XLockMutex(&(*pdb)->linfo); _XLockMutex(&(*pdb)->linfo);
@ -1024,19 +974,11 @@ void falrmQPutResource(pdb, bindings, quarks, type, value)
_XUnlockMutex(&(*pdb)->linfo); _XUnlockMutex(&(*pdb)->linfo);
} }
#if NeedFunctionPrototypes
void falrmPutResource( void falrmPutResource(
XrmDatabase *pdb, XrmDatabase *pdb,
_Xconst char *specifier, const char *specifier,
_Xconst char *type, const char *type,
XrmValuePtr value) XrmValuePtr value)
#else
void falrmPutResource(pdb, specifier, type, value)
XrmDatabase *pdb;
char *specifier;
char *type;
XrmValuePtr value;
#endif
{ {
XrmBinding bindings[MAXDBDEPTH+1]; XrmBinding bindings[MAXDBDEPTH+1];
XrmQuark quarks[MAXDBDEPTH+1]; XrmQuark quarks[MAXDBDEPTH+1];
@ -1048,19 +990,11 @@ void falrmPutResource(pdb, specifier, type, value)
_XUnlockMutex(&(*pdb)->linfo); _XUnlockMutex(&(*pdb)->linfo);
} }
#if NeedFunctionPrototypes
void falrmQPutStringResource( void falrmQPutStringResource(
XrmDatabase *pdb, XrmDatabase *pdb,
XrmBindingList bindings, XrmBindingList bindings,
XrmQuarkList quarks, XrmQuarkList quarks,
_Xconst char *str) const char *str)
#else
void falrmQPutStringResource(pdb, bindings, quarks, str)
XrmDatabase *pdb;
XrmBindingList bindings;
XrmQuarkList quarks;
char *str;
#endif
{ {
XrmValue value; XrmValue value;
@ -1093,20 +1027,20 @@ void falrmQPutStringResource(pdb, bindings, quarks, str)
static void GetIncludeFile(); static void GetIncludeFile();
static void GetDatabase(db, str, filename, doall) static void GetDatabase(
XrmDatabase db; XrmDatabase db,
register char *str; char *str,
char *filename; char *filename,
Bool doall; Bool doall)
{ {
register char *ptr; char *ptr;
register XrmBits bits = 0; XrmBits bits = 0;
register char c; char c;
int len; int len;
register Signature sig; Signature sig;
register char *ptr_max; char *ptr_max;
register XrmQuarkList t_quarks; XrmQuarkList t_quarks;
register XrmBindingList t_bindings; XrmBindingList t_bindings;
int alloc_chars = BUFSIZ; int alloc_chars = BUFSIZ;
char buffer[BUFSIZ], *value_str; char buffer[BUFSIZ], *value_str;
@ -1487,17 +1421,10 @@ static void GetDatabase(db, str, filename, doall)
(*db->methods->mbfinish)(db->mbstate); (*db->methods->mbfinish)(db->mbstate);
} }
#if NeedFunctionPrototypes
void falrmPutStringResource( void falrmPutStringResource(
XrmDatabase *pdb, XrmDatabase *pdb,
_Xconst char*specifier, const char*specifier,
_Xconst char*str) const char*str)
#else
void falrmPutStringResource(pdb, specifier, str)
XrmDatabase *pdb;
char *specifier;
char *str;
#endif
{ {
XrmValue value; XrmValue value;
XrmBinding bindings[MAXDBDEPTH+1]; XrmBinding bindings[MAXDBDEPTH+1];
@ -1513,15 +1440,7 @@ void falrmPutStringResource(pdb, specifier, str)
} }
#if NeedFunctionPrototypes void falrmPutLineResource(XrmDatabase *pdb, char *line)
void falrmPutLineResource(
XrmDatabase *pdb,
_Xconst char*line)
#else
void falrmPutLineResource(pdb, line)
XrmDatabase *pdb;
char *line;
#endif
{ {
if (!*pdb) *pdb = NewDatabase(); if (!*pdb) *pdb = NewDatabase();
_XLockMutex(&(*pdb)->linfo); _XLockMutex(&(*pdb)->linfo);
@ -1529,13 +1448,7 @@ void falrmPutLineResource(pdb, line)
_XUnlockMutex(&(*pdb)->linfo); _XUnlockMutex(&(*pdb)->linfo);
} }
#if NeedFunctionPrototypes XrmDatabase falrmGetStringDatabase(char *data)
XrmDatabase falrmGetStringDatabase(
_Xconst char *data)
#else
XrmDatabase falrmGetStringDatabase(data)
char *data;
#endif
{ {
XrmDatabase db; XrmDatabase db;
@ -1553,10 +1466,9 @@ XrmDatabase falrmGetStringDatabase(data)
*/ */
static char * static char *
ReadInFile(filename) ReadInFile(char *filename)
char * filename;
{ {
register int fd, size; int fd, size;
char * filebuf; char * filebuf;
if ( (fd = OpenFile(filename)) == -1 ) if ( (fd = OpenFile(filename)) == -1 )
@ -1582,11 +1494,11 @@ char * filename;
} }
static void static void
GetIncludeFile(db, base, fname, fnamelen) GetIncludeFile(
XrmDatabase db; XrmDatabase db,
char *base; char *base,
char *fname; char *fname,
int fnamelen; int fnamelen)
{ {
int len; int len;
char *str; char *str;
@ -1611,13 +1523,7 @@ GetIncludeFile(db, base, fname, fnamelen)
Xfree(str); Xfree(str);
} }
#if NeedFunctionPrototypes XrmDatabase falrmGetFileDatabase(char *filename)
XrmDatabase falrmGetFileDatabase(
_Xconst char *filename)
#else
XrmDatabase falrmGetFileDatabase(filename)
char *filename;
#endif
{ {
XrmDatabase db; XrmDatabase db;
char *str; char *str;
@ -1633,17 +1539,10 @@ XrmDatabase falrmGetFileDatabase(filename)
return db; return db;
} }
#if NeedFunctionPrototypes
Status falrmCombineFileDatabase( Status falrmCombineFileDatabase(
_Xconst char *filename, char *filename,
XrmDatabase *target, XrmDatabase *target,
Bool override) Bool override)
#else
Status falrmCombineFileDatabase(filename, target, override)
char *filename;
XrmDatabase *target;
Bool override;
#endif
{ {
XrmDatabase db; XrmDatabase db;
char *str; char *str;
@ -1669,16 +1568,16 @@ Status falrmCombineFileDatabase(filename, target, override)
* stop if user proc returns True. level is current depth in database. * stop if user proc returns True. level is current depth in database.
*/ */
/*ARGSUSED*/ /*ARGSUSED*/
static Bool EnumLTable(table, names, classes, level, closure) static Bool EnumLTable(
LTable table; LTable table,
XrmNameList names; XrmNameList names,
XrmClassList classes; XrmClassList classes,
register int level; int level,
register EClosure closure; EClosure closure)
{ {
register VEntry *bucket; VEntry *bucket;
register int i; int i;
register VEntry entry; VEntry entry;
XrmValue value; XrmValue value;
XrmRepresentation type; XrmRepresentation type;
Bool tightOk; Bool tightOk;
@ -1715,14 +1614,11 @@ static Bool EnumLTable(table, names, classes, level, closure)
return False; return False;
} }
static Bool EnumAllNTable(table, level, closure) static Bool EnumAllNTable(NTable table, int level, EClosure closure)
NTable table;
register int level;
register EClosure closure;
{ {
register NTable *bucket; NTable *bucket;
register int i; int i;
register NTable entry; NTable entry;
XrmQuark empty = NULLQUARK; XrmQuark empty = NULLQUARK;
if (level >= MAXDBDEPTH) if (level >= MAXDBDEPTH)
@ -1749,16 +1645,16 @@ static Bool EnumAllNTable(table, level, closure)
/* recurse on every table in the table, arbitrary order. /* recurse on every table in the table, arbitrary order.
* stop if user proc returns True. level is current depth in database. * stop if user proc returns True. level is current depth in database.
*/ */
static Bool EnumNTable(table, names, classes, level, closure) static Bool EnumNTable(
NTable table; NTable table,
XrmNameList names; XrmNameList names,
XrmClassList classes; XrmClassList classes,
register int level; int level,
register EClosure closure; EClosure closure)
{ {
register NTable entry; NTable entry;
register XrmQuark q; XrmQuark q;
register unsigned int leaf; unsigned int leaf;
Bool (*get)(); Bool (*get)();
Bool bilevel; Bool bilevel;
@ -1907,17 +1803,17 @@ static Bool EnumNTable(table, names, classes, level, closure)
/* call the proc for every value in the database, arbitrary order. /* call the proc for every value in the database, arbitrary order.
* stop if the proc returns True. * stop if the proc returns True.
*/ */
Bool falrmEnumerateDatabase(db, names, classes, mode, proc, closure) Bool falrmEnumerateDatabase(
XrmDatabase db; XrmDatabase db,
XrmNameList names; XrmNameList names,
XrmClassList classes; XrmClassList classes,
int mode; int mode,
DBEnumProc proc; DBEnumProc proc,
XPointer closure; XPointer closure)
{ {
XrmBinding bindings[MAXDBDEPTH+2]; XrmBinding bindings[MAXDBDEPTH+2];
XrmQuark quarks[MAXDBDEPTH+2]; XrmQuark quarks[MAXDBDEPTH+2];
register NTable table; NTable table;
EClosureRec eclosure; EClosureRec eclosure;
Bool retval = False; Bool retval = False;
@ -1943,10 +1839,10 @@ Bool falrmEnumerateDatabase(db, names, classes, mode, proc, closure)
return retval; return retval;
} }
static void PrintBindingQuarkList(bindings, quarks, stream) static void PrintBindingQuarkList(
XrmBindingList bindings; XrmBindingList bindings,
XrmQuarkList quarks; XrmQuarkList quarks,
FILE *stream; FILE *stream)
{ {
Bool firstNameSeen; Bool firstNameSeen;
@ -1963,18 +1859,18 @@ static void PrintBindingQuarkList(bindings, quarks, stream)
/* output out the entry in correct file syntax */ /* output out the entry in correct file syntax */
/*ARGSUSED*/ /*ARGSUSED*/
static Bool DumpEntry(db, bindings, quarks, type, value, data) static Bool DumpEntry(
XrmDatabase *db; XrmDatabase *db,
XrmBindingList bindings; XrmBindingList bindings,
XrmQuarkList quarks; XrmQuarkList quarks,
XrmRepresentation *type; XrmRepresentation *type,
XrmValuePtr value; XrmValuePtr value,
XPointer data; XPointer data)
{ {
FILE *stream = (FILE *)data; FILE *stream = (FILE *)data;
register unsigned int i; unsigned int i;
register char *s; char *s;
register char c; char c;
if (*type != XrmQString) if (*type != XrmQString)
(void) putc('!', stream); (void) putc('!', stream);
@ -2011,9 +1907,7 @@ static Bool DumpEntry(db, bindings, quarks, type, value, data)
#ifdef DEBUG #ifdef DEBUG
void falPrintTable(table, file) void falPrintTable(NTable table, FILE *file)
NTable table;
FILE *file;
{ {
XrmBinding bindings[MAXDBDEPTH+1]; XrmBinding bindings[MAXDBDEPTH+1];
XrmQuark quarks[MAXDBDEPTH+1]; XrmQuark quarks[MAXDBDEPTH+1];
@ -2034,15 +1928,7 @@ void falPrintTable(table, file)
#endif /* DEBUG */ #endif /* DEBUG */
#if NeedFunctionPrototypes void falrmPutFileDatabase(XrmDatabase db, const char *fileName)
void falrmPutFileDatabase(
XrmDatabase db,
_Xconst char *fileName)
#else
void falrmPutFileDatabase(db, fileName)
XrmDatabase db;
char *fileName;
#endif
{ {
FILE *file; FILE *file;
XrmQuark empty = NULLQUARK; XrmQuark empty = NULLQUARK;
@ -2101,11 +1987,11 @@ void falrmPutFileDatabase(db, fileName)
/* add tight/loose entry to the search list, return True if list is full */ /* add tight/loose entry to the search list, return True if list is full */
/*ARGSUSED*/ /*ARGSUSED*/
static Bool AppendLEntry(table, names, classes, closure) static Bool AppendLEntry(
LTable table; LTable table,
XrmNameList names; XrmNameList names,
XrmClassList classes; XrmClassList classes,
register SClosure closure; SClosure closure)
{ {
/* check for duplicate */ /* check for duplicate */
if (closure->idx >= 0 && closure->list[closure->idx] == table) if (closure->idx >= 0 && closure->list[closure->idx] == table)
@ -2120,11 +2006,11 @@ static Bool AppendLEntry(table, names, classes, closure)
/* add loose entry to the search list, return True if list is full */ /* add loose entry to the search list, return True if list is full */
/*ARGSUSED*/ /*ARGSUSED*/
static Bool AppendLooseLEntry(table, names, classes, closure) static Bool AppendLooseLEntry(
LTable table; LTable table,
XrmNameList names; XrmNameList names,
XrmClassList classes; XrmClassList classes,
register SClosure closure; SClosure closure)
{ {
/* check for duplicate */ /* check for duplicate */
if (closure->idx >= 0 && closure->list[closure->idx] == table) if (closure->idx >= 0 && closure->list[closure->idx] == table)
@ -2140,15 +2026,15 @@ static Bool AppendLooseLEntry(table, names, classes, closure)
} }
/* search for a leaf table */ /* search for a leaf table */
static Bool SearchNEntry(table, names, classes, closure) static Bool SearchNEntry(
NTable table; NTable table,
XrmNameList names; XrmNameList names,
XrmClassList classes; XrmClassList classes,
SClosure closure; SClosure closure)
{ {
register NTable entry; NTable entry;
register XrmQuark q; XrmQuark q;
register unsigned int leaf; unsigned int leaf;
Bool (*get)(); Bool (*get)();
if (names[1]) { if (names[1]) {
@ -2204,14 +2090,14 @@ static Bool SearchNEntry(table, names, classes, closure)
return False; return False;
} }
Bool falrmQGetSearchList(db, names, classes, searchList, listLength) Bool falrmQGetSearchList(
XrmDatabase db; XrmDatabase db,
XrmNameList names; XrmNameList names,
XrmClassList classes; XrmClassList classes,
XrmSearchList searchList; /* RETURN */ XrmSearchList searchList, /* RETURN */
int listLength; int listLength)
{ {
register NTable table; NTable table;
SClosureRec closure; SClosureRec closure;
if (listLength <= 0) if (listLength <= 0)
@ -2249,16 +2135,16 @@ Bool falrmQGetSearchList(db, names, classes, searchList, listLength)
return True; return True;
} }
Bool falrmQGetSearchResource(searchList, name, class, pType, pValue) Bool falrmQGetSearchResource(
XrmSearchList searchList; XrmSearchList searchList,
register XrmName name; XrmName name,
register XrmClass class; XrmClass class,
XrmRepresentation *pType; /* RETURN */ XrmRepresentation *pType, /* RETURN */
XrmValue *pValue; /* RETURN */ XrmValue *pValue) /* RETURN */
{ {
register LTable *list; LTable *list;
register LTable table; LTable table;
register VEntry entry; VEntry entry;
int flags; int flags;
/* find tight or loose entry */ /* find tight or loose entry */
@ -2338,14 +2224,14 @@ Bool falrmQGetSearchResource(searchList, name, class, pType, pValue)
} }
/* look for a tight/loose value */ /* look for a tight/loose value */
static Bool GetVEntry(table, names, classes, closure) static Bool GetVEntry(
LTable table; LTable table,
XrmNameList names; XrmNameList names,
XrmClassList classes; XrmClassList classes,
VClosure closure; VClosure closure)
{ {
register VEntry entry; VEntry entry;
register XrmQuark q; XrmQuark q;
/* try name first */ /* try name first */
q = *names; q = *names;
@ -2373,14 +2259,14 @@ static Bool GetVEntry(table, names, classes, closure)
} }
/* look for a loose value */ /* look for a loose value */
static Bool GetLooseVEntry(table, names, classes, closure) static Bool GetLooseVEntry(
LTable table; LTable table,
XrmNameList names; XrmNameList names,
XrmClassList classes; XrmClassList classes,
VClosure closure; VClosure closure)
{ {
register VEntry entry; VEntry entry;
register XrmQuark q; XrmQuark q;
#define VLOOSE(ename) \ #define VLOOSE(ename) \
q = ename; \ q = ename; \
@ -2415,15 +2301,15 @@ static Bool GetLooseVEntry(table, names, classes, closure)
} }
/* recursive search for a value */ /* recursive search for a value */
static Bool GetNEntry(table, names, classes, closure) static Bool GetNEntry(
NTable table; NTable table,
XrmNameList names; XrmNameList names,
XrmClassList classes; XrmClassList classes,
VClosure closure; VClosure closure)
{ {
register NTable entry; NTable entry;
register XrmQuark q; XrmQuark q;
register unsigned int leaf; unsigned int leaf;
Bool (*get)(); Bool (*get)();
NTable otable; NTable otable;
@ -2483,14 +2369,14 @@ static Bool GetNEntry(table, names, classes, closure)
return False; return False;
} }
Bool falrmQGetResource(db, names, classes, pType, pValue) Bool falrmQGetResource(
XrmDatabase db; XrmDatabase db,
XrmNameList names; XrmNameList names,
XrmClassList classes; XrmClassList classes,
XrmRepresentation *pType; /* RETURN */ XrmRepresentation *pType, /* RETURN */
XrmValuePtr pValue; /* RETURN */ XrmValuePtr pValue) /* RETURN */
{ {
register NTable table; NTable table;
VClosureRec closure; VClosureRec closure;
if (db && *names) { if (db && *names) {
@ -2525,21 +2411,12 @@ Bool falrmQGetResource(db, names, classes, pType, pValue)
return False; return False;
} }
#if NeedFunctionPrototypes Bool falrmGetResource(
Bool falrmGetResource(db, name_str, class_str, pType_str, pValue) XrmDatabase db,
XrmDatabase db; const char *name_str,
_Xconst char *name_str; const char *class_str,
_Xconst char *class_str; XrmString *pType_str, /* RETURN */
XrmString *pType_str; /* RETURN */ XrmValuePtr pValue) /* RETURN */
XrmValuePtr pValue; /* RETURN */
#else
Bool falrmGetResource(db, name_str, class_str, pType_str, pValue)
XrmDatabase db;
XrmString name_str;
XrmString class_str;
XrmString *pType_str; /* RETURN */
XrmValuePtr pValue; /* RETURN */
#endif
{ {
XrmName names[MAXDBDEPTH+1]; XrmName names[MAXDBDEPTH+1];
XrmClass classes[MAXDBDEPTH+1]; XrmClass classes[MAXDBDEPTH+1];
@ -2554,12 +2431,11 @@ Bool falrmGetResource(db, name_str, class_str, pType_str, pValue)
} }
/* destroy all values, plus table itself */ /* destroy all values, plus table itself */
static void DestroyLTable(table) static void DestroyLTable(LTable table)
LTable table;
{ {
register int i; int i;
register VEntry *buckets; VEntry *buckets;
register VEntry entry, next; VEntry entry, next;
buckets = table->buckets; buckets = table->buckets;
for (i = table->table.mask; i >= 0; i--, buckets++) { for (i = table->table.mask; i >= 0; i--, buckets++) {
@ -2573,12 +2449,11 @@ static void DestroyLTable(table)
} }
/* destroy all contained tables, plus table itself */ /* destroy all contained tables, plus table itself */
static void DestroyNTable(table) static void DestroyNTable(NTable table)
NTable table;
{ {
register int i; int i;
register NTable *buckets; NTable *buckets;
register NTable entry, next; NTable entry, next;
buckets = NodeBuckets(table); buckets = NodeBuckets(table);
for (i = table->mask; i >= 0; i--, buckets++) { for (i = table->mask; i >= 0; i--, buckets++) {
@ -2593,8 +2468,7 @@ static void DestroyNTable(table)
Xfree((char *)table); Xfree((char *)table);
} }
char *falrmLocaleOfDatabase(db) char *falrmLocaleOfDatabase(XrmDatabase db)
XrmDatabase db;
{ {
char* retval; char* retval;
_XLockMutex(&db->linfo); _XLockMutex(&db->linfo);
@ -2603,10 +2477,9 @@ char *falrmLocaleOfDatabase(db)
return retval; return retval;
} }
void falrmDestroyDatabase(db) void falrmDestroyDatabase(XrmDatabase db)
XrmDatabase db;
{ {
register NTable table, next; NTable table, next;
if (db) { if (db) {
_XLockMutex(&db->linfo); _XLockMutex(&db->linfo);

View file

@ -66,9 +66,7 @@ typedef struct _FalGlyphRegion {
/* /*
* "code" no jyoui "i" byte me wo "unsigned char" toshite kaesu. * "code" no jyoui "i" byte me wo "unsigned char" toshite kaesu.
*/ */
static unsigned char getbyte(code,i) static unsigned char getbyte(unsigned long code, int i)
unsigned long code;
int i;
{ {
unsigned long byteL; unsigned long byteL;
unsigned char byte; unsigned char byte;
@ -83,11 +81,11 @@ int i;
charset_str : JISX0208.1983-0 charset_str : JISX0208.1983-0
*/ */
fal_get_codeset(locale,charset_str,codeset,num_codeset) fal_get_codeset(
char *locale; char *locale,
char *charset_str; char *charset_str,
int **codeset; int **codeset,
int *num_codeset; int *num_codeset)
{ {
XLCdRec lcdrec; XLCdRec lcdrec;
XLCd lcd; XLCd lcd;
@ -164,9 +162,7 @@ int *num_codeset;
return 0; return 0;
} }
static Bool gi_to_vgi(gi,vgi,scope) static Bool gi_to_vgi(unsigned long gi, unsigned long *vgi, FontScope scope)
unsigned long gi,*vgi;
FontScope scope;
{ {
if(scope->shift_direction == (unsigned long)'+'){ if(scope->shift_direction == (unsigned long)'+'){
gi -= scope->shift; gi -= scope->shift;
@ -180,9 +176,7 @@ FontScope scope;
return(False); return(False);
} }
static void shift_area(udc,scope) static void shift_area(FalGlyphRegion *udc, FontScope scope)
FalGlyphRegion *udc;
FontScope scope;
{ {
if(scope->shift_direction == (unsigned long)'+'){ if(scope->shift_direction == (unsigned long)'+'){
udc->start += scope->shift; udc->start += scope->shift;
@ -199,12 +193,12 @@ FontScope scope;
locale : ja_JP locale : ja_JP
charset_str : JISX0208.1983-0 charset_str : JISX0208.1983-0
*/ */
FalGetUDCGIArea(locale,codeset,charset_str,gr,num_gr) FalGetUDCGIArea(
char *locale; char *locale,
int codeset; int codeset,
char *charset_str; char *charset_str,
FalGlyphRegion **gr; FalGlyphRegion **gr,
int *num_gr; int *num_gr)
{ {
XLCdRec lcdrec; XLCdRec lcdrec;
XLCd lcd; XLCd lcd;
@ -302,14 +296,14 @@ int *num_gr;
* *
*/ */
int fal_gi_to_vgi(lcd,locale,charset_str,codeset,gi,vgi,charsetname) int fal_gi_to_vgi(
XLCd lcd; XLCd lcd,
char *locale; char *locale,
char *charset_str; char *charset_str,
int codeset; int codeset,
unsigned long gi; unsigned long gi,
unsigned long *vgi; unsigned long *vgi,
char *charsetname; char *charsetname)
{ {
FalGlyphRegion *udc; FalGlyphRegion *udc;
int num = 0,count,num_ret=0; int num = 0,count,num_ret=0;
@ -346,9 +340,7 @@ char *charsetname;
return(True); return(True);
} }
Bool falnon_standard(lcd,charset) Bool falnon_standard(XLCd lcd, XlcCharSet charset)
XLCd lcd;
XlcCharSet charset;
{ {
char buf[256]; char buf[256];
int count,i; int count,i;
@ -371,10 +363,7 @@ XlcCharSet charset;
} }
void void
falmake_none_standard(from,charset,src) falmake_none_standard(char *from, XlcCharSet charset, char *src)
char *from;
XlcCharSet charset;
char *src;
{ {
int name_len,seq_len,i; int name_len,seq_len,i;
name_len = 2 + strlen(charset->encoding_name) + 1; name_len = 2 + strlen(charset->encoding_name) + 1;
@ -387,12 +376,12 @@ char *src;
strcpy(&from[seq_len + name_len],src); strcpy(&from[seq_len + name_len],src);
} }
int int
fal_glyph_to_code(locale,charset_str,codeset,glyph_index,codepoint) fal_glyph_to_code(
char *locale; char *locale,
char *charset_str; char *charset_str,
int codeset; int codeset,
unsigned long glyph_index; unsigned long glyph_index,
unsigned long *codepoint; unsigned long *codepoint)
{ {
XLCd lcd; XLCd lcd;
unsigned char *from; int from_left; unsigned char *from; int from_left;
@ -466,12 +455,12 @@ typedef struct _FalCodeRegion {
} FalCodeRegion ; } FalCodeRegion ;
int int
FalGetUDCCPArea(locale,codeset,charset_str,cr,num_cr) FalGetUDCCPArea(
char *locale; char *locale,
int codeset; int codeset,
char *charset_str; char *charset_str,
FalCodeRegion **cr; FalCodeRegion **cr,
int *num_cr; int *num_cr)
{ {
int i,num_gr,ret; int i,num_gr,ret;
FalGlyphRegion *gr; FalGlyphRegion *gr;
@ -547,9 +536,7 @@ typedef struct _FalGIInf {
* *
* *
*/ */
static Bool vgi_to_gi(gi,vgi,scope) static Bool vgi_to_gi(unsigned long *gi, unsigned long vgi, FontScope scope)
unsigned long *gi,vgi;
FontScope scope;
{ {
if(vgi >= scope->start && vgi <= scope->end){ if(vgi >= scope->start && vgi <= scope->end){
if(scope->shift_direction == (unsigned long)'+'){ if(scope->shift_direction == (unsigned long)'+'){
@ -566,13 +553,13 @@ FontScope scope;
* *
*/ */
static Bool static Bool
fal_vgi_to_gi(lcd,locale,vglyph,glyph,charset,charsetname) fal_vgi_to_gi(
XLCd lcd; XLCd lcd,
char *locale; char *locale,
unsigned long vglyph; unsigned long vglyph,
unsigned long *glyph; unsigned long *glyph,
XlcCharSet charset; XlcCharSet charset,
char *charsetname; char *charsetname)
{ {
int num = 0,count,num_ret=0; int num = 0,count,num_ret=0;
int i,j,k; int i,j,k;
@ -620,11 +607,11 @@ char *charsetname;
return(True); return(True);
} }
int int
fal_code_to_glyph(locale,codepoint,gi,num_gi) fal_code_to_glyph(
char *locale; char *locale,
unsigned long codepoint; unsigned long codepoint,
FalGIInf **gi; FalGIInf **gi,
int *num_gi; int *num_gi)
{ {
XLCd lcd; XLCd lcd;
unsigned char *from; int from_left; unsigned char *from; int from_left;

View file

@ -349,406 +349,307 @@ _XFUNCPROTOBEGIN
/* The following declarations are alphabetized. */ /* The following declarations are alphabetized. */
extern XClassHint *XAllocClassHint ( extern XClassHint *XAllocClassHint (
#if NeedFunctionPrototypes
void void
#endif
); );
extern XIconSize *XAllocIconSize ( extern XIconSize *XAllocIconSize (
#if NeedFunctionPrototypes
void void
#endif
); );
extern XSizeHints *XAllocSizeHints ( extern XSizeHints *XAllocSizeHints (
#if NeedFunctionPrototypes
void void
#endif
); );
extern XStandardColormap *XAllocStandardColormap ( extern XStandardColormap *XAllocStandardColormap (
#if NeedFunctionPrototypes
void void
#endif
); );
extern XWMHints *XAllocWMHints ( extern XWMHints *XAllocWMHints (
#if NeedFunctionPrototypes
void void
#endif
); );
extern XClipBox( extern XClipBox(
#if NeedFunctionPrototypes
Region /* r */, Region /* r */,
XRectangle* /* rect_return */ XRectangle* /* rect_return */
#endif
); );
extern Region XCreateRegion( extern Region XCreateRegion(
#if NeedFunctionPrototypes
void void
#endif
); );
extern char *falDefaultString( extern char *falDefaultString(
#if NeedFunctionPrototypes
void void
#endif
); );
extern int XDeleteContext( extern int XDeleteContext(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
XID /* rid */, XID /* rid */,
XContext /* context */ XContext /* context */
#endif
); );
extern XDestroyRegion( extern XDestroyRegion(
#if NeedFunctionPrototypes
Region /* r */ Region /* r */
#endif
); );
extern XEmptyRegion( extern XEmptyRegion(
#if NeedFunctionPrototypes
Region /* r */ Region /* r */
#endif
); );
extern XEqualRegion( extern XEqualRegion(
#if NeedFunctionPrototypes
Region /* r1 */, Region /* r1 */,
Region /* r2 */ Region /* r2 */
#endif
); );
extern int XFindContext( extern int XFindContext(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
XID /* rid */, XID /* rid */,
XContext /* context */, XContext /* context */,
XPointer* /* data_return */ XPointer* /* data_return */
#endif
); );
extern Status XGetClassHint( extern Status XGetClassHint(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XClassHint* /* class_hints_return */ XClassHint* /* class_hints_return */
#endif
); );
extern Status XGetIconSizes( extern Status XGetIconSizes(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XIconSize** /* size_list_return */, XIconSize** /* size_list_return */,
int* /* count_return */ int* /* count_return */
#endif
); );
extern Status XGetNormalHints( extern Status XGetNormalHints(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XSizeHints* /* hints_return */ XSizeHints* /* hints_return */
#endif
); );
extern Status XGetRGBColormaps( extern Status XGetRGBColormaps(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XStandardColormap** /* stdcmap_return */, XStandardColormap** /* stdcmap_return */,
int* /* count_return */, int* /* count_return */,
Atom /* property */ Atom /* property */
#endif
); );
extern Status XGetSizeHints( extern Status XGetSizeHints(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XSizeHints* /* hints_return */, XSizeHints* /* hints_return */,
Atom /* property */ Atom /* property */
#endif
); );
extern Status XGetStandardColormap( extern Status XGetStandardColormap(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XStandardColormap* /* colormap_return */, XStandardColormap* /* colormap_return */,
Atom /* property */ Atom /* property */
#endif
); );
extern Status XGetTextProperty( extern Status XGetTextProperty(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* window */, Window /* window */,
XTextProperty* /* text_prop_return */, XTextProperty* /* text_prop_return */,
Atom /* property */ Atom /* property */
#endif
); );
extern XVisualInfo *XGetVisualInfo( extern XVisualInfo *XGetVisualInfo(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
long /* vinfo_mask */, long /* vinfo_mask */,
XVisualInfo* /* vinfo_template */, XVisualInfo* /* vinfo_template */,
int* /* nitems_return */ int* /* nitems_return */
#endif
); );
extern Status XGetWMClientMachine( extern Status XGetWMClientMachine(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XTextProperty* /* text_prop_return */ XTextProperty* /* text_prop_return */
#endif
); );
extern XWMHints *XGetWMHints( extern XWMHints *XGetWMHints(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */ Window /* w */
#endif
); );
extern Status XGetWMIconName( extern Status XGetWMIconName(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XTextProperty* /* text_prop_return */ XTextProperty* /* text_prop_return */
#endif
); );
extern Status XGetWMName( extern Status XGetWMName(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XTextProperty* /* text_prop_return */ XTextProperty* /* text_prop_return */
#endif
); );
extern Status XGetWMNormalHints( extern Status XGetWMNormalHints(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XSizeHints* /* hints_return */, XSizeHints* /* hints_return */,
long* /* supplied_return */ long* /* supplied_return */
#endif
); );
extern Status XGetWMSizeHints( extern Status XGetWMSizeHints(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XSizeHints* /* hints_return */, XSizeHints* /* hints_return */,
long* /* supplied_return */, long* /* supplied_return */,
Atom /* property */ Atom /* property */
#endif
); );
extern Status XGetZoomHints( extern Status XGetZoomHints(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XSizeHints* /* zhints_return */ XSizeHints* /* zhints_return */
#endif
); );
extern XIntersectRegion( extern XIntersectRegion(
#if NeedFunctionPrototypes
Region /* sra */, Region /* sra */,
Region /* srb */, Region /* srb */,
Region /* dr_return */ Region /* dr_return */
#endif
); );
extern void XConvertCase( extern void XConvertCase(
#if NeedFunctionPrototypes
KeySym /* sym */, KeySym /* sym */,
KeySym* /* lower */, KeySym* /* lower */,
KeySym* /* upper */ KeySym* /* upper */
#endif
); );
extern int XLookupString( extern int XLookupString(
#if NeedFunctionPrototypes
XKeyEvent* /* event_struct */, XKeyEvent* /* event_struct */,
char* /* buffer_return */, char* /* buffer_return */,
int /* bytes_buffer */, int /* bytes_buffer */,
KeySym* /* keysym_return */, KeySym* /* keysym_return */,
XComposeStatus* /* status_in_out */ XComposeStatus* /* status_in_out */
#endif
); );
extern Status XMatchVisualInfo( extern Status XMatchVisualInfo(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
int /* screen */, int /* screen */,
int /* depth */, int /* depth */,
int /* class */, int /* class */,
XVisualInfo* /* vinfo_return */ XVisualInfo* /* vinfo_return */
#endif
); );
extern XOffsetRegion( extern XOffsetRegion(
#if NeedFunctionPrototypes
Region /* r */, Region /* r */,
int /* dx */, int /* dx */,
int /* dy */ int /* dy */
#endif
); );
extern Bool XPointInRegion( extern Bool XPointInRegion(
#if NeedFunctionPrototypes
Region /* r */, Region /* r */,
int /* x */, int /* x */,
int /* y */ int /* y */
#endif
); );
extern Region XPolygonRegion( extern Region XPolygonRegion(
#if NeedFunctionPrototypes
XPoint* /* points */, XPoint* /* points */,
int /* n */, int /* n */,
int /* fill_rule */ int /* fill_rule */
#endif
); );
extern int XRectInRegion( extern int XRectInRegion(
#if NeedFunctionPrototypes
Region /* r */, Region /* r */,
int /* x */, int /* x */,
int /* y */, int /* y */,
unsigned int /* width */, unsigned int /* width */,
unsigned int /* height */ unsigned int /* height */
#endif
); );
extern int XSaveContext( extern int XSaveContext(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
XID /* rid */, XID /* rid */,
XContext /* context */, XContext /* context */,
_Xconst char* /* data */ const char* /* data */
#endif
); );
extern XSetClassHint( extern XSetClassHint(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XClassHint* /* class_hints */ XClassHint* /* class_hints */
#endif
); );
extern XSetIconSizes( extern XSetIconSizes(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XIconSize* /* size_list */, XIconSize* /* size_list */,
int /* count */ int /* count */
#endif
); );
extern XSetNormalHints( extern XSetNormalHints(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XSizeHints* /* hints */ XSizeHints* /* hints */
#endif
); );
extern void XSetRGBColormaps( extern void XSetRGBColormaps(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XStandardColormap* /* stdcmaps */, XStandardColormap* /* stdcmaps */,
int /* count */, int /* count */,
Atom /* property */ Atom /* property */
#endif
); );
extern XSetSizeHints( extern XSetSizeHints(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XSizeHints* /* hints */, XSizeHints* /* hints */,
Atom /* property */ Atom /* property */
#endif
); );
extern XSetStandardProperties( extern XSetStandardProperties(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
_Xconst char* /* window_name */, const char* /* window_name */,
_Xconst char* /* icon_name */, const char* /* icon_name */,
Pixmap /* icon_pixmap */, Pixmap /* icon_pixmap */,
char** /* argv */, char** /* argv */,
int /* argc */, int /* argc */,
XSizeHints* /* hints */ XSizeHints* /* hints */
#endif
); );
extern void XSetTextProperty( extern void XSetTextProperty(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XTextProperty* /* text_prop */, XTextProperty* /* text_prop */,
Atom /* property */ Atom /* property */
#endif
); );
extern void XSetWMClientMachine( extern void XSetWMClientMachine(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XTextProperty* /* text_prop */ XTextProperty* /* text_prop */
#endif
); );
extern XSetWMHints( extern XSetWMHints(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XWMHints* /* wm_hints */ XWMHints* /* wm_hints */
#endif
); );
extern void XSetWMIconName( extern void XSetWMIconName(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XTextProperty* /* text_prop */ XTextProperty* /* text_prop */
#endif
); );
extern void XSetWMName( extern void XSetWMName(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XTextProperty* /* text_prop */ XTextProperty* /* text_prop */
#endif
); );
extern void XSetWMNormalHints( extern void XSetWMNormalHints(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XSizeHints* /* hints */ XSizeHints* /* hints */
#endif
); );
extern void XSetWMProperties( extern void XSetWMProperties(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XTextProperty* /* window_name */, XTextProperty* /* window_name */,
@ -758,155 +659,121 @@ extern void XSetWMProperties(
XSizeHints* /* normal_hints */, XSizeHints* /* normal_hints */,
XWMHints* /* wm_hints */, XWMHints* /* wm_hints */,
XClassHint* /* class_hints */ XClassHint* /* class_hints */
#endif
); );
extern void XmbSetWMProperties( extern void XmbSetWMProperties(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
_Xconst char* /* window_name */, const char* /* window_name */,
_Xconst char* /* icon_name */, const char* /* icon_name */,
char** /* argv */, char** /* argv */,
int /* argc */, int /* argc */,
XSizeHints* /* normal_hints */, XSizeHints* /* normal_hints */,
XWMHints* /* wm_hints */, XWMHints* /* wm_hints */,
XClassHint* /* class_hints */ XClassHint* /* class_hints */
#endif
); );
extern void XSetWMSizeHints( extern void XSetWMSizeHints(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XSizeHints* /* hints */, XSizeHints* /* hints */,
Atom /* property */ Atom /* property */
#endif
); );
extern XSetRegion( extern XSetRegion(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
GC /* gc */, GC /* gc */,
Region /* r */ Region /* r */
#endif
); );
extern void XSetStandardColormap( extern void XSetStandardColormap(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XStandardColormap* /* colormap */, XStandardColormap* /* colormap */,
Atom /* property */ Atom /* property */
#endif
); );
extern XSetZoomHints( extern XSetZoomHints(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Window /* w */, Window /* w */,
XSizeHints* /* zhints */ XSizeHints* /* zhints */
#endif
); );
extern XShrinkRegion( extern XShrinkRegion(
#if NeedFunctionPrototypes
Region /* r */, Region /* r */,
int /* dx */, int /* dx */,
int /* dy */ int /* dy */
#endif
); );
extern Status XStringListToTextProperty( extern Status XStringListToTextProperty(
#if NeedFunctionPrototypes
char** /* list */, char** /* list */,
int /* count */, int /* count */,
XTextProperty* /* text_prop_return */ XTextProperty* /* text_prop_return */
#endif
); );
extern XSubtractRegion( extern XSubtractRegion(
#if NeedFunctionPrototypes
Region /* sra */, Region /* sra */,
Region /* srb */, Region /* srb */,
Region /* dr_return */ Region /* dr_return */
#endif
); );
extern int falmbTextListToTextProperty( extern int falmbTextListToTextProperty(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
char** /* list */, char** /* list */,
int /* count */, int /* count */,
XICCEncodingStyle /* style */, XICCEncodingStyle /* style */,
XTextProperty* /* text_prop_return */ XTextProperty* /* text_prop_return */
#endif
); );
extern int falwcTextListToTextProperty( extern int falwcTextListToTextProperty(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
wchar_t** /* list */, wchar_t** /* list */,
int /* count */, int /* count */,
XICCEncodingStyle /* style */, XICCEncodingStyle /* style */,
XTextProperty* /* text_prop_return */ XTextProperty* /* text_prop_return */
#endif
); );
extern void falwcFreeStringList( extern void falwcFreeStringList(
#if NeedFunctionPrototypes
wchar_t** /* list */ wchar_t** /* list */
#endif
); );
extern Status XTextPropertyToStringList( extern Status XTextPropertyToStringList(
#if NeedFunctionPrototypes
XTextProperty* /* text_prop */, XTextProperty* /* text_prop */,
char*** /* list_return */, char*** /* list_return */,
int* /* count_return */ int* /* count_return */
#endif
); );
extern int falmbTextPropertyToTextList( extern int falmbTextPropertyToTextList(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
XTextProperty* /* text_prop */, XTextProperty* /* text_prop */,
char*** /* list_return */, char*** /* list_return */,
int* /* count_return */ int* /* count_return */
#endif
); );
extern int falwcTextPropertyToTextList( extern int falwcTextPropertyToTextList(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
XTextProperty* /* text_prop */, XTextProperty* /* text_prop */,
wchar_t*** /* list_return */, wchar_t*** /* list_return */,
int* /* count_return */ int* /* count_return */
#endif
); );
extern XUnionRectWithRegion( extern XUnionRectWithRegion(
#if NeedFunctionPrototypes
XRectangle* /* rectangle */, XRectangle* /* rectangle */,
Region /* src_region */, Region /* src_region */,
Region /* dest_region_return */ Region /* dest_region_return */
#endif
); );
extern XUnionRegion( extern XUnionRegion(
#if NeedFunctionPrototypes
Region /* sra */, Region /* sra */,
Region /* srb */, Region /* srb */,
Region /* dr_return */ Region /* dr_return */
#endif
); );
extern int XWMGeometry( extern int XWMGeometry(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
int /* screen_number */, int /* screen_number */,
_Xconst char* /* user_geometry */, const char* /* user_geometry */,
_Xconst char* /* default_geometry */, const char* /* default_geometry */,
unsigned int /* border_width */, unsigned int /* border_width */,
XSizeHints* /* hints */, XSizeHints* /* hints */,
int* /* x_return */, int* /* x_return */,
@ -914,15 +781,12 @@ extern int XWMGeometry(
int* /* width_return */, int* /* width_return */,
int* /* height_return */, int* /* height_return */,
int* /* gravity_return */ int* /* gravity_return */
#endif
); );
extern XXorRegion( extern XXorRegion(
#if NeedFunctionPrototypes
Region /* sra */, Region /* sra */,
Region /* srb */, Region /* srb */,
Region /* dr_return */ Region /* dr_return */
#endif
); );
_XFUNCPROTOEND _XFUNCPROTOEND

View file

@ -94,11 +94,9 @@ static unsigned char _reverse_byte[0x100] = {
* Invert bit order within each BYTE of an array. * Invert bit order within each BYTE of an array.
*/ */
void void
BitOrderInvert(buf, nbytes) BitOrderInvert(unsigned char *buf, int nbytes)
register unsigned char *buf;
register int nbytes;
{ {
register unsigned char *rev = _reverse_byte; unsigned char *rev = _reverse_byte;
for (; --nbytes >= 0; buf++) for (; --nbytes >= 0; buf++)
*buf = rev[*buf]; *buf = rev[*buf];
@ -108,11 +106,9 @@ BitOrderInvert(buf, nbytes)
* Invert byte order within each 16-bits of an array. * Invert byte order within each 16-bits of an array.
*/ */
void void
TwoByteSwap(buf, nbytes) TwoByteSwap(unsigned char *buf, int nbytes)
register unsigned char *buf;
register int nbytes;
{ {
register unsigned char c; unsigned char c;
for (; nbytes > 0; nbytes -= 2, buf += 2) for (; nbytes > 0; nbytes -= 2, buf += 2)
{ {
@ -126,11 +122,9 @@ TwoByteSwap(buf, nbytes)
* Invert byte order within each 32-bits of an array. * Invert byte order within each 32-bits of an array.
*/ */
void void
FourByteSwap(buf, nbytes) FourByteSwap(unsigned char *buf, int nbytes)
register unsigned char *buf;
register int nbytes;
{ {
register unsigned char c; unsigned char c;
for (; nbytes > 0; nbytes -= 4, buf += 4) for (; nbytes > 0; nbytes -= 4, buf += 4)
{ {
@ -148,10 +142,13 @@ FourByteSwap(buf, nbytes)
*/ */
int int
RepadBitmap (pSrc, pDst, srcPad, dstPad, width, height) RepadBitmap (
char *pSrc, *pDst; char *pSrc,
unsigned srcPad, dstPad; char *pDst,
int width, height; unsigned srcPad,
unsigned dstPad,
int width,
int height)
{ {
int srcWidthBytes,dstWidthBytes; int srcWidthBytes,dstWidthBytes;
int row,col; int row,col;

View file

@ -82,13 +82,8 @@ typedef char *va_list;
#else /* !__HIGHC__ */ #else /* !__HIGHC__ */
#if NeedVarargsPrototypes
# include <stdarg.h> # include <stdarg.h>
# define Va_start(a,b) va_start(a,b) # 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 /* __HIGHC__ */

View file

@ -42,12 +42,12 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <X11/Intrinsic.h>
#include "FaLib.h" #include "FaLib.h"
#include "falfont.h" #include "falfont.h"
#include "udcutil.h" #include "udcutil.h"
#define MKFONTLIST (1<<1) #define MKFONTLIST (1<<1)
#define SRCHFNAME (1<<2) #define SRCHFNAME (1<<2)
#define FONTOFID (1<<3) #define FONTOFID (1<<3)
@ -154,7 +154,7 @@ extern int fal_glyph_to_code() ;
static int static int
fal_init() fal_init(void)
{ {
memset( fal_err_file, '\0', sizeof(fal_err_file) ) ; memset( fal_err_file, '\0', sizeof(fal_err_file) ) ;
memset( fal_err_file_buf, '\0', sizeof(fal_err_file_buf) ) ; memset( fal_err_file_buf, '\0', sizeof(fal_err_file_buf) ) ;
@ -175,9 +175,7 @@ fal_init()
} }
void void
set_errfile_str( obuf, ibuf ) set_errfile_str(char *obuf, char *ibuf)
char *obuf ;
char *ibuf ;
{ {
char *sp ; char *sp ;
@ -194,10 +192,7 @@ char *ibuf ;
* open a fontfile by "RDONLY" * open a fontfile by "RDONLY"
*/ */
FalFontID FalFontID
FalOpenFont( file, protect_key_data, codeset ) FalOpenFont(char *file, int protect_key_data, int codeset)
char *file;
int protect_key_data;
int codeset;
{ {
FalFontID __FalOpenFont(); FalFontID __FalOpenFont();
@ -213,17 +208,15 @@ int codeset;
* 0: OFF -- for "FalOpenFont()" * 0: OFF -- for "FalOpenFont()"
*/ */
FalFontID FalFontID
__FalOpenFont( file, protect_key_data, codeset, lockflag ) __FalOpenFont(char *file, int protect_key_data, int codeset, int lockflag)
char *file;
int protect_key_data;
int codeset;
int lockflag;
{ {
int fd ; int fd ;
char *buf; char *buf;
char *openfontfile; char *openfontfile;
struct stat st; struct stat st;
Oak_FontInf *finf; Oak_FontInf *finf;
while(1){
if ( !(openfontfile = (char *)malloc( strlen( file ) + 1 )) ) { if ( !(openfontfile = (char *)malloc( strlen( file ) + 1 )) ) {
fal_seterrcode( _FAL_MALOC_ER, 0, fal_seterrcode( _FAL_MALOC_ER, 0,
@ -358,7 +351,7 @@ int lockflag;
fal_utyderror = 0; fal_utyderror = 0;
fal_utyerrno = FAL_ERR_FONT ; fal_utyerrno = FAL_ERR_FONT ;
fal_utyerrno |= (FAL_FUNCNUM_OPNFNT<<8) ; fal_utyerrno |= (FAL_FUNCNUM_OPNFNT<<8) ;
goto FalError01 ; break;
} }
finf->isFef = FALSE; finf->isFef = FALSE;
finf->isPcf = TRUE; finf->isPcf = TRUE;
@ -376,11 +369,11 @@ int lockflag;
= (unsigned char *)((char *)finf->pCinf = (unsigned char *)((char *)finf->pCinf
+ (sizeof(CharInfoRec) * GETNUMCHARS(finf->pFinf))); + (sizeof(CharInfoRec) * GETNUMCHARS(finf->pFinf)));
finf->width finf->width
= finf->pFinf->maxbounds.metrics.rightSideBearing = finf->pFinf->maxbounds.rightSideBearing
- finf->pFinf->maxbounds.metrics.leftSideBearing; - finf->pFinf->maxbounds.leftSideBearing;
finf->height finf->height
= finf->pFinf->maxbounds.metrics.ascent = finf->pFinf->maxbounds.ascent
+ finf->pFinf->maxbounds.metrics.descent; + finf->pFinf->maxbounds.descent;
} else if ( finf->isPcf ) { } else if ( finf->isPcf ) {
finf->pCinf = NULL; finf->pCinf = NULL;
finf->pGlyphs = NULL; finf->pGlyphs = NULL;
@ -390,7 +383,7 @@ int lockflag;
fal_utyderror = 0; fal_utyderror = 0;
fal_utyerrno = FAL_ERR_FONT ; fal_utyerrno = FAL_ERR_FONT ;
fal_utyerrno |= (FAL_FUNCNUM_OPNFNT<<8) ; fal_utyerrno |= (FAL_FUNCNUM_OPNFNT<<8) ;
goto FalError01 ; break;
} }
finf->start = (finf->pFinf->firstRow << 8) | finf->pFinf->firstCol; finf->start = (finf->pFinf->firstRow << 8) | finf->pFinf->firstCol;
@ -411,7 +404,7 @@ int lockflag;
fal_utyderror = 0; fal_utyderror = 0;
fal_utyerrno = FAL_ERR_MALLOC ; fal_utyerrno = FAL_ERR_MALLOC ;
fal_utyerrno |= (FAL_FUNCNUM_OPNFNT<<8) ; fal_utyerrno |= (FAL_FUNCNUM_OPNFNT<<8) ;
goto FalError01 ; break;
} }
/* Save font information */ /* Save font information */
@ -420,7 +413,7 @@ int lockflag;
lockflag ) == FAL_ERROR ) lockflag ) == FAL_ERROR )
{ {
fal_utyerrno |= (FAL_FUNCNUM_OPNFNT<<8) ; fal_utyerrno |= (FAL_FUNCNUM_OPNFNT<<8) ;
goto FalError01 ; break;
} }
/* Lock the font file */ /* Lock the font file */
@ -430,44 +423,38 @@ int lockflag;
fal_utyerror = _FAL_OPEN_ER; fal_utyerror = _FAL_OPEN_ER;
fal_utyderror = errno; fal_utyderror = errno;
fal_utyerrno |= (FAL_FUNCNUM_OPNFNT<<8) ; fal_utyerrno |= (FAL_FUNCNUM_OPNFNT<<8) ;
goto FalError01 ; break;
} }
} }
free( openfontfile ); free( openfontfile );
return( ( FalFontID ) finf ); return( ( FalFontID ) finf );
FalError01: }
#if defined( SVR4 ) #if defined( SVR4 )
if ( finf->ismmap == TRUE ) { if ( finf->ismmap == TRUE ) {
munmap( buf, finf->fsize ); munmap( buf, finf->fsize );
} else { } else {
free( buf );
close( fd );
}
#else
free( buf ); free( buf );
close( fd ); close( fd );
}
#else
free( buf );
close( fd );
#endif #endif
set_errfile_str( fal_err_file, openfontfile ) ; set_errfile_str( fal_err_file, openfontfile ) ;
free( openfontfile ); free( openfontfile );
free( finf->fname ); free( finf->fname );
finf->fname = NULL; finf->fname = NULL;
free(finf); free(finf);
return (FalFontID)FAL_ERROR; return (FalFontID)FAL_ERROR;
} }
#if NeedFunctionPrototypes FalCloseFont(FalFontID fid)
FalCloseFont(
FalFontID fid )
#else
FalCloseFont( fid )
FalFontID fid;
#endif
{ {
int __FalCloseFont(); int __FalCloseFont();
FontIDInfo fontid_inf ; FontIDInfo fontid_inf ;
@ -489,9 +476,7 @@ FalFontID fid;
* 1: ON --- open a font by "RDWR" mode * 1: ON --- open a font by "RDWR" mode
* 0: OFF -- for "FalOpenFont()" * 0: OFF -- for "FalOpenFont()"
*/ */
__FalCloseFont( fid, lockflag ) __FalCloseFont(FalFontID fid, int lockflag)
FalFontID fid;
int lockflag;
{ {
Oak_FontInf *finf; Oak_FontInf *finf;
@ -545,15 +530,7 @@ int lockflag;
return _FAL_OK; return _FAL_OK;
} }
#if NeedFunctionPrototypes FalQueryFont(FalFontID fid, FalFontinfo *fontinfo)
FalQueryFont(
FalFontID fid,
FalFontinfo *fontinfo )
#else
FalQueryFont( fid, fontinfo )
FalFontID fid;
FalFontinfo *fontinfo;
#endif
{ {
Oak_FontInf *finf; Oak_FontInf *finf;
unsigned int inner_start, inner_end ; unsigned int inner_start, inner_end ;
@ -594,21 +571,12 @@ FalFontinfo *fontinfo;
return _FAL_OK; return _FAL_OK;
} }
#if NeedFunctionPrototypes
char * char *
FalReadFont( FalReadFont(
FalFontID fid, FalFontID fid,
int code, int code,
int width, int width,
int height ) int height )
#else
char *
FalReadFont( fid, code, width, height )
FalFontID fid;
int code ;
int width ;
int height ;
#endif
{ {
Oak_FontInf *finf; Oak_FontInf *finf;
int zoom_on ; int zoom_on ;
@ -713,10 +681,7 @@ int height ;
} }
static static
falGetGlyph( glyph, finf, code ) falGetGlyph(char *glyph, Oak_FontInf *finf, int code)
char *glyph;
Oak_FontInf *finf;
int code;
{ {
int in_dwidth, out_dwidth, ix, i, j; int in_dwidth, out_dwidth, ix, i, j;
char *glyph_p, *inp, p_mask, falGetMask(); char *glyph_p, *inp, p_mask, falGetMask();
@ -740,17 +705,6 @@ int code;
return 0; return 0;
} }
/* Get a character index */
ix = falGetCharIndex( finf, inner_code );
CharInfP = finf->pCinf;
if ( !CharInfP[ix].exists ) {
fal_utyexists = 1;
return 0;
} else {
fal_utyexists = 0;
}
in_dwidth in_dwidth
= (finf->width + SNF_BOUND - 1) = (finf->width + SNF_BOUND - 1)
/ SNF_BOUND * (SNF_BOUND / 8); / SNF_BOUND * (SNF_BOUND / 8);
@ -758,7 +712,7 @@ int code;
p_mask = falGetMask( finf->width ); p_mask = falGetMask( finf->width );
glyph_p = (char *)finf->pGlyphs + CharInfP[ix].byteOffset; glyph_p = (char *)finf->pGlyphs;
for ( i = 0; i < finf->height; i++ ) { for ( i = 0; i < finf->height; i++ ) {
inp = glyph_p + ( in_dwidth * i ); inp = glyph_p + ( in_dwidth * i );
for ( j = 0; j < out_dwidth-1; j++ ) { for ( j = 0; j < out_dwidth-1; j++ ) {
@ -770,9 +724,7 @@ int code;
} }
static static
falGetCharIndex( finf, code ) falGetCharIndex(Oak_FontInf *finf, int code) /* an inside code of a file */
Oak_FontInf *finf;
int code; /* an inside code of a file */
{ {
int nColperRow, nRow, nCol; int nColperRow, nRow, nCol;
@ -784,24 +736,13 @@ int code; /* an inside code of a file */
} }
static static
falZoom( dmem, smem, sw, sh, dw, dh, dbuf ) falZoom(char *dmem, char *smem, int sw, int sh, int dw, int dh, char *dbuf)
char *dmem;
char *smem;
int sw;
int sh;
int dw;
int dh;
char *dbuf;
{ {
int swidth; int swidth = (sw + 7) / 8;
int dwidth; int dwidth = (dw + 7) / 8;
int i, lcnt; int i, lcnt = 0;
char *sp, *dp; char *sp, *dp;
swidth = (sw + 7) / 8;
dwidth = (dw + 7) / 8;
lcnt = 0;
sp = smem; sp = smem;
dp = dmem; dp = dmem;
for ( i=0; i < sh; i++ ) { for ( i=0; i < sh; i++ ) {
@ -824,11 +765,7 @@ char *dbuf;
} }
static static
exline( sp, dbuf, sw, dw ) exline(char *sp, char *dbuf, int sw, int dw)
char *sp;
char *dbuf;
int sw;
int dw;
{ {
int i, bit, sval, dval, dcnt, bcnt; int i, bit, sval, dval, dcnt, bcnt;
@ -862,8 +799,7 @@ static unsigned char _Fal_Mask_Tab[8] = {
}; };
static char static char
falGetMask( width ) falGetMask(int width)
int width;
{ {
int ix = width % 8; int ix = width % 8;
return _Fal_Mask_Tab[ix]; return _Fal_Mask_Tab[ix];
@ -896,19 +832,11 @@ FAL_DB_OPTION ;
/* make a font information list and carry to user */ /* make a font information list and carry to user */
/*********************************************************/ /*********************************************************/
#if NeedFunctionPrototypes
int int
FalGetFontList( FalGetFontList(
FalFontData *key_data, FalFontData *key_data, /* a structure of a searching information */
int mask, int mask, /* a mask */
FalFontDataList **list_ret ) FalFontDataList **list_ret ) /* maked a address of a structure */
#else
int
FalGetFontList( key_data, mask, list_ret )
FalFontData *key_data; /* a structure of a searching information */
int mask; /* a mask */
FalFontDataList **list_ret; /* maked a address of a structure */
#endif
{ {
FalFontDataList *fls; /* a pointer of a structure of "FalFontDataList()" */ FalFontDataList *fls; /* a pointer of a structure of "FalFontDataList()" */
@ -987,9 +915,9 @@ FalFontDataList **list_ret; /* maked a address of a structure */
/***********************************************************************/ /***********************************************************************/
static int static int
chk_key_str( key, mask ) chk_key_str(
FalFontData *key; /* a structure of saerching information */ FalFontData *key, /* a structure of saerching information */
int mask; /* a mask */ int mask) /* a mask */
{ {
int flg = 0; int flg = 0;
@ -1028,10 +956,10 @@ int mask; /* a mask */
static int static int
fal_make_fontlist( fls, key, mask ) fal_make_fontlist(
FalFontDataList *fls; /* a pointer of a structure of a font information list */ FalFontDataList *fls, /* a pointer of a structure of a font information list */
FalFontData *key; /* a structure of searching information */ FalFontData *key, /* a structure of searching information */
int mask; /* a mask for a saerch */ int mask) /* a mask for a saerch */
{ {
return falReadFontInfoLists(MKFONTLIST, return falReadFontInfoLists(MKFONTLIST,
key, mask, fls, key, mask, fls,
@ -1044,15 +972,8 @@ int mask; /* a mask for a saerch */
/* free a structure of "FalFontDataList()" */ /* free a structure of "FalFontDataList()" */
/**************************************************/ /**************************************************/
#if NeedFunctionPrototypes
int int
FalFreeFontList( FalFreeFontList(FalFontDataList *list)
FalFontDataList *list )
#else
int
FalFreeFontList( list )
FalFontDataList *list;
#endif
{ {
int i; int i;
@ -1089,10 +1010,7 @@ FalFontDataList *list;
/***********************************************************************/ /***********************************************************************/
static int static int
fal_split_data( buf, elm_num, elm) fal_split_data(char *buf, int elm_num, char *elm[])
char *buf;
int elm_num;
char *elm[];
{ {
int cnt; int cnt;
int strtop_flg; int strtop_flg;
@ -1131,8 +1049,7 @@ char *elm[];
/***********************************************************************/ /***********************************************************************/
static int static int
fal_clear_data(tmp) fal_clear_data(FalFontData *tmp)
FalFontData *tmp;
{ {
/* search a character */ /* search a character */
free(tmp->xlfdname); free(tmp->xlfdname);
@ -1144,9 +1061,7 @@ FalFontData *tmp;
} }
static int static int
fal_check_already_exist( data, lst ) fal_check_already_exist(FalFontData *data, FalFontDataList *lst)
FalFontData *data;
FalFontDataList *lst;
{ {
int i; int i;
int mask ; int mask ;
@ -1168,8 +1083,7 @@ FalFontDataList *lst;
static int static int
fal_sort_fontlist( lst ) fal_sort_fontlist(FalFontDataList *lst)
FalFontDataList *lst;
{ {
int i,j; int i,j;
FalFontDataList srt; FalFontDataList srt;
@ -1223,9 +1137,7 @@ FalFontDataList *lst;
/***************************************/ /***************************************/
static int static int
fal_atoi(str, val) fal_atoi(char *str, int *val)
char *str;
int *val;
{ {
char *ptr; char *ptr;
char *str_end; char *str_end;
@ -1251,9 +1163,7 @@ int *val;
/*******************************/ /*******************************/
static int static int
fal_set_cs(str, cs) fal_set_cs(char *str, int *cs)
char *str;
int *cs;
{ {
if (!strcmp(str, "CS0")) { if (!strcmp(str, "CS0")) {
*cs = FAL_FONT_CS0; *cs = FAL_FONT_CS0;
@ -1279,9 +1189,7 @@ int *cs;
static int static int
fal_set_prm(str, prm) fal_set_prm(char *str, int *prm)
char *str;
int *prm;
{ {
int tmp = 0; int tmp = 0;
for ( ; *str != '\0' ; str++) { for ( ; *str != '\0' ; str++) {
@ -1300,9 +1208,7 @@ int *prm;
return 0 ; return 0 ;
} }
static int fal_read_db( str, db ) static int fal_read_db(char *str, FalFontDB *db)
char *str;
FalFontDB *db;
{ {
int i; int i;
@ -1320,8 +1226,7 @@ FalFontDB *db;
/***************************************/ /***************************************/
int int
FalGetFontPath( dlist_ret ) FalGetFontPath(FalFontPath **dlist_ret)
FalFontPath **dlist_ret;
{ {
/* clear an error data */ /* clear an error data */
@ -1363,14 +1268,13 @@ FalFontPath **dlist_ret;
} }
static int static int
set_default_path() set_default_path(void)
{ {
return set_font_pathlist(&orgn, 0) ; return set_font_pathlist(&orgn, 0) ;
} }
static int static int
cpy_default_path( p ) cpy_default_path(FalFontPath *p)
FalFontPath *p;
{ {
int i; int i;
FalFontPath tmp; FalFontPath tmp;
@ -1408,8 +1312,7 @@ FalFontPath *p;
} }
static int static int
comp_default_path(p) comp_default_path(FalFontPath *p)
FalFontPath *p;
{ {
int i; int i;
@ -1430,8 +1333,7 @@ FalFontPath *p;
static int static int
fal_clear_font_path( ls ) fal_clear_font_path(FalFontPath *ls)
FalFontPath *ls;
{ {
int i; int i;
@ -1468,69 +1370,67 @@ FalFontPath *ls;
#define FAL_FONT_ELM_XLFDNAME 12 #define FAL_FONT_ELM_XLFDNAME 12
int int
set_struct( tmp_data, elm ) set_struct(FalFontData *tmp_data, char *elm[])
FalFontData *tmp_data;
char *elm[];
{ {
char *dup_p; char *dup_p;
/* data information */
/* data information */
while(1){
/* a width of a character size */ /* a width of a character size */
if ( fal_atoi( if ( fal_atoi(
elm[FAL_FONT_ELM_SIZE_W], &(tmp_data->size.w ) elm[FAL_FONT_ELM_SIZE_W], &(tmp_data->size.w )
) == FAL_ERROR ) == FAL_ERROR
) { ) {
goto FalError02 ; break;
} }
/* a height of a character size */ /* a height of a character size */
if ( fal_atoi( if ( fal_atoi(
elm[FAL_FONT_ELM_SIZE_H], &(tmp_data->size.h ) elm[FAL_FONT_ELM_SIZE_H], &(tmp_data->size.h )
) == FAL_ERROR ) == FAL_ERROR
) { ) {
goto FalError02 ; break;
} }
/* a width of a letter size */ /* a width of a letter size */
if ( fal_atoi( if ( fal_atoi(
elm[FAL_FONT_ELM_LETTER_W], &(tmp_data->letter.w ) elm[FAL_FONT_ELM_LETTER_W], &(tmp_data->letter.w )
) == FAL_ERROR ) == FAL_ERROR
) { ) {
goto FalError02 ; break;
} }
/* a height of a letter size */ /* a height of a letter size */
if ( fal_atoi( if ( fal_atoi(
elm[FAL_FONT_ELM_LETTER_H], &(tmp_data->letter.h ) elm[FAL_FONT_ELM_LETTER_H], &(tmp_data->letter.h )
) == FAL_ERROR ) == FAL_ERROR
) { ) {
goto FalError02 ; break;
} }
/* position x of a letter size */ /* position x of a letter size */
if ( fal_atoi( if ( fal_atoi(
elm[FAL_FONT_ELM_LETTER_X], &(tmp_data->letter.x ) elm[FAL_FONT_ELM_LETTER_X], &(tmp_data->letter.x )
) == FAL_ERROR ) == FAL_ERROR
) { ) {
goto FalError02 ; break;
} }
/* position y of a letter size */ /* position y of a letter size */
if ( fal_atoi( if ( fal_atoi(
elm[FAL_FONT_ELM_LETTER_Y], &(tmp_data->letter.y ) elm[FAL_FONT_ELM_LETTER_Y], &(tmp_data->letter.y )
) == FAL_ERROR ) == FAL_ERROR
) { ) {
goto FalError02 ; break;
} }
/* codeset */ /* codeset */
if ( fal_set_cs( if ( fal_set_cs(
elm[FAL_FONT_ELM_CODE_SET], &(tmp_data->cd_set ) elm[FAL_FONT_ELM_CODE_SET], &(tmp_data->cd_set )
) == FAL_ERROR ) == FAL_ERROR
) { ) {
goto FalError02 ; break;
} }
/* a equipment of an output permission */ /* a equipment of an output permission */
if ( fal_set_prm( if ( fal_set_prm(
elm[FAL_FONT_ELM_PERMISSION], &(tmp_data->prm ) elm[FAL_FONT_ELM_PERMISSION], &(tmp_data->prm )
) == FAL_ERROR ) == FAL_ERROR
) { ) {
goto FalError02 ; break;
} }
/* character information */ /* character information */
@ -1572,16 +1472,14 @@ char *elm[];
SET_STRUCT_OPTION( dup_p, elm, tmp_data, fal_utyerror, fal_db_group ) ; SET_STRUCT_OPTION( dup_p, elm, tmp_data, fal_utyerror, fal_db_group ) ;
return 0; return 0;
FalError02: }
set_errfile_str( fal_err_file, fal_err_file_buf ) ; set_errfile_str( fal_err_file, fal_err_file_buf ) ;
fal_utyerrno = FAL_ERR_FDATA_DSC ; fal_utyerrno = FAL_ERR_FDATA_DSC ;
return FAL_ERROR; return FAL_ERROR;
} }
/* get a full path name */ /* get a full path name */
int searchFontFileName( data, fullPathName ) int searchFontFileName(FalFontData data, char *fullPathName)
FalFontData data;
char *fullPathName;
{ {
int rtn ; int rtn ;
rtn = falReadFontInfoLists(SRCHFNAME, rtn = falReadFontInfoLists(SRCHFNAME,
@ -1595,9 +1493,7 @@ char *fullPathName;
} }
int fal_eq_data( data, tmp_data ) int fal_eq_data(FalFontData data, FalFontData tmp_data)
FalFontData data;
FalFontData tmp_data;
{ {
int flg = 0; int flg = 0;
@ -1684,8 +1580,7 @@ FalFontData tmp_data;
static int static int
CR_to_NULL(buf) CR_to_NULL(char *buf)
char *buf;
{ {
for( ; *buf != '\0'; buf++ ) { for( ; *buf != '\0'; buf++ ) {
if (*buf == '\n') { if (*buf == '\n') {
@ -1696,8 +1591,7 @@ char *buf;
return 0 ; return 0 ;
} }
char *fal_get_base_name( str ) char *fal_get_base_name(char *str)
char *str;
{ {
char *str_slash; char *str_slash;
@ -1710,10 +1604,7 @@ char *str;
static int static int
fal_cmp_data( op1, key, mask ) fal_cmp_data(FalFontData *op1, FalFontData *key, int mask)
FalFontData *op1;
FalFontData *key;
int mask ;
{ {
if ( mask == 0 ) { if ( mask == 0 ) {
return(0); return(0);
@ -1816,9 +1707,7 @@ int mask ;
/* no sort ... 0 */ /* no sort ... 0 */
static int static int
new_target( target, choose ) new_target(FalFontData *target, FalFontData *choose)
FalFontData *target;
FalFontData *choose;
{ {
FalFontData diff; FalFontData diff;
DEF_STR_CHK ; DEF_STR_CHK ;
@ -1932,15 +1821,9 @@ FalFontData *choose;
return 0; return 0;
} }
#if NeedFunctionPrototypes
int FalFontOfFontID( int FalFontOfFontID(
FalFontID fid, FalFontID fid,
FalFontData *fontdata ) FalFontData *fontdata )
#else
int FalFontOfFontID( fid, fontdata )
FalFontID fid;
FalFontData *fontdata;
#endif
{ {
int rtn ; int rtn ;
rtn = falReadFontInfoLists(FONTOFID, rtn = falReadFontInfoLists(FONTOFID,
@ -1953,19 +1836,11 @@ FalFontData *fontdata;
return rtn ; return rtn ;
} }
#if NeedFunctionPrototypes
FalFontID FalFontID
FalOpenSysFont( FalOpenSysFont(
FalFontData *open_font_data, FalFontData *open_font_data,
int font_data_mask, int font_data_mask,
FalFontDataList **missing_font_list_return ) FalFontDataList **missing_font_list_return )
#else
FalFontID
FalOpenSysFont( open_font_data, font_data_mask, missing_font_list_return )
FalFontData *open_font_data;
int font_data_mask;
FalFontDataList **missing_font_list_return;
#endif
{ {
int retFL; /* return a data of FontList */ int retFL; /* return a data of FontList */
FalFontID retOF; /* return a data of OpenFont */ FalFontID retOF; /* return a data of OpenFont */
@ -2046,7 +1921,7 @@ FalFontDataList **missing_font_list_return;
* function to access fonts.list * function to access fonts.list
********************************************************/ ********************************************************/
static static
FILE *open_fonts_list() FILE *open_fonts_list(void)
{ {
FILE *fp; FILE *fp;
@ -2097,9 +1972,7 @@ FILE *open_fonts_list()
static int static int
set_font_pathlist(pathlist, nodef) set_font_pathlist(FalFontPath *pathlist, int nodef)
FalFontPath *pathlist ;
int nodef ;
{ {
FILE *fp; FILE *fp;
char buf[FAL_LINE_MAX]; char buf[FAL_LINE_MAX];
@ -2222,8 +2095,7 @@ int nodef ;
static int static int
make_default_path(pathlist) make_default_path(FalFontPath *pathlist)
FalFontPath *pathlist ;
{ {
struct stat statbuf ; struct stat statbuf ;
char pbuf[FAL_LINE_MAX], *dir, *p ; char pbuf[FAL_LINE_MAX], *dir, *p ;
@ -2302,18 +2174,18 @@ FalFontPath *pathlist ;
static int static int
falReadFontInfoLists(func, lstkey, mask, fls, fnkey, fullpath, fid, fdata) falReadFontInfoLists(
int func ; int func,
/* parameters for FalGetFontList */ /* parameters for FalGetFontList */
FalFontData *lstkey; FalFontData *lstkey,
int mask; int mask,
FalFontDataList *fls; FalFontDataList *fls,
/* parameters for searchFontFileName */ /* parameters for searchFontFileName */
FalFontData fnkey; FalFontData fnkey,
char *fullpath; char *fullpath,
/* parameters for FalFontOfFontID */ /* parameters for FalFontOfFontID */
FalFontID fid ; FalFontID fid,
FalFontData *fdata; FalFontData *fdata)
{ {
FILE *fp; FILE *fp;
char pname[ FAL_LINE_MAX ] ; char pname[ FAL_LINE_MAX ] ;
@ -2675,7 +2547,7 @@ FalError:
/* clear code set informations */ /* clear code set informations */
static void static void
clear_charset_info() clear_charset_info(void)
{ {
if( charset_str_buf ) free( charset_str_buf ) ; if( charset_str_buf ) free( charset_str_buf ) ;
charset_str_buf = NULL ; charset_str_buf = NULL ;
@ -2686,13 +2558,13 @@ clear_charset_info()
static int static int
fal_get_def_fontdata(func, pname, buf, elm, tmp_data, key_fname) fal_get_def_fontdata(
int func ; int func,
char *pname ; /* font path */ char *pname, /* font path */
char *buf ; /* buffer for fgets() */ char *buf, /* buffer for fgets() */
char **elm ; char **elm,
FalFontData *tmp_data ; FalFontData *tmp_data,
char *key_fname ; char *key_fname)
{ {
int rtn ; int rtn ;
char tmp_fname[FAL_LINE_MAX] ; char tmp_fname[FAL_LINE_MAX] ;
@ -2716,12 +2588,12 @@ char *key_fname ;
static int static int
falgetfontlist(tmp_data, key, mask, fls, fontnum) falgetfontlist(
FalFontData *tmp_data ; FalFontData *tmp_data,
FalFontData *key ; FalFontData *key,
int mask ; int mask,
FalFontDataList *fls ; FalFontDataList *fls,
int fontnum ; int fontnum)
{ {
FalFontData *p_bak ; FalFontData *p_bak ;
@ -2754,14 +2626,14 @@ int fontnum ;
static int static int
fal_get_undef_fontdata(func, full_path, xlfd, tmp_data, key_fname, codeset_num, codeset_list) fal_get_undef_fontdata(
int func ; int func,
char *full_path ; char *full_path,
char *xlfd ; char *xlfd,
FalFontData *tmp_data ; FalFontData *tmp_data,
char *key_fname ; char *key_fname,
int *codeset_num ; int *codeset_num,
int **codeset_list ; int **codeset_list)
{ {
int rtn, pix ; int rtn, pix ;
char *char_set ; char *char_set ;
@ -2836,17 +2708,10 @@ int **codeset_list ;
* get file name of fonts * get file name of fonts
*/ */
#if NeedFunctionPrototypes
int int
FalFontIDToFileName( FalFontIDToFileName(
FalFontID fid, FalFontID fid,
char **file_name ) char **file_name )
#else
int
FalFontIDToFileName( fid, file_name )
FalFontID fid;
char **file_name;
#endif
{ {
char *fname ; char *fname ;
Oak_FontInf *finf ; Oak_FontInf *finf ;
@ -2876,15 +2741,8 @@ char **file_name;
} }
#if NeedFunctionPrototypes
int int
FalFree( FalFree(void *list)
void *list )
#else
int
FalFree( list )
void *list ;
#endif
{ {
if( list == NULL ) { if( list == NULL ) {
fal_utyerror = _FAL_PARM_ER ; fal_utyerror = _FAL_PARM_ER ;
@ -2899,9 +2757,7 @@ void *list ;
int int
FalFreeGI( ginf, num ) FalFreeGI(FalGIInf *ginf, int num)
FalGIInf *ginf ;
int num ;
{ {
int i ; int i ;
if( ginf == NULL ) { if( ginf == NULL ) {
@ -2924,11 +2780,7 @@ int num ;
*/ */
static int static int
fal_add_fidinf( fid, dspcode, cd_set, islock ) fal_add_fidinf(FalFontID fid, int dspcode, int cd_set, int islock)
FalFontID fid ;
int dspcode ;
int cd_set ;
int islock ;
{ {
int exist, i, cnt ; int exist, i, cnt ;
FontIDInfo **flist ; FontIDInfo **flist ;
@ -2985,9 +2837,7 @@ int islock ;
} }
static int static int
fal_read_fidinf( fid, fontid_inf ) fal_read_fidinf(FalFontID fid, FontIDInfo *fontid_inf)
FalFontID fid ;
FontIDInfo *fontid_inf;
{ {
int i ; int i ;
if( fid == NULL ) { if( fid == NULL ) {
@ -3011,8 +2861,7 @@ FontIDInfo *fontid_inf;
static int static int
fal_del_fidinf( fid ) fal_del_fidinf(FalFontID fid)
FalFontID fid ;
{ {
int i, cnt, target ; int i, cnt, target ;
FontIDInfo **flist ; FontIDInfo **flist ;
@ -3051,10 +2900,7 @@ FalFontID fid ;
*/ */
static int static int
fal_conv_code_to_glyph( fid, code, glidx ) fal_conv_code_to_glyph(FalFontID fid, unsigned int code, unsigned int *glidx)
FalFontID fid ;
unsigned int code ;
unsigned int *glidx ;
{ {
Oak_FontInf *finf ; Oak_FontInf *finf ;
FalFontData tmp_data ; FalFontData tmp_data ;
@ -3128,12 +2974,12 @@ unsigned int *glidx ;
*/ */
static int static int
fal_conv_glyph_to_code( finf, dspcode, cd_set, glidx, code ) fal_conv_glyph_to_code(
Oak_FontInf *finf ; Oak_FontInf *finf,
int dspcode ; int dspcode,
int cd_set ; int cd_set,
unsigned int glidx ; unsigned int glidx,
unsigned int *code ; unsigned int *code)
{ {
FalFontData tmp_data ; FalFontData tmp_data ;
int inner_code ; int inner_code ;
@ -3176,8 +3022,7 @@ unsigned int *code ;
static int static int
file_lock( fd ) file_lock(int fd) /* a file descripter */
int fd; /* a file descripter */
{ {
struct flock flpar; struct flock flpar;
@ -3195,8 +3040,7 @@ int fd; /* a file descripter */
} }
static int static int
file_unlock( fd ) file_unlock(int fd) /* a file descripter */
int fd; /* a file descripter */
{ {
struct flock flpar; struct flock flpar;
@ -3213,8 +3057,7 @@ int fd; /* a file descripter */
} }
static int static int
is_lock( fd ) is_lock(int fd) /* file descripter */
int fd; /* file descripter */
{ {
struct flock flpar; struct flock flpar;

View file

@ -1,9 +1,9 @@
############################################################################# #############################################################################
##### ##### ##### #####
##### fonts.list ##### ##### fonts.list #####
##### ##### ##### #####
##### All Rights Reserved, Copyright (C) FUJITSU LIMITED 1995 ##### ##### All Rights Reserved, Copyright (C) FUJITSU LIMITED 1995 #####
##### ##### ##### #####
############################################################################# #############################################################################
# #
# This file is referenced by : # This file is referenced by :

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,122 +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,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

@ -36,6 +36,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <X11/Intrinsic.h>
#include "FaLib.h" #include "FaLib.h"
#include "falfont.h" #include "falfont.h"
@ -62,8 +63,7 @@ extern void BitOrderInvert() ;
extern void set_errfile_str() ; extern void set_errfile_str() ;
static CARD32 static CARD32
getLSB32( p) getLSB32(unsigned char *p)
unsigned char *p;
{ {
CARD32 c; CARD32 c;
@ -76,9 +76,7 @@ unsigned char *p;
} }
static int static int
getINT32( p, format) getINT32(unsigned char *p, CARD32 format)
unsigned char *p;
CARD32 format;
{ {
CARD32 c; CARD32 c;
@ -98,9 +96,7 @@ CARD32 format;
} }
static int static int
getINT16( p, format) getINT16(unsigned char *p, CARD32 format)
unsigned char *p;
CARD32 format;
{ {
CARD32 c; CARD32 c;
@ -116,13 +112,13 @@ CARD32 format;
} }
static Bool static Bool
seekToType( tables, ntables, type, formatp, sizep, offsetp) seekToType(
PCFTablePtr tables; PCFTablePtr tables,
int ntables; int ntables,
CARD32 type; CARD32 type,
CARD32 *formatp; CARD32 *formatp,
CARD32 *sizep; CARD32 *sizep,
CARD32 *offsetp; CARD32 *offsetp)
{ {
int i; int i;
@ -143,10 +139,7 @@ CARD32 *offsetp;
static void static void
getMetric( buf, format, metric) getMetric(caddr_t buf, CARD32 format, xCharInfo *metric)
caddr_t buf;
CARD32 format;
xCharInfo *metric;
{ {
metric->leftSideBearing = getINT16( (unsigned char *)buf, (CARD32)format); metric->leftSideBearing = getINT16( (unsigned char *)buf, (CARD32)format);
buf += 2; buf += 2;
@ -163,13 +156,13 @@ xCharInfo *metric;
} }
static Bool static Bool
getAccel( pFontInfo, maxink, buf_top, tables, ntables, type) getAccel(
FontInfoPtr pFontInfo; FontInfoPtr pFontInfo,
xCharInfo *maxink; xCharInfo *maxink,
caddr_t buf_top; caddr_t buf_top,
PCFTablePtr tables; PCFTablePtr tables,
int ntables; int ntables,
CARD32 type; CARD32 type)
{ {
CARD32 format; CARD32 format;
CARD32 offset; CARD32 offset;
@ -200,23 +193,21 @@ CARD32 type;
buffer +=4; buffer +=4;
/* pFontInfo->maxOverlap = getINT32( (unsigned char *)buffer, (CARD32)format); */ buffer += 4; /* pFontInfo->maxOverlap = getINT32( (unsigned char *)buffer, (CARD32)format); */ buffer += 4;
getMetric(buffer, format, &pFontInfo->minbounds.metrics); getMetric(buffer, format, &pFontInfo->minbounds);
buffer += 12; buffer += 12;
getMetric(buffer, format, &pFontInfo->maxbounds.metrics); getMetric(buffer, format, &pFontInfo->maxbounds);
buffer += 12; buffer += 12;
if (PCF_FORMAT_MATCH(format, PCF_ACCEL_W_INKBOUNDS)) { if (PCF_FORMAT_MATCH(format, PCF_ACCEL_W_INKBOUNDS)) {
buffer += 12; buffer += 12;
getMetric( buffer, format, maxink); getMetric( buffer, format, maxink);
} else { } else {
*maxink = pFontInfo->maxbounds.metrics; *maxink = pFontInfo->maxbounds;
} }
return TRUE; return TRUE;
} }
int int
falInitReadPcf( pcfinf, buftop) falInitReadPcf(struct pcf_inf *pcfinf, caddr_t buftop)
struct pcf_inf *pcfinf;
caddr_t buftop;
{ {
CARD32 format; CARD32 format;
CARD32 offset; CARD32 offset;
@ -225,7 +216,7 @@ caddr_t buftop;
caddr_t buffp; caddr_t buffp;
if ( getLSB32( (unsigned char *)buftop ) != PCF_FILE_VERSION) if ( getLSB32( (unsigned char *)buftop ) != PCF_FILE_VERSION)
goto Bail; return -1;
pcfinf->ntables = getLSB32( (unsigned char *)(buftop + 4) ); pcfinf->ntables = getLSB32( (unsigned char *)(buftop + 4) );
@ -235,20 +226,20 @@ caddr_t buftop;
(CARD32)PCF_BDF_ACCELERATORS)) (CARD32)PCF_BDF_ACCELERATORS))
if ( !getAccel( &pcfinf->info, &maxink, buftop, pcfinf->tables, pcfinf->ntables, if ( !getAccel( &pcfinf->info, &maxink, buftop, pcfinf->tables, pcfinf->ntables,
(CARD32)PCF_ACCELERATORS)) (CARD32)PCF_ACCELERATORS))
goto Bail; return -1;
pcfinf->org_bounds = pcfinf->info.maxbounds.metrics; pcfinf->org_bounds = pcfinf->info.maxbounds;
if ( !seekToType( pcfinf->tables, pcfinf->ntables, (CARD32)PCF_BITMAPS, if ( !seekToType( pcfinf->tables, pcfinf->ntables, (CARD32)PCF_BITMAPS,
&format, (CARD32 *)NULL, &offset)) &format, (CARD32 *)NULL, &offset))
goto Bail; return -1;
buffp = buftop + offset; buffp = buftop + offset;
format = getLSB32( (unsigned char *)buffp ); format = getLSB32( (unsigned char *)buffp );
buffp += 4; buffp += 4;
if (!PCF_FORMAT_MATCH(format, PCF_DEFAULT_FORMAT)) if (!PCF_FORMAT_MATCH(format, PCF_DEFAULT_FORMAT))
goto Bail; return -1;
pcfinf->nbitmaps = getINT32( (unsigned char *)buffp, (CARD32)format); pcfinf->nbitmaps = getINT32( (unsigned char *)buffp, (CARD32)format);
buffp += 4; buffp += 4;
@ -264,13 +255,13 @@ caddr_t buftop;
if ( !seekToType( pcfinf->tables, pcfinf->ntables, (CARD32)PCF_BDF_ENCODINGS, if ( !seekToType( pcfinf->tables, pcfinf->ntables, (CARD32)PCF_BDF_ENCODINGS,
&format, (CARD32 *)NULL, &offset)) &format, (CARD32 *)NULL, &offset))
goto Bail; return -1;
buffp = buftop + offset; buffp = buftop + offset;
format = getLSB32( (unsigned char *)buffp ); format = getLSB32( (unsigned char *)buffp );
buffp += 4; buffp += 4;
if (!PCF_FORMAT_MATCH(format, PCF_DEFAULT_FORMAT)) if (!PCF_FORMAT_MATCH(format, PCF_DEFAULT_FORMAT))
goto Bail; return -1;
pcfinf->info.firstCol = getINT16( (unsigned char *)buffp, (CARD32)format); pcfinf->info.firstCol = getINT16( (unsigned char *)buffp, (CARD32)format);
buffp += 2; buffp += 2;
@ -283,7 +274,7 @@ caddr_t buftop;
/* /*
pcfinf->info.defaultCh = 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); pcfinf->info.defaultCh = getINT16( (unsigned char *)buffp, (CARD32)format);
buffp += 2; buffp += 2;
pcfinf->info.allExist = FALSE; pcfinf->info.allExist = FALSE;
@ -291,14 +282,10 @@ caddr_t buftop;
pcfinf->encodingOffsets = (CARD16 *)buffp; pcfinf->encodingOffsets = (CARD16 *)buffp;
return 0; return 0;
Bail:
return -1;
} }
static void static void
ByteSwap( p, scan) ByteSwap(char *p, int scan)
char *p;
int scan;
{ {
char w; char w;
@ -321,11 +308,7 @@ int scan;
} }
} }
static void static void
repadBits( src, format, width, height, dest) repadBits(char *src, CARD32 format, int width, int height, char *dest)
char *src;
CARD32 format;
int width, height;
char *dest;
{ {
int bit, byte, glyph, scan; int bit, byte, glyph, scan;
int src_bytewidth, dest_bytewidth; int src_bytewidth, dest_bytewidth;
@ -358,17 +341,14 @@ char *dest;
} }
int int
falPcfGlyph( glyph, finf, code) falPcfGlyph(char *glyph, Oak_FontInf *finf, int code)
char *glyph;
Oak_FontInf *finf;
int code;
{ {
int encode; int encode;
int inner_code; int inner_code;
char *bitmap; char *bitmap;
int encodingOffset; int encodingOffset;
int codeRow, codeCol; int codeRow, codeCol;
int bytewidth; int bytewidth;
int bmp_adj, ptn_adj; int bmp_adj, ptn_adj;
int adj_hi; int adj_hi;
int cpy_height; int cpy_height;
@ -405,9 +385,9 @@ int code;
bitmap = finf->pcfinf.bitmaps + getINT32( (unsigned char *)(finf->pcfinf.offsets + encodingOffset), finf->pcfinf.bmp_fmt); bitmap = finf->pcfinf.bitmaps + getINT32( (unsigned char *)(finf->pcfinf.offsets + encodingOffset), finf->pcfinf.bmp_fmt);
bmp_height = finf->pFinf->maxbounds.metrics.ascent bmp_height = finf->pFinf->maxbounds.ascent
+ finf->pFinf->maxbounds.metrics.descent; + finf->pFinf->maxbounds.descent;
if (( adj_hi = finf->pFinf->maxbounds.metrics.ascent if (( adj_hi = finf->pFinf->maxbounds.ascent
- finf->pcfinf.org_bounds.ascent) > 0) { - finf->pcfinf.org_bounds.ascent) > 0) {
bytewidth = 8 * PCF_GLYPH_PAD( finf->pcfinf.bmp_fmt); bytewidth = 8 * PCF_GLYPH_PAD( finf->pcfinf.bmp_fmt);
bytewidth = (( finf->width + bytewidth - 1)/ bytewidth ) * PCF_GLYPH_PAD( finf->pcfinf.bmp_fmt); bytewidth = (( finf->width + bytewidth - 1)/ bytewidth ) * PCF_GLYPH_PAD( finf->pcfinf.bmp_fmt);
@ -433,9 +413,10 @@ int code;
} }
void void
falGetPcfGSize( pcfinf, widthp, heightp) falGetPcfGSize(
struct pcf_inf *pcfinf; struct pcf_inf *pcfinf,
unsigned int *widthp, *heightp; unsigned int *widthp,
unsigned int *heightp)
{ {
unsigned int w, h; unsigned int w, h;
@ -456,7 +437,7 @@ unsigned int *widthp, *heightp;
* *
*******************************************************/ *******************************************************/
#include "fontstruct.h" #include <X11/fonts/fontstruct.h>
static char *getPcfFontProp(); static char *getPcfFontProp();
static char *getSnfFontProp(); static char *getSnfFontProp();
@ -466,11 +447,11 @@ static char *getSnfFontProp();
*/ */
int int
falReadFontProp( file, protect_key_data, databuff, islock ) falReadFontProp(
char *file ; /* name of font file */ char *file, /* name of font file */
int protect_key_data ; int protect_key_data,
FalFontData *databuff ; FalFontData *databuff,
int islock ; int islock)
{ {
Oak_FontInf finf; Oak_FontInf finf;
int fd ; int fd ;
@ -586,11 +567,11 @@ int islock ;
* get properties of GPF format file * get properties of GPF format file
*/ */
int int
falReadGpfProp( updflg, finf, protect_key_data, databuff ) falReadGpfProp(
int updflg ; int updflg,
Oak_FontInf *finf; Oak_FontInf *finf,
int protect_key_data ; int protect_key_data,
FalFontData *databuff ; FalFontData *databuff)
{ {
char *openfontfile; char *openfontfile;
int rtn ; int rtn ;
@ -656,10 +637,7 @@ FalFontData *databuff ;
* get properties of PCF format file * get properties of PCF format file
*/ */
int int
falInitReadPcfProp( updflg, finf, databuff ) falInitReadPcfProp(int updflg, Oak_FontInf *finf, FalFontData *databuff)
int updflg ;
Oak_FontInf *finf;
FalFontData *databuff ;
{ {
struct pcf_inf *pcfinf; struct pcf_inf *pcfinf;
caddr_t buftop; caddr_t buftop;
@ -685,7 +663,7 @@ FalFontData *databuff ;
if ( !getAccel( &pcfinf->info, &maxink, buftop, pcfinf->tables, if ( !getAccel( &pcfinf->info, &maxink, buftop, pcfinf->tables,
pcfinf->ntables, (CARD32)PCF_ACCELERATORS)) { pcfinf->ntables, (CARD32)PCF_ACCELERATORS)) {
fal_utyerrno = FAL_ERR_FONT ; fal_utyerrno = FAL_ERR_FONT ;
goto Bail; return -1;
} }
} }
@ -696,7 +674,7 @@ FalFontData *databuff ;
*/ */
if( updflg == FAL_UPDATE_FONTINFO ) { if( updflg == FAL_UPDATE_FONTINFO ) {
pcfinf->org_bounds = pcfinf->info.maxbounds.metrics; pcfinf->org_bounds = pcfinf->info.maxbounds;
} }
lb = pcfinf->org_bounds.leftSideBearing ; lb = pcfinf->org_bounds.leftSideBearing ;
@ -714,7 +692,7 @@ FalFontData *databuff ;
pcfinf->ntables, "FONT" )) { pcfinf->ntables, "FONT" )) {
if( (databuff->xlfdname = (char *)strdup( buffp )) == (char *)NULL ){ if( (databuff->xlfdname = (char *)strdup( buffp )) == (char *)NULL ){
fal_utyerrno = FAL_ERR_MALLOC ; fal_utyerrno = FAL_ERR_MALLOC ;
goto Bail; return -1;
} }
}else{ }else{
set_errfile_str( fal_err_file, finf->fname ) ; set_errfile_str( fal_err_file, finf->fname ) ;
@ -729,7 +707,7 @@ FalFontData *databuff ;
pcfinf->ntables, "FAMILY_NAME")) { pcfinf->ntables, "FAMILY_NAME")) {
if( (databuff->style.name = (char *)strdup( buffp )) == NULL ){ if( (databuff->style.name = (char *)strdup( buffp )) == NULL ){
fal_utyerrno = FAL_ERR_MALLOC ; fal_utyerrno = FAL_ERR_MALLOC ;
goto Bail ; return -1;
} }
}else{ }else{
set_errfile_str( fal_err_file, finf->fname ) ; set_errfile_str( fal_err_file, finf->fname ) ;
@ -738,18 +716,13 @@ FalFontData *databuff ;
} }
return 0; return 0;
Bail:
return -1;
} }
static char * static char *
getPcfFontProp( buftop, tables, ntables, propname) getPcfFontProp(caddr_t buftop, PCFTablePtr tables, int ntables, char *propname)
caddr_t buftop;
PCFTablePtr tables;
int ntables;
char *propname;
{ {
caddr_t buffer; caddr_t buffer;
int name_ofs; int name_ofs;
@ -792,10 +765,10 @@ char *propname;
* get properties of SNF format file * get properties of SNF format file
*/ */
int int
falInitReadSnfProp( finf, buftop, databuff ) falInitReadSnfProp(
Oak_FontInf *finf; /* pointer to the infomation structure */ Oak_FontInf *finf, /* pointer to the infomation structure */
caddr_t buftop; /* font file */ caddr_t buftop, /* font file */
FalFontData *databuff ; FalFontData *databuff)
{ {
caddr_t stprop ; caddr_t stprop ;
int lb, rb, as, ds ; int lb, rb, as, ds ;
@ -805,23 +778,21 @@ FalFontData *databuff ;
/* initialize pointer */ /* initialize pointer */
nprops = finf->pFinf->nProps ; nprops = finf->pFinf->nprops ;
num_chars = ( finf->pFinf->lastRow - finf->pFinf->firstRow + 1 ) * num_chars = ( finf->pFinf->lastRow - finf->pFinf->firstRow + 1 ) *
( finf->pFinf->lastCol - finf->pFinf->firstCol + 1 ) ; ( finf->pFinf->lastCol - finf->pFinf->firstCol + 1 ) ;
bitmapSize = BYTESOFGLYPHINFO(finf->pFinf) ;
stprop = buftop ; stprop = buftop ;
stprop += sizeof(FontInfoRec) ; stprop += sizeof(FontInfoRec) ;
stprop += num_chars * sizeof(CharInfoRec) ; stprop += num_chars * sizeof(CharInfoRec) ;
stprop += bitmapSize ;
/* /*
* read property "FONTBOUNDINGBOX" * read property "FONTBOUNDINGBOX"
*/ */
lb = finf->pFinf->maxbounds.metrics.leftSideBearing ; lb = finf->pFinf->maxbounds.leftSideBearing ;
rb = finf->pFinf->maxbounds.metrics.rightSideBearing ; rb = finf->pFinf->maxbounds.rightSideBearing ;
as = finf->pFinf->maxbounds.metrics.ascent ; as = finf->pFinf->maxbounds.ascent ;
ds = finf->pFinf->maxbounds.metrics.descent ; ds = finf->pFinf->maxbounds.descent ;
/* /*
* read property "FONT" * read property "FONT"
@ -829,7 +800,8 @@ FalFontData *databuff ;
if ( propptr = getSnfFontProp( stprop, nprops, "FONT" )) { if ( propptr = getSnfFontProp( stprop, nprops, "FONT" )) {
if( (fnt = (char *)strdup( propptr )) == NULL ){ if( (fnt = (char *)strdup( propptr )) == NULL ){
fal_utyerrno = FAL_ERR_MALLOC ; fal_utyerrno = FAL_ERR_MALLOC ;
goto Bail; free(fnt);
return -1;
} }
}else{ }else{
set_errfile_str( fal_err_file, finf->fname ) ; set_errfile_str( fal_err_file, finf->fname ) ;
@ -843,7 +815,8 @@ FalFontData *databuff ;
if ( propptr = getSnfFontProp( stprop, nprops, "FAMILY_NAME")) { if ( propptr = getSnfFontProp( stprop, nprops, "FAMILY_NAME")) {
if( (fam = (char *)strdup( propptr )) == NULL ){ if( (fam = (char *)strdup( propptr )) == NULL ){
fal_utyerrno = FAL_ERR_MALLOC ; fal_utyerrno = FAL_ERR_MALLOC ;
goto Bail ; free(fnt);
return -1;
} }
}else{ }else{
set_errfile_str( fal_err_file, finf->fname ) ; set_errfile_str( fal_err_file, finf->fname ) ;
@ -863,18 +836,12 @@ FalFontData *databuff ;
databuff->style.name = fam ; databuff->style.name = fam ;
return 0; return 0;
Bail:
free(fnt);
return -1;
} }
static char * static char *
getSnfFontProp( buftop, nprops, propname ) getSnfFontProp(caddr_t buftop, int nprops, char *propname)
caddr_t buftop;
int nprops ;
char *propname;
{ {
caddr_t buffer; caddr_t buffer;
int name_ofs; int name_ofs;
@ -889,11 +856,7 @@ char *propname;
for ( i=0; i < nprops ; i++, ProcRec++ ) { for ( i=0; i < nprops ; i++, ProcRec++ ) {
name_ofs = ProcRec->name ; name_ofs = ProcRec->name ;
if( strcmp( propstr + name_ofs, propname ) == 0 ){ if( strcmp( propstr + name_ofs, propname ) == 0 ){
if( ProcRec->indirect ){
return( propstr + ProcRec->value ) ;
}else{
return( (char *) (intptr_t) ProcRec->value ) ; return( (char *) (intptr_t) ProcRec->value ) ;
}
} }
} }

View file

@ -33,45 +33,34 @@
#include "_falutil.h" #include "_falutil.h"
extern XrmQuark falrmStringToQuark( extern XrmQuark falrmStringToQuark(
#if NeedFunctionPrototypes const char* /* string */
_Xconst char* /* string */
#endif
); );
extern XrmString falrmQuarkToString( extern XrmString falrmQuarkToString(
#if NeedFunctionPrototypes
XrmQuark /* quark */ XrmQuark /* quark */
#endif
); );
extern char *falGetAtomName( extern char *falGetAtomName(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
Atom /* atom */ Atom /* atom */
#endif
); );
extern char **falListFonts( extern char **falListFonts(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
_Xconst char* /* pattern */, const char* /* pattern */,
int /* maxnames */, int /* maxnames */,
int* /* actual_count_return */ int* /* actual_count_return */
#endif
); );
extern char **falListFontsWithInfo( extern char **falListFontsWithInfo(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
_Xconst char* /* pattern */, const char* /* pattern */,
int /* maxnames */, int /* maxnames */,
int* /* count_return */, int* /* count_return */,
XFontStruct** /* info_return */ XFontStruct** /* info_return */
#endif
); );
extern XFontStruct *falLoadQueryFont( extern XFontStruct *falLoadQueryFont(
#if NeedFunctionPrototypes
Display* /* display */, Display* /* display */,
_Xconst char* /* name */ const char* /* name */
#endif
); );

View file

@ -55,13 +55,22 @@
#include "bdfgpf.h" #include "bdfgpf.h"
static void ErrMsgTable_GetDefaultFile(); static void ErrMsgTable_GetDefaultFile(char *com,
static int falcom_split_data() ; int ret,
static void dsp_font_list() ; int size,
static int search_Font_File_Name(); char *style,
char *fname);
static int falcom_split_data(char *buf,
int entry_num,
char *elm[]);
static void dsp_font_list(FalFontDataList *flist);
static int search_Font_File_Name(FalFontData data, char *fname);
extern int searchFontFileName(); extern int searchFontFileName(FalFontData data, char *fullPathName);
extern int falReadFontProp() ; extern int falReadFontProp(char *file,
int protect_key_data,
FalFontData *databuff,
int islock);
/* /*
* get "character size" and "letter size" from a character of an interface * get "character size" and "letter size" from a character of an interface
@ -76,10 +85,10 @@ extern int falReadFontProp() ;
#define BODY_AND_LETTER 2 #define BODY_AND_LETTER 2
static int static int
GetSize( size_str, body, letter ) GetSize(
char *size_str; /* a character of a size */ char *size_str, /* a character of a size */
int *body; /* set "character size" (output) */ int *body, /* set "character size" (output) */
int *letter; /* set "letter size" (output) */ int *letter) /* set "letter size" (output) */
{ {
char *str_dot; char *str_dot;
/* char *str_end; */ /* char *str_end; */
@ -120,18 +129,10 @@ int *letter; /* set "letter size" (output) */
*/ */
int int
#if NeedFunctionPrototypes
falcom_atoi( falcom_atoi(
char *str, /* numerical character */ char *str, /* numerical character */
char ed_code,/* an end code in numerical character */ char ed_code,/* an end code in numerical character */
int *val /* set numarical data */ int *val) /* set numarical data */
)
#else
falcom_atoi(str, ed_code, val)
char *str; /* numerical character */
char ed_code;/* an end code in numerical character */
int *val; /* set numarical data */
#endif
{ {
char *ptr; char *ptr;
char *str_end; char *str_end;
@ -153,8 +154,7 @@ int *val; /* set numarical data */
static int static int
falcom_cr_to_null(buf) falcom_cr_to_null(char *buf)
char *buf;
{ {
buf = strchr( buf, '\n'); buf = strchr( buf, '\n');
if (buf != NULL) { if (buf != NULL) {
@ -173,18 +173,10 @@ char *buf;
int int
#if NeedFunctionPrototypes
GetDefaultFile( GetDefaultFile(
int size, int size, /* character size */
char *style, char *style, /* character style */
char *fname char *fname) /* buffer */
)
#else
GetDefaultFile( size, style, fname )
int size; /* character size */
char *style; /* character style */
char *fname; /* buffer */
#endif
{ {
FILE *fp; FILE *fp;
int ret; int ret;
@ -213,20 +205,11 @@ char *fname; /* buffer */
int int
#if NeedFunctionPrototypes
get_default_file( get_default_file(
FILE *fp, FILE *fp,
int size, int size, /* character size */
char *style, char *style, /* character style */
char *fname char *fname) /* buffer */
)
#else
get_default_file( fp, size, style, fname )
FILE *fp;
int size; /* character size */
char *style; /* character style */
char *fname; /* buffer */
#endif
{ {
char buf[BUFSIZE]; /* buffer */ char buf[BUFSIZE]; /* buffer */
int size_tmp; /* size (read file) */ int size_tmp; /* size (read file) */
@ -273,10 +256,10 @@ char *fname; /* buffer */
/**************************************************************/ /**************************************************************/
static int static int
falcom_split_data( buf, entry_num, elm ) falcom_split_data(
char *buf; /* read a font information character array from a file */ char *buf, /* read a font information character array from a file */
int entry_num; int entry_num,
char *elm[]; char *elm[])
{ {
int cnt; /* counter */ int cnt; /* counter */
int strtop_flg; /* flag of a head of a character array */ int strtop_flg; /* flag of a head of a character array */
@ -309,12 +292,7 @@ char *elm[];
char * char *
#if NeedFunctionPrototypes falcom_get_base_name( char *str /* a full path character of a file name */ )
falcom_get_base_name( char *str )
#else
falcom_get_base_name( str )
char *str; /* a full path character of a file name */
#endif
{ {
char *str_slash; char *str_slash;
@ -327,8 +305,7 @@ char *str; /* a full path character of a file name */
static int static int
is_letter_size_not_only_one( lst ) is_letter_size_not_only_one( FalFontDataList *lst /* a font list */ )
FalFontDataList *lst; /* a font list */
{ {
int i, letter_cmp; int i, letter_cmp;
@ -351,22 +328,12 @@ FalFontDataList *lst; /* a font list */
* *
*/ */
int int
#if NeedFunctionPrototypes
GetFileName( GetFileName(
char *com, char *com, /* a character of a command name(case error) */
char *size_str, char *size_str, /* a character of "size" */
char *style, char *style, /* a character of "style" */
int codeset, int codeset, /* a codeset */
char *ofile char *ofile) /* set a target file name (output) */
)
#else
GetFileName(com, size_str, style, codeset, ofile)
char *com; /* a character of a command name(case error) */
char *size_str; /* a character of "size" */
char *style; /* a character of "style" */
int codeset; /* a codeset */
char *ofile; /* set a target file name (output) */
#endif
{ {
int body, letter; int body, letter;
int size_sw; /* a size flag */ int size_sw; /* a size flag */
@ -570,18 +537,10 @@ char *fal_errmsg_org[0xff] = {
void void
#if NeedFunctionPrototypes
ErrMsgTable_FalGetFontList( ErrMsgTable_FalGetFontList(
char *com, char *com, /* command name */
int utyerr, int utyerr, /* fal_utyerror */
int utyderr int utyderr) /* fal_utyderror */
)
#else
ErrMsgTable_FalGetFontList( com, utyerr, utyderr )
char *com; /* command name */
int utyerr; /* fal_utyerror */
int utyderr; /* fal_utyderror */
#endif
{ {
char *fontsdir, *locale ; char *fontsdir, *locale ;
@ -627,17 +586,15 @@ int utyderr; /* fal_utyderror */
} }
} }
/* take out an error message of "GetDefaultFile()" */ /* take out an error message of "GetDefaultFile()" */
static void static void
ErrMsgTable_GetDefaultFile( com, ret, size, style, fname ) ErrMsgTable_GetDefaultFile(
char *com; /* a command name */ char *com, /* a command name */
int ret; /* return code */ int ret, /* return code */
int size; /* a character size */ int size, /* a character size */
char *style; /* a character style */ char *style, /* a character style */
char *fname; /* user defined character information file name */ char *fname) /* user defined character information file name */
{ {
switch (ret) { switch (ret) {
case -1: case -1:
@ -666,12 +623,7 @@ char *fname; /* user defined character information file name */
*/ */
void void
#if NeedFunctionPrototypes
fal_cut_tailslash( char *name ) fal_cut_tailslash( char *name )
#else
fal_cut_tailslash( name )
char *name;
#endif
{ {
char *p; char *p;
@ -695,12 +647,7 @@ char *name;
*/ */
char * char *
#if NeedFunctionPrototypes
GetRealFileName( char *name ) GetRealFileName( char *name )
#else
GetRealFileName( name )
char *name;
#endif
{ {
static char *ret_name ; static char *ret_name ;
char link_name[BUFSIZE]; char link_name[BUFSIZE];
@ -760,18 +707,10 @@ char *name;
*/ */
int int
#if NeedFunctionPrototypes
IsInRegion( IsInRegion(
int code , int code ,
int num_gr , int num_gr ,
FalGlyphRegion *gr FalGlyphRegion *gr)
)
#else
IsInRegion(code, num_gr, gr)
int code ;
int num_gr ;
FalGlyphRegion *gr ;
#endif
{ {
int i ; int i ;
if( code < MIN_CODE || code > MAX_CODE ) return -1 ; if( code < MIN_CODE || code > MAX_CODE ) return -1 ;
@ -787,9 +726,7 @@ FalGlyphRegion *gr ;
static int static int
search_Font_File_Name( data, fname ) search_Font_File_Name( FalFontData data, char *fname )
FalFontData data ;
char *fname ;
{ {
FalFontID fid ; FalFontID fid ;
FalFontDataList *flist ; FalFontDataList *flist ;
@ -861,20 +798,11 @@ char *fname ;
int int
#if NeedFunctionPrototypes
GetUdcFileName( GetUdcFileName(
char *com , char *com,
int code_no , int code_no,
char *xlfdname , char *xlfdname,
char *fname char *fname)
)
#else
GetUdcFileName( com, code_no, xlfdname, fname )
char *com ;
int code_no ;
char *xlfdname ;
char *fname ;
#endif
{ {
FalFontData data ; FalFontData data ;
@ -891,8 +819,7 @@ char *fname ;
static void static void
dsp_font_list( flist ) dsp_font_list( FalFontDataList *flist )
FalFontDataList *flist ;
{ {
int i ; int i ;
@ -910,22 +837,12 @@ FalFontDataList *flist ;
int int
#if NeedFunctionPrototypes
GetUdcRegion( GetUdcRegion(
char *com , char *com,
int codeset , int codeset,
char *gpf_file , char *gpf_file,
int *num_gr , int *num_gr,
FalGlyphRegion **gr FalGlyphRegion **gr)
)
#else
GetUdcRegion( com, codeset, gpf_file, num_gr, gr )
char *com ;
int codeset ;
char *gpf_file ;
int *num_gr ;
FalGlyphRegion **gr ;
#endif
{ {
FalFontData fdata ; FalFontData fdata ;
char *locale, *char_set, *tmp_gpf ; char *locale, *char_set, *tmp_gpf ;
@ -971,12 +888,7 @@ FalGlyphRegion **gr ;
#define MAX_CODESET 8 #define MAX_CODESET 8
int int
#if NeedFunctionPrototypes
DispUdcCpArea( FILE *fp ) DispUdcCpArea( FILE *fp )
#else
DispUdcCpArea( fp )
FILE *fp ;
#endif
{ {
int cd_set, j ; int cd_set, j ;
FalFontDataList *fls ; FalFontDataList *fls ;
@ -1026,18 +938,10 @@ FILE *fp ;
int int
#if NeedFunctionPrototypes
GetUdcFontName( GetUdcFontName(
char *gpf_file , char *gpf_file ,
char *bdf_file , char *bdf_file ,
char **fontname char **fontname)
)
#else
GetUdcFontName( gpf_file, bdf_file, fontname )
char *gpf_file ;
char *bdf_file ;
char **fontname ;
#endif
{ {
FILE *fp ; FILE *fp ;
pid_t chld_pid = 0; pid_t chld_pid = 0;

View file

@ -48,12 +48,7 @@
*/ */
int int
#if NeedFunctionPrototypes
FileLock( int fd ) FileLock( int fd )
#else
FileLock( fd )
int fd; /* a file descripter */
#endif
{ {
struct flock flpar; struct flock flpar;
@ -83,12 +78,7 @@ int fd; /* a file descripter */
*/ */
int int
#if NeedFunctionPrototypes
FileUnLock( int fd ) FileUnLock( int fd )
#else
FileUnLock( fd )
int fd; /* a file descripter */
#endif
{ {
struct flock flpar; struct flock flpar;
@ -115,12 +105,7 @@ int fd; /* a file descripter */
*/ */
int int
#if NeedFunctionPrototypes
isLock( int fd ) isLock( int fd )
#else
isLock( fd )
int fd; /* file descripter */
#endif
{ {
struct flock flpar; struct flock flpar;

View file

@ -52,7 +52,7 @@
#include "bdfgpf.h" #include "bdfgpf.h"
#include "udcutil.h" #include "udcutil.h"
static void exline(); static void exline(char *sp, char *dbuf, int sw, int dw);
char *oakgtobdf; char *oakgtobdf;
char *bdftosnf = BDFTOSNF; char *bdftosnf = BDFTOSNF;
@ -66,16 +66,7 @@ static int put_file_create_err_msg = 0;
#define READ_FAIL 5 #define READ_FAIL 5
int int
#if NeedFunctionPrototypes ReadBdfHeader(struct btophead *head, char *buf)
ReadBdfHeader(
struct btophead *head,
char *buf
)
#else
ReadBdfHeader( head, buf )
struct btophead *head;
char *buf;
#endif
{ {
char *p; char *p;
unsigned int getstat = 0; unsigned int getstat = 0;
@ -128,16 +119,7 @@ char *buf;
int int
#if NeedFunctionPrototypes ReadGpfHeader(struct ptobhead *head, char *buf)
ReadGpfHeader(
struct ptobhead *head,
char *buf
)
#else
ReadGpfHeader(head, buf)
struct ptobhead *head;
char *buf;
#endif
{ {
char *p; char *p;
unsigned int getstat = 0; unsigned int getstat = 0;
@ -173,12 +155,7 @@ char *buf;
int int
#if NeedFunctionPrototypes
WriteBdfHeader( struct ptobhead *head ) WriteBdfHeader( struct ptobhead *head )
#else
WriteBdfHeader(head)
struct ptobhead *head;
#endif
{ {
FILE *fp; FILE *fp;
int fd[2]; int fd[2];
@ -296,12 +273,7 @@ struct ptobhead *head;
void void
#if NeedFunctionPrototypes
WriteGpfHeader( struct btophead *head ) WriteGpfHeader( struct btophead *head )
#else
WriteGpfHeader(head)
struct btophead *head;
#endif
{ {
fprintf(head->output, "numfonts:%d\n", head->num_chars); fprintf(head->output, "numfonts:%d\n", head->num_chars);
fprintf(head->output, "width:%d\n", head->p_width ); fprintf(head->output, "width:%d\n", head->p_width );
@ -312,12 +284,7 @@ struct btophead *head;
int int
#if NeedFunctionPrototypes
WritePtnToBdf( struct ptobhead *head ) WritePtnToBdf( struct ptobhead *head )
#else
WritePtnToBdf(head)
struct ptobhead *head;
#endif
{ {
int msize, swidth, rtn, i, nchar; int msize, swidth, rtn, i, nchar;
char *zoomptn; char *zoomptn;
@ -376,12 +343,7 @@ struct ptobhead *head;
int int
#if NeedFunctionPrototypes
putDefaultChars( struct ptobhead *head ) putDefaultChars( struct ptobhead *head )
#else
putDefaultChars(head )
struct ptobhead *head;
#endif
{ {
int swidth, bytew, i, j; int swidth, bytew, i, j;
unsigned int posbit ; unsigned int posbit ;
@ -408,12 +370,7 @@ struct ptobhead *head;
int int
#if NeedFunctionPrototypes
WritePtnToGpf( struct btophead *head ) WritePtnToGpf( struct btophead *head )
#else
WritePtnToGpf(head)
struct btophead *head;
#endif
{ {
int msize, rtn, i; int msize, rtn, i;
char *zoomptn; char *zoomptn;
@ -456,16 +413,7 @@ struct btophead *head;
int int
#if NeedFunctionPrototypes ReadBdfToMemory(struct btophead *head, char *buf)
ReadBdfToMemory(
struct btophead *head,
char *buf
)
#else
ReadBdfToMemory(head, buf)
struct btophead *head;
char *buf;
#endif
{ {
int code, mwidth, num_char, bsize, rtn; int code, mwidth, num_char, bsize, rtn;
char *ptn; char *ptn;
@ -502,20 +450,11 @@ char *buf;
int int
#if NeedFunctionPrototypes
ReadBdfToMemory_with_init( ReadBdfToMemory_with_init(
struct btophead *head, struct btophead *head,
int init_start, int init_start,
int init_end, int init_end,
char *buf char *buf)
)
#else
ReadBdfToMemory_with_init(head, init_start, init_end, buf)
struct btophead *head;
int init_start;
int init_end;
char *buf;
#endif
{ {
int code, mwidth, num_char, bsize, rtn; int code, mwidth, num_char, bsize, rtn;
char *ptn; char *ptn;
@ -555,18 +494,11 @@ char *buf;
int int
#if NeedFunctionPrototypes
GetBdfCode( GetBdfCode(
struct btophead *head, struct btophead *head,
char *buf, char *buf,
int *code int *code
) )
#else
GetBdfCode(head, buf, code)
struct btophead *head;
char *buf;
int *code;
#endif
{ {
char *p; char *p;
@ -590,24 +522,13 @@ int *code;
return(0); return(0);
} }
int int
#if NeedFunctionPrototypes
GetBdfPtn( GetBdfPtn(
struct btophead *head, struct btophead *head,
char *buf, char *buf,
char *ptn, char *ptn,
int mwidth, int mwidth,
int bsize int bsize)
)
#else
GetBdfPtn(head, buf, ptn, mwidth, bsize)
struct btophead *head;
char *buf;
char *ptn;
int mwidth;
int bsize;
#endif
{ {
int skip, i, j; int skip, i, j;
char *p; char *p;
@ -654,16 +575,7 @@ int bsize;
int int
#if NeedFunctionPrototypes ReadGpfToMemory(struct ptobhead *head, char *buf)
ReadGpfToMemory(
struct ptobhead *head,
char *buf
)
#else
ReadGpfToMemory(head, buf)
struct ptobhead *head;
char *buf;
#endif
{ {
int code, mwidth, num_char, bsize, rtn; int code, mwidth, num_char, bsize, rtn;
char *ptn; char *ptn;
@ -700,18 +612,7 @@ char *buf;
int int
#if NeedFunctionPrototypes GetGpfCode(struct ptobhead *head, char *buf, int *code)
GetGpfCode(
struct ptobhead *head,
char *buf,
int *code
)
#else
GetGpfCode(head, buf, code)
struct ptobhead *head;
char *buf;
int *code;
#endif
{ {
char *p; char *p;
@ -735,9 +636,7 @@ int *code;
return(0); return(0);
} }
int int
#if NeedFunctionPrototypes
GetGpfPtn( GetGpfPtn(
struct ptobhead *head, struct ptobhead *head,
char *buf, char *buf,
@ -745,14 +644,6 @@ GetGpfPtn(
int mwidth, int mwidth,
int bsize int bsize
) )
#else
GetGpfPtn(head, buf, ptn, mwidth, bsize)
struct ptobhead *head;
char *buf;
char *ptn;
int mwidth;
int bsize;
#endif
{ {
int skip, i, j; int skip, i, j;
char *p; char *p;
@ -788,18 +679,7 @@ int bsize;
void void
#if NeedFunctionPrototypes GetBdfLinePtn(char *mem, char *buf, int width)
GetBdfLinePtn(
char *mem,
char *buf,
int width
)
#else
GetBdfLinePtn(mem, buf, width)
char *mem;
char *buf;
int width;
#endif
{ {
int i, iend, len; int i, iend, len;
char *p, str[3]; char *p, str[3];
@ -831,18 +711,7 @@ int width;
} }
void void
#if NeedFunctionPrototypes GetGpfLinePtn(char *mem, char *buf, int width)
GetGpfLinePtn(
char *mem,
char *buf,
int width
)
#else
GetGpfLinePtn(mem, buf, width)
char *mem;
char *buf;
int width;
#endif
{ {
unsigned int skip, i, iend, j; unsigned int skip, i, iend, j;
unsigned char ptn; unsigned char ptn;
@ -876,20 +745,7 @@ int width;
int int
#if NeedFunctionPrototypes PutBdfPtn(unsigned char *ptn, int width, int height, FILE *fp)
PutBdfPtn(
unsigned char *ptn,
int width,
int height,
FILE *fp
)
#else
PutBdfPtn(ptn, width, height, fp)
unsigned char *ptn;
int width;
int height;
FILE *fp;
#endif
{ {
int i, j, nbyte ; int i, j, nbyte ;
unsigned char *pbuf, x, c; unsigned char *pbuf, x, c;
@ -920,24 +776,8 @@ FILE *fp;
return(0); return(0);
} }
int int
#if NeedFunctionPrototypes PutGpfPtn(char *ptn, int width, int height, FILE *fp)
PutGpfPtn(
char *ptn,
int width,
int height,
FILE *fp
)
#else
PutGpfPtn(ptn, width, height, fp)
char *ptn;
int width;
int height;
FILE *fp;
#endif
{ {
int i, j, k, nbyte, tw; int i, j, k, nbyte, tw;
unsigned char p, *pbuf; unsigned char p, *pbuf;
@ -974,24 +814,7 @@ FILE *fp;
int int
#if NeedFunctionPrototypes PtnZoom(char *dmem, char *smem, int sw, int sh, int dw, int dh)
PtnZoom(
char *dmem,
char *smem,
int sw,
int sh,
int dw,
int dh
)
#else
PtnZoom(dmem, smem, sw, sh, dw, dh)
char *dmem;
char *smem;
int sw;
int sh;
int dw;
int dh;
#endif
{ {
int swidth; int swidth;
int dwidth; int dwidth;
@ -1031,11 +854,7 @@ int dh;
static void static void
exline(sp, dbuf, sw, dw) exline(char *sp, char *dbuf, int sw, int dw)
char *sp;
char *dbuf;
int sw;
int dw;
{ {
unsigned int i, bit, sval, dval, dcnt, bcnt; unsigned int i, bit, sval, dval, dcnt, bcnt;
@ -1065,12 +884,7 @@ int dw;
char * char *
#if NeedFunctionPrototypes
GetTmpPath( char *path ) GetTmpPath( char *path )
#else
GetTmpPath( path )
char *path;
#endif
{ {
char *p=NULL, *sp, *buf ; char *p=NULL, *sp, *buf ;
int len ; int len ;
@ -1097,18 +911,12 @@ char *path;
if( *sp == '/' ) *sp-- = '\0' ; if( *sp == '/' ) *sp-- = '\0' ;
sprintf( sp+1, "/%s", TEMPFILEKEY ) ; sprintf( sp+1, "/%s", TEMPFILEKEY ) ;
/* Get temporary file name */ /* Get temporary file name */
return mktemp( buf ) ; return mkstemp( buf );
} }
int int
#if NeedFunctionPrototypes
Link_NewFile( char *rd_file, char *wr_file ) Link_NewFile( char *rd_file, char *wr_file )
#else
Link_NewFile( rd_file, wr_file )
char *rd_file ;
char *wr_file ;
#endif
{ {
FILE *rfp, *wfp ; FILE *rfp, *wfp ;
int i, c ; int i, c ;
@ -1187,12 +995,7 @@ char *wr_file ;
int int
#if NeedFunctionPrototypes ChkNumString( char *str )
ChkNumString( char *str )
#else
ChkNumString( str )
char *str;
#endif
{ {
char *tmp; char *tmp;
int num; int num;
@ -1209,7 +1012,6 @@ char *str;
void void
#if NeedFunctionPrototypes
ErrMsgTable_AndExit( ErrMsgTable_AndExit(
int er_no, int er_no,
char *snf_in, char *snf_in,
@ -1219,16 +1021,6 @@ ErrMsgTable_AndExit(
char *bdf_in, char *bdf_in,
char *prog_name char *prog_name
) )
#else
ErrMsgTable_AndExit(er_no, snf_in, snf_out, gpf_in, gpf_out, bdf_in, prog_name)
int er_no;
char *snf_in;
char *snf_out;
char *gpf_in;
char *gpf_out;
char *bdf_in;
char *prog_name ;
#endif
{ {
int rtn = 0 ; int rtn = 0 ;
switch(er_no) { switch(er_no) {
@ -1305,16 +1097,7 @@ char *prog_name ;
void void
#if NeedFunctionPrototypes fatal_err_msg(int er_no, char *prog_name)
fatal_err_msg(
int er_no,
char *prog_name
)
#else
fatal_err_msg( er_no, prog_name )
int er_no;
char *prog_name;
#endif
{ {
USAGE1("%s : The font file failed to be converted. ", prog_name); USAGE1("%s : The font file failed to be converted. ", prog_name);
switch( er_no ) { switch( er_no ) {
@ -1371,13 +1154,12 @@ static int sig_flg=0;
#define CATCH_SIGNAL 10 #define CATCH_SIGNAL 10
void void
ChatchSig() ChatchSig(void)
{ {
sig_flg = 1; sig_flg = 1;
} }
void void
#if NeedFunctionPrototypes
Put_File_Create_Err_Msg( Put_File_Create_Err_Msg(
int msg_level, int msg_level,
char *org_name, char *org_name,
@ -1385,14 +1167,6 @@ Put_File_Create_Err_Msg(
char *save_name, char *save_name,
char *com char *com
) )
#else
Put_File_Create_Err_Msg( msg_level, org_name, tmp_name, save_name, com )
int msg_level;
char *org_name;
char *tmp_name;
char *save_name;
char *com;
#endif
{ {
switch( msg_level ) { switch( msg_level ) {
case GPF_BUCK_UP_FAIL: case GPF_BUCK_UP_FAIL:
@ -1419,7 +1193,6 @@ char *com;
} }
int int
#if NeedFunctionPrototypes
Make_NewFefFile( Make_NewFefFile(
char *org_name, char *org_name,
char *tmp_name, char *tmp_name,
@ -1428,15 +1201,6 @@ Make_NewFefFile(
gid_t group, gid_t group,
char *com char *com
) )
#else
Make_NewFefFile( org_name, tmp_name, mode, owner, group, com )
char *org_name;
char *tmp_name;
mode_t mode;
uid_t owner;
gid_t group;
char *com;
#endif
{ {
struct stat statbuf; struct stat statbuf;
char *save_name = NULL; char *save_name = NULL;
@ -1503,16 +1267,7 @@ char *com;
int int
#if NeedFunctionPrototypes Unlink_Tmpfile(char *file,char *com)
Unlink_Tmpfile(
char *file,
char *com
)
#else
Unlink_Tmpfile( file, com )
char *file;
char *com;
#endif
{ {
errno = 0; errno = 0;
if ( unlink( file ) != 0 ) { if ( unlink( file ) != 0 ) {
@ -1524,18 +1279,7 @@ char *com;
int int
#if NeedFunctionPrototypes Chmod_File (char *fname, mode_t mode, char *com)
Chmod_File (
char *fname,
mode_t mode,
char *com
)
#else
Chmod_File ( fname, mode, com )
char *fname;
mode_t mode;
char *com;
#endif
{ {
errno = 0; errno = 0;
if ( mode == 0 ) return( 0 ) ; if ( mode == 0 ) return( 0 ) ;
@ -1548,20 +1292,7 @@ char *com;
int int
#if NeedFunctionPrototypes Chown_File (char *fname, uid_t owner, gid_t group, char *com)
Chown_File (
char *fname,
uid_t owner,
gid_t group,
char *com
)
#else
Chown_File ( fname, owner, group, com )
char *fname;
uid_t owner;
gid_t group;
char *com;
#endif
{ {
errno = 0; errno = 0;
if ( chown (fname, owner, group) != 0) { if ( chown (fname, owner, group) != 0) {
@ -1577,12 +1308,7 @@ char *com;
int int
#if NeedFunctionPrototypes ChkPcfFontFile( char *filename )
ChkPcfFontFile( char *filename )
#else
ChkPcfFontFile( filename )
char *filename;
#endif
{ {
char *suffix; char *suffix;
@ -1599,12 +1325,7 @@ char *filename;
int int
#if NeedFunctionPrototypes ChkSnfFontFile( char *filename )
ChkSnfFontFile( char *filename )
#else
ChkSnfFontFile( filename )
char *filename;
#endif
{ {
char *suffix; char *suffix;
@ -1621,16 +1342,7 @@ char *filename;
char * char *
#if NeedFunctionPrototypes get_cmd_path(char *path, char *cmd)
get_cmd_path(
char *path,
char *cmd
)
#else
get_cmd_path( path, cmd )
char *path;
char *cmd;
#endif
{ {
char *cmd_path = NULL; char *cmd_path = NULL;
struct stat st; struct stat st;
@ -1673,20 +1385,7 @@ char *cmd;
} }
int int
#if NeedFunctionPrototypes SetCmdPath(char *com, char **path, char *dflt_path, char *cmd)
SetCmdPath(
char *com ,
char **path ,
char *dflt_path ,
char *cmd
)
#else
SetCmdPath( com, path, dflt_path, cmd )
char *com ;
char **path ;
char *dflt_path ;
char *cmd ;
#endif
{ {
struct stat statbuf ; struct stat statbuf ;
char *pbuf ; char *pbuf ;

View file

@ -39,18 +39,18 @@
#include "xoakufont.h" #include "xoakufont.h"
#include "util.h" #include "util.h"
void CBeOblB_aEnd(); void CBeOblB_aEnd(Widget widget, caddr_t clientData, caddr_t callData);
void EHeStaT_list(); void EHeStaT_list(Widget widget, int select, XEvent *e);
void CBeScro(); void CBeScro(Widget widget, caddr_t clientData, caddr_t callData);
void EHeBulB_eMEv(); void EHeBulB_eMEv(Widget widget, caddr_t clientData, XEvent *e);
void EHeBulB_eExp(); void EHeBulB_eExp(Widget widget, caddr_t clientData, XEvent *e);
void EHeBulB_dExp(); void EHeBulB_dExp(Widget widget, caddr_t clientData);
static void EHStaT_disp(); static void EHStaT_disp(Widget widget, int i);
extern Resource resource; extern Resource resource;
extern int efctPtnNum(); extern int efctPtnNum(void);
extern char *char_set(); extern char *char_set(char *str);
extern char *fullpath; extern char *fullpath;
extern FalFontData fullFontData; extern FalFontData fullFontData;
@ -77,16 +77,15 @@ static Widget wgeStaT_form[EDLIST_MAX],
* contents : displays the "User Defined Charactrer editor" window * contents : displays the "User Defined Charactrer editor" window
*/ */
static Widget CreateEditPtn(); static Widget CreateEditPtn(Widget owner);
void OpenCB(); void OpenCB(Widget w, XtPointer client_data, XtPointer call_data);
void MngPtnCB(); void MngPtnCB(void);
void CpyPtnCB(); void CpyPtnCB(void);
void CBeRecB_color(); void CBeRecB_obj(Widget widget, int obj, XmToggleButtonCallbackStruct *call);
void CBeRecB_obj(); void CBeOblB_aAdd(void);
void CBeOblB_aAdd(); void CBeOblB_rCmd(Widget widget, int proc, caddr_t callData);
void CBeOblB_rCmd(); void CBeOblB_rCmdp(Widget widget, int proc, caddr_t callData);
void CBeOblB_rCmdp(); void CBeOblB_rCan(Widget widget, caddr_t clientData, caddr_t callData);
void CBeOblB_rCan();
/** /**
@ -95,12 +94,12 @@ void CBeOblB_rCan();
**/ **/
static void static void
XlfdCB() XlfdCB(void)
{ {
Widget dialog; Widget dialog;
Arg args[5]; Arg args[5];
char mess[1024]; char mess[1024];
int n; int n = 0;
XmString cs, cs1, cs2; XmString cs, cs1, cs2;
sprintf(mess, "%s : %s", resource.file_name, fullpath); sprintf(mess, "%s : %s", resource.file_name, fullpath);
@ -114,7 +113,6 @@ XlfdCB()
cs = XmStringConcat(cs2, cs1); cs = XmStringConcat(cs2, cs1);
XmStringFree(cs1); XmStringFree(cs1);
XmStringFree(cs2); XmStringFree(cs2);
n = 0;
XtSetArg (args[n], XmNtitle, resource.l_xlfd_title); n++; XtSetArg (args[n], XmNtitle, resource.l_xlfd_title); n++;
XtSetArg (args[n], XmNmessageString, cs); n++; XtSetArg (args[n], XmNmessageString, cs); n++;
XtSetArg (args[n], XmNdialogStyle, XmDIALOG_MODELESS); n++; XtSetArg (args[n], XmNdialogStyle, XmDIALOG_MODELESS); n++;
@ -126,7 +124,7 @@ XlfdCB()
} }
static void static void
CodeAreaCB() CodeAreaCB(void)
{ {
char mess[256]; char mess[256];
char tmp[16]; char tmp[16];
@ -169,16 +167,13 @@ CodeAreaCB()
} }
void void
ListSetLabelStr(i, str) ListSetLabelStr(int i, String str)
int i;
String str;
{ {
SetLabelString( wgeStaT_list[i], str ); SetLabelString( wgeStaT_list[i], str );
} }
void void
ListSelectItem(i) ListSelectItem(int i)
int i;
{ {
XtVaSetValues( wgeStaT_list[i], XtVaSetValues( wgeStaT_list[i],
XmNbackground, (XtArgVal) resource.foreground, XmNbackground, (XtArgVal) resource.foreground,
@ -188,8 +183,7 @@ int i;
} }
void void
ListUnselectItem(i) ListUnselectItem(int i)
int i;
{ {
XtVaSetValues( wgeStaT_list[i], XtVaSetValues( wgeStaT_list[i],
XmNbackground, (XtArgVal) resource.background, XmNbackground, (XtArgVal) resource.background,
@ -199,8 +193,7 @@ int i;
} }
void void
ListSetGlyphImage( i ) ListSetGlyphImage( int i )
int i ;
{ {
int code ; int code ;
@ -231,9 +224,7 @@ int i ;
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
EHStaT_disp( widget, i ) EHStaT_disp( Widget widget, int i /* widget that have some ivent */ )
Widget widget;
int i; /* widget that have some ivent */
{ {
ListSetGlyphImage( i ); ListSetGlyphImage( i );
} }
@ -307,7 +298,7 @@ static ExclusiveItems draw_ex[] = {
static Exclusive DrawEX = EXCLUSIVE( draw_ex ); static Exclusive DrawEX = EXCLUSIVE( draw_ex );
static void static void
Unset() Unset(void)
{ {
XtSetSensitive(EditBTN.w[0], False); XtSetSensitive(EditBTN.w[0], False);
XtSetSensitive(EditBTN.w[1], False); XtSetSensitive(EditBTN.w[1], False);
@ -322,7 +313,7 @@ Unset()
} }
void void
SelectSet() SelectSet(void)
{ {
XtSetSensitive(EditBTN.w[0], True); XtSetSensitive(EditBTN.w[0], True);
XtSetSensitive(EditBTN.w[1], True); XtSetSensitive(EditBTN.w[1], True);
@ -335,7 +326,7 @@ SelectSet()
} }
void void
SelectUnset() SelectUnset(void)
{ {
XtSetSensitive(EditBTN.w[0], False); XtSetSensitive(EditBTN.w[0], False);
XtSetSensitive(EditBTN.w[1], False); XtSetSensitive(EditBTN.w[1], False);
@ -348,19 +339,19 @@ SelectUnset()
} }
void void
CopySet() CopySet(void)
{ {
XtSetSensitive(EditBTN.w[5], True); XtSetSensitive(EditBTN.w[5], True);
} }
void void
UndoSet() UndoSet(void)
{ {
XtSetSensitive(EditBTN.w[9], True); XtSetSensitive(EditBTN.w[9], True);
} }
void void
UndoUnset() UndoUnset(void)
{ {
XtSetSensitive(EditBTN.w[9], False); XtSetSensitive(EditBTN.w[9], False);
} }
@ -371,8 +362,7 @@ UndoUnset()
**/ **/
void void
PopupEditPtn(owner) PopupEditPtn(Widget owner)
Widget owner;
{ {
if (! editPtnW){ if (! editPtnW){
editPtnW = CreateEditPtn(owner); editPtnW = CreateEditPtn(owner);
@ -382,8 +372,7 @@ Widget owner;
} }
static Widget static Widget
CreateEditPtn(owner) CreateEditPtn(Widget owner)
Widget owner;
{ {
int slimax; int slimax;
int i; int i;
@ -573,8 +562,7 @@ Widget owner;
void void
SetCodeString(code) SetCodeString(int code)
int code;
{ {
char str[8]; char str[8];
@ -590,7 +578,7 @@ int code;
static void static void
_create_editptn_after() _create_editptn_after(void)
{ {
int slctloc; int slctloc;
static char dashPtn[] = {1,1}; /* Editing pane's border pattern */ static char dashPtn[] = {1,1}; /* Editing pane's border pattern */
@ -667,8 +655,7 @@ _create_editptn_after()
} }
void void
UpdateMessage(str) UpdateMessage(String str)
String str;
{ {
static Boolean nomsg = False; static Boolean nomsg = False;

View file

@ -74,13 +74,12 @@ extern Resource resource ;
FalFontData fullFontData; FalFontData fullFontData;
void PopupSelectXLFD() ; void PopupSelectXLFD(Widget top) ;
static Widget CreateSelectXLFD() ; static Widget CreateSelectXLFD(Widget top) ;
extern void xlfdPopupDialog() ; extern void xlfdPopupDialog(Widget w);
extern int GetListsOfItems() ;
extern void ReadCB(); extern void ReadCB(Widget w, XtPointer client_data, XtPointer call_data);
Widget xlfdDialog; Widget xlfdDialog;
@ -122,10 +121,7 @@ static Widget *button4=NULL;
***************************************************************/ ***************************************************************/
static char * static char *
spc(str, ch, count) spc(char *str, char ch, int count)
char * str;
char ch;
int count;
{ {
char *p; char *p;
p = str + strlen(str); p = str + strlen(str);
@ -139,7 +135,7 @@ int count;
return(NULL); return(NULL);
} }
static void OpenWindowCB() static void OpenWindowCB(void)
{ {
char *str, *p; char *str, *p;
XmStringTable st; XmStringTable st;
@ -175,10 +171,7 @@ static void OpenWindowCB()
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
OpenCancelCB( widget, clientData, callData ) OpenCancelCB(Widget widget, caddr_t clientData, caddr_t callData)
Widget widget;
caddr_t clientData;
caddr_t callData;
{ {
extern void ForcePopdownDialog(); extern void ForcePopdownDialog();
if ( !editPtnW ){ if ( !editPtnW ){
@ -192,8 +185,7 @@ caddr_t callData;
* create selection window view * create selection window view
*/ */
void void
PopupSelectXLFD( top ) PopupSelectXLFD(Widget top)
Widget top ;
{ {
if( xlfdDialog == NULL ){ if( xlfdDialog == NULL ){
@ -207,7 +199,7 @@ Widget top ;
static void static void
create_xlfd() create_xlfd(void)
{ {
int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
FalFontData key; FalFontData key;
@ -253,8 +245,7 @@ create_xlfd()
} }
static void static void
udc_call(w) udc_call(Widget w)
Widget w;
{ {
XmString label; XmString label;
char *moji; char *moji;
@ -283,8 +274,7 @@ Widget w;
} }
static void static void
sty_call(w) sty_call(Widget w)
Widget w;
{ {
XmString label; XmString label;
char *moji; char *moji;
@ -308,8 +298,7 @@ Widget w;
} }
static void static void
wls_call(w) wls_call(Widget w)
Widget w;
{ {
XmString label; XmString label;
char *moji; char *moji;
@ -329,8 +318,7 @@ Widget w;
} }
static void static void
hls_call(w) hls_call(Widget w)
Widget w;
{ {
XmString label; XmString label;
char *moji; char *moji;
@ -350,7 +338,7 @@ Widget w;
} }
static void static void
button_set1() button_set1(void)
{ {
int i, j; int i, j;
int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
@ -399,7 +387,7 @@ button_set1()
} }
static void static void
button_set2() button_set2(void)
{ {
int i, j; int i, j;
int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
@ -448,7 +436,7 @@ button_set2()
} }
static void static void
button_set3() button_set3(void)
{ {
int i, j; int i, j;
int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
@ -497,7 +485,7 @@ button_set3()
} }
static void static void
button_set4() button_set4(void)
{ {
int i, j; int i, j;
int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
@ -546,9 +534,7 @@ button_set4()
} }
void void
data_sort(data, count) data_sort(int *data, int count)
int *data;
int count;
{ {
int *p1, *p2, tmp, i; int *p1, *p2, tmp, i;
@ -565,7 +551,7 @@ int count;
static void static void
font_init() font_init(void)
{ {
FalFontDataList *fontlist; FalFontDataList *fontlist;
FalFontData *f; FalFontData *f;
@ -704,8 +690,7 @@ font_init()
static Widget static Widget
CreateSelectXLFD( top ) CreateSelectXLFD(Widget top)
Widget top ;
{ {
int n; int n;

View file

@ -41,8 +41,6 @@
#define XLFD_COLUMNS 38 #define XLFD_COLUMNS 38
#define KEY_COLUMNS 15 #define KEY_COLUMNS 15
#define PIXELSIZE 7
/* /*
* put data from resource database * put data from resource database
*/ */

View file

@ -30,10 +30,8 @@
*/ */
#define substance_source
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <math.h> #include <math.h>
#include <X11/Intrinsic.h> #include <X11/Intrinsic.h>
@ -41,26 +39,11 @@
#include "xoakufont.h" #include "xoakufont.h"
#include "util.h" #include "util.h"
#ifndef NO_MESSAGE_CAT
#ifdef __ultrix
#define _CLIENT_CAT_NAME "dtudcfonted.cat"
#else /* __ultrix */
#define _CLIENT_CAT_NAME "dtudcfonted" #define _CLIENT_CAT_NAME "dtudcfonted"
#endif /* __ultrix */ extern char *_DtGetMessage(char *filename, int set, int n, char *s);
#ifdef _NO_PROTO
extern char *_DtGetMessage();
#else /* _NO_PROTO */
extern char *_DtGetMessage(
char *filename,
int set,
int n,
char *s );
#endif /* _NO_PROTO */
#define GETMESSAGE(set, number, string) GetMessage(set, number, string) #define GETMESSAGE(set, number, string) GetMessage(set, number, string)
static char * static char *
GetMessage(set, number, string) GetMessage(int set, int number, char *string)
int set, number;
char *string;
{ {
char *tmp, *ret; char *tmp, *ret;
tmp = _DtGetMessage(_CLIENT_CAT_NAME, set, number, string); tmp = _DtGetMessage(_CLIENT_CAT_NAME, set, number, string);
@ -68,73 +51,72 @@ char *string;
strcpy(ret, tmp); strcpy(ret, tmp);
return (ret); return (ret);
} }
#else /* NO_MESSAGE_CAT */
#define GETMESSAGE(set, number, string)\
string
#endif /* NO_MESSAGE_CAT */
/**************************************************************** /****************************************************************
* Widgets * * Widgets *
***************************************************************/ ***************************************************************/
/* Widget toplevel; */ Widget toplevel;
static Widget dnPopW; static Widget dnPopW;
Widget wgeScro, editPopW; Widget wgeScro, editPopW;
static int select_x, select_y, select_w, select_h; static int select_x, select_y, select_w, select_h;
static int r1_x, r1_y, r2_x, r2_y, cut_w, cut_h; static int r1_x, r1_y, r2_x, r2_y, cut_w, cut_h;
extern Widget xlfdDialog, cpyDialog ; extern Widget xlfdDialog, cpyDialog;
extern FalFontID font_id; extern FalFontID font_id;
Pixmap arrow_pix=0; Pixmap arrow_pix=0;
/*
*
*/
static XtAppContext app; /* application context */ static XtAppContext app; /* application context */
static int edpane_size=0; static int edpane_size=0;
void CB_set_wait_msg();
void set_wait_msg();
static void OtherFontSelect(); static void OtherFontSelect(void);
void drawDelCode(); void drawDelCode(int i);
void drawDelPtn(); void drawDelPtn(int i);
static void xeg_init(); static void xeg_init(void);
static void dstrypaneEditPtn(); static void dstrypaneEditPtn(void);
void chgEdCode(); void chgEdCode(int code, char mode);
void chgEdList(); void chgEdList(int statloc, int slctloc, char mode);
static void chgEdPtn(); static void chgEdPtn(int code);
static void DrawRectEdPn(); static void DrawRectEdPn(int x1, int y1, int x2, int y2);
static void DrawBorderEdPn(); static void DrawBorderEdPn(int x1, int y1, int x2, int y2);
static void DrawPointEdPn(); static void DrawPointEdPn(int x, int y, int mode);
static void DrawDpPn(); static void DrawDpPn(void);
static void DrawPointDpPn(); static void DrawPointDpPn(int x, int y, int mode);
static void musPoint(); static void musPoint(int evtype, int px, int py);
static void musLine(); static void musLine(int evtype, int px, int py);
static void musCircle(); static void musCircle(int evtype, int px, int py);
static void musRect(); static void musRect(int proc, int evtype, int px, int py);
static void musRegionProc(); static void musRegionProc(int proc, int evtype, int px, int py);
static void musPasteProc(); static void musPasteProc(Widget w, XtPointer client_data, XEvent *event);
static void rubLine(); static void rubLine(int x1, int y1, int x2, int y2);
static void rubBand(); static void rubBand(int x1, int y1, int x2, int y2);
static void rubCircle(); static void rubCircle(int ox, int oy, int rx, int ry);
static void resetEditMode(); static void resetEditMode(unsigned int flag);
static void copyPatterns(); static void copyPatterns(FalFontData *fdata,
extern String MngCodeTfValue(); int s1_code,
extern String CpySrcCodeTfValue(); int s2_code,
extern String CpyDestCodeTfValue(); int d1_code,
char *get_cmd_path() ; int proc);
extern String MngCodeTfValue(void);
extern String CpySrcCodeTfValue(void);
extern String CpyDestCodeTfValue(void);
char *get_cmd_path(char *path, char *cmd);
extern FalFontData fullFontData; extern FalFontData fullFontData;
extern FalFontData copyFontData; extern FalFontData copyFontData;
extern void PopupSelectXLFD(); extern void PopupSelectXLFD(Widget top);
extern void UpdateMessage(); extern void UpdateMessage(String str);
extern void DispMngErrorMessage(); extern void DispMngErrorMessage(String msg);
extern void DispCpyErrorMessage(); extern void DispCpyErrorMessage(String msg);
static int setRealDelArea(); static int setRealDelArea(int *s_ncode,
int *e_ncode,
int *sq_start,
int *sq_end);
/**************************************************************** /****************************************************************
* parameters * * parameters *
@ -148,16 +130,16 @@ Resource resource;
* callback routines * * callback routines *
***************************************************************/ ***************************************************************/
static void CancelCB(); static void CancelCB(void);
static void static void
ExitCB() ExitCB(void)
{ {
exit(0); exit(0);
} }
int int
efctPtnNum() efctPtnNum(void)
{ {
int no; int no;
int sq; int sq;
@ -173,9 +155,7 @@ efctPtnNum()
} }
void void
Error_message(widget, message) Error_message(Widget widget, char *message)
Widget widget;
char *message;
{ {
static NoticeButton is_lock[] = { static NoticeButton is_lock[] = {
NBTNARGS( ExitCB, NULL, 'E', True, False ), NBTNARGS( ExitCB, NULL, 'E', True, False ),
@ -193,9 +173,7 @@ char *message;
} }
void void
Error_message2(widget, message) Error_message2(Widget widget, char *message)
Widget widget;
char *message;
{ {
static NoticeButton is_lock[] = { static NoticeButton is_lock[] = {
NBTNARGS( CancelCB, NULL, 'C', True, True ) NBTNARGS( CancelCB, NULL, 'C', True, True )
@ -218,10 +196,7 @@ char *message;
*/ */
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
CBmOblB_edit( widget, clientData, callData ) CBmOblB_edit( Widget widget, caddr_t clientData, caddr_t callData )
Widget widget;
caddr_t clientData;
caddr_t callData;
{ {
int ptn_n; int ptn_n;
int ptn_w; int ptn_w;
@ -250,7 +225,6 @@ caddr_t callData;
if( xlfdDialog != NULL ) if( xlfdDialog != NULL )
PopdownDialog(xlfdDialog); PopdownDialog(xlfdDialog);
/* */
ptnGetInfo( &ptn_n, &ptn_w, &ptn_h ); ptnGetInfo( &ptn_n, &ptn_w, &ptn_h );
for( i=0 ; i<ptn_n ; i++ ) { for( i=0 ; i<ptn_n ; i++ ) {
code = noToCode( ptnSqToNo(i) ); code = noToCode( ptnSqToNo(i) );
@ -274,15 +248,14 @@ caddr_t callData;
void CBeOblB_aAdd(); void CBeOblB_aAdd(void);
static Boolean do_read = False; static Boolean do_read = False;
static Boolean do_end = False; static Boolean do_end = False;
static void CancelCB() { } static void CancelCB(void) { }
static void ContReadCB(w) static void ContReadCB(Widget w)
Widget w;
{ {
FalCloseFont(font_id); FalCloseFont(font_id);
editPtnW = NULL; editPtnW = NULL;
@ -290,7 +263,7 @@ Widget w;
PopupSelectXLFD(toplevel); PopupSelectXLFD(toplevel);
} }
static void SaveReadCB() static void SaveReadCB(void)
{ {
CBeOblB_aAdd(); CBeOblB_aAdd();
do_read = True; do_read = True;
@ -298,13 +271,13 @@ static void SaveReadCB()
} }
static void ContEndCB() static void ContEndCB(void)
{ {
FalCloseFont(font_id); FalCloseFont(font_id);
exit(0); exit(0);
} }
static void SaveEndCB() static void SaveEndCB(void)
{ {
CBeOblB_aAdd(); CBeOblB_aAdd();
do_end = True; do_end = True;
@ -318,10 +291,7 @@ static void SaveEndCB()
/*ARGSUSED*/ /*ARGSUSED*/
static int static int
QuitEditPtn( widget, clientData, callData ) QuitEditPtn( Widget widget, caddr_t clientData, caddr_t callData )
Widget widget;
caddr_t clientData;
caddr_t callData;
{ {
resetEditMode( RES_MSG | RES_PROC | RES_SLCT | RES_RSV ); resetEditMode( RES_MSG | RES_PROC | RES_SLCT | RES_RSV );
@ -337,10 +307,7 @@ caddr_t callData;
void void
OpenCB(w, client_data, call_data) OpenCB(Widget w, XtPointer client_data, XtPointer call_data)
Widget w;
XtPointer client_data;
XtPointer call_data;
{ {
static NoticeButton is_save_read_btn1[] = { static NoticeButton is_save_read_btn1[] = {
NBTNARGS( SaveReadCB, NULL, 'S', True, False ), NBTNARGS( SaveReadCB, NULL, 'S', True, False ),
@ -384,10 +351,7 @@ XtPointer call_data;
void void
ReadCB(w, client_data, call_data) ReadCB(Widget w, XtPointer client_data, XtPointer call_data)
Widget w;
XtPointer client_data;
XtPointer call_data;
{ {
if (fullFontData.xlfdname == NULL) { if (fullFontData.xlfdname == NULL) {
return; return;
@ -408,8 +372,7 @@ XtPointer call_data;
*/ */
static Boolean static Boolean
WPwriteSNF( restart ) WPwriteSNF( int restart )
int restart;
{ {
int rc, err; int rc, err;
char str[MG_MAXSIZE]; char str[MG_MAXSIZE];
@ -440,7 +403,7 @@ int restart;
default: default:
sprintf(str, "%s", resource.me_write_snf); sprintf(str, "%s", resource.me_write_snf);
} }
SetString( wgeStaT, str ); UpdateMessage( str );
return( TRUE ); return( TRUE );
case 0: case 0:
edg.flag = 0; edg.flag = 0;
@ -463,7 +426,7 @@ int restart;
else else
sprintf( str, "%s(%3d%%)", resource.mg_write_snf , rc-1000 ); sprintf( str, "%s(%3d%%)", resource.mg_write_snf , rc-1000 );
SetString( wgeStaT, str ); UpdateMessage( str );
XtAppAddWorkProc( app, (XtWorkProc)WPwriteSNF, (XtPointer)ON ); XtAppAddWorkProc( app, (XtWorkProc)WPwriteSNF, (XtPointer)ON );
if( rc == 1101 ){ if( rc == 1101 ){
XSync( xl.display,0 ); XSync( xl.display,0 );
@ -479,12 +442,12 @@ int restart;
*/ */
void void
CBeOblB_aAdd() CBeOblB_aAdd(void)
{ {
char str[MG_MAXSIZE]; char str[MG_MAXSIZE];
resetEditMode( RES_MSG | RES_PROC | RES_SLCT | RES_RSV ); resetEditMode( RES_MSG | RES_PROC | RES_SLCT | RES_RSV );
SetString( wgeStaT, resource.mg_write_snf ); UpdateMessage( resource.mg_write_snf );
if( edg.code != 0 ) if( edg.code != 0 )
ptnAdd( edg.code, edg.ptn ); ptnAdd( edg.code, edg.ptn );
@ -498,7 +461,7 @@ CBeOblB_aAdd()
return; return;
} }
else{ else{
SetString( wgeStaT, "" ); UpdateMessage( "" );
} }
} }
@ -509,7 +472,7 @@ CBeOblB_aAdd()
*/ */
static void static void
OtherFontSelect() OtherFontSelect(void)
{ {
dstrypaneEditPtn(); dstrypaneEditPtn();
xeg_init(); xeg_init();
@ -523,10 +486,7 @@ OtherFontSelect()
/*ARGSUSED*/ /*ARGSUSED*/
void void
CBeOblB_aEnd( widget, clientData, callData ) CBeOblB_aEnd( Widget widget, caddr_t clientData, caddr_t callData )
Widget widget;
caddr_t clientData;
caddr_t callData;
{ {
static NoticeButton is_save_exit_btn[] = { static NoticeButton is_save_exit_btn[] = {
NBTNARGS( SaveEndCB, NULL, 'S', True, False ), NBTNARGS( SaveEndCB, NULL, 'S', True, False ),
@ -558,10 +518,7 @@ caddr_t callData;
/*ARGSUSED*/ /*ARGSUSED*/
void void
CBeOblB_rCmd( widget, proc, callData ) CBeOblB_rCmd( Widget widget, int proc, caddr_t callData )
Widget widget;
int proc;
caddr_t callData;
{ {
extern void SelectUnset(); extern void SelectUnset();
extern void UndoSet(); extern void UndoSet();
@ -600,10 +557,7 @@ caddr_t callData;
/*ARGSUSED*/ /*ARGSUSED*/
void void
CBeOblB_rCmdp( widget, proc, callData ) CBeOblB_rCmdp( Widget widget, int proc, caddr_t callData )
Widget widget;
int proc;
caddr_t callData;
{ {
extern Widget wgeBulB_edit; extern Widget wgeBulB_edit;
extern void CopySet(); extern void CopySet();
@ -655,10 +609,7 @@ caddr_t callData;
/*ARGSUSED*/ /*ARGSUSED*/
void void
CBeOblB_rCan( widget, clientData, callData ) CBeOblB_rCan( Widget widget, caddr_t clientData, caddr_t callData )
Widget widget;
caddr_t clientData;
caddr_t callData;
{ {
extern void UndoUnset(); extern void UndoUnset();
@ -682,9 +633,7 @@ caddr_t callData;
* contents : get a sequential number of the editor * contents : get a sequential number of the editor
*/ */
int int
RelToAbsSq( from, cnt) RelToAbsSq( int from, int cnt)
int from;
int cnt;
{ {
int i; int i;
int no; int no;
@ -716,9 +665,7 @@ int cnt;
* contents : get a relative number of the system area * contents : get a relative number of the system area
*/ */
int int
AbsSqToRel( from, to) AbsSqToRel( int from, int to)
int from;
int to;
{ {
int sq; int sq;
int cnt; int cnt;
@ -746,18 +693,13 @@ int to;
} }
/* /*
* contents : be the character list selected * contents : be the character list selected
*/ */
/*ARGSUSED*/ /*ARGSUSED*/
void void
EHeStaT_list( widget, select, e ) EHeStaT_list( Widget widget, int select, XEvent *e )
Widget widget;
int select;
XEvent *e; /* X Event */
{ {
int sq, no; int sq, no;
int code; int code;
@ -773,7 +715,6 @@ XEvent *e; /* X Event */
if( edlist.slctloc == select ) if( edlist.slctloc == select )
return; return;
/* */
sq = RelToAbsSq( edlist.sqstart + edlist.statloc, select); sq = RelToAbsSq( edlist.sqstart + edlist.statloc, select);
if( (no = ptnSqToNo(sq)) == -1 ) if( (no = ptnSqToNo(sq)) == -1 )
@ -801,10 +742,7 @@ XEvent *e; /* X Event */
/*ARGSUSED*/ /*ARGSUSED*/
void void
CBeScro( widget, clientData, callData ) CBeScro( Widget widget, caddr_t clientData, caddr_t callData )
Widget widget;
caddr_t clientData;
caddr_t callData;
{ {
int newl; int newl;
int new_statloc; int new_statloc;
@ -836,10 +774,7 @@ caddr_t callData;
/*ARGSUSED*/ /*ARGSUSED*/
void void
EHeBulB_eMEv( widget, clientData, e ) EHeBulB_eMEv( Widget widget, caddr_t clientData, XEvent *e )
Widget widget;
caddr_t clientData;
XEvent *e; /* X Event */
{ {
int px, py; int px, py;
int downbutton; int downbutton;
@ -945,10 +880,7 @@ XEvent *e; /* X Event */
/*ARGSUSED*/ /*ARGSUSED*/
void void
EHeBulB_eExp( widget, clientData, e ) EHeBulB_eExp( Widget widget, caddr_t clientData, XEvent *e )
Widget widget;
caddr_t clientData;
XEvent *e; /* X Event */
{ {
int x1, y1; int x1, y1;
int x2, y2; int x2, y2;
@ -975,10 +907,7 @@ XEvent *e; /* X Event */
/*ARGSUSED*/ /*ARGSUSED*/
void void
CBeRecB_obj( widget, obj, call) CBeRecB_obj( Widget widget, int obj, XmToggleButtonCallbackStruct *call)
Widget widget;
int obj;
XmToggleButtonCallbackStruct *call;
{ {
extern void SelectUnset(); extern void SelectUnset();
@ -1011,9 +940,7 @@ XmToggleButtonCallbackStruct *call;
/*ARGSUSED*/ /*ARGSUSED*/
void void
EHeBulB_dExp( widget, clientData ) EHeBulB_dExp( Widget widget, caddr_t clientData )
Widget widget;
caddr_t clientData;
{ {
if (xl.display == NULL ){ if (xl.display == NULL ){
return; return;
@ -1027,9 +954,7 @@ caddr_t clientData;
*/ */
static int static int
codeAreaSet(s_code,e_code) codeAreaSet(int *s_code, int *e_code)
int *s_code;
int *e_code;
{ {
char *str; char *str;
char delm; char delm;
@ -1065,9 +990,7 @@ int *e_code;
***************************************************************/ ***************************************************************/
Boolean Boolean
BeforeMngCheck(s_code, e_code) BeforeMngCheck(int *s_code, int *e_code)
int *s_code;
int *e_code;
{ {
if(codeAreaSet(s_code, e_code) == -1) { if(codeAreaSet(s_code, e_code) == -1) {
DispMngErrorMessage( resource.me_illegal_code ); DispMngErrorMessage( resource.me_illegal_code );
@ -1077,9 +1000,7 @@ int *e_code;
} }
void void
DoAddProc(s_code, e_code) DoAddProc(int s_code, int e_code)
int s_code;
int e_code;
{ {
int code; int code;
@ -1091,7 +1012,6 @@ int e_code;
resetEditMode( RES_MSG | RES_PROC | RES_SLCT | RES_RSV ); resetEditMode( RES_MSG | RES_PROC | RES_SLCT | RES_RSV );
/* */
s_ncode = codeToNo( s_code ); s_ncode = codeToNo( s_code );
e_ncode = codeToNo( e_code ); e_ncode = codeToNo( e_code );
mode = OFF; mode = OFF;
@ -1102,7 +1022,7 @@ int e_code;
continue; continue;
if (ptnSense(code) == 0) { if (ptnSense(code) == 0) {
if(ptnAdd(code, ptn) != 1) { if(ptnAdd(code, ptn) != 1) {
SetString( wgeStaT, resource.me_non_memory ); UpdateMessage( resource.me_non_memory );
return; return;
} }
edg.flag = ON; edg.flag = ON;
@ -1111,11 +1031,10 @@ int e_code;
} }
} }
/* */
if( ptnSense( edg.code ) == 1 ) { if( ptnSense( edg.code ) == 1 ) {
ptnAdd( edg.code, edg.ptn ); ptnAdd( edg.code, edg.ptn );
} }
/* */
if(mode == ON) { if(mode == ON) {
chgEdCode( s_code, mode ); chgEdCode( s_code, mode );
} }
@ -1130,9 +1049,7 @@ Widget CreateDelNotice();
void void
DoDelProc( s_code, e_code ) DoDelProc( int s_code, int e_code )
int s_code;
int e_code;
{ {
resetEditMode( RES_MSG | RES_PROC | RES_SLCT | RES_RSV ); resetEditMode( RES_MSG | RES_PROC | RES_SLCT | RES_RSV );
@ -1163,9 +1080,7 @@ int e_code;
static int static int
setRealDelArea(s_ncode, e_ncode, sq_start, sq_end ) setRealDelArea(int *s_ncode, int *e_ncode, int *sq_start, int *sq_end )
int *s_ncode, *e_ncode;
int *sq_start, *sq_end;
{ {
int ncode; int ncode;
int flg; int flg;
@ -1212,7 +1127,7 @@ int *sq_start, *sq_end;
****************************************************************/ ****************************************************************/
static int static int
CpySrcCodeCheck() CpySrcCodeCheck(void)
{ {
char *str; char *str;
char delm; char delm;
@ -1244,7 +1159,7 @@ CpySrcCodeCheck()
} }
static int static int
CpyDestCodeCheck() CpyDestCodeCheck(void)
{ {
char *str; char *str;
@ -1266,8 +1181,7 @@ CpyDestCodeCheck()
} }
Boolean Boolean
BeforeCpyCheck( proc ) BeforeCpyCheck( int proc )
int proc;
{ {
int s_ncode, e_ncode; int s_ncode, e_ncode;
int r1_code, r2_code; int r1_code, r2_code;
@ -1321,7 +1235,7 @@ int proc;
} }
void void
DoCpyProc() DoCpyProc(void)
{ {
extern void PopdownCpyPtn(); extern void PopdownCpyPtn();
@ -1452,24 +1366,20 @@ int CodePoint = False;
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
xerror(d, ev) xerror(Display *d, XErrorEvent *ev)
Display *d;
register XErrorEvent *ev;
{ {
fprintf (stderr, "dtudcfonted: warning, error event receieved.\n"); fprintf (stderr, "dtudcfonted: warning, error event receieved.\n");
exit(-1); exit(-1);
} }
int int
main(argc, argv) main(int argc, char *argv[])
int argc;
char *argv[];
{ {
static char class_name[] = "Dtudcfonted"; static char class_name[] = "Dtudcfonted";
int i; int i;
/* initialize GUI */ /* initialize GUI */
toplevel = (Widget)GuiInitialize(&app, class_name, &argc, argv); toplevel = GuiInitialize(&app, class_name, &argc, argv);
/* get application's resources */ /* get application's resources */
XtGetApplicationResources( toplevel, &resource, XtGetApplicationResources( toplevel, &resource,
@ -1639,7 +1549,7 @@ char *argv[];
*/ */
static void static void
xeg_init() xeg_init(void)
{ {
int i; int i;
@ -1718,7 +1628,7 @@ xeg_init()
*/ */
static void static void
dstrypaneEditPtn() dstrypaneEditPtn(void)
{ {
int i ; int i ;
@ -1753,9 +1663,7 @@ dstrypaneEditPtn()
*/ */
void void
chgEdCode( code, mode ) chgEdCode( int code, char mode )
int code;
char mode;
{ {
int ncode; int ncode;
int esq; int esq;
@ -1809,10 +1717,7 @@ char mode;
*/ */
void void
chgEdList( statloc, slctloc, mode ) chgEdList( int statloc, int slctloc, char mode )
int statloc;
int slctloc;
char mode;
{ {
int sq; int sq;
int i; int i;
@ -1862,8 +1767,7 @@ char mode;
*/ */
static void static void
chgEdPtn( code ) chgEdPtn( int code )
int code;
{ {
extern void SetCodeString(); extern void SetCodeString();
@ -1906,11 +1810,7 @@ int code;
*/ */
static void static void
DrawRectEdPn( x1, y1, x2, y2 ) DrawRectEdPn( int x1, int y1, int x2, int y2 )
int x1;
int y1;
int x2;
int y2;
{ {
int i, j, wk; int i, j, wk;
short cx1, cy1, cx2, cy2; short cx1, cy1, cx2, cy2;
@ -1944,15 +1844,15 @@ int y2;
if( bitRead( edg.ptn, i, j ) != 0 ) { if( bitRead( edg.ptn, i, j ) != 0 ) {
recOn[nron].x = cx1; recOn[nron].x = cx1;
recOn[nron].y = cy1; recOn[nron].y = cy1;
recOn[nron].width = (USHORT)(cx2 - cx1); recOn[nron].width = (unsigned short)(cx2 - cx1);
recOn[nron].height = (USHORT)(cy2 - cy1); recOn[nron].height = (unsigned short)(cy2 - cy1);
nron++; nron++;
} }
else { else {
recOff[nroff].x = cx1; recOff[nroff].x = cx1;
recOff[nroff].y = cy1; recOff[nroff].y = cy1;
recOff[nroff].width = (USHORT)(cx2 - cx1); recOff[nroff].width = (unsigned short)(cx2 - cx1);
recOff[nroff].height = (USHORT)(cy2 - cy1); recOff[nroff].height = (unsigned short)(cy2 - cy1);
nroff++; nroff++;
} }
} }
@ -1969,11 +1869,7 @@ int y2;
*/ */
static void static void
DrawBorderEdPn( x1, y1, x2, y2 ) DrawBorderEdPn( int x1, int y1, int x2, int y2 )
int x1;
int y1;
int x2;
int y2;
{ {
short cx1, cy1; short cx1, cy1;
short cx2, cy2; short cx2, cy2;
@ -2030,10 +1926,7 @@ int y2;
*/ */
static void static void
DrawPointEdPn( x, y, mode ) DrawPointEdPn( int x, int y, int mode )
int x;
int y;
int mode;
{ {
int x1, y1; int x1, y1;
int x2, y2; int x2, y2;
@ -2063,7 +1956,7 @@ int mode;
*/ */
static void static void
DrawDpPn() DrawDpPn(void)
{ {
if (xl.display == NULL ){ if (xl.display == NULL ){
return; return;
@ -2084,10 +1977,7 @@ DrawDpPn()
*/ */
static void static void
DrawPointDpPn( x, y, mode ) DrawPointDpPn( int x, int y, int mode )
int x;
int y;
int mode;
{ {
if (xl.display == NULL ){ if (xl.display == NULL ){
@ -2116,10 +2006,7 @@ int mode;
*/ */
static void static void
musPoint( evtype, px, py ) musPoint( int evtype, int px, int py )
int evtype;
int px;
int py;
{ {
switch( evtype ) { switch( evtype ) {
case MotionNotify: case MotionNotify:
@ -2149,10 +2036,7 @@ int py;
*/ */
static void static void
musLine( evtype, px, py ) musLine( int evtype, int px, int py )
int evtype;
int px;
int py;
{ {
int r1_x, r1_y; int r1_x, r1_y;
int r2_x, r2_y; int r2_x, r2_y;
@ -2206,10 +2090,7 @@ int py;
*/ */
static void static void
musCircle( evtype, px, py ) musCircle( int evtype, int px, int py )
int evtype;
int px;
int py;
{ {
int r1_x, r1_y; int r1_x, r1_y;
int r2_x, r2_y; int r2_x, r2_y;
@ -2265,11 +2146,7 @@ int py;
*/ */
static void static void
musRect( proc, evtype, px, py ) musRect( int proc, int evtype, int px, int py )
int proc;
int evtype;
int px;
int py;
{ {
int r1_x, r1_y; int r1_x, r1_y;
int r2_x, r2_y; int r2_x, r2_y;
@ -2338,11 +2215,7 @@ int py;
*/ */
static void static void
musRegionProc( proc, evtype, px, py ) musRegionProc( int proc, int evtype, int px, int py )
int proc;
int evtype;
int px;
int py;
{ {
int rx, ry; int rx, ry;
int dpx, dpy, dp; int dpx, dpy, dp;
@ -2407,10 +2280,7 @@ int py;
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
musPasteProc(w, client_data, event) musPasteProc(Widget w, XtPointer client_data, XEvent *event)
Widget w;
XtPointer client_data;
XEvent *event;
{ {
static int ox=0, oy=0; static int ox=0, oy=0;
int rc, tx, ty; int rc, tx, ty;
@ -2451,19 +2321,13 @@ XEvent *event;
DrawDpPn(); DrawDpPn();
UndoSet(); UndoSet();
break; break;
defaults:
break;
} }
} }
static void static void
rubLine( x1, y1, x2, y2 ) rubLine( int x1, int y1, int x2, int y2 )
int x1;
int y1;
int x2;
int y2;
{ {
if( x1==x2 && y1==y2 ) return; if( x1==x2 && y1==y2 ) return;
@ -2473,11 +2337,7 @@ int y2;
static void static void
rubBand( x1, y1, x2, y2 ) rubBand( int x1, int y1, int x2, int y2 )
int x1;
int y1;
int x2;
int y2;
{ {
if( x1==x2 && y1==y2 ) if( x1==x2 && y1==y2 )
return; return;
@ -2491,11 +2351,7 @@ int y2;
static void static void
rubCircle( ox, oy, rx, ry ) rubCircle( int ox, int oy, int rx, int ry )
int ox;
int oy;
int rx;
int ry;
{ {
unsigned int r; unsigned int r;
int x, y; int x, y;
@ -2518,14 +2374,13 @@ int ry;
static void static void
resetEditMode( flag ) resetEditMode( unsigned int flag )
UINT flag;
{ {
int r1_x, r1_y; int r1_x, r1_y;
int r2_x, r2_y; int r2_x, r2_y;
if( flag & RES_MSG ) if( flag & RES_MSG )
SetString( wgeStaT, "" ); UpdateMessage( "" );
if( flag & RES_PROC ) if( flag & RES_PROC )
em.proc = edpane.obj; em.proc = edpane.obj;
@ -2554,12 +2409,12 @@ UINT flag;
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
copyPatterns( fdata, s1_code, s2_code, d1_code, proc ) copyPatterns(
FalFontData *fdata; FalFontData *fdata,
int s1_code; int s1_code,
int s2_code; int s2_code,
int d1_code; int d1_code,
int proc; int proc)
{ {
int ret; int ret;
int d1_ncode, d2_ncode; int d1_ncode, d2_ncode;
@ -2605,7 +2460,7 @@ int proc;
edg.flag = ON; edg.flag = ON;
} else { } else {
if( ptnAdd( code_d, ptn[i_s] ) != 1 ) { if( ptnAdd( code_d, ptn[i_s] ) != 1 ) {
SetString( wgeStaT, resource.me_non_memory ); UpdateMessage( resource.me_non_memory );
break; break;
} }
edlist.nptn++; edlist.nptn++;
@ -2631,5 +2486,5 @@ int proc;
chgEdCode( code_disp, ON ); chgEdCode( code_disp, ON );
resetEditMode( (UINT) (RES_MSG | RES_PROC | RES_SLCT | RES_RSV) ); resetEditMode( (unsigned int) (RES_MSG | RES_PROC | RES_SLCT | RES_RSV) );
} }

View file

@ -43,8 +43,8 @@
#include "FaLib.h" #include "FaLib.h"
extern Widget toplevel; extern Widget toplevel;
static void _destroy(); static void _destroy(Widget w);
void _unmap(); void _unmap(void);
extern Resource resource ; extern Resource resource ;
@ -67,19 +67,18 @@ extern Resource resource ;
/*ARGSUSED*/ /*ARGSUSED*/
Widget Widget
CreateCaptionFrame(owner, name, labelstr, type, thickness) CreateCaptionFrame(
Widget owner; Widget owner,
String name; String name,
String labelstr; String labelstr,
int type; int type,
int thickness; int thickness)
{ {
Widget top, label, frame; Widget top, label, frame;
Arg args[20]; Arg args[20];
int n; int n = 0;
XmString xmstr; XmString xmstr;
n = 0;
top = XmCreateForm(owner, "form", args, n); top = XmCreateForm(owner, "form", args, n);
if (labelstr && *labelstr){ if (labelstr && *labelstr){
xmstr = XmStringCreateLocalized(labelstr); xmstr = XmStringCreateLocalized(labelstr);
@ -120,24 +119,22 @@ int thickness;
*/ */
Widget Widget
CreatePixButton(owner, name, data) CreatePixButton(
Widget owner; Widget owner,
String name; String name,
RadioButt *data; RadioButt *data)
{ {
Arg args[20]; Arg args[20];
int i, n; int i, n = 0;
Pixmap mask; Pixmap mask;
XpmAttributes attr; XpmAttributes attr;
Pixmap pix[NUMPIX]; Pixmap pix[NUMPIX];
Widget top; Widget top;
Display *disp; Display *disp;
Window root; Window root = DefaultRootWindow(disp);
disp = XtDisplay(owner); disp = XtDisplay(owner);
root = DefaultRootWindow(disp);
n = 0;
XtSetArg(args[n], XmNborderWidth, 1); n++; XtSetArg(args[n], XmNborderWidth, 1); n++;
XtSetArg(args[n], XmNradioAlwaysOne, TRUE); n++; XtSetArg(args[n], XmNradioAlwaysOne, TRUE); n++;
XtSetArg(args[n], XmNradioBehavior, TRUE); n++; XtSetArg(args[n], XmNradioBehavior, TRUE); n++;
@ -183,8 +180,7 @@ String
#else #else
XtPointer XtPointer
#endif #endif
GetTextFieldValue(textf) GetTextFieldValue(TextField *textf)
TextField *textf;
{ {
char *s1, *s2, *s3; char *s1, *s2, *s3;
if (textf->w2 == NULL) { if (textf->w2 == NULL) {
@ -210,8 +206,7 @@ TextField *textf;
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
arrow_change(w, data) arrow_change(int w, TextField *data)
TextField *data;
{ {
if (XtIsSensitive(data->w2)) { if (XtIsSensitive(data->w2)) {
XtSetSensitive(data->w2, False); XtSetSensitive(data->w2, False);
@ -225,14 +220,13 @@ extern char AreaStr[160];
extern FalFontData fullFontData; extern FalFontData fullFontData;
static void static void
focus(w) focus(Widget w)
Widget w;
{ {
focus_widget = w; focus_widget = w;
} }
static void static void
code_input() code_input(void)
{ {
extern void CodeWindow(); extern void CodeWindow();
CodeWindow(focus_widget, fullFontData.xlfdname, False); CodeWindow(focus_widget, fullFontData.xlfdname, False);
@ -240,16 +234,16 @@ code_input()
/*ARGSUSED*/ /*ARGSUSED*/
void void
CreateTextField(owner, name, labelstr, data, maxlength) CreateTextField(
Widget owner; Widget owner,
String name; String name,
String labelstr; String labelstr,
TextField *data; TextField *data,
int maxlength; int maxlength)
{ {
Widget row, label, arrow, textfield, code; Widget row, label, arrow, textfield, code;
Arg args[20]; Arg args[20];
register int n; int n = 0;
Display *disp; Display *disp;
Window root; Window root;
Pixmap mask; Pixmap mask;
@ -257,7 +251,6 @@ int maxlength;
XmString xms; XmString xms;
extern Pixmap arrow_pix; extern Pixmap arrow_pix;
n = 0;
XtSetArg(args[n], XmNorientation, (XtArgVal)XmHORIZONTAL); n++; XtSetArg(args[n], XmNorientation, (XtArgVal)XmHORIZONTAL); n++;
row = XmCreateRowColumn(owner, "row", args, n); row = XmCreateRowColumn(owner, "row", args, n);
XtManageChild(row); XtManageChild(row);
@ -318,14 +311,7 @@ int maxlength;
void void
#if __STDC__
CreateMenuButtons( Widget owner, Button *buttons, int buttons_cnt ) CreateMenuButtons( Widget owner, Button *buttons, int buttons_cnt )
#else
CreateMenuButtons( owner, buttons, buttons_cnt )
Widget owner;
Button *buttons;
int buttons_cnt;
#endif
{ {
Arg args[4]; Arg args[4];
char buf[64]; char buf[64];
@ -374,7 +360,7 @@ int buttons_cnt;
} }
static Atom static Atom
DeleteWindowAtom() DeleteWindowAtom(void)
{ {
static Atom delatom = 0; static Atom delatom = 0;
if (! delatom){ if (! delatom){
@ -386,26 +372,20 @@ DeleteWindowAtom()
/*ARGSUSED*/ /*ARGSUSED*/
Widget Widget
#if __STDC__ CreateDialogAndButtons(
CreateDialogAndButtons( Widget owner, String name, Widget owner,
void (*delcb)(), Button *btns, int btns_cnt, Widget *pop ) String name,
#else void (*delcb)(),
CreateDialogAndButtons( owner, name, delcb, btns, btns_cnt, pop ) Button *btns,
Widget owner; int btns_cnt,
String name; Widget *pop)
void (*delcb)();
Button *btns;
int btns_cnt;
Widget *pop;
#endif
{ {
int n; int n = 0;
Arg args[32]; Arg args[32];
Arg arg[8]; Arg arg[8];
Widget rowcol; Widget rowcol;
XmString cs1, cs2, cs3; XmString cs1, cs2, cs3;
n = 0;
XtSetArg( args[n], XmNautoUnmanage, resource. dia_tm_automng ); n++; XtSetArg( args[n], XmNautoUnmanage, resource. dia_tm_automng ); n++;
XtSetArg( args[n], XmNmarginWidth, resource.dia_tm_width ); n++; XtSetArg( args[n], XmNmarginWidth, resource.dia_tm_width ); n++;
XtSetArg( args[n], XmNmarginHeight, resource.dia_tm_height ); n++; XtSetArg( args[n], XmNmarginHeight, resource.dia_tm_height ); n++;
@ -474,11 +454,7 @@ Widget *pop;
/* Initialize GUI */ /* Initialize GUI */
Widget Widget
GuiInitialize(app, class_name, ac, av) GuiInitialize(XtAppContext *app, String class_name, int *ac, String av[])
XtAppContext *app;
String class_name;
int *ac;
String av[];
{ {
Widget top; Widget top;
@ -491,19 +467,18 @@ String av[];
} }
Widget Widget
CreateDrawingArea( owner, name, width, height, proc, val ) CreateDrawingArea(
Widget owner; Widget owner,
String name; String name,
int width; int width,
int height; int height,
void (*proc)(); void (*proc)(),
int val; int val)
{ {
int n; int n = 0;
Arg arg[16]; Arg arg[16];
Widget drawarea; Widget drawarea;
n = 0;
XtSetArg(arg[n], XmNwidth, width); n++; XtSetArg(arg[n], XmNwidth, width); n++;
XtSetArg(arg[n], XmNheight, height); n++; XtSetArg(arg[n], XmNheight, height); n++;
XtSetArg(arg[n], XmNresizePolicy, XmRESIZE_NONE); n++; XtSetArg(arg[n], XmNresizePolicy, XmRESIZE_NONE); n++;
@ -523,10 +498,7 @@ int val;
#ifndef USE_MACRO #ifndef USE_MACRO
void void
AddLeftAttachWidget( w, ref, offset ) AddLeftAttachWidget( Widget w, Widget ref, int offset)
Widget w;
Widget ref;
int offset;
{ {
XtVaSetValues( w, XtVaSetValues( w,
XmNleftAttachment, XmATTACH_WIDGET, XmNleftAttachment, XmATTACH_WIDGET,
@ -536,9 +508,7 @@ int offset;
} }
void void
AddLeftAttachForm( w, offset ) AddLeftAttachForm( Widget w, int offset )
Widget w;
int offset;
{ {
XtVaSetValues( w, XtVaSetValues( w,
XmNleftAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM,
@ -547,10 +517,7 @@ int offset;
} }
void void
AddTopAttachWidget( w, ref, offset ) AddTopAttachWidget( Widget w, Widget ref, int offset )
Widget w;
Widget ref;
int offset;
{ {
XtVaSetValues( w, XtVaSetValues( w,
XmNtopAttachment, XmATTACH_WIDGET, XmNtopAttachment, XmATTACH_WIDGET,
@ -560,9 +527,7 @@ int offset;
} }
void void
AddTopAttachForm( w, offset ) AddTopAttachForm( Widget w, int offset )
Widget w;
int offset;
{ {
XtVaSetValues( w, XtVaSetValues( w,
XmNtopAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM,
@ -571,10 +536,7 @@ int offset;
} }
void void
AddRightAttachWidget( w, ref, offset ) AddRightAttachWidget( Widget w, Widget ref, int offset )
Widget w;
Widget ref;
int offset;
{ {
XtVaSetValues( w, XtVaSetValues( w,
XmNrightAttachment, XmATTACH_WIDGET, XmNrightAttachment, XmATTACH_WIDGET,
@ -584,9 +546,7 @@ int offset;
} }
void void
AddRightAttachForm( w, offset ) AddRightAttachForm( Widget w, int offset )
Widget w;
int offset;
{ {
XtVaSetValues( w, XtVaSetValues( w,
XmNrightAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM,
@ -595,9 +555,7 @@ int offset;
} }
void void
AddBottomAttachForm( w, offset ) AddBottomAttachForm( Widget w, int offset )
Widget w;
int offset;
{ {
XtVaSetValues( w, XtVaSetValues( w,
XmNbottomAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM,
@ -607,8 +565,7 @@ int offset;
#endif /* not USE_MACRO */ #endif /* not USE_MACRO */
void void
PopupDialog(w) PopupDialog(Widget w)
Widget w;
{ {
if (! XtIsManaged(w)) if (! XtIsManaged(w))
XtManageChild(w); XtManageChild(w);
@ -617,8 +574,7 @@ Widget w;
} }
void void
PopdownDialog(w) PopdownDialog(Widget w)
Widget w;
{ {
if (XtIsManaged(w)){ if (XtIsManaged(w)){
XtUnmanageChild(w); XtUnmanageChild(w);
@ -626,8 +582,7 @@ Widget w;
} }
void void
ForcePopdownDialog(w) ForcePopdownDialog(Widget w)
Widget w;
{ {
if (XtIsManaged(w)){ if (XtIsManaged(w)){
XtUnmanageChild(w); XtUnmanageChild(w);
@ -635,23 +590,17 @@ Widget w;
} }
void void
SetLabelString(w, str) SetLabelString(Widget w, String str)
Widget w;
String str;
{ {
XmString cs; XmString cs = XmStringCreateLocalized(str);
cs = XmStringCreateLocalized(str);
XtVaSetValues( w, XmNlabelString, cs, NULL); XtVaSetValues( w, XmNlabelString, cs, NULL);
XmStringFree( cs ); XmStringFree( cs );
} }
void void
SetFooterString(w, str) SetFooterString(Widget w, String str)
Widget w;
String str;
{ {
XmString cs; XmString cs = XmStringCreateLocalized(str);
cs = XmStringCreateLocalized(str);
XtVaSetValues( w, XmNlabelString, cs, NULL); XtVaSetValues( w, XmNlabelString, cs, NULL);
XmStringFree( cs ); XmStringFree( cs );
XmUpdateDisplay(w); XmUpdateDisplay(w);
@ -665,10 +614,7 @@ String str;
static Widget notice=NULL; static Widget notice=NULL;
static void static void
format_str(st, charcnt , str) format_str(Widget st, int charcnt , char *str)
Widget st;
int charcnt ;
char *str;
{ {
int i ; int i ;
char *s, *p; char *s, *p;
@ -699,15 +645,14 @@ char *str;
XmStringFree(cs); XmStringFree(cs);
} }
void _unmap() void _unmap(void)
{ {
if (notice && XtIsManaged(notice)){ if (notice && XtIsManaged(notice)){
XtUnmanageChild(notice); XtUnmanageChild(notice);
} }
} }
static void _destroy(w) static void _destroy(Widget w)
Widget w;
{ {
if (w){ if (w){
XtDestroyWidget(w); XtDestroyWidget(w);
@ -720,20 +665,19 @@ Widget w;
/*ARGSUSED*/ /*ARGSUSED*/
void void
PopupNotice( owner, message, type, button, do_format, title ) PopupNotice(
Widget owner; Widget owner,
char *message; char *message,
unsigned char type; unsigned char type,
NButton *button; NButton *button,
Boolean do_format; Boolean do_format,
String title; String title)
{ {
Widget label, help, cancel; Widget label, help, cancel;
int n; int n = 0;
Arg args[32]; Arg args[32];
XmString cs1, cs2, cs3; XmString cs1, cs2, cs3;
n = 0;
XtSetArg(args[n], XmNtitle, title ); n++; XtSetArg(args[n], XmNtitle, title ); n++;
XtSetArg(args[n], XmNnoResize, resource.pop_resize ); n++; XtSetArg(args[n], XmNnoResize, resource.pop_resize ); n++;
XtSetArg(args[n], XmNminimizeButtons, resource.pop_minimize ); n++; XtSetArg(args[n], XmNminimizeButtons, resource.pop_minimize ); n++;
@ -799,9 +743,7 @@ String title;
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
_layout_centerEH(w, clientdata) _layout_centerEH(Widget w, XtPointer clientdata)
Widget w;
XtPointer clientdata;
{ {
Widget *child; Widget *child;
int num; int num;
@ -822,20 +764,19 @@ XtPointer clientdata;
/*ARGSUSED*/ /*ARGSUSED*/
Widget Widget
CreateTemplateDialog( w, message, type, button, title, pop ) CreateTemplateDialog(
Widget w; Widget w,
char *message; char *message,
unsigned char type; unsigned char type,
NButton *button; NButton *button,
String title; String title,
Widget *pop; Widget *pop)
{ {
int n; int n = 0;
Arg args[32]; Arg args[32];
XmString cs, cs1=NULL, cs2=NULL, cs3=NULL; XmString cs, cs1=NULL, cs2=NULL, cs3=NULL;
Widget brtnb; Widget brtnb;
n = 0;
cs = XmStringCreateLocalized(message); cs = XmStringCreateLocalized(message);
XtSetArg(args[n], XmNnoResize, resource.temp_resize ); n++; XtSetArg(args[n], XmNnoResize, resource.temp_resize ); n++;
XtSetArg(args[n], XmNminimizeButtons, resource.temp_minimize ); n++; XtSetArg(args[n], XmNminimizeButtons, resource.temp_minimize ); n++;
@ -884,9 +825,7 @@ Widget *pop;
void void
AddDeleteProc(w, delcb) AddDeleteProc(Widget w, void (*delcb)())
Widget w;
void (*delcb)();
{ {
Atom del = DeleteWindowAtom(); Atom del = DeleteWindowAtom();
XmAddWMProtocols( w, &del, 1); XmAddWMProtocols( w, &del, 1);
@ -894,38 +833,33 @@ void (*delcb)();
} }
void void
AddPopupProc(w, popupcb) AddPopupProc(Widget w, void (*popupcb)())
Widget w;
void (*popupcb)();
{ {
XtAddCallback(XtParent(w), XmNpopupCallback, popupcb, 0); XtAddCallback(XtParent(w), XmNpopupCallback, popupcb, 0);
} }
void void
AddDestroyProc(w, destroycb) AddDestroyProc(Widget w, void (*destroycb)())
Widget w;
void (*destroycb)();
{ {
XtAddCallback(XtParent(w), XmNdestroyCallback, destroycb, 0); XtAddCallback(XtParent(w), XmNdestroyCallback, destroycb, 0);
} }
Widget Widget
CreateMenuBarAndFooterMessageForm(owner, name, buttons, bcnt, pop, footer) CreateMenuBarAndFooterMessageForm(
Widget owner; Widget owner,
String name; String name,
MButton *buttons; MButton *buttons,
int bcnt; int bcnt,
Widget *pop; Widget *pop,
Widget *footer; Widget *footer)
{ {
Widget menuBar, form; Widget menuBar, form;
Widget footerFrame, footerForm, footerLabel, sep, casBtn, baseForm; Widget footerFrame, footerForm, footerLabel, sep, casBtn, baseForm;
XmString cs; XmString cs;
char buf[64]; char buf[64];
Arg arg[20]; Arg arg[20];
int n, i; int i, n = 0;
n = 0;
XtSetArg( arg[n], XmNiconName, name ); n++; XtSetArg( arg[n], XmNiconName, name ); n++;
XtSetArg( arg[n], XmNdeleteResponse, XmUNMAP ); n++; XtSetArg( arg[n], XmNdeleteResponse, XmUNMAP ); n++;
XtSetArg( arg[n], XmNmwmFunctions, XtSetArg( arg[n], XmNmwmFunctions,
@ -1010,23 +944,18 @@ Widget *footer;
} }
Widget Widget
GetMenuWidget( buttons, buttons_num ) GetMenuWidget( MButton *buttons, int buttons_num )
MButton *buttons;
int buttons_num;
{ {
return(buttons->items[buttons_num].menu); return(buttons->items[buttons_num].menu);
} }
Widget Widget
CreateForm( owner, name ) CreateForm( Widget owner, String name )
Widget owner;
String name;
{ {
Widget form; Widget form;
int n; int n = 0;
Arg arg[8]; Arg arg[8];
n=0;
form = XmCreateForm( owner, name, arg, n ); form = XmCreateForm( owner, name, arg, n );
XtManageChild(form); XtManageChild(form);
return(form); return(form);
@ -1034,14 +963,11 @@ String name;
/*ARGSUSED*/ /*ARGSUSED*/
Widget Widget
CreateLabel( owner, name, str ) CreateLabel( Widget owner, String name, String str )
Widget owner;
String name;
String str;
{ {
Widget label; Widget label;
Arg arg[2]; Arg arg[2];
int n=0; int n = 0;
XmString cs = XmStringCreateLocalized(str); XmString cs = XmStringCreateLocalized(str);
XtSetArg( arg[n], XmNlabelString, cs); n++; XtSetArg( arg[n], XmNlabelString, cs); n++;
label = XmCreateLabel( owner, "label", arg, n); label = XmCreateLabel( owner, "label", arg, n);
@ -1052,17 +978,11 @@ String str;
/*ARGSUSED*/ /*ARGSUSED*/
Widget Widget
CreateFrame(owner, name, type, thickness) CreateFrame(Widget owner, String name, XtPointer type, XtPointer thickness)
Widget owner;
String name;
XtPointer type;
XtPointer thickness;
{ {
Widget frame; Widget frame;
Arg args[20]; Arg args[20];
int n; int n = 0;
n = 0;
XtSetArg(args[n], XmNresizable, resource.frame_resize ); n++; XtSetArg(args[n], XmNresizable, resource.frame_resize ); n++;
XtSetArg(args[n], XmNshadowType, type); n++; XtSetArg(args[n], XmNshadowType, type); n++;
XtSetArg(args[n], XmNshadowThickness , thickness); n++; XtSetArg(args[n], XmNshadowThickness , thickness); n++;
@ -1073,19 +993,17 @@ XtPointer thickness;
/*ARGSUSED*/ /*ARGSUSED*/
Widget Widget
CreateRowColumn(owner, name, layout, space, marginw, marginh) CreateRowColumn(
Widget owner; Widget owner,
String name; String name,
int layout; int layout,
int space; int space,
int marginw; int marginw,
int marginh; int marginh)
{ {
Widget rc; Widget rc;
Arg args[20]; Arg args[20];
int n; int n = 0;
n = 0;
XtSetArg(args[n], XmNorientation, layout); n++; XtSetArg(args[n], XmNorientation, layout); n++;
XtSetArg(args[n], XmNspacing, space); n++; XtSetArg(args[n], XmNspacing, space); n++;
XtSetArg(args[n], XmNmarginWidth, marginw); n++; XtSetArg(args[n], XmNmarginWidth, marginw); n++;
@ -1097,20 +1015,19 @@ int marginh;
/*ARGSUSED*/ /*ARGSUSED*/
Widget Widget
CreateScrollBar( owner, name, height, val, min, max, proc ) CreateScrollBar(
Widget owner; Widget owner,
String name; String name,
int height; int height,
int val; int val,
int min; int min,
int max; int max,
void (*proc)(); void (*proc)())
{ {
Widget sc; Widget sc;
int n; int n = 0;
Arg arg[16]; Arg arg[16];
n = 0;
XtSetArg( arg[n], XmNsliderSize, (XtArgVal)val ); n++; XtSetArg( arg[n], XmNsliderSize, (XtArgVal)val ); n++;
XtSetArg( arg[n], XmNpageIncrement, (XtArgVal)val ); n++; XtSetArg( arg[n], XmNpageIncrement, (XtArgVal)val ); n++;
XtSetArg( arg[n], XmNmaximum, (XtArgVal)max ); n++; XtSetArg( arg[n], XmNmaximum, (XtArgVal)max ); n++;
@ -1124,29 +1041,25 @@ void (*proc)();
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
_scbase_cb( w, proc, calldata ) _scbase_cb( Widget w, void (*proc)(), XmScrollBarCallbackStruct *calldata )
Widget w;
void (*proc)();
XmScrollBarCallbackStruct *calldata;
{ {
(*proc)(calldata->value); (*proc)(calldata->value);
} }
Widget Widget
CreateScrollBase( owner, name, min, max, val, vcnt, sbproc ) CreateScrollBase(
Widget owner; Widget owner,
String name; String name,
int min; int min,
int max; int max,
int val; int val,
int vcnt; int vcnt,
void (*sbproc)(); void (*sbproc)())
{ {
int n; int n = 0;
Arg arg[16]; Arg arg[16];
Widget base, frame, rwclm, sc; Widget base, frame, rwclm, sc;
n=0;
XtSetArg( arg[n], XmNwidth, resource.scll_fr_width ); n++; XtSetArg( arg[n], XmNwidth, resource.scll_fr_width ); n++;
base = XmCreateForm( owner, name, arg, n ); base = XmCreateForm( owner, name, arg, n );
XtManageChild( base ); XtManageChild( base );

View file

@ -29,69 +29,9 @@
* This is unpublished proprietary source code of FUJITSU LIMITED * This is unpublished proprietary source code of FUJITSU LIMITED
*/ */
extern Widget GetMenuWidget();
extern Widget CreateFrame();
extern Widget CreateControlArea();
extern Widget CreateScrollBar();
extern Widget CreateDrawingArea();
extern Widget CreateExclusive();
extern Widget CreateLabel();
extern Widget CreateDialogAndButtons();
extern
#ifdef _HPUX_SOURCE
String
#else
XtPointer
#endif
GetTextFieldValue();
extern Widget CreateTemplateDialog();
extern Widget CreateScrollBase();
extern Widget CreateForm();
#include <Xm/Xm.h> #include <Xm/Xm.h>
#include <Xm/XmStrDefs.h> #include <Xm/XmStrDefs.h>
Widget CreateCaptionFrame();
#ifdef _HPUX_SOURCE
String
#else
XtPointer
#endif
GetTextFieldValue();
void CreateTextField();
void CreateButtons();
void CreateMenuButtons();
void LayoutButtonsEH();
Widget CreateLayoutButtons();
Widget CreateDialogAndButtons();
Widget GuiInitialize();
Widget CreateDrawingArea();
void AddTopWidget();
void AddLeftAttachWidget();
void AddLeftAttachForm();
void AddTopAttachWidget();
void AddTopAttachForm();
void AddRightAttachWidget();
void AddRightAttachForm();
void AddBottomAttachForm();
void PopupDialog();
void PopdownDialog();
void ForcePopdownDialog();
void SetLabelString();
void SetFooterString();
void PopupNotice();
void AddDeleteProc();
Widget CreateMenuBarAndFooterMessageForm();
Widget GetMenuWidget();
Widget CreateForm();
Widget CreateLabel();
Widget CreateFrame();
Widget CreateRowColumn();
Widget CreateScrollBar();
#define MarginWidth 4 #define MarginWidth 4
#define RowMarginWidth 11 #define RowMarginWidth 11
#define MarginHeight 11 #define MarginHeight 11
@ -264,4 +204,131 @@ typedef struct _TextField {
XmNbottomAttachment, XmATTACH_FORM, \ XmNbottomAttachment, XmATTACH_FORM, \
XmNbottomOffset, offset, \ XmNbottomOffset, offset, \
0) 0)
extern Widget GetMenuWidget(MButton *buttons, int buttons_num);
extern Widget CreateFrame(Widget owner,
String name,
XtPointer type,
XtPointer thickness);
extern Widget CreateScrollBar(Widget owner,
String name,
int height,
int val,
int min,
int max,
void (*proc)());
extern Widget CreateDrawingArea(Widget owner,
String name,
int width,
int height,
void (*proc)(),
int val);
extern Widget CreateLabel(Widget owner, String name, String str);
extern Widget CreateDialogAndButtons(Widget owner,
String name,
void (*delcb)(),
Button *btns,
int btns_cnt,
Widget *pop);
extern
#ifdef _HPUX_SOURCE
String
#else
XtPointer
#endif
GetTextFieldValue(TextField *textf);
extern Widget CreateTemplateDialog(Widget w,
char *message,
unsigned char type,
NButton *button,
String title,
Widget *pop);
extern Widget CreateScrollBase(Widget owner,
String name,
int min,
int max,
int val,
int vcnt,
void (*sbproc)());
extern Widget CreateForm(Widget owner, String name);
Widget CreateCaptionFrame(Widget owner,
String name,
String labelstr,
int type,
int thickness);
#ifdef _HPUX_SOURCE
String
#else
XtPointer
#endif
GetTextFieldValue(TextField *textf);
void CreateTextField(Widget owner,
String name,
String labelstr,
TextField *data,
int maxlength);
void CreateMenuButtons(Widget owner, Button *buttons, int buttons_cnt);
Widget CreateDialogAndButtons(Widget owner,
String name,
void (*delcb)(),
Button *btns,
int btns_cnt,
Widget *pop);
Widget GuiInitialize(XtAppContext *app,
String class_name,
int *ac,
String av[]);
Widget CreateDrawingArea(Widget owner,
String name,
int width,
int height,
void (*proc)(),
int val);
void AddLeftAttachWidget(Widget w, Widget ref, int offset);
void AddLeftAttachForm(Widget w, int offset);
void AddTopAttachWidget(Widget w, Widget ref, int offset);
void AddTopAttachForm(Widget w, int offset);
void AddRightAttachWidget(Widget w, Widget ref, int offset);
void AddRightAttachForm(Widget w, int offset);
void AddBottomAttachForm(Widget w, int offset);
void PopupDialog(Widget w);
void PopdownDialog(Widget w);
void ForcePopdownDialog(Widget w);
void SetLabelString(Widget w, String str);
void SetFooterString(Widget w, String str);
void PopupNotice(Widget owner,
char *message,
unsigned char type,
NButton *button,
Boolean do_format,
String title);
void AddDeleteProc(Widget w, void (*delcb)());
Widget CreateMenuBarAndFooterMessageForm(Widget owner,
String name,
MButton *buttons,
int bcnt,
Widget *pop,
Widget *footer);
Widget GetMenuWidget(MButton *buttons, int buttons_num);
Widget CreateForm(Widget owner, String name);
Widget CreateLabel(Widget owner, String name, String str);
Widget CreateFrame(Widget owner,
String name,
XtPointer type,
XtPointer thickness);
Widget CreateRowColumn(Widget owner,
String name,
int layout,
int space,
int marginw,
int marginh);
Widget CreateScrollBar(Widget owner,
String name,
int height,
int val,
int min,
int max,
void (*proc)());
#endif /* USE_MACRO */ #endif /* USE_MACRO */

View file

@ -30,58 +30,70 @@
*/ */
#include "fssxeg.h" #include "fssxeg.h"
extern Widget CreateOblB(); extern Widget CreateLabel(Widget owner, String name, String str);
extern Widget CreateOblBG();
extern Widget CreateToglBG();
extern Widget CreateToglB();
extern Widget CreateRecBG();
extern Widget CreateRecB();
extern Widget CreateCapt();
extern Widget CreateCaptG();
extern Widget CreateLabelG();
extern Widget CreateLabel();
extern void SetString();
extern int readSNF(); extern int readSNF(FalFontData **fdata,
extern int writeSNF(); int *width,
extern int ptnClose(); int *height,
extern int ptnAdd(); char *err);
extern int ptnGet(); extern int writeSNF(int restart, int *err);
extern int ptnSense(); extern int ptnClose(void);
extern int ptnDel(); extern int ptnAdd(int code, char *ptn);
extern int GetInfo(); extern int ptnGet(int code, char *ptn);
extern int ptnSqToNo(); extern int ptnSense(int code);
extern int ptnNoToSq(); extern int ptnDel(int code);
extern int noToCode(); extern int ptnSqToNo(int num);
extern int noToCode2(); extern int ptnNoToSq(int ncode);
extern int codeToNo(); extern int noToCode(int sno);
extern int codeToNo2(); extern int codeToNo(int code);
extern int codeCheck(); extern int codeCheck(int code);
extern int codeCheck2(); extern void bitSetInfo(int width, int height);
extern void bitSetInfo(); extern void bitSet(char *ptn, int cx, int cy);
extern void bitSet(); extern void bitReset(char *ptn, int cx, int cy);
extern void bitReset(); extern int bitRead(char *ptn, int cx, int cy);
extern int bitRead(); extern void bitPtnClear(char *ptn);
extern void bitPtnClear(); extern void bitPtnCopy(char *d_ptn, char *s_ptn);
extern void bitPtnCopy(); extern int bitDrawLine(char *ptn,
extern int bitDrawLine(); int x1,
extern int bitDrawRect(); int y1,
extern int bitDrawCls(); int x2,
extern int bitDrawSet(); int y2,
extern int bitDrawRev(); int mode);
extern int bitDrawCpy(); extern int bitDrawRect(char *ptn,
extern int bitDrawMov(); int x,
extern int bitDrawRoll(); int y,
extern int bitDrawSymV(); int width,
extern int bitDrawSymH(); int height,
int mode);
extern int bitDrawCls(char *ptn,
int x,
int y,
int width,
int height);
extern int bitDrawSet(char *ptn,
int x,
int y,
int width,
int height);
extern int bitDrawRev(char *ptn,
int x,
int y,
int width,
int height);
extern int bitDrawCpy(char *ptn,
int sx,
int sy,
int width,
int height,
int cut_flag);
extern int bitDrawRoll(char *ptn, int x, int y, int width, int height);
extern int bitDrawSymV(char *ptn, int x, int y, int width, int height);
extern int bitDrawSymH(char *ptn, int x, int y, int width, int height);
#define D_MAX 10 #define D_MAX 10
#define SetString(w,s) UpdateMessage((s))
#define PROC_POINT 0 #define PROC_POINT 0
#define PROC_LINE 1 #define PROC_LINE 1
#define PROC_RECT 2 #define PROC_RECT 2
@ -123,20 +135,9 @@ extern int bitDrawSymH();
#define SET_SYSTEM 5 #define SET_SYSTEM 5
#define MG_MAXSIZE 100 #define MG_MAXSIZE 100
#ifdef DEBUG
#define Dprintf2 printf
#define Dprintf printf
#else
#define Dprintf2
#define Dprintf
#endif
/********************************************************************** /**********************************************************************
structure structure
**********************************************************************/ **********************************************************************/
@ -254,58 +255,23 @@ typedef struct _FontInf {
**********************************************************************/ **********************************************************************/
#ifdef substance_source Widget toplevel;
#define ex
#define I(x) =(x)
#else
#define ex extern
#define I(x)
#endif /* substance_source */
ex Widget toplevel I(NULL); Widget editPtnW;
Widget cpyPtnW;
Widget mngPtnW;
ex Widget editPtnW I(NULL); EditChar edg;
ex Widget cpyPtnW I(NULL); EditList edlist;
ex Widget mngPtnW I(NULL); EditPane edpane;
XlibInf xl;
DelInf dn;
DelPtnInf dl[D_MAX] ;
DelPtnInf dl_glyph[EDLIST_MAX]; /* add dl_disp 1995.09.20 */
int sq_disp[EDLIST_MAX]; /* add sq_disp 1995.09.20 */
ex EditChar edg EditPtnInf em;
#ifdef substance_source CopyPtnInf cpm;
={ 0,0,0,0,0,0,0, OFF }
#endif /* substance_source */
;
ex EditList edlist
#ifdef substance_source
={ EDLIST_MAX, 0,0,0,0,0,0,0,0,0 }
#endif /* substance_source */
;
EditPane edpane
#ifdef substance_source
={ EDPANE_SIZE, EDPANE_SIZE, 0,0,0,0,0,0 }
#endif /* substance_source */
;
ex XlibInf xl;
ex DelInf dn
#ifdef substance_source
={ 0,0,0,0,0,0,0,0,0,0,0 }
#endif /* substance_source */
;
ex DelPtnInf dl[D_MAX] ;
ex DelPtnInf dl_glyph[EDLIST_MAX] ; /* add dl_disp 1995.09.20 */
ex int sq_disp[EDLIST_MAX] ; /* add sq_disp 1995.09.20 */
ex EditPtnInf em
#ifdef substance_source
={ OFF,0,0,0,0,0,0,0,0,0,0,0,0,0 }
#endif /* substance_source */
;
ex CopyPtnInf cpm
#ifdef substance_source
={ 0,0,0,0,0 }
#endif /* substance_source */
;
#undef ex
#undef I
/* /*
@ -314,91 +280,4 @@ ex CopyPtnInf cpm
#include"ufontrsrc.h" /* 1995.06.28 H.Chiba */ #include"ufontrsrc.h" /* 1995.06.28 H.Chiba */
/*Resource resource; del 1995.05.30 H.Chiba BSC */
#ifdef substance_source /* add 1995.06.29 H.Chiba -> */
/* CreateCaptionFrame() */
Boolean capt_resize = True ; /* resizable: */
int capt_lftoff = 2 ; /* leftOffset: */
int capt_topoff = 2 ; /* topOffset: */
int capt_rghoff = 2 ; /* rightOffset: */
Pixel pane_background;
Pixel pane_foreground;
/* CreateMenuButtons() */
Dimension menu_margin = 0 ; /* margin: */
/* CreateDialogAndButtons() */
Boolean dia_tm_automng = False ; /* autoUnmanage: */
Dimension dia_tm_width = 4 ; /* marginWidth: */
Dimension dia_tm_height = 4 ; /* marginHeight: */
Boolean dia_tm_resize = True ; /* noResize: */
Boolean dia_tm_minimize = True ; /* minimizeButtons: */
Dimension dia_rw_width = 6 ; /* marginWidth: */
Dimension dia_rw_height = 6 ; /* marginHeight: */
Dimension dia_rw_spacing = 4 ; /* spacing: */
/* CreateDrawingArea() */
Dimension draw_border = 1 ; /* borderWidth: */
int draw_topoff = 2 ; /* topOffset: */
int draw_lftoff = 2 ; /* leftOffset: */
/* PopupNotice() */
Boolean pop_resize = True ; /* noResize: */
Boolean pop_minimize = True ; /* minimizeButtons: */
/* CreateTemplateDialog() */
Boolean temp_resize = True ; /* noResize: */
Boolean temp_minimize = True ; /* minimizeButtons: */
Dimension temp_width = 1 ; /* width: */
Dimension temp_height = 1 ; /* height: */
/* CreateMenuBarAndFooterMessageForm() */
#if 0
ed_functions = ( MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE | MWM_FUNC_CLOSE ) ;/* mwmFunctions: */
#endif
int ed_bar_topoff = 1 ; /* topOffset: */
int ed_bar_lftoff = 1 ; /* leftOffset: */
int ed_bar_rghoff = 1 ; /* rightOffset: */
int ed_frm_btmoff = 3 ; /* bottomOffset: */
int ed_frm_lftoff = 3 ; /* leftOffset: */
int ed_frm_rghoff = 3 ; /* rightOffset: */
Dimension ed_msg_margintop = 3 ; /* marginTop: */
Dimension ed_msg_marginbtm = 3 ; /* marginBottom: */
Dimension ed_mesg_margintop = 3 ; /* marginTop: */
Dimension ed_mesg_marginbtm = 3 ; /* marginBottom: */
int ed_sep_btmoff = 3 ; /* bottomOffset: */
int ed_sep_lftoff = 0 ; /* leftOffset: */
int ed_sep_rghoff = 0 ; /* rightOffset: */
Dimension ed_sep_margin = 0 ; /* margin: */
int ed_wge_topoff = 10 ; /* topOffset: */
int ed_wge_lftoff = 10 ; /* leftOffset: */
int ed_wge_rghoff = 10 ; /* rightOffset: */
int ed_wge_btmoff = 10 ; /* bottomOffset: */
/* CreateFrame() */
Boolean frame_resize = False ; /* resizable: */
/* CreateScrollBase() */
Dimension scll_fr_width = 500 ; /* width: */
Dimension scll_fr_thick = 2 ; /* shadowThickness: */
int scll_bar_lftoff = 4 ; /* leftOffset: */
#endif /* substance_source */ /* -> add 1995.06.29 H.Chiba */
/**********/ /**********/

View file

@ -54,7 +54,7 @@
/* /*
* parameters * parameters
*/ */
void xlfdPopupDialog() ; void xlfdPopupDialog(Widget w);
extern int getmask ; extern int getmask ;
@ -73,8 +73,7 @@ extern Widget slctBLabel[BUTTONITEMS],
*/ */
void void
xlfdPopupDialog(w) xlfdPopupDialog(Widget w)
Widget w;
{ {
if (! XtIsManaged(w)) if (! XtIsManaged(w))
XtManageChild(w); XtManageChild(w);