[Rd] Some libraries and ideas for a 'librarified' R
Fri, 15 Dec 2000 14:20:53 -0000
Hy you all,
I think I have some code that could be interesting to make the R
architecture evolve towards better thread support, easier memory management,
better user interface programming (progress bar, logs), powerful debugging
without recompiling (hach!)
some years ago I start learning C with an ambitious project: write a C
library for multivariate data analysis.
On the route I learned C quite well and I discovered the power of scripting
languages nad finally the S language.
I wanted to write programs to perform routinely done exploratory data
analysis, using gnuplot as the graphic driver.
One of the my bigger concern has ever be memory management and reentrancy of
my code, possibly avoiding using OS support (such as thread local storage on
windows); I tried to allow for custom allocator in the library, supporting
ANSI functions as a ready option ...
I also have always used DOS (djgpp) and windows so I hated (and probably
strongly dislike) autoconf and the like: I tried to follow the advice not to
include to many #ifdef/#else/#endif in my code and to prefer to configure my
libraries at run-time.
Dealing with long calculations, I also wanted to make she/he let know where
the program is (it terms of time and or percentage achieved). I wanted to
deal with user cancellation requests and the rollback (free memory, close
files) associated with it.
Moreover I had to encapsulate logs, warning, errors and debugging
informations into specific interfaces so that my code could be used in
GUI-based application as well in console mode or in COM components (here
Now I have (thread safe, customizable: ALL, some UNICODE compatible):
- an interface to memory management, usable with multiple threads, allowing
to define and manipulate memory spaces (clean the space of the thread just
stopped by user request), with customizable allocators;
- an interface to debug information, based on Fred Fish DBUG library used in
mysql (it allows to trace the execution of the code, to print selected
- an mprintf function to format messages in malloc'ed string (I have tested
also the UNICODE version) stolen from mktclapp from www.hwaci.com; this
maybe similar to R_printf;
- interfaces to errors, warnings, and log messages, with customizable
callbacks to send the content of the massages every where you can send a
char * or a wchar_t *; I followed the discussion on error handling on the
gsl mailing list and tried to implement the ideas in
http://t8web.lanl.gov/people/jungman/except.pdf I found quite interesting;
I would like to help with this code, if considered interesting.
Via Spartaco, 19, ITALY
Tel. + 39 02 55002251
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: firstname.lastname@example.org