Imported Upstream version 0.4.8
[platform/upstream/libsmi.git] / lib / parser-smi.c
1 /* A Bison parser, made by GNU Bison 2.3.  */
2
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
4
5    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6    Free Software Foundation, Inc.
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2, or (at your option)
11    any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor,
21    Boston, MA 02110-1301, USA.  */
22
23 /* As a special exception, you may create a larger work that contains
24    part or all of the Bison parser skeleton and distribute that work
25    under terms of your choice, so long as that work isn't itself a
26    parser generator using the skeleton or a modified version thereof
27    as a parser skeleton.  Alternatively, if you modify or redistribute
28    the parser skeleton itself, you may (at your option) remove this
29    special exception, which will cause the skeleton and the resulting
30    Bison output files to be licensed under the GNU General Public
31    License without this special exception.
32
33    This special exception was added by the Free Software Foundation in
34    version 2.2 of Bison.  */
35
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37    simplifying the original so-called "semantic" parser.  */
38
39 /* All symbols defined below should begin with yy or YY, to avoid
40    infringing on user name space.  This should be done even for local
41    variables, as they might otherwise be expanded by user macros.
42    There are some unavoidable exceptions within include files to
43    define necessary library symbols; they are noted "INFRINGES ON
44    USER NAME SPACE" below.  */
45
46 /* Identify Bison output.  */
47 #define YYBISON 1
48
49 /* Bison version.  */
50 #define YYBISON_VERSION "2.3"
51
52 /* Skeleton name.  */
53 #define YYSKELETON_NAME "yacc.c"
54
55 /* Pure parsers.  */
56 #define YYPURE 1
57
58 /* Using locations.  */
59 #define YYLSP_NEEDED 0
60
61 /* Substitute the variable and function names.  */
62 #define yyparse smiparse
63 #define yylex   smilex
64 #define yyerror smierror
65 #define yylval  smilval
66 #define yychar  smichar
67 #define yydebug smidebug
68 #define yynerrs sminerrs
69
70
71 /* Tokens.  */
72 #ifndef YYTOKENTYPE
73 # define YYTOKENTYPE
74    /* Put the tokens into the symbol table, so that GDB and other debuggers
75       know about them.  */
76    enum yytokentype {
77      DOT_DOT = 258,
78      COLON_COLON_EQUAL = 259,
79      UPPERCASE_IDENTIFIER = 260,
80      LOWERCASE_IDENTIFIER = 261,
81      NUMBER = 262,
82      NEGATIVENUMBER = 263,
83      NUMBER64 = 264,
84      NEGATIVENUMBER64 = 265,
85      BIN_STRING = 266,
86      HEX_STRING = 267,
87      QUOTED_STRING = 268,
88      ACCESS = 269,
89      AGENT_CAPABILITIES = 270,
90      APPLICATION = 271,
91      AUGMENTS = 272,
92      BEGIN_ = 273,
93      BITS = 274,
94      CHOICE = 275,
95      CONTACT_INFO = 276,
96      CREATION_REQUIRES = 277,
97      COUNTER32 = 278,
98      COUNTER64 = 279,
99      DEFINITIONS = 280,
100      DEFVAL = 281,
101      DESCRIPTION = 282,
102      DISPLAY_HINT = 283,
103      END = 284,
104      ENTERPRISE = 285,
105      EXPORTS = 286,
106      EXTENDS = 287,
107      FROM = 288,
108      GROUP = 289,
109      GAUGE32 = 290,
110      IDENTIFIER = 291,
111      IMPLICIT = 292,
112      IMPLIED = 293,
113      IMPORTS = 294,
114      INCLUDES = 295,
115      INDEX = 296,
116      INSTALL_ERRORS = 297,
117      INTEGER = 298,
118      INTEGER32 = 299,
119      INTEGER64 = 300,
120      IPADDRESS = 301,
121      LAST_UPDATED = 302,
122      MACRO = 303,
123      MANDATORY_GROUPS = 304,
124      MAX_ACCESS = 305,
125      MIN_ACCESS = 306,
126      MODULE = 307,
127      MODULE_COMPLIANCE = 308,
128      MODULE_IDENTITY = 309,
129      NOT_ACCESSIBLE = 310,
130      NOTIFICATIONS = 311,
131      NOTIFICATION_GROUP = 312,
132      NOTIFICATION_TYPE = 313,
133      OBJECT = 314,
134      OBJECT_GROUP = 315,
135      OBJECT_IDENTITY = 316,
136      OBJECT_TYPE = 317,
137      OBJECTS = 318,
138      OCTET = 319,
139      OF = 320,
140      ORGANIZATION = 321,
141      OPAQUE = 322,
142      PIB_ACCESS = 323,
143      PIB_DEFINITIONS = 324,
144      PIB_INDEX = 325,
145      PIB_MIN_ACCESS = 326,
146      PIB_REFERENCES = 327,
147      PIB_TAG = 328,
148      POLICY_ACCESS = 329,
149      PRODUCT_RELEASE = 330,
150      REFERENCE = 331,
151      REVISION = 332,
152      SEQUENCE = 333,
153      SIZE = 334,
154      STATUS = 335,
155      STRING = 336,
156      SUBJECT_CATEGORIES = 337,
157      SUPPORTS = 338,
158      SYNTAX = 339,
159      TEXTUAL_CONVENTION = 340,
160      TIMETICKS = 341,
161      TRAP_TYPE = 342,
162      UNIQUENESS = 343,
163      UNITS = 344,
164      UNIVERSAL = 345,
165      UNSIGNED32 = 346,
166      UNSIGNED64 = 347,
167      VALUE = 348,
168      VARIABLES = 349,
169      VARIATION = 350,
170      WRITE_SYNTAX = 351
171    };
172 #endif
173 /* Tokens.  */
174 #define DOT_DOT 258
175 #define COLON_COLON_EQUAL 259
176 #define UPPERCASE_IDENTIFIER 260
177 #define LOWERCASE_IDENTIFIER 261
178 #define NUMBER 262
179 #define NEGATIVENUMBER 263
180 #define NUMBER64 264
181 #define NEGATIVENUMBER64 265
182 #define BIN_STRING 266
183 #define HEX_STRING 267
184 #define QUOTED_STRING 268
185 #define ACCESS 269
186 #define AGENT_CAPABILITIES 270
187 #define APPLICATION 271
188 #define AUGMENTS 272
189 #define BEGIN_ 273
190 #define BITS 274
191 #define CHOICE 275
192 #define CONTACT_INFO 276
193 #define CREATION_REQUIRES 277
194 #define COUNTER32 278
195 #define COUNTER64 279
196 #define DEFINITIONS 280
197 #define DEFVAL 281
198 #define DESCRIPTION 282
199 #define DISPLAY_HINT 283
200 #define END 284
201 #define ENTERPRISE 285
202 #define EXPORTS 286
203 #define EXTENDS 287
204 #define FROM 288
205 #define GROUP 289
206 #define GAUGE32 290
207 #define IDENTIFIER 291
208 #define IMPLICIT 292
209 #define IMPLIED 293
210 #define IMPORTS 294
211 #define INCLUDES 295
212 #define INDEX 296
213 #define INSTALL_ERRORS 297
214 #define INTEGER 298
215 #define INTEGER32 299
216 #define INTEGER64 300
217 #define IPADDRESS 301
218 #define LAST_UPDATED 302
219 #define MACRO 303
220 #define MANDATORY_GROUPS 304
221 #define MAX_ACCESS 305
222 #define MIN_ACCESS 306
223 #define MODULE 307
224 #define MODULE_COMPLIANCE 308
225 #define MODULE_IDENTITY 309
226 #define NOT_ACCESSIBLE 310
227 #define NOTIFICATIONS 311
228 #define NOTIFICATION_GROUP 312
229 #define NOTIFICATION_TYPE 313
230 #define OBJECT 314
231 #define OBJECT_GROUP 315
232 #define OBJECT_IDENTITY 316
233 #define OBJECT_TYPE 317
234 #define OBJECTS 318
235 #define OCTET 319
236 #define OF 320
237 #define ORGANIZATION 321
238 #define OPAQUE 322
239 #define PIB_ACCESS 323
240 #define PIB_DEFINITIONS 324
241 #define PIB_INDEX 325
242 #define PIB_MIN_ACCESS 326
243 #define PIB_REFERENCES 327
244 #define PIB_TAG 328
245 #define POLICY_ACCESS 329
246 #define PRODUCT_RELEASE 330
247 #define REFERENCE 331
248 #define REVISION 332
249 #define SEQUENCE 333
250 #define SIZE 334
251 #define STATUS 335
252 #define STRING 336
253 #define SUBJECT_CATEGORIES 337
254 #define SUPPORTS 338
255 #define SYNTAX 339
256 #define TEXTUAL_CONVENTION 340
257 #define TIMETICKS 341
258 #define TRAP_TYPE 342
259 #define UNIQUENESS 343
260 #define UNITS 344
261 #define UNIVERSAL 345
262 #define UNSIGNED32 346
263 #define UNSIGNED64 347
264 #define VALUE 348
265 #define VARIABLES 349
266 #define VARIATION 350
267 #define WRITE_SYNTAX 351
268
269
270
271
272 /* Copy the first part of user declarations.  */
273 #line 14 "parser-smi.y"
274
275
276 #include <config.h>
277     
278 #ifdef BACKEND_SMI
279
280 #include <stdio.h>
281 #include <errno.h>
282 #include <stdlib.h>
283 #include <string.h>
284 #include <ctype.h>
285 #include <time.h>
286 #include <limits.h>
287
288 #if defined(_MSC_VER)
289 #include <malloc.h>
290 #endif
291
292 #include "smi.h"
293 #include "error.h"
294 #include "parser-smi.h"
295 #include "scanner-smi.h"
296 #include "data.h"
297 #include "check.h"
298 #include "util.h"
299     
300 #ifdef HAVE_DMALLOC_H
301 #include <dmalloc.h>
302 #endif
303
304
305
306 /*
307  * These arguments are passed to yyparse() and yylex().
308  */
309 #define YYPARSE_PARAM parserPtr
310 #define YYLEX_PARAM   parserPtr
311
312     
313     
314 #define thisParserPtr      ((Parser *)parserPtr)
315 #define thisModulePtr     (((Parser *)parserPtr)->modulePtr)
316
317
318     
319 /*
320  * NOTE: The argument lvalp is not really a void pointer. Unfortunately,
321  * we don't know it better at this point. bison generated C code declares
322  * YYSTYPE just a few lines below based on the `%union' declaration.
323  */
324 extern int yylex(void *lvalp, Parser *parserPtr);
325
326
327
328 static int         impliedFlag;
329 static SmiNodekind variationkind;
330 static SmiBasetype defaultBasetype;
331 static int         indexFlag;
332
333 /*
334  * Values for the indexFlag variable
335  */
336 #define INDEXFLAG_NONE     0
337 #define INDEXFLAG_PIBINDEX 1
338 #define INDEXFLAG_AUGMENTS 2
339 #define INDEXFLAG_EXTENDS  3
340  
341
342 #define SMI_EPOCH       631152000       /* 01 Jan 1990 00:00:00 */ 
343
344  
345
346 static char *convertImportv2[] = {
347     "RFC1155-SMI", "internet",      "SNMPv2-SMI", "internet",
348     "RFC1155-SMI", "directory",     "SNMPv2-SMI", "directory",
349     "RFC1155-SMI", "mgmt",          "SNMPv2-SMI", "mgmt",
350     "RFC1155-SMI", "experimental",  "SNMPv2-SMI", "experimental",
351     "RFC1155-SMI", "private",       "SNMPv2-SMI", "private",
352     "RFC1155-SMI", "enterprises",   "SNMPv2-SMI", "enterprises",
353     "RFC1155-SMI", "IpAddress",     "SNMPv2-SMI", "IpAddress",
354     "RFC1155-SMI", "Counter",       "SNMPv2-SMI", "Counter32",
355     "RFC1155-SMI", "Gauge",         "SNMPv2-SMI", "Gauge32",
356     "RFC1155-SMI", "TimeTicks",     "SNMPv2-SMI", "TimeTicks",
357     "RFC1155-SMI", "Opaque",        "SNMPv2-SMI", "Opaque",
358     "RFC1065-SMI", "internet",      "SNMPv2-SMI", "internet",
359     "RFC1065-SMI", "directory",     "SNMPv2-SMI", "directory",
360     "RFC1065-SMI", "mgmt",          "SNMPv2-SMI", "mgmt",
361     "RFC1065-SMI", "experimental",  "SNMPv2-SMI", "experimental",
362     "RFC1065-SMI", "private",       "SNMPv2-SMI", "private",
363     "RFC1065-SMI", "enterprises",   "SNMPv2-SMI", "enterprises",
364     "RFC1065-SMI", "IpAddress",     "SNMPv2-SMI", "IpAddress",
365     "RFC1065-SMI", "Counter",       "SNMPv2-SMI", "Counter32",
366     "RFC1065-SMI", "Gauge",         "SNMPv2-SMI", "Gauge32",
367     "RFC1065-SMI", "TimeTicks",     "SNMPv2-SMI", "TimeTicks",
368     "RFC1065-SMI", "Opaque",        "SNMPv2-SMI", "Opaque",
369     "RFC1213-MIB", "mib-2",         "SNMPv2-SMI", "mib-2",    
370     "RFC1213-MIB", "DisplayString", "SNMPv2-TC",  "DisplayString",    
371     NULL, NULL, NULL, NULL
372 };
373
374
375
376 static void
377 checkDescr(Parser *parser, char *descr)
378 {
379     if (descr) {
380         if (descr[0] == 0) {
381             smiPrintError(parser, ERR_EMPTY_DESCRIPTION);
382         }
383         /* we might want to add more checks since I have recently
384            seen things like DESCRIPTION "." to cirumvent warnings */
385     }
386 }
387  
388
389  
390 static void
391 checkNameLen(Parser *parser, char *name, int error_32, int error_64)
392 {
393     int len = strlen(name);
394     
395     if (len > 64) {
396         smiPrintError(parser, error_64, name);
397     } else if (len > 32) {
398         smiPrintError(parser, error_32, name);
399     }
400 }
401
402
403  
404 static void
405 checkModuleName(Parser *parserPtr, Module *modulePtr)
406 {
407      static char *mib_ignore[] = {
408          "SNMPv2-SMI", "SNMPv2-TC", "SNMPv2-CONF", NULL
409      };
410      
411      static char *pib_ignore[] = {
412          "COPS-PR-SPPI", "COPS-PR-SPPI-TC",
413          "SNMPv2-SMI", "SNMPv2-TC", "SNMPv2-CONF", NULL
414      };
415
416      const char *name = thisModulePtr->export.name;
417      const int len = strlen(name);
418      int i;
419
420      switch (modulePtr->export.language) {
421      case SMI_LANGUAGE_SMIV1:
422      case SMI_LANGUAGE_SMIV2:
423      case SMI_LANGUAGE_SMING:
424          for (i = 0; mib_ignore[i]; i++) {
425              if (strcmp(mib_ignore[i], name) == 0) {
426                  return;
427              }
428          }
429          if (len > 3 && (strcmp(name + len - 4, "-MIB") != 0)) {
430              smiPrintError(parserPtr, ERR_MIB_MODULENAME_SUFFIX, name);
431              return;
432          }
433          break;
434      case SMI_LANGUAGE_SPPI:
435          for (i = 0; pib_ignore[i]; i++) {
436              if (strcmp(pib_ignore[i], name) == 0) {
437                  return;
438              }
439          }
440          if (len > 3 && (strcmp(name + len - 4, "-PIB") != 0)) {
441              smiPrintError(parserPtr, ERR_PIB_MODULENAME_SUFFIX, name);
442          }
443          break;
444      case SMI_LANGUAGE_UNKNOWN:
445          break;
446      }
447 }
448
449
450
451 static void
452 checkModuleIdentity(Parser *parserPtr, Module *modulePtr)
453 {
454     if ((modulePtr->export.language == SMI_LANGUAGE_SMIV2)
455         && (modulePtr->numModuleIdentities < 1)
456         && strcmp(modulePtr->export.name, "SNMPv2-SMI")
457         && strcmp(modulePtr->export.name, "SNMPv2-CONF")
458         && strcmp(modulePtr->export.name, "SNMPv2-TC")
459         && strcmp(modulePtr->export.name, "COPS-PR-SPPI")) {
460         smiPrintError(parserPtr, ERR_NO_MODULE_IDENTITY);
461     }
462 }
463
464
465
466 static void
467 checkObjects(Parser *parserPtr, Module *modulePtr)
468 {
469     Object *objectPtr;
470     Node *nodePtr;
471     int i;
472     Type *counterTypePtr, *counter32TypePtr, *counter64TypePtr;
473     
474     counterTypePtr = findTypeByName("Counter");
475     counter32TypePtr = findTypeByModulenameAndName("SNMPv2-SMI", "Counter32");
476     counter64TypePtr = findTypeByModulenameAndName("SNMPv2-SMI", "Counter64");
477     
478     for (objectPtr = modulePtr->firstObjectPtr;
479          objectPtr; objectPtr = objectPtr->nextPtr) {
480
481         Object *parentPtr;
482         
483         if ((objectPtr->export.decl != SMI_DECL_UNKNOWN) &&
484             objectPtr->nodePtr->parentPtr &&
485             objectPtr->nodePtr->parentPtr->lastObjectPtr) {
486             parentPtr = objectPtr->nodePtr->parentPtr->lastObjectPtr;
487         } else {
488             parentPtr = NULL;
489         }
490
491         /*
492          * Set nodekinds of all newly defined objects.
493          */
494         
495         if (objectPtr->export.decl == SMI_DECL_MODULEIDENTITY) {
496             objectPtr->export.nodekind = SMI_NODEKIND_NODE;
497         } else if ((objectPtr->export.decl == SMI_DECL_VALUEASSIGNMENT) ||
498                    (objectPtr->export.decl == SMI_DECL_OBJECTIDENTITY)) {
499             objectPtr->export.nodekind = SMI_NODEKIND_NODE;
500         } else if ((objectPtr->export.decl == SMI_DECL_OBJECTTYPE) &&
501                    (objectPtr->typePtr) &&
502                    (objectPtr->typePtr->export.decl == SMI_DECL_IMPL_SEQUENCEOF)) {
503             objectPtr->export.nodekind = SMI_NODEKIND_TABLE;
504         } else if ((objectPtr->export.decl == SMI_DECL_OBJECTTYPE) &&
505                    (objectPtr->export.indexkind != SMI_INDEX_UNKNOWN)) {
506             objectPtr->export.nodekind = SMI_NODEKIND_ROW;
507         } else if ((objectPtr->export.decl == SMI_DECL_NOTIFICATIONTYPE) ||
508                    (objectPtr->export.decl == SMI_DECL_TRAPTYPE)) {
509             objectPtr->export.nodekind = SMI_NODEKIND_NOTIFICATION;
510         } else if ((objectPtr->export.decl == SMI_DECL_OBJECTGROUP) ||
511                    (objectPtr->export.decl == SMI_DECL_NOTIFICATIONGROUP)) {
512             objectPtr->export.nodekind = SMI_NODEKIND_GROUP;
513         } else if (objectPtr->export.decl == SMI_DECL_MODULECOMPLIANCE) {
514             objectPtr->export.nodekind = SMI_NODEKIND_COMPLIANCE;
515         } else if (objectPtr->export.decl == SMI_DECL_AGENTCAPABILITIES) {
516             objectPtr->export.nodekind = SMI_NODEKIND_CAPABILITIES;
517         } else if ((objectPtr->export.decl == SMI_DECL_OBJECTTYPE) &&
518                    (parentPtr) &&
519                    (parentPtr->export.indexkind != SMI_INDEX_UNKNOWN)) {
520             objectPtr->export.nodekind = SMI_NODEKIND_COLUMN;
521         } else if ((objectPtr->export.decl == SMI_DECL_OBJECTTYPE) &&
522                    (parentPtr) &&
523                    (parentPtr->export.indexkind == SMI_INDEX_UNKNOWN)) {
524             objectPtr->export.nodekind = SMI_NODEKIND_SCALAR;
525         }
526     }
527
528     for (objectPtr = modulePtr->firstObjectPtr;
529          objectPtr; objectPtr = objectPtr->nextPtr) {
530
531         Object *parentPtr;
532         
533         if (objectPtr->nodePtr->parentPtr &&
534             objectPtr->nodePtr->parentPtr->lastObjectPtr) {
535             parentPtr = objectPtr->nodePtr->parentPtr->lastObjectPtr;
536         } else {
537             parentPtr = NULL;
538         }
539
540         /*
541          * Check whether the associated type resolves to a known base type.
542          */
543         
544         if (objectPtr->typePtr
545             && (objectPtr->export.nodekind == SMI_NODEKIND_COLUMN
546                 || objectPtr->export.nodekind == SMI_NODEKIND_SCALAR)
547             && objectPtr->typePtr->export.basetype == SMI_BASETYPE_UNKNOWN) {
548             smiPrintErrorAtLine(parserPtr, ERR_BASETYPE_UNKNOWN,
549                                 objectPtr->line,
550                                 objectPtr->typePtr->export.name ?
551                                 objectPtr->typePtr->export.name : "[unknown]",
552                                 objectPtr->export.name);
553             if (objectPtr->nodePtr->parentPtr->firstObjectPtr->export.nodekind
554                 == SMI_NODEKIND_TABLE) {
555                 /* the parent node is a table node, so assume this is
556                  *  a row node. this adjusts missing INDEXs in RFC 1158.
557                  */
558                 objectPtr->export.nodekind = SMI_NODEKIND_ROW;
559             }
560         }
561
562         /*
563          * Mark types that are referenced in this module.
564          */
565
566         if (objectPtr->typePtr
567             && (objectPtr->export.nodekind == SMI_NODEKIND_COLUMN
568                 || objectPtr->export.nodekind == SMI_NODEKIND_SCALAR)
569             && (objectPtr->typePtr->export.decl == SMI_DECL_TYPEDEF
570                 || objectPtr->typePtr->export.decl == SMI_DECL_TEXTUALCONVENTION
571                 || objectPtr->typePtr->export.decl == SMI_DECL_IMPLICIT_TYPE)) {
572             addTypeFlags(objectPtr->typePtr, FLAG_INSYNTAX);
573             if (objectPtr->typePtr->export.decl == SMI_DECL_IMPLICIT_TYPE) {
574                 addTypeFlags(objectPtr->typePtr->parentPtr, FLAG_INSYNTAX);
575             }
576         }
577         
578         /*
579          * Check whether the status of the associated type matches the
580          * status of the object.
581          */
582
583         if (objectPtr->typePtr
584             && (objectPtr->export.nodekind == SMI_NODEKIND_COLUMN
585                 || objectPtr->export.nodekind == SMI_NODEKIND_SCALAR)
586             && (objectPtr->export.status < objectPtr->typePtr->export.status)) {
587             if (objectPtr->typePtr->export.status == SMI_STATUS_DEPRECATED) {
588                 smiPrintErrorAtLine(parserPtr, ERR_TYPE_STATUS_DEPRECATED,
589                                     objectPtr->line,
590                                     objectPtr->typePtr->export.name,
591                                     objectPtr->export.name);
592             }
593             if (objectPtr->typePtr->export.status == SMI_STATUS_OBSOLETE) {
594                 smiPrintErrorAtLine(parserPtr, ERR_TYPE_STATUS_OBSOLETE,
595                                     objectPtr->line,
596                                     objectPtr->typePtr->export.name,
597                                     objectPtr->export.name);
598             }
599         }
600
601         /*
602          * Check the nodekind of the parent node.
603          */
604
605         if (parentPtr) {
606             switch (objectPtr->export.nodekind) {
607             case SMI_NODEKIND_COLUMN:
608                 if (parentPtr->export.nodekind != SMI_NODEKIND_ROW) {
609                     smiPrintErrorAtLine(parserPtr, ERR_COLUMN_PARENT_TYPE,
610                                         objectPtr->line, objectPtr->export.name);
611                 }
612                 break;
613             case SMI_NODEKIND_ROW:
614                 if (parentPtr->export.nodekind != SMI_NODEKIND_TABLE) {
615                     smiPrintErrorAtLine(parserPtr, ERR_ROW_PARENT_TYPE,
616                                         objectPtr->line, objectPtr->export.name);
617                 }
618                 if (parentPtr->typePtr && parentPtr->typePtr->parentPtr &&
619                     strcmp(parentPtr->typePtr->parentPtr->export.name,
620                            objectPtr->typePtr->export.name)) {
621                     smiPrintErrorAtLine(parserPtr, ERR_TABLE_ROW_TYPE_MISMATCH,
622                                         objectPtr->line,
623                                         objectPtr->export.name);
624                 }
625                 break;
626             case SMI_NODEKIND_TABLE:
627                 if ((parentPtr->export.nodekind != SMI_NODEKIND_UNKNOWN) &&
628                     (parentPtr->export.nodekind != SMI_NODEKIND_NODE)) {
629                     smiPrintErrorAtLine(parserPtr, ERR_TABLE_PARENT_TYPE,
630                                         objectPtr->line, objectPtr->export.name);
631                 }
632                 break;
633             case SMI_NODEKIND_SCALAR:
634                 if ((parentPtr->export.nodekind != SMI_NODEKIND_UNKNOWN) &&
635                     (parentPtr->export.nodekind != SMI_NODEKIND_NODE)) {
636                     smiPrintErrorAtLine(parserPtr, ERR_SCALAR_PARENT_TYPE,
637                                         objectPtr->line, objectPtr->export.name);
638                 }
639                 break;
640             case SMI_NODEKIND_NOTIFICATION:
641                 if ((parentPtr->export.nodekind != SMI_NODEKIND_NODE) &&
642                     (parentPtr->export.nodekind != SMI_NODEKIND_UNKNOWN)) {
643                     smiPrintErrorAtLine(parserPtr, ERR_NOTIFICATION_PARENT_TYPE,
644                                         objectPtr->line, objectPtr->export.name);
645                 }
646                 if (parserPtr && parentPtr->nodePtr->parentPtr &&
647                     parentPtr->nodePtr->parentPtr->lastObjectPtr) {
648                     Object *parent2Ptr = parentPtr->nodePtr->parentPtr->lastObjectPtr;
649                     if ((parent2Ptr->export.nodekind != SMI_NODEKIND_NODE) &&
650                         (parent2Ptr->export.nodekind != SMI_NODEKIND_UNKNOWN)) {
651                         smiPrintErrorAtLine(parserPtr,
652                                             ERR_NOTIFICATION_PARENT_TYPE,
653                                             objectPtr->line,
654                                             objectPtr->export.name);
655                     }
656                 }
657                 break;
658             case SMI_NODEKIND_NODE:
659                 /* Node defined by OBJECT IDENTIFIER assignments can have
660                    arbitrary parent node. */
661                 if ((parentPtr->export.nodekind != SMI_NODEKIND_UNKNOWN) &&
662                     (parentPtr->export.nodekind != SMI_NODEKIND_NODE) &&
663                     (objectPtr->export.decl != SMI_DECL_VALUEASSIGNMENT)) {
664                     smiPrintErrorAtLine(parserPtr, ERR_NODE_PARENT_TYPE,
665                                         objectPtr->line, objectPtr->export.name);
666                 }
667                 break;
668             case SMI_NODEKIND_GROUP:
669                 if ((parentPtr->export.nodekind != SMI_NODEKIND_UNKNOWN) &&
670                     (parentPtr->export.nodekind != SMI_NODEKIND_NODE)) {
671                     smiPrintErrorAtLine(parserPtr, ERR_GROUP_PARENT_TYPE,
672                                         objectPtr->line, objectPtr->export.name);
673                 }
674                 break;
675             case SMI_NODEKIND_COMPLIANCE:
676                 if ((parentPtr->export.nodekind != SMI_NODEKIND_UNKNOWN) &&
677                     (parentPtr->export.nodekind != SMI_NODEKIND_NODE)) {
678                     smiPrintErrorAtLine(parserPtr, ERR_COMPLIANCE_PARENT_TYPE,
679                                         objectPtr->line, objectPtr->export.name);
680                 }
681                 break;
682             case SMI_NODEKIND_CAPABILITIES:
683                 if ((parentPtr->export.nodekind != SMI_NODEKIND_UNKNOWN) &&
684                     (parentPtr->export.nodekind != SMI_NODEKIND_NODE)) {
685                     smiPrintErrorAtLine(parserPtr, ERR_CAPABILITIES_PARENT_TYPE,
686                                         objectPtr->line, objectPtr->export.name);
687                 }
688                 break;
689             }
690         }
691         
692         /*
693          * Check whether groups only contain scalars, columns and
694          * notifications.
695          */
696
697         if (objectPtr->export.nodekind == SMI_NODEKIND_GROUP) {
698             smiCheckGroupMembers(parserPtr, objectPtr);
699         }
700
701         /*
702          * Check whether compliance statements contain out of date
703          * groups or objects.
704          */
705
706         if (objectPtr->export.nodekind == SMI_NODEKIND_COMPLIANCE) {
707             smiCheckComplianceStatus(parserPtr, objectPtr);
708         }
709
710         /*
711          * Check whether notification statements contain useful
712          * objects.
713          */
714
715         if (objectPtr->export.nodekind == SMI_NODEKIND_NOTIFICATION) {
716             smiCheckNotificationOid(parserPtr, modulePtr, objectPtr);
717             smiCheckNotificationMembers(parserPtr, objectPtr);
718         }
719
720         if (modulePtr->export.language != SMI_LANGUAGE_SPPI) {
721             /*
722              * Check whether tables and rows are not accessible
723              * (RFC 2578 7.1.12).
724              */
725
726             if (objectPtr->export.nodekind == SMI_NODEKIND_TABLE
727                 && objectPtr->export.access != SMI_ACCESS_NOT_ACCESSIBLE) {
728                 smiPrintErrorAtLine(parserPtr, ERR_TABLE_ACCESS,
729                                     objectPtr->line, objectPtr->export.name);
730             }
731
732             if (objectPtr->export.nodekind == SMI_NODEKIND_ROW
733                 && objectPtr->export.access != SMI_ACCESS_NOT_ACCESSIBLE) {
734                 smiPrintErrorAtLine(parserPtr, ERR_ROW_ACCESS,
735                                     objectPtr->line, objectPtr->export.name);
736             }
737
738             /*
739              * Check whether counter objects are read-only or
740              * accessible-for-notify (RFC 2578, 7.1.6).
741              */
742             if (((objectPtr->export.nodekind == SMI_NODEKIND_SCALAR) ||
743                  (objectPtr->export.nodekind == SMI_NODEKIND_COLUMN)) &&
744                 (objectPtr->export.access != SMI_ACCESS_NOTIFY) &&
745                 (objectPtr->export.access != SMI_ACCESS_READ_ONLY) &&
746                 (smiTypeDerivedFrom(objectPtr->typePtr, counterTypePtr) ||
747                  smiTypeDerivedFrom(objectPtr->typePtr, counter32TypePtr) ||
748                  smiTypeDerivedFrom(objectPtr->typePtr, counter64TypePtr))) {
749                 smiPrintErrorAtLine(parserPtr, ERR_COUNTER_ACCESS,
750                                     objectPtr->line, objectPtr->export.name);
751             }
752         }
753         
754         /*
755          * Check whether a row's subid is 1, see RFC 2578 7.10 (1).
756          */
757         
758         if (objectPtr->export.nodekind == SMI_NODEKIND_ROW) {
759             int len;
760             
761             if (objectPtr->nodePtr->subid != 1) {
762                 smiPrintErrorAtLine(parserPtr, ERR_ROW_SUBID_ONE,
763                                     objectPtr->line, objectPtr->export.name);
764             }
765
766             len = strlen(objectPtr->export.name);
767             if (len < 6 || strcmp(objectPtr->export.name+len-5, "Entry")) {
768                 smiPrintErrorAtLine(parserPtr, ERR_ROWNAME_ENTRY,
769                                     objectPtr->line, objectPtr->export.name);
770             } else {
771
772                 /*
773                  * This misreports some cases where the table name
774                  * does not have the "*Table" suffix.  This is trying
775                  * to allow Entry names of either fooTableEntry or
776                  * fooEntry.
777                  */
778                 if (parentPtr &&
779                     !(((int)strlen(parentPtr->export.name) == len ||
780                        (int)strlen(parentPtr->export.name) == len - 5) &&
781                       !strncmp(objectPtr->export.name, parentPtr->export.name,
782                         len - 5))) {
783                     smiPrintErrorAtLine(parserPtr, ERR_ROWNAME_TABLENAME,
784                                         objectPtr->line,
785                                         objectPtr->export.name,
786                                         parentPtr->export.name);
787                 }
788             }
789         }
790
791         /*
792          * Check whether a row's SEQUENCE contains exactly the list
793          * of child nodes (columns).  An unknown SEQUENCE type
794          * is handled later.
795          */
796
797         if (objectPtr->export.nodekind == SMI_NODEKIND_ROW &&
798             ((objectPtr->typePtr->flags & FLAG_INCOMPLETE) == 0)) {
799             List *p;
800             Node *seqNodePtr, *childNodePtr;
801             Object *colPtr;
802             int i;
803             
804             /*
805              * Walk through the SEQUENCE elements and find those
806              * that are misordered or have no matching columnar object.
807              */
808             for (p = objectPtr->typePtr->listPtr, i = 1,
809                      childNodePtr = objectPtr->nodePtr->firstChildPtr;
810                  p && childNodePtr;
811                  p = p->nextPtr, childNodePtr = childNodePtr->nextPtr, i++) {
812                 seqNodePtr = ((Object *)p->ptr)->nodePtr;
813
814                 if (seqNodePtr->parentPtr != childNodePtr->parentPtr) {
815                     smiPrintErrorAtLine(parserPtr, ERR_SEQUENCE_NO_COLUMN,
816                                         objectPtr->typePtr->line,
817                                         i,
818                                         ((Object *)p->ptr)->export.name,
819                                         objectPtr->export.name);
820                     continue;
821                 }
822
823                 if (seqNodePtr != childNodePtr) {
824                     smiPrintErrorAtLine(parserPtr, ERR_SEQUENCE_ORDER,
825                                         objectPtr->typePtr->line,
826                                         i,
827                                         ((Object *)p->ptr)->export.name,
828                                         objectPtr->export.name);
829                     break;
830                 }
831             }
832             if ((p != NULL) && (childNodePtr == NULL)) {
833                 smiPrintErrorAtLine(parserPtr, ERR_SEQUENCE_NO_COLUMN,
834                                     objectPtr->typePtr->line,
835                                     i, 
836                                     ((Object *)p->ptr)->export.name,
837                                     objectPtr->export.name);
838             }
839
840             /*
841              * Walk through all child objects and find those
842              * that were missing in the SEQUENCE.
843              */
844             for (childNodePtr = objectPtr->nodePtr->firstChildPtr;
845                  childNodePtr; childNodePtr = childNodePtr->nextPtr) {
846                 colPtr = findObjectByModuleAndNode(modulePtr, childNodePtr);
847                 if (!colPtr) continue;
848                 for (p = objectPtr->typePtr->listPtr; p; p = p->nextPtr) {
849                     if (((Object *)p->ptr)->nodePtr == colPtr->nodePtr)
850                         break;
851                 }
852                 if (!p) {
853                     if (colPtr->export.name) {
854                         /*
855                          * Don't complain, if it's an implcitly defined
856                          * unnamed node (could happen for parent node of
857                          * TRAP-TYPE definitions).
858                          */
859                         smiPrintErrorAtLine(parserPtr,
860                                             ERR_SEQUENCE_MISSING_COLUMN,
861                                             objectPtr->typePtr->line,
862                                             objectPtr->typePtr->export.name,
863                                             colPtr->export.name);
864                     }
865                 }
866             }
867             
868         }
869         
870         if (objectPtr->export.nodekind == SMI_NODEKIND_TABLE) {
871             int len;
872
873             len = strlen(objectPtr->export.name);
874             if (len < 6 || strcmp(objectPtr->export.name+len-5, "Table")) {
875                 smiPrintErrorAtLine(parserPtr, ERR_TABLENAME_TABLE,
876                                     objectPtr->line, objectPtr->export.name);
877             }
878         }
879
880         /*
881          * TODO: check whether the row is the only node below the
882          * table node
883          */
884
885         /*
886          * Check references to unknown identifiers.
887          */
888
889         if ((objectPtr->flags & FLAG_INCOMPLETE) &&
890             (objectPtr->export.decl != SMI_DECL_IMPL_OBJECT)) {
891             if (objectPtr->export.name) {
892                 smiPrintErrorAtLine(parserPtr, ERR_UNKNOWN_OIDLABEL,
893                                     objectPtr->line, objectPtr->export.name);
894             } else {
895                 smiPrintErrorAtLine(parserPtr, ERR_IMPLICIT_NODE,
896                                     objectPtr->line);
897             }
898         }
899
900         /*
901          * Adjust the status of implicit type definitions.
902          */
903         
904         if (objectPtr->typePtr
905             && (objectPtr->typePtr->export.decl == SMI_DECL_IMPLICIT_TYPE)
906             && (objectPtr->typePtr->export.status == SMI_STATUS_UNKNOWN)) {
907             objectPtr->typePtr->export.status = objectPtr->export.status;
908         }
909
910         /*
911          * Link implicit type definition from refinements into
912          * the type derivation tree. Adjust the status of implicit
913          * type definitions in refinements. 
914          */
915
916         if (objectPtr->export.nodekind == SMI_NODEKIND_COMPLIANCE) {
917
918             List *listPtr;
919
920             for (listPtr = objectPtr->refinementlistPtr;
921                  listPtr;
922                  listPtr = listPtr->nextPtr) {
923
924                 Refinement *refinementPtr;
925                 Type *typePtr;
926                 
927                 refinementPtr = ((Refinement *)(listPtr->ptr));
928                 typePtr = refinementPtr->typePtr;
929                 if (typePtr) {
930                     if (typePtr->export.status == SMI_STATUS_UNKNOWN) {
931                         typePtr->export.status = objectPtr->export.status;
932                     }
933                 }
934
935                 typePtr = refinementPtr->writetypePtr;
936                 if (typePtr) {
937                     if (typePtr->export.status == SMI_STATUS_UNKNOWN) {
938                         typePtr->export.status = objectPtr->export.status;
939                     }
940                 }
941                 
942             }
943             /* relocate the refinement type into the type tree */
944             /* relocate the write refinement type into the type tree */
945         }
946
947         /*
948          * Set the oidlen/oid values that are not yet correct.
949          */
950
951         if (objectPtr->export.oidlen == 0) {
952             if (objectPtr->nodePtr->oidlen == 0) {
953                 for (nodePtr = objectPtr->nodePtr, i = 1;
954                      nodePtr->parentPtr != thisParserPtr->pendingNodePtr &&
955                          nodePtr->parentPtr != smiHandle->rootNodePtr &&
956                          nodePtr != nodePtr->parentPtr &&
957                          i <= 128;
958                      nodePtr = nodePtr->parentPtr, i++);
959                 if ((objectPtr->export.name) &&
960                     ((i > 128) || (nodePtr == nodePtr->parentPtr))) {
961                     smiPrintErrorAtLine(parserPtr, ERR_OID_RECURSIVE,
962                                         objectPtr->line,
963                                         objectPtr->export.name);
964                 }
965                 objectPtr->nodePtr->oid = smiMalloc(i * sizeof(SmiSubid));
966                 objectPtr->nodePtr->oidlen = i;
967                 for (nodePtr = objectPtr->nodePtr; i > 0; i--) {
968                     objectPtr->nodePtr->oid[i-1] = nodePtr->subid;
969                     nodePtr = nodePtr->parentPtr;
970                 }
971             }
972             objectPtr->export.oidlen = objectPtr->nodePtr->oidlen;
973             objectPtr->export.oid = objectPtr->nodePtr->oid;
974         }
975
976         if ((objectPtr->export.decl != SMI_DECL_UNKNOWN)
977             && (objectPtr->export.nodekind != SMI_NODEKIND_NODE)
978             && objectPtr->export.name
979             && objectPtr->export.oid[objectPtr->export.oidlen-1] == 0
980             && objectPtr->export.oidlen != 2 && objectPtr->export.oid[0] != 0) {
981             smiPrintErrorAtLine(parserPtr, ERR_OID_ADMIN_ZERO,
982                                 objectPtr->line,
983                                 objectPtr->export.name);
984         }
985
986         /*
987          * Check whether the module identity is registered in a well
988          * known controlled location. 
989          */
990
991         if (objectPtr->export.decl == SMI_DECL_MODULEIDENTITY) {
992             smiCheckModuleIdentityRegistration(parserPtr, objectPtr);
993         }
994
995         /*
996          * Check table linkage constraints for row objects.
997          */
998
999         if (objectPtr->export.nodekind == SMI_NODEKIND_ROW) {
1000             switch (objectPtr->export.indexkind) {
1001             case SMI_INDEX_INDEX:
1002                 smiCheckIndex(parserPtr, objectPtr);
1003                 break;
1004             case SMI_INDEX_AUGMENT:
1005             case SMI_INDEX_SPARSE:
1006                 smiCheckAugment(parserPtr, objectPtr);
1007                 break;
1008             default:
1009                 break;
1010             }
1011         }
1012         
1013         /*
1014          * Determine the longest common OID prefix of all nodes.
1015          */
1016
1017         if (!modulePtr->prefixNodePtr) {
1018             modulePtr->prefixNodePtr = objectPtr->nodePtr;
1019         } else {
1020             if (objectPtr->nodePtr->oidlen < modulePtr->prefixNodePtr->oidlen) {
1021                 Node *nodePtr = findNodeByOid(objectPtr->nodePtr->oidlen,
1022                                               modulePtr->prefixNodePtr->oid);
1023                 if (nodePtr)
1024                     modulePtr->prefixNodePtr = nodePtr;
1025                 else
1026                     smiPrintError(parserPtr, ERR_OTHER_ERROR,
1027                                   "Failed to create complete object tree - "
1028                                   "expect incorrect output");
1029             }
1030             for (i = 0; i < modulePtr->prefixNodePtr->oidlen; i++) {
1031                 if (modulePtr->prefixNodePtr->oid[i] !=
1032                     objectPtr->nodePtr->oid[i]) {
1033                     modulePtr->prefixNodePtr =
1034                         findNodeByOid(i, modulePtr->prefixNodePtr->oid);
1035                     break;
1036                 }
1037             }
1038         }
1039     }
1040
1041     if (modulePtr->export.language == SMI_LANGUAGE_SMIV2) {
1042         for (objectPtr = modulePtr->firstObjectPtr;
1043              objectPtr; objectPtr = objectPtr->nextPtr) {
1044             
1045             /*
1046              * Check whether all objects and notifications are contained in at
1047              * least one conformance group (RFC 2580 3.3 and 4.1).
1048              */
1049             
1050             smiCheckGroupMembership(parserPtr, objectPtr);
1051         }
1052     }
1053
1054     if (modulePtr->export.language == SMI_LANGUAGE_SPPI) {
1055         Object *parentPtr;
1056         
1057         for (objectPtr = modulePtr->firstObjectPtr;
1058              objectPtr; objectPtr = objectPtr->nextPtr) {
1059             /*
1060              * All checks for SPPI constructs
1061              */
1062             if (objectPtr->nodePtr->parentPtr)
1063                 parentPtr = objectPtr->nodePtr->parentPtr->lastObjectPtr;
1064             else
1065                 parentPtr = NULL;
1066             
1067             /*
1068              * Do all rows contain a PIB-INDEX/AUGMENTS/EXTENDS ?
1069              * See RFC 3159 7.5, 7.7, 7.8
1070              */
1071             if (parentPtr  &&
1072                 (parentPtr->export.nodekind == SMI_NODEKIND_TABLE) &&
1073                 (objectPtr->export.indexkind != SMI_INDEX_INDEX) &&
1074                 (objectPtr->export.indexkind != SMI_INDEX_AUGMENT) &&
1075                 (objectPtr->export.indexkind != SMI_INDEX_SPARSE))
1076                 smiPrintErrorAtLine(parserPtr, ERR_ROW_LACKS_PIB_INDEX,
1077                                     objectPtr->line);
1078
1079             /*
1080              * Does any non row contain a PIB-INDEX/AUGMENTS/EXTENDS ?
1081              * See RFC 3159 7.5, 7.7, 7.8
1082              */
1083             if ((objectPtr->export.nodekind != SMI_NODEKIND_ROW) &&
1084                 (objectPtr->export.indexkind != SMI_INDEX_UNKNOWN))
1085                 smiPrintErrorAtLine(parserPtr, ERR_PIB_INDEX_FOR_NON_ROW_TYPE,
1086                                     objectPtr->line);
1087
1088             /*
1089              * Check the PIB-INDEX and other indices
1090              */
1091             if ((objectPtr->export.nodekind == SMI_NODEKIND_ROW) &&
1092                 (objectPtr->export.indexkind == SMI_INDEX_INDEX)) {
1093
1094                 /*
1095                  * Only the first element (PIB-INDEX) has to be an InstanceId.
1096                  * See RFC 3159 7.5
1097                  */
1098                 if (objectPtr->listPtr && objectPtr->listPtr->ptr) {
1099                     Object *pibindex = (Object *)objectPtr->listPtr->ptr;
1100                     if (pibindex->typePtr && pibindex->typePtr->export.name &&
1101                         strcmp(pibindex->typePtr->export.name, "InstanceId"))
1102                         smiPrintErrorAtLine(thisParserPtr, ERR_PIB_INDEX_NOT_INSTANCEID,
1103                                             pibindex->line, pibindex->export.name);
1104                 }
1105             }
1106             
1107             /*
1108              * Do all tables contain a PIB-ACCESS clause?
1109              * See RFC 3159 7.3
1110              */
1111             if ((objectPtr->export.nodekind == SMI_NODEKIND_TABLE) &&
1112                 (objectPtr->export.access == SMI_ACCESS_UNKNOWN))
1113                 smiPrintErrorAtLine(parserPtr, ERR_TABLE_LACKS_PIB_ACCESS,
1114                                     objectPtr->line);
1115
1116             /*
1117              * Does any non table types contain a PIB-ACCESS clause?
1118              * See RFC 3159 7.3
1119              */
1120             if (((objectPtr->export.nodekind == SMI_NODEKIND_NODE) ||
1121                  (objectPtr->export.nodekind == SMI_NODEKIND_ROW) ||
1122                  (objectPtr->export.nodekind == SMI_NODEKIND_SCALAR)) &&
1123                 (objectPtr->export.access != SMI_ACCESS_UNKNOWN))
1124                 smiPrintErrorAtLine(parserPtr, ERR_PIB_ACCESS_FOR_NON_TABLE,
1125                                     objectPtr->line);
1126
1127             /*
1128              * Check the UNIQUENESS clause and its entries
1129              * See RFC 3159 7.9
1130              */
1131             if (objectPtr->uniquenessPtr) {
1132                 if (objectPtr->export.nodekind != SMI_NODEKIND_ROW)
1133                     smiPrintErrorAtLine(parserPtr, ERR_UNIQUENESS_FOR_NON_ROW,
1134                                         objectPtr->line);
1135                 else
1136                     smiCheckUniqueness(parserPtr, objectPtr);
1137             }
1138             
1139             /*
1140              * Does the PIB-REFERENCES object point to a PRC (table)?
1141              * See RFC 3159 7.10
1142              */
1143             if (objectPtr->typePtr && objectPtr->typePtr->export.name &&
1144                 !strcmp(objectPtr->typePtr->export.name, "ReferenceId") &&
1145                 objectPtr->relatedPtr &&
1146                 (objectPtr->relatedPtr->export.nodekind != SMI_NODEKIND_ROW))
1147                 smiPrintErrorAtLine(parserPtr, ERR_PIB_REFERENCES_NOT_ROW,
1148                                     objectPtr->line);
1149
1150             /*
1151              * Do all PIB-TAGs point to objects with a SYNTAX of TagId?
1152              * See RFC 3159 7.12
1153              */
1154             if (objectPtr->typePtr && objectPtr->typePtr->export.name &&
1155                 !strcmp(objectPtr->typePtr->export.name, "TagReferenceId") &&
1156                 objectPtr->relatedPtr && objectPtr->relatedPtr->typePtr &&
1157                 objectPtr->relatedPtr->typePtr->export.name &&
1158                 strcmp(objectPtr->relatedPtr->typePtr->export.name, "TagId"))
1159                 smiPrintErrorAtLine(parserPtr, ERR_PIB_TAG_TYPE, objectPtr->line);
1160             
1161             /*
1162              * Is the attribute member of at least one compliance group?
1163              * See RFC 3159 9.1
1164              */
1165             if (objectPtr->export.nodekind & SMI_NODEKIND_COLUMN) {
1166                 Object *group;
1167                 int found = 0;
1168                 
1169                 for (group = modulePtr->firstObjectPtr; group;
1170                      group = group->nextPtr) {
1171                     if ((group->export.nodekind == SMI_NODEKIND_GROUP) &&
1172                         group->listPtr) {
1173                         List *l;
1174                         
1175                         for (l = group->listPtr; l; l = l->nextPtr)
1176                             if (((Object *)l->ptr)->export.name &&
1177                                 !strcmp(((Object *)l->ptr)->export.name,
1178                                         objectPtr->export.name)) {
1179                                 found = 1;
1180                                 break;
1181                             }
1182                     }
1183                     if (found)
1184                         break;
1185                 }
1186                 if (!found)
1187                     smiPrintErrorAtLine(parserPtr, ERR_ATTRIBUTE_NOT_IN_GROUP,
1188                                         objectPtr->line, objectPtr->export.name);
1189             }
1190         }
1191     }
1192 }
1193
1194
1195
1196 static void
1197 checkTypes(Parser *parserPtr, Module *modulePtr)
1198 {
1199     Type *typePtr;
1200     
1201     for (typePtr = modulePtr->firstTypePtr;
1202         typePtr; typePtr = typePtr->nextPtr) {
1203
1204         /*
1205          * Check references to unknown types.
1206          */
1207         
1208         if ((typePtr->flags & FLAG_INCOMPLETE)
1209             && typePtr->export.name
1210             && (typePtr->export.decl == SMI_DECL_UNKNOWN)) {
1211             smiPrintErrorAtLine(parserPtr, ERR_UNKNOWN_TYPE,
1212                                 typePtr->line, typePtr->export.name);
1213         }
1214
1215         /*
1216          * Use TCs instead of type assignments in SMIv2.
1217          */
1218
1219         if (thisModulePtr->export.language == SMI_LANGUAGE_SMIV2
1220             && typePtr->export.decl == SMI_DECL_TYPEASSIGNMENT
1221             && typePtr->export.basetype != SMI_BASETYPE_UNKNOWN
1222             && strcmp(thisModulePtr->export.name, "SNMPv2-SMI")) {
1223             smiPrintErrorAtLine(parserPtr, ERR_SMIV2_TYPE_ASSIGNEMENT,
1224                                 typePtr->line, typePtr->export.name);
1225         }
1226
1227         /*
1228          * Check whether we have types that are not used in this
1229          * module.
1230          */
1231
1232         if ((typePtr->export.decl == SMI_DECL_TYPEDEF
1233              || typePtr->export.decl == SMI_DECL_TEXTUALCONVENTION)
1234             && ! (typePtr->flags & FLAG_INSYNTAX)) {
1235             static char *status[] = { "Unknown", "current", "deprecated",
1236                                       "mandatory", "optional", "obsolete" };
1237             smiPrintErrorAtLine(parserPtr, ERR_TYPE_UNREF,
1238                                 typePtr->line,
1239                                 status[typePtr->export.status],
1240                                 typePtr->export.name);
1241         }
1242
1243         /*
1244          * Complain about TCs derived from other TCs (RFC 2579 3.5).
1245          */
1246         
1247         if (typePtr->parentPtr
1248             && typePtr->export.decl == SMI_DECL_TEXTUALCONVENTION
1249             && typePtr->export.decl == typePtr->parentPtr->export.decl) {
1250             smiPrintErrorAtLine(parserPtr, ERR_SMIV2_NESTED_TEXTUAL_CONVENTION,
1251                                 typePtr->line,
1252                                 typePtr->export.name,
1253                                 typePtr->parentPtr->export.name);
1254
1255             if (typePtr->export.status < typePtr->parentPtr->export.status) {
1256                 if (typePtr->parentPtr->export.status == SMI_STATUS_DEPRECATED) {
1257                     smiPrintErrorAtLine(parserPtr, ERR_TYPE_STATUS_DEPRECATED,
1258                                         typePtr->line,
1259                                         typePtr->parentPtr->export.name,
1260                                         typePtr->export.name);
1261                 }
1262                 if (typePtr->parentPtr->export.status == SMI_STATUS_OBSOLETE) {
1263                     smiPrintErrorAtLine(parserPtr, ERR_TYPE_STATUS_OBSOLETE,
1264                                         typePtr->line,
1265                                         typePtr->parentPtr->export.name,
1266                                         typePtr->export.name);
1267                 }
1268             }
1269         }
1270
1271         smiCheckTypeFormat(parserPtr, typePtr);
1272         smiCheckNamedNumberRedefinition(parserPtr, typePtr);
1273         smiCheckNamedNumberSubtyping(parserPtr, typePtr);
1274     }
1275 }
1276
1277
1278                                 
1279 static void
1280 adjustDefval(Parser *parserPtr, SmiValue *valuePtr, Type *typePtr, int line)
1281 {
1282     Object *object2Ptr;
1283     List *bitsListPtr, *valueListPtr, *p, *pp, *nextPtr, *listPtr;
1284     Import *importPtr;
1285     int nBits, bit;
1286     
1287     if (valuePtr->basetype == SMI_BASETYPE_UNKNOWN)
1288         return;
1289         
1290     if (valuePtr->basetype == SMI_BASETYPE_OBJECTIDENTIFIER) {
1291         /* a len of -1 indicates an unresolved label in ptr */
1292         if (valuePtr->len == -1) {
1293             object2Ptr = findObjectByModuleAndName(parserPtr->modulePtr,
1294                                                   (char *)valuePtr->value.ptr);
1295             if (!object2Ptr) {
1296                 importPtr = findImportByName(
1297                     (char *)valuePtr->value.ptr, parserPtr->modulePtr);
1298                 if (importPtr) {                /* imported object */
1299                     importPtr->use++;
1300                     object2Ptr = findObjectByModulenameAndName(
1301                         importPtr->export.module,
1302                         importPtr->export.name);
1303                 }
1304             }
1305             if (!object2Ptr) {
1306                 smiPrintErrorAtLine(parserPtr, ERR_UNKNOWN_OIDLABEL,
1307                                     line,
1308                                     (char *)valuePtr->value.ptr);
1309                 smiFree(valuePtr->value.ptr);
1310                 valuePtr->value.ptr = NULL;
1311                 valuePtr->basetype = SMI_BASETYPE_UNKNOWN;
1312             } else {
1313                 smiFree(valuePtr->value.ptr);
1314                 valuePtr->len = object2Ptr->export.oidlen;
1315                 valuePtr->value.ptr = smiMalloc(object2Ptr->export.oidlen *
1316                                                 sizeof(SmiSubid));
1317                 memcpy(valuePtr->value.ptr,
1318                        object2Ptr->export.oid,
1319                        object2Ptr->export.oidlen * sizeof(SmiSubid));
1320             }
1321         }
1322     } else if (valuePtr->basetype == SMI_BASETYPE_BITS) {
1323         bitsListPtr = typePtr->listPtr;
1324         valueListPtr = (void *)valuePtr->value.ptr;
1325         for (nBits = 0, p = bitsListPtr; p; p = p->nextPtr) {
1326             if (nBits < 1+((NamedNumber *)(p->ptr))->export.value.value.integer32) {
1327                 nBits = 1+((NamedNumber *)(p->ptr))->export.value.value.integer32;
1328             }
1329         }
1330         valuePtr->value.ptr = smiMalloc((nBits+7)/8);
1331         memset(valuePtr->value.ptr, 0, (nBits+7)/8);
1332         valuePtr->len = (nBits+7)/8;
1333         for (p = valueListPtr; p;) {
1334             for (pp = bitsListPtr; pp; pp = pp->nextPtr) {
1335                 if (!strcmp(p->ptr,
1336                             ((NamedNumber *)(pp->ptr))->export.name)) {
1337                     bit = ((NamedNumber *)(pp->ptr))->export.value.value.integer32;
1338                     valuePtr->value.ptr[bit/8] |=
1339                         1 << (7-(bit%8));
1340                 }
1341             }
1342             smiFree(p->ptr);
1343             nextPtr = p->nextPtr;
1344             smiFree(p);
1345             p = nextPtr;
1346         }
1347     } else if (valuePtr->basetype == SMI_BASETYPE_ENUM) {
1348         /* a len of -1 indicates an unresolved enum label in ptr */
1349         if (valuePtr->len == -1) {
1350             for (listPtr = typePtr->listPtr; listPtr;
1351                  listPtr = listPtr->nextPtr) {
1352                 if (!strcmp(((NamedNumber *)(listPtr->ptr))->export.name,
1353                             (char *)valuePtr->value.ptr)) {
1354                     smiFree(valuePtr->value.ptr);
1355                     valuePtr->value.integer32 =
1356                         ((NamedNumber *)(listPtr->ptr))->
1357                         export.value.value.integer32;
1358                     valuePtr->len = 1;
1359                     break;
1360                 }
1361             }
1362         }
1363     }
1364 }
1365
1366
1367
1368 static void
1369 checkDefvals(Parser *parserPtr, Module *modulePtr)
1370 {
1371     Object *objectPtr;
1372     
1373     /*
1374      * Check unknown identifiers in OID DEFVALs.
1375      */
1376
1377     for(objectPtr = modulePtr->firstObjectPtr;
1378         objectPtr; objectPtr = objectPtr->nextPtr) {
1379
1380         adjustDefval(parserPtr, &objectPtr->export.value,
1381                      objectPtr->typePtr, objectPtr->line);
1382         
1383         if (objectPtr->export.value.len == -1) {
1384             smiPrintErrorAtLine(parserPtr,
1385                                 ERR_DEFVAL_SYNTAX, objectPtr->line);
1386         }
1387         
1388         smiCheckDefault(parserPtr, objectPtr);
1389     }
1390 }
1391
1392
1393
1394 static void
1395 checkImportsUsage(Parser *parserPtr, Module *modulePtr)
1396 {
1397     Import *importPtr;
1398     
1399     /*
1400      * Check usage of all imported identifiers.
1401      */
1402
1403     if (strcmp(modulePtr->export.name, "SNMPv2-TC") &&
1404         strcmp(modulePtr->export.name, "SNMPv2-CONF") &&
1405         strcmp(modulePtr->export.name, "RFC-1212") &&
1406         strcmp(modulePtr->export.name, "RFC-1215")) {
1407         for(importPtr = modulePtr->firstImportPtr;
1408             importPtr; importPtr = importPtr->nextPtr) {
1409             if (! strcmp(importPtr->export.module, "SNMPv2-SMI")) {
1410                 if (! strcmp(importPtr->export.name, "ExtUTCTime")
1411                     || !strcmp(importPtr->export.name, "ObjectName")
1412                     || !strcmp(importPtr->export.name, "NotificationName")) {
1413                     smiPrintErrorAtLine(parserPtr, ERR_ILLEGAL_IMPORT,
1414                                         importPtr->line,
1415                                         importPtr->export.name,
1416                                         importPtr->export.module);
1417                 }
1418             }
1419             /* checkImports() handles KIND_NOTFOUND */
1420             if (importPtr->use == 0 && importPtr->kind != KIND_NOTFOUND) {
1421                 smiPrintErrorAtLine(parserPtr, ERR_UNUSED_IMPORT,
1422                                     importPtr->line,
1423                                     importPtr->export.name,
1424                                     importPtr->export.module);
1425             }
1426
1427             if (modulePtr->export.language == SMI_LANGUAGE_SMIV2) {
1428                 int j;
1429                 for (j = 0; convertImportv2[j]; j += 4) {
1430                     if ((strcmp(convertImportv2[j],
1431                                 importPtr->export.module) == 0)
1432                         && (strcmp(convertImportv2[j+1],
1433                                    importPtr->export.name) == 0)) {
1434                         smiPrintErrorAtLine(parserPtr,
1435                                             ERR_OBSOLETE_IMPORT,
1436                                             importPtr->line,
1437                                             importPtr->export.name,
1438                                             convertImportv2[j+2],
1439                                             importPtr->export.module);
1440                     }
1441                 }
1442             }
1443         }
1444     }
1445 }
1446
1447
1448
1449 static time_t
1450 checkDate(Parser *parserPtr, char *date)
1451 {
1452     struct tm   tm;
1453     time_t      anytime;
1454     int         i, len;
1455     char        *p;
1456     
1457     memset(&tm, 0, sizeof(tm));
1458     anytime = 0;
1459     
1460     len = strlen(date);
1461     if (len == 11 || len == 13) {
1462         for (i = 0; i < len; i++) {
1463             if ( (i < len-1 && ! isdigit((int) date[i]))
1464                  || (i == len-1 && date[len-1] != 'Z')) {
1465                 smiPrintError(parserPtr, ERR_DATE_CHARACTER, date);
1466                 anytime = (time_t) -1;
1467                 break;
1468             }
1469         }
1470     } else {
1471         smiPrintError(parserPtr, ERR_DATE_LENGTH, date);
1472         anytime = (time_t) -1;
1473     }
1474
1475     if (anytime == 0) {
1476         for (i = 0, p = date, tm.tm_year = 0;
1477              i < ((len == 11) ? 2 : 4); i++, p++) {
1478             tm.tm_year = tm.tm_year * 10 + (*p - '0');
1479         }
1480         if (len == 11) {
1481             tm.tm_year += 1900;
1482             if (tm.tm_year < 1990)
1483                 smiPrintError(parserPtr, ERR_DATE_YEAR_2DIGITS,
1484                               date, tm.tm_year);
1485         }
1486         tm.tm_mon  = (p[0]-'0') * 10 + (p[1]-'0');
1487         p += 2;
1488         tm.tm_mday = (p[0]-'0') * 10 + (p[1]-'0');
1489         p += 2;
1490         tm.tm_hour = (p[0]-'0') * 10 + (p[1]-'0');
1491         p += 2;
1492         tm.tm_min  = (p[0]-'0') * 10 + (p[1]-'0');
1493         
1494         if (tm.tm_mon < 1 || tm.tm_mon > 12) {
1495             smiPrintError(parserPtr, ERR_DATE_MONTH, date);
1496         }
1497         if (tm.tm_mday < 1 || tm.tm_mday > 31) {
1498             smiPrintError(parserPtr, ERR_DATE_DAY, date);
1499         }
1500         if (tm.tm_hour < 0 || tm.tm_hour > 23) {
1501             smiPrintError(parserPtr, ERR_DATE_HOUR, date);
1502         }
1503         if (tm.tm_min < 0 || tm.tm_min > 59) {
1504             smiPrintError(parserPtr, ERR_DATE_MINUTES, date);
1505         }
1506         
1507         tm.tm_year -= 1900;
1508         tm.tm_mon -= 1;
1509         tm.tm_isdst = 0;
1510
1511         anytime = timegm(&tm);
1512         
1513         if (anytime == (time_t) -1) {
1514             smiPrintError(parserPtr, ERR_DATE_VALUE, date);
1515         } else {
1516             if (anytime < SMI_EPOCH) {
1517                 smiPrintError(parserPtr, ERR_DATE_IN_PAST, date);
1518             }
1519             if (anytime > time(NULL)) {
1520                 smiPrintError(parserPtr, ERR_DATE_IN_FUTURE, date);
1521             }
1522         }
1523     }
1524
1525     return (anytime == (time_t) -1) ? 0 : anytime;
1526 }
1527
1528
1529
1530 /* Enabling traces.  */
1531 #ifndef YYDEBUG
1532 # define YYDEBUG 1
1533 #endif
1534
1535 /* Enabling verbose error messages.  */
1536 #ifdef YYERROR_VERBOSE
1537 # undef YYERROR_VERBOSE
1538 # define YYERROR_VERBOSE 1
1539 #else
1540 # define YYERROR_VERBOSE 0
1541 #endif
1542
1543 /* Enabling the token table.  */
1544 #ifndef YYTOKEN_TABLE
1545 # define YYTOKEN_TABLE 0
1546 #endif
1547
1548 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1549 typedef union YYSTYPE
1550 #line 1288 "parser-smi.y"
1551 {
1552     char           *text;                       /* scanned quoted text       */
1553     char           *id;                         /* identifier name           */
1554     int            err;                         /* actually just a dummy     */
1555     time_t         date;                        /* a date value              */
1556     Object         *objectPtr;                  /* object identifier         */
1557     SmiStatus      status;                      /* a STATUS value            */
1558     SmiAccess      access;                      /* an ACCESS value           */
1559     Type           *typePtr;
1560     List           *listPtr;                    /* SEQUENCE and INDEX lists  */
1561     NamedNumber    *namedNumberPtr;             /* BITS or enum item         */
1562     Range          *rangePtr;                   /* type restricting range    */
1563     SmiValue       *valuePtr;
1564     SmiUnsigned32  unsigned32;                  /*                           */
1565     SmiInteger32   integer32;                   /*                           */
1566     SmiUnsigned64  unsigned64;                  /*                           */
1567     SmiInteger64   integer64;                   /*                           */
1568     struct Compl   compl;
1569     struct Index   index;
1570     Module         *modulePtr;
1571     SubjectCategories *subjectCategoriesPtr;
1572 }
1573 /* Line 187 of yacc.c.  */
1574 #line 1575 "parser-smi.c"
1575         YYSTYPE;
1576 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1577 # define YYSTYPE_IS_DECLARED 1
1578 # define YYSTYPE_IS_TRIVIAL 1
1579 #endif
1580
1581
1582
1583 /* Copy the second part of user declarations.  */
1584
1585
1586 /* Line 216 of yacc.c.  */
1587 #line 1588 "parser-smi.c"
1588
1589 #ifdef short
1590 # undef short
1591 #endif
1592
1593 #ifdef YYTYPE_UINT8
1594 typedef YYTYPE_UINT8 yytype_uint8;
1595 #else
1596 typedef unsigned char yytype_uint8;
1597 #endif
1598
1599 #ifdef YYTYPE_INT8
1600 typedef YYTYPE_INT8 yytype_int8;
1601 #elif (defined __STDC__ || defined __C99__FUNC__ \
1602      || defined __cplusplus || defined _MSC_VER)
1603 typedef signed char yytype_int8;
1604 #else
1605 typedef short int yytype_int8;
1606 #endif
1607
1608 #ifdef YYTYPE_UINT16
1609 typedef YYTYPE_UINT16 yytype_uint16;
1610 #else
1611 typedef unsigned short int yytype_uint16;
1612 #endif
1613
1614 #ifdef YYTYPE_INT16
1615 typedef YYTYPE_INT16 yytype_int16;
1616 #else
1617 typedef short int yytype_int16;
1618 #endif
1619
1620 #ifndef YYSIZE_T
1621 # ifdef __SIZE_TYPE__
1622 #  define YYSIZE_T __SIZE_TYPE__
1623 # elif defined size_t
1624 #  define YYSIZE_T size_t
1625 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1626      || defined __cplusplus || defined _MSC_VER)
1627 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1628 #  define YYSIZE_T size_t
1629 # else
1630 #  define YYSIZE_T unsigned int
1631 # endif
1632 #endif
1633
1634 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1635
1636 #ifndef YY_
1637 # if YYENABLE_NLS
1638 #  if ENABLE_NLS
1639 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1640 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
1641 #  endif
1642 # endif
1643 # ifndef YY_
1644 #  define YY_(msgid) msgid
1645 # endif
1646 #endif
1647
1648 /* Suppress unused-variable warnings by "using" E.  */
1649 #if ! defined lint || defined __GNUC__
1650 # define YYUSE(e) ((void) (e))
1651 #else
1652 # define YYUSE(e) /* empty */
1653 #endif
1654
1655 /* Identity function, used to suppress warnings about constant conditions.  */
1656 #ifndef lint
1657 # define YYID(n) (n)
1658 #else
1659 #if (defined __STDC__ || defined __C99__FUNC__ \
1660      || defined __cplusplus || defined _MSC_VER)
1661 static int
1662 YYID (int i)
1663 #else
1664 static int
1665 YYID (i)
1666     int i;
1667 #endif
1668 {
1669   return i;
1670 }
1671 #endif
1672
1673 #if ! defined yyoverflow || YYERROR_VERBOSE
1674
1675 /* The parser invokes alloca or malloc; define the necessary symbols.  */
1676
1677 # ifdef YYSTACK_USE_ALLOCA
1678 #  if YYSTACK_USE_ALLOCA
1679 #   ifdef __GNUC__
1680 #    define YYSTACK_ALLOC __builtin_alloca
1681 #   elif defined __BUILTIN_VA_ARG_INCR
1682 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1683 #   elif defined _AIX
1684 #    define YYSTACK_ALLOC __alloca
1685 #   elif defined _MSC_VER
1686 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1687 #    define alloca _alloca
1688 #   else
1689 #    define YYSTACK_ALLOC alloca
1690 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1691      || defined __cplusplus || defined _MSC_VER)
1692 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1693 #     ifndef _STDLIB_H
1694 #      define _STDLIB_H 1
1695 #     endif
1696 #    endif
1697 #   endif
1698 #  endif
1699 # endif
1700
1701 # ifdef YYSTACK_ALLOC
1702    /* Pacify GCC's `empty if-body' warning.  */
1703 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1704 #  ifndef YYSTACK_ALLOC_MAXIMUM
1705     /* The OS might guarantee only one guard page at the bottom of the stack,
1706        and a page size can be as small as 4096 bytes.  So we cannot safely
1707        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
1708        to allow for a few compiler-allocated temporary stack slots.  */
1709 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1710 #  endif
1711 # else
1712 #  define YYSTACK_ALLOC YYMALLOC
1713 #  define YYSTACK_FREE YYFREE
1714 #  ifndef YYSTACK_ALLOC_MAXIMUM
1715 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1716 #  endif
1717 #  if (defined __cplusplus && ! defined _STDLIB_H \
1718        && ! ((defined YYMALLOC || defined malloc) \
1719              && (defined YYFREE || defined free)))
1720 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1721 #   ifndef _STDLIB_H
1722 #    define _STDLIB_H 1
1723 #   endif
1724 #  endif
1725 #  ifndef YYMALLOC
1726 #   define YYMALLOC malloc
1727 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1728      || defined __cplusplus || defined _MSC_VER)
1729 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1730 #   endif
1731 #  endif
1732 #  ifndef YYFREE
1733 #   define YYFREE free
1734 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1735      || defined __cplusplus || defined _MSC_VER)
1736 void free (void *); /* INFRINGES ON USER NAME SPACE */
1737 #   endif
1738 #  endif
1739 # endif
1740 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1741
1742
1743 #if (! defined yyoverflow \
1744      && (! defined __cplusplus \
1745          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1746
1747 /* A type that is properly aligned for any stack member.  */
1748 union yyalloc
1749 {
1750   yytype_int16 yyss;
1751   YYSTYPE yyvs;
1752   };
1753
1754 /* The size of the maximum gap between one aligned stack and the next.  */
1755 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1756
1757 /* The size of an array large to enough to hold all stacks, each with
1758    N elements.  */
1759 # define YYSTACK_BYTES(N) \
1760      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1761       + YYSTACK_GAP_MAXIMUM)
1762
1763 /* Copy COUNT objects from FROM to TO.  The source and destination do
1764    not overlap.  */
1765 # ifndef YYCOPY
1766 #  if defined __GNUC__ && 1 < __GNUC__
1767 #   define YYCOPY(To, From, Count) \
1768       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1769 #  else
1770 #   define YYCOPY(To, From, Count)              \
1771       do                                        \
1772         {                                       \
1773           YYSIZE_T yyi;                         \
1774           for (yyi = 0; yyi < (Count); yyi++)   \
1775             (To)[yyi] = (From)[yyi];            \
1776         }                                       \
1777       while (YYID (0))
1778 #  endif
1779 # endif
1780
1781 /* Relocate STACK from its old location to the new one.  The
1782    local variables YYSIZE and YYSTACKSIZE give the old and new number of
1783    elements in the stack, and YYPTR gives the new location of the
1784    stack.  Advance YYPTR to a properly aligned location for the next
1785    stack.  */
1786 # define YYSTACK_RELOCATE(Stack)                                        \
1787     do                                                                  \
1788       {                                                                 \
1789         YYSIZE_T yynewbytes;                                            \
1790         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
1791         Stack = &yyptr->Stack;                                          \
1792         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1793         yyptr += yynewbytes / sizeof (*yyptr);                          \
1794       }                                                                 \
1795     while (YYID (0))
1796
1797 #endif
1798
1799 /* YYFINAL -- State number of the termination state.  */
1800 #define YYFINAL  6
1801 /* YYLAST -- Last index in YYTABLE.  */
1802 #define YYLAST   664
1803
1804 /* YYNTOKENS -- Number of terminals.  */
1805 #define YYNTOKENS  107
1806 /* YYNNTS -- Number of nonterminals.  */
1807 #define YYNNTS  224
1808 /* YYNRULES -- Number of rules.  */
1809 #define YYNRULES  427
1810 /* YYNRULES -- Number of states.  */
1811 #define YYNSTATES  712
1812
1813 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
1814 #define YYUNDEFTOK  2
1815 #define YYMAXUTOK   351
1816
1817 #define YYTRANSLATE(YYX)                                                \
1818   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1819
1820 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
1821 static const yytype_uint8 yytranslate[] =
1822 {
1823        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1824        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1825        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1826        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1827      101,   102,     2,     2,   100,     2,   105,     2,     2,     2,
1828        2,     2,     2,     2,     2,     2,     2,     2,     2,    99,
1829        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1830        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1831        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1832        2,   103,     2,   104,     2,     2,     2,     2,     2,     2,
1833        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1834        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1835        2,     2,     2,    97,   106,    98,     2,     2,     2,     2,
1836        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1837        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1838        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1839        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1840        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1841        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1842        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1843        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1844        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1845        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1846        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1847        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1848        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
1849        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
1850       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
1851       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
1852       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
1853       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
1854       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
1855       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
1856       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
1857       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
1858       95,    96
1859 };
1860
1861 #if YYDEBUG
1862 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1863    YYRHS.  */
1864 static const yytype_uint16 yyprhs[] =
1865 {
1866        0,     0,     3,     5,     6,     8,    11,    12,    23,    27,
1867       28,    30,    32,    34,    35,    39,    40,    41,    45,    47,
1868       48,    50,    53,    57,    59,    63,    65,    67,    69,    71,
1869       73,    75,    77,    79,    81,    83,    85,    87,    89,    91,
1870       93,    95,    97,    99,   101,   103,   105,   107,   109,   111,
1871      113,   115,   117,   119,   121,   122,   124,   127,   129,   131,
1872      133,   135,   137,   139,   141,   143,   145,   147,   149,   151,
1873      154,   155,   156,   162,   164,   166,   168,   170,   172,   174,
1874      176,   178,   180,   182,   183,   187,   189,   191,   192,   201,
1875      202,   207,   209,   211,   213,   215,   217,   219,   221,   223,
1876      225,   227,   229,   231,   233,   235,   237,   239,   240,   241,
1877      253,   255,   259,   261,   266,   268,   272,   275,   277,   282,
1878      284,   286,   289,   291,   295,   296,   302,   303,   304,   305,
1879      320,   321,   322,   346,   347,   350,   351,   352,   364,   369,
1880      370,   372,   376,   378,   381,   382,   384,   386,   387,   390,
1881      392,   394,   395,   401,   402,   403,   409,   410,   411,   417,
1882      418,   420,   421,   423,   427,   429,   430,   436,   437,   439,
1883      443,   448,   449,   453,   454,   458,   459,   460,   461,   477,
1884      478,   479,   480,   481,   482,   483,   484,   485,   510,   515,
1885      516,   518,   520,   524,   526,   531,   533,   536,   538,   540,
1886      542,   544,   550,   556,   558,   560,   562,   564,   565,   569,
1887      570,   574,   576,   577,   581,   582,   586,   591,   594,   599,
1888      602,   603,   608,   611,   616,   620,   622,   624,   626,   628,
1889      630,   632,   634,   636,   640,   643,   646,   650,   654,   657,
1890      660,   663,   665,   668,   670,   673,   676,   678,   681,   684,
1891      687,   689,   692,   694,   697,   700,   703,   706,   709,   712,
1892      714,   717,   719,   721,   723,   725,   727,   728,   732,   739,
1893      741,   745,   747,   751,   753,   755,   757,   759,   761,   763,
1894      767,   769,   773,   774,   780,   782,   784,   786,   788,   791,
1895      792,   795,   796,   798,   799,   805,   810,   811,   817,   818,
1896      819,   825,   826,   828,   832,   835,   837,   839,   841,   846,
1897      847,   849,   853,   855,   856,   858,   862,   864,   866,   869,
1898      870,   872,   873,   875,   878,   879,   885,   890,   891,   896,
1899      898,   902,   904,   909,   911,   915,   917,   919,   921,   922,
1900      925,   927,   930,   932,   936,   938,   943,   950,   952,   954,
1901      957,   962,   964,   965,   966,   967,   983,   984,   985,   986,
1902     1002,  1003,  1004,  1005,  1021,  1023,  1025,  1028,  1029,  1035,
1903     1038,  1040,  1041,  1046,  1047,  1049,  1053,  1055,  1057,  1058,
1904     1060,  1063,  1065,  1067,  1068,  1074,  1075,  1084,  1087,  1088,
1905     1091,  1092,  1094,  1097,  1100,  1101,  1102,  1103,  1104,  1122,
1906     1124,  1125,  1127,  1130,  1131,  1140,  1142,  1146,  1148,  1151,
1907     1153,  1155,  1156,  1158,  1161,  1162,  1163,  1164,  1165,  1166,
1908     1181,  1184,  1185,  1187,  1192,  1193,  1195,  1199
1909 };
1910
1911 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
1912 static const yytype_int16 yyrhs[] =
1913 {
1914      108,     0,    -1,   109,    -1,    -1,   110,    -1,   109,   110,
1915       -1,    -1,   126,   111,   112,   113,     4,    18,   116,   114,
1916      127,    29,    -1,    97,   269,    98,    -1,    -1,    25,    -1,
1917       69,    -1,   115,    -1,    -1,    39,   118,    99,    -1,    -1,
1918       -1,    31,   117,    99,    -1,   119,    -1,    -1,   120,    -1,
1919      119,   120,    -1,   121,    33,   126,    -1,   122,    -1,   121,
1920      100,   122,    -1,     6,    -1,     5,    -1,   123,    -1,   124,
1921       -1,   125,    -1,    19,    -1,    44,    -1,    46,    -1,    49,
1922       -1,    53,    -1,    54,    -1,    60,    -1,    61,    -1,    62,
1923       -1,    67,    -1,    85,    -1,    86,    -1,    91,    -1,    15,
1924       -1,    23,    -1,    24,    -1,    35,    -1,    57,    -1,    58,
1925       -1,    87,    -1,    45,    -1,    92,    -1,     5,    -1,   128,
1926       -1,    -1,   129,    -1,   128,   129,    -1,   139,    -1,   137,
1927       -1,   159,    -1,   163,    -1,   167,    -1,   193,    -1,   197,
1928       -1,   284,    -1,   276,    -1,   280,    -1,   307,    -1,   130,
1929       -1,     1,    98,    -1,    -1,    -1,   133,   131,    48,   132,
1930       29,    -1,    54,    -1,    62,    -1,    87,    -1,    58,    -1,
1931       61,    -1,    85,    -1,    60,    -1,    57,    -1,    53,    -1,
1932       15,    -1,    -1,    20,   135,    98,    -1,     6,    -1,     5,
1933       -1,    -1,   136,   138,    59,    36,     4,    97,   269,    98,
1934       -1,    -1,   141,   140,     4,   146,    -1,     5,    -1,   142,
1935       -1,   145,    -1,   143,    -1,   144,    -1,    46,    -1,    86,
1936       -1,    67,    -1,    44,    -1,    91,    -1,    23,    -1,    35,
1937       -1,    24,    -1,    45,    -1,    92,    -1,   154,    -1,    -1,
1938       -1,    85,   147,   237,    80,   235,    27,   267,   148,   255,
1939       84,   154,    -1,   134,    -1,    78,    65,   150,    -1,     5,
1940       -1,    78,    97,   152,    98,    -1,   153,    -1,   152,   100,
1941      153,    -1,     6,   155,    -1,   210,    -1,    19,    97,   156,
1942       98,    -1,   212,    -1,    19,    -1,     5,   224,    -1,   157,
1943       -1,   156,   100,   157,    -1,    -1,     6,   158,   101,     7,
1944      102,    -1,    -1,    -1,    -1,     6,   160,    61,   161,    80,
1945      235,    27,   267,   162,   255,     4,    97,   269,    98,    -1,
1946       -1,    -1,     6,   164,    62,   165,    84,   154,   238,   174,
1947      177,   179,    80,   235,   166,   186,   255,   240,   243,   181,
1948      249,     4,    97,   253,    98,    -1,    -1,    27,   267,    -1,
1949       -1,    -1,   136,   168,    87,   169,    30,   269,   170,   173,
1950      255,     4,     7,    -1,    94,    97,   171,    98,    -1,    -1,
1951      172,    -1,   171,   100,   172,    -1,   253,    -1,    27,   267,
1952       -1,    -1,   190,    -1,   175,    -1,    -1,   176,   239,    -1,
1953       74,    -1,    68,    -1,    -1,    72,   178,    97,   248,    98,
1954       -1,    -1,    -1,    73,   180,    97,   253,    98,    -1,    -1,
1955       -1,    88,   182,    97,   183,    98,    -1,    -1,   184,    -1,
1956       -1,   185,    -1,   184,   100,   185,    -1,   253,    -1,    -1,
1957       42,   187,    97,   188,    98,    -1,    -1,   189,    -1,   188,
1958      100,   189,    -1,     6,   101,     7,   102,    -1,    -1,    50,
1959      191,   239,    -1,    -1,    14,   192,   239,    -1,    -1,    -1,
1960       -1,     6,   194,    58,   195,   260,    80,   235,    27,   267,
1961      196,   255,     4,    97,   254,    98,    -1,    -1,    -1,    -1,
1962       -1,    -1,    -1,    -1,    -1,     6,   198,    54,   199,   206,
1963      200,    47,   268,   201,    66,   267,   202,    21,   267,   203,
1964       27,   267,   204,   256,   205,     4,    97,   269,    98,    -1,
1965       82,    97,   207,    98,    -1,    -1,   208,    -1,   209,    -1,
1966      208,   100,   209,    -1,     6,    -1,     6,   101,     7,   102,
1967       -1,   214,    -1,   211,   214,    -1,   149,    -1,   150,    -1,
1968      151,    -1,   222,    -1,   103,    16,     7,   104,    37,    -1,
1969      103,    90,     7,   104,    37,    -1,   221,    -1,   223,    -1,
1970      220,    -1,    43,    -1,    -1,    43,   215,   225,    -1,    -1,
1971       43,   216,   230,    -1,    44,    -1,    -1,    44,   217,   225,
1972       -1,    -1,     5,   218,   230,    -1,   126,   105,     5,   230,
1973       -1,     5,   225,    -1,   126,   105,     5,   225,    -1,    64,
1974       81,    -1,    -1,    64,    81,   219,   226,    -1,     5,   226,
1975       -1,   126,   105,     5,   226,    -1,    59,    36,   224,    -1,
1976        7,    -1,     8,    -1,     9,    -1,    10,    -1,    11,    -1,
1977       12,    -1,     6,    -1,    13,    -1,    97,   273,    98,    -1,
1978       43,   224,    -1,    44,   224,    -1,    64,    81,   224,    -1,
1979       59,    36,   224,    -1,    46,   224,    -1,    23,   224,    -1,
1980       23,   225,    -1,    35,    -1,    35,   225,    -1,    91,    -1,
1981       91,   225,    -1,    86,   224,    -1,    67,    -1,    67,   226,
1982       -1,    24,   224,    -1,    24,   225,    -1,    45,    -1,    45,
1983      225,    -1,    92,    -1,    92,   225,    -1,    46,   224,    -1,
1984       23,   224,    -1,    35,   224,    -1,    91,   224,    -1,    86,
1985      224,    -1,    67,    -1,    24,   224,    -1,    45,    -1,    92,
1986       -1,   225,    -1,   226,    -1,   230,    -1,    -1,   101,   227,
1987      102,    -1,   101,    79,   101,   227,   102,   102,    -1,   228,
1988       -1,   227,   106,   228,    -1,   229,    -1,   229,     3,   229,
1989       -1,     8,    -1,     7,    -1,    10,    -1,     9,    -1,    12,
1990       -1,    11,    -1,    97,   231,    98,    -1,   232,    -1,   231,
1991      100,   232,    -1,    -1,     6,   233,   101,   234,   102,    -1,
1992        7,    -1,     8,    -1,     6,    -1,     6,    -1,    28,   267,
1993       -1,    -1,    89,   267,    -1,    -1,     6,    -1,    -1,    70,
1994      241,    97,   248,    98,    -1,    17,    97,   248,    98,    -1,
1995       -1,    32,   242,    97,   248,    98,    -1,    -1,    -1,    41,
1996      244,    97,   245,    98,    -1,    -1,   246,    -1,   245,   100,
1997      246,    -1,    38,   247,    -1,   247,    -1,   253,    -1,   253,
1998       -1,    26,    97,   250,    98,    -1,    -1,   213,    -1,    97,
1999      251,    98,    -1,   252,    -1,    -1,     6,    -1,   252,   100,
2000        6,    -1,   269,    -1,   269,    -1,    76,   267,    -1,    -1,
2001      257,    -1,    -1,   258,    -1,   257,   258,    -1,    -1,    77,
2002      268,   259,    27,   267,    -1,    63,    97,   262,    98,    -1,
2003       -1,    63,    97,   262,    98,    -1,   263,    -1,   262,   100,
2004      263,    -1,   253,    -1,    56,    97,   265,    98,    -1,   266,
2005       -1,   265,   100,   266,    -1,   254,    -1,    13,    -1,    13,
2006       -1,    -1,   270,   271,    -1,   272,    -1,   271,   272,    -1,
2007      136,    -1,   126,   105,     6,    -1,     7,    -1,     6,   101,
2008        7,   102,    -1,   126,   105,     6,   101,     7,   102,    -1,
2009      274,    -1,   275,    -1,   274,   275,    -1,     6,   101,     7,
2010      102,    -1,     7,    -1,    -1,    -1,    -1,     6,   277,    60,
2011      278,   261,    80,   235,    27,   267,   279,   255,     4,    97,
2012      269,    98,    -1,    -1,    -1,    -1,     6,   281,    57,   282,
2013      264,    80,   235,    27,   267,   283,   255,     4,    97,   269,
2014       98,    -1,    -1,    -1,    -1,     6,   285,    53,   286,    80,
2015      235,    27,   267,   287,   255,   288,     4,    97,   269,    98,
2016       -1,   289,    -1,   290,    -1,   289,   290,    -1,    -1,    52,
2017      292,   291,   293,   296,    -1,     5,   269,    -1,     5,    -1,
2018       -1,    49,    97,   294,    98,    -1,    -1,   295,    -1,   294,
2019      100,   295,    -1,   269,    -1,   297,    -1,    -1,   298,    -1,
2020      297,   298,    -1,   299,    -1,   301,    -1,    -1,    34,   300,
2021      269,    27,   267,    -1,    -1,    59,   302,   253,   303,   304,
2022      306,    27,   267,    -1,    84,   154,    -1,    -1,    96,   305,
2023       -1,    -1,   154,    -1,    51,   239,    -1,    71,   239,    -1,
2024       -1,    -1,    -1,    -1,     6,   308,    15,   309,    75,   267,
2025       80,   236,    27,   267,   310,   255,   311,     4,    97,   269,
2026       98,    -1,   312,    -1,    -1,   313,    -1,   312,   313,    -1,
2027       -1,    83,   317,   314,    40,    97,   315,    98,   318,    -1,
2028      316,    -1,   315,   100,   316,    -1,   269,    -1,     5,   269,
2029       -1,     5,    -1,   319,    -1,    -1,   320,    -1,   319,   320,
2030       -1,    -1,    -1,    -1,    -1,    -1,    95,   253,   321,   303,
2031      322,   304,   323,   326,   328,   324,   249,   325,    27,   267,
2032       -1,    14,   327,    -1,    -1,     6,    -1,    22,    97,   329,
2033       98,    -1,    -1,   330,    -1,   329,   100,   330,    -1,   253,
2034       -1
2035 };
2036
2037 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
2038 static const yytype_uint16 yyrline[] =
2039 {
2040        0,  1586,  1586,  1591,  1596,  1598,  1607,  1606,  1668,  1671,
2041     1674,  1676,  1685,  1688,  1691,  1706,  1708,  1707,  1728,  1731,
2042     1735,  1737,  1741,  1786,  1788,  1796,  1802,  1808,  1824,  1834,
2043     1840,  1841,  1842,  1843,  1844,  1845,  1846,  1847,  1848,  1849,
2044     1850,  1851,  1852,  1855,  1856,  1857,  1858,  1859,  1860,  1861,
2045     1864,  1865,  1868,  1880,  1883,  1887,  1889,  1893,  1898,  1903,
2046     1908,  1913,  1918,  1923,  1928,  1933,  1938,  1943,  1948,  1953,
2047     1968,  1980,  1967,  2013,  2014,  2015,  2016,  2017,  2018,  2019,
2048     2020,  2021,  2022,  2026,  2025,  2055,  2060,  2076,  2075,  2116,
2049     2115,  2281,  2285,  2309,  2323,  2324,  2333,  2334,  2335,  2336,
2050     2337,  2340,  2341,  2342,  2345,  2346,  2349,  2366,  2397,  2365,
2051     2433,  2441,  2455,  2500,  2508,  2514,  2534,  2617,  2623,  2645,
2052     2649,  2654,  2687,  2693,  2707,  2706,  2742,  2752,  2777,  2741,
2053     2805,  2815,  2804,  3111,  3120,  3128,  3138,  3127,  3210,  3215,
2054     3220,  3230,  3252,  3258,  3264,  3267,  3271,  3280,  3283,  3287,
2055     3291,  3296,  3295,  3303,  3307,  3306,  3314,  3319,  3318,  3326,
2056     3329,  3332,  3335,  3341,  3355,  3360,  3359,  3367,  3370,  3376,
2057     3390,  3412,  3411,  3423,  3422,  3436,  3446,  3466,  3435,  3497,
2058     3507,  3532,  3536,  3540,  3547,  3554,  3558,  3496,  3604,  3611,
2059     3618,  3625,  3631,  3646,  3667,  3690,  3694,  3714,  3719,  3724,
2060     3729,  3746,  3748,  3756,  3761,  3778,  3787,  3801,  3800,  3820,
2061     3819,  3834,  3861,  3860,  3892,  3891,  3945,  3992,  4047,  4097,
2062     4103,  4102,  4114,  4160,  4201,  4208,  4215,  4221,  4228,  4235,
2063     4261,  4284,  4304,  4321,  4354,  4358,  4383,  4387,  4393,  4421,
2064     4447,  4484,  4510,  4543,  4567,  4594,  4622,  4660,  4706,  4732,
2065     4769,  4795,  4832,  4858,  4901,  4929,  4955,  4981,  5005,  5033,
2066     5073,  5099,  5124,  5151,  5168,  5185,  5204,  5211,  5221,  5233,
2067     5239,  5253,  5260,  5270,  5276,  5282,  5288,  5294,  5317,  5344,
2068     5350,  5356,  5370,  5369,  5391,  5406,  5415,  5474,  5490,  5500,
2069     5505,  5515,  5520,  5587,  5586,  5604,  5615,  5614,  5628,  5634,
2070     5633,  5667,  5672,  5678,  5692,  5697,  5703,  5713,  5719,  5734,
2071     5738,  5740,  5748,  5751,  5754,  5760,  5773,  5779,  5785,  5795,
2072     5798,  5801,  5804,  5806,  5811,  5810,  5841,  5846,  5851,  5857,
2073     5863,  5876,  5888,  5894,  5900,  5913,  5924,  5935,  5941,  5941,
2074     5956,  5960,  5969,  6063,  6167,  6191,  6251,  6320,  6324,  6326,
2075     6330,  6332,  6337,  6347,  6366,  6336,  6397,  6407,  6429,  6396,
2076     6461,  6471,  6489,  6460,  6553,  6559,  6563,  6599,  6598,  6627,
2077     6636,  6646,  6651,  6656,  6661,  6667,  6680,  6703,  6710,  6717,
2078     6721,  6788,  6794,  6803,  6802,  6836,  6835,  6882,  6891,  6896,
2079     6908,  6913,  6919,  6925,  6934,  6940,  6950,  6972,  6939,  7007,
2080     7010,  7013,  7015,  7020,  7019,  7046,  7056,  7073,  7079,  7088,
2081     7098,  7101,  7104,  7106,  7111,  7119,  7126,  7134,  7141,  7110,
2082     7164,  7167,  7170,  7235,  7238,  7241,  7243,  7247
2083 };
2084 #endif
2085
2086 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
2087 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
2088    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
2089 static const char *const yytname[] =
2090 {
2091   "$end", "error", "$undefined", "DOT_DOT", "COLON_COLON_EQUAL",
2092   "UPPERCASE_IDENTIFIER", "LOWERCASE_IDENTIFIER", "NUMBER",
2093   "NEGATIVENUMBER", "NUMBER64", "NEGATIVENUMBER64", "BIN_STRING",
2094   "HEX_STRING", "QUOTED_STRING", "ACCESS", "AGENT_CAPABILITIES",
2095   "APPLICATION", "AUGMENTS", "BEGIN_", "BITS", "CHOICE", "CONTACT_INFO",
2096   "CREATION_REQUIRES", "COUNTER32", "COUNTER64", "DEFINITIONS", "DEFVAL",
2097   "DESCRIPTION", "DISPLAY_HINT", "END", "ENTERPRISE", "EXPORTS", "EXTENDS",
2098   "FROM", "GROUP", "GAUGE32", "IDENTIFIER", "IMPLICIT", "IMPLIED",
2099   "IMPORTS", "INCLUDES", "INDEX", "INSTALL_ERRORS", "INTEGER", "INTEGER32",
2100   "INTEGER64", "IPADDRESS", "LAST_UPDATED", "MACRO", "MANDATORY_GROUPS",
2101   "MAX_ACCESS", "MIN_ACCESS", "MODULE", "MODULE_COMPLIANCE",
2102   "MODULE_IDENTITY", "NOT_ACCESSIBLE", "NOTIFICATIONS",
2103   "NOTIFICATION_GROUP", "NOTIFICATION_TYPE", "OBJECT", "OBJECT_GROUP",
2104   "OBJECT_IDENTITY", "OBJECT_TYPE", "OBJECTS", "OCTET", "OF",
2105   "ORGANIZATION", "OPAQUE", "PIB_ACCESS", "PIB_DEFINITIONS", "PIB_INDEX",
2106   "PIB_MIN_ACCESS", "PIB_REFERENCES", "PIB_TAG", "POLICY_ACCESS",
2107   "PRODUCT_RELEASE", "REFERENCE", "REVISION", "SEQUENCE", "SIZE", "STATUS",
2108   "STRING", "SUBJECT_CATEGORIES", "SUPPORTS", "SYNTAX",
2109   "TEXTUAL_CONVENTION", "TIMETICKS", "TRAP_TYPE", "UNIQUENESS", "UNITS",
2110   "UNIVERSAL", "UNSIGNED32", "UNSIGNED64", "VALUE", "VARIABLES",
2111   "VARIATION", "WRITE_SYNTAX", "'{'", "'}'", "';'", "','", "'('", "')'",
2112   "'['", "']'", "'.'", "'|'", "$accept", "mibFile", "modules", "module",
2113   "@1", "moduleOid", "definitions", "linkagePart", "linkageClause",
2114   "exportsClause", "@2", "importPart", "imports", "import",
2115   "importIdentifiers", "importIdentifier", "importedKeyword",
2116   "importedSMIKeyword", "importedSPPIKeyword", "moduleName",
2117   "declarationPart", "declarations", "declaration", "macroClause", "@3",
2118   "@4", "macroName", "choiceClause", "@5", "fuzzy_lowercase_identifier",
2119   "valueDeclaration", "@6", "typeDeclaration", "@7", "typeName", "typeSMI",
2120   "typeSMIandSPPI", "typeSMIonly", "typeSPPIonly", "typeDeclarationRHS",
2121   "@8", "@9", "conceptualTable", "row", "entryType", "sequenceItems",
2122   "sequenceItem", "Syntax", "sequenceSyntax", "NamedBits", "NamedBit",
2123   "@10", "objectIdentityClause", "@11", "@12", "@13", "objectTypeClause",
2124   "@14", "@15", "descriptionClause", "trapTypeClause", "@16", "@17",
2125   "VarPart", "VarTypes", "VarType", "DescrPart", "MaxOrPIBAccessPart",
2126   "PibAccessPart", "PibAccess", "SPPIPibReferencesPart", "@18",
2127   "SPPIPibTagPart", "@19", "SPPIUniquePart", "@20", "UniqueTypesPart",
2128   "UniqueTypes", "UniqueType", "SPPIErrorsPart", "@21", "Errors", "Error",
2129   "MaxAccessPart", "@22", "@23", "notificationTypeClause", "@24", "@25",
2130   "@26", "moduleIdentityClause", "@27", "@28", "@29", "@30", "@31", "@32",
2131   "@33", "@34", "SubjectCategoriesPart", "SubjectCategories",
2132   "CategoryIDs", "CategoryID", "ObjectSyntax", "typeTag",
2133   "sequenceObjectSyntax", "valueofObjectSyntax", "SimpleSyntax", "@35",
2134   "@36", "@37", "@38", "@39", "valueofSimpleSyntax",
2135   "sequenceSimpleSyntax", "ApplicationSyntax", "sequenceApplicationSyntax",
2136   "anySubType", "integerSubType", "octetStringSubType", "ranges", "range",
2137   "value", "enumSpec", "enumItems", "enumItem", "@40", "enumNumber",
2138   "Status", "Status_Capabilities", "DisplayPart", "UnitsPart", "Access",
2139   "IndexPart", "@41", "@42", "MibIndex", "@43", "IndexTypes", "IndexType",
2140   "Index", "Entry", "DefValPart", "Value", "BitsValue", "BitNames",
2141   "ObjectName", "NotificationName", "ReferPart", "RevisionPart",
2142   "Revisions", "Revision", "@44", "NotificationObjectsPart",
2143   "ObjectGroupObjectsPart", "Objects", "Object", "NotificationsPart",
2144   "Notifications", "Notification", "Text", "ExtUTCTime",
2145   "objectIdentifier", "@45", "subidentifiers", "subidentifier",
2146   "objectIdentifier_defval", "subidentifiers_defval",
2147   "subidentifier_defval", "objectGroupClause", "@46", "@47", "@48",
2148   "notificationGroupClause", "@49", "@50", "@51", "moduleComplianceClause",
2149   "@52", "@53", "@54", "ComplianceModulePart", "ComplianceModules",
2150   "ComplianceModule", "@55", "ComplianceModuleName", "MandatoryPart",
2151   "MandatoryGroups", "MandatoryGroup", "CompliancePart", "Compliances",
2152   "Compliance", "ComplianceGroup", "@56", "ComplianceObject", "@57",
2153   "SyntaxPart", "WriteSyntaxPart", "WriteSyntax", "AccessPart",
2154   "agentCapabilitiesClause", "@58", "@59", "@60",
2155   "ModulePart_Capabilities", "Modules_Capabilities", "Module_Capabilities",
2156   "@61", "CapabilitiesGroups", "CapabilitiesGroup",
2157   "ModuleName_Capabilities", "VariationPart", "Variations", "Variation",
2158   "@62", "@63", "@64", "@65", "@66", "VariationAccessPart",
2159   "VariationAccess", "CreationPart", "Cells", "Cell", 0
2160 };
2161 #endif
2162
2163 # ifdef YYPRINT
2164 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
2165    token YYLEX-NUM.  */
2166 static const yytype_uint16 yytoknum[] =
2167 {
2168        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
2169      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
2170      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
2171      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
2172      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
2173      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
2174      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
2175      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
2176      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
2177      345,   346,   347,   348,   349,   350,   351,   123,   125,    59,
2178       44,    40,    41,    91,    93,    46,   124
2179 };
2180 # endif
2181
2182 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
2183 static const yytype_uint16 yyr1[] =
2184 {
2185        0,   107,   108,   108,   109,   109,   111,   110,   112,   112,
2186      113,   113,   114,   114,   115,   116,   117,   116,   118,   118,
2187      119,   119,   120,   121,   121,   122,   122,   122,   123,   123,
2188      123,   123,   123,   123,   123,   123,   123,   123,   123,   123,
2189      123,   123,   123,   124,   124,   124,   124,   124,   124,   124,
2190      125,   125,   126,   127,   127,   128,   128,   129,   129,   129,
2191      129,   129,   129,   129,   129,   129,   129,   129,   129,   129,
2192      131,   132,   130,   133,   133,   133,   133,   133,   133,   133,
2193      133,   133,   133,   135,   134,   136,   136,   138,   137,   140,
2194      139,   141,   141,   141,   142,   142,   143,   143,   143,   143,
2195      143,   144,   144,   144,   145,   145,   146,   147,   148,   146,
2196      146,   149,   150,   151,   152,   152,   153,   154,   154,   155,
2197      155,   155,   156,   156,   158,   157,   160,   161,   162,   159,
2198      164,   165,   163,   166,   166,   168,   169,   167,   170,   170,
2199      171,   171,   172,   173,   173,   174,   174,   174,   175,   176,
2200      176,   178,   177,   177,   180,   179,   179,   182,   181,   181,
2201      183,   183,   184,   184,   185,   187,   186,   186,   188,   188,
2202      189,   191,   190,   192,   190,   194,   195,   196,   193,   198,
2203      199,   200,   201,   202,   203,   204,   205,   197,   206,   206,
2204      207,   208,   208,   209,   209,   210,   210,   210,   210,   210,
2205      210,   211,   211,   212,   212,   213,   214,   215,   214,   216,
2206      214,   214,   217,   214,   218,   214,   214,   214,   214,   214,
2207      219,   214,   214,   214,   214,   220,   220,   220,   220,   220,
2208      220,   220,   220,   220,   221,   221,   221,   221,   222,   222,
2209      222,   222,   222,   222,   222,   222,   222,   222,   222,   222,
2210      222,   222,   222,   222,   223,   223,   223,   223,   223,   223,
2211      223,   223,   223,   224,   224,   224,   224,   225,   226,   227,
2212      227,   228,   228,   229,   229,   229,   229,   229,   229,   230,
2213      231,   231,   233,   232,   234,   234,   235,   236,   237,   237,
2214      238,   238,   239,   241,   240,   240,   242,   240,   240,   244,
2215      243,   243,   245,   245,   246,   246,   247,   248,   249,   249,
2216      250,   250,   251,   251,   252,   252,   253,   254,   255,   255,
2217      256,   256,   257,   257,   259,   258,   260,   260,   261,   262,
2218      262,   263,   264,   265,   265,   266,   267,   268,   270,   269,
2219      271,   271,   272,   272,   272,   272,   272,   273,   274,   274,
2220      275,   275,   277,   278,   279,   276,   281,   282,   283,   280,
2221      285,   286,   287,   284,   288,   289,   289,   291,   290,   292,
2222      292,   292,   293,   293,   294,   294,   295,   296,   296,   297,
2223      297,   298,   298,   300,   299,   302,   301,   303,   303,   304,
2224      304,   305,   306,   306,   306,   308,   309,   310,   307,   311,
2225      311,   312,   312,   314,   313,   315,   315,   316,   317,   317,
2226      318,   318,   319,   319,   321,   322,   323,   324,   325,   320,
2227      326,   326,   327,   328,   328,   329,   329,   330
2228 };
2229
2230 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
2231 static const yytype_uint8 yyr2[] =
2232 {
2233        0,     2,     1,     0,     1,     2,     0,    10,     3,     0,
2234        1,     1,     1,     0,     3,     0,     0,     3,     1,     0,
2235        1,     2,     3,     1,     3,     1,     1,     1,     1,     1,
2236        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2237        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2238        1,     1,     1,     1,     0,     1,     2,     1,     1,     1,
2239        1,     1,     1,     1,     1,     1,     1,     1,     1,     2,
2240        0,     0,     5,     1,     1,     1,     1,     1,     1,     1,
2241        1,     1,     1,     0,     3,     1,     1,     0,     8,     0,
2242        4,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2243        1,     1,     1,     1,     1,     1,     1,     0,     0,    11,
2244        1,     3,     1,     4,     1,     3,     2,     1,     4,     1,
2245        1,     2,     1,     3,     0,     5,     0,     0,     0,    14,
2246        0,     0,    23,     0,     2,     0,     0,    11,     4,     0,
2247        1,     3,     1,     2,     0,     1,     1,     0,     2,     1,
2248        1,     0,     5,     0,     0,     5,     0,     0,     5,     0,
2249        1,     0,     1,     3,     1,     0,     5,     0,     1,     3,
2250        4,     0,     3,     0,     3,     0,     0,     0,    15,     0,
2251        0,     0,     0,     0,     0,     0,     0,    24,     4,     0,
2252        1,     1,     3,     1,     4,     1,     2,     1,     1,     1,
2253        1,     5,     5,     1,     1,     1,     1,     0,     3,     0,
2254        3,     1,     0,     3,     0,     3,     4,     2,     4,     2,
2255        0,     4,     2,     4,     3,     1,     1,     1,     1,     1,
2256        1,     1,     1,     3,     2,     2,     3,     3,     2,     2,
2257        2,     1,     2,     1,     2,     2,     1,     2,     2,     2,
2258        1,     2,     1,     2,     2,     2,     2,     2,     2,     1,
2259        2,     1,     1,     1,     1,     1,     0,     3,     6,     1,
2260        3,     1,     3,     1,     1,     1,     1,     1,     1,     3,
2261        1,     3,     0,     5,     1,     1,     1,     1,     2,     0,
2262        2,     0,     1,     0,     5,     4,     0,     5,     0,     0,
2263        5,     0,     1,     3,     2,     1,     1,     1,     4,     0,
2264        1,     3,     1,     0,     1,     3,     1,     1,     2,     0,
2265        1,     0,     1,     2,     0,     5,     4,     0,     4,     1,
2266        3,     1,     4,     1,     3,     1,     1,     1,     0,     2,
2267        1,     2,     1,     3,     1,     4,     6,     1,     1,     2,
2268        4,     1,     0,     0,     0,    15,     0,     0,     0,    15,
2269        0,     0,     0,    15,     1,     1,     2,     0,     5,     2,
2270        1,     0,     4,     0,     1,     3,     1,     1,     0,     1,
2271        2,     1,     1,     0,     5,     0,     8,     2,     0,     2,
2272        0,     1,     2,     2,     0,     0,     0,     0,    17,     1,
2273        0,     1,     2,     0,     8,     1,     3,     1,     2,     1,
2274        1,     0,     1,     2,     0,     0,     0,     0,     0,    14,
2275        2,     0,     1,     4,     0,     1,     3,     1
2276 };
2277
2278 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2279    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
2280    means the default is an error.  */
2281 static const yytype_uint16 yydefact[] =
2282 {
2283        3,    52,     0,     2,     4,     6,     1,     5,     9,   338,
2284        0,     0,     0,    10,    11,     0,     8,    86,    85,   344,
2285        0,   342,   339,   340,     0,     0,     0,   341,    15,     0,
2286      343,    16,    13,   345,     0,     0,    19,     0,    12,     0,
2287       17,    26,    25,    43,    30,    44,    45,    46,    31,    50,
2288       32,    33,    34,    35,    47,    48,    36,    37,    38,    39,
2289       40,    41,    49,    42,    51,     0,    18,    20,     0,    23,
2290       27,    28,    29,     0,    86,    85,    82,   101,   103,   102,
2291       99,   104,    96,    81,    73,    80,    76,    79,    77,    74,
2292       98,    78,    97,    75,   100,   105,     0,     0,    55,    68,
2293       70,    87,    58,    57,    89,    92,    94,    95,    93,    59,
2294       60,    61,    62,    63,    65,    66,    64,    67,   346,    14,
2295       21,     0,     0,    69,     0,     0,     0,     0,     0,     0,
2296        0,     0,     7,    56,     0,     0,     0,     0,    22,    24,
2297      127,   131,   176,   180,   353,   357,   361,   396,    71,     0,
2298      136,     0,     0,     0,   327,   189,     0,     0,     0,     0,
2299        0,     0,     0,   112,     0,    83,   266,   266,   241,   206,
2300      211,   250,   266,     0,     0,   246,     0,   107,   266,   243,
2301      252,     0,     0,   110,    90,   197,   198,   199,   106,   117,
2302        0,   195,   200,     0,     0,     0,     0,     0,   181,     0,
2303        0,     0,     0,     0,     0,    72,     0,   338,     0,     0,
2304      217,   222,     0,     0,     0,   239,   240,   264,   265,   248,
2305      249,     0,   242,     0,     0,     0,   251,   238,   263,   266,
2306      219,     0,   247,     0,     0,   289,   245,   244,   253,     0,
2307        0,     0,    52,   196,   286,     0,   291,   338,     0,     0,
2308        0,   338,     0,   338,     0,     0,   336,     0,   338,   139,
2309      274,   273,   276,   275,   278,   277,     0,     0,   269,   271,
2310      215,   124,     0,   122,    84,   282,     0,   280,   208,   210,
2311      213,   224,     0,   112,   111,     0,     0,   114,     0,     0,
2312        0,     0,     0,     0,     0,   147,   331,     0,   329,   316,
2313        0,   193,     0,   190,   191,     0,     0,     0,   335,     0,
2314      333,   317,     0,     0,     0,     0,     0,   144,     0,   267,
2315        0,     0,     0,   118,     0,     0,   279,     0,   221,   266,
2316      120,   266,   266,   266,   266,   266,   261,   266,     0,     0,
2317      259,   266,   266,   262,   116,   119,   203,   204,   113,     0,
2318      288,     0,     0,     0,   218,   223,   216,   128,   290,   173,
2319      171,   150,   149,   153,   146,     0,   145,   326,   338,     0,
2320        0,   188,     0,   337,   182,   328,     0,   332,   338,     0,
2321      362,   287,     0,    88,   338,     0,   319,     0,   270,   272,
2322        0,   123,     0,   281,   121,   255,   260,   256,   234,   235,
2323      254,   266,   266,   258,   257,   115,     0,   201,   202,   319,
2324        0,     0,   151,   156,   292,   148,   330,   177,     0,   192,
2325        0,   354,   334,   358,   319,     0,     0,   140,   142,   143,
2326        0,     0,     0,     0,   284,   285,     0,   237,   236,     0,
2327        0,   174,   172,     0,   154,     0,   319,   194,     0,   319,
2328      319,     0,   397,   138,   338,   318,     0,   268,   125,   283,
2329      108,     0,   338,     0,     0,     0,   183,     0,     0,   371,
2330        0,   364,   365,   319,   141,   137,   319,   338,     0,   307,
2331      338,   133,     0,     0,     0,     0,   370,   367,     0,   366,
2332      400,     0,     0,   152,     0,     0,   167,   338,     0,   338,
2333      338,   369,   373,   338,     0,     0,   399,   401,     0,   129,
2334      155,   134,   165,   319,     0,   184,     0,     0,     0,   378,
2335        0,   338,   403,     0,   402,   109,     0,   298,   178,     0,
2336      355,   359,   338,   383,   385,   368,   377,   379,   381,   382,
2337      363,   408,     0,   338,     0,     0,   296,   293,   301,     0,
2338      376,     0,   374,   338,   338,   380,     0,     0,     0,     0,
2339      168,   338,     0,     0,   299,   159,   185,   372,   338,     0,
2340      388,   338,   398,     0,   166,     0,     0,   338,   338,     0,
2341      157,   309,   321,   375,     0,     0,   390,   407,     0,   405,
2342        0,   169,   295,     0,     0,   338,     0,     0,     0,     0,
2343      186,   320,   322,   384,   387,     0,   394,   411,   338,   170,
2344      297,   294,   338,     0,   302,   305,   306,   338,     0,     0,
2345      324,     0,   323,   391,   389,     0,     0,     0,   338,   404,
2346      410,   412,   406,   304,   300,   338,     0,   160,   162,   164,
2347      231,   225,   226,   227,   228,   229,   230,   232,   313,   310,
2348      205,     0,   338,     0,     0,   392,   393,     0,   414,   413,
2349      303,   158,   338,   314,   351,     0,   312,     0,   347,   348,
2350      308,     0,     0,   338,   386,   388,   163,     0,   311,     0,
2351      233,     0,   349,   132,   325,     0,   415,     0,   315,   187,
2352      390,   350,   416,   421,     0,   424,   422,   420,     0,   417,
2353      338,   309,   427,     0,   425,   418,   423,   338,     0,   426,
2354        0,   419
2355 };
2356
2357 /* YYDEFGOTO[NTERM-NUM].  */
2358 static const yytype_int16 yydefgoto[] =
2359 {
2360       -1,     2,     3,     4,     8,    10,    15,    37,    38,    32,
2361       35,    65,    66,    67,    68,    69,    70,    71,    72,   182,
2362       96,    97,    98,    99,   134,   160,   100,   183,   213,    21,
2363      102,   135,   103,   137,   104,   105,   106,   107,   108,   184,
2364      235,   476,   185,   186,   187,   286,   287,   188,   344,   272,
2365      273,   322,   109,   124,   152,   409,   110,   125,   153,   496,
2366      111,   136,   162,   317,   426,   427,   386,   363,   364,   365,
2367      413,   443,   445,   463,   581,   596,   636,   637,   638,   513,
2368      526,   559,   560,   366,   411,   410,   112,   126,   154,   446,
2369      113,   127,   155,   250,   420,   483,   529,   582,   621,   198,
2370      302,   303,   304,   189,   190,   345,   649,   191,   223,   224,
2371      225,   209,   282,   650,   346,   192,   347,   215,   228,   217,
2372      267,   268,   269,   218,   276,   277,   325,   436,   245,   382,
2373      289,   295,   415,   548,   563,   562,   565,   579,   613,   614,
2374      615,   478,   598,   651,   665,   666,   479,   308,   431,   600,
2375      601,   602,   653,   196,   200,   297,   298,   202,   309,   310,
2376      257,   374,   299,    12,    22,    23,   667,   668,   669,   114,
2377      128,   156,   449,   115,   129,   157,   450,   116,   130,   158,
2378      424,   470,   471,   472,   502,   487,   519,   551,   552,   535,
2379      536,   537,   538,   553,   539,   554,   586,   606,   624,   627,
2380      117,   131,   159,   473,   505,   506,   507,   542,   588,   589,
2381      522,   629,   630,   631,   675,   690,   693,   701,   708,   695,
2382      697,   699,   703,   704
2383 };
2384
2385 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2386    STATE-NUM.  */
2387 #define YYPACT_NINF -461
2388 static const yytype_int16 yypact[] =
2389 {
2390       19,  -461,    36,    19,  -461,  -461,  -461,  -461,   -58,  -461,
2391       -5,   -31,    54,  -461,  -461,    78,  -461,    -1,     9,  -461,
2392       38,  -461,    54,  -461,   107,   154,   160,  -461,   138,    88,
2393       90,  -461,   153,  -461,   186,    95,   561,   350,  -461,    93,
2394     -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,
2395     -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,
2396     -461,  -461,  -461,  -461,  -461,    97,   561,  -461,   -23,  -461,
2397     -461,  -461,  -461,    99,   195,    70,  -461,  -461,  -461,  -461,
2398     -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,
2399     -461,  -461,  -461,  -461,  -461,  -461,   171,   496,  -461,  -461,
2400     -461,   115,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,
2401     -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,
2402     -461,    19,   561,  -461,   140,   141,   146,   151,   149,   155,
2403      158,   191,  -461,  -461,   166,   156,   129,   213,  -461,  -461,
2404     -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,   183,
2405     -461,   202,   143,   134,   157,   142,   167,   173,   152,   161,
2406      204,   227,   205,     2,   145,  -461,   -47,   -47,   150,   -18,
2407      159,   150,   -47,   203,   162,   169,   -49,  -461,   -47,   150,
2408      150,    -2,   148,  -461,  -461,  -461,  -461,  -461,  -461,  -461,
2409       52,  -461,  -461,   244,   233,   165,   174,   170,  -461,   176,
2410      178,   177,   179,   244,   242,  -461,   184,  -461,    35,   185,
2411     -461,  -461,   257,   187,   265,  -461,  -461,  -461,  -461,  -461,
2412     -461,   175,  -461,   150,   185,   150,  -461,  -461,  -461,   -47,
2413      188,   193,  -461,   270,   277,   256,  -461,  -461,  -461,   279,
2414      283,   286,     5,  -461,  -461,   268,   207,  -461,   244,   292,
2415      254,  -461,   244,  -461,   244,   275,  -461,   223,  -461,   210,
2416     -461,  -461,  -461,  -461,  -461,  -461,   206,     3,  -461,   303,
2417     -461,  -461,    15,  -461,  -461,  -461,    37,  -461,  -461,  -461,
2418     -461,  -461,   169,  -461,  -461,   441,    41,  -461,   242,   229,
2419      208,   209,   -47,   242,   242,    13,  -461,    44,  -461,  -461,
2420      287,   214,   212,   217,  -461,   305,    48,   293,  -461,    51,
2421     -461,  -461,   294,   242,   316,   225,   230,   299,   175,  -461,
2422      175,   175,   228,  -461,   257,   231,  -461,   265,  -461,   -47,
2423     -461,   -47,   -47,   -47,   -47,   -47,  -461,   -47,   295,   247,
2424     -461,   -47,   -47,  -461,  -461,  -461,  -461,  -461,  -461,   277,
2425     -461,   244,   296,   297,  -461,  -461,  -461,  -461,  -461,  -461,
2426     -461,  -461,  -461,   258,  -461,   329,  -461,  -461,  -461,   242,
2427      330,  -461,   292,  -461,  -461,  -461,   242,  -461,  -461,   242,
2428     -461,  -461,   311,  -461,  -461,   242,   263,     6,  -461,  -461,
2429      333,  -461,   126,  -461,  -461,  -461,  -461,  -461,  -461,  -461,
2430     -461,   -47,   -47,  -461,  -461,  -461,   314,  -461,  -461,   263,
2431      329,   329,  -461,   269,  -461,  -461,  -461,  -461,   241,  -461,
2432      278,  -461,  -461,  -461,   263,   242,    55,  -461,  -461,  -461,
2433      242,   341,   245,   246,  -461,  -461,   248,  -461,  -461,   242,
2434      342,  -461,  -461,   255,  -461,   273,   263,  -461,   242,   263,
2435      263,   302,  -461,  -461,  -461,  -461,   351,  -461,  -461,  -461,
2436     -461,   260,  -461,   262,   244,   356,  -461,   357,   358,   359,
2437      363,   302,  -461,   263,  -461,  -461,   263,  -461,   272,  -461,
2438     -461,   336,   271,   354,   280,   281,   114,  -461,   284,  -461,
2439      300,   304,   282,  -461,   288,   242,   334,  -461,   242,  -461,
2440     -461,  -461,   335,  -461,   385,   387,   300,  -461,   233,  -461,
2441     -461,  -461,  -461,   263,   301,  -461,   307,   317,   312,    -3,
2442      320,   352,  -461,   322,  -461,  -461,   323,    20,  -461,   370,
2443     -461,  -461,  -461,  -461,  -461,  -461,    -3,  -461,  -461,  -461,
2444     -461,  -461,   360,  -461,   392,   324,  -461,  -461,   361,   242,
2445     -461,    58,  -461,  -461,  -461,  -461,   325,   326,   313,    59,
2446     -461,  -461,   331,   332,  -461,   338,  -461,  -461,  -461,   374,
2447      339,  -461,  -461,   420,  -461,   392,   340,  -461,  -461,   337,
2448     -461,   404,   355,  -461,   242,   233,   343,  -461,    64,  -461,
2449      345,  -461,  -461,   346,   347,   393,   353,   362,   429,   305,
2450     -461,   355,  -461,  -461,  -461,   233,   -13,   348,  -461,  -461,
2451     -461,  -461,  -461,    67,  -461,  -461,  -461,   364,    63,   366,
2452     -461,   436,  -461,  -461,  -461,   329,   329,   421,  -461,  -461,
2453      348,  -461,  -461,  -461,  -461,   393,   368,   349,  -461,  -461,
2454     -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,   172,  -461,
2455     -461,   369,  -461,   424,   372,  -461,  -461,   242,  -461,  -461,
2456     -461,  -461,  -461,   371,  -461,   373,   375,   376,   182,  -461,
2457     -461,   380,   242,  -461,  -461,   339,  -461,   445,  -461,   447,
2458     -461,   371,  -461,  -461,  -461,   381,  -461,   378,  -461,  -461,
2459      343,  -461,  -461,   442,   449,   435,  -461,  -461,   384,  -461,
2460     -461,   404,  -461,    77,  -461,  -461,  -461,  -461,   431,  -461,
2461      242,  -461
2462 };
2463
2464 /* YYPGOTO[NTERM-NUM].  */
2465 static const yytype_int16 yypgoto[] =
2466 {
2467     -461,  -461,  -461,   467,  -461,  -461,  -461,  -461,  -461,  -461,
2468     -461,  -461,  -461,   407,  -461,   367,  -461,  -461,  -461,    29,
2469     -461,  -461,   386,  -461,  -461,  -461,  -461,  -461,  -461,    -4,
2470     -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,
2471     -461,  -461,  -461,   249,  -461,  -461,   144,  -192,  -461,  -461,
2472      168,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,
2473     -461,  -461,  -461,  -461,  -461,    42,  -461,  -461,  -461,  -461,
2474     -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -167,  -461,
2475     -461,  -461,   -77,  -461,  -461,  -461,  -461,  -461,  -461,  -461,
2476     -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,
2477     -461,  -461,   127,  -461,  -461,  -461,  -461,   319,  -461,  -461,
2478     -461,  -461,  -461,  -461,  -461,  -461,  -461,  -161,  -145,  -156,
2479      189,   190,   192,  -194,  -461,   194,  -461,  -461,  -199,  -461,
2480     -461,  -461,  -398,  -461,  -461,  -461,  -461,  -461,  -461,  -132,
2481     -108,  -460,  -195,  -461,  -461,  -461,  -246,    17,  -384,  -461,
2482     -461,   -86,  -461,  -461,  -461,   266,   180,  -461,  -461,   196,
2483     -285,   -83,    -9,  -461,  -461,   500,  -461,  -461,  -150,  -461,
2484     -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,  -461,
2485     -461,  -461,  -461,    53,  -461,  -461,  -461,  -461,   -42,  -461,
2486     -461,    -8,  -461,  -461,  -461,  -461,  -146,  -160,  -461,  -461,
2487     -461,  -461,  -461,  -461,  -461,  -461,    30,  -461,  -461,   -73,
2488     -461,  -461,  -461,   -93,  -461,  -461,  -461,  -461,  -461,  -461,
2489     -461,  -461,  -461,  -169
2490 };
2491
2492 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
2493    positive, shift that token.  If negative, reduce the rule which
2494    number is the opposite.  If zero, do what YYDEFACT says.
2495    If YYTABLE_NINF, syntax error.  */
2496 #define YYTABLE_NINF -410
2497 static const yytype_int16 yytable[] =
2498 {
2499       11,   296,   246,   350,   255,   296,   219,   211,   357,   358,
2500      121,   227,   441,   442,   239,   270,   233,   236,   210,   232,
2501       13,   216,   220,   222,     1,   440,   226,   359,   380,     5,
2502      279,   533,     5,   101,   237,   238,     6,   545,   625,     9,
2503      451,    20,   260,   261,   262,   263,   264,   265,   234,   300,
2504      214,    20,   546,   307,   208,   312,   534,   242,   626,    17,
2505       18,    19,   465,   360,    14,   467,   468,    16,   281,   640,
2506      641,   642,   643,   644,   645,   646,   647,   122,   278,  -209,
2507      280,   361,    24,  -207,   417,  -395,   211,   362,   240,   490,
2508      547,   421,   491,   101,   423,   169,   170,   210,   356,  -214,
2509      429,   576,  -214,   208,   -52,   319,   208,   -52,   432,   320,
2510       25,   173,   320,   323,   266,   324,   174,   593,   594,  -338,
2511     -338,  -338,   296,  -360,  -179,    28,   328,  -356,  -175,   527,
2512     -352,  -126,  -130,   434,   435,   326,   355,   327,   428,   348,
2513      452,   349,   367,    26,   368,   455,   375,   354,   368,   377,
2514      138,   378,   406,   453,   460,   454,   567,   574,   568,   575,
2515      648,    29,   607,   466,   608,   634,    30,   635,   394,    31,
2516      395,   396,   397,   398,   399,   706,   400,   707,   663,   664,
2517      403,   404,   260,   261,   262,   263,   264,   265,   681,   664,
2518       33,    34,    36,    39,    40,   118,   119,   123,   259,   -91,
2519      132,   140,  -135,   141,   142,   143,   147,   163,   428,   144,
2520      511,   146,   145,   515,   148,   149,   150,   151,   194,   161,
2521      195,   164,   165,   193,   197,   166,   167,   655,   656,   201,
2522      199,   206,   203,   205,   494,   207,   204,   168,   163,   229,
2523      437,   438,   212,   230,   311,   169,   170,   171,   172,   315,
2524      244,   221,   164,   241,   248,   256,   166,   167,   252,   254,
2525     -212,   173,   247,   271,   566,   481,   174,   249,   168,   175,
2526      231,   275,   266,   251,   253,   283,   169,   170,   171,   172,
2527      176,   258,   214,   285,   288,   274,   290,   177,   178,  -220,
2528      291,   292,   173,   179,   180,   293,   294,   174,   301,   603,
2529      175,   305,   313,   314,   316,   181,   321,   318,   570,   351,
2530      371,   176,   352,   353,   369,   370,   525,   372,   373,   178,
2531      376,   379,   381,   383,   179,   180,   385,   384,   402,   390,
2532      412,   401,   392,   407,   408,   414,   181,   418,   425,   430,
2533      433,   439,   444,   447,   448,   456,   461,   457,   458,   616,
2534      459,    73,   462,   464,   469,    74,    75,   477,   475,   480,
2535      482,   484,   485,   495,   486,    76,   616,   488,   497,   311,
2536      493,   639,   674,    77,    78,   498,   512,   499,   500,   -54,
2537      509,   503,   658,   504,   518,    79,   510,   684,   508,   616,
2538      521,   523,  -409,   604,    80,    81,    82,   549,   558,   528,
2539      556,   584,   564,    83,    84,   530,   671,    85,    86,   532,
2540       87,    88,    89,   623,   573,   531,   639,    90,   540,   543,
2541      544,   561,   571,   585,   572,   711,   580,   590,   577,   578,
2542      597,   612,   599,   619,   595,    91,    92,    93,   592,   605,
2543      654,    94,    95,   628,   610,   611,   329,   609,   657,   662,
2544      617,   672,   687,   688,   702,   696,   694,   698,   710,   618,
2545      330,   702,  -161,   652,   331,   332,   661,   670,   492,   673,
2546        7,   678,   677,   120,   680,   679,   333,   501,   683,   689,
2547      691,   700,   284,   133,   334,   335,   336,   337,   311,   139,
2548      516,   517,   391,   405,   520,   676,   474,    73,   591,   419,
2549      338,    74,    75,   660,   633,   339,   705,   387,   340,   243,
2550      388,    76,   541,   389,   514,   622,   620,   306,   682,    77,
2551       78,   393,    27,   550,   489,   -53,   583,   341,   555,   686,
2552      692,    79,   342,   343,   557,   632,   524,   659,   709,     0,
2553       80,    81,    82,     0,   569,     0,     0,     0,   416,    83,
2554       84,     0,     0,    85,    86,     0,    87,    88,    89,   550,
2555        0,     0,   587,    90,     0,     0,    41,    42,     0,     0,
2556        0,     0,     0,     0,   422,     0,    43,     0,     0,     0,
2557       44,    91,    92,    93,    45,    46,     0,    94,    95,     0,
2558        0,     0,     0,     0,     0,     0,    47,     0,     0,   587,
2559        0,     0,     0,     0,     0,    48,    49,    50,     0,     0,
2560       51,     0,     0,     0,    52,    53,     0,     0,    54,    55,
2561        0,    56,    57,    58,     0,     0,     0,     0,    59,     0,
2562        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2563        0,     0,     0,     0,     0,     0,    60,    61,    62,     0,
2564        0,     0,    63,    64,     0,     0,     0,     0,     0,     0,
2565        0,     0,     0,     0,   685
2566 };
2567
2568 static const yytype_int16 yycheck[] =
2569 {
2570        9,   247,   194,   288,   203,   251,   167,   163,   293,   294,
2571       33,   172,   410,   411,    16,   209,    65,   178,   163,   175,
2572       25,   166,   167,   168,     5,   409,   171,    14,   313,     0,
2573      224,    34,     3,    37,   179,   180,     0,    17,    51,    97,
2574      424,    12,     7,     8,     9,    10,    11,    12,    97,   248,
2575       97,    22,    32,   252,   101,   254,    59,     5,    71,     5,
2576        6,     7,   446,    50,    69,   449,   450,    98,   229,     6,
2577        7,     8,     9,    10,    11,    12,    13,   100,   223,    97,
2578      225,    68,     4,   101,   369,    15,   242,    74,    90,   473,
2579       70,   376,   476,    97,   379,    43,    44,   242,   292,    97,
2580      385,   561,    97,   101,   105,   102,   101,   105,   102,   106,
2581      101,    59,   106,    98,    79,   100,    64,   577,   578,     5,
2582        6,     7,   368,    53,    54,    18,   282,    57,    58,   513,
2583       60,    61,    62,     7,     8,    98,   292,   100,   384,    98,
2584      425,   100,    98,   105,   100,   430,    98,   292,   100,    98,
2585      121,   100,   351,    98,   439,   100,    98,    98,   100,   100,
2586       97,     7,    98,   448,   100,    98,     6,   100,   329,    31,
2587      331,   332,   333,   334,   335,    98,   337,   100,     6,     7,
2588      341,   342,     7,     8,     9,    10,    11,    12,     6,     7,
2589      102,   101,    39,     7,    99,   102,    99,    98,   207,     4,
2590       29,    61,    87,    62,    58,    54,    15,     5,   454,    60,
2591      495,    53,    57,   498,    48,    59,    87,     4,    84,    36,
2592       63,    19,    20,    80,    82,    23,    24,   625,   626,    56,
2593       63,     4,    80,    29,   480,    30,    75,    35,     5,    36,
2594      401,   402,    97,    81,   253,    43,    44,    45,    46,   258,
2595        6,   101,    19,   105,    80,    13,    23,    24,    80,    80,
2596      101,    59,    97,     6,   549,   464,    64,    97,    35,    67,
2597      101,     6,    79,    97,    97,     5,    43,    44,    45,    46,
2598       78,    97,    97,     6,    28,    98,     7,    85,    86,   101,
2599        7,     5,    59,    91,    92,    27,    89,    64,     6,   584,
2600       67,    47,    27,    80,    94,   103,     3,   101,   554,    80,
2601       98,    78,   104,   104,    27,   101,   508,   100,    13,    86,
2602       27,    27,     6,    98,    91,    92,    27,    97,    81,   101,
2603       72,    36,   101,    37,    37,     6,   103,     7,    27,    76,
2604        7,    27,    73,   102,    66,     4,     4,   102,   102,   595,
2605      102,     1,    97,    80,    52,     5,     6,    97,     7,    97,
2606        4,     4,     4,    27,     5,    15,   612,     4,    97,   378,
2607       98,   617,   657,    23,    24,    21,    42,    97,    97,    29,
2608       98,    97,   628,    83,    49,    35,    98,   672,    84,   635,
2609        5,     4,    40,   585,    44,    45,    46,    27,     6,    98,
2610       40,    27,    41,    53,    54,    98,   652,    57,    58,    97,
2611       60,    61,    62,   605,   101,    98,   662,    67,    98,    97,
2612       97,    97,    97,    84,    98,   710,    88,     7,    97,    97,
2613       26,    38,    77,     4,    97,    85,    86,    87,    98,    96,
2614        4,    91,    92,    95,    98,    98,     5,   102,    27,   100,
2615       97,    27,     7,     6,   700,     6,    14,    22,    27,    97,
2616       19,   707,    98,    97,    23,    24,    98,    98,   477,    97,
2617        3,    98,   101,    66,    98,   100,    35,   486,    98,    98,
2618      102,    97,   233,    97,    43,    44,    45,    46,   497,   122,
2619      499,   500,   324,   349,   503,   662,   454,     1,   575,   372,
2620       59,     5,     6,   635,   612,    64,   701,   318,    67,   190,
2621      320,    15,   521,   321,   497,   601,   599,   251,   668,    23,
2622       24,   327,    22,   532,   471,    29,   568,    86,   536,   675,
2623      690,    35,    91,    92,   543,   608,   506,   630,   707,    -1,
2624       44,    45,    46,    -1,   553,    -1,    -1,    -1,   368,    53,
2625       54,    -1,    -1,    57,    58,    -1,    60,    61,    62,   568,
2626       -1,    -1,   571,    67,    -1,    -1,     5,     6,    -1,    -1,
2627       -1,    -1,    -1,    -1,   378,    -1,    15,    -1,    -1,    -1,
2628       19,    85,    86,    87,    23,    24,    -1,    91,    92,    -1,
2629       -1,    -1,    -1,    -1,    -1,    -1,    35,    -1,    -1,   608,
2630       -1,    -1,    -1,    -1,    -1,    44,    45,    46,    -1,    -1,
2631       49,    -1,    -1,    -1,    53,    54,    -1,    -1,    57,    58,
2632       -1,    60,    61,    62,    -1,    -1,    -1,    -1,    67,    -1,
2633       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2634       -1,    -1,    -1,    -1,    -1,    -1,    85,    86,    87,    -1,
2635       -1,    -1,    91,    92,    -1,    -1,    -1,    -1,    -1,    -1,
2636       -1,    -1,    -1,    -1,   673
2637 };
2638
2639 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2640    symbol of state STATE-NUM.  */
2641 static const yytype_uint16 yystos[] =
2642 {
2643        0,     5,   108,   109,   110,   126,     0,   110,   111,    97,
2644      112,   269,   270,    25,    69,   113,    98,     5,     6,     7,
2645      126,   136,   271,   272,     4,   101,   105,   272,    18,     7,
2646        6,    31,   116,   102,   101,   117,    39,   114,   115,     7,
2647       99,     5,     6,    15,    19,    23,    24,    35,    44,    45,
2648       46,    49,    53,    54,    57,    58,    60,    61,    62,    67,
2649       85,    86,    87,    91,    92,   118,   119,   120,   121,   122,
2650      123,   124,   125,     1,     5,     6,    15,    23,    24,    35,
2651       44,    45,    46,    53,    54,    57,    58,    60,    61,    62,
2652       67,    85,    86,    87,    91,    92,   127,   128,   129,   130,
2653      133,   136,   137,   139,   141,   142,   143,   144,   145,   159,
2654      163,   167,   193,   197,   276,   280,   284,   307,   102,    99,
2655      120,    33,   100,    98,   160,   164,   194,   198,   277,   281,
2656      285,   308,    29,   129,   131,   138,   168,   140,   126,   122,
2657       61,    62,    58,    54,    60,    57,    53,    15,    48,    59,
2658       87,     4,   161,   165,   195,   199,   278,   282,   286,   309,
2659      132,    36,   169,     5,    19,    20,    23,    24,    35,    43,
2660       44,    45,    46,    59,    64,    67,    78,    85,    86,    91,
2661       92,   103,   126,   134,   146,   149,   150,   151,   154,   210,
2662      211,   214,   222,    80,    84,    63,   260,    82,   206,    63,
2663      261,    56,   264,    80,    75,    29,     4,    30,   101,   218,
2664      225,   226,    97,   135,    97,   224,   225,   226,   230,   224,
2665      225,   101,   225,   215,   216,   217,   225,   224,   225,    36,
2666       81,   101,   226,    65,    97,   147,   224,   225,   225,    16,
2667       90,   105,     5,   214,     6,   235,   154,    97,    80,    97,
2668      200,    97,    80,    97,    80,   235,    13,   267,    97,   269,
2669        7,     8,     9,    10,    11,    12,    79,   227,   228,   229,
2670      230,     6,   156,   157,    98,     6,   231,   232,   225,   230,
2671      225,   224,   219,     5,   150,     6,   152,   153,    28,   237,
2672        7,     7,     5,    27,    89,   238,   253,   262,   263,   269,
2673      235,     6,   207,   208,   209,    47,   262,   235,   254,   265,
2674      266,   269,   235,    27,    80,   269,    94,   170,   101,   102,
2675      106,     3,   158,    98,   100,   233,    98,   100,   226,     5,
2676       19,    23,    24,    35,    43,    44,    45,    46,    59,    64,
2677       67,    86,    91,    92,   155,   212,   221,   223,    98,   100,
2678      267,    80,   104,   104,   225,   226,   230,   267,   267,    14,
2679       50,    68,    74,   174,   175,   176,   190,    98,   100,    27,
2680      101,    98,   100,    13,   268,    98,    27,    98,   100,    27,
2681      267,     6,   236,    98,    97,    27,   173,   227,   228,   229,
2682      101,   157,   101,   232,   224,   224,   224,   224,   224,   224,
2683      224,    36,    81,   224,   224,   153,   235,    37,    37,   162,
2684      192,   191,    72,   177,     6,   239,   263,   267,     7,   209,
2685      201,   267,   266,   267,   287,    27,   171,   172,   253,   267,
2686       76,   255,   102,     7,     7,     8,   234,   224,   224,    27,
2687      255,   239,   239,   178,    73,   179,   196,   102,    66,   279,
2688      283,   255,   267,    98,   100,   267,     4,   102,   102,   102,
2689      267,     4,    97,   180,    80,   255,   267,   255,   255,    52,
2690      288,   289,   290,   310,   172,     7,   148,    97,   248,   253,
2691       97,   235,     4,   202,     4,     4,     5,   292,     4,   290,
2692      255,   255,   269,    98,   253,    27,   166,    97,    21,    97,
2693       97,   269,   291,    97,    83,   311,   312,   313,    84,    98,
2694       98,   267,    42,   186,   254,   267,   269,   269,    49,   293,
2695      269,     5,   317,     4,   313,   154,   187,   255,    98,   203,
2696       98,    98,    97,    34,    59,   296,   297,   298,   299,   301,
2697       98,   269,   314,    97,    97,    17,    32,    70,   240,    27,
2698      269,   294,   295,   300,   302,   298,    40,   269,     6,   188,
2699      189,    97,   242,   241,    41,   243,   267,    98,   100,   269,
2700      253,    97,    98,   101,    98,   100,   248,    97,    97,   244,
2701       88,   181,   204,   295,    27,    84,   303,   269,   315,   316,
2702        7,   189,    98,   248,   248,    97,   182,    26,   249,    77,
2703      256,   257,   258,   267,   154,    96,   304,    98,   100,   102,
2704       98,    98,    38,   245,   246,   247,   253,    97,    97,     4,
2705      268,   205,   258,   154,   305,    51,    71,   306,    95,   318,
2706      319,   320,   316,   247,    98,   100,   183,   184,   185,   253,
2707        6,     7,     8,     9,    10,    11,    12,    13,    97,   213,
2708      220,   250,    97,   259,     4,   239,   239,    27,   253,   320,
2709      246,    98,   100,     6,     7,   251,   252,   273,   274,   275,
2710       98,   253,    27,    97,   267,   321,   185,   101,    98,   100,
2711       98,     6,   275,    98,   267,   269,   303,     7,     6,    98,
2712      322,   102,   304,   323,    14,   326,     6,   327,    22,   328,
2713       97,   324,   253,   329,   330,   249,    98,   100,   325,   330,
2714       27,   267
2715 };
2716
2717 #define yyerrok         (yyerrstatus = 0)
2718 #define yyclearin       (yychar = YYEMPTY)
2719 #define YYEMPTY         (-2)
2720 #define YYEOF           0
2721
2722 #define YYACCEPT        goto yyacceptlab
2723 #define YYABORT         goto yyabortlab
2724 #define YYERROR         goto yyerrorlab
2725
2726
2727 /* Like YYERROR except do call yyerror.  This remains here temporarily
2728    to ease the transition to the new meaning of YYERROR, for GCC.
2729    Once GCC version 2 has supplanted version 1, this can go.  */
2730
2731 #define YYFAIL          goto yyerrlab
2732
2733 #define YYRECOVERING()  (!!yyerrstatus)
2734
2735 #define YYBACKUP(Token, Value)                                  \
2736 do                                                              \
2737   if (yychar == YYEMPTY && yylen == 1)                          \
2738     {                                                           \
2739       yychar = (Token);                                         \
2740       yylval = (Value);                                         \
2741       yytoken = YYTRANSLATE (yychar);                           \
2742       YYPOPSTACK (1);                                           \
2743       goto yybackup;                                            \
2744     }                                                           \
2745   else                                                          \
2746     {                                                           \
2747       yyerror (YY_("syntax error: cannot back up")); \
2748       YYERROR;                                                  \
2749     }                                                           \
2750 while (YYID (0))
2751
2752
2753 #define YYTERROR        1
2754 #define YYERRCODE       256
2755
2756
2757 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2758    If N is 0, then set CURRENT to the empty location which ends
2759    the previous symbol: RHS[0] (always defined).  */
2760
2761 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2762 #ifndef YYLLOC_DEFAULT
2763 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
2764     do                                                                  \
2765       if (YYID (N))                                                    \
2766         {                                                               \
2767           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
2768           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
2769           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
2770           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
2771         }                                                               \
2772       else                                                              \
2773         {                                                               \
2774           (Current).first_line   = (Current).last_line   =              \
2775             YYRHSLOC (Rhs, 0).last_line;                                \
2776           (Current).first_column = (Current).last_column =              \
2777             YYRHSLOC (Rhs, 0).last_column;                              \
2778         }                                                               \
2779     while (YYID (0))
2780 #endif
2781
2782
2783 /* YY_LOCATION_PRINT -- Print the location on the stream.
2784    This macro was not mandated originally: define only if we know
2785    we won't break user code: when these are the locations we know.  */
2786
2787 #ifndef YY_LOCATION_PRINT
2788 # if YYLTYPE_IS_TRIVIAL
2789 #  define YY_LOCATION_PRINT(File, Loc)                  \
2790      fprintf (File, "%d.%d-%d.%d",                      \
2791               (Loc).first_line, (Loc).first_column,     \
2792               (Loc).last_line,  (Loc).last_column)
2793 # else
2794 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2795 # endif
2796 #endif
2797
2798
2799 /* YYLEX -- calling `yylex' with the right arguments.  */
2800
2801 #ifdef YYLEX_PARAM
2802 # define YYLEX yylex (&yylval, YYLEX_PARAM)
2803 #else
2804 # define YYLEX yylex (&yylval)
2805 #endif
2806
2807 /* Enable debugging if requested.  */
2808 #if YYDEBUG
2809
2810 # ifndef YYFPRINTF
2811 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2812 #  define YYFPRINTF fprintf
2813 # endif
2814
2815 # define YYDPRINTF(Args)                        \
2816 do {                                            \
2817   if (yydebug)                                  \
2818     YYFPRINTF Args;                             \
2819 } while (YYID (0))
2820
2821 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
2822 do {                                                                      \
2823   if (yydebug)                                                            \
2824     {                                                                     \
2825       YYFPRINTF (stderr, "%s ", Title);                                   \
2826       yy_symbol_print (stderr,                                            \
2827                   Type, Value); \
2828       YYFPRINTF (stderr, "\n");                                           \
2829     }                                                                     \
2830 } while (YYID (0))
2831
2832
2833 /*--------------------------------.
2834 | Print this symbol on YYOUTPUT.  |
2835 `--------------------------------*/
2836
2837 /*ARGSUSED*/
2838 #if (defined __STDC__ || defined __C99__FUNC__ \
2839      || defined __cplusplus || defined _MSC_VER)
2840 static void
2841 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2842 #else
2843 static void
2844 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2845     FILE *yyoutput;
2846     int yytype;
2847     YYSTYPE const * const yyvaluep;
2848 #endif
2849 {
2850   if (!yyvaluep)
2851     return;
2852 # ifdef YYPRINT
2853   if (yytype < YYNTOKENS)
2854     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2855 # else
2856   YYUSE (yyoutput);
2857 # endif
2858   switch (yytype)
2859     {
2860       default:
2861         break;
2862     }
2863 }
2864
2865
2866 /*--------------------------------.
2867 | Print this symbol on YYOUTPUT.  |
2868 `--------------------------------*/
2869
2870 #if (defined __STDC__ || defined __C99__FUNC__ \
2871      || defined __cplusplus || defined _MSC_VER)
2872 static void
2873 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2874 #else
2875 static void
2876 yy_symbol_print (yyoutput, yytype, yyvaluep)
2877     FILE *yyoutput;
2878     int yytype;
2879     YYSTYPE const * const yyvaluep;
2880 #endif
2881 {
2882   if (yytype < YYNTOKENS)
2883     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2884   else
2885     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2886
2887   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2888   YYFPRINTF (yyoutput, ")");
2889 }
2890
2891 /*------------------------------------------------------------------.
2892 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2893 | TOP (included).                                                   |
2894 `------------------------------------------------------------------*/
2895
2896 #if (defined __STDC__ || defined __C99__FUNC__ \
2897      || defined __cplusplus || defined _MSC_VER)
2898 static void
2899 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2900 #else
2901 static void
2902 yy_stack_print (bottom, top)
2903     yytype_int16 *bottom;
2904     yytype_int16 *top;
2905 #endif
2906 {
2907   YYFPRINTF (stderr, "Stack now");
2908   for (; bottom <= top; ++bottom)
2909     YYFPRINTF (stderr, " %d", *bottom);
2910   YYFPRINTF (stderr, "\n");
2911 }
2912
2913 # define YY_STACK_PRINT(Bottom, Top)                            \
2914 do {                                                            \
2915   if (yydebug)                                                  \
2916     yy_stack_print ((Bottom), (Top));                           \
2917 } while (YYID (0))
2918
2919
2920 /*------------------------------------------------.
2921 | Report that the YYRULE is going to be reduced.  |
2922 `------------------------------------------------*/
2923
2924 #if (defined __STDC__ || defined __C99__FUNC__ \
2925      || defined __cplusplus || defined _MSC_VER)
2926 static void
2927 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2928 #else
2929 static void
2930 yy_reduce_print (yyvsp, yyrule)
2931     YYSTYPE *yyvsp;
2932     int yyrule;
2933 #endif
2934 {
2935   int yynrhs = yyr2[yyrule];
2936   int yyi;
2937   unsigned long int yylno = yyrline[yyrule];
2938   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2939              yyrule - 1, yylno);
2940   /* The symbols being reduced.  */
2941   for (yyi = 0; yyi < yynrhs; yyi++)
2942     {
2943       fprintf (stderr, "   $%d = ", yyi + 1);
2944       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2945                        &(yyvsp[(yyi + 1) - (yynrhs)])
2946                                        );
2947       fprintf (stderr, "\n");
2948     }
2949 }
2950
2951 # define YY_REDUCE_PRINT(Rule)          \
2952 do {                                    \
2953   if (yydebug)                          \
2954     yy_reduce_print (yyvsp, Rule); \
2955 } while (YYID (0))
2956
2957 /* Nonzero means print parse trace.  It is left uninitialized so that
2958    multiple parsers can coexist.  */
2959 int yydebug;
2960 #else /* !YYDEBUG */
2961 # define YYDPRINTF(Args)
2962 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2963 # define YY_STACK_PRINT(Bottom, Top)
2964 # define YY_REDUCE_PRINT(Rule)
2965 #endif /* !YYDEBUG */
2966
2967
2968 /* YYINITDEPTH -- initial size of the parser's stacks.  */
2969 #ifndef YYINITDEPTH
2970 # define YYINITDEPTH 200
2971 #endif
2972
2973 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2974    if the built-in stack extension method is used).
2975
2976    Do not make this value too large; the results are undefined if
2977    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2978    evaluated with infinite-precision integer arithmetic.  */
2979
2980 #ifndef YYMAXDEPTH
2981 # define YYMAXDEPTH 10000
2982 #endif
2983
2984 \f
2985
2986 #if YYERROR_VERBOSE
2987
2988 # ifndef yystrlen
2989 #  if defined __GLIBC__ && defined _STRING_H
2990 #   define yystrlen strlen
2991 #  else
2992 /* Return the length of YYSTR.  */
2993 #if (defined __STDC__ || defined __C99__FUNC__ \
2994      || defined __cplusplus || defined _MSC_VER)
2995 static YYSIZE_T
2996 yystrlen (const char *yystr)
2997 #else
2998 static YYSIZE_T
2999 yystrlen (yystr)
3000     const char *yystr;
3001 #endif
3002 {
3003   YYSIZE_T yylen;
3004   for (yylen = 0; yystr[yylen]; yylen++)
3005     continue;
3006   return yylen;
3007 }
3008 #  endif
3009 # endif
3010
3011 # ifndef yystpcpy
3012 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3013 #   define yystpcpy stpcpy
3014 #  else
3015 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3016    YYDEST.  */
3017 #if (defined __STDC__ || defined __C99__FUNC__ \
3018      || defined __cplusplus || defined _MSC_VER)
3019 static char *
3020 yystpcpy (char *yydest, const char *yysrc)
3021 #else
3022 static char *
3023 yystpcpy (yydest, yysrc)
3024     char *yydest;
3025     const char *yysrc;
3026 #endif
3027 {
3028   char *yyd = yydest;
3029   const char *yys = yysrc;
3030
3031   while ((*yyd++ = *yys++) != '\0')
3032     continue;
3033
3034   return yyd - 1;
3035 }
3036 #  endif
3037 # endif
3038
3039 # ifndef yytnamerr
3040 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3041    quotes and backslashes, so that it's suitable for yyerror.  The
3042    heuristic is that double-quoting is unnecessary unless the string
3043    contains an apostrophe, a comma, or backslash (other than
3044    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
3045    null, do not copy; instead, return the length of what the result
3046    would have been.  */
3047 static YYSIZE_T
3048 yytnamerr (char *yyres, const char *yystr)
3049 {
3050   if (*yystr == '"')
3051     {
3052       YYSIZE_T yyn = 0;
3053       char const *yyp = yystr;
3054
3055       for (;;)
3056         switch (*++yyp)
3057           {
3058           case '\'':
3059           case ',':
3060             goto do_not_strip_quotes;
3061
3062           case '\\':
3063             if (*++yyp != '\\')
3064               goto do_not_strip_quotes;
3065             /* Fall through.  */
3066           default:
3067             if (yyres)
3068               yyres[yyn] = *yyp;
3069             yyn++;
3070             break;
3071
3072           case '"':
3073             if (yyres)
3074               yyres[yyn] = '\0';
3075             return yyn;
3076           }
3077     do_not_strip_quotes: ;
3078     }
3079
3080   if (! yyres)
3081     return yystrlen (yystr);
3082
3083   return yystpcpy (yyres, yystr) - yyres;
3084 }
3085 # endif
3086
3087 /* Copy into YYRESULT an error message about the unexpected token
3088    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
3089    including the terminating null byte.  If YYRESULT is null, do not
3090    copy anything; just return the number of bytes that would be
3091    copied.  As a special case, return 0 if an ordinary "syntax error"
3092    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
3093    size calculation.  */
3094 static YYSIZE_T
3095 yysyntax_error (char *yyresult, int yystate, int yychar)
3096 {
3097   int yyn = yypact[yystate];
3098
3099   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3100     return 0;
3101   else
3102     {
3103       int yytype = YYTRANSLATE (yychar);
3104       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3105       YYSIZE_T yysize = yysize0;
3106       YYSIZE_T yysize1;
3107       int yysize_overflow = 0;
3108       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3109       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3110       int yyx;
3111
3112 # if 0
3113       /* This is so xgettext sees the translatable formats that are
3114          constructed on the fly.  */
3115       YY_("syntax error, unexpected %s");
3116       YY_("syntax error, unexpected %s, expecting %s");
3117       YY_("syntax error, unexpected %s, expecting %s or %s");
3118       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3119       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3120 # endif
3121       char *yyfmt;
3122       char const *yyf;
3123       static char const yyunexpected[] = "syntax error, unexpected %s";
3124       static char const yyexpecting[] = ", expecting %s";
3125       static char const yyor[] = " or %s";
3126       char yyformat[sizeof yyunexpected
3127                     + sizeof yyexpecting - 1
3128                     + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3129                        * (sizeof yyor - 1))];
3130       char const *yyprefix = yyexpecting;
3131
3132       /* Start YYX at -YYN if negative to avoid negative indexes in
3133          YYCHECK.  */
3134       int yyxbegin = yyn < 0 ? -yyn : 0;
3135
3136       /* Stay within bounds of both yycheck and yytname.  */
3137       int yychecklim = YYLAST - yyn + 1;
3138       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3139       int yycount = 1;
3140
3141       yyarg[0] = yytname[yytype];
3142       yyfmt = yystpcpy (yyformat, yyunexpected);
3143
3144       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3145         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3146           {
3147             if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3148               {
3149                 yycount = 1;
3150                 yysize = yysize0;
3151                 yyformat[sizeof yyunexpected - 1] = '\0';
3152                 break;
3153               }
3154             yyarg[yycount++] = yytname[yyx];
3155             yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3156             yysize_overflow |= (yysize1 < yysize);
3157             yysize = yysize1;
3158             yyfmt = yystpcpy (yyfmt, yyprefix);
3159             yyprefix = yyor;
3160           }
3161
3162       yyf = YY_(yyformat);
3163       yysize1 = yysize + yystrlen (yyf);
3164       yysize_overflow |= (yysize1 < yysize);
3165       yysize = yysize1;
3166
3167       if (yysize_overflow)
3168         return YYSIZE_MAXIMUM;
3169
3170       if (yyresult)
3171         {
3172           /* Avoid sprintf, as that infringes on the user's name space.
3173              Don't have undefined behavior even if the translation
3174              produced a string with the wrong number of "%s"s.  */
3175           char *yyp = yyresult;
3176           int yyi = 0;
3177           while ((*yyp = *yyf) != '\0')
3178             {
3179               if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3180                 {
3181                   yyp += yytnamerr (yyp, yyarg[yyi++]);
3182                   yyf += 2;
3183                 }
3184               else
3185                 {
3186                   yyp++;
3187                   yyf++;
3188                 }
3189             }
3190         }
3191       return yysize;
3192     }
3193 }
3194 #endif /* YYERROR_VERBOSE */
3195 \f
3196
3197 /*-----------------------------------------------.
3198 | Release the memory associated to this symbol.  |
3199 `-----------------------------------------------*/
3200
3201 /*ARGSUSED*/
3202 #if (defined __STDC__ || defined __C99__FUNC__ \
3203      || defined __cplusplus || defined _MSC_VER)
3204 static void
3205 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3206 #else
3207 static void
3208 yydestruct (yymsg, yytype, yyvaluep)
3209     const char *yymsg;
3210     int yytype;
3211     YYSTYPE *yyvaluep;
3212 #endif
3213 {
3214   YYUSE (yyvaluep);
3215
3216   if (!yymsg)
3217     yymsg = "Deleting";
3218   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3219
3220   switch (yytype)
3221     {
3222
3223       default:
3224         break;
3225     }
3226 }
3227 \f
3228
3229 /* Prevent warnings from -Wmissing-prototypes.  */
3230
3231 #ifdef YYPARSE_PARAM
3232 #if defined __STDC__ || defined __cplusplus
3233 int yyparse (void *YYPARSE_PARAM);
3234 #else
3235 int yyparse ();
3236 #endif
3237 #else /* ! YYPARSE_PARAM */
3238 #if defined __STDC__ || defined __cplusplus
3239 int yyparse (void);
3240 #else
3241 int yyparse ();
3242 #endif
3243 #endif /* ! YYPARSE_PARAM */
3244
3245
3246
3247
3248
3249
3250 /*----------.
3251 | yyparse.  |
3252 `----------*/
3253
3254 #ifdef YYPARSE_PARAM
3255 #if (defined __STDC__ || defined __C99__FUNC__ \
3256      || defined __cplusplus || defined _MSC_VER)
3257 int
3258 yyparse (void *YYPARSE_PARAM)
3259 #else
3260 int
3261 yyparse (YYPARSE_PARAM)
3262     void *YYPARSE_PARAM;
3263 #endif
3264 #else /* ! YYPARSE_PARAM */
3265 #if (defined __STDC__ || defined __C99__FUNC__ \
3266      || defined __cplusplus || defined _MSC_VER)
3267 int
3268 yyparse (void)
3269 #else
3270 int
3271 yyparse ()
3272
3273 #endif
3274 #endif
3275 {
3276   /* The look-ahead symbol.  */
3277 int yychar;
3278
3279 /* The semantic value of the look-ahead symbol.  */
3280 YYSTYPE yylval;
3281
3282 /* Number of syntax errors so far.  */
3283 int yynerrs;
3284
3285   int yystate;
3286   int yyn;
3287   int yyresult;
3288   /* Number of tokens to shift before error messages enabled.  */
3289   int yyerrstatus;
3290   /* Look-ahead token as an internal (translated) token number.  */
3291   int yytoken = 0;
3292 #if YYERROR_VERBOSE
3293   /* Buffer for error messages, and its allocated size.  */
3294   char yymsgbuf[128];
3295   char *yymsg = yymsgbuf;
3296   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3297 #endif
3298
3299   /* Three stacks and their tools:
3300      `yyss': related to states,
3301      `yyvs': related to semantic values,
3302      `yyls': related to locations.
3303
3304      Refer to the stacks thru separate pointers, to allow yyoverflow
3305      to reallocate them elsewhere.  */
3306
3307   /* The state stack.  */
3308   yytype_int16 yyssa[YYINITDEPTH];
3309   yytype_int16 *yyss = yyssa;
3310   yytype_int16 *yyssp;
3311
3312   /* The semantic value stack.  */
3313   YYSTYPE yyvsa[YYINITDEPTH];
3314   YYSTYPE *yyvs = yyvsa;
3315   YYSTYPE *yyvsp;
3316
3317
3318
3319 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
3320
3321   YYSIZE_T yystacksize = YYINITDEPTH;
3322
3323   /* The variables used to return semantic value and location from the
3324      action routines.  */
3325   YYSTYPE yyval;
3326
3327
3328   /* The number of symbols on the RHS of the reduced rule.
3329      Keep to zero when no symbol should be popped.  */
3330   int yylen = 0;
3331
3332   YYDPRINTF ((stderr, "Starting parse\n"));
3333
3334   yystate = 0;
3335   yyerrstatus = 0;
3336   yynerrs = 0;
3337   yychar = YYEMPTY;             /* Cause a token to be read.  */
3338
3339   /* Initialize stack pointers.
3340      Waste one element of value and location stack
3341      so that they stay on the same level as the state stack.
3342      The wasted elements are never initialized.  */
3343
3344   yyssp = yyss;
3345   yyvsp = yyvs;
3346
3347   goto yysetstate;
3348
3349 /*------------------------------------------------------------.
3350 | yynewstate -- Push a new state, which is found in yystate.  |
3351 `------------------------------------------------------------*/
3352  yynewstate:
3353   /* In all cases, when you get here, the value and location stacks
3354      have just been pushed.  So pushing a state here evens the stacks.  */
3355   yyssp++;
3356
3357  yysetstate:
3358   *yyssp = yystate;
3359
3360   if (yyss + yystacksize - 1 <= yyssp)
3361     {
3362       /* Get the current used size of the three stacks, in elements.  */
3363       YYSIZE_T yysize = yyssp - yyss + 1;
3364
3365 #ifdef yyoverflow
3366       {
3367         /* Give user a chance to reallocate the stack.  Use copies of
3368            these so that the &'s don't force the real ones into
3369            memory.  */
3370         YYSTYPE *yyvs1 = yyvs;
3371         yytype_int16 *yyss1 = yyss;
3372
3373
3374         /* Each stack pointer address is followed by the size of the
3375            data in use in that stack, in bytes.  This used to be a
3376            conditional around just the two extra args, but that might
3377            be undefined if yyoverflow is a macro.  */
3378         yyoverflow (YY_("memory exhausted"),
3379                     &yyss1, yysize * sizeof (*yyssp),
3380                     &yyvs1, yysize * sizeof (*yyvsp),
3381
3382                     &yystacksize);
3383
3384         yyss = yyss1;
3385         yyvs = yyvs1;
3386       }
3387 #else /* no yyoverflow */
3388 # ifndef YYSTACK_RELOCATE
3389       goto yyexhaustedlab;
3390 # else
3391       /* Extend the stack our own way.  */
3392       if (YYMAXDEPTH <= yystacksize)
3393         goto yyexhaustedlab;
3394       yystacksize *= 2;
3395       if (YYMAXDEPTH < yystacksize)
3396         yystacksize = YYMAXDEPTH;
3397
3398       {
3399         yytype_int16 *yyss1 = yyss;
3400         union yyalloc *yyptr =
3401           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3402         if (! yyptr)
3403           goto yyexhaustedlab;
3404         YYSTACK_RELOCATE (yyss);
3405         YYSTACK_RELOCATE (yyvs);
3406
3407 #  undef YYSTACK_RELOCATE
3408         if (yyss1 != yyssa)
3409           YYSTACK_FREE (yyss1);
3410       }
3411 # endif
3412 #endif /* no yyoverflow */
3413
3414       yyssp = yyss + yysize - 1;
3415       yyvsp = yyvs + yysize - 1;
3416
3417
3418       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3419                   (unsigned long int) yystacksize));
3420
3421       if (yyss + yystacksize - 1 <= yyssp)
3422         YYABORT;
3423     }
3424
3425   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3426
3427   goto yybackup;
3428
3429 /*-----------.
3430 | yybackup.  |
3431 `-----------*/
3432 yybackup:
3433
3434   /* Do appropriate processing given the current state.  Read a
3435      look-ahead token if we need one and don't already have one.  */
3436
3437   /* First try to decide what to do without reference to look-ahead token.  */
3438   yyn = yypact[yystate];
3439   if (yyn == YYPACT_NINF)
3440     goto yydefault;
3441
3442   /* Not known => get a look-ahead token if don't already have one.  */
3443
3444   /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
3445   if (yychar == YYEMPTY)
3446     {
3447       YYDPRINTF ((stderr, "Reading a token: "));
3448       yychar = YYLEX;
3449     }
3450
3451   if (yychar <= YYEOF)
3452     {
3453       yychar = yytoken = YYEOF;
3454       YYDPRINTF ((stderr, "Now at end of input.\n"));
3455     }
3456   else
3457     {
3458       yytoken = YYTRANSLATE (yychar);
3459       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3460     }
3461
3462   /* If the proper action on seeing token YYTOKEN is to reduce or to
3463      detect an error, take that action.  */
3464   yyn += yytoken;
3465   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3466     goto yydefault;
3467   yyn = yytable[yyn];
3468   if (yyn <= 0)
3469     {
3470       if (yyn == 0 || yyn == YYTABLE_NINF)
3471         goto yyerrlab;
3472       yyn = -yyn;
3473       goto yyreduce;
3474     }
3475
3476   if (yyn == YYFINAL)
3477     YYACCEPT;
3478
3479   /* Count tokens shifted since error; after three, turn off error
3480      status.  */
3481   if (yyerrstatus)
3482     yyerrstatus--;
3483
3484   /* Shift the look-ahead token.  */
3485   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3486
3487   /* Discard the shifted token unless it is eof.  */
3488   if (yychar != YYEOF)
3489     yychar = YYEMPTY;
3490
3491   yystate = yyn;
3492   *++yyvsp = yylval;
3493
3494   goto yynewstate;
3495
3496
3497 /*-----------------------------------------------------------.
3498 | yydefault -- do the default action for the current state.  |
3499 `-----------------------------------------------------------*/
3500 yydefault:
3501   yyn = yydefact[yystate];
3502   if (yyn == 0)
3503     goto yyerrlab;
3504   goto yyreduce;
3505
3506
3507 /*-----------------------------.
3508 | yyreduce -- Do a reduction.  |
3509 `-----------------------------*/
3510 yyreduce:
3511   /* yyn is the number of a rule to reduce with.  */
3512   yylen = yyr2[yyn];
3513
3514   /* If YYLEN is nonzero, implement the default value of the action:
3515      `$$ = $1'.
3516
3517      Otherwise, the following line sets YYVAL to garbage.
3518      This behavior is undocumented and Bison
3519      users should not rely upon it.  Assigning to YYVAL
3520      unconditionally makes the parser a bit smaller, and it avoids a
3521      GCC warning that YYVAL may be used uninitialized.  */
3522   yyval = yyvsp[1-yylen];
3523
3524
3525   YY_REDUCE_PRINT (yyn);
3526   switch (yyn)
3527     {
3528         case 2:
3529 #line 1587 "parser-smi.y"
3530     {
3531         (yyval.err) = 0;
3532     ;}
3533     break;
3534
3535   case 3:
3536 #line 1591 "parser-smi.y"
3537     {
3538         (yyval.err) = 0;
3539     ;}
3540     break;
3541
3542   case 4:
3543 #line 1597 "parser-smi.y"
3544     { (yyval.err) = 0; ;}
3545     break;
3546
3547   case 5:
3548 #line 1599 "parser-smi.y"
3549     { (yyval.err) = 0; ;}
3550     break;
3551
3552   case 6:
3553 #line 1607 "parser-smi.y"
3554     {
3555                             thisParserPtr->firstStatementLine = thisParserPtr->line;
3556                             thisParserPtr->currentDecl = SMI_DECL_MODULE;
3557                             
3558                             thisParserPtr->modulePtr = findModuleByName((yyvsp[(1) - (1)].id));
3559                             if (!thisParserPtr->modulePtr) {
3560                                 thisParserPtr->modulePtr =
3561                                     addModule((yyvsp[(1) - (1)].id),
3562                                               smiStrdup(thisParserPtr->path),
3563                                               0,
3564                                               thisParserPtr);
3565                                 thisParserPtr->modulePtr->
3566                                     numImportedIdentifiers = 0;
3567                                 thisParserPtr->modulePtr->
3568                                     numStatements = 0;
3569                                 thisParserPtr->modulePtr->
3570                                     numModuleIdentities = 0;
3571                                 if (!strcmp((yyvsp[(1) - (1)].id), "SNMPv2-SMI")) {
3572                                     /*
3573                                      * SNMPv2-SMI is an SMIv2 module
3574                                      * that cannot be identified by
3575                                      * importing from SNMPv2-SMI.
3576                                      */
3577                                     thisModulePtr->export.language =
3578                                         SMI_LANGUAGE_SMIV2;
3579                                 }
3580                             } else {
3581                                 smiPrintError(thisParserPtr,
3582                                               ERR_MODULE_ALREADY_LOADED,
3583                                               (yyvsp[(1) - (1)].id));
3584                                 /*
3585                                  * this aborts parsing the whole file,
3586                                  * not only the current module.
3587                                  */
3588                                 YYABORT;
3589                             }
3590                         ;}
3591     break;
3592
3593   case 7:
3594 #line 1651 "parser-smi.y"
3595     {
3596                             if (thisModulePtr->export.language == SMI_LANGUAGE_UNKNOWN)
3597                                 thisModulePtr->export.language = SMI_LANGUAGE_SMIV1;
3598                             checkModuleName(thisParserPtr, thisModulePtr);
3599                             checkModuleIdentity(thisParserPtr, thisModulePtr);
3600                             checkObjects(thisParserPtr, thisModulePtr);
3601                             checkTypes(thisParserPtr, thisModulePtr);
3602                             checkDefvals(thisParserPtr, thisModulePtr);
3603                             checkImportsUsage(thisParserPtr, thisModulePtr);
3604                             smiCheckTypeUsage(thisParserPtr, thisModulePtr);
3605                             
3606                             thisParserPtr->capabilitiesModulePtr = NULL;
3607
3608                             (yyval.err) = 0;
3609                         ;}
3610     break;
3611
3612   case 8:
3613 #line 1669 "parser-smi.y"
3614     { (yyval.err) = 0; ;}
3615     break;
3616
3617   case 9:
3618 #line 1671 "parser-smi.y"
3619     { (yyval.err) = 0; ;}
3620     break;
3621
3622   case 10:
3623 #line 1675 "parser-smi.y"
3624     { ;}
3625     break;
3626
3627   case 11:
3628 #line 1677 "parser-smi.y"
3629     {
3630                             thisModulePtr->export.language = SMI_LANGUAGE_SPPI;
3631                         ;}
3632     break;
3633
3634   case 12:
3635 #line 1686 "parser-smi.y"
3636     { (yyval.err) = 0; ;}
3637     break;
3638
3639   case 13:
3640 #line 1688 "parser-smi.y"
3641     { (yyval.err) = 0; ;}
3642     break;
3643
3644   case 14:
3645 #line 1692 "parser-smi.y"
3646     {
3647                             thisParserPtr->firstStatementLine = thisParserPtr->line;
3648                             thisParserPtr->currentDecl = SMI_DECL_MODULE;
3649
3650                             if ((thisModulePtr->export.language != SMI_LANGUAGE_SMIV2) &&
3651                                 (thisModulePtr->export.language != SMI_LANGUAGE_SPPI))
3652                                 thisModulePtr->export.language = SMI_LANGUAGE_SMIV1;
3653                             
3654                             (yyval.err) = 0;
3655                         ;}
3656     break;
3657
3658   case 15:
3659 #line 1706 "parser-smi.y"
3660     { (yyval.err) = 0; ;}
3661     break;
3662
3663   case 16:
3664 #line 1708 "parser-smi.y"
3665     {
3666                             if (thisParserPtr->modulePtr->export.language ==
3667                                  SMI_LANGUAGE_SPPI)
3668                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "EXPORTS");
3669                             
3670                             thisParserPtr->firstStatementLine = thisParserPtr->line;
3671                             thisParserPtr->currentDecl = SMI_DECL_MODULE;
3672
3673                             if (strcmp(thisParserPtr->modulePtr->export.name,
3674                                        "RFC1155-SMI") &&
3675                                 strcmp(thisParserPtr->modulePtr->export.name,
3676                                        "RFC1065-SMI")) {
3677                                 smiPrintError(thisParserPtr, ERR_EXPORTS);
3678                             }
3679                         ;}
3680     break;
3681
3682   case 17:
3683 #line 1725 "parser-smi.y"
3684     { (yyval.err) = 0; ;}
3685     break;
3686
3687   case 18:
3688 #line 1729 "parser-smi.y"
3689     { (yyval.err) = 0; ;}
3690     break;
3691
3692   case 19:
3693 #line 1731 "parser-smi.y"
3694     { (yyval.err) = 0; ;}
3695     break;
3696
3697   case 20:
3698 #line 1736 "parser-smi.y"
3699     { (yyval.err) = 0; ;}
3700     break;
3701
3702   case 21:
3703 #line 1738 "parser-smi.y"
3704     { (yyval.err) = 0; ;}
3705     break;
3706
3707   case 22:
3708 #line 1744 "parser-smi.y"
3709     {
3710                             Import      *importPtr;
3711                             Module      *modulePtr;
3712                             
3713                             /*
3714                              * Recursively call the parser to suffer
3715                              * the IMPORTS, if the module is not yet
3716                              * loaded.
3717                              */
3718                             modulePtr = findModuleByName((yyvsp[(3) - (3)].id));
3719                             if (!modulePtr) {
3720                                 modulePtr = loadModule((yyvsp[(3) - (3)].id), thisParserPtr);
3721                             }
3722                             checkImports(modulePtr, thisParserPtr);
3723
3724                             if (modulePtr && !strcmp((yyvsp[(3) - (3)].id), "SNMPv2-SMI")) {
3725                                 /*
3726                                  * A module that imports a macro or
3727                                  * type definition from SNMPv2-SMI
3728                                  * seems to be SMIv2 style - but only if
3729                                  * it is not SPPI yet.
3730                                  */
3731                                 if (thisModulePtr->export.language != SMI_LANGUAGE_SPPI) {
3732                                     for (importPtr =
3733                                              thisModulePtr->firstImportPtr;
3734                                          importPtr;
3735                                          importPtr = importPtr->nextPtr) {
3736                                         if ((!strcmp(importPtr->export.module,
3737                                                      (yyvsp[(3) - (3)].id))) &&
3738                                             ((importPtr->kind == KIND_MACRO) ||
3739                                              (importPtr->kind == KIND_TYPE))) {
3740                                             thisModulePtr->export.language =
3741                                                 SMI_LANGUAGE_SMIV2;
3742                                         }
3743                                     }
3744                                 }
3745                             }
3746
3747                             smiFree((yyvsp[(3) - (3)].id));
3748                         ;}
3749     break;
3750
3751   case 23:
3752 #line 1787 "parser-smi.y"
3753     { (yyval.err) = 0; ;}
3754     break;
3755
3756   case 24:
3757 #line 1790 "parser-smi.y"
3758     { (yyval.err) = 0; ;}
3759     break;
3760
3761   case 25:
3762 #line 1797 "parser-smi.y"
3763     {
3764                             addImport((yyvsp[(1) - (1)].id), thisParserPtr);
3765                             thisParserPtr->modulePtr->numImportedIdentifiers++;
3766                             (yyval.id) = 0;
3767                         ;}
3768     break;
3769
3770   case 26:
3771 #line 1803 "parser-smi.y"
3772     {
3773                             addImport((yyvsp[(1) - (1)].id), thisParserPtr);
3774                             thisParserPtr->modulePtr->numImportedIdentifiers++;
3775                             (yyval.id) = 0;
3776                         ;}
3777     break;
3778
3779   case 27:
3780 #line 1809 "parser-smi.y"
3781     {
3782                             addImport(smiStrdup((yyvsp[(1) - (1)].id)), thisParserPtr);
3783                             thisParserPtr->modulePtr->numImportedIdentifiers++;
3784                             (yyval.id) = 0;
3785                         ;}
3786     break;
3787
3788   case 28:
3789 #line 1825 "parser-smi.y"
3790     {
3791                             /*
3792                              * There are PIBs that import e.g. Counter64 - so
3793                              * don't complain here about SMI keywords.
3794                              */
3795                            /* if (thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI)
3796                               smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, $1);*/
3797                             (yyval.id) = (yyvsp[(1) - (1)].id);
3798                         ;}
3799     break;
3800
3801   case 29:
3802 #line 1835 "parser-smi.y"
3803     {
3804                             if (thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)
3805                                 smiPrintError(thisParserPtr, ERR_SPPI_TYPE_IN_MIB, (yyvsp[(1) - (1)].id));
3806                             (yyval.id) = (yyvsp[(1) - (1)].id);
3807                         ;}
3808     break;
3809
3810   case 52:
3811 #line 1869 "parser-smi.y"
3812     {
3813                             checkNameLen(thisParserPtr, (yyvsp[(1) - (1)].id),
3814                                          ERR_MODULENAME_32, ERR_MODULENAME_64);
3815                             (yyval.id) = (yyvsp[(1) - (1)].id);
3816                         ;}
3817     break;
3818
3819   case 53:
3820 #line 1881 "parser-smi.y"
3821     { (yyval.err) = 0; ;}
3822     break;
3823
3824   case 54:
3825 #line 1883 "parser-smi.y"
3826     { (yyval.err) = 0; ;}
3827     break;
3828
3829   case 55:
3830 #line 1888 "parser-smi.y"
3831     { (yyval.err) = 0; ;}
3832     break;
3833
3834   case 56:
3835 #line 1890 "parser-smi.y"
3836     { (yyval.err) = 0; ;}
3837     break;
3838
3839   case 57:
3840 #line 1894 "parser-smi.y"
3841     { 
3842                             thisParserPtr->modulePtr->numStatements++;
3843                             (yyval.err) = 0;
3844                         ;}
3845     break;
3846
3847   case 58:
3848 #line 1899 "parser-smi.y"
3849     { 
3850                             thisParserPtr->modulePtr->numStatements++;
3851                             (yyval.err) = 0;
3852                         ;}
3853     break;
3854
3855   case 59:
3856 #line 1904 "parser-smi.y"
3857     { 
3858                             thisParserPtr->modulePtr->numStatements++;
3859                             (yyval.err) = 0;
3860                         ;}
3861     break;
3862
3863   case 60:
3864 #line 1909 "parser-smi.y"
3865     { 
3866                             thisParserPtr->modulePtr->numStatements++;
3867                             (yyval.err) = 0;
3868                         ;}
3869     break;
3870
3871   case 61:
3872 #line 1914 "parser-smi.y"
3873     { 
3874                             thisParserPtr->modulePtr->numStatements++;
3875                             (yyval.err) = 0;
3876                         ;}
3877     break;
3878
3879   case 62:
3880 #line 1919 "parser-smi.y"
3881     { 
3882                             thisParserPtr->modulePtr->numStatements++;
3883                             (yyval.err) = 0;
3884                         ;}
3885     break;
3886
3887   case 63:
3888 #line 1924 "parser-smi.y"
3889     { 
3890                             thisParserPtr->modulePtr->numStatements++;
3891                             (yyval.err) = 0;
3892                         ;}
3893     break;
3894
3895   case 64:
3896 #line 1929 "parser-smi.y"
3897     { 
3898                             thisParserPtr->modulePtr->numStatements++;
3899                             (yyval.err) = 0;
3900                         ;}
3901     break;
3902
3903   case 65:
3904 #line 1934 "parser-smi.y"
3905     { 
3906                             thisParserPtr->modulePtr->numStatements++;
3907                             (yyval.err) = 0;
3908                         ;}
3909     break;
3910
3911   case 66:
3912 #line 1939 "parser-smi.y"
3913     {
3914                             thisParserPtr->modulePtr->numStatements++;
3915                             (yyval.err) = 0;
3916                         ;}
3917     break;
3918
3919   case 67:
3920 #line 1944 "parser-smi.y"
3921     { 
3922                             thisParserPtr->modulePtr->numStatements++;
3923                             (yyval.err) = 0;
3924                         ;}
3925     break;
3926
3927   case 68:
3928 #line 1949 "parser-smi.y"
3929     { 
3930                             thisParserPtr->modulePtr->numStatements++;
3931                             (yyval.err) = 0;
3932                         ;}
3933     break;
3934
3935   case 69:
3936 #line 1954 "parser-smi.y"
3937     {
3938                             smiPrintError(thisParserPtr,
3939                                           ERR_FLUSH_DECLARATION);
3940                             yyerrok;
3941                             (yyval.err) = 1;
3942                         ;}
3943     break;
3944
3945   case 70:
3946 #line 1968 "parser-smi.y"
3947     {
3948                             Macro *macroPtr;
3949
3950                             thisParserPtr->firstStatementLine = thisParserPtr->line;
3951                             thisParserPtr->currentDecl = SMI_DECL_MACRO;
3952
3953                             macroPtr = addMacro(smiStrdup((yyvsp[(1) - (1)].id)),
3954                                                 0, thisParserPtr);
3955                             setMacroLine(macroPtr, thisParserPtr->firstStatementLine,
3956                                          thisParserPtr);
3957                         ;}
3958     break;
3959
3960   case 71:
3961 #line 1980 "parser-smi.y"
3962     {
3963                             /*
3964                              * ASN.1 macros are known to be in these
3965                              * modules.
3966                              */
3967                             if (strcmp(thisParserPtr->modulePtr->export.name,
3968                                        "SNMPv2-SMI") &&
3969                                 strcmp(thisParserPtr->modulePtr->export.name,
3970                                        "SNMPv2-TC") &&
3971                                 strcmp(thisParserPtr->modulePtr->export.name,
3972                                        "SNMPv2-CONF") &&
3973                                 strcmp(thisParserPtr->modulePtr->export.name,
3974                                        "RFC-1212") &&
3975                                 strcmp(thisParserPtr->modulePtr->export.name,
3976                                        "RFC-1215") &&
3977                                 strcmp(thisParserPtr->modulePtr->export.name,
3978                                        "RFC1065-SMI") &&
3979                                 strcmp(thisParserPtr->modulePtr->export.name,
3980                                        "RFC1155-SMI") &&
3981                                 strcmp(thisParserPtr->modulePtr->export.name,
3982                                        "COPS-PR-SPPI") &&
3983                                 strcmp(thisParserPtr->modulePtr->export.name,
3984                                        "COPS-PR-SPPI-TC")) {
3985                                 smiPrintError(thisParserPtr, ERR_MACRO);
3986                             }
3987                         ;}
3988     break;
3989
3990   case 72:
3991 #line 2008 "parser-smi.y"
3992     {
3993                             (yyval.err) = 0;
3994                         ;}
3995     break;
3996
3997   case 73:
3998 #line 2013 "parser-smi.y"
3999     { (yyval.id) = (yyvsp[(1) - (1)].id); ;}
4000     break;
4001
4002   case 74:
4003 #line 2014 "parser-smi.y"
4004     { (yyval.id) = (yyvsp[(1) - (1)].id); ;}
4005     break;
4006
4007   case 75:
4008 #line 2015 "parser-smi.y"
4009     { (yyval.id) = (yyvsp[(1) - (1)].id); ;}
4010     break;
4011
4012   case 76:
4013 #line 2016 "parser-smi.y"
4014     { (yyval.id) = (yyvsp[(1) - (1)].id); ;}
4015     break;
4016
4017   case 77:
4018 #line 2017 "parser-smi.y"
4019     { (yyval.id) = (yyvsp[(1) - (1)].id); ;}
4020     break;
4021
4022   case 78:
4023 #line 2018 "parser-smi.y"
4024     { (yyval.id) = (yyvsp[(1) - (1)].id); ;}
4025     break;
4026
4027   case 79:
4028 #line 2019 "parser-smi.y"
4029     { (yyval.id) = (yyvsp[(1) - (1)].id); ;}
4030     break;
4031
4032   case 80:
4033 #line 2020 "parser-smi.y"
4034     { (yyval.id) = (yyvsp[(1) - (1)].id); ;}
4035     break;
4036
4037   case 81:
4038 #line 2021 "parser-smi.y"
4039     { (yyval.id) = (yyvsp[(1) - (1)].id); ;}
4040     break;
4041
4042   case 82:
4043 #line 2022 "parser-smi.y"
4044     { (yyval.id) = (yyvsp[(1) - (1)].id); ;}
4045     break;
4046
4047   case 83:
4048 #line 2026 "parser-smi.y"
4049     {
4050                             if (strcmp(thisParserPtr->modulePtr->export.name,
4051                                        "SNMPv2-SMI") &&
4052                                 strcmp(thisParserPtr->modulePtr->export.name,
4053                                        "SNMPv2-TC") &&
4054                                 strcmp(thisParserPtr->modulePtr->export.name,
4055                                        "SNMPv2-CONF") &&
4056                                 strcmp(thisParserPtr->modulePtr->export.name,
4057                                        "RFC-1212") &&
4058                                 strcmp(thisParserPtr->modulePtr->export.name,
4059                                        "RFC1065-SMI") &&
4060                                 strcmp(thisParserPtr->modulePtr->export.name,
4061                                        "RFC1155-SMI") && 
4062                                 strcmp(thisParserPtr->modulePtr->export.name,
4063                                        "COPS-PR-SPPI")) {
4064                                 smiPrintError(thisParserPtr, ERR_CHOICE);
4065                             }
4066                         ;}
4067     break;
4068
4069   case 84:
4070 #line 2046 "parser-smi.y"
4071     {
4072                             (yyval.typePtr) = addType(NULL, SMI_BASETYPE_UNKNOWN, 0,
4073                                          thisParserPtr);
4074                         ;}
4075     break;
4076
4077   case 85:
4078 #line 2056 "parser-smi.y"
4079     {
4080                           (yyval.id) = (yyvsp[(1) - (1)].id);
4081                         ;}
4082     break;
4083
4084   case 86:
4085 #line 2061 "parser-smi.y"
4086     {
4087                             smiPrintError (thisParserPtr,
4088                                            ERR_BAD_LOWER_IDENTIFIER_CASE,
4089                                            (yyvsp[(1) - (1)].id));
4090                             /* xxx
4091                             if ((thisParserPtr->flags & SMI_FLAG_BE_LAX) == 0) {
4092                                 YYERROR;
4093                             }
4094                             */
4095                           (yyval.id) = (yyvsp[(1) - (1)].id);
4096                         ;}
4097     break;
4098
4099   case 87:
4100 #line 2076 "parser-smi.y"
4101     {
4102                             thisParserPtr->firstStatementLine = thisParserPtr->line;
4103                             thisParserPtr->currentDecl = SMI_DECL_VALUEASSIGNMENT;
4104
4105                             checkNameLen(thisParserPtr, (yyvsp[(1) - (1)].id),
4106                                          ERR_OIDNAME_32, ERR_OIDNAME_64);
4107                             smiCheckObjectName(thisParserPtr,
4108                                                thisModulePtr, (yyvsp[(1) - (1)].id));
4109                             if (thisModulePtr->export.language == SMI_LANGUAGE_SMIV2)
4110                             {
4111                                 if (strchr((yyvsp[(1) - (1)].id), '-') &&
4112                                     (strcmp((yyvsp[(1) - (1)].id), "mib-2") ||
4113                                   strcmp(thisModulePtr->export.name, "SNMPv2-SMI"))) {
4114                                     smiPrintError(thisParserPtr,
4115                                                   ERR_OIDNAME_INCLUDES_HYPHEN,
4116                                                   (yyvsp[(1) - (1)].id));
4117                                 }
4118                             }
4119                         ;}
4120     break;
4121
4122   case 88:
4123 #line 2097 "parser-smi.y"
4124     {
4125                             Object *objectPtr;
4126                             
4127                             objectPtr = (yyvsp[(7) - (8)].objectPtr);
4128                             smiCheckObjectReuse(thisParserPtr, (yyvsp[(1) - (8)].id), &objectPtr);
4129                             objectPtr = setObjectName(objectPtr, (yyvsp[(1) - (8)].id), thisParserPtr);
4130                             deleteObjectFlags(objectPtr, FLAG_INCOMPLETE);
4131                             setObjectLine(objectPtr, thisParserPtr->firstStatementLine,
4132                                           thisParserPtr);
4133                             setObjectDecl(objectPtr,
4134                                           SMI_DECL_VALUEASSIGNMENT);
4135                             (yyval.err) = 0;
4136                         ;}
4137     break;
4138
4139   case 89:
4140 #line 2116 "parser-smi.y"
4141     {
4142                             thisParserPtr->firstStatementLine = thisParserPtr->line;
4143                             thisParserPtr->currentDecl = SMI_DECL_TYPEASSIGNMENT;
4144
4145                             checkNameLen(thisParserPtr, (yyvsp[(1) - (1)].id),
4146                                          ERR_TYPENAME_32, ERR_TYPENAME_64);
4147                         ;}
4148     break;
4149
4150   case 90:
4151 #line 2124 "parser-smi.y"
4152     {
4153                             Type *typePtr;
4154                             
4155                             if (strlen((yyvsp[(1) - (4)].id))) {
4156                                 if ((yyvsp[(4) - (4)].typePtr)->export.basetype != SMI_BASETYPE_UNKNOWN) {
4157                                     smiCheckTypeName(thisParserPtr,
4158                                                      thisModulePtr, (yyvsp[(1) - (4)].id),
4159                                                      thisParserPtr->firstStatementLine);
4160                                 }
4161                                 setTypeLine((yyvsp[(4) - (4)].typePtr), thisParserPtr->firstStatementLine,
4162                                             thisParserPtr);
4163                                 setTypeName((yyvsp[(4) - (4)].typePtr), (yyvsp[(1) - (4)].id));
4164                                 (yyval.err) = 0;
4165                             } else {
4166                                 (yyval.err) = 0;
4167                             }
4168
4169                             /*
4170                              * If we are in an SMI module, some type
4171                              * definitions derived from ASN.1 `INTEGER'
4172                              * must be modified to libsmi basetypes.
4173                              */
4174                             if (thisModulePtr &&
4175                                 (!strcmp(thisModulePtr->export.name, "SNMPv2-SMI"))) {
4176                                 if (!strcmp((yyvsp[(1) - (4)].id), "Counter32")) {
4177                                     (yyvsp[(4) - (4)].typePtr)->export.basetype = SMI_BASETYPE_UNSIGNED32;
4178                                     setTypeParent((yyvsp[(4) - (4)].typePtr), smiHandle->typeUnsigned32Ptr);
4179                                     if ((yyvsp[(4) - (4)].typePtr)->listPtr) {
4180                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.basetype = SMI_BASETYPE_UNSIGNED32;
4181                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.value.unsigned32 = 0;
4182                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.basetype = SMI_BASETYPE_UNSIGNED32;
4183                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.value.unsigned32 = 4294967295U;
4184                                     }
4185                                 } else if (!strcmp((yyvsp[(1) - (4)].id), "Gauge32")) {
4186                                     (yyvsp[(4) - (4)].typePtr)->export.basetype = SMI_BASETYPE_UNSIGNED32;
4187                                     setTypeParent((yyvsp[(4) - (4)].typePtr), smiHandle->typeUnsigned32Ptr);
4188                                     if ((yyvsp[(4) - (4)].typePtr)->listPtr) {
4189                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.basetype = SMI_BASETYPE_UNSIGNED32;
4190                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.value.unsigned32 = 0;
4191                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.basetype = SMI_BASETYPE_UNSIGNED32;
4192                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.value.unsigned32 = 4294967295U;
4193                                     }
4194                                 } else if (!strcmp((yyvsp[(1) - (4)].id), "Unsigned32")) {
4195                                     (yyvsp[(4) - (4)].typePtr)->export.basetype = SMI_BASETYPE_UNSIGNED32;
4196                                     setTypeParent((yyvsp[(4) - (4)].typePtr), smiHandle->typeUnsigned32Ptr);
4197                                     if ((yyvsp[(4) - (4)].typePtr)->listPtr) {
4198                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.basetype = SMI_BASETYPE_UNSIGNED32;
4199                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.value.unsigned32 = 0;
4200                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.basetype = SMI_BASETYPE_UNSIGNED32;
4201                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.value.unsigned32 = 4294967295U;
4202                                     }
4203                                 } else if (!strcmp((yyvsp[(1) - (4)].id), "TimeTicks")) {
4204                                     (yyvsp[(4) - (4)].typePtr)->export.basetype = SMI_BASETYPE_UNSIGNED32;
4205                                     setTypeParent((yyvsp[(4) - (4)].typePtr), smiHandle->typeUnsigned32Ptr);
4206                                     if ((yyvsp[(4) - (4)].typePtr)->listPtr) {
4207                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.basetype = SMI_BASETYPE_UNSIGNED32;
4208                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.value.unsigned32 = 0;
4209                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.basetype = SMI_BASETYPE_UNSIGNED32;
4210                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.value.unsigned32 = 4294967295U;
4211                                     }
4212                                 } else if (!strcmp((yyvsp[(1) - (4)].id), "Counter64")) {
4213                                     (yyvsp[(4) - (4)].typePtr)->export.basetype = SMI_BASETYPE_UNSIGNED64;
4214                                     if ((yyvsp[(4) - (4)].typePtr)->listPtr) {
4215                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.basetype = SMI_BASETYPE_UNSIGNED64;
4216                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.value.unsigned64 = 0;
4217                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.basetype = SMI_BASETYPE_UNSIGNED64;
4218                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.value.unsigned64 = SMI_BASETYPE_UNSIGNED64_MAX;
4219                                     }
4220                                     setTypeParent((yyvsp[(4) - (4)].typePtr), smiHandle->typeUnsigned64Ptr);
4221                                 }
4222                             }
4223                             if (thisModulePtr &&
4224                                 (!strcmp(thisModulePtr->export.name, "RFC1155-SMI") ||
4225                                  !strcmp(thisModulePtr->export.name, "RFC1065-SMI"))) {
4226                                 if (!strcmp((yyvsp[(1) - (4)].id), "Counter")) {
4227                                     (yyvsp[(4) - (4)].typePtr)->export.basetype = SMI_BASETYPE_UNSIGNED32;
4228                                     setTypeParent((yyvsp[(4) - (4)].typePtr), smiHandle->typeUnsigned32Ptr);
4229                                     if ((yyvsp[(4) - (4)].typePtr)->listPtr) {
4230                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.basetype = SMI_BASETYPE_UNSIGNED32;
4231                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.value.unsigned32 = 0;
4232                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.basetype = SMI_BASETYPE_UNSIGNED32;
4233                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.value.unsigned32 = 4294967295U;
4234                                     }
4235                                 } else if (!strcmp((yyvsp[(1) - (4)].id), "Gauge")) {
4236                                     (yyvsp[(4) - (4)].typePtr)->export.basetype = SMI_BASETYPE_UNSIGNED32;
4237                                     setTypeParent((yyvsp[(4) - (4)].typePtr), smiHandle->typeUnsigned32Ptr);
4238                                     if ((yyvsp[(4) - (4)].typePtr)->listPtr) {
4239                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.basetype = SMI_BASETYPE_UNSIGNED32;
4240                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.value.unsigned32 = 0;
4241                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.basetype = SMI_BASETYPE_UNSIGNED32;
4242                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.value.unsigned32 = 4294967295U;
4243                                     }
4244                                 } else if (!strcmp((yyvsp[(1) - (4)].id), "TimeTicks")) {
4245                                     (yyvsp[(4) - (4)].typePtr)->export.basetype = SMI_BASETYPE_UNSIGNED32;
4246                                     setTypeParent((yyvsp[(4) - (4)].typePtr), smiHandle->typeUnsigned32Ptr);
4247                                     if ((yyvsp[(4) - (4)].typePtr)->listPtr) {
4248                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.basetype = SMI_BASETYPE_UNSIGNED32;
4249                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.value.unsigned32 = 0;
4250                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.basetype = SMI_BASETYPE_UNSIGNED32;
4251                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.value.unsigned32 = 4294967295U;
4252                                     }
4253                                 } else if (!strcmp((yyvsp[(1) - (4)].id), "NetworkAddress")) {
4254                                     setTypeName((yyvsp[(4) - (4)].typePtr), smiStrdup("NetworkAddress"));
4255                                     (yyvsp[(4) - (4)].typePtr)->export.basetype = SMI_BASETYPE_OCTETSTRING;
4256                                     setTypeParent((yyvsp[(4) - (4)].typePtr), findTypeByModuleAndName(
4257                                                            thisModulePtr,
4258                                                            "IpAddress"));
4259                                 } else if (!strcmp((yyvsp[(1) - (4)].id), "IpAddress")) {
4260                                     typePtr = findTypeByModuleAndName(
4261                                         thisModulePtr, "NetworkAddress");
4262                                     if (typePtr) 
4263                                         setTypeParent(typePtr, (yyvsp[(4) - (4)].typePtr));
4264                                 }
4265                             }
4266                             if (thisModulePtr &&
4267                                 (!strcmp(thisModulePtr->export.name, "COPS-PR-SPPI"))) {
4268                                 if (!strcmp((yyvsp[(1) - (4)].id), "Unsigned32")) {
4269                                     (yyvsp[(4) - (4)].typePtr)->export.basetype = SMI_BASETYPE_UNSIGNED32;
4270                                     setTypeParent((yyvsp[(4) - (4)].typePtr), smiHandle->typeUnsigned32Ptr);
4271                                     if ((yyvsp[(4) - (4)].typePtr)->listPtr) {
4272                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.basetype = SMI_BASETYPE_UNSIGNED32;
4273                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.value.unsigned32 = 0;
4274                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.basetype = SMI_BASETYPE_UNSIGNED32;
4275                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.value.unsigned32 = 4294967295U;
4276                                     }
4277                                 } else if (!strcmp((yyvsp[(1) - (4)].id), "TimeTicks")) {
4278                                     (yyvsp[(4) - (4)].typePtr)->export.basetype = SMI_BASETYPE_UNSIGNED32;
4279                                     setTypeParent((yyvsp[(4) - (4)].typePtr), smiHandle->typeUnsigned32Ptr);
4280                                     if ((yyvsp[(4) - (4)].typePtr)->listPtr) {
4281                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.basetype = SMI_BASETYPE_UNSIGNED32;
4282                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.value.unsigned32 = 0;
4283                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.basetype = SMI_BASETYPE_UNSIGNED32;
4284                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.value.unsigned32 = 4294967295U;
4285                                     }
4286                                 } else if (!strcmp((yyvsp[(1) - (4)].id), "Unsigned64")) {
4287                                     (yyvsp[(4) - (4)].typePtr)->export.basetype = SMI_BASETYPE_UNSIGNED64;
4288                                     if ((yyvsp[(4) - (4)].typePtr)->listPtr) {
4289                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.basetype = SMI_BASETYPE_UNSIGNED64;
4290                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.value.unsigned64 = 0;
4291                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.basetype = SMI_BASETYPE_UNSIGNED64;
4292                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.value.unsigned64 = SMI_BASETYPE_UNSIGNED64_MAX;
4293                                     }
4294                                     setTypeParent((yyvsp[(4) - (4)].typePtr), smiHandle->typeUnsigned64Ptr);
4295                                 } else if (!strcmp((yyvsp[(1) - (4)].id), "Integer64")) {
4296                                     (yyvsp[(4) - (4)].typePtr)->export.basetype = SMI_BASETYPE_INTEGER64;
4297                                     if ((yyvsp[(4) - (4)].typePtr)->listPtr) {
4298                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.basetype = SMI_BASETYPE_INTEGER64;
4299                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.minValue.value.integer64 = SMI_BASETYPE_INTEGER64_MIN;
4300                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.basetype = SMI_BASETYPE_INTEGER64;
4301                                         ((Range *)(yyvsp[(4) - (4)].typePtr)->listPtr->ptr)->export.maxValue.value.integer64 = SMI_BASETYPE_INTEGER64_MAX;
4302                                     }
4303                                     setTypeParent((yyvsp[(4) - (4)].typePtr), smiHandle->typeInteger64Ptr);
4304                                 }
4305                             }
4306                         ;}
4307     break;
4308
4309   case 91:
4310 #line 2282 "parser-smi.y"
4311     {
4312                             (yyval.id) = (yyvsp[(1) - (1)].id);
4313                         ;}
4314     break;
4315
4316   case 92:
4317 #line 2286 "parser-smi.y"
4318     {
4319                             (yyval.id) = smiStrdup((yyvsp[(1) - (1)].id));
4320                             /*
4321                              * well known types (keywords in this grammar)
4322                              * are known to be defined in these modules.
4323                              */
4324                             if (strcmp(thisParserPtr->modulePtr->export.name,
4325                                        "SNMPv2-SMI") &&
4326                                 strcmp(thisParserPtr->modulePtr->export.name,
4327                                        "SNMPv2-TC") &&
4328                                 strcmp(thisParserPtr->modulePtr->export.name,
4329                                        "SNMPv2-CONF") &&
4330                                 strcmp(thisParserPtr->modulePtr->export.name,
4331                                        "RFC-1212") &&
4332                                 strcmp(thisParserPtr->modulePtr->export.name,
4333                                        "RFC1065-SMI") &&
4334                                 strcmp(thisParserPtr->modulePtr->export.name,
4335                                        "RFC1155-SMI") &&
4336                                 strcmp(thisParserPtr->modulePtr->export.name,
4337                                        "COPS-PR-SPPI")) {
4338                                 smiPrintError(thisParserPtr, ERR_TYPE_SMI_OR_SPPI, (yyvsp[(1) - (1)].id));
4339                             }
4340                         ;}
4341     break;
4342
4343   case 93:
4344 #line 2310 "parser-smi.y"
4345     {
4346                             (yyval.id) = smiStrdup((yyvsp[(1) - (1)].id));
4347                             /*
4348                              * well known types (keywords in this grammar)
4349                              * are known to be defined in these modules.
4350                              */
4351                             if ((strcmp(thisParserPtr->modulePtr->export.name,
4352                                         "COPS-PR-SPPI")) &&
4353                                 (thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI))
4354                                 smiPrintError(thisParserPtr, ERR_TYPE_SPPI, (yyvsp[(1) - (1)].id));
4355                         ;}
4356     break;
4357
4358   case 95:
4359 #line 2325 "parser-smi.y"
4360     {
4361                             if ((thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI) &&
4362                                 !findImportByName((yyvsp[(1) - (1)].id), thisParserPtr->modulePtr))
4363                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, (yyvsp[(1) - (1)].id));
4364                             (yyval.id) = (yyvsp[(1) - (1)].id);
4365                         ;}
4366     break;
4367
4368   case 106:
4369 #line 2350 "parser-smi.y"
4370     {
4371                             if ((yyvsp[(1) - (1)].typePtr)->export.name) {
4372                                 /*
4373                                  * If we found an already defined type,
4374                                  * we have to inherit a new type structure.
4375                                  * (Otherwise the `Syntax' rule created
4376                                  * a new type for us.)
4377                                  */
4378                                 (yyval.typePtr) = duplicateType((yyvsp[(1) - (1)].typePtr), 0, thisParserPtr);
4379                                 setTypeDecl((yyval.typePtr), SMI_DECL_TYPEASSIGNMENT);
4380                             } else {
4381                                 (yyval.typePtr) = (yyvsp[(1) - (1)].typePtr);
4382                                 setTypeDecl((yyval.typePtr), SMI_DECL_TYPEASSIGNMENT);
4383                             }
4384                         ;}
4385     break;
4386
4387   case 107:
4388 #line 2366 "parser-smi.y"
4389     {
4390                             Import *importPtr;
4391
4392                             thisParserPtr->currentDecl = SMI_DECL_TEXTUALCONVENTION;
4393
4394                             if (thisModulePtr->export.language == SMI_LANGUAGE_UNKNOWN)
4395                                 thisModulePtr->export.language = SMI_LANGUAGE_SMIV2;
4396
4397                             if (strcmp(thisModulePtr->export.name, "SNMPv2-TC")) {
4398                                 importPtr =
4399                                     findImportByName("TEXTUAL-CONVENTION",
4400                                                      thisModulePtr);
4401                                 if (importPtr) {
4402                                     importPtr->use++;
4403                                 } else {
4404                                     if (thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)
4405                                         smiPrintError(thisParserPtr,
4406                                                       ERR_MACRO_NOT_IMPORTED,
4407                                                       "TEXTUAL-CONVENTION",
4408                                                       "SNMPv2-TC");
4409                                     else
4410                                         smiPrintError(thisParserPtr,
4411                                                       ERR_MACRO_NOT_IMPORTED,
4412                                                       "TEXTUAL-CONVENTION",
4413                                                       "COPS-PR-SPPI");
4414                                 }
4415                             }
4416                         ;}
4417     break;
4418
4419   case 108:
4420 #line 2397 "parser-smi.y"
4421     {
4422                             checkDescr(thisParserPtr, (yyvsp[(7) - (7)].text));
4423                         ;}
4424     break;
4425
4426   case 109:
4427 #line 2402 "parser-smi.y"
4428     {
4429                             if (((yyvsp[(11) - (11)].typePtr)) && !((yyvsp[(11) - (11)].typePtr)->export.name)) {
4430                                 /*
4431                                  * If the Type we found has just been
4432                                  * defined, we don't have to allocate
4433                                  * a new one.
4434                                  */
4435                                 (yyval.typePtr) = (yyvsp[(11) - (11)].typePtr);
4436                             } else {
4437                                 if (!((yyvsp[(11) - (11)].typePtr)))
4438                                     smiPrintError(thisParserPtr, ERR_INTERNAL);
4439                                 /*
4440                                  * Otherwise, we have to allocate a
4441                                  * new Type struct, inherited from $10.
4442                                  */
4443                                 (yyval.typePtr) = duplicateType((yyvsp[(11) - (11)].typePtr), 0, thisParserPtr);
4444                             }
4445                             setTypeDescription((yyval.typePtr), (yyvsp[(7) - (11)].text), thisParserPtr);
4446                             if ((yyvsp[(9) - (11)].text)) {
4447                                 setTypeReference((yyval.typePtr), (yyvsp[(9) - (11)].text), thisParserPtr);
4448                             }
4449                             setTypeStatus((yyval.typePtr), (yyvsp[(5) - (11)].status));
4450                             if ((yyvsp[(3) - (11)].text)) {
4451                                 if (smiCheckFormat(thisParserPtr,
4452                                                    (yyval.typePtr)->export.basetype, (yyvsp[(3) - (11)].text),
4453                                                    thisParserPtr->firstStatementLine)) {
4454                                     setTypeFormat((yyval.typePtr), (yyvsp[(3) - (11)].text));
4455                                 }
4456                             }
4457                             setTypeDecl((yyval.typePtr), SMI_DECL_TEXTUALCONVENTION);
4458                         ;}
4459     break;
4460
4461   case 110:
4462 #line 2434 "parser-smi.y"
4463     {
4464                             (yyval.typePtr) = (yyvsp[(1) - (1)].typePtr);
4465                             setTypeDecl((yyval.typePtr), SMI_DECL_TYPEASSIGNMENT);
4466                         ;}
4467     break;
4468
4469   case 111:
4470 #line 2442 "parser-smi.y"
4471     {
4472                             if ((yyvsp[(3) - (3)].typePtr)) {
4473                                 (yyval.typePtr) = addType(NULL,
4474                                              SMI_BASETYPE_UNKNOWN, 0,
4475                                              thisParserPtr);
4476                                 setTypeDecl((yyval.typePtr), SMI_DECL_IMPL_SEQUENCEOF);
4477                                 setTypeParent((yyval.typePtr), (yyvsp[(3) - (3)].typePtr));
4478                             } else {
4479                                 (yyval.typePtr) = NULL;
4480                             }
4481                         ;}
4482     break;
4483
4484   case 112:
4485 #line 2461 "parser-smi.y"
4486     {
4487                             Type *typePtr;
4488                             Import *importPtr;
4489
4490                             (yyval.typePtr) = findTypeByModulenameAndName(
4491                                 thisParserPtr->modulePtr->export.name, (yyvsp[(1) - (1)].id));
4492                             if (! (yyval.typePtr)) {
4493                                 importPtr = findImportByName((yyvsp[(1) - (1)].id),
4494                                                              thisModulePtr);
4495                                 if (!importPtr ||
4496                                     (importPtr->kind == KIND_NOTFOUND)) {
4497                                     /* 
4498                                      * forward referenced type. create it,
4499                                      * marked with FLAG_INCOMPLETE.
4500                                      */
4501                                     typePtr = addType((yyvsp[(1) - (1)].id),
4502                                                       SMI_BASETYPE_UNKNOWN,
4503                                                       FLAG_INCOMPLETE,
4504                                                       thisParserPtr);
4505                                     (yyval.typePtr) = typePtr;
4506                                 } else {
4507                                     /*
4508                                      * imported type.
4509                                      * TODO: is this allowed in a SEQUENCE? 
4510                                      */
4511                                     importPtr->use++;
4512                                     (yyval.typePtr) = findTypeByModulenameAndName(
4513                                         importPtr->export.module,
4514                                         importPtr->export.name);
4515                                     smiFree((yyvsp[(1) - (1)].id));
4516                                 }
4517                             } else {
4518                                 smiFree((yyvsp[(1) - (1)].id));
4519                             }
4520                         ;}
4521     break;
4522
4523   case 113:
4524 #line 2501 "parser-smi.y"
4525     {
4526                             (yyval.typePtr) = addType(NULL, SMI_BASETYPE_UNKNOWN, 0,
4527                                          thisParserPtr);
4528                             setTypeList((yyval.typePtr), (yyvsp[(3) - (4)].listPtr));
4529                         ;}
4530     break;
4531
4532   case 114:
4533 #line 2509 "parser-smi.y"
4534     {
4535                             (yyval.listPtr) = smiMalloc(sizeof(List));
4536                             (yyval.listPtr)->ptr = (yyvsp[(1) - (1)].objectPtr);
4537                             (yyval.listPtr)->nextPtr = NULL;
4538                         ;}
4539     break;
4540
4541   case 115:
4542 #line 2516 "parser-smi.y"
4543     {
4544                             List *p, *pp;
4545                             
4546                             p = smiMalloc(sizeof(List));
4547                             p->ptr = (void *)(yyvsp[(3) - (3)].objectPtr);
4548                             p->nextPtr = NULL;
4549                             for (pp = (yyvsp[(1) - (3)].listPtr); pp->nextPtr; pp = pp->nextPtr);
4550                             pp->nextPtr = p;
4551                             (yyval.listPtr) = (yyvsp[(1) - (3)].listPtr);
4552                         ;}
4553     break;
4554
4555   case 116:
4556 #line 2535 "parser-smi.y"
4557     {
4558                             Object *objectPtr;
4559                             Import *importPtr;
4560                             Type *typePtr;
4561                             
4562                             objectPtr =
4563                                 findObjectByModuleAndName(thisParserPtr->modulePtr,
4564                                                           (yyvsp[(1) - (2)].id));
4565
4566                             if (!objectPtr) {
4567                                 importPtr = findImportByName((yyvsp[(1) - (2)].id),
4568                                                              thisModulePtr);
4569                                 if (!importPtr ||
4570                                     (importPtr->kind == KIND_NOTFOUND)) {
4571                                     objectPtr = addObject((yyvsp[(1) - (2)].id), thisParserPtr->pendingNodePtr,
4572                                                           0,
4573                                                           FLAG_INCOMPLETE |
4574                                                           FLAG_SEQTYPE,
4575                                                           thisParserPtr);
4576                                     setObjectType(objectPtr, (yyvsp[(2) - (2)].typePtr));
4577                                 } else {
4578                                     /*
4579                                      * imported object.
4580                                      */
4581                                     importPtr->use++;
4582                                     objectPtr = findObjectByModulenameAndName(
4583                                         importPtr->export.module, (yyvsp[(1) - (2)].id));
4584                                     smiFree((yyvsp[(1) - (2)].id));
4585
4586                                     if (objectPtr->typePtr->export.name) {
4587                                         typePtr = objectPtr->typePtr;
4588                                     } else {
4589                                         typePtr = objectPtr->typePtr->parentPtr;
4590                                     }
4591                                     if (((yyvsp[(2) - (2)].typePtr) != typePtr) &&
4592                                         (((yyvsp[(2) - (2)].typePtr)->export.basetype !=
4593                                           SMI_BASETYPE_INTEGER32) ||
4594                                          (typePtr->export.basetype !=
4595                                           SMI_BASETYPE_ENUM)) &&
4596                                         (((yyvsp[(2) - (2)].typePtr)->export.basetype !=
4597                                           SMI_BASETYPE_OCTETSTRING) ||
4598                                          (typePtr->export.basetype !=
4599                                           SMI_BASETYPE_BITS))) {
4600                                         smiPrintError(thisParserPtr,
4601                                                       ERR_SEQUENCE_TYPE_MISMATCH,
4602                                                       objectPtr->export.name);
4603                                     }
4604                                 }
4605                             } else {
4606                                 smiFree((yyvsp[(1) - (2)].id));
4607                                 if (objectPtr->typePtr) {
4608
4609                                     if (objectPtr->typePtr->export.name) {
4610                                         typePtr = objectPtr->typePtr;
4611                                     } else {
4612                                         typePtr = objectPtr->typePtr->parentPtr;
4613                                     }
4614                                     if (((yyvsp[(2) - (2)].typePtr) != typePtr) &&
4615                                         (((yyvsp[(2) - (2)].typePtr)->export.basetype !=
4616                                           SMI_BASETYPE_INTEGER32) ||
4617                                          (typePtr->export.basetype !=
4618                                           SMI_BASETYPE_ENUM)) &&
4619                                         (((yyvsp[(2) - (2)].typePtr)->export.basetype !=
4620                                           SMI_BASETYPE_OCTETSTRING) ||
4621                                          (typePtr->export.basetype !=
4622                                           SMI_BASETYPE_BITS))) {
4623                                         smiPrintError(thisParserPtr,
4624                                                       ERR_SEQUENCE_TYPE_MISMATCH,
4625                                                       objectPtr->export.name);
4626                                     }
4627
4628                                 } else {
4629                                     setObjectType(objectPtr, (yyvsp[(2) - (2)].typePtr));
4630                                     addObjectFlags(objectPtr,
4631                                                    FLAG_SEQTYPE);
4632                                 }
4633                             }
4634
4635                             (yyval.objectPtr) = objectPtr;
4636                         ;}
4637     break;
4638
4639   case 117:
4640 #line 2618 "parser-smi.y"
4641     {
4642                             (yyval.typePtr) = (yyvsp[(1) - (1)].typePtr);
4643                             if ((yyval.typePtr))
4644                                 defaultBasetype = (yyval.typePtr)->export.basetype;
4645                         ;}
4646     break;
4647
4648   case 118:
4649 #line 2626 "parser-smi.y"
4650     {
4651                             Type *typePtr;
4652                             List *p;
4653                             
4654                             defaultBasetype = SMI_BASETYPE_BITS;
4655                             typePtr = addType(NULL, SMI_BASETYPE_BITS,
4656                                               FLAG_INCOMPLETE,
4657                                               thisParserPtr);
4658                             setTypeDecl(typePtr, SMI_DECL_IMPLICIT_TYPE);
4659                             setTypeParent(typePtr, smiHandle->typeBitsPtr);
4660                             setTypeList(typePtr, (yyvsp[(3) - (4)].listPtr));
4661                             for (p = (yyvsp[(3) - (4)].listPtr); p; p = p->nextPtr)
4662                                 ((NamedNumber *)p->ptr)->typePtr = typePtr;
4663                             smiCheckNamedNumbersOrder(parserPtr, typePtr);
4664                             (yyval.typePtr) = typePtr;
4665                         ;}
4666     break;
4667
4668   case 119:
4669 #line 2646 "parser-smi.y"
4670     {
4671                             (yyval.typePtr) = (yyvsp[(1) - (1)].typePtr);
4672                         ;}
4673     break;
4674
4675   case 120:
4676 #line 2650 "parser-smi.y"
4677     {
4678                             /* TODO: */
4679                             (yyval.typePtr) = smiHandle->typeOctetStringPtr;
4680                         ;}
4681     break;
4682
4683   case 121:
4684 #line 2655 "parser-smi.y"
4685     {
4686                             Type *typePtr;
4687                             Import *importPtr;
4688                             
4689                             (yyval.typePtr) = findTypeByModulenameAndName(
4690                                 thisParserPtr->modulePtr->export.name, (yyvsp[(1) - (2)].id));
4691                             if (! (yyval.typePtr)) {
4692                                 importPtr = findImportByName((yyvsp[(1) - (2)].id),
4693                                                              thisModulePtr);
4694                                 if (!importPtr ||
4695                                     (importPtr->kind == KIND_NOTFOUND)) {
4696                                     /* 
4697                                      * forward referenced type. create it,
4698                                      * marked with FLAG_INCOMPLETE.
4699                                      */
4700                                     typePtr = addType((yyvsp[(1) - (2)].id), SMI_BASETYPE_UNKNOWN,
4701                                                       FLAG_INCOMPLETE,
4702                                                       thisParserPtr);
4703                                     (yyval.typePtr) = typePtr;
4704                                 } else {
4705                                     importPtr->use++;
4706                                     (yyval.typePtr) = findTypeByModulenameAndName(
4707                                         importPtr->export.module,
4708                                         importPtr->export.name);
4709                                     smiFree((yyvsp[(1) - (2)].id));
4710                                 }
4711                             } else {
4712                                 smiFree((yyvsp[(1) - (2)].id));
4713                             }
4714                         ;}
4715     break;
4716
4717   case 122:
4718 #line 2688 "parser-smi.y"
4719     {
4720                             (yyval.listPtr) = smiMalloc(sizeof(List));
4721                             (yyval.listPtr)->ptr = (yyvsp[(1) - (1)].namedNumberPtr);
4722                             (yyval.listPtr)->nextPtr = NULL;
4723                         ;}
4724     break;
4725
4726   case 123:
4727 #line 2694 "parser-smi.y"
4728     {
4729                             List *p, *pp;
4730                             
4731                             p = smiMalloc(sizeof(List));
4732                             p->ptr = (void *)(yyvsp[(3) - (3)].namedNumberPtr);
4733                             p->nextPtr = NULL;
4734                             for (pp = (yyvsp[(1) - (3)].listPtr); pp->nextPtr; pp = pp->nextPtr);
4735                             pp->nextPtr = p;
4736                             (yyval.listPtr) = (yyvsp[(1) - (3)].listPtr);
4737                         ;}
4738     break;
4739
4740   case 124:
4741 #line 2707 "parser-smi.y"
4742     {
4743                             checkNameLen(thisParserPtr, (yyvsp[(1) - (1)].id),
4744                                          ERR_BITNAME_32, ERR_BITNAME_64);
4745                             if (thisModulePtr->export.language == SMI_LANGUAGE_SMIV2)
4746                             {
4747                                 if (strchr((yyvsp[(1) - (1)].id), '-')) {
4748                                     smiPrintError(thisParserPtr,
4749                                                   ERR_NAMEDBIT_INCLUDES_HYPHEN,
4750                                                   (yyvsp[(1) - (1)].id));
4751                                 }
4752                             }
4753                         ;}
4754     break;
4755
4756   case 125:
4757 #line 2720 "parser-smi.y"
4758     {
4759                             (yyval.namedNumberPtr) = smiMalloc(sizeof(NamedNumber));
4760                             (yyval.namedNumberPtr)->export.name = (yyvsp[(1) - (5)].id);
4761                             (yyval.namedNumberPtr)->export.value.basetype =
4762                                                        SMI_BASETYPE_UNSIGNED32;
4763                             (yyval.namedNumberPtr)->export.value.value.unsigned32 = (yyvsp[(4) - (5)].unsigned32);
4764                             /* RFC 2578 7.1.4 */
4765                             if ((yyvsp[(4) - (5)].unsigned32) >= 65535*8) {
4766                                 smiPrintError(thisParserPtr,
4767                                               ERR_BITS_NUMBER_TOO_LARGE,
4768                                               (yyvsp[(1) - (5)].id), (yyvsp[(4) - (5)].unsigned32));
4769                             } else {
4770                                 if ((yyvsp[(4) - (5)].unsigned32) >= 128) {
4771                                     smiPrintError(thisParserPtr,
4772                                                   ERR_BITS_NUMBER_LARGE,
4773                                                   (yyvsp[(1) - (5)].id), (yyvsp[(4) - (5)].unsigned32));
4774                                 }
4775                             }
4776                         ;}
4777     break;
4778
4779   case 126:
4780 #line 2742 "parser-smi.y"
4781     {
4782                             thisParserPtr->firstStatementLine = thisParserPtr->line;
4783                             thisParserPtr->currentDecl = SMI_DECL_OBJECTIDENTITY;
4784
4785                             checkNameLen(thisParserPtr, (yyvsp[(1) - (1)].id),
4786                                          ERR_OIDNAME_32, ERR_OIDNAME_64);
4787                             smiCheckObjectName(thisParserPtr,
4788                                                thisModulePtr, (yyvsp[(1) - (1)].id));
4789                         ;}
4790     break;
4791
4792   case 127:
4793 #line 2752 "parser-smi.y"
4794     {
4795                             Import *importPtr;
4796
4797                             if (strcmp(thisModulePtr->export.name, "SNMPv2-SMI") &&
4798                                 strcmp(thisModulePtr->export.name, "COPS-PR-SPPI")) {
4799                                 importPtr = findImportByName("OBJECT-IDENTITY",
4800                                                              thisModulePtr);
4801                                 if (importPtr) {
4802                                     importPtr->use++;
4803                                 } else {
4804                                     if (thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)
4805                                         smiPrintError(thisParserPtr,
4806                                                       ERR_MACRO_NOT_IMPORTED,
4807                                                       "OBJECT-IDENTITY",
4808                                                       "SNMPv2-SMI");
4809                                     else
4810                                         smiPrintError(thisParserPtr,
4811                                                       ERR_MACRO_NOT_IMPORTED,
4812                                                       "OBJECT-IDENTITY",
4813                                                       "COPS-PR-SPPI");
4814                                 }
4815                             }
4816                         ;}
4817     break;
4818
4819   case 128:
4820 #line 2777 "parser-smi.y"
4821     {
4822                             checkDescr(thisParserPtr, (yyvsp[(8) - (8)].text));
4823                         ;}
4824     break;
4825
4826   case 129:
4827 #line 2783 "parser-smi.y"
4828     {
4829                             Object *objectPtr;
4830                             
4831                             objectPtr = (yyvsp[(13) - (14)].objectPtr);
4832                             smiCheckObjectReuse(thisParserPtr, (yyvsp[(1) - (14)].id), &objectPtr);
4833
4834                             objectPtr = setObjectName(objectPtr, (yyvsp[(1) - (14)].id), thisParserPtr);
4835                             setObjectDecl(objectPtr, SMI_DECL_OBJECTIDENTITY);
4836                             setObjectLine(objectPtr, thisParserPtr->firstStatementLine,
4837                                           thisParserPtr);
4838                             setObjectStatus(objectPtr, (yyvsp[(6) - (14)].status));
4839                             setObjectDescription(objectPtr, (yyvsp[(8) - (14)].text), thisParserPtr);
4840                             if ((yyvsp[(10) - (14)].text)) {
4841                                 setObjectReference(objectPtr, (yyvsp[(10) - (14)].text), thisParserPtr);
4842                             }
4843                             addObjectFlags(objectPtr, FLAG_REGISTERED);
4844                             deleteObjectFlags(objectPtr, FLAG_INCOMPLETE);
4845                             (yyval.err) = 0;
4846                         ;}
4847     break;
4848
4849   case 130:
4850 #line 2805 "parser-smi.y"
4851     {
4852                             thisParserPtr->firstStatementLine = thisParserPtr->line;
4853                             thisParserPtr->currentDecl = SMI_DECL_OBJECTTYPE;
4854                             
4855                             checkNameLen(thisParserPtr, (yyvsp[(1) - (1)].id),
4856                                          ERR_OIDNAME_32, ERR_OIDNAME_64);
4857                             smiCheckObjectName(thisParserPtr,
4858                                                thisModulePtr, (yyvsp[(1) - (1)].id));
4859                         ;}
4860     break;
4861
4862   case 131:
4863 #line 2815 "parser-smi.y"
4864     {
4865                             Import *importPtr;
4866                             
4867                             importPtr = findImportByName("OBJECT-TYPE",
4868                                                          thisModulePtr);
4869                             if (importPtr) {
4870                                 importPtr->use++;
4871                             } else {
4872                                 if (thisModulePtr->export.language ==
4873                                     SMI_LANGUAGE_SMIV2) {
4874                                     smiPrintError(thisParserPtr,
4875                                                   ERR_MACRO_NOT_IMPORTED,
4876                                                   "OBJECT-TYPE", "SNMPv2-SMI");
4877                                 } else if (thisModulePtr->export.language ==
4878                                     SMI_LANGUAGE_SPPI) {
4879                                     smiPrintError(thisParserPtr,
4880                                                   ERR_MACRO_NOT_IMPORTED,
4881                                                   "OBJECT-TYPE", "COPS-PR-SPPI");
4882                                 } else {
4883                                     smiPrintError(thisParserPtr,
4884                                                   ERR_MACRO_NOT_IMPORTED,
4885                                                   "OBJECT-TYPE", "RFC-1212");
4886                                 }
4887                             }
4888                             indexFlag = 0;
4889                         ;}
4890     break;
4891
4892   case 132:
4893 #line 2855 "parser-smi.y"
4894     {
4895                             Object *objectPtr, *parentPtr;
4896                             Type *typePtr = NULL;
4897                             
4898                             objectPtr = (yyvsp[(22) - (23)].objectPtr);
4899
4900                             smiCheckObjectReuse(thisParserPtr, (yyvsp[(1) - (23)].id), &objectPtr);
4901
4902                             objectPtr = setObjectName(objectPtr, (yyvsp[(1) - (23)].id), thisParserPtr);
4903                             setObjectDecl(objectPtr, SMI_DECL_OBJECTTYPE);
4904                             setObjectLine(objectPtr, thisParserPtr->firstStatementLine,
4905                                           thisParserPtr);
4906                             if (checkObjectFlags(objectPtr, FLAG_SEQTYPE)) {
4907                                 deleteObjectFlags(objectPtr, FLAG_SEQTYPE);
4908                                 if ((yyvsp[(6) - (23)].typePtr)) {
4909                                     if ((yyvsp[(6) - (23)].typePtr)->export.name) {
4910                                         typePtr = (yyvsp[(6) - (23)].typePtr);
4911                                         /*
4912                                          * According to RFC 3159 7.1.3. Opaque must not be used
4913                                          * in a SYNTAX clause.
4914                                          */
4915                                         if ((thisModulePtr->export.language == SMI_LANGUAGE_SPPI) &&
4916                                             !strcmp(typePtr->export.name, "Opaque"))
4917                                             smiPrintError(thisParserPtr, ERR_OPAQUE_IN_SYNTAX);
4918                                         /*
4919                                          * According to RFC 3159 7.1.4. IpAddress must not be used
4920                                          * in a SYNTAX clause.
4921                                          */
4922                                         if ((thisModulePtr->export.language == SMI_LANGUAGE_SPPI) &&
4923                                             !strcmp(typePtr->export.name, "IpAddress"))
4924                                             smiPrintError(thisParserPtr, ERR_IPADDRESS_IN_SYNTAX);
4925                                     } else {
4926                                         typePtr = (yyvsp[(6) - (23)].typePtr)->parentPtr;
4927                                     }
4928                                     if ((objectPtr->typePtr != typePtr) &&
4929                                         ((objectPtr->typePtr->export.basetype !=
4930                                           SMI_BASETYPE_INTEGER32) ||
4931                                          (typePtr->export.basetype !=
4932                                           SMI_BASETYPE_ENUM)) &&
4933                                         ((objectPtr->typePtr->export.basetype !=
4934                                           SMI_BASETYPE_OCTETSTRING) ||
4935                                          (typePtr->export.basetype !=
4936                                           SMI_BASETYPE_BITS))) {
4937                                         smiPrintError(thisParserPtr,
4938                                                       ERR_SEQUENCE_TYPE_MISMATCH,
4939                                                       objectPtr->export.name);
4940                                     }
4941                                 }
4942                             }
4943                             setObjectType(objectPtr, (yyvsp[(6) - (23)].typePtr));
4944                             if (!((yyvsp[(6) - (23)].typePtr)->export.name)) {
4945                                 /*
4946                                  * An inlined type.
4947                                  */
4948 #if 0 /* export implicitly defined types by the node's lowercase name */
4949                                 setTypeName((yyvsp[(6) - (23)].typePtr), (yyvsp[(1) - (23)].id));
4950 #endif
4951                             }
4952                             setObjectUnits(objectPtr, (yyvsp[(7) - (23)].text));
4953                             setObjectAccess(objectPtr, (yyvsp[(8) - (23)].access));
4954                             if (thisParserPtr->flags & FLAG_CREATABLE) {
4955                                 thisParserPtr->flags &= ~FLAG_CREATABLE;
4956                                 parentPtr =
4957                                   objectPtr->nodePtr->parentPtr->lastObjectPtr;
4958                                 if (parentPtr &&
4959                                     parentPtr->export.indexkind !=
4960                                        SMI_INDEX_UNKNOWN) {
4961                                     /*
4962                                      * add objectPtr to the parent object's
4963                                      * listPtr, which is the list of columns
4964                                      * needed for row creation.
4965                                      *
4966                                      * Note, that this would clash, if the
4967                                      * parent row object-type is not yet
4968                                      * defined.
4969                                      */
4970                                     /*
4971                                     newlistPtr = smiMalloc(sizeof(List));
4972                                     newlistPtr->nextPtr = NULL;
4973                                     newlistPtr->ptr = objectPtr;
4974                                     */
4975                                     /*
4976                                      * Look up the parent object-type.
4977                                      */
4978                                     /*
4979                                     if (parentPtr->listPtr) {
4980                                         for(listPtr = parentPtr->listPtr;
4981                                             listPtr->nextPtr;
4982                                             listPtr = listPtr->nextPtr);
4983                                         listPtr->nextPtr = newlistPtr;
4984                                     } else {
4985                                         parentPtr->listPtr = newlistPtr;
4986                                     }
4987                                     */
4988                                     addObjectFlags(parentPtr, FLAG_CREATABLE);
4989                                     setObjectCreate(parentPtr, 1);
4990                                 } else {
4991                                     smiPrintError(thisParserPtr,
4992                                                   ERR_SCALAR_READCREATE);
4993                                 }
4994                             }
4995                             setObjectStatus(objectPtr, (yyvsp[(12) - (23)].status));
4996                             addObjectFlags(objectPtr, FLAG_REGISTERED);
4997                             deleteObjectFlags(objectPtr, FLAG_INCOMPLETE);
4998                             if ((yyvsp[(13) - (23)].text)) {
4999                                 setObjectDescription(objectPtr, (yyvsp[(13) - (23)].text), thisParserPtr);
5000                             }
5001                             if ((yyvsp[(15) - (23)].text)) {
5002                                 setObjectReference(objectPtr, (yyvsp[(15) - (23)].text), thisParserPtr);
5003                             }
5004                             if (thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI) {
5005                                 /*
5006                                  * For SMI documents either $16 (IndexPart) or $17 (MibIndex)
5007                                  * are used, but not both. This is signalled via the indexFlag
5008                                  * which is 1 if IndexPart has been used.
5009                                  */
5010                                 if (indexFlag == INDEXFLAG_AUGMENTS) { /* IndexPart was used */
5011                                     if ((yyvsp[(16) - (23)].index).indexkind != SMI_INDEX_UNKNOWN) {
5012                                         setObjectList(objectPtr, (yyvsp[(16) - (23)].index).listPtr);
5013                                         setObjectImplied(objectPtr, (yyvsp[(16) - (23)].index).implied);
5014                                         setObjectIndexkind(objectPtr, (yyvsp[(16) - (23)].index).indexkind);
5015                                         setObjectRelated(objectPtr, (yyvsp[(16) - (23)].index).rowPtr);
5016                                     }
5017                                 } else {
5018                                     if ((yyvsp[(17) - (23)].index).indexkind != SMI_INDEX_UNKNOWN) {
5019                                         setObjectList(objectPtr, (yyvsp[(17) - (23)].index).listPtr);
5020                                         setObjectImplied(objectPtr, (yyvsp[(17) - (23)].index).implied);
5021                                         setObjectIndexkind(objectPtr, (yyvsp[(17) - (23)].index).indexkind);
5022                                         setObjectRelated(objectPtr, (yyvsp[(17) - (23)].index).rowPtr);
5023                                     }
5024                                 }
5025                             } else {
5026                                 /*
5027                                  * PIBs contain either PIB-INDEX or AUGMENTS or EXTENDS - 
5028                                  * but only with one Index entry. A PIB-INDEX may be
5029                                  * followed by a full INDEX. We get the indexkind
5030                                  * from the first.
5031                                  * Note that PIB-INDEX/AUGMENTS/EXTENS is always
5032                                  * the first element in objectPtr->listPtr.
5033                                  * If an optional INDEX exists then it is
5034                                  * appended to this list.
5035                                  */
5036                                 if ((yyvsp[(16) - (23)].index).indexkind != SMI_INDEX_UNKNOWN) {
5037                                     setObjectList(objectPtr, (yyvsp[(16) - (23)].index).listPtr);
5038                                     setObjectIndexkind(objectPtr, (yyvsp[(16) - (23)].index).indexkind);
5039                                     setObjectRelated(objectPtr, (yyvsp[(16) - (23)].index).rowPtr);
5040                                 }
5041                                 if ((yyvsp[(17) - (23)].index).indexkind != SMI_INDEX_UNKNOWN) {
5042                                     if (objectPtr->listPtr) {
5043                                         List *p;
5044                                         for (p = objectPtr->listPtr; p->nextPtr;
5045                                              p = p->nextPtr);
5046                                         p->nextPtr = (yyvsp[(17) - (23)].index).listPtr;
5047                                     }
5048                                     setObjectImplied(objectPtr, (yyvsp[(17) - (23)].index).implied);
5049                                 }
5050                             }
5051                             if ((yyvsp[(18) - (23)].listPtr)) {
5052                                 setObjectUniqueness(objectPtr, (yyvsp[(18) - (23)].listPtr));
5053                             }
5054                             if ((yyvsp[(19) - (23)].valuePtr)) {
5055                                 if (objectPtr->typePtr
5056                                     && (((objectPtr->typePtr->export.basetype == SMI_BASETYPE_OCTETSTRING) &&
5057                                          ((yyvsp[(19) - (23)].valuePtr)->basetype != SMI_BASETYPE_OCTETSTRING))
5058                                         || ((objectPtr->typePtr->export.basetype == SMI_BASETYPE_OBJECTIDENTIFIER) &&
5059                                             ((yyvsp[(19) - (23)].valuePtr)->basetype != SMI_BASETYPE_OBJECTIDENTIFIER)))) {
5060                                     smiPrintError(thisParserPtr,
5061                                                   ERR_DEFVAL_SYNTAX);
5062                                     if ((yyvsp[(19) - (23)].valuePtr)->basetype == SMI_BASETYPE_OBJECTIDENTIFIER) {
5063                                         smiFree((yyvsp[(19) - (23)].valuePtr)->value.oid);
5064                                     }
5065                                     if (((yyvsp[(19) - (23)].valuePtr)->basetype == SMI_BASETYPE_BITS) ||
5066                                         ((yyvsp[(19) - (23)].valuePtr)->basetype == SMI_BASETYPE_OCTETSTRING)) {
5067                                         smiFree((yyvsp[(19) - (23)].valuePtr)->value.ptr);
5068                                     }
5069                                     smiFree((yyvsp[(19) - (23)].valuePtr));
5070                                 } else {
5071                                     setObjectValue(objectPtr, (yyvsp[(19) - (23)].valuePtr));
5072                                 }
5073                             }
5074                             if ((yyvsp[(9) - (23)].objectPtr)) {
5075                                 if (objectPtr->relatedPtr)
5076                                     smiPrintError(thisParserPtr, ERR_OBJECTPTR_ELEMENT_IN_USE,
5077                                                   "relatedPtr", "PIB-REFERENCES");
5078                                 /*
5079                                  * PIB-REFERENCES clauses are only allowed for
5080                                  * objects with a SYNTAX of 'ReferenceId'.
5081                                  * See RFC 3159 7.10
5082                                  */
5083                                 if (objectPtr->typePtr && objectPtr->typePtr->export.name &&
5084                                     strcmp(objectPtr->typePtr->export.name, "ReferenceId"))
5085                                     smiPrintErrorAtLine(parserPtr, ERR_PIB_REFERENCES_WRONG_TYPE,
5086                                                         objectPtr->line);
5087                                 else
5088                                     setObjectRelated(objectPtr, (yyvsp[(9) - (23)].objectPtr));
5089                             } else {
5090                                /*
5091                                 * Does this object have a SYNTAX of 'ReferenceId'
5092                                 * and a PIB-REFERENCES clause?
5093                                 * See RFC 3159 7.10
5094                                 */
5095                                if ((thisModulePtr->export.language == SMI_LANGUAGE_SPPI) &&
5096                                    objectPtr->typePtr && objectPtr->typePtr->export.name &&
5097                                    !strcmp(objectPtr->typePtr->export.name, "ReferenceId"))
5098                                    smiPrintErrorAtLine(parserPtr, ERR_LACKING_PIB_REFERENCES,
5099                                                        objectPtr->line);
5100                             }
5101                             if ((yyvsp[(10) - (23)].objectPtr)) {
5102                                 if (objectPtr->relatedPtr)
5103                                     smiPrintError(thisParserPtr, ERR_OBJECTPTR_ELEMENT_IN_USE,
5104                                                   "relatedPtr", "PIB-TAG");
5105                                 /*
5106                                  * PIB-TAG clauses are only allowed for
5107                                  * objects with a SYNTAX of 'TagReferenceId'.
5108                                  * See RFC 3159 7.11
5109                                  */
5110                                 if (objectPtr->typePtr && objectPtr->typePtr->export.name &&
5111                                     strcmp(objectPtr->typePtr->export.name, "TagReferenceId"))
5112                                     smiPrintErrorAtLine(parserPtr, ERR_PIB_TAG_WRONG_TYPE,
5113                                                         objectPtr->line);
5114                                 else
5115                                     setObjectRelated(objectPtr, (yyvsp[(10) - (23)].objectPtr));
5116                             } else {
5117                                 /*
5118                                  * Does this object have a SYNTAX of 'TagReferenceId'
5119                                  * and a PIB-TAG clause?
5120                                  * See RFC 3159 7.11
5121                                  */
5122                                 if ((thisModulePtr->export.language == SMI_LANGUAGE_SPPI) &&
5123                                     objectPtr->typePtr && objectPtr->typePtr->export.name &&
5124                                     !strcmp(objectPtr->typePtr->export.name, "TagReferenceId"))
5125                                     smiPrintErrorAtLine(parserPtr, ERR_LACKING_PIB_TAG,
5126                                                         objectPtr->line);
5127
5128                             }
5129                             if ((yyvsp[(14) - (23)].listPtr)) {
5130                                 if (objectPtr->listPtr)
5131                                     smiPrintError(thisParserPtr, ERR_OBJECTPTR_ELEMENT_IN_USE,
5132                                                   "listPtr", "INSTALL-ERRORS");
5133                                 /*
5134                                  * Are INSTALL-ERRORS only used with tables?
5135                                  * See RFC 3159 7.4
5136                                  */
5137                                 if (!((objectPtr->export.decl == SMI_DECL_OBJECTTYPE) &&
5138                                     (objectPtr->typePtr) &&
5139                                     (objectPtr->typePtr->export.decl == SMI_DECL_IMPL_SEQUENCEOF)))
5140                                     smiPrintErrorAtLine(parserPtr, ERR_INSTALL_ERRORS_FOR_NON_TABLE,
5141                                                         objectPtr->line);
5142                                 else
5143                                     setObjectList(objectPtr, (yyvsp[(14) - (23)].listPtr));
5144                             }
5145                             (yyval.err) = 0;
5146                         ;}
5147     break;
5148
5149   case 133:
5150 #line 3111 "parser-smi.y"
5151     {
5152                             if ((thisModulePtr->export.language == SMI_LANGUAGE_SMIV2) ||
5153                                 (thisModulePtr->export.language == SMI_LANGUAGE_SPPI))
5154                             {
5155                                 smiPrintError(thisParserPtr,
5156                                               ERR_MISSING_DESCRIPTION);
5157                             }
5158                             (yyval.text) = NULL;
5159                         ;}
5160     break;
5161
5162   case 134:
5163 #line 3121 "parser-smi.y"
5164     {
5165                             (yyval.text) = (yyvsp[(2) - (2)].text);
5166                             checkDescr(thisParserPtr, (yyvsp[(2) - (2)].text));
5167                         ;}
5168     break;
5169
5170   case 135:
5171 #line 3128 "parser-smi.y"
5172     {
5173                             thisParserPtr->firstStatementLine = thisParserPtr->line;
5174                             thisParserPtr->currentDecl = SMI_DECL_TRAPTYPE;
5175                             
5176                             checkNameLen(thisParserPtr, (yyvsp[(1) - (1)].id),
5177                                          ERR_OIDNAME_32, ERR_OIDNAME_64);
5178                             smiCheckObjectName(thisParserPtr,
5179                                                thisModulePtr, (yyvsp[(1) - (1)].id));
5180                         ;}
5181     break;
5182
5183   case 136:
5184 #line 3138 "parser-smi.y"
5185     {
5186                             Import *importPtr;
5187                             if (thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI)
5188                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "TRAP-TYPE");
5189                             
5190                             if (thisModulePtr->export.language == SMI_LANGUAGE_SMIV2)
5191                             {
5192                                 smiPrintError(thisParserPtr, ERR_TRAP_TYPE);
5193                             }
5194
5195                             importPtr = findImportByName("TRAP-TYPE",
5196                                                          thisModulePtr);
5197                             if (importPtr) {
5198                                 importPtr->use++;
5199                             } else {
5200                                 smiPrintError(thisParserPtr,
5201                                               ERR_MACRO_NOT_IMPORTED,
5202                                               "TRAP-TYPE", "RFC-1215");
5203                             }
5204                         ;}
5205     break;
5206
5207   case 137:
5208 #line 3164 "parser-smi.y"
5209     {
5210                             Object *objectPtr;
5211                             Node *nodePtr;
5212                             
5213                             objectPtr = (yyvsp[(6) - (11)].objectPtr);
5214                             nodePtr = findNodeByParentAndSubid(
5215                                 objectPtr->nodePtr, 0);
5216                             if (nodePtr && nodePtr->lastObjectPtr &&
5217                                 (nodePtr->lastObjectPtr->modulePtr == thisModulePtr)) {
5218                                 /*
5219                                  * hopefully, the last defined Object for
5220                                  * this Node is the one we expect.
5221                                  */
5222                                 objectPtr = nodePtr->lastObjectPtr;
5223                             } else {
5224                                 objectPtr = addObject(NULL,
5225                                                       objectPtr->nodePtr,
5226                                                       0,
5227                                                       FLAG_INCOMPLETE,
5228                                                       thisParserPtr);
5229                             }
5230                             objectPtr = addObject(NULL,
5231                                                   objectPtr->nodePtr,
5232                                                   (yyvsp[(11) - (11)].unsigned32),
5233                                                   FLAG_INCOMPLETE,
5234                                                   thisParserPtr);
5235                             
5236                             smiCheckObjectReuse(thisParserPtr, (yyvsp[(1) - (11)].id), &objectPtr);
5237
5238                             objectPtr = setObjectName(objectPtr, (yyvsp[(1) - (11)].id), thisParserPtr);
5239                             setObjectDecl(objectPtr,
5240                                           SMI_DECL_TRAPTYPE);
5241                             setObjectLine(objectPtr, thisParserPtr->firstStatementLine,
5242                                           thisParserPtr);
5243                             addObjectFlags(objectPtr, FLAG_REGISTERED);
5244                             deleteObjectFlags(objectPtr, FLAG_INCOMPLETE);
5245                             setObjectList(objectPtr, (yyvsp[(7) - (11)].listPtr));
5246                             setObjectStatus(objectPtr, SMI_STATUS_CURRENT); 
5247                             setObjectDescription(objectPtr, (yyvsp[(8) - (11)].text), thisParserPtr);
5248                             if ((yyvsp[(9) - (11)].text)) {
5249                                 setObjectReference(objectPtr, (yyvsp[(9) - (11)].text), thisParserPtr);
5250                             }
5251                             (yyval.err) = 0;
5252                         ;}
5253     break;
5254
5255   case 138:
5256 #line 3211 "parser-smi.y"
5257     {
5258                             (yyval.listPtr) = (yyvsp[(3) - (4)].listPtr);
5259                         ;}
5260     break;
5261
5262   case 139:
5263 #line 3215 "parser-smi.y"
5264     {
5265                             (yyval.listPtr) = NULL;
5266                         ;}
5267     break;
5268
5269   case 140:
5270 #line 3221 "parser-smi.y"
5271     {
5272                             if ((yyvsp[(1) - (1)].objectPtr)) {
5273                                 (yyval.listPtr) = smiMalloc(sizeof(List));
5274                                 (yyval.listPtr)->ptr = (yyvsp[(1) - (1)].objectPtr);
5275                                 (yyval.listPtr)->nextPtr = NULL;
5276                             } else {
5277                                 (yyval.listPtr) = NULL;
5278                             }
5279                         ;}
5280     break;
5281
5282   case 141:
5283 #line 3231 "parser-smi.y"
5284     {
5285                             List *p, *pp;
5286
5287                             if ((yyvsp[(3) - (3)].objectPtr)) {
5288                                 p = smiMalloc(sizeof(List));
5289                                 p->ptr = (yyvsp[(3) - (3)].objectPtr);
5290                                 p->nextPtr = NULL;
5291                                 if ((yyvsp[(1) - (3)].listPtr)) {
5292                                     for (pp = (yyvsp[(1) - (3)].listPtr); pp->nextPtr;
5293                                          pp = pp->nextPtr);
5294                                     pp->nextPtr = p;
5295                                     (yyval.listPtr) = (yyvsp[(1) - (3)].listPtr);
5296                                 } else {
5297                                     (yyval.listPtr) = p;
5298                                 }
5299                             } else {
5300                                 (yyval.listPtr) = (yyvsp[(1) - (3)].listPtr);
5301                             }
5302                         ;}
5303     break;
5304
5305   case 142:
5306 #line 3253 "parser-smi.y"
5307     {
5308                             (yyval.objectPtr) = (yyvsp[(1) - (1)].objectPtr);
5309                         ;}
5310     break;
5311
5312   case 143:
5313 #line 3259 "parser-smi.y"
5314     {
5315                             (yyval.text) = (yyvsp[(2) - (2)].text);
5316                             checkDescr(thisParserPtr, (yyvsp[(2) - (2)].text));
5317                         ;}
5318     break;
5319
5320   case 144:
5321 #line 3264 "parser-smi.y"
5322     { (yyval.text) = NULL; ;}
5323     break;
5324
5325   case 145:
5326 #line 3268 "parser-smi.y"
5327     {
5328                             (yyval.access) = (yyvsp[(1) - (1)].access);
5329                         ;}
5330     break;
5331
5332   case 146:
5333 #line 3272 "parser-smi.y"
5334     {
5335                             if (thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)
5336                                 smiPrintError(thisParserPtr, ERR_SPPI_CONSTRUCT_IN_MIB, "MAX-ACCESS");
5337                             if ((yyvsp[(1) - (1)].access) == SMI_ACCESS_NOT_ACCESSIBLE)
5338                                 smiPrintError(thisParserPtr, ERR_NOT_ACCESSIBLE_IN_PIB_ACCESS);
5339                             (yyval.access) = (yyvsp[(1) - (1)].access);
5340                         ;}
5341     break;
5342
5343   case 147:
5344 #line 3280 "parser-smi.y"
5345     { (yyval.access) = 0;  ;}
5346     break;
5347
5348   case 148:
5349 #line 3284 "parser-smi.y"
5350     { (yyval.access) = (yyvsp[(2) - (2)].access); ;}
5351     break;
5352
5353   case 149:
5354 #line 3288 "parser-smi.y"
5355     { 
5356                             smiPrintError(thisParserPtr, ERR_POLICY_ACCESS_IN_PIB);
5357                         ;}
5358     break;
5359
5360   case 150:
5361 #line 3292 "parser-smi.y"
5362     { ;}
5363     break;
5364
5365   case 151:
5366 #line 3296 "parser-smi.y"
5367     {
5368                             if (thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)
5369                                 smiPrintError(thisParserPtr, ERR_SPPI_CONSTRUCT_IN_MIB, "PIB-REFERENCES");
5370                         ;}
5371     break;
5372
5373   case 152:
5374 #line 3301 "parser-smi.y"
5375     { (yyval.objectPtr) = (yyvsp[(4) - (5)].objectPtr); ;}
5376     break;
5377
5378   case 153:
5379 #line 3303 "parser-smi.y"
5380     { (yyval.objectPtr) = 0; ;}
5381     break;
5382
5383   case 154:
5384 #line 3307 "parser-smi.y"
5385     {
5386                             if (thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)
5387                                 smiPrintError(thisParserPtr, ERR_SPPI_CONSTRUCT_IN_MIB, "PIB-TAG");
5388                         ;}
5389     break;
5390
5391   case 155:
5392 #line 3312 "parser-smi.y"
5393     { (yyval.objectPtr) = (yyvsp[(4) - (5)].objectPtr); ;}
5394     break;
5395
5396   case 156:
5397 #line 3314 "parser-smi.y"
5398     { (yyval.objectPtr) = 0; ;}
5399     break;
5400
5401   case 157:
5402 #line 3319 "parser-smi.y"
5403     {
5404                             if (thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)
5405                                 smiPrintError(thisParserPtr, ERR_SPPI_CONSTRUCT_IN_MIB, "UNIQUENESS");
5406                         ;}
5407     break;
5408
5409   case 158:
5410 #line 3324 "parser-smi.y"
5411     { (yyval.listPtr) = (yyvsp[(4) - (5)].listPtr); ;}
5412     break;
5413
5414   case 159:
5415 #line 3326 "parser-smi.y"
5416     { (yyval.listPtr) = NULL; ;}
5417     break;
5418
5419   case 160:
5420 #line 3330 "parser-smi.y"
5421     { (yyval.listPtr) = (yyvsp[(1) - (1)].listPtr); ;}
5422     break;
5423
5424   case 161:
5425 #line 3332 "parser-smi.y"
5426     { (yyval.listPtr) = NULL; ;}
5427     break;
5428
5429   case 162:
5430 #line 3336 "parser-smi.y"
5431     {
5432                             (yyval.listPtr) = smiMalloc(sizeof(List));
5433                             (yyval.listPtr)->ptr = (yyvsp[(1) - (1)].objectPtr);
5434                             (yyval.listPtr)->nextPtr = NULL;
5435                         ;}
5436     break;
5437
5438   case 163:
5439 #line 3343 "parser-smi.y"
5440     {
5441                             List *p, *pp;
5442                             
5443                             p = smiMalloc(sizeof(List));
5444                             p->ptr = (yyvsp[(3) - (3)].objectPtr);
5445                             p->nextPtr = NULL;
5446                             for (pp = (yyvsp[(1) - (3)].listPtr); pp->nextPtr; pp = pp->nextPtr);
5447                             pp->nextPtr = p;
5448                             (yyval.listPtr) = (yyvsp[(1) - (3)].listPtr);
5449                         ;}
5450     break;
5451
5452   case 164:
5453 #line 3356 "parser-smi.y"
5454     { (yyval.objectPtr) = (yyvsp[(1) - (1)].objectPtr); ;}
5455     break;
5456
5457   case 165:
5458 #line 3360 "parser-smi.y"
5459     {
5460                             if (thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)
5461                                 smiPrintError(thisParserPtr, ERR_SPPI_CONSTRUCT_IN_MIB, "INSTALL-ERRORS");
5462                         ;}
5463     break;
5464
5465   case 166:
5466 #line 3365 "parser-smi.y"
5467     { (yyval.listPtr) = (yyvsp[(4) - (5)].listPtr); ;}
5468     break;
5469
5470   case 167:
5471 #line 3367 "parser-smi.y"
5472     { (yyval.listPtr) = NULL; ;}
5473     break;
5474
5475   case 168:
5476 #line 3371 "parser-smi.y"
5477     {
5478                             (yyval.listPtr) = smiMalloc(sizeof(List));
5479                             (yyval.listPtr)->ptr = (yyvsp[(1) - (1)].objectPtr);
5480                             (yyval.listPtr)->nextPtr = NULL;
5481                         ;}
5482     break;
5483
5484   case 169:
5485 #line 3378 "parser-smi.y"
5486     {
5487                             List *p, *pp;
5488                             
5489                             p = smiMalloc(sizeof(List));
5490                             p->ptr = (yyvsp[(3) - (3)].objectPtr);
5491                             p->nextPtr = NULL;
5492                             for (pp = (yyvsp[(1) - (3)].listPtr); pp->nextPtr; pp = pp->nextPtr);
5493                             pp->nextPtr = p;
5494                             (yyval.listPtr) = (yyvsp[(1) - (3)].listPtr);
5495                         ;}
5496     break;
5497
5498   case 170:
5499 #line 3391 "parser-smi.y"
5500     {
5501                             Object *objectPtr;
5502                             
5503                             if (((yyvsp[(3) - (4)].unsigned32) < 1) || ((yyvsp[(3) - (4)].unsigned32) > 65536))
5504                                 smiPrintError(thisParserPtr, ERR_ERROR_NUMBER_RANGE, (yyvsp[(3) - (4)].unsigned32));
5505                             /*
5506                              * This is not a regular object that will be added vid
5507                              * 'addObject' as error identifier have no other
5508                              * meaning in PIBs. They are just used for
5509                              * a direct mapping to the actual protocol fields.
5510                              */
5511                             objectPtr = smiMalloc(sizeof(Object));
5512                             objectPtr->export.name = (yyvsp[(1) - (4)].id);
5513                             objectPtr->export.oidlen = 1;
5514                             objectPtr->export.oid = (void *)(yyvsp[(3) - (4)].unsigned32);
5515                             (yyval.objectPtr) = objectPtr;
5516                         ;}
5517     break;
5518
5519   case 171:
5520 #line 3412 "parser-smi.y"
5521     {
5522                             if (thisModulePtr->export.language == SMI_LANGUAGE_SMIV1)
5523                             {
5524                                 smiPrintError(thisParserPtr,
5525                                               ERR_MAX_ACCESS_IN_SMIV1);
5526                             } else if (thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI)
5527                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "MAX-ACCESS");
5528                         ;}
5529     break;
5530
5531   case 172:
5532 #line 3421 "parser-smi.y"
5533     { (yyval.access) = (yyvsp[(3) - (3)].access); ;}
5534     break;
5535
5536   case 173:
5537 #line 3423 "parser-smi.y"
5538     {
5539                             if (thisModulePtr->export.language == SMI_LANGUAGE_SMIV2)
5540                             {
5541                                 smiPrintError(thisParserPtr, ERR_ACCESS_IN_SMIV2);
5542                             } else if (thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI)
5543                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "ACCESS");
5544                         ;}
5545     break;
5546
5547   case 174:
5548 #line 3432 "parser-smi.y"
5549     { (yyval.access) = (yyvsp[(3) - (3)].access); ;}
5550     break;
5551
5552   case 175:
5553 #line 3436 "parser-smi.y"
5554     {
5555                             thisParserPtr->firstStatementLine = thisParserPtr->line;
5556                             thisParserPtr->currentDecl = SMI_DECL_NOTIFICATIONTYPE;
5557
5558                             checkNameLen(thisParserPtr, (yyvsp[(1) - (1)].id),
5559                                          ERR_OIDNAME_32, ERR_OIDNAME_64);
5560                             smiCheckObjectName(thisParserPtr,
5561                                                thisModulePtr, (yyvsp[(1) - (1)].id));
5562                         ;}
5563     break;
5564
5565   case 176:
5566 #line 3446 "parser-smi.y"
5567     {
5568                             Import *importPtr;
5569
5570                             if (thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI)
5571                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "NOTIFICATION-TYPE");
5572                                 
5573                             importPtr = findImportByName("NOTIFICATION-TYPE",
5574                                                          thisModulePtr);
5575                             if (importPtr) {
5576                                 importPtr->use++;
5577                             } else {
5578                                 smiPrintError(thisParserPtr,
5579                                               ERR_MACRO_NOT_IMPORTED,
5580                                               "NOTIFICATION-TYPE",
5581                                               "SNMPv2-SMI");
5582                             }
5583                         ;}
5584     break;
5585
5586   case 177:
5587 #line 3466 "parser-smi.y"
5588     {
5589                             checkDescr(thisParserPtr, (yyvsp[(9) - (9)].text));
5590                         ;}
5591     break;
5592
5593   case 178:
5594 #line 3472 "parser-smi.y"
5595     {
5596                             Object *objectPtr;
5597                             
5598                             objectPtr = (yyvsp[(14) - (15)].objectPtr);
5599
5600                             smiCheckObjectReuse(thisParserPtr, (yyvsp[(1) - (15)].id), &objectPtr);
5601
5602                             objectPtr = setObjectName(objectPtr, (yyvsp[(1) - (15)].id), thisParserPtr);
5603                             setObjectDecl(objectPtr,
5604                                           SMI_DECL_NOTIFICATIONTYPE);
5605                             setObjectLine(objectPtr, thisParserPtr->firstStatementLine,
5606                                           thisParserPtr);
5607                             addObjectFlags(objectPtr, FLAG_REGISTERED);
5608                             deleteObjectFlags(objectPtr, FLAG_INCOMPLETE);
5609                             setObjectList(objectPtr, (yyvsp[(5) - (15)].listPtr));
5610                             setObjectStatus(objectPtr, (yyvsp[(7) - (15)].status));
5611                             setObjectDescription(objectPtr, (yyvsp[(9) - (15)].text), thisParserPtr);
5612                             if ((yyvsp[(11) - (15)].text)) {
5613                                 setObjectReference(objectPtr, (yyvsp[(11) - (15)].text), thisParserPtr);
5614                             }
5615                             (yyval.err) = 0;
5616                         ;}
5617     break;
5618
5619   case 179:
5620 #line 3497 "parser-smi.y"
5621     {
5622                             thisParserPtr->firstStatementLine = thisParserPtr->line;
5623                             thisParserPtr->currentDecl = SMI_DECL_MODULEIDENTITY;
5624                             
5625                             checkNameLen(thisParserPtr, (yyvsp[(1) - (1)].id),
5626                                          ERR_OIDNAME_32, ERR_OIDNAME_64);
5627                             smiCheckObjectName(thisParserPtr,
5628                                                thisModulePtr, (yyvsp[(1) - (1)].id));
5629                         ;}
5630     break;
5631
5632   case 180:
5633 #line 3507 "parser-smi.y"
5634     {
5635                             Import *importPtr;
5636                             
5637                             importPtr = findImportByName("MODULE-IDENTITY",
5638                                                          thisModulePtr);
5639                             if (importPtr) {
5640                                 importPtr->use++;
5641                             } else {
5642                                 smiPrintError(thisParserPtr,
5643                                               ERR_MACRO_NOT_IMPORTED,
5644                                               "MODULE-IDENTITY",
5645                                               "SNMPv2-SMI");
5646                             }
5647                             
5648                             if (thisParserPtr->modulePtr->numModuleIdentities > 0)
5649                             {
5650                                 smiPrintError(thisParserPtr,
5651                                               ERR_TOO_MANY_MODULE_IDENTITIES);
5652                             }
5653                             if (thisParserPtr->modulePtr->numStatements > 0) {
5654                                 smiPrintError(thisParserPtr,
5655                                               ERR_MODULE_IDENTITY_NOT_FIRST);
5656                             }
5657                         ;}
5658     break;
5659
5660   case 181:
5661 #line 3532 "parser-smi.y"
5662     {
5663                           /* do nothing at the moment */
5664                         ;}
5665     break;
5666
5667   case 182:
5668 #line 3536 "parser-smi.y"
5669     {
5670                             setModuleLastUpdated(thisParserPtr->modulePtr, (yyvsp[(8) - (8)].date));
5671                         ;}
5672     break;
5673
5674   case 183:
5675 #line 3540 "parser-smi.y"
5676     {
5677                             if ((yyvsp[(11) - (11)].text) && !strlen((yyvsp[(11) - (11)].text))) {
5678                                 smiPrintError(thisParserPtr,
5679                                               ERR_EMPTY_ORGANIZATION);
5680                             }
5681                         ;}
5682     break;
5683
5684   case 184:
5685 #line 3547 "parser-smi.y"
5686     {
5687                             if ((yyvsp[(14) - (14)].text) && !strlen((yyvsp[(14) - (14)].text))) {
5688                                 smiPrintError(thisParserPtr,
5689                                               ERR_EMPTY_CONTACT);
5690                             }
5691                         ;}
5692     break;
5693
5694   case 185:
5695 #line 3554 "parser-smi.y"
5696     {
5697                             checkDescr(thisParserPtr, (yyvsp[(17) - (17)].text));
5698                         ;}
5699     break;
5700
5701   case 186:
5702 #line 3558 "parser-smi.y"
5703     {
5704                             if ((!thisModulePtr->firstRevisionPtr) ||
5705                                 (thisModulePtr->firstRevisionPtr->export.date !=
5706                                  thisModulePtr->lastUpdated)) {
5707                                 smiPrintError(thisParserPtr,
5708                                               ERR_REVISION_MISSING);
5709                                 addRevision(thisModulePtr->lastUpdated,
5710                                             smiStrdup(
5711                                                 "[Revision added by libsmi due to a LAST-UPDATED clause.]"),
5712                                             thisParserPtr);
5713                             }
5714                         ;}
5715     break;
5716
5717   case 187:
5718 #line 3572 "parser-smi.y"
5719     {
5720                             Object *objectPtr;
5721                             
5722                             objectPtr = (yyvsp[(23) - (24)].objectPtr);
5723                             smiCheckObjectReuse(thisParserPtr, (yyvsp[(1) - (24)].id), &objectPtr);
5724
5725                             thisParserPtr->modulePtr->numModuleIdentities++;
5726
5727                             objectPtr = setObjectName(objectPtr, (yyvsp[(1) - (24)].id), thisParserPtr);
5728                             setObjectDecl(objectPtr, SMI_DECL_MODULEIDENTITY);
5729                             setObjectLine(objectPtr, thisParserPtr->firstStatementLine,
5730                                           thisParserPtr);
5731                             setObjectStatus(objectPtr, SMI_STATUS_CURRENT);
5732                             addObjectFlags(objectPtr, FLAG_REGISTERED);
5733                             deleteObjectFlags(objectPtr, FLAG_INCOMPLETE);
5734                             setModuleIdentityObject(thisParserPtr->modulePtr,
5735                                                     objectPtr);
5736                             setModuleOrganization(thisParserPtr->modulePtr,
5737                                                   (yyvsp[(11) - (24)].text));
5738                             setModuleContactInfo(thisParserPtr->modulePtr,
5739                                                  (yyvsp[(14) - (24)].text));
5740                             setModuleDescription(thisParserPtr->modulePtr,
5741                                                  (yyvsp[(17) - (24)].text), thisParserPtr);
5742                             if ((yyvsp[(5) - (24)].subjectCategoriesPtr) != NULL) {
5743                                 setObjectList(objectPtr, (yyvsp[(5) - (24)].subjectCategoriesPtr)->categories);
5744                                 smiFree((yyvsp[(5) - (24)].subjectCategoriesPtr));
5745                             }
5746                             /* setObjectDescription(objectPtr, $15); */
5747                             (yyval.err) = 0;
5748                         ;}
5749     break;
5750
5751   case 188:
5752 #line 3605 "parser-smi.y"
5753     {
5754                             if (thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)
5755                                 smiPrintError(thisParserPtr, ERR_SPPI_CONSTRUCT_IN_MIB, "SUBJECT-CATEGORIES");
5756                             (yyval.subjectCategoriesPtr) = (yyvsp[(3) - (4)].subjectCategoriesPtr);
5757                         ;}
5758     break;
5759
5760   case 189:
5761 #line 3611 "parser-smi.y"
5762     {
5763                             if (thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI)
5764                                 smiPrintError(thisParserPtr, ERR_SUBJECT_CATEGORIES_MISSING);
5765                             (yyval.subjectCategoriesPtr) = NULL;
5766                         ;}
5767     break;
5768
5769   case 190:
5770 #line 3619 "parser-smi.y"
5771     {
5772                             (yyval.subjectCategoriesPtr) = smiMalloc(sizeof(SubjectCategories));
5773                             (yyval.subjectCategoriesPtr)->categories    = (yyvsp[(1) - (1)].listPtr);
5774                         ;}
5775     break;
5776
5777   case 191:
5778 #line 3626 "parser-smi.y"
5779     {
5780                             (yyval.listPtr) = smiMalloc(sizeof(List));
5781                             (yyval.listPtr)->ptr = (yyvsp[(1) - (1)].objectPtr);
5782                             (yyval.listPtr)->nextPtr = NULL;
5783                         ;}
5784     break;
5785
5786   case 192:
5787 #line 3632 "parser-smi.y"
5788     {
5789                             List *p, *pp;
5790                             
5791                             if ((yyvsp[(1) - (3)].listPtr)->ptr == NULL)
5792                                 smiPrintError(thisParserPtr, ERR_SUBJECT_CATEGORIES_ALL);
5793                             p = smiMalloc(sizeof(List));
5794                             p->ptr = (void *)(yyvsp[(3) - (3)].objectPtr);
5795                             p->nextPtr = NULL;
5796                             for (pp = (yyvsp[(1) - (3)].listPtr); pp->nextPtr; pp = pp->nextPtr);
5797                             pp->nextPtr = p;
5798                             (yyval.listPtr) = (yyvsp[(1) - (3)].listPtr);
5799                         ;}
5800     break;
5801
5802   case 193:
5803 #line 3647 "parser-smi.y"
5804     {
5805                             Object *objectPtr;
5806                             
5807                             if (strcmp((yyvsp[(1) - (1)].id), "all"))
5808                                 smiPrintError(thisParserPtr, ERR_SUBJECT_CATEGORIES_MISSING_SUBID);
5809                             else {
5810                                 /*
5811                                  * This is not a regular object that will be added via
5812                                  * 'addObject' as subject category dentifier have no
5813                                  * other meaning in PIBs. They are just used for
5814                                  * a direct mapping to the actual protocol fields.
5815                                  */
5816                                 objectPtr = smiMalloc(sizeof(Object));
5817                                 objectPtr->export.name = "all";
5818                                 objectPtr->export.oidlen = 0;
5819                                 objectPtr->export.oid = 0;
5820                                 (yyval.objectPtr) = objectPtr;
5821                             }
5822                             smiFree((yyvsp[(1) - (1)].id));
5823                         ;}
5824     break;
5825
5826   case 194:
5827 #line 3668 "parser-smi.y"
5828     {
5829                             Object *objectPtr;
5830                             
5831                             if (!strcmp((yyvsp[(1) - (4)].id), "all")) {
5832                                 smiPrintError(thisParserPtr, ERR_SUBJECT_CATEGORIES_ALL_WITH_SUBID);
5833                                 (yyval.objectPtr) = NULL;
5834                             } else {
5835                                 /*
5836                                  * This is not a regular object that will be added via
5837                                  * 'addObject' as subject category dentifier have no
5838                                  * other meaning in PIBs. They are just used for
5839                                  * a direct mapping to the actual protocol fields.
5840                                  */
5841                                 objectPtr = smiMalloc(sizeof(Object));
5842                                 objectPtr->export.name = (yyvsp[(1) - (4)].id);
5843                                 objectPtr->export.oidlen = 1;
5844                                 objectPtr->export.oid = (void *)(yyvsp[(3) - (4)].unsigned32);
5845                                 (yyval.objectPtr) = objectPtr;
5846                             }
5847                         ;}
5848     break;
5849
5850   case 195:
5851 #line 3691 "parser-smi.y"
5852     {
5853                             (yyval.typePtr) = (yyvsp[(1) - (1)].typePtr);
5854                         ;}
5855     break;
5856
5857   case 196:
5858 #line 3695 "parser-smi.y"
5859     {
5860                             if (strcmp(thisParserPtr->modulePtr->export.name,
5861                                        "SNMPv2-SMI") &&
5862                                 strcmp(thisParserPtr->modulePtr->export.name,
5863                                        "SNMPv2-TC") &&
5864                                 strcmp(thisParserPtr->modulePtr->export.name,
5865                                        "SNMPv2-CONF") &&
5866                                 strcmp(thisParserPtr->modulePtr->export.name,
5867                                        "RFC-1212") &&
5868                                 strcmp(thisParserPtr->modulePtr->export.name,
5869                                        "RFC1065-SMI") &&
5870                                 strcmp(thisParserPtr->modulePtr->export.name,
5871                                        "RFC1155-SMI") &&
5872                                 strcmp(thisParserPtr->modulePtr->export.name,
5873                                        "COPS-PR-SPPI")) {
5874                                 smiPrintError(thisParserPtr, ERR_TYPE_TAG, (yyvsp[(1) - (2)].err));
5875                             }
5876                             (yyval.typePtr) = (yyvsp[(2) - (2)].typePtr);
5877                         ;}
5878     break;
5879
5880   case 197:
5881 #line 3715 "parser-smi.y"
5882     {
5883                             /* TODO */
5884                             (yyval.typePtr) = (yyvsp[(1) - (1)].typePtr);
5885                         ;}
5886     break;
5887
5888   case 198:
5889 #line 3720 "parser-smi.y"
5890     {
5891                             /* TODO */
5892                             (yyval.typePtr) = (yyvsp[(1) - (1)].typePtr);
5893                         ;}
5894     break;
5895
5896   case 199:
5897 #line 3725 "parser-smi.y"
5898     {
5899                             /* TODO */
5900                             (yyval.typePtr) = (yyvsp[(1) - (1)].typePtr);
5901                         ;}
5902     break;
5903
5904   case 200:
5905 #line 3730 "parser-smi.y"
5906     {
5907                             Import *importPtr;
5908
5909                             if ((yyvsp[(1) - (1)].typePtr) && (yyvsp[(1) - (1)].typePtr)->export.name) {
5910                                 importPtr = findImportByName((yyvsp[(1) - (1)].typePtr)->export.name,
5911                                                              thisModulePtr);
5912                                 if (importPtr) {
5913                                     importPtr->use++;
5914                                 }
5915                             }
5916
5917                             /* TODO */
5918                             (yyval.typePtr) = (yyvsp[(1) - (1)].typePtr);
5919                         ;}
5920     break;
5921
5922   case 201:
5923 #line 3747 "parser-smi.y"
5924     { (yyval.err) = 0; /* TODO: check range */ ;}
5925     break;
5926
5927   case 202:
5928 #line 3749 "parser-smi.y"
5929     { (yyval.err) = 0; /* TODO: check range */ ;}
5930     break;
5931
5932   case 203:
5933 #line 3757 "parser-smi.y"
5934     { (yyval.typePtr) = (yyvsp[(1) - (1)].typePtr); ;}
5935     break;
5936
5937   case 204:
5938 #line 3762 "parser-smi.y"
5939     {
5940                             Import *importPtr;
5941
5942                             if ((yyvsp[(1) - (1)].typePtr) && (yyvsp[(1) - (1)].typePtr)->export.name) {
5943                                 importPtr = findImportByName((yyvsp[(1) - (1)].typePtr)->export.name,
5944                                                              thisModulePtr);
5945                                 if (importPtr) {
5946                                     importPtr->use++;
5947                                 }
5948                             }
5949
5950                             /* TODO */
5951                             (yyval.typePtr) = (yyvsp[(1) - (1)].typePtr);
5952                         ;}
5953     break;
5954
5955   case 205:
5956 #line 3779 "parser-smi.y"
5957     { (yyval.valuePtr) = (yyvsp[(1) - (1)].valuePtr); ;}
5958     break;
5959
5960   case 206:
5961 #line 3788 "parser-smi.y"
5962     {
5963                             if ((thisModulePtr->export.language == SMI_LANGUAGE_SMIV2)
5964                                 &&
5965                                 (strcmp(thisModulePtr->export.name, "SNMPv2-SMI") &&
5966                                  strcmp(thisModulePtr->export.name, "SNMPv2-TC") &&
5967                                  strcmp(thisModulePtr->export.name, "COPS-PR-SPPI")))
5968                                 smiPrintError(thisParserPtr,
5969                                               ERR_INTEGER_IN_SMIV2);
5970
5971                             defaultBasetype = SMI_BASETYPE_INTEGER32;
5972                             (yyval.typePtr) = smiHandle->typeInteger32Ptr;
5973                         ;}
5974     break;
5975
5976   case 207:
5977 #line 3801 "parser-smi.y"
5978     {
5979                             defaultBasetype = SMI_BASETYPE_INTEGER32;
5980                         ;}
5981     break;
5982
5983   case 208:
5984 #line 3805 "parser-smi.y"
5985     {
5986                             if ((thisModulePtr->export.language == SMI_LANGUAGE_SMIV2)
5987                                 &&
5988                                 (strcmp(thisModulePtr->export.name, "SNMPv2-SMI") &&
5989                                  strcmp(thisModulePtr->export.name, "SNMPv2-TC") &&
5990                                  strcmp(thisModulePtr->export.name, "COPS-PR-SPPI")))
5991                                 smiPrintError(thisParserPtr,
5992                                               ERR_INTEGER_IN_SMIV2);
5993
5994                             (yyval.typePtr) = duplicateType(smiHandle->typeInteger32Ptr, 0,
5995                                                thisParserPtr);
5996                             setTypeList((yyval.typePtr), (yyvsp[(3) - (3)].listPtr));
5997                             smiCheckTypeRanges(thisParserPtr, (yyval.typePtr));
5998                         ;}
5999     break;
6000
6001   case 209:
6002 #line 3820 "parser-smi.y"
6003     {
6004                             defaultBasetype = SMI_BASETYPE_ENUM;
6005                         ;}
6006     break;
6007
6008   case 210:
6009 #line 3824 "parser-smi.y"
6010     {
6011                             List *p;
6012                             
6013                             (yyval.typePtr) = duplicateType(smiHandle->typeEnumPtr, 0,
6014                                                thisParserPtr);
6015                             setTypeList((yyval.typePtr), (yyvsp[(3) - (3)].listPtr));
6016                             for (p = (yyvsp[(3) - (3)].listPtr); p; p = p->nextPtr)
6017                                 ((NamedNumber *)p->ptr)->typePtr = (yyval.typePtr);
6018                             smiCheckNamedNumbersOrder(parserPtr, (yyval.typePtr));
6019                         ;}
6020     break;
6021
6022   case 211:
6023 #line 3835 "parser-smi.y"
6024     {
6025                             Import *importPtr;
6026
6027                             defaultBasetype = SMI_BASETYPE_INTEGER32;
6028                             importPtr = findImportByName("Integer32",
6029                                                          thisModulePtr);
6030                             if (importPtr) {
6031                                 importPtr->use++;
6032                             } else {
6033                                 if (thisModulePtr->export.language ==
6034                                     SMI_LANGUAGE_SMIV2) {
6035                                     smiPrintError(thisParserPtr,
6036                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
6037                                                   "Integer32");
6038                                 } else if (thisModulePtr->export.language ==
6039                                            SMI_LANGUAGE_SPPI) {
6040                                     smiPrintError(thisParserPtr,
6041                                                   ERR_SPPI_BASETYPE_NOT_IMPORTED,
6042                                                   "Integer32");
6043                                 }
6044                             }
6045
6046                             /* TODO: any need to distinguish from INTEGER? */
6047                             (yyval.typePtr) = smiHandle->typeInteger32Ptr;
6048                         ;}
6049     break;
6050
6051   case 212:
6052 #line 3861 "parser-smi.y"
6053     {
6054                             defaultBasetype = SMI_BASETYPE_INTEGER32;
6055                         ;}
6056     break;
6057
6058   case 213:
6059 #line 3865 "parser-smi.y"
6060     {
6061                             Import *importPtr;
6062                             
6063                             importPtr = findImportByName("Integer32",
6064                                                          thisModulePtr);
6065                             if (importPtr) {
6066                                 importPtr->use++;
6067                             } else {
6068                                 if (thisModulePtr->export.language ==
6069                                     SMI_LANGUAGE_SMIV2) {
6070                                     smiPrintError(thisParserPtr,
6071                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
6072                                                   "Integer32");
6073                                 } else if (thisModulePtr->export.language ==
6074                                            SMI_LANGUAGE_SPPI) {
6075                                     smiPrintError(thisParserPtr,
6076                                                   ERR_SPPI_BASETYPE_NOT_IMPORTED,
6077                                                   "Integer32");
6078                                 }
6079                             }
6080
6081                             (yyval.typePtr) = duplicateType(smiHandle->typeInteger32Ptr, 0,
6082                                                thisParserPtr);
6083                             setTypeList((yyval.typePtr), (yyvsp[(3) - (3)].listPtr));
6084                             smiCheckTypeRanges(thisParserPtr, (yyval.typePtr));
6085                         ;}
6086     break;
6087
6088   case 214:
6089 #line 3892 "parser-smi.y"
6090     {
6091                             defaultBasetype = SMI_BASETYPE_ENUM;
6092                         ;}
6093     break;
6094
6095   case 215:
6096 #line 3896 "parser-smi.y"
6097     {
6098                             Type *parentPtr;
6099                             Import *importPtr;
6100                             List *p;
6101                             
6102                             parentPtr = findTypeByModuleAndName(
6103                                 thisParserPtr->modulePtr, (yyvsp[(1) - (3)].id));
6104                             if (!parentPtr) {
6105                                 importPtr = findImportByName((yyvsp[(1) - (3)].id),
6106                                                              thisModulePtr);
6107                                 if (importPtr &&
6108                                     importPtr->kind == KIND_TYPE) {
6109                                     importPtr->use++;
6110                                     parentPtr = findTypeByModulenameAndName(
6111                                         importPtr->export.module, (yyvsp[(1) - (3)].id));
6112                                 }
6113                             }
6114                             if (parentPtr) {
6115                                 if ((parentPtr->export.basetype !=
6116                                      SMI_BASETYPE_ENUM) &&
6117                                     (parentPtr->export.basetype !=
6118                                      SMI_BASETYPE_BITS)) {
6119                                     smiPrintError(thisParserPtr,
6120                                                   ERR_ILLEGAL_ENUM_FOR_PARENT_TYPE,
6121                                                   (yyvsp[(1) - (3)].id));
6122                                     (yyval.typePtr) = duplicateType(smiHandle->typeEnumPtr, 0,
6123                                                        thisParserPtr);
6124                                 } else {
6125                                     (yyval.typePtr) = duplicateType(parentPtr, 0,
6126                                                        thisParserPtr);
6127                                 }
6128                                 smiFree((yyvsp[(1) - (3)].id));
6129                             } else {
6130                                 /* 
6131                                  * forward referenced type. create it,
6132                                  * marked with FLAG_INCOMPLETE.
6133                                  */
6134                                 parentPtr = addType((yyvsp[(1) - (3)].id),
6135                                                     SMI_BASETYPE_UNKNOWN,
6136                                                     FLAG_INCOMPLETE,
6137                                                     thisParserPtr);
6138                                 (yyval.typePtr) = duplicateType(parentPtr, 0,
6139                                                    thisParserPtr);
6140                             }
6141                             setTypeList((yyval.typePtr), (yyvsp[(3) - (3)].listPtr));
6142                             for (p = (yyvsp[(3) - (3)].listPtr); p; p = p->nextPtr)
6143                                 ((NamedNumber *)p->ptr)->typePtr = (yyval.typePtr);
6144                             smiCheckNamedNumbersOrder(parserPtr, (yyval.typePtr));
6145                         ;}
6146     break;
6147
6148   case 216:
6149 #line 3947 "parser-smi.y"
6150     {
6151                             Type *parentPtr;
6152                             Import *importPtr;
6153                             List *p;
6154                             
6155                             defaultBasetype = SMI_BASETYPE_ENUM;
6156                             parentPtr = findTypeByModulenameAndName((yyvsp[(1) - (4)].id), (yyvsp[(3) - (4)].id));
6157                             if (!parentPtr) {
6158                                 importPtr =
6159                                     findImportByModulenameAndName((yyvsp[(1) - (4)].id),
6160                                                           (yyvsp[(3) - (4)].id), thisModulePtr);
6161                                 if (importPtr &&
6162                                     importPtr->kind == KIND_TYPE) {
6163                                     importPtr->use++;
6164                                     parentPtr =
6165                                         findTypeByModulenameAndName((yyvsp[(1) - (4)].id), (yyvsp[(3) - (4)].id));
6166                                 }
6167                             }
6168                             if (parentPtr) {
6169                                 if ((parentPtr->export.basetype !=
6170                                      SMI_BASETYPE_ENUM) &&
6171                                     (parentPtr->export.basetype !=
6172                                      SMI_BASETYPE_BITS)) {
6173                                     smiPrintError(thisParserPtr,
6174                                                   ERR_ILLEGAL_ENUM_FOR_PARENT_TYPE,
6175                                                   (yyvsp[(3) - (4)].id));
6176                                     (yyval.typePtr) = duplicateType(smiHandle->typeEnumPtr, 0,
6177                                                        thisParserPtr);
6178                                 } else {
6179                                     (yyval.typePtr) = duplicateType(parentPtr, 0,
6180                                                        thisParserPtr);
6181                                 }
6182                             } else {
6183                                 smiPrintError(thisParserPtr,
6184                                               ERR_UNKNOWN_TYPE, (yyvsp[(3) - (4)].id));
6185                                 (yyval.typePtr) = duplicateType(smiHandle->typeEnumPtr, 0,
6186                                                    thisParserPtr);
6187                             }
6188                             setTypeList((yyval.typePtr), (yyvsp[(4) - (4)].listPtr));
6189                             for (p = (yyvsp[(4) - (4)].listPtr); p; p = p->nextPtr)
6190                                 ((NamedNumber *)p->ptr)->typePtr = (yyval.typePtr);
6191                             smiCheckNamedNumbersOrder(parserPtr, (yyval.typePtr));
6192                             smiFree((yyvsp[(1) - (4)].id));
6193                             smiFree((yyvsp[(3) - (4)].id));
6194                         ;}
6195     break;
6196
6197   case 217:
6198 #line 3993 "parser-smi.y"
6199     {
6200                             Type *parentPtr;
6201                             Import *importPtr;
6202                             
6203                             parentPtr = findTypeByModuleAndName(
6204                                 thisParserPtr->modulePtr, (yyvsp[(1) - (2)].id));
6205                             if (!parentPtr) {
6206                                 importPtr = findImportByName((yyvsp[(1) - (2)].id),
6207                                                              thisModulePtr);
6208                                 if (importPtr &&
6209                                     importPtr->kind == KIND_TYPE) {
6210                                     importPtr->use++;
6211                                     parentPtr = findTypeByModulenameAndName(
6212                                         importPtr->export.module, (yyvsp[(1) - (2)].id));
6213                                 }
6214                             }
6215                             if (parentPtr) {
6216                                 if ((parentPtr->export.basetype !=
6217                                     SMI_BASETYPE_INTEGER32) &&
6218                                     (parentPtr->export.basetype !=
6219                                      SMI_BASETYPE_INTEGER64) &&
6220                                     (parentPtr->export.basetype !=
6221                                      SMI_BASETYPE_UNSIGNED32) &&
6222                                     (parentPtr->export.basetype !=
6223                                      SMI_BASETYPE_UNSIGNED64)) {
6224                                     smiPrintError(thisParserPtr,
6225                                              ERR_ILLEGAL_RANGE_FOR_PARENT_TYPE,
6226                                                   (yyvsp[(1) - (2)].id));
6227                                     (yyval.typePtr) = duplicateType(smiHandle->typeInteger32Ptr, 0,
6228                                                        thisParserPtr);
6229                                     defaultBasetype = SMI_BASETYPE_INTEGER32;
6230                                 } else {
6231                                     defaultBasetype =
6232                                         parentPtr->export.basetype;
6233                                     (yyval.typePtr) = duplicateType(parentPtr, 0,
6234                                                        thisParserPtr);
6235                                 }
6236                                 smiFree((yyvsp[(1) - (2)].id));
6237                             } else {
6238                                 /* 
6239                                  * forward referenced type. create it,
6240                                  * marked with FLAG_INCOMPLETE.
6241                                  */
6242                                 parentPtr = addType((yyvsp[(1) - (2)].id),
6243                                                     SMI_BASETYPE_UNKNOWN,
6244                                                     FLAG_INCOMPLETE,
6245                                                     thisParserPtr);
6246                                 (yyval.typePtr) = duplicateType(parentPtr, 0,
6247                                                    thisParserPtr);
6248                                 defaultBasetype = SMI_BASETYPE_INTEGER32;
6249                             }
6250                             setTypeList((yyval.typePtr), (yyvsp[(2) - (2)].listPtr));
6251                             smiCheckTypeRanges(thisParserPtr, (yyval.typePtr));
6252                         ;}
6253     break;
6254
6255   case 218:
6256 #line 4049 "parser-smi.y"
6257     {
6258                             Type *parentPtr;
6259                             Import *importPtr;
6260                             
6261                             parentPtr = findTypeByModulenameAndName((yyvsp[(1) - (4)].id), (yyvsp[(3) - (4)].id));
6262                             if (!parentPtr) {
6263                                 importPtr = findImportByModulenameAndName((yyvsp[(1) - (4)].id),
6264                                                           (yyvsp[(3) - (4)].id), thisModulePtr);
6265                                 if (importPtr &&
6266                                     importPtr->kind == KIND_TYPE) {
6267                                     importPtr->use++;
6268                                     parentPtr = findTypeByModulenameAndName(
6269                                         (yyvsp[(1) - (4)].id), (yyvsp[(3) - (4)].id));
6270                                 }
6271                             }
6272                             if (parentPtr) {
6273                                 if ((parentPtr->export.basetype !=
6274                                     SMI_BASETYPE_INTEGER32) &&
6275                                     (parentPtr->export.basetype !=
6276                                      SMI_BASETYPE_INTEGER64) &&
6277                                     (parentPtr->export.basetype !=
6278                                      SMI_BASETYPE_UNSIGNED32) &&
6279                                     (parentPtr->export.basetype !=
6280                                      SMI_BASETYPE_UNSIGNED64)) {
6281                                     smiPrintError(thisParserPtr,
6282                                              ERR_ILLEGAL_RANGE_FOR_PARENT_TYPE,
6283                                                   (yyvsp[(3) - (4)].id));
6284                                     (yyval.typePtr) = duplicateType(smiHandle->typeInteger32Ptr, 0,
6285                                                        thisParserPtr);
6286                                     defaultBasetype = SMI_BASETYPE_INTEGER32;
6287                                 } else {
6288                                     defaultBasetype =
6289                                         parentPtr->export.basetype;
6290                                     (yyval.typePtr) = duplicateType(parentPtr, 0,
6291                                                        thisParserPtr);
6292                                 }
6293                             } else {
6294                                 smiPrintError(thisParserPtr,
6295                                               ERR_UNKNOWN_TYPE, (yyvsp[(3) - (4)].id));
6296                                 (yyval.typePtr) = duplicateType(smiHandle->typeInteger32Ptr, 0,
6297                                                    thisParserPtr);
6298                                 defaultBasetype = SMI_BASETYPE_INTEGER32;
6299                             }
6300                             setTypeList((yyval.typePtr), (yyvsp[(4) - (4)].listPtr));
6301                             smiCheckTypeRanges(thisParserPtr, (yyval.typePtr));
6302                             smiFree((yyvsp[(1) - (4)].id));
6303                             smiFree((yyvsp[(3) - (4)].id));
6304                         ;}
6305     break;
6306
6307   case 219:
6308 #line 4098 "parser-smi.y"
6309     {
6310                             defaultBasetype = SMI_BASETYPE_OCTETSTRING;
6311                             (yyval.typePtr) = smiHandle->typeOctetStringPtr;
6312                         ;}
6313     break;
6314
6315   case 220:
6316 #line 4103 "parser-smi.y"
6317     {
6318                             defaultBasetype = SMI_BASETYPE_OCTETSTRING;
6319                         ;}
6320     break;
6321
6322   case 221:
6323 #line 4107 "parser-smi.y"
6324     {
6325                             
6326                             (yyval.typePtr) = duplicateType(smiHandle->typeOctetStringPtr, 0,
6327                                                thisParserPtr);
6328                             setTypeList((yyval.typePtr), (yyvsp[(4) - (4)].listPtr));
6329                             smiCheckTypeRanges(thisParserPtr, (yyval.typePtr));
6330                         ;}
6331     break;
6332
6333   case 222:
6334 #line 4115 "parser-smi.y"
6335     {
6336                             Type *parentPtr;
6337                             Import *importPtr;
6338                             
6339                             defaultBasetype = SMI_BASETYPE_OCTETSTRING;
6340                             parentPtr = findTypeByModuleAndName(
6341                                 thisParserPtr->modulePtr, (yyvsp[(1) - (2)].id));
6342                             if (!parentPtr) {
6343                                 importPtr = findImportByName((yyvsp[(1) - (2)].id),
6344                                                              thisModulePtr);
6345                                 if (importPtr &&
6346                                     importPtr->kind == KIND_TYPE) {
6347                                     importPtr->use++;
6348                                     parentPtr = findTypeByModulenameAndName(
6349                                         importPtr->export.module, (yyvsp[(1) - (2)].id));
6350                                 }
6351                             }
6352                             if (parentPtr) {
6353                                 if (parentPtr->export.basetype !=
6354                                     SMI_BASETYPE_OCTETSTRING) {
6355                                     smiPrintError(thisParserPtr,
6356                                               ERR_ILLEGAL_SIZE_FOR_PARENT_TYPE,
6357                                                   (yyvsp[(1) - (2)].id));
6358                                     (yyval.typePtr) = duplicateType(smiHandle->typeOctetStringPtr, 0,
6359                                                        thisParserPtr);
6360                                 } else {
6361                                     (yyval.typePtr) = duplicateType(parentPtr, 0,
6362                                                        thisParserPtr);
6363                                 }
6364                                 smiFree((yyvsp[(1) - (2)].id));
6365                             } else {
6366                                 /* 
6367                                  * forward referenced type. create it,
6368                                  * marked with FLAG_INCOMPLETE.
6369                                  */
6370                                 parentPtr = addType((yyvsp[(1) - (2)].id),
6371                                                     SMI_BASETYPE_UNKNOWN,
6372                                                     FLAG_INCOMPLETE,
6373                                                     thisParserPtr);
6374                                 (yyval.typePtr) = duplicateType(parentPtr, 0,
6375                                                    thisParserPtr);
6376                             }
6377                             setTypeList((yyval.typePtr), (yyvsp[(2) - (2)].listPtr));
6378                             smiCheckTypeRanges(thisParserPtr, (yyval.typePtr));
6379                         ;}
6380     break;
6381
6382   case 223:
6383 #line 4162 "parser-smi.y"
6384     {
6385                             Type *parentPtr;
6386                             Import *importPtr;
6387                             
6388                             defaultBasetype = SMI_BASETYPE_OCTETSTRING;
6389                             parentPtr = findTypeByModulenameAndName((yyvsp[(1) - (4)].id), (yyvsp[(3) - (4)].id));
6390                             if (!parentPtr) {
6391                                 importPtr = findImportByModulenameAndName((yyvsp[(1) - (4)].id),
6392                                                           (yyvsp[(3) - (4)].id), thisModulePtr);
6393                                 if (importPtr &&
6394                                     importPtr->kind == KIND_TYPE) {
6395                                     importPtr->use++;
6396                                     parentPtr = findTypeByModulenameAndName(
6397                                         (yyvsp[(1) - (4)].id), (yyvsp[(3) - (4)].id));
6398                                 }
6399                             }
6400                             if (parentPtr) {
6401                                 if (parentPtr->export.basetype !=
6402                                     SMI_BASETYPE_OCTETSTRING) {
6403                                     smiPrintError(thisParserPtr,
6404                                               ERR_ILLEGAL_SIZE_FOR_PARENT_TYPE,
6405                                                   (yyvsp[(3) - (4)].id));
6406                                     (yyval.typePtr) = duplicateType(smiHandle->typeOctetStringPtr, 0,
6407                                                        thisParserPtr);
6408                                 } else {
6409                                     (yyval.typePtr) = duplicateType(parentPtr, 0,
6410                                                        thisParserPtr);
6411                                 }
6412                             } else {
6413                                 smiPrintError(thisParserPtr,
6414                                               ERR_UNKNOWN_TYPE, (yyvsp[(3) - (4)].id));
6415                                 (yyval.typePtr) = duplicateType(smiHandle->typeOctetStringPtr, 0,
6416                                                    thisParserPtr);
6417                             }
6418                             setTypeList((yyval.typePtr), (yyvsp[(4) - (4)].listPtr));
6419                             smiCheckTypeRanges(thisParserPtr, (yyval.typePtr));
6420                             smiFree((yyvsp[(1) - (4)].id));
6421                             smiFree((yyvsp[(3) - (4)].id));
6422                         ;}
6423     break;
6424
6425   case 224:
6426 #line 4202 "parser-smi.y"
6427     {
6428                             defaultBasetype = SMI_BASETYPE_OBJECTIDENTIFIER;
6429                             (yyval.typePtr) = smiHandle->typeObjectIdentifierPtr;
6430                         ;}
6431     break;
6432
6433   case 225:
6434 #line 4210 "parser-smi.y"
6435     {
6436                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
6437                             (yyval.valuePtr)->basetype = SMI_BASETYPE_UNSIGNED32;
6438                             (yyval.valuePtr)->value.unsigned32 = (yyvsp[(1) - (1)].unsigned32);
6439                         ;}
6440     break;
6441
6442   case 226:
6443 #line 4216 "parser-smi.y"
6444     {
6445                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
6446                             (yyval.valuePtr)->basetype = SMI_BASETYPE_INTEGER32;
6447                             (yyval.valuePtr)->value.integer32 = (yyvsp[(1) - (1)].integer32);
6448                         ;}
6449     break;
6450
6451   case 227:
6452 #line 4222 "parser-smi.y"
6453     {   
6454                             /* The scanner already checks for the language */
6455                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
6456                             (yyval.valuePtr)->basetype = SMI_BASETYPE_UNSIGNED64;
6457                             (yyval.valuePtr)->value.unsigned64 = (yyvsp[(1) - (1)].unsigned64);
6458                         ;}
6459     break;
6460
6461   case 228:
6462 #line 4229 "parser-smi.y"
6463     {
6464                             /* The scanner already checks for the language */
6465                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
6466                             (yyval.valuePtr)->basetype = SMI_BASETYPE_INTEGER64;
6467                             (yyval.valuePtr)->value.integer64 = (yyvsp[(1) - (1)].integer64);
6468                         ;}
6469     break;
6470
6471   case 229:
6472 #line 4236 "parser-smi.y"
6473     {
6474                             char s[9];
6475                             int i, len, j;
6476                             
6477                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
6478                             if (defaultBasetype == SMI_BASETYPE_OCTETSTRING) {
6479                                 (yyval.valuePtr)->basetype = SMI_BASETYPE_OCTETSTRING;
6480                                 len = strlen((yyvsp[(1) - (1)].text));
6481                                 (yyval.valuePtr)->value.ptr =
6482                                     smiMalloc((len+7)/8+1);
6483                                 for (i = 0; i < len; i += 8) {
6484                                     strncpy(s, &(yyvsp[(1) - (1)].text)[i], 8);
6485                                     for (j = 1; j < 8; j++) {
6486                                         if (!s[j]) s[j] = '0';
6487                                     }
6488                                     s[8] = 0;
6489                                     (yyval.valuePtr)->value.ptr[i/8] =
6490                                         (unsigned char)strtol(s, 0, 2);
6491                                 }
6492                                 (yyval.valuePtr)->len = (len+7)/8;
6493                             } else {
6494                                 (yyval.valuePtr)->basetype = SMI_BASETYPE_UNSIGNED32;
6495                                 (yyval.valuePtr)->value.unsigned32 = strtoul((yyvsp[(1) - (1)].text), NULL, 2);
6496                             }
6497                         ;}
6498     break;
6499
6500   case 230:
6501 #line 4262 "parser-smi.y"
6502     {
6503                             char s[3];
6504                             int i, len;
6505                             
6506                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
6507                             if (defaultBasetype == SMI_BASETYPE_OCTETSTRING) {
6508                                 (yyval.valuePtr)->basetype = SMI_BASETYPE_OCTETSTRING;
6509                                 len = strlen((yyvsp[(1) - (1)].text));
6510                                 (yyval.valuePtr)->value.ptr = smiMalloc((len+1)/2+1);
6511                                 for (i = 0; i < len; i += 2) {
6512                                     strncpy(s, &(yyvsp[(1) - (1)].text)[i], 2);
6513                                     if (!s[1]) s[1] = '0';
6514                                     s[2] = 0;
6515                                     (yyval.valuePtr)->value.ptr[i/2] =
6516                                         (unsigned char)strtol(s, 0, 16);
6517                                 }
6518                                 (yyval.valuePtr)->len = (len+1)/2;
6519                             } else {
6520                                 (yyval.valuePtr)->basetype = SMI_BASETYPE_UNSIGNED32;
6521                                 (yyval.valuePtr)->value.unsigned32 = strtoul((yyvsp[(1) - (1)].text), NULL, 16);
6522                             }
6523                         ;}
6524     break;
6525
6526   case 231:
6527 #line 4285 "parser-smi.y"
6528     {
6529                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
6530                             if ((defaultBasetype != SMI_BASETYPE_ENUM) &&
6531                                 (defaultBasetype != SMI_BASETYPE_OBJECTIDENTIFIER)) {
6532                                 smiPrintError(thisParserPtr, ERR_DEFVAL_SYNTAX);
6533                                 (yyval.valuePtr)->basetype = defaultBasetype;
6534                                 if (defaultBasetype == SMI_BASETYPE_ENUM) {
6535                                     (yyval.valuePtr)->len = 1;
6536                                     (yyval.valuePtr)->value.unsigned32 = 0;
6537                                 } else {
6538                                     (yyval.valuePtr)->len = 0;
6539                                     (yyval.valuePtr)->value.ptr = NULL;
6540                                 }
6541                             } else {
6542                                 (yyval.valuePtr)->basetype = defaultBasetype;
6543                                 (yyval.valuePtr)->len = -1;  /* indicates unresolved ptr */
6544                                 (yyval.valuePtr)->value.ptr = (yyvsp[(1) - (1)].id); /* JS: needs strdup? */
6545                             }
6546                         ;}
6547     break;
6548
6549   case 232:
6550 #line 4305 "parser-smi.y"
6551     {
6552                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
6553                             (yyval.valuePtr)->basetype = SMI_BASETYPE_OCTETSTRING;
6554                             (yyval.valuePtr)->value.ptr = smiStrdup((yyvsp[(1) - (1)].text));
6555                             (yyval.valuePtr)->len = strlen((yyvsp[(1) - (1)].text));
6556                         ;}
6557     break;
6558
6559   case 233:
6560 #line 4328 "parser-smi.y"
6561     {
6562                             /*
6563                              * SMIv1 allows something like { 0 0 } !
6564                              * SMIv2 does not!
6565                              */
6566                             /* TODO: make it work correctly for SMIv1 */
6567                             if (thisModulePtr->export.language == SMI_LANGUAGE_SMIV2) {
6568                                 smiPrintError(thisParserPtr,
6569                                               ERR_OID_DEFVAL_TOO_LONG_SMIV2);
6570                             } else {
6571                                 smiPrintError(thisParserPtr,
6572                                               ERR_OID_DEFVAL_TOO_LONG_SMIV1);
6573                             }
6574                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
6575                             (yyval.valuePtr)->basetype = SMI_BASETYPE_OBJECTIDENTIFIER;
6576                             (yyval.valuePtr)->len = 2;
6577                             (yyval.valuePtr)->value.oid = smiMalloc(2 * sizeof(SmiSubid));
6578                             (yyval.valuePtr)->value.oid[0] = 0;
6579                             (yyval.valuePtr)->value.oid[1] = 0;
6580                         ;}
6581     break;
6582
6583   case 234:
6584 #line 4355 "parser-smi.y"
6585     {
6586                             (yyval.typePtr) = smiHandle->typeInteger32Ptr;
6587                         ;}
6588     break;
6589
6590   case 235:
6591 #line 4359 "parser-smi.y"
6592     {
6593                             Import *importPtr;
6594                             
6595                             /* TODO: any need to distinguish from INTEGER? */
6596                             (yyval.typePtr) = smiHandle->typeInteger32Ptr;
6597
6598                             importPtr = findImportByName("Integer32",
6599                                                          thisModulePtr);
6600                             if (importPtr) {
6601                                 importPtr->use++;
6602                             } else {
6603                                 if (thisModulePtr->export.language ==
6604                                     SMI_LANGUAGE_SMIV2) {
6605                                     smiPrintError(thisParserPtr,
6606                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
6607                                                   "Integer32");
6608                                 } else if (thisModulePtr->export.language ==
6609                                            SMI_LANGUAGE_SPPI) {
6610                                     smiPrintError(thisParserPtr,
6611                                                   ERR_SPPI_BASETYPE_NOT_IMPORTED,
6612                                                   "Integer32");
6613                                 }
6614                             }
6615                         ;}
6616     break;
6617
6618   case 236:
6619 #line 4384 "parser-smi.y"
6620     {
6621                             (yyval.typePtr) = smiHandle->typeOctetStringPtr;
6622                         ;}
6623     break;
6624
6625   case 237:
6626 #line 4388 "parser-smi.y"
6627     {
6628                             (yyval.typePtr) = smiHandle->typeObjectIdentifierPtr;
6629                         ;}
6630     break;
6631
6632   case 238:
6633 #line 4394 "parser-smi.y"
6634     {
6635                             Import *importPtr;
6636                             
6637                             (yyval.typePtr) = findTypeByName("IpAddress");
6638                             if (! (yyval.typePtr)) {
6639                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
6640                                               "IpAddress");
6641                             }
6642                             
6643                             importPtr = findImportByName("IpAddress",
6644                                                          thisModulePtr);
6645                             if (importPtr) {
6646                                 importPtr->use++;
6647                             } else {
6648                                 if (thisModulePtr->export.language ==
6649                                     SMI_LANGUAGE_SMIV2) {
6650                                     smiPrintError(thisParserPtr,
6651                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
6652                                                   "IpAddress");
6653                                 } else if (thisModulePtr->export.language ==
6654                                            SMI_LANGUAGE_SPPI) {
6655                                     smiPrintError(thisParserPtr,
6656                                                   ERR_SPPI_BASETYPE_NOT_IMPORTED,
6657                                                   "IpAddress");
6658                                 }
6659                             }
6660                         ;}
6661     break;
6662
6663   case 239:
6664 #line 4422 "parser-smi.y"
6665     {
6666                             Import *importPtr;
6667
6668                             if ((thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI) &&
6669                                 !findImportByName("Counter32", thisParserPtr->modulePtr))
6670                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "COUNTER32");
6671                             (yyval.typePtr) = findTypeByName("Counter32");
6672                             if (! (yyval.typePtr)) {
6673                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
6674                                               "Counter32");
6675                             }
6676                             
6677                             importPtr = findImportByName("Counter32",
6678                                                          thisModulePtr);
6679                             if (importPtr) {
6680                                 importPtr->use++;
6681                             } else {
6682                                 if (thisModulePtr->export.language ==
6683                                     SMI_LANGUAGE_SMIV2) {
6684                                     smiPrintError(thisParserPtr,
6685                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
6686                                                   "Counter32");
6687                                 }
6688                             }
6689                         ;}
6690     break;
6691
6692   case 240:
6693 #line 4448 "parser-smi.y"
6694     {
6695                             Import *importPtr;
6696                             List *listPtr, *nextListPtr;
6697                             
6698                             smiPrintError(thisParserPtr,
6699                                           ERR_ILLEGAL_RANGE_FOR_COUNTER,
6700                                           "Counter32");
6701                             for (listPtr = (yyvsp[(2) - (2)].listPtr); listPtr;
6702                                  listPtr = nextListPtr) {
6703                                 nextListPtr = listPtr->nextPtr;
6704                                 smiFree((Range *)listPtr->ptr);
6705                                 smiFree(listPtr);
6706                             }
6707                             
6708                             if ((thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI) &&
6709                                 !findImportByName("Counter32", thisParserPtr->modulePtr))
6710                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "Counter32");
6711                             (yyval.typePtr) = findTypeByName("Counter32");
6712                             if (! (yyval.typePtr)) {
6713                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
6714                                               "Counter32");
6715                             }
6716                             
6717                             importPtr = findImportByName("Counter32",
6718                                                          thisModulePtr);
6719                             if (importPtr) {
6720                                 importPtr->use++;
6721                             } else {
6722                                 if (thisModulePtr->export.language ==
6723                                     SMI_LANGUAGE_SMIV2) {
6724                                     smiPrintError(thisParserPtr,
6725                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
6726                                                   "Counter32");
6727                                 }
6728                             }
6729                         ;}
6730     break;
6731
6732   case 241:
6733 #line 4485 "parser-smi.y"
6734     {
6735                             Import *importPtr;
6736
6737                             if ((thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI) &&
6738                                 !findImportByName("Gauge32", thisParserPtr->modulePtr))
6739                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "Gauge32");
6740                             (yyval.typePtr) = findTypeByName("Gauge32");
6741                             if (! (yyval.typePtr)) {
6742                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
6743                                               "Gauge32");
6744                             }
6745                             
6746                             importPtr = findImportByName("Gauge32",
6747                                                          thisModulePtr);
6748                             if (importPtr) {
6749                                 importPtr->use++;
6750                             } else {
6751                                 if (thisModulePtr->export.language ==
6752                                     SMI_LANGUAGE_SMIV2) {
6753                                     smiPrintError(thisParserPtr,
6754                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
6755                                                   "Gauge32");
6756                                 }
6757                             }
6758                         ;}
6759     break;
6760
6761   case 242:
6762 #line 4511 "parser-smi.y"
6763     {
6764                             Type *parentPtr;
6765                             Import *importPtr;
6766                             
6767                             if ((thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI) &&
6768                                 !findImportByName("Gauge32", thisParserPtr->modulePtr))
6769                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "Gauge32");
6770                             parentPtr = findTypeByName("Gauge32");
6771                             if (! parentPtr) {
6772                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
6773                                               "Gauge32");
6774                                 (yyval.typePtr) = NULL;
6775                             } else {
6776                                 (yyval.typePtr) = duplicateType(parentPtr, 0,
6777                                                    thisParserPtr);
6778                                 setTypeList((yyval.typePtr), (yyvsp[(2) - (2)].listPtr));
6779                                 smiCheckTypeRanges(thisParserPtr, (yyval.typePtr));
6780                             }
6781                             
6782                             importPtr = findImportByName("Gauge32",
6783                                                          thisModulePtr);
6784                             if (importPtr) {
6785                                 importPtr->use++;
6786                             } else {
6787                                 if (thisModulePtr->export.language ==
6788                                     SMI_LANGUAGE_SMIV2) {
6789                                     smiPrintError(thisParserPtr,
6790                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
6791                                                   "Gauge32");
6792                                 }
6793                             }
6794                         ;}
6795     break;
6796
6797   case 243:
6798 #line 4544 "parser-smi.y"
6799     {
6800                             Import *importPtr;
6801
6802                             (yyval.typePtr) = smiHandle->typeUnsigned32Ptr;
6803                             
6804                             importPtr = findImportByName("Unsigned32",
6805                                                          thisModulePtr);
6806                             if (importPtr) {
6807                                 importPtr->use++;
6808                             } else {
6809                                 if (thisModulePtr->export.language ==
6810                                     SMI_LANGUAGE_SMIV2) {
6811                                     smiPrintError(thisParserPtr,
6812                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
6813                                                   "Unsigned32");
6814                                 } else if (thisModulePtr->export.language ==
6815                                            SMI_LANGUAGE_SPPI) {
6816                                     smiPrintError(thisParserPtr,
6817                                                   ERR_SPPI_BASETYPE_NOT_IMPORTED,
6818                                                   "Unsigned32");
6819                                 }
6820                             }
6821                         ;}
6822     break;
6823
6824   case 244:
6825 #line 4568 "parser-smi.y"
6826     {
6827                             Import *importPtr;
6828                             
6829                             (yyval.typePtr) = duplicateType(smiHandle->typeUnsigned32Ptr, 0,
6830                                                thisParserPtr);
6831                             setTypeList((yyval.typePtr), (yyvsp[(2) - (2)].listPtr));
6832                             smiCheckTypeRanges(thisParserPtr, (yyval.typePtr));
6833
6834                             importPtr = findImportByName("Unsigned32",
6835                                                          thisModulePtr);
6836                             if (importPtr) {
6837                                 importPtr->use++;
6838                             } else {
6839                                 if (thisModulePtr->export.language ==
6840                                     SMI_LANGUAGE_SMIV2) {
6841                                     smiPrintError(thisParserPtr,
6842                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
6843                                                   "Unsigned32");
6844                                 } else if (thisModulePtr->export.language ==
6845                                            SMI_LANGUAGE_SPPI) {
6846                                     smiPrintError(thisParserPtr,
6847                                                   ERR_SPPI_BASETYPE_NOT_IMPORTED,
6848                                                   "Unsigned32");
6849                                 }
6850                             }
6851                         ;}
6852     break;
6853
6854   case 245:
6855 #line 4595 "parser-smi.y"
6856     {
6857                             Import *importPtr;
6858                             
6859                             (yyval.typePtr) = findTypeByName("TimeTicks");
6860                             if (! (yyval.typePtr)) {
6861                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
6862                                               "TimeTicks");
6863                             }
6864                             
6865                             importPtr = findImportByName("TimeTicks",
6866                                                          thisModulePtr);
6867                             if (importPtr) {
6868                                 importPtr->use++;
6869                             } else {
6870                                 if (thisModulePtr->export.language ==
6871                                     SMI_LANGUAGE_SMIV2) {
6872                                     smiPrintError(thisParserPtr,
6873                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
6874                                                   "TimeTicks");
6875                                 } else if (thisModulePtr->export.language ==
6876                                            SMI_LANGUAGE_SPPI) {
6877                                     smiPrintError(thisParserPtr,
6878                                                   ERR_SPPI_BASETYPE_NOT_IMPORTED,
6879                                                   "TimeTicks");
6880                                 }
6881                             }
6882                         ;}
6883     break;
6884
6885   case 246:
6886 #line 4623 "parser-smi.y"
6887     {
6888                             Import *importPtr;
6889                             
6890                             (yyval.typePtr) = findTypeByName("Opaque");
6891                             if (! (yyval.typePtr)) {
6892                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
6893                                               "Opaque");
6894                             } else {
6895                                 if (thisModulePtr->export.language ==
6896                                     SMI_LANGUAGE_SMIV2) {
6897                                     smiPrintError(thisParserPtr,
6898                                                   ERR_SMIV2_OPAQUE_OBSOLETE);
6899                                 } else if (thisModulePtr->export.language ==
6900                                            SMI_LANGUAGE_SPPI) {
6901                                     smiPrintError(thisParserPtr,
6902                                                   ERR_SPPI_OPAQUE_OBSOLETE);
6903                                 }
6904                             }
6905                             
6906                             importPtr = findImportByName("Opaque",
6907                                                          thisModulePtr);
6908                             if (importPtr) {
6909                                 importPtr->use++;
6910                             } else {
6911                                 if (thisModulePtr->export.language ==
6912                                     SMI_LANGUAGE_SMIV2) {
6913                                     smiPrintError(thisParserPtr,
6914                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
6915                                                   "Opaque");
6916                                 } else if (thisModulePtr->export.language ==
6917                                            SMI_LANGUAGE_SPPI) {
6918                                     smiPrintError(thisParserPtr,
6919                                                   ERR_SPPI_BASETYPE_NOT_IMPORTED,
6920                                                   "Opaque");
6921                                 }
6922                             }
6923                         ;}
6924     break;
6925
6926   case 247:
6927 #line 4661 "parser-smi.y"
6928     {
6929                             Type *parentPtr;
6930                             Import *importPtr;
6931                             
6932                             parentPtr = findTypeByName("Opaque");
6933                             if (! parentPtr) {
6934                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
6935                                               "Opaque");
6936                                 (yyval.typePtr) = NULL;
6937                             } else {
6938                                 if (thisModulePtr->export.language ==
6939                                     SMI_LANGUAGE_SMIV2) {
6940                                     smiPrintError(thisParserPtr,
6941                                                   ERR_SMIV2_OPAQUE_OBSOLETE,
6942                                                   "Opaque");
6943                                 } else if (thisModulePtr->export.language ==
6944                                            SMI_LANGUAGE_SPPI) {
6945                                     smiPrintError(thisParserPtr,
6946                                                   ERR_SPPI_OPAQUE_OBSOLETE,
6947                                                   "Opaque");
6948                                 }
6949                                 (yyval.typePtr) = duplicateType(parentPtr, 0,
6950                                                    thisParserPtr);
6951                                 setTypeList((yyval.typePtr), (yyvsp[(2) - (2)].listPtr));
6952                                 smiCheckTypeRanges(thisParserPtr, (yyval.typePtr));
6953                             }
6954
6955                             importPtr = findImportByName("Opaque",
6956                                                          thisModulePtr);
6957                             if (importPtr) {
6958                                 importPtr->use++;
6959                             } else {
6960                                 if (thisModulePtr->export.language ==
6961                                     SMI_LANGUAGE_SMIV2) {
6962                                     smiPrintError(thisParserPtr,
6963                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
6964                                                   "Opaque");
6965                                 } else if (thisModulePtr->export.language ==
6966                                            SMI_LANGUAGE_SPPI) {
6967                                     smiPrintError(thisParserPtr,
6968                                                   ERR_SPPI_BASETYPE_NOT_IMPORTED,
6969                                                   "Opaque");
6970                                 }
6971                             }
6972                         ;}
6973     break;
6974
6975   case 248:
6976 #line 4707 "parser-smi.y"
6977     {
6978                             Import *importPtr;
6979
6980                             if ((thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI) &&
6981                                 !findImportByName("Counter64", thisParserPtr->modulePtr))
6982                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "Counter64");
6983                             (yyval.typePtr) = findTypeByName("Counter64");
6984                             if (! (yyval.typePtr)) {
6985                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
6986                                               "Counter64");
6987                             }
6988
6989                             importPtr = findImportByName("Counter64",
6990                                                          thisModulePtr);
6991                             if (importPtr) {
6992                                 importPtr->use++;
6993                             } else {
6994                                 if (thisModulePtr->export.language ==
6995                                     SMI_LANGUAGE_SMIV2) {
6996                                     smiPrintError(thisParserPtr,
6997                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
6998                                                   "Counter64");
6999                                 }
7000                             }
7001                         ;}
7002     break;
7003
7004   case 249:
7005 #line 4733 "parser-smi.y"
7006     {
7007                             Import *importPtr;
7008                             List *listPtr, *nextListPtr;
7009                             
7010                             smiPrintError(thisParserPtr,
7011                                           ERR_ILLEGAL_RANGE_FOR_COUNTER,
7012                                           "Counter64");
7013                             for (listPtr = (yyvsp[(2) - (2)].listPtr); listPtr;
7014                                  listPtr = nextListPtr) {
7015                                 nextListPtr = listPtr->nextPtr;
7016                                 smiFree((Range *)listPtr->ptr);
7017                                 smiFree(listPtr);
7018                             }
7019                             
7020                             if ((thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI) &&
7021                                 !findImportByName("Counter64", thisParserPtr->modulePtr))
7022                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "Counter64");
7023                             (yyval.typePtr) = findTypeByName("Counter64");
7024                             if (! (yyval.typePtr)) {
7025                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
7026                                               "Counter64");
7027                             }
7028
7029                             importPtr = findImportByName("Counter64",
7030                                                          thisModulePtr);
7031                             if (importPtr) {
7032                                 importPtr->use++;
7033                             } else {
7034                                 if (thisModulePtr->export.language ==
7035                                     SMI_LANGUAGE_SMIV2) {
7036                                     smiPrintError(thisParserPtr,
7037                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
7038                                                   "Counter64");
7039                                 }
7040                             }
7041                         ;}
7042     break;
7043
7044   case 250:
7045 #line 4770 "parser-smi.y"
7046     {
7047                             Import *importPtr;
7048
7049                             (yyval.typePtr) = findTypeByModulenameAndName(
7050                                 thisParserPtr->modulePtr->export.name, "Integer64");
7051                             if (! (yyval.typePtr)) {
7052                                 importPtr = findImportByName("Integer64",
7053                                                              thisModulePtr);
7054                                 if (!importPtr) {
7055                                     (yyval.typePtr) = findTypeByName("Integer64");
7056                                     if ((thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)) {
7057                                         smiPrintError(thisParserPtr, ERR_SPPI_CONSTRUCT_IN_MIB, "Integer64");
7058                                     } else {
7059                                         smiPrintError(thisParserPtr,
7060                                                       ERR_SPPI_BASETYPE_NOT_IMPORTED,
7061                                                       "Integer64");
7062                                     }
7063                                 } else {
7064                                     importPtr->use++;
7065                                     (yyval.typePtr) = findTypeByModulenameAndName(
7066                                         importPtr->export.module,
7067                                         importPtr->export.name);
7068                                 }
7069                             }
7070                         ;}
7071     break;
7072
7073   case 251:
7074 #line 4796 "parser-smi.y"
7075     {
7076                             Type *parentPtr;
7077                             Import *importPtr;
7078                             
7079                             parentPtr = findTypeByModulenameAndName(
7080                                 thisParserPtr->modulePtr->export.name, "Integer64");
7081                             if (! parentPtr) {
7082                                 importPtr = findImportByName("Integer64",
7083                                                              thisModulePtr);
7084                                 if (!importPtr) {
7085                                     parentPtr = findTypeByName("Integer64");
7086                                     if ((thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)) {
7087                                         smiPrintError(thisParserPtr, ERR_SPPI_CONSTRUCT_IN_MIB, "Integer64");
7088                                     } else {
7089                                         smiPrintError(thisParserPtr,
7090                                                       ERR_SPPI_BASETYPE_NOT_IMPORTED,
7091                                                       "Integer64");
7092                                     }
7093                                 } else {
7094                                     importPtr->use++;
7095                                     parentPtr = findTypeByModulenameAndName(
7096                                         importPtr->export.module,
7097                                         importPtr->export.name);
7098                                 }
7099                             }
7100                             if (! parentPtr) {
7101                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
7102                                               "Integer64");
7103                                 (yyval.typePtr) = NULL;
7104                             } else {
7105                                 (yyval.typePtr) = duplicateType(parentPtr, 0,
7106                                                    thisParserPtr);
7107                                 setTypeList((yyval.typePtr), (yyvsp[(2) - (2)].listPtr));
7108                                 smiCheckTypeRanges(thisParserPtr, (yyval.typePtr));
7109                             }
7110                         ;}
7111     break;
7112
7113   case 252:
7114 #line 4833 "parser-smi.y"
7115     {
7116                             Import *importPtr;
7117
7118                             (yyval.typePtr) = findTypeByModulenameAndName(
7119                                 thisParserPtr->modulePtr->export.name, "Unsigned64");
7120                             if (! (yyval.typePtr)) {
7121                                 importPtr = findImportByName("Unsigned64",
7122                                                              thisModulePtr);
7123                                 if (!importPtr) {
7124                                     (yyval.typePtr) = findTypeByName("Unsigned64");
7125                                     if ((thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)) {
7126                                         smiPrintError(thisParserPtr, ERR_SPPI_CONSTRUCT_IN_MIB, "Unsigned64");
7127                                     } else {
7128                                         smiPrintError(thisParserPtr,
7129                                                       ERR_SPPI_BASETYPE_NOT_IMPORTED,
7130                                                       "Unsigned64");
7131                                     }
7132                                 } else {
7133                                     importPtr->use++;
7134                                     (yyval.typePtr) = findTypeByModulenameAndName(
7135                                         importPtr->export.module,
7136                                         importPtr->export.name);
7137                                 }
7138                             }
7139                         ;}
7140     break;
7141
7142   case 253:
7143 #line 4859 "parser-smi.y"
7144     {
7145                             Type *parentPtr;
7146                             Import *importPtr;
7147                             
7148                             parentPtr = findTypeByModulenameAndName(
7149                                 thisParserPtr->modulePtr->export.name, "Unsigned64");
7150                             if (! parentPtr) {
7151                                 importPtr = findImportByName("Unsigned64",
7152                                                              thisModulePtr);
7153                                 if (!importPtr) {
7154                                     parentPtr = findTypeByName("Unsigned64");
7155                                     if ((thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)) {
7156                                         smiPrintError(thisParserPtr, ERR_SPPI_CONSTRUCT_IN_MIB, "Unsigned64");
7157                                     } else {
7158                                         smiPrintError(thisParserPtr,
7159                                                       ERR_SPPI_BASETYPE_NOT_IMPORTED,
7160                                                       "Unsigned64");
7161                                     }
7162                                 } else {
7163                                     importPtr->use++;
7164                                     parentPtr = findTypeByModulenameAndName(
7165                                         importPtr->export.module,
7166                                         importPtr->export.name);
7167                                 }
7168                             }
7169                             if (! parentPtr) {
7170                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
7171                                               "Unsigned64");
7172                                 (yyval.typePtr) = NULL;
7173                             } else {
7174                                 (yyval.typePtr) = duplicateType(parentPtr, 0,
7175                                                    thisParserPtr);
7176                                 setTypeList((yyval.typePtr), (yyvsp[(2) - (2)].listPtr));
7177                                 smiCheckTypeRanges(thisParserPtr, (yyval.typePtr));
7178                             }
7179                         ;}
7180     break;
7181
7182   case 254:
7183 #line 4902 "parser-smi.y"
7184     {
7185                             Import *importPtr;
7186                             
7187                             (yyval.typePtr) = findTypeByName("IpAddress");
7188                             if (! (yyval.typePtr)) {
7189                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
7190                                               "IpAddress");
7191                             }
7192
7193                             importPtr = findImportByName("IpAddress",
7194                                                          thisModulePtr);
7195                             if (importPtr) {
7196                                 importPtr->use++;
7197                             } else {
7198                                 if (thisModulePtr->export.language ==
7199                                     SMI_LANGUAGE_SMIV2) {
7200                                     smiPrintError(thisParserPtr,
7201                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
7202                                                   "IpAddress");
7203                                 } else if (thisModulePtr->export.language ==
7204                                            SMI_LANGUAGE_SPPI) {
7205                                     smiPrintError(thisParserPtr,
7206                                                   ERR_SPPI_BASETYPE_NOT_IMPORTED,
7207                                                   "IpAddress");
7208                                 }
7209                             }
7210                         ;}
7211     break;
7212
7213   case 255:
7214 #line 4930 "parser-smi.y"
7215     {
7216                             Import *importPtr;
7217                             
7218                             if ((thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI) &&
7219                                 !findImportByName("Counter32", thisParserPtr->modulePtr))
7220                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "Counter32");
7221                             (yyval.typePtr) = findTypeByName("Counter32");
7222                             if (! (yyval.typePtr)) {
7223                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
7224                                               "Counter32");
7225                             }
7226
7227                             importPtr = findImportByName("Counter32",
7228                                                          thisModulePtr);
7229                             if (importPtr) {
7230                                 importPtr->use++;
7231                             } else {
7232                                 if (thisModulePtr->export.language ==
7233                                     SMI_LANGUAGE_SMIV2) {
7234                                     smiPrintError(thisParserPtr,
7235                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
7236                                                   "Counter32");
7237                                 }
7238                             }
7239                         ;}
7240     break;
7241
7242   case 256:
7243 #line 4956 "parser-smi.y"
7244     {
7245                             Import *importPtr;
7246                             
7247                             if ((thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI) &&
7248                                 !findImportByName("Gauge32", thisParserPtr->modulePtr))
7249                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "Gauge32");
7250                             (yyval.typePtr) = findTypeByName("Gauge32");
7251                             if (! (yyval.typePtr)) {
7252                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
7253                                               "Gauge32");
7254                             }
7255
7256                             importPtr = findImportByName("Gauge32",
7257                                                          thisModulePtr);
7258                             if (importPtr) {
7259                                 importPtr->use++;
7260                             } else {
7261                                 if (thisModulePtr->export.language ==
7262                                     SMI_LANGUAGE_SMIV2) {
7263                                     smiPrintError(thisParserPtr,
7264                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
7265                                                   "Gauge32");
7266                                 }
7267                             }
7268                         ;}
7269     break;
7270
7271   case 257:
7272 #line 4982 "parser-smi.y"
7273     {
7274                             Import *importPtr;
7275                             
7276                             (yyval.typePtr) = smiHandle->typeUnsigned32Ptr;
7277
7278                             importPtr = findImportByName("Unsigned32",
7279                                                          thisModulePtr);
7280                             if (importPtr) {
7281                                 importPtr->use++;
7282                             } else {
7283                                 if (thisModulePtr->export.language ==
7284                                     SMI_LANGUAGE_SMIV2) {
7285                                     smiPrintError(thisParserPtr,
7286                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
7287                                                   "Unsigned32");
7288                                 } else if (thisModulePtr->export.language ==
7289                                            SMI_LANGUAGE_SPPI) {
7290                                     smiPrintError(thisParserPtr,
7291                                                   ERR_SPPI_BASETYPE_NOT_IMPORTED,
7292                                                   "Unsigned32");
7293                                 }
7294                             }
7295                         ;}
7296     break;
7297
7298   case 258:
7299 #line 5006 "parser-smi.y"
7300     {
7301                             Import *importPtr;
7302                             
7303                             (yyval.typePtr) = findTypeByName("TimeTicks");
7304                             if (! (yyval.typePtr)) {
7305                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
7306                                               "TimeTicks");
7307                             }
7308
7309                             importPtr = findImportByName("TimeTicks",
7310                                                          thisModulePtr);
7311                             if (importPtr) {
7312                                 importPtr->use++;
7313                             } else {
7314                                 if (thisModulePtr->export.language ==
7315                                     SMI_LANGUAGE_SMIV2) {
7316                                     smiPrintError(thisParserPtr,
7317                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
7318                                                   "TimeTicks");
7319                                 } else if (thisModulePtr->export.language ==
7320                                            SMI_LANGUAGE_SPPI) {
7321                                     smiPrintError(thisParserPtr,
7322                                                   ERR_SPPI_BASETYPE_NOT_IMPORTED,
7323                                                   "TimeTicks");
7324                                 }
7325                             }
7326                         ;}
7327     break;
7328
7329   case 259:
7330 #line 5034 "parser-smi.y"
7331     {
7332                             Import *importPtr;
7333                             
7334                             (yyval.typePtr) = findTypeByName("Opaque");
7335                             if (! (yyval.typePtr)) {
7336                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
7337                                               "Opaque");
7338                             } else {
7339                                 if (thisModulePtr->export.language ==
7340                                     SMI_LANGUAGE_SMIV2) {
7341                                     smiPrintError(thisParserPtr,
7342                                                   ERR_SMIV2_OPAQUE_OBSOLETE,
7343                                                   "Opaque");
7344                                 } else if (thisModulePtr->export.language ==
7345                                            SMI_LANGUAGE_SPPI) {
7346                                     smiPrintError(thisParserPtr,
7347                                                   ERR_SPPI_OPAQUE_OBSOLETE,
7348                                                   "Opaque");
7349                                 }
7350                             }
7351
7352                             importPtr = findImportByName("Opaque",
7353                                                          thisModulePtr);
7354                             if (importPtr) {
7355                                 importPtr->use++;
7356                             } else {
7357                                 if (thisModulePtr->export.language ==
7358                                     SMI_LANGUAGE_SMIV2) {
7359                                     smiPrintError(thisParserPtr,
7360                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
7361                                                   "Opaque");
7362                                 } else if (thisModulePtr->export.language ==
7363                                            SMI_LANGUAGE_SPPI) {
7364                                     smiPrintError(thisParserPtr,
7365                                                   ERR_SPPI_BASETYPE_NOT_IMPORTED,
7366                                                   "Opaque");
7367                                 }
7368                             }
7369                         ;}
7370     break;
7371
7372   case 260:
7373 #line 5074 "parser-smi.y"
7374     {
7375                             Import *importPtr;
7376
7377                             if ((thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI) &&
7378                                 !findImportByName("Counter64", thisModulePtr))
7379                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "Counter64");
7380                             (yyval.typePtr) = findTypeByName("Counter64");
7381                             if (! (yyval.typePtr)) {
7382                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
7383                                               "Counter64");
7384                             }
7385
7386                             importPtr = findImportByName("Counter64",
7387                                                          thisModulePtr);
7388                             if (importPtr) {
7389                                 importPtr->use++;
7390                             } else {
7391                                 if (thisModulePtr->export.language ==
7392                                     SMI_LANGUAGE_SMIV2) {
7393                                     smiPrintError(thisParserPtr,
7394                                                   ERR_SMIV2_BASETYPE_NOT_IMPORTED,
7395                                                   "Counter64");
7396                                 }
7397                             }
7398                         ;}
7399     break;
7400
7401   case 261:
7402 #line 5100 "parser-smi.y"
7403     {
7404                             Import *importPtr;
7405
7406                             if (thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)
7407                                 smiPrintError(thisParserPtr, ERR_SPPI_CONSTRUCT_IN_MIB, "Integer64");
7408                             (yyval.typePtr) = findTypeByName("Integer64");
7409                             if (! (yyval.typePtr)) {
7410                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
7411                                               "Integer64");
7412                             }
7413
7414                             importPtr = findImportByName("Integer64",
7415                                                          thisModulePtr);
7416                             if (importPtr) {
7417                                 importPtr->use++;
7418                             } else {
7419                                 if (thisModulePtr->export.language ==
7420                                            SMI_LANGUAGE_SPPI) {
7421                                     smiPrintError(thisParserPtr,
7422                                                   ERR_SPPI_BASETYPE_NOT_IMPORTED,
7423                                                   "Integer64");
7424                                 }
7425                             }
7426                         ;}
7427     break;
7428
7429   case 262:
7430 #line 5125 "parser-smi.y"
7431     {
7432                             Import *importPtr;
7433
7434                             importPtr = findImportByName("Unsigned64",
7435                                                          thisModulePtr);
7436                             if ((thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI) && (!importPtr))
7437                                 smiPrintError(thisParserPtr, ERR_SPPI_CONSTRUCT_IN_MIB, "Unsigned64");
7438                             (yyval.typePtr) = findTypeByName("Unsigned64");
7439                             if (! (yyval.typePtr)) {
7440                                 smiPrintError(thisParserPtr, ERR_UNKNOWN_TYPE,
7441                                               "Unsigned64");
7442                             }
7443
7444                             if (importPtr) {
7445                                 importPtr->use++;
7446                             } else {
7447                                 if (thisModulePtr->export.language ==
7448                                            SMI_LANGUAGE_SPPI) {
7449                                     smiPrintError(thisParserPtr,
7450                                                   ERR_SPPI_BASETYPE_NOT_IMPORTED,
7451                                                   "Unsigned64");
7452                                 }
7453                             }
7454                         ;}
7455     break;
7456
7457   case 263:
7458 #line 5152 "parser-smi.y"
7459     {
7460                             List *listPtr, *nextListPtr;
7461
7462                             if (thisModulePtr->export.language == SMI_LANGUAGE_SMIV2)
7463                                 smiPrintError(thisParserPtr,
7464                                               ERR_UNEXPECTED_TYPE_RESTRICTION);
7465
7466                             for (listPtr = (yyvsp[(1) - (1)].listPtr); listPtr;
7467                                  listPtr = nextListPtr) {
7468                                 nextListPtr = listPtr->nextPtr;
7469                                 smiFree((Range *)(listPtr->ptr));
7470                                 smiFree(listPtr);
7471                             }
7472
7473                             (yyval.listPtr) = NULL;
7474                         ;}
7475     break;
7476
7477   case 264:
7478 #line 5169 "parser-smi.y"
7479     {
7480                             List *listPtr, *nextListPtr;
7481
7482                             if (thisModulePtr->export.language == SMI_LANGUAGE_SMIV2)
7483                                 smiPrintError(thisParserPtr,
7484                                               ERR_UNEXPECTED_TYPE_RESTRICTION);
7485
7486                             for (listPtr = (yyvsp[(1) - (1)].listPtr); listPtr;
7487                                  listPtr = nextListPtr) {
7488                                 nextListPtr = listPtr->nextPtr;
7489                                 smiFree((Range *)(listPtr->ptr));
7490                                 smiFree(listPtr);
7491                             }
7492
7493                             (yyval.listPtr) = NULL;
7494                         ;}
7495     break;
7496
7497   case 265:
7498 #line 5186 "parser-smi.y"
7499     {
7500                             List *listPtr, *nextListPtr;
7501
7502                             if (thisModulePtr->export.language == SMI_LANGUAGE_SMIV2)
7503                                 smiPrintError(thisParserPtr,
7504                                               ERR_UNEXPECTED_TYPE_RESTRICTION);
7505
7506                             for (listPtr = (yyvsp[(1) - (1)].listPtr); listPtr;
7507                                  listPtr = nextListPtr) {
7508                                 nextListPtr = listPtr->nextPtr;
7509                                 smiFree(((NamedNumber *)(listPtr->ptr))->export.name);
7510                                 smiFree((NamedNumber *)(listPtr->ptr));
7511                                 smiFree(listPtr);
7512                             }
7513
7514                             (yyval.listPtr) = NULL;
7515                         ;}
7516     break;
7517
7518   case 266:
7519 #line 5204 "parser-smi.y"
7520     {
7521                             (yyval.listPtr) = NULL;
7522                         ;}
7523     break;
7524
7525   case 267:
7526 #line 5218 "parser-smi.y"
7527     { (yyval.listPtr) = (yyvsp[(2) - (3)].listPtr); ;}
7528     break;
7529
7530   case 268:
7531 #line 5228 "parser-smi.y"
7532     {
7533                             (yyval.listPtr) = (yyvsp[(4) - (6)].listPtr);
7534                         ;}
7535     break;
7536
7537   case 269:
7538 #line 5234 "parser-smi.y"
7539     {
7540                             (yyval.listPtr) = smiMalloc(sizeof(List));
7541                             (yyval.listPtr)->ptr = (yyvsp[(1) - (1)].rangePtr);
7542                             (yyval.listPtr)->nextPtr = NULL;
7543                         ;}
7544     break;
7545
7546   case 270:
7547 #line 5240 "parser-smi.y"
7548     {
7549                             List *p, *pp;
7550                             
7551                             p = smiMalloc(sizeof(List));
7552                             p->ptr = (void *)(yyvsp[(3) - (3)].rangePtr);
7553                             p->nextPtr = NULL;
7554                             for (pp = (yyvsp[(1) - (3)].listPtr); pp->nextPtr; pp = pp->nextPtr);
7555                             pp->nextPtr = p;
7556                             
7557                             (yyval.listPtr) = (yyvsp[(1) - (3)].listPtr);
7558                         ;}
7559     break;
7560
7561   case 271:
7562 #line 5254 "parser-smi.y"
7563     {
7564                             (yyval.rangePtr) = smiMalloc(sizeof(Range));
7565                             (yyval.rangePtr)->export.minValue = *(yyvsp[(1) - (1)].valuePtr);
7566                             (yyval.rangePtr)->export.maxValue = *(yyvsp[(1) - (1)].valuePtr);
7567                             smiFree((yyvsp[(1) - (1)].valuePtr));
7568                         ;}
7569     break;
7570
7571   case 272:
7572 #line 5261 "parser-smi.y"
7573     {
7574                             (yyval.rangePtr) = smiMalloc(sizeof(Range));
7575                             (yyval.rangePtr)->export.minValue = *(yyvsp[(1) - (3)].valuePtr);
7576                             (yyval.rangePtr)->export.maxValue = *(yyvsp[(3) - (3)].valuePtr);
7577                             smiFree((yyvsp[(1) - (3)].valuePtr));
7578                             smiFree((yyvsp[(3) - (3)].valuePtr));
7579                         ;}
7580     break;
7581
7582   case 273:
7583 #line 5271 "parser-smi.y"
7584     {
7585                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
7586                             (yyval.valuePtr)->basetype = SMI_BASETYPE_INTEGER32;
7587                             (yyval.valuePtr)->value.integer32 = (yyvsp[(1) - (1)].integer32);
7588                         ;}
7589     break;
7590
7591   case 274:
7592 #line 5277 "parser-smi.y"
7593     {
7594                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
7595                             (yyval.valuePtr)->basetype = SMI_BASETYPE_UNSIGNED32;
7596                             (yyval.valuePtr)->value.unsigned32 = (yyvsp[(1) - (1)].unsigned32);
7597                         ;}
7598     break;
7599
7600   case 275:
7601 #line 5283 "parser-smi.y"
7602     {
7603                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
7604                             (yyval.valuePtr)->basetype = SMI_BASETYPE_INTEGER64;
7605                             (yyval.valuePtr)->value.integer64 = (yyvsp[(1) - (1)].integer64);
7606                         ;}
7607     break;
7608
7609   case 276:
7610 #line 5289 "parser-smi.y"
7611     {
7612                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
7613                             (yyval.valuePtr)->basetype = SMI_BASETYPE_UNSIGNED64;
7614                             (yyval.valuePtr)->value.unsigned64 = (yyvsp[(1) - (1)].unsigned64);
7615                         ;}
7616     break;
7617
7618   case 277:
7619 #line 5295 "parser-smi.y"
7620     {
7621                             char s[3];
7622                             int i, len;
7623                             
7624                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
7625                             if (defaultBasetype == SMI_BASETYPE_OCTETSTRING) {
7626                                 (yyval.valuePtr)->basetype = SMI_BASETYPE_OCTETSTRING;
7627                                 len = strlen((yyvsp[(1) - (1)].text));
7628                                 (yyval.valuePtr)->value.ptr = smiMalloc((len+1)/2+1);
7629                                 for (i = 0; i < len; i += 2) {
7630                                     strncpy(s, &(yyvsp[(1) - (1)].text)[i], 2);
7631                                     if (!s[1]) s[1] = '0';
7632                                     s[2] = 0;
7633                                     (yyval.valuePtr)->value.ptr[i/2] =
7634                                         (unsigned char)strtol(s, 0, 16);
7635                                 }
7636                                 (yyval.valuePtr)->len = (len+1)/2;
7637                             } else {
7638                                 (yyval.valuePtr)->basetype = SMI_BASETYPE_UNSIGNED32;
7639                                 (yyval.valuePtr)->value.unsigned32 = strtoul((yyvsp[(1) - (1)].text), NULL, 16);
7640                             }
7641                         ;}
7642     break;
7643
7644   case 278:
7645 #line 5318 "parser-smi.y"
7646     {
7647                             char s[9];
7648                             int i, len, j;
7649                             
7650                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
7651                             if (defaultBasetype == SMI_BASETYPE_OCTETSTRING) {
7652                                 (yyval.valuePtr)->basetype = SMI_BASETYPE_OCTETSTRING;
7653                                 len = strlen((yyvsp[(1) - (1)].text));
7654                                 (yyval.valuePtr)->value.ptr = smiMalloc((len+7)/8+1);
7655                                 for (i = 0; i < len; i += 8) {
7656                                     strncpy(s, &(yyvsp[(1) - (1)].text)[i], 8);
7657                                     for (j = 1; j < 8; j++) {
7658                                         if (!s[j]) s[j] = '0';
7659                                     }
7660                                     s[8] = 0;
7661                                     (yyval.valuePtr)->value.ptr[i/8] =
7662                                         (unsigned char)strtol(s, 0, 2);
7663                                 }
7664                                 (yyval.valuePtr)->len = (len+7)/8;
7665                             } else {
7666                                 (yyval.valuePtr)->basetype = SMI_BASETYPE_UNSIGNED32;
7667                                 (yyval.valuePtr)->value.unsigned32 = strtoul((yyvsp[(1) - (1)].text), NULL, 2);
7668                             }
7669                         ;}
7670     break;
7671
7672   case 279:
7673 #line 5345 "parser-smi.y"
7674     {
7675                             (yyval.listPtr) = (yyvsp[(2) - (3)].listPtr);
7676                         ;}
7677     break;
7678
7679   case 280:
7680 #line 5351 "parser-smi.y"
7681     {
7682                             (yyval.listPtr) = smiMalloc(sizeof(List));
7683                             (yyval.listPtr)->ptr = (yyvsp[(1) - (1)].namedNumberPtr);
7684                             (yyval.listPtr)->nextPtr = NULL;
7685                         ;}
7686     break;
7687
7688   case 281:
7689 #line 5357 "parser-smi.y"
7690     {
7691                             List *p, *pp;
7692                             
7693                             p = smiMalloc(sizeof(List));
7694                             p->ptr = (void *)(yyvsp[(3) - (3)].namedNumberPtr);
7695                             p->nextPtr = NULL;
7696                             for (pp = (yyvsp[(1) - (3)].listPtr); pp->nextPtr; pp = pp->nextPtr);
7697                             pp->nextPtr = p;
7698                             (yyval.listPtr) = (yyvsp[(1) - (3)].listPtr);
7699                         ;}
7700     break;
7701
7702   case 282:
7703 #line 5370 "parser-smi.y"
7704     {
7705                             checkNameLen(thisParserPtr, (yyvsp[(1) - (1)].id),
7706                                          ERR_ENUMNAME_32, ERR_ENUMNAME_64);
7707                             if (thisModulePtr->export.language == SMI_LANGUAGE_SMIV2)
7708                             {
7709                                 if (strchr((yyvsp[(1) - (1)].id), '-')) {
7710                                     smiPrintError(thisParserPtr,
7711                                           ERR_NAMEDNUMBER_INCLUDES_HYPHEN,
7712                                                   (yyvsp[(1) - (1)].id));
7713                                 }
7714                             }
7715                         ;}
7716     break;
7717
7718   case 283:
7719 #line 5383 "parser-smi.y"
7720     {
7721                             (yyval.namedNumberPtr) = smiMalloc(sizeof(NamedNumber));
7722                             (yyval.namedNumberPtr)->export.name = (yyvsp[(1) - (5)].id);
7723                             (yyval.namedNumberPtr)->export.value = *(yyvsp[(4) - (5)].valuePtr);
7724                             smiFree((yyvsp[(4) - (5)].valuePtr));
7725                         ;}
7726     break;
7727
7728   case 284:
7729 #line 5392 "parser-smi.y"
7730     {
7731                             if ((yyvsp[(1) - (1)].unsigned32) > SMI_BASETYPE_INTEGER32_MAX) {
7732                                 smiPrintError(thisParserPtr,
7733                                               ERR_INTEGER32_TOO_LARGE, (yyvsp[(1) - (1)].unsigned32));
7734                             }
7735                             if ((thisModulePtr->export.language == SMI_LANGUAGE_SMIV1) &&
7736                                 ((yyvsp[(1) - (1)].unsigned32) == 0)) {
7737                                 smiPrintError(thisParserPtr,
7738                                               ERR_ENUM_ZERO);
7739                             }
7740                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
7741                             (yyval.valuePtr)->basetype = SMI_BASETYPE_INTEGER32;
7742                             (yyval.valuePtr)->value.integer32 = (yyvsp[(1) - (1)].unsigned32);
7743                         ;}
7744     break;
7745
7746   case 285:
7747 #line 5407 "parser-smi.y"
7748     {
7749                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
7750                             (yyval.valuePtr)->basetype = SMI_BASETYPE_INTEGER32;
7751                             (yyval.valuePtr)->value.integer32 = (yyvsp[(1) - (1)].integer32);
7752                             /* TODO: non-negative is suggested */
7753                         ;}
7754     break;
7755
7756   case 286:
7757 #line 5416 "parser-smi.y"
7758     {
7759                             if (thisModulePtr->export.language == SMI_LANGUAGE_SMIV2)
7760                             {
7761                                 if (!strcmp((yyvsp[(1) - (1)].id), "current")) {
7762                                     (yyval.status) = SMI_STATUS_CURRENT;
7763                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "deprecated")) {
7764                                     (yyval.status) = SMI_STATUS_DEPRECATED;
7765                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "obsolete")) {
7766                                     (yyval.status) = SMI_STATUS_OBSOLETE;
7767                                 } else {
7768                                     smiPrintError(thisParserPtr,
7769                                                   ERR_INVALID_SMIV2_STATUS,
7770                                                   (yyvsp[(1) - (1)].id));
7771                                     if (!strcmp((yyvsp[(1) - (1)].id), "mandatory")
7772                                         || !strcmp((yyvsp[(1) - (1)].id), "optional")) {
7773                                         /* best guess */
7774                                         (yyval.status) = SMI_STATUS_CURRENT;
7775                                     } else {
7776                                         (yyval.status) = SMI_STATUS_UNKNOWN;
7777                                     }
7778                                 }
7779                             } else if (thisModulePtr->export.language != SMI_LANGUAGE_SPPI) {
7780                                 if (!strcmp((yyvsp[(1) - (1)].id), "mandatory")) {
7781                                     (yyval.status) = SMI_STATUS_MANDATORY;
7782                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "optional")) {
7783                                     (yyval.status) = SMI_STATUS_OPTIONAL;
7784                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "obsolete")) {
7785                                     (yyval.status) = SMI_STATUS_OBSOLETE;
7786                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "deprecated")) {
7787                                     (yyval.status) = SMI_STATUS_OBSOLETE;
7788                                 } else {
7789                                     smiPrintError(thisParserPtr,
7790                                                   ERR_INVALID_SMIV1_STATUS,
7791                                                   (yyvsp[(1) - (1)].id));
7792                                     if (!strcmp((yyvsp[(1) - (1)].id), "current")) {
7793                                         /* best guess */
7794                                         (yyval.status) = SMI_STATUS_MANDATORY; 
7795                                     } else {
7796                                         (yyval.status) = SMI_STATUS_UNKNOWN;
7797                                     }
7798                                 }
7799                             } else { /* it is SPPI */
7800                                 if (!strcmp((yyvsp[(1) - (1)].id), "current")) {
7801                                     (yyval.status) = SMI_STATUS_CURRENT;
7802                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "obsolete")) {
7803                                     (yyval.status) = SMI_STATUS_OBSOLETE;
7804                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "deprecated")) {
7805                                     (yyval.status) = SMI_STATUS_OBSOLETE;
7806                                 } else {
7807                                     smiPrintError(thisParserPtr,
7808                                                   ERR_INVALID_SPPI_STATUS, (yyvsp[(1) - (1)].id));
7809                                     (yyval.status) = SMI_STATUS_UNKNOWN;
7810                                 }
7811                             }
7812                             smiFree((yyvsp[(1) - (1)].id));
7813                         ;}
7814     break;
7815
7816   case 287:
7817 #line 5475 "parser-smi.y"
7818     {
7819                             if (!strcmp((yyvsp[(1) - (1)].id), "current")) {
7820                                 (yyval.status) = SMI_STATUS_CURRENT;
7821                             } else if (!strcmp((yyvsp[(1) - (1)].id), "obsolete")) {
7822                                 (yyval.status) = SMI_STATUS_OBSOLETE;
7823                             } else {
7824                                 smiPrintError(thisParserPtr,
7825                                               ERR_INVALID_CAPABILITIES_STATUS,
7826                                               (yyvsp[(1) - (1)].id));
7827                                 (yyval.status) = SMI_STATUS_UNKNOWN;
7828                             }
7829                             smiFree((yyvsp[(1) - (1)].id));
7830                         ;}
7831     break;
7832
7833   case 288:
7834 #line 5491 "parser-smi.y"
7835     {
7836                             (yyval.text) = (yyvsp[(2) - (2)].text);
7837                             
7838                             if ((yyvsp[(2) - (2)].text) && !strlen((yyvsp[(2) - (2)].text))) {
7839                                 smiPrintError(thisParserPtr,
7840                                               ERR_EMPTY_FORMAT);
7841                             }
7842                         ;}
7843     break;
7844
7845   case 289:
7846 #line 5500 "parser-smi.y"
7847     {
7848                             (yyval.text) = NULL;
7849                         ;}
7850     break;
7851
7852   case 290:
7853 #line 5506 "parser-smi.y"
7854     {
7855                             (yyval.text) = (yyvsp[(2) - (2)].text);
7856                             
7857                             if ((yyvsp[(2) - (2)].text) && !strlen((yyvsp[(2) - (2)].text))) {
7858                                 smiPrintError(thisParserPtr,
7859                                               ERR_EMPTY_UNITS);
7860                             }
7861                         ;}
7862     break;
7863
7864   case 291:
7865 #line 5515 "parser-smi.y"
7866     {
7867                             (yyval.text) = NULL;
7868                         ;}
7869     break;
7870
7871   case 292:
7872 #line 5521 "parser-smi.y"
7873     {
7874                             if (thisModulePtr->export.language == SMI_LANGUAGE_SMIV2)
7875                             {
7876                                 if (!strcmp((yyvsp[(1) - (1)].id), "not-accessible")) {
7877                                     (yyval.access) = SMI_ACCESS_NOT_ACCESSIBLE;
7878                                 } else if (!strcmp((yyvsp[(1) - (1)].id),
7879                                                    "accessible-for-notify")) {
7880                                     (yyval.access) = SMI_ACCESS_NOTIFY;
7881                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "read-only")) {
7882                                     (yyval.access) = SMI_ACCESS_READ_ONLY;
7883                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "read-write")) {
7884                                     (yyval.access) = SMI_ACCESS_READ_WRITE;
7885                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "read-create")) {
7886                                     (yyval.access) = SMI_ACCESS_READ_WRITE;
7887                                     thisParserPtr->flags |= FLAG_CREATABLE;
7888                                     /* TODO:remember it's really read-create */
7889                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "write-only")) {
7890                                     smiPrintError(thisParserPtr,
7891                                                   ERR_SMIV2_WRITE_ONLY);
7892                                     (yyval.access) = SMI_ACCESS_READ_WRITE;
7893                                 } else {
7894                                     smiPrintError(thisParserPtr,
7895                                                   ERR_INVALID_SMIV2_ACCESS,
7896                                                   (yyvsp[(1) - (1)].id));
7897                                     (yyval.access) = SMI_ACCESS_UNKNOWN;
7898                                 }
7899                             } else if (thisModulePtr->export.language != SMI_LANGUAGE_SPPI) {
7900                                 if (!strcmp((yyvsp[(1) - (1)].id), "not-accessible")) {
7901                                     (yyval.access) = SMI_ACCESS_NOT_ACCESSIBLE;
7902                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "read-only")) {
7903                                     (yyval.access) = SMI_ACCESS_READ_ONLY;
7904                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "read-write")) {
7905                                     (yyval.access) = SMI_ACCESS_READ_WRITE;
7906                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "write-only")) {
7907                                     smiPrintError(thisParserPtr,
7908                                                   ERR_SMIV1_WRITE_ONLY);
7909                                     (yyval.access) = SMI_ACCESS_READ_WRITE;
7910                                 } else {
7911                                     smiPrintError(thisParserPtr,
7912                                                   ERR_INVALID_SMIV1_ACCESS,
7913                                                   (yyvsp[(1) - (1)].id));
7914                                     (yyval.access) = SMI_ACCESS_UNKNOWN;
7915                                 }
7916                             } else {
7917                                 if (!strcmp((yyvsp[(1) - (1)].id), "install")) {
7918                                     (yyval.access) = SMI_ACCESS_INSTALL;
7919                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "install-notify")) {
7920                                     (yyval.access) = SMI_ACCESS_INSTALL_NOTIFY;
7921                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "notify")) {
7922                                     (yyval.access) = SMI_ACCESS_NOTIFY;
7923                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "report-only")) {
7924                                     (yyval.access) = SMI_ACCESS_REPORT_ONLY;
7925                                 } else if (!strcmp((yyvsp[(1) - (1)].id), "not-accessible")) {
7926                                     (yyval.access) = SMI_ACCESS_NOT_ACCESSIBLE;
7927                                 } else {
7928                                     smiPrintError(thisParserPtr,
7929                                                   ERR_INVALID_SPPI_ACCESS,
7930                                                   (yyvsp[(1) - (1)].id));
7931                                     (yyval.access) = SMI_ACCESS_UNKNOWN;
7932                                 }
7933                             }
7934                             smiFree((yyvsp[(1) - (1)].id));
7935                         ;}
7936     break;
7937
7938   case 293:
7939 #line 5587 "parser-smi.y"
7940     {
7941                             if (thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)
7942                                 smiPrintError(thisParserPtr, ERR_SPPI_CONSTRUCT_IN_MIB, "PIB-INDEX");
7943                         ;}
7944     break;
7945
7946   case 294:
7947 #line 5592 "parser-smi.y"
7948     {
7949                             List *p = smiMalloc(sizeof(List));
7950                             
7951                             p->ptr       = (yyvsp[(4) - (5)].objectPtr);
7952                             p->nextPtr   = NULL;
7953                             
7954                             (yyval.index).indexkind = SMI_INDEX_INDEX;
7955                             (yyval.index).implied   = impliedFlag;
7956                             (yyval.index).listPtr   = p;
7957                             (yyval.index).rowPtr    = NULL;
7958                             indexFlag    = INDEXFLAG_PIBINDEX;
7959                         ;}
7960     break;
7961
7962   case 295:
7963 #line 5607 "parser-smi.y"
7964     {
7965                             (yyval.index).indexkind    = SMI_INDEX_AUGMENT;
7966                             (yyval.index).implied      = 0;
7967                             (yyval.index).listPtr      = NULL;
7968                             (yyval.index).rowPtr       = (yyvsp[(3) - (4)].objectPtr);
7969                             indexFlag       = INDEXFLAG_AUGMENTS;
7970                         ;}
7971     break;
7972
7973   case 296:
7974 #line 5615 "parser-smi.y"
7975     {
7976                             if (thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)
7977                                 smiPrintError(thisParserPtr, ERR_SPPI_CONSTRUCT_IN_MIB, "EXTENDS");
7978                         ;}
7979     break;
7980
7981   case 297:
7982 #line 5620 "parser-smi.y"
7983     {
7984                             (yyval.index).indexkind    = SMI_INDEX_SPARSE;
7985                             (yyval.index).implied      = 0;
7986                             (yyval.index).listPtr      = NULL;
7987                             (yyval.index).rowPtr       = (yyvsp[(4) - (5)].objectPtr);
7988                             indexFlag       = INDEXFLAG_EXTENDS;
7989                         ;}
7990     break;
7991
7992   case 298:
7993 #line 5628 "parser-smi.y"
7994     {
7995                             (yyval.index).indexkind = SMI_INDEX_UNKNOWN;
7996                         ;}
7997     break;
7998
7999   case 299:
8000 #line 5634 "parser-smi.y"
8001     {
8002                             /* 
8003                              * To avoid ambiguity caused by merging
8004                              * the SMI and SPPI parser we use a flag.
8005                              */
8006                             if (thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI) {
8007                                 /*
8008                                  * Only INDEX or AUGMENTS are allowed for SMI
8009                                  */
8010                                 if (indexFlag != INDEXFLAG_NONE)
8011                                     smiPrintError(thisParserPtr, ERR_INDEX_AND_AUGMENTS_USED);
8012                             } else {
8013                                 /*
8014                                  * INDEX may only be used if PIB_INDEX was used
8015                                  */
8016                                 if (indexFlag != INDEXFLAG_PIBINDEX)
8017                                     smiPrintError(thisParserPtr, ERR_INDEX_WITHOUT_PIB_INDEX);
8018                             }
8019                             
8020                             /*
8021                              * Use a global variable to fetch and remember
8022                              * whether we have seen an IMPLIED keyword.
8023                              */
8024                             impliedFlag = 0;
8025                         ;}
8026     break;
8027
8028   case 300:
8029 #line 5660 "parser-smi.y"
8030     {
8031                             (yyval.index).indexkind = SMI_INDEX_INDEX;
8032                             (yyval.index).implied   = impliedFlag;
8033                             (yyval.index).listPtr   = (yyvsp[(4) - (5)].listPtr);
8034                             (yyval.index).rowPtr    = NULL;
8035                         ;}
8036     break;
8037
8038   case 301:
8039 #line 5667 "parser-smi.y"
8040     {
8041                             (yyval.index).indexkind = SMI_INDEX_UNKNOWN;
8042                         ;}
8043     break;
8044
8045   case 302:
8046 #line 5673 "parser-smi.y"
8047     {
8048                             (yyval.listPtr) = smiMalloc(sizeof(List));
8049                             (yyval.listPtr)->ptr = (yyvsp[(1) - (1)].objectPtr);
8050                             (yyval.listPtr)->nextPtr = NULL;
8051                         ;}
8052     break;
8053
8054   case 303:
8055 #line 5680 "parser-smi.y"
8056     {
8057                             List *p, *pp;
8058                             
8059                             p = smiMalloc(sizeof(List));
8060                             p->ptr = (yyvsp[(3) - (3)].objectPtr);
8061                             p->nextPtr = NULL;
8062                             for (pp = (yyvsp[(1) - (3)].listPtr); pp->nextPtr; pp = pp->nextPtr);
8063                             pp->nextPtr = p;
8064                             (yyval.listPtr) = (yyvsp[(1) - (3)].listPtr);
8065                         ;}
8066     break;
8067
8068   case 304:
8069 #line 5693 "parser-smi.y"
8070     {
8071                             impliedFlag = 1;
8072                             (yyval.objectPtr) = (yyvsp[(2) - (2)].objectPtr);
8073                         ;}
8074     break;
8075
8076   case 305:
8077 #line 5698 "parser-smi.y"
8078     {
8079                             (yyval.objectPtr) = (yyvsp[(1) - (1)].objectPtr);
8080                         ;}
8081     break;
8082
8083   case 306:
8084 #line 5708 "parser-smi.y"
8085     {
8086                             (yyval.objectPtr) = (yyvsp[(1) - (1)].objectPtr);
8087                         ;}
8088     break;
8089
8090   case 307:
8091 #line 5714 "parser-smi.y"
8092     {
8093                             (yyval.objectPtr) = (yyvsp[(1) - (1)].objectPtr);
8094                         ;}
8095     break;
8096
8097   case 308:
8098 #line 5720 "parser-smi.y"
8099     {
8100                             (yyval.valuePtr) = (yyvsp[(3) - (4)].valuePtr);
8101                             if ((defaultBasetype == SMI_BASETYPE_BITS) &&
8102                                 ((yyval.valuePtr)->basetype != SMI_BASETYPE_BITS)) {
8103                                 smiPrintError(thisParserPtr,
8104                                               ERR_DEFVAL_SYNTAX);
8105                                 if ((yyval.valuePtr)->basetype == SMI_BASETYPE_OCTETSTRING) {
8106                                     smiFree((yyval.valuePtr)->value.ptr);
8107                                 }
8108                                 smiFree((yyval.valuePtr));
8109                                 (yyval.valuePtr) = NULL;
8110                             }
8111                         ;}
8112     break;
8113
8114   case 309:
8115 #line 5734 "parser-smi.y"
8116     { (yyval.valuePtr) = NULL; ;}
8117     break;
8118
8119   case 310:
8120 #line 5739 "parser-smi.y"
8121     { (yyval.valuePtr) = (yyvsp[(1) - (1)].valuePtr); ;}
8122     break;
8123
8124   case 311:
8125 #line 5741 "parser-smi.y"
8126     {
8127                             (yyval.valuePtr) = smiMalloc(sizeof(SmiValue));
8128                             (yyval.valuePtr)->basetype = SMI_BASETYPE_BITS;
8129                             (yyval.valuePtr)->value.ptr = (void *)(yyvsp[(2) - (3)].listPtr);
8130                         ;}
8131     break;
8132
8133   case 312:
8134 #line 5749 "parser-smi.y"
8135     { (yyval.listPtr) = (yyvsp[(1) - (1)].listPtr); ;}
8136     break;
8137
8138   case 313:
8139 #line 5751 "parser-smi.y"
8140     { (yyval.listPtr) = NULL; ;}
8141     break;
8142
8143   case 314:
8144 #line 5755 "parser-smi.y"
8145     {
8146                             (yyval.listPtr) = smiMalloc(sizeof(List));
8147                             (yyval.listPtr)->ptr = (yyvsp[(1) - (1)].id);
8148                             (yyval.listPtr)->nextPtr = NULL;
8149                         ;}
8150     break;
8151
8152   case 315:
8153 #line 5761 "parser-smi.y"
8154     {
8155                             List *p, *pp;
8156                             
8157                             p = smiMalloc(sizeof(List));
8158                             p->ptr = (yyvsp[(3) - (3)].id);
8159                             p->nextPtr = NULL;
8160                             for (pp = (yyvsp[(1) - (3)].listPtr); pp->nextPtr; pp = pp->nextPtr);
8161                             pp->nextPtr = p;
8162                             (yyval.listPtr) = (yyvsp[(1) - (3)].listPtr);
8163                         ;}
8164     break;
8165
8166   case 316:
8167 #line 5774 "parser-smi.y"
8168     {
8169                             (yyval.objectPtr) = (yyvsp[(1) - (1)].objectPtr);
8170                         ;}
8171     break;
8172
8173   case 317:
8174 #line 5780 "parser-smi.y"
8175     {
8176                             (yyval.objectPtr) = (yyvsp[(1) - (1)].objectPtr);
8177                         ;}
8178     break;
8179
8180   case 318:
8181 #line 5786 "parser-smi.y"
8182     {
8183                             (yyval.text) = (yyvsp[(2) - (2)].text);
8184
8185                             if ((yyvsp[(2) - (2)].text) && !strlen((yyvsp[(2) - (2)].text))) {
8186                                 smiPrintError(thisParserPtr,
8187                                               ERR_EMPTY_REFERENCE);
8188                             }
8189                         ;}
8190     break;
8191
8192   case 319:
8193 #line 5795 "parser-smi.y"
8194     { (yyval.text) = NULL; ;}
8195     break;
8196
8197   case 320:
8198 #line 5799 "parser-smi.y"
8199     { (yyval.err) = 0; ;}
8200     break;
8201
8202   case 321:
8203 #line 5801 "parser-smi.y"
8204     { (yyval.err) = 0; ;}
8205     break;
8206
8207   case 322:
8208 #line 5805 "parser-smi.y"
8209     { (yyval.err) = 0; ;}
8210     break;
8211
8212   case 323:
8213 #line 5807 "parser-smi.y"
8214     { (yyval.err) = 0; ;}
8215     break;
8216
8217   case 324:
8218 #line 5811 "parser-smi.y"
8219     {
8220                             thisParserPtr->firstRevisionLine = thisParserPtr->line;
8221
8222                             if (thisParserPtr->modulePtr->lastRevisionPtr &&
8223                                 ((yyvsp[(2) - (2)].date) >= thisParserPtr->modulePtr->lastRevisionPtr->export.date)) {
8224                                 smiPrintError(thisParserPtr,
8225                                               ERR_REVISION_NOT_DESCENDING);
8226                             }
8227
8228                             if ((yyvsp[(2) - (2)].date) > thisParserPtr->modulePtr->lastUpdated) {
8229                                 smiPrintError(thisParserPtr,
8230                                               ERR_REVISION_AFTER_LAST_UPDATE);
8231                             }
8232                         ;}
8233     break;
8234
8235   case 325:
8236 #line 5826 "parser-smi.y"
8237     {
8238                             Revision *revisionPtr;
8239
8240                             checkDescr(thisParserPtr, (yyvsp[(5) - (5)].text));
8241
8242                             revisionPtr = addRevision((yyvsp[(2) - (5)].date), (yyvsp[(5) - (5)].text), thisParserPtr);
8243                             if (revisionPtr) {
8244                                 setRevisionLine(revisionPtr,
8245                                                 thisParserPtr->firstRevisionLine,
8246                                                 thisParserPtr);
8247                             }
8248                             (yyval.err) = revisionPtr ? 0 : -1;
8249                         ;}
8250     break;
8251
8252   case 326:
8253 #line 5842 "parser-smi.y"
8254     {
8255                             (yyval.listPtr) = (yyvsp[(3) - (4)].listPtr);
8256                         ;}
8257     break;
8258
8259   case 327:
8260 #line 5846 "parser-smi.y"
8261     {
8262                             (yyval.listPtr) = NULL;
8263                         ;}
8264     break;
8265
8266   case 328:
8267 #line 5852 "parser-smi.y"
8268     {
8269                             (yyval.listPtr) = (yyvsp[(3) - (4)].listPtr);
8270                         ;}
8271     break;
8272
8273   case 329:
8274 #line 5858 "parser-smi.y"
8275     {
8276                             (yyval.listPtr) = smiMalloc(sizeof(List));
8277                             (yyval.listPtr)->ptr = (yyvsp[(1) - (1)].objectPtr);
8278                             (yyval.listPtr)->nextPtr = NULL;
8279                         ;}
8280     break;
8281
8282   case 330:
8283 #line 5864 "parser-smi.y"
8284     {
8285                             List *p, *pp;
8286                             
8287                             p = smiMalloc(sizeof(List));
8288                             p->ptr = (yyvsp[(3) - (3)].objectPtr);
8289                             p->nextPtr = NULL;
8290                             for (pp = (yyvsp[(1) - (3)].listPtr); pp->nextPtr; pp = pp->nextPtr);
8291                             pp->nextPtr = p;
8292                             (yyval.listPtr) = (yyvsp[(1) - (3)].listPtr);
8293                         ;}
8294     break;
8295
8296   case 331:
8297 #line 5877 "parser-smi.y"
8298     {
8299                             (yyval.objectPtr) = (yyvsp[(1) - (1)].objectPtr);
8300                             if ((thisParserPtr->currentDecl == SMI_DECL_OBJECTGROUP) &&
8301                                 (yyval.objectPtr)->modulePtr != thisParserPtr->modulePtr) {
8302                                 smiPrintError(thisParserPtr,
8303                                               ERR_COMPLIANCE_MEMBER_NOT_LOCAL,
8304                                               (yyval.objectPtr)->export.name);
8305                             }
8306                         ;}
8307     break;
8308
8309   case 332:
8310 #line 5889 "parser-smi.y"
8311     {
8312                             (yyval.listPtr) = (yyvsp[(3) - (4)].listPtr);
8313                         ;}
8314     break;
8315
8316   case 333:
8317 #line 5895 "parser-smi.y"
8318     {
8319                             (yyval.listPtr) = smiMalloc(sizeof(List));
8320                             (yyval.listPtr)->ptr = (yyvsp[(1) - (1)].objectPtr);
8321                             (yyval.listPtr)->nextPtr = NULL;
8322                         ;}
8323     break;
8324
8325   case 334:
8326 #line 5901 "parser-smi.y"
8327     {
8328                             List *p, *pp;
8329                             
8330                             p = smiMalloc(sizeof(List));
8331                             p->ptr = (yyvsp[(3) - (3)].objectPtr);
8332                             p->nextPtr = NULL;
8333                             for (pp = (yyvsp[(1) - (3)].listPtr); pp->nextPtr; pp = pp->nextPtr);
8334                             pp->nextPtr = p;
8335                             (yyval.listPtr) = (yyvsp[(1) - (3)].listPtr);
8336                         ;}
8337     break;
8338
8339   case 335:
8340 #line 5914 "parser-smi.y"
8341     {
8342                             (yyval.objectPtr) = (yyvsp[(1) - (1)].objectPtr);
8343                             if ((yyval.objectPtr)->modulePtr != thisParserPtr->modulePtr) {
8344                                 smiPrintError(thisParserPtr,
8345                                               ERR_COMPLIANCE_MEMBER_NOT_LOCAL,
8346                                               (yyval.objectPtr)->export.name);
8347                             }
8348                         ;}
8349     break;
8350
8351   case 336:
8352 #line 5925 "parser-smi.y"
8353     {
8354                             int len;
8355                             (yyval.text) = smiStrdup((yyvsp[(1) - (1)].text));
8356                             len = strlen((yyval.text));
8357                             while (len > 0 && (yyval.text)[len-1] == '\n') {
8358                                 (yyval.text)[--len] = 0;
8359                             }
8360                         ;}
8361     break;
8362
8363   case 337:
8364 #line 5936 "parser-smi.y"
8365     {
8366                             (yyval.date) = checkDate(thisParserPtr, (yyvsp[(1) - (1)].text));
8367                         ;}
8368     break;
8369
8370   case 338:
8371 #line 5941 "parser-smi.y"
8372     {
8373                             thisParserPtr->parentNodePtr = smiHandle->rootNodePtr;
8374                         ;}
8375     break;
8376
8377   case 339:
8378 #line 5945 "parser-smi.y"
8379     {
8380                             (yyval.objectPtr) = (yyvsp[(2) - (2)].objectPtr);
8381                             if ((yyval.objectPtr)) {
8382                                 thisParserPtr->parentNodePtr = (yyvsp[(2) - (2)].objectPtr)->nodePtr;
8383                             } else {
8384                                 thisParserPtr->parentNodePtr = NULL;
8385                             }
8386                         ;}
8387     break;
8388
8389   case 340:
8390 #line 5957 "parser-smi.y"
8391     {
8392                             (yyval.objectPtr) = (yyvsp[(1) - (1)].objectPtr);
8393                         ;}
8394     break;
8395
8396   case 341:
8397 #line 5962 "parser-smi.y"
8398     {
8399                             (yyval.objectPtr) = (yyvsp[(2) - (2)].objectPtr);
8400                         ;}
8401     break;
8402
8403   case 342:
8404 #line 5970 "parser-smi.y"
8405     {
8406                             Object *objectPtr;
8407                             Import *importPtr;
8408                             
8409                             if (thisParserPtr->parentNodePtr != smiHandle->rootNodePtr) {
8410                                 smiPrintError(thisParserPtr,
8411                                               ERR_OIDLABEL_NOT_FIRST, (yyvsp[(1) - (1)].id));
8412                             }
8413                             objectPtr = findObjectByModuleAndName(
8414                                 thisParserPtr->modulePtr, (yyvsp[(1) - (1)].id));
8415                             if (objectPtr) {
8416                                 (yyval.objectPtr) = objectPtr;
8417                                 smiFree((yyvsp[(1) - (1)].id));
8418                             } else {
8419                                 importPtr = findImportByName((yyvsp[(1) - (1)].id),
8420                                                              thisModulePtr);
8421                                 if (!importPtr ||
8422                                     (importPtr->kind == KIND_NOTFOUND)) {
8423                                     /*
8424                                      * If we are in a MODULE-COMPLIANCE
8425                                      * statement with a given MODULE...
8426                                      */
8427                                     if (thisParserPtr->complianceModulePtr) {
8428                                         objectPtr =
8429                                             findObjectByModuleAndName(
8430                                                 thisParserPtr->complianceModulePtr, (yyvsp[(1) - (1)].id));
8431                                         if (objectPtr) {
8432                                             importPtr = addImport(
8433                                                 (yyvsp[(1) - (1)].id),
8434                                                 thisParserPtr);
8435                                             setImportModulename(importPtr,
8436                                                                 thisParserPtr->complianceModulePtr->export.name);
8437                                             addImportFlags(importPtr,
8438                                                            FLAG_INCOMPLIANCE);
8439                                             importPtr->use++;
8440                                         } else {
8441                                             objectPtr = addObject((yyvsp[(1) - (1)].id),
8442                                                                   thisParserPtr->pendingNodePtr, 0,
8443                                                                   FLAG_INCOMPLETE,
8444                                                                   thisParserPtr);
8445                                             smiPrintError(thisParserPtr,
8446                                                           ERR_IDENTIFIER_NOT_IN_MODULE, (yyvsp[(1) - (1)].id),
8447                                                           thisParserPtr->complianceModulePtr->export.name);
8448                                         }
8449                                     } else if (thisParserPtr->capabilitiesModulePtr) {
8450                                         objectPtr =
8451                                             findObjectByModuleAndName(
8452                                                 thisParserPtr->capabilitiesModulePtr, (yyvsp[(1) - (1)].id));
8453                                         if (objectPtr) {
8454                                             importPtr = addImport(
8455                                                 (yyvsp[(1) - (1)].id),
8456                                                 thisParserPtr);
8457                                             setImportModulename(importPtr,
8458                                                                 thisParserPtr->capabilitiesModulePtr->
8459                                                                 export.name);
8460                                             addImportFlags(importPtr,
8461                                                            FLAG_INCOMPLIANCE);
8462                                             importPtr->use++;
8463                                         } else {
8464                                             objectPtr = addObject((yyvsp[(1) - (1)].id),
8465                                                                   thisParserPtr->pendingNodePtr, 0,
8466                                                                   FLAG_INCOMPLETE,
8467                                                                   thisParserPtr);
8468                                             smiPrintError(thisParserPtr,
8469                                                           ERR_IDENTIFIER_NOT_IN_MODULE, (yyvsp[(1) - (1)].id),
8470                                                           thisParserPtr->capabilitiesModulePtr->export.name);
8471                                         }
8472                                     } else {
8473                                         /* 
8474                                          * forward referenced node.
8475                                          * create it,
8476                                          * marked with FLAG_INCOMPLETE.
8477                                          */
8478                                         objectPtr = addObject((yyvsp[(1) - (1)].id),
8479                                                               thisParserPtr->pendingNodePtr,
8480                                                               0,
8481                                                               FLAG_INCOMPLETE,
8482                                                               thisParserPtr);
8483                                     }
8484                                     (yyval.objectPtr) = objectPtr;
8485                                 } else {
8486                                     /*
8487                                      * imported object.
8488                                      */
8489                                     importPtr->use++;
8490                                     (yyval.objectPtr) = findObjectByModulenameAndName(
8491                                         importPtr->export.module, (yyvsp[(1) - (1)].id));
8492                                     smiFree((yyvsp[(1) - (1)].id));
8493                                 }
8494                             }
8495                             if ((yyval.objectPtr))
8496                                 thisParserPtr->parentNodePtr = (yyval.objectPtr)->nodePtr;
8497                         ;}
8498     break;
8499
8500   case 343:
8501 #line 6064 "parser-smi.y"
8502     {
8503                             Object *objectPtr;
8504                             Import *importPtr;
8505                             char *md;
8506                             
8507                             if (thisParserPtr->parentNodePtr != smiHandle->rootNodePtr) {
8508                                 md = smiMalloc(sizeof(char) *
8509                                                (strlen((yyvsp[(1) - (3)].id)) + strlen((yyvsp[(3) - (3)].id)) + 2));
8510                                 sprintf(md, "%s.%s", (yyvsp[(1) - (3)].id), (yyvsp[(3) - (3)].id));
8511                                 smiPrintError(thisParserPtr,
8512                                               ERR_OIDLABEL_NOT_FIRST, md);
8513                                 smiFree(md);
8514                             } else {
8515                                 objectPtr = findObjectByModulenameAndName(
8516                                     (yyvsp[(1) - (3)].id), (yyvsp[(3) - (3)].id));
8517                                 if (objectPtr) {
8518                                     (yyval.objectPtr) = objectPtr;
8519                                     smiFree((yyvsp[(1) - (3)].id));
8520                                     smiFree((yyvsp[(3) - (3)].id));
8521                                 } else {
8522                                     importPtr = findImportByModulenameAndName(
8523                                         (yyvsp[(1) - (3)].id), (yyvsp[(3) - (3)].id), thisModulePtr);
8524                                     if (!importPtr ||
8525                                         (importPtr->kind == KIND_NOTFOUND)) {
8526                                         /* TODO: check: $1 == thisModule ? */
8527                                         /*
8528                                          * If we are in a MODULE-COMPLIANCE
8529                                          * statement with a given MODULE...
8530                                          */
8531                                         if (thisParserPtr->complianceModulePtr) {
8532                                             objectPtr =
8533                                                 findObjectByModuleAndName(
8534                                                     thisParserPtr->complianceModulePtr, (yyvsp[(1) - (3)].id));
8535                                             if (objectPtr) {
8536                                                 importPtr = addImport(
8537                                                     (yyvsp[(1) - (3)].id),
8538                                                     thisParserPtr);
8539                                                 setImportModulename(importPtr,
8540                                                     thisParserPtr->complianceModulePtr->export.name);
8541                                                 addImportFlags(importPtr,
8542                                                                FLAG_INCOMPLIANCE);
8543                                                 importPtr->use++;
8544                                             } else {
8545                                                 objectPtr = addObject((yyvsp[(1) - (3)].id),
8546                                                     thisParserPtr->pendingNodePtr, 0,
8547                                                     FLAG_INCOMPLETE,
8548                                                     thisParserPtr);
8549                                                 smiPrintError(thisParserPtr,
8550                                               ERR_IDENTIFIER_NOT_IN_MODULE, (yyvsp[(1) - (3)].id),
8551                                              thisParserPtr->complianceModulePtr->export.name);
8552                                             }
8553                                         } else if (thisParserPtr->capabilitiesModulePtr) {
8554                                             objectPtr =
8555                                                 findObjectByModuleAndName(
8556                                                     thisParserPtr->capabilitiesModulePtr, (yyvsp[(1) - (3)].id));
8557                                             if (objectPtr) {
8558                                                 importPtr = addImport(
8559                                                     (yyvsp[(1) - (3)].id),
8560                                                     thisParserPtr);
8561                                                 setImportModulename(importPtr,
8562                                                         thisParserPtr->capabilitiesModulePtr->
8563                                                                   export.name);
8564                                                 addImportFlags(importPtr,
8565                                                                FLAG_INCOMPLIANCE);
8566                                                 importPtr->use++;
8567                                             } else {
8568                                                 objectPtr = addObject((yyvsp[(1) - (3)].id),
8569                                                     thisParserPtr->pendingNodePtr, 0,
8570                                                     FLAG_INCOMPLETE,
8571                                                     thisParserPtr);
8572                                                 smiPrintError(thisParserPtr,
8573                                               ERR_IDENTIFIER_NOT_IN_MODULE, (yyvsp[(1) - (3)].id),
8574                                            thisParserPtr->capabilitiesModulePtr->export.name);
8575                                             }
8576                                         } else {
8577                                             /* 
8578                                              * forward referenced node.
8579                                              * create it,
8580                                              * marked with FLAG_INCOMPLETE.
8581                                              */
8582                                             objectPtr = addObject((yyvsp[(3) - (3)].id),
8583                                                             thisParserPtr->pendingNodePtr,
8584                                                               0,
8585                                                               FLAG_INCOMPLETE,
8586                                                               thisParserPtr);
8587                                             smiFree((yyvsp[(1) - (3)].id));
8588                                         }
8589                                         (yyval.objectPtr) = objectPtr;
8590                                     } else {
8591                                         /*
8592                                          * imported object.
8593                                          */
8594                                         importPtr->use++;
8595                                         (yyval.objectPtr) = findObjectByModulenameAndName(
8596                                             importPtr->export.module, (yyvsp[(3) - (3)].id));
8597                                         smiFree((yyvsp[(1) - (3)].id));
8598                                         smiFree((yyvsp[(3) - (3)].id));
8599                                     }
8600                                 }
8601                                 if ((yyval.objectPtr))
8602                                     thisParserPtr->parentNodePtr = (yyval.objectPtr)->nodePtr;
8603                             }
8604                         ;}
8605     break;
8606
8607   case 344:
8608 #line 6168 "parser-smi.y"
8609     {
8610                             Node *nodePtr;
8611                             Object *objectPtr;
8612
8613                             nodePtr = findNodeByParentAndSubid(thisParserPtr->parentNodePtr,
8614                                                                (yyvsp[(1) - (1)].unsigned32));
8615                             if (nodePtr && nodePtr->lastObjectPtr &&
8616                         (nodePtr->lastObjectPtr->modulePtr == thisModulePtr)) {
8617                                 /*
8618                                  * hopefully, the last defined Object for
8619                                  * this Node is the one we expect.
8620                                  */
8621                                 (yyval.objectPtr) = nodePtr->lastObjectPtr;
8622                             } else {
8623                                 objectPtr = addObject(NULL,
8624                                                       thisParserPtr->parentNodePtr,
8625                                                       (yyvsp[(1) - (1)].unsigned32),
8626                                                       FLAG_INCOMPLETE,
8627                                                       thisParserPtr);
8628                                 (yyval.objectPtr) = objectPtr;
8629                             }
8630                             thisParserPtr->parentNodePtr = (yyval.objectPtr)->nodePtr;
8631                         ;}
8632     break;
8633
8634   case 345:
8635 #line 6192 "parser-smi.y"
8636     {
8637                             Object *objectPtr = NULL;
8638                             Object *oldObjectPtr = NULL;
8639                             Node *oldNodePtr = NULL;
8640                             
8641                             /* TODO: search in local module and
8642                              *       in imported modules
8643                              */
8644
8645                             oldNodePtr = findNodeByParentAndSubid(
8646                                 thisParserPtr->parentNodePtr, (yyvsp[(3) - (4)].unsigned32));
8647                             oldObjectPtr = findObjectByModuleAndName(
8648                                 thisParserPtr->modulePtr, (yyvsp[(1) - (4)].id));
8649
8650                             if (oldObjectPtr &&
8651                                 ((oldObjectPtr->nodePtr->subid != (yyvsp[(3) - (4)].unsigned32)) ||
8652                                  (oldObjectPtr->nodePtr->parentPtr != thisParserPtr->parentNodePtr))) {
8653                                 smiPrintError(thisParserPtr,
8654                                               ERR_IDENTIFIER_OID_CHANGED,
8655                                               (yyvsp[(1) - (4)].id));
8656                                 smiPrintErrorAtLine(thisParserPtr,
8657                                                     ERR_PREVIOUS_DEFINITION,
8658                                                     oldObjectPtr->line,
8659                                                     oldObjectPtr->export.name);
8660                                 objectPtr = addObject((yyvsp[(1) - (4)].id),
8661                                                       thisParserPtr->parentNodePtr,
8662                                                       (yyvsp[(3) - (4)].unsigned32), 0, thisParserPtr);
8663                                 setObjectDecl(objectPtr,
8664                                               SMI_DECL_IMPL_OBJECT);
8665                                 (yyval.objectPtr) = objectPtr;
8666                                 thisParserPtr->parentNodePtr = (yyval.objectPtr)->nodePtr;
8667                             } else if (oldNodePtr &&
8668                                        oldNodePtr->lastObjectPtr &&
8669                                        oldNodePtr->lastObjectPtr->export.name &&
8670                                        strcmp(oldNodePtr->lastObjectPtr->export.name, (yyvsp[(1) - (4)].id))) {
8671                                 smiPrintError(thisParserPtr,
8672                                               ERR_OIDLABEL_CHANGED,
8673                                               (yyvsp[(1) - (4)].id), oldNodePtr->lastObjectPtr->export.name);
8674                                 smiPrintErrorAtLine(thisParserPtr,
8675                                                     ERR_PREVIOUS_DEFINITION,
8676                                                     oldNodePtr->lastObjectPtr->line,
8677                                                     oldNodePtr->lastObjectPtr->export.name);
8678                                 objectPtr = addObject((yyvsp[(1) - (4)].id),
8679                                                       thisParserPtr->parentNodePtr,
8680                                                       (yyvsp[(3) - (4)].unsigned32), 0, thisParserPtr);
8681                                 setObjectDecl(objectPtr,
8682                                               SMI_DECL_IMPL_OBJECT);
8683                                 (yyval.objectPtr) = objectPtr;
8684                                 thisParserPtr->parentNodePtr = (yyval.objectPtr)->nodePtr;
8685                             } else {
8686                                 objectPtr = addObject((yyvsp[(1) - (4)].id), thisParserPtr->parentNodePtr,
8687                                                       (yyvsp[(3) - (4)].unsigned32), 0,
8688                                                       thisParserPtr);
8689                                 setObjectDecl(objectPtr,
8690                                               SMI_DECL_IMPL_OBJECT);
8691                                 (yyval.objectPtr) = objectPtr;
8692                                 thisParserPtr->parentNodePtr = (yyval.objectPtr)->nodePtr;
8693                             }
8694                         ;}
8695     break;
8696
8697   case 346:
8698 #line 6252 "parser-smi.y"
8699     {
8700                             Object *objectPtr = NULL;
8701                             Object *oldObjectPtr = NULL;
8702                             Node *oldNodePtr = NULL;
8703                             char *md;
8704
8705                             md = smiMalloc(sizeof(char) *
8706                                            (strlen((yyvsp[(1) - (6)].id)) + strlen((yyvsp[(3) - (6)].id)) + 2));
8707                             sprintf(md, "%s.%s", (yyvsp[(1) - (6)].id), (yyvsp[(3) - (6)].id));
8708
8709                             oldNodePtr = findNodeByParentAndSubid(
8710                                 thisParserPtr->parentNodePtr, (yyvsp[(5) - (6)].unsigned32));
8711                             oldObjectPtr = findObjectByModulenameAndName(
8712                                 (yyvsp[(1) - (6)].id), (yyvsp[(3) - (6)].id));
8713
8714                             if (oldObjectPtr &&
8715                                 ((oldObjectPtr->nodePtr->subid != (yyvsp[(5) - (6)].unsigned32)) ||
8716                                  (oldObjectPtr->nodePtr->parentPtr != thisParserPtr->parentNodePtr))) {
8717                                 smiPrintError(thisParserPtr,
8718                                               ERR_ILLEGALLY_QUALIFIED, md);
8719                                 smiPrintError(thisParserPtr,
8720                                               ERR_IDENTIFIER_OID_CHANGED,
8721                                               (yyvsp[(3) - (6)].id));
8722                                 smiPrintErrorAtLine(thisParserPtr,
8723                                                     ERR_PREVIOUS_DEFINITION,
8724                                                     oldObjectPtr->line,
8725                                                     oldObjectPtr->export.name);
8726                                 objectPtr = addObject((yyvsp[(3) - (6)].id),
8727                                                       thisParserPtr->parentNodePtr,
8728                                                       (yyvsp[(5) - (6)].unsigned32), 0, thisParserPtr);
8729                                 setObjectDecl(objectPtr,
8730                                               SMI_DECL_IMPL_OBJECT);
8731                                 (yyval.objectPtr) = objectPtr;
8732                                 thisParserPtr->parentNodePtr = (yyval.objectPtr)->nodePtr;
8733                             } else if (oldNodePtr &&
8734                                        oldNodePtr->lastObjectPtr &&
8735                                        strcmp(oldNodePtr->lastObjectPtr->export.name, (yyvsp[(3) - (6)].id))) {
8736                                 smiPrintError(thisParserPtr,
8737                                               ERR_ILLEGALLY_QUALIFIED, md);
8738                                 smiPrintError(thisParserPtr,
8739                                               ERR_OIDLABEL_CHANGED,
8740                                               (yyvsp[(3) - (6)].id), oldNodePtr->lastObjectPtr->export.name);
8741                                 smiPrintErrorAtLine(thisParserPtr,
8742                                                     ERR_PREVIOUS_DEFINITION,
8743                                                     oldNodePtr->lastObjectPtr->line,
8744                                                     oldNodePtr->lastObjectPtr->export.name);
8745                                 objectPtr = addObject((yyvsp[(3) - (6)].id),
8746                                                       thisParserPtr->parentNodePtr,
8747                                                       (yyvsp[(5) - (6)].unsigned32), 0, thisParserPtr);
8748                                 setObjectDecl(objectPtr,
8749                                               SMI_DECL_IMPL_OBJECT);
8750                                 (yyval.objectPtr) = objectPtr;
8751                                 thisParserPtr->parentNodePtr = (yyval.objectPtr)->nodePtr;
8752                             } else {
8753                                 smiPrintError(thisParserPtr,
8754                                               ERR_ILLEGALLY_QUALIFIED, md);
8755                                 objectPtr = addObject((yyvsp[(3) - (6)].id), thisParserPtr->parentNodePtr,
8756                                                       (yyvsp[(5) - (6)].unsigned32), 0,
8757                                                       thisParserPtr);
8758                                 setObjectDecl(objectPtr,
8759                                               SMI_DECL_IMPL_OBJECT);
8760                                 (yyval.objectPtr) = objectPtr;
8761                                 thisParserPtr->parentNodePtr = (yyval.objectPtr)->nodePtr;
8762                             }
8763                             smiFree(md);
8764                         ;}
8765     break;
8766
8767   case 347:
8768 #line 6321 "parser-smi.y"
8769     { (yyval.text) = NULL; ;}
8770     break;
8771
8772   case 348:
8773 #line 6325 "parser-smi.y"
8774     { (yyval.err) = 0; ;}
8775     break;
8776
8777   case 349:
8778 #line 6327 "parser-smi.y"
8779     { (yyval.err) = 0; ;}
8780     break;
8781
8782   case 350:
8783 #line 6331 "parser-smi.y"
8784     { (yyval.err) = 0; ;}
8785     break;
8786
8787   case 351:
8788 #line 6333 "parser-smi.y"
8789     { (yyval.err) = 0; ;}
8790     break;
8791
8792   case 352:
8793 #line 6337 "parser-smi.y"
8794     {
8795                             thisParserPtr->firstStatementLine = thisParserPtr->line;
8796                             thisParserPtr->currentDecl = SMI_DECL_OBJECTGROUP;
8797                             
8798                             checkNameLen(thisParserPtr, (yyvsp[(1) - (1)].id),
8799                                          ERR_OIDNAME_32, ERR_OIDNAME_64);
8800                             smiCheckObjectName(thisParserPtr,
8801                                                thisModulePtr, (yyvsp[(1) - (1)].id));
8802                         ;}
8803     break;
8804
8805   case 353:
8806 #line 6347 "parser-smi.y"
8807     {
8808                             Import *importPtr;
8809                             
8810                             if (thisModulePtr->export.language == SMI_LANGUAGE_UNKNOWN)
8811                                 thisModulePtr->export.language = SMI_LANGUAGE_SMIV2;
8812
8813                             importPtr = findImportByName("OBJECT-GROUP",
8814                                                          thisModulePtr);
8815                             if (importPtr) {
8816                                 importPtr->use++;
8817                             } else {
8818                                 smiPrintError(thisParserPtr,
8819                                               ERR_MACRO_NOT_IMPORTED,
8820                                               "OBJECT-GROUP", "SNMPv2-CONF");
8821                             }
8822                         ;}
8823     break;
8824
8825   case 354:
8826 #line 6366 "parser-smi.y"
8827     {
8828                             checkDescr(thisParserPtr, (yyvsp[(9) - (9)].text));
8829                         ;}
8830     break;
8831
8832   case 355:
8833 #line 6371 "parser-smi.y"
8834     {
8835                             Object *objectPtr;
8836                             
8837                             objectPtr = (yyvsp[(14) - (15)].objectPtr);
8838
8839                             smiCheckObjectReuse(thisParserPtr, (yyvsp[(1) - (15)].id), &objectPtr);
8840
8841                             objectPtr = setObjectName(objectPtr, (yyvsp[(1) - (15)].id), thisParserPtr);
8842                             setObjectDecl(objectPtr, SMI_DECL_OBJECTGROUP);
8843                             setObjectLine(objectPtr, thisParserPtr->firstStatementLine,
8844                                           thisParserPtr);
8845                             addObjectFlags(objectPtr, FLAG_REGISTERED);
8846                             deleteObjectFlags(objectPtr, FLAG_INCOMPLETE);
8847                             setObjectStatus(objectPtr, (yyvsp[(7) - (15)].status));
8848                             setObjectDescription(objectPtr, (yyvsp[(9) - (15)].text), thisParserPtr);
8849                             if ((yyvsp[(11) - (15)].text)) {
8850                                 setObjectReference(objectPtr, (yyvsp[(11) - (15)].text), thisParserPtr);
8851                             }
8852                             setObjectAccess(objectPtr,
8853                                             SMI_ACCESS_NOT_ACCESSIBLE);
8854                             setObjectList(objectPtr, (yyvsp[(5) - (15)].listPtr));
8855                             (yyval.err) = 0;
8856                         ;}
8857     break;
8858
8859   case 356:
8860 #line 6397 "parser-smi.y"
8861     {
8862                             thisParserPtr->firstStatementLine = thisParserPtr->line;
8863                             thisParserPtr->currentDecl = SMI_DECL_NOTIFICATIONGROUP;
8864                             
8865                             checkNameLen(thisParserPtr, (yyvsp[(1) - (1)].id),
8866                                          ERR_OIDNAME_32, ERR_OIDNAME_64);
8867                             smiCheckObjectName(thisParserPtr,
8868                                                thisModulePtr, (yyvsp[(1) - (1)].id));
8869                         ;}
8870     break;
8871
8872   case 357:
8873 #line 6407 "parser-smi.y"
8874     {
8875                             Import *importPtr;
8876                             if (thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI)
8877                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "NOTIFICATION-GROUP");
8878                             
8879                             if (thisModulePtr->export.language == SMI_LANGUAGE_UNKNOWN)
8880                                 thisModulePtr->export.language = SMI_LANGUAGE_SMIV2;
8881
8882                             importPtr = findImportByName("NOTIFICATION-GROUP",
8883                                                          thisModulePtr);
8884                             if (importPtr) {
8885                                 importPtr->use++;
8886                             } else {
8887                                 smiPrintError(thisParserPtr,
8888                                               ERR_MACRO_NOT_IMPORTED,
8889                                               "NOTIFICATION-GROUP",
8890                                               "SNMPv2-CONF");
8891                             }
8892                         ;}
8893     break;
8894
8895   case 358:
8896 #line 6429 "parser-smi.y"
8897     {
8898                             checkDescr(thisParserPtr, (yyvsp[(9) - (9)].text));
8899                         ;}
8900     break;
8901
8902   case 359:
8903 #line 6434 "parser-smi.y"
8904     {
8905                             Object *objectPtr;
8906                             
8907                             objectPtr = (yyvsp[(14) - (15)].objectPtr);
8908
8909                             smiCheckObjectReuse(thisParserPtr, (yyvsp[(1) - (15)].id), &objectPtr);
8910
8911                             objectPtr = setObjectName(objectPtr, (yyvsp[(1) - (15)].id), thisParserPtr);
8912                             setObjectDecl(objectPtr,
8913                                           SMI_DECL_NOTIFICATIONGROUP);
8914                             setObjectLine(objectPtr, thisParserPtr->firstStatementLine,
8915                                           thisParserPtr);
8916                             addObjectFlags(objectPtr, FLAG_REGISTERED);
8917                             deleteObjectFlags(objectPtr, FLAG_INCOMPLETE);
8918                             setObjectStatus(objectPtr, (yyvsp[(7) - (15)].status));
8919                             setObjectDescription(objectPtr, (yyvsp[(9) - (15)].text), thisParserPtr);
8920                             if ((yyvsp[(11) - (15)].text)) {
8921                                 setObjectReference(objectPtr, (yyvsp[(11) - (15)].text), thisParserPtr);
8922                             }
8923                             setObjectAccess(objectPtr,
8924                                             SMI_ACCESS_NOT_ACCESSIBLE);
8925                             setObjectList(objectPtr, (yyvsp[(5) - (15)].listPtr));
8926                             (yyval.err) = 0;
8927                         ;}
8928     break;
8929
8930   case 360:
8931 #line 6461 "parser-smi.y"
8932     {
8933                             thisParserPtr->firstStatementLine = thisParserPtr->line;
8934                             thisParserPtr->currentDecl = SMI_DECL_MODULECOMPLIANCE;
8935                             
8936                             checkNameLen(thisParserPtr, (yyvsp[(1) - (1)].id),
8937                                          ERR_OIDNAME_32, ERR_OIDNAME_64);
8938                             smiCheckObjectName(thisParserPtr,
8939                                                thisModulePtr, (yyvsp[(1) - (1)].id));
8940                         ;}
8941     break;
8942
8943   case 361:
8944 #line 6471 "parser-smi.y"
8945     {
8946                             Import *importPtr;
8947                             
8948                             if (thisModulePtr->export.language == SMI_LANGUAGE_UNKNOWN)
8949                                 thisModulePtr->export.language = SMI_LANGUAGE_SMIV2;
8950                             importPtr = findImportByName("MODULE-COMPLIANCE",
8951                                                          thisModulePtr);
8952                             if (importPtr) {
8953                                 importPtr->use++;
8954                             } else {
8955                                 smiPrintError(thisParserPtr,
8956                                               ERR_MACRO_NOT_IMPORTED,
8957                                               "MODULE-COMPLIANCE",
8958                                               "SNMPv2-CONF");
8959                             }
8960                         ;}
8961     break;
8962
8963   case 362:
8964 #line 6489 "parser-smi.y"
8965     {
8966                             checkDescr(thisParserPtr, (yyvsp[(8) - (8)].text));
8967                         ;}
8968     break;
8969
8970   case 363:
8971 #line 6495 "parser-smi.y"
8972     {
8973                             Object *objectPtr;
8974                             Option *optionPtr;
8975                             Refinement *refinementPtr;
8976                             List *listPtr;
8977                             
8978                             objectPtr = (yyvsp[(14) - (15)].objectPtr);
8979
8980                             smiCheckObjectReuse(thisParserPtr, (yyvsp[(1) - (15)].id), &objectPtr);
8981
8982                             setObjectName(objectPtr, (yyvsp[(1) - (15)].id), thisParserPtr);
8983                             setObjectDecl(objectPtr,
8984                                           SMI_DECL_MODULECOMPLIANCE);
8985                             setObjectLine(objectPtr, thisParserPtr->firstStatementLine,
8986                                           thisParserPtr);
8987                             addObjectFlags(objectPtr, FLAG_REGISTERED);
8988                             deleteObjectFlags(objectPtr, FLAG_INCOMPLETE);
8989                             setObjectStatus(objectPtr, (yyvsp[(6) - (15)].status));
8990                             setObjectDescription(objectPtr, (yyvsp[(8) - (15)].text), thisParserPtr);
8991                             if ((yyvsp[(10) - (15)].text)) {
8992                                 setObjectReference(objectPtr, (yyvsp[(10) - (15)].text), thisParserPtr);
8993                             }
8994                             setObjectAccess(objectPtr,
8995                                             SMI_ACCESS_NOT_ACCESSIBLE);
8996                             setObjectList(objectPtr, (yyvsp[(11) - (15)].compl).mandatorylistPtr);
8997                             objectPtr->optionlistPtr = (yyvsp[(11) - (15)].compl).optionlistPtr;
8998                             objectPtr->refinementlistPtr =
8999                                                           (yyvsp[(11) - (15)].compl).refinementlistPtr;
9000
9001                             if ((yyvsp[(11) - (15)].compl).optionlistPtr) {
9002                                 for (listPtr = (yyvsp[(11) - (15)].compl).optionlistPtr;
9003                                      listPtr;
9004                                      listPtr = listPtr->nextPtr) {
9005                                     optionPtr = ((Option *)(listPtr->ptr));
9006                                     optionPtr->compliancePtr = objectPtr;
9007                                 }
9008                             }
9009
9010                             /*
9011                              * Dirty: Fake the types' names in the
9012                              * refinement list:
9013                              * ``<compliancename>+<objecttypename>+type''
9014                              * ``<compliancename>+<objecttypename>+writetype''
9015                              */
9016                             if ((yyvsp[(11) - (15)].compl).refinementlistPtr) {
9017                                 for (listPtr = (yyvsp[(11) - (15)].compl).refinementlistPtr;
9018                                      listPtr;
9019                                      listPtr = listPtr->nextPtr) {
9020                                     refinementPtr =
9021                                         ((Refinement *)(listPtr->ptr));
9022                                     refinementPtr->compliancePtr = objectPtr;
9023                                 }
9024                             }
9025
9026                             (yyval.err) = 0;
9027                         ;}
9028     break;
9029
9030   case 364:
9031 #line 6554 "parser-smi.y"
9032     {
9033                             (yyval.compl) = (yyvsp[(1) - (1)].compl);
9034                         ;}
9035     break;
9036
9037   case 365:
9038 #line 6560 "parser-smi.y"
9039     {
9040                             (yyval.compl) = (yyvsp[(1) - (1)].compl);
9041                         ;}
9042     break;
9043
9044   case 366:
9045 #line 6564 "parser-smi.y"
9046     {
9047                             List *listPtr;
9048                             
9049                             /* concatenate lists in $1 and $2 */
9050                             if ((yyvsp[(1) - (2)].compl).mandatorylistPtr) {
9051                                 for (listPtr = (yyvsp[(1) - (2)].compl).mandatorylistPtr;
9052                                      listPtr->nextPtr;
9053                                      listPtr = listPtr->nextPtr);
9054                                 listPtr->nextPtr = (yyvsp[(2) - (2)].compl).mandatorylistPtr;
9055                                 (yyval.compl).mandatorylistPtr = (yyvsp[(1) - (2)].compl).mandatorylistPtr;
9056                             } else {
9057                                 (yyval.compl).mandatorylistPtr = (yyvsp[(2) - (2)].compl).mandatorylistPtr;
9058                             }
9059                             if ((yyvsp[(1) - (2)].compl).optionlistPtr) {
9060                                 for (listPtr = (yyvsp[(1) - (2)].compl).optionlistPtr;
9061                                      listPtr->nextPtr;
9062                                      listPtr = listPtr->nextPtr);
9063                                 listPtr->nextPtr = (yyvsp[(2) - (2)].compl).optionlistPtr;
9064                                 (yyval.compl).optionlistPtr = (yyvsp[(1) - (2)].compl).optionlistPtr;
9065                             } else {
9066                                 (yyval.compl).optionlistPtr = (yyvsp[(2) - (2)].compl).optionlistPtr;
9067                             }
9068                             if ((yyvsp[(1) - (2)].compl).refinementlistPtr) {
9069                                 for (listPtr = (yyvsp[(1) - (2)].compl).refinementlistPtr;
9070                                      listPtr->nextPtr;
9071                                      listPtr = listPtr->nextPtr);
9072                                 listPtr->nextPtr = (yyvsp[(2) - (2)].compl).refinementlistPtr;
9073                                 (yyval.compl).refinementlistPtr = (yyvsp[(1) - (2)].compl).refinementlistPtr;
9074                             } else {
9075                                 (yyval.compl).refinementlistPtr = (yyvsp[(2) - (2)].compl).refinementlistPtr;
9076                             }
9077                         ;}
9078     break;
9079
9080   case 367:
9081 #line 6599 "parser-smi.y"
9082     {
9083                             /*
9084                              * Remember the module. SMIv2 is broken by
9085                              * design to allow subsequent clauses to
9086                              * refer identifiers that are not
9087                              * imported.  Although, SMIv2 does not
9088                              * require, we will fake it by inserting
9089                              * appropriate imports.
9090                              */
9091                             if ((yyvsp[(2) - (2)].modulePtr) == thisModulePtr)
9092                                 thisParserPtr->complianceModulePtr = NULL;
9093                             else
9094                                 thisParserPtr->complianceModulePtr = (yyvsp[(2) - (2)].modulePtr);
9095                         ;}
9096     break;
9097
9098   case 368:
9099 #line 6615 "parser-smi.y"
9100     {
9101                             (yyval.compl).mandatorylistPtr = (yyvsp[(4) - (5)].listPtr);
9102                             (yyval.compl).optionlistPtr = (yyvsp[(5) - (5)].compl).optionlistPtr;
9103                             (yyval.compl).refinementlistPtr = (yyvsp[(5) - (5)].compl).refinementlistPtr;
9104                             if (thisParserPtr->complianceModulePtr) {
9105                                 checkImports(thisParserPtr->complianceModulePtr,
9106                                              thisParserPtr);
9107                                 thisParserPtr->complianceModulePtr = NULL;
9108                             }
9109                         ;}
9110     break;
9111
9112   case 369:
9113 #line 6628 "parser-smi.y"
9114     {
9115                             (yyval.modulePtr) = findModuleByName((yyvsp[(1) - (2)].id));
9116                             /* TODO: handle objectIdentifier */
9117                             if (!(yyval.modulePtr)) {
9118                                 (yyval.modulePtr) = loadModule((yyvsp[(1) - (2)].id), thisParserPtr);
9119                             }
9120                             smiFree((yyvsp[(1) - (2)].id));
9121                         ;}
9122     break;
9123
9124   case 370:
9125 #line 6637 "parser-smi.y"
9126     {
9127                             (yyval.modulePtr) = findModuleByName((yyvsp[(1) - (1)].id));
9128                             if (!(yyval.modulePtr)) {
9129                                 (yyval.modulePtr) = loadModule((yyvsp[(1) - (1)].id), thisParserPtr);
9130                             }
9131                             smiFree((yyvsp[(1) - (1)].id));
9132                         ;}
9133     break;
9134
9135   case 371:
9136 #line 6646 "parser-smi.y"
9137     {
9138                             (yyval.modulePtr) = thisModulePtr;
9139                         ;}
9140     break;
9141
9142   case 372:
9143 #line 6652 "parser-smi.y"
9144     {
9145                             (yyval.listPtr) = (yyvsp[(3) - (4)].listPtr);
9146                         ;}
9147     break;
9148
9149   case 373:
9150 #line 6656 "parser-smi.y"
9151     {
9152                             (yyval.listPtr) = NULL;
9153                         ;}
9154     break;
9155
9156   case 374:
9157 #line 6662 "parser-smi.y"
9158     {
9159                             (yyval.listPtr) = smiMalloc(sizeof(List));
9160                             (yyval.listPtr)->ptr = (yyvsp[(1) - (1)].objectPtr);
9161                             (yyval.listPtr)->nextPtr = NULL;
9162                         ;}
9163     break;
9164
9165   case 375:
9166 #line 6668 "parser-smi.y"
9167     {
9168                             List *p, *pp;
9169                             
9170                             p = smiMalloc(sizeof(List));
9171                             p->ptr = (yyvsp[(3) - (3)].objectPtr);
9172                             p->nextPtr = NULL;
9173                             for (pp = (yyvsp[(1) - (3)].listPtr); pp->nextPtr; pp = pp->nextPtr);
9174                             pp->nextPtr = p;
9175                             (yyval.listPtr) = (yyvsp[(1) - (3)].listPtr);
9176                         ;}
9177     break;
9178
9179   case 376:
9180 #line 6681 "parser-smi.y"
9181     {
9182                             /* TODO: check that objectIdentifier is
9183                                found, is defined in thisParserPtr->complianceModulePtr,
9184                                and is a group node. */
9185                             Import *importPtr;
9186
9187                             (yyval.objectPtr) = (yyvsp[(1) - (1)].objectPtr);
9188                             if (thisParserPtr->complianceModulePtr) {
9189                                 (yyval.objectPtr) = findObjectByModuleAndName(
9190                                                            thisParserPtr->complianceModulePtr,
9191                                                            (yyvsp[(1) - (1)].objectPtr)->export.name);
9192                             }
9193                             if (thisParserPtr->complianceModulePtr && (yyvsp[(1) - (1)].objectPtr)->export.name) {
9194                                 importPtr = findImportByModulenameAndName(
9195                                     thisParserPtr->complianceModulePtr->export.name,
9196                                     (yyvsp[(1) - (1)].objectPtr)->export.name, thisModulePtr);
9197                                 if (importPtr)
9198                                     importPtr->use++;
9199                             }
9200                         ;}
9201     break;
9202
9203   case 377:
9204 #line 6704 "parser-smi.y"
9205     {
9206                             (yyval.compl).mandatorylistPtr = NULL;
9207                             (yyval.compl).optionlistPtr = (yyvsp[(1) - (1)].compl).optionlistPtr;
9208                             (yyval.compl).refinementlistPtr = (yyvsp[(1) - (1)].compl).refinementlistPtr;
9209                         ;}
9210     break;
9211
9212   case 378:
9213 #line 6710 "parser-smi.y"
9214     {
9215                             (yyval.compl).mandatorylistPtr = NULL;
9216                             (yyval.compl).optionlistPtr = NULL;
9217                             (yyval.compl).refinementlistPtr = NULL;
9218                         ;}
9219     break;
9220
9221   case 379:
9222 #line 6718 "parser-smi.y"
9223     {
9224                             (yyval.compl) = (yyvsp[(1) - (1)].compl);
9225                         ;}
9226     break;
9227
9228   case 380:
9229 #line 6722 "parser-smi.y"
9230     {
9231                             List *listPtr;
9232                             int stop;
9233                             
9234                             (yyval.compl).mandatorylistPtr = NULL;
9235
9236                             /* check for duplicates in optionlist */
9237                             stop = 0;
9238                             if ((yyvsp[(2) - (2)].compl).optionlistPtr) {
9239                                 for (listPtr = (yyvsp[(1) - (2)].compl).optionlistPtr; listPtr;
9240                                      listPtr = listPtr->nextPtr) {
9241                                     if (((Option *)listPtr->ptr)->objectPtr ==
9242                                         ((Option *)(yyvsp[(2) - (2)].compl).optionlistPtr->ptr)->objectPtr) {
9243                                         smiPrintError(thisParserPtr,
9244                                                       ERR_OPTIONALGROUP_ALREADY_EXISTS,
9245                                                       ((Option *)(yyvsp[(2) - (2)].compl).optionlistPtr->ptr)->objectPtr->export.name);
9246                                         stop = 1;
9247                                         (yyval.compl).optionlistPtr = (yyvsp[(1) - (2)].compl).optionlistPtr;
9248                                     }
9249                                 }
9250                             }
9251         
9252                             /* concatenate optionlists */
9253                             if ((yyvsp[(1) - (2)].compl).optionlistPtr) {
9254                                 for (listPtr = (yyvsp[(1) - (2)].compl).optionlistPtr;
9255                                      listPtr->nextPtr;
9256                                      listPtr = listPtr->nextPtr);
9257                                 if (!stop) {
9258                                     listPtr->nextPtr = (yyvsp[(2) - (2)].compl).optionlistPtr;
9259                                 }
9260                                 (yyval.compl).optionlistPtr = (yyvsp[(1) - (2)].compl).optionlistPtr;
9261                             } else {
9262                                 (yyval.compl).optionlistPtr = (yyvsp[(2) - (2)].compl).optionlistPtr;
9263                             }
9264
9265                             /* check for duplicates in refinementlist */
9266                             stop = 0;
9267                             if ((yyvsp[(2) - (2)].compl).refinementlistPtr) {
9268                                 for (listPtr = (yyvsp[(1) - (2)].compl).refinementlistPtr; listPtr;
9269                                      listPtr = listPtr->nextPtr) {
9270                                     if (((Refinement *)listPtr->ptr)->objectPtr ==
9271                                         ((Refinement *)(yyvsp[(2) - (2)].compl).refinementlistPtr->ptr)->objectPtr) {
9272                                         smiPrintError(thisParserPtr,
9273                                                       ERR_REFINEMENT_ALREADY_EXISTS,
9274                                                       ((Refinement *)(yyvsp[(2) - (2)].compl).refinementlistPtr->ptr)->objectPtr->export.name);
9275                                         stop = 1;
9276                                         (yyval.compl).refinementlistPtr = (yyvsp[(1) - (2)].compl).refinementlistPtr;
9277                                     }
9278                                 }
9279                             }
9280                             
9281                             /* concatenate refinementlists */
9282                             if ((yyvsp[(1) - (2)].compl).refinementlistPtr) {
9283                                 for (listPtr = (yyvsp[(1) - (2)].compl).refinementlistPtr;
9284                                      listPtr->nextPtr;
9285                                      listPtr = listPtr->nextPtr);
9286                                 if (!stop) {
9287                                     listPtr->nextPtr = (yyvsp[(2) - (2)].compl).refinementlistPtr;
9288                                 }
9289                                 (yyval.compl).refinementlistPtr = (yyvsp[(1) - (2)].compl).refinementlistPtr;
9290                             } else {
9291                                 (yyval.compl).refinementlistPtr = (yyvsp[(2) - (2)].compl).refinementlistPtr;
9292                             }
9293                         ;}
9294     break;
9295
9296   case 381:
9297 #line 6789 "parser-smi.y"
9298     {
9299                             (yyval.compl).mandatorylistPtr = NULL;
9300                             (yyval.compl).optionlistPtr = (yyvsp[(1) - (1)].listPtr);
9301                             (yyval.compl).refinementlistPtr = NULL;
9302                         ;}
9303     break;
9304
9305   case 382:
9306 #line 6795 "parser-smi.y"
9307     {
9308                             (yyval.compl).mandatorylistPtr = NULL;
9309                             (yyval.compl).optionlistPtr = NULL;
9310                             (yyval.compl).refinementlistPtr = (yyvsp[(1) - (1)].listPtr);
9311                         ;}
9312     break;
9313
9314   case 383:
9315 #line 6803 "parser-smi.y"
9316     {
9317                             thisParserPtr->firstNestedStatementLine = thisParserPtr->line;
9318                         ;}
9319     break;
9320
9321   case 384:
9322 #line 6808 "parser-smi.y"
9323     {
9324                             Import *importPtr;
9325                             
9326                             if (thisParserPtr->complianceModulePtr && (yyvsp[(3) - (5)].objectPtr)->export.name) {
9327                                 importPtr = findImportByModulenameAndName(
9328                                                     thisParserPtr->complianceModulePtr->export.name,
9329                                                     (yyvsp[(3) - (5)].objectPtr)->export.name,
9330                                                     thisModulePtr);
9331                                 if (importPtr)
9332                                     importPtr->use++;
9333                             }
9334
9335                             checkDescr(thisParserPtr, (yyvsp[(5) - (5)].text));
9336                             
9337                             (yyval.listPtr) = smiMalloc(sizeof(List));
9338                             (yyval.listPtr)->nextPtr = NULL;
9339                             (yyval.listPtr)->ptr = smiMalloc(sizeof(Option));
9340                             ((Option *)((yyval.listPtr)->ptr))->line = thisParserPtr->firstNestedStatementLine;
9341                             ((Option *)((yyval.listPtr)->ptr))->objectPtr = (yyvsp[(3) - (5)].objectPtr);
9342                             if (! (thisModulePtr->flags & SMI_FLAG_NODESCR)) {
9343                                 ((Option *)((yyval.listPtr)->ptr))->export.description = (yyvsp[(5) - (5)].text);
9344                             } else {
9345                                 smiFree((yyvsp[(5) - (5)].text));
9346                             }
9347                         ;}
9348     break;
9349
9350   case 385:
9351 #line 6836 "parser-smi.y"
9352     {
9353                             thisParserPtr->firstNestedStatementLine = thisParserPtr->line;
9354                         ;}
9355     break;
9356
9357   case 386:
9358 #line 6844 "parser-smi.y"
9359     {
9360                             Import *importPtr;
9361
9362                             if (thisParserPtr->complianceModulePtr && (yyvsp[(3) - (8)].objectPtr)->export.name) {
9363                                 importPtr = findImportByModulenameAndName(
9364                                                     thisParserPtr->complianceModulePtr->export.name,
9365                                                     (yyvsp[(3) - (8)].objectPtr)->export.name,
9366                                                     thisModulePtr);
9367                                 if (importPtr) 
9368                                     importPtr->use++;
9369                             }
9370
9371                             checkDescr(thisParserPtr, (yyvsp[(8) - (8)].text));
9372                             
9373                             thisParserPtr->flags &= ~FLAG_CREATABLE;
9374                             (yyval.listPtr) = smiMalloc(sizeof(List));
9375                             (yyval.listPtr)->nextPtr = NULL;
9376                             (yyval.listPtr)->ptr = smiMalloc(sizeof(Refinement));
9377                             ((Refinement *)((yyval.listPtr)->ptr))->line =
9378                                 thisParserPtr->firstNestedStatementLine;
9379                             ((Refinement *)((yyval.listPtr)->ptr))->objectPtr = (yyvsp[(3) - (8)].objectPtr);
9380                             ((Refinement *)((yyval.listPtr)->ptr))->typePtr = (yyvsp[(4) - (8)].typePtr);
9381                             if ((yyvsp[(4) - (8)].typePtr)) {
9382                                 (yyvsp[(4) - (8)].typePtr)->parentPtr = (yyvsp[(3) - (8)].objectPtr)->typePtr;
9383                             }
9384                             ((Refinement *)((yyval.listPtr)->ptr))->writetypePtr = (yyvsp[(5) - (8)].typePtr);
9385                             if ((yyvsp[(5) - (8)].typePtr)) {
9386                                 (yyvsp[(5) - (8)].typePtr)->parentPtr = (yyvsp[(3) - (8)].objectPtr)->typePtr;
9387                             }
9388                             ((Refinement *)((yyval.listPtr)->ptr))->export.access = (yyvsp[(6) - (8)].access);
9389                             if (! (thisParserPtr->flags & SMI_FLAG_NODESCR)) {
9390                                 ((Refinement *)((yyval.listPtr)->ptr))->export.description = (yyvsp[(8) - (8)].text);
9391                             } else {
9392                                 smiFree((yyvsp[(8) - (8)].text));
9393                             }
9394                         ;}
9395     break;
9396
9397   case 387:
9398 #line 6883 "parser-smi.y"
9399     {
9400                             if ((yyvsp[(2) - (2)].typePtr)->export.name) {
9401                                 (yyval.typePtr) = duplicateType((yyvsp[(2) - (2)].typePtr), 0, thisParserPtr);
9402                             } else {
9403                                 (yyval.typePtr) = (yyvsp[(2) - (2)].typePtr);
9404                             }
9405                         ;}
9406     break;
9407
9408   case 388:
9409 #line 6891 "parser-smi.y"
9410     {
9411                             (yyval.typePtr) = NULL;
9412                         ;}
9413     break;
9414
9415   case 389:
9416 #line 6897 "parser-smi.y"
9417     {
9418                             /* must not be present in PIBs */
9419                             if (thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI)
9420                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "WRITE-SYNTAX");
9421                             if ((yyvsp[(2) - (2)].typePtr)->export.name) {
9422                                 (yyval.typePtr) = duplicateType((yyvsp[(2) - (2)].typePtr), 0, thisParserPtr);
9423                             } else {
9424                                 (yyval.typePtr) = (yyvsp[(2) - (2)].typePtr);
9425                             }
9426                         ;}
9427     break;
9428
9429   case 390:
9430 #line 6908 "parser-smi.y"
9431     {
9432                             (yyval.typePtr) = NULL;
9433                         ;}
9434     break;
9435
9436   case 391:
9437 #line 6914 "parser-smi.y"
9438     {
9439                             (yyval.typePtr) = (yyvsp[(1) - (1)].typePtr);
9440                         ;}
9441     break;
9442
9443   case 392:
9444 #line 6920 "parser-smi.y"
9445     {
9446                             if (thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI)
9447                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "MIN-ACCESS");
9448                             (yyval.access) = (yyvsp[(2) - (2)].access);
9449                         ;}
9450     break;
9451
9452   case 393:
9453 #line 6926 "parser-smi.y"
9454     {
9455                             if (thisParserPtr->modulePtr->export.language != SMI_LANGUAGE_SPPI)
9456                                 smiPrintError(thisParserPtr, ERR_SPPI_CONSTRUCT_IN_MIB, "PIB-MIN-ACCESS");
9457                             if ((yyvsp[(2) - (2)].access) == SMI_ACCESS_REPORT_ONLY)
9458                                 smiPrintError(thisParserPtr, ERR_REPORT_ONLY_IN_PIB_MIN_ACCESS);
9459                             (yyval.access) = (yyvsp[(2) - (2)].access);
9460                         ;}
9461     break;
9462
9463   case 394:
9464 #line 6934 "parser-smi.y"
9465     {
9466                             (yyval.access) = SMI_ACCESS_UNKNOWN;
9467                         ;}
9468     break;
9469
9470   case 395:
9471 #line 6940 "parser-smi.y"
9472     {
9473                             thisParserPtr->firstStatementLine = thisParserPtr->line;
9474                             thisParserPtr->currentDecl = SMI_DECL_AGENTCAPABILITIES;
9475                             
9476                             checkNameLen(thisParserPtr, (yyvsp[(1) - (1)].id),
9477                                          ERR_OIDNAME_32, ERR_OIDNAME_64);
9478                             smiCheckObjectName(thisParserPtr,
9479                                                thisModulePtr, (yyvsp[(1) - (1)].id));
9480                         ;}
9481     break;
9482
9483   case 396:
9484 #line 6950 "parser-smi.y"
9485     {
9486                             Import *importPtr;
9487                             if (thisParserPtr->modulePtr->export.language == SMI_LANGUAGE_SPPI)
9488                                 smiPrintError(thisParserPtr, ERR_SMI_CONSTRUCT_IN_PIB, "AGENT-CAAPABILITIES");
9489                             
9490                             if (thisModulePtr->export.language == SMI_LANGUAGE_UNKNOWN)
9491                                 thisModulePtr->export.language = SMI_LANGUAGE_SMIV2;
9492
9493                             importPtr = findImportByName("AGENT-CAPABILITIES",
9494                                                          thisModulePtr);
9495                             if (importPtr) {
9496                                 importPtr->use++;
9497                             } else {
9498                                 smiPrintError(thisParserPtr,
9499                                               ERR_MACRO_NOT_IMPORTED,
9500                                               "AGENT-CAPABILITIES",
9501                                               "SNMPv2-CONF");
9502                             }
9503                         ;}
9504     break;
9505
9506   case 397:
9507 #line 6972 "parser-smi.y"
9508     {
9509                             checkDescr(thisParserPtr, (yyvsp[(10) - (10)].text));
9510                         ;}
9511     break;
9512
9513   case 398:
9514 #line 6978 "parser-smi.y"
9515     {
9516                             Object *objectPtr;
9517                             
9518                             objectPtr = (yyvsp[(16) - (17)].objectPtr);
9519                             
9520                             smiCheckObjectReuse(thisParserPtr, (yyvsp[(1) - (17)].id), &objectPtr);
9521
9522                             setObjectName(objectPtr, (yyvsp[(1) - (17)].id), thisParserPtr);
9523                             setObjectDecl(objectPtr,
9524                                           SMI_DECL_AGENTCAPABILITIES);
9525                             setObjectLine(objectPtr, thisParserPtr->firstStatementLine,
9526                                           thisParserPtr);
9527                             addObjectFlags(objectPtr, FLAG_REGISTERED);
9528                             deleteObjectFlags(objectPtr, FLAG_INCOMPLETE);
9529                             setObjectStatus(objectPtr, (yyvsp[(8) - (17)].status));
9530                             setObjectDescription(objectPtr, (yyvsp[(10) - (17)].text), thisParserPtr);
9531                             if ((yyvsp[(12) - (17)].text)) {
9532                                 setObjectReference(objectPtr, (yyvsp[(12) - (17)].text), thisParserPtr);
9533                             }
9534                             setObjectAccess(objectPtr,
9535                                             SMI_ACCESS_NOT_ACCESSIBLE);
9536                                 /*
9537                                  * TODO: PRODUCT_RELEASE Text
9538                                  * TODO: ModulePart_Capabilities
9539                                  */
9540                             (yyval.err) = 0;
9541                         ;}
9542     break;
9543
9544   case 399:
9545 #line 7008 "parser-smi.y"
9546     { (yyval.err) = 0; ;}
9547     break;
9548
9549   case 400:
9550 #line 7010 "parser-smi.y"
9551     { (yyval.err) = 0; ;}
9552     break;
9553
9554   case 401:
9555 #line 7014 "parser-smi.y"
9556     { (yyval.err) = 0; ;}
9557     break;
9558
9559   case 402:
9560 #line 7016 "parser-smi.y"
9561     { (yyval.err) = 0; ;}
9562     break;
9563
9564   case 403:
9565 #line 7020 "parser-smi.y"
9566     {
9567                             /*
9568                              * Remember the module. SMIv2 is broken by
9569                              * design to allow subsequent clauses to
9570                              * refer identifiers that are not
9571                              * imported.  Although, SMIv2 does not
9572                              * require, we will fake it by inserting
9573                              * appropriate imports.
9574                              */
9575                             if ((yyvsp[(2) - (2)].modulePtr) == thisModulePtr)
9576                                 thisParserPtr->capabilitiesModulePtr = NULL;
9577                             else
9578                                 thisParserPtr->capabilitiesModulePtr = (yyvsp[(2) - (2)].modulePtr);
9579                         ;}
9580     break;
9581
9582   case 404:
9583 #line 7036 "parser-smi.y"
9584     {
9585                             if (thisParserPtr->capabilitiesModulePtr) {
9586                                 checkImports(thisParserPtr->capabilitiesModulePtr,
9587                                              thisParserPtr);
9588                                 thisParserPtr->capabilitiesModulePtr = NULL;
9589                             }
9590                             (yyval.err) = 0;
9591                         ;}
9592     break;
9593
9594   case 405:
9595 #line 7047 "parser-smi.y"
9596     {
9597 #if 0
9598                             (yyval.listPtr) = smiMalloc(sizeof(List));
9599                             (yyval.listPtr)->ptr = (yyvsp[(1) - (1)].listPtr);
9600                             (yyval.listPtr)->nextPtr = NULL;
9601 #else
9602                             (yyval.listPtr) = NULL;
9603 #endif
9604                         ;}
9605     break;
9606
9607   case 406:
9608 #line 7057 "parser-smi.y"
9609     {
9610 #if 0
9611                             List *p, *pp;
9612                             
9613                             p = smiMalloc(sizeof(List));
9614                             p->ptr = (yyvsp[(3) - (3)].listPtr);
9615                             p->nextPtr = NULL;
9616                             for (pp = (yyvsp[(1) - (3)].listPtr); pp->nextPtr; pp = pp->nextPtr);
9617                             pp->nextPtr = p;
9618                             (yyval.listPtr) = (yyvsp[(1) - (3)].listPtr);
9619 #else
9620                             (yyval.listPtr) = NULL;
9621 #endif
9622                         ;}
9623     break;
9624
9625   case 407:
9626 #line 7074 "parser-smi.y"
9627     {
9628                             (yyval.listPtr) = NULL;
9629                         ;}
9630     break;
9631
9632   case 408:
9633 #line 7080 "parser-smi.y"
9634     {
9635                             (yyval.modulePtr) = findModuleByName((yyvsp[(1) - (2)].id));
9636                             /* TODO: handle objectIdentifier */
9637                             if (!(yyval.modulePtr)) {
9638                                 (yyval.modulePtr) = loadModule((yyvsp[(1) - (2)].id), thisParserPtr);
9639                             }
9640                             smiFree((yyvsp[(1) - (2)].id));
9641                         ;}
9642     break;
9643
9644   case 409:
9645 #line 7089 "parser-smi.y"
9646     {
9647                             (yyval.modulePtr) = findModuleByName((yyvsp[(1) - (1)].id));
9648                             if (!(yyval.modulePtr)) {
9649                                 (yyval.modulePtr) = loadModule((yyvsp[(1) - (1)].id), thisParserPtr);
9650                             }
9651                             smiFree((yyvsp[(1) - (1)].id));
9652                         ;}
9653     break;
9654
9655   case 410:
9656 #line 7099 "parser-smi.y"
9657     { (yyval.err) = 0; ;}
9658     break;
9659
9660   case 411:
9661 #line 7101 "parser-smi.y"
9662     { (yyval.err) = 0; ;}
9663     break;
9664
9665   case 412:
9666 #line 7105 "parser-smi.y"
9667     { (yyval.err) = 0; ;}
9668     break;
9669
9670   case 413:
9671 #line 7107 "parser-smi.y"
9672     { (yyval.err) = 0; ;}
9673     break;
9674
9675   case 414:
9676 #line 7111 "parser-smi.y"
9677     {
9678                             if ((yyvsp[(2) - (2)].objectPtr)) {
9679                                 variationkind = (yyvsp[(2) - (2)].objectPtr)->export.nodekind;
9680                             } else {
9681                                 variationkind = SMI_NODEKIND_UNKNOWN;
9682                             }
9683                         ;}
9684     break;
9685
9686   case 415:
9687 #line 7119 "parser-smi.y"
9688     {
9689                             if (variationkind == SMI_NODEKIND_NOTIFICATION) {
9690                                 smiPrintError(thisParserPtr,
9691                                       ERR_NOTIFICATION_VARIATION_SYNTAX);
9692                             }
9693                         ;}
9694     break;
9695
9696   case 416:
9697 #line 7126 "parser-smi.y"
9698     {
9699                             if (variationkind == SMI_NODEKIND_NOTIFICATION) {
9700                                 smiPrintError(thisParserPtr,
9701                                       ERR_NOTIFICATION_VARIATION_WRITESYNTAX);
9702                             }
9703                         ;}
9704     break;
9705
9706   case 417:
9707 #line 7134 "parser-smi.y"
9708     {
9709                             if (variationkind == SMI_NODEKIND_NOTIFICATION) {
9710                                 smiPrintError(thisParserPtr,
9711                                       ERR_NOTIFICATION_VARIATION_CREATION);
9712                             }
9713                         ;}
9714     break;
9715
9716   case 418:
9717 #line 7141 "parser-smi.y"
9718     {
9719                             if (variationkind == SMI_NODEKIND_NOTIFICATION) {
9720                                 smiPrintError(thisParserPtr,
9721                                       ERR_NOTIFICATION_VARIATION_DEFVAL);
9722                             } else if ((yyvsp[(11) - (11)].valuePtr)) {
9723                                 adjustDefval(thisParserPtr,
9724                                              (yyvsp[(11) - (11)].valuePtr), (yyvsp[(2) - (11)].objectPtr)->typePtr,
9725                                              thisParserPtr->line);
9726                                 smiCheckValueType(thisParserPtr,
9727                                                   (yyvsp[(11) - (11)].valuePtr), (yyvsp[(2) - (11)].objectPtr)->typePtr,
9728                                                   thisParserPtr->line);
9729                             }
9730                         ;}
9731     break;
9732
9733   case 419:
9734 #line 7155 "parser-smi.y"
9735     {
9736                             thisParserPtr->flags &= ~FLAG_CREATABLE;
9737                             (yyval.err) = 0;
9738                             variationkind = SMI_NODEKIND_UNKNOWN;
9739
9740                             checkDescr(thisParserPtr, (yyvsp[(14) - (14)].text));
9741                         ;}
9742     break;
9743
9744   case 420:
9745 #line 7165 "parser-smi.y"
9746     { (yyval.access) = (yyvsp[(2) - (2)].access); ;}
9747     break;
9748
9749   case 421:
9750 #line 7167 "parser-smi.y"
9751     { (yyval.access) = 0; ;}
9752     break;
9753
9754   case 422:
9755 #line 7171 "parser-smi.y"
9756     {
9757                             if (!strcmp((yyvsp[(1) - (1)].id), "not-implemented")) {
9758                                 (yyval.access) = SMI_ACCESS_NOT_IMPLEMENTED;
9759                             } else if (!strcmp((yyvsp[(1) - (1)].id), "accessible-for-notify")) {
9760                                 if (variationkind ==
9761                                     SMI_NODEKIND_NOTIFICATION) {
9762                                     smiPrintError(thisParserPtr,
9763                                      ERR_INVALID_NOTIFICATION_VARIATION_ACCESS,
9764                                                (yyvsp[(1) - (1)].id));
9765                                     (yyval.access) = SMI_ACCESS_UNKNOWN;
9766                                 } else {
9767                                     (yyval.access) = SMI_ACCESS_NOTIFY;
9768                                 }
9769                             } else if (!strcmp((yyvsp[(1) - (1)].id), "read-only")) {
9770                                 if (variationkind ==
9771                                     SMI_NODEKIND_NOTIFICATION) {
9772                                     smiPrintError(thisParserPtr,
9773                                      ERR_INVALID_NOTIFICATION_VARIATION_ACCESS,
9774                                                (yyvsp[(1) - (1)].id));
9775                                     (yyval.access) = SMI_ACCESS_UNKNOWN;
9776                                 } else {
9777                                     (yyval.access) = SMI_ACCESS_READ_ONLY;
9778                                 }
9779                             } else if (!strcmp((yyvsp[(1) - (1)].id), "read-write")) {
9780                                 if (variationkind ==
9781                                     SMI_NODEKIND_NOTIFICATION) {
9782                                     smiPrintError(thisParserPtr,
9783                                      ERR_INVALID_NOTIFICATION_VARIATION_ACCESS,
9784                                                (yyvsp[(1) - (1)].id));
9785                                     (yyval.access) = SMI_ACCESS_UNKNOWN;
9786                                 } else {
9787                                     (yyval.access) = SMI_ACCESS_READ_WRITE;
9788                                 }
9789                             } else if (!strcmp((yyvsp[(1) - (1)].id), "read-create")) {
9790                                 if (variationkind ==
9791                                     SMI_NODEKIND_NOTIFICATION) {
9792                                     smiPrintError(thisParserPtr,
9793                                      ERR_INVALID_NOTIFICATION_VARIATION_ACCESS,
9794                                                (yyvsp[(1) - (1)].id));
9795                                     (yyval.access) = SMI_ACCESS_UNKNOWN;
9796                                 } else {
9797                                     (yyval.access) = SMI_ACCESS_READ_WRITE;
9798                                 }
9799                             } else if (!strcmp((yyvsp[(1) - (1)].id), "write-only")) {
9800                                 if (variationkind ==
9801                                     SMI_NODEKIND_NOTIFICATION) {
9802                                     smiPrintError(thisParserPtr,
9803                                      ERR_INVALID_NOTIFICATION_VARIATION_ACCESS,
9804                                                (yyvsp[(1) - (1)].id));
9805                                     (yyval.access) = SMI_ACCESS_UNKNOWN;
9806                                 } else {
9807                                     (yyval.access) = SMI_ACCESS_READ_WRITE; /* TODO */
9808                                     smiPrintError(thisParserPtr,
9809                                                ERR_SMIV2_WRITE_ONLY);
9810                                 }
9811                             } else {
9812                                 smiPrintError(thisParserPtr,
9813                                               ERR_INVALID_VARIATION_ACCESS,
9814                                               (yyvsp[(1) - (1)].id));
9815                                 (yyval.access) = SMI_ACCESS_UNKNOWN;
9816                             }
9817                         ;}
9818     break;
9819
9820   case 423:
9821 #line 7236 "parser-smi.y"
9822     { (yyval.err) = 0; ;}
9823     break;
9824
9825   case 424:
9826 #line 7238 "parser-smi.y"
9827     { (yyval.err) = 0; ;}
9828     break;
9829
9830   case 425:
9831 #line 7242 "parser-smi.y"
9832     { (yyval.err) = 0; ;}
9833     break;
9834
9835   case 426:
9836 #line 7244 "parser-smi.y"
9837     { (yyval.err) = 0; ;}
9838     break;
9839
9840   case 427:
9841 #line 7248 "parser-smi.y"
9842     { (yyval.err) = 0; ;}
9843     break;
9844
9845
9846 /* Line 1267 of yacc.c.  */
9847 #line 9848 "parser-smi.c"
9848       default: break;
9849     }
9850   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
9851
9852   YYPOPSTACK (yylen);
9853   yylen = 0;
9854   YY_STACK_PRINT (yyss, yyssp);
9855
9856   *++yyvsp = yyval;
9857
9858
9859   /* Now `shift' the result of the reduction.  Determine what state
9860      that goes to, based on the state we popped back to and the rule
9861      number reduced by.  */
9862
9863   yyn = yyr1[yyn];
9864
9865   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
9866   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
9867     yystate = yytable[yystate];
9868   else
9869     yystate = yydefgoto[yyn - YYNTOKENS];
9870
9871   goto yynewstate;
9872
9873
9874 /*------------------------------------.
9875 | yyerrlab -- here on detecting error |
9876 `------------------------------------*/
9877 yyerrlab:
9878   /* If not already recovering from an error, report this error.  */
9879   if (!yyerrstatus)
9880     {
9881       ++yynerrs;
9882 #if ! YYERROR_VERBOSE
9883       yyerror (YY_("syntax error"));
9884 #else
9885       {
9886         YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
9887         if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
9888           {
9889             YYSIZE_T yyalloc = 2 * yysize;
9890             if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
9891               yyalloc = YYSTACK_ALLOC_MAXIMUM;
9892             if (yymsg != yymsgbuf)
9893               YYSTACK_FREE (yymsg);
9894             yymsg = (char *) YYSTACK_ALLOC (yyalloc);
9895             if (yymsg)
9896               yymsg_alloc = yyalloc;
9897             else
9898               {
9899                 yymsg = yymsgbuf;
9900                 yymsg_alloc = sizeof yymsgbuf;
9901               }
9902           }
9903
9904         if (0 < yysize && yysize <= yymsg_alloc)
9905           {
9906             (void) yysyntax_error (yymsg, yystate, yychar);
9907             yyerror (yymsg);
9908           }
9909         else
9910           {
9911             yyerror (YY_("syntax error"));
9912             if (yysize != 0)
9913               goto yyexhaustedlab;
9914           }
9915       }
9916 #endif
9917     }
9918
9919
9920
9921   if (yyerrstatus == 3)
9922     {
9923       /* If just tried and failed to reuse look-ahead token after an
9924          error, discard it.  */
9925
9926       if (yychar <= YYEOF)
9927         {
9928           /* Return failure if at end of input.  */
9929           if (yychar == YYEOF)
9930             YYABORT;
9931         }
9932       else
9933         {
9934           yydestruct ("Error: discarding",
9935                       yytoken, &yylval);
9936           yychar = YYEMPTY;
9937         }
9938     }
9939
9940   /* Else will try to reuse look-ahead token after shifting the error
9941      token.  */
9942   goto yyerrlab1;
9943
9944
9945 /*---------------------------------------------------.
9946 | yyerrorlab -- error raised explicitly by YYERROR.  |
9947 `---------------------------------------------------*/
9948 yyerrorlab:
9949
9950   /* Pacify compilers like GCC when the user code never invokes
9951      YYERROR and the label yyerrorlab therefore never appears in user
9952      code.  */
9953   if (/*CONSTCOND*/ 0)
9954      goto yyerrorlab;
9955
9956   /* Do not reclaim the symbols of the rule which action triggered
9957      this YYERROR.  */
9958   YYPOPSTACK (yylen);
9959   yylen = 0;
9960   YY_STACK_PRINT (yyss, yyssp);
9961   yystate = *yyssp;
9962   goto yyerrlab1;
9963
9964
9965 /*-------------------------------------------------------------.
9966 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
9967 `-------------------------------------------------------------*/
9968 yyerrlab1:
9969   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
9970
9971   for (;;)
9972     {
9973       yyn = yypact[yystate];
9974       if (yyn != YYPACT_NINF)
9975         {
9976           yyn += YYTERROR;
9977           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
9978             {
9979               yyn = yytable[yyn];
9980               if (0 < yyn)
9981                 break;
9982             }
9983         }
9984
9985       /* Pop the current state because it cannot handle the error token.  */
9986       if (yyssp == yyss)
9987         YYABORT;
9988
9989
9990       yydestruct ("Error: popping",
9991                   yystos[yystate], yyvsp);
9992       YYPOPSTACK (1);
9993       yystate = *yyssp;
9994       YY_STACK_PRINT (yyss, yyssp);
9995     }
9996
9997   if (yyn == YYFINAL)
9998     YYACCEPT;
9999
10000   *++yyvsp = yylval;
10001
10002
10003   /* Shift the error token.  */
10004   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
10005
10006   yystate = yyn;
10007   goto yynewstate;
10008
10009
10010 /*-------------------------------------.
10011 | yyacceptlab -- YYACCEPT comes here.  |
10012 `-------------------------------------*/
10013 yyacceptlab:
10014   yyresult = 0;
10015   goto yyreturn;
10016
10017 /*-----------------------------------.
10018 | yyabortlab -- YYABORT comes here.  |
10019 `-----------------------------------*/
10020 yyabortlab:
10021   yyresult = 1;
10022   goto yyreturn;
10023
10024 #ifndef yyoverflow
10025 /*-------------------------------------------------.
10026 | yyexhaustedlab -- memory exhaustion comes here.  |
10027 `-------------------------------------------------*/
10028 yyexhaustedlab:
10029   yyerror (YY_("memory exhausted"));
10030   yyresult = 2;
10031   /* Fall through.  */
10032 #endif
10033
10034 yyreturn:
10035   if (yychar != YYEOF && yychar != YYEMPTY)
10036      yydestruct ("Cleanup: discarding lookahead",
10037                  yytoken, &yylval);
10038   /* Do not reclaim the symbols of the rule which action triggered
10039      this YYABORT or YYACCEPT.  */
10040   YYPOPSTACK (yylen);
10041   YY_STACK_PRINT (yyss, yyssp);
10042   while (yyssp != yyss)
10043     {
10044       yydestruct ("Cleanup: popping",
10045                   yystos[*yyssp], yyvsp);
10046       YYPOPSTACK (1);
10047     }
10048 #ifndef yyoverflow
10049   if (yyss != yyssa)
10050     YYSTACK_FREE (yyss);
10051 #endif
10052 #if YYERROR_VERBOSE
10053   if (yymsg != yymsgbuf)
10054     YYSTACK_FREE (yymsg);
10055 #endif
10056   /* Make sure YYID is used.  */
10057   return YYID (yyresult);
10058 }
10059
10060
10061 #line 7251 "parser-smi.y"
10062
10063
10064 #endif
10065