On Thu Dec 13 09:36:46 EST 2012, [email protected] wrote:
> a plumber rule to match an sha1 hash by catenating 40 of '[0-9a-f]' character 
> classes. got ``too many character classes; limit@'' error.
> 
> 
> so far i've found
> #define       NCLASS  (sizeof(RePrOg.class)/sizeof(Reclass))
> but no definition of RePrOg, only
> extern Reprog RePrOg;

yes, that is quite an obtuse definition.  i had a similar problem
in plan 9 and changed things so the definitions were explicit
in regexp.h.  at the same time, i noticed that the test for adjacent
ranges was incorrect, but that doesn't appear to be your problem.

i put the full source here:

         /n/sources/contrib/quanstro/regexp.tar

not every difference is a good one.  :-)  it looks like i need to
do a bit of cleanup.

- erik

---

/n/sources/plan9/sys/include/regexp.h:1,6 - /sys/include/regexp.h:1,11
  #pragma       src     "/sys/src/libregexp"
  #pragma       lib     "libregexp.a"
  
+ enum {
+       NSPANS  = 128,          /* max rune ranges per character class */
+       NCLASS  = 16,           /* max character classes per program */
+ };
+ 
  typedef struct Resub          Resub;
  typedef struct Reclass                Reclass;
  typedef struct Reinst         Reinst;
/n/sources/plan9/sys/include/regexp.h:27,33 - /sys/include/regexp.h:32,38
   */
  struct Reclass{
        Rune    *end;
-       Rune    spans[64];
+       Rune    spans[NSPANS*2];
  };
  
  /*
/n/sources/plan9/sys/include/regexp.h:52,58 - /sys/include/regexp.h:57,63
   */
  struct Reprog{
        Reinst  *startinst;     /* start pc */
-       Reclass class[16];      /* .data */
+       Reclass class[NCLASS];  /* .data */
        Reinst  firstinst[5];   /* .text */
  };

/n/sources/plan9/sys/src/libregexp/regcomp.c:389,399 - regcomp.c:383,408
    static int
  bldcclass(void)
  {
        int type;
-       Rune r[NCCRUNE];
+       Rune r[NSPANS*2];
        Rune *p, *ep, *np;
        Rune rune;
        int quoted;

Reply via email to