The interpreter has direct access to utf8proc if needed, so the type of wrapper 
has no impact.

What is the best way to provide access to utf8proc from a script?
Some of the methods are REXX methods, mainly for the constants.
The remaining methods are native (20 methods).

a)
Native class UTF8Proc with class methods only.
No instances, enforced by New and Copy.
UTF8Proc.cls is included in rexx.img.
It works, but there is no similar implementation among the predefined classes.

b)
Native class UTF8Proc with instance methods.
Singleton, similar to RexxInfo.
UTF8Proc.cls is included in rexx.img.

c)
Not a native class, but a library with native methods, similar to File or 
Stream.
Singleton.
UTF8Proc.cls is included in rexx.img.

d)
Same as (c), but not included in rexx.img.
UTF8Proc.cls is located in trunk/extensions/Unicode and must be loaded by the 
user.


Illustration of the current implementation (option a):

StartClassDefinition(UTF8Proc)

        AddClassMethod("New"                        , UTF8ProcClass::newRexx, 
A_COUNT);
        AddClassMethod("Version"                    , UTF8ProcClass::version, 
0);
        AddClassMethod("GraphemeBreak"              , 
UTF8ProcClass::graphemeBreak, 1);
        AddClassMethod("CodepointCategory"          , 
UTF8ProcClass::codepointCategory, 1);
        ...

    CompleteClassMethodDefinitions();

        AddMethod("Copy"                            , UTF8ProcClass::copyRexx, 
0);

    CompleteMethodDefinitions();

    CompleteClassDefinition(UTF8Proc);

EndClassDefinition(UTF8Proc);




UTF8Proc.cls
...
-- Values returned by .UTF8Proc~CodepointCategory(codepoint)
::constant CATEGORY_CN  0 /**< Other, not assigned */
::constant CATEGORY_LU  1 /**< Letter, uppercase */
::constant CATEGORY_LL  2 /**< Letter, lowercase */
::constant CATEGORY_LT  3 /**< Letter, titlecase */
::constant CATEGORY_LM  4 /**< Letter, modifier */
...


_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to