Followup question: as RexxQueryFunction() belongs to the pre-4.0 APIs it
is not aware of the REXX_TYPED_ROUTINEs that may have been registered
(as per the bug tracker comment).

Hence I came up with the following attempt to find out whether a routine
is loaded or not, but unfortunately it does not work.

Here is the attempted code (purpose: find out whether routines are
available or not): 

    RexxRoutine1(RexxStemObject, BsfQueryRegisteredFunctions, 
OPTIONAL_RexxStemObject, stem)  // 20090505, ---rgf
    {
    #ifdef RGF_INFO
        fprintf(stderr, "*** RGF_INFO: BsfQueryRegisteredFunctions() 1 ...\n");
        fflush(stderr);
    #endif

        if (stem==NULL)     // argument not given
        {
            stem=context->NewStem("BsfQueryRegisteredFunctions");
        }

        int32_t   entries=sizeof(ApiFncTableOrdered)/sizeof(PSZ), i=0, j=0;
        logical_t bExists=false;

        // get the package from the caller context: "stolen" from Mark's 
nutshell example "my.data"
        RexxPackageObject pkg=(RexxPackageObject) 
context->SendMessage0(context->GetCallerContext(),"PACKAGE");

        // RexxDirectoryObject rdo=context->GetPackagePublicRoutines(pkg); // 
get all public routines
        RexxDirectoryObject rdo=context->GetPackageRoutines(pkg); // get all 
available routines
        RexxObjectPtr logicalVal;

        for (i=0; i<entries; i++)       // loop over all functions/routines
        {
                // query the directory whether it has the routine
            logicalVal=context->SendMessage1(rdo, "HASENTRY", 
context->CString(ApiFncTableOrdered[i]));
            if (context->ObjectToLogical(logicalVal, &bExists)) // convert to 
logical, save it in 'bExists'
            {
                fprintf(stderr, "... querying [%s], bExists=[%d]\n", 
ApiFncTableOrdered[i], bExists);
                fflush(stderr);

                if (bExists)    // is the routine available at the moment, if 
so, save it in the stem
                {
                    context->SetStemArrayElement(stem, ++j, 
context->String(ApiFncTableOrdered[i]));
                }
            }
        }
        context->SetStemArrayElement(stem, 0, context->Int32ToObject(j));   // 
set total numbers of entries
        return stem;    // return the stem object
    }

      

What am I doing wrong?

How could one test whether REXX_TYPED_ROUTINES are registered or not?

---rony

P.S.: Maybe API functions "Has[Public]Routine(CNAME name)"  [and
"Has[Public]Class(CNAME className)"] and versions for returning the
respective routine/class objects may proof helpful for the API coders?




------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to