|
|
|
|
File: [XFree86 CVS] / xc / programs / Xserver / hw / xwin / winprefsyacc.y
(download)
Revision: 1.1, Thu Oct 2 12:30:11 2003 UTC (9 years, 7 months ago) by eich Branch: MAIN CVS Tags: xf-4_8_0-bindist, xf-4_8_0, xf-4_8-branch, xf-4_7_99_9, xf-4_7_99_8, xf-4_7_99_7, xf-4_7_99_6, xf-4_7_99_5, xf-4_7_99_4, xf-4_7_99_31, xf-4_7_99_30, xf-4_7_99_3, xf-4_7_99_29, xf-4_7_99_28, xf-4_7_99_27, xf-4_7_99_26, xf-4_7_99_25, xf-4_7_99_24, xf-4_7_99_23, xf-4_7_99_22, xf-4_7_99_21, xf-4_7_99_20, xf-4_7_99_2, xf-4_7_99_19, xf-4_7_99_18, xf-4_7_99_17, xf-4_7_99_16, xf-4_7_99_15, xf-4_7_99_14, xf-4_7_99_13, xf-4_7_99_12, xf-4_7_99_11, xf-4_7_99_10, xf-4_7_99_1, xf-4_7_0, xf-4_7-branch, xf-4_6_99_9, xf-4_6_99_8, xf-4_6_99_7, xf-4_6_99_6, xf-4_6_99_5, xf-4_6_99_4, xf-4_6_99_3, xf-4_6_99_29, xf-4_6_99_28, xf-4_6_99_27, xf-4_6_99_26, xf-4_6_99_25, xf-4_6_99_24, xf-4_6_99_23, xf-4_6_99_22, xf-4_6_99_21, xf-4_6_99_20, xf-4_6_99_2, xf-4_6_99_19, xf-4_6_99_18, xf-4_6_99_17, xf-4_6_99_16, xf-4_6_99_15, xf-4_6_99_14, xf-4_6_99_13, xf-4_6_99_12, xf-4_6_99_11, xf-4_6_99_10, xf-4_6_99_1, xf-4_6_0, xf-4_6-branch, xf-4_5_99_904, xf-4_5_99_903, xf-4_5_99_902, xf-4_5_99_901, xf-4_5_99_9, xf-4_5_99_8, xf-4_5_99_7, xf-4_5_99_6, xf-4_5_99_5, xf-4_5_99_4, xf-4_5_99_3, xf-4_5_99_22, xf-4_5_99_21, xf-4_5_99_20, xf-4_5_99_2, xf-4_5_99_19, xf-4_5_99_18, xf-4_5_99_17, xf-4_5_99_16, xf-4_5_99_15, xf-4_5_99_14, xf-4_5_99_13, xf-4_5_99_12, xf-4_5_99_11, xf-4_5_99_10, xf-4_5_99_1, xf-4_5_0, xf-4_5-branch, xf-4_4_99_903, xf-4_4_99_902, xf-4_4_99_901, xf-4_4_99_9, xf-4_4_99_8, xf-4_4_99_7, xf-4_4_99_6, xf-4_4_99_5, xf-4_4_99_4, xf-4_4_99_3, xf-4_4_99_22, xf-4_4_99_21, xf-4_4_99_20, xf-4_4_99_2, xf-4_4_99_19, xf-4_4_99_18, xf-4_4_99_17, xf-4_4_99_16, xf-4_4_99_15, xf-4_4_99_14, xf-4_4_99_13, xf-4_4_99_12, xf-4_4_99_11, xf-4_4_99_10, xf-4_4_99_1, xf-4_4_0, xf-4_4-branch, xf-4_3_99_903, xf-4_3_99_902, xf-4_3_99_901, xf-4_3_99_16, xf-4_3_99_15, xf-4_3_99_14, HEAD 475. APM driver:
. improved clock parameter calculation.
. Fixed order of initialization of cursor.
. Fixed restauration of grapical text mode.
. Added YUY2 video format.
. Corrected accel framebuffer pitches and max screen height
(BugzillaR #528, Egbert Eich).
474. Moved DisableMMIO() out of the unmap() function, added call to
EnableMMIO() to EnterVT() to work around lockup problems when
switching between two Xserver (BugzillaR #748, Egbert Eich).
473. Fixed problem with text widget in Xaw when widget has a different
depth than the default visual (Bugzilla #745, Wolfram Gloger).
472. Fixed Sig11 when calling X -query with no ipv6 support in kernel
(BugzillaR #737, Egbert Eich).
471. Added support for Sparc64 and AMD64 on FreeBSD.
This patch also disables warnings from system headers, fixes some elf
relocations also relevant for other platforms and disables translation of
KEY_SysReqest and KEY_Break on sparc64. (Bugzilla #739, Eric Anholt).
470. Switched VIA video driver to fillkey helper function (Bugzilla #525,
Alan Cox).
469. Fixed CRT modes > FP panel size for siliconmotion (Bugzilla #727,
Hugues Fournier).
468. Fixed xedit coredumps: update counter of free objects when getting an
object from the list (BugzillaR #722, Egbert Eich).
467. Fixed definititon of UseInstalledOnCrossCompile so that it never is
undefined (Harlod L. Hunt II).
466. Add the 'b' flag to fopen() when opening binary xkm files. This is
irrelevant for *nix OSes, but reqired for Cygwin. (Bugzilla #689,
Harold L Hunt II).
465. Cygwin:
* MultiWindow Mode: Automatically validate the size of windows that are
being resized. (Earle F. Philhower III)
* Safely shutdown the MultiWindow Mode and Clipboard Manager threads on
server shutdown. (Earle F. Philhower III)
* MultiWindow Mode - Fix a crash from a string copy bug.
(Earle F. Philhower III)
* Add lots of defaults for keyboardlayout. (Alexander Gottwald)
* Add a system tha allows arbitrary commands to be added to the tray menu
icon. (Earle F. Philhower III)
* Print the name of the keyboardlayout to aid in adding more layouts.
(Alexander Gottwald)
* Stop printing the IDirectDrawSurface4_Blt() failure messages after 10
times. (Harold L Hunt II)
* Disable check for pc105 keyboard and just assume that it is present.
This check was causing problems with certain keyboard drivers that
failed to report that a pc105 keyboard was present.
(Alexander Gottwald)
* MultiWindow Mode - Add handling for WM_CHANGE_STATE IconicState
messages;
minimize the associated Windows window when these messages are
received. (Harold L Hunt II).
Submitted: (Bugzilla #704, Harold L. Hunt).
464. cygwin.cf:
* removed BuildDPS flag.
* Changed Alloca flag as Cygwin 1.5.x supports alloca, now.
* Use external expat package by default.
* Changed XawI18nDefines to utilize improved wide char suoort in
Cygwin 1.5.x. (Bugzilla #699, Harold L. Hunt II).
463. Fixed C&T panel register setting (Akira Taniguchi, Egbert Eich).
462. Fixing crash on ia64 because of wrong setjmp buffer alignment (Bugzilla
#596, John Dennis).
461. Changing ImPS/2 mouse Z-axis range to -8 to 7 (Bugzilla #691,
Matthew W. S. Bell, Egbert Eich).
460. Making sure the compiled xkb config file is found by Xnest if
ProjectRoot is modified (Bugzilla #688, Frank Giessler).
459. Fixing build of machine code .S files on OS/2 (Bugzilla #689,
Frank Giessler).
- Changed wording of message which is printed by the bigfont extension when
shm support doesn't exist (Bugzilla #698, Harold Hunt).
|
%{
/*
* Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the XFree86 Project
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from the XFree86 Project.
*
* Authors: Earle F. Philhower, III
*/
/* $XFree86: $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "winprefs.h"
/* The following give better error messages in bison at the cost of a few KB */
#define YYERROR_VERBOSE 1
/* The global pref settings */
WINMULTIWINDOWPREFS pref;
/* The working menu */
static MENUPARSED menu;
/* Functions for parsing the tokens into out structure */
/* Defined at the end section of this file */
static void SetIconDirectory (char *path);
static void SetDefaultIcon (char *fname);
static void SetRootMenu (char *menu);
static void SetDefaultSysMenu (char *menu, int pos);
static void OpenMenu(char *menuname);
static void AddMenuLine(char *name, MENUCOMMANDTYPE cmd, char *param);
static void CloseMenu();
static void OpenIcons();
static void AddIconLine(char *matchstr, char *iconfile);
static void CloseIcons();
static void OpenSysMenu();
static void AddSysMenuLine(char *matchstr, char *menuname, int pos);
static void CloseSysMenu();
static int yyerror (char *s);
extern void ErrorF (const char* /*f*/, ...);
extern char *yytext;
extern int yylex();
%}
%union {
char *sVal;
int iVal;
}
%token NEWLINE MENU LB RB ICONDIRECTORY DEFAULTICON ICONS DEFAULTSYSMENU
%token SYSMENU ROOTMENU SEPARATOR ATSTART ATEND EXEC ALWAYSONTOP DEBUG
%token RELOAD
%token <sVal> STRING
%type <iVal> atspot
%%
input: /* empty */
| input line
;
line: NEWLINE
| command
;
newline_or_nada:
| NEWLINE newline_or_nada
;
command: defaulticon
| icondirectory
| menu
| icons
| sysmenu
| rootmenu
| defaultsysmenu
| debug
;
rootmenu: ROOTMENU STRING NEWLINE { SetRootMenu($2); free($2); }
;
defaultsysmenu: DEFAULTSYSMENU STRING atspot NEWLINE { SetDefaultSysMenu($2, $3); free($2); }
;
defaulticon: DEFAULTICON STRING NEWLINE { SetDefaultIcon($2); free($2); }
;
icondirectory: ICONDIRECTORY STRING NEWLINE { SetIconDirectory($2); free($2); }
;
menuline: SEPARATOR NEWLINE newline_or_nada { AddMenuLine("-", CMD_SEPARATOR, ""); }
| STRING ALWAYSONTOP NEWLINE newline_or_nada { AddMenuLine($1, CMD_ALWAYSONTOP, ""); free($1); }
| STRING EXEC STRING NEWLINE newline_or_nada { AddMenuLine($1, CMD_EXEC, $3); free($1); free($3); }
| STRING MENU STRING NEWLINE newline_or_nada { AddMenuLine($1, CMD_MENU, $3); free($1); free($3); }
| STRING RELOAD NEWLINE newline_or_nada { AddMenuLine($1, CMD_RELOAD, ""); free($1); }
;
menulist: menuline
| menuline menulist
;
menu: MENU STRING LB { OpenMenu($2); free($2); } newline_or_nada menulist RB {CloseMenu();}
;
iconline: STRING STRING NEWLINE newline_or_nada { AddIconLine($1, $2); free($1); free($2); }
;
iconlist: iconline
| iconline iconlist
;
icons: ICONS LB {OpenIcons();} newline_or_nada iconlist RB {CloseIcons();}
;
atspot: { $$=AT_END; }
| ATSTART { $$=AT_START; }
| ATEND { $$=AT_END; }
;
sysmenuline: STRING STRING atspot NEWLINE newline_or_nada { AddSysMenuLine($1, $2, $3); free($1); free($2); }
;
sysmenulist: sysmenuline
| sysmenuline sysmenulist
;
sysmenu: SYSMENU LB NEWLINE {OpenSysMenu();} newline_or_nada sysmenulist RB {CloseSysMenu();}
;
debug: DEBUG STRING NEWLINE { ErrorF("LoadPreferences: %s\n", $2); free($2); }
;
%%
/*
* Errors in parsing abort and print log messages
*/
static int
yyerror (char *s)
{
extern int yylineno; /* Handled by flex internally */
ErrorF("LoadPreferences: %s line %d\n", s, yylineno);
return 1;
}
/* Miscellaneous functions to store TOKENs into the structure */
static void
SetIconDirectory (char *path)
{
strncpy (pref.iconDirectory, path, PATH_MAX);
pref.iconDirectory[PATH_MAX] = 0;
}
static void
SetDefaultIcon (char *fname)
{
strncpy (pref.defaultIconName, fname, NAME_MAX);
pref.defaultIconName[NAME_MAX] = 0;
}
static void
SetRootMenu (char *menu)
{
strncpy (pref.rootMenuName, menu, MENU_MAX);
pref.rootMenuName[MENU_MAX] = 0;
}
static void
SetDefaultSysMenu (char *menu, int pos)
{
strncpy (pref.defaultSysMenuName, menu, MENU_MAX);
pref.defaultSysMenuName[MENU_MAX] = 0;
pref.defaultSysMenuPos = pos;
}
static void
OpenMenu (char *menuname)
{
if (menu.menuItem) free(menu.menuItem);
menu.menuItem = NULL;
strncpy(menu.menuName, menuname, MENU_MAX);
menu.menuName[MENU_MAX] = 0;
menu.menuItems = 0;
}
static void
AddMenuLine (char *text, MENUCOMMANDTYPE cmd, char *param)
{
if (menu.menuItem==NULL)
menu.menuItem = (MENUITEM*)malloc(sizeof(MENUITEM));
else
menu.menuItem = (MENUITEM*)
realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1));
strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX);
menu.menuItem[menu.menuItems].text[MENU_MAX] = 0;
menu.menuItem[menu.menuItems].cmd = cmd;
strncpy(menu.menuItem[menu.menuItems].param, param, PARAM_MAX);
menu.menuItem[menu.menuItems].param[PARAM_MAX] = 0;
menu.menuItem[menu.menuItems].commandID = 0;
menu.menuItems++;
}
static void
CloseMenu ()
{
if (menu.menuItem==NULL || menu.menuItems==0)
{
ErrorF("LoadPreferences: Empty menu detected\n");
return;
}
if (pref.menuItems)
pref.menu = (MENUPARSED*)
realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED));
else
pref.menu = (MENUPARSED*)malloc (sizeof(MENUPARSED));
memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED));
pref.menuItems++;
memset (&menu, 0, sizeof(MENUPARSED));
}
static void
OpenIcons ()
{
if (pref.icon != NULL) {
ErrorF("LoadPreferences: Redefining icon mappings\n");
free(pref.icon);
pref.icon = NULL;
}
pref.iconItems = 0;
}
static void
AddIconLine (char *matchstr, char *iconfile)
{
if (pref.icon==NULL)
pref.icon = (ICONITEM*)malloc(sizeof(ICONITEM));
else
pref.icon = (ICONITEM*)
realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1));
strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX);
pref.icon[pref.iconItems].match[MENU_MAX] = 0;
strncpy(pref.icon[pref.iconItems].iconFile, iconfile, PATH_MAX+NAME_MAX+1);
pref.icon[pref.iconItems].iconFile[PATH_MAX+NAME_MAX+1] = 0;
pref.icon[pref.iconItems].hicon = 0;
pref.iconItems++;
}
static void
CloseIcons ()
{
}
static void
OpenSysMenu ()
{
if (pref.sysMenu != NULL) {
ErrorF("LoadPreferences: Redefining system menu\n");
free(pref.sysMenu);
pref.sysMenu = NULL;
}
pref.sysMenuItems = 0;
}
static void
AddSysMenuLine (char *matchstr, char *menuname, int pos)
{
if (pref.sysMenu==NULL)
pref.sysMenu = (SYSMENUITEM*)malloc(sizeof(SYSMENUITEM));
else
pref.sysMenu = (SYSMENUITEM*)
realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1));
strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX);
pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0;
strncpy (pref.sysMenu[pref.sysMenuItems].menuName, menuname, MENU_MAX);
pref.sysMenu[pref.sysMenuItems].menuName[MENU_MAX] = 0;
pref.sysMenu[pref.sysMenuItems].menuPos = pos;
pref.sysMenuItems++;
}
static void
CloseSysMenu ()
{
}
|
Powered by ViewCVS 0.9.2 |