/[cvs]/ccvs/lib/regex_internal.h
ViewVC logotype

Diff of /ccvs/lib/regex_internal.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by dprice, Fri Aug 12 20:58:10 2005 UTC revision 1.2 by dprice, Sun Sep 4 05:58:56 2005 UTC
# Line 22  Line 22 
22    
23  #include <assert.h>  #include <assert.h>
24  #include <ctype.h>  #include <ctype.h>
25    #include <stdbool.h>
26  #include <stdio.h>  #include <stdio.h>
27  #include <stdlib.h>  #include <stdlib.h>
28  #include <string.h>  #include <string.h>
# Line 90  Line 91 
91  # define inline  # define inline
92  #endif  #endif
93    
 /* Number of bits in a byte.  */  
 #define BYTE_BITS 8  
94  /* Number of single byte character.  */  /* Number of single byte character.  */
95  #define SBC_MAX 256  #define SBC_MAX 256
96    
# Line 123  Line 122 
122  extern const char __re_error_msgid[] attribute_hidden;  extern const char __re_error_msgid[] attribute_hidden;
123  extern const size_t __re_error_msgid_idx[] attribute_hidden;  extern const size_t __re_error_msgid_idx[] attribute_hidden;
124    
125    typedef __re_idx_t Idx;
126    
127    /* Special return value for failure to match.  */
128    #define REG_MISSING ((Idx) -1)
129    
130    /* Special return value for internal error.  */
131    #define REG_ERROR ((Idx) -2)
132    
133    /* Test whether N is a valid index, and is not one of the above.  */
134    #ifdef _REGEX_LARGE_OFFSETS
135    # define REG_VALID_INDEX(n) ((Idx) (n) < REG_ERROR)
136    #else
137    # define REG_VALID_INDEX(n) (0 <= (n))
138    #endif
139    
140    /* Test whether N is a valid nonzero index.  */
141    #ifdef _REGEX_LARGE_OFFSETS
142    # define REG_VALID_NONZERO_INDEX(n) ((Idx) ((n) - 1) < (Idx) (REG_ERROR - 1))
143    #else
144    # define REG_VALID_NONZERO_INDEX(n) (0 < (n))
145    #endif
146    
147    /* A hash value, suitable for computing hash tables.  */
148    typedef __re_size_t re_hashval_t;
149    
150  /* Number of bits in an unsinged int.  */  /* Number of bits in an unsinged int.  */
151  #define UINT_BITS (sizeof (unsigned int) * BYTE_BITS)  #define UINT_BITS (sizeof (unsigned int) * CHAR_BIT)
152  /* Number of unsigned int in an bit_set.  */  /* Number of unsigned int in an bit_set.  */
153  #define BITSET_UINTS ((SBC_MAX + UINT_BITS - 1) / UINT_BITS)  #define BITSET_UINTS ((SBC_MAX + UINT_BITS - 1) / UINT_BITS)
154  typedef unsigned int bitset[BITSET_UINTS];  typedef unsigned int bitset[BITSET_UINTS];
155  typedef unsigned int *re_bitset_ptr_t;  typedef unsigned int *re_bitset_ptr_t;
156  typedef const unsigned int *re_const_bitset_ptr_t;  typedef const unsigned int *re_const_bitset_ptr_t;
157    
158  #define bitset_set(set,i) (set[i / UINT_BITS] |= 1 << i % UINT_BITS)  #define bitset_set(set,i) (set[i / UINT_BITS] |= 1u << i % UINT_BITS)
159  #define bitset_clear(set,i) (set[i / UINT_BITS] &= ~(1 << i % UINT_BITS))  #define bitset_clear(set,i) (set[i / UINT_BITS] &= ~(1u << i % UINT_BITS))
160  #define bitset_contain(set,i) (set[i / UINT_BITS] & (1 << i % UINT_BITS))  #define bitset_contain(set,i) (set[i / UINT_BITS] & (1u << i % UINT_BITS))
161  #define bitset_empty(set) memset (set, 0, sizeof (unsigned int) * BITSET_UINTS)  #define bitset_empty(set) memset (set, 0, sizeof (unsigned int) * BITSET_UINTS)
162  #define bitset_set_all(set) \  #define bitset_set_all(set) \
163    memset (set, 255, sizeof (unsigned int) * BITSET_UINTS)    memset (set, 255, sizeof (unsigned int) * BITSET_UINTS)
164  #define bitset_copy(dest,src) \  #define bitset_copy(dest,src) \
165    memcpy (dest, src, sizeof (unsigned int) * BITSET_UINTS)    memcpy (dest, src, sizeof (unsigned int) * BITSET_UINTS)
 static inline void bitset_not (bitset set);  
 static inline void bitset_merge (bitset dest, const bitset src);  
 static inline void bitset_not_merge (bitset dest, const bitset src);  
 static inline void bitset_mask (bitset dest, const bitset src);  
166    
167  #define PREV_WORD_CONSTRAINT 0x0001  #define PREV_WORD_CONSTRAINT 0x0001
168  #define PREV_NOTWORD_CONSTRAINT 0x0002  #define PREV_NOTWORD_CONSTRAINT 0x0002
# Line 171  typedef enum Line 191  typedef enum
191    
192  typedef struct  typedef struct
193  {  {
194    int alloc;    Idx alloc;
195    int nelem;    Idx nelem;
196    int *elems;    Idx *elems;
197  } re_node_set;  } re_node_set;
198    
199  typedef enum  typedef enum
# Line 259  typedef struct Line 279  typedef struct
279    unsigned int non_match : 1;    unsigned int non_match : 1;
280    
281    /* # of multibyte characters.  */    /* # of multibyte characters.  */
282    int nmbchars;    Idx nmbchars;
283    
284    /* # of collating symbols.  */    /* # of collating symbols.  */
285    int ncoll_syms;    Idx ncoll_syms;
286    
287    /* # of equivalence classes. */    /* # of equivalence classes. */
288    int nequiv_classes;    Idx nequiv_classes;
289    
290    /* # of range expressions. */    /* # of range expressions. */
291    int nranges;    Idx nranges;
292    
293    /* # of character classes. */    /* # of character classes. */
294    int nchar_classes;    Idx nchar_classes;
295  } re_charset_t;  } re_charset_t;
296  #endif /* RE_ENABLE_I18N */  #endif /* RE_ENABLE_I18N */
297    
# Line 284  typedef struct Line 304  typedef struct
304  #ifdef RE_ENABLE_I18N  #ifdef RE_ENABLE_I18N
305      re_charset_t *mbcset;       /* for COMPLEX_BRACKET */      re_charset_t *mbcset;       /* for COMPLEX_BRACKET */
306  #endif /* RE_ENABLE_I18N */  #endif /* RE_ENABLE_I18N */
307      int idx;                    /* for BACK_REF */      Idx idx;                    /* for BACK_REF */
308      re_context_type ctx_type;   /* for ANCHOR */      re_context_type ctx_type;   /* for ANCHOR */
309    } opr;    } opr;
310  #if __GNUC__ >= 2  #if __GNUC__ >= 2
# Line 318  struct re_string_t Line 338  struct re_string_t
338  #ifdef RE_ENABLE_I18N  #ifdef RE_ENABLE_I18N
339    /* Store the wide character string which is corresponding to MBS.  */    /* Store the wide character string which is corresponding to MBS.  */
340    wint_t *wcs;    wint_t *wcs;
341    int *offsets;    Idx *offsets;
342    mbstate_t cur_state;    mbstate_t cur_state;
343  #endif  #endif
344    /* Index in RAW_MBS.  Each character mbs[i] corresponds to    /* Index in RAW_MBS.  Each character mbs[i] corresponds to
345       raw_mbs[raw_mbs_idx + i].  */       raw_mbs[raw_mbs_idx + i].  */
346    int raw_mbs_idx;    Idx raw_mbs_idx;
347    /* The length of the valid characters in the buffers.  */    /* The length of the valid characters in the buffers.  */
348    int valid_len;    Idx valid_len;
349    /* The corresponding number of bytes in raw_mbs array.  */    /* The corresponding number of bytes in raw_mbs array.  */
350    int valid_raw_len;    Idx valid_raw_len;
351    /* The length of the buffers MBS and WCS.  */    /* The length of the buffers MBS and WCS.  */
352    int bufs_len;    Idx bufs_len;
353    /* The index in MBS, which is updated by re_string_fetch_byte.  */    /* The index in MBS, which is updated by re_string_fetch_byte.  */
354    int cur_idx;    Idx cur_idx;
355    /* length of RAW_MBS array.  */    /* length of RAW_MBS array.  */
356    int raw_len;    Idx raw_len;
357    /* This is RAW_LEN - RAW_MBS_IDX + VALID_LEN - VALID_RAW_LEN.  */    /* This is RAW_LEN - RAW_MBS_IDX + VALID_LEN - VALID_RAW_LEN.  */
358    int len;    Idx len;
359    /* End of the buffer may be shorter than its length in the cases such    /* End of the buffer may be shorter than its length in the cases such
360       as re_match_2, re_search_2.  Then, we use STOP for end of the buffer       as re_match_2, re_search_2.  Then, we use STOP for end of the buffer
361       instead of LEN.  */       instead of LEN.  */
362    int raw_stop;    Idx raw_stop;
363    /* This is RAW_STOP - RAW_MBS_IDX adjusted through OFFSETS.  */    /* This is RAW_STOP - RAW_MBS_IDX adjusted through OFFSETS.  */
364    int stop;    Idx stop;
365    
366    /* The context of mbs[0].  We store the context independently, since    /* The context of mbs[0].  We store the context independently, since
367       the context of mbs[0] may be different from raw_mbs[0], which is       the context of mbs[0] may be different from raw_mbs[0], which is
368       the beginning of the input string.  */       the beginning of the input string.  */
369    unsigned int tip_context;    unsigned int tip_context;
370    /* The translation passed as a part of an argument of re_compile_pattern.  */    /* The translation passed as a part of an argument of re_compile_pattern.  */
371    unsigned RE_TRANSLATE_TYPE trans;    unsigned REG_TRANSLATE_TYPE trans;
372    /* Copy of re_dfa_t's word_char.  */    /* Copy of re_dfa_t's word_char.  */
373    re_const_bitset_ptr_t word_char;    re_const_bitset_ptr_t word_char;
374    /* 1 if REG_ICASE.  */    /* true if REG_ICASE.  */
375    unsigned char icase;    unsigned char icase;
376    unsigned char is_utf8;    unsigned char is_utf8;
377    unsigned char map_notascii;    unsigned char map_notascii;
# Line 375  typedef struct re_dfa_t re_dfa_t; Line 395  typedef struct re_dfa_t re_dfa_t;
395  # endif  # endif
396  #endif  #endif
397    
 #ifndef RE_NO_INTERNAL_PROTOTYPES  
 static reg_errcode_t re_string_allocate (re_string_t *pstr, const char *str,  
                                          int len, int init_len,  
                                          RE_TRANSLATE_TYPE trans, int icase,  
                                          const re_dfa_t *dfa)  
      internal_function;  
 static reg_errcode_t re_string_construct (re_string_t *pstr, const char *str,  
                                           int len, RE_TRANSLATE_TYPE trans,  
                                           int icase, const re_dfa_t *dfa)  
      internal_function;  
 static reg_errcode_t re_string_reconstruct (re_string_t *pstr, int idx,  
                                             int eflags) internal_function;  
398  static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr,  static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr,
399                                                  int new_buf_len)                                                  Idx new_buf_len)
400       internal_function;       internal_function;
401  # ifdef RE_ENABLE_I18N  #ifdef RE_ENABLE_I18N
402  static void build_wcs_buffer (re_string_t *pstr) internal_function;  static void build_wcs_buffer (re_string_t *pstr) internal_function;
403  static int build_wcs_upper_buffer (re_string_t *pstr) internal_function;  static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr)
404  # endif /* RE_ENABLE_I18N */       internal_function;
405    #endif /* RE_ENABLE_I18N */
406  static void build_upper_buffer (re_string_t *pstr) internal_function;  static void build_upper_buffer (re_string_t *pstr) internal_function;
407  static void re_string_translate_buffer (re_string_t *pstr) internal_function;  static void re_string_translate_buffer (re_string_t *pstr) internal_function;
408  static void re_string_destruct (re_string_t *pstr) internal_function;  static unsigned int re_string_context_at (const re_string_t *input,
409  # ifdef RE_ENABLE_I18N                                            Idx idx, int eflags)
 static int re_string_elem_size_at (const re_string_t *pstr, int idx)  
      internal_function __attribute ((pure));  
 static inline int re_string_char_size_at (const re_string_t *pstr, int idx)  
      internal_function __attribute ((pure));  
 static inline wint_t re_string_wchar_at (const re_string_t *pstr, int idx)  
      internal_function __attribute ((pure));  
 # endif /* RE_ENABLE_I18N */  
 static unsigned int re_string_context_at (const re_string_t *input, int idx,  
                                           int eflags)  
410       internal_function __attribute ((pure));       internal_function __attribute ((pure));
411  static unsigned char re_string_peek_byte_case (const re_string_t *pstr,  
                                                int idx)  
      internal_function __attribute ((pure));  
 static unsigned char re_string_fetch_byte_case (re_string_t *pstr)  
      internal_function __attribute ((pure));  
 #endif  
412  #define re_string_peek_byte(pstr, offset) \  #define re_string_peek_byte(pstr, offset) \
413    ((pstr)->mbs[(pstr)->cur_idx + offset])    ((pstr)->mbs[(pstr)->cur_idx + offset])
414  #define re_string_fetch_byte(pstr) \  #define re_string_fetch_byte(pstr) \
# Line 431  static unsigned char re_string_fetch_byt Line 426  static unsigned char re_string_fetch_byt
426  #define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx))  #define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx))
427  #define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx))  #define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx))
428    
429    #include <alloca.h>
430    
431    #ifndef _LIBC
432    # if HAVE_ALLOCA
433    /* The OS usually guarantees only one guard page at the bottom of the stack,
434       and a page size can be as small as 4096 bytes.  So we cannot safely
435       allocate anything larger than 4096 bytes.  Also care for the possibility
436       of a few compiler-allocated temporary stack slots.  */
437    #  define __libc_use_alloca(n) ((n) < 4032)
438    # else
439    /* alloca is implemented with malloc, so just use malloc.  */
440    #  define __libc_use_alloca(n) 0
441    # endif
442    #endif
443    
444  #define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t)))  #define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t)))
445    #define re_xmalloc(t,n) ((t *) re_xnmalloc (n, sizeof (t)))
446    #define re_calloc(t,n) ((t *) calloc (n, sizeof (t)))
447  #define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t)))  #define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t)))
448    #define re_xrealloc(p,t,n) ((t *) re_xnrealloc (p, n, sizeof (t)))
449    #define re_x2realloc(p,t,pn) ((t *) re_x2nrealloc (p, pn, sizeof (t)))
450  #define re_free(p) free (p)  #define re_free(p) free (p)
451    
452    #ifndef SIZE_MAX
453    # define SIZE_MAX ((size_t) -1)
454    #endif
455    
456    /* Return true if an array of N objects, each of size S, cannot exist
457       due to size arithmetic overflow.  S must be nonzero.  */
458    static inline bool
459    re_alloc_oversized (size_t n, size_t s)
460    {
461      return BE (SIZE_MAX / s < n, 0);
462    }
463    
464    /* Return true if an array of (2 * N + 1) objects, each of size S,
465       cannot exist due to size arithmetic overflow.  S must be nonzero.  */
466    static inline bool
467    re_x2alloc_oversized (size_t n, size_t s)
468    {
469      return BE ((SIZE_MAX / s - 1) / 2 < n, 0);
470    }
471    
472    /* Allocate an array of N objects, each with S bytes of memory,
473       dynamically, with error checking.  S must be nonzero.  */
474    static inline void *
475    re_xnmalloc (size_t n, size_t s)
476    {
477      return re_alloc_oversized (n, s) ? NULL : malloc (n * s);
478    }
479    
480    /* Change the size of an allocated block of memory P to an array of N
481       objects each of S bytes, with error checking.  S must be nonzero.  */
482    static inline void *
483    re_xnrealloc (void *p, size_t n, size_t s)
484    {
485      return re_alloc_oversized (n, s) ? NULL : realloc (p, n * s);
486    }
487    
488    /* Reallocate a block of memory P to an array of (2 * (*PN) + 1)
489       objects each of S bytes, with error checking.  S must be nonzero.
490       If the allocation is successful, set *PN to the new allocation
491       count and return the resulting pointer.  Otherwise, return
492       NULL.  */
493    static inline void *
494    re_x2nrealloc (void *p, size_t *pn, size_t s)
495    {
496      if (re_x2alloc_oversized (*pn, s))
497        return NULL;
498      else
499        {
500          /* Add 1 in case *PN is zero.  */
501          size_t n1 = 2 * *pn + 1;
502          p = realloc (p, n1 * s);
503          if (BE (p != NULL, 1))
504            *pn = n1;
505          return p;
506        }
507    }
508    
509  struct bin_tree_t  struct bin_tree_t
510  {  {
511    struct bin_tree_t *parent;    struct bin_tree_t *parent;
# Line 447  struct bin_tree_t Line 518  struct bin_tree_t
518    
519    /* `node_idx' is the index in dfa->nodes, if `type' == 0.    /* `node_idx' is the index in dfa->nodes, if `type' == 0.
520       Otherwise `type' indicate the type of this node.  */       Otherwise `type' indicate the type of this node.  */
521    int node_idx;    Idx node_idx;
522  };  };
523  typedef struct bin_tree_t bin_tree_t;  typedef struct bin_tree_t bin_tree_t;
524    
# Line 491  typedef struct bin_tree_storage_t bin_tr Line 562  typedef struct bin_tree_storage_t bin_tr
562    
563  struct re_dfastate_t  struct re_dfastate_t
564  {  {
565    unsigned int hash;    re_hashval_t hash;
566    re_node_set nodes;    re_node_set nodes;
567    re_node_set non_eps_nodes;    re_node_set non_eps_nodes;
568    re_node_set inveclosure;    re_node_set inveclosure;
# Line 511  typedef struct re_dfastate_t re_dfastate Line 582  typedef struct re_dfastate_t re_dfastate
582    
583  struct re_state_table_entry  struct re_state_table_entry
584  {  {
585    int num;    Idx num;
586    int alloc;    Idx alloc;
587    re_dfastate_t **array;    re_dfastate_t **array;
588  };  };
589    
# Line 520  struct re_state_table_entry Line 591  struct re_state_table_entry
591    
592  typedef struct  typedef struct
593  {  {
594    int next_idx;    Idx next_idx;
595    int alloc;    Idx alloc;
596    re_dfastate_t **array;    re_dfastate_t **array;
597  } state_array_t;  } state_array_t;
598    
# Line 529  typedef struct Line 600  typedef struct
600    
601  typedef struct  typedef struct
602  {  {
603    int node;    Idx node;
604    int str_idx; /* The position NODE match at.  */    Idx str_idx; /* The position NODE match at.  */
605    state_array_t path;    state_array_t path;
606  } re_sub_match_last_t;  } re_sub_match_last_t;
607    
# Line 540  typedef struct Line 611  typedef struct
611    
612  typedef struct  typedef struct
613  {  {
614    int str_idx;    Idx str_idx;
615    int node;    Idx node;
   int next_last_offset;  
616    state_array_t *path;    state_array_t *path;
617    int alasts; /* Allocation size of LASTS.  */    Idx alasts; /* Allocation size of LASTS.  */
618    int nlasts; /* The number of LASTS.  */    Idx nlasts; /* The number of LASTS.  */
619    re_sub_match_last_t **lasts;    re_sub_match_last_t **lasts;
620  } re_sub_match_top_t;  } re_sub_match_top_t;
621    
622  struct re_backref_cache_entry  struct re_backref_cache_entry
623  {  {
624    int node;    Idx node;
625    int str_idx;    Idx str_idx;
626    int subexp_from;    Idx subexp_from;
627    int subexp_to;    Idx subexp_to;
628    char more;    char more;
629    char unused;    char unused;
630    unsigned short int eps_reachable_subexps_map;    unsigned short int eps_reachable_subexps_map;
# Line 572  typedef struct Line 642  typedef struct
642    /* EFLAGS of the argument of regexec.  */    /* EFLAGS of the argument of regexec.  */
643    int eflags;    int eflags;
644    /* Where the matching ends.  */    /* Where the matching ends.  */
645    int match_last;    Idx match_last;
646    int last_node;    Idx last_node;
647    /* The state log used by the matcher.  */    /* The state log used by the matcher.  */
648    re_dfastate_t **state_log;    re_dfastate_t **state_log;
649    int state_log_top;    Idx state_log_top;
650    /* Back reference cache.  */    /* Back reference cache.  */
651    int nbkref_ents;    Idx nbkref_ents;
652    int abkref_ents;    Idx abkref_ents;
653    struct re_backref_cache_entry *bkref_ents;    struct re_backref_cache_entry *bkref_ents;
654    int max_mb_elem_len;    int max_mb_elem_len;
655    int nsub_tops;    Idx nsub_tops;
656    int asub_tops;    Idx asub_tops;
657    re_sub_match_top_t **sub_tops;    re_sub_match_top_t **sub_tops;
658  } re_match_context_t;  } re_match_context_t;
659    
# Line 591  typedef struct Line 661  typedef struct
661  {  {
662    re_dfastate_t **sifted_states;    re_dfastate_t **sifted_states;
663    re_dfastate_t **limited_states;    re_dfastate_t **limited_states;
664    int last_node;    Idx last_node;
665    int last_str_idx;    Idx last_str_idx;
666    re_node_set limits;    re_node_set limits;
667  } re_sift_context_t;  } re_sift_context_t;
668    
669  struct re_fail_stack_ent_t  struct re_fail_stack_ent_t
670  {  {
671    int idx;    Idx idx;
672    int node;    Idx node;
673    regmatch_t *regs;    regmatch_t *regs;
674    re_node_set eps_via_nodes;    re_node_set eps_via_nodes;
675  };  };
676    
677  struct re_fail_stack_t  struct re_fail_stack_t
678  {  {
679    int num;    Idx num;
680    int alloc;    Idx alloc;
681    struct re_fail_stack_ent_t *stack;    struct re_fail_stack_ent_t *stack;
682  };  };
683    
684  struct re_dfa_t  struct re_dfa_t
685  {  {
686    re_token_t *nodes;    re_token_t *nodes;
687    int nodes_alloc;    Idx nodes_alloc;
688    int nodes_len;    Idx nodes_len;
689    int *nexts;    Idx *nexts;
690    int *org_indices;    Idx *org_indices;
691    re_node_set *edests;    re_node_set *edests;
692    re_node_set *eclosures;    re_node_set *eclosures;
693    re_node_set *inveclosures;    re_node_set *inveclosures;
# Line 632  struct re_dfa_t Line 702  struct re_dfa_t
702    int str_tree_storage_idx;    int str_tree_storage_idx;
703    
704    /* number of subexpressions `re_nsub' is in regex_t.  */    /* number of subexpressions `re_nsub' is in regex_t.  */
705    unsigned int state_hash_mask;    re_hashval_t state_hash_mask;
706    int states_alloc;    Idx init_node;
707    int init_node;    Idx nbackref; /* The number of backreference in this dfa.  */
   int nbackref; /* The number of backreference in this dfa.  */  
708    
709    /* Bitmap expressing which backreference is used.  */    /* Bitmap expressing which backreference is used.  */
710    unsigned int used_bkref_map;    unsigned int used_bkref_map;
# Line 652  struct re_dfa_t Line 721  struct re_dfa_t
721    int mb_cur_max;    int mb_cur_max;
722    bitset word_char;    bitset word_char;
723    reg_syntax_t syntax;    reg_syntax_t syntax;
724    int *subexp_map;    Idx *subexp_map;
725  #ifdef DEBUG  #ifdef DEBUG
726    char* re_str;    char* re_str;
727  #endif  #endif
728    __libc_lock_define (, lock)    __libc_lock_define (, lock)
729  };  };
730    
 #ifndef RE_NO_INTERNAL_PROTOTYPES  
 static reg_errcode_t re_node_set_alloc (re_node_set *set, int size) internal_function;  
 static reg_errcode_t re_node_set_init_1 (re_node_set *set, int elem) internal_function;  
 static reg_errcode_t re_node_set_init_2 (re_node_set *set, int elem1,  
                                          int elem2) internal_function;  
731  #define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set))  #define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set))
 static reg_errcode_t re_node_set_init_copy (re_node_set *dest,  
                                             const re_node_set *src) internal_function;  
 static reg_errcode_t re_node_set_add_intersect (re_node_set *dest,  
                                                 const re_node_set *src1,  
                                                 const re_node_set *src2) internal_function;  
 static reg_errcode_t re_node_set_init_union (re_node_set *dest,  
                                              const re_node_set *src1,  
                                              const re_node_set *src2) internal_function;  
 static reg_errcode_t re_node_set_merge (re_node_set *dest,  
                                         const re_node_set *src) internal_function;  
 static int re_node_set_insert (re_node_set *set, int elem) internal_function;  
 static int re_node_set_insert_last (re_node_set *set,  
                                     int elem) internal_function;  
 static int re_node_set_compare (const re_node_set *set1,  
                                 const re_node_set *set2)  
      internal_function __attribute ((pure));  
 static int re_node_set_contains (const re_node_set *set, int elem)  
      internal_function __attribute ((pure));  
 static void re_node_set_remove_at (re_node_set *set, int idx) internal_function;  
732  #define re_node_set_remove(set,id) \  #define re_node_set_remove(set,id) \
733    (re_node_set_remove_at (set, re_node_set_contains (set, id) - 1))    (re_node_set_remove_at (set, re_node_set_contains (set, id) - 1))
734  #define re_node_set_empty(p) ((p)->nelem = 0)  #define re_node_set_empty(p) ((p)->nelem = 0)
735  #define re_node_set_free(set) re_free ((set)->elems)  #define re_node_set_free(set) re_free ((set)->elems)
736  static int re_dfa_add_node (re_dfa_t *dfa, re_token_t token) internal_function;  
 static re_dfastate_t *re_acquire_state (reg_errcode_t *err, re_dfa_t *dfa,  
                                         const re_node_set *nodes) internal_function;  
 static re_dfastate_t *re_acquire_state_context (reg_errcode_t *err,  
                                                 re_dfa_t *dfa,  
                                                 const re_node_set *nodes,  
                                                 unsigned int context) internal_function;  
737  static void free_state (re_dfastate_t *state) internal_function;  static void free_state (re_dfastate_t *state) internal_function;
 #endif  
738    
739    
740  typedef enum  typedef enum
# Line 753  bitset_mask (bitset dest, const bitset s Line 791  bitset_mask (bitset dest, const bitset s
791      dest[bitset_i] &= src[bitset_i];      dest[bitset_i] &= src[bitset_i];
792  }  }
793    
794  #if defined RE_ENABLE_I18N && !defined RE_NO_INTERNAL_PROTOTYPES  #if defined RE_ENABLE_I18N
795  /* Inline functions for re_string.  */  /* Inline functions for re_string.  */
796  static inline int  static inline int
797  internal_function  internal_function __attribute ((pure))
798  re_string_char_size_at (const re_string_t *pstr, int idx)  re_string_char_size_at (const re_string_t *pstr, Idx idx)
799  {  {
800    int byte_idx;    int byte_idx;
801    if (pstr->mb_cur_max == 1)    if (pstr->mb_cur_max == 1)
# Line 769  re_string_char_size_at (const re_string_ Line 807  re_string_char_size_at (const re_string_
807  }  }
808    
809  static inline wint_t  static inline wint_t
810  internal_function  internal_function __attribute ((pure))
811  re_string_wchar_at (const re_string_t *pstr, int idx)  re_string_wchar_at (const re_string_t *pstr, Idx idx)
812  {  {
813    if (pstr->mb_cur_max == 1)    if (pstr->mb_cur_max == 1)
814      return (wint_t) pstr->mbs[idx];      return (wint_t) pstr->mbs[idx];
# Line 778  re_string_wchar_at (const re_string_t *p Line 816  re_string_wchar_at (const re_string_t *p
816  }  }
817    
818  static int  static int
819  internal_function  internal_function __attribute ((pure))
820  re_string_elem_size_at (const re_string_t *pstr, int idx)  re_string_elem_size_at (const re_string_t *pstr, Idx idx)
821  {  {
822  #ifdef _LIBC  #ifdef _LIBC
823    const unsigned char *p, *extra;    const unsigned char *p, *extra;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26