~ubuntu-branches/ubuntu/quantal/mesa/quantal

« back to all changes in this revision

Viewing changes to src/mesa/shader/grammar/grammar.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-02-21 12:44:07 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20070221124407-rgcacs32mycrtadl
ImportĀ upstreamĀ versionĀ 6.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Mesa 3-D graphics library
3
 
 * Version:  6.2
 
3
 * Version:  6.6
4
4
 *
5
 
 * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
 
5
 * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
6
6
 *
7
7
 * Permission is hereby granted, free of charge, to any person obtaining a
8
8
 * copy of this software and associated documentation files (the "Software"),
368
368
    return grammar_string_compare_n (str1, str2, n) == 0;
369
369
}
370
370
 
371
 
static unsigned int str_length (const byte *str)
 
371
static int
 
372
str_length (const byte *str)
372
373
{
373
 
    return grammar_string_length (str);
 
374
   return (int) (grammar_string_length (str));
374
375
}
375
376
 
376
377
/*
655
656
}
656
657
 
657
658
struct dict_;
658
 
static byte *error_get_token (error *, struct dict_ *, const byte *, unsigned int);
 
659
 
 
660
static byte *
 
661
error_get_token (error *, struct dict_ *, const byte *, int);
659
662
 
660
663
/*
661
664
    condition operand type typedef
1616
1619
    /* try to extract "token" from "...$token$..." */
1617
1620
    {
1618
1621
        byte *processed = NULL;
1619
 
        unsigned int len = 0, i = 0;
 
1622
        unsigned int len = 0;
 
1623
      int i = 0;
1620
1624
 
1621
1625
        if (string_grow (&processed, &len, '\0'))
1622
1626
        {
2274
2278
} match_result;
2275
2279
 
2276
2280
/*
2277
 
    This function does the main job. It parses the text and generates output data.
2278
 
*/
2279
 
static match_result match (dict *di, const byte *text, unsigned int *index, rule *ru, barray **ba,
2280
 
    int filtering_string, regbyte_ctx **rbc)
 
2281
 * This function does the main job. It parses the text and generates output data.
 
2282
 */
 
2283
static match_result
 
2284
match (dict *di, const byte *text, int *index, rule *ru, barray **ba, int filtering_string,
 
2285
       regbyte_ctx **rbc)
2281
2286
{
2282
 
    unsigned int ind = *index;
 
2287
   int ind = *index;
2283
2288
    match_result status = mr_not_matched;
2284
2289
    spec *sp = ru->m_specs;
2285
2290
    regbyte_ctx *ctx = *rbc;
2287
2292
    /* for every specifier in the rule */
2288
2293
    while (sp)
2289
2294
    {
2290
 
        unsigned int i, len, save_ind = ind;
 
2295
      int i, len, save_ind = ind;
2291
2296
        barray *array = NULL;
2292
2297
 
2293
2298
        if (satisfies_condition (sp->m_cond, ctx))
2318
2323
                if (!filtering_string && di->m_string)
2319
2324
                {
2320
2325
                    barray *ba;
2321
 
                    unsigned int filter_index = 0;
 
2326
               int filter_index = 0;
2322
2327
                    match_result result;
2323
2328
                    regbyte_ctx *null_ctx = NULL;
2324
2329
 
2510
2515
    return mr_not_matched;
2511
2516
}
2512
2517
 
2513
 
static match_result fast_match (dict *di, const byte *text, unsigned int *index, rule *ru, int *_PP, bytepool *_BP,
2514
 
    int filtering_string, regbyte_ctx **rbc)
 
2518
static match_result
 
2519
fast_match (dict *di, const byte *text, int *index, rule *ru, int *_PP, bytepool *_BP,
 
2520
            int filtering_string, regbyte_ctx **rbc)
2515
2521
{
2516
 
    unsigned int ind = *index;
 
2522
   int ind = *index;
2517
2523
    int _P = filtering_string ? 0 : *_PP;
2518
2524
    int _P2;
2519
2525
    match_result status = mr_not_matched;
2523
2529
    /* for every specifier in the rule */
2524
2530
    while (sp)
2525
2531
    {
2526
 
        unsigned int i, len, save_ind = ind;
 
2532
      int i, len, save_ind = ind;
2527
2533
 
2528
2534
        _P2 = _P + (sp->m_emits ? emit_size (sp->m_emits) : 0);
2529
2535
        if (bytepool_reserve (_BP, _P2))
2551
2557
                /* prefilter the stream */
2552
2558
                if (!filtering_string && di->m_string)
2553
2559
                {
2554
 
                    unsigned int filter_index = 0;
 
2560
               int filter_index = 0;
2555
2561
                    match_result result;
2556
2562
                    regbyte_ctx *null_ctx = NULL;
2557
2563
 
2722
2728
    return mr_not_matched;
2723
2729
}
2724
2730
 
2725
 
static byte *error_get_token (error *er, dict *di, const byte *text, unsigned int ind)
 
2731
static byte *
 
2732
error_get_token (error *er, dict *di, const byte *text, int ind)
2726
2733
{
2727
2734
    byte *str = NULL;
2728
2735
 
2729
2736
    if (er->m_token)
2730
2737
    {
2731
2738
        barray *ba;
2732
 
        unsigned int filter_index = 0;
 
2739
      int filter_index = 0;
2733
2740
        regbyte_ctx *ctx = NULL;
2734
2741
 
2735
2742
        barray_create (&ba);
2990
2997
    unsigned int estimate_prod_size, int use_fast_path)
2991
2998
{
2992
2999
    dict *di = NULL;
2993
 
    unsigned int index = 0;
 
3000
   int index = 0;
2994
3001
 
2995
3002
    clear_last_error ();
2996
3003