Things learned today, 15/10 2009

  • Simply moving initialization statements from the blip startup script in /usr/local/bin/blip to /home/samuel/.plrc did not work. Something seems not to get loaded in the correct way.
  • Alteration of the prolog initialization should be done in the JPL.Java file

Learned how to print out the parameters the current prolog engine was called with, with the following function:

    public String getActualArgs() {
        String[] initArgs = JPL.getActualInitArgs();
        StringBuffer result = new StringBuffer("");
        if (initArgs.length > 0) {
            result.append(initArgs[0]);
            for (int i=1; i<initArgs.length; i++) {
                result.append("\n");
                result.append(initArgs[i]);                
            }
        } else {
            result.append("Empty");
        }
        return result.toString();      
    }

And the corresponding interface method:

    @Recorded
    @PublishedMethod(
            methodSummary="Prints the arguments that the current Prolog engine was called with"
    )
    public String getActualArgs();

Calling it from the Bioclipse JS Console:

> blipkit.getActualArgs()
java.lang.NullPointerException: 
 
> blipkit.test()
Result: 
passed.
 
> blipkit.getActualArgs()
pl
-g
true
-nosignals

Ok, good to know.

I also came a bit with inputting the parameters from the blipkit startup script in /usr/local/bin/blip. I still get an error about an unknown PL_new_atom.

searching for that in the SWI-Prolog codebase yields the following:

samuel@samuel-asus:~/install/swi-prolog/pl-5.7.15$ egrep -ir "^pl_new_atom\(" ./*
./library/MANUAL:PL_new_atom(), 891
./man/foreign.doc:PL_new_atom() and PL_atom_chars().
./packages/xpce/sicstus/src/swi.h:PL_new_atom(const char *s)
./packages/C-sicstus/swi.h:PL_new_atom(const char *s)
./src/pl-fli.c:PL_new_atom(const char *s)

Gotta check up Prolog FLI (what's that?)