diff options
Diffstat (limited to 'src/TMparse.c')
-rw-r--r-- | src/TMparse.c | 530 |
1 files changed, 265 insertions, 265 deletions
diff --git a/src/TMparse.c b/src/TMparse.c index 47a3e8d..5aed5c4 100644 --- a/src/TMparse.c +++ b/src/TMparse.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +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 +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +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 @@ -92,14 +92,14 @@ static String XtNtranslationParseError = "translationParseError"; typedef int EventType; -typedef String (*ParseProc)(); /* str, closure, event ,error */ - /* String str; */ - /* Opaque closure; */ - /* EventPtr event; */ - /* Boolean* error */ +typedef String (*ParseProc)( + String /* str; */, + Opaque /* closure; */, + EventPtr /* event; */, + Boolean* /* error */); -typedef void (*ModifierProc)(); typedef TMShortCard Value; +typedef void (*ModifierProc)(Value, LateBindingsPtr*, Boolean, Value*); typedef struct _ModifierRec { char* name; @@ -122,11 +122,11 @@ typedef struct { Value value; } NameValueRec, *NameValueTable; -static void ParseModImmed(); -static void ParseModSym(); -static String PanicModeRecovery(); -static String CheckForPoundSign(); -static KeySym StringToKeySym(); +static void ParseModImmed(Value, LateBindingsPtr*, Boolean, Value*); +static void ParseModSym(Value, LateBindingsPtr*, Boolean, Value*); +static String PanicModeRecovery(String); +static String CheckForPoundSign(String, _XtTranslateOp, _XtTranslateOp *); +static KeySym StringToKeySym(String, Boolean *); static ModifierRec modifiers[] = { {"Shift", 0, ParseModImmed,ShiftMask}, {"Lock", 0, ParseModImmed,LockMask}, @@ -217,13 +217,13 @@ static NameValueRec mappingNotify[] = { {NULL, NULLQUARK, 0}, }; -static String ParseKeySym(); -static String ParseKeyAndModifiers(); -static String ParseTable(); -static String ParseImmed(); -static String ParseAddModifier(); -static String ParseNone(); -static String ParseAtom(); +static String ParseKeySym(String, Opaque, EventPtr, Boolean*); +static String ParseKeyAndModifiers(String, Opaque, EventPtr, Boolean*); +static String ParseTable(String, Opaque, EventPtr, Boolean*); +static String ParseImmed(String, Opaque, EventPtr, Boolean*); +static String ParseAddModifier(String, Opaque, EventPtr, Boolean*); +static String ParseNone(String, Opaque, EventPtr, Boolean*); +static String ParseAtom(String, Opaque, EventPtr, Boolean*); static EventKey events[] = { @@ -399,8 +399,8 @@ static XrmQuark QCtrl; static XrmQuark QNone; static XrmQuark QAny; -static void FreeEventSeq(eventSeq) - EventSeqPtr eventSeq; +static void FreeEventSeq( + EventSeqPtr eventSeq) { register EventSeqPtr evs = eventSeq; @@ -421,8 +421,8 @@ static void FreeEventSeq(eventSeq) } } -static void CompileNameValueTable(table) - NameValueTable table; +static void CompileNameValueTable( + NameValueTable table) { register int i; @@ -436,9 +436,9 @@ static int OrderEvents(_Xconst void *a, _Xconst void *b) ((_Xconst EventKey *)b)->signature) ? -1 : 1); } -static void Compile_XtEventTable(table, count) - EventKeys table; - Cardinal count; +static void Compile_XtEventTable( + EventKeys table, + Cardinal count) { register int i; register EventKeys entry = table; @@ -454,9 +454,9 @@ static int OrderModifiers(_Xconst void *a, _Xconst void *b) ((_Xconst ModifierRec *)b)->signature) ? -1 : 1); } -static void Compile_XtModifierTable(table, count) - ModifierKeys table; - Cardinal count; +static void Compile_XtModifierTable( + ModifierKeys table, + Cardinal count) { register int i; register ModifierKeys entry = table; @@ -466,8 +466,8 @@ static void Compile_XtModifierTable(table, count) qsort(table, count, sizeof(ModifierRec), OrderModifiers); } -static String PanicModeRecovery(str) - String str; +static String PanicModeRecovery( + String str) { ScanFor(str,'\n'); if (*str == '\n') str++; @@ -476,8 +476,8 @@ static String PanicModeRecovery(str) } -static void Syntax(str0,str1) - String str0,str1; +static void Syntax( + String str0,String str1) { Cardinal num_params = 2; String params[2]; @@ -490,11 +490,11 @@ static void Syntax(str0,str1) -static Cardinal LookupTMEventType(eventStr,error) - String eventStr; - Boolean *error; +static Cardinal LookupTMEventType( + String eventStr, + Boolean *error) { - register int i, left, right; + register int i = 0, left, right; register XrmQuark signature; static int previous = 0; @@ -525,13 +525,12 @@ static Cardinal LookupTMEventType(eventStr,error) return (Cardinal) i; } -static void StoreLateBindings(keysymL,notL,keysymR,notR,lateBindings) - - KeySym keysymL; - Boolean notL; - KeySym keysymR; - Boolean notR; - LateBindingsPtr* lateBindings; +static void StoreLateBindings( + KeySym keysymL, + Boolean notL, + KeySym keysymR, + Boolean notR, + LateBindingsPtr* lateBindings) { LateBindingsPtr temp; Boolean pair = FALSE; @@ -547,7 +546,7 @@ static void StoreLateBindings(keysymL,notL,keysymR,notR,lateBindings) } else{ number = 2;pair = TRUE; } - + temp = (LateBindingsPtr)XtRealloc((char *)temp, (unsigned)((count+number+1) * sizeof(LateBindings)) ); *lateBindings = temp; @@ -566,14 +565,14 @@ static void StoreLateBindings(keysymL,notL,keysymR,notR,lateBindings) temp[count].ref_count = 0; temp[count].keysym = 0; } -} - -static void _XtParseKeysymMod(name,lateBindings,notFlag,valueP,error) - String name; - LateBindingsPtr* lateBindings; - Boolean notFlag; - Value *valueP; - Boolean *error; +} + +static void _XtParseKeysymMod( + String name, + LateBindingsPtr* lateBindings, + Boolean notFlag, + Value *valueP, + Boolean *error) { KeySym keySym; keySym = StringToKeySym(name, error); @@ -583,13 +582,12 @@ static void _XtParseKeysymMod(name,lateBindings,notFlag,valueP,error) } } -static Boolean _XtLookupModifier(signature, lateBindings, notFlag, valueP, - constMask) - XrmQuark signature; - LateBindingsPtr* lateBindings; - Boolean notFlag; - Value *valueP; - Bool constMask; +static Boolean _XtLookupModifier( + XrmQuark signature, + LateBindingsPtr* lateBindings, + Boolean notFlag, + Value *valueP, + Bool constMask) { register int i, left, right; static int previous = 0; @@ -627,8 +625,8 @@ static Boolean _XtLookupModifier(signature, lateBindings, notFlag, valueP, } -static String ScanIdent(str) - register String str; +static String ScanIdent( + register String str) { ScanAlphanumeric(str); while ( @@ -642,9 +640,9 @@ static String ScanIdent(str) return str; } -static String FetchModifierToken(str, token_return) - String str; - XrmQuark *token_return; +static String FetchModifierToken( + String str, + XrmQuark *token_return) { String start = str; @@ -663,7 +661,7 @@ static String FetchModifierToken(str, token_return) char modStrbuf[100]; char* modStr; - modStr = XtStackAlloc (str - start + 1, modStrbuf); + modStr = XtStackAlloc ((size_t)(str - start + 1), modStrbuf); if (modStr == NULL) _XtAllocError (NULL); (void) memmove(modStr, start, str-start); modStr[str-start] = '\0'; @@ -672,18 +670,18 @@ static String FetchModifierToken(str, token_return) return str; } return str; -} - -static String ParseModifiers(str, event,error) - register String str; - EventPtr event; - Boolean* error; +} + +static String ParseModifiers( + register String str, + EventPtr event, + Boolean* error) { register String start; Boolean notFlag, exclusive, keysymAsMod; Value maskBit; XrmQuark Qmod; - + ScanWhitespace(str); start = str; str = FetchModifierToken(str, &Qmod); @@ -714,12 +712,12 @@ static String ParseModifiers(str, event,error) ScanWhitespace(str); } } - + while (*str != '<') { if (*str == '~') { notFlag = TRUE; str++; - } else + } else notFlag = FALSE; if (*str == '@') { keysymAsMod = TRUE; @@ -756,31 +754,31 @@ static String ParseModifiers(str, event,error) return str; } -static String ParseXtEventType(str, event, tmEventP,error) - register String str; - EventPtr event; - Cardinal *tmEventP; - Boolean* error; +static String ParseXtEventType( + register String str, + EventPtr event, + Cardinal *tmEventP, + Boolean* error) { String start = str; char eventTypeStrbuf[100]; char* eventTypeStr; ScanAlphanumeric(str); - eventTypeStr = XtStackAlloc (str - start + 1, eventTypeStrbuf); + eventTypeStr = XtStackAlloc ((size_t)(str - start + 1), eventTypeStrbuf); if (eventTypeStr == NULL) _XtAllocError (NULL); (void) memmove(eventTypeStr, start, str-start); eventTypeStr[str-start] = '\0'; *tmEventP = LookupTMEventType(eventTypeStr,error); XtStackFree (eventTypeStr, eventTypeStrbuf); - if (*error) + if (*error) return PanicModeRecovery(str); event->event.eventType = events[*tmEventP].eventType; return str; } -static unsigned long StrToHex(str) - String str; +static unsigned long StrToHex( + String str) { register char c; register unsigned long val = 0; @@ -796,8 +794,8 @@ static unsigned long StrToHex(str) return val; } -static unsigned long StrToOct(str) - String str; +static unsigned long StrToOct( + String str) { register char c; register unsigned long val = 0; @@ -810,8 +808,8 @@ static unsigned long StrToOct(str) return val; } -static unsigned long StrToNum(str) - String str; +static unsigned long StrToNum( + String str) { register char c; register unsigned long val = 0; @@ -831,9 +829,9 @@ static unsigned long StrToNum(str) return val; } -static KeySym StringToKeySym(str, error) - String str; - Boolean *error; +static KeySym StringToKeySym( + String str, + Boolean *error) { KeySym k; @@ -862,23 +860,23 @@ static KeySym StringToKeySym(str, error) return NoSymbol; } /* ARGSUSED */ -static void ParseModImmed(value, lateBindings, notFlag, valueP) - Value value; - LateBindingsPtr* lateBindings; - Boolean notFlag; - Value* valueP; +static void ParseModImmed( + Value value, + LateBindingsPtr* lateBindings, + Boolean notFlag, + Value* valueP) { *valueP = value; } -static void ParseModSym(value, lateBindings, notFlag, valueP) /* is only valid with keysyms that have an _L and _R in their name; * and ignores keysym lookup errors (i.e. assumes only valid keysyms) */ - Value value; - LateBindingsPtr* lateBindings; - Boolean notFlag; - Value* valueP; +static void ParseModSym( + Value value, + LateBindingsPtr* lateBindings, + Boolean notFlag, + Value* valueP) { register KeySym keysymL = (KeySym)value; register KeySym keysymR = keysymL + 1; /* valid for supported keysyms */ @@ -899,24 +897,24 @@ static String stupid_optimizer_kludge; #endif /* ARGSUSED */ -static String ParseImmed(str, closure, event,error) - register String str; - register Opaque closure; - register EventPtr event; - Boolean* error; +static String ParseImmed( + register String str, + register Opaque closure, + register EventPtr event, + Boolean* error) { event->event.eventCode = (unsigned long)closure; - event->event.eventCodeMask = (unsigned long)~0L; + event->event.eventCodeMask = ~0UL; return BROKEN_OPTIMIZER_HACK(str); } /* ARGSUSED */ -static String ParseAddModifier(str, closure, event, error) - register String str; - register Opaque closure; - register EventPtr event; - Boolean* error; +static String ParseAddModifier( + register String str, + register Opaque closure, + register EventPtr event, + Boolean* error) { register unsigned long modval = (unsigned long)closure; event->event.modifiers |= modval; @@ -927,11 +925,11 @@ static String ParseAddModifier(str, closure, event, error) } -static String ParseKeyAndModifiers(str, closure, event,error) - String str; - Opaque closure; - EventPtr event; - Boolean* error; +static String ParseKeyAndModifiers( + String str, + Opaque closure, + EventPtr event, + Boolean* error) { str = ParseKeySym(str, closure, event,error); if ((unsigned long) closure == 0) { @@ -946,11 +944,11 @@ static String ParseKeyAndModifiers(str, closure, event,error) } /*ARGSUSED*/ -static String ParseKeySym(str, closure, event,error) - register String str; - Opaque closure; - EventPtr event; - Boolean* error; +static String ParseKeySym( + register String str, + Opaque closure, + EventPtr event, + Boolean* error) { char *start; char keySymNamebuf[100]; @@ -985,7 +983,7 @@ static String ParseKeySym(str, closure, event,error) && !IsNewline(*str) && (*str != '(' || *(str+1) <= '0' || *(str+1) >= '9') && *str != '\0') str++; - keySymName = XtStackAlloc (str - start + 1, keySymNamebuf); + keySymName = XtStackAlloc ((size_t)(str - start + 1), keySymNamebuf); (void) memmove(keySymName, start, str-start); keySymName[str-start] = '\0'; event->event.eventCode = StringToKeySym(keySymName, error); @@ -1005,7 +1003,7 @@ static String ParseKeySym(str, closure, event,error) } if (event->event.standard) event->event.matchEvent = _XtMatchUsingStandardMods; - else + else event->event.matchEvent = _XtMatchUsingDontCareMods; XtStackFree (keySymName, keySymNamebuf); @@ -1013,11 +1011,11 @@ static String ParseKeySym(str, closure, event,error) return str; } -static String ParseTable(str, closure, event,error) - register String str; - Opaque closure; - EventPtr event; - Boolean* error; +static String ParseTable( + register String str, + Opaque closure, + EventPtr event, + Boolean* error) { register String start = str; register XrmQuark signature; @@ -1048,11 +1046,11 @@ static String ParseTable(str, closure, event,error) } /*ARGSUSED*/ -static String ParseNone(str, closure, event,error) - String str; - Opaque closure; - EventPtr event; - Boolean* error; +static String ParseNone( + String str, + Opaque closure, + EventPtr event, + Boolean* error) { event->event.eventCode = 0; event->event.eventCodeMask = 0; @@ -1061,11 +1059,11 @@ static String ParseNone(str, closure, event,error) } /*ARGSUSED*/ -static String ParseAtom(str, closure, event,error) - String str; - Opaque closure; - EventPtr event; - Boolean* error; +static String ParseAtom( + String str, + Opaque closure, + EventPtr event, + Boolean* error) { ScanWhitespace(str); @@ -1099,21 +1097,21 @@ static String ParseAtom(str, closure, event,error) static ModifierMask buttonModifierMasks[] = { 0, Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask }; -static String ParseRepeat(); - -static String ParseEvent(str, event, reps, plus, error) - register String str; - EventPtr event; - int* reps; - Boolean* plus; - Boolean* error; +static String ParseRepeat(String, int *, Boolean *, Boolean *); + +static String ParseEvent( + register String str, + EventPtr event, + int* reps, + Boolean* plus, + Boolean* error) { Cardinal tmEvent; str = ParseModifiers(str, event,error); if (*error) return str; if (*str != '<') { - Syntax("Missing '<' while parsing event type.",""); + Syntax("Missing '<' while parsing event type.",""); *error = TRUE; return PanicModeRecovery(str); } @@ -1149,10 +1147,10 @@ static String ParseEvent(str, event, reps, plus, error) return str; } -static String ParseQuotedStringEvent(str, event,error) - register String str; - register EventPtr event; - Boolean *error; +static String ParseQuotedStringEvent( + register String str, + register EventPtr event, + Boolean *error) { Value metaMask; char s[2]; @@ -1182,16 +1180,16 @@ static String ParseQuotedStringEvent(str, event,error) static EventSeqRec timerEventRec = { - {0, 0, NULL, _XtEventTimerEventType, 0L, 0L, NULL}, + {0, 0, NULL, _XtEventTimerEventType, 0L, 0L, NULL, False}, /* (StatePtr) -1 */ NULL, NULL, NULL }; -static void RepeatDown(eventP, reps, actionsP) - EventPtr *eventP; - int reps; - ActionPtr **actionsP; +static void RepeatDown( + EventPtr *eventP, + int reps, + ActionPtr **actionsP) { EventRec upEventRec; register EventPtr event, downEvent; @@ -1235,10 +1233,10 @@ static void RepeatDown(eventP, reps, actionsP) *actionsP = &event->actions; } -static void RepeatDownPlus(eventP, reps, actionsP) - EventPtr *eventP; - int reps; - ActionPtr **actionsP; +static void RepeatDownPlus( + EventPtr *eventP, + int reps, + ActionPtr **actionsP) { EventRec upEventRec; register EventPtr event, downEvent, lastDownEvent = NULL; @@ -1285,10 +1283,10 @@ static void RepeatDownPlus(eventP, reps, actionsP) *actionsP = &lastDownEvent->actions; } -static void RepeatUp(eventP, reps, actionsP) - EventPtr *eventP; - int reps; - ActionPtr **actionsP; +static void RepeatUp( + EventPtr *eventP, + int reps, + ActionPtr **actionsP) { EventRec upEventRec; register EventPtr event, downEvent; @@ -1341,10 +1339,10 @@ static void RepeatUp(eventP, reps, actionsP) *actionsP = &event->actions; } -static void RepeatUpPlus(eventP, reps, actionsP) - EventPtr *eventP; - int reps; - ActionPtr **actionsP; +static void RepeatUpPlus( + EventPtr *eventP, + int reps, + ActionPtr **actionsP) { EventRec upEventRec; register EventPtr event, downEvent, lastUpEvent = NULL; @@ -1392,10 +1390,10 @@ static void RepeatUpPlus(eventP, reps, actionsP) *actionsP = &lastUpEvent->actions; } -static void RepeatOther(eventP, reps, actionsP) - EventPtr *eventP; - int reps; - ActionPtr **actionsP; +static void RepeatOther( + EventPtr *eventP, + int reps, + ActionPtr **actionsP) { register EventPtr event, tempEvent; register int i; @@ -1415,10 +1413,10 @@ static void RepeatOther(eventP, reps, actionsP) *actionsP = &event->actions; } -static void RepeatOtherPlus(eventP, reps, actionsP) - EventPtr *eventP; - int reps; - ActionPtr **actionsP; +static void RepeatOtherPlus( + EventPtr *eventP, + int reps, + ActionPtr **actionsP) { register EventPtr event, tempEvent; register int i; @@ -1439,11 +1437,11 @@ static void RepeatOtherPlus(eventP, reps, actionsP) *actionsP = &event->actions; } -static void RepeatEvent(eventP, reps, plus, actionsP) - EventPtr *eventP; - int reps; - Boolean plus; - ActionPtr **actionsP; +static void RepeatEvent( + EventPtr *eventP, + int reps, + Boolean plus, + ActionPtr **actionsP) { switch ((*eventP)->event.eventType) { @@ -1465,10 +1463,10 @@ static void RepeatEvent(eventP, reps, plus, actionsP) } } -static String ParseRepeat(str, reps, plus, error) - register String str; - int *reps; - Boolean *plus, *error; +static String ParseRepeat( + register String str, + int *reps, + Boolean *plus, Boolean *error) { /*** Parse the repetitions, for double click etc... ***/ @@ -1478,7 +1476,7 @@ static String ParseRepeat(str, reps, plus, error) if (isdigit(*str)) { String start = str; char repStr[7]; - int len; + size_t len; ScanNumeric(str); len = (str - start); @@ -1517,14 +1515,14 @@ static String ParseRepeat(str, reps, plus, error) * Parses the left hand side of a translation table production * up to, and consuming the ":". * Takes a pointer to a char* (where to start parsing) and returns an - * event seq (in a passed in variable), having updated the String + * event seq (in a passed in variable), having updated the String **********************************************************************/ -static String ParseEventSeq(str, eventSeqP, actionsP,error) - register String str; - EventSeqPtr *eventSeqP; - ActionPtr **actionsP; - Boolean *error; +static String ParseEventSeq( + register String str, + EventSeqPtr *eventSeqP, + ActionPtr **actionsP, + Boolean *error) { EventSeqPtr *nextEvent = eventSeqP; @@ -1593,7 +1591,7 @@ static String ParseEventSeq(str, eventSeqP, actionsP,error) } if (*str != ':') { - Syntax("Missing ':'after event sequence.",""); + Syntax("Missing ':'after event sequence.",""); *error = TRUE; return PanicModeRecovery(str); } else str++; @@ -1602,10 +1600,10 @@ static String ParseEventSeq(str, eventSeqP, actionsP,error) } -static String ParseActionProc(str, actionProcNameP, error) - register String str; - XrmQuark *actionProcNameP; - Boolean *error; +static String ParseActionProc( + register String str, + XrmQuark *actionProcNameP, + Boolean *error) { register String start = str; char procName[200]; @@ -1623,9 +1621,9 @@ static String ParseActionProc(str, actionProcNameP, error) } -static String ParseString(str, strP) - register String str; - String *strP; +static String ParseString( + register String str, + String *strP) { register String start; @@ -1640,7 +1638,7 @@ static String ParseString(str, strP) /* \" produces double quote embedded in a quoted parameter * \\" produces backslash as last character of a quoted parameter */ - if (*str == '\\' && + if (*str == '\\' && (*(str+1) == '"' || (*(str+1) == '\\' && *(str+2) == '"'))) { len = prev_len + (str-start+2); *strP = XtRealloc(*strP, len); @@ -1650,7 +1648,7 @@ static String ParseString(str, strP) (*strP)[prev_len-1] = *str; (*strP)[prev_len] = '\0'; start = str+1; - } + } str++; } len = prev_len + (str-start+1); @@ -1678,10 +1676,10 @@ static String ParseString(str, strP) } -static String ParseParamSeq(str, paramSeqP, paramNumP) - register String str; - String **paramSeqP; - Cardinal *paramNumP; +static String ParseParamSeq( + register String str, + String **paramSeqP, + Cardinal *paramNumP) { typedef struct _ParamRec *ParamPtr; typedef struct _ParamRec { @@ -1735,11 +1733,11 @@ static String ParseParamSeq(str, paramSeqP, paramNumP) return str; } -static String ParseAction(str, actionP, quarkP, error) - String str; - ActionPtr actionP; - XrmQuark* quarkP; - Boolean* error; +static String ParseAction( + String str, + ActionPtr actionP, + XrmQuark* quarkP, + Boolean* error) { str = ParseActionProc(str, quarkP, error); if (*error) return str; @@ -1748,7 +1746,7 @@ static String ParseAction(str, actionP, quarkP, error) str++; str = ParseParamSeq(str, &actionP->params, &actionP->num_params); } else { - Syntax("Missing '(' while parsing action sequence",""); + Syntax("Missing '(' while parsing action sequence",""); *error = TRUE; return str; } @@ -1762,11 +1760,11 @@ static String ParseAction(str, actionP, quarkP, error) } -static String ParseActionSeq(parseTree, str, actionsP, error) - TMParseStateTree parseTree; - String str; - ActionPtr *actionsP; - Boolean *error; +static String ParseActionSeq( + TMParseStateTree parseTree, + String str, + ActionPtr *actionsP, + Boolean *error) { ActionPtr *nextActionP = actionsP; @@ -1794,12 +1792,12 @@ static String ParseActionSeq(parseTree, str, actionsP, error) } -static void ShowProduction(currentProduction) - String currentProduction; +static void ShowProduction( + String currentProduction) { Cardinal num_params = 1; String params[1]; - int len; + size_t len; char *eol, *production, productionbuf[500]; #ifdef __UNIXOS2__ @@ -1826,10 +1824,10 @@ static void ShowProduction(currentProduction) * Parses one line of event bindings. ***********************************************************************/ -static String ParseTranslationTableProduction(parseTree, str, error) - TMParseStateTree parseTree; - register String str; - Boolean* error; +static String ParseTranslationTableProduction( + TMParseStateTree parseTree, + register String str, + Boolean* error) { EventSeqPtr eventSeq = NULL; ActionPtr *actionsP; @@ -1854,15 +1852,15 @@ static String ParseTranslationTableProduction(parseTree, str, error) return (str); } -static String CheckForPoundSign(str, defaultOp, actualOpRtn) - String str; - _XtTranslateOp defaultOp; - _XtTranslateOp *actualOpRtn; +static String CheckForPoundSign( + String str, + _XtTranslateOp defaultOp, + _XtTranslateOp *actualOpRtn) { String start; char operation[20]; _XtTranslateOp opType; - + opType = defaultOp; ScanWhitespace(str); if (*str == '#') { @@ -1889,11 +1887,11 @@ static String CheckForPoundSign(str, defaultOp, actualOpRtn) return str; } -static XtTranslations ParseTranslationTable(source, isAccelerator, defaultOp, error) - String source; - Boolean isAccelerator; - _XtTranslateOp defaultOp; - Boolean* error; +static XtTranslations ParseTranslationTable( + String source, + Boolean isAccelerator, + _XtTranslateOp defaultOp, + Boolean* error) { XtTranslations xlations; TMStateTree stateTrees[8]; @@ -1954,12 +1952,13 @@ static XtTranslations ParseTranslationTable(source, isAccelerator, defaultOp, er /*** public procedures ***/ /*ARGSUSED*/ -Boolean XtCvtStringToAcceleratorTable(dpy, args, num_args, from, to, closure) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr from,to; - XtPointer *closure; +Boolean XtCvtStringToAcceleratorTable( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr from, + XrmValuePtr to, + XtPointer *closure) { String str; Boolean error = FALSE; @@ -1982,17 +1981,17 @@ Boolean XtCvtStringToAcceleratorTable(dpy, args, num_args, from, to, closure) to->size = sizeof(XtAccelerators); return FALSE; } - *(XtAccelerators*)to->addr = + *(XtAccelerators*)to->addr = (XtAccelerators) ParseTranslationTable(str, TRUE, XtTableAugment, &error); } else { static XtAccelerators staticStateTable; - staticStateTable = + staticStateTable = (XtAccelerators) ParseTranslationTable(str, TRUE, XtTableAugment, &error); to->addr = (XPointer) &staticStateTable; to->size = sizeof(XtAccelerators); } - if (error == TRUE) + if (error == TRUE) XtAppWarningMsg(XtDisplayToApplicationContext(dpy), "parseError","cvtStringToAcceleratorTable",XtCXtToolkitError, "String to AcceleratorTable conversion encountered errors", @@ -2003,16 +2002,17 @@ Boolean XtCvtStringToAcceleratorTable(dpy, args, num_args, from, to, closure) /*ARGSUSED*/ Boolean -XtCvtStringToTranslationTable(dpy, args, num_args, from, to, closure_ret) - Display *dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr from,to; - XtPointer *closure_ret; +XtCvtStringToTranslationTable( + Display *dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr from, + XrmValuePtr to, + XtPointer *closure_ret) { String str; Boolean error = FALSE; - + if (*num_args != 0) XtAppWarningMsg(XtDisplayToApplicationContext(dpy), "wrongParameters","cvtStringToTranslationTable",XtCXtToolkitError, @@ -2031,17 +2031,17 @@ XtCvtStringToTranslationTable(dpy, args, num_args, from, to, closure_ret) to->size = sizeof(XtTranslations); return FALSE; } - *(XtTranslations*)to->addr = + *(XtTranslations*)to->addr = ParseTranslationTable(str, FALSE, XtTableReplace, &error); } else { static XtTranslations staticStateTable; - staticStateTable = + staticStateTable = ParseTranslationTable(str, FALSE, XtTableReplace, &error); to->addr = (XPointer) &staticStateTable; to->size = sizeof(XtTranslations); } - if (error == TRUE) + if (error == TRUE) XtAppWarningMsg(XtDisplayToApplicationContext(dpy), "parseError","cvtStringToTranslationTable",XtCXtToolkitError, "String to TranslationTable conversion encountered errors", @@ -2058,8 +2058,8 @@ XtAccelerators XtParseAcceleratorTable( { Boolean error = FALSE; XtAccelerators ret = - (XtAccelerators) ParseTranslationTable (source, TRUE, XtTableAugment, &error); - if (error == TRUE) + (XtAccelerators) ParseTranslationTable ((char *)source, TRUE, XtTableAugment, &error); + if (error == TRUE) XtWarningMsg ("parseError", "cvtStringToAcceleratorTable", XtCXtToolkitError, "String to AcceleratorTable conversion encountered errors", @@ -2071,8 +2071,8 @@ XtTranslations XtParseTranslationTable( _Xconst char* source) { Boolean error = FALSE; - XtTranslations ret = ParseTranslationTable(source, FALSE, XtTableReplace, &error); - if (error == TRUE) + XtTranslations ret = ParseTranslationTable((char *)source, FALSE, XtTableReplace, &error); + if (error == TRUE) XtWarningMsg ("parseError", "cvtStringToTranslationTable", XtCXtToolkitError, "String to TranslationTable conversion encountered errors", @@ -2112,12 +2112,12 @@ void _XtTranslateInitialize(void) CompileNameValueTable( mappingNotify ); } -void _XtAddTMConverters(table) - ConverterTable table; +void _XtAddTMConverters( + ConverterTable table) { _XtTableAddConverter(table, _XtQString, - XrmPermStringToQuark(XtRTranslationTable), + XrmPermStringToQuark(XtRTranslationTable), XtCvtStringToTranslationTable, (XtConvertArgList) NULL, (Cardinal)0, True, CACHED, _XtFreeTranslations, True); _XtTableAddConverter(table, _XtQString, @@ -2126,7 +2126,7 @@ void _XtAddTMConverters(table) (Cardinal)0, True, CACHED, _XtFreeTranslations, True); _XtTableAddConverter(table, XrmPermStringToQuark( _XtRStateTablePair ), - XrmPermStringToQuark(XtRTranslationTable), + XrmPermStringToQuark(XtRTranslationTable), _XtCvtMergeTranslations, (XtConvertArgList) NULL, (Cardinal)0, True, CACHED, _XtFreeTranslations, True); } |