Hi,
pcre.h contains some macro (in the C #define sense) syntax that CINT
does not handle well. In order to use it you need to use rootcint
option '-p'
rootcint -f pcreDict.C -c -p pcre++.h pcreLinkDef.h
Also I recommend that you do NOT name your dictionar pcre.C (as in
your example) since this would produce a pcre.h which will conflict
with th real pcre.h.
Using '.x sample.C' will only work once you build and loaded a
shared library with the TPcre dictionary.
Cheers,
Philippe.
-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Ashley Cambrell
Sent: Saturday, March 30, 2002 9:33 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] PCRE regular expression class
Hi All,
I've just discovered Carrot (from slashdot) and have been playing around
with root and I've seemed to have struck trouble. I couldn't find a
pcre compatible class so I though I might try my hand at writing a
wrapper for pcre. I found a C++ class called pcre++ which looks very
close to what I need.
Just for starters I thought I might see if it compiled straight after
adding a ClassDef(TPcre,0) to the class definition (after changing the
class name to TPcre from Pcre (for "convention" ;-) ).
[I actually thought it might barf on the use of vector<int> etc but
after some testing in a test file it seemed to do what it was meant to :-) ]
Using the supplied pcre++ sample.cc I tried to compile it and I get
root [11] .x sample.C
Error: Too many '}' FILE:/usr/include/pcre.h LINE:107
If I do the naughty thing and drop down to root (user) and edit the file
and take out the
#ifdef __cplusplus
extern "C" {
#endif
and
#ifdef __cplusplus
}
#endif
and try to compile it I get:
root [12] .x sample.C
Error: Unexpected EOF G__fignorestream():3 FILE:/usr/include/pcre.h LINE:111
I got this error once before when I had forgotten to close a bracket
ie
void test()
{
TString s4("blah blah" //<--
//more stuff
}
but it's a normal system header, written by somebody who is infinitely
more able than me, so obviously there isn't (normall) any missing
bracket...
Is root missing something?
Event a straight..
rootcint pcre.C -c pcre++.h
Error: Too many '}' FILE:/usr/include/pcre.h LINE:107
Note: link requested for unknown class pcre FILE:G__auto17678LinkDef.h
LINE:7
Warning: Error occured during reading source files
Warning: Error occured during dictionary source generation
!!!Removing pcre.C pcre.h !!!
rootcint: error loading headers...
fails, yet the library compiles fine with g++
The smart question to ask first would be:
1. Has anyone written a pcre compatible class?
2. If not, anyone know why root might be failing with the brackets?
(I didn't change much in the normal distro of pcre++ so I'll just
provide the link to it instead of attaching it)
ftp://ftp.daemon.de/scip/Apps/pcre++/pcre++-0.4.tar.gz
Thanks Everyone!
Ashley Cambrell
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:48 MET