Re: ANA() SANA() Macros are wrong...

From: Peter Ajamian (
Date: 03/10/01

George Greer wrote:
> On Sat, 10 Mar 2001, Peter Ajamian wrote:
> >Unfotunately, I don't have an english primer to check and I don't know
> >off the top of my head what exactly defines "y" to be a vowel, I think it
> >acts as a vowel in the abscence of other vowels, if that's the case then
> >the following (while being rather more complex) should work...
> Since we're only concerned with the beginning of the line, it doesn't
> matter much. It appears to be a Diku artifact, changing...

hrmmm, I just realized that my fix relies on obj names of only one word,
so if an object is named, for example, "Yellow flag", (oh wait, that
would work, but imagine for a minute that "yellow" doesn't have any
vowels other than the initial "y" and it's supposed to return "an") it
would return "a" because it would find a vowel in the word "flag".  Try
this instead...

#define VOWEL_LEADER(name) (strchr("aeiouAEIOU", *(name)) || \
        (strchr("yY", *(name)) && \
         (!(name)[strcspn((name), "aeiouAEIOU")] || \
          (name)[strcspn((name), "aeiouAEIOU")] == ' ')))

Heh, I counted the ()'s there, but it's a little complicated, so if it
errors, well, I'm sure you can fix it *grins*.  The other two #defiens
are the same.  By the way, this is getting complex enough for a function
(it would be nice to stash the return of the strcspn in a variable since
it has to be tested twice).

Regards, Peter

   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/04/01 PST