From luke@goose.stat.umn.edu  Mon Dec  4 17:14:03 2000
From: luke@goose.stat.umn.edu (Luke Tierney)
Date: Mon, 4 Dec 2000 11:14:03 -0600 (CST)
Subject: [Rd] device drivers
Message-ID: <200012041714.LAA18450@goose.stat.umn.edu>

Unless you are maintaining a device driver for R, you can ignore this
note.

If you are, two issues have come up: the need to make sure there is a
slot available for a device before allocating it and, on unix at
least, the need to turn off interrupts during device initialization.

Currently typical device driver code starts the device something like this:

	if (!(dd = (DevDesc *) malloc(sizeof(DevDesc))))
	    return 0;
	...
	addDevice(dd);
	initDisplayList(dd);

To address these two problems in a device driver for R 1.2 this should
be changed to

    R_CheckDeviceAvailable();
    BEGIN_SUSPEND_INTERRUPTS {
	if (!(dd = (DevDesc *) malloc(sizeof(DevDesc))))
	    return 0;
        ...
	addDevice(dd);
	initDisplayList(dd);
    } END_SUSPEND_INTERRUPTS;

[Better yet, in case this changes before release, have a look at the
corresponding section of do_PS in the released sources.]

luke

-- 
Luke Tierney
University of Minnesota                      Phone:           612-625-7843
School of Statistics                         Fax:             612-624-8868
313 Ford Hall, 224 Church St. S.E.           email:      luke@stat.umn.edu
Minneapolis, MN 55455 USA                    WWW:  http://www.stat.umn.edu
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] device drivers
Luke Tierney