From: Maurice L. <mj...@ga...> - 2003-10-12 19:49:08
|
Henning Thielemann writes: > The current implementation seems to depend heavily on global variables in > the plplot library. By the way I'm wondering how this was possible in a > project which was initiated on Amiga computers because Amiga shared > libraries are reentrant and cannot manage task relative global data. So > Amiga library programmers was always forced to make interfaces in the > black box handle style. My first experience with building shared libraries was on HPUX, which occurred several years after my last significant development work on the Amiga. As such, global vars had creeped into the code, and didn't seem to pose a problem under HPUX. E.g. the stream pointer, plsc. This var exists only for convenience, not necessity. So implementing a change like what you propose: > Indeed I'd be more glad if the library works with black box handles and > functions that manipulates them. A program invoking plplot would then look > more like: > > PLWindow *win = plopenoutput(specs); > plline(win,data,...); > plcloseoutput(win); > > or > > PLWindow *win = plopenoutput(specs); > PLWindow **arrayof4winhandles = plsubplots(win,2,2); > plline(arrayof4winhandles[0],data0,...); > plpoin(arrayof4winhandles[1],data1,...); > ... > plcloseoutput(win); would be fairly straightforward, I think. > I think that there are many programs around that rely on the current > interface but what one could do is to provide an "easy" and an "expert" > interface. The "easy" interface is the current one which will be silently > mapped to the more flexible "expert" one. Yes, this will require much > restructuring effort ... I'm not so sure there would be so many programs affected if we were to abolish all global vars, in favor of function calls. Do we actually advertise the existence of any global vars in the API docs? If not, then any program breakage would be due to not following "the rules". I don't think any of my projects, for example, would be affected by such a change. Opinions? -- Maurice LeBrun Lightspeed Semiconductor Corp |