clasp icon indicating copy to clipboard operation
clasp copied to clipboard

calling clasp as a single function in a custom (application dependent) main function provided by the user

Open dg1sbg opened this issue 6 years ago • 0 comments

ENHANCEMENT / FEATURE REQUEST:

Currently, clasp has its own main function. It does set up a couple things then calls into lisp land. Also, currently clasp has not a fail-safe way of handling sigsegv and other signals and exceptions that cause process termination.

This is not acceptable for e.g. use as control application in an embedded device. Therefore I would like to request the following enhancement:

Provide a function

int clasp_main( int argc, char **argv, void * context )

that is the main function for clasp and contains all clasp internal machinery. The context parameter is a pointer to a data structure that provides function pointers and data containers for access to functionality like logging, signal handling and other, non-clasp specific but application usage dependent functionality.

The context handling functionality will provide functions for feature detection: If e.g. clasp (or other modules of the application) require logging functionality, there will be a function (or macro) context_check_feature( "LOGGING" ); (or a similar way) that returns True if that feature is provided by the context. If the feature is provided by the context then a feature record (to be defined) provides a means of calling functions of that logging feature.

It is also a requirement that the clasp_main function is exported as a C function to enable interfacing with other languages. - Imaging calling clasp from Python ... ;-)

This is an attempt of making clasp usable as a kind of library where the surrounding main function may be provided by the clasp-using application / the user.

dg1sbg avatar Mar 10 '18 13:03 dg1sbg