Dear Christian Thank you for this extensive answer, I have now enough possibilities to try. Thanks to your grep samples I will first try grep. Since I am not a unix person but a Mac person, I realized that I do not like Emacs. For this reason I use NEdit as my editor of choice. Best regards Christian Christian Holm Christensen wrote: > Hi Name-brother, et al, > > On Fri, 08 Mar 2002 20:08:15 +0100 > "cstrato@EUnet.at" <cstrato@EUnet.at> wrote > concerning "Re: [ROOT] TSQLServer::Query enhancement request: FORM ??": > > Dear Rooters > > > > The mail below is a good starting point for my questions: > > > > When trying to understand root code from the source, it is often hard > > for me to find the code of different functions: > > > > As example: > > 1, SafeDelete: In the ClassIndex it is not crossreferenced, so it took > > me some time to find that it was a macro. > > (Until recently, I did not know that lxr exists. Furthermore, I am > > offline most of the time at home and thus do not have immediate > > access to online-information, so I have to rely on the sourcecode) > > > > 2, Form: I still do not know what Form does and where to find it. > > In this case, even the following site is not very helpful: > > http://root.cern.ch/lxr/source/base/inc/TString.h#412 > > Is this a Root function or a general C function? I cannot find it in > > any of my C books? > > It's a function defined by ROOT. It's a bit tricky to use, since it > uses an internal buffer to construct the return string. Hence, the > pointer you get back is a pointer pointing to statically allocated > memory, and if you need to keep it, you must copy it somewhere > _immediatly_, since another `Form' (or `Format') may come along and > overwrite the memory. So, usually it's a good idea to use it like > > TString s(Form("pi is %f, and e is %g", TMath::Pi(), TMath::E())); > > BTW, ROOT team, is `Form' thread-safe? It doesn't look it. A mutex > (marco?) would probably be a good idea. > > > Maybe root could contain in the sourcecode somewhere a file, > > which lists all non-method and other functions and where to find > > their definitions? > > I know it's a pain in the ..., but sometimes the easiest way to find > such stuff, is to `grep' for it: > > prompt% grep 'Form' root/*/src/*.cxx | less > prompt% grep 'SafeDelete' root/*/src/*.cxx | less > > The later will probably bare no fruit, as SafeDelete is a macro, > defined in a header, so you'll have to try > > prompt% grep 'SafeDelete' root/*/inc/*.h | less > > You can also try to `grep' the `LinkDef*.h' files for defintions, > though that will not help you with macros. > > prompt% grep Form root/*/inc/LinkDef*.h > root/base/inc/LinkDef1.h:#pragma link C++ function Form; > > This gives you at least an idea which directory to look in. Finally, > there exists numerous tools to index source trees. There's an Emacs > library called `oo-browser' which can do quite a lot of stuff. You > can ofcourse also make an Emacs tag file, like > > prompt% find root -name "*.h" -or -name "*.cxx" \ > -or -name "*.C" -or -name "*.c" | xargs etags > > and use that from inside Emacs to look for functions, ladida, doing > > M-x tags-search RET <search term> RET > > The package doc++ also does a fairly good job at indexing source > tree's. Unfortunately, the way doc++ and ROOT markes up the code for > documetation is not compatible, so you need to `docify' the source > tree first. `doc++' uses a Java like syntax: > > /** This is a long documentation of the class HelloWorld, that is a > simple class to write out the string `hello world' */ > class HelloWorld { > private: > /// Short documentatation of a a member: The message of the class > const char* fMessage; > public: > /// HelloWorld constructor. You can change the message if you like > HelloWorld(const char* msg="hello world") : fMessage(msg) {} > > /// Do the stuff > void DoIt() { cout << fMessage << endl; } > > /** Main method. If this looks a bit Java like to you, then it's > because it is :-). In doc++ we can use a subset of \LaTeX > commands, {\Large great} \emph{fun} */ > static int Main(int argc, char** argv) { > HelloWorld* h = 0; > if (argc > 1) > h = new HelloWorld(argv[1]); > else > h = new HelloWorld(); > h->DoIt(); > return 0; > } > }; > > /// We can also document functions if we like > int main(int argc, char** argv) { > return HelloWorld::Main(argc, argv); > } > > Just a few ideas. > > Yours, > > Christian Holm Christensen ------------------------------------------- > Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91 > DK-2200 Copenhagen N Cell: (+45) 28 82 16 23 > Denmark Office: (+45) 353 25 305 > Email: cholm@nbi.dk Web: www.nbi.dk/~cholm
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:45 MET