~bkerensa/ubuntu/raring/valgrind/merge-from-deb

« back to all changes in this revision

Viewing changes to coregrind/m_seqmatch.c

  • Committer: Benjamin Kerensa
  • Date: 2012-11-21 23:57:58 UTC
  • mfrom: (1.1.16)
  • Revision ID: bkerensa@ubuntu.com-20121121235758-bd1rv5uc5vzov2p6
Merge from debian unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
   This file is part of Valgrind, a dynamic binary instrumentation
9
9
   framework.
10
10
 
11
 
   Copyright (C) 2008-2011 OpenWorks Ltd
 
11
   Copyright (C) 2008-2012 OpenWorks Ltd
12
12
      info@open-works.co.uk
13
13
 
14
14
   This program is free software; you can redistribute it and/or
45
45
        void* input, SizeT szbInput, UWord nInput, UWord ixInput,
46
46
        Bool (*pIsStar)(void*),
47
47
        Bool (*pIsQuery)(void*),
48
 
        Bool (*pattEQinp)(void*,void*)
 
48
        Bool (*pattEQinp)(void*,void*,void*,UWord),
 
49
        void* inputCompleter
49
50
     )
50
51
{
51
52
   /* This is the spec, written in my favourite formal specification
102
103
         if (VG_(generic_match)( matchAll,
103
104
                                 patt, szbPatt, nPatt,  ixPatt+1,
104
105
                                 input,szbInput,nInput, ixInput+0,
105
 
                                 pIsStar,pIsQuery,pattEQinp) ) {
 
106
                                 pIsStar,pIsQuery,pattEQinp,
 
107
                                 inputCompleter) ) {
106
108
            return True;
107
109
         }
108
110
         // but we can tail-recurse for the second call
129
131
   //
130
132
   // ma (p:ps)   (i:is) = p == i && ma ps is
131
133
   if (havePatt && haveInput) {
132
 
      if (!pattEQinp(currPatt,currInput)) return False;
 
134
      if (!pattEQinp(currPatt,currInput,inputCompleter,ixInput)) return False;
133
135
      ixPatt++; ixInput++; goto tailcall;
134
136
   }
135
137
 
163
165
*/
164
166
static Bool charIsStar  ( void* pV ) { return *(Char*)pV == '*'; }
165
167
static Bool charIsQuery ( void* pV ) { return *(Char*)pV == '?'; }
166
 
static Bool char_p_EQ_i ( void* pV, void* cV ) {
 
168
static Bool char_p_EQ_i ( void* pV, void* cV,
 
169
                          void* null_completer, UWord ixcV ) {
167
170
   Char p = *(Char*)pV;
168
171
   Char c = *(Char*)cV;
169
172
   vg_assert(p != '*' && p != '?');
175
178
             True/* match-all */,
176
179
             (void*)patt,  sizeof(UChar), VG_(strlen)(patt), 0,
177
180
             (void*)input, sizeof(UChar), VG_(strlen)(input), 0,
178
 
             charIsStar, charIsQuery, char_p_EQ_i
 
181
             charIsStar, charIsQuery, char_p_EQ_i,
 
182
             NULL
179
183
          );
180
184
}
181
185