Forum OpenACS Q&A: Re: Using the API for shell scripts

Collapse
Posted by Jose Agustin Lopez Bueno on
Hello, Lars!

Thanks for the reply.

That is a nice tool!
But I need some thing more flexible, for
calling from command line (linux bash).

I am looking the code for call tcl procs that
I need but I have found that several tcl used code is
embebed in aolserver (like nsv_array structure)
and I do not know how could I use that
from my program (it is programed in C).
Any pointer??

All the way, I think of OpenACS would need full
independence from aolserver code. In that way we
could build tools for administrate since command
line.

Regards,
Agustin

Collapse
Posted by Andrew Piskorski on
Jose, you are writing a stand-alone program in C, which you call from the command line? In that case, why would you ever need nsv? Nsv is for sharing data between threads in AOLserver. What does your command line C program do? Is this still for the "load many courses and users into OpenACS from an external database" problem that you opened this thread with? If so I don't see why you'd be doing any C coding at all for that.

I think the following is not useful for Jose's application, but just in case:

If on the other hand you're writing an AOLserver module in C, you may have noticed that AOLserver provides no C API to nsv, only a Tcl API. However, it is fortunately not too difficult to add an efficient C NSV API. I have done so and use it myself, although I never packaged it up for release. (Which means if someone actually needs it, let me know.)

If you are writing a non-AOLserver multi-threaded program and miss the AOLserver Nsv API, you are in luck, just use the Tcl Threads Extension with tclsh. It's tsv api is just like nsv only better. Last time I looked tsv also has only a Tcl API no C; I never tried to add a C API to it but presumably it should also be feasible.