Re: How to do grafics w/o interpreter?

Valery Fine (fine@mail.cern.ch)
Mon, 28 Jul 1997 20:57:45 +0100


On 28 Jul 97 at 18:21, merzky@zib.de wrote:

> // Hello!
>
> // These days I tried to use ROOT to draw some histograms like the ones
> // shown at the ROOT webpages. It didn't work...
>
> // Well, it's fine to have a C Interpreter, but I liked to use ROOT's
> // functions in compiled programs. I hoped: some calls, and I
> have a pic/histogram...
>
> // Why doesn't it work?
> // It compiles w/o problems, but gives no output, esp. no grafical...
> // Didn't I correctly understood the idea of ROOT at all? It seems to work fine
> // via the interpreter (ROOT shell)...
>
> // Sincerly yours, Andre Merzky.
>

I'd like to highlight that on the your question

"How to do graphics w/o interpreter?"

The right answer will be

"NO WAY" !!!

No way you can do any graphics without interpreter?. The way
proposed one can do graphics without "Line mode Command PROMPT". If
one doesn't see any prompt this DOESN'T mean he DOESN'T use our
interpreter.

Why? Because ANY ROOT-base interactive program needs the C++ interpreter
internally.

Speaking of the "graphics output" the instance of the TCanvas
object is assumed to be created. But TCanvas object is a tool of the
INTERACTION with ROOT-base program. First of all it is a tool to
INPUT the user's "wishes" and then to provide some graphics
response. It uses CINT as soon as the "command line prompt".
(For example one wants to be able to MOVE / RESIZE /
Minimize a window on the screen and get a "normal" image after any of
such sort of the "simple" interaction.)

This means NO way your stand-alone program is simpler that our
"FULL" ROOT. I would say it is at least as complicate as ROOT .

To prove this just compare the ROOT code and the code of HWORD.cxx
example we do provide.

Therefore I'd like to repeat what I had said on this list. One
needs a quite strong reason to use stand-alone program with a
graphics output. The idea "this program will be lighter / smaller /
faster because it will not use CINT" is wrong. So the recommended way
is to use either ROOT macro or create a ROOT DLLs and share libs.
After all it saves you a huge amount of time.

Hope this helps.
Valery

======= Appendix RMAIN.cxx ===========
//////////////////////////////////////////////////////////////////////////
// //
// RMain //
// //
// Main program used to create RINT application. //
// //
//////////////////////////////////////////////////////////////////////////

//*KEEP,TROOT.
#include "TROOT.h"
//*KEEP,TRint.
#include "TRint.h"
//*KEND.

extern void InitGui();

int Error; // needed by Motif

VoidFuncPtr_t initfuncs[] = { InitGui, 0 };

TROOT root("Rint","The ROOT Interactive Interface", initfuncs);

//______________________________________________________________________________
int main(int argc, char **argv)
{
TRint *theApp = new TRint("Rint", &argc, argv, 0, 0);

// Init Intrinsics, build all windows, and enter event loop
theApp->Run();

delete theApp;

return(0);
}
=================================================================
Dr. Valery Fine Telex : 911621 dubna su
-----------
LCTA/Joint Inst.for NuclearRes Phone : +7 09621 6 40 80
141980 Dubna, Moscow region Fax : +7 09621 6 51 45
Russia mailto:fine@main1.jinr.dubna.su

Dr. Valeri Faine
------------ Phone: +41 22 767 6468
CERN FAX : +41 22 767 7910
CH-1211 Geneva, 23 mailto:fine@mail.cern.ch
Switzerland http://nicewww.cern.ch/~fine