~ubuntu-branches/ubuntu/intrepid/comedilib/intrepid

« back to all changes in this revision

Viewing changes to lib/calib_yacc.c

  • Committer: Bazaar Package Importer
  • Author(s): David Schleef
  • Date: 2003-09-23 18:11:12 UTC
  • Revision ID: james.westby@ubuntu.com-20030923181112-sat05jyh702rb1at
Tags: upstream-0.7.21
ImportĀ upstreamĀ versionĀ 0.7.21

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* A Bison parser, made by GNU Bison 1.875a.  */
 
2
 
 
3
/* Skeleton parser for Yacc-like parsing with Bison,
 
4
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
5
 
 
6
   This program is free software; you can redistribute it and/or modify
 
7
   it under the terms of the GNU General Public License as published by
 
8
   the Free Software Foundation; either version 2, or (at your option)
 
9
   any later version.
 
10
 
 
11
   This program is distributed in the hope that it will be useful,
 
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
   GNU General Public License for more details.
 
15
 
 
16
   You should have received a copy of the GNU General Public License
 
17
   along with this program; if not, write to the Free Software
 
18
   Foundation, Inc., 59 Temple Place - Suite 330,
 
19
   Boston, MA 02111-1307, USA.  */
 
20
 
 
21
/* As a special exception, when this file is copied by Bison into a
 
22
   Bison output file, you may use that output file without restriction.
 
23
   This special exception was added by the Free Software Foundation
 
24
   in version 1.24 of Bison.  */
 
25
 
 
26
/* Written by Richard Stallman by simplifying the original so called
 
27
   ``semantic'' parser.  */
 
28
 
 
29
/* All symbols defined below should begin with yy or YY, to avoid
 
30
   infringing on user name space.  This should be done even for local
 
31
   variables, as they might otherwise be expanded by user macros.
 
32
   There are some unavoidable exceptions within include files to
 
33
   define necessary library symbols; they are noted "INFRINGES ON
 
34
   USER NAME SPACE" below.  */
 
35
 
 
36
/* Identify Bison output.  */
 
37
#define YYBISON 1
 
38
 
 
39
/* Skeleton name.  */
 
40
#define YYSKELETON_NAME "yacc.c"
 
41
 
 
42
/* Pure parsers.  */
 
43
#define YYPURE 1
 
44
 
 
45
/* Using locations.  */
 
46
#define YYLSP_NEEDED 1
 
47
 
 
48
/* If NAME_PREFIX is specified substitute the variables and functions
 
49
   names.  */
 
50
#define yyparse calib_yyparse
 
51
#define yylex   calib_yylex
 
52
#define yyerror calib_yyerror
 
53
#define yylval  calib_yylval
 
54
#define yychar  calib_yychar
 
55
#define yydebug calib_yydebug
 
56
#define yynerrs calib_yynerrs
 
57
#define yylloc calib_yylloc
 
58
 
 
59
/* Tokens.  */
 
60
#ifndef YYTOKENTYPE
 
61
# define YYTOKENTYPE
 
62
   /* Put the tokens into the symbol table, so that GDB and other debuggers
 
63
      know about them.  */
 
64
   enum yytokentype {
 
65
     T_DRIVER_NAME = 258,
 
66
     T_BOARD_NAME = 259,
 
67
     T_CALIBRATIONS = 260,
 
68
     T_SUBDEVICE = 261,
 
69
     T_CHANNELS = 262,
 
70
     T_RANGES = 263,
 
71
     T_AREFS = 264,
 
72
     T_CALDACS = 265,
 
73
     T_CHANNEL = 266,
 
74
     T_VALUE = 267,
 
75
     T_NUMBER = 268,
 
76
     T_STRING = 269,
 
77
     T_ASSIGN = 270
 
78
   };
 
79
#endif
 
80
#define T_DRIVER_NAME 258
 
81
#define T_BOARD_NAME 259
 
82
#define T_CALIBRATIONS 260
 
83
#define T_SUBDEVICE 261
 
84
#define T_CHANNELS 262
 
85
#define T_RANGES 263
 
86
#define T_AREFS 264
 
87
#define T_CALDACS 265
 
88
#define T_CHANNEL 266
 
89
#define T_VALUE 267
 
90
#define T_NUMBER 268
 
91
#define T_STRING 269
 
92
#define T_ASSIGN 270
 
93
 
 
94
 
 
95
 
 
96
 
 
97
/* Copy the first part of user declarations.  */
 
98
#line 1 "calib_yacc.y"
 
99
 
 
100
/*
 
101
    lib/calib_yacc.y
 
102
    code for parsing calibration file, generated by bison
 
103
 
 
104
    Copyright (C) 2003 Frank Mori Hess <fmhess@users.sourceforge.net>
 
105
 
 
106
    This library is free software; you can redistribute it and/or
 
107
    modify it under the terms of the GNU Lesser General Public
 
108
    License as published by the Free Software Foundation, version 2.1
 
109
    of the License.
 
110
 
 
111
    This library is distributed in the hope that it will be useful,
 
112
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
113
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
114
    Lesser General Public License for more details.
 
115
 
 
116
    You should have received a copy of the GNU Lesser General Public
 
117
    License along with this library; if not, write to the Free Software
 
118
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 
119
    USA.
 
120
*/
 
121
 
 
122
#include <stdio.h>
 
123
#include "libinternal.h"
 
124
#include <string.h>
 
125
#include <stdlib.h>
 
126
#include "calib_yacc.h"
 
127
 
 
128
#define YYERROR_VERBOSE
 
129
#define YYPARSE_PARAM parse_arg
 
130
 
 
131
typedef struct
 
132
{
 
133
        comedi_calibration_t *parsed_file;
 
134
        comedi_caldac_t caldac;
 
135
        int cal_index;
 
136
} calib_yyparse_private_t;
 
137
 
 
138
YY_DECL;
 
139
 
 
140
static inline calib_yyparse_private_t* priv( calib_yyparse_private_t *parse_arg)
 
141
{
 
142
        return parse_arg;
 
143
}
 
144
 
 
145
static void free_calibration_setting( comedi_calibration_setting_t *setting )
 
146
{
 
147
        if( setting->channels );
 
148
        {
 
149
                free( setting->channels );
 
150
                setting->channels = NULL;
 
151
                setting->num_channels = 0;
 
152
        }
 
153
        if( setting->ranges );
 
154
        {
 
155
                free( setting->ranges );
 
156
                setting->ranges = NULL;
 
157
                setting->num_ranges = 0;
 
158
        }
 
159
        setting->num_arefs = 0;
 
160
        if( setting->caldacs );
 
161
        {
 
162
                free( setting->caldacs );
 
163
                setting->caldacs = NULL;
 
164
                setting->num_caldacs = 0;
 
165
        }
 
166
}
 
167
 
 
168
static void free_settings( comedi_calibration_t *file_contents )
 
169
{
 
170
        int i;
 
171
 
 
172
        if( file_contents->settings == NULL ) return;
 
173
 
 
174
        for( i = 0; i < file_contents->num_settings; i++ )
 
175
        {
 
176
                free_calibration_setting( &file_contents->settings[ i ] );
 
177
        }
 
178
        file_contents->settings = NULL;
 
179
}
 
180
 
 
181
static int add_calibration_setting( comedi_calibration_t *file_contents )
 
182
{
 
183
        comedi_calibration_setting_t *temp;
 
184
 
 
185
        temp = realloc( file_contents->settings,
 
186
                ( file_contents->num_settings + 1 ) * sizeof( comedi_calibration_setting_t ) );
 
187
        if( temp == NULL ) return -1;
 
188
        file_contents->settings = temp;
 
189
        memset( &file_contents->settings[ file_contents->num_settings ],
 
190
                0, sizeof( comedi_calibration_setting_t ) );
 
191
 
 
192
        file_contents->num_settings++;
 
193
        return 0;
 
194
}
 
195
 
 
196
static comedi_calibration_setting_t* current_setting( calib_yyparse_private_t *priv )
 
197
{
 
198
        int retval;
 
199
 
 
200
        while( priv->cal_index >= priv->parsed_file->num_settings )
 
201
        {
 
202
                retval = add_calibration_setting( priv->parsed_file );
 
203
                if( retval < 0 ) return NULL;
 
204
        }
 
205
        return &priv->parsed_file->settings[ priv->cal_index ];
 
206
}
 
207
 
 
208
static int add_channel( calib_yyparse_private_t *priv, int channel )
 
209
{
 
210
        int *temp;
 
211
        comedi_calibration_setting_t *setting;
 
212
 
 
213
        setting = current_setting( priv );
 
214
        if( setting == NULL ) return -1;
 
215
 
 
216
        temp = realloc( setting->channels, ( setting->num_channels + 1 ) * sizeof( int ) );
 
217
        if( temp == NULL ) return -1;
 
218
        setting->channels = temp;
 
219
        setting->channels[ setting->num_channels++ ] = channel;
 
220
        return 0;
 
221
}
 
222
 
 
223
static int add_range( calib_yyparse_private_t *priv, int range )
 
224
{
 
225
        int *temp;
 
226
        comedi_calibration_setting_t *setting;
 
227
 
 
228
        setting = current_setting( priv );
 
229
        if( setting == NULL ) return -1;
 
230
 
 
231
        temp = realloc( setting->ranges, ( setting->num_ranges + 1 ) * sizeof( int ) );
 
232
        if( temp == NULL ) return -1;
 
233
        setting->ranges = temp;
 
234
        setting->ranges[ setting->num_ranges++ ] = range;
 
235
        return 0;
 
236
}
 
237
 
 
238
static int add_aref( calib_yyparse_private_t *priv, int aref )
 
239
{
 
240
        comedi_calibration_setting_t *setting;
 
241
 
 
242
        setting = current_setting( priv );
 
243
        if( setting == NULL ) return -1;
 
244
 
 
245
        if( setting->num_arefs >= sizeof( setting->arefs ) /
 
246
                sizeof( setting->arefs[ 0 ] ) )
 
247
                return -1;
 
248
        setting->arefs[ setting->num_arefs++ ] = aref;
 
249
        return 0;
 
250
}
 
251
 
 
252
static int add_caldac( calib_yyparse_private_t *priv,
 
253
        comedi_caldac_t caldac )
 
254
{
 
255
        comedi_caldac_t *temp;
 
256
        comedi_calibration_setting_t *setting;
 
257
 
 
258
        setting = current_setting( priv );
 
259
        if( setting == NULL ) return -1;
 
260
 
 
261
        temp = realloc( setting->caldacs, ( setting->num_caldacs + 1 ) *
 
262
                sizeof( comedi_caldac_t ) );
 
263
        if( temp == NULL ) return -1;
 
264
        setting->caldacs = temp;
 
265
        setting->caldacs[ setting->num_caldacs++ ] = caldac;
 
266
        return 0;
 
267
}
 
268
 
 
269
static comedi_calibration_t* alloc_calib_parse( void )
 
270
{
 
271
        comedi_calibration_t *file_contents;
 
272
 
 
273
        file_contents = malloc( sizeof( *file_contents ) );
 
274
        if( file_contents == NULL ) return file_contents;
 
275
        memset( file_contents, 0, sizeof( *file_contents ) );
 
276
        return file_contents;
 
277
}
 
278
 
 
279
EXPORT_ALIAS_DEFAULT(_comedi_cleanup_calibration,comedi_cleanup_calibration,0.7.20);
 
280
extern void _comedi_cleanup_calibration( comedi_calibration_t *file_contents )
 
281
{
 
282
        if( file_contents->driver_name )
 
283
        {
 
284
                free( file_contents->driver_name );
 
285
                file_contents->driver_name = NULL;
 
286
        }
 
287
        if( file_contents->board_name )
 
288
        {
 
289
                free( file_contents->board_name );
 
290
                file_contents->board_name = NULL;
 
291
        }
 
292
        free_settings( file_contents );
 
293
        free( file_contents );
 
294
        file_contents = NULL;
 
295
}
 
296
 
 
297
EXPORT_ALIAS_DEFAULT(_comedi_parse_calibration_file,comedi_parse_calibration_file,0.7.20);
 
298
extern comedi_calibration_t* _comedi_parse_calibration_file( const char *cal_file_path )
 
299
{
 
300
        calib_yyparse_private_t priv;
 
301
        FILE *file;
 
302
 
 
303
        if( cal_file_path == NULL ) return NULL;
 
304
        
 
305
        priv.parsed_file = alloc_calib_parse();
 
306
        if( priv.parsed_file == NULL ) return NULL;
 
307
        priv.cal_index = 0;
 
308
 
 
309
        file = fopen( cal_file_path, "r" );
 
310
        if( file == NULL )
 
311
        {
 
312
                COMEDILIB_DEBUG( 3, "failed to open file\n" );
 
313
                return NULL;
 
314
        }
 
315
        calib_yyrestart( file );
 
316
        if( calib_yyparse( &priv ) )
 
317
        {
 
318
                comedi_cleanup_calibration( priv.parsed_file );
 
319
                priv.parsed_file = NULL;
 
320
        }
 
321
        fclose( file );
 
322
        return priv.parsed_file;
 
323
}
 
324
 
 
325
 
 
326
 
 
327
/* Enabling traces.  */
 
328
#ifndef YYDEBUG
 
329
# define YYDEBUG 0
 
330
#endif
 
331
 
 
332
/* Enabling verbose error messages.  */
 
333
#ifdef YYERROR_VERBOSE
 
334
# undef YYERROR_VERBOSE
 
335
# define YYERROR_VERBOSE 1
 
336
#else
 
337
# define YYERROR_VERBOSE 0
 
338
#endif
 
339
 
 
340
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 
341
#line 232 "calib_yacc.y"
 
342
typedef union YYSTYPE {
 
343
        int  ival;
 
344
        char *sval;
 
345
} YYSTYPE;
 
346
/* Line 191 of yacc.c.  */
 
347
#line 348 "calib_yacc.c"
 
348
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
 
349
# define YYSTYPE_IS_DECLARED 1
 
350
# define YYSTYPE_IS_TRIVIAL 1
 
351
#endif
 
352
 
 
353
#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
 
354
typedef struct YYLTYPE
 
355
{
 
356
  int first_line;
 
357
  int first_column;
 
358
  int last_line;
 
359
  int last_column;
 
360
} YYLTYPE;
 
361
# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
 
362
# define YYLTYPE_IS_DECLARED 1
 
363
# define YYLTYPE_IS_TRIVIAL 1
 
364
#endif
 
365
 
 
366
 
 
367
/* Copy the second part of user declarations.  */
 
368
 
 
369
 
 
370
/* Line 214 of yacc.c.  */
 
371
#line 372 "calib_yacc.c"
 
372
 
 
373
#if ! defined (yyoverflow) || YYERROR_VERBOSE
 
374
 
 
375
/* The parser invokes alloca or malloc; define the necessary symbols.  */
 
376
 
 
377
# if YYSTACK_USE_ALLOCA
 
378
#  define YYSTACK_ALLOC alloca
 
379
# else
 
380
#  ifndef YYSTACK_USE_ALLOCA
 
381
#   if defined (alloca) || defined (_ALLOCA_H)
 
382
#    define YYSTACK_ALLOC alloca
 
383
#   else
 
384
#    ifdef __GNUC__
 
385
#     define YYSTACK_ALLOC __builtin_alloca
 
386
#    endif
 
387
#   endif
 
388
#  endif
 
389
# endif
 
390
 
 
391
# ifdef YYSTACK_ALLOC
 
392
   /* Pacify GCC's `empty if-body' warning. */
 
393
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
 
394
# else
 
395
#  if defined (__STDC__) || defined (__cplusplus)
 
396
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
 
397
#   define YYSIZE_T size_t
 
398
#  endif
 
399
#  define YYSTACK_ALLOC malloc
 
400
#  define YYSTACK_FREE free
 
401
# endif
 
402
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
 
403
 
 
404
 
 
405
#if (! defined (yyoverflow) \
 
406
     && (! defined (__cplusplus) \
 
407
         || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
 
408
 
 
409
/* A type that is properly aligned for any stack member.  */
 
410
union yyalloc
 
411
{
 
412
  short yyss;
 
413
  YYSTYPE yyvs;
 
414
    YYLTYPE yyls;
 
415
};
 
416
 
 
417
/* The size of the maximum gap between one aligned stack and the next.  */
 
418
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
 
419
 
 
420
/* The size of an array large to enough to hold all stacks, each with
 
421
   N elements.  */
 
422
# define YYSTACK_BYTES(N) \
 
423
     ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))      \
 
424
      + 2 * YYSTACK_GAP_MAXIMUM)
 
425
 
 
426
/* Copy COUNT objects from FROM to TO.  The source and destination do
 
427
   not overlap.  */
 
428
# ifndef YYCOPY
 
429
#  if 1 < __GNUC__
 
430
#   define YYCOPY(To, From, Count) \
 
431
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
 
432
#  else
 
433
#   define YYCOPY(To, From, Count)              \
 
434
      do                                        \
 
435
        {                                       \
 
436
          register YYSIZE_T yyi;                \
 
437
          for (yyi = 0; yyi < (Count); yyi++)   \
 
438
            (To)[yyi] = (From)[yyi];            \
 
439
        }                                       \
 
440
      while (0)
 
441
#  endif
 
442
# endif
 
443
 
 
444
/* Relocate STACK from its old location to the new one.  The
 
445
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
 
446
   elements in the stack, and YYPTR gives the new location of the
 
447
   stack.  Advance YYPTR to a properly aligned location for the next
 
448
   stack.  */
 
449
# define YYSTACK_RELOCATE(Stack)                                        \
 
450
    do                                                                  \
 
451
      {                                                                 \
 
452
        YYSIZE_T yynewbytes;                                            \
 
453
        YYCOPY (&yyptr->Stack, Stack, yysize);                          \
 
454
        Stack = &yyptr->Stack;                                          \
 
455
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
 
456
        yyptr += yynewbytes / sizeof (*yyptr);                          \
 
457
      }                                                                 \
 
458
    while (0)
 
459
 
 
460
#endif
 
461
 
 
462
#if defined (__STDC__) || defined (__cplusplus)
 
463
   typedef signed char yysigned_char;
 
464
#else
 
465
   typedef short yysigned_char;
 
466
#endif
 
467
 
 
468
/* YYFINAL -- State number of the termination state. */
 
469
#define YYFINAL  9
 
470
/* YYLAST -- Last index in YYTABLE.  */
 
471
#define YYLAST   84
 
472
 
 
473
/* YYNTOKENS -- Number of terminals. */
 
474
#define YYNTOKENS  21
 
475
/* YYNNTS -- Number of nonterminals. */
 
476
#define YYNNTS  16
 
477
/* YYNRULES -- Number of rules. */
 
478
#define YYNRULES  41
 
479
/* YYNRULES -- Number of states. */
 
480
#define YYNSTATES  81
 
481
 
 
482
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 
483
#define YYUNDEFTOK  2
 
484
#define YYMAXUTOK   270
 
485
 
 
486
#define YYTRANSLATE(YYX)                                                \
 
487
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
 
488
 
 
489
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
 
490
static const unsigned char yytranslate[] =
 
491
{
 
492
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
493
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
494
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
495
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
496
       2,     2,     2,     2,    18,     2,     2,     2,     2,     2,
 
497
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
498
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
499
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
500
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
501
       2,    19,     2,    20,     2,     2,     2,     2,     2,     2,
 
502
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
503
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
504
       2,     2,     2,    16,     2,    17,     2,     2,     2,     2,
 
505
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
506
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
507
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
508
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
509
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
510
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
511
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
512
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
513
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
514
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
515
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
516
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
517
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
 
518
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
 
519
      15
 
520
};
 
521
 
 
522
#if YYDEBUG
 
523
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
 
524
   YYRHS.  */
 
525
static const unsigned char yyprhs[] =
 
526
{
 
527
       0,     0,     3,     7,     9,    10,    12,    16,    20,    24,
 
528
      30,    31,    35,    41,    42,    44,    48,    52,    58,    64,
 
529
      70,    76,    77,    79,    83,    85,    86,    88,    92,    94,
 
530
      95,    97,   101,   103,   104,   108,   114,   115,   117,   121,
 
531
     125,   129
 
532
};
 
533
 
 
534
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
 
535
static const yysigned_char yyrhs[] =
 
536
{
 
537
      22,     0,    -1,    16,    23,    17,    -1,     1,    -1,    -1,
 
538
      24,    -1,    24,    18,    23,    -1,     3,    15,    14,    -1,
 
539
       4,    15,    14,    -1,     5,    15,    19,    25,    20,    -1,
 
540
      -1,    16,    26,    17,    -1,    16,    26,    17,    18,    25,
 
541
      -1,    -1,    27,    -1,    27,    18,    26,    -1,     6,    15,
 
542
      13,    -1,     7,    15,    19,    28,    20,    -1,     8,    15,
 
543
      19,    30,    20,    -1,     9,    15,    19,    32,    20,    -1,
 
544
      10,    15,    19,    34,    20,    -1,    -1,    29,    -1,    29,
 
545
      18,    28,    -1,    13,    -1,    -1,    31,    -1,    31,    18,
 
546
      30,    -1,    13,    -1,    -1,    33,    -1,    33,    18,    32,
 
547
      -1,    13,    -1,    -1,    16,    35,    17,    -1,    16,    35,
 
548
      17,    18,    34,    -1,    -1,    36,    -1,    36,    18,    35,
 
549
      -1,     6,    15,    13,    -1,    11,    15,    13,    -1,    12,
 
550
      15,    13,    -1
 
551
};
 
552
 
 
553
/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 
554
static const unsigned short yyrline[] =
 
555
{
 
556
       0,   246,   246,   247,   254,   255,   256,   259,   264,   269,
 
557
     272,   273,   274,   277,   278,   279,   282,   289,   290,   291,
 
558
     292,   295,   296,   297,   300,   303,   304,   305,   308,   311,
 
559
     312,   313,   316,   319,   320,   321,   324,   325,   326,   329,
 
560
     330,   331
 
561
};
 
562
#endif
 
563
 
 
564
#if YYDEBUG || YYERROR_VERBOSE
 
565
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
 
566
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
 
567
static const char *const yytname[] =
 
568
{
 
569
  "$end", "error", "$undefined", "T_DRIVER_NAME", "T_BOARD_NAME", 
 
570
  "T_CALIBRATIONS", "T_SUBDEVICE", "T_CHANNELS", "T_RANGES", "T_AREFS", 
 
571
  "T_CALDACS", "T_CHANNEL", "T_VALUE", "T_NUMBER", "T_STRING", "T_ASSIGN", 
 
572
  "'{'", "'}'", "','", "'['", "']'", "$accept", "input", "hash", 
 
573
  "hash_element", "calibrations_array", "calibration_setting", 
 
574
  "calibration_setting_element", "channels_array", "channel", 
 
575
  "ranges_array", "range", "arefs_array", "aref", "caldacs_array", 
 
576
  "caldac", "caldac_element", 0
 
577
};
 
578
#endif
 
579
 
 
580
# ifdef YYPRINT
 
581
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
 
582
   token YYLEX-NUM.  */
 
583
static const unsigned short yytoknum[] =
 
584
{
 
585
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
 
586
     265,   266,   267,   268,   269,   270,   123,   125,    44,    91,
 
587
      93
 
588
};
 
589
# endif
 
590
 
 
591
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 
592
static const unsigned char yyr1[] =
 
593
{
 
594
       0,    21,    22,    22,    23,    23,    23,    24,    24,    24,
 
595
      25,    25,    25,    26,    26,    26,    27,    27,    27,    27,
 
596
      27,    28,    28,    28,    29,    30,    30,    30,    31,    32,
 
597
      32,    32,    33,    34,    34,    34,    35,    35,    35,    36,
 
598
      36,    36
 
599
};
 
600
 
 
601
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
 
602
static const unsigned char yyr2[] =
 
603
{
 
604
       0,     2,     3,     1,     0,     1,     3,     3,     3,     5,
 
605
       0,     3,     5,     0,     1,     3,     3,     5,     5,     5,
 
606
       5,     0,     1,     3,     1,     0,     1,     3,     1,     0,
 
607
       1,     3,     1,     0,     3,     5,     0,     1,     3,     3,
 
608
       3,     3
 
609
};
 
610
 
 
611
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
 
612
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
 
613
   means the default is an error.  */
 
614
static const unsigned char yydefact[] =
 
615
{
 
616
       0,     3,     4,     0,     0,     0,     0,     0,     5,     1,
 
617
       0,     0,     0,     2,     4,     7,     8,    10,     6,    13,
 
618
       0,     0,     0,     0,     0,     0,     0,    14,     9,     0,
 
619
       0,     0,     0,     0,    11,    13,    16,    21,    25,    29,
 
620
      33,    10,    15,    24,     0,    22,    28,     0,    26,    32,
 
621
       0,    30,    36,     0,    12,    17,    21,    18,    25,    19,
 
622
      29,     0,     0,     0,     0,    37,    20,    23,    27,    31,
 
623
       0,     0,     0,    34,    36,    39,    40,    41,    33,    38,
 
624
      35
 
625
};
 
626
 
 
627
/* YYDEFGOTO[NTERM-NUM]. */
 
628
static const yysigned_char yydefgoto[] =
 
629
{
 
630
      -1,     3,     7,     8,    20,    26,    27,    44,    45,    47,
 
631
      48,    50,    51,    53,    64,    65
 
632
};
 
633
 
 
634
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
 
635
   STATE-NUM.  */
 
636
#define YYPACT_NINF -24
 
637
static const yysigned_char yypact[] =
 
638
{
 
639
      -1,   -24,     0,    13,   -13,     1,     3,    -3,     4,   -24,
 
640
       5,     6,    -2,   -24,     0,   -24,   -24,     7,   -24,     2,
 
641
       8,     9,    10,    11,    12,    14,    15,    16,   -24,    17,
 
642
      18,    19,    20,    21,    23,     2,   -24,    22,    29,    30,
 
643
      28,     7,   -24,   -24,    25,    31,   -24,    26,    32,   -24,
 
644
      27,    33,    -5,    34,   -24,   -24,    22,   -24,    29,   -24,
 
645
      30,    37,    38,    40,    39,    41,   -24,   -24,   -24,   -24,
 
646
      35,    44,    45,    42,    -5,   -24,   -24,   -24,    28,   -24,
 
647
     -24
 
648
};
 
649
 
 
650
/* YYPGOTO[NTERM-NUM].  */
 
651
static const yysigned_char yypgoto[] =
 
652
{
 
653
     -24,   -24,    47,   -24,   -20,    -4,   -24,   -23,   -24,   -22,
 
654
     -24,    24,   -24,   -16,   -11,   -24
 
655
};
 
656
 
 
657
/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
 
658
   positive, shift that token.  If negative, reduce the rule which
 
659
   number is the opposite.  If zero, do what YYDEFACT says.
 
660
   If YYTABLE_NINF, syntax error.  */
 
661
#define YYTABLE_NINF -1
 
662
static const unsigned char yytable[] =
 
663
{
 
664
       1,    61,    10,     4,     5,     6,    62,    63,    21,    22,
 
665
      23,    24,    25,     9,    13,     2,    11,    17,    12,    15,
 
666
      16,    54,    14,    19,    29,    30,    31,    32,    28,    33,
 
667
      36,    42,    34,    67,    35,    43,    68,    37,    38,    39,
 
668
      40,    41,    46,    49,    52,    55,    57,    59,    75,    56,
 
669
      58,    60,    70,    71,    66,    72,    73,    76,    77,    74,
 
670
      78,    18,    80,    79,     0,     0,     0,     0,     0,     0,
 
671
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
 
672
       0,     0,     0,     0,    69
 
673
};
 
674
 
 
675
static const yysigned_char yycheck[] =
 
676
{
 
677
       1,     6,    15,     3,     4,     5,    11,    12,     6,     7,
 
678
       8,     9,    10,     0,    17,    16,    15,    19,    15,    14,
 
679
      14,    41,    18,    16,    15,    15,    15,    15,    20,    15,
 
680
      13,    35,    17,    56,    18,    13,    58,    19,    19,    19,
 
681
      19,    18,    13,    13,    16,    20,    20,    20,    13,    18,
 
682
      18,    18,    15,    15,    20,    15,    17,    13,    13,    18,
 
683
      18,    14,    78,    74,    -1,    -1,    -1,    -1,    -1,    -1,
 
684
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
 
685
      -1,    -1,    -1,    -1,    60
 
686
};
 
687
 
 
688
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
 
689
   symbol of state STATE-NUM.  */
 
690
static const unsigned char yystos[] =
 
691
{
 
692
       0,     1,    16,    22,     3,     4,     5,    23,    24,     0,
 
693
      15,    15,    15,    17,    18,    14,    14,    19,    23,    16,
 
694
      25,     6,     7,     8,     9,    10,    26,    27,    20,    15,
 
695
      15,    15,    15,    15,    17,    18,    13,    19,    19,    19,
 
696
      19,    18,    26,    13,    28,    29,    13,    30,    31,    13,
 
697
      32,    33,    16,    34,    25,    20,    18,    20,    18,    20,
 
698
      18,     6,    11,    12,    35,    36,    20,    28,    30,    32,
 
699
      15,    15,    15,    17,    18,    13,    13,    13,    18,    35,
 
700
      34
 
701
};
 
702
 
 
703
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
 
704
# define YYSIZE_T __SIZE_TYPE__
 
705
#endif
 
706
#if ! defined (YYSIZE_T) && defined (size_t)
 
707
# define YYSIZE_T size_t
 
708
#endif
 
709
#if ! defined (YYSIZE_T)
 
710
# if defined (__STDC__) || defined (__cplusplus)
 
711
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
 
712
#  define YYSIZE_T size_t
 
713
# endif
 
714
#endif
 
715
#if ! defined (YYSIZE_T)
 
716
# define YYSIZE_T unsigned int
 
717
#endif
 
718
 
 
719
#define yyerrok         (yyerrstatus = 0)
 
720
#define yyclearin       (yychar = YYEMPTY)
 
721
#define YYEMPTY         (-2)
 
722
#define YYEOF           0
 
723
 
 
724
#define YYACCEPT        goto yyacceptlab
 
725
#define YYABORT         goto yyabortlab
 
726
#define YYERROR         do                              \
 
727
                          {                             \
 
728
                            yylerrsp = yylsp;           \
 
729
                            *++yylerrsp = yyloc;        \
 
730
                            goto yyerrlab1;             \
 
731
                          }                             \
 
732
                        while (0)
 
733
 
 
734
 
 
735
/* Like YYERROR except do call yyerror.  This remains here temporarily
 
736
   to ease the transition to the new meaning of YYERROR, for GCC.
 
737
   Once GCC version 2 has supplanted version 1, this can go.  */
 
738
 
 
739
#define YYFAIL          goto yyerrlab
 
740
 
 
741
#define YYRECOVERING()  (!!yyerrstatus)
 
742
 
 
743
#define YYBACKUP(Token, Value)                                  \
 
744
do                                                              \
 
745
  if (yychar == YYEMPTY && yylen == 1)                          \
 
746
    {                                                           \
 
747
      yychar = (Token);                                         \
 
748
      yylval = (Value);                                         \
 
749
      yytoken = YYTRANSLATE (yychar);                           \
 
750
      YYPOPSTACK;                                               \
 
751
      goto yybackup;                                            \
 
752
    }                                                           \
 
753
  else                                                          \
 
754
    {                                                           \
 
755
      yyerror ("syntax error: cannot back up");\
 
756
      YYERROR;                                                  \
 
757
    }                                                           \
 
758
while (0)
 
759
 
 
760
#define YYTERROR        1
 
761
#define YYERRCODE       256
 
762
 
 
763
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
 
764
   are run).  */
 
765
 
 
766
#ifndef YYLLOC_DEFAULT
 
767
# define YYLLOC_DEFAULT(Current, Rhs, N)         \
 
768
  Current.first_line   = Rhs[1].first_line;      \
 
769
  Current.first_column = Rhs[1].first_column;    \
 
770
  Current.last_line    = Rhs[N].last_line;       \
 
771
  Current.last_column  = Rhs[N].last_column;
 
772
#endif
 
773
 
 
774
/* YYLEX -- calling `yylex' with the right arguments.  */
 
775
 
 
776
#ifdef YYLEX_PARAM
 
777
# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
 
778
#else
 
779
# define YYLEX yylex (&yylval, &yylloc)
 
780
#endif
 
781
 
 
782
/* Enable debugging if requested.  */
 
783
#if YYDEBUG
 
784
 
 
785
# ifndef YYFPRINTF
 
786
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
 
787
#  define YYFPRINTF fprintf
 
788
# endif
 
789
 
 
790
# define YYDPRINTF(Args)                        \
 
791
do {                                            \
 
792
  if (yydebug)                                  \
 
793
    YYFPRINTF Args;                             \
 
794
} while (0)
 
795
 
 
796
# define YYDSYMPRINT(Args)                      \
 
797
do {                                            \
 
798
  if (yydebug)                                  \
 
799
    yysymprint Args;                            \
 
800
} while (0)
 
801
 
 
802
# define YYDSYMPRINTF(Title, Token, Value, Location)            \
 
803
do {                                                            \
 
804
  if (yydebug)                                                  \
 
805
    {                                                           \
 
806
      YYFPRINTF (stderr, "%s ", Title);                         \
 
807
      yysymprint (stderr,                                       \
 
808
                  Token, Value, Location);      \
 
809
      YYFPRINTF (stderr, "\n");                                 \
 
810
    }                                                           \
 
811
} while (0)
 
812
 
 
813
/*------------------------------------------------------------------.
 
814
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
 
815
| TOP (cinluded).                                                   |
 
816
`------------------------------------------------------------------*/
 
817
 
 
818
#if defined (__STDC__) || defined (__cplusplus)
 
819
static void
 
820
yy_stack_print (short *bottom, short *top)
 
821
#else
 
822
static void
 
823
yy_stack_print (bottom, top)
 
824
    short *bottom;
 
825
    short *top;
 
826
#endif
 
827
{
 
828
  YYFPRINTF (stderr, "Stack now");
 
829
  for (/* Nothing. */; bottom <= top; ++bottom)
 
830
    YYFPRINTF (stderr, " %d", *bottom);
 
831
  YYFPRINTF (stderr, "\n");
 
832
}
 
833
 
 
834
# define YY_STACK_PRINT(Bottom, Top)                            \
 
835
do {                                                            \
 
836
  if (yydebug)                                                  \
 
837
    yy_stack_print ((Bottom), (Top));                           \
 
838
} while (0)
 
839
 
 
840
 
 
841
/*------------------------------------------------.
 
842
| Report that the YYRULE is going to be reduced.  |
 
843
`------------------------------------------------*/
 
844
 
 
845
#if defined (__STDC__) || defined (__cplusplus)
 
846
static void
 
847
yy_reduce_print (int yyrule)
 
848
#else
 
849
static void
 
850
yy_reduce_print (yyrule)
 
851
    int yyrule;
 
852
#endif
 
853
{
 
854
  int yyi;
 
855
  unsigned int yylineno = yyrline[yyrule];
 
856
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
 
857
             yyrule - 1, yylineno);
 
858
  /* Print the symbols being reduced, and their result.  */
 
859
  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
 
860
    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
 
861
  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
 
862
}
 
863
 
 
864
# define YY_REDUCE_PRINT(Rule)          \
 
865
do {                                    \
 
866
  if (yydebug)                          \
 
867
    yy_reduce_print (Rule);             \
 
868
} while (0)
 
869
 
 
870
/* Nonzero means print parse trace.  It is left uninitialized so that
 
871
   multiple parsers can coexist.  */
 
872
int yydebug;
 
873
#else /* !YYDEBUG */
 
874
# define YYDPRINTF(Args)
 
875
# define YYDSYMPRINT(Args)
 
876
# define YYDSYMPRINTF(Title, Token, Value, Location)
 
877
# define YY_STACK_PRINT(Bottom, Top)
 
878
# define YY_REDUCE_PRINT(Rule)
 
879
#endif /* !YYDEBUG */
 
880
 
 
881
 
 
882
/* YYINITDEPTH -- initial size of the parser's stacks.  */
 
883
#ifndef YYINITDEPTH
 
884
# define YYINITDEPTH 200
 
885
#endif
 
886
 
 
887
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
 
888
   if the built-in stack extension method is used).
 
889
 
 
890
   Do not make this value too large; the results are undefined if
 
891
   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
 
892
   evaluated with infinite-precision integer arithmetic.  */
 
893
 
 
894
#if YYMAXDEPTH == 0
 
895
# undef YYMAXDEPTH
 
896
#endif
 
897
 
 
898
#ifndef YYMAXDEPTH
 
899
# define YYMAXDEPTH 10000
 
900
#endif
 
901
 
 
902
 
 
903
 
 
904
#if YYERROR_VERBOSE
 
905
 
 
906
# ifndef yystrlen
 
907
#  if defined (__GLIBC__) && defined (_STRING_H)
 
908
#   define yystrlen strlen
 
909
#  else
 
910
/* Return the length of YYSTR.  */
 
911
static YYSIZE_T
 
912
#   if defined (__STDC__) || defined (__cplusplus)
 
913
yystrlen (const char *yystr)
 
914
#   else
 
915
yystrlen (yystr)
 
916
     const char *yystr;
 
917
#   endif
 
918
{
 
919
  register const char *yys = yystr;
 
920
 
 
921
  while (*yys++ != '\0')
 
922
    continue;
 
923
 
 
924
  return yys - yystr - 1;
 
925
}
 
926
#  endif
 
927
# endif
 
928
 
 
929
# ifndef yystpcpy
 
930
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
 
931
#   define yystpcpy stpcpy
 
932
#  else
 
933
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
 
934
   YYDEST.  */
 
935
static char *
 
936
#   if defined (__STDC__) || defined (__cplusplus)
 
937
yystpcpy (char *yydest, const char *yysrc)
 
938
#   else
 
939
yystpcpy (yydest, yysrc)
 
940
     char *yydest;
 
941
     const char *yysrc;
 
942
#   endif
 
943
{
 
944
  register char *yyd = yydest;
 
945
  register const char *yys = yysrc;
 
946
 
 
947
  while ((*yyd++ = *yys++) != '\0')
 
948
    continue;
 
949
 
 
950
  return yyd - 1;
 
951
}
 
952
#  endif
 
953
# endif
 
954
 
 
955
#endif /* !YYERROR_VERBOSE */
 
956
 
 
957
 
 
958
 
 
959
#if YYDEBUG
 
960
/*--------------------------------.
 
961
| Print this symbol on YYOUTPUT.  |
 
962
`--------------------------------*/
 
963
 
 
964
#if defined (__STDC__) || defined (__cplusplus)
 
965
static void
 
966
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
 
967
#else
 
968
static void
 
969
yysymprint (yyoutput, yytype, yyvaluep, yylocationp)
 
970
    FILE *yyoutput;
 
971
    int yytype;
 
972
    YYSTYPE *yyvaluep;
 
973
    YYLTYPE *yylocationp;
 
974
#endif
 
975
{
 
976
  /* Pacify ``unused variable'' warnings.  */
 
977
  (void) yyvaluep;
 
978
  (void) yylocationp;
 
979
 
 
980
  if (yytype < YYNTOKENS)
 
981
    {
 
982
      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
 
983
# ifdef YYPRINT
 
984
      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
 
985
# endif
 
986
    }
 
987
  else
 
988
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
 
989
 
 
990
  switch (yytype)
 
991
    {
 
992
      default:
 
993
        break;
 
994
    }
 
995
  YYFPRINTF (yyoutput, ")");
 
996
}
 
997
 
 
998
#endif /* ! YYDEBUG */
 
999
/*-----------------------------------------------.
 
1000
| Release the memory associated to this symbol.  |
 
1001
`-----------------------------------------------*/
 
1002
 
 
1003
#if defined (__STDC__) || defined (__cplusplus)
 
1004
static void
 
1005
yydestruct (int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
 
1006
#else
 
1007
static void
 
1008
yydestruct (yytype, yyvaluep, yylocationp)
 
1009
    int yytype;
 
1010
    YYSTYPE *yyvaluep;
 
1011
    YYLTYPE *yylocationp;
 
1012
#endif
 
1013
{
 
1014
  /* Pacify ``unused variable'' warnings.  */
 
1015
  (void) yyvaluep;
 
1016
  (void) yylocationp;
 
1017
 
 
1018
  switch (yytype)
 
1019
    {
 
1020
 
 
1021
      default:
 
1022
        break;
 
1023
    }
 
1024
}
 
1025
 
 
1026
 
 
1027
/* Prevent warnings from -Wmissing-prototypes.  */
 
1028
 
 
1029
#ifdef YYPARSE_PARAM
 
1030
# if defined (__STDC__) || defined (__cplusplus)
 
1031
int yyparse (void *YYPARSE_PARAM);
 
1032
# else
 
1033
int yyparse ();
 
1034
# endif
 
1035
#else /* ! YYPARSE_PARAM */
 
1036
#if defined (__STDC__) || defined (__cplusplus)
 
1037
int yyparse (void);
 
1038
#else
 
1039
int yyparse ();
 
1040
#endif
 
1041
#endif /* ! YYPARSE_PARAM */
 
1042
 
 
1043
 
 
1044
 
 
1045
 
 
1046
 
 
1047
 
 
1048
/*----------.
 
1049
| yyparse.  |
 
1050
`----------*/
 
1051
 
 
1052
#ifdef YYPARSE_PARAM
 
1053
# if defined (__STDC__) || defined (__cplusplus)
 
1054
int yyparse (void *YYPARSE_PARAM)
 
1055
# else
 
1056
int yyparse (YYPARSE_PARAM)
 
1057
  void *YYPARSE_PARAM;
 
1058
# endif
 
1059
#else /* ! YYPARSE_PARAM */
 
1060
#if defined (__STDC__) || defined (__cplusplus)
 
1061
int
 
1062
yyparse (void)
 
1063
#else
 
1064
int
 
1065
yyparse ()
 
1066
 
 
1067
#endif
 
1068
#endif
 
1069
{
 
1070
  /* The lookahead symbol.  */
 
1071
int yychar;
 
1072
 
 
1073
/* The semantic value of the lookahead symbol.  */
 
1074
YYSTYPE yylval;
 
1075
 
 
1076
/* Number of syntax errors so far.  */
 
1077
int yynerrs;
 
1078
/* Location data for the lookahead symbol.  */
 
1079
YYLTYPE yylloc;
 
1080
 
 
1081
  register int yystate;
 
1082
  register int yyn;
 
1083
  int yyresult;
 
1084
  /* Number of tokens to shift before error messages enabled.  */
 
1085
  int yyerrstatus;
 
1086
  /* Lookahead token as an internal (translated) token number.  */
 
1087
  int yytoken = 0;
 
1088
 
 
1089
  /* Three stacks and their tools:
 
1090
     `yyss': related to states,
 
1091
     `yyvs': related to semantic values,
 
1092
     `yyls': related to locations.
 
1093
 
 
1094
     Refer to the stacks thru separate pointers, to allow yyoverflow
 
1095
     to reallocate them elsewhere.  */
 
1096
 
 
1097
  /* The state stack.  */
 
1098
  short yyssa[YYINITDEPTH];
 
1099
  short *yyss = yyssa;
 
1100
  register short *yyssp;
 
1101
 
 
1102
  /* The semantic value stack.  */
 
1103
  YYSTYPE yyvsa[YYINITDEPTH];
 
1104
  YYSTYPE *yyvs = yyvsa;
 
1105
  register YYSTYPE *yyvsp;
 
1106
 
 
1107
  /* The location stack.  */
 
1108
  YYLTYPE yylsa[YYINITDEPTH];
 
1109
  YYLTYPE *yyls = yylsa;
 
1110
  YYLTYPE *yylsp;
 
1111
  YYLTYPE *yylerrsp;
 
1112
 
 
1113
#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
 
1114
 
 
1115
  YYSIZE_T yystacksize = YYINITDEPTH;
 
1116
 
 
1117
  /* The variables used to return semantic value and location from the
 
1118
     action routines.  */
 
1119
  YYSTYPE yyval;
 
1120
  YYLTYPE yyloc;
 
1121
 
 
1122
  /* When reducing, the number of symbols on the RHS of the reduced
 
1123
     rule.  */
 
1124
  int yylen;
 
1125
 
 
1126
  YYDPRINTF ((stderr, "Starting parse\n"));
 
1127
 
 
1128
  yystate = 0;
 
1129
  yyerrstatus = 0;
 
1130
  yynerrs = 0;
 
1131
  yychar = YYEMPTY;             /* Cause a token to be read.  */
 
1132
 
 
1133
  /* Initialize stack pointers.
 
1134
     Waste one element of value and location stack
 
1135
     so that they stay on the same level as the state stack.
 
1136
     The wasted elements are never initialized.  */
 
1137
 
 
1138
  yyssp = yyss;
 
1139
  yyvsp = yyvs;
 
1140
  yylsp = yyls;
 
1141
  goto yysetstate;
 
1142
 
 
1143
/*------------------------------------------------------------.
 
1144
| yynewstate -- Push a new state, which is found in yystate.  |
 
1145
`------------------------------------------------------------*/
 
1146
 yynewstate:
 
1147
  /* In all cases, when you get here, the value and location stacks
 
1148
     have just been pushed. so pushing a state here evens the stacks.
 
1149
     */
 
1150
  yyssp++;
 
1151
 
 
1152
 yysetstate:
 
1153
  *yyssp = yystate;
 
1154
 
 
1155
  if (yyss + yystacksize - 1 <= yyssp)
 
1156
    {
 
1157
      /* Get the current used size of the three stacks, in elements.  */
 
1158
      YYSIZE_T yysize = yyssp - yyss + 1;
 
1159
 
 
1160
#ifdef yyoverflow
 
1161
      {
 
1162
        /* Give user a chance to reallocate the stack. Use copies of
 
1163
           these so that the &'s don't force the real ones into
 
1164
           memory.  */
 
1165
        YYSTYPE *yyvs1 = yyvs;
 
1166
        short *yyss1 = yyss;
 
1167
        YYLTYPE *yyls1 = yyls;
 
1168
 
 
1169
        /* Each stack pointer address is followed by the size of the
 
1170
           data in use in that stack, in bytes.  This used to be a
 
1171
           conditional around just the two extra args, but that might
 
1172
           be undefined if yyoverflow is a macro.  */
 
1173
        yyoverflow ("parser stack overflow",
 
1174
                    &yyss1, yysize * sizeof (*yyssp),
 
1175
                    &yyvs1, yysize * sizeof (*yyvsp),
 
1176
                    &yyls1, yysize * sizeof (*yylsp),
 
1177
                    &yystacksize);
 
1178
        yyls = yyls1;
 
1179
        yyss = yyss1;
 
1180
        yyvs = yyvs1;
 
1181
      }
 
1182
#else /* no yyoverflow */
 
1183
# ifndef YYSTACK_RELOCATE
 
1184
      goto yyoverflowlab;
 
1185
# else
 
1186
      /* Extend the stack our own way.  */
 
1187
      if (YYMAXDEPTH <= yystacksize)
 
1188
        goto yyoverflowlab;
 
1189
      yystacksize *= 2;
 
1190
      if (YYMAXDEPTH < yystacksize)
 
1191
        yystacksize = YYMAXDEPTH;
 
1192
 
 
1193
      {
 
1194
        short *yyss1 = yyss;
 
1195
        union yyalloc *yyptr =
 
1196
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
 
1197
        if (! yyptr)
 
1198
          goto yyoverflowlab;
 
1199
        YYSTACK_RELOCATE (yyss);
 
1200
        YYSTACK_RELOCATE (yyvs);
 
1201
        YYSTACK_RELOCATE (yyls);
 
1202
#  undef YYSTACK_RELOCATE
 
1203
        if (yyss1 != yyssa)
 
1204
          YYSTACK_FREE (yyss1);
 
1205
      }
 
1206
# endif
 
1207
#endif /* no yyoverflow */
 
1208
 
 
1209
      yyssp = yyss + yysize - 1;
 
1210
      yyvsp = yyvs + yysize - 1;
 
1211
      yylsp = yyls + yysize - 1;
 
1212
 
 
1213
      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
 
1214
                  (unsigned long int) yystacksize));
 
1215
 
 
1216
      if (yyss + yystacksize - 1 <= yyssp)
 
1217
        YYABORT;
 
1218
    }
 
1219
 
 
1220
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 
1221
 
 
1222
  goto yybackup;
 
1223
 
 
1224
/*-----------.
 
1225
| yybackup.  |
 
1226
`-----------*/
 
1227
yybackup:
 
1228
 
 
1229
/* Do appropriate processing given the current state.  */
 
1230
/* Read a lookahead token if we need one and don't already have one.  */
 
1231
/* yyresume: */
 
1232
 
 
1233
  /* First try to decide what to do without reference to lookahead token.  */
 
1234
 
 
1235
  yyn = yypact[yystate];
 
1236
  if (yyn == YYPACT_NINF)
 
1237
    goto yydefault;
 
1238
 
 
1239
  /* Not known => get a lookahead token if don't already have one.  */
 
1240
 
 
1241
  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
 
1242
  if (yychar == YYEMPTY)
 
1243
    {
 
1244
      YYDPRINTF ((stderr, "Reading a token: "));
 
1245
      yychar = YYLEX;
 
1246
    }
 
1247
 
 
1248
  if (yychar <= YYEOF)
 
1249
    {
 
1250
      yychar = yytoken = YYEOF;
 
1251
      YYDPRINTF ((stderr, "Now at end of input.\n"));
 
1252
    }
 
1253
  else
 
1254
    {
 
1255
      yytoken = YYTRANSLATE (yychar);
 
1256
      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
 
1257
    }
 
1258
 
 
1259
  /* If the proper action on seeing token YYTOKEN is to reduce or to
 
1260
     detect an error, take that action.  */
 
1261
  yyn += yytoken;
 
1262
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
 
1263
    goto yydefault;
 
1264
  yyn = yytable[yyn];
 
1265
  if (yyn <= 0)
 
1266
    {
 
1267
      if (yyn == 0 || yyn == YYTABLE_NINF)
 
1268
        goto yyerrlab;
 
1269
      yyn = -yyn;
 
1270
      goto yyreduce;
 
1271
    }
 
1272
 
 
1273
  if (yyn == YYFINAL)
 
1274
    YYACCEPT;
 
1275
 
 
1276
  /* Shift the lookahead token.  */
 
1277
  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
 
1278
 
 
1279
  /* Discard the token being shifted unless it is eof.  */
 
1280
  if (yychar != YYEOF)
 
1281
    yychar = YYEMPTY;
 
1282
 
 
1283
  *++yyvsp = yylval;
 
1284
  *++yylsp = yylloc;
 
1285
 
 
1286
  /* Count tokens shifted since error; after three, turn off error
 
1287
     status.  */
 
1288
  if (yyerrstatus)
 
1289
    yyerrstatus--;
 
1290
 
 
1291
  yystate = yyn;
 
1292
  goto yynewstate;
 
1293
 
 
1294
 
 
1295
/*-----------------------------------------------------------.
 
1296
| yydefault -- do the default action for the current state.  |
 
1297
`-----------------------------------------------------------*/
 
1298
yydefault:
 
1299
  yyn = yydefact[yystate];
 
1300
  if (yyn == 0)
 
1301
    goto yyerrlab;
 
1302
  goto yyreduce;
 
1303
 
 
1304
 
 
1305
/*-----------------------------.
 
1306
| yyreduce -- Do a reduction.  |
 
1307
`-----------------------------*/
 
1308
yyreduce:
 
1309
  /* yyn is the number of a rule to reduce with.  */
 
1310
  yylen = yyr2[yyn];
 
1311
 
 
1312
  /* If YYLEN is nonzero, implement the default value of the action:
 
1313
     `$$ = $1'.
 
1314
 
 
1315
     Otherwise, the following line sets YYVAL to garbage.
 
1316
     This behavior is undocumented and Bison
 
1317
     users should not rely upon it.  Assigning to YYVAL
 
1318
     unconditionally makes the parser a bit smaller, and it avoids a
 
1319
     GCC warning that YYVAL may be used uninitialized.  */
 
1320
  yyval = yyvsp[1-yylen];
 
1321
 
 
1322
  /* Default location. */
 
1323
  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
 
1324
  YY_REDUCE_PRINT (yyn);
 
1325
  switch (yyn)
 
1326
    {
 
1327
        case 3:
 
1328
#line 248 "calib_yacc.y"
 
1329
    {
 
1330
                                fprintf(stderr, "input error on line %i\n", yylsp[0].first_line );
 
1331
                                YYABORT;
 
1332
                        }
 
1333
    break;
 
1334
 
 
1335
  case 7:
 
1336
#line 260 "calib_yacc.y"
 
1337
    {
 
1338
                        if( priv(parse_arg)->parsed_file->driver_name != NULL ) YYABORT;
 
1339
                        priv(parse_arg)->parsed_file->driver_name = strdup( yyvsp[0].sval );
 
1340
                }
 
1341
    break;
 
1342
 
 
1343
  case 8:
 
1344
#line 265 "calib_yacc.y"
 
1345
    {
 
1346
                        if( priv(parse_arg)->parsed_file->board_name != NULL ) YYABORT;
 
1347
                        priv(parse_arg)->parsed_file->board_name = strdup( yyvsp[0].sval );
 
1348
                }
 
1349
    break;
 
1350
 
 
1351
  case 13:
 
1352
#line 277 "calib_yacc.y"
 
1353
    { priv(parse_arg)->cal_index++; }
 
1354
    break;
 
1355
 
 
1356
  case 14:
 
1357
#line 278 "calib_yacc.y"
 
1358
    { priv(parse_arg)->cal_index++; }
 
1359
    break;
 
1360
 
 
1361
  case 16:
 
1362
#line 283 "calib_yacc.y"
 
1363
    {
 
1364
                        comedi_calibration_setting_t *setting;
 
1365
                        setting = current_setting( parse_arg );
 
1366
                        if( setting == NULL ) YYABORT;
 
1367
                        setting->subdevice = yyvsp[0].ival;
 
1368
                }
 
1369
    break;
 
1370
 
 
1371
  case 24:
 
1372
#line 300 "calib_yacc.y"
 
1373
    { add_channel( parse_arg, yyvsp[0].ival ); }
 
1374
    break;
 
1375
 
 
1376
  case 28:
 
1377
#line 308 "calib_yacc.y"
 
1378
    { add_range( parse_arg, yyvsp[0].ival ); }
 
1379
    break;
 
1380
 
 
1381
  case 32:
 
1382
#line 316 "calib_yacc.y"
 
1383
    { add_aref( parse_arg, yyvsp[0].ival ); }
 
1384
    break;
 
1385
 
 
1386
  case 36:
 
1387
#line 324 "calib_yacc.y"
 
1388
    { add_caldac( parse_arg, priv(parse_arg)->caldac ); }
 
1389
    break;
 
1390
 
 
1391
  case 37:
 
1392
#line 325 "calib_yacc.y"
 
1393
    { add_caldac( parse_arg, priv(parse_arg)->caldac ); }
 
1394
    break;
 
1395
 
 
1396
  case 39:
 
1397
#line 329 "calib_yacc.y"
 
1398
    { priv(parse_arg)->caldac.subdevice = yyvsp[0].ival; }
 
1399
    break;
 
1400
 
 
1401
  case 40:
 
1402
#line 330 "calib_yacc.y"
 
1403
    { priv(parse_arg)->caldac.channel = yyvsp[0].ival; }
 
1404
    break;
 
1405
 
 
1406
  case 41:
 
1407
#line 331 "calib_yacc.y"
 
1408
    { priv(parse_arg)->caldac.value = yyvsp[0].ival; }
 
1409
    break;
 
1410
 
 
1411
 
 
1412
    }
 
1413
 
 
1414
/* Line 999 of yacc.c.  */
 
1415
#line 1416 "calib_yacc.c"
 
1416
 
 
1417
  yyvsp -= yylen;
 
1418
  yyssp -= yylen;
 
1419
  yylsp -= yylen;
 
1420
 
 
1421
  YY_STACK_PRINT (yyss, yyssp);
 
1422
 
 
1423
  *++yyvsp = yyval;
 
1424
  *++yylsp = yyloc;
 
1425
 
 
1426
  /* Now `shift' the result of the reduction.  Determine what state
 
1427
     that goes to, based on the state we popped back to and the rule
 
1428
     number reduced by.  */
 
1429
 
 
1430
  yyn = yyr1[yyn];
 
1431
 
 
1432
  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
 
1433
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
 
1434
    yystate = yytable[yystate];
 
1435
  else
 
1436
    yystate = yydefgoto[yyn - YYNTOKENS];
 
1437
 
 
1438
  goto yynewstate;
 
1439
 
 
1440
 
 
1441
/*------------------------------------.
 
1442
| yyerrlab -- here on detecting error |
 
1443
`------------------------------------*/
 
1444
yyerrlab:
 
1445
  /* If not already recovering from an error, report this error.  */
 
1446
  if (!yyerrstatus)
 
1447
    {
 
1448
      ++yynerrs;
 
1449
#if YYERROR_VERBOSE
 
1450
      yyn = yypact[yystate];
 
1451
 
 
1452
      if (YYPACT_NINF < yyn && yyn < YYLAST)
 
1453
        {
 
1454
          YYSIZE_T yysize = 0;
 
1455
          int yytype = YYTRANSLATE (yychar);
 
1456
          char *yymsg;
 
1457
          int yyx, yycount;
 
1458
 
 
1459
          yycount = 0;
 
1460
          /* Start YYX at -YYN if negative to avoid negative indexes in
 
1461
             YYCHECK.  */
 
1462
          for (yyx = yyn < 0 ? -yyn : 0;
 
1463
               yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
 
1464
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
 
1465
              yysize += yystrlen (yytname[yyx]) + 15, yycount++;
 
1466
          yysize += yystrlen ("syntax error, unexpected ") + 1;
 
1467
          yysize += yystrlen (yytname[yytype]);
 
1468
          yymsg = (char *) YYSTACK_ALLOC (yysize);
 
1469
          if (yymsg != 0)
 
1470
            {
 
1471
              char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
 
1472
              yyp = yystpcpy (yyp, yytname[yytype]);
 
1473
 
 
1474
              if (yycount < 5)
 
1475
                {
 
1476
                  yycount = 0;
 
1477
                  for (yyx = yyn < 0 ? -yyn : 0;
 
1478
                       yyx < (int) (sizeof (yytname) / sizeof (char *));
 
1479
                       yyx++)
 
1480
                    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
 
1481
                      {
 
1482
                        const char *yyq = ! yycount ? ", expecting " : " or ";
 
1483
                        yyp = yystpcpy (yyp, yyq);
 
1484
                        yyp = yystpcpy (yyp, yytname[yyx]);
 
1485
                        yycount++;
 
1486
                      }
 
1487
                }
 
1488
              yyerror (yymsg);
 
1489
              YYSTACK_FREE (yymsg);
 
1490
            }
 
1491
          else
 
1492
            yyerror ("syntax error; also virtual memory exhausted");
 
1493
        }
 
1494
      else
 
1495
#endif /* YYERROR_VERBOSE */
 
1496
        yyerror ("syntax error");
 
1497
    }
 
1498
 
 
1499
  yylerrsp = yylsp;
 
1500
 
 
1501
  if (yyerrstatus == 3)
 
1502
    {
 
1503
      /* If just tried and failed to reuse lookahead token after an
 
1504
         error, discard it.  */
 
1505
 
 
1506
      /* Return failure if at end of input.  */
 
1507
      if (yychar == YYEOF)
 
1508
        {
 
1509
          /* Pop the error token.  */
 
1510
          YYPOPSTACK;
 
1511
          /* Pop the rest of the stack.  */
 
1512
          while (yyss < yyssp)
 
1513
            {
 
1514
              YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
 
1515
              yydestruct (yystos[*yyssp], yyvsp, yylsp);
 
1516
              YYPOPSTACK;
 
1517
            }
 
1518
          YYABORT;
 
1519
        }
 
1520
 
 
1521
      YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
 
1522
      yydestruct (yytoken, &yylval, &yylloc);
 
1523
      yychar = YYEMPTY;
 
1524
      *++yylerrsp = yylloc;
 
1525
    }
 
1526
 
 
1527
  /* Else will try to reuse lookahead token after shifting the error
 
1528
     token.  */
 
1529
  goto yyerrlab1;
 
1530
 
 
1531
 
 
1532
/*----------------------------------------------------.
 
1533
| yyerrlab1 -- error raised explicitly by an action.  |
 
1534
`----------------------------------------------------*/
 
1535
yyerrlab1:
 
1536
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
 
1537
 
 
1538
  for (;;)
 
1539
    {
 
1540
      yyn = yypact[yystate];
 
1541
      if (yyn != YYPACT_NINF)
 
1542
        {
 
1543
          yyn += YYTERROR;
 
1544
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
 
1545
            {
 
1546
              yyn = yytable[yyn];
 
1547
              if (0 < yyn)
 
1548
                break;
 
1549
            }
 
1550
        }
 
1551
 
 
1552
      /* Pop the current state because it cannot handle the error token.  */
 
1553
      if (yyssp == yyss)
 
1554
        YYABORT;
 
1555
 
 
1556
      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
 
1557
      yydestruct (yystos[yystate], yyvsp, yylsp);
 
1558
      yyvsp--;
 
1559
      yystate = *--yyssp;
 
1560
      yylsp--;
 
1561
      YY_STACK_PRINT (yyss, yyssp);
 
1562
    }
 
1563
 
 
1564
  if (yyn == YYFINAL)
 
1565
    YYACCEPT;
 
1566
 
 
1567
  YYDPRINTF ((stderr, "Shifting error token, "));
 
1568
 
 
1569
  *++yyvsp = yylval;
 
1570
  YYLLOC_DEFAULT (yyloc, yylsp, (yylerrsp - yylsp));
 
1571
  *++yylsp = yyloc;
 
1572
 
 
1573
  yystate = yyn;
 
1574
  goto yynewstate;
 
1575
 
 
1576
 
 
1577
/*-------------------------------------.
 
1578
| yyacceptlab -- YYACCEPT comes here.  |
 
1579
`-------------------------------------*/
 
1580
yyacceptlab:
 
1581
  yyresult = 0;
 
1582
  goto yyreturn;
 
1583
 
 
1584
/*-----------------------------------.
 
1585
| yyabortlab -- YYABORT comes here.  |
 
1586
`-----------------------------------*/
 
1587
yyabortlab:
 
1588
  yyresult = 1;
 
1589
  goto yyreturn;
 
1590
 
 
1591
#ifndef yyoverflow
 
1592
/*----------------------------------------------.
 
1593
| yyoverflowlab -- parser overflow comes here.  |
 
1594
`----------------------------------------------*/
 
1595
yyoverflowlab:
 
1596
  yyerror ("parser stack overflow");
 
1597
  yyresult = 2;
 
1598
  /* Fall through.  */
 
1599
#endif
 
1600
 
 
1601
yyreturn:
 
1602
#ifndef yyoverflow
 
1603
  if (yyss != yyssa)
 
1604
    YYSTACK_FREE (yyss);
 
1605
#endif
 
1606
  return yyresult;
 
1607
}
 
1608
 
 
1609
 
 
1610
#line 334 "calib_yacc.y"
 
1611
 
 
1612
 
 
1613
void calib_yyerror(char *s)
 
1614
{
 
1615
        fprintf(stderr, "%s\n", s);
 
1616
}
 
1617
 
 
1618
 
 
1619
 
 
1620