r12782: Don't segfault if we cannot setup messaging.
[jelmer/samba4-debian.git] / source / pidl / smb_interfaces.pm
1 ####################################################################
2 #
3 #    This file was generated using Parse::Yapp version 1.05.
4 #
5 #        Don't edit this file, use source file instead.
6 #
7 #             ANY CHANGE MADE HERE WILL BE LOST !
8 #
9 ####################################################################
10 package smb_interfaces;
11 use vars qw ( @ISA );
12 use strict;
13
14 @ISA= qw ( Parse::Yapp::Driver );
15 #Included Parse/Yapp/Driver.pm file----------------------------------------
16 {
17 #
18 # Module Parse::Yapp::Driver
19 #
20 # This module is part of the Parse::Yapp package available on your
21 # nearest CPAN
22 #
23 # Any use of this module in a standalone parser make the included
24 # text under the same copyright as the Parse::Yapp module itself.
25 #
26 # This notice should remain unchanged.
27 #
28 # (c) Copyright 1998-2001 Francois Desarmenien, all rights reserved.
29 # (see the pod text in Parse::Yapp module for use and distribution rights)
30 #
31
32 package Parse::Yapp::Driver;
33
34 require 5.004;
35
36 use strict;
37
38 use vars qw ( $VERSION $COMPATIBLE $FILENAME );
39
40 $VERSION = '1.05';
41 $COMPATIBLE = '0.07';
42 $FILENAME=__FILE__;
43
44 use Carp;
45
46 #Known parameters, all starting with YY (leading YY will be discarded)
47 my(%params)=(YYLEX => 'CODE', 'YYERROR' => 'CODE', YYVERSION => '',
48                          YYRULES => 'ARRAY', YYSTATES => 'ARRAY', YYDEBUG => '');
49 #Mandatory parameters
50 my(@params)=('LEX','RULES','STATES');
51
52 sub new {
53     my($class)=shift;
54         my($errst,$nberr,$token,$value,$check,$dotpos);
55     my($self)={ ERROR => \&_Error,
56                                 ERRST => \$errst,
57                 NBERR => \$nberr,
58                                 TOKEN => \$token,
59                                 VALUE => \$value,
60                                 DOTPOS => \$dotpos,
61                                 STACK => [],
62                                 DEBUG => 0,
63                                 CHECK => \$check };
64
65         _CheckParams( [], \%params, \@_, $self );
66
67                 exists($$self{VERSION})
68         and     $$self{VERSION} < $COMPATIBLE
69         and     croak "Yapp driver version $VERSION ".
70                           "incompatible with version $$self{VERSION}:\n".
71                           "Please recompile parser module.";
72
73         ref($class)
74     and $class=ref($class);
75
76     bless($self,$class);
77 }
78
79 sub YYParse {
80     my($self)=shift;
81     my($retval);
82
83         _CheckParams( \@params, \%params, \@_, $self );
84
85         if($$self{DEBUG}) {
86                 _DBLoad();
87                 $retval = eval '$self->_DBParse()';#Do not create stab entry on compile
88         $@ and die $@;
89         }
90         else {
91                 $retval = $self->_Parse();
92         }
93     $retval
94 }
95
96 sub YYData {
97         my($self)=shift;
98
99                 exists($$self{USER})
100         or      $$self{USER}={};
101
102         $$self{USER};
103         
104 }
105
106 sub YYErrok {
107         my($self)=shift;
108
109         ${$$self{ERRST}}=0;
110     undef;
111 }
112
113 sub YYNberr {
114         my($self)=shift;
115
116         ${$$self{NBERR}};
117 }
118
119 sub YYRecovering {
120         my($self)=shift;
121
122         ${$$self{ERRST}} != 0;
123 }
124
125 sub YYAbort {
126         my($self)=shift;
127
128         ${$$self{CHECK}}='ABORT';
129     undef;
130 }
131
132 sub YYAccept {
133         my($self)=shift;
134
135         ${$$self{CHECK}}='ACCEPT';
136     undef;
137 }
138
139 sub YYError {
140         my($self)=shift;
141
142         ${$$self{CHECK}}='ERROR';
143     undef;
144 }
145
146 sub YYSemval {
147         my($self)=shift;
148         my($index)= $_[0] - ${$$self{DOTPOS}} - 1;
149
150                 $index < 0
151         and     -$index <= @{$$self{STACK}}
152         and     return $$self{STACK}[$index][1];
153
154         undef;  #Invalid index
155 }
156
157 sub YYCurtok {
158         my($self)=shift;
159
160         @_
161     and ${$$self{TOKEN}}=$_[0];
162     ${$$self{TOKEN}};
163 }
164
165 sub YYCurval {
166         my($self)=shift;
167
168         @_
169     and ${$$self{VALUE}}=$_[0];
170     ${$$self{VALUE}};
171 }
172
173 sub YYExpect {
174     my($self)=shift;
175
176     keys %{$self->{STATES}[$self->{STACK}[-1][0]]{ACTIONS}}
177 }
178
179 sub YYLexer {
180     my($self)=shift;
181
182         $$self{LEX};
183 }
184
185
186 #################
187 # Private stuff #
188 #################
189
190
191 sub _CheckParams {
192         my($mandatory,$checklist,$inarray,$outhash)=@_;
193         my($prm,$value);
194         my($prmlst)={};
195
196         while(($prm,$value)=splice(@$inarray,0,2)) {
197         $prm=uc($prm);
198                         exists($$checklist{$prm})
199                 or      croak("Unknow parameter '$prm'");
200                         ref($value) eq $$checklist{$prm}
201                 or      croak("Invalid value for parameter '$prm'");
202         $prm=unpack('@2A*',$prm);
203                 $$outhash{$prm}=$value;
204         }
205         for (@$mandatory) {
206                         exists($$outhash{$_})
207                 or      croak("Missing mandatory parameter '".lc($_)."'");
208         }
209 }
210
211 sub _Error {
212         print "Parse error.\n";
213 }
214
215 sub _DBLoad {
216         {
217                 no strict 'refs';
218
219                         exists(${__PACKAGE__.'::'}{_DBParse})#Already loaded ?
220                 and     return;
221         }
222         my($fname)=__FILE__;
223         my(@drv);
224         open(DRV,"<$fname") or die "Report this as a BUG: Cannot open $fname";
225         while(<DRV>) {
226                         /^\s*sub\s+_Parse\s*{\s*$/ .. /^\s*}\s*#\s*_Parse\s*$/
227                 and     do {
228                         s/^#DBG>//;
229                         push(@drv,$_);
230                 }
231         }
232         close(DRV);
233
234         $drv[0]=~s/_P/_DBP/;
235         eval join('',@drv);
236 }
237
238 #Note that for loading debugging version of the driver,
239 #this file will be parsed from 'sub _Parse' up to '}#_Parse' inclusive.
240 #So, DO NOT remove comment at end of sub !!!
241 sub _Parse {
242     my($self)=shift;
243
244         my($rules,$states,$lex,$error)
245      = @$self{ 'RULES', 'STATES', 'LEX', 'ERROR' };
246         my($errstatus,$nberror,$token,$value,$stack,$check,$dotpos)
247      = @$self{ 'ERRST', 'NBERR', 'TOKEN', 'VALUE', 'STACK', 'CHECK', 'DOTPOS' };
248
249 #DBG>   my($debug)=$$self{DEBUG};
250 #DBG>   my($dbgerror)=0;
251
252 #DBG>   my($ShowCurToken) = sub {
253 #DBG>           my($tok)='>';
254 #DBG>           for (split('',$$token)) {
255 #DBG>                   $tok.=          (ord($_) < 32 or ord($_) > 126)
256 #DBG>                                   ?       sprintf('<%02X>',ord($_))
257 #DBG>                                   :       $_;
258 #DBG>           }
259 #DBG>           $tok.='<';
260 #DBG>   };
261
262         $$errstatus=0;
263         $$nberror=0;
264         ($$token,$$value)=(undef,undef);
265         @$stack=( [ 0, undef ] );
266         $$check='';
267
268     while(1) {
269         my($actions,$act,$stateno);
270
271         $stateno=$$stack[-1][0];
272         $actions=$$states[$stateno];
273
274 #DBG>   print STDERR ('-' x 40),"\n";
275 #DBG>           $debug & 0x2
276 #DBG>   and     print STDERR "In state $stateno:\n";
277 #DBG>           $debug & 0x08
278 #DBG>   and     print STDERR "Stack:[".
279 #DBG>                                    join(',',map { $$_[0] } @$stack).
280 #DBG>                                    "]\n";
281
282
283         if  (exists($$actions{ACTIONS})) {
284
285                                 defined($$token)
286             or  do {
287                                 ($$token,$$value)=&$lex($self);
288 #DBG>                           $debug & 0x01
289 #DBG>                   and     print STDERR "Need token. Got ".&$ShowCurToken."\n";
290                         };
291
292             $act=   exists($$actions{ACTIONS}{$$token})
293                     ?   $$actions{ACTIONS}{$$token}
294                     :   exists($$actions{DEFAULT})
295                         ?   $$actions{DEFAULT}
296                         :   undef;
297         }
298         else {
299             $act=$$actions{DEFAULT};
300 #DBG>                   $debug & 0x01
301 #DBG>           and     print STDERR "Don't need token.\n";
302         }
303
304             defined($act)
305         and do {
306
307                 $act > 0
308             and do {        #shift
309
310 #DBG>                           $debug & 0x04
311 #DBG>                   and     print STDERR "Shift and go to state $act.\n";
312
313                                         $$errstatus
314                                 and     do {
315                                         --$$errstatus;
316
317 #DBG>                                   $debug & 0x10
318 #DBG>                           and     $dbgerror
319 #DBG>                           and     $$errstatus == 0
320 #DBG>                           and     do {
321 #DBG>                                   print STDERR "**End of Error recovery.\n";
322 #DBG>                                   $dbgerror=0;
323 #DBG>                           };
324                                 };
325
326
327                 push(@$stack,[ $act, $$value ]);
328
329                                         $$token ne ''   #Don't eat the eof
330                                 and     $$token=$$value=undef;
331                 next;
332             };
333
334             #reduce
335             my($lhs,$len,$code,@sempar,$semval);
336             ($lhs,$len,$code)=@{$$rules[-$act]};
337
338 #DBG>                   $debug & 0x04
339 #DBG>           and     $act
340 #DBG>           and     print STDERR "Reduce using rule ".-$act." ($lhs,$len): ";
341
342                 $act
343             or  $self->YYAccept();
344
345             $$dotpos=$len;
346
347                 unpack('A1',$lhs) eq '@'    #In line rule
348             and do {
349                     $lhs =~ /^\@[0-9]+\-([0-9]+)$/
350                 or  die "In line rule name '$lhs' ill formed: ".
351                         "report it as a BUG.\n";
352                 $$dotpos = $1;
353             };
354
355             @sempar =       $$dotpos
356                         ?   map { $$_[1] } @$stack[ -$$dotpos .. -1 ]
357                         :   ();
358
359             $semval = $code ? &$code( $self, @sempar )
360                             : @sempar ? $sempar[0] : undef;
361
362             splice(@$stack,-$len,$len);
363
364                 $$check eq 'ACCEPT'
365             and do {
366
367 #DBG>                   $debug & 0x04
368 #DBG>           and     print STDERR "Accept.\n";
369
370                                 return($semval);
371                         };
372
373                 $$check eq 'ABORT'
374             and do {
375
376 #DBG>                   $debug & 0x04
377 #DBG>           and     print STDERR "Abort.\n";
378
379                                 return(undef);
380
381                         };
382
383 #DBG>                   $debug & 0x04
384 #DBG>           and     print STDERR "Back to state $$stack[-1][0], then ";
385
386                 $$check eq 'ERROR'
387             or  do {
388 #DBG>                           $debug & 0x04
389 #DBG>                   and     print STDERR 
390 #DBG>                               "go to state $$states[$$stack[-1][0]]{GOTOS}{$lhs}.\n";
391
392 #DBG>                           $debug & 0x10
393 #DBG>                   and     $dbgerror
394 #DBG>                   and     $$errstatus == 0
395 #DBG>                   and     do {
396 #DBG>                           print STDERR "**End of Error recovery.\n";
397 #DBG>                           $dbgerror=0;
398 #DBG>                   };
399
400                             push(@$stack,
401                      [ $$states[$$stack[-1][0]]{GOTOS}{$lhs}, $semval ]);
402                 $$check='';
403                 next;
404             };
405
406 #DBG>                   $debug & 0x04
407 #DBG>           and     print STDERR "Forced Error recovery.\n";
408
409             $$check='';
410
411         };
412
413         #Error
414             $$errstatus
415         or   do {
416
417             $$errstatus = 1;
418             &$error($self);
419                 $$errstatus # if 0, then YYErrok has been called
420             or  next;       # so continue parsing
421
422 #DBG>                   $debug & 0x10
423 #DBG>           and     do {
424 #DBG>                   print STDERR "**Entering Error recovery.\n";
425 #DBG>                   ++$dbgerror;
426 #DBG>           };
427
428             ++$$nberror;
429
430         };
431
432                         $$errstatus == 3        #The next token is not valid: discard it
433                 and     do {
434                                 $$token eq ''   # End of input: no hope
435                         and     do {
436 #DBG>                           $debug & 0x10
437 #DBG>                   and     print STDERR "**At eof: aborting.\n";
438                                 return(undef);
439                         };
440
441 #DBG>                   $debug & 0x10
442 #DBG>           and     print STDERR "**Dicard invalid token ".&$ShowCurToken.".\n";
443
444                         $$token=$$value=undef;
445                 };
446
447         $$errstatus=3;
448
449                 while(    @$stack
450                           and (         not exists($$states[$$stack[-1][0]]{ACTIONS})
451                                 or  not exists($$states[$$stack[-1][0]]{ACTIONS}{error})
452                                         or      $$states[$$stack[-1][0]]{ACTIONS}{error} <= 0)) {
453
454 #DBG>                   $debug & 0x10
455 #DBG>           and     print STDERR "**Pop state $$stack[-1][0].\n";
456
457                         pop(@$stack);
458                 }
459
460                         @$stack
461                 or      do {
462
463 #DBG>                   $debug & 0x10
464 #DBG>           and     print STDERR "**No state left on stack: aborting.\n";
465
466                         return(undef);
467                 };
468
469                 #shift the error token
470
471 #DBG>                   $debug & 0x10
472 #DBG>           and     print STDERR "**Shift \$error token and go to state ".
473 #DBG>                                            $$states[$$stack[-1][0]]{ACTIONS}{error}.
474 #DBG>                                            ".\n";
475
476                 push(@$stack, [ $$states[$$stack[-1][0]]{ACTIONS}{error}, undef ]);
477
478     }
479
480     #never reached
481         croak("Error in driver logic. Please, report it as a BUG");
482
483 }#_Parse
484 #DO NOT remove comment
485
486 1;
487
488 }
489 #End of include--------------------------------------------------
490
491
492
493
494 sub new {
495         my($class)=shift;
496         ref($class)
497     and $class=ref($class);
498
499     my($self)=$class->SUPER::new( yyversion => '1.05',
500                                   yystates =>
501 [
502         {#State 0
503                 ACTIONS => {
504                         'UNION' => 5,
505                         'ENUM' => 1,
506                         'TYPEDEF' => 7,
507                         'STRUCT' => 2
508                 },
509                 GOTOS => {
510                         'struct' => 6,
511                         'enum' => 9,
512                         'typedef' => 8,
513                         'union' => 10,
514                         'definitions' => 3,
515                         'definition' => 4
516                 }
517         },
518         {#State 1
519                 ACTIONS => {
520                         'IDENTIFIER' => 11
521                 }
522         },
523         {#State 2
524                 ACTIONS => {
525                         'IDENTIFIER' => 12
526                 },
527                 DEFAULT => -33,
528                 GOTOS => {
529                         'optional_identifier' => 13
530                 }
531         },
532         {#State 3
533                 ACTIONS => {
534                         '' => 14,
535                         'UNION' => 5,
536                         'ENUM' => 1,
537                         'TYPEDEF' => 7,
538                         'STRUCT' => 2
539                 },
540                 GOTOS => {
541                         'struct' => 6,
542                         'typedef' => 8,
543                         'enum' => 9,
544                         'union' => 10,
545                         'definition' => 15
546                 }
547         },
548         {#State 4
549                 DEFAULT => -1
550         },
551         {#State 5
552                 ACTIONS => {
553                         'IDENTIFIER' => 12
554                 },
555                 DEFAULT => -33,
556                 GOTOS => {
557                         'optional_identifier' => 16
558                 }
559         },
560         {#State 6
561                 DEFAULT => -3
562         },
563         {#State 7
564                 ACTIONS => {
565                         'STRUCT' => 17
566                 }
567         },
568         {#State 8
569                 DEFAULT => -5
570         },
571         {#State 9
572                 DEFAULT => -6
573         },
574         {#State 10
575                 DEFAULT => -4
576         },
577         {#State 11
578                 ACTIONS => {
579                         "{" => 18
580                 }
581         },
582         {#State 12
583                 DEFAULT => -32
584         },
585         {#State 13
586                 ACTIONS => {
587                         "{" => 19
588                 }
589         },
590         {#State 14
591                 DEFAULT => 0
592         },
593         {#State 15
594                 DEFAULT => -2
595         },
596         {#State 16
597                 ACTIONS => {
598                         "{" => 20
599                 }
600         },
601         {#State 17
602                 ACTIONS => {
603                         "{" => 21
604                 }
605         },
606         {#State 18
607                 ACTIONS => {
608                         'IDENTIFIER' => 22
609                 },
610                 GOTOS => {
611                         'enum_identifiers' => 23,
612                         'enum_identifier' => 24
613                 }
614         },
615         {#State 19
616                 DEFAULT => -15,
617                 GOTOS => {
618                         'elements' => 25
619                 }
620         },
621         {#State 20
622                 DEFAULT => -15,
623                 GOTOS => {
624                         'elements' => 26
625                 }
626         },
627         {#State 21
628                 DEFAULT => -15,
629                 GOTOS => {
630                         'elements' => 27
631                 }
632         },
633         {#State 22
634                 ACTIONS => {
635                         "=" => 28
636                 },
637                 DEFAULT => -13
638         },
639         {#State 23
640                 ACTIONS => {
641                         "}" => 29,
642                         "," => 30
643                 }
644         },
645         {#State 24
646                 DEFAULT => -11
647         },
648         {#State 25
649                 ACTIONS => {
650                         "}" => 31,
651                         'UNION' => 37,
652                         'IDENTIFIER' => 33,
653                         'ENUM' => 32,
654                         'STRUCT' => 35,
655                         'CONST' => 34
656                 },
657                 GOTOS => {
658                         'struct' => 38,
659                         'type' => 39,
660                         'union' => 40,
661                         'element' => 36
662                 }
663         },
664         {#State 26
665                 ACTIONS => {
666                         "}" => 41,
667                         'UNION' => 37,
668                         'IDENTIFIER' => 33,
669                         'ENUM' => 32,
670                         'STRUCT' => 35,
671                         'CONST' => 34
672                 },
673                 GOTOS => {
674                         'struct' => 38,
675                         'type' => 39,
676                         'union' => 40,
677                         'element' => 36
678                 }
679         },
680         {#State 27
681                 ACTIONS => {
682                         "}" => 42,
683                         'UNION' => 37,
684                         'IDENTIFIER' => 33,
685                         'ENUM' => 32,
686                         'STRUCT' => 35,
687                         'CONST' => 34
688                 },
689                 GOTOS => {
690                         'struct' => 38,
691                         'type' => 39,
692                         'union' => 40,
693                         'element' => 36
694                 }
695         },
696         {#State 28
697                 ACTIONS => {
698                         'IDENTIFIER' => 43
699                 }
700         },
701         {#State 29
702                 ACTIONS => {
703                         ";" => 44
704                 }
705         },
706         {#State 30
707                 ACTIONS => {
708                         'IDENTIFIER' => 22
709                 },
710                 GOTOS => {
711                         'enum_identifier' => 45
712                 }
713         },
714         {#State 31
715                 DEFAULT => -28,
716                 GOTOS => {
717                         'pointers' => 46
718                 }
719         },
720         {#State 32
721                 ACTIONS => {
722                         'IDENTIFIER' => 47
723                 }
724         },
725         {#State 33
726                 DEFAULT => -26
727         },
728         {#State 34
729                 ACTIONS => {
730                         'IDENTIFIER' => 33,
731                         'ENUM' => 32
732                 },
733                 GOTOS => {
734                         'type' => 48
735                 }
736         },
737         {#State 35
738                 ACTIONS => {
739                         'IDENTIFIER' => 49
740                 },
741                 DEFAULT => -33,
742                 GOTOS => {
743                         'optional_identifier' => 13
744                 }
745         },
746         {#State 36
747                 DEFAULT => -16
748         },
749         {#State 37
750                 ACTIONS => {
751                         'IDENTIFIER' => 50
752                 },
753                 DEFAULT => -33,
754                 GOTOS => {
755                         'optional_identifier' => 16
756                 }
757         },
758         {#State 38
759                 DEFAULT => -18
760         },
761         {#State 39
762                 DEFAULT => -28,
763                 GOTOS => {
764                         'pointers' => 51
765                 }
766         },
767         {#State 40
768                 DEFAULT => -19
769         },
770         {#State 41
771                 DEFAULT => -28,
772                 GOTOS => {
773                         'pointers' => 52
774                 }
775         },
776         {#State 42
777                 ACTIONS => {
778                         'IDENTIFIER' => 12
779                 },
780                 DEFAULT => -33,
781                 GOTOS => {
782                         'optional_identifier' => 53
783                 }
784         },
785         {#State 43
786                 DEFAULT => -14
787         },
788         {#State 44
789                 DEFAULT => -10
790         },
791         {#State 45
792                 DEFAULT => -12
793         },
794         {#State 46
795                 ACTIONS => {
796                         'IDENTIFIER' => 12,
797                         "*" => 55
798                 },
799                 DEFAULT => -33,
800                 GOTOS => {
801                         'optional_identifier' => 54,
802                         'optional_identifiers' => 56
803                 }
804         },
805         {#State 47
806                 DEFAULT => -27
807         },
808         {#State 48
809                 DEFAULT => -28,
810                 GOTOS => {
811                         'pointers' => 57
812                 }
813         },
814         {#State 49
815                 ACTIONS => {
816                         "{" => -32
817                 },
818                 DEFAULT => -28,
819                 GOTOS => {
820                         'pointers' => 58
821                 }
822         },
823         {#State 50
824                 ACTIONS => {
825                         "{" => -32
826                 },
827                 DEFAULT => -28,
828                 GOTOS => {
829                         'pointers' => 59
830                 }
831         },
832         {#State 51
833                 ACTIONS => {
834                         'IDENTIFIER' => 60,
835                         "*" => 55
836                 }
837         },
838         {#State 52
839                 ACTIONS => {
840                         'IDENTIFIER' => 12,
841                         "*" => 55
842                 },
843                 DEFAULT => -33,
844                 GOTOS => {
845                         'optional_identifier' => 61
846                 }
847         },
848         {#State 53
849                 ACTIONS => {
850                         ";" => 62
851                 }
852         },
853         {#State 54
854                 DEFAULT => -30
855         },
856         {#State 55
857                 DEFAULT => -29
858         },
859         {#State 56
860                 ACTIONS => {
861                         ";" => 63,
862                         "," => 64
863                 }
864         },
865         {#State 57
866                 ACTIONS => {
867                         'IDENTIFIER' => 65,
868                         "*" => 55
869                 }
870         },
871         {#State 58
872                 ACTIONS => {
873                         'IDENTIFIER' => 66,
874                         "*" => 55
875                 }
876         },
877         {#State 59
878                 ACTIONS => {
879                         'IDENTIFIER' => 67,
880                         "*" => 55
881                 }
882         },
883         {#State 60
884                 ACTIONS => {
885                         "[" => 69
886                 },
887                 DEFAULT => -24,
888                 GOTOS => {
889                         'array' => 68
890                 }
891         },
892         {#State 61
893                 ACTIONS => {
894                         ";" => 70
895                 }
896         },
897         {#State 62
898                 DEFAULT => -9
899         },
900         {#State 63
901                 DEFAULT => -7
902         },
903         {#State 64
904                 ACTIONS => {
905                         'IDENTIFIER' => 12
906                 },
907                 DEFAULT => -33,
908                 GOTOS => {
909                         'optional_identifier' => 71
910                 }
911         },
912         {#State 65
913                 ACTIONS => {
914                         "[" => 69
915                 },
916                 DEFAULT => -24,
917                 GOTOS => {
918                         'array' => 72
919                 }
920         },
921         {#State 66
922                 ACTIONS => {
923                         ";" => 73
924                 }
925         },
926         {#State 67
927                 ACTIONS => {
928                         ";" => 74
929                 }
930         },
931         {#State 68
932                 ACTIONS => {
933                         ";" => 75
934                 }
935         },
936         {#State 69
937                 ACTIONS => {
938                         'CONSTANT' => 76
939                 }
940         },
941         {#State 70
942                 DEFAULT => -8
943         },
944         {#State 71
945                 DEFAULT => -31
946         },
947         {#State 72
948                 ACTIONS => {
949                         ";" => 77
950                 }
951         },
952         {#State 73
953                 DEFAULT => -20
954         },
955         {#State 74
956                 DEFAULT => -21
957         },
958         {#State 75
959                 DEFAULT => -23
960         },
961         {#State 76
962                 ACTIONS => {
963                         "]" => 78
964                 }
965         },
966         {#State 77
967                 DEFAULT => -22
968         },
969         {#State 78
970                 DEFAULT => -25
971         }
972 ],
973                                   yyrules  =>
974 [
975         [#Rule 0
976                  '$start', 2, undef
977         ],
978         [#Rule 1
979                  'definitions', 1,
980 sub
981 #line 14 "build/pidl/smb_interfaces.yp"
982 { [$_[1]] }
983         ],
984         [#Rule 2
985                  'definitions', 2,
986 sub
987 #line 15 "build/pidl/smb_interfaces.yp"
988 { push(@{$_[1]}, $_[2]); $_[1] }
989         ],
990         [#Rule 3
991                  'definition', 1, undef
992         ],
993         [#Rule 4
994                  'definition', 1, undef
995         ],
996         [#Rule 5
997                  'definition', 1, undef
998         ],
999         [#Rule 6
1000                  'definition', 1, undef
1001         ],
1002         [#Rule 7
1003                  'struct', 8,
1004 sub
1005 #line 26 "build/pidl/smb_interfaces.yp"
1006 {
1007                 {
1008                         "NAME" => $_[7],
1009                         "STRUCT_NAME" => $_[2],
1010                         "TYPE" => "struct",
1011                         "DATA" => $_[4],
1012                 }
1013         }
1014         ],
1015         [#Rule 8
1016                  'union', 8,
1017 sub
1018 #line 38 "build/pidl/smb_interfaces.yp"
1019 {
1020                 {
1021                         "NAME" => $_[7],
1022                         "UNION_NAME" => $_[2],
1023                         "TYPE" => "union",
1024                         "DATA" => $_[4],
1025                 }
1026         }
1027         ],
1028         [#Rule 9
1029                  'typedef', 7, undef
1030         ],
1031         [#Rule 10
1032                  'enum', 6, undef
1033         ],
1034         [#Rule 11
1035                  'enum_identifiers', 1, undef
1036         ],
1037         [#Rule 12
1038                  'enum_identifiers', 3, undef
1039         ],
1040         [#Rule 13
1041                  'enum_identifier', 1, undef
1042         ],
1043         [#Rule 14
1044                  'enum_identifier', 3, undef
1045         ],
1046         [#Rule 15
1047                  'elements', 0, undef
1048         ],
1049         [#Rule 16
1050                  'elements', 2,
1051 sub
1052 #line 65 "build/pidl/smb_interfaces.yp"
1053 { push(@{$_[1]}, $_[2]); $_[1] }
1054         ],
1055         [#Rule 17
1056                  'element', 0, undef
1057         ],
1058         [#Rule 18
1059                  'element', 1, undef
1060         ],
1061         [#Rule 19
1062                  'element', 1, undef
1063         ],
1064         [#Rule 20
1065                  'element', 5,
1066 sub
1067 #line 72 "build/pidl/smb_interfaces.yp"
1068 {{
1069                         "NAME" => [$_[2]],
1070                         "POINTERS" => $_[3],
1071                         "TYPE" => "struct $_[2]",
1072                 }}
1073         ],
1074         [#Rule 21
1075                  'element', 5,
1076 sub
1077 #line 78 "build/pidl/smb_interfaces.yp"
1078 {{
1079                         "NAME" => $_[2],
1080                         "POINTERS" => $_[3],
1081                         "TYPE" => "union $_[2]",
1082                 }}
1083         ],
1084         [#Rule 22
1085                  'element', 6,
1086 sub
1087 #line 84 "build/pidl/smb_interfaces.yp"
1088 {{
1089                            "NAME" => [$_[4]],
1090                            "TYPE" => $_[2],
1091                            "POINTERS" => $_[3],
1092                 }}
1093         ],
1094         [#Rule 23
1095                  'element', 5,
1096 sub
1097 #line 90 "build/pidl/smb_interfaces.yp"
1098 {{
1099                            "NAME" => [$_[3]],
1100                            "TYPE" => $_[1],
1101                            "POINTERS" => $_[2],
1102                            "ARRAY_LENGTH" => $_[4]
1103                 }}
1104         ],
1105         [#Rule 24
1106                  'array', 0, undef
1107         ],
1108         [#Rule 25
1109                  'array', 3,
1110 sub
1111 #line 99 "build/pidl/smb_interfaces.yp"
1112 { int($_[2]) }
1113         ],
1114         [#Rule 26
1115                  'type', 1, undef
1116         ],
1117         [#Rule 27
1118                  'type', 2,
1119 sub
1120 #line 104 "build/pidl/smb_interfaces.yp"
1121 { "enum $_[2]" }
1122         ],
1123         [#Rule 28
1124                  'pointers', 0, undef
1125         ],
1126         [#Rule 29
1127                  'pointers', 2,
1128 sub
1129 #line 109 "build/pidl/smb_interfaces.yp"
1130 { $_[1]+1 }
1131         ],
1132         [#Rule 30
1133                  'optional_identifiers', 1,
1134 sub
1135 #line 112 "build/pidl/smb_interfaces.yp"
1136 { [$_[1]] }
1137         ],
1138         [#Rule 31
1139                  'optional_identifiers', 3,
1140 sub
1141 #line 113 "build/pidl/smb_interfaces.yp"
1142 { push(@{$_[1]}, $_[3]); $_[1] }
1143         ],
1144         [#Rule 32
1145                  'optional_identifier', 1, undef
1146         ],
1147         [#Rule 33
1148                  'optional_identifier', 0, undef
1149         ]
1150 ],
1151                                   @_);
1152     bless($self,$class);
1153 }
1154
1155 #line 119 "build/pidl/smb_interfaces.yp"
1156
1157
1158 #####################################################################
1159 # traverse a perl data structure removing any empty arrays or
1160 # hashes and any hash elements that map to undef
1161 sub CleanData($)
1162 {
1163     sub CleanData($);
1164     my($v) = shift;
1165     if (ref($v) eq "ARRAY") {
1166         foreach my $i (0 .. $#{$v}) {
1167             CleanData($v->[$i]);
1168             if (ref($v->[$i]) eq "ARRAY" && $#{$v->[$i]}==-1) { 
1169                     $v->[$i] = undef; 
1170                     next; 
1171             }
1172         }
1173         # this removes any undefined elements from the array
1174         @{$v} = grep { defined $_ } @{$v};
1175     } elsif (ref($v) eq "HASH") {
1176         foreach my $x (keys %{$v}) {
1177             CleanData($v->{$x});
1178             if (!defined $v->{$x}) { delete($v->{$x}); next; }
1179             if (ref($v->{$x}) eq "ARRAY" && $#{$v->{$x}}==-1) { delete($v->{$x}); next; }
1180         }
1181     }
1182         return $v;
1183 }
1184
1185 sub _Error {
1186     if (exists $_[0]->YYData->{ERRMSG}) {
1187                 print $_[0]->YYData->{ERRMSG};
1188                 delete $_[0]->YYData->{ERRMSG};
1189                 return;
1190         };
1191         my $line = $_[0]->YYData->{LINE};
1192         my $last_token = $_[0]->YYData->{LAST_TOKEN};
1193         my $file = $_[0]->YYData->{INPUT_FILENAME};
1194         
1195         print "$file:$line: Syntax error near '$last_token'\n";
1196 }
1197
1198 sub _Lexer($)
1199 {
1200         my($parser)=shift;
1201
1202     $parser->YYData->{INPUT} or return('',undef);
1203
1204 again:
1205         $parser->YYData->{INPUT} =~ s/^[ \t]*//;
1206
1207         for ($parser->YYData->{INPUT}) {
1208                 if (/^\#/) {
1209                         if (s/^\# (\d+) \"(.*?)\"( \d+|)//) {
1210                                 $parser->YYData->{LINE} = $1-1;
1211                                 $parser->YYData->{INPUT_FILENAME} = $2;
1212                                 goto again;
1213                         }
1214                         if (s/^\#line (\d+) \"(.*?)\"( \d+|)//) {
1215                                 $parser->YYData->{LINE} = $1-1;
1216                                 $parser->YYData->{INPUT_FILENAME} = $2;
1217                                 goto again;
1218                         }
1219                         if (s/^(\#.*)$//m) {
1220                                 goto again;
1221                         }
1222                 }
1223                 if (s/^(\n)//) {
1224                         $parser->YYData->{LINE}++;
1225                         goto again;
1226                 }
1227                 if (s/^\"(.*?)\"//) {
1228                         $parser->YYData->{LAST_TOKEN} = $1;
1229                         return('TEXT',$1); 
1230                 }
1231                 if (s/^(\d+)(\W|$)/$2/) {
1232                         $parser->YYData->{LAST_TOKEN} = $1;
1233                         return('CONSTANT',$1); 
1234                 }
1235                 if (s/^([\w_]+)//) {
1236                         $parser->YYData->{LAST_TOKEN} = $1;
1237                         if ($1 =~ 
1238                             /^(const|typedef|union|struct|enum)$/x) {
1239                                 return uc($1);
1240                         }
1241                         return('IDENTIFIER',$1);
1242                 }
1243                 if (s/^(.)//s) {
1244                         $parser->YYData->{LAST_TOKEN} = $1;
1245                         return($1,$1);
1246                 }
1247         }
1248 }
1249
1250 sub parse($$)
1251 {
1252         my ($self,$filename) = @_;
1253
1254         my $saved_delim = $/;
1255         undef $/;
1256         my $cpp = $ENV{CPP};
1257         if (! defined $cpp) {
1258                 $cpp = "cpp"
1259         }
1260         my $data = `$cpp -D__PIDL__ -xc $filename`;
1261         $/ = $saved_delim;
1262
1263     $self->YYData->{INPUT} = $data;
1264     $self->YYData->{LINE} = 0;
1265     $self->YYData->{LAST_TOKEN} = "NONE";
1266
1267         my $idl = $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error );
1268
1269         return CleanData($idl);
1270 }
1271
1272 1;