#4 altlinuxHyph added code


Some suggested code for substring.c.
Add what looks okay, leave-out what doesn't seem okay.

1) Moved messages to one area - should allow for messages to be re-used. Could possibly add other languages by using #ifdef (hard-coded) or by inserting messages into arrays (load on demand).

2) Used << and >> for CPUs that don't have a divide or multiply (less code, plus faster for some CPUs).

3) Added a possible suggested way of dealing with UTF-8 at lines 42/43/44 by using if (c>=0)
Maybe better to code as if (c>=0 && ascii8bit) where ascii8bit=0 for UTF-8 and !=0 for ISO-885x text.


  • Jose Da Silva

    Jose Da Silva - 2007-05-24

    some improvements and fixes for substring.c

  • Németh László

    • status: open --> pending
  • Németh László

    Logged In: YES
    Originator: NO

    Hi, it would be nice to post the substring.c patch to its author, too. Unfortunatelly, I have no time to check your patch. The preferred way to precompile LibHnj hyphenation patterns is using substrings.pl for its Unicode and non-standard hyphenation support (but the C version would be useful for a loading time preprocessing.)

  • Jose Da Silva

    Jose Da Silva - 2007-06-14
    • status: pending --> open
  • Jose Da Silva

    Jose Da Silva - 2007-06-14

    Logged In: YES
    Originator: YES

    Okay - good suggestion.
    1 email pointing to this webpage and patch have been sent to Raph Levien using email address at bottom of page of www.levien.com

    2nd email to Nanning Buitenhuis (substrings.c) mentioned in the authors section.

  • caolan mcnamara

    caolan mcnamara - 2010-03-04

    patch is quite old now, FWIW though
    Any half way right compiler would optimize /2 *2 into shifts
    fgets returns NULL on error, so comparison > 0 wouldn't be ideal
    fprintf returns number of chars written so comparison against !0 causing a failure isn't ideal either
    worth checking the nulls of course, so added that in

  • caolan mcnamara

    caolan mcnamara - 2010-03-04
    • status: open --> closed-fixed

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks