]> granicus.if.org Git - flex/commitdiff
Remove %t cruft
authorVern Paxson <vern@ee.lbl.gov>
Sat, 6 Feb 1993 21:01:45 +0000 (21:01 +0000)
committerVern Paxson <vern@ee.lbl.gov>
Sat, 6 Feb 1993 21:01:45 +0000 (21:01 +0000)
ecs.c

diff --git a/ecs.c b/ecs.c
index 73c07ddafbfa014c44d16941181830ad1bade3d4..2617c4649b89c51a9b9d691ce47a3ebdef32e8fb 100644 (file)
--- a/ecs.c
+++ b/ecs.c
@@ -61,32 +61,7 @@ void ccl2ecl()
            ich = ccltbl[cclp + ccls];
            cclmec = ecgroup[ich];
 
-           if ( xlation && cclmec < 0 )
-               {
-               /* special hack--if we're doing %t tables then it's
-                * possible that no representative of this character's
-                * equivalence class is in the ccl.  So waiting till
-                * we see the representative would be disastrous.  Instead,
-                * we add this character's equivalence class anyway, if it's
-                * not already present.
-                */
-               int j;
-
-               /* this loop makes this whole process n^2; but we don't
-                * really care about %t performance anyway
-                */
-               for ( j = 0; j < newlen; ++j )
-                   if ( ccltbl[cclp + j] == -cclmec )
-                       break;
-
-               if ( j >= newlen )
-                   { /* no representative yet, add this one in */
-                   ccltbl[cclp + newlen] = -cclmec;
-                   ++newlen;
-                   }
-               }
-
-           else if ( cclmec > 0 )
+           if ( cclmec > 0 )
                {
                ccltbl[cclp + newlen] = cclmec;
                ++newlen;
@@ -135,88 +110,6 @@ int fwd[], bck[], num;
     }
 
 
-/* ecs_from_xlation - associate equivalence class numbers using %t table
- *
- * synopsis
- *    numecs = ecs_from_xlation( ecmap );
- *
- *  Upon return, ecmap will map each character code to its equivalence
- *  class.  The mapping will be positive if the character is the representative
- *  of its class, negative otherwise.
- *
- *  Returns the number of equivalence classes used.
- */
-
-int ecs_from_xlation( ecmap )
-int ecmap[];
-
-    {
-    int i;
-    int nul_is_alone = false;
-    int did_default_xlation_class = false;
-
-    if ( xlation[0] != 0 )
-       {
-       /* if NUL shares its translation with other characters, choose one
-        * of the other characters as the representative for the equivalence
-        * class.  This allows a cheap test later to see whether we can
-        * do away with NUL's equivalence class.
-        */
-       for ( i = 1; i < csize; ++i )
-           if ( xlation[i] == -xlation[0] )
-               {
-               xlation[i] = xlation[0];
-               ecmap[0] = -xlation[0];
-               break;
-               }
-
-       if ( i >= csize )
-           /* didn't find a companion character--remember this fact */
-           nul_is_alone = true;
-       }
-
-    for ( i = 1; i < csize; ++i )
-       if ( xlation[i] == 0 )
-           {
-           if ( did_default_xlation_class )
-               ecmap[i] = -num_xlations;
-           
-           else
-               {
-               /* make an equivalence class for those characters not
-                * specified in the %t table
-                */
-               ++num_xlations;
-               ecmap[i] = num_xlations;
-               did_default_xlation_class = true;
-               }
-           }
-
-       else
-           ecmap[i] = xlation[i];
-
-    if ( nul_is_alone )
-       /* force NUL's equivalence class to be the last one */
-       {
-       ++num_xlations;
-       ecmap[0] = num_xlations;
-
-       /* there's actually a bug here: if someone is fanatic enough to
-        * put every character in its own translation class, then right
-        * now we just promoted NUL's equivalence class to be csize + 1;
-        * we can handle NUL's class number being == csize (by instead
-        * putting it in its own table), but we can't handle some *other*
-        * character having to be put in its own table, too.  So in
-        * this case we bail out.
-        */
-       if ( num_xlations > csize )
-           flexfatal( "too many %t classes!" );
-       }
-
-    return num_xlations;
-    }
-
-
 /* mkeccl - update equivalence classes based on character class xtions
  *
  * synopsis