~ubuntu-branches/ubuntu/raring/forked-daapd/raring-proposed

« back to all changes in this revision

Viewing changes to src/pregen/DAAP2SQL.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien BLACHE
  • Date: 2011-04-09 11:41:55 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20110409114155-5i6vbc4v0eqtvcsg
Tags: 0.15-1
* New upstream release.

* debian/control:
  + Add build-dependency on gperf.
  + Bump Standards-Version to 3.9.2 (no changes).
* debian/copyright:
  + Update list of copyright holders.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *  This C source file was generated by $ANTLR version 3.2 debian-5
3
3
 *
4
4
 *     -  From the grammar source file : DAAP2SQL.g
5
 
 *     -                            On : 2011-03-25 18:48:35
 
5
 *     -                            On : 2011-04-09 11:33:35
6
6
 *     -           for the tree parser : DAAP2SQLTreeParser *
7
7
 * Editing it, at least manually, is not wise. 
8
8
 *
46
46
 
47
47
        #include <stdio.h>
48
48
        #include <stdlib.h>
 
49
        #include <string.h>
49
50
        #include <limits.h>
50
51
        #include <errno.h>
51
52
 
341
342
        return DAAP2SQLTokenNames; 
342
343
}
343
344
 
 
345
 
 
346
        struct dmap_query_field_map {
 
347
          char *dmap_field;
 
348
          char *db_col;
 
349
          int as_int;
 
350
        };
 
351
 
 
352
        /* gperf static hash, daap_query.gperf */
 
353
        #include "daap_query_hash.c"
 
354
 
344
355
    
345
356
/* Declare the bitsets
346
357
 */
347
358
 
348
 
/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_query59  */
349
 
static  ANTLR3_BITWORD FOLLOW_expr_in_query59_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000000002) };
350
 
static  ANTLR3_BITSET_LIST FOLLOW_expr_in_query59       = { FOLLOW_expr_in_query59_bits, 1      };
351
 
/** Bitset defining follow set for error recovery in rule state: FOLLOW_OPAND_in_expr84  */
352
 
static  ANTLR3_BITWORD FOLLOW_OPAND_in_expr84_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000000004) };
353
 
static  ANTLR3_BITSET_LIST FOLLOW_OPAND_in_expr84       = { FOLLOW_OPAND_in_expr84_bits, 1      };
354
 
/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr90  */
355
 
static  ANTLR3_BITWORD FOLLOW_expr_in_expr90_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000000260) };
356
 
static  ANTLR3_BITSET_LIST FOLLOW_expr_in_expr90        = { FOLLOW_expr_in_expr90_bits, 1       };
 
359
/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_query65  */
 
360
static  ANTLR3_BITWORD FOLLOW_expr_in_query65_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000000002) };
 
361
static  ANTLR3_BITSET_LIST FOLLOW_expr_in_query65       = { FOLLOW_expr_in_query65_bits, 1      };
 
362
/** Bitset defining follow set for error recovery in rule state: FOLLOW_OPAND_in_expr90  */
 
363
static  ANTLR3_BITWORD FOLLOW_OPAND_in_expr90_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000000004) };
 
364
static  ANTLR3_BITSET_LIST FOLLOW_OPAND_in_expr90       = { FOLLOW_OPAND_in_expr90_bits, 1      };
357
365
/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr96  */
358
 
static  ANTLR3_BITWORD FOLLOW_expr_in_expr96_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000000008) };
 
366
static  ANTLR3_BITWORD FOLLOW_expr_in_expr96_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000000260) };
359
367
static  ANTLR3_BITSET_LIST FOLLOW_expr_in_expr96        = { FOLLOW_expr_in_expr96_bits, 1       };
360
 
/** Bitset defining follow set for error recovery in rule state: FOLLOW_OPOR_in_expr107  */
361
 
static  ANTLR3_BITWORD FOLLOW_OPOR_in_expr107_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000000004) };
362
 
static  ANTLR3_BITSET_LIST FOLLOW_OPOR_in_expr107       = { FOLLOW_OPOR_in_expr107_bits, 1      };
363
 
/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr113  */
364
 
static  ANTLR3_BITWORD FOLLOW_expr_in_expr113_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000000260) };
365
 
static  ANTLR3_BITSET_LIST FOLLOW_expr_in_expr113       = { FOLLOW_expr_in_expr113_bits, 1      };
 
368
/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr102  */
 
369
static  ANTLR3_BITWORD FOLLOW_expr_in_expr102_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000000008) };
 
370
static  ANTLR3_BITSET_LIST FOLLOW_expr_in_expr102       = { FOLLOW_expr_in_expr102_bits, 1      };
 
371
/** Bitset defining follow set for error recovery in rule state: FOLLOW_OPOR_in_expr113  */
 
372
static  ANTLR3_BITWORD FOLLOW_OPOR_in_expr113_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000000004) };
 
373
static  ANTLR3_BITSET_LIST FOLLOW_OPOR_in_expr113       = { FOLLOW_OPOR_in_expr113_bits, 1      };
366
374
/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr119  */
367
 
static  ANTLR3_BITWORD FOLLOW_expr_in_expr119_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000000008) };
 
375
static  ANTLR3_BITWORD FOLLOW_expr_in_expr119_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000000260) };
368
376
static  ANTLR3_BITSET_LIST FOLLOW_expr_in_expr119       = { FOLLOW_expr_in_expr119_bits, 1      };
369
 
/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_expr129  */
370
 
static  ANTLR3_BITWORD FOLLOW_STR_in_expr129_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000000002) };
371
 
static  ANTLR3_BITSET_LIST FOLLOW_STR_in_expr129        = { FOLLOW_STR_in_expr129_bits, 1       };
 
377
/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr125  */
 
378
static  ANTLR3_BITWORD FOLLOW_expr_in_expr125_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000000008) };
 
379
static  ANTLR3_BITSET_LIST FOLLOW_expr_in_expr125       = { FOLLOW_expr_in_expr125_bits, 1      };
 
380
/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_expr135  */
 
381
static  ANTLR3_BITWORD FOLLOW_STR_in_expr135_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000000002) };
 
382
static  ANTLR3_BITSET_LIST FOLLOW_STR_in_expr135        = { FOLLOW_STR_in_expr135_bits, 1       };
372
383
     
373
384
 
374
385
 
378
389
 */
379
390
/** 
380
391
 * $ANTLR start query
381
 
 * DAAP2SQL.g:38:1: query returns [ pANTLR3_STRING result ] : e= expr ;
 
392
 * DAAP2SQL.g:50:1: query returns [ pANTLR3_STRING result ] : e= expr ;
382
393
 */
383
394
static pANTLR3_STRING
384
395
query(pDAAP2SQL ctx)
394
405
 
395
406
 
396
407
    {
397
 
        // DAAP2SQL.g:39:2: (e= expr )
398
 
        // DAAP2SQL.g:39:4: e= expr
 
408
        // DAAP2SQL.g:51:2: (e= expr )
 
409
        // DAAP2SQL.g:51:4: e= expr
399
410
        {
400
 
            FOLLOWPUSH(FOLLOW_expr_in_query59);
 
411
            FOLLOWPUSH(FOLLOW_expr_in_query65);
401
412
            e=expr(ctx);
402
413
 
403
414
            FOLLOWPOP();
445
456
 
446
457
/** 
447
458
 * $ANTLR start expr
448
 
 * DAAP2SQL.g:55:1: expr returns [ pANTLR3_STRING result, int valid ] : ( ^( OPAND a= expr b= expr ) | ^( OPOR a= expr b= expr ) | STR );
 
459
 * DAAP2SQL.g:67:1: expr returns [ pANTLR3_STRING result, int valid ] : ( ^( OPAND a= expr b= expr ) | ^( OPOR a= expr b= expr ) | STR );
449
460
 */
450
461
static DAAP2SQL_expr_return
451
462
expr(pDAAP2SQL ctx)
471
482
 
472
483
    {
473
484
        {
474
 
            //  DAAP2SQL.g:57:2: ( ^( OPAND a= expr b= expr ) | ^( OPOR a= expr b= expr ) | STR )
 
485
            //  DAAP2SQL.g:69:2: ( ^( OPAND a= expr b= expr ) | ^( OPOR a= expr b= expr ) | STR )
475
486
            
476
487
            ANTLR3_UINT32 alt1;
477
488
 
509
520
            switch (alt1) 
510
521
            {
511
522
                case 1:
512
 
                    // DAAP2SQL.g:57:4: ^( OPAND a= expr b= expr )
 
523
                    // DAAP2SQL.g:69:4: ^( OPAND a= expr b= expr )
513
524
                    {
514
 
                         MATCHT(OPAND, &FOLLOW_OPAND_in_expr84); 
 
525
                         MATCHT(OPAND, &FOLLOW_OPAND_in_expr90); 
515
526
                        if  (HASEXCEPTION())
516
527
                        {
517
528
                            goto ruleexprEx;
524
535
                            goto ruleexprEx;
525
536
                        }
526
537
 
527
 
                        FOLLOWPUSH(FOLLOW_expr_in_expr90);
528
 
                        a=expr(ctx);
529
 
 
530
 
                        FOLLOWPOP();
531
 
                        if  (HASEXCEPTION())
532
 
                        {
533
 
                            goto ruleexprEx;
534
 
                        }
535
 
 
536
538
                        FOLLOWPUSH(FOLLOW_expr_in_expr96);
 
539
                        a=expr(ctx);
 
540
 
 
541
                        FOLLOWPOP();
 
542
                        if  (HASEXCEPTION())
 
543
                        {
 
544
                            goto ruleexprEx;
 
545
                        }
 
546
 
 
547
                        FOLLOWPUSH(FOLLOW_expr_in_expr102);
537
548
                        b=expr(ctx);
538
549
 
539
550
                        FOLLOWPOP();
570
581
                    }
571
582
                    break;
572
583
                case 2:
573
 
                    // DAAP2SQL.g:73:4: ^( OPOR a= expr b= expr )
 
584
                    // DAAP2SQL.g:85:4: ^( OPOR a= expr b= expr )
574
585
                    {
575
 
                         MATCHT(OPOR, &FOLLOW_OPOR_in_expr107); 
 
586
                         MATCHT(OPOR, &FOLLOW_OPOR_in_expr113); 
576
587
                        if  (HASEXCEPTION())
577
588
                        {
578
589
                            goto ruleexprEx;
585
596
                            goto ruleexprEx;
586
597
                        }
587
598
 
588
 
                        FOLLOWPUSH(FOLLOW_expr_in_expr113);
589
 
                        a=expr(ctx);
590
 
 
591
 
                        FOLLOWPOP();
592
 
                        if  (HASEXCEPTION())
593
 
                        {
594
 
                            goto ruleexprEx;
595
 
                        }
596
 
 
597
599
                        FOLLOWPUSH(FOLLOW_expr_in_expr119);
 
600
                        a=expr(ctx);
 
601
 
 
602
                        FOLLOWPOP();
 
603
                        if  (HASEXCEPTION())
 
604
                        {
 
605
                            goto ruleexprEx;
 
606
                        }
 
607
 
 
608
                        FOLLOWPUSH(FOLLOW_expr_in_expr125);
598
609
                        b=expr(ctx);
599
610
 
600
611
                        FOLLOWPOP();
631
642
                    }
632
643
                    break;
633
644
                case 3:
634
 
                    // DAAP2SQL.g:89:4: STR
 
645
                    // DAAP2SQL.g:101:4: STR
635
646
                    {
636
 
                        STR1 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expr129); 
 
647
                        STR1 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expr135); 
637
648
                        if  (HASEXCEPTION())
638
649
                        {
639
650
                            goto ruleexprEx;
647
658
                                                pANTLR3_UINT8 escaped;
648
659
                                                ANTLR3_UINT8 op;
649
660
                                                int neg_op;
650
 
                                                struct dmap_query_field_map *dqfm;
 
661
                                                const struct dmap_query_field_map *dqfm;
651
662
                                                char *end;
652
663
                                                long long llval;
653
664
 
715
726
                                                        neg_op = 0;
716
727
 
717
728
                                                /* Lookup DMAP field in the query field map */
718
 
                                                dqfm = daap_query_field_lookup((char *)field);
 
729
                                                dqfm = daap_query_field_lookup((char *)field, strlen((char *)field));
719
730
                                                if (!dqfm)
720
731
                                                {
721
732
                                                        DPRINTF(E_LOG, L_DAAP, "DMAP field '%s' is not a valid field in queries\n", field);