apmdparse.y (c7012f4a11b48bf77823f24d247cac20df091f0c) | apmdparse.y (d50a71bdd882717df3f41dadd84ffc28f3466a1a) |
---|---|
1%{ 2/*- 3 * APM (Advanced Power Management) Event Dispatcher 4 * 5 * Copyright (c) 1999 Mitsuru IWASAKI <iwasaki@FreeBSD.org> 6 * Copyright (c) 1999 KOIE Hidetaka <koie@suri.co.jp> 7 * All rights reserved. 8 * --- 13 unchanged lines hidden (view full) --- 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * | 1%{ 2/*- 3 * APM (Advanced Power Management) Event Dispatcher 4 * 5 * Copyright (c) 1999 Mitsuru IWASAKI <iwasaki@FreeBSD.org> 6 * Copyright (c) 1999 KOIE Hidetaka <koie@suri.co.jp> 7 * All rights reserved. 8 * --- 13 unchanged lines hidden (view full) --- 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * |
30 * $FreeBSD$ | 30 * $Id: apmdparse.y,v 1.1.3.5 1999/06/08 09:01:47 koie Exp $ |
31 */ 32 33#include <stdio.h> 34#include <bitstring.h> | 31 */ 32 33#include <stdio.h> 34#include <bitstring.h> |
35#include <stdlib.h> 36#include <string.h> | |
37#include "apmd.h" 38 39#ifdef DEBUG 40#define YYDEBUG 1 41#endif 42 43extern int first_time; 44 45%} 46 47%union { 48 char *str; 49 bitstr_t bit_decl(evlist, EVENT_MAX); 50 int ev; 51 struct event_cmd * evcmd; | 35#include "apmd.h" 36 37#ifdef DEBUG 38#define YYDEBUG 1 39#endif 40 41extern int first_time; 42 43%} 44 45%union { 46 char *str; 47 bitstr_t bit_decl(evlist, EVENT_MAX); 48 int ev; 49 struct event_cmd * evcmd; |
52 int i; | |
53} 54 55%token BEGINBLOCK ENDBLOCK 56%token COMMA SEMICOLON 57%token APMEVENT | 50} 51 52%token BEGINBLOCK ENDBLOCK 53%token COMMA SEMICOLON 54%token APMEVENT |
58%token APMBATT 59%token BATTCHARGE BATTDISCHARGE 60%token <i> BATTTIME BATTPERCENT | |
61%token EXECCMD REJECTCMD 62%token <ev> EVENT 63%token <str> STRING UNKNOWN 64 | 55%token EXECCMD REJECTCMD 56%token <ev> EVENT 57%token <str> STRING UNKNOWN 58 |
65%type <i> apm_battery_level 66%type <i> apm_battery_direction | |
67%type <str> string 68%type <str> unknown 69%type <evlist> event_list 70%type <evcmd> cmd_list 71%type <evcmd> cmd 72%type <evcmd> exec_cmd reject_cmd 73 74%% --- 4 unchanged lines hidden (view full) --- 79 80config_list 81 : config 82 | config_list config 83 ; 84 85config 86 : apm_event_statement | 59%type <str> string 60%type <str> unknown 61%type <evlist> event_list 62%type <evcmd> cmd_list 63%type <evcmd> cmd 64%type <evcmd> exec_cmd reject_cmd 65 66%% --- 4 unchanged lines hidden (view full) --- 71 72config_list 73 : config 74 | config_list config 75 ; 76 77config 78 : apm_event_statement |
87 | apm_battery_statement | |
88 ; 89 90apm_event_statement 91 : APMEVENT event_list BEGINBLOCK cmd_list ENDBLOCK 92 { 93 if (register_apm_event_handlers($2, $4) < 0) 94 abort(); /* XXX */ 95 free_event_cmd_list($4); 96 } 97 ; 98 | 79 ; 80 81apm_event_statement 82 : APMEVENT event_list BEGINBLOCK cmd_list ENDBLOCK 83 { 84 if (register_apm_event_handlers($2, $4) < 0) 85 abort(); /* XXX */ 86 free_event_cmd_list($4); 87 } 88 ; 89 |
99apm_battery_level 100 : BATTPERCENT 101 { 102 $$ = $1; 103 } 104 | BATTTIME 105 { 106 $$ = $1; 107 } 108 ; 109 110apm_battery_direction 111 : BATTCHARGE 112 { 113 $$ = 1; 114 } 115 | BATTDISCHARGE 116 { 117 $$ = -1; 118 } 119 ; 120apm_battery_statement 121 : APMBATT apm_battery_level apm_battery_direction 122 BEGINBLOCK cmd_list ENDBLOCK 123 { 124 if (register_battery_handlers($2, $3, $5) < 0) 125 abort(); /* XXX */ 126 free_event_cmd_list($5); 127 } 128 ; 129 | |
130event_list 131 : EVENT 132 { 133 bit_nclear($$, 0, EVENT_MAX - 1); 134 bit_set($$, $1); 135 } 136 | event_list COMMA EVENT 137 { --- 68 unchanged lines hidden --- | 90event_list 91 : EVENT 92 { 93 bit_nclear($$, 0, EVENT_MAX - 1); 94 bit_set($$, $1); 95 } 96 | event_list COMMA EVENT 97 { --- 68 unchanged lines hidden --- |