static char sccsid
[] = "@(#)n8.c 1.1 (CWI) 85/07/17";
#define HY_BIT 0200 /* stuff in here only works for ascii */
while (punct(cbits(*i
++)))
while (alph(cbits(*i
++)))
while (punct(cbits(*i
++)))
if ((wdend
- wdstart
- 4) < 0)
if (!exword() && !suffix())
if (hyalg
== ORIGINAL
&& !suffix())
for (hyp
= hyptr
+ 1; *hyp
!= 0; hyp
++) {
if (i
>= 'a' && i
<= 'z' || i
>= 'A' && i
<= 'Z')
* set the hyphenation algorithm
fprintf(stderr
, "Unknown dialect %d.\n", i
);
if ((j
= nexth
) >= (hbuf
+ NHEX
- 2))
if (i
== ' ' || i
== '\n') {
if (j
>= (hbuf
+ NHEX
- 2))
fprintf(stderr
, "troff: exception word list full.\n");
while (*e
&& w
<= hyend
&& (*e
& 0177) == maplow(cbits(*w
))) {
(hyalg
== ORIGINAL
/* s-extension only in original */
&& (w
== wdend
&& maplow(cbits(*w
)) == 's'))) {
for (e
= save
; *e
; e
++) {
if (hyp
> (hyptr
+ NHYP
- 1))
if (!alph(cbits(i
= cbits(*hyend
))))
if ((s0
= suftab
[i
-'a']) == 0)
if ((i
= *s0
& 017) == 0)
while (s
> s0
&& w
>= wdstart
&& (*s
& 0177) == maplow(cbits(*w
))) {
extern char bxh
[26][13], bxxh
[26][13], xxh
[26][13], xhx
[26][13], hxx
[26][13];
if (!(w
= chkvow(hyend
+ 1)))
if (!(w
= chkvow(hyend
)))
while ((++w
< hyend
) && (w
< (wdend
- 1))) {
val
*= dilook('a', cbits(*w
), bxh
);
else if (w
== wdstart
+ 1)
val
*= dilook(cbits(*(w
-1)), cbits(*w
), bxxh
);
val
*= dilook(cbits(*(w
-1)), cbits(*w
), xxh
);
val
*= dilook(cbits(*w
), cbits(*(w
+1)), xhx
);
val
*= dilook(cbits(*(w
+1)), cbits(*(w
+2)), hxx
);
i
= t
[maplow(a
)-'a'][(j
= maplow(b
)-'a')/2];
* All these jazz is to have the dialect dutch being hyphenated
* It first appeared in the dutch version of troff (nltroff), due to
* The original program has converted from Algol60 to C by, I think
* Planted in this version of troff by jaap akkerhuis (jna).
* Note that this is licensed software!
#define MAXLETT 50 /* at most the first MAXLETT characters of a word
#define MAXSYLL 20 /* at most the first MAXSYLL syllables of a word
split( aword
, anend
) register tchar
*aword
, *anend
;
extern tchar
*bestsplit1();
place
= bestsplit1( aword
, anend
);
if( place
!= (tchar
*) NULL
)
if( place
- aword
> thresh
&& anend
- place
> thresh
)
if( anend
- place
> thresh
&& place
- aword
> thresh
)
bestsplit1( tosplit
, aend
)
/* This function determines the "best" place to split into two parts the
* Dutch word contained in a string of <size> characters which starts at
* the address <tosplit> .
* The input characters should be in ASCII code .
* The function returns as value the number of characters of the first
* If the returned value exceeds the character count of the line the
* user may try to invoke bestsplit1 again but now with <size> equal to
* the returned value plus one .
* The algorithm is adapted from the Mathematical Centre report NR 28/72,
* "BESTESPLITS1, EEN PROCEDURE VOOR HET AUTOMATISCH AFBREKEN VAN NEDER-
* LANDSE WOORDEN" , which has been written by J.C. VAN VLIET.
extern char translate
[], comprimation
[][14], consonant
[][23],
short word
[ MAXLETT
+1], reference
[ MAXLETT
+1], vowel
[ MAXSYLL
],
turn
[ MAXSYLL
] , letter
, nextlett
, vowel1
, vowel2
,
short numlett
, numsyll
, turnindex
, differ
, start1
, start2
, stop
,
register int i
, j
, help
;
short size
= aend
- tosplit
+ 1;
/* translate into bestsplit code : */
while ( (++help
< size
) && (i
< MAXLETT
) ) {
word
[i
++] = translate
[maplow(cbits(tosplit
[help
])) - 'a'] ;
/* end of translation : */
if ( numlett
< 4 ) goto nosplit
;
/* comprimation of vowels : */
if ( (25 < letter
) && (letter
< 41) ) {
if ( (28 < nextlett
) && (nextlett
< 43) ) {
letter
= comprimation
[letter
-26][nextlett
-29] ;
} /* end of comprimation */
word
[j
] = word
[numlett
] ;
/* determination of the number of syllables */
while ( ( ++i
<= numlett
) && ( j
< MAXSYLL
) ) {
if ( numsyll
< 2 ) goto nosplit
;
while ( turnindex
< stop
) {
for ( i
= stop
- 1 ; i
>= 0 ; i
-- ) {
if ( vowel1
- vowel2
== differ
) {
if ( differ
== 1 ) start1
= turnindex
;
else if ( differ
== 2 ) start2
= turnindex
;
if ( turnindex
>= stop
) {
if ( level
== 1 ) turnindex
= start2
;
if ( turnindex
>= stop
) goto next
;
for ( j
= vowel2
-2 ; j
>= vowel1
+1 ; j
-- ) {
help
= consonant
[word
[j
]-39][word
[j
+1]-39] ;
if ( abs(help
) == 1 ) goto splitafterj
;
if ( help
< 0 ) goto next
;
break ; /* end of first phase */
for ( i
= vowel2
-2 ; i
>= vowel1
+1 ; i
-- ) {
help
= consonant
[word
[i
]-39][word
[i
+1]-39] ;
help
= abs(consonant
[word
[i
-1]-39][word
[i
]-39]) ;
else if ( ( abs(help
) == 4 ) &&
if ( help
< 0 ) goto next
;
break ; /* end of second phase */
if ( (help
== LETTERJ
) || (help
== LETTERV
) ||
(help
== LETTERZ
) ) goto splitafterj
;
if ( help
== LETTERX
) goto next
;
if ( l1
== LETTEREE
) goto next
;
if ( ( l1
> 24 ) && ( l1
< 29 ) ) {
for ( i
= 0 ; i
< 7 ; i
++ )
if ( ( l0
== prefix
[i
][0] ) &&
( l1
== prefix
[i
][1] ) &&
( l2
== prefix
[i
][2] ) ) goto next
;
break ; /* end of third phase */
bp
= reference
[j
+1] - 1 ;
if((bp
< size
-1) && (bp
> 0))
return(bp
== 0? (tchar
*) NULL
: tosplit
+bp
) ;