~ubuntu-branches/ubuntu/trusty/isdnutils/trusty

« back to all changes in this revision

Viewing changes to ant-phone/src/isdnparser.y

  • Committer: Package Import Robot
  • Author(s): Steve Langasek
  • Date: 2013-11-15 00:02:58 UTC
  • mfrom: (1.1.8) (31.1.1 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20131115000258-tt9v3gasgrdml07k
Tags: 1:3.25+dfsg1-3.3ubuntu1
* Merge from Debian unstable:
  - resolves licensing issues with package contents.  LP: #511988.
  - includes proper upstream fix for ipppd on ARM.  LP: #453159.
  - resolves isdnutils-base removal failures.  LP: #813771.
  - fixes capiutils init script to not try to mount obsolete capifs.
    LP: #1064347.
* Remaining changes:
  - Switch libreadline5-dev to libreadline-gplv2-dev since this package
    appears to be GPLv2
  - debian/patches/no-imake.patch: Don't build xisdnload/xmonisdn using
    xmkmf/imake.  This patch was dropped in Debian without explanation;
    it still applies and seems to still be a good idea for eventual
    upstreaming, since imake is quite obsolete.
  - capi.conf: Fix typo for fcdsl2 firmware. LP: #189132.
  - Remove dependencies on /etc/inittab.
    - Disable the installation code to modify /etc/inittab.
    - isdnutils-base: Add ttyI0 example script, which needs to be installed
      in /etc/event.d/ttyI0.
    - isdnvboxserver: Add ttyI1 example script, which needs to be installed
      in /etc/event.d/ttyI1.
    - The two upstart scripts need to be edited.
    - Further improvements and documentation welcome.
* Changes included in Debian:
  - replace calls to ./MAKEDEV with /sbin/MAKEDEV
  - Build-depend on ppp-dev.
  - Switch to newer tcl -dev.
  - update to newer automake
  - debian/rules: use autoreconf to update the autotools in the capi20
    directory
  - debian/{compat,rules,*.files,.dirs}: Convert to Multi-arch.
  - debian/libcapi20-dev.install: Remove .la files (no builds use them).
* Changes included upstream:
  - fix for ARM FTBFS.
  - fix bashisms in vboxplay.
  - debian/patches/{config_libdir,toplevel-make}.patch: add CONFIG_LIBDIR
    override to upstream build system to support Multi-arch.
* Dropped changes:
  - kick dpatch to the curb.
* Handle migrating the blacklist file from
  /etc/modprobe.d/blacklist-capiutils.conf to the path used in Debian,
  /etc/modprobe.d/capiutils.conf.
* Handle rename of /etc/ppp/ip-down.d/99-ipppd and /etc/ppp/ip-up.d/00-ipppd
  to /etc/ppp/ip-down.d/ipppd and /etc/ppp/ip-up.d/ipppd
* Handle rename of /etc/init.d/isdnutils to /etc/init.d/isdnutils-base
* Restore standard.tcl to /usr/share/isdnvboxserver/default; maintainer
  scripts must not depend on contents of /usr/share/doc.
* Apply patches that were preserved in the 3.0 (quilt) migration, but
  were inadvertently not applied:
  - debian/patches/capifax.additional_error_codes.patch
  - debian/patches/capifax.3_1kHz_audio.patch
* Drop debian/isdnutils-base.cron.d, which isn't a cronjob example at all
  but an inittab example gone astray.
* debian/dotconfig*: don't use embedded quotes for paths; this confuses
  vbox's Makefiles something fierce, and causes files to be missed from
  debian/tmp'/usr/share/man/' at install time.
* Fix isdnlog and ipppd to not ship files used in the postinst under
  /usr/share/doc.
* Modernize the upstart examples.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%name-prefix="isdn_"
2
 
%{
3
 
/*
4
 
 * isdn4linux options file format parser
5
 
 *
6
 
 * This file is part of ANT (Ant is Not a Telephone)
7
 
 *
8
 
 * Copyright 2002, 2003 Roland Stigge
9
 
 *
10
 
 * ANT is free software; you can redistribute it and/or modify
11
 
 * it under the terms of the GNU General Public License as published by
12
 
 * the Free Software Foundation; either version 2 of the License, or
13
 
 * (at your option) any later version.
14
 
 *
15
 
 * ANT is distributed in the hope that it will be useful,
16
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 
 * GNU General Public License for more details.
19
 
 *
20
 
 * You should have received a copy of the GNU General Public License
21
 
 * along with ANT; if not, write to the Free Software
22
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
 
 *
24
 
 */
25
 
 
26
 
/* regular GNU system includes */
27
 
#include <stdio.h>
28
 
#include <stdlib.h>
29
 
 
30
 
/* own header files */
31
 
#include "globals.h"
32
 
#include "util.h"
33
 
#include "settings.h"
34
 
#include "isdntree.h"
35
 
 
36
 
typedef struct isdn_list_store_t isdn_list_store_t;
37
 
struct isdn_list_store_t {
38
 
  isdn_tree_node_t* list; /* list itself (start) */
39
 
  isdn_tree_node_t** last;  /* pointer to pointer to last element */
40
 
                            /* (which in turn should always be NULL) */
41
 
};
42
 
 
43
 
int isdn_lex(void);
44
 
void isdn_error(const char *message);
45
 
%}
46
 
 
47
 
/* types of semantic values */
48
 
%union {
49
 
  char* s;
50
 
  isdn_list_store_t list;
51
 
  isdn_tree_node_t* element;
52
 
}
53
 
 
54
 
/* terminal symbols */
55
 
%token <s> ISDN_TOKEN_NAME
56
 
%token <s> ISDN_TOKEN_VALUE
57
 
 
58
 
/* non terminal symbols */
59
 
%type <list> config;
60
 
%type <list> sections;
61
 
%type <element> section;
62
 
%type <list> entries;
63
 
%type <element> entry;
64
 
%type <s> value;
65
 
 
66
 
%%
67
 
 
68
 
config     : entries sections
69
 
               {
70
 
                 if ($1.list == NULL) {
71
 
                   $$ = $2;
72
 
                 } else {
73
 
                   $$.list = $1.list;
74
 
                   *$1.last = $2.list;
75
 
                   $$.last = $2.last;
76
 
                 }
77
 
                 isdn_tree = $$.list;
78
 
               }
79
 
;
80
 
 
81
 
sections   : { $$.list = NULL; $$.last = NULL; }
82
 
           | sections section
83
 
               {
84
 
                 if ($1.list == NULL) {
85
 
                   $$.list = $2;
86
 
                   $$.last = &$2->next;
87
 
                 } else {
88
 
                   $$.list = $1.list;
89
 
                   *$1.last = $2;
90
 
                   $$.last = &$2->next;
91
 
                 }
92
 
               }
93
 
;
94
 
 
95
 
section    : '[' ISDN_TOKEN_NAME ']' entries
96
 
               {
97
 
                 if (!($$ =
98
 
                       (isdn_tree_node_t*) malloc(sizeof(isdn_tree_node_t))))
99
 
                 {
100
 
                   fprintf(stderr, "Error: Out of memory.\n");
101
 
                   exit(1);
102
 
                 }
103
 
                 $$->type = ISDN_NODE_TYPE_SECTION;
104
 
                 $$->name = $2;
105
 
                 $$->content.section = $4.list;
106
 
                 /* finally: only list needed */
107
 
                 $$->next = NULL;
108
 
               }
109
 
;
110
 
 
111
 
entries    : { $$.list = NULL; $$.last = NULL; }
112
 
           | entries entry
113
 
               {
114
 
                 if ($1.list == NULL) {
115
 
                   $$.list = $2;
116
 
                   $$.last = &$2->next;
117
 
                 } else {
118
 
                   $$.list = $1.list;
119
 
                   *$1.last = $2;
120
 
                   $$.last = &$2->next;
121
 
                 }
122
 
               }
123
 
           | entries error
124
 
               {
125
 
                 fprintf(stderr, "Error region from %d:%d up to %d:%d.\n",
126
 
                         @2.first_line, @2.first_column,
127
 
                         @2.last_line, @2.last_column);
128
 
                 $$ = $1;
129
 
               }
130
 
;
131
 
 
132
 
entry      : ISDN_TOKEN_NAME '=' value
133
 
               {
134
 
                 if (!($$ =
135
 
                       (isdn_tree_node_t*) malloc(sizeof(isdn_tree_node_t))))
136
 
                 {
137
 
                   fprintf(stderr, "Error: Out of memory.\n");
138
 
                   exit(1);
139
 
                 }
140
 
                 $$->type = ISDN_NODE_TYPE_ENTRY;
141
 
                 $$->name = $1;
142
 
                 $$->content.value = $3;
143
 
                 $$->next = NULL;
144
 
               }
145
 
           | ISDN_TOKEN_NAME '=' '{' config '}'
146
 
               {
147
 
                 if (!($$ =
148
 
                       (isdn_tree_node_t*) malloc(sizeof(isdn_tree_node_t))))
149
 
                 {
150
 
                   fprintf(stderr, "Error: Out of memory.\n");
151
 
                   exit(1);
152
 
                 }
153
 
                 $$->type = ISDN_NODE_TYPE_SUBSECTION;
154
 
                 $$->name = $1;
155
 
                 $$->content.subsection = $4.list;
156
 
                 /* finally: only list needed */
157
 
                 $$->next = NULL;
158
 
               }
159
 
;
160
 
 
161
 
value      : ISDN_TOKEN_VALUE
162
 
           | ISDN_TOKEN_NAME
163
 
;
164
 
 
165
 
%%
166
 
 
167
 
/*
168
 
 * callback for yyparse(), (also) called on errors (hopefully) handled
169
 
 * by error token actions in grammar, but not if errors occur to
170
 
 * often (bison needs 3 "correct" tokens to recover)
171
 
 */
172
 
void isdn_error(const char *message) {
173
 
  if (debug)
174
 
    fprintf(stderr,
175
 
            "Warning: Parsing isdn options file: %d:%d: %s.\n",
176
 
            isdn_lloc.first_line, isdn_lloc.first_column, message);
177
 
}
178