From: Daniel J S. <dan...@ie...> - 2006-08-03 19:35:50
|
Ethan Merritt wrote: > On Thursday 03 August 2006 12:10 pm, Daniel J Sebald wrote: > >>>Better yet would be to figure out a way to make all.dem itself >>>recognize and skip unsupported demos, but to my recollection past >>>discussions never came up with a reasonable way to do that. >> >>I think a function that allows executing a command without falling >>back to the command line would be nice. Say "attempt" > > > Maybe, but it wouldn't actually help in the case of all.dem. > Falling back to the command line would leave you in the middle of > a sequence of now-useless commands. What we need for the demo > case is some way of skipping the demo altogether. Well, that sort of is the limitation. I mean, if attempt("plot 'foo.dat' with foos") load 'foo.dem' : print "no foo" would be sort of like putting the first line of your demo inside "all.dem", which is a bit silly. But if there were some way of calling a command that would verify the existence of the support, i.e., "set style"... eh, still nothing elegant. > > Hmm. I've got an idea that wouldn't have been possible before. > > Now that we have all these GPVAL_*** variables, maybe > we should load one with the conditional compilation flags as > reported by "show version long". > > gnuplot> print GPVAL_COMPILE_OPTIONS > -READLINE +LIBREADLINE +HISTORY +BACKWARDS_COMPATIBILITY > +BINARY_DATA +GD_PNG +GD_JPEG +GD_TTF +GD_GIF +ANIMATION -NOCWDRC > +X11 +X11_POLYGON +MULTIBYTE +USE_MOUSE +HIDDEN3D_QUADTREE > +DATASTRINGS +HISTOGRAMS +OBJECTS +STRINGVARS +MACROS +IMAGE > > > Then we could do > > if (strstrt(GPVAL_COMPILE_OPTIONS,"+IMAGE")) load "image.dem" > > Anyone see anything wrong with this approach? Sounds alright to me. This would be a variable the user can't alter, right? I like it. Would you want to specifically require the + and - settings? I'm thinking of "backward" and "forward" compatibility here. In later versions of gnuplot, some of these options may no longer be present because they are no longer options... So that means we'd want to condition on the "negative presence" of an option? I.e. if (!strstrt(GPVAL_COMPILE_OPTIONS,"-IMAGE")) load "image.dem" I think (?) Dan |