diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:49:23 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:49:23 +0000 |
commit | 1952210eda8c22ca34704894290e9a39ee96ecb4 (patch) | |
tree | 1375ae1eeb5242441c3a09ddde966af9e764e30c | |
parent | e621300441be997039c5f1abadd92fc3bab733f8 (diff) |
XFree86 4.3.0.1xf86-4_3_0_1PRE_xf86-4_3_0_1
-rw-r--r-- | psgeom.c | 168 | ||||
-rw-r--r-- | utils.c | 105 | ||||
-rw-r--r-- | utils.h | 34 | ||||
-rw-r--r-- | xkbprint.c | 34 | ||||
-rw-r--r-- | xkbprint.man | 9 |
5 files changed, 140 insertions, 210 deletions
@@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbprint/psgeom.c,v 1.5 2001/07/25 15:05:25 dawes Exp $ */ #define XK_TECHNICAL #define XK_PUBLISHING @@ -37,6 +38,7 @@ #include <X11/extensions/XKM.h> #include <X11/extensions/XKBfile.h> #include <X11/keysym.h> +#include <X11/Xutil.h> #if defined(sgi) #include <malloc.h> @@ -44,9 +46,7 @@ #define DEBUG_VAR_NOT_LOCAL #define DEBUG_VAR debugFlags -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #include "utils.h" #include "xkbprint.h" @@ -114,6 +114,7 @@ typedef struct { } KeyTop; #define DFLT_LABEL_FONT "Helvetica-Narrow-Bold" +#define DFLT_LABEL_FONT_SIZE 10 /***====================================================================***/ @@ -128,10 +129,7 @@ static PSFontDef internalFonts[] = { static int nInternalFonts = (sizeof(internalFonts)/sizeof(PSFontDef)); static void -ListInternalFonts(out,first,indent) - FILE * out; - int first; - int indent; +ListInternalFonts(FILE *out, int first, int indent) { register int i,n,nThisLine; @@ -158,9 +156,7 @@ register int i,n,nThisLine; } static Bool -PSIncludeFont(out,font) - FILE *out; - char *font; +PSIncludeFont(FILE *out, char *font) { char ** pstr; register int i; @@ -182,10 +178,8 @@ register int i; return False; } -extern Bool -DumpInternalFont(out,fontName) - FILE * out; - char * fontName; +Bool +DumpInternalFont(FILE *out, char *fontName) { if (strcmp(fontName,"IsoKeyCaps")!=0) { uError("No internal font named \"%s\"\n",fontName); @@ -201,10 +195,7 @@ DumpInternalFont(out,fontName) /***====================================================================***/ static void -PSColorDef(out,state,color) - FILE * out; - PSState * state; - XkbColorPtr color; +PSColorDef(FILE *out, PSState *state, XkbColorPtr color) { int tmp; @@ -243,14 +234,7 @@ int tmp; } static void -#if NeedFunctionPrototypes PSSetColor(FILE *out,PSState *state,int color) -#else -PSSetColor(out,state,color) - FILE * out; - PSState * state; - int color; -#endif { if ((state->args->wantColor)&&(state->color!=color)) { fprintf(out,"C%03d %% set color\n",color); @@ -260,18 +244,14 @@ PSSetColor(out,state,color) } static void -PSGSave(out,state) - FILE * out; - PSState * state; +PSGSave(FILE *out, PSState *state) { fprintf(out,"gsave\n"); return; } static void -PSGRestore(out,state) - FILE * out; - PSState * state; +PSGRestore(FILE *out, PSState *state) { fprintf(out,"grestore\n"); state->color= -1; @@ -281,10 +261,7 @@ PSGRestore(out,state) } static void -PSShapeDef(out,state,shape) - FILE * out; - PSState * state; - XkbShapePtr shape; +PSShapeDef(FILE *out, PSState *state, XkbShapePtr shape) { int o,p; XkbOutlinePtr ol; @@ -418,8 +395,7 @@ typedef struct { } FontStuff; static void -ClearFontStuff(stuff) - FontStuff * stuff; +ClearFontStuff(FontStuff *stuff) { if (stuff && stuff->foundry) uFree(stuff->foundry); @@ -428,9 +404,7 @@ ClearFontStuff(stuff) } static Bool -CrackXLFDName(name,stuff) - char * name; - FontStuff * stuff; +CrackXLFDName(char *name, FontStuff *stuff) { char *tmp; if ((name==NULL)||(stuff==NULL)) @@ -500,13 +474,7 @@ BAILOUT: } static void -#if NeedFunctionPrototypes -PSSetUpForLatin1(FILE *out,PSState *state) -#else -PSSetUpForLatin1(out,state) - FILE * out; - PSState * state; -#endif +PSSetUpForLatin1(FILE *out, PSState *state) { fprintf(out,"save\n"); fprintf(out,"/ISOLatin1Encoding where {pop save true}{false} ifelse\n"); @@ -562,9 +530,7 @@ PSSetUpForLatin1(out,state) } static void -PSReencodeLatin1Font(out,font) - FILE *out; - char *font; +PSReencodeLatin1Font(FILE *out, char *font) { fprintf(out,"/%s findfont reencodeISO-1\n",font); fprintf(out," /%s-8859-1 exch definefont pop\n",font); @@ -572,9 +538,7 @@ PSReencodeLatin1Font(out,font) } static void -PSSetUpFonts(out,textFont,size) - FILE * out; - char * textFont; +PSSetUpFonts(FILE *out, char *textFont, int size) { fprintf(out,"/F%d { /%s findfont exch scalefont setfont } def\n", FONT_TEXT,textFont); @@ -588,12 +552,7 @@ PSSetUpFonts(out,textFont,size) } static void -PSSetFont(out,state,font,size,pts) - FILE * out; - PSState * state; - int font; - int size; - int pts; +PSSetFont(FILE *out, PSState *state, int font, int size, int pts) { if ((state->font!=font)||(state->fontSize!=size)) { fprintf(out,"%d %sF%d\n",size,(pts?"pts ":""),font); @@ -605,9 +564,7 @@ PSSetFont(out,state,font,size,pts) static void -PSProlog(out,state) - FILE * out; - PSState * state; +PSProlog(FILE *out, PSState *state) { register int i; @@ -717,15 +674,13 @@ register int i; if (state->args->label==LABEL_SYMBOLS) { PSIncludeFont(out,"IsoKeyCaps"); } - PSSetUpFonts(out,DFLT_LABEL_FONT); + PSSetUpFonts(out,DFLT_LABEL_FONT, DFLT_LABEL_FONT_SIZE); fprintf(out,"%%%%EndProlog\n"); return; } static void -PSFileTrailer(out,state) - FILE * out; - PSState * state; +PSFileTrailer(FILE *out, PSState *state) { fprintf(out,"restore\n"); if (!state->args->wantEPS) @@ -739,9 +694,7 @@ PSFileTrailer(out,state) } static void -PSPageSetup(out,state,drawBorder) - FILE * out; - PSState * state; +PSPageSetup(FILE *out, PSState *state, Bool drawBorder) { XkbGeometryPtr geom; @@ -811,9 +764,7 @@ XkbGeometryPtr geom; } static void -PSPageTrailer(out,state) - FILE * out; - PSState * state; +PSPageTrailer(FILE *out, PSState *state) { char * name; XkbDescPtr xkb; @@ -942,11 +893,8 @@ int p,baseline; return; } -void -PSDoodad(out,state,doodad) - FILE * out; - PSState * state; - XkbDoodadPtr doodad; +static void +PSDoodad(FILE *out, PSState *state, XkbDoodadPtr doodad) { XkbDescPtr xkb; char *name,*dname; @@ -1052,13 +1000,9 @@ int sz,leading; /***====================================================================***/ -Bool -PSKeycapsSymbol(sym,buf,font_rtrn,sz_rtrn,state) - KeySym sym; - unsigned char * buf; - int * font_rtrn; - int * sz_rtrn; - PSState * state; +static Bool +PSKeycapsSymbol(KeySym sym, unsigned char *buf, + int *font_rtrn, int *sz_rtrn, PSState *state) { if (state->args->wantSymbols==NO_SYMBOLS) return False; @@ -1215,13 +1159,9 @@ PSKeycapsSymbol(sym,buf,font_rtrn,sz_rtrn,state) return False; } -Bool -PSNonLatin1Symbol(sym,buf,font_rtrn,sz_rtrn,state) - KeySym sym; - unsigned char * buf; - int * font_rtrn; - int * sz_rtrn; - PSState * state; +static Bool +PSNonLatin1Symbol(KeySym sym, unsigned char *buf, + int *font_rtrn, int *sz_rtrn, PSState *state) { if (state->args->wantSymbols==NO_SYMBOLS) return False; @@ -1311,9 +1251,7 @@ PSNonLatin1Symbol(sym,buf,font_rtrn,sz_rtrn,state) } static KeySym -CheckSymbolAlias(sym,state) - KeySym sym; - PSState * state; +CheckSymbolAlias(KeySym sym, PSState *state) { if (XkbKSIsKeypad(sym)) { if ((sym>=XK_KP_0)&&(sym<=XK_KP_9)) @@ -1371,12 +1309,8 @@ CheckSymbolAlias(sym,state) return sym; } -Bool -FindKeysymsByName(xkb,name,state,top) - XkbDescPtr xkb; - char * name; - PSState * state; - KeyTop * top; +static Bool +FindKeysymsByName(XkbDescPtr xkb, char *name, PSState *state, KeyTop *top) { static unsigned char buf[30]; int kc; @@ -1396,7 +1330,7 @@ int eG,nG,gI,l,g; nG= XkbKeyNumGroups(xkb,kc); gI= XkbKeyGroupInfo(xkb,kc); if ((state->args->wantDiffs)&&(eG>=XkbKeyNumGroups(xkb,kc))) - return; + return False; /* XXX was a return with no value */ if (nG==0) { return False; } @@ -1439,7 +1373,7 @@ int eG,nG,gI,l,g; if (sym=='(') sprintf((char *)buf,"\\("); else if (sym==')') sprintf((char *)buf,"\\)"); else if (sym=='\\') sprintf((char *)buf,"\\\\"); - else sprintf((char *)buf,"%c",sym); + else sprintf((char *)buf,"%c",(char)sym); top->font[(g*2)+l]= FONT_LATIN1; top->size[(g*2)+l]= SZ_MEDIUM; switch (buf[0]) { @@ -1461,7 +1395,7 @@ int eG,nG,gI,l,g; char *tmp; tmp= XKeysymToString(sym); if (tmp!=NULL) strcpy((char *)buf,tmp); - else sprintf((char *)buf,"(%d)",sym); + else sprintf((char *)buf,"(%ld)",sym); top->font[(g*2)+l]= FONT_LATIN1; if (strlen((char *)buf)<9) top->size[(g*2)+l]= SZ_SMALL; @@ -1483,12 +1417,8 @@ int eG,nG,gI,l,g; return True; } -void -PSDrawLabel(out,label,x,y,w,h) - FILE * out; - char * label; - int x,y; - int w,h; +static void +PSDrawLabel(FILE *out, char *label, int x, int y, int w, int h) { fprintf(out,"%d %d (%s) centeroffset\n",w,h,label); fprintf(out,"%d add exch\n",y); @@ -1505,13 +1435,9 @@ PSDrawLabel(out,label,x,y,w,h) #define RIGHT_COL 1 #define CENTER_COL 2 -PSLabelKey(out,state,top,x,y,bounds,kc,btm) - FILE * out; - PSState * state; - KeyTop * top; - int x,y; - XkbBoundsPtr bounds; - int kc,btm; +static void +PSLabelKey(FILE *out, PSState *state, KeyTop *top, int x, int y, + XkbBoundsPtr bounds, int kc, int btm) { char keycode[10]; int w,h,i; @@ -1640,11 +1566,8 @@ int sym_col[NLABELS]; return; } -void -PSSection(out,state,section) - FILE * out; - PSState * state; - XkbSectionPtr section; +static void +PSSection(FILE *out, PSState *state, XkbSectionPtr section) { int r,offset; XkbRowPtr row; @@ -1803,10 +1726,7 @@ XkbDescPtr xkb; } Bool -GeometryToPostScript(out,pResult,args) - FILE * out; - XkbFileInfo * pResult; - XKBPrintArgs * args; +GeometryToPostScript(FILE *out, XkbFileInfo *pResult, XKBPrintArgs *args) { XkbDrawablePtr first,draw; PSState state; @@ -25,14 +25,11 @@ * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. \*/ +/* $XFree86: xc/programs/xkbprint/utils.c,v 3.5 2001/07/25 15:05:25 dawes Exp $ */ #include "utils.h" #include <ctype.h> -#ifndef X_NOT_STDC_ENV -#include <stdlib.h> -#else -char *malloc(); -#endif +#include <stdlib.h> /***====================================================================***/ @@ -102,7 +99,7 @@ uFree(ptr) /*** FUNCTION ENTRY TRACKING ***/ /***====================================================================***/ -static FILE *entryFile= stderr; +static FILE *entryFile= NULL; int uEntryLevel; Boolean @@ -123,18 +120,18 @@ uSetEntryFile(name) } void -uEntry(l,s,a1,a2,a3,a4,a5,a6,a7,a8) -int l; -char *s; -Opaque a1,a2,a3,a4,a5,a6,a7,a8; +uEntry(int l, char *s,...) { int i; +va_list ap; + va_start(ap, s); for (i=0;i<uEntryLevel;i++) { putc(' ',entryFile); } - fprintf(entryFile,s,a1,a2,a3,a4,a5,a6,a7,a8); + vfprintf(entryFile,s,ap); uEntryLevel+= l; + va_end(ap); return; } @@ -158,7 +155,7 @@ int i; /*** PRINT FUNCTIONS ***/ /***====================================================================***/ - FILE *uDebugFile= stderr; + FILE *uDebugFile= NULL; int uDebugIndentLevel= 0; int uDebugIndentSize= 4; @@ -180,37 +177,39 @@ uSetDebugFile(name) } void -uDebug(s,a1,a2,a3,a4,a5,a6,a7,a8) -char *s; -Opaque a1,a2,a3,a4,a5,a6,a7,a8; +uDebug(char *s,...) { int i; +va_list ap; + va_start(ap, s); for (i=(uDebugIndentLevel*uDebugIndentSize);i>0;i--) { putc(' ',uDebugFile); } - fprintf(uDebugFile,s,a1,a2,a3,a4,a5,a6,a7,a8); + vfprintf(uDebugFile,s,ap); fflush(uDebugFile); + va_end(ap); return; } void -uDebugNOI(s,a1,a2,a3,a4,a5,a6,a7,a8) -char *s; -Opaque a1,a2,a3,a4,a5,a6,a7,a8; +uDebugNOI(char *s,...) { - fprintf(uDebugFile,s,a1,a2,a3,a4,a5,a6,a7,a8); +va_list ap; + + va_start(ap, s); + vfprintf(uDebugFile,s,ap); fflush(uDebugFile); + va_end(ap); return; } /***====================================================================***/ -static FILE *errorFile= stderr; +static FILE *errorFile= NULL; Boolean -uSetErrorFile(name) - char *name; +uSetErrorFile(char *name) { if ((errorFile!=NULL)&&(errorFile!=stderr)) { fprintf(errorFile,"switching to %s\n",name?name:"stderr"); @@ -226,65 +225,75 @@ uSetErrorFile(name) } void -uInformation(s,a1,a2,a3,a4,a5,a6,a7,a8) -char *s; -Opaque a1,a2,a3,a4,a5,a6,a7,a8; +uInformation(char *s,...) { - fprintf(errorFile,s,a1,a2,a3,a4,a5,a6,a7,a8); + va_list ap; + + va_start(ap, s); + vfprintf(errorFile,s,ap); fflush(errorFile); + va_end(ap); return; } /***====================================================================***/ void -uAction(s,a1,a2,a3,a4,a5,a6,a7,a8) -char *s; -Opaque a1,a2,a3,a4,a5,a6,a7,a8; +uAction(char *s,...) { + va_list ap; + + va_start(ap, s); fprintf(errorFile," "); - fprintf(errorFile,s,a1,a2,a3,a4,a5,a6,a7,a8); + vfprintf(errorFile,s,ap); fflush(errorFile); + va_end(ap); return; } /***====================================================================***/ void -uWarning(s,a1,a2,a3,a4,a5,a6,a7,a8) -char *s; -Opaque a1,a2,a3,a4,a5,a6,a7,a8; +uWarning(char *s,...) { + va_list ap; + + va_start(ap, s); fprintf(errorFile,"Warning: "); - fprintf(errorFile,s,a1,a2,a3,a4,a5,a6,a7,a8); + vfprintf(errorFile,s,ap); fflush(errorFile); + va_end(ap); return; } /***====================================================================***/ void -uError(s,a1,a2,a3,a4,a5,a6,a7,a8) -char *s; -Opaque a1,a2,a3,a4,a5,a6,a7,a8; +uError(char *s,...) { + va_list ap; + + va_start(ap, s); fprintf(errorFile,"Error: "); - fprintf(errorFile,s,a1,a2,a3,a4,a5,a6,a7,a8); + vfprintf(errorFile,s,ap); fflush(errorFile); + va_end(ap); return; } /***====================================================================***/ void -uFatalError(s,a1,a2,a3,a4,a5,a6,a7,a8) -char *s; -Opaque a1,a2,a3,a4,a5,a6,a7,a8; +uFatalError(char *s,...) { + va_list ap; + + va_start(ap, s); fprintf(errorFile,"Fatal Error: "); - fprintf(errorFile,s,a1,a2,a3,a4,a5,a6,a7,a8); + vfprintf(errorFile,s,ap); fprintf(errorFile," Exiting\n"); fflush(errorFile); + va_end(ap); exit(1); /* NOTREACHED */ } @@ -292,13 +301,15 @@ Opaque a1,a2,a3,a4,a5,a6,a7,a8; /***====================================================================***/ void -uInternalError(s,a1,a2,a3,a4,a5,a6,a7,a8) -char *s; -Opaque a1,a2,a3,a4,a5,a6,a7,a8; +uInternalError(char *s,...) { + va_list ap; + + va_start(ap, s); fprintf(errorFile,"Internal error: "); - fprintf(errorFile,s,a1,a2,a3,a4,a5,a6,a7,a8); + vfprintf(errorFile,s,ap); fflush(errorFile); + va_end(ap); return; } @@ -27,6 +27,7 @@ * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. \*/ +/* $XFree86: xc/programs/xkbprint/utils.h,v 1.5 2001/07/25 15:05:25 dawes Exp $ */ /***====================================================================***/ @@ -34,12 +35,11 @@ #include <X11/Xos.h> #include <X11/Xfuncproto.h> #include <X11/Xfuncs.h> +#include <stdarg.h> +#include <stddef.h> _XFUNCPROTOBEGIN -#ifndef NULL -#define NULL 0 -#endif #ifndef NUL #define NUL '\0' @@ -74,12 +74,14 @@ typedef int Comparison; #define comparisonText(c) ((c)?((c)<0?"Less":"Greater"):"Equal") #endif +#ifdef notyet typedef union { int i; unsigned u; void *p; - void *(*fp)(); + void *(*fp)(); } Union; +#endif /***====================================================================***/ @@ -128,17 +130,13 @@ extern void uFree( /***====================================================================***/ -extern Boolean uSetErrorFile( -#if NeedFunctionPrototypes - char * /* name */ -#endif -); -extern void uInformation(); -extern void uAction(); -extern void uWarning(); -extern void uError(); -extern void uFatalError(); -extern void uInternalError(); +extern Boolean uSetErrorFile ( char *name ); +extern void uInformation ( char *s, ...); +extern void uAction ( char *s, ... ); +extern void uWarning ( char *s, ... ); +extern void uError ( char *s, ... ); +extern void uFatalError(char *s,...); +extern void uInternalError ( char *s, ... ); /***====================================================================***/ @@ -196,8 +194,8 @@ extern #endif unsigned int DEBUG_VAR; -extern void uDebug(); -extern void uDebugNOI(); /* no indent */ +extern void uDebug( char *s, ... ); +extern void uDebugNOI( char *s, ... ); /* no indent */ extern Boolean uSetDebugFile( #if NeedFunctionPrototypes char *name @@ -241,7 +239,7 @@ extern Boolean uSetEntryFile( char *name #endif ); -extern void uEntry(); +extern void uEntry(int l, char *s, ... ); extern void uExit( #if NeedFunctionPrototypes int l,char *rtVal @@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbprint/xkbprint.c,v 3.9 2001/07/25 15:05:25 dawes Exp $ */ #include <stdio.h> #include <ctype.h> @@ -42,9 +43,7 @@ #define DEBUG_VAR_NOT_LOCAL #define DEBUG_VAR debugFlags -#ifndef X_NOT_STDC_ENV #include <stdlib.h> -#endif #include "utils.h" #include "xkbprint.h" @@ -60,11 +59,13 @@ #define INPUT_XKB 1 #define INPUT_XKM 2 +#ifdef notyet static char *fileTypeExt[] = { "XXX", "xkm", "xkb" }; +#endif static unsigned inputFormat= INPUT_UNKNOWN; static unsigned outputFormat= WANT_DEFAULT; @@ -83,10 +84,8 @@ static XKBPrintArgs args; /***====================================================================***/ -void -Usage(argc,argv) - int argc; - char * argv[]; +static void +Usage(int argc, char *argv[]) { fprintf(stderr,"Usage: %s [options] input-file [ output-file ]\n",argv[0]); fprintf(stderr,"Legal options:\n"); @@ -134,10 +133,8 @@ fprintf(stderr," be \"all\", \"none\" or \"common\" (default)\n"); /***====================================================================***/ -Bool -parseArgs(argc,argv) - int argc; - char * argv[]; +static Bool +parseArgs(int argc, char *argv[]) { register int i; @@ -544,10 +541,8 @@ register int i; return True; } -Display * -GetDisplay(program,dpyName) - char * program; - char * dpyName; +static Display * +GetDisplay(char *program, char *dpyName) { int mjr,mnr,error; Display *dpy; @@ -586,19 +581,22 @@ Display *dpy; /***====================================================================***/ +#ifdef notyet #define MAX_INCLUDE_OPTS 10 static char *includeOpt[MAX_INCLUDE_OPTS]; static int numIncludeOpts = 0; +#endif int -main(argc,argv) - int argc; - char * argv[]; +main(int argc, char *argv[]) { FILE * file; int ok; XkbFileInfo result; + uSetEntryFile(NullString); + uSetDebugFile(NullString); + uSetErrorFile(NullString); if (!parseArgs(argc,argv)) exit(1); #ifdef DEBUG @@ -706,7 +704,7 @@ XkbFileInfo result; ok= 0; } if (ok) { - FILE *out; + FILE *out = NULL; if (setlocale(LC_ALL,(wantLocale))==NULL) { if (wantLocale!=NULL) { uWarning("Couldn't change to locale %s\n",wantLocale); diff --git a/xkbprint.man b/xkbprint.man index 19fdb92..2e81645 100644 --- a/xkbprint.man +++ b/xkbprint.man @@ -1,5 +1,8 @@ .\" $Xorg: xkbprint.man,v 1.3 2000/08/17 19:54:50 cpqbld Exp $ -.TH XKBPRINT 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xkbprint/xkbprint.man,v 1.7 2001/01/27 18:21:16 dawes Exp $ +.\" +.TH XKBPRINT 1 __xorgversion__ .SH NAME xkbprint \- print an XKB keyboard description .SH SYNOPSIS @@ -100,11 +103,11 @@ Forces synchronization for X requests. .B -w\ \fIlevel\fP Sets warning level (0 for no warning, 10 for all warnings). .SH "SEE ALSO" -X(1),xkbcomp(1) +X(__miscmansuffix__),xkbcomp(1) .SH COPYRIGHT Copyright 1995, Silicon Graphics Computer Systems Copyright 1995, 1998 The Open Group .br -See \fIX(1)\fP for a full statement of rights and permissions. +See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHOR Erik Fortune, Silicon Graphics |