From: chase Date: Fri, 27 Jul 2018 21:44:10 +0000 (-0500) Subject: Refactor and reimplement dtudcfonted X-Git-Tag: 2.3.0a~26^2~22 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b491f9134f25b0a14d00adbfcb9fe14ab17ff971;p=oweals%2Fcde.git Refactor and reimplement dtudcfonted --- diff --git a/cde/programs/dtudcexch/excutil.h b/cde/programs/dtudcexch/excutil.h index 0deada83..83fdd9ec 100644 --- a/cde/programs/dtudcexch/excutil.h +++ b/cde/programs/dtudcexch/excutil.h @@ -96,25 +96,17 @@ typedef struct { } ListData; #ifndef NO_MESSAGE_CATALOG -# ifdef __ultrix -# define _CLIENT_CAT_NAME "dtudcexch.cat" -# else /* __ultrix */ -# define _CLIENT_CAT_NAME "dtudcexch" -# endif /* __ultrix */ -# ifdef _NO_PROTO -extern char *_DtGetMessage(); -# else /* _NO_PROTO */ +# define _CLIENT_CAT_NAME "dtudcexch" + extern char *_DtGetMessage( char *filename, int set, int n, char *s ); -# endif /* _NO_PROTO */ + #define GETMESSAGE(set, number, string) GetMessage(set, number, string) static char * -GetMessage(set, number, string) -int set, number; -char *string; +GetMessage(int set, int number, char *string) { char *tmp; static char * point[100]; diff --git a/cde/programs/dtudcexch/exportbdf.c b/cde/programs/dtudcexch/exportbdf.c index 01c9a399..0f13c71c 100644 --- a/cde/programs/dtudcexch/exportbdf.c +++ b/cde/programs/dtudcexch/exportbdf.c @@ -65,10 +65,7 @@ sigint_out() } int -expCheckCode( code, code_num, code_list ) -unsigned int code ; -int code_num ; -int *code_list ; +expCheckCode( unsigned int code, int code_num, int *code_list ) { int i ; @@ -80,14 +77,15 @@ int *code_list ; } int -ExpGpftoBDF( gpf_name, bdf_name, code_num, code_list, comment_num, comment_list, make_all ) -char *gpf_name ; /* pointer to GPF file name area */ -char *bdf_name ; /* pointer to BDF file name area */ -int code_num ; /* number of GPF code */ -int *code_list ; /* pointer to GPF code lists */ -int comment_num ; /* number comments */ -char **comment_list ;/* pointer to the list of comments */ -int make_all ; /* convert whole GPF fomat file to BDF */ +ExpGpftoBDF( + char *gpf_name, /* pointer to GPF file name area */ + char *bdf_name, /* pointer to BDF file name area */ + int code_num, /* number of GPF code */ + int *code_list, /* pointer to GPF code lists */ + int comment_num, /* number comments */ + char **comment_list, /* pointer to the list of comments */ + int make_all /* convert whole GPF fomat file to BDF */ +) { struct stat statbuf ; 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.ptn = r_gpf.ptn ; - if( (rtn = WritePtnToBdf( &w_bdf, buf )) ){ + if( (rtn = WritePtnToBdf( &w_bdf )) ){ fprintf(stderr, "\"%s\" cannot write glyph.\n", bdf_name ) ; fclose(w_bdf.output) ; return rtn ; @@ -193,10 +191,10 @@ int make_all ; /* convert whole GPF fomat file to BDF */ } static int -writeBdfHeader(head, comment_num, comment_list) -struct ptobhead *head; -int comment_num ; /* number comments */ -char **comment_list ;/* pointer to the list of comments */ +writeBdfHeader(struct ptobhead *head, + int comment_num, /* number comments */ + char **comment_list /*pointer to the list of comments */ +) { FILE *fp; int fd[2]; @@ -276,7 +274,7 @@ char **comment_list ;/* pointer to the list of comments */ char *ep ; if( (ep = (char *)strchr( comment_list[i], '\n' )) != NULL ) *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\n"); @@ -327,12 +325,11 @@ char **comment_list ;/* pointer to the list of comments */ static int -readBdfToMemory(head, buf, code_num, code_list, make_all) -struct btophead *head; -char *buf; -int code_num ; /* number of GPF code */ -int *code_list ; /* pointer to GPF code lists */ -int make_all ; /* convert whole GPF fomat file to BDF */ +readBdfToMemory(struct btophead *head, char *buf, +int code_num, /* number of GPF code */ +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; char *ptn; diff --git a/cde/programs/dtudcexch/importbdf.c b/cde/programs/dtudcexch/importbdf.c index aa818300..480c71f2 100644 --- a/cde/programs/dtudcexch/importbdf.c +++ b/cde/programs/dtudcexch/importbdf.c @@ -83,7 +83,7 @@ static char *targ_file = NULL; /* UDC_file_name */ static void -sigint_out() +sigint_out(void) { if (WriteGpf.out_file) { UNLINK_TMPFILE( WriteGpf.out_file ); @@ -95,10 +95,7 @@ sigint_out() int -ImpBDFCodeList( bdf_name, code_num, code_list ) -char *bdf_name ; -int *code_num ; -int **code_list ; +ImpBDFCodeList(char *bdf_name, int *code_num, int **code_list) { int *glyph_list ; FILE *bdfp ; @@ -165,8 +162,7 @@ int **code_list ; int -ImpBDFCodeListFree( code_list ) -int **code_list ; +ImpBDFCodeListFree(int **code_list) { free( *code_list ) ; return(0) ; @@ -175,9 +171,10 @@ int **code_list ; int -ImpBDFCheck( bdf_name, gpf_name ) -char *bdf_name ; /* BDF file name */ -char *gpf_name ; /* GPF file name */ +ImpBDFCheck( +char *bdf_name, /* BDF file name */ +char *gpf_name /* GPF file name */ +) { /* parameter check */ if( bdf_name == NULL || gpf_name == NULL ){ @@ -190,11 +187,12 @@ char *gpf_name ; /* GPF file name */ int -ImpBDFtoGpf( bdf_name, gpf_name, bdf_codenum, bdf_codelist) -char *bdf_name ; -char *gpf_name ; -int bdf_codenum ; -int *bdf_codelist ; +ImpBDFtoGpf( +char *bdf_name, +char *gpf_name, +int bdf_codenum, +int *bdf_codelist +) { int rtn ; int exit_stat; @@ -359,10 +357,11 @@ int *bdf_codelist ; */ static -impFileConvInit(r_udc, r_gpf, w_gpf ) -struct btophead *r_udc; -struct btophead *r_gpf; -struct ptobhead *w_gpf; +impFileConvInit( +struct btophead *r_udc, +struct btophead *r_gpf, +struct ptobhead *w_gpf +) { int fd[2], snf_fd, permission; char buf[BUFSIZE]; @@ -386,11 +385,6 @@ struct ptobhead *w_gpf; if ( ChkPcfFontFile( w_gpf->snf_file ) ) { /* snf */ 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; } } @@ -477,11 +471,12 @@ struct ptobhead *w_gpf; static -impGetGpfInf( r_gpf, w_gpf, buf, bdf_codenum ) -struct btophead *r_gpf; -struct ptobhead *w_gpf; -char *buf; -int bdf_codenum ; +impGetGpfInf( +struct btophead *r_gpf, +struct ptobhead *w_gpf, +char *buf, +int bdf_codenum +) { int nchar, rtn; @@ -505,10 +500,11 @@ int bdf_codenum ; static -impReadBdfHeaderAndPut(r_gpf, w_gpf, buf) -struct btophead *r_gpf; -struct ptobhead *w_gpf; -char *buf; +impReadBdfHeaderAndPut( +struct btophead *r_gpf, +struct ptobhead *w_gpf, +char *buf +) { char *p; unsigned int getstat = 0; @@ -555,12 +551,13 @@ char *buf; static -impMergePtn(r_udc, r_gpf, buf, bdf_codenum, bdf_codelist ) -struct btophead *r_udc; -struct btophead *r_gpf; -char *buf; -int bdf_codenum ; -int *bdf_codelist ; +impMergePtn( +struct btophead *r_udc, +struct btophead *r_gpf, +char *buf, +int bdf_codenum, +int *bdf_codelist +) { int code, rtn, msize, i, j; char *ptn; @@ -615,11 +612,7 @@ int *bdf_codelist ; } static -impModifyPtn( r_udc, r_gpf, buf, ix ) -struct btophead *r_udc; -struct btophead *r_gpf; -char *buf; -int ix; +impModifyPtn(struct btophead *r_udc, struct btophead *r_gpf, char *buf, int ix) { int mwidth, msize, rtn; @@ -644,12 +637,13 @@ int ix; } static -impInsertPtn( r_udc, r_gpf, buf, code, ix ) -struct btophead *r_udc; -struct btophead *r_gpf; -char *buf; -int code; -int ix; +impInsertPtn( +struct btophead *r_udc, +struct btophead *r_gpf, +char *buf, +int code, +int ix +) { int mwidth, msize, rtn, i; @@ -688,9 +682,7 @@ int ix; } static -impWriteSnf( r_gpf, w_gpf ) -struct btophead *r_gpf; -struct ptobhead *w_gpf; +impWriteSnf(struct btophead *r_gpf, struct ptobhead *w_gpf) { w_gpf->zoomf = 0; w_gpf->num_chars = r_gpf->num_chars; diff --git a/cde/programs/dtudcexch/selectx.c b/cde/programs/dtudcexch/selectx.c index 9a5ed9ec..520da5e6 100644 --- a/cde/programs/dtudcexch/selectx.c +++ b/cde/programs/dtudcexch/selectx.c @@ -134,8 +134,7 @@ static Widget *button4=NULL; */ void -xlfdPopupDialog(w) -Widget w; +xlfdPopupDialog(Widget w) { if (! XtIsManaged(w)) XtManageChild(w); @@ -144,8 +143,7 @@ Widget w; } void -ForcePopdownDialog(w) -Widget w; +ForcePopdownDialog(Widget w) { if (XtIsManaged(w)){ XtUnmanageChild(w); @@ -367,10 +365,7 @@ char_set(char *str) /* dtex */ } static char * -spc(str, ch, count) -char * str; -char ch; -int count; +spc(char *str, char ch, int count) { char *p; p = str + strlen(str); @@ -506,10 +501,8 @@ static void OpenWindowCB() /* dtex change */ /*ARGSUSED*/ static void -OpenCancelCB( widget, clientData, callData ) /* dtex change */ -Widget widget; -caddr_t clientData; -caddr_t callData; +OpenCancelCB( Widget widget, caddr_t clientData, caddr_t callData ) +/* dtex change */ { /* extern void ForcePopdownDialog(); if ( !editPtnW ){ @@ -523,8 +516,7 @@ caddr_t callData; * create selection window view */ void -PopupSelectXLFD( top ) -Widget top ; +PopupSelectXLFD( Widget top ) { if( xlfdDialog == NULL ){ @@ -584,8 +576,7 @@ create_xlfd() } static void -udc_call(w) -Widget w; +udc_call(Widget w) { XmString label; char *moji; @@ -621,8 +612,7 @@ Widget w; } static void -sty_call(w) -Widget w; +sty_call(Widget w) { XmString label; char *moji; @@ -651,8 +641,7 @@ Widget w; } static void -wls_call(w) -Widget w; +wls_call(Widget w) { XmString label; char *moji; @@ -678,8 +667,7 @@ Widget w; } static void -hls_call(w) -Widget w; +hls_call(Widget w) { XmString label; char *moji; @@ -899,9 +887,7 @@ button_set4() } void -data_sort(data, count) -int *data; -int count; +data_sort(int *data, int count) { int *p1, *p2, tmp, i; @@ -1071,8 +1057,7 @@ font_init() /* dtex change */ static Widget -CreateSelectXLFD( top ) /* dtex change */ -Widget top ; +CreateSelectXLFD( Widget top ) /* dtex change */ { int n; diff --git a/cde/programs/dtudcexch/selectxlfd.c b/cde/programs/dtudcexch/selectxlfd.c index b4b63b42..cfdfa9fd 100644 --- a/cde/programs/dtudcexch/selectxlfd.c +++ b/cde/programs/dtudcexch/selectxlfd.c @@ -168,7 +168,7 @@ void setallcode(ListData *ld) } } -FalFontID openfont() +FalFontID openfont(void) { int protect_key = FAL_FONT_DISPLAY; int codeset; @@ -311,8 +311,7 @@ void getexistcode(ListData *ld) */ void -xlfdPopupDialog(w) -Widget w; +xlfdPopupDialog(Widget w) { if (! XtIsManaged(w)) XtManageChild(w); @@ -321,8 +320,7 @@ Widget w; } void -xlfdPopdownDialog(w) -Widget w; +xlfdPopdownDialog(Widget w) { if (XtIsManaged(w)){ XtUnmanageChild(w); @@ -334,10 +332,7 @@ Widget w; * get pixel width */ Dimension -GetPixelWidth( w, columns, width ) -Widget w ; -int columns ; -Dimension *width ; +GetPixelWidth(Widget w, int columns, Dimension *width) { Arg args[1] ; XtSetArg( args[0], XmNwidth, width ) ; @@ -350,9 +345,7 @@ Dimension *width ; * callbacks * ***************************************************************/ -void quit(w, client_data, call_data) -Widget w; -caddr_t *client_data, *call_data; +void quit(Widget w, caddr_t *client_data, caddr_t *call_data) { char *msg; int ans; @@ -374,9 +367,7 @@ caddr_t *client_data, *call_data; * Unmanage widgets */ int -ClearText( num, slctBText ) -int num ; -Widget *slctBText ; +ClearText(int num, Widget *slctBText) { int i ; /* toggle button unset */ @@ -389,9 +380,7 @@ Widget *slctBText ; } int -ClearButtons( num, slctButton ) -int num ; -Widget *slctButton ; +ClearButtons(int num, Widget *slctButton) { int i, cnt ; Boolean isSet ; @@ -418,13 +407,13 @@ Widget *slctButton ; * get text field position */ int -GetPositionOfLists( num, xlfdDialog, listPop, slctBText, x, y ) -int num ; -Widget xlfdDialog ; -Widget *listPop ; -Widget *slctBText ; -Position *x ; -Position *y ; +GetPositionOfLists( +int num, +Widget xlfdDialog, +Widget *listPop, +Widget *slctBText, +Position *x, +Position *y) { int i ; Position tbx, tby, tx, ty ; @@ -462,10 +451,7 @@ Position *y ; -void listEH(w, num, event) -Widget w ; -int num ; -XButtonEvent *event; +void listEH(Widget w, int num, XButtonEvent *event) { int i, j, ITEM_COUNT; Arg args[10]; @@ -536,10 +522,7 @@ XButtonEvent *event; -void listPrintCB(w, num, call_data) -Widget w; -int num ; -XmListCallbackStruct *call_data; +void listPrintCB(Widget w, int num, XmListCallbackStruct *call_data) { char *str ; @@ -568,9 +551,7 @@ XmListCallbackStruct *call_data; -void OpenWindow(w, client_data, call_data) -Widget w; -caddr_t client_data, *call_data; +void OpenWindow(Widget w, caddr_t client_data, caddr_t *call_data) { int r ; int i ; @@ -680,11 +661,11 @@ caddr_t client_data, *call_data; int -CreateXLFDLabelAndText( owner, slctBLabel, slctBText, slctButton ) -Widget owner ; -Widget *slctBLabel ; -Widget *slctBText ; -Widget *slctButton ; +CreateXLFDLabelAndText( +Widget owner, +Widget *slctBLabel, +Widget *slctBText, +Widget *slctButton) { Widget _slctBLabel ; @@ -769,15 +750,14 @@ Widget *slctButton ; int -CreateOtherLabelAndText( num, owner, baseForm, - slctBLabel, topW, slctBText, slctButton ) -int num ; -Widget owner ; -Widget baseForm ; -Widget *slctBLabel ; -Widget topW ; -Widget *slctBText ; -Widget *slctButton ; +CreateOtherLabelAndText( +int num, +Widget owner, +Widget baseForm, +Widget *slctBLabel, +Widget topW, +Widget *slctBText, +Widget *slctButton) { Widget _slctBLabel ; @@ -875,11 +855,7 @@ Widget *slctButton ; Widget -xlfdCreateScrolledList ( owner, name, args, n ) -Widget owner ; -char *name ; -Arg *args ; -int n ; +xlfdCreateScrolledList (Widget owner, char *name, Arg *args, int n) { Widget listW ; @@ -901,8 +877,7 @@ int n ; * create selection window view */ void -PopupSelectXLFD( top ) -Widget top ; +PopupSelectXLFD(Widget top) { int n, i, j; diff --git a/cde/programs/dtudcexch/xlfdutil.c b/cde/programs/dtudcexch/xlfdutil.c index 811da2d4..3c21a565 100644 --- a/cde/programs/dtudcexch/xlfdutil.c +++ b/cde/programs/dtudcexch/xlfdutil.c @@ -132,10 +132,7 @@ GetXLFDInfomations() int -GetItemsToDisplay( num, itemcnt, xms_list ) -int num ; -int *itemcnt ; -XmString **xms_list ; +GetItemsToDisplay( int num, int *itemcnt, XmString **xms_list ) { int i, j, cnt ; char *sp ,string[256], buf[256] ; @@ -252,9 +249,7 @@ XmString **xms_list ; static char* -skipSpace( str, skipcnt ) -char *str ; -int skipcnt ; +skipSpace( char *str, int skipcnt ) { int i, spacecnt ; char *sp ; @@ -276,9 +271,7 @@ int skipcnt ; int -SetKeyBuff( num, str ) -int num ; -char *str ; +SetKeyBuff( int num, char *str ) { int i, j ; int cdset, start, end ; diff --git a/cde/programs/dtudcfonted/Imakefile b/cde/programs/dtudcfonted/Imakefile index 36befed1..8f90abc0 100644 --- a/cde/programs/dtudcfonted/Imakefile +++ b/cde/programs/dtudcfonted/Imakefile @@ -9,10 +9,9 @@ UDC_INC_PATH1 = -I./ UDC_INC_PATH2 = -I./include UDC_INC_PATH3 = -I./libfal -UDC_INC_PATH4 = -I./libfal/include -UDC_INC_PATH5 = -I$(DTSVCSRC)/DtXpm -UDC_INC_PATH6 = -I$(TOP)/../x11/xc +UDC_INC_PATH4 = -I$(DTSVCSRC)/DtXpm +UDC_INC_PATH5 = -I$(TOP)/../x11/xc #ifdef X11ProjectRoot OPT2 = -DFONTC='"'$(XPROJECTROOT)/bin/bdftopcf'"' @@ -22,12 +21,11 @@ UDC_INC_PATH6 = -I$(TOP)/../x11/xc DEFINES = $(OPT2) - INCLUDES = $(UDC_INC_PATH1)\ + INCLUDES = $(UDC_INC_PATH1)\ $(UDC_INC_PATH2)\ $(UDC_INC_PATH3)\ $(UDC_INC_PATH4)\ - $(UDC_INC_PATH5)\ - $(UDC_INC_PATH6) + $(UDC_INC_PATH5) DEPLIBS = $(DEPDTSVCLIB) $(DEPTTLIB) $(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB) LOCAL_LIBRARIES = $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTOOLLIB) $(XLIB) ./libfuty/liboakfuty.a ./libfal/libfal.a @@ -50,7 +48,7 @@ SYS_LIBRARIES = DtClientSysLibs #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' SUBDIRS = \ - libfal \ + libfal \ libfuty \ dtaddcpf \ dtbdftocpf \ diff --git a/cde/programs/dtudcfonted/code.c b/cde/programs/dtudcfonted/code.c index 6fc91921..8ecc1cd0 100644 --- a/cde/programs/dtudcfonted/code.c +++ b/cde/programs/dtudcfonted/code.c @@ -68,7 +68,7 @@ extern int CodePoint; extern Resource resource; static void -OpenFont() +OpenFont(void) { int mask; FalFontData font_data; @@ -90,7 +90,7 @@ OpenFont() } static void -CloseFont() +CloseFont(void) { if (fid != font_id) { FalCloseFont(fid); @@ -99,9 +99,7 @@ CloseFont() } static void -DrawCode(w, low_code) -Widget w; -int low_code; +DrawCode(Widget w, int low_code) { int hi_code; char *f = NULL; @@ -193,20 +191,14 @@ SetPixmap(start_code) } static void -Code1Call(w, start_code, data) -Widget w; -int start_code; -XmListCallbackStruct *data; +Code1Call(Widget w, int start_code, XmListCallbackStruct *data) { code1 = start_code + data->item_position -1; SetPixmap(code1); } static void -Code2Call(w, code2, data) -Widget w; -int code2; -XmPushButtonCallbackStruct *data; +Code2Call(Widget w, int code2, XmPushButtonCallbackStruct *data) { char asc[16]; sprintf(asc, "%2.2X%2.2X", code1, code2); @@ -215,8 +207,7 @@ XmPushButtonCallbackStruct *data; } static void -PrevPage(w, scroll) -Widget w, scroll; +PrevPage(Widget w, Widget scroll) { int *list; int num; @@ -229,8 +220,7 @@ Widget w, scroll; } static void -NextPage(w, scroll) -Widget w, scroll; +NextPage(Widget w, Widget scroll) { int *list; int num, item; @@ -244,13 +234,13 @@ Widget w, scroll; } static void -Cancel() +Cancel(void) { XtUnmapWidget(XtParent(code_w)); } static void -Apply() +Apply(void) { char *asc; XtVaGetValues(text, XmNvalue, &asc, NULL); @@ -260,10 +250,7 @@ Apply() } static void -CreateItem(item, item_count, start_code) -XmString *item; -int *item_count; -int *start_code; +CreateItem(XmString *item, int *item_count, int *start_code) { int count; int start, end; @@ -307,8 +294,7 @@ int *start_code; } static Widget -CreateCodeWindow(w) -Widget w; +CreateCodeWindow(Widget w) { Widget top, base1, base2, base3, base4; Widget frame, scroll, label, sep, form; @@ -457,10 +443,7 @@ Widget w; } void -CodeWindow(widget, font_name, load_font) - Widget widget; - char * font_name; - Boolean load_font; +CodeWindow(Widget widget, char *font_name, Boolean load_font) { static Boolean old_load_font; extern int CodePoint; diff --git a/cde/programs/dtudcfonted/comsub.c b/cde/programs/dtudcfonted/comsub.c index 62b8fab4..6c10007d 100644 --- a/cde/programs/dtudcfonted/comsub.c +++ b/cde/programs/dtudcfonted/comsub.c @@ -31,6 +31,7 @@ #include +#include #include #include #include @@ -42,9 +43,9 @@ #include "falfont.h" #include "ufontrsrc.h" -static void writePtn(); -static void sig_receive(); -char *get_cmd_path() ; +static void writePtn(char *ptn, int width, int height, FILE *fp); +static void sig_receive(void); +char *get_cmd_path(char *path, char *cmd) ; extern Resource resource; @@ -61,9 +62,9 @@ typedef struct { /* area to manage character patterns */ int nptn; /* number of characters in editting */ int nmaxptn; /* maximum number of characters in editting */ int ptnsize; /* size per byte of single pattern */ - UINT ptnmemsize; /* size of memory of whole patterns */ - USHORT *ntoc; /* character list / relative code */ - USHORT *ctop; /* relative code / bitmap area */ + unsigned int ptnmemsize; /* size of memory of whole patterns */ + unsigned short *ntoc; /* character list / relative code */ + unsigned short *ctop; /* relative code / bitmap area */ char *ptn; /* pointer to the bimap area */ int cptnnum; /* current pattern number */ } PATTERN_MNG; @@ -86,7 +87,7 @@ char AreaStr[160]; FalFontID font_id; static char * -get_locale() +get_locale(void) { char *loc; @@ -104,8 +105,7 @@ get_locale() */ int -ptnSqToNo( num ) -int num; /* sequential number */ +ptnSqToNo( int num /*sequential number */) { if( (pm.flag == 0) || (num >= pm.nptn) ) return( -1 ); @@ -123,8 +123,7 @@ int num; /* sequential number */ */ int -ptnNoToSq( ncode ) -int ncode; /* relative code */ +ptnNoToSq( int ncode /* relative code */) { int sq; @@ -149,8 +148,7 @@ int ncode; /* relative code */ */ int -codeToNo( code ) -int code; /* character code */ +codeToNo( int code /* character code */) { return( code - begin_code); } @@ -165,8 +163,7 @@ int code; /* character code */ */ int -noToCode( sno ) -int sno; /* relative code */ +noToCode( int sno /* relative code */) { return( sno + begin_code); } @@ -179,8 +176,7 @@ int sno; /* relative code */ */ int -codeCheck( code ) -int code; +codeCheck( int code ) { if (code < begin_code || code > last_code) { return( -1 ); @@ -196,11 +192,12 @@ int code; */ static int -ptnOpen(n, maxc, width, height) -int n; /* initial number of charcters */ -int maxc; -int width; /* pattern width */ -int height; /* pattern height */ +ptnOpen( +int n, /* initial number of charcters */ +int maxc, +int width, /* pattern width */ +int height /* pattern height */ +) { int i; int fpsize; @@ -218,12 +215,12 @@ int height; /* pattern height */ pm.nmaxptn = n + GUADDPTNN; pm.ptnsize = height * ((width+7)/8); 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 ); } - if(( pm.ctop = (USHORT *)calloc(maxc, sizeof(USHORT)) ) == NULL ) { + if(( pm.ctop = (unsigned short *)calloc(maxc, sizeof(unsigned short)) ) == NULL ) { free( pm.ntoc ); return( -1 ); } @@ -257,7 +254,7 @@ int height; /* pattern height */ */ int -ptnClose() +ptnClose(void) { if( pm.flag == 0 ) { return( -1 ); @@ -282,18 +279,18 @@ ptnClose() */ int -ptnAdd( code, ptn ) -int code; /* code to be add */ -char *ptn; /* pointer to the pattern */ +ptnAdd( +int code, /* code to be add */ +char *ptn) /* pointer to the pattern */ { int fpsize; int ncode; - USHORT pno; + unsigned short pno; char *pf; char *pp; int i; char *re_ptn; - UINT re_ptnmemsize; + unsigned int re_ptnmemsize; int cpn; if( pm.flag == 0 ) @@ -339,7 +336,7 @@ char *ptn; /* pointer to the pattern */ } pm.cptnnum = cpn; - pm.ctop[ncode] = (USHORT) cpn; + pm.ctop[ncode] = (unsigned short) cpn; pf = pm.ptn + fpsize*cpn; pp = pf + 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] = (USHORT) ncode; + pm.ntoc[i+1] = (unsigned short) ncode; pm.nptn += 1; return( 1 ); @@ -366,13 +363,11 @@ char *ptn; /* pointer to the pattern */ */ int -ptnGet( code, ptn ) -int code; -char *ptn; +ptnGet( int code, char *ptn ) { int ncode; int fpsize; - USHORT pno; + unsigned short pno; char *pf; char *pp; int i; @@ -404,8 +399,7 @@ char *ptn; */ int -ptnSense( code ) -int code; +ptnSense( int code ) { if( (pm.flag == 0) || (codeCheck(code) == -1) ) return( -1 ); @@ -425,12 +419,11 @@ int code; */ int -ptnDel( code ) -int code; +ptnDel( int code ) { int ncode; int fpsize; - USHORT pno; + unsigned short pno; char *pf; int i; @@ -468,10 +461,10 @@ int code; */ int -ptnGetInfo( n, width, height ) -int *n; /* the number of characters in editting */ -int *width; /* pattern width */ -int *height; /* pattern height */ +ptnGetInfo( +int *n, /* the number of characters in editting */ +int *width, /* pattern width */ +int *height) /* pattern height */ { if( pm.flag == 0 ) return( -1 ); @@ -500,9 +493,9 @@ struct { /* infomation of character pattern */ */ static void -bitSetInfo( width, height) -int width; /* pattern width */ -int height; /* pattern height */ +bitSetInfo( +int width, /* pattern width */ +int height) /* pattern height */ { bitInfo.width = width; bitInfo.height = height; @@ -517,10 +510,7 @@ int height; /* pattern height */ */ void -bitSet( ptn, cx, cy ) -char *ptn; -int cx; -int cy; +bitSet( char *ptn, int cx, int cy ) { if((cx < 0) || (bitInfo.width <= cx) || (cy < 0) || (bitInfo.height <= cy)) return; @@ -533,10 +523,7 @@ int cy; */ void -bitReset( ptn, cx, cy ) -char *ptn; -int cx; -int cy; +bitReset( char *ptn, int cx, int cy ) { if((cx < 0) || (bitInfo.width <= cx) || (cy < 0) || (bitInfo.height <= cy)) return; @@ -549,10 +536,7 @@ int cy; */ int -bitRead( ptn, cx, cy ) -char *ptn; -int cx; -int cy; +bitRead( char *ptn, int cx, int cy ) { if((cx < 0) || (bitInfo.width <= cx) || (cy < 0) || (bitInfo.height <= cy)) return( 0 ); @@ -568,8 +552,7 @@ int cy; */ void -bitPtnClear( ptn ) -char *ptn; +bitPtnClear( char *ptn ) { int i; @@ -583,9 +566,9 @@ char *ptn; */ void -bitPtnCopy( d_ptn, s_ptn ) -char *d_ptn; /* pointer of the destination file */ -char *s_ptn; /* pointer of the source file */ +bitPtnCopy( +char *d_ptn, /* pointer of the destination file */ +char *s_ptn) /* pointer of the source file */ { int i; @@ -608,13 +591,13 @@ char *s_ptn; /* pointer of the source file */ */ int -bitDrawLine( ptn, x1, y1, x2, y2 ,mode ) -char *ptn; /* pointer of the bit map file */ -int x1; -int y1; -int x2; -int y2; -int mode; /* 0: erase 1: draw */ +bitDrawLine( +char *ptn, /* pointer of the bit map file */ +int x1, +int y1, +int x2, +int y2, +int mode) /* 0: erase 1: draw */ { float dx, dy; float x, y; @@ -655,13 +638,13 @@ int mode; /* 0: erase 1: draw */ */ int -bitDrawCircle( ptn, x1, y1, x2, y2, mode ) -char *ptn; -int x1; -int y1; -int x2; -int y2; -int mode; +bitDrawCircle( +char *ptn, +int x1, +int y1, +int x2, +int y2, +int mode) { int dx, dy; int i,x; @@ -708,13 +691,13 @@ int mode; */ int -bitDrawRect( ptn, x, y, width, height, mode ) -char *ptn; -int x; -int y; -int width; -int height; -int mode; +bitDrawRect( +char *ptn, +int x, +int y, +int width, +int height, +int mode) { int i; @@ -757,12 +740,12 @@ int mode; */ int -bitDrawCls( ptn, x, y, width, height ) -char *ptn; -int x; -int y; -int width; -int height; +bitDrawCls( +char *ptn, +int x, +int y, +int width, +int height) { int i, j; @@ -789,12 +772,12 @@ int height; */ int -bitDrawSet( ptn, x, y, width, height ) -char *ptn; -int x; -int y; -int width; -int height; +bitDrawSet( +char *ptn, +int x, +int y, +int width, +int height) { int i, j; @@ -820,12 +803,12 @@ int height; */ int -bitDrawRev( ptn, x, y, width, height ) -char *ptn; -int x; -int y; -int width; -int height; +bitDrawRev( +char *ptn, +int x, +int y, +int width, +int height) { int i, j; @@ -859,13 +842,13 @@ static int cut_buffer_h=0; */ int -bitDrawCpy(ptn, sx, sy, width, height, cut_flag) -char *ptn; -int sx; -int sy; -int width; -int height; -int cut_flag; +bitDrawCpy( +char *ptn, +int sx, +int sy, +int width, +int height, +int cut_flag) { int i, j; @@ -890,10 +873,7 @@ int cut_flag; } int -bitDrawPaste(ptn, dx, dy) -char *ptn; -int dx; -int dy; +bitDrawPaste(char *ptn, int dx, int dy) { int i, j; int width, height; @@ -927,12 +907,7 @@ int dy; */ int -bitDrawRoll( ptn, x, y, width, height ) -char *ptn; -int x; -int y; -int width; -int height; +bitDrawRoll(char *ptn, int x, int y, int width, int height) { char *point; int xx, yy; @@ -970,12 +945,7 @@ int height; */ int -bitDrawSymV( ptn, x, y, width, height ) -char *ptn; -int x; -int y; -int width; -int height; +bitDrawSymV( char *ptn, int x, int y, int width, int height ) { int k, j; int d1, d2; @@ -1009,12 +979,7 @@ int height; */ int -bitDrawSymH( ptn, x, y, width, height ) -char *ptn; -int x; -int y; -int width; -int height; +bitDrawSymH( char *ptn, int x, int y, int width, int height ) { int k, j; int d1, d2; @@ -1070,11 +1035,7 @@ char_set(char *str) * -2 : file is locked */ int -readSNF(fdata, width, height, err) -FalFontData **fdata; -int *width; -int *height; -char *err; +readSNF(FalFontData **fdata, int *width, int *height, char *err) { FalFontinfo finfo; int start, end; @@ -1300,22 +1261,15 @@ char *err; } static void -bicopy(s1, s2, size) -char *s1, *s2; -int size; +bicopy(char *s1, char *s2, int size) { - register int i; + int i; for(i=size; i; i--, s1++, s2++) *s2 = *s1; } int -copySNF(start, end, ptn, num, err) -int start; -int end; -char ***ptn; -int *num; -char *err; +copySNF(int start, int end, char ***ptn, int *num, char *err) { FalFontID fid; int mask; @@ -1395,9 +1349,7 @@ char *err; } void -freeSNF(addr, count) -char **addr; -int count; +freeSNF(char **addr, int count) { char **p; for (p=addr; count; count--, p++) @@ -1417,9 +1369,9 @@ static int sig_flg = 0; /* flag for signal */ */ int -writeSNF( restart, err ) -int restart; /* ON:continue OFF:initial */ -int *err; /* errors : */ +writeSNF( +int restart, /* ON:continue OFF:initial */ +int *err) /* errors : */ { static int pfstdi[2]; static FILE *fstdi; @@ -1481,19 +1433,22 @@ int *err; /* errors : */ case 0: close( 0 ); /** 0 ... stdin **/ - dup( pfstdi[0] ); - close( pfstdi[0] ); - close( pfstdi[1] ); - argv[0] = resource.l_ptog_cmd; - argv[1] = "-codeset"; - argv[2] = code_set; - argv[3] = "-xlfd"; - argv[4] = fullFontData.xlfdname; - argv[5] = "-init"; - argv[6] = "-f"; - argv[7] = NULL; - execv (command, argv ); - exit( 103 ); + if( dup( pfstdi[0] ) == -1){ + return -1; + } else { + close( pfstdi[0] ); + close( pfstdi[1] ); + argv[0] = resource.l_ptog_cmd; + argv[1] = "-codeset"; + argv[2] = code_set; + argv[3] = "-xlfd"; + argv[4] = fullFontData.xlfdname; + argv[5] = "-init"; + argv[6] = "-f"; + argv[7] = NULL; + execv (command, argv ); + exit( 103 ); + } } @@ -1567,7 +1522,7 @@ int *err; /* errors : */ */ static void -sig_receive() +sig_receive(void) { sig_flg = 1; return; @@ -1579,11 +1534,7 @@ sig_receive() */ static void -writePtn(ptn, width, height, fp) -char *ptn; -int width; -int height; -FILE *fp; +writePtn(char *ptn, int width, int height, FILE *fp) { int i, j, k; int nbyte; diff --git a/cde/programs/dtudcfonted/cpyw.c b/cde/programs/dtudcfonted/cpyw.c index 2cae1422..b028be32 100644 --- a/cde/programs/dtudcfonted/cpyw.c +++ b/cde/programs/dtudcfonted/cpyw.c @@ -47,10 +47,10 @@ extern Widget cpyDialog; ** ================================================================== **/ -void PopdownCpyPtn(); -void DoCpyProc(); -void CpyPtnCB(); -void CpyCB(); +void PopdownCpyPtn(void); +void DoCpyProc(void); +void CpyPtnCB(void); +void CpyCB(Widget w, XtPointer cdata); /* static */ TextField SrcTf; /* static */ TextField DestTf; @@ -64,7 +64,7 @@ void CpyCB(); **/ void -InitCpyPtn() +InitCpyPtn(void) { /* initialize font infomation */ } @@ -77,7 +77,7 @@ InitCpyPtn() **/ void -CpyPtnCB() +CpyPtnCB(void) { extern void CpyPtnXLFD(); CpyPtnXLFD(); @@ -90,7 +90,7 @@ CpyPtnCB() **/ void -PopdownCpyPtn() +PopdownCpyPtn(void) { ForcePopdownDialog(cpyDialog); } @@ -102,7 +102,7 @@ PopdownCpyPtn() **/ String -CpySrcCodeTfValue() +CpySrcCodeTfValue(void) { return(GetTextFieldValue(&SrcTf)); } @@ -114,7 +114,7 @@ CpySrcCodeTfValue() **/ String -CpyDestCodeTfValue() +CpyDestCodeTfValue(void) { return(GetTextFieldValue(&DestTf)); } @@ -126,8 +126,7 @@ CpyDestCodeTfValue() **/ void -PopupCpyNotice( message ) -String message; +PopupCpyNotice( String message ) { char bmsg[512] = ""; @@ -152,9 +151,7 @@ String message; /*ARGSUSED*/ void -CpyCB(w, cdata) -Widget w; -XtPointer cdata; +CpyCB(Widget w, XtPointer cdata) { extern Boolean BeforeCpyCheck(); if (BeforeCpyCheck(cdata)){ @@ -176,7 +173,7 @@ XtPointer cdata; **/ static void -PopdownMngPtn() +PopdownMngPtn(void) { PopdownDialog(mngPtnW); } @@ -187,7 +184,7 @@ PopdownMngPtn() **/ static void -AddCB() +AddCB(void) { int s_code, e_code; extern Boolean BeforeMngCheck(); @@ -205,7 +202,7 @@ AddCB() **/ static void -DelCB() +DelCB(void) { int s_code, e_code; extern void DoDelProc(); @@ -231,7 +228,7 @@ static TextField MngCodeTf; **/ void -MngPtnCB() +MngPtnCB(void) { if (! mngPtnW){ 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 -MngCodeTfValue() +MngCodeTfValue(void) { return(GetTextFieldValue(&MngCodeTf)); } @@ -286,8 +284,7 @@ static Widget dnStaT_code[D_MAX], dnBulB_disp[D_MAX], dnPopW; **/ void -PopupDelNotice( owner ) -Widget owner; +PopupDelNotice( Widget owner ) { int i; Widget delNoticeW = NULL; @@ -315,7 +312,7 @@ Widget owner; **/ static void -dstrypaneDelNotice() +dstrypaneDelNotice(void) { int i; @@ -331,7 +328,7 @@ dstrypaneDelNotice() **/ static void -DelOkCB() +DelOkCB(void) { CBdnOblB_del(); PopdownMngPtn(); @@ -344,8 +341,7 @@ DelOkCB() **/ static void -delScProc( value ) -int value; +delScProc( int value ) { int i; extern int RelToAbsSq(); @@ -364,8 +360,7 @@ int value; **/ static Widget -CreateDelNotice(owner) -Widget owner; +CreateDelNotice(Widget owner) { Widget form, listBase, itemform[D_MAX]; char buf[64]; @@ -441,7 +436,7 @@ Widget owner; **/ static void -CBdnOblB_del() +CBdnOblB_del(void) { int code; /* code number for check */ int ncode; /* sequential number in the codeset system area */ @@ -515,8 +510,7 @@ CBdnOblB_del() **/ static void -drawDelPtn( i ) -int i; /* window number */ +drawDelPtn( int i /* window number */) { if ( RelToAbsSq( dn.sq_top, i) <= dn.sq_end) { ptnGet( noToCode(ptnSqToNo(RelToAbsSq( dn.sq_top, i))), @@ -536,8 +530,7 @@ int i; /* window number */ **/ static void -drawDelCode( i ) -int i; /* window number */ +drawDelCode( int i /* window number */) { char str[20]; @@ -557,9 +550,7 @@ int i; /* window number */ /*ARGSUSED*/ static void -EHdnBulB_disp( widget, i ) -Widget widget; -int i; /* widget that have some ivent */ +EHdnBulB_disp( Widget widget, int i /* widget that have some ivent */ ) { drawDelPtn( i ); } @@ -578,10 +569,7 @@ int i; /* widget that have some ivent */ **/ static void -DispErrorMessage( owner, title, msg ) -Widget owner; -String title; -String msg; +DispErrorMessage( Widget owner, String title, String msg ) { static NoticeButton buttons[] = { NBTNARGS( NULL, NULL, NULL, True, False ), @@ -599,8 +587,7 @@ String msg; **/ void -DispMngErrorMessage( msg ) -String msg; +DispMngErrorMessage( String msg ) { DispErrorMessage( mngPtnW, resource.l_error_title, msg ); } @@ -612,8 +599,7 @@ String msg; **/ void -DispCpyErrorMessage( msg ) -String msg; +DispCpyErrorMessage( String msg ) { DispErrorMessage( cpyPtnW, resource.l_error_title, msg ); } diff --git a/cde/programs/dtudcfonted/cpyx.c b/cde/programs/dtudcfonted/cpyx.c index 957bf49c..0de53a71 100644 --- a/cde/programs/dtudcfonted/cpyx.c +++ b/cde/programs/dtudcfonted/cpyx.c @@ -62,20 +62,29 @@ extern XtPointer _XmStringUngenerate (XmString string, #endif #include "pixmaps/arrow.pm" -static Widget CreateCopyXLFD() ; -static void CpyXLFDCB() ; - -extern int CreateOtherLabelAndText(); -extern Widget xlfdCreateScrolledList(); -extern int GetItemsToDisplay(); - -extern void xlfdPopupDialog(); - -extern void InitCpyPtn() ; -extern void _unmap(); -extern void CpyCB() ; -extern void PopdownCpyPtn() ; -extern void AddPopupProc() ; +static Widget CreateCopyXLFD(Widget Top); +static void CpyXLFDCB(Widget w, caddr_t client_data, caddr_t *call_data); + +extern int CreateOtherLabelAndText(int num, + Widget owner, + 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(Widget w); + +extern void InitCpyPtn(void); +extern void _unmap(void); +extern void CpyCB(Widget w, XtPointer cdata); +extern void PopdownCpyPtn(void); +extern void AddPopupProc(Widget w, void(*popupcb)()); extern FalFontData fullFontData; @@ -139,9 +148,7 @@ static Widget focus_widget=NULL; /*ARGSUSED*/ static void -CpyXLFDCB(w, client_data, call_data) -Widget w; -caddr_t client_data, *call_data; +CpyXLFDCB(Widget w, caddr_t client_data, caddr_t *call_data) { char *str; XmStringTable st; @@ -162,7 +169,7 @@ caddr_t client_data, *call_data; void -CpyPtnXLFD() +CpyPtnXLFD(void) { if( cpyDialog == NULL ) { @@ -199,7 +206,7 @@ CpyPtnXLFD() static void -create_xlfd() +create_xlfd(void) { int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; FalFontData key; @@ -239,8 +246,7 @@ create_xlfd() } static void -udc_call(w) -Widget w; +udc_call(Widget w) { XmString label; char *moji; @@ -269,8 +275,7 @@ Widget w; } static void -sty_call(w) -Widget w; +sty_call(Widget w) { XmString label; char *moji; @@ -294,8 +299,7 @@ Widget w; } static void -wls_call(w) -Widget w; +wls_call(Widget w) { XmString label; char *moji; @@ -315,8 +319,7 @@ Widget w; } static void -hls_call(w) -Widget w; +hls_call(Widget w) { XmString label; char *moji; @@ -336,7 +339,7 @@ Widget w; } static void -button_set1() +button_set1(void) { int i, j; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; @@ -385,7 +388,7 @@ button_set1() } static void -button_set2() +button_set2(void) { int i, j; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; @@ -434,7 +437,7 @@ button_set2() } static void -button_set3() +button_set3(void) { int i, j; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; @@ -483,7 +486,7 @@ button_set3() } static void -button_set4() +button_set4(void) { int i, j; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; @@ -533,7 +536,7 @@ button_set4() static void -font_init() +font_init(void) { FalFontDataList *fontlist; FalFontData *f; @@ -675,9 +678,7 @@ font_init() /*ARGSUSED*/ static void -arrow_change(w, wid) -Widget w; -Widget wid; +arrow_change(Widget w, Widget wid) { if (XtIsSensitive(wid)) { XtSetSensitive(wid, False); @@ -687,14 +688,13 @@ Widget wid; } static void -focus(w) -Widget w; +focus(Widget w) { focus_widget = w; } static void -code_input() +code_input(void) { char *str; XmStringTable st; @@ -708,15 +708,14 @@ code_input() } static void -code_input2() +code_input2(void) { extern void CodeWindow(); CodeWindow(codeText[2], fullFontData.xlfdname, False); } static Widget -CreateCopyXLFD( top ) -Widget top ; +CreateCopyXLFD( Widget top ) { int n; diff --git a/cde/programs/dtudcfonted/dtaddcpf/addcpf.c b/cde/programs/dtudcfonted/dtaddcpf/addcpf.c index 77149555..2504d992 100644 --- a/cde/programs/dtudcfonted/dtaddcpf/addcpf.c +++ b/cde/programs/dtudcfonted/dtaddcpf/addcpf.c @@ -52,7 +52,7 @@ #include #include -#include "fontstruct.h" +#include #include "FaLib.h" #include "snfstruct.h" @@ -61,20 +61,65 @@ #include -static int rw_init() ; -static int readSnf() ; -static int readSnf_with_init() ; -static int readSnfHeader() ; -static int readBdfHeaderAndPut() ; -static int mergePtn() ; -static int ModifyPtn() ; -static int InsertPtn() ; -static int writeSnf() ; -static void put_error_and_exit(); -static void put_help(); -static int readBdfToMemory_with_init() ; - -extern int fal_glyph_to_code() ; +static int rw_init(struct ptobhead *r_gpf, + struct btophead *r_snf, + struct ptobhead *w_snf, + int init_all); +static int readSnf(struct ptobhead *r_gpf, + struct btophead *r_snf, + struct ptobhead *w_snf, + char *buf); +static int readSnf_with_init(struct ptobhead *r_gpf, + struct btophead *r_snf, + struct ptobhead *w_snf, + 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(char *locale, + char *charset_str, + int codeset, + unsigned long glyph_index, + unsigned long *codepoint); static struct ptobhead WriteSnf; @@ -86,14 +131,15 @@ static char *util_locale ; static pid_t gtob_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 ; #else static union wait chld_stat ; #endif static void -sigint_out() +sigint_out(void) { if (WriteSnf.out_file) { Unlink_Tmpfile( WriteSnf.out_file, com ); @@ -101,9 +147,7 @@ sigint_out() exit( 0 ); } -main( argc, argv ) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { int code_area , init, modify, help, no_infile, no_style; int fupd = 0 ; @@ -433,11 +477,11 @@ char *argv[]; } static -rw_init(r_gpf, r_snf, w_snf, init_all ) -struct ptobhead *r_gpf; -struct btophead *r_snf; -struct ptobhead *w_snf; -int init_all; +rw_init( +struct ptobhead *r_gpf, +struct btophead *r_snf, +struct ptobhead *w_snf, +int init_all) { FontInfoRec *finf; int fd[2], snf_fd, permission; @@ -458,13 +502,7 @@ int init_all; /* SNF format */ if ( ChkPcfFontFile( w_snf->snf_file ) ) { - permission = 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; } } @@ -554,11 +592,11 @@ int init_all; static -readSnf(r_gpf, r_snf, w_snf, buf) -struct ptobhead *r_gpf; -struct btophead *r_snf; -struct ptobhead *w_snf; -char *buf; +readSnf( +struct ptobhead *r_gpf, +struct btophead *r_snf, +struct ptobhead *w_snf, +char *buf) { int nchar, rtn; @@ -580,14 +618,14 @@ char *buf; } static -readSnf_with_init(r_gpf, r_snf, w_snf, init, buf, num_gr, gr ) -struct ptobhead *r_gpf; -struct btophead *r_snf; -struct ptobhead *w_snf; -int init; -char *buf; -int num_gr ; -FalGlyphRegion *gr ; +readSnf_with_init( +struct ptobhead *r_gpf, +struct btophead *r_snf, +struct ptobhead *w_snf, +int init, +char *buf, +int num_gr, +FalGlyphRegion *gr) { int nchar, rtn; @@ -611,11 +649,11 @@ FalGlyphRegion *gr ; static -readSnfHeader(r_gpf, r_snf, w_snf, buf) -struct ptobhead *r_gpf; -struct btophead *r_snf; -struct ptobhead *w_snf; -char *buf; +readSnfHeader( +struct ptobhead *r_gpf, +struct btophead *r_snf, +struct ptobhead *w_snf, +char *buf) { int rtn; @@ -635,10 +673,7 @@ char *buf; } static -readBdfHeaderAndPut(r_snf, w_snf, buf) -struct btophead *r_snf; -struct ptobhead *w_snf; -char *buf; +readBdfHeaderAndPut(struct btophead *r_snf, struct ptobhead *w_snf, char *buf) { char *p; int getstat = 0; @@ -695,17 +730,17 @@ char *buf; } static -mergePtn(com, r_gpf, r_snf, buf, code_area, modify, prog_name, num_gr, gr, code_no) -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 ; +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) { int code, rtn, msize, i, j, dspcode; char *ptn; @@ -744,8 +779,11 @@ int code_no ; ) { 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 ); - fgets(buf, BUFSIZE, r_gpf->input); - continue; + if( fgets(buf, BUFSIZE, r_gpf->input) == NULL){ + return -1; + } else { + continue; + } } for ( j = 0; j < r_snf->num_chars; j++ ) { @@ -753,8 +791,11 @@ int code_no ; if ( !modify ) { 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 ); - fgets( buf, BUFSIZE, r_gpf->input ); - break; + if(fgets( buf, BUFSIZE, r_gpf->input ) == NULL){ + return -1; + } else { + break; + } } if ( ( rtn = ModifyPtn( r_gpf, r_snf, buf, j ) ) ) { return rtn; @@ -778,11 +819,11 @@ int code_no ; static -ModifyPtn( r_gpf, r_snf, buf, ix ) -struct ptobhead *r_gpf; -struct btophead *r_snf; -char *buf; -int ix; +ModifyPtn( +struct ptobhead *r_gpf, +struct btophead *r_snf, +char *buf, +int ix) { int mwidth, msize, rtn; @@ -807,12 +848,12 @@ int ix; } static -InsertPtn( r_gpf, r_snf, buf, code, ix ) -struct ptobhead *r_gpf; -struct btophead *r_snf; -char *buf; -int code; -int ix; +InsertPtn( +struct ptobhead *r_gpf, +struct btophead *r_snf, +char *buf, +int code, +int ix) { int mwidth, msize, rtn, i; @@ -851,9 +892,7 @@ int ix; } static -writeSnf( r_snf, w_snf ) -struct btophead *r_snf; -struct ptobhead *w_snf; +writeSnf(struct btophead *r_snf, struct ptobhead *w_snf) { w_snf->zoomf = 0; w_snf->num_chars = r_snf->num_chars; @@ -874,12 +913,12 @@ struct ptobhead *w_snf; static void -put_error_and_exit(ptob_in, btop, ptob_out, er_no, prog_name) -struct ptobhead *ptob_in; -struct btophead *btop; -struct ptobhead *ptob_out; -int er_no; -char *prog_name; +put_error_and_exit( +struct ptobhead *ptob_in, +struct btophead *btop, +struct ptobhead *ptob_out, +int er_no, +char *prog_name) { ErrMsgTable_AndExit( er_no, ptob_in->in_file, ptob_out->out_file, btop->in_file, NULL, @@ -892,8 +931,7 @@ char *prog_name; static void -put_help( prog_name ) -char *prog_name; +put_help(char *prog_name) { USAGE1("Usage: %s -xlfd xlfd_name \n", prog_name); 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); USAGE("codeset \t\tcode area\n"); USAGE("----------------------------------------\n"); - DispUdcCpArea() ; + DispUdcCpArea(stdout) ; USAGE("The xlfd name and character size may be obtained using dtlsgpf command.\n"); return; } @@ -912,12 +950,12 @@ char *prog_name; static int -readBdfToMemory_with_init(head, init, buf, num_gr, gr ) -struct btophead *head; -int init; -char *buf; -int num_gr ; -FalGlyphRegion *gr ; +readBdfToMemory_with_init( +struct btophead *head, +int init, +char *buf, +int num_gr, +FalGlyphRegion *gr) { int code, mwidth, num_char, bsize, rtn ; char *ptn; diff --git a/cde/programs/dtudcfonted/dtbdftocpf/bdftocpf.c b/cde/programs/dtudcfonted/dtbdftocpf/bdftocpf.c index d3bc2072..f93abd29 100644 --- a/cde/programs/dtudcfonted/dtbdftocpf/bdftocpf.c +++ b/cde/programs/dtudcfonted/dtbdftocpf/bdftocpf.c @@ -39,16 +39,16 @@ #include "bdfgpf.h" #include "udcutil.h" -static void put_error(); -static void put_help() ; -static void Usage() ; -static void sigint_out() ; -static int CnvBDFtoGPF() ; +static void put_error(struct btophead *head, int er_no, char *prog_name); +static void put_help(char *prog_name); +static void Usage(char *prog_name) ; +static void sigint_out(void) ; +static int CnvBDFtoGPF(struct btophead *head) ; static struct btophead Head; static void -sigint_out() +sigint_out(void) { if (Head.out_file) { unlink(Head.out_file); @@ -56,9 +56,7 @@ sigint_out() exit(0); } -main(argc, argv) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { int rtn, i; char *GetTmpPath(); @@ -190,8 +188,7 @@ char *argv[]; } static -CnvBDFtoGPF(head) -struct btophead *head; +CnvBDFtoGPF( struct btophead *head) { char bdfbuf[BUFSIZE]; int rtn; @@ -235,10 +232,7 @@ struct btophead *head; } static void -put_error(head, er_no, prog_name) -struct btophead *head; -int er_no; -char *prog_name; +put_error(struct btophead *head, int er_no, char *prog_name) { switch(er_no) { case FATAL_ERROR : @@ -276,16 +270,14 @@ char *prog_name; } static void -put_help(prog_name) -char *prog_name; +put_help(char *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"); } static void -Usage(prog_name) -char *prog_name; +Usage(char *prog_name) { put_help(prog_name); exit(PARAM_ERROR * (-1)); diff --git a/cde/programs/dtudcfonted/dtcpftobdf/cpftobdf.c b/cde/programs/dtudcfonted/dtcpftobdf/cpftobdf.c index c98479b7..ba837d0d 100644 --- a/cde/programs/dtudcfonted/dtcpftobdf/cpftobdf.c +++ b/cde/programs/dtudcfonted/dtcpftobdf/cpftobdf.c @@ -37,16 +37,16 @@ #include "bdfgpf.h" #include "udcutil.h" -static void put_error(); -static void put_help() ; -static void Usage() ; -static int CnvGPFtoBDF() ; -static void sigint_out() ; +static void put_error(struct ptobhead *head, int er_no, char *prog_name); +static void put_help(char *prog_name); +static void Usage(char *prog_name); +static int CnvGPFtoBDF(struct ptobhead *head) ; +static void sigint_out(void) ; static struct ptobhead Head; static void -sigint_out() +sigint_out(void) { if ( Head.out_file ) { unlink( Head.out_file ); @@ -54,9 +54,7 @@ sigint_out() exit( 0 ); } -main( argc, argv ) -int argc; -char *argv[]; +int main( int argc, char *argv[]) { int rtn, i; char *GetTmpPath(); @@ -184,8 +182,7 @@ char *argv[]; } static -CnvGPFtoBDF( head ) -struct ptobhead *head; +CnvGPFtoBDF(struct ptobhead *head) { char textbuf[BUFSIZE] ; int rtn ; @@ -226,10 +223,7 @@ struct ptobhead *head; } static void -put_error( head, er_no, prog_name ) -struct ptobhead *head; -int er_no; -char *prog_name; +put_error(struct ptobhead *head, int er_no, char *prog_name) { switch( er_no ) { case FATAL_ERROR: @@ -274,16 +268,14 @@ char *prog_name; } static void -put_help( prog_name ) -char *prog_name; +put_help( char *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"); } static void -Usage( prog_name ) -char *prog_name; +Usage( char *prog_name) { put_help( prog_name ); exit( PARAM_ERROR * (-1) ); diff --git a/cde/programs/dtudcfonted/dtcpftogpf/cpftogpf.c b/cde/programs/dtudcfonted/dtcpftogpf/cpftogpf.c index 4bd2646f..c5b475d6 100644 --- a/cde/programs/dtudcfonted/dtcpftogpf/cpftogpf.c +++ b/cde/programs/dtudcfonted/dtcpftogpf/cpftogpf.c @@ -53,7 +53,7 @@ #include "bdfgpf.h" #include "snfstruct.h" -#include "fontstruct.h" +#include #include "FaLib.h" #include "udcutil.h" @@ -61,10 +61,12 @@ #include -static void sigint_out() ; -static void put_error_and_exit(); -static void put_help(); -static int CnvGPFtoBDF() ; +static void sigint_out(void); +static void put_error_and_exit(struct ptobhead *ptob, + int er_no, + char *prog_name); +static void put_help(char *prog_name); +static int CnvGPFtoBDF(struct ptobhead *head); static struct ptobhead Head; @@ -75,7 +77,7 @@ static char *char_set ; static void -sigint_out() +sigint_out(void) { if (Head.out_file) { Unlink_Tmpfile(Head.out_file, com); @@ -83,9 +85,7 @@ sigint_out() exit(0); } -main( argc, argv ) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { FontInfoRec *finf; int help, no_infile, style_err, rtn, i; @@ -96,7 +96,8 @@ char *argv[]; char *style ; /* style */ int chk_fd; 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 ; #else union wait chld_stat ; @@ -282,15 +283,8 @@ char *argv[]; put_error_and_exit( &Head, MKTMP_ERROR, argv[0] ); } - permission = 0; if ( ( snf_fd = open( Head.snf_file, O_RDONLY ) ) >= 0 ) { 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 */ close( snf_fd ); } @@ -396,8 +390,7 @@ char *argv[]; static -CnvGPFtoBDF( head ) -struct ptobhead *head; +CnvGPFtoBDF(struct ptobhead *head) { int rtn; char textbuf[BUFSIZE]; @@ -439,10 +432,7 @@ struct ptobhead *head; static void -put_error_and_exit( ptob, er_no, prog_name ) -struct ptobhead *ptob; -int er_no; -char *prog_name; +put_error_and_exit(struct ptobhead *ptob, int er_no, char *prog_name) { ErrMsgTable_AndExit( er_no, ptob->snf_file, ptob->out_file, ptob->in_file, NULL, @@ -454,8 +444,7 @@ char *prog_name; static void -put_help( prog_name ) -char *prog_name; +put_help(char *prog_name) { USAGE1("Usage: %s -xlfd xlfd_name\n", prog_name); USAGE("\t\t[-g character_size][-p character_pattern_file_name]\n" ); diff --git a/cde/programs/dtudcfonted/dtcpgpf/cpgpf.c b/cde/programs/dtudcfonted/dtcpgpf/cpgpf.c index 715e0850..33b030eb 100644 --- a/cde/programs/dtudcfonted/dtcpgpf/cpgpf.c +++ b/cde/programs/dtudcfonted/dtcpgpf/cpgpf.c @@ -52,7 +52,7 @@ #include #include -#include "fontstruct.h" +#include #include "FaLib.h" #include "snfstruct.h" @@ -68,26 +68,63 @@ #define RESIZE_BY_RATE( a, r ) ((int)( (float)(a) * (r))) #define DEF_RESOLUTION ((78 / 72.27) * 100) -static void put_error_and_exit(); -static void put_help(); -static void sigint_out() ; -static void getDefaultCh() ; -static void MkFontProp() ; - -static int CpyGpfInit() ; -static int writeGpf() ; -static int check_width() ; -static int check_height() ; -static int check_width_height() ; -static int getGpfFileName() ; -static int readGpf() ; -static int readBdfHeaderAndPut() ; -static int check_code() ; -static int readBdfToMemory() ; -static int cpg_atoi() ; -static int is_in_udcregion() ; - -extern int fal_code_to_glyph() ; +static void put_error_and_exit(struct btophead *ptob_in, + struct ptobhead *ptob_out, + int er_no, + char *prog_name); +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(struct btophead *i_gpf, + struct btophead *o_gpf, + struct ptobhead *w_gpf, + int type); +static int writeGpf(struct btophead *i_gpf, + struct btophead *o_gpf, + struct ptobhead *w_gpf); +static int check_width(char *prog_name, char *len_str); +static int check_height(char *prog_name, char *len_str); +static int check_width_height(char *prog_name, char *len_str, int mode); +static int getGpfFileName(char *com, + 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(char *locale, + unsigned long codepoint, + FalGIInf **gi, + int *num_gi); static struct ptobhead WriteGpf; @@ -103,7 +140,7 @@ static char *xlfdname ; static void -sigint_out() +sigint_out(void) { if (WriteGpf.out_file) { Unlink_Tmpfile( WriteGpf.out_file, com ); @@ -112,9 +149,7 @@ sigint_out() } -main( argc, argv ) -int argc; -char **argv ; +int main(int argc, char **argv) { int code_area , help, no_infile, no_style, type ; int rtn, i, exit_code ; @@ -538,14 +573,14 @@ char **argv ; static int -getGpfFileName( com, gpfinf, code_area, code_no, xlfdname, snf_file, style ) -char *com ; -struct btophead *gpfinf ; -int code_area ; -int code_no ; -char *xlfdname ; -char *snf_file ; -char *style ; +getGpfFileName( +char *com, +struct btophead *gpfinf, +int code_area, +int code_no, +char *xlfdname, +char *snf_file, +char *style) { @@ -586,11 +621,11 @@ char *style ; static -CpyGpfInit(i_gpf, o_gpf, w_gpf, type ) -struct btophead *i_gpf; -struct btophead *o_gpf; -struct ptobhead *w_gpf; -int type ; +CpyGpfInit( +struct btophead *i_gpf, +struct btophead *o_gpf, +struct ptobhead *w_gpf, +int type) { FontInfoRec *finf; int ifd[2], ofd[2], snf_fd, permission; @@ -604,13 +639,7 @@ int type ; /* SNF format */ if( !new_target ){ if ( ChkPcfFontFile( w_gpf->snf_file ) ) { - permission = 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; } } @@ -733,12 +762,13 @@ int type ; static int -readGpf(i_gpf, buf, startcode, endcode, num_gr, gr) -struct btophead *i_gpf; -char *buf; -int startcode ; -int endcode ; -FalGlyphRegion *gr ; +readGpf( +struct btophead *i_gpf, +char *buf, +int startcode, +int endcode, +int num_gr, +FalGlyphRegion *gr) { int nchar, rtn; @@ -762,10 +792,7 @@ FalGlyphRegion *gr ; static int -readBdfHeaderAndPut(o_gpf, w_gpf, buf) -struct btophead *o_gpf; -struct ptobhead *w_gpf; -char *buf; +readBdfHeaderAndPut(struct btophead *o_gpf, struct ptobhead *w_gpf, char *buf) { FILE *fp ; char *p; @@ -886,10 +913,7 @@ char *buf; static -writeGpf( i_gpf, o_gpf, w_gpf ) -struct btophead *i_gpf; -struct btophead *o_gpf; -struct ptobhead *w_gpf; +writeGpf(struct btophead *i_gpf, struct btophead *o_gpf, struct ptobhead *w_gpf) { FILE *fp ; char rdbuf[BUFSIZE] ; @@ -936,27 +960,21 @@ struct ptobhead *w_gpf; static int -check_width( prog_name, len_str ) -char *prog_name; -char *len_str; +check_width(char *prog_name, char *len_str) { return( check_width_height( prog_name, len_str, 0) ); } static int -check_height( prog_name, len_str ) -char *prog_name; -char *len_str; +check_height(char *prog_name, char *len_str) { return( check_width_height( prog_name, len_str, 1) ); } static int -check_width_height( prog_name, len_str, mode ) -char *prog_name; -char *len_str; -int mode; /* width ... 0 , height ... 1 */ +check_width_height(char *prog_name, char *len_str, int mode) +/* width ... 0 , height ... 1 */ { int ret; char *tmp; @@ -983,13 +1001,13 @@ int mode; /* width ... 0 , height ... 1 */ static int -check_code( prog_name, code_str, mode, charset, num_gr, gr ) -char *prog_name; -char *code_str; -int mode; /* start_code ... 0, end_code ... 1 */ -char *charset ; -int num_gr ; -FalGlyphRegion *gr ; +check_code( +char *prog_name, +char *code_str, +int mode, /* start_code ... 0, end_code ... 1 */ +char *charset, +int num_gr, +FalGlyphRegion *gr) { int err_flg = 0; int code_num; @@ -1054,13 +1072,13 @@ FalGlyphRegion *gr ; static int -readBdfToMemory(head, buf, startcode, endcode, num_gr, gr) -struct btophead *head; -char *buf; -int startcode ; -int endcode ; -int num_gr ; -FalGlyphRegion *gr ; +readBdfToMemory( +struct btophead *head, +char *buf, +int startcode, +int endcode, +int num_gr, +FalGlyphRegion *gr) { int code, mwidth, num_char, bsize, rtn; char *ptn; @@ -1095,11 +1113,8 @@ FalGlyphRegion *gr ; static void -getDefaultCh( code ) -unsigned int code ; +getDefaultCh(unsigned int cbuf) { - unsigned int cbuf ; - cbuf = code ; if( (cbuf & 0xff) < firstCol ) firstCol = cbuf & 0xff ; if( (cbuf >> 8) < firstRow ) firstRow = cbuf >> 8 ; if( (cbuf & 0xff) > lastCol ) lastCol = cbuf & 0xff ; @@ -1108,8 +1123,7 @@ unsigned int code ; static int -cpg_atoi( numstr ) -char *numstr ; +cpg_atoi(char *numstr) { int val ; char *ep, *cbuf ; @@ -1123,9 +1137,7 @@ char *numstr ; } static int -is_in_udcregion( start, end, num_gr, gr ) -int start, end, num_gr ; -FalGlyphRegion *gr ; +is_in_udcregion( int start, int end, int num_gr, FalGlyphRegion *gr ) { int i ; if( start < gr[0].start && end < gr[0].start ){ @@ -1145,10 +1157,7 @@ FalGlyphRegion *gr ; static void -MkFontProp(font_height, font, output) -int font_height ; -char *font; -char *output; +MkFontProp(int font_height, char *font, char *output) { char fbuf[BUFSIZE], split[BUFSIZE] ; char *ep, *pix_sz, *point_sz, *rsl_x, *av_width, *char_set ; @@ -1177,11 +1186,11 @@ char *output; static void -put_error_and_exit(ptob_in, ptob_out, er_no, prog_name) -struct btophead *ptob_in; -struct ptobhead *ptob_out; -int er_no; -char *prog_name; +put_error_and_exit( +struct btophead *ptob_in, +struct ptobhead *ptob_out, +int er_no, +char *prog_name) { ErrMsgTable_AndExit( er_no, ptob_in->in_file, ptob_out->out_file, NULL, NULL, NULL, prog_name ); @@ -1191,8 +1200,7 @@ char *prog_name; static void -put_help( prog_name ) -char *prog_name; +put_help(char *prog_name) { USAGE1("Usage: %s -ixlfd oxlfd -oxlfd oxlfd\n", prog_name); 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); USAGE("codeset \t\tcode area\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("The xlfd name and character size may be obtained using dtlsgpf command.\n"); return; diff --git a/cde/programs/dtudcfonted/dtgpftobdf/bdftosnf.h b/cde/programs/dtudcfonted/dtgpftobdf/bdftosnf.h index f5f5f639..4a7b6f71 100644 --- a/cde/programs/dtudcfonted/dtgpftobdf/bdftosnf.h +++ b/cde/programs/dtudcfonted/dtgpftobdf/bdftosnf.h @@ -94,13 +94,6 @@ typedef struct _TempFont { # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */ # 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) # ifdef MIPSEL diff --git a/cde/programs/dtudcfonted/dtgpftobdf/gpftobdf.c b/cde/programs/dtudcfonted/dtgpftobdf/gpftobdf.c index 25ae6867..41db3ad3 100644 --- a/cde/programs/dtudcfonted/dtgpftobdf/gpftobdf.c +++ b/cde/programs/dtudcfonted/dtgpftobdf/gpftobdf.c @@ -36,14 +36,14 @@ #include #include #include -#include "font.h" -#include "misc.h" +#include #include #include #include +#include #include #include -#include "fontstruct.h" +#include #include "snfstruct.h" #include #include "bdftosnf.h" @@ -107,40 +107,80 @@ typedef struct prop_tmp { -static char *readfontfile(); -static void Anafprop(); -static void pSIZE(); -static void pPROPS(); -static void pCHARS(); -static void pfixCHARS(); -static int getarg(); - -static Bool seekToType() ; -static void getMetric() ; -static Bool getAccel() ; -static Bool getProperties() ; -static void putPtn() ; -static void ByteSwap() ; -static void invertBits() ; - -static int getINT16() ; -static int getINT32() ; -static CARD32 getLSB32(); -static char *make_toptn(); -static void pSIZE_pcf(); -static PcfTmp *openPcfFont(); -static void setProp(); -static void pPROPS_pcf(); -static void pCHARS_pcf(); -static void BitOrderInvert(); +static char *readfontfile(char *fname); +static void Anafprop(FontInfoRec *fip, + FontPropRec *fpropPtr, + char *fpropvnPtr, + char **fontname, + FontPropRec **fplistPtr, + 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(PCFTablePtr tables, + int ntables, + CARD32 type, + CARD32 *formatp, + CARD32 *sizep, + CARD32 *offsetp); +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(unsigned char *p, CARD32 format); +static int getINT32(unsigned char *p, CARD32 format); +static CARD32 getLSB32(unsigned char *p); +static char *make_toptn(int width, int height); +static void pSIZE_pcf(PropTmp *proptmp); +static PcfTmp *openPcfFont(char *fontname); +static void setProp(PcfTmp *pcf, PropTmp *proptmp); +static void pPROPS_pcf(PcfTmp *pcf); +static void pCHARS_pcf(PcfTmp *pcf, int fix); +static void BitOrderInvert(unsigned char *buf, int nbytes); static char *bufp,buf[2048]; -extern int ChkPcfFontFile(); +extern int ChkPcfFontFile(char *filename); -main( argc,argv ) -int argc; -char *argv[]; +int main( int argc, char *argv[] ) { int i,k; @@ -150,7 +190,7 @@ char *argv[]; CharInfoRec *cip, *wkcip; /* character information */ unsigned int glyphstotal; /* glyph */ unsigned int charInfoNum ; /* character information's number */ - unsigned int charNum; /* define character number */ + unsigned int charNum; /* define character number */ char *glyphPtr; /* glyph */ FontPropRec *fpropPtr,*fplistPtr; /* font property list */ FontPropRec psprop; /* point size property */ @@ -215,12 +255,6 @@ char *argv[]; if ( !isPcf ) { /* SNF format */ 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)); @@ -231,26 +265,16 @@ char *argv[]; charNum = charInfoNum ; wkcip = cip ; - glyphstotal = fip->maxbounds.byteOffset; - - glyphPad = (((fip->maxbounds.metrics.rightSideBearing - - fip->maxbounds.metrics.leftSideBearing)+31)/32)*4; + glyphPad = (((fip->maxbounds.rightSideBearing + - fip->maxbounds.leftSideBearing)+31)/32)*4; if ( fix == TRUE ) { for ( i = 0; i < charInfoNum; i++ ) { - if ( wkcip->exists == FALSE ) { - charNum-- ; - } wkcip++; } } else { glyphstotal = 0 ; for ( i = 0; i < charInfoNum; i++ ) { - if (wkcip->exists == FALSE) { - charNum-- ; - wkcip++; - continue; - } glyphstotal += (wkcip->metrics.ascent + wkcip->metrics.descent) * glyphPad; wkcip++; @@ -258,7 +282,7 @@ char *argv[]; } 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 ); pSIZE_pcf( &proptmp ); fprintf( stdout,"FONTBOUNDINGBOX %d %d %d %d\n", - pcf->info.maxbounds.metrics.rightSideBearing - - pcf->info.maxbounds.metrics.leftSideBearing, - pcf->info.maxbounds.metrics.ascent - + pcf->info.maxbounds.metrics.descent, - pcf->info.maxbounds.metrics.leftSideBearing, - - ( pcf->info.maxbounds.metrics.descent ) + pcf->info.maxbounds.rightSideBearing + - pcf->info.maxbounds.leftSideBearing, + pcf->info.maxbounds.ascent + + pcf->info.maxbounds.descent, + pcf->info.maxbounds.leftSideBearing, + - ( pcf->info.maxbounds.descent ) ); pPROPS_pcf( pcf ); if ( outLevel == FALSE ) { @@ -344,10 +368,8 @@ char *argv[]; /* * read to font file - * */ -static char *readfontfile( fname ) -char *fname; +static char *readfontfile( char *fname ) { int fd; char *fp = NULL; @@ -407,8 +429,7 @@ char *fname; #define getINT8( p ) ( *p++ ) ; static CARD32 -getLSB32( p ) -unsigned char *p; +getLSB32( unsigned char *p ) { CARD32 c; @@ -422,9 +443,7 @@ unsigned char *p; static int -getINT32( p, format ) -unsigned char *p; -CARD32 format; +getINT32( unsigned char *p, CARD32 format ) { CARD32 c; @@ -444,9 +463,7 @@ CARD32 format; } static int -getINT16( p, format ) -unsigned char *p; -CARD32 format; +getINT16( unsigned char *p, CARD32 format ) { CARD32 c; @@ -462,13 +479,13 @@ CARD32 format; } static Bool -seekToType( tables, ntables, type, formatp, sizep, offsetp) -PCFTablePtr tables; -int ntables; -CARD32 type; -CARD32 *formatp; -CARD32 *sizep; -CARD32 *offsetp; +seekToType( +PCFTablePtr tables, +int ntables, +CARD32 type, +CARD32 *formatp, +CARD32 *sizep, +CARD32 *offsetp) { int i; @@ -485,10 +502,7 @@ CARD32 *offsetp; static void -getMetric( buf, format, metric ) -caddr_t buf; -CARD32 format; -xCharInfo *metric; +getMetric( caddr_t buf, CARD32 format, xCharInfo *metric) { metric->leftSideBearing = getINT16( (unsigned char *)buf, format); buf += 2; @@ -505,13 +519,13 @@ xCharInfo *metric; } static Bool -getAccel( pFontInfo, maxink, buf_top, tables, ntables, type ) -FontInfoPtr pFontInfo; -xCharInfo *maxink; -caddr_t buf_top; -PCFTablePtr tables; -int ntables; -CARD32 type; +getAccel( +FontInfoPtr pFontInfo, +xCharInfo *maxink, +caddr_t buf_top, +PCFTablePtr tables, +int ntables, +CARD32 type) { CARD32 format; CARD32 size; @@ -549,28 +563,24 @@ CARD32 type; buffer += 4; - getMetric(buffer, format, &pFontInfo->minbounds.metrics); + getMetric(buffer, format, &pFontInfo->minbounds); buffer += 12; - getMetric(buffer, format, &pFontInfo->maxbounds.metrics); + getMetric(buffer, format, &pFontInfo->maxbounds); buffer += 12; if ( PCF_FORMAT_MATCH( format, PCF_ACCEL_W_INKBOUNDS ) ) { buffer += 12; getMetric( buffer, format, maxink); } else { - *maxink = pFontInfo->maxbounds.metrics; + *maxink = pFontInfo->maxbounds; } return TRUE; } static Bool -getProperties( pcf, buf_top, tables, ntables) -PcfTmp *pcf; -caddr_t buf_top; -PCFTablePtr tables; -int ntables; +getProperties(PcfTmp *pcf, caddr_t buf_top, PCFTablePtr tables, int ntables) { CARD32 format; CARD32 size; @@ -620,38 +630,40 @@ int ntables; static PcfTmp * -openPcfFont( fontname ) -char *fontname; +openPcfFont(char *fontname) { - PcfTmp *pcf_tmp; + PcfTmp *pcf_tmp; - CARD32 format; - CARD32 size; - CARD32 offset; - CARD32 *bitmapSizes; - xCharInfo maxink; - caddr_t buffp; - struct stat st; + CARD32 format; + CARD32 size; + CARD32 offset; + CARD32 *bitmapSizes; + xCharInfo maxink; + caddr_t buffp; + struct stat st; + + pcf_tmp = ( PcfTmp * )calloc( 1, sizeof( PcfTmp ) ); + + while(1){ - pcf_tmp = ( PcfTmp * )calloc( 1, sizeof( PcfTmp ) ); if ( !pcf_tmp ) { USAGE("dtgpftobdf : calloc() error.\n" ) ; - goto Bail; + break; } if ( stat( fontname, &st ) ) { - goto Bail; + break; } if ( ( pcf_tmp->pcf_buffer = readfontfile( fontname)) == (char *)-1 ) { - goto Bail; + break; } pcf_tmp->pcf_bufsz = st.st_size; if ( (format = getLSB32( (unsigned char *)pcf_tmp->pcf_buffer )) != PCF_FILE_VERSION ) { USAGE1("dtgpftobdf : pcf file version(0x%x) error.\n", format ) ; - goto Bail; + break; } pcf_tmp->ntables = getLSB32( (unsigned char *)(pcf_tmp->pcf_buffer + 4) ); @@ -668,7 +680,7 @@ char *fontname; ) ) { USAGE("dtgpftobdf : Cannot get accelerators.\n" ) ; - goto Bail; + break; } } @@ -678,7 +690,7 @@ char *fontname; ) ) { USAGE("dtgpftobdf : getProperties error.\n" ) ; - goto Bail; + break; } if ( !seekToType( pcf_tmp->tables, pcf_tmp->ntables, @@ -686,7 +698,7 @@ char *fontname; ) ) { USAGE("dtgpftobdf : PCF_BITMAPS error.\n" ) ; - goto Bail; + break; } buffp = pcf_tmp->pcf_buffer + offset; @@ -696,7 +708,7 @@ char *fontname; if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { USAGE("dtgpftobdf : error.!PCF_FORMAT_MATCH(PCF_BITMAPS)\n" ) ; - goto Bail; + break; } pcf_tmp->nbitmaps = getINT32( (unsigned char *)buffp, format); @@ -719,7 +731,7 @@ char *fontname; ) ) { USAGE("dtgpftobdf : error.(PCF_BDF_ENCODINGS)\n" ) ; - goto Bail; + break; } buffp = pcf_tmp->pcf_buffer + offset; @@ -727,7 +739,7 @@ char *fontname; buffp += 4; if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { USAGE("dtgpftobdf : error.!PCF_FORMAT_MATCH(PCF_BDF_ENCODINGS)\n" ) ; - goto Bail; + break; } pcf_tmp->info.firstCol = getINT16( (unsigned char *)buffp, format); @@ -738,7 +750,7 @@ char *fontname; buffp += 2; pcf_tmp->info.lastRow = getINT16( (unsigned char *)buffp, format); buffp += 2; - pcf_tmp->info.chDefault = getINT16( (unsigned char *)buffp, format); + pcf_tmp->info.defaultCh = getINT16( (unsigned char *)buffp, format); buffp += 2; pcf_tmp->info.allExist = FALSE; @@ -753,14 +765,14 @@ char *fontname; (CARD32)PCF_SWIDTHS, &format, &size, &offset ) ) { - goto Bail; + break; } buffp = pcf_tmp->pcf_buffer + offset; format = getLSB32( (unsigned char*)buffp); buffp += 4; if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { - goto Bail; + break; } pcf_tmp->swd_fmt = (CARD32)format ; pcf_tmp->swd_num = getINT32( (unsigned char*)buffp, format ) ; @@ -776,14 +788,14 @@ char *fontname; (CARD32)PCF_GLYPH_NAMES, &format, &size, &offset ) ) { - goto Bail; + break; } buffp = pcf_tmp->pcf_buffer + offset; format = getLSB32( (unsigned char*)buffp); buffp += 4; if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { - goto Bail; + break; } pcf_tmp->glyphs = getINT32( (unsigned char*)buffp, format ) ; buffp += 4; @@ -800,7 +812,7 @@ char *fontname; (CARD32)PCF_METRICS, &format, &size, &offset ) ) { - goto Bail; + break; } buffp = pcf_tmp->pcf_buffer + offset; @@ -815,41 +827,40 @@ char *fontname; pcf_tmp->mtr_num = (int)getINT16( (unsigned char*)buffp, format ) ; buffp += 2; }else{ - goto Bail; + break; } pcf_tmp->metrics = (xCharInfo *)buffp ; pcf_tmp->mtr_fmt = (CARD32)format ; return pcf_tmp; - -Bail: - if ( pcf_tmp ) { - free( pcf_tmp ); - } - return NULL; + } + if ( pcf_tmp ) { + free( pcf_tmp ); + } + return NULL; } static void -Anafprop(fip,fpropPtr,fpropvnPtr,fontname,ps,res,fplistPtr,fplistNum) -FontInfoRec *fip; -FontPropRec *fpropPtr; -char *fpropvnPtr; -char **fontname; -FontPropRec **fplistPtr; -FontPropRec *ps; -FontPropRec *res; -unsigned int *fplistNum; +Anafprop( +FontInfoRec *fip, +FontPropRec *fpropPtr, +char *fpropvnPtr, +char **fontname, +FontPropRec **fplistPtr, +FontPropRec *ps, +FontPropRec *res, +unsigned int *fplistNum) { FontPropRec *wkp ,*wklp; int i, fpnL; char *fpnp; - *fplistNum = fip->nProps - 1; + *fplistNum = fip->nprops - 1; *fplistPtr = (FontPropRec *)malloc(*fplistNum * sizeof(FontPropRec)); wkp = fpropPtr; wklp = *fplistPtr; - for (i = 0; i < fip->nProps; i++) { + for (i = 0; i < fip->nprops; i++) { fpnp = fpropvnPtr + wkp->name; fpnL = strlen(fpnp); if ((fpnL == 4) && (strncmp(fpnp,"FONT",4) == 0)) { @@ -866,12 +877,7 @@ unsigned int *fplistNum; } } 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->indirect = wkp->indirect; wkp++; wklp++; } @@ -880,9 +886,7 @@ unsigned int *fplistNum; static void -setProp( pcf, proptmp ) -PcfTmp *pcf; -PropTmp *proptmp; +setProp( PcfTmp *pcf, PropTmp *proptmp ) { int i, fpnL; char *fpnp; @@ -911,8 +915,7 @@ PropTmp *proptmp; * */ static void -pSIZE( ps, res ) -FontPropRec *ps, *res; +pSIZE( FontPropRec *ps, FontPropRec *res ) { int k; float f; @@ -934,8 +937,7 @@ FontPropRec *ps, *res; /* output to SIZE of pcf font */ static void -pSIZE_pcf( proptmp ) -PropTmp *proptmp; +pSIZE_pcf( PropTmp *proptmp ) { int k; float f; @@ -956,10 +958,7 @@ PropTmp *proptmp; static void -pPROPS( fip,fplistPtr,fplistNum ) -FontInfoRec *fip; -FontPropRec *fplistPtr; -unsigned int fplistNum; +pPROPS( FontInfoRec *fip, FontPropRec *fplistPtr, unsigned int fplistNum ) { FontPropRec *wkp; int i, k; @@ -971,18 +970,13 @@ unsigned int fplistNum; bufp += k; k = snprintf( bufp, sizeof(buf) - (bufp - buf), "FONT_DESCENT %d\n", fip->fontDescent ); 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; wkp = fplistPtr; 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 ); bufp += k; - } - wkp++; + wkp++; } k = snprintf( bufp, sizeof(buf) - (bufp - buf), "ENDPROPERTIES\n" ); bufp += k; @@ -995,8 +989,7 @@ unsigned int fplistNum; /* output to font property information of pcf fontpcf */ static void -pPROPS_pcf( pcf ) -PcfTmp *pcf; +pPROPS_pcf(PcfTmp *pcf) { FontPropPtr wkp; int i, k; @@ -1005,16 +998,16 @@ PcfTmp *pcf; k = sprintf( bufp, "STARTPROPERTIES %d\n", pcf->nprops+3 ); bufp += k; k = sprintf( bufp, "FONT_ASCENT %d\n", - (pcf->info.fontAscent >= pcf->info.maxbounds.metrics.ascent) - ? pcf->info.fontAscent : pcf->info.maxbounds.metrics.ascent + (pcf->info.fontAscent >= pcf->info.maxbounds.ascent) + ? pcf->info.fontAscent : pcf->info.maxbounds.ascent ); bufp += k; k = sprintf( bufp, "FONT_DESCENT %d\n", - (pcf->info.fontDescent >= pcf->info.maxbounds.metrics.descent) - ? pcf->info.fontDescent : pcf->info.maxbounds.metrics.descent + (pcf->info.fontDescent >= pcf->info.maxbounds.descent) + ? pcf->info.fontDescent : pcf->info.maxbounds.descent ); bufp += k; - k = sprintf( bufp, "DEFAULT_CHAR %d\n", pcf->info.chDefault ); + k = sprintf( bufp, "DEFAULT_CHAR %d\n", pcf->info.defaultCh ); bufp += k; wkp = pcf->props; for ( i = 0; i < pcf->nprops; i++ ) { @@ -1043,16 +1036,14 @@ PcfTmp *pcf; /* * output to character information and patern - * */ static void -pCHARS(fip,cip,glyphPtr,charNum,glyphPad) -FontInfoRec *fip; -CharInfoRec *cip; -char *glyphPtr; -unsigned int charNum; -unsigned int glyphPad; - +pCHARS( +FontInfoRec *fip, +CharInfoRec *cip, +char *glyphPtr, +unsigned int charNum, +unsigned int glyphPad) { CharInfoRec *wkp; int i, j; @@ -1077,10 +1068,6 @@ unsigned int glyphPad; for ( row = frow; row <= lrow; row++ ) { for ( col = fcol; col <= lcol; col++ ) { - if ( wkp->exists == FALSE ) { - wkp++; - continue; - } fprintf( stdout, "STARTCHAR %.2x%.2x\n", row,col ); fprintf( stdout, "ENCODING %d\n", (row << 8) + col ); fprintf( stdout, "SWIDTH 256 0\nDWIDTH %d %d\n", @@ -1111,24 +1098,23 @@ unsigned int glyphPad; /* * output to character information and patern - * */ static void -pfixCHARS(fip,cip,glyphPtr,charNum,glyphPad) -FontInfoRec *fip; -CharInfoRec *cip; -char *glyphPtr; -unsigned int charNum; -unsigned int glyphPad; +pfixCHARS( +FontInfoRec *fip, +CharInfoRec *cip, +char *glyphPtr, +unsigned int charNum, +unsigned int glyphPad) { CharInfoRec *wkp; - register int i, j, k; + int i, j, k; unsigned int frow,lrow,fcol,lcol; - register int row, col; + int row, col; unsigned int bbw, bbh, bbox, bboy; unsigned int xd, yd; unsigned int bml; - register char *glyph; + char *glyph; char fixbuf[240], *fixbufp; int fixdl; @@ -1162,10 +1148,6 @@ unsigned int glyphPad; glyph = glyphPtr; for ( row = frow; row <= lrow; row++ ) { for ( col = fcol; col <= lcol; col++ ) { - if ( wkp->exists == FALSE ) { - wkp++; - continue; - } bufp = buf; memcpy(bufp,"STARTCHAR ",10); bufp += 10; @@ -1199,9 +1181,9 @@ unsigned int glyphPad; static void -putPtn( bits, width, height) -unsigned char *bits; /* 1 byte boundary , no byte swap data */ -int width, height; +putPtn(unsigned char *bits, /* 1 byte boundary , no byte swap data */ + int width, + int height) { int bytewidth; int i, j; @@ -1218,9 +1200,7 @@ int width, height; } static void -ByteSwap( p, scan) -char *p; -int scan; +ByteSwap(char *p, int scan) { char w; @@ -1279,22 +1259,16 @@ static unsigned char _reverse_byte[0x100] = { }; static void -BitOrderInvert(buf, nbytes) -register unsigned char *buf; -register int nbytes; +BitOrderInvert(unsigned char *buf, int nbytes) { - register unsigned char *rev = _reverse_byte; + unsigned char *rev = _reverse_byte; for (; --nbytes >= 0; buf++) *buf = rev[*buf]; } static void -invertBits( src, format, width, height, dest) -char *src; -CARD32 format; -int width, height; -char *dest; +invertBits(char *src, CARD32 format, int width, int height, char *dest) { int bit, byte, glyph, scan; int src_bytewidth, dest_bytewidth; @@ -1328,9 +1302,7 @@ char *dest; } static void -pCHARS_pcf (pcf, fix) -PcfTmp *pcf; -int fix ; +pCHARS_pcf (PcfTmp *pcf, int fix) { char *bmp_ptn = NULL; char *bitmap = NULL; @@ -1356,17 +1328,17 @@ int fix ; nencoding = row_width * (pcf->info.lastRow - pcf->info.firstRow + 1); if( fix == TRUE ) { - bmp_width = pcf->info.maxbounds.metrics.leftSideBearing - + pcf->info.maxbounds.metrics.rightSideBearing ; + bmp_width = pcf->info.maxbounds.leftSideBearing + + pcf->info.maxbounds.rightSideBearing ; bmp_height = pcf->info.fontAscent + pcf->info.fontDescent ; ptn_width = bmp_width ; - ptn_height = pcf->info.maxbounds.metrics.ascent + - pcf->info.maxbounds.metrics.descent; + ptn_height = pcf->info.maxbounds.ascent + + pcf->info.maxbounds.descent; if (!(bmp_ptn = make_toptn( ptn_width, ptn_height))) 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 = (( width_bytes + bmp_width - 1)/width_bytes) * PCF_GLYPH_PAD( pcf->bmp_fmt); 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 ) ; if( fix == FALSE ) { - bmp_width = pcf->info.maxbounds.metrics.leftSideBearing - + pcf->info.maxbounds.metrics.rightSideBearing ; + bmp_width = pcf->info.maxbounds.leftSideBearing + + pcf->info.maxbounds.rightSideBearing ; bmp_height = pcf->info.fontAscent + pcf->info.fontDescent ; ptn_width = bbw ; ptn_height = bbh ; @@ -1442,7 +1414,7 @@ int fix ; if (!(bmp_ptn = make_toptn( ptn_width, ptn_height))) 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 = (( width_bytes + bmp_width - 1)/width_bytes) * PCF_GLYPH_PAD( pcf->bmp_fmt); bmp_adj = width_bytes * adj_hi; @@ -1486,8 +1458,7 @@ int fix ; } static char * -make_toptn( width, height) -int width, height; +make_toptn(int width, int height) { int byte_width; @@ -1500,16 +1471,16 @@ int width, height; static int -getarg(argc,argv,fname,bitorder,byteorder,scanunit,glyphPad,outLevel,fix) -int argc; -char *argv[]; -char *fname; -int *bitorder; -int *byteorder; -int *scanunit; -int *glyphPad; -int *outLevel; -int *fix; +getarg( +int argc, +char *argv[], +char *fname, +int *bitorder, +int *byteorder, +int *scanunit, +int *glyphPad, +int *outLevel, +int *fix) { int i; int already; diff --git a/cde/programs/dtudcfonted/dtgpftocpf/gpftocpf.c b/cde/programs/dtudcfonted/dtgpftocpf/gpftocpf.c index 218d0168..bb94c091 100644 --- a/cde/programs/dtudcfonted/dtgpftocpf/gpftocpf.c +++ b/cde/programs/dtudcfonted/dtgpftocpf/gpftocpf.c @@ -57,27 +57,44 @@ #define START_CODE 0 #define END_CODE 1 -static int CnvBDFtoGPF() ; -static int check_width() ; -static int check_height() ; -static int check_width_height() ; -static int check_code() ; -static int readBdfToMemory() ; -static void sigint_out() ; -static void put_error_and_exit(); -static void put_help(); -static void Usage(); - -extern int fal_code_to_glyph() ; +static int CnvBDFtoGPF(struct btophead *head, + int num_gr, + FalGlyphRegion *gr, + int code_area); +static int check_width(char *prog_name, char *len_str); +static int check_height(char *prog_name, char *len_str); +static int check_width_height(char *prog_name, char *len_str, int mode); +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 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(char *locale, + unsigned long codepoint, + FalGIInf **gi, + int *num_gi); static struct btophead Head; -static char *locale ; -static char *spacing ; -static char *char_set ; +static char *locale; +static char *spacing; +static char *char_set; static void -sigint_out() +sigint_out(void) { if ( Head.out_file ) { unlink( Head.out_file ); @@ -85,9 +102,7 @@ sigint_out() exit( 0 ); } -main( argc, argv ) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { int help, code_area, fd[2], rtn, i; struct stat st; @@ -412,11 +427,11 @@ char *argv[]; static int -CnvBDFtoGPF( head, num_gr, gr, code_area ) -struct btophead *head; -int num_gr ; -FalGlyphRegion *gr ; -int code_area ; +CnvBDFtoGPF( +struct btophead *head, +int num_gr, +FalGlyphRegion *gr, +int code_area) { int rtn; char bdfbuf[BUFSIZE]; @@ -463,10 +478,7 @@ int code_area ; static void -put_error_and_exit(btop, er_no, prog_name) -struct btophead *btop; -int er_no; -char *prog_name; +put_error_and_exit(struct btophead *btop, int er_no, char *prog_name) { ErrMsgTable_AndExit( er_no, btop->in_file, NULL, NULL, btop->out_file, @@ -481,8 +493,7 @@ char *prog_name; static void -put_help(prog_name) -char *prog_name; +put_help(char *prog_name) { USAGE1("Usage : %s -xlfd xlfd_name\n", prog_name); 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); USAGE("codeset \t\tcode area\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("The xlfd name and character size may be obtained using dtlsgpf command.\n"); return; } static void -Usage(prog_name) -char *prog_name; +Usage(char *prog_name) { put_help( prog_name ); exit(1); @@ -509,27 +519,21 @@ char *prog_name; static int -check_width( prog_name, len_str ) -char *prog_name; -char *len_str; +check_width(char *prog_name, char *len_str) { return( check_width_height( prog_name, len_str, 0) ); } static int -check_height( prog_name, len_str ) -char *prog_name; -char *len_str; +check_height(char *prog_name, char *len_str) { return( check_width_height( prog_name, len_str, 1) ); } static int -check_width_height( prog_name, len_str, mode ) -char *prog_name; -char *len_str; -int mode; /* width ... 0 , height ... 1 */ +check_width_height(char *prog_name, char *len_str, int mode) +/* width ... 0 , height ... 1 */ { int ret; char *tmp; @@ -559,13 +563,13 @@ int mode; /* width ... 0 , height ... 1 */ static int -check_code( prog_name, code_str, mode, charset, num_gr, gr ) -char *prog_name; -char *code_str; -int mode; /* start_code ... 0, end_code ... 1 */ -char *charset ; -int num_gr ; -FalGlyphRegion *gr ; +check_code( +char *prog_name, +char *code_str, +int mode, /* start_code ... 0, end_code ... 1 */ +char *charset, +int num_gr, +FalGlyphRegion *gr) { int err_flg = 0; int code_num; @@ -628,12 +632,12 @@ FalGlyphRegion *gr ; static int -readBdfToMemory(head, buf, num_gr, gr, code_area) -struct btophead *head; -char *buf; -int num_gr ; -FalGlyphRegion *gr ; -int code_area ; +readBdfToMemory( +struct btophead *head, +char *buf, +int num_gr, +FalGlyphRegion *gr, +int code_area) { int code, mwidth, num_char, bsize, rtn; char *ptn; diff --git a/cde/programs/dtudcfonted/dtlsgpf/lsgpf.c b/cde/programs/dtudcfonted/dtlsgpf/lsgpf.c index fc3ee4f5..9db4c3dd 100644 --- a/cde/programs/dtudcfonted/dtlsgpf/lsgpf.c +++ b/cde/programs/dtudcfonted/dtlsgpf/lsgpf.c @@ -39,23 +39,9 @@ #include "bdfgpf.h" #include "udcutil.h" - -static void dsp_info_list(); -static void dsp_title(); -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 ; +static char *utillocale; +static char *fontdir; +static char *command_name; typedef struct { int num; @@ -82,10 +68,37 @@ typedef struct { #define X_OPT (1<<3) #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 -main( argc, argv ) -int argc; -char *argv[]; +main( int argc, char *argv[] ) { FalFontDataList *lst_m; /* font information list struct */ FalFontData key; /* font reference information creation struct */ @@ -221,12 +234,12 @@ char *argv[]; static void -dsp_info_list( com, dspopt, lst, unknown_file_lst, errflg ) -char *com; -int dspopt; -FalFontDataList *lst; -MISS_ENTRY *unknown_file_lst; -int *errflg ; +dsp_info_list( +char *com, +int dspopt, +FalFontDataList *lst, +MISS_ENTRY *unknown_file_lst, +int *errflg) { FalFontDataList srt_lst; int i, j ; @@ -428,10 +441,7 @@ int *errflg ; static void -dsp_error_title(com, errflg, dspopt ) -char *com; -int *errflg ; -int dspopt ; +dsp_error_title(char *com, int *errflg, int dspopt) { USAGE("\n\n" ); if( dspopt & A_OPT ) { @@ -452,9 +462,7 @@ int dspopt ; static int -dsp_error_files( lst, unknown ) -FalFontDataList *lst; -MISS_ENTRY *unknown; +dsp_error_files( FalFontDataList *lst, MISS_ENTRY *unknown ) { int i,j; int entry_start, entry_end; @@ -504,11 +512,11 @@ MISS_ENTRY *unknown; static void -sort_offset_list( flist, mask, sort_list, data_cnt ) -FalFontDataList *flist ; -int mask ; -int **sort_list ; -int *data_cnt ; +sort_offset_list( +FalFontDataList *flist, +int mask, +int **sort_list, +int *data_cnt) { int *size_offset_list ; int cnt, i, j ; @@ -586,9 +594,7 @@ int *data_cnt ; static void -dsp_title( fp, dspopt ) -FILE *fp; -int dspopt ; +dsp_title( FILE *fp, int dspopt ) { if( dspopt & L_OPT || dspopt & X_OPT ) { fprintf(fp, "\n" ) ; @@ -611,13 +617,13 @@ int dspopt ; static void -dspinfo_1line( data, fp, unknown_file_lst, offset, errflg, dspopt ) -FalFontData data; -FILE *fp; -MISS_ENTRY *unknown_file_lst; -int offset ; -int *errflg ; -int dspopt ; +dspinfo_1line( +FalFontData data, +FILE *fp, +MISS_ENTRY *unknown_file_lst, +int offset, +int *errflg, +int dspopt) { int dsp_on ; char *namep; @@ -682,16 +688,14 @@ int dspopt ; static void -disp_no_fontslist( dspopt ) -int dspopt ; +disp_no_fontslist( int dspopt ) { fprintf( stdout, "\nThere are no fonts that are used for user defined character.\n" ) ; } static void -put_help( prog_name ) -char *prog_name; +put_help( char *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"); @@ -707,12 +711,12 @@ char *prog_name; static int -search_fontfile_name( data, fname, unknown_file_lst, offset, errflg ) -FalFontData data ; -char *fname ; -MISS_ENTRY *unknown_file_lst; -int offset ; -int *errflg ; +search_fontfile_name( +FalFontData data, +char *fname, +MISS_ENTRY *unknown_file_lst, +int offset, +int *errflg) { FalFontID fid ; FalFontDataList *flist ; @@ -797,11 +801,8 @@ int *errflg ; return(0) ; } - - static int -sort_fontlist( lst ) -FalFontDataList *lst; +sort_fontlist( FalFontDataList *lst ) { int i,j; FalFontDataList srt; @@ -853,9 +854,7 @@ FalFontDataList *lst; /* no sort ... 0 */ static int -get_new_target( target, choose ) -FalFontData *target; -FalFontData *choose; +get_new_target( FalFontData *target, FalFontData *choose ) { FalFontData diff; DEF_STR_CHK ; diff --git a/cde/programs/dtudcfonted/fssxeg.h b/cde/programs/dtudcfonted/fssxeg.h index fce1dad1..57abf7d5 100644 --- a/cde/programs/dtudcfonted/fssxeg.h +++ b/cde/programs/dtudcfonted/fssxeg.h @@ -34,21 +34,12 @@ #include "udccom.h" /* 1995.10.09 */ #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 OFF 0 #define MAXPTNSIZE 128 #define MAXPTNBYTE MAXPTNSIZE*((MAXPTNSIZE+7)/8) - #define ERROR_VAL fal_utyerror #define EXISTS_FLAG fal_utyexists diff --git a/cde/programs/dtudcfonted/include/FaLib.h b/cde/programs/dtudcfonted/include/FaLib.h index ee974a8d..f2524b45 100644 --- a/cde/programs/dtudcfonted/include/FaLib.h +++ b/cde/programs/dtudcfonted/include/FaLib.h @@ -209,12 +209,12 @@ typedef struct _FalGIInf { #include #include -#ifdef Bool -#undef Bool +#ifdef Bool +#undef Bool #endif #include "snfstruct.h" -#include "fontstruct.h" +#include #include "pcf.h" struct pcf_inf { @@ -263,88 +263,66 @@ typedef Oak_FontInf * FalFontID; /* font distinction */ * function prototypes */ extern FalFontID FalOpenSysFont( -#if NeedFunctionPrototypes FalFontData* /* open_font_data */, int /* font_data_mask */, FalFontDataList** /* missing_font_list_return */ -#endif ) ; extern int FalGetFontList( -#if NeedFunctionPrototypes FalFontData* /* key_data */, int /* mask */, FalFontDataList** /* list_ret */ -#endif ) ; extern int FalFreeFontList( -#if NeedFunctionPrototypes FalFontDataList* /* list */ -#endif ) ; extern char * FalReadFont( -#if NeedFunctionPrototypes FalFontID /* fid */ , int /* code */ , int /* width */ , int /* height */ -#endif ) ; extern int FalQueryFont( -#if NeedFunctionPrototypes FalFontID /* fid */ , FalFontinfo* /* fontinfo */ -#endif ) ; extern int FalFontOfFontID( -#if NeedFunctionPrototypes FalFontID /* fid */, FalFontData* /* fontdata */ -#endif ) ; extern int FalCloseFont( -#if NeedFunctionPrototypes FalFontID /* fid */ -#endif ) ; extern int FalFontIDToFileName( -#if NeedFunctionPrototypes FalFontID /* fid */ , char** /* file_name */ -#endif ) ; extern int FalFree( -#if NeedFunctionPrototypes void* /* list */ -#endif ) ; extern int FalGetUDCCPArea( -#if NeedFunctionPrototypes char* /* locale */ , int /* code_set */ , char* /* charset_str */ , FalCodeRegion** /* cr */ , int* /* num_cr */ -#endif ) ; extern int FalGetUDCGIArea( -#if NeedFunctionPrototypes char* /* locale */ , int /* codeset */ , char* /* charset_str */ , FalGlyphRegion** /* gr */ , int* /* num_gr */ -#endif ) ; extern FalFontID FalOpenFont() ; diff --git a/cde/programs/dtudcfonted/include/bdfgpf.h b/cde/programs/dtudcfonted/include/bdfgpf.h index 196a5746..6cf0e70d 100644 --- a/cde/programs/dtudcfonted/include/bdfgpf.h +++ b/cde/programs/dtudcfonted/include/bdfgpf.h @@ -29,6 +29,7 @@ */ #include "udccom.h" +#include "FaLib.h" struct btophead { char *in_file; @@ -68,17 +69,17 @@ struct ptobhead { int bdf_width; int bdf_height; - int bdf_x; - int bdf_y; + int bdf_x; + int bdf_y; float bdf_point; int bdf_xdpi; - int reserve ; + int reserve ; int *code; char **ptn; int zoomf; - int code_category; + int code_category; int start_code; int end_code; @@ -234,287 +235,212 @@ extern char *bdftopcf; * Function prototypes */ extern int falcom_atoi( -#if NeedFunctionPrototypes char* /* str */, char /* ed_cod */, int* /* val */ -#endif ); extern int GetDefaultFile( -#if NeedFunctionPrototypes int /* size */, char* /* style */, char* /* fname */ -#endif ); extern int get_default_file( -#if NeedFunctionPrototypes FILE* /* fp */, int /* size */, char* /* style */, char* /* fname */ -#endif ); extern char *falcom_get_base_name( -#if NeedFunctionPrototypes char* /* str */ -#endif ); extern int GetFileName( -#if NeedFunctionPrototypes char* /* com */, char* /* size_str */, char* /* style */, int /* codeset */, char* /* ofile */ -#endif ); extern void ErrMsgTable_FalGetFontList( -#if NeedFunctionPrototypes char* /* com */, int /* utyerr */, int /* utyderr */ -#endif ); extern void fal_cut_tailslash( -#if NeedFunctionPrototypes char* /* name */ -#endif ); extern char *GetRealFileName( -#if NeedFunctionPrototypes char* /* name */ -#endif ); extern int IsInRegion( -#if NeedFunctionPrototypes int /* code */, int /* num_gr */, FalGlyphRegion* /* gr */ -#endif ); extern int GetUdcFileName( -#if NeedFunctionPrototypes char* /* com */, int /* code_no */, char* /* xlfdname */, char* /* fname */ -#endif ); extern int GetUdcRegion( -#if NeedFunctionPrototypes char* /* com */, int /* codeset */, char* /* gpf_file */, int* /* num_gr */, FalGlyphRegion** /* gr */ -#endif ); extern int DispUdcCpArea( -#if NeedFunctionPrototypes FILE* /* fp */ -#endif ); extern int GetUdcFontName( -#if NeedFunctionPrototypes char* /* gpf_file */, char* /* bdf_file */, char** /* fontname */ -#endif ); extern int FileLock( -#if NeedFunctionPrototypes int /* fd */ -#endif ); extern int FileUnLock( -#if NeedFunctionPrototypes int /* fd */ -#endif ); extern int isLock( -#if NeedFunctionPrototypes int /* fd */ -#endif ); extern int ReadBdfHeader( -#if NeedFunctionPrototypes struct btophead* /* head */, char* /* buf */ -#endif ); extern int ReadGpfHeader( -#if NeedFunctionPrototypes struct ptobhead* /* head */, char* /* buf */ -#endif ); extern int WriteBdfHeader( -#if NeedFunctionPrototypes struct ptobhead* /* head */ -#endif ); extern void WriteGpfHeader( -#if NeedFunctionPrototypes struct btophead* /* head */ -#endif ); extern int WritePtnToBdf( -#if NeedFunctionPrototypes struct ptobhead* /* head */ -#endif ); extern int putDefaultChars( -#if NeedFunctionPrototypes struct ptobhead* /* head */ -#endif ); extern int WritePtnToGpf( -#if NeedFunctionPrototypes struct btophead* /* head */ -#endif ); extern int ReadBdfToMemory( -#if NeedFunctionPrototypes struct btophead* /* head */, char* /* buf */ -#endif ); extern int ReadBdfToMemory_with_init( -#if NeedFunctionPrototypes struct btophead* /* head */, int /* init_start */, int /* init_end */, char* /* buf */ -#endif ); extern int GetBdfCode( -#if NeedFunctionPrototypes struct btophead* /* head */, char* /* buf */, int* /* code */ -#endif ); extern int GetBdfPtn( -#if NeedFunctionPrototypes struct btophead* /* head */, char* /* buf */, char* /* ptn */, int /* mwidth */, int /* bsize */ -#endif ); extern int ReadGpfToMemory( -#if NeedFunctionPrototypes struct ptobhead* /* head */, char* /* buf */ -#endif ); extern int GetGpfCode( -#if NeedFunctionPrototypes struct ptobhead* /* head */, char* /* buf */, int* /* code */ -#endif ); extern int GetGpfPtn( -#if NeedFunctionPrototypes struct ptobhead* /* head */, char* /* buf */, char* /* ptn */, int /* mwidth */, int /* bsize */ -#endif ); extern void GetBdfLinePtn( -#if NeedFunctionPrototypes char* /* mem */, char* /* buf */, int /* width */ -#endif ); extern void GetGpfLinePtn( -#if NeedFunctionPrototypes char* /* mem */, char* /* buf */, int /* width */ -#endif ); extern int PutBdfPtn( -#if NeedFunctionPrototypes unsigned char* /* ptn */, int /* width */, int /* height */, FILE* /* fp */ -#endif ); extern int PutGpfPtn( -#if NeedFunctionPrototypes char* /* ptn */, int /* width */, int /* height */, FILE* /* fp */ -#endif ); extern int PtnZoom( -#if NeedFunctionPrototypes char* /* dmem */, char* /* smem */, int /* sw */, int /* sh */, int /* dw */, int /* dh */ -#endif ); extern char *GetTmpPath( -#if NeedFunctionPrototypes char* /* path */ -#endif ); extern int ChkNumString( -#if NeedFunctionPrototypes char* /* str */ -#endif ); extern void ErrMsgTable_AndExit( -#if NeedFunctionPrototypes int /* er_no */, char* /* snf_in */, char* /* snf_out */, @@ -522,95 +448,72 @@ extern void ErrMsgTable_AndExit( char* /* gpf_out */, char* /* bdf_in */, char* /* prog_name */ -#endif ); extern void fatal_err_msg( -#if NeedFunctionPrototypes int /* er_no */, char* /* prog_name */ -#endif ); extern void ChatchSig() ; extern void Put_File_Create_Err_Msg( -#if NeedFunctionPrototypes int /* msg_level */, char* /* org_name */, char* /* tmp_name */, char* /* save_name */, char* /* com */ -#endif ); extern int Make_NewFefFile( -#if NeedFunctionPrototypes char* /* org_name */, char* /* tmp_name */, mode_t /* mode */, uid_t /* owner */, gid_t /* group */, char* /* com */ -#endif ); extern int Unlink_Tmpfile( -#if NeedFunctionPrototypes char* /* file */, char* /* com */ -#endif ); extern int Chmod_File ( -#if NeedFunctionPrototypes char* /* fname */, mode_t /* mode */, char* /* com */ -#endif ); extern int Chown_File ( -#if NeedFunctionPrototypes char* /* fname */, uid_t /* owner */, gid_t /* group */, char* /* com */ -#endif ); extern int ChkPcfFontFile( -#if NeedFunctionPrototypes char* /* filename */ -#endif ); extern int ChkSnfFontFile( -#if NeedFunctionPrototypes char* /* filename */ -#endif ); extern char *get_cmd_path( -#if NeedFunctionPrototypes char* /* path */, char* /* cmd */ -#endif ); extern int SetCmdPath( -#if NeedFunctionPrototypes char* /* com */, char** /* path */, char* /* dflt_path */, char* /* cmd */ -#endif ); extern int Link_NewFile( -#if NeedFunctionPrototypes char * /* rd_file */, char * /* wr_file */ -#endif -) ; +); diff --git a/cde/programs/dtudcfonted/include/pcf.h b/cde/programs/dtudcfonted/include/pcf.h new file mode 100644 index 00000000..ad36b922 --- /dev/null +++ b/cde/programs/dtudcfonted/include/pcf.h @@ -0,0 +1,107 @@ +/* + * CDE - Common Desktop Environment + * + * Copyright (c) 1993-2012, The Open Group. All rights reserved. + * + * These libraries and programs are free software; you can + * redistribute them and/or modify them under the terms of the GNU + * Lesser General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * These libraries and programs are distributed in the hope that + * they will be useful, but WITHOUT ANY WARRANTY; without even the + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with these libraries and programs; if not, write + * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth + * Floor, Boston, MA 02110-1301 USA + */ +/* $XConsortium: pcf.h /main/2 1996/02/10 16:25:46 cde-fuj $ */ +/* + * + * Copyright 1990 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + (c) Copyright 1995 FUJITSU LIMITED + This is source code modified by FUJITSU LIMITED under the Joint + Development Agreement for the CDEnext PST. + This is unpublished proprietary source code of FUJITSU LIMITED + */ + +#ifndef _PCF_H_ +#define _PCF_H_ + +/* + * Information used to read/write PCF fonts + */ + +typedef struct _PCFTable { + CARD32 type; + CARD32 format; + CARD32 size; + CARD32 offset; +} PCFTableRec, *PCFTablePtr; + +#define PCF_FILE_VERSION (('p'<<24)|('c'<<16)|('f'<<8)|1) +#define PCF_FORMAT_MASK 0xffffff00 + +#define PCF_DEFAULT_FORMAT 0x00000000 +#define PCF_INKBOUNDS 0x00000200 +#define PCF_ACCEL_W_INKBOUNDS 0x00000100 +#define PCF_COMPRESSED_METRICS 0x00000100 + +#define PCF_FORMAT_MATCH(a,b) (((a)&PCF_FORMAT_MASK) == ((b)&PCF_FORMAT_MASK)) + +#define PCF_GLYPH_PAD_MASK (3<<0) +#define PCF_BYTE_MASK (1<<2) +#define PCF_BIT_MASK (1<<3) +#define PCF_SCAN_UNIT_MASK (3<<4) + +#define PCF_BYTE_ORDER(f) (((f) & PCF_BYTE_MASK)?MSBFirst:LSBFirst) +#define PCF_BIT_ORDER(f) (((f) & PCF_BIT_MASK)?MSBFirst:LSBFirst) +#define PCF_GLYPH_PAD_INDEX(f) ((f) & PCF_GLYPH_PAD_MASK) +#define PCF_GLYPH_PAD(f) (1<> 4) +#define PCF_SCAN_UNIT(f) (1< #include /* @@ -87,12 +86,6 @@ This is unpublished proprietary source code of FUJITSU LIMITED #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 */ @@ -106,7 +99,7 @@ typedef struct _FontProp { * pad out glyphs to a CARD32 boundary */ #define ADDRXFONTPROPS( pfi) \ - ((DIXFontProp *) ((char *)ADDRCHARGLYPHS( pfi) + BYTESOFGLYPHINFO(pfi))) + ((DIXFontProp *) (char *)ADDRCHARGLYPHS( pfi)) #define ADDRSTRINGTAB( pfi) \ ((char *)ADDRXFONTPROPS( pfi) + BYTESOFPROPINFO(pfi)) @@ -115,7 +108,7 @@ typedef struct _FontProp { #define BYTESOFCHARINFO(pfi) (sizeof(CharInfoRec) * n2dChars(pfi)) #define BYTESOFPROPINFO(pfi) (sizeof(FontPropRec) * (pfi)->nProps) #define BYTESOFSTRINGINFO(pfi) ((pfi)->lenStrings) -#define BYTESOFGLYPHINFO(pfi) (((pfi)->maxbounds.byteOffset+3) & ~0x3) #define BYTESOFINKINFO(pfi) (sizeof(CharInfoRec) * (2 + n2dChars(pfi))) #endif /* SNFSTRUCT_H */ + diff --git a/cde/programs/dtudcfonted/include/udcopt.h b/cde/programs/dtudcfonted/include/udcopt.h index 810d754e..4827eadc 100644 --- a/cde/programs/dtudcfonted/include/udcopt.h +++ b/cde/programs/dtudcfonted/include/udcopt.h @@ -45,16 +45,6 @@ snprintf( (buf), sizeof((buf)), " -i " ) ; \ 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_EXECLBDFTOSNF( permission, buf, snf_file ) { \ execl( bdftosnf, bdftosnf, "-i", 0 ); \ @@ -69,20 +59,8 @@ /* case of a snf former font */ #define FAL_GET_SNF_HEADER( buf, protect_key_data, fal_utyerror, fal_utyderror, fd, finf, openfontfile ) { \ (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)->isPcf = FALSE; \ - } \ } /* falReadGpfProp() */ @@ -90,12 +68,6 @@ (finf)->isFef = TRUE; \ (finf)->isPcf = FALSE; \ (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 diff --git a/cde/programs/dtudcfonted/libfal/_falQuarks.c b/cde/programs/dtudcfonted/libfal/_falQuarks.c index 41d412bb..97ebf9f4 100644 --- a/cde/programs/dtudcfonted/libfal/_falQuarks.c +++ b/cde/programs/dtudcfonted/libfal/_falQuarks.c @@ -136,8 +136,7 @@ static XrmQuark nextUniq = -1; /* next quark from falrmUniqueQuark */ static char *neverFreeTable = NULL; static int neverFreeTableSize = 0; -static char *permalloc(length) - register unsigned int length; +static char *permalloc(unsigned int length) { char *ret; @@ -155,16 +154,13 @@ static char *permalloc(length) return(ret); } -#ifndef WORD64 typedef struct {char a; double b;} TestType1; typedef struct {char a; unsigned long b;} TestType2; -#endif #ifdef XTHREADS static char *_falpermalloc(); -char *falpermalloc(length) - unsigned int length; +char *falpermalloc(unsigned int length) { char *p; @@ -177,13 +173,11 @@ char *falpermalloc(length) static #endif /* XTHREADS */ -char *falpermalloc(length) - unsigned int length; +char *falpermalloc(unsigned int length) { int i; if (neverFreeTableSize && length < NEVERFREETABLESIZE) { -#ifndef WORD64 if ((sizeof(TestType1) != (sizeof(TestType2) - sizeof(unsigned long) + sizeof(double))) && !(length & (DALIGN-1)) && @@ -191,7 +185,6 @@ char *falpermalloc(length) neverFreeTableSize -= DALIGN - i; neverFreeTable += DALIGN - i; } else -#endif if (i = (NEVERFREETABLESIZE - neverFreeTableSize) & (WALIGN-1)) { neverFreeTableSize -= WALIGN - i; neverFreeTable += WALIGN - i; @@ -201,13 +194,13 @@ char *falpermalloc(length) } static Bool -ExpandQuarkTable() +ExpandQuarkTable(void) { unsigned long oldmask, newmask; - register char c, *s; - register Entry *oldentries, *entries; - register Entry entry; - register int oldidx, newidx, rehash; + char c, *s; + Entry *oldentries, *entries; + Entry entry; + int oldidx, newidx, rehash; Signature sig; XrmQuark q; @@ -266,42 +259,41 @@ ExpandQuarkTable() return True; } -#if NeedFunctionPrototypes XrmQuark _falrmInternalStringToQuark( - register _Xconst char *name, register int len, register Signature sig, - Bool permstring) -#else -XrmQuark _falrmInternalStringToQuark(name, len, sig, permstring) - register XrmString name; - register int len; - register Signature sig; - Bool permstring; -#endif + const char *name, int len, Signature sig, Bool permstring) { - register XrmQuark q; - register Entry entry; - register int idx, rehash; - register int i; - register char *s1, *s2; + XrmQuark q; + Entry entry; + int idx; + int rehash = 0; + int i; + char *s1, *s2; char *new; - rehash = 0; idx = HASH(sig); _XLockMutex(_Xglobal_lock); while (entry = quarkTable[idx]) { if (entry & LARGEQUARK) q = entry & (LARGEQUARK-1); else { - if ((entry - sig) & XSIGMASK) - goto nomatch; + if ((entry - sig) & XSIGMASK){ + if (!rehash) + rehash = REHASHVAL(sig); + idx = REHASH(idx, rehash); + continue; + } q = (entry >> QUARKSHIFT) & QUARKMASK; } for (i = len, s1 = (char *)name, s2 = NAME(q); --i >= 0; ) { - if (*s1++ != *s2++) - goto nomatch; + if (*s1++ != *s2++){ + if (!rehash) + rehash = REHASHVAL(sig); + idx = REHASH(idx, rehash); + continue; + } } if (*s2) { -nomatch: if (!rehash) + if (!rehash) rehash = REHASHVAL(sig); idx = REHASH(idx, rehash); continue; @@ -316,11 +308,15 @@ nomatch: if (!rehash) _XUnlockMutex(_Xglobal_lock); return q; } - if (nextUniq == nextQuark) - goto fail; + if (nextUniq == nextQuark){ + _XUnlockMutex(_Xglobal_lock); + return NULLQUARK; + } if ((nextQuark + (nextQuark >> 2)) > quarkMask) { - if (!ExpandQuarkTable()) - goto fail; + if (!ExpandQuarkTable()){ + _XUnlockMutex(_Xglobal_lock); + return NULLQUARK; + } _XUnlockMutex(_Xglobal_lock); return _falrmInternalStringToQuark(name, len, sig, permstring); } @@ -329,20 +325,26 @@ nomatch: if (!rehash) if (!(q & CHUNKMASK)) { if (!(new = Xrealloc((char *)stringTable, sizeof(XrmString *) * - ((q >> QUANTUMSHIFT) + CHUNKPER)))) - goto fail; + ((q >> QUANTUMSHIFT) + CHUNKPER)))){ + _XUnlockMutex(_Xglobal_lock); + return NULLQUARK; + } stringTable = (XrmString **)new; #ifdef PERMQ if (!(new = Xrealloc((char *)permTable, sizeof(Bits *) * - ((q >> QUANTUMSHIFT) + CHUNKPER)))) - goto fail; + ((q >> QUANTUMSHIFT) + CHUNKPER)))){ + _XUnlockMutex(_Xglobal_lock); + return NULLQUARK; + } permTable = (Bits **)new; #endif } new = falpermalloc(QUANTSIZE); - if (!new) - goto fail; + if (!new){ + _XUnlockMutex(_Xglobal_lock); + return NULLQUARK; + } stringTable[q >> QUANTUMSHIFT] = (XrmString *)new; #ifdef PERMQ permTable[q >> QUANTUMSHIFT] = (Bits *)(new + STRQUANTSIZE); @@ -355,8 +357,10 @@ nomatch: if (!rehash) #else name = permalloc(len+1); #endif - if (!name) - goto fail; + if (!name){ + _XUnlockMutex(_Xglobal_lock); + return NULLQUARK; + } for (i = len, s1 = (char *)name; --i >= 0; ) *s1++ = *s2++; *s1++ = '\0'; @@ -376,21 +380,12 @@ nomatch: if (!rehash) nextQuark++; _XUnlockMutex(_Xglobal_lock); return q; - fail: - _XUnlockMutex(_Xglobal_lock); - return NULLQUARK; } -#if NeedFunctionPrototypes -XrmQuark falrmStringToQuark( - _Xconst char *name) -#else -XrmQuark falrmStringToQuark(name) - XrmString name; -#endif +XrmQuark falrmStringToQuark(const char *name) { - register char c, *tname; - register Signature sig = 0; + char c, *tname; + Signature sig = 0; if (!name) return (NULLQUARK); @@ -401,16 +396,11 @@ XrmQuark falrmStringToQuark(name) return _falrmInternalStringToQuark(name, tname-(char *)name-1, sig, False); } -#if NeedFunctionPrototypes XrmQuark falrmPermStringToQuark( - _Xconst char *name) -#else -XrmQuark falrmPermStringToQuark(name) - XrmString name; -#endif + const char *name) { - register char c, *tname; - register Signature sig = 0; + char c, *tname; + Signature sig = 0; if (!name) return (NULLQUARK); @@ -421,7 +411,7 @@ XrmQuark falrmPermStringToQuark(name) return _falrmInternalStringToQuark(name, tname-(char *)name-1, sig, True); } -XrmQuark falrmUniqueQuark() +XrmQuark falrmUniqueQuark(void) { XrmQuark q; @@ -434,8 +424,7 @@ XrmQuark falrmUniqueQuark() return q; } -XrmString falrmQuarkToString(quark) - register XrmQuark quark; +XrmString falrmQuarkToString(XrmQuark quark) { XrmString s; diff --git a/cde/programs/dtudcfonted/libfal/_falSetLocale.c b/cde/programs/dtudcfonted/libfal/_falSetLocale.c index a34dfd03..155a2000 100644 --- a/cde/programs/dtudcfonted/libfal/_falSetLocale.c +++ b/cde/programs/dtudcfonted/libfal/_falSetLocale.c @@ -88,26 +88,10 @@ from the X Consortium. #ifdef X_LOCALE -/* alternative setlocale() for when the OS does not provide one */ - -#ifdef X_NOT_STDC_ENV -extern char *getenv(); -#endif - #define MAXLOCALE 64 /* buffer size of locale name */ -#if NeedFunctionPrototypes -char * -_falsetlocale( - int category, - _Xconst char *name -) -#else char * -_falsetlocale(category, name) - int category; - char *name; -#endif +_falsetlocale(int category, const char *name) { static char *xsl_name; char *old_name; @@ -157,49 +141,32 @@ _falsetlocale(category, name) */ char * -_fallcMapOSLocaleName(osname, siname) - char *osname; - char *siname; +_fallcMapOSLocaleName(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 #define SKIPCOUNT 2 #define STARTCHAR ':' #define ENDCHAR ';' -#else -#ifdef ultrix -#define SKIPCOUNT 2 -#define STARTCHAR '\001' -#define ENDCHAR '\001' -#else -#ifdef WIN32 +#elif defined(WIN32) #define SKIPCOUNT 1 #define STARTCHAR '=' #define ENDCHAR ';' #define WHITEFILL -#else -#if defined(AIXV3) -#define STARTCHAR ' ' -#define ENDCHAR ' ' -#else -#if !defined(sun) || defined(SVR4) +#elif !defined(sun) || defined(SVR4) #define STARTCHAR '/' -#endif #define ENDCHAR '/' -#endif -#endif -#endif #endif char *start; char *end; int len; -#ifdef SKIPCOUNT - int n; -#endif start = osname; #ifdef SKIPCOUNT + int = n; for (n = SKIPCOUNT; --n >= 0 && start && (start = strchr (start, STARTCHAR)); start++) diff --git a/cde/programs/dtudcfonted/libfal/_fallcCT.c b/cde/programs/dtudcfonted/libfal/_fallcCT.c index dd94559c..2f7c342a 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcCT.c +++ b/cde/programs/dtudcfonted/libfal/_fallcCT.c @@ -95,17 +95,6 @@ static CTDataRec default_ct_data[] = { "JISX0208.1983-0:GR", "\033$)B" }, { "KSC5601.1987-0:GL", "\033$(C" }, { "KSC5601.1987-0:GR", "\033$)C" }, -#ifdef notdef - { "JISX0212.1990-0:GL", "\033$(D" }, - { "JISX0212.1990-0:GR", "\033$)D" }, - { "CNS11643.1986-1:GL", "\033$(G" }, - { "CNS11643.1986-1:GR", "\033$)G" }, - { "CNS11643.1986-2:GL", "\033$(H" }, - { "CNS11643.1986-2:GR", "\033$)H" }, - - /* Non-Standard Character Set Encodings */ - { "TIS620.2533-1:GR", "\033-T"}, -#endif } ; #define XctC0 0x0000 @@ -154,11 +143,9 @@ typedef struct { static CTInfo ct_list = NULL; static CTInfo -_XlcGetCTInfoFromEncoding(encoding, length) - register char *encoding; - register int length; +_XlcGetCTInfoFromEncoding(char *encoding, int length) { - register CTInfo ct_info; + CTInfo ct_info; for (ct_info = ct_list; ct_info; ct_info = ct_info->next) { if (length >= ct_info->encoding_len) { @@ -178,14 +165,11 @@ _XlcGetCTInfoFromEncoding(encoding, length) } static unsigned int -_XlcParseCT(parse, text, length) - register CTParse parse; - char **text; - int *length; +_XlcParseCT(CTParse parse, char **text, int *length) { unsigned int ret = 0; unsigned char ch; - register unsigned char *str = (unsigned char *) *text; + unsigned char *str = (unsigned char *) *text; bzero((char *) parse, sizeof(CTParseRec)); @@ -209,7 +193,9 @@ _XlcParseCT(parse, text, length) parse->ext_seg_length = (*str - 128) * 128 + *(str + 1) - 128; str += 2; - goto done; + *length -= (char *) str - *text; + *text = (char *) str; + return ret; } else if (*str == XctCntrlFunc && *length >= 4 && *(str + 1) >= 0x20 && *(str + 1) <= 0x2f && (*(str + 2) == XctIgnoreExt || @@ -220,7 +206,9 @@ _XlcParseCT(parse, text, length) parse->version = *str++ - 0x20; ret = *str++; - goto done; + *length -= (char *) str - *text; + *text = (char *) str; + return ret; } if (*str == XctMB) { /* multiple-byte sets */ @@ -276,21 +264,29 @@ _XlcParseCT(parse, text, length) parse->ct_info = _XlcGetCTInfoFromEncoding(*text, *length); } str++; - goto done; + *length -= (char *) str - *text; + *text = (char *) str; + return ret; case XctCSI: /* direction */ if (*str == XctLeftToRight && *(str + 1) == XctDirection) { ret = XctLeftToRight; str += 2; - goto done; + *length -= (char *) str - *text; + *text = (char *) str; + return ret; } else if (*str == XctRightToLeft && *(str + 1) == XctDirection) { ret = XctRightToLeft; str += 2; - goto done; + *length -= (char *) str - *text; + *text = (char *) str; + return ret; } else if (*str == XctDirectionEnd) { ret = XctDirectionEnd; str++; - goto done; + *length -= (char *) str - *text; + *text = (char *) str; + return ret; } SKIP_P(str) @@ -301,7 +297,9 @@ _XlcParseCT(parse, text, length) ret = XctCSISeq; str++; - goto done; + *length -= (char *) str - *text; + *text = (char *) str; + return ret; } if (ch & 0x80) { @@ -318,19 +316,11 @@ _XlcParseCT(parse, text, length) ret = XctGL; } - return ret; - -done: - *length -= (char *) str - *text; - *text = (char *) str; - return ret; } XlcCharSet -_fallcAddCT(name, encoding) - char *name; - char *encoding; +_fallcAddCT(char *name, char *encoding) { CTInfo ct_info; XlcCharSet charset; @@ -381,10 +371,9 @@ _fallcAddCT(name, encoding) } static CTInfo -_XlcGetCTInfoFromCharSet(charset) - register XlcCharSet charset; +_XlcGetCTInfoFromCharSet(XlcCharSet charset) { - register CTInfo ct_info; + CTInfo ct_info; for (ct_info = ct_list; ct_info; ct_info = ct_info->next) if (ct_info->charset == charset) @@ -394,8 +383,7 @@ _XlcGetCTInfoFromCharSet(charset) } Bool -_fallcParseCharSet(charset) - XlcCharSet charset; +_fallcParseCharSet(XlcCharSet charset) { CTParseRec parse; char *ptr, buf[BUFSIZ]; @@ -434,11 +422,11 @@ _fallcParseCharSet(charset) static void init_converter(); Bool -_fallcInitCTInfo() +_fallcInitCTInfo(void) { - register XlcCharSet charset; - register CTData ct_data; - register int num; + XlcCharSet charset; + CTData ct_data; + int num; if (ct_list == NULL) { num = sizeof(default_ct_data) / sizeof(CTDataRec); @@ -455,10 +443,7 @@ _fallcInitCTInfo() static int -_XlcCheckCTSequence(state, ctext, ctext_len) - State state; - char **ctext; - int *ctext_len; +_XlcCheckCTSequence(State state, char **ctext, int *ctext_len) { XlcCharSet charset; CTParseRec parse; @@ -493,8 +478,7 @@ _XlcCheckCTSequence(state, ctext, ctext_len) static void -init_state(conv) - XlcConv conv; +init_state(XlcConv conv) { State state = (State) conv->state; static XlcCharSet GL_charset = NULL; @@ -512,17 +496,17 @@ init_state(conv) } static int -cttocs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +cttocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { - register State state = (State) conv->state; - register unsigned char ch; + State state = (State) conv->state; + unsigned char ch; int length; XlcCharSet charset = NULL; char *ctptr, *bufptr; @@ -600,19 +584,18 @@ cttocs(conv, from, from_left, to, to_left, args, num_args) } static int -cstoct(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +cstoct( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { State state = (State) conv->state; XlcSide side; - unsigned char min_ch, max_ch; - register unsigned char ch; + unsigned char min_ch, max_ch, ch; int length; CTInfo ct_info; XlcCharSet charset; @@ -711,19 +694,19 @@ cstoct(conv, from, from_left, to, to_left, args, num_args) } static int -strtocs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +strtocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { State state = (State) conv->state; - register char *src, *dst; + char *src, *dst; unsigned char side; - register length; + int length; src = (char *) *from; dst = (char *) *to; @@ -746,14 +729,14 @@ strtocs(conv, from, from_left, to, to_left, args, num_args) } static int -cstostr(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +cstostr( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { State state = (State) conv->state; char *csptr, *string_ptr; @@ -792,8 +775,7 @@ cstostr(conv, from, from_left, to, to_left, args, num_args) static void -close_converter(conv) - XlcConv conv; +close_converter(XlcConv conv) { if (conv->state) Xfree((char *) conv->state); @@ -802,29 +784,25 @@ close_converter(conv) } static XlcConv -create_conv(methods) - XlcConvMethods methods; +create_conv(XlcConvMethods methods) { - register XlcConv conv; + XlcConv conv; conv = (XlcConv) Xmalloc(sizeof(XlcConvRec)); if (conv == NULL) return (XlcConv) NULL; conv->state = (XPointer) Xmalloc(sizeof(StateRec)); - if (conv->state == NULL) - goto err; + if (conv->state == NULL) { + close_converter(conv); + return (XlcConv) NULL; + } conv->methods = methods; init_state(conv); return conv; - -err: - close_converter(conv); - - return (XlcConv) NULL; } static XlcConvMethodsRec cttocs_methods = { @@ -834,11 +812,7 @@ static XlcConvMethodsRec cttocs_methods = { } ; static XlcConv -open_cttocs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_cttocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(&cttocs_methods); } @@ -850,11 +824,7 @@ static XlcConvMethodsRec cstoct_methods = { } ; static XlcConv -open_cstoct(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_cstoct(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(&cstoct_methods); } @@ -866,11 +836,7 @@ static XlcConvMethodsRec strtocs_methods = { } ; static XlcConv -open_strtocs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_strtocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(&strtocs_methods); } @@ -882,17 +848,13 @@ static XlcConvMethodsRec cstostr_methods = { } ; static XlcConv -open_cstostr(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_cstostr(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(&cstostr_methods); } static void -init_converter() +init_converter(void) { _fallcSetConverter((XLCd) NULL, XlcNCompoundText, (XLCd) NULL, XlcNCharSet, open_cttocs); diff --git a/cde/programs/dtudcfonted/libfal/_fallcCharSet.c b/cde/programs/dtudcfonted/libfal/_fallcCharSet.c index 6063c238..d4f2fa76 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcCharSet.c +++ b/cde/programs/dtudcfonted/libfal/_fallcCharSet.c @@ -51,15 +51,8 @@ #include "_fallibint.h" #include "_fallcPublic.h" -#if NeedVarargsPrototypes char * _fallcGetCSValues(XlcCharSet charset, ...) -#else -char * -_fallcGetCSValues(charset, va_alist) - XlcCharSet charset; - va_dcl -#endif { va_list var; XlcArgList args; @@ -95,8 +88,7 @@ typedef struct _XlcCharSetListRec { static XlcCharSetList charset_list = NULL; XlcCharSet -_fallcGetCharSet(name) - char *name; +_fallcGetCharSet(char *name) { XlcCharSetList list; XrmQuark xrm_name; @@ -112,8 +104,7 @@ _fallcGetCharSet(name) } Bool -_fallcAddCharSet(charset) - XlcCharSet charset; +_fallcAddCharSet(XlcCharSet charset) { XlcCharSetList list; @@ -147,10 +138,7 @@ static XlcResource resources[] = { }; static char * -get_values(charset, args, num_args) - register XlcCharSet charset; - register XlcArgList args; - register int num_args; +get_values(XlcCharSet charset, XlcArgList args, int num_args) { if (resources[0].xrm_name == NULLQUARK) _fallcCompileResourceList(resources, XlcNumber(resources)); @@ -160,9 +148,7 @@ get_values(charset, args, num_args) } XlcCharSet -_fallcCreateDefaultCharSet(name, ct_sequence) - char *name; - char *ct_sequence; +_fallcCreateDefaultCharSet(char *name, char *ct_sequence) { XlcCharSet charset; diff --git a/cde/programs/dtudcfonted/libfal/_fallcConv.c b/cde/programs/dtudcfonted/libfal/_fallcConv.c index c5ebd5a6..0afc9c18 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcConv.c +++ b/cde/programs/dtudcfonted/libfal/_fallcConv.c @@ -67,20 +67,19 @@ typedef struct _fallcConverterListRec { static XlcConverterList conv_list = NULL; static void -close_converter(conv) - XlcConv conv; +close_converter(XlcConv conv) { (*conv->methods->close)(conv); } static XlcConv -get_converter(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - XrmQuark from_type; - XLCd to_lcd; - XrmQuark to_type; +get_converter( + XLCd from_lcd, + XrmQuark from_type, + XLCd to_lcd, + XrmQuark to_type) { - register XlcConverterList list, prev = NULL; + XlcConverterList list, prev = NULL; XlcConv conv; for (list = conv_list; list; list = list->next) { @@ -103,15 +102,15 @@ get_converter(from_lcd, from_type, to_lcd, to_type) } Bool -_fallcSetConverter(from_lcd, from, to_lcd, to, converter) - XLCd from_lcd; - char *from; - XLCd to_lcd; - char *to; - XlcOpenConverterProc converter; +_fallcSetConverter( + XLCd from_lcd, + char *from, + XLCd to_lcd, + char *to, + XlcOpenConverterProc converter) { - register XlcConverterList list; - register XrmQuark from_type, to_type; + XlcConverterList list; + XrmQuark from_type, to_type; from_type = falrmStringToQuark(from); to_type = falrmStringToQuark(to); @@ -148,14 +147,14 @@ typedef struct _ConvRec { } ConvRec, *Conv; static int -indirect_convert(lc_conv, from, from_left, to, to_left, args, num_args) - XlcConv lc_conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +indirect_convert( + XlcConv lc_conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { Conv conv = (Conv) lc_conv->state; XlcConv from_conv = conv->from_conv; @@ -205,8 +204,7 @@ indirect_convert(lc_conv, from, from_left, to, to_left, args, num_args) } static void -close_indirect_converter(lc_conv) - XlcConv lc_conv; +close_indirect_converter(XlcConv lc_conv) { Conv conv = (Conv) lc_conv->state; @@ -223,8 +221,7 @@ close_indirect_converter(lc_conv) } static void -reset_indirect_converter(lc_conv) - XlcConv lc_conv; +reset_indirect_converter(XlcConv lc_conv) { Conv conv = (Conv) lc_conv->state; @@ -243,11 +240,7 @@ static XlcConvMethodsRec conv_methods = { } ; static XlcConv -open_indirect_converter(from_lcd, from, to_lcd, to) - XLCd from_lcd; - char *from; - XLCd to_lcd; - char *to; +open_indirect_converter(XLCd from_lcd, char *from, XLCd to_lcd, char *to) { XlcConv lc_conv, from_conv, to_conv; Conv conv; @@ -274,8 +267,10 @@ open_indirect_converter(from_lcd, from, to_lcd, to) lc_conv->methods = &conv_methods; lc_conv->state = (XPointer) Xmalloc(sizeof(ConvRec)); - if (lc_conv->state == NULL) - goto err; + if (lc_conv->state == NULL){ + close_indirect_converter(lc_conv); + return (XlcConv) NULL; + } 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); if (from_conv == NULL) from_conv = get_converter(from_lcd, from_type, from_lcd, QChar); - if (from_conv == NULL) - goto err; + if (from_conv == NULL){ + close_indirect_converter(lc_conv); + return (XlcConv) NULL; + } conv->from_conv = from_conv; 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); if (to_conv == NULL) to_conv = get_converter((XLCd) NULL, QCharSet, (XLCd) NULL, to_type); - if (to_conv == NULL) - goto err; + if (to_conv == NULL){ + close_indirect_converter(lc_conv); + return (XlcConv) NULL; + } conv->to_conv = to_conv; return lc_conv; - -err: - close_indirect_converter(lc_conv); - - return (XlcConv) NULL; } XlcConv -_fallcOpenConverter(from_lcd, from, to_lcd, to) - XLCd from_lcd; - char *from; - XLCd to_lcd; - char *to; +_fallcOpenConverter(XLCd from_lcd, char *from, XLCd to_lcd, char *to) { XlcConv conv; XrmQuark from_type, to_type; @@ -327,29 +317,27 @@ _fallcOpenConverter(from_lcd, from, to_lcd, to) } void -_fallcCloseConverter(conv) - XlcConv conv; +_fallcCloseConverter(XlcConv conv) { close_converter(conv); } int -_fallcConvert(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +_fallcConvert( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { return (*conv->methods->convert)(conv, from, from_left, to, to_left, args, num_args); } void -_fallcResetConverter(conv) - XlcConv conv; +_fallcResetConverter(XlcConv conv) { if (conv->methods->reset) (*conv->methods->reset)(conv); diff --git a/cde/programs/dtudcfonted/libfal/_fallcDB.c b/cde/programs/dtudcfonted/libfal/_fallcDB.c index 6aa89546..864f95bc 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcDB.c +++ b/cde/programs/dtudcfonted/libfal/_fallcDB.c @@ -46,21 +46,12 @@ * SOFTWARE. * */ -#ifndef NOT_X_ENV #include "syncx.h" #include #include "_fallibint.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 the database parsing routine. */ /* For UDC/VW */ @@ -172,7 +163,7 @@ typedef struct { static DBParseInfo parse_info; -static void init_parse_info() +static void init_parse_info(void) { static int first = 1; char *ptr; @@ -192,7 +183,7 @@ static void init_parse_info() } static void -clear_parse_info() +clear_parse_info(void) { int i; char *ptr; @@ -220,8 +211,7 @@ clear_parse_info() } static Bool -realloc_parse_info(len) -int len; +realloc_parse_info(int len) { char *p; @@ -245,8 +235,7 @@ typedef struct _Line { } Line; static void -free_line(line) - Line *line; +free_line(Line *line) { if(line->str != NULL){ Xfree(line->str); @@ -255,9 +244,7 @@ free_line(line) } static int -realloc_line(line, size) - Line *line; - int size; +realloc_line(Line *line, int size) { char *str = line->str; @@ -279,21 +266,10 @@ realloc_line(line, size) #define iswhite(ch) ((ch) == SYM_SPACE || (ch) == SYM_TAB) static void -zap_comment(str, quoted) - char *str; - int *quoted; +zap_comment(char *str, int *quoted) { 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){ if(*p == SYM_DOUBLE_QUOTE){ if(p == str || p[-1] != SYM_BACKSLASH){ @@ -317,13 +293,11 @@ zap_comment(str, quoted) } ++p; } -#endif + } static int -read_line(fd, line) - FILE *fd; - Line *line; +read_line(FILE *fd, Line *line) { char buf[BUFSIZE], *p; int len; @@ -347,7 +321,7 @@ read_line(fd, line) if(cur + len + 1 > line->maxsize){ /* need to reallocate buffer. */ if(! realloc_line(line, line->maxsize + BUFSIZE)){ - goto err; /* realloc error. */ + return -1; /* realloc error. */ } str = line->str; } @@ -369,19 +343,15 @@ read_line(fd, line) } if(quoted){ /* error. still in quoted state. */ - goto err; + return -1; } return line->cursize = cur; - - err:; - return -1; } /************************************************************************/ static Token -get_token(str) - char *str; +get_token(char *str) { switch(*str){ case SYM_NEWLINE: return T_NEWLINE; @@ -405,9 +375,7 @@ get_token(str) } static int -get_word(str, word) - char *str; - char *word; +get_word(char *str, char *word) { char *p = str, *w = word; Token token; @@ -435,9 +403,7 @@ get_word(str, word) } static int -get_quoted_word(str, word) - char *str; - char *word; +get_quoted_word(char *str, char *word) { char *p = str, *w = word; Token token; @@ -451,7 +417,8 @@ get_quoted_word(str, word) token_len = token_tbl[token].len; if(token == T_DOUBLE_QUOTE){ p += token_len; - goto found; + *w = '\0'; + return p - str; } if(token == T_BACKSLASH){ p += token_len; @@ -466,16 +433,12 @@ get_quoted_word(str, word) } /* error. cannot detect next double quote */ return 0; - - found:; - *w = '\0'; - return p - str; } /************************************************************************/ static int -append_value_list() +append_value_list(void) { char **value_list = parse_info.value; char *value = NULL; @@ -529,7 +492,7 @@ append_value_list() parse_info.bufsize = 0; return 1; - err:; + err: if(value_list){ Xfree((char **)value_list); } @@ -544,10 +507,9 @@ append_value_list() } static int -construct_name(name) - char *name; +construct_name(char *name) { - register int i, len = 0; + int i, len = 0; char *p = name; for(i = 0; i <= parse_info.nest_depth; ++i){ @@ -565,57 +527,58 @@ construct_name(name) } static int -store_to_database(db) - Database *db; +store_to_database(Database *db) { Database new = (Database)NULL; char name[BUFSIZE]; - if(parse_info.pre_state == S_VALUE){ - if(! append_value_list()){ - goto err; + while(1){ + + if(parse_info.pre_state == S_VALUE){ + if(! append_value_list()){ + break; + } } - } - if(parse_info.name[parse_info.nest_depth] == NULL){ - goto err; - } + if(parse_info.name[parse_info.nest_depth] == NULL){ + break; + } - new = (Database)Xmalloc(sizeof(DatabaseRec)); - if(new == (Database)NULL){ - goto err; - } - bzero(new, sizeof(DatabaseRec)); + 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){ - goto err; - } - strcpy(new->category, parse_info.category); + new->category = (char *)Xmalloc(strlen(parse_info.category) + 1); + if(new->category == NULL){ + break; + } + 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; + 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; + 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; + parse_info.value = (char **)NULL; + parse_info.value_num = 0; + parse_info.value_len = 0; - return 1; + return 1; + } - err:; if(new){ if(new->category){ Xfree(new->category); @@ -641,8 +604,7 @@ store_to_database(db) #define END_MARK_LEN 3 /*strlen(END_MARK)*/ static int -check_category_end(str) - char *str; +check_category_end(char *str) { char *p; int len; @@ -667,37 +629,28 @@ check_category_end(str) /************************************************************************/ static int -f_newline(str, token, db) - char *str; - Token token; - Database *db; +f_newline(char *str, Token token, Database *db) { switch(parse_info.pre_state){ case S_NULL: case S_CATEGORY: break; case S_NAME: - goto err; /* no value */ + return 0; /* no value */ case S_VALUE: if(!store_to_database(db)){ - goto err; + return 0; } parse_info.pre_state = S_CATEGORY; break; default: - goto err; + return 0; } return token_tbl[token].len; - - err:; - return 0; } static int -f_comment(str, token, db) - char *str; - Token token; - Database *db; +f_comment(char *str, Token token, Database *db) { /* NOTE: comment is already handled in read_line(), so this function is not necessary. */ @@ -711,10 +664,7 @@ f_comment(str, token, db) } static int -f_white(str, token, db) - char *str; - Token token; - Database *db; +f_white(char *str, Token token, Database *db) { char *p = str; @@ -725,76 +675,61 @@ f_white(str, token, db) } static int -f_semicolon(str, token, db) - char *str; - Token token; - Database *db; +f_semicolon(char *str, Token token, Database *db) { switch(parse_info.pre_state){ case S_NULL: case S_CATEGORY: case S_NAME: - goto err; + return 0; case S_VALUE: if(! append_value_list()){ - goto err; + return 0; } parse_info.pre_state = S_VALUE; break; default: - goto err; + return 0; } return token_tbl[token].len; - - err:; - return 0; } static int -f_left_brace(str, token, db) - char *str; - Token token; - Database *db; +f_left_brace(char *str, Token token, Database *db) { switch(parse_info.pre_state){ case S_NULL: case S_CATEGORY: - goto err; + return 0; case S_NAME: if(parse_info.name[parse_info.nest_depth] == NULL || parse_info.nest_depth + 1 > MAX_NAME_NEST){ - goto err; + return 0; } ++parse_info.nest_depth; parse_info.pre_state = S_CATEGORY; break; case S_VALUE: default: - goto err; + return 0; } return token_tbl[token].len; - - err: - return 0; } static int -f_right_brace(str, token, db) - char *str; - Token token; - Database *db; +f_right_brace(char *str, Token token, Database *db) { if(parse_info.nest_depth < 1){ - goto err; + return 0; } switch(parse_info.pre_state){ case S_NULL: case S_NAME: - goto err; + return 0; case S_VALUE: if(! store_to_database(db)){ - goto err; + return 0; } /* fall into next case */ case S_CATEGORY: @@ -806,19 +741,13 @@ f_right_brace(str, token, db) parse_info.pre_state = S_CATEGORY; break; default: - goto err; + return 0; } return token_tbl[token].len; - - err:; - return 0; } static int -f_double_quote(str, token, db) - char *str; - Token token; - Database *db; +f_double_quote(char *str, Token token, Database *db) { char word[BUFSIZE]; int len = 0; @@ -826,17 +755,17 @@ f_double_quote(str, token, db) switch(parse_info.pre_state){ case S_NULL: case S_CATEGORY: - goto err; + return 0; case S_NAME: case S_VALUE: len = get_quoted_word(str, word); if(len < 1){ - goto err; + return 0; } if( (parse_info.bufsize + (int)strlen(word) +1) >= parse_info.bufMaxSize){ if(realloc_parse_info(strlen(word) +1) == False){ - goto err; + return 0; } } strcpy(&parse_info.buf[parse_info.bufsize], word); @@ -844,28 +773,19 @@ f_double_quote(str, token, db) parse_info.pre_state = S_VALUE; break; default: - goto err; + return 0; } return len; /* including length of token */ - - err:; - return 0; } static int -f_backslash(str, token, db) - char *str; - Token token; - Database *db; +f_backslash(char *str, Token token, Database *db) { return f_default(str, token, db); } static int -f_numeric(str, token, db) - char *str; - Token token; - Database *db; +f_numeric(char *str, Token token, Database *db) { char word[BUFSIZE], *p; int len; @@ -874,19 +794,19 @@ f_numeric(str, token, db) switch(parse_info.pre_state){ case S_NULL: case S_CATEGORY: - goto err; + return 0; case S_NAME: case S_VALUE: token_len = token_tbl[token].len; p = str + token_len; len = get_word(p, word); if(len < 1){ - goto err; + return 0; } if( (parse_info.bufsize + token_len + (int)strlen(word) +1) >= parse_info.bufMaxSize){ if(realloc_parse_info(token_len + strlen(word) +1) == False){ - goto err; + return 0; } } 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; break; default: - goto err; + return 0; } return len + token_len; - - err:; - return 0; } static int -f_default(str, token, db) - char *str; - Token token; - Database *db; +f_default(char *str, Token token, Database *db) { char word[BUFSIZE], *p; int len; len = get_word(str, word); if(len < 1){ - goto err; + return 0; } switch(parse_info.pre_state){ case S_NULL: if(parse_info.category != NULL){ - goto err; + return 0; } p = (char *)Xmalloc(strlen(word) + 1); if(p == NULL){ - goto err; + return 0; } strcpy(p, word); parse_info.category = p; @@ -942,7 +856,7 @@ f_default(str, token, db) } p = (char *)Xmalloc(strlen(word) + 1); if(p == NULL){ - goto err; + return 0; } strcpy(p, word); 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 ) >= parse_info.bufMaxSize){ if(realloc_parse_info(strlen(word) +1) == False){ - goto err; + return 0; } } strcpy(&parse_info.buf[parse_info.bufsize], word); @@ -964,20 +878,16 @@ f_default(str, token, db) parse_info.pre_state = S_VALUE; break; default: - goto err; + return 0; } return len; - - err:; - return 0; } /************************************************************************/ #ifdef DEBUG static void -PrintDatabase(db) - Database db; +PrintDatabase(Database db) { Database p = db; int i = 0, j; @@ -998,8 +908,7 @@ PrintDatabase(db) #endif static void -DestroyDatabase(db) - Database db; +DestroyDatabase(Database db) { Database p = db; @@ -1023,8 +932,7 @@ DestroyDatabase(db) } static int -CountDatabase(db) - Database db; +CountDatabase(Database db) { Database p = db; int cnt = 0; @@ -1037,8 +945,7 @@ CountDatabase(db) } static Database -CreateDatabase(dbfile) - char *dbfile; +CreateDatabase(char *dbfile) { Database db = (Database)NULL; FILE *fd; @@ -1101,8 +1008,6 @@ CreateDatabase(dbfile) /************************************************************************/ -#ifndef NOT_X_ENV - /* locale framework functions */ typedef struct _XlcDatabaseRec { @@ -1129,12 +1034,12 @@ static XlcDatabaseList _db_list = (XlcDatabaseList)NULL; /* This function retrieves XLocale database information. */ /************************************************************************/ void -_fallcGetResource(lcd, category, class, value, count) - XLCd lcd; - char *category; - char *class; - char ***value; - int *count; +_fallcGetResource( + XLCd lcd, + char *category, + char *class, + char ***value, + int *count) { XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd); @@ -1148,12 +1053,12 @@ _fallcGetResource(lcd, category, class, value, count) /* This function retrieves XLocale database information. */ /************************************************************************/ void -_fallcGetLocaleDataBase(lcd, category, name, value, count) - XLCd lcd; - char *category; - char *name; - char ***value; - int *count; +_fallcGetLocaleDataBase( + XLCd lcd, + char *category, + char *name, + char ***value, + int *count) { XlcDatabase lc_db = (XlcDatabase)XLC_PUBLIC(lcd, xlocale_db); 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 */ /* 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. */ /************************************************************************/ void -_fallcDestroyLocaleDataBase(lcd) - XLCd lcd; +_fallcDestroyLocaleDataBase(XLCd lcd) { XlcDatabase lc_db = (XlcDatabase)XLC_PUBLIC(lcd, xlocale_db); XlcDatabaseList p, prev; @@ -1215,8 +1119,7 @@ _fallcDestroyLocaleDataBase(lcd) /* the specified XLCd. */ /************************************************************************/ XPointer -_fallcCreateLocaleDataBase(lcd) - XLCd lcd; +_fallcCreateLocaleDataBase(XLCd lcd) { XlcDatabaseList list, new; Database p, database = (Database)NULL; @@ -1247,7 +1150,11 @@ _fallcCreateLocaleDataBase(lcd) n = CountDatabase(database); lc_db = (XlcDatabase)Xmalloc(sizeof(XlcDatabaseRec) * (n + 1)); 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)); for(p = database, i = 0; p && i < n; p = p->next, ++i){ @@ -1258,7 +1165,11 @@ _fallcCreateLocaleDataBase(lcd) new = (XlcDatabaseList)Xmalloc(sizeof(XlcDatabaseListRec)); 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->lc_db = lc_db; @@ -1268,13 +1179,4 @@ _fallcCreateLocaleDataBase(lcd) _db_list = new; 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 */ diff --git a/cde/programs/dtudcfonted/libfal/_fallcDefConv.c b/cde/programs/dtudcfonted/libfal/_fallcDefConv.c index eaa92529..ce3b9c92 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcDefConv.c +++ b/cde/programs/dtudcfonted/libfal/_fallcDefConv.c @@ -59,18 +59,18 @@ typedef struct _StateRec { } StateRec, *State; static int -strtostr(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +strtostr( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { - register char *src, *dst; + char *src, *dst; unsigned char side; - register length; + int length; if (from == NULL || *from == NULL) return 0; @@ -104,18 +104,18 @@ strtostr(conv, from, from_left, to, to_left, args, num_args) } static int -wcstostr(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +wcstostr( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { - register wchar_t *src, side; - register char *dst; - register length; + wchar_t *src, side; + char *dst; + int length; if (from == NULL || *from == NULL) return 0; @@ -149,18 +149,18 @@ wcstostr(conv, from, from_left, to, to_left, args, num_args) } static int -cstostr(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +cstostr( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { - register char *src, *dst; + char *src, *dst; unsigned char side; - register length; + int length; if (from == NULL || *from == NULL) return 0; @@ -202,18 +202,18 @@ cstostr(conv, from, from_left, to, to_left, args, num_args) } static int -strtowcs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +strtowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { - register char *src; - register wchar_t *dst; - register length; + char *src; + wchar_t *dst; + int length; if (from == NULL || *from == NULL) return 0; @@ -244,8 +244,7 @@ strtowcs(conv, from, from_left, to, to_left, args, num_args) static void -close_converter(conv) - XlcConv conv; +close_converter(XlcConv conv) { if (conv->state) Xfree((char *) conv->state); @@ -254,10 +253,9 @@ close_converter(conv) } static XlcConv -create_conv(methods) - XlcConvMethods methods; +create_conv(XlcConvMethods methods) { - register XlcConv conv; + XlcConv conv; State state; static XlcCharSet GL_charset = NULL; static XlcCharSet GR_charset = NULL; @@ -274,8 +272,10 @@ create_conv(methods) conv->state = NULL; state = (State) Xmalloc(sizeof(StateRec)); - if (state == NULL) - goto err; + if (state == NULL){ + close_converter(conv); + return (XlcConv) NULL; + } state->GL_charset = state->charset = GL_charset; state->GR_charset = GR_charset; @@ -284,11 +284,6 @@ create_conv(methods) conv->state = (XPointer) state; return conv; - -err: - close_converter(conv); - - return (XlcConv) NULL; } static XlcConvMethodsRec strtostr_methods = { @@ -298,11 +293,7 @@ static XlcConvMethodsRec strtostr_methods = { } ; static XlcConv -open_strtostr(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_strtostr( XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type ) { return create_conv(&strtostr_methods); } @@ -314,11 +305,7 @@ static XlcConvMethodsRec wcstostr_methods = { } ; static XlcConv -open_wcstostr(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_wcstostr( XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type ) { return create_conv(&wcstostr_methods); } @@ -330,11 +317,7 @@ static XlcConvMethodsRec cstostr_methods = { } ; static XlcConv -open_cstostr(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_cstostr( XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type ) { return create_conv(&cstostr_methods); } @@ -346,18 +329,13 @@ static XlcConvMethodsRec strtowcs_methods = { } ; static XlcConv -open_strtowcs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_strtowcs( XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type ) { return create_conv(&strtowcs_methods); } XLCd -_fallcDefaultLoader(name) - char *name; +_fallcDefaultLoader(char *name) { XLCd lcd; diff --git a/cde/programs/dtudcfonted/libfal/_fallcDynamic.c b/cde/programs/dtudcfonted/libfal/_fallcDynamic.c index eaa7c0fb..6736248d 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcDynamic.c +++ b/cde/programs/dtudcfonted/libfal/_fallcDynamic.c @@ -52,8 +52,7 @@ extern char *dlerror(); #define GLOBAL 0x100 XLCd -_fallcDynamicLoader(name) - char *name; +_fallcDynamicLoader(char *name) { char libpath[1024]; XLCdMethods _fallcGenericMethods; diff --git a/cde/programs/dtudcfonted/libfal/_fallcEuc.c b/cde/programs/dtudcfonted/libfal/_fallcEuc.c index 2b79a71e..f93fa78c 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcEuc.c +++ b/cde/programs/dtudcfonted/libfal/_fallcEuc.c @@ -105,23 +105,23 @@ static CodeSet wc_codeset(); */ static int -euc_mbstowcs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +euc_mbstowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { XLCd lcd = (XLCd)conv->state; - register Uchar ch; - register int chr_len = 0; - register int sshift = False; - register int shift_mult = 0; - register Uint chrcode; + Uchar ch; + int chr_len = 0; + int sshift = False; + int shift_mult = 0; + Uint chrcode; Uint wc_encode = 0; Uint wc_tmp = 0; @@ -259,20 +259,20 @@ euc_mbstowcs(conv, from, from_left, to, to_left, args, num_args) static int -euc_wcstombs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +euc_wcstombs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { wchar_t *inbufptr = (wchar_t *) *from; - register XPointer outbufptr = *to; + XPointer outbufptr = *to; XPointer outbuf_base = outbufptr; wchar_t wch; - register length; + int length; Uchar tmp; int num_conv; int unconv_num = 0; @@ -324,14 +324,14 @@ euc_wcstombs(conv, from, from_left, to, to_left, args, num_args) static int -euc_mbtocs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +euc_mbtocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { XLCd lcd = (XLCd)conv->state; XlcCharSet charset; @@ -340,7 +340,7 @@ euc_mbtocs(conv, from, from_left, to, to_left, args, num_args) int length; int unconv_num = 0; int min_ch = 0; - register char *src = *from, *dst = *to; + char *src = *from, *dst = *to; if (isleftside(*src)) { /* 7-bit (CS0) */ @@ -411,14 +411,14 @@ euc_mbtocs(conv, from, from_left, to, to_left, args, num_args) static int -euc_mbstocs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +euc_mbstocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { XLCd lcd = (XLCd)conv->state; char *tmp_from, *tmp_to; @@ -471,21 +471,21 @@ euc_mbstocs(conv, from, from_left, to, to_left, args, num_args) static int -euc_wcstocs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +euc_wcstocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { XLCd lcd = (XLCd)conv->state; wchar_t *wcptr = (wchar_t *) *from; - register char *bufptr = (char *) *to; + char *bufptr = (char *) *to; wchar_t wch; char *tmpptr; - register length; + int length; CodeSet codeset; Ulong wc_encoding; int unconv_num = 0; @@ -533,20 +533,20 @@ euc_wcstocs(conv, from, from_left, to, to_left, args, num_args) static int -euc_cstombs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +euc_cstombs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { XLCd lcd = (XLCd)conv->state; - register char *csptr = *from; - register char *bufptr = *to; + char *csptr = *from; + char *bufptr = *to; int csstr_len = *from_left; - register buf_len = *to_left; + int buf_len = *to_left; int length; CodeSet codeset; int cvt_length; @@ -593,21 +593,21 @@ euc_cstombs(conv, from, from_left, to, to_left, args, num_args) static int -euc_cstowcs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +euc_cstowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { XLCd lcd = (XLCd)conv->state; - register char *csptr = *from; + char *csptr = *from; wchar_t *bufptr = (wchar_t *) *to; wchar_t *toptr = (wchar_t *) *to; int csstr_len = *from_left; - register buf_len = *to_left; + int buf_len = *to_left; wchar_t wch; int length; 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 -wc_codeset(lcd, wch) - XLCd lcd; - wchar_t wch; +wc_codeset(XLCd lcd, wchar_t wch) { - register CodeSet *codesets = XLC_GENERIC(lcd, codeset_list); - register int end = XLC_GENERIC(lcd, codeset_num); - register Ulong widech = (Ulong)(wch & XLC_GENERIC(lcd, wc_encode_mask)); + CodeSet *codesets = XLC_GENERIC(lcd, codeset_list); + int end = XLC_GENERIC(lcd, codeset_num); + Ulong widech = (Ulong)(wch & XLC_GENERIC(lcd, wc_encode_mask)); for (; --end >= 0; codesets++) if ( widech == (*codesets)->wc_encoding ) @@ -669,13 +667,11 @@ wc_codeset(lcd, wch) static CodeSet -GetCodeSetFromCharSet(lcd, charset) - XLCd lcd; - XlcCharSet charset; +GetCodeSetFromCharSet(XLCd lcd, XlcCharSet charset) { - register CodeSet *codeset = XLC_GENERIC(lcd, codeset_list); - register XlcCharSet *charset_list; - register codeset_num, num_charsets; + CodeSet *codeset = XLC_GENERIC(lcd, codeset_list); + XlcCharSet *charset_list; + int codeset_num, num_charsets; codeset_num = XLC_GENERIC(lcd, codeset_num); @@ -693,9 +689,7 @@ GetCodeSetFromCharSet(lcd, charset) static XlcConv -create_conv(lcd, methods) - XLCd lcd; - XlcConvMethods methods; +create_conv(XLCd lcd, XlcConvMethods methods) { XlcConv conv; @@ -711,7 +705,6 @@ create_conv(lcd, methods) /* * Stripped down Direct CT converters for EUC - * */ 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. */ static void -initCTptr(lcd) - XLCd lcd; +initCTptr(XLCd lcd) { int num_codesets = XLC_GENERIC(lcd, codeset_num); int num_charsets; @@ -829,27 +821,27 @@ initCTptr(lcd) #define SKIP_P(str) while (*(str) >= 0x30 && *(str) <= 0x3f) (str)++; static int -euc_ctstowcs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +euc_ctstowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { XLCd lcd = (XLCd)conv->state; Ulong wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits); - register XPointer inbufptr = *from; + XPointer inbufptr = *from; XPointer inbuf_base; - register wchar_t *outbufptr = (wchar_t *) *to; + wchar_t *outbufptr = (wchar_t *) *to; wchar_t *outbuf_base = outbufptr; - register clen, length; + int clen, length; int num_conv; int unconv_num = 0; unsigned int ct_seglen = 0; Uchar ct_type = 0; - register shift_mult; + int shift_mult; wchar_t wc_tmp; wchar_t wch; 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) static int -euc_wcstocts(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +euc_wcstocts( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { - register ct_len = *to_left; - register wchar_t *inbufptr = (wchar_t *) *from; - register char *ctptr = *to; + int ct_len = *to_left; + wchar_t *inbufptr = (wchar_t *) *from; + char *ctptr = *to; XPointer ct_base = ctptr; wchar_t wch; - register length; - register unconv_num = 0; + int length; + int unconv_num = 0; Uchar tmp; Uchar t1 = 0, t2; int num_conv; @@ -1085,20 +1077,20 @@ euc_wcstocts(conv, from, from_left, to, to_left, args, num_args) #define userdef (ctdp == ctdptr[Userdef]) static int -euc_ctstombs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +euc_ctstombs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { - register XPointer inbufptr = *from; - register XPointer outbufptr = *to; + XPointer inbufptr = *from; + XPointer outbufptr = *to; XPointer inbuf_base; XPointer outbuf_base = outbufptr; - register clen, length; + int clen, length; int unconv_num = 0; int num_conv; unsigned int ct_seglen = 0; @@ -1204,22 +1196,22 @@ euc_ctstombs(conv, from, from_left, to, to_left, args, num_args) static int -euc_mbstocts(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +euc_mbstocts( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { - register ct_len = *to_left; + int ct_len = *to_left; int cs_num; int clen, length; int unconv_num = 0; int num_conv; XPointer inbufptr = *from; - register char *ctptr = *to; + char *ctptr = *to; XPointer ct_base = ctptr; StateRec ct_state; @@ -1321,8 +1313,7 @@ euc_mbstocts(conv, from, from_left, to, to_left, args, num_args) static void -close_converter(conv) - XlcConv conv; +close_converter(XlcConv conv) { Xfree((char *) conv); } @@ -1346,118 +1337,73 @@ static XlcConvMethodsRec conv_methods[] = { static XlcConv -open_mbstocs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_mbstocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[MBSTOCS]); } static XlcConv -open_wcstocs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_wcstocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[WCSTOCS]); } static XlcConv -open_mbtocs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_mbtocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[MBTOCS]); } static XlcConv -open_cstombs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_cstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[CSTOMBS]); } static XlcConv -open_cstowcs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_cstowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[CSTOWCS]); } static XlcConv -open_mbstowcs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_mbstowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[MBSTOWCS]); } static XlcConv -open_wcstombs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_wcstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[WCSTOMBS]); } static XlcConv -open_ctstowcs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_ctstowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[CTSTOWCS]); } static XlcConv -open_ctstombs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_ctstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[CTSTOMBS]); } static XlcConv -open_wcstocts(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_wcstocts(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[WCSTOCTS]); } static XlcConv -open_mbstocts(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_mbstocts(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[MBSTOCTS]); } XLCd -_fallcEucLoader(name) - char *name; +_fallcEucLoader(char *name) { XLCd lcd; diff --git a/cde/programs/dtudcfonted/libfal/_fallcFile.c b/cde/programs/dtudcfonted/libfal/_fallcFile.c index e994ba0d..9bb12539 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcFile.c +++ b/cde/programs/dtudcfonted/libfal/_fallcFile.c @@ -51,9 +51,6 @@ #include "_fallibint.h" #include "_fallcPubI.h" #include -#ifdef X_NOT_STDC_ENV -extern char *getenv(); -#endif /************************************************************************/ @@ -64,10 +61,7 @@ extern char *getenv(); */ static int -parse_line(line, argv, argsize) - char *line; - char **argv; - int argsize; +parse_line(char *line, char **argv, int argsize) { int argc = 0; char *p = line; @@ -97,8 +91,7 @@ parse_line(line, argv, argsize) #endif static void -xlocaledir(path) - char *path; +xlocaledir(char *path) { char *dir, *p = path; int len; @@ -114,10 +107,7 @@ xlocaledir(path) } static int -parse_path(path, argv, argsize) - char *path; - char **argv; - int argsize; +parse_path(char *path, char **argv, int argsize) { char *p = path; int i, n; @@ -144,10 +134,7 @@ parse_path(path, argv, argsize) enum { LtoR, RtoL }; static char * -_XlcResolveName(lc_name, file_name, direction) - char *lc_name; - char *file_name; - int direction; /* mapping direction */ +_XlcResolveName(char *lc_name, char *file_name, int direction)/*mapping direction*/ { FILE *fp; char buf[BUFSIZE], *name = NULL; @@ -195,9 +182,7 @@ _XlcResolveName(lc_name, file_name, direction) #define tolower(ch) ((ch) - 'A' + 'a') */ static char * -lowercase(dst, src) - char *dst; - char *src; +lowercase(char *dst, char *src) { char *s, *t; @@ -210,9 +195,7 @@ lowercase(dst, src) /************************************************************************/ char * -_fallcFileName(lcd, category) - XLCd lcd; - char *category; +_fallcFileName(XLCd lcd, char *category) { char lc_name[BUFSIZE]; char cat[BUFSIZE], dir[BUFSIZE]; @@ -267,12 +250,12 @@ _fallcFileName(lcd, category) #endif int -_fallcResolveLocaleName(lc_name, full_name, language, territory, codeset) - char *lc_name; - char *full_name; - char *language; - char *territory; - char *codeset; +_fallcResolveLocaleName( + char *lc_name, + char *full_name, + char *language, + char *territory, + char *codeset) { char dir[BUFSIZE], buf[BUFSIZE], *name = NULL; int i, n; @@ -337,9 +320,7 @@ _fallcResolveLocaleName(lc_name, full_name, language, territory, codeset) #endif int -_fallcResolveDBName(lc_name, file_name) - char *lc_name; - char *file_name; +_fallcResolveDBName(char *lc_name, char *file_name) { char dir[BUFSIZE], buf[BUFSIZE], *name = NULL; int i, n; @@ -367,8 +348,7 @@ _fallcResolveDBName(lc_name, file_name) /************************************************************************/ int -_fallcResolveI18NPath(path_name) - char *path_name; +_fallcResolveI18NPath(char *path_name) { if(path_name != NULL){ xlocaledir(path_name); diff --git a/cde/programs/dtudcfonted/libfal/_fallcGenConv.c b/cde/programs/dtudcfonted/libfal/_fallcGenConv.c index 15358814..6e577c6a 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcGenConv.c +++ b/cde/programs/dtudcfonted/libfal/_fallcGenConv.c @@ -87,17 +87,6 @@ static CTDataRec default_ct_data[] = { "JISX0208.1983-0:GR", "\033$)B" }, { "KSC5601.1987-0:GL", "\033$(C" }, { "KSC5601.1987-0:GR", "\033$)C" }, -#ifdef notdef - { "JISX0212.1990-0:GL", "\033$(D" }, - { "JISX0212.1990-0:GR", "\033$)D" }, - { "CNS11643.1986-1:GL", "\033$(G" }, - { "CNS11643.1986-1:GR", "\033$)G" }, - { "CNS11643.1986-2:GL", "\033$(H" }, - { "CNS11643.1986-2:GR", "\033$)H" }, - - /* Non-Standard Character Set Encodings */ - { "TIS620.2533-1:GR", "\033-T"}, -#endif } ; static CTDataRec directionality_data[] = @@ -128,10 +117,7 @@ typedef struct _StateRec { /* -------------------------------------------------------------------------- */ static int -compare(src, encoding, length) - register char *src; - register char *encoding; - register int length; +compare(char *src, char *encoding, int length) { char *start = src; @@ -146,9 +132,7 @@ compare(src, encoding, length) } static unsigned long -conv_to_dest(conv, code) - Conversion conv; - unsigned long code; +conv_to_dest(Conversion conv, unsigned long code) { int i; int conv_num = conv->conv_num; @@ -171,9 +155,7 @@ conv_to_dest(conv, code) } static unsigned long -conv_to_source(conv, code) - Conversion conv; - unsigned long code; +conv_to_source(Conversion conv, unsigned long code) { int i; int conv_num; @@ -213,9 +195,7 @@ conv_to_source(conv, code) } static unsigned long -mb_to_gi(mb, codeset) - unsigned long mb; - CodeSet codeset; +mb_to_gi(unsigned long mb, CodeSet codeset) { int i; unsigned long mb_tmp, mask = 0; @@ -238,9 +218,7 @@ mb_to_gi(mb, codeset) } static unsigned long -gi_to_mb(glyph_index, codeset) - unsigned long glyph_index; - CodeSet codeset; +gi_to_mb(unsigned long glyph_index, CodeSet codeset) { int i; unsigned long mask = 0; @@ -258,11 +236,7 @@ gi_to_mb(glyph_index, codeset) } static Bool -gi_to_wc(lcd, glyph_index, codeset, wc) - XLCd lcd; - unsigned long glyph_index; - CodeSet codeset; - wchar_t *wc; +gi_to_wc(XLCd lcd, unsigned long glyph_index, CodeSet codeset, wchar_t *wc) { unsigned char mask = 0; unsigned long wc_encoding = codeset->wc_encoding; @@ -281,11 +255,7 @@ gi_to_wc(lcd, glyph_index, codeset, wc) } static Bool -wc_to_gi(lcd, wc, glyph_index, codeset) - XLCd lcd; - wchar_t wc; - unsigned long *glyph_index; - CodeSet *codeset; +wc_to_gi(XLCd lcd, wchar_t wc, unsigned long *glyph_index, CodeSet *codeset) { int i; unsigned char mask = 0; @@ -317,9 +287,7 @@ wc_to_gi(lcd, wc, glyph_index, codeset) } static CodeSet -byteM_parse_codeset(lcd, inbufptr) - XLCd lcd; - XPointer inbufptr; +byteM_parse_codeset(XLCd lcd, XPointer inbufptr) { unsigned char ch; CodeSet codeset; @@ -364,9 +332,7 @@ byteM_parse_codeset(lcd, inbufptr) } static CodeSet -GLGR_parse_codeset(lcd, ch) - XLCd lcd; - unsigned char ch; +GLGR_parse_codeset(XLCd lcd, unsigned char ch) { int i; CodeSet initial_state_GL = XLC_GENERIC(lcd, initial_state_GL); @@ -395,9 +361,7 @@ GLGR_parse_codeset(lcd, ch) } static XlcCharSet -gi_parse_charset(glyph_index, codeset) - unsigned long glyph_index; - CodeSet codeset; +gi_parse_charset(unsigned long glyph_index, CodeSet codeset) { int i; size_t table_size = sizeof(default_ct_data) / sizeof(default_ct_data[0]); @@ -418,40 +382,34 @@ gi_parse_charset(glyph_index, codeset) return(NULL); /* Standard Character Set Encoding ? */ - for (i = 0; i < table_size; i++) + for (i = 0; i < table_size; i++){ if (compare(charset->ct_sequence, - default_ct_data[i].encoding, strlen(charset->ct_sequence))) - goto check_extended_seg; - - return(charset); - -check_extended_seg: - if (!ctextseg) - return(charset); + default_ct_data[i].encoding, strlen(charset->ct_sequence))){ + if (!ctextseg) + return(charset); - area = ctextseg->area; - area_num = ctextseg->area_num; + area = ctextseg->area; + area_num = ctextseg->area_num; - for (i = 0; i < area_num; i++) { + for (i = 0; i < area_num; i++) { - if (area[i].start <= glyph_index && glyph_index <= area[i].end) { + if (area[i].start <= glyph_index && glyph_index <= area[i].end) { - charset = ctextseg->charset; + charset = ctextseg->charset; - if (*charset->ct_sequence == '\0') - return(NULL); + if (*charset->ct_sequence == '\0') + return(NULL); - break; + break; + } + } } } - return(charset); } static Bool -ct_parse_csi(inbufptr, ctr_seq_len) - XPointer inbufptr; - int *ctr_seq_len; +ct_parse_csi(XPointer inbufptr, int *ctr_seq_len) { int i; int num = sizeof(directionality_data) / sizeof(directionality_data[0]); @@ -469,10 +427,7 @@ ct_parse_csi(inbufptr, ctr_seq_len) } static int -cmp_esc_sequence(inbufptr, ct_sequence, encoding_name) - XPointer inbufptr; - char *ct_sequence; - char *encoding_name; +cmp_esc_sequence(XPointer inbufptr, char *ct_sequence, char *encoding_name) { size_t table_size = sizeof(default_ct_data) / sizeof(default_ct_data[0]); int i, seq_len, name_len, total_len; @@ -523,11 +478,11 @@ cmp_esc_sequence(inbufptr, ct_sequence, encoding_name) } static Bool -ct_parse_charset(lcd, inbufptr, charset, ctr_seq_len) - XLCd lcd; - XPointer inbufptr; - XlcCharSet *charset; - int *ctr_seq_len; +ct_parse_charset( + XLCd lcd, + XPointer inbufptr, + XlcCharSet *charset, + int *ctr_seq_len) { int i, j; ExtdSegment ctextseg; @@ -584,10 +539,7 @@ ct_parse_charset(lcd, inbufptr, charset, ctr_seq_len) } static Bool -segment_conversion(lcd, charset, glyph_index) - XLCd lcd; - XlcCharSet *charset; - unsigned long *glyph_index; +segment_conversion(XLCd lcd, XlcCharSet *charset, unsigned long *glyph_index) { int i; int segment_conv_num = XLC_GENERIC(lcd, segment_conv_num); @@ -619,9 +571,7 @@ segment_conversion(lcd, charset, glyph_index) } CodeSet -_fallcGetCodeSetFromName(lcd, name) - XLCd lcd; - char *name; +_fallcGetCodeSetFromName(XLCd lcd, char *name) { int i, j; XlcCharSet charset; @@ -652,11 +602,11 @@ _fallcGetCodeSetFromName(lcd, name) } static Bool -_XlcGetCodeSetFromCharSet(lcd, charset, codeset, glyph_index) - XLCd lcd; - XlcCharSet charset; - CodeSet *codeset; - unsigned long *glyph_index; +_XlcGetCodeSetFromCharSet( + XLCd lcd, + XlcCharSet charset, + CodeSet *codeset, + unsigned long *glyph_index) { int i, j, num; CodeSet *codeset_list = XLC_GENERIC(lcd, codeset_list); @@ -726,8 +676,7 @@ end_loop: } static Bool -check_string_encoding(codeset) - CodeSet codeset; +check_string_encoding(CodeSet codeset) { int i; XlcCharSet charset; @@ -749,10 +698,9 @@ check_string_encoding(codeset) /* -------------------------------------------------------------------------- */ static void -init_state(conv) - XlcConv conv; +init_state(XlcConv conv) { - register State state = (State) conv->state; + State state = (State) conv->state; /* for CT */ state->charset = NULL; @@ -765,14 +713,14 @@ init_state(conv) /* -------------------------------------------------------------------------- */ static int -mbstowcs_org(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +mbstowcs_org( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; @@ -820,8 +768,17 @@ mbstowcs_org(conv, from, from_left, to, to_left, args, num_args) } /* same mb char data */ - if (len_left) - goto output_one_wc; + if (len_left){ + mb = (mb << 8) | ch; /* 1 byte left shift */ + len_left--; + + /* last of one mb char data */ + if (!len_left) { + gi_to_wc(lcd, mb_to_gi(mb, codeset), codeset, &wc); + if (outbufptr) {*outbufptr++ = wc;} + (*to_left)--; + } + } /* next mb char data for single shift ? */ if (mb_parse_table) { @@ -838,33 +795,18 @@ mbstowcs_org(conv, from, from_left, to, to_left, args, num_args) } /* next mb char data for byteM ? */ - if (codeset = byteM_parse_codeset(lcd, (inbufptr - 1))) - goto next_mb_char; - - /* next mb char data for GL or GR side ? */ - if (codeset = GLGR_parse_codeset(lcd, ch)) - goto next_mb_char; + if ((codeset = byteM_parse_codeset(lcd, (inbufptr - 1))) || + /* next mb char data for GL or GR side ? */ + (codeset = GLGR_parse_codeset(lcd, ch))){ + length = len_left = codeset->length; + mb = 0; + ss_flag = 0; + } /* can't find codeset for the ch */ unconv_num++; continue; -next_mb_char: - length = len_left = codeset->length; - mb = 0; - ss_flag = 0; - -output_one_wc: - mb = (mb << 8) | ch; /* 1 byte left shift */ - len_left--; - - /* last of one mb char data */ - if (!len_left) { - gi_to_wc(lcd, mb_to_gi(mb, codeset), codeset, &wc); - if (outbufptr) {*outbufptr++ = wc;} - (*to_left)--; - } - } /* end of while */ /* error check on last char */ @@ -882,14 +824,14 @@ output_one_wc: } static int -wcstombs_org(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +wcstombs_org( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; @@ -975,14 +917,14 @@ wcstombs_org(conv, from, from_left, to, to_left, args, num_args) } static int -wcstocts(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +wcstocts( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { size_t table_size = sizeof(default_ct_data) / sizeof(default_ct_data[0]); State state = (State) conv->state; @@ -1124,14 +1066,14 @@ wcstocts(conv, from, from_left, to, to_left, args, num_args) } static int -ctstowcs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +ctstowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; @@ -1181,8 +1123,41 @@ ctstowcs(conv, from, from_left, to, to_left, args, num_args) } /* same glyph_index data */ - if (gi_len_left) - goto output_one_wc; + if (gi_len_left){ + + if (state->charset->side == XlcC1 || state->charset->side == XlcGR) + glyph_index = (glyph_index << 8) | (ch & GL); + else + glyph_index = (glyph_index << 8) | ch; + + gi_len_left--; + + /* last of one glyph_index data */ + if (!gi_len_left) { + + /* segment conversion */ + charset_tmp = state->charset; + if ( !segment_conversion(lcd, &charset_tmp, &glyph_index) ) { + unconv_num += gi_len; + continue; + } + + /* get codeset */ + if ( !_XlcGetCodeSetFromCharSet(lcd, charset_tmp, + &codeset, &glyph_index) ) { + unconv_num += gi_len; + continue; + } + + /* convert glyph index to wicd char */ + gi_to_wc(lcd, glyph_index, codeset, &wc); + if (outbufptr) {*outbufptr++ = wc;} + (*to_left)--; + } + + continue; + + } /* control sequence ? */ if (ch == CSI) { @@ -1243,39 +1218,6 @@ ctstowcs(conv, from, from_left, to, to_left, args, num_args) gi_len = gi_len_left = state->charset->char_size; glyph_index = 0; -output_one_wc: - if (state->charset->side == XlcC1 || state->charset->side == XlcGR) - glyph_index = (glyph_index << 8) | (ch & GL); - else - glyph_index = (glyph_index << 8) | ch; - - gi_len_left--; - - /* last of one glyph_index data */ - if (!gi_len_left) { - - /* segment conversion */ - charset_tmp = state->charset; - if ( !segment_conversion(lcd, &charset_tmp, &glyph_index) ) { - unconv_num += gi_len; - continue; - } - - /* get codeset */ - if ( !_XlcGetCodeSetFromCharSet(lcd, charset_tmp, - &codeset, &glyph_index) ) { - unconv_num += gi_len; - continue; - } - - /* convert glyph index to wicd char */ - gi_to_wc(lcd, glyph_index, codeset, &wc); - if (outbufptr) {*outbufptr++ = wc;} - (*to_left)--; - } - - continue; - skip_the_seg: /* skip until next escape or control sequence */ while ( *from_left ) { @@ -1311,14 +1253,14 @@ skip_the_seg: } static int -mbstocts(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +mbstocts( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { XPointer buf = Xmalloc((*from_left) * sizeof(wchar_t)); XPointer buf_ptr1 = buf; @@ -1329,32 +1271,34 @@ mbstocts(conv, from, from_left, to, to_left, args, num_args) unconv_num = mbstowcs_org(conv, from, from_left, &buf_ptr1, &buf_left1, args, num_args); - if (unconv_num < 0) - goto ret; + if (unconv_num < 0){ + if (buf) + Xfree((char *)buf); + + return unconv_num; + } buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t); unconv_num += wcstocts(conv, &buf_ptr2, &buf_left2, to, to_left, args, num_args); - if (unconv_num < 0) - goto ret; - -ret: - if (buf) - Xfree((char *)buf); + if (unconv_num < 0){ + if (buf) + Xfree((char *)buf); - return unconv_num; + return unconv_num; + } } static int -mbstostr(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +mbstostr( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; @@ -1402,8 +1346,20 @@ mbstostr(conv, from, from_left, to, to_left, args, num_args) } /* same mb char data */ - if (len_left) - goto output_one_mb; + if (len_left){ + mb = (mb << 8) | ch; /* 1 byte left shift */ + len_left--; + + /* last of one mb char data */ + if (!len_left) { + if (check_string_encoding(codeset)) { + if (outbufptr) {*outbufptr++ = mb & 0xff;} + (*to_left)--; + } else { + unconv_num++; + } + } + } /* next mb char data for single shift ? */ if (mb_parse_table) { @@ -1420,36 +1376,18 @@ mbstostr(conv, from, from_left, to, to_left, args, num_args) } /* next char data : byteM ? */ - if (codeset = byteM_parse_codeset(lcd, (inbufptr - 1))) - goto next_mb_char; - + if ((codeset = byteM_parse_codeset(lcd, (inbufptr - 1))) || /* next char data : GL or GR side ? */ - if (codeset = GLGR_parse_codeset(lcd, ch)) - goto next_mb_char; + (codeset = GLGR_parse_codeset(lcd, ch))){ + length = len_left = codeset->length; + mb = 0; + ss_flag = 0; + } /* can't find codeset for the ch */ unconv_num++; continue; -next_mb_char: - length = len_left = codeset->length; - mb = 0; - ss_flag = 0; - -output_one_mb: - mb = (mb << 8) | ch; /* 1 byte left shift */ - len_left--; - - /* last of one mb char data */ - if (!len_left) { - if (check_string_encoding(codeset)) { - if (outbufptr) {*outbufptr++ = mb & 0xff;} - (*to_left)--; - } else { - unconv_num++; - } - } - } /* end of while */ /* error check on last char */ @@ -1467,14 +1405,14 @@ output_one_mb: } static int -mbtocs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +mbtocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; @@ -1536,21 +1474,17 @@ mbtocs(conv, from, from_left, to, to_left, args, num_args) } /* next mb char data for byteM ? */ - if (codeset = byteM_parse_codeset(lcd, (inbufptr - 1))) - goto next_mb_char; - + if ((codeset = byteM_parse_codeset(lcd, (inbufptr - 1))) || /* next mb char data for GL or GR side ? */ - if (codeset = GLGR_parse_codeset(lcd, ch)) - goto next_mb_char; + (codeset = GLGR_parse_codeset(lcd, ch))){ + length = len_left = codeset->length; + mb = 0; + } /* can't find codeset for the ch */ unconv_num = 1; break; -next_mb_char: - length = len_left = codeset->length; - mb = 0; - output: mb = (mb << 8) | ch; /* 1 byte left shift */ len_left--; @@ -1610,14 +1544,14 @@ output: } static int -mbstocs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +mbstocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { int ret; XlcCharSet charset_old, charset = NULL; @@ -1661,14 +1595,14 @@ mbstocs(conv, from, from_left, to, to_left, args, num_args) } static int -wcstostr(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +wcstostr( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; @@ -1759,14 +1693,14 @@ wcstostr(conv, from, from_left, to, to_left, args, num_args) } static int -wctocs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +wctocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; @@ -1859,14 +1793,14 @@ end: } static int -wcstocs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +wcstocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { int ret; XlcCharSet charset_old, charset = NULL; @@ -1910,14 +1844,14 @@ wcstocs(conv, from, from_left, to, to_left, args, num_args) } static int -ctstombs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +ctstombs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { XPointer buf = Xmalloc((*from_left) * sizeof(wchar_t)); XPointer buf_ptr1 = buf; @@ -1928,32 +1862,33 @@ ctstombs(conv, from, from_left, to, to_left, args, num_args) unconv_num = ctstowcs(conv, from, from_left, &buf_ptr1, &buf_left1, args, num_args); - if (unconv_num < 0) - goto ret; + if (unconv_num < 0){ + if (buf) + Xfree((char *)buf); + return unconv_num; + } buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t); unconv_num += wcstombs_org(conv, &buf_ptr2, &buf_left2, to, to_left, args, num_args); - if (unconv_num < 0) - goto ret; + if (unconv_num < 0){ + if (buf) + Xfree((char *)buf); -ret: - if (buf) - Xfree((char *)buf); - - return unconv_num; + return unconv_num; + } } static int -strtombs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +strtombs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; @@ -2034,14 +1969,14 @@ strtombs(conv, from, from_left, to, to_left, args, num_args) } static int -strtowcs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +strtowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; @@ -2105,8 +2040,7 @@ strtowcs(conv, from, from_left, to, to_left, args, num_args) /* -------------------------------------------------------------------------- */ static void -close_converter(conv) - XlcConv conv; +close_converter(XlcConv conv) { if (conv->state) { Xfree((char *) conv->state); @@ -2124,9 +2058,7 @@ close_converter(conv) /* -------------------------------------------------------------------------- */ static XlcConv -create_conv(lcd, methods) - XLCd lcd; - XlcConvMethods methods; +create_conv(XLCd lcd, XlcConvMethods methods) { XlcConv conv; State state; @@ -2136,15 +2068,19 @@ create_conv(lcd, methods) return (XlcConv) NULL; conv->methods = (XlcConvMethods) Xmalloc(sizeof(XlcConvMethodsRec)); - if (conv->methods == NULL) - goto err; + if (conv->methods == NULL){ + close_converter(conv); + return (XlcConv) NULL; + } *conv->methods = *methods; if (XLC_PUBLIC(lcd, is_state_depend)) conv->methods->reset = init_state; conv->state = (XPointer) Xmalloc(sizeof(StateRec)); - if (conv->state == NULL) - goto err; + if (conv->state == NULL){ + close_converter(conv); + return (XlcConv) NULL; + } bzero((char *) conv->state, sizeof(StateRec)); state = (State) conv->state; @@ -2152,11 +2088,6 @@ create_conv(lcd, methods) init_state(conv); return conv; - -err: - close_converter(conv); - - return (XlcConv) NULL; } static XlcConvMethodsRec mbstowcs_methods = { @@ -2166,11 +2097,7 @@ static XlcConvMethodsRec mbstowcs_methods = { } ; static XlcConv -open_mbstowcs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_mbstowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &mbstowcs_methods); } @@ -2182,11 +2109,7 @@ static XlcConvMethodsRec mbstocts_methods = { } ; static XlcConv -open_mbstocts(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_mbstocts(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &mbstocts_methods); } @@ -2198,11 +2121,7 @@ static XlcConvMethodsRec mbstostr_methods = { } ; static XlcConv -open_mbstostr(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_mbstostr(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &mbstostr_methods); } @@ -2214,11 +2133,7 @@ static XlcConvMethodsRec mbstocs_methods = { } ; static XlcConv -open_mbstocs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_mbstocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &mbstocs_methods); } @@ -2230,11 +2145,7 @@ static XlcConvMethodsRec mbtocs_methods = { } ; static XlcConv -open_mbtocs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_mbtocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &mbtocs_methods); } @@ -2246,11 +2157,7 @@ static XlcConvMethodsRec wcstombs_methods = { } ; static XlcConv -open_wcstombs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_wcstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &wcstombs_methods); } @@ -2262,11 +2169,7 @@ static XlcConvMethodsRec wcstocts_methods = { } ; static XlcConv -open_wcstocts(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_wcstocts(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &wcstocts_methods); } @@ -2278,11 +2181,7 @@ static XlcConvMethodsRec wcstostr_methods = { } ; static XlcConv -open_wcstostr(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_wcstostr(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &wcstostr_methods); } @@ -2294,11 +2193,7 @@ static XlcConvMethodsRec wcstocs_methods = { } ; static XlcConv -open_wcstocs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_wcstocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &wcstocs_methods); } @@ -2310,11 +2205,7 @@ static XlcConvMethodsRec wctocs_methods = { } ; static XlcConv -open_wctocs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_wctocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &wctocs_methods); } @@ -2326,11 +2217,7 @@ static XlcConvMethodsRec ctstombs_methods = { } ; static XlcConv -open_ctstombs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_ctstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &ctstombs_methods); } @@ -2342,11 +2229,7 @@ static XlcConvMethodsRec ctstowcs_methods = { } ; static XlcConv -open_ctstowcs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_ctstowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &ctstowcs_methods); } @@ -2358,11 +2241,7 @@ static XlcConvMethodsRec strtombs_methods = { } ; static XlcConv -open_strtombs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_strtombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &strtombs_methods); } @@ -2374,11 +2253,7 @@ static XlcConvMethodsRec strtowcs_methods = { } ; static XlcConv -open_strtowcs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_strtowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &strtowcs_methods); } @@ -2388,8 +2263,7 @@ open_strtowcs(from_lcd, from_type, to_lcd, to_type) /* -------------------------------------------------------------------------- */ XLCd -_fallcGenericLoader(name) - char *name; +_fallcGenericLoader(char *name) { XLCd lcd; diff --git a/cde/programs/dtudcfonted/libfal/_fallcGeneric.c b/cde/programs/dtudcfonted/libfal/_fallcGeneric.c index 0a792a31..606eaab9 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcGeneric.c +++ b/cde/programs/dtudcfonted/libfal/_fallcGeneric.c @@ -60,9 +60,9 @@ #include "_fallibint.h" #include "_fallcGeneric.h" -static XLCd create(); -static Bool initialize(); -static void destroy(); +static XLCd create(char *name, XLCdMethods methods); +static Bool initialize(XLCd lcd); +static void destroy(XLCd lcd); static XLCdPublicMethodsRec genericMethods = { { NULL }, /* use default methods */ @@ -78,9 +78,7 @@ static XLCdPublicMethodsRec genericMethods = { XLCdMethods _fallcGenericMethods = (XLCdMethods) &genericMethods; static XLCd -create(name, methods) - char *name; - XLCdMethods methods; +create(char *name, XLCdMethods methods) { XLCd lcd; XLCdPublicMethods new; @@ -91,27 +89,25 @@ create(name, methods) bzero((char *) lcd, sizeof(XLCdRec)); lcd->core = (XLCdCore) Xmalloc(sizeof(XLCdGenericRec)); - if (lcd->core == NULL) - goto err; + if (lcd->core == NULL){ + Xfree(lcd); + return (XLCd) NULL; + } bzero((char *) lcd->core, sizeof(XLCdGenericRec)); new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec)); - if (new == NULL) - goto err; + if (new == NULL){ + Xfree(lcd); + return (XLCd) NULL; + } *new = *((XLCdPublicMethods) methods); lcd->methods = (XLCdMethods) new; return lcd; - -err: - Xfree(lcd); - return (XLCd) NULL; } static Bool -string_to_encoding(str, encoding) - char *str; - char *encoding; +string_to_encoding(char *str, char *encoding) { char *next; long value; @@ -144,9 +140,7 @@ string_to_encoding(str, encoding) } static Bool -string_to_ulong(str, value) -char *str; -unsigned long *value; +string_to_ulong(char *str, unsigned long *value) { char *tmp1 = str; int base; @@ -175,9 +169,7 @@ unsigned long *value; static Bool -add_charset(codeset, charset) - CodeSet codeset; - XlcCharSet charset; +add_charset(CodeSet codeset, XlcCharSet charset) { XlcCharSet *new_list; int num; @@ -199,8 +191,7 @@ add_charset(codeset, charset) } static CodeSet -add_codeset(gen) - XLCdGenericPart *gen; +add_codeset(XLCdGenericPart *gen) { CodeSet new, *new_list; int num; @@ -216,27 +207,24 @@ add_codeset(gen) else new_list = (CodeSet *) Xmalloc(sizeof(CodeSet)); - if (new_list == NULL) - goto err; + if (new_list == NULL){ + Xfree(new); + return NULL; + } new_list[num] = new; gen->codeset_list = new_list; gen->codeset_num = num + 1; return new; - -err: - Xfree(new); - - return NULL; } static Bool -add_parse_list(gen, type, encoding, codeset) - XLCdGenericPart *gen; - EncodingType type; - char *encoding; - CodeSet codeset; +add_parse_list( + XLCdGenericPart *gen, + EncodingType type, + char *encoding, + CodeSet codeset) { ParseInfo new, *new_list; char *str; @@ -249,14 +237,24 @@ add_parse_list(gen, type, encoding, codeset) strcpy(str, encoding); new = (ParseInfo) Xmalloc(sizeof(ParseInfoRec)); - if (new == NULL) - goto err; + if (new == NULL){ + Xfree(str); + if (new) + Xfree(new); + + return False; + } bzero((char *) new, sizeof(ParseInfoRec)); if (gen->mb_parse_table == NULL) { gen->mb_parse_table = (unsigned char *) Xmalloc(256); /* 2^8 */ - if (gen->mb_parse_table == NULL) - goto err; + if (gen->mb_parse_table == NULL){ + Xfree(str); + if (new) + Xfree(new); + + return False; + } 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)); } - if (new_list == NULL) - goto err; + if (new_list == NULL){ + Xfree(str); + if (new) + Xfree(new); + + return False; + } new_list[num] = new; new_list[num + 1] = NULL; @@ -287,18 +290,10 @@ add_parse_list(gen, type, encoding, codeset) codeset->parse_info = new; return True; - -err: - Xfree(str); - if (new) - Xfree(new); - - return False; } static void -free_charset(lcd) - XLCd lcd; +free_charset(XLCd lcd) { XLCdGenericPart *gen = XLC_GENERIC_PART(lcd); CodeSet *codeset; @@ -324,9 +319,7 @@ free_charset(lcd) #define FORWARD (unsigned long)'+' #define BACKWARD (unsigned long)'-' -static char *getscope(str,scp) -char *str; -FontScope scp; +static char *getscope(char *str, FontScope scp) { char buff[256],*next; unsigned long start=0,end=0,dest=0,shift=0,direction=0; @@ -355,8 +348,7 @@ FontScope scp; next = str+1 ; return(next); } -static int count_scopemap(str) -char *str; +static int count_scopemap(char *str) { char *ptr; int num=0; @@ -367,9 +359,7 @@ char *str; } return(num); } -FontScope falparse_scopemaps(str,size) -char *str; -int *size; +FontScope falparse_scopemaps(char *str, int *size) { int num=0,i; FontScope scope,sc_ptr; @@ -388,25 +378,20 @@ int *size; } void -dbg_printValue(str,value,num) -char *str; -char **value; -int num; +dbg_printValue(char *str, char **value, int num) { -/* +#ifdef DEBUG int i; for(i=0;i 0) { - if (string_to_ulong(value[0], &l) == False) - goto err; + if (string_to_ulong(value[0], &l) == False){ + free_charset(lcd); + return False; + } gen->wc_encode_mask = l; } /***** wc_shift_bits *****/ @@ -805,8 +782,10 @@ load_generic(lcd) if (num > 0) { char *tmp; - if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) - goto err; + if (codeset == NULL && (codeset = add_codeset(gen)) == NULL){ + free_charset(lcd); + return False; + } /* 3.4.1 side */ if( !_fallcNCompareISOLatin1(value[0], "none", 4) ){ @@ -831,8 +810,10 @@ load_generic(lcd) sprintf(name, "%s.%s", cs , "length"); _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); if (num > 0) { - if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) - goto err; + if (codeset == NULL && (codeset = add_codeset(gen)) == NULL){ + free_charset(lcd); + return False; + } codeset->length = atoi(value[0]); if (codeset->length < 1) codeset->length = 1; @@ -853,8 +834,10 @@ load_generic(lcd) }; int j; - if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) - goto err; + if (codeset == NULL && (codeset = add_codeset(gen)) == NULL){ + free_charset(lcd); + return False; + } for ( ; num-- > 0; value++) { char encoding[256]; char *tmp = *value; @@ -867,8 +850,10 @@ load_generic(lcd) break; } } - if (string_to_encoding(tmp, encoding) == False) - goto err; + if (string_to_encoding(tmp, encoding) == False){ + free_charset(lcd); + return False; + } add_parse_list(gen, type, encoding, codeset); } } @@ -877,10 +862,11 @@ load_generic(lcd) sprintf(name, "%s.%s", cs, "wc_encoding"); _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); if (num > 0) { - if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) - goto err; - if (string_to_ulong(value[0], &l) == False) - goto err; + if ((codeset == NULL && (codeset = add_codeset(gen)) == NULL) || \ + (string_to_ulong(value[0], &l) == False)){ + free_charset(lcd); + return False; + } codeset->wc_encoding = l; } @@ -891,8 +877,10 @@ load_generic(lcd) XlcCharSet charset; char *encoding; - if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) - goto err; + if (codeset == NULL && (codeset = add_codeset(gen)) == NULL){ + free_charset(lcd); + return False; + } for ( ; num-- > 0; value++) { string_to_encoding(*value, name); charset = NULL; @@ -911,8 +899,10 @@ load_generic(lcd) } } if (charset) { - if (add_charset(codeset, charset) == False) - goto err; + if (add_charset(codeset, charset) == False){ + free_charset(lcd); + return False; + } } } } @@ -938,7 +928,8 @@ load_generic(lcd) (ByteInfoListRec *)Xmalloc( (codeset->length)*sizeof(ByteInfoListRec)); 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 */ return True; - -err: - free_charset(lcd); - - return False; } static Bool -initialize(lcd) - XLCd lcd; +initialize(XLCd lcd) { XLCdPublicMethods superclass = (XLCdPublicMethods) _fallcPublicMethods; @@ -1035,8 +1020,7 @@ initialize(lcd) } /* VW/UDC start 95.01.08 */ static void -freeByteM(codeset) - CodeSet codeset; +freeByteM(CodeSet codeset) { int i; ByteInfoList blst; @@ -1054,8 +1038,7 @@ freeByteM(codeset) codeset->byteM = NULL; } static void -freeConversion(codeset) - CodeSet codeset; +freeConversion(CodeSet codeset) { int i; Conversion mbconv,ctconv; @@ -1081,8 +1064,7 @@ freeConversion(codeset) } } static void -freeExtdSegment(codeset) - CodeSet codeset; +freeExtdSegment(CodeSet codeset) { int i; ExtdSegment ctextseg; @@ -1102,8 +1084,7 @@ freeExtdSegment(codeset) codeset->ctextseg = NULL; } static void -freeParseInfo(codeset) - CodeSet codeset; +freeParseInfo(CodeSet codeset) { int i; ParseInfo parse_info; @@ -1119,8 +1100,7 @@ freeParseInfo(codeset) codeset->parse_info = NULL; } static void -destroy_CodeSetList(gen) - XLCdGenericPart *gen ; +destroy_CodeSetList(XLCdGenericPart *gen) { CodeSet *codeset = gen->codeset_list; int i; @@ -1140,10 +1120,9 @@ destroy_CodeSetList(gen) } Xfree(codeset); gen->codeset_list = NULL; } -/* */ + static void -destroy_SegConv(gen) - XLCdGenericPart *gen ; +destroy_SegConv(XLCdGenericPart *gen) { SegConv seg = gen->segment_conv; int i; @@ -1167,8 +1146,7 @@ destroy_SegConv(gen) } static void -destroy_gen(lcd) - XLCd lcd; +destroy_gen(XLCd lcd) { XLCdGenericPart *gen = XLC_GENERIC_PART(lcd); destroy_SegConv(gen); @@ -1184,8 +1162,7 @@ destroy_gen(lcd) } /* VW/UDC end 95.01.08 */ static void -destroy(lcd) - XLCd lcd; +destroy(XLCd lcd) { XLCdPublicMethods superclass = XLC_PUBLIC_METHODS(lcd)->superclass; diff --git a/cde/programs/dtudcfonted/libfal/_fallcGeneric.h b/cde/programs/dtudcfonted/libfal/_fallcGeneric.h index bacb3454..b9eb08f9 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcGeneric.h +++ b/cde/programs/dtudcfonted/libfal/_fallcGeneric.h @@ -153,10 +153,8 @@ typedef struct _XLCdGenericPart { CodeSet initial_state_GR; int segment_conv_num; /* UDC */ SegConv segment_conv; /* UDC */ -#ifndef X_NOT_STDC_ENV Bool use_stdc_env; Bool force_convert_to_mb; -#endif } XLCdGenericPart; typedef struct _XLCdGenericRec { diff --git a/cde/programs/dtudcfonted/libfal/_fallcInit.c b/cde/programs/dtudcfonted/libfal/_fallcInit.c index 661ea690..3f1db9bd 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcInit.c +++ b/cde/programs/dtudcfonted/libfal/_fallcInit.c @@ -67,74 +67,50 @@ /*** #define USE_UTF_LOADER ***/ extern XLCd _fallcDefaultLoader( -#if NeedFunctionPrototypes char* -#endif ); #ifdef DYNAMIC_LOAD #ifdef sun extern XLCd _falsunOsDynamicLoad( -#if NeedFunctionPrototypes char* -#endif ); #endif /* sun */ - -#ifdef AIXV3 -extern XLCd _falaixOsDynamicLoad( -#if NeedFunctionPrototypes - char* -#endif -); -#endif /* AIXV3 */ -#endif +#endif /* DYNAMIC_LOAD */ #ifdef USE_GENERIC_LOADER extern XLCd _fallcGenericLoader( -#if NeedFunctionPrototypes char* -#endif ); #endif #ifdef USE_UTF_LOADER extern XLCd _fallcUtfLoader( -#if NeedFunctionPrototypes char* -#endif ); #endif #ifdef USE_EUC_LOADER extern XLCd _fallcEucLoader( -#if NeedFunctionPrototypes char* -#endif ); #endif #ifdef USE_SJIS_LOADER extern XLCd _fallcSjisLoader( -#if NeedFunctionPrototypes char* -#endif ); #endif #ifdef USE_JIS_LOADER extern XLCd _XlcJisLoader( -#if NeedFunctionPrototypes char* -#endif ); #endif #ifdef USE_DYNAMIC_LOADER extern XLCd _fallcDynamicLoader( -#if NeedFunctionPrototypes char* -#endif ); #endif @@ -144,7 +120,7 @@ extern XLCd _fallcDynamicLoader( */ void -_fallcInitLoader() +_fallcInitLoader(void) { #ifdef USE_GENERIC_LOADER _fallcAddLoader(_fallcGenericLoader, XlcHead); @@ -174,10 +150,6 @@ _fallcInitLoader() #ifdef sun _fallcAddLoader(_falsunOsDynamicLoad, XlcHead); #endif /* sun */ - -#ifdef AIXV3 - _fallcAddLoader(_falaixOsDynamicLoad, XlcHead); -#endif /* AIXV3 */ #endif /* DYNAMIC_LOAD */ #ifdef USE_DYNAMIC_LOADER diff --git a/cde/programs/dtudcfonted/libfal/_fallcPrTxt.c b/cde/programs/dtudcfonted/libfal/_fallcPrTxt.c index cd647983..a8b87160 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcPrTxt.c +++ b/cde/programs/dtudcfonted/libfal/_fallcPrTxt.c @@ -53,10 +53,7 @@ #include static XPointer * -alloc_list(is_wide_char, count, nitems) - Bool is_wide_char; - int count; - int nitems; +alloc_list(Bool is_wide_char, int count, int nitems) { if (is_wide_char) { wchar_t **wstr_list; @@ -90,11 +87,7 @@ alloc_list(is_wide_char, count, nitems) } static void -copy_list(is_wide_char, text, list, count) - Bool is_wide_char; - XPointer text; - XPointer *list; - int count; +copy_list(Bool is_wide_char, XPointer text, XPointer *list, int count) { int length; @@ -128,13 +121,13 @@ copy_list(is_wide_char, text, list, count) } static int -_XTextPropertyToTextList(lcd, dpy, text_prop, to_type, list_ret, count_ret) - XLCd lcd; - Display *dpy; - XTextProperty *text_prop; - char *to_type; - XPointer **list_ret; - int *count_ret; +_XTextPropertyToTextList( + XLCd lcd, + Display *dpy, + XTextProperty *text_prop, + char *to_type, + XPointer **list_ret, + int *count_ret) { XlcConv conv; char *from_type; @@ -231,33 +224,31 @@ _XTextPropertyToTextList(lcd, dpy, text_prop, to_type, list_ret, count_ret) } int -_falmbTextPropertyToTextList(lcd, dpy, text_prop, list_ret, count_ret) - XLCd lcd; - Display *dpy; - XTextProperty *text_prop; - char ***list_ret; - int *count_ret; +_falmbTextPropertyToTextList( + XLCd lcd, + Display *dpy, + XTextProperty *text_prop, + char ***list_ret, + int *count_ret) { return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNMultiByte, (XPointer **) list_ret, count_ret); } int -_falwcTextPropertyToTextList(lcd, dpy, text_prop, list_ret, count_ret) - XLCd lcd; - Display *dpy; - XTextProperty *text_prop; - wchar_t ***list_ret; - int *count_ret; +_falwcTextPropertyToTextList( + XLCd lcd, + Display *dpy, + XTextProperty *text_prop, + wchar_t ***list_ret, + int *count_ret) { return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNWideChar, (XPointer **) list_ret, count_ret); } void -_falwcFreeStringList(lcd, list) - XLCd lcd; - wchar_t **list; +_falwcFreeStringList(XLCd lcd, wchar_t **list) { if (list) { if (*list) diff --git a/cde/programs/dtudcfonted/libfal/_fallcPubI.h b/cde/programs/dtudcfonted/libfal/_fallcPubI.h index 5d1cac8f..e86b50f8 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcPubI.h +++ b/cde/programs/dtudcfonted/libfal/_fallcPubI.h @@ -63,40 +63,30 @@ typedef struct _XLCdPublicMethodsRec *XLCdPublicMethods; typedef XLCd (*XlcPubCreateProc)( -#if NeedFunctionPrototypes char* /* name */, XLCdMethods /* methods */ -#endif ); typedef Bool (*XlcPubInitializeProc)( -#if NeedFunctionPrototypes XLCd /* lcd */ -#endif ); typedef void (*XlcPubDestroyProc)( -#if NeedFunctionPrototypes XLCd /* lcd */ -#endif ); typedef char* (*XlcPubGetValuesProc)( -#if NeedFunctionPrototypes XLCd /* lcd */, XlcArgList /* args */, int /* num_args */ -#endif ); typedef void (*XlcPubGetResourceProc)( -#if NeedFunctionPrototypes XLCd /* lcd */, char* /* category */, char* /* class */, char*** /* value */, int* /* count */ -#endif ); typedef struct _XLCdPublicMethodsPart { @@ -139,137 +129,103 @@ extern XLCdMethods _fallcPublicMethods; _XFUNCPROTOBEGIN extern XLCd _fallcCreateLC( -#if NeedFunctionPrototypes char* /* name */, XLCdMethods /* methods */ -#endif ); extern void _fallcDestroyLC( -#if NeedFunctionPrototypes XLCd /* lcd */ -#endif ); extern Bool _fallcParseCharSet( -#if NeedFunctionPrototypes XlcCharSet /* charset */ -#endif ); extern XlcCharSet _fallcCreateDefaultCharSet( -#if NeedFunctionPrototypes char* /* name */, char* /* control_sequence */ -#endif ); extern XlcCharSet _fallcAddCT( -#if NeedFunctionPrototypes char* /* name */, char* /* control_sequence */ -#endif ); extern XrmMethods _falrmDefaultInitParseInfo( -#if NeedFunctionPrototypes XLCd /* lcd */, XPointer* /* state */ -#endif ); extern int _falmbTextPropertyToTextList( -#if NeedFunctionPrototypes XLCd /* lcd */, Display* /* dpy */, XTextProperty* /* text_prop */, char*** /* list_ret */, int* /* count_ret */ -#endif ); extern int _falwcTextPropertyToTextList( -#if NeedFunctionPrototypes XLCd /* lcd */, Display* /* dpy */, XTextProperty* /* text_prop */, wchar_t*** /* list_ret */, int* /* count_ret */ -#endif ); extern int _falmbTextListToTextProperty( -#if NeedFunctionPrototypes XLCd /* lcd */, Display* /* dpy */, char** /* list */, int /* count */, XICCEncodingStyle /* style */, XTextProperty* /* text_prop */ -#endif ); extern int _falwcTextListToTextProperty( -#if NeedFunctionPrototypes XLCd /* lcd */, Display* /* dpy */, wchar_t** /* list */, int /* count */, XICCEncodingStyle /* style */, XTextProperty* /* text_prop */ -#endif ); extern void _falwcFreeStringList( -#if NeedFunctionPrototypes XLCd /* lcd */, wchar_t** /* list */ -#endif ); extern int _fallcResolveLocaleName( -#if NeedFunctionPrototypes char* /* lc_name */, char* /* full_name */, char* /* language */, char* /* territory */, char* /* codeset */ -#endif ); extern int _fallcResolveDBName( -#if NeedFunctionPrototypes char* /* lc_name */, char* /* file_name */ -#endif ); extern int _fallcResolveI18NPath( -#if NeedFunctionPrototypes char* /* path_name */ -#endif ); extern XPointer _fallcCreateLocaleDataBase( -#if NeedFunctionPrototypes XLCd /* lcd */ -#endif ); extern void _fallcDestroyLocaleDataBase( -#if NeedFunctionPrototypes XLCd /* lcd */ -#endif ); extern void _fallcGetLocaleDataBase( -#if NeedFunctionPrototypes XLCd /* lcd */, char* /* category */, char* /* name */, char*** /* value */, int* /* count */ -#endif ); _XFUNCPROTOEND diff --git a/cde/programs/dtudcfonted/libfal/_fallcPubWrap.c b/cde/programs/dtudcfonted/libfal/_fallcPubWrap.c index e69c4da1..532c8395 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcPubWrap.c +++ b/cde/programs/dtudcfonted/libfal/_fallcPubWrap.c @@ -50,15 +50,8 @@ #include "_fallibint.h" #include "_fallcPubI.h" -#if NeedVarargsPrototypes char * _falGetLCValues(XLCd lcd, ...) -#else -char * -_falGetLCValues(lcd, va_alist) - XLCd lcd; - va_dcl -#endif { va_list var; XlcArgList args; @@ -85,8 +78,7 @@ _falGetLCValues(lcd, va_alist) } void -_fallcDestroyLC(lcd) - XLCd lcd; +_fallcDestroyLC(XLCd lcd) { XLCdPublicMethods methods = (XLCdPublicMethods) lcd->methods; @@ -94,9 +86,7 @@ _fallcDestroyLC(lcd) } XLCd -_fallcCreateLC(name, methods) - char *name; - XLCdMethods methods; +_fallcCreateLC(char *name, XLCdMethods methods) { XLCdPublicMethods pub_methods = (XLCdPublicMethods) methods; XLCd lcd; @@ -107,21 +97,21 @@ _fallcCreateLC(name, methods) if (lcd->core->name == NULL) { lcd->core->name = (char*) Xmalloc(strlen(name) + 1); - if (lcd->core->name == NULL) - goto err; + if (lcd->core->name == NULL) { + _fallcDestroyLC(lcd); + return (XLCd) NULL; + } + strcpy(lcd->core->name, name); } if (lcd->methods == NULL) lcd->methods = methods; - if ((*pub_methods->pub.initialize)(lcd) == False) - goto err; + if ((*pub_methods->pub.initialize)(lcd) == False) { + _fallcDestroyLC(lcd); + return (XLCd) NULL; + } return lcd; - -err: - _fallcDestroyLC(lcd); - - return (XLCd) NULL; } diff --git a/cde/programs/dtudcfonted/libfal/_fallcPublic.c b/cde/programs/dtudcfonted/libfal/_fallcPublic.c index 12447f88..af397293 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcPublic.c +++ b/cde/programs/dtudcfonted/libfal/_fallcPublic.c @@ -87,16 +87,13 @@ static XLCdPublicMethodsRec publicMethods = { XLCdMethods _fallcPublicMethods = (XLCdMethods) &publicMethods; static char * -default_string(lcd) - XLCd lcd; +default_string(XLCd lcd) { return XLC_PUBLIC(lcd, default_string); } static XLCd -create(name, methods) - char *name; - XLCdMethods methods; +create(char *name, XLCdMethods methods) { XLCd lcd; XLCdPublicMethods new; @@ -107,26 +104,25 @@ create(name, methods) bzero((char *) lcd, sizeof(XLCdRec)); lcd->core = (XLCdCore) Xmalloc(sizeof(XLCdPublicRec)); - if (lcd->core == NULL) - goto err; + if (lcd->core == NULL){ + Xfree(lcd); + return (XLCd) NULL; + } bzero((char *) lcd->core, sizeof(XLCdPublicRec)); new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec)); - if (new == NULL) - goto err; + if (new == NULL){ + Xfree(lcd); + return (XLCd) NULL; + } *new = *((XLCdPublicMethods) methods); lcd->methods = (XLCdMethods) new; return lcd; - -err: - Xfree(lcd); - return (XLCd) NULL; } static Bool -load_public(lcd) - XLCd lcd; +load_public(XLCd lcd) { XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd); char **values, *str; @@ -160,8 +156,7 @@ load_public(lcd) } static Bool -initialize_core(lcd) - XLCd lcd; +initialize_core(XLCd lcd) { XLCdMethods methods = lcd->methods; XLCdMethods core = &publicMethods.core; @@ -202,8 +197,7 @@ initialize_core(lcd) extern Bool _fallcInitCTInfo(); static Bool -initialize(lcd) - XLCd lcd; +initialize(XLCd lcd) { XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd); XLCdPublicMethodsPart *pub_methods = &publicMethods.pub; @@ -261,8 +255,7 @@ initialize(lcd) } static void -destroy_core(lcd) - XLCd lcd; +destroy_core(XLCd lcd) { if (lcd->core) { if (lcd->core->name) @@ -277,8 +270,7 @@ destroy_core(lcd) } static void -destroy(lcd) - XLCd lcd; +destroy(XLCd lcd) { XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd); @@ -310,10 +302,7 @@ static XlcResource resources[] = { }; static char * -get_values(lcd, args, num_args) - register XLCd lcd; - register XlcArgList args; - register int num_args; +get_values(XLCd lcd, XlcArgList args, int num_args) { XLCdPublic pub = (XLCdPublic) lcd->core; diff --git a/cde/programs/dtudcfonted/libfal/_fallcPublic.h b/cde/programs/dtudcfonted/libfal/_fallcPublic.h index 07af5cc6..9bb73fec 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcPublic.h +++ b/cde/programs/dtudcfonted/libfal/_fallcPublic.h @@ -92,11 +92,9 @@ typedef struct _UDCArea { typedef struct _XlcCharSetRec *XlcCharSet; typedef char* (*XlcGetCSValuesProc)( -#if NeedFunctionPrototypes XlcCharSet /* charset */, XlcArgList /* args */, int /* num_args */ -#endif ); typedef struct _XlcCharSetRec { @@ -122,22 +120,17 @@ typedef struct _XlcCharSetRec { typedef struct _XlcConvRec *XlcConv; typedef XlcConv (*XlcOpenConverterProc)( -#if NeedFunctionPrototypes XLCd /* from_lcd */, char* /* from_type */, XLCd /* to_lcd */, char* /* to_type */ -#endif ); typedef void (*XlcCloseConverterProc)( -#if NeedFunctionPrototypes XlcConv /* conv */ -#endif ); typedef int (*XlcConvertProc)( -#if NeedFunctionPrototypes XlcConv /* conv */, XPointer* /* from */, int* /* from_left */, @@ -145,13 +138,10 @@ typedef int (*XlcConvertProc)( int* /* to_left */, XPointer* /* args */, int /* num_args */ -#endif ); typedef void (*XlcResetConverterProc)( -#if NeedFunctionPrototypes XlcConv /* conv */ -#endif ); typedef struct _XlcConvMethodsRec{ @@ -181,60 +171,43 @@ typedef struct _XlcConvRec { _XFUNCPROTOBEGIN extern Bool _falInitOM( -#if NeedFunctionPrototypes XLCd /* lcd */ -#endif ); extern Bool _XInitIM( -#if NeedFunctionPrototypes XLCd /* lcd */ -#endif ); extern char *_falGetLCValues( -#if NeedVarargsPrototypes XLCd /* lcd */, ... -#endif ); extern XlcCharSet _fallcGetCharSet( -#if NeedFunctionPrototypes char* /* name */ -#endif ); extern Bool _fallcAddCharSet( -#if NeedFunctionPrototypes XlcCharSet /* charset */ -#endif ); extern char *_fallcGetCSValues( -#if NeedVarargsPrototypes XlcCharSet /* charset */, ... -#endif ); extern XlcConv _fallcOpenConverter( -#if NeedFunctionPrototypes XLCd /* from_lcd */, char* /* from_type */, XLCd /* to_lcd */, char* /* to_type */ -#endif ); extern void _fallcCloseConverter( -#if NeedFunctionPrototypes XlcConv /* conv */ -#endif ); extern int _fallcConvert( -#if NeedFunctionPrototypes XlcConv /* conv */, XPointer* /* from */, int* /* from_left */, @@ -242,68 +215,51 @@ extern int _fallcConvert( int* /* to_left */, XPointer* /* args */, int /* num_args */ -#endif ); extern void _fallcResetConverter( -#if NeedFunctionPrototypes XlcConv /* conv */ -#endif ); extern Bool _fallcSetConverter( -#if NeedFunctionPrototypes XLCd /* from_lcd */, char* /* from_type */, XLCd /* to_lcd */, char* /* to_type */, XlcOpenConverterProc /* open_converter */ -#endif ); extern void _fallcGetResource( -#if NeedFunctionPrototypes XLCd /* lcd */, char* /* category */, char* /* class */, char*** /* value */, int* /* count */ -#endif ); extern char *_fallcFileName( -#if NeedFunctionPrototypes XLCd /* lcd */, char* /* category */ -#endif ); extern int _falwcslen( -#if NeedFunctionPrototypes wchar_t* /* wstr */ -#endif ); extern wchar_t *_falwcscpy( -#if NeedFunctionPrototypes wchar_t* /* wstr1 */, wchar_t* /* wstr2 */ -#endif ); extern int _fallcCompareISOLatin1( -#if NeedFunctionPrototypes char* /* str1 */, char* /* str2 */ -#endif ); extern int _fallcNCompareISOLatin1( -#if NeedFunctionPrototypes char* /* str1 */, char* /* str2 */, int /* len */ -#endif ); _XFUNCPROTOEND diff --git a/cde/programs/dtudcfonted/libfal/_fallcRM.c b/cde/programs/dtudcfonted/libfal/_fallcRM.c index f5cffd2f..478a2835 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcRM.c +++ b/cde/programs/dtudcfonted/libfal/_fallcRM.c @@ -57,17 +57,13 @@ typedef struct _StateRec { } StateRec, *State; static void -mbinit(state) - XPointer state; +mbinit(XPointer state) { _fallcResetConverter(((State) state)->conv); } static char -mbchar(state, str, lenp) - XPointer state; - char *str; - int *lenp; +mbchar(XPointer state, char *str, char *lenp) { XlcConv conv = ((State) state)->conv; XlcCharSet charset; @@ -91,21 +87,18 @@ mbchar(state, str, lenp) } static void -mbfinish(state) - XPointer state; +mbfinish(XPointer state) { } static char * -lcname(state) - XPointer state; +lcname(XPointer state) { return ((State) state)->lcd->core->name; } static void -destroy(state) - XPointer state; +destroy(XPointer state) { _fallcCloseConverter(((State) state)->conv); _falCloseLC(((State) state)->lcd); @@ -121,9 +114,7 @@ static XrmMethodsRec rm_methods = { } ; XrmMethods -_falrmDefaultInitParseInfo(lcd, rm_state) - XLCd lcd; - XPointer *rm_state; +_falrmDefaultInitParseInfo(XLCd lcd, XPointer *rm_state) { State state; diff --git a/cde/programs/dtudcfonted/libfal/_fallcSjis.c b/cde/programs/dtudcfonted/libfal/_fallcSjis.c index 18ac8799..e4b02200 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcSjis.c +++ b/cde/programs/dtudcfonted/libfal/_fallcSjis.c @@ -135,22 +135,22 @@ static CodeSet wc_codeset(); static int -sjis_mbstowcs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +sjis_mbstowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { XLCd lcd = (XLCd)conv->state; - register int chr_len = 0; - register int outbuf = 0; - register int shift_mult = 0; - register Uint chrcode = 0; + int chr_len = 0; + int outbuf = 0; + int shift_mult = 0; + Uint chrcode = 0; Uchar ch, ch2; Uint wc_encode = 0; @@ -276,20 +276,20 @@ sjis_mbstowcs(conv, from, from_left, to, to_left, args, num_args) #define byte2 (byte1 == 0) static int -sjis_wcstombs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +sjis_wcstombs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { - register wchar_t *inbufptr = (wchar_t *) *from; - register XPointer outbufptr = *to; + wchar_t *inbufptr = (wchar_t *) *from; + XPointer outbufptr = *to; XPointer outbuf_base = outbufptr; wchar_t wch; - register length; + int length; Uchar tmp; Uchar t1, t2; 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) */ static void -sjis_to_jis(p1, p2) - Uchar *p1; - Uchar *p2; +sjis_to_jis(Uchar *p1, Uchar *p2) { - register Uchar c1 = *p1; - register Uchar c2 = *p2; - register Uchar adjust = c2 < 0x9f; - register Uchar rowOffset = c1 < 0xa0 ? 0x70 : 0xb0; - register Uchar cellOffset = adjust ? (0x1f + (c2 > 0x7f)) : 0x7e; + Uchar c1 = *p1; + Uchar c2 = *p2; + Uchar adjust = c2 < 0x9f; + Uchar rowOffset = c1 < 0xa0 ? 0x70 : 0xb0; + Uchar cellOffset = adjust ? (0x1f + (c2 > 0x7f)) : 0x7e; *p1 = ((c1 - rowOffset) << 1) - adjust; *p2 -= cellOffset; } static void -jis_to_sjis(p1, p2) - Uchar *p1; - Uchar *p2; +jis_to_sjis(Uchar *p1, Uchar *p2) { - register Uchar c1 = *p1; - register Uchar c2 = *p2; - register Uchar rowOffset = c1 < 0x5f ? 0x70 : 0xb0; - register Uchar cellOffset = c1 % 2 ? 0x1f + (c2 > 0x5f) : 0x7e; + Uchar c1 = *p1; + Uchar c2 = *p2; + Uchar rowOffset = c1 < 0x5f ? 0x70 : 0xb0; + Uchar cellOffset = c1 % 2 ? 0x1f + (c2 > 0x5f) : 0x7e; *p1 = ((Uchar)(c1 + 1) >> 1) + rowOffset; *p2 = c2 + cellOffset; } static CodeSet -wc_codeset(lcd, wch) - XLCd lcd; - wchar_t wch; +wc_codeset(XLCd lcd, wchar_t wch) { - register CodeSet *codesets = XLC_GENERIC(lcd, codeset_list); -#if !defined(__sony_news) || defined(SVR4) - register int end = XLC_GENERIC(lcd, codeset_num); - register Ulong widech = (Ulong)(wch & XLC_GENERIC(lcd, wc_encode_mask)); + CodeSet *codesets = XLC_GENERIC(lcd, codeset_list); + int end = XLC_GENERIC(lcd, codeset_num); + Ulong widech = (Ulong)(wch & XLC_GENERIC(lcd, wc_encode_mask)); for (; --end >= 0; codesets++) if ( widech == (*codesets)->wc_encoding ) return *codesets; return NULL; -#else - if( iskanji(wch >> 8) ) - return( codesets[1] ); - if( iskana(wch & 0xff) ) - return( codesets[2] ); - return( codesets[0] ); -#endif } static int -sjis_mbtocs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +sjis_mbtocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { XLCd lcd = (XLCd)conv->state; XlcCharSet charset = NULL; int char_size = 0; int unconv_num = 0; - register char *src = *from, *dst = *to; + char *src = *from, *dst = *to; CodeSet *codesets = XLC_GENERIC(lcd, codeset_list); 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 -sjis_mbstocs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +sjis_mbstocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { XLCd lcd = (XLCd) conv->state; char *tmp_from, *tmp_to; @@ -556,21 +542,21 @@ sjis_mbstocs(conv, from, from_left, to, to_left, args, num_args) } static int -sjis_wcstocs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +sjis_wcstocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { XLCd lcd = (XLCd) conv->state; wchar_t *wcptr = *((wchar_t **)from); - register char *bufptr = *((char **) to); + char *bufptr = *((char **) to); wchar_t wch; char *tmpptr; - register length; + int length; CodeSet codeset; Ulong wc_encoding; 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) buf_len = wcstr_len * codeset->length; -#if !defined(__sony_news) || defined(SVR4) wc_encoding = codeset->wc_encoding; 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); } } -#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) *((XlcCharSet *) args[0]) = *codeset->charset_list; @@ -637,13 +603,11 @@ sjis_wcstocs(conv, from, from_left, to, to_left, args, num_args) } static CodeSet -GetCodeSetFromCharSet(lcd, charset) - XLCd lcd; - XlcCharSet charset; +GetCodeSetFromCharSet(XLCd lcd, XlcCharSet charset) { - register CodeSet *codeset = XLC_GENERIC(lcd, codeset_list); - register XlcCharSet *charset_list; - register codeset_num, num_charsets; + CodeSet *codeset = XLC_GENERIC(lcd, codeset_list); + XlcCharSet *charset_list; + int codeset_num, num_charsets; codeset_num = XLC_GENERIC(lcd, codeset_num); @@ -661,20 +625,20 @@ GetCodeSetFromCharSet(lcd, charset) static int -sjis_cstombs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - char **from; - int *from_left; - char **to; - int *to_left; - XPointer *args; - int num_args; +sjis_cstombs( + XlcConv conv, + char **from, + int *from_left, + char **to, + int *to_left, + XPointer *args, + int num_args) { XLCd lcd = (XLCd) conv->state; - register char *csptr = *from; - register char *bufptr = *to; + char *csptr = *from; + char *bufptr = *to; int csstr_len = *from_left; - register buf_len = *to_left; + int buf_len = *to_left; int length; CodeSet codeset; EncodingType type; @@ -719,21 +683,21 @@ sjis_cstombs(conv, from, from_left, to, to_left, args, num_args) } static int -sjis_cstowcs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +sjis_cstowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { XLCd lcd = (XLCd) conv->state; - register char *csptr = (char *) *from; + char *csptr = (char *) *from; wchar_t *bufptr = (wchar_t *) *to; wchar_t *toptr = (wchar_t *) *to; int csstr_len = *from_left; - register buf_len = *to_left; + int buf_len = *to_left; wchar_t wch; int length; 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 - * */ #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. */ static void -initCTptr(lcd) - XLCd lcd; +initCTptr(XLCd lcd) { int num_codesets = XLC_GENERIC(lcd, codeset_num); int num_charsets; @@ -892,22 +854,22 @@ initCTptr(lcd) static int -sjis_mbstocts(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +sjis_mbstocts( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { - register ct_len = *to_left; + int ct_len = *to_left; int cs_num; int clen; int unconv_num = 0; int num_conv; XPointer inbufptr = *from; - register char *ctptr = *to; + char *ctptr = *to; XPointer ct_base = ctptr; StateRec ct_state; @@ -1027,21 +989,21 @@ sjis_mbstocts(conv, from, from_left, to, to_left, args, num_args) #define byte2 (byte1 == 0) static int -sjis_wcstocts(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +sjis_wcstocts( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { - register ct_len = *to_left; - register wchar_t *inbufptr = (wchar_t *) *from; - register char *ctptr = *to; + int ct_len = *to_left; + wchar_t *inbufptr = (wchar_t *) *from; + char *ctptr = *to; XPointer ct_base = ctptr; wchar_t wch; - register length; + int length; Uchar tmp; Uchar t1 = 0, t2; 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)++; static int -sjis_ctstombs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +sjis_ctstombs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { - register XPointer inbufptr = *from; - register XPointer outbufptr = *to; + XPointer inbufptr = *from; + XPointer outbufptr = *to; XPointer inbuf_base; XPointer outbuf_base = outbufptr; - register clen, length; + int clen, length; int unconv_num = 0; int num_conv; unsigned int ct_seglen = 0; @@ -1257,27 +1219,27 @@ sjis_ctstombs(conv, from, from_left, to, to_left, args, num_args) static int -sjis_ctstowcs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +sjis_ctstowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { XLCd lcd = (XLCd)conv->state; Ulong wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits); - register XPointer inbufptr = *from; + XPointer inbufptr = *from; XPointer inbuf_base; - register wchar_t *outbufptr = (wchar_t *) *to; + wchar_t *outbufptr = (wchar_t *) *to; wchar_t *outbuf_base = outbufptr; - register clen, length; + int clen, length; int num_conv; int unconv_num = 0; unsigned int ct_seglen = 0; Uchar ct_type = 0; - register shift_mult; + int shift_mult; wchar_t wc_tmp; wchar_t wch; Ulong wc_encoding; @@ -1349,7 +1311,6 @@ sjis_ctstowcs(conv, from, from_left, to, to_left, args, num_args) (*from_left) -= 2; continue; } -#if !defined(__sony_news) || defined(SVR4) wc_encoding = (ctdp == ctdptr[Kana] && isleftside(*inbufptr)) ? 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--; } while (--clen); *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; @@ -1385,17 +1336,14 @@ sjis_ctstowcs(conv, from, from_left, to, to_left, args, num_args) #undef BADCHAR static void -close_converter(conv) - XlcConv conv; +close_converter(XlcConv conv) { Xfree((char *) conv); } static XlcConv -create_conv(lcd, methods) - XLCd lcd; - XlcConvMethods methods; +create_conv(XLCd lcd, XlcConvMethods methods) { XlcConv conv; @@ -1428,118 +1376,73 @@ static XlcConvMethodsRec conv_methods[] = { static XlcConv -open_mbstocs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_mbstocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[MBSTOCS]); } static XlcConv -open_wcstocs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_wcstocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[WCSTOCS]); } static XlcConv -open_mbtocs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_mbtocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[MBTOCS]); } static XlcConv -open_cstombs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_cstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[CSTOMBS]); } static XlcConv -open_cstowcs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_cstowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[CSTOWCS]); } static XlcConv -open_mbstowcs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_mbstowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[MBSTOWCS]); } static XlcConv -open_wcstombs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_wcstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[WCSTOMBS]); } static XlcConv -open_wcstocts(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_wcstocts(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[WCSTOCTS]); } static XlcConv -open_mbstocts(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_mbstocts(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[MBSTOCTS]); } static XlcConv -open_ctstombs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_ctstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[CTSTOMBS]); } static XlcConv -open_ctstowcs(from_lcd, from_type, to_lcd, to_type) - XLCd from_lcd; - char *from_type; - XLCd to_lcd; - char *to_type; +open_ctstowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) { return create_conv(from_lcd, &conv_methods[CTSTOWCS]); } XLCd -_fallcSjisLoader(name) - char *name; +_fallcSjisLoader(char *name) { XLCd lcd; CodeSet *codeset_list; diff --git a/cde/programs/dtudcfonted/libfal/_fallcStd.c b/cde/programs/dtudcfonted/libfal/_fallcStd.c index 7e15afe2..a7404ae5 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcStd.c +++ b/cde/programs/dtudcfonted/libfal/_fallcStd.c @@ -51,11 +51,7 @@ #include "_fallcPubI.h" int -_fallcmbtowc(lcd, wstr, str, len) - XLCd lcd; - wchar_t *wstr; - char *str; - int len; +_fallcmbtowc(XLCd lcd, wchar_t *wstr, char *str, int len) { static XLCd last_lcd = NULL; static XlcConv conv = NULL; @@ -96,10 +92,7 @@ _fallcmbtowc(lcd, wstr, str, len) } int -_fallcwctomb(lcd, str, wc) - XLCd lcd; - char *str; - wchar_t wc; +_fallcwctomb(XLCd lcd, char *str, wchar_t wc) { static XLCd last_lcd = NULL; static XlcConv conv = NULL; @@ -139,11 +132,7 @@ _fallcwctomb(lcd, str, wc) } int -_fallcmbstowcs(lcd, wstr, str, len) - XLCd lcd; - wchar_t *wstr; - char *str; - int len; +_fallcmbstowcs(XLCd lcd, wchar_t *wstr, char *str, int len) { XlcConv conv; XPointer from, to; @@ -178,11 +167,7 @@ _fallcmbstowcs(lcd, wstr, str, len) } int -_fallcwcstombs(lcd, str, wstr, len) - XLCd lcd; - char *str; - wchar_t *wstr; - int len; +_fallcwcstombs(XLCd lcd, char *str, wchar_t *wstr, int len) { XlcConv conv; XPointer from, to; @@ -218,51 +203,37 @@ _fallcwcstombs(lcd, str, wstr, len) int -_falmbtowc(wstr, str, len) - wchar_t *wstr; - char *str; - int len; +_falmbtowc(wchar_t *wstr, char *str, int len) { return _fallcmbtowc((XLCd) NULL, wstr, str, len); } int -_falmblen(str, len) - char *str; - int len; +_falmblen(char *str, int len) { return _falmbtowc((wchar_t *) NULL, str, len); } int -_falwctomb(str, wc) - char *str; - wchar_t wc; +_falwctomb(char *str, wchar_t wc) { return _fallcwctomb((XLCd) NULL, str, wc); } int -_falmbstowcs(wstr, str, len) - wchar_t *wstr; - char *str; - int len; +_falmbstowcs(wchar_t *wstr, char *str, int len) { return _fallcmbstowcs((XLCd) NULL, wstr, str, len); } int -_falwcstombs(str, wstr, len) - char *str; - wchar_t *wstr; - int len; +_falwcstombs(char *str, wchar_t *wstr, int len) { return _fallcwcstombs((XLCd) NULL, str, wstr, len); } wchar_t * -_falwcscpy(wstr1, wstr2) - register wchar_t *wstr1, *wstr2; +_falwcscpy(wchar_t *wstr1, wchar_t *wstr2) { wchar_t *wstr_tmp = wstr1; @@ -273,9 +244,7 @@ _falwcscpy(wstr1, wstr2) } wchar_t * -_falwcsncpy(wstr1, wstr2, len) - register wchar_t *wstr1, *wstr2; - register len; +_falwcsncpy(wchar_t *wstr1, wchar_t *wstr2, int len) { wchar_t *wstr_tmp = wstr1; @@ -290,10 +259,9 @@ _falwcsncpy(wstr1, wstr2, len) } int -_falwcslen(wstr) - register wchar_t *wstr; +_falwcslen(wchar_t *wstr) { - register wchar_t *wstr_ptr = wstr; + wchar_t *wstr_ptr = wstr; while (*wstr_ptr) wstr_ptr++; @@ -302,8 +270,7 @@ _falwcslen(wstr) } int -_falwcscmp(wstr1, wstr2) - register wchar_t *wstr1, *wstr2; +_falwcscmp(wchar_t *wstr1, wchar_t *wstr2) { for ( ; *wstr1 && *wstr2; wstr1++, wstr2++) if (*wstr1 != *wstr2) @@ -313,9 +280,7 @@ _falwcscmp(wstr1, wstr2) } int -_falwcsncmp(wstr1, wstr2, len) - register wchar_t *wstr1, *wstr2; - register len; +_falwcsncmp(wchar_t *wstr1, wchar_t *wstr2, int len) { for ( ; *wstr1 && *wstr2 && len > 0; wstr1++, wstr2++, len--) if (*wstr1 != *wstr2) diff --git a/cde/programs/dtudcfonted/libfal/_fallcTxtPr.c b/cde/programs/dtudcfonted/libfal/_fallcTxtPr.c index 4e5923bb..708543d8 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcTxtPr.c +++ b/cde/programs/dtudcfonted/libfal/_fallcTxtPr.c @@ -54,14 +54,11 @@ #include static int -get_buf_size(is_wide_char, list, count) - Bool is_wide_char; - XPointer list; - int count; +get_buf_size(Bool is_wide_char, XPointer list, int count) { - register length = 0; - register char **mb_list; - register wchar_t **wc_list; + int length = 0; + char **mb_list; + wchar_t **wc_list; if (list == NULL) return 0; @@ -87,14 +84,14 @@ get_buf_size(is_wide_char, list, count) } static int -_XTextListToTextProperty(lcd, dpy, from_type, list, count, style, text_prop) - XLCd lcd; - Display *dpy; - char *from_type; - XPointer list; - int count; - XICCEncodingStyle style; - XTextProperty *text_prop; +_XTextListToTextProperty( + XLCd lcd, + Display *dpy, + char *from_type, + XPointer list, + int count, + XICCEncodingStyle style, + XTextProperty *text_prop) { Atom encoding; XlcConv conv; @@ -103,7 +100,7 @@ _XTextListToTextProperty(lcd, dpy, from_type, list, count, style, text_prop) wchar_t **wc_list; XPointer from; 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; if (strcmp(XlcNWideChar, from_type) == 0) @@ -138,7 +135,7 @@ _XTextListToTextProperty(lcd, dpy, from_type, list, count, style, text_prop) mb_list++; } unconv_num = 0; - goto done; + done++; } break; default: @@ -148,107 +145,111 @@ _XTextListToTextProperty(lcd, dpy, from_type, list, count, style, text_prop) if (count < 1) { nitems = 0; - goto done; + done++; } -retry: - conv = _fallcOpenConverter(lcd, from_type, lcd, to_type); - if (conv == NULL) { + if(done == 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); - 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) - wc_list = (wchar_t **) list; - else - mb_list = (char **) list; + do{ + retry = 0; + conv = _fallcOpenConverter(lcd, from_type, lcd, to_type); + if (conv == NULL) { + Xfree(buf); + return XConverterNotFound; + } - to = buf; - to_left = buf_len; + if (is_wide_char) + wc_list = (wchar_t **) list; + else + mb_list = (char **) list; - unconv_num = 0; + to = buf; + to_left = buf_len; - 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++; - } + unconv_num = 0; - ret = _fallcConvert(conv, &from, &from_left, (XPointer *) &to, &to_left, + for (i = 1; to_left > 0; i++) { + if (is_wide_char) { + from = (XPointer) *wc_list; + from_left = _falwcslen(*wc_list); + wc_list++; + } else { + from = (XPointer) *mb_list; + from_left = strlen(*mb_list); + mb_list++; + } + + ret = _fallcConvert(conv, &from, &from_left, (XPointer *) &to, &to_left, NULL, 0); - if (ret < 0) - continue; + if (ret < 0) + continue; - if (ret > 0 && style == XStdICCTextStyle && encoding == XA_STRING) { - _fallcCloseConverter(conv); - encoding = falInternAtom(dpy, "COMPOUND_TEXT", False); - to_type = XlcNCompoundText; - goto retry; - } + if (ret > 0 && style == XStdICCTextStyle && encoding == XA_STRING) { + _fallcCloseConverter(conv); + encoding = falInternAtom(dpy, "COMPOUND_TEXT", False); + to_type = XlcNCompoundText; + retry++; + } - unconv_num += ret; - *to++ = '\0'; - to_left--; + unconv_num += ret; + *to++ = '\0'; + to_left--; - if (i >= count) - break; + if (i >= count) + break; - _fallcResetConverter(conv); - } + _fallcResetConverter(conv); + } _fallcCloseConverter(conv); nitems = to - buf; -done: - if (nitems <= 0) - nitems = 1; - value = (char *) Xmalloc(nitems); - if (value == NULL) { - Xfree(buf); - return XNoMemory; - } - if (nitems == 1) - *value = 0; - else - memcpy(value, buf, nitems); - nitems--; - Xfree(buf); - - text_prop->value = (unsigned char *) value; - text_prop->encoding = encoding; - text_prop->format = 8; - text_prop->nitems = nitems; - - return unconv_num; + }while (retry == 1); } int -_falmbTextListToTextProperty(lcd, dpy, list, count, style, text_prop) - XLCd lcd; - Display *dpy; - char **list; - int count; - XICCEncodingStyle style; - XTextProperty *text_prop; +_falmbTextListToTextProperty( + XLCd lcd, + Display *dpy, + char **list, + int count, + XICCEncodingStyle style, + XTextProperty *text_prop) { return _XTextListToTextProperty(lcd, dpy, XlcNMultiByte, (XPointer) list, count, style, text_prop); } int -_falwcTextListToTextProperty(lcd, dpy, list, count, style, text_prop) - XLCd lcd; - Display *dpy; - wchar_t **list; - int count; - XICCEncodingStyle style; - XTextProperty *text_prop; +_falwcTextListToTextProperty( + XLCd lcd, + Display *dpy, + wchar_t **list, + int count, + XICCEncodingStyle style, + XTextProperty *text_prop) { return _XTextListToTextProperty(lcd, dpy, XlcNWideChar, (XPointer) list, count, style, text_prop); diff --git a/cde/programs/dtudcfonted/libfal/_fallcUTF.c b/cde/programs/dtudcfonted/libfal/_fallcUTF.c index 60e753d8..3154dc51 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcUTF.c +++ b/cde/programs/dtudcfonted/libfal/_fallcUTF.c @@ -49,65 +49,52 @@ OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "_fallcUTF.h" +#include -static long getutfrune(); +static long getutfrune(char **read_from, int *from_len); static void our_wctomb( -#if NeedFunctionPrototypes unsigned short r, char **bufptr, int *buf_len -#endif ); static int our_mbtowc( -#if NeedFunctionPrototypes unsigned long *p, char *s, size_t n -#endif ); static void latin2rune( -#if NeedFunctionPrototypes unsigned char c, Rune *r -#endif ); static void jis02012rune( -#if NeedFunctionPrototypes unsigned char c, Rune *r -#endif ); static void jis02082rune( -#if NeedFunctionPrototypes unsigned char c, Rune *r -#endif ); static void ksc2rune( -#if NeedFunctionPrototypes unsigned char c, Rune *r -#endif ); static void gb2rune( -#if NeedFunctionPrototypes unsigned char c, Rune *r -#endif ); -static void init_latin1tab(); -static void init_latin2tab(); -static void init_latin3tab(); -static void init_latin4tab(); -static void init_latin5tab(); -static void init_latin6tab(); -static void init_latin7tab(); -static void init_latin8tab(); -static void init_latin9tab(); -static void init_jis0201tab(); -static void init_jis0208tab(); -static void init_ksc5601tab(); -static void init_gb2312tab(); +static void init_latin1tab(long *tbl, long fb_default); +static void init_latin2tab(long *tbl, long fb_default); +static void init_latin3tab(long *tbl, long fb_default); +static void init_latin4tab(long *tbl, long fb_default); +static void init_latin5tab(long *tbl, long fb_default); +static void init_latin6tab(long *tbl, long fb_default); +static void init_latin7tab(long *tbl, long fb_default); +static void init_latin8tab(long *tbl, long fb_default); +static void init_latin9tab(long *tbl, long fb_default); +static void init_jis0201tab(long *tbl, long fb_default); +static void init_jis0208tab(long *tbl, long fb_default); +static void init_ksc5601tab(long *tbl, long fb_default); +static void init_gb2312tab(long *tbl, long fb_default); static char *int_locale = NULL; @@ -149,21 +136,16 @@ static XlcUTFDataRec default_utf_data[] = static void -set_latin_nop(table, default_val) -long *table; -long default_val; +set_latin_nop(long *table, long default_val) { - register int i; + int i; for(i = 0; i < 0x1fff; i++) table[i] = default_val; return; } static void -set_latin_tab(fptr, table, fb_default) -FILE *fptr; -long *table; -long fb_default; +set_latin_tab(FILE *fptr, long *table, long fb_default) { int i = 0; int j = 0; @@ -186,9 +168,7 @@ extern int _fallcResolveI18NPath(); #define TBL_DATA_DIR "tbl_data" static void -init_latin1tab(tbl, fb_default) -long *tbl; -long fb_default; +init_latin1tab(long *tbl, long fb_default) { FILE *fp = NULL; char dirname[BUFSIZE]; @@ -221,9 +201,7 @@ long fb_default; } static void -init_latin2tab(tbl, fb_default) -long *tbl; -long fb_default; +init_latin2tab(long *tbl, long fb_default) { FILE *fp; char dirname[BUFSIZE]; @@ -256,9 +234,7 @@ long fb_default; } static void -init_latin3tab(tbl, fb_default) -long *tbl; -long fb_default; +init_latin3tab(long *tbl, long fb_default) { FILE *fp; char dirname[BUFSIZE]; @@ -291,9 +267,7 @@ long fb_default; } static void -init_latin4tab(tbl, fb_default) -long *tbl; -long fb_default; +init_latin4tab(long *tbl, long fb_default) { FILE *fp; char dirname[BUFSIZE]; @@ -326,9 +300,7 @@ long fb_default; } static void -init_latin5tab(tbl, fb_default) -long *tbl; -long fb_default; +init_latin5tab(long *tbl, long fb_default) { FILE *fp; char dirname[BUFSIZE]; @@ -361,9 +333,7 @@ long fb_default; } static void -init_latin6tab(tbl, fb_default) -long *tbl; -long fb_default; +init_latin6tab(long *tbl, long fb_default) { FILE *fp; char dirname[BUFSIZE]; @@ -396,9 +366,7 @@ long fb_default; } static void -init_latin7tab(tbl, fb_default) -long *tbl; -long fb_default; +init_latin7tab(long *tbl, long fb_default) { FILE *fp; char dirname[BUFSIZE]; @@ -431,9 +399,7 @@ long fb_default; } static void -init_latin8tab(tbl, fb_default) -long *tbl; -long fb_default; +init_latin8tab(long *tbl, long fb_default) { FILE *fp; char dirname[BUFSIZE]; @@ -466,9 +432,7 @@ long fb_default; } static void -init_latin9tab(tbl, fb_default) -long *tbl; -long fb_default; +init_latin9tab(long *tbl, long fb_default) { FILE *fp; char dirname[BUFSIZE]; @@ -501,9 +465,7 @@ long fb_default; } static void -init_jis0201tab(tbl, fb_default) -long *tbl; -long fb_default; +init_jis0201tab(long *tbl, long fb_default) { int i; for(i = 0; i < NRUNE; i++) @@ -511,25 +473,23 @@ long fb_default; } static void -set_cjk_nop(to_tbl, to_max, default_val) -long **to_tbl; -long default_val; -int to_max; +set_cjk_nop(long **to_tbl, int to_max, long default_val) { - register int i; + int i; for(i = 0; i < to_max; i++) (*to_tbl)[i] = default_val; return; } static void -set_table(fptr, to_tbl, from_tbl, to_max, fb_default) -FILE *fptr; -long **to_tbl, *from_tbl; -int to_max; -long fb_default; +set_table( +FILE *fptr, +long **to_tbl, +long *from_tbl, +int to_max, +long fb_default) { - register int i = 0; + int i = 0; int j = 0; int rv = 0; long value; @@ -554,9 +514,7 @@ long fb_default; static void -init_jis0208tab(tbl, fb_default) -long *tbl; -long fb_default; +init_jis0208tab(long *tbl, long fb_default) { FILE *fp; char dirname[BUFSIZE]; @@ -592,9 +550,7 @@ long fb_default; } static void -init_ksc5601tab(tbl, fb_default) -long *tbl; -long fb_default; +init_ksc5601tab(long *tbl, long fb_default) { FILE *fp; char dirname[BUFSIZE]; @@ -630,9 +586,7 @@ long fb_default; } static void -init_gb2312tab(tbl, fb_default) -long *tbl; -long fb_default; +init_gb2312tab(long *tbl, long fb_default) { FILE *fp; char dirname[BUFSIZE]; @@ -668,7 +622,7 @@ long fb_default; } static UtfData -make_entry() +make_entry(void) { UtfData tmp = (UtfData)Xmalloc(sizeof(UtfDataRec)); bzero(tmp, sizeof(UtfDataRec)); @@ -677,8 +631,7 @@ make_entry() static int once = 0; static int -_XlcInitUTFInfo(lcd) -XLCd lcd; +_XlcInitUTFInfo(XLCd lcd) { if(!once) { int i; @@ -726,14 +679,14 @@ XLCd lcd; } static int -utftocs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - char **from; - int *from_left; - char **to; - int *to_left; - XPointer *args; - int num_args; +utftocs( + XlcConv conv, + char **from, + int *from_left, + char **to, + int *to_left, + XPointer *args, + int num_args) { char *utfptr; char *bufptr; @@ -763,7 +716,17 @@ utftocs(conv, from, from_left, to, to_left, args, num_args) tbl += l; if((r = *tbl) == -1) { 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 { pdata = pdata->next; continue; @@ -799,28 +762,17 @@ utftocs(conv, from, from_left, to, to_left, args, num_args) 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 -utf1tocs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - char **from; - int *from_left; - char **to; - int *to_left; - XPointer *args; - int num_args; +utf1tocs( + XlcConv conv, + char **from, + int *from_left, + char **to, + int *to_left, + XPointer *args, + int num_args) { char **ptr = NULL; char char_ptr[UTFmax]; @@ -839,14 +791,14 @@ utf1tocs(conv, from, from_left, to, to_left, args, num_args) } static int -ucstocs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - XPointer *from; - int *from_left; - char **to; - int *to_left; - XPointer *args; - int num_args; +ucstocs( + XlcConv conv, + XPointer *from, + int *from_left, + char **to, + int *to_left, + XPointer *args, + int num_args) { wchar_t *ucsptr; char *bufptr; @@ -871,7 +823,17 @@ ucstocs(conv, from, from_left, to, to_left, args, num_args) tbl += *ucsptr; if((r = *tbl) == -1) { 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 { pdata = pdata->next; continue; @@ -908,27 +870,10 @@ ucstocs(conv, from, from_left, to, to_left, args, num_args) } 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 -#if NeedFunctionPrototypes getutfrune(char **read_from, int *from_len) -#else -getutfrune(read_from, from_len) -char **read_from; -int *from_len; -#endif { int c, i; char str[UTFmax]; /* MB_LEN_MAX really */ @@ -952,24 +897,22 @@ int *from_len; } static -cstoutf(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - char **from; - int *from_left; - char **to; - int *to_left; - XPointer *args; - int num_args; +cstoutf( + XlcConv conv, + char **from, + int *from_left, + char **to, + int *to_left, + XPointer *args, + int num_args) { XlcCharSet charset; char *csptr, *utfptr; int csstr_len, utf_len; int cmp_len = 0; void (*putrune)( -#if NeedFunctionPrototypes unsigned char c, Rune *r -#endif ) = NULL; Rune r = (Rune)0; UtfData pdata = utfdata_list; @@ -1017,14 +960,14 @@ cstoutf(conv, from, from_left, to, to_left, args, num_args) } static -cstoucs(conv, from, from_left, to, to_left, args, num_args) - XlcConv conv; - char **from; - int *from_left; - XPointer *to; - int *to_left; - XPointer *args; - int num_args; +cstoucs( + XlcConv conv, + char **from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) { XlcCharSet charset; char *csptr; @@ -1032,10 +975,8 @@ cstoucs(conv, from, from_left, to, to_left, args, num_args) int csstr_len, ucs_len; int cmp_len = 0; void (*putrune)( -#if NeedFunctionPrototypes unsigned char c, Rune *r -#endif ) = NULL; Rune r = (Rune)0; UtfData pdata = utfdata_list; @@ -1085,14 +1026,7 @@ cstoucs(conv, from, from_left, to, to_left, args, num_args) } static void -#if NeedFunctionPrototypes 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; @@ -1150,26 +1084,14 @@ int *utf_len; } static void -#if NeedFunctionPrototypes latin2rune(unsigned char c, Rune *r) -#else -latin2rune(c, r) -unsigned char c; -Rune *r; -#endif { *r = (Rune)c; return; } static void -#if NeedFunctionPrototypes ksc2rune(unsigned char c, Rune *r) -#else -ksc2rune(c, r) -unsigned char c; -Rune *r; -#endif { static enum { init, cs1last} state = init; static int korean646 = 1; /* fixed to 1 for now. */ @@ -1206,32 +1128,19 @@ Rune *r; } static void -#if NeedFunctionPrototypes jis02012rune(unsigned char c, Rune *r) -#else -jis02012rune(c, r) -unsigned char c; -Rune *r; -#endif { /* To Be Implemented */ } static void -#if NeedFunctionPrototypes gb2rune(unsigned char c, Rune *r) -#else -gb2rune(c, r) -unsigned char c; -Rune *r; -#endif { static enum { state0, state1 } state = state0; static int lastc; long n, ch; unsigned char ch1 = (c|0x80); /* XXX */ -again: switch(state) { case state0: /* idle state */ @@ -1261,21 +1170,16 @@ again: } static void -#if NeedFunctionPrototypes jis02082rune(unsigned char c, Rune *r) -#else -jis02082rune(c, r) -unsigned char c; -Rune *r; -#endif { static enum { state0, state1} state = state0; static int lastc; unsigned char ch = (c|0x80); /* XXX */ - int n; + int n, again; long l; -again: +do { + again = 0; switch(state) { case state0: /* idle state */ @@ -1287,7 +1191,7 @@ again: if((lastc&0x80) != (ch&0x80)){ emit(lastc); state = state0; - goto again; + again += 1; } if(CANS2J(lastc, ch)){ int h = lastc, l = ch; @@ -1305,17 +1209,11 @@ again: } state = state0; } + } while (again == 1); } static int -#if NeedFunctionPrototypes 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; int c0, c1, c2, c3, c4, c5; @@ -1325,38 +1223,42 @@ size_t n; return 0; /* no shift states */ if(n < 1) - goto badlen; + return -2; /* bad length */ us = (unsigned char*)s; c0 = us[0]; if(c0 >= T3) { if(n < 3) - goto badlen; + return -2; c1 = us[1] ^ Tx; c2 = us[2] ^ Tx; if((c1|c2) & T2) { - goto bad; + errno = EILSEQ; + return -1; } if(c0 >= T5) { if(n < 5) - goto badlen; + return -2; c3 = us[3] ^ Tx; c4 = us[4] ^ Tx; if((c3|c4) & T2) { - goto bad; + errno = EILSEQ; + return -1; } if(c0 >= T6) { /* 6 bytes */ if(n < 6) - goto badlen; + return -2; c5 = us[5] ^ Tx; if(c5 & T2) { - goto bad; + errno = EILSEQ; + return -1; } wc = ((((((((((c0 & Mask6) << Bitx) | c1) << Bitx) | c2) << Bitx) | c3) << Bitx) | c4) << Bitx) | c5; if(wc <= Wchar5) { - goto bad; + errno = EILSEQ; + return -1; } *p = wc; return 6; @@ -1366,7 +1268,8 @@ size_t n; c1) << Bitx) | c2) << Bitx) | c3) << Bitx) | c4; if(wc <= Wchar4) { - goto bad; + errno = EILSEQ; + return -1; } *p = wc; return 5; @@ -1374,16 +1277,18 @@ size_t n; if(c0 >= T4) { /* 4 bytes */ if(n < 4) - goto badlen; + return -2; c3 = us[3] ^ Tx; if(c3 & T2) { - goto bad; + errno = EILSEQ; + return -1; } wc = ((((((c0 & Mask4) << Bitx) | c1) << Bitx) | c2) << Bitx) | c3; if(wc <= Wchar3) { - goto bad; + errno = EILSEQ; + return -1; } *p = wc; return 4; @@ -1392,7 +1297,8 @@ size_t n; wc = ((((c0 & Mask3) << Bitx) | c1) << Bitx) | c2; if(wc <= Wchar2) { - goto bad; + errno = EILSEQ; + return -1; } *p = wc; return 3; @@ -1400,44 +1306,38 @@ size_t n; if(c0 >= T2) { /* 2 bytes */ if(n < 2) - goto badlen; + return -2; c1 = us[1] ^ Tx; if(c1 & T2) { - goto bad; + errno = EILSEQ; + return -1; } wc = ((c0 & Mask2) << Bitx) | c1; if(wc <= Wchar1) { - goto bad; + errno = EILSEQ; + return -1; } *p = wc; return 2; } /* 1 byte */ if(c0 >= Tx) { - goto bad; + errno = EILSEQ; + return -1; } *p = c0; return 1; - -bad: - errno = EILSEQ; - return -1; -badlen: - return -2; } static void -close_converter(conv) - XlcConv conv; +close_converter(XlcConv conv) { Xfree((char *) conv); } static XlcConv -create_conv(lcd, methods) - XLCd lcd; - XlcConvMethods methods; +create_conv(XLCd lcd, XlcConvMethods methods) { XlcConv conv; @@ -1452,10 +1352,10 @@ create_conv(lcd, methods) return conv; -err: +/* if an error occurs somewhere close_converter(conv); - return (XlcConv) NULL; +*/ } static XlcConvMethodsRec mbtocs_methods = { @@ -1465,11 +1365,7 @@ static XlcConvMethodsRec mbtocs_methods = { }; static XlcConv -open_mbtocs(from_lcd, from, to_lcd, to) - XLCd from_lcd; - char *from; - XLCd to_lcd; - char *to; +open_mbtocs(XLCd from_lcd, char *from, XLCd to_lcd, char *to) { return create_conv(from_lcd, &mbtocs_methods); } @@ -1481,11 +1377,7 @@ static XlcConvMethodsRec mbstocs_methods = { }; static XlcConv -open_mbstocs(from_lcd, from, to_lcd, to) - XLCd from_lcd; - char *from; - XLCd to_lcd; - char *to; +open_mbstocs(XLCd from_lcd, char *from, XLCd to_lcd, char *to) { return create_conv(from_lcd, &mbstocs_methods); } @@ -1497,11 +1389,7 @@ static XlcConvMethodsRec wcstocs_methods = { }; static XlcConv -open_wcstocs(from_lcd, from, to_lcd, to) - XLCd from_lcd; - char *from; - XLCd to_lcd; - char *to; +open_wcstocs(XLCd from_lcd, char *from, XLCd to_lcd, char *to) { return create_conv(from_lcd, &wcstocs_methods); } @@ -1513,11 +1401,7 @@ static XlcConvMethodsRec cstombs_methods = { }; static XlcConv -open_cstombs(from_lcd, from, to_lcd, to) - XLCd from_lcd; - char *from; - XLCd to_lcd; - char *to; +open_cstombs(XLCd from_lcd, char *from, XLCd to_lcd, char *to) { return create_conv(from_lcd, &cstombs_methods); } @@ -1529,19 +1413,14 @@ static XlcConvMethodsRec cstowcs_methods = { }; static XlcConv -open_cstowcs(from_lcd, from, to_lcd, to) - XLCd from_lcd; - char *from; - XLCd to_lcd; - char *to; +open_cstowcs(XLCd from_lcd, char *from, XLCd to_lcd, char *to) { return create_conv(from_lcd, &cstowcs_methods); } XLCd -_fallcUtfLoader(name) - char *name; +_fallcUtfLoader(char *name) { XLCd lcd; diff --git a/cde/programs/dtudcfonted/libfal/_fallcUTF.h b/cde/programs/dtudcfonted/libfal/_fallcUTF.h index 853de961..825b455e 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcUTF.h +++ b/cde/programs/dtudcfonted/libfal/_fallcUTF.h @@ -91,18 +91,14 @@ typedef enum { typedef struct _UtfDataRec { XlcCharSet charset; void (*initialize)( /* Table Initializer */ -#if NeedNestedPrototypes long *tbl, long fallback -#endif ); long *fromtbl; /* UTF -> CharSet */ NormalizeType type; /* Normalize type */ void (*cstorune)( /* CharSet -> UTF */ -#if NeedNestedPrototypes unsigned char c, Rune *r -#endif ); Bool already_init; struct _UtfDataRec *next; /* next entry */ @@ -113,10 +109,8 @@ typedef struct _XlcUTFDataRec { XlcSide side; void (*initialize)(); void (*cstorune)( -#if NeedNestedPrototypes unsigned char c, Rune *r -#endif ); NormalizeType type; long fallback_value; diff --git a/cde/programs/dtudcfonted/libfal/_fallcUtil.c b/cde/programs/dtudcfonted/libfal/_fallcUtil.c index 6c67134c..3de03e54 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcUtil.c +++ b/cde/programs/dtudcfonted/libfal/_fallcUtil.c @@ -59,10 +59,9 @@ #endif int -_fallcCompareISOLatin1(str1, str2) - char *str1, *str2; +_fallcCompareISOLatin1(char *str1, char *str2) { - register char ch1, ch2; + char ch1, ch2; for ( ; (ch1 = *str1) && (ch2 = *str2); str1++, str2++) { if (islower(ch1)) @@ -78,11 +77,9 @@ _fallcCompareISOLatin1(str1, str2) } int -_fallcNCompareISOLatin1(str1, str2, len) - char *str1, *str2; - int len; +_fallcNCompareISOLatin1(char *str1, char *str2, int len) { - register char ch1, ch2; + char ch1, ch2; for ( ; (ch1 = *str1) && (ch2 = *str2) && len; str1++, str2++, len--) { if (islower(ch1)) diff --git a/cde/programs/dtudcfonted/libfal/_fallcWrap.c b/cde/programs/dtudcfonted/libfal/_fallcWrap.c index fd6ef9cb..0923cf7e 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcWrap.c +++ b/cde/programs/dtudcfonted/libfal/_fallcWrap.c @@ -93,36 +93,16 @@ from the X Consortium. #endif #include "_falutil.h" -#ifdef __STDC__ -#define Const const -#else -#define Const /**/ -#endif - -#ifdef X_NOT_STDC_ENV -extern char *getenv(); -#endif - extern void _fallcInitLoader( -#if NeedFunctionPrototypes void -#endif ); #ifdef XTHREADS LockInfoPtr _Xi18n_lock; #endif -#if NeedFunctionPrototypes char * -falSetLocaleModifiers( - _Xconst char *modifiers -) -#else -char * -falSetLocaleModifiers(modifiers) - char *modifiers; -#endif +falSetLocaleModifiers(const char *modifiers) { XLCd lcd = _fallcCurrentLC(); char *user_mods; @@ -143,14 +123,12 @@ falSetLocaleModifiers(modifiers) } Bool -falSupportsLocale() +falSupportsLocale(void) { return _fallcCurrentLC() != (XLCd)NULL; } -Bool _fallcValidModSyntax(mods, valid_mods) - char *mods; - char **valid_mods; +Bool _fallcValidModSyntax(char *mods, char **valid_mods) { int i; char **ptr; @@ -174,14 +152,11 @@ Bool _fallcValidModSyntax(mods, valid_mods) return !mods || !*mods; } -static Const char *im_valid[] = {"im", (char *)NULL}; +static const char *im_valid[] = {"im", (char *)NULL}; /*ARGSUSED*/ char * -_fallcDefaultMapModifiers (lcd, user_mods, prog_mods) - XLCd lcd; - char *user_mods; - char *prog_mods; +_fallcDefaultMapModifiers (XLCd lcd, char *user_mods, char *prog_mods) { int i; char *mods; @@ -231,8 +206,7 @@ typedef struct _XlcLoaderListRec { static XlcLoaderList loader_list = NULL; void -_fallcRemoveLoader(proc) - XLCdLoadProc proc; +_fallcRemoveLoader(XLCdLoadProc proc) { XlcLoaderList loader, prev; @@ -259,9 +233,7 @@ _fallcRemoveLoader(proc) } Bool -_fallcAddLoader(proc, position) - XLCdLoadProc proc; - XlcPosition position; +_fallcAddLoader(XLCdLoadProc proc, XlcPosition position) { XlcLoaderList loader, last; @@ -292,8 +264,7 @@ _fallcAddLoader(proc, position) } XLCd -_falOpenLC(name) - char *name; +_falOpenLC(char *name) { XLCd lcd; XlcLoaderList loader; @@ -319,7 +290,8 @@ _falOpenLC(name) if (!strcmp (cur->lcd->core->name, name)) { lcd = cur->lcd; cur->ref_count++; - goto found; + _XUnlockMutex(_Xi18n_lock); + return lcd; } } @@ -345,15 +317,10 @@ _falOpenLC(name) break; } } - -found: - _XUnlockMutex(_Xi18n_lock); - return lcd; } void -_falCloseLC(lcd) - XLCd lcd; +_falCloseLC(XLCd lcd) { XLCdList cur, *prev; @@ -374,7 +341,7 @@ _falCloseLC(lcd) */ XLCd -_fallcCurrentLC() +_fallcCurrentLC(void) { XLCd lcd; static XLCd last_lcd = NULL; @@ -390,8 +357,7 @@ _fallcCurrentLC() } XrmMethods -_falrmInitParseInfo(state) - XPointer *state; +_falrmInitParseInfo(XPointer *state) { XLCd lcd = _falOpenLC((char *) NULL); @@ -402,11 +368,11 @@ _falrmInitParseInfo(state) } int -falmbTextPropertyToTextList(dpy, text_prop, list_ret, count_ret) - Display *dpy; - XTextProperty *text_prop; - char ***list_ret; - int *count_ret; +falmbTextPropertyToTextList( + Display *dpy, + XTextProperty *text_prop, + char ***list_ret, + int *count_ret) { XLCd lcd = _fallcCurrentLC(); @@ -418,11 +384,11 @@ falmbTextPropertyToTextList(dpy, text_prop, list_ret, count_ret) } int -falwcTextPropertyToTextList(dpy, text_prop, list_ret, count_ret) - Display *dpy; - XTextProperty *text_prop; - wchar_t ***list_ret; - int *count_ret; +falwcTextPropertyToTextList( + Display *dpy, + XTextProperty *text_prop, + wchar_t ***list_ret, + int *count_ret) { XLCd lcd = _fallcCurrentLC(); @@ -434,12 +400,12 @@ falwcTextPropertyToTextList(dpy, text_prop, list_ret, count_ret) } int -falmbTextListToTextProperty(dpy, list, count, style, text_prop) - Display *dpy; - char **list; - int count; - XICCEncodingStyle style; - XTextProperty *text_prop; +falmbTextListToTextProperty( + Display *dpy, + char **list, + int count, + XICCEncodingStyle style, + XTextProperty *text_prop) { XLCd lcd = _fallcCurrentLC(); @@ -451,12 +417,12 @@ falmbTextListToTextProperty(dpy, list, count, style, text_prop) } int -falwcTextListToTextProperty(dpy, list, count, style, text_prop) - Display *dpy; - wchar_t **list; - int count; - XICCEncodingStyle style; - XTextProperty *text_prop; +falwcTextListToTextProperty( + Display *dpy, + wchar_t **list, + int count, + XICCEncodingStyle style, + XTextProperty *text_prop) { XLCd lcd = _fallcCurrentLC(); @@ -468,8 +434,7 @@ falwcTextListToTextProperty(dpy, list, count, style, text_prop) } void -falwcFreeStringList(list) - wchar_t **list; +falwcFreeStringList(wchar_t **list) { XLCd lcd = _fallcCurrentLC(); @@ -480,7 +445,7 @@ falwcFreeStringList(list) } char * -falDefaultString() +falDefaultString(void) { XLCd lcd = _fallcCurrentLC(); @@ -491,10 +456,7 @@ falDefaultString() } void -_fallcCopyFromArg(src, dst, size) - char *src; - register char *dst; - register int size; +_fallcCopyFromArg(char *src, char *dst, int size) { if (size == sizeof(long)) *((long *) dst) = (long) src; @@ -515,10 +477,7 @@ _fallcCopyFromArg(src, dst, size) } void -_fallcCopyToArg(src, dst, size) - register char *src; - register char **dst; - register int size; +_fallcCopyToArg(char *src, char **dst, int size) { if (size == sizeof(long)) *((long *) *dst) = *((long *) src); @@ -533,11 +492,9 @@ _fallcCopyToArg(src, dst, size) } void -_fallcCountVaList(var, count_ret) - va_list var; - int *count_ret; +_fallcCountVaList(va_list var, int *count_ret) { - register int count; + int count; for (count = 0; va_arg(var, char *); count++) va_arg(var, XPointer); @@ -546,12 +503,9 @@ _fallcCountVaList(var, count_ret) } void -_fallcVaToArgList(var, count, args_ret) - va_list var; - register int count; - XlcArgList *args_ret; +_fallcVaToArgList(va_list var, int count, XlcArgList *args_ret) { - register XlcArgList args; + XlcArgList args; *args_ret = args = (XlcArgList) Xmalloc(sizeof(XlcArg) * count); if (args == (XlcArgList) NULL) @@ -564,22 +518,20 @@ _fallcVaToArgList(var, count, args_ret) } void -_fallcCompileResourceList(resources, num_resources) - register XlcResourceList resources; - register int num_resources; +_fallcCompileResourceList(XlcResourceList resources, int num_resources) { for ( ; num_resources-- > 0; resources++) resources->xrm_name = falrmPermStringToQuark(resources->name); } char * -_fallcGetValues(base, resources, num_resources, args, num_args, mask) - XPointer base; - XlcResourceList resources; - int num_resources; - XlcArgList args; - int num_args; - unsigned long mask; +_fallcGetValues( + XPointer base, + XlcResourceList resources, + int num_resources, + XlcArgList args, + int num_args, + unsigned long mask) { XlcResourceList res; XrmQuark xrm_name; @@ -605,13 +557,13 @@ _fallcGetValues(base, resources, num_resources, args, num_args, mask) } char * -_fallcSetValues(base, resources, num_resources, args, num_args, mask) - XPointer base; - XlcResourceList resources; - int num_resources; - XlcArgList args; - int num_args; - unsigned long mask; +_fallcSetValues( + XPointer base, + XlcResourceList resources, + int num_resources, + XlcArgList args, + int num_args, + unsigned long mask) { XlcResourceList res; XrmQuark xrm_name; diff --git a/cde/programs/dtudcfonted/libfal/_fallcint.h b/cde/programs/dtudcfonted/libfal/_fallcint.h index a1260128..4ae07e32 100644 --- a/cde/programs/dtudcfonted/libfal/_fallcint.h +++ b/cde/programs/dtudcfonted/libfal/_fallcint.h @@ -107,12 +107,10 @@ from the X Consortium. #include "_falvarargs.h" typedef Bool (*XFilterEventProc)( -#if NeedFunctionPrototypes Display* /* display */, Window /* window */, XEvent* /* event */, XPointer /* client_data */ -#endif ); typedef struct _XIMFilter { @@ -195,35 +193,25 @@ typedef struct { */ typedef void (*XmbInitProc)( -#if NeedFunctionPrototypes XPointer /* state */ -#endif ); typedef char (*XmbCharProc)( -#if NeedFunctionPrototypes XPointer /* state */, char* /* str */, int* /* lenp */ -#endif ); typedef void (*XmbFinishProc)( -#if NeedFunctionPrototypes XPointer /* state */ -#endif ); typedef char* (*XlcNameProc)( -#if NeedFunctionPrototypes XPointer /* state */ -#endif ); typedef void (*XrmDestroyProc)( -#if NeedFunctionPrototypes XPointer /* state */ -#endif ); typedef struct { @@ -241,41 +229,32 @@ typedef struct _XLCd *XLCd; /* need forward reference */ */ typedef void (*XCloseLCProc)( -#if NeedFunctionPrototypes XLCd /* lcd */ -#endif ); typedef char* (*XlcMapModifiersProc)( -#if NeedFunctionPrototypes XLCd /* lcd */, char* /* user_mods */, char* /* prog_mods */ -#endif ); typedef XOM (*XOpenOMProc)( -#if NeedFunctionPrototypes XLCd /* lcd */, Display* /* display */, XrmDatabase /* rdb */, - _Xconst char* /* res_name */, - _Xconst char* /* res_class */ -#endif + const char* /* res_name */, + const char* /* res_class */ ); typedef XIM (*XOpenIMProc)( -#if NeedFunctionPrototypes XLCd /* lcd */, Display* /* display */, XrmDatabase /* rdb */, char* /* res_name */, char* /* res_class */ -#endif ); typedef Bool (*XRegisterIMInstantiateCBProc)( -#if NeedFunctionPrototypes XLCd /* lcd */, Display* /* display */, XrmDatabase /* rdb */, @@ -283,11 +262,9 @@ typedef Bool (*XRegisterIMInstantiateCBProc)( char* /* res_class */, XIMProc /* callback */, XPointer* /* client_data */ -#endif ); typedef Bool (*XUnregisterIMInstantiateCBProc)( -#if NeedFunctionPrototypes XLCd /* lcd */, Display* /* display */, XrmDatabase /* rdb */, @@ -295,69 +272,54 @@ typedef Bool (*XUnregisterIMInstantiateCBProc)( char* /* res_class */, XIMProc /* callback */, XPointer* /* client_data */ -#endif ); typedef XrmMethods (*XrmInitParseInfoProc)( -#if NeedFunctionPrototypes XLCd /* lcd */, XPointer* /* state */ -#endif ); typedef int (*falmbTextPropertyToTextListProc)( -#if NeedFunctionPrototypes XLCd /* lcd */, Display* /* display */, XTextProperty* /* text_prop */, char*** /* list_return */, int* /* count_return */ -#endif ); typedef int (*falwcTextPropertyToTextListProc)( -#if NeedFunctionPrototypes XLCd /* lcd */, Display* /* display */, XTextProperty* /* text_prop */, wchar_t*** /* list_return */, int* /* count_return */ -#endif ); typedef int (*falmbTextListToTextPropertyProc)( -#if NeedFunctionPrototypes XLCd /* lcd */, Display* /* display */, char** /* list */, int /* count */, XICCEncodingStyle /* style */, XTextProperty* /* text_prop_return */ -#endif ); typedef int (*falwcTextListToTextPropertyProc)( -#if NeedFunctionPrototypes XLCd /* lcd */, Display* /* display */, wchar_t** /* list */, int /* count */, XICCEncodingStyle /* style */, XTextProperty* /* text_prop_return */ -#endif ); typedef void (*falwcFreeStringListProc)( -#if NeedFunctionPrototypes XLCd /* lcd */, wchar_t** /* list */ -#endif ); typedef char* (*falDefaultStringProc)( -#if NeedFunctionPrototypes XLCd /* lcd */ -#endif ); typedef struct { @@ -416,33 +378,25 @@ typedef struct _XlcResource { #define XlcNumber(arr) (sizeof(arr) / sizeof(arr[0])) typedef Status (*XCloseOMProc)( -#if NeedFunctionPrototypes XOM /* om */ -#endif ); typedef char* (*XSetOMValuesProc)( -#if NeedFunctionPrototypes XOM /* om */, XlcArgList /* args */, int /* num_args */ -#endif ); typedef char* (*XGetOMValuesProc)( -#if NeedFunctionPrototypes XOM /* om */, XlcArgList /* args */, int /* num_args */ -#endif ); typedef XOC (*XCreateOCProc)( -#if NeedFunctionPrototypes XOM /* om */, XlcArgList /* args */, int /* num_args */ -#endif ); typedef struct _XOMMethodsRec { @@ -474,25 +428,19 @@ typedef struct _XOM { } XOMRec; typedef void (*XDestroyOCProc)( -#if NeedFunctionPrototypes XOC /* oc */ -#endif ); typedef char* (*XSetOCValuesProc)( -#if NeedFunctionPrototypes XOC /* oc */, XlcArgList /* args */, int /* num_args */ -#endif ); typedef char* (*XGetOCValuesProc)( -#if NeedFunctionPrototypes XOC /* oc */, XlcArgList /* args */, int /* num_args */ -#endif ); /* @@ -505,27 +453,22 @@ typedef char* (*XGetOCValuesProc)( */ typedef int (*XmbTextEscapementProc)( -#if NeedFunctionPrototypes XFontSet /* font_set */, - _Xconst char* /* text */, + const char* /* text */, int /* text_len */ -#endif ); typedef int (*XmbTextExtentsProc)( -#if NeedFunctionPrototypes XFontSet /* font_set */, - _Xconst char* /* text */, + const char* /* text */, int /* text_len */, XRectangle* /* overall_ink_extents */, XRectangle* /* overall_logical_extents */ -#endif ); typedef Status (*XmbTextPerCharExtentsProc)( -#if NeedFunctionPrototypes XFontSet /* font_set */, - _Xconst char* /* text */, + const char* /* text */, int /* text_len */, XRectangle* /* ink_extents_buffer */, XRectangle* /* logical_extents_buffer */, @@ -533,57 +476,47 @@ typedef Status (*XmbTextPerCharExtentsProc)( int* /* num_chars */, XRectangle* /* max_ink_extents */, XRectangle* /* max_logical_extents */ -#endif ); typedef int (*XmbDrawStringProc)( -#if NeedFunctionPrototypes Display* /* display */, Drawable /* drawable */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, - _Xconst char* /* text */, + const char* /* text */, int /* text_len */ -#endif ); typedef void (*XmbDrawImageStringProc)( -#if NeedFunctionPrototypes Display* /* display */, Drawable /* drawable */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, - _Xconst char* /* text */, + const char* /* text */, int /* text_len */ -#endif ); typedef int (*XwcTextEscapementProc)( -#if NeedFunctionPrototypes XFontSet /* font_set */, - _Xconst wchar_t* /* text */, + const wchar_t* /* text */, int /* text_len */ -#endif ); typedef int (*XwcTextExtentsProc)( -#if NeedFunctionPrototypes XFontSet /* font_set */, - _Xconst wchar_t* /* text */, + const wchar_t* /* text */, int /* text_len */, XRectangle* /* overall_ink_extents */, XRectangle* /* overall_logical_extents */ -#endif ); typedef Status (*XwcTextPerCharExtentsProc)( -#if NeedFunctionPrototypes XFontSet /* font_set */, - _Xconst wchar_t* /* text */, + const wchar_t* /* text */, int /* text_len */, XRectangle* /* ink_extents_buffer */, XRectangle* /* logical_extents_buffer */, @@ -591,33 +524,28 @@ typedef Status (*XwcTextPerCharExtentsProc)( int* /* num_chars */, XRectangle* /* max_ink_extents */, XRectangle* /* max_logical_extents */ -#endif ); typedef int (*XwcDrawStringProc)( -#if NeedFunctionPrototypes Display* /* display */, Drawable /* drawable */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, - _Xconst wchar_t* /* text */, + const wchar_t* /* text */, int /* text_len */ -#endif ); typedef void (*XwcDrawImageStringProc)( -#if NeedFunctionPrototypes Display* /* display */, Drawable /* drawable */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, - _Xconst wchar_t* /* text */, + const wchar_t* /* text */, int /* text_len */ -#endif ); typedef struct { @@ -669,12 +597,6 @@ typedef struct _XOC { } 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 * object itself, a method list and data. @@ -685,34 +607,22 @@ typedef struct _XOC { */ typedef struct { Status (*close)( -#if NeedFunctionPrototypes XIM -#endif ); char* (*set_values)( -#if NeedFunctionPrototypes XIM, XIMArg* -#endif ); char* (*get_values)( -#if NeedFunctionPrototypes XIM, XIMArg* -#endif ); XIC (*create_ic)( -#if NeedFunctionPrototypes XIM, XIMArg* -#endif ); int (*ctstombs)( -#if NeedFunctionPrototypes XIM, char*, int, char*, int, Status * -#endif ); int (*ctstowcs)( -#if NeedFunctionPrototypes XIM, char*, int, wchar_t*, int, Status * -#endif ); } XIMMethodsRec, *XIMMethods; @@ -763,49 +673,31 @@ typedef struct _XIM { */ typedef struct { void (*destroy)( -#if NeedFunctionPrototypes XIC -#endif ); void (*set_focus)( -#if NeedFunctionPrototypes XIC -#endif ); void (*unset_focus)( -#if NeedFunctionPrototypes XIC -#endif ); char* (*set_values)( -#if NeedFunctionPrototypes XIC, XIMArg* -#endif ); char* (*get_values)( -#if NeedFunctionPrototypes XIC, XIMArg* -#endif ); char* (*mb_reset)( -#if NeedFunctionPrototypes XIC -#endif ); wchar_t* (*wc_reset)( -#if NeedFunctionPrototypes XIC -#endif ); int (*mb_lookup_string)( -#if NeedFunctionPrototypes XIC, XKeyEvent*, char*, int, KeySym*, Status* -#endif ); int (*wc_lookup_string)( -#if NeedFunctionPrototypes XIC, XKeyEvent*, wchar_t*, int, KeySym*, Status* -#endif ); } XICMethodsRec, *XICMethods; @@ -847,186 +739,135 @@ typedef struct _XIC { XICCoreRec core; /* data of this IC */ } XICRec; -/* current Ultrix compiler gets horribly confused */ -#if !defined(NeedFunctionPrototypes) && defined(FUNCPROTO) -#define NeedFunctionPrototypes 1 -#endif - typedef XLCd (*XLCdLoadProc)( -#if NeedFunctionPrototypes char* -#endif ); _XFUNCPROTOBEGIN extern XLCd _falOpenLC( -#if NeedFunctionPrototypes char* /* name */ -#endif ); extern void _falCloseLC( -#if NeedFunctionPrototypes XLCd /* lcd */ -#endif ); extern XLCd _fallcCurrentLC( -#if NeedFunctionPrototypes void -#endif ); extern Bool _fallcValidModSyntax( -#if NeedFunctionPrototypes char* /* mods */, char** /* valid */ -#endif ); extern char *_fallcDefaultMapModifiers( -#if NeedFunctionPrototypes XLCd /* lcd */, char* /* user_mods */, char* /* prog_mods */ -#endif ); extern void _XIMCompileResourceList( -#if NeedFunctionPrototypes XIMResourceList /* res */, unsigned int /* num_res */ -#endif ); extern void _XCopyToArg( -#if NeedFunctionPrototypes XPointer /* src */, XPointer* /* dst */, unsigned int /* size */ -#endif ); extern char ** _falParseBaseFontNameList( -#if NeedFunctionPrototypes char* /* str */, int* /* num */ -#endif ); extern XrmMethods _falrmInitParseInfo( -#if NeedFunctionPrototypes XPointer* /* statep */ -#endif ); extern void _XRegisterFilterByMask( -#if NeedFunctionPrototypes Display* /* dpy */, Window /* window */, unsigned long /* event_mask */, Bool (*)( -#if NeedNestedPrototypes Display* /* display */, Window /* window */, XEvent* /* event */, XPointer /* client_data */ -#endif ) /* filter */, XPointer /* client_data */ -#endif ); extern void _XRegisterFilterByType( -#if NeedFunctionPrototypes Display* /* dpy */, Window /* window */, int /* start_type */, int /* end_type */, Bool (*)( -#if NeedNestedPrototypes Display* /* display */, Window /* window */, XEvent* /* event */, XPointer /* client_data */ -#endif ) /* filter */, XPointer /* client_data */ -#endif ); extern void _XUnregisterFilter( -#if NeedFunctionPrototypes Display* /* dpy */, Window /* window */, Bool (*)( -#if NeedNestedPrototypes Display* /* display */, Window /* window */, XEvent* /* event */, XPointer /* client_data */ -#endif ) /* filter */, XPointer /* client_data */ -#endif ); extern void _fallcCountVaList( -#if NeedFunctionPrototypes va_list /* var */, int* /* count_return */ -#endif ); extern void _fallcVaToArgList( -#if NeedFunctionPrototypes va_list /* var */, int /* count */, XlcArgList* /* args_return */ -#endif ); extern void _fallcCompileResourceList( -#if NeedFunctionPrototypes XlcResourceList /* resources */, int /* num_resources */ -#endif ); extern char *_fallcGetValues( -#if NeedFunctionPrototypes XPointer /* base */, XlcResourceList /* resources */, int /* num_resources */, XlcArgList /* args */, int /* num_args */, unsigned long /* mask */ -#endif ); extern char *_fallcSetValues( -#if NeedFunctionPrototypes XPointer /* base */, XlcResourceList /* resources */, int /* num_resources */, XlcArgList /* args */, int /* num_args */, unsigned long /* mask */ -#endif ); extern Bool _fallcAddLoader( -#if NeedFunctionPrototypes XLCdLoadProc /* proc */, XlcPosition /* position */ -#endif ); extern void _fallcRemoveLoader( -#if NeedFunctionPrototypes XLCdLoadProc /* proc */ -#endif ); _XFUNCPROTOEND diff --git a/cde/programs/dtudcfonted/libfal/_fallibint.h b/cde/programs/dtudcfonted/libfal/_fallibint.h index 7c795154..e344b1ae 100644 --- a/cde/programs/dtudcfonted/libfal/_fallibint.h +++ b/cde/programs/dtudcfonted/libfal/_fallibint.h @@ -192,11 +192,9 @@ struct _XDisplay #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_ /* @@ -214,21 +212,14 @@ typedef struct _XSQEvent #define NEED_REPLIES #endif -#if NeedFunctionPrototypes /* prototypes require event type definitions */ #define NEED_EVENTS #define NEED_REPLIES -#endif #include #include #define _XBCOPYFUNC _Xbcopy #include #include -/* Utek leaves kernel macros around in include files (bleah) */ -#ifdef dirty -#undef dirty -#endif - #ifndef X_NOT_STDC_ENV #include #include @@ -272,32 +263,24 @@ typedef struct _LockInfoRec *LockInfoPtr; /* in XlibInt.c */ extern void (*_XCreateMutex_fn)( -#if NeedFunctionPrototypes LockInfoPtr /* lock */ -#endif ); extern void (*_XFreeMutex_fn)( -#if NeedFunctionPrototypes LockInfoPtr /* lock */ -#endif ); extern void (*_XLockMutex_fn)( -#if NeedFunctionPrototypes LockInfoPtr /* lock */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char * /* file */ , int /* line */ #endif -#endif ); extern void (*_XUnlockMutex_fn)( -#if NeedFunctionPrototypes LockInfoPtr /* lock */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char * /* file */ , int /* line */ #endif -#endif ); extern LockInfoPtr _Xglobal_lock; @@ -348,9 +331,6 @@ extern LockInfoPtr _Xglobal_lock; #endif -#ifndef NULL -#define NULL 0 -#endif #define LOCKED 1 #define UNLOCKED 0 @@ -402,26 +382,7 @@ extern int errno; /* Internal system error number. */ * 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 -#endif /* WORD64 */ - /* * 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++ #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) \ { \ long _BRdat; \ @@ -559,7 +508,6 @@ extern int errno; /* Internal system error number. */ ((unsigned long *)req)[1] = _BRlen + n + 2; \ Data32(dpy, &_BRdat, 4); \ } -#endif #define SetReqLen(req,n,badlen) \ if ((req->length + n) > (unsigned)65535) { \ @@ -615,10 +563,6 @@ extern int errno; /* Internal system error number. */ ptr = (type) dpy->bufptr; \ 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 _XRead16Pad(dpy, data, len) _XReadPad((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 _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len)) #endif -#endif /* not WORD64 */ #define PackData16(dpy,data,len) Data16 (dpy, data, len) #define PackData32(dpy,data,len) Data32 (dpy, data, len) @@ -778,87 +721,60 @@ _XFUNCPROTOBEGIN extern void Data(); #endif extern int _XError( -#if NeedFunctionPrototypes Display* /* dpy */, xError* /* rep */ -#endif ); extern int _XIOError( -#if NeedFunctionPrototypes Display* /* dpy */ -#endif ); extern int (*_XIOErrorFunction)( -#if NeedNestedPrototypes Display* /* dpy */ -#endif ); extern int (*_XErrorFunction)( -#if NeedNestedPrototypes Display* /* dpy */, XErrorEvent* /* error_event */ -#endif ); extern void _XEatData( -#if NeedFunctionPrototypes Display* /* dpy */, unsigned long /* n */ -#endif ); extern char *_XAllocScratch( -#if NeedFunctionPrototypes Display* /* dpy */, unsigned long /* nbytes */ -#endif ); extern char *_XAllocTemp( -#if NeedFunctionPrototypes Display* /* dpy */, unsigned long /* nbytes */ -#endif ); extern void _XFreeTemp( -#if NeedFunctionPrototypes Display* /* dpy */, char* /* buf */, unsigned long /* nbytes */ -#endif ); extern Visual *_XVIDtoVisual( -#if NeedFunctionPrototypes Display* /* dpy */, VisualID /* id */ -#endif ); extern unsigned long _XSetLastRequestRead( -#if NeedFunctionPrototypes Display* /* dpy */, xGenericReply* /* rep */ -#endif ); extern int _XGetHostname( -#if NeedFunctionPrototypes char* /* buf */, int /* maxlen */ -#endif ); extern Screen *_XScreenOfWindow( -#if NeedFunctionPrototypes Display* /* dpy */, Window /* w */ -#endif ); extern Bool _XAsyncErrorHandler( -#if NeedFunctionPrototypes Display* /* dpy */, xReply* /* rep */, char* /* buf */, int /* len */, XPointer /* data */ -#endif ); extern char *_XGetAsyncReply( -#if NeedFunctionPrototypes Display* /* dpy */, char* /* replbuf */, xReply* /* rep */, @@ -866,347 +782,238 @@ extern char *_XGetAsyncReply( int /* len */, int /* extra */, Bool /* discard */ -#endif ); extern _XFlush( -#if NeedFunctionPrototypes Display* /* dpy */ -#endif ); extern int _XEventsQueued( -#if NeedFunctionPrototypes Display* /* dpy */, int /* mode */ -#endif ); extern _XReadEvents( -#if NeedFunctionPrototypes Display* /* dpy */ -#endif ); extern _XRead( -#if NeedFunctionPrototypes Display* /* dpy */, char* /* data */, long /* size */ -#endif ); extern _XReadPad( -#if NeedFunctionPrototypes Display* /* dpy */, char* /* data */, long /* size */ -#endif ); extern _XSend( -#if NeedFunctionPrototypes Display* /* dpy */, - _Xconst char* /* data */, + const char* /* data */, long /* size */ -#endif ); extern Status _XReply( -#if NeedFunctionPrototypes Display* /* dpy */, xReply* /* rep */, int /* extra */, Bool /* discard */ -#endif ); extern _XEnq( -#if NeedFunctionPrototypes Display* /* dpy */, xEvent* /* event */ -#endif ); extern _XDeq( -#if NeedFunctionPrototypes Display* /* dpy */, _XQEvent* /* prev */, _XQEvent* /* qelt */ -#endif ); extern int (*XESetCreateGC( -#if NeedFunctionPrototypes Display* /* display */, int /* extension */, int (*) ( -#if NeedNestedPrototypes Display* /* display */, GC /* gc */, XExtCodes* /* codes */ -#endif ) /* proc */ -#endif ))( -#if NeedNestedPrototypes Display*, GC, XExtCodes* -#endif ); extern int (*XESetCopyGC( -#if NeedFunctionPrototypes Display* /* display */, int /* extension */, int (*) ( -#if NeedNestedPrototypes Display* /* display */, GC /* gc */, XExtCodes* /* codes */ -#endif ) /* proc */ -#endif ))( -#if NeedNestedPrototypes Display*, GC, XExtCodes* -#endif ); extern int (*XESetFlushGC( -#if NeedFunctionPrototypes Display* /* display */, int /* extension */, int (*) ( -#if NeedNestedPrototypes Display* /* display */, GC /* gc */, XExtCodes* /* codes */ -#endif ) /* proc */ -#endif ))( -#if NeedNestedPrototypes Display*, GC, XExtCodes* -#endif ); extern int (*XESetFreeGC( -#if NeedFunctionPrototypes Display* /* display */, int /* extension */, int (*) ( -#if NeedNestedPrototypes Display* /* display */, GC /* gc */, XExtCodes* /* codes */ -#endif ) /* proc */ -#endif ))( -#if NeedNestedPrototypes Display*, GC, XExtCodes* -#endif ); extern int (*XESetCreateFont( -#if NeedFunctionPrototypes Display* /* display */, int /* extension */, int (*) ( -#if NeedNestedPrototypes Display* /* display */, XFontStruct* /* fs */, XExtCodes* /* codes */ -#endif ) /* proc */ -#endif ))( -#if NeedNestedPrototypes Display*, XFontStruct*, XExtCodes* -#endif ); extern int (*XESetFreeFont( -#if NeedFunctionPrototypes Display* /* display */, int /* extension */, int (*) ( -#if NeedNestedPrototypes Display* /* display */, XFontStruct* /* fs */, XExtCodes* /* codes */ -#endif ) /* proc */ -#endif ))( -#if NeedNestedPrototypes Display*, XFontStruct*, XExtCodes* -#endif ); extern int (*XESetCloseDisplay( -#if NeedFunctionPrototypes Display* /* display */, int /* extension */, int (*) ( -#if NeedNestedPrototypes Display* /* display */, XExtCodes* /* codes */ -#endif ) /* proc */ -#endif ))( -#if NeedNestedPrototypes Display*, XExtCodes* -#endif ); extern int (*XESetError( -#if NeedFunctionPrototypes Display* /* display */, int /* extension */, int (*) ( -#if NeedNestedPrototypes Display* /* display */, xError* /* err */, XExtCodes* /* codes */, int* /* ret_code */ -#endif ) /* proc */ -#endif ))( -#if NeedNestedPrototypes Display*, xError*, XExtCodes*, int* -#endif ); extern char* (*XESetErrorString( -#if NeedFunctionPrototypes Display* /* display */, int /* extension */, char* (*) ( -#if NeedNestedPrototypes Display* /* display */, int /* code */, XExtCodes* /* codes */, char* /* buffer */, int /* nbytes */ -#endif ) /* proc */ -#endif ))( -#if NeedNestedPrototypes Display*, int, XExtCodes*, char*, int -#endif ); extern void (*XESetPrintErrorValues ( -#if NeedFunctionPrototypes Display* /* display */, int /* extension */, void (*)( -#if NeedNestedPrototypes Display* /* display */, XErrorEvent* /* ev */, void* /* fp */ -#endif ) /* proc */ -#endif ))( -#if NeedNestedPrototypes Display*, XErrorEvent*, void* -#endif ); extern Bool (*XESetWireToEvent( -#if NeedFunctionPrototypes Display* /* display */, int /* event_number */, Bool (*) ( -#if NeedNestedPrototypes Display* /* display */, XEvent* /* re */, xEvent* /* event */ -#endif ) /* proc */ -#endif ))( -#if NeedNestedPrototypes Display*, XEvent*, xEvent* -#endif ); extern Status (*XESetEventToWire( -#if NeedFunctionPrototypes Display* /* display */, int /* event_number */, Status (*) ( -#if NeedNestedPrototypes Display* /* display */, XEvent* /* re */, xEvent* /* event */ -#endif ) /* proc */ -#endif ))( -#if NeedNestedPrototypes Display*, XEvent*, xEvent* -#endif ); extern Bool (*XESetWireToError( -#if NeedFunctionPrototypes Display* /* display */, int /* error_number */, Bool (*) ( -#if NeedNestedPrototypes Display* /* display */, XErrorEvent* /* he */, xError* /* we */ -#endif ) /* proc */ -#endif ))( -#if NeedNestedPrototypes Display*, XErrorEvent*, xError* -#endif ); extern void (*XESetBeforeFlush( -#if NeedFunctionPrototypes Display* /* display */, int /* error_number */, void (*) ( -#if NeedNestedPrototypes Display* /* display */, XExtCodes* /* codes */, char* /* data */, long /* len */ -#endif ) /* proc */ -#endif ))( -#if NeedNestedPrototypes Display*, XExtCodes*, char*, long -#endif ); /* internal connections for IMs */ typedef void (*_XInternalConnectionProc)( -#if NeedFunctionPrototypes Display* /* dpy */, int /* fd */, XPointer /* call_data */ -#endif ); extern Status _XRegisterInternalConnection( -#if NeedFunctionPrototypes Display* /* dpy */, int /* fd */, _XInternalConnectionProc /* callback */, XPointer /* call_data */ -#endif ); extern void _XUnregisterInternalConnection( -#if NeedFunctionPrototypes Display* /* dpy */, int /* fd */ -#endif ); /* Display structure has pointers to these */ @@ -1226,19 +1033,15 @@ struct _XConnWatchInfo { /* info from XAddConnectionWatch */ }; extern int XTextHeight( -#if NeedFunctionPrototypes XFontStruct* /* font_struct */, - _Xconst char* /* string */, + const char* /* string */, int /* count */ -#endif ); extern int XTextHeight16( -#if NeedFunctionPrototypes XFontStruct* /* font_struct */, - _Xconst XChar2b* /* string */, + const XChar2b* /* string */, int /* count */ -#endif ); _XFUNCPROTOEND diff --git a/cde/programs/dtudcfonted/libfal/_fallocking.h b/cde/programs/dtudcfonted/libfal/_fallocking.h index 6235ea40..384437f9 100644 --- a/cde/programs/dtudcfonted/libfal/_fallocking.h +++ b/cde/programs/dtudcfonted/libfal/_fallocking.h @@ -70,9 +70,7 @@ struct _XCVList { }; extern xthread_t (*_Xthread_self_fn)( /* in XlibInt.c */ -#if NeedFunctionPrototypes void -#endif ); /* Display->lock is a pointer to one of these */ @@ -97,77 +95,57 @@ struct _XLockInfo { struct _XCVList *free_cvls; /* used only in XlibInt.c */ void (*pop_reader)( -#if NeedNestedPrototypes Display* /* dpy */, struct _XCVList** /* list */, struct _XCVList*** /* tail */ -#endif ); struct _XCVList *(*push_reader)( -#if NeedNestedPrototypes Display * /* dpy */, struct _XCVList*** /* tail */ -#endif ); void (*condition_wait)( -#if NeedNestedPrototypes xcondition_t /* cv */, xmutex_t /* mutex */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char* /* file */, int /* line */ -#endif #endif ); void (*internal_lock_display)( -#if NeedNestedPrototypes Display* /* dpy */, Bool /* wskip */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char* /* file */, int /* line */ -#endif #endif ); /* used in XlibInt.c and locking.c */ void (*condition_signal)( -#if NeedNestedPrototypes xcondition_t /* cv */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char* /* file */, int /* line */ -#endif #endif ); void (*condition_broadcast)( -#if NeedNestedPrototypes xcondition_t /* cv */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char* /* file */, int /* line */ -#endif #endif ); /* used in XlibInt.c and XLockDis.c */ void (*lock_wait)( -#if NeedNestedPrototypes Display* /* dpy */ -#endif ); void (*user_lock_display)( -#if NeedNestedPrototypes Display* /* dpy */ -#endif ); void (*user_unlock_display)( -#if NeedNestedPrototypes Display* /* dpy */ -#endif ); struct _XCVList *(*create_cvl)( -#if NeedNestedPrototypes Display * /* dpy */ -#endif ); }; diff --git a/cde/programs/dtudcfonted/libfal/_falomGeneric.c b/cde/programs/dtudcfonted/libfal/_falomGeneric.c index f1d309a8..2caeaa76 100644 --- a/cde/programs/dtudcfonted/libfal/_falomGeneric.c +++ b/cde/programs/dtudcfonted/libfal/_falomGeneric.c @@ -86,9 +86,7 @@ extern void dbg_printValue(char *str, char **value, int num); /* For VW/UDC start */ static FontData -init_fontdata(font_data, font_data_count) - FontData font_data; - int font_data_count; +init_fontdata(FontData font_data, int font_data_count) { FontData fd; int i; @@ -105,12 +103,12 @@ init_fontdata(font_data, font_data_count) } static VRotate -init_vrotate(font_data, font_data_count, type, code_range, code_range_num) - FontData font_data; - int font_data_count; - int type; - CodeRange code_range; - int code_range_num; +init_vrotate( + FontData font_data, + int font_data_count, + int type, + CodeRange code_range, + int code_range_num) { VRotate vrotate; int i; @@ -136,13 +134,13 @@ init_vrotate(font_data, font_data_count, type, code_range, code_range_num) } static Bool -init_fontset(oc) - XOC oc; +init_fontset(XOC oc) { XOCGenericPart *gen; FontSet font_set; OMData data; int count; + int err = 0; count = XOM_GENERIC(oc->core.om)->data_num; data = XOM_GENERIC(oc->core.om)->data; @@ -161,16 +159,22 @@ init_fontset(oc) font_set->charset_list = data->charset_list; if((font_set->font_data = init_fontdata(data->font_data, - data->font_data_count)) == NULL) - goto err; + data->font_data_count)) == NULL){ + err += 1; + break; + } font_set->font_data_count = data->font_data_count; if((font_set->substitute = init_fontdata(data->substitute, - data->substitute_num)) == NULL) - goto err; + data->substitute_num)) == NULL){ + err += 1; + break; + } font_set->substitute_num = data->substitute_num; if((font_set->vmap = init_fontdata(data->vmap, - data->vmap_num)) == NULL) - goto err; + data->vmap_num)) == NULL){ + err += 1; + break; + } font_set->vmap_num = data->vmap_num; if(data->vrotate_type != VROTATE_NONE) { @@ -180,35 +184,37 @@ init_fontset(oc) data->font_data_count, data->vrotate_type, data->vrotate, - data->vrotate_num)) == NULL) - goto err; + data->vrotate_num)) == NULL){ + err += 1; + break; + } font_set->vrotate_num = data->font_data_count; } } - return True; -err: - if(font_set->font_data) - Xfree(font_set->font_data); - if(font_set->substitute) - Xfree(font_set->substitute); - if(font_set->vmap) - Xfree(font_set->vmap); - if(font_set->vrotate) - Xfree(font_set->vrotate); - if(font_set) - Xfree(font_set); - gen->font_set = (FontSet) NULL; - gen->font_set_num = 0; - return False; + if (err == 1){ + if(font_set->font_data) + Xfree(font_set->font_data); + if(font_set->substitute) + Xfree(font_set->substitute); + if(font_set->vmap) + Xfree(font_set->vmap); + if(font_set->vrotate) + Xfree(font_set->vrotate); + if(font_set) + Xfree(font_set); + gen->font_set = (FontSet) NULL; + gen->font_set_num = 0; + return False; + } else { + return True; + } } /* For VW/UDC end */ static char * -get_prop_name(dpy, fs) - Display *dpy; - XFontStruct *fs; +get_prop_name(Display *dpy, XFontStruct *fs) { unsigned long fp; @@ -219,9 +225,7 @@ get_prop_name(dpy, fs) } static FontData -check_charset(font_set, font_name) - FontSet font_set; - char *font_name; +check_charset(FontSet font_set, char *font_name) { FontData font_data; char *last; @@ -245,10 +249,7 @@ check_charset(font_set, font_name) } static int -check_fontname(oc, name, found_num) - XOC oc; - char *name; - int found_num; +check_fontname(XOC oc, char *name, int found_num) { Display *dpy = oc->core.om->core.display; XOCGenericPart *gen = XOC_GENERIC(oc); @@ -309,10 +310,7 @@ check_fontname(oc, name, found_num) /* For VW/UDC start */ static Bool -load_fontdata(oc, font_data, font_data_num) - XOC oc; - FontData font_data; - int font_data_num; +load_fontdata(XOC oc, FontData font_data, int font_data_num) { Display *dpy = oc->core.om->core.display; FontData fd = font_data; @@ -328,8 +326,7 @@ load_fontdata(oc, font_data, font_data_num) } static Bool -load_font(oc) - XOC oc; +load_font(XOC oc) { int i; XOCGenericPart *gen = XOC_GENERIC(oc); @@ -374,8 +371,7 @@ load_font(oc) /* For VW/UDC end */ static Bool -load_font_info(oc) - XOC oc; +load_font_info(XOC oc) { Display *dpy = oc->core.om->core.display; XOCGenericPart *gen = XOC_GENERIC(oc); @@ -403,10 +399,11 @@ load_font_info(oc) /* For Vertical Writing start */ static void -check_fontset_extents(overall, logical_ascent, logical_descent, font) - XCharStruct *overall; - int *logical_ascent, *logical_descent; - XFontStruct *font; +check_fontset_extents( + XCharStruct *overall, + int *logical_ascent, + int *logical_descent, + XFontStruct *font) { overall->lbearing = min(overall->lbearing, font->min_bounds.lbearing); 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 */ static void -set_fontset_extents(oc) - XOC oc; +set_fontset_extents(XOC oc) { XRectangle *ink = &oc->core.font_set_extents.max_ink_extent; XRectangle *logical = &oc->core.font_set_extents.max_logical_extent; @@ -495,8 +491,7 @@ set_fontset_extents(oc) } static Bool -init_core_part(oc) - XOC oc; +init_core_part(XOC oc) { XOCGenericPart *gen = XOC_GENERIC(oc); FontSet font_set; @@ -524,12 +519,20 @@ init_core_part(oc) return False; font_name_list = (char **) Xmalloc(sizeof(char *) * count); - if (font_name_list == NULL) - goto err; + if (font_name_list == NULL){ + if (font_name_list) + Xfree(font_name_list); + Xfree(font_struct_list); + return False; + } font_name_buf = (char *) Xmalloc(length); - if (font_name_buf == NULL) - goto err; + if (font_name_buf == NULL){ + 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.font_name_list = font_name_list; @@ -556,19 +559,10 @@ init_core_part(oc) set_fontset_extents(oc); return True; - -err: - if (font_name_list) - Xfree(font_name_list); - Xfree(font_struct_list); - - return False; } static char * -get_font_name(oc, pattern) - XOC oc; - char *pattern; +get_font_name(XOC oc, char *pattern) { char **list, *name; int count = 0; @@ -589,8 +583,7 @@ get_font_name(oc, pattern) /* For VW/UDC start*/ static char -*get_rotate_fontname(font_name) - char *font_name; +*get_rotate_fontname(char *font_name) { char *pattern = NULL, *ptr = NULL; char *fields[CHARSET_ENCODING_FIELD]; @@ -663,9 +656,7 @@ static char } static Bool -is_match_charset(font_data, font_name) - FontData font_data; - char *font_name; +is_match_charset(FontData font_data, char *font_name) { char *last; int length, name_len; @@ -684,10 +675,7 @@ is_match_charset(font_data, font_name) } static int -parse_all_name(oc, font_data, pattern) - XOC oc; - FontData font_data; - char *pattern; +parse_all_name(XOC oc, FontData font_data, char *pattern) { if(is_match_charset(font_data, pattern) != True) @@ -702,10 +690,7 @@ parse_all_name(oc, font_data, pattern) } static int -parse_omit_name(oc, font_data, pattern) - XOC oc; - FontData font_data; - char *pattern; +parse_omit_name(XOC oc, FontData font_data, char *pattern) { char *font_name = (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; static int -parse_fontdata(oc, font_data, font_data_count, name_list, name_list_count, - class) - XOC oc; - FontData font_data; - int font_data_count; - char **name_list; - int name_list_count; - ClassType class; +parse_fontdata( + XOC oc, + FontData font_data, + int font_data_count, + char **name_list, + int name_list_count, + ClassType class) { char **cur_name_list = name_list; char *font_name = (char *) NULL; @@ -866,11 +850,7 @@ parse_fontdata(oc, font_data, font_data_count, name_list, name_list_count, static int -parse_vw(oc, font_set, name_list, count) - XOC oc; - FontSet font_set; - char **name_list; - int count; +parse_vw(XOC oc, FontSet font_set, char **name_list, int count) { FontData vmap = font_set->vmap; VRotate vrotate = font_set->vrotate; @@ -929,8 +909,7 @@ parse_vw(oc, font_set, name_list, count) } static int -parse_fontname(oc) - XOC oc; +parse_fontname(XOC oc) { XOCGenericPart *gen = XOC_GENERIC(oc); FontSet font_set; @@ -957,17 +936,22 @@ parse_fontname(oc) font_set->font_data_count, name_list, count, C_PRIMARY); if(ret == -1) { - goto err; + falFreeStringList(name_list); + return -1; } else if(ret == True) { font_set->font_name = (char *)Xmalloc (strlen(font_set->font_data->xlfd_name) + 1); - if(font_set->font_name == (char *) NULL) - goto err; + if(font_set->font_name == (char *) NULL){ + falFreeStringList(name_list); + return -1; + } strcpy(font_set->font_name, font_set->font_data->xlfd_name); font_set->side = font_set->font_data->side; - if(parse_vw(oc, font_set, name_list, count) == -1) - goto err; + if(parse_vw(oc, font_set, name_list, count) == -1){ + falFreeStringList(name_list); + return -1; + } found_num++; /* The substitute font is serched, when the primary fonts */ @@ -992,7 +976,8 @@ parse_fontname(oc) font_set->substitute_num, name_list, count, C_SUBSTITUTE); if(ret == -1) { - goto err; + falFreeStringList(name_list); + return -1; } else if(ret == True) { for(i=0;isubstitute_num;i++){ if(font_set->substitute[i].xlfd_name != NULL){ @@ -1001,12 +986,16 @@ parse_fontname(oc) } font_set->font_name = (char *)Xmalloc (strlen(font_set->substitute[i].xlfd_name) + 1); - if(font_set->font_name == (char *) NULL) - goto err; + if(font_set->font_name == (char *) NULL){ + falFreeStringList(name_list); + return -1; + } strcpy(font_set->font_name,font_set->substitute[i].xlfd_name); font_set->side = font_set->substitute[i].side; - if(parse_vw(oc, font_set, name_list, count) == -1) - goto err; + if(parse_vw(oc, font_set, name_list, count) == -1){ + falFreeStringList(name_list); + return -1; + } found_num++; } } @@ -1015,7 +1004,8 @@ parse_fontname(oc) font_set->substitute_num, name_list, count, C_SUBSTITUTE); if(ret == -1) { - goto err; + falFreeStringList(name_list); + return -1; } else if(ret == True) { for(i=0;isubstitute_num;i++){ if(font_set->substitute[i].xlfd_name != NULL){ @@ -1024,12 +1014,17 @@ parse_fontname(oc) } font_set->font_name = (char *)Xmalloc (strlen(font_set->substitute[i].xlfd_name) + 1); - if(font_set->font_name == (char *) NULL) - goto err; + if(font_set->font_name == (char *) NULL){ + falFreeStringList(name_list); + return -1; + } + strcpy(font_set->font_name,font_set->substitute[i].xlfd_name); font_set->side = font_set->substitute[i].side; - if(parse_vw(oc, font_set, name_list, count) == -1) - goto err; + if(parse_vw(oc, font_set, name_list, count) == -1){ + falFreeStringList(name_list); + return -1; + } found_num++; } @@ -1037,8 +1032,10 @@ parse_fontname(oc) } base_name = (char *) Xmalloc(strlen(oc->core.base_name_list) + 1); - if (base_name == NULL) - goto err; + if (base_name == NULL){ + falFreeStringList(name_list); + return -1; + } strcpy(base_name, oc->core.base_name_list); oc->core.base_name_list = base_name; @@ -1046,18 +1043,12 @@ parse_fontname(oc) falFreeStringList(name_list); return found_num; - -err: - falFreeStringList(name_list); - - return -1; } /* For VW/UDC end*/ static Bool -set_missing_list(oc) - XOC oc; +set_missing_list(XOC oc) { XOCGenericPart *gen = XOC_GENERIC(oc); FontSet font_set; @@ -1140,8 +1131,7 @@ set_missing_list(oc) } static Bool -create_fontset(oc) - XOC oc; +create_fontset(XOC oc) { XOMGenericPart *gen = XOM_GENERIC(oc->core.om); int found_num; @@ -1175,10 +1165,7 @@ create_fontset(oc) /* For VW/UDC start */ static void -free_fontdataOC(dpy,font_data, font_data_count) - Display *dpy; - FontData font_data; - int font_data_count; +free_fontdataOC(Display *dpy, FontData font_data, int font_data_count) { for( ; font_data_count-- ; font_data++) { if(font_data->xlfd_name){ @@ -1208,9 +1195,7 @@ free_fontdataOC(dpy,font_data, font_data_count) } static void -destroy_fontdata(gen,dpy) - XOCGenericPart *gen ; - Display *dpy ; +destroy_fontdata(XOCGenericPart *gen, Display *dpy) { FontSet font_set = (FontSet) NULL; int font_set_num = 0; @@ -1252,8 +1237,7 @@ destroy_fontdata(gen,dpy) /* For VW/UDC end */ static void -destroy_oc(oc) - XOC oc; +destroy_oc(XOC oc) { Display *dpy = oc->core.om->core.display; XOCGenericPart *gen = XOC_GENERIC(oc); @@ -1287,21 +1271,11 @@ destroy_oc(oc) if (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); } static char * -set_oc_values(oc, args, num_args) - XOC oc; - XlcArgList args; - int num_args; +set_oc_values(XOC oc, XlcArgList args, int num_args) { if (oc->core.resources == NULL) return NULL; @@ -1311,10 +1285,7 @@ set_oc_values(oc, args, num_args) } static char * -get_oc_values(oc, args, num_args) - XOC oc; - XlcArgList args; - int num_args; +get_oc_values(XOC oc, XlcArgList args, int num_args) { if (oc->core.resources == NULL) return NULL; @@ -1385,10 +1356,7 @@ static XlcResource oc_resources[] = { }; static XOC -create_oc(om, args, num_args) - XOM om; - XlcArgList args; - int num_args; +create_oc(XOM om, XlcArgList args, int num_args) { XOC oc; XOMGenericPart *gen = XOM_GENERIC(om); @@ -1406,18 +1374,21 @@ create_oc(om, args, num_args) _fallcCompileResourceList(oc_resources, XlcNumber(oc_resources)); if (_fallcSetValues((XPointer) oc, oc_resources, XlcNumber(oc_resources), - args, num_args, XlcCreateMask | XlcDefaultMask)) - goto err; - - if (oc->core.base_name_list == NULL) - goto err; - + args, num_args, XlcCreateMask | XlcDefaultMask)){ + destroy_oc(oc); + return (XOC) NULL; + } + if (oc->core.base_name_list == NULL){ + destroy_oc(oc); + return (XOC) NULL; + } oc->core.resources = oc_resources; oc->core.num_resources = XlcNumber(oc_resources); - if (create_fontset(oc) == False) - goto err; - + if (create_fontset(oc) == False){ + destroy_oc(oc); + return (XOC) NULL; + } oc->methods = &oc_generic_methods; if (gen->object_name) { @@ -1432,17 +1403,10 @@ create_oc(om, args, num_args) } return oc; - -err: - destroy_oc(oc); - - return (XOC) NULL; } static void -free_fontdataOM(font_data, font_data_count) - FontData font_data; - int font_data_count; +free_fontdataOM(FontData font_data, int font_data_count) { for( ; font_data_count-- ; font_data++) { if(font_data->name){ @@ -1457,8 +1421,7 @@ free_fontdataOM(font_data, font_data_count) } static Status -close_om(om) - XOM om; +close_om(XOM om) { XOMGenericPart *gen = XOM_GENERIC(om); OMData data; @@ -1533,10 +1496,7 @@ close_om(om) } static char * -set_om_values(om, args, num_args) - XOM om; - XlcArgList args; - int num_args; +set_om_values(XOM om, XlcArgList args, int num_args) { if (om->core.resources == NULL) return NULL; @@ -1546,10 +1506,7 @@ set_om_values(om, args, num_args) } static char * -get_om_values(om, args, num_args) - XOM om; - XlcArgList args; - int num_args; +get_om_values(XOM om, XlcArgList args, int num_args) { if (om->core.resources == NULL) return NULL; @@ -1577,12 +1534,12 @@ static XlcResource om_resources[] = { }; static XOM -create_om(lcd, dpy, rdb, res_name, res_class) - XLCd lcd; - Display *dpy; - XrmDatabase rdb; - char *res_name; - char *res_class; +create_om( + XLCd lcd, + Display *dpy, + XrmDatabase rdb, + char *res_name, + char *res_class) { XOM om; @@ -1597,14 +1554,18 @@ create_om(lcd, dpy, rdb, res_name, res_class) om->core.rdb = rdb; if (res_name) { om->core.res_name = (char *) Xmalloc(strlen(res_name) + 1); - if (om->core.res_name == NULL) - goto err; + if (om->core.res_name == NULL){ + close_om(om); + return (XOM) NULL; + } strcpy(om->core.res_name, res_name); } if (res_class) { om->core.res_class = (char *) Xmalloc(strlen(res_class) + 1); - if (om->core.res_class == NULL) - goto err; + if (om->core.res_class == NULL){ + close_om(om); + return (XOM) NULL; + } 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); return om; - -err: - close_om(om); - - return (XOM) NULL; } static OMData -add_data(om) - XOM om; +add_data(XOM om) { XOMGenericPart *gen = XOM_GENERIC(om); OMData new; @@ -1649,9 +1604,7 @@ add_data(om) /* For VW/UDC */ FontData -falread_EncodingInfo(count,value) -int count; -char **value; +falread_EncodingInfo(int count, char **value) { FontData font_data,ret; char *buf, *bufptr,*scp; @@ -1694,11 +1647,11 @@ char **value; return(ret); } -static CodeRange read_vrotate(count,value,type,vrotate_num) -int count; -char **value; -int *type; -int *vrotate_num; +static CodeRange read_vrotate( +int count, +char **value, +int *type, +int *vrotate_num) { FontData font_data,ret; char *buf, *bufptr,*scp; @@ -1720,10 +1673,7 @@ int *vrotate_num; } static void -read_vw(lcd,font_set,num) -XLCd lcd; -OMData font_set; -int num; +read_vw(XLCd lcd, OMData font_set, int num) { char **value, buf[BUFSIZ], *bufptr; int count,i; @@ -1746,8 +1696,7 @@ int num; } /* VW/UDC end */ static Bool -init_om(om) - XOM om; +init_om(XOM om) { XLCd lcd = om->core.lcd; XOMGenericPart *gen = XOM_GENERIC(om); @@ -1905,17 +1854,8 @@ init_om(om) } XOM -#if NeedFunctionPrototypes _falomGenericOpenOM(XLCd lcd, Display *dpy, XrmDatabase rdb, - _Xconst char *res_name, _Xconst 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 + char *res_name, char *res_class) { XOM om; @@ -1923,20 +1863,16 @@ _falomGenericOpenOM(lcd, dpy, rdb, res_name, res_class) if (om == NULL) return (XOM) NULL; - if (init_om(om) == False) - goto err; + if (init_om(om) == False){ + close_om(om); + return (XOM) NULL; + } return om; - -err: - close_om(om); - - return (XOM) NULL; } Bool -_falInitOM(lcd) - XLCd lcd; +_falInitOM(XLCd lcd) { lcd->methods->open_om = _falomGenericOpenOM; diff --git a/cde/programs/dtudcfonted/libfal/_falomGeneric.h b/cde/programs/dtudcfonted/libfal/_falomGeneric.h index 0a27a418..71fa4984 100644 --- a/cde/programs/dtudcfonted/libfal/_falomGeneric.h +++ b/cde/programs/dtudcfonted/libfal/_falomGeneric.h @@ -170,24 +170,19 @@ typedef struct _XOCGenericRec { _XFUNCPROTOBEGIN extern XOM _falomGenericOpenOM( -#if NeedFunctionPrototypes XLCd /* lcd */, Display* /* dpy */, XrmDatabase /* rdb */, - _Xconst char* /* res_name */, - _Xconst char* /* res_class */ -#endif + char* /* res_name */, + char* /* res_class */ ); extern XlcConv _XomInitConverter( -#if NeedFunctionPrototypes XOC /* oc */, XOMTextType /* type */ -#endif ); extern int _XomConvert( -#if NeedFunctionPrototypes XOC /* oc */, XlcConv /* conv */, XPointer* /* from */, @@ -196,7 +191,6 @@ extern int _XomConvert( int* /* to_left */, XPointer* /* args */, int /* num_args */ -#endif ); _XFUNCPROTOEND diff --git a/cde/programs/dtudcfonted/libfal/_falrm.c b/cde/programs/dtudcfonted/libfal/_falrm.c index 38573d48..82e43c1a 100644 --- a/cde/programs/dtudcfonted/libfal/_falrm.c +++ b/cde/programs/dtudcfonted/libfal/_falrm.c @@ -86,17 +86,6 @@ from the X Consortium. #include "_falrmI.h" #include -#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 @@ -150,14 +139,13 @@ typedef unsigned long Signature; static XrmQuark XrmQString, XrmQANY; 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 */, XrmBindingList /* bindings */, XrmQuarkList /* quarks */, XrmRepresentation* /* type */, XrmValue* /* value */, XPointer /* closure */ -#endif ); typedef struct _VEntry { @@ -319,7 +307,7 @@ typedef unsigned char XrmBits; #define is_special(bits) ((bits) & (ENDOF|BSLASH)) /* parsing types */ -static XrmBits Const xrmtypes[256] = { +static XrmBits const xrmtypes[256] = { EOS,0,0,0,0,0,0,0, 0,SPACE,EOL,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. */ }; -void falrmInitialize() +void falrmInitialize(void) { XrmQString = falrmPermStringToQuark("String"); XrmQANY = falrmPermStringToQuark("?"); @@ -355,29 +343,19 @@ XrmDatabase falrmGetDatabase(display) return retval; } -void falrmSetDatabase(display, database) - Display *display; - XrmDatabase database; +void falrmSetDatabase(Display *display, XrmDatabase database) { LockDisplay(display); display->db = database; UnlockDisplay(display); } -#if NeedFunctionPrototypes -void falrmStringToQuarkList( - register _Xconst char *name, - register XrmQuarkList quarks) /* RETURN */ -#else -void falrmStringToQuarkList(name, quarks) - register char *name; - register XrmQuarkList quarks; /* RETURN */ -#endif +void falrmStringToQuarkList(const char *name, XrmQuarkList quarks)/*RETURN*/ { - register XrmBits bits; - register Signature sig = 0; - register char ch, *tname; - register int i = 0; + XrmBits bits; + Signature sig = 0; + char ch, *tname; + int i = 0; if (tname = (char *)name) { tname--; @@ -402,23 +380,16 @@ void falrmStringToQuarkList(name, quarks) *quarks = NULLQUARK; } -#if NeedFunctionPrototypes void falrmStringToBindingQuarkList( - register _Xconst char *name, - register XrmBindingList bindings, /* RETURN */ - register XrmQuarkList quarks) /* RETURN */ -#else -void falrmStringToBindingQuarkList(name, bindings, quarks) - register char *name; - register XrmBindingList bindings; /* RETURN */ - register XrmQuarkList quarks; /* RETURN */ -#endif + const char *name, + XrmBindingList bindings, /* RETURN */ + XrmQuarkList quarks) /* RETURN */ { - register XrmBits bits; - register Signature sig = 0; - register char ch, *tname; - register XrmBinding binding; - register int i = 0; + XrmBits bits; + Signature sig = 0; + char ch, *tname; + XrmBinding binding; + int i = 0; if (tname = (char *)name) { tname--; @@ -453,9 +424,7 @@ void falrmStringToBindingQuarkList(name, bindings, quarks) #ifdef DEBUG -static void PrintQuarkList(quarks, stream) - XrmQuarkList quarks; - FILE *stream; +static void PrintQuarkList(XrmQuarkList quarks, FILE *stream) { Bool firstNameSeen; @@ -471,29 +440,24 @@ static void PrintQuarkList(quarks, stream) #endif /* DEBUG */ /*ARGSUSED*/ -static void mbnoop(state) - XPointer state; +static void mbnoop(XPointer state) { } /*ARGSUSED*/ -static char mbchar(state, str, lenp) - XPointer state; - char *str; - int *lenp; +static char mbchar(XPointer state, char *str, int *lenp) { *lenp = 1; return *str; } /*ARGSUSED*/ -static char *lcname(state) - XPointer state; +static char *lcname(XPointer state) { return "C"; } -static RConst XrmMethodsRec mb_methods = { +static const XrmMethodsRec mb_methods = { mbnoop, mbchar, mbnoop, @@ -501,9 +465,9 @@ static RConst XrmMethodsRec mb_methods = { mbnoop }; -static XrmDatabase NewDatabase() +static XrmDatabase NewDatabase(void) { - register XrmDatabase db; + XrmDatabase db; db = (XrmDatabase) Xmalloc(sizeof(XrmHashBucketRec)); if (db) { @@ -517,17 +481,15 @@ static XrmDatabase NewDatabase() } /* 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) - LTable ftable; - register LTable ttable; +static void MoveValues(LTable ftable, LTable ttable) { - register VEntry fentry, nfentry; - register VEntry *prev; - register VEntry *bucket; - register VEntry tentry; - register int i; + VEntry fentry, nfentry; + VEntry *prev; + VEntry *bucket; + VEntry tentry; + int i; for (i = ftable->table.mask, bucket = ftable->buckets; i >= 0; i--) { 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. * ttable is quaranteed empty to start with. */ -static void MoveTables(ftable, ttable) - NTable ftable; - register NTable ttable; +static void MoveTables(NTable ftable, NTable ttable) { - register NTable fentry, nfentry; - register NTable *prev; - register NTable *bucket; - register NTable tentry; - register int i; + NTable fentry, nfentry; + NTable *prev; + NTable *bucket; + NTable tentry; + int i; for (i = ftable->mask, bucket = NodeBuckets(ftable); i >= 0; i--) { for (fentry = *bucket++; fentry; fentry = nfentry) { @@ -571,11 +531,10 @@ static void MoveTables(ftable, ttable) } /* grow the table, based on current number of entries */ -static void GrowTable(prev) - NTable *prev; +static void GrowTable(NTable *prev) { - register NTable table; - register int i; + NTable table; + int i; table = *prev; i = table->mask; @@ -585,7 +544,7 @@ static void GrowTable(prev) i = (i << 1) + 1; i++; /* i is now the new size */ if (table->leaf) { - register LTable ltable; + LTable ltable; LTableRec otable; ltable = (LTable)table; @@ -600,7 +559,7 @@ static void GrowTable(prev) bzero((char *)ltable->buckets, i * sizeof(VEntry)); MoveValues(&otable, ltable); } else { - register NTable ntable; + NTable ntable; ntable = (NTable)Xmalloc(sizeof(NTableRec) + i * sizeof(NTable)); if (!ntable) @@ -614,17 +573,14 @@ static void GrowTable(prev) } /* merge values from ftable into *pprev, destroy ftable in the process */ -static void MergeValues(ftable, pprev, override) - LTable ftable; - NTable *pprev; - Bool override; +static void MergeValues(LTable ftable, NTable *pprev, Bool override) { - register VEntry fentry, tentry; - register VEntry *prev; - register LTable ttable; + VEntry fentry, tentry; + VEntry *prev; + LTable ttable; VEntry *bucket; int i; - register XrmQuark q; + XrmQuark q; ttable = (LTable)*pprev; 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 */ -static void MergeTables(ftable, pprev, override) - NTable ftable; - NTable *pprev; - Bool override; +static void MergeTables(NTable ftable, NTable *pprev, Bool override) { - register NTable fentry, tentry; + NTable fentry, tentry; NTable nfentry; - register NTable *prev; - register NTable ttable; + NTable *prev; + NTable ttable; NTable *bucket; int i; - register XrmQuark q; + XrmQuark q; ttable = *pprev; if (ftable->hasloose) @@ -767,12 +720,10 @@ static void MergeTables(ftable, pprev, override) GROW(pprev); } -void falrmCombineDatabase(from, into, override) - XrmDatabase from, *into; - Bool override; +void falrmCombineDatabase(XrmDatabase from, XrmDatabase *into, Bool override) { - register NTable *prev; - register NTable ftable, ttable, nftable; + NTable *prev; + NTable ftable, ttable, nftable; if (!*into) { *into = from; @@ -816,25 +767,24 @@ void falrmCombineDatabase(from, into, override) } } -void falrmMergeDatabases(from, into) - XrmDatabase from, *into; +void falrmMergeDatabases(XrmDatabase from, XrmDatabase *into) { falrmCombineDatabase(from, into, True); } /* store a value in the database, overriding any existing entry */ -static void PutEntry(db, bindings, quarks, type, value) - XrmDatabase db; - XrmBindingList bindings; - XrmQuarkList quarks; - XrmRepresentation type; - XrmValuePtr value; +static void PutEntry( + XrmDatabase db, + XrmBindingList bindings, + XrmQuarkList quarks, + XrmRepresentation type, + XrmValuePtr value) { - register NTable *pprev, *prev; - register NTable table; - register XrmQuark q; - register VEntry *vprev; - register VEntry entry; + NTable *pprev, *prev; + NTable table; + XrmQuark q; + VEntry *vprev; + VEntry entry; NTable *nprev, *firstpprev; #define NEWTABLE(q,i) \ @@ -1011,12 +961,12 @@ static void PutEntry(db, bindings, quarks, type, value) #undef NEWTABLE } -void falrmQPutResource(pdb, bindings, quarks, type, value) - XrmDatabase *pdb; - XrmBindingList bindings; - XrmQuarkList quarks; - XrmRepresentation type; - XrmValuePtr value; +void falrmQPutResource( + XrmDatabase *pdb, + XrmBindingList bindings, + XrmQuarkList quarks, + XrmRepresentation type, + XrmValuePtr value) { if (!*pdb) *pdb = NewDatabase(); _XLockMutex(&(*pdb)->linfo); @@ -1024,19 +974,11 @@ void falrmQPutResource(pdb, bindings, quarks, type, value) _XUnlockMutex(&(*pdb)->linfo); } -#if NeedFunctionPrototypes void falrmPutResource( XrmDatabase *pdb, - _Xconst char *specifier, - _Xconst char *type, + const char *specifier, + const char *type, XrmValuePtr value) -#else -void falrmPutResource(pdb, specifier, type, value) - XrmDatabase *pdb; - char *specifier; - char *type; - XrmValuePtr value; -#endif { XrmBinding bindings[MAXDBDEPTH+1]; XrmQuark quarks[MAXDBDEPTH+1]; @@ -1048,19 +990,11 @@ void falrmPutResource(pdb, specifier, type, value) _XUnlockMutex(&(*pdb)->linfo); } -#if NeedFunctionPrototypes void falrmQPutStringResource( XrmDatabase *pdb, XrmBindingList bindings, XrmQuarkList quarks, - _Xconst char *str) -#else -void falrmQPutStringResource(pdb, bindings, quarks, str) - XrmDatabase *pdb; - XrmBindingList bindings; - XrmQuarkList quarks; - char *str; -#endif + const char *str) { XrmValue value; @@ -1093,20 +1027,20 @@ void falrmQPutStringResource(pdb, bindings, quarks, str) static void GetIncludeFile(); -static void GetDatabase(db, str, filename, doall) - XrmDatabase db; - register char *str; - char *filename; - Bool doall; +static void GetDatabase( + XrmDatabase db, + char *str, + char *filename, + Bool doall) { - register char *ptr; - register XrmBits bits = 0; - register char c; + char *ptr; + XrmBits bits = 0; + char c; int len; - register Signature sig; - register char *ptr_max; - register XrmQuarkList t_quarks; - register XrmBindingList t_bindings; + Signature sig; + char *ptr_max; + XrmQuarkList t_quarks; + XrmBindingList t_bindings; int alloc_chars = BUFSIZ; char buffer[BUFSIZ], *value_str; @@ -1487,17 +1421,10 @@ static void GetDatabase(db, str, filename, doall) (*db->methods->mbfinish)(db->mbstate); } -#if NeedFunctionPrototypes void falrmPutStringResource( XrmDatabase *pdb, - _Xconst char*specifier, - _Xconst char*str) -#else -void falrmPutStringResource(pdb, specifier, str) - XrmDatabase *pdb; - char *specifier; - char *str; -#endif + const char*specifier, + const char*str) { XrmValue value; XrmBinding bindings[MAXDBDEPTH+1]; @@ -1513,15 +1440,7 @@ void falrmPutStringResource(pdb, specifier, str) } -#if NeedFunctionPrototypes -void falrmPutLineResource( - XrmDatabase *pdb, - _Xconst char*line) -#else -void falrmPutLineResource(pdb, line) - XrmDatabase *pdb; - char *line; -#endif +void falrmPutLineResource(XrmDatabase *pdb, char *line) { if (!*pdb) *pdb = NewDatabase(); _XLockMutex(&(*pdb)->linfo); @@ -1529,13 +1448,7 @@ void falrmPutLineResource(pdb, line) _XUnlockMutex(&(*pdb)->linfo); } -#if NeedFunctionPrototypes -XrmDatabase falrmGetStringDatabase( - _Xconst char *data) -#else -XrmDatabase falrmGetStringDatabase(data) - char *data; -#endif +XrmDatabase falrmGetStringDatabase(char *data) { XrmDatabase db; @@ -1553,10 +1466,9 @@ XrmDatabase falrmGetStringDatabase(data) */ static char * -ReadInFile(filename) -char * filename; +ReadInFile(char *filename) { - register int fd, size; + int fd, size; char * filebuf; if ( (fd = OpenFile(filename)) == -1 ) @@ -1582,11 +1494,11 @@ char * filename; } static void -GetIncludeFile(db, base, fname, fnamelen) - XrmDatabase db; - char *base; - char *fname; - int fnamelen; +GetIncludeFile( + XrmDatabase db, + char *base, + char *fname, + int fnamelen) { int len; char *str; @@ -1611,13 +1523,7 @@ GetIncludeFile(db, base, fname, fnamelen) Xfree(str); } -#if NeedFunctionPrototypes -XrmDatabase falrmGetFileDatabase( - _Xconst char *filename) -#else -XrmDatabase falrmGetFileDatabase(filename) - char *filename; -#endif +XrmDatabase falrmGetFileDatabase(char *filename) { XrmDatabase db; char *str; @@ -1633,17 +1539,10 @@ XrmDatabase falrmGetFileDatabase(filename) return db; } -#if NeedFunctionPrototypes Status falrmCombineFileDatabase( - _Xconst char *filename, + char *filename, XrmDatabase *target, Bool override) -#else -Status falrmCombineFileDatabase(filename, target, override) - char *filename; - XrmDatabase *target; - Bool override; -#endif { XrmDatabase db; char *str; @@ -1669,16 +1568,16 @@ Status falrmCombineFileDatabase(filename, target, override) * stop if user proc returns True. level is current depth in database. */ /*ARGSUSED*/ -static Bool EnumLTable(table, names, classes, level, closure) - LTable table; - XrmNameList names; - XrmClassList classes; - register int level; - register EClosure closure; +static Bool EnumLTable( + LTable table, + XrmNameList names, + XrmClassList classes, + int level, + EClosure closure) { - register VEntry *bucket; - register int i; - register VEntry entry; + VEntry *bucket; + int i; + VEntry entry; XrmValue value; XrmRepresentation type; Bool tightOk; @@ -1715,14 +1614,11 @@ static Bool EnumLTable(table, names, classes, level, closure) return False; } -static Bool EnumAllNTable(table, level, closure) - NTable table; - register int level; - register EClosure closure; +static Bool EnumAllNTable(NTable table, int level, EClosure closure) { - register NTable *bucket; - register int i; - register NTable entry; + NTable *bucket; + int i; + NTable entry; XrmQuark empty = NULLQUARK; if (level >= MAXDBDEPTH) @@ -1749,16 +1645,16 @@ static Bool EnumAllNTable(table, level, closure) /* recurse on every table in the table, arbitrary order. * stop if user proc returns True. level is current depth in database. */ -static Bool EnumNTable(table, names, classes, level, closure) - NTable table; - XrmNameList names; - XrmClassList classes; - register int level; - register EClosure closure; +static Bool EnumNTable( + NTable table, + XrmNameList names, + XrmClassList classes, + int level, + EClosure closure) { - register NTable entry; - register XrmQuark q; - register unsigned int leaf; + NTable entry; + XrmQuark q; + unsigned int leaf; Bool (*get)(); 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. * stop if the proc returns True. */ -Bool falrmEnumerateDatabase(db, names, classes, mode, proc, closure) - XrmDatabase db; - XrmNameList names; - XrmClassList classes; - int mode; - DBEnumProc proc; - XPointer closure; +Bool falrmEnumerateDatabase( + XrmDatabase db, + XrmNameList names, + XrmClassList classes, + int mode, + DBEnumProc proc, + XPointer closure) { XrmBinding bindings[MAXDBDEPTH+2]; XrmQuark quarks[MAXDBDEPTH+2]; - register NTable table; + NTable table; EClosureRec eclosure; Bool retval = False; @@ -1943,10 +1839,10 @@ Bool falrmEnumerateDatabase(db, names, classes, mode, proc, closure) return retval; } -static void PrintBindingQuarkList(bindings, quarks, stream) - XrmBindingList bindings; - XrmQuarkList quarks; - FILE *stream; +static void PrintBindingQuarkList( + XrmBindingList bindings, + XrmQuarkList quarks, + FILE *stream) { Bool firstNameSeen; @@ -1963,18 +1859,18 @@ static void PrintBindingQuarkList(bindings, quarks, stream) /* output out the entry in correct file syntax */ /*ARGSUSED*/ -static Bool DumpEntry(db, bindings, quarks, type, value, data) - XrmDatabase *db; - XrmBindingList bindings; - XrmQuarkList quarks; - XrmRepresentation *type; - XrmValuePtr value; - XPointer data; +static Bool DumpEntry( + XrmDatabase *db, + XrmBindingList bindings, + XrmQuarkList quarks, + XrmRepresentation *type, + XrmValuePtr value, + XPointer data) { FILE *stream = (FILE *)data; - register unsigned int i; - register char *s; - register char c; + unsigned int i; + char *s; + char c; if (*type != XrmQString) (void) putc('!', stream); @@ -2011,9 +1907,7 @@ static Bool DumpEntry(db, bindings, quarks, type, value, data) #ifdef DEBUG -void falPrintTable(table, file) - NTable table; - FILE *file; +void falPrintTable(NTable table, FILE *file) { XrmBinding bindings[MAXDBDEPTH+1]; XrmQuark quarks[MAXDBDEPTH+1]; @@ -2034,15 +1928,7 @@ void falPrintTable(table, file) #endif /* DEBUG */ -#if NeedFunctionPrototypes -void falrmPutFileDatabase( - XrmDatabase db, - _Xconst char *fileName) -#else -void falrmPutFileDatabase(db, fileName) - XrmDatabase db; - char *fileName; -#endif +void falrmPutFileDatabase(XrmDatabase db, const char *fileName) { FILE *file; 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 */ /*ARGSUSED*/ -static Bool AppendLEntry(table, names, classes, closure) - LTable table; - XrmNameList names; - XrmClassList classes; - register SClosure closure; +static Bool AppendLEntry( + LTable table, + XrmNameList names, + XrmClassList classes, + SClosure closure) { /* check for duplicate */ 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 */ /*ARGSUSED*/ -static Bool AppendLooseLEntry(table, names, classes, closure) - LTable table; - XrmNameList names; - XrmClassList classes; - register SClosure closure; +static Bool AppendLooseLEntry( + LTable table, + XrmNameList names, + XrmClassList classes, + SClosure closure) { /* check for duplicate */ 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 */ -static Bool SearchNEntry(table, names, classes, closure) - NTable table; - XrmNameList names; - XrmClassList classes; - SClosure closure; +static Bool SearchNEntry( + NTable table, + XrmNameList names, + XrmClassList classes, + SClosure closure) { - register NTable entry; - register XrmQuark q; - register unsigned int leaf; + NTable entry; + XrmQuark q; + unsigned int leaf; Bool (*get)(); if (names[1]) { @@ -2204,14 +2090,14 @@ static Bool SearchNEntry(table, names, classes, closure) return False; } -Bool falrmQGetSearchList(db, names, classes, searchList, listLength) - XrmDatabase db; - XrmNameList names; - XrmClassList classes; - XrmSearchList searchList; /* RETURN */ - int listLength; +Bool falrmQGetSearchList( + XrmDatabase db, + XrmNameList names, + XrmClassList classes, + XrmSearchList searchList, /* RETURN */ + int listLength) { - register NTable table; + NTable table; SClosureRec closure; if (listLength <= 0) @@ -2249,16 +2135,16 @@ Bool falrmQGetSearchList(db, names, classes, searchList, listLength) return True; } -Bool falrmQGetSearchResource(searchList, name, class, pType, pValue) - XrmSearchList searchList; - register XrmName name; - register XrmClass class; - XrmRepresentation *pType; /* RETURN */ - XrmValue *pValue; /* RETURN */ +Bool falrmQGetSearchResource( + XrmSearchList searchList, + XrmName name, + XrmClass class, + XrmRepresentation *pType, /* RETURN */ + XrmValue *pValue) /* RETURN */ { - register LTable *list; - register LTable table; - register VEntry entry; + LTable *list; + LTable table; + VEntry entry; int flags; /* find tight or loose entry */ @@ -2338,14 +2224,14 @@ Bool falrmQGetSearchResource(searchList, name, class, pType, pValue) } /* look for a tight/loose value */ -static Bool GetVEntry(table, names, classes, closure) - LTable table; - XrmNameList names; - XrmClassList classes; - VClosure closure; +static Bool GetVEntry( + LTable table, + XrmNameList names, + XrmClassList classes, + VClosure closure) { - register VEntry entry; - register XrmQuark q; + VEntry entry; + XrmQuark q; /* try name first */ q = *names; @@ -2373,14 +2259,14 @@ static Bool GetVEntry(table, names, classes, closure) } /* look for a loose value */ -static Bool GetLooseVEntry(table, names, classes, closure) - LTable table; - XrmNameList names; - XrmClassList classes; - VClosure closure; +static Bool GetLooseVEntry( + LTable table, + XrmNameList names, + XrmClassList classes, + VClosure closure) { - register VEntry entry; - register XrmQuark q; + VEntry entry; + XrmQuark q; #define VLOOSE(ename) \ q = ename; \ @@ -2415,15 +2301,15 @@ static Bool GetLooseVEntry(table, names, classes, closure) } /* recursive search for a value */ -static Bool GetNEntry(table, names, classes, closure) - NTable table; - XrmNameList names; - XrmClassList classes; - VClosure closure; +static Bool GetNEntry( + NTable table, + XrmNameList names, + XrmClassList classes, + VClosure closure) { - register NTable entry; - register XrmQuark q; - register unsigned int leaf; + NTable entry; + XrmQuark q; + unsigned int leaf; Bool (*get)(); NTable otable; @@ -2483,14 +2369,14 @@ static Bool GetNEntry(table, names, classes, closure) return False; } -Bool falrmQGetResource(db, names, classes, pType, pValue) - XrmDatabase db; - XrmNameList names; - XrmClassList classes; - XrmRepresentation *pType; /* RETURN */ - XrmValuePtr pValue; /* RETURN */ +Bool falrmQGetResource( + XrmDatabase db, + XrmNameList names, + XrmClassList classes, + XrmRepresentation *pType, /* RETURN */ + XrmValuePtr pValue) /* RETURN */ { - register NTable table; + NTable table; VClosureRec closure; if (db && *names) { @@ -2525,21 +2411,12 @@ Bool falrmQGetResource(db, names, classes, pType, pValue) return False; } -#if NeedFunctionPrototypes -Bool falrmGetResource(db, name_str, class_str, pType_str, pValue) - XrmDatabase db; - _Xconst char *name_str; - _Xconst char *class_str; - XrmString *pType_str; /* 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 +Bool falrmGetResource( + XrmDatabase db, + const char *name_str, + const char *class_str, + XrmString *pType_str, /* RETURN */ + XrmValuePtr pValue) /* RETURN */ { XrmName names[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 */ -static void DestroyLTable(table) - LTable table; +static void DestroyLTable(LTable table) { - register int i; - register VEntry *buckets; - register VEntry entry, next; + int i; + VEntry *buckets; + VEntry entry, next; buckets = table->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 */ -static void DestroyNTable(table) - NTable table; +static void DestroyNTable(NTable table) { - register int i; - register NTable *buckets; - register NTable entry, next; + int i; + NTable *buckets; + NTable entry, next; buckets = NodeBuckets(table); for (i = table->mask; i >= 0; i--, buckets++) { @@ -2593,8 +2468,7 @@ static void DestroyNTable(table) Xfree((char *)table); } -char *falrmLocaleOfDatabase(db) - XrmDatabase db; +char *falrmLocaleOfDatabase(XrmDatabase db) { char* retval; _XLockMutex(&db->linfo); @@ -2603,10 +2477,9 @@ char *falrmLocaleOfDatabase(db) return retval; } -void falrmDestroyDatabase(db) - XrmDatabase db; +void falrmDestroyDatabase(XrmDatabase db) { - register NTable table, next; + NTable table, next; if (db) { _XLockMutex(&db->linfo); diff --git a/cde/programs/dtudcfonted/libfal/_faludcInf.c b/cde/programs/dtudcfonted/libfal/_faludcInf.c index 349cab28..9c03ab32 100644 --- a/cde/programs/dtudcfonted/libfal/_faludcInf.c +++ b/cde/programs/dtudcfonted/libfal/_faludcInf.c @@ -66,9 +66,7 @@ typedef struct _FalGlyphRegion { /* * "code" no jyoui "i" byte me wo "unsigned char" toshite kaesu. */ -static unsigned char getbyte(code,i) -unsigned long code; -int i; +static unsigned char getbyte(unsigned long code, int i) { unsigned long byteL; unsigned char byte; @@ -83,11 +81,11 @@ int i; charset_str : JISX0208.1983-0 */ -fal_get_codeset(locale,charset_str,codeset,num_codeset) -char *locale; -char *charset_str; -int **codeset; -int *num_codeset; +fal_get_codeset( +char *locale, +char *charset_str, +int **codeset, +int *num_codeset) { XLCdRec lcdrec; XLCd lcd; @@ -164,9 +162,7 @@ int *num_codeset; return 0; } -static Bool gi_to_vgi(gi,vgi,scope) -unsigned long gi,*vgi; -FontScope scope; +static Bool gi_to_vgi(unsigned long gi, unsigned long *vgi, FontScope scope) { if(scope->shift_direction == (unsigned long)'+'){ gi -= scope->shift; @@ -180,9 +176,7 @@ FontScope scope; return(False); } -static void shift_area(udc,scope) -FalGlyphRegion *udc; -FontScope scope; +static void shift_area(FalGlyphRegion *udc, FontScope scope) { if(scope->shift_direction == (unsigned long)'+'){ udc->start += scope->shift; @@ -199,12 +193,12 @@ FontScope scope; locale : ja_JP charset_str : JISX0208.1983-0 */ -FalGetUDCGIArea(locale,codeset,charset_str,gr,num_gr) -char *locale; -int codeset; -char *charset_str; -FalGlyphRegion **gr; -int *num_gr; +FalGetUDCGIArea( +char *locale, +int codeset, +char *charset_str, +FalGlyphRegion **gr, +int *num_gr) { XLCdRec lcdrec; XLCd lcd; @@ -302,14 +296,14 @@ int *num_gr; * */ -int fal_gi_to_vgi(lcd,locale,charset_str,codeset,gi,vgi,charsetname) -XLCd lcd; -char *locale; -char *charset_str; -int codeset; -unsigned long gi; -unsigned long *vgi; -char *charsetname; +int fal_gi_to_vgi( +XLCd lcd, +char *locale, +char *charset_str, +int codeset, +unsigned long gi, +unsigned long *vgi, +char *charsetname) { FalGlyphRegion *udc; int num = 0,count,num_ret=0; @@ -346,9 +340,7 @@ char *charsetname; return(True); } -Bool falnon_standard(lcd,charset) -XLCd lcd; -XlcCharSet charset; +Bool falnon_standard(XLCd lcd, XlcCharSet charset) { char buf[256]; int count,i; @@ -371,10 +363,7 @@ XlcCharSet charset; } void -falmake_none_standard(from,charset,src) -char *from; -XlcCharSet charset; -char *src; +falmake_none_standard(char *from, XlcCharSet charset, char *src) { int name_len,seq_len,i; name_len = 2 + strlen(charset->encoding_name) + 1; @@ -387,12 +376,12 @@ char *src; strcpy(&from[seq_len + name_len],src); } int -fal_glyph_to_code(locale,charset_str,codeset,glyph_index,codepoint) -char *locale; -char *charset_str; -int codeset; -unsigned long glyph_index; -unsigned long *codepoint; +fal_glyph_to_code( +char *locale, +char *charset_str, +int codeset, +unsigned long glyph_index, +unsigned long *codepoint) { XLCd lcd; unsigned char *from; int from_left; @@ -466,12 +455,12 @@ typedef struct _FalCodeRegion { } FalCodeRegion ; int -FalGetUDCCPArea(locale,codeset,charset_str,cr,num_cr) -char *locale; -int codeset; -char *charset_str; -FalCodeRegion **cr; -int *num_cr; +FalGetUDCCPArea( +char *locale, +int codeset, +char *charset_str, +FalCodeRegion **cr, +int *num_cr) { int i,num_gr,ret; FalGlyphRegion *gr; @@ -547,9 +536,7 @@ typedef struct _FalGIInf { * * */ -static Bool vgi_to_gi(gi,vgi,scope) -unsigned long *gi,vgi; -FontScope scope; +static Bool vgi_to_gi(unsigned long *gi, unsigned long vgi, FontScope scope) { if(vgi >= scope->start && vgi <= scope->end){ if(scope->shift_direction == (unsigned long)'+'){ @@ -566,13 +553,13 @@ FontScope scope; * */ static Bool -fal_vgi_to_gi(lcd,locale,vglyph,glyph,charset,charsetname) -XLCd lcd; -char *locale; -unsigned long vglyph; -unsigned long *glyph; -XlcCharSet charset; -char *charsetname; +fal_vgi_to_gi( +XLCd lcd, +char *locale, +unsigned long vglyph, +unsigned long *glyph, +XlcCharSet charset, +char *charsetname) { int num = 0,count,num_ret=0; int i,j,k; @@ -620,11 +607,11 @@ char *charsetname; return(True); } int -fal_code_to_glyph(locale,codepoint,gi,num_gi) -char *locale; -unsigned long codepoint; -FalGIInf **gi; -int *num_gi; +fal_code_to_glyph( +char *locale, +unsigned long codepoint, +FalGIInf **gi, +int *num_gi) { XLCd lcd; unsigned char *from; int from_left; diff --git a/cde/programs/dtudcfonted/libfal/_falutil.h b/cde/programs/dtudcfonted/libfal/_falutil.h index 5bc2c3ed..e8e68a99 100644 --- a/cde/programs/dtudcfonted/libfal/_falutil.h +++ b/cde/programs/dtudcfonted/libfal/_falutil.h @@ -349,406 +349,307 @@ _XFUNCPROTOBEGIN /* The following declarations are alphabetized. */ extern XClassHint *XAllocClassHint ( -#if NeedFunctionPrototypes void -#endif ); extern XIconSize *XAllocIconSize ( -#if NeedFunctionPrototypes void -#endif ); extern XSizeHints *XAllocSizeHints ( -#if NeedFunctionPrototypes void -#endif ); extern XStandardColormap *XAllocStandardColormap ( -#if NeedFunctionPrototypes void -#endif ); extern XWMHints *XAllocWMHints ( -#if NeedFunctionPrototypes void -#endif ); extern XClipBox( -#if NeedFunctionPrototypes Region /* r */, XRectangle* /* rect_return */ -#endif ); extern Region XCreateRegion( -#if NeedFunctionPrototypes void -#endif ); extern char *falDefaultString( -#if NeedFunctionPrototypes void -#endif ); extern int XDeleteContext( -#if NeedFunctionPrototypes Display* /* display */, XID /* rid */, XContext /* context */ -#endif ); extern XDestroyRegion( -#if NeedFunctionPrototypes Region /* r */ -#endif ); extern XEmptyRegion( -#if NeedFunctionPrototypes Region /* r */ -#endif ); extern XEqualRegion( -#if NeedFunctionPrototypes Region /* r1 */, Region /* r2 */ -#endif ); extern int XFindContext( -#if NeedFunctionPrototypes Display* /* display */, XID /* rid */, XContext /* context */, XPointer* /* data_return */ -#endif ); extern Status XGetClassHint( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XClassHint* /* class_hints_return */ -#endif ); extern Status XGetIconSizes( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XIconSize** /* size_list_return */, int* /* count_return */ -#endif ); extern Status XGetNormalHints( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XSizeHints* /* hints_return */ -#endif ); extern Status XGetRGBColormaps( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XStandardColormap** /* stdcmap_return */, int* /* count_return */, Atom /* property */ -#endif ); extern Status XGetSizeHints( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XSizeHints* /* hints_return */, Atom /* property */ -#endif ); extern Status XGetStandardColormap( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XStandardColormap* /* colormap_return */, Atom /* property */ -#endif ); extern Status XGetTextProperty( -#if NeedFunctionPrototypes Display* /* display */, Window /* window */, XTextProperty* /* text_prop_return */, Atom /* property */ -#endif ); extern XVisualInfo *XGetVisualInfo( -#if NeedFunctionPrototypes Display* /* display */, long /* vinfo_mask */, XVisualInfo* /* vinfo_template */, int* /* nitems_return */ -#endif ); extern Status XGetWMClientMachine( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XTextProperty* /* text_prop_return */ -#endif ); extern XWMHints *XGetWMHints( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */ -#endif ); extern Status XGetWMIconName( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XTextProperty* /* text_prop_return */ -#endif ); extern Status XGetWMName( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XTextProperty* /* text_prop_return */ -#endif ); extern Status XGetWMNormalHints( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XSizeHints* /* hints_return */, long* /* supplied_return */ -#endif ); extern Status XGetWMSizeHints( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XSizeHints* /* hints_return */, long* /* supplied_return */, Atom /* property */ -#endif ); extern Status XGetZoomHints( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XSizeHints* /* zhints_return */ -#endif ); extern XIntersectRegion( -#if NeedFunctionPrototypes Region /* sra */, Region /* srb */, Region /* dr_return */ -#endif ); extern void XConvertCase( -#if NeedFunctionPrototypes KeySym /* sym */, KeySym* /* lower */, KeySym* /* upper */ -#endif ); extern int XLookupString( -#if NeedFunctionPrototypes XKeyEvent* /* event_struct */, char* /* buffer_return */, int /* bytes_buffer */, KeySym* /* keysym_return */, XComposeStatus* /* status_in_out */ -#endif ); extern Status XMatchVisualInfo( -#if NeedFunctionPrototypes Display* /* display */, int /* screen */, int /* depth */, int /* class */, XVisualInfo* /* vinfo_return */ -#endif ); extern XOffsetRegion( -#if NeedFunctionPrototypes Region /* r */, int /* dx */, int /* dy */ -#endif ); extern Bool XPointInRegion( -#if NeedFunctionPrototypes Region /* r */, int /* x */, int /* y */ -#endif ); extern Region XPolygonRegion( -#if NeedFunctionPrototypes XPoint* /* points */, int /* n */, int /* fill_rule */ -#endif ); extern int XRectInRegion( -#if NeedFunctionPrototypes Region /* r */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */ -#endif ); extern int XSaveContext( -#if NeedFunctionPrototypes Display* /* display */, XID /* rid */, XContext /* context */, - _Xconst char* /* data */ -#endif + const char* /* data */ ); extern XSetClassHint( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XClassHint* /* class_hints */ -#endif ); extern XSetIconSizes( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XIconSize* /* size_list */, int /* count */ -#endif ); extern XSetNormalHints( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XSizeHints* /* hints */ -#endif ); extern void XSetRGBColormaps( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XStandardColormap* /* stdcmaps */, int /* count */, Atom /* property */ -#endif ); extern XSetSizeHints( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XSizeHints* /* hints */, Atom /* property */ -#endif ); extern XSetStandardProperties( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, - _Xconst char* /* window_name */, - _Xconst char* /* icon_name */, + const char* /* window_name */, + const char* /* icon_name */, Pixmap /* icon_pixmap */, char** /* argv */, int /* argc */, XSizeHints* /* hints */ -#endif ); extern void XSetTextProperty( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XTextProperty* /* text_prop */, Atom /* property */ -#endif ); extern void XSetWMClientMachine( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XTextProperty* /* text_prop */ -#endif ); extern XSetWMHints( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XWMHints* /* wm_hints */ -#endif ); extern void XSetWMIconName( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XTextProperty* /* text_prop */ -#endif ); extern void XSetWMName( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XTextProperty* /* text_prop */ -#endif ); extern void XSetWMNormalHints( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XSizeHints* /* hints */ -#endif ); extern void XSetWMProperties( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XTextProperty* /* window_name */, @@ -758,155 +659,121 @@ extern void XSetWMProperties( XSizeHints* /* normal_hints */, XWMHints* /* wm_hints */, XClassHint* /* class_hints */ -#endif ); extern void XmbSetWMProperties( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, - _Xconst char* /* window_name */, - _Xconst char* /* icon_name */, + const char* /* window_name */, + const char* /* icon_name */, char** /* argv */, int /* argc */, XSizeHints* /* normal_hints */, XWMHints* /* wm_hints */, XClassHint* /* class_hints */ -#endif ); extern void XSetWMSizeHints( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XSizeHints* /* hints */, Atom /* property */ -#endif ); extern XSetRegion( -#if NeedFunctionPrototypes Display* /* display */, GC /* gc */, Region /* r */ -#endif ); extern void XSetStandardColormap( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XStandardColormap* /* colormap */, Atom /* property */ -#endif ); extern XSetZoomHints( -#if NeedFunctionPrototypes Display* /* display */, Window /* w */, XSizeHints* /* zhints */ -#endif ); extern XShrinkRegion( -#if NeedFunctionPrototypes Region /* r */, int /* dx */, int /* dy */ -#endif ); extern Status XStringListToTextProperty( -#if NeedFunctionPrototypes char** /* list */, int /* count */, XTextProperty* /* text_prop_return */ -#endif ); extern XSubtractRegion( -#if NeedFunctionPrototypes Region /* sra */, Region /* srb */, Region /* dr_return */ -#endif ); extern int falmbTextListToTextProperty( -#if NeedFunctionPrototypes Display* /* display */, char** /* list */, int /* count */, XICCEncodingStyle /* style */, XTextProperty* /* text_prop_return */ -#endif ); extern int falwcTextListToTextProperty( -#if NeedFunctionPrototypes Display* /* display */, wchar_t** /* list */, int /* count */, XICCEncodingStyle /* style */, XTextProperty* /* text_prop_return */ -#endif ); extern void falwcFreeStringList( -#if NeedFunctionPrototypes wchar_t** /* list */ -#endif ); extern Status XTextPropertyToStringList( -#if NeedFunctionPrototypes XTextProperty* /* text_prop */, char*** /* list_return */, int* /* count_return */ -#endif ); extern int falmbTextPropertyToTextList( -#if NeedFunctionPrototypes Display* /* display */, XTextProperty* /* text_prop */, char*** /* list_return */, int* /* count_return */ -#endif ); extern int falwcTextPropertyToTextList( -#if NeedFunctionPrototypes Display* /* display */, XTextProperty* /* text_prop */, wchar_t*** /* list_return */, int* /* count_return */ -#endif ); extern XUnionRectWithRegion( -#if NeedFunctionPrototypes XRectangle* /* rectangle */, Region /* src_region */, Region /* dest_region_return */ -#endif ); extern XUnionRegion( -#if NeedFunctionPrototypes Region /* sra */, Region /* srb */, Region /* dr_return */ -#endif ); extern int XWMGeometry( -#if NeedFunctionPrototypes Display* /* display */, int /* screen_number */, - _Xconst char* /* user_geometry */, - _Xconst char* /* default_geometry */, + const char* /* user_geometry */, + const char* /* default_geometry */, unsigned int /* border_width */, XSizeHints* /* hints */, int* /* x_return */, @@ -914,15 +781,12 @@ extern int XWMGeometry( int* /* width_return */, int* /* height_return */, int* /* gravity_return */ -#endif ); extern XXorRegion( -#if NeedFunctionPrototypes Region /* sra */, Region /* srb */, Region /* dr_return */ -#endif ); _XFUNCPROTOEND diff --git a/cde/programs/dtudcfonted/libfal/_falutilbitmap.c b/cde/programs/dtudcfonted/libfal/_falutilbitmap.c index 8c59d610..cd506617 100644 --- a/cde/programs/dtudcfonted/libfal/_falutilbitmap.c +++ b/cde/programs/dtudcfonted/libfal/_falutilbitmap.c @@ -94,11 +94,9 @@ static unsigned char _reverse_byte[0x100] = { * Invert bit order within each BYTE of an array. */ void -BitOrderInvert(buf, nbytes) - register unsigned char *buf; - register int nbytes; +BitOrderInvert(unsigned char *buf, int nbytes) { - register unsigned char *rev = _reverse_byte; + unsigned char *rev = _reverse_byte; for (; --nbytes >= 0; buf++) *buf = rev[*buf]; @@ -108,11 +106,9 @@ BitOrderInvert(buf, nbytes) * Invert byte order within each 16-bits of an array. */ void -TwoByteSwap(buf, nbytes) - register unsigned char *buf; - register int nbytes; +TwoByteSwap(unsigned char *buf, int nbytes) { - register unsigned char c; + unsigned char c; for (; nbytes > 0; nbytes -= 2, buf += 2) { @@ -126,11 +122,9 @@ TwoByteSwap(buf, nbytes) * Invert byte order within each 32-bits of an array. */ void -FourByteSwap(buf, nbytes) - register unsigned char *buf; - register int nbytes; +FourByteSwap(unsigned char *buf, int nbytes) { - register unsigned char c; + unsigned char c; for (; nbytes > 0; nbytes -= 4, buf += 4) { @@ -148,10 +142,13 @@ FourByteSwap(buf, nbytes) */ int -RepadBitmap (pSrc, pDst, srcPad, dstPad, width, height) - char *pSrc, *pDst; - unsigned srcPad, dstPad; - int width, height; +RepadBitmap ( + char *pSrc, + char *pDst, + unsigned srcPad, + unsigned dstPad, + int width, + int height) { int srcWidthBytes,dstWidthBytes; int row,col; diff --git a/cde/programs/dtudcfonted/libfal/_falvarargs.h b/cde/programs/dtudcfonted/libfal/_falvarargs.h index 65f945b3..5b05b47a 100644 --- a/cde/programs/dtudcfonted/libfal/_falvarargs.h +++ b/cde/programs/dtudcfonted/libfal/_falvarargs.h @@ -82,13 +82,8 @@ typedef char *va_list; #else /* !__HIGHC__ */ -#if NeedVarargsPrototypes # include # define Va_start(a,b) va_start(a,b) -#else -# include -# define Va_start(a,b) va_start(a) -#endif #endif /* __HIGHC__ */ diff --git a/cde/programs/dtudcfonted/libfal/falfont.c b/cde/programs/dtudcfonted/libfal/falfont.c index 77feec3d..74501fae 100644 --- a/cde/programs/dtudcfonted/libfal/falfont.c +++ b/cde/programs/dtudcfonted/libfal/falfont.c @@ -42,12 +42,12 @@ #include #include #include +#include #include "FaLib.h" #include "falfont.h" #include "udcutil.h" - #define MKFONTLIST (1<<1) #define SRCHFNAME (1<<2) #define FONTOFID (1<<3) @@ -154,7 +154,7 @@ extern int fal_glyph_to_code() ; static int -fal_init() +fal_init(void) { memset( fal_err_file, '\0', sizeof(fal_err_file) ) ; memset( fal_err_file_buf, '\0', sizeof(fal_err_file_buf) ) ; @@ -175,9 +175,7 @@ fal_init() } void -set_errfile_str( obuf, ibuf ) -char *obuf ; -char *ibuf ; +set_errfile_str(char *obuf, char *ibuf) { char *sp ; @@ -194,10 +192,7 @@ char *ibuf ; * open a fontfile by "RDONLY" */ FalFontID -FalOpenFont( file, protect_key_data, codeset ) -char *file; -int protect_key_data; -int codeset; +FalOpenFont(char *file, int protect_key_data, int codeset) { FalFontID __FalOpenFont(); @@ -213,17 +208,15 @@ int codeset; * 0: OFF -- for "FalOpenFont()" */ FalFontID -__FalOpenFont( file, protect_key_data, codeset, lockflag ) -char *file; -int protect_key_data; -int codeset; -int lockflag; +__FalOpenFont(char *file, int protect_key_data, int codeset, int lockflag) { - int fd ; - char *buf; - char *openfontfile; - struct stat st; - Oak_FontInf *finf; + int fd ; + char *buf; + char *openfontfile; + struct stat st; + Oak_FontInf *finf; + + while(1){ if ( !(openfontfile = (char *)malloc( strlen( file ) + 1 )) ) { fal_seterrcode( _FAL_MALOC_ER, 0, @@ -358,7 +351,7 @@ int lockflag; fal_utyderror = 0; fal_utyerrno = FAL_ERR_FONT ; fal_utyerrno |= (FAL_FUNCNUM_OPNFNT<<8) ; - goto FalError01 ; + break; } finf->isFef = FALSE; finf->isPcf = TRUE; @@ -376,11 +369,11 @@ int lockflag; = (unsigned char *)((char *)finf->pCinf + (sizeof(CharInfoRec) * GETNUMCHARS(finf->pFinf))); finf->width - = finf->pFinf->maxbounds.metrics.rightSideBearing - - finf->pFinf->maxbounds.metrics.leftSideBearing; + = finf->pFinf->maxbounds.rightSideBearing + - finf->pFinf->maxbounds.leftSideBearing; finf->height - = finf->pFinf->maxbounds.metrics.ascent - + finf->pFinf->maxbounds.metrics.descent; + = finf->pFinf->maxbounds.ascent + + finf->pFinf->maxbounds.descent; } else if ( finf->isPcf ) { finf->pCinf = NULL; finf->pGlyphs = NULL; @@ -390,7 +383,7 @@ int lockflag; fal_utyderror = 0; fal_utyerrno = FAL_ERR_FONT ; fal_utyerrno |= (FAL_FUNCNUM_OPNFNT<<8) ; - goto FalError01 ; + break; } finf->start = (finf->pFinf->firstRow << 8) | finf->pFinf->firstCol; @@ -411,7 +404,7 @@ int lockflag; fal_utyderror = 0; fal_utyerrno = FAL_ERR_MALLOC ; fal_utyerrno |= (FAL_FUNCNUM_OPNFNT<<8) ; - goto FalError01 ; + break; } /* Save font information */ @@ -420,7 +413,7 @@ int lockflag; lockflag ) == FAL_ERROR ) { fal_utyerrno |= (FAL_FUNCNUM_OPNFNT<<8) ; - goto FalError01 ; + break; } /* Lock the font file */ @@ -430,44 +423,38 @@ int lockflag; fal_utyerror = _FAL_OPEN_ER; fal_utyderror = errno; fal_utyerrno |= (FAL_FUNCNUM_OPNFNT<<8) ; - goto FalError01 ; + break; } } free( openfontfile ); return( ( FalFontID ) finf ); -FalError01: + } #if defined( SVR4 ) - if ( finf->ismmap == TRUE ) { - munmap( buf, finf->fsize ); - } else { - free( buf ); - close( fd ); - } -#else + if ( finf->ismmap == TRUE ) { + munmap( buf, finf->fsize ); + } else { free( buf ); close( fd ); + } +#else + free( buf ); + close( fd ); #endif - set_errfile_str( fal_err_file, openfontfile ) ; - free( openfontfile ); - free( finf->fname ); - finf->fname = NULL; - free(finf); + set_errfile_str( fal_err_file, openfontfile ) ; + free( openfontfile ); + free( finf->fname ); + finf->fname = NULL; + free(finf); - return (FalFontID)FAL_ERROR; + return (FalFontID)FAL_ERROR; } -#if NeedFunctionPrototypes -FalCloseFont( - FalFontID fid ) -#else -FalCloseFont( fid ) -FalFontID fid; -#endif +FalCloseFont(FalFontID fid) { int __FalCloseFont(); FontIDInfo fontid_inf ; @@ -489,9 +476,7 @@ FalFontID fid; * 1: ON --- open a font by "RDWR" mode * 0: OFF -- for "FalOpenFont()" */ -__FalCloseFont( fid, lockflag ) -FalFontID fid; -int lockflag; +__FalCloseFont(FalFontID fid, int lockflag) { Oak_FontInf *finf; @@ -545,15 +530,7 @@ int lockflag; return _FAL_OK; } -#if NeedFunctionPrototypes -FalQueryFont( - FalFontID fid, - FalFontinfo *fontinfo ) -#else -FalQueryFont( fid, fontinfo ) -FalFontID fid; -FalFontinfo *fontinfo; -#endif +FalQueryFont(FalFontID fid, FalFontinfo *fontinfo) { Oak_FontInf *finf; unsigned int inner_start, inner_end ; @@ -594,21 +571,12 @@ FalFontinfo *fontinfo; return _FAL_OK; } -#if NeedFunctionPrototypes char * FalReadFont( FalFontID fid, int code, int width, int height ) -#else -char * -FalReadFont( fid, code, width, height ) -FalFontID fid; -int code ; -int width ; -int height ; -#endif { Oak_FontInf *finf; int zoom_on ; @@ -713,10 +681,7 @@ int height ; } static -falGetGlyph( glyph, finf, code ) -char *glyph; -Oak_FontInf *finf; -int code; +falGetGlyph(char *glyph, Oak_FontInf *finf, int code) { int in_dwidth, out_dwidth, ix, i, j; char *glyph_p, *inp, p_mask, falGetMask(); @@ -740,17 +705,6 @@ int code; 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 = (finf->width + SNF_BOUND - 1) / SNF_BOUND * (SNF_BOUND / 8); @@ -758,7 +712,7 @@ int code; 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++ ) { inp = glyph_p + ( in_dwidth * i ); for ( j = 0; j < out_dwidth-1; j++ ) { @@ -770,9 +724,7 @@ int code; } static -falGetCharIndex( finf, code ) -Oak_FontInf *finf; -int code; /* an inside code of a file */ +falGetCharIndex(Oak_FontInf *finf, int code) /* an inside code of a file */ { int nColperRow, nRow, nCol; @@ -784,24 +736,13 @@ int code; /* an inside code of a file */ } static -falZoom( dmem, smem, sw, sh, dw, dh, dbuf ) -char *dmem; -char *smem; -int sw; -int sh; -int dw; -int dh; -char *dbuf; +falZoom(char *dmem, char *smem, int sw, int sh, int dw, int dh, char *dbuf) { - int swidth; - int dwidth; - int i, lcnt; + int swidth = (sw + 7) / 8; + int dwidth = (dw + 7) / 8; + int i, lcnt = 0; char *sp, *dp; - swidth = (sw + 7) / 8; - dwidth = (dw + 7) / 8; - - lcnt = 0; sp = smem; dp = dmem; for ( i=0; i < sh; i++ ) { @@ -824,11 +765,7 @@ char *dbuf; } static -exline( sp, dbuf, sw, dw ) -char *sp; -char *dbuf; -int sw; -int dw; +exline(char *sp, char *dbuf, int sw, int dw) { int i, bit, sval, dval, dcnt, bcnt; @@ -862,8 +799,7 @@ static unsigned char _Fal_Mask_Tab[8] = { }; static char -falGetMask( width ) -int width; +falGetMask(int width) { int ix = width % 8; return _Fal_Mask_Tab[ix]; @@ -896,19 +832,11 @@ FAL_DB_OPTION ; /* make a font information list and carry to user */ /*********************************************************/ -#if NeedFunctionPrototypes int FalGetFontList( - FalFontData *key_data, - int mask, - FalFontDataList **list_ret ) -#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 + FalFontData *key_data, /* a structure of a searching information */ + int mask, /* a mask */ + FalFontDataList **list_ret ) /* maked a address of a structure */ { FalFontDataList *fls; /* a pointer of a structure of "FalFontDataList()" */ @@ -987,9 +915,9 @@ FalFontDataList **list_ret; /* maked a address of a structure */ /***********************************************************************/ static int -chk_key_str( key, mask ) -FalFontData *key; /* a structure of saerching information */ -int mask; /* a mask */ +chk_key_str( +FalFontData *key, /* a structure of saerching information */ +int mask) /* a mask */ { int flg = 0; @@ -1028,10 +956,10 @@ int mask; /* a mask */ static int -fal_make_fontlist( fls, key, mask ) -FalFontDataList *fls; /* a pointer of a structure of a font information list */ -FalFontData *key; /* a structure of searching information */ -int mask; /* a mask for a saerch */ +fal_make_fontlist( +FalFontDataList *fls, /* a pointer of a structure of a font information list */ +FalFontData *key, /* a structure of searching information */ +int mask) /* a mask for a saerch */ { return falReadFontInfoLists(MKFONTLIST, key, mask, fls, @@ -1044,15 +972,8 @@ int mask; /* a mask for a saerch */ /* free a structure of "FalFontDataList()" */ /**************************************************/ -#if NeedFunctionPrototypes int -FalFreeFontList( - FalFontDataList *list ) -#else -int -FalFreeFontList( list ) -FalFontDataList *list; -#endif +FalFreeFontList(FalFontDataList *list) { int i; @@ -1089,10 +1010,7 @@ FalFontDataList *list; /***********************************************************************/ static int -fal_split_data( buf, elm_num, elm) -char *buf; -int elm_num; -char *elm[]; +fal_split_data(char *buf, int elm_num, char *elm[]) { int cnt; int strtop_flg; @@ -1131,8 +1049,7 @@ char *elm[]; /***********************************************************************/ static int -fal_clear_data(tmp) -FalFontData *tmp; +fal_clear_data(FalFontData *tmp) { /* search a character */ free(tmp->xlfdname); @@ -1144,9 +1061,7 @@ FalFontData *tmp; } static int -fal_check_already_exist( data, lst ) -FalFontData *data; -FalFontDataList *lst; +fal_check_already_exist(FalFontData *data, FalFontDataList *lst) { int i; int mask ; @@ -1168,8 +1083,7 @@ FalFontDataList *lst; static int -fal_sort_fontlist( lst ) -FalFontDataList *lst; +fal_sort_fontlist(FalFontDataList *lst) { int i,j; FalFontDataList srt; @@ -1223,9 +1137,7 @@ FalFontDataList *lst; /***************************************/ static int -fal_atoi(str, val) -char *str; -int *val; +fal_atoi(char *str, int *val) { char *ptr; char *str_end; @@ -1251,9 +1163,7 @@ int *val; /*******************************/ static int -fal_set_cs(str, cs) -char *str; -int *cs; +fal_set_cs(char *str, int *cs) { if (!strcmp(str, "CS0")) { *cs = FAL_FONT_CS0; @@ -1279,9 +1189,7 @@ int *cs; static int -fal_set_prm(str, prm) -char *str; -int *prm; +fal_set_prm(char *str, int *prm) { int tmp = 0; for ( ; *str != '\0' ; str++) { @@ -1300,9 +1208,7 @@ int *prm; return 0 ; } -static int fal_read_db( str, db ) -char *str; -FalFontDB *db; +static int fal_read_db(char *str, FalFontDB *db) { int i; @@ -1320,8 +1226,7 @@ FalFontDB *db; /***************************************/ int -FalGetFontPath( dlist_ret ) -FalFontPath **dlist_ret; +FalGetFontPath(FalFontPath **dlist_ret) { /* clear an error data */ @@ -1363,14 +1268,13 @@ FalFontPath **dlist_ret; } static int -set_default_path() +set_default_path(void) { return set_font_pathlist(&orgn, 0) ; } static int -cpy_default_path( p ) -FalFontPath *p; +cpy_default_path(FalFontPath *p) { int i; FalFontPath tmp; @@ -1408,8 +1312,7 @@ FalFontPath *p; } static int -comp_default_path(p) -FalFontPath *p; +comp_default_path(FalFontPath *p) { int i; @@ -1430,8 +1333,7 @@ FalFontPath *p; static int -fal_clear_font_path( ls ) -FalFontPath *ls; +fal_clear_font_path(FalFontPath *ls) { int i; @@ -1468,69 +1370,67 @@ FalFontPath *ls; #define FAL_FONT_ELM_XLFDNAME 12 int -set_struct( tmp_data, elm ) -FalFontData *tmp_data; -char *elm[]; +set_struct(FalFontData *tmp_data, char *elm[]) { - char *dup_p; - - /* data information */ + char *dup_p; + /* data information */ + while(1){ /* a width of a character size */ if ( fal_atoi( elm[FAL_FONT_ELM_SIZE_W], &(tmp_data->size.w ) ) == FAL_ERROR ) { - goto FalError02 ; + break; } /* a height of a character size */ if ( fal_atoi( elm[FAL_FONT_ELM_SIZE_H], &(tmp_data->size.h ) ) == FAL_ERROR ) { - goto FalError02 ; + break; } /* a width of a letter size */ if ( fal_atoi( elm[FAL_FONT_ELM_LETTER_W], &(tmp_data->letter.w ) ) == FAL_ERROR ) { - goto FalError02 ; + break; } /* a height of a letter size */ if ( fal_atoi( elm[FAL_FONT_ELM_LETTER_H], &(tmp_data->letter.h ) ) == FAL_ERROR ) { - goto FalError02 ; + break; } /* position x of a letter size */ if ( fal_atoi( elm[FAL_FONT_ELM_LETTER_X], &(tmp_data->letter.x ) ) == FAL_ERROR ) { - goto FalError02 ; + break; } /* position y of a letter size */ if ( fal_atoi( elm[FAL_FONT_ELM_LETTER_Y], &(tmp_data->letter.y ) ) == FAL_ERROR ) { - goto FalError02 ; + break; } /* codeset */ if ( fal_set_cs( elm[FAL_FONT_ELM_CODE_SET], &(tmp_data->cd_set ) ) == FAL_ERROR ) { - goto FalError02 ; + break; } /* a equipment of an output permission */ if ( fal_set_prm( elm[FAL_FONT_ELM_PERMISSION], &(tmp_data->prm ) ) == FAL_ERROR ) { - goto FalError02 ; + break; } /* character information */ @@ -1572,16 +1472,14 @@ char *elm[]; SET_STRUCT_OPTION( dup_p, elm, tmp_data, fal_utyerror, fal_db_group ) ; return 0; -FalError02: - set_errfile_str( fal_err_file, fal_err_file_buf ) ; - fal_utyerrno = FAL_ERR_FDATA_DSC ; - return FAL_ERROR; + } + set_errfile_str( fal_err_file, fal_err_file_buf ) ; + fal_utyerrno = FAL_ERR_FDATA_DSC ; + return FAL_ERROR; } /* get a full path name */ -int searchFontFileName( data, fullPathName ) -FalFontData data; -char *fullPathName; +int searchFontFileName(FalFontData data, char *fullPathName) { int rtn ; rtn = falReadFontInfoLists(SRCHFNAME, @@ -1595,9 +1493,7 @@ char *fullPathName; } -int fal_eq_data( data, tmp_data ) -FalFontData data; -FalFontData tmp_data; +int fal_eq_data(FalFontData data, FalFontData tmp_data) { int flg = 0; @@ -1684,8 +1580,7 @@ FalFontData tmp_data; static int -CR_to_NULL(buf) -char *buf; +CR_to_NULL(char *buf) { for( ; *buf != '\0'; buf++ ) { if (*buf == '\n') { @@ -1696,8 +1591,7 @@ char *buf; return 0 ; } -char *fal_get_base_name( str ) -char *str; +char *fal_get_base_name(char *str) { char *str_slash; @@ -1710,10 +1604,7 @@ char *str; static int -fal_cmp_data( op1, key, mask ) -FalFontData *op1; -FalFontData *key; -int mask ; +fal_cmp_data(FalFontData *op1, FalFontData *key, int mask) { if ( mask == 0 ) { return(0); @@ -1816,9 +1707,7 @@ int mask ; /* no sort ... 0 */ static int -new_target( target, choose ) -FalFontData *target; -FalFontData *choose; +new_target(FalFontData *target, FalFontData *choose) { FalFontData diff; DEF_STR_CHK ; @@ -1932,15 +1821,9 @@ FalFontData *choose; return 0; } -#if NeedFunctionPrototypes int FalFontOfFontID( FalFontID fid, FalFontData *fontdata ) -#else -int FalFontOfFontID( fid, fontdata ) -FalFontID fid; -FalFontData *fontdata; -#endif { int rtn ; rtn = falReadFontInfoLists(FONTOFID, @@ -1953,19 +1836,11 @@ FalFontData *fontdata; return rtn ; } -#if NeedFunctionPrototypes FalFontID FalOpenSysFont( FalFontData *open_font_data, int font_data_mask, 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 */ FalFontID retOF; /* return a data of OpenFont */ @@ -2046,7 +1921,7 @@ FalFontDataList **missing_font_list_return; * function to access fonts.list ********************************************************/ static -FILE *open_fonts_list() +FILE *open_fonts_list(void) { FILE *fp; @@ -2097,9 +1972,7 @@ FILE *open_fonts_list() static int -set_font_pathlist(pathlist, nodef) -FalFontPath *pathlist ; -int nodef ; +set_font_pathlist(FalFontPath *pathlist, int nodef) { FILE *fp; char buf[FAL_LINE_MAX]; @@ -2222,8 +2095,7 @@ int nodef ; static int -make_default_path(pathlist) -FalFontPath *pathlist ; +make_default_path(FalFontPath *pathlist) { struct stat statbuf ; char pbuf[FAL_LINE_MAX], *dir, *p ; @@ -2302,18 +2174,18 @@ FalFontPath *pathlist ; static int -falReadFontInfoLists(func, lstkey, mask, fls, fnkey, fullpath, fid, fdata) -int func ; +falReadFontInfoLists( +int func, /* parameters for FalGetFontList */ -FalFontData *lstkey; -int mask; -FalFontDataList *fls; +FalFontData *lstkey, +int mask, +FalFontDataList *fls, /* parameters for searchFontFileName */ -FalFontData fnkey; -char *fullpath; +FalFontData fnkey, +char *fullpath, /* parameters for FalFontOfFontID */ -FalFontID fid ; -FalFontData *fdata; +FalFontID fid, +FalFontData *fdata) { FILE *fp; char pname[ FAL_LINE_MAX ] ; @@ -2675,7 +2547,7 @@ FalError: /* clear code set informations */ static void -clear_charset_info() +clear_charset_info(void) { if( charset_str_buf ) free( charset_str_buf ) ; charset_str_buf = NULL ; @@ -2686,13 +2558,13 @@ clear_charset_info() static int -fal_get_def_fontdata(func, pname, buf, elm, tmp_data, key_fname) -int func ; -char *pname ; /* font path */ -char *buf ; /* buffer for fgets() */ -char **elm ; -FalFontData *tmp_data ; -char *key_fname ; +fal_get_def_fontdata( +int func, +char *pname, /* font path */ +char *buf, /* buffer for fgets() */ +char **elm, +FalFontData *tmp_data, +char *key_fname) { int rtn ; char tmp_fname[FAL_LINE_MAX] ; @@ -2716,12 +2588,12 @@ char *key_fname ; static int -falgetfontlist(tmp_data, key, mask, fls, fontnum) -FalFontData *tmp_data ; -FalFontData *key ; -int mask ; -FalFontDataList *fls ; -int fontnum ; +falgetfontlist( +FalFontData *tmp_data, +FalFontData *key, +int mask, +FalFontDataList *fls, +int fontnum) { FalFontData *p_bak ; @@ -2754,14 +2626,14 @@ int fontnum ; static int -fal_get_undef_fontdata(func, full_path, xlfd, tmp_data, key_fname, codeset_num, codeset_list) -int func ; -char *full_path ; -char *xlfd ; -FalFontData *tmp_data ; -char *key_fname ; -int *codeset_num ; -int **codeset_list ; +fal_get_undef_fontdata( +int func, +char *full_path, +char *xlfd, +FalFontData *tmp_data, +char *key_fname, +int *codeset_num, +int **codeset_list) { int rtn, pix ; char *char_set ; @@ -2836,17 +2708,10 @@ int **codeset_list ; * get file name of fonts */ -#if NeedFunctionPrototypes int FalFontIDToFileName( FalFontID fid, char **file_name ) -#else -int -FalFontIDToFileName( fid, file_name ) -FalFontID fid; -char **file_name; -#endif { char *fname ; Oak_FontInf *finf ; @@ -2876,15 +2741,8 @@ char **file_name; } -#if NeedFunctionPrototypes int -FalFree( - void *list ) -#else -int -FalFree( list ) -void *list ; -#endif +FalFree(void *list) { if( list == NULL ) { fal_utyerror = _FAL_PARM_ER ; @@ -2899,9 +2757,7 @@ void *list ; int -FalFreeGI( ginf, num ) -FalGIInf *ginf ; -int num ; +FalFreeGI(FalGIInf *ginf, int num) { int i ; if( ginf == NULL ) { @@ -2924,11 +2780,7 @@ int num ; */ static int -fal_add_fidinf( fid, dspcode, cd_set, islock ) -FalFontID fid ; -int dspcode ; -int cd_set ; -int islock ; +fal_add_fidinf(FalFontID fid, int dspcode, int cd_set, int islock) { int exist, i, cnt ; FontIDInfo **flist ; @@ -2985,9 +2837,7 @@ int islock ; } static int -fal_read_fidinf( fid, fontid_inf ) -FalFontID fid ; -FontIDInfo *fontid_inf; +fal_read_fidinf(FalFontID fid, FontIDInfo *fontid_inf) { int i ; if( fid == NULL ) { @@ -3011,8 +2861,7 @@ FontIDInfo *fontid_inf; static int -fal_del_fidinf( fid ) -FalFontID fid ; +fal_del_fidinf(FalFontID fid) { int i, cnt, target ; FontIDInfo **flist ; @@ -3051,10 +2900,7 @@ FalFontID fid ; */ static int -fal_conv_code_to_glyph( fid, code, glidx ) -FalFontID fid ; -unsigned int code ; -unsigned int *glidx ; +fal_conv_code_to_glyph(FalFontID fid, unsigned int code, unsigned int *glidx) { Oak_FontInf *finf ; FalFontData tmp_data ; @@ -3128,12 +2974,12 @@ unsigned int *glidx ; */ static int -fal_conv_glyph_to_code( finf, dspcode, cd_set, glidx, code ) -Oak_FontInf *finf ; -int dspcode ; -int cd_set ; -unsigned int glidx ; -unsigned int *code ; +fal_conv_glyph_to_code( +Oak_FontInf *finf, +int dspcode, +int cd_set, +unsigned int glidx, +unsigned int *code) { FalFontData tmp_data ; int inner_code ; @@ -3176,8 +3022,7 @@ unsigned int *code ; static int -file_lock( fd ) -int fd; /* a file descripter */ +file_lock(int fd) /* a file descripter */ { struct flock flpar; @@ -3195,8 +3040,7 @@ int fd; /* a file descripter */ } static int -file_unlock( fd ) -int fd; /* a file descripter */ +file_unlock(int fd) /* a file descripter */ { struct flock flpar; @@ -3213,8 +3057,7 @@ int fd; /* a file descripter */ } static int -is_lock( fd ) -int fd; /* file descripter */ +is_lock(int fd) /* file descripter */ { struct flock flpar; diff --git a/cde/programs/dtudcfonted/libfal/fonts.list.header b/cde/programs/dtudcfonted/libfal/fonts.list.header index d3db1648..9e194cef 100644 --- a/cde/programs/dtudcfonted/libfal/fonts.list.header +++ b/cde/programs/dtudcfonted/libfal/fonts.list.header @@ -1,9 +1,9 @@ ############################################################################# ##### ##### ##### fonts.list ##### -##### ##### +##### ##### ##### All Rights Reserved, Copyright (C) FUJITSU LIMITED 1995 ##### -##### ##### +##### ##### ############################################################################# # # This file is referenced by : diff --git a/cde/programs/dtudcfonted/libfal/include/font.h b/cde/programs/dtudcfonted/libfal/include/font.h deleted file mode 100644 index 59211e38..00000000 --- a/cde/programs/dtudcfonted/libfal/include/font.h +++ /dev/null @@ -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 */ diff --git a/cde/programs/dtudcfonted/libfal/include/fontstruct.h b/cde/programs/dtudcfonted/libfal/include/fontstruct.h deleted file mode 100644 index 215bbfe0..00000000 --- a/cde/programs/dtudcfonted/libfal/include/fontstruct.h +++ /dev/null @@ -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 */ diff --git a/cde/programs/dtudcfonted/libfal/include/misc.h b/cde/programs/dtudcfonted/libfal/include/misc.h deleted file mode 100644 index d22eded9..00000000 --- a/cde/programs/dtudcfonted/libfal/include/misc.h +++ /dev/null @@ -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 -#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 */ diff --git a/cde/programs/dtudcfonted/libfal/include/os.h b/cde/programs/dtudcfonted/libfal/include/os.h deleted file mode 100644 index d651f10f..00000000 --- a/cde/programs/dtudcfonted/libfal/include/os.h +++ /dev/null @@ -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 -#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 */ diff --git a/cde/programs/dtudcfonted/libfal/include/pcf.h b/cde/programs/dtudcfonted/libfal/include/pcf.h deleted file mode 100644 index ad36b922..00000000 --- a/cde/programs/dtudcfonted/libfal/include/pcf.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * CDE - Common Desktop Environment - * - * Copyright (c) 1993-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these libraries and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA - */ -/* $XConsortium: pcf.h /main/2 1996/02/10 16:25:46 cde-fuj $ */ -/* - * - * Copyright 1990 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - (c) Copyright 1995 FUJITSU LIMITED - This is source code modified by FUJITSU LIMITED under the Joint - Development Agreement for the CDEnext PST. - This is unpublished proprietary source code of FUJITSU LIMITED - */ - -#ifndef _PCF_H_ -#define _PCF_H_ - -/* - * Information used to read/write PCF fonts - */ - -typedef struct _PCFTable { - CARD32 type; - CARD32 format; - CARD32 size; - CARD32 offset; -} PCFTableRec, *PCFTablePtr; - -#define PCF_FILE_VERSION (('p'<<24)|('c'<<16)|('f'<<8)|1) -#define PCF_FORMAT_MASK 0xffffff00 - -#define PCF_DEFAULT_FORMAT 0x00000000 -#define PCF_INKBOUNDS 0x00000200 -#define PCF_ACCEL_W_INKBOUNDS 0x00000100 -#define PCF_COMPRESSED_METRICS 0x00000100 - -#define PCF_FORMAT_MATCH(a,b) (((a)&PCF_FORMAT_MASK) == ((b)&PCF_FORMAT_MASK)) - -#define PCF_GLYPH_PAD_MASK (3<<0) -#define PCF_BYTE_MASK (1<<2) -#define PCF_BIT_MASK (1<<3) -#define PCF_SCAN_UNIT_MASK (3<<4) - -#define PCF_BYTE_ORDER(f) (((f) & PCF_BYTE_MASK)?MSBFirst:LSBFirst) -#define PCF_BIT_ORDER(f) (((f) & PCF_BIT_MASK)?MSBFirst:LSBFirst) -#define PCF_GLYPH_PAD_INDEX(f) ((f) & PCF_GLYPH_PAD_MASK) -#define PCF_GLYPH_PAD(f) (1<> 4) -#define PCF_SCAN_UNIT(f) (1< 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 */ diff --git a/cde/programs/dtudcfonted/libfal/readpcf.c b/cde/programs/dtudcfonted/libfal/readpcf.c index 65a8fb49..4dc9eed8 100644 --- a/cde/programs/dtudcfonted/libfal/readpcf.c +++ b/cde/programs/dtudcfonted/libfal/readpcf.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "FaLib.h" #include "falfont.h" @@ -62,8 +63,7 @@ extern void BitOrderInvert() ; extern void set_errfile_str() ; static CARD32 -getLSB32( p) -unsigned char *p; +getLSB32(unsigned char *p) { CARD32 c; @@ -76,9 +76,7 @@ unsigned char *p; } static int -getINT32( p, format) -unsigned char *p; -CARD32 format; +getINT32(unsigned char *p, CARD32 format) { CARD32 c; @@ -98,9 +96,7 @@ CARD32 format; } static int -getINT16( p, format) -unsigned char *p; -CARD32 format; +getINT16(unsigned char *p, CARD32 format) { CARD32 c; @@ -116,13 +112,13 @@ CARD32 format; } static Bool -seekToType( tables, ntables, type, formatp, sizep, offsetp) -PCFTablePtr tables; -int ntables; -CARD32 type; -CARD32 *formatp; -CARD32 *sizep; -CARD32 *offsetp; +seekToType( +PCFTablePtr tables, +int ntables, +CARD32 type, +CARD32 *formatp, +CARD32 *sizep, +CARD32 *offsetp) { int i; @@ -143,10 +139,7 @@ CARD32 *offsetp; static void -getMetric( buf, format, metric) -caddr_t buf; -CARD32 format; -xCharInfo *metric; +getMetric(caddr_t buf, CARD32 format, xCharInfo *metric) { metric->leftSideBearing = getINT16( (unsigned char *)buf, (CARD32)format); buf += 2; @@ -163,13 +156,13 @@ xCharInfo *metric; } static Bool -getAccel( pFontInfo, maxink, buf_top, tables, ntables, type) -FontInfoPtr pFontInfo; -xCharInfo *maxink; -caddr_t buf_top; -PCFTablePtr tables; -int ntables; -CARD32 type; +getAccel( +FontInfoPtr pFontInfo, +xCharInfo *maxink, +caddr_t buf_top, +PCFTablePtr tables, +int ntables, +CARD32 type) { CARD32 format; CARD32 offset; @@ -200,23 +193,21 @@ CARD32 type; 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; - getMetric(buffer, format, &pFontInfo->maxbounds.metrics); + getMetric(buffer, format, &pFontInfo->maxbounds); buffer += 12; if (PCF_FORMAT_MATCH(format, PCF_ACCEL_W_INKBOUNDS)) { buffer += 12; getMetric( buffer, format, maxink); } else { - *maxink = pFontInfo->maxbounds.metrics; + *maxink = pFontInfo->maxbounds; } return TRUE; } int -falInitReadPcf( pcfinf, buftop) -struct pcf_inf *pcfinf; -caddr_t buftop; +falInitReadPcf(struct pcf_inf *pcfinf, caddr_t buftop) { CARD32 format; CARD32 offset; @@ -225,7 +216,7 @@ caddr_t buftop; caddr_t buffp; if ( getLSB32( (unsigned char *)buftop ) != PCF_FILE_VERSION) - goto Bail; + return -1; pcfinf->ntables = getLSB32( (unsigned char *)(buftop + 4) ); @@ -235,20 +226,20 @@ caddr_t buftop; (CARD32)PCF_BDF_ACCELERATORS)) if ( !getAccel( &pcfinf->info, &maxink, buftop, pcfinf->tables, pcfinf->ntables, (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, &format, (CARD32 *)NULL, &offset)) - goto Bail; + return -1; buffp = buftop + offset; format = getLSB32( (unsigned char *)buffp ); buffp += 4; if (!PCF_FORMAT_MATCH(format, PCF_DEFAULT_FORMAT)) - goto Bail; + return -1; pcfinf->nbitmaps = getINT32( (unsigned char *)buffp, (CARD32)format); buffp += 4; @@ -264,13 +255,13 @@ caddr_t buftop; if ( !seekToType( pcfinf->tables, pcfinf->ntables, (CARD32)PCF_BDF_ENCODINGS, &format, (CARD32 *)NULL, &offset)) - goto Bail; + return -1; buffp = buftop + offset; format = getLSB32( (unsigned char *)buffp ); buffp += 4; if (!PCF_FORMAT_MATCH(format, PCF_DEFAULT_FORMAT)) - goto Bail; + return -1; pcfinf->info.firstCol = getINT16( (unsigned char *)buffp, (CARD32)format); buffp += 2; @@ -283,7 +274,7 @@ caddr_t buftop; /* 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; pcfinf->info.allExist = FALSE; @@ -291,14 +282,10 @@ caddr_t buftop; pcfinf->encodingOffsets = (CARD16 *)buffp; return 0; -Bail: - return -1; } static void -ByteSwap( p, scan) -char *p; -int scan; +ByteSwap(char *p, int scan) { char w; @@ -321,11 +308,7 @@ int scan; } } static void -repadBits( src, format, width, height, dest) -char *src; -CARD32 format; -int width, height; -char *dest; +repadBits(char *src, CARD32 format, int width, int height, char *dest) { int bit, byte, glyph, scan; int src_bytewidth, dest_bytewidth; @@ -358,17 +341,14 @@ char *dest; } int -falPcfGlyph( glyph, finf, code) -char *glyph; -Oak_FontInf *finf; -int code; +falPcfGlyph(char *glyph, Oak_FontInf *finf, int code) { - int encode; - int inner_code; - char *bitmap; - int encodingOffset; - int codeRow, codeCol; - int bytewidth; + int encode; + int inner_code; + char *bitmap; + int encodingOffset; + int codeRow, codeCol; + int bytewidth; int bmp_adj, ptn_adj; int adj_hi; int cpy_height; @@ -405,9 +385,9 @@ int code; bitmap = finf->pcfinf.bitmaps + getINT32( (unsigned char *)(finf->pcfinf.offsets + encodingOffset), finf->pcfinf.bmp_fmt); - bmp_height = finf->pFinf->maxbounds.metrics.ascent - + finf->pFinf->maxbounds.metrics.descent; - if (( adj_hi = finf->pFinf->maxbounds.metrics.ascent + bmp_height = finf->pFinf->maxbounds.ascent + + finf->pFinf->maxbounds.descent; + if (( adj_hi = finf->pFinf->maxbounds.ascent - finf->pcfinf.org_bounds.ascent) > 0) { bytewidth = 8 * PCF_GLYPH_PAD( finf->pcfinf.bmp_fmt); bytewidth = (( finf->width + bytewidth - 1)/ bytewidth ) * PCF_GLYPH_PAD( finf->pcfinf.bmp_fmt); @@ -433,9 +413,10 @@ int code; } void -falGetPcfGSize( pcfinf, widthp, heightp) -struct pcf_inf *pcfinf; -unsigned int *widthp, *heightp; +falGetPcfGSize( +struct pcf_inf *pcfinf, +unsigned int *widthp, +unsigned int *heightp) { unsigned int w, h; @@ -456,7 +437,7 @@ unsigned int *widthp, *heightp; * *******************************************************/ -#include "fontstruct.h" +#include static char *getPcfFontProp(); static char *getSnfFontProp(); @@ -466,11 +447,11 @@ static char *getSnfFontProp(); */ int -falReadFontProp( file, protect_key_data, databuff, islock ) -char *file ; /* name of font file */ -int protect_key_data ; -FalFontData *databuff ; -int islock ; +falReadFontProp( +char *file, /* name of font file */ +int protect_key_data, +FalFontData *databuff, +int islock) { Oak_FontInf finf; int fd ; @@ -586,11 +567,11 @@ int islock ; * get properties of GPF format file */ int -falReadGpfProp( updflg, finf, protect_key_data, databuff ) -int updflg ; -Oak_FontInf *finf; -int protect_key_data ; -FalFontData *databuff ; +falReadGpfProp( +int updflg, +Oak_FontInf *finf, +int protect_key_data, +FalFontData *databuff) { char *openfontfile; int rtn ; @@ -656,10 +637,7 @@ FalFontData *databuff ; * get properties of PCF format file */ int -falInitReadPcfProp( updflg, finf, databuff ) -int updflg ; -Oak_FontInf *finf; -FalFontData *databuff ; +falInitReadPcfProp(int updflg, Oak_FontInf *finf, FalFontData *databuff) { struct pcf_inf *pcfinf; caddr_t buftop; @@ -685,7 +663,7 @@ FalFontData *databuff ; if ( !getAccel( &pcfinf->info, &maxink, buftop, pcfinf->tables, pcfinf->ntables, (CARD32)PCF_ACCELERATORS)) { fal_utyerrno = FAL_ERR_FONT ; - goto Bail; + return -1; } } @@ -696,7 +674,7 @@ FalFontData *databuff ; */ if( updflg == FAL_UPDATE_FONTINFO ) { - pcfinf->org_bounds = pcfinf->info.maxbounds.metrics; + pcfinf->org_bounds = pcfinf->info.maxbounds; } lb = pcfinf->org_bounds.leftSideBearing ; @@ -714,7 +692,7 @@ FalFontData *databuff ; pcfinf->ntables, "FONT" )) { if( (databuff->xlfdname = (char *)strdup( buffp )) == (char *)NULL ){ fal_utyerrno = FAL_ERR_MALLOC ; - goto Bail; + return -1; } }else{ set_errfile_str( fal_err_file, finf->fname ) ; @@ -729,7 +707,7 @@ FalFontData *databuff ; pcfinf->ntables, "FAMILY_NAME")) { if( (databuff->style.name = (char *)strdup( buffp )) == NULL ){ fal_utyerrno = FAL_ERR_MALLOC ; - goto Bail ; + return -1; } }else{ set_errfile_str( fal_err_file, finf->fname ) ; @@ -738,18 +716,13 @@ FalFontData *databuff ; } return 0; -Bail: - return -1; + } static char * -getPcfFontProp( buftop, tables, ntables, propname) -caddr_t buftop; -PCFTablePtr tables; -int ntables; -char *propname; +getPcfFontProp(caddr_t buftop, PCFTablePtr tables, int ntables, char *propname) { caddr_t buffer; int name_ofs; @@ -792,10 +765,10 @@ char *propname; * get properties of SNF format file */ int -falInitReadSnfProp( finf, buftop, databuff ) -Oak_FontInf *finf; /* pointer to the infomation structure */ -caddr_t buftop; /* font file */ -FalFontData *databuff ; +falInitReadSnfProp( +Oak_FontInf *finf, /* pointer to the infomation structure */ +caddr_t buftop, /* font file */ +FalFontData *databuff) { caddr_t stprop ; int lb, rb, as, ds ; @@ -805,23 +778,21 @@ FalFontData *databuff ; /* initialize pointer */ - nprops = finf->pFinf->nProps ; + nprops = finf->pFinf->nprops ; num_chars = ( finf->pFinf->lastRow - finf->pFinf->firstRow + 1 ) * ( finf->pFinf->lastCol - finf->pFinf->firstCol + 1 ) ; - bitmapSize = BYTESOFGLYPHINFO(finf->pFinf) ; stprop = buftop ; stprop += sizeof(FontInfoRec) ; stprop += num_chars * sizeof(CharInfoRec) ; - stprop += bitmapSize ; /* * read property "FONTBOUNDINGBOX" */ - lb = finf->pFinf->maxbounds.metrics.leftSideBearing ; - rb = finf->pFinf->maxbounds.metrics.rightSideBearing ; - as = finf->pFinf->maxbounds.metrics.ascent ; - ds = finf->pFinf->maxbounds.metrics.descent ; + lb = finf->pFinf->maxbounds.leftSideBearing ; + rb = finf->pFinf->maxbounds.rightSideBearing ; + as = finf->pFinf->maxbounds.ascent ; + ds = finf->pFinf->maxbounds.descent ; /* * read property "FONT" @@ -829,7 +800,8 @@ FalFontData *databuff ; if ( propptr = getSnfFontProp( stprop, nprops, "FONT" )) { if( (fnt = (char *)strdup( propptr )) == NULL ){ fal_utyerrno = FAL_ERR_MALLOC ; - goto Bail; + free(fnt); + return -1; } }else{ set_errfile_str( fal_err_file, finf->fname ) ; @@ -843,7 +815,8 @@ FalFontData *databuff ; if ( propptr = getSnfFontProp( stprop, nprops, "FAMILY_NAME")) { if( (fam = (char *)strdup( propptr )) == NULL ){ fal_utyerrno = FAL_ERR_MALLOC ; - goto Bail ; + free(fnt); + return -1; } }else{ set_errfile_str( fal_err_file, finf->fname ) ; @@ -863,18 +836,12 @@ FalFontData *databuff ; databuff->style.name = fam ; return 0; -Bail: - free(fnt); - return -1; } static char * -getSnfFontProp( buftop, nprops, propname ) -caddr_t buftop; -int nprops ; -char *propname; +getSnfFontProp(caddr_t buftop, int nprops, char *propname) { caddr_t buffer; int name_ofs; @@ -889,11 +856,7 @@ char *propname; for ( i=0; i < nprops ; i++, ProcRec++ ) { name_ofs = ProcRec->name ; if( strcmp( propstr + name_ofs, propname ) == 0 ){ - if( ProcRec->indirect ){ - return( propstr + ProcRec->value ) ; - }else{ return( (char *) (intptr_t) ProcRec->value ) ; - } } } diff --git a/cde/programs/dtudcfonted/libfal/syncx.h b/cde/programs/dtudcfonted/libfal/syncx.h index fde099d5..1814dfc6 100644 --- a/cde/programs/dtudcfonted/libfal/syncx.h +++ b/cde/programs/dtudcfonted/libfal/syncx.h @@ -33,45 +33,34 @@ #include "_falutil.h" extern XrmQuark falrmStringToQuark( -#if NeedFunctionPrototypes - _Xconst char* /* string */ -#endif + const char* /* string */ ); extern XrmString falrmQuarkToString( -#if NeedFunctionPrototypes XrmQuark /* quark */ -#endif ); extern char *falGetAtomName( -#if NeedFunctionPrototypes Display* /* display */, Atom /* atom */ -#endif ); extern char **falListFonts( -#if NeedFunctionPrototypes Display* /* display */, - _Xconst char* /* pattern */, + const char* /* pattern */, int /* maxnames */, int* /* actual_count_return */ -#endif ); extern char **falListFontsWithInfo( -#if NeedFunctionPrototypes Display* /* display */, - _Xconst char* /* pattern */, + const char* /* pattern */, int /* maxnames */, int* /* count_return */, XFontStruct** /* info_return */ -#endif ); extern XFontStruct *falLoadQueryFont( -#if NeedFunctionPrototypes Display* /* display */, - _Xconst char* /* name */ -#endif + const char* /* name */ ); + diff --git a/cde/programs/dtudcfonted/libfuty/getfname.c b/cde/programs/dtudcfonted/libfuty/getfname.c index 0782b215..167a3135 100644 --- a/cde/programs/dtudcfonted/libfuty/getfname.c +++ b/cde/programs/dtudcfonted/libfuty/getfname.c @@ -55,13 +55,22 @@ #include "bdfgpf.h" -static void ErrMsgTable_GetDefaultFile(); -static int falcom_split_data() ; -static void dsp_font_list() ; -static int search_Font_File_Name(); - -extern int searchFontFileName(); -extern int falReadFontProp() ; +static void ErrMsgTable_GetDefaultFile(char *com, + int ret, + int size, + 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(FalFontData data, char *fullPathName); +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 @@ -76,10 +85,10 @@ extern int falReadFontProp() ; #define BODY_AND_LETTER 2 static int -GetSize( size_str, body, letter ) -char *size_str; /* a character of a size */ -int *body; /* set "character size" (output) */ -int *letter; /* set "letter size" (output) */ +GetSize( +char *size_str, /* a character of a size */ +int *body, /* set "character size" (output) */ +int *letter) /* set "letter size" (output) */ { char *str_dot; /* char *str_end; */ @@ -120,18 +129,10 @@ int *letter; /* set "letter size" (output) */ */ int -#if NeedFunctionPrototypes falcom_atoi( char *str, /* numerical character */ char ed_code,/* an end code in numerical character */ - 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 + int *val) /* set numarical data */ { char *ptr; char *str_end; @@ -153,8 +154,7 @@ int *val; /* set numarical data */ static int -falcom_cr_to_null(buf) -char *buf; +falcom_cr_to_null(char *buf) { buf = strchr( buf, '\n'); if (buf != NULL) { @@ -173,18 +173,10 @@ char *buf; int -#if NeedFunctionPrototypes GetDefaultFile( - int size, - char *style, - char *fname -) -#else -GetDefaultFile( size, style, fname ) -int size; /* character size */ -char *style; /* character style */ -char *fname; /* buffer */ -#endif + int size, /* character size */ + char *style, /* character style */ + char *fname) /* buffer */ { FILE *fp; int ret; @@ -213,20 +205,11 @@ char *fname; /* buffer */ int -#if NeedFunctionPrototypes get_default_file( FILE *fp, - int size, - char *style, - char *fname -) -#else -get_default_file( fp, size, style, fname ) -FILE *fp; -int size; /* character size */ -char *style; /* character style */ -char *fname; /* buffer */ -#endif + int size, /* character size */ + char *style, /* character style */ + char *fname) /* buffer */ { char buf[BUFSIZE]; /* buffer */ int size_tmp; /* size (read file) */ @@ -273,10 +256,10 @@ char *fname; /* buffer */ /**************************************************************/ static int -falcom_split_data( buf, entry_num, elm ) -char *buf; /* read a font information character array from a file */ -int entry_num; -char *elm[]; +falcom_split_data( +char *buf, /* read a font information character array from a file */ +int entry_num, +char *elm[]) { int cnt; /* counter */ int strtop_flg; /* flag of a head of a character array */ @@ -309,12 +292,7 @@ char *elm[]; char * -#if NeedFunctionPrototypes -falcom_get_base_name( char *str ) -#else -falcom_get_base_name( str ) -char *str; /* a full path character of a file name */ -#endif +falcom_get_base_name( char *str /* a full path character of a file name */ ) { char *str_slash; @@ -327,8 +305,7 @@ char *str; /* a full path character of a file name */ static int -is_letter_size_not_only_one( lst ) -FalFontDataList *lst; /* a font list */ +is_letter_size_not_only_one( FalFontDataList *lst /* a font list */ ) { int i, letter_cmp; @@ -351,22 +328,12 @@ FalFontDataList *lst; /* a font list */ * */ int -#if NeedFunctionPrototypes GetFileName( - char *com, - char *size_str, - char *style, - int codeset, - char *ofile -) -#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 + 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) */ { int body, letter; int size_sw; /* a size flag */ @@ -570,18 +537,10 @@ char *fal_errmsg_org[0xff] = { void -#if NeedFunctionPrototypes ErrMsgTable_FalGetFontList( - char *com, - int utyerr, - int utyderr -) -#else -ErrMsgTable_FalGetFontList( com, utyerr, utyderr ) -char *com; /* command name */ -int utyerr; /* fal_utyerror */ -int utyderr; /* fal_utyderror */ -#endif + char *com, /* command name */ + int utyerr, /* fal_utyerror */ + int utyderr) /* fal_utyderror */ { char *fontsdir, *locale ; @@ -627,17 +586,15 @@ int utyderr; /* fal_utyderror */ } } - - /* take out an error message of "GetDefaultFile()" */ static void -ErrMsgTable_GetDefaultFile( com, ret, size, style, fname ) -char *com; /* a command name */ -int ret; /* return code */ -int size; /* a character size */ -char *style; /* a character style */ -char *fname; /* user defined character information file name */ +ErrMsgTable_GetDefaultFile( +char *com, /* a command name */ +int ret, /* return code */ +int size, /* a character size */ +char *style, /* a character style */ +char *fname) /* user defined character information file name */ { switch (ret) { case -1: @@ -666,12 +623,7 @@ char *fname; /* user defined character information file name */ */ void -#if NeedFunctionPrototypes fal_cut_tailslash( char *name ) -#else -fal_cut_tailslash( name ) -char *name; -#endif { char *p; @@ -695,12 +647,7 @@ char *name; */ char * -#if NeedFunctionPrototypes GetRealFileName( char *name ) -#else -GetRealFileName( name ) -char *name; -#endif { static char *ret_name ; char link_name[BUFSIZE]; @@ -760,18 +707,10 @@ char *name; */ int -#if NeedFunctionPrototypes IsInRegion( int code , int num_gr , - FalGlyphRegion *gr -) -#else -IsInRegion(code, num_gr, gr) -int code ; -int num_gr ; -FalGlyphRegion *gr ; -#endif + FalGlyphRegion *gr) { int i ; if( code < MIN_CODE || code > MAX_CODE ) return -1 ; @@ -787,9 +726,7 @@ FalGlyphRegion *gr ; static int -search_Font_File_Name( data, fname ) -FalFontData data ; -char *fname ; +search_Font_File_Name( FalFontData data, char *fname ) { FalFontID fid ; FalFontDataList *flist ; @@ -861,20 +798,11 @@ char *fname ; int -#if NeedFunctionPrototypes GetUdcFileName( - char *com , - int code_no , - char *xlfdname , - char *fname -) -#else -GetUdcFileName( com, code_no, xlfdname, fname ) -char *com ; -int code_no ; -char *xlfdname ; -char *fname ; -#endif + char *com, + int code_no, + char *xlfdname, + char *fname) { FalFontData data ; @@ -891,8 +819,7 @@ char *fname ; static void -dsp_font_list( flist ) -FalFontDataList *flist ; +dsp_font_list( FalFontDataList *flist ) { int i ; @@ -910,22 +837,12 @@ FalFontDataList *flist ; int -#if NeedFunctionPrototypes GetUdcRegion( - char *com , - int codeset , - char *gpf_file , - int *num_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 + char *com, + int codeset, + char *gpf_file, + int *num_gr, + FalGlyphRegion **gr) { FalFontData fdata ; char *locale, *char_set, *tmp_gpf ; @@ -971,12 +888,7 @@ FalGlyphRegion **gr ; #define MAX_CODESET 8 int -#if NeedFunctionPrototypes DispUdcCpArea( FILE *fp ) -#else -DispUdcCpArea( fp ) -FILE *fp ; -#endif { int cd_set, j ; FalFontDataList *fls ; @@ -1026,18 +938,10 @@ FILE *fp ; int -#if NeedFunctionPrototypes GetUdcFontName( char *gpf_file , char *bdf_file , - char **fontname -) -#else -GetUdcFontName( gpf_file, bdf_file, fontname ) -char *gpf_file ; -char *bdf_file ; -char **fontname ; -#endif + char **fontname) { FILE *fp ; pid_t chld_pid = 0; diff --git a/cde/programs/dtudcfonted/libfuty/lock.c b/cde/programs/dtudcfonted/libfuty/lock.c index 40b30c8b..b6fddf3b 100644 --- a/cde/programs/dtudcfonted/libfuty/lock.c +++ b/cde/programs/dtudcfonted/libfuty/lock.c @@ -48,12 +48,7 @@ */ int -#if NeedFunctionPrototypes FileLock( int fd ) -#else -FileLock( fd ) -int fd; /* a file descripter */ -#endif { struct flock flpar; @@ -83,12 +78,7 @@ int fd; /* a file descripter */ */ int -#if NeedFunctionPrototypes FileUnLock( int fd ) -#else -FileUnLock( fd ) -int fd; /* a file descripter */ -#endif { struct flock flpar; @@ -115,12 +105,7 @@ int fd; /* a file descripter */ */ int -#if NeedFunctionPrototypes isLock( int fd ) -#else -isLock( fd ) -int fd; /* file descripter */ -#endif { struct flock flpar; diff --git a/cde/programs/dtudcfonted/libfuty/oakfuty.c b/cde/programs/dtudcfonted/libfuty/oakfuty.c index 04c9d1e0..b1ad17c8 100644 --- a/cde/programs/dtudcfonted/libfuty/oakfuty.c +++ b/cde/programs/dtudcfonted/libfuty/oakfuty.c @@ -52,7 +52,7 @@ #include "bdfgpf.h" #include "udcutil.h" -static void exline(); +static void exline(char *sp, char *dbuf, int sw, int dw); char *oakgtobdf; char *bdftosnf = BDFTOSNF; @@ -66,16 +66,7 @@ static int put_file_create_err_msg = 0; #define READ_FAIL 5 int -#if NeedFunctionPrototypes -ReadBdfHeader( - struct btophead *head, - char *buf -) -#else -ReadBdfHeader( head, buf ) -struct btophead *head; -char *buf; -#endif +ReadBdfHeader(struct btophead *head, char *buf) { char *p; unsigned int getstat = 0; @@ -128,16 +119,7 @@ char *buf; int -#if NeedFunctionPrototypes -ReadGpfHeader( - struct ptobhead *head, - char *buf -) -#else -ReadGpfHeader(head, buf) -struct ptobhead *head; -char *buf; -#endif +ReadGpfHeader(struct ptobhead *head, char *buf) { char *p; unsigned int getstat = 0; @@ -173,12 +155,7 @@ char *buf; int -#if NeedFunctionPrototypes WriteBdfHeader( struct ptobhead *head ) -#else -WriteBdfHeader(head) -struct ptobhead *head; -#endif { FILE *fp; int fd[2]; @@ -296,12 +273,7 @@ struct ptobhead *head; void -#if NeedFunctionPrototypes WriteGpfHeader( struct btophead *head ) -#else -WriteGpfHeader(head) -struct btophead *head; -#endif { fprintf(head->output, "numfonts:%d\n", head->num_chars); fprintf(head->output, "width:%d\n", head->p_width ); @@ -312,12 +284,7 @@ struct btophead *head; int -#if NeedFunctionPrototypes WritePtnToBdf( struct ptobhead *head ) -#else -WritePtnToBdf(head) -struct ptobhead *head; -#endif { int msize, swidth, rtn, i, nchar; char *zoomptn; @@ -376,12 +343,7 @@ struct ptobhead *head; int -#if NeedFunctionPrototypes putDefaultChars( struct ptobhead *head ) -#else -putDefaultChars(head ) -struct ptobhead *head; -#endif { int swidth, bytew, i, j; unsigned int posbit ; @@ -408,12 +370,7 @@ struct ptobhead *head; int -#if NeedFunctionPrototypes WritePtnToGpf( struct btophead *head ) -#else -WritePtnToGpf(head) -struct btophead *head; -#endif { int msize, rtn, i; char *zoomptn; @@ -456,16 +413,7 @@ struct btophead *head; int -#if NeedFunctionPrototypes -ReadBdfToMemory( - struct btophead *head, - char *buf -) -#else -ReadBdfToMemory(head, buf) -struct btophead *head; -char *buf; -#endif +ReadBdfToMemory(struct btophead *head, char *buf) { int code, mwidth, num_char, bsize, rtn; char *ptn; @@ -502,20 +450,11 @@ char *buf; int -#if NeedFunctionPrototypes ReadBdfToMemory_with_init( struct btophead *head, - int init_start, - int init_end, - 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 init_start, + int init_end, + char *buf) { int code, mwidth, num_char, bsize, rtn; char *ptn; @@ -555,18 +494,11 @@ char *buf; int -#if NeedFunctionPrototypes GetBdfCode( struct btophead *head, char *buf, int *code ) -#else -GetBdfCode(head, buf, code) -struct btophead *head; -char *buf; -int *code; -#endif { char *p; @@ -590,24 +522,13 @@ int *code; return(0); } - int -#if NeedFunctionPrototypes GetBdfPtn( struct btophead *head, char *buf, char *ptn, int mwidth, - int bsize -) -#else -GetBdfPtn(head, buf, ptn, mwidth, bsize) -struct btophead *head; -char *buf; -char *ptn; -int mwidth; -int bsize; -#endif + int bsize) { int skip, i, j; char *p; @@ -654,16 +575,7 @@ int bsize; int -#if NeedFunctionPrototypes -ReadGpfToMemory( - struct ptobhead *head, - char *buf -) -#else -ReadGpfToMemory(head, buf) -struct ptobhead *head; -char *buf; -#endif +ReadGpfToMemory(struct ptobhead *head, char *buf) { int code, mwidth, num_char, bsize, rtn; char *ptn; @@ -700,18 +612,7 @@ char *buf; int -#if NeedFunctionPrototypes -GetGpfCode( - struct ptobhead *head, - char *buf, - int *code -) -#else -GetGpfCode(head, buf, code) -struct ptobhead *head; -char *buf; -int *code; -#endif +GetGpfCode(struct ptobhead *head, char *buf, int *code) { char *p; @@ -735,9 +636,7 @@ int *code; return(0); } - int -#if NeedFunctionPrototypes GetGpfPtn( struct ptobhead *head, char *buf, @@ -745,14 +644,6 @@ GetGpfPtn( int mwidth, 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; char *p; @@ -788,18 +679,7 @@ int bsize; void -#if NeedFunctionPrototypes -GetBdfLinePtn( - char *mem, - char *buf, - int width -) -#else -GetBdfLinePtn(mem, buf, width) -char *mem; -char *buf; -int width; -#endif +GetBdfLinePtn(char *mem, char *buf, int width) { int i, iend, len; char *p, str[3]; @@ -831,18 +711,7 @@ int width; } void -#if NeedFunctionPrototypes -GetGpfLinePtn( - char *mem, - char *buf, - int width -) -#else -GetGpfLinePtn(mem, buf, width) -char *mem; -char *buf; -int width; -#endif +GetGpfLinePtn(char *mem, char *buf, int width) { unsigned int skip, i, iend, j; unsigned char ptn; @@ -876,20 +745,7 @@ int width; int -#if NeedFunctionPrototypes -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 +PutBdfPtn(unsigned char *ptn, int width, int height, FILE *fp) { int i, j, nbyte ; unsigned char *pbuf, x, c; @@ -920,24 +776,8 @@ FILE *fp; return(0); } - - - int -#if NeedFunctionPrototypes -PutGpfPtn( - char *ptn, - int width, - int height, - FILE *fp -) -#else -PutGpfPtn(ptn, width, height, fp) -char *ptn; -int width; -int height; -FILE *fp; -#endif +PutGpfPtn(char *ptn, int width, int height, FILE *fp) { int i, j, k, nbyte, tw; unsigned char p, *pbuf; @@ -974,24 +814,7 @@ FILE *fp; int -#if NeedFunctionPrototypes -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 +PtnZoom(char *dmem, char *smem, int sw, int sh, int dw, int dh) { int swidth; int dwidth; @@ -1031,11 +854,7 @@ int dh; static void -exline(sp, dbuf, sw, dw) -char *sp; -char *dbuf; -int sw; -int dw; +exline(char *sp, char *dbuf, int sw, int dw) { unsigned int i, bit, sval, dval, dcnt, bcnt; @@ -1065,12 +884,7 @@ int dw; char * -#if NeedFunctionPrototypes GetTmpPath( char *path ) -#else -GetTmpPath( path ) -char *path; -#endif { char *p=NULL, *sp, *buf ; int len ; @@ -1097,18 +911,12 @@ char *path; if( *sp == '/' ) *sp-- = '\0' ; sprintf( sp+1, "/%s", TEMPFILEKEY ) ; /* Get temporary file name */ - return mktemp( buf ) ; + return mkstemp( buf ); } int -#if NeedFunctionPrototypes 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 ; int i, c ; @@ -1187,12 +995,7 @@ char *wr_file ; int -#if NeedFunctionPrototypes -ChkNumString( char *str ) -#else -ChkNumString( str ) -char *str; -#endif +ChkNumString( char *str ) { char *tmp; int num; @@ -1209,7 +1012,6 @@ char *str; void -#if NeedFunctionPrototypes ErrMsgTable_AndExit( int er_no, char *snf_in, @@ -1219,16 +1021,6 @@ ErrMsgTable_AndExit( char *bdf_in, 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 ; switch(er_no) { @@ -1305,16 +1097,7 @@ char *prog_name ; void -#if NeedFunctionPrototypes -fatal_err_msg( - int er_no, - char *prog_name -) -#else -fatal_err_msg( er_no, prog_name ) -int er_no; -char *prog_name; -#endif +fatal_err_msg(int er_no, char *prog_name) { USAGE1("%s : The font file failed to be converted. ", prog_name); switch( er_no ) { @@ -1371,13 +1154,12 @@ static int sig_flg=0; #define CATCH_SIGNAL 10 void -ChatchSig() +ChatchSig(void) { sig_flg = 1; } void -#if NeedFunctionPrototypes Put_File_Create_Err_Msg( int msg_level, char *org_name, @@ -1385,14 +1167,6 @@ Put_File_Create_Err_Msg( char *save_name, 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 ) { case GPF_BUCK_UP_FAIL: @@ -1419,7 +1193,6 @@ char *com; } int -#if NeedFunctionPrototypes Make_NewFefFile( char *org_name, char *tmp_name, @@ -1428,15 +1201,6 @@ Make_NewFefFile( gid_t group, 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; char *save_name = NULL; @@ -1503,16 +1267,7 @@ char *com; int -#if NeedFunctionPrototypes -Unlink_Tmpfile( - char *file, - char *com -) -#else -Unlink_Tmpfile( file, com ) -char *file; -char *com; -#endif +Unlink_Tmpfile(char *file,char *com) { errno = 0; if ( unlink( file ) != 0 ) { @@ -1524,18 +1279,7 @@ char *com; int -#if NeedFunctionPrototypes -Chmod_File ( - char *fname, - mode_t mode, - char *com -) -#else -Chmod_File ( fname, mode, com ) -char *fname; -mode_t mode; -char *com; -#endif +Chmod_File (char *fname, mode_t mode, char *com) { errno = 0; if ( mode == 0 ) return( 0 ) ; @@ -1548,20 +1292,7 @@ char *com; int -#if NeedFunctionPrototypes -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 +Chown_File (char *fname, uid_t owner, gid_t group, char *com) { errno = 0; if ( chown (fname, owner, group) != 0) { @@ -1577,12 +1308,7 @@ char *com; int -#if NeedFunctionPrototypes -ChkPcfFontFile( char *filename ) -#else -ChkPcfFontFile( filename ) -char *filename; -#endif +ChkPcfFontFile( char *filename ) { char *suffix; @@ -1599,12 +1325,7 @@ char *filename; int -#if NeedFunctionPrototypes -ChkSnfFontFile( char *filename ) -#else -ChkSnfFontFile( filename ) -char *filename; -#endif +ChkSnfFontFile( char *filename ) { char *suffix; @@ -1621,16 +1342,7 @@ char *filename; char * -#if NeedFunctionPrototypes -get_cmd_path( - char *path, - char *cmd -) -#else -get_cmd_path( path, cmd ) -char *path; -char *cmd; -#endif +get_cmd_path(char *path, char *cmd) { char *cmd_path = NULL; struct stat st; @@ -1673,20 +1385,7 @@ char *cmd; } int -#if NeedFunctionPrototypes -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 +SetCmdPath(char *com, char **path, char *dflt_path, char *cmd) { struct stat statbuf ; char *pbuf ; diff --git a/cde/programs/dtudcfonted/mtfgui.c b/cde/programs/dtudcfonted/mtfgui.c index 02775f60..b9066713 100644 --- a/cde/programs/dtudcfonted/mtfgui.c +++ b/cde/programs/dtudcfonted/mtfgui.c @@ -39,18 +39,18 @@ #include "xoakufont.h" #include "util.h" -void CBeOblB_aEnd(); -void EHeStaT_list(); -void CBeScro(); -void EHeBulB_eMEv(); -void EHeBulB_eExp(); -void EHeBulB_dExp(); -static void EHStaT_disp(); +void CBeOblB_aEnd(Widget widget, caddr_t clientData, caddr_t callData); +void EHeStaT_list(Widget widget, int select, XEvent *e); +void CBeScro(Widget widget, caddr_t clientData, caddr_t callData); +void EHeBulB_eMEv(Widget widget, caddr_t clientData, XEvent *e); +void EHeBulB_eExp(Widget widget, caddr_t clientData, XEvent *e); +void EHeBulB_dExp(Widget widget, caddr_t clientData); +static void EHStaT_disp(Widget widget, int i); extern Resource resource; -extern int efctPtnNum(); -extern char *char_set(); +extern int efctPtnNum(void); +extern char *char_set(char *str); extern char *fullpath; extern FalFontData fullFontData; @@ -77,16 +77,15 @@ static Widget wgeStaT_form[EDLIST_MAX], * contents : displays the "User Defined Charactrer editor" window */ -static Widget CreateEditPtn(); -void OpenCB(); -void MngPtnCB(); -void CpyPtnCB(); -void CBeRecB_color(); -void CBeRecB_obj(); -void CBeOblB_aAdd(); -void CBeOblB_rCmd(); -void CBeOblB_rCmdp(); -void CBeOblB_rCan(); +static Widget CreateEditPtn(Widget owner); +void OpenCB(Widget w, XtPointer client_data, XtPointer call_data); +void MngPtnCB(void); +void CpyPtnCB(void); +void CBeRecB_obj(Widget widget, int obj, XmToggleButtonCallbackStruct *call); +void CBeOblB_aAdd(void); +void CBeOblB_rCmd(Widget widget, int proc, caddr_t callData); +void CBeOblB_rCmdp(Widget widget, int proc, caddr_t callData); +void CBeOblB_rCan(Widget widget, caddr_t clientData, caddr_t callData); /** @@ -95,12 +94,12 @@ void CBeOblB_rCan(); **/ static void -XlfdCB() +XlfdCB(void) { Widget dialog; Arg args[5]; char mess[1024]; - int n; + int n = 0; XmString cs, cs1, cs2; sprintf(mess, "%s : %s", resource.file_name, fullpath); @@ -114,7 +113,6 @@ XlfdCB() cs = XmStringConcat(cs2, cs1); XmStringFree(cs1); XmStringFree(cs2); - n = 0; XtSetArg (args[n], XmNtitle, resource.l_xlfd_title); n++; XtSetArg (args[n], XmNmessageString, cs); n++; XtSetArg (args[n], XmNdialogStyle, XmDIALOG_MODELESS); n++; @@ -126,7 +124,7 @@ XlfdCB() } static void -CodeAreaCB() +CodeAreaCB(void) { char mess[256]; char tmp[16]; @@ -169,16 +167,13 @@ CodeAreaCB() } void -ListSetLabelStr(i, str) -int i; -String str; +ListSetLabelStr(int i, String str) { SetLabelString( wgeStaT_list[i], str ); } void -ListSelectItem(i) -int i; +ListSelectItem(int i) { XtVaSetValues( wgeStaT_list[i], XmNbackground, (XtArgVal) resource.foreground, @@ -188,8 +183,7 @@ int i; } void -ListUnselectItem(i) -int i; +ListUnselectItem(int i) { XtVaSetValues( wgeStaT_list[i], XmNbackground, (XtArgVal) resource.background, @@ -199,8 +193,7 @@ int i; } void -ListSetGlyphImage( i ) -int i ; +ListSetGlyphImage( int i ) { int code ; @@ -231,9 +224,7 @@ int i ; /*ARGSUSED*/ static void -EHStaT_disp( widget, i ) -Widget widget; -int i; /* widget that have some ivent */ +EHStaT_disp( Widget widget, int i /* widget that have some ivent */ ) { ListSetGlyphImage( i ); } @@ -307,7 +298,7 @@ static ExclusiveItems draw_ex[] = { static Exclusive DrawEX = EXCLUSIVE( draw_ex ); static void -Unset() +Unset(void) { XtSetSensitive(EditBTN.w[0], False); XtSetSensitive(EditBTN.w[1], False); @@ -322,7 +313,7 @@ Unset() } void -SelectSet() +SelectSet(void) { XtSetSensitive(EditBTN.w[0], True); XtSetSensitive(EditBTN.w[1], True); @@ -335,7 +326,7 @@ SelectSet() } void -SelectUnset() +SelectUnset(void) { XtSetSensitive(EditBTN.w[0], False); XtSetSensitive(EditBTN.w[1], False); @@ -348,19 +339,19 @@ SelectUnset() } void -CopySet() +CopySet(void) { XtSetSensitive(EditBTN.w[5], True); } void -UndoSet() +UndoSet(void) { XtSetSensitive(EditBTN.w[9], True); } void -UndoUnset() +UndoUnset(void) { XtSetSensitive(EditBTN.w[9], False); } @@ -371,8 +362,7 @@ UndoUnset() **/ void -PopupEditPtn(owner) -Widget owner; +PopupEditPtn(Widget owner) { if (! editPtnW){ editPtnW = CreateEditPtn(owner); @@ -382,8 +372,7 @@ Widget owner; } static Widget -CreateEditPtn(owner) -Widget owner; +CreateEditPtn(Widget owner) { int slimax; int i; @@ -573,8 +562,7 @@ Widget owner; void -SetCodeString(code) -int code; +SetCodeString(int code) { char str[8]; @@ -590,7 +578,7 @@ int code; static void -_create_editptn_after() +_create_editptn_after(void) { int slctloc; static char dashPtn[] = {1,1}; /* Editing pane's border pattern */ @@ -667,8 +655,7 @@ _create_editptn_after() } void -UpdateMessage(str) -String str; +UpdateMessage(String str) { static Boolean nomsg = False; diff --git a/cde/programs/dtudcfonted/selectx.c b/cde/programs/dtudcfonted/selectx.c index 85906430..cd86af2f 100644 --- a/cde/programs/dtudcfonted/selectx.c +++ b/cde/programs/dtudcfonted/selectx.c @@ -74,13 +74,12 @@ extern Resource resource ; FalFontData fullFontData; -void PopupSelectXLFD() ; -static Widget CreateSelectXLFD() ; +void PopupSelectXLFD(Widget top) ; +static Widget CreateSelectXLFD(Widget top) ; -extern void xlfdPopupDialog() ; -extern int GetListsOfItems() ; +extern void xlfdPopupDialog(Widget w); -extern void ReadCB(); +extern void ReadCB(Widget w, XtPointer client_data, XtPointer call_data); Widget xlfdDialog; @@ -122,10 +121,7 @@ static Widget *button4=NULL; ***************************************************************/ static char * -spc(str, ch, count) -char * str; -char ch; -int count; +spc(char *str, char ch, int count) { char *p; p = str + strlen(str); @@ -139,7 +135,7 @@ int count; return(NULL); } -static void OpenWindowCB() +static void OpenWindowCB(void) { char *str, *p; XmStringTable st; @@ -175,10 +171,7 @@ static void OpenWindowCB() /*ARGSUSED*/ static void -OpenCancelCB( widget, clientData, callData ) -Widget widget; -caddr_t clientData; -caddr_t callData; +OpenCancelCB(Widget widget, caddr_t clientData, caddr_t callData) { extern void ForcePopdownDialog(); if ( !editPtnW ){ @@ -192,8 +185,7 @@ caddr_t callData; * create selection window view */ void -PopupSelectXLFD( top ) -Widget top ; +PopupSelectXLFD(Widget top) { if( xlfdDialog == NULL ){ @@ -207,7 +199,7 @@ Widget top ; static void -create_xlfd() +create_xlfd(void) { int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; FalFontData key; @@ -253,8 +245,7 @@ create_xlfd() } static void -udc_call(w) -Widget w; +udc_call(Widget w) { XmString label; char *moji; @@ -283,8 +274,7 @@ Widget w; } static void -sty_call(w) -Widget w; +sty_call(Widget w) { XmString label; char *moji; @@ -308,8 +298,7 @@ Widget w; } static void -wls_call(w) -Widget w; +wls_call(Widget w) { XmString label; char *moji; @@ -329,8 +318,7 @@ Widget w; } static void -hls_call(w) -Widget w; +hls_call(Widget w) { XmString label; char *moji; @@ -350,7 +338,7 @@ Widget w; } static void -button_set1() +button_set1(void) { int i, j; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; @@ -399,7 +387,7 @@ button_set1() } static void -button_set2() +button_set2(void) { int i, j; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; @@ -448,7 +436,7 @@ button_set2() } static void -button_set3() +button_set3(void) { int i, j; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; @@ -497,7 +485,7 @@ button_set3() } static void -button_set4() +button_set4(void) { int i, j; int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED; @@ -546,9 +534,7 @@ button_set4() } void -data_sort(data, count) -int *data; -int count; +data_sort(int *data, int count) { int *p1, *p2, tmp, i; @@ -565,7 +551,7 @@ int count; static void -font_init() +font_init(void) { FalFontDataList *fontlist; FalFontData *f; @@ -704,8 +690,7 @@ font_init() static Widget -CreateSelectXLFD( top ) -Widget top ; +CreateSelectXLFD(Widget top) { int n; diff --git a/cde/programs/dtudcfonted/selectxlfd.h b/cde/programs/dtudcfonted/selectxlfd.h index 585599f7..916c645d 100644 --- a/cde/programs/dtudcfonted/selectxlfd.h +++ b/cde/programs/dtudcfonted/selectxlfd.h @@ -41,8 +41,6 @@ #define XLFD_COLUMNS 38 #define KEY_COLUMNS 15 -#define PIXELSIZE 7 - /* * put data from resource database */ diff --git a/cde/programs/dtudcfonted/ufont.c b/cde/programs/dtudcfonted/ufont.c index 62be2192..1372e945 100644 --- a/cde/programs/dtudcfonted/ufont.c +++ b/cde/programs/dtudcfonted/ufont.c @@ -30,10 +30,8 @@ */ - -#define substance_source - #include +#include #include #include @@ -41,26 +39,11 @@ #include "xoakufont.h" #include "util.h" -#ifndef NO_MESSAGE_CAT -#ifdef __ultrix -#define _CLIENT_CAT_NAME "dtudcfonted.cat" -#else /* __ultrix */ #define _CLIENT_CAT_NAME "dtudcfonted" -#endif /* __ultrix */ -#ifdef _NO_PROTO -extern char *_DtGetMessage(); -#else /* _NO_PROTO */ -extern char *_DtGetMessage( - char *filename, - int set, - int n, - char *s ); -#endif /* _NO_PROTO */ +extern char *_DtGetMessage(char *filename, int set, int n, char *s); #define GETMESSAGE(set, number, string) GetMessage(set, number, string) static char * -GetMessage(set, number, string) -int set, number; -char *string; +GetMessage(int set, int number, char *string) { char *tmp, *ret; tmp = _DtGetMessage(_CLIENT_CAT_NAME, set, number, string); @@ -68,73 +51,72 @@ char *string; strcpy(ret, tmp); return (ret); } -#else /* NO_MESSAGE_CAT */ -#define GETMESSAGE(set, number, string)\ - string -#endif /* NO_MESSAGE_CAT */ /**************************************************************** * Widgets * ***************************************************************/ -/* Widget toplevel; */ +Widget toplevel; static Widget dnPopW; Widget wgeScro, editPopW; static int select_x, select_y, select_w, select_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; Pixmap arrow_pix=0; -/* - * - */ + static XtAppContext app; /* application context */ static int edpane_size=0; -void CB_set_wait_msg(); -void set_wait_msg(); - -static void OtherFontSelect(); -void drawDelCode(); -void drawDelPtn(); -static void xeg_init(); - - -static void dstrypaneEditPtn(); -void chgEdCode(); -void chgEdList(); -static void chgEdPtn(); -static void DrawRectEdPn(); -static void DrawBorderEdPn(); -static void DrawPointEdPn(); -static void DrawDpPn(); -static void DrawPointDpPn(); -static void musPoint(); -static void musLine(); -static void musCircle(); -static void musRect(); -static void musRegionProc(); -static void musPasteProc(); -static void rubLine(); -static void rubBand(); -static void rubCircle(); -static void resetEditMode(); -static void copyPatterns(); -extern String MngCodeTfValue(); -extern String CpySrcCodeTfValue(); -extern String CpyDestCodeTfValue(); -char *get_cmd_path() ; + +static void OtherFontSelect(void); +void drawDelCode(int i); +void drawDelPtn(int i); +static void xeg_init(void); + + +static void dstrypaneEditPtn(void); +void chgEdCode(int code, char mode); +void chgEdList(int statloc, int slctloc, char mode); +static void chgEdPtn(int code); +static void DrawRectEdPn(int x1, int y1, int x2, int y2); +static void DrawBorderEdPn(int x1, int y1, int x2, int y2); +static void DrawPointEdPn(int x, int y, int mode); +static void DrawDpPn(void); +static void DrawPointDpPn(int x, int y, int mode); +static void musPoint(int evtype, int px, int py); +static void musLine(int evtype, int px, int py); +static void musCircle(int evtype, int px, int py); +static void musRect(int proc, int evtype, int px, int py); +static void musRegionProc(int proc, int evtype, int px, int py); +static void musPasteProc(Widget w, XtPointer client_data, XEvent *event); +static void rubLine(int x1, int y1, int x2, int y2); +static void rubBand(int x1, int y1, int x2, int y2); +static void rubCircle(int ox, int oy, int rx, int ry); +static void resetEditMode(unsigned int flag); +static void copyPatterns(FalFontData *fdata, + int s1_code, + int s2_code, + int d1_code, + 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 copyFontData; -extern void PopupSelectXLFD(); -extern void UpdateMessage(); -extern void DispMngErrorMessage(); -extern void DispCpyErrorMessage(); -static int setRealDelArea(); +extern void PopupSelectXLFD(Widget top); +extern void UpdateMessage(String str); +extern void DispMngErrorMessage(String msg); +extern void DispCpyErrorMessage(String msg); +static int setRealDelArea(int *s_ncode, + int *e_ncode, + int *sq_start, + int *sq_end); /**************************************************************** * parameters * @@ -148,16 +130,16 @@ Resource resource; * callback routines * ***************************************************************/ -static void CancelCB(); +static void CancelCB(void); static void -ExitCB() +ExitCB(void) { exit(0); } int -efctPtnNum() +efctPtnNum(void) { int no; int sq; @@ -173,9 +155,7 @@ efctPtnNum() } void -Error_message(widget, message) -Widget widget; -char *message; +Error_message(Widget widget, char *message) { static NoticeButton is_lock[] = { NBTNARGS( ExitCB, NULL, 'E', True, False ), @@ -193,9 +173,7 @@ char *message; } void -Error_message2(widget, message) -Widget widget; -char *message; +Error_message2(Widget widget, char *message) { static NoticeButton is_lock[] = { NBTNARGS( CancelCB, NULL, 'C', True, True ) @@ -218,10 +196,7 @@ char *message; */ /*ARGSUSED*/ static void -CBmOblB_edit( widget, clientData, callData ) -Widget widget; -caddr_t clientData; -caddr_t callData; +CBmOblB_edit( Widget widget, caddr_t clientData, caddr_t callData ) { int ptn_n; int ptn_w; @@ -250,7 +225,6 @@ caddr_t callData; if( xlfdDialog != NULL ) PopdownDialog(xlfdDialog); - /* */ ptnGetInfo( &ptn_n, &ptn_w, &ptn_h ); for( i=0 ; iw2 == NULL) { @@ -210,8 +206,7 @@ TextField *textf; /*ARGSUSED*/ static void -arrow_change(w, data) -TextField *data; +arrow_change(int w, TextField *data) { if (XtIsSensitive(data->w2)) { XtSetSensitive(data->w2, False); @@ -225,14 +220,13 @@ extern char AreaStr[160]; extern FalFontData fullFontData; static void -focus(w) -Widget w; +focus(Widget w) { focus_widget = w; } static void -code_input() +code_input(void) { extern void CodeWindow(); CodeWindow(focus_widget, fullFontData.xlfdname, False); @@ -240,16 +234,16 @@ code_input() /*ARGSUSED*/ void -CreateTextField(owner, name, labelstr, data, maxlength) -Widget owner; -String name; -String labelstr; -TextField *data; -int maxlength; +CreateTextField( +Widget owner, +String name, +String labelstr, +TextField *data, +int maxlength) { Widget row, label, arrow, textfield, code; Arg args[20]; - register int n; + int n = 0; Display *disp; Window root; Pixmap mask; @@ -257,7 +251,6 @@ int maxlength; XmString xms; extern Pixmap arrow_pix; - n = 0; XtSetArg(args[n], XmNorientation, (XtArgVal)XmHORIZONTAL); n++; row = XmCreateRowColumn(owner, "row", args, n); XtManageChild(row); @@ -318,14 +311,7 @@ int maxlength; void -#if __STDC__ 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]; char buf[64]; @@ -374,7 +360,7 @@ int buttons_cnt; } static Atom -DeleteWindowAtom() +DeleteWindowAtom(void) { static Atom delatom = 0; if (! delatom){ @@ -386,26 +372,20 @@ DeleteWindowAtom() /*ARGSUSED*/ Widget -#if __STDC__ -CreateDialogAndButtons( Widget owner, String name, - void (*delcb)(), Button *btns, int btns_cnt, Widget *pop ) -#else -CreateDialogAndButtons( owner, name, delcb, btns, btns_cnt, pop ) -Widget owner; -String name; -void (*delcb)(); -Button *btns; -int btns_cnt; -Widget *pop; -#endif +CreateDialogAndButtons( +Widget owner, +String name, +void (*delcb)(), +Button *btns, +int btns_cnt, +Widget *pop) { - int n; + int n = 0; Arg args[32]; Arg arg[8]; Widget rowcol; XmString cs1, cs2, cs3; - n = 0; XtSetArg( args[n], XmNautoUnmanage, resource. dia_tm_automng ); n++; XtSetArg( args[n], XmNmarginWidth, resource.dia_tm_width ); n++; XtSetArg( args[n], XmNmarginHeight, resource.dia_tm_height ); n++; @@ -474,11 +454,7 @@ Widget *pop; /* Initialize GUI */ Widget -GuiInitialize(app, class_name, ac, av) -XtAppContext *app; -String class_name; -int *ac; -String av[]; +GuiInitialize(XtAppContext *app, String class_name, int *ac, String av[]) { Widget top; @@ -491,19 +467,18 @@ String av[]; } Widget -CreateDrawingArea( owner, name, width, height, proc, val ) -Widget owner; -String name; -int width; -int height; -void (*proc)(); -int val; +CreateDrawingArea( +Widget owner, +String name, +int width, +int height, +void (*proc)(), +int val) { - int n; + int n = 0; Arg arg[16]; Widget drawarea; - n = 0; XtSetArg(arg[n], XmNwidth, width); n++; XtSetArg(arg[n], XmNheight, height); n++; XtSetArg(arg[n], XmNresizePolicy, XmRESIZE_NONE); n++; @@ -523,10 +498,7 @@ int val; #ifndef USE_MACRO void -AddLeftAttachWidget( w, ref, offset ) -Widget w; -Widget ref; -int offset; +AddLeftAttachWidget( Widget w, Widget ref, int offset) { XtVaSetValues( w, XmNleftAttachment, XmATTACH_WIDGET, @@ -536,9 +508,7 @@ int offset; } void -AddLeftAttachForm( w, offset ) -Widget w; -int offset; +AddLeftAttachForm( Widget w, int offset ) { XtVaSetValues( w, XmNleftAttachment, XmATTACH_FORM, @@ -547,10 +517,7 @@ int offset; } void -AddTopAttachWidget( w, ref, offset ) -Widget w; -Widget ref; -int offset; +AddTopAttachWidget( Widget w, Widget ref, int offset ) { XtVaSetValues( w, XmNtopAttachment, XmATTACH_WIDGET, @@ -560,9 +527,7 @@ int offset; } void -AddTopAttachForm( w, offset ) -Widget w; -int offset; +AddTopAttachForm( Widget w, int offset ) { XtVaSetValues( w, XmNtopAttachment, XmATTACH_FORM, @@ -571,10 +536,7 @@ int offset; } void -AddRightAttachWidget( w, ref, offset ) -Widget w; -Widget ref; -int offset; +AddRightAttachWidget( Widget w, Widget ref, int offset ) { XtVaSetValues( w, XmNrightAttachment, XmATTACH_WIDGET, @@ -584,9 +546,7 @@ int offset; } void -AddRightAttachForm( w, offset ) -Widget w; -int offset; +AddRightAttachForm( Widget w, int offset ) { XtVaSetValues( w, XmNrightAttachment, XmATTACH_FORM, @@ -595,9 +555,7 @@ int offset; } void -AddBottomAttachForm( w, offset ) -Widget w; -int offset; +AddBottomAttachForm( Widget w, int offset ) { XtVaSetValues( w, XmNbottomAttachment, XmATTACH_FORM, @@ -607,8 +565,7 @@ int offset; #endif /* not USE_MACRO */ void -PopupDialog(w) -Widget w; +PopupDialog(Widget w) { if (! XtIsManaged(w)) XtManageChild(w); @@ -617,8 +574,7 @@ Widget w; } void -PopdownDialog(w) -Widget w; +PopdownDialog(Widget w) { if (XtIsManaged(w)){ XtUnmanageChild(w); @@ -626,8 +582,7 @@ Widget w; } void -ForcePopdownDialog(w) -Widget w; +ForcePopdownDialog(Widget w) { if (XtIsManaged(w)){ XtUnmanageChild(w); @@ -635,23 +590,17 @@ Widget w; } void -SetLabelString(w, str) -Widget w; -String str; +SetLabelString(Widget w, String str) { - XmString cs; - cs = XmStringCreateLocalized(str); + XmString cs = XmStringCreateLocalized(str); XtVaSetValues( w, XmNlabelString, cs, NULL); XmStringFree( cs ); } void -SetFooterString(w, str) -Widget w; -String str; +SetFooterString(Widget w, String str) { - XmString cs; - cs = XmStringCreateLocalized(str); + XmString cs = XmStringCreateLocalized(str); XtVaSetValues( w, XmNlabelString, cs, NULL); XmStringFree( cs ); XmUpdateDisplay(w); @@ -665,10 +614,7 @@ String str; static Widget notice=NULL; static void -format_str(st, charcnt , str) -Widget st; -int charcnt ; -char *str; +format_str(Widget st, int charcnt , char *str) { int i ; char *s, *p; @@ -699,15 +645,14 @@ char *str; XmStringFree(cs); } -void _unmap() +void _unmap(void) { if (notice && XtIsManaged(notice)){ XtUnmanageChild(notice); } } -static void _destroy(w) -Widget w; +static void _destroy(Widget w) { if (w){ XtDestroyWidget(w); @@ -720,20 +665,19 @@ Widget w; /*ARGSUSED*/ void -PopupNotice( owner, message, type, button, do_format, title ) -Widget owner; -char *message; -unsigned char type; -NButton *button; -Boolean do_format; -String title; +PopupNotice( +Widget owner, +char *message, +unsigned char type, +NButton *button, +Boolean do_format, +String title) { Widget label, help, cancel; - int n; + int n = 0; Arg args[32]; XmString cs1, cs2, cs3; - n = 0; XtSetArg(args[n], XmNtitle, title ); n++; XtSetArg(args[n], XmNnoResize, resource.pop_resize ); n++; XtSetArg(args[n], XmNminimizeButtons, resource.pop_minimize ); n++; @@ -799,9 +743,7 @@ String title; /*ARGSUSED*/ static void -_layout_centerEH(w, clientdata) -Widget w; -XtPointer clientdata; +_layout_centerEH(Widget w, XtPointer clientdata) { Widget *child; int num; @@ -822,20 +764,19 @@ XtPointer clientdata; /*ARGSUSED*/ Widget -CreateTemplateDialog( w, message, type, button, title, pop ) -Widget w; -char *message; -unsigned char type; -NButton *button; -String title; -Widget *pop; +CreateTemplateDialog( +Widget w, +char *message, +unsigned char type, +NButton *button, +String title, +Widget *pop) { - int n; + int n = 0; Arg args[32]; XmString cs, cs1=NULL, cs2=NULL, cs3=NULL; Widget brtnb; - n = 0; cs = XmStringCreateLocalized(message); XtSetArg(args[n], XmNnoResize, resource.temp_resize ); n++; XtSetArg(args[n], XmNminimizeButtons, resource.temp_minimize ); n++; @@ -884,9 +825,7 @@ Widget *pop; void -AddDeleteProc(w, delcb) -Widget w; -void (*delcb)(); +AddDeleteProc(Widget w, void (*delcb)()) { Atom del = DeleteWindowAtom(); XmAddWMProtocols( w, &del, 1); @@ -894,38 +833,33 @@ void (*delcb)(); } void -AddPopupProc(w, popupcb) -Widget w; -void (*popupcb)(); +AddPopupProc(Widget w, void (*popupcb)()) { XtAddCallback(XtParent(w), XmNpopupCallback, popupcb, 0); } void -AddDestroyProc(w, destroycb) -Widget w; -void (*destroycb)(); +AddDestroyProc(Widget w, void (*destroycb)()) { XtAddCallback(XtParent(w), XmNdestroyCallback, destroycb, 0); } Widget -CreateMenuBarAndFooterMessageForm(owner, name, buttons, bcnt, pop, footer) -Widget owner; -String name; -MButton *buttons; -int bcnt; -Widget *pop; -Widget *footer; +CreateMenuBarAndFooterMessageForm( +Widget owner, +String name, +MButton *buttons, +int bcnt, +Widget *pop, +Widget *footer) { Widget menuBar, form; Widget footerFrame, footerForm, footerLabel, sep, casBtn, baseForm; XmString cs; char buf[64]; Arg arg[20]; - int n, i; + int i, n = 0; - n = 0; XtSetArg( arg[n], XmNiconName, name ); n++; XtSetArg( arg[n], XmNdeleteResponse, XmUNMAP ); n++; XtSetArg( arg[n], XmNmwmFunctions, @@ -1010,23 +944,18 @@ Widget *footer; } Widget -GetMenuWidget( buttons, buttons_num ) -MButton *buttons; -int buttons_num; +GetMenuWidget( MButton *buttons, int buttons_num ) { return(buttons->items[buttons_num].menu); } Widget -CreateForm( owner, name ) -Widget owner; -String name; +CreateForm( Widget owner, String name ) { Widget form; - int n; + int n = 0; Arg arg[8]; - n=0; form = XmCreateForm( owner, name, arg, n ); XtManageChild(form); return(form); @@ -1034,14 +963,11 @@ String name; /*ARGSUSED*/ Widget -CreateLabel( owner, name, str ) -Widget owner; -String name; -String str; +CreateLabel( Widget owner, String name, String str ) { Widget label; Arg arg[2]; - int n=0; + int n = 0; XmString cs = XmStringCreateLocalized(str); XtSetArg( arg[n], XmNlabelString, cs); n++; label = XmCreateLabel( owner, "label", arg, n); @@ -1052,17 +978,11 @@ String str; /*ARGSUSED*/ Widget -CreateFrame(owner, name, type, thickness) -Widget owner; -String name; -XtPointer type; -XtPointer thickness; +CreateFrame(Widget owner, String name, XtPointer type, XtPointer thickness) { Widget frame; Arg args[20]; - int n; - - n = 0; + int n = 0; XtSetArg(args[n], XmNresizable, resource.frame_resize ); n++; XtSetArg(args[n], XmNshadowType, type); n++; XtSetArg(args[n], XmNshadowThickness , thickness); n++; @@ -1073,19 +993,17 @@ XtPointer thickness; /*ARGSUSED*/ Widget -CreateRowColumn(owner, name, layout, space, marginw, marginh) -Widget owner; -String name; -int layout; -int space; -int marginw; -int marginh; +CreateRowColumn( +Widget owner, +String name, +int layout, +int space, +int marginw, +int marginh) { Widget rc; Arg args[20]; - int n; - - n = 0; + int n = 0; XtSetArg(args[n], XmNorientation, layout); n++; XtSetArg(args[n], XmNspacing, space); n++; XtSetArg(args[n], XmNmarginWidth, marginw); n++; @@ -1097,20 +1015,19 @@ int marginh; /*ARGSUSED*/ Widget -CreateScrollBar( owner, name, height, val, min, max, proc ) -Widget owner; -String name; -int height; -int val; -int min; -int max; -void (*proc)(); +CreateScrollBar( +Widget owner, +String name, +int height, +int val, +int min, +int max, +void (*proc)()) { Widget sc; - int n; + int n = 0; Arg arg[16]; - n = 0; XtSetArg( arg[n], XmNsliderSize, (XtArgVal)val ); n++; XtSetArg( arg[n], XmNpageIncrement, (XtArgVal)val ); n++; XtSetArg( arg[n], XmNmaximum, (XtArgVal)max ); n++; @@ -1124,29 +1041,25 @@ void (*proc)(); /*ARGSUSED*/ static void -_scbase_cb( w, proc, calldata ) -Widget w; -void (*proc)(); -XmScrollBarCallbackStruct *calldata; +_scbase_cb( Widget w, void (*proc)(), XmScrollBarCallbackStruct *calldata ) { (*proc)(calldata->value); } Widget -CreateScrollBase( owner, name, min, max, val, vcnt, sbproc ) -Widget owner; -String name; -int min; -int max; -int val; -int vcnt; -void (*sbproc)(); +CreateScrollBase( +Widget owner, +String name, +int min, +int max, +int val, +int vcnt, +void (*sbproc)()) { - int n; + int n = 0; Arg arg[16]; Widget base, frame, rwclm, sc; - n=0; XtSetArg( arg[n], XmNwidth, resource.scll_fr_width ); n++; base = XmCreateForm( owner, name, arg, n ); XtManageChild( base ); diff --git a/cde/programs/dtudcfonted/util.h b/cde/programs/dtudcfonted/util.h index d81f4545..057a4acc 100644 --- a/cde/programs/dtudcfonted/util.h +++ b/cde/programs/dtudcfonted/util.h @@ -29,69 +29,9 @@ * 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 #include -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 RowMarginWidth 11 #define MarginHeight 11 @@ -264,4 +204,131 @@ typedef struct _TextField { XmNbottomAttachment, XmATTACH_FORM, \ XmNbottomOffset, offset, \ 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 */ diff --git a/cde/programs/dtudcfonted/xoakufont.h b/cde/programs/dtudcfonted/xoakufont.h index 8ff359d3..6d126152 100644 --- a/cde/programs/dtudcfonted/xoakufont.h +++ b/cde/programs/dtudcfonted/xoakufont.h @@ -30,58 +30,70 @@ */ - #include "fssxeg.h" -extern Widget CreateOblB(); -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 writeSNF(); -extern int ptnClose(); -extern int ptnAdd(); -extern int ptnGet(); -extern int ptnSense(); -extern int ptnDel(); -extern int GetInfo(); -extern int ptnSqToNo(); -extern int ptnNoToSq(); -extern int noToCode(); -extern int noToCode2(); -extern int codeToNo(); -extern int codeToNo2(); -extern int codeCheck(); -extern int codeCheck2(); -extern void bitSetInfo(); -extern void bitSet(); -extern void bitReset(); -extern int bitRead(); -extern void bitPtnClear(); -extern void bitPtnCopy(); -extern int bitDrawLine(); -extern int bitDrawRect(); -extern int bitDrawCls(); -extern int bitDrawSet(); -extern int bitDrawRev(); -extern int bitDrawCpy(); -extern int bitDrawMov(); -extern int bitDrawRoll(); -extern int bitDrawSymV(); -extern int bitDrawSymH(); +extern Widget CreateLabel(Widget owner, String name, String str); + +extern int readSNF(FalFontData **fdata, + int *width, + int *height, + char *err); +extern int writeSNF(int restart, int *err); +extern int ptnClose(void); +extern int ptnAdd(int code, char *ptn); +extern int ptnGet(int code, char *ptn); +extern int ptnSense(int code); +extern int ptnDel(int code); +extern int ptnSqToNo(int num); +extern int ptnNoToSq(int ncode); +extern int noToCode(int sno); +extern int codeToNo(int code); +extern int codeCheck(int code); +extern void bitSetInfo(int width, int height); +extern void bitSet(char *ptn, int cx, int cy); +extern void bitReset(char *ptn, int cx, int cy); +extern int bitRead(char *ptn, int cx, int cy); +extern void bitPtnClear(char *ptn); +extern void bitPtnCopy(char *d_ptn, char *s_ptn); +extern int bitDrawLine(char *ptn, + int x1, + int y1, + int x2, + int y2, + int mode); +extern int bitDrawRect(char *ptn, + int x, + int y, + int width, + 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 SetString(w,s) UpdateMessage((s)) - #define PROC_POINT 0 #define PROC_LINE 1 #define PROC_RECT 2 @@ -123,20 +135,9 @@ extern int bitDrawSymH(); #define SET_SYSTEM 5 - #define MG_MAXSIZE 100 - -#ifdef DEBUG -#define Dprintf2 printf -#define Dprintf printf -#else -#define Dprintf2 -#define Dprintf -#endif - - /********************************************************************** structure **********************************************************************/ @@ -254,58 +255,23 @@ typedef struct _FontInf { **********************************************************************/ -#ifdef substance_source -#define ex -#define I(x) =(x) -#else -#define ex extern -#define I(x) -#endif /* substance_source */ - -ex Widget toplevel I(NULL); - -ex Widget editPtnW I(NULL); -ex Widget cpyPtnW I(NULL); -ex Widget mngPtnW I(NULL); - -ex EditChar edg -#ifdef substance_source -={ 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 +Widget toplevel; + +Widget editPtnW; +Widget cpyPtnW; +Widget mngPtnW; + +EditChar edg; +EditList edlist; +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 */ + +EditPtnInf em; +CopyPtnInf cpm; /* @@ -314,91 +280,4 @@ ex CopyPtnInf cpm #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 */ - /**********/ diff --git a/cde/programs/dtudcfonted/xutil.c b/cde/programs/dtudcfonted/xutil.c index d6646846..b4e2e28e 100644 --- a/cde/programs/dtudcfonted/xutil.c +++ b/cde/programs/dtudcfonted/xutil.c @@ -54,7 +54,7 @@ /* * parameters */ -void xlfdPopupDialog() ; +void xlfdPopupDialog(Widget w); extern int getmask ; @@ -73,8 +73,7 @@ extern Widget slctBLabel[BUTTONITEMS], */ void -xlfdPopupDialog(w) -Widget w; +xlfdPopupDialog(Widget w) { if (! XtIsManaged(w)) XtManageChild(w);