| 1 | Description: Fixes bi- and trigrams continuation |
| 2 | Author: Michael Stummvoll <[email protected]> |
| 3 | Bug: #651510 |
| 4 | Reviewed-by: Francesco Paolo Lovergine <[email protected]> |
| 5 | Last-Update: 2016-03-06 |
| 6 | --- |
| 7 | This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ |
| 8 | Index: gpw-0.0.19940601/loadtris.c |
| 9 | =================================================================== |
| 10 | --- gpw-0.0.19940601.orig/loadtris.c 2016-03-06 13:12:42.665014737 +0100 |
| 11 | +++ gpw-0.0.19940601/loadtris.c 2016-03-06 13:12:42.661014718 +0100 |
| 12 | @@ -20,6 +20,28 @@ |
| 13 | |
| 14 | FILE *fp; |
| 15 | |
| 16 | +void checktris() { |
| 17 | + int c1, c2, c3; |
| 18 | + for(c1=0; c1<26; c1++) { |
| 19 | + for(c2=0; c2<26; c2++) { |
| 20 | + int hastris = 0; |
| 21 | + for(c3=0; c3<26; c3++) { |
| 22 | + if(tris[c1][c2][c3]) { |
| 23 | + hastris = 1; |
| 24 | + break; |
| 25 | + } |
| 26 | + } |
| 27 | + if(!hastris) { /* if [c1][c2] has no tris... */ |
| 28 | + duos[c1][c2] = 0; /* ... do not use the duo ...*/ |
| 29 | + for(c3=0; c3<26; c3++) { /* ... and don't use tris */ |
| 30 | + sigma-=tris[c3][c1][c2];/* which are ending */ |
| 31 | + tris[c3][c1][c2] = 0; /* on [c1][c2] ...*/ |
| 32 | + } |
| 33 | + } |
| 34 | + } |
| 35 | + } |
| 36 | +} |
| 37 | + |
| 38 | int main (int argc, char ** argv) { |
| 39 | char buf[100]; |
| 40 | int j; |
| 41 | @@ -89,6 +111,7 @@ |
| 42 | } /* for argno */ |
| 43 | |
| 44 | if (nfiles) { /* find any input? */ |
| 45 | + checktris(); |
| 46 | printf ("/* BEGIN INCLUDE FILE .. trigram.h */\n"); /* Multics style */ |
| 47 | printf ("\n"); |
| 48 | printf ("const long sigma = %ld;\n", sigma); |